summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.appveyor.yml24
-rw-r--r--.gitignore1
-rw-r--r--.travis.yml18
-rw-r--r--README.md3
-rw-r--r--SConstruct115
-rw-r--r--compat.py29
-rw-r--r--core/SCsub21
-rw-r--r--core/array.cpp15
-rw-r--r--core/array.h6
-rw-r--r--core/bind/core_bind.cpp24
-rw-r--r--core/bind/core_bind.h7
-rw-r--r--core/class_db.cpp10
-rw-r--r--core/class_db.h8
-rw-r--r--core/core_string_names.cpp23
-rw-r--r--core/core_string_names.h27
-rw-r--r--core/engine.cpp4
-rw-r--r--core/engine.h8
-rw-r--r--core/error_list.h2
-rw-r--r--core/error_macros.cpp3
-rw-r--r--core/error_macros.h21
-rw-r--r--core/global_constants.cpp2
-rw-r--r--core/image.cpp10
-rw-r--r--core/io/compression.cpp2
-rw-r--r--core/io/file_access_buffered_fa.h5
-rw-r--r--core/io/file_access_compressed.cpp7
-rw-r--r--core/io/file_access_compressed.h1
-rw-r--r--core/io/file_access_encrypted.cpp6
-rw-r--r--core/io/file_access_encrypted.h1
-rw-r--r--core/io/file_access_memory.cpp4
-rw-r--r--core/io/file_access_memory.h1
-rw-r--r--core/io/file_access_network.cpp4
-rw-r--r--core/io/file_access_network.h1
-rw-r--r--core/io/file_access_pack.cpp5
-rw-r--r--core/io/file_access_pack.h1
-rw-r--r--core/io/file_access_zip.cpp5
-rw-r--r--core/io/file_access_zip.h1
-rw-r--r--core/io/http_client.cpp2
-rw-r--r--core/io/logger.cpp266
-rw-r--r--core/io/logger.h107
-rw-r--r--core/io/marshalls.cpp3
-rw-r--r--core/io/resource_import.cpp2
-rw-r--r--core/io/resource_loader.cpp2
-rw-r--r--core/map.h319
-rw-r--r--core/object.cpp2
-rw-r--r--core/object.h6
-rw-r--r--core/os/file_access.cpp2
-rw-r--r--core/os/file_access.h1
-rw-r--r--core/os/os.cpp49
-rw-r--r--core/os/os.h32
-rw-r--r--core/project_settings.cpp22
-rw-r--r--core/project_settings.h5
-rw-r--r--core/register_core_types.cpp18
-rw-r--r--core/safe_refcount.cpp148
-rw-r--r--core/safe_refcount.h135
-rw-r--r--core/script_debugger_local.cpp10
-rw-r--r--core/script_debugger_local.h4
-rw-r--r--core/script_debugger_remote.cpp14
-rw-r--r--core/script_debugger_remote.h4
-rw-r--r--core/script_language.h2
-rw-r--r--core/set.h130
-rw-r--r--core/string_db.h3
-rw-r--r--core/translation.cpp2
-rw-r--r--core/typedefs.h8
-rw-r--r--core/ustring.cpp12
-rw-r--r--core/variant.cpp4
-rw-r--r--core/variant.h1
-rw-r--r--core/variant_call.cpp70
-rw-r--r--core/variant_op.cpp560
-rw-r--r--doc/Makefile2
-rw-r--r--doc/classes/@Global Scope.xml2
-rw-r--r--doc/classes/@VisualScript.xml2
-rw-r--r--doc/classes/ARVRAnchor.xml7
-rw-r--r--doc/classes/ARVRInterface.xml88
-rw-r--r--doc/classes/ARVRScriptInterface.xml43
-rw-r--r--doc/classes/ARVRServer.xml32
-rw-r--r--doc/classes/AcceptDialog.xml2
-rw-r--r--doc/classes/AnimatedSprite.xml14
-rw-r--r--doc/classes/AnimatedSprite3D.xml8
-rw-r--r--doc/classes/Animation.xml4
-rw-r--r--doc/classes/Area.xml47
-rw-r--r--doc/classes/Area2D.xml75
-rw-r--r--doc/classes/Array.xml15
-rw-r--r--doc/classes/AudioBusLayout.xml2
-rw-r--r--doc/classes/AudioEffectAmplify.xml9
-rw-r--r--doc/classes/AudioEffectCompressor.xml15
-rw-r--r--doc/classes/AudioEffectDelay.xml16
-rw-r--r--doc/classes/AudioEffectDistortion.xml13
-rw-r--r--doc/classes/AudioEffectEQ.xml6
-rw-r--r--doc/classes/AudioEffectEQ10.xml15
-rw-r--r--doc/classes/AudioEffectEQ21.xml26
-rw-r--r--doc/classes/AudioEffectEQ6.xml11
-rw-r--r--doc/classes/AudioEffectLimiter.xml6
-rw-r--r--doc/classes/AudioEffectPanner.xml3
-rw-r--r--doc/classes/AudioEffectPhaser.xml8
-rw-r--r--doc/classes/AudioEffectPitchShift.xml4
-rw-r--r--doc/classes/AudioEffectReverb.xml11
-rw-r--r--doc/classes/AudioServer.xml37
-rw-r--r--doc/classes/AudioStreamPlayback.xml2
-rw-r--r--doc/classes/AudioStreamPlayer.xml12
-rw-r--r--doc/classes/AudioStreamPlayer2D.xml7
-rw-r--r--doc/classes/AudioStreamPlayer3D.xml7
-rw-r--r--doc/classes/BackBufferCopy.xml10
-rw-r--r--doc/classes/BitMap.xml3
-rw-r--r--doc/classes/Camera.xml31
-rw-r--r--doc/classes/Camera2D.xml14
-rw-r--r--doc/classes/CanvasItem.xml2
-rw-r--r--doc/classes/CanvasModulate.xml5
-rw-r--r--doc/classes/CollisionObject.xml26
-rw-r--r--doc/classes/CollisionObject2D.xml33
-rw-r--r--doc/classes/CollisionPolygon2D.xml14
-rw-r--r--doc/classes/ColorRect.xml4
-rw-r--r--doc/classes/Control.xml137
-rw-r--r--doc/classes/ConvexPolygonShape.xml5
-rw-r--r--doc/classes/ConvexPolygonShape2D.xml5
-rw-r--r--doc/classes/Directory.xml1
-rw-r--r--doc/classes/EditorResourceConversionPlugin.xml29
-rw-r--r--doc/classes/EditorResourcePreview.xml4
-rw-r--r--doc/classes/EditorSpatialGizmo.xml2
-rw-r--r--doc/classes/Engine.xml19
-rw-r--r--doc/classes/Environment.xml86
-rw-r--r--doc/classes/File.xml98
-rw-r--r--doc/classes/FuncRef.xml5
-rw-r--r--doc/classes/Gradient.xml4
-rw-r--r--doc/classes/GraphEdit.xml6
-rw-r--r--doc/classes/GridContainer.xml1
-rw-r--r--doc/classes/ImageTexture.xml5
-rw-r--r--doc/classes/ImmediateGeometry.xml19
-rw-r--r--doc/classes/JSON.xml4
-rw-r--r--doc/classes/JSONParseResult.xml14
-rw-r--r--doc/classes/KinematicBody.xml18
-rw-r--r--doc/classes/KinematicBody2D.xml22
-rw-r--r--doc/classes/Label.xml23
-rw-r--r--doc/classes/LargeTexture.xml22
-rw-r--r--doc/classes/Light2D.xml14
-rw-r--r--doc/classes/Line2D.xml26
-rw-r--r--doc/classes/OS.xml98
-rw-r--r--doc/classes/Particles.xml16
-rw-r--r--doc/classes/Particles2D.xml20
-rw-r--r--doc/classes/ParticlesMaterial.xml68
-rw-r--r--doc/classes/Performance.xml39
-rw-r--r--doc/classes/Polygon2D.xml16
-rw-r--r--doc/classes/Range.xml9
-rw-r--r--doc/classes/RayShape.xml3
-rw-r--r--doc/classes/RegEx.xml10
-rw-r--r--doc/classes/RegExMatch.xml10
-rw-r--r--doc/classes/RichTextLabel.xml12
-rw-r--r--doc/classes/Shape.xml2
-rw-r--r--doc/classes/SpatialMaterial.xml80
-rw-r--r--doc/classes/SphereShape.xml3
-rw-r--r--doc/classes/Sprite.xml16
-rw-r--r--doc/classes/Sprite3D.xml9
-rw-r--r--doc/classes/SpriteBase3D.xml17
-rw-r--r--doc/classes/SpriteFrames.xml18
-rw-r--r--doc/classes/StaticBody2D.xml9
-rw-r--r--doc/classes/TextureButton.xml21
-rw-r--r--doc/classes/TextureProgress.xml34
-rw-r--r--doc/classes/Transform2D.xml2
-rw-r--r--doc/classes/Tree.xml70
-rw-r--r--doc/classes/TreeItem.xml61
-rw-r--r--doc/classes/VideoPlayer.xml9
-rw-r--r--doc/classes/VisualScript.xml48
-rw-r--r--doc/classes/VisualScriptBasicTypeConstant.xml4
-rw-r--r--doc/classes/VisualScriptBuiltinFunc.xml62
-rw-r--r--doc/classes/VisualScriptClassConstant.xml4
-rw-r--r--doc/classes/VisualScriptComment.xml6
-rw-r--r--doc/classes/VisualScriptCondition.xml9
-rw-r--r--doc/classes/VisualScriptConstant.xml4
-rw-r--r--doc/classes/VisualScriptConstructor.xml20
-rw-r--r--doc/classes/VisualScriptCustomNode.xml32
-rw-r--r--doc/classes/VisualScriptDeconstruct.xml3
-rw-r--r--doc/classes/VisualScriptEmitSignal.xml3
-rw-r--r--doc/classes/VisualScriptEngineSingleton.xml3
-rw-r--r--doc/classes/VisualScriptNode.xml13
-rw-r--r--doc/classes/VisualScriptOperator.xml7
-rw-r--r--doc/classes/VisualScriptSceneNode.xml7
-rw-r--r--doc/tools/doc_status.py74
-rw-r--r--doc/tools/makerst.py54
-rw-r--r--drivers/SCsub9
-rw-r--r--drivers/coreaudio/SCsub8
-rw-r--r--drivers/coreaudio/audio_driver_coreaudio.cpp (renamed from platform/osx/audio_driver_osx.cpp)56
-rw-r--r--drivers/coreaudio/audio_driver_coreaudio.h (renamed from platform/osx/audio_driver_osx.h)20
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp96
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.h9
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp12
-rw-r--r--drivers/gles3/shader_compiler_gles3.cpp14
-rw-r--r--drivers/gles3/shaders/canvas.glsl12
-rw-r--r--drivers/gles3/shaders/copy.glsl24
-rw-r--r--drivers/gles3/shaders/scene.glsl246
-rw-r--r--drivers/gles3/shaders/subsurf_scattering.glsl25
-rw-r--r--drivers/png/SCsub2
-rw-r--r--drivers/unix/file_access_unix.cpp6
-rw-r--r--drivers/unix/file_access_unix.h1
-rw-r--r--drivers/unix/os_unix.cpp101
-rw-r--r--drivers/unix/os_unix.h14
-rw-r--r--drivers/unix/syslog_logger.cpp71
-rw-r--r--drivers/unix/syslog_logger.h48
-rw-r--r--drivers/windows/dir_access_windows.cpp2
-rw-r--r--drivers/windows/file_access_windows.cpp6
-rw-r--r--drivers/windows/file_access_windows.h1
-rw-r--r--editor/SCsub24
-rw-r--r--editor/animation_editor.cpp7
-rw-r--r--editor/code_editor.cpp31
-rw-r--r--editor/create_dialog.cpp28
-rw-r--r--editor/create_dialog.h5
-rw-r--r--editor/dependency_editor.cpp13
-rw-r--r--editor/editor_asset_installer.cpp2
-rw-r--r--editor/editor_audio_buses.cpp51
-rw-r--r--editor/editor_audio_buses.h4
-rw-r--r--editor/editor_autoload_settings.cpp6
-rw-r--r--editor/editor_export.cpp8
-rw-r--r--editor/editor_file_dialog.cpp19
-rw-r--r--editor/editor_file_dialog.h3
-rw-r--r--editor/editor_file_system.cpp2
-rw-r--r--editor/editor_fonts.cpp23
-rw-r--r--editor/editor_help.cpp32
-rw-r--r--editor/editor_log.cpp16
-rw-r--r--editor/editor_node.cpp94
-rw-r--r--editor/editor_node.h6
-rw-r--r--editor/editor_plugin.cpp4
-rw-r--r--editor/editor_plugin_settings.cpp8
-rw-r--r--editor/editor_profiler.cpp8
-rw-r--r--editor/editor_profiler.h6
-rw-r--r--editor/editor_settings.cpp410
-rw-r--r--editor/editor_settings.h19
-rw-r--r--editor/editor_themes.cpp298
-rw-r--r--editor/export_template_manager.cpp8
-rw-r--r--editor/filesystem_dock.cpp20
-rw-r--r--editor/icons/icon_2_d.svg4
-rw-r--r--editor/icons/icon_3_d.svg4
-rw-r--r--editor/icons/icon_GUI_dropdown.svg6
-rw-r--r--editor/icons/icon_GUI_h_tick.svg3
-rw-r--r--editor/icons/icon_GUI_mini_checkerboard.svg (renamed from editor/icons/icon_mini_checkerboard.svg)0
-rw-r--r--editor/icons/icon_GUI_mini_tab_menu.svg6
-rw-r--r--editor/icons/icon_GUI_tab_menu.svg6
-rw-r--r--editor/icons/icon_GUI_tree_option.svg5
-rw-r--r--editor/icons/icon_GUI_tree_updown.svg5
-rw-r--r--editor/icons/icon_GUI_v_tick.svg5
-rw-r--r--editor/icons/icon_accept_dialog.svg4
-rw-r--r--editor/icons/icon_add.svg4
-rw-r--r--editor/icons/icon_audio_bus_bypass.svg2
-rw-r--r--editor/icons/icon_audio_bus_mute.svg2
-rw-r--r--editor/icons/icon_audio_bus_solo.svg2
-rw-r--r--editor/icons/icon_connect.svg4
-rw-r--r--editor/icons/icon_editor_3d_handle.svg1
-rw-r--r--editor/icons/icon_editor_control_anchor.svg4
-rw-r--r--editor/icons/icon_editor_handle.svg9
-rw-r--r--editor/icons/icon_editor_pivot.svg2
-rw-r--r--editor/icons/icon_gizmo_camera.svg1
-rw-r--r--editor/icons/icon_gizmo_directional_light.svg1
-rw-r--r--editor/icons/icon_gizmo_g_i_probe.svg3
-rw-r--r--editor/icons/icon_gizmo_light.svg1
-rw-r--r--editor/icons/icon_gizmo_listener.svg1
-rw-r--r--editor/icons/icon_gizmo_particles.svg1
-rw-r--r--editor/icons/icon_gizmo_reflection_probe.svg5
-rw-r--r--editor/icons/icon_gizmo_spatial_sample_player.svg5
-rw-r--r--editor/icons/icon_gizmo_spatial_stream_player.svg5
-rw-r--r--editor/icons/icon_gizmo_spot_light.svg1
-rw-r--r--editor/icons/icon_group_viewport.svg7
-rw-r--r--editor/icons/icon_key.svg6
-rw-r--r--editor/icons/icon_key_move_disabled.svg4
-rw-r--r--editor/icons/icon_key_move_enabled.svg7
-rw-r--r--editor/icons/icon_key_rotate_disabled.svg4
-rw-r--r--editor/icons/icon_key_rotate_enabled.svg7
-rw-r--r--editor/icons/icon_key_scale_disabled.svg4
-rw-r--r--editor/icons/icon_key_scale_enabled.svg7
-rw-r--r--editor/icons/icon_lock.svg7
-rw-r--r--editor/icons/icon_lock_viewport.svg6
-rw-r--r--editor/icons/icon_matrix.svg5
-rw-r--r--editor/icons/icon_mini_color.svg6
-rw-r--r--editor/icons/icon_mini_image.svg5
-rw-r--r--editor/icons/icon_mini_input.svg5
-rw-r--r--editor/icons/icon_node_warning.svg6
-rw-r--r--editor/icons/icon_snap.svg2
-rw-r--r--editor/icons/icon_snap_grid.svg2
-rw-r--r--editor/icons/icon_status_error.svg3
-rw-r--r--editor/icons/icon_status_success.svg3
-rw-r--r--editor/icons/icon_status_warning.svg3
-rw-r--r--editor/icons/icon_unlock.svg6
-rw-r--r--editor/icons/icon_zoom_less.svg5
-rw-r--r--editor/icons/icon_zoom_more.svg5
-rw-r--r--editor/icons/icon_zoom_reset.svg5
-rw-r--r--editor/import/resource_importer_obj.cpp172
-rw-r--r--editor/import/resource_importer_obj.h22
-rw-r--r--editor/import_dock.cpp4
-rw-r--r--editor/plugins/abstract_polygon_2d_editor.cpp619
-rw-r--r--editor/plugins/abstract_polygon_2d_editor.h131
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp2
-rw-r--r--editor/plugins/animation_tree_editor_plugin.cpp4
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp4
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp385
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h75
-rwxr-xr-x[-rw-r--r--]editor/plugins/collision_polygon_2d_editor_plugin.cpp396
-rwxr-xr-x[-rw-r--r--]editor/plugins/collision_polygon_2d_editor_plugin.h60
-rw-r--r--editor/plugins/cube_grid_theme_editor_plugin.cpp4
-rw-r--r--editor/plugins/curve_editor_plugin.cpp34
-rw-r--r--editor/plugins/light_occluder_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/material_editor_plugin.cpp46
-rw-r--r--editor/plugins/material_editor_plugin.h10
-rw-r--r--editor/plugins/mesh_editor_plugin.cpp4
-rw-r--r--editor/plugins/navigation_mesh_generator.cpp4
-rwxr-xr-x[-rw-r--r--]editor/plugins/navigation_polygon_editor_plugin.cpp500
-rwxr-xr-x[-rw-r--r--]editor/plugins/navigation_polygon_editor_plugin.h74
-rw-r--r--editor/plugins/path_2d_editor_plugin.cpp2
-rwxr-xr-x[-rw-r--r--]editor/plugins/polygon_2d_editor_plugin.cpp416
-rwxr-xr-x[-rw-r--r--]editor/plugins/polygon_2d_editor_plugin.h61
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.cpp4
-rw-r--r--editor/plugins/script_editor_plugin.cpp9
-rw-r--r--editor/plugins/script_text_editor.cpp50
-rw-r--r--editor/plugins/script_text_editor.h12
-rw-r--r--editor/plugins/shader_graph_editor_plugin.cpp2
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp421
-rw-r--r--editor/plugins/spatial_editor_plugin.h6
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp4
-rw-r--r--editor/plugins/style_box_editor_plugin.cpp2
-rw-r--r--editor/plugins/texture_editor_plugin.cpp2
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp17
-rw-r--r--editor/plugins/theme_editor_plugin.cpp6
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp46
-rw-r--r--editor/plugins/tile_map_editor_plugin.h1
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp4
-rw-r--r--editor/progress_dialog.cpp4
-rw-r--r--editor/project_export.cpp8
-rw-r--r--editor/project_manager.cpp359
-rw-r--r--editor/project_manager.h4
-rw-r--r--editor/project_settings_editor.cpp31
-rw-r--r--editor/property_editor.cpp102
-rw-r--r--editor/property_editor.h16
-rw-r--r--editor/scene_tree_dock.cpp12
-rw-r--r--editor/scene_tree_editor.cpp4
-rw-r--r--editor/script_editor_debugger.cpp21
-rw-r--r--editor/settings_config_dialog.cpp7
-rw-r--r--editor/spatial_editor_gizmos.cpp4
-rw-r--r--main/input_default.cpp14
-rw-r--r--main/input_default.h2
-rw-r--r--main/main.cpp65
-rw-r--r--main/performance.cpp14
-rw-r--r--main/performance.h6
-rw-r--r--methods.py10
-rw-r--r--misc/dist/ios_xcode/export_options.plist10
-rwxr-xr-xmisc/dist/ios_xcode/godot.iphone.debug.arm (renamed from misc/dist/ios_xcode/godot_debug.iphone)0
-rwxr-xr-xmisc/dist/ios_xcode/godot.iphone.debug.arm64 (renamed from misc/dist/ios_xcode/godot_opt.iphone)0
-rwxr-xr-xmisc/dist/ios_xcode/godot.iphone.debug.fat0
-rwxr-xr-xmisc/dist/ios_xcode/godot.iphone.release.arm0
-rwxr-xr-xmisc/dist/ios_xcode/godot.iphone.release.arm640
-rwxr-xr-xmisc/dist/ios_xcode/godot.iphone.release.fat0
-rw-r--r--misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj198
-rw-r--r--misc/dist/ios_xcode/godot_ios.xcodeproj/project.xcworkspace/contents.xcworkspacedata2
-rw-r--r--misc/dist/ios_xcode/godot_ios.xcodeproj/xcshareddata/xcschemes/godot_ios.xcscheme93
-rw-r--r--misc/dist/ios_xcode/godot_ios/Default-568h@2x.png (renamed from misc/dist/ios_xcode/godot_ios/Default-568h@2x~iphone.png)bin564 -> 564 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Default-667h.pngbin683 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Default-736h@3x.pngbin2582 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Default-Landscape-1366h@2x.pngbin0 -> 32836 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Default-Landscape-736h@3x.png (renamed from misc/dist/ios_xcode/godot_ios/Default-Landscape-736h.png)bin2582 -> 2582 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Default-Landscape@2x.png (renamed from misc/dist/ios_xcode/godot_ios/Default-Landscape@2x~ipad.png)bin3131 -> 3131 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Default-Landscape~ipad.pngbin634 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Default-Portrait-1366h@2x.pngbin0 -> 33309 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Default-Portrait-736h@3x.png (renamed from misc/dist/ios_xcode/godot_ios/Default-736h.png)bin1676 -> 1676 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Default-Portrait@2x.pngbin0 -> 33309 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Default-Portrait@2x~ipad.pngbin3070 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Default-Portrait~ipad.pngbin589 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Default@2x~iphone.pngbin515 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Default~iphone.pngbin309 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Contents.json128
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-100.pngbin250 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-114.pngbin253 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-120.pngbin253 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-144.pngbin259 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-152.pngbin260 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-180.pngbin265 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-29.pngbin242 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-40.pngbin240 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-50.pngbin243 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-57.pngbin243 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-58.pngbin243 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-60.pngbin244 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-72.pngbin244 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-76.pngbin246 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-80.pngbin245 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-167.pngbin262 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-87.pngbin247 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/sizes17
-rw-r--r--misc/dist/ios_xcode/godot_ios/godot_ios-Info.plist15
-rw-r--r--misc/dist/ios_xcode/godot_ios/godot_ios.entitlements8
-rw-r--r--misc/dist/linux/godot.6165
-rw-r--r--misc/dist/linux/godot.appdata.xml34
-rw-r--r--misc/dist/linux/godot.desktop9
-rwxr-xr-xmisc/dist/osx_tools.app/Contents/Info.plist4
-rw-r--r--modules/enet/SCsub2
-rw-r--r--modules/etc/config.py4
-rw-r--r--modules/freetype/SCsub4
-rw-r--r--modules/gdnative/SCsub143
-rw-r--r--modules/gdnative/gd_native_library_editor.cpp4
-rw-r--r--modules/gdnative/gdnative.cpp18
-rw-r--r--modules/gdnative/gdnative.h2
-rw-r--r--modules/gdnative/gdnative/gdnative.cpp2
-rw-r--r--modules/gdnative/gdnative/string_name.cpp91
-rw-r--r--modules/gdnative/gdnative_api.json5234
-rw-r--r--modules/gdnative/include/gdnative/gdnative.h22
-rw-r--r--modules/gdnative/include/gdnative/string_name.h68
-rw-r--r--modules/gdnative/include/gdnative_api_struct.h723
-rw-r--r--modules/gdnative/include/nativescript/godot_nativescript.h36
-rw-r--r--modules/gdnative/nativescript/SCsub3
-rw-r--r--modules/gdnative/nativescript/api_generator.cpp6
-rw-r--r--modules/gdnative/register_types.cpp1
-rw-r--r--modules/gdscript/gd_editor.cpp3
-rw-r--r--modules/gdscript/gd_function.cpp313
-rw-r--r--modules/gridmap/grid_map.cpp15
-rw-r--r--modules/gridmap/grid_map.h2
-rw-r--r--modules/mobile_vr/SCsub13
-rw-r--r--modules/mobile_vr/config.py12
-rw-r--r--modules/mobile_vr/doc_classes/MobileVRInterface.xml134
-rw-r--r--modules/mobile_vr/mobile_interface.cpp504
-rw-r--r--modules/mobile_vr/mobile_interface.h152
-rw-r--r--modules/mobile_vr/register_types.cpp43
-rw-r--r--modules/mobile_vr/register_types.h31
-rw-r--r--modules/mobile_vr/shaders/SCsub7
-rw-r--r--modules/mobile_vr/shaders/lens_distorted.glsl59
-rw-r--r--modules/mono/SCsub121
-rw-r--r--modules/mono/config.py143
-rw-r--r--modules/mono/csharp_script.cpp1923
-rw-r--r--modules/mono/csharp_script.h338
-rw-r--r--modules/mono/doc_classes/@C#.xml15
-rw-r--r--modules/mono/doc_classes/CSharpScript.xml21
-rw-r--r--modules/mono/doc_classes/GodotSharp.xml43
-rw-r--r--modules/mono/editor/GodotSharpTools/Build/BuildSystem.cs343
-rw-r--r--modules/mono/editor/GodotSharpTools/Editor/MonoDevelopInstance.cs58
-rw-r--r--modules/mono/editor/GodotSharpTools/GodotSharpTools.csproj45
-rw-r--r--modules/mono/editor/GodotSharpTools/GodotSharpTools.sln17
-rw-r--r--modules/mono/editor/GodotSharpTools/GodotSharpTools.userprefs14
-rw-r--r--modules/mono/editor/GodotSharpTools/Project/ProjectExtensions.cs52
-rw-r--r--modules/mono/editor/GodotSharpTools/Project/ProjectGenerator.cs216
-rw-r--r--modules/mono/editor/GodotSharpTools/Project/ProjectUtils.cs17
-rw-r--r--modules/mono/editor/GodotSharpTools/Properties/AssemblyInfo.cs27
-rw-r--r--modules/mono/editor/GodotSharpTools/StringExtensions.cs52
-rw-r--r--modules/mono/editor/bindings_generator.cpp2142
-rw-r--r--modules/mono/editor/bindings_generator.h429
-rw-r--r--modules/mono/editor/csharp_project.cpp120
-rw-r--r--modules/mono/editor/csharp_project.h44
-rw-r--r--modules/mono/editor/godotsharp_builds.cpp482
-rw-r--r--modules/mono/editor/godotsharp_builds.h96
-rw-r--r--modules/mono/editor/godotsharp_editor.cpp256
-rw-r--r--modules/mono/editor/godotsharp_editor.h87
-rw-r--r--modules/mono/editor/mono_bottom_panel.cpp441
-rw-r--r--modules/mono/editor/mono_bottom_panel.h145
-rw-r--r--modules/mono/editor/mono_build_info.h64
-rw-r--r--modules/mono/editor/monodevelop_instance.cpp81
-rw-r--r--modules/mono/editor/monodevelop_instance.h50
-rw-r--r--modules/mono/editor/net_solution.cpp130
-rw-r--r--modules/mono/editor/net_solution.h57
-rw-r--r--modules/mono/glue/cs_files/Basis.cs520
-rw-r--r--modules/mono/glue/cs_files/Color.cs590
-rw-r--r--modules/mono/glue/cs_files/Error.cs48
-rw-r--r--modules/mono/glue/cs_files/ExportAttribute.cs19
-rw-r--r--modules/mono/glue/cs_files/GD.cs191
-rw-r--r--modules/mono/glue/cs_files/GodotMethodAttribute.cs17
-rw-r--r--modules/mono/glue/cs_files/GodotSynchronizationContext.cs26
-rw-r--r--modules/mono/glue/cs_files/GodotTaskScheduler.cs94
-rw-r--r--modules/mono/glue/cs_files/IAwaitable.cs12
-rw-r--r--modules/mono/glue/cs_files/IAwaiter.cs19
-rw-r--r--modules/mono/glue/cs_files/MarshalUtils.cs36
-rw-r--r--modules/mono/glue/cs_files/Mathf.cs234
-rw-r--r--modules/mono/glue/cs_files/Plane.cs209
-rw-r--r--modules/mono/glue/cs_files/Quat.cs328
-rw-r--r--modules/mono/glue/cs_files/RPCAttributes.cs16
-rw-r--r--modules/mono/glue/cs_files/Rect2.cs233
-rw-r--r--modules/mono/glue/cs_files/Rect3.cs477
-rw-r--r--modules/mono/glue/cs_files/SignalAwaiter.cs59
-rw-r--r--modules/mono/glue/cs_files/StringExtensions.cs962
-rw-r--r--modules/mono/glue/cs_files/ToolAttribute.cs7
-rw-r--r--modules/mono/glue/cs_files/Transform.cs174
-rw-r--r--modules/mono/glue/cs_files/Transform2D.cs356
-rw-r--r--modules/mono/glue/cs_files/Vector2.cs362
-rw-r--r--modules/mono/glue/cs_files/Vector3.cs420
-rw-r--r--modules/mono/glue/glue_header.h302
-rw-r--r--modules/mono/godotsharp_defs.h41
-rw-r--r--modules/mono/godotsharp_dirs.cpp185
-rw-r--r--modules/mono/godotsharp_dirs.h58
-rw-r--r--modules/mono/mono_gc_handle.cpp77
-rw-r--r--modules/mono/mono_gc_handle.h63
-rw-r--r--modules/mono/mono_gd/gd_mono.cpp767
-rw-r--r--modules/mono/mono_gd/gd_mono.h226
-rw-r--r--modules/mono/mono_gd/gd_mono_assembly.cpp356
-rw-r--r--modules/mono/mono_gd/gd_mono_assembly.h121
-rw-r--r--modules/mono/mono_gd/gd_mono_class.cpp381
-rw-r--r--modules/mono/mono_gd/gd_mono_class.h124
-rw-r--r--modules/mono/mono_gd/gd_mono_field.cpp362
-rw-r--r--modules/mono/mono_gd/gd_mono_field.h74
-rw-r--r--modules/mono/mono_gd/gd_mono_header.h59
-rw-r--r--modules/mono/mono_gd/gd_mono_internals.cpp66
-rw-r--r--modules/mono/mono_gd/gd_mono_internals.h42
-rw-r--r--modules/mono/mono_gd/gd_mono_log.cpp175
-rw-r--r--modules/mono/mono_gd/gd_mono_log.h (renamed from platform/iphone/audio_driver_iphone.h)49
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.cpp845
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.h218
-rw-r--r--modules/mono/mono_gd/gd_mono_method.cpp192
-rw-r--r--modules/mono/mono_gd/gd_mono_method.h81
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.cpp367
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.h182
-rw-r--r--modules/mono/mono_reg_utils.py58
-rw-r--r--modules/mono/register_types.cpp72
-rw-r--r--modules/mono/register_types.h31
-rw-r--r--modules/mono/signal_awaiter_utils.cpp77
-rw-r--r--modules/mono/signal_awaiter_utils.h53
-rw-r--r--modules/mono/utils/mono_reg_utils.cpp228
-rw-r--r--modules/mono/utils/mono_reg_utils.h54
-rw-r--r--modules/mono/utils/path_utils.cpp111
-rw-r--r--modules/mono/utils/path_utils.h53
-rw-r--r--modules/mono/utils/string_utils.cpp128
-rw-r--r--modules/mono/utils/string_utils.h38
-rw-r--r--modules/ogg/SCsub2
-rw-r--r--modules/openssl/SCsub2
-rw-r--r--modules/openssl/stream_peer_openssl.cpp60
-rw-r--r--modules/openssl/stream_peer_openssl.h5
-rw-r--r--modules/opus/SCsub4
-rw-r--r--modules/opus/audio_stream_opus.cpp6
-rw-r--r--modules/opus/audio_stream_opus.h4
-rw-r--r--modules/recast/SCsub6
-rw-r--r--modules/regex/SCsub2
-rw-r--r--modules/squish/SCsub2
-rw-r--r--modules/squish/config.py4
-rw-r--r--modules/stb_vorbis/audio_stream_ogg_vorbis.cpp8
-rw-r--r--modules/stb_vorbis/audio_stream_ogg_vorbis.h4
-rw-r--r--modules/svg/image_loader_svg.cpp2
-rw-r--r--modules/theora/SCsub6
-rw-r--r--modules/theora/video_stream_theora.cpp4
-rw-r--r--modules/theora/video_stream_theora.h4
-rw-r--r--modules/tinyexr/config.py4
-rw-r--r--modules/visual_script/visual_script.cpp5
-rw-r--r--modules/visual_script/visual_script_editor.cpp175
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp14
-rw-r--r--modules/visual_script/visual_script_nodes.cpp8
-rw-r--r--modules/visual_script/visual_script_yield_nodes.cpp8
-rw-r--r--modules/visual_script/visual_script_yield_nodes.h2
-rw-r--r--modules/vorbis/SCsub4
-rw-r--r--modules/vorbis/audio_stream_ogg_vorbis.cpp6
-rw-r--r--modules/vorbis/audio_stream_ogg_vorbis.h4
-rw-r--r--modules/webm/SCsub8
-rw-r--r--modules/webm/libvpx/SCsub2
-rw-r--r--modules/webm/video_stream_webm.cpp4
-rw-r--r--modules/webm/video_stream_webm.h4
-rw-r--r--modules/webp/SCsub2
-rw-r--r--platform/android/SCsub12
-rw-r--r--platform/android/build.gradle.template5
-rw-r--r--platform/android/detect.py19
-rw-r--r--platform/android/export/export.cpp2
-rw-r--r--platform/android/file_access_android.cpp5
-rw-r--r--platform/android/file_access_android.h1
-rw-r--r--platform/android/file_access_jandroid.cpp3
-rw-r--r--platform/android/file_access_jandroid.h1
-rw-r--r--platform/android/java/src/org/godotengine/godot/Godot.java15
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotLib.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java73
-rw-r--r--platform/android/java_glue.cpp79
-rw-r--r--platform/android/java_glue.h1
-rw-r--r--platform/android/os_android.cpp44
-rw-r--r--platform/android/os_android.h8
-rw-r--r--platform/haiku/detect.py3
-rw-r--r--platform/iphone/SCsub1
-rw-r--r--platform/iphone/app_delegate.mm23
-rw-r--r--platform/iphone/audio_driver_iphone.cpp187
-rw-r--r--platform/iphone/detect.py28
-rw-r--r--platform/iphone/export/export.cpp361
-rw-r--r--platform/iphone/game_center.mm2
-rw-r--r--platform/iphone/gl_view.h2
-rw-r--r--platform/iphone/gl_view.mm40
-rw-r--r--platform/iphone/godot_iphone.cpp7
-rw-r--r--platform/iphone/os_iphone.cpp33
-rw-r--r--platform/iphone/os_iphone.h12
-rw-r--r--platform/javascript/SCsub2
-rw-r--r--platform/javascript/detect.py16
-rw-r--r--platform/javascript/engine.js6
-rw-r--r--platform/javascript/javascript_main.cpp16
-rw-r--r--platform/javascript/os_javascript.cpp25
-rw-r--r--platform/javascript/os_javascript.h11
-rw-r--r--platform/osx/SCsub1
-rw-r--r--platform/osx/detect.py9
-rw-r--r--platform/osx/export/export.cpp466
-rw-r--r--platform/osx/os_osx.h19
-rw-r--r--platform/osx/os_osx.mm222
-rw-r--r--platform/server/detect.py58
-rw-r--r--platform/uwp/detect.py4
-rw-r--r--platform/uwp/gl_context_egl.cpp36
-rw-r--r--platform/uwp/os_uwp.cpp62
-rw-r--r--platform/uwp/os_uwp.h6
-rw-r--r--platform/windows/SCsub3
-rw-r--r--platform/windows/detect.py15
-rw-r--r--platform/windows/os_windows.cpp172
-rw-r--r--platform/windows/os_windows.h8
-rw-r--r--platform/windows/windows_terminal_logger.cpp157
-rw-r--r--platform/windows/windows_terminal_logger.h47
-rw-r--r--platform/x11/detect.py103
-rw-r--r--platform/x11/os_x11.cpp72
-rw-r--r--platform/x11/os_x11.h2
-rw-r--r--scene/2d/animated_sprite.cpp4
-rw-r--r--scene/2d/area_2d.cpp10
-rw-r--r--scene/2d/area_2d.h4
-rw-r--r--scene/2d/audio_stream_player_2d.cpp16
-rw-r--r--scene/2d/audio_stream_player_2d.h2
-rw-r--r--scene/2d/camera_2d.cpp12
-rw-r--r--scene/2d/collision_object_2d.cpp2
-rw-r--r--scene/2d/physics_body_2d.cpp2
-rw-r--r--scene/2d/ray_cast_2d.cpp10
-rw-r--r--scene/2d/visibility_notifier_2d.cpp18
-rw-r--r--scene/2d/visibility_notifier_2d.h2
-rw-r--r--scene/3d/SCsub2
-rw-r--r--scene/3d/arvr_nodes.cpp110
-rw-r--r--scene/3d/arvr_nodes.h7
-rw-r--r--scene/3d/audio_stream_player_3d.cpp18
-rw-r--r--scene/3d/audio_stream_player_3d.h4
-rw-r--r--scene/3d/camera.cpp4
-rw-r--r--scene/3d/camera.h10
-rw-r--r--scene/3d/collision_object.cpp2
-rw-r--r--scene/3d/gi_probe.cpp4
-rw-r--r--scene/3d/immediate_geometry.h2
-rw-r--r--scene/3d/interpolated_camera.cpp2
-rw-r--r--scene/3d/light.cpp6
-rw-r--r--scene/3d/navigation.cpp4
-rw-r--r--scene/3d/physics_body.cpp2
-rw-r--r--scene/3d/ray_cast.cpp10
-rw-r--r--scene/3d/spatial_velocity_tracker.cpp28
-rw-r--r--scene/3d/spatial_velocity_tracker.h6
-rw-r--r--scene/3d/vehicle_body.cpp7
-rw-r--r--scene/3d/vehicle_body.h2
-rw-r--r--scene/animation/animation_player.cpp28
-rw-r--r--scene/animation/animation_player.h2
-rw-r--r--scene/animation/animation_tree_player.cpp12
-rw-r--r--scene/animation/animation_tree_player.h2
-rw-r--r--scene/animation/tween.cpp12
-rw-r--r--scene/animation/tween.h2
-rw-r--r--scene/audio/audio_player.cpp15
-rw-r--r--scene/audio/audio_player.h2
-rw-r--r--scene/gui/base_button.cpp4
-rw-r--r--scene/gui/color_picker.cpp45
-rw-r--r--scene/gui/control.cpp158
-rw-r--r--scene/gui/control.h36
-rw-r--r--scene/gui/file_dialog.cpp4
-rw-r--r--scene/gui/graph_edit.cpp18
-rw-r--r--scene/gui/item_list.cpp37
-rw-r--r--scene/gui/line_edit.cpp12
-rw-r--r--scene/gui/popup.cpp2
-rw-r--r--scene/gui/range.cpp10
-rw-r--r--scene/gui/rich_text_label.cpp68
-rw-r--r--scene/gui/rich_text_label.h4
-rw-r--r--scene/gui/scroll_bar.cpp30
-rw-r--r--scene/gui/scroll_container.cpp22
-rw-r--r--scene/gui/slider.cpp4
-rw-r--r--scene/gui/spin_box.cpp2
-rw-r--r--scene/gui/tab_container.cpp8
-rw-r--r--scene/gui/text_edit.cpp23
-rw-r--r--scene/gui/tree.cpp35
-rw-r--r--scene/gui/tree.h1
-rw-r--r--scene/gui/video_player.cpp9
-rw-r--r--scene/gui/video_player.h1
-rwxr-xr-xscene/main/node.cpp76
-rw-r--r--scene/main/node.h18
-rw-r--r--scene/main/scene_tree.cpp15
-rw-r--r--scene/main/scene_tree.h4
-rwxr-xr-xscene/main/timer.cpp20
-rwxr-xr-xscene/main/timer.h2
-rw-r--r--scene/main/viewport.cpp6
-rw-r--r--scene/register_scene_types.cpp14
-rw-r--r--scene/resources/audio_stream_sample.cpp9
-rw-r--r--scene/resources/audio_stream_sample.h4
-rw-r--r--scene/resources/curve.cpp10
-rw-r--r--scene/resources/default_theme/default_theme.cpp3
-rw-r--r--scene/resources/default_theme/mini_checkerboard.pngbin0 -> 166 bytes
-rw-r--r--scene/resources/default_theme/source/arrow_down.svg80
-rw-r--r--scene/resources/default_theme/source/arrow_right.svg80
-rw-r--r--scene/resources/default_theme/source/graph_node_close.svg94
-rw-r--r--scene/resources/default_theme/source/graph_port.svg80
-rw-r--r--scene/resources/default_theme/source/icon_close.svg94
-rw-r--r--scene/resources/default_theme/source/option_arrow.svg86
-rw-r--r--scene/resources/default_theme/source/popup_checked.svg81
-rw-r--r--scene/resources/default_theme/source/spinbox_updown.svg86
-rw-r--r--scene/resources/default_theme/source/submenu.svg80
-rw-r--r--scene/resources/default_theme/source/tab_close.svg93
-rw-r--r--scene/resources/default_theme/source/tab_menu.svg80
-rw-r--r--scene/resources/default_theme/source/updown.svg86
-rw-r--r--scene/resources/default_theme/theme_data.h4
-rw-r--r--scene/resources/environment.cpp21
-rw-r--r--scene/resources/environment.h6
-rw-r--r--scene/resources/material.cpp155
-rw-r--r--scene/resources/material.h38
-rw-r--r--scene/resources/video_stream.h4
-rw-r--r--scene/scene_string_names.cpp2
-rw-r--r--scene/scene_string_names.h2
-rw-r--r--servers/arvr/arvr_interface.cpp68
-rw-r--r--servers/arvr/arvr_interface.h51
-rw-r--r--servers/arvr/arvr_script_interface.cpp37
-rw-r--r--servers/arvr/arvr_script_interface.h13
-rw-r--r--servers/arvr_server.cpp4
-rw-r--r--servers/arvr_server.h7
-rw-r--r--servers/audio/audio_stream.cpp8
-rw-r--r--servers/audio/audio_stream.h8
-rw-r--r--servers/audio/effects/audio_effect_chorus.cpp3
-rw-r--r--servers/audio/effects/audio_effect_limiter.cpp2
-rw-r--r--servers/physics/physics_server_sw.cpp17
-rw-r--r--servers/physics/physics_server_sw.h5
-rw-r--r--servers/physics_2d/physics_2d_server_sw.cpp17
-rw-r--r--servers/physics_2d/physics_2d_server_sw.h5
-rw-r--r--servers/physics_2d/physics_2d_server_wrap_mt.cpp3
-rw-r--r--servers/physics_2d/physics_2d_server_wrap_mt.h9
-rw-r--r--servers/physics_2d_server.cpp2
-rw-r--r--servers/physics_2d_server.h5
-rw-r--r--servers/physics_server.cpp2
-rw-r--r--servers/physics_server.h5
-rw-r--r--servers/register_server_types.cpp8
-rw-r--r--servers/visual/rasterizer.h2
-rw-r--r--servers/visual/shader_language.cpp11
-rw-r--r--servers/visual/shader_types.cpp38
-rw-r--r--servers/visual/visual_server_raster.h22
-rw-r--r--servers/visual/visual_server_scene.cpp6
-rw-r--r--servers/visual/visual_server_scene.h5
-rw-r--r--servers/visual/visual_server_wrap_mt.h2
-rw-r--r--servers/visual_server.h4
-rw-r--r--thirdparty/README.md2
-rw-r--r--thirdparty/freetype/include/freetype/config/ftoption.h21
-rw-r--r--thirdparty/freetype/include/freetype/freetype.h37
-rw-r--r--thirdparty/freetype/include/freetype/ftautoh.h14
-rw-r--r--thirdparty/freetype/include/freetype/fterrdef.h2
-rw-r--r--thirdparty/freetype/include/freetype/fterrors.h6
-rw-r--r--thirdparty/freetype/include/freetype/ftglyph.h9
-rw-r--r--thirdparty/freetype/include/freetype/ftimage.h20
-rw-r--r--thirdparty/freetype/include/freetype/ftlcdfil.h19
-rw-r--r--thirdparty/freetype/include/freetype/ftmac.h9
-rw-r--r--thirdparty/freetype/include/freetype/ftmm.h64
-rw-r--r--thirdparty/freetype/include/freetype/ftoutln.h3
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftcalc.h36
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftobjs.h34
-rw-r--r--thirdparty/freetype/include/freetype/tttags.h6
-rw-r--r--thirdparty/freetype/src/autofit/afblue.c12
-rw-r--r--thirdparty/freetype/src/autofit/afblue.dat20
-rw-r--r--thirdparty/freetype/src/autofit/afblue.h10
-rw-r--r--thirdparty/freetype/src/autofit/afcjk.c12
-rw-r--r--thirdparty/freetype/src/autofit/afhints.c6
-rw-r--r--thirdparty/freetype/src/autofit/aflatin.c33
-rw-r--r--thirdparty/freetype/src/autofit/aflatin2.c12
-rw-r--r--thirdparty/freetype/src/autofit/afloader.c8
-rw-r--r--thirdparty/freetype/src/autofit/afscript.h24
-rw-r--r--thirdparty/freetype/src/autofit/afshaper.c1
-rw-r--r--thirdparty/freetype/src/autofit/afstyles.h28
-rw-r--r--thirdparty/freetype/src/base/ftbitmap.c5
-rw-r--r--thirdparty/freetype/src/base/ftcalc.c150
-rw-r--r--thirdparty/freetype/src/base/ftglyph.c16
-rw-r--r--thirdparty/freetype/src/base/ftlcdfil.c211
-rw-r--r--thirdparty/freetype/src/base/ftmac.c2
-rw-r--r--thirdparty/freetype/src/base/ftmm.c32
-rw-r--r--thirdparty/freetype/src/base/ftobjs.c38
-rw-r--r--thirdparty/freetype/src/base/ftoutln.c3
-rw-r--r--thirdparty/freetype/src/base/ftrfork.c10
-rw-r--r--thirdparty/freetype/src/base/ftsynth.c2
-rw-r--r--thirdparty/freetype/src/base/ftutil.c10
-rw-r--r--thirdparty/freetype/src/bdf/bdfdrivr.c144
-rw-r--r--thirdparty/freetype/src/bdf/bdflib.c40
-rw-r--r--thirdparty/freetype/src/cache/ftcbasic.c38
-rw-r--r--thirdparty/freetype/src/cff/cf2blues.c45
-rw-r--r--thirdparty/freetype/src/cff/cf2blues.h2
-rw-r--r--thirdparty/freetype/src/cff/cf2fixed.h4
-rw-r--r--thirdparty/freetype/src/cff/cf2font.c4
-rw-r--r--thirdparty/freetype/src/cff/cf2ft.c4
-rw-r--r--thirdparty/freetype/src/cff/cf2hints.c255
-rw-r--r--thirdparty/freetype/src/cff/cf2intrp.c179
-rw-r--r--thirdparty/freetype/src/cff/cffgload.c207
-rw-r--r--thirdparty/freetype/src/cff/cffload.c9
-rw-r--r--thirdparty/freetype/src/cff/cffparse.c27
-rw-r--r--thirdparty/freetype/src/gxvalid/README2
-rw-r--r--thirdparty/freetype/src/pcf/README4
-rw-r--r--thirdparty/freetype/src/pcf/pcfdrivr.c12
-rw-r--r--thirdparty/freetype/src/pcf/pcfread.c78
-rw-r--r--thirdparty/freetype/src/pfr/pfrobjs.c6
-rw-r--r--thirdparty/freetype/src/psaux/psconv.c8
-rw-r--r--thirdparty/freetype/src/psaux/t1decode.c92
-rw-r--r--thirdparty/freetype/src/psnames/psmodule.c13
-rw-r--r--thirdparty/freetype/src/psnames/pstables.h36
-rw-r--r--thirdparty/freetype/src/raster/ftrend1.c9
-rw-r--r--thirdparty/freetype/src/sfnt/pngshim.c72
-rw-r--r--thirdparty/freetype/src/sfnt/sfobjs.c51
-rw-r--r--thirdparty/freetype/src/sfnt/ttcmap.c112
-rw-r--r--thirdparty/freetype/src/sfnt/ttcmap.h2
-rw-r--r--thirdparty/freetype/src/sfnt/ttkern.c8
-rw-r--r--thirdparty/freetype/src/sfnt/ttpost.c7
-rw-r--r--thirdparty/freetype/src/sfnt/ttsbit.c20
-rw-r--r--thirdparty/freetype/src/smooth/ftgrays.c15
-rw-r--r--thirdparty/freetype/src/smooth/ftsmooth.c192
-rw-r--r--thirdparty/freetype/src/truetype/ttgload.c101
-rw-r--r--thirdparty/freetype/src/truetype/ttgxvar.c97
-rw-r--r--thirdparty/freetype/src/truetype/ttinterp.c303
-rw-r--r--thirdparty/freetype/src/truetype/ttinterp.h50
-rw-r--r--thirdparty/freetype/src/truetype/ttobjs.c16
-rw-r--r--thirdparty/freetype/src/truetype/ttpload.c8
-rw-r--r--thirdparty/freetype/src/type1/t1load.c4
-rw-r--r--thirdparty/freetype/src/type1/t1objs.c6
-rw-r--r--thirdparty/freetype/src/type42/t42objs.c6
-rw-r--r--thirdparty/freetype/src/winfonts/winfnt.c6
-rw-r--r--thirdparty/zstd/SCsub23
795 files changed, 39037 insertions, 9036 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
new file mode 100644
index 0000000000..dbd56ab7e0
--- /dev/null
+++ b/.appveyor.yml
@@ -0,0 +1,24 @@
+os: Visual Studio 2015
+
+environment:
+ PYTHON: C:\Python27
+ matrix:
+ - VS: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
+ GD_PLATFORM: windows
+ TOOLS: yes
+ TARGET: release_debug
+ ARCH: amd64
+
+install:
+ - SET "PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
+ - pip install --egg scons # it will fail on AppVeyor without --egg flag
+ - if defined VS call "%VS%" %ARCH% # if defined - so we can also use mingw
+
+before_build:
+ - echo %GD_PLATFORM%
+ - python --version
+ - scons --version
+ - cl.exe
+
+build_script:
+- scons platform=%GD_PLATFORM% target=%TARGET% tools=%TOOLS% progress=no
diff --git a/.gitignore b/.gitignore
index d27b8b2b4b..b347b348a5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -53,6 +53,7 @@ gmon.out
# Misc
.DS_Store
+logs/
# for projects that use SCons for building: http://http://www.scons.org/
.sconf_temp
diff --git a/.travis.yml b/.travis.yml
index 602152374a..a2c3417412 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,7 +19,7 @@ env:
- GODOT_TARGET=osx
- GODOT_TARGET=x11
#- GODOT_TARGET=android
- - GODOT_TARGET=windows
+ #- GODOT_TARGET=windows
matrix:
include:
@@ -66,13 +66,13 @@ addons:
- libxrandr-dev
# For cross-compiling to Windows.
- - binutils-mingw-w64-i686
- - binutils-mingw-w64-x86-64
- - gcc-mingw-w64-i686
- - gcc-mingw-w64-x86-64
- - g++-mingw-w64-i686
- - g++-mingw-w64-x86-64
- - mingw-w64
+ #- binutils-mingw-w64-i686
+ #- binutils-mingw-w64-x86-64
+ #- gcc-mingw-w64-i686
+ #- gcc-mingw-w64-x86-64
+ #- g++-mingw-w64-i686
+ #- g++-mingw-w64-x86-64
+ #- mingw-w64
# For style checks.
- clang-format-3.9
@@ -92,5 +92,5 @@ script:
- if [ "$STATIC_CHECKS" = "yes" ]; then
sh ./misc/travis/clang-format.sh;
else
- scons -j 2 platform=$GODOT_TARGET progress=no verbose=yes CXX=$CXX builtin_openssl=yes;
+ scons -j 2 platform=$GODOT_TARGET progress=no verbose=yes CXX=$CXX;
fi
diff --git a/README.md b/README.md
index dc0dad6b90..675e666ce6 100644
--- a/README.md
+++ b/README.md
@@ -62,5 +62,6 @@ There are also a number of other learning resources provided by the community,
such as text and video tutorials, demos, etc. Consult the [community channels](https://godotengine.org/community)
for more info.
-[![Build Status](https://travis-ci.org/godotengine/godot.svg?branch=master)](https://travis-ci.org/godotengine/godot)
+[![Travis Build Status](https://travis-ci.org/godotengine/godot.svg?branch=master)](https://travis-ci.org/godotengine/godot)
+[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/bfiihqq6byxsjxxh/branch/master?svg=true)](https://ci.appveyor.com/project/akien-mga/godot)
[![Code Triagers Badge](https://www.codetriage.com/godotengine/godot/badges/users.svg)](https://www.codetriage.com/godotengine/godot)
diff --git a/SConstruct b/SConstruct
index f2f1ea57f3..c05a4332ab 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-EnsureSConsVersion(0, 14)
+EnsureSConsVersion(0, 98, 1)
import string
@@ -72,6 +72,7 @@ env_base.AppendENVPath('PATH', os.getenv('PATH'))
env_base.AppendENVPath('PKG_CONFIG_PATH', os.getenv('PKG_CONFIG_PATH'))
env_base.global_defaults = global_defaults
env_base.android_maven_repos = []
+env_base.android_flat_dirs = []
env_base.android_dependencies = []
env_base.android_gradle_plugins = []
env_base.android_gradle_classpath = []
@@ -96,6 +97,7 @@ env_base.SetOption('implicit_cache', 1)
env_base.__class__.android_add_maven_repository = methods.android_add_maven_repository
+env_base.__class__.android_add_flat_dir = methods.android_add_flat_dir
env_base.__class__.android_add_dependency = methods.android_add_dependency
env_base.__class__.android_add_java_dir = methods.android_add_java_dir
env_base.__class__.android_add_res_dir = methods.android_add_res_dir
@@ -132,45 +134,46 @@ opts = Variables(customs, ARGUMENTS)
# Target build options
opts.Add('arch', "Platform-dependent architecture (arm/arm64/x86/x64/mips/etc)", '')
-opts.Add('bits', "Target platform bits (default/32/64/fat)", 'default')
+opts.Add(EnumVariable('bits', "Target platform bits", 'default', ('default', '32', '64', 'fat')))
opts.Add('p', "Platform (alias for 'platform')", '')
-opts.Add('platform', "Target platform: any in " + str(platform_list), '')
-opts.Add('target', "Compilation target (debug/release_debug/release)", 'debug')
-opts.Add('tools', "Build the tools a.k.a. the Godot editor (yes/no)", 'yes')
+opts.Add('platform', "Target platform (%s)" % ('|'.join(platform_list), ), '')
+opts.Add(EnumVariable('target', "Compilation target", 'debug', ('debug', 'release_debug', 'release')))
+opts.Add(BoolVariable('tools', "Build the tools a.k.a. the Godot editor", True))
# Components
-opts.Add('deprecated', "Enable deprecated features (yes/no)", 'yes')
-opts.Add('gdscript', "Build GDSCript support (yes/no)", 'yes')
-opts.Add('minizip', "Build minizip archive support (yes/no)", 'yes')
-opts.Add('xaudio2', "XAudio2 audio driver (yes/no)", 'no')
-opts.Add('xml', "XML format support for resources (yes/no)", 'yes')
+opts.Add(BoolVariable('deprecated', "Enable deprecated features", True))
+opts.Add(BoolVariable('gdscript', "Build GDSCript support", True))
+opts.Add(BoolVariable('minizip', "Build minizip archive support", True))
+opts.Add(BoolVariable('xaudio2', "XAudio2 audio driver", False))
+opts.Add(BoolVariable('xml', "XML format support for resources", True))
# Advanced options
-opts.Add('disable_3d', "Disable 3D nodes for smaller executable (yes/no)", 'no')
-opts.Add('disable_advanced_gui', "Disable advance 3D gui nodes and behaviors (yes/no)", 'no')
+opts.Add(BoolVariable('disable_3d', "Disable 3D nodes for smaller executable", False))
+opts.Add(BoolVariable('disable_advanced_gui', "Disable advance 3D gui nodes and behaviors", False))
opts.Add('extra_suffix', "Custom extra suffix added to the base filename of all generated binary files", '')
opts.Add('unix_global_settings_path', "UNIX-specific path to system-wide settings. Currently only used for templates", '')
-opts.Add('verbose', "Enable verbose output for the compilation (yes/no)", 'no')
-opts.Add('vsproj', "Generate Visual Studio Project. (yes/no)", 'no')
-opts.Add('warnings', "Set the level of warnings emitted during compilation (extra/all/moderate/no)", 'no')
-opts.Add('progress', "Show a progress indicator during build (yes/no)", 'yes')
-opts.Add('dev', "If yes, alias for verbose=yes warnings=all (yes/no)", 'no')
+opts.Add(BoolVariable('verbose', "Enable verbose output for the compilation", False))
+opts.Add(BoolVariable('vsproj', "Generate Visual Studio Project.", False))
+opts.Add(EnumVariable('warnings', "Set the level of warnings emitted during compilation", 'no', ('extra', 'all', 'moderate', 'no')))
+opts.Add(BoolVariable('progress', "Show a progress indicator during build", True))
+opts.Add(BoolVariable('dev', "If yes, alias for verbose=yes warnings=all", False))
# Thirdparty libraries
-opts.Add('builtin_enet', "Use the builtin enet library (yes/no)", 'yes')
-opts.Add('builtin_freetype', "Use the builtin freetype library (yes/no)", 'yes')
-opts.Add('builtin_libogg', "Use the builtin libogg library (yes/no)", 'yes')
-opts.Add('builtin_libpng', "Use the builtin libpng library (yes/no)", 'yes')
-opts.Add('builtin_libtheora', "Use the builtin libtheora library (yes/no)", 'yes')
-opts.Add('builtin_libvorbis', "Use the builtin libvorbis library (yes/no)", 'yes')
-opts.Add('builtin_libvpx', "Use the builtin libvpx library (yes/no)", 'yes')
-opts.Add('builtin_libwebp', "Use the builtin libwebp library (yes/no)", 'yes')
-opts.Add('builtin_openssl', "Use the builtin openssl library (yes/no)", 'yes')
-opts.Add('builtin_opus', "Use the builtin opus library (yes/no)", 'yes')
-opts.Add('builtin_pcre2', "Use the builtin pcre2 library (yes/no)", 'yes')
-opts.Add('builtin_recast', "Use the builtin recast library (yes/no)", 'yes')
-opts.Add('builtin_squish', "Use the builtin squish library (yes/no)", 'yes')
-opts.Add('builtin_zlib', "Use the builtin zlib library (yes/no)", 'yes')
+opts.Add(BoolVariable('builtin_enet', "Use the builtin enet library", True))
+opts.Add(BoolVariable('builtin_freetype', "Use the builtin freetype library", True))
+opts.Add(BoolVariable('builtin_libogg', "Use the builtin libogg library", True))
+opts.Add(BoolVariable('builtin_libpng', "Use the builtin libpng library", True))
+opts.Add(BoolVariable('builtin_libtheora', "Use the builtin libtheora library", True))
+opts.Add(BoolVariable('builtin_libvorbis', "Use the builtin libvorbis library", True))
+opts.Add(BoolVariable('builtin_libvpx', "Use the builtin libvpx library", True))
+opts.Add(BoolVariable('builtin_libwebp', "Use the builtin libwebp library", True))
+opts.Add(BoolVariable('builtin_openssl', "Use the builtin openssl library", True))
+opts.Add(BoolVariable('builtin_opus', "Use the builtin opus library", True))
+opts.Add(BoolVariable('builtin_pcre2', "Use the builtin pcre2 library)", True))
+opts.Add(BoolVariable('builtin_recast', "Use the builtin recast library", True))
+opts.Add(BoolVariable('builtin_squish', "Use the builtin squish library", True))
+opts.Add(BoolVariable('builtin_zlib', "Use the builtin zlib library", True))
+opts.Add(BoolVariable('builtin_zstd', "Use the builtin zstd library", True))
# Environment setup
opts.Add("CXX", "C++ compiler")
@@ -185,10 +188,19 @@ opts.Add("LINKFLAGS", "Custom flags for the linker")
for k in platform_opts.keys():
opt_list = platform_opts[k]
for o in opt_list:
- opts.Add(o[0], o[1], o[2])
+ opts.Add(o)
for x in module_list:
- opts.Add('module_' + x + '_enabled', "Enable module '" + x + "' (yes/no)", "yes")
+ module_enabled = True
+ tmppath = "./modules/" + x
+ sys.path.append(tmppath)
+ import config
+ enabled_attr = getattr(config, "is_enabled", None)
+ if (callable(enabled_attr) and not config.is_enabled()):
+ module_enabled = False
+ sys.path.remove(tmppath)
+ sys.modules.pop('config')
+ opts.Add(BoolVariable('module_' + x + '_enabled', "Enable module '%s'" % (x, ), module_enabled))
opts.Update(env_base) # update environment
Help(opts.GenerateHelpText(env_base)) # generate help
@@ -212,7 +224,7 @@ if (env_base['target'] == 'debug'):
env_base.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
env_base.Append(CPPFLAGS=['-DSCI_NAMESPACE'])
-if (env_base['deprecated'] == 'no'):
+if not env_base['deprecated']:
env_base.Append(CPPFLAGS=['-DDISABLE_DEPRECATED'])
env_base.platforms = {}
@@ -235,12 +247,12 @@ if selected_platform in platform_list:
env = detect.create(env_base)
else:
env = env_base.Clone()
-
- if (env["dev"] == "yes"):
+
+ if env['dev']:
env["warnings"] = "all"
- env["verbose"] = "yes"
+ env['verbose'] = True
- if env['vsproj'] == "yes":
+ if env['vsproj']:
env.vs_incs = []
env.vs_srcs = []
@@ -318,19 +330,19 @@ if selected_platform in platform_list:
suffix = "." + selected_platform
if (env["target"] == "release"):
- if (env["tools"] == "yes"):
+ if env["tools"]:
print("Tools can only be built with targets 'debug' and 'release_debug'.")
sys.exit(255)
suffix += ".opt"
env.Append(CCFLAGS=['-DNDEBUG'])
elif (env["target"] == "release_debug"):
- if (env["tools"] == "yes"):
+ if env["tools"]:
suffix += ".opt.tools"
else:
suffix += ".opt.debug"
else:
- if (env["tools"] == "yes"):
+ if env["tools"]:
suffix += ".tools"
else:
suffix += ".debug"
@@ -358,7 +370,7 @@ if selected_platform in platform_list:
env.doc_class_path={}
for x in module_list:
- if env['module_' + x + '_enabled'] != "yes":
+ if not env['module_' + x + '_enabled']:
continue
tmppath = "./modules/" + x
sys.path.append(tmppath)
@@ -385,22 +397,22 @@ if selected_platform in platform_list:
# to test 64 bits compiltion
# env.Append(CPPFLAGS=['-m64'])
- if (env['tools'] == 'yes'):
+ if env['tools']:
env.Append(CPPFLAGS=['-DTOOLS_ENABLED'])
- if (env['disable_3d'] == 'yes'):
+ if env['disable_3d']:
env.Append(CPPFLAGS=['-D_3D_DISABLED'])
- if (env['gdscript'] == 'yes'):
+ if env['gdscript']:
env.Append(CPPFLAGS=['-DGDSCRIPT_ENABLED'])
- if (env['disable_advanced_gui'] == 'yes'):
+ if env['disable_advanced_gui']:
env.Append(CPPFLAGS=['-DADVANCED_GUI_DISABLED'])
- if (env['minizip'] == 'yes'):
+ if env['minizip']:
env.Append(CPPFLAGS=['-DMINIZIP_ENABLED'])
- if (env['xml'] == 'yes'):
+ if env['xml']:
env.Append(CPPFLAGS=['-DXML_ENABLED'])
- if (env['verbose'] == 'no'):
+ if not env['verbose']:
methods.no_verbose(sys, env)
if (True): # FIXME: detect GLES3
@@ -422,7 +434,8 @@ if selected_platform in platform_list:
SConscript("platform/" + selected_platform + "/SCsub") # build selected platform
# Microsoft Visual Studio Project Generation
- if (env['vsproj']) == "yes":
+ if env['vsproj']:
+ env['CPPPATH'] = [Dir(path) for path in env['CPPPATH']]
methods.generate_vs_project(env, GetOption("num_jobs"))
# Check for the existence of headers
@@ -469,7 +482,7 @@ def progress_finish(target, source, env):
with open(node_count_fname, 'w') as f:
f.write('%d\n' % node_count)
-if ('env' in locals() and env["progress"] == "yes"):
+if 'env' in locals() and env['progress']:
try:
with open(node_count_fname) as f:
node_count_max = int(f.readline())
diff --git a/compat.py b/compat.py
index 7338c479fb..e1bc0ed673 100644
--- a/compat.py
+++ b/compat.py
@@ -14,6 +14,17 @@ if sys.version_info < (3,):
return x
def iteritems(d):
return d.iteritems()
+ def escape_string(s):
+ if isinstance(s, unicode):
+ s = s.encode('ascii')
+ result = ''
+ for c in s:
+ if not (32 <= ord(c) < 127) or c in ('\\', '"'):
+ result += '\\%03o' % ord(c)
+ else:
+ result += c
+ return result
+
else:
def isbasestring(s):
return isinstance(s, (str, bytes))
@@ -29,3 +40,21 @@ else:
return codecs.utf_8_encode(x)[0]
def iteritems(d):
return iter(d.items())
+ def charcode_to_c_escapes(c):
+ rev_result = []
+ while c >= 256:
+ c, low = (c // 256, c % 256)
+ rev_result.append('\\%03o' % low)
+ rev_result.append('\\%03o' % c)
+ return ''.join(reversed(rev_result))
+ def escape_string(s):
+ result = ''
+ if isinstance(s, str):
+ s = s.encode('utf-8')
+ for c in s:
+ if not(32 <= c < 127) or c in (ord('\\'), ord('"')):
+ result += charcode_to_c_escapes(c)
+ else:
+ result += chr(c)
+ return result
+
diff --git a/core/SCsub b/core/SCsub
index c1e57f6840..e9b21bc71b 100644
--- a/core/SCsub
+++ b/core/SCsub
@@ -83,24 +83,8 @@ thirdparty_minizip_sources = [
thirdparty_minizip_sources = [thirdparty_minizip_dir + file for file in thirdparty_minizip_sources]
env.add_source_files(env.core_sources, thirdparty_minizip_sources)
-thirdparty_zstd_dir = "#thirdparty/zstd/"
-thirdparty_zstd_sources = [
- "common/entropy_common.c",
- "common/error_private.c",
- "common/fse_decompress.c",
- "common/pool.c",
- "common/threading.c",
- "common/xxhash.c",
- "common/zstd_common.c",
- "compress/fse_compress.c",
- "compress/huf_compress.c",
- "compress/zstd_compress.c",
- "compress/zstdmt_compress.c",
- "decompress/huf_decompress.c",
- "decompress/zstd_decompress.c",
-]
-thirdparty_zstd_sources = [thirdparty_zstd_dir + file for file in thirdparty_zstd_sources]
-env.add_source_files(env.core_sources, thirdparty_zstd_sources)
+if 'builtin_zstd' in env and env['builtin_zstd']:
+ SConscript("#thirdparty/zstd/SCsub")
# Godot's own sources
@@ -123,5 +107,4 @@ SConscript('helper/SCsub')
# Build it all as a library
lib = env.Library("core", env.core_sources)
env.Prepend(LIBS=[lib])
-env.Append(CPPPATH=["#thirdparty/zstd", "#thirdparty/zstd/common"])
Export('env')
diff --git a/core/array.cpp b/core/array.cpp
index 2e3fbf858d..171c11776c 100644
--- a/core/array.cpp
+++ b/core/array.cpp
@@ -47,11 +47,11 @@ void Array::_ref(const Array &p_from) const {
ERR_FAIL_COND(!_fp); // should NOT happen.
if (_fp == _p)
- return; //wathever it is, nothing to do here move along
+ return; // whatever it is, nothing to do here move along
bool success = _fp->refcount.ref();
- ERR_FAIL_COND(!success); //should really not happen either
+ ERR_FAIL_COND(!success); // should really not happen either
_unref();
@@ -233,9 +233,10 @@ struct _ArrayVariantSort {
}
};
-void Array::sort() {
+Array &Array::sort() {
_p->array.sort_custom<_ArrayVariantSort>();
+ return *this;
}
struct _ArrayVariantSortCustom {
@@ -253,19 +254,21 @@ struct _ArrayVariantSortCustom {
return res;
}
};
-void Array::sort_custom(Object *p_obj, const StringName &p_function) {
+Array &Array::sort_custom(Object *p_obj, const StringName &p_function) {
- ERR_FAIL_NULL(p_obj);
+ ERR_FAIL_NULL_V(p_obj, *this);
SortArray<Variant, _ArrayVariantSortCustom> avs;
avs.compare.obj = p_obj;
avs.compare.func = p_function;
avs.sort(_p->array.ptr(), _p->array.size());
+ return *this;
}
-void Array::invert() {
+Array &Array::invert() {
_p->array.invert();
+ return *this;
}
void Array::push_front(const Variant &p_value) {
diff --git a/core/array.h b/core/array.h
index 8a647dd13b..2c29103108 100644
--- a/core/array.h
+++ b/core/array.h
@@ -68,9 +68,9 @@ public:
Variant front() const;
Variant back() const;
- void sort();
- void sort_custom(Object *p_obj, const StringName &p_function);
- void invert();
+ Array &sort();
+ Array &sort_custom(Object *p_obj, const StringName &p_function);
+ Array &invert();
int find(const Variant &p_value, int p_from = 0) const;
int rfind(const Variant &p_value, int p_from = -1) const;
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 2477b1b187..b47e611a51 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -453,6 +453,11 @@ int _OS::get_power_percent_left() {
return OS::get_singleton()->get_power_percent_left();
}
+bool _OS::has_feature(const String &p_feature) const {
+
+ return OS::get_singleton()->has_feature(p_feature);
+}
+
/*
enum Weekday {
DAY_SUNDAY,
@@ -755,6 +760,11 @@ bool _OS::can_draw() const {
return OS::get_singleton()->can_draw();
}
+bool _OS::is_userfs_persistent() const {
+
+ return OS::get_singleton()->is_userfs_persistent();
+}
+
int _OS::get_processor_count() const {
return OS::get_singleton()->get_processor_count();
@@ -858,6 +868,10 @@ void _OS::hide_virtual_keyboard() {
OS::get_singleton()->hide_virtual_keyboard();
}
+int _OS::get_virtual_keyboard_height() {
+ return OS::get_singleton()->get_virtual_keyboard_height();
+}
+
void _OS::print_all_resources(const String &p_to_file) {
OS::get_singleton()->print_all_resources(p_to_file);
@@ -1051,6 +1065,7 @@ void _OS::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_model_name"), &_OS::get_model_name);
ClassDB::bind_method(D_METHOD("can_draw"), &_OS::can_draw);
+ ClassDB::bind_method(D_METHOD("is_userfs_persistent"), &_OS::is_userfs_persistent);
ClassDB::bind_method(D_METHOD("is_stdout_verbose"), &_OS::is_stdout_verbose);
ClassDB::bind_method(D_METHOD("can_use_threads"), &_OS::can_use_threads);
@@ -1064,6 +1079,7 @@ void _OS::_bind_methods() {
ClassDB::bind_method(D_METHOD("has_virtual_keyboard"), &_OS::has_virtual_keyboard);
ClassDB::bind_method(D_METHOD("show_virtual_keyboard", "existing_text"), &_OS::show_virtual_keyboard, DEFVAL(""));
ClassDB::bind_method(D_METHOD("hide_virtual_keyboard"), &_OS::hide_virtual_keyboard);
+ ClassDB::bind_method(D_METHOD("get_virtual_keyboard_height"), &_OS::get_virtual_keyboard_height);
ClassDB::bind_method(D_METHOD("print_resources_in_use", "short"), &_OS::print_resources_in_use, DEFVAL(false));
ClassDB::bind_method(D_METHOD("print_all_resources", "tofile"), &_OS::print_all_resources, DEFVAL(""));
@@ -1099,6 +1115,8 @@ void _OS::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_use_vsync", "enable"), &_OS::set_use_vsync);
ClassDB::bind_method(D_METHOD("is_vsync_enabled"), &_OS::is_vsync_enabled);
+ ClassDB::bind_method(D_METHOD("has_feature", "tag_name"), &_OS::has_feature);
+
ClassDB::bind_method(D_METHOD("get_power_state"), &_OS::get_power_state);
ClassDB::bind_method(D_METHOD("get_power_seconds_left"), &_OS::get_power_seconds_left);
ClassDB::bind_method(D_METHOD("get_power_percent_left"), &_OS::get_power_percent_left);
@@ -2557,8 +2575,8 @@ Dictionary _Engine::get_version_info() const {
return Engine::get_singleton()->get_version_info();
}
-bool _Engine::is_in_fixed_frame() const {
- return Engine::get_singleton()->is_in_fixed_frame();
+bool _Engine::is_in_physics_frame() const {
+ return Engine::get_singleton()->is_in_physics_frame();
}
void _Engine::set_editor_hint(bool p_enabled) {
@@ -2588,7 +2606,7 @@ void _Engine::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_version_info"), &_Engine::get_version_info);
- ClassDB::bind_method(D_METHOD("is_in_fixed_frame"), &_Engine::is_in_fixed_frame);
+ ClassDB::bind_method(D_METHOD("is_in_physics_frame"), &_Engine::is_in_physics_frame);
ClassDB::bind_method(D_METHOD("set_editor_hint", "enabled"), &_Engine::set_editor_hint);
ClassDB::bind_method(D_METHOD("is_editor_hint"), &_Engine::is_editor_hint);
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index 1a22d45932..7f8c734e36 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -204,6 +204,7 @@ public:
bool has_virtual_keyboard() const;
void show_virtual_keyboard(const String &p_existing_text = "");
void hide_virtual_keyboard();
+ int get_virtual_keyboard_height();
void print_resources_in_use(bool p_short = false);
void print_all_resources(const String &p_to_file);
@@ -266,6 +267,8 @@ public:
bool can_draw() const;
+ bool is_userfs_persistent() const;
+
bool is_stdout_verbose() const;
int get_processor_count() const;
@@ -315,6 +318,8 @@ public:
int get_power_seconds_left();
int get_power_percent_left();
+ bool has_feature(const String &p_feature) const;
+
static _OS *get_singleton() { return singleton; }
_OS();
@@ -661,7 +666,7 @@ public:
Dictionary get_version_info() const;
- bool is_in_fixed_frame() const;
+ bool is_in_physics_frame() const;
void set_editor_hint(bool p_enabled);
bool is_editor_hint() const;
diff --git a/core/class_db.cpp b/core/class_db.cpp
index f5ddd9c761..12310f6151 100644
--- a/core/class_db.cpp
+++ b/core/class_db.cpp
@@ -205,6 +205,7 @@ ClassDB::ClassInfo::ClassInfo() {
creation_func = NULL;
inherits_ptr = NULL;
disabled = false;
+ exposed = false;
}
ClassDB::ClassInfo::~ClassInfo() {
}
@@ -1284,6 +1285,15 @@ bool ClassDB::is_class_enabled(StringName p_class) {
return !ti->disabled;
}
+bool ClassDB::is_class_exposed(StringName p_class) {
+
+ OBJTYPE_RLOCK;
+
+ ClassInfo *ti = classes.getptr(p_class);
+ ERR_FAIL_COND_V(!ti, false);
+ return ti->exposed;
+}
+
StringName ClassDB::get_category(const StringName &p_node) {
ERR_FAIL_COND_V(!classes.has(p_node), StringName());
diff --git a/core/class_db.h b/core/class_db.h
index f6b97748b0..5910a2ce01 100644
--- a/core/class_db.h
+++ b/core/class_db.h
@@ -127,6 +127,7 @@ public:
StringName inherits;
StringName name;
bool disabled;
+ bool exposed;
Object *(*creation_func)();
ClassInfo();
~ClassInfo();
@@ -168,6 +169,7 @@ public:
ClassInfo *t = classes.getptr(T::get_class_static());
ERR_FAIL_COND(!t);
t->creation_func = &creator<T>;
+ t->exposed = true;
T::register_custom_data_to_otdb();
}
@@ -176,6 +178,9 @@ public:
GLOBAL_LOCK_FUNCTION;
T::initialize_class();
+ ClassInfo *t = classes.getptr(T::get_class_static());
+ ERR_FAIL_COND(!t);
+ t->exposed = true;
//nothing
}
@@ -193,6 +198,7 @@ public:
ClassInfo *t = classes.getptr(T::get_class_static());
ERR_FAIL_COND(!t);
t->creation_func = &_create_ptr_func<T>;
+ t->exposed = true;
T::register_custom_data_to_otdb();
}
@@ -347,6 +353,8 @@ public:
static void set_class_enabled(StringName p_class, bool p_enable);
static bool is_class_enabled(StringName p_class);
+ static bool is_class_exposed(StringName p_class);
+
static void add_resource_base_extension(const StringName &p_extension, const StringName &p_class);
static void get_resource_base_extensions(List<String> *p_extensions);
static void get_extensions_for_type(const StringName &p_class, List<String> *p_extensions);
diff --git a/core/core_string_names.cpp b/core/core_string_names.cpp
index ef9346253f..feee39225f 100644
--- a/core/core_string_names.cpp
+++ b/core/core_string_names.cpp
@@ -47,4 +47,27 @@ CoreStringNames::CoreStringNames()
_sections_unfolded(StaticCString::create("_sections_unfolded")),
#endif
_custom_features(StaticCString::create("_custom_features")) {
+
+ x = StaticCString::create("x");
+ y = StaticCString::create("y");
+ z = StaticCString::create("z");
+ w = StaticCString::create("w");
+ r = StaticCString::create("r");
+ g = StaticCString::create("g");
+ b = StaticCString::create("b");
+ a = StaticCString::create("a");
+ position = StaticCString::create("position");
+ size = StaticCString::create("size");
+ end = StaticCString::create("end");
+ basis = StaticCString::create("basis");
+ origin = StaticCString::create("origin");
+ normal = StaticCString::create("normal");
+ d = StaticCString::create("d");
+ h = StaticCString::create("h");
+ s = StaticCString::create("s");
+ v = StaticCString::create("v");
+ r8 = StaticCString::create("r8");
+ g8 = StaticCString::create("g8");
+ b8 = StaticCString::create("b8");
+ a8 = StaticCString::create("a8");
}
diff --git a/core/core_string_names.h b/core/core_string_names.h
index 2eb2b703ae..6fcc773169 100644
--- a/core/core_string_names.h
+++ b/core/core_string_names.h
@@ -37,8 +37,6 @@ class CoreStringNames {
friend void register_core_types();
friend void unregister_core_types();
- static CoreStringNames *singleton;
-
static void create() { singleton = memnew(CoreStringNames); }
static void free() {
memdelete(singleton);
@@ -50,6 +48,8 @@ class CoreStringNames {
public:
_FORCE_INLINE_ static CoreStringNames *get_singleton() { return singleton; }
+ static CoreStringNames *singleton;
+
StringName _free;
StringName changed;
StringName _meta;
@@ -65,6 +65,29 @@ public:
StringName _sections_unfolded;
#endif
StringName _custom_features;
+
+ StringName x;
+ StringName y;
+ StringName z;
+ StringName w;
+ StringName r;
+ StringName g;
+ StringName b;
+ StringName a;
+ StringName position;
+ StringName size;
+ StringName end;
+ StringName basis;
+ StringName origin;
+ StringName normal;
+ StringName d;
+ StringName h;
+ StringName s;
+ StringName v;
+ StringName r8;
+ StringName g8;
+ StringName b8;
+ StringName a8;
};
#endif // SCENE_STRING_NAMES_H
diff --git a/core/engine.cpp b/core/engine.cpp
index d73693dc12..c609ae9520 100644
--- a/core/engine.cpp
+++ b/core/engine.cpp
@@ -116,9 +116,9 @@ Engine::Engine() {
_target_fps = 0;
_time_scale = 1.0;
_pixel_snap = false;
- _fixed_frames = 0;
+ _physics_frames = 0;
_idle_frames = 0;
- _in_fixed = false;
+ _in_physics = false;
_frame_ticks = 0;
_frame_step = 0;
editor_hint = false;
diff --git a/core/engine.h b/core/engine.h
index 6f46ec8923..3b4979582f 100644
--- a/core/engine.h
+++ b/core/engine.h
@@ -49,10 +49,10 @@ class Engine {
int _target_fps;
float _time_scale;
bool _pixel_snap;
- uint64_t _fixed_frames;
+ uint64_t _physics_frames;
uint64_t _idle_frames;
- bool _in_fixed;
+ bool _in_physics;
bool editor_hint;
@@ -71,9 +71,9 @@ public:
uint64_t get_frames_drawn();
- uint64_t get_fixed_frames() const { return _fixed_frames; }
+ uint64_t get_physics_frames() const { return _physics_frames; }
uint64_t get_idle_frames() const { return _idle_frames; }
- bool is_in_fixed_frame() const { return _in_fixed; }
+ bool is_in_physics_frame() const { return _in_physics; }
uint64_t get_idle_frame_ticks() const { return _frame_ticks; }
float get_idle_frame_step() const { return _frame_step; }
diff --git a/core/error_list.h b/core/error_list.h
index bc65ad0ee4..50d248b3d0 100644
--- a/core/error_list.h
+++ b/core/error_list.h
@@ -66,7 +66,7 @@ enum Error {
ERR_CANT_CONNECT, // (25)
ERR_CANT_RESOLVE,
ERR_CONNECTION_ERROR,
- ERR_CANT_AQUIRE_RESOURCE,
+ ERR_CANT_ACQUIRE_RESOURCE,
ERR_CANT_FORK,
ERR_INVALID_DATA, ///< Data passed is invalid (30)
ERR_INVALID_PARAMETER, ///< Parameter passed is invalid
diff --git a/core/error_macros.cpp b/core/error_macros.cpp
index 5919d38375..170a22e8dd 100644
--- a/core/error_macros.cpp
+++ b/core/error_macros.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "error_macros.h"
+#include "io/logger.h"
#include "os/os.h"
bool _err_error_exists = false;
@@ -79,7 +80,7 @@ void remove_error_handler(ErrorHandlerList *p_handler) {
void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, ErrorHandlerType p_type) {
- OS::get_singleton()->print_error(p_function, p_file, p_line, p_error, _err_error_exists ? OS::get_singleton()->get_last_error() : "", (OS::ErrorType)p_type);
+ OS::get_singleton()->print_error(p_function, p_file, p_line, p_error, _err_error_exists ? OS::get_singleton()->get_last_error() : "", (Logger::ErrorType)p_type);
_global_lock();
ErrorHandlerList *l = error_handler_list;
diff --git a/core/error_macros.h b/core/error_macros.h
index 005b0e32a3..1fa7f2c134 100644
--- a/core/error_macros.h
+++ b/core/error_macros.h
@@ -30,6 +30,7 @@
#ifndef ERROR_MACROS_H
#define ERROR_MACROS_H
+#include "typedefs.h"
/**
* Error macros. Unlike exceptions and asserts, these macros try to mantain consistency and stability
* inside the code. It is recommended to always return processable data, so in case of an error, the
@@ -130,7 +131,7 @@ extern bool _err_error_exists;
#define ERR_FAIL_INDEX(m_index, m_size) \
do { \
- if ((m_index) < 0 || (m_index) >= (m_size)) { \
+ if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Index " _STR(m_index) " out of size (" _STR(m_size) ")."); \
return; \
} else \
@@ -144,7 +145,7 @@ extern bool _err_error_exists;
#define ERR_FAIL_INDEX_V(m_index, m_size, m_retval) \
do { \
- if ((m_index) < 0 || (m_index) >= (m_size)) { \
+ if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Index " _STR(m_index) " out of size (" _STR(m_size) ")."); \
return m_retval; \
} else \
@@ -156,7 +157,7 @@ extern bool _err_error_exists;
*/
#define CRASH_BAD_INDEX(m_index, m_size) \
do { \
- if ((m_index) < 0 || (m_index) >= (m_size)) { \
+ if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: Index " _STR(m_index) " out of size (" _STR(m_size) ")."); \
GENERATE_TRAP \
} \
@@ -168,7 +169,7 @@ extern bool _err_error_exists;
#define ERR_FAIL_NULL(m_param) \
{ \
- if (!m_param) { \
+ if (unlikely(!m_param)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter ' " _STR(m_param) " ' is null."); \
return; \
} else \
@@ -177,7 +178,7 @@ extern bool _err_error_exists;
#define ERR_FAIL_NULL_V(m_param, m_retval) \
{ \
- if (!m_param) { \
+ if (unlikely(!m_param)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter ' " _STR(m_param) " ' is null."); \
return m_retval; \
} else \
@@ -190,7 +191,7 @@ extern bool _err_error_exists;
#define ERR_FAIL_COND(m_cond) \
{ \
- if (m_cond) { \
+ if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition ' " _STR(m_cond) " ' is true."); \
return; \
} else \
@@ -202,7 +203,7 @@ extern bool _err_error_exists;
#define CRASH_COND(m_cond) \
{ \
- if (m_cond) { \
+ if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: Condition ' " _STR(m_cond) " ' is true."); \
GENERATE_TRAP \
} \
@@ -216,7 +217,7 @@ extern bool _err_error_exists;
#define ERR_FAIL_COND_V(m_cond, m_retval) \
{ \
- if (m_cond) { \
+ if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition ' " _STR(m_cond) " ' is true. returned: " _STR(m_retval)); \
return m_retval; \
} else \
@@ -229,7 +230,7 @@ extern bool _err_error_exists;
#define ERR_CONTINUE(m_cond) \
{ \
- if (m_cond) { \
+ if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition ' " _STR(m_cond) " ' is true. Continuing..:"); \
continue; \
} else \
@@ -242,7 +243,7 @@ extern bool _err_error_exists;
#define ERR_BREAK(m_cond) \
{ \
- if (m_cond) { \
+ if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition ' " _STR(m_cond) " ' is true. Breaking..:"); \
break; \
} else \
diff --git a/core/global_constants.cpp b/core/global_constants.cpp
index 224ee0e0aa..6f58af2ccf 100644
--- a/core/global_constants.cpp
+++ b/core/global_constants.cpp
@@ -472,7 +472,7 @@ void register_global_constants() {
BIND_GLOBAL_ENUM_CONSTANT(ERR_ALREADY_IN_USE);
BIND_GLOBAL_ENUM_CONSTANT(ERR_LOCKED); ///< resource is locked
BIND_GLOBAL_ENUM_CONSTANT(ERR_TIMEOUT);
- BIND_GLOBAL_ENUM_CONSTANT(ERR_CANT_AQUIRE_RESOURCE);
+ BIND_GLOBAL_ENUM_CONSTANT(ERR_CANT_ACQUIRE_RESOURCE);
BIND_GLOBAL_ENUM_CONSTANT(ERR_INVALID_DATA); ///< Data passed is invalid
BIND_GLOBAL_ENUM_CONSTANT(ERR_INVALID_PARAMETER); ///< Parameter passed is invalid
BIND_GLOBAL_ENUM_CONSTANT(ERR_ALREADY_EXISTS); ///< When adding ), item already exists
diff --git a/core/image.cpp b/core/image.cpp
index 4d1f32c360..c7f21d5599 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -530,7 +530,7 @@ static void _scale_cubic(const uint8_t *p_src, uint8_t *p_dst, uint32_t p_src_wi
int height = p_src_height;
double xfac = (double)width / p_dst_width;
double yfac = (double)height / p_dst_height;
- // coordinates of source points and cooefficiens
+ // coordinates of source points and coefficients
double ox, oy, dx, dy, k1, k2;
int ox1, oy1, ox2, oy2;
// destination pixel values
@@ -561,7 +561,7 @@ static void _scale_cubic(const uint8_t *p_src, uint8_t *p_dst, uint32_t p_src_wi
}
for (int n = -1; n < 3; n++) {
- // get Y cooefficient
+ // get Y coefficient
k1 = _bicubic_interp_kernel(dy - (double)n);
oy2 = oy1 + n;
@@ -571,7 +571,7 @@ static void _scale_cubic(const uint8_t *p_src, uint8_t *p_dst, uint32_t p_src_wi
oy2 = ymax;
for (int m = -1; m < 3; m++) {
- // get X cooefficient
+ // get X coefficient
k2 = k1 * _bicubic_interp_kernel((double)m - dx);
ox2 = ox1 + m;
@@ -1013,8 +1013,8 @@ void Image::shrink_x2() {
copymem(w.ptr(), &r[ofs], new_size);
}
- width /= 2;
- height /= 2;
+ width = MAX(width / 2, 1);
+ height = MAX(height / 2, 1);
data = new_img;
} else {
diff --git a/core/io/compression.cpp b/core/io/compression.cpp
index 44fa65e11d..fbe97e54c7 100644
--- a/core/io/compression.cpp
+++ b/core/io/compression.cpp
@@ -33,9 +33,9 @@
#include "zip_io.h"
#include "thirdparty/misc/fastlz.h"
-#include "thirdparty/zstd/zstd.h"
#include <zlib.h>
+#include <zstd.h>
int Compression::compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size, Mode p_mode) {
diff --git a/core/io/file_access_buffered_fa.h b/core/io/file_access_buffered_fa.h
index 9e41834561..309fc16d09 100644
--- a/core/io/file_access_buffered_fa.h
+++ b/core/io/file_access_buffered_fa.h
@@ -76,6 +76,11 @@ protected:
};
public:
+ void flush() {
+
+ f.flush();
+ };
+
void store_8(uint8_t p_dest) {
f.store_8(p_dest);
diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp
index 4750945854..514e3c65f0 100644
--- a/core/io/file_access_compressed.cpp
+++ b/core/io/file_access_compressed.cpp
@@ -338,6 +338,13 @@ Error FileAccessCompressed::get_error() const {
return read_eof ? ERR_FILE_EOF : OK;
}
+void FileAccessCompressed::flush() {
+ ERR_FAIL_COND(!f);
+ ERR_FAIL_COND(!writing);
+
+ // compressed files keep data in memory till close()
+}
+
void FileAccessCompressed::store_8(uint8_t p_dest) {
ERR_FAIL_COND(!f);
diff --git a/core/io/file_access_compressed.h b/core/io/file_access_compressed.h
index 1a57e2d4ee..1d99e5bfd4 100644
--- a/core/io/file_access_compressed.h
+++ b/core/io/file_access_compressed.h
@@ -84,6 +84,7 @@ public:
virtual Error get_error() const; ///< get last error
+ virtual void flush();
virtual void store_8(uint8_t p_dest); ///< store a byte
virtual bool file_exists(const String &p_name); ///< return true if a file exists
diff --git a/core/io/file_access_encrypted.cpp b/core/io/file_access_encrypted.cpp
index 461c5bafe2..c93e12f7da 100644
--- a/core/io/file_access_encrypted.cpp
+++ b/core/io/file_access_encrypted.cpp
@@ -268,6 +268,12 @@ void FileAccessEncrypted::store_buffer(const uint8_t *p_src, int p_length) {
}
}
+void FileAccessEncrypted::flush() {
+ ERR_FAIL_COND(!writing);
+
+ // encrypted files keep data in memory till close()
+}
+
void FileAccessEncrypted::store_8(uint8_t p_dest) {
ERR_FAIL_COND(!writing);
diff --git a/core/io/file_access_encrypted.h b/core/io/file_access_encrypted.h
index 82f60ac654..d83fed3e0e 100644
--- a/core/io/file_access_encrypted.h
+++ b/core/io/file_access_encrypted.h
@@ -71,6 +71,7 @@ public:
virtual Error get_error() const; ///< get last error
+ virtual void flush();
virtual void store_8(uint8_t p_dest); ///< store a byte
virtual void store_buffer(const uint8_t *p_src, int p_length); ///< store an array of bytes
diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp
index b948394385..0a5815fca8 100644
--- a/core/io/file_access_memory.cpp
+++ b/core/io/file_access_memory.cpp
@@ -170,6 +170,10 @@ Error FileAccessMemory::get_error() const {
return pos >= length ? ERR_FILE_EOF : OK;
}
+void FileAccessMemory::flush() {
+ ERR_FAIL_COND(!data);
+}
+
void FileAccessMemory::store_8(uint8_t p_byte) {
ERR_FAIL_COND(!data);
diff --git a/core/io/file_access_memory.h b/core/io/file_access_memory.h
index b7b8430089..23392719b4 100644
--- a/core/io/file_access_memory.h
+++ b/core/io/file_access_memory.h
@@ -62,6 +62,7 @@ public:
virtual Error get_error() const; ///< get last error
+ virtual void flush();
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
diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp
index 8c624226a1..a224abd9e7 100644
--- a/core/io/file_access_network.cpp
+++ b/core/io/file_access_network.cpp
@@ -456,6 +456,10 @@ Error FileAccessNetwork::get_error() const {
return pos == total_size ? ERR_FILE_EOF : OK;
}
+void FileAccessNetwork::flush() {
+ ERR_FAIL();
+}
+
void FileAccessNetwork::store_8(uint8_t p_dest) {
ERR_FAIL();
diff --git a/core/io/file_access_network.h b/core/io/file_access_network.h
index abbe378b60..20614476d0 100644
--- a/core/io/file_access_network.h
+++ b/core/io/file_access_network.h
@@ -155,6 +155,7 @@ public:
virtual Error get_error() const; ///< get last error
+ virtual void flush();
virtual void store_8(uint8_t p_dest); ///< store a byte
virtual bool file_exists(const String &p_path); ///< return true if a file exists
diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp
index ff4c28ec39..a7eb8ce6a9 100644
--- a/core/io/file_access_pack.cpp
+++ b/core/io/file_access_pack.cpp
@@ -293,6 +293,11 @@ Error FileAccessPack::get_error() const {
return OK;
}
+void FileAccessPack::flush() {
+
+ ERR_FAIL();
+}
+
void FileAccessPack::store_8(uint8_t p_dest) {
ERR_FAIL();
diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h
index 3deb0d2bd3..12187a353a 100644
--- a/core/io/file_access_pack.h
+++ b/core/io/file_access_pack.h
@@ -161,6 +161,7 @@ public:
virtual Error get_error() const;
+ virtual void flush();
virtual void store_8(uint8_t p_dest);
virtual void store_buffer(const uint8_t *p_src, int p_length);
diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp
index 73b23ac702..ec809011a9 100644
--- a/core/io/file_access_zip.cpp
+++ b/core/io/file_access_zip.cpp
@@ -353,6 +353,11 @@ Error FileAccessZip::get_error() const {
return OK;
};
+void FileAccessZip::flush() {
+
+ ERR_FAIL();
+}
+
void FileAccessZip::store_8(uint8_t p_dest) {
ERR_FAIL();
diff --git a/core/io/file_access_zip.h b/core/io/file_access_zip.h
index a40e1a753d..0977b241ee 100644
--- a/core/io/file_access_zip.h
+++ b/core/io/file_access_zip.h
@@ -108,6 +108,7 @@ public:
virtual Error get_error() const; ///< get last error
+ virtual void flush();
virtual void store_8(uint8_t p_dest); ///< store a byte
virtual bool file_exists(const String &p_name); ///< return true if a file exists
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index dd56db9bf9..b8c0a2b616 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -297,7 +297,7 @@ Error HTTPClient::poll() {
case StreamPeerTCP::STATUS_CONNECTED: {
if (ssl) {
Ref<StreamPeerSSL> ssl = StreamPeerSSL::create();
- Error err = ssl->connect_to_stream(tcp_connection, true, ssl_verify_host ? conn_host : String());
+ Error err = ssl->connect_to_stream(tcp_connection, ssl_verify_host, ssl_verify_host ? conn_host : String());
if (err != OK) {
close();
status = STATUS_SSL_HANDSHAKE_ERROR;
diff --git a/core/io/logger.cpp b/core/io/logger.cpp
new file mode 100644
index 0000000000..ad6371f1e1
--- /dev/null
+++ b/core/io/logger.cpp
@@ -0,0 +1,266 @@
+/*************************************************************************/
+/* logger.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "logger.h"
+#include "os/dir_access.h"
+#include "os/os.h"
+#include "print_string.h"
+
+// va_copy was defined in the C99, but not in C++ standards before C++11.
+// When you compile C++ without --std=c++<XX> option, compilers still define
+// va_copy, otherwise you have to use the internal version (__va_copy).
+#if !defined(va_copy)
+#if defined(__GNUC__)
+#define va_copy(d, s) __va_copy(d, s)
+#else
+#define va_copy(d, s) ((d) = (s))
+#endif
+#endif
+
+bool Logger::should_log(bool p_err) {
+ return (!p_err || _print_error_enabled) && (p_err || _print_line_enabled);
+}
+
+void Logger::log_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type) {
+ if (!should_log(true)) {
+ return;
+ }
+
+ const char *err_type = "**ERROR**";
+ switch (p_type) {
+ case ERR_ERROR: err_type = "**ERROR**"; break;
+ case ERR_WARNING: err_type = "**WARNING**"; break;
+ case ERR_SCRIPT: err_type = "**SCRIPT ERROR**"; break;
+ case ERR_SHADER: err_type = "**SHADER ERROR**"; break;
+ default: ERR_PRINT("Unknown error type"); break;
+ }
+
+ const char *err_details;
+ if (p_rationale && *p_rationale)
+ err_details = p_rationale;
+ else
+ err_details = p_code;
+
+ logf_error("%s: %s\n", err_type, err_details);
+ logf_error(" At: %s:%i:%s() - %s\n", p_file, p_line, p_function, p_code);
+}
+
+void Logger::logf(const char *p_format, ...) {
+ if (!should_log(false)) {
+ return;
+ }
+
+ va_list argp;
+ va_start(argp, p_format);
+
+ logv(p_format, argp, false);
+
+ va_end(argp);
+}
+
+void Logger::logf_error(const char *p_format, ...) {
+ if (!should_log(true)) {
+ return;
+ }
+
+ va_list argp;
+ va_start(argp, p_format);
+
+ logv(p_format, argp, true);
+
+ va_end(argp);
+}
+
+Logger::~Logger() {}
+
+void RotatedFileLogger::close_file() {
+ if (file) {
+ memdelete(file);
+ file = NULL;
+ }
+}
+
+void RotatedFileLogger::clear_old_backups() {
+ int max_backups = max_files - 1; // -1 for the current file
+
+ String basename = base_path.get_basename();
+ String extension = "." + base_path.get_extension();
+
+ DirAccess *da = DirAccess::open(base_path.get_base_dir());
+ if (!da) {
+ return;
+ }
+
+ da->list_dir_begin();
+ String f = da->get_next();
+ Set<String> backups;
+ while (f != String()) {
+ if (!da->current_is_dir() && f.begins_with(basename) && f.ends_with(extension) && f != base_path) {
+ backups.insert(f);
+ }
+ f = da->get_next();
+ }
+ da->list_dir_end();
+
+ if (backups.size() > max_backups) {
+ // since backups are appended with timestamp and Set iterates them in sorted order,
+ // first backups are the oldest
+ int to_delete = backups.size() - max_backups;
+ for (Set<String>::Element *E = backups.front(); E && to_delete > 0; E = E->next(), --to_delete) {
+ da->remove(E->get());
+ }
+ }
+
+ memdelete(da);
+}
+
+void RotatedFileLogger::rotate_file() {
+ close_file();
+
+ if (FileAccess::exists(base_path)) {
+ if (max_files > 1) {
+ char timestamp[21];
+ OS::Date date = OS::get_singleton()->get_date();
+ OS::Time time = OS::get_singleton()->get_time();
+ sprintf(timestamp, "-%04d-%02d-%02d-%02d-%02d-%02d", date.year, date.month, date.day + 1, time.hour, time.min, time.sec);
+
+ String backup_name = base_path.get_basename() + timestamp + "." + base_path.get_extension();
+
+ DirAccess *da = DirAccess::open(base_path.get_base_dir());
+ if (da) {
+ da->copy(base_path, backup_name);
+ memdelete(da);
+ }
+ clear_old_backups();
+ }
+ } else {
+ DirAccess *da = DirAccess::create(DirAccess::ACCESS_USERDATA);
+ if (da) {
+ da->make_dir_recursive(base_path.get_base_dir());
+ memdelete(da);
+ }
+ }
+
+ file = FileAccess::open(base_path, FileAccess::WRITE);
+}
+
+RotatedFileLogger::RotatedFileLogger(const String &p_base_path, int p_max_files) {
+ file = NULL;
+ base_path = p_base_path.simplify_path();
+ max_files = p_max_files > 0 ? p_max_files : 1;
+
+ rotate_file();
+}
+
+void RotatedFileLogger::logv(const char *p_format, va_list p_list, bool p_err) {
+ if (!should_log(p_err)) {
+ return;
+ }
+
+ if (file) {
+ const int static_buf_size = 512;
+ char static_buf[static_buf_size];
+ char *buf = static_buf;
+ va_list list_copy;
+ va_copy(list_copy, p_list);
+ int len = vsnprintf(buf, static_buf_size, p_format, p_list);
+ if (len >= static_buf_size) {
+ buf = (char *)Memory::alloc_static(len + 1);
+ vsnprintf(buf, len + 1, p_format, list_copy);
+ }
+ va_end(list_copy);
+ file->store_buffer((uint8_t *)buf, len);
+ if (len >= static_buf_size) {
+ Memory::free_static(buf);
+ }
+#ifdef DEBUG_ENABLED
+ const bool need_flush = true;
+#else
+ bool need_flush = p_err;
+#endif
+ if (need_flush) {
+ file->flush();
+ }
+ }
+}
+
+RotatedFileLogger::~RotatedFileLogger() {
+ close_file();
+}
+
+void StdLogger::logv(const char *p_format, va_list p_list, bool p_err) {
+ if (!should_log(p_err)) {
+ return;
+ }
+
+ if (p_err) {
+ vfprintf(stderr, p_format, p_list);
+ } else {
+ vprintf(p_format, p_list);
+#ifdef DEBUG_ENABLED
+ fflush(stdout);
+#endif
+ }
+}
+
+StdLogger::~StdLogger() {}
+
+CompositeLogger::CompositeLogger(Vector<Logger *> p_loggers) {
+ loggers = p_loggers;
+}
+
+void CompositeLogger::logv(const char *p_format, va_list p_list, bool p_err) {
+ if (!should_log(p_err)) {
+ return;
+ }
+
+ for (int i = 0; i < loggers.size(); ++i) {
+ va_list list_copy;
+ va_copy(list_copy, p_list);
+ loggers[i]->logv(p_format, list_copy, p_err);
+ va_end(list_copy);
+ }
+}
+
+void CompositeLogger::log_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type) {
+ if (!should_log(true)) {
+ return;
+ }
+
+ for (int i = 0; i < loggers.size(); ++i) {
+ loggers[i]->log_error(p_function, p_file, p_line, p_code, p_rationale, p_type);
+ }
+}
+
+CompositeLogger::~CompositeLogger() {
+ for (int i = 0; i < loggers.size(); ++i) {
+ memdelete(loggers[i]);
+ }
+}
diff --git a/core/io/logger.h b/core/io/logger.h
new file mode 100644
index 0000000000..cf0cc7699f
--- /dev/null
+++ b/core/io/logger.h
@@ -0,0 +1,107 @@
+/*************************************************************************/
+/* logger.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef LOGGER_H
+#define LOGGER_H
+
+#include "os/file_access.h"
+#include "ustring.h"
+#include "vector.h"
+#include <stdarg.h>
+
+class Logger {
+protected:
+ bool should_log(bool p_err);
+
+public:
+ enum ErrorType {
+ ERR_ERROR,
+ ERR_WARNING,
+ ERR_SCRIPT,
+ ERR_SHADER
+ };
+
+ virtual void logv(const char *p_format, va_list p_list, bool p_err) = 0;
+ virtual void log_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);
+
+ void logf(const char *p_format, ...);
+ void logf_error(const char *p_format, ...);
+
+ virtual ~Logger();
+};
+
+/**
+ * Writes messages to stdout/stderr.
+ */
+class StdLogger : public Logger {
+
+public:
+ virtual void logv(const char *p_format, va_list p_list, bool p_err);
+ virtual ~StdLogger();
+};
+
+/**
+ * Writes messages to the specified file. If the file already exists, creates a copy (backup)
+ * of it with timestamp appended to the file name. Maximum number of backups is configurable.
+ * When maximum is reached, the oldest backups are erased. With the maximum being equal to 1,
+ * it acts as a simple file logger.
+ */
+class RotatedFileLogger : public Logger {
+ String base_path;
+ int max_files;
+
+ FileAccess *file;
+
+ void rotate_file_without_closing();
+ void close_file();
+ void clear_old_backups();
+ void rotate_file();
+
+public:
+ RotatedFileLogger(const String &p_base_path, int p_max_files = 10);
+
+ virtual void logv(const char *p_format, va_list p_list, bool p_err);
+
+ virtual ~RotatedFileLogger();
+};
+
+class CompositeLogger : public Logger {
+ Vector<Logger *> loggers;
+
+public:
+ CompositeLogger(Vector<Logger *> p_loggers);
+
+ virtual void logv(const char *p_format, va_list p_list, bool p_err);
+ virtual void log_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 ~CompositeLogger();
+};
+
+#endif \ No newline at end of file
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index 0834d6c321..d388a622de 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -1140,8 +1140,9 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
if (buf) {
encode_uint32(0, buf);
buf += 4;
- r_len += 4;
}
+ r_len += 4;
+
} else {
_encode_string(obj->get_class(), buf, r_len);
diff --git a/core/io/resource_import.cpp b/core/io/resource_import.cpp
index bc7ea47762..401d704222 100644
--- a/core/io/resource_import.cpp
+++ b/core/io/resource_import.cpp
@@ -77,7 +77,7 @@ Error ResourceFormatImporter::_get_path_and_type(const String &p_path, PathAndTy
if (assign != String()) {
if (!path_found && assign.begins_with("path.") && r_path_and_type.path == String()) {
String feature = assign.get_slicec('.', 1);
- if (OS::get_singleton()->check_feature_support(feature)) {
+ if (OS::get_singleton()->has_feature(feature)) {
r_path_and_type.path = value;
path_found = true; //first match must have priority
}
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index 89cb4a22c2..ed0d491679 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -492,7 +492,7 @@ void ResourceLoader::reload_translation_remaps() {
void ResourceLoader::load_translation_remaps() {
- if (!ProjectSettings::get_singleton()->has("locale/translation_remaps"))
+ if (!ProjectSettings::get_singleton()->has_setting("locale/translation_remaps"))
return;
Dictionary remaps = ProjectSettings::get_singleton()->get("locale/translation_remaps");
diff --git a/core/map.h b/core/map.h
index a37d898a9c..f01062ebed 100644
--- a/core/map.h
+++ b/core/map.h
@@ -31,6 +31,7 @@
#define MAP_H
#include "set.h"
+
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
@@ -52,7 +53,6 @@ public:
private:
friend class Map<K, V, C, A>;
- //Color color;
int color;
Element *right;
Element *left;
@@ -61,7 +61,6 @@ public:
Element *_prev;
K _key;
V _value;
-
//_Data *data;
public:
@@ -147,7 +146,6 @@ private:
#ifdef GLOBALNIL_DISABLED
memdelete_allocator<Element, A>(_nil);
#endif
- //memdelete_allocator<Element,A>(_root);
}
};
@@ -158,6 +156,7 @@ private:
ERR_FAIL_COND(p_node == _data._nil && p_color == RED);
p_node->color = p_color;
}
+
inline void _rotate_left(Element *p_node) {
Element *r = p_node->right;
@@ -206,8 +205,9 @@ private:
while (node == node->parent->right) {
node = node->parent;
}
+
if (node->parent == _data._root)
- return NULL;
+ return NULL; // No successor, as p_node = last node
return node->parent;
}
}
@@ -225,10 +225,11 @@ private:
} else {
while (node == node->parent->left) {
- if (node->parent == _data._root)
- return NULL;
node = node->parent;
}
+
+ if (node == _data._root)
+ return NULL; // No predecessor, as p_node = first node
return node->parent;
}
}
@@ -239,16 +240,15 @@ private:
C less;
while (node != _data._nil) {
-
if (less(p_key, node->_key))
node = node->left;
else if (less(node->_key, p_key))
node = node->right;
else
- break; // found
+ return node; // found
}
- return (node != _data._nil) ? node : NULL;
+ return NULL;
}
Element *_find_closest(const K &p_key) const {
@@ -265,24 +265,68 @@ private:
else if (less(node->_key, p_key))
node = node->right;
else
- break; // found
+ return node; // found
}
- if (node == _data._nil) {
- if (prev == NULL)
- return NULL;
- if (less(p_key, prev->_key)) {
+ if (prev == NULL)
+ return NULL; // tree empty
- prev = prev->_prev;
- }
+ if (less(p_key, prev->_key))
+ prev = prev->_prev;
- return prev;
+ return prev;
+ }
- } else
- return node;
+ void _insert_rb_fix(Element *p_new_node) {
+
+ Element *node = p_new_node;
+ Element *nparent = node->parent;
+ Element *ngrand_parent;
+
+ while (nparent->color == RED) {
+ ngrand_parent = nparent->parent;
+
+ if (nparent == ngrand_parent->left) {
+ if (ngrand_parent->right->color == RED) {
+ _set_color(nparent, BLACK);
+ _set_color(ngrand_parent->right, BLACK);
+ _set_color(ngrand_parent, RED);
+ node = ngrand_parent;
+ nparent = node->parent;
+ } else {
+ if (node == nparent->right) {
+ _rotate_left(nparent);
+ node = nparent;
+ nparent = node->parent;
+ }
+ _set_color(nparent, BLACK);
+ _set_color(ngrand_parent, RED);
+ _rotate_right(ngrand_parent);
+ }
+ } else {
+ if (ngrand_parent->left->color == RED) {
+ _set_color(nparent, BLACK);
+ _set_color(ngrand_parent->left, BLACK);
+ _set_color(ngrand_parent, RED);
+ node = ngrand_parent;
+ nparent = node->parent;
+ } else {
+ if (node == nparent->left) {
+ _rotate_right(nparent);
+ node = nparent;
+ nparent = node->parent;
+ }
+ _set_color(nparent, BLACK);
+ _set_color(ngrand_parent, RED);
+ _rotate_left(ngrand_parent);
+ }
+ }
+ }
+
+ _set_color(_data._root->left, BLACK);
}
- Element *_insert(const K &p_key, bool &r_exists) {
+ Element *_insert(const K &p_key, const V &p_value) {
Element *new_parent = _data._root;
Element *node = _data._root->left;
@@ -297,27 +341,25 @@ private:
else if (less(node->_key, p_key))
node = node->right;
else {
- r_exists = true;
- return node;
+ node->_value = p_value;
+ return node; // Return existing node with new value
}
}
Element *new_node = memnew_allocator(Element, A);
-
new_node->parent = new_parent;
new_node->right = _data._nil;
new_node->left = _data._nil;
new_node->_key = p_key;
+ new_node->_value = p_value;
//new_node->data=_data;
- if (new_parent == _data._root || less(p_key, new_parent->_key)) {
+ if (new_parent == _data._root || less(p_key, new_parent->_key)) {
new_parent->left = new_node;
} else {
new_parent->right = new_node;
}
- r_exists = false;
-
new_node->_next = _successor(new_node);
new_node->_prev = _predecessor(new_node);
if (new_node->_next)
@@ -325,168 +367,113 @@ private:
if (new_node->_prev)
new_node->_prev->_next = new_node;
- return new_node;
- }
-
- Element *_insert_rb(const K &p_key, const V &p_value) {
-
- bool exists = false;
- Element *new_node = _insert(p_key, exists);
-
- if (new_node) {
- new_node->_value = p_value;
- }
- if (exists)
- return new_node;
-
- Element *node = new_node;
_data.size_cache++;
-
- while (node->parent->color == RED) {
-
- if (node->parent == node->parent->parent->left) {
-
- Element *aux = node->parent->parent->right;
-
- if (aux->color == RED) {
- _set_color(node->parent, BLACK);
- _set_color(aux, BLACK);
- _set_color(node->parent->parent, RED);
- node = node->parent->parent;
- } else {
- if (node == node->parent->right) {
- node = node->parent;
- _rotate_left(node);
- }
- _set_color(node->parent, BLACK);
- _set_color(node->parent->parent, RED);
- _rotate_right(node->parent->parent);
- }
- } else {
- Element *aux = node->parent->parent->left;
-
- if (aux->color == RED) {
- _set_color(node->parent, BLACK);
- _set_color(aux, BLACK);
- _set_color(node->parent->parent, RED);
- node = node->parent->parent;
- } else {
- if (node == node->parent->left) {
- node = node->parent;
- _rotate_right(node);
- }
- _set_color(node->parent, BLACK);
- _set_color(node->parent->parent, RED);
- _rotate_left(node->parent->parent);
- }
- }
- }
- _set_color(_data._root->left, BLACK);
+ _insert_rb_fix(new_node);
return new_node;
}
- void _erase_fix(Element *p_node) {
+ void _erase_fix_rb(Element *p_node) {
Element *root = _data._root->left;
- Element *node = p_node;
-
- while ((node->color == BLACK) && (root != node)) {
- if (node == node->parent->left) {
- Element *aux = node->parent->right;
- if (aux->color == RED) {
- _set_color(aux, BLACK);
- _set_color(node->parent, RED);
- _rotate_left(node->parent);
- aux = node->parent->right;
- }
- if ((aux->right->color == BLACK) && (aux->left->color == BLACK)) {
- _set_color(aux, RED);
- node = node->parent;
+ Element *node = _data._nil;
+ Element *sibling = p_node;
+ Element *parent = sibling->parent;
+
+ while (node != root) { // If red node found, will exit at a break
+ if (sibling->color == RED) {
+ _set_color(sibling, BLACK);
+ _set_color(parent, RED);
+ if (sibling == parent->right) {
+ sibling = sibling->left;
+ _rotate_left(parent);
} else {
- if (aux->right->color == BLACK) {
- _set_color(aux->left, BLACK);
- _set_color(aux, RED);
- _rotate_right(aux);
- aux = node->parent->right;
- }
- _set_color(aux, node->parent->color);
- _set_color(node->parent, BLACK);
- _set_color(aux->right, BLACK);
- _rotate_left(node->parent);
- node = root; /* this is to exit while loop */
+ sibling = sibling->right;
+ _rotate_right(parent);
}
- } else { /* the code below is has left and right switched from above */
- Element *aux = node->parent->left;
- if (aux->color == RED) {
- _set_color(aux, BLACK);
- _set_color(node->parent, RED);
- _rotate_right(node->parent);
- aux = node->parent->left;
+ }
+ if ((sibling->left->color == BLACK) && (sibling->right->color == BLACK)) {
+ _set_color(sibling, RED);
+ if (parent->color == RED) {
+ _set_color(parent, BLACK);
+ break;
+ } else { // loop: haven't found any red nodes yet
+ node = parent;
+ parent = node->parent;
+ sibling = (node == parent->left) ? parent->right : parent->left;
}
- if ((aux->right->color == BLACK) && (aux->left->color == BLACK)) {
- _set_color(aux, RED);
- node = node->parent;
+ } else {
+ if (sibling == parent->right) {
+ if (sibling->right->color == BLACK) {
+ _set_color(sibling->left, BLACK);
+ _set_color(sibling, RED);
+ _rotate_right(sibling);
+ sibling = sibling->parent;
+ }
+ _set_color(sibling, parent->color);
+ _set_color(parent, BLACK);
+ _set_color(sibling->right, BLACK);
+ _rotate_left(parent);
+ break;
} else {
- if (aux->left->color == BLACK) {
- _set_color(aux->right, BLACK);
- _set_color(aux, RED);
- _rotate_left(aux);
- aux = node->parent->left;
+ if (sibling->left->color == BLACK) {
+ _set_color(sibling->right, BLACK);
+ _set_color(sibling, RED);
+ _rotate_left(sibling);
+ sibling = sibling->parent;
}
- _set_color(aux, node->parent->color);
- _set_color(node->parent, BLACK);
- _set_color(aux->left, BLACK);
- _rotate_right(node->parent);
- node = root;
+
+ _set_color(sibling, parent->color);
+ _set_color(parent, BLACK);
+ _set_color(sibling->left, BLACK);
+ _rotate_right(parent);
+ break;
}
}
}
- _set_color(node, BLACK);
-
ERR_FAIL_COND(_data._nil->color != BLACK);
}
void _erase(Element *p_node) {
- Element *rp = ((p_node->left == _data._nil) || (p_node->right == _data._nil)) ? p_node : _successor(p_node);
- if (!rp)
- rp = _data._nil;
+ Element *rp = ((p_node->left == _data._nil) || (p_node->right == _data._nil)) ? p_node : p_node->_next;
Element *node = (rp->left == _data._nil) ? rp->right : rp->left;
node->parent = rp->parent;
- if (_data._root == node->parent) {
- _data._root->left = node;
+ Element *sibling;
+ if (rp == rp->parent->left) {
+ rp->parent->left = node;
+ sibling = rp->parent->right;
} else {
- if (rp == rp->parent->left) {
- rp->parent->left = node;
- } else {
- rp->parent->right = node;
- }
+ rp->parent->right = node;
+ sibling = rp->parent->left;
+ }
+
+ if (node->color == RED) {
+ node->parent = rp->parent;
+ _set_color(node, BLACK);
+ } else if (rp->color == BLACK && rp->parent != _data._root) {
+ _erase_fix_rb(sibling);
}
if (rp != p_node) {
ERR_FAIL_COND(rp == _data._nil);
- if (rp->color == BLACK)
- _erase_fix(node);
-
rp->left = p_node->left;
rp->right = p_node->right;
rp->parent = p_node->parent;
rp->color = p_node->color;
- p_node->left->parent = rp;
- p_node->right->parent = rp;
+ if (p_node->left != _data._nil)
+ p_node->left->parent = rp;
+ if (p_node->right != _data._nil)
+ p_node->right->parent = rp;
if (p_node == p_node->parent->left) {
p_node->parent->left = rp;
} else {
p_node->parent->right = rp;
}
- } else {
- if (p_node->color == BLACK)
- _erase_fix(node);
}
if (p_node->_next)
@@ -501,11 +488,12 @@ private:
void _calculate_depth(Element *p_element, int &max_d, int d) const {
- if (p_element == _data._nil) {
+ if (p_element == _data._nil)
return;
- }
+
_calculate_depth(p_element->left, max_d, d + 1);
_calculate_depth(p_element->right, max_d, d + 1);
+
if (d > max_d)
max_d = d;
}
@@ -544,6 +532,7 @@ public:
if (!_data._root)
return NULL;
+
Element *res = _find(p_key);
return res;
}
@@ -552,6 +541,7 @@ public:
if (!_data._root)
return NULL;
+
const Element *res = _find_closest(p_key);
return res;
}
@@ -560,21 +550,28 @@ public:
if (!_data._root)
return NULL;
+
Element *res = _find_closest(p_key);
return res;
}
+ bool has(const K &p_key) const {
+
+ return find(p_key) != NULL;
+ }
+
Element *insert(const K &p_key, const V &p_value) {
if (!_data._root)
_data._create_root();
- return _insert_rb(p_key, p_value);
+ return _insert(p_key, p_value);
}
void erase(Element *p_element) {
- if (!_data._root)
+ if (!_data._root || !p_element)
return;
+
_erase(p_element);
if (_data.size_cache == 0 && _data._root)
_data._free_root();
@@ -584,20 +581,17 @@ public:
if (!_data._root)
return false;
+
Element *e = find(p_key);
if (!e)
return false;
+
_erase(e);
+ if (_data.size_cache == 0 && _data._root)
+ _data._free_root();
return true;
}
- bool has(const K &p_key) const {
-
- if (!_data._root)
- return false;
- return find(p_key) != NULL;
- }
-
const V &operator[](const K &p_key) const {
CRASH_COND(!_data._root);
@@ -605,6 +599,7 @@ public:
CRASH_COND(!e);
return e->_value;
}
+
V &operator[](const K &p_key) {
if (!_data._root)
@@ -614,7 +609,6 @@ public:
if (!e)
e = insert(p_key, V());
- CRASH_COND(!e);
return e->_value;
}
@@ -637,6 +631,7 @@ public:
if (!_data._root)
return NULL;
+
Element *e = _data._root->left;
if (e == _data._nil)
return NULL;
@@ -649,10 +644,12 @@ public:
inline bool empty() const { return _data.size_cache == 0; }
inline int size() const { return _data.size_cache; }
+
int calculate_depth() const {
// used for debug mostly
if (!_data._root)
return 0;
+
int max_d = 0;
_calculate_depth(_data._root->left, max_d, 0);
return max_d;
@@ -662,10 +659,10 @@ public:
if (!_data._root)
return;
+
_cleanup_tree(_data._root->left);
_data._root->left = _data._nil;
_data.size_cache = 0;
- _data._nil->parent = _data._nil;
_data._free_root();
}
diff --git a/core/object.cpp b/core/object.cpp
index b1770f1d7a..823cbe14d4 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -1052,7 +1052,7 @@ Variant Object::_emit_signal(const Variant **p_args, int p_argcount, Variant::Ca
Error Object::emit_signal(const StringName &p_name, const Variant **p_args, int p_argcount) {
if (_block_signals)
- return ERR_CANT_AQUIRE_RESOURCE; //no emit, signals blocked
+ return ERR_CANT_ACQUIRE_RESOURCE; //no emit, signals blocked
Signal *s = signal_map.getptr(p_name);
if (!s) {
diff --git a/core/object.h b/core/object.h
index 3070439138..7af2c78fc3 100644
--- a/core/object.h
+++ b/core/object.h
@@ -64,9 +64,9 @@ enum PropertyHint {
PROPERTY_HINT_LAYERS_3D_RENDER,
PROPERTY_HINT_LAYERS_3D_PHYSICS,
PROPERTY_HINT_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc,"
- PROPERTY_HINT_DIR, ///< a directort path must be passed
+ PROPERTY_HINT_DIR, ///< a directory path must be passed
PROPERTY_HINT_GLOBAL_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc,"
- PROPERTY_HINT_GLOBAL_DIR, ///< a directort path must be passed
+ PROPERTY_HINT_GLOBAL_DIR, ///< a directory path must be passed
PROPERTY_HINT_RESOURCE_TYPE, ///< a resource object type
PROPERTY_HINT_MULTILINE_TEXT, ///< used for string properties that can contain multiple lines
PROPERTY_HINT_COLOR_NO_ALPHA, ///< used for ignoring alpha component when editing a color
@@ -221,7 +221,7 @@ struct MethodInfo {
//return NULL;
/*
- the following is an uncomprehensible blob of hacks and workarounds to compensate for many of the fallencies in C++. As a plus, this macro pretty much alone defines the object model.
+ the following is an incomprehensible blob of hacks and workarounds to compensate for many of the fallencies in C++. As a plus, this macro pretty much alone defines the object model.
*/
#define REVERSE_GET_PROPERTY_LIST \
diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp
index b969b58bfb..fcb3b58fed 100644
--- a/core/os/file_access.cpp
+++ b/core/os/file_access.cpp
@@ -55,7 +55,7 @@ FileAccess *FileAccess::create(AccessType p_access) {
bool FileAccess::exists(const String &p_name) {
- if (PackedData::get_singleton()->has_path(p_name))
+ if (PackedData::get_singleton() && PackedData::get_singleton()->has_path(p_name))
return true;
FileAccess *f = open(p_name, READ);
diff --git a/core/os/file_access.h b/core/os/file_access.h
index 34e7549fa3..455dd1ea99 100644
--- a/core/os/file_access.h
+++ b/core/os/file_access.h
@@ -119,6 +119,7 @@ public:
virtual Error get_error() const = 0; ///< get last error
+ virtual void flush() = 0;
virtual void store_8(uint8_t p_dest) = 0; ///< store a byte
virtual void store_16(uint16_t p_dest); ///< store 16 bits uint
virtual void store_32(uint32_t p_dest); ///< store 32 bits uint
diff --git a/core/os/os.cpp b/core/os/os.cpp
index 437ce01a5e..eb5d5be33d 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -62,20 +62,20 @@ void OS::debug_break(){
// something
};
-void OS::print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type) {
-
- const char *err_type = "**ERROR**";
- switch (p_type) {
- case ERR_ERROR: err_type = "**ERROR**"; break;
- case ERR_WARNING: err_type = "**WARNING**"; break;
- case ERR_SCRIPT: err_type = "**SCRIPT ERROR**"; break;
- case ERR_SHADER: err_type = "**SHADER ERROR**"; break;
- default: ERR_PRINT("Unknown error type"); break;
+void OS::_set_logger(Logger *p_logger) {
+ if (_logger) {
+ memdelete(_logger);
}
+ _logger = p_logger;
+}
+
+void OS::initialize_logger() {
+ _set_logger(memnew(StdLogger));
+}
+
+void OS::print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, Logger::ErrorType p_type) {
- if (p_rationale && *p_rationale)
- print("%s: %s\n ", err_type, p_rationale);
- print("%s: At: %s:%i:%s() - %s\n", err_type, p_file, p_line, p_function, p_code);
+ _logger->log_error(p_function, p_file, p_line, p_code, p_rationale, p_type);
}
void OS::print(const char *p_format, ...) {
@@ -83,17 +83,16 @@ void OS::print(const char *p_format, ...) {
va_list argp;
va_start(argp, p_format);
- vprint(p_format, argp);
+ _logger->logv(p_format, argp, false);
va_end(argp);
};
void OS::printerr(const char *p_format, ...) {
-
va_list argp;
va_start(argp, p_format);
- vprint(p_format, argp, true);
+ _logger->logv(p_format, argp, true);
va_end(argp);
};
@@ -194,6 +193,10 @@ void OS::show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_scr
void OS::hide_virtual_keyboard() {
}
+int OS::get_virtual_keyboard_height() const {
+ return 0;
+}
+
void OS::print_all_resources(String p_to_file) {
ERR_FAIL_COND(p_to_file != "" && _OSPRF);
@@ -495,7 +498,7 @@ int OS::get_power_percent_left() {
return -1;
}
-bool OS::check_feature_support(const String &p_feature) {
+bool OS::has_feature(const String &p_feature) {
if (p_feature == get_name())
return true;
@@ -507,6 +510,13 @@ bool OS::check_feature_support(const String &p_feature) {
return true;
#endif
+ if (sizeof(void *) == 8 && p_feature == "64") {
+ return true;
+ }
+ if (sizeof(void *) == 4 && p_feature == "32") {
+ return true;
+ }
+
if (_check_internal_feature_support(p_feature))
return true;
@@ -531,11 +541,14 @@ OS::OS() {
_render_thread_mode = RENDER_THREAD_SAFE;
- _allow_hidpi = true;
+ _allow_hidpi = false;
_stack_bottom = (void *)(&stack_bottom);
+
+ _logger = NULL;
+ _set_logger(memnew(StdLogger));
}
OS::~OS() {
-
+ memdelete(_logger);
singleton = NULL;
}
diff --git a/core/os/os.h b/core/os/os.h
index 38bbbc0a57..48effe99da 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -32,6 +32,7 @@
#include "engine.h"
#include "image.h"
+#include "io/logger.h"
#include "list.h"
#include "os/main_loop.h"
#include "ustring.h"
@@ -61,6 +62,11 @@ class OS {
void *_stack_bottom;
+ Logger *_logger;
+
+protected:
+ void _set_logger(Logger *p_logger);
+
public:
typedef void (*ImeCallback)(void *p_inp, String p_text, Point2 p_selection);
@@ -108,6 +114,7 @@ protected:
virtual int get_audio_driver_count() const = 0;
virtual const char *get_audio_driver_name(int p_driver) const = 0;
+ virtual void initialize_logger();
virtual void initialize_core() = 0;
virtual void initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) = 0;
@@ -127,18 +134,10 @@ public:
static OS *get_singleton();
- enum ErrorType {
- ERR_ERROR,
- ERR_WARNING,
- ERR_SCRIPT,
- ERR_SHADER
- };
-
- 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);
+ void print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, Logger::ErrorType p_type = Logger::ERR_ERROR);
+ void print(const char *p_format, ...);
+ void printerr(const char *p_format, ...);
- virtual void print(const char *p_format, ...);
- virtual void printerr(const char *p_format, ...);
- virtual void vprint(const char *p_format, va_list p_list, bool p_stderr = false) = 0;
virtual void alert(const String &p_alert, const String &p_title = "ALERT!") = 0;
virtual String get_stdin_string(bool p_block = true) = 0;
@@ -205,7 +204,7 @@ public:
virtual String get_installed_templates_path() const { return ""; }
virtual String get_executable_path() const;
- virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL) = 0;
+ virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false) = 0;
virtual Error kill(const ProcessID &p_pid) = 0;
virtual int get_process_id() const;
@@ -284,6 +283,8 @@ public:
virtual bool can_draw() const = 0;
+ virtual bool is_userfs_persistent() const { return true; }
+
bool is_stdout_verbose() const;
virtual void disable_crash_handler() {}
@@ -314,6 +315,9 @@ public:
virtual void show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect = Rect2());
virtual void hide_virtual_keyboard();
+ // returns height of the currently shown virtual keyboard (0 if keyboard is hidden)
+ virtual int get_virtual_keyboard_height() const;
+
virtual void set_cursor_shape(CursorShape p_shape) = 0;
virtual bool get_swap_ok_cancel() { return false; }
@@ -335,6 +339,8 @@ public:
virtual String get_data_dir() const;
virtual String get_resource_dir() const;
+ virtual Error move_to_trash(const String &p_path) { return FAILED; }
+
enum SystemDir {
SYSTEM_DIR_DESKTOP,
SYSTEM_DIR_DCIM,
@@ -424,7 +430,7 @@ public:
virtual int get_power_seconds_left();
virtual int get_power_percent_left();
- bool check_feature_support(const String &p_feature);
+ bool has_feature(const String &p_feature);
/**
* Returns the stack bottom of the main thread of the application.
diff --git a/core/project_settings.cpp b/core/project_settings.cpp
index 14ebe87dc5..3994011c06 100644
--- a/core/project_settings.cpp
+++ b/core/project_settings.cpp
@@ -152,7 +152,7 @@ bool ProjectSettings::_set(const StringName &p_name, const Variant &p_value) {
bool override_valid = false;
for (int i = 1; i < s.size(); i++) {
String feature = s[i].strip_edges();
- if (OS::get_singleton()->check_feature_support(feature) || custom_features.has(feature)) {
+ if (OS::get_singleton()->has_feature(feature) || custom_features.has(feature)) {
override_valid = true;
break;
}
@@ -420,7 +420,7 @@ Error ProjectSettings::setup(const String &p_path, const String &p_main_pack) {
return OK;
}
-bool ProjectSettings::has(String p_var) const {
+bool ProjectSettings::has_setting(String p_var) const {
_THREAD_SAFE_METHOD_
@@ -667,8 +667,8 @@ Error ProjectSettings::_save_settings_text(const String &p_file, const Map<Strin
file->store_line("; Engine configuration file.");
file->store_line("; It's best edited using the editor UI and not directly,");
file->store_line("; since the parameters that go here are not all obvious.");
- file->store_line("; ");
- file->store_line("; Format: ");
+ file->store_line(";");
+ file->store_line("; Format:");
file->store_line("; [section] ; section goes between []");
file->store_line("; param=value ; assign values to parameters");
file->store_line("");
@@ -800,7 +800,7 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust
Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default) {
Variant ret;
- if (ProjectSettings::get_singleton()->has(p_var)) {
+ if (ProjectSettings::get_singleton()->has_setting(p_var)) {
ret = ProjectSettings::get_singleton()->get(p_var);
} else {
ProjectSettings::get_singleton()->set(p_var, p_default);
@@ -907,9 +907,19 @@ Variant ProjectSettings::property_get_revert(const String &p_name) {
return props[p_name].initial;
}
+void ProjectSettings::set_setting(const String &p_setting, const Variant &p_value) {
+ set(p_setting, p_value);
+}
+
+Variant ProjectSettings::get_setting(const String &p_setting) const {
+ return get(p_setting);
+}
+
void ProjectSettings::_bind_methods() {
- ClassDB::bind_method(D_METHOD("has", "name"), &ProjectSettings::has);
+ ClassDB::bind_method(D_METHOD("has_setting", "name"), &ProjectSettings::has_setting);
+ ClassDB::bind_method(D_METHOD("set_setting", "name", "value"), &ProjectSettings::set_setting);
+ ClassDB::bind_method(D_METHOD("get_setting", "name"), &ProjectSettings::get_setting);
ClassDB::bind_method(D_METHOD("set_order", "name", "position"), &ProjectSettings::set_order);
ClassDB::bind_method(D_METHOD("get_order", "name"), &ProjectSettings::get_order);
ClassDB::bind_method(D_METHOD("set_initial_value", "name", "value"), &ProjectSettings::set_initial_value);
diff --git a/core/project_settings.h b/core/project_settings.h
index 718ab2a011..ea6034dc84 100644
--- a/core/project_settings.h
+++ b/core/project_settings.h
@@ -119,7 +119,10 @@ protected:
static void _bind_methods();
public:
- bool has(String p_var) const;
+ void set_setting(const String &p_setting, const Variant &p_value);
+ Variant get_setting(const String &p_setting) const;
+
+ bool has_setting(String p_var) const;
String localize_path(const String &p_path) const;
String globalize_path(const String &p_path) const;
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index 0e34a3eea5..c6d7cd44e8 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -40,6 +40,7 @@
#include "io/config_file.h"
#include "io/http_client.h"
#include "io/marshalls.h"
+#include "io/networked_multiplayer_peer.h"
#include "io/packet_peer.h"
#include "io/packet_peer_udp.h"
#include "io/pck_packer.h"
@@ -109,6 +110,8 @@ void register_core_types() {
ClassDB::register_class<Object>();
+ ClassDB::register_virtual_class<Script>();
+
ClassDB::register_class<Reference>();
ClassDB::register_class<WeakRef>();
ClassDB::register_class<Resource>();
@@ -136,6 +139,7 @@ void register_core_types() {
ClassDB::register_virtual_class<IP>();
ClassDB::register_virtual_class<PacketPeer>();
ClassDB::register_class<PacketPeerStream>();
+ ClassDB::register_virtual_class<NetworkedMultiplayerPeer>();
ClassDB::register_class<MainLoop>();
//ClassDB::register_type<OptimizedSaver>();
ClassDB::register_class<Translation>();
@@ -185,6 +189,20 @@ void register_core_settings() {
void register_core_singletons() {
+ ClassDB::register_class<ProjectSettings>();
+ ClassDB::register_virtual_class<IP>();
+ ClassDB::register_class<_Geometry>();
+ ClassDB::register_class<_ResourceLoader>();
+ ClassDB::register_class<_ResourceSaver>();
+ ClassDB::register_class<_OS>();
+ ClassDB::register_class<_Engine>();
+ ClassDB::register_class<_ClassDB>();
+ ClassDB::register_class<_Marshalls>();
+ ClassDB::register_class<TranslationServer>();
+ ClassDB::register_virtual_class<Input>();
+ ClassDB::register_class<InputMap>();
+ ClassDB::register_class<_JSON>();
+
ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("ProjectSettings", ProjectSettings::get_singleton()));
ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("IP", IP::get_singleton()));
ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("Geometry", _Geometry::get_singleton()));
diff --git a/core/safe_refcount.cpp b/core/safe_refcount.cpp
index c330a983a7..c9acdb7970 100644
--- a/core/safe_refcount.cpp
+++ b/core/safe_refcount.cpp
@@ -27,122 +27,10 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "safe_refcount.h"
-
-// Atomic functions, these are used for multithread safe reference counters!
-
-#ifdef NO_THREADS
-
-/* Bogus implementation unaware of multiprocessing */
-
-template <class T>
-static _ALWAYS_INLINE_ T _atomic_conditional_increment_impl(register T *pw) {
-
- if (*pw == 0)
- return 0;
-
- (*pw)++;
-
- return *pw;
-}
-
-template <class T>
-static _ALWAYS_INLINE_ T _atomic_decrement_impl(register T *pw) {
-
- (*pw)--;
-
- return *pw;
-}
-
-template <class T>
-static _ALWAYS_INLINE_ T _atomic_increment_impl(register T *pw) {
-
- (*pw)++;
-
- return *pw;
-}
-
-template <class T>
-static _ALWAYS_INLINE_ T _atomic_sub_impl(register T *pw, register T val) {
-
- (*pw) -= val;
-
- return *pw;
-}
-
-template <class T>
-static _ALWAYS_INLINE_ T _atomic_add_impl(register T *pw, register T val) {
-
- (*pw) += val;
-
- return *pw;
-}
-
-template <class T>
-static _ALWAYS_INLINE_ T _atomic_exchange_if_greater_impl(register T *pw, register T val) {
-
- if (val > *pw)
- *pw = val;
-
- return *pw;
-}
-#elif defined(__GNUC__)
-
-/* Implementation for GCC & Clang */
-
-// GCC guarantees atomic intrinsics for sizes of 1, 2, 4 and 8 bytes.
-// Clang states it supports GCC atomic builtins.
-
-template <class T>
-static _ALWAYS_INLINE_ T _atomic_conditional_increment_impl(register T *pw) {
-
- while (true) {
- T tmp = static_cast<T const volatile &>(*pw);
- if (tmp == 0)
- return 0; // if zero, can't add to it anymore
- if (__sync_val_compare_and_swap(pw, tmp, tmp + 1) == tmp)
- return tmp + 1;
- }
-}
-
-template <class T>
-static _ALWAYS_INLINE_ T _atomic_decrement_impl(register T *pw) {
-
- return __sync_sub_and_fetch(pw, 1);
-}
-
-template <class T>
-static _ALWAYS_INLINE_ T _atomic_increment_impl(register T *pw) {
-
- return __sync_add_and_fetch(pw, 1);
-}
-
-template <class T>
-static _ALWAYS_INLINE_ T _atomic_sub_impl(register T *pw, register T val) {
-
- return __sync_sub_and_fetch(pw, val);
-}
-
-template <class T>
-static _ALWAYS_INLINE_ T _atomic_add_impl(register T *pw, register T val) {
-
- return __sync_add_and_fetch(pw, val);
-}
-
-template <class T>
-static _ALWAYS_INLINE_ T _atomic_exchange_if_greater_impl(register T *pw, register T val) {
-
- while (true) {
- T tmp = static_cast<T const volatile &>(*pw);
- if (tmp >= val)
- return tmp; // already greater, or equal
- if (__sync_val_compare_and_swap(pw, tmp, val) == tmp)
- return val;
- }
-}
+#include "safe_refcount.h"
-#elif defined(_MSC_VER)
+#if defined(_MSC_VER)
/* Implementation for MSVC-Windows */
@@ -169,73 +57,66 @@ static _ALWAYS_INLINE_ T _atomic_exchange_if_greater_impl(register T *pw, regist
return m_val; \
}
-static _ALWAYS_INLINE_ uint32_t _atomic_conditional_increment_impl(register uint32_t *pw) {
+_ALWAYS_INLINE_ uint32_t _atomic_conditional_increment_impl(register uint32_t *pw) {
ATOMIC_CONDITIONAL_INCREMENT_BODY(pw, LONG, InterlockedCompareExchange, uint32_t)
}
-static _ALWAYS_INLINE_ uint32_t _atomic_decrement_impl(register uint32_t *pw) {
+_ALWAYS_INLINE_ uint32_t _atomic_decrement_impl(register uint32_t *pw) {
return InterlockedDecrement((LONG volatile *)pw);
}
-static _ALWAYS_INLINE_ uint32_t _atomic_increment_impl(register uint32_t *pw) {
+_ALWAYS_INLINE_ uint32_t _atomic_increment_impl(register uint32_t *pw) {
return InterlockedIncrement((LONG volatile *)pw);
}
-static _ALWAYS_INLINE_ uint32_t _atomic_sub_impl(register uint32_t *pw, register uint32_t val) {
+_ALWAYS_INLINE_ uint32_t _atomic_sub_impl(register uint32_t *pw, register uint32_t val) {
return InterlockedExchangeAdd((LONG volatile *)pw, -(int32_t)val) - val;
}
-static _ALWAYS_INLINE_ uint32_t _atomic_add_impl(register uint32_t *pw, register uint32_t val) {
+_ALWAYS_INLINE_ uint32_t _atomic_add_impl(register uint32_t *pw, register uint32_t val) {
return InterlockedAdd((LONG volatile *)pw, val);
}
-static _ALWAYS_INLINE_ uint32_t _atomic_exchange_if_greater_impl(register uint32_t *pw, register uint32_t val) {
+_ALWAYS_INLINE_ uint32_t _atomic_exchange_if_greater_impl(register uint32_t *pw, register uint32_t val) {
ATOMIC_EXCHANGE_IF_GREATER_BODY(pw, val, LONG, InterlockedCompareExchange, uint32_t)
}
-static _ALWAYS_INLINE_ uint64_t _atomic_conditional_increment_impl(register uint64_t *pw) {
+_ALWAYS_INLINE_ uint64_t _atomic_conditional_increment_impl(register uint64_t *pw) {
ATOMIC_CONDITIONAL_INCREMENT_BODY(pw, LONGLONG, InterlockedCompareExchange64, uint64_t)
}
-static _ALWAYS_INLINE_ uint64_t _atomic_decrement_impl(register uint64_t *pw) {
+_ALWAYS_INLINE_ uint64_t _atomic_decrement_impl(register uint64_t *pw) {
return InterlockedDecrement64((LONGLONG volatile *)pw);
}
-static _ALWAYS_INLINE_ uint64_t _atomic_increment_impl(register uint64_t *pw) {
+_ALWAYS_INLINE_ uint64_t _atomic_increment_impl(register uint64_t *pw) {
return InterlockedIncrement64((LONGLONG volatile *)pw);
}
-static _ALWAYS_INLINE_ uint64_t _atomic_sub_impl(register uint64_t *pw, register uint64_t val) {
+_ALWAYS_INLINE_ uint64_t _atomic_sub_impl(register uint64_t *pw, register uint64_t val) {
return InterlockedExchangeAdd64((LONGLONG volatile *)pw, -(int64_t)val) - val;
}
-static _ALWAYS_INLINE_ uint64_t _atomic_add_impl(register uint64_t *pw, register uint64_t val) {
+_ALWAYS_INLINE_ uint64_t _atomic_add_impl(register uint64_t *pw, register uint64_t val) {
return InterlockedAdd64((LONGLONG volatile *)pw, val);
}
-static _ALWAYS_INLINE_ uint64_t _atomic_exchange_if_greater_impl(register uint64_t *pw, register uint64_t val) {
+_ALWAYS_INLINE_ uint64_t _atomic_exchange_if_greater_impl(register uint64_t *pw, register uint64_t val) {
ATOMIC_EXCHANGE_IF_GREATER_BODY(pw, val, LONGLONG, InterlockedCompareExchange64, uint64_t)
}
-#else
-
-//no threads supported?
-#error Must provide atomic functions for this platform or compiler!
-
-#endif
-
// The actual advertised functions; they'll call the right implementation
uint32_t atomic_conditional_increment(register uint32_t *counter) {
@@ -285,3 +166,4 @@ uint64_t atomic_add(register uint64_t *pw, register uint64_t val) {
uint64_t atomic_exchange_if_greater(register uint64_t *pw, register uint64_t val) {
return _atomic_exchange_if_greater_impl(pw, val);
}
+#endif
diff --git a/core/safe_refcount.h b/core/safe_refcount.h
index 802d84cccc..39967d5ac4 100644
--- a/core/safe_refcount.h
+++ b/core/safe_refcount.h
@@ -36,20 +36,141 @@
#include "platform_config.h"
#include "typedefs.h"
-uint32_t atomic_conditional_increment(register uint32_t *counter);
+// Atomic functions, these are used for multithread safe reference counters!
+
+#ifdef NO_THREADS
+
+/* Bogus implementation unaware of multiprocessing */
+
+template <class T>
+static _ALWAYS_INLINE_ T atomic_conditional_increment(register T *pw) {
+
+ if (*pw == 0)
+ return 0;
+
+ (*pw)++;
+
+ return *pw;
+}
+
+template <class T>
+static _ALWAYS_INLINE_ T atomic_decrement(register T *pw) {
+
+ (*pw)--;
+
+ return *pw;
+}
+
+template <class T>
+static _ALWAYS_INLINE_ T atomic_increment(register T *pw) {
+
+ (*pw)++;
+
+ return *pw;
+}
+
+template <class T, class V>
+static _ALWAYS_INLINE_ T atomic_sub(register T *pw, register V val) {
+
+ (*pw) -= val;
+
+ return *pw;
+}
+
+template <class T, class V>
+static _ALWAYS_INLINE_ T atomic_add(register T *pw, register V val) {
+
+ (*pw) += val;
+
+ return *pw;
+}
+
+template <class T, class V>
+static _ALWAYS_INLINE_ T atomic_exchange_if_greater(register T *pw, register V val) {
+
+ if (val > *pw)
+ *pw = val;
+
+ return *pw;
+}
+
+#elif defined(__GNUC__)
+
+/* Implementation for GCC & Clang */
+
+// GCC guarantees atomic intrinsics for sizes of 1, 2, 4 and 8 bytes.
+// Clang states it supports GCC atomic builtins.
+
+template <class T>
+static _ALWAYS_INLINE_ T atomic_conditional_increment(register T *pw) {
+
+ while (true) {
+ T tmp = static_cast<T const volatile &>(*pw);
+ if (tmp == 0)
+ return 0; // if zero, can't add to it anymore
+ if (__sync_val_compare_and_swap(pw, tmp, tmp + 1) == tmp)
+ return tmp + 1;
+ }
+}
+
+template <class T>
+static _ALWAYS_INLINE_ T atomic_decrement(register T *pw) {
+
+ return __sync_sub_and_fetch(pw, 1);
+}
+
+template <class T>
+static _ALWAYS_INLINE_ T atomic_increment(register T *pw) {
+
+ return __sync_add_and_fetch(pw, 1);
+}
+
+template <class T, class V>
+static _ALWAYS_INLINE_ T atomic_sub(register T *pw, register V val) {
+
+ return __sync_sub_and_fetch(pw, val);
+}
+
+template <class T, class V>
+static _ALWAYS_INLINE_ T atomic_add(register T *pw, register V val) {
+
+ return __sync_add_and_fetch(pw, val);
+}
+
+template <class T, class V>
+static _ALWAYS_INLINE_ T atomic_exchange_if_greater(register T *pw, register V val) {
+
+ while (true) {
+ T tmp = static_cast<T const volatile &>(*pw);
+ if (tmp >= val)
+ return tmp; // already greater, or equal
+ if (__sync_val_compare_and_swap(pw, tmp, val) == tmp)
+ return val;
+ }
+}
+
+#elif defined(_MSC_VER)
+// For MSVC use a separate compilation unit to prevent windows.h from polluting
+// the global namespace.
+uint32_t atomic_conditional_increment(register uint32_t *pw);
uint32_t atomic_decrement(register uint32_t *pw);
uint32_t atomic_increment(register uint32_t *pw);
uint32_t atomic_sub(register uint32_t *pw, register uint32_t val);
uint32_t atomic_add(register uint32_t *pw, register uint32_t val);
uint32_t atomic_exchange_if_greater(register uint32_t *pw, register uint32_t val);
-uint64_t atomic_conditional_increment(register uint64_t *counter);
+uint64_t atomic_conditional_increment(register uint64_t *pw);
uint64_t atomic_decrement(register uint64_t *pw);
uint64_t atomic_increment(register uint64_t *pw);
uint64_t atomic_sub(register uint64_t *pw, register uint64_t val);
uint64_t atomic_add(register uint64_t *pw, register uint64_t val);
uint64_t atomic_exchange_if_greater(register uint64_t *pw, register uint64_t val);
+#else
+//no threads supported?
+#error Must provide atomic functions for this platform or compiler!
+#endif
+
struct SafeRefCount {
uint32_t count;
@@ -57,17 +178,17 @@ struct SafeRefCount {
public:
// destroy() is called when weak_count_ drops to zero.
- bool ref() { //true on success
+ _ALWAYS_INLINE_ bool ref() { //true on success
return atomic_conditional_increment(&count) != 0;
}
- uint32_t refval() { //true on success
+ _ALWAYS_INLINE_ uint32_t refval() { //true on success
return atomic_conditional_increment(&count);
}
- bool unref() { // true if must be disposed of
+ _ALWAYS_INLINE_ bool unref() { // true if must be disposed of
if (atomic_decrement(&count) == 0) {
return true;
@@ -76,12 +197,12 @@ public:
return false;
}
- uint32_t get() const { // nothrow
+ _ALWAYS_INLINE_ uint32_t get() const { // nothrow
return count;
}
- void init(uint32_t p_value = 1) {
+ _ALWAYS_INLINE_ void init(uint32_t p_value = 1) {
count = p_value;
}
diff --git a/core/script_debugger_local.cpp b/core/script_debugger_local.cpp
index c2632da38b..8d2600e52d 100644
--- a/core/script_debugger_local.cpp
+++ b/core/script_debugger_local.cpp
@@ -186,12 +186,12 @@ struct _ScriptDebuggerLocalProfileInfoSort {
}
};
-void ScriptDebuggerLocal::profiling_set_frame_times(float p_frame_time, float p_idle_time, float p_fixed_time, float p_fixed_frame_time) {
+void ScriptDebuggerLocal::profiling_set_frame_times(float p_frame_time, float p_idle_time, float p_physics_time, float p_physics_frame_time) {
frame_time = p_frame_time;
idle_time = p_idle_time;
- fixed_time = p_fixed_time;
- fixed_frame_time = p_fixed_frame_time;
+ physics_time = p_physics_time;
+ physics_frame_time = p_physics_frame_time;
}
void ScriptDebuggerLocal::idle_poll() {
@@ -250,9 +250,9 @@ void ScriptDebuggerLocal::profiling_start() {
profiling = true;
pinfo.resize(32768);
frame_time = 0;
- fixed_time = 0;
+ physics_time = 0;
idle_time = 0;
- fixed_frame_time = 0;
+ physics_frame_time = 0;
}
void ScriptDebuggerLocal::profiling_end() {
diff --git a/core/script_debugger_local.h b/core/script_debugger_local.h
index 097c7c41f3..91f787052c 100644
--- a/core/script_debugger_local.h
+++ b/core/script_debugger_local.h
@@ -35,7 +35,7 @@
class ScriptDebuggerLocal : public ScriptDebugger {
bool profiling;
- float frame_time, idle_time, fixed_time, fixed_frame_time;
+ float frame_time, idle_time, physics_time, physics_frame_time;
uint64_t idle_accum;
Vector<ScriptLanguage::ProfilingInfo> pinfo;
@@ -51,7 +51,7 @@ public:
virtual void profiling_start();
virtual void profiling_end();
- virtual void profiling_set_frame_times(float p_frame_time, float p_idle_time, float p_fixed_time, float p_fixed_frame_time);
+ virtual void profiling_set_frame_times(float p_frame_time, float p_idle_time, float p_physics_time, float p_physics_frame_time);
ScriptDebuggerLocal();
};
diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp
index f0097054b1..4653ade294 100644
--- a/core/script_debugger_remote.cpp
+++ b/core/script_debugger_remote.cpp
@@ -647,8 +647,8 @@ void ScriptDebuggerRemote::_poll_events() {
profiling = true;
frame_time = 0;
idle_time = 0;
- fixed_time = 0;
- fixed_frame_time = 0;
+ physics_time = 0;
+ physics_frame_time = 0;
print_line("PROFILING ALRIGHT!");
@@ -727,8 +727,8 @@ void ScriptDebuggerRemote::_send_profiling_data(bool p_for_frame) {
packet_peer_stream->put_var(Engine::get_singleton()->get_frames_drawn()); //total frame time
packet_peer_stream->put_var(frame_time); //total frame time
packet_peer_stream->put_var(idle_time); //idle frame time
- packet_peer_stream->put_var(fixed_time); //fixed frame time
- packet_peer_stream->put_var(fixed_frame_time); //fixed frame time
+ packet_peer_stream->put_var(physics_time); //fixed frame time
+ packet_peer_stream->put_var(physics_frame_time); //fixed frame time
packet_peer_stream->put_var(USEC_TO_SEC(total_script_time)); //total script execution time
@@ -917,12 +917,12 @@ void ScriptDebuggerRemote::profiling_end() {
//ignores this, uses it via connnection
}
-void ScriptDebuggerRemote::profiling_set_frame_times(float p_frame_time, float p_idle_time, float p_fixed_time, float p_fixed_frame_time) {
+void ScriptDebuggerRemote::profiling_set_frame_times(float p_frame_time, float p_idle_time, float p_physics_time, float p_physics_frame_time) {
frame_time = p_frame_time;
idle_time = p_idle_time;
- fixed_time = p_fixed_time;
- fixed_frame_time = p_fixed_frame_time;
+ physics_time = p_physics_time;
+ physics_frame_time = p_physics_frame_time;
}
ScriptDebuggerRemote::ResourceUsageFunc ScriptDebuggerRemote::resource_usage_func = NULL;
diff --git a/core/script_debugger_remote.h b/core/script_debugger_remote.h
index b1ef88b812..22137d1350 100644
--- a/core/script_debugger_remote.h
+++ b/core/script_debugger_remote.h
@@ -54,7 +54,7 @@ class ScriptDebuggerRemote : public ScriptDebugger {
Vector<ScriptLanguage::ProfilingInfo *> profile_info_ptrs;
Map<StringName, int> profiler_function_signature_map;
- float frame_time, idle_time, fixed_time, fixed_frame_time;
+ float frame_time, idle_time, physics_time, physics_frame_time;
bool profiling;
int max_frame_functions;
@@ -161,7 +161,7 @@ public:
virtual void profiling_start();
virtual void profiling_end();
- virtual void profiling_set_frame_times(float p_frame_time, float p_idle_time, float p_fixed_time, float p_fixed_frame_time);
+ virtual void profiling_set_frame_times(float p_frame_time, float p_idle_time, float p_physics_time, float p_physics_frame_time);
ScriptDebuggerRemote();
~ScriptDebuggerRemote();
diff --git a/core/script_language.h b/core/script_language.h
index 2261737f9a..25767a2f7a 100644
--- a/core/script_language.h
+++ b/core/script_language.h
@@ -397,7 +397,7 @@ public:
virtual void add_profiling_frame_data(const StringName &p_name, const Array &p_data) = 0;
virtual void profiling_start() = 0;
virtual void profiling_end() = 0;
- virtual void profiling_set_frame_times(float p_frame_time, float p_idle_time, float p_fixed_time, float p_fixed_frame_time) = 0;
+ virtual void profiling_set_frame_times(float p_frame_time, float p_idle_time, float p_physics_time, float p_physics_frame_time) = 0;
ScriptDebugger();
virtual ~ScriptDebugger() { singleton = NULL; }
diff --git a/core/set.h b/core/set.h
index d91dd9b3ea..0f48e07520 100644
--- a/core/set.h
+++ b/core/set.h
@@ -100,17 +100,15 @@ private:
Element *_nil;
int size_cache;
- _Data() {
+ _FORCE_INLINE_ _Data() {
#ifdef GLOBALNIL_DISABLED
_nil = memnew_allocator(Element, A);
_nil->parent = _nil->left = _nil->right = _nil;
_nil->color = BLACK;
#else
-
_nil = (Element *)&_GlobalNilClass::_nil;
#endif
_root = NULL;
-
size_cache = 0;
}
@@ -132,6 +130,7 @@ private:
~_Data() {
_free_root();
+
#ifdef GLOBALNIL_DISABLED
memdelete_allocator<Element, A>(_nil);
#endif
@@ -196,7 +195,7 @@ private:
}
if (node->parent == _data._root)
- return NULL; // No successor, as p_node is the last node.
+ return NULL; // No successor, as p_node = last node
return node->parent;
}
}
@@ -218,7 +217,7 @@ private:
}
if (node == _data._root)
- return NULL; // No predecessor, as p_node is the first node.
+ return NULL; // No predecessor, as p_node = first node.
return node->parent;
}
}
@@ -266,65 +265,13 @@ private:
return prev;
}
- Element *_insert(const T &p_value, bool &r_exists) {
-
- Element *new_parent = _data._root;
- Element *node = _data._root->left;
- C less;
-
- while (node != _data._nil) {
-
- new_parent = node;
-
- if (less(p_value, node->value))
- node = node->left;
- else if (less(node->value, p_value))
- node = node->right;
- else {
- r_exists = true;
- return node;
- }
- }
-
- r_exists = false;
+ void _insert_rb_fix(Element *p_new_node) {
- Element *new_node = memnew_allocator(Element, A);
- new_node->parent = new_parent;
- new_node->right = _data._nil;
- new_node->left = _data._nil;
- new_node->value = p_value;
- //new_node->data=_data;
-
- if (new_parent == _data._root || less(p_value, new_parent->value)) {
- new_parent->left = new_node;
- } else {
- new_parent->right = new_node;
- }
-
- new_node->_next = _successor(new_node);
- new_node->_prev = _predecessor(new_node);
- if (new_node->_next)
- new_node->_next->_prev = new_node;
- if (new_node->_prev)
- new_node->_prev->_next = new_node;
-
- return new_node;
- }
-
- Element *_insert_rb(const T &p_value) {
-
- bool exists = false;
- Element *new_node = _insert(p_value, exists);
- if (exists)
- return new_node;
-
- _data.size_cache++;
- Element *node = new_node;
+ Element *node = p_new_node;
Element *nparent = node->parent;
Element *ngrand_parent;
while (nparent->color == RED) {
-
ngrand_parent = nparent->parent;
if (nparent == ngrand_parent->left) {
@@ -365,11 +312,53 @@ private:
}
_set_color(_data._root->left, BLACK);
+ }
+
+ Element *_insert(const T &p_value) {
+
+ Element *new_parent = _data._root;
+ Element *node = _data._root->left;
+ C less;
+
+ while (node != _data._nil) {
+
+ new_parent = node;
+
+ if (less(p_value, node->value))
+ node = node->left;
+ else if (less(node->value, p_value))
+ node = node->right;
+ else {
+ return node; // Return existing node
+ }
+ }
+ Element *new_node = memnew_allocator(Element, A);
+ new_node->parent = new_parent;
+ new_node->right = _data._nil;
+ new_node->left = _data._nil;
+ new_node->value = p_value;
+ //new_node->data=_data;
+
+ if (new_parent == _data._root || less(p_value, new_parent->value)) {
+ new_parent->left = new_node;
+ } else {
+ new_parent->right = new_node;
+ }
+
+ new_node->_next = _successor(new_node);
+ new_node->_prev = _predecessor(new_node);
+ if (new_node->_next)
+ new_node->_next->_prev = new_node;
+ if (new_node->_prev)
+ new_node->_prev->_next = new_node;
+
+ _data.size_cache++;
+ _insert_rb_fix(new_node);
return new_node;
}
- void _erase_fix(Element *p_node) {
+ void _erase_fix_rb(Element *p_node) {
Element *root = _data._root->left;
Element *node = _data._nil;
@@ -450,7 +439,7 @@ private:
node->parent = rp->parent;
_set_color(node, BLACK);
} else if (rp->color == BLACK && rp->parent != _data._root) {
- _erase_fix(sibling);
+ _erase_fix_rb(sibling);
}
if (rp != p_node) {
@@ -485,11 +474,12 @@ private:
void _calculate_depth(Element *p_element, int &max_d, int d) const {
- if (p_element == _data._nil) {
+ if (p_element == _data._nil)
return;
- }
+
_calculate_depth(p_element->left, max_d, d + 1);
_calculate_depth(p_element->right, max_d, d + 1);
+
if (d > max_d)
max_d = d;
}
@@ -533,10 +523,13 @@ public:
return res;
}
+ Element *lower_bound(const T &p_value) const {
+
+ return _lower_bound(p_value);
+ }
+
bool has(const T &p_value) const {
- if (!_data._root)
- return false;
return find(p_value) != NULL;
}
@@ -544,7 +537,7 @@ public:
if (!_data._root)
_data._create_root();
- return _insert_rb(p_value);
+ return _insert(p_value);
}
void erase(Element *p_element) {
@@ -602,11 +595,6 @@ public:
return e;
}
- Element *lower_bound(const T &p_value) const {
-
- return _lower_bound(p_value);
- }
-
inline int size() const { return _data.size_cache; }
int calculate_depth() const {
diff --git a/core/string_db.h b/core/string_db.h
index 2bef29fab8..de91e2abd8 100644
--- a/core/string_db.h
+++ b/core/string_db.h
@@ -113,6 +113,9 @@ public:
else
return 0;
}
+ _FORCE_INLINE_ const void *data_unique_pointer() const {
+ return (void *)_data;
+ }
bool operator!=(const StringName &p_name) const;
_FORCE_INLINE_ operator String() const {
diff --git a/core/translation.cpp b/core/translation.cpp
index f1f9c72b85..27e3b202d0 100644
--- a/core/translation.cpp
+++ b/core/translation.cpp
@@ -1052,7 +1052,7 @@ TranslationServer *TranslationServer::singleton = NULL;
bool TranslationServer::_load_translations(const String &p_from) {
- if (ProjectSettings::get_singleton()->has(p_from)) {
+ if (ProjectSettings::get_singleton()->has_setting(p_from)) {
PoolVector<String> translations = ProjectSettings::get_singleton()->get(p_from);
int tcount = translations.size();
diff --git a/core/typedefs.h b/core/typedefs.h
index 565e28020b..bf5c8b0f75 100644
--- a/core/typedefs.h
+++ b/core/typedefs.h
@@ -290,4 +290,12 @@ struct _GlobalLock {
#define __STRX(m_index) #m_index
#define __STR(m_index) __STRX(m_index)
+#ifdef __GNUC__
+#define likely(x) __builtin_expect(!!(x), 1)
+#define unlikely(x) __builtin_expect(!!(x), 0)
+#else
+#define likely(x) x
+#define unlikely(x) x
+#endif
+
#endif /* typedefs.h */
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 8273ed144b..b85996e3d1 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -1755,7 +1755,7 @@ static double built_in_strtod(const C *string, /* A decimal ASCII floating-point
register int c;
int exp = 0; /* Exponent read from "EX" field. */
int fracExp = 0; /* Exponent that derives from the fractional
- * part. Under normal circumstatnces, it is
+ * part. Under normal circumstances, it is
* the negative of the number of digits in F.
* However, if I is very long, the last digits
* of I get dropped (otherwise a long I with a
@@ -2332,12 +2332,12 @@ int String::findn(String p_str, int p_from) const {
int String::rfind(String p_str, int p_from) const {
- //stabilish a limit
+ // establish a limit
int limit = length() - p_str.length();
if (limit < 0)
return -1;
- //stabilish a starting point
+ // establish a starting point
if (p_from < 0)
p_from = limit;
else if (p_from > limit)
@@ -2347,7 +2347,7 @@ int String::rfind(String p_str, int p_from) const {
int len = length();
if (src_len == 0 || len == 0)
- return -1; //wont find anything!
+ return -1; // won't find anything!
const CharType *src = c_str();
@@ -2378,12 +2378,12 @@ int String::rfind(String p_str, int p_from) const {
}
int String::rfindn(String p_str, int p_from) const {
- //stabilish a limit
+ // establish a limit
int limit = length() - p_str.length();
if (limit < 0)
return -1;
- //stabilish a starting point
+ // establish a starting point
if (p_from < 0)
p_from = limit;
else if (p_from > limit)
diff --git a/core/variant.cpp b/core/variant.cpp
index 52bdd4e22d..f70e4a5218 100644
--- a/core/variant.cpp
+++ b/core/variant.cpp
@@ -2469,10 +2469,10 @@ Variant::Variant(const Vector<Color> &p_array) {
void Variant::operator=(const Variant &p_variant) {
- if (this == &p_variant)
+ if (unlikely(this == &p_variant))
return;
- if (type != p_variant.type) {
+ if (unlikely(type != p_variant.type)) {
reference(p_variant);
return;
}
diff --git a/core/variant.h b/core/variant.h
index 5ea540a63f..e0d0bf05c8 100644
--- a/core/variant.h
+++ b/core/variant.h
@@ -368,6 +368,7 @@ public:
static Vector<Variant> get_method_default_arguments(Variant::Type p_type, const StringName &p_method);
static Variant::Type get_method_return_type(Variant::Type p_type, const StringName &p_method, bool *r_has_return = NULL);
static Vector<StringName> get_method_argument_names(Variant::Type p_type, const StringName &p_method);
+ static bool is_method_const(Variant::Type p_type, const StringName &p_method);
void set_named(const StringName &p_index, const Variant &p_value, bool *r_valid = NULL);
Variant get_named(const StringName &p_index, bool *r_valid = NULL) const;
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 7205280938..d141621fbb 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -53,6 +53,7 @@ struct _VariantCall {
Vector<StringName> arg_names;
Variant::Type return_type;
+ bool _const;
#ifdef DEBUG_ENABLED
bool returns;
#endif
@@ -145,11 +146,12 @@ struct _VariantCall {
#endif
}
- static void addfunc(Variant::Type p_type, Variant::Type p_return, const StringName &p_name, VariantFunc p_func, const Vector<Variant> &p_defaultarg, const Arg &p_argtype1 = Arg(), const Arg &p_argtype2 = Arg(), const Arg &p_argtype3 = Arg(), const Arg &p_argtype4 = Arg(), const Arg &p_argtype5 = Arg()) {
+ static void addfunc(bool p_const, Variant::Type p_type, Variant::Type p_return, const StringName &p_name, VariantFunc p_func, const Vector<Variant> &p_defaultarg, const Arg &p_argtype1 = Arg(), const Arg &p_argtype2 = Arg(), const Arg &p_argtype3 = Arg(), const Arg &p_argtype4 = Arg(), const Arg &p_argtype5 = Arg()) {
FuncData funcdata;
funcdata.func = p_func;
funcdata.default_args = p_defaultarg;
+ funcdata._const = p_const;
#ifdef DEBUG_ENABLED
funcdata.return_type = p_return;
funcdata.returns = p_return != Variant::NIL;
@@ -1201,6 +1203,17 @@ Vector<Variant::Type> Variant::get_method_argument_types(Variant::Type p_type, c
return E->get().arg_types;
}
+bool Variant::is_method_const(Variant::Type p_type, const StringName &p_method) {
+
+ const _VariantCall::TypeFunc &fd = _VariantCall::type_funcs[p_type];
+
+ const Map<StringName, _VariantCall::FuncData>::Element *E = fd.functions.find(p_method);
+ if (!E)
+ return false;
+
+ return E->get()._const;
+}
+
Vector<StringName> Variant::get_method_argument_names(Variant::Type p_type, const StringName &p_method) {
const _VariantCall::TypeFunc &fd = _VariantCall::type_funcs[p_type];
@@ -1248,6 +1261,10 @@ void Variant::get_method_list(List<MethodInfo> *p_list) const {
MethodInfo mi;
mi.name = E->key();
+ if (fd._const) {
+ mi.flags |= METHOD_FLAG_CONST;
+ }
+
for (int i = 0; i < fd.arg_types.size(); i++) {
PropertyInfo pi;
@@ -1360,15 +1377,26 @@ void register_variant_methods() {
_VariantCall::constant_data = memnew_arr(_VariantCall::ConstantData, Variant::VARIANT_MAX);
#define ADDFUNC0(m_vtype, m_ret, m_class, m_method, m_defarg) \
- _VariantCall::addfunc(Variant::m_vtype, Variant::m_ret, _scs_create(#m_method), VCALL(m_class, m_method), m_defarg);
+ _VariantCall::addfunc(true, Variant::m_vtype, Variant::m_ret, _scs_create(#m_method), VCALL(m_class, m_method), m_defarg);
#define ADDFUNC1(m_vtype, m_ret, m_class, m_method, m_arg1, m_argname1, m_defarg) \
- _VariantCall::addfunc(Variant::m_vtype, Variant::m_ret, _scs_create(#m_method), VCALL(m_class, m_method), m_defarg, _VariantCall::Arg(Variant::m_arg1, _scs_create(m_argname1)));
+ _VariantCall::addfunc(true, Variant::m_vtype, Variant::m_ret, _scs_create(#m_method), VCALL(m_class, m_method), m_defarg, _VariantCall::Arg(Variant::m_arg1, _scs_create(m_argname1)));
#define ADDFUNC2(m_vtype, m_ret, m_class, m_method, m_arg1, m_argname1, m_arg2, m_argname2, m_defarg) \
- _VariantCall::addfunc(Variant::m_vtype, Variant::m_ret, _scs_create(#m_method), VCALL(m_class, m_method), m_defarg, _VariantCall::Arg(Variant::m_arg1, _scs_create(m_argname1)), _VariantCall::Arg(Variant::m_arg2, _scs_create(m_argname2)));
+ _VariantCall::addfunc(true, Variant::m_vtype, Variant::m_ret, _scs_create(#m_method), VCALL(m_class, m_method), m_defarg, _VariantCall::Arg(Variant::m_arg1, _scs_create(m_argname1)), _VariantCall::Arg(Variant::m_arg2, _scs_create(m_argname2)));
#define ADDFUNC3(m_vtype, m_ret, m_class, m_method, m_arg1, m_argname1, m_arg2, m_argname2, m_arg3, m_argname3, m_defarg) \
- _VariantCall::addfunc(Variant::m_vtype, Variant::m_ret, _scs_create(#m_method), VCALL(m_class, m_method), m_defarg, _VariantCall::Arg(Variant::m_arg1, _scs_create(m_argname1)), _VariantCall::Arg(Variant::m_arg2, _scs_create(m_argname2)), _VariantCall::Arg(Variant::m_arg3, _scs_create(m_argname3)));
+ _VariantCall::addfunc(true, Variant::m_vtype, Variant::m_ret, _scs_create(#m_method), VCALL(m_class, m_method), m_defarg, _VariantCall::Arg(Variant::m_arg1, _scs_create(m_argname1)), _VariantCall::Arg(Variant::m_arg2, _scs_create(m_argname2)), _VariantCall::Arg(Variant::m_arg3, _scs_create(m_argname3)));
#define ADDFUNC4(m_vtype, m_ret, m_class, m_method, m_arg1, m_argname1, m_arg2, m_argname2, m_arg3, m_argname3, m_arg4, m_argname4, m_defarg) \
- _VariantCall::addfunc(Variant::m_vtype, Variant::m_ret, _scs_create(#m_method), VCALL(m_class, m_method), m_defarg, _VariantCall::Arg(Variant::m_arg1, _scs_create(m_argname1)), _VariantCall::Arg(Variant::m_arg2, _scs_create(m_argname2)), _VariantCall::Arg(Variant::m_arg3, _scs_create(m_argname3)), _VariantCall::Arg(Variant::m_arg4, _scs_create(m_argname4)));
+ _VariantCall::addfunc(true, Variant::m_vtype, Variant::m_ret, _scs_create(#m_method), VCALL(m_class, m_method), m_defarg, _VariantCall::Arg(Variant::m_arg1, _scs_create(m_argname1)), _VariantCall::Arg(Variant::m_arg2, _scs_create(m_argname2)), _VariantCall::Arg(Variant::m_arg3, _scs_create(m_argname3)), _VariantCall::Arg(Variant::m_arg4, _scs_create(m_argname4)));
+
+#define ADDFUNC0NC(m_vtype, m_ret, m_class, m_method, m_defarg) \
+ _VariantCall::addfunc(false, Variant::m_vtype, Variant::m_ret, _scs_create(#m_method), VCALL(m_class, m_method), m_defarg);
+#define ADDFUNC1NC(m_vtype, m_ret, m_class, m_method, m_arg1, m_argname1, m_defarg) \
+ _VariantCall::addfunc(false, Variant::m_vtype, Variant::m_ret, _scs_create(#m_method), VCALL(m_class, m_method), m_defarg, _VariantCall::Arg(Variant::m_arg1, _scs_create(m_argname1)));
+#define ADDFUNC2NC(m_vtype, m_ret, m_class, m_method, m_arg1, m_argname1, m_arg2, m_argname2, m_defarg) \
+ _VariantCall::addfunc(false, Variant::m_vtype, Variant::m_ret, _scs_create(#m_method), VCALL(m_class, m_method), m_defarg, _VariantCall::Arg(Variant::m_arg1, _scs_create(m_argname1)), _VariantCall::Arg(Variant::m_arg2, _scs_create(m_argname2)));
+#define ADDFUNC3NC(m_vtype, m_ret, m_class, m_method, m_arg1, m_argname1, m_arg2, m_argname2, m_arg3, m_argname3, m_defarg) \
+ _VariantCall::addfunc(false, Variant::m_vtype, Variant::m_ret, _scs_create(#m_method), VCALL(m_class, m_method), m_defarg, _VariantCall::Arg(Variant::m_arg1, _scs_create(m_argname1)), _VariantCall::Arg(Variant::m_arg2, _scs_create(m_argname2)), _VariantCall::Arg(Variant::m_arg3, _scs_create(m_argname3)));
+#define ADDFUNC4NC(m_vtype, m_ret, m_class, m_method, m_arg1, m_argname1, m_arg2, m_argname2, m_arg3, m_argname3, m_arg4, m_argname4, m_defarg) \
+ _VariantCall::addfunc(false, Variant::m_vtype, Variant::m_ret, _scs_create(#m_method), VCALL(m_class, m_method), m_defarg, _VariantCall::Arg(Variant::m_arg1, _scs_create(m_argname1)), _VariantCall::Arg(Variant::m_arg2, _scs_create(m_argname2)), _VariantCall::Arg(Variant::m_arg3, _scs_create(m_argname3)), _VariantCall::Arg(Variant::m_arg4, _scs_create(m_argname4)));
/* STRING */
ADDFUNC1(STRING, INT, String, casecmp_to, STRING, "to", varray());
@@ -1545,7 +1573,7 @@ void register_variant_methods() {
ADDFUNC0(DICTIONARY, INT, Dictionary, size, varray());
ADDFUNC0(DICTIONARY, BOOL, Dictionary, empty, varray());
- ADDFUNC0(DICTIONARY, NIL, Dictionary, clear, varray());
+ ADDFUNC0NC(DICTIONARY, NIL, Dictionary, clear, varray());
ADDFUNC1(DICTIONARY, BOOL, Dictionary, has, NIL, "key", varray());
ADDFUNC1(DICTIONARY, BOOL, Dictionary, has_all, ARRAY, "keys", varray());
ADDFUNC1(DICTIONARY, NIL, Dictionary, erase, NIL, "key", varray());
@@ -1555,15 +1583,15 @@ void register_variant_methods() {
ADDFUNC0(ARRAY, INT, Array, size, varray());
ADDFUNC0(ARRAY, BOOL, Array, empty, varray());
- ADDFUNC0(ARRAY, NIL, Array, clear, varray());
+ ADDFUNC0NC(ARRAY, NIL, Array, clear, varray());
ADDFUNC0(ARRAY, INT, Array, hash, varray());
- ADDFUNC1(ARRAY, NIL, Array, push_back, NIL, "value", varray());
- ADDFUNC1(ARRAY, NIL, Array, push_front, NIL, "value", varray());
- ADDFUNC1(ARRAY, NIL, Array, append, NIL, "value", varray());
- ADDFUNC1(ARRAY, NIL, Array, resize, INT, "size", varray());
- ADDFUNC2(ARRAY, NIL, Array, insert, INT, "position", NIL, "value", varray());
- ADDFUNC1(ARRAY, NIL, Array, remove, INT, "position", varray());
- ADDFUNC1(ARRAY, NIL, Array, erase, NIL, "value", varray());
+ ADDFUNC1NC(ARRAY, NIL, Array, push_back, NIL, "value", varray());
+ ADDFUNC1NC(ARRAY, NIL, Array, push_front, NIL, "value", varray());
+ ADDFUNC1NC(ARRAY, NIL, Array, append, NIL, "value", varray());
+ ADDFUNC1NC(ARRAY, NIL, Array, resize, INT, "size", varray());
+ ADDFUNC2NC(ARRAY, NIL, Array, insert, INT, "position", NIL, "value", varray());
+ ADDFUNC1NC(ARRAY, NIL, Array, remove, INT, "position", varray());
+ ADDFUNC1NC(ARRAY, NIL, Array, erase, NIL, "value", varray());
ADDFUNC0(ARRAY, NIL, Array, front, varray());
ADDFUNC0(ARRAY, NIL, Array, back, varray());
ADDFUNC2(ARRAY, INT, Array, find, NIL, "what", INT, "from", varray(0));
@@ -1571,12 +1599,12 @@ void register_variant_methods() {
ADDFUNC1(ARRAY, INT, Array, find_last, NIL, "value", varray());
ADDFUNC1(ARRAY, INT, Array, count, NIL, "value", varray());
ADDFUNC1(ARRAY, BOOL, Array, has, NIL, "value", varray());
- ADDFUNC0(ARRAY, NIL, Array, pop_back, varray());
- ADDFUNC0(ARRAY, NIL, Array, pop_front, varray());
- ADDFUNC0(ARRAY, NIL, Array, sort, varray());
- ADDFUNC2(ARRAY, NIL, Array, sort_custom, OBJECT, "obj", STRING, "func", varray());
- ADDFUNC0(ARRAY, NIL, Array, invert, varray());
- ADDFUNC0(ARRAY, ARRAY, Array, duplicate, varray());
+ ADDFUNC0NC(ARRAY, NIL, Array, pop_back, varray());
+ ADDFUNC0NC(ARRAY, NIL, Array, pop_front, varray());
+ ADDFUNC0NC(ARRAY, NIL, Array, sort, varray());
+ ADDFUNC2NC(ARRAY, NIL, Array, sort_custom, OBJECT, "obj", STRING, "func", varray());
+ ADDFUNC0NC(ARRAY, NIL, Array, invert, varray());
+ ADDFUNC0NC(ARRAY, ARRAY, Array, duplicate, varray());
ADDFUNC0(POOL_BYTE_ARRAY, INT, PoolByteArray, size, varray());
ADDFUNC2(POOL_BYTE_ARRAY, NIL, PoolByteArray, set, INT, "idx", INT, "byte", varray());
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index 1c5a4ce8d0..03ec336291 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -100,32 +100,32 @@
}
/* clang-format on */
-#define CASES(PREFIX) static void *switch_table_##PREFIX[25][27] = { \
- TYPES(PREFIX, OP_EQUAL), \
- TYPES(PREFIX, OP_NOT_EQUAL), \
- TYPES(PREFIX, OP_LESS), \
- TYPES(PREFIX, OP_LESS_EQUAL), \
- TYPES(PREFIX, OP_GREATER), \
- TYPES(PREFIX, OP_GREATER_EQUAL), \
- TYPES(PREFIX, OP_ADD), \
- TYPES(PREFIX, OP_SUBTRACT), \
- TYPES(PREFIX, OP_MULTIPLY), \
- TYPES(PREFIX, OP_DIVIDE), \
- TYPES(PREFIX, OP_NEGATE), \
- TYPES(PREFIX, OP_POSITIVE), \
- TYPES(PREFIX, OP_MODULE), \
- TYPES(PREFIX, OP_STRING_CONCAT), \
- TYPES(PREFIX, OP_SHIFT_LEFT), \
- TYPES(PREFIX, OP_SHIFT_RIGHT), \
- TYPES(PREFIX, OP_BIT_AND), \
- TYPES(PREFIX, OP_BIT_OR), \
- TYPES(PREFIX, OP_BIT_XOR), \
- TYPES(PREFIX, OP_BIT_NEGATE), \
- TYPES(PREFIX, OP_AND), \
- TYPES(PREFIX, OP_OR), \
- TYPES(PREFIX, OP_XOR), \
- TYPES(PREFIX, OP_NOT), \
- TYPES(PREFIX, OP_IN), \
+#define CASES(PREFIX) static const void *switch_table_##PREFIX[25][27] = { \
+ TYPES(PREFIX, OP_EQUAL), \
+ TYPES(PREFIX, OP_NOT_EQUAL), \
+ TYPES(PREFIX, OP_LESS), \
+ TYPES(PREFIX, OP_LESS_EQUAL), \
+ TYPES(PREFIX, OP_GREATER), \
+ TYPES(PREFIX, OP_GREATER_EQUAL), \
+ TYPES(PREFIX, OP_ADD), \
+ TYPES(PREFIX, OP_SUBTRACT), \
+ TYPES(PREFIX, OP_MULTIPLY), \
+ TYPES(PREFIX, OP_DIVIDE), \
+ TYPES(PREFIX, OP_NEGATE), \
+ TYPES(PREFIX, OP_POSITIVE), \
+ TYPES(PREFIX, OP_MODULE), \
+ TYPES(PREFIX, OP_STRING_CONCAT), \
+ TYPES(PREFIX, OP_SHIFT_LEFT), \
+ TYPES(PREFIX, OP_SHIFT_RIGHT), \
+ TYPES(PREFIX, OP_BIT_AND), \
+ TYPES(PREFIX, OP_BIT_OR), \
+ TYPES(PREFIX, OP_BIT_XOR), \
+ TYPES(PREFIX, OP_BIT_NEGATE), \
+ TYPES(PREFIX, OP_AND), \
+ TYPES(PREFIX, OP_OR), \
+ TYPES(PREFIX, OP_XOR), \
+ TYPES(PREFIX, OP_NOT), \
+ TYPES(PREFIX, OP_IN), \
}
#define SWITCH(PREFIX, op, val) goto *switch_table_##PREFIX[op][val];
@@ -334,6 +334,13 @@ bool Variant::booleanize() const {
DEFAULT_OP_ARRAY_OP_BODY(m_prefix, m_op_name, m_name, m_type, !=, !=, true, false, false) \
}
+#define DEFAULT_OP_ARRAY_NEQ(m_prefix, m_op_name, m_name, m_type) \
+ CASE_TYPE(m_prefix, m_op_name, m_name) { \
+ if (p_b.type == NIL) \
+ _RETURN(true) \
+ DEFAULT_OP_ARRAY_OP_BODY(m_prefix, m_op_name, m_name, m_type, !=, ==, true, true, false) \
+ }
+
#define DEFAULT_OP_ARRAY_LT(m_prefix, m_op_name, m_name, m_type) \
DEFAULT_OP_ARRAY_OP(m_prefix, m_op_name, m_name, m_type, <, !=, false, a_len < array_b.size(), true)
@@ -555,14 +562,13 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
DEFAULT_OP_STR_NULL(math, OP_NOT_EQUAL, NODE_PATH, !=, NodePath);
DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, _RID, !=, RID);
- CASE_TYPE(math, OP_NOT_EQUAL, POOL_BYTE_ARRAY);
- CASE_TYPE(math, OP_NOT_EQUAL, POOL_INT_ARRAY);
- CASE_TYPE(math, OP_NOT_EQUAL, POOL_REAL_ARRAY);
- CASE_TYPE(math, OP_NOT_EQUAL, POOL_STRING_ARRAY);
- CASE_TYPE(math, OP_NOT_EQUAL, POOL_VECTOR2_ARRAY);
- CASE_TYPE(math, OP_NOT_EQUAL, POOL_VECTOR3_ARRAY);
- CASE_TYPE(math, OP_NOT_EQUAL, POOL_COLOR_ARRAY);
- _RETURN_FAIL;
+ DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_BYTE_ARRAY, uint8_t);
+ DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_INT_ARRAY, int);
+ DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_REAL_ARRAY, real_t);
+ DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_STRING_ARRAY, String);
+ DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_VECTOR2_ARRAY, Vector2);
+ DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_VECTOR3_ARRAY, Vector3);
+ DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_COLOR_ARRAY, Color);
}
SWITCH_OP(math, OP_LESS, p_a.type) {
@@ -1214,54 +1220,486 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
void Variant::set_named(const StringName &p_index, const Variant &p_value, bool *r_valid) {
- if (type == OBJECT) {
+ bool valid = false;
+ switch (type) {
+ case VECTOR2: {
+ if (p_value.type == Variant::INT) {
+ Vector2 *v = reinterpret_cast<Vector2 *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->x) {
+ v->x = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ v->y = p_value._data._int;
+ valid = true;
+ }
+ } else if (p_value.type == Variant::REAL) {
+ Vector2 *v = reinterpret_cast<Vector2 *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->x) {
+ v->x = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ v->y = p_value._data._real;
+ valid = true;
+ }
+ }
-#ifdef DEBUG_ENABLED
- if (!_get_obj().obj) {
- if (r_valid)
- *r_valid = false;
- return;
- } else {
+ } break;
+ case RECT2: {
- if (ScriptDebugger::get_singleton() && _get_obj().ref.is_null() && !ObjectDB::instance_validate(_get_obj().obj)) {
- if (r_valid)
- *r_valid = false;
- return;
+ if (p_value.type == Variant::VECTOR2) {
+ Rect2 *v = reinterpret_cast<Rect2 *>(_data._mem);
+ //scalar name
+ if (p_index == CoreStringNames::singleton->position) {
+ v->position = *reinterpret_cast<const Vector2 *>(p_value._data._mem);
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->size) {
+ v->size = *reinterpret_cast<const Vector2 *>(p_value._data._mem);
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->end) {
+ v->size = *reinterpret_cast<const Vector2 *>(p_value._data._mem) - v->position;
+ valid = true;
+ }
+ }
+ } break;
+ case TRANSFORM2D: {
+
+ if (p_value.type == Variant::VECTOR2) {
+ Transform2D *v = _data._transform2d;
+ if (p_index == CoreStringNames::singleton->x) {
+ v->elements[0] = *reinterpret_cast<const Vector2 *>(p_value._data._mem);
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ v->elements[1] = *reinterpret_cast<const Vector2 *>(p_value._data._mem);
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->origin) {
+ v->elements[2] = *reinterpret_cast<const Vector2 *>(p_value._data._mem);
+ valid = true;
+ }
+ }
+
+ } break;
+ case VECTOR3: {
+
+ if (p_value.type == Variant::INT) {
+ Vector3 *v = reinterpret_cast<Vector3 *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->x) {
+ v->x = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ v->y = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->z) {
+ v->z = p_value._data._int;
+ valid = true;
+ }
+ } else if (p_value.type == Variant::REAL) {
+ Vector3 *v = reinterpret_cast<Vector3 *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->x) {
+ v->x = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ v->y = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->z) {
+ v->z = p_value._data._real;
+ valid = true;
+ }
+ }
+
+ } break;
+ case PLANE: {
+
+ if (p_value.type == Variant::INT) {
+ Plane *v = reinterpret_cast<Plane *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->x) {
+ v->normal.x = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ v->normal.y = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->z) {
+ v->normal.z = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->d) {
+ v->d = p_value._data._int;
+ valid = true;
+ }
+ } else if (p_value.type == Variant::REAL) {
+ Plane *v = reinterpret_cast<Plane *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->x) {
+ v->normal.x = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ v->normal.y = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->z) {
+ v->normal.z = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->d) {
+ v->d = p_value._data._real;
+ valid = true;
+ }
+
+ } else if (p_value.type == Variant::VECTOR3) {
+ Plane *v = reinterpret_cast<Plane *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->normal) {
+ v->normal = *reinterpret_cast<const Vector3 *>(p_value._data._mem);
+ valid = true;
+ }
+ }
+
+ } break;
+ case QUAT: {
+
+ if (p_value.type == Variant::INT) {
+ Quat *v = reinterpret_cast<Quat *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->x) {
+ v->x = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ v->y = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->z) {
+ v->z = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->w) {
+ v->w = p_value._data._int;
+ valid = true;
+ }
+ } else if (p_value.type == Variant::REAL) {
+ Quat *v = reinterpret_cast<Quat *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->x) {
+ v->x = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ v->y = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->z) {
+ v->z = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->w) {
+ v->w = p_value._data._real;
+ valid = true;
+ }
+ }
+
+ } break; // 10
+ case RECT3: {
+
+ if (p_value.type == Variant::VECTOR3) {
+ Rect3 *v = _data._rect3;
+ //scalar name
+ if (p_index == CoreStringNames::singleton->position) {
+ v->position = *reinterpret_cast<const Vector3 *>(p_value._data._mem);
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->size) {
+ v->size = *reinterpret_cast<const Vector3 *>(p_value._data._mem);
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->end) {
+ v->size = *reinterpret_cast<const Vector3 *>(p_value._data._mem) - v->position;
+ valid = true;
+ }
+ }
+ } break;
+ case BASIS: {
+
+ if (p_value.type == Variant::VECTOR3) {
+ Basis *v = _data._basis;
+ //scalar name
+ if (p_index == CoreStringNames::singleton->x) {
+ v->set_axis(0, *reinterpret_cast<const Vector3 *>(p_value._data._mem));
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ v->set_axis(1, *reinterpret_cast<const Vector3 *>(p_value._data._mem));
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->z) {
+ v->set_axis(2, *reinterpret_cast<const Vector3 *>(p_value._data._mem));
+ valid = true;
+ }
+ }
+ } break;
+ case TRANSFORM: {
+
+ if (p_value.type == Variant::BASIS && p_index == CoreStringNames::singleton->basis) {
+ _data._transform->basis = *p_value._data._basis;
+ valid = true;
+ } else if (p_value.type == Variant::VECTOR3 && p_index == CoreStringNames::singleton->origin) {
+ _data._transform->origin = *reinterpret_cast<const Vector3 *>(p_value._data._mem);
+ valid = true;
+ }
+
+ } break;
+ case COLOR: {
+
+ if (p_value.type == Variant::INT) {
+ Color *v = reinterpret_cast<Color *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->r) {
+ v->r = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->g) {
+ v->g = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->b) {
+ v->b = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->a) {
+ v->a = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->r8) {
+ v->r = p_value._data._int / 255.0;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->g8) {
+ v->g = p_value._data._int / 255.0;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->b8) {
+ v->b = p_value._data._int / 255.0;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->a8) {
+ v->a = p_value._data._int / 255.0;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->h) {
+ v->set_hsv(p_value._data._int, v->get_s(), v->get_v());
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->s) {
+ v->set_hsv(v->get_h(), p_value._data._int, v->get_v());
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->v) {
+ v->set_hsv(v->get_h(), v->get_v(), p_value._data._int);
+ valid = true;
+ }
+ } else if (p_value.type == Variant::REAL) {
+ Color *v = reinterpret_cast<Color *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->r) {
+ v->r = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->g) {
+ v->g = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->b) {
+ v->b = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->a) {
+ v->a = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->r8) {
+ v->r = p_value._data._real / 255.0;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->g8) {
+ v->g = p_value._data._real / 255.0;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->b8) {
+ v->b = p_value._data._real / 255.0;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->a8) {
+ v->a = p_value._data._real / 255.0;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->h) {
+ v->set_hsv(p_value._data._real, v->get_s(), v->get_v());
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->s) {
+ v->set_hsv(v->get_h(), p_value._data._real, v->get_v());
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->v) {
+ v->set_hsv(v->get_h(), v->get_v(), p_value._data._real);
+ valid = true;
+ }
+ }
+ } break;
+ case OBJECT: {
+
+#ifdef DEBUG_ENABLED
+ if (!_get_obj().obj) {
+ break;
+ } else if (ScriptDebugger::get_singleton() && _get_obj().ref.is_null() && !ObjectDB::instance_validate(_get_obj().obj)) {
+ break;
}
- }
#endif
- _get_obj().obj->set(p_index, p_value, r_valid);
- return;
+ _get_obj().obj->set(p_index, p_value, &valid);
+
+ } break;
+ default: {
+ set(p_index.operator String(), p_value, &valid);
+ } break;
}
- set(p_index.operator String(), p_value, r_valid);
+ if (r_valid) {
+ *r_valid = valid;
+ }
}
Variant Variant::get_named(const StringName &p_index, bool *r_valid) const {
- if (type == OBJECT) {
+ if (r_valid) {
+ *r_valid = true;
+ }
+ switch (type) {
+ case VECTOR2: {
+ const Vector2 *v = reinterpret_cast<const Vector2 *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->x) {
+ return v->x;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ return v->y;
+ }
-#ifdef DEBUG_ENABLED
- if (!_get_obj().obj) {
- if (r_valid)
- *r_valid = false;
- return "Instance base is null.";
- } else {
+ } break;
+ case RECT2: {
- if (ScriptDebugger::get_singleton() && _get_obj().ref.is_null() && !ObjectDB::instance_validate(_get_obj().obj)) {
+ const Rect2 *v = reinterpret_cast<const Rect2 *>(_data._mem);
+ //scalar name
+ if (p_index == CoreStringNames::singleton->position) {
+ return v->position;
+ } else if (p_index == CoreStringNames::singleton->size) {
+ return v->size;
+ } else if (p_index == CoreStringNames::singleton->end) {
+ return v->size + v->position;
+ }
+ } break;
+ case TRANSFORM2D: {
+
+ const Transform2D *v = _data._transform2d;
+ if (p_index == CoreStringNames::singleton->x) {
+ return v->elements[0];
+ } else if (p_index == CoreStringNames::singleton->y) {
+ return v->elements[1];
+ } else if (p_index == CoreStringNames::singleton->origin) {
+ return v->elements[2];
+ }
+
+ } break;
+ case VECTOR3: {
+
+ const Vector3 *v = reinterpret_cast<const Vector3 *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->x) {
+ return v->x;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ return v->y;
+ } else if (p_index == CoreStringNames::singleton->z) {
+ return v->z;
+ }
+
+ } break;
+ case PLANE: {
+
+ const Plane *v = reinterpret_cast<const Plane *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->x) {
+ return v->normal.x;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ return v->normal.y;
+ } else if (p_index == CoreStringNames::singleton->z) {
+ return v->normal.z;
+ } else if (p_index == CoreStringNames::singleton->d) {
+ return v->d;
+ } else if (p_index == CoreStringNames::singleton->normal) {
+ return v->normal;
+ }
+
+ } break;
+ case QUAT: {
+
+ const Quat *v = reinterpret_cast<const Quat *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->x) {
+ return v->x;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ return v->y;
+ } else if (p_index == CoreStringNames::singleton->z) {
+ return v->z;
+ } else if (p_index == CoreStringNames::singleton->w) {
+ return v->w;
+ }
+
+ } break; // 10
+ case RECT3: {
+
+ const Rect3 *v = _data._rect3;
+ //scalar name
+ if (p_index == CoreStringNames::singleton->position) {
+ return v->position;
+ } else if (p_index == CoreStringNames::singleton->size) {
+ return v->size;
+ } else if (p_index == CoreStringNames::singleton->end) {
+ return v->size + v->position;
+ }
+ } break;
+ case BASIS: {
+
+ const Basis *v = _data._basis;
+ //scalar name
+ if (p_index == CoreStringNames::singleton->x) {
+ return v->get_axis(0);
+ } else if (p_index == CoreStringNames::singleton->y) {
+ return v->get_axis(1);
+ } else if (p_index == CoreStringNames::singleton->z) {
+ return v->get_axis(2);
+ }
+
+ } break;
+ case TRANSFORM: {
+
+ if (p_index == CoreStringNames::singleton->basis) {
+ return _data._transform->basis;
+ } else if (p_index == CoreStringNames::singleton->origin) {
+ return _data._transform->origin;
+ }
+
+ } break;
+ case COLOR: {
+
+ const Color *v = reinterpret_cast<const Color *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->r) {
+ return v->r;
+ } else if (p_index == CoreStringNames::singleton->g) {
+ return v->g;
+ } else if (p_index == CoreStringNames::singleton->b) {
+ return v->b;
+ } else if (p_index == CoreStringNames::singleton->a) {
+ return v->a;
+ } else if (p_index == CoreStringNames::singleton->r8) {
+ return v->r * 255.0;
+ } else if (p_index == CoreStringNames::singleton->g8) {
+ return v->g * 255.0;
+ } else if (p_index == CoreStringNames::singleton->b8) {
+ return v->b * 255.0;
+ } else if (p_index == CoreStringNames::singleton->a8) {
+ return v->a * 255.0;
+ } else if (p_index == CoreStringNames::singleton->h) {
+ return v->get_h();
+ } else if (p_index == CoreStringNames::singleton->s) {
+ return v->get_s();
+ } else if (p_index == CoreStringNames::singleton->v) {
+ return v->get_v();
+ }
+ } break;
+ case OBJECT: {
+
+#ifdef DEBUG_ENABLED
+ if (!_get_obj().obj) {
if (r_valid)
*r_valid = false;
- return "Attempted use of stray pointer object.";
+ return "Instance base is null.";
+ } else {
+
+ if (ScriptDebugger::get_singleton() && _get_obj().ref.is_null() && !ObjectDB::instance_validate(_get_obj().obj)) {
+ if (r_valid)
+ *r_valid = false;
+ return "Attempted use of stray pointer object.";
+ }
}
- }
#endif
- return _get_obj().obj->get(p_index, r_valid);
+ return _get_obj().obj->get(p_index, r_valid);
+
+ } break;
+ default: {
+ return get(p_index.operator String(), r_valid);
+ }
}
- return get(p_index.operator String(), r_valid);
+ if (r_valid) {
+ *r_valid = false;
+ }
+ return Variant();
}
#define DEFAULT_OP_ARRAY_CMD(m_name, m_type, skip_test, cmd) \
diff --git a/doc/Makefile b/doc/Makefile
index 4914c657d2..d68c66f8eb 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,5 +1,5 @@
BASEDIR = $(CURDIR)
-CLASSES = $(BASEDIR)/base/classes.xml
+CLASSES = $(BASEDIR)/classes/ $(BASEDIR)/../modules/
OUTPUTDIR = $(BASEDIR)/_build
TOOLSDIR = $(BASEDIR)/tools
diff --git a/doc/classes/@Global Scope.xml b/doc/classes/@Global Scope.xml
index a8fd377ecf..d8c9a57a88 100644
--- a/doc/classes/@Global Scope.xml
+++ b/doc/classes/@Global Scope.xml
@@ -1013,7 +1013,7 @@
</constant>
<constant name="ERR_TIMEOUT" value="24">
</constant>
- <constant name="ERR_CANT_AQUIRE_RESOURCE" value="28">
+ <constant name="ERR_CANT_ACQUIRE_RESOURCE" value="28">
</constant>
<constant name="ERR_INVALID_DATA" value="30">
</constant>
diff --git a/doc/classes/@VisualScript.xml b/doc/classes/@VisualScript.xml
index 2392e3ecca..fe40bc45e9 100644
--- a/doc/classes/@VisualScript.xml
+++ b/doc/classes/@VisualScript.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="@VisualScript" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Built-in visual script functions.
</brief_description>
<description>
+ A list of built-in visual script functions, see [VisualScriptBuiltinFunc] and [VisualScript].
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/ARVRAnchor.xml b/doc/classes/ARVRAnchor.xml
index 4ff39390b2..6e11034073 100644
--- a/doc/classes/ARVRAnchor.xml
+++ b/doc/classes/ARVRAnchor.xml
@@ -34,6 +34,13 @@
Returns true if the anchor is being tracked and false if no anchor with this id is currently known.
</description>
</method>
+ <method name="get_plane" qualifiers="const">
+ <return type="Plane">
+ </return>
+ <description>
+ Returns a plane aligned with our anchor, handy for intersection testing
+ </description>
+ </method>
<method name="get_size" qualifiers="const">
<return type="Vector3">
</return>
diff --git a/doc/classes/ARVRInterface.xml b/doc/classes/ARVRInterface.xml
index fad9571628..1c2e761b57 100644
--- a/doc/classes/ARVRInterface.xml
+++ b/doc/classes/ARVRInterface.xml
@@ -12,6 +12,20 @@
<demos>
</demos>
<methods>
+ <method name="get_anchor_detection_is_enabled" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ Returns true if achor detection is enabled (AR only).
+ </description>
+ </method>
+ <method name="get_capabilities" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ Returns a combination of flags providing information about the capabilities of this interface.
+ </description>
+ </method>
<method name="get_name" qualifiers="const">
<return type="String">
</return>
@@ -26,11 +40,11 @@
Returns the resolution at which we should render our intermediate results before things like lens distortion are applied by the VR platform.
</description>
</method>
- <method name="hmd_is_present">
- <return type="bool">
+ <method name="get_tracking_status" qualifiers="const">
+ <return type="int" enum="ARVRInterface.Tracking_status">
</return>
<description>
- Returns true if an HMD is available for this interface.
+ If supported, returns the status of our tracking. This will allow you to provide feedback to the user whether there are issues with positional tracking.
</description>
</method>
<method name="initialize">
@@ -51,34 +65,45 @@
Returns true if this interface is active.
</description>
</method>
- <method name="is_installed">
+ <method name="is_primary">
<return type="bool">
</return>
<description>
- Returns true if this interface has been installed. Say your game is designed to work with OpenVR so you are using the OpenVR interface but the user hasn't installed SteamVR, this would return false.
+ Returns true if this interface is currently the primary interface (the interface responsible for showing the output).
</description>
</method>
- <method name="is_primary">
+ <method name="is_stereo">
<return type="bool">
</return>
<description>
- Returns true if this interface is currently the primary interface (the interface responsible for showing the output).
+ Returns true if the current output of this interface is in stereo.
</description>
</method>
- <method name="set_is_primary">
+ <method name="set_anchor_detection_is_enabled">
<return type="void">
</return>
<argument index="0" name="enable" type="bool">
</argument>
<description>
- Set this interface to the primary interface (unset the old one).
+ Enables anchor detection, this is used on AR interfaces and enables the extra logic that will detect planes, features, objects, etc. and adds/modifies anchor points.
</description>
</method>
- <method name="supports_hmd">
- <return type="bool">
+ <method name="set_is_initialized">
+ <return type="void">
+ </return>
+ <argument index="0" name="initialized" type="bool">
+ </argument>
+ <description>
+ Initialise/uninitilise this interface (same effect as calling intialize/uninitialize).
+ </description>
+ </method>
+ <method name="set_is_primary">
+ <return type="void">
</return>
+ <argument index="0" name="enable" type="bool">
+ </argument>
<description>
- Returns true if this interface supports HMDs and by extension uses stereo scopic rendering.
+ Set this interface to the primary interface (unset the old one).
</description>
</method>
<method name="uninitialize">
@@ -90,10 +115,32 @@
</method>
</methods>
<members>
- <member name="primary" type="bool" setter="set_is_primary" getter="is_primary">
+ <member name="ar_is_anchor_detection_enabled" type="bool" setter="set_anchor_detection_is_enabled" getter="get_anchor_detection_is_enabled">
+ On an AR interface, is our anchor detection enabled?
+ </member>
+ <member name="interface_is_initialized" type="bool" setter="set_is_initialized" getter="is_initialized">
+ Has this interface been initialized?
+ </member>
+ <member name="interface_is_primary" type="bool" setter="set_is_primary" getter="is_primary">
+ Is this our primary interface?
</member>
</members>
<constants>
+ <constant name="ARVR_NONE" value="0">
+ No ARVR capabilities.
+ </constant>
+ <constant name="ARVR_MONO" value="1">
+ This interface can work with normal rendering output (non-HMD based AR).
+ </constant>
+ <constant name="ARVR_STEREO" value="2">
+ This interface supports stereoscopic rendering.
+ </constant>
+ <constant name="ARVR_AR" value="4">
+ This interface support AR (video background and real world tracking).
+ </constant>
+ <constant name="ARVR_EXTERNAL" value="8">
+ This interface outputs to an external device, if the main viewport is used the on screen output is an unmodified buffer of either the left or right eye (stretched if the viewport size is not changed to the same aspect ratio of get_recommended_render_targetsize. Using a seperate viewport node frees up the main viewport for other purposes.
+ </constant>
<constant name="EYE_MONO" value="0">
Mono output, this is mostly used internally when retrieving positioning information for our camera node or when stereo scopic rendering is not supported.
</constant>
@@ -103,5 +150,20 @@
<constant name="EYE_RIGHT" value="2">
Right eye output, this is mostly used internally when rendering the image for the right eye and obtaining positioning and projection information.
</constant>
+ <constant name="ARVR_NORMAL_TRACKING" value="0">
+ Tracking is behaving as expected.
+ </constant>
+ <constant name="ARVR_EXCESSIVE_MOTION" value="1">
+ Tracking is hindered by excessive motion, player is moving faster then tracking can keep up.
+ </constant>
+ <constant name="ARVR_INSUFFICIENT_FEATURES" value="2">
+ Tracking is hindered by insufficient features, it's too dark (for camera based tracking), player is blocked, etc.
+ </constant>
+ <constant name="ARVR_UNKNOWN_TRACKING" value="3">
+ We don't know the status of the tracking or this interface does not provide feedback.
+ </constant>
+ <constant name="ARVR_NOT_TRACKING" value="4">
+ Tracking is not functional (camera not plugged in or obscured, lighthouses turned off, etc.)
+ </constant>
</constants>
</class>
diff --git a/doc/classes/ARVRScriptInterface.xml b/doc/classes/ARVRScriptInterface.xml
index 54415539e0..182147a015 100644
--- a/doc/classes/ARVRScriptInterface.xml
+++ b/doc/classes/ARVRScriptInterface.xml
@@ -29,6 +29,20 @@
Outputs a finished render buffer to the AR/VR device for the given eye.
</description>
</method>
+ <method name="get_anchor_detection_is_enabled" qualifiers="virtual">
+ <return type="bool">
+ </return>
+ <description>
+ Returns true if achor detection is enabled (AR only).
+ </description>
+ </method>
+ <method name="get_capabilities" qualifiers="virtual">
+ <return type="int">
+ </return>
+ <description>
+ Returns a combination of flags providing information about the capabilities of this interface.
+ </description>
+ </method>
<method name="get_recommended_render_targetsize" qualifiers="virtual">
<return type="Vector2">
</return>
@@ -36,6 +50,13 @@
Returns the size at which we should render our scene to get optimal quality on the output device.
</description>
</method>
+ <method name="get_tracking_status" qualifiers="virtual">
+ <return type="int">
+ </return>
+ <description>
+ If supported, returns the status of our tracking. This will allow you to provide feedback to the user whether there are issues with positional tracking.
+ </description>
+ </method>
<method name="get_transform_for_eye" qualifiers="virtual">
<return type="Transform">
</return>
@@ -47,13 +68,6 @@
Get the location and orientation transform used when rendering a specific eye.
</description>
</method>
- <method name="hmd_is_present" qualifiers="virtual">
- <return type="bool">
- </return>
- <description>
- Return true is an HMD is available.
- </description>
- </method>
<method name="initialize" qualifiers="virtual">
<return type="bool">
</return>
@@ -68,13 +82,6 @@
Returns true if this interface has been initialized and is active.
</description>
</method>
- <method name="is_installed" qualifiers="virtual">
- <return type="bool">
- </return>
- <description>
- Returns true if the required middleware is installed.
- </description>
- </method>
<method name="is_stereo" qualifiers="virtual">
<return type="bool">
</return>
@@ -89,11 +96,13 @@
Gets called before rendering each frame so tracking data gets updated in time.
</description>
</method>
- <method name="supports_hmd" qualifiers="virtual">
- <return type="bool">
+ <method name="set_anchor_detection_is_enabled" qualifiers="virtual">
+ <return type="void">
</return>
+ <argument index="0" name="enabled" type="bool">
+ </argument>
<description>
- Returns true if this interface supports HMDs.
+ Enables anchor detection, this is used on AR interfaces and enables the extra logic that will detect planes, features, objects, etc. and adds/modifies anchor points.
</description>
</method>
<method name="uninitialize" qualifiers="virtual">
diff --git a/doc/classes/ARVRServer.xml b/doc/classes/ARVRServer.xml
index 282f25bec9..6a7262bd14 100644
--- a/doc/classes/ARVRServer.xml
+++ b/doc/classes/ARVRServer.xml
@@ -20,6 +20,22 @@
Mostly exposed for GDNative based interfaces, this is called to register an available interface with the AR/VR server.
</description>
</method>
+ <method name="center_on_hmd">
+ <return type="void">
+ </return>
+ <argument index="0" name="ignore_tilt" type="bool">
+ </argument>
+ <argument index="1" name="keep_height" type="bool">
+ </argument>
+ <description>
+ This is a really important function to understand correctly. AR and VR platforms all handle positioning slightly differently.
+ For platforms that do not offer spatial tracking our origin point (0,0,0) is the location of our HMD but you have little control over the direction the player is facing in the real world.
+ For platforms that do offer spatial tracking our origin point depends very much on the system. For OpenVR our origin point is usually the center of the tracking space, on the ground. For other platforms its often the location of the tracking camera.
+ This method allows you to center our tracker on the location of the HMD, it will take the current location of the HMD and use that to adjust all our tracking data in essence realigning the real world to your players current position in your game world.
+ For this method to produce usable results tracking information should be available and this often takes a few frames after starting your game.
+ You should call this method after a few seconds have passed, when the user requests a realignment of the display holding a designated button on a controller for a short period of time, and when implementing a teleport mechanism.
+ </description>
+ </method>
<method name="find_interface" qualifiers="const">
<return type="ARVRInterface">
</return>
@@ -84,22 +100,6 @@
Removes a registered interface, again exposed mostly for GDNative based interfaces.
</description>
</method>
- <method name="request_reference_frame">
- <return type="void">
- </return>
- <argument index="0" name="ignore_tilt" type="bool">
- </argument>
- <argument index="1" name="keep_height" type="bool">
- </argument>
- <description>
- This is a really important function to understand correctly. AR and VR platforms all handle positioning slightly differently.
- For platforms that do not offer spatial tracking our origin point (0,0,0) is the location of our HMD but you have little control over the direction the player is facing in the real world.
- For platforms that do offer spatial tracking our origin point depends very much on the system. For OpenVR our origin point is usually the center of the tracking space, on the ground. For other platforms its often the location of the tracking camera.
- This method allows you to create a reference frame, it will take the current location of the HMD and use that to adjust all our tracking data in essence realigning the real world to your players current position in your game world.
- For this method to produce usable results tracking information should be available and this often takes a few frames after starting your game.
- You should call this method after a few seconds have passed, when the user requests a realignment of the display holding a designated button on a controller for a short period of time, and when implementing a teleport mechanism.
- </description>
- </method>
<method name="set_primary_interface">
<return type="void">
</return>
diff --git a/doc/classes/AcceptDialog.xml b/doc/classes/AcceptDialog.xml
index 4244e66a35..f87a40b8aa 100644
--- a/doc/classes/AcceptDialog.xml
+++ b/doc/classes/AcceptDialog.xml
@@ -92,8 +92,10 @@
</methods>
<members>
<member name="dialog_hide_on_ok" type="bool" setter="set_hide_on_ok" getter="get_hide_on_ok">
+ If [code]true[/code] the dialog is hidden when accepted. Default value: [code]true[/code].
</member>
<member name="dialog_text" type="String" setter="set_text" getter="get_text">
+ The text displayed by this dialog.
</member>
</members>
<signals>
diff --git a/doc/classes/AnimatedSprite.xml b/doc/classes/AnimatedSprite.xml
index f8663e90e0..dce7bf283a 100644
--- a/doc/classes/AnimatedSprite.xml
+++ b/doc/classes/AnimatedSprite.xml
@@ -4,7 +4,7 @@
Sprite node that can use multiple textures for animation.
</brief_description>
<description>
- Sprite node that can use multiple textures for animation.
+ Animations are created using a [SpriteFrames] resource, which can be configured in the editor via the SpriteFrames panel.
</description>
<tutorials>
</tutorials>
@@ -149,31 +149,39 @@
</methods>
<members>
<member name="animation" type="String" setter="set_animation" getter="get_animation">
+ The current animation from the [code]frames[/code] resource. If this value changes, the [code]frame[/code] counter is reset.
</member>
<member name="centered" type="bool" setter="set_centered" getter="is_centered">
+ If [code]true[/code] texture will be centered. Default value: [code]true[/code].
</member>
<member name="flip_h" type="bool" setter="set_flip_h" getter="is_flipped_h">
+ If [code]true[/code] texture is flipped horizontally. Default value: [code]false[/code].
</member>
<member name="flip_v" type="bool" setter="set_flip_v" getter="is_flipped_v">
+ If [code]true[/code] texture is flipped vertically. Default value: [code]false[/code].
</member>
<member name="frame" type="int" setter="set_frame" getter="get_frame">
+ The displayed animation frame's index.
</member>
<member name="frames" type="SpriteFrames" setter="set_sprite_frames" getter="get_sprite_frames">
+ The [SpriteFrames] resource containing the animation(s).
</member>
<member name="offset" type="Vector2" setter="set_offset" getter="get_offset">
+ The texture's drawing offset.
</member>
<member name="playing" type="bool" setter="_set_playing" getter="_is_playing">
+ If [code]true[/code] the [member animation] is currently playing.
</member>
</members>
<signals>
<signal name="animation_finished">
<description>
- Emitted when the animation is finished (when it plays the last frame). If the animation is looping, this signal is emitted every time the last frame is drawn, before looping.
+ Emitted when the animation is finished (when it plays the last frame). If the animation is looping, this signal is emitted every time the last frame is drawn.
</description>
</signal>
<signal name="frame_changed">
<description>
- Emitted when frame is changed.
+ Emitted when [member frame] changed.
</description>
</signal>
</signals>
diff --git a/doc/classes/AnimatedSprite3D.xml b/doc/classes/AnimatedSprite3D.xml
index 4e28f7de8d..b0bb7bb6ab 100644
--- a/doc/classes/AnimatedSprite3D.xml
+++ b/doc/classes/AnimatedSprite3D.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AnimatedSprite3D" inherits="SpriteBase3D" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ 2D sprite node in 3D world, that can use multiple 2D textures for animation.
</brief_description>
<description>
+ Animations are created using a [SpriteFrames] resource, which can be configured in the editor via the SpriteFrames panel.
</description>
<tutorials>
</tutorials>
@@ -83,18 +85,22 @@
</methods>
<members>
<member name="animation" type="String" setter="set_animation" getter="get_animation">
+ The current animation from the [code]frames[/code] resource. If this value changes, the [code]frame[/code] counter is reset.
</member>
<member name="frame" type="int" setter="set_frame" getter="get_frame">
+ The displayed animation frame's index.
</member>
<member name="frames" type="SpriteFrames" setter="set_sprite_frames" getter="get_sprite_frames">
+ The [SpriteFrames] resource containing the animation(s).
</member>
<member name="playing" type="bool" setter="_set_playing" getter="_is_playing">
+ If [code]true[/code] the [member animation] is currently playing.
</member>
</members>
<signals>
<signal name="frame_changed">
<description>
- Emitted when frame is changed.
+ Emitted when [member frame] changed.
</description>
</signal>
</signals>
diff --git a/doc/classes/Animation.xml b/doc/classes/Animation.xml
index 6cb4fd5b17..d853345268 100644
--- a/doc/classes/Animation.xml
+++ b/doc/classes/Animation.xml
@@ -368,9 +368,9 @@
</argument>
<argument index="1" name="time" type="float">
</argument>
- <argument index="2" name="loc" type="Vector3">
+ <argument index="2" name="location" type="Vector3">
</argument>
- <argument index="3" name="rot" type="Quat">
+ <argument index="3" name="rotation" type="Quat">
</argument>
<argument index="4" name="scale" type="Vector3">
</argument>
diff --git a/doc/classes/Area.xml b/doc/classes/Area.xml
index c59bbee084..8797575038 100644
--- a/doc/classes/Area.xml
+++ b/doc/classes/Area.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Area" inherits="CollisionObject" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- General purpose area detection and influence for 3D physics.
+ General purpose area node for detection and 3D physics influence.
</brief_description>
<description>
- General purpose area detection for 3D physics. Areas can be used for detection of objects that enter/exit them, as well as overriding space parameters (changing gravity, damping, etc). For this, use any space override different from AREA_SPACE_OVERRIDE_DISABLE and point gravity at the center of mass.
+ 3D area that detects [CollisionObject] nodes overlapping, entering, or exiting. Can also alter or override local physics parameters (gravity, damping).
</description>
<tutorials>
</tutorials>
@@ -88,14 +88,14 @@
<return type="Array">
</return>
<description>
- Return a list of the areas that are totally or partially inside this area.
+ Returns a list of intersecting [Area]\ s.
</description>
</method>
<method name="get_overlapping_bodies" qualifiers="const">
<return type="Array">
</return>
<description>
- Return a list of the bodies ([PhysicsBody]) that are totally or partially inside this area.
+ Returns a list of intersecting [PhysicsBody]\ s.
</description>
</method>
<method name="get_priority" qualifiers="const">
@@ -169,7 +169,7 @@
<argument index="0" name="area" type="Node">
</argument>
<description>
- Return whether the area passed is totally or partially inside this area.
+ If [code]true[/code] the given area overlaps the Area.
</description>
</method>
<method name="overlaps_body" qualifiers="const">
@@ -178,7 +178,7 @@
<argument index="0" name="body" type="Node">
</argument>
<description>
- Return whether the body passed is totally or partially inside this area.
+ If [code]true[/code] the given body overlaps the Area.
</description>
</method>
<method name="set_angular_damp">
@@ -374,30 +374,43 @@
</methods>
<members>
<member name="angular_damp" type="float" setter="set_angular_damp" getter="get_angular_damp">
+ The rate at which objects stop spinning in this area. Represents the angular velocity lost per second. Values range from [code]0[/code] (no damping) to [code]1[/code] (full damping).
</member>
<member name="audio_bus_name" type="String" setter="set_audio_bus" getter="get_audio_bus">
+ The name of the area's audio bus.
</member>
<member name="audio_bus_override" type="bool" setter="set_audio_bus_override" getter="is_overriding_audio_bus">
+ If [code]true[/code] the area's audio bus overrides the default audio bus. Default value: [code]false[/code].
</member>
<member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer">
+ The area's physics layer(s). Collidable objects can exist in any of 32 different layers. A contact is detected if object A is in any of the layers that object B scans, or object B is in any layers that object A scans. See also [code]collision_mask[/code].
</member>
<member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask">
+ The physics layers this area scans to determine collision detection.
</member>
<member name="gravity" type="float" setter="set_gravity" getter="get_gravity">
+ The area's gravity intensity (ranges from -1024 to 1024). This value multiplies the gravity vector. This is useful to alter the force of gravity without altering its direction.
</member>
<member name="gravity_distance_scale" type="float" setter="set_gravity_distance_scale" getter="get_gravity_distance_scale">
+ The falloff factor for point gravity. The greater the value, the faster gravity decreases with distance.
</member>
<member name="gravity_point" type="bool" setter="set_gravity_is_point" getter="is_gravity_a_point">
+ If [code]true[/code] gravity is calculated from a point (set via [code]gravity_vec[/code]). Also see [code]space_override[/code]. Default value: [code]false[/code].
</member>
<member name="gravity_vec" type="Vector3" setter="set_gravity_vector" getter="get_gravity_vector">
+ The area's gravity vector (not normalized). If gravity is a point (see [method is_gravity_a_point]), this will be the point of attraction.
</member>
<member name="linear_damp" type="float" setter="set_linear_damp" getter="get_linear_damp">
+ The rate at which objects stop moving in this area. Represents the linear velocity lost per second. Values range from [code]0[/code] (no damping) to [code]1[/code] (full damping).
</member>
<member name="monitorable" type="bool" setter="set_monitorable" getter="is_monitorable">
+ If [code]true[/code] other monitoring areas can detect this area. Default value: [code]true[/code].
</member>
<member name="monitoring" type="bool" setter="set_monitoring" getter="is_monitoring">
+ If [code]true[/code] the area detects bodies or areas entering and exiting it. Default value: [code]true[/code].
</member>
<member name="priority" type="float" setter="set_priority" getter="get_priority">
+ The area's priority. Higher priority areas are processed first. Default value: 0.
</member>
<member name="reverb_bus_amount" type="float" setter="set_reverb_amount" getter="get_reverb_amount">
</member>
@@ -408,6 +421,7 @@
<member name="reverb_bus_uniformity" type="float" setter="set_reverb_uniformity" getter="get_reverb_uniformity">
</member>
<member name="space_override" type="int" setter="set_space_override_mode" getter="get_space_override_mode" enum="Area.SpaceOverride">
+ Override mode for gravity and damping calculations within this area. See the SPACE_OVERRIDE_* constants for values.
</member>
</members>
<signals>
@@ -415,14 +429,14 @@
<argument index="0" name="area" type="Object">
</argument>
<description>
- This signal is triggered only once when an area enters this area. The only parameter passed is the area that entered this area.
+ Emitted when another area enters.
</description>
</signal>
<signal name="area_exited">
<argument index="0" name="area" type="Object">
</argument>
<description>
- This signal is triggered only once when an area exits this area. The only parameter passed is the area that exited this area.
+ Emitted when another area exits.
</description>
</signal>
<signal name="area_shape_entered">
@@ -435,7 +449,7 @@
<argument index="3" name="self_shape" type="int">
</argument>
<description>
- This signal triggers only once when an area enters this area. The first parameter is the area's [RID]. The second one is the area as an object. The third one is the index of the shape entering this area, and the fourth one is the index of the shape in this area that reported the entering.
+ Emitted when another area enters, reporting which areas overlapped.
</description>
</signal>
<signal name="area_shape_exited">
@@ -448,21 +462,21 @@
<argument index="3" name="self_shape" type="int">
</argument>
<description>
- This signal triggers only once when an area exits this area. The first parameter is the area's [RID]. The second one is the area as an object. The third one is the index of the shape entering this area, and the fourth one is the index of the shape in this area that reported the entering.
+ Emitted when another area exits, reporting which areas were overlapping.
</description>
</signal>
<signal name="body_entered">
<argument index="0" name="body" type="Object">
</argument>
<description>
- This signal is triggered only once when a body enters this area. The only parameter passed is the body that entered this area.
+ Emitted when a [PhysicsBody] object enters.
</description>
</signal>
<signal name="body_exited">
<argument index="0" name="body" type="Object">
</argument>
<description>
- This signal is triggered only once when a body exits this area. The only parameter passed is the body that exited this area.
+ Emitted when a [PhysicsBody2D] object exits.
</description>
</signal>
<signal name="body_shape_entered">
@@ -475,7 +489,7 @@
<argument index="3" name="area_shape" type="int">
</argument>
<description>
- This signal triggers only once when a body enters this area. The first parameter is the body's [RID]. The second one is the body as an object. The third one is the index of the shape of the body that entered this area, and the fourth one is the index of the shape in this area that reported the entering.
+ Emitted when a [PhysicsBody2D] object enters, reporting which shapes overlapped.
</description>
</signal>
<signal name="body_shape_exited">
@@ -488,20 +502,25 @@
<argument index="3" name="area_shape" type="int">
</argument>
<description>
- This signal triggers only once when a body exits this area. The first parameter is the body's [RID]. The second one is the body as an object. The third one is the index of the shape exiting this area, and the fourth one is the index of the shape in this area that reported the exit.
+ Emitted when a [PhysicsBody2D] object exits, reporting which shapes were overlapping.
</description>
</signal>
</signals>
<constants>
<constant name="SPACE_OVERRIDE_DISABLED" value="0">
+ This area does not affect gravity/damping.
</constant>
<constant name="SPACE_OVERRIDE_COMBINE" value="1">
+ This area adds its gravity/damping values to whatever has been calculated so far (in [code]priority[/code] order).
</constant>
<constant name="SPACE_OVERRIDE_COMBINE_REPLACE" value="2">
+ This area adds its gravity/damping values to whatever has been calculated so far (in [code]priority[/code] order), ignoring any lower priority areas.
</constant>
<constant name="SPACE_OVERRIDE_REPLACE" value="3">
+ This area replaces any gravity/damping, even the defaults, ignoring any lower priority areas.
</constant>
<constant name="SPACE_OVERRIDE_REPLACE_COMBINE" value="4">
+ This area replaces any gravity/damping calculated so far (in [code]priority[/code] order), but keeps calculating the rest of the areas.
</constant>
</constants>
</class>
diff --git a/doc/classes/Area2D.xml b/doc/classes/Area2D.xml
index e093b5cb49..0cbc079962 100644
--- a/doc/classes/Area2D.xml
+++ b/doc/classes/Area2D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Area2D" inherits="CollisionObject2D" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- 2D area that detects nodes that enter or exit it. Can override 2D physics properties within range.
+ 2D area for detection and 2D physics influence.
</brief_description>
<description>
- 2D area that detects nodes that enter or exit it. Change the 'space_override' property SPACE_OVERRIDE_* to override physics parameters for nodes like [Rigidbody2D]. E.g. gravity, damping... See [CollisionObject2D] for usage.
+ 2D area that detects [CollisionObject2D] nodes overlapping, entering, or exiting. Can also alter or override local physics parameters (gravity, damping).
</description>
<tutorials>
</tutorials>
@@ -18,7 +18,7 @@
Return the angular damp rate.
</description>
</method>
- <method name="get_audio_bus" qualifiers="const">
+ <method name="get_audio_bus_name" qualifiers="const">
<return type="String">
</return>
<description>
@@ -88,14 +88,14 @@
<return type="Array">
</return>
<description>
- Returns a list of the [Area2D]s that intersect with this area.
+ Returns a list of intersecting [Area2D]\ s.
</description>
</method>
<method name="get_overlapping_bodies" qualifiers="const">
<return type="Array">
</return>
<description>
- Return a list of the [PhysicsBody2D]s that intersect with this area.
+ Returns a list of intersecting [PhysicsBody2D]\ s.
</description>
</method>
<method name="get_priority" qualifiers="const">
@@ -145,7 +145,7 @@
<argument index="0" name="area" type="Node">
</argument>
<description>
- Return whether the area passed is totally or partially inside this area.
+ If [code]true[/code] the given area overlaps the Area2D.
</description>
</method>
<method name="overlaps_body" qualifiers="const">
@@ -154,7 +154,7 @@
<argument index="0" name="body" type="Node">
</argument>
<description>
- Return whether the body passed is totally or partially inside this area.
+ If [code]true[/code] the given body overlaps the Area2D.
</description>
</method>
<method name="set_angular_damp">
@@ -167,7 +167,7 @@
In practice, as the fraction of speed lost gets smaller with each frame, a value of 1.0 does not mean the object will stop in exactly one second. Only when the physics calculations are done at 1 frame per second, it does stop in a second.
</description>
</method>
- <method name="set_audio_bus">
+ <method name="set_audio_bus_name">
<return type="void">
</return>
<argument index="0" name="name" type="String">
@@ -318,49 +318,46 @@
</methods>
<members>
<member name="angular_damp" type="float" setter="set_angular_damp" getter="get_angular_damp">
- The rate at which objects stop spinning in this area. Represents the amount of speed lost per second. If 1.0, physics bodies in the area stop rotating immediately. If 0.0, they never slow down. Does not incorporate external forces. The physics-update's rate affects 'angular_damp'.
+ The rate at which objects stop spinning in this area. Represents the angular velocity lost per second. Values range from [code]0[/code] (no damping) to [code]1[/code] (full damping).
</member>
- <member name="audio_bus_name" type="String" setter="set_audio_bus" getter="get_audio_bus">
- The name of the Area2D's audio bus.
+ <member name="audio_bus_name" type="String" setter="set_audio_bus_name" getter="get_audio_bus_name">
+ The name of the area's audio bus.
</member>
<member name="audio_bus_override" type="bool" setter="set_audio_bus_override" getter="is_overriding_audio_bus">
- If [code]true[/code], overrides the default audio bus with the Area2D's. Defaults to [code]false[/code].
+ If [code]true[/code] the area's audio bus overrides the default audio bus. Default value: [code]false[/code].
</member>
<member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer">
- The physics layer this Area2D is in.
- Collidable objects can exist in any of 32 different layers. These layers are not visual, but more of a tagging system instead. A collidable can use these layers/tags to select with which objects it can collide, using [method set_collision_mask].
- A contact is detected if object A is in any of the layers that object B scans, or object B is in any layers that object A scans.
+ The area's physics layer(s). Collidable objects can exist in any of 32 different layers. A contact is detected if object A is in any of the layers that object B scans, or object B is in any layers that object A scans. See also [code]collision_mask[/code].
</member>
<member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask">
- The physics layers this Area2D scans to determine collision detections.
+ The physics layers this area scans to determine collision detection.
</member>
<member name="gravity" type="float" setter="set_gravity" getter="get_gravity">
- The gravity intensity within the Area2D (ranges -1024 to 1024). This is useful to alter the force of gravity without altering its direction.
- This value multiplies the gravity vector, whether it is the given vector ([method set_gravity_vector]), or a calculated one (when using a center of gravity).
+ The area's gravity intensity (ranges from -1024 to 1024). This value multiplies the gravity vector. This is useful to alter the force of gravity without altering its direction.
</member>
<member name="gravity_distance_scale" type="float" setter="set_gravity_distance_scale" getter="get_gravity_distance_scale">
- The falloff factor for point gravity. The greater this value is, the faster the strength of gravity decreases with the square of distance.
+ The falloff factor for point gravity. The greater the value, the faster gravity decreases with distance.
</member>
<member name="gravity_point" type="bool" setter="set_gravity_is_point" getter="is_gravity_a_point">
- If [code]true[/code], calculates gravity from a particular point during a space override (see [method set_space_override_mode]). If a point, [Vector2] position is set with [method set_gravity_vector]. Defaults to [code]false[/code].
+ If [code]true[/code] gravity is calculated from a point (set via [code]gravity_vec[/code]). Also see [code]space_override[/code]. Default value: [code]false[/code].
</member>
<member name="gravity_vec" type="Vector2" setter="set_gravity_vector" getter="get_gravity_vector">
- The gravitational direction/strength as a vector (not normalized). If gravity is a point (see [method is_gravity_a_point]), this will be the attraction center.
+ The area's gravity vector (not normalized). If gravity is a point (see [method is_gravity_a_point]), this will be the point of attraction.
</member>
<member name="linear_damp" type="float" setter="set_linear_damp" getter="get_linear_damp">
- The rate at which objects stop spinning in this area. Represents the amount of speed lost per second. If 1.0, physics bodies in the area stop rotating immediately. If 0.0, they never slow down. Does not incorporate external forces. The physics-update's rate affects 'angular_damp'.
+ The rate at which objects stop moving in this area. Represents the linear velocity lost per second. Values range from [code]0[/code] (no damping) to [code]1[/code] (full damping).
</member>
<member name="monitorable" type="bool" setter="set_monitorable" getter="is_monitorable">
- If [code]true[/code], other monitoring areas can detect this Area2D (is it undetectable at the moment?). Defaults to [code]true[/code].
+ If [code]true[/code] other monitoring areas can detect this area. Default value: [code]true[/code].
</member>
<member name="monitoring" type="bool" setter="set_monitoring" getter="is_monitoring">
- If [code]true[/code], this detects bodies/areas entering/exiting it (can it detect others at the moment?). Defaults to [code]true[/code].
+ If [code]true[/code] the area detects bodies or areas entering and exiting it. Default value: [code]true[/code].
</member>
<member name="priority" type="float" setter="set_priority" getter="get_priority">
- The processing order for this priority. Ranges from 0 to 128. Defaults to 0. Higher priorities are processed first.
+ The area's priority. Higher priority areas are processed first. Default value: 0.
</member>
<member name="space_override" type="int" setter="set_space_override_mode" getter="get_space_override_mode" enum="Area2D.SpaceOverride">
- How to override gravity and damping calculations within this Area2D, if at all. Consult the SPACE_OVERRIDE_* constants for available options.
+ Override mode for gravity and damping calculations within this area. See the SPACE_OVERRIDE_* constants for values.
</member>
</members>
<signals>
@@ -368,14 +365,14 @@
<argument index="0" name="area" type="Object">
</argument>
<description>
- This signal is triggered only once when an area enters this area. The only parameter passed is the area that entered this area.
+ Emitted when another area enters.
</description>
</signal>
<signal name="area_exited">
<argument index="0" name="area" type="Object">
</argument>
<description>
- This signal is triggered only once when an area exits this area. The only parameter passed is the area that exited this area.
+ Emitted when another area exits.
</description>
</signal>
<signal name="area_shape_entered">
@@ -388,7 +385,7 @@
<argument index="3" name="self_shape" type="int">
</argument>
<description>
- This signal triggers only once when an area enters this area. The first parameter is the area's [RID]. The second one is the area as an object. The third one is the index of the shape entering this area, and the fourth one is the index of the shape in this area that reported the entering.
+ Emitted when another area enters, reporting which shapes overlapped.
</description>
</signal>
<signal name="area_shape_exited">
@@ -401,21 +398,21 @@
<argument index="3" name="self_shape" type="int">
</argument>
<description>
- This signal triggers only once when an area exits this area. The first parameter is the area's [RID]. The second one is the area as an object. The third one is the index of the shape entering this area, and the fourth one is the index of the shape in this area that reported the entering.
+ Emitted when another area exits, reporting which shapes were overlapping.
</description>
</signal>
<signal name="body_entered">
<argument index="0" name="body" type="Object">
</argument>
<description>
- This signal is triggered only once when a body enters this area. The only parameter passed is the body that entered this area.
+ Emitted when a [PhysicsBody2D] object enters.
</description>
</signal>
<signal name="body_exited">
<argument index="0" name="body" type="Object">
</argument>
<description>
- This signal is triggered only once when a body exits this area. The only parameter passed is the body that exited this area.
+ Emitted when a [PhysicsBody2D] object exits.
</description>
</signal>
<signal name="body_shape_entered">
@@ -428,7 +425,7 @@
<argument index="3" name="area_shape" type="int">
</argument>
<description>
- This signal triggers only once when a body enters this area. The first parameter is the body's [RID]. The second one is the body as an object. The third one is the index of the shape of the body that entered this area, and the fourth one is the index of the shape in this area that reported the entering.
+ Emitted when a [PhysicsBody2D] object enters, reporting which shapes overlapped.
</description>
</signal>
<signal name="body_shape_exited">
@@ -441,25 +438,25 @@
<argument index="3" name="area_shape" type="int">
</argument>
<description>
- This signal triggers only once when a body exits this area. The first parameter is the body's [RID]. The second one is the body as an object. The third one is the index of the shape exiting this area, and the fourth one is the index of the shape in this area that reported the exit.
+ Emitted when a [PhysicsBody2D] object exits, reporting which shapes were overlapping.
</description>
</signal>
</signals>
<constants>
<constant name="SPACE_OVERRIDE_DISABLED" value="0">
- This area does not affect gravity/damp. These are areas that exist only to detect collisions and objects entering or exiting them.
+ This area does not affect gravity/damping.
</constant>
<constant name="SPACE_OVERRIDE_COMBINE" value="1">
- This area adds its gravity/damp values to whatever has been calculated so far. This way, many overlapping areas can combine their physics to make interesting effects.
+ This area adds its gravity/damping values to whatever has been calculated so far (in [code]priority[/code] order).
</constant>
<constant name="SPACE_OVERRIDE_COMBINE_REPLACE" value="2">
- This area adds its gravity/damp values to whatever has been calculated so far. Then stops taking into account the rest of the areas, even the default one.
+ This area adds its gravity/damping values to whatever has been calculated so far (in [code]priority[/code] order), ignoring any lower priority areas.
</constant>
<constant name="SPACE_OVERRIDE_REPLACE" value="3">
- This area replaces any gravity/damp, even the default one, and stops taking into account the rest of the areas.
+ This area replaces any gravity/damping, even the defaults, ignoring any lower priority areas.
</constant>
<constant name="SPACE_OVERRIDE_REPLACE_COMBINE" value="4">
- This area replaces any gravity/damp calculated so far, but keeps calculating the rest of the areas, down to the default one.
+ This area replaces any gravity/damping calculated so far (in [code]priority[/code] order), but keeps calculating the rest of the areas.
</constant>
</constants>
</class>
diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml
index f833764141..2cfbaffe04 100644
--- a/doc/classes/Array.xml
+++ b/doc/classes/Array.xml
@@ -104,6 +104,7 @@
<return type="Array">
</return>
<description>
+ Returns a copy of this [code]Array[/code].
</description>
</method>
<method name="empty">
@@ -177,8 +178,10 @@
</description>
</method>
<method name="invert">
+ <return type="Array">
+ </return>
<description>
- Reverse the order of the elements in the array (so first element will now be the last).
+ Reverse the order of the elements in the array (so first element will now be the last) and return reference to the array.
</description>
</method>
<method name="pop_back">
@@ -213,7 +216,7 @@
</description>
</method>
<method name="resize">
- <argument index="0" name="position" type="int">
+ <argument index="0" name="size" type="int">
</argument>
<description>
Resize the array to contain a different number of elements. If the array size is smaller, elements are cleared, if bigger, new elements are Null.
@@ -238,17 +241,21 @@
</description>
</method>
<method name="sort">
+ <return type="Array">
+ </return>
<description>
- Sort the array using natural order.
+ Sort the array using natural order and return reference to the array.
</description>
</method>
<method name="sort_custom">
+ <return type="Array">
+ </return>
<argument index="0" name="obj" type="Object">
</argument>
<argument index="1" name="func" type="String">
</argument>
<description>
- Sort the array using a custom method. The arguments are an object that holds the method and the name of such method. The custom method receives two arguments (a pair of elements from the array) and must return true if the first argument is less than the second, and return false otherwise. Note: you cannot randomize the return value as the heapsort algorithm expects a deterministic result. Doing so will result in unexpected behavior.
+ Sort the array using a custom method and return reference to the array. The arguments are an object that holds the method and the name of such method. The custom method receives two arguments (a pair of elements from the array) and must return true if the first argument is less than the second, and return false otherwise. Note: you cannot randomize the return value as the heapsort algorithm expects a deterministic result. Doing so will result in unexpected behavior.
</description>
</method>
</methods>
diff --git a/doc/classes/AudioBusLayout.xml b/doc/classes/AudioBusLayout.xml
index e5b17b8dfb..045c6c2bf9 100644
--- a/doc/classes/AudioBusLayout.xml
+++ b/doc/classes/AudioBusLayout.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AudioBusLayout" inherits="Resource" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Stores information about the audiobusses.
</brief_description>
<description>
+ Stores position, muting, solo, bypass, effects, effect position, volume, and the connections between busses. See [AudioServer] for usage.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/AudioEffectAmplify.xml b/doc/classes/AudioEffectAmplify.xml
index 8497042b53..35d7991833 100644
--- a/doc/classes/AudioEffectAmplify.xml
+++ b/doc/classes/AudioEffectAmplify.xml
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AudioEffectAmplify" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Amplifies the volume of an audio source.
+ Adds a Amplify audio effect to an Audio bus.
+ Increases or decreases the volume of the selected audio bus.
</brief_description>
<description>
- Amplifies the volume of an audio source. Increase gain of the audio being routed through the bus.
+ Increases or decreases the volume being routed through the audio bus.
</description>
<tutorials>
</tutorials>
@@ -15,7 +16,6 @@
<return type="float">
</return>
<description>
- Returns the set maximum volume.
</description>
</method>
<method name="set_volume_db">
@@ -24,13 +24,12 @@
<argument index="0" name="volume" type="float">
</argument>
<description>
- Sets the maximum volume.
</description>
</method>
</methods>
<members>
<member name="volume_db" type="float" setter="set_volume_db" getter="get_volume_db">
- The effect's volume limit.
+ Amount of amplification. Positive values make the sound louder, negative values make it quieter. Value can range from -80 to 24. Default value: [code]0[/code].
</member>
</members>
<constants>
diff --git a/doc/classes/AudioEffectCompressor.xml b/doc/classes/AudioEffectCompressor.xml
index 5a7a91ede0..9d7e25dbf2 100644
--- a/doc/classes/AudioEffectCompressor.xml
+++ b/doc/classes/AudioEffectCompressor.xml
@@ -1,8 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AudioEffectCompressor" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Adds a Compressor audio effect to an Audio bus.
+ Reduces sounds that exceed a certain threshold level, smooths out the dynamics and increases the overall volume.
</brief_description>
<description>
+ Dynamic range compressor reduces the level of the sound when the amplitude goes over a certain threshold in Decibels. One of the main uses of a compressor is to increase the dynamic range by clipping as little as possible (when sound goes over 0dB).
+ Compressor has many uses in the mix:
+ - In the Master bus to compress the whole output (Although a [AudioEffectLimiter] is probably better)
+ - In voice channels to ensure they sound as balanced as possible.
+ - Sidechained. Sidechained, which can reduce the sound level sidechained with another audio bus for threshold detection.. This technique is very common in video game mixing to download the level of Music/SFX while voices are being heard.
+ - Accentuates transients by using a wider attack, making effects sound more punchy.
</description>
<tutorials>
</tutorials>
@@ -110,18 +118,25 @@
</methods>
<members>
<member name="attack_us" type="float" setter="set_attack_us" getter="get_attack_us">
+ Compressor's reaction time when the signal exceeds the threshold. Value can range from 20 to 2000. Default value: [code]20ms[/code].
</member>
<member name="gain" type="float" setter="set_gain" getter="get_gain">
+ Gain applied to the output signal.
</member>
<member name="mix" type="float" setter="set_mix" getter="get_mix">
+ Balance between original signal and effect signal. Value can range from 0 (totally dry) to 1 (totally wet). Default value: [code]1[/code].
</member>
<member name="ratio" type="float" setter="set_ratio" getter="get_ratio">
+ Amount of compression applied to the audio once it passes the threshold level. The higher the ratio the more the loud parts of the audio will be compressed. Value can range from 1 to 48. Default value: [code]4[/code].
</member>
<member name="release_ms" type="float" setter="set_release_ms" getter="get_release_ms">
+ Compressor's delay time to stop reducing the signal after the signal level falls below the threshold. Value can range from 20 to 2000. Default value: [code]250ms[/code].
</member>
<member name="sidechain" type="String" setter="set_sidechain" getter="get_sidechain">
+ Reduce the sound level using another audio bus for threshold detection.
</member>
<member name="threshold" type="float" setter="set_threshold" getter="get_threshold">
+ The level above which compression is applied to the audio. Value can range from -60 to 0. Default value: [code]0[/code].
</member>
</members>
<constants>
diff --git a/doc/classes/AudioEffectDelay.xml b/doc/classes/AudioEffectDelay.xml
index 8d317b3c46..9dc61883ab 100644
--- a/doc/classes/AudioEffectDelay.xml
+++ b/doc/classes/AudioEffectDelay.xml
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AudioEffectDelay" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Adds a Delay audio effect to an Audio bus. Plays input signal back after a period of time.
+ Two tap delay and feedback options.
</brief_description>
<description>
+ Plays input signal back after a period of time. The delayed signal may be played back multiple times to create the sound of a repeating, decaying echo. Delay effects range from a subtle echo effect to a pronounced blending of previous sounds with new sounds.
</description>
<tutorials>
</tutorials>
@@ -194,30 +197,43 @@
</methods>
<members>
<member name="dry" type="float" setter="set_dry" getter="get_dry">
+ Output percent of original sound. At 0, only delayed sounds are output. Value can range from 0 to 1. Default value: [code]1[/code].
</member>
<member name="feedback/active" type="bool" setter="set_feedback_active" getter="is_feedback_active">
+ If [code]true[/code] feedback is enabled. Default value: [code]false[/code].
</member>
<member name="feedback/delay_ms" type="float" setter="set_feedback_delay_ms" getter="get_feedback_delay_ms">
+ Feedback delay time in milliseconds. Default value: [code]340[/code].
</member>
<member name="feedback/level_db" type="float" setter="set_feedback_level_db" getter="get_feedback_level_db">
+ Sound level for [code]tap1[/code]. Default value: [code]-6 dB[/code].
</member>
<member name="feedback/lowpass" type="float" setter="set_feedback_lowpass" getter="get_feedback_lowpass">
+ Low-pass filter for feedback. Frequencies below the Low Cut value are filtered out of the source signal. Default value: [code]16000[/code].
</member>
<member name="tap1/active" type="bool" setter="set_tap1_active" getter="is_tap1_active">
+ If [code]true[/code], [code]tap1[/code] will be enabled. Default value: [code]true[/code].
</member>
<member name="tap1/delay_ms" type="float" setter="set_tap1_delay_ms" getter="get_tap1_delay_ms">
+ [b]Tap1[/b] delay time in milliseconds. Default value: [code]250ms[/code].
</member>
<member name="tap1/level_db" type="float" setter="set_tap1_level_db" getter="get_tap1_level_db">
+ Sound level for [code]tap1[/code]. Default value: [code]-6 dB[/code].
</member>
<member name="tap1/pan" type="float" setter="set_tap1_pan" getter="get_tap1_pan">
+ Pan position for [code]tap1[/code]. Value can range from -1 (fully left) to 1 (fully right). Default value: [code]0.2[/code].
</member>
<member name="tap2/active" type="bool" setter="set_tap2_active" getter="is_tap2_active">
+ If [code]true[/code], [code]tap2[/code] will be enabled. Default value: [code]true[/code].
</member>
<member name="tap2/delay_ms" type="float" setter="set_tap2_delay_ms" getter="get_tap2_delay_ms">
+ [b]Tap2[/b] delay time in milliseconds. Default value: [code]500ms[/code].
</member>
<member name="tap2/level_db" type="float" setter="set_tap2_level_db" getter="get_tap2_level_db">
+ Sound level for [code]tap2[/code]. Default value: [code]-12 dB[/code].
</member>
<member name="tap2/pan" type="float" setter="set_tap2_pan" getter="get_tap2_pan">
+ Pan position for [code]tap2[/code]. Value can range from -1 (fully left) to 1 (fully right). Default value: [code]-0.4[/code].
</member>
</members>
<constants>
diff --git a/doc/classes/AudioEffectDistortion.xml b/doc/classes/AudioEffectDistortion.xml
index e5c5a3b50e..1a6aa1d2b6 100644
--- a/doc/classes/AudioEffectDistortion.xml
+++ b/doc/classes/AudioEffectDistortion.xml
@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AudioEffectDistortion" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Adds a Distortion audio effect to an Audio bus.
+ Modify the sound to make it dirty.
</brief_description>
<description>
+ Modify the sound and make it dirty. Differents types available : clip, tan, lofi (bit crushing), overdrive, or waveshape.
+ By distorting the waveform the frequency content change, which will often make the sound "crunchy" or "abrasive". For games, it can simulate sound coming from some saturated device or speaker very efficiently.
</description>
<tutorials>
</tutorials>
@@ -82,26 +86,35 @@
</methods>
<members>
<member name="drive" type="float" setter="set_drive" getter="get_drive">
+ Distortion power. Value can range from 0 to 1. Default value: [code]0[/code].
</member>
<member name="keep_hf_hz" type="float" setter="set_keep_hf_hz" getter="get_keep_hf_hz">
+ High-pass filter. Frequencies higher than this value will not be affected by the distortion. Value can range from 1 to 20000. Default value: [code]16000[/code].
</member>
<member name="mode" type="int" setter="set_mode" getter="get_mode" enum="AudioEffectDistortion.Mode">
+ Distortion type. Default value: [code]MODE_CLIP[/code].
</member>
<member name="post_gain" type="float" setter="set_post_gain" getter="get_post_gain">
+ Increases or decreases the volume after the effect. Value can range from -80 to 24. Default value: [code]0[/code].
</member>
<member name="pre_gain" type="float" setter="set_pre_gain" getter="get_pre_gain">
+ Increases or decreases the volume before the effect. Value can range from -60 to 60. Default value: [code]0[/code].
</member>
</members>
<constants>
<constant name="MODE_CLIP" value="0">
+ Digital distortion effect which cuts off peaks at the top and bottom of the waveform.
</constant>
<constant name="MODE_ATAN" value="1">
</constant>
<constant name="MODE_LOFI" value="2">
+ Low-resolution digital distortion effect. You can use it to emulate the sound of early digital audio devices.
</constant>
<constant name="MODE_OVERDRIVE" value="3">
+ Emulates the warm distortion produced by a field effect transistor, which is commonly used in solid-state musical instrument amplifiers.
</constant>
<constant name="MODE_WAVESHAPE" value="4">
+ Waveshaper distortions are used mainly by electronic musicians to achieve an extra-abrasive sound.
</constant>
</constants>
</class>
diff --git a/doc/classes/AudioEffectEQ.xml b/doc/classes/AudioEffectEQ.xml
index 94d5c696c3..246f6b882e 100644
--- a/doc/classes/AudioEffectEQ.xml
+++ b/doc/classes/AudioEffectEQ.xml
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AudioEffectEQ" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Base class for audio equalizers. Gives you control over frequencies.
+ Use it to create a custom equalizer if [AudioEffectEQ6], [AudioEffectEQ10] or [AudioEffectEQ21] don't fit your needs.
</brief_description>
<description>
+ AudioEffectEQ gives you control over frequencies. Use it to compensate for existing deficiencies in audio. AudioEffectEQ are very useful on the Master Bus to completely master a mix and give it character. They are also very useful when a game is run on a mobile device, to adjust the mix to that kind of speakers (it can be added but disabled when headphones are plugged).
</description>
<tutorials>
</tutorials>
@@ -13,6 +16,7 @@
<return type="int">
</return>
<description>
+ Returns the number of bands of the equalizer.
</description>
</method>
<method name="get_band_gain_db" qualifiers="const">
@@ -21,6 +25,7 @@
<argument index="0" name="band_idx" type="int">
</argument>
<description>
+ Returns the band's gain at the specified index, in dB.
</description>
</method>
<method name="set_band_gain_db">
@@ -31,6 +36,7 @@
<argument index="1" name="volume_db" type="float">
</argument>
<description>
+ Sets band's gain at the specified index, in dB.
</description>
</method>
</methods>
diff --git a/doc/classes/AudioEffectEQ10.xml b/doc/classes/AudioEffectEQ10.xml
index 004236dfde..7a29f4cc0b 100644
--- a/doc/classes/AudioEffectEQ10.xml
+++ b/doc/classes/AudioEffectEQ10.xml
@@ -1,8 +1,23 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AudioEffectEQ10" inherits="AudioEffectEQ" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Adds a 10-band equalizer audio effect to an Audio bus. Gives you control over frequencies from 31 Hz to 16000 Hz.
+ Each frequency can be modulated between -60/+24 dB.
</brief_description>
<description>
+ Frequency bands :
+ Band 1 : 31 Hz
+ Band 2 : 62 Hz
+ Band 3 : 125 Hz
+ Band 4 : 250 Hz
+ Band 5 : 500 Hz
+ Band 6 : 1000 Hz
+ Band 7 : 2000 Hz
+ Band 8 : 4000 Hz
+ Band 9 : 8000 Hz
+ Band 10 : 16000 Hz
+
+ See also [AudioEffectEQ], [AudioEffectEQ6], [AudioEffectEQ21].
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/AudioEffectEQ21.xml b/doc/classes/AudioEffectEQ21.xml
index e4faa9bb0c..327f5a291a 100644
--- a/doc/classes/AudioEffectEQ21.xml
+++ b/doc/classes/AudioEffectEQ21.xml
@@ -1,8 +1,34 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AudioEffectEQ21" inherits="AudioEffectEQ" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Adds a 21-band equalizer audio effect to an Audio bus. Gives you control over frequencies from 22 Hz to 22000 Hz.
+ Each frequency can be modulated between -60/+24 dB.
</brief_description>
<description>
+ Frequency bands :
+ Band 1 : 22 Hz
+ Band 2 : 32 Hz
+ Band 3 : 44 Hz
+ Band 4 : 63 Hz
+ Band 5 : 90 Hz
+ Band 6 : 125 Hz
+ Band 7 : 175 Hz
+ Band 8 : 250 Hz
+ Band 9 : 350 Hz
+ Band 10 : 500 Hz
+ Band 11 : 700 Hz
+ Band 12 : 1000 Hz
+ Band 13 : 1400 Hz
+ Band 14 : 2000 Hz
+ Band 15 : 2800 Hz
+ Band 16 : 4000 Hz
+ Band 17 : 5600 Hz
+ Band 18 : 8000 Hz
+ Band 19 : 11000 Hz
+ Band 20 : 16000 Hz
+ Band 21 : 22000 Hz
+
+ See also [AudioEffectEQ], [AudioEffectEQ6], [AudioEffectEQ10].
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/AudioEffectEQ6.xml b/doc/classes/AudioEffectEQ6.xml
index b74cc5d285..bc05535041 100644
--- a/doc/classes/AudioEffectEQ6.xml
+++ b/doc/classes/AudioEffectEQ6.xml
@@ -1,8 +1,19 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AudioEffectEQ6" inherits="AudioEffectEQ" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Adds a 6-band equalizer audio effect to an Audio bus. Gives you control over frequencies from 32 Hz to 10000 Hz.
+ Each frequency can be modulated between -60/+24 dB.
</brief_description>
<description>
+ Frequency bands :
+ Band 1 : 32 Hz
+ Band 2 : 100 Hz
+ Band 3 : 320 Hz
+ Band 4 : 1000 Hz
+ Band 5 : 3200 Hz
+ Band 6 : 10000 Hz
+
+ See also [AudioEffectEQ], [AudioEffectEQ10], [AudioEffectEQ21].
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/AudioEffectLimiter.xml b/doc/classes/AudioEffectLimiter.xml
index e52fb57c70..5209f290b1 100644
--- a/doc/classes/AudioEffectLimiter.xml
+++ b/doc/classes/AudioEffectLimiter.xml
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AudioEffectLimiter" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Adds a soft clip Limiter audio effect to an Audio bus.
</brief_description>
<description>
+ A limiter is similar to a compressor, but it’s less flexible and designed to disallow sound going over a given dB threshold. Adding one in the Master Bus is always recommended to reduce the effects of clipping.
+ Soft clipping starts to reduce the peaks a little below the threshold level and progressively increases its effect as the input level increases such that the threshold is never exceeded.
</description>
<tutorials>
</tutorials>
@@ -68,12 +71,15 @@
</methods>
<members>
<member name="ceiling_db" type="float" setter="set_ceiling_db" getter="get_ceiling_db">
+ The waveform's maximum allowed value. Value can range from -20 to -0.1. Default value: [code]-0.1dB[/code].
</member>
<member name="soft_clip_db" type="float" setter="set_soft_clip_db" getter="get_soft_clip_db">
+ Applies a gain to the limited waves. Value can range from 0 to 6. Default value: [code]2dB[/code].
</member>
<member name="soft_clip_ratio" type="float" setter="set_soft_clip_ratio" getter="get_soft_clip_ratio">
</member>
<member name="threshold_db" type="float" setter="set_threshold_db" getter="get_threshold_db">
+ Threshold from which the limiter begins to be active. Value can range from -30 to 0. Default value: [code]0dB[/code].
</member>
</members>
<constants>
diff --git a/doc/classes/AudioEffectPanner.xml b/doc/classes/AudioEffectPanner.xml
index b55d7f91c1..56b39a36c6 100644
--- a/doc/classes/AudioEffectPanner.xml
+++ b/doc/classes/AudioEffectPanner.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AudioEffectPanner" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Adds a Panner audio effect to an Audio bus. Pans sound left or right.
</brief_description>
<description>
+ Determines how much of an audio signal is sent to the left and right buses.
</description>
<tutorials>
</tutorials>
@@ -26,6 +28,7 @@
</methods>
<members>
<member name="pan" type="float" setter="set_pan" getter="get_pan">
+ Pan position. Value can range from -1 (fully left) to 1 (fully right).
</member>
</members>
<constants>
diff --git a/doc/classes/AudioEffectPhaser.xml b/doc/classes/AudioEffectPhaser.xml
index 7e9cd27a47..bd9067471b 100644
--- a/doc/classes/AudioEffectPhaser.xml
+++ b/doc/classes/AudioEffectPhaser.xml
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AudioEffectPhaser" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Adds a Phaser audio effect to an Audio bus.
+ Combines the original signal with a copy that is slightly out of phase with the original.
</brief_description>
<description>
+ Combines phase-shifted signals with the original signal. The movement of the phase-shifted signals is controlled using a Low Frequency Oscillator.
</description>
<tutorials>
</tutorials>
@@ -82,14 +85,19 @@
</methods>
<members>
<member name="depth" type="float" setter="set_depth" getter="get_depth">
+ Governs how high the filter frequencies sweep. Low value will primarily affect bass frequencies. High value can sweep high into the treble. Value can range from 0.1 to 4. Default value: [code]1[/code].
</member>
<member name="feedback" type="float" setter="set_feedback" getter="get_feedback">
+ Output percent of modified sound. Value can range from 0.1 to 0.9. Default value: [code]0.7[/code].
</member>
<member name="range_max_hz" type="float" setter="set_range_max_hz" getter="get_range_max_hz">
+ Determines the maximum frequency affected by the LFO modulations. Value can range from 10 to 10000. Default value: [code]1600hz[/code].
</member>
<member name="range_min_hz" type="float" setter="set_range_min_hz" getter="get_range_min_hz">
+ Determines the minimum frequency affected by the LFO modulations. Value can range from 10 to 10000. Default value: [code]440hz[/code].
</member>
<member name="rate_hz" type="float" setter="set_rate_hz" getter="get_rate_hz">
+ Adjusts the rate at which the effect sweeps up and down across the frequency range.
</member>
</members>
<constants>
diff --git a/doc/classes/AudioEffectPitchShift.xml b/doc/classes/AudioEffectPitchShift.xml
index 6fc3acdc20..edcb54e09e 100644
--- a/doc/classes/AudioEffectPitchShift.xml
+++ b/doc/classes/AudioEffectPitchShift.xml
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AudioEffectPitchShift" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Adds a Pitch shift audio effect to an Audio bus.
+ Raises or lowers the pitch of original sound.
</brief_description>
<description>
+ Allows modulation of pitch independently of tempo. All frequencies can be increased/decreased with minimal effect on transients.
</description>
<tutorials>
</tutorials>
@@ -26,6 +29,7 @@
</methods>
<members>
<member name="pitch_scale" type="float" setter="set_pitch_scale" getter="get_pitch_scale">
+ Pitch value. Can range from 0 (-1 octave) to 16 (+16 octaves).
</member>
</members>
<constants>
diff --git a/doc/classes/AudioEffectReverb.xml b/doc/classes/AudioEffectReverb.xml
index b390fa239c..4cda24530b 100644
--- a/doc/classes/AudioEffectReverb.xml
+++ b/doc/classes/AudioEffectReverb.xml
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AudioEffectReverb" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Adds a Reverb audio effect to an Audio bus.
+ Simulates the sound of acoustic environments such as rooms, concert halls, caverns, or an open spaces.
</brief_description>
<description>
+ Simulates rooms of different sizes. Its parameters can be adjusted to simulate the sound of a specific room.
</description>
<tutorials>
</tutorials>
@@ -124,20 +127,28 @@
</methods>
<members>
<member name="damping" type="float" setter="set_damping" getter="get_damping">
+ Widens or narrows the stereo image of the reverb tail. 1 means fully widens. Value can range from 0 to 1. Default value: [code]1[/code].
</member>
<member name="dry" type="float" setter="set_dry" getter="get_dry">
+ Output percent of original sound. At 0, only modified sound is outputted. Value can range from 0 to 1. Default value: [code]1[/code].
</member>
<member name="hipass" type="float" setter="set_hpf" getter="get_hpf">
+ High-pass filter passes signals with a frequency higher than a certain cutoff frequency and attenuates signals with frequencies lower than the cutoff frequency. Value can range from 0 to 1. Default value: [code]0[/code].
</member>
<member name="predelay_feedback" type="float" setter="set_predelay_msec" getter="get_predelay_msec">
+ Output percent of predelay. Value can range from 0 to 1. Default value: [code]1[/code].
</member>
<member name="predelay_msec" type="float" setter="set_predelay_msec" getter="get_predelay_msec">
+ Time between the original signal and the early reflections of the reverb signal. Default value: [code]150ms[/code].
</member>
<member name="room_size" type="float" setter="set_room_size" getter="get_room_size">
+ Dimensions of simulated room. Bigger means more echoes. Value can range from 0 to 1. Default value: [code]0.8[/code].
</member>
<member name="spread" type="float" setter="set_spread" getter="get_spread">
+ Defines how reflective the imaginary room's walls are. Value can range from 0 to 1. Default value: [code]1[/code].
</member>
<member name="wet" type="float" setter="set_wet" getter="get_wet">
+ Output percent of modified sound. At 0, only original sound is outputted. Value can range from 0 to 1. Default value: [code]0.5[/code].
</member>
</members>
<constants>
diff --git a/doc/classes/AudioServer.xml b/doc/classes/AudioServer.xml
index 768987fd0b..0a59da5355 100644
--- a/doc/classes/AudioServer.xml
+++ b/doc/classes/AudioServer.xml
@@ -17,6 +17,7 @@
<argument index="0" name="at_position" type="int" default="-1">
</argument>
<description>
+ Adds a bus at [code]at_position[/code].
</description>
</method>
<method name="add_bus_effect">
@@ -29,18 +30,21 @@
<argument index="2" name="at_position" type="int" default="-1">
</argument>
<description>
+ Adds an [AudioEffect] effect to the bus [code]bus_idx[/code] at [code]at_position[/code].
</description>
</method>
<method name="generate_bus_layout" qualifiers="const">
<return type="AudioBusLayout">
</return>
<description>
+ Generates an [AudioBusLayout] using the available busses and effects.
</description>
</method>
<method name="get_bus_count" qualifiers="const">
<return type="int">
</return>
<description>
+ Returns the number of available busses.
</description>
</method>
<method name="get_bus_effect">
@@ -51,6 +55,7 @@
<argument index="1" name="effect_idx" type="int">
</argument>
<description>
+ Returns the [AudioEffect] at position [code]effect_idx[/code] in bus [code]bus_idx[/code].
</description>
</method>
<method name="get_bus_effect_count">
@@ -59,6 +64,7 @@
<argument index="0" name="bus_idx" type="int">
</argument>
<description>
+ Returns the number of effects on the bus at [code]bus_idx[/code].
</description>
</method>
<method name="get_bus_index" qualifiers="const">
@@ -67,6 +73,7 @@
<argument index="0" name="bus_name" type="String">
</argument>
<description>
+ Returns the index of the bus with the name [code]bus_name[/code].
</description>
</method>
<method name="get_bus_name" qualifiers="const">
@@ -75,6 +82,7 @@
<argument index="0" name="bus_idx" type="int">
</argument>
<description>
+ Returns the name of the bus with the index [code]bus_idx[/code].
</description>
</method>
<method name="get_bus_peak_volume_left_db" qualifiers="const">
@@ -85,6 +93,7 @@
<argument index="1" name="channel" type="int">
</argument>
<description>
+ Returns the peak volume of the left speaker at bus index [code]bus_idx[/code] and channel index [code]channel[/code].
</description>
</method>
<method name="get_bus_peak_volume_right_db" qualifiers="const">
@@ -95,6 +104,7 @@
<argument index="1" name="channel" type="int">
</argument>
<description>
+ Returns the peak volume of the right speaker at bus index [code]bus_idx[/code] and channel index [code]channel[/code].
</description>
</method>
<method name="get_bus_send" qualifiers="const">
@@ -103,6 +113,7 @@
<argument index="0" name="bus_idx" type="int">
</argument>
<description>
+ Returns the name of the bus that the bus at index [code]bus_idx[/code] sends to.
</description>
</method>
<method name="get_bus_volume_db" qualifiers="const">
@@ -111,18 +122,21 @@
<argument index="0" name="bus_idx" type="int">
</argument>
<description>
+ Returns the volume of the bus at index [code]bus_idx[/code] in dB.
</description>
</method>
<method name="get_mix_rate" qualifiers="const">
<return type="float">
</return>
<description>
+ Returns the sample rate at the output of the audioserver.
</description>
</method>
<method name="get_speaker_mode" qualifiers="const">
<return type="int" enum="AudioServer.SpeakerMode">
</return>
<description>
+ Returns the speaker configuration.
</description>
</method>
<method name="is_bus_bypassing_effects" qualifiers="const">
@@ -131,6 +145,7 @@
<argument index="0" name="bus_idx" type="int">
</argument>
<description>
+ If [code]true[/code] the bus at index [code]bus_idx[/code] is bypassing effects.
</description>
</method>
<method name="is_bus_effect_enabled" qualifiers="const">
@@ -141,6 +156,7 @@
<argument index="1" name="effect_idx" type="int">
</argument>
<description>
+ If [code]true[/code] the effect at index [code]effect_idx[/code] on the bus at index [code]bus_idx[/code] is enabled.
</description>
</method>
<method name="is_bus_mute" qualifiers="const">
@@ -149,6 +165,7 @@
<argument index="0" name="bus_idx" type="int">
</argument>
<description>
+ If [code]true[/code] the bus at index [code]bus_idx[/code] is muted.
</description>
</method>
<method name="is_bus_solo" qualifiers="const">
@@ -157,12 +174,14 @@
<argument index="0" name="bus_idx" type="int">
</argument>
<description>
+ If [code]true[/code] the bus at index [code]bus_idx[/code] is in solo mode.
</description>
</method>
<method name="lock">
<return type="void">
</return>
<description>
+ Locks the audio drivers mainloop. Remember to unlock it afterwards.
</description>
</method>
<method name="move_bus">
@@ -173,6 +192,7 @@
<argument index="1" name="to_index" type="int">
</argument>
<description>
+ Moves the bus from index [code]index[/code] to index [code]to_index[/code].
</description>
</method>
<method name="remove_bus">
@@ -181,6 +201,7 @@
<argument index="0" name="index" type="int">
</argument>
<description>
+ Removes the bus at index [code]index[/code].
</description>
</method>
<method name="remove_bus_effect">
@@ -191,6 +212,7 @@
<argument index="1" name="effect_idx" type="int">
</argument>
<description>
+ Removes the effect at index [code]effect_idx[/code] from the bus at index [code]bus_idx[/code].
</description>
</method>
<method name="set_bus_bypass_effects">
@@ -201,6 +223,7 @@
<argument index="1" name="enable" type="bool">
</argument>
<description>
+ If [code]true[/code] the bus at index [code]bus_idx[/code] is bypassing effects.
</description>
</method>
<method name="set_bus_count">
@@ -209,6 +232,7 @@
<argument index="0" name="amount" type="int">
</argument>
<description>
+ Adds and removes busses to make the number of busses match [code]amount[/code].
</description>
</method>
<method name="set_bus_effect_enabled">
@@ -221,6 +245,7 @@
<argument index="2" name="enabled" type="bool">
</argument>
<description>
+ If [code]true[/code] the effect at index [code]effect_idx[/code] on the bus at index [code]bus_idx[/code] is enabled.
</description>
</method>
<method name="set_bus_layout">
@@ -229,6 +254,7 @@
<argument index="0" name="bus_layout" type="AudioBusLayout">
</argument>
<description>
+ Overwrites the currently used [AudioBusLayout].
</description>
</method>
<method name="set_bus_mute">
@@ -239,6 +265,7 @@
<argument index="1" name="enable" type="bool">
</argument>
<description>
+ If [code]true[/code] the bus at index [code]bus_idx[/code] is muted.
</description>
</method>
<method name="set_bus_name">
@@ -249,6 +276,7 @@
<argument index="1" name="name" type="String">
</argument>
<description>
+ Sets the name of the bus at index [code]bus_idx[/code] to [code]name[/code].
</description>
</method>
<method name="set_bus_send">
@@ -259,6 +287,7 @@
<argument index="1" name="send" type="String">
</argument>
<description>
+ Connects the output of the bus at [code]bus_idx[/code] to the bus named [code]send[/send].
</description>
</method>
<method name="set_bus_solo">
@@ -269,6 +298,7 @@
<argument index="1" name="enable" type="bool">
</argument>
<description>
+ If [code]true[/code] the bus at index [code]bus_idx[/code] is in solo mode.
</description>
</method>
<method name="set_bus_volume_db">
@@ -279,6 +309,7 @@
<argument index="1" name="volume_db" type="float">
</argument>
<description>
+ Sets the volume of the bus at index [code]bus_idx[/code] to [code]volume_db[/code].
</description>
</method>
<method name="swap_bus_effects">
@@ -291,27 +322,33 @@
<argument index="2" name="by_effect_idx" type="int">
</argument>
<description>
+ Swaps the position of two effects in bus [code]bus_idx[/code].
</description>
</method>
<method name="unlock">
<return type="void">
</return>
<description>
+ Unlocks the audiodriver's main loop. After locking it always unlock it.
</description>
</method>
</methods>
<signals>
<signal name="bus_layout_changed">
<description>
+ Emitted when the [AudioBusLayout] changes.
</description>
</signal>
</signals>
<constants>
<constant name="SPEAKER_MODE_STEREO" value="0">
+ Two or fewer speakers are detected.
</constant>
<constant name="SPEAKER_SURROUND_51" value="2">
+ A 5.1 channel surround setup detected.
</constant>
<constant name="SPEAKER_SURROUND_71" value="3">
+ A 7.1 channel surround setup detected.
</constant>
</constants>
</class>
diff --git a/doc/classes/AudioStreamPlayback.xml b/doc/classes/AudioStreamPlayback.xml
index 30a9a8f070..f45beec42c 100644
--- a/doc/classes/AudioStreamPlayback.xml
+++ b/doc/classes/AudioStreamPlayback.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AudioStreamPlayback" inherits="Reference" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Meta class for playing back audio.
</brief_description>
<description>
+ Can play, loop, pause a scroll through Audio. See [AudioStream] and [AudioStreamOGGVorbis] for usage.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/AudioStreamPlayer.xml b/doc/classes/AudioStreamPlayer.xml
index 2dba35bec0..1a9ad85565 100644
--- a/doc/classes/AudioStreamPlayer.xml
+++ b/doc/classes/AudioStreamPlayer.xml
@@ -7,6 +7,7 @@
Plays background audio.
</description>
<tutorials>
+ http://docs.godotengine.org/en/latest/learning/features/audio/index.html
</tutorials>
<demos>
</demos>
@@ -23,10 +24,11 @@
<description>
</description>
</method>
- <method name="get_position">
+ <method name="get_playback_position">
<return type="float">
</return>
<description>
+ Returns the position in the [AudioStream].
</description>
</method>
<method name="get_stream" qualifiers="const">
@@ -121,15 +123,16 @@
</methods>
<members>
<member name="autoplay" type="bool" setter="set_autoplay" getter="is_autoplay_enabled">
- If [code]true[/code], audio plays when added to scene tree. Default value: [code]false[/code].
+ If [code]true[/code] audio plays when added to scene tree. Default value: [code]false[/code].
</member>
<member name="bus" type="String" setter="set_bus" getter="get_bus">
Bus on which this audio is playing.
</member>
<member name="mix_target" type="int" setter="set_mix_target" getter="get_mix_target" enum="AudioStreamPlayer.MixTarget">
+ If the audio configuration has more than two speakers, this sets the target channels. See [code]MIX_TARGET_*[/code] constants.
</member>
<member name="playing" type="bool" setter="_set_playing" getter="is_playing">
- If [code]true[/code], audio is playing.
+ If [code]true[/code] audio is playing.
</member>
<member name="stream" type="AudioStream" setter="set_stream" getter="get_stream">
The [AudioStream] object to be played.
@@ -147,10 +150,13 @@
</signals>
<constants>
<constant name="MIX_TARGET_STEREO" value="0">
+ The audio will be played only on the first channel.
</constant>
<constant name="MIX_TARGET_SURROUND" value="1">
+ The audio will be played on all surround channels.
</constant>
<constant name="MIX_TARGET_CENTER" value="2">
+ The audio will be played on the second channel, which is usually the center.
</constant>
</constants>
</class>
diff --git a/doc/classes/AudioStreamPlayer2D.xml b/doc/classes/AudioStreamPlayer2D.xml
index 68afffdb41..c6fd8ff54f 100644
--- a/doc/classes/AudioStreamPlayer2D.xml
+++ b/doc/classes/AudioStreamPlayer2D.xml
@@ -36,10 +36,11 @@
<description>
</description>
</method>
- <method name="get_position">
+ <method name="get_playback_position">
<return type="float">
</return>
<description>
+ Returns the position in the [AudioStream].
</description>
</method>
<method name="get_stream" qualifiers="const">
@@ -156,7 +157,7 @@
Dampens audio over distance with this as an exponent.
</member>
<member name="autoplay" type="bool" setter="set_autoplay" getter="is_autoplay_enabled">
- If [code]true[/code], audio plays when added to scene tree. Default value: [code]false[/code].
+ If [code]true[/code] audio plays when added to scene tree. Default value: [code]false[/code].
</member>
<member name="bus" type="String" setter="set_bus" getter="get_bus">
Bus on which this audio is playing.
@@ -165,7 +166,7 @@
Maximum distance from which audio is still hearable.
</member>
<member name="playing" type="bool" setter="_set_playing" getter="is_playing">
- If [code]true[/code], audio is playing.
+ If [code]true[/code] audio is playing.
</member>
<member name="stream" type="AudioStream" setter="set_stream" getter="get_stream">
The [AudioStream] object to be played.
diff --git a/doc/classes/AudioStreamPlayer3D.xml b/doc/classes/AudioStreamPlayer3D.xml
index 1577c1e4d3..2085b35e2e 100644
--- a/doc/classes/AudioStreamPlayer3D.xml
+++ b/doc/classes/AudioStreamPlayer3D.xml
@@ -78,10 +78,11 @@
<description>
</description>
</method>
- <method name="get_position">
+ <method name="get_playback_position">
<return type="float">
</return>
<description>
+ Returns the position in the [AudioStream].
</description>
</method>
<method name="get_stream" qualifiers="const">
@@ -288,7 +289,7 @@
Decides if audio should get quieter with distance linearly, quadratically or logarithmically.
</member>
<member name="autoplay" type="bool" setter="set_autoplay" getter="is_autoplay_enabled">
- If [code]true[/code], audio plays audio plays when added to scene tree. Default value: [code]false[/code].
+ If [code]true[/code] audio plays when added to scene tree. Default value: [code]false[/code].
</member>
<member name="bus" type="String" setter="set_bus" getter="get_bus">
Bus on which this audio is playing.
@@ -300,7 +301,7 @@
The angle in which the audio reaches cameras undampened.
</member>
<member name="emission_angle_enabled" type="bool" setter="set_emission_angle_enabled" getter="is_emission_angle_enabled">
- If [code]true[/code], the audio should be dampened according to the direction of the sound.
+ If [code]true[/code] the audio should be dampened according to the direction of the sound.
</member>
<member name="emission_angle_filter_attenuation_db" type="float" setter="set_emission_angle_filter_attenuation_db" getter="get_emission_angle_filter_attenuation_db">
dampens audio if camera is outside of 'emission_angle_degrees' and 'emission_angle_enabled' is set by this factor, in dB.
diff --git a/doc/classes/BackBufferCopy.xml b/doc/classes/BackBufferCopy.xml
index 091bd3fa73..6c44430949 100644
--- a/doc/classes/BackBufferCopy.xml
+++ b/doc/classes/BackBufferCopy.xml
@@ -15,7 +15,7 @@
<return type="int" enum="BackBufferCopy.CopyMode">
</return>
<description>
- Return the copy mode currently applied to the BackBufferCopy (refer to constants section).
+ Return the copy mode currently applied to the BackBufferCopy. See [code]COPY_MODE_*[/code] constants.
</description>
</method>
<method name="get_rect" qualifiers="const">
@@ -31,7 +31,7 @@
<argument index="0" name="copy_mode" type="int" enum="BackBufferCopy.CopyMode">
</argument>
<description>
- Set the copy mode of the BackBufferCopy (refer to constants section).
+ Set the copy mode of the BackBufferCopy. See [code]COPY_MODE_*[/code] constants.
</description>
</method>
<method name="set_rect">
@@ -46,8 +46,10 @@
</methods>
<members>
<member name="copy_mode" type="int" setter="set_copy_mode" getter="get_copy_mode" enum="BackBufferCopy.CopyMode">
+ Buffer mode. See [code]COPY_MODE_*[/code] constants.
</member>
<member name="rect" type="Rect2" setter="set_rect" getter="get_rect">
+ The area covered by the BackBufferCopy. Only used if [code]copy_mode[/code] is [code]COPY_MODE_RECT[/code].
</member>
</members>
<constants>
@@ -55,10 +57,10 @@
Disables the buffering mode. This means the BackBufferCopy node will directly use the portion of screen it covers.
</constant>
<constant name="COPY_MODE_RECT" value="1">
- Sets the copy mode to a region.
+ BackBufferCopy buffers a rectangular region.
</constant>
<constant name="COPY_MODE_VIEWPORT" value="2">
- Sets the copy mode to the entire screen.
+ BackBufferCopy buffers the entire screen.
</constant>
</constants>
</class>
diff --git a/doc/classes/BitMap.xml b/doc/classes/BitMap.xml
index d872d0892d..63e6a5f682 100644
--- a/doc/classes/BitMap.xml
+++ b/doc/classes/BitMap.xml
@@ -77,6 +77,9 @@
</methods>
<members>
<member name="data" type="Dictionary" setter="_set_data" getter="_get_data">
+ Returns a [Dictionary] with two keys :
+ [code]data[/code] : [PoolByteArray] with [code]true[/code]/[code]false[/code] [code]BitMap[/code] data.
+ [code]size[/code] : The [code]Bitmap[/code]'s size.
</member>
</members>
<constants>
diff --git a/doc/classes/Camera.xml b/doc/classes/Camera.xml
index 2302c39e35..068b91204c 100644
--- a/doc/classes/Camera.xml
+++ b/doc/classes/Camera.xml
@@ -15,6 +15,7 @@
<return type="void">
</return>
<description>
+ If this is the current Camera, remove it from being current. If it is inside the node tree, request to make the next Camera current, if any.
</description>
</method>
<method name="get_camera_transform" qualifiers="const">
@@ -28,6 +29,7 @@
<return type="int">
</return>
<description>
+ Returns the culling mask, describing which 3D render layers are rendered by this Camera.
</description>
</method>
<method name="get_doppler_tracking" qualifiers="const">
@@ -40,30 +42,35 @@
<return type="Environment">
</return>
<description>
+ Returns the [Environment] used by this Camera.
</description>
</method>
<method name="get_fov" qualifiers="const">
<return type="float">
</return>
<description>
+ Returns the [i]FOV[/i] Y angle in degrees (FOV means Field of View).
</description>
</method>
<method name="get_h_offset" qualifiers="const">
<return type="float">
</return>
<description>
+ Returns the horizontal (X) offset of the Camera viewport.
</description>
</method>
<method name="get_keep_aspect_mode" qualifiers="const">
<return type="int" enum="Camera.KeepAspect">
</return>
<description>
+ Returns the current mode for keeping the aspect ratio. See [code]KEEP_*[/code] constants.
</description>
</method>
<method name="get_projection" qualifiers="const">
<return type="int" enum="Camera.Projection">
</return>
<description>
+ Returns the Camera's projection. See PROJECTION_* constants.
</description>
</method>
<method name="get_size" qualifiers="const">
@@ -76,25 +83,28 @@
<return type="float">
</return>
<description>
+ Returns the vertical (Y) offset of the Camera viewport.
</description>
</method>
<method name="get_zfar" qualifiers="const">
<return type="float">
</return>
<description>
+ Returns the far clip plane in world space units.
</description>
</method>
<method name="get_znear" qualifiers="const">
<return type="float">
</return>
<description>
+ Returns the near clip plane in world space units.
</description>
</method>
<method name="is_current" qualifiers="const">
<return type="bool">
</return>
<description>
- Return whether the Camera is the current one in the [Viewport], or plans to become current (if outside the scene tree).
+ Returns [code]true[/code] if the Camera is the current one in the [Viewport], or plans to become current (if outside the scene tree).
</description>
</method>
<method name="is_position_behind" qualifiers="const">
@@ -103,6 +113,7 @@
<argument index="0" name="world_point" type="Vector3">
</argument>
<description>
+ Returns [code]true[/code] if the given position is behind the Camera.
</description>
</method>
<method name="make_current">
@@ -126,6 +137,7 @@
<argument index="0" name="screen_point" type="Vector2">
</argument>
<description>
+ Returns how a 2D coordinate in the Viewport rectangle maps to a 3D point in worldspace.
</description>
</method>
<method name="project_ray_normal" qualifiers="const">
@@ -134,7 +146,7 @@
<argument index="0" name="screen_point" type="Vector2">
</argument>
<description>
- Return a normal vector in worldspace, that is the result of projecting a point on the [Viewport] rectangle by the camera projection. This is useful for casting rays in the form of (origin,normal) for object intersection or picking.
+ Returns a normal vector in worldspace, that is the result of projecting a point on the [Viewport] rectangle by the camera projection. This is useful for casting rays in the form of (origin, normal) for object intersection or picking.
</description>
</method>
<method name="project_ray_origin" qualifiers="const">
@@ -143,7 +155,7 @@
<argument index="0" name="screen_point" type="Vector2">
</argument>
<description>
- Return a 3D position in worldspace, that is the result of projecting a point on the [Viewport] rectangle by the camera projection. This is useful for casting rays in the form of (origin,normal) for object intersection or picking.
+ Returns a 3D position in worldspace, that is the result of projecting a point on the [Viewport] rectangle by the camera projection. This is useful for casting rays in the form of (origin, normal) for object intersection or picking.
</description>
</method>
<method name="set_cull_mask">
@@ -152,6 +164,7 @@
<argument index="0" name="mask" type="int">
</argument>
<description>
+ Sets the cull mask, describing which 3D render layers are rendered by this Camera.
</description>
</method>
<method name="set_doppler_tracking">
@@ -160,6 +173,7 @@
<argument index="0" name="mode" type="int" enum="Camera.DopplerTracking">
</argument>
<description>
+ Changes Doppler effect tracking. See [code]DOPPLER_*[/code] constants.
</description>
</method>
<method name="set_environment">
@@ -168,6 +182,7 @@
<argument index="0" name="env" type="Environment">
</argument>
<description>
+ Sets the [Environment] to use for this Camera.
</description>
</method>
<method name="set_h_offset">
@@ -176,6 +191,7 @@
<argument index="0" name="ofs" type="float">
</argument>
<description>
+ Sets the horizontal (X) offset of the Camera viewport.
</description>
</method>
<method name="set_keep_aspect_mode">
@@ -184,6 +200,7 @@
<argument index="0" name="mode" type="int" enum="Camera.KeepAspect">
</argument>
<description>
+ Sets the mode for keeping the aspect ratio. See [code]KEEP_*[/code] constants.
</description>
</method>
<method name="set_orthogonal">
@@ -218,6 +235,7 @@
<argument index="0" name="ofs" type="float">
</argument>
<description>
+ Sets the vertical (Y) offset of the Camera viewport.
</description>
</method>
<method name="unproject_position" qualifiers="const">
@@ -226,7 +244,7 @@
<argument index="0" name="world_point" type="Vector3">
</argument>
<description>
- Return how a 3D point in worldspace maps to a 2D coordinate in the [Viewport] rectangle.
+ Returns how a 3D point in worldspace maps to a 2D coordinate in the [Viewport] rectangle.
</description>
</method>
</methods>
@@ -238,14 +256,19 @@
Orthogonal Projection (objects remain the same size on the screen no matter how far away they are).
</constant>
<constant name="KEEP_WIDTH" value="0">
+ Try to keep the aspect ratio when scaling the Camera's viewport to the screen. If not possible, preserve the viewport's width by changing the height. Height is [code]sizey[/code] for orthographic projection, [code]fovy[/code] for perspective projection.
</constant>
<constant name="KEEP_HEIGHT" value="1">
+ Try to keep the aspect ratio when scaling the Camera's viewport to the screen. If not possible, preserve the viewport's height by changing the width. Width is [code]sizex[/code] for orthographic projection, [code]fovx[/code] for perspective projection.
</constant>
<constant name="DOPPLER_TRACKING_DISABLED" value="0">
+ Disable Doppler effect simulation (default).
</constant>
<constant name="DOPPLER_TRACKING_IDLE_STEP" value="1">
+ Simulate Doppler effect by tracking positions of objects that are changed in [code]_process[/code]. Changes in the relative velocity of this Camera compared to those objects affect how Audio is perceived (changing the Audio's [code]pitch shift[/code]).
</constant>
<constant name="DOPPLER_TRACKING_FIXED_STEP" value="2">
+ Simulate Doppler effect by tracking positions of objects that are changed in [code]_physics_process[/code]. Changes in the relative velocity of this Camera compared to those objects affect how Audio is perceived (changing the Audio's [code]pitch shift[/code]).
</constant>
</constants>
</class>
diff --git a/doc/classes/Camera2D.xml b/doc/classes/Camera2D.xml
index b6b699612e..c627112af5 100644
--- a/doc/classes/Camera2D.xml
+++ b/doc/classes/Camera2D.xml
@@ -5,7 +5,7 @@
</brief_description>
<description>
Camera node for 2D scenes. It forces the screen (current layer) to scroll following this node. This makes it easier (and faster) to program scrollable scenes than manually changing the position of [CanvasItem] based nodes.
- This node is intended to be a simple helper get get things going quickly and it may happen often that more functionality is desired to change how the camera works. To make your own custom camera node, simply inherit from [Node2D] and change the transform of the canvas by calling get_viewport().set_canvas_transform(m) in [Viewport].
+ This node is intended to be a simple helper to get things going quickly and it may happen often that more functionality is desired to change how the camera works. To make your own custom camera node, simply inherit from [Node2D] and change the transform of the canvas by calling get_viewport().set_canvas_transform(m) in [Viewport].
</description>
<tutorials>
</tutorials>
@@ -324,18 +324,24 @@
</methods>
<members>
<member name="anchor_mode" type="int" setter="set_anchor_mode" getter="get_anchor_mode" enum="Camera2D.AnchorMode">
+ The Camera2D's anchor point. See [code]ANCHOR_MODE_*[/code] constants.
</member>
<member name="current" type="bool" setter="_set_current" getter="is_current">
+ If [code]true[/code] this camera is the active camera for the current scene. Only one camera can be current, so setting a different camera [code]current[/code] will disable this one.
</member>
<member name="drag_margin_bottom" type="float" setter="set_drag_margin" getter="get_drag_margin">
+ Bottom margin needed to drag the camera. A value of [code]1[/code] makes the camera move only when reaching the edge of the screen.
</member>
<member name="drag_margin_h_enabled" type="bool" setter="set_h_drag_enabled" getter="is_h_drag_enabled">
</member>
<member name="drag_margin_left" type="float" setter="set_drag_margin" getter="get_drag_margin">
+ Left margin needed to drag the camera. A value of [code]1[/code] makes the camera move only when reaching the edge of the screen.
</member>
<member name="drag_margin_right" type="float" setter="set_drag_margin" getter="get_drag_margin">
+ Right margin needed to drag the camera. A value of [code]1[/code] makes the camera move only when reaching the edge of the screen.
</member>
<member name="drag_margin_top" type="float" setter="set_drag_margin" getter="get_drag_margin">
+ Top margin needed to drag the camera. A value of [code]1[/code] makes the camera move only when reaching the edge of the screen.
</member>
<member name="drag_margin_v_enabled" type="bool" setter="set_v_drag_enabled" getter="is_v_drag_enabled">
</member>
@@ -346,16 +352,21 @@
<member name="editor_draw_screen" type="bool" setter="set_screen_drawing_enabled" getter="is_screen_drawing_enabled">
</member>
<member name="limit_bottom" type="int" setter="set_limit" getter="get_limit">
+ Bottom scroll limit in pixels. The camera stops moving when reaching this value.
</member>
<member name="limit_left" type="int" setter="set_limit" getter="get_limit">
+ Left scroll limit in pixels. The camera stops moving when reaching this value.
</member>
<member name="limit_right" type="int" setter="set_limit" getter="get_limit">
+ Right scroll limit in pixels. The camera stops moving when reaching this value.
</member>
<member name="limit_smoothed" type="bool" setter="set_limit_smoothing_enabled" getter="is_limit_smoothing_enabled">
</member>
<member name="limit_top" type="int" setter="set_limit" getter="get_limit">
+ Top scroll limit in pixels. The camera stops moving when reaching this value.
</member>
<member name="offset" type="Vector2" setter="set_offset" getter="get_offset">
+ The camera's offset, useful for looking around or camera shake animations.
</member>
<member name="rotating" type="bool" setter="set_rotating" getter="is_rotating">
</member>
@@ -364,6 +375,7 @@
<member name="smoothing_speed" type="float" setter="set_follow_smoothing" getter="get_follow_smoothing">
</member>
<member name="zoom" type="Vector2" setter="set_zoom" getter="get_zoom">
+ The camera's zoom relative to the viewport. Values larger than [code]Vector2(1, 1)[/code] zoom out and smaller values zoom in. For an example, use [code]Vector2(0.5, 0.5)[/code] for a 2x zoom in, and [code]Vector2(4, 4)[/code] for a 4x zoom out.
</member>
</members>
<constants>
diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml
index 8fc2ff2bc2..4a9890ea18 100644
--- a/doc/classes/CanvasItem.xml
+++ b/doc/classes/CanvasItem.xml
@@ -172,7 +172,7 @@
</return>
<argument index="0" name="position" type="Vector2">
</argument>
- <argument index="1" name="rot" type="float">
+ <argument index="1" name="rotation" type="float">
</argument>
<argument index="2" name="scale" type="Vector2">
</argument>
diff --git a/doc/classes/CanvasModulate.xml b/doc/classes/CanvasModulate.xml
index f0e3132da5..b4b20e29f9 100644
--- a/doc/classes/CanvasModulate.xml
+++ b/doc/classes/CanvasModulate.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="CanvasModulate" inherits="Node2D" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Tint the entire canvas
+ Tint the entire canvas.
</brief_description>
<description>
- CanvasModulate tints the canvas elements using its assigned color
+ [code]CanvasModulate[/code] tints the canvas elements using its assigned [code]color[/code].
</description>
<tutorials>
</tutorials>
@@ -30,6 +30,7 @@
</methods>
<members>
<member name="color" type="Color" setter="set_color" getter="get_color">
+ The tint color to apply.
</member>
</members>
<constants>
diff --git a/doc/classes/CollisionObject.xml b/doc/classes/CollisionObject.xml
index 98023a5898..64e9e07925 100644
--- a/doc/classes/CollisionObject.xml
+++ b/doc/classes/CollisionObject.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="CollisionObject" inherits="Spatial" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Base node for collision objects.
</brief_description>
<description>
+ CollisionObject is the base class for physics objects. It can hold any number of collision [Shape]\ s. Each shape must be assigned to a [i]shape owner[/i]. The CollisionObject can have any number of shape owners. Shape owners are not nodes and do not appear in the editor, but are accessible through code using the [code]shape_owner_*[/code] methods.
</description>
<tutorials>
</tutorials>
@@ -31,7 +33,7 @@
<argument index="0" name="owner" type="Object">
</argument>
<description>
- Creates new holder for the shapes. Argument is a [CollisionShape] node. It will return owner_id which usually you will want to save for later use.
+ Creates a new shape owner for the given object. Returns [code]owner_id[/code] of the new owner for future reference.
</description>
</method>
<method name="get_capture_input_on_drag" qualifiers="const">
@@ -44,13 +46,14 @@
<return type="RID">
</return>
<description>
+ Returns the object's [RID].
</description>
</method>
<method name="get_shape_owners">
<return type="Array">
</return>
<description>
- Shape owner is a node which is holding concrete shape resources. This method will return an array which is holding an integer numbers that are representing unique ID of each owner. You can use those ids when you are using others shape_owner methods.
+ Returns an [Array] of [code]owner_id[/code] identifiers. You can use these ids in other methods that take [code]owner_id[/code] as an argument.
</description>
</method>
<method name="is_ray_pickable" qualifiers="const">
@@ -65,6 +68,7 @@
<argument index="0" name="owner_id" type="int">
</argument>
<description>
+ If [code]true[/code] the shape owner and its shapes are disabled.
</description>
</method>
<method name="remove_shape_owner">
@@ -73,6 +77,7 @@
<argument index="0" name="owner_id" type="int">
</argument>
<description>
+ Removes the given shape owner.
</description>
</method>
<method name="set_capture_input_on_drag">
@@ -97,6 +102,7 @@
<argument index="0" name="shape_index" type="int">
</argument>
<description>
+ Returns the [code]owner_id[/code] of the given shape.
</description>
</method>
<method name="shape_owner_add_shape">
@@ -107,6 +113,7 @@
<argument index="1" name="shape" type="Shape">
</argument>
<description>
+ Adds a [Shape] to the shape owner.
</description>
</method>
<method name="shape_owner_clear_shapes">
@@ -115,7 +122,7 @@
<argument index="0" name="owner_id" type="int">
</argument>
<description>
- Will remove all the shapes associated with given owner.
+ Removes all shapes from the shape owner.
</description>
</method>
<method name="shape_owner_get_owner" qualifiers="const">
@@ -124,6 +131,7 @@
<argument index="0" name="owner_id" type="int">
</argument>
<description>
+ Returns the parent object of the given shape owner.
</description>
</method>
<method name="shape_owner_get_shape" qualifiers="const">
@@ -134,7 +142,7 @@
<argument index="1" name="shape_id" type="int">
</argument>
<description>
- Will return a [Shape]. First argument owner_id is an integer that can be obtained from [method get_shape_owners]. Shape_id is a position of the shape inside owner; it's a value in range from 0 to [method shape_owner_get_shape_count].
+ Returns the [Shape] with the given id from the given shape owner.
</description>
</method>
<method name="shape_owner_get_shape_count" qualifiers="const">
@@ -143,7 +151,7 @@
<argument index="0" name="owner_id" type="int">
</argument>
<description>
- Returns number of shapes to which given owner is associated to.
+ Returns the number of shapes the given shape owner contains.
</description>
</method>
<method name="shape_owner_get_shape_index" qualifiers="const">
@@ -162,7 +170,7 @@
<argument index="0" name="owner_id" type="int">
</argument>
<description>
- Will return [Transform] of an owner node.
+ Returns the shape owner's [Transform].
</description>
</method>
<method name="shape_owner_remove_shape">
@@ -173,7 +181,7 @@
<argument index="1" name="shape_id" type="int">
</argument>
<description>
- Removes related shape from the owner.
+ Removes a shape from the given shape owner.
</description>
</method>
<method name="shape_owner_set_disabled">
@@ -184,6 +192,7 @@
<argument index="1" name="disabled" type="bool">
</argument>
<description>
+ If [code]true[/code] disables the given shape owner.
</description>
</method>
<method name="shape_owner_set_transform">
@@ -194,6 +203,7 @@
<argument index="1" name="transform" type="Transform">
</argument>
<description>
+ Sets the [Transform] of the given shape owner.
</description>
</method>
</methods>
@@ -220,10 +230,12 @@
</signal>
<signal name="mouse_entered">
<description>
+ Emitted when the mouse pointer enters any of this object's shapes.
</description>
</signal>
<signal name="mouse_exited">
<description>
+ Emitted when the mouse pointer exits all this object's shapes.
</description>
</signal>
</signals>
diff --git a/doc/classes/CollisionObject2D.xml b/doc/classes/CollisionObject2D.xml
index db1412805f..52743bd37d 100644
--- a/doc/classes/CollisionObject2D.xml
+++ b/doc/classes/CollisionObject2D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="CollisionObject2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Base node for 2D collisionables.
+ Base node for 2D collision objects.
</brief_description>
<description>
- CollisionObject2D is the base class for 2D physics collisionables. They can hold any number of 2D collision shapes. Usually, they are edited by placing [CollisionShape2D] and/or [CollisionPolygon2D] nodes as children. Such nodes are for reference and not present outside the editor, so code should use the regular shape API.
+ CollisionObject2D is the base class for 2D physics objects. It can hold any number of 2D collision [Shape2D]\ s. Each shape must be assigned to a [i]shape owner[/i]. The CollisionObject2D can have any number of shape owners. Shape owners are not nodes and do not appear in the editor, but are accessible through code using the [code]shape_owner_*[/code] methods.
</description>
<tutorials>
</tutorials>
@@ -29,21 +29,21 @@
<argument index="0" name="owner" type="Object">
</argument>
<description>
- Creates new holder for the shapes. Argument is a [CollisionShape2D] node. It will return owner_id which usually you will want to save for later use.
+ Creates a new shape owner for the given object. Returns [code]owner_id[/code] of the new owner for future reference.
</description>
</method>
<method name="get_rid" qualifiers="const">
<return type="RID">
</return>
<description>
- Return the RID of this object.
+ Returns the object's [RID].
</description>
</method>
<method name="get_shape_owners">
<return type="Array">
</return>
<description>
- Shape owner is a node which is holding concrete shape resources. This method will return an array which is holding an integer numbers that are representing unique ID of each owner. You can use those ids when you are using others shape_owner methods.
+ Returns an [Array] of [code]owner_id[/code] identifiers. You can use these ids in other methods that take [code]owner_id[/code] as an argument.
</description>
</method>
<method name="is_pickable" qualifiers="const">
@@ -59,6 +59,7 @@
<argument index="0" name="owner_id" type="int">
</argument>
<description>
+ If [code]true[/code] the shape owner and its shapes are disabled.
</description>
</method>
<method name="is_shape_owner_one_way_collision_enabled" qualifiers="const">
@@ -75,6 +76,7 @@
<argument index="0" name="owner_id" type="int">
</argument>
<description>
+ Removes the given shape owner.
</description>
</method>
<method name="set_pickable">
@@ -92,6 +94,7 @@
<argument index="0" name="shape_index" type="int">
</argument>
<description>
+ Returns the [code]owner_id[/code] of the given shape.
</description>
</method>
<method name="shape_owner_add_shape">
@@ -102,6 +105,7 @@
<argument index="1" name="shape" type="Shape2D">
</argument>
<description>
+ Adds a [Shape2D] to the shape owner.
</description>
</method>
<method name="shape_owner_clear_shapes">
@@ -110,7 +114,7 @@
<argument index="0" name="owner_id" type="int">
</argument>
<description>
- Will remove all the shapes associated with given owner.
+ Removes all shapes from the shape owner.
</description>
</method>
<method name="shape_owner_get_owner" qualifiers="const">
@@ -119,6 +123,7 @@
<argument index="0" name="owner_id" type="int">
</argument>
<description>
+ Returns the parent object of the given shape owner.
</description>
</method>
<method name="shape_owner_get_shape" qualifiers="const">
@@ -129,7 +134,7 @@
<argument index="1" name="shape_id" type="int">
</argument>
<description>
- Will return a [Shape2D]. First argument owner_id is an integer that can be obtained from [method get_shape_owners]. Shape_id is a position of the shape inside owner; it's a value in range from 0 to [method shape_owner_get_shape_count].
+ Returns the [Shape2D] with the given id from the given shape owner.
</description>
</method>
<method name="shape_owner_get_shape_count" qualifiers="const">
@@ -138,7 +143,7 @@
<argument index="0" name="owner_id" type="int">
</argument>
<description>
- Returns number of shapes to which given owner is associated to.
+ Returns the number of shapes the given shape owner contains.
</description>
</method>
<method name="shape_owner_get_shape_index" qualifiers="const">
@@ -157,7 +162,7 @@
<argument index="0" name="owner_id" type="int">
</argument>
<description>
- Will return [Transform2D] of an owner node.
+ Returns the shape owner's [Transform2D].
</description>
</method>
<method name="shape_owner_remove_shape">
@@ -168,7 +173,7 @@
<argument index="1" name="shape_id" type="int">
</argument>
<description>
- Removes related shape from the owner.
+ Removes a shape from the given shape owner.
</description>
</method>
<method name="shape_owner_set_disabled">
@@ -179,6 +184,7 @@
<argument index="1" name="disabled" type="bool">
</argument>
<description>
+ If [code]true[/code] disables the given shape owner.
</description>
</method>
<method name="shape_owner_set_one_way_collision">
@@ -199,11 +205,13 @@
<argument index="1" name="transform" type="Transform2D">
</argument>
<description>
+ Sets the [Transform2D] of the given shape owner.
</description>
</method>
</methods>
<members>
<member name="input_pickable" type="bool" setter="set_pickable" getter="is_pickable">
+ If [code]true[/code] this object is pickable. A pickable object can detect the mouse pointer entering/leaving, and if the mouse is inside it, report input events.
</member>
</members>
<signals>
@@ -215,16 +223,17 @@
<argument index="2" name="shape_idx" type="int">
</argument>
<description>
+ Emitted when an input event occurs and [code]input_pickable[/code] is [code]true[/code].
</description>
</signal>
<signal name="mouse_entered">
<description>
- This event fires only once when the mouse pointer enters any shape of this object.
+ Emitted when the mouse pointer enters any of this object's shapes.
</description>
</signal>
<signal name="mouse_exited">
<description>
- This event fires only once when the mouse pointer exits all shapes of this object.
+ Emitted when the mouse pointer exits all this object's shapes.
</description>
</signal>
</signals>
diff --git a/doc/classes/CollisionPolygon2D.xml b/doc/classes/CollisionPolygon2D.xml
index d3dee1e9bb..7f30e8e83e 100644
--- a/doc/classes/CollisionPolygon2D.xml
+++ b/doc/classes/CollisionPolygon2D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="CollisionPolygon2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Editor-only class for defining a collision polygon in 2D space.
+ Defines a 2D collision polygon.
</brief_description>
<description>
- Allows editing a collision polygon's vertices. This class is only available in the editor. It will not appear in the scene tree at runtime. Creates a [Shape2D] for gameplay. Properties modified during gameplay will have no effect.
+ Provides a 2D collision polygon to a [CollisionObject2D] parent. Polygon can be drawn in the editor or specified by a list of vertices.
</description>
<tutorials>
</tutorials>
@@ -75,22 +75,24 @@
</methods>
<members>
<member name="build_mode" type="int" setter="set_build_mode" getter="get_build_mode" enum="CollisionPolygon2D.BuildMode">
- If BUILD_SOLIDS, the polygon and the area within it will have collision. If BUILD_SEGMENTS, only the edges of the polygon will have collision.
+ Collision build mode. Use one of the [code]BUILD_*[/code] constants. Default value: [code]BUILD_SOLIDS[/code].
</member>
<member name="disabled" type="bool" setter="set_disabled" getter="is_disabled">
- If true, no collision will be produced.
+ If [code]true[/code] no collisions will be detected.
</member>
<member name="one_way_collision" type="bool" setter="set_one_way_collision" getter="is_one_way_collision_enabled">
- If true, only edges that face up, relative to CollisionPolygon2D's rotation, will collide with other objects.
+ If [code]true[/code] only edges that face up, relative to CollisionPolygon2D's rotation, will collide with other objects.
</member>
<member name="polygon" type="PoolVector2Array" setter="set_polygon" getter="get_polygon">
- Array of vertices which define the polygon.
+ The polygon's list of vertices. The final point will be connected to the first.
</member>
</members>
<constants>
<constant name="BUILD_SOLIDS" value="0">
+ Collisions will include the polygon and its contained area.
</constant>
<constant name="BUILD_SEGMENTS" value="1">
+ Collisions will only include the polygon edges.
</constant>
</constants>
</class>
diff --git a/doc/classes/ColorRect.xml b/doc/classes/ColorRect.xml
index 90e88603b0..6e70a1e8b7 100644
--- a/doc/classes/ColorRect.xml
+++ b/doc/classes/ColorRect.xml
@@ -38,6 +38,10 @@
</methods>
<members>
<member name="color" type="Color" setter="set_frame_color" getter="get_frame_color">
+ The color to fill the [code]ColorRect[/code].
+ [codeblock]
+ $ColorRect.color = Color(1, 0, 0, 1) # Set ColorRect node's color to red
+ [/codeblock]
</member>
</members>
<constants>
diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml
index 59c3bd30c7..b3bdd1d6c2 100644
--- a/doc/classes/Control.xml
+++ b/doc/classes/Control.xml
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Control" inherits="CanvasItem" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Base node for all User Interface components.
+ All User Interface nodes inherit from Control. Features anchors and margins to adapt its position and size to its parent.
</brief_description>
<description>
- The base class Node for all User Interface components. Every UI node inherits from it. Any scene or portion of a scene tree composed of Control nodes is a User Interface.
- Controls use anchors and margins to place themselves relative to their parent. They adapt automatically when their parent or the screen size changes. To build flexible UIs, use built-in [Container] nodes or create your own.
- Anchors work by defining which margin do they follow, and a value relative to it. Allowed anchoring modes are ANCHOR_BEGIN, where the margin is relative to the top or left margins of the parent (in pixels), ANCHOR_END for the right and bottom margins of the parent and ANCHOR_RATIO, which is a ratio from 0 to 1 in the parent range.
- Godot sends Input events to the root node first, via [method Node._input]. The method distributes it through the node tree and delivers the input events to the node under the mouse cursor or on focus with the keyboard. To do so, it calls [method MainLoop._input_event]. No need to enable [method Node.set_process_input] on Controls to receive input events. Call [method accept_event] to ensure no other node receives the event, not even [method Node._unhandled_input].
- Only the one Control node in focus receives keyboard events. To do so, the Control must get the focus mode with [method set_focus_mode]. It loses focus when another Control gets it, or if the current Control in focus is hidden.
- You'll sometimes want Controls to ignore mouse or touch events. For example, if you place an icon on top of a button. Call [method set_ignore_mouse] for that.
- [Theme] resources change the Control's appearance. If you change the [Theme] on a parent Control node, it will propagate to all of its children. You can override parts of the theme on each Control with the add_*_override methods, like [method add_font_override]. You can also override the theme from the editor.
+ Base class for all User Interface or [i]UI[/i] related nodes. [code]Control[/code] features a bounding rectangle that defines its extents, an anchor position relative to its parent and margins that represent an offset to the anchor. The margins update automatically when the node, any of its parents, or the screen size change.
+ For more information on Godot's UI system, anchors, margins, and containers, see the related tutorials in the manual. To build flexible UIs, you'll need a mix of UI elements that inherit from [code]Control[/code] and [Container] nodes.
+ [b]User Interface nodes and input[/b]
+ Godot sends input events to the scene's root node first, by calling [method Node._input]. [method Node._input] forwards the event down the node tree to the nodes under the mouse cursor, or on keyboard focus. To do so, it calls [method MainLoop._input_event]. Call [method accept_event] so no other node receives the event. Once you accepted an input, it becomes handled so [method Node._unhandled_input] will not process it.
+ Only one [code]Control[/code] node can be in keyboard focus. Only the node in focus will receive keyboard events. To get the foucs, call [method set_focus_mode]. [code]Control[/code] nodes lose focus when another node grabs it, or if you hide the node in focus.
+ Call [method set_ignore_mouse] to tell a [code]Control[/code] node to ignore mouse or touch events. You'll need it if you place an icon on top of a button.
+ [Theme] resources change the Control's appearance. If you change the [Theme] on a [code]Control[/code] node, it affects all of its children. To override some of the theme's parameters, call one of the [code]add_*_override[/code] methods, like [method add_font_override]. You can override the theme with the inspector.
</description>
<tutorials>
</tutorials>
@@ -21,7 +21,7 @@
<return type="Vector2">
</return>
<description>
- Returns the minimum size this Control can shrink to. A control will never be displayed or resized smaller than its minimum size.
+ Returns the minimum size this Control can shrink to. The node can never be smaller than this minimum size.
</description>
</method>
<method name="_gui_input" qualifiers="virtual">
@@ -30,13 +30,15 @@
<argument index="0" name="event" type="InputEvent">
</argument>
<description>
+ The node's parent forwards input events to this method. Use it to process and accept inputs on UI elements. See [method accept_event].
+ Replaces Godot 2's [code]_input_event[/code].
</description>
</method>
<method name="accept_event">
<return type="void">
</return>
<description>
- Marks the input event as handled. No other Control will receive it, and the input event will not propagate. Not even to nodes listening to [method Node._unhandled_input] or [method Node._unhandled_key_input].
+ Marks an input event as handled. Once you accept an input event, it stops propagating, even to nodes listening to [method Node._unhandled_input] or [method Node._unhandled_key_input].
</description>
</method>
<method name="add_color_override">
@@ -47,6 +49,7 @@
<argument index="1" name="color" type="Color">
</argument>
<description>
+ Overrides the color in the [theme] resource the node uses.
</description>
</method>
<method name="add_constant_override">
@@ -57,7 +60,7 @@
<argument index="1" name="constant" type="int">
</argument>
<description>
- Override a single constant (integer) in the theme of this Control. If constant equals Theme.INVALID_CONSTANT, override is cleared.
+ Overrides an integer constant in the [theme] resource the node uses. If the [code]constant[code] is invalid, Godot clears the override. See [member Theme.INVALID_CONSTANT] for more information.
</description>
</method>
<method name="add_font_override">
@@ -68,7 +71,7 @@
<argument index="1" name="font" type="Font">
</argument>
<description>
- Override a single font (font) in the theme of this Control. If font is empty, override is cleared.
+ Overrides the [code]name[/code] font in the [theme] resource the node uses. If [code]font[/code] is empty, Godot clears the override.
</description>
</method>
<method name="add_icon_override">
@@ -79,7 +82,7 @@
<argument index="1" name="texture" type="Texture">
</argument>
<description>
- Override a single icon ([Texture]) in the theme of this Control. If texture is empty, override is cleared.
+ Overrides the [code]name[/code] icon in the [theme] resource the node uses. If [code]icon[/code] is empty, Godot clears the override.
</description>
</method>
<method name="add_shader_override">
@@ -90,6 +93,7 @@
<argument index="1" name="shader" type="Shader">
</argument>
<description>
+ Overrides the [code]name[/code] shader in the [theme] resource the node uses. If [code]shader[/code] is empty, Godot clears the override.
</description>
</method>
<method name="add_style_override">
@@ -100,7 +104,7 @@
<argument index="1" name="stylebox" type="StyleBox">
</argument>
<description>
- Override a single stylebox ([Stylebox]) in the theme of this Control. If stylebox is empty, override is cleared.
+ Overrides the [code]name[/code] [Stylebox] in the [theme] resource the node uses. If [code]stylebox[/code] is empty, Godot clears the override.
</description>
</method>
<method name="can_drop_data" qualifiers="virtual">
@@ -180,7 +184,7 @@
<argument index="0" name="position" type="Vector2" default="Vector2( 0, 0 )">
</argument>
<description>
- Return the cursor shape at a certain position in the control.
+ Returns the mouse cursor shape the control displays on mouse hover, one of the [code]CURSOR_*[/code] constants.
</description>
</method>
<method name="get_custom_minimum_size" qualifiers="const">
@@ -193,7 +197,7 @@
<return type="int" enum="Control.CursorShape">
</return>
<description>
- Return the default cursor shape for this control. See enum CURSOR_* for the list of shapes.
+ Returns the default cursor shape for this control. See enum [code]CURSOR_*[/code] for the list of shapes.
</description>
</method>
<method name="get_drag_data" qualifiers="virtual">
@@ -624,7 +628,7 @@
<argument index="0" name="shape" type="int" enum="Control.CursorShape">
</argument>
<description>
- Set the default cursor shape for this control. See enum CURSOR_* for the list of shapes.
+ Sets the default cursor shape for this control. See [code]CURSOR_*[/code] for the list of available cursor shapes. Useful for Godot plugins and applications or games that use the system's mouse cursors.
</description>
</method>
<method name="set_drag_forwarding">
@@ -785,7 +789,7 @@
<argument index="0" name="theme" type="Theme">
</argument>
<description>
- Override whole the [Theme] for this Control and all its children controls.
+ Overrides the whole [Theme] for this node and all its [code]Control[/code] children.
</description>
</method>
<method name="set_tooltip">
@@ -794,7 +798,7 @@
<argument index="0" name="tooltip" type="String">
</argument>
<description>
- Set a tooltip, which will appear when the cursor is resting over this control.
+ Changes the tooltip text. The tooltip appears when the user's mouse cursor stays idle over this control for a few moments.
</description>
</method>
<method name="set_v_grow_direction">
@@ -834,58 +838,83 @@
</methods>
<members>
<member name="anchor_bottom" type="float" setter="_set_anchor" getter="get_anchor">
+ Anchors the bottom edge of the node to the origin, the center, or the end of its parent container. It changes how the bottom margin updates when the node moves or changes size. Use one of the [code]ANCHOR_*[/code] constants. Default value: [code]ANCHOR_BEGIN[/code].
</member>
<member name="anchor_left" type="float" setter="_set_anchor" getter="get_anchor">
+ Anchors the left edge of the node to the origin, the center or the end of its parent container. It changes how the left margin updates when the node moves or changes size. Use one of the [code]ANCHOR_*[/code] constants. Default value: [code]ANCHOR_BEGIN[/code].
</member>
<member name="anchor_right" type="float" setter="_set_anchor" getter="get_anchor">
+ Anchors the right edge of the node to the origin, the center or the end of its parent container. It changes how the right margin updates when the node moves or changes size. Use one of the [code]ANCHOR_*[/code] constants. Default value: [code]ANCHOR_BEGIN[/code].
</member>
<member name="anchor_top" type="float" setter="_set_anchor" getter="get_anchor">
+ Anchors the top edge of the node to the origin, the center or the end of its parent container. It changes how the top margin updates when the node moves or changes size. Use one of the [code]ANCHOR_*[/code] constants. Default value: [code]ANCHOR_BEGIN[/code].
</member>
<member name="focus_neighbour_bottom" type="NodePath" setter="set_focus_neighbour" getter="get_focus_neighbour">
+ Tells Godot which node it should give keyboard focus to if the user presses Tab, the down arrow on the keyboard, or down on a gamepad. The node must be a [code]Control[/code]. If this property is not set, Godot will give focus to the closest [code]Control[/code] to the bottom of this one.
+ If the user presses Tab, Godot will give focus to the closest node to the right first, then to the bottom. If the user presses Shift+Tab, Godot will look to the left of the node, then above it.
</member>
<member name="focus_neighbour_left" type="NodePath" setter="set_focus_neighbour" getter="get_focus_neighbour">
+ Tells Godot which node it should give keyboard focus to if the user presses Shift+Tab, the left arrow on the keyboard or left on a gamepad. The node must be a [code]Control[/code]. If this property is not set, Godot will give focus to the closest [code]Control[/code] to the left of this one.
</member>
<member name="focus_neighbour_right" type="NodePath" setter="set_focus_neighbour" getter="get_focus_neighbour">
+ Tells Godot which node it should give keyboard focus to if the user presses Tab, the right arrow on the keyboard or right on a gamepad. The node must be a [code]Control[/code]. If this property is not set, Godot will give focus to the closest [code]Control[/code] to the bottom of this one.
</member>
<member name="focus_neighbour_top" type="NodePath" setter="set_focus_neighbour" getter="get_focus_neighbour">
+ Tells Godot which node it should give keyboard focus to if the user presses Shift+Tab, the top arrow on the keyboard or top on a gamepad. The node must be a [code]Control[/code]. If this property is not set, Godot will give focus to the closest [code]Control[/code] to the bottom of this one.
</member>
<member name="grow_horizontal" type="int" setter="set_h_grow_direction" getter="get_h_grow_direction" enum="Control.GrowDirection">
</member>
<member name="grow_vertical" type="int" setter="set_v_grow_direction" getter="get_v_grow_direction" enum="Control.GrowDirection">
</member>
<member name="hint_tooltip" type="String" setter="set_tooltip" getter="_get_tooltip">
+ Changes the tooltip text. The tooltip appears when the user's mouse cursor stays idle over this control for a few moments.
</member>
<member name="margin_bottom" type="float" setter="set_margin" getter="get_margin">
+ Distance between the node's bottom edge and its parent container, based on [member anchor_bottom].
+ Margins are often controlled by one or multiple parent [Container] nodes. Margins update automatically when you move or resize the node.
</member>
<member name="margin_left" type="float" setter="set_margin" getter="get_margin">
+ Distance between the node's left edge and its parent container, based on [member anchor_left].
</member>
<member name="margin_right" type="float" setter="set_margin" getter="get_margin">
+ Distance between the node's right edge and its parent container, based on [member anchor_right].
</member>
<member name="margin_top" type="float" setter="set_margin" getter="get_margin">
+ Distance between the node's top edge and its parent container, based on [member anchor_top].
</member>
<member name="mouse_filter" type="int" setter="set_mouse_filter" getter="get_mouse_filter" enum="Control.MouseFilter">
</member>
<member name="rect_clip_content" type="bool" setter="set_clip_contents" getter="is_clipping_contents">
</member>
<member name="rect_min_size" type="Vector2" setter="set_custom_minimum_size" getter="get_custom_minimum_size">
+ The minimum size of the node's bounding rectangle. If you set it to a value greater than (0, 0), the node's bounding rectangle will always have at least this size, even if its content is smaller. If it's set to (0, 0), the node sizes automatically to fit its content, be it a texture or child nodes.
</member>
<member name="rect_pivot_offset" type="Vector2" setter="set_pivot_offset" getter="get_pivot_offset">
+ By default, the node's pivot is its top-left corner. When you change its [member rect_scale], it will scale around this pivot. Set this property to [member rect_size] / 2 to center the pivot in the node's rectangle.
</member>
<member name="rect_position" type="Vector2" setter="set_position" getter="get_position">
+ The node's position, relative to its parent. It corresponds to the rectangle's top-left corner. The property is not affected by [member rect_pivot_offset].
</member>
<member name="rect_rotation" type="float" setter="set_rotation_deg" getter="get_rotation_deg">
+ The node's rotation around its pivot, in degrees. See [member rect_pivot_offset] to change the pivot's position.
</member>
<member name="rect_scale" type="Vector2" setter="set_scale" getter="get_scale">
+ The node's scale, relative to its [member rect_size]. Change this property to scale the node around its [member rect_pivot_offset].
</member>
<member name="rect_size" type="Vector2" setter="set_size" getter="get_size">
+ The size of the node's bounding rectangle, in pixels. [Container] nodes update this property automatically.
</member>
<member name="size_flags_horizontal" type="int" setter="set_h_size_flags" getter="get_h_size_flags">
+ Tells the parent [Container] nodes how they should resize and place the node on the X axis. Use one of the [code]SIZE_*[/code] constants to change the flags. See the constants to learn what each does.
</member>
<member name="size_flags_stretch_ratio" type="float" setter="set_stretch_ratio" getter="get_stretch_ratio">
+ If the node and at least one of its neighbours uses the [code]SIZE_EXPAND[/code] size flag, the parent [Container] will let it take more or less space depending on this property. If this node has a stretch ratio of 2 and its neighbour a ratio of 1, this node will take two thirds of the available space.
</member>
<member name="size_flags_vertical" type="int" setter="set_v_size_flags" getter="get_v_size_flags">
+ Tells the parent [Container] nodes how they should resize and place the node on the Y axis. Use one of the [code]SIZE_*[/code] constants to change the flags. See the constants to learn what each does.
</member>
<member name="theme" type="Theme" setter="set_theme" getter="get_theme">
+ Changing this property replaces the current [Theme] resource this node and all its [code]Control[/code] children use.
</member>
</members>
<signals>
@@ -903,6 +932,7 @@
<argument index="0" name="ev" type="Object">
</argument>
<description>
+ Emitted when the node receives an [InputEvent].
</description>
</signal>
<signal name="minimum_size_changed">
@@ -912,16 +942,17 @@
</signal>
<signal name="modal_closed">
<description>
+ Emitted when a modal [code]Control[/code] is closed. See [method show_modal].
</description>
</signal>
<signal name="mouse_entered">
<description>
- Emitted when the mouse enters the control's area.
+ Emitted when the mouse enters the control's [code]Rect[/code] area.
</description>
</signal>
<signal name="mouse_exited">
<description>
- Emitted when the mouse leaves the control's area.
+ Emitted when the mouse leaves the control's [code]Rect[/code] area.
</description>
</signal>
<signal name="resized">
@@ -931,116 +962,154 @@
</signal>
<signal name="size_flags_changed">
<description>
- Emitted when the size flags change.
+ Emitted when one of the size flags changes. See [member size_flags_horizontal] and [member size_flags_vertical].
</description>
</signal>
</signals>
<constants>
<constant name="FOCUS_NONE" value="0">
- Control can't acquire focus.
+ The node cannot grab focus. Use with [member set_focus_mode].
</constant>
<constant name="FOCUS_CLICK" value="1">
- Control can acquire focus only if clicked.
+ The node can only grab focus on mouse clicks. Use with [member set_focus_mode].
</constant>
<constant name="FOCUS_ALL" value="2">
- Control can acquire focus if clicked, or by pressing TAB/Directionals in the keyboard from another Control.
+ The node can grab focus on mouse click or using the arrows and the Tab keys on the keyboard. Use with [member set_focus_mode].
</constant>
<constant name="NOTIFICATION_RESIZED" value="40" enum="">
- Control changed size (get_size() reports the new size).
+ Sent when the node changes size. Use [member rect_size] to get the new size.
</constant>
<constant name="NOTIFICATION_MOUSE_ENTER" value="41" enum="">
- Mouse pointer entered the area of the Control.
+ Sent when the mouse pointer enters the node's [code]Rect[/code] area.
</constant>
<constant name="NOTIFICATION_MOUSE_EXIT" value="42" enum="">
- Mouse pointer exited the area of the Control.
+ Sent when the mouse pointer exits the node's [code]Rect[/code] area.
</constant>
<constant name="NOTIFICATION_FOCUS_ENTER" value="43" enum="">
- Control gained focus.
+ Sent when the node grabs focus.
</constant>
<constant name="NOTIFICATION_FOCUS_EXIT" value="44" enum="">
- Control lost focus.
+ Sent when the node loses focus.
</constant>
<constant name="NOTIFICATION_THEME_CHANGED" value="45" enum="">
- Theme changed. Redrawing is desired.
+ Sent when the node's [member theme] changes, right before Godot redraws the [code]Control[/code]. Happens when you call one of the [code]add_*_override[/code]
</constant>
<constant name="NOTIFICATION_MODAL_CLOSE" value="46" enum="">
- Modal control was closed.
+ Sent when an open modal dialog closes. See [member show_modal].
</constant>
<constant name="CURSOR_ARROW" value="0">
+ Show the system's arrow mouse cursor when the user hovers the node. Use with [method set_default_cursor_shape].
</constant>
<constant name="CURSOR_IBEAM" value="1">
+ Show the system's I-beam mouse cursor when the user hovers the node. The I-beam pointer has a shape similar to "I". It tells the user they can highlight or insert text.
</constant>
<constant name="CURSOR_POINTING_HAND" value="2">
+ Show the system's pointing hand mouse cursor when the user hovers the node.
</constant>
<constant name="CURSOR_CROSS" value="3">
+ Show the system's cross mouse cursor when the user hovers the node.
</constant>
<constant name="CURSOR_WAIT" value="4">
+ Show the system's wait mouse cursor, often an hourglass, when the user hovers the node.
</constant>
<constant name="CURSOR_BUSY" value="5">
+ Show the system's busy mouse cursor when the user hovers the node. Often an hourglass.
</constant>
<constant name="CURSOR_DRAG" value="6">
+ Show the system's drag mouse cursor, often a closed fist or a cross symbol, when the user hovers the node. It tells the user they're currently dragging an item, like a node in the Scene dock.
</constant>
<constant name="CURSOR_CAN_DROP" value="7">
+ Show the system's drop mouse cursor when the user hovers the node. It can be an open hand. It tells the user they can drop an item they're currently grabbing, like a node in the Scene dock.
</constant>
<constant name="CURSOR_FORBIDDEN" value="8">
+ Show the system's forbidden mouse cursor when the user hovers the node. Often a crossed circle.
</constant>
<constant name="CURSOR_VSIZE" value="9">
+ Show the system's vertical resize mouse cursor when the user hovers the node. A double headed vertical arrow. It tells the user they can resize the window or the panel vertically.
</constant>
<constant name="CURSOR_HSIZE" value="10">
+ Show the system's horizontal resize mouse cursor when the user hovers the node. A double headed horizontal arrow. It tells the user they can resize the window or the panel horizontally.
</constant>
<constant name="CURSOR_BDIAGSIZE" value="11">
+ Show the system's window resize mouse cursor when the user hovers the node. The cursor is a double headed arrow that goes from the bottom left to the top right. It tells the user they can resize the window or the panel both horizontally and vertically.
</constant>
<constant name="CURSOR_FDIAGSIZE" value="12">
+ Show the system's window resize mouse cursor when the user hovers the node. The cursor is a double headed arrow that goes from the top left to the bottom right, the opposite of [code]CURSOR_BDIAGSIZE[/code]. It tells the user they can resize the window or the panel both horizontally and vertically.
</constant>
<constant name="CURSOR_MOVE" value="13">
+ Show the system's move mouse cursor when the user hovers the node. It shows 2 double-headed arrows at a 90 degree angle. It tells the user they can move a UI element freely.
</constant>
<constant name="CURSOR_VSPLIT" value="14">
+ Show the system's vertical split mouse cursor when the user hovers the node. On Windows, it's the same as [code]CURSOR_VSIZE[/code].
</constant>
<constant name="CURSOR_HSPLIT" value="15">
+ Show the system's horizontal split mouse cursor when the user hovers the node. On Windows, it's the same as [code]CURSOR_HSIZE[/code].
</constant>
<constant name="CURSOR_HELP" value="16">
+ Show the system's help mouse cursor when the user hovers the node, a question mark.
</constant>
<constant name="PRESET_TOP_LEFT" value="0">
+ Snap all 4 anchors to the top-left of the parent container's bounds. Use with [method set_anchors_preset].
</constant>
<constant name="PRESET_TOP_RIGHT" value="1">
+ Snap all 4 anchors to the top-right of the parent container's bounds. Use with [method set_anchors_preset].
</constant>
<constant name="PRESET_BOTTOM_LEFT" value="2">
+ Snap all 4 anchors to the bottom-left of the parent container's bounds. Use with [method set_anchors_preset].
</constant>
<constant name="PRESET_BOTTOM_RIGHT" value="3">
+ Snap all 4 anchors to the bottom-right of the parent container's bounds. Use with [method set_anchors_preset].
</constant>
<constant name="PRESET_CENTER_LEFT" value="4">
+ Snap all 4 anchors to the center of the left edge of the parent container's bounds. Use with [method set_anchors_preset].
</constant>
<constant name="PRESET_CENTER_TOP" value="5">
+ Snap all 4 anchors to the center of the top edge of the parent container's bounds. Use with [method set_anchors_preset].
</constant>
<constant name="PRESET_CENTER_RIGHT" value="6">
+ Snap all 4 anchors to the center of the right edge of the parent container's bounds. Use with [method set_anchors_preset].
</constant>
<constant name="PRESET_CENTER_BOTTOM" value="7">
+ Snap all 4 anchors to the center of the bottom edge of the parent container's bounds. Use with [method set_anchors_preset].
</constant>
<constant name="PRESET_CENTER" value="8">
+ Snap all 4 anchors to the center of the parent container's bounds. Use with [method set_anchors_preset].
</constant>
<constant name="PRESET_LEFT_WIDE" value="9">
+ Snap all 4 anchors to the left edge of the parent container. The left margin becomes relative to the left edge and the top margin relative to the top left corner of the node's parent. Use with [method set_anchors_preset].
</constant>
<constant name="PRESET_TOP_WIDE" value="10">
+ Snap all 4 anchors to the top edge of the parent container. The left margin becomes relative to the top left corner, the top margin relative to the top edge, and the right margin relative to the top right corner of the node's parent. Use with [method set_anchors_preset].
</constant>
<constant name="PRESET_RIGHT_WIDE" value="11">
+ Snap all 4 anchors to the right edge of the parent container. The right margin becomes relative to the right edge and the top margin relative to the top right corner of the node's parent. Use with [method set_anchors_preset].
</constant>
<constant name="PRESET_BOTTOM_WIDE" value="12">
+ Snap all 4 anchors to the bottom edge of the parent container. The left margin becomes relative to the bottom left corner, the bottom margin relative to the bottom edge, and the right margin relative to the bottom right corner of the node's parent. Use with [method set_anchors_preset].
</constant>
<constant name="PRESET_VCENTER_WIDE" value="13">
+ Snap all 4 anchors to a vertical line that cuts the parent container in half. Use with [method set_anchors_preset].
</constant>
<constant name="PRESET_HCENTER_WIDE" value="14">
+ Snap all 4 anchors to a horizontal line that cuts the parent container in half. Use with [method set_anchors_preset].
</constant>
<constant name="PRESET_WIDE" value="15">
+ Snap all 4 anchors to the respective corners of the parent container. Set all 4 margins to 0 after you applied this preset and the [code]Control[/code] will fit its parent container. Use with [method set_anchors_preset].
</constant>
<constant name="SIZE_EXPAND" value="2">
+ Tells the parent [Container] to let this node take all the available space on the axis you flag. If multiple neighboring nodes are set to expand, they'll share the space based on their stretch ratio. See [member size_flags_stretch_ratio]. Use with [member size_flags_horizontal] and [member size_flags_vertical].
</constant>
<constant name="SIZE_FILL" value="1">
+ Tells the parent [Container] to expand the bounds of this node to fill all the available space without pushing any other node. Use with [member size_flags_horizontal] and [member size_flags_vertical].
</constant>
<constant name="SIZE_EXPAND_FILL" value="3">
+ Sets the node's size flags to both fill and expand. See the 2 constants above for more information.
</constant>
<constant name="SIZE_SHRINK_CENTER" value="4">
+ Tells the parent [Container] to center the node in itself. It centers the [code]Control[/code] based on its bounding box, so it doesn't work with the fill or expand size flags. Use with [member size_flags_horizontal] and [member size_flags_vertical].
</constant>
<constant name="SIZE_SHRINK_END" value="8">
+ Tells the parent [Container] to align the node with its end, either the bottom or the right edge. It doesn't work with the fill or expand size flags. Use with [member size_flags_horizontal] and [member size_flags_vertical].
</constant>
<constant name="MOUSE_FILTER_STOP" value="0">
</constant>
@@ -1053,10 +1122,10 @@
<constant name="GROW_DIRECTION_END" value="1">
</constant>
<constant name="ANCHOR_BEGIN" value="0">
- X is relative to MARGIN_LEFT, Y is relative to MARGIN_TOP.
+ Snaps one of the 4 anchor's sides to the origin of the node's [code]Rect[/code], in the top left. Use it with one of the [code]anchor_*[/code] member variables, like [member anchor_left]. To change all 4 anchors at once, use [method set_anchors_preset].
</constant>
<constant name="ANCHOR_END" value="1">
- X is relative to -MARGIN_RIGHT, Y is relative to -MARGIN_BOTTOM.
+ Snaps one of the 4 anchor's sides to the end of the node's [code]Rect[/code], in the bottom right. Use it with one of the [code]anchor_*[/code] member variables, like [member anchor_left]. To change all 4 anchors at once, use [method set_anchors_preset].
</constant>
</constants>
</class>
diff --git a/doc/classes/ConvexPolygonShape.xml b/doc/classes/ConvexPolygonShape.xml
index 9a7cb0d475..822b99547e 100644
--- a/doc/classes/ConvexPolygonShape.xml
+++ b/doc/classes/ConvexPolygonShape.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="ConvexPolygonShape" inherits="Shape" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Convex Polygon Shape.
+ Convex polygon shape for 3D physics.
</brief_description>
<description>
- Convex polygon shape resource, which can be set into a [PhysicsBody] or area.
+ Convex polygon shape resource, which can be added to a [PhysicsBody] or area.
</description>
<tutorials>
</tutorials>
@@ -28,6 +28,7 @@
</methods>
<members>
<member name="points" type="PoolVector3Array" setter="set_points" getter="get_points">
+ The list of 3D points forming the convex polygon shape.
</member>
</members>
<constants>
diff --git a/doc/classes/ConvexPolygonShape2D.xml b/doc/classes/ConvexPolygonShape2D.xml
index c5b6d90041..0cb4f4045b 100644
--- a/doc/classes/ConvexPolygonShape2D.xml
+++ b/doc/classes/ConvexPolygonShape2D.xml
@@ -16,7 +16,7 @@
<return type="PoolVector2Array">
</return>
<description>
- Return a list of points in either clockwise or counter clockwise order, forming a convex polygon.
+ Returns a list of points in either clockwise or counter clockwise order, forming a convex polygon.
</description>
</method>
<method name="set_point_cloud">
@@ -34,12 +34,13 @@
<argument index="0" name="points" type="PoolVector2Array">
</argument>
<description>
- Set a list of points in either clockwise or counter clockwise order, forming a convex polygon.
+ Sets a list of points in either clockwise or counter clockwise order, forming a convex polygon.
</description>
</method>
</methods>
<members>
<member name="points" type="PoolVector2Array" setter="set_points" getter="get_points">
+ The polygon's list of vertices. Can be in either clockwise or counterclockwise order.
</member>
</members>
<constants>
diff --git a/doc/classes/Directory.xml b/doc/classes/Directory.xml
index ee0b873084..c3c4c7a8ac 100644
--- a/doc/classes/Directory.xml
+++ b/doc/classes/Directory.xml
@@ -85,6 +85,7 @@
<return type="int">
</return>
<description>
+ Returns the currently opened directory's drive index. See [method get_drive] to convert returned index to the name of the drive.
</description>
</method>
<method name="get_drive">
diff --git a/doc/classes/EditorResourceConversionPlugin.xml b/doc/classes/EditorResourceConversionPlugin.xml
new file mode 100644
index 0000000000..e165ae376b
--- /dev/null
+++ b/doc/classes/EditorResourceConversionPlugin.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="EditorResourceConversionPlugin" inherits="Reference" category="Core" version="3.0.alpha.custom_build">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="_convert" qualifiers="virtual">
+ <return type="Resource">
+ </return>
+ <argument index="0" name="resource" type="Resource">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="_converts_to" qualifiers="virtual">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/doc/classes/EditorResourcePreview.xml b/doc/classes/EditorResourcePreview.xml
index e530557a23..acf36b6a08 100644
--- a/doc/classes/EditorResourcePreview.xml
+++ b/doc/classes/EditorResourcePreview.xml
@@ -41,7 +41,7 @@
<argument index="3" name="userdata" type="Variant">
</argument>
<description>
- Queue a resource being edited for preview (using an instance). Once the preview is ready, your receiver.receiver_func will be called either containing the preview texture or an empty texure (if no preview was possible). Callback must have the format: (path,texture,userdata). Userdata can be anything.
+ Queue a resource being edited for preview (using an instance). Once the preview is ready, your receiver.receiver_func will be called either containing the preview texture or an empty texture (if no preview was possible). Callback must have the format: (path,texture,userdata). Userdata can be anything.
</description>
</method>
<method name="queue_resource_preview">
@@ -56,7 +56,7 @@
<argument index="3" name="userdata" type="Variant">
</argument>
<description>
- Queue a resource file for preview (using a path). Once the preview is ready, your receiver.receiver_func will be called either containing the preview texture or an empty texure (if no preview was possible). Callback must have the format: (path,texture,userdata). Userdata can be anything.
+ Queue a resource file for preview (using a path). Once the preview is ready, your receiver.receiver_func will be called either containing the preview texture or an empty texture (if no preview was possible). Callback must have the format: (path,texture,userdata). Userdata can be anything.
</description>
</method>
<method name="remove_preview_generator">
diff --git a/doc/classes/EditorSpatialGizmo.xml b/doc/classes/EditorSpatialGizmo.xml
index de9ea5282a..baab995fab 100644
--- a/doc/classes/EditorSpatialGizmo.xml
+++ b/doc/classes/EditorSpatialGizmo.xml
@@ -24,6 +24,8 @@
</return>
<argument index="0" name="triangles" type="TriangleMesh">
</argument>
+ <argument index="1" name="bounds" type="Rect3">
+ </argument>
<description>
Add collision triangles to the gizmo for picking. A [TriangleMesh] can be generated from a regular [Mesh] too. Call this function during [method redraw].
</description>
diff --git a/doc/classes/Engine.xml b/doc/classes/Engine.xml
index 2372c619f5..5bb0810296 100644
--- a/doc/classes/Engine.xml
+++ b/doc/classes/Engine.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Engine" inherits="Object" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Access to basic engine properties.
</brief_description>
<description>
+ The [Engine] class allows you to query and modify the game's run-time parameters, such as frames per second, time scale, and others.
</description>
<tutorials>
</tutorials>
@@ -13,7 +15,7 @@
<return type="int">
</return>
<description>
- Return the total amount of frames drawn.
+ Returns the total number of frames drawn.
</description>
</method>
<method name="get_frames_per_second" qualifiers="const">
@@ -27,26 +29,28 @@
<return type="int">
</return>
<description>
- Return the amount of fixed iterations per second (for fixed process and physics).
+ Returns the number of fixed iterations per second (for fixed process and physics).
</description>
</method>
<method name="get_main_loop" qualifiers="const">
<return type="MainLoop">
</return>
<description>
- Return the main loop object (see [MainLoop] and [SceneTree]).
+ Returns the main loop object (see [MainLoop] and [SceneTree]).
</description>
</method>
<method name="get_target_fps" qualifiers="const">
<return type="float">
</return>
<description>
+ Returns the desired frames per second. If the hardware cannot keep up, this setting may not be respected. It defaults to 0, which indicates no limit.
</description>
</method>
<method name="get_time_scale">
<return type="float">
</return>
<description>
+ Returns how fast or slow the in-game clock ticks versus the real life one. It defaults to 1.0. A value of 2.0 means the game moves twice as fast as real life, whilst a value of 0.5 means the game moves at half the regular speed.
</description>
</method>
<method name="get_version_info" qualifiers="const">
@@ -67,12 +71,14 @@
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if the editor is running.
</description>
</method>
- <method name="is_in_fixed_frame" qualifiers="const">
+ <method name="is_in_physics_frame" qualifiers="const">
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if the game is inside the fixed process and physics phase of the game loop.
</description>
</method>
<method name="set_editor_hint">
@@ -81,6 +87,7 @@
<argument index="0" name="enabled" type="bool">
</argument>
<description>
+ Sets the running inside the editor hint if [code]enabled[/code] is [code]true[/code].
</description>
</method>
<method name="set_iterations_per_second">
@@ -89,7 +96,7 @@
<argument index="0" name="iterations_per_second" type="int">
</argument>
<description>
- Set the amount of fixed iterations per second (for fixed process and physics).
+ Sets the number of fixed iterations per second (for fixed process and physics).
</description>
</method>
<method name="set_target_fps">
@@ -98,6 +105,7 @@
<argument index="0" name="target_fps" type="int">
</argument>
<description>
+ Sets the target frames per second.
</description>
</method>
<method name="set_time_scale">
@@ -106,6 +114,7 @@
<argument index="0" name="time_scale" type="float">
</argument>
<description>
+ Sets the time scale.
</description>
</method>
</methods>
diff --git a/doc/classes/Environment.xml b/doc/classes/Environment.xml
index 4338b188a6..3880c45a86 100644
--- a/doc/classes/Environment.xml
+++ b/doc/classes/Environment.xml
@@ -1,8 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Environment" inherits="Resource" category="Core" version="3.0.alpha.custom_build">
+<class name="Environment" inherits="Resource" category="Core" version="3.0">
<brief_description>
+ Resource for environment nodes (like [WorldEnvironment]) that define multiple rendering options.
</brief_description>
<description>
+ Resource for environment nodes (like [WorldEnvironment]) that define multiple environment operations (such as background [Sky] or [Color], ambient light, fog, depth-of-field...). These parameters affect the final render of the scene. The order of these operations is:
+ - DOF Blur
+ - Motion Blur
+ - Bloom
+ - Tonemap (auto exposure)
+ - Adjustments
</description>
<tutorials>
</tutorials>
@@ -982,118 +989,174 @@
</methods>
<members>
<member name="adjustment_brightness" type="float" setter="set_adjustment_brightness" getter="get_adjustment_brightness">
+ Global brightness value of the rendered scene (default value is 1).
</member>
<member name="adjustment_color_correction" type="Texture" setter="set_adjustment_color_correction" getter="get_adjustment_color_correction">
+ Applies the provided [Texture] resource to affect the global color aspect of the rendered scene.
</member>
<member name="adjustment_contrast" type="float" setter="set_adjustment_contrast" getter="get_adjustment_contrast">
+ Global contrast value of the rendered scene (default value is 1).
</member>
<member name="adjustment_enabled" type="bool" setter="set_adjustment_enable" getter="is_adjustment_enabled">
+ Enables the adjustment_* options provided by this resource. If false, adjustments modifications will have no effect on the rendered scene.
</member>
<member name="adjustment_saturation" type="float" setter="set_adjustment_saturation" getter="get_adjustment_saturation">
+ Global color saturation value of the rendered scene (default value is 1).
</member>
<member name="ambient_light_color" type="Color" setter="set_ambient_light_color" getter="get_ambient_light_color">
+ [Color] of the ambient light.
</member>
<member name="ambient_light_energy" type="float" setter="set_ambient_light_energy" getter="get_ambient_light_energy">
+ Energy of the ambient light. The higher the value, the stronger the light.
</member>
<member name="ambient_light_sky_contribution" type="float" setter="set_ambient_light_sky_contribution" getter="get_ambient_light_sky_contribution">
+ Defines the amount of light that the sky brings on the scene. A value of 0 means that the sky's light emission has no effect on the scene illumination, thus all ambient illumination is provided by the ambient light. On the contrary, a value of 1 means that all the light that affects the scene is provided by the sky, thus the ambient light parameter has no effect on the scene.
</member>
<member name="auto_exposure_enabled" type="bool" setter="set_tonemap_auto_exposure" getter="get_tonemap_auto_exposure">
+ Enables the tonemapping auto exposure mode of the scene renderer. If activated, the renderer will automatically determine the exposure setting to adapt to the illumination of the scene and the observed light.
</member>
<member name="auto_exposure_max_luma" type="float" setter="set_tonemap_auto_exposure_max" getter="get_tonemap_auto_exposure_max">
+ Maximum luminance value for the auto exposure.
</member>
<member name="auto_exposure_min_luma" type="float" setter="set_tonemap_auto_exposure_min" getter="get_tonemap_auto_exposure_min">
+ Minimum luminance value for the auto exposure.
</member>
<member name="auto_exposure_scale" type="float" setter="set_tonemap_auto_exposure_grey" getter="get_tonemap_auto_exposure_grey">
+ Scale of the auto exposure effect. Affects the intensity of auto exposure.
</member>
<member name="auto_exposure_speed" type="float" setter="set_tonemap_auto_exposure_speed" getter="get_tonemap_auto_exposure_speed">
+ Speed of the auto exposure effect. Affects the time needed for the camera to perform auto exposure.
</member>
<member name="background_canvas_max_layer" type="int" setter="set_canvas_max_layer" getter="get_canvas_max_layer">
+ Maximum layer id (if using Layer background mode).
</member>
<member name="background_color" type="Color" setter="set_bg_color" getter="get_bg_color">
+ Color displayed for clear areas of the scene (if using Custom color or Color+Sky background modes).
</member>
<member name="background_energy" type="float" setter="set_bg_energy" getter="get_bg_energy">
+ Power of light emitted by the background.
</member>
<member name="background_mode" type="int" setter="set_background" getter="get_background" enum="Environment.BGMode">
+ Defines the mode of background.
</member>
<member name="background_sky" type="Sky" setter="set_sky" getter="get_sky">
+ [Sky] resource defined as background.
</member>
<member name="background_sky_scale" type="float" setter="set_sky_scale" getter="get_sky_scale">
+ [Sky] resource's scale.
</member>
<member name="dof_blur_far_amount" type="float" setter="set_dof_blur_far_amount" getter="get_dof_blur_far_amount">
+ Amount of far blur.
</member>
<member name="dof_blur_far_distance" type="float" setter="set_dof_blur_far_distance" getter="get_dof_blur_far_distance">
+ Distance from the camera where the far blur effect affects the rendering.
</member>
<member name="dof_blur_far_enabled" type="bool" setter="set_dof_blur_far_enabled" getter="is_dof_blur_far_enabled">
+ Enables the far blur effect.
</member>
<member name="dof_blur_far_quality" type="int" setter="set_dof_blur_far_quality" getter="get_dof_blur_far_quality" enum="Environment.DOFBlurQuality">
+ Quality of the far blur quality.
</member>
<member name="dof_blur_far_transition" type="float" setter="set_dof_blur_far_transition" getter="get_dof_blur_far_transition">
+ Transition between no-blur area and far blur.
</member>
<member name="dof_blur_near_amount" type="float" setter="set_dof_blur_near_amount" getter="get_dof_blur_near_amount">
+ Amount of near blur.
</member>
<member name="dof_blur_near_distance" type="float" setter="set_dof_blur_near_distance" getter="get_dof_blur_near_distance">
+ Distance from the camera where the near blur effect affects the rendering.
</member>
<member name="dof_blur_near_enabled" type="bool" setter="set_dof_blur_near_enabled" getter="is_dof_blur_near_enabled">
+ Enables the near blur effect.
</member>
<member name="dof_blur_near_quality" type="int" setter="set_dof_blur_near_quality" getter="get_dof_blur_near_quality" enum="Environment.DOFBlurQuality">
+ Quality of the near blur quality.
</member>
<member name="dof_blur_near_transition" type="float" setter="set_dof_blur_near_transition" getter="get_dof_blur_near_transition">
+ Transition between near blur and no-blur area.
</member>
<member name="fog_color" type="Color" setter="set_fog_color" getter="get_fog_color">
+ Fog's [Color].
</member>
<member name="fog_depth_begin" type="float" setter="set_fog_depth_begin" getter="get_fog_depth_begin">
+ Fog's depth starting distance from the camera.
</member>
<member name="fog_depth_curve" type="float" setter="set_fog_depth_curve" getter="get_fog_depth_curve">
+ Value defining the fog depth intensity.
</member>
<member name="fog_depth_enabled" type="bool" setter="set_fog_depth_enabled" getter="is_fog_depth_enabled">
+ Enables the fog depth.
</member>
<member name="fog_enabled" type="bool" setter="set_fog_enabled" getter="is_fog_enabled">
+ Enables the fog. Needs fog_height_enabled and/or for_depth_enabled to actually display fog.
</member>
<member name="fog_height_curve" type="float" setter="set_fog_height_curve" getter="get_fog_height_curve">
+ Value defining the fog height intensity.
</member>
<member name="fog_height_enabled" type="bool" setter="set_fog_height_enabled" getter="is_fog_height_enabled">
+ Enables the fog height.
</member>
<member name="fog_height_max" type="float" setter="set_fog_height_max" getter="get_fog_height_max">
+ Maximum height of fog.
</member>
<member name="fog_height_min" type="float" setter="set_fog_height_min" getter="get_fog_height_min">
+ Minimum height of fog.
</member>
<member name="fog_sun_amount" type="float" setter="set_fog_sun_amount" getter="get_fog_sun_amount">
+ Amount of sun that affects the fog rendering.
</member>
<member name="fog_sun_color" type="Color" setter="set_fog_sun_color" getter="get_fog_sun_color">
+ Sun [Color].
</member>
<member name="fog_transmit_curve" type="float" setter="set_fog_transmit_curve" getter="get_fog_transmit_curve">
+ Amount of light that the fog transmits.
</member>
<member name="fog_transmit_enabled" type="bool" setter="set_fog_transmit_enabled" getter="is_fog_transmit_enabled">
+ Enables fog's light transmission. If enabled, lets reflections light to be transmitted by the fog.
</member>
<member name="glow_bicubic_upscale" type="bool" setter="set_glow_bicubic_upscale" getter="is_glow_bicubic_upscale_enabled">
</member>
<member name="glow_blend_mode" type="int" setter="set_glow_blend_mode" getter="get_glow_blend_mode" enum="Environment.GlowBlendMode">
+ Glow blending mode.
</member>
<member name="glow_bloom" type="float" setter="set_glow_bloom" getter="get_glow_bloom">
+ Bloom value (global glow).
</member>
<member name="glow_enabled" type="bool" setter="set_glow_enabled" getter="is_glow_enabled">
+ Enables glow rendering.
</member>
<member name="glow_hdr_scale" type="float" setter="set_glow_hdr_bleed_scale" getter="get_glow_hdr_bleed_scale">
+ Bleed scale of the HDR glow.
</member>
<member name="glow_hdr_threshold" type="float" setter="set_glow_hdr_bleed_threshold" getter="get_glow_hdr_bleed_threshold">
+ Bleed threshold of the HDR glow.
</member>
<member name="glow_intensity" type="float" setter="set_glow_intensity" getter="get_glow_intensity">
+ Glow intensity.
</member>
<member name="glow_levels/1" type="bool" setter="set_glow_level" getter="is_glow_level_enabled">
+ First level of glow (most local).
</member>
<member name="glow_levels/2" type="bool" setter="set_glow_level" getter="is_glow_level_enabled">
+ Second level of glow.
</member>
<member name="glow_levels/3" type="bool" setter="set_glow_level" getter="is_glow_level_enabled">
+ Third level of glow.
</member>
<member name="glow_levels/4" type="bool" setter="set_glow_level" getter="is_glow_level_enabled">
+ Fourth level of glow.
</member>
<member name="glow_levels/5" type="bool" setter="set_glow_level" getter="is_glow_level_enabled">
+ Fifth level of glow.
</member>
<member name="glow_levels/6" type="bool" setter="set_glow_level" getter="is_glow_level_enabled">
+ Sixth level of glow.
</member>
<member name="glow_levels/7" type="bool" setter="set_glow_level" getter="is_glow_level_enabled">
+ Seventh level of glow (most global).
</member>
<member name="glow_strength" type="float" setter="set_glow_strength" getter="get_glow_strength">
+ Glow strength.
</member>
<member name="ss_reflections_depth_tolerance" type="float" setter="set_ssr_depth_tolerance" getter="get_ssr_depth_tolerance">
</member>
@@ -1126,48 +1189,69 @@
<member name="ssao_radius2" type="float" setter="set_ssao_radius2" getter="get_ssao_radius2">
</member>
<member name="tonemap_exposure" type="float" setter="set_tonemap_exposure" getter="get_tonemap_exposure">
+ Default exposure for tonemap.
</member>
<member name="tonemap_mode" type="int" setter="set_tonemapper" getter="get_tonemapper" enum="Environment.ToneMapper">
+ Tonemapping mode.
</member>
<member name="tonemap_white" type="float" setter="set_tonemap_white" getter="get_tonemap_white">
+ White reference value for tonemap.
</member>
</members>
<constants>
<constant name="BG_KEEP" value="5">
+ Keep on screen every pixel drawn in the background.
</constant>
<constant name="BG_CLEAR_COLOR" value="0">
+ Clear the background using the project's clear color.
</constant>
<constant name="BG_COLOR" value="1">
+ Clear the background using a custom clear color.
</constant>
<constant name="BG_SKY" value="2">
+ Display a user-defined sky in the background.
</constant>
<constant name="BG_COLOR_SKY" value="3">
+ Clear the background using a custom clear color and allows defining a sky for shading and reflection.
</constant>
<constant name="BG_CANVAS" value="4">
+ Display a [CanvasLayer] in the background.
</constant>
<constant name="BG_MAX" value="6">
+ Helper constant keeping track of the enum's size, has no direct usage in API calls.
</constant>
<constant name="GLOW_BLEND_MODE_ADDITIVE" value="0">
+ Additive glow blending mode. Mostly used for particles, glows (bloom), lens flare, bright sources.
</constant>
<constant name="GLOW_BLEND_MODE_SCREEN" value="1">
+ Screen glow blending mode. Increases brightness, used frequently with bloom.
</constant>
<constant name="GLOW_BLEND_MODE_SOFTLIGHT" value="2">
+ Softlight glow blending mode. Modifies contrast, exposes shadows and highlights, vivid bloom.
</constant>
<constant name="GLOW_BLEND_MODE_REPLACE" value="3">
+ Replace glow blending mode. Replaces all pixels' color by the glow value.
</constant>
<constant name="TONE_MAPPER_LINEAR" value="0">
+ Linear tonemapper operator. Reads the linear data and performs an exposure adjustment.
</constant>
<constant name="TONE_MAPPER_REINHARDT" value="1">
+ Reinhardt tonemapper operator. Performs a variation on rendered pixels' colors by this formula: color = color / (1 + color).
</constant>
<constant name="TONE_MAPPER_FILMIC" value="2">
+ Filmic tonemapper operator.
</constant>
<constant name="TONE_MAPPER_ACES" value="3">
+ Academy Color Encoding System tonemapper operator.
</constant>
<constant name="DOF_BLUR_QUALITY_LOW" value="0">
+ Low depth-of-field blur quality.
</constant>
<constant name="DOF_BLUR_QUALITY_MEDIUM" value="1">
+ Medium depth-of-field blur quality.
</constant>
<constant name="DOF_BLUR_QUALITY_HIGH" value="2">
+ High depth-of-field blur quality.
</constant>
</constants>
</class>
diff --git a/doc/classes/File.xml b/doc/classes/File.xml
index e1a024270e..6272d4105c 100644
--- a/doc/classes/File.xml
+++ b/doc/classes/File.xml
@@ -30,14 +30,14 @@
<return type="void">
</return>
<description>
- Close the currently opened file.
+ Closes the currently opened file.
</description>
</method>
<method name="eof_reached" qualifiers="const">
<return type="bool">
</return>
<description>
- Return whether the file cursor reached the end of the file.
+ Returns [code]true[/code] if the file cursor has reached the end of the file.
</description>
</method>
<method name="file_exists" qualifiers="const">
@@ -46,42 +46,42 @@
<argument index="0" name="path" type="String">
</argument>
<description>
- Get whether or not the file in the specified path exists.
+ Returns [code]true[/code] if the file exists in the given path.
</description>
</method>
<method name="get_16" qualifiers="const">
<return type="int">
</return>
<description>
- Get the next 16 bits from the file as an integer.
+ Returns the next 16 bits from the file as an integer.
</description>
</method>
<method name="get_32" qualifiers="const">
<return type="int">
</return>
<description>
- Get the next 32 bits from the file as an integer.
+ Returns the next 32 bits from the file as an integer.
</description>
</method>
<method name="get_64" qualifiers="const">
<return type="int">
</return>
<description>
- Get the next 64 bits from the file as an integer.
+ Returns the next 64 bits from the file as an integer.
</description>
</method>
<method name="get_8" qualifiers="const">
<return type="int">
</return>
<description>
- Get the next 8 bits from the file as an integer.
+ Returns the next 8 bits from the file as an integer.
</description>
</method>
<method name="get_as_text" qualifiers="const">
<return type="String">
</return>
<description>
- Get the whole file as a [String].
+ Returns the whole file as a [String].
</description>
</method>
<method name="get_buffer" qualifiers="const">
@@ -90,7 +90,7 @@
<argument index="0" name="len" type="int">
</argument>
<description>
- Get next len bytes of the file as a [PoolByteArray].
+ Returns next [code]len[/code] bytes of the file as a [PoolByteArray].
</description>
</method>
<method name="get_csv_line" qualifiers="const">
@@ -99,49 +99,49 @@
<argument index="0" name="delim" type="String" default="&quot;,&quot;">
</argument>
<description>
- Get the next value of the file in CSV (Comma Separated Values) format. You can pass a different delimiter to use other than the default "," (comma).
+ Returns the next value of the file in CSV (Comma Separated Values) format. You can pass a different delimiter to use other than the default "," (comma).
</description>
</method>
<method name="get_double" qualifiers="const">
<return type="float">
</return>
<description>
- Get the next 64 bits from the file as a floating point number.
+ Returns the next 64 bits from the file as a floating point number.
</description>
</method>
<method name="get_endian_swap">
<return type="bool">
</return>
<description>
- Get whether endian swap is enabled for this file.
+ Returns [code]true[/code] if endian swap is enabled for this file.
</description>
</method>
<method name="get_error" qualifiers="const">
<return type="int" enum="Error">
</return>
<description>
- Get the last error that happened when trying to perform operations. Compare with the [code]ERR_FILE_*[/code] constants from [@Global Scope].
+ Returns the last error that happened when trying to perform operations. Compare with the [code]ERR_FILE_*[/code] constants from [@Global Scope].
</description>
</method>
<method name="get_float" qualifiers="const">
<return type="float">
</return>
<description>
- Get the next 32 bits from the file as a floating point number.
+ Returns the next 32 bits from the file as a floating point number.
</description>
</method>
<method name="get_len" qualifiers="const">
<return type="int">
</return>
<description>
- Return the size of the file in bytes.
+ Returns the size of the file in bytes.
</description>
</method>
<method name="get_line" qualifiers="const">
<return type="String">
</return>
<description>
- Get the next line of the file as a [String].
+ Returns the next line of the file as a [String].
</description>
</method>
<method name="get_md5" qualifiers="const">
@@ -150,7 +150,7 @@
<argument index="0" name="path" type="String">
</argument>
<description>
- Return a md5 String representing the file at the given path or an empty [String] on failure.
+ Returns an MD5 String representing the file at the given path or an empty [String] on failure.
</description>
</method>
<method name="get_modified_time" qualifiers="const">
@@ -159,27 +159,28 @@
<argument index="0" name="file" type="String">
</argument>
<description>
+ Returns the last time the [code]file[/code] was modified in unix timestamp format or returns a [String] "ERROR IN [code]file[/code]". This unix timestamp can be converted to datetime by using [method OS.get_datetime_from_unix_time].
</description>
</method>
<method name="get_pascal_string">
<return type="String">
</return>
<description>
- Get a [String] saved in Pascal format from the file.
+ Returns a [String] saved in Pascal format from the file.
</description>
</method>
<method name="get_position" qualifiers="const">
<return type="int">
</return>
<description>
- Return the file cursor position.
+ Returns the file cursor's position.
</description>
</method>
<method name="get_real" qualifiers="const">
<return type="float">
</return>
<description>
- Get the next bits from the file as a floating point number.
+ Returns the next bits from the file as a floating point number.
</description>
</method>
<method name="get_sha256" qualifiers="const">
@@ -188,21 +189,21 @@
<argument index="0" name="path" type="String">
</argument>
<description>
- Return a sha256 String representing the file at the given path or an empty [String] on failure.
+ Returns a SHA-256 [String] representing the file at the given path or an empty [String] on failure.
</description>
</method>
<method name="get_var" qualifiers="const">
<return type="Variant">
</return>
<description>
- Get the next Variant value from the file.
+ Returns the next [Variant] value from the file.
</description>
</method>
<method name="is_open" qualifiers="const">
<return type="bool">
</return>
<description>
- Return whether the file is currently opened.
+ Returns [code]true[/code] if the file is currently opened.
</description>
</method>
<method name="open">
@@ -213,7 +214,7 @@
<argument index="1" name="flags" type="int">
</argument>
<description>
- Open the file for writing or reading, depending on the flags.
+ Opens the file for writing or reading, depending on the flags.
</description>
</method>
<method name="open_compressed">
@@ -226,7 +227,7 @@
<argument index="2" name="compression_mode" type="int" default="0">
</argument>
<description>
- Open a compressed file for reading or writing. The compression_mode can be set as one of the COMPRESSION_* constants.
+ Opens a compressed file for reading or writing. Use COMPRESSION_* constants to set [code]compression_mode[/code].
</description>
</method>
<method name="open_encrypted">
@@ -239,7 +240,7 @@
<argument index="2" name="key" type="PoolByteArray">
</argument>
<description>
- Open an encrypted file in write or read mode. You need to pass a binary key to encrypt/decrypt it.
+ Opens an encrypted file in write or read mode. You need to pass a binary key to encrypt/decrypt it.
</description>
</method>
<method name="open_encrypted_with_pass">
@@ -252,7 +253,7 @@
<argument index="2" name="pass" type="String">
</argument>
<description>
- Open an encrypted file in write or read mode. You need to pass a password to encrypt/decrypt it.
+ Opens an encrypted file in write or read mode. You need to pass a password to encrypt/decrypt it.
</description>
</method>
<method name="seek">
@@ -270,7 +271,7 @@
<argument index="0" name="position" type="int" default="0">
</argument>
<description>
- Change the file reading/writing cursor to the specified position (in bytes from the end of the file). Note that this is an offset, so you should use negative numbers or the cursor will be at the end of the file.
+ Changes the file reading/writing cursor to the specified position (in bytes from the end of the file). Note that this is an offset, so you should use negative numbers or the cursor will be at the end of the file.
</description>
</method>
<method name="set_endian_swap">
@@ -279,7 +280,7 @@
<argument index="0" name="enable" type="bool">
</argument>
<description>
- Set whether to swap the endianness of the file. Enable this if you're dealing with files written in big endian machines.
+ If [code]true[/code] the file's endianness is swapped. Use this if you're dealing with files written in big endian machines.
Note that this is about the file format, not CPU type. This is always reseted to [code]false[/code] whenever you open the file.
</description>
</method>
@@ -289,7 +290,7 @@
<argument index="0" name="value" type="int">
</argument>
<description>
- Store an integer as 16 bits in the file.
+ Stores an integer as 16 bits in the file.
</description>
</method>
<method name="store_32">
@@ -298,7 +299,7 @@
<argument index="0" name="value" type="int">
</argument>
<description>
- Store an integer as 32 bits in the file.
+ Stores an integer as 32 bits in the file.
</description>
</method>
<method name="store_64">
@@ -307,7 +308,7 @@
<argument index="0" name="value" type="int">
</argument>
<description>
- Store an integer as 64 bits in the file.
+ Stores an integer as 64 bits in the file.
</description>
</method>
<method name="store_8">
@@ -316,7 +317,7 @@
<argument index="0" name="value" type="int">
</argument>
<description>
- Store an integer as 8 bits in the file.
+ Stores an integer as 8 bits in the file.
</description>
</method>
<method name="store_buffer">
@@ -325,7 +326,7 @@
<argument index="0" name="buffer" type="PoolByteArray">
</argument>
<description>
- Store the given array of bytes in the file.
+ Stores the given array of bytes in the file.
</description>
</method>
<method name="store_double">
@@ -334,7 +335,7 @@
<argument index="0" name="value" type="float">
</argument>
<description>
- Store a floating point number as 64 bits in the file.
+ Stores a floating point number as 64 bits in the file.
</description>
</method>
<method name="store_float">
@@ -343,7 +344,7 @@
<argument index="0" name="value" type="float">
</argument>
<description>
- Store a floating point number as 32 bits in the file.
+ Stores a floating point number as 32 bits in the file.
</description>
</method>
<method name="store_line">
@@ -352,7 +353,7 @@
<argument index="0" name="line" type="String">
</argument>
<description>
- Store the given [String] as a line in the file.
+ Stores the given [String] as a line in the file.
</description>
</method>
<method name="store_pascal_string">
@@ -361,7 +362,7 @@
<argument index="0" name="string" type="String">
</argument>
<description>
- Store the given [String] as a line in the file in Pascal format (i.e. also store the length of the string).
+ Stores the given [String] as a line in the file in Pascal format (i.e. also store the length of the string).
</description>
</method>
<method name="store_real">
@@ -370,7 +371,7 @@
<argument index="0" name="value" type="float">
</argument>
<description>
- Store a floating point number in the file.
+ Stores a floating point number in the file.
</description>
</method>
<method name="store_string">
@@ -379,7 +380,7 @@
<argument index="0" name="string" type="String">
</argument>
<description>
- Store the given [String] in the file.
+ Stores the given [String] in the file.
</description>
</method>
<method name="store_var">
@@ -388,33 +389,34 @@
<argument index="0" name="value" type="Variant">
</argument>
<description>
- Store any Variant value in the file.
+ Stores any Variant value in the file.
</description>
</method>
</methods>
<constants>
<constant name="READ" value="1">
- Open the file for reading.
+ Opens the file for read operations.
</constant>
<constant name="WRITE" value="2">
- Open the file for writing. Create it if the file not exists and truncate if it exists.
+ Opens the file for write operations. Create it if the file does not exist and truncate if it exists.
</constant>
<constant name="READ_WRITE" value="3">
- Open the file for reading and writing, without truncating the file.
+ Opens the file for read and write operations. Does not truncate the file.
</constant>
<constant name="WRITE_READ" value="7">
- Open the file for reading and writing. Create it if the file not exists and truncate if it exists.
+ Opens the file for read and write operations. Create it if the file does not exist and truncate if it exists.
</constant>
<constant name="COMPRESSION_FASTLZ" value="0">
- Use the FastLZ compression method.
+ Uses the FastLZ compression method.
</constant>
<constant name="COMPRESSION_DEFLATE" value="1">
- Use the Deflate compression method.
+ Uses the Deflate compression method.
</constant>
<constant name="COMPRESSION_ZSTD" value="2">
- Use the Zstd compression method.
+ Uses the Zstd compression method.
</constant>
<constant name="COMPRESSION_GZIP" value="3">
+ Uses the gzip compression method.
</constant>
</constants>
</class>
diff --git a/doc/classes/FuncRef.xml b/doc/classes/FuncRef.xml
index a7593dc2a1..1277cef77d 100644
--- a/doc/classes/FuncRef.xml
+++ b/doc/classes/FuncRef.xml
@@ -16,6 +16,7 @@
<return type="Variant">
</return>
<description>
+ Calls the referenced function previously set by [method set_function] or [method @GDScript.funcref].
</description>
</method>
<method name="set_function">
@@ -24,7 +25,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
- Set the name of the function to call on the object, without parentheses or any parameters.
+ The name of the referenced function to call on the object, without parentheses or any parameters.
</description>
</method>
<method name="set_instance">
@@ -33,7 +34,7 @@
<argument index="0" name="instance" type="Object">
</argument>
<description>
- Set the object on which to call the referenced function. This object must be of a type actually inheriting from [Object], not a built-in type such as [int], [Vector2] or [Dictionary].
+ The object containing the referenced function. This object must be of a type actually inheriting from [Object], not a built-in type such as [int], [Vector2] or [Dictionary].
</description>
</method>
</methods>
diff --git a/doc/classes/Gradient.xml b/doc/classes/Gradient.xml
index f97908b0a2..e086ae86b1 100644
--- a/doc/classes/Gradient.xml
+++ b/doc/classes/Gradient.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Gradient" inherits="Resource" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Color interpolator node
+ Color interpolator node.
</brief_description>
<description>
Given a set of colors, this node will interpolate them in order, meaning, that if you have color 1, color 2 and color3, the ramp will interpolate (generate the colors between two colors) from color 1 to color 2 and from color 2 to color 3. Initially the ramp will have 2 colors (black and white), one (black) at ramp lower offset offset 0 and the other (white) at the ramp higher offset 1.
@@ -122,8 +122,10 @@
</methods>
<members>
<member name="colors" type="PoolColorArray" setter="set_colors" getter="get_colors">
+ Gradient's colors returned as a [PoolColorArray].
</member>
<member name="offsets" type="PoolRealArray" setter="set_offsets" getter="get_offsets">
+ Gradient's offsets returned as a [PoolRealArray].
</member>
</members>
<constants>
diff --git a/doc/classes/GraphEdit.xml b/doc/classes/GraphEdit.xml
index c9771f1ada..f064029a01 100644
--- a/doc/classes/GraphEdit.xml
+++ b/doc/classes/GraphEdit.xml
@@ -228,9 +228,11 @@
<constants>
</constants>
<theme_items>
+ <theme_item name="SnapGrid" type="Texture">
+ </theme_item>
<theme_item name="bezier_len_neg" type="int">
</theme_item>
- <theme_item name="bezier_len_position" type="int">
+ <theme_item name="bezier_len_pos" type="int">
</theme_item>
<theme_item name="bg" type="StyleBox">
</theme_item>
@@ -244,7 +246,5 @@
</theme_item>
<theme_item name="reset" type="Texture">
</theme_item>
- <theme_item name="snap" type="Texture">
- </theme_item>
</theme_items>
</class>
diff --git a/doc/classes/GridContainer.xml b/doc/classes/GridContainer.xml
index ca7b868cd8..30976eff99 100644
--- a/doc/classes/GridContainer.xml
+++ b/doc/classes/GridContainer.xml
@@ -30,6 +30,7 @@
</methods>
<members>
<member name="columns" type="int" setter="set_columns" getter="get_columns">
+ The number of columns in the [code]GridContainer[/code]. If modified, [code]GridContainer[/code] reorders its children to accommodate the new layout.
</member>
</members>
<constants>
diff --git a/doc/classes/ImageTexture.xml b/doc/classes/ImageTexture.xml
index 2b74a15fd5..fdaee798db 100644
--- a/doc/classes/ImageTexture.xml
+++ b/doc/classes/ImageTexture.xml
@@ -4,7 +4,7 @@
A [Texture] based on an [Image].
</brief_description>
<description>
- A [Texture] based on an [Image]. Can be created from an [Image].
+ A [Texture] based on an [Image]. Can be created from an [Image] with [method create_from_image].
</description>
<tutorials>
</tutorials>
@@ -66,7 +66,7 @@
<argument index="0" name="path" type="String">
</argument>
<description>
- Load an [ImageTexure].
+ Load an [ImageTexture].
</description>
</method>
<method name="set_data">
@@ -93,6 +93,7 @@
<argument index="0" name="size" type="Vector2">
</argument>
<description>
+ Resizes the [code]ImageTexture[/code] to the specified dimensions.
</description>
</method>
<method name="set_storage">
diff --git a/doc/classes/ImmediateGeometry.xml b/doc/classes/ImmediateGeometry.xml
index b12f9c99a9..cd7074aeaf 100644
--- a/doc/classes/ImmediateGeometry.xml
+++ b/doc/classes/ImmediateGeometry.xml
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="ImmediateGeometry" inherits="GeometryInstance" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Node to draw simple geometry from code, ala OpenGL 1.x
+ Draws simple geometry from code.
</brief_description>
<description>
+ Draws simple geometry from code. Uses a drawing mode similar to OpenGL 1.x.
</description>
<tutorials>
</tutorials>
@@ -31,7 +32,7 @@
<argument index="0" name="position" type="Vector3">
</argument>
<description>
- Add a vertex with the currently set color/uv/etc.
+ Adds a vertex with the currently set color/uv/etc.
</description>
</method>
<method name="begin">
@@ -50,14 +51,14 @@
<return type="void">
</return>
<description>
- Clear everything that was drawn using begin/end.
+ Clears everything that was drawn using begin/end.
</description>
</method>
<method name="end">
<return type="void">
</return>
<description>
- Call this when done adding a batch of geometry, otherwise it can't be displayed.
+ Ends a drawing context and displays the results.
</description>
</method>
<method name="set_color">
@@ -66,7 +67,7 @@
<argument index="0" name="color" type="Color">
</argument>
<description>
- Set the color that the next vertex will use to be drawn.
+ The current drawing color.
</description>
</method>
<method name="set_normal">
@@ -75,7 +76,7 @@
<argument index="0" name="normal" type="Vector3">
</argument>
<description>
- Set the normal that the next vertex will use to be drawn.
+ The next vertex's normal.
</description>
</method>
<method name="set_tangent">
@@ -84,7 +85,7 @@
<argument index="0" name="tangent" type="Plane">
</argument>
<description>
- Set the tangent (and binormal facing) that the next vertex will use to be drawn.
+ The next vertex's tangent (and binormal facing).
</description>
</method>
<method name="set_uv">
@@ -93,7 +94,7 @@
<argument index="0" name="uv" type="Vector2">
</argument>
<description>
- Set the UV that the next vertex will use to be drawn.
+ The next vertex's UV.
</description>
</method>
<method name="set_uv2">
@@ -102,7 +103,7 @@
<argument index="0" name="uv" type="Vector2">
</argument>
<description>
- Set the second layer of UV that the next vertex will use to be drawn.
+ The next vertex's second layer UV.
</description>
</method>
</methods>
diff --git a/doc/classes/JSON.xml b/doc/classes/JSON.xml
index a38b2f61cf..8bff140bb4 100644
--- a/doc/classes/JSON.xml
+++ b/doc/classes/JSON.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="JSON" inherits="Object" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Helper class for parsing JSON data.
</brief_description>
<description>
+ Helper class for parsing JSON data.
</description>
<tutorials>
</tutorials>
@@ -15,6 +17,7 @@
<argument index="0" name="json" type="String">
</argument>
<description>
+ Parses a JSON encoded string and returns a [JSONParseResult] containing the result.
</description>
</method>
<method name="print">
@@ -23,6 +26,7 @@
<argument index="0" name="value" type="Variant">
</argument>
<description>
+ Converts a Variant var to JSON text and returns the result. Useful for serializing data to store or send over the network.
</description>
</method>
</methods>
diff --git a/doc/classes/JSONParseResult.xml b/doc/classes/JSONParseResult.xml
index 6aeb614508..86edaaf1e6 100644
--- a/doc/classes/JSONParseResult.xml
+++ b/doc/classes/JSONParseResult.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="JSONParseResult" inherits="Reference" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Data class wrapper for decoded JSON.
</brief_description>
<description>
+ Returned by [method JSON.parse], [JSONParseResult] contains decoded JSON or error information if JSON source not successfully parsed. You can check if JSON source was successfully parsed with [code]if json_result.error == 0[/code].
</description>
<tutorials>
</tutorials>
@@ -68,12 +70,24 @@
</methods>
<members>
<member name="error" type="int" setter="set_error" getter="get_error" enum="Error">
+ The error type if JSON source was not successfully parsed. See [@Global Scope]ERR_* constants.
</member>
<member name="error_line" type="int" setter="set_error_line" getter="get_error_line">
+ The line number where the error occurred if JSON source was not successfully parsed.
</member>
<member name="error_string" type="String" setter="set_error_string" getter="get_error_string">
+ The error message if JSON source was not successfully parsed. See [@Global Scope]ERR_* constants.
</member>
<member name="result" type="Variant" setter="set_result" getter="get_result">
+ A [Variant] containing the parsed JSON. Use typeof() to check if it is what you expect. For exemple, if JSON source starts with braces [code]{}[/code] a [Dictionary] will be returned, if JSON source starts with array braces [code][][/code] an [Array] will be returned.
+ [i]Be aware that the JSON specification does not define integer or float types, but only a number type. Therefore, parsing a JSON text will convert all numerical values to float types.[/i]
+ [codeblock]
+ p = JSON.parse('["hello", "world", "!"]')
+ if typeof(p) == TYPE_ARRAY:
+ print(p[0]) # prints 'hello'
+ else:
+ print("unexpected results")
+ [/codeblock]
</member>
</members>
<constants>
diff --git a/doc/classes/KinematicBody.xml b/doc/classes/KinematicBody.xml
index 8f242c5187..86354548cd 100644
--- a/doc/classes/KinematicBody.xml
+++ b/doc/classes/KinematicBody.xml
@@ -6,7 +6,7 @@
<description>
Kinematic bodies are special types of bodies that are meant to be user-controlled. They are not affected by physics at all (to other types of bodies, such a character or a rigid body, these are the same as a static body). They have however, two main uses:
Simulated Motion: When these bodies are moved manually, either from code or from an AnimationPlayer (with process mode set to fixed), the physics will automatically compute an estimate of their linear and angular velocity. This makes them very useful for moving platforms or other AnimationPlayer-controlled objects (like a door, a bridge that opens, etc).
- Kinematic Characters: KinematicBody also has an api for moving objects (the [method move] method) while performing collision tests. This makes them really useful to implement characters that collide against a world, but that don't require advanced physics.
+ Kinematic Characters: KinematicBody also has an API for moving objects (the [method move_and_collide] and [method move_and_slide] methods) while performing collision tests. This makes them really useful to implement characters that collide against a world, but that don't require advanced physics.
</description>
<tutorials>
</tutorials>
@@ -17,6 +17,7 @@
<return type="Vector3">
</return>
<description>
+ Returns the velocity of the floor. Only updates when calling [method move_and_slide].
</description>
</method>
<method name="get_safe_margin" qualifiers="const">
@@ -31,30 +32,35 @@
<argument index="0" name="slide_idx" type="int">
</argument>
<description>
+ Returns a [KinematicCollision], which contains information about a collision that occured during the last [method move_and_slide] call. Since the body can collide several times in a single call to [method move_and_slide], you must specify the index of the collision in the range 0 to ([method get_slide_count]()-1).
</description>
</method>
<method name="get_slide_count" qualifiers="const">
<return type="int">
</return>
<description>
+ Returns the number of times the body collided and changed direction during the last call to [method move_and_slide].
</description>
</method>
<method name="is_on_ceiling" qualifiers="const">
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if the body is on the ceiling. Only updates when calling [method move_and_slide].
</description>
</method>
<method name="is_on_floor" qualifiers="const">
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if the body is on the floor. Only updates when calling [method move_and_slide].
</description>
</method>
<method name="is_on_wall" qualifiers="const">
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if the body is on a wall. Only updates when calling [method move_and_slide].
</description>
</method>
<method name="move_and_collide">
@@ -63,6 +69,7 @@
<argument index="0" name="rel_vec" type="Vector3">
</argument>
<description>
+ Moves the body along the vector [code]rel_vec[/code]. The body will stop if it collides. Returns a [KinematicCollision], which contains information about the collision.
</description>
</method>
<method name="move_and_slide">
@@ -79,6 +86,13 @@
<argument index="4" name="floor_max_angle" type="float" default="0.785398">
</argument>
<description>
+ Moves the body along a vector. If the body collides with another, it will slide along the other body rather than stop immediately. If the other body is a [KinematicBody] or [RigidBody], it will also be affected by the motion of the other body. You can use this to make moving or rotating platforms, or to make nodes push other nodes.
+ [code]linear_velocity[/code] is a value in pixels per second. Unlike in for example [method move_and_collide], you should [i]not[/i] multiply it with [code]delta[/code] — this is done by the method.
+ [code]floor_normal[/code] is the up direction, used to determine what is a wall and what is a floor or a ceiling. If set to the default value of [code]Vector2(0, 0)[/code], everything is considered a wall. This is useful for topdown games.
+ If the body is standing on a slope and the horizontal speed (relative to the floor's speed) goes below [code]slope_stop_min_velocity[/code], the body will stop completely. This prevents the body from sliding down slopes when you include gravity in [code]linear_velocity[/code]. When set to lower values, the body will not be able to stand still on steep slopes.
+ If the body collides, it will change direction a maximum of [code]max_bounces[/code] times before it stops.
+ [code]floor_max_angle[/code] is the maximum angle (in radians) where a slope is still considered a floor (or a ceiling), rather than a wall. The default value equals 45 degrees.
+ Returns the movement that remained when the body stopped. To get more detailed information about collisions that occured, use [method get_slide_collision].
</description>
</method>
<method name="set_safe_margin">
@@ -97,11 +111,13 @@
<argument index="1" name="rel_vec" type="Vector3">
</argument>
<description>
+ Checks for collisions without moving the body. Virtually sets the node's position, scale and rotation to that of the given [Transform], then tries to move the body along the vector [code]rel_vec[/code]. Returns [code]true[/code] if a collision would occur.
</description>
</method>
</methods>
<members>
<member name="collision/safe_margin" type="float" setter="set_safe_margin" getter="get_safe_margin">
+ If the body is at least this close to another body, this body will consider them to be colliding.
</member>
</members>
<constants>
diff --git a/doc/classes/KinematicBody2D.xml b/doc/classes/KinematicBody2D.xml
index dddae2c0fc..e7c58fdb3a 100644
--- a/doc/classes/KinematicBody2D.xml
+++ b/doc/classes/KinematicBody2D.xml
@@ -6,7 +6,7 @@
<description>
Kinematic bodies are special types of bodies that are meant to be user-controlled. They are not affected by physics at all (to other types of bodies, such a character or a rigid body, these are the same as a static body). They have however, two main uses:
Simulated Motion: When these bodies are moved manually, either from code or from an AnimationPlayer (with process mode set to fixed), the physics will automatically compute an estimate of their linear and angular velocity. This makes them very useful for moving platforms or other AnimationPlayer-controlled objects (like a door, a bridge that opens, etc).
- Kinematic Characters: KinematicBody2D also has an api for moving objects (the [method move] method) while performing collision tests. This makes them really useful to implement characters that collide against a world, but that don't require advanced physics.
+ Kinematic Characters: KinematicBody2D also has an API for moving objects (the [method move_and_collide] and [method move_and_slide] methods) while performing collision tests. This makes them really useful to implement characters that collide against a world, but that don't require advanced physics.
</description>
<tutorials>
</tutorials>
@@ -17,6 +17,7 @@
<return type="Vector2">
</return>
<description>
+ Returns the velocity of the floor. Only updates when calling [method move_and_slide].
</description>
</method>
<method name="get_safe_margin" qualifiers="const">
@@ -31,30 +32,35 @@
<argument index="0" name="slide_idx" type="int">
</argument>
<description>
+ Returns a [KinematicCollision2D], which contains information about a collision that occured during the last [method move_and_slide] call. Since the body can collide several times in a single call to [method move_and_slide], you must specify the index of the collision in the range 0 to ([method get_slide_count]()-1).
</description>
</method>
<method name="get_slide_count" qualifiers="const">
<return type="int">
</return>
<description>
+ Returns the number of times the body collided and changed direction during the last call to [method move_and_slide].
</description>
</method>
<method name="is_on_ceiling" qualifiers="const">
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if the body is on the ceiling. Only updates when calling [method move_and_slide].
</description>
</method>
<method name="is_on_floor" qualifiers="const">
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if the body is on the floor. Only updates when calling [method move_and_slide].
</description>
</method>
<method name="is_on_wall" qualifiers="const">
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if the body is on a wall. Only updates when calling [method move_and_slide].
</description>
</method>
<method name="move_and_collide">
@@ -63,7 +69,7 @@
<argument index="0" name="rel_vec" type="Vector2">
</argument>
<description>
- Moves the body along the given vector. The body will stop if it collides. Returns a [KinematicCollision2D], which contains information about the colliding body.
+ Moves the body along the vector [code]rel_vec[/code]. The body will stop if it collides. Returns a [KinematicCollision2D], which contains information about the collision.
</description>
</method>
<method name="move_and_slide">
@@ -80,6 +86,13 @@
<argument index="4" name="floor_max_angle" type="float" default="0.785398">
</argument>
<description>
+ Moves the body along a vector. If the body collides with another, it will slide along the other body rather than stop immediately. If the other body is a [KinematicBody2D] or [RigidBody2D], it will also be affected by the motion of the other body. You can use this to make moving or rotating platforms, or to make nodes push other nodes.
+ [code]linear_velocity[/code] is a value in pixels per second. Unlike in for example [method move_and_collide], you should [i]not[/i] multiply it with [code]delta[/code] — this is done by the method.
+ [code]floor_normal[/code] is the up direction, used to determine what is a wall and what is a floor or a ceiling. If set to the default value of [code]Vector2(0, 0)[/code], everything is considered a wall. This is useful for topdown games.
+ If the body is standing on a slope and the horizontal speed (relative to the floor's speed) goes below [code]slope_stop_min_velocity[/code], the body will stop completely. This prevents the body from sliding down slopes when you include gravity in [code]linear_velocity[/code]. When set to lower values, the body will not be able to stand still on steep slopes.
+ If the body collides, it will change direction a maximum of [code]max_bounces[/code] times before it stops.
+ [code]floor_max_angle[/code] is the maximum angle (in radians) where a slope is still considered a floor (or a ceiling), rather than a wall. The default value equals 45 degrees.
+ Returns the movement that remained when the body stopped. To get more detailed information about collisions that occured, use [method get_slide_collision].
</description>
</method>
<method name="set_safe_margin">
@@ -98,14 +111,15 @@
<argument index="1" name="rel_vec" type="Vector2">
</argument>
<description>
- Returns true if there would be a collision if the body moved from the given point in the given direction.
+ Checks for collisions without moving the body. Virtually sets the node's position, scale and rotation to that of the given [Transform2D], then tries to move the body along the vector [code]rel_vec[/code]. Returns [code]true[/code] if a collision would occur.
</description>
</method>
</methods>
<members>
<member name="collision/safe_margin" type="float" setter="set_safe_margin" getter="get_safe_margin">
+ If the body is at least this close to another body, this body will consider them to be colliding.
</member>
</members>
<constants>
</constants>
-</class>
+</class> \ No newline at end of file
diff --git a/doc/classes/Label.xml b/doc/classes/Label.xml
index 8c5e69b407..1d1ce63a58 100644
--- a/doc/classes/Label.xml
+++ b/doc/classes/Label.xml
@@ -15,7 +15,7 @@
<return type="int" enum="Label.Align">
</return>
<description>
- Return the alignment mode (any of the ALIGN_* enumeration values).
+ Returns the alignment mode (any of the ALIGN_* enumeration values).
</description>
</method>
<method name="get_line_count" qualifiers="const">
@@ -36,76 +36,77 @@
<return type="int">
</return>
<description>
- Return the the number of lines to skipped before displaying.
+ Returns the the number of lines to skip before displaying.
</description>
</method>
<method name="get_max_lines_visible" qualifiers="const">
<return type="int">
</return>
<description>
- Return the restricted number of lines to display. Returns -1 if unrestricted.
+ Returns the maximum number of lines to display. Returns -1 if unrestricted.
</description>
</method>
<method name="get_percent_visible" qualifiers="const">
<return type="float">
</return>
<description>
- Return the restricted number of characters to display (as a percentage of the total text).
+ Returns the maximum number of characters to display as a percentage of the total text.
</description>
</method>
<method name="get_text" qualifiers="const">
<return type="String">
</return>
<description>
- Return the label text. Text can contain newlines.
+ Returns the label text. Text can contain newlines.
</description>
</method>
<method name="get_total_character_count" qualifiers="const">
<return type="int">
</return>
<description>
- Return the total length of the text.
+ Returns the total length of the text.
</description>
</method>
<method name="get_valign" qualifiers="const">
<return type="int" enum="Label.VAlign">
</return>
<description>
- Return the vertical alignment mode (any of the VALIGN_* enumeration values).
+ Returns the vertical alignment mode (any of the VALIGN_* enumeration values).
</description>
</method>
<method name="get_visible_characters" qualifiers="const">
<return type="int">
</return>
<description>
- Return the restricted number of characters to display. Returns -1 if unrestricted.
+ Returns the restricted number of characters to display. Returns -1 if unrestricted.
</description>
</method>
<method name="get_visible_line_count" qualifiers="const">
<return type="int">
</return>
<description>
+ Returns the number of lines shown. Useful if the [code]Label[/code] 's height cannot currently display all lines.
</description>
</method>
<method name="has_autowrap" qualifiers="const">
<return type="bool">
</return>
<description>
- Return the state of the [i]autowrap[/i] mode (see [method set_autowrap]).
+ Returns [code]true[/code] if [i]autowrap[/i] mode (see [method set_autowrap]).
</description>
</method>
<method name="is_clipping_text" qualifiers="const">
<return type="bool">
</return>
<description>
- Return [code]true[/code] if text would be cut off if it is too wide.
+ Returns [code]true[/code] if text would be cut off if it is too wide.
</description>
</method>
<method name="is_uppercase" qualifiers="const">
<return type="bool">
</return>
<description>
- Return [code]true[/code] if text is displayed in all capitals.
+ Returns [code]true[/code] if text is displayed in all capitals.
</description>
</method>
<method name="set_align">
diff --git a/doc/classes/LargeTexture.xml b/doc/classes/LargeTexture.xml
index e4cabdc556..f5416488f6 100644
--- a/doc/classes/LargeTexture.xml
+++ b/doc/classes/LargeTexture.xml
@@ -5,7 +5,7 @@
</brief_description>
<description>
A Texture capable of storing many smaller Textures with offsets.
- You can dynamically add pieces(Textures) to this fLargeTexture] using different offsets.
+ You can dynamically add pieces([Texture]) to this [code]LargeTexture[/code] using different offsets.
</description>
<tutorials>
</tutorials>
@@ -20,21 +20,21 @@
<argument index="1" name="texture" type="Texture">
</argument>
<description>
- Add another [Texture] to this [LargeTexture], starting on offset "ofs".
+ Add another [Texture] to this [code]LargeTexture[/code], starting on offset "ofs".
</description>
</method>
<method name="clear">
<return type="void">
</return>
<description>
- Clear the [LargeTexture].
+ Clears the [code]LargeTexture[/code].
</description>
</method>
<method name="get_piece_count" qualifiers="const">
<return type="int">
</return>
<description>
- Return the number of pieces currently in this [LargeTexture].
+ Returns the number of pieces currently in this [code]LargeTexture[/code].
</description>
</method>
<method name="get_piece_offset" qualifiers="const">
@@ -43,7 +43,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the offset of the piece with index "idx".
+ Returns the offset of the piece with index "idx".
</description>
</method>
<method name="get_piece_texture" qualifiers="const">
@@ -52,7 +52,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the [Texture] of the piece with index "idx".
+ Returns the [Texture] of the piece with index "idx".
</description>
</method>
<method name="set_piece_offset">
@@ -63,7 +63,7 @@
<argument index="1" name="ofs" type="Vector2">
</argument>
<description>
- Set the offset of the piece with index "idx" to "ofs".
+ Sets the offset of the piece with index "idx" to "ofs".
</description>
</method>
<method name="set_piece_texture">
@@ -74,7 +74,7 @@
<argument index="1" name="texture" type="Texture">
</argument>
<description>
- Set the [Texture] of the piece with index "idx" to "ofs".
+ Sets the [Texture] of the piece with index "idx" to "ofs".
</description>
</method>
<method name="set_size">
@@ -83,12 +83,16 @@
<argument index="0" name="size" type="Vector2">
</argument>
<description>
- Set the size of this [LargeTexture].
+ Sets the size of this [code]LargeTexture[/code].
</description>
</method>
</methods>
<members>
<member name="_data" type="Array" setter="_set_data" getter="_get_data">
+ Returns an [Array] with offsets and textures data of each added piece. Schema is [offsets1, texture1, offsets2, texture2, large_texture_size].
+ [code]offsets[/code] : [Vector2] offsets of the texture piece.
+ [code]second[/code] : [StreamTexture] data of the texture piece.
+ [code]last entry[/code] : [Vector2] size of the entire large texture.
</member>
</members>
<constants>
diff --git a/doc/classes/Light2D.xml b/doc/classes/Light2D.xml
index 7ce7cef7c1..05054e06fd 100644
--- a/doc/classes/Light2D.xml
+++ b/doc/classes/Light2D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Light2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Node that casts light in a 2D environment.
+ Casts light in a 2D environment.
</brief_description>
<description>
- Node that casts light in a 2D environment. Light is defined by a (usually grayscale) texture, a color, an energy value, a mode (see constants), and various other parameters (range and shadows-related). Note that Light2D can be used as a mask.
+ Casts light in a 2D environment. Light is defined by a (usually grayscale) texture, a color, an energy value, a mode (see constants), and various other parameters (range and shadows-related). Note that Light2D can be used as a mask.
</description>
<tutorials>
</tutorials>
@@ -385,7 +385,7 @@
If [code]true[/code] the Light2D will cast shadows. Default value: [code]false[/code].
</member>
<member name="shadow_filter" type="int" setter="set_shadow_filter" getter="get_shadow_filter" enum="Light2D.ShadowFilter">
- Shadow filter type. May be one of [code][None, PCF5, PCF9, PCF13][/code]. Default value: [code]None[/code].
+ Shadow filter type. Use SHADOW_FILTER_* constants to set [code]shadow_filter[/code]. Default value: [code]None[/code].
</member>
<member name="shadow_filter_smooth" type="float" setter="set_shadow_smooth" getter="get_shadow_smooth">
Smoothing value for shadows.
@@ -408,7 +408,7 @@
Adds the value of pixels corresponding to the Light2D to the values of pixels under it. This is the common behaviour of a light.
</constant>
<constant name="MODE_SUB" value="1">
- Subtract the value of pixels corresponding to the Light2D to the values of pixels under it, resulting in inversed light effect.
+ Subtracts the value of pixels corresponding to the Light2D to the values of pixels under it, resulting in inversed light effect.
</constant>
<constant name="MODE_MIX" value="2">
Mix the value of pixels corresponding to the Light2D to the values of pixels under it by linear interpolation.
@@ -417,16 +417,22 @@
The light texture of the Light2D is used as a mask, hiding or revealing parts of the screen underneath depending on the value of each pixel of the light (mask) texture.
</constant>
<constant name="SHADOW_FILTER_NONE" value="0">
+ No filter applies to the shadow map. See [method shadow_filter].
</constant>
<constant name="SHADOW_FILTER_PCF3" value="1">
+ Percentage closer filtering (3 samples) applies to the shadow map. See [method shadow_filter].
</constant>
<constant name="SHADOW_FILTER_PCF5" value="2">
+ Percentage closer filtering (5 samples) applies to the shadow map. See [method shadow_filter].
</constant>
<constant name="SHADOW_FILTER_PCF7" value="3">
+ Percentage closer filtering (7 samples) applies to the shadow map. See [method shadow_filter].
</constant>
<constant name="SHADOW_FILTER_PCF9" value="4">
+ Percentage closer filtering (9 samples) applies to the shadow map. See [method shadow_filter].
</constant>
<constant name="SHADOW_FILTER_PCF13" value="5">
+ Percentage closer filtering (13 samples) applies to the shadow map. See [method shadow_filter].
</constant>
</constants>
</class>
diff --git a/doc/classes/Line2D.xml b/doc/classes/Line2D.xml
index e6e615ccf1..3cca256a5d 100644
--- a/doc/classes/Line2D.xml
+++ b/doc/classes/Line2D.xml
@@ -17,7 +17,7 @@
<argument index="0" name="position" type="Vector2">
</argument>
<description>
- Add a point at the x/y position in the supplied [Vector2]
+ Add a point at the [code]position[/code]. Appends the point at the end of the line.
</description>
</method>
<method name="get_begin_cap_mode" qualifiers="const">
@@ -54,6 +54,7 @@
<return type="int">
</return>
<description>
+ Returns the Line2D's amount of points.
</description>
</method>
<method name="get_point_position" qualifiers="const">
@@ -62,6 +63,7 @@
<argument index="0" name="i" type="int">
</argument>
<description>
+ Returns point [code]i[code]'s position.
</description>
</method>
<method name="get_points" qualifiers="const">
@@ -106,7 +108,7 @@
<argument index="0" name="i" type="int">
</argument>
<description>
- Remove the point at index 'i' from the line.
+ Remove the point at index [code]i[/code] from the line.
</description>
</method>
<method name="set_begin_cap_mode">
@@ -157,6 +159,7 @@
<argument index="1" name="position" type="Vector2">
</argument>
<description>
+ Overwites the position in point [code]i[/code] with the supplied [code]position[/code].
</description>
</method>
<method name="set_points">
@@ -210,44 +213,63 @@
</methods>
<members>
<member name="begin_cap_mode" type="int" setter="set_begin_cap_mode" getter="get_begin_cap_mode" enum="Line2D.LineCapMode">
+ Controls the style of the line's first point. Use [code]LINE_CAP_*[/code] constants. Default value: [code]LINE_CAP_NONE[/code].
</member>
<member name="default_color" type="Color" setter="set_default_color" getter="get_default_color">
+ The line's color. Will not be used if a gradient is set.
</member>
<member name="end_cap_mode" type="int" setter="set_end_cap_mode" getter="get_end_cap_mode" enum="Line2D.LineCapMode">
+ Controls the style of the line's last point. Use [code]LINE_CAP_*[/code] constants. Default value: [code]LINE_CAP_NONE[/code].
</member>
<member name="gradient" type="Gradient" setter="set_gradient" getter="get_gradient">
+ The gradient is drawn through the whole line from start to finish. The default color will not be used if a gradient is set.
</member>
<member name="joint_mode" type="int" setter="set_joint_mode" getter="get_joint_mode" enum="Line2D.LineJointMode">
+ The style for the points inbetween the start and the end.
</member>
<member name="points" type="PoolVector2Array" setter="set_points" getter="get_points">
+ The points that form the lines. The line is drawn between every point set in this array.
</member>
<member name="round_precision" type="int" setter="set_round_precision" getter="get_round_precision">
+ The smoothness of the rounded joints and caps. This is only used if a cap or joint is set as round.
</member>
<member name="sharp_limit" type="float" setter="set_sharp_limit" getter="get_sharp_limit">
+ The direction difference in radians between vector points. This value is only used if [code]joint mode[/code] is set to [code]LINE_JOINT_SHARP[/code].
</member>
<member name="texture" type="Texture" setter="set_texture" getter="get_texture">
+ The texture used for the line's texture. Uses [code]texture_mode[/code] for drawing style.
</member>
<member name="texture_mode" type="int" setter="set_texture_mode" getter="get_texture_mode" enum="Line2D.LineTextureMode">
+ The style to render the [code]texture[/code] on the line. Use [code]LINE_TEXTURE_*[/code] constants. Default value: [code]LINE_TEXTURE_NONE[/code].
</member>
<member name="width" type="float" setter="set_width" getter="get_width">
+ The line's width.
</member>
</members>
<constants>
<constant name="LINE_JOINT_SHARP" value="0">
+ The line's joints will be pointy. If [code]sharp_limit[/code] is greater than the rotation of a joint, it becomes a bevel joint instead.
</constant>
<constant name="LINE_JOINT_BEVEL" value="1">
+ The line's joints will be bevelled/chamfered.
</constant>
<constant name="LINE_JOINT_ROUND" value="2">
+ The line's joints will be rounded.
</constant>
<constant name="LINE_CAP_NONE" value="0">
+ Don't have a line cap.
</constant>
<constant name="LINE_CAP_BOX" value="1">
+ Draws the line cap as a box.
</constant>
<constant name="LINE_CAP_ROUND" value="2">
+ Draws the line cap as a circle.
</constant>
<constant name="LINE_TEXTURE_NONE" value="0">
+ Takes the left pixels of the texture and renders it over the whole line.
</constant>
<constant name="LINE_TEXTURE_TILE" value="1">
+ Tiles the texture over the line. The texture need to be imported with Repeat Enabled for it to work properly.
</constant>
</constants>
</class>
diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml
index 65200c4769..f78821e158 100644
--- a/doc/classes/OS.xml
+++ b/doc/classes/OS.xml
@@ -26,14 +26,14 @@
<return type="bool">
</return>
<description>
- Return true if the host OS allows drawing.
+ Returns [code]true[/code] if the host OS allows drawing.
</description>
</method>
<method name="can_use_threads" qualifiers="const">
<return type="bool">
</return>
<description>
- Returns if the current host platform is using multiple threads.
+ Returns [code]true[/code] if the current host platform is using multiple threads.
</description>
</method>
<method name="delay_msec" qualifiers="const">
@@ -117,7 +117,7 @@
<return type="PoolStringArray">
</return>
<description>
- Return the commandline passed to the engine.
+ Returns the command line arguments passed to the engine.
</description>
</method>
<method name="get_current_screen" qualifiers="const">
@@ -131,7 +131,7 @@
<return type="String">
</return>
<description>
- Return the absolute directory path of user data path([user://]).
+ Returns the absolute directory path of user data path([user://]).
</description>
</method>
<method name="get_date" qualifiers="const">
@@ -166,7 +166,7 @@
<return type="int">
</return>
<description>
- Return the total amount of dynamic memory used (only works in debug).
+ Returns the total amount of dynamic memory used (only works in debug).
</description>
</method>
<method name="get_environment" qualifiers="const">
@@ -175,14 +175,14 @@
<argument index="0" name="environment" type="String">
</argument>
<description>
- Return an environment variable.
+ Returns an environment variable.
</description>
</method>
<method name="get_executable_path" qualifiers="const">
<return type="String">
</return>
<description>
- Return the path to the current engine executable.
+ Returns the path to the current engine executable.
</description>
</method>
<method name="get_exit_code" qualifiers="const">
@@ -203,7 +203,7 @@
<return type="String">
</return>
<description>
- Return the host OS locale.
+ Returns the host OS locale.
</description>
</method>
<method name="get_model_name" qualifiers="const">
@@ -217,25 +217,28 @@
<return type="String">
</return>
<description>
- Return the name of the host OS. Possible values are: "Android", "Haiku", "iOS", "HTML5", "OSX", "Server", "Windows", "UWP", "X11".
+ Returns the name of the host OS. Possible values are: "Android", "Haiku", "iOS", "HTML5", "OSX", "Server", "Windows", "UWP", "X11".
</description>
</method>
<method name="get_power_percent_left">
<return type="int">
</return>
<description>
+ Returns the amount of battery left in the device as a percentage.
</description>
</method>
<method name="get_power_seconds_left">
<return type="int">
</return>
<description>
+ Returns the time in seconds before the device runs out of battery.
</description>
</method>
<method name="get_power_state">
<return type="int" enum="OS.PowerState">
</return>
<description>
+ Returns the current state of the device regarding battery and power. See [code]POWERSTATE_*[/code] constants.
</description>
</method>
<method name="get_process_id" qualifiers="const">
@@ -265,7 +268,7 @@
<return type="int">
</return>
<description>
- Returns the number of displays attached to the host machine
+ Returns the number of displays attached to the host machine.
</description>
</method>
<method name="get_screen_dpi" qualifiers="const">
@@ -298,6 +301,7 @@
<argument index="0" name="screen" type="int" default="-1">
</argument>
<description>
+ Returns the position of the specified screen by index. If no screen index is provided, the current screen will be used.
</description>
</method>
<method name="get_screen_size" qualifiers="const">
@@ -319,13 +323,14 @@
<return type="int">
</return>
<description>
- Return the max amount of static memory used (only works in debug).
+ Returns the max amount of static memory used (only works in debug).
</description>
</method>
<method name="get_static_memory_usage" qualifiers="const">
<return type="int">
</return>
<description>
+ Returns the amount of static memory being used by the program in bytes.
</description>
</method>
<method name="get_system_dir" qualifiers="const">
@@ -334,19 +339,21 @@
<argument index="0" name="dir" type="int" enum="OS.SystemDir">
</argument>
<description>
+ Returns the actual path to commonly used folders across different platforms. Available locations are specified in [OS.SystemDir].
</description>
</method>
<method name="get_system_time_secs" qualifiers="const">
<return type="int">
</return>
<description>
+ Returns the epoch time of the operating system in seconds.
</description>
</method>
<method name="get_ticks_msec" qualifiers="const">
<return type="int">
</return>
<description>
- Return the amount of time passed in milliseconds since the engine started.
+ Returns the amount of time passed in milliseconds since the engine started.
</description>
</method>
<method name="get_time" qualifiers="const">
@@ -355,19 +362,21 @@
<argument index="0" name="utc" type="bool" default="false">
</argument>
<description>
- Returns current time as a dictionary of keys: hour, minute, second
+ Returns current time as a dictionary of keys: hour, minute, second.
</description>
</method>
<method name="get_time_zone_info" qualifiers="const">
<return type="Dictionary">
</return>
<description>
+ Returns the current time zone as a dictionary with the keys: bias and name.
</description>
</method>
<method name="get_unique_id" qualifiers="const">
<return type="String">
</return>
<description>
+ Returns a unique string.
</description>
</method>
<method name="get_unix_time" qualifiers="const">
@@ -408,20 +417,21 @@
<argument index="0" name="environment" type="String">
</argument>
<description>
- Return true if an environment variable exists.
+ Returns [code]true[/code] if an environment variable exists.
</description>
</method>
<method name="has_touchscreen_ui_hint" qualifiers="const">
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if the device has a touchscreen or emulates one.
</description>
</method>
<method name="has_virtual_keyboard" qualifiers="const">
<return type="bool">
</return>
<description>
- Returns true if the platform has a virtual keyboard, false otherwise.
+ Returns [code]true[/code] if the platform has a virtual keyboard, [code]false[/code] otherwise.
</description>
</method>
<method name="hide_virtual_keyboard">
@@ -435,26 +445,30 @@
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if the build is a debug build.
+ Returns [code]true[/code] when running in the editor.
+ Returns [code]false[/code] if the build is a release build.
</description>
</method>
<method name="is_in_low_processor_usage_mode" qualifiers="const">
<return type="bool">
</return>
<description>
- Return true if low cpu usage mode is enabled.
+ Returns [code]true[/code] if low cpu usage mode is enabled.
</description>
</method>
<method name="is_keep_screen_on" qualifiers="const">
<return type="bool">
</return>
<description>
- Returns whether the screen is being kept on or not.
+ Returns [code]true[/code] if the screen is being kept on.
</description>
</method>
<method name="is_ok_left_and_cancel_right" qualifiers="const">
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if the "Okay" button should appear on the left and "Cancel" on the right.
</description>
</method>
<method name="is_scancode_unicode" qualifiers="const">
@@ -463,47 +477,56 @@
<argument index="0" name="code" type="int">
</argument>
<description>
+ Returns [code]true[/code] if the input code has a unicode character.
</description>
</method>
<method name="is_stdout_verbose" qualifiers="const">
<return type="bool">
</return>
<description>
- Return true if the engine was executed with -v (verbose stdout).
+ Returns [code]true[/code] if the engine was executed with -v (verbose stdout).
+ </description>
+ </method>
+ <method name="is_userfs_persistent" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ If [code]true[/code], the [code]user://[/code] file system is persistent, so that its state is the same after a player quits and starts the game again. Relevant to the HTML5 platform, where this persistence may be unavailable.
</description>
</method>
<method name="is_vsync_enabled" qualifiers="const">
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if synchronizing the framerate to the monitor's refresh rate is enabled.
</description>
</method>
<method name="is_window_fullscreen" qualifiers="const">
<return type="bool">
</return>
<description>
- Returns whether the window is in fullscreen mode or not.
+ Returns [code]true[/code] if the window is in fullscreen mode.
</description>
</method>
<method name="is_window_maximized" qualifiers="const">
<return type="bool">
</return>
<description>
- Return true if the window is maximized.
+ Returns [code]true[/code] if the window is maximized.
</description>
</method>
<method name="is_window_minimized" qualifiers="const">
<return type="bool">
</return>
<description>
- Return true if the window is minimized.
+ Returns [code]true[/code] if the window is minimized.
</description>
</method>
<method name="is_window_resizable" qualifiers="const">
<return type="bool">
</return>
<description>
- Returns whether the window is resizable or not.
+ Returns [code]true[/code] if the window is resizable.
</description>
</method>
<method name="kill">
@@ -519,12 +542,14 @@
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if native video is playing.
</description>
</method>
<method name="native_video_pause">
<return type="void">
</return>
<description>
+ Pauses native video playback.
</description>
</method>
<method name="native_video_play">
@@ -539,18 +564,21 @@
<argument index="3" name="subtitle_track" type="String">
</argument>
<description>
+ Plays native video from the specified path, at the given volume and with audio and subtitle tracks.
</description>
</method>
<method name="native_video_stop">
<return type="void">
</return>
<description>
+ Stops native video playback.
</description>
</method>
<method name="native_video_unpause">
<return type="void">
</return>
<description>
+ Resumes native video playback.
</description>
</method>
<method name="print_all_resources">
@@ -559,12 +587,14 @@
<argument index="0" name="tofile" type="String" default="&quot;&quot;">
</argument>
<description>
+ Shows all resources in the game. Optionally the list can be written to a file.
</description>
</method>
<method name="print_all_textures_by_size">
<return type="void">
</return>
<description>
+ Shows the list of loaded textures sorted by size in memory.
</description>
</method>
<method name="print_resources_by_type">
@@ -573,6 +603,7 @@
<argument index="0" name="types" type="PoolStringArray">
</argument>
<description>
+ Shows the number of resources loaded by the game of the given types.
</description>
</method>
<method name="print_resources_in_use">
@@ -581,6 +612,7 @@
<argument index="0" name="short" type="bool" default="false">
</argument>
<description>
+ Shows all resources currently used by the game.
</description>
</method>
<method name="request_attention">
@@ -596,6 +628,7 @@
<argument index="0" name="borderless" type="bool">
</argument>
<description>
+ Removes the window frame.
</description>
</method>
<method name="set_clipboard">
@@ -604,7 +637,7 @@
<argument index="0" name="clipboard" type="String">
</argument>
<description>
- Set clipboard to the OS.
+ Sets clipboard to the OS.
</description>
</method>
<method name="set_current_screen">
@@ -613,6 +646,7 @@
<argument index="0" name="screen" type="int">
</argument>
<description>
+ Sets the current screen by index.
</description>
</method>
<method name="set_exit_code">
@@ -621,6 +655,7 @@
<argument index="0" name="code" type="int">
</argument>
<description>
+ Sets the exit code that will be returned by the game.
</description>
</method>
<method name="set_icon">
@@ -629,6 +664,7 @@
<argument index="0" name="icon" type="Image">
</argument>
<description>
+ Sets the game's icon.
</description>
</method>
<method name="set_ime_position">
@@ -645,7 +681,7 @@
<argument index="0" name="enabled" type="bool">
</argument>
<description>
- Set keep screen on if true, or goes to sleep by device setting if false. (for Android/iOS)
+ Sets keep screen on if true, or goes to sleep by device setting if false. (for Android/iOS)
</description>
</method>
<method name="set_low_processor_usage_mode">
@@ -654,7 +690,7 @@
<argument index="0" name="enable" type="bool">
</argument>
<description>
- Set to true to enable the low cpu usage mode. In this mode, the screen only redraws when there are changes, and a considerable sleep time is inserted between frames. This way, editors using the engine UI only use very little cpu.
+ Set to [code]true[/code] to enable the low cpu usage mode. In this mode, the screen only redraws when there are changes, and a considerable sleep time is inserted between frames. Use this in tool mode to reduce CPU usage.
</description>
</method>
<method name="set_screen_orientation">
@@ -672,6 +708,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
+ Sets the name of the current thread.
</description>
</method>
<method name="set_use_file_access_save_and_swap">
@@ -680,6 +717,7 @@
<argument index="0" name="enabled" type="bool">
</argument>
<description>
+ Enables backup saves if [code]enabled[/code] is [code]true[/code].
</description>
</method>
<method name="set_use_vsync">
@@ -688,6 +726,7 @@
<argument index="0" name="enable" type="bool">
</argument>
<description>
+ If [code]true[/code] the framerate will synchronize to the monitor's refresh rate.
</description>
</method>
<method name="set_window_fullscreen">
@@ -705,7 +744,7 @@
<argument index="0" name="enabled" type="bool">
</argument>
<description>
- Set the window size to maximized.
+ Set [code]true[/code] to maximize the window.
</description>
</method>
<method name="set_window_minimized">
@@ -714,7 +753,7 @@
<argument index="0" name="enabled" type="bool">
</argument>
<description>
- Set whether the window is minimized.
+ Set [code]true[/code] to minimize the window.
</description>
</method>
<method name="set_window_position">
@@ -732,7 +771,7 @@
<argument index="0" name="enabled" type="bool">
</argument>
<description>
- Set the window resizable state, if the window is not resizable it will preserve the dimensions specified in the project settings.
+ Sets the window resizable state, if the window is not resizable it will preserve the dimensions specified in the project settings.
</description>
</method>
<method name="set_window_size">
@@ -759,6 +798,9 @@
<argument index="0" name="uri" type="String">
</argument>
<description>
+ Requests the OS to open a resource with the most appropriate program. For example.
+ [code]OS.shell_open("C:\\Users\name\Downloads")[/code] on Windows opens the file explorer at the downloads folders of the user.
+ [code]OS.shell_open("http://godotengine.org")[/code] opens the default web browser on the official Godot website.
</description>
</method>
<method name="show_virtual_keyboard">
diff --git a/doc/classes/Particles.xml b/doc/classes/Particles.xml
index e17e60f2bc..1e89d2194c 100644
--- a/doc/classes/Particles.xml
+++ b/doc/classes/Particles.xml
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Particles" inherits="GeometryInstance" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ 3D particle emitter.
</brief_description>
<description>
+ 3D particle node used to create a variety of particle systems and effects. [code]Particles[/code] features an emitter that generates some number of particles at a given rate.
+ Use the [code]process_material[/code] property to add a [ParticlesMaterial] to configure particle appearance and behavior. Alternatively, you can add a [ShaderMaterial] which will be applied to all particles.
</description>
<tutorials>
</tutorials>
@@ -252,8 +255,10 @@
</methods>
<members>
<member name="amount" type="int" setter="set_amount" getter="get_amount">
+ Number of particles to emit.
</member>
<member name="draw_order" type="int" setter="set_draw_order" getter="get_draw_order" enum="Particles.DrawOrder">
+ Particle draw order. Uses [code]DRAW_ORDER_*[/code] values. Default value: [code]DRAW_ORDER_INDEX[/code].
</member>
<member name="draw_pass_1" type="Mesh" setter="set_draw_pass_mesh" getter="get_draw_pass_mesh">
</member>
@@ -266,36 +271,47 @@
<member name="draw_passes" type="int" setter="set_draw_passes" getter="get_draw_passes">
</member>
<member name="emitting" type="bool" setter="set_emitting" getter="is_emitting">
+ If [code]true[/code] particles are being emitted. Default value: [code]true[/code].
</member>
<member name="explosiveness" type="float" setter="set_explosiveness_ratio" getter="get_explosiveness_ratio">
+ Time ratio between each emission. If [code]0[/code] particles are emitted continuously. If [code]1[/code] all particles are emitted simultaneously. Default value: [code]0[/code].
</member>
<member name="fixed_fps" type="int" setter="set_fixed_fps" getter="get_fixed_fps">
</member>
<member name="fract_delta" type="bool" setter="set_fractional_delta" getter="get_fractional_delta">
</member>
<member name="lifetime" type="float" setter="set_lifetime" getter="get_lifetime">
+ Amount of time each particle will exist. Default value: [code]1[/code].
</member>
<member name="local_coords" type="bool" setter="set_use_local_coordinates" getter="get_use_local_coordinates">
+ If [code]true[/code] particles use the parent node's coordinate space. If [code]false[/code] they use global coordinates. Default value: [code]true[/code].
</member>
<member name="one_shot" type="bool" setter="set_one_shot" getter="get_one_shot">
+ If [code]true[/code] only [code]amount[/code] particles will be emitted. Default value: [code]false[/code].
</member>
<member name="preprocess" type="float" setter="set_pre_process_time" getter="get_pre_process_time">
</member>
<member name="process_material" type="Material" setter="set_process_material" getter="get_process_material">
+ [Material] for processing particles. Can be a [ParticlesMaterial] or a [ShaderMaterial].
</member>
<member name="randomness" type="float" setter="set_randomness_ratio" getter="get_randomness_ratio">
+ Emission randomness ratio. Default value: [code]0[/code].
</member>
<member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale">
+ Speed scaling ratio. Default value: [code]1[/code].
</member>
<member name="visibility_aabb" type="Rect3" setter="set_visibility_aabb" getter="get_visibility_aabb">
</member>
</members>
<constants>
<constant name="DRAW_ORDER_INDEX" value="0">
+ Particles are drawn in the order emitted.
</constant>
<constant name="DRAW_ORDER_LIFETIME" value="1">
+ Particles are drawn in order of remaining lifetime.
</constant>
<constant name="DRAW_ORDER_VIEW_DEPTH" value="2">
+ Particles are drawn in order of depth.
</constant>
<constant name="MAX_DRAW_PASSES" value="4" enum="">
</constant>
diff --git a/doc/classes/Particles2D.xml b/doc/classes/Particles2D.xml
index d837d6eb62..b2c63ea0c3 100644
--- a/doc/classes/Particles2D.xml
+++ b/doc/classes/Particles2D.xml
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Particles2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- 2D Particle emitter
+ 2D particle emitter.
</brief_description>
<description>
- Particles2D is a particle system 2D [Node] that is used to simulate several types of particle effects, such as explosions, rain, snow, fireflies, or other magical-like shinny sparkles. Particles are drawn using impostors, and given their dynamic behavior, the user must provide a visibility bounding box (although helpers to create one automatically exist).
+ 2D particle node used to create a variety of particle systems and effects. [code]Particles2D[/code] features an emitter that generates some number of particles at a given rate.
+ Use the [code]process_material[/code] property to add a [ParticlesMaterial] to configure particle appearance and behavior. Alternatively, you can add a [ShaderMaterial] which will be applied to all particles.
</description>
<tutorials>
</tutorials>
@@ -285,46 +286,61 @@
</methods>
<members>
<member name="amount" type="int" setter="set_amount" getter="get_amount">
+ Number of particles to emit.
</member>
<member name="draw_order" type="int" setter="set_draw_order" getter="get_draw_order" enum="Particles2D.DrawOrder">
+ Particle draw order. Uses [code]DRAW_ORDER_*[/code] values. Default value: [code]DRAW_ORDER_INDEX[/code].
</member>
<member name="emitting" type="bool" setter="set_emitting" getter="is_emitting">
+ If [code]true[/code] particles are being emitted. Default value: [code]true[/code].
</member>
<member name="explosiveness" type="float" setter="set_explosiveness_ratio" getter="get_explosiveness_ratio">
+ Time ratio between each emission. If [code]0[/code] particles are emitted continuously. If [code]1[/code] all particles are emitted simultaneously. Default value: [code]0[/code].
</member>
<member name="fixed_fps" type="int" setter="set_fixed_fps" getter="get_fixed_fps">
</member>
<member name="fract_delta" type="bool" setter="set_fractional_delta" getter="get_fractional_delta">
</member>
<member name="h_frames" type="int" setter="set_h_frames" getter="get_h_frames">
+ Number of horizontal frames in [code]texture[/code].
</member>
<member name="lifetime" type="float" setter="set_lifetime" getter="get_lifetime">
+ Amount of time each particle will exist. Default value: [code]1[/code].
</member>
<member name="local_coords" type="bool" setter="set_use_local_coordinates" getter="get_use_local_coordinates">
+ If [code]true[/code] particles use the parent node's coordinate space. If [code]false[/code] they use global coordinates. Default value: [code]true[/code].
</member>
<member name="normal_map" type="Texture" setter="set_normal_map" getter="get_normal_map">
</member>
<member name="one_shot" type="bool" setter="set_one_shot" getter="get_one_shot">
+ If [code]true[/code] only [code]amount[/code] particles will be emitted. Default value: [code]false[/code].
</member>
<member name="preprocess" type="float" setter="set_pre_process_time" getter="get_pre_process_time">
</member>
<member name="process_material" type="Material" setter="set_process_material" getter="get_process_material">
+ [Material] for processing particles. Can be a [ParticlesMaterial] or a [ShaderMaterial].
</member>
<member name="randomness" type="float" setter="set_randomness_ratio" getter="get_randomness_ratio">
+ Emission randomness ratio. Default value: [code]0[/code].
</member>
<member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale">
+ Speed scaling ratio. Default value: [code]1[/code].
</member>
<member name="texture" type="Texture" setter="set_texture" getter="get_texture">
+ Particle texture. If [code]null[/code] particles will be squares.
</member>
<member name="v_frames" type="int" setter="set_v_frames" getter="get_v_frames">
+ Number of vertical frames in [code]texture[/code].
</member>
<member name="visibility_rect" type="Rect2" setter="set_visibility_rect" getter="get_visibility_rect">
</member>
</members>
<constants>
<constant name="DRAW_ORDER_INDEX" value="0">
+ Particles are drawn in the order emitted.
</constant>
<constant name="DRAW_ORDER_LIFETIME" value="1">
+ Particles are drawn in order of remaining lifetime.
</constant>
</constants>
</class>
diff --git a/doc/classes/ParticlesMaterial.xml b/doc/classes/ParticlesMaterial.xml
index 1767a19a9f..bebdc44b69 100644
--- a/doc/classes/ParticlesMaterial.xml
+++ b/doc/classes/ParticlesMaterial.xml
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="ParticlesMaterial" inherits="Material" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Particle properties for [Particles] and [Particles2D] nodes.
</brief_description>
<description>
+ ParticlesMaterial defines particle properties and behavior. It is used in the [code]process_material[/code] of [Particles] and [Particles2D] emitter nodes.
+ Some of this material's properties are applied to each particle when emitted, while others can have a [CurveTexture] applied to vary values over the lifetime of the particle.
</description>
<tutorials>
</tutorials>
@@ -294,152 +297,217 @@
</methods>
<members>
<member name="angle" type="float" setter="set_param" getter="get_param">
+ Initial rotation applied to each particle.
</member>
<member name="angle_curve" type="Texture" setter="set_param_texture" getter="get_param_texture">
+ Each particle's rotation will be animated along this [CurveTexture].
</member>
<member name="angle_random" type="float" setter="set_param_randomness" getter="get_param_randomness">
+ Rotation randomness ratio. Default value: [code]0[/code].
</member>
<member name="angular_velocity" type="float" setter="set_param" getter="get_param">
+ Initial angular velocity applied to each particle.
</member>
<member name="angular_velocity_curve" type="Texture" setter="set_param_texture" getter="get_param_texture">
+ Each particle's angular velocity will vary along this [CurveTexture].
</member>
<member name="angular_velocity_random" type="float" setter="set_param_randomness" getter="get_param_randomness">
+ Angular velocity randomness ratio. Default value: [code]0[/code].
</member>
<member name="anim_loop" type="bool" setter="set_flag" getter="get_flag">
+ If [code]true[/code] animation will loop. Default value: [code]false[/code].
</member>
<member name="anim_offset" type="float" setter="set_param" getter="get_param">
+ Particle animation offset.
</member>
<member name="anim_offset_curve" type="Texture" setter="set_param_texture" getter="get_param_texture">
+ Each particle's animation offset will vary along this [CurveTexture].
</member>
<member name="anim_offset_random" type="float" setter="set_param_randomness" getter="get_param_randomness">
+ Animation offset randomness ratio. Default value: [code]0[/code].
</member>
<member name="anim_speed" type="float" setter="set_param" getter="get_param">
+ Particle animation speed.
</member>
<member name="anim_speed_curve" type="Texture" setter="set_param_texture" getter="get_param_texture">
+ Each particle's animation speed will vary along this [CurveTexture].
</member>
<member name="anim_speed_random" type="float" setter="set_param_randomness" getter="get_param_randomness">
+ Animation speed randomness ratio. Default value: [code]0[/code].
</member>
<member name="color" type="Color" setter="set_color" getter="get_color">
+ Each particle's initial color. If the [Particle2D]'s [code]texture[/code] is defined, it will be multiplied by this color.
</member>
<member name="color_ramp" type="Texture" setter="set_color_ramp" getter="get_color_ramp">
+ Each particle's color will vary along this [GradientTexture].
</member>
<member name="damping" type="float" setter="set_param" getter="get_param">
+ The rate at which particles lose velocity.
</member>
<member name="damping_curve" type="Texture" setter="set_param_texture" getter="get_param_texture">
+ Damping will vary along this [CurveTexture].
</member>
<member name="damping_random" type="float" setter="set_param_randomness" getter="get_param_randomness">
+ Damping randomness ratio. Default value: [code]0[/code].
</member>
<member name="emission_box_extents" type="Vector3" setter="set_emission_box_extents" getter="get_emission_box_extents">
+ The box's extents if [code]emission_shape[/code] is set to [code]EMISSION_SHAPE_BOX[/code].
</member>
<member name="emission_color_texture" type="Texture" setter="set_emission_color_texture" getter="get_emission_color_texture">
</member>
<member name="emission_normal_texture" type="Texture" setter="set_emission_normal_texture" getter="get_emission_normal_texture">
</member>
<member name="emission_point_count" type="int" setter="set_emission_point_count" getter="get_emission_point_count">
+ The number of emission points if [code]emission_shape[/code] is set to [code]EMISSION_SHAPE_POINTS[/code] or [code]EMISSION_SHAPE_DIRECTED_POINTS[/code].
</member>
<member name="emission_point_texture" type="Texture" setter="set_emission_point_texture" getter="get_emission_point_texture">
</member>
<member name="emission_shape" type="int" setter="set_emission_shape" getter="get_emission_shape" enum="ParticlesMaterial.EmissionShape">
+ Particles will be emitted inside this region. Use [code]EMISSION_SHAPE_*[/code] constants for values. Default value: [code]EMISSION_SHAPE_POINT[/code].
</member>
<member name="emission_sphere_radius" type="float" setter="set_emission_sphere_radius" getter="get_emission_sphere_radius">
+ The sphere's radius if [code]emission_shape[/code] is set to [code]EMISSION_SHAPE_SPHERE[/code].
</member>
<member name="flag_align_y" type="bool" setter="set_flag" getter="get_flag">
</member>
<member name="flag_disable_z" type="bool" setter="set_flag" getter="get_flag">
+ If [code]true[/code] particles will not move on the z axis. Default value: [code]true[/code] for [Particles2D], [code]false[/code] for [Particles].
</member>
<member name="flag_rotate_y" type="bool" setter="set_flag" getter="get_flag">
</member>
<member name="flatness" type="float" setter="set_flatness" getter="get_flatness">
</member>
<member name="gravity" type="Vector3" setter="set_gravity" getter="get_gravity">
+ Gravity applied to every particle. Default value: [code](0, 98, 0)[/code].
</member>
<member name="hue_variation" type="float" setter="set_param" getter="get_param">
+ Initial hue variation applied to each particle.
</member>
<member name="hue_variation_curve" type="Texture" setter="set_param_texture" getter="get_param_texture">
+ Each particle's hue will vary along this [CurveTexture].
</member>
<member name="hue_variation_random" type="float" setter="set_param_randomness" getter="get_param_randomness">
+ Hue variation randomness ratio. Default value: [code]0[/code].
</member>
<member name="initial_velocity" type="float" setter="set_param" getter="get_param">
+ Initial velocity for each particle.
</member>
<member name="initial_velocity_random" type="float" setter="set_param_randomness" getter="get_param_randomness">
+ Initial velocity randomness ratio. Default value: [code]0[/code].
</member>
<member name="linear_accel" type="float" setter="set_param" getter="get_param">
+ Linear acceleration applied to each particle.
</member>
<member name="linear_accel_curve" type="Texture" setter="set_param_texture" getter="get_param_texture">
+ Each particle's linear acceleration will vary along this [CurveTexture].
</member>
<member name="linear_accel_random" type="float" setter="set_param_randomness" getter="get_param_randomness">
+ Linear acceleration randomness ratio. Default value: [code]0[/code].
</member>
<member name="orbit_velocity" type="float" setter="set_param" getter="get_param">
+ Orbital velocity applied to each particle.
</member>
<member name="orbit_velocity_curve" type="Texture" setter="set_param_texture" getter="get_param_texture">
+ Each particle's orbital velocity will vary along this [CurveTexture].
</member>
<member name="orbit_velocity_random" type="float" setter="set_param_randomness" getter="get_param_randomness">
+ Orbital velocity randomness ratio. Default value: [code]0[/code].
</member>
<member name="radial_accel" type="float" setter="set_param" getter="get_param">
+ Linear acceleration applied to each particle.
</member>
<member name="radial_accel_curve" type="Texture" setter="set_param_texture" getter="get_param_texture">
+ Each particle's radial acceleration will vary along this [CurveTexture].
</member>
<member name="radial_accel_random" type="float" setter="set_param_randomness" getter="get_param_randomness">
+ Radial acceleration randomness ratio. Default value: [code]0[/code].
</member>
<member name="scale" type="float" setter="set_param" getter="get_param">
+ Initial scale applied to each particle.
</member>
<member name="scale_curve" type="Texture" setter="set_param_texture" getter="get_param_texture">
+ Each particle's scale will vary along this [CurveTexture].
</member>
<member name="scale_random" type="float" setter="set_param_randomness" getter="get_param_randomness">
+ Scale randomness ratio. Default value: [code]0[/code].
</member>
<member name="spread" type="float" setter="set_spread" getter="get_spread">
+ Each particle's initial direction range from [code]+spread[/code] to [code]-spread[/code] degrees. Default value: [code]45[/code].
</member>
<member name="tangential_accel" type="float" setter="set_param" getter="get_param">
+ Tangential acceleration applied to each particle. Tangential acceleration is perpendicular to the particle's velocity.
</member>
<member name="tangential_accel_curve" type="Texture" setter="set_param_texture" getter="get_param_texture">
+ Each particle's tangential acceleration will vary along this [CurveTexture].
</member>
<member name="tangential_accel_random" type="float" setter="set_param_randomness" getter="get_param_randomness">
+ Tangential acceleration randomness ratio. Default value: [code]0[/code].
</member>
<member name="trail_color_modifier" type="GradientTexture" setter="set_trail_color_modifier" getter="get_trail_color_modifier">
+ Trail particles' color will vary along this [GradientTexture].
</member>
<member name="trail_divisor" type="int" setter="set_trail_divisor" getter="get_trail_divisor">
+ Emitter will emit [code]amount[/code] divided by [code]trail_divisor[/code] particles. The remaining particles will be used as trail(s).
</member>
<member name="trail_size_modifier" type="CurveTexture" setter="set_trail_size_modifier" getter="get_trail_size_modifier">
+ Trail particles' size will vary along this [CurveTexture].
</member>
</members>
<constants>
<constant name="PARAM_INITIAL_LINEAR_VELOCITY" value="0">
+ Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set initial velocity properties.
</constant>
<constant name="PARAM_ANGULAR_VELOCITY" value="1">
+ Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set angular velocity properties.
</constant>
<constant name="PARAM_ORBIT_VELOCITY" value="2">
+ Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set orbital_velocity properties.
</constant>
<constant name="PARAM_LINEAR_ACCEL" value="3">
+ Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set linear acceleration properties.
</constant>
<constant name="PARAM_RADIAL_ACCEL" value="4">
+ Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set radial acceleration properties.
</constant>
<constant name="PARAM_TANGENTIAL_ACCEL" value="5">
+ Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set tangential acceleration properties.
</constant>
<constant name="PARAM_DAMPING" value="6">
+ Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set damping properties.
</constant>
<constant name="PARAM_ANGLE" value="7">
+ Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set angle properties.
</constant>
<constant name="PARAM_SCALE" value="8">
+ Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set scale properties.
</constant>
<constant name="PARAM_HUE_VARIATION" value="9">
+ Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set hue_variation properties.
</constant>
<constant name="PARAM_ANIM_SPEED" value="10">
+ Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set animation speed properties.
</constant>
<constant name="PARAM_ANIM_OFFSET" value="11">
+ Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set animation offset properties.
</constant>
<constant name="PARAM_MAX" value="12">
</constant>
<constant name="FLAG_ALIGN_Y_TO_VELOCITY" value="0">
+ Use with [method set_flag] to set [member flag_align_y].
</constant>
<constant name="FLAG_ROTATE_Y" value="1">
+ Use with [method set_flag] to set [member flag_rotate_y]
</constant>
<constant name="FLAG_MAX" value="4">
</constant>
<constant name="EMISSION_SHAPE_POINT" value="0">
+ All particles will be emitted from a single point.
</constant>
<constant name="EMISSION_SHAPE_SPHERE" value="1">
+ Particles will be emitted in the volume of a sphere.
</constant>
<constant name="EMISSION_SHAPE_BOX" value="2">
+ Particles will be emitted in the volume of a box.
</constant>
<constant name="EMISSION_SHAPE_POINTS" value="3">
</constant>
diff --git a/doc/classes/Performance.xml b/doc/classes/Performance.xml
index 71987ace9e..82ee3531f1 100644
--- a/doc/classes/Performance.xml
+++ b/doc/classes/Performance.xml
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Performance" inherits="Object" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Exposes performance related data.
</brief_description>
<description>
+ This class provides access to a number of different monitors related to performance, such as memory usage, draw calls, and FPS. These are the same as the values displayed in the [i]Monitor[/i] tab in the editor's [i]Debugger[/i] panel. By using the [method get_monitor] method of this class, you can access this data from your code. Note that a few of these monitors are only available in debug mode and will always return 0 when used in a release build.
+ Many of these monitors are not updated in real-time, so there may be a short delay between changes.
</description>
<tutorials>
</tutorials>
@@ -15,63 +18,93 @@
<argument index="0" name="monitor" type="int" enum="Performance.Monitor">
</argument>
<description>
+ Returns the value of one of the available monitors. You should provide one of this class's constants as the argument, like this:
+ [codeblock]
+ print(Performance.get_monitor(Performance.TIME_FPS)) # Prints the FPS to the console
+ [/codeblock]
</description>
</method>
</methods>
<constants>
<constant name="TIME_FPS" value="0">
+ Frames per second.
</constant>
<constant name="TIME_PROCESS" value="1">
+ Time it took to complete one frame.
</constant>
- <constant name="TIME_FIXED_PROCESS" value="2">
+ <constant name="TIME_PHYSICS_PROCESS" value="2">
+ Time it took to complete one physics frame.
</constant>
<constant name="MEMORY_STATIC" value="3">
+ Static memory currently used, in bytes. Not available in release builds.
</constant>
<constant name="MEMORY_DYNAMIC" value="4">
+ Dynamic memory currently used, in bytes. Not available in release builds.
</constant>
<constant name="MEMORY_STATIC_MAX" value="5">
+ Available static memory. Not available in release builds.
</constant>
<constant name="MEMORY_DYNAMIC_MAX" value="6">
+ Available dynamic memory. Not available in release builds.
</constant>
<constant name="MEMORY_MESSAGE_BUFFER_MAX" value="7">
+ Largest amount of memory the message queue buffer has used, in bytes. The message queue is used for deferred functions calls and notifications.
</constant>
<constant name="OBJECT_COUNT" value="8">
+ Number of objects currently instanced (including nodes).
</constant>
<constant name="OBJECT_RESOURCE_COUNT" value="9">
+ Number of resources currently used.
</constant>
<constant name="OBJECT_NODE_COUNT" value="10">
+ Number of nodes currently instanced. This also includes the root node, as well as any nodes not in the scene tree.
</constant>
<constant name="RENDER_OBJECTS_IN_FRAME" value="11">
+ 3D objects drawn per frame.
</constant>
<constant name="RENDER_VERTICES_IN_FRAME" value="12">
+ Vertices drawn per frame. 3D only.
</constant>
<constant name="RENDER_MATERIAL_CHANGES_IN_FRAME" value="13">
+ Material changes per frame. 3D only
</constant>
<constant name="RENDER_SHADER_CHANGES_IN_FRAME" value="14">
+ Shader changes per frame. 3D only.
</constant>
<constant name="RENDER_SURFACE_CHANGES_IN_FRAME" value="15">
+ Render surface changes per frame. 3D only.
</constant>
<constant name="RENDER_DRAW_CALLS_IN_FRAME" value="16">
- </constant>
- <constant name="RENDER_USAGE_VIDEO_MEM_TOTAL" value="20">
+ Draw calls per frame. 3D only.
</constant>
<constant name="RENDER_VIDEO_MEM_USED" value="17">
+ Video memory used. Includes both texture and vertex memory.
</constant>
<constant name="RENDER_TEXTURE_MEM_USED" value="18">
+ Texture memory used.
</constant>
<constant name="RENDER_VERTEX_MEM_USED" value="19">
+ Vertex memory used.
+ </constant>
+ <constant name="RENDER_USAGE_VIDEO_MEM_TOTAL" value="20">
</constant>
<constant name="PHYSICS_2D_ACTIVE_OBJECTS" value="21">
+ Number of active [RigidBody2D] nodes in the game.
</constant>
<constant name="PHYSICS_2D_COLLISION_PAIRS" value="22">
+ Number of collision pairs in the 2D physics engine.
</constant>
<constant name="PHYSICS_2D_ISLAND_COUNT" value="23">
+ Number of islands in the 2D physics engine.
</constant>
<constant name="PHYSICS_3D_ACTIVE_OBJECTS" value="24">
+ Number of active [RigidBody] and [VehicleBody] nodes in the game.
</constant>
<constant name="PHYSICS_3D_COLLISION_PAIRS" value="25">
+ Number of collision pairs in the 3D physics engine.
</constant>
<constant name="PHYSICS_3D_ISLAND_COUNT" value="26">
+ Number of islands in the 3D physics engine.
</constant>
<constant name="MONITOR_MAX" value="27">
</constant>
diff --git a/doc/classes/Polygon2D.xml b/doc/classes/Polygon2D.xml
index 05869c514e..23cb9bd91b 100644
--- a/doc/classes/Polygon2D.xml
+++ b/doc/classes/Polygon2D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Polygon2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- 2D polygon representation
+ A 2D polygon.
</brief_description>
<description>
- A Polygon2D is defined by a set of n vertices connected together by line segments, meaning that the vertex 1 will be connected with vertex 2, vertex 2 with vertex 3 ..., vertex n-1 with vertex n and vertex n with vertex 1 in order to close the loop and define a polygon.
+ A Polygon2D is defined by a set of points. Each point is connected to the next, with the final point being connected to the first, resulting in a closed polygon. Polygon2Ds can be filled with color (solid or gradient) or filled with a given texture.
</description>
<tutorials>
</tutorials>
@@ -204,28 +204,40 @@
</methods>
<members>
<member name="antialiased" type="bool" setter="set_antialiased" getter="get_antialiased">
+ If [code]true[/code] polygon edges will be anti-aliased. Default value: [code]false[/code].
</member>
<member name="color" type="Color" setter="set_color" getter="get_color">
+ The polygon's fill color. If [code]texture[/code] is defined, it will be multiplied by this color. It will also be the default color for vertices not set in [code]vertex_colors[/code].
</member>
<member name="invert_border" type="float" setter="set_invert_border" getter="get_invert_border">
+ Added padding applied to the bounding box when using [code]invert[/code]. Setting this value too small may result in a "Bad Polygon" error. Default value: [code]100[/code].
</member>
<member name="invert_enable" type="bool" setter="set_invert" getter="get_invert">
+ If [code]true[/code] polygon will be inverted, containing the area outside the defined points and extending to the [code]invert_border[/code]. Default value: [code]false[/code].
</member>
<member name="offset" type="Vector2" setter="set_offset" getter="get_offset">
+ The offset applied to each vertex.
</member>
<member name="polygon" type="PoolVector2Array" setter="set_polygon" getter="get_polygon">
+ The polygon's list of vertices. The final point will be connected to the first.
</member>
<member name="texture" type="Texture" setter="set_texture" getter="get_texture">
+ The polygon's fill texture. Use [code]uv[/code] to set texture coordinates.
</member>
<member name="texture_offset" type="Vector2" setter="set_texture_offset" getter="get_texture_offset">
+ Amount to offset the polygon's [code]texture[/code]. If [code](0, 0)[/code] the texture's origin (its top-left corner) will be placed at the polygon's [code]position[/code].
</member>
<member name="texture_rotation" type="float" setter="_set_texture_rotationd" getter="_get_texture_rotationd">
+ The texture's rotation in degrees.
</member>
<member name="texture_scale" type="Vector2" setter="set_texture_scale" getter="get_texture_scale">
+ Amount to multiply the [code]uv[/code] coordinates when using a [code]texture[/code]. Larger values make the texture smaller, and vice versa.
</member>
<member name="uv" type="PoolVector2Array" setter="set_uv" getter="get_uv">
+ Texture coordinates for each vertex of the polygon. There should be one [code]uv[/code] per polygon vertex. If there are fewer, undefined vertices will use [code](0, 0)[/code].
</member>
<member name="vertex_colors" type="PoolColorArray" setter="set_vertex_colors" getter="get_vertex_colors">
+ Color for each vertex. Colors are interpolated between vertices, resulting in smooth gradients. There should be one per polygon vertex. If there are fewer, undefined vertices will use [code]color[/code].
</member>
</members>
<constants>
diff --git a/doc/classes/Range.xml b/doc/classes/Range.xml
index 9af6abf7b8..cd75c2b658 100644
--- a/doc/classes/Range.xml
+++ b/doc/classes/Range.xml
@@ -138,29 +138,38 @@
<argument index="0" name="with" type="Node">
</argument>
<description>
+ Binds two Ranges together along with any Ranges previously grouped with either of them. When any of Range's member variables change, it will share the new value with all other Ranges in its group.
</description>
</method>
<method name="unshare">
<return type="void">
</return>
<description>
+ Stop Range from sharing its member variables with any other Range.
</description>
</method>
</methods>
<members>
<member name="exp_edit" type="bool" setter="set_exp_ratio" getter="is_ratio_exp">
+ If [code]true[/code] and [code]min_value[/code] is greater than 0, [code]value[/code] will be represented exponentially rather than linearly.
</member>
<member name="max_value" type="float" setter="set_max" getter="get_max">
+ Maximum value. Range is clamped if [code]value[/code] is greater than [code]max_value[/code]. Default value: 100.
</member>
<member name="min_value" type="float" setter="set_min" getter="get_min">
+ Minimum value. Range is clamped if [code]value[/code] is less than [code]min_value[/code]. Default value: 0.
</member>
<member name="page" type="float" setter="set_page" getter="get_page">
+ Page size. Used mainly for [ScrollBar]. ScrollBar's length is its size multiplied by [code]page[/code] over the difference between [code]min_value[/code] and [code]max_value[/code].
</member>
<member name="rounded" type="bool" setter="set_use_rounded_values" getter="is_using_rounded_values">
+ If [code]true[/code], [code]value[/code] will always be rounded to the nearest integer.
</member>
<member name="step" type="float" setter="set_step" getter="get_step">
+ If greater than 0, [code]value[/code] will always be rounded to a multiple of [code]step[/code]. If [code]rounded[/code] is also [code]true[/code], [code]value[/code] will first be rounded to a multiple of [code]step[/code] then rounded to the nearest integer.
</member>
<member name="value" type="float" setter="set_value" getter="get_value">
+ Range's current value.
</member>
</members>
<signals>
diff --git a/doc/classes/RayShape.xml b/doc/classes/RayShape.xml
index 7fab9c3949..d5d367a335 100644
--- a/doc/classes/RayShape.xml
+++ b/doc/classes/RayShape.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="RayShape" inherits="Shape" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Ray shape for 3D collisions.
</brief_description>
<description>
+ Ray shape for 3D collisions, which can be set into a [PhysicsBody] or [Area]. A ray is not really a collision body, instead it tries to separate itself from whatever is touching its far endpoint. It's often useful for characters.
</description>
<tutorials>
</tutorials>
@@ -26,6 +28,7 @@
</methods>
<members>
<member name="length" type="float" setter="set_length" getter="get_length">
+ The ray's length.
</member>
</members>
<constants>
diff --git a/doc/classes/RegEx.xml b/doc/classes/RegEx.xml
index 626f8f1a93..4577672c72 100644
--- a/doc/classes/RegEx.xml
+++ b/doc/classes/RegEx.xml
@@ -5,7 +5,7 @@
</brief_description>
<description>
Class for finding text patterns in a string using regular expressions. It can not perform replacements. Regular expressions are a way to define patterns of text to be searched. Details on writing patterns are too long to explain here but the Internet is full of tutorials and detailed explanations.
- Once created, the RegEx object needs to be compiled with the pattern before it can be used. The pattern must be escaped first for gdscript before it is escaped for the expression. For example:
+ Once created, the RegEx object needs to be compiled with the search pattern before it can be used. The search pattern must be escaped first for gdscript before it is escaped for the expression. For example:
[code]var exp = RegEx.new()[/code]
[code]exp.compile("\\d+")[/code]
would be read by RegEx as [code]\d+[/code]
@@ -47,7 +47,7 @@
<argument index="0" name="pattern" type="String">
</argument>
<description>
- Compiles and assign the regular expression pattern to use.
+ Compiles and assign the search pattern to use.
</description>
</method>
<method name="get_group_count" qualifiers="const">
@@ -68,14 +68,14 @@
<return type="String">
</return>
<description>
- Returns the expression used to compile the code.
+ Returns the search pattern used to compile the code.
</description>
</method>
<method name="is_valid" qualifiers="const">
<return type="bool">
</return>
<description>
- Returns whether this object has a valid regular expression assigned.
+ Returns whether this object has a valid search pattern assigned.
</description>
</method>
<method name="search" qualifiers="const">
@@ -88,7 +88,7 @@
<argument index="2" name="end" type="int" default="-1">
</argument>
<description>
- Searches the text for the compiled pattern. Returns a [RegExMatch] container of the first matching reult if found, otherwise null. The region to search within can be specified without modifying where the start and end anchor would be.
+ Searches the text for the compiled pattern. Returns a [RegExMatch] container of the first matching result if found, otherwise null. The region to search within can be specified without modifying where the start and end anchor would be.
</description>
</method>
<method name="sub" qualifiers="const">
diff --git a/doc/classes/RegExMatch.xml b/doc/classes/RegExMatch.xml
index 9e021ed6c8..abf2e383d5 100644
--- a/doc/classes/RegExMatch.xml
+++ b/doc/classes/RegExMatch.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="RegExMatch" inherits="Reference" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Contains the results of a regex search.
</brief_description>
<description>
+ Contains the results of a regex search. [method RegEx.search] returns an instance of [code]RegExMatch[/code] if it finds the search pattern in the [source] string.
</description>
<tutorials>
</tutorials>
@@ -15,7 +17,7 @@
<argument index="0" name="name" type="Variant" default="0">
</argument>
<description>
- Returns the end position of the match in the string. An integer can be specified for numeric groups or a string for named groups. Returns -1 if that group wasn't found or doesn't exist. Defaults to 0 (whole pattern).
+ Returns the end position of the match in the [source] string. An integer can be specified for numeric groups or a string for named groups. Returns -1 if that group wasn't found or doesn't exist. Defaults to 0 (whole pattern).
</description>
</method>
<method name="get_group_count" qualifiers="const">
@@ -38,7 +40,7 @@
<argument index="0" name="name" type="Variant" default="0">
</argument>
<description>
- Returns the starting position of the match in the string. An integer can be specified for numeric groups or a string for named groups. Returns -1 if that group wasn't found or doesn't exist. Defaults to 0 (whole pattern).
+ Returns the starting position of the match in the [source] string. An integer can be specified for numeric groups or a string for named groups. Returns -1 if that group wasn't found or doesn't exist. Defaults to 0 (whole pattern).
</description>
</method>
<method name="get_string" qualifiers="const">
@@ -47,19 +49,21 @@
<argument index="0" name="name" type="Variant" default="0">
</argument>
<description>
- Returns the result of the match in the string. An integer can be specified for numeric groups or a string for named groups. Returns -1 if that group wasn't found or doesn't exist. Defaults to 0 (whole pattern).
+ Returns the result of the match in the [source] string. An integer can be specified for numeric groups or a string for named groups. Returns -1 if that group wasn't found or doesn't exist. Defaults to 0 (whole pattern).
</description>
</method>
<method name="get_strings" qualifiers="const">
<return type="Array">
</return>
<description>
+ Returns an [Array] of the matches in the [source] string.
</description>
</method>
<method name="get_subject" qualifiers="const">
<return type="String">
</return>
<description>
+ Returns the [source] string used with the search pattern to find this matching result.
</description>
</method>
</methods>
diff --git a/doc/classes/RichTextLabel.xml b/doc/classes/RichTextLabel.xml
index 90ee76cb98..9f8cdcce6d 100644
--- a/doc/classes/RichTextLabel.xml
+++ b/doc/classes/RichTextLabel.xml
@@ -47,6 +47,12 @@
<description>
</description>
</method>
+ <method name="get_line_count" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="get_percent_visible" qualifiers="const">
<return type="float">
</return>
@@ -84,6 +90,12 @@
<description>
</description>
</method>
+ <method name="get_visible_line_count" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="is_meta_underlined" qualifiers="const">
<return type="bool">
</return>
diff --git a/doc/classes/Shape.xml b/doc/classes/Shape.xml
index 8e6e12a736..4d822a1705 100644
--- a/doc/classes/Shape.xml
+++ b/doc/classes/Shape.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Shape" inherits="Resource" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Base class for all 3D shape resources.
</brief_description>
<description>
+ Base class for all 3D shape resources. All 3D shapes that inherit from this can be set into a [PhysicsBody] or [Area].
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/SpatialMaterial.xml b/doc/classes/SpatialMaterial.xml
index 0f1c57e85b..344a42b7c0 100644
--- a/doc/classes/SpatialMaterial.xml
+++ b/doc/classes/SpatialMaterial.xml
@@ -105,6 +105,18 @@
<description>
</description>
</method>
+ <method name="get_distance_fade_max_distance" qualifiers="const">
+ <return type="float">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_distance_fade_min_distance" qualifiers="const">
+ <return type="float">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="get_emission" qualifiers="const">
<return type="Color">
</return>
@@ -187,6 +199,12 @@
<description>
</description>
</method>
+ <method name="get_proximity_fade_distance" qualifiers="const">
+ <return type="float">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="get_refraction" qualifiers="const">
<return type="float">
</return>
@@ -297,12 +315,24 @@
<description>
</description>
</method>
+ <method name="is_distance_fade_enabled" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="is_grow_enabled" qualifiers="const">
<return type="bool">
</return>
<description>
</description>
</method>
+ <method name="is_proximity_fade_enabled" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="set_albedo">
<return type="void">
</return>
@@ -439,6 +469,30 @@
<description>
</description>
</method>
+ <method name="set_distance_fade">
+ <return type="void">
+ </return>
+ <argument index="0" name="enabled" type="bool">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_distance_fade_max_distance">
+ <return type="void">
+ </return>
+ <argument index="0" name="distance" type="float">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_distance_fade_min_distance">
+ <return type="void">
+ </return>
+ <argument index="0" name="distance" type="float">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="set_emission">
<return type="void">
</return>
@@ -555,6 +609,22 @@
<description>
</description>
</method>
+ <method name="set_proximity_fade">
+ <return type="void">
+ </return>
+ <argument index="0" name="enabled" type="bool">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_proximity_fade_distance">
+ <return type="void">
+ </return>
+ <argument index="0" name="distance" type="float">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="set_refraction">
<return type="void">
</return>
@@ -745,6 +815,12 @@
</member>
<member name="detail_uv_layer" type="int" setter="set_detail_uv" getter="get_detail_uv" enum="SpatialMaterial.DetailUV">
</member>
+ <member name="distance_fade_enable" type="bool" setter="set_distance_fade" getter="is_distance_fade_enabled">
+ </member>
+ <member name="distance_fade_max_distance" type="float" setter="set_distance_fade_max_distance" getter="get_distance_fade_max_distance">
+ </member>
+ <member name="distance_fade_min_distance" type="float" setter="set_distance_fade_min_distance" getter="get_distance_fade_min_distance">
+ </member>
<member name="emission" type="Color" setter="set_emission" getter="get_emission">
</member>
<member name="emission_enabled" type="bool" setter="set_feature" getter="get_feature">
@@ -811,6 +887,10 @@
</member>
<member name="particles_anim_v_frames" type="int" setter="set_particles_anim_v_frames" getter="get_particles_anim_v_frames">
</member>
+ <member name="proximity_fade_distance" type="float" setter="set_proximity_fade_distance" getter="get_proximity_fade_distance">
+ </member>
+ <member name="proximity_fade_enable" type="bool" setter="set_proximity_fade" getter="is_proximity_fade_enabled">
+ </member>
<member name="refraction_enabled" type="bool" setter="set_feature" getter="get_feature">
</member>
<member name="refraction_scale" type="float" setter="set_refraction" getter="get_refraction">
diff --git a/doc/classes/SphereShape.xml b/doc/classes/SphereShape.xml
index 120c7fcc25..7c6174f4e4 100644
--- a/doc/classes/SphereShape.xml
+++ b/doc/classes/SphereShape.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="SphereShape" inherits="Shape" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Sphere shape for 3D collisions.
</brief_description>
<description>
+ Sphere shape for 3D collisions, which can be set into a [PhysicsBody] or [Area]. This shape is useful for modeling sphere-like 3D objects.
</description>
<tutorials>
</tutorials>
@@ -26,6 +28,7 @@
</methods>
<members>
<member name="radius" type="float" setter="set_radius" getter="get_radius">
+ The sphere's radius. The shape's diameter is double the radius.
</member>
</members>
<constants>
diff --git a/doc/classes/Sprite.xml b/doc/classes/Sprite.xml
index 90ebe79666..0cdc8f7099 100644
--- a/doc/classes/Sprite.xml
+++ b/doc/classes/Sprite.xml
@@ -4,7 +4,7 @@
General purpose Sprite node.
</brief_description>
<description>
- General purpose Sprite node. This Sprite node can show any texture as a sprite. The texture can be used as a spritesheet for animation, or only a region from a bigger texture can referenced, like an atlas.
+ A node that displays a 2D texture. The texture displayed can be a region from a larger atlas texture, or a frame from a sprite sheet animation.
</description>
<tutorials>
</tutorials>
@@ -202,37 +202,51 @@
</methods>
<members>
<member name="centered" type="bool" setter="set_centered" getter="is_centered">
+ If [code]true[/code] texture is centered. Default value: [code]true[/code].
</member>
<member name="flip_h" type="bool" setter="set_flip_h" getter="is_flipped_h">
+ If [code]true[/code] texture is flipped horizontally. Default value: [code]false[/code].
</member>
<member name="flip_v" type="bool" setter="set_flip_v" getter="is_flipped_v">
+ If [code]true[/code] texture is flipped vertically. Default value: [code]false[/code].
</member>
<member name="frame" type="int" setter="set_frame" getter="get_frame">
+ Current frame to display from sprite sheet. [member vframes] or [member hframes] must be greater than 1.
</member>
<member name="hframes" type="int" setter="set_hframes" getter="get_hframes">
+ The number of collumns in the sprite sheet.
</member>
<member name="normal_map" type="Texture" setter="set_normal_map" getter="get_normal_map">
+ The normal map gives depth to the Sprite.
</member>
<member name="offset" type="Vector2" setter="set_offset" getter="get_offset">
+ The texture's drawing offset.
</member>
<member name="region_enabled" type="bool" setter="set_region" getter="is_region">
+ If [code]true[/code] texture is cut from a larger atlas texture. See [code]region_rect[/code]. Default value: [code]false[/code].
</member>
<member name="region_filter_clip" type="bool" setter="set_region_filter_clip" getter="is_region_filter_clip_enabled">
+ If [code]true[/code] the outermost pixels get blurred out.
</member>
<member name="region_rect" type="Rect2" setter="set_region_rect" getter="get_region_rect">
+ The region of the atlas texture to display. [member region_enabled] must be [code]true[/code].
</member>
<member name="texture" type="Texture" setter="set_texture" getter="get_texture">
+ [Texture] object to draw.
</member>
<member name="vframes" type="int" setter="set_vframes" getter="get_vframes">
+ The number of rows in the sprite sheet.
</member>
</members>
<signals>
<signal name="frame_changed">
<description>
+ Emitted when the [member frame] changes.
</description>
</signal>
<signal name="texture_changed">
<description>
+ Emitted when the [member texture] changes.
</description>
</signal>
</signals>
diff --git a/doc/classes/Sprite3D.xml b/doc/classes/Sprite3D.xml
index f6f2f8f00c..e51616a071 100644
--- a/doc/classes/Sprite3D.xml
+++ b/doc/classes/Sprite3D.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Sprite3D" inherits="SpriteBase3D" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ 2D Sprite node in 3D world.
</brief_description>
<description>
+ A node that displays a 2D texture in a 3D environment. The texture displayed can be a region from a larger atlas texture, or a frame from a sprite sheet animation.
</description>
<tutorials>
</tutorials>
@@ -96,21 +98,28 @@
</methods>
<members>
<member name="frame" type="int" setter="set_frame" getter="get_frame">
+ Current frame to display from sprite sheet. [member vframes] or [member hframes] must be greater than 1.
</member>
<member name="hframes" type="int" setter="set_hframes" getter="get_hframes">
+ The number of columns in the sprite sheet.
</member>
<member name="region_enabled" type="bool" setter="set_region" getter="is_region">
+ If [code]true[/code] texture will be cut from a larger atlas texture. See [member region_rect]. Default value: [code]false[/code].
</member>
<member name="region_rect" type="Rect2" setter="set_region_rect" getter="get_region_rect">
+ The region of the atlas texture to display. [member region_enabled] must be [code]true[/code].
</member>
<member name="texture" type="Texture" setter="set_texture" getter="get_texture">
+ [Texture] object to draw.
</member>
<member name="vframes" type="int" setter="set_vframes" getter="get_vframes">
+ The number of rows in the sprite sheet.
</member>
</members>
<signals>
<signal name="frame_changed">
<description>
+ Emitted when the [member frame] changes.
</description>
</signal>
</signals>
diff --git a/doc/classes/SpriteBase3D.xml b/doc/classes/SpriteBase3D.xml
index 1640e5dc9f..7ed681ea12 100644
--- a/doc/classes/SpriteBase3D.xml
+++ b/doc/classes/SpriteBase3D.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="SpriteBase3D" inherits="GeometryInstance" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ 2D Sprite node in 3D environment.
</brief_description>
<description>
+ A node that displays 2D texture information in a 3D environment.
</description>
<tutorials>
</tutorials>
@@ -164,36 +166,51 @@
<member name="alpha_cut" type="int" setter="set_alpha_cut_mode" getter="get_alpha_cut_mode" enum="SpriteBase3D.AlphaCutMode">
</member>
<member name="axis" type="int" setter="set_axis" getter="get_axis" enum="Vector3.Axis">
+ The direction in which the front of the texture faces.
</member>
<member name="centered" type="bool" setter="set_centered" getter="is_centered">
+ If [code]true[/code] texture will be centered. Default value: [code]true[/code].
</member>
<member name="double_sided" type="bool" setter="set_draw_flag" getter="get_draw_flag">
+ If [code]true[/code] texture can be seen from the back as well, if [code]false[/code], it is invisible when looking at it from behind. Default value: [code]true[/code].
</member>
<member name="flip_h" type="bool" setter="set_flip_h" getter="is_flipped_h">
+ If [code]true[/code] texture is flipped horizontally. Default value: [code]false[/code].
</member>
<member name="flip_v" type="bool" setter="set_flip_v" getter="is_flipped_v">
+ If [code]true[/code] texture is flipped vertically. Default value: [code]false[/code].
</member>
<member name="modulate" type="Color" setter="set_modulate" getter="get_modulate">
+ A color value that gets multiplied on, could be used for mood-coloring or to simulate the color of light.
</member>
<member name="offset" type="Vector2" setter="set_offset" getter="get_offset">
+ The texture's drawing offset.
</member>
<member name="opacity" type="float" setter="set_opacity" getter="get_opacity">
+ The objects visibility on a scale from [code]0[/code] fully invisible to [code]1[/code] fully visible.
</member>
<member name="pixel_size" type="float" setter="set_pixel_size" getter="get_pixel_size">
+ The size of one pixel's width on the Sprite to scale it in 3D.
</member>
<member name="shaded" type="bool" setter="set_draw_flag" getter="get_draw_flag">
+ If [code]true[/code] the [Light] in the [Environment] has effects on the Sprite. Default value: [code]false[/code].
</member>
<member name="transparent" type="bool" setter="set_draw_flag" getter="get_draw_flag">
+ If [code]true[/code] the texture's transparency and the opacity are used to make those parts of the Sprite invisible. Default value: [code]true[/code].
</member>
</members>
<constants>
<constant name="FLAG_TRANSPARENT" value="0">
+ If set, the texture's transparency and the opacity are used to make those parts of the Sprite invisible.
</constant>
<constant name="FLAG_SHADED" value="1">
+ If set, the Light in the Environment has effects on the Sprite.
</constant>
<constant name="FLAG_DOUBLE_SIDED" value="2">
+ If set, texture can be seen from the back as well, if not, it is invisible when looking at it from behind.
</constant>
<constant name="FLAG_MAX" value="3">
+ Used internally to mark the end of the Flags section.
</constant>
<constant name="ALPHA_CUT_DISABLED" value="0">
</constant>
diff --git a/doc/classes/SpriteFrames.xml b/doc/classes/SpriteFrames.xml
index f4a8eeabe4..e46fdc80e0 100644
--- a/doc/classes/SpriteFrames.xml
+++ b/doc/classes/SpriteFrames.xml
@@ -4,7 +4,7 @@
Sprite frame library for AnimatedSprite.
</brief_description>
<description>
- Sprite frame library for [AnimatedSprite].
+ Sprite frame library for [AnimatedSprite]. Contains frames and animation data for playback.
</description>
<tutorials>
</tutorials>
@@ -17,6 +17,7 @@
<argument index="0" name="anim" type="String">
</argument>
<description>
+ Adds a new animation to the the library.
</description>
</method>
<method name="add_frame">
@@ -29,6 +30,7 @@
<argument index="2" name="at_position" type="int" default="-1">
</argument>
<description>
+ Adds a frame to the given animation.
</description>
</method>
<method name="clear">
@@ -37,12 +39,14 @@
<argument index="0" name="anim" type="String">
</argument>
<description>
+ Removes all frames from the given animation.
</description>
</method>
<method name="clear_all">
<return type="void">
</return>
<description>
+ Removes all animations. A "default" animation will be created.
</description>
</method>
<method name="get_animation_loop" qualifiers="const">
@@ -51,6 +55,7 @@
<argument index="0" name="anim" type="String">
</argument>
<description>
+ If [code]true[/code] the given animation will loop.
</description>
</method>
<method name="get_animation_speed" qualifiers="const">
@@ -59,6 +64,7 @@
<argument index="0" name="anim" type="String">
</argument>
<description>
+ The animation's speed in frames per second.
</description>
</method>
<method name="get_frame" qualifiers="const">
@@ -69,6 +75,7 @@
<argument index="1" name="idx" type="int">
</argument>
<description>
+ Returns the animation's selected frame.
</description>
</method>
<method name="get_frame_count" qualifiers="const">
@@ -77,6 +84,7 @@
<argument index="0" name="anim" type="String">
</argument>
<description>
+ Returns the number of frames in the animation.
</description>
</method>
<method name="has_animation" qualifiers="const">
@@ -85,6 +93,7 @@
<argument index="0" name="anim" type="String">
</argument>
<description>
+ If [code]true[/code] the named animation exists.
</description>
</method>
<method name="remove_animation">
@@ -93,6 +102,7 @@
<argument index="0" name="anim" type="String">
</argument>
<description>
+ Removes the given animation.
</description>
</method>
<method name="remove_frame">
@@ -103,6 +113,7 @@
<argument index="1" name="idx" type="int">
</argument>
<description>
+ Removes the animation's selected frame.
</description>
</method>
<method name="rename_animation">
@@ -113,6 +124,7 @@
<argument index="1" name="newname" type="String">
</argument>
<description>
+ Changes the animation's name to [code]newname[/code].
</description>
</method>
<method name="set_animation_loop">
@@ -123,6 +135,7 @@
<argument index="1" name="loop" type="bool">
</argument>
<description>
+ If [code]true[/code] the animation will loop.
</description>
</method>
<method name="set_animation_speed">
@@ -133,6 +146,7 @@
<argument index="1" name="speed" type="float">
</argument>
<description>
+ The animation's speed in frames per second.
</description>
</method>
<method name="set_frame">
@@ -145,11 +159,13 @@
<argument index="2" name="txt" type="Texture">
</argument>
<description>
+ Sets the texture of the given frame.
</description>
</method>
</methods>
<members>
<member name="animations" type="Array" setter="_set_animations" getter="_get_animations">
+ An [Array] containing the [code]name[/code], [code]speed[/code], [code]loop[/code], and [code]frames[/code] of each animation.
</member>
<member name="frames" type="Array" setter="_set_frames" getter="_get_frames">
</member>
diff --git a/doc/classes/StaticBody2D.xml b/doc/classes/StaticBody2D.xml
index 2f23ac588b..cff41074b8 100644
--- a/doc/classes/StaticBody2D.xml
+++ b/doc/classes/StaticBody2D.xml
@@ -4,9 +4,8 @@
Static body for 2D Physics.
</brief_description>
<description>
- Static body for 2D Physics. A static body is a simple body that is not intended to move. They don't consume any CPU resources in contrast to a [RigidBody2D] so they are great for scenario collision.
- A static body can also be animated by using simulated motion mode. This is useful for implementing functionalities such as moving platforms. When this mode is active the body can be animated and automatically computes linear and angular velocity to apply in that frame and to influence other bodies.
- Alternatively, a constant linear or angular velocity can be set for the static body, so even if it doesn't move, it affects other bodies as if it was moving (this is useful for simulating conveyor belts or conveyor wheels).
+ Static body for 2D Physics. A StaticBody2D is a body that is not intended to move. It is ideal for implementing objects in the environment, such as walls or platforms.
+ Additionally, a constant linear or angular velocity can be set for the static body, which will affect colliding bodies as if it were moving (for example, a conveyor belt).
</description>
<tutorials>
</tutorials>
@@ -80,12 +79,16 @@
</methods>
<members>
<member name="bounce" type="float" setter="set_bounce" getter="get_bounce">
+ The body's bounciness. Values range from [code]0[/code] (no bounce) to [code]1[/code] (full bounciness).
</member>
<member name="constant_angular_velocity" type="float" setter="set_constant_angular_velocity" getter="get_constant_angular_velocity">
+ Constant angular velocity for the body. This does not rotate the body, but affects colliding bodies, as if it were rotating.
</member>
<member name="constant_linear_velocity" type="Vector2" setter="set_constant_linear_velocity" getter="get_constant_linear_velocity">
+ Constant linear velocity for the body. This does not move the body, but affects colliding bodies, as if it were moving.
</member>
<member name="friction" type="float" setter="set_friction" getter="get_friction">
+ The body's friction. Values range from [code]0[/code] (no friction) to [code]1[/code] (full friction).
</member>
</members>
<constants>
diff --git a/doc/classes/TextureButton.xml b/doc/classes/TextureButton.xml
index e4f00555b3..8e51548c10 100644
--- a/doc/classes/TextureButton.xml
+++ b/doc/classes/TextureButton.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="TextureButton" inherits="BaseButton" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Button that can be themed with textures.
+ Texture-based button. Supports Pressed, Hover, Disabled and Focused states.
</brief_description>
<description>
- Button that can be themed with textures. This is like a regular [Button] but can be themed by assigning textures to it. This button is intended to be easy to theme, however a regular button can expand (that uses styleboxes) and still be better if the interface is expect to have internationalization of texts.
- Only the normal texture is required, the others are optional.
+ [code]TextureButton[/code] has the same functionality as [Button], except it uses sprites instead of Godot's [Theme] resource. It is faster to create, but it doesn't support localization like more complex Controls.
+ The Normal state's texture is required. Others are optional.
</description>
<tutorials>
</tutorials>
@@ -127,36 +127,51 @@
</methods>
<members>
<member name="expand" type="bool" setter="set_expand" getter="get_expand">
+ If [code]true[/code] the texture stretches to the edges of the node's bounding rectangle using the [member stretch_mode]. If [code]false[/code] the texture will not scale with the node. Default value: [code]false[/code].
</member>
<member name="stretch_mode" type="int" setter="set_stretch_mode" getter="get_stretch_mode" enum="TextureButton.StretchMode">
+ Controls the texture's behavior when you resize the node's bounding rectangle, [b]only if[/b] [member expand] is [code]true[/code]. Set it to one of the [code]STRETCH_*[/code] constants. See the constants to learn more.
</member>
<member name="texture_click_mask" type="BitMap" setter="set_click_mask" getter="get_click_mask">
+ Pure black and white [Bitmap] image to use for click detection. On the mask, white pixels represent the button's clickable area. Use it to create buttons with curved shapes.
</member>
<member name="texture_disabled" type="Texture" setter="set_disabled_texture" getter="get_disabled_texture">
+ Texture to display when the node is disabled. See [member BaseButton.disabled].
</member>
<member name="texture_focused" type="Texture" setter="set_focused_texture" getter="get_focused_texture">
+ Texture to display when the node has mouse or keyboard focus.
</member>
<member name="texture_hover" type="Texture" setter="set_hover_texture" getter="get_hover_texture">
+ Texture to display when the mouse hovers the node.
</member>
<member name="texture_normal" type="Texture" setter="set_normal_texture" getter="get_normal_texture">
+ Texture to display by default, when the node is [b]not[/b] in the disabled, focused, hover or pressed state.
</member>
<member name="texture_pressed" type="Texture" setter="set_pressed_texture" getter="get_pressed_texture">
+ Texture to display on mouse down over the node, if the node has keyboard focus and the player presses the enter key or if the player presses the [member BaseButton.shortcut] key.
</member>
</members>
<constants>
<constant name="STRETCH_SCALE" value="0">
+ Scale to fit the node's bounding rectangle.
</constant>
<constant name="STRETCH_TILE" value="1">
+ Tile inside the node's bounding rectangle.
</constant>
<constant name="STRETCH_KEEP" value="2">
+ The texture keeps its original size and stays in the bounding rectangle's top-left corner.
</constant>
<constant name="STRETCH_KEEP_CENTERED" value="3">
+ The texture keeps its original size and stays centered in the node's bounding rectangle.
</constant>
<constant name="STRETCH_KEEP_ASPECT" value="4">
+ Scale the texture to fit the node's bounding rectangle, but maintain the texture's aspect ratio.
</constant>
<constant name="STRETCH_KEEP_ASPECT_CENTERED" value="5">
+ Scale the texture to fit the node's bounding rectangle, center it, and maintain its aspect ratio.
</constant>
<constant name="STRETCH_KEEP_ASPECT_COVERED" value="6">
+ Scale the texture so that the shorter side fits the bounding rectangle. The other side clips to the node's limits.
</constant>
</constants>
</class>
diff --git a/doc/classes/TextureProgress.xml b/doc/classes/TextureProgress.xml
index 0a6ffcdeb8..f8165753c6 100644
--- a/doc/classes/TextureProgress.xml
+++ b/doc/classes/TextureProgress.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="TextureProgress" inherits="Range" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Textured progress bar.
+ Texture-based progress bar. Useful for loading screens and life or stamina bars.
</brief_description>
<description>
- A [ProgressBar] that uses textures to display fill percentage. Can be set to linear or radial mode.
+ TextureProgress works like [ProgressBar] but it uses up to 3 textures instead of Godot's [Theme] resource. Works horizontally, vertically, and radially.
</description>
<tutorials>
</tutorials>
@@ -151,51 +151,59 @@
The fill direction. Uses FILL_* constants.
</member>
<member name="nine_patch_stretch" type="bool" setter="set_nine_patch_stretch" getter="get_nine_patch_stretch">
- If [code]true[/code] textures will be stretched as [NinePatchRect]. Uses [code]stretch_margin[/code] properties (see below). Default value: [code]false[/code]
+ If [code]true[/code] Godot treats the bar's textures like [NinePatchRect]. Use [code]stretch_margin_*[/code], like [member stretch_margin_bottom], to set up the nine patch's 3x3 grid. Default value: [code]false[/code].
</member>
<member name="radial_center_offset" type="Vector2" setter="set_radial_center_offset" getter="get_radial_center_offset">
- The offset amount for radial mode.
+ Offsets [member texture_progress] if [member fill_mode] is [code]FILL_CLOCKWISE[/code] or [code]FILL_COUNTER_CLOCKWISE[/code].
</member>
<member name="radial_fill_degrees" type="float" setter="set_fill_degrees" getter="get_fill_degrees">
- The amount of the texture to use for radial mode.
+ Upper limit for the fill of [member texture_progress] if [member fill_mode] is [code]FILL_CLOCKWISE[/code] or [code]FILL_COUNTER_CLOCKWISE[/code]. When the node's [code]value[/code] is equal to its [code]max_value[/code], the texture fills up to this angle.
+ See [member Range.value], [member Range.max_value].
</member>
<member name="radial_initial_angle" type="float" setter="set_radial_initial_angle" getter="get_radial_initial_angle">
- Start angle for radial mode.
+ Starting angle for the fill of [member texture_progress] if [member fill_mode] is [code]FILL_CLOCKWISE[/code] or [code]FILL_COUNTER_CLOCKWISE[/code]. When the node's [code]value[/code] is equal to its [code]min_value[/code], the texture doesn't show up at all. When the [code]value[/code] increases, the texture fills and tends towards [member radial_fill_degrees].
</member>
<member name="stretch_margin_bottom" type="int" setter="set_stretch_margin" getter="get_stretch_margin">
- Nine-patch texture offset for bottom margin.
+ The height of the 9-patch's bottom row. A margin of 16 means the 9-slice's bottom corners and side will have a height of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders.
</member>
<member name="stretch_margin_left" type="int" setter="set_stretch_margin" getter="get_stretch_margin">
- Nine-patch texture offset for left margin.
+ The width of the 9-patch's left column.
</member>
<member name="stretch_margin_right" type="int" setter="set_stretch_margin" getter="get_stretch_margin">
- Nine-patch texture offset for right margin.
+ The width of the 9-patch's right column.
</member>
<member name="stretch_margin_top" type="int" setter="set_stretch_margin" getter="get_stretch_margin">
- Nine-patch texture offset for top margin.
+ The height of the 9-patch's top row.
</member>
<member name="texture_over" type="Texture" setter="set_over_texture" getter="get_over_texture">
- The [Texture] that will be drawn over the progress bar.
+ [Texture] that draws over the progress bar. Use it to add highlights or an upper-frame that hides part of [member texture_progress].
</member>
<member name="texture_progress" type="Texture" setter="set_progress_texture" getter="get_progress_texture">
- The [Texture] used to display [code]value[/code].
+ [Texture] that clips based on the node's [code]value[/code] and [member fill_mode]. As [code]value[/code] increased, the texture fills up. It shows entirely when [code]value[/code] reaches [code]max_value[/code]. It doesn't show at all if [code]value[/code] is equal to [code]min_value[/code].
+ The [code]value[/code] property comes from [Range]. See [member Range.value], [member Range.min_value], [member Range.max_value].
</member>
<member name="texture_under" type="Texture" setter="set_under_texture" getter="get_under_texture">
- The [Texture] that will be drawn under the progress bar.
+ [Texture] that draws under the progress bar. The bar's background.
</member>
</members>
<constants>
<constant name="FILL_LEFT_TO_RIGHT" value="0">
+ The [member texture_progress] fills from left to right.
</constant>
<constant name="FILL_RIGHT_TO_LEFT" value="1">
+ The [member texture_progress] fills from right to left.
</constant>
<constant name="FILL_TOP_TO_BOTTOM" value="2">
+ The [member texture_progress] fills from top to bototm.
</constant>
<constant name="FILL_BOTTOM_TO_TOP" value="3">
+ The [member texture_progress] fills from bottom to top.
</constant>
<constant name="FILL_CLOCKWISE" value="4">
+ Turns the node into a radial bar. The [member texture_progress] fills clockwise. See [member radial_center_offset], [member radial_initial_angle] and [member radial_fill_degrees] to refine its behavior.
</constant>
<constant name="FILL_COUNTER_CLOCKWISE" value="5">
+ Turns the node into a radial bar. The [member texture_progress] fills counter-clockwise. See [member radial_center_offset], [member radial_initial_angle] and [member radial_fill_degrees] to refine its behavior.
</constant>
</constants>
</class>
diff --git a/doc/classes/Transform2D.xml b/doc/classes/Transform2D.xml
index a90013f922..0e39505ac3 100644
--- a/doc/classes/Transform2D.xml
+++ b/doc/classes/Transform2D.xml
@@ -36,7 +36,7 @@
<method name="Transform2D">
<return type="Transform2D">
</return>
- <argument index="0" name="rot" type="float">
+ <argument index="0" name="rotation" type="float">
</argument>
<argument index="1" name="position" type="Vector2">
</argument>
diff --git a/doc/classes/Tree.xml b/doc/classes/Tree.xml
index 82e85126cc..bf9245d23a 100644
--- a/doc/classes/Tree.xml
+++ b/doc/classes/Tree.xml
@@ -4,8 +4,8 @@
Control to show a tree of items.
</brief_description>
<description>
- This shows a tree of items that can be selected, expanded and collapsed. The tree can have multiple columns with custom controls like text editing, buttons and popups. It can be useful for structural displaying and interactions.
- Trees are built via code, using [TreeItem] objects to create the structure. They have a single root but multiple root can be simulated if a dummy hidden root is added.
+ This shows a tree of items that can be selected, expanded and collapsed. The tree can have multiple columns with custom controls like text editing, buttons and popups. It can be useful for structured displays and interactions.
+ Trees are built via code, using [TreeItem] objects to create the structure. They have a single root but multiple roots can be simulated if a dummy hidden root is added.
[codeblock]
func _ready():
var tree = Tree.new()
@@ -26,14 +26,14 @@
<return type="bool">
</return>
<description>
- Get whether the column titles are being shown.
+ Returns [code]true[/code] if the column titles are being shown.
</description>
</method>
<method name="clear">
<return type="void">
</return>
<description>
- Clear the tree. This erases all of the items.
+ Clears the tree. This removes all items.
</description>
</method>
<method name="create_item">
@@ -42,27 +42,28 @@
<argument index="0" name="parent" type="Object" default="null">
</argument>
<description>
- Create an item in the tree and add it as the last child of [code]parent[/code]. If parent is not given, it will be added as the last child of the root, or it'll the be the root itself if the tree is empty.
+ Create an item in the tree and add it as the last child of [code]parent[/code]. If parent is not given, it will be added as the root's last child, or it'll the be the root itself if the tree is empty.
</description>
</method>
<method name="ensure_cursor_is_visible">
<return type="void">
</return>
<description>
- Make the current selected item visible. This will scroll the tree to make sure the selected item is in sight.
+ Makes the currently selected item visible. This will scroll the tree to make sure the selected item is visible.
</description>
</method>
<method name="get_allow_reselect" qualifiers="const">
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if a cell that is currently already selected may be selected again.
</description>
</method>
<method name="get_allow_rmb_select" qualifiers="const">
<return type="bool">
</return>
<description>
- Get whether a right click can select items.
+ Returns [code]true[/code] if a right click can select items.
</description>
</method>
<method name="get_column_at_position" qualifiers="const">
@@ -71,7 +72,7 @@
<argument index="0" name="position" type="Vector2">
</argument>
<description>
- Get the column index under the given point.
+ Returns the column index under the given point.
</description>
</method>
<method name="get_column_title" qualifiers="const">
@@ -80,7 +81,7 @@
<argument index="0" name="column" type="int">
</argument>
<description>
- Get the title of the given column.
+ Returns the column's title.
</description>
</method>
<method name="get_column_width" qualifiers="const">
@@ -89,28 +90,28 @@
<argument index="0" name="column" type="int">
</argument>
<description>
- Get the width of the given column in pixels.
+ Returns the column's width in pixels.
</description>
</method>
<method name="get_columns" qualifiers="const">
<return type="int">
</return>
<description>
- Get the amount of columns.
+ Returns the amount of columns.
</description>
</method>
<method name="get_custom_popup_rect" qualifiers="const">
<return type="Rect2">
</return>
<description>
- Get the rectangle for custom popups. Helper to create custom cell controls that display a popup. See [method TreeItem.set_cell_mode].
+ Returns the rectangle for custom popups. Helper to create custom cell controls that display a popup. See [method TreeItem.set_cell_mode].
</description>
</method>
<method name="get_drop_mode_flags" qualifiers="const">
<return type="int">
</return>
<description>
- Get the flags of the current drop mode.
+ Returns the current drop mode's flags.
</description>
</method>
<method name="get_drop_section_at_position" qualifiers="const">
@@ -125,14 +126,14 @@
<return type="TreeItem">
</return>
<description>
- Get the current edited item. This is only available for custom cell mode.
+ Returns the currently edited item. This is only available for custom cell mode.
</description>
</method>
<method name="get_edited_column" qualifiers="const">
<return type="int">
</return>
<description>
- Get the column of the cell for the current edited icon. This is only available for custom cell mode.
+ Returns the column for the currently edited item. This is only available for custom cell mode.
</description>
</method>
<method name="get_item_area_rect" qualifiers="const">
@@ -143,7 +144,7 @@
<argument index="1" name="column" type="int" default="-1">
</argument>
<description>
- Get the rectangle area of the the specified item. If column is specified, only get the position and size of that column, otherwise get the rectangle containing all columns.
+ Returns the rectangle area for the specified item. If column is specified, only get the position and size of that column, otherwise get the rectangle containing all columns.
</description>
</method>
<method name="get_item_at_position" qualifiers="const">
@@ -152,7 +153,7 @@
<argument index="0" name="position" type="Vector2">
</argument>
<description>
- Get the tree item at the specified position (relative to the tree origin position).
+ Returns the tree item at the specified position (relative to the tree origin position).
</description>
</method>
<method name="get_next_selected">
@@ -161,49 +162,49 @@
<argument index="0" name="from" type="Object">
</argument>
<description>
- Get the next selected item after the given one.
+ Returns the next selected item after the given one.
</description>
</method>
<method name="get_pressed_button" qualifiers="const">
<return type="int">
</return>
<description>
- Get the index of the last pressed button.
+ Returns the last pressed button's index.
</description>
</method>
<method name="get_root">
<return type="TreeItem">
</return>
<description>
- Get the root item of the tree.
+ Returns the tree's root item.
</description>
</method>
<method name="get_scroll" qualifiers="const">
<return type="Vector2">
</return>
<description>
- Get the current scrolling position.
+ Returns the current scrolling position.
</description>
</method>
<method name="get_selected" qualifiers="const">
<return type="TreeItem">
</return>
<description>
- Get the currently selected item.
+ Returns the currently selected item.
</description>
</method>
<method name="get_selected_column" qualifiers="const">
<return type="int">
</return>
<description>
- Get the column number of the current selection.
+ Returns the current selection's column.
</description>
</method>
<method name="is_folding_hidden" qualifiers="const">
<return type="bool">
</return>
<description>
- Get whether the folding arrow is hidden.
+ Returns [code]true[/code] if the folding arrow is hidden.
</description>
</method>
<method name="set_allow_reselect">
@@ -212,6 +213,7 @@
<argument index="0" name="allow" type="bool">
</argument>
<description>
+ If [code]true[/code] the currently selected cell may be selected again.
</description>
</method>
<method name="set_allow_rmb_select">
@@ -220,7 +222,7 @@
<argument index="0" name="allow" type="bool">
</argument>
<description>
- Set whether or not a right mouse button click can select items.
+ If [code]true[/code] a right mouse button click can select items.
</description>
</method>
<method name="set_column_expand">
@@ -231,7 +233,7 @@
<argument index="1" name="expand" type="bool">
</argument>
<description>
- Set whether a column will have the "Expand" flag of [Control].
+ If [code]true[/code] the column will have the "Expand" flag of [Control].
</description>
</method>
<method name="set_column_min_width">
@@ -262,7 +264,7 @@
<argument index="0" name="visible" type="bool">
</argument>
<description>
- Set whether the column titles visibility.
+ If [code]true[/code] column titles are visible.
</description>
</method>
<method name="set_columns">
@@ -289,7 +291,7 @@
<argument index="0" name="hide" type="bool">
</argument>
<description>
- Set whether the folding arrow should be hidden.
+ If [code]true[/code] the folding arrow is hidden.
</description>
</method>
<method name="set_hide_root">
@@ -298,7 +300,7 @@
<argument index="0" name="enable" type="bool">
</argument>
<description>
- Set whether the root of the tree should be hidden.
+ If [code]true[/code] the tree's root is hidden.
</description>
</method>
<method name="set_select_mode">
@@ -307,7 +309,7 @@
<argument index="0" name="mode" type="int" enum="Tree.SelectMode">
</argument>
<description>
- Set the selection mode. Use one of the [code]SELECT_*[/code] constants.
+ Allow single or multiple selection. See the [code]SELECT_*[/code] constants.
</description>
</method>
</methods>
@@ -332,6 +334,7 @@
<argument index="0" name="column" type="int">
</argument>
<description>
+ Emitted when a column's title is pressed.
</description>
</signal>
<signal name="custom_popup_edited">
@@ -366,15 +369,17 @@
</signal>
<signal name="item_double_clicked">
<description>
+ Emitted when an item is double clicked.
</description>
</signal>
<signal name="item_edited">
<description>
- Emitted when an item is editted.
+ Emitted when an item is edited.
</description>
</signal>
<signal name="item_rmb_edited">
<description>
+ Emitted when an item is edited using the right mouse button.
</description>
</signal>
<signal name="item_rmb_selected">
@@ -397,15 +402,18 @@
<argument index="2" name="selected" type="bool">
</argument>
<description>
+ Emitted instead of [code]item_selected[/code] when [code]select_mode[/code] is [code]SELECT_MULTI[/code].
</description>
</signal>
</signals>
<constants>
<constant name="SELECT_SINGLE" value="0">
+ Allow selection of a single item at a time.
</constant>
<constant name="SELECT_ROW" value="1">
</constant>
<constant name="SELECT_MULTI" value="2">
+ Allow selection of multiple items at the same time.
</constant>
<constant name="DROP_MODE_DISABLED" value="0">
</constant>
diff --git a/doc/classes/TreeItem.xml b/doc/classes/TreeItem.xml
index d1e45bd10f..10ebc72134 100644
--- a/doc/classes/TreeItem.xml
+++ b/doc/classes/TreeItem.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="TreeItem" inherits="Object" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Control for a single item inside a [Tree].
</brief_description>
<description>
+ Control for a single item inside a [Tree]. May have child [TreeItem]\ s and be styled as well as contain buttons.
</description>
<tutorials>
</tutorials>
@@ -23,6 +25,7 @@
<argument index="4" name="tooltip" type="String" default="&quot;&quot;">
</argument>
<description>
+ Adds a button with [Texture] [code]button[/code] at column [code]column[/code]. The [code]button_idx[/code] index is used to identify the button when calling other methods. If not specified, the next available index is used, which may be retrieved by calling [code]get_buton_count()[/code] immediately after this method. Optionally, the button can be [code]disabled[/code] and have a [code]tooltip[/code].
</description>
</method>
<method name="clear_custom_bg_color">
@@ -31,6 +34,7 @@
<argument index="0" name="column" type="int">
</argument>
<description>
+ Resets the background color for the given column to default.
</description>
</method>
<method name="clear_custom_color">
@@ -39,6 +43,7 @@
<argument index="0" name="column" type="int">
</argument>
<description>
+ Resets the color for the given column to default.
</description>
</method>
<method name="deselect">
@@ -47,6 +52,7 @@
<argument index="0" name="column" type="int">
</argument>
<description>
+ Deselects the given column.
</description>
</method>
<method name="erase_button">
@@ -57,6 +63,7 @@
<argument index="1" name="button_idx" type="int">
</argument>
<description>
+ Removes the button at index [code]button_idx[/code] in column [code]column[/code].
</description>
</method>
<method name="get_button" qualifiers="const">
@@ -67,6 +74,7 @@
<argument index="1" name="button_idx" type="int">
</argument>
<description>
+ Returns the [Texture] of the button at index [code]button_idx[/code] in column [code]column[/code].
</description>
</method>
<method name="get_button_count" qualifiers="const">
@@ -75,6 +83,7 @@
<argument index="0" name="column" type="int">
</argument>
<description>
+ Returns the number of buttons in column [code]column[/code]. May be used to get the most recently added button's index, if no index was specified.
</description>
</method>
<method name="get_cell_mode" qualifiers="const">
@@ -83,12 +92,14 @@
<argument index="0" name="column" type="int">
</argument>
<description>
+ Returns the column's cell mode. See [code]CELL_MODE_*[/code] constants.
</description>
</method>
<method name="get_children">
<return type="TreeItem">
</return>
<description>
+ Returns the TreeItem's child items.
</description>
</method>
<method name="get_custom_bg_color" qualifiers="const">
@@ -97,12 +108,14 @@
<argument index="0" name="column" type="int">
</argument>
<description>
+ Returns the custom background color of column [code]column[/code].
</description>
</method>
<method name="get_custom_minimum_height" qualifiers="const">
<return type="int">
</return>
<description>
+ Returns the custom minimum height.
</description>
</method>
<method name="get_expand_right" qualifiers="const">
@@ -111,6 +124,7 @@
<argument index="0" name="column" type="int">
</argument>
<description>
+ Returns [code]true[/code] if [code]expand_right[/code] is set.
</description>
</method>
<method name="get_icon" qualifiers="const">
@@ -119,6 +133,7 @@
<argument index="0" name="column" type="int">
</argument>
<description>
+ Returns the given column's icon [Texture]. Error if no icon is set.
</description>
</method>
<method name="get_icon_max_width" qualifiers="const">
@@ -127,6 +142,7 @@
<argument index="0" name="column" type="int">
</argument>
<description>
+ Returns the column's icon's maximum width.
</description>
</method>
<method name="get_icon_region" qualifiers="const">
@@ -135,6 +151,7 @@
<argument index="0" name="column" type="int">
</argument>
<description>
+ Returns the icon [Texture] region as [Rect2].
</description>
</method>
<method name="get_metadata" qualifiers="const">
@@ -149,30 +166,35 @@
<return type="TreeItem">
</return>
<description>
+ Returns the next TreeItem in the tree.
</description>
</method>
<method name="get_next_visible">
<return type="TreeItem">
</return>
<description>
+ Returns the next visible TreeItem in the tree.
</description>
</method>
<method name="get_parent">
<return type="TreeItem">
</return>
<description>
+ Returns the parent TreeItem.
</description>
</method>
<method name="get_prev">
<return type="TreeItem">
</return>
<description>
+ Returns the previous TreeItem in the tree.
</description>
</method>
<method name="get_prev_visible">
<return type="TreeItem">
</return>
<description>
+ Returns the previous visible TreeItem in the tree.
</description>
</method>
<method name="get_range" qualifiers="const">
@@ -197,6 +219,7 @@
<argument index="0" name="column" type="int">
</argument>
<description>
+ Returns the given column's text.
</description>
</method>
<method name="get_text_align" qualifiers="const">
@@ -205,6 +228,7 @@
<argument index="0" name="column" type="int">
</argument>
<description>
+ Returns the given column's text alignment.
</description>
</method>
<method name="get_tooltip" qualifiers="const">
@@ -213,6 +237,7 @@
<argument index="0" name="column" type="int">
</argument>
<description>
+ Returns the given column's tooltip.
</description>
</method>
<method name="is_button_disabled" qualifiers="const">
@@ -223,6 +248,7 @@
<argument index="1" name="button_idx" type="int">
</argument>
<description>
+ Returns [code]true[/code] if the button at index [code]button_idx[/code] for the given column is disabled.
</description>
</method>
<method name="is_checked" qualifiers="const">
@@ -231,12 +257,14 @@
<argument index="0" name="column" type="int">
</argument>
<description>
+ Returns [code]true[/code] if the given column is checked.
</description>
</method>
<method name="is_collapsed">
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if this TreeItem is collapsed.
</description>
</method>
<method name="is_custom_set_as_button" qualifiers="const">
@@ -253,12 +281,14 @@
<argument index="0" name="column" type="int">
</argument>
<description>
+ Returns [code]true[/code] if column [code]column[/code] is editable.
</description>
</method>
<method name="is_folding_disabled" qualifiers="const">
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if folding is disabled for this TreeItem.
</description>
</method>
<method name="is_selectable" qualifiers="const">
@@ -267,6 +297,7 @@
<argument index="0" name="column" type="int">
</argument>
<description>
+ Returns [code]true[/code] if column [code]column[/code] is selectable.
</description>
</method>
<method name="is_selected">
@@ -275,18 +306,21 @@
<argument index="0" name="column" type="int">
</argument>
<description>
+ Returns [code]true[/code] if column [code]column[/code] is selected.
</description>
</method>
<method name="move_to_bottom">
<return type="void">
</return>
<description>
+ Moves this TreeItem to the bottom in the [Tree] hierarchy.
</description>
</method>
<method name="move_to_top">
<return type="void">
</return>
<description>
+ Moves this TreeItem to the top in the [Tree] hierarchy.
</description>
</method>
<method name="remove_child">
@@ -295,6 +329,7 @@
<argument index="0" name="child" type="Object">
</argument>
<description>
+ Removes the child TreeItem at index [code]index[/code].
</description>
</method>
<method name="select">
@@ -303,6 +338,7 @@
<argument index="0" name="column" type="int">
</argument>
<description>
+ Selects the column [code]column[/code].
</description>
</method>
<method name="set_button">
@@ -315,6 +351,7 @@
<argument index="2" name="button" type="Texture">
</argument>
<description>
+ Sets the given column's button [Texture] at index [code]button_idx[/code] to [code]button[/code].
</description>
</method>
<method name="set_cell_mode">
@@ -325,6 +362,7 @@
<argument index="1" name="mode" type="int" enum="TreeItem.TreeCellMode">
</argument>
<description>
+ Sets the given column's cell mode to [code]mode[/code]. See [code]CELL_MODE_*[/code] constants.
</description>
</method>
<method name="set_checked">
@@ -335,6 +373,7 @@
<argument index="1" name="checked" type="bool">
</argument>
<description>
+ If [code]true[/code] the column [code]column[/code] is checked.
</description>
</method>
<method name="set_collapsed">
@@ -343,6 +382,7 @@
<argument index="0" name="enable" type="bool">
</argument>
<description>
+ If [code]true[/code] the TreeItem is collapsed.
</description>
</method>
<method name="set_custom_as_button">
@@ -365,6 +405,7 @@
<argument index="2" name="just_outline" type="bool" default="false">
</argument>
<description>
+ Sets the given column's custom background color and whether to just use it as an outline.
</description>
</method>
<method name="set_custom_color">
@@ -375,6 +416,7 @@
<argument index="1" name="color" type="Color">
</argument>
<description>
+ Sets the given column's custom color.
</description>
</method>
<method name="set_custom_draw">
@@ -387,6 +429,7 @@
<argument index="2" name="callback" type="String">
</argument>
<description>
+ Sets the given column's custom draw callback to [code]callback[/code] method on [code]object[/code].
</description>
</method>
<method name="set_custom_minimum_height">
@@ -395,6 +438,7 @@
<argument index="0" name="height" type="int">
</argument>
<description>
+ Sets the custom minimum height of this TreeItem.
</description>
</method>
<method name="set_disable_folding">
@@ -403,6 +447,7 @@
<argument index="0" name="disable" type="bool">
</argument>
<description>
+ If [code]true[/code] folding is disabled for this TreeItem.
</description>
</method>
<method name="set_editable">
@@ -413,6 +458,7 @@
<argument index="1" name="enabled" type="bool">
</argument>
<description>
+ If [code]true[/code] column [code]column[/code] is editable.
</description>
</method>
<method name="set_expand_right">
@@ -423,6 +469,7 @@
<argument index="1" name="enable" type="bool">
</argument>
<description>
+ If [code]true[/code] column [code]column[/code] is expanded to the right.
</description>
</method>
<method name="set_icon">
@@ -433,6 +480,7 @@
<argument index="1" name="texture" type="Texture">
</argument>
<description>
+ Sets the given column's icon [Texture].
</description>
</method>
<method name="set_icon_max_width">
@@ -443,6 +491,7 @@
<argument index="1" name="width" type="int">
</argument>
<description>
+ Sets the given column's icon's maximum width.
</description>
</method>
<method name="set_icon_region">
@@ -453,6 +502,7 @@
<argument index="1" name="region" type="Rect2">
</argument>
<description>
+ Sets the given column's icon's texture region.
</description>
</method>
<method name="set_metadata">
@@ -499,6 +549,7 @@
<argument index="1" name="selectable" type="bool">
</argument>
<description>
+ If [code]true[/code] the given column is selectable.
</description>
</method>
<method name="set_text">
@@ -519,6 +570,7 @@
<argument index="1" name="text_align" type="int" enum="TreeItem.TextAlign">
</argument>
<description>
+ Sets the given column's text alignment. See [code]ALIGN_*[/code] constants.
</description>
</method>
<method name="set_tooltip">
@@ -529,27 +581,36 @@
<argument index="1" name="tooltip" type="String">
</argument>
<description>
+ Sets the given column's tooltip text.
</description>
</method>
</methods>
<constants>
<constant name="CELL_MODE_STRING" value="0">
+ Cell contains a string.
</constant>
<constant name="CELL_MODE_CHECK" value="1">
+ Cell can be checked.
</constant>
<constant name="CELL_MODE_RANGE" value="2">
+ Cell contains a range.
</constant>
<constant name="CELL_MODE_RANGE_EXPRESSION" value="3">
+ Cell contains a range expression.
</constant>
<constant name="CELL_MODE_ICON" value="4">
+ Cell contains an icon.
</constant>
<constant name="CELL_MODE_CUSTOM" value="5">
</constant>
<constant name="ALIGN_LEFT" value="0">
+ Align text to the left. See [code]set_text_align()[/code].
</constant>
<constant name="ALIGN_CENTER" value="1">
+ Center text. See [code]set_text_align()[/code].
</constant>
<constant name="ALIGN_RIGHT" value="2">
+ Align text to the right. See [code]set_text_align()[/code].
</constant>
</constants>
</class>
diff --git a/doc/classes/VideoPlayer.xml b/doc/classes/VideoPlayer.xml
index 57e417974e..bac7d1e3b0 100644
--- a/doc/classes/VideoPlayer.xml
+++ b/doc/classes/VideoPlayer.xml
@@ -156,6 +156,15 @@
Set the video stream for this player.
</description>
</method>
+ <method name="set_stream_position">
+ <return type="void">
+ </return>
+ <argument index="0" name="position" type="float">
+ </argument>
+ <description>
+ Set the current position of the stream, in seconds.
+ </description>
+ </method>
<method name="set_volume">
<return type="void">
</return>
diff --git a/doc/classes/VisualScript.xml b/doc/classes/VisualScript.xml
index 6473b074d3..e44547cd8f 100644
--- a/doc/classes/VisualScript.xml
+++ b/doc/classes/VisualScript.xml
@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualScript" inherits="Script" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ A script implemented in the Visual Script programming environment.
</brief_description>
<description>
+ A script implemented in the Visual Script programming environment. The script exends the functionality of all objects that instance it.
+ [method Object.set_script] extends an existing object, if that object's class matches one of the script's base classes.
+ You are most likely to use this class via the Visual Script editor or when writing plugins for it.
</description>
<tutorials>
</tutorials>
@@ -15,6 +19,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
+ Add a custom signal with the specified name to the VisualScript.
</description>
</method>
<method name="add_function">
@@ -23,6 +28,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
+ Add a function with the specified name to the VisualScript.
</description>
</method>
<method name="add_node">
@@ -37,6 +43,7 @@
<argument index="3" name="position" type="Vector2" default="Vector2( 0, 0 )">
</argument>
<description>
+ Add a node to a function of the VisualScript.
</description>
</method>
<method name="add_variable">
@@ -49,6 +56,7 @@
<argument index="2" name="export" type="bool" default="false">
</argument>
<description>
+ Add a variable to the VisualScript, optionally giving it a default value or marking it as exported.
</description>
</method>
<method name="custom_signal_add_argument">
@@ -63,6 +71,7 @@
<argument index="3" name="index" type="int" default="-1">
</argument>
<description>
+ Add an argument to a custom signal added with [method add_custom_signal].
</description>
</method>
<method name="custom_signal_get_argument_count" qualifiers="const">
@@ -71,6 +80,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
+ Get the count of a custom signal's arguments.
</description>
</method>
<method name="custom_signal_get_argument_name" qualifiers="const">
@@ -81,6 +91,7 @@
<argument index="1" name="argidx" type="int">
</argument>
<description>
+ Get the name of a custom signal's argument.
</description>
</method>
<method name="custom_signal_get_argument_type" qualifiers="const">
@@ -91,6 +102,7 @@
<argument index="1" name="argidx" type="int">
</argument>
<description>
+ Get the type of a custom signal's argument.
</description>
</method>
<method name="custom_signal_remove_argument">
@@ -101,6 +113,7 @@
<argument index="1" name="argidx" type="int">
</argument>
<description>
+ Remove a specific custom signal's argument.
</description>
</method>
<method name="custom_signal_set_argument_name">
@@ -113,6 +126,7 @@
<argument index="2" name="argname" type="String">
</argument>
<description>
+ Rename a custom signal's argument.
</description>
</method>
<method name="custom_signal_set_argument_type">
@@ -125,6 +139,7 @@
<argument index="2" name="type" type="int" enum="Variant.Type">
</argument>
<description>
+ Change the type of a custom signal's argument.
</description>
</method>
<method name="custom_signal_swap_argument">
@@ -137,6 +152,7 @@
<argument index="2" name="withidx" type="int">
</argument>
<description>
+ Swap two of the arguments of a custom signal.
</description>
</method>
<method name="data_connect">
@@ -153,6 +169,7 @@
<argument index="4" name="to_port" type="int">
</argument>
<description>
+ Connect two data ports. The value of [code]from_node[/code]'s [code]from_port[/code] would be fed into [code]to_node[/code]'s [code]to_port[/code].
</description>
</method>
<method name="data_disconnect">
@@ -169,6 +186,7 @@
<argument index="4" name="to_port" type="int">
</argument>
<description>
+ Disconnect two data ports previously connected with [method data_connect].
</description>
</method>
<method name="get_function_node_id" qualifiers="const">
@@ -177,6 +195,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
+ Returns the id of a function's entry point node.
</description>
</method>
<method name="get_function_scroll" qualifiers="const">
@@ -185,6 +204,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
+ Returns the position of the center of the screen for a given function.
</description>
</method>
<method name="get_node" qualifiers="const">
@@ -195,6 +215,7 @@
<argument index="1" name="id" type="int">
</argument>
<description>
+ Returns a node given its id and its function.
</description>
</method>
<method name="get_node_position" qualifiers="const">
@@ -205,6 +226,7 @@
<argument index="1" name="id" type="int">
</argument>
<description>
+ Returns a node's position in pixels.
</description>
</method>
<method name="get_variable_default_value" qualifiers="const">
@@ -213,6 +235,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
+ Returns the default (initial) value of a variable.
</description>
</method>
<method name="get_variable_export" qualifiers="const">
@@ -221,6 +244,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
+ Returns whether a variable is exported.
</description>
</method>
<method name="get_variable_info" qualifiers="const">
@@ -229,6 +253,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
+ Returns the info for a given variable as a dictionary. The information includes its name, type, hint and usage.
</description>
</method>
<method name="has_custom_signal" qualifiers="const">
@@ -237,6 +262,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
+ Returns whether a signal exists with the specified name.
</description>
</method>
<method name="has_data_connection" qualifiers="const">
@@ -253,6 +279,7 @@
<argument index="4" name="to_port" type="int">
</argument>
<description>
+ Returns whether the specified data ports are connected.
</description>
</method>
<method name="has_function" qualifiers="const">
@@ -261,6 +288,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
+ Returns whether a function exists with the specified name.
</description>
</method>
<method name="has_node" qualifiers="const">
@@ -271,6 +299,7 @@
<argument index="1" name="id" type="int">
</argument>
<description>
+ Returns whether a node exists with the given id.
</description>
</method>
<method name="has_sequence_connection" qualifiers="const">
@@ -285,6 +314,7 @@
<argument index="3" name="to_node" type="int">
</argument>
<description>
+ Returns whether the specified sequence ports are connected.
</description>
</method>
<method name="has_variable" qualifiers="const">
@@ -293,6 +323,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
+ Returns whether a variable exists with the specified name.
</description>
</method>
<method name="remove_custom_signal">
@@ -301,6 +332,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
+ Remove a custom signal with the given name.
</description>
</method>
<method name="remove_function">
@@ -309,6 +341,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
+ Remove a specific function and its nodes from the script.
</description>
</method>
<method name="remove_node">
@@ -319,6 +352,7 @@
<argument index="1" name="id" type="int">
</argument>
<description>
+ Remove a specific node.
</description>
</method>
<method name="remove_variable">
@@ -327,6 +361,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
+ Remove a variable with the given name.
</description>
</method>
<method name="rename_custom_signal">
@@ -337,6 +372,7 @@
<argument index="1" name="new_name" type="String">
</argument>
<description>
+ Change the name of a custom signal.
</description>
</method>
<method name="rename_function">
@@ -347,6 +383,7 @@
<argument index="1" name="new_name" type="String">
</argument>
<description>
+ Change the name of a function.
</description>
</method>
<method name="rename_variable">
@@ -357,6 +394,7 @@
<argument index="1" name="new_name" type="String">
</argument>
<description>
+ Change the name of a variable.
</description>
</method>
<method name="sequence_connect">
@@ -371,6 +409,8 @@
<argument index="3" name="to_node" type="int">
</argument>
<description>
+ Connect two sequence ports. The execution will flow from of [code]from_node[/code]'s [code]from_output[/code] into [code]to_node[/code].
+ Unlike [method data_connect], there isn't a [code]to_port[/code], since the target node can have only one sequence port.
</description>
</method>
<method name="sequence_disconnect">
@@ -385,6 +425,7 @@
<argument index="3" name="to_node" type="int">
</argument>
<description>
+ Disconnect two sequence ports previously connected with [method sequence_connect].
</description>
</method>
<method name="set_function_scroll">
@@ -395,6 +436,7 @@
<argument index="1" name="ofs" type="Vector2">
</argument>
<description>
+ Position the center of the screen for a function.
</description>
</method>
<method name="set_instance_base_type">
@@ -403,6 +445,7 @@
<argument index="0" name="type" type="String">
</argument>
<description>
+ Set the base type of the script.
</description>
</method>
<method name="set_node_position">
@@ -415,6 +458,7 @@
<argument index="2" name="position" type="Vector2">
</argument>
<description>
+ Position a node on the screen.
</description>
</method>
<method name="set_variable_default_value">
@@ -425,6 +469,7 @@
<argument index="1" name="value" type="Variant">
</argument>
<description>
+ Change the default (initial) value of a variable.
</description>
</method>
<method name="set_variable_export">
@@ -435,6 +480,7 @@
<argument index="1" name="enable" type="bool">
</argument>
<description>
+ Change whether a variable is exported.
</description>
</method>
<method name="set_variable_info">
@@ -445,6 +491,7 @@
<argument index="1" name="value" type="Dictionary">
</argument>
<description>
+ Set a variable's info, using the same format as [method get_variable_info].
</description>
</method>
</methods>
@@ -459,6 +506,7 @@
<argument index="1" name="id" type="int">
</argument>
<description>
+ Emitted when the ports of a node are changed.
</description>
</signal>
</signals>
diff --git a/doc/classes/VisualScriptBasicTypeConstant.xml b/doc/classes/VisualScriptBasicTypeConstant.xml
index 5b066f9925..cc09815481 100644
--- a/doc/classes/VisualScriptBasicTypeConstant.xml
+++ b/doc/classes/VisualScriptBasicTypeConstant.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualScriptBasicTypeConstant" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ A Visual Script node representing a constant from the base types.
</brief_description>
<description>
+ A Visual Script node representing a constant from base types, such as [Vector3.AXIS_X].
</description>
<tutorials>
</tutorials>
@@ -40,8 +42,10 @@
</methods>
<members>
<member name="basic_type" type="int" setter="set_basic_type" getter="get_basic_type" enum="Variant.Type">
+ The type to get the constant from.
</member>
<member name="constant" type="String" setter="set_basic_type_constant" getter="get_basic_type_constant">
+ The name of the constant to return.
</member>
</members>
<constants>
diff --git a/doc/classes/VisualScriptBuiltinFunc.xml b/doc/classes/VisualScriptBuiltinFunc.xml
index a88633749e..f48f5a5308 100644
--- a/doc/classes/VisualScriptBuiltinFunc.xml
+++ b/doc/classes/VisualScriptBuiltinFunc.xml
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualScriptBuiltinFunc" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ A Visual Script node used to call built-in functions.
</brief_description>
<description>
+ A built-in function used inside a [VisualScript]. It is usually a math function or an utility function.
+ See also [@GDScript], for the same functions in the GDScript language.
</description>
<tutorials>
</tutorials>
@@ -26,124 +29,183 @@
</methods>
<members>
<member name="function" type="int" setter="set_func" getter="get_func" enum="VisualScriptBuiltinFunc.BuiltinFunc">
+ The function to be executed.
</member>
</members>
<constants>
<constant name="MATH_SIN" value="0">
+ Return the sine of the input.
</constant>
<constant name="MATH_COS" value="1">
+ Return the cosine of the input.
</constant>
<constant name="MATH_TAN" value="2">
+ Return the tangent of the input.
</constant>
<constant name="MATH_SINH" value="3">
+ Return the hyperbolic sine of the input.
</constant>
<constant name="MATH_COSH" value="4">
+ Return the hyperbolic cosine of the input.
</constant>
<constant name="MATH_TANH" value="5">
+ Return the hyperbolic tangent of the input.
</constant>
<constant name="MATH_ASIN" value="6">
+ Return the arc sine of the input.
</constant>
<constant name="MATH_ACOS" value="7">
+ Return the arc cosine of the input.
</constant>
<constant name="MATH_ATAN" value="8">
+ Return the arc tangent of the input.
</constant>
<constant name="MATH_ATAN2" value="9">
+ Return the arc tangent of the input, using the signs of both parameters to determine the exact angle.
</constant>
<constant name="MATH_SQRT" value="10">
+ Return the square root of the input.
</constant>
<constant name="MATH_FMOD" value="11">
+ Return the remainder of one input divided by the other, using floating-point numbers.
</constant>
<constant name="MATH_FPOSMOD" value="12">
+ Return the positive remainder of one input divided by the other, using floating-point numbers.
</constant>
<constant name="MATH_FLOOR" value="13">
+ Return the input rounded down.
</constant>
<constant name="MATH_CEIL" value="14">
+ Return the input rounded up.
</constant>
<constant name="MATH_ROUND" value="15">
+ Return the input rounded to the nearest integer.
</constant>
<constant name="MATH_ABS" value="16">
+ Return the absolute value of the input.
</constant>
<constant name="MATH_SIGN" value="17">
+ Return the sign of the input, turning it into 1, -1, or 0. Useful to determine if the input is positive or negative.
</constant>
<constant name="MATH_POW" value="18">
+ Return the input raised to a given power.
</constant>
<constant name="MATH_LOG" value="19">
+ Return the natural logarithm of the input. Note that this is not the typical base-10 logarithm function calculators use.
</constant>
<constant name="MATH_EXP" value="20">
+ Return [b]e[/b] raised to the power of the input. [b]e[/b] sometimes called "Euler's number" is a mathematical constant whose value is approximately 2.71828.
</constant>
<constant name="MATH_ISNAN" value="21">
+ Return whether the input is NaN (Not a Number) or not. NaN is usually produced by dividing 0 by 0, though other ways exist.
</constant>
<constant name="MATH_ISINF" value="22">
+ Return whether the input is an infinite floating-point number or not. Infinity is usually produced by dividing a number by 0, though other ways exist.
</constant>
<constant name="MATH_EASE" value="23">
+ Easing function, based on exponent. 0 is constant, 1 is linear, 0 to 1 is ease-in, 1+ is ease out. Negative values are in-out/out in.
</constant>
<constant name="MATH_DECIMALS" value="24">
+ Return the number of digit places after the decimal that the first non-zero digit occurs.
</constant>
<constant name="MATH_STEPIFY" value="25">
+ Return the input snapped to a given step.
</constant>
<constant name="MATH_LERP" value="26">
+ Return a number linearly interpolated between the first two inputs, based on the third input. Uses the formula [code]a + (a - b) * t[/code].
</constant>
<constant name="MATH_DECTIME" value="27">
+ Return the result of 'value' decreased by 'step' * 'amount'.
</constant>
<constant name="MATH_RANDOMIZE" value="28">
+ Randomize the seed (or the internal state) of the random number generator. Current implementation reseeds using a number based on time.
</constant>
<constant name="MATH_RAND" value="29">
+ Return a random 32 bits integer value. To obtain a random value between 0 to N (where N is smaller than 2^32 - 1), you can use it with the remainder function.
</constant>
<constant name="MATH_RANDF" value="30">
+ Return a random floating-point value between 0 and 1. To obtain a random value between 0 to N, you can use it with multiplication.
</constant>
<constant name="MATH_RANDOM" value="31">
+ Return a random floating-point value between the two inputs.
</constant>
<constant name="MATH_SEED" value="32">
+ Set the seed for the random number generator.
</constant>
<constant name="MATH_RANDSEED" value="33">
+ Return a random value from the given seed, along with the new seed.
</constant>
<constant name="MATH_DEG2RAD" value="34">
+ Convert the input from degrees to radians.
</constant>
<constant name="MATH_RAD2DEG" value="35">
+ Convert the input from radians to degrees.
</constant>
<constant name="MATH_LINEAR2DB" value="36">
+ Convert the input from linear volume to decibel volume.
</constant>
<constant name="MATH_DB2LINEAR" value="37">
+ Convert the input from decibel volume to linear volume.
</constant>
<constant name="LOGIC_MAX" value="38">
+ Return the greater of the two numbers, also known as their maximum.
</constant>
<constant name="LOGIC_MIN" value="39">
+ Return the lesser of the two numbers, also known as their minimum.
</constant>
<constant name="LOGIC_CLAMP" value="40">
+ Return the input clamped inside the given range, ensuring the result is never outside it. Equivalent to `min(max(input, range_low), range_high)`
</constant>
<constant name="LOGIC_NEAREST_PO2" value="41">
+ Return the nearest power of 2 to the input.
</constant>
<constant name="OBJ_WEAKREF" value="42">
+ Create a [WeakRef] from the input.
</constant>
<constant name="FUNC_FUNCREF" value="43">
+ Create a [FuncRef] from the input.
</constant>
<constant name="TYPE_CONVERT" value="44">
+ Convert between types.
</constant>
<constant name="TYPE_OF" value="45">
+ Return the type of the input as an integer. Check [enum Variant.Type] for the integers that might be returned.
</constant>
<constant name="TYPE_EXISTS" value="46">
+ Checks if a type is registered in the [ClassDB].
</constant>
<constant name="TEXT_CHAR" value="47">
+ Return a character with the given ascii value.
</constant>
<constant name="TEXT_STR" value="48">
+ Convert the input to a string.
</constant>
<constant name="TEXT_PRINT" value="49">
+ Print the given string to the output window.
</constant>
<constant name="TEXT_PRINTERR" value="50">
+ Print the given string to the standard error output.
</constant>
<constant name="TEXT_PRINTRAW" value="51">
+ Print the given string to the standard output, without adding a newline.
</constant>
<constant name="VAR_TO_STR" value="52">
+ Serialize a [Variant] to a string.
</constant>
<constant name="STR_TO_VAR" value="53">
+ Deserialize a [Variant] from a string serialized using [VAR_TO_STR].
</constant>
<constant name="VAR_TO_BYTES" value="54">
+ Serialize a [Variant] to a [PoolByteArray].
</constant>
<constant name="BYTES_TO_VAR" value="55">
+ Deserialize a [Variant] from a [PoolByteArray] serialized using [VAR_TO_BYTES].
</constant>
<constant name="COLORN" value="56">
+ Return the [Color] with the given name and alpha ranging from 0 to 1. Note: names are defined in color_names.inc.
</constant>
<constant name="FUNC_MAX" value="57">
+ The maximum value the [member function] property can have.
</constant>
</constants>
</class>
diff --git a/doc/classes/VisualScriptClassConstant.xml b/doc/classes/VisualScriptClassConstant.xml
index 5e43b4972c..70e7de5dd9 100644
--- a/doc/classes/VisualScriptClassConstant.xml
+++ b/doc/classes/VisualScriptClassConstant.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualScriptClassConstant" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ A Visual Script node representing a constant from a class.
</brief_description>
<description>
+ A Visual Script node representing a constant from the classes, such as [@GlobalScope.TYPE_INT].
</description>
<tutorials>
</tutorials>
@@ -40,8 +42,10 @@
</methods>
<members>
<member name="base_type" type="String" setter="set_base_type" getter="get_base_type">
+ The type to get the constant from.
</member>
<member name="constant" type="String" setter="set_class_constant" getter="get_class_constant">
+ The name of the constant to return.
</member>
</members>
<constants>
diff --git a/doc/classes/VisualScriptComment.xml b/doc/classes/VisualScriptComment.xml
index be4eefd775..69126052d0 100644
--- a/doc/classes/VisualScriptComment.xml
+++ b/doc/classes/VisualScriptComment.xml
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualScriptComment" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ A Visual Script node used to annotate the script.
</brief_description>
<description>
+ A Visual Script node used to display annotations in the script, so that code may be documented.
+ Comment nodes can be resized so they encompass a group of nodes.
</description>
<tutorials>
</tutorials>
@@ -54,10 +57,13 @@
</methods>
<members>
<member name="description" type="String" setter="set_description" getter="get_description">
+ The text inside the comment node.
</member>
<member name="size" type="Vector2" setter="set_size" getter="get_size">
+ The comment node's size (in pixels).
</member>
<member name="title" type="String" setter="set_title" getter="get_title">
+ The comment node's title.
</member>
</members>
<constants>
diff --git a/doc/classes/VisualScriptCondition.xml b/doc/classes/VisualScriptCondition.xml
index 73f1b69c02..a776c9bc9b 100644
--- a/doc/classes/VisualScriptCondition.xml
+++ b/doc/classes/VisualScriptCondition.xml
@@ -1,8 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualScriptCondition" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ A Visual Script node which branches the flow.
</brief_description>
<description>
+ A Visual Script node that checks a [bool] input port. If [code]true[/code] it will exit via the “true” sequence port. If [code]false[/code] it will exit via the "false" sequence port. After exiting either, it exits via the “done” port. Sequence ports may be left disconnected.
+ [b]Input Ports:[/b]
+ - Sequence: [code]if (cond) is[/code]
+ - Data (boolean): [code]cond[/code]
+ [b]Output Ports:[/b]
+ - Sequence: [code]true[/code]
+ - Sequence: [code]false[/code]
+ - Sequence: [code]done[/code]
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/VisualScriptConstant.xml b/doc/classes/VisualScriptConstant.xml
index b0af3bda98..508087a928 100644
--- a/doc/classes/VisualScriptConstant.xml
+++ b/doc/classes/VisualScriptConstant.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualScriptConstant" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ A Visual Script node which returns a constant value.
</brief_description>
<description>
+ A Visual Script node which returns the specified constant value.
</description>
<tutorials>
</tutorials>
@@ -40,8 +42,10 @@
</methods>
<members>
<member name="type" type="int" setter="set_constant_type" getter="get_constant_type" enum="Variant.Type">
+ The constant's type.
</member>
<member name="value" type="Variant" setter="set_constant_value" getter="get_constant_value">
+ The constant's value.
</member>
</members>
<constants>
diff --git a/doc/classes/VisualScriptConstructor.xml b/doc/classes/VisualScriptConstructor.xml
index e8afd36b9c..3b1fc5e385 100644
--- a/doc/classes/VisualScriptConstructor.xml
+++ b/doc/classes/VisualScriptConstructor.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualScriptConstructor" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ A Visual Script node which calls a base type constructor.
</brief_description>
<description>
+ A Visual Script node which calls a base type constructor. It can be used for type conversion as well.
</description>
<tutorials>
</tutorials>
@@ -40,8 +42,26 @@
</methods>
<members>
<member name="constructor" type="Dictionary" setter="set_constructor" getter="get_constructor">
+ The constructor function's method info. Has roughly the following structure:
+ [codeblock]
+ {
+ name = "string",
+ args = [{
+ name = "string"
+ class_name = "string"
+ type = TYPE_*
+ hint = PROPERTY_HINT_*
+ hint_string = "string"
+ }]
+ default_args = [] # Array of variants
+ flags = METHOD_FLAG_*
+ id = 0
+ return = {type = TYPE_*}
+ }
+ [/codeblock]
</member>
<member name="type" type="int" setter="set_constructor_type" getter="get_constructor_type" enum="Variant.Type">
+ The type to be constructed.
</member>
</members>
<constants>
diff --git a/doc/classes/VisualScriptCustomNode.xml b/doc/classes/VisualScriptCustomNode.xml
index ec442e993c..e321c8854a 100644
--- a/doc/classes/VisualScriptCustomNode.xml
+++ b/doc/classes/VisualScriptCustomNode.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualScriptCustomNode" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ A scripted Visual Script node.
</brief_description>
<description>
+ A custom Visual Script node which can be scripted in powerful ways.
</description>
<tutorials>
</tutorials>
@@ -13,18 +15,21 @@
<return type="String">
</return>
<description>
+ Return the node's title.
</description>
</method>
<method name="_get_category" qualifiers="virtual">
<return type="String">
</return>
<description>
+ Return the node's category.
</description>
</method>
<method name="_get_input_value_port_count" qualifiers="virtual">
<return type="int">
</return>
<description>
+ Return the count of input value ports.
</description>
</method>
<method name="_get_input_value_port_name" qualifiers="virtual">
@@ -33,6 +38,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Return the specified input port's name.
</description>
</method>
<method name="_get_input_value_port_type" qualifiers="virtual">
@@ -41,12 +47,14 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Return the specified input port's type. See the TYPE_* enum in [@GlobalScope].
</description>
</method>
<method name="_get_output_sequence_port_count" qualifiers="virtual">
<return type="int">
</return>
<description>
+ Return the amount of output [b]sequence[/b] ports.
</description>
</method>
<method name="_get_output_sequence_port_text" qualifiers="virtual">
@@ -55,12 +63,14 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Return the specified [b]sequence[/b] output's name.
</description>
</method>
<method name="_get_output_value_port_count" qualifiers="virtual">
<return type="int">
</return>
<description>
+ Return the amount of output value ports.
</description>
</method>
<method name="_get_output_value_port_name" qualifiers="virtual">
@@ -69,6 +79,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Return the specified output's name.
</description>
</method>
<method name="_get_output_value_port_type" qualifiers="virtual">
@@ -77,24 +88,28 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Return the specified output's type. See the TYPE_* enum in [@GlobalScope].
</description>
</method>
<method name="_get_text" qualifiers="virtual">
<return type="String">
</return>
<description>
+ Return the custom node's text, which is shown right next to the input [b]sequence[/b] port (if there is none, on the place that is usually taken by it).
</description>
</method>
<method name="_get_working_memory_size" qualifiers="virtual">
<return type="int">
</return>
<description>
+ Return the size of the custom node's working memory. See [method _step] for more details.
</description>
</method>
<method name="_has_input_sequence_port" qualifiers="virtual">
<return type="bool">
</return>
<description>
+ Return whether the custom node has an input [b]sequence[/b] port.
</description>
</method>
<method name="_step" qualifiers="virtual">
@@ -109,25 +124,42 @@
<argument index="3" name="working_mem" type="Array">
</argument>
<description>
+ Execute the custom node's logic, returning the index of the output sequence port to use or a [String] when there is an error.
+
+ The [code]inputs[/code] array contains the values of the input ports.
+ [code]outputs[/code] is an array whose indices should be set to the respective outputs.
+ The [code]start_mode[/code] is usually [code]START_MODE_BEGIN_SEQUENCE[/code], unless you have used the STEP_* constants.
+ [code]working_mem[/code] is an array which can be used to persist information between runs of the custom node.
+
+ When returning, you can mask the returned value with one of the STEP_* constants.
</description>
</method>
</methods>
<constants>
<constant name="START_MODE_BEGIN_SEQUENCE" value="0">
+ The start mode used the first time when [method _step] is called.
</constant>
<constant name="START_MODE_CONTINUE_SEQUENCE" value="1">
+ The start mode used when [method _step] is called after coming back from a STEP_PUSH_STACK_BIT.
</constant>
<constant name="START_MODE_RESUME_YIELD" value="2">
+ The start mode used when [method _step] is called after resuming from STEP_YIELD_BIT.
</constant>
<constant name="STEP_PUSH_STACK_BIT" value="16777216" enum="">
+ Hint used by [method _step] to tell that control should return to it when there is no other node left to execute.
+ This is used by [VisualScriptCondition] to redirect the sequence to the "Done" port after the true/false branch has finished execution.
</constant>
<constant name="STEP_GO_BACK_BIT" value="33554432" enum="">
+ Hint used by [method _step] to tell that control should return back, either hitting a previous STEP_PUSH_STACK_BIT or exiting the function.
</constant>
<constant name="STEP_NO_ADVANCE_BIT" value="67108864" enum="">
</constant>
<constant name="STEP_EXIT_FUNCTION_BIT" value="134217728" enum="">
+ Hint used by [method _step] to tell that control should stop and exit the function.
</constant>
<constant name="STEP_YIELD_BIT" value="268435456" enum="">
+ Hint used by [method _step] to tell that the function should be yielded.
+ Using this requires you to have at least one working memory slot, which is used for the [VisualScriptFunctionState].
</constant>
</constants>
</class>
diff --git a/doc/classes/VisualScriptDeconstruct.xml b/doc/classes/VisualScriptDeconstruct.xml
index 5bb12539af..cd7d79ae56 100644
--- a/doc/classes/VisualScriptDeconstruct.xml
+++ b/doc/classes/VisualScriptDeconstruct.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualScriptDeconstruct" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ A Visual Script node which deconstructs a base type instance into its parts.
</brief_description>
<description>
+ A Visual Script node which deconstructs a base type instance into its parts.
</description>
<tutorials>
</tutorials>
@@ -28,6 +30,7 @@
<member name="elem_cache" type="Array" setter="_set_elem_cache" getter="_get_elem_cache">
</member>
<member name="type" type="int" setter="set_deconstruct_type" getter="get_deconstruct_type" enum="Variant.Type">
+ The type to deconstruct.
</member>
</members>
<constants>
diff --git a/doc/classes/VisualScriptEmitSignal.xml b/doc/classes/VisualScriptEmitSignal.xml
index 21af3c6ea0..844b5a40ec 100644
--- a/doc/classes/VisualScriptEmitSignal.xml
+++ b/doc/classes/VisualScriptEmitSignal.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualScriptEmitSignal" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ A Visual Script node which emits a specified signal.
</brief_description>
<description>
+ A Visual Script node which emits a specified signal when it is executed.
</description>
<tutorials>
</tutorials>
@@ -26,6 +28,7 @@
</methods>
<members>
<member name="signal" type="String" setter="set_signal" getter="get_signal">
+ The signal to emit.
</member>
</members>
<constants>
diff --git a/doc/classes/VisualScriptEngineSingleton.xml b/doc/classes/VisualScriptEngineSingleton.xml
index c00fd2a0a4..6606f10f11 100644
--- a/doc/classes/VisualScriptEngineSingleton.xml
+++ b/doc/classes/VisualScriptEngineSingleton.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualScriptEngineSingleton" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ A Visual Script node returning a singleton from [@GlobalScope]
</brief_description>
<description>
+ A Visual Script node returning a singleton from [@GlobalScope]
</description>
<tutorials>
</tutorials>
@@ -26,6 +28,7 @@
</methods>
<members>
<member name="constant" type="String" setter="set_singleton" getter="get_singleton">
+ The singleton's name.
</member>
</members>
<constants>
diff --git a/doc/classes/VisualScriptNode.xml b/doc/classes/VisualScriptNode.xml
index dbb75e69fa..74ec9bdc2e 100644
--- a/doc/classes/VisualScriptNode.xml
+++ b/doc/classes/VisualScriptNode.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualScriptNode" inherits="Resource" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ A node which is part of a [VisualScript].
</brief_description>
<description>
+ A node which is part of a [VisualScript]. Not to be confused with [Node], which is a part of a [SceneTree].
</description>
<tutorials>
</tutorials>
@@ -15,12 +17,21 @@
<argument index="0" name="port_idx" type="int">
</argument>
<description>
+ Returns the default value of a given port. The default value is used when nothing is connected to the port.
</description>
</method>
<method name="get_visual_script" qualifiers="const">
<return type="VisualScript">
</return>
<description>
+ Returns the [VisualScript] instance the node is bound to.
+ </description>
+ </method>
+ <method name="ports_changed_notify">
+ <return type="void">
+ </return>
+ <description>
+ Notify that the node's ports have changed. Usually used in conjunction with [VisualScriptCustomNode] .
</description>
</method>
<method name="set_default_input_value">
@@ -31,6 +42,7 @@
<argument index="1" name="value" type="Variant">
</argument>
<description>
+ Change the default value of a given port.
</description>
</method>
</methods>
@@ -41,6 +53,7 @@
<signals>
<signal name="ports_changed">
<description>
+ Emitted when the available input/output ports are changed.
</description>
</signal>
</signals>
diff --git a/doc/classes/VisualScriptOperator.xml b/doc/classes/VisualScriptOperator.xml
index 82951c9e0c..7e85af8af2 100644
--- a/doc/classes/VisualScriptOperator.xml
+++ b/doc/classes/VisualScriptOperator.xml
@@ -3,6 +3,13 @@
<brief_description>
</brief_description>
<description>
+ [b]Input Ports:[/b]
+ - Data (variant): [code]A[/code]
+ - Data (variant): [code]B[/code]
+ [b]Output Ports:[/b]
+ - Sequence: [code]true[/code]
+ - Sequence: [code]false[/code]
+ - Sequence: [code]done[/code]
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/VisualScriptSceneNode.xml b/doc/classes/VisualScriptSceneNode.xml
index 90a8f132c0..b71bd9adfb 100644
--- a/doc/classes/VisualScriptSceneNode.xml
+++ b/doc/classes/VisualScriptSceneNode.xml
@@ -1,8 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualScriptSceneNode" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Node reference.
</brief_description>
<description>
+ A direct reference to a node.
+ [b]Input Ports:[/b]
+ none
+ [b]Output Ports:[/b]
+ - Data: [code]node[/code] (obj)
</description>
<tutorials>
</tutorials>
@@ -26,6 +32,7 @@
</methods>
<members>
<member name="node_path" type="NodePath" setter="set_node_path" getter="get_node_path">
+ The node's path in the scene tree.
</member>
</members>
<constants>
diff --git a/doc/tools/doc_status.py b/doc/tools/doc_status.py
index 6b6b794f11..e89b49eb4d 100644
--- a/doc/tools/doc_status.py
+++ b/doc/tools/doc_status.py
@@ -1,5 +1,6 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
+import fnmatch
import os
import sys
import re
@@ -22,6 +23,7 @@ flags = {
'o': True,
'i': False,
'a': True,
+ 'e': False,
}
flag_descriptions = {
'c': 'Toggle colors when outputting.',
@@ -34,6 +36,7 @@ flag_descriptions = {
'o': 'Toggle overall column.',
'i': 'Toggle collapse of class items columns.',
'a': 'Toggle showing all items.',
+ 'e': 'Toggle hiding empty items.',
}
long_flags = {
'colors': 'c',
@@ -63,6 +66,8 @@ long_flags = {
'collapse': 'i',
'all': 'a',
+
+ 'empty': 'e',
}
table_columns = ['name', 'brief_description', 'description', 'methods', 'constants', 'members', 'signals']
table_column_names = ['Name', 'Brief Desc.', 'Desc.', 'Methods', 'Constants', 'Members', 'Signals']
@@ -91,7 +96,7 @@ def validate_tag(elem, tag):
def color(color, string):
- if flags['c']:
+ if flags['c'] and terminal_supports_color():
color_format = ''
for code in colors[color]:
color_format += '\033[' + str(code) + 'm'
@@ -105,6 +110,15 @@ ansi_escape = re.compile(r'\x1b[^m]*m')
def nonescape_len(s):
return len(ansi_escape.sub('', s))
+def terminal_supports_color():
+ p = sys.platform
+ supported_platform = p != 'Pocket PC' and (p != 'win32' or
+ 'ANSICON' in os.environ)
+
+ is_a_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()
+ if not supported_platform or not is_a_tty:
+ return False
+ return True
################################################################################
# Classes #
@@ -134,8 +148,8 @@ class ClassStatusProgress:
return self.to_colored_string()
def to_colored_string(self, format='{has}/{total}', pad_format='{pad_described}{s}{pad_total}'):
- ratio = self.described / self.total if self.total != 0 else 1
- percent = round(100 * ratio)
+ ratio = float(self.described) / float(self.total) if self.total != 0 else 1
+ percent = int(round(100 * ratio))
s = format.format(has=str(self.described), total=str(self.total), percent=str(percent))
if self.described >= self.total:
s = color('part_good', s)
@@ -182,6 +196,14 @@ class ClassStatus:
ok = ok and self.progresses[k].is_ok()
return ok
+ def is_empty(self):
+ sum = 0
+ for k in self.progresses:
+ if self.progresses[k].is_ok():
+ continue
+ sum += self.progresses[k].total
+ return sum < 1
+
def make_output(self):
output = {}
output['name'] = color('name', self.name)
@@ -218,6 +240,7 @@ class ClassStatus:
return output
+ @staticmethod
def generate_for_class(c):
status = ClassStatus()
status.name = c.attrib['name']
@@ -274,17 +297,21 @@ input_class_list = []
merged_file = ""
for arg in sys.argv[1:]:
- if arg.startswith('--'):
- flags[long_flags[arg[2:]]] = not flags[long_flags[arg[2:]]]
- elif arg.startswith('-'):
- for f in arg[1:]:
- flags[f] = not flags[f]
- elif os.path.isdir(arg):
- for f in os.listdir(arg):
- if f.endswith('.xml'):
- input_file_list.append(os.path.join(arg, f));
- else:
- input_class_list.append(arg)
+ try:
+ if arg.startswith('--'):
+ flags[long_flags[arg[2:]]] = not flags[long_flags[arg[2:]]]
+ elif arg.startswith('-'):
+ for f in arg[1:]:
+ flags[f] = not flags[f]
+ elif os.path.isdir(arg):
+ for f in os.listdir(arg):
+ if f.endswith('.xml'):
+ input_file_list.append(os.path.join(arg, f));
+ else:
+ input_class_list.append(arg)
+ except KeyError:
+ print("Unknown command line flag: " + arg)
+ sys.exit(1)
if flags['i']:
for r in ['methods', 'constants', 'members', 'signals']:
@@ -356,8 +383,13 @@ for file in input_file_list:
class_names.sort()
if len(input_class_list) < 1:
- input_class_list = class_names
+ input_class_list = ['*']
+filtered_classes = set()
+for pattern in input_class_list:
+ filtered_classes |= set(fnmatch.filter(class_names, pattern))
+filtered_classes = list(filtered_classes)
+filtered_classes.sort()
################################################################################
# Make output table #
@@ -369,10 +401,7 @@ table_column_chars = '|'
total_status = ClassStatus('Total')
-for cn in input_class_list:
- if not cn in classes:
- print('Cannot find class ' + cn + '!')
- sys.exit(255)
+for cn in filtered_classes:
c = classes[cn]
validate_tag(c, 'class')
@@ -383,6 +412,9 @@ for cn in input_class_list:
if (flags['b'] and status.is_ok()) or (flags['g'] and not status.is_ok()) or (not flags['a']):
continue
+ if flags['e'] and status.is_empty():
+ continue
+
out = status.make_output()
row = []
for column in table_columns:
@@ -436,7 +468,7 @@ for row_i, row in enumerate(table):
if cell_i == 0:
row_string += table_row_chars[3] + cell + table_row_chars[3] * (padding_needed - 1)
else:
- row_string += table_row_chars[3] * math.floor(padding_needed / 2) + cell + table_row_chars[3] * math.ceil((padding_needed / 2))
+ row_string += table_row_chars[3] * int(math.floor(float(padding_needed) / 2)) + cell + table_row_chars[3] * int(math.ceil(float(padding_needed) / 2))
row_string += table_column_chars
print(row_string)
diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py
index 696e3c9c78..c4dff588b0 100644
--- a/doc/tools/makerst.py
+++ b/doc/tools/makerst.py
@@ -3,15 +3,19 @@
import codecs
import sys
+import os
import xml.etree.ElementTree as ET
input_list = []
for arg in sys.argv[1:]:
+ if arg.endswith(os.sep):
+ arg = arg[:-1]
input_list.append(arg)
if len(input_list) < 1:
- print 'usage: makerst.py <classes.xml>'
+ print 'usage: makerst.py <path to folders> and/or <path to .xml files> (order of arguments irrelevant)'
+ print 'example: makerst.py "../../modules/" "../classes" path_to/some_class.xml'
sys.exit(0)
@@ -34,7 +38,6 @@ def ul_string(str, ul):
def make_class_list(class_list, columns):
-
f = codecs.open('class_list.rst', 'wb', 'utf-8')
prev = 0
col_max = len(class_list) / columns + 1
@@ -102,7 +105,6 @@ def make_class_list(class_list, columns):
def rstize_text(text, cclass):
-
# Linebreak + tabs in the XML should become two line breaks unless in a "codeblock"
pos = 0
while True:
@@ -250,9 +252,6 @@ def rstize_text(text, cclass):
text = pre_text + tag_text + post_text
pos = len(pre_text) + len(tag_text)
- # tnode = ET.SubElement(parent,"div")
- # tnode.text=text
-
return text
@@ -272,7 +271,6 @@ def make_method(
event=False,
pp=None
):
-
if (declare or pp == None):
t = '- '
else:
@@ -340,7 +338,6 @@ def make_method(
if 'qualifiers' in m.attrib:
s += ' ' + m.attrib['qualifiers']
-# f.write(s)
if (not declare):
if (pp != None):
pp.append((t, s))
@@ -355,24 +352,23 @@ def make_heading(title, underline):
def make_rst_class(node):
-
name = node.attrib['name']
f = codecs.open("class_" + name.lower() + '.rst', 'wb', 'utf-8')
# Warn contributors not to edit this file directly
f.write(".. Generated automatically by doc/tools/makerst.py in Godot's source tree.\n")
- f.write(".. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.\n\n")
+ f.write(".. DO NOT EDIT THIS FILE, but the " + name + ".xml source instead.\n")
+ f.write(".. The source is found in doc/classes or modules/<name>/doc_classes.\n\n")
f.write(".. _class_" + name + ":\n\n")
f.write(make_heading(name, '='))
if 'inherits' in node.attrib:
inh = node.attrib['inherits'].strip()
-# whle inh in classes[cn]
f.write('**Inherits:** ')
first = True
- while(inh in classes):
+ while (inh in classes):
if (not first):
f.write(" **<** ")
else:
@@ -436,10 +432,10 @@ def make_rst_class(node):
f.write(sep)
for s in ml:
rt = s[0]
- while(len(rt) < longest_s):
+ while (len(rt) < longest_s):
rt += " "
st = s[1]
- while(len(st) < longest_t):
+ while (len(st) < longest_t):
st += " "
f.write("| " + rt + " | " + st + " |\n")
f.write(sep)
@@ -494,8 +490,6 @@ def make_rst_class(node):
f.write(make_heading('Member Function Description', '-'))
for m in list(methods):
f.write(".. _class_" + name + "_" + m.attrib['name'] + ":\n\n")
-# f.write(ul_string(m.attrib['name'],"^"))
- #f.write('\n<a name="'+m.attrib['name']+'">' + m.attrib['name'] + '</a>\n------\n')
make_method(f, node.attrib['name'], m, True, name)
f.write('\n')
d = m.find('description')
@@ -506,7 +500,21 @@ def make_rst_class(node):
f.write('\n')
-for file in input_list:
+file_list = []
+
+for path in input_list:
+ if os.path.basename(path) == 'modules':
+ for subdir, dirs, _ in os.walk(path):
+ if 'doc_classes' in dirs:
+ doc_dir = os.path.join(subdir, 'doc_classes')
+ class_file_name = [f for f in os.listdir(doc_dir) if f.endswith('.xml')][0]
+ file_list.append(os.path.join(doc_dir, class_file_name))
+ elif not os.path.isfile(path):
+ file_list += [os.path.join(path, f) for f in os.listdir(path) if f.endswith('.xml')]
+ elif os.path.isfile(path) and path.endswith('.xml'):
+ file_list.append(path)
+
+for file in file_list:
tree = ET.parse(file)
doc = tree.getroot()
@@ -515,17 +523,15 @@ for file in input_list:
sys.exit(255)
version = doc.attrib['version']
-
- for c in list(doc):
- if c.attrib['name'] in class_names:
- continue
- class_names.append(c.attrib['name'])
- classes[c.attrib['name']] = c
+ if doc.attrib['name'] in class_names:
+ continue
+ class_names.append(doc.attrib['name'])
+ classes[doc.attrib['name']] = doc
class_names.sort()
# Don't make class list for Sphinx, :toctree: handles it
-#make_class_list(class_names, 2)
+# make_class_list(class_names, 2)
for cn in class_names:
c = classes[cn]
diff --git a/drivers/SCsub b/drivers/SCsub
index b8bba91378..34d6254578 100644
--- a/drivers/SCsub
+++ b/drivers/SCsub
@@ -4,7 +4,7 @@ Import('env')
env.drivers_sources = []
-if ("builtin_zlib" in env and env["builtin_zlib"] == "yes"):
+if 'builtin_zlib' in env and env['builtin_zlib']:
SConscript("zlib/SCsub")
# OS drivers
@@ -13,11 +13,12 @@ SConscript('windows/SCsub')
# Sounds drivers
SConscript('alsa/SCsub')
+SConscript('coreaudio/SCsub')
SConscript('pulseaudio/SCsub')
if (env["platform"] == "windows"):
SConscript("rtaudio/SCsub")
SConscript("wasapi/SCsub")
-if (env["xaudio2"] == "yes"):
+if env['xaudio2']:
SConscript("xaudio2/SCsub")
# Graphics drivers
@@ -29,10 +30,10 @@ SConscript("png/SCsub")
# Tools override
# FIXME: Should likely be integrated in the tools/ codebase
-if (env["tools"] == "yes"):
+if env['tools']:
SConscript("convex_decomp/SCsub")
-if env['vsproj'] == "yes":
+if env['vsproj']:
env.AddToVSProject(env.drivers_sources)
if env.split_drivers:
diff --git a/drivers/coreaudio/SCsub b/drivers/coreaudio/SCsub
new file mode 100644
index 0000000000..233593b0f9
--- /dev/null
+++ b/drivers/coreaudio/SCsub
@@ -0,0 +1,8 @@
+#!/usr/bin/env python
+
+Import('env')
+
+# Driver source files
+env.add_source_files(env.drivers_sources, "*.cpp")
+
+Export('env')
diff --git a/platform/osx/audio_driver_osx.cpp b/drivers/coreaudio/audio_driver_coreaudio.cpp
index 3b3ba60507..c531d6af9d 100644
--- a/platform/osx/audio_driver_osx.cpp
+++ b/drivers/coreaudio/audio_driver_coreaudio.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* audio_driver_osx.cpp */
+/* audio_driver_coreaudio.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -27,27 +27,33 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifdef OSX_ENABLED
+#ifdef COREAUDIO_ENABLED
-#include "audio_driver_osx.h"
+#include "audio_driver_coreaudio.h"
#include "core/project_settings.h"
#include "os/os.h"
#define kOutputBus 0
+#ifdef OSX_ENABLED
static OSStatus outputDeviceAddressCB(AudioObjectID inObjectID, UInt32 inNumberAddresses, const AudioObjectPropertyAddress *inAddresses, void *__nullable inClientData) {
- AudioDriverOSX *driver = (AudioDriverOSX *)inClientData;
+ AudioDriverCoreAudio *driver = (AudioDriverCoreAudio *)inClientData;
driver->reopen();
return noErr;
}
+#endif
-Error AudioDriverOSX::initDevice() {
+Error AudioDriverCoreAudio::initDevice() {
AudioComponentDescription desc;
zeromem(&desc, sizeof(desc));
desc.componentType = kAudioUnitType_Output;
+#ifdef OSX_ENABLED
desc.componentSubType = kAudioUnitSubType_HALOutput;
+#else
+ desc.componentSubType = kAudioUnitSubType_RemoteIO;
+#endif
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
AudioComponent comp = AudioComponentFindNext(NULL, &desc);
@@ -96,8 +102,10 @@ Error AudioDriverOSX::initDevice() {
// Sample rate is independent of channels (ref: https://stackoverflow.com/questions/11048825/audio-sample-frequency-rely-on-channels)
buffer_frames = closest_power_of_2(latency * mix_rate / 1000);
+#ifdef OSX_ENABLED
result = AudioUnitSetProperty(audio_unit, kAudioDevicePropertyBufferFrameSize, kAudioUnitScope_Global, kOutputBus, &buffer_frames, sizeof(UInt32));
ERR_FAIL_COND_V(result != noErr, FAILED);
+#endif
buffer_size = buffer_frames * channels;
samples_in.resize(buffer_size);
@@ -109,7 +117,7 @@ Error AudioDriverOSX::initDevice() {
AURenderCallbackStruct callback;
zeromem(&callback, sizeof(AURenderCallbackStruct));
- callback.inputProc = &AudioDriverOSX::output_callback;
+ callback.inputProc = &AudioDriverCoreAudio::output_callback;
callback.inputProcRefCon = this;
result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, kOutputBus, &callback, sizeof(callback));
ERR_FAIL_COND_V(result != noErr, FAILED);
@@ -120,7 +128,7 @@ Error AudioDriverOSX::initDevice() {
return OK;
}
-Error AudioDriverOSX::finishDevice() {
+Error AudioDriverCoreAudio::finishDevice() {
OSStatus result;
if (active) {
@@ -136,24 +144,26 @@ Error AudioDriverOSX::finishDevice() {
return OK;
}
-Error AudioDriverOSX::init() {
+Error AudioDriverCoreAudio::init() {
OSStatus result;
mutex = Mutex::create();
active = false;
channels = 2;
+#ifdef OSX_ENABLED
outputDeviceAddress.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
outputDeviceAddress.mScope = kAudioObjectPropertyScopeGlobal;
outputDeviceAddress.mElement = kAudioObjectPropertyElementMaster;
result = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &outputDeviceAddress, &outputDeviceAddressCB, this);
ERR_FAIL_COND_V(result != noErr, FAILED);
+#endif
return initDevice();
};
-Error AudioDriverOSX::reopen() {
+Error AudioDriverCoreAudio::reopen() {
bool restart = false;
lock();
@@ -185,13 +195,13 @@ Error AudioDriverOSX::reopen() {
return OK;
}
-OSStatus AudioDriverOSX::output_callback(void *inRefCon,
+OSStatus AudioDriverCoreAudio::output_callback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber, UInt32 inNumberFrames,
AudioBufferList *ioData) {
- AudioDriverOSX *ad = (AudioDriverOSX *)inRefCon;
+ AudioDriverCoreAudio *ad = (AudioDriverCoreAudio *)inRefCon;
if (!ad->active || !ad->try_lock()) {
for (unsigned int i = 0; i < ioData->mNumberBuffers; i++) {
@@ -227,7 +237,7 @@ OSStatus AudioDriverOSX::output_callback(void *inRefCon,
return 0;
};
-void AudioDriverOSX::start() {
+void AudioDriverCoreAudio::start() {
if (!active) {
OSStatus result = AudioOutputUnitStart(audio_unit);
if (result != noErr) {
@@ -238,37 +248,41 @@ void AudioDriverOSX::start() {
}
};
-int AudioDriverOSX::get_mix_rate() const {
+int AudioDriverCoreAudio::get_mix_rate() const {
return mix_rate;
};
-AudioDriver::SpeakerMode AudioDriverOSX::get_speaker_mode() const {
+AudioDriver::SpeakerMode AudioDriverCoreAudio::get_speaker_mode() const {
return get_speaker_mode_by_total_channels(channels);
};
-void AudioDriverOSX::lock() {
+void AudioDriverCoreAudio::lock() {
if (mutex)
mutex->lock();
};
-void AudioDriverOSX::unlock() {
+void AudioDriverCoreAudio::unlock() {
if (mutex)
mutex->unlock();
};
-bool AudioDriverOSX::try_lock() {
+bool AudioDriverCoreAudio::try_lock() {
if (mutex)
return mutex->try_lock() == OK;
return true;
}
-void AudioDriverOSX::finish() {
+void AudioDriverCoreAudio::finish() {
+ OSStatus result;
+
finishDevice();
- OSStatus result = AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &outputDeviceAddress, &outputDeviceAddressCB, this);
+#ifdef OSX_ENABLED
+ result = AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &outputDeviceAddress, &outputDeviceAddressCB, this);
if (result != noErr) {
ERR_PRINT("AudioObjectRemovePropertyListener failed");
}
+#endif
AURenderCallbackStruct callback;
zeromem(&callback, sizeof(AURenderCallbackStruct));
@@ -283,7 +297,7 @@ void AudioDriverOSX::finish() {
}
};
-AudioDriverOSX::AudioDriverOSX() {
+AudioDriverCoreAudio::AudioDriverCoreAudio() {
active = false;
mutex = NULL;
@@ -296,6 +310,6 @@ AudioDriverOSX::AudioDriverOSX() {
samples_in.clear();
};
-AudioDriverOSX::~AudioDriverOSX(){};
+AudioDriverCoreAudio::~AudioDriverCoreAudio(){};
#endif
diff --git a/platform/osx/audio_driver_osx.h b/drivers/coreaudio/audio_driver_coreaudio.h
index a7e68c8141..33b3ba93ec 100644
--- a/platform/osx/audio_driver_osx.h
+++ b/drivers/coreaudio/audio_driver_coreaudio.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* audio_driver_osx.h */
+/* audio_driver_coreaudio.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -27,20 +27,24 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifdef OSX_ENABLED
+#ifdef COREAUDIO_ENABLED
-#ifndef AUDIO_DRIVER_OSX_H
-#define AUDIO_DRIVER_OSX_H
+#ifndef AUDIO_DRIVER_COREAUDIO_H
+#define AUDIO_DRIVER_COREAUDIO_H
#include "servers/audio_server.h"
#include <AudioUnit/AudioUnit.h>
+#ifdef OSX_ENABLED
#include <CoreAudio/AudioHardware.h>
+#endif
-class AudioDriverOSX : public AudioDriver {
+class AudioDriverCoreAudio : public AudioDriver {
AudioComponentInstance audio_unit;
+#ifdef OSX_ENABLED
AudioObjectPropertyAddress outputDeviceAddress;
+#endif
bool active;
Mutex *mutex;
@@ -62,7 +66,7 @@ class AudioDriverOSX : public AudioDriver {
public:
const char *get_name() const {
- return "AudioUnit";
+ return "CoreAudio";
};
virtual Error init();
@@ -76,8 +80,8 @@ public:
bool try_lock();
Error reopen();
- AudioDriverOSX();
- ~AudioDriverOSX();
+ AudioDriverCoreAudio();
+ ~AudioDriverCoreAudio();
};
#endif
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index 146a2359b6..6117c91a6a 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "rasterizer_scene_gles3.h"
-
+#include "math_funcs.h"
#include "os/os.h"
#include "project_settings.h"
#include "rasterizer_canvas_gles3.h"
@@ -379,6 +379,7 @@ bool RasterizerSceneGLES3::shadow_atlas_update_light(RID p_atlas, RID p_light_in
sh->owner = p_light_intance;
sh->alloc_tick = tick;
sh->version = p_light_version;
+ li->shadow_atlases.insert(p_atlas);
//make new key
key = new_quadrant << ShadowAtlas::QUADRANT_SHIFT;
@@ -414,6 +415,7 @@ bool RasterizerSceneGLES3::shadow_atlas_update_light(RID p_atlas, RID p_light_in
sh->owner = p_light_intance;
sh->alloc_tick = tick;
sh->version = p_light_version;
+ li->shadow_atlases.insert(p_atlas);
//make new key
uint32_t key = new_quadrant << ShadowAtlas::QUADRANT_SHIFT;
@@ -799,12 +801,12 @@ void RasterizerSceneGLES3::environment_set_sky(RID p_env, RID p_sky) {
env->sky = p_sky;
}
-void RasterizerSceneGLES3::environment_set_sky_scale(RID p_env, float p_scale) {
+void RasterizerSceneGLES3::environment_set_sky_custom_fov(RID p_env, float p_scale) {
Environment *env = environment_owner.getornull(p_env);
ERR_FAIL_COND(!env);
- env->sky_scale = p_scale;
+ env->sky_custom_fov = p_scale;
}
void RasterizerSceneGLES3::environment_set_bg_color(RID p_env, const Color &p_color) {
@@ -2140,7 +2142,6 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_
first = false;
}
- glFrontFace(GL_CW);
glBindVertexArray(0);
state.scene_shader.set_conditional(SceneShaderGLES3::USE_INSTANCING, false);
@@ -2319,7 +2320,7 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G
}
}
-void RasterizerSceneGLES3::_draw_sky(RasterizerStorageGLES3::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_scale, float p_energy) {
+void RasterizerSceneGLES3::_draw_sky(RasterizerStorageGLES3::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_custom_fov, float p_energy) {
if (!p_sky)
return;
@@ -2349,8 +2350,30 @@ void RasterizerSceneGLES3::_draw_sky(RasterizerStorageGLES3::Sky *p_sky, const C
glDepthFunc(GL_LEQUAL);
glColorMask(1, 1, 1, 1);
+ // Camera
+ CameraMatrix camera;
+
+ if (p_custom_fov) {
+
+ float near_plane = p_projection.get_z_near();
+ float far_plane = p_projection.get_z_far();
+ float aspect = p_projection.get_aspect();
+
+ camera.set_perspective(p_custom_fov, aspect, near_plane, far_plane);
+
+ } else {
+ camera = p_projection;
+ }
+
float flip_sign = p_vflip ? -1 : 1;
+ /*
+ If matrix[2][0] or matrix[2][1] we're dealing with an asymmetrical projection matrix. This is the case for stereoscopic rendering (i.e. VR).
+ To ensure the image rendered is perspective correct we need to move some logic into the shader. For this the USE_ASYM_PANO option is introduced.
+ It also means the uv coordinates are ignored in this mode and we don't need our loop.
+ */
+ bool asymmetrical = ((camera.matrix[2][0] != 0.0) || (camera.matrix[2][1] != 0.0));
+
Vector3 vertices[8] = {
Vector3(-1, -1 * flip_sign, 1),
Vector3(0, 1, 0),
@@ -2360,24 +2383,21 @@ void RasterizerSceneGLES3::_draw_sky(RasterizerStorageGLES3::Sky *p_sky, const C
Vector3(1, 0, 0),
Vector3(-1, 1 * flip_sign, 1),
Vector3(0, 0, 0)
-
};
- //sky uv vectors
- float vw, vh, zn;
- p_projection.get_viewport_size(vw, vh);
- zn = p_projection.get_z_near();
-
- float scale = p_scale;
-
- for (int i = 0; i < 4; i++) {
-
- Vector3 uv = vertices[i * 2 + 1];
- uv.x = (uv.x * 2.0 - 1.0) * vw * scale;
- uv.y = -(uv.y * 2.0 - 1.0) * vh * scale;
- uv.z = -zn;
- vertices[i * 2 + 1] = p_transform.basis.xform(uv).normalized();
- vertices[i * 2 + 1].z = -vertices[i * 2 + 1].z;
+ if (!asymmetrical) {
+ float vw, vh, zn;
+ camera.get_viewport_size(vw, vh);
+ zn = p_projection.get_z_near();
+
+ for (int i = 0; i < 4; i++) {
+ Vector3 uv = vertices[i * 2 + 1];
+ uv.x = (uv.x * 2.0 - 1.0) * vw;
+ uv.y = -(uv.y * 2.0 - 1.0) * vh;
+ uv.z = -zn;
+ vertices[i * 2 + 1] = p_transform.basis.xform(uv).normalized();
+ vertices[i * 2 + 1].z = -vertices[i * 2 + 1].z;
+ }
}
glBindBuffer(GL_ARRAY_BUFFER, state.sky_verts);
@@ -2386,16 +2406,24 @@ void RasterizerSceneGLES3::_draw_sky(RasterizerStorageGLES3::Sky *p_sky, const C
glBindVertexArray(state.sky_array);
- storage->shaders.copy.set_conditional(CopyShaderGLES3::USE_PANORAMA, true);
+ storage->shaders.copy.set_conditional(CopyShaderGLES3::USE_ASYM_PANO, asymmetrical);
+ storage->shaders.copy.set_conditional(CopyShaderGLES3::USE_PANORAMA, !asymmetrical);
storage->shaders.copy.set_conditional(CopyShaderGLES3::USE_MULTIPLIER, true);
storage->shaders.copy.bind();
storage->shaders.copy.set_uniform(CopyShaderGLES3::MULTIPLIER, p_energy);
+ if (asymmetrical) {
+ // pack the bits we need from our projection matrix
+ storage->shaders.copy.set_uniform(CopyShaderGLES3::ASYM_PROJ, camera.matrix[2][0], camera.matrix[0][0], camera.matrix[2][1], camera.matrix[1][1]);
+ ///@TODO I couldn't get mat3 + p_transform.basis to work, that would be better here.
+ storage->shaders.copy.set_uniform(CopyShaderGLES3::PANO_TRANSFORM, p_transform);
+ }
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glBindVertexArray(0);
glColorMask(1, 1, 1, 1);
+ storage->shaders.copy.set_conditional(CopyShaderGLES3::USE_ASYM_PANO, false);
storage->shaders.copy.set_conditional(CopyShaderGLES3::USE_MULTIPLIER, false);
storage->shaders.copy.set_conditional(CopyShaderGLES3::USE_PANORAMA, false);
}
@@ -2404,6 +2432,7 @@ void RasterizerSceneGLES3::_setup_environment(Environment *env, const CameraMatr
//store camera into ubo
store_camera(p_cam_projection, state.ubo_data.projection_matrix);
+ store_camera(p_cam_projection.inverse(), state.ubo_data.inv_projection_matrix);
store_transform(p_cam_transform, state.ubo_data.camera_matrix);
store_transform(p_cam_transform.affine_inverse(), state.ubo_data.camera_inverse_matrix);
@@ -2521,9 +2550,10 @@ void RasterizerSceneGLES3::_setup_directional_light(int p_index, const Transform
float sign = li->light_ptr->negative ? -1 : 1;
Color linear_col = li->light_ptr->color.to_linear();
- ubo_data.light_color_energy[0] = linear_col.r * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];
- ubo_data.light_color_energy[1] = linear_col.g * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];
- ubo_data.light_color_energy[2] = linear_col.b * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];
+ //compensate normalized diffuse range by multiplying by PI
+ ubo_data.light_color_energy[0] = linear_col.r * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY] * Math_PI;
+ ubo_data.light_color_energy[1] = linear_col.g * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY] * Math_PI;
+ ubo_data.light_color_energy[2] = linear_col.b * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY] * Math_PI;
ubo_data.light_color_energy[3] = 0;
//omni, keep at 0
@@ -2661,9 +2691,9 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result, int p_light_c
float sign = li->light_ptr->negative ? -1 : 1;
Color linear_col = li->light_ptr->color.to_linear();
- ubo_data.light_color_energy[0] = linear_col.r * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];
- ubo_data.light_color_energy[1] = linear_col.g * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];
- ubo_data.light_color_energy[2] = linear_col.b * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];
+ ubo_data.light_color_energy[0] = linear_col.r * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY] * Math_PI;
+ ubo_data.light_color_energy[1] = linear_col.g * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY] * Math_PI;
+ ubo_data.light_color_energy[2] = linear_col.b * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY] * Math_PI;
ubo_data.light_color_energy[3] = 0;
Vector3 pos = p_camera_inverse_transform.xform(li->transform.origin);
@@ -2747,9 +2777,9 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result, int p_light_c
float sign = li->light_ptr->negative ? -1 : 1;
Color linear_col = li->light_ptr->color.to_linear();
- ubo_data.light_color_energy[0] = linear_col.r * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];
- ubo_data.light_color_energy[1] = linear_col.g * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];
- ubo_data.light_color_energy[2] = linear_col.b * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];
+ ubo_data.light_color_energy[0] = linear_col.r * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY] * Math_PI;
+ ubo_data.light_color_energy[1] = linear_col.g * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY] * Math_PI;
+ ubo_data.light_color_energy[2] = linear_col.b * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY] * Math_PI;
ubo_data.light_color_energy[3] = 0;
Vector3 pos = p_camera_inverse_transform.xform(li->transform.origin);
@@ -4257,7 +4287,7 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.fbo); //switch to alpha fbo for sky, only diffuse/ambient matters
*/
- _draw_sky(sky, p_cam_projection, p_cam_transform, false, env->sky_scale, env->bg_energy);
+ _draw_sky(sky, p_cam_projection, p_cam_transform, false, env->sky_custom_fov, env->bg_energy);
}
//_render_list_forward(&alpha_render_list,camera_transform,camera_transform_inverse,camera_projection,false,fragment_lighting,true);
@@ -5010,6 +5040,8 @@ void RasterizerSceneGLES3::initialize() {
}
state.debug_draw = VS::VIEWPORT_DEBUG_DRAW_DISABLED;
+
+ glFrontFace(GL_CW);
}
void RasterizerSceneGLES3::iteration() {
diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h
index 8669c42a7a..28a5cef0ee 100644
--- a/drivers/gles3/rasterizer_scene_gles3.h
+++ b/drivers/gles3/rasterizer_scene_gles3.h
@@ -110,6 +110,7 @@ public:
struct SceneDataUBO {
//this is a std140 compatible struct. Please read the OpenGL 3.3 Specificaiton spec before doing any changes
float projection_matrix[16];
+ float inv_projection_matrix[16];
float camera_inverse_matrix[16];
float camera_matrix[16];
float ambient_light_color[4];
@@ -351,7 +352,7 @@ public:
VS::EnvironmentBG bg_mode;
RID sky;
- float sky_scale;
+ float sky_custom_fov;
Color bg_color;
float bg_energy;
@@ -434,7 +435,7 @@ public:
Environment() {
bg_mode = VS::ENV_BG_CLEAR_COLOR;
- sky_scale = 1.0;
+ sky_custom_fov = 0.0;
bg_energy = 1.0;
sky_ambient = 0;
ambient_energy = 1.0;
@@ -519,7 +520,7 @@ public:
virtual void environment_set_background(RID p_env, VS::EnvironmentBG p_bg);
virtual void environment_set_sky(RID p_env, RID p_sky);
- virtual void environment_set_sky_scale(RID p_env, float p_scale);
+ virtual void environment_set_sky_custom_fov(RID p_env, float p_scale);
virtual void environment_set_bg_color(RID p_env, const Color &p_color);
virtual void environment_set_bg_energy(RID p_env, float p_energy);
virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer);
@@ -810,7 +811,7 @@ public:
_FORCE_INLINE_ void _add_geometry_with_material(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, RasterizerStorageGLES3::Material *p_material, bool p_depth_pass);
- 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 _draw_sky(RasterizerStorageGLES3::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_custom_fov, 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_transform, bool p_use_shadows);
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index b99817fb12..44a9909bd7 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -1564,6 +1564,7 @@ void RasterizerStorageGLES3::_update_shader(Shader *p_shader) const {
p_shader->canvas_item.blend_mode = Shader::CanvasItem::BLEND_MODE_MIX;
p_shader->canvas_item.uses_screen_texture = false;
p_shader->canvas_item.uses_screen_uv = false;
+ p_shader->canvas_item.uses_time = false;
shaders.actions_canvas.render_mode_values["blend_add"] = Pair<int *, int>(&p_shader->canvas_item.blend_mode, Shader::CanvasItem::BLEND_MODE_ADD);
shaders.actions_canvas.render_mode_values["blend_mix"] = Pair<int *, int>(&p_shader->canvas_item.blend_mode, Shader::CanvasItem::BLEND_MODE_MIX);
@@ -1595,6 +1596,7 @@ void RasterizerStorageGLES3::_update_shader(Shader *p_shader) const {
p_shader->spatial.unshaded = false;
p_shader->spatial.no_depth_test = false;
p_shader->spatial.uses_sss = false;
+ p_shader->spatial.uses_time = false;
p_shader->spatial.uses_vertex_lighting = false;
p_shader->spatial.uses_screen_texture = false;
p_shader->spatial.uses_vertex = false;
@@ -2471,7 +2473,7 @@ void RasterizerStorageGLES3::_update_material(Material *material) {
glGenBuffers(1, &material->ubo_id);
glBindBuffer(GL_UNIFORM_BUFFER, material->ubo_id);
- glBufferData(GL_UNIFORM_BUFFER, material->shader->ubo_size, NULL, GL_DYNAMIC_DRAW);
+ glBufferData(GL_UNIFORM_BUFFER, material->shader->ubo_size, NULL, GL_STATIC_DRAW);
glBindBuffer(GL_UNIFORM_BUFFER, 0);
material->ubo_size = material->shader->ubo_size;
}
@@ -3766,7 +3768,7 @@ void RasterizerStorageGLES3::multimesh_allocate(RID p_multimesh, int p_instances
glGenBuffers(1, &multimesh->buffer);
glBindBuffer(GL_ARRAY_BUFFER, multimesh->buffer);
- glBufferData(GL_ARRAY_BUFFER, multimesh->data.size() * sizeof(float), NULL, GL_DYNAMIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, multimesh->data.size() * sizeof(float), NULL, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
@@ -5213,7 +5215,7 @@ void RasterizerStorageGLES3::particles_set_amount(RID p_particles, int p_amount)
glBindVertexArray(particles->particle_vaos[i]);
glBindBuffer(GL_ARRAY_BUFFER, particles->particle_buffers[i]);
- glBufferData(GL_ARRAY_BUFFER, floats * sizeof(float), data, GL_DYNAMIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, floats * sizeof(float), data, GL_STATIC_DRAW);
for (int i = 0; i < 6; i++) {
glEnableVertexAttribArray(i);
@@ -6196,7 +6198,7 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt) {
rt->buffers.effects_active = true;
}
- if (!rt->flags[RENDER_TARGET_NO_SAMPLING]) {
+ if (!rt->flags[RENDER_TARGET_NO_SAMPLING] && rt->width >= 2 && rt->height >= 2) {
for (int i = 0; i < 2; i++) {
@@ -6509,7 +6511,7 @@ void RasterizerStorageGLES3::canvas_light_occluder_set_polylines(RID p_occluder,
if (!co->vertex_id) {
glGenBuffers(1, &co->vertex_id);
glBindBuffer(GL_ARRAY_BUFFER, co->vertex_id);
- glBufferData(GL_ARRAY_BUFFER, lc * 6 * sizeof(real_t), vw.ptr(), GL_DYNAMIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, lc * 6 * sizeof(real_t), vw.ptr(), GL_STATIC_DRAW);
} else {
glBindBuffer(GL_ARRAY_BUFFER, co->vertex_id);
diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp
index 5401c8266a..91159e3381 100644
--- a/drivers/gles3/shader_compiler_gles3.cpp
+++ b/drivers/gles3/shader_compiler_gles3.cpp
@@ -700,9 +700,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
/** CANVAS ITEM SHADER **/
- actions[VS::SHADER_CANVAS_ITEM].renames["SRC_VERTEX"] = "vertex";
actions[VS::SHADER_CANVAS_ITEM].renames["VERTEX"] = "outvec.xy";
- actions[VS::SHADER_CANVAS_ITEM].renames["VERTEX_COLOR"] = "vertex_color";
actions[VS::SHADER_CANVAS_ITEM].renames["UV"] = "uv_interp";
actions[VS::SHADER_CANVAS_ITEM].renames["POINT_SIZE"] = "gl_PointSize";
@@ -711,6 +709,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
actions[VS::SHADER_CANVAS_ITEM].renames["EXTRA_MATRIX"] == "extra_matrix";
actions[VS::SHADER_CANVAS_ITEM].renames["TIME"] = "time";
actions[VS::SHADER_CANVAS_ITEM].renames["AT_LIGHT_PASS"] = "at_light_pass";
+ actions[VS::SHADER_CANVAS_ITEM].renames["INSTANCE_CUSTOM"] = "instance_custom";
actions[VS::SHADER_CANVAS_ITEM].renames["COLOR"] = "color";
actions[VS::SHADER_CANVAS_ITEM].renames["NORMAL"] = "normal";
@@ -720,6 +719,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
actions[VS::SHADER_CANVAS_ITEM].renames["COLOR"] = "color";
actions[VS::SHADER_CANVAS_ITEM].renames["TEXTURE"] = "color_texture";
actions[VS::SHADER_CANVAS_ITEM].renames["TEXTURE_PIXEL_SIZE"] = "color_texpixel_size";
+ actions[VS::SHADER_CANVAS_ITEM].renames["NORMAL_TEXTURE"] = "normal_texture";
actions[VS::SHADER_CANVAS_ITEM].renames["SCREEN_UV"] = "screen_uv";
actions[VS::SHADER_CANVAS_ITEM].renames["SCREEN_TEXTURE"] = "screen_texture";
actions[VS::SHADER_CANVAS_ITEM].renames["SCREEN_PIXEL_SIZE"] = "screen_pixel_size";
@@ -750,6 +750,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
actions[VS::SHADER_SPATIAL].renames["INV_CAMERA_MATRIX"] = "camera_inverse_matrix";
actions[VS::SHADER_SPATIAL].renames["CAMERA_MATRIX"] = "camera_matrix";
actions[VS::SHADER_SPATIAL].renames["PROJECTION_MATRIX"] = "projection_matrix";
+ actions[VS::SHADER_SPATIAL].renames["INV_PROJECTION_MATRIX"] = "inv_projection_matrix";
actions[VS::SHADER_SPATIAL].renames["MODELVIEW_MATRIX"] = "modelview";
actions[VS::SHADER_SPATIAL].renames["VERTEX"] = "vertex.xyz";
@@ -786,6 +787,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
actions[VS::SHADER_SPATIAL].renames["SSS_STRENGTH"] = "sss_strength";
actions[VS::SHADER_SPATIAL].renames["TRANSMISSION"] = "transmission";
actions[VS::SHADER_SPATIAL].renames["AO"] = "ao";
+ actions[VS::SHADER_SPATIAL].renames["AO_LIGHT_AFFECT"] = "ao_light_affect";
actions[VS::SHADER_SPATIAL].renames["EMISSION"] = "emission";
//actions[VS::SHADER_SPATIAL].renames["SCREEN_UV"]=ShaderLanguage::TYPE_VEC2;
actions[VS::SHADER_SPATIAL].renames["POINT_COORD"] = "gl_PointCoord";
@@ -796,6 +798,13 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
actions[VS::SHADER_SPATIAL].renames["SIDE"] = "side";
actions[VS::SHADER_SPATIAL].renames["ALPHA_SCISSOR"] = "alpha_scissor";
+ //for light
+ actions[VS::SHADER_SPATIAL].renames["VIEW"] = "view";
+ actions[VS::SHADER_SPATIAL].renames["LIGHT_COLOR"] = "light_color";
+ actions[VS::SHADER_SPATIAL].renames["ATTENUATION"] = "attenuation";
+ actions[VS::SHADER_SPATIAL].renames["DIFFUSE_LIGHT"] = "diffuse_light";
+ actions[VS::SHADER_SPATIAL].renames["SPECULAR_LIGHT"] = "specular_light";
+
actions[VS::SHADER_SPATIAL].usage_defines["TANGENT"] = "#define ENABLE_TANGENT_INTERP\n";
actions[VS::SHADER_SPATIAL].usage_defines["BINORMAL"] = "@TANGENT";
actions[VS::SHADER_SPATIAL].usage_defines["RIM"] = "#define LIGHT_USE_RIM\n";
@@ -805,6 +814,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
actions[VS::SHADER_SPATIAL].usage_defines["ANISOTROPY"] = "#define LIGHT_USE_ANISOTROPY\n";
actions[VS::SHADER_SPATIAL].usage_defines["ANISOTROPY_FLOW"] = "@ANISOTROPY";
actions[VS::SHADER_SPATIAL].usage_defines["AO"] = "#define ENABLE_AO\n";
+ actions[VS::SHADER_SPATIAL].usage_defines["AO_LIGHT_AFFECT"] = "#define ENABLE_AO\n";
actions[VS::SHADER_SPATIAL].usage_defines["UV"] = "#define ENABLE_UV_INTERP\n";
actions[VS::SHADER_SPATIAL].usage_defines["UV2"] = "#define ENABLE_UV2_INTERP\n";
actions[VS::SHADER_SPATIAL].usage_defines["NORMALMAP"] = "#define ENABLE_NORMALMAP\n";
diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl
index bf8eaf601d..731d6968ce 100644
--- a/drivers/gles3/shaders/canvas.glsl
+++ b/drivers/gles3/shaders/canvas.glsl
@@ -105,13 +105,16 @@ VERTEX_SHADER_GLOBALS
void main() {
- vec4 vertex_color = color_attrib;
+ vec4 color = color_attrib;
#ifdef USE_INSTANCING
mat4 extra_matrix2 = extra_matrix * transpose(mat4(instance_xform0,instance_xform1,instance_xform2,vec4(0.0,0.0,0.0,1.0)));
- vertex_color*=instance_color;
+ color*=instance_color;
+ vec4 instance_custom = instance_custom_data;
+
#else
mat4 extra_matrix2 = extra_matrix;
+ vec4 instance_custom = vec4(0.0);
#endif
#ifdef USE_TEXTURE_RECT
@@ -135,7 +138,7 @@ void main() {
//compute h and v frames and adjust UV interp for animation
int total_frames = h_frames * v_frames;
- int frame = min(int(float(total_frames) *instance_custom_data.z),total_frames-1);
+ int frame = min(int(float(total_frames) *instance_custom.z),total_frames-1);
float frame_w = 1.0/float(h_frames);
float frame_h = 1.0/float(v_frames);
uv_interp.x = uv_interp.x * frame_w + frame_w * float(frame % h_frames);
@@ -146,7 +149,6 @@ void main() {
#define extra_matrix extra_matrix2
{
- vec2 src_vtx=outvec.xy;
VERTEX_SHADER_CODE
@@ -165,7 +167,7 @@ VERTEX_SHADER_CODE
#undef extra_matrix
- color_interp = vertex_color;
+ color_interp = color;
#ifdef USE_PIXEL_SNAP
diff --git a/drivers/gles3/shaders/copy.glsl b/drivers/gles3/shaders/copy.glsl
index d33193ee50..743fe122d1 100644
--- a/drivers/gles3/shaders/copy.glsl
+++ b/drivers/gles3/shaders/copy.glsl
@@ -27,6 +27,8 @@ void main() {
#if defined(USE_CUBEMAP) || defined(USE_PANORAMA)
cube_interp = cube_in;
+#elif defined(USE_ASYM_PANO)
+ uv_interp = vertex_attrib.xy;
#else
uv_interp = uv_in;
#ifdef V_FLIP
@@ -59,6 +61,11 @@ in vec3 cube_interp;
in vec2 uv_interp;
#endif
+#ifdef USE_ASYM_PANO
+uniform highp mat4 pano_transform;
+uniform highp vec4 asym_proj;
+#endif
+
#ifdef USE_CUBEMAP
uniform samplerCube source_cube; //texunit:0
#else
@@ -70,7 +77,7 @@ uniform sampler2D source; //texunit:0
uniform float multiplier;
#endif
-#ifdef USE_PANORAMA
+#if defined(USE_PANORAMA) || defined(USE_ASYM_PANO)
vec4 texturePanorama(vec3 normal,sampler2D pano ) {
@@ -122,6 +129,21 @@ void main() {
vec4 color = texturePanorama( normalize(cube_interp), source );
+#elif defined(USE_ASYM_PANO)
+
+ // When an assymetrical projection matrix is used (applicable for stereoscopic rendering i.e. VR) we need to do this calculation per fragment to get a perspective correct result.
+ // Note that we're ignoring the x-offset for IPD, with Z sufficiently in the distance it becomes neglectible, as a result we could probably just set cube_normal.z to -1.
+ // The Matrix[2][0] (= asym_proj.x) and Matrix[2][1] (= asym_proj.z) values are what provide the right shift in the image.
+
+ vec3 cube_normal;
+ cube_normal.z = -1000000.0;
+ cube_normal.x = (cube_normal.z * (-uv_interp.x - asym_proj.x)) / asym_proj.y;
+ cube_normal.y = (cube_normal.z * (-uv_interp.y - asym_proj.z)) / asym_proj.a;
+ cube_normal = mat3(pano_transform) * cube_normal;
+ cube_normal.z = -cube_normal.z;
+
+ vec4 color = texturePanorama( normalize(cube_normal.xyz), source );
+
#elif defined(USE_CUBEMAP)
vec4 color = texture( source_cube, normalize(cube_interp) );
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index 5f83033293..b322a4c957 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -1,5 +1,6 @@
[vertex]
+#define M_PI 3.14159265359
/*
from VisualServer:
@@ -61,6 +62,7 @@ layout(location=12) in highp vec4 instance_custom_data;
layout(std140) uniform SceneData { //ubo:0
highp mat4 projection_matrix;
+ highp mat4 inv_projection_matrix;
highp mat4 camera_inverse_matrix;
highp mat4 camera_matrix;
@@ -162,10 +164,10 @@ uniform int spot_light_count;
out vec4 diffuse_light_interp;
out vec4 specular_light_interp;
-void light_compute(vec3 N, vec3 L,vec3 V, vec3 light_color,float roughness,inout vec3 diffuse, inout vec3 specular) {
+void light_compute(vec3 N, vec3 L,vec3 V, vec3 light_color, float roughness, inout vec3 diffuse, inout vec3 specular) {
float dotNL = max(dot(N,L), 0.0 );
- diffuse += dotNL * light_color;
+ diffuse += dotNL * light_color / M_PI;
if (roughness > 0.0) {
@@ -588,7 +590,7 @@ vec3 textureDualParaboloid(sampler2DArray p_tex, vec3 p_vec,float p_roughness) {
norm.xy=norm.xy * vec2(0.5,0.25) + vec2(0.5,0.25);
// we need to lie the derivatives (normg) and assume that DP side is always the same
- // to get proper texure filtering
+ // to get proper texture filtering
vec2 normg=norm.xy;
if (norm.z>0.0) {
norm.y=0.5-norm.y+0.5;
@@ -643,6 +645,7 @@ FRAGMENT_SHADER_GLOBALS
layout(std140) uniform SceneData {
highp mat4 projection_matrix;
+ highp mat4 inv_projection_matrix;
highp mat4 camera_inverse_matrix;
highp mat4 camera_matrix;
@@ -862,11 +865,57 @@ float contact_shadow_compute(vec3 pos, vec3 dir, float max_distance) {
#endif
-// GGX Specular
-// Source: http://www.filmicworlds.com/images/ggx-opt/optimized-ggx.hlsl
-float G1V(float dotNV, float k)
-{
- return 1.0 / (dotNV * (1.0 - k) + k);
+
+// This returns the G_GGX function divided by 2 cos_theta_m, where in practice cos_theta_m is either N.L or N.V.
+// We're dividing this factor off because the overall term we'll end up looks like
+// (see, for example, the first unnumbered equation in B. Burley, "Physically Based Shading at Disney", SIGGRAPH 2012):
+//
+// F(L.V) D(N.H) G(N.L) G(N.V) / (4 N.L N.V)
+//
+// We're basically regouping this as
+//
+// F(L.V) D(N.H) [G(N.L)/(2 N.L)] [G(N.V) / (2 N.V)]
+//
+// and thus, this function implements the [G(N.m)/(2 N.m)] part with m = L or V.
+//
+// The contents of the D and G (G1) functions (GGX) are taken from
+// E. Heitz, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs", J. Comp. Graph. Tech. 3 (2) (2014).
+// Eqns 71-72 and 85-86 (see also Eqns 43 and 80).
+
+float G_GGX_2cos(float cos_theta_m, float alpha) {
+ // Schlick's approximation
+ // C. Schlick, "An Inexpensive BRDF Model for Physically-based Rendering", Computer Graphics Forum. 13 (3): 233 (1994)
+ // Eq. (19), although see Heitz (2014) the about the problems with his derivation.
+ // It nevertheless approximates GGX well with k = alpha/2.
+ float k = 0.5*alpha;
+ return 0.5 / (cos_theta_m * (1.0 - k) + k);
+
+ // float cos2 = cos_theta_m*cos_theta_m;
+ // float sin2 = (1.0-cos2);
+ // return 1.0 /( cos_theta_m + sqrt(cos2 + alpha*alpha*sin2) );
+}
+
+float D_GXX(float cos_theta_m, float alpha) {
+ float alpha2 = alpha*alpha;
+ float d = 1.0 + (alpha2-1.0)*cos_theta_m*cos_theta_m;
+ return alpha2/(M_PI * d * d);
+}
+
+float G_GGX_anisotropic_2cos(float cos_theta_m, float alpha_x, float alpha_y, float cos_phi, float sin_phi) {
+ float cos2 = cos_theta_m * cos_theta_m;
+ float sin2 = (1.0-cos2);
+ float s_x = alpha_x * cos_phi;
+ float s_y = alpha_y * sin_phi;
+ return 1.0 / (cos_theta_m + sqrt(cos2 + (s_x*s_x + s_y*s_y)*sin2 ));
+}
+
+float D_GXX_anisotropic(float cos_theta_m, float alpha_x, float alpha_y, float cos_phi, float sin_phi) {
+ float cos2 = cos_theta_m * cos_theta_m;
+ float sin2 = (1.0-cos2);
+ float r_x = cos_phi/alpha_x;
+ float r_y = sin_phi/alpha_y;
+ float d = cos2 + sin2*(r_x * r_x + r_y * r_y);
+ return 1.0 / (M_PI * alpha_x * alpha_y * d * d );
}
@@ -885,52 +934,62 @@ float GTR1(float NdotH, float a)
return (a2-1.0) / (M_PI*log(a2)*t);
}
+vec3 metallic_to_specular_color(float metallic, float specular, vec3 albedo) {
+ float dielectric = (0.034 * 2.0) * specular;
+ // energy conservation
+ return mix(vec3(dielectric), albedo, metallic); // TODO: reference?
+}
-
-void light_compute(vec3 N, vec3 L,vec3 V,vec3 B, vec3 T,vec3 light_color,vec3 diffuse_color, vec3 transmission, float specular_blob_intensity, float roughness, float rim,float rim_tint, float clearcoat, float clearcoat_gloss,float anisotropy,inout vec3 diffuse, inout vec3 specular) {
+void light_compute(vec3 N, vec3 L, vec3 V, vec3 B, vec3 T, vec3 light_color, vec3 attenuation, vec3 diffuse_color, vec3 transmission, float specular_blob_intensity, float roughness, float rim, float rim_tint, float clearcoat, float clearcoat_gloss, float anisotropy, inout vec3 diffuse_light, inout vec3 specular_light) {
#if defined(USE_LIGHT_SHADER_CODE)
//light is written by the light shader
+ vec3 normal = N;
+ vec3 albedo = diffuse_color;
+ vec3 light = L;
+ vec3 view = V;
LIGHT_SHADER_CODE
#else
-
- float dotNL = max(dot(N,L), 0.0 );
+ float NdotL = dot(N,L);
+ float cNdotL = max(NdotL, 0.0); // clamped NdotL
+ float NdotV = dot(N, V);
+ float cNdotV = max(NdotV, 0.0);
#if defined(DIFFUSE_OREN_NAYAR)
- vec3 light_amount;
+ vec3 diffuse_brdf_NL;
#else
- float light_amount;
+ float diffuse_brdf_NL; // BRDF times N.L for calculating diffuse radiance
#endif
#if defined(DIFFUSE_LAMBERT_WRAP)
//energy conserving lambert wrap shader
- light_amount = max(0.0,(dot(N,L) + roughness) / ((1.0 + roughness) * (1.0 + roughness)));
+ diffuse_brdf_NL = max(0.0,(NdotL + roughness) / ((1.0 + roughness) * (1.0 + roughness)));
#elif defined(DIFFUSE_OREN_NAYAR)
{
+ // see http://mimosa-pudica.net/improved-oren-nayar.html
float LdotV = dot(L, V);
- float NdotL = dot(L, N);
- float NdotV = dot(N, V);
+
float s = LdotV - NdotL * NdotV;
float t = mix(1.0, max(NdotL, NdotV), step(0.0, s));
- float sigma2 = roughness * roughness;
- vec3 A = 1.0 + sigma2 * (diffuse_color / (sigma2 + 0.13) + 0.5 / (sigma2 + 0.33));
+ float sigma2 = roughness * roughness; // TODO: this needs checking
+ vec3 A = 1.0 + sigma2 * (- 0.5 / (sigma2 + 0.33) + 0.17*diffuse_color / (sigma2 + 0.13) );
float B = 0.45 * sigma2 / (sigma2 + 0.09);
- light_amount = max(0.0, NdotL) * (A + vec3(B) * s / t) / M_PI;
+ diffuse_brdf_NL = cNdotL * (A + vec3(B) * s / t) * (1.0 / M_PI);
}
#elif defined(DIFFUSE_TOON)
- light_amount = smoothstep(-roughness,max(roughness,0.01),dot(N,L));
+ diffuse_brdf_NL = smoothstep(-roughness,max(roughness,0.01),NdotL);
#elif defined(DIFFUSE_BURLEY)
@@ -938,40 +997,38 @@ LIGHT_SHADER_CODE
vec3 H = normalize(V + L);
- float NoL = max(0.0,dot(N, L));
- float VoH = max(0.0,dot(L, H));
- float NoV = max(0.0,dot(N, V));
-
- float FD90 = 0.5 + 2.0 * VoH * VoH * roughness;
- float FdV = 1.0 + (FD90 - 1.0) * pow( 1.0 - NoV, 5.0 );
- float FdL = 1.0 + (FD90 - 1.0) * pow( 1.0 - NoL, 5.0 );
- light_amount = ( (1.0 / M_PI) * FdV * FdL );
+ float cLdotH = max(0.0,dot(L, H));
+
+ float FD90 = 0.5 + 2.0 * cLdotH * cLdotH * roughness;
+ float FdV = 1.0 + (FD90 - 1.0) * SchlickFresnel(cNdotV);
+ float FdL = 1.0 + (FD90 - 1.0) * SchlickFresnel(cNdotL);
+ diffuse_brdf_NL = (1.0 / M_PI) * FdV * FdL * cNdotL;
/*
float energyBias = mix(roughness, 0.0, 0.5);
float energyFactor = mix(roughness, 1.0, 1.0 / 1.51);
float fd90 = energyBias + 2.0 * VoH * VoH * roughness;
float f0 = 1.0;
- float lightScatter = f0 + (fd90 - f0) * pow(1.0 - NoL, 5.0);
- float viewScatter = f0 + (fd90 - f0) * pow(1.0 - NoV, 5.0);
+ float lightScatter = f0 + (fd90 - f0) * pow(1.0 - cNdotL, 5.0);
+ float viewScatter = f0 + (fd90 - f0) * pow(1.0 - cNdotV, 5.0);
- light_amount = lightScatter * viewScatter * energyFactor;*/
+ diffuse_brdf_NL = lightScatter * viewScatter * energyFactor;*/
}
#else
//lambert
- light_amount = dotNL;
+ diffuse_brdf_NL = cNdotL * (1.0 / M_PI);
#endif
#if defined(TRANSMISSION_USED)
- diffuse += light_color * diffuse_color * mix(vec3(light_amount),vec3(1.0),transmission);
+ diffuse_light += light_color * diffuse_color * mix(vec3(diffuse_brdf_NL), vec3(M_PI), transmission) * attenuation;
#else
- diffuse += light_color * diffuse_color * light_amount;
+ diffuse_light += light_color * diffuse_color * diffuse_brdf_NL * attenuation;
#endif
- float dotNV = max(dot(N,V), 0.0 );
+
#if defined(LIGHT_USE_RIM)
- float rim_light = pow(1.0-dotNV,(1.0-roughness)*16.0);
- diffuse += rim_light * rim * mix(vec3(1.0),diffuse_color,rim_tint) * light_color;
+ float rim_light = pow(1.0-cNdotV, (1.0-roughness)*16.0);
+ diffuse_light += rim_light * rim * mix(vec3(1.0),diffuse_color,rim_tint) * light_color;
#endif
@@ -983,37 +1040,36 @@ LIGHT_SHADER_CODE
#if defined(SPECULAR_BLINN)
vec3 H = normalize(V + L);
- float dotNH = max(dot(N,H), 0.0 );
- float intensity = pow( dotNH, (1.0-roughness) * 256.0);
- specular += light_color * intensity * specular_blob_intensity;
+ float cNdotH = max(dot(N,H), 0.0 );
+ float intensity = pow( cNdotH, (1.0-roughness) * 256.0);
+ specular_light += light_color * intensity * specular_blob_intensity * attenuation;
#elif defined(SPECULAR_PHONG)
vec3 R = normalize(-reflect(L,N));
- float dotNV = max(0.0,dot(R,V));
- float intensity = pow( dotNV, (1.0-roughness) * 256.0);
- specular += light_color * intensity * specular_blob_intensity;
+ float cRdotV = max(0.0,dot(R,V));
+ float intensity = pow( cRdotV, (1.0-roughness) * 256.0);
+ specular_light += light_color * intensity * specular_blob_intensity * attenuation;
#elif defined(SPECULAR_TOON)
vec3 R = normalize(-reflect(L,N));
- float dotNV = dot(R,V);
+ float RdotV = dot(R,V);
float mid = 1.0-roughness;
mid*=mid;
- float intensity = smoothstep(mid-roughness*0.5,mid+roughness*0.5,dotNV) * mid;
- diffuse += light_color * intensity * specular_blob_intensity; //write to diffuse, as in toon shading you generally want no reflection
+ float intensity = smoothstep(mid-roughness*0.5, mid+roughness*0.5, RdotV) * mid;
+ diffuse_light += light_color * intensity * specular_blob_intensity * attenuation; // write to diffuse_light, as in toon shading you generally want no reflection
#elif defined(SPECULAR_DISABLED)
//none..
-#else
+#elif defined(SPECULAR_SCHLICK_GGX)
// shlick+ggx as default
- float alpha = roughness * roughness;
vec3 H = normalize(V + L);
- float dotNH = max(dot(N,H), 0.0 );
- float dotLH = max(dot(L,H), 0.0 );
+ float cNdotH = max(dot(N,H), 0.0);
+ float cLdotH = max(dot(L,H), 0.0);
#if defined(LIGHT_USE_ANISOTROPY)
@@ -1022,38 +1078,42 @@ LIGHT_SHADER_CODE
float ry = roughness*aspect;
float ax = rx*rx;
float ay = ry*ry;
- float dotXH = dot( T, H );
- float dotYH = dot( B, H );
- float pi = M_PI;
- float denom = dotXH*dotXH / (ax*ax) + dotYH*dotYH / (ay*ay) + dotNH*dotNH;
- float D = 1.0 / ( pi * ax*ay * denom*denom );
+ float XdotH = dot( T, H );
+ float YdotH = dot( B, H );
+ float D = D_GXX_anisotropic(cNdotH, ax, ay, XdotH, YdotH);
+ float G = G_GGX_anisotropic_2cos(cNdotL, ax, ay, XdotH, YdotH) * G_GGX_anisotropic_2cos(cNdotV, ax, ay, XdotH, YdotH);
#else
- float alphaSqr = alpha * alpha;
- float pi = M_PI;
- float denom = dotNH * dotNH * (alphaSqr - 1.0) + 1.0;
- float D = alphaSqr / (pi * denom * denom);
+ float alpha = roughness * roughness;
+ float D = D_GGX(cNdotH, alpha);
+ float G = G_GGX_2cos(cNdotL, alpha) * G_GGX_2cos(cNdotV, alpha);
#endif
// F
- float F0 = 1.0;
- float dotLH5 = SchlickFresnel( dotLH );
- float F = F0 + (1.0 - F0) * (dotLH5);
+ float F0 = 1.0; // FIXME
+ float cLdotH5 = SchlickFresnel(cLdotH);
+ float F = mix(cLdotH5, 1.0, F0);
- // V
- float k = alpha / 2.0f;
- float vis = G1V(dotNL, k) * G1V(dotNV, k);
+ float specular_brdf_NL = cNdotL * D * F * G;
- float speci = dotNL * D * F * vis;
-
- specular += speci * light_color * specular_blob_intensity;
+ specular_light += specular_brdf_NL * light_color * specular_blob_intensity * attenuation;
#endif
#if defined(LIGHT_USE_CLEARCOAT)
- float Dr = GTR1(dotNH, mix(.1,.001,clearcoat_gloss));
- float Fr = mix(.04, 1.0, dotLH5);
- float Gr = G1V(dotNL, .25) * G1V(dotNV, .25);
- specular += .25*clearcoat*Gr*Fr*Dr;
+# if !defined(SPECULAR_SCHLICK_GGX) && !defined(SPECULAR_BLINN)
+ vec3 H = normalize(V + L);
+# endif
+# if !defined(SPECULAR_SCHLICK_GGX)
+ float cNdotH = max(dot(N,H), 0.0);
+ float cLdotH = max(dot(L,H), 0.0);
+ float cLdotH5 = SchlickFresnel(cLdotH);
+#endif
+ float Dr = GTR1(cNdotH, mix(.1, .001, clearcoat_gloss));
+ float Fr = mix(.04, 1.0, cLdotH5);
+ float Gr = G_GGX_2cos(cNdotL, .25) * G_GGX_2cos(cNdotV, .25);
+
+
+ specular_light += .25*clearcoat*Gr*Fr*Dr;
#endif
}
@@ -1081,9 +1141,7 @@ float sample_shadow(highp sampler2DShadow shadow, vec2 shadow_pixel_size, vec2 p
avg+=textureProj(shadow,vec4(pos+vec2(0.0,-shadow_pixel_size.y*2.0),depth,1.0));
return avg*(1.0/13.0);
-#endif
-
-#ifdef SHADOW_MODE_PCF_5
+#elif defined(SHADOW_MODE_PCF_5)
float avg=textureProj(shadow,vec4(pos,depth,1.0));
avg+=textureProj(shadow,vec4(pos+vec2(shadow_pixel_size.x,0.0),depth,1.0));
@@ -1091,11 +1149,11 @@ float sample_shadow(highp sampler2DShadow shadow, vec2 shadow_pixel_size, vec2 p
avg+=textureProj(shadow,vec4(pos+vec2(0.0,shadow_pixel_size.y),depth,1.0));
avg+=textureProj(shadow,vec4(pos+vec2(0.0,-shadow_pixel_size.y),depth,1.0));
return avg*(1.0/5.0);
-#endif
-#if !defined(SHADOW_MODE_PCF_5) && !defined(SHADOW_MODE_PCF_13)
+#else
return textureProj(shadow,vec4(pos,depth,1.0));
+
#endif
}
@@ -1137,7 +1195,7 @@ vec3 light_transmittance(float translucency,vec3 light_vec, vec3 normal, vec3 po
}
#endif
-void light_process_omni(int idx, vec3 vertex, vec3 eye_vec,vec3 normal,vec3 binormal, vec3 tangent, vec3 albedo, vec3 transmission, float roughness, float rim, float rim_tint, float clearcoat, float clearcoat_gloss,float anisotropy,float p_blob_intensity,inout vec3 diffuse_light, inout vec3 specular_light) {
+void light_process_omni(int idx, vec3 vertex, vec3 eye_vec,vec3 normal,vec3 binormal, vec3 tangent, vec3 albedo, vec3 transmission, float roughness, float rim, float rim_tint, float clearcoat, float clearcoat_gloss, float anisotropy, float p_blob_intensity, inout vec3 diffuse_light, inout vec3 specular_light) {
vec3 light_rel_vec = omni_lights[idx].light_pos_inv_radius.xyz-vertex;
float light_length = length( light_rel_vec );
@@ -1191,7 +1249,7 @@ void light_process_omni(int idx, vec3 vertex, vec3 eye_vec,vec3 normal,vec3 bino
light_attenuation*=mix(omni_lights[idx].shadow_color_contact.rgb,vec3(1.0),shadow);
}
- light_compute(normal,normalize(light_rel_vec),eye_vec,binormal,tangent,omni_lights[idx].light_color_energy.rgb*light_attenuation,albedo,transmission,omni_lights[idx].light_params.z*p_blob_intensity,roughness,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light);
+ light_compute(normal,normalize(light_rel_vec),eye_vec,binormal,tangent,omni_lights[idx].light_color_energy.rgb,light_attenuation,albedo,transmission,omni_lights[idx].light_params.z*p_blob_intensity,roughness,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light);
}
@@ -1225,7 +1283,7 @@ void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 bi
light_attenuation*=mix(spot_lights[idx].shadow_color_contact.rgb,vec3(1.0),shadow);
}
- light_compute(normal,normalize(light_rel_vec),eye_vec,binormal,tangent,spot_lights[idx].light_color_energy.rgb*light_attenuation,albedo,transmission,spot_lights[idx].light_params.z*p_blob_intensity,roughness,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light);
+ light_compute(normal,normalize(light_rel_vec),eye_vec,binormal,tangent,spot_lights[idx].light_color_energy.rgb,light_attenuation,albedo,transmission,spot_lights[idx].light_params.z*p_blob_intensity,roughness,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light);
}
@@ -1534,6 +1592,7 @@ void main() {
#if defined(ENABLE_AO)
float ao=1.0;
+ float ao_light_affect=0.0;
#endif
float alpha = 1.0;
@@ -1857,7 +1916,7 @@ FRAGMENT_SHADER_CODE
specular_light*=mix(vec3(1.0),light_attenuation,specular_light_interp.a);
#else
- light_compute(normal,-light_direction_attenuation.xyz,eye_vec,binormal,tangent,light_color_energy.rgb*light_attenuation,albedo,transmission,light_params.z*specular_blob_intensity,roughness,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light);
+ light_compute(normal,-light_direction_attenuation.xyz,eye_vec,binormal,tangent,light_color_energy.rgb,light_attenuation,albedo,transmission,light_params.z*specular_blob_intensity,roughness,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light);
#endif
@@ -1918,12 +1977,16 @@ FRAGMENT_SHADER_CODE
#if defined(ENABLE_AO)
ambient_light*=ao;
+ ao_light_affect = mix(1.0,ao,ao_light_affect);
+ specular_light*=ao_light_affect;
+ diffuse_light*=ao_light_affect;
#endif
- //energu conservation
- diffuse_light=mix(diffuse_light,vec3(0.0),metallic);
- ambient_light=mix(ambient_light,vec3(0.0),metallic);
+
+ //energy conservation
+ diffuse_light *= 1.0-metallic; // TODO: avoid diffuse and ambient light calculations when metallic == 1
+ ambient_light *= 1.0-metallic;
{
@@ -1932,18 +1995,17 @@ FRAGMENT_SHADER_CODE
//simplify for toon, as
specular_light *= specular * metallic * albedo * 2.0;
#else
- //brdf approximation (Lazarov 2013)
- float ndotv = clamp(dot(normal,eye_vec),0.0,1.0);
- vec3 dielectric = vec3(0.034) * specular * 2.0;
- //energy conservation
- vec3 f0 = mix(dielectric, albedo, metallic);
+ // Environment brdf approximation (Lazarov 2013)
+ // see https://www.unrealengine.com/en-US/blog/physically-based-shading-on-mobile
const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);
const vec4 c1 = vec4( 1.0, 0.0425, 1.04, -0.04);
vec4 r = roughness * c0 + c1;
+ float ndotv = clamp(dot(normal,eye_vec),0.0,1.0);
float a004 = min( r.x * r.x, exp2( -9.28 * ndotv ) ) * r.x + r.y;
- vec2 brdf = vec2( -1.04, 1.04 ) * a004 + r.zw;
+ vec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;
- specular_light *= min(1.0,50.0 * f0.g) * brdf.y + brdf.x * f0;
+ vec3 specular_color = metallic_to_specular_color(metallic, specular, albedo);
+ specular_light *= AB.x * specular_color + AB.y;
#endif
}
diff --git a/drivers/gles3/shaders/subsurf_scattering.glsl b/drivers/gles3/shaders/subsurf_scattering.glsl
index 20c3b7473f..fc66d66198 100644
--- a/drivers/gles3/shaders/subsurf_scattering.glsl
+++ b/drivers/gles3/shaders/subsurf_scattering.glsl
@@ -82,18 +82,18 @@ QUALIFIER vec2 kernel[17] = vec2[](
const int kernel_size=11;
-QUALIFIER vec4 kernel[11] = vec4[](
- vec4(0.560479, 0.0),
- vec4(0.00471691, -2.0),
- vec4(0.0192831, -1.28),
- vec4(0.03639, -0.72),
- vec4(0.0821904, -0.32),
- vec4(0.0771802, -0.08),
- vec4(0.0771802, 0.08),
- vec4(0.0821904, 0.32),
- vec4(0.03639, 0.72),
- vec4(0.0192831, 1.28),
- vec4(0.00471691,2.0)
+QUALIFIER vec2 kernel[11] = vec2[](
+ vec2(0.560479, 0.0),
+ vec2(0.00471691, -2.0),
+ vec2(0.0192831, -1.28),
+ vec2(0.03639, -0.72),
+ vec2(0.0821904, -0.32),
+ vec2(0.0771802, -0.08),
+ vec2(0.0771802, 0.08),
+ vec2(0.0821904, 0.32),
+ vec2(0.03639, 0.72),
+ vec2(0.0192831, 1.28),
+ vec2(0.00471691,2.0)
);
#endif //USE_11_SAMPLES
@@ -190,4 +190,3 @@ void main() {
frag_color = base_color;
}
}
-
diff --git a/drivers/png/SCsub b/drivers/png/SCsub
index 6684e36b20..39480351a6 100644
--- a/drivers/png/SCsub
+++ b/drivers/png/SCsub
@@ -5,7 +5,7 @@ Import('env')
env_png = env.Clone()
# Thirdparty source files
-if (env['builtin_libpng'] != 'no'):
+if env['builtin_libpng']:
thirdparty_dir = "#thirdparty/libpng/"
thirdparty_sources = [
"png.c",
diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp
index 649f874cf4..206f57d4a2 100644
--- a/drivers/unix/file_access_unix.cpp
+++ b/drivers/unix/file_access_unix.cpp
@@ -223,6 +223,12 @@ Error FileAccessUnix::get_error() const {
return last_error;
}
+void FileAccessUnix::flush() {
+
+ ERR_FAIL_COND(!f);
+ fflush(f);
+}
+
void FileAccessUnix::store_8(uint8_t p_dest) {
ERR_FAIL_COND(!f);
diff --git a/drivers/unix/file_access_unix.h b/drivers/unix/file_access_unix.h
index e2848e4128..96f2ff8e26 100644
--- a/drivers/unix/file_access_unix.h
+++ b/drivers/unix/file_access_unix.h
@@ -72,6 +72,7 @@ public:
virtual Error get_error() const; ///< get last error
+ virtual void flush();
virtual void store_8(uint8_t p_dest); ///< store a byte
virtual bool file_exists(const String &p_path); ///< return true if a file exists
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index 75c8a153f6..e0a62b316d 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -64,39 +64,7 @@
#include <string.h>
#include <sys/time.h>
#include <sys/wait.h>
-
-extern bool _print_error_enabled;
-
-void OS_Unix::print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type) {
-
- if (!_print_error_enabled)
- return;
-
- const char *err_details;
- if (p_rationale && p_rationale[0])
- err_details = p_rationale;
- else
- err_details = p_code;
-
- switch (p_type) {
- case ERR_ERROR:
- print("\E[1;31mERROR: %s: \E[0m\E[1m%s\n", p_function, err_details);
- print("\E[0;31m At: %s:%i.\E[0m\n", p_file, p_line);
- break;
- case ERR_WARNING:
- print("\E[1;33mWARNING: %s: \E[0m\E[1m%s\n", p_function, err_details);
- print("\E[0;33m At: %s:%i.\E[0m\n", p_file, p_line);
- break;
- case ERR_SCRIPT:
- print("\E[1;35mSCRIPT ERROR: %s: \E[0m\E[1m%s\n", p_function, err_details);
- print("\E[0;35m At: %s:%i.\E[0m\n", p_file, p_line);
- break;
- case ERR_SHADER:
- print("\E[1;36mSHADER ERROR: %s: \E[0m\E[1m%s\n", p_function, err_details);
- print("\E[0;36m At: %s:%i.\E[0m\n", p_file, p_line);
- break;
- }
-}
+#include <unistd.h>
void OS_Unix::debug_break() {
@@ -165,29 +133,16 @@ void OS_Unix::initialize_core() {
}
}
-void OS_Unix::finalize_core() {
+void OS_Unix::initialize_logger() {
+ Vector<Logger *> loggers;
+ loggers.push_back(memnew(UnixTerminalLogger));
+ loggers.push_back(memnew(RotatedFileLogger("user://logs/log.txt")));
+ _set_logger(memnew(CompositeLogger(loggers)));
}
-void OS_Unix::vprint(const char *p_format, va_list p_list, bool p_stder) {
-
- if (p_stder) {
-
- vfprintf(stderr, p_format, p_list);
- fflush(stderr);
- } else {
-
- vprintf(p_format, p_list);
- fflush(stdout);
- }
+void OS_Unix::finalize_core() {
}
-void OS_Unix::print(const char *p_format, ...) {
-
- va_list argp;
- va_start(argp, p_format);
- vprintf(p_format, argp);
- va_end(argp);
-}
void OS_Unix::alert(const String &p_alert, const String &p_title) {
fprintf(stderr, "ERROR: %s\n", p_alert.utf8().get_data());
@@ -330,7 +285,7 @@ uint64_t OS_Unix::get_ticks_usec() const {
return longtime;
}
-Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode) {
+Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode, bool read_stderr) {
if (p_blocking && r_pipe) {
@@ -342,7 +297,11 @@ Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bo
argss += String(" \"") + p_arguments[i] + "\"";
}
- argss += " 2>/dev/null"; //silence stderr
+ if (read_stderr) {
+ argss += " 2>&1"; // Read stderr too
+ } else {
+ argss += " 2>/dev/null"; //silence stderr
+ }
FILE *f = popen(argss.utf8().get_data(), "r");
ERR_FAIL_COND_V(!f, ERR_CANT_OPEN);
@@ -559,4 +518,38 @@ String OS_Unix::get_executable_path() const {
#endif
}
+void UnixTerminalLogger::log_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type) {
+ if (!should_log(true)) {
+ return;
+ }
+
+ const char *err_details;
+ if (p_rationale && p_rationale[0])
+ err_details = p_rationale;
+ else
+ err_details = p_code;
+
+ switch (p_type) {
+ case ERR_WARNING:
+ logf_error("\E[1;33mWARNING: %s: \E[0m\E[1m%s\n", p_function, err_details);
+ logf_error("\E[0;33m At: %s:%i.\E[0m\n", p_file, p_line);
+ break;
+ case ERR_SCRIPT:
+ logf_error("\E[1;35mSCRIPT ERROR: %s: \E[0m\E[1m%s\n", p_function, err_details);
+ logf_error("\E[0;35m At: %s:%i.\E[0m\n", p_file, p_line);
+ break;
+ case ERR_SHADER:
+ logf_error("\E[1;36mSHADER ERROR: %s: \E[0m\E[1m%s\n", p_function, err_details);
+ logf_error("\E[0;36m At: %s:%i.\E[0m\n", p_file, p_line);
+ break;
+ case ERR_ERROR:
+ default:
+ logf_error("\E[1;31mERROR: %s: \E[0m\E[1m%s\n", p_function, err_details);
+ logf_error("\E[0;31m At: %s:%i.\E[0m\n", p_file, p_line);
+ break;
+ }
+}
+
+UnixTerminalLogger::~UnixTerminalLogger() {}
+
#endif
diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h
index 19e79728fb..87e73534c4 100644
--- a/drivers/unix/os_unix.h
+++ b/drivers/unix/os_unix.h
@@ -54,11 +54,11 @@ protected:
virtual int get_audio_driver_count() const;
virtual const char *get_audio_driver_name(int p_driver) const;
+ virtual void initialize_logger();
virtual void initialize_core();
virtual int unix_initialize_audio(int p_audio_driver);
//virtual void initialize(int p_video_driver,int p_audio_driver);
- //virtual void finalize();
virtual void finalize_core();
String stdin_buf;
@@ -66,10 +66,6 @@ protected:
String get_global_settings_path() const;
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_stder = false);
virtual void alert(const String &p_alert, const String &p_title = "ALERT!");
virtual String get_stdin_string(bool p_block);
@@ -101,7 +97,7 @@ public:
virtual void delay_usec(uint32_t p_usec) const;
virtual uint64_t get_ticks_usec() const;
- virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL);
+ virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false);
virtual Error kill(const ProcessID &p_pid);
virtual int get_process_id() const;
@@ -120,6 +116,12 @@ public:
//virtual void run( MainLoop * p_main_loop );
};
+class UnixTerminalLogger : public StdLogger {
+public:
+ virtual void log_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 ~UnixTerminalLogger();
+};
+
#endif
#endif
diff --git a/drivers/unix/syslog_logger.cpp b/drivers/unix/syslog_logger.cpp
new file mode 100644
index 0000000000..d57f391325
--- /dev/null
+++ b/drivers/unix/syslog_logger.cpp
@@ -0,0 +1,71 @@
+/*************************************************************************/
+/* syslog_logger.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifdef UNIX_ENABLED
+
+#include "syslog_logger.h"
+#include "print_string.h"
+#include <syslog.h>
+
+void SyslogLogger::logv(const char *p_format, va_list p_list, bool p_err) {
+ if (!should_log(p_err)) {
+ return;
+ }
+
+ vsyslog(p_err ? LOG_ERR : LOG_INFO, p_format, p_list);
+}
+
+void SyslogLogger::print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type) {
+ if (!should_log(true)) {
+ return;
+ }
+
+ const char *err_type = "**ERROR**";
+ switch (p_type) {
+ case ERR_ERROR: err_type = "**ERROR**"; break;
+ case ERR_WARNING: err_type = "**WARNING**"; break;
+ case ERR_SCRIPT: err_type = "**SCRIPT ERROR**"; break;
+ case ERR_SHADER: err_type = "**SHADER ERROR**"; break;
+ default: ERR_PRINT("Unknown error type"); break;
+ }
+
+ const char *err_details;
+ if (p_rationale && *p_rationale)
+ err_details = p_rationale;
+ else
+ err_details = p_code;
+
+ syslog(p_type == ERR_WARNING ? LOG_WARNING : LOG_ERR, "%s: %s\n At: %s:%i:%s() - %s", err_type, err_details, p_file, p_line, p_function, p_code);
+}
+
+SyslogLogger::~SyslogLogger() {
+}
+
+#endif \ No newline at end of file
diff --git a/drivers/unix/syslog_logger.h b/drivers/unix/syslog_logger.h
new file mode 100644
index 0000000000..b3cf2f9e3a
--- /dev/null
+++ b/drivers/unix/syslog_logger.h
@@ -0,0 +1,48 @@
+/*************************************************************************/
+/* syslog_logger.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef SYSLOG_LOGGER_H
+#define SYSLOG_LOGGER_H
+
+#ifdef UNIX_ENABLED
+
+#include "io/logger.h"
+
+class SyslogLogger : public Logger {
+public:
+ virtual void logv(const char *p_format, va_list p_list, bool p_err);
+ 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);
+
+ virtual ~SyslogLogger();
+};
+
+#endif
+
+#endif \ No newline at end of file
diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp
index 6d6a6027d9..8d6e78dbee 100644
--- a/drivers/windows/dir_access_windows.cpp
+++ b/drivers/windows/dir_access_windows.cpp
@@ -162,10 +162,10 @@ Error DirAccessWindows::make_dir(String p_dir) {
GLOBAL_LOCK_FUNCTION
+ p_dir = fix_path(p_dir);
if (p_dir.is_rel_path())
p_dir = get_current_dir().plus_file(p_dir);
- p_dir = fix_path(p_dir);
p_dir = p_dir.replace("/", "\\");
bool success;
diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp
index d128b58244..3b6e469c9c 100644
--- a/drivers/windows/file_access_windows.cpp
+++ b/drivers/windows/file_access_windows.cpp
@@ -207,6 +207,12 @@ Error FileAccessWindows::get_error() const {
return last_error;
}
+void FileAccessWindows::flush() {
+
+ ERR_FAIL_COND(!f);
+ fflush(f);
+}
+
void FileAccessWindows::store_8(uint8_t p_dest) {
ERR_FAIL_COND(!f);
diff --git a/drivers/windows/file_access_windows.h b/drivers/windows/file_access_windows.h
index 15cbdca739..e5e7fd4a13 100644
--- a/drivers/windows/file_access_windows.h
+++ b/drivers/windows/file_access_windows.h
@@ -64,6 +64,7 @@ public:
virtual Error get_error() const; ///< get last error
+ virtual void flush();
virtual void store_8(uint8_t p_dest); ///< store a byte
virtual bool file_exists(const String &p_name); ///< return true if a file exists
diff --git a/editor/SCsub b/editor/SCsub
index 315865ad32..772feca5f8 100644
--- a/editor/SCsub
+++ b/editor/SCsub
@@ -4,7 +4,7 @@ Import('env')
env.editor_sources = []
import os
-from compat import encode_utf8, byte_to_str, open_utf8
+from compat import encode_utf8, byte_to_str, open_utf8, escape_string
def make_certs_header(target, source, env):
@@ -162,7 +162,7 @@ def make_authors_header(target, source, env):
for line in f:
if reading:
if line.startswith(" "):
- g.write("\t\"" + line.strip() + "\",\n")
+ g.write("\t\"" + escape_string(line.strip()) + "\",\n")
continue
if line.startswith("## "):
if reading:
@@ -170,7 +170,7 @@ def make_authors_header(target, source, env):
reading = False
for i in range(len(sections)):
if line.strip().endswith(sections[i]):
- current_section = sections_id[i]
+ current_section = escape_string(sections_id[i])
reading = True
g.write("static const char *" + current_section + "[] = {\n")
break
@@ -204,7 +204,7 @@ def make_donors_header(target, source, env):
for line in f:
if reading >= 0:
if line.startswith(" "):
- g.write("\t\"" + line.strip() + "\",\n")
+ g.write("\t\"" + escape_string(line.strip()) + "\",\n")
continue
if line.startswith("## "):
if reading:
@@ -212,7 +212,7 @@ def make_donors_header(target, source, env):
reading = False
for i in range(len(sections)):
if line.strip().endswith(sections[i]):
- current_section = sections_id[i]
+ current_section = escape_string(sections_id[i])
reading = True
g.write("static const char *" + current_section + "[] = {\n")
break
@@ -237,7 +237,8 @@ def make_license_header(target, source, env):
g.write("static const char *about_license =")
for line in f:
- g.write("\n\t\"" + line.strip().replace("\"", "\\\"") + "\\n\"")
+ escaped_string = escape_string(line.strip())
+ g.write("\n\t\"" + escaped_string + "\\n\"")
g.write(";\n")
@@ -322,11 +323,13 @@ def make_license_header(target, source, env):
for k in j[0].split("\n"):
if file_body != "":
file_body += "\\n\"\n"
- file_body += "\t\"" + k.strip().replace("\"", "\\\"")
+ escaped_string = escape_string(k.strip())
+ file_body += "\t\"" + escaped_string
for k in j[1].split("\n"):
if copyright_body != "":
copyright_body += "\\n\"\n"
- copyright_body += "\t\"" + k.strip().replace("\"", "\\\"")
+ escaped_string = escape_string(k.strip())
+ copyright_body += "\t\"" + escaped_string
about_tp_file += "\t" + file_body + "\",\n"
about_tp_copyright += "\t" + copyright_body + "\",\n"
@@ -340,7 +343,8 @@ def make_license_header(target, source, env):
for j in i[1].split("\n"):
if body != "":
body += "\\n\"\n"
- body += "\t\"" + j.strip().replace("\"", "\\\"")
+ escaped_string = escape_string(j.strip())
+ body += "\t\"" + escaped_string
about_license_name += "\t\"" + i[0] + "\",\n"
about_license_body += "\t" + body + "\",\n"
@@ -395,8 +399,8 @@ def _make_doc_data_class_path(to_path):
g.write("{NULL,NULL}\n")
g.write("};\n")
-if (env["tools"] == "yes"):
+if env['tools']:
# Register exporters
reg_exporters_inc = '#include "register_exporters.h"\n'
reg_exporters = 'void register_exporters() {\n'
diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp
index 2965003645..b832b993bb 100644
--- a/editor/animation_editor.cpp
+++ b/editor/animation_editor.cpp
@@ -3900,7 +3900,7 @@ AnimationKeyEditor::AnimationKeyEditor() {
//menu->get_popup()->connect("id_pressed",this,"_menu_callback");
hb = memnew(HBoxContainer);
- hb->set_area_as_parent_rect();
+ hb->set_anchors_and_margins_preset(Control::PRESET_WIDE);
ec->add_child(hb);
hb->set_v_size_flags(SIZE_EXPAND_FILL);
@@ -3912,14 +3912,14 @@ AnimationKeyEditor::AnimationKeyEditor() {
track_editor->set_h_size_flags(SIZE_EXPAND_FILL);
track_pos = memnew(Control);
- track_pos->set_area_as_parent_rect();
+ track_pos->set_anchors_and_margins_preset(Control::PRESET_WIDE);
track_pos->set_mouse_filter(MOUSE_FILTER_IGNORE);
track_editor->add_child(track_pos);
track_pos->connect("draw", this, "_track_position_draw");
select_anim_warning = memnew(Label);
track_editor->add_child(select_anim_warning);
- select_anim_warning->set_area_as_parent_rect();
+ select_anim_warning->set_anchors_and_margins_preset(Control::PRESET_WIDE);
select_anim_warning->set_text(TTR("Select an AnimationPlayer from the Scene Tree to edit animations."));
select_anim_warning->set_autowrap(true);
select_anim_warning->set_align(Label::ALIGN_CENTER);
@@ -3936,7 +3936,6 @@ AnimationKeyEditor::AnimationKeyEditor() {
key_editor_tab->set_custom_minimum_size(Size2(200, 0) * EDSCALE);
key_editor = memnew(PropertyEditor);
- key_editor->set_area_as_parent_rect();
key_editor->hide_top_label();
key_editor->set_name(TTR("Key"));
key_editor_tab->add_child(key_editor);
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 0e77d2097e..ee1faf5a55 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -86,7 +86,7 @@ void FindReplaceBar::_notification(int p_what) {
find_prev->set_icon(get_icon("MoveUp", "EditorIcons"));
find_next->set_icon(get_icon("MoveDown", "EditorIcons"));
hide_button->set_normal_texture(get_icon("Close", "EditorIcons"));
- hide_button->set_hover_texture(get_icon("CloseHover", "EditorIcons"));
+ hide_button->set_hover_texture(get_icon("Close", "EditorIcons"));
hide_button->set_pressed_texture(get_icon("Close", "EditorIcons"));
} else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
@@ -97,7 +97,7 @@ void FindReplaceBar::_notification(int p_what) {
find_prev->set_icon(get_icon("MoveUp", "EditorIcons"));
find_next->set_icon(get_icon("MoveDown", "EditorIcons"));
hide_button->set_normal_texture(get_icon("Close", "EditorIcons"));
- hide_button->set_hover_texture(get_icon("CloseHover", "EditorIcons"));
+ hide_button->set_hover_texture(get_icon("Close", "EditorIcons"));
hide_button->set_pressed_texture(get_icon("Close", "EditorIcons"));
}
}
@@ -1010,7 +1010,7 @@ void CodeTextEditor::_reset_zoom() {
Ref<DynamicFont> font = text_editor->get_font("font"); // reset source font size to default
if (font.is_valid()) {
- EditorSettings::get_singleton()->set("interface/source_font_size", 14);
+ EditorSettings::get_singleton()->set("interface/editor/source_font_size", 14);
font->set_size(14);
}
}
@@ -1025,8 +1025,9 @@ void CodeTextEditor::_text_changed() {
if (text_editor->is_insert_text_operation()) {
code_complete_timer->start();
- idle->start();
}
+
+ idle->start();
}
void CodeTextEditor::_code_complete_timer_timeout() {
@@ -1066,7 +1067,7 @@ void CodeTextEditor::_font_resize_timeout() {
if (font.is_valid()) {
int new_size = CLAMP(font->get_size() + font_resize_val, 8 * EDSCALE, 96 * EDSCALE);
if (new_size != font->get_size()) {
- EditorSettings::get_singleton()->set("interface/source_font_size", new_size / EDSCALE);
+ EditorSettings::get_singleton()->set("interface/editor/source_font_size", new_size / EDSCALE);
font->set_size(new_size);
}
@@ -1197,17 +1198,9 @@ CodeTextEditor::CodeTextEditor() {
text_editor->set_brace_matching(true);
text_editor->set_auto_indent(true);
- MarginContainer *status_mc = memnew(MarginContainer);
- add_child(status_mc);
- status_mc->set("custom_constants/margin_left", 2);
- status_mc->set("custom_constants/margin_top", 5);
- status_mc->set("custom_constants/margin_right", 2);
- status_mc->set("custom_constants/margin_bottom", 1);
-
HBoxContainer *status_bar = memnew(HBoxContainer);
- status_mc->add_child(status_bar);
+ add_child(status_bar);
status_bar->set_h_size_flags(SIZE_EXPAND_FILL);
- status_bar->add_child(memnew(Label)); //to keep the height if the other labels are not visible
idle = memnew(Timer);
add_child(idle);
@@ -1226,14 +1219,18 @@ CodeTextEditor::CodeTextEditor() {
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", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor"));
+ error->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts"));
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_child(memnew(Label)); //to keep the height if the other labels are not visible
+
Label *line_txt = memnew(Label);
status_bar->add_child(line_txt);
line_txt->set_align(Label::ALIGN_RIGHT);
line_txt->set_valign(Label::VALIGN_CENTER);
line_txt->set_v_size_flags(SIZE_FILL);
line_txt->set_text(TTR("Line:"));
+ line_txt->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts"));
line_nb = memnew(Label);
status_bar->add_child(line_nb);
@@ -1242,6 +1239,8 @@ CodeTextEditor::CodeTextEditor() {
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);
+ line_nb->set_align(Label::ALIGN_RIGHT);
+ line_nb->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts"));
Label *col_txt = memnew(Label);
status_bar->add_child(col_txt);
@@ -1249,6 +1248,7 @@ CodeTextEditor::CodeTextEditor() {
col_txt->set_valign(Label::VALIGN_CENTER);
col_txt->set_v_size_flags(SIZE_FILL);
col_txt->set_text(TTR("Col:"));
+ col_txt->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts"));
col_nb = memnew(Label);
status_bar->add_child(col_nb);
@@ -1257,6 +1257,9 @@ CodeTextEditor::CodeTextEditor() {
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);
+ col_nb->set_align(Label::ALIGN_RIGHT);
+ col_nb->set("custom_constants/margin_right", 0);
+ col_nb->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts"));
text_editor->connect("gui_input", this, "_text_editor_gui_input");
text_editor->connect("cursor_changed", this, "_line_col_changed");
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index bb5f5e9175..520bf480fd 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -83,7 +83,7 @@ void CreateDialog::popup_create(bool p_dontclear) {
_update_favorite_list();
// Restore valid window bounds or pop up at default size.
- if (EditorSettings::get_singleton()->has("interface/dialogs/create_new_node_bounds")) {
+ if (EditorSettings::get_singleton()->has_setting("interface/dialogs/create_new_node_bounds")) {
popup(EditorSettings::get_singleton()->get("interface/dialogs/create_new_node_bounds"));
} else {
popup_centered_ratio();
@@ -165,11 +165,14 @@ void CreateDialog::add_type(const String &p_type, HashMap<String, TreeItem *> &p
TreeItem *item = search_options->create_item(parent);
item->set_text(0, p_type);
if (!ClassDB::can_instance(p_type)) {
- item->set_custom_color(0, Color(0.5, 0.5, 0.5));
+ item->set_custom_color(0, get_color("disabled_font_color", "Editor"));
item->set_selectable(0, false);
} else {
+ bool is_search_subsequence = search_box->get_text().is_subsequence_ofi(p_type);
+ String to_select_type = *to_select ? (*to_select)->get_text(0) : "";
+ bool current_item_is_preffered = ClassDB::is_parent_class(p_type, preferred_search_result_type) && !ClassDB::is_parent_class(to_select_type, preferred_search_result_type);
- if ((!*to_select && (search_box->get_text().is_subsequence_ofi(p_type))) || search_box->get_text() == p_type) {
+ if (((!*to_select || current_item_is_preffered) && is_search_subsequence) || search_box->get_text() == p_type) {
*to_select = item;
}
}
@@ -361,6 +364,19 @@ void CreateDialog::set_base_type(const String &p_base) {
_update_search();
}
+String CreateDialog::get_base_type() const {
+
+ return base_type;
+}
+
+void CreateDialog::set_preferred_search_result_type(const String &p_preferred_type) {
+ preferred_search_result_type = p_preferred_type;
+}
+
+String CreateDialog::get_preferred_search_result_type() {
+
+ return preferred_search_result_type;
+}
String CreateDialog::get_selected_type() {
TreeItem *selected = search_options->get_selected();
@@ -411,11 +427,6 @@ Object *CreateDialog::instance_selected() {
return NULL;
}
-String CreateDialog::get_base_type() const {
-
- return base_type;
-}
-
void CreateDialog::_item_selected() {
TreeItem *item = search_options->get_selected();
@@ -654,6 +665,7 @@ CreateDialog::CreateDialog() {
search_options->connect("cell_selected", this, "_item_selected");
//search_options->set_hide_root(true);
base_type = "Object";
+ preferred_search_result_type = "";
help_bit = memnew(EditorHelpBit);
vbc->add_margin_child(TTR("Description:"), help_bit);
diff --git a/editor/create_dialog.h b/editor/create_dialog.h
index a523539ba0..2e4ce9b277 100644
--- a/editor/create_dialog.h
+++ b/editor/create_dialog.h
@@ -53,7 +53,7 @@ class CreateDialog : public ConfirmationDialog {
LineEdit *search_box;
Tree *search_options;
String base_type;
-
+ String preferred_search_result_type;
EditorHelpBit *help_bit;
void _item_selected();
@@ -93,6 +93,9 @@ public:
void set_base_type(const String &p_base);
String get_base_type() const;
+ void set_preferred_search_result_type(const String &p_preferred_type);
+ String get_preferred_search_result_type();
+
void popup_create(bool p_dontclear);
CreateDialog();
diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp
index 54bf31cd62..5305c4f256 100644
--- a/editor/dependency_editor.cpp
+++ b/editor/dependency_editor.cpp
@@ -409,17 +409,22 @@ void DependencyRemoveDialog::show(const Vector<String> &to_erase) {
void DependencyRemoveDialog::ok_pressed() {
- DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
+ bool changed = false;
+
for (Map<String, TreeItem *>::Element *E = files.front(); E; E = E->next()) {
if (ResourceCache::has(E->key())) {
Resource *res = ResourceCache::get(E->key());
res->set_path(""); //clear reference to path
}
- da->remove(E->key());
- EditorFileSystem::get_singleton()->update_file(E->key());
+ String fpath = OS::get_singleton()->get_resource_dir() + E->key().replace_first("res://", "/");
+ OS::get_singleton()->move_to_trash(fpath);
+ changed = true;
+ }
+
+ if (changed) {
+ EditorFileSystem::get_singleton()->scan_changes();
}
- memdelete(da);
}
DependencyRemoveDialog::DependencyRemoveDialog() {
diff --git a/editor/editor_asset_installer.cpp b/editor/editor_asset_installer.cpp
index a8eee24fe2..1aac697ffd 100644
--- a/editor/editor_asset_installer.cpp
+++ b/editor/editor_asset_installer.cpp
@@ -197,7 +197,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) {
String res_path = "res://" + path;
if (FileAccess::exists(res_path)) {
- ti->set_custom_color(0, Color(1, 0.3, 0.2));
+ ti->set_custom_color(0, get_color("error_color", "Editor"));
ti->set_tooltip(0, res_path + " (Already Exists)");
ti->set_checked(0, false);
} else {
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index b74bd3ab43..de64c11308 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -64,6 +64,8 @@ void EditorAudioBus::_notification(int p_what) {
if (has_focus()) {
draw_style_box(get_stylebox("focus", "Button"), Rect2(Vector2(), get_size()));
+ } else if (is_master) {
+ draw_style_box(get_stylebox("disabled", "Button"), Rect2(Vector2(), get_size()));
}
}
@@ -123,7 +125,7 @@ void EditorAudioBus::_notification(int p_what) {
void EditorAudioBus::update_send() {
send->clear();
- if (get_index() == 0) {
+ if (is_master) {
send->set_disabled(true);
send->set_text(TTR("Speakers"));
} else {
@@ -154,7 +156,7 @@ void EditorAudioBus::update_bus() {
slider->set_value(AudioServer::get_singleton()->get_bus_volume_db(index));
track_name->set_text(AudioServer::get_singleton()->get_bus_name(index));
- if (get_index() == 0)
+ if (is_master)
track_name->set_editable(false);
solo->set_pressed(AudioServer::get_singleton()->is_bus_solo(index));
@@ -237,6 +239,8 @@ void EditorAudioBus::_name_changed(const String &p_new_name) {
ur->commit_action();
updating_bus = false;
+
+ track_name->release_focus();
}
void EditorAudioBus::_volume_db_changed(float p_db) {
@@ -401,7 +405,6 @@ void EditorAudioBus::_gui_input(const Ref<InputEvent> &p_event) {
Vector2 pos = Vector2(mb->get_position().x, mb->get_position().y);
bus_popup->set_position(get_global_position() + pos);
- bus_popup->set_item_disabled(1, get_index() == 0);
bus_popup->popup();
}
}
@@ -619,10 +622,11 @@ void EditorAudioBus::_bind_methods() {
ADD_SIGNAL(MethodInfo("dropped"));
}
-EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses) {
+EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
buses = p_buses;
updating_bus = false;
+ is_master = p_is_master;
set_tooltip(TTR("Audio Bus, Drag and Drop to rearrange."));
@@ -630,24 +634,15 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses) {
add_child(vb);
set_v_size_flags(SIZE_EXPAND_FILL);
+ set_custom_minimum_size(Size2(100, 0) * EDSCALE);
- HBoxContainer *head = memnew(HBoxContainer);
track_name = memnew(LineEdit);
- head->add_child(track_name);
track_name->connect("text_entered", this, "_name_changed");
track_name->connect("focus_exited", this, "_name_focus_exit");
- track_name->set_h_size_flags(SIZE_EXPAND_FILL);
-
- bus_options = memnew(MenuButton);
- bus_options->set_h_size_flags(SIZE_SHRINK_END);
- bus_options->set_tooltip(TTR("Bus options"));
- head->add_child(bus_options);
-
- vb->add_child(head);
+ vb->add_child(track_name);
HBoxContainer *hbc = memnew(HBoxContainer);
vb->add_child(hbc);
- hbc->add_spacer();
solo = memnew(ToolButton);
solo->set_toggle_mode(true);
solo->set_tooltip(TTR("Solo"));
@@ -668,6 +663,23 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses) {
hbc->add_child(bypass);
hbc->add_spacer();
+ bus_options = memnew(MenuButton);
+ bus_options->set_h_size_flags(SIZE_SHRINK_END);
+ bus_options->set_anchor(MARGIN_RIGHT, 0.0);
+ bus_options->set_tooltip(TTR("Bus options"));
+ hbc->add_child(bus_options);
+
+ Ref<StyleBoxEmpty> sbempty = memnew(StyleBoxEmpty);
+ for (int i = 0; i < hbc->get_child_count(); i++) {
+ Control *child = Object::cast_to<Control>(hbc->get_child(i));
+ child->add_style_override("normal", sbempty);
+ child->add_style_override("hover", sbempty);
+ child->add_style_override("focus", sbempty);
+ child->add_style_override("pressed", sbempty);
+ }
+
+ vb->add_child(memnew(HSeparator));
+
HBoxContainer *hb = memnew(HBoxContainer);
vb->add_child(hb);
slider = memnew(VSlider);
@@ -699,8 +711,6 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses) {
scale = memnew(TextureRect);
hb->add_child(scale);
- //add_child(hb);
-
effects = memnew(Tree);
effects->set_hide_root(true);
effects->set_custom_minimum_size(Size2(0, 100) * EDSCALE);
@@ -745,6 +755,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses) {
bus_popup = bus_options->get_popup();
bus_popup->add_item(TTR("Duplicate"));
bus_popup->add_item(TTR("Delete"));
+ bus_popup->set_item_disabled(1, is_master);
bus_popup->add_item(TTR("Reset Volume"));
bus_popup->connect("index_pressed", this, "_bus_popup_pressed");
@@ -787,10 +798,8 @@ void EditorAudioBuses::_update_buses() {
for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) {
- EditorAudioBus *audio_bus = memnew(EditorAudioBus(this));
- if (i == 0) {
- audio_bus->set_self_modulate(Color(1, 0.9, 0.9));
- }
+ bool is_master = i == 0 ? true : false;
+ EditorAudioBus *audio_bus = memnew(EditorAudioBus(this, is_master));
bus_hb->add_child(audio_bus);
audio_bus->connect("delete_request", this, "_delete_bus", varray(audio_bus), CONNECT_DEFERRED);
audio_bus->connect("duplicate_request", this, "_duplicate_bus", varray(), CONNECT_DEFERRED);
diff --git a/editor/editor_audio_buses.h b/editor/editor_audio_buses.h
index dba1b73295..995def468c 100644
--- a/editor/editor_audio_buses.h
+++ b/editor/editor_audio_buses.h
@@ -84,6 +84,8 @@ class EditorAudioBus : public PanelContainer {
bool updating_bus;
+ bool is_master;
+
void _gui_input(const Ref<InputEvent> &p_event);
void _bus_popup_pressed(int p_option);
@@ -120,7 +122,7 @@ public:
void update_bus();
void update_send();
- EditorAudioBus(EditorAudioBuses *p_buses = NULL);
+ EditorAudioBus(EditorAudioBuses *p_buses = NULL, bool p_is_master = false);
};
class EditorAudioBusDrop : public Panel {
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp
index ee537f4228..ae7ed7ce61 100644
--- a/editor/editor_autoload_settings.cpp
+++ b/editor/editor_autoload_settings.cpp
@@ -117,7 +117,7 @@ void EditorAutoloadSettings::_autoload_add() {
undo_redo->create_action(TTR("Add AutoLoad"));
undo_redo->add_do_property(ProjectSettings::get_singleton(), name, "*" + path);
- if (ProjectSettings::get_singleton()->has(name)) {
+ if (ProjectSettings::get_singleton()->has_setting(name)) {
undo_redo->add_undo_property(ProjectSettings::get_singleton(), name, ProjectSettings::get_singleton()->get(name));
} else {
undo_redo->add_undo_property(ProjectSettings::get_singleton(), name, Variant());
@@ -169,7 +169,7 @@ void EditorAutoloadSettings::_autoload_edited() {
return;
}
- if (ProjectSettings::get_singleton()->has("autoload/" + name)) {
+ if (ProjectSettings::get_singleton()->has_setting("autoload/" + name)) {
ti->set_text(0, old_name);
EditorNode::get_singleton()->show_warning(vformat(TTR("Autoload '%s' already exists!"), name));
return;
@@ -364,7 +364,7 @@ void EditorAutoloadSettings::update_autoload() {
item->add_button(3, get_icon("MoveUp", "EditorIcons"), BUTTON_MOVE_UP);
item->add_button(3, get_icon("MoveDown", "EditorIcons"), BUTTON_MOVE_DOWN);
- item->add_button(3, get_icon("Del", "EditorIcons"), BUTTON_DELETE);
+ item->add_button(3, get_icon("Remove", "EditorIcons"), BUTTON_DELETE);
item->set_selectable(3, false);
}
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index 4caf2641fc..bc20a99809 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -273,6 +273,8 @@ void EditorExportPlatform::gen_debug_flags(Vector<String> &r_flags, int p_flags)
}
Error EditorExportPlatform::_save_pack_file(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total) {
+ if (p_path.ends_with(".so") || p_path.ends_with(".dylib") || p_path.ends_with(".dll"))
+ return OK;
PackData *pd = (PackData *)p_userdata;
@@ -1139,6 +1141,12 @@ void EditorExportPlatformPC::get_preset_features(const Ref<EditorExportPreset> &
if (p_preset->get("texture_format/etc2")) {
r_features->push_back("etc2");
}
+
+ if (p_preset->get("binary_format/64_bits")) {
+ r_features->push_back("64");
+ } else {
+ r_features->push_back("32");
+ }
}
void EditorExportPlatformPC::get_export_options(List<ExportOption> *r_options) {
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index 8d13153128..b980c4f0ec 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -56,15 +56,15 @@ void EditorFileDialog::_notification(int p_what) {
//_update_icons
mode_thumbnails->set_icon(get_icon("FileThumbnail", "EditorIcons"));
mode_list->set_icon(get_icon("FileList", "EditorIcons"));
- dir_prev->set_icon(get_icon("ArrowLeft", "EditorIcons"));
- dir_next->set_icon(get_icon("ArrowRight", "EditorIcons"));
+ dir_prev->set_icon(get_icon("Back", "EditorIcons"));
+ dir_next->set_icon(get_icon("Forward", "EditorIcons"));
dir_up->set_icon(get_icon("ArrowUp", "EditorIcons"));
refresh->set_icon(get_icon("Reload", "EditorIcons"));
favorite->set_icon(get_icon("Favorites", "EditorIcons"));
fav_up->set_icon(get_icon("MoveUp", "EditorIcons"));
fav_down->set_icon(get_icon("MoveDown", "EditorIcons"));
- fav_rm->set_icon(get_icon("RemoveSmall", "EditorIcons"));
+ fav_rm->set_icon(get_icon("Remove", "EditorIcons"));
} else if (p_what == NOTIFICATION_PROCESS) {
@@ -97,15 +97,15 @@ void EditorFileDialog::_notification(int p_what) {
//_update_icons
mode_thumbnails->set_icon(get_icon("FileThumbnail", "EditorIcons"));
mode_list->set_icon(get_icon("FileList", "EditorIcons"));
- dir_prev->set_icon(get_icon("ArrowLeft", "EditorIcons"));
- dir_next->set_icon(get_icon("ArrowRight", "EditorIcons"));
+ dir_prev->set_icon(get_icon("Back", "EditorIcons"));
+ dir_next->set_icon(get_icon("Forward", "EditorIcons"));
dir_up->set_icon(get_icon("ArrowUp", "EditorIcons"));
refresh->set_icon(get_icon("Reload", "EditorIcons"));
favorite->set_icon(get_icon("Favorites", "EditorIcons"));
fav_up->set_icon(get_icon("MoveUp", "EditorIcons"));
fav_down->set_icon(get_icon("MoveDown", "EditorIcons"));
- fav_rm->set_icon(get_icon("RemoveSmall", "EditorIcons"));
+ fav_rm->set_icon(get_icon("Remove", "EditorIcons"));
update_file_list();
}
@@ -1281,6 +1281,7 @@ EditorFileDialog::EditorFileDialog() {
dir_prev = memnew(ToolButton);
dir_next = memnew(ToolButton);
dir_up = memnew(ToolButton);
+ dir_up->set_tooltip(TTR("Go to parent folder"));
pathhb->add_child(dir_prev);
pathhb->add_child(dir_next);
@@ -1290,6 +1291,8 @@ EditorFileDialog::EditorFileDialog() {
dir_next->connect("pressed", this, "_go_forward");
dir_up->connect("pressed", this, "_go_up");
+ pathhb->add_child(memnew(Label(TTR("Path:"))));
+
dir = memnew(LineEdit);
pathhb->add_child(dir);
dir->set_h_size_flags(SIZE_EXPAND_FILL);
@@ -1330,9 +1333,9 @@ EditorFileDialog::EditorFileDialog() {
makedir->connect("pressed", this, "_make_dir");
pathhb->add_child(makedir);
- list_hb = memnew(HBoxContainer);
+ list_hb = memnew(HSplitContainer);
- vbc->add_margin_child(TTR("Path:"), pathhb);
+ vbc->add_child(pathhb);
vbc->add_child(list_hb);
list_hb->set_v_size_flags(SIZE_EXPAND_FILL);
diff --git a/editor/editor_file_dialog.h b/editor/editor_file_dialog.h
index 3b22189014..4dc2947292 100644
--- a/editor/editor_file_dialog.h
+++ b/editor/editor_file_dialog.h
@@ -36,6 +36,7 @@
#include "scene/gui/item_list.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/option_button.h"
+#include "scene/gui/split_container.h"
#include "scene/gui/texture_rect.h"
#include "scene/gui/tool_button.h"
/**
@@ -92,7 +93,7 @@ private:
ItemList *item_list;
TextureRect *preview;
VBoxContainer *preview_vb;
- HBoxContainer *list_hb;
+ HSplitContainer *list_hb;
LineEdit *file;
AcceptDialog *mkdirerr;
AcceptDialog *exterr;
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index 481f2a8179..4ae786391b 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -1383,7 +1383,7 @@ void EditorFileSystem::_reimport_file(const String &p_file) {
}
}
- if (load_default && ProjectSettings::get_singleton()->has("importer_defaults/" + importer->get_importer_name())) {
+ if (load_default && ProjectSettings::get_singleton()->has_setting("importer_defaults/" + importer->get_importer_name())) {
//use defaults if exist
Dictionary d = ProjectSettings::get_singleton()->get("importer_defaults/" + importer->get_importer_name());
List<Variant> v;
diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp
index 6e5726a16d..05f9da03e1 100644
--- a/editor/editor_fonts.cpp
+++ b/editor/editor_fonts.cpp
@@ -122,7 +122,7 @@ void editor_register_fonts(Ref<Theme> p_theme) {
dfmono->set_font_ptr(_font_Hack_Regular, _font_Hack_Regular_size);
//dfd->set_force_autohinter(true); //just looks better..i think?
- MAKE_DEFAULT_FONT(df, int(EditorSettings::get_singleton()->get("interface/font_size")) * EDSCALE);
+ MAKE_DEFAULT_FONT(df, int(EditorSettings::get_singleton()->get("interface/editor/font_size")) * EDSCALE);
p_theme->set_default_theme_font(df);
@@ -142,7 +142,7 @@ void editor_register_fonts(Ref<Theme> p_theme) {
Ref<DynamicFont> df_code;
df_code.instance();
- df_code->set_size(int(EditorSettings::get_singleton()->get("interface/source_font_size")) * EDSCALE);
+ df_code->set_size(int(EditorSettings::get_singleton()->get("interface/editor/source_font_size")) * EDSCALE);
df_code->set_font_data(dfmono);
MAKE_FALLBACKS(df_code);
@@ -158,6 +158,25 @@ void editor_register_fonts(Ref<Theme> p_theme) {
p_theme->set_font("doc_source", "EditorFonts", df_doc_code);
+ Ref<DynamicFont> df_output_code;
+ df_output_code.instance();
+ df_output_code->set_size(int(EDITOR_DEF("run/output/font_size", 13)) * EDSCALE);
+ df_output_code->set_spacing(DynamicFont::SPACING_TOP, -EDSCALE);
+ df_output_code->set_spacing(DynamicFont::SPACING_BOTTOM, -EDSCALE);
+ df_output_code->set_font_data(dfmono);
+ MAKE_FALLBACKS(df_output_code);
+
+ p_theme->set_font("output_source", "EditorFonts", df_output_code);
+
+ Ref<DynamicFont> df_text_editor_status_code;
+ df_output_code.instance();
+ df_output_code->set_size(14 * EDSCALE);
+ df_output_code->set_spacing(DynamicFont::SPACING_TOP, -EDSCALE);
+ df_output_code->set_spacing(DynamicFont::SPACING_BOTTOM, -EDSCALE);
+ df_output_code->set_font_data(dfmono);
+ MAKE_FALLBACKS(df_output_code);
+ p_theme->set_font("status_source", "EditorFonts", df_output_code);
+
//replace default theme
Ref<Texture> di;
Ref<StyleBox> ds;
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 6c8bd0f14b..cb94ea72d1 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -650,8 +650,8 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
// Colors
const Color title_color = get_color("accent_color", "Editor");
- const Color text_color = get_color("font_color", "RichTextLabel");
- const Color highlight_color = get_color("highlight_color", "RichTextLabel");
+ const Color text_color = get_color("default_color", "RichTextLabel");
+ const Color headline_color = get_color("headline_color", "EditorHelp");
const Color base_type_color = title_color.linear_interpolate(text_color, 0.5);
const Color comment_color = Color(text_color.r, text_color.g, text_color.b, 0.6);
const Color symbol_color = comment_color;
@@ -669,7 +669,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->push_font(doc_title_font);
class_desc->push_color(title_color);
class_desc->add_text(TTR("Class:") + " ");
- class_desc->push_color(highlight_color);
+ class_desc->push_color(headline_color);
_add_text(p_class);
class_desc->pop();
class_desc->pop();
@@ -812,7 +812,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
}
class_desc->push_font(doc_code_font);
- class_desc->push_color(highlight_color);
+ class_desc->push_color(headline_color);
_add_text(cd.properties[i].name);
if (describe) {
@@ -883,7 +883,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
method_descr = true;
class_desc->push_meta("@" + methods[i].name);
}
- class_desc->push_color(highlight_color);
+ class_desc->push_color(headline_color);
_add_text(methods[i].name);
class_desc->pop();
if (methods[i].description != "")
@@ -969,7 +969,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->push_cell();
class_desc->push_font(doc_code_font);
- class_desc->push_color(highlight_color);
+ class_desc->push_color(headline_color);
_add_text(cd.theme_properties[i].name);
class_desc->pop();
class_desc->pop();
@@ -1015,7 +1015,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->push_font(doc_code_font); // monofont
//_add_type("void");
//class_desc->add_text(" ");
- class_desc->push_color(highlight_color);
+ class_desc->push_color(headline_color);
_add_text(cd.signals[i].name);
class_desc->pop();
class_desc->push_color(symbol_color);
@@ -1102,7 +1102,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
e = e.get_slice(".", 1);
}
- class_desc->push_color(highlight_color);
+ class_desc->push_color(headline_color);
class_desc->add_text(e);
class_desc->pop();
class_desc->pop();
@@ -1117,7 +1117,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
for (int i = 0; i < enum_list.size(); i++) {
class_desc->push_font(doc_code_font);
- class_desc->push_color(highlight_color);
+ class_desc->push_color(headline_color);
_add_text(enum_list[i].name);
class_desc->pop();
class_desc->push_color(symbol_color);
@@ -1165,7 +1165,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
constant_line[constants[i].name] = class_desc->get_line_count() - 2;
class_desc->push_font(doc_code_font);
- class_desc->push_color(highlight_color);
+ class_desc->push_color(headline_color);
_add_text(constants[i].name);
class_desc->pop();
class_desc->push_color(symbol_color);
@@ -1235,7 +1235,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
_add_type(cd.properties[i].type, cd.properties[i].enumeration);
class_desc->add_text(" ");
- class_desc->push_color(highlight_color);
+ class_desc->push_color(headline_color);
_add_text(cd.properties[i].name);
class_desc->pop(); //color
@@ -1324,7 +1324,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
_add_type(methods[i].return_type, methods[i].return_enum);
class_desc->add_text(" ");
- class_desc->push_color(highlight_color);
+ class_desc->push_color(headline_color);
_add_text(methods[i].name);
class_desc->pop();
class_desc->push_color(symbol_color);
@@ -1456,7 +1456,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
Ref<Font> doc_font = p_rt->get_font("doc", "EditorFonts");
Ref<Font> doc_code_font = p_rt->get_font("doc_source", "EditorFonts");
- Color font_color_hl = p_rt->get_color("highlight_color", "RichTextLabel");
+ Color font_color_hl = p_rt->get_color("headline_color", "EditorHelp");
Color link_color = p_rt->get_color("accent_color", "Editor").linear_interpolate(font_color_hl, 0.8);
String bbcode = p_bbcode.replace("\t", " ").replace("\r", " ").strip_edges();
@@ -1695,9 +1695,6 @@ void EditorHelp::_notification(int p_what) {
//back->set_icon(get_icon("Back","EditorIcons"));
_update_doc();
- class_desc->add_style_override("normal", class_desc->get_stylebox("code_normal", "RichTextLabel"));
- class_desc->add_style_override("focus", class_desc->get_stylebox("code_focus", "RichTextLabel"));
-
} break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
@@ -1790,7 +1787,6 @@ EditorHelp::EditorHelp() {
{
class_desc = memnew(RichTextLabel);
vbc->add_child(class_desc);
- class_desc->set_area_as_parent_rect();
class_desc->set_v_size_flags(SIZE_EXPAND_FILL);
class_desc->add_color_override("selection_color", EDITOR_DEF("text_editor/highlighting/selection_color", Color(0.2, 0.2, 1)));
class_desc->connect("meta_clicked", this, "_class_desc_select");
@@ -1900,7 +1896,7 @@ EditorHelpBit::EditorHelpBit() {
rich_text = memnew(RichTextLabel);
add_child(rich_text);
- rich_text->set_area_as_parent_rect();
+ rich_text->set_anchors_and_margins_preset(Control::PRESET_WIDE);
rich_text->connect("meta_clicked", this, "_meta_clicked");
rich_text->add_color_override("selection_color", EDITOR_DEF("text_editor/highlighting/selection_color", Color(0.2, 0.2, 1)));
set_custom_minimum_size(Size2(0, 70 * EDSCALE));
diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp
index 481f2aaecf..407420d3d0 100644
--- a/editor/editor_log.cpp
+++ b/editor/editor_log.cpp
@@ -31,6 +31,7 @@
#include "editor_node.h"
#include "scene/gui/center_container.h"
+#include "scene/resources/dynamic_font.h"
#include "version.h"
void EditorLog::_error_handler(void *p_self, const char *p_func, const char *p_file, int p_line, const char *p_error, const char *p_errorexp, ErrorHandlerType p_type) {
@@ -51,7 +52,6 @@ void EditorLog::_error_handler(void *p_self, const char *p_func, const char *p_f
self->emit_signal("show_request");
*/
- err_str = " " + err_str;
self->add_message(err_str, true);
}
@@ -60,6 +60,13 @@ void EditorLog::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
//button->set_icon(get_icon("Console","EditorIcons"));
+ log->add_font_override("normal_font", get_font("output_source", "EditorFonts"));
+ } else if (p_what == NOTIFICATION_THEME_CHANGED) {
+ Ref<DynamicFont> df_output_code = get_font("output_source", "EditorFonts");
+ if (df_output_code.is_valid()) {
+ df_output_code->set_size(int(EDITOR_DEF("run/output/font_size", 13)) * EDSCALE);
+ log->add_font_override("normal_font", get_font("output_source", "EditorFonts"));
+ }
}
/*if (p_what==NOTIFICATION_DRAW) {
@@ -85,15 +92,13 @@ void EditorLog::clear() {
void EditorLog::add_message(const String &p_msg, bool p_error) {
- Ref<Font> doc_code_font = get_font("doc_source", "EditorFonts");
- log->push_font(doc_code_font);
-
log->add_newline();
if (p_error) {
log->push_color(get_color("error_color", "Editor"));
Ref<Texture> icon = get_icon("Error", "EditorIcons");
log->add_image(icon);
+ log->add_text(" ");
//button->set_icon(icon);
} else {
//button->set_icon(Ref<Texture>());
@@ -104,8 +109,6 @@ void EditorLog::add_message(const String &p_msg, bool p_error) {
if (p_error)
log->pop();
-
- log->pop(); // pop font;
}
/*
@@ -158,7 +161,6 @@ EditorLog::EditorLog() {
log->set_selection_enabled(true);
log->set_focus_mode(FOCUS_CLICK);
log->set_custom_minimum_size(Size2(0, 180) * EDSCALE);
- log->set_area_as_parent_rect();
log->set_v_size_flags(SIZE_EXPAND_FILL);
log->set_h_size_flags(SIZE_EXPAND_FILL);
vb->add_child(log);
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 54c6ff79ea..1ca88133b8 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -114,7 +114,7 @@ EditorNode *EditorNode::singleton = NULL;
void EditorNode::_update_scene_tabs() {
- bool show_rb = EditorSettings::get_singleton()->get("interface/show_script_in_scene_tabs");
+ bool show_rb = EditorSettings::get_singleton()->get("interface/editor/show_script_in_scene_tabs");
scene_tabs->clear_tabs();
Ref<Texture> script_icon = gui_base->get_icon("Script", "EditorIcons");
@@ -282,8 +282,8 @@ void EditorNode::_notification(int p_what) {
}
if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
- scene_tabs->set_tab_close_display_policy((bool(EDITOR_DEF("interface/always_show_close_button_in_scene_tabs", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY));
- property_editor->set_enable_capitalize_paths(bool(EDITOR_DEF("interface/capitalize_properties", true)));
+ scene_tabs->set_tab_close_display_policy((bool(EDITOR_DEF("interface/editor/always_show_close_button_in_scene_tabs", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY));
+ property_editor->set_enable_capitalize_paths(bool(EDITOR_DEF("interface/editor/capitalize_properties", true)));
Ref<Theme> theme = create_editor_theme(theme_base->get_theme());
theme_base->set_theme(theme);
@@ -308,6 +308,10 @@ void EditorNode::_notification(int p_what) {
}
_update_scene_tabs();
+ // debugger area
+ if (ScriptEditor::get_singleton()->get_debugger()->is_visible())
+ bottom_panel->add_style_override("panel", gui_base->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles"));
+
//_update_icons
for (int i = 0; i < singleton->main_editor_buttons.size(); i++) {
main_editor_buttons[i]->set_icon(gui_base->get_icon(singleton->main_editor_buttons[i]->get_name(), "EditorIcons"));
@@ -369,6 +373,9 @@ void EditorNode::_fs_changed() {
String err = "Preset \"" + export_defer.preset + "\" doesn't have a platform.";
ERR_PRINT(err.utf8().get_data());
} else {
+ // ensures export_project does not loop infinitely, because notifications may
+ // come during the export
+ export_defer.preset = "";
platform->export_project(preset, export_defer.debug, export_defer.path, /*p_flags*/ 0);
}
}
@@ -2240,10 +2247,10 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
case RUN_PROJECT_MANAGER: {
if (!p_confirmed) {
- bool save_each = EDITOR_DEF("interface/save_each_scene_on_quit", true);
+ bool save_each = EDITOR_DEF("interface/editor/save_each_scene_on_quit", true);
if (_next_unsaved_scene(!save_each) == -1) {
- bool confirm = EDITOR_DEF("interface/quit_confirmation", true);
+ bool confirm = EDITOR_DEF("interface/editor/quit_confirmation", true);
if (confirm) {
confirmation->get_ok()->set_text(p_option == FILE_QUIT ? TTR("Quit") : TTR("Yes"));
@@ -2568,7 +2575,7 @@ void EditorNode::_editor_select(int p_which) {
editor_data.get_editor_plugin(i)->notify_main_screen_changed(editor_plugin_screen->get_name());
}
- if (EditorSettings::get_singleton()->get("interface/separate_distraction_mode")) {
+ if (EditorSettings::get_singleton()->get("interface/editor/separate_distraction_mode")) {
if (p_which == EDITOR_SCRIPT) {
set_distraction_free_mode(script_distraction);
} else {
@@ -3247,6 +3254,7 @@ void EditorNode::register_editor_types() {
ClassDB::register_virtual_class<ScriptEditor>();
ClassDB::register_virtual_class<EditorInterface>();
ClassDB::register_class<EditorExportPlugin>();
+ ClassDB::register_class<EditorResourceConversionPlugin>();
// FIXME: Is this stuff obsolete, or should it be ported to new APIs?
//ClassDB::register_class<EditorScenePostImport>();
@@ -3467,7 +3475,7 @@ void EditorNode::_dock_select_draw() {
Color used = Color(0.6, 0.6, 0.6, 0.8);
Color used_selected = Color(0.8, 0.8, 0.8, 0.8);
- Color tab_selected = Color(1, 1, 1, 1);
+ Color tab_selected = theme_base->get_color("mono_color", "Editor");
Color unused = used;
unused.a = 0.4;
Color unusable = unused;
@@ -4061,29 +4069,25 @@ void EditorNode::_bottom_panel_switch(bool p_enable, int p_idx) {
ERR_FAIL_INDEX(p_idx, bottom_panel_items.size());
if (p_enable) {
- // this is the debug panel wich uses tabs, so the top section should be smaller
- if (ScriptEditor::get_singleton()->get_debugger() == bottom_panel_items[p_idx].control) {
- Ref<StyleBoxFlat> style_panel_invisible_top = gui_base->get_stylebox("debugger_panel", "EditorStyles");
- bottom_panel->add_style_override("panel", style_panel_invisible_top);
- } else {
- bottom_panel->add_style_override("panel", gui_base->get_stylebox("panel", "TabContainer"));
- }
for (int i = 0; i < bottom_panel_items.size(); i++) {
bottom_panel_items[i].button->set_pressed(i == p_idx);
bottom_panel_items[i].control->set_visible(i == p_idx);
}
+ if (ScriptEditor::get_singleton()->get_debugger() == bottom_panel_items[p_idx].control) { // this is the debug panel wich uses tabs, so the top section should be smaller
+ bottom_panel->add_style_override("panel", gui_base->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles"));
+ } else {
+ bottom_panel->add_style_override("panel", gui_base->get_stylebox("panel", "TabContainer"));
+ }
center_split->set_dragger_visibility(SplitContainer::DRAGGER_VISIBLE);
center_split->set_collapsed(false);
} else {
bottom_panel->add_style_override("panel", gui_base->get_stylebox("panel", "TabContainer"));
-
for (int i = 0; i < bottom_panel_items.size(); i++) {
bottom_panel_items[i].button->set_pressed(false);
bottom_panel_items[i].control->set_visible(false);
}
-
center_split->set_dragger_visibility(SplitContainer::DRAGGER_HIDDEN);
center_split->set_collapsed(true);
}
@@ -4100,7 +4104,7 @@ bool EditorNode::get_docks_visible() const {
void EditorNode::_toggle_distraction_free_mode() {
- if (EditorSettings::get_singleton()->get("interface/separate_distraction_mode")) {
+ if (EditorSettings::get_singleton()->get("interface/editor/separate_distraction_mode")) {
int screen = -1;
for (int i = 0; i < editor_table.size(); i++) {
if (editor_plugin_screen == editor_table[i]) {
@@ -4384,7 +4388,7 @@ void EditorNode::_open_imported() {
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");
+ bool dim_ui = EditorSettings::get_singleton()->get("interface/editor/dim_editor_on_dialog_popup");
if (p_dimming) {
if (dim_ui) {
if (dim_count == 0) {
@@ -4411,9 +4415,9 @@ void EditorNode::_start_dimming(bool p_dimming) {
void EditorNode::_dim_timeout() {
_dim_time += _dim_timer->get_wait_time();
- float wait_time = EditorSettings::get_singleton()->get("interface/dim_transition_time");
+ float wait_time = EditorSettings::get_singleton()->get("interface/editor/dim_transition_time");
- float c = 1.0f - (float)EditorSettings::get_singleton()->get("interface/dim_amount");
+ float c = 1.0f - (float)EditorSettings::get_singleton()->get("interface/editor/dim_amount");
Color base = _dimming ? Color(1, 1, 1) : Color(c, c, c);
Color final = _dimming ? Color(c, c, c) : Color(1, 1, 1);
@@ -4431,6 +4435,27 @@ void EditorNode::open_export_template_manager() {
export_template_manager->popup_manager();
}
+void EditorNode::add_resource_conversion_plugin(const Ref<EditorResourceConversionPlugin> &p_plugin) {
+ resource_conversion_plugins.push_back(p_plugin);
+}
+
+void EditorNode::remove_resource_conversion_plugin(const Ref<EditorResourceConversionPlugin> &p_plugin) {
+ resource_conversion_plugins.erase(p_plugin);
+}
+
+Vector<Ref<EditorResourceConversionPlugin> > EditorNode::find_resource_conversion_plugin(const Ref<Resource> &p_for_resource) {
+
+ Vector<Ref<EditorResourceConversionPlugin> > ret;
+
+ for (int i = 0; i < resource_conversion_plugins.size(); i++) {
+ if (resource_conversion_plugins[i].is_valid() && resource_conversion_plugins[i]->handles(p_for_resource)) {
+ ret.push_back(resource_conversion_plugins[i]);
+ }
+ }
+
+ return ret;
+}
+
void EditorNode::_bind_methods() {
ClassDB::bind_method("_menu_option", &EditorNode::_menu_option);
@@ -4564,9 +4589,10 @@ EditorNode::EditorNode() {
EditorSettings::create();
{
- int dpi_mode = EditorSettings::get_singleton()->get("interface/hidpi_mode");
+ int dpi_mode = EditorSettings::get_singleton()->get("interface/editor/hidpi_mode");
if (dpi_mode == 0) {
- editor_set_scale(OS::get_singleton()->get_screen_dpi(0) >= 192 && OS::get_singleton()->get_screen_size(OS::get_singleton()->get_current_screen()).x > 2000 ? 2.0 : 1.0);
+ const int screen = OS::get_singleton()->get_current_screen();
+ editor_set_scale(OS::get_singleton()->get_screen_dpi(screen) >= 192 && OS::get_singleton()->get_screen_size(screen).x > 2000 ? 2.0 : 1.0);
} else if (dpi_mode == 1) {
editor_set_scale(0.75);
} else if (dpi_mode == 2) {
@@ -4601,6 +4627,10 @@ EditorNode::EditorNode() {
import_wav.instance();
ResourceFormatImporter::get_singleton()->add_importer(import_wav);
+ Ref<ResourceImporterOBJ> import_obj;
+ import_obj.instance();
+ ResourceFormatImporter::get_singleton()->add_importer(import_obj);
+
Ref<ResourceImporterScene> import_scene;
import_scene.instance();
ResourceFormatImporter::get_singleton()->add_importer(import_scene);
@@ -4649,11 +4679,11 @@ EditorNode::EditorNode() {
theme_base = memnew(Control);
add_child(theme_base);
- theme_base->set_area_as_parent_rect();
+ theme_base->set_anchors_and_margins_preset(Control::PRESET_WIDE);
gui_base = memnew(Panel);
theme_base->add_child(gui_base);
- gui_base->set_area_as_parent_rect();
+ gui_base->set_anchors_and_margins_preset(Control::PRESET_WIDE);
Ref<Theme> theme = create_editor_theme();
theme_base->set_theme(theme);
@@ -4672,7 +4702,7 @@ EditorNode::EditorNode() {
main_vbox = memnew(VBoxContainer);
gui_base->add_child(main_vbox);
- main_vbox->set_area_as_parent_rect(8);
+ main_vbox->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 8);
main_vbox->set_margin(MARGIN_TOP, 5 * EDSCALE);
menu_hb = memnew(HBoxContainer);
@@ -4815,7 +4845,7 @@ EditorNode::EditorNode() {
scene_tabs->add_style_override("tab_bg", gui_base->get_stylebox("SceneTabBG", "EditorStyles"));
scene_tabs->add_tab("unsaved");
scene_tabs->set_tab_align(Tabs::ALIGN_LEFT);
- scene_tabs->set_tab_close_display_policy((bool(EDITOR_DEF("interface/always_show_close_button_in_scene_tabs", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY));
+ scene_tabs->set_tab_close_display_policy((bool(EDITOR_DEF("interface/editor/always_show_close_button_in_scene_tabs", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY));
scene_tabs->set_min_width(int(EDITOR_DEF("interface/scene_tabs/minimum_width", 50)) * EDSCALE);
scene_tabs->connect("tab_changed", this, "_scene_tab_changed");
scene_tabs->connect("right_button_pressed", this, "_scene_tab_script_edited");
@@ -5061,9 +5091,6 @@ EditorNode::EditorNode() {
play_cc = memnew(CenterContainer);
play_cc->set_mouse_filter(Control::MOUSE_FILTER_IGNORE);
menu_hb->add_child(play_cc);
- play_cc->set_area_as_parent_rect();
- play_cc->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_BEGIN, 10);
- play_cc->set_margin(MARGIN_TOP, 5);
play_button_panel = memnew(PanelContainer);
// play_button_panel->add_style_override("panel", gui_base->get_stylebox("PlayButtonPanel", "EditorStyles"));
@@ -5272,7 +5299,7 @@ EditorNode::EditorNode() {
property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
property_editor->set_use_doc_hints(true);
property_editor->set_hide_script(false);
- property_editor->set_enable_capitalize_paths(bool(EDITOR_DEF("interface/capitalize_properties", true)));
+ property_editor->set_enable_capitalize_paths(bool(EDITOR_DEF("interface/editor/capitalize_properties", true)));
property_editor->hide_top_label();
property_editor->register_text_enter(search_box);
@@ -5497,6 +5524,11 @@ EditorNode::EditorNode() {
resource_preview->add_preview_generator(Ref<EditorMeshPreviewPlugin>(memnew(EditorMeshPreviewPlugin)));
resource_preview->add_preview_generator(Ref<EditorBitmapPreviewPlugin>(memnew(EditorBitmapPreviewPlugin)));
+ {
+ Ref<SpatialMaterialConversionPlugin> spatial_mat_convert;
+ spatial_mat_convert.instance();
+ resource_conversion_plugins.push_back(spatial_mat_convert);
+ }
circle_step_msec = OS::get_singleton()->get_ticks_msec();
circle_step_frame = Engine::get_singleton()->get_frames_drawn();
circle_step = 0;
@@ -5585,7 +5617,7 @@ EditorNode::EditorNode() {
{
_initializing_addons = true;
Vector<String> addons;
- if (ProjectSettings::get_singleton()->has("editor_plugins/enabled")) {
+ if (ProjectSettings::get_singleton()->has_setting("editor_plugins/enabled")) {
addons = ProjectSettings::get_singleton()->get("editor_plugins/enabled");
}
diff --git a/editor/editor_node.h b/editor/editor_node.h
index e7853a27ba..0d1c6787cd 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -608,6 +608,8 @@ private:
void _license_tree_selected();
+ Vector<Ref<EditorResourceConversionPlugin> > resource_conversion_plugins;
+
protected:
void _notification(int p_what);
static void _bind_methods();
@@ -776,6 +778,10 @@ public:
~EditorNode();
void get_singleton(const char *arg1, bool arg2);
+ void add_resource_conversion_plugin(const Ref<EditorResourceConversionPlugin> &p_plugin);
+ void remove_resource_conversion_plugin(const Ref<EditorResourceConversionPlugin> &p_plugin);
+ Vector<Ref<EditorResourceConversionPlugin> > find_resource_conversion_plugin(const Ref<Resource> &p_for_resource);
+
static void add_init_callback(EditorNodeInitCallback p_callback) { _init_callbacks.push_back(p_callback); }
static void add_build_callback(EditorBuildCallback p_callback);
};
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index 246599be11..b4460c5619 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -112,8 +112,10 @@ Vector<Ref<Texture> > EditorInterface::make_mesh_previews(const Vector<Ref<Mesh>
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)
+ if (m == 0) {
+ textures.push_back(Ref<Texture>());
continue;
+ }
m = 1.0 / m;
m *= 0.5;
print_line("scale: " + rtos(m));
diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp
index 6732d7048f..8baa56b9b4 100644
--- a/editor/editor_plugin_settings.cpp
+++ b/editor/editor_plugin_settings.cpp
@@ -127,10 +127,10 @@ void EditorPluginSettings::update_plugins() {
item->set_editable(3, true);
if (EditorNode::get_singleton()->is_addon_plugin_enabled(d)) {
- item->set_custom_color(3, Color(0.2, 1, 0.2));
+ item->set_custom_color(3, get_color("success_color", "Editor"));
item->set_range(3, 1);
} else {
- item->set_custom_color(3, Color(1, 0.2, 0.2));
+ item->set_custom_color(3, get_color("disabled_font_color", "Editor"));
item->set_range(3, 0);
}
}
@@ -160,9 +160,9 @@ void EditorPluginSettings::_plugin_activity_changed() {
}
if (is_active)
- ti->set_custom_color(3, Color(0.2, 1, 0.2));
+ ti->set_custom_color(3, get_color("success_color", "Editor"));
else
- ti->set_custom_color(3, Color(1, 0.2, 0.2));
+ ti->set_custom_color(3, get_color("disabled_font_color", "Editor"));
}
void EditorPluginSettings::_bind_methods() {
diff --git a/editor/editor_profiler.cpp b/editor/editor_profiler.cpp
index 247775fa1d..968d8b831e 100644
--- a/editor/editor_profiler.cpp
+++ b/editor/editor_profiler.cpp
@@ -89,7 +89,7 @@ void EditorProfiler::clear() {
variables->clear();
//activate->set_pressed(false);
plot_sigs.clear();
- plot_sigs.insert("fixed_frame_time");
+ plot_sigs.insert("physics_frame_time");
plot_sigs.insert("category_frame_time");
updating_frame = true;
@@ -120,9 +120,9 @@ String EditorProfiler::_get_time_as_text(Metric &m, float p_time, int p_calls) {
return rtos(p_time / p_calls);
} else if (dmode == DISPLAY_FRAME_PERCENT) {
return _get_percent_txt(p_time, m.frame_time);
- } else if (dmode == DISPLAY_FIXED_FRAME_PERCENT) {
+ } else if (dmode == DISPLAY_PHYSICS_FRAME_PERCENT) {
- return _get_percent_txt(p_time, m.fixed_frame_time);
+ return _get_percent_txt(p_time, m.physics_frame_time);
}
return "err";
@@ -714,7 +714,7 @@ EditorProfiler::EditorProfiler() {
add_child(plot_delay);
plot_delay->connect("timeout", this, "_update_plot");
- plot_sigs.insert("fixed_frame_time");
+ plot_sigs.insert("physics_frame_time");
plot_sigs.insert("category_frame_time");
seeking = false;
diff --git a/editor/editor_profiler.h b/editor/editor_profiler.h
index e2d781f125..e9e88ed7f2 100644
--- a/editor/editor_profiler.h
+++ b/editor/editor_profiler.h
@@ -51,8 +51,8 @@ public:
int frame_number;
float frame_time;
float idle_time;
- float fixed_time;
- float fixed_frame_time;
+ float physics_time;
+ float physics_frame_time;
struct Category {
@@ -89,7 +89,7 @@ public:
DISPLAY_FRAME_TIME,
DISPLAY_AVERAGE_TIME,
DISPLAY_FRAME_PERCENT,
- DISPLAY_FIXED_FRAME_PERCENT,
+ DISPLAY_PHYSICS_FRAME_PERCENT,
};
enum DisplayTime {
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 5e81fd0fb4..b532bb793a 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -54,7 +54,7 @@ EditorSettings *EditorSettings::get_singleton() {
return singleton.ptr();
}
-bool EditorSettings::_set(const StringName &p_name, const Variant &p_value) {
+bool EditorSettings::_set(const StringName &p_name, const Variant &p_value, bool p_emit_signal) {
_THREAD_SAFE_METHOD_
@@ -90,7 +90,9 @@ bool EditorSettings::_set(const StringName &p_name, const Variant &p_value) {
}
}
- emit_signal("settings_changed");
+ if (p_emit_signal) {
+ emit_signal("settings_changed");
+ }
return true;
}
@@ -131,6 +133,11 @@ bool EditorSettings::_get(const StringName &p_name, Variant &r_ret) const {
return true;
}
+void EditorSettings::_initial_set(const StringName &p_name, const Variant &p_value) {
+ set(p_name, p_value);
+ props[p_name].initial = p_value;
+}
+
struct _EVCSort {
String name;
@@ -188,7 +195,17 @@ void EditorSettings::_get_property_list(List<PropertyInfo> *p_list) const {
p_list->push_back(PropertyInfo(Variant::ARRAY, "shortcuts", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); //do not edit
}
-bool EditorSettings::has(String p_var) const {
+void EditorSettings::set_setting(const String &p_setting, const Variant &p_value) {
+ _THREAD_SAFE_METHOD_
+ set(p_setting, p_value);
+}
+
+Variant EditorSettings::get_setting(const String &p_setting) const {
+ _THREAD_SAFE_METHOD_
+ return get(p_setting);
+}
+
+bool EditorSettings::has_setting(String p_var) const {
_THREAD_SAFE_METHOD_
@@ -211,15 +228,17 @@ void EditorSettings::raise_order(const String &p_name) {
Variant _EDITOR_DEF(const String &p_var, const Variant &p_default) {
- if (EditorSettings::get_singleton()->has(p_var))
+ if (EditorSettings::get_singleton()->has_setting(p_var))
return EditorSettings::get_singleton()->get(p_var);
EditorSettings::get_singleton()->set(p_var, p_default);
+ EditorSettings::get_singleton()->set_initial_value(p_var, p_default);
+
return p_default;
}
Variant _EDITOR_GET(const String &p_var) {
- ERR_FAIL_COND_V(!EditorSettings::get_singleton()->has(p_var), Variant())
+ ERR_FAIL_COND_V(!EditorSettings::get_singleton()->has_setting(p_var), Variant())
return EditorSettings::get_singleton()->get(p_var);
}
@@ -444,7 +463,7 @@ String EditorSettings::get_settings_path() const {
void EditorSettings::setup_language() {
- String lang = get("interface/editor_language");
+ String lang = get("interface/editor/editor_language");
if (lang == "en")
return; //none to do
@@ -462,8 +481,8 @@ void EditorSettings::setup_network() {
IP::get_singleton()->get_local_addresses(&local_ip);
String lip = "127.0.0.1";
String hint;
- String current = has("network/debug/remote_host") ? get("network/debug/remote_host") : "";
- int port = has("network/debug/remote_port") ? (int)get("network/debug/remote_port") : 6007;
+ String current = has_setting("network/debug/remote_host") ? get("network/debug/remote_host") : "";
+ int port = has_setting("network/debug/remote_port") ? (int)get("network/debug/remote_port") : 6007;
for (List<IP_Address>::Element *E = local_ip.front(); E; E = E->next()) {
@@ -546,235 +565,235 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
best = "en";
}
- set("interface/editor_language", best);
- hints["interface/editor_language"] = PropertyInfo(Variant::STRING, "interface/editor_language", PROPERTY_HINT_ENUM, lang_hint, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ _initial_set("interface/editor/editor_language", best);
+ hints["interface/editor/editor_language"] = PropertyInfo(Variant::STRING, "interface/editor/editor_language", PROPERTY_HINT_ENUM, lang_hint, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
}
- set("interface/hidpi_mode", 0);
- hints["interface/hidpi_mode"] = PropertyInfo(Variant::INT, "interface/hidpi_mode", PROPERTY_HINT_ENUM, "Auto,VeryLoDPI,LoDPI,MidDPI,HiDPI", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
- set("interface/show_script_in_scene_tabs", false);
- set("interface/font_size", 14);
- hints["interface/font_size"] = PropertyInfo(Variant::INT, "interface/font_size", PROPERTY_HINT_RANGE, "10,40,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
- set("interface/source_font_size", 14);
- hints["interface/source_font_size"] = PropertyInfo(Variant::INT, "interface/source_font_size", PROPERTY_HINT_RANGE, "8,96,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
- set("interface/custom_font", "");
- hints["interface/custom_font"] = PropertyInfo(Variant::STRING, "interface/custom_font", PROPERTY_HINT_GLOBAL_FILE, "*.font", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
- set("interface/dim_editor_on_dialog_popup", true);
- set("interface/dim_amount", 0.6f);
- hints["interface/dim_amount"] = PropertyInfo(Variant::REAL, "interface/dim_amount", PROPERTY_HINT_RANGE, "0,1,0.01", PROPERTY_USAGE_DEFAULT);
- set("interface/dim_transition_time", 0.08f);
- hints["interface/dim_transition_time"] = PropertyInfo(Variant::REAL, "interface/dim_transition_time", PROPERTY_HINT_RANGE, "0,1,0.001", PROPERTY_USAGE_DEFAULT);
-
- set("interface/separate_distraction_mode", false);
-
- set("interface/save_each_scene_on_quit", true); // Regression
- set("interface/quit_confirmation", true);
-
- set("interface/theme/preset", 0);
- hints["interface/theme/preset"] = PropertyInfo(Variant::INT, "interface/theme/preset", PROPERTY_HINT_ENUM, "Default,Grey,Godot 2,Arc,Light,Custom", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
- set("interface/theme/icon_and_font_color", 0);
+ _initial_set("interface/editor/hidpi_mode", 0);
+ hints["interface/editor/hidpi_mode"] = PropertyInfo(Variant::INT, "interface/editor/hidpi_mode", PROPERTY_HINT_ENUM, "Auto,VeryLoDPI,LoDPI,MidDPI,HiDPI", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ _initial_set("interface/editor/show_script_in_scene_tabs", false);
+ _initial_set("interface/editor/font_size", 14);
+ hints["interface/editor/font_size"] = PropertyInfo(Variant::INT, "interface/editor/font_size", PROPERTY_HINT_RANGE, "10,40,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ _initial_set("interface/editor/source_font_size", 14);
+ hints["interface/editor/source_font_size"] = PropertyInfo(Variant::INT, "interface/editor/source_font_size", PROPERTY_HINT_RANGE, "8,96,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ _initial_set("interface/editor/custom_font", "");
+ hints["interface/editor/custom_font"] = PropertyInfo(Variant::STRING, "interface/editor/custom_font", PROPERTY_HINT_GLOBAL_FILE, "*.font,*.tres,*.res", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ _initial_set("interface/editor/dim_editor_on_dialog_popup", true);
+ _initial_set("interface/editor/dim_amount", 0.6f);
+ hints["interface/editor/dim_amount"] = PropertyInfo(Variant::REAL, "interface/editor/dim_amount", PROPERTY_HINT_RANGE, "0,1,0.01", PROPERTY_USAGE_DEFAULT);
+ _initial_set("interface/editor/dim_transition_time", 0.08f);
+ hints["interface/editor/dim_transition_time"] = PropertyInfo(Variant::REAL, "interface/editor/dim_transition_time", PROPERTY_HINT_RANGE, "0,1,0.001", PROPERTY_USAGE_DEFAULT);
+
+ _initial_set("interface/editor/separate_distraction_mode", false);
+
+ _initial_set("interface/editor/save_each_scene_on_quit", true); // Regression
+ _initial_set("interface/editor/quit_confirmation", true);
+
+ _initial_set("interface/theme/preset", 0);
+ hints["interface/theme/preset"] = PropertyInfo(Variant::INT, "interface/theme/preset", PROPERTY_HINT_ENUM, "Default,Grey,Godot 2,Arc,Light,Alien,Custom", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ _initial_set("interface/theme/icon_and_font_color", 0);
hints["interface/theme/icon_and_font_color"] = PropertyInfo(Variant::INT, "interface/theme/icon_and_font_color", PROPERTY_HINT_ENUM, "Auto,Dark,Light", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
- set("interface/theme/base_color", Color::html("#323b4f"));
+ _initial_set("interface/theme/base_color", Color::html("#323b4f"));
hints["interface/theme/accent_color"] = PropertyInfo(Variant::COLOR, "interface/theme/accent_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
- set("interface/theme/accent_color", Color::html("#699ce8"));
+ _initial_set("interface/theme/accent_color", Color::html("#699ce8"));
hints["interface/theme/base_color"] = PropertyInfo(Variant::COLOR, "interface/theme/base_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
- set("interface/theme/contrast", 0.25);
+ _initial_set("interface/theme/contrast", 0.25);
hints["interface/theme/contrast"] = PropertyInfo(Variant::REAL, "interface/theme/contrast", PROPERTY_HINT_RANGE, "0.01, 1, 0.01");
- set("interface/theme/highlight_tabs", false);
- set("interface/theme/border_size", 1);
- set("interface/theme/use_graph_node_headers", false);
+ _initial_set("interface/theme/highlight_tabs", false);
+ _initial_set("interface/theme/border_size", 1);
+ _initial_set("interface/theme/use_graph_node_headers", false);
hints["interface/theme/border_size"] = PropertyInfo(Variant::INT, "interface/theme/border_size", PROPERTY_HINT_RANGE, "0,2,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
- set("interface/theme/additional_spacing", 0);
+ _initial_set("interface/theme/additional_spacing", 0);
hints["interface/theme/additional_spacing"] = PropertyInfo(Variant::REAL, "interface/theme/additional_spacing", PROPERTY_HINT_RANGE, "0,5,0.1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
- set("interface/theme/custom_theme", "");
+ _initial_set("interface/theme/custom_theme", "");
hints["interface/theme/custom_theme"] = PropertyInfo(Variant::STRING, "interface/theme/custom_theme", PROPERTY_HINT_GLOBAL_FILE, "*.res,*.tres,*.theme", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
- set("interface/scene_tabs/show_extension", false);
- set("interface/scene_tabs/show_thumbnail_on_hover", true);
- set("interface/scene_tabs/resize_if_many_tabs", true);
- set("interface/scene_tabs/minimum_width", 50);
+ _initial_set("interface/scene_tabs/show_extension", false);
+ _initial_set("interface/scene_tabs/show_thumbnail_on_hover", true);
+ _initial_set("interface/scene_tabs/resize_if_many_tabs", true);
+ _initial_set("interface/scene_tabs/minimum_width", 50);
hints["interface/scene_tabs/minimum_width"] = PropertyInfo(Variant::INT, "interface/scene_tabs/minimum_width", PROPERTY_HINT_RANGE, "50,500,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
- set("filesystem/directories/autoscan_project_path", "");
+ _initial_set("filesystem/directories/autoscan_project_path", "");
hints["filesystem/directories/autoscan_project_path"] = PropertyInfo(Variant::STRING, "filesystem/directories/autoscan_project_path", PROPERTY_HINT_GLOBAL_DIR);
- set("filesystem/directories/default_project_path", OS::get_singleton()->has_environment("HOME") ? OS::get_singleton()->get_environment("HOME") : OS::get_singleton()->get_system_dir(OS::SYSTEM_DIR_DOCUMENTS));
+ _initial_set("filesystem/directories/default_project_path", OS::get_singleton()->has_environment("HOME") ? OS::get_singleton()->get_environment("HOME") : OS::get_singleton()->get_system_dir(OS::SYSTEM_DIR_DOCUMENTS));
hints["filesystem/directories/default_project_path"] = PropertyInfo(Variant::STRING, "filesystem/directories/default_project_path", PROPERTY_HINT_GLOBAL_DIR);
- set("filesystem/directories/default_project_export_path", "");
+ _initial_set("filesystem/directories/default_project_export_path", "");
hints["global/default_project_export_path"] = PropertyInfo(Variant::STRING, "global/default_project_export_path", PROPERTY_HINT_GLOBAL_DIR);
- set("interface/show_script_in_scene_tabs", false);
+ _initial_set("interface/editor/show_script_in_scene_tabs", false);
- set("text_editor/theme/color_theme", "Adaptive");
+ _initial_set("text_editor/theme/color_theme", "Adaptive");
hints["text_editor/theme/color_theme"] = PropertyInfo(Variant::STRING, "text_editor/theme/color_theme", PROPERTY_HINT_ENUM, "Adaptive,Default");
- set("text_editor/theme/line_spacing", 4);
+ _initial_set("text_editor/theme/line_spacing", 4);
_load_default_text_editor_theme();
- set("text_editor/highlighting/syntax_highlighting", true);
+ _initial_set("text_editor/highlighting/syntax_highlighting", true);
- set("text_editor/highlighting/highlight_all_occurrences", true);
- set("text_editor/cursor/scroll_past_end_of_file", false);
+ _initial_set("text_editor/highlighting/highlight_all_occurrences", true);
+ _initial_set("text_editor/cursor/scroll_past_end_of_file", false);
- set("text_editor/indent/type", 0);
+ _initial_set("text_editor/indent/type", 0);
hints["text_editor/indent/type"] = PropertyInfo(Variant::INT, "text_editor/indent/type", PROPERTY_HINT_ENUM, "Tabs,Spaces");
- set("text_editor/indent/size", 4);
+ _initial_set("text_editor/indent/size", 4);
hints["text_editor/indent/size"] = PropertyInfo(Variant::INT, "text_editor/indent/size", PROPERTY_HINT_RANGE, "1, 64, 1"); // size of 0 crashes.
- set("text_editor/indent/auto_indent", true);
- set("text_editor/indent/convert_indent_on_save", false);
- set("text_editor/indent/draw_tabs", true);
-
- set("text_editor/line_numbers/show_line_numbers", true);
- set("text_editor/line_numbers/line_numbers_zero_padded", false);
- set("text_editor/line_numbers/show_breakpoint_gutter", true);
- set("text_editor/line_numbers/show_line_length_guideline", false);
- set("text_editor/line_numbers/line_length_guideline_column", 80);
+ _initial_set("text_editor/indent/auto_indent", true);
+ _initial_set("text_editor/indent/convert_indent_on_save", false);
+ _initial_set("text_editor/indent/draw_tabs", true);
+
+ _initial_set("text_editor/line_numbers/show_line_numbers", true);
+ _initial_set("text_editor/line_numbers/line_numbers_zero_padded", false);
+ _initial_set("text_editor/line_numbers/show_breakpoint_gutter", true);
+ _initial_set("text_editor/line_numbers/show_line_length_guideline", false);
+ _initial_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/v_scroll_speed", 80);
- set("text_editor/open_scripts/show_members_overview", true);
+ _initial_set("text_editor/open_scripts/smooth_scrolling", true);
+ _initial_set("text_editor/open_scripts/v_scroll_speed", 80);
+ _initial_set("text_editor/open_scripts/show_members_overview", true);
- set("text_editor/files/trim_trailing_whitespace_on_save", false);
- set("text_editor/completion/idle_parse_delay", 2);
- set("text_editor/tools/create_signal_callbacks", true);
- set("text_editor/files/autosave_interval_secs", 0);
+ _initial_set("text_editor/files/trim_trailing_whitespace_on_save", false);
+ _initial_set("text_editor/completion/idle_parse_delay", 2);
+ _initial_set("text_editor/tools/create_signal_callbacks", true);
+ _initial_set("text_editor/files/autosave_interval_secs", 0);
- set("text_editor/cursor/block_caret", false);
- set("text_editor/cursor/caret_blink", false);
- set("text_editor/cursor/caret_blink_speed", 0.65);
+ _initial_set("text_editor/cursor/block_caret", false);
+ _initial_set("text_editor/cursor/caret_blink", false);
+ _initial_set("text_editor/cursor/caret_blink_speed", 0.65);
hints["text_editor/cursor/caret_blink_speed"] = PropertyInfo(Variant::REAL, "text_editor/cursor/caret_blink_speed", PROPERTY_HINT_RANGE, "0.1, 10, 0.1");
- set("text_editor/theme/font", "");
- hints["text_editor/theme/font"] = PropertyInfo(Variant::STRING, "text_editor/theme/font", PROPERTY_HINT_GLOBAL_FILE, "*.font");
- set("text_editor/completion/auto_brace_complete", false);
- set("text_editor/files/restore_scripts_on_load", true);
- set("text_editor/completion/complete_file_paths", true);
- set("text_editor/files/maximum_recent_files", 20);
+ _initial_set("text_editor/theme/font", "");
+ hints["text_editor/theme/font"] = PropertyInfo(Variant::STRING, "text_editor/theme/font", PROPERTY_HINT_GLOBAL_FILE, "*.font,*.tres,*.res");
+ _initial_set("text_editor/completion/auto_brace_complete", false);
+ _initial_set("text_editor/files/restore_scripts_on_load", true);
+ _initial_set("text_editor/completion/complete_file_paths", true);
+ _initial_set("text_editor/files/maximum_recent_files", 20);
hints["text_editor/files/maximum_recent_files"] = PropertyInfo(Variant::INT, "text_editor/files/maximum_recent_files", PROPERTY_HINT_RANGE, "1, 200, 0");
- set("docks/scene_tree/start_create_dialog_fully_expanded", false);
- set("docks/scene_tree/draw_relationship_lines", false);
- set("docks/scene_tree/relationship_line_color", Color::html("464646"));
+ _initial_set("docks/scene_tree/start_create_dialog_fully_expanded", false);
+ _initial_set("docks/scene_tree/draw_relationship_lines", false);
+ _initial_set("docks/scene_tree/relationship_line_color", Color::html("464646"));
- set("editors/grid_map/pick_distance", 5000.0);
+ _initial_set("editors/grid_map/pick_distance", 5000.0);
- set("editors/3d/grid_color", Color(1, 1, 1, 0.2));
- hints["editors/3d/grid_color"] = PropertyInfo(Variant::COLOR, "editors/3d/grid_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ _initial_set("editors/3d/grid_color", Color::html("808080"));
+ hints["editors/3d/grid_color"] = PropertyInfo(Variant::COLOR, "editors/3d/grid_color", PROPERTY_HINT_COLOR_NO_ALPHA, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
- set("editors/3d/default_fov", 55.0);
- set("editors/3d/default_z_near", 0.1);
- set("editors/3d/default_z_far", 500.0);
+ _initial_set("editors/3d/default_fov", 55.0);
+ _initial_set("editors/3d/default_z_near", 0.1);
+ _initial_set("editors/3d/default_z_far", 500.0);
// navigation
- set("editors/3d/navigation/navigation_scheme", 0);
+ _initial_set("editors/3d/navigation/navigation_scheme", 0);
hints["editors/3d/navigation/navigation_scheme"] = PropertyInfo(Variant::INT, "editors/3d/navigation/navigation_scheme", PROPERTY_HINT_ENUM, "Godot,Maya,Modo");
- set("editors/3d/navigation/zoom_style", 0);
+ _initial_set("editors/3d/navigation/zoom_style", 0);
hints["editors/3d/navigation/zoom_style"] = PropertyInfo(Variant::INT, "editors/3d/navigation/zoom_style", PROPERTY_HINT_ENUM, "Vertical, Horizontal");
- set("editors/3d/navigation/emulate_3_button_mouse", false);
- set("editors/3d/navigation/orbit_modifier", 0);
+ _initial_set("editors/3d/navigation/emulate_3_button_mouse", false);
+ _initial_set("editors/3d/navigation/orbit_modifier", 0);
hints["editors/3d/navigation/orbit_modifier"] = PropertyInfo(Variant::INT, "editors/3d/navigation/orbit_modifier", PROPERTY_HINT_ENUM, "None,Shift,Alt,Meta,Ctrl");
- set("editors/3d/navigation/pan_modifier", 1);
+ _initial_set("editors/3d/navigation/pan_modifier", 1);
hints["editors/3d/navigation/pan_modifier"] = PropertyInfo(Variant::INT, "editors/3d/navigation/pan_modifier", PROPERTY_HINT_ENUM, "None,Shift,Alt,Meta,Ctrl");
- set("editors/3d/navigation/zoom_modifier", 4);
+ _initial_set("editors/3d/navigation/zoom_modifier", 4);
hints["editors/3d/navigation/zoom_modifier"] = PropertyInfo(Variant::INT, "editors/3d/navigation/zoom_modifier", PROPERTY_HINT_ENUM, "None,Shift,Alt,Meta,Ctrl");
- // set("editors/3d/navigation/emulate_numpad", false); not used at the moment
- set("editors/3d/navigation/warped_mouse_panning", true);
+ // _initial_set("editors/3d/navigation/emulate_numpad", false); not used at the moment
+ _initial_set("editors/3d/navigation/warped_mouse_panning", true);
// navigation feel
- set("editors/3d/navigation_feel/orbit_sensitivity", 0.4);
+ _initial_set("editors/3d/navigation_feel/orbit_sensitivity", 0.4);
hints["editors/3d/navigation_feel/orbit_sensitivity"] = PropertyInfo(Variant::REAL, "editors/3d/navigation_feel/orbit_sensitivity", PROPERTY_HINT_RANGE, "0.0, 2, 0.01");
- set("editors/3d/navigation_feel/orbit_inertia", 0.15);
+ _initial_set("editors/3d/navigation_feel/orbit_inertia", 0.15);
hints["editors/3d/navigation_feel/orbit_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/navigation_feel/orbit_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
- set("editors/3d/navigation_feel/translation_inertia", 0.15);
+ _initial_set("editors/3d/navigation_feel/translation_inertia", 0.15);
hints["editors/3d/navigation_feel/translation_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/navigation_feel/translation_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
- set("editors/3d/navigation_feel/zoom_inertia", 0.1);
+ _initial_set("editors/3d/navigation_feel/zoom_inertia", 0.075);
hints["editors/3d/navigation_feel/zoom_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/navigation_feel/zoom_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
- set("editors/3d/navigation_feel/manipulation_orbit_inertia", 0.1);
+ _initial_set("editors/3d/navigation_feel/manipulation_orbit_inertia", 0.075);
hints["editors/3d/navigation_feel/manipulation_orbit_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/navigation_feel/manipulation_orbit_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
- set("editors/3d/navigation_feel/manipulation_translation_inertia", 0.1);
+ _initial_set("editors/3d/navigation_feel/manipulation_translation_inertia", 0.075);
hints["editors/3d/navigation_feel/manipulation_translation_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/navigation_feel/manipulation_translation_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
// freelook
- set("editors/3d/freelook/freelook_inertia", 0.1);
+ _initial_set("editors/3d/freelook/freelook_inertia", 0.1);
hints["editors/3d/freelook/freelook_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/freelook/freelook_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
- set("editors/3d/freelook/freelook_base_speed", 0.5);
- hints["editors/3d/freelook/freelook_base_speed"] = PropertyInfo(Variant::REAL, "editors/3d/freelook/freelook_base_speed", PROPERTY_HINT_RANGE, "0.0, 10, 0.1");
- set("editors/3d/freelook/freelook_activation_modifier", 0);
+ _initial_set("editors/3d/freelook/freelook_base_speed", 0.1);
+ hints["editors/3d/freelook/freelook_base_speed"] = PropertyInfo(Variant::REAL, "editors/3d/freelook/freelook_base_speed", PROPERTY_HINT_RANGE, "0.0, 10, 0.01");
+ _initial_set("editors/3d/freelook/freelook_activation_modifier", 0);
hints["editors/3d/freelook/freelook_activation_modifier"] = PropertyInfo(Variant::INT, "editors/3d/freelook/freelook_activation_modifier", PROPERTY_HINT_ENUM, "None,Shift,Alt,Meta,Ctrl");
- set("editors/3d/freelook/freelook_modifier_speed_factor", 3.0);
+ _initial_set("editors/3d/freelook/freelook_modifier_speed_factor", 3.0);
hints["editors/3d/freelook/freelook_modifier_speed_factor"] = PropertyInfo(Variant::REAL, "editors/3d/freelook/freelook_modifier_speed_factor", PROPERTY_HINT_RANGE, "0.0, 10.0, 0.1");
- set("editors/2d/bone_width", 5);
- set("editors/2d/bone_color1", Color(1.0, 1.0, 1.0, 0.9));
- set("editors/2d/bone_color2", Color(0.75, 0.75, 0.75, 0.9));
- set("editors/2d/bone_selected_color", Color(0.9, 0.45, 0.45, 0.9));
- set("editors/2d/bone_ik_color", Color(0.9, 0.9, 0.45, 0.9));
- set("editors/2d/keep_margins_when_changing_anchors", false);
- set("editors/2d/warped_mouse_panning", true);
- set("editors/2d/scroll_to_pan", false);
- set("editors/2d/pan_speed", 20);
+ _initial_set("editors/2d/bone_width", 5);
+ _initial_set("editors/2d/bone_color1", Color(1.0, 1.0, 1.0, 0.9));
+ _initial_set("editors/2d/bone_color2", Color(0.75, 0.75, 0.75, 0.9));
+ _initial_set("editors/2d/bone_selected_color", Color(0.9, 0.45, 0.45, 0.9));
+ _initial_set("editors/2d/bone_ik_color", Color(0.9, 0.9, 0.45, 0.9));
+ _initial_set("editors/2d/keep_margins_when_changing_anchors", false);
+ _initial_set("editors/2d/warped_mouse_panning", true);
+ _initial_set("editors/2d/scroll_to_pan", false);
+ _initial_set("editors/2d/pan_speed", 20);
- set("editors/poly_editor/point_grab_radius", 8);
- set("editors/poly_editor/show_previous_outline", true);
+ _initial_set("editors/poly_editor/point_grab_radius", 8);
+ _initial_set("editors/poly_editor/show_previous_outline", true);
- set("run/window_placement/rect", 1);
+ _initial_set("run/window_placement/rect", 1);
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);
}
- set("run/window_placement/rect_custom_position", Vector2());
- set("run/window_placement/screen", 0);
+ _initial_set("run/window_placement/rect_custom_position", Vector2());
+ _initial_set("run/window_placement/screen", 0);
hints["run/window_placement/screen"] = PropertyInfo(Variant::INT, "run/window_placement/screen", PROPERTY_HINT_ENUM, screen_hints);
- set("filesystem/on_save/compress_binary_resources", true);
- set("filesystem/on_save/save_modified_external_resources", true);
+ _initial_set("filesystem/on_save/compress_binary_resources", true);
+ _initial_set("filesystem/on_save/save_modified_external_resources", true);
- set("text_editor/tools/create_signal_callbacks", true);
+ _initial_set("text_editor/tools/create_signal_callbacks", true);
- set("filesystem/file_dialog/show_hidden_files", false);
- set("filesystem/file_dialog/display_mode", 0);
+ _initial_set("filesystem/file_dialog/show_hidden_files", false);
+ _initial_set("filesystem/file_dialog/display_mode", 0);
hints["filesystem/file_dialog/display_mode"] = PropertyInfo(Variant::INT, "filesystem/file_dialog/display_mode", PROPERTY_HINT_ENUM, "Thumbnails,List");
- set("filesystem/file_dialog/thumbnail_size", 64);
+ _initial_set("filesystem/file_dialog/thumbnail_size", 64);
hints["filesystem/file_dialog/thumbnail_size"] = PropertyInfo(Variant::INT, "filesystem/file_dialog/thumbnail_size", PROPERTY_HINT_RANGE, "32,128,16");
- set("docks/filesystem/display_mode", 0);
+ _initial_set("docks/filesystem/display_mode", 0);
hints["docks/filesystem/display_mode"] = PropertyInfo(Variant::INT, "docks/filesystem/display_mode", PROPERTY_HINT_ENUM, "Thumbnails,List");
- set("docks/filesystem/thumbnail_size", 64);
+ _initial_set("docks/filesystem/thumbnail_size", 64);
hints["docks/filesystem/thumbnail_size"] = PropertyInfo(Variant::INT, "docks/filesystem/thumbnail_size", PROPERTY_HINT_RANGE, "32,128,16");
- set("docks/filesystem/display_mode", 0);
+ _initial_set("docks/filesystem/display_mode", 0);
hints["docks/filesystem/display_mode"] = PropertyInfo(Variant::INT, "docks/filesystem/display_mode", PROPERTY_HINT_ENUM, "Thumbnails,List");
- set("docks/filesystem/always_show_folders", true);
+ _initial_set("docks/filesystem/always_show_folders", true);
- set("editors/animation/autorename_animation_tracks", true);
- set("editors/animation/confirm_insert_track", true);
+ _initial_set("editors/animation/autorename_animation_tracks", true);
+ _initial_set("editors/animation/confirm_insert_track", true);
- set("docks/property_editor/texture_preview_width", 48);
- set("docks/property_editor/auto_refresh_interval", 0.3);
- set("text_editor/help/doc_path", "");
- set("text_editor/help/show_help_index", true);
+ _initial_set("docks/property_editor/texture_preview_width", 48);
+ _initial_set("docks/property_editor/auto_refresh_interval", 0.3);
+ _initial_set("text_editor/help/doc_path", "");
+ _initial_set("text_editor/help/show_help_index", true);
- set("filesystem/import/ask_save_before_reimport", false);
+ _initial_set("filesystem/import/ask_save_before_reimport", false);
- set("filesystem/import/pvrtc_texture_tool", "");
+ _initial_set("filesystem/import/pvrtc_texture_tool", "");
#ifdef WINDOWS_ENABLED
hints["filesystem/import/pvrtc_texture_tool"] = PropertyInfo(Variant::STRING, "filesystem/import/pvrtc_texture_tool", PROPERTY_HINT_GLOBAL_FILE, "*.exe");
#else
hints["filesystem/import/pvrtc_texture_tool"] = PropertyInfo(Variant::STRING, "filesystem/import/pvrtc_texture_tool", PROPERTY_HINT_GLOBAL_FILE, "");
#endif
- set("filesystem/import/pvrtc_fast_conversion", false);
+ _initial_set("filesystem/import/pvrtc_fast_conversion", false);
- set("run/auto_save/save_before_running", true);
- set("run/output/always_clear_output_on_play", true);
- set("run/output/always_open_output_on_play", true);
- set("run/output/always_close_output_on_stop", false);
- set("filesystem/resources/save_compressed_resources", true);
- set("filesystem/resources/auto_reload_modified_images", true);
+ _initial_set("run/auto_save/save_before_running", true);
+ _initial_set("run/output/always_clear_output_on_play", true);
+ _initial_set("run/output/always_open_output_on_play", true);
+ _initial_set("run/output/always_close_output_on_stop", false);
+ _initial_set("filesystem/resources/save_compressed_resources", true);
+ _initial_set("filesystem/resources/auto_reload_modified_images", true);
- set("filesystem/import/automatic_reimport_on_sources_changed", true);
+ _initial_set("filesystem/import/automatic_reimport_on_sources_changed", true);
if (p_extra_config.is_valid()) {
@@ -804,35 +823,35 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
}
void EditorSettings::_load_default_text_editor_theme() {
- set("text_editor/highlighting/background_color", Color::html("3b000000"));
- set("text_editor/highlighting/completion_background_color", Color::html("2C2A32"));
- set("text_editor/highlighting/completion_selected_color", Color::html("434244"));
- set("text_editor/highlighting/completion_existing_color", Color::html("21dfdfdf"));
- set("text_editor/highlighting/completion_scroll_color", Color::html("ffffff"));
- set("text_editor/highlighting/completion_font_color", Color::html("aaaaaa"));
- set("text_editor/highlighting/caret_color", Color::html("aaaaaa"));
- set("text_editor/highlighting/caret_background_color", Color::html("000000"));
- set("text_editor/highlighting/line_number_color", Color::html("66aaaaaa"));
- set("text_editor/highlighting/text_color", Color::html("aaaaaa"));
- set("text_editor/highlighting/text_selected_color", Color::html("000000"));
- set("text_editor/highlighting/keyword_color", Color::html("ffffb3"));
- set("text_editor/highlighting/base_type_color", Color::html("a4ffd4"));
- set("text_editor/highlighting/engine_type_color", Color::html("83d3ff"));
- set("text_editor/highlighting/function_color", Color::html("66a2ce"));
- set("text_editor/highlighting/member_variable_color", Color::html("e64e59"));
- set("text_editor/highlighting/comment_color", Color::html("676767"));
- set("text_editor/highlighting/string_color", Color::html("ef6ebe"));
- set("text_editor/highlighting/number_color", Color::html("EB9532"));
- set("text_editor/highlighting/symbol_color", Color::html("badfff"));
- set("text_editor/highlighting/selection_color", Color::html("6ca9c2"));
- set("text_editor/highlighting/brace_mismatch_color", Color(1, 0.2, 0.2));
- set("text_editor/highlighting/current_line_color", Color(0.3, 0.5, 0.8, 0.15));
- set("text_editor/highlighting/line_length_guideline_color", Color(0.3, 0.5, 0.8, 0.1));
- set("text_editor/highlighting/mark_color", Color(1.0, 0.4, 0.4, 0.4));
- set("text_editor/highlighting/breakpoint_color", Color(0.8, 0.8, 0.4, 0.2));
- set("text_editor/highlighting/word_highlighted_color", Color(0.8, 0.9, 0.9, 0.15));
- set("text_editor/highlighting/search_result_color", Color(0.05, 0.25, 0.05, 1));
- set("text_editor/highlighting/search_result_border_color", Color(0.1, 0.45, 0.1, 1));
+ _initial_set("text_editor/highlighting/background_color", Color::html("3b000000"));
+ _initial_set("text_editor/highlighting/completion_background_color", Color::html("2C2A32"));
+ _initial_set("text_editor/highlighting/completion_selected_color", Color::html("434244"));
+ _initial_set("text_editor/highlighting/completion_existing_color", Color::html("21dfdfdf"));
+ _initial_set("text_editor/highlighting/completion_scroll_color", Color::html("ffffff"));
+ _initial_set("text_editor/highlighting/completion_font_color", Color::html("aaaaaa"));
+ _initial_set("text_editor/highlighting/caret_color", Color::html("aaaaaa"));
+ _initial_set("text_editor/highlighting/caret_background_color", Color::html("000000"));
+ _initial_set("text_editor/highlighting/line_number_color", Color::html("66aaaaaa"));
+ _initial_set("text_editor/highlighting/text_color", Color::html("aaaaaa"));
+ _initial_set("text_editor/highlighting/text_selected_color", Color::html("000000"));
+ _initial_set("text_editor/highlighting/keyword_color", Color::html("ffffb3"));
+ _initial_set("text_editor/highlighting/base_type_color", Color::html("a4ffd4"));
+ _initial_set("text_editor/highlighting/engine_type_color", Color::html("83d3ff"));
+ _initial_set("text_editor/highlighting/function_color", Color::html("66a2ce"));
+ _initial_set("text_editor/highlighting/member_variable_color", Color::html("e64e59"));
+ _initial_set("text_editor/highlighting/comment_color", Color::html("676767"));
+ _initial_set("text_editor/highlighting/string_color", Color::html("ef6ebe"));
+ _initial_set("text_editor/highlighting/number_color", Color::html("EB9532"));
+ _initial_set("text_editor/highlighting/symbol_color", Color::html("badfff"));
+ _initial_set("text_editor/highlighting/selection_color", Color::html("6ca9c2"));
+ _initial_set("text_editor/highlighting/brace_mismatch_color", Color(1, 0.2, 0.2));
+ _initial_set("text_editor/highlighting/current_line_color", Color(0.3, 0.5, 0.8, 0.15));
+ _initial_set("text_editor/highlighting/line_length_guideline_color", Color(0.3, 0.5, 0.8, 0.1));
+ _initial_set("text_editor/highlighting/mark_color", Color(1.0, 0.4, 0.4, 0.4));
+ _initial_set("text_editor/highlighting/breakpoint_color", Color(0.8, 0.8, 0.4, 0.2));
+ _initial_set("text_editor/highlighting/word_highlighted_color", Color(0.8, 0.9, 0.9, 0.15));
+ _initial_set("text_editor/highlighting/search_result_color", Color(0.05, 0.25, 0.05, 1));
+ _initial_set("text_editor/highlighting/search_result_border_color", Color(0.1, 0.45, 0.1, 1));
}
void EditorSettings::notify_changes() {
@@ -980,7 +999,7 @@ void EditorSettings::load_text_editor_theme() {
String val = cf->get_value("color_theme", key);
// don't load if it's not already there!
- if (has("text_editor/highlighting/" + key)) {
+ if (has_setting("text_editor/highlighting/" + key)) {
// make sure it is actually a color
if (val.is_valid_html_color() && key.find("color") >= 0) {
@@ -1037,7 +1056,7 @@ bool EditorSettings::save_text_editor_theme_as(String p_file) {
String theme_name = p_file.substr(0, p_file.length() - 4).get_file();
if (p_file.get_base_dir() == get_settings_path() + "/text_editor_themes") {
- set("text_editor/theme/color_theme", theme_name);
+ _initial_set("text_editor/theme/color_theme", theme_name);
load_text_editor_theme();
}
return true;
@@ -1161,8 +1180,34 @@ void EditorSettings::set_project_metadata(const String &p_section, const String
cf->save(path);
}
+bool EditorSettings::property_can_revert(const String &p_name) {
+
+ if (!props.has(p_name))
+ return false;
+
+ return props[p_name].initial != props[p_name].variant;
+}
+
+Variant EditorSettings::property_get_revert(const String &p_name) {
+
+ if (!props.has(p_name))
+ return Variant();
+
+ return props[p_name].initial;
+}
+
+void EditorSettings::set_initial_value(const StringName &p_name, const Variant &p_value) {
+
+ ERR_FAIL_COND(!props.has(p_name));
+ props[p_name].initial = p_value;
+}
+
void EditorSettings::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("has_setting", "name"), &EditorSettings::has_setting);
+ ClassDB::bind_method(D_METHOD("set_setting", "name", "value"), &EditorSettings::set_setting);
+ ClassDB::bind_method(D_METHOD("get_setting", "name"), &EditorSettings::get_setting);
+
ClassDB::bind_method(D_METHOD("erase", "property"), &EditorSettings::erase);
ClassDB::bind_method(D_METHOD("get_settings_path"), &EditorSettings::get_settings_path);
ClassDB::bind_method(D_METHOD("get_project_settings_path"), &EditorSettings::get_project_settings_path);
@@ -1175,6 +1220,11 @@ void EditorSettings::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_recent_dirs", "dirs"), &EditorSettings::set_recent_dirs);
ClassDB::bind_method(D_METHOD("get_recent_dirs"), &EditorSettings::get_recent_dirs);
+ ClassDB::bind_method(D_METHOD("property_can_revert", "name"), &EditorSettings::property_can_revert);
+ ClassDB::bind_method(D_METHOD("property_get_revert", "name"), &EditorSettings::property_get_revert);
+
+ ClassDB::bind_method(D_METHOD("set_initial_value", "name", "value"), &EditorSettings::set_initial_value);
+
ADD_SIGNAL(MethodInfo("settings_changed"));
}
diff --git a/editor/editor_settings.h b/editor/editor_settings.h
index 177ec4760d..c5d2670650 100644
--- a/editor/editor_settings.h
+++ b/editor/editor_settings.h
@@ -65,6 +65,7 @@ private:
struct VariantContainer {
int order;
Variant variant;
+ Variant initial;
bool hide_from_editor;
bool save;
VariantContainer() {
@@ -84,10 +85,12 @@ private:
HashMap<String, VariantContainer> props;
String resource_path;
- bool _set(const StringName &p_name, const Variant &p_value);
+ bool _set(const StringName &p_name, const Variant &p_value, bool p_emit_signal = true);
bool _get(const StringName &p_name, Variant &r_ret) const;
void _get_property_list(List<PropertyInfo> *p_list) const;
+ void _initial_set(const StringName &p_name, const Variant &p_value);
+
static Ref<EditorSettings> singleton;
String config_file_path;
@@ -123,7 +126,14 @@ public:
NOTIFICATION_EDITOR_SETTINGS_CHANGED = 10000
};
- bool has(String p_var) const;
+ void set_manually(const StringName &p_name, const Variant &p_value, bool p_emit_signal = false) {
+ _set(p_name, p_value, p_emit_signal);
+ }
+
+ void set_setting(const String &p_setting, const Variant &p_value);
+ Variant get_setting(const String &p_setting) const;
+
+ bool has_setting(String p_var) const;
static EditorSettings *get_singleton();
void erase(String p_var);
String get_settings_path() const;
@@ -171,6 +181,11 @@ public:
Variant get_project_metadata(const String &p_section, const String &p_key, Variant p_default);
void set_project_metadata(const String &p_section, const String &p_key, Variant p_data);
+ bool property_can_revert(const String &p_name);
+ Variant property_get_revert(const String &p_name);
+
+ void set_initial_value(const StringName &p_name, const Variant &p_value);
+
EditorSettings();
~EditorSettings();
};
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 791b3ee92c..0436ac78df 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -37,9 +37,9 @@
#include "modules/svg/image_loader_svg.h"
#include "time.h"
-static Ref<StyleBoxTexture> make_stylebox(Ref<Texture> texture, float p_left, float p_top, float p_right, float p_botton, float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_botton = -1, bool p_draw_center = true) {
+static Ref<StyleBoxTexture> make_stylebox(Ref<Texture> p_texture, float p_left, float p_top, float p_right, float p_botton, float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_botton = -1, bool p_draw_center = true) {
Ref<StyleBoxTexture> style(memnew(StyleBoxTexture));
- style->set_texture(texture);
+ style->set_texture(p_texture);
style->set_margin_size(MARGIN_LEFT, p_left * EDSCALE);
style->set_margin_size(MARGIN_RIGHT, p_right * EDSCALE);
style->set_margin_size(MARGIN_BOTTOM, p_botton * EDSCALE);
@@ -61,9 +61,9 @@ static Ref<StyleBoxEmpty> make_empty_stylebox(float p_margin_left = -1, float p_
return style;
}
-static Ref<StyleBoxFlat> make_flat_stylebox(Color color, float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_bottom = -1) {
+static Ref<StyleBoxFlat> make_flat_stylebox(Color p_color, float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_bottom = -1) {
Ref<StyleBoxFlat> style(memnew(StyleBoxFlat));
- style->set_bg_color(color);
+ style->set_bg_color(p_color);
style->set_default_margin(MARGIN_LEFT, p_margin_left * EDSCALE);
style->set_default_margin(MARGIN_RIGHT, p_margin_right * EDSCALE);
style->set_default_margin(MARGIN_BOTTOM, p_margin_bottom * EDSCALE);
@@ -71,12 +71,12 @@ static Ref<StyleBoxFlat> make_flat_stylebox(Color color, float p_margin_left = -
return style;
}
-static Ref<StyleBoxLine> make_line_stylebox(Color color, int thickness = 1, float grow = 1, bool vertical = false) {
+static Ref<StyleBoxLine> make_line_stylebox(Color p_color, int p_thickness = 1, float p_grow = 1, bool p_vertical = false) {
Ref<StyleBoxLine> style(memnew(StyleBoxLine));
- style->set_color(color);
- style->set_grow(grow);
- style->set_thickness(thickness);
- style->set_vertical(vertical);
+ style->set_color(p_color);
+ style->set_grow(p_grow);
+ style->set_thickness(p_thickness);
+ style->set_vertical(p_vertical);
return style;
}
@@ -86,7 +86,7 @@ static Ref<StyleBoxFlat> change_border_color(Ref<StyleBoxFlat> p_style, Color p_
return style;
}
-Ref<ImageTexture> editor_generate_icon(int p_index, bool convert_color, float p_scale = EDSCALE, bool force_filter = false) {
+Ref<ImageTexture> editor_generate_icon(int p_index, bool p_convert_color, float p_scale = EDSCALE, bool p_force_filter = false) {
Ref<ImageTexture> icon = memnew(ImageTexture);
Ref<Image> img = memnew(Image);
@@ -94,9 +94,9 @@ Ref<ImageTexture> editor_generate_icon(int p_index, bool convert_color, float p_
// dumb gizmo check
bool is_gizmo = String(editor_icons_names[p_index]).begins_with("Gizmo");
- ImageLoaderSVG::create_image_from_string(img, editor_icons_sources[p_index], p_scale, true, convert_color);
+ ImageLoaderSVG::create_image_from_string(img, editor_icons_sources[p_index], p_scale, true, p_convert_color);
- if ((p_scale - (float)((int)p_scale)) > 0.0 || is_gizmo || force_filter)
+ if ((p_scale - (float)((int)p_scale)) > 0.0 || is_gizmo || p_force_filter)
icon->create_from_image(img); // in this case filter really helps
else
icon->create_from_image(img, 0);
@@ -108,11 +108,11 @@ Ref<ImageTexture> editor_generate_icon(int p_index, bool convert_color, float p_
#define ADD_CONVERT_COLOR(dictionary, old_color, new_color) dictionary[Color::html(old_color)] = Color::html(new_color)
#endif
-void editor_register_and_generate_icons(Ref<Theme> p_theme, bool dark_theme = true, int p_thumb_size = 32, bool only_thumbs = false) {
+void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme = true, int p_thumb_size = 32, bool p_only_thumbs = false) {
#ifdef SVG_ENABLED
Dictionary dark_icon_color_dictionary;
- if (!dark_theme) {
+ if (!p_dark_theme) {
//convert color: FROM TO
ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#e0e0e0", "#4f4f4f"); // common icon color
ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#ffffff", "#000000"); // white
@@ -146,6 +146,25 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool dark_theme = tr
ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#84c2ff", "#5caeff"); // selection (blue)
ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#ea686c", "#e3383d"); // key xform (red)
+
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#69ecbd", "#25e3a0"); // VS variant
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#8da6f0", "#6d8eeb"); // VS bool
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#7dc6ef", "#4fb2e9"); // VS int
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#61daf4", "#27ccf0"); // VS float
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#6ba7ec", "#4690e7"); // VS string
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#bd91f1", "#ad76ee"); // VS vector2
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#f191a5", "#ee758e"); // VS rect
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#e286f0", "#dc6aed"); // VS vector3
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#c4ec69", "#96ce1a"); // VS transform2D
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#f77070", "#f77070"); // VS plane
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#ec69a3", "#ec69a3"); // VS quat
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#ee7991", "#ee7991"); // VS aabb
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#e3ec69", "#b2bb19"); // VS basis
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#f6a86e", "#f49047"); // VS transform
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#6993ec", "#6993ec"); // VS path
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#69ec9a", "#2ce573"); // VS rid
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#79f3e8", "#12d5c3"); // VS object
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#77edb1", "#57e99f"); // VS dict
}
// these ones should be converted even if we are using a dark theme
@@ -168,13 +187,18 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool dark_theme = tr
exceptions.push_back("GuiCloseCustomizable");
exceptions.push_back("GuiGraphNodePort");
exceptions.push_back("GuiResizer");
+ exceptions.push_back("ZoomMore");
+ exceptions.push_back("ZoomLess");
+ exceptions.push_back("ZoomReset");
+ exceptions.push_back("LockViewport");
+ exceptions.push_back("GroupViewport");
clock_t begin_time = clock();
ImageLoaderSVG::set_convert_colors(&dark_icon_color_dictionary);
// generate icons
- if (!only_thumbs)
+ if (!p_only_thumbs)
for (int i = 0; i < editor_icons_count; i++) {
List<String>::Element *is_exception = exceptions.find(editor_icons_names[i]);
if (is_exception) exceptions.erase(is_exception);
@@ -190,7 +214,7 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool dark_theme = tr
int index = editor_bg_thumbs_indices[i];
List<String>::Element *is_exception = exceptions.find(editor_icons_names[index]);
if (is_exception) exceptions.erase(is_exception);
- Ref<ImageTexture> icon = editor_generate_icon(index, !dark_theme && !is_exception, scale, force_filter);
+ Ref<ImageTexture> icon = editor_generate_icon(index, !p_dark_theme && !is_exception, scale, force_filter);
p_theme->set_icon(editor_icons_names[index], "EditorIcons", icon);
}
} else {
@@ -199,7 +223,7 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool dark_theme = tr
int index = editor_md_thumbs_indices[i];
List<String>::Element *is_exception = exceptions.find(editor_icons_names[index]);
if (is_exception) exceptions.erase(is_exception);
- Ref<ImageTexture> icon = editor_generate_icon(index, !dark_theme && !is_exception, scale, force_filter);
+ Ref<ImageTexture> icon = editor_generate_icon(index, !p_dark_theme && !is_exception, scale, force_filter);
p_theme->set_icon(editor_icons_names[index], "EditorIcons", icon);
}
}
@@ -222,8 +246,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
const float default_contrast = 0.25;
//Theme settings
- Color accent_color = EDITOR_DEF("interface/theme/accent_color", Color::html("#000000"));
- Color base_color = EDITOR_DEF("interface/theme/base_color", Color::html("#000000"));
+ Color accent_color = EDITOR_DEF("interface/theme/accent_color", Color::html("#699ce8"));
+ Color base_color = EDITOR_DEF("interface/theme/base_color", Color::html("#323b4f"));
float contrast = EDITOR_DEF("interface/theme/contrast", default_contrast);
int preset = EDITOR_DEF("interface/theme/preset", 0);
@@ -235,33 +259,59 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
Color script_bg_color = EDITOR_DEF("text_editor/highlighting/background_color", Color(0, 0, 0, 0));
+ Color preset_accent_color;
+ Color preset_base_color;
+ float preset_contrast;
switch (preset) {
case 0: { // Default
- accent_color = Color::html("#699ce8");
- base_color = Color::html("#323b4f");
- contrast = default_contrast;
+ preset_accent_color = Color::html("#699ce8");
+ preset_base_color = Color::html("#323b4f");
+ preset_contrast = default_contrast;
} break;
case 1: { // Grey
- accent_color = Color::html("#3e3e3e");
- base_color = Color::html("#3d3d3d");
- contrast = 0.2;
+ preset_accent_color = Color::html("#b8e4ff");
+ preset_base_color = Color::html("#3d3d3d");
+ preset_contrast = 0.2;
} break;
case 2: { // Godot 2
- accent_color = Color::html("#86ace2");
- base_color = Color::html("#3C3A44");
- contrast = 0.25;
+ preset_accent_color = Color::html("#86ace2");
+ preset_base_color = Color::html("#3C3A44");
+ preset_contrast = 0.25;
} break;
case 3: { // Arc
- accent_color = Color::html("#5294e2");
- base_color = Color::html("#383c4a");
- contrast = 0.25;
+ preset_accent_color = Color::html("#5294e2");
+ preset_base_color = Color::html("#383c4a");
+ preset_contrast = 0.25;
} break;
case 4: { // Light
- accent_color = Color::html("#2070ff");
- base_color = Color::html("#ffffff");
- contrast = 0.08;
+ preset_accent_color = Color::html("#2070ff");
+ preset_base_color = Color::html("#ffffff");
+ preset_contrast = 0.08;
} break;
+ case 5: { // Alien
+ preset_accent_color = Color::html("#1bfe99");
+ preset_base_color = Color::html("#2f373f");
+ preset_contrast = 0.25;
+ }
+ default: { // Custom
+ accent_color = EDITOR_DEF("interface/theme/accent_color", Color::html("#699ce8"));
+ base_color = EDITOR_DEF("interface/theme/base_color", Color::html("#323b4f"));
+ contrast = EDITOR_DEF("interface/theme/contrast", default_contrast);
+ }
+ }
+
+ if (preset != 6) {
+ accent_color = preset_accent_color;
+ base_color = preset_base_color;
+ contrast = preset_contrast;
+ EditorSettings::get_singleton()->set_initial_value("interface/theme/accent_color", accent_color);
+ EditorSettings::get_singleton()->set_initial_value("interface/theme/base_color", base_color);
+ EditorSettings::get_singleton()->set_initial_value("interface/theme/contrast", contrast);
}
+ EditorSettings::get_singleton()->set_manually("interface/theme/preset", preset);
+ EditorSettings::get_singleton()->set_manually("interface/theme/accent_color", accent_color);
+ EditorSettings::get_singleton()->set_manually("interface/theme/base_color", base_color);
+ EditorSettings::get_singleton()->set_manually("interface/theme/contrast", contrast);
//Colors
int AUTO_COLOR = 0;
@@ -291,6 +341,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
const Color highlight_color = Color(mono_color.r, mono_color.g, mono_color.b, 0.2);
theme->set_color("accent_color", "Editor", accent_color);
+ theme->set_color("highlight_color", "Editor", highlight_color);
theme->set_color("base_color", "Editor", base_color);
theme->set_color("dark_color_1", "Editor", dark_color_1);
theme->set_color("dark_color_2", "Editor", dark_color_2);
@@ -299,17 +350,27 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("contrast_color_2", "Editor", contrast_color_2);
theme->set_color("font_color", "Editor", font_color);
+ theme->set_color("disabled_font_color", "Editor", font_color_disabled);
+
+ theme->set_color("mono_color", "Editor", mono_color);
- Color success_color = accent_color.linear_interpolate(Color(.6, 1, .6), 0.8);
- Color warning_color = accent_color.linear_interpolate(Color(1, 1, .2), 0.8);
- Color error_color = accent_color.linear_interpolate(Color(1, .2, .2), 0.8);
+ Color success_color = accent_color.linear_interpolate(Color(0.2, 1, 0.2), 0.6) * 1.2;
+ Color warning_color = accent_color.linear_interpolate(Color(1, 1, 0), 0.7) * 1.2;
+ Color error_color = accent_color.linear_interpolate(Color(1, 0, 0), 0.8) * 1.7;
+ if (!dark_theme) {
+ // yellow on white themes is a P.I.T.A.
+ warning_color = accent_color.linear_interpolate(Color(1, 0.8, 0), 0.9);
+ warning_color = warning_color.linear_interpolate(mono_color, 0.2);
+ success_color = success_color.linear_interpolate(mono_color, 0.2);
+ error_color = error_color.linear_interpolate(mono_color, 0.2);
+ }
theme->set_color("success_color", "Editor", success_color);
theme->set_color("warning_color", "Editor", warning_color);
theme->set_color("error_color", "Editor", error_color);
// 2d grid color
- const Color grid_minor_color = Color(font_color.r, font_color.g, font_color.b, 0.1);
- const Color grid_major_color = Color(font_color_disabled.r, font_color_disabled.g, font_color_disabled.b, 0.05);
+ const Color grid_minor_color = mono_color * Color(1.0, 1.0, 1.0, 0.07);
+ const Color grid_major_color = Color(font_color_disabled.r, font_color_disabled.g, font_color_disabled.b, 0.15);
theme->set_color("grid_major_color", "Editor", grid_major_color);
theme->set_color("grid_minor_color", "Editor", grid_minor_color);
@@ -351,7 +412,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
style_default->set_draw_center(true);
// Button and widgets
- const float extra_spacing = EDITOR_DEF("interface/theme/additional_spacing", 0.0);
+ const float extra_spacing = EDITOR_GET("interface/theme/additional_spacing");
Ref<StyleBoxFlat> style_widget = style_default->duplicate();
style_widget->set_default_margin(MARGIN_LEFT, (extra_spacing + 6) * EDSCALE);
@@ -376,32 +437,44 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// style for windows, popups, etc..
Ref<StyleBoxFlat> style_popup = style_default->duplicate();
- style_popup->set_default_margin(MARGIN_LEFT, default_margin_size * EDSCALE * 2);
- style_popup->set_default_margin(MARGIN_TOP, default_margin_size * EDSCALE * 2);
- style_popup->set_default_margin(MARGIN_RIGHT, default_margin_size * EDSCALE * 2);
- style_popup->set_default_margin(MARGIN_BOTTOM, default_margin_size * EDSCALE * 2);
+ const int popup_margin_size = default_margin_size * EDSCALE * 2;
+ style_popup->set_default_margin(MARGIN_LEFT, popup_margin_size);
+ style_popup->set_default_margin(MARGIN_TOP, popup_margin_size);
+ style_popup->set_default_margin(MARGIN_RIGHT, popup_margin_size);
+ style_popup->set_default_margin(MARGIN_BOTTOM, popup_margin_size);
style_popup->set_border_color_all(contrast_color_1);
style_popup->set_border_width_all(MAX(EDSCALE, border_width));
const Color shadow_color = Color(0, 0, 0, dark_theme ? 0.3 : 0.1);
style_popup->set_shadow_color(shadow_color);
style_popup->set_shadow_size(4 * EDSCALE);
+ Ref<StyleBoxLine> style_popup_separator(memnew(StyleBoxLine));
+ style_popup_separator->set_color(separator_color);
+ style_popup_separator->set_grow(popup_margin_size - MAX(EDSCALE, border_width));
+ style_popup_separator->set_thickness(MAX(EDSCALE, border_width));
+
Ref<StyleBoxEmpty> style_empty = make_empty_stylebox(default_margin_size, default_margin_size, default_margin_size, default_margin_size);
// Tabs
- const int tab_default_margin_side = 10 * EDSCALE;
+
+ const int tab_default_margin_side = 10 * EDSCALE + extra_spacing * EDSCALE;
+ const int tab_default_margin_vertical = 5 * EDSCALE + extra_spacing * EDSCALE;
+
Ref<StyleBoxFlat> style_tab_selected = style_widget->duplicate();
+
style_tab_selected->set_border_width_all(border_width);
style_tab_selected->set_border_width(MARGIN_BOTTOM, 0);
style_tab_selected->set_border_color_all(dark_color_3);
style_tab_selected->set_expand_margin_size(MARGIN_BOTTOM, border_width);
style_tab_selected->set_default_margin(MARGIN_LEFT, tab_default_margin_side);
style_tab_selected->set_default_margin(MARGIN_RIGHT, tab_default_margin_side);
+ style_tab_selected->set_default_margin(MARGIN_BOTTOM, tab_default_margin_vertical);
+ style_tab_selected->set_default_margin(MARGIN_TOP, tab_default_margin_vertical);
style_tab_selected->set_bg_color(tab_color);
Ref<StyleBoxFlat> style_tab_unselected = style_tab_selected->duplicate();
- style_tab_unselected->set_bg_color(Color(0.0, 0.0, 0.0, 0.0));
- style_tab_unselected->set_border_color_all(Color(0.0, 0.0, 0.0, 0.0));
+ style_tab_unselected->set_draw_center(false);
+ style_tab_unselected->set_border_width_all(0);
// Editor background
theme->set_stylebox("Background", "EditorStyles", make_flat_stylebox(background_color, default_margin_size, default_margin_size, default_margin_size, default_margin_size));
@@ -420,11 +493,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("MenuPanel", "EditorStyles", style_menu);
// Script Editor
- theme->set_stylebox("ScriptEditorPanel", "EditorStyles", make_empty_stylebox(4, 0, 4, 4));
+ theme->set_stylebox("ScriptEditorPanel", "EditorStyles", make_empty_stylebox(default_margin_size, 0, default_margin_size, default_margin_size));
theme->set_stylebox("ScriptEditor", "EditorStyles", make_empty_stylebox(0, 0, 0, 0));
// Play button group
- theme->set_stylebox("PlayButtonPanel", "EditorStyles", style_empty); //make_stylebox(theme->get_icon("GuiPlayButtonGroup", "EditorIcons"), 16, 16, 16, 16, 8, 4, 8, 4));
+ theme->set_stylebox("PlayButtonPanel", "EditorStyles", style_empty);
//MenuButton
Ref<StyleBoxFlat> style_menu_hover_border = style_widget->duplicate();
@@ -491,7 +564,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("font_color_disabled", "OptionButton", font_color_disabled);
theme->set_color("icon_color_hover", "OptionButton", font_color_hl);
theme->set_icon("arrow", "OptionButton", theme->get_icon("GuiOptionArrow", "EditorIcons"));
- theme->set_constant("arrow_margin", "OptionButton", 4 * EDSCALE);
+ theme->set_constant("arrow_margin", "OptionButton", default_margin_size * EDSCALE);
theme->set_constant("modulate_arrow", "OptionButton", true);
// CheckButton
@@ -519,7 +592,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// PopupMenu
Ref<StyleBoxFlat> style_popup_menu = style_popup;
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)));
+ theme->set_stylebox("separator", "PopupMenu", style_popup_separator);
theme->set_color("font_color", "PopupMenu", font_color);
theme->set_color("font_color_hover", "PopupMenu", font_color_hl);
theme->set_color("font_color_accel", "PopupMenu", font_color_disabled);
@@ -528,27 +601,42 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_icon("unchecked", "PopupMenu", theme->get_icon("GuiUnchecked", "EditorIcons"));
theme->set_icon("radio_checked", "PopupMenu", theme->get_icon("GuiChecked", "EditorIcons"));
theme->set_icon("radio_unchecked", "PopupMenu", theme->get_icon("GuiUnchecked", "EditorIcons"));
+ theme->set_icon("submenu", "PopupMenu", theme->get_icon("ArrowRight", "EditorIcons"));
theme->set_constant("vseparation", "PopupMenu", (extra_spacing + default_margin_size) * EDSCALE);
+
// Tree & ItemList background
Ref<StyleBoxFlat> style_tree_bg = style_default->duplicate();
style_tree_bg->set_bg_color(dark_color_1);
style_tree_bg->set_border_color_all(dark_color_3);
theme->set_stylebox("bg", "Tree", style_tree_bg);
+ const Color guide_color = Color(mono_color.r, mono_color.g, mono_color.b, 0.05);
// Tree
theme->set_icon("checked", "Tree", theme->get_icon("GuiChecked", "EditorIcons"));
theme->set_icon("unchecked", "Tree", theme->get_icon("GuiUnchecked", "EditorIcons"));
theme->set_icon("arrow", "Tree", theme->get_icon("GuiTreeArrowDown", "EditorIcons"));
theme->set_icon("arrow_collapsed", "Tree", theme->get_icon("GuiTreeArrowRight", "EditorIcons"));
+ theme->set_icon("updown", "Tree", theme->get_icon("GuiTreeUpdown", "EditorIcons"));
theme->set_icon("select_arrow", "Tree", theme->get_icon("GuiDropdown", "EditorIcons"));
+ theme->set_icon("select_option", "Tree", theme->get_icon("GuiTreeOption", "EditorIcons"));
theme->set_stylebox("bg_focus", "Tree", style_focus);
theme->set_stylebox("custom_button", "Tree", make_empty_stylebox());
theme->set_stylebox("custom_button_pressed", "Tree", make_empty_stylebox());
theme->set_stylebox("custom_button_hover", "Tree", style_widget);
theme->set_color("custom_button_font_highlight", "Tree", font_color_hl);
theme->set_color("font_color", "Tree", font_color);
- theme->set_color("font_color_selected", "Tree", font_color);
+ theme->set_color("font_color_selected", "Tree", mono_color);
+ theme->set_color("title_button_color", "Tree", font_color);
+ theme->set_color("guide_color", "Tree", guide_color);
+ theme->set_color("drop_position_color", "Tree", accent_color);
theme->set_constant("vseparation", "Tree", (extra_spacing + default_margin_size) * EDSCALE);
+ theme->set_constant("hseparation", "Tree", (extra_spacing + default_margin_size) * EDSCALE);
+ theme->set_constant("guide_width", "Tree", border_width);
+ theme->set_constant("item_margin", "Tree", 3 * default_margin_size * EDSCALE);
+ theme->set_constant("button_margin", "Tree", default_margin_size * EDSCALE);
+ theme->set_constant("draw_relationship_lines", "Tree", 0);
+ theme->set_constant("scroll_border", "Tree", default_margin_size * EDSCALE);
+ theme->set_constant("scroll_speed", "Tree", 12);
Ref<StyleBoxFlat> style_tree_btn = style_default->duplicate();
style_tree_btn->set_bg_color(contrast_color_1);
@@ -601,8 +689,13 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("selected", "ItemList", style_tree_selected);
theme->set_stylebox("bg_focus", "ItemList", style_focus);
theme->set_stylebox("bg", "ItemList", style_itemlist_bg);
- theme->set_constant("vseparation", "ItemList", (extra_spacing + default_margin_size) * EDSCALE);
theme->set_color("font_color", "ItemList", font_color);
+ theme->set_color("font_color_selected", "ItemList", mono_color);
+ theme->set_color("guide_color", "ItemList", guide_color);
+ theme->set_constant("vseparation", "ItemList", 2 * EDSCALE);
+ theme->set_constant("hseparation", "ItemList", 2 * EDSCALE);
+ theme->set_constant("icon_margin", "ItemList", default_margin_size * EDSCALE);
+ theme->set_constant("line_separation", "ItemList", 2 * EDSCALE);
// Tabs & TabContainer
theme->set_stylebox("tab_fg", "TabContainer", style_tab_selected);
@@ -642,33 +735,22 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("panel", "TabContainer", style_content_panel);
theme->set_stylebox("Content", "EditorStyles", style_content_panel_vp);
- // Separators (no separators)
+ // Separators
theme->set_stylebox("separator", "HSeparator", make_line_stylebox(separator_color, border_width));
theme->set_stylebox("separator", "VSeparator", make_line_stylebox(separator_color, border_width, 0, true));
- // HACK Debuger panel
+ // Debugger
+
Ref<StyleBoxFlat> style_panel_debugger = style_content_panel->duplicate();
- const int v_offset = theme->get_font("font", "Tabs")->get_height() + style_tab_selected->get_minimum_size().height + default_margin_size * EDSCALE;
- style_panel_debugger->set_expand_margin_size(MARGIN_TOP, -v_offset);
- theme->set_stylebox("debugger_panel", "EditorStyles", style_panel_debugger);
+ style_panel_debugger->set_border_width(MARGIN_BOTTOM, 0);
+ theme->set_stylebox("DebuggerPanel", "EditorStyles", style_panel_debugger);
+ theme->set_stylebox("DebuggerTabFG", "EditorStyles", style_tab_selected);
+ theme->set_stylebox("DebuggerTabBG", "EditorStyles", style_tab_unselected);
- // Debugger
- Ref<StyleBoxFlat> style_debugger_contents = style_content_panel->duplicate();
- style_debugger_contents->set_default_margin(MARGIN_LEFT, 0);
- style_debugger_contents->set_default_margin(MARGIN_BOTTOM, 0);
- style_debugger_contents->set_default_margin(MARGIN_RIGHT, 0);
- style_debugger_contents->set_border_width_all(0);
- style_debugger_contents->set_expand_margin_size(MARGIN_TOP, -v_offset);
- theme->set_constant("extra_margin", "DebuggerPanel", default_margin_size * EDSCALE + border_width);
- theme->set_stylebox("DebuggerPanel", "EditorStyles", style_debugger_contents);
- Ref<StyleBoxFlat> style_tab_fg_debugger = style_tab_selected->duplicate();
- style_tab_fg_debugger->set_expand_margin_size(MARGIN_LEFT, default_margin_size * EDSCALE + border_width);
- style_tab_fg_debugger->set_default_margin(MARGIN_LEFT, tab_default_margin_side - default_margin_size * EDSCALE);
- theme->set_stylebox("DebuggerTabFG", "EditorStyles", style_tab_fg_debugger);
- Ref<StyleBoxFlat> style_tab_bg_debugger = style_tab_unselected->duplicate();
- style_tab_bg_debugger->set_expand_margin_size(MARGIN_LEFT, default_margin_size * EDSCALE + border_width);
- style_tab_bg_debugger->set_default_margin(MARGIN_LEFT, tab_default_margin_side - default_margin_size * EDSCALE);
- theme->set_stylebox("DebuggerTabBG", "EditorStyles", style_tab_bg_debugger);
+ Ref<StyleBoxFlat> style_panel_invisible_top = style_content_panel->duplicate();
+ int stylebox_offset = theme->get_font("tab_fg", "TabContainer")->get_height() + theme->get_stylebox("tab_fg", "TabContainer")->get_minimum_size().height + theme->get_stylebox("panel", "TabContainer")->get_default_margin(MARGIN_TOP);
+ style_panel_invisible_top->set_expand_margin_size(MARGIN_TOP, -stylebox_offset);
+ theme->set_stylebox("BottomPanelDebuggerOverride", "EditorStyles", style_panel_invisible_top);
// LineEdit
theme->set_stylebox("normal", "LineEdit", style_widget);
@@ -683,6 +765,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("focus", "TextEdit", style_widget_hover);
theme->set_constant("side_margin", "TabContainer", 0);
theme->set_icon("tab", "TextEdit", theme->get_icon("GuiTab", "EditorIcons"));
+ theme->set_color("font_color", "TextEdit", font_color);
+ theme->set_color("caret_color", "TextEdit", highlight_color);
// H/VSplitContainer
theme->set_stylebox("bg", "VSplitContainer", make_stylebox(theme->get_icon("GuiVsplitBg", "EditorIcons"), 1, 1, 1, 1));
@@ -765,34 +849,31 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("grabber_area", "VSlider", make_flat_stylebox(contrast_color_1, default_margin_size / 2, 0, default_margin_size / 2, 0));
//RichTextLabel
- Color rtl_combined_bg_color = dark_color_1.linear_interpolate(script_bg_color, script_bg_color.a);
- Color rtl_mono_color = (rtl_combined_bg_color.r + rtl_combined_bg_color.g + rtl_combined_bg_color.b > 1.5) ? Color(0, 0, 0) : Color(1, 1, 1);
- Color rtl_font_color = rtl_mono_color.linear_interpolate(rtl_combined_bg_color, 0.25);
- theme->set_color("default_color", "RichTextLabel", rtl_font_color);
+ theme->set_color("default_color", "RichTextLabel", font_color);
theme->set_stylebox("focus", "RichTextLabel", make_empty_stylebox());
theme->set_stylebox("normal", "RichTextLabel", style_tree_bg);
- Ref<StyleBoxFlat> style_code = style_tree_bg->duplicate();
- style_code->set_bg_color(rtl_combined_bg_color);
- theme->set_stylebox("code_normal", "RichTextLabel", style_code);
- Ref<StyleBoxFlat> style_code_focus = style_tree_focus->duplicate();
- style_code_focus->set_bg_color(rtl_combined_bg_color);
- theme->set_stylebox("code_focus", "RichTextLabel", style_code_focus);
- theme->set_color("font_color", "RichTextLabel", rtl_font_color);
- theme->set_color("highlight_color", "RichTextLabel", rtl_mono_color);
+ theme->set_color("headline_color", "EditorHelp", mono_color);
// Panel
theme->set_stylebox("panel", "Panel", make_flat_stylebox(dark_color_1, 6, 4, 6, 4));
// Label
+ theme->set_stylebox("normal", "Label", style_empty);
theme->set_color("font_color", "Label", font_color);
+ theme->set_color("font_color_shadow", "Label", Color(0, 0, 0, 0));
+ theme->set_constant("shadow_offset_x", "Label", 1 * EDSCALE);
+ theme->set_constant("shadow_offset_y", "Label", 1 * EDSCALE);
+ theme->set_constant("shadow_as_outline", "Label", 0 * EDSCALE);
+ theme->set_constant("line_spacing", "Label", 3 * EDSCALE);
// TooltipPanel
Ref<StyleBoxFlat> style_tooltip = style_popup->duplicate();
style_tooltip->set_bg_color(Color(mono_color.r, mono_color.g, mono_color.b, 0.9));
style_tooltip->set_border_width_all(border_width);
style_tooltip->set_border_color_all(mono_color);
- theme->set_color("font_color", "TooltipPanel", font_color);
+ theme->set_color("font_color", "TooltipLabel", font_color.inverted());
+ theme->set_color("font_color_shadow", "TooltipLabel", mono_color.inverted() * Color(1, 1, 1, 0.1));
theme->set_stylebox("panel", "TooltipPanel", style_tooltip);
// PopupPanel
@@ -819,21 +900,31 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// GraphNode
+ const float mv = dark_theme ? 0.0 : 1.0;
+ const float mv2 = 1.0 - mv;
const int gn_margin_side = 28;
- Ref<StyleBoxFlat> graphsb = make_flat_stylebox(Color(0, 0, 0, 0.3), gn_margin_side, 24, gn_margin_side, 5);
+ Ref<StyleBoxFlat> graphsb = make_flat_stylebox(Color(mv, mv, mv, 0.7), gn_margin_side, 24, gn_margin_side, 5);
graphsb->set_border_width_all(border_width);
- graphsb->set_border_color_all(Color(1, 1, 1, 0.9));
- Ref<StyleBoxFlat> graphsbselected = make_flat_stylebox(Color(0, 0, 0, 0.4), gn_margin_side, 24, gn_margin_side, 5);
+ graphsb->set_border_color_all(Color(mv2, mv2, mv2, 0.9));
+ Ref<StyleBoxFlat> graphsbselected = make_flat_stylebox(Color(mv, mv, mv, 0.9), gn_margin_side, 24, gn_margin_side, 5);
graphsbselected->set_border_width_all(border_width);
graphsbselected->set_border_color_all(Color(accent_color.r, accent_color.g, accent_color.b, 0.9));
graphsbselected->set_shadow_size(8 * EDSCALE);
graphsbselected->set_shadow_color(shadow_color);
- Ref<StyleBoxFlat> graphsbcomment = make_flat_stylebox(Color(0, 0, 0, 0.3), gn_margin_side, 24, gn_margin_side, 5);
+ Ref<StyleBoxFlat> graphsbcomment = make_flat_stylebox(Color(mv, mv, mv, 0.3), gn_margin_side, 24, gn_margin_side, 5);
graphsbcomment->set_border_width_all(border_width);
- graphsbcomment->set_border_color_all(Color(1, 1, 1, 0.9));
- Ref<StyleBoxFlat> graphsbcommentselected = make_flat_stylebox(Color(0, 0, 0, 0.4), gn_margin_side, 24, gn_margin_side, 5);
+ graphsbcomment->set_border_color_all(Color(mv2, mv2, mv2, 0.9));
+ Ref<StyleBoxFlat> graphsbcommentselected = make_flat_stylebox(Color(mv, mv, mv, 0.4), gn_margin_side, 24, gn_margin_side, 5);
graphsbcommentselected->set_border_width_all(border_width);
- graphsbcommentselected->set_border_color_all(Color(1, 1, 1, 0.9));
+ graphsbcommentselected->set_border_color_all(Color(mv2, mv2, mv2, 0.9));
+ Ref<StyleBoxFlat> graphsbbreakpoint = graphsbselected->duplicate();
+ graphsbbreakpoint->set_draw_center(false);
+ graphsbbreakpoint->set_border_color_all(warning_color);
+ graphsbbreakpoint->set_shadow_color(warning_color * Color(1.0, 1.0, 1.0, 0.1));
+ Ref<StyleBoxFlat> graphsbposition = graphsbselected->duplicate();
+ graphsbposition->set_draw_center(false);
+ graphsbposition->set_border_color_all(error_color);
+ graphsbposition->set_shadow_color(error_color * Color(1.0, 1.0, 1.0, 0.2));
if (use_gn_headers) {
graphsb->set_border_width(MARGIN_TOP, 24 * EDSCALE);
@@ -846,6 +937,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("selectedframe", "GraphNode", graphsbselected);
theme->set_stylebox("comment", "GraphNode", graphsbcomment);
theme->set_stylebox("commentfocus", "GraphNode", graphsbcommentselected);
+ theme->set_stylebox("breakpoint", "GraphNode", graphsbbreakpoint);
+ theme->set_stylebox("position", "GraphNode", graphsbposition);
theme->set_constant("port_offset", "GraphNode", 14 * EDSCALE);
theme->set_constant("title_h_offset", "GraphNode", -16 * EDSCALE);
theme->set_constant("close_h_offset", "GraphNode", 20 * EDSCALE);
@@ -858,8 +951,21 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_constant("vseperation", "GridContainer", (extra_spacing + default_margin_size) * EDSCALE);
// FileDialog
+ theme->set_icon("folder", "FileDialog", theme->get_icon("Folder", "EditorIcons"));
theme->set_color("files_disabled", "FileDialog", font_color_disabled);
+ // color picker
+ theme->set_constant("margin", "ColorPicker", popup_margin_size);
+ theme->set_constant("sv_width", "ColorPicker", 256 * EDSCALE);
+ theme->set_constant("sv_height", "ColorPicker", 256 * EDSCALE);
+ theme->set_constant("h_width", "ColorPicker", 30 * EDSCALE);
+ theme->set_constant("label_width", "ColorPicker", 10 * EDSCALE);
+ theme->set_icon("screen_picker", "ColorPicker", theme->get_icon("ColorPick", "EditorIcons"));
+ theme->set_icon("add_preset", "ColorPicker", theme->get_icon("Add", "EditorIcons"));
+ theme->set_icon("preset_bg", "ColorPicker", theme->get_icon("GuiMiniCheckerboard", "EditorIcons"));
+
+ theme->set_icon("bg", "ColorPickerButton", theme->get_icon("GuiMiniCheckerboard", "EditorIcons"));
+
// adaptive script theme constants
// for comments and elements with lower relevance
const Color dim_color = Color(font_color.r, font_color.g, font_color.b, 0.5);
@@ -945,7 +1051,7 @@ Ref<Theme> create_custom_theme() {
theme = ResourceLoader::load(custom_theme);
}
- String global_font = EditorSettings::get_singleton()->get("interface/custom_font");
+ String global_font = EditorSettings::get_singleton()->get("interface/editor/custom_font");
if (global_font != "") {
Ref<Font> fnt = ResourceLoader::load(global_font);
if (fnt.is_valid()) {
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp
index 147d5f90c6..d867404f3d 100644
--- a/editor/export_template_manager.cpp
+++ b/editor/export_template_manager.cpp
@@ -73,7 +73,7 @@ void ExportTemplateManager::_update_template_list() {
current_hb->add_child(current);
if (templates.has(current_version)) {
- current->add_color_override("font_color", Color(0.5, 1, 0.5));
+ current->add_color_override("font_color", get_color("success_color", "Editor"));
Button *redownload = memnew(Button);
redownload->set_text(TTR("Re-Download"));
current_hb->add_child(redownload);
@@ -86,7 +86,7 @@ void ExportTemplateManager::_update_template_list() {
uninstall->connect("pressed", this, "_uninstall_template", varray(current_version));
} else {
- current->add_color_override("font_color", Color(1.0, 0.5, 0.5));
+ current->add_color_override("font_color", get_color("error_color", "Editor"));
Button *redownload = memnew(Button);
redownload->set_text(TTR("Download"));
redownload->connect("pressed", this, "_download_template", varray(current_version));
@@ -98,7 +98,7 @@ void ExportTemplateManager::_update_template_list() {
HBoxContainer *hbc = memnew(HBoxContainer);
Label *version = memnew(Label);
- version->set_modulate(Color(1, 1, 1, 0.7));
+ version->set_modulate(get_color("disabled_font_color", "Editor"));
String text = E->get();
if (text == current_version) {
text += " " + TTR("(Current)");
@@ -299,7 +299,7 @@ void ExportTemplateManager::_install_from_file(const String &p_file) {
void ExportTemplateManager::popup_manager() {
_update_template_list();
- popup_centered_minsize(Size2(400, 600) * EDSCALE);
+ popup_centered_minsize(Size2(400, 400) * EDSCALE);
}
void ExportTemplateManager::ok_pressed() {
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 5f9f109a2e..a9d72607b4 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -1002,7 +1002,7 @@ void FileSystemDock::_file_option(int p_option) {
for (int i = 0; i < files->get_item_count(); i++) {
String path = files->get_item_metadata(i);
- if (path.ends_with("/") || !files->is_selected(i))
+ if (!files->is_selected(i))
continue;
torem.push_back(path);
}
@@ -1466,6 +1466,7 @@ void FileSystemDock::_files_list_rmb_select(int p_item, const Vector2 &p_pos) {
bool all_scenes = true;
bool all_can_reimport = true;
+ bool is_dir = false;
Set<String> types;
for (int i = 0; i < files->get_item_count(); i++) {
@@ -1481,8 +1482,7 @@ void FileSystemDock::_files_list_rmb_select(int p_item, const Vector2 &p_pos) {
}
if (path.ends_with("/")) {
- //no operate on dirs
- return;
+ is_dir = true;
}
int pos;
@@ -1513,17 +1513,19 @@ void FileSystemDock::_files_list_rmb_select(int p_item, const Vector2 &p_pos) {
file_options->add_separator();
- if (filenames.size() == 1) {
+ if (filenames.size() == 1 && !is_dir) {
file_options->add_item(TTR("Edit Dependencies.."), FILE_DEPENDENCIES);
file_options->add_item(TTR("View Owners.."), FILE_OWNERS);
file_options->add_separator();
}
- if (filenames.size() == 1) {
- file_options->add_item(TTR("Copy Path"), FILE_COPY_PATH);
- file_options->add_item(TTR("Rename or Move.."), FILE_MOVE);
- } else {
- file_options->add_item(TTR("Move To.."), FILE_MOVE);
+ if (!is_dir) {
+ if (filenames.size() == 1) {
+ file_options->add_item(TTR("Copy Path"), FILE_COPY_PATH);
+ file_options->add_item(TTR("Rename or Move.."), FILE_MOVE);
+ } else {
+ file_options->add_item(TTR("Move To.."), FILE_MOVE);
+ }
}
file_options->add_item(TTR("Delete"), FILE_REMOVE);
diff --git a/editor/icons/icon_2_d.svg b/editor/icons/icon_2_d.svg
index b77c330bff..dcc22a579e 100644
--- a/editor/icons/icon_2_d.svg
+++ b/editor/icons/icon_2_d.svg
@@ -1,5 +1,3 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1036.4)">
-<path transform="translate(0 1036.4)" d="m3.9844 1.002a1.0001 1.0001 0 0 0 -0.69141 0.29102l-2 2a1 1 0 0 0 0 1.4141 1 1 0 0 0 1.4141 0l0.29297-0.29297v8.5859h8.5859l-0.29297 0.29297a1 1 0 0 0 0 1.4141 1 1 0 0 0 1.4141 0l2-2a1.0001 1.0001 0 0 0 0 -1.4141l-2-2a1 1 0 0 0 -0.7207 -0.29102 1 1 0 0 0 -0.69336 0.29102 1 1 0 0 0 0 1.4141l0.29297 0.29297h-6.5859v-6.5859l0.29297 0.29297a1 1 0 0 0 1.4141 0 1 1 0 0 0 0 -1.4141l-2-2a1.0001 1.0001 0 0 0 -0.72266 -0.29102z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#e0e0e0" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="filter-blend-mode:normal;filter-gaussianBlur-deviation:0;font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
-</g>
+<path d="m3.9844 1.002a1.0001 1.0001 0 0 0 -0.69141 0.29102l-2 2a1 1 0 0 0 0 1.4141 1 1 0 0 0 1.4141 0l0.29297-0.29297v8.5859h8.5859l-0.29297 0.29297a1 1 0 0 0 0 1.4141 1 1 0 0 0 1.4141 0l2-2a1.0001 1.0001 0 0 0 0 -1.4141l-2-2a1 1 0 0 0 -0.7207 -0.29102 1 1 0 0 0 -0.69336 0.29102 1 1 0 0 0 0 1.4141l0.29297 0.29297h-6.5859v-6.5859l0.29297 0.29297a1 1 0 0 0 1.4141 0 1 1 0 0 0 0 -1.4141l-2-2a1.0001 1.0001 0 0 0 -0.72266 -0.29102z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#e0e0e0" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="filter-blend-mode:normal;filter-gaussianBlur-deviation:0;font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
</svg>
diff --git a/editor/icons/icon_3_d.svg b/editor/icons/icon_3_d.svg
index 91d3abf60d..2b89b0fbbe 100644
--- a/editor/icons/icon_3_d.svg
+++ b/editor/icons/icon_3_d.svg
@@ -1,5 +1,3 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1036.4)">
-<path transform="translate(0 1036.4)" d="m3.9902 1.002a1.0001 1.0001 0 0 0 -0.69141 0.29102l-2 2a1 1 0 0 0 0 1.4141 1 1 0 0 0 1.4141 0l0.29297-0.29297v8.5859h8.5859l-0.29297 0.29297a1 1 0 0 0 0 1.4141 1 1 0 0 0 1.4141 0l2-2a1.0001 1.0001 0 0 0 0 -1.4141l-2-2a1 1 0 0 0 -0.72266 -0.29102 1 1 0 0 0 -0.69141 0.29102 1 1 0 0 0 0 1.4141l0.29297 0.29297h-5.1719l5.5859-5.5859v0.41602a1 1 0 0 0 1 1 1 1 0 0 0 1 -1v-2.8301a1.0001 1.0001 0 0 0 -1 -1h-2.8301a1 1 0 0 0 -1 1 1 1 0 0 0 1 1h0.41602l-5.5859 5.5859v-5.1719l0.29297 0.29297a1 1 0 0 0 1.4141 0 1 1 0 0 0 0 -1.4141l-2-2a1.0001 1.0001 0 0 0 -0.72266 -0.29102z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#e0e0e0" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="filter-blend-mode:normal;filter-gaussianBlur-deviation:0;font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
-</g>
+<path d="m3.9902 1.002a1.0001 1.0001 0 0 0 -0.69141 0.29102l-2 2a1 1 0 0 0 0 1.4141 1 1 0 0 0 1.4141 0l0.29297-0.29297v8.5859h8.5859l-0.29297 0.29297a1 1 0 0 0 0 1.4141 1 1 0 0 0 1.4141 0l2-2a1.0001 1.0001 0 0 0 0 -1.4141l-2-2a1 1 0 0 0 -0.72266 -0.29102 1 1 0 0 0 -0.69141 0.29102 1 1 0 0 0 0 1.4141l0.29297 0.29297h-5.1719l5.5859-5.5859v0.41602a1 1 0 0 0 1 1 1 1 0 0 0 1 -1v-2.8301a1.0001 1.0001 0 0 0 -1 -1h-2.8301a1 1 0 0 0 -1 1 1 1 0 0 0 1 1h0.41602l-5.5859 5.5859v-5.1719l0.29297 0.29297a1 1 0 0 0 1.4141 0 1 1 0 0 0 0 -1.4141l-2-2a1.0001 1.0001 0 0 0 -0.72266 -0.29102z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#e0e0e0" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="filter-blend-mode:normal;filter-gaussianBlur-deviation:0;font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
</svg>
diff --git a/editor/icons/icon_GUI_dropdown.svg b/editor/icons/icon_GUI_dropdown.svg
index 22db0fa1a7..4aa800b470 100644
--- a/editor/icons/icon_GUI_dropdown.svg
+++ b/editor/icons/icon_GUI_dropdown.svg
@@ -1,7 +1,5 @@
<svg width="14" height="14" version="1.1" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1038.4)" fill="#fff" fill-opacity=".58824" stroke-linejoin="round" stroke-opacity=".39216" stroke-width="2">
-<circle cx="7.5" cy="1040.9" r="1.5"/>
-<circle cx="7.5" cy="1045.9" r="1.5"/>
-<circle cx="7.5" cy="1050.9" r="1.5"/>
+<g transform="translate(0 -1038.4)">
+<path d="m4 1045.4 3 3 3-3" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".58824" stroke-width="2"/>
</g>
</svg>
diff --git a/editor/icons/icon_GUI_h_tick.svg b/editor/icons/icon_GUI_h_tick.svg
new file mode 100644
index 0000000000..5aa799deb0
--- /dev/null
+++ b/editor/icons/icon_GUI_h_tick.svg
@@ -0,0 +1,3 @@
+<svg width="4" height="16" version="1.1" viewBox="0 0 4 15.999999" xmlns="http://www.w3.org/2000/svg">
+<circle cx="2" cy="2" r="1" fill="#fff" fill-opacity=".39216"/>
+</svg>
diff --git a/editor/icons/icon_mini_checkerboard.svg b/editor/icons/icon_GUI_mini_checkerboard.svg
index e740113b2d..e740113b2d 100644
--- a/editor/icons/icon_mini_checkerboard.svg
+++ b/editor/icons/icon_GUI_mini_checkerboard.svg
diff --git a/editor/icons/icon_GUI_mini_tab_menu.svg b/editor/icons/icon_GUI_mini_tab_menu.svg
index c54eb26115..8aeb85277c 100644
--- a/editor/icons/icon_GUI_mini_tab_menu.svg
+++ b/editor/icons/icon_GUI_mini_tab_menu.svg
@@ -1,7 +1,5 @@
<svg width="6" height="16" version="1.1" viewBox="0 0 6 16" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1036.4)" fill="#fff" fill-opacity=".39216">
-<circle cx="3" cy="1038.4" r="2"/>
-<circle cx="3" cy="1044.4" r="2"/>
-<circle cx="3" cy="1050.4" r="2"/>
+<g transform="translate(0 -1036.4)">
+<path transform="translate(0 1036.4)" d="m3 0a2 2 0 0 0 -2 2 2 2 0 0 0 2 2 2 2 0 0 0 2 -2 2 2 0 0 0 -2 -2zm0 6a2 2 0 0 0 -2 2 2 2 0 0 0 2 2 2 2 0 0 0 2 -2 2 2 0 0 0 -2 -2zm0 6a2 2 0 0 0 -2 2 2 2 0 0 0 2 2 2 2 0 0 0 2 -2 2 2 0 0 0 -2 -2z" fill="#fff" fill-opacity=".39216"/>
</g>
</svg>
diff --git a/editor/icons/icon_GUI_tab_menu.svg b/editor/icons/icon_GUI_tab_menu.svg
index 3324adf98b..9284e7488b 100644
--- a/editor/icons/icon_GUI_tab_menu.svg
+++ b/editor/icons/icon_GUI_tab_menu.svg
@@ -1,7 +1,5 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1036.4)" fill="#fff" fill-opacity=".39216">
-<circle cx="8" cy="1038.4" r="2"/>
-<circle cx="8" cy="1044.4" r="2"/>
-<circle cx="8" cy="1050.4" r="2"/>
+<g transform="translate(0 -1036.4)">
+<path transform="translate(0 1036.4)" d="m8 0a2 2 0 0 0 -2 2 2 2 0 0 0 2 2 2 2 0 0 0 2 -2 2 2 0 0 0 -2 -2zm0 6a2 2 0 0 0 -2 2 2 2 0 0 0 2 2 2 2 0 0 0 2 -2 2 2 0 0 0 -2 -2zm0 6a2 2 0 0 0 -2 2 2 2 0 0 0 2 2 2 2 0 0 0 2 -2 2 2 0 0 0 -2 -2z" fill="#fff" fill-opacity=".39216"/>
</g>
</svg>
diff --git a/editor/icons/icon_GUI_tree_option.svg b/editor/icons/icon_GUI_tree_option.svg
new file mode 100644
index 0000000000..4200745a78
--- /dev/null
+++ b/editor/icons/icon_GUI_tree_option.svg
@@ -0,0 +1,5 @@
+<svg width="14" height="14" version="1.1" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg">
+<g transform="translate(0 -1038.4)">
+<path transform="translate(0 1038.4)" d="m7.5 1a1.5 1.5 0 0 0 -1.5 1.5 1.5 1.5 0 0 0 1.5 1.5 1.5 1.5 0 0 0 1.5 -1.5 1.5 1.5 0 0 0 -1.5 -1.5zm0 5a1.5 1.5 0 0 0 -1.5 1.5 1.5 1.5 0 0 0 1.5 1.5 1.5 1.5 0 0 0 1.5 -1.5 1.5 1.5 0 0 0 -1.5 -1.5zm0 5a1.5 1.5 0 0 0 -1.5 1.5 1.5 1.5 0 0 0 1.5 1.5 1.5 1.5 0 0 0 1.5 -1.5 1.5 1.5 0 0 0 -1.5 -1.5z" fill="#fff" fill-opacity=".58824" stroke-linejoin="round" stroke-opacity=".39216" stroke-width="2"/>
+</g>
+</svg>
diff --git a/editor/icons/icon_GUI_tree_updown.svg b/editor/icons/icon_GUI_tree_updown.svg
new file mode 100644
index 0000000000..cdcd6c2441
--- /dev/null
+++ b/editor/icons/icon_GUI_tree_updown.svg
@@ -0,0 +1,5 @@
+<svg width="14" height="14" version="1.1" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg">
+<g transform="translate(0 -1038.4)">
+<path transform="translate(0 1038.4)" d="m6.9844 1.002a1.0001 1.0001 0 0 0 -0.69141 0.29102l-3 3a1 1 0 0 0 0 1.4141 1 1 0 0 0 1.4141 0l2.293-2.293 2.293 2.293a1 1 0 0 0 1.4141 0 1 1 0 0 0 0 -1.4141l-3-3a1.0001 1.0001 0 0 0 -0.72266 -0.29102zm3 6.998a1 1 0 0 0 -0.69141 0.29297l-2.293 2.293-2.293-2.293a1 1 0 0 0 -0.7207 -0.29102 1 1 0 0 0 -0.69336 0.29102 1 1 0 0 0 0 1.4141l3 3a1.0001 1.0001 0 0 0 1.4141 0l3-3a1 1 0 0 0 0 -1.4141 1 1 0 0 0 -0.72266 -0.29297z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#fff" fill-opacity=".58824" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="filter-blend-mode:normal;filter-gaussianBlur-deviation:0;font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
+</g>
+</svg>
diff --git a/editor/icons/icon_GUI_v_tick.svg b/editor/icons/icon_GUI_v_tick.svg
new file mode 100644
index 0000000000..87b5656927
--- /dev/null
+++ b/editor/icons/icon_GUI_v_tick.svg
@@ -0,0 +1,5 @@
+<svg width="16" height="4" version="1.1" viewBox="0 0 16 3.9999998" xmlns="http://www.w3.org/2000/svg">
+<g transform="translate(0,-12)">
+<circle cx="2" cy="14" r="1" fill="#fff" fill-opacity=".39216"/>
+</g>
+</svg>
diff --git a/editor/icons/icon_accept_dialog.svg b/editor/icons/icon_accept_dialog.svg
index 331b88dd74..b65f58b35e 100644
--- a/editor/icons/icon_accept_dialog.svg
+++ b/editor/icons/icon_accept_dialog.svg
@@ -1,5 +1,3 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1036.4)">
-<path transform="translate(0 1036.4)" d="m3 1c-1.1046 0-2 0.8954-2 2v1h14v-1c0-1.1046-0.89543-2-2-2zm9 1h1v1h-1zm-11 3v8c0 1.1046 0.89543 2 2 2h10c1.1046 0 2-0.8954 2-2v-8zm9.4746 1.6367 1.4141 1.4141-4.9492 4.9492-2.8281-2.8281 1.4141-1.4141 1.4141 1.4141z" fill="#a5efac"/>
-</g>
+<path d="m3 1c-1.1046 0-2 0.8954-2 2v1h14v-1c0-1.1046-0.89543-2-2-2zm9 1h1v1h-1zm-11 3v8c0 1.1046 0.89543 2 2 2h10c1.1046 0 2-0.8954 2-2v-8zm9.4746 1.6367 1.4141 1.4141-4.9492 4.9492-2.8281-2.8281 1.4141-1.4141 1.4141 1.4141z" fill="#a5efac"/>
</svg>
diff --git a/editor/icons/icon_add.svg b/editor/icons/icon_add.svg
index 685e6e82e8..3b7e9b8fc1 100644
--- a/editor/icons/icon_add.svg
+++ b/editor/icons/icon_add.svg
@@ -1,5 +1,3 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1036.4)">
-<path transform="translate(0 1036.4)" d="m7 1v6h-6v2h6v6h2v-6h6v-2h-6v-6h-2z" fill="#e0e0e0"/>
-</g>
+<path d="m7 1v6h-6v2h6v6h2v-6h6v-2h-6v-6h-2z" fill="#e0e0e0"/>
</svg>
diff --git a/editor/icons/icon_audio_bus_bypass.svg b/editor/icons/icon_audio_bus_bypass.svg
index 75c1caf7f1..f85c9d17b5 100644
--- a/editor/icons/icon_audio_bus_bypass.svg
+++ b/editor/icons/icon_audio_bus_bypass.svg
@@ -1,5 +1,5 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 -1036.4)">
-<path transform="translate(0 1036.4)" d="m6.9707 2c-0.25474 0.01-0.49715 0.11122-0.67773 0.29102l-2.707 2.707h-1.5859c-0.55226 1e-4 -0.99994 0.4477-1 1v4c5.52e-5 0.5523 0.44774 0.9999 1 1h1.5859l2.707 2.707c0.63002 0.6296 1.7067 0.18367 1.707-0.70703v-10c-9.424e-4 -0.5631-0.46642-1.0144-1.0293-0.99805zm3.0293 5v1 1h4v-1-1h-4z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#e0e0e0" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
+<path transform="translate(0 1036.4)" d="m5 3c-0.55226 5.52e-5 -0.99994 0.44774-1 1v8c5.52e-5 0.55226 0.44774 0.99994 1 1h4c1.0702 0 2.0645-0.5732 2.5996-1.5 0.5351-0.9268 0.5351-2.0732 0-3-0.40058-0.69381-1.058-1.1892-1.8125-1.3945 0.33452-0.84425 0.27204-1.8062-0.18945-2.6055-0.5351-0.9268-1.5275-1.5-2.5977-1.5zm1 2h1c0.35887 0 0.6858 0.1892 0.86523 0.5s0.17943 0.6892 0 1-0.50637 0.5-0.86523 0.5h-1zm0 4h1 2c0.35887 0 0.68775 0.1892 0.86719 0.5 0.17943 0.3108 0.17943 0.6892 0 1-0.17944 0.3108-0.50832 0.5-0.86719 0.5h-3z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#e0e0e0" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
</g>
</svg>
diff --git a/editor/icons/icon_audio_bus_mute.svg b/editor/icons/icon_audio_bus_mute.svg
index a7d085d535..cacca295eb 100644
--- a/editor/icons/icon_audio_bus_mute.svg
+++ b/editor/icons/icon_audio_bus_mute.svg
@@ -1,5 +1,5 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 -1036.4)">
-<path transform="translate(0 1036.4)" d="m6.9707 2c-0.25474 0.01-0.49715 0.11122-0.67773 0.29102l-2.707 2.707h-1.5859c-0.55226 1e-4 -0.99994 0.4477-1 1v4c5.52e-5 0.5523 0.44774 0.9999 1 1h1.5859l2.707 2.707c0.63002 0.6296 1.7067 0.18367 1.707-0.70703v-10c-9.424e-4 -0.5631-0.46642-1.0144-1.0293-0.99805zm4.0195 2.9902a1.0001 1.0001 0 0 0 -0.69726 1.7168l1.293 1.293-1.293 1.293a1.0001 1.0001 0 1 0 1.4141 1.4141l1.293-1.293 1.293 1.293a1.0001 1.0001 0 1 0 1.4141 -1.4141l-1.293-1.293 1.293-1.293a1.0001 1.0001 0 0 0 -0.72656 -1.7148 1.0001 1.0001 0 0 0 -0.6875 0.30078l-1.293 1.293-1.293-1.293a1.0001 1.0001 0 0 0 -0.7168 -0.30273z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#e0e0e0" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
+<path d="m4 1048.4v-8l4 5 4-5v8" fill="none" stroke="#e0e0e0" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
</g>
</svg>
diff --git a/editor/icons/icon_audio_bus_solo.svg b/editor/icons/icon_audio_bus_solo.svg
index e84c1cca25..25e26d6038 100644
--- a/editor/icons/icon_audio_bus_solo.svg
+++ b/editor/icons/icon_audio_bus_solo.svg
@@ -1,5 +1,5 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 -1036.4)">
-<path transform="translate(0 1036.4)" d="m6.9707 2c-0.25474 0.01-0.49715 0.11122-0.67773 0.29102l-2.707 2.707h-1.5859c-0.55226 1e-4 -0.99994 0.4477-1 1v4c5.52e-5 0.5523 0.44774 0.9999 1 1h1.5859l2.707 2.707c0.63002 0.6296 1.7067 0.18367 1.707-0.70703v-10c-9.424e-4 -0.5631-0.46642-1.0144-1.0293-0.99805zm8.0293 2a3 3 0 0 0 -3 3v2a1 1 0 0 1 -1 1h-1v2h1a3 3 0 0 0 3 -3v-2a1 1 0 0 1 1 -1h1v-2h-1z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#e0e0e0" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
+<path transform="translate(0 1036.4)" d="m7 3a1 1 0 0 0 -0.12695 0.0078125c-1.0208 0.043703-1.957 0.60248-2.4707 1.4922-0.5351 0.9268-0.5351 2.0732 0 3 0.5351 0.9268 1.5275 1.5 2.5977 1.5h2c0.35887 0 0.6858 0.1892 0.86523 0.5 0.17943 0.3108 0.17943 0.6892 0 1-0.17943 0.3108-0.50637 0.5-0.86523 0.5h-3a1 1 0 0 0 -1 1 1 1 0 0 0 1 1h3c1.0702 0 2.0626-0.5732 2.5977-1.5s0.5351-2.0732 0-3-1.5275-1.5-2.5977-1.5h-2c-0.35887 0-0.6858-0.1892-0.86523-0.5s-0.17943-0.6892 0-1 0.50637-0.5 0.86523-0.5h3a1 1 0 0 0 1 -1 1 1 0 0 0 -1 -1h-3z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#e0e0e0" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="filter-blend-mode:normal;filter-gaussianBlur-deviation:0;font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
</g>
</svg>
diff --git a/editor/icons/icon_connect.svg b/editor/icons/icon_connect.svg
index 43ec84646c..97859370b7 100644
--- a/editor/icons/icon_connect.svg
+++ b/editor/icons/icon_connect.svg
@@ -1,7 +1,5 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 -1036.4)">
-<circle cx="4" cy="1048.4" r="2" fill="#e0e0e0"/>
-<path d="m4 1043.4a5 5 0 0 1 5 5" fill="none" stroke="#e0e0e0" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
-<path d="m4 1039.4a9 9 0 0 1 9 9" fill="none" stroke="#e0e0e0" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
+<path transform="translate(0 1036.4)" d="m4 2a1 1 0 0 0 -1 1 1 1 0 0 0 1 1c4.4301 0 8 3.5699 8 8a1 1 0 0 0 1 1 1 1 0 0 0 1 -1c0-5.511-4.489-10-10-10zm0 4a1 1 0 0 0 -1 1 1 1 0 0 0 1 1c2.221 0 4 1.779 4 4a1 1 0 0 0 1 1 1 1 0 0 0 1 -1c0-3.3018-2.6981-6-6-6zm0 4a2 2 0 0 0 -2 2 2 2 0 0 0 2 2 2 2 0 0 0 2 -2 2 2 0 0 0 -2 -2z" fill="#e0e0e0"/>
</g>
</svg>
diff --git a/editor/icons/icon_editor_3d_handle.svg b/editor/icons/icon_editor_3d_handle.svg
index 189baf3dad..cd28f8d22e 100644
--- a/editor/icons/icon_editor_3d_handle.svg
+++ b/editor/icons/icon_editor_3d_handle.svg
@@ -1,5 +1,6 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 -1036.4)">
+<circle cx="8" cy="1044.4" r="8" fill-opacity=".29412"/>
<circle cx="8" cy="1044.4" r="7" fill="#fff"/>
<circle cx="8" cy="1044.4" r="5" fill="#ff8484"/>
</g>
diff --git a/editor/icons/icon_editor_control_anchor.svg b/editor/icons/icon_editor_control_anchor.svg
index eeee2c182f..5e75f9bdf5 100644
--- a/editor/icons/icon_editor_control_anchor.svg
+++ b/editor/icons/icon_editor_control_anchor.svg
@@ -1,8 +1,8 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 -1036.4)">
-<path transform="translate(0 1036.4)" d="m8.832 6.1445a4 4 0 0 1 -2.6914 2.6855l9.8594 7.1699-7.168-9.8555z" fill="#a5efac" fill-rule="evenodd"/>
+<path transform="translate(0 1036.4)" d="m5 0a5 5 0 0 0 -5 5 5 5 0 0 0 5 5 5 5 0 0 0 1.0566 -0.11914l9.9434 6.1191-6.1172-9.9395a5 5 0 0 0 0.11719 -1.0605 5 5 0 0 0 -5 -5z" fill-opacity=".39216" style="paint-order:fill markers stroke"/>
+<path transform="translate(0 1036.4)" d="m5 1a4 4 0 0 0 -4 4 4 4 0 0 0 4 4 4 4 0 0 0 1.1406 -0.16992l9.8594 7.1699-7.168-9.8555a4 4 0 0 0 0.16797 -1.1445 4 4 0 0 0 -4 -4z" fill="#a5efac" fill-rule="evenodd"/>
<ellipse cx="3" cy="1039.4" r="2" fill="#6e6e6e"/>
-<ellipse cx="4" cy="1040.4" rx="4" ry="4" fill="#a5efac" style="paint-order:fill markers stroke"/>
<circle cx="5" cy="1041.4" r="0" fill="#a5efac" style="paint-order:fill markers stroke"/>
</g>
</svg>
diff --git a/editor/icons/icon_editor_handle.svg b/editor/icons/icon_editor_handle.svg
index 7e58aaa803..05f3e2f2cc 100644
--- a/editor/icons/icon_editor_handle.svg
+++ b/editor/icons/icon_editor_handle.svg
@@ -1,6 +1,7 @@
-<svg width="8" height="8" version="1.1" viewBox="0 0 8 8" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1044.4)">
-<ellipse cx="4" cy="1048.4" rx="4" ry="4" fill="#fff"/>
-<ellipse cx="4" cy="1048.4" rx="2.8572" ry="2.8571" fill="#ff8484"/>
+<svg width="10" height="10" version="1.1" viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg">
+<g transform="translate(0 -1042.4)">
+<ellipse cx="5" cy="1047.4" rx="5" ry="5" fill-opacity=".29412"/>
+<ellipse cx="5" cy="1047.4" rx="4" ry="4" fill="#fff"/>
+<ellipse cx="5" cy="1047.4" rx="3" ry="3" fill="#ff8484"/>
</g>
</svg>
diff --git a/editor/icons/icon_editor_pivot.svg b/editor/icons/icon_editor_pivot.svg
index d59d2d804d..8b8d07c7de 100644
--- a/editor/icons/icon_editor_pivot.svg
+++ b/editor/icons/icon_editor_pivot.svg
@@ -1,6 +1,6 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 -1036.4)">
<path transform="translate(0 1036.4)" d="m6 0v6h-6v4h6v6h4v-6h6v-4h-6v-6h-4zm1 7h2v2h-2v-2z" fill="#fff" fill-opacity=".70588"/>
-<path transform="translate(0 1036.4)" d="m7 1v5h2v-5h-2zm-6 6v2h5v-2h-5zm9 0v2h5v-2h-5zm-3 3v5h2v-5h-2z" fill="#ff8484" fill-opacity=".58824"/>
+<path transform="translate(0 1036.4)" d="m7 1v5h2v-5h-2zm-6 6v2h5v-2h-5zm9 0v2h5v-2h-5zm-3 3v5h2v-5h-2z" fill="#ff8484"/>
</g>
</svg>
diff --git a/editor/icons/icon_gizmo_camera.svg b/editor/icons/icon_gizmo_camera.svg
index f6e5f885e7..cb80c16598 100644
--- a/editor/icons/icon_gizmo_camera.svg
+++ b/editor/icons/icon_gizmo_camera.svg
@@ -1,5 +1,6 @@
<svg width="128" height="128" version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 -924.36)">
+<path transform="translate(0 924.36)" d="m76 16a28 28 0 0 0 -26.631 19.4 28 28 0 0 0 -13.369 -3.4004 28 28 0 0 0 -28 28 28 28 0 0 0 16 25.26v14.74c0 6.648 5.352 12 12 12h48c6.648 0 12-5.352 12-12l24 16v-64l-24 16v-4.4434a28 28 0 0 0 8 -19.557 28 28 0 0 0 -28 -28z" fill-opacity=".29412" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".98824" stroke-width="2"/>
<path d="m76 944.36a24 24 0 0 0 -23.906 22.219 24 24 0 0 0 -16.094 -6.2192 24 24 0 0 0 -24 24 24 24 0 0 0 16 22.594v17.406c0 4.432 3.5679 8 8 8h48c4.4321 0 8-3.568 8-8v-8l24 16v-48l-24 16v-14.156a24 24 0 0 0 8 -17.844 24 24 0 0 0 -24 -24z" fill="#f7f5cf"/>
</g>
</svg>
diff --git a/editor/icons/icon_gizmo_directional_light.svg b/editor/icons/icon_gizmo_directional_light.svg
index f7fa732501..1b125b44de 100644
--- a/editor/icons/icon_gizmo_directional_light.svg
+++ b/editor/icons/icon_gizmo_directional_light.svg
@@ -1,5 +1,6 @@
<svg width="128" height="128" version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 -924.36)">
+<path transform="translate(0 924.36)" d="m64 4c-4.432 0-8 3.568-8 8v16c0 4.432 3.568 8 8 8s8-3.568 8-8v-16c0-4.432-3.568-8-8-8zm-36.77 15.223c-2.045 0-4.0893 0.78461-5.6562 2.3516-3.1339 3.1339-3.1339 8.1786 0 11.312l11.312 11.314c3.1339 3.1339 8.1806 3.1339 11.314 0s3.1339-8.1806 0-11.314l-11.314-11.312c-1.5669-1.5669-3.6113-2.3516-5.6562-2.3516zm73.539 0c-2.045 0-4.0893 0.78461-5.6562 2.3516l-11.314 11.312c-3.1339 3.1339-3.1339 8.1806 0 11.314s8.1806 3.1339 11.314 0l11.312-11.314c3.1339-3.1339 3.1339-8.1786 0-11.312-1.567-1.5669-3.6113-2.3516-5.6562-2.3516zm-36.77 20.777a24 24 0 0 0 -24 24 24 24 0 0 0 24 24 24 24 0 0 0 24 -24 24 24 0 0 0 -24 -24zm-52 16c-4.432 0-8 3.568-8 8s3.568 8 8 8h16c4.432 0 8-3.568 8-8s-3.568-8-8-8h-16zm88 0c-4.432 0-8 3.568-8 8s3.568 8 8 8h16c4.432 0 8-3.568 8-8s-3.568-8-8-8h-16zm-61.455 25.449c-2.045 0-4.0913 0.78266-5.6582 2.3496l-11.312 11.314c-3.1339 3.1339-3.1339 8.1786 0 11.312 3.1339 3.1339 8.1786 3.1339 11.312 0l11.314-11.312c3.1339-3.1339 3.1339-8.1806 0-11.314-1.5669-1.5669-3.6113-2.3496-5.6562-2.3496zm50.91 0c-2.045 0-4.0893 0.78266-5.6562 2.3496-3.1339 3.1339-3.1339 8.1806 0 11.314l11.314 11.312c3.1339 3.1339 8.1786 3.1339 11.312 0s3.1339-8.1786 0-11.312l-11.312-11.314c-1.5669-1.5669-3.6132-2.3496-5.6582-2.3496zm-25.455 10.551c-4.432 0-8 3.568-8 8v16c0 4.432 3.568 8 8 8s8-3.568 8-8v-16c0-4.432-3.568-8-8-8z" fill-opacity=".29412" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".98824" stroke-width="2"/>
<path transform="translate(0 924.36)" d="m64 8c-2.216 0-4 1.784-4 4v16c0 2.216 1.784 4 4 4s4-1.784 4-4v-16c0-2.216-1.784-4-4-4zm-36.77 15.227c-1.0225 0-2.0447 0.39231-2.8281 1.1758-1.5669 1.5669-1.5669 4.0893 0 5.6562l11.312 11.314c1.5669 1.5669 4.0913 1.5669 5.6582 0s1.5669-4.0913 0-5.6582l-11.314-11.312c-0.78348-0.78348-1.8056-1.1758-2.8281-1.1758zm73.539 0c-1.0225 0-2.0446 0.39231-2.8281 1.1758l-11.314 11.312c-1.5669 1.5669-1.5669 4.0913 0 5.6582s4.0913 1.5669 5.6582 0l11.313-11.314c1.5669-1.5669 1.5669-4.0893 0-5.6562-0.78348-0.78348-1.8056-1.1758-2.8281-1.1758zm-36.77 20.773c-11.046 1e-5 -20 8.9543-20 20 7e-6 11.046 8.9543 20 20 20s20-8.9543 20-20c-8e-6 -11.046-8.9543-20-20-20zm-52 16c-2.216 0-4 1.784-4 4s1.784 4 4 4h16c2.216 0 4-1.784 4-4s-1.784-4-4-4h-16zm88 0c-2.216 0-4 1.784-4 4s1.784 4 4 4h16c2.216 0 4-1.784 4-4s-1.784-4-4-4h-16zm-61.455 25.453c-1.0225 0-2.0466 0.39035-2.8301 1.1738l-11.312 11.314c-1.5669 1.5669-1.5669 4.0893 0 5.6563 1.5669 1.5669 4.0893 1.5669 5.6562 0l11.314-11.313c1.5669-1.5669 1.5669-4.0913 0-5.6582-0.78347-0.78347-1.8056-1.1738-2.8281-1.1738zm50.91 0c-1.0225 0-2.0447 0.39035-2.8281 1.1738-1.5669 1.5669-1.5669 4.0913 0 5.6582l11.314 11.313c1.5669 1.5669 4.0893 1.5669 5.6563 0 1.5669-1.567 1.5669-4.0893 0-5.6563l-11.313-11.314c-0.78347-0.78347-1.8076-1.1738-2.8301-1.1738zm-25.455 10.547c-2.216 0-4 1.784-4 4v16c0 2.216 1.784 4 4 4s4-1.784 4-4v-16c0-2.216-1.784-4-4-4z" fill="#f7f5cf"/>
</g>
</svg>
diff --git a/editor/icons/icon_gizmo_g_i_probe.svg b/editor/icons/icon_gizmo_g_i_probe.svg
index 7d3adf4196..815da4d5c3 100644
--- a/editor/icons/icon_gizmo_g_i_probe.svg
+++ b/editor/icons/icon_gizmo_g_i_probe.svg
@@ -1,5 +1,6 @@
<svg width="128" height="128" version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 -924.36)">
-<path transform="translate(0 924.36)" d="m12 8a4.0004 4.0004 0 0 0 -4 4v104a4.0004 4.0004 0 0 0 4 4h60v-8h-56v-96h96v8h8v-12a4.0004 4.0004 0 0 0 -4 -4h-104zm27.715 17.951c-1.2324 0.086154-2.3996 0.76492-3.0664 1.9199l-0.14844 0.25781c-1.0669 1.848-0.43784 4.1948 1.4102 5.2617l10.648 6.1484c1.848 1.0669 4.1948 0.43784 5.2617-1.4102l0.14844-0.25781c1.0669-1.848 0.43784-4.1948-1.4102-5.2617l-10.648-6.1484c-0.693-0.4001-1.4558-0.56146-2.1953-0.50977zm52.285 2.0488a32 32 0 0 0 -32 32 32 32 0 0 0 16 27.668v8.332c0 4.432 3.568 8 8 8h16c4.432 0 8-3.568 8-8v-8.3223a32 32 0 0 0 16 -27.678 32 32 0 0 0 -32 -32zm0 12a20 20 0 0 1 20 20 20 20 0 0 1 -20 20 20 20 0 0 1 -20 -20 20 20 0 0 1 20 -20zm-60.148 16c-2.1339 0-3.8516 1.7177-3.8516 3.8516v0.29688c0 2.1339 1.7177 3.8516 3.8516 3.8516h12.297c2.1339 0 3.8516-1.7177 3.8516-3.8516v-0.29688c0-2.1339-1.7177-3.8516-3.8516-3.8516h-12.297zm18.902 23.951c-0.73947-0.051693-1.5023 0.10966-2.1953 0.50977l-10.648 6.1484c-1.848 1.0669-2.4771 3.4137-1.4102 5.2617l0.14844 0.25781c1.0669 1.848 3.4137 2.4771 5.2617 1.4102l10.648-6.1484c1.848-1.0669 2.4771-3.4137 1.4102-5.2617l-0.14844-0.25781c-0.66684-1.155-1.834-1.8338-3.0664-1.9199zm33.246 32.049v8h16v-8h-16z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#f7f5cf" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="filter-blend-mode:normal;filter-gaussianBlur-deviation:0;font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
+<path transform="translate(0 924.36)" d="m12 4c-4.4183 9.5e-6 -8 3.5817-8 8v104c9.5e-6 4.4183 3.5817 8 8 8h64v-16h-56v-88h88v7.7676a36 36 0 0 0 -16 -3.7676 36 36 0 0 0 -36 36 36 36 0 0 0 16 29.9v8.0996c0 4.8544 3.4253 8.8788 8 9.8008v16.199h24v-16.199c4.5747-0.92197 8-4.9464 8-9.8008v-8.0879a36 36 0 0 0 16 -29.912 36 36 0 0 0 -19.523 -32h15.523v-16c-1e-5 -4.4183-3.5817-8-8-8h-104zm28.25 17.996c-2.8358-0.076599-5.6171 1.3651-7.1406 4.0039-2.216 3.8382-0.90854 8.7117 2.9297 10.928l10.393 6c3.8382 2.216 8.7117 0.91049 10.928-2.9277s0.91049-8.7117-2.9277-10.928l-10.393-6c-1.1994-0.6925-2.5-1.0414-3.7891-1.0762zm51.75 22.004a16 16 0 0 1 16 16 16 16 0 0 1 -16 16 16 16 0 0 1 -16 -16 16 16 0 0 1 16 -16zm-60 8c-4.432 0-8 3.568-8 8s3.568 8 8 8h12c4.432 0 8-3.568 8-8s-3.568-8-8-8h-12zm18.221 23.996c-1.289 0.034818-2.5896 0.38367-3.7891 1.0762l-10.393 6c-3.8382 2.216-5.1457 7.0895-2.9297 10.928s7.0915 5.1437 10.93 2.9277l10.393-6c3.8382-2.216 5.1437-7.0895 2.9277-10.928-1.5235-2.6388-4.3028-4.0805-7.1387-4.0039z" fill-opacity=".29412"/>
+<path transform="translate(0 924.36)" d="m12 8a4.0004 4.0004 0 0 0 -4 4v104a4.0004 4.0004 0 0 0 4 4h60v-8h-56v-96h96v8h8v-12a4.0004 4.0004 0 0 0 -4 -4zm27.715 17.951c-1.2324 0.08615-2.3996 0.76492-3.0664 1.9199l-0.14844 0.25781c-1.0669 1.848-0.43784 4.1948 1.4102 5.2617l10.648 6.1484c1.848 1.0669 4.1948 0.43784 5.2617-1.4102l0.14844-0.25781c1.0669-1.848 0.43784-4.1948-1.4102-5.2617l-10.648-6.1484c-0.693-0.4001-1.4558-0.56146-2.1953-0.50977zm52.285 2.0488a32 32 0 0 0 -32 32 32 32 0 0 0 16 27.668v8.332c0 4.432 3.568 8 8 8h16c4.432 0 8-3.568 8-8v-8.3223a32 32 0 0 0 16 -27.678 32 32 0 0 0 -32 -32zm0 12a20 20 0 0 1 20 20 20 20 0 0 1 -20 20 20 20 0 0 1 -20 -20 20 20 0 0 1 20 -20zm-60.148 16c-2.1339 0-3.8516 1.7177-3.8516 3.8516v0.29688c0 2.1339 1.7177 3.8516 3.8516 3.8516h12.297c2.1339 0 3.8516-1.7177 3.8516-3.8516v-0.29688c0-2.1339-1.7177-3.8516-3.8516-3.8516zm18.902 23.951c-0.73947-0.05169-1.5023 0.10966-2.1953 0.50977l-10.648 6.1484c-1.848 1.0669-2.4771 3.4137-1.4102 5.2617l0.14844 0.25781c1.0669 1.848 3.4137 2.4771 5.2617 1.4102l10.648-6.1484c1.848-1.0669 2.4771-3.4137 1.4102-5.2617l-0.14844-0.25781c-0.66684-1.155-1.834-1.8338-3.0664-1.9199zm33.246 32.049v8h16v-8z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#f7f5cf" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
</g>
</svg>
diff --git a/editor/icons/icon_gizmo_light.svg b/editor/icons/icon_gizmo_light.svg
index c411d13dc7..0db2749e91 100644
--- a/editor/icons/icon_gizmo_light.svg
+++ b/editor/icons/icon_gizmo_light.svg
@@ -1,5 +1,6 @@
<svg width="128" height="128" version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 -924.36)">
+<path transform="translate(0 924.36)" d="m64 2a44 44 0 0 0 -44 44 44 44 0 0 0 24 39.189v5.8105 5 3c0 5.0515 3.3756 9.2769 8 10.578v16.422h24v-16.422c4.6244-1.3012 8-5.5266 8-10.578v-3-5-5.8574a44 44 0 0 0 24 -39.143 44 44 0 0 0 -44 -44zm0 20a24 24 0 0 1 24 24 24 24 0 0 1 -24 24 24 24 0 0 1 -24 -24 24 24 0 0 1 24 -24z" fill-opacity=".29412" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".98824" stroke-width="2.2"/>
<path transform="translate(0 924.36)" d="m64 6a40 40 0 0 0 -40 40 40 40 0 0 0 24 36.607v15.393a8 8 0 0 0 8 8h16a8 8 0 0 0 8 -8v-15.363a40 40 0 0 0 24 -36.637 40 40 0 0 0 -40 -40zm0 12a28 28 0 0 1 28 28 28 28 0 0 1 -28 28 28 28 0 0 1 -28 -28 28 28 0 0 1 28 -28zm-8 96v8h16v-8h-16z" fill="#f7f5cf"/>
</g>
</svg>
diff --git a/editor/icons/icon_gizmo_listener.svg b/editor/icons/icon_gizmo_listener.svg
index adb6aebaec..9b74469b67 100644
--- a/editor/icons/icon_gizmo_listener.svg
+++ b/editor/icons/icon_gizmo_listener.svg
@@ -1,6 +1,7 @@
<svg width="128" height="128" version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 -924.36)">
<g transform="matrix(2 0 0 2 -16 -1040.4)">
+<path d="m32 984.36c-12.126 2e-5 -22 9.8729-22 21.999 1.1e-4 1.1045 0.89548 1.9999 2 2h8c1.1045-1e-4 1.9999-0.8955 2-2 2.23e-4 -5.546 4.4536-9.999 10-9.999 5.5464 1e-5 9.9998 4.453 10 9.999 0 6.5873-1.6032 8.0251-3.8408 9.8897-1.0295 0.8579-2.3133 1.6111-3.7969 2.6826-0.72285 0.522-1.6649 1.2341-2.5488 2.3496-0.98288 1.2402-1.8135 2.99-1.8135 5.0781 0 2.3898-0.31658 3.686-0.61035 4.3194-0.29378 0.6333-0.4706 0.73-0.97754 1.0341-0.54947 0.3297-2.5162 0.6446-4.4121 0.6446-0.0065 3e-4 -0.01302 6e-4 -0.01953 1e-3h-3.9805c-1.1045 1e-4 -1.9999 0.8954-2 2v8c1.1e-4 1.1045 0.89548 1.9999 2 2h4c0.0072-3e-4 0.01432-5e-4 0.02148-1e-3 1.9052 1e-3 6.3098 0.1982 10.566-2.3555 4.0103-2.4061 6.6628-7.2724 7.1738-13.592 0.81224-0.548 2.3445-1.497 4.0791-2.9424 4.0025-3.3353 8.1592-9.5405 8.1592-19.108-9.5e-5 -12.126-9.8735-21.999-22-21.999zm31.807 4.002c-0.38259-0.0177-0.76221 0.0749-1.0938 0.2666l-6.9531 4.0156c-0.95754 0.55332-1.2843 1.7787-0.72949 2.7354 1.9364 3.3365 2.9609 7.1229 2.9717 10.98-0.0072 3.8597-1.0296 7.6487-2.9648 10.988-0.55452 0.9572-0.22681 2.1827 0.73144 2.7353l6.9453 4.0069c0.95656 0.5517 2.1792 0.2238 2.7314-0.7325 6.0717-10.516 6.0717-23.482 0-33.998-0.3406-0.59005-0.95812-0.96615-1.6387-0.99805z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill-opacity=".29412" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
<path transform="matrix(.5 0 0 .5 8 982.36)" d="m48 8a40 39.998 0 0 0 -40 39.998h16a24 23.999 0 0 1 24 -23.998 24 23.999 0 0 1 24 23.998c0 13.999-4.33 18.859-9.1211 22.852-2.3955 1.9962-5.0363 3.5302-7.8125 5.5352-1.3881 1.0024-2.8661 2.126-4.3047 3.9414-1.4385 1.8152-2.7617 4.6719-2.7617 7.6719 0 10.221-2.5383 12.59-5.1172 14.137-2.5789 1.5472-6.8828 1.8594-10.883 1.8594v0.00195h-8v16h8v-0.00195c4 0 11.696 0.31158 19.117-4.1406 7.0602-4.236 12.198-13.279 12.695-26 0.1835-0.1636 0.14883-0.15489 0.62109-0.49609 1.7238-1.245 5.083-3.2112 8.6875-6.2148 7.209-6.0072 14.879-17.145 14.879-35.145a40 39.998 0 0 0 -40 -39.998zm63.426 8l-13.906 8.0312a48 47.998 0 0 1 6.4844 23.967 48 47.998 0 0 1 -6.4688 23.984l13.891 8.0137a64 63.997 0 0 0 0 -63.996z" fill="#f7f5cf"/>
</g>
</g>
diff --git a/editor/icons/icon_gizmo_particles.svg b/editor/icons/icon_gizmo_particles.svg
index 05fc84619e..0989c1acad 100644
--- a/editor/icons/icon_gizmo_particles.svg
+++ b/editor/icons/icon_gizmo_particles.svg
@@ -1,5 +1,6 @@
<svg width="128" height="128" version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 -924.36)">
+<path d="m63.998 928.36c-18.429 5e-3 -34.029 13.88-38.557 32.926-12.4 3.0077-21.427 14.08-21.441 27.07v4e-3c0 15.417 12.583 28 28 28h64c15.417 0 28-12.583 28-28v-4e-3c-0.0152-13-9.0549-24.076-21.467-27.074-4.5265-19.033-20.112-32.903-38.529-32.922zm32.002 88c-6.58 0-12 5.42-12 12s5.42 12 12 12c6.58 0 12-5.42 12-12s-5.42-12-12-12zm-64 0c-6.58 0-12 5.42-12 12s5.42 12 12 12 12-5.42 12-12-5.42-12-12-12zm32 8c-6.58 0-12 5.42-12 12s5.42 12 12 12 12-5.42 12-12-5.42-12-12-12z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill-opacity=".29412" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
<path transform="translate(0 924.36)" d="m64 8a36 40 0 0 0 -35.311 32.256 24 24 0 0 0 -20.689 23.744 24 24 0 0 0 24 24h64a24 24 0 0 0 24 -24 24 24 0 0 0 -20.715 -23.746 36 40 0 0 0 -35.285 -32.254zm-32 88a8 8 0 0 0 -8 8 8 8 0 0 0 8 8 8 8 0 0 0 8 -8 8 8 0 0 0 -8 -8zm64 0a8 8 0 0 0 -8 8 8 8 0 0 0 8 8 8 8 0 0 0 8 -8 8 8 0 0 0 -8 -8zm-32 8a8 8 0 0 0 -8 8 8 8 0 0 0 8 8 8 8 0 0 0 8 -8 8 8 0 0 0 -8 -8z" fill="#f7f5cf"/>
</g>
</svg>
diff --git a/editor/icons/icon_gizmo_reflection_probe.svg b/editor/icons/icon_gizmo_reflection_probe.svg
index 6d80e73b8c..bcfd6e53f9 100644
--- a/editor/icons/icon_gizmo_reflection_probe.svg
+++ b/editor/icons/icon_gizmo_reflection_probe.svg
@@ -1,5 +1,6 @@
<svg width="128" height="128" version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -924.36)">
-<path transform="translate(0 924.36)" d="m12 8a4.0004 4.0004 0 0 0 -4 4v24h8v-20h96v8h8v-12a4.0004 4.0004 0 0 0 -4 -4h-104zm76 28a4 4 0 0 0 -4 4 4 4 0 0 0 4 4h18.732l-42.957 50.119-44.947-44.947-5.6562 5.6582 48 48a4.0004 4.0004 0 0 0 5.8652 -0.22656l44.963-52.457v17.854a4 4 0 0 0 4 4 4 4 0 0 0 4 -4v-28a4.0004 4.0004 0 0 0 -4 -4h-28zm-80 52v28a4.0004 4.0004 0 0 0 4 4h104a4.0004 4.0004 0 0 0 4 -4v-28h-8v24h-96v-24h-8z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#f7f5cf" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="filter-blend-mode:normal;filter-gaussianBlur-deviation:0;font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
+<g transform="translate(0 -924.36)" shape-rendering="auto">
+<path d="m12 928.36c-4.3705 4.4e-4 -7.9996 3.6295-8 8v28h16v-20h88v8h16v-16c-4.4e-4 -4.3705-3.6295-7.9996-8-8zm76 28c-4.3709 0-8 3.6291-8 8s3.6291 8 8 8h10.035l-34.486 40.236-44.721-44.723-11.312 11.316 50.828 50.828c3.2536 3.2513 8.7374 3.0394 11.73-0.4531l37.926-44.244v7.0391c0 4.3709 3.6291 8 8 8s8-3.6291 8-8v-28c-4.4e-4 -4.3705-3.6295-7.9996-8-8zm-84 52v32c4.37e-4 4.3705 3.6295 7.9996 8 8h104c4.3705-4e-4 7.9996-3.6295 8-8v-32h-16v24h-88v-24z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill-opacity=".29412" image-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
+<path d="m12 932.36c-2.209 2.2e-4 -3.9998 1.791-4 4v24h8v-20h96v8h8v-12c-2.2e-4 -2.209-1.791-3.9998-4-4zm76 28c-2.2091 0-4 1.7909-4 4s1.7909 4 4 4h18.732l-42.957 50.119-44.947-44.947-5.6562 5.6582 48 48c1.648 1.6468 4.3491 1.5425 5.8652-0.2266l44.963-52.457v17.854c0 2.2091 1.7909 4 4 4s4-1.7909 4-4v-28c-2.2e-4 -2.209-1.791-3.9998-4-4zm-80 52v28c2.209e-4 2.2091 1.791 3.9998 4 4h104c2.209-2e-4 3.9998-1.7909 4-4v-28h-8v24h-96v-24z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#f7f5cf" image-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
</g>
</svg>
diff --git a/editor/icons/icon_gizmo_spatial_sample_player.svg b/editor/icons/icon_gizmo_spatial_sample_player.svg
index 7dbb4744be..aa69248503 100644
--- a/editor/icons/icon_gizmo_spatial_sample_player.svg
+++ b/editor/icons/icon_gizmo_spatial_sample_player.svg
@@ -1,5 +1,6 @@
<svg width="128" height="128" version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -924.36)">
-<path transform="translate(0 924.36)" d="m63.883 12.004c-1.0195 0.0295-1.9892 0.4473-2.7109 1.168l-30.828 30.83h-14.344c-2.209 2.21e-4 -3.9998 1.791-4 4v32c2.21e-4 2.209 1.791 3.9998 4 4h14.344l30.828 30.828c2.52 2.5182 6.8267 0.73442 6.8281-2.8281v-96.002c-0.0015-2.2541-1.8641-4.0619-4.1172-3.9961zm48.117 3.9961a4 4 0 0 0 -4 4v88a4 4 0 0 0 4 4 4 4 0 0 0 4 -4v-88a4 4 0 0 0 -4 -4zm-24 24a4 4 0 0 0 -4 4v40a4 4 0 0 0 4 4 4 4 0 0 0 4 -4v-40a4 4 0 0 0 -4 -4z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#f7f5cf" fill-rule="evenodd" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
+<g transform="translate(0 -924.36)" fill-rule="evenodd" shape-rendering="auto">
+<path d="m63.766 932.37c-2.0369 0.0594-3.9779 0.89602-5.4199 2.3359l-2e-3 2e-3 -29.656 29.658h-12.688c-4.3705 4.4e-4 -7.9996 3.6295-8 8v32c4.372e-4 4.3705 3.6295 7.9995 8 8h12.688l29.656 29.656c2.4 2.3983 5.9795 2.8662 8.7168 1.7324 2.7373-1.1337 4.9381-3.9958 4.9395-7.3886v-96.004c-3e-3 -4.4555-3.779-8.1211-8.2324-7.9922zm48.234 3.9941c-4.3709 0-8 3.6291-8 8v88c0 4.3709 3.6291 8 8 8s8-3.6291 8-8v-88c0-4.3709-3.6291-8-8-8zm-24 24c-4.3709 0-8 3.6291-8 8v40c0 4.3709 3.6291 8 8 8s8-3.6291 8-8v-40c0-4.3709-3.6291-8-8-8z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill-opacity=".29412" image-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
+<path transform="translate(0 924.36)" d="m63.883 12.004c-1.0195 0.0295-1.9892 0.4473-2.7109 1.168l-30.828 30.83h-14.344c-2.209 2.21e-4 -3.9998 1.791-4 4v32c2.21e-4 2.209 1.791 3.9998 4 4h14.344l30.828 30.828c2.52 2.5182 6.8267 0.73442 6.8281-2.8281v-96.002c-0.0015-2.2541-1.8641-4.0619-4.1172-3.9961zm48.117 3.9961a4 4 0 0 0 -4 4v88a4 4 0 0 0 4 4 4 4 0 0 0 4 -4v-88a4 4 0 0 0 -4 -4zm-24 24a4 4 0 0 0 -4 4v40a4 4 0 0 0 4 4 4 4 0 0 0 4 -4v-40a4 4 0 0 0 -4 -4z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#f7f5cf" image-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
</g>
</svg>
diff --git a/editor/icons/icon_gizmo_spatial_stream_player.svg b/editor/icons/icon_gizmo_spatial_stream_player.svg
index 2cf3966364..1470d3bfba 100644
--- a/editor/icons/icon_gizmo_spatial_stream_player.svg
+++ b/editor/icons/icon_gizmo_spatial_stream_player.svg
@@ -1,5 +1,6 @@
<svg width="128" height="128" version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -924.36)">
-<path d="m99.766 934.36a8.0008 8.0011 0 0 0 -1.9609 0.296l-56 16a8.0008 8.0011 0 0 0 -5.8047 7.6964v48.119a18 18.001 0 0 0 -2 -0.116 18 18.001 0 0 0 -18 18.001 18 18.001 0 0 0 18 18.001 18 18.001 0 0 0 17.875 -16.001h0.125v-2-59.963l40-11.43v37.517a18 18.001 0 0 0 -2 -0.124 18 18.001 0 0 0 -18 18.001 18 18.001 0 0 0 18 18 18 18.001 0 0 0 17.875 -16h0.125v-2-66.003a8.0008 8.0011 0 0 0 -8.2344 -7.9924z" color="#000000" color-rendering="auto" fill="#f7f5cf" fill-rule="evenodd" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="block-progression:tb;isolation:auto;mix-blend-mode:normal;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-transform:none;white-space:normal"/>
+<g transform="translate(0 -924.36)" shape-rendering="auto">
+<path transform="translate(0 924.36)" d="m99.645 6.0059c-0.9956 0.029687-1.9837 0.18322-2.9414 0.45703l-56 16c-5.1336 1.4668-8.7021 6.198-8.7031 11.537v44.203c-11.16 1.0331-20 10.379-20 21.797 1.1e-5 12.103 9.8971 22 22 22 12.103-1e-5 22-9.8971 22-22v-56.947l32-9.1426v28.293c-11.16 1.0331-20 10.379-20 21.797 1.1e-5 12.103 9.8971 22 22 22 12.103-1e-5 22-9.8971 22-22v-66c-0.00104-6.7137-5.6428-12.192-12.354-11.994z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill-opacity=".29412" image-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
+<path transform="translate(0 924.36)" d="m99.764 10.004a8.0008 8.0008 0 0 0 -1.9609 0.30469l-56 16a8.0008 8.0008 0 0 0 -5.8027 7.6914v48.121a18 18 0 0 0 -2 -0.12109 18 18 0 0 0 -18 18 18 18 0 0 0 18 18 18 18 0 0 0 18 -18v-59.965l40-11.428v37.514a18 18 0 0 0 -2 -0.12109 18 18 0 0 0 -18 18 18 18 0 0 0 18 18 18 18 0 0 0 18 -18v-66a8.0008 8.0008 0 0 0 -8.2363 -7.9961z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#f7f5cf" image-rendering="auto" solid-color="#000000" style="filter-blend-mode:normal;filter-gaussianBlur-deviation:0;font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
</g>
</svg>
diff --git a/editor/icons/icon_gizmo_spot_light.svg b/editor/icons/icon_gizmo_spot_light.svg
index 9b4ddadd17..1881b6b60a 100644
--- a/editor/icons/icon_gizmo_spot_light.svg
+++ b/editor/icons/icon_gizmo_spot_light.svg
@@ -1,5 +1,6 @@
<svg width="128" height="128" version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 -924.36)">
+<path transform="translate(0 924.36)" d="m52 4c-6.5788 0-12 5.4212-12 12v26.625c-12.263 7.2822-19.978 19.75-20 33.369l-0.005859 4.0059h28.578c1.7994 6.8632 8.0265 12 15.428 12s13.628-5.1368 15.428-12h28.576l-0.00391-4.0039c-0.01526-13.625-7.7323-26.099-20-33.385v-26.611c0-6.5788-5.4212-12-12-12zm-11.689 78.016c-1.536-0.10738-3.1419 0.23676-4.5586 1.0547l-10.393 6c-3.7786 2.1816-5.1117 7.1503-2.9297 10.93 2.1816 3.7786 7.1503 5.1117 10.93 2.9297l10.393-6c3.7796-2.1822 5.1087-7.1521 2.9277-10.93-1.3629-2.3605-3.8057-3.8052-6.3691-3.9844zm47.379 0c-2.5634 0.1792-5.0063 1.6238-6.3691 3.9844-2.181 3.7776-0.85187 8.7475 2.9277 10.93l10.393 6c3.7794 2.182 8.7481 0.8489 10.93-2.9297 2.182-3.7794 0.84891-8.7481-2.9297-10.93l-10.393-6c-1.4167-0.81792-3.0225-1.1621-4.5586-1.0547zm-23.689 13.984c-4.3628 0-8 3.6372-8 8v12c0 4.3628 3.6372 8 8 8s8-3.6372 8-8v-12c0-4.3628-3.6372-8-8-8z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill-opacity=".29412" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
<path transform="translate(0 924.36)" d="m52 8c-4.432 0-8 3.568-8 8v12 16.875a40 36 0 0 0 -20 31.125h28a12 12 0 0 0 12 12 12 12 0 0 0 12 -12h28a40 36 0 0 0 -20 -31.141v-20.859-8c0-4.432-3.568-8-8-8h-24zm-11.969 78.006c-0.76793-0.053681-1.5596 0.1138-2.2793 0.5293l-10.393 6c-1.9191 1.108-2.5728 3.5457-1.4648 5.4648s3.5457 2.5728 5.4648 1.4648l10.393-6c1.9191-1.108 2.5709-3.5457 1.4629-5.4648-0.6925-1.1994-1.9037-1.9047-3.1836-1.9941zm47.938 0c-1.2799 0.08947-2.4911 0.7947-3.1836 1.9941-1.108 1.9191-0.45622 4.3568 1.4629 5.4648l10.393 6c1.9191 1.108 4.3568 0.45427 5.4648-1.4648s0.45427-4.3568-1.4648-5.4648l-10.393-6c-0.71967-0.4155-1.5114-0.58298-2.2793-0.5293zm-23.969 13.994c-2.216 0-4 1.784-4 4v12c0 2.216 1.784 4 4 4s4-1.784 4-4v-12c0-2.216-1.784-4-4-4z" fill="#f7f5cf" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.1082"/>
</g>
</svg>
diff --git a/editor/icons/icon_group_viewport.svg b/editor/icons/icon_group_viewport.svg
new file mode 100644
index 0000000000..350fb4103f
--- /dev/null
+++ b/editor/icons/icon_group_viewport.svg
@@ -0,0 +1,7 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<g transform="translate(0 -1036.4)">
+<path transform="translate(0 1036.4)" d="m0 0v4h4v-4h-4zm6 0v6h-6v10h10v-6h6v-10h-10zm4 4h2v2h-2v-2zm2 8v4h4v-4h-4z" fill-opacity=".39216" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".98824" stroke-width=".5"/>
+<path transform="translate(0 1036.4)" d="m7 1v6h-6v8h8v-6h6v-8zm2 2h4v4h-4z" fill="#e0e0e0"/>
+<path transform="translate(0 1036.4)" d="m1 1v2c0 2.34e-5 0.446 0 1 0s1 2.34e-5 1 0v-2c0-2.341e-5 -0.446 0-1 0s-1-2.341e-5 -1 0zm12 0v2c0 2.34e-5 0.446 0 1 0s1 2.34e-5 1 0v-2c0-2.341e-5 -0.446 0-1 0s-1-2.341e-5 -1 0zm-12 12v2c0 2.3e-5 0.446 0 1 0s1 2.3e-5 1 0v-2c0-2.3e-5 -0.446 0-1 0s-1-2.3e-5 -1 0zm12 0v2c0 2.3e-5 0.446 0 1 0s1 2.3e-5 1 0v-2c0-2.3e-5 -0.446 0-1 0s-1-2.3e-5 -1 0z" fill="#fff"/>
+</g>
+</svg>
diff --git a/editor/icons/icon_key.svg b/editor/icons/icon_key.svg
index 041b820e00..cc152b58a5 100644
--- a/editor/icons/icon_key.svg
+++ b/editor/icons/icon_key.svg
@@ -1,7 +1,5 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1036.4)" fill="#e0e0e0" fill-opacity=".99608">
-<path transform="translate(0 1036.4)" d="m11 4a4 4 0 0 0 -4 4 4 4 0 0 0 4 4 4 4 0 0 0 4 -4 4 4 0 0 0 -4 -4zm0 2a2 2 0 0 1 2 2 2 2 0 0 1 -2 2 2 2 0 0 1 -2 -2 2 2 0 0 1 2 -2z"/>
-<rect x="1" y="1043.4" width="8" height="2"/>
-<rect x="2" y="1045.4" width="3" height="2"/>
+<g transform="translate(0 -1036.4)">
+<path transform="translate(0 1036.4)" d="m11 4a4 4 0 0 0 -3.8691 3h-6.1309v2h1v2h3v-2h2.1328a4 4 0 0 0 3.8672 3 4 4 0 0 0 4 -4 4 4 0 0 0 -4 -4zm0 2a2 2 0 0 1 2 2 2 2 0 0 1 -2 2 2 2 0 0 1 -2 -2 2 2 0 0 1 2 -2z" fill="#e0e0e0" fill-opacity=".99608"/>
</g>
</svg>
diff --git a/editor/icons/icon_key_move_disabled.svg b/editor/icons/icon_key_move_disabled.svg
deleted file mode 100644
index 05c158dc3c..0000000000
--- a/editor/icons/icon_key_move_disabled.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-<svg width="16" height="16" style="isolation:isolate" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
-<path d="m7.984 1.002c-0.259 4e-3 -0.507 0.108-0.691 0.291l-2 2 1.414 1.414 1.293-1.293 1.293 1.293 1.414-1.414-2-2c-0.191-0.191-0.452-0.296-0.722-0.291h-1e-3zm-4.691 4.291l-2 2c-0.39 0.391-0.39 1.024 0 1.414l2 2 1.414-1.414-1.293-1.293 1.293-1.293-1.414-1.414zm9.414 0l-1.414 1.414 1.293 1.293-1.293 1.293 1.414 1.414 2-2c0.39-0.39 0.39-1.023 0-1.414l-2-2zm-6 6l-1.414 1.414 2 2c0.391 0.391 1.024 0.391 1.414 0l2-2-1.414-1.414-1.293 1.293-1.293-1.293z" fill="#e0e0e0" fill-opacity=".5" fill-rule="evenodd"/>
-<path d="m5.168 7.595l2.427-2.427c0.224-0.224 0.586-0.224 0.81 0l2.427 2.427c0.224 0.224 0.224 0.586 0 0.81l-2.427 2.427c-0.224 0.224-0.586 0.224-0.81 0l-2.427-2.427c-0.224-0.224-0.224-0.586 0-0.81z" fill="#84c2ff" fill-opacity=".5"/>
-</svg>
diff --git a/editor/icons/icon_key_move_enabled.svg b/editor/icons/icon_key_move_enabled.svg
index 2d455f2d81..203b697ad2 100644
--- a/editor/icons/icon_key_move_enabled.svg
+++ b/editor/icons/icon_key_move_enabled.svg
@@ -1,4 +1,5 @@
-<svg width="16" height="16" style="isolation:isolate" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
-<path d="m7.984 1.002c-0.259 4e-3 -0.507 0.108-0.691 0.291l-2 2 1.414 1.414 1.293-1.293 1.293 1.293 1.414-1.414-2-2c-0.191-0.191-0.452-0.296-0.722-0.291h-1e-3zm-4.691 4.291l-2 2c-0.39 0.391-0.39 1.024 0 1.414l2 2 1.414-1.414-1.293-1.293 1.293-1.293-1.414-1.414zm9.414 0l-1.414 1.414 1.293 1.293-1.293 1.293 1.414 1.414 2-2c0.39-0.39 0.39-1.023 0-1.414l-2-2zm-6 6l-1.414 1.414 2 2c0.391 0.391 1.024 0.391 1.414 0l2-2-1.414-1.414-1.293 1.293-1.293-1.293z" fill="#e0e0e0" fill-opacity=".99608" fill-rule="evenodd"/>
-<path d="m5.168 7.595l2.427-2.427c0.224-0.224 0.586-0.224 0.81 0l2.427 2.427c0.224 0.224 0.224 0.586 0 0.81l-2.427 2.427c-0.224 0.224-0.586 0.224-0.81 0l-2.427-2.427c-0.224-0.224-0.224-0.586 0-0.81z" fill="#84C2FF"/>
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<g transform="translate(0 -1036.4)">
+<path transform="translate(0 1036.4)" d="m8 1c-0.195 0-0.38964 0.07519-0.53906 0.22461l-3.2363 3.2363c-0.29884 0.29884-0.29884 0.77929 0 1.0781l3.2363 3.2363c0.29884 0.29884 0.77929 0.29884 1.0781 0l3.2363-3.2363c0.29884-0.29884 0.29884-0.77929 0-1.0781l-3.2363-3.2363c-0.14942-0.14942-0.34406-0.22461-0.53906-0.22461zm-7 7v5c0 1.6569 1.3471 3.114 3 3h1v-2h-1c-0.55228-1e-5 -0.99999-0.44772-1-1v-5h-2zm7 2c-1.645 0-3 1.355-3 3s1.355 3 3 3 3-1.355 3-3-1.355-3-3-3zm3 3c0 1.6569 1.3431 3 3 3h1v-2h-1c-0.55228-1e-5 -0.99999-0.44772-1-1 1e-5 -0.55228 0.44772-0.99999 1-1h1v-2h-1c-1.6569 0-3 1.3431-3 3zm-3-1c0.56413 0 1 0.4359 1 1 0 0.5642-0.43587 1-1 1s-1-0.4358-1-1c0-0.5641 0.43587-1 1-1z" fill="#e0e0e0" fill-opacity=".99608"/>
+</g>
</svg>
diff --git a/editor/icons/icon_key_rotate_disabled.svg b/editor/icons/icon_key_rotate_disabled.svg
deleted file mode 100644
index 6394bfd82d..0000000000
--- a/editor/icons/icon_key_rotate_disabled.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-<svg width="16" height="16" style="isolation:isolate" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
-<path d="m8.088 1.001c-0.102-1e-3 -0.203 0-0.305 2e-3 -0.233 8e-3 -0.466 0.027-0.697 0.057-2.973 0.392-5.366 2.633-5.951 5.574-0.46 2.319 0.281 4.712 1.97 6.365h-1.105v2h4c0.308 1e-3 0.599-0.141 0.788-0.384 0.19-0.243 0.257-0.559 0.183-0.858l-1-4-1.942 0.487 0.281 1.121c-0.84-0.92-1.308-2.12-1.31-3.366 0-2.761 2.239-5 5-5 1.326 0 2.598 0.527 3.536 1.465 0.937 0.938 1.464 2.209 1.464 3.535-1e-3 1.326-0.529 2.597-1.467 3.534l1.416 1.416c2.12-2.121 2.654-5.356 1.328-8.045-1.165-2.362-3.556-3.869-6.189-3.903z" fill="#e0e0e0" fill-opacity=".5"/>
-<path d="m5.168 7.595l2.427-2.427c0.224-0.224 0.586-0.224 0.81 0l2.427 2.427c0.224 0.224 0.224 0.586 0 0.81l-2.427 2.427c-0.224 0.224-0.586 0.224-0.81 0l-2.427-2.427c-0.224-0.224-0.224-0.586 0-0.81z" fill="#84c2ff" fill-opacity=".5"/>
-</svg>
diff --git a/editor/icons/icon_key_rotate_enabled.svg b/editor/icons/icon_key_rotate_enabled.svg
index 1dcb12c8ab..0f975631b2 100644
--- a/editor/icons/icon_key_rotate_enabled.svg
+++ b/editor/icons/icon_key_rotate_enabled.svg
@@ -1,4 +1,5 @@
-<svg width="16" height="16" style="isolation:isolate" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
-<path d="m8.088 1.001c-0.102-1e-3 -0.203 0-0.305 2e-3 -0.233 8e-3 -0.466 0.027-0.697 0.057-2.973 0.392-5.366 2.633-5.951 5.574-0.46 2.319 0.281 4.712 1.97 6.365h-1.105v2h4c0.308 1e-3 0.599-0.141 0.788-0.384 0.19-0.243 0.257-0.559 0.183-0.858l-1-4-1.942 0.487 0.281 1.121c-0.84-0.92-1.308-2.12-1.31-3.366 0-2.761 2.239-5 5-5 1.326 0 2.598 0.527 3.536 1.465 0.937 0.938 1.464 2.209 1.464 3.535-1e-3 1.326-0.529 2.597-1.467 3.534l1.416 1.416c2.12-2.121 2.654-5.356 1.328-8.045-1.165-2.362-3.556-3.869-6.189-3.903z" fill="#e0e0e0" fill-opacity=".99608"/>
-<path d="m5.168 7.595l2.427-2.427c0.224-0.224 0.586-0.224 0.81 0l2.427 2.427c0.224 0.224 0.224 0.586 0 0.81l-2.427 2.427c-0.224 0.224-0.586 0.224-0.81 0l-2.427-2.427c-0.224-0.224-0.224-0.586 0-0.81z" fill="#84C2FF"/>
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<g transform="translate(0 -1036.4)">
+<path transform="translate(0 1036.4)" d="m8 1c-0.195 0-0.38964 0.07519-0.53906 0.22461l-3.2363 3.2363c-0.29884 0.29884-0.29884 0.77929 0 1.0781l3.2363 3.2363c0.29884 0.29884 0.77929 0.29884 1.0781 0l3.2363-3.2363c0.29884-0.29884 0.29884-0.77929 0-1.0781l-3.2363-3.2363c-0.14942-0.14942-0.34406-0.22461-0.53906-0.22461zm3 7v5c0 1.6569 1.3431 3 3 3h1v-2h-1c-0.55228 0-0.99999-0.4477-1-1v-1h2v-2h-2v-2h-2zm0 5c0-1.645-1.355-3-3-3s-3 1.355-3 3 1.355 3 3 3 3-1.355 3-3zm-7-3c-1.6569 0-3 1.3431-3 3v3h2v-3c9.6e-6 -0.5523 0.44772-1 1-1h1v-2h-1zm4 2c0.56413 0 1 0.4359 1 1 0 0.5642-0.43587 1-1 1s-1-0.4358-1-1c0-0.5641 0.43587-1 1-1z" fill="#e0e0e0" fill-opacity=".99608"/>
+</g>
</svg>
diff --git a/editor/icons/icon_key_scale_disabled.svg b/editor/icons/icon_key_scale_disabled.svg
deleted file mode 100644
index 9601e4925b..0000000000
--- a/editor/icons/icon_key_scale_disabled.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-<svg width="16" height="16" style="isolation:isolate" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
-<path d="m9 1c-0.552 0-1 0.448-1 1s0.448 1 1 1h2.586l-1.293 1.293 1.414 1.414 1.293-1.293v2.586c0 0.552 0.448 1 1 1s1-0.448 1-1v-5c0-0.552-0.448-1-1-1h-5zm-7 7c-0.552 0-1 0.448-1 1v5c0 0.552 0.448 1 1 1h5c0.552 0 1-0.448 1-1s-0.448-1-1-1h-2.586l1.293-1.293-1.414-1.414-1.293 1.293v-2.586c0-0.552-0.448-1-1-1z" fill="#e0e0e0" fill-opacity=".5" fill-rule="evenodd"/>
-<path d="m5.168 7.595l2.427-2.427c0.224-0.224 0.586-0.224 0.81 0l2.427 2.427c0.224 0.224 0.224 0.586 0 0.81l-2.427 2.427c-0.224 0.224-0.586 0.224-0.81 0l-2.427-2.427c-0.224-0.224-0.224-0.586 0-0.81z" fill="#84c2ff" fill-opacity=".5"/>
-</svg>
diff --git a/editor/icons/icon_key_scale_enabled.svg b/editor/icons/icon_key_scale_enabled.svg
index f00f3db35f..eaa12fdf0e 100644
--- a/editor/icons/icon_key_scale_enabled.svg
+++ b/editor/icons/icon_key_scale_enabled.svg
@@ -1,4 +1,5 @@
-<svg width="16" height="16" style="isolation:isolate" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
-<path d="m9 1c-0.552 0-1 0.448-1 1s0.448 1 1 1h2.586l-1.293 1.293 1.414 1.414 1.293-1.293v2.586c0 0.552 0.448 1 1 1s1-0.448 1-1v-5c0-0.552-0.448-1-1-1h-5zm-7 7c-0.552 0-1 0.448-1 1v5c0 0.552 0.448 1 1 1h5c0.552 0 1-0.448 1-1s-0.448-1-1-1h-2.586l1.293-1.293-1.414-1.414-1.293 1.293v-2.586c0-0.552-0.448-1-1-1z" fill="#e0e0e0" fill-opacity=".99608" fill-rule="evenodd"/>
-<path d="m5.168 7.595l2.427-2.427c0.224-0.224 0.586-0.224 0.81 0l2.427 2.427c0.224 0.224 0.224 0.586 0 0.81l-2.427 2.427c-0.224 0.224-0.586 0.224-0.81 0l-2.427-2.427c-0.224-0.224-0.224-0.586 0-0.81z" fill="#84C2FF"/>
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<g transform="translate(0 -1036.4)">
+<path transform="translate(0 1036.4)" d="m8 1c-0.195 0-0.38964 0.07519-0.53906 0.22461l-3.2363 3.2363c-0.29884 0.29884-0.29884 0.77929 0 1.0781l3.2363 3.2363c0.29884 0.29884 0.77929 0.29884 1.0781 0l3.2363-3.2363c0.29884-0.29884 0.29884-0.77929 0-1.0781l-3.2363-3.2363c-0.14942-0.14942-0.34406-0.22461-0.53906-0.22461zm3 7v5c0 1.6569 1.3431 3 3 3h1v-2h-1c-0.55228-1e-5 -0.99999-0.44772-1-1v-5h-2zm-8 2c-0.71466-1e-4 -1.3751 0.3811-1.7324 1-0.35727 0.6188-0.35727 1.3812 0 2 0.35733 0.6189 1.0178 1.0001 1.7324 1h-2v2h2c0.71466 1e-4 1.3751-0.3811 1.7324-1 0.35727-0.6188 0.35727-1.3812 0-2-0.35733-0.6189-1.0178-1.0001-1.7324-1h2v-2h-2zm6 0c-1.6569 0-3 1.3431-3 3s1.3431 3 3 3h1v-2h-1c-0.55228-1e-5 -0.99999-0.44772-1-1 9.6e-6 -0.55228 0.44772-0.99999 1-1h1v-2h-1z" fill="#e0e0e0" fill-opacity=".99608"/>
+</g>
</svg>
diff --git a/editor/icons/icon_lock.svg b/editor/icons/icon_lock.svg
index b0b0125648..1202f1d86f 100644
--- a/editor/icons/icon_lock.svg
+++ b/editor/icons/icon_lock.svg
@@ -1,8 +1,5 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1036.4)" fill="#e0e0e0">
-<path transform="translate(0 1036.4)" d="m2 8v7h12v-7h-12zm5 2h2v3h-2v-3z"/>
-<path transform="translate(0 1036.4)" d="m8 1a5 5 0 0 0 -5 5h2a3 3 0 0 1 3 -3 3 3 0 0 1 3 3h2a5 5 0 0 0 -5 -5z"/>
-<rect x="3" y="1042.4" width="2" height="2"/>
-<rect x="11" y="1042.4" width="2" height="2"/>
+<g transform="translate(0 -1036.4)">
+<path transform="translate(0 1036.4)" d="m8 1a5 5 0 0 0 -5 5v2h-1v7h12v-7h-1v-2a5 5 0 0 0 -5 -5zm0 2a3 3 0 0 1 3 3v2h-6v-2a3 3 0 0 1 3 -3zm-1 7h2v3h-2v-3z" fill="#e0e0e0"/>
</g>
</svg>
diff --git a/editor/icons/icon_lock_viewport.svg b/editor/icons/icon_lock_viewport.svg
new file mode 100644
index 0000000000..54dc9f6b82
--- /dev/null
+++ b/editor/icons/icon_lock_viewport.svg
@@ -0,0 +1,6 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<g transform="translate(0 -1036.4)">
+<path transform="translate(0 1036.4)" d="m8 0a6 6 0 0 0 -6 6v1h-1v9h14v-9h-1v-1a6 6 0 0 0 -6 -6zm0 4c1.1046 0 2 0.89543 2 2v1h-4v-1c0-1.1046 0.89543-2 2-2z" fill-opacity=".39216" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".98824" stroke-width="4"/>
+<path transform="translate(0 1036.4)" d="m8 1a5 5 0 0 0 -5 5v2h-1v7h12v-7h-1v-2a5 5 0 0 0 -5 -5zm0 2a3 3 0 0 1 3 3v2h-6v-2a3 3 0 0 1 3 -3zm-1 7h2v3h-2v-3z" fill="#e0e0e0"/>
+</g>
+</svg>
diff --git a/editor/icons/icon_matrix.svg b/editor/icons/icon_matrix.svg
deleted file mode 100644
index ff5b1b0808..0000000000
--- a/editor/icons/icon_matrix.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<svg width="14" height="14" version="1.1" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1038.4)">
-<path transform="translate(0 1038.4)" d="m1 1v1 11h1 2v-1h-2v-10h2v-1h-2-1zm9 0v1h2v10h-2v1h3v-1-11h-3zm-7 2v2h2v-2h-2zm3 0v2h2v-2h-2zm3 0v2h2v-2h-2zm-6 3v2h2v-2h-2zm3 0v2h2v-2h-2zm3 0v2h2v-2h-2zm-6 3v2h2v-2h-2zm3 0v2h2v-2h-2zm3 0v2h2v-2h-2z" fill="#ea686c"/>
-</g>
-</svg>
diff --git a/editor/icons/icon_mini_color.svg b/editor/icons/icon_mini_color.svg
index b70015a05d..623f922158 100644
--- a/editor/icons/icon_mini_color.svg
+++ b/editor/icons/icon_mini_color.svg
@@ -1,7 +1,7 @@
<svg width="16" height="12" version="1.1" viewBox="0 0 16 12" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 -1040.4)">
-<path transform="translate(0 1040.4)" d="m4 4a3 3 0 0 0 -3 3 3 3 0 0 0 3 3h1v-2h-1a1 1 0 0 1 -1 -1 1 1 0 0 1 1 -1h1v-2h-1z" fill="#ff7070"/>
-<path transform="translate(0 1040.4)" d="m14 4a3 3 0 0 0 -3 3v3h2v-3a1 1 0 0 1 1 -1h1v-2h-1z" fill="#70bfff"/>
-<path transform="translate(0 1040.4)" d="m6 2v5a3 3 0 0 0 3 3h1v-2h-1a1 1 0 0 1 -1 -1v-5h-2z" fill="#7aff70"/>
+<path transform="translate(0 1040.4)" d="m4 4a3 3 0 0 0 -3 3 3 3 0 0 0 3 3h1v-2h-1a1 1 0 0 1 -1 -1 1 1 0 0 1 1 -1h1v-2h-1z" fill="#ff8484"/>
+<path transform="translate(0 1040.4)" d="m14 4a3 3 0 0 0 -3 3v3h2v-3a1 1 0 0 1 1 -1h1v-2h-1z" fill="#84c2ff"/>
+<path transform="translate(0 1040.4)" d="m6 2v5a3 3 0 0 0 3 3h1v-2h-1a1 1 0 0 1 -1 -1v-5h-2z" fill="#84ffb1"/>
</g>
</svg>
diff --git a/editor/icons/icon_mini_image.svg b/editor/icons/icon_mini_image.svg
deleted file mode 100644
index 735cb563cb..0000000000
--- a/editor/icons/icon_mini_image.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<svg width="16" height="12" version="1.1" viewBox="0 0 16 12" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1040.4)">
-<path transform="translate(0 1040.4)" d="m0 1v2h2v-2h-2zm3 2v6h2v-4a1 1 0 0 1 1 1v3h2v-3-1a1 1 0 0 1 1 1v3h2v-3a3 3 0 0 0 -3 -3h-2v0.17578a3 3 0 0 0 -1 -0.17578h-2zm8 3a3 3 0 0 0 3 3 1 1 0 0 1 -1 1h-1v2h1a3 3 0 0 0 3 -3v-6h-2a3 3 0 0 0 -3 3zm-11-1v4h2v-4h-2zm14 0v2a1 1 0 0 1 -1 -1 1 1 0 0 1 1 -1z" fill="#93f1b9"/>
-</g>
-</svg>
diff --git a/editor/icons/icon_mini_input.svg b/editor/icons/icon_mini_input.svg
deleted file mode 100644
index 92cf763cf8..0000000000
--- a/editor/icons/icon_mini_input.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<svg width="16" height="12" version="1.1" viewBox="0 0 16 12" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1040.4)">
-<path transform="translate(0 1040.4)" d="m0 2v2h2v-2h-2zm13 0v5a3 3 0 0 0 3 3v-2a1 1 0 0 1 -1 -1v-1h1v-2h-1v-2h-2zm0 5a3 3 0 0 0 -3 -3h-2v3a3 3 0 0 0 -3 -3h-2v6h2v-4a1 1 0 0 1 1 1v3h2v2h2v-2a3 3 0 0 0 3 -3zm-13-1v4h2v-4h-2zm10 0a1 1 0 0 1 1 1 1 1 0 0 1 -1 1v-2z" fill="#adf18f"/>
-</g>
-</svg>
diff --git a/editor/icons/icon_node_warning.svg b/editor/icons/icon_node_warning.svg
index 66663f7d62..8a1a3bd2ea 100644
--- a/editor/icons/icon_node_warning.svg
+++ b/editor/icons/icon_node_warning.svg
@@ -1,7 +1,3 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1036.4)">
-<g transform="translate(0 -1.6949e-5)">
-<path transform="translate(0 1036.4)" d="m8.0293 2.002a1.0001 1.0001 0 0 0 -0.88672 0.48438l-6 10a1.0001 1.0001 0 0 0 0.85742 1.5137h12a1.0001 1.0001 0 0 0 0.85742 -1.5137l-6-10a1.0001 1.0001 0 0 0 -0.82812 -0.48438zm-1.0293 2.998h2v5h-2v-5zm0 6h2v2h-2v-2z" color="#000000" color-rendering="auto" fill="#ffdd65" fill-rule="evenodd" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="block-progression:tb;isolation:auto;mix-blend-mode:normal;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-transform:none;white-space:normal"/>
-</g>
-</g>
+<path d="m8.0293 2.002a1.0001 1.0001 0 0 0 -0.88672 0.48438l-6 10a1.0001 1.0001 0 0 0 0.85742 1.5137h12a1.0001 1.0001 0 0 0 0.85742 -1.5137l-6-10a1.0001 1.0001 0 0 0 -0.82812 -0.48438zm-1.0293 2.998h2v5h-2v-5zm0 6h2v2h-2v-2z" color="#000000" color-rendering="auto" fill="#ffdd65" fill-rule="evenodd" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="block-progression:tb;isolation:auto;mix-blend-mode:normal;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-transform:none;white-space:normal"/>
</svg>
diff --git a/editor/icons/icon_snap.svg b/editor/icons/icon_snap.svg
index 83e7b47fab..0e535b11ce 100644
--- a/editor/icons/icon_snap.svg
+++ b/editor/icons/icon_snap.svg
@@ -1,6 +1,6 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 -1036.4)">
-<path transform="translate(0 1036.4)" d="m3 3v2h2v-2h-2zm6 0v2h2v-2h-2zm-6 6v2h2v-2h-2zm4 4v2h2v-2h-2zm6 0v2h2v-2h-2z" fill="#f3f3f3"/>
+<path transform="translate(0 1036.4)" d="m3 3v2h2v-2h-2zm6 0v2h2v-2h-2zm-6 6v2h2v-2h-2zm4 4v2h2v-2h-2zm6 0v2h2v-2h-2z" fill="#e0e0e0"/>
<path transform="translate(0 1036.4)" d="m11 7a4 4 0 0 0 -4 4v2h2v-2a2 2 0 0 1 2 -2 2 2 0 0 1 2 2v2h2v-2a4 4 0 0 0 -4 -4z" fill="#fff" fill-opacity=".68627"/>
</g>
</svg>
diff --git a/editor/icons/icon_snap_grid.svg b/editor/icons/icon_snap_grid.svg
index 1cb9140f1f..7124bd918e 100644
--- a/editor/icons/icon_snap_grid.svg
+++ b/editor/icons/icon_snap_grid.svg
@@ -1,6 +1,6 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 -1036.4)">
-<path transform="translate(0 1036.4)" d="m3 0v3h-3v2h3v4h-3v2h3v3h2v-9h9v-2h-3v-3h-2v3h-4v-3zm4 13v2h2v-2zm6 0v2h2v-2z" fill="#f3f3f3"/>
+<path transform="translate(0 1036.4)" d="m3 0v3h-3v2h3v4h-3v2h3v3h2v-9h9v-2h-3v-3h-2v3h-4v-3zm4 13v2h2v-2zm6 0v2h2v-2z" fill="#e0e0e0"/>
<path transform="translate(0 1036.4)" d="m11 7a4 4 0 0 0 -4 4v2h2v-2a2 2 0 0 1 2 -2 2 2 0 0 1 2 2v2h2v-2a4 4 0 0 0 -4 -4z" fill="#fff" fill-opacity=".68627"/>
</g>
</svg>
diff --git a/editor/icons/icon_status_error.svg b/editor/icons/icon_status_error.svg
new file mode 100644
index 0000000000..072964b02d
--- /dev/null
+++ b/editor/icons/icon_status_error.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<path d="m8 1c-3.866 0-7 3.134-7 7 0 3.866 3.134 7 7 7 3.866 0 7-3.134 7-7 0-3.866-3.134-7-7-7zm-2.8281 2.7578l2.8281 2.8281 2.8281-2.8281 1.4141 1.4141-2.8281 2.8281 2.8281 2.8281-1.4141 1.4141-2.8281-2.8281-2.8281 2.8281-1.4141-1.4141 2.8281-2.8281-2.8281-2.8281 1.4141-1.4141z" fill="#ff5d5d"/>
+</svg>
diff --git a/editor/icons/icon_status_success.svg b/editor/icons/icon_status_success.svg
new file mode 100644
index 0000000000..d1ddc08579
--- /dev/null
+++ b/editor/icons/icon_status_success.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<path d="m8 1c-3.866 0-7 3.134-7 7 0 3.866 3.134 7 7 7 3.866 0 7-3.134 7-7 0-3.866-3.134-7-7-7zm3.293 3.877 1.4141 1.4141-5.707 5.709-3.707-3.709 1.4141-1.4141 2.293 2.293z" fill="#45ff8b"/>
+</svg>
diff --git a/editor/icons/icon_status_warning.svg b/editor/icons/icon_status_warning.svg
new file mode 100644
index 0000000000..28364bb274
--- /dev/null
+++ b/editor/icons/icon_status_warning.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<path d="m8 1a7 7 0 0 0 -7 7 7 7 0 0 0 7 7 7 7 0 0 0 7 -7 7 7 0 0 0 -7 -7zm-1 2h2v7h-2v-7zm0 8h2v2h-2v-2z" fill="#ffdd65"/>
+</svg>
diff --git a/editor/icons/icon_unlock.svg b/editor/icons/icon_unlock.svg
index 10ea82cbcf..591b3d0102 100644
--- a/editor/icons/icon_unlock.svg
+++ b/editor/icons/icon_unlock.svg
@@ -1,7 +1,5 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1036.4)" fill="#e0e0e0">
-<path transform="translate(0 1036.4)" d="m2 8v7h12v-7h-12zm5 2h2v3h-2v-3z"/>
-<path transform="translate(0 1036.4)" d="m8 1c-0.87738 0.001545-1.7389 0.23394-2.498 0.67383l1 1.7324c0.45506-0.26449 0.97171-0.40459 1.498-0.40625 1.6569 0 3 1.3431 3 3h2c0-2.7614-2.2386-5-5-5z"/>
-<rect x="11" y="1042.4" width="2" height="2"/>
+<g transform="translate(0 -1036.4)">
+<path transform="translate(0 1036.4)" d="m8 1c-0.87738 0.001545-1.7389 0.23394-2.498 0.67383l1 1.7324c0.45506-0.26449 0.97171-0.40459 1.498-0.40625 1.6569 0 3 1.3431 3 3v2h-9v7h12v-7h-1v-2c0-2.7614-2.2386-5-5-5zm-1 9h2v3h-2v-3z" fill="#e0e0e0"/>
</g>
</svg>
diff --git a/editor/icons/icon_zoom_less.svg b/editor/icons/icon_zoom_less.svg
index c78262841c..aebadf443f 100644
--- a/editor/icons/icon_zoom_less.svg
+++ b/editor/icons/icon_zoom_less.svg
@@ -1,5 +1,6 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1036.4)">
-<path transform="translate(0 1036.4)" d="m8 1a7 7 0 0 0 -7 7 7 7 0 0 0 7 7 7 7 0 0 0 7 -7 7 7 0 0 0 -7 -7zm-4 6h8v2h-8v-2z" fill="#e0e0e0" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
+<g transform="translate(0 -1036.4)" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
+<circle cx="8" cy="1044.4" r="8" fill-opacity=".39216" stroke-opacity=".98824"/>
+<path transform="translate(0 1036.4)" d="m8 1a7 7 0 0 0 -7 7 7 7 0 0 0 7 7 7 7 0 0 0 7 -7 7 7 0 0 0 -7 -7zm-4 6h8v2h-8v-2z" fill="#e0e0e0"/>
</g>
</svg>
diff --git a/editor/icons/icon_zoom_more.svg b/editor/icons/icon_zoom_more.svg
index 55323cf96e..be1e13d145 100644
--- a/editor/icons/icon_zoom_more.svg
+++ b/editor/icons/icon_zoom_more.svg
@@ -1,5 +1,6 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1036.4)">
-<path transform="translate(0 1036.4)" d="m8 1a7 7 0 0 0 -7 7 7 7 0 0 0 7 7 7 7 0 0 0 7 -7 7 7 0 0 0 -7 -7zm-1 3h2v3h3v2h-3v3h-2v-3h-3v-2h3v-3z" fill="#e0e0e0" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
+<g transform="translate(0 -1036.4)" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
+<circle cx="8" cy="1044.4" r="8" fill-opacity=".39216" stroke-opacity=".98824"/>
+<path transform="translate(0 1036.4)" d="m8 1a7 7 0 0 0 -7 7 7 7 0 0 0 7 7 7 7 0 0 0 7 -7 7 7 0 0 0 -7 -7zm-1 3h2v3h3v2h-3v3h-2v-3h-3v-2h3v-3z" fill="#e0e0e0"/>
</g>
</svg>
diff --git a/editor/icons/icon_zoom_reset.svg b/editor/icons/icon_zoom_reset.svg
index 3ba2a149c8..aa5ad03727 100644
--- a/editor/icons/icon_zoom_reset.svg
+++ b/editor/icons/icon_zoom_reset.svg
@@ -1,5 +1,6 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1036.4)">
-<path transform="translate(0 1036.4)" d="m8 1a7 7 0 0 0 -7 7 7 7 0 0 0 7 7 7 7 0 0 0 7 -7 7 7 0 0 0 -7 -7zm-0.029297 3.002a1.0001 1.0001 0 0 1 1.0293 0.99805v7h-2v-5.1309l-1.4453 0.96289-1.1094-1.6641 3-2a1.0001 1.0001 0 0 1 0.52539 -0.16602z" fill="#e0e0e0" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
+<g transform="translate(0 -1036.4)" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
+<circle cx="8" cy="1044.4" r="8" fill-opacity=".39216" stroke-opacity=".98824"/>
+<path transform="translate(0 1036.4)" d="m8 1a7 7 0 0 0 -7 7 7 7 0 0 0 7 7 7 7 0 0 0 7 -7 7 7 0 0 0 -7 -7zm-0.029297 3.002a1.0001 1.0001 0 0 1 1.0293 0.99805v7h-2v-5.1309l-1.4453 0.96289-1.1094-1.6641 3-2a1.0001 1.0001 0 0 1 0.52539 -0.16602z" fill="#e0e0e0"/>
</g>
</svg>
diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp
index 6a936649c3..4541c77085 100644
--- a/editor/import/resource_importer_obj.cpp
+++ b/editor/import/resource_importer_obj.cpp
@@ -40,12 +40,8 @@ uint32_t EditorOBJImporter::get_import_flags() const {
return IMPORT_SCENE;
}
-void EditorOBJImporter::get_extensions(List<String> *r_extensions) const {
- r_extensions->push_back("obj");
-}
-
-Error EditorOBJImporter::_parse_material_library(const String &p_path, Map<String, Ref<SpatialMaterial> > &material_map, List<String> *r_missing_deps) {
+static Error _parse_material_library(const String &p_path, Map<String, Ref<SpatialMaterial> > &material_map, List<String> *r_missing_deps) {
FileAccessRef f = FileAccess::open(p_path, FileAccess::READ);
ERR_FAIL_COND_V(!f, ERR_CANT_OPEN);
@@ -134,7 +130,7 @@ Error EditorOBJImporter::_parse_material_library(const String &p_path, Map<Strin
if (texture.is_valid()) {
current->set_texture(SpatialMaterial::TEXTURE_ALBEDO, texture);
- } else {
+ } else if (r_missing_deps) {
r_missing_deps->push_back(path);
}
@@ -149,7 +145,7 @@ Error EditorOBJImporter::_parse_material_library(const String &p_path, Map<Strin
if (texture.is_valid()) {
current->set_texture(SpatialMaterial::TEXTURE_METALLIC, texture);
- } else {
+ } else if (r_missing_deps) {
r_missing_deps->push_back(path);
}
@@ -164,7 +160,7 @@ Error EditorOBJImporter::_parse_material_library(const String &p_path, Map<Strin
if (texture.is_valid()) {
current->set_texture(SpatialMaterial::TEXTURE_ROUGHNESS, texture);
- } else {
+ } else if (r_missing_deps) {
r_missing_deps->push_back(path);
}
} else if (l.begins_with("map_bump ")) {
@@ -179,7 +175,7 @@ Error EditorOBJImporter::_parse_material_library(const String &p_path, Map<Strin
if (texture.is_valid()) {
current->set_feature(SpatialMaterial::FEATURE_NORMAL_MAPPING, true);
current->set_texture(SpatialMaterial::TEXTURE_NORMAL, texture);
- } else {
+ } else if (r_missing_deps) {
r_missing_deps->push_back(path);
}
} else if (f->eof_reached()) {
@@ -190,28 +186,16 @@ Error EditorOBJImporter::_parse_material_library(const String &p_path, Map<Strin
return OK;
}
-Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err) {
+static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p_single_mesh, bool p_generate_tangents, List<String> *r_missing_deps) {
FileAccessRef f = FileAccess::open(p_path, FileAccess::READ);
- if (r_err) {
- *r_err = ERR_CANT_OPEN;
- }
-
- ERR_FAIL_COND_V(!f, NULL);
-
- if (r_err) {
- *r_err = OK;
- }
-
- Spatial *scene = memnew(Spatial);
+ ERR_FAIL_COND_V(!f, ERR_CANT_OPEN);
Ref<ArrayMesh> mesh;
mesh.instance();
- Map<String, Ref<Material> > name_map;
-
- bool generate_tangents = p_flags & IMPORT_GENERATE_TANGENT_ARRAYS;
+ bool generate_tangents = p_generate_tangents;
bool flip_faces = false;
//bool flip_faces = p_options["force/flip_faces"];
//bool force_smooth = p_options["force/smooth_shading"];
@@ -239,7 +223,7 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in
if (l.begins_with("v ")) {
//vertex
Vector<String> v = l.split(" ", false);
- ERR_FAIL_COND_V(v.size() < 4, NULL);
+ ERR_FAIL_COND_V(v.size() < 4, ERR_FILE_CORRUPT);
Vector3 vtx;
vtx.x = v[1].to_float();
vtx.y = v[2].to_float();
@@ -248,7 +232,7 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in
} else if (l.begins_with("vt ")) {
//uv
Vector<String> v = l.split(" ", false);
- ERR_FAIL_COND_V(v.size() < 3, NULL);
+ ERR_FAIL_COND_V(v.size() < 3, ERR_FILE_CORRUPT);
Vector2 uv;
uv.x = v[1].to_float();
uv.y = 1.0 - v[2].to_float();
@@ -257,7 +241,7 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in
} else if (l.begins_with("vn ")) {
//normal
Vector<String> v = l.split(" ", false);
- ERR_FAIL_COND_V(v.size() < 4, NULL);
+ ERR_FAIL_COND_V(v.size() < 4, ERR_FILE_CORRUPT);
Vector3 nrm;
nrm.x = v[1].to_float();
nrm.y = v[2].to_float();
@@ -267,19 +251,19 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in
//vertex
Vector<String> v = l.split(" ", false);
- ERR_FAIL_COND_V(v.size() < 4, NULL);
+ ERR_FAIL_COND_V(v.size() < 4, ERR_FILE_CORRUPT);
//not very fast, could be sped up
Vector<String> face[3];
face[0] = v[1].split("/");
face[1] = v[2].split("/");
- ERR_FAIL_COND_V(face[0].size() == 0, NULL);
- ERR_FAIL_COND_V(face[0].size() != face[1].size(), NULL);
+ ERR_FAIL_COND_V(face[0].size() == 0, ERR_FILE_CORRUPT);
+ ERR_FAIL_COND_V(face[0].size() != face[1].size(), ERR_FILE_CORRUPT);
for (int i = 2; i < v.size() - 1; i++) {
face[2] = v[i + 1].split("/");
- ERR_FAIL_COND_V(face[0].size() != face[2].size(), NULL);
+ ERR_FAIL_COND_V(face[0].size() != face[2].size(), ERR_FILE_CORRUPT);
for (int j = 0; j < 3; j++) {
int idx = j;
@@ -292,7 +276,7 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in
int norm = face[idx][2].to_int() - 1;
if (norm < 0)
norm += normals.size() + 1;
- ERR_FAIL_INDEX_V(norm, normals.size(), NULL);
+ ERR_FAIL_INDEX_V(norm, normals.size(), ERR_FILE_CORRUPT);
surf_tool->add_normal(normals[norm]);
}
@@ -300,14 +284,14 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in
int uv = face[idx][1].to_int() - 1;
if (uv < 0)
uv += uvs.size() + 1;
- ERR_FAIL_INDEX_V(uv, uvs.size(), NULL);
+ ERR_FAIL_INDEX_V(uv, uvs.size(), ERR_FILE_CORRUPT);
surf_tool->add_uv(uvs[uv]);
}
int vtx = face[idx][0].to_int() - 1;
if (vtx < 0)
vtx += vertices.size() + 1;
- ERR_FAIL_INDEX_V(vtx, vertices.size(), NULL);
+ ERR_FAIL_INDEX_V(vtx, vertices.size(), ERR_FILE_CORRUPT);
Vector3 vertex = vertices[vtx];
//if (weld_vertices)
@@ -359,16 +343,13 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in
if (l.begins_with("o ") || f->eof_reached()) {
- MeshInstance *mi = memnew(MeshInstance);
- mi->set_name(name);
- mi->set_mesh(mesh);
-
- scene->add_child(mi);
- mi->set_owner(scene);
-
- mesh.instance();
- current_group = "";
- current_material = "";
+ if (!p_single_mesh) {
+ mesh->set_name(name);
+ r_meshes.push_back(mesh);
+ mesh.instance();
+ current_group = "";
+ current_material = "";
+ }
}
if (f->eof_reached()) {
@@ -406,16 +387,40 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in
}
}
- /*
- TODO, check existing materials and merge?
- //re-apply materials if exist
- for(int i=0;i<mesh->get_surface_count();i++) {
+ if (p_single_mesh) {
+
+ r_meshes.push_back(mesh);
+ }
+
+ return OK;
+}
+
+Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err) {
+
+ List<Ref<Mesh> > meshes;
+
+ Error err = _parse_obj(p_path, meshes, false, p_flags & IMPORT_GENERATE_TANGENT_ARRAYS, r_missing_deps);
+
+ if (err != OK) {
+ if (r_err) {
+ *r_err = err;
+ }
+ return NULL;
+ }
+
+ Spatial *scene = memnew(Spatial);
+
+ for (List<Ref<Mesh> >::Element *E = meshes.front(); E; E = E->next()) {
+
+ MeshInstance *mi = memnew(MeshInstance);
+ mi->set_name(E->get()->get_name());
+ scene->add_child(mi);
+ mi->set_owner(scene);
+ }
- String n = mesh->surface_get_name(i);
- if (name_map.has(n))
- mesh->surface_set_material(i,name_map[n]);
+ if (r_err) {
+ *r_err = OK;
}
-*/
return scene;
}
@@ -423,5 +428,68 @@ Ref<Animation> EditorOBJImporter::import_animation(const String &p_path, uint32_
return Ref<Animation>();
}
+
+void EditorOBJImporter::get_extensions(List<String> *r_extensions) const {
+
+ r_extensions->push_back("obj");
+}
+
EditorOBJImporter::EditorOBJImporter() {
}
+////////////////////////////////////////////////////
+
+String ResourceImporterOBJ::get_importer_name() const {
+ return "wavefront_obj";
+}
+String ResourceImporterOBJ::get_visible_name() const {
+ return "OBJ As Mesh";
+}
+void ResourceImporterOBJ::get_recognized_extensions(List<String> *p_extensions) const {
+
+ p_extensions->push_back("obj");
+}
+String ResourceImporterOBJ::get_save_extension() const {
+ return "mesh";
+}
+String ResourceImporterOBJ::get_resource_type() const {
+ return "Mesh";
+}
+
+int ResourceImporterOBJ::get_preset_count() const {
+ return 0;
+}
+String ResourceImporterOBJ::get_preset_name(int p_idx) const {
+ return "";
+}
+
+void ResourceImporterOBJ::get_import_options(List<ImportOption> *r_options, int p_preset) const {
+
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "generate_tangents"), true));
+}
+bool ResourceImporterOBJ::get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const {
+
+ return true;
+}
+
+Error ResourceImporterOBJ::import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files) {
+
+ List<Ref<Mesh> > meshes;
+
+ Error err = _parse_obj(p_source_file, meshes, true, p_options["generate_tangents"], NULL);
+
+ ERR_FAIL_COND_V(err != OK, err);
+ ERR_FAIL_COND_V(meshes.size() != 1, ERR_BUG);
+
+ String save_path = p_save_path + ".mesh";
+
+ err = ResourceSaver::save(save_path, meshes.front()->get());
+
+ ERR_FAIL_COND_V(err != OK, err);
+
+ r_gen_files->push_back(save_path);
+
+ return OK;
+}
+
+ResourceImporterOBJ::ResourceImporterOBJ() {
+}
diff --git a/editor/import/resource_importer_obj.h b/editor/import/resource_importer_obj.h
index 247d58e148..7eeceeabbe 100644
--- a/editor/import/resource_importer_obj.h
+++ b/editor/import/resource_importer_obj.h
@@ -36,8 +36,6 @@ class EditorOBJImporter : public EditorSceneImporter {
GDCLASS(EditorOBJImporter, EditorSceneImporter);
- Error _parse_material_library(const String &p_path, Map<String, Ref<SpatialMaterial> > &material_map, List<String> *r_missing_deps);
-
public:
virtual uint32_t get_import_flags() const;
virtual void get_extensions(List<String> *r_extensions) const;
@@ -47,4 +45,24 @@ public:
EditorOBJImporter();
};
+class ResourceImporterOBJ : public ResourceImporter {
+ GDCLASS(ResourceImporterOBJ, ResourceImporter)
+public:
+ virtual String get_importer_name() const;
+ virtual String get_visible_name() const;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const;
+ virtual String get_save_extension() const;
+ virtual String get_resource_type() const;
+
+ virtual int get_preset_count() const;
+ virtual String get_preset_name(int p_idx) const;
+
+ virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
+ virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
+
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL);
+
+ ResourceImporterOBJ();
+};
+
#endif // RESOURCEIMPORTEROBJ_H
diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp
index 112e3abcb5..77fd6d883a 100644
--- a/editor/import_dock.cpp
+++ b/editor/import_dock.cpp
@@ -137,7 +137,7 @@ void ImportDock::set_edit_path(const String &p_path) {
preset->get_popup()->add_separator();
preset->get_popup()->add_item(vformat(TTR("Set as Default for '%s'"), params->importer->get_visible_name()), ITEM_SET_AS_DEFAULT);
- if (ProjectSettings::get_singleton()->has("importer_defaults/" + params->importer->get_importer_name())) {
+ if (ProjectSettings::get_singleton()->has_setting("importer_defaults/" + params->importer->get_importer_name())) {
preset->get_popup()->add_item(TTR("Load Default"), ITEM_LOAD_DEFAULT);
preset->get_popup()->add_separator();
preset->get_popup()->add_item(vformat(TTR("Clear Default for '%s'"), params->importer->get_visible_name()), ITEM_CLEAR_DEFAULT);
@@ -281,7 +281,7 @@ void ImportDock::_preset_selected(int p_idx) {
} break;
case ITEM_LOAD_DEFAULT: {
- ERR_FAIL_COND(!ProjectSettings::get_singleton()->has("importer_defaults/" + params->importer->get_importer_name()));
+ ERR_FAIL_COND(!ProjectSettings::get_singleton()->has_setting("importer_defaults/" + params->importer->get_importer_name()));
Dictionary d = ProjectSettings::get_singleton()->get("importer_defaults/" + params->importer->get_importer_name());
List<Variant> v;
diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp
new file mode 100644
index 0000000000..2fd74d529e
--- /dev/null
+++ b/editor/plugins/abstract_polygon_2d_editor.cpp
@@ -0,0 +1,619 @@
+/*************************************************************************/
+/* abstract_polygon_2d_editor.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "abstract_polygon_2d_editor.h"
+
+#include "canvas_item_editor_plugin.h"
+
+bool AbstractPolygon2DEditor::_is_empty() const {
+
+ if (!_get_node())
+ return true;
+
+ const int n = _get_polygon_count();
+
+ for (int i = 0; i < n; i++) {
+
+ Vector<Vector2> vertices = _get_polygon(i);
+
+ if (vertices.size() != 0)
+ return false;
+ }
+
+ return true;
+}
+
+int AbstractPolygon2DEditor::_get_polygon_count() const {
+
+ return 1;
+}
+
+Variant AbstractPolygon2DEditor::_get_polygon(int p_idx) const {
+
+ return _get_node()->get("polygon");
+}
+
+void AbstractPolygon2DEditor::_set_polygon(int p_idx, const Variant &p_polygon) const {
+
+ _get_node()->set("polygon", p_polygon);
+}
+
+void AbstractPolygon2DEditor::_action_set_polygon(int p_idx, const Variant &p_previous, const Variant &p_polygon) {
+
+ Node2D *node = _get_node();
+ undo_redo->add_do_method(node, "set_polygon", p_polygon);
+ undo_redo->add_undo_method(node, "set_polygon", p_previous);
+}
+
+Vector2 AbstractPolygon2DEditor::_get_offset(int p_idx) const {
+
+ return Vector2(0, 0);
+}
+
+void AbstractPolygon2DEditor::_commit_action() {
+
+ undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->commit_action();
+}
+
+void AbstractPolygon2DEditor::_action_add_polygon(const Variant &p_polygon) {
+
+ _action_set_polygon(0, p_polygon);
+}
+
+void AbstractPolygon2DEditor::_action_remove_polygon(int p_idx) {
+
+ _action_set_polygon(p_idx, _get_polygon(p_idx), PoolVector<Vector2>());
+}
+
+void AbstractPolygon2DEditor::_action_set_polygon(int p_idx, const Variant &p_polygon) {
+
+ _action_set_polygon(p_idx, _get_polygon(p_idx), p_polygon);
+}
+
+bool AbstractPolygon2DEditor::_has_resource() const {
+
+ return true;
+}
+
+void AbstractPolygon2DEditor::_create_resource() {
+}
+
+void AbstractPolygon2DEditor::_menu_option(int p_option) {
+
+ switch (p_option) {
+
+ case MODE_CREATE: {
+
+ mode = MODE_CREATE;
+ button_create->set_pressed(true);
+ button_edit->set_pressed(false);
+ } break;
+ case MODE_EDIT: {
+
+ mode = MODE_EDIT;
+ button_create->set_pressed(false);
+ button_edit->set_pressed(true);
+ } break;
+ }
+}
+
+void AbstractPolygon2DEditor::_notification(int p_what) {
+
+ switch (p_what) {
+
+ case NOTIFICATION_READY: {
+
+ button_create->set_icon(get_icon("Edit", "EditorIcons"));
+ button_edit->set_icon(get_icon("MovePoint", "EditorIcons"));
+ button_edit->set_pressed(true);
+
+ get_tree()->connect("node_removed", this, "_node_removed");
+
+ create_resource->connect("confirmed", this, "_create_resource");
+
+ } break;
+ case NOTIFICATION_PHYSICS_PROCESS: {
+
+ } break;
+ }
+}
+
+void AbstractPolygon2DEditor::_node_removed(Node *p_node) {
+
+ if (p_node == _get_node()) {
+ edit(NULL);
+ hide();
+
+ canvas_item_editor->get_viewport_control()->update();
+ }
+}
+
+void AbstractPolygon2DEditor::_wip_close() {
+
+ if (wip.size() >= 3) {
+
+ undo_redo->create_action(TTR("Create Poly"));
+ _action_add_polygon(wip);
+ _commit_action();
+
+ mode = MODE_EDIT;
+ button_edit->set_pressed(true);
+ button_create->set_pressed(false);
+ }
+
+ wip.clear();
+ wip_active = false;
+ edited_point = -1;
+}
+
+bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
+
+ if (!_get_node())
+ return false;
+
+ Ref<InputEventMouseButton> mb = p_event;
+
+ if (!_has_resource()) {
+
+ if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_pressed()) {
+ create_resource->set_text(String("No polygon resource on this node.\nCreate and assign one?"));
+ create_resource->popup_centered_minsize();
+ }
+ return (mb.is_valid() && mb->get_button_index() == 1);
+ }
+
+ if (mb.is_valid()) {
+
+ Transform2D xform = canvas_item_editor->get_canvas_transform() * _get_node()->get_global_transform();
+
+ Vector2 gpoint = mb->get_position();
+ Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
+ cpoint = canvas_item_editor->snap_point(cpoint);
+ cpoint = _get_node()->get_global_transform().affine_inverse().xform(cpoint);
+
+ //first check if a point is to be added (segment split)
+ real_t grab_threshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8);
+
+ if (mode == MODE_CREATE) {
+
+ if (mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) {
+
+ if (!wip_active) {
+
+ wip.clear();
+ wip.push_back(cpoint);
+ wip_active = true;
+ edited_point_pos = cpoint;
+ edited_polygon = -1;
+ edited_point = 1;
+ canvas_item_editor->get_viewport_control()->update();
+ return true;
+ } else {
+
+ if (wip.size() > 1 && xform.xform(wip[0]).distance_to(gpoint) < grab_threshold) {
+ //wip closed
+ _wip_close();
+
+ return true;
+ } else {
+
+ wip.push_back(cpoint);
+ edited_point = wip.size();
+ canvas_item_editor->get_viewport_control()->update();
+ return true;
+
+ //add wip point
+ }
+ }
+ } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && wip_active) {
+ _wip_close();
+ }
+ } else if (mode == MODE_EDIT) {
+
+ if (mb->get_button_index() == BUTTON_LEFT) {
+
+ if (mb->is_pressed()) {
+
+ if (mb->get_control()) {
+
+ const int n_polygons = _get_polygon_count();
+
+ if (n_polygons >= 1) {
+
+ Vector<Vector2> vertices = _get_polygon(n_polygons - 1);
+
+ if (vertices.size() < 3) {
+
+ vertices.push_back(cpoint);
+ undo_redo->create_action(TTR("Edit Poly"));
+ _action_set_polygon(n_polygons - 1, vertices);
+ _commit_action();
+ return true;
+ }
+ }
+
+ //search edges
+ int closest_poly = -1;
+ int closest_idx = -1;
+ Vector2 closest_pos;
+ real_t closest_dist = 1e10;
+
+ for (int j = 0; j < n_polygons; j++) {
+
+ PoolVector<Vector2> points = _get_polygon(j);
+ const Vector2 offset = _get_offset(j);
+ const int n_points = points.size();
+
+ for (int i = 0; i < n_points; i++) {
+
+ Vector2 p[2] = { xform.xform(points[i] + offset),
+ xform.xform(points[(i + 1) % n_points] + offset) };
+
+ Vector2 cp = Geometry::get_closest_point_to_segment_2d(gpoint, p);
+ if (cp.distance_squared_to(points[0]) < CMP_EPSILON2 || cp.distance_squared_to(points[1]) < CMP_EPSILON2)
+ continue; //not valid to reuse point
+
+ real_t d = cp.distance_to(gpoint);
+ if (d < closest_dist && d < grab_threshold) {
+ closest_poly = j;
+ closest_dist = d;
+ closest_pos = cp;
+ closest_idx = i;
+ }
+ }
+ }
+
+ if (closest_idx >= 0) {
+
+ Vector<Vector2> vertices = _get_polygon(closest_poly);
+ pre_move_edit = vertices;
+ vertices.insert(closest_idx + 1, xform.affine_inverse().xform(closest_pos));
+ edited_point = closest_idx + 1;
+ edited_polygon = closest_poly;
+ edited_point_pos = xform.affine_inverse().xform(closest_pos);
+
+ undo_redo->create_action(TTR("Insert Point"));
+ _action_set_polygon(closest_poly, vertices);
+ _commit_action();
+
+ return true;
+ }
+ } else {
+
+ //look for points to move
+ int closest_poly = -1;
+ int closest_idx = -1;
+ Vector2 closest_pos;
+ real_t closest_dist = 1e10;
+
+ const int n_polygons = _get_polygon_count();
+
+ for (int j = 0; j < n_polygons; j++) {
+
+ PoolVector<Vector2> points = _get_polygon(j);
+ const Vector2 offset = _get_offset(j);
+ const int n_points = points.size();
+
+ for (int i = 0; i < n_points; i++) {
+
+ Vector2 cp = xform.xform(points[i] + offset);
+
+ real_t d = cp.distance_to(gpoint);
+ if (d < closest_dist && d < grab_threshold) {
+ closest_poly = j;
+ closest_dist = d;
+ closest_pos = cp;
+ closest_idx = i;
+ }
+ }
+ }
+
+ if (closest_idx >= 0) {
+
+ pre_move_edit = _get_polygon(closest_poly);
+ edited_polygon = closest_poly;
+ edited_point = closest_idx;
+ edited_point_pos = xform.affine_inverse().xform(closest_pos);
+ canvas_item_editor->get_viewport_control()->update();
+ return true;
+ }
+ }
+ } else {
+
+ if (edited_point != -1) {
+
+ //apply
+
+ Vector<Vector2> vertices = _get_polygon(edited_polygon);
+ ERR_FAIL_INDEX_V(edited_point, vertices.size(), false);
+ vertices[edited_point] = edited_point_pos - _get_offset(edited_polygon);
+
+ undo_redo->create_action(TTR("Edit Poly"));
+ _action_set_polygon(edited_polygon, pre_move_edit, vertices);
+ _commit_action();
+
+ edited_point = -1;
+ return true;
+ }
+ }
+ } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && edited_point == -1) {
+
+ int closest_poly = -1;
+ int closest_idx = -1;
+ Vector2 closest_pos;
+ real_t closest_dist = 1e10;
+ const int n_polygons = _get_polygon_count();
+
+ for (int j = 0; j < n_polygons; j++) {
+
+ PoolVector<Vector2> points = _get_polygon(j);
+ const int n_points = points.size();
+ const Vector2 offset = _get_offset(j);
+
+ for (int i = 0; i < n_points; i++) {
+
+ Vector2 cp = xform.xform(points[i] + offset);
+
+ real_t d = cp.distance_to(gpoint);
+ if (d < closest_dist && d < grab_threshold) {
+ closest_poly = j;
+ closest_dist = d;
+ closest_pos = cp;
+ closest_idx = i;
+ }
+ }
+ }
+
+ if (closest_idx >= 0) {
+
+ PoolVector<Vector2> vertices = _get_polygon(closest_poly);
+
+ if (vertices.size() > 3) {
+
+ vertices.remove(closest_idx);
+
+ undo_redo->create_action(TTR("Edit Poly (Remove Point)"));
+ _action_set_polygon(closest_poly, vertices);
+ _commit_action();
+ } else {
+
+ undo_redo->create_action(TTR("Remove Poly And Point"));
+ _action_remove_polygon(closest_poly);
+ _commit_action();
+ }
+
+ if (_is_empty())
+ _menu_option(MODE_CREATE);
+ return true;
+ }
+ }
+ }
+ }
+
+ Ref<InputEventMouseMotion> mm = p_event;
+
+ if (mm.is_valid()) {
+
+ if (edited_point != -1 && (wip_active || (mm->get_button_mask() & BUTTON_MASK_LEFT))) {
+
+ Vector2 gpoint = mm->get_position();
+ Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
+ cpoint = canvas_item_editor->snap_point(cpoint);
+ edited_point_pos = _get_node()->get_global_transform().affine_inverse().xform(cpoint);
+
+ if (!wip_active) {
+
+ Vector<Vector2> vertices = _get_polygon(edited_polygon);
+ ERR_FAIL_INDEX_V(edited_point, vertices.size(), false);
+ vertices[edited_point] = edited_point_pos - _get_offset(edited_polygon);
+ _set_polygon(edited_polygon, vertices);
+ }
+
+ canvas_item_editor->get_viewport_control()->update();
+ }
+ }
+
+ return false;
+}
+
+void AbstractPolygon2DEditor::_canvas_draw() {
+
+ if (!_get_node())
+ return;
+
+ Control *vpc = canvas_item_editor->get_viewport_control();
+
+ Transform2D xform = canvas_item_editor->get_canvas_transform() * _get_node()->get_global_transform();
+ Ref<Texture> handle = get_icon("EditorHandle", "EditorIcons");
+ const int n_polygons = _get_polygon_count();
+
+ for (int j = -1; j < n_polygons; j++) {
+
+ if (wip_active && wip_destructive && j != -1)
+ continue;
+
+ PoolVector<Vector2> points;
+ Vector2 offset;
+
+ if (wip_active && j == edited_polygon) {
+
+ points = Variant(wip);
+ offset = Vector2(0, 0);
+ } else {
+
+ if (j == -1)
+ continue;
+ points = _get_polygon(j);
+ offset = _get_offset(j);
+ }
+
+ if (!wip_active && j == edited_polygon && edited_point >= 0 && EDITOR_DEF("editors/poly_editor/show_previous_outline", true)) {
+
+ const Color col = Color(0.5, 0.5, 0.5); // FIXME polygon->get_outline_color();
+ const int n = pre_move_edit.size();
+ for (int i = 0; i < n; i++) {
+
+ Vector2 p, p2;
+ p = pre_move_edit[i] + offset;
+ p2 = pre_move_edit[(i + 1) % n] + offset;
+
+ Vector2 point = xform.xform(p);
+ Vector2 next_point = xform.xform(p2);
+
+ vpc->draw_line(point, next_point, col, 2);
+ }
+ }
+
+ const int n_points = points.size();
+ const Color col = Color(1, 0.3, 0.1, 0.8);
+
+ for (int i = 0; i < n_points; i++) {
+
+ Vector2 p, p2;
+ p = (j == edited_polygon && i == edited_point) ? edited_point_pos : (points[i] + offset);
+ if (j == edited_polygon && ((wip_active && i == n_points - 1) || (((i + 1) % n_points) == edited_point)))
+ p2 = edited_point_pos;
+ else
+ p2 = points[(i + 1) % n_points] + offset;
+
+ Vector2 point = xform.xform(p);
+ Vector2 next_point = xform.xform(p2);
+
+ vpc->draw_line(point, next_point, col, 2);
+ vpc->draw_texture(handle, point - handle->get_size() * 0.5);
+ }
+ }
+}
+
+void AbstractPolygon2DEditor::edit(Node *p_polygon) {
+
+ if (!canvas_item_editor) {
+ canvas_item_editor = CanvasItemEditor::get_singleton();
+ }
+
+ if (p_polygon) {
+
+ _set_node(p_polygon);
+
+ //Enable the pencil tool if the polygon is empty
+ if (_is_empty())
+ _menu_option(MODE_CREATE);
+
+ if (!canvas_item_editor->get_viewport_control()->is_connected("draw", this, "_canvas_draw"))
+ canvas_item_editor->get_viewport_control()->connect("draw", this, "_canvas_draw");
+
+ wip.clear();
+ wip_active = false;
+ edited_point = -1;
+
+ canvas_item_editor->get_viewport_control()->update();
+
+ } else {
+
+ _set_node(NULL);
+
+ if (canvas_item_editor->get_viewport_control()->is_connected("draw", this, "_canvas_draw"))
+ canvas_item_editor->get_viewport_control()->disconnect("draw", this, "_canvas_draw");
+ }
+}
+
+void AbstractPolygon2DEditor::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_canvas_draw"), &AbstractPolygon2DEditor::_canvas_draw);
+ ClassDB::bind_method(D_METHOD("_node_removed"), &AbstractPolygon2DEditor::_node_removed);
+ ClassDB::bind_method(D_METHOD("_menu_option"), &AbstractPolygon2DEditor::_menu_option);
+ ClassDB::bind_method(D_METHOD("_create_resource"), &AbstractPolygon2DEditor::_create_resource);
+}
+
+AbstractPolygon2DEditor::AbstractPolygon2DEditor(EditorNode *p_editor, bool p_wip_destructive) {
+
+ canvas_item_editor = NULL;
+ editor = p_editor;
+ undo_redo = editor->get_undo_redo();
+
+ wip_active = false;
+ edited_polygon = -1;
+ wip_destructive = p_wip_destructive;
+
+ add_child(memnew(VSeparator));
+ button_create = memnew(ToolButton);
+ add_child(button_create);
+ button_create->connect("pressed", this, "_menu_option", varray(MODE_CREATE));
+ button_create->set_toggle_mode(true);
+ button_create->set_tooltip(TTR("Create a new polygon from scratch."));
+
+ button_edit = memnew(ToolButton);
+ add_child(button_edit);
+ button_edit->connect("pressed", this, "_menu_option", varray(MODE_EDIT));
+ button_edit->set_toggle_mode(true);
+ button_edit->set_tooltip(TTR("Edit existing polygon:\nLMB: Move Point.\nCtrl+LMB: Split Segment.\nRMB: Erase Point."));
+
+ create_resource = memnew(ConfirmationDialog);
+ add_child(create_resource);
+ create_resource->get_ok()->set_text(TTR("Create"));
+
+ mode = MODE_EDIT;
+}
+
+void AbstractPolygon2DEditorPlugin::edit(Object *p_object) {
+
+ polygon_editor->edit(Object::cast_to<Node>(p_object));
+}
+
+bool AbstractPolygon2DEditorPlugin::handles(Object *p_object) const {
+
+ return p_object->is_class(klass);
+}
+
+void AbstractPolygon2DEditorPlugin::make_visible(bool p_visible) {
+
+ if (p_visible) {
+
+ polygon_editor->show();
+ } else {
+
+ polygon_editor->hide();
+ polygon_editor->edit(NULL);
+ }
+}
+
+AbstractPolygon2DEditorPlugin::AbstractPolygon2DEditorPlugin(EditorNode *p_node, AbstractPolygon2DEditor *p_polygon_editor, String p_class) {
+
+ editor = p_node;
+ polygon_editor = p_polygon_editor;
+ klass = p_class;
+ CanvasItemEditor::get_singleton()->add_control_to_menu_panel(polygon_editor);
+
+ polygon_editor->hide();
+}
+
+AbstractPolygon2DEditorPlugin::~AbstractPolygon2DEditorPlugin() {
+}
diff --git a/editor/plugins/abstract_polygon_2d_editor.h b/editor/plugins/abstract_polygon_2d_editor.h
new file mode 100644
index 0000000000..86e14694da
--- /dev/null
+++ b/editor/plugins/abstract_polygon_2d_editor.h
@@ -0,0 +1,131 @@
+/*************************************************************************/
+/* abstract_polygon_2d_editor.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef ABSTRACT_POLYGON_2D_EDITOR_H
+#define ABSTRACT_POLYGON_2D_EDITOR_H
+
+#include "editor/editor_node.h"
+#include "editor/editor_plugin.h"
+#include "scene/2d/polygon_2d.h"
+#include "scene/gui/tool_button.h"
+
+/**
+ @author Juan Linietsky <reduzio@gmail.com>
+*/
+class CanvasItemEditor;
+
+class AbstractPolygon2DEditor : public HBoxContainer {
+
+ GDCLASS(AbstractPolygon2DEditor, HBoxContainer);
+
+ ToolButton *button_create;
+ ToolButton *button_edit;
+
+ int edited_polygon;
+ int edited_point;
+ Vector2 edited_point_pos;
+ Vector<Vector2> pre_move_edit;
+ Vector<Vector2> wip;
+ bool wip_active;
+ bool wip_destructive;
+
+ CanvasItemEditor *canvas_item_editor;
+ EditorNode *editor;
+ Panel *panel;
+ ConfirmationDialog *create_resource;
+
+protected:
+ enum {
+
+ MODE_CREATE,
+ MODE_EDIT,
+ MODE_CONT,
+
+ };
+
+ int mode;
+
+ UndoRedo *undo_redo;
+
+ virtual void _menu_option(int p_option);
+ void _wip_close();
+ void _canvas_draw();
+
+ void _notification(int p_what);
+ void _node_removed(Node *p_node);
+ static void _bind_methods();
+
+ bool _is_empty() const;
+ void _commit_action();
+
+protected:
+ virtual Node2D *_get_node() const = 0;
+ virtual void _set_node(Node *p_polygon) = 0;
+
+ virtual int _get_polygon_count() const;
+ virtual Vector2 _get_offset(int p_idx) const;
+ virtual Variant _get_polygon(int p_idx) const;
+ virtual void _set_polygon(int p_idx, const Variant &p_polygon) const;
+
+ virtual void _action_add_polygon(const Variant &p_polygon);
+ virtual void _action_remove_polygon(int p_idx);
+ virtual void _action_set_polygon(int p_idx, const Variant &p_polygon);
+ virtual void _action_set_polygon(int p_idx, const Variant &p_previous, const Variant &p_polygon);
+
+ virtual bool _has_resource() const;
+ virtual void _create_resource();
+
+public:
+ bool forward_gui_input(const Ref<InputEvent> &p_event);
+ void edit(Node *p_polygon);
+ AbstractPolygon2DEditor(EditorNode *p_editor, bool p_wip_destructive = true);
+};
+
+class AbstractPolygon2DEditorPlugin : public EditorPlugin {
+
+ GDCLASS(AbstractPolygon2DEditorPlugin, EditorPlugin);
+
+ AbstractPolygon2DEditor *polygon_editor;
+ EditorNode *editor;
+ String klass;
+
+public:
+ virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const Ref<InputEvent> &p_event) { return polygon_editor->forward_gui_input(p_event); }
+
+ bool has_main_screen() const { return false; }
+ virtual String get_name() const { return klass; }
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
+ virtual void make_visible(bool p_visible);
+
+ AbstractPolygon2DEditorPlugin(EditorNode *p_node, AbstractPolygon2DEditor *p_polygon_editor, String p_class);
+ ~AbstractPolygon2DEditorPlugin();
+};
+
+#endif // ABSTRACT_POLYGON_2D_EDITOR_H
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index de905d80ef..bdfe380211 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -1426,7 +1426,7 @@ AnimationPlayerEditorPlugin::AnimationPlayerEditorPlugin(EditorNode *p_node) {
editor->add_bottom_panel_item(TTR("Animation"), anim_editor);
/*
editor->get_viewport()->add_child(anim_editor);
- anim_editor->set_area_as_parent_rect();
+ anim_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE);
anim_editor->set_anchor( MARGIN_TOP, Control::ANCHOR_END);
anim_editor->set_margin( MARGIN_TOP, 75 );
anim_editor->set_anchor( MARGIN_RIGHT, Control::ANCHOR_END);
diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp
index 4dd877a6ee..22d23e1c72 100644
--- a/editor/plugins/animation_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_tree_editor_plugin.cpp
@@ -1419,13 +1419,13 @@ void AnimationTreeEditorPlugin::make_visible(bool p_visible) {
//editor->animation_panel_make_visible(true);
button->show();
editor->make_bottom_panel_item_visible(anim_tree_editor);
- anim_tree_editor->set_fixed_process(true);
+ anim_tree_editor->set_physics_process(true);
} else {
if (anim_tree_editor->is_visible_in_tree())
editor->hide_bottom_panel();
button->hide();
- anim_tree_editor->set_fixed_process(false);
+ anim_tree_editor->set_physics_process(false);
}
}
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp
index 626b4f5a7f..cd53264437 100644
--- a/editor/plugins/asset_library_editor_plugin.cpp
+++ b/editor/plugins/asset_library_editor_plugin.cpp
@@ -1434,7 +1434,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
error_hb = memnew(HBoxContainer);
library_main->add_child(error_hb);
error_label = memnew(Label);
- error_label->add_color_override("color", Color(1, 0.4, 0.3));
+ error_label->add_color_override("color", get_color("error_color", "Editor"));
error_hb->add_child(error_label);
description = NULL;
@@ -1478,7 +1478,7 @@ AssetLibraryEditorPlugin::AssetLibraryEditorPlugin(EditorNode *p_node) {
addon_library = memnew(EditorAssetLibrary);
addon_library->set_v_size_flags(Control::SIZE_EXPAND_FILL);
editor->get_viewport()->add_child(addon_library);
- addon_library->set_area_as_parent_rect();
+ addon_library->set_anchors_and_margins_preset(Control::PRESET_WIDE);
addon_library->hide();
}
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index bc5f11e734..4b216d63f5 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -990,9 +990,10 @@ void CanvasItemEditor::_prepare_drag(const Point2 &p_click_pos) {
se->undo_pivot = Object::cast_to<Control>(canvas_item)->get_pivot_offset();
se->pre_drag_xform = canvas_item->get_global_transform_with_canvas();
+ se->pre_drag_rect = canvas_item->get_item_rect();
}
- if (selection.size() == 1 && Object::cast_to<Node2D>(selection[0])) {
+ if (selection.size() == 1 && Object::cast_to<Node2D>(selection[0]) && bone_ik_list.size() == 0) {
drag = DRAG_NODE_2D;
drag_point_from = Object::cast_to<Node2D>(selection[0])->get_global_position();
} else {
@@ -1219,50 +1220,26 @@ void CanvasItemEditor::_viewport_base_gui_input(const Ref<InputEvent> &p_event)
if (b->get_button_index() == BUTTON_WHEEL_DOWN) {
// Scroll or pan down
if (bool(EditorSettings::get_singleton()->get("editors/2d/scroll_to_pan"))) {
-
v_scroll->set_value(v_scroll->get_value() + int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor());
-
+ _update_scroll(0);
+ viewport->update();
} else {
-
- if (zoom < MIN_ZOOM)
- return;
-
- float prev_zoom = zoom;
- zoom = zoom * (1 - (0.05 * b->get_factor()));
- {
- Point2 ofs = viewport_scrollable->get_transform().affine_inverse().xform(b->get_position());
- ofs = ofs / prev_zoom - ofs / zoom;
- h_scroll->set_value(h_scroll->get_value() + ofs.x);
- v_scroll->set_value(v_scroll->get_value() + ofs.y);
- }
+ _zoom_on_position(zoom * (1 - (0.05 * b->get_factor())), viewport_scrollable->get_transform().affine_inverse().xform(b->get_position()));
}
- _update_scroll(0);
- viewport->update();
return;
}
if (b->get_button_index() == BUTTON_WHEEL_UP) {
// Scroll or pan up
if (bool(EditorSettings::get_singleton()->get("editors/2d/scroll_to_pan"))) {
-
v_scroll->set_value(v_scroll->get_value() - int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor());
-
+ _update_scroll(0);
+ viewport->update();
} else {
- if (zoom > MAX_ZOOM) return;
-
- float prev_zoom = zoom;
- zoom = zoom * ((0.95 + (0.05 * b->get_factor())) / 0.95);
- {
- Point2 ofs = viewport_scrollable->get_transform().affine_inverse().xform(b->get_position());
- ofs = ofs / prev_zoom - ofs / zoom;
- h_scroll->set_value(h_scroll->get_value() + ofs.x);
- v_scroll->set_value(v_scroll->get_value() + ofs.y);
- }
+ _zoom_on_position(zoom * ((0.95 + (0.05 * b->get_factor())) / 0.95), viewport_scrollable->get_transform().affine_inverse().xform(b->get_position()));
}
- _update_scroll(0);
- viewport->update();
return;
}
@@ -1541,6 +1518,7 @@ void CanvasItemEditor::_viewport_base_gui_input(const Ref<InputEvent> &p_event)
if (Object::cast_to<Control>(canvas_item))
se->undo_pivot = Object::cast_to<Control>(canvas_item)->get_pivot_offset();
se->pre_drag_xform = canvas_item->get_global_transform_with_canvas();
+ se->pre_drag_rect = canvas_item->get_item_rect();
return;
}
@@ -1563,6 +1541,7 @@ void CanvasItemEditor::_viewport_base_gui_input(const Ref<InputEvent> &p_event)
if (Object::cast_to<Control>(canvas_item))
se->undo_pivot = Object::cast_to<Control>(canvas_item)->get_pivot_offset();
se->pre_drag_xform = canvas_item->get_global_transform_with_canvas();
+ se->pre_drag_rect = canvas_item->get_item_rect();
return;
}
@@ -1574,6 +1553,7 @@ void CanvasItemEditor::_viewport_base_gui_input(const Ref<InputEvent> &p_event)
drag_from = transform.affine_inverse().xform(click);
se->undo_state = canvas_item->edit_get_state();
se->pre_drag_xform = canvas_item->get_global_transform_with_canvas();
+ se->pre_drag_rect = canvas_item->get_item_rect();
return;
}
}
@@ -2230,16 +2210,16 @@ void CanvasItemEditor::_draw_selection() {
Rect2 rect = canvas_item->get_item_rect();
- if (drag != DRAG_NONE && drag != DRAG_PIVOT) {
+ if (show_helpers && drag != DRAG_NONE && drag != DRAG_PIVOT) {
const Transform2D pre_drag_xform = transform * se->pre_drag_xform;
const Color pre_drag_color = Color(0.4, 0.6, 1, 0.7);
Vector2 pre_drag_endpoints[4] = {
- pre_drag_xform.xform(rect.position),
- pre_drag_xform.xform(rect.position + Vector2(rect.size.x, 0)),
- pre_drag_xform.xform(rect.position + rect.size),
- pre_drag_xform.xform(rect.position + Vector2(0, rect.size.y))
+ pre_drag_xform.xform(se->pre_drag_rect.position),
+ pre_drag_xform.xform(se->pre_drag_rect.position + Vector2(se->pre_drag_rect.size.x, 0)),
+ pre_drag_xform.xform(se->pre_drag_rect.position + se->pre_drag_rect.size),
+ pre_drag_xform.xform(se->pre_drag_rect.position + Vector2(0, se->pre_drag_rect.size.y))
};
for (int i = 0; i < 4; i++) {
@@ -2595,12 +2575,12 @@ void CanvasItemEditor::_draw_locks_and_groups(Node *p_node, const Transform2D &p
}
if (ci) {
- Ref<Texture> lock = get_icon("Lock", "EditorIcons");
+ Ref<Texture> lock = get_icon("LockViewport", "EditorIcons");
if (p_node->has_meta("_edit_lock_")) {
lock->draw(viewport_ci, transform_ci.xform(Point2(0, 0)));
}
- Ref<Texture> group = get_icon("Group", "EditorIcons");
+ Ref<Texture> group = get_icon("GroupViewport", "EditorIcons");
if (ci->has_meta("_edit_group_")) {
Vector2 ofs = transform_ci.xform(Point2(0, 0));
if (ci->has_meta("_edit_lock_"))
@@ -2668,13 +2648,13 @@ void CanvasItemEditor::_draw_viewport() {
all_group = false;
} else {
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- if (Object::cast_to<Control>(E->get()) && !Object::cast_to<Control>(E->get())->has_meta("_edit_lock_")) {
+ if (Object::cast_to<CanvasItem>(E->get()) && !Object::cast_to<CanvasItem>(E->get())->has_meta("_edit_lock_")) {
all_locked = false;
break;
}
}
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- if (Object::cast_to<Control>(E->get()) && !Object::cast_to<Control>(E->get())->has_meta("_edit_group_")) {
+ if (Object::cast_to<CanvasItem>(E->get()) && !Object::cast_to<CanvasItem>(E->get())->has_meta("_edit_group_")) {
all_group = false;
break;
}
@@ -2693,7 +2673,8 @@ void CanvasItemEditor::_draw_viewport() {
_draw_grid();
_draw_selection();
_draw_axis();
- _draw_locks_and_groups(editor->get_edited_scene(), transform);
+ if (editor->get_edited_scene())
+ _draw_locks_and_groups(editor->get_edited_scene(), transform);
RID ci = viewport->get_canvas_item();
VisualServer::get_singleton()->canvas_item_add_set_transform(ci, Transform2D());
@@ -2703,11 +2684,12 @@ void CanvasItemEditor::_draw_viewport() {
over_plugin_list->forward_draw_over_canvas(transform, viewport);
}
_draw_focus();
+ _draw_bones();
}
void CanvasItemEditor::_notification(int p_what) {
- if (p_what == NOTIFICATION_FIXED_PROCESS) {
+ if (p_what == NOTIFICATION_PHYSICS_PROCESS) {
EditorNode::get_singleton()->get_scene_root()->set_snap_controls_to_pixels(GLOBAL_GET("gui/common/snap_controls_to_pixels"));
@@ -2766,9 +2748,9 @@ void CanvasItemEditor::_notification(int p_what) {
}
if (all_control && has_control)
- anchor_menu->show();
+ presets_menu->show();
else
- anchor_menu->hide();
+ presets_menu->hide();
for (Map<ObjectID, BoneList>::Element *E = bone_list.front(); E; E = E->next()) {
@@ -2800,57 +2782,15 @@ void CanvasItemEditor::_notification(int p_what) {
select_sb->set_default_margin(Margin(i), 4);
}
- select_button->set_icon(get_icon("ToolSelect", "EditorIcons"));
- list_select_button->set_icon(get_icon("ListSelect", "EditorIcons"));
- move_button->set_icon(get_icon("ToolMove", "EditorIcons"));
- rotate_button->set_icon(get_icon("ToolRotate", "EditorIcons"));
- snap_button->set_icon(get_icon("Snap", "EditorIcons"));
- snap_config_menu->set_icon(get_icon("GuiMiniTabMenu", "EditorIcons"));
- skeleton_menu->set_icon(get_icon("Bone", "EditorIcons"));
- 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"));
- ungroup_button->set_icon(get_icon("Ungroup", "EditorIcons"));
- key_insert_button->set_icon(get_icon("Key", "EditorIcons"));
-
- zoom_minus->set_icon(get_icon("ZoomLess", "EditorIcons"));
- zoom_reset->set_icon(get_icon("ZoomReset", "EditorIcons"));
- zoom_plus->set_icon(get_icon("ZoomMore", "EditorIcons"));
-
- anchor_menu->set_icon(get_icon("Anchor", "EditorIcons"));
- PopupMenu *p = anchor_menu->get_popup();
-
- p->add_icon_item(get_icon("ControlAlignTopLeft", "EditorIcons"), "Top Left", ANCHOR_ALIGN_TOP_LEFT);
- p->add_icon_item(get_icon("ControlAlignTopRight", "EditorIcons"), "Top Right", ANCHOR_ALIGN_TOP_RIGHT);
- p->add_icon_item(get_icon("ControlAlignBottomRight", "EditorIcons"), "Bottom Right", ANCHOR_ALIGN_BOTTOM_RIGHT);
- p->add_icon_item(get_icon("ControlAlignBottomLeft", "EditorIcons"), "Bottom Left", ANCHOR_ALIGN_BOTTOM_LEFT);
- p->add_separator();
- p->add_icon_item(get_icon("ControlAlignLeftCenter", "EditorIcons"), "Center Left", ANCHOR_ALIGN_CENTER_LEFT);
- p->add_icon_item(get_icon("ControlAlignTopCenter", "EditorIcons"), "Center Top", ANCHOR_ALIGN_CENTER_TOP);
- p->add_icon_item(get_icon("ControlAlignRightCenter", "EditorIcons"), "Center Right", ANCHOR_ALIGN_CENTER_RIGHT);
- p->add_icon_item(get_icon("ControlAlignBottomCenter", "EditorIcons"), "Center Bottom", ANCHOR_ALIGN_CENTER_BOTTOM);
- p->add_icon_item(get_icon("ControlAlignCenter", "EditorIcons"), "Center", ANCHOR_ALIGN_CENTER);
- p->add_separator();
- p->add_icon_item(get_icon("ControlAlignLeftWide", "EditorIcons"), "Left Wide", ANCHOR_ALIGN_LEFT_WIDE);
- p->add_icon_item(get_icon("ControlAlignTopWide", "EditorIcons"), "Top Wide", ANCHOR_ALIGN_TOP_WIDE);
- p->add_icon_item(get_icon("ControlAlignRightWide", "EditorIcons"), "Right Wide", ANCHOR_ALIGN_RIGHT_WIDE);
- p->add_icon_item(get_icon("ControlAlignBottomWide", "EditorIcons"), "Bottom Wide", ANCHOR_ALIGN_BOTTOM_WIDE);
- p->add_icon_item(get_icon("ControlVcenterWide", "EditorIcons"), "VCenter Wide ", ANCHOR_ALIGN_VCENTER_WIDE);
- p->add_icon_item(get_icon("ControlHcenterWide", "EditorIcons"), "HCenter Wide ", ANCHOR_ALIGN_HCENTER_WIDE);
- p->add_separator();
- p->add_icon_item(get_icon("ControlAlignWide", "EditorIcons"), "Full Rect", ANCHOR_ALIGN_WIDE);
- p->add_icon_item(get_icon("ControlAlignWide", "EditorIcons"), "Full Rect and Fit Parent", ANCHOR_ALIGN_WIDE_FIT);
-
AnimationPlayerEditor::singleton->get_key_editor()->connect("visibility_changed", this, "_keying_changed");
_keying_changed();
+
} else if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
select_sb->set_texture(get_icon("EditorRect2D", "EditorIcons"));
+ }
+ if (p_what == NOTIFICATION_ENTER_TREE || p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
select_button->set_icon(get_icon("ToolSelect", "EditorIcons"));
list_select_button->set_icon(get_icon("ListSelect", "EditorIcons"));
move_button->set_icon(get_icon("ToolMove", "EditorIcons"));
@@ -2868,30 +2808,56 @@ void CanvasItemEditor::_notification(int p_what) {
ungroup_button->set_icon(get_icon("Ungroup", "EditorIcons"));
key_insert_button->set_icon(get_icon("Key", "EditorIcons"));
- anchor_menu->set_icon(get_icon("Anchor", "EditorIcons"));
- PopupMenu *p = anchor_menu->get_popup();
- p->clear();
+ zoom_minus->set_icon(get_icon("ZoomLess", "EditorIcons"));
+ zoom_reset->set_icon(get_icon("ZoomReset", "EditorIcons"));
+ zoom_plus->set_icon(get_icon("ZoomMore", "EditorIcons"));
- p->add_icon_item(get_icon("ControlAlignTopLeft", "EditorIcons"), "Top Left", ANCHOR_ALIGN_TOP_LEFT);
- p->add_icon_item(get_icon("ControlAlignTopRight", "EditorIcons"), "Top Right", ANCHOR_ALIGN_TOP_RIGHT);
- p->add_icon_item(get_icon("ControlAlignBottomRight", "EditorIcons"), "Bottom Right", ANCHOR_ALIGN_BOTTOM_RIGHT);
- p->add_icon_item(get_icon("ControlAlignBottomLeft", "EditorIcons"), "Bottom Left", ANCHOR_ALIGN_BOTTOM_LEFT);
+ PopupMenu *p = presets_menu->get_popup();
+
+ p->clear();
+ p->add_icon_item(get_icon("ControlAlignTopLeft", "EditorIcons"), "Top Left", ANCHORS_AND_MARGINS_PRESET_TOP_LEFT);
+ p->add_icon_item(get_icon("ControlAlignTopRight", "EditorIcons"), "Top Right", ANCHORS_AND_MARGINS_PRESET_TOP_RIGHT);
+ p->add_icon_item(get_icon("ControlAlignBottomRight", "EditorIcons"), "Bottom Right", ANCHORS_AND_MARGINS_PRESET_BOTTOM_RIGHT);
+ p->add_icon_item(get_icon("ControlAlignBottomLeft", "EditorIcons"), "Bottom Left", ANCHORS_AND_MARGINS_PRESET_BOTTOM_LEFT);
+ p->add_separator();
+ p->add_icon_item(get_icon("ControlAlignLeftCenter", "EditorIcons"), "Center Left", ANCHORS_AND_MARGINS_PRESET_CENTER_LEFT);
+ p->add_icon_item(get_icon("ControlAlignTopCenter", "EditorIcons"), "Center Top", ANCHORS_AND_MARGINS_PRESET_CENTER_TOP);
+ p->add_icon_item(get_icon("ControlAlignRightCenter", "EditorIcons"), "Center Right", ANCHORS_AND_MARGINS_PRESET_CENTER_RIGHT);
+ p->add_icon_item(get_icon("ControlAlignBottomCenter", "EditorIcons"), "Center Bottom", ANCHORS_AND_MARGINS_PRESET_CENTER_BOTTOM);
+ p->add_icon_item(get_icon("ControlAlignCenter", "EditorIcons"), "Center", ANCHORS_AND_MARGINS_PRESET_CENTER);
p->add_separator();
- p->add_icon_item(get_icon("ControlAlignLeftCenter", "EditorIcons"), "Center Left", ANCHOR_ALIGN_CENTER_LEFT);
- p->add_icon_item(get_icon("ControlAlignTopCenter", "EditorIcons"), "Center Top", ANCHOR_ALIGN_CENTER_TOP);
- p->add_icon_item(get_icon("ControlAlignRightCenter", "EditorIcons"), "Center Right", ANCHOR_ALIGN_CENTER_RIGHT);
- p->add_icon_item(get_icon("ControlAlignBottomCenter", "EditorIcons"), "Center Bottom", ANCHOR_ALIGN_CENTER_BOTTOM);
- p->add_icon_item(get_icon("ControlAlignCenter", "EditorIcons"), "Center", ANCHOR_ALIGN_CENTER);
+ p->add_icon_item(get_icon("ControlAlignLeftWide", "EditorIcons"), "Left Wide", ANCHORS_AND_MARGINS_PRESET_LEFT_WIDE);
+ p->add_icon_item(get_icon("ControlAlignTopWide", "EditorIcons"), "Top Wide", ANCHORS_AND_MARGINS_PRESET_TOP_WIDE);
+ p->add_icon_item(get_icon("ControlAlignRightWide", "EditorIcons"), "Right Wide", ANCHORS_AND_MARGINS_PRESET_RIGHT_WIDE);
+ p->add_icon_item(get_icon("ControlAlignBottomWide", "EditorIcons"), "Bottom Wide", ANCHORS_AND_MARGINS_PRESET_BOTTOM_WIDE);
+ p->add_icon_item(get_icon("ControlVcenterWide", "EditorIcons"), "VCenter Wide ", ANCHORS_AND_MARGINS_PRESET_VCENTER_WIDE);
+ p->add_icon_item(get_icon("ControlHcenterWide", "EditorIcons"), "HCenter Wide ", ANCHORS_AND_MARGINS_PRESET_HCENTER_WIDE);
p->add_separator();
- p->add_icon_item(get_icon("ControlAlignLeftWide", "EditorIcons"), "Left Wide", ANCHOR_ALIGN_LEFT_WIDE);
- p->add_icon_item(get_icon("ControlAlignTopWide", "EditorIcons"), "Top Wide", ANCHOR_ALIGN_TOP_WIDE);
- p->add_icon_item(get_icon("ControlAlignRightWide", "EditorIcons"), "Right Wide", ANCHOR_ALIGN_RIGHT_WIDE);
- p->add_icon_item(get_icon("ControlAlignBottomWide", "EditorIcons"), "Bottom Wide", ANCHOR_ALIGN_BOTTOM_WIDE);
- p->add_icon_item(get_icon("ControlVcenterWide", "EditorIcons"), "VCenter Wide ", ANCHOR_ALIGN_VCENTER_WIDE);
- p->add_icon_item(get_icon("ControlHcenterWide", "EditorIcons"), "HCenter Wide ", ANCHOR_ALIGN_HCENTER_WIDE);
+ p->add_icon_item(get_icon("ControlAlignWide", "EditorIcons"), "Full Rect", ANCHORS_AND_MARGINS_PRESET_WIDE);
p->add_separator();
- p->add_icon_item(get_icon("ControlAlignWide", "EditorIcons"), "Full Rect", ANCHOR_ALIGN_WIDE);
- p->add_icon_item(get_icon("ControlAlignWide", "EditorIcons"), "Full Rect and Fit Parent", ANCHOR_ALIGN_WIDE_FIT);
+ p->add_submenu_item(TTR("Anchors only"), "Anchors");
+ p->set_item_icon(20, get_icon("Anchor", "EditorIcons"));
+
+ anchors_popup->clear();
+ anchors_popup->add_icon_item(get_icon("ControlAlignTopLeft", "EditorIcons"), "Top Left", ANCHORS_PRESET_TOP_LEFT);
+ anchors_popup->add_icon_item(get_icon("ControlAlignTopRight", "EditorIcons"), "Top Right", ANCHORS_PRESET_TOP_RIGHT);
+ anchors_popup->add_icon_item(get_icon("ControlAlignBottomRight", "EditorIcons"), "Bottom Right", ANCHORS_PRESET_BOTTOM_RIGHT);
+ anchors_popup->add_icon_item(get_icon("ControlAlignBottomLeft", "EditorIcons"), "Bottom Left", ANCHORS_PRESET_BOTTOM_LEFT);
+ anchors_popup->add_separator();
+ anchors_popup->add_icon_item(get_icon("ControlAlignLeftCenter", "EditorIcons"), "Center Left", ANCHORS_PRESET_CENTER_LEFT);
+ anchors_popup->add_icon_item(get_icon("ControlAlignTopCenter", "EditorIcons"), "Center Top", ANCHORS_PRESET_CENTER_TOP);
+ anchors_popup->add_icon_item(get_icon("ControlAlignRightCenter", "EditorIcons"), "Center Right", ANCHORS_PRESET_CENTER_RIGHT);
+ anchors_popup->add_icon_item(get_icon("ControlAlignBottomCenter", "EditorIcons"), "Center Bottom", ANCHORS_PRESET_CENTER_BOTTOM);
+ anchors_popup->add_icon_item(get_icon("ControlAlignCenter", "EditorIcons"), "Center", ANCHORS_PRESET_CENTER);
+ anchors_popup->add_separator();
+ anchors_popup->add_icon_item(get_icon("ControlAlignLeftWide", "EditorIcons"), "Left Wide", ANCHORS_PRESET_LEFT_WIDE);
+ anchors_popup->add_icon_item(get_icon("ControlAlignTopWide", "EditorIcons"), "Top Wide", ANCHORS_PRESET_TOP_WIDE);
+ anchors_popup->add_icon_item(get_icon("ControlAlignRightWide", "EditorIcons"), "Right Wide", ANCHORS_PRESET_RIGHT_WIDE);
+ anchors_popup->add_icon_item(get_icon("ControlAlignBottomWide", "EditorIcons"), "Bottom Wide", ANCHORS_PRESET_BOTTOM_WIDE);
+ anchors_popup->add_icon_item(get_icon("ControlVcenterWide", "EditorIcons"), "VCenter Wide ", ANCHORS_PRESET_VCENTER_WIDE);
+ anchors_popup->add_icon_item(get_icon("ControlHcenterWide", "EditorIcons"), "HCenter Wide ", ANCHORS_PRESET_HCENTER_WIDE);
+ anchors_popup->add_separator();
+ anchors_popup->add_icon_item(get_icon("ControlAlignWide", "EditorIcons"), "Full Rect", ANCHORS_PRESET_WIDE);
}
}
@@ -3023,25 +2989,51 @@ void CanvasItemEditor::_update_scroll(float) {
viewport_base->update();
}
-void CanvasItemEditor::_set_anchors_preset(Control::LayoutPreset p_preset) {
+void CanvasItemEditor::_set_anchors_and_margins_preset(Control::LayoutPreset p_preset) {
List<Node *> &selection = editor_selection->get_selected_node_list();
- undo_redo->create_action(TTR("Change Anchors"));
+ undo_redo->create_action(TTR("Change Anchors and Margins"));
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
Control *c = Object::cast_to<Control>(E->get());
undo_redo->add_do_method(c, "set_anchors_preset", p_preset);
+ switch (p_preset) {
+ case PRESET_TOP_LEFT:
+ case PRESET_TOP_RIGHT:
+ case PRESET_BOTTOM_LEFT:
+ case PRESET_BOTTOM_RIGHT:
+ case PRESET_CENTER_LEFT:
+ case PRESET_CENTER_TOP:
+ case PRESET_CENTER_RIGHT:
+ case PRESET_CENTER_BOTTOM:
+ case PRESET_CENTER:
+ undo_redo->add_do_method(c, "set_margins_preset", p_preset, Control::PRESET_MODE_KEEP_SIZE);
+ break;
+ case PRESET_LEFT_WIDE:
+ case PRESET_TOP_WIDE:
+ case PRESET_RIGHT_WIDE:
+ case PRESET_BOTTOM_WIDE:
+ case PRESET_VCENTER_WIDE:
+ case PRESET_HCENTER_WIDE:
+ case PRESET_WIDE:
+ undo_redo->add_do_method(c, "set_margins_preset", p_preset, Control::PRESET_MODE_MINSIZE);
+ break;
+ }
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));
undo_redo->add_undo_method(c, "set_anchor", MARGIN_BOTTOM, c->get_anchor(MARGIN_BOTTOM));
+ undo_redo->add_undo_method(c, "set_margin", MARGIN_LEFT, c->get_margin(MARGIN_LEFT));
+ undo_redo->add_undo_method(c, "set_margin", MARGIN_TOP, c->get_margin(MARGIN_TOP));
+ undo_redo->add_undo_method(c, "set_margin", MARGIN_RIGHT, c->get_margin(MARGIN_RIGHT));
+ undo_redo->add_undo_method(c, "set_margin", MARGIN_BOTTOM, c->get_margin(MARGIN_BOTTOM));
}
undo_redo->commit_action();
}
-void CanvasItemEditor::_set_full_rect() {
+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"));
@@ -3049,49 +3041,42 @@ void CanvasItemEditor::_set_full_rect() {
Control *c = Object::cast_to<Control>(E->get());
- 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);
- undo_redo->add_do_method(c, "set_margin", MARGIN_BOTTOM, 0);
+ 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));
undo_redo->add_undo_method(c, "set_anchor", MARGIN_BOTTOM, c->get_anchor(MARGIN_BOTTOM));
- undo_redo->add_undo_method(c, "set_margin", MARGIN_LEFT, c->get_margin(MARGIN_LEFT));
- undo_redo->add_undo_method(c, "set_margin", MARGIN_TOP, c->get_margin(MARGIN_TOP));
- undo_redo->add_undo_method(c, "set_margin", MARGIN_RIGHT, c->get_margin(MARGIN_RIGHT));
- undo_redo->add_undo_method(c, "set_margin", MARGIN_BOTTOM, c->get_margin(MARGIN_BOTTOM));
}
undo_redo->commit_action();
}
-void CanvasItemEditor::_zoom_minus() {
- if (zoom < MIN_ZOOM)
+void CanvasItemEditor::_zoom_on_position(float p_zoom, Point2 p_position) {
+ if (p_zoom < MIN_ZOOM || p_zoom > MAX_ZOOM)
return;
- zoom /= 2.0;
+
+ float prev_zoom = zoom;
+ zoom = p_zoom;
+ Point2 ofs = p_position;
+ ofs = ofs / prev_zoom - ofs / zoom;
+ h_scroll->set_value(h_scroll->get_value() + ofs.x);
+ v_scroll->set_value(v_scroll->get_value() + ofs.y);
_update_scroll(0);
viewport->update();
viewport_base->update();
}
+void CanvasItemEditor::_zoom_minus() {
+ _zoom_on_position(zoom / 2.0, viewport_scrollable->get_size() / 2.0);
+}
+
void CanvasItemEditor::_zoom_reset() {
- zoom = 1;
- _update_scroll(0);
- viewport->update();
- viewport_base->update();
+ _zoom_on_position(1.0, viewport_scrollable->get_size() / 2.0);
}
void CanvasItemEditor::_zoom_plus() {
- if (zoom > MAX_ZOOM)
- return;
-
- zoom *= 2.0;
- _update_scroll(0);
- viewport->update();
- viewport_base->update();
+ _zoom_on_position(zoom * 2.0, viewport_scrollable->get_size() / 2.0);
}
void CanvasItemEditor::_toggle_snap(bool p_status) {
@@ -3254,56 +3239,103 @@ void CanvasItemEditor::_popup_callback(int p_op) {
viewport->update();
} break;
- case ANCHOR_ALIGN_TOP_LEFT: {
+
+ case ANCHORS_AND_MARGINS_PRESET_TOP_LEFT: {
+ _set_anchors_and_margins_preset(PRESET_TOP_LEFT);
+ } break;
+ case ANCHORS_AND_MARGINS_PRESET_TOP_RIGHT: {
+ _set_anchors_and_margins_preset(PRESET_TOP_RIGHT);
+ } break;
+ case ANCHORS_AND_MARGINS_PRESET_BOTTOM_LEFT: {
+ _set_anchors_and_margins_preset(PRESET_BOTTOM_LEFT);
+ } break;
+ case ANCHORS_AND_MARGINS_PRESET_BOTTOM_RIGHT: {
+ _set_anchors_and_margins_preset(PRESET_BOTTOM_RIGHT);
+ } break;
+ case ANCHORS_AND_MARGINS_PRESET_CENTER_LEFT: {
+ _set_anchors_and_margins_preset(PRESET_CENTER_LEFT);
+ } break;
+ case ANCHORS_AND_MARGINS_PRESET_CENTER_RIGHT: {
+ _set_anchors_and_margins_preset(PRESET_CENTER_RIGHT);
+ } break;
+ case ANCHORS_AND_MARGINS_PRESET_CENTER_TOP: {
+ _set_anchors_and_margins_preset(PRESET_CENTER_TOP);
+ } break;
+ case ANCHORS_AND_MARGINS_PRESET_CENTER_BOTTOM: {
+ _set_anchors_and_margins_preset(PRESET_CENTER_BOTTOM);
+ } break;
+ case ANCHORS_AND_MARGINS_PRESET_CENTER: {
+ _set_anchors_and_margins_preset(PRESET_CENTER);
+ } break;
+ case ANCHORS_AND_MARGINS_PRESET_TOP_WIDE: {
+ _set_anchors_and_margins_preset(PRESET_TOP_WIDE);
+ } break;
+ case ANCHORS_AND_MARGINS_PRESET_LEFT_WIDE: {
+ _set_anchors_and_margins_preset(PRESET_LEFT_WIDE);
+ } break;
+ case ANCHORS_AND_MARGINS_PRESET_RIGHT_WIDE: {
+ _set_anchors_and_margins_preset(PRESET_RIGHT_WIDE);
+ } break;
+ case ANCHORS_AND_MARGINS_PRESET_BOTTOM_WIDE: {
+ _set_anchors_and_margins_preset(PRESET_BOTTOM_WIDE);
+ } break;
+ case ANCHORS_AND_MARGINS_PRESET_VCENTER_WIDE: {
+ _set_anchors_and_margins_preset(PRESET_VCENTER_WIDE);
+ } break;
+ case ANCHORS_AND_MARGINS_PRESET_HCENTER_WIDE: {
+ _set_anchors_and_margins_preset(PRESET_HCENTER_WIDE);
+ } break;
+ case ANCHORS_AND_MARGINS_PRESET_WIDE: {
+ _set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ } break;
+
+ case ANCHORS_PRESET_TOP_LEFT: {
_set_anchors_preset(PRESET_TOP_LEFT);
} break;
- case ANCHOR_ALIGN_TOP_RIGHT: {
+ case ANCHORS_PRESET_TOP_RIGHT: {
_set_anchors_preset(PRESET_TOP_RIGHT);
} break;
- case ANCHOR_ALIGN_BOTTOM_LEFT: {
+ case ANCHORS_PRESET_BOTTOM_LEFT: {
_set_anchors_preset(PRESET_BOTTOM_LEFT);
} break;
- case ANCHOR_ALIGN_BOTTOM_RIGHT: {
+ case ANCHORS_PRESET_BOTTOM_RIGHT: {
_set_anchors_preset(PRESET_BOTTOM_RIGHT);
} break;
- case ANCHOR_ALIGN_CENTER_LEFT: {
+ case ANCHORS_PRESET_CENTER_LEFT: {
_set_anchors_preset(PRESET_CENTER_LEFT);
} break;
- case ANCHOR_ALIGN_CENTER_RIGHT: {
+ case ANCHORS_PRESET_CENTER_RIGHT: {
_set_anchors_preset(PRESET_CENTER_RIGHT);
} break;
- case ANCHOR_ALIGN_CENTER_TOP: {
+ case ANCHORS_PRESET_CENTER_TOP: {
_set_anchors_preset(PRESET_CENTER_TOP);
} break;
- case ANCHOR_ALIGN_CENTER_BOTTOM: {
+ case ANCHORS_PRESET_CENTER_BOTTOM: {
_set_anchors_preset(PRESET_CENTER_BOTTOM);
} break;
- case ANCHOR_ALIGN_CENTER: {
+ case ANCHORS_PRESET_CENTER: {
_set_anchors_preset(PRESET_CENTER);
} break;
- case ANCHOR_ALIGN_TOP_WIDE: {
+ case ANCHORS_PRESET_TOP_WIDE: {
_set_anchors_preset(PRESET_TOP_WIDE);
} break;
- case ANCHOR_ALIGN_LEFT_WIDE: {
+ case ANCHORS_PRESET_LEFT_WIDE: {
_set_anchors_preset(PRESET_LEFT_WIDE);
} break;
- case ANCHOR_ALIGN_RIGHT_WIDE: {
+ case ANCHORS_PRESET_RIGHT_WIDE: {
_set_anchors_preset(PRESET_RIGHT_WIDE);
} break;
- case ANCHOR_ALIGN_BOTTOM_WIDE: {
+ case ANCHORS_PRESET_BOTTOM_WIDE: {
_set_anchors_preset(PRESET_BOTTOM_WIDE);
} break;
- case ANCHOR_ALIGN_VCENTER_WIDE: {
+ case ANCHORS_PRESET_VCENTER_WIDE: {
_set_anchors_preset(PRESET_VCENTER_WIDE);
} break;
- case ANCHOR_ALIGN_HCENTER_WIDE: {
+ case ANCHORS_PRESET_HCENTER_WIDE: {
_set_anchors_preset(PRESET_HCENTER_WIDE);
} break;
- case ANCHOR_ALIGN_WIDE: {
- _set_anchors_preset(PRESET_WIDE);
- } break;
- case ANCHOR_ALIGN_WIDE_FIT: {
- _set_full_rect();
+ case ANCHORS_PRESET_WIDE: {
+ _set_anchors_preset(Control::PRESET_WIDE);
} break;
case ANIM_INSERT_KEY:
@@ -3697,7 +3729,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
hb = memnew(HBoxContainer);
add_child(hb);
- hb->set_area_as_parent_rect();
+ hb->set_anchors_and_margins_preset(Control::PRESET_WIDE);
bottom_split = memnew(VSplitContainer);
add_child(bottom_split);
@@ -3709,6 +3741,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
viewport_base = memnew(Control);
palette_split->add_child(viewport_base);
+ viewport_base->set_clip_contents(true);
viewport_base->connect("draw", this, "_draw_viewport_base");
viewport_base->connect("gui_input", this, "_viewport_base_gui_input");
viewport_base->set_focus_mode(FOCUS_ALL);
@@ -3719,19 +3752,19 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
viewport_base->add_child(viewport_scrollable);
viewport_scrollable->set_mouse_filter(MOUSE_FILTER_PASS);
viewport_scrollable->set_draw_behind_parent(true);
- viewport_scrollable->set_area_as_parent_rect();
+ viewport_scrollable->set_anchors_and_margins_preset(Control::PRESET_WIDE);
viewport_scrollable->set_begin(Point2(RULER_WIDTH, RULER_WIDTH));
ViewportContainer *scene_tree = memnew(ViewportContainer);
viewport_scrollable->add_child(scene_tree);
scene_tree->set_stretch(true);
- scene_tree->set_area_as_parent_rect();
+ scene_tree->set_anchors_and_margins_preset(Control::PRESET_WIDE);
scene_tree->add_child(p_editor->get_scene_root());
viewport = memnew(CanvasItemEditorViewport(p_editor, this));
viewport_scrollable->add_child(viewport);
viewport->set_mouse_filter(MOUSE_FILTER_PASS);
- viewport->set_area_as_parent_rect();
+ viewport->set_anchors_and_margins_preset(Control::PRESET_WIDE);
viewport->set_clip_contents(true);
viewport->connect("draw", this, "_draw_viewport");
@@ -3821,7 +3854,6 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
snap_config_menu = memnew(MenuButton);
hb->add_child(snap_config_menu);
- snap_config_menu->get_popup()->connect("id_pressed", this, "_popup_callback");
snap_config_menu->set_h_size_flags(SIZE_SHRINK_END);
snap_config_menu->set_tooltip(TTR("Snapping options"));
@@ -3875,7 +3907,6 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
p = skeleton_menu->get_popup();
p->set_hide_on_checkable_item_selection(false);
- p->connect("id_pressed", this, "_popup_callback");
p->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_make_bones", TTR("Make Bones"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_B), SKELETON_MAKE_BONES);
p->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_clear_bones", TTR("Clear Bones")), SKELETON_CLEAR_BONES);
p->add_separator();
@@ -3883,7 +3914,6 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
p->add_separator();
p->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_set_ik_chain", TTR("Make IK Chain")), SKELETON_SET_IK_CHAIN);
p->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_clear_ik_chain", TTR("Clear IK Chain")), SKELETON_CLEAR_IK_CHAIN);
- p->set_hide_on_checkable_item_selection(false);
p->connect("id_pressed", this, "_popup_callback");
hb->add_child(memnew(VSeparator));
@@ -3901,13 +3931,18 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
p->add_shortcut(ED_SHORTCUT("canvas_item_editor/center_selection", TTR("Center Selection"), KEY_F), VIEW_CENTER_TO_SELECTION);
p->add_shortcut(ED_SHORTCUT("canvas_item_editor/frame_selection", TTR("Frame Selection"), KEY_MASK_SHIFT | KEY_F), VIEW_FRAME_TO_SELECTION);
- anchor_menu = memnew(MenuButton);
- anchor_menu->set_text(TTR("Anchor"));
- hb->add_child(anchor_menu);
- anchor_menu->get_popup()->connect("id_pressed", this, "_popup_callback");
- anchor_menu->hide();
+ presets_menu = memnew(MenuButton);
+ presets_menu->set_text(TTR("Layout"));
+ hb->add_child(presets_menu);
+ presets_menu->hide();
+
+ p = presets_menu->get_popup();
+ p->connect("id_pressed", this, "_popup_callback");
- //p = anchor_menu->get_popup();
+ anchors_popup = memnew(PopupMenu);
+ p->add_child(anchors_popup);
+ anchors_popup->set_name("Anchors");
+ anchors_popup->connect("id_pressed", this, "_popup_callback");
animation_hb = memnew(HBoxContainer);
hb->add_child(animation_hb);
@@ -4032,14 +4067,14 @@ void CanvasItemEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
canvas_item_editor->show();
- canvas_item_editor->set_fixed_process(true);
+ canvas_item_editor->set_physics_process(true);
VisualServer::get_singleton()->viewport_set_hide_canvas(editor->get_scene_root()->get_viewport_rid(), false);
canvas_item_editor->viewport_base->grab_focus();
} else {
canvas_item_editor->hide();
- canvas_item_editor->set_fixed_process(false);
+ canvas_item_editor->set_physics_process(false);
VisualServer::get_singleton()->viewport_set_hide_canvas(editor->get_scene_root()->get_viewport_rid(), true);
}
}
@@ -4059,7 +4094,7 @@ CanvasItemEditorPlugin::CanvasItemEditorPlugin(EditorNode *p_node) {
canvas_item_editor = memnew(CanvasItemEditor(editor));
canvas_item_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
editor->get_viewport()->add_child(canvas_item_editor);
- canvas_item_editor->set_area_as_parent_rect();
+ canvas_item_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE);
canvas_item_editor->hide();
}
@@ -4181,7 +4216,7 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String &
editor_data->get_undo_redo().add_do_property(child, property, texture);
// make visible for certain node type
- if (default_type == "Patch9Rect") {
+ if (default_type == "NinePatchRect") {
editor_data->get_undo_redo().add_do_property(child, "rect/size", texture_size);
} else if (default_type == "Polygon2D") {
PoolVector<Vector2> list;
@@ -4199,7 +4234,7 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String &
}
Transform2D trans = canvas->get_canvas_transform();
Point2 target_position = (p_point - trans.get_origin()) / trans.get_scale().x - pos;
- if (default_type == "Polygon2D" || default_type == "TouchScreenButton" || default_type == "TextureRect" || default_type == "Patch9Rect") {
+ if (default_type == "Polygon2D" || default_type == "TouchScreenButton" || default_type == "TextureRect" || default_type == "NinePatchRect") {
target_position -= texture_size / 2;
}
// there's nothing to be used as source position so snapping will work as absolute if enabled
@@ -4275,7 +4310,7 @@ void CanvasItemEditorViewport::_perform_drop_data() {
child = memnew(TouchScreenButton);
else if (default_type == "TextureRect")
child = memnew(TextureRect);
- else if (default_type == "Patch9Rect")
+ else if (default_type == "NinePatchRect")
child = memnew(NinePatchRect);
else
child = memnew(Sprite); // default
@@ -4437,7 +4472,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte
types.push_back("TouchScreenButton");
// Control
types.push_back("TextureRect");
- types.push_back("Patch9Rect");
+ types.push_back("NinePatchRect");
target_node = NULL;
editor = p_node;
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index af834507e0..69dc25d180 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -59,6 +59,7 @@ public:
float prev_anchors[4];
Transform2D pre_drag_xform;
+ Rect2 pre_drag_rect;
CanvasItemEditorSelectedItem() { prev_rot = 0; }
};
@@ -97,23 +98,54 @@ class CanvasItemEditor : public VBoxContainer {
UNLOCK_SELECTED,
GROUP_SELECTED,
UNGROUP_SELECTED,
- ANCHOR_ALIGN_TOP_LEFT,
- ANCHOR_ALIGN_TOP_RIGHT,
- ANCHOR_ALIGN_BOTTOM_LEFT,
- ANCHOR_ALIGN_BOTTOM_RIGHT,
- ANCHOR_ALIGN_CENTER_LEFT,
- ANCHOR_ALIGN_CENTER_RIGHT,
- ANCHOR_ALIGN_CENTER_TOP,
- ANCHOR_ALIGN_CENTER_BOTTOM,
- ANCHOR_ALIGN_CENTER,
- ANCHOR_ALIGN_TOP_WIDE,
- ANCHOR_ALIGN_LEFT_WIDE,
- ANCHOR_ALIGN_RIGHT_WIDE,
- ANCHOR_ALIGN_BOTTOM_WIDE,
- ANCHOR_ALIGN_VCENTER_WIDE,
- ANCHOR_ALIGN_HCENTER_WIDE,
- ANCHOR_ALIGN_WIDE,
- ANCHOR_ALIGN_WIDE_FIT,
+ ANCHORS_AND_MARGINS_PRESET_TOP_LEFT,
+ ANCHORS_AND_MARGINS_PRESET_TOP_RIGHT,
+ ANCHORS_AND_MARGINS_PRESET_BOTTOM_LEFT,
+ ANCHORS_AND_MARGINS_PRESET_BOTTOM_RIGHT,
+ ANCHORS_AND_MARGINS_PRESET_CENTER_LEFT,
+ ANCHORS_AND_MARGINS_PRESET_CENTER_RIGHT,
+ ANCHORS_AND_MARGINS_PRESET_CENTER_TOP,
+ ANCHORS_AND_MARGINS_PRESET_CENTER_BOTTOM,
+ ANCHORS_AND_MARGINS_PRESET_CENTER,
+ ANCHORS_AND_MARGINS_PRESET_TOP_WIDE,
+ ANCHORS_AND_MARGINS_PRESET_LEFT_WIDE,
+ ANCHORS_AND_MARGINS_PRESET_RIGHT_WIDE,
+ ANCHORS_AND_MARGINS_PRESET_BOTTOM_WIDE,
+ ANCHORS_AND_MARGINS_PRESET_VCENTER_WIDE,
+ ANCHORS_AND_MARGINS_PRESET_HCENTER_WIDE,
+ ANCHORS_AND_MARGINS_PRESET_WIDE,
+ ANCHORS_PRESET_TOP_LEFT,
+ ANCHORS_PRESET_TOP_RIGHT,
+ ANCHORS_PRESET_BOTTOM_LEFT,
+ ANCHORS_PRESET_BOTTOM_RIGHT,
+ ANCHORS_PRESET_CENTER_LEFT,
+ ANCHORS_PRESET_CENTER_RIGHT,
+ ANCHORS_PRESET_CENTER_TOP,
+ ANCHORS_PRESET_CENTER_BOTTOM,
+ ANCHORS_PRESET_CENTER,
+ ANCHORS_PRESET_TOP_WIDE,
+ ANCHORS_PRESET_LEFT_WIDE,
+ ANCHORS_PRESET_RIGHT_WIDE,
+ ANCHORS_PRESET_BOTTOM_WIDE,
+ ANCHORS_PRESET_VCENTER_WIDE,
+ ANCHORS_PRESET_HCENTER_WIDE,
+ ANCHORS_PRESET_WIDE,
+ MARGINS_PRESET_TOP_LEFT,
+ MARGINS_PRESET_TOP_RIGHT,
+ MARGINS_PRESET_BOTTOM_LEFT,
+ MARGINS_PRESET_BOTTOM_RIGHT,
+ MARGINS_PRESET_CENTER_LEFT,
+ MARGINS_PRESET_CENTER_RIGHT,
+ MARGINS_PRESET_CENTER_TOP,
+ MARGINS_PRESET_CENTER_BOTTOM,
+ MARGINS_PRESET_CENTER,
+ MARGINS_PRESET_TOP_WIDE,
+ MARGINS_PRESET_LEFT_WIDE,
+ MARGINS_PRESET_RIGHT_WIDE,
+ MARGINS_PRESET_BOTTOM_WIDE,
+ MARGINS_PRESET_VCENTER_WIDE,
+ MARGINS_PRESET_HCENTER_WIDE,
+ MARGINS_PRESET_WIDE,
ANIM_INSERT_KEY,
ANIM_INSERT_KEY_EXISTING,
ANIM_INSERT_POS,
@@ -278,7 +310,10 @@ class CanvasItemEditor : public VBoxContainer {
MenuButton *view_menu;
HBoxContainer *animation_hb;
MenuButton *animation_menu;
- MenuButton *anchor_menu;
+
+ MenuButton *presets_menu;
+ PopupMenu *anchors_and_margins_popup;
+ PopupMenu *anchors_popup;
Button *key_loc_button;
Button *key_rot_button;
@@ -385,8 +420,10 @@ class CanvasItemEditor : public VBoxContainer {
void _snap_other_nodes(Point2 p_value, Point2 &r_current_snap, bool (&r_snapped)[2], const Node *p_current, const CanvasItem *p_to_snap);
void _set_anchors_preset(Control::LayoutPreset p_preset);
- void _set_full_rect();
+ void _set_margins_preset(Control::LayoutPreset p_preset);
+ void _set_anchors_and_margins_preset(Control::LayoutPreset p_preset);
+ void _zoom_on_position(float p_zoom, Point2 p_position = Point2());
void _zoom_minus();
void _zoom_reset();
void _zoom_plus();
diff --git a/editor/plugins/collision_polygon_2d_editor_plugin.cpp b/editor/plugins/collision_polygon_2d_editor_plugin.cpp
index 38f95d8278..00e6d617a1 100644..100755
--- a/editor/plugins/collision_polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/collision_polygon_2d_editor_plugin.cpp
@@ -29,400 +29,20 @@
/*************************************************************************/
#include "collision_polygon_2d_editor_plugin.h"
-#include "canvas_item_editor_plugin.h"
-#include "editor/editor_settings.h"
-#include "os/file_access.h"
+Node2D *CollisionPolygon2DEditor::_get_node() const {
-void CollisionPolygon2DEditor::_notification(int p_what) {
-
- switch (p_what) {
-
- case NOTIFICATION_READY: {
-
- button_create->set_icon(get_icon("Edit", "EditorIcons"));
- button_edit->set_icon(get_icon("MovePoint", "EditorIcons"));
- button_edit->set_pressed(true);
- get_tree()->connect("node_removed", this, "_node_removed");
-
- } break;
- case NOTIFICATION_FIXED_PROCESS: {
-
- } break;
- }
-}
-void CollisionPolygon2DEditor::_node_removed(Node *p_node) {
-
- if (p_node == node) {
- node = NULL;
- hide();
- canvas_item_editor->get_viewport_control()->update();
- }
-}
-
-void CollisionPolygon2DEditor::_menu_option(int p_option) {
-
- switch (p_option) {
-
- case MODE_CREATE: {
-
- mode = MODE_CREATE;
- button_create->set_pressed(true);
- button_edit->set_pressed(false);
- } break;
- case MODE_EDIT: {
-
- mode = MODE_EDIT;
- button_create->set_pressed(false);
- button_edit->set_pressed(true);
- } break;
- }
-}
-
-void CollisionPolygon2DEditor::_wip_close() {
-
- undo_redo->create_action(TTR("Create Poly"));
- undo_redo->add_undo_method(node, "set_polygon", node->get_polygon());
- undo_redo->add_do_method(node, "set_polygon", wip);
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
- wip.clear();
- wip_active = false;
- mode = MODE_EDIT;
- button_edit->set_pressed(true);
- button_create->set_pressed(false);
- edited_point = -1;
-}
-
-bool CollisionPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
-
- if (!node)
- return false;
-
- Ref<InputEventMouseButton> mb = p_event;
-
- if (mb.is_valid()) {
- Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
-
- Vector2 gpoint = mb->get_position();
- Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
- cpoint = canvas_item_editor->snap_point(cpoint);
- cpoint = node->get_global_transform().affine_inverse().xform(cpoint);
-
- Vector<Vector2> poly = node->get_polygon();
-
- //first check if a point is to be added (segment split)
- real_t grab_threshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8);
-
- switch (mode) {
-
- case MODE_CREATE: {
-
- if (mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) {
-
- if (!wip_active) {
-
- wip.clear();
- wip.push_back(cpoint);
- wip_active = true;
- edited_point_pos = cpoint;
- canvas_item_editor->get_viewport_control()->update();
- edited_point = 1;
- return true;
- } else {
-
- if (wip.size() > 1 && xform.xform(wip[0]).distance_to(gpoint) < grab_threshold) {
- //wip closed
- _wip_close();
-
- return true;
- } else {
-
- wip.push_back(cpoint);
- edited_point = wip.size();
- canvas_item_editor->get_viewport_control()->update();
- return true;
-
- //add wip point
- }
- }
- } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && wip_active) {
- _wip_close();
- }
-
- } break;
-
- case MODE_EDIT: {
-
- if (mb->get_button_index() == BUTTON_LEFT) {
- if (mb->is_pressed()) {
-
- if (mb->get_control()) {
-
- if (poly.size() < 3) {
-
- undo_redo->create_action(TTR("Edit Poly"));
- undo_redo->add_undo_method(node, "set_polygon", poly);
- poly.push_back(cpoint);
- undo_redo->add_do_method(node, "set_polygon", poly);
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
- return true;
- }
-
- //search edges
- int closest_idx = -1;
- Vector2 closest_pos;
- real_t closest_dist = 1e10;
- for (int i = 0; i < poly.size(); i++) {
-
- Vector2 points[2] = { xform.xform(poly[i]),
- xform.xform(poly[(i + 1) % poly.size()]) };
-
- Vector2 cp = Geometry::get_closest_point_to_segment_2d(gpoint, points);
- if (cp.distance_squared_to(points[0]) < CMP_EPSILON2 || cp.distance_squared_to(points[1]) < CMP_EPSILON2)
- continue; //not valid to reuse point
-
- real_t d = cp.distance_to(gpoint);
- if (d < closest_dist && d < grab_threshold) {
- closest_dist = d;
- closest_pos = cp;
- closest_idx = i;
- }
- }
-
- if (closest_idx >= 0) {
-
- pre_move_edit = poly;
- poly.insert(closest_idx + 1, xform.affine_inverse().xform(closest_pos));
- edited_point = closest_idx + 1;
- edited_point_pos = xform.affine_inverse().xform(closest_pos);
- node->set_polygon(poly);
- canvas_item_editor->get_viewport_control()->update();
- return true;
- }
- } else {
-
- //look for points to move
-
- int closest_idx = -1;
- Vector2 closest_pos;
- real_t closest_dist = 1e10;
- for (int i = 0; i < poly.size(); i++) {
-
- Vector2 cp = xform.xform(poly[i]);
-
- real_t d = cp.distance_to(gpoint);
- if (d < closest_dist && d < grab_threshold) {
- closest_dist = d;
- closest_pos = cp;
- closest_idx = i;
- }
- }
-
- if (closest_idx >= 0) {
-
- pre_move_edit = poly;
- edited_point = closest_idx;
- edited_point_pos = xform.affine_inverse().xform(closest_pos);
- canvas_item_editor->get_viewport_control()->update();
- return true;
- }
- }
- } else {
-
- if (edited_point != -1) {
-
- //apply
-
- ERR_FAIL_INDEX_V(edited_point, poly.size(), false);
- poly[edited_point] = edited_point_pos;
- undo_redo->create_action(TTR("Edit Poly"));
- undo_redo->add_do_method(node, "set_polygon", poly);
- undo_redo->add_undo_method(node, "set_polygon", pre_move_edit);
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
-
- edited_point = -1;
- return true;
- }
- }
- } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && edited_point == -1) {
-
- int closest_idx = -1;
- Vector2 closest_pos;
- real_t closest_dist = 1e10;
- for (int i = 0; i < poly.size(); i++) {
-
- Vector2 cp = xform.xform(poly[i]);
-
- real_t d = cp.distance_to(gpoint);
- if (d < closest_dist && d < grab_threshold) {
- closest_dist = d;
- closest_pos = cp;
- closest_idx = i;
- }
- }
-
- if (closest_idx >= 0) {
-
- undo_redo->create_action(TTR("Edit Poly (Remove Point)"));
- undo_redo->add_undo_method(node, "set_polygon", poly);
- poly.remove(closest_idx);
- undo_redo->add_do_method(node, "set_polygon", poly);
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
- return true;
- }
- }
-
- } break;
- }
- }
-
- Ref<InputEventMouseMotion> mm = p_event;
-
- if (mm.is_valid()) {
-
- if (edited_point != -1 && (wip_active || mm->get_button_mask() & BUTTON_MASK_LEFT)) {
-
- Vector2 gpoint = mm->get_position();
- Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
- cpoint = canvas_item_editor->snap_point(cpoint);
- edited_point_pos = node->get_global_transform().affine_inverse().xform(cpoint);
-
- canvas_item_editor->get_viewport_control()->update();
- }
- }
-
- return false;
+ return node;
}
-void CollisionPolygon2DEditor::_canvas_draw() {
-
- if (!node)
- return;
-
- Control *vpc = canvas_item_editor->get_viewport_control();
-
- Vector<Vector2> poly;
-
- if (wip_active)
- poly = wip;
- else
- poly = node->get_polygon();
- Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
- Ref<Texture> handle = get_icon("EditorHandle", "EditorIcons");
+void CollisionPolygon2DEditor::_set_node(Node *p_polygon) {
- for (int i = 0; i < poly.size(); i++) {
-
- Vector2 p, p2;
- p = i == edited_point ? edited_point_pos : poly[i];
- if ((wip_active && i == poly.size() - 1) || (((i + 1) % poly.size()) == edited_point))
- p2 = edited_point_pos;
- else
- p2 = poly[(i + 1) % poly.size()];
-
- Vector2 point = xform.xform(p);
- Vector2 next_point = xform.xform(p2);
-
- Color col = Color(1, 0.3, 0.1, 0.8);
- vpc->draw_line(point, next_point, col, 2);
- vpc->draw_texture(handle, point - handle->get_size() * 0.5);
- }
+ node = Object::cast_to<CollisionPolygon2D>(p_polygon);
}
-void CollisionPolygon2DEditor::edit(Node *p_collision_polygon) {
-
- if (!canvas_item_editor) {
- canvas_item_editor = CanvasItemEditor::get_singleton();
- }
-
- if (p_collision_polygon) {
-
- node = Object::cast_to<CollisionPolygon2D>(p_collision_polygon);
- //Enable the pencil tool if the polygon is empty
- if (node->get_polygon().size() == 0) {
- _menu_option(MODE_CREATE);
- }
- if (!canvas_item_editor->get_viewport_control()->is_connected("draw", this, "_canvas_draw"))
- canvas_item_editor->get_viewport_control()->connect("draw", this, "_canvas_draw");
- wip.clear();
- wip_active = false;
- edited_point = -1;
- canvas_item_editor->get_viewport_control()->update();
-
- } else {
- node = NULL;
-
- if (canvas_item_editor->get_viewport_control()->is_connected("draw", this, "_canvas_draw"))
- canvas_item_editor->get_viewport_control()->disconnect("draw", this, "_canvas_draw");
- }
-}
-
-void CollisionPolygon2DEditor::_bind_methods() {
-
- ClassDB::bind_method(D_METHOD("_menu_option"), &CollisionPolygon2DEditor::_menu_option);
- ClassDB::bind_method(D_METHOD("_canvas_draw"), &CollisionPolygon2DEditor::_canvas_draw);
- ClassDB::bind_method(D_METHOD("_node_removed"), &CollisionPolygon2DEditor::_node_removed);
-}
-
-CollisionPolygon2DEditor::CollisionPolygon2DEditor(EditorNode *p_editor) {
-
- node = NULL;
- canvas_item_editor = NULL;
- editor = p_editor;
- undo_redo = editor->get_undo_redo();
-
- add_child(memnew(VSeparator));
- button_create = memnew(ToolButton);
- add_child(button_create);
- button_create->connect("pressed", this, "_menu_option", varray(MODE_CREATE));
- button_create->set_toggle_mode(true);
- button_create->set_tooltip(TTR("Create a new polygon from scratch."));
-
- button_edit = memnew(ToolButton);
- add_child(button_edit);
- button_edit->connect("pressed", this, "_menu_option", varray(MODE_EDIT));
- button_edit->set_toggle_mode(true);
- button_edit->set_tooltip(TTR("Edit existing polygon:\nLMB: Move Point.\nCtrl+LMB: Split Segment.\nRMB: Erase Point."));
-
- mode = MODE_EDIT;
- wip_active = false;
-}
-
-void CollisionPolygon2DEditorPlugin::edit(Object *p_object) {
-
- collision_polygon_editor->edit(Object::cast_to<Node>(p_object));
-}
-
-bool CollisionPolygon2DEditorPlugin::handles(Object *p_object) const {
-
- return p_object->is_class("CollisionPolygon2D");
-}
-
-void CollisionPolygon2DEditorPlugin::make_visible(bool p_visible) {
-
- if (p_visible) {
- collision_polygon_editor->show();
- } else {
-
- collision_polygon_editor->hide();
- collision_polygon_editor->edit(NULL);
- }
-}
-
-CollisionPolygon2DEditorPlugin::CollisionPolygon2DEditorPlugin(EditorNode *p_node) {
-
- editor = p_node;
- collision_polygon_editor = memnew(CollisionPolygon2DEditor(p_node));
- CanvasItemEditor::get_singleton()->add_control_to_menu_panel(collision_polygon_editor);
-
- collision_polygon_editor->hide();
+CollisionPolygon2DEditor::CollisionPolygon2DEditor(EditorNode *p_editor)
+ : AbstractPolygon2DEditor(p_editor) {
}
-CollisionPolygon2DEditorPlugin::~CollisionPolygon2DEditorPlugin() {
+CollisionPolygon2DEditorPlugin::CollisionPolygon2DEditorPlugin(EditorNode *p_node)
+ : AbstractPolygon2DEditorPlugin(p_node, memnew(CollisionPolygon2DEditor(p_node)), "CollisionPolygon2D") {
}
diff --git a/editor/plugins/collision_polygon_2d_editor_plugin.h b/editor/plugins/collision_polygon_2d_editor_plugin.h
index 4715abd2e6..edf3bbcc08 100644..100755
--- a/editor/plugins/collision_polygon_2d_editor_plugin.h
+++ b/editor/plugins/collision_polygon_2d_editor_plugin.h
@@ -30,78 +30,32 @@
#ifndef COLLISION_POLYGON_2D_EDITOR_PLUGIN_H
#define COLLISION_POLYGON_2D_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
-#include "editor/editor_plugin.h"
+#include "editor/plugins/abstract_polygon_2d_editor.h"
#include "scene/2d/collision_polygon_2d.h"
-#include "scene/gui/tool_button.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
-class CanvasItemEditor;
+class CollisionPolygon2DEditor : public AbstractPolygon2DEditor {
-class CollisionPolygon2DEditor : public HBoxContainer {
+ GDCLASS(CollisionPolygon2DEditor, AbstractPolygon2DEditor);
- GDCLASS(CollisionPolygon2DEditor, HBoxContainer);
-
- UndoRedo *undo_redo;
- enum Mode {
-
- MODE_CREATE,
- MODE_EDIT,
-
- };
-
- Mode mode;
-
- ToolButton *button_create;
- ToolButton *button_edit;
-
- CanvasItemEditor *canvas_item_editor;
- EditorNode *editor;
- Panel *panel;
CollisionPolygon2D *node;
- MenuButton *options;
-
- int edited_point;
- Vector2 edited_point_pos;
- Vector<Vector2> pre_move_edit;
- Vector<Vector2> wip;
- bool wip_active;
-
- void _wip_close();
- void _canvas_draw();
- void _menu_option(int p_option);
protected:
- void _notification(int p_what);
- void _node_removed(Node *p_node);
- static void _bind_methods();
+ virtual Node2D *_get_node() const;
+ virtual void _set_node(Node *p_polygon);
public:
- bool forward_gui_input(const Ref<InputEvent> &p_event);
- void edit(Node *p_collision_polygon);
CollisionPolygon2DEditor(EditorNode *p_editor);
};
-class CollisionPolygon2DEditorPlugin : public EditorPlugin {
-
- GDCLASS(CollisionPolygon2DEditorPlugin, EditorPlugin);
+class CollisionPolygon2DEditorPlugin : public AbstractPolygon2DEditorPlugin {
- CollisionPolygon2DEditor *collision_polygon_editor;
- EditorNode *editor;
+ GDCLASS(CollisionPolygon2DEditorPlugin, AbstractPolygon2DEditorPlugin);
public:
- virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const Ref<InputEvent> &p_event) { return collision_polygon_editor->forward_gui_input(p_event); }
-
- virtual String get_name() const { return "CollisionPolygon2D"; }
- bool has_main_screen() const { return false; }
- virtual void edit(Object *p_object);
- virtual bool handles(Object *p_object) const;
- virtual void make_visible(bool p_visible);
-
CollisionPolygon2DEditorPlugin(EditorNode *p_node);
- ~CollisionPolygon2DEditorPlugin();
};
#endif // COLLISION_POLYGON_2D_EDITOR_PLUGIN_H
diff --git a/editor/plugins/cube_grid_theme_editor_plugin.cpp b/editor/plugins/cube_grid_theme_editor_plugin.cpp
index 1c17daf425..2b31f192b3 100644
--- a/editor/plugins/cube_grid_theme_editor_plugin.cpp
+++ b/editor/plugins/cube_grid_theme_editor_plugin.cpp
@@ -241,7 +241,7 @@ MeshLibraryEditor::MeshLibraryEditor(EditorNode *p_editor) {
file->connect("file_selected", this, "_import_scene_cbk");
Panel *panel = memnew(Panel);
- panel->set_area_as_parent_rect();
+ panel->set_anchors_and_margins_preset(Control::PRESET_WIDE);
add_child(panel);
MenuButton *options = memnew(MenuButton);
panel->add_child(options);
@@ -289,7 +289,7 @@ MeshLibraryEditorPlugin::MeshLibraryEditorPlugin(EditorNode *p_node) {
theme_editor = memnew(MeshLibraryEditor(p_node));
p_node->get_viewport()->add_child(theme_editor);
- theme_editor->set_area_as_parent_rect();
+ theme_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE);
theme_editor->set_anchor(MARGIN_BOTTOM, Control::ANCHOR_BEGIN);
theme_editor->set_end(Point2(0, 22));
theme_editor->hide();
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp
index 70d771afc8..2754aeed06 100644
--- a/editor/plugins/curve_editor_plugin.cpp
+++ b/editor/plugins/curve_editor_plugin.cpp
@@ -53,12 +53,12 @@ CurveEditor::CurveEditor() {
_presets_menu = memnew(PopupMenu);
_presets_menu->set_name("_presets_menu");
- _presets_menu->add_item("Flat0", PRESET_FLAT0);
- _presets_menu->add_item("Flat1", PRESET_FLAT1);
- _presets_menu->add_item("Linear", PRESET_LINEAR);
- _presets_menu->add_item("Ease in", PRESET_EASE_IN);
- _presets_menu->add_item("Ease out", PRESET_EASE_OUT);
- _presets_menu->add_item("Smoothstep", PRESET_SMOOTHSTEP);
+ _presets_menu->add_item(TTR("Flat0"), PRESET_FLAT0);
+ _presets_menu->add_item(TTR("Flat1"), PRESET_FLAT1);
+ _presets_menu->add_item(TTR("Linear"), PRESET_LINEAR);
+ _presets_menu->add_item(TTR("Ease in"), PRESET_EASE_IN);
+ _presets_menu->add_item(TTR("Ease out"), PRESET_EASE_OUT);
+ _presets_menu->add_item(TTR("Smoothstep"), PRESET_SMOOTHSTEP);
_presets_menu->connect("id_pressed", this, "_on_preset_item_selected");
_context_menu->add_child(_presets_menu);
}
@@ -344,19 +344,19 @@ void CurveEditor::open_context_menu(Vector2 pos) {
_curve_ref->get_point_left_mode(_selected_point) == Curve::TANGENT_LINEAR :
_curve_ref->get_point_right_mode(_selected_point) == Curve::TANGENT_LINEAR;
- _context_menu->set_item_checked(CONTEXT_LINEAR, is_linear);
+ _context_menu->set_item_checked(_context_menu->get_item_index(CONTEXT_LINEAR), is_linear);
} else {
_context_menu->add_separator();
if (_selected_point > 0) {
_context_menu->add_check_item(TTR("Left linear"), CONTEXT_LEFT_LINEAR);
- _context_menu->set_item_checked(CONTEXT_LEFT_LINEAR,
+ _context_menu->set_item_checked(_context_menu->get_item_index(CONTEXT_LEFT_LINEAR),
_curve_ref->get_point_left_mode(_selected_point) == Curve::TANGENT_LINEAR);
}
if (_selected_point + 1 < _curve_ref->get_point_count()) {
_context_menu->add_check_item(TTR("Right linear"), CONTEXT_RIGHT_LINEAR);
- _context_menu->set_item_checked(CONTEXT_RIGHT_LINEAR,
+ _context_menu->set_item_checked(_context_menu->get_item_index(CONTEXT_RIGHT_LINEAR),
_curve_ref->get_point_right_mode(_selected_point) == Curve::TANGENT_LINEAR);
}
}
@@ -613,8 +613,8 @@ void CurveEditor::_draw() {
Vector2 min_edge = get_world_pos(Vector2(0, view_size.y));
Vector2 max_edge = get_world_pos(Vector2(view_size.x, 0));
- const Color grid_color0(0, 0, 0, 0.5);
- const Color grid_color1(0, 0, 0, 0.15);
+ const Color grid_color0 = get_color("grid_major_color", "Editor");
+ const Color grid_color1 = get_color("grid_minor_color", "Editor");
draw_line(Vector2(min_edge.x, curve.get_min_value()), Vector2(max_edge.x, curve.get_min_value()), grid_color0);
draw_line(Vector2(max_edge.x, curve.get_max_value()), Vector2(min_edge.x, curve.get_max_value()), grid_color0);
draw_line(Vector2(0, min_edge.y), Vector2(0, max_edge.y), grid_color0);
@@ -636,7 +636,7 @@ void CurveEditor::_draw() {
Ref<Font> font = get_font("font", "Label");
float font_height = font->get_height();
- const Color text_color(1, 1, 1, 0.3);
+ const Color text_color = get_color("font_color", "Editor");
{
// X axis
@@ -664,7 +664,7 @@ void CurveEditor::_draw() {
if (_selected_point >= 0) {
- const Color tangent_color(0.5, 0.5, 1, 1);
+ const Color tangent_color = get_color("accent_color", "Editor");
int i = _selected_point;
Vector2 pos = curve.get_point_position(i);
@@ -686,8 +686,8 @@ void CurveEditor::_draw() {
draw_set_transform_matrix(_world_to_view);
- const Color line_color(1, 1, 1, 0.85);
- const Color edge_line_color(1, 1, 1, 0.4);
+ const Color line_color = get_color("highlight_color", "Editor");
+ const Color edge_line_color = get_color("font_color", "Editor");
CanvasItemPlotCurve plot_func(*this, line_color, edge_line_color);
plot_curve_accurate(curve, 4.f / view_size.x, plot_func);
@@ -714,8 +714,8 @@ void CurveEditor::_draw() {
draw_set_transform_matrix(Transform2D());
- const Color point_color(1, 1, 1);
- const Color selected_point_color(1, 0.5, 0.5);
+ const Color point_color = get_color("font_color", "Editor");
+ const Color selected_point_color = get_color("accent_color", "Editor");
for (int i = 0; i < curve.get_point_count(); ++i) {
Vector2 pos = curve.get_point_position(i);
diff --git a/editor/plugins/light_occluder_2d_editor_plugin.cpp b/editor/plugins/light_occluder_2d_editor_plugin.cpp
index e6b921c539..ed0bc60d2f 100644
--- a/editor/plugins/light_occluder_2d_editor_plugin.cpp
+++ b/editor/plugins/light_occluder_2d_editor_plugin.cpp
@@ -46,7 +46,7 @@ void LightOccluder2DEditor::_notification(int p_what) {
create_poly->connect("confirmed", this, "_create_poly");
} break;
- case NOTIFICATION_FIXED_PROCESS: {
+ case NOTIFICATION_PHYSICS_PROCESS: {
} break;
}
diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp
index d2767bf1b2..6b613c1bcc 100644
--- a/editor/plugins/material_editor_plugin.cpp
+++ b/editor/plugins/material_editor_plugin.cpp
@@ -30,9 +30,11 @@
// FIXME: Disabled as (according to reduz) users were complaining that it gets in the way
// Waiting for PropertyEditor rewrite (planned for 3.1) to be refactored.
-#if 0
+
#include "material_editor_plugin.h"
+#if 0
+
#include "scene/main/viewport.h"
void MaterialEditor::_gui_input(InputEvent p_event) {
@@ -42,7 +44,7 @@ void MaterialEditor::_gui_input(InputEvent p_event) {
void MaterialEditor::_notification(int p_what) {
- if (p_what==NOTIFICATION_FIXED_PROCESS) {
+ if (p_what==NOTIFICATION_PHYSICS_PROCESS) {
}
@@ -335,7 +337,7 @@ MaterialEditor::MaterialEditor() {
HBoxContainer *hb = memnew( HBoxContainer );
add_child(hb);
- hb->set_area_as_parent_rect(2);
+ hb->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 2);
VBoxContainer *vb_shape = memnew( VBoxContainer );
hb->add_child(vb_shape);
@@ -416,3 +418,41 @@ MaterialEditorPlugin::~MaterialEditorPlugin()
}
#endif
+
+String SpatialMaterialConversionPlugin::converts_to() const {
+
+ return "ShaderMaterial";
+}
+bool SpatialMaterialConversionPlugin::handles(const Ref<Resource> &p_resource) const {
+
+ Ref<SpatialMaterial> mat = p_resource;
+ return mat.is_valid();
+}
+Ref<Resource> SpatialMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) {
+
+ Ref<SpatialMaterial> mat = p_resource;
+ ERR_FAIL_COND_V(!mat.is_valid(), Ref<Resource>());
+
+ Ref<ShaderMaterial> smat;
+ smat.instance();
+
+ Ref<Shader> shader;
+ shader.instance();
+
+ String code = VS::get_singleton()->shader_get_code(mat->get_shader_rid());
+
+ shader->set_code(code);
+
+ smat->set_shader(shader);
+
+ List<PropertyInfo> params;
+ VS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), &params);
+
+ for (List<PropertyInfo>::Element *E = params.front(); E; E = E->next()) {
+ Variant value = VS::get_singleton()->material_get_param(mat->get_rid(), E->get().name);
+ smat->set_shader_param(E->get().name, value);
+ }
+
+ smat->set_render_priority(mat->get_render_priority());
+ return smat;
+}
diff --git a/editor/plugins/material_editor_plugin.h b/editor/plugins/material_editor_plugin.h
index 10d7997a52..af9602f944 100644
--- a/editor/plugins/material_editor_plugin.h
+++ b/editor/plugins/material_editor_plugin.h
@@ -30,6 +30,7 @@
#ifndef MATERIAL_EDITOR_PLUGIN_H
#define MATERIAL_EDITOR_PLUGIN_H
+#include "editor/property_editor.h"
// FIXME: Disabled as (according to reduz) users were complaining that it gets in the way
// Waiting for PropertyEditor rewrite (planned for 3.1) to be refactored.
#if 0
@@ -101,4 +102,13 @@ public:
};
#endif
+
+class SpatialMaterialConversionPlugin : public EditorResourceConversionPlugin {
+ GDCLASS(SpatialMaterialConversionPlugin, EditorResourceConversionPlugin)
+public:
+ virtual String converts_to() const;
+ virtual bool handles(const Ref<Resource> &p_resource) const;
+ virtual Ref<Resource> convert(const Ref<Resource> &p_resource);
+};
+
#endif // MATERIAL_EDITOR_PLUGIN_H
diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp
index a77f022347..74618aecc2 100644
--- a/editor/plugins/mesh_editor_plugin.cpp
+++ b/editor/plugins/mesh_editor_plugin.cpp
@@ -47,7 +47,7 @@ void MeshEditor::_gui_input(Ref<InputEvent> p_event) {
void MeshEditor::_notification(int p_what) {
- if (p_what == NOTIFICATION_FIXED_PROCESS) {
+ if (p_what == NOTIFICATION_PHYSICS_PROCESS) {
}
if (p_what == NOTIFICATION_READY) {
@@ -162,7 +162,7 @@ MeshEditor::MeshEditor() {
HBoxContainer *hb = memnew(HBoxContainer);
add_child(hb);
- hb->set_area_as_parent_rect(2);
+ hb->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 2);
hb->add_spacer();
diff --git a/editor/plugins/navigation_mesh_generator.cpp b/editor/plugins/navigation_mesh_generator.cpp
index 526db3a582..86dc5c3663 100644
--- a/editor/plugins/navigation_mesh_generator.cpp
+++ b/editor/plugins/navigation_mesh_generator.cpp
@@ -38,9 +38,11 @@ void NavigationMeshGenerator::_add_vertex(const Vector3 &p_vec3, Vector<float> &
}
void NavigationMeshGenerator::_add_mesh(const Ref<Mesh> &p_mesh, const Transform &p_xform, Vector<float> &p_verticies, Vector<int> &p_indices) {
- int current_vertex_count = p_verticies.size() / 3;
+ int current_vertex_count = 0;
for (int i = 0; i < p_mesh->get_surface_count(); i++) {
+ current_vertex_count = p_verticies.size() / 3;
+
if (p_mesh->surface_get_primitive_type(i) != Mesh::PRIMITIVE_TRIANGLES)
continue;
diff --git a/editor/plugins/navigation_polygon_editor_plugin.cpp b/editor/plugins/navigation_polygon_editor_plugin.cpp
index de8d4f9618..6560a8dac7 100644..100755
--- a/editor/plugins/navigation_polygon_editor_plugin.cpp
+++ b/editor/plugins/navigation_polygon_editor_plugin.cpp
@@ -29,485 +29,101 @@
/*************************************************************************/
#include "navigation_polygon_editor_plugin.h"
-#include "canvas_item_editor_plugin.h"
-#include "editor/editor_settings.h"
-#include "os/file_access.h"
+Ref<NavigationPolygon> NavigationPolygonEditor::_ensure_navpoly() const {
-void NavigationPolygonEditor::_notification(int p_what) {
+ Ref<NavigationPolygon> navpoly = node->get_navigation_polygon();
+ if (!navpoly.is_valid()) {
- switch (p_what) {
-
- case NOTIFICATION_READY: {
-
- button_create->set_icon(get_icon("Edit", "EditorIcons"));
- button_edit->set_icon(get_icon("MovePoint", "EditorIcons"));
- button_edit->set_pressed(true);
- get_tree()->connect("node_removed", this, "_node_removed");
- create_nav->connect("confirmed", this, "_create_nav");
-
- } break;
- case NOTIFICATION_FIXED_PROCESS: {
-
- } break;
+ navpoly = Ref<NavigationPolygon>(memnew(NavigationPolygon));
+ node->set_navigation_polygon(navpoly);
}
+ return navpoly;
}
-void NavigationPolygonEditor::_node_removed(Node *p_node) {
- if (p_node == node) {
- node = NULL;
- hide();
- canvas_item_editor->get_viewport_control()->update();
- }
-}
+Node2D *NavigationPolygonEditor::_get_node() const {
-void NavigationPolygonEditor::_create_nav() {
-
- if (!node)
- return;
-
- undo_redo->create_action(TTR("Create Navigation Polygon"));
- undo_redo->add_do_method(node, "set_navigation_polygon", Ref<NavigationPolygon>(memnew(NavigationPolygon)));
- undo_redo->add_undo_method(node, "set_navigation_polygon", Variant(REF()));
- undo_redo->commit_action();
- _menu_option(MODE_CREATE);
+ return node;
}
-void NavigationPolygonEditor::_menu_option(int p_option) {
+void NavigationPolygonEditor::_set_node(Node *p_polygon) {
- switch (p_option) {
-
- case MODE_CREATE: {
-
- mode = MODE_CREATE;
- button_create->set_pressed(true);
- button_edit->set_pressed(false);
- } break;
- case MODE_EDIT: {
-
- mode = MODE_EDIT;
- button_create->set_pressed(false);
- button_edit->set_pressed(true);
- } break;
- }
+ node = Object::cast_to<NavigationPolygonInstance>(p_polygon);
}
-void NavigationPolygonEditor::_wip_close() {
+int NavigationPolygonEditor::_get_polygon_count() const {
- if (wip.size() >= 3) {
-
- undo_redo->create_action(TTR("Create Poly"));
- undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "remove_outline", node->get_navigation_polygon()->get_outline_count());
- undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "add_outline", wip);
- undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines");
- undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines");
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
- mode = MODE_EDIT;
- button_edit->set_pressed(true);
- button_create->set_pressed(false);
- }
-
- wip.clear();
- wip_active = false;
- edited_point = -1;
+ Ref<NavigationPolygon> navpoly = node->get_navigation_polygon();
+ if (navpoly.is_valid())
+ return navpoly->get_outline_count();
+ else
+ return 0;
}
-bool NavigationPolygonEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
-
- if (!node)
- return false;
-
- if (node->get_navigation_polygon().is_null()) {
-
- Ref<InputEventMouseButton> mb = p_event;
-
- if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_pressed()) {
- create_nav->set_text("No NavigationPolygon resource on this node.\nCreate and assign one?");
- create_nav->popup_centered_minsize();
- }
- return (mb.is_valid() && mb->get_button_index() == 1);
- }
-
- Ref<InputEventMouseButton> mb = p_event;
-
- if (mb.is_valid()) {
-
- Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
-
- Vector2 gpoint = mb->get_position();
- Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
- cpoint = canvas_item_editor->snap_point(cpoint);
- cpoint = node->get_global_transform().affine_inverse().xform(cpoint);
-
- //first check if a point is to be added (segment split)
- real_t grab_threshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8);
-
- switch (mode) {
-
- case MODE_CREATE: {
-
- if (mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) {
-
- if (!wip_active) {
-
- wip.clear();
- wip.push_back(cpoint);
- wip_active = true;
- edited_point_pos = cpoint;
- edited_outline = -1;
- canvas_item_editor->get_viewport_control()->update();
- edited_point = 1;
- return true;
- } else {
-
- if (wip.size() > 1 && xform.xform(wip[0]).distance_to(gpoint) < grab_threshold) {
- //wip closed
- _wip_close();
-
- return true;
- } else {
-
- wip.push_back(cpoint);
- edited_point = wip.size();
- canvas_item_editor->get_viewport_control()->update();
- return true;
-
- //add wip point
- }
- }
- } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && wip_active) {
- _wip_close();
- }
-
- } break;
-
- case MODE_EDIT: {
-
- if (mb->get_button_index() == BUTTON_LEFT) {
- if (mb->is_pressed()) {
-
- if (mb->get_control()) {
-
- //search edges
- int closest_outline = -1;
- int closest_idx = -1;
- Vector2 closest_pos;
- real_t closest_dist = 1e10;
-
- for (int j = 0; j < node->get_navigation_polygon()->get_outline_count(); j++) {
-
- PoolVector<Vector2> points = node->get_navigation_polygon()->get_outline(j);
-
- int pc = points.size();
- PoolVector<Vector2>::Read poly = points.read();
-
- for (int i = 0; i < pc; i++) {
-
- Vector2 points[2] = { xform.xform(poly[i]),
- xform.xform(poly[(i + 1) % pc]) };
-
- Vector2 cp = Geometry::get_closest_point_to_segment_2d(gpoint, points);
- if (cp.distance_squared_to(points[0]) < CMP_EPSILON2 || cp.distance_squared_to(points[1]) < CMP_EPSILON2)
- continue; //not valid to reuse point
-
- real_t d = cp.distance_to(gpoint);
- if (d < closest_dist && d < grab_threshold) {
- closest_dist = d;
- closest_outline = j;
- closest_pos = cp;
- closest_idx = i;
- }
- }
- }
-
- if (closest_idx >= 0) {
-
- pre_move_edit = node->get_navigation_polygon()->get_outline(closest_outline);
- PoolVector<Point2> poly = pre_move_edit;
- poly.insert(closest_idx + 1, xform.affine_inverse().xform(closest_pos));
- edited_point = closest_idx + 1;
- edited_outline = closest_outline;
- edited_point_pos = xform.affine_inverse().xform(closest_pos);
- node->get_navigation_polygon()->set_outline(closest_outline, poly);
- canvas_item_editor->get_viewport_control()->update();
- return true;
- }
- } else {
-
- //look for points to move
- int closest_outline = -1;
- int closest_idx = -1;
- Vector2 closest_pos;
- real_t closest_dist = 1e10;
-
- for (int j = 0; j < node->get_navigation_polygon()->get_outline_count(); j++) {
-
- PoolVector<Vector2> points = node->get_navigation_polygon()->get_outline(j);
-
- int pc = points.size();
- PoolVector<Vector2>::Read poly = points.read();
+Variant NavigationPolygonEditor::_get_polygon(int p_idx) const {
- for (int i = 0; i < pc; i++) {
-
- Vector2 cp = xform.xform(poly[i]);
-
- real_t d = cp.distance_to(gpoint);
- if (d < closest_dist && d < grab_threshold) {
- closest_dist = d;
- closest_pos = cp;
- closest_outline = j;
- closest_idx = i;
- }
- }
- }
-
- if (closest_idx >= 0) {
-
- pre_move_edit = node->get_navigation_polygon()->get_outline(closest_outline);
- edited_point = closest_idx;
- edited_outline = closest_outline;
- edited_point_pos = xform.affine_inverse().xform(closest_pos);
- canvas_item_editor->get_viewport_control()->update();
- return true;
- }
- }
- } else {
-
- if (edited_point != -1) {
-
- //apply
-
- PoolVector<Vector2> poly = node->get_navigation_polygon()->get_outline(edited_outline);
- ERR_FAIL_INDEX_V(edited_point, poly.size(), false);
- poly.set(edited_point, edited_point_pos);
- undo_redo->create_action(TTR("Edit Poly"));
- undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "set_outline", edited_outline, poly);
- undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "set_outline", edited_outline, pre_move_edit);
- undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines");
- undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines");
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
-
- edited_point = -1;
- return true;
- }
- }
- } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && edited_point == -1) {
-
- int closest_outline = -1;
- int closest_idx = -1;
- Vector2 closest_pos;
- real_t closest_dist = 1e10;
-
- for (int j = 0; j < node->get_navigation_polygon()->get_outline_count(); j++) {
-
- PoolVector<Vector2> points = node->get_navigation_polygon()->get_outline(j);
-
- int pc = points.size();
- PoolVector<Vector2>::Read poly = points.read();
-
- for (int i = 0; i < pc; i++) {
-
- Vector2 cp = xform.xform(poly[i]);
-
- real_t d = cp.distance_to(gpoint);
- if (d < closest_dist && d < grab_threshold) {
- closest_dist = d;
- closest_pos = cp;
- closest_outline = j;
- closest_idx = i;
- }
- }
- }
-
- if (closest_idx >= 0) {
-
- PoolVector<Vector2> poly = node->get_navigation_polygon()->get_outline(closest_outline);
-
- if (poly.size() > 3) {
- undo_redo->create_action(TTR("Edit Poly (Remove Point)"));
- undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "set_outline", closest_outline, poly);
- poly.remove(closest_idx);
- undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "set_outline", closest_outline, poly);
- undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines");
- undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines");
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
- } else {
-
- undo_redo->create_action(TTR("Remove Poly And Point"));
- undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "add_outline_at_index", poly, closest_outline);
- poly.remove(closest_idx);
- undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "remove_outline", closest_outline);
- undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines");
- undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines");
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
- }
- return true;
- }
- }
-
- } break;
- }
- }
-
- Ref<InputEventMouseMotion> mm = p_event;
-
- if (mm.is_valid()) {
-
- if (edited_point != -1 && (wip_active || mm->get_button_mask() & BUTTON_MASK_LEFT)) {
-
- Vector2 gpoint = mm->get_position();
- Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
- cpoint = canvas_item_editor->snap_point(cpoint);
- edited_point_pos = node->get_global_transform().affine_inverse().xform(cpoint);
-
- canvas_item_editor->get_viewport_control()->update();
- }
- }
-
- return false;
+ Ref<NavigationPolygon> navpoly = node->get_navigation_polygon();
+ if (navpoly.is_valid())
+ return navpoly->get_outline(p_idx);
+ else
+ return Variant(Vector<Vector2>());
}
-void NavigationPolygonEditor::_canvas_draw() {
- if (!node)
- return;
+void NavigationPolygonEditor::_set_polygon(int p_idx, const Variant &p_polygon) const {
- Control *vpc = canvas_item_editor->get_viewport_control();
- if (node->get_navigation_polygon().is_null())
- return;
-
- Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
- Ref<Texture> handle = get_icon("EditorHandle", "EditorIcons");
-
- for (int j = -1; j < node->get_navigation_polygon()->get_outline_count(); j++) {
- Vector<Vector2> poly;
-
- if (wip_active && j == edited_outline) {
- poly = wip;
- } else {
- if (j == -1)
- continue;
- poly = Variant(node->get_navigation_polygon()->get_outline(j));
- }
-
- for (int i = 0; i < poly.size(); i++) {
-
- Vector2 p, p2;
- p = (j == edited_outline && i == edited_point) ? edited_point_pos : poly[i];
- if (j == edited_outline && ((wip_active && i == poly.size() - 1) || (((i + 1) % poly.size()) == edited_point)))
- p2 = edited_point_pos;
- else
- p2 = poly[(i + 1) % poly.size()];
-
- Vector2 point = xform.xform(p);
- Vector2 next_point = xform.xform(p2);
-
- Color col = Color(1, 0.3, 0.1, 0.8);
- vpc->draw_line(point, next_point, col, 2);
- vpc->draw_texture(handle, point - handle->get_size() * 0.5);
- }
- }
+ Ref<NavigationPolygon> navpoly = _ensure_navpoly();
+ navpoly->set_outline(p_idx, p_polygon);
+ navpoly->make_polygons_from_outlines();
}
-void NavigationPolygonEditor::edit(Node *p_collision_polygon) {
-
- if (!canvas_item_editor) {
- canvas_item_editor = CanvasItemEditor::get_singleton();
- }
-
- if (p_collision_polygon) {
+void NavigationPolygonEditor::_action_add_polygon(const Variant &p_polygon) {
- node = Object::cast_to<NavigationPolygonInstance>(p_collision_polygon);
- //Enable the pencil tool if the polygon is empty
- if (!node->get_navigation_polygon().is_null()) {
- if (node->get_navigation_polygon()->get_polygon_count() == 0)
- _menu_option(MODE_CREATE);
- }
- if (!canvas_item_editor->get_viewport_control()->is_connected("draw", this, "_canvas_draw"))
- canvas_item_editor->get_viewport_control()->connect("draw", this, "_canvas_draw");
- wip.clear();
- wip_active = false;
- edited_point = -1;
- canvas_item_editor->get_viewport_control()->update();
-
- } else {
- node = NULL;
-
- if (canvas_item_editor->get_viewport_control()->is_connected("draw", this, "_canvas_draw"))
- canvas_item_editor->get_viewport_control()->disconnect("draw", this, "_canvas_draw");
- }
+ Ref<NavigationPolygon> navpoly = _ensure_navpoly();
+ undo_redo->add_do_method(navpoly.ptr(), "add_outline", p_polygon);
+ undo_redo->add_undo_method(navpoly.ptr(), "remove_outline", navpoly->get_outline_count());
+ undo_redo->add_do_method(navpoly.ptr(), "make_polygons_from_outlines");
+ undo_redo->add_undo_method(navpoly.ptr(), "make_polygons_from_outlines");
}
-void NavigationPolygonEditor::_bind_methods() {
+void NavigationPolygonEditor::_action_remove_polygon(int p_idx) {
- ClassDB::bind_method(D_METHOD("_menu_option"), &NavigationPolygonEditor::_menu_option);
- ClassDB::bind_method(D_METHOD("_canvas_draw"), &NavigationPolygonEditor::_canvas_draw);
- ClassDB::bind_method(D_METHOD("_node_removed"), &NavigationPolygonEditor::_node_removed);
- ClassDB::bind_method(D_METHOD("_create_nav"), &NavigationPolygonEditor::_create_nav);
+ Ref<NavigationPolygon> navpoly = _ensure_navpoly();
+ undo_redo->add_do_method(navpoly.ptr(), "remove_outline", p_idx);
+ undo_redo->add_undo_method(navpoly.ptr(), "add_outline_at_index", navpoly->get_outline(p_idx), p_idx);
+ undo_redo->add_do_method(navpoly.ptr(), "make_polygons_from_outlines");
+ undo_redo->add_undo_method(navpoly.ptr(), "make_polygons_from_outlines");
}
-NavigationPolygonEditor::NavigationPolygonEditor(EditorNode *p_editor) {
- node = NULL;
- canvas_item_editor = NULL;
- editor = p_editor;
- undo_redo = editor->get_undo_redo();
+void NavigationPolygonEditor::_action_set_polygon(int p_idx, const Variant &p_previous, const Variant &p_polygon) {
- add_child(memnew(VSeparator));
- button_create = memnew(ToolButton);
- add_child(button_create);
- button_create->connect("pressed", this, "_menu_option", varray(MODE_CREATE));
- button_create->set_toggle_mode(true);
- button_create->set_tooltip(TTR("Create a new polygon from scratch."));
-
- button_edit = memnew(ToolButton);
- add_child(button_edit);
- button_edit->connect("pressed", this, "_menu_option", varray(MODE_EDIT));
- button_edit->set_toggle_mode(true);
- button_edit->set_tooltip(TTR("Edit existing polygon:") + "\n" + TTR("LMB: Move Point.") + "\n" + TTR("Ctrl+LMB: Split Segment.") + "\n" + TTR("RMB: Erase Point."));
- create_nav = memnew(ConfirmationDialog);
- add_child(create_nav);
- create_nav->get_ok()->set_text(TTR("Create"));
-
- mode = MODE_EDIT;
- wip_active = false;
- edited_outline = -1;
+ Ref<NavigationPolygon> navpoly = _ensure_navpoly();
+ undo_redo->add_do_method(navpoly.ptr(), "set_outline", p_idx, p_polygon);
+ undo_redo->add_undo_method(navpoly.ptr(), "set_outline", p_idx, p_previous);
+ undo_redo->add_do_method(navpoly.ptr(), "make_polygons_from_outlines");
+ undo_redo->add_undo_method(navpoly.ptr(), "make_polygons_from_outlines");
}
-void NavigationPolygonEditorPlugin::edit(Object *p_object) {
+bool NavigationPolygonEditor::_has_resource() const {
- collision_polygon_editor->edit(Object::cast_to<Node>(p_object));
+ return node && node->get_navigation_polygon().is_valid();
}
-bool NavigationPolygonEditorPlugin::handles(Object *p_object) const {
-
- return p_object->is_class("NavigationPolygonInstance");
-}
+void NavigationPolygonEditor::_create_resource() {
-void NavigationPolygonEditorPlugin::make_visible(bool p_visible) {
+ if (!node)
+ return;
- if (p_visible) {
- collision_polygon_editor->show();
- } else {
+ undo_redo->create_action(TTR("Create Navigation Polygon"));
+ undo_redo->add_do_method(node, "set_navigation_polygon", Ref<NavigationPolygon>(memnew(NavigationPolygon)));
+ undo_redo->add_undo_method(node, "set_navigation_polygon", Variant(REF()));
+ undo_redo->commit_action();
- collision_polygon_editor->hide();
- collision_polygon_editor->edit(NULL);
- }
+ _menu_option(MODE_CREATE);
}
-NavigationPolygonEditorPlugin::NavigationPolygonEditorPlugin(EditorNode *p_node) {
-
- editor = p_node;
- collision_polygon_editor = memnew(NavigationPolygonEditor(p_node));
- CanvasItemEditor::get_singleton()->add_control_to_menu_panel(collision_polygon_editor);
-
- collision_polygon_editor->hide();
+NavigationPolygonEditor::NavigationPolygonEditor(EditorNode *p_editor)
+ : AbstractPolygon2DEditor(p_editor) {
}
-NavigationPolygonEditorPlugin::~NavigationPolygonEditorPlugin() {
+NavigationPolygonEditorPlugin::NavigationPolygonEditorPlugin(EditorNode *p_node)
+ : AbstractPolygon2DEditorPlugin(p_node, memnew(NavigationPolygonEditor(p_node)), "NavigationPolygonInstance") {
}
diff --git a/editor/plugins/navigation_polygon_editor_plugin.h b/editor/plugins/navigation_polygon_editor_plugin.h
index 7dd555e9c9..54cc347a8c 100644..100755
--- a/editor/plugins/navigation_polygon_editor_plugin.h
+++ b/editor/plugins/navigation_polygon_editor_plugin.h
@@ -30,83 +30,45 @@
#ifndef NAVIGATIONPOLYGONEDITORPLUGIN_H
#define NAVIGATIONPOLYGONEDITORPLUGIN_H
-#include "editor/editor_node.h"
-#include "editor/editor_plugin.h"
+#include "editor/plugins/abstract_polygon_2d_editor.h"
#include "scene/2d/navigation_polygon.h"
-#include "scene/gui/tool_button.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
-class CanvasItemEditor;
+class NavigationPolygonEditor : public AbstractPolygon2DEditor {
-class NavigationPolygonEditor : public HBoxContainer {
+ GDCLASS(NavigationPolygonEditor, AbstractPolygon2DEditor);
- GDCLASS(NavigationPolygonEditor, HBoxContainer);
-
- UndoRedo *undo_redo;
- enum Mode {
-
- MODE_CREATE,
- MODE_EDIT,
-
- };
-
- Mode mode;
-
- ToolButton *button_create;
- ToolButton *button_edit;
-
- ConfirmationDialog *create_nav;
-
- CanvasItemEditor *canvas_item_editor;
- EditorNode *editor;
- Panel *panel;
NavigationPolygonInstance *node;
- MenuButton *options;
- int edited_outline;
- int edited_point;
- Vector2 edited_point_pos;
- PoolVector<Vector2> pre_move_edit;
- Vector<Vector2> wip;
- bool wip_active;
+ Ref<NavigationPolygon> _ensure_navpoly() const;
- void _wip_close();
- void _canvas_draw();
- void _create_nav();
+protected:
+ virtual Node2D *_get_node() const;
+ virtual void _set_node(Node *p_polygon);
- void _menu_option(int p_option);
+ virtual int _get_polygon_count() const;
+ virtual Variant _get_polygon(int p_idx) const;
+ virtual void _set_polygon(int p_idx, const Variant &p_polygon) const;
-protected:
- void _notification(int p_what);
- void _node_removed(Node *p_node);
- static void _bind_methods();
+ virtual void _action_add_polygon(const Variant &p_polygon);
+ virtual void _action_remove_polygon(int p_idx);
+ virtual void _action_set_polygon(int p_idx, const Variant &p_previous, const Variant &p_polygon);
+
+ virtual bool _has_resource() const;
+ virtual void _create_resource();
public:
- bool forward_gui_input(const Ref<InputEvent> &p_event);
- void edit(Node *p_collision_polygon);
NavigationPolygonEditor(EditorNode *p_editor);
};
-class NavigationPolygonEditorPlugin : public EditorPlugin {
+class NavigationPolygonEditorPlugin : public AbstractPolygon2DEditorPlugin {
- GDCLASS(NavigationPolygonEditorPlugin, EditorPlugin);
-
- NavigationPolygonEditor *collision_polygon_editor;
- EditorNode *editor;
+ GDCLASS(NavigationPolygonEditorPlugin, AbstractPolygon2DEditorPlugin);
public:
- virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const Ref<InputEvent> &p_event) { return collision_polygon_editor->forward_gui_input(p_event); }
-
- virtual String get_name() const { return "NavigationPolygonInstance"; }
- bool has_main_screen() const { return false; }
- virtual void edit(Object *p_object);
- virtual bool handles(Object *p_object) const;
- virtual void make_visible(bool p_visible);
-
NavigationPolygonEditorPlugin(EditorNode *p_node);
- ~NavigationPolygonEditorPlugin();
};
#endif // NAVIGATIONPOLYGONEDITORPLUGIN_H
diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp
index 1160e90384..df10ac8929 100644
--- a/editor/plugins/path_2d_editor_plugin.cpp
+++ b/editor/plugins/path_2d_editor_plugin.cpp
@@ -46,7 +46,7 @@ void Path2DEditor::_notification(int p_what) {
//button_edit->set_pressed(true);
} break;
- case NOTIFICATION_FIXED_PROCESS: {
+ case NOTIFICATION_PHYSICS_PROCESS: {
} break;
}
diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp
index 8c4e1b8f27..0e8c13b067 100644..100755
--- a/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -35,15 +35,27 @@
#include "os/input.h"
#include "os/keyboard.h"
+Node2D *Polygon2DEditor::_get_node() const {
+
+ return node;
+}
+
+void Polygon2DEditor::_set_node(Node *p_polygon) {
+
+ node = Object::cast_to<Polygon2D>(p_polygon);
+}
+
+Vector2 Polygon2DEditor::_get_offset(int p_idx) const {
+
+ return node->get_offset();
+}
+
void Polygon2DEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_READY: {
- button_create->set_icon(get_icon("Edit", "EditorIcons"));
- button_edit->set_icon(get_icon("MovePoint", "EditorIcons"));
- button_edit->set_pressed(true);
button_uv->set_icon(get_icon("Uv", "EditorIcons"));
uv_button[UV_MODE_EDIT_POINT]->set_icon(get_icon("ToolSelect", "EditorIcons"));
@@ -55,40 +67,17 @@ void Polygon2DEditor::_notification(int p_what) {
b_snap_enable->set_icon(get_icon("SnapGrid", "EditorIcons"));
uv_icon_zoom->set_texture(get_icon("Zoom", "EditorIcons"));
- get_tree()->connect("node_removed", this, "_node_removed");
-
} break;
- case NOTIFICATION_FIXED_PROCESS: {
+ case NOTIFICATION_PHYSICS_PROCESS: {
} break;
}
}
-void Polygon2DEditor::_node_removed(Node *p_node) {
-
- if (p_node == node) {
- edit(NULL);
- hide();
-
- canvas_item_editor->get_viewport_control()->update();
- }
-}
void Polygon2DEditor::_menu_option(int p_option) {
switch (p_option) {
- case MODE_CREATE: {
-
- mode = MODE_CREATE;
- button_create->set_pressed(true);
- button_edit->set_pressed(false);
- } break;
- case MODE_EDIT: {
-
- mode = MODE_EDIT;
- button_create->set_pressed(false);
- button_edit->set_pressed(true);
- } break;
case MODE_EDIT_UV: {
if (node->get_texture().is_null()) {
@@ -153,6 +142,9 @@ void Polygon2DEditor::_menu_option(int p_option) {
undo_redo->commit_action();
} break;
+ default: {
+ AbstractPolygon2DEditor::_menu_option(p_option);
+ } break;
}
}
@@ -185,289 +177,6 @@ void Polygon2DEditor::_set_snap_step_y(float p_val) {
uv_edit_draw->update();
}
-void Polygon2DEditor::_wip_close() {
-
- undo_redo->create_action(TTR("Create Poly"));
- undo_redo->add_undo_method(node, "set_polygon", node->get_polygon());
- undo_redo->add_do_method(node, "set_polygon", wip);
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
- wip.clear();
- wip_active = false;
- mode = MODE_EDIT;
- button_edit->set_pressed(true);
- button_create->set_pressed(false);
- edited_point = -1;
-}
-
-bool Polygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
-
- if (node == NULL)
- return false;
-
- Ref<InputEventMouseButton> mb = p_event;
-
- if (mb.is_valid()) {
-
- Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
-
- Vector2 gpoint = mb->get_position();
- Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
- cpoint = canvas_item_editor->snap_point(cpoint);
- cpoint = node->get_global_transform().affine_inverse().xform(cpoint);
-
- Vector<Vector2> poly = Variant(node->get_polygon());
-
- //first check if a point is to be added (segment split)
- real_t grab_threshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8);
-
- switch (mode) {
-
- case MODE_CREATE: {
-
- if (mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) {
-
- if (!wip_active) {
-
- wip.clear();
- wip.push_back(cpoint - node->get_offset());
- wip_active = true;
- edited_point_pos = cpoint;
- canvas_item_editor->get_viewport_control()->update();
- edited_point = 1;
- return true;
- } else {
-
- if (wip.size() > 1 && xform.xform(wip[0] + node->get_offset()).distance_to(gpoint) < grab_threshold) {
- //wip closed
- _wip_close();
-
- return true;
- } else {
-
- wip.push_back(cpoint - node->get_offset());
- edited_point = wip.size();
- canvas_item_editor->get_viewport_control()->update();
- return true;
-
- //add wip point
- }
- }
- } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && wip_active) {
- _wip_close();
- }
-
- } break;
-
- case MODE_EDIT: {
-
- if (mb->get_button_index() == BUTTON_LEFT) {
- if (mb->is_pressed()) {
-
- if (mb->get_control()) {
-
- if (poly.size() < 3) {
-
- undo_redo->create_action(TTR("Edit Poly"));
- undo_redo->add_undo_method(node, "set_polygon", poly);
- poly.push_back(cpoint);
- undo_redo->add_do_method(node, "set_polygon", poly);
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
- return true;
- }
-
- //search edges
- int closest_idx = -1;
- Vector2 closest_pos;
- real_t closest_dist = 1e10;
- for (int i = 0; i < poly.size(); i++) {
-
- Vector2 points[2] = { xform.xform(poly[i] + node->get_offset()),
- xform.xform(poly[(i + 1) % poly.size()] + node->get_offset()) };
-
- Vector2 cp = Geometry::get_closest_point_to_segment_2d(gpoint, points);
- if (cp.distance_squared_to(points[0]) < CMP_EPSILON2 || cp.distance_squared_to(points[1]) < CMP_EPSILON2)
- continue; //not valid to reuse point
-
- real_t d = cp.distance_to(gpoint);
- if (d < closest_dist && d < grab_threshold) {
- closest_dist = d;
- closest_pos = cp;
- closest_idx = i;
- }
- }
-
- if (closest_idx >= 0) {
-
- pre_move_edit = poly;
- poly.insert(closest_idx + 1, xform.affine_inverse().xform(closest_pos) - node->get_offset());
- edited_point = closest_idx + 1;
- edited_point_pos = xform.affine_inverse().xform(closest_pos);
- node->set_polygon(Variant(poly));
- canvas_item_editor->get_viewport_control()->update();
- return true;
- }
- } else {
-
- //look for points to move
-
- int closest_idx = -1;
- Vector2 closest_pos;
- real_t closest_dist = 1e10;
- for (int i = 0; i < poly.size(); i++) {
-
- Vector2 cp = xform.xform(poly[i] + node->get_offset());
-
- real_t d = cp.distance_to(gpoint);
- if (d < closest_dist && d < grab_threshold) {
- closest_dist = d;
- closest_pos = cp;
- closest_idx = i;
- }
- }
-
- if (closest_idx >= 0) {
-
- pre_move_edit = poly;
- edited_point = closest_idx;
- edited_point_pos = xform.affine_inverse().xform(closest_pos);
- canvas_item_editor->get_viewport_control()->update();
- return true;
- }
- }
- } else {
-
- if (edited_point != -1) {
-
- //apply
-
- ERR_FAIL_INDEX_V(edited_point, poly.size(), false);
- poly[edited_point] = edited_point_pos - node->get_offset();
- undo_redo->create_action(TTR("Edit Poly"));
- undo_redo->add_do_method(node, "set_polygon", poly);
- undo_redo->add_undo_method(node, "set_polygon", pre_move_edit);
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
-
- edited_point = -1;
- return true;
- }
- }
- } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && edited_point == -1) {
-
- int closest_idx = -1;
- Vector2 closest_pos;
- real_t closest_dist = 1e10;
- for (int i = 0; i < poly.size(); i++) {
-
- Vector2 cp = xform.xform(poly[i] + node->get_offset());
-
- real_t d = cp.distance_to(gpoint);
- if (d < closest_dist && d < grab_threshold) {
- closest_dist = d;
- closest_pos = cp;
- closest_idx = i;
- }
- }
-
- if (closest_idx >= 0) {
-
- undo_redo->create_action(TTR("Edit Poly (Remove Point)"));
- undo_redo->add_undo_method(node, "set_polygon", poly);
- poly.remove(closest_idx);
- undo_redo->add_do_method(node, "set_polygon", poly);
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
- return true;
- }
- }
-
- } break;
- }
- }
-
- Ref<InputEventMouseMotion> mm = p_event;
-
- if (mm.is_valid()) {
-
- if (edited_point != -1 && (wip_active || (mm->get_button_mask() & BUTTON_MASK_LEFT))) {
-
- Vector2 gpoint = mm->get_position();
- Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
- cpoint = canvas_item_editor->snap_point(cpoint);
- edited_point_pos = node->get_global_transform().affine_inverse().xform(cpoint);
-
- if (!wip_active) {
-
- Vector<Vector2> poly = Variant(node->get_polygon());
- ERR_FAIL_INDEX_V(edited_point, poly.size(), false);
- poly[edited_point] = edited_point_pos - node->get_offset();
- node->set_polygon(Variant(poly));
- }
-
- canvas_item_editor->get_viewport_control()->update();
- }
- }
-
- return false;
-}
-void Polygon2DEditor::_canvas_draw() {
-
- if (!node)
- return;
-
- Control *vpc = canvas_item_editor->get_viewport_control();
-
- Vector<Vector2> poly;
-
- if (wip_active)
- poly = wip;
- else
- poly = Variant(node->get_polygon());
-
- Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
- Ref<Texture> handle = get_icon("EditorHandle", "EditorIcons");
-
- if (!wip_active && edited_point >= 0 && EDITOR_DEF("editors/poly_editor/show_previous_outline", true)) {
-
- const Color col = node->get_color().contrasted();
- const int n = pre_move_edit.size();
- for (int i = 0; i < n; i++) {
-
- Vector2 p, p2;
- p = pre_move_edit[i] + node->get_offset();
- p2 = pre_move_edit[(i + 1) % n] + node->get_offset();
-
- Vector2 point = xform.xform(p);
- Vector2 next_point = xform.xform(p2);
-
- vpc->draw_line(point, next_point, col, 2);
- }
- }
-
- for (int i = 0; i < poly.size(); i++) {
-
- Vector2 p, p2;
- p = i == edited_point ? edited_point_pos : (poly[i] + node->get_offset());
- if ((wip_active && i == poly.size() - 1) || (((i + 1) % poly.size()) == edited_point))
- p2 = edited_point_pos;
- else
- p2 = poly[(i + 1) % poly.size()] + node->get_offset();
-
- Vector2 point = xform.xform(p);
- Vector2 next_point = xform.xform(p2);
-
- Color col = Color(1, 0.3, 0.1, 0.8);
- vpc->draw_line(point, next_point, col, 2);
- vpc->draw_texture(handle, point - handle->get_size() * 0.5);
- }
-}
-
void Polygon2DEditor::_uv_mode(int p_mode) {
uv_mode = UVMode(p_mode);
@@ -714,44 +423,12 @@ void Polygon2DEditor::_uv_draw() {
updating_uv_scroll = false;
}
-void Polygon2DEditor::edit(Node *p_collision_polygon) {
-
- if (!canvas_item_editor) {
- canvas_item_editor = CanvasItemEditor::get_singleton();
- }
-
- if (p_collision_polygon) {
-
- node = Object::cast_to<Polygon2D>(p_collision_polygon);
- //Enable the pencil tool if the polygon is empty
- if (node->get_polygon().size() == 0) {
- _menu_option(MODE_CREATE);
- }
- if (!canvas_item_editor->get_viewport_control()->is_connected("draw", this, "_canvas_draw"))
- canvas_item_editor->get_viewport_control()->connect("draw", this, "_canvas_draw");
-
- wip.clear();
- wip_active = false;
- edited_point = -1;
-
- } else {
-
- node = NULL;
-
- if (canvas_item_editor->get_viewport_control()->is_connected("draw", this, "_canvas_draw"))
- canvas_item_editor->get_viewport_control()->disconnect("draw", this, "_canvas_draw");
- }
-}
-
void Polygon2DEditor::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_menu_option"), &Polygon2DEditor::_menu_option);
- ClassDB::bind_method(D_METHOD("_canvas_draw"), &Polygon2DEditor::_canvas_draw);
ClassDB::bind_method(D_METHOD("_uv_mode"), &Polygon2DEditor::_uv_mode);
ClassDB::bind_method(D_METHOD("_uv_draw"), &Polygon2DEditor::_uv_draw);
ClassDB::bind_method(D_METHOD("_uv_input"), &Polygon2DEditor::_uv_input);
ClassDB::bind_method(D_METHOD("_uv_scroll_changed"), &Polygon2DEditor::_uv_scroll_changed);
- ClassDB::bind_method(D_METHOD("_node_removed"), &Polygon2DEditor::_node_removed);
ClassDB::bind_method(D_METHOD("_set_use_snap"), &Polygon2DEditor::_set_use_snap);
ClassDB::bind_method(D_METHOD("_set_show_grid"), &Polygon2DEditor::_set_show_grid);
ClassDB::bind_method(D_METHOD("_set_snap_off_x"), &Polygon2DEditor::_set_snap_off_x);
@@ -773,35 +450,17 @@ Vector2 Polygon2DEditor::snap_point(Vector2 p_target) const {
return p_target;
}
-Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) {
-
- node = NULL;
- canvas_item_editor = NULL;
- editor = p_editor;
- undo_redo = editor->get_undo_redo();
+Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor)
+ : AbstractPolygon2DEditor(p_editor) {
snap_step = Vector2(10, 10);
use_snap = false;
snap_show_grid = false;
- add_child(memnew(VSeparator));
- button_create = memnew(ToolButton);
- add_child(button_create);
- button_create->connect("pressed", this, "_menu_option", varray(MODE_CREATE));
- button_create->set_toggle_mode(true);
-
- button_edit = memnew(ToolButton);
- add_child(button_edit);
- button_edit->connect("pressed", this, "_menu_option", varray(MODE_EDIT));
- button_edit->set_toggle_mode(true);
-
button_uv = memnew(ToolButton);
add_child(button_uv);
button_uv->connect("pressed", this, "_menu_option", varray(MODE_EDIT_UV));
- mode = MODE_EDIT;
- wip_active = false;
-
uv_mode = UV_MODE_EDIT_POINT;
uv_edit = memnew(AcceptDialog);
add_child(uv_edit);
@@ -941,35 +600,6 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) {
uv_edit_draw->set_clip_contents(true);
}
-void Polygon2DEditorPlugin::edit(Object *p_object) {
-
- collision_polygon_editor->edit(Object::cast_to<Node>(p_object));
-}
-
-bool Polygon2DEditorPlugin::handles(Object *p_object) const {
-
- return p_object->is_class("Polygon2D");
-}
-
-void Polygon2DEditorPlugin::make_visible(bool p_visible) {
-
- if (p_visible) {
- collision_polygon_editor->show();
- } else {
-
- collision_polygon_editor->hide();
- collision_polygon_editor->edit(NULL);
- }
-}
-
-Polygon2DEditorPlugin::Polygon2DEditorPlugin(EditorNode *p_node) {
-
- editor = p_node;
- collision_polygon_editor = memnew(Polygon2DEditor(p_node));
- CanvasItemEditor::get_singleton()->add_control_to_menu_panel(collision_polygon_editor);
-
- collision_polygon_editor->hide();
-}
-
-Polygon2DEditorPlugin::~Polygon2DEditorPlugin() {
+Polygon2DEditorPlugin::Polygon2DEditorPlugin(EditorNode *p_node)
+ : AbstractPolygon2DEditorPlugin(p_node, memnew(Polygon2DEditor(p_node)), "Polygon2D") {
}
diff --git a/editor/plugins/polygon_2d_editor_plugin.h b/editor/plugins/polygon_2d_editor_plugin.h
index f9d6a6b4b6..90da3e61c1 100644..100755
--- a/editor/plugins/polygon_2d_editor_plugin.h
+++ b/editor/plugins/polygon_2d_editor_plugin.h
@@ -30,26 +30,18 @@
#ifndef POLYGON_2D_EDITOR_PLUGIN_H
#define POLYGON_2D_EDITOR_PLUGIN_H
-#include "editor/editor_node.h"
-#include "editor/editor_plugin.h"
-#include "scene/2d/polygon_2d.h"
-#include "scene/gui/tool_button.h"
+#include "editor/plugins/abstract_polygon_2d_editor.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
-class CanvasItemEditor;
+class Polygon2DEditor : public AbstractPolygon2DEditor {
-class Polygon2DEditor : public HBoxContainer {
+ GDCLASS(Polygon2DEditor, AbstractPolygon2DEditor);
- GDCLASS(Polygon2DEditor, HBoxContainer);
-
- UndoRedo *undo_redo;
enum Mode {
- MODE_CREATE,
- MODE_EDIT,
- MODE_EDIT_UV,
+ MODE_EDIT_UV = MODE_CONT,
UVEDIT_POLYGON_TO_UV,
UVEDIT_UV_TO_POLYGON,
UVEDIT_UV_CLEAR
@@ -64,7 +56,7 @@ class Polygon2DEditor : public HBoxContainer {
UV_MODE_MAX
};
- Mode mode;
+ Polygon2D *node;
UVMode uv_mode;
AcceptDialog *uv_edit;
@@ -90,34 +82,19 @@ class Polygon2DEditor : public HBoxContainer {
AcceptDialog *error;
- ToolButton *button_create;
- ToolButton *button_edit;
ToolButton *button_uv;
- CanvasItemEditor *canvas_item_editor;
- EditorNode *editor;
- Panel *panel;
- Polygon2D *node;
- MenuButton *options;
-
- int edited_point;
- Vector2 edited_point_pos;
- Vector<Vector2> pre_move_edit;
- Vector<Vector2> wip;
- bool wip_active;
-
bool use_snap;
bool snap_show_grid;
Vector2 snap_offset;
Vector2 snap_step;
+ virtual void _menu_option(int p_option);
+
void _uv_scroll_changed(float);
void _uv_input(const Ref<InputEvent> &p_input);
void _uv_draw();
void _uv_mode(int p_mode);
- void _wip_close();
- void _canvas_draw();
- void _menu_option(int p_option);
void _set_use_snap(bool p_use);
void _set_show_grid(bool p_show);
@@ -127,36 +104,26 @@ class Polygon2DEditor : public HBoxContainer {
void _set_snap_step_y(float p_val);
protected:
+ virtual Node2D *_get_node() const;
+ virtual void _set_node(Node *p_polygon);
+
+ virtual Vector2 _get_offset(int p_idx) const;
+
void _notification(int p_what);
- void _node_removed(Node *p_node);
static void _bind_methods();
Vector2 snap_point(Vector2 p_target) const;
public:
- bool forward_gui_input(const Ref<InputEvent> &p_event);
- void edit(Node *p_collision_polygon);
Polygon2DEditor(EditorNode *p_editor);
};
-class Polygon2DEditorPlugin : public EditorPlugin {
-
- GDCLASS(Polygon2DEditorPlugin, EditorPlugin);
+class Polygon2DEditorPlugin : public AbstractPolygon2DEditorPlugin {
- Polygon2DEditor *collision_polygon_editor;
- EditorNode *editor;
+ GDCLASS(Polygon2DEditorPlugin, AbstractPolygon2DEditorPlugin);
public:
- virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const Ref<InputEvent> &p_event) { return collision_polygon_editor->forward_gui_input(p_event); }
-
- virtual String get_name() const { return "Polygon2D"; }
- bool has_main_screen() const { return false; }
- virtual void edit(Object *p_object);
- virtual bool handles(Object *p_object) const;
- virtual void make_visible(bool p_visible);
-
Polygon2DEditorPlugin(EditorNode *p_node);
- ~Polygon2DEditorPlugin();
};
#endif // POLYGON_2D_EDITOR_PLUGIN_H
diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp
index da4a3f84d6..d421b3798b 100644
--- a/editor/plugins/resource_preloader_editor_plugin.cpp
+++ b/editor/plugins/resource_preloader_editor_plugin.cpp
@@ -38,7 +38,7 @@ void ResourcePreloaderEditor::_gui_input(Ref<InputEvent> p_event) {
void ResourcePreloaderEditor::_notification(int p_what) {
- if (p_what == NOTIFICATION_FIXED_PROCESS) {
+ if (p_what == NOTIFICATION_PHYSICS_PROCESS) {
}
if (p_what == NOTIFICATION_ENTER_TREE) {
@@ -248,7 +248,7 @@ void ResourcePreloaderEditor::edit(ResourcePreloader *p_preloader) {
} else {
hide();
- set_fixed_process(false);
+ set_physics_process(false);
}
}
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 9af5885a17..477d440f28 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -1278,7 +1278,11 @@ void ScriptEditor::_members_overview_selected(int p_idx) {
if (!se) {
return;
}
- se->goto_line(members_overview->get_item_metadata(p_idx));
+ Dictionary state;
+ state["scroll_position"] = members_overview->get_item_metadata(p_idx);
+ state["column"] = 0;
+ state["row"] = members_overview->get_item_metadata(p_idx);
+ se->set_edit_state(state);
se->ensure_focus();
}
@@ -1683,9 +1687,8 @@ bool ScriptEditor::edit(const Ref<Script> &p_script, int p_line, int p_col, bool
}
ERR_FAIL_COND_V(!se, false);
- // load script before adding as child else editor will crash at theme loading
- se->set_edited_script(p_script);
tab_container->add_child(se);
+ se->set_edited_script(p_script);
se->set_tooltip_request_func("_get_debug_tooltip", this);
if (se->get_edit_menu()) {
se->get_edit_menu()->hide();
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index d3c75d1c42..adf65c11e1 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -168,14 +168,34 @@ void ScriptTextEditor::_load_theme_settings() {
text_edit->add_constant_override("line_spacing", EDITOR_DEF("text_editor/theme/line_spacing", 4));
+ colors_cache.symbol_color = symbol_color;
+ colors_cache.keyword_color = keyword_color;
+ colors_cache.basetype_color = basetype_color;
+ colors_cache.type_color = type_color;
+ colors_cache.comment_color = comment_color;
+ colors_cache.string_color = string_color;
+
+ theme_loaded = true;
+ if (!script.is_null())
+ _set_theme_for_script();
+}
+
+void ScriptTextEditor::_set_theme_for_script() {
+
+ if (!theme_loaded)
+ return;
+
+ TextEdit *text_edit = code_editor->get_text_edit();
+
List<String> keywords;
script->get_language()->get_reserved_words(&keywords);
for (List<String>::Element *E = keywords.front(); E; E = E->next()) {
- text_edit->add_keyword_color(E->get(), keyword_color);
+ text_edit->add_keyword_color(E->get(), colors_cache.keyword_color);
}
//colorize core types
+ const Color basetype_color = colors_cache.basetype_color;
text_edit->add_keyword_color("String", basetype_color);
text_edit->add_keyword_color("Vector2", basetype_color);
text_edit->add_keyword_color("Rect2", basetype_color);
@@ -210,7 +230,7 @@ void ScriptTextEditor::_load_theme_settings() {
if (n.begins_with("_"))
n = n.substr(1, n.length());
- text_edit->add_keyword_color(n, type_color);
+ text_edit->add_keyword_color(n, colors_cache.type_color);
}
//colorize comments
@@ -223,7 +243,7 @@ void ScriptTextEditor::_load_theme_settings() {
String beg = comment.get_slice(" ", 0);
String end = comment.get_slice_count(" ") > 1 ? comment.get_slice(" ", 1) : String();
- text_edit->add_color_region(beg, end, comment_color, end == "");
+ text_edit->add_color_region(beg, end, colors_cache.comment_color, end == "");
}
//colorize strings
@@ -235,7 +255,7 @@ void ScriptTextEditor::_load_theme_settings() {
String string = E->get();
String beg = string.get_slice(" ", 0);
String end = string.get_slice_count(" ") > 1 ? string.get_slice(" ", 1) : String();
- text_edit->add_color_region(beg, end, string_color, end == "");
+ text_edit->add_color_region(beg, end, colors_cache.string_color, end == "");
}
}
@@ -263,10 +283,10 @@ void ScriptTextEditor::reload_text() {
void ScriptTextEditor::_notification(int p_what) {
- if (p_what == NOTIFICATION_READY) {
-
- //emit_signal("name_changed");
- _load_theme_settings();
+ switch (p_what) {
+ case NOTIFICATION_READY:
+ _load_theme_settings();
+ break;
}
}
@@ -509,9 +529,9 @@ void ScriptTextEditor::ensure_focus() {
void ScriptTextEditor::set_edit_state(const Variant &p_state) {
Dictionary state = p_state;
- code_editor->get_text_edit()->set_v_scroll(state["scroll_position"]);
code_editor->get_text_edit()->cursor_set_column(state["column"]);
code_editor->get_text_edit()->cursor_set_line(state["row"]);
+ code_editor->get_text_edit()->set_v_scroll(state["scroll_position"]);
code_editor->get_text_edit()->grab_focus();
//int scroll_pos;
@@ -556,6 +576,8 @@ void ScriptTextEditor::set_edited_script(const Ref<Script> &p_script) {
emit_signal("name_changed");
code_editor->update_line_and_column();
+
+ _set_theme_for_script();
}
void ScriptTextEditor::_validate_script() {
@@ -1452,10 +1474,12 @@ void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color) {
ScriptTextEditor::ScriptTextEditor() {
+ theme_loaded = false;
+
code_editor = memnew(CodeTextEditor);
add_child(code_editor);
code_editor->add_constant_override("separation", 0);
- code_editor->set_area_as_parent_rect();
+ code_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE);
code_editor->connect("validate_script", this, "_validate_script");
code_editor->connect("load_theme_settings", this, "_load_theme_settings");
code_editor->set_code_complete_func(_code_complete_scripts, this);
@@ -1557,11 +1581,7 @@ ScriptTextEditor::ScriptTextEditor() {
static ScriptEditorBase *create_editor(const Ref<Script> &p_script) {
- if (p_script->has_source_code()) {
- return memnew(ScriptTextEditor);
- }
-
- return NULL;
+ return memnew(ScriptTextEditor);
}
void ScriptTextEditor::register_editor() {
diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h
index f8b7470ec8..83f3ea57c0 100644
--- a/editor/plugins/script_text_editor.h
+++ b/editor/plugins/script_text_editor.h
@@ -57,6 +57,17 @@ class ScriptTextEditor : public ScriptEditorBase {
int color_line;
String color_args;
+ struct ColorsCache {
+ Color symbol_color;
+ Color keyword_color;
+ Color basetype_color;
+ Color type_color;
+ Color comment_color;
+ Color string_color;
+ } colors_cache;
+
+ bool theme_loaded;
+
enum {
EDIT_UNDO,
EDIT_REDO,
@@ -101,6 +112,7 @@ protected:
void _validate_script();
void _code_complete_script(const String &p_code, List<String> *r_options, bool &r_force);
void _load_theme_settings();
+ void _set_theme_for_script();
void _notification(int p_what);
static void _bind_methods();
diff --git a/editor/plugins/shader_graph_editor_plugin.cpp b/editor/plugins/shader_graph_editor_plugin.cpp
index f1863c3ca4..cd90d47896 100644
--- a/editor/plugins/shader_graph_editor_plugin.cpp
+++ b/editor/plugins/shader_graph_editor_plugin.cpp
@@ -2921,7 +2921,7 @@ ShaderGraphEditorPlugin::ShaderGraphEditorPlugin(EditorNode *p_node, bool p_2d)
//editor->get_viewport()->add_child(shader_editor);
- //shader_editor->set_area_as_parent_rect();
+ //shader_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE);
//shader_editor->hide();
}
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 008dcac2c1..32973db6ec 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -49,13 +49,15 @@
#define DISTANCE_DEFAULT 4
-#define GIZMO_ARROW_SIZE 0.3
+#define GIZMO_ARROW_SIZE 0.35
#define GIZMO_RING_HALF_WIDTH 0.1
//#define GIZMO_SCALE_DEFAULT 0.28
#define GIZMO_SCALE_DEFAULT 0.15
#define GIZMO_PLANE_SIZE 0.2
#define GIZMO_PLANE_DST 0.3
-#define GIZMO_CIRCLE_SIZE 0.9
+#define GIZMO_CIRCLE_SIZE 1.1
+#define GIZMO_SCALE_OFFSET (GIZMO_CIRCLE_SIZE + 0.3)
+#define GIZMO_ARROW_OFFSET (GIZMO_CIRCLE_SIZE + 0.3)
#define ZOOM_MIN_DISTANCE 0.001
#define ZOOM_MULTIPLIER 1.08
@@ -70,20 +72,17 @@
#define MAX_FOV 179
void SpatialEditorViewport::_update_camera(float p_interp_delta) {
- if (orthogonal) {
- //camera->set_orthogonal(size.width*cursor.distance,get_znear(),get_zfar());
- camera->set_orthogonal(2 * cursor.distance, 0.1, 8192);
- } else
- camera->set_perspective(get_fov(), get_znear(), get_zfar());
+
+ bool is_orthogonal = camera->get_projection() == Camera::PROJECTION_ORTHOGONAL;
//when not being manipulated, move softly
- float free_orbit_inertia = EDITOR_DEF("editors/3d/navigation_feel/orbit_inertia", 0.15);
- float free_translation_inertia = EDITOR_DEF("editors/3d/navigation_feel/translation_inertia", 0.15);
+ float free_orbit_inertia = EDITOR_GET("editors/3d/navigation_feel/orbit_inertia");
+ float free_translation_inertia = EDITOR_GET("editors/3d/navigation_feel/translation_inertia");
//when being manipulated, move more quickly
- float manip_orbit_inertia = EDITOR_DEF("editors/3d/navigation_feel/manipulation_orbit_inertia", 0.1);
- float manip_translation_inertia = EDITOR_DEF("editors/3d/navigation_feel/manipulation_translation_inertia", 0.1);
+ float manip_orbit_inertia = EDITOR_GET("editors/3d/navigation_feel/manipulation_orbit_inertia");
+ float manip_translation_inertia = EDITOR_GET("editors/3d/navigation_feel/manipulation_translation_inertia");
- float zoom_inertia = EDITOR_DEF("editors/3d/navigation_feel/zoom_inertia", 0.1);
+ float zoom_inertia = EDITOR_GET("editors/3d/navigation_feel/zoom_inertia");
//determine if being manipulated
bool manipulated = (Input::get_singleton()->get_mouse_button_mask() & (2 | 4)) || Input::get_singleton()->is_key_pressed(KEY_SHIFT) || Input::get_singleton()->is_key_pressed(KEY_ALT) || Input::get_singleton()->is_key_pressed(KEY_CONTROL);
@@ -104,21 +103,30 @@ void SpatialEditorViewport::_update_camera(float p_interp_delta) {
camera_cursor = cursor;
}
- float tolerance = 0.0001;
+ float tolerance = 0.001;
bool equal = true;
- if (Math::abs(old_camera_cursor.x_rot - camera_cursor.x_rot) > tolerance || Math::abs(old_camera_cursor.y_rot - camera_cursor.y_rot) > tolerance)
+ if (Math::abs(old_camera_cursor.x_rot - camera_cursor.x_rot) > tolerance || Math::abs(old_camera_cursor.y_rot - camera_cursor.y_rot) > tolerance) {
equal = false;
+ }
- if (equal && old_camera_cursor.pos.distance_squared_to(camera_cursor.pos) > tolerance * tolerance)
+ if (equal && old_camera_cursor.pos.distance_squared_to(camera_cursor.pos) > tolerance * tolerance) {
equal = false;
+ }
- if (equal && Math::abs(old_camera_cursor.distance - camera_cursor.distance) > tolerance)
+ if (equal && Math::abs(old_camera_cursor.distance - camera_cursor.distance) > tolerance) {
equal = false;
+ }
- if (!equal || p_interp_delta == 0 || is_freelook_active()) {
+ if (!equal || p_interp_delta == 0 || is_freelook_active() || is_orthogonal != orthogonal) {
camera->set_global_transform(to_camera_transform(camera_cursor));
update_transform_gizmo_view();
+
+ if (orthogonal) {
+ //camera->set_orthogonal(size.width*cursor.distance,get_znear(),get_zfar());
+ camera->set_orthogonal(2 * cursor.distance, 0.1, 8192);
+ } else
+ camera->set_perspective(get_fov(), get_znear(), get_zfar());
}
}
@@ -532,8 +540,6 @@ void SpatialEditorViewport::_compute_edit(const Point2 &p_point) {
List<Node *> &selection = editor_selection->get_selected_node_list();
- //Vector3 center;
- //int nc=0;
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
Spatial *sp = Object::cast_to<Spatial>(E->get());
@@ -545,14 +551,8 @@ void SpatialEditorViewport::_compute_edit(const Point2 &p_point) {
continue;
se->original = se->sp->get_global_transform();
- //center+=se->original.origin;
- //nc++;
+ se->original_local = se->sp->get_transform();
}
-
- /*
- if (nc)
- _edit.center=center/float(nc);
- */
}
static int _get_key_modifier_setting(const String &p_property) {
@@ -603,7 +603,7 @@ bool SpatialEditorViewport::_gizmo_select(const Vector2 &p_screenpos, bool p_hig
for (int i = 0; i < 3; i++) {
- Vector3 grabber_pos = gt.origin + gt.basis.get_axis(i) * gs;
+ Vector3 grabber_pos = gt.origin + gt.basis.get_axis(i) * gs * (GIZMO_ARROW_OFFSET + (GIZMO_ARROW_SIZE * 0.5));
float grabber_radius = gs * GIZMO_ARROW_SIZE;
Vector3 r;
@@ -618,7 +618,7 @@ bool SpatialEditorViewport::_gizmo_select(const Vector2 &p_screenpos, bool p_hig
}
bool is_plane_translate = false;
- // second try
+ // plane select
if (col_axis == -1) {
col_d = 1e20;
@@ -704,6 +704,43 @@ bool SpatialEditorViewport::_gizmo_select(const Vector2 &p_screenpos, bool p_hig
}
}
+ if (spatial_editor->get_tool_mode() == SpatialEditor::TOOL_MODE_SCALE) {
+
+ int col_axis = -1;
+ float col_d = 1e20;
+
+ for (int i = 0; i < 3; i++) {
+
+ Vector3 grabber_pos = gt.origin + gt.basis.get_axis(i) * gs * GIZMO_SCALE_OFFSET;
+ float grabber_radius = gs * GIZMO_ARROW_SIZE;
+
+ Vector3 r;
+
+ if (Geometry::segment_intersects_sphere(ray_pos, ray_pos + ray * 10000.0, grabber_pos, grabber_radius, &r)) {
+ float d = r.distance_to(ray_pos);
+ if (d < col_d) {
+ col_d = d;
+ col_axis = i;
+ }
+ }
+ }
+
+ if (col_axis != -1) {
+
+ if (p_highlight_only) {
+
+ spatial_editor->select_gizmo_highlight_axis(col_axis + 9);
+
+ } else {
+ //handle scale
+ _edit.mode = TRANSFORM_SCALE;
+ _compute_edit(Point2(p_screenpos.x, p_screenpos.y));
+ _edit.plane = TransformPlane(TRANSFORM_X_AXIS + col_axis);
+ }
+ return true;
+ }
+ }
+
if (p_highlight_only)
spatial_editor->select_gizmo_highlight_axis(-1);
@@ -1176,7 +1213,28 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
case TRANSFORM_SCALE: {
- Plane plane = Plane(_edit.center, _get_camera_normal());
+ Vector3 motion_mask;
+ Plane plane;
+ bool plane_mv;
+
+ switch (_edit.plane) {
+ case TRANSFORM_VIEW:
+ motion_mask = Vector3(0, 0, 0);
+ plane = Plane(_edit.center, _get_camera_normal());
+ break;
+ case TRANSFORM_X_AXIS:
+ motion_mask = spatial_editor->get_gizmo_transform().basis.get_axis(0);
+ plane = Plane(_edit.center, motion_mask.cross(motion_mask.cross(_get_camera_normal())).normalized());
+ break;
+ case TRANSFORM_Y_AXIS:
+ motion_mask = spatial_editor->get_gizmo_transform().basis.get_axis(1);
+ plane = Plane(_edit.center, motion_mask.cross(motion_mask.cross(_get_camera_normal())).normalized());
+ break;
+ case TRANSFORM_Z_AXIS:
+ motion_mask = spatial_editor->get_gizmo_transform().basis.get_axis(2);
+ plane = Plane(_edit.center, motion_mask.cross(motion_mask.cross(_get_camera_normal())).normalized());
+ break;
+ }
Vector3 intersection;
if (!plane.intersects_ray(ray_pos, ray, &intersection))
@@ -1186,42 +1244,78 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (!plane.intersects_ray(_edit.click_ray_pos, _edit.click_ray, &click))
break;
- float center_click_dist = click.distance_to(_edit.center);
- float center_inters_dist = intersection.distance_to(_edit.center);
- if (center_click_dist == 0)
- break;
+ Vector3 motion = intersection - click;
+ print_line(String(intersection) + " --- " + String(click));
+ if (motion_mask != Vector3()) {
- float scale = (center_inters_dist / center_click_dist) * 100.0;
+ motion = motion_mask.dot(motion) * motion_mask;
+ } else {
- if (_edit.snap || spatial_editor->is_snap_enabled()) {
+ float center_click_dist = click.distance_to(_edit.center);
+ float center_inters_dist = intersection.distance_to(_edit.center);
+ if (center_click_dist == 0)
+ break;
- scale = Math::stepify(scale, spatial_editor->get_scale_snap());
+ float scale = center_inters_dist - center_click_dist;
+ motion = Vector3(scale, scale, scale);
}
- set_message(vformat(TTR("Scaling to %s%%."), String::num(scale, 1)));
- scale /= 100.0;
+ List<Node *> &selection = editor_selection->get_selected_node_list();
- Transform r;
- r.basis.scale(Vector3(scale, scale, scale));
+ bool local_coords = (spatial_editor->are_local_coords_enabled() && motion_mask != Vector3()); // Disable local transformation for TRANSFORM_VIEW
- List<Node *> &selection = editor_selection->get_selected_node_list();
+ float snap = 0;
+ if (_edit.snap || spatial_editor->is_snap_enabled()) {
+
+ snap = spatial_editor->get_scale_snap() / 100;
+ }
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
Spatial *sp = Object::cast_to<Spatial>(E->get());
- if (!sp)
+ if (!sp) {
continue;
+ }
SpatialEditorSelectedItem *se = editor_selection->get_node_editor_data<SpatialEditorSelectedItem>(sp);
- if (!se)
+ if (!se) {
continue;
+ }
Transform original = se->original;
-
+ Transform original_local = se->original_local;
Transform base = Transform(Basis(), _edit.center);
- Transform t = base * (r * (base.inverse() * original));
+ Transform t;
+ Vector3 local_scale;
- sp->set_global_transform(t);
+ if (local_coords) {
+
+ Basis g = original.basis.orthonormalized();
+ Vector3 local_motion = g.inverse().xform(motion);
+
+ if (_edit.snap || spatial_editor->is_snap_enabled()) {
+ local_motion.snap(Vector3(snap, snap, snap));
+ }
+
+ local_scale = original_local.basis.get_scale() * (local_motion + Vector3(1, 1, 1));
+
+ } else {
+
+ if (_edit.snap || spatial_editor->is_snap_enabled()) {
+ motion.snap(Vector3(snap, snap, snap));
+ }
+
+ Transform r;
+ r.basis.scale(motion + Vector3(1, 1, 1));
+ t = base * (r * (base.inverse() * original));
+ }
+
+ // Apply scale
+ if (local_coords) {
+ sp->set_scale(local_scale);
+ } else {
+ sp->set_global_transform(t);
+ }
}
surface->update();
@@ -1348,6 +1442,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
case TRANSFORM_ROTATE: {
Plane plane;
+ Vector3 axis;
switch (_edit.plane) {
case TRANSFORM_VIEW:
@@ -1355,12 +1450,15 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
break;
case TRANSFORM_X_AXIS:
plane = Plane(_edit.center, spatial_editor->get_gizmo_transform().basis.get_axis(0));
+ axis = Vector3(1, 0, 0);
break;
case TRANSFORM_Y_AXIS:
plane = Plane(_edit.center, spatial_editor->get_gizmo_transform().basis.get_axis(1));
+ axis = Vector3(0, 1, 0);
break;
case TRANSFORM_Z_AXIS:
plane = Plane(_edit.center, spatial_editor->get_gizmo_transform().basis.get_axis(2));
+ axis = Vector3(0, 0, 1);
break;
}
@@ -1376,6 +1474,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
Vector3 x_axis = plane.normal.cross(y_axis).normalized();
float angle = Math::atan2(x_axis.dot(intersection - _edit.center), y_axis.dot(intersection - _edit.center));
+
if (_edit.snap || spatial_editor->is_snap_enabled()) {
float snap = spatial_editor->get_rotate_snap();
@@ -1392,11 +1491,10 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
set_message(vformat(TTR("Rotating %s degrees."), rtos(Math::rad2deg(angle))));
}
- Transform r;
- r.basis.rotate(plane.normal, angle);
-
List<Node *> &selection = editor_selection->get_selected_node_list();
+ bool local_coords = spatial_editor->are_local_coords_enabled();
+
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
Spatial *sp = Object::cast_to<Spatial>(E->get());
@@ -1407,27 +1505,33 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (!se)
continue;
- Transform original = se->original;
+ Transform t;
- Transform base = Transform(Basis(), _edit.center);
- Transform t = base * r * base.inverse() * original;
+ if (local_coords) {
- sp->set_global_transform(t);
+ Transform original_local = se->original_local;
+ Basis rot = Basis(axis, angle);
+
+ t.basis = original_local.get_basis() * rot;
+ t.origin = original_local.origin;
+
+ sp->set_transform(t);
+
+ } else {
+
+ Transform original = se->original;
+ Transform r;
+ Transform base = Transform(Basis(), _edit.center);
+
+ r.basis.rotate(plane.normal, angle);
+ t = base * r * base.inverse() * original;
+
+ sp->set_global_transform(t);
+ }
}
surface->update();
- /*
- VisualServer::get_singleton()->poly_clear(indicators);
-
- Vector<Vector3> points;
- Vector<Vector3> empty;
- Vector<Color> colors;
- points.push_back(intersection);
- points.push_back(_edit.original.origin);
- colors.push_back( Color(255,155,100) );
- colors.push_back( Color(255,155,100) );
- VisualServer::get_singleton()->poly_add_primitive(indicators,points,empty,colors,empty);
- */
+
} break;
default: {}
}
@@ -1844,7 +1948,7 @@ void SpatialEditorViewport::_notification(int p_what) {
last_message = message;
}
- message_time -= get_fixed_process_delta_time();
+ message_time -= get_physics_process_delta_time();
if (message_time < 0)
surface->update();
}
@@ -2265,6 +2369,14 @@ void SpatialEditorViewport::_init_gizmo_instance(int p_idx) {
//VS::get_singleton()->instance_geometry_set_flag(rotate_gizmo_instance[i],VS::INSTANCE_FLAG_DEPH_SCALE,true);
VS::get_singleton()->instance_geometry_set_cast_shadows_setting(rotate_gizmo_instance[i], VS::SHADOW_CASTING_SETTING_OFF);
VS::get_singleton()->instance_set_layer_mask(rotate_gizmo_instance[i], layer);
+
+ scale_gizmo_instance[i] = VS::get_singleton()->instance_create();
+ VS::get_singleton()->instance_set_base(scale_gizmo_instance[i], spatial_editor->get_scale_gizmo(i)->get_rid());
+ VS::get_singleton()->instance_set_scenario(scale_gizmo_instance[i], get_tree()->get_root()->get_world()->get_scenario());
+ VS::get_singleton()->instance_set_visible(scale_gizmo_instance[i], false);
+ //VS::get_singleton()->instance_geometry_set_flag(scale_gizmo_instance[i],VS::INSTANCE_FLAG_DEPH_SCALE,true);
+ VS::get_singleton()->instance_geometry_set_cast_shadows_setting(scale_gizmo_instance[i], VS::SHADOW_CASTING_SETTING_OFF);
+ VS::get_singleton()->instance_set_layer_mask(scale_gizmo_instance[i], layer);
}
}
@@ -2274,6 +2386,7 @@ void SpatialEditorViewport::_finish_gizmo_instances() {
VS::get_singleton()->free(move_gizmo_instance[i]);
VS::get_singleton()->free(move_plane_gizmo_instance[i]);
VS::get_singleton()->free(rotate_gizmo_instance[i]);
+ VS::get_singleton()->free(scale_gizmo_instance[i]);
}
}
void SpatialEditorViewport::_toggle_camera_preview(bool p_activate) {
@@ -2368,6 +2481,8 @@ void SpatialEditorViewport::update_transform_gizmo_view() {
VisualServer::get_singleton()->instance_set_visible(move_plane_gizmo_instance[i], spatial_editor->is_gizmo_visible() && (spatial_editor->get_tool_mode() == SpatialEditor::TOOL_MODE_SELECT || spatial_editor->get_tool_mode() == SpatialEditor::TOOL_MODE_MOVE));
VisualServer::get_singleton()->instance_set_transform(rotate_gizmo_instance[i], xform);
VisualServer::get_singleton()->instance_set_visible(rotate_gizmo_instance[i], spatial_editor->is_gizmo_visible() && (spatial_editor->get_tool_mode() == SpatialEditor::TOOL_MODE_SELECT || spatial_editor->get_tool_mode() == SpatialEditor::TOOL_MODE_ROTATE));
+ VisualServer::get_singleton()->instance_set_transform(scale_gizmo_instance[i], xform);
+ VisualServer::get_singleton()->instance_set_visible(scale_gizmo_instance[i], spatial_editor->is_gizmo_visible() && (spatial_editor->get_tool_mode() == SpatialEditor::TOOL_MODE_SCALE));
}
}
@@ -2836,7 +2951,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
ViewportContainer *c = memnew(ViewportContainer);
c->set_stretch(true);
add_child(c);
- c->set_area_as_parent_rect();
+ c->set_anchors_and_margins_preset(Control::PRESET_WIDE);
viewport = memnew(Viewport);
viewport->set_disable_input(true);
@@ -2844,7 +2959,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
surface = memnew(Control);
surface->set_drag_forwarding(this);
add_child(surface);
- surface->set_area_as_parent_rect();
+ surface->set_anchors_and_margins_preset(Control::PRESET_WIDE);
surface->set_clip_contents(true);
camera = memnew(Camera);
camera->set_disable_gizmo(true);
@@ -3253,6 +3368,7 @@ void SpatialEditor::select_gizmo_highlight_axis(int p_axis) {
move_gizmo[i]->surface_set_material(0, i == p_axis ? gizmo_hl : gizmo_color[i]);
move_plane_gizmo[i]->surface_set_material(0, (i + 6) == p_axis ? gizmo_hl : plane_gizmo_color[i]);
rotate_gizmo[i]->surface_set_material(0, (i + 3) == p_axis ? gizmo_hl : gizmo_color[i]);
+ scale_gizmo[i]->surface_set_material(0, (i + 9) == p_axis ? gizmo_hl : gizmo_color[i]);
}
}
@@ -3263,7 +3379,7 @@ void SpatialEditor::update_transform_gizmo() {
bool first = true;
Basis gizmo_basis;
- bool local_gizmo_coords = transform_menu->get_popup()->is_item_checked(transform_menu->get_popup()->get_item_index(MENU_TRANSFORM_LOCAL_COORDS));
+ bool local_gizmo_coords = are_local_coords_enabled();
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
@@ -3714,20 +3830,13 @@ void SpatialEditor::_menu_item_pressed(int p_option) {
void SpatialEditor::_init_indicators() {
- //RID mat = VisualServer::get_singleton()->fixed_material_create();
- ///VisualServer::get_singleton()->fixed_material_set_flag(mat, VisualServer::FIXED_MATERIAL_FLAG_USE_ALPHA,true);
- //VisualServer::get_singleton()->fixed_material_set_flag(mat, VisualServer::FIXED_MATERIAL_FLAG_USE_COLOR_ARRAY,true);
-
{
indicator_mat.instance();
indicator_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
- //indicator_mat->set_flag(SpatialMaterial::FLAG_ONTOP,true);
indicator_mat->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
indicator_mat->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
- indicator_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
-
PoolVector<Color> grid_colors[3];
PoolVector<Vector3> grid_points[3];
Vector<Color> origin_colors;
@@ -3747,50 +3856,31 @@ void SpatialEditor::_init_indicators() {
origin_colors.push_back(Color(axis.x, axis.y, axis.z));
origin_points.push_back(axis * 4096);
origin_points.push_back(axis * -4096);
-#define ORIGIN_GRID_SIZE 100
+#define ORIGIN_GRID_SIZE 50
for (int j = -ORIGIN_GRID_SIZE; j <= ORIGIN_GRID_SIZE; j++) {
- for (int k = -ORIGIN_GRID_SIZE; k <= ORIGIN_GRID_SIZE; k++) {
-
- Vector3 p = axis_n1 * j + axis_n2 * k;
- float trans = Math::pow(MAX(0, 1.0 - (Vector2(j, k).length() / ORIGIN_GRID_SIZE)), 2);
-
- Vector3 pj = axis_n1 * (j + 1) + axis_n2 * k;
- float transj = Math::pow(MAX(0, 1.0 - (Vector2(j + 1, k).length() / ORIGIN_GRID_SIZE)), 2);
-
- Vector3 pk = axis_n1 * j + axis_n2 * (k + 1);
- float transk = Math::pow(MAX(0, 1.0 - (Vector2(j, k + 1).length() / ORIGIN_GRID_SIZE)), 2);
+ Vector3 p1 = axis_n1 * j + axis_n2 * -ORIGIN_GRID_SIZE;
+ Vector3 p1_dest = p1 * (-axis_n2 + axis_n1);
+ Vector3 p2 = axis_n2 * j + axis_n1 * -ORIGIN_GRID_SIZE;
+ Vector3 p2_dest = p2 * (-axis_n1 + axis_n2);
- Color trans_color = grid_color;
- trans_color.a *= trans;
-
- Color transk_color = grid_color;
- transk_color.a *= transk;
-
- Color transj_color = grid_color;
- transj_color.a *= transj;
-
- if (j % 10 == 0 || k % 10 == 0) {
- trans_color.a *= 2;
- }
- if ((k + 1) % 10 == 0) {
- transk_color.a *= 2;
- }
- if ((j + 1) % 10 == 0) {
- transj_color.a *= 2;
- }
+ Color line_color = grid_color;
+ if (j == 0) {
+ continue;
+ } else if (j % 10 == 0) {
+ line_color *= 1.5;
+ }
- grid_points[i].push_back(p);
- grid_points[i].push_back(pk);
- grid_colors[i].push_back(trans_color);
- grid_colors[i].push_back(transk_color);
+ grid_points[i].push_back(p1);
+ grid_points[i].push_back(p1_dest);
+ grid_colors[i].push_back(line_color);
+ grid_colors[i].push_back(line_color);
- grid_points[i].push_back(p);
- grid_points[i].push_back(pj);
- grid_colors[i].push_back(trans_color);
- grid_colors[i].push_back(transj_color);
- }
+ grid_points[i].push_back(p2);
+ grid_points[i].push_back(p2_dest);
+ grid_colors[i].push_back(line_color);
+ grid_colors[i].push_back(line_color);
}
grid[i] = VisualServer::get_singleton()->mesh_create();
@@ -3834,32 +3924,6 @@ void SpatialEditor::_init_indicators() {
}
{
- cursor_mesh = VisualServer::get_singleton()->mesh_create();
- PoolVector<Vector3> cursor_points;
- float cs = 0.25;
- cursor_points.push_back(Vector3(+cs, 0, 0));
- cursor_points.push_back(Vector3(-cs, 0, 0));
- cursor_points.push_back(Vector3(0, +cs, 0));
- cursor_points.push_back(Vector3(0, -cs, 0));
- cursor_points.push_back(Vector3(0, 0, +cs));
- cursor_points.push_back(Vector3(0, 0, -cs));
- cursor_material.instance();
- cursor_material->set_albedo(Color(0, 1, 1));
- cursor_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
-
- Array d;
- d.resize(VS::ARRAY_MAX);
- d[VS::ARRAY_VERTEX] = cursor_points;
- VisualServer::get_singleton()->mesh_add_surface_from_arrays(cursor_mesh, VS::PRIMITIVE_LINES, d);
- VisualServer::get_singleton()->mesh_surface_set_material(cursor_mesh, 0, cursor_material->get_rid());
-
- cursor_instance = VisualServer::get_singleton()->instance_create2(cursor_mesh, get_tree()->get_root()->get_world()->get_scenario());
- VS::get_singleton()->instance_set_layer_mask(cursor_instance, 1 << SpatialEditorViewport::GIZMO_GRID_LAYER);
-
- VisualServer::get_singleton()->instance_geometry_set_cast_shadows_setting(cursor_instance, VS::SHADOW_CASTING_SETTING_OFF);
- }
-
- {
//move gizmo
@@ -3877,6 +3941,7 @@ void SpatialEditor::_init_indicators() {
move_gizmo[i] = Ref<ArrayMesh>(memnew(ArrayMesh));
move_plane_gizmo[i] = Ref<ArrayMesh>(memnew(ArrayMesh));
rotate_gizmo[i] = Ref<ArrayMesh>(memnew(ArrayMesh));
+ scale_gizmo[i] = Ref<ArrayMesh>(memnew(ArrayMesh));
Ref<SpatialMaterial> mat = memnew(SpatialMaterial);
mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
@@ -3899,25 +3964,25 @@ void SpatialEditor::_init_indicators() {
Vector3 ivec3;
ivec3[(i + 2) % 3] = 1;
+ //translate
{
Ref<SurfaceTool> surftool = memnew(SurfaceTool);
surftool->begin(Mesh::PRIMITIVE_TRIANGLES);
- //translate
-
+ // Arrow profile
const int arrow_points = 5;
Vector3 arrow[5] = {
nivec * 0.0 + ivec * 0.0,
nivec * 0.01 + ivec * 0.0,
- nivec * 0.01 + ivec * 1.0,
- nivec * 0.1 + ivec * 1.0,
- nivec * 0.0 + ivec * (1 + GIZMO_ARROW_SIZE),
+ nivec * 0.01 + ivec * GIZMO_ARROW_OFFSET,
+ nivec * 0.065 + ivec * GIZMO_ARROW_OFFSET,
+ nivec * 0.0 + ivec * (GIZMO_ARROW_OFFSET + GIZMO_ARROW_SIZE),
};
int arrow_sides = 6;
- for (int k = 0; k < 7; k++) {
+ for (int k = 0; k < 6; k++) {
Basis ma(ivec, Math_PI * 2 * float(k) / arrow_sides);
Basis mb(ivec, Math_PI * 2 * float(k + 1) / arrow_sides);
@@ -3944,7 +4009,7 @@ void SpatialEditor::_init_indicators() {
surftool->commit(move_gizmo[i]);
}
- // plane translation
+ // Plane Translation
{
Ref<SurfaceTool> surftool = memnew(SurfaceTool);
surftool->begin(Mesh::PRIMITIVE_TRIANGLES);
@@ -3987,6 +4052,7 @@ void SpatialEditor::_init_indicators() {
surftool->commit(move_plane_gizmo[i]);
}
+ // Rotate
{
Ref<SurfaceTool> surftool = memnew(SurfaceTool);
@@ -4000,7 +4066,7 @@ void SpatialEditor::_init_indicators() {
ivec * 0.02 + ivec2 * 0.02 + ivec2 * GIZMO_CIRCLE_SIZE,
};
- for (int k = 0; k < 33; k++) {
+ for (int k = 0; k < 32; k++) {
Basis ma(ivec, Math_PI * 2 * float(k) / 32);
Basis mb(ivec, Math_PI * 2 * float(k + 1) / 32);
@@ -4026,19 +4092,55 @@ void SpatialEditor::_init_indicators() {
surftool->set_material(mat);
surftool->commit(rotate_gizmo[i]);
}
- }
- }
- /*for(int i=0;i<4;i++) {
+ // Scale
+ {
+ Ref<SurfaceTool> surftool = memnew(SurfaceTool);
+ surftool->begin(Mesh::PRIMITIVE_TRIANGLES);
+
+ // Cube arrow profile
+ const int arrow_points = 6;
+ Vector3 arrow[6] = {
+ nivec * 0.0 + ivec * 0.0,
+ nivec * 0.01 + ivec * 0.0,
+ nivec * 0.01 + ivec * 1.0 * GIZMO_SCALE_OFFSET,
+ nivec * 0.07 + ivec * 1.0 * GIZMO_SCALE_OFFSET,
+ nivec * 0.07 + ivec * 1.11 * GIZMO_SCALE_OFFSET,
+ nivec * 0.0 + ivec * 1.11 * GIZMO_SCALE_OFFSET,
+ };
- viewports[i]->init_gizmo_instance(i);
- }*/
+ int arrow_sides = 4;
- _generate_selection_box();
+ for (int k = 0; k < 4; k++) {
+
+ Basis ma(ivec, Math_PI * 2 * float(k) / arrow_sides);
+ Basis mb(ivec, Math_PI * 2 * float(k + 1) / arrow_sides);
+
+ for (int j = 0; j < arrow_points - 1; j++) {
- //Object::cast_to<EditorNode>(get_scene()->get_root_node())->get_scene_root()->add_child(camera);
+ Vector3 points[4] = {
+ ma.xform(arrow[j]),
+ mb.xform(arrow[j]),
+ mb.xform(arrow[j + 1]),
+ ma.xform(arrow[j + 1]),
+ };
+ surftool->add_vertex(points[0]);
+ surftool->add_vertex(points[1]);
+ surftool->add_vertex(points[2]);
+
+ surftool->add_vertex(points[0]);
+ surftool->add_vertex(points[2]);
+ surftool->add_vertex(points[3]);
+ }
+ }
- //current_camera=camera;
+ surftool->set_material(mat);
+ surftool->commit(scale_gizmo[i]);
+ }
+ }
+ }
+
+ _generate_selection_box();
}
void SpatialEditor::_finish_indicators() {
@@ -4052,9 +4154,6 @@ void SpatialEditor::_finish_indicators() {
//VisualServer::get_singleton()->free(poly);
//VisualServer::get_singleton()->free(indicators_instance);
//VisualServer::get_singleton()->free(indicators);
-
- VisualServer::get_singleton()->free(cursor_instance);
- VisualServer::get_singleton()->free(cursor_mesh);
}
bool SpatialEditor::is_any_freelook_active() const {
@@ -4216,7 +4315,7 @@ void SpatialEditor::_toggle_maximize_view(Object *p_viewport) {
for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) {
if (i == (uint32_t)index)
- viewports[i]->set_area_as_parent_rect();
+ viewports[i]->set_anchors_and_margins_preset(Control::PRESET_WIDE);
else
viewports[i]->hide();
}
@@ -4642,7 +4741,7 @@ SpatialEditorPlugin::SpatialEditorPlugin(EditorNode *p_node) {
spatial_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
editor->get_viewport()->add_child(spatial_editor);
- //spatial_editor->set_area_as_parent_rect();
+ //spatial_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE);
spatial_editor->hide();
spatial_editor->connect("transform_key_request", editor, "_transform_keyed");
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index e0ded6e646..4f4c540048 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -245,7 +245,7 @@ private:
real_t zoom_indicator_delay;
- RID move_gizmo_instance[3], move_plane_gizmo_instance[3], rotate_gizmo_instance[3];
+ RID move_gizmo_instance[3], move_plane_gizmo_instance[3], rotate_gizmo_instance[3], scale_gizmo_instance[3];
String last_message;
String message;
@@ -319,6 +319,7 @@ class SpatialEditorSelectedItem : public Object {
public:
Rect3 aabb;
Transform original; // original location when moving
+ Transform original_local;
Transform last_xform; // last transform
Spatial *sp;
RID sbox_instance;
@@ -407,7 +408,7 @@ private:
bool grid_enable[3]; //should be always visible if true
bool grid_enabled;
- Ref<ArrayMesh> move_gizmo[3], move_plane_gizmo[3], rotate_gizmo[3];
+ Ref<ArrayMesh> move_gizmo[3], move_plane_gizmo[3], rotate_gizmo[3], scale_gizmo[3];
Ref<SpatialMaterial> gizmo_color[3];
Ref<SpatialMaterial> plane_gizmo_color[3];
Ref<SpatialMaterial> gizmo_hl;
@@ -557,6 +558,7 @@ public:
Ref<ArrayMesh> get_move_gizmo(int idx) const { return move_gizmo[idx]; }
Ref<ArrayMesh> get_move_plane_gizmo(int idx) const { return move_plane_gizmo[idx]; }
Ref<ArrayMesh> get_rotate_gizmo(int idx) const { return rotate_gizmo[idx]; }
+ Ref<ArrayMesh> get_scale_gizmo(int idx) const { return scale_gizmo[idx]; }
void update_transform_gizmo();
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index b9cb1788f0..3b6eeb61d6 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -39,7 +39,7 @@ void SpriteFramesEditor::_gui_input(Ref<InputEvent> p_event) {
void SpriteFramesEditor::_notification(int p_what) {
- if (p_what == NOTIFICATION_FIXED_PROCESS) {
+ if (p_what == NOTIFICATION_PHYSICS_PROCESS) {
}
if (p_what == NOTIFICATION_ENTER_TREE) {
@@ -535,7 +535,7 @@ void SpriteFramesEditor::edit(SpriteFrames *p_frames) {
} else {
hide();
- //set_fixed_process(false);
+ //set_physics_process(false);
}
}
diff --git a/editor/plugins/style_box_editor_plugin.cpp b/editor/plugins/style_box_editor_plugin.cpp
index 478ca2e972..5c965e4a05 100644
--- a/editor/plugins/style_box_editor_plugin.cpp
+++ b/editor/plugins/style_box_editor_plugin.cpp
@@ -57,7 +57,7 @@ StyleBoxEditor::StyleBoxEditor() {
panel = memnew(Panel);
add_child(panel);
- panel->set_area_as_parent_rect();
+ panel->set_anchors_and_margins_preset(Control::PRESET_WIDE);
Label *l = memnew(Label);
l->set_text(TTR("StyleBox Preview:"));
diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp
index 90dc4cf993..855e857d80 100644
--- a/editor/plugins/texture_editor_plugin.cpp
+++ b/editor/plugins/texture_editor_plugin.cpp
@@ -38,7 +38,7 @@ void TextureEditor::_gui_input(Ref<InputEvent> p_event) {
void TextureEditor::_notification(int p_what) {
- if (p_what == NOTIFICATION_FIXED_PROCESS) {
+ if (p_what == NOTIFICATION_PHYSICS_PROCESS) {
}
if (p_what == NOTIFICATION_READY) {
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 38d1350b07..0a7f3ff8f9 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -39,7 +39,7 @@
void draw_margin_line(Control *edit_draw, Vector2 from, Vector2 to) {
Vector2 line = (to - from).normalized() * 10;
while ((to - from).length_squared() > 200) {
- edit_draw->draw_line(from, from + line, Color(0.97, 0.2, 0.2), 2);
+ edit_draw->draw_line(from, from + line, EditorNode::get_singleton()->get_theme_base()->get_color("mono_color", "Editor"), 2);
from += line * 2;
}
}
@@ -66,6 +66,7 @@ void TextureRegionEditor::_region_draw() {
VS::get_singleton()->canvas_item_add_set_transform(edit_draw->get_canvas_item(), Transform2D());
if (snap_mode == SNAP_GRID) {
+ Color grid_color = get_color("grid_major_color", "Editor");
Size2 s = edit_draw->get_size();
int last_cell = 0;
@@ -76,7 +77,7 @@ void TextureRegionEditor::_region_draw() {
if (i == 0)
last_cell = cell;
if (last_cell != cell)
- edit_draw->draw_line(Point2(i, 0), Point2(i, s.height), Color(0.3, 0.7, 1, 0.3));
+ edit_draw->draw_line(Point2(i, 0), Point2(i, s.height), grid_color);
last_cell = cell;
}
else
@@ -85,7 +86,7 @@ void TextureRegionEditor::_region_draw() {
if (i == 0)
last_cell = cell;
if (last_cell != cell)
- edit_draw->draw_rect(Rect2(i - snap_separation.x * draw_zoom, 0, snap_separation.x * draw_zoom, s.height), Color(0.3, 0.7, 1, 0.3));
+ edit_draw->draw_rect(Rect2(i - snap_separation.x * draw_zoom, 0, snap_separation.x * draw_zoom, s.height), grid_color);
last_cell = cell;
}
}
@@ -97,7 +98,7 @@ void TextureRegionEditor::_region_draw() {
if (i == 0)
last_cell = cell;
if (last_cell != cell)
- edit_draw->draw_line(Point2(0, i), Point2(s.width, i), Color(0.3, 0.7, 1, 0.3));
+ edit_draw->draw_line(Point2(0, i), Point2(s.width, i), grid_color);
last_cell = cell;
}
else
@@ -106,7 +107,7 @@ void TextureRegionEditor::_region_draw() {
if (i == 0)
last_cell = cell;
if (last_cell != cell)
- edit_draw->draw_rect(Rect2(0, i - snap_separation.y * draw_zoom, s.width, snap_separation.y * draw_zoom), Color(0.3, 0.7, 1, 0.3));
+ edit_draw->draw_rect(Rect2(0, i - snap_separation.y * draw_zoom, s.width, snap_separation.y * draw_zoom), grid_color);
last_cell = cell;
}
}
@@ -137,7 +138,7 @@ void TextureRegionEditor::_region_draw() {
mtx.basis_xform(rect.position + rect.size),
mtx.basis_xform(rect.position + Vector2(0, rect.size.y))
};
- Color color(0.9, 0.5, 0.5);
+ Color color = get_color("mono_color", "Editor");
for (int i = 0; i < 4; i++) {
int prev = (i + 3) % 4;
@@ -773,7 +774,7 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) {
VBoxContainer *main_vb = memnew(VBoxContainer);
add_child(main_vb);
- main_vb->set_area_as_parent_rect(0);
+ main_vb->set_anchors_and_margins_preset(Control::PRESET_WIDE);
HBoxContainer *hb_tools = memnew(HBoxContainer);
main_vb->add_child(hb_tools);
@@ -906,7 +907,7 @@ void TextureRegionEditorPlugin::edit(Object *p_object) {
}
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");
+ return p_object->is_class("Sprite") || p_object->is_class("NinePatchRect") || p_object->is_class("StyleBoxTexture") || p_object->is_class("AtlasTexture");
}
void TextureRegionEditorPlugin::make_visible(bool p_visible) {
diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp
index 86ef1a489f..e500dec0ef 100644
--- a/editor/plugins/theme_editor_plugin.cpp
+++ b/editor/plugins/theme_editor_plugin.cpp
@@ -607,7 +607,7 @@ ThemeEditor::ThemeEditor() {
scroll = memnew(ScrollContainer);
add_child(scroll);
- scroll->set_area_as_parent_rect(3);
+ scroll->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 3);
scroll->set_margin(MARGIN_TOP, 30 * EDSCALE);
//scroll->set_enable_h_scroll(true);
scroll->set_enable_v_scroll(true);
@@ -621,7 +621,7 @@ ThemeEditor::ThemeEditor() {
main_vb = memnew(VBoxContainer);
panel->add_child(main_vb);
- main_vb->set_area_as_parent_rect(4 * EDSCALE);
+ main_vb->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 4 * EDSCALE);
HBoxContainer *hb_menu = memnew(HBoxContainer);
main_vb->add_child(hb_menu);
@@ -648,7 +648,7 @@ ThemeEditor::ThemeEditor() {
main_hb->add_child(first_vb);
//main_panel->add_child(panel);
- //panel->set_area_as_parent_rect();
+ //panel->set_anchors_and_margins_preset(Control::PRESET_WIDE);
//panel->set_margin( MARGIN_TOP,20 );
first_vb->add_child(memnew(Label("Label")));
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index b85ffd6c67..2f2ed7bdf0 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -39,6 +39,14 @@ void TileMapEditor::_notification(int p_what) {
switch (p_what) {
+ case NOTIFICATION_PROCESS: {
+
+ if (bucket_queue.size() && canvas_item_editor) {
+ canvas_item_editor->update();
+ }
+
+ } break;
+
case NOTIFICATION_ENTER_TREE: {
transp->set_icon(get_icon("Transpose", "EditorIcons"));
@@ -351,6 +359,10 @@ PoolVector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool era
return PoolVector<Vector2>();
}
+ if (id == prev_id) {
+ return PoolVector<Vector2>();
+ }
+
Rect2i r = node->get_item_rect();
r.position = r.position / node->get_cell_size();
r.size = r.size / node->get_cell_size();
@@ -378,20 +390,26 @@ PoolVector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool era
bucket_cache = PoolVector<Vector2>();
bucket_cache_tile = prev_id;
bucket_cache_rect = r;
- } else {
- return bucket_cache;
+ bucket_queue.clear();
}
}
PoolVector<Vector2> points;
+ int count = 0;
+ int limit = 0;
+
+ if (preview) {
+ limit = 1024;
+ } else {
+ bucket_queue.clear();
+ }
- List<Point2i> queue;
- queue.push_back(p_start);
+ bucket_queue.push_back(p_start);
- while (queue.size()) {
+ while (bucket_queue.size()) {
- Point2i n = queue.front()->get();
- queue.pop_front();
+ Point2i n = bucket_queue.front()->get();
+ bucket_queue.pop_front();
if (!r.has_point(n))
continue;
@@ -409,10 +427,15 @@ PoolVector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool era
points.push_back(n);
}
- queue.push_back(n + Point2i(0, 1));
- queue.push_back(n + Point2i(0, -1));
- queue.push_back(n + Point2i(1, 0));
- queue.push_back(n + Point2i(-1, 0));
+ bucket_queue.push_back(Point2i(n.x, n.y + 1));
+ bucket_queue.push_back(Point2i(n.x, n.y - 1));
+ bucket_queue.push_back(Point2i(n.x + 1, n.y));
+ bucket_queue.push_back(Point2i(n.x - 1, n.y));
+ count++;
+ }
+
+ if (limit > 0 && count >= limit) {
+ break;
}
}
@@ -1644,6 +1667,7 @@ TileMapEditorPlugin::TileMapEditorPlugin(EditorNode *p_node) {
tile_map_editor = memnew(TileMapEditor(p_node));
add_control_to_container(CONTAINER_CANVAS_EDITOR_SIDE, tile_map_editor);
tile_map_editor->hide();
+ tile_map_editor->set_process(true);
}
TileMapEditorPlugin::~TileMapEditorPlugin() {
diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h
index de9b9e8e0d..c8f29dfb7b 100644
--- a/editor/plugins/tile_map_editor_plugin.h
+++ b/editor/plugins/tile_map_editor_plugin.h
@@ -113,6 +113,7 @@ class TileMapEditor : public VBoxContainer {
Rect2i bucket_cache_rect;
int bucket_cache_tile;
PoolVector<Vector2> bucket_cache;
+ List<Point2i> bucket_queue;
struct CellOp {
int idx;
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index 443c280428..f2f71ba6b1 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -238,7 +238,7 @@ void TileSetEditor::_bind_methods() {
TileSetEditor::TileSetEditor(EditorNode *p_editor) {
Panel *panel = memnew(Panel);
- panel->set_area_as_parent_rect();
+ panel->set_anchors_and_margins_preset(Control::PRESET_WIDE);
add_child(panel);
MenuButton *options = memnew(MenuButton);
panel->add_child(options);
@@ -293,7 +293,7 @@ TileSetEditorPlugin::TileSetEditorPlugin(EditorNode *p_node) {
tileset_editor = memnew(TileSetEditor(p_node));
p_node->get_viewport()->add_child(tileset_editor);
- tileset_editor->set_area_as_parent_rect();
+ tileset_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE);
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 376d9d3158..09f5375bb4 100644
--- a/editor/progress_dialog.cpp
+++ b/editor/progress_dialog.cpp
@@ -49,7 +49,7 @@ void BackgroundProgress::_add_task(const String &p_task, const String &p_label,
Control *ec = memnew(Control);
ec->set_h_size_flags(SIZE_EXPAND_FILL);
ec->set_v_size_flags(SIZE_EXPAND_FILL);
- t.progress->set_area_as_parent_rect();
+ t.progress->set_anchors_and_margins_preset(Control::PRESET_WIDE);
ec->add_child(t.progress);
ec->set_custom_minimum_size(Size2(80, 5) * EDSCALE);
t.hb->add_child(ec);
@@ -222,7 +222,7 @@ ProgressDialog::ProgressDialog() {
main = memnew(VBoxContainer);
add_child(main);
- main->set_area_as_parent_rect();
+ main->set_anchors_and_margins_preset(Control::PRESET_WIDE);
set_exclusive(true);
last_progress_tick = 0;
singleton = this;
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index c3b50657f9..e5b6f8e406 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -71,7 +71,7 @@ void ProjectExportDialog::popup_export() {
_update_presets();
// Restore valid window bounds or pop up at default size.
- if (EditorSettings::get_singleton()->has("interface/dialogs/export_bounds")) {
+ if (EditorSettings::get_singleton()->has_setting("interface/dialogs/export_bounds")) {
popup(EditorSettings::get_singleton()->get("interface/dialogs/export_bounds"));
} else {
popup_centered_ratio();
@@ -894,7 +894,7 @@ ProjectExportDialog::ProjectExportDialog() {
Panel *features_panel = memnew(Panel);
custom_feature_display = memnew(RichTextLabel);
features_panel->add_child(custom_feature_display);
- custom_feature_display->set_area_as_parent_rect(10 * EDSCALE);
+ custom_feature_display->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 10 * EDSCALE);
custom_feature_display->set_v_size_flags(SIZE_EXPAND_FILL);
feature_vb->add_margin_child(TTR("Feature List:"), features_panel, true);
sections->add_child(feature_vb);
@@ -929,7 +929,7 @@ ProjectExportDialog::ProjectExportDialog() {
export_error = memnew(Label);
main_vb->add_child(export_error);
export_error->hide();
- export_error->add_color_override("font_color", Color(1, 0.5, 0.5));
+ export_error->add_color_override("font_color", get_color("error_color", "Editor"));
export_templates_error = memnew(HBoxContainer);
main_vb->add_child(export_templates_error);
@@ -937,7 +937,7 @@ ProjectExportDialog::ProjectExportDialog() {
Label *export_error2 = memnew(Label);
export_templates_error->add_child(export_error2);
- export_error2->add_color_override("font_color", Color(1, 0.5, 0.5));
+ export_error2->add_color_override("font_color", get_color("error_color", "Editor"));
export_error2->set_text(" - " + TTR("Export templates for this platform are missing:") + " ");
LinkButton *download_templates = memnew(LinkButton);
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index f8f222ac2e..d1210ee26a 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -51,9 +51,9 @@
#include "version.h"
#include "version_hash.gen.h"
-class NewProjectDialog : public ConfirmationDialog {
+class ProjectDialog : public ConfirmationDialog {
- GDCLASS(NewProjectDialog, ConfirmationDialog);
+ GDCLASS(ProjectDialog, ConfirmationDialog);
public:
enum Mode {
@@ -64,20 +64,56 @@ public:
};
private:
+ enum MessageType {
+ MESSAGE_ERROR,
+ MESSAGE_WARNING,
+ MESSAGE_SUCCESS
+ };
+
Mode mode;
Button *browse;
- Label *pp, *pn;
- Label *error;
+ Button *create_dir;
+ Container *name_container;
+ Container *path_container;
+ Label *msg;
LineEdit *project_path;
LineEdit *project_name;
+ ToolButton *status_btn;
FileDialog *fdialog;
String zip_path;
String zip_title;
AcceptDialog *dialog_error;
+ String fav_dir;
+
+ String created_folder_path;
+
+ void set_message(const String &p_msg, MessageType p_type = MESSAGE_SUCCESS) {
+ msg->set_text(p_msg);
+ if (p_msg == "") {
+ status_btn->set_icon(get_icon("StatusSuccess", "EditorIcons"));
+ return;
+ }
+ msg->hide();
+ switch (p_type) {
+ case MESSAGE_ERROR:
+ msg->add_color_override("font_color", get_color("error_color", "Editor"));
+ status_btn->set_icon(get_icon("StatusError", "EditorIcons"));
+ msg->show();
+ break;
+ case MESSAGE_WARNING:
+ msg->add_color_override("font_color", get_color("warning_color", "Editor"));
+ status_btn->set_icon(get_icon("StatusWarning", "EditorIcons"));
+ break;
+ case MESSAGE_SUCCESS:
+ msg->add_color_override("font_color", get_color("success_color", "Editor"));
+ status_btn->set_icon(get_icon("StatusSuccess", "EditorIcons"));
+ break;
+ }
+ }
String _test_path() {
- error->set_text("");
+ set_message(" ");
get_ok()->set_disabled(true);
DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
String valid_path;
@@ -88,7 +124,7 @@ private:
}
if (valid_path == "") {
- error->set_text(TTR("Invalid project path, the path must exist!"));
+ set_message(TTR("The path does not exists."), MESSAGE_ERROR);
memdelete(d);
return "";
}
@@ -97,16 +133,35 @@ private:
if (valid_path != "" && !d->file_exists("project.godot")) {
- error->set_text(TTR("Invalid project path, project.godot must exist."));
+ set_message(TTR("Please choose a 'project.godot' file."), MESSAGE_ERROR);
memdelete(d);
return "";
}
+ } else if (mode == MODE_NEW) {
+
+ // check if the specified folder is empty, even though this is not an error, it is good to check here
+ d->list_dir_begin();
+ bool is_empty = true;
+ String n = d->get_next();
+ while (n != String()) {
+ if (!n.begins_with(".")) { // i dont know if this is enough to guarantee an empty dir
+ is_empty = false;
+ break;
+ }
+ n = d->get_next();
+ }
+ d->list_dir_end();
+
+ if (!is_empty) {
+ set_message(TTR("Your project will be created in a non empty folder (you might want to create a new folder)."), MESSAGE_WARNING);
+ }
+
} else {
if (d->file_exists("project.godot")) {
- error->set_text(TTR("Invalid project path, project.godot must not exist."));
+ set_message(TTR("Please choose a folder that does not contain a 'project.godot' file."), MESSAGE_ERROR);
memdelete(d);
return "";
}
@@ -122,16 +177,23 @@ private:
String sp = _test_path();
if (sp != "") {
- sp = sp.replace("\\", "/");
- int lidx = sp.find_last("/");
+ // set the project name to the select folder name
+ if (project_name->get_text() == "") {
+ sp = sp.replace("\\", "/");
+ int lidx = sp.find_last("/");
+
+ if (lidx != -1) {
+ sp = sp.substr(lidx + 1, sp.length());
+ }
+ if (sp == "" && mode == MODE_IMPORT)
+ sp = TTR("Imported Project");
- if (lidx != -1) {
- sp = sp.substr(lidx + 1, sp.length());
+ project_name->set_text(sp);
}
- if (sp == "" && mode == MODE_IMPORT)
- sp = TTR("Imported Project");
+ }
- project_name->set_text(sp);
+ if (created_folder_path != "" && created_folder_path != p_path) {
+ _remove_created_folder();
}
}
@@ -140,13 +202,17 @@ private:
String p = p_path;
if (mode == MODE_IMPORT) {
if (p.ends_with("project.godot")) {
-
p = p.get_base_dir();
+ get_ok()->set_disabled(false);
+ } else {
+ set_message(TTR("Please choose a 'project.godot' file."), MESSAGE_ERROR);
+ get_ok()->set_disabled(true);
+ return;
}
}
String sp = p.simplify_path();
project_path->set_text(sp);
- _path_text_changed(sp);
+ set_message(TTR(" ")); // just so it does not disappear
get_ok()->call_deferred("grab_focus");
}
@@ -155,12 +221,13 @@ private:
String p = p_path;
String sp = p.simplify_path();
project_path->set_text(sp);
- _path_text_changed(sp);
get_ok()->call_deferred("grab_focus");
}
void _browse_path() {
+ fdialog->set_current_dir(project_path->get_text());
+
if (mode == MODE_IMPORT) {
fdialog->set_mode(FileDialog::MODE_OPEN_FILE);
@@ -172,34 +239,46 @@ private:
fdialog->popup_centered_ratio();
}
- void _text_changed(const String &p_text) {
- _test_path();
- error->set_text("");
- if (p_text == "") {
+ void _create_folder() {
- error->set_text(TTR("Name cannot be empty"));
- get_ok()->set_disabled(true);
+ if (project_name->get_text() == "" || created_folder_path != "") {
return;
}
- get_ok()->set_disabled(false);
+
+ DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+ if (d->change_dir(project_path->get_text()) == OK) {
+ if (!d->dir_exists(project_name->get_text())) {
+ if (d->make_dir(project_name->get_text()) == OK) {
+ d->change_dir(project_name->get_text());
+ project_path->set_text(d->get_current_dir());
+ created_folder_path = d->get_current_dir();
+ create_dir->set_disabled(true);
+ }
+ }
+ }
+ memdelete(d);
}
- void _name_changed(const String &p_text) {
+ void _text_changed(const String &p_text) {
+
+ if (mode != MODE_NEW)
+ return;
+
+ _test_path();
+
+ if (p_text == "")
+ set_message(TTR("It would be a good idea to name your project."), MESSAGE_WARNING);
}
void ok_pressed() {
- String dir = _test_path();
- if (dir == "") {
- error->set_text(TTR("Invalid project path (changed anything?)."));
- return;
- }
+ String dir = project_path->get_text();
if (mode == MODE_RENAME) {
String dir = _test_path();
if (dir == "") {
- error->set_text(TTR("Invalid project path (changed anything?)."));
+ set_message(TTR("Invalid project path (changed anything?)."), MESSAGE_ERROR);
return;
}
@@ -207,13 +286,13 @@ private:
current->add_singleton(ProjectSettings::Singleton("Current"));
if (current->setup(dir, "")) {
- error->set_text(TTR("Couldn't get project.godot in project path."));
+ set_message(TTR("Couldn't get project.godot in project path."), MESSAGE_ERROR);
} else {
ProjectSettings::CustomMap edited_settings;
edited_settings["application/config/name"] = project_name->get_text();
if (current->save_custom(dir.plus_file("/project.godot"), edited_settings, Vector<String>(), true)) {
- error->set_text(TTR("Couldn't edit project.godot in project path."));
+ set_message(TTR("Couldn't edit project.godot in project path."), MESSAGE_ERROR);
}
}
@@ -232,13 +311,13 @@ private:
initial_settings["rendering/environment/default_environment"] = "res://default_env.tres";
if (ProjectSettings::get_singleton()->save_custom(dir.plus_file("/project.godot"), initial_settings, Vector<String>(), false)) {
- error->set_text(TTR("Couldn't create project.godot in project path."));
+ set_message(TTR("Couldn't create project.godot in project path."), MESSAGE_ERROR);
} else {
ResourceSaver::save(dir.plus_file("/icon.png"), get_icon("DefaultProjectIcon", "EditorIcons"));
FileAccess *f = FileAccess::open(dir.plus_file("/default_env.tres"), FileAccess::WRITE);
if (!f) {
- error->set_text(TTR("Couldn't create project.godot in project path."));
+ set_message(TTR("Couldn't create project.godot in project path."), MESSAGE_ERROR);
} else {
f->store_line("[gd_resource type=\"Environment\" load_steps=2 format=2]");
f->store_line("[sub_resource type=\"ProceduralSky\" id=1]");
@@ -356,14 +435,40 @@ private:
}
}
+ void _remove_created_folder() {
+
+ if (created_folder_path != "") {
+ DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+ d->remove(created_folder_path);
+ memdelete(d);
+
+ create_dir->set_disabled(false);
+ created_folder_path = "";
+ }
+ }
+
+ void _toggle_message() {
+ msg->set_visible(!msg->is_visible());
+ }
+
+ void cancel_pressed() {
+
+ _remove_created_folder();
+
+ project_path->clear();
+ project_name->clear();
+ }
+
protected:
static void _bind_methods() {
- ClassDB::bind_method("_browse_path", &NewProjectDialog::_browse_path);
- ClassDB::bind_method("_text_changed", &NewProjectDialog::_text_changed);
- ClassDB::bind_method("_path_text_changed", &NewProjectDialog::_path_text_changed);
- ClassDB::bind_method("_path_selected", &NewProjectDialog::_path_selected);
- ClassDB::bind_method("_file_selected", &NewProjectDialog::_file_selected);
+ ClassDB::bind_method("_browse_path", &ProjectDialog::_browse_path);
+ ClassDB::bind_method("_create_folder", &ProjectDialog::_create_folder);
+ ClassDB::bind_method("_text_changed", &ProjectDialog::_text_changed);
+ ClassDB::bind_method("_path_text_changed", &ProjectDialog::_path_text_changed);
+ ClassDB::bind_method("_path_selected", &ProjectDialog::_path_selected);
+ ClassDB::bind_method("_file_selected", &ProjectDialog::_file_selected);
+ ClassDB::bind_method("_toggle_message", &ProjectDialog::_toggle_message);
ADD_SIGNAL(MethodInfo("project_created"));
ADD_SIGNAL(MethodInfo("project_renamed"));
}
@@ -390,129 +495,129 @@ public:
if (mode == MODE_RENAME) {
project_path->set_editable(false);
- browse->set_disabled(true);
+ browse->hide();
set_title(TTR("Rename Project"));
get_ok()->set_text(TTR("Rename"));
- pp->set_text(TTR("Project Path:"));
- pn->set_text(TTR("Project Name:"));
- pn->show();
- project_name->show();
+ name_container->show();
- String dir = _test_path();
- if (dir == "") {
- error->set_text(TTR("Invalid project path (changed anything?)."));
- return;
- }
ProjectSettings *current = memnew(ProjectSettings);
current->add_singleton(ProjectSettings::Singleton("Current"));
- if (current->setup(dir, "")) {
- error->set_text(TTR("Couldn't get project.godot in project path."));
- } else {
- if (current->has("application/config/name")) {
- String appname = current->get("application/config/name");
- project_name->set_text(appname);
- }
+ if (current->setup(project_path->get_text(), "")) {
+ set_message(TTR("Couldn't get project.godot in the project path."), MESSAGE_ERROR);
+ } else if (current->has_setting("application/config/name")) {
+ project_name->set_text(current->get("application/config/name"));
}
-
- popup_centered(Size2(500, 125) * EDSCALE);
project_name->grab_focus();
+ create_dir->hide();
+ status_btn->hide();
+
} else {
- project_path->clear();
- project_name->clear();
+ fav_dir = EditorSettings::get_singleton()->get("filesystem/directories/default_project_path");
+ if (fav_dir != "") {
+ project_path->set_text(fav_dir);
+ fdialog->set_current_dir(fav_dir);
+ } else {
+ DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+ project_path->set_text(d->get_current_dir());
+ fdialog->set_current_dir(d->get_current_dir());
+ memdelete(d);
+ }
+ project_name->set_text(TTR("New Game Project"));
+
project_path->set_editable(true);
browse->set_disabled(false);
+ browse->show();
+ create_dir->show();
+ status_btn->show();
if (mode == MODE_IMPORT) {
set_title(TTR("Import Existing Project"));
get_ok()->set_text(TTR("Import"));
- pp->set_text(TTR("Project Path (Must Exist):"));
- pn->set_text(TTR("Project Name:"));
- pn->hide();
- project_name->hide();
-
- popup_centered(Size2(500, 125) * EDSCALE);
+ name_container->hide();
+ project_path->grab_focus();
} else if (mode == MODE_NEW) {
set_title(TTR("Create New Project"));
get_ok()->set_text(TTR("Create"));
- pp->set_text(TTR("Project Path:"));
- pn->set_text(TTR("Project Name:"));
- pn->show();
- project_name->show();
+ name_container->show();
+ project_name->grab_focus();
- popup_centered(Size2(500, 145) * EDSCALE);
} else if (mode == MODE_INSTALL) {
set_title(TTR("Install Project:") + " " + zip_title);
get_ok()->set_text(TTR("Install"));
- pp->set_text(TTR("Project Path:"));
- pn->hide();
- project_name->hide();
-
- popup_centered(Size2(500, 125) * EDSCALE);
+ name_container->hide();
+ project_path->grab_focus();
}
- project_path->grab_focus();
_test_path();
}
+
+ popup_centered(Size2(500, 125) * EDSCALE);
}
- NewProjectDialog() {
+ ProjectDialog() {
VBoxContainer *vb = memnew(VBoxContainer);
add_child(vb);
- //set_child_rect(vb);
+
+ name_container = memnew(VBoxContainer);
+ vb->add_child(name_container);
Label *l = memnew(Label);
+ l->set_text(TTR("Project Name:"));
+ name_container->add_child(l);
+
+ HBoxContainer *pnhb = memnew(HBoxContainer);
+ name_container->add_child(pnhb);
+
+ project_name = memnew(LineEdit);
+ project_name->set_h_size_flags(SIZE_EXPAND_FILL);
+ pnhb->add_child(project_name);
+
+ create_dir = memnew(Button);
+ pnhb->add_child(create_dir);
+ create_dir->set_text(TTR("Create folder"));
+ create_dir->connect("pressed", this, "_create_folder");
+
+ path_container = memnew(VBoxContainer);
+ vb->add_child(path_container);
+
+ l = memnew(Label);
l->set_text(TTR("Project Path:"));
- vb->add_child(l);
- pp = l;
+ path_container->add_child(l);
- project_path = memnew(LineEdit);
- MarginContainer *mc = memnew(MarginContainer);
- vb->add_child(mc);
HBoxContainer *pphb = memnew(HBoxContainer);
- mc->add_child(pphb);
- pphb->add_child(project_path);
+ path_container->add_child(pphb);
+
+ project_path = memnew(LineEdit);
project_path->set_h_size_flags(SIZE_EXPAND_FILL);
+ pphb->add_child(project_path);
+
+ // status button
+ status_btn = memnew(ToolButton);
+ status_btn->connect("pressed", this, "_toggle_message");
+ pphb->add_child(status_btn);
browse = memnew(Button);
- pphb->add_child(browse);
browse->set_text(TTR("Browse"));
browse->connect("pressed", this, "_browse_path");
+ pphb->add_child(browse);
- l = memnew(Label);
- l->set_text(TTR("Project Name:"));
- l->set_position(Point2(5, 50));
- vb->add_child(l);
- pn = l;
-
- project_name = memnew(LineEdit);
- mc = memnew(MarginContainer);
- vb->add_child(mc);
- mc->add_child(project_name);
- project_name->set_text(TTR("New Game Project"));
-
- l = memnew(Label);
- l->set_text(TTR("That's a BINGO!"));
- vb->add_child(l);
- error = l;
- l->add_color_override("font_color", Color(1, 0.4, 0.3, 0.8));
- l->set_align(Label::ALIGN_CENTER);
-
- DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
- project_path->set_text(d->get_current_dir());
- memdelete(d);
+ msg = memnew(Label);
+ msg->set_text(TTR("That's a BINGO!"));
+ msg->set_align(Label::ALIGN_CENTER);
+ msg->hide();
+ vb->add_child(msg);
fdialog = memnew(FileDialog);
- add_child(fdialog);
fdialog->set_access(FileDialog::ACCESS_FILESYSTEM);
- fdialog->set_current_dir(EditorSettings::get_singleton()->get("filesystem/directories/default_project_path"));
+ add_child(fdialog);
project_name->connect("text_changed", this, "_text_changed");
project_path->connect("text_changed", this, "_path_text_changed");
fdialog->connect("dir_selected", this, "_path_selected");
@@ -564,7 +669,7 @@ void ProjectManager::_panel_draw(Node *p_hb) {
hb->draw_line(Point2(0, hb->get_size().y + 1), Point2(hb->get_size().x - 10, hb->get_size().y + 1), get_color("guide_color", "Tree"));
if (selected_list.has(hb->get_meta("name"))) {
- hb->draw_style_box(gui_base->get_stylebox("selected", "Tree"), Rect2(Point2(), hb->get_size() - Size2(10, 0)));
+ hb->draw_style_box(gui_base->get_stylebox("selected", "Tree"), Rect2(Point2(), hb->get_size() - Size2(10, 0) * EDSCALE));
}
}
@@ -645,6 +750,9 @@ void ProjectManager::_unhandled_input(const Ref<InputEvent> &p_ev) {
if (!k->is_pressed())
return;
+ if (tabs->get_current_tab() != 0)
+ return;
+
bool scancode_handled = true;
switch (k->get_scancode()) {
@@ -1168,13 +1276,13 @@ void ProjectManager::_scan_projects() {
void ProjectManager::_new_project() {
- npdialog->set_mode(NewProjectDialog::MODE_NEW);
+ npdialog->set_mode(ProjectDialog::MODE_NEW);
npdialog->show_dialog();
}
void ProjectManager::_import_project() {
- npdialog->set_mode(NewProjectDialog::MODE_IMPORT);
+ npdialog->set_mode(ProjectDialog::MODE_IMPORT);
npdialog->show_dialog();
}
@@ -1188,7 +1296,7 @@ void ProjectManager::_rename_project() {
const String &selected = E->key();
String path = EditorSettings::get_singleton()->get("projects/" + selected);
npdialog->set_project_path(path);
- npdialog->set_mode(NewProjectDialog::MODE_RENAME);
+ npdialog->set_mode(ProjectDialog::MODE_RENAME);
npdialog->show_dialog();
}
}
@@ -1224,7 +1332,7 @@ void ProjectManager::_exit_dialog() {
void ProjectManager::_install_project(const String &p_zip_path, const String &p_title) {
- npdialog->set_mode(NewProjectDialog::MODE_INSTALL);
+ npdialog->set_mode(ProjectDialog::MODE_INSTALL);
npdialog->set_zip_path(p_zip_path);
npdialog->set_zip_title(p_title);
npdialog->show_dialog();
@@ -1313,9 +1421,10 @@ ProjectManager::ProjectManager() {
EditorSettings::get_singleton()->set_optimize_save(false); //just write settings as they came
{
- int dpi_mode = EditorSettings::get_singleton()->get("interface/hidpi_mode");
+ int dpi_mode = EditorSettings::get_singleton()->get("interface/editor/hidpi_mode");
if (dpi_mode == 0) {
- editor_set_scale(OS::get_singleton()->get_screen_dpi(0) >= 192 && OS::get_singleton()->get_screen_size(OS::get_singleton()->get_current_screen()).x > 2000 ? 2.0 : 1.0);
+ const int screen = OS::get_singleton()->get_current_screen();
+ editor_set_scale(OS::get_singleton()->get_screen_dpi(screen) >= 192 && OS::get_singleton()->get_screen_size(screen).x > 2000 ? 2.0 : 1.0);
} else if (dpi_mode == 1) {
editor_set_scale(0.75);
} else if (dpi_mode == 2) {
@@ -1329,21 +1438,21 @@ ProjectManager::ProjectManager() {
FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("filesystem/file_dialog/show_hidden_files"));
- set_area_as_parent_rect();
+ set_anchors_and_margins_preset(Control::PRESET_WIDE);
set_theme(create_editor_theme());
gui_base = memnew(Control);
add_child(gui_base);
- gui_base->set_area_as_parent_rect();
+ gui_base->set_anchors_and_margins_preset(Control::PRESET_WIDE);
gui_base->set_theme(create_custom_theme());
Panel *panel = memnew(Panel);
gui_base->add_child(panel);
- panel->set_area_as_parent_rect();
+ panel->set_anchors_and_margins_preset(Control::PRESET_WIDE);
VBoxContainer *vb = memnew(VBoxContainer);
panel->add_child(vb);
- vb->set_area_as_parent_rect(20 * EDSCALE);
+ vb->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 20 * EDSCALE);
vb->set_margin(MARGIN_TOP, 4 * EDSCALE);
vb->set_margin(MARGIN_BOTTOM, -4 * EDSCALE);
vb->add_constant_override("separation", 15 * EDSCALE);
@@ -1511,7 +1620,7 @@ ProjectManager::ProjectManager() {
OS::get_singleton()->set_low_processor_usage_mode(true);
- npdialog = memnew(NewProjectDialog);
+ npdialog = memnew(ProjectDialog);
gui_base->add_child(npdialog);
npdialog->connect("project_renamed", this, "_on_project_renamed");
diff --git a/editor/project_manager.h b/editor/project_manager.h
index 8a3e7c0457..bfae0b2297 100644
--- a/editor/project_manager.h
+++ b/editor/project_manager.h
@@ -37,7 +37,7 @@
#include "scene/gui/tool_button.h"
#include "scene/gui/tree.h"
-class NewProjectDialog;
+class ProjectDialog;
class ProjectListFilter;
class ProjectManager : public Control {
@@ -60,7 +60,7 @@ class ProjectManager : public Control {
ConfirmationDialog *multi_scan_ask;
AcceptDialog *run_error_diag;
AcceptDialog *dialog_error;
- NewProjectDialog *npdialog;
+ ProjectDialog *npdialog;
ScrollContainer *scroll;
VBoxContainer *scroll_childs;
Map<String, String> selected_list; // name -> main_scene
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index 1f65589643..91ef9e36f3 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -146,7 +146,7 @@ void ProjectSettingsEditor::_action_edited() {
String action_prop = "input/" + new_name;
- if (ProjectSettings::get_singleton()->has(action_prop)) {
+ if (ProjectSettings::get_singleton()->has_setting(action_prop)) {
ti->set_text(0, old_name);
add_at = "input/" + old_name;
@@ -707,7 +707,7 @@ void ProjectSettingsEditor::_update_actions() {
void ProjectSettingsEditor::popup_project_settings() {
// Restore valid window bounds or pop up at default size.
- if (EditorSettings::get_singleton()->has("interface/dialogs/project_settings_bounds")) {
+ if (EditorSettings::get_singleton()->has_setting("interface/dialogs/project_settings_bounds")) {
popup(EditorSettings::get_singleton()->get("interface/dialogs/project_settings_bounds"));
} else {
popup_centered_ratio();
@@ -753,7 +753,7 @@ void ProjectSettingsEditor::_item_add() {
undo_redo->add_do_property(ProjectSettings::get_singleton(), name, value);
- if (ProjectSettings::get_singleton()->has(name)) {
+ if (ProjectSettings::get_singleton()->has_setting(name)) {
undo_redo->add_undo_property(ProjectSettings::get_singleton(), name, ProjectSettings::get_singleton()->get(name));
} else {
undo_redo->add_undo_property(ProjectSettings::get_singleton(), name, Variant());
@@ -782,7 +782,7 @@ void ProjectSettingsEditor::_item_del() {
String property = globals_editor->get_current_section().plus_file(path);
- if (!ProjectSettings::get_singleton()->has(property)) {
+ if (!ProjectSettings::get_singleton()->has_setting(property)) {
EditorNode::get_singleton()->show_warning(TTR("No property '" + property + "' exists."));
return;
}
@@ -823,7 +823,7 @@ void ProjectSettingsEditor::_action_check(String p_action) {
action_add->set_disabled(true);
return;
}
- if (ProjectSettings::get_singleton()->has("input/" + p_action)) {
+ if (ProjectSettings::get_singleton()->has_setting("input/" + p_action)) {
action_add->set_text(TTR("Already existing"));
action_add->set_disabled(true);
return;
@@ -907,6 +907,8 @@ void ProjectSettingsEditor::_copy_to_platform_about_to_show() {
presets.insert("pvrtc");
presets.insert("debug");
presets.insert("release");
+ presets.insert("32");
+ presets.insert("64");
for (int i = 0; i < EditorExport::get_singleton()->get_export_platform_count(); i++) {
List<String> p;
@@ -963,7 +965,7 @@ void ProjectSettingsEditor::_copy_to_platform(int p_which) {
String new_path = property + "." + feature;
undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", new_path, value);
- if (ProjectSettings::get_singleton()->has(new_path)) {
+ if (ProjectSettings::get_singleton()->has_setting(new_path)) {
undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", new_path, ProjectSettings::get_singleton()->get(new_path));
}
@@ -1040,7 +1042,7 @@ void ProjectSettingsEditor::_translation_res_add(const String &p_path) {
Variant prev;
Dictionary remaps;
- if (ProjectSettings::get_singleton()->has("locale/translation_remaps")) {
+ if (ProjectSettings::get_singleton()->has_setting("locale/translation_remaps")) {
remaps = ProjectSettings::get_singleton()->get("locale/translation_remaps");
prev = remaps;
}
@@ -1066,7 +1068,7 @@ void ProjectSettingsEditor::_translation_res_option_file_open() {
}
void ProjectSettingsEditor::_translation_res_option_add(const String &p_path) {
- ERR_FAIL_COND(!ProjectSettings::get_singleton()->has("locale/translation_remaps"));
+ ERR_FAIL_COND(!ProjectSettings::get_singleton()->has_setting("locale/translation_remaps"));
Dictionary remaps = ProjectSettings::get_singleton()->get("locale/translation_remaps");
@@ -1103,7 +1105,7 @@ void ProjectSettingsEditor::_translation_res_option_changed() {
if (updating_translations)
return;
- if (!ProjectSettings::get_singleton()->has("locale/translation_remaps"))
+ if (!ProjectSettings::get_singleton()->has_setting("locale/translation_remaps"))
return;
Dictionary remaps = ProjectSettings::get_singleton()->get("locale/translation_remaps");
@@ -1145,7 +1147,7 @@ void ProjectSettingsEditor::_translation_res_delete(Object *p_item, int p_column
if (updating_translations)
return;
- if (!ProjectSettings::get_singleton()->has("locale/translation_remaps"))
+ if (!ProjectSettings::get_singleton()->has_setting("locale/translation_remaps"))
return;
Dictionary remaps = ProjectSettings::get_singleton()->get("locale/translation_remaps");
@@ -1172,7 +1174,7 @@ void ProjectSettingsEditor::_translation_res_option_delete(Object *p_item, int p
if (updating_translations)
return;
- if (!ProjectSettings::get_singleton()->has("locale/translation_remaps"))
+ if (!ProjectSettings::get_singleton()->has_setting("locale/translation_remaps"))
return;
Dictionary remaps = ProjectSettings::get_singleton()->get("locale/translation_remaps");
@@ -1213,7 +1215,7 @@ void ProjectSettingsEditor::_update_translations() {
translation_list->clear();
TreeItem *root = translation_list->create_item(NULL);
translation_list->set_hide_root(true);
- if (ProjectSettings::get_singleton()->has("locale/translations")) {
+ if (ProjectSettings::get_singleton()->has_setting("locale/translations")) {
PoolStringArray translations = ProjectSettings::get_singleton()->get("locale/translations");
for (int i = 0; i < translations.size(); i++) {
@@ -1251,7 +1253,7 @@ void ProjectSettingsEditor::_update_translations() {
langnames += names[i];
}
- if (ProjectSettings::get_singleton()->has("locale/translation_remaps")) {
+ if (ProjectSettings::get_singleton()->has_setting("locale/translation_remaps")) {
Dictionary remaps = ProjectSettings::get_singleton()->get("locale/translation_remaps");
List<Variant> rk;
@@ -1504,7 +1506,6 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
Control *input_base = memnew(Control);
input_base->set_name(TTR("Input Map"));
- input_base->set_area_as_parent_rect();
tab_container->add_child(input_base);
VBoxContainer *vbc = memnew(VBoxContainer);
@@ -1552,7 +1553,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
l = memnew(Label);
l->set_text(TTR("Press a Key.."));
- l->set_area_as_parent_rect();
+ l->set_anchors_and_margins_preset(Control::PRESET_WIDE);
l->set_align(Label::ALIGN_CENTER);
l->set_margin(MARGIN_TOP, 20);
l->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_BEGIN, 30);
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 1a3a7ff430..658f67d6a4 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -53,6 +53,49 @@
#include "scene/resources/packed_scene.h"
#include "scene/scene_string_names.h"
+void EditorResourceConversionPlugin::_bind_methods() {
+
+ MethodInfo mi;
+ mi.name = "_convert";
+ mi.return_val.type = Variant::OBJECT;
+ mi.return_val.class_name = "Resource";
+ mi.return_val.hint = PROPERTY_HINT_RESOURCE_TYPE;
+ mi.return_val.hint_string = "Resource";
+ mi.arguments.push_back(mi.return_val);
+ mi.arguments[0].name = "resource";
+
+ BIND_VMETHOD(mi)
+
+ mi.name = "_handles";
+ mi.return_val = PropertyInfo(Variant::BOOL, "");
+
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "_converts_to"));
+}
+
+String EditorResourceConversionPlugin::converts_to() const {
+
+ if (get_script_instance())
+ return get_script_instance()->call("_converts_to");
+
+ return "";
+}
+
+bool EditorResourceConversionPlugin::handles(const Ref<Resource> &p_resource) const {
+
+ if (get_script_instance())
+ return get_script_instance()->call("_handles", p_resource);
+
+ return false;
+}
+
+Ref<Resource> EditorResourceConversionPlugin::convert(const Ref<Resource> &p_resource) {
+
+ if (get_script_instance())
+ return get_script_instance()->call("_convert", p_resource);
+
+ return Ref<Resource>();
+}
+
void CustomPropertyEditor::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
@@ -213,6 +256,20 @@ void CustomPropertyEditor::_menu_option(int p_which) {
} break;
default: {
+ if (p_which >= CONVERT_BASE_ID) {
+
+ int to_type = p_which - CONVERT_BASE_ID;
+
+ Vector<Ref<EditorResourceConversionPlugin> > conversions = EditorNode::get_singleton()->find_resource_conversion_plugin(RES(v));
+
+ ERR_FAIL_INDEX(to_type, conversions.size());
+
+ Ref<Resource> new_res = conversions[to_type]->convert(v);
+
+ v = new_res;
+ emit_signal("variant_changed");
+ break;
+ }
ERR_FAIL_COND(inheritors_array.empty());
String intype = inheritors_array[p_which - TYPE_BASE_ID];
@@ -804,7 +861,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
names.push_back(TTR("Assign"));
names.push_back(TTR("Clear"));
- if (owner->is_class("Node") && (v.get_type() == Variant::NODE_PATH) && Object::cast_to<Node>(owner)->has_node(v))
+ if (owner && owner->is_class("Node") && (v.get_type() == Variant::NODE_PATH) && Object::cast_to<Node>(owner)->has_node(v))
names.push_back(TTR("Select Node"));
config_action_buttons(names);
@@ -903,6 +960,27 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
}
}
+ if (!RES(v).is_null()) {
+
+ Vector<Ref<EditorResourceConversionPlugin> > conversions = EditorNode::get_singleton()->find_resource_conversion_plugin(RES(v));
+ if (conversions.size()) {
+ menu->add_separator();
+ }
+ for (int i = 0; i < conversions.size(); i++) {
+ String what = conversions[i]->converts_to();
+ Ref<Texture> icon;
+ if (has_icon(what, "EditorIcons")) {
+
+ icon = get_icon(what, "EditorIcons");
+ } else {
+
+ icon = get_icon(what, "Resource");
+ }
+
+ menu->add_icon_item(icon, vformat(TTR("Convert To %s"), what), CONVERT_BASE_ID + i);
+ }
+ }
+
menu->set_position(get_position());
menu->popup();
hide();
@@ -1811,7 +1889,7 @@ CustomPropertyEditor::CustomPropertyEditor() {
text_edit = memnew(TextEdit);
add_child(text_edit);
- text_edit->set_area_as_parent_rect(5);
+ text_edit->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 5);
text_edit->set_margin(MARGIN_BOTTOM, -30);
text_edit->hide();
@@ -1870,12 +1948,12 @@ CustomPropertyEditor::CustomPropertyEditor() {
spinbox = memnew(SpinBox);
add_child(spinbox);
- spinbox->set_area_as_parent_rect(5);
+ spinbox->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 5);
spinbox->connect("value_changed", this, "_range_modified");
slider = memnew(HSlider);
add_child(slider);
- slider->set_area_as_parent_rect(5);
+ slider->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 5);
slider->connect("value_changed", this, "_range_modified");
create_dialog = NULL;
@@ -2355,7 +2433,7 @@ bool PropertyEditor::_is_drop_valid(const Dictionary &p_drag_data, const Diction
void PropertyEditor::_mark_drop_fields(TreeItem *p_at) {
if (_is_drop_valid(get_viewport()->gui_get_drag_data(), p_at->get_metadata(0)))
- p_at->set_custom_bg_color(1, Color(0.7, 0.5, 0.2), true);
+ p_at->set_custom_bg_color(1, get_color("accent_color", "Editor"), true);
if (p_at->get_children()) {
_mark_drop_fields(p_at->get_children());
@@ -2507,10 +2585,10 @@ void PropertyEditor::_notification(int p_what) {
}
}
- if (p_what == NOTIFICATION_FIXED_PROCESS) {
+ if (p_what == NOTIFICATION_PHYSICS_PROCESS) {
if (refresh_countdown > 0) {
- refresh_countdown -= get_fixed_process_delta_time();
+ refresh_countdown -= get_physics_process_delta_time();
if (refresh_countdown <= 0) {
TreeItem *root = tree->get_root();
_refresh_item(root);
@@ -2880,7 +2958,7 @@ void PropertyEditor::update_tree() {
item->set_metadata(1, p.name);
if (draw_red)
- item->set_custom_color(0, Color(0.8, 0.4, 0.20));
+ item->set_custom_color(0, get_color("error_color", "Editor"));
if (p.name == selected_property) {
@@ -3460,14 +3538,14 @@ void PropertyEditor::_draw_transparency(Object *t, const Rect2 &p_rect) {
return;
Color color = obj->get(ti->get_metadata(1));
- Ref<Texture> arrow = tree->get_icon("select_arrow");
+ Ref<Texture> arrow = tree->get_icon("select_option");
// make a little space between consecutive color fields
Rect2 area = p_rect;
area.position.y += 1;
area.size.height -= 2;
area.size.width -= arrow->get_size().width + 5;
- tree->draw_texture_rect(get_icon("Transparent", "EditorIcons"), area, true);
+ tree->draw_texture_rect(get_icon("GuiMiniCheckerboard", "EditorIcons"), area, true);
tree->draw_rect(area, color);
}
@@ -4149,7 +4227,7 @@ PropertyEditor::PropertyEditor() {
tree->set_drag_forwarding(this);
- set_fixed_process(true);
+ set_physics_process(true);
custom_editor = memnew(CustomPropertyEditor);
add_child(custom_editor);
@@ -4179,7 +4257,7 @@ PropertyEditor::PropertyEditor() {
use_filter = false;
subsection_selectable = false;
property_selectable = false;
- show_type_icons = EDITOR_DEF("interface/show_type_icons", false);
+ show_type_icons = EDITOR_DEF("interface/editor/show_type_icons", false);
}
PropertyEditor::~PropertyEditor() {
diff --git a/editor/property_editor.h b/editor/property_editor.h
index bfd5ee401e..e69ca8bcd5 100644
--- a/editor/property_editor.h
+++ b/editor/property_editor.h
@@ -53,6 +53,19 @@ class PropertyValueEvaluator;
class CreateDialog;
class PropertySelector;
+class EditorResourceConversionPlugin : public Reference {
+
+ GDCLASS(EditorResourceConversionPlugin, Reference)
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual String converts_to() const;
+ virtual bool handles(const Ref<Resource> &p_resource) const;
+ virtual Ref<Resource> convert(const Ref<Resource> &p_resource);
+};
+
class CustomPropertyEditor : public Popup {
GDCLASS(CustomPropertyEditor, Popup);
@@ -68,7 +81,8 @@ class CustomPropertyEditor : public Popup {
OBJ_MENU_PASTE = 5,
OBJ_MENU_NEW_SCRIPT = 6,
OBJ_MENU_SHOW_IN_FILE_SYSTEM = 7,
- TYPE_BASE_ID = 100
+ TYPE_BASE_ID = 100,
+ CONVERT_BASE_ID = 1000
};
enum {
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 2fcba7e3c0..f3e59932c4 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -270,6 +270,18 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
switch (p_tool) {
case TOOL_NEW: {
+
+ String preferred = "";
+ Node *current_edited_scene_root = EditorNode::get_singleton()->get_edited_scene();
+
+ if (current_edited_scene_root) {
+
+ if (ClassDB::is_parent_class(current_edited_scene_root->get_class_name(), "Node2D"))
+ preferred = "Node2D";
+ else if (ClassDB::is_parent_class(current_edited_scene_root->get_class_name(), "Spatial"))
+ preferred = "Spatial";
+ }
+ create_dialog->set_preferred_search_result_type(preferred);
create_dialog->popup_create(true);
} break;
case TOOL_INSTANCE: {
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index cfc563f470..6dcd5e54ec 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -185,7 +185,7 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) {
if (part_of_subscene) {
//item->set_selectable(0,marked_selectable);
- item->set_custom_color(0, get_color("error_color", "Editor").linear_interpolate(get_color("warning_color", "Editor"), 0.4));
+ item->set_custom_color(0, get_color("disabled_font_color", "Editor"));
} else if (marked.has(p_node)) {
@@ -345,7 +345,7 @@ void SceneTreeEditor::_update_visibility_color(Node *p_node, TreeItem *p_item) {
Color color(1, 1, 1, 1);
bool visible_on_screen = p_node->call("is_visible_in_tree");
if (!visible_on_screen) {
- color = Color(0.6, 0.6, 0.6, 1);
+ color.a = 0.6;
}
int idx = p_item->get_button_by_id(0, BUTTON_VISIBILITY);
p_item->set_button_color(0, idx, color);
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index 76e75cff0a..5ad4674f7f 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -649,8 +649,8 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
metric.frame_number = p_data[0];
metric.frame_time = p_data[1];
metric.idle_time = p_data[2];
- metric.fixed_time = p_data[3];
- metric.fixed_frame_time = p_data[4];
+ metric.physics_time = p_data[3];
+ metric.physics_frame_time = p_data[4];
int frame_data_amount = p_data[6];
int frame_function_amount = p_data[7];
@@ -664,9 +664,9 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
item.calls = 1;
item.line = 0;
item.name = "Fixed Time";
- item.total = metric.fixed_time;
+ item.total = metric.physics_time;
item.self = item.total;
- item.signature = "fixed_time";
+ item.signature = "physics_time";
frame_time.items.push_back(item);
@@ -678,9 +678,9 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
frame_time.items.push_back(item);
item.name = "Fixed Frame Time";
- item.total = metric.fixed_frame_time;
+ item.total = metric.physics_frame_time;
item.self = item.total;
- item.signature = "fixed_frame_time";
+ item.signature = "physics_frame_time";
frame_time.items.push_back(item);
@@ -1045,6 +1045,8 @@ void ScriptEditorDebugger::_notification(int p_what) {
tabs->add_style_override("panel", editor->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles"));
tabs->add_style_override("tab_fg", editor->get_gui_base()->get_stylebox("DebuggerTabFG", "EditorStyles"));
tabs->add_style_override("tab_bg", editor->get_gui_base()->get_stylebox("DebuggerTabBG", "EditorStyles"));
+ tabs->set_margin(MARGIN_LEFT, -EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT));
+ tabs->set_margin(MARGIN_RIGHT, EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT));
} break;
}
}
@@ -1065,7 +1067,7 @@ void ScriptEditorDebugger::start() {
int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port");
if (server->listen(remote_port) != OK) {
- EditorNode::get_log()->add_message(String("** Error listening on port ") + itos(remote_port) + String(" **"));
+ EditorNode::get_log()->add_message(String("Error listening on port ") + itos(remote_port), true);
return;
}
set_process(true);
@@ -1622,7 +1624,10 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
tabs->add_style_override("panel", editor->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles"));
tabs->add_style_override("tab_fg", editor->get_gui_base()->get_stylebox("DebuggerTabFG", "EditorStyles"));
tabs->add_style_override("tab_bg", editor->get_gui_base()->get_stylebox("DebuggerTabBG", "EditorStyles"));
- tabs->set_area_as_parent_rect();
+
+ tabs->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ tabs->set_margin(MARGIN_LEFT, -editor->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT));
+ tabs->set_margin(MARGIN_RIGHT, editor->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT));
add_child(tabs);
{ //debugger
diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp
index 05e3feedb5..86979a1174 100644
--- a/editor/settings_config_dialog.cpp
+++ b/editor/settings_config_dialog.cpp
@@ -58,6 +58,8 @@ void EditorSettingsDialog::_settings_property_edited(const String &p_name) {
// color theme is changed
if (full_name == "text_editor/theme/color_theme") {
property_editor->get_property_editor()->update_tree();
+ } else if (full_name == "interface/theme/accent_color" || full_name == "interface/theme/base_color" || full_name == "interface/theme/contrast") {
+ EditorSettings::get_singleton()->set_manually("interface/theme/preset", 6); // set preset to Custom
}
}
@@ -91,7 +93,7 @@ void EditorSettingsDialog::popup_edit_settings() {
_update_shortcuts();
// Restore valid window bounds or pop up at default size.
- if (EditorSettings::get_singleton()->has("interface/dialogs/editor_settings_bounds")) {
+ if (EditorSettings::get_singleton()->has_setting("interface/dialogs/editor_settings_bounds")) {
popup(EditorSettings::get_singleton()->get("interface/dialogs/editor_settings_bounds"));
} else {
popup_centered_ratio(0.7);
@@ -334,6 +336,7 @@ EditorSettingsDialog::EditorSettingsDialog() {
property_editor->get_property_editor()->set_use_filter(true);
property_editor->register_search_box(search_box);
property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
+ property_editor->get_property_editor()->set_undo_redo(EditorNode::get_singleton()->get_undo_redo());
vbc->add_child(property_editor);
property_editor->get_property_editor()->connect("property_edited", this, "_settings_property_edited");
@@ -374,7 +377,7 @@ EditorSettingsDialog::EditorSettingsDialog() {
l = memnew(Label);
l->set_text(TTR("Press a Key.."));
- l->set_area_as_parent_rect();
+ l->set_anchors_and_margins_preset(Control::PRESET_WIDE);
l->set_align(Label::ALIGN_CENTER);
l->set_margin(MARGIN_TOP, 20);
l->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_BEGIN, 30);
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp
index 450c9f4b3c..3c1889e829 100644
--- a/editor/spatial_editor_gizmos.cpp
+++ b/editor/spatial_editor_gizmos.cpp
@@ -744,7 +744,7 @@ static float _find_closest_angle_to_half_pi_arc(const Vector3 &p_from, const Vec
}
//min_p = p_arc_xform.affine_inverse().xform(min_p);
- float a = Vector2(min_p.x, -min_p.z).angle();
+ float a = (Math_PI * 0.5) - Vector2(min_p.x, -min_p.z).angle();
return a * 180.0 / Math_PI;
}
@@ -893,7 +893,7 @@ void LightSpatialGizmo::redraw() {
if (Object::cast_to<SpotLight>(light)) {
- Ref<Material> material = create_material("light_spot_material", gizmo_color, true);
+ Ref<Material> material = create_material("light_spot_material", gizmo_color);
Ref<Material> icon = create_icon_material("light_spot_icon", SpatialEditor::get_singleton()->get_icon("GizmoSpotLight", "EditorIcons"));
clear();
diff --git a/main/input_default.cpp b/main/input_default.cpp
index 18979c844a..2940f432d5 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -105,8 +105,8 @@ bool InputDefault::is_action_just_pressed(const StringName &p_action) const {
if (!E)
return false;
- if (Engine::get_singleton()->is_in_fixed_frame()) {
- return E->get().pressed && E->get().fixed_frame == Engine::get_singleton()->get_fixed_frames();
+ if (Engine::get_singleton()->is_in_physics_frame()) {
+ return E->get().pressed && E->get().physics_frame == Engine::get_singleton()->get_physics_frames();
} else {
return E->get().pressed && E->get().idle_frame == Engine::get_singleton()->get_idle_frames();
}
@@ -118,8 +118,8 @@ bool InputDefault::is_action_just_released(const StringName &p_action) const {
if (!E)
return false;
- if (Engine::get_singleton()->is_in_fixed_frame()) {
- return !E->get().pressed && E->get().fixed_frame == Engine::get_singleton()->get_fixed_frames();
+ if (Engine::get_singleton()->is_in_physics_frame()) {
+ return !E->get().pressed && E->get().physics_frame == Engine::get_singleton()->get_physics_frames();
} else {
return !E->get().pressed && E->get().idle_frame == Engine::get_singleton()->get_idle_frames();
}
@@ -324,7 +324,7 @@ void InputDefault::parse_input_event(const Ref<InputEvent> &p_event) {
if (InputMap::get_singleton()->event_is_action(p_event, E->key()) && is_action_pressed(E->key()) != p_event->is_pressed()) {
Action action;
- action.fixed_frame = Engine::get_singleton()->get_fixed_frames();
+ action.physics_frame = Engine::get_singleton()->get_physics_frames();
action.idle_frame = Engine::get_singleton()->get_idle_frames();
action.pressed = p_event->is_pressed();
action_state[E->key()] = action;
@@ -460,7 +460,7 @@ void InputDefault::action_press(const StringName &p_action) {
Action action;
- action.fixed_frame = Engine::get_singleton()->get_fixed_frames();
+ action.physics_frame = Engine::get_singleton()->get_physics_frames();
action.idle_frame = Engine::get_singleton()->get_idle_frames();
action.pressed = true;
@@ -471,7 +471,7 @@ void InputDefault::action_release(const StringName &p_action) {
Action action;
- action.fixed_frame = Engine::get_singleton()->get_fixed_frames();
+ action.physics_frame = Engine::get_singleton()->get_physics_frames();
action.idle_frame = Engine::get_singleton()->get_idle_frames();
action.pressed = false;
diff --git a/main/input_default.h b/main/input_default.h
index 480e78e971..e2cb03e67c 100644
--- a/main/input_default.h
+++ b/main/input_default.h
@@ -51,7 +51,7 @@ class InputDefault : public Input {
MainLoop *main_loop;
struct Action {
- uint64_t fixed_frame;
+ uint64_t physics_frame;
uint64_t idle_frame;
bool pressed;
};
diff --git a/main/main.cpp b/main/main.cpp
index 1f7418ba2a..c6d3c3f15c 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -74,6 +74,7 @@
#include "performance.h"
#include "translation.h"
#include "version.h"
+#include "version_hash.gen.h"
static ProjectSettings *globals = NULL;
static Engine *engine = NULL;
@@ -122,6 +123,14 @@ static String unescape_cmdline(const String &p_str) {
return p_str.replace("%20", " ");
}
+static String get_full_version_string() {
+
+ String hash = String(VERSION_HASH);
+ if (hash.length() != 0)
+ hash = "." + hash.left(7);
+ return String(VERSION_MKSTRING) + hash;
+}
+
//#define DEBUG_INIT
#ifdef DEBUG_INIT
@@ -132,7 +141,7 @@ static String unescape_cmdline(const String &p_str) {
void Main::print_help(const char *p_binary) {
- OS::get_singleton()->print(VERSION_FULL_NAME " - https://godotengine.org\n");
+ print_line(String(_MKSTR(VERSION_NAME)) + " v" + get_full_version_string() + " - https://godotengine.org");
OS::get_singleton()->print("(c) 2007-2017 Juan Linietsky, Ariel Manzur.\n");
OS::get_singleton()->print("(c) 2014-2017 Godot Engine contributors.\n");
OS::get_singleton()->print("\n");
@@ -141,6 +150,7 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print("General options:\n");
OS::get_singleton()->print(" -h, --help Display this help message.\n");
+ OS::get_singleton()->print(" --version Display the version string.\n");
OS::get_singleton()->print(" -v, --verbose Use verbose stdout mode.\n");
OS::get_singleton()->print(" --quiet Quiet mode, silences stdout messages. Errors are still displayed.\n");
OS::get_singleton()->print("\n");
@@ -195,7 +205,7 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(" --time-scale <scale> Force time scale (higher values are faster, 1.0 is normal speed).\n");
OS::get_singleton()->print(" --disable-render-loop Disable render loop so rendering only occurs when called explicitly from script.\n");
OS::get_singleton()->print(" --disable-crash-handler Disable crash handler when supported by the platform code.\n");
- OS::get_singleton()->print(" --fixed-fps <fps> Forces a fixed ratio between process and fixed_process timing, for use when precision is required, or when rendering to video files. Setting this will disable real-time syncronization, so that run speed is only capped by performance\n");
+ OS::get_singleton()->print(" --fixed-fps <fps> Force a fixed number of frames per second. This setting disables real-time synchronization.\n");
OS::get_singleton()->print("\n");
OS::get_singleton()->print("Standalone tools:\n");
@@ -203,7 +213,7 @@ void Main::print_help(const char *p_binary) {
#ifdef TOOLS_ENABLED
OS::get_singleton()->print(" --export <target> Export the project using the given export target.\n");
OS::get_singleton()->print(" --export-debug Use together with --export, enables debug mode for the template.\n");
- OS::get_singleton()->print(" --doctool <file> Dump the whole engine API to <file> in XML format. If <file> exists, it will be merged.\n");
+ OS::get_singleton()->print(" --doctool <path> Dump the engine API reference to the given <path> in XML format, merging if existing files are found.\n");
OS::get_singleton()->print(" --no-docbase Disallow dumping the base types (used with --doctool).\n");
#ifdef DEBUG_METHODS_ENABLED
OS::get_singleton()->print(" --gdnative-generate-json-api Generate JSON dump of the Godot API for GDNative bindings.\n");
@@ -221,7 +231,6 @@ void Main::print_help(const char *p_binary) {
}
Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_phase) {
-
RID_OwnerBase::init_rid();
OS::get_singleton()->initialize_core();
@@ -244,8 +253,11 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
register_core_settings(); //here globals is present
+ OS::get_singleton()->initialize_logger();
+
translation_server = memnew(TranslationServer);
performance = memnew(Performance);
+ ClassDB::register_class<Performance>();
globals->add_singleton(ProjectSettings::Singleton("Performance", performance));
GLOBAL_DEF("debug/settings/crash_handler/message", String("Please include this when reporting the bug on https://github.com/godotengine/godot/issues"));
@@ -268,7 +280,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
while (I) {
I->get() = unescape_cmdline(I->get().strip_escapes());
- //print_line("CMD: "+I->get());
I = I->next();
}
@@ -318,6 +329,11 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
show_help = true;
goto error;
+ } else if (I->get() == "--version") {
+
+ print_line(get_full_version_string());
+ goto error;
+
} else if (I->get() == "--resolution") { // force resolution
if (I->next()) {
@@ -711,7 +727,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
#ifdef TOOLS_ENABLED
- if (main_args.size() == 0 && (!ProjectSettings::get_singleton()->has("application/run/main_loop_type")) && (!ProjectSettings::get_singleton()->has("application/run/main_scene") || String(ProjectSettings::get_singleton()->get("application/run/main_scene")) == ""))
+ if (main_args.size() == 0 && (!ProjectSettings::get_singleton()->has_setting("application/run/main_loop_type")) && (!ProjectSettings::get_singleton()->has_setting("application/run/main_scene") || String(ProjectSettings::get_singleton()->get("application/run/main_scene")) == ""))
use_custom_res = false; //project manager (run without arguments)
#endif
@@ -724,21 +740,21 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
//if (video_driver == "") // useless for now, so removing
// video_driver = GLOBAL_DEF("display/driver/name", Variant((const char *)OS::get_singleton()->get_video_driver_name(0)));
- if (!force_res && use_custom_res && globals->has("display/window/size/width"))
+ if (!force_res && use_custom_res && globals->has_setting("display/window/size/width"))
video_mode.width = globals->get("display/window/size/width");
- if (!force_res && use_custom_res && globals->has("display/window/size/height"))
+ if (!force_res && use_custom_res && globals->has_setting("display/window/size/height"))
video_mode.height = globals->get("display/window/size/height");
- if (!editor && ((globals->has("display/window/dpi/allow_hidpi") && !globals->get("display/window/dpi/allow_hidpi")) || force_lowdpi)) {
+ if (!editor && ((globals->has_setting("display/window/dpi/allow_hidpi") && !globals->get("display/window/dpi/allow_hidpi")) || force_lowdpi)) {
OS::get_singleton()->_allow_hidpi = false;
}
- if (use_custom_res && globals->has("display/window/size/fullscreen"))
+ if (use_custom_res && globals->has_setting("display/window/size/fullscreen"))
video_mode.fullscreen = globals->get("display/window/size/fullscreen");
- if (use_custom_res && globals->has("display/window/size/resizable"))
+ if (use_custom_res && globals->has_setting("display/window/size/resizable"))
video_mode.resizable = globals->get("display/window/size/resizable");
- if (use_custom_res && globals->has("display/window/size/borderless"))
+ if (use_custom_res && globals->has_setting("display/window/size/borderless"))
video_mode.borderless_window = globals->get("display/window/size/borderless");
- if (!force_res && use_custom_res && globals->has("display/window/size/test_width") && globals->has("display/window/size/test_height")) {
+ if (!force_res && use_custom_res && globals->has_setting("display/window/size/test_width") && globals->has_setting("display/window/size/test_height")) {
int tw = globals->get("display/window/size/test_width");
int th = globals->get("display/window/size/test_height");
if (tw > 0 && th > 0) {
@@ -759,6 +775,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
GLOBAL_DEF("rendering/quality/intended_usage/framebuffer_allocation", 2);
GLOBAL_DEF("rendering/quality/intended_usage/framebuffer_allocation.mobile", 3);
+ if (editor) {
+ OS::get_singleton()->_allow_hidpi = true; //editors always in hidpi
+ }
Engine::get_singleton()->_pixel_snap = GLOBAL_DEF("rendering/quality/2d/use_pixel_snap", false);
OS::get_singleton()->_keep_screen_on = GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true);
if (rtm == -1) {
@@ -1560,7 +1579,7 @@ uint32_t Main::frame = 0;
bool Main::force_redraw_requested = false;
//for performance metrics
-static uint64_t fixed_process_max = 0;
+static uint64_t physics_process_max = 0;
static uint64_t idle_process_max = 0;
bool Main::iteration() {
@@ -1583,7 +1602,7 @@ bool Main::iteration() {
return false;
*/
- uint64_t fixed_process_ticks = 0;
+ uint64_t physics_process_ticks = 0;
uint64_t idle_process_ticks = 0;
frame += ticks_elapsed;
@@ -1601,7 +1620,7 @@ bool Main::iteration() {
int iters = 0;
- Engine::get_singleton()->_in_fixed = true;
+ Engine::get_singleton()->_in_physics = true;
while (time_accum > frame_slice) {
@@ -1628,13 +1647,13 @@ bool Main::iteration() {
time_accum -= frame_slice;
message_queue->flush();
- fixed_process_ticks = MAX(fixed_process_ticks, OS::get_singleton()->get_ticks_usec() - fixed_begin); // keep the largest one for reference
- fixed_process_max = MAX(OS::get_singleton()->get_ticks_usec() - fixed_begin, fixed_process_max);
+ physics_process_ticks = MAX(physics_process_ticks, OS::get_singleton()->get_ticks_usec() - fixed_begin); // keep the largest one for reference
+ physics_process_max = MAX(OS::get_singleton()->get_ticks_usec() - fixed_begin, physics_process_max);
iters++;
- Engine::get_singleton()->_fixed_frames++;
+ Engine::get_singleton()->_physics_frames++;
}
- Engine::get_singleton()->_in_fixed = false;
+ Engine::get_singleton()->_in_physics = false;
uint64_t idle_begin = OS::get_singleton()->get_ticks_usec();
@@ -1670,7 +1689,7 @@ bool Main::iteration() {
if (script_debugger) {
if (script_debugger->is_profiling()) {
- script_debugger->profiling_set_frame_times(USEC_TO_SEC(frame_time), USEC_TO_SEC(idle_process_ticks), USEC_TO_SEC(fixed_process_ticks), frame_slice);
+ script_debugger->profiling_set_frame_times(USEC_TO_SEC(frame_time), USEC_TO_SEC(idle_process_ticks), USEC_TO_SEC(physics_process_ticks), frame_slice);
}
script_debugger->idle_poll();
}
@@ -1686,9 +1705,9 @@ bool Main::iteration() {
Engine::get_singleton()->_fps = frames;
performance->set_process_time(USEC_TO_SEC(idle_process_max));
- performance->set_fixed_process_time(USEC_TO_SEC(fixed_process_max));
+ performance->set_physics_process_time(USEC_TO_SEC(physics_process_max));
idle_process_max = 0;
- fixed_process_max = 0;
+ physics_process_max = 0;
frame %= 1000000;
frames = 0;
diff --git a/main/performance.cpp b/main/performance.cpp
index e85d2bf736..0f3383c4a8 100644
--- a/main/performance.cpp
+++ b/main/performance.cpp
@@ -42,7 +42,7 @@ void Performance::_bind_methods() {
BIND_ENUM_CONSTANT(TIME_FPS);
BIND_ENUM_CONSTANT(TIME_PROCESS);
- BIND_ENUM_CONSTANT(TIME_FIXED_PROCESS);
+ BIND_ENUM_CONSTANT(TIME_PHYSICS_PROCESS);
BIND_ENUM_CONSTANT(MEMORY_STATIC);
BIND_ENUM_CONSTANT(MEMORY_DYNAMIC);
BIND_ENUM_CONSTANT(MEMORY_STATIC_MAX);
@@ -78,7 +78,7 @@ String Performance::get_monitor_name(Monitor p_monitor) const {
"time/fps",
"time/process",
- "time/fixed_process",
+ "time/physics_process",
"memory/static",
"memory/dynamic",
"memory/static_max",
@@ -94,7 +94,7 @@ String Performance::get_monitor_name(Monitor p_monitor) const {
"raster/surface_changes",
"raster/draw_calls",
"video/video_mem",
- "video/texure_mem",
+ "video/texture_mem",
"video/vertex_mem",
"video/video_mem_max",
"physics_2d/active_objects",
@@ -114,7 +114,7 @@ float Performance::get_monitor(Monitor p_monitor) const {
switch (p_monitor) {
case TIME_FPS: return Engine::get_singleton()->get_frames_per_second();
case TIME_PROCESS: return _process_time;
- case TIME_FIXED_PROCESS: return _fixed_process_time;
+ case TIME_PHYSICS_PROCESS: return _physics_process_time;
case MEMORY_STATIC: return Memory::get_mem_usage();
case MEMORY_DYNAMIC: return MemoryPool::total_memory;
case MEMORY_STATIC_MAX: return Memory::get_mem_max_usage();
@@ -158,14 +158,14 @@ void Performance::set_process_time(float p_pt) {
_process_time = p_pt;
}
-void Performance::set_fixed_process_time(float p_pt) {
+void Performance::set_physics_process_time(float p_pt) {
- _fixed_process_time = p_pt;
+ _physics_process_time = p_pt;
}
Performance::Performance() {
_process_time = 0;
- _fixed_process_time = 0;
+ _physics_process_time = 0;
singleton = this;
}
diff --git a/main/performance.h b/main/performance.h
index a9e3c07d7c..900e6434b7 100644
--- a/main/performance.h
+++ b/main/performance.h
@@ -43,14 +43,14 @@ class Performance : public Object {
static void _bind_methods();
float _process_time;
- float _fixed_process_time;
+ float _physics_process_time;
public:
enum Monitor {
TIME_FPS,
TIME_PROCESS,
- TIME_FIXED_PROCESS,
+ TIME_PHYSICS_PROCESS,
MEMORY_STATIC,
MEMORY_DYNAMIC,
MEMORY_STATIC_MAX,
@@ -83,7 +83,7 @@ public:
String get_monitor_name(Monitor p_monitor) const;
void set_process_time(float p_pt);
- void set_fixed_process_time(float p_pt);
+ void set_physics_process_time(float p_pt);
static Performance *get_singleton() { return singleton; }
diff --git a/methods.py b/methods.py
index 2ab76a5416..b56a0364b5 100644
--- a/methods.py
+++ b/methods.py
@@ -1360,6 +1360,10 @@ def win32_spawn(sh, escape, cmd, args, spawnenv):
return exit_code
"""
+def android_add_flat_dir(self, dir):
+ if (dir not in self.android_flat_dirs):
+ self.android_flat_dirs.append(dir)
+
def android_add_maven_repository(self, url):
if (url not in self.android_maven_repos):
self.android_maven_repos.append(url)
@@ -1706,9 +1710,9 @@ def generate_vs_project(env, num_jobs):
env.AddToVSProject(env.servers_sources)
env.AddToVSProject(env.editor_sources)
- env['MSVSBUILDCOM'] = build_commandline('scons platform=windows target=$(Configuration) tools=!tools! -j' + str(num_jobs))
- env['MSVSREBUILDCOM'] = build_commandline('scons platform=windows target=$(Configuration) tools=!tools! vsproj=yes -j' + str(num_jobs))
- env['MSVSCLEANCOM'] = build_commandline('scons --clean platform=windows target=$(Configuration) tools=!tools! -j' + str(num_jobs))
+ env['MSVSBUILDCOM'] = build_commandline('scons --directory=$(ProjectDir) platform=windows target=$(Configuration) tools=!tools! -j' + str(num_jobs))
+ env['MSVSREBUILDCOM'] = build_commandline('scons --directory=$(ProjectDir) platform=windows target=$(Configuration) tools=!tools! vsproj=yes -j' + str(num_jobs))
+ env['MSVSCLEANCOM'] = build_commandline('scons --directory=$(ProjectDir) --clean platform=windows target=$(Configuration) tools=!tools! -j' + str(num_jobs))
# This version information (Win32, x64, Debug, Release, Release_Debug seems to be
# required for Visual Studio to understand that it needs to generate an NMAKE
diff --git a/misc/dist/ios_xcode/export_options.plist b/misc/dist/ios_xcode/export_options.plist
new file mode 100644
index 0000000000..86d89a6e42
--- /dev/null
+++ b/misc/dist/ios_xcode/export_options.plist
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>method</key>
+ <string>$export_method</string>
+ <key>teamID</key>
+ <string>$team_id</string>
+</dict>
+</plist> \ No newline at end of file
diff --git a/misc/dist/ios_xcode/godot_debug.iphone b/misc/dist/ios_xcode/godot.iphone.debug.arm
index e69de29bb2..e69de29bb2 100755
--- a/misc/dist/ios_xcode/godot_debug.iphone
+++ b/misc/dist/ios_xcode/godot.iphone.debug.arm
diff --git a/misc/dist/ios_xcode/godot_opt.iphone b/misc/dist/ios_xcode/godot.iphone.debug.arm64
index e69de29bb2..e69de29bb2 100755
--- a/misc/dist/ios_xcode/godot_opt.iphone
+++ b/misc/dist/ios_xcode/godot.iphone.debug.arm64
diff --git a/misc/dist/ios_xcode/godot.iphone.debug.fat b/misc/dist/ios_xcode/godot.iphone.debug.fat
new file mode 100755
index 0000000000..e69de29bb2
--- /dev/null
+++ b/misc/dist/ios_xcode/godot.iphone.debug.fat
diff --git a/misc/dist/ios_xcode/godot.iphone.release.arm b/misc/dist/ios_xcode/godot.iphone.release.arm
new file mode 100755
index 0000000000..e69de29bb2
--- /dev/null
+++ b/misc/dist/ios_xcode/godot.iphone.release.arm
diff --git a/misc/dist/ios_xcode/godot.iphone.release.arm64 b/misc/dist/ios_xcode/godot.iphone.release.arm64
new file mode 100755
index 0000000000..e69de29bb2
--- /dev/null
+++ b/misc/dist/ios_xcode/godot.iphone.release.arm64
diff --git a/misc/dist/ios_xcode/godot.iphone.release.fat b/misc/dist/ios_xcode/godot.iphone.release.fat
new file mode 100755
index 0000000000..e69de29bb2
--- /dev/null
+++ b/misc/dist/ios_xcode/godot.iphone.release.fat
diff --git a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj
index bdba8488c8..3f2db94193 100644
--- a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj
+++ b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj
@@ -7,18 +7,17 @@
objects = {
/* Begin PBXBuildFile section */
- D07CD43F1C5D573600B7FB28 /* Default-568h@2x~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD4331C5D573600B7FB28 /* Default-568h@2x~iphone.png */; };
- D07CD4401C5D573600B7FB28 /* Default-667h.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD4341C5D573600B7FB28 /* Default-667h.png */; };
+ 1F1575721F582BE20003B888 /* dylibs in Resources */ = {isa = PBXBuildFile; fileRef = 1F1575711F582BE20003B888 /* dylibs */; };
+ 1FF4C1851F584E3F00A41E41 /* GameKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1FF4C1841F584E3F00A41E41 /* GameKit.framework */; };
+ 1FF4C1871F584E5600A41E41 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1FF4C1861F584E5600A41E41 /* StoreKit.framework */; };
+ D07CD43F1C5D573600B7FB28 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD4331C5D573600B7FB28 /* Default-568h@2x.png */; };
D07CD4411C5D573600B7FB28 /* Default-667h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD4351C5D573600B7FB28 /* Default-667h@2x.png */; };
- D07CD4421C5D573600B7FB28 /* Default-736h.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD4361C5D573600B7FB28 /* Default-736h.png */; };
- D07CD4431C5D573600B7FB28 /* Default-736h@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD4371C5D573600B7FB28 /* Default-736h@3x.png */; };
- D07CD4441C5D573600B7FB28 /* Default-Landscape-736h.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD4381C5D573600B7FB28 /* Default-Landscape-736h.png */; };
- D07CD4451C5D573600B7FB28 /* Default-Landscape@2x~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD4391C5D573600B7FB28 /* Default-Landscape@2x~ipad.png */; };
- D07CD4461C5D573600B7FB28 /* Default-Landscape~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD43A1C5D573600B7FB28 /* Default-Landscape~ipad.png */; };
- D07CD4471C5D573600B7FB28 /* Default-Portrait@2x~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD43B1C5D573600B7FB28 /* Default-Portrait@2x~ipad.png */; };
- D07CD4481C5D573600B7FB28 /* Default-Portrait~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD43C1C5D573600B7FB28 /* Default-Portrait~ipad.png */; };
- D07CD4491C5D573600B7FB28 /* Default@2x~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD43D1C5D573600B7FB28 /* Default@2x~iphone.png */; };
- D07CD44A1C5D573600B7FB28 /* Default~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD43E1C5D573600B7FB28 /* Default~iphone.png */; };
+ D07CD4421C5D573600B7FB28 /* Default-Portrait-736h@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD4361C5D573600B7FB28 /* Default-Portrait-736h@3x.png */; };
+ D07CD4441C5D573600B7FB28 /* Default-Landscape-736h@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD4381C5D573600B7FB28 /* Default-Landscape-736h@3x.png */; };
+ D07CD4451C5D573600B7FB28 /* Default-Landscape@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD4391C5D573600B7FB28 /* Default-Landscape@2x.png */; };
+ D07CD4461C5D573600B7FB28 /* Default-Landscape-1366h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD43A1C5D573600B7FB28 /* Default-Landscape-1366h@2x.png */; };
+ D07CD4471C5D573600B7FB28 /* Default-Portrait@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD43B1C5D573600B7FB28 /* Default-Portrait@2x.png */; };
+ D07CD4481C5D573600B7FB28 /* Default-Portrait-1366h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD43C1C5D573600B7FB28 /* Default-Portrait-1366h@2x.png */; };
D07CD44E1C5D589C00B7FB28 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D07CD44D1C5D589C00B7FB28 /* Images.xcassets */; };
D0BCFE3818AEBDA2004A7AAE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0BCFE3718AEBDA2004A7AAE /* Foundation.framework */; };
D0BCFE3A18AEBDA2004A7AAE /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0BCFE3918AEBDA2004A7AAE /* CoreGraphics.framework */; };
@@ -26,36 +25,36 @@
D0BCFE3E18AEBDA2004A7AAE /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0BCFE3D18AEBDA2004A7AAE /* GLKit.framework */; };
D0BCFE4018AEBDA2004A7AAE /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0BCFE3F18AEBDA2004A7AAE /* OpenGLES.framework */; };
D0BCFE4618AEBDA2004A7AAE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = D0BCFE4418AEBDA2004A7AAE /* InfoPlist.strings */; };
- D0BCFE7818AEBFEB004A7AAE /* data.pck in Resources */ = {isa = PBXBuildFile; fileRef = D0BCFE7718AEBFEB004A7AAE /* data.pck */; };
- D0BCFE7A18AEC06A004A7AAE /* godot_opt.iphone in Resources */ = {isa = PBXBuildFile; fileRef = D0BCFE7918AEC06A004A7AAE /* godot_opt.iphone */; };
+ D0BCFE7818AEBFEB004A7AAE /* $binary.pck in Resources */ = {isa = PBXBuildFile; fileRef = D0BCFE7718AEBFEB004A7AAE /* $binary.pck */; };
+ D0BCFE7A18AEC06A004A7AAE /* $binary.iphone in Resources */ = {isa = PBXBuildFile; fileRef = D0BCFE7918AEC06A004A7AAE /* $binary.iphone */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
- D07CD4331C5D573600B7FB28 /* Default-568h@2x~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x~iphone.png"; sourceTree = "<group>"; };
- D07CD4341C5D573600B7FB28 /* Default-667h.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-667h.png"; sourceTree = "<group>"; };
+ 1F1575711F582BE20003B888 /* dylibs */ = {isa = PBXFileReference; lastKnownFileType = folder; name = dylibs; path = dylibs; sourceTree = "<group>"; };
+ 1FF4C1841F584E3F00A41E41 /* GameKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameKit.framework; path = System/Library/Frameworks/GameKit.framework; sourceTree = SDKROOT; };
+ 1FF4C1861F584E5600A41E41 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; };
+ 1FF4C1881F584E6300A41E41 /* $binary.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = $binary.entitlements; sourceTree = "<group>"; };
+ D07CD4331C5D573600B7FB28 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
D07CD4351C5D573600B7FB28 /* Default-667h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-667h@2x.png"; sourceTree = "<group>"; };
- D07CD4361C5D573600B7FB28 /* Default-736h.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-736h.png"; sourceTree = "<group>"; };
- D07CD4371C5D573600B7FB28 /* Default-736h@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-736h@3x.png"; sourceTree = "<group>"; };
- D07CD4381C5D573600B7FB28 /* Default-Landscape-736h.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape-736h.png"; sourceTree = "<group>"; };
- D07CD4391C5D573600B7FB28 /* Default-Landscape@2x~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape@2x~ipad.png"; sourceTree = "<group>"; };
- D07CD43A1C5D573600B7FB28 /* Default-Landscape~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape~ipad.png"; sourceTree = "<group>"; };
- D07CD43B1C5D573600B7FB28 /* Default-Portrait@2x~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Portrait@2x~ipad.png"; sourceTree = "<group>"; };
- D07CD43C1C5D573600B7FB28 /* Default-Portrait~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Portrait~ipad.png"; sourceTree = "<group>"; };
- D07CD43D1C5D573600B7FB28 /* Default@2x~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x~iphone.png"; sourceTree = "<group>"; };
- D07CD43E1C5D573600B7FB28 /* Default~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default~iphone.png"; sourceTree = "<group>"; };
+ D07CD4361C5D573600B7FB28 /* Default-Portrait-736h@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Portrait-736h@3x.png"; sourceTree = "<group>"; };
+ D07CD4381C5D573600B7FB28 /* Default-Landscape-736h@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape-736h@3x.png"; sourceTree = "<group>"; };
+ D07CD4391C5D573600B7FB28 /* Default-Landscape@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape@2x.png"; sourceTree = "<group>"; };
+ D07CD43A1C5D573600B7FB28 /* Default-Landscape-1366h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape-1366h@2x.png"; sourceTree = "<group>"; };
+ D07CD43B1C5D573600B7FB28 /* Default-Portrait@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Portrait@2x.png"; sourceTree = "<group>"; };
+ D07CD43C1C5D573600B7FB28 /* Default-Portrait-1366h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Portrait-1366h@2x.png"; sourceTree = "<group>"; };
D07CD44D1C5D589C00B7FB28 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
- D0BCFE3418AEBDA2004A7AAE /* godot_ios.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = godot_ios.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ D0BCFE3418AEBDA2004A7AAE /* $binary.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = $binary.app; sourceTree = BUILT_PRODUCTS_DIR; };
D0BCFE3718AEBDA2004A7AAE /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
D0BCFE3918AEBDA2004A7AAE /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
D0BCFE3B18AEBDA2004A7AAE /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
D0BCFE3D18AEBDA2004A7AAE /* GLKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLKit.framework; path = System/Library/Frameworks/GLKit.framework; sourceTree = SDKROOT; };
D0BCFE3F18AEBDA2004A7AAE /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
- D0BCFE4318AEBDA2004A7AAE /* godot_ios-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "godot_ios-Info.plist"; sourceTree = "<group>"; };
+ D0BCFE4318AEBDA2004A7AAE /* $binary-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "$binary-Info.plist"; sourceTree = "<group>"; };
D0BCFE4518AEBDA2004A7AAE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
- D0BCFE4918AEBDA2004A7AAE /* godot_ios-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "godot_ios-Prefix.pch"; sourceTree = "<group>"; };
+ D0BCFE4918AEBDA2004A7AAE /* $binary-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "$binary-Prefix.pch"; sourceTree = "<group>"; };
D0BCFE6118AEBDA3004A7AAE /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
- D0BCFE7718AEBFEB004A7AAE /* data.pck */ = {isa = PBXFileReference; lastKnownFileType = text; path = data.pck; sourceTree = "<group>"; };
- D0BCFE7918AEC06A004A7AAE /* godot_opt.iphone */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = godot_opt.iphone; sourceTree = "<group>"; };
+ D0BCFE7718AEBFEB004A7AAE /* $binary.pck */ = {isa = PBXFileReference; lastKnownFileType = file; path = $binary.pck; sourceTree = "<group>"; };
+ D0BCFE7918AEC06A004A7AAE /* $binary.iphone */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = $binary.iphone; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -64,8 +63,10 @@
buildActionMask = 2147483647;
files = (
D0BCFE4018AEBDA2004A7AAE /* OpenGLES.framework in Frameworks */,
+ 1FF4C1871F584E5600A41E41 /* StoreKit.framework in Frameworks */,
D0BCFE3A18AEBDA2004A7AAE /* CoreGraphics.framework in Frameworks */,
D0BCFE3C18AEBDA2004A7AAE /* UIKit.framework in Frameworks */,
+ 1FF4C1851F584E3F00A41E41 /* GameKit.framework in Frameworks */,
D0BCFE3E18AEBDA2004A7AAE /* GLKit.framework in Frameworks */,
D0BCFE3818AEBDA2004A7AAE /* Foundation.framework in Frameworks */,
);
@@ -77,9 +78,10 @@
D0BCFE2B18AEBDA2004A7AAE = {
isa = PBXGroup;
children = (
- D0BCFE7918AEC06A004A7AAE /* godot_opt.iphone */,
- D0BCFE7718AEBFEB004A7AAE /* data.pck */,
- D0BCFE4118AEBDA2004A7AAE /* godot_ios */,
+ 1F1575711F582BE20003B888 /* dylibs */,
+ D0BCFE7918AEC06A004A7AAE /* $binary.iphone */,
+ D0BCFE7718AEBFEB004A7AAE /* $binary.pck */,
+ D0BCFE4118AEBDA2004A7AAE /* $binary */,
D0BCFE3618AEBDA2004A7AAE /* Frameworks */,
D0BCFE3518AEBDA2004A7AAE /* Products */,
);
@@ -88,7 +90,7 @@
D0BCFE3518AEBDA2004A7AAE /* Products */ = {
isa = PBXGroup;
children = (
- D0BCFE3418AEBDA2004A7AAE /* godot_ios.app */,
+ D0BCFE3418AEBDA2004A7AAE /* $binary.app */,
);
name = Products;
sourceTree = "<group>";
@@ -96,6 +98,8 @@
D0BCFE3618AEBDA2004A7AAE /* Frameworks */ = {
isa = PBXGroup;
children = (
+ 1FF4C1861F584E5600A41E41 /* StoreKit.framework */,
+ 1FF4C1841F584E3F00A41E41 /* GameKit.framework */,
D0BCFE3718AEBDA2004A7AAE /* Foundation.framework */,
D0BCFE3918AEBDA2004A7AAE /* CoreGraphics.framework */,
D0BCFE3B18AEBDA2004A7AAE /* UIKit.framework */,
@@ -106,33 +110,30 @@
name = Frameworks;
sourceTree = "<group>";
};
- D0BCFE4118AEBDA2004A7AAE /* godot_ios */ = {
+ D0BCFE4118AEBDA2004A7AAE /* $binary */ = {
isa = PBXGroup;
children = (
- D07CD4331C5D573600B7FB28 /* Default-568h@2x~iphone.png */,
- D07CD4341C5D573600B7FB28 /* Default-667h.png */,
+ 1FF4C1881F584E6300A41E41 /* $binary.entitlements */,
+ D07CD4331C5D573600B7FB28 /* Default-568h@2x.png */,
D07CD4351C5D573600B7FB28 /* Default-667h@2x.png */,
- D07CD4361C5D573600B7FB28 /* Default-736h.png */,
- D07CD4371C5D573600B7FB28 /* Default-736h@3x.png */,
- D07CD4381C5D573600B7FB28 /* Default-Landscape-736h.png */,
- D07CD4391C5D573600B7FB28 /* Default-Landscape@2x~ipad.png */,
- D07CD43A1C5D573600B7FB28 /* Default-Landscape~ipad.png */,
- D07CD43B1C5D573600B7FB28 /* Default-Portrait@2x~ipad.png */,
- D07CD43C1C5D573600B7FB28 /* Default-Portrait~ipad.png */,
- D07CD43D1C5D573600B7FB28 /* Default@2x~iphone.png */,
- D07CD43E1C5D573600B7FB28 /* Default~iphone.png */,
+ D07CD4361C5D573600B7FB28 /* Default-Portrait-736h@3x.png */,
+ D07CD4381C5D573600B7FB28 /* Default-Landscape-736h@3x.png */,
+ D07CD4391C5D573600B7FB28 /* Default-Landscape@2x.png */,
+ D07CD43A1C5D573600B7FB28 /* Default-Landscape-1366h@2x.png */,
+ D07CD43B1C5D573600B7FB28 /* Default-Portrait@2x.png */,
+ D07CD43C1C5D573600B7FB28 /* Default-Portrait-1366h@2x.png */,
D07CD44D1C5D589C00B7FB28 /* Images.xcassets */,
D0BCFE4218AEBDA2004A7AAE /* Supporting Files */,
);
- path = godot_ios;
+ path = $binary;
sourceTree = "<group>";
};
D0BCFE4218AEBDA2004A7AAE /* Supporting Files */ = {
isa = PBXGroup;
children = (
- D0BCFE4318AEBDA2004A7AAE /* godot_ios-Info.plist */,
+ D0BCFE4318AEBDA2004A7AAE /* $binary-Info.plist */,
D0BCFE4418AEBDA2004A7AAE /* InfoPlist.strings */,
- D0BCFE4918AEBDA2004A7AAE /* godot_ios-Prefix.pch */,
+ D0BCFE4918AEBDA2004A7AAE /* $binary-Prefix.pch */,
);
name = "Supporting Files";
sourceTree = "<group>";
@@ -140,9 +141,9 @@
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
- D0BCFE3318AEBDA2004A7AAE /* godot_ios */ = {
+ D0BCFE3318AEBDA2004A7AAE /* $binary */ = {
isa = PBXNativeTarget;
- buildConfigurationList = D0BCFE7118AEBDA3004A7AAE /* Build configuration list for PBXNativeTarget "godot_ios" */;
+ buildConfigurationList = D0BCFE7118AEBDA3004A7AAE /* Build configuration list for PBXNativeTarget "$binary" */;
buildPhases = (
D0BCFE3018AEBDA2004A7AAE /* Sources */,
D0BCFE3118AEBDA2004A7AAE /* Frameworks */,
@@ -152,9 +153,9 @@
);
dependencies = (
);
- name = godot_ios;
- productName = godot_ios;
- productReference = D0BCFE3418AEBDA2004A7AAE /* godot_ios.app */;
+ name = "$binary";
+ productName = "$name";
+ productReference = D0BCFE3418AEBDA2004A7AAE /* $binary.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
@@ -165,8 +166,24 @@
attributes = {
LastUpgradeCheck = 0500;
ORGANIZATIONNAME = GodotEngine;
+ TargetAttributes = {
+ D0BCFE3318AEBDA2004A7AAE = {
+ DevelopmentTeam = $team_id;
+ SystemCapabilities = {
+ com.apple.GameCenter = {
+ enabled = 1;
+ };
+ com.apple.InAppPurchase = {
+ enabled = 1;
+ };
+ com.apple.Push = {
+ enabled = 1;
+ };
+ };
+ };
+ };
};
- buildConfigurationList = D0BCFE2F18AEBDA2004A7AAE /* Build configuration list for PBXProject "godot_ios" */;
+ buildConfigurationList = D0BCFE2F18AEBDA2004A7AAE /* Build configuration list for PBXProject "$binary" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
@@ -179,7 +196,7 @@
projectDirPath = "";
projectRoot = "";
targets = (
- D0BCFE3318AEBDA2004A7AAE /* godot_ios */,
+ D0BCFE3318AEBDA2004A7AAE /* $binary */,
);
};
/* End PBXProject section */
@@ -189,22 +206,19 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- D07CD4471C5D573600B7FB28 /* Default-Portrait@2x~ipad.png in Resources */,
+ 1F1575721F582BE20003B888 /* dylibs in Resources */,
D07CD44E1C5D589C00B7FB28 /* Images.xcassets in Resources */,
- D0BCFE7818AEBFEB004A7AAE /* data.pck in Resources */,
- D07CD4461C5D573600B7FB28 /* Default-Landscape~ipad.png in Resources */,
+ D0BCFE7818AEBFEB004A7AAE /* $binary.pck in Resources */,
+ D07CD4471C5D573600B7FB28 /* Default-Portrait@2x.png in Resources */,
+ D07CD4461C5D573600B7FB28 /* Default-Landscape-1366h@2x.png in Resources */,
D07CD4411C5D573600B7FB28 /* Default-667h@2x.png in Resources */,
- D07CD4401C5D573600B7FB28 /* Default-667h.png in Resources */,
- D07CD4431C5D573600B7FB28 /* Default-736h@3x.png in Resources */,
- D07CD43F1C5D573600B7FB28 /* Default-568h@2x~iphone.png in Resources */,
- D07CD4451C5D573600B7FB28 /* Default-Landscape@2x~ipad.png in Resources */,
- D07CD44A1C5D573600B7FB28 /* Default~iphone.png in Resources */,
- D07CD4491C5D573600B7FB28 /* Default@2x~iphone.png in Resources */,
- D07CD4441C5D573600B7FB28 /* Default-Landscape-736h.png in Resources */,
- D07CD4421C5D573600B7FB28 /* Default-736h.png in Resources */,
+ D07CD43F1C5D573600B7FB28 /* Default-568h@2x.png in Resources */,
+ D07CD4451C5D573600B7FB28 /* Default-Landscape@2x.png in Resources */,
+ D07CD4441C5D573600B7FB28 /* Default-Landscape-736h@3x.png in Resources */,
+ D07CD4421C5D573600B7FB28 /* Default-Portrait-736h@3x.png in Resources */,
+ D07CD4481C5D573600B7FB28 /* Default-Portrait-1366h@2x.png in Resources */,
D0BCFE4618AEBDA2004A7AAE /* InfoPlist.strings in Resources */,
- D0BCFE7A18AEC06A004A7AAE /* godot_opt.iphone in Resources */,
- D07CD4481C5D573600B7FB28 /* Default-Portrait~ipad.png in Resources */,
+ D0BCFE7A18AEC06A004A7AAE /* $binary.iphone in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -249,7 +263,7 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "$code_sign_identity_debug";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
@@ -265,7 +279,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 7.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 9.0;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -289,7 +303,8 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ CODE_SIGN_IDENTITY = "$code_sign_identity_release";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "$code_sign_identity_release";
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
@@ -299,7 +314,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 7.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 9.0;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
@@ -311,13 +326,22 @@
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CODE_SIGN_ENTITLEMENTS = $binary/$binary.entitlements;
+ CODE_SIGN_IDENTITY = "$code_sign_identity_debug";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "$code_sign_identity_debug";
CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)";
+ DEVELOPMENT_TEAM = $team_id;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = "godot_ios/godot_ios-Prefix.pch";
- INFOPLIST_FILE = "godot_ios/godot_ios-Info.plist";
- IPHONEOS_DEPLOYMENT_TARGET = 6.0;
- PRODUCT_BUNDLE_IDENTIFIER = org.godotengine.game.ios;
+ GCC_PREFIX_HEADER = "$binary/$binary-Prefix.pch";
+ INFOPLIST_FILE = "$binary/$binary-Info.plist";
+ IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(PROJECT_DIR)/dylibs",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = $identifier;
PRODUCT_NAME = "$(TARGET_NAME)";
+ PROVISIONING_PROFILE = "$provisioning_profile_uuid_debug";
TARGETED_DEVICE_FAMILY = "1,2";
VALID_ARCHS = "armv7 armv7s";
WRAPPER_EXTENSION = app;
@@ -329,14 +353,22 @@
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
- CODE_SIGN_IDENTITY = "iPhone Distribution: Ariel Manzur (BYC57PA2Q5)";
+ CODE_SIGN_ENTITLEMENTS = $binary/$binary.entitlements;
+ CODE_SIGN_IDENTITY = "$code_sign_identity_release";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "$code_sign_identity_release";
CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)";
+ DEVELOPMENT_TEAM = $team_id;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = "godot_ios/godot_ios-Prefix.pch";
- INFOPLIST_FILE = "godot_ios/godot_ios-Info.plist";
- IPHONEOS_DEPLOYMENT_TARGET = 6.0;
- PRODUCT_BUNDLE_IDENTIFIER = org.godotengine.game.ios;
+ GCC_PREFIX_HEADER = "$binary/$binary-Prefix.pch";
+ INFOPLIST_FILE = "$binary/$binary-Info.plist";
+ IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(PROJECT_DIR)/dylibs",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = $identifier;
PRODUCT_NAME = "$(TARGET_NAME)";
+ PROVISIONING_PROFILE = "$provisioning_profile_uuid_release";
TARGETED_DEVICE_FAMILY = "1,2";
VALID_ARCHS = "armv7 armv7s";
WRAPPER_EXTENSION = app;
@@ -346,7 +378,7 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
- D0BCFE2F18AEBDA2004A7AAE /* Build configuration list for PBXProject "godot_ios" */ = {
+ D0BCFE2F18AEBDA2004A7AAE /* Build configuration list for PBXProject "$binary" */ = {
isa = XCConfigurationList;
buildConfigurations = (
D0BCFE6F18AEBDA3004A7AAE /* Debug */,
@@ -355,7 +387,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
- D0BCFE7118AEBDA3004A7AAE /* Build configuration list for PBXNativeTarget "godot_ios" */ = {
+ D0BCFE7118AEBDA3004A7AAE /* Build configuration list for PBXNativeTarget "$binary" */ = {
isa = XCConfigurationList;
buildConfigurations = (
D0BCFE7218AEBDA3004A7AAE /* Debug */,
diff --git a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.xcworkspace/contents.xcworkspacedata
index 3c9ba38bbe..c9c19829f4 100644
--- a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.xcworkspace/contents.xcworkspacedata
+++ b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
- location = "self:godot_ios.xcodeproj">
+ location = "self:$binary.xcodeproj">
</FileRef>
</Workspace>
diff --git a/misc/dist/ios_xcode/godot_ios.xcodeproj/xcshareddata/xcschemes/godot_ios.xcscheme b/misc/dist/ios_xcode/godot_ios.xcodeproj/xcshareddata/xcschemes/godot_ios.xcscheme
new file mode 100644
index 0000000000..3f0df5c437
--- /dev/null
+++ b/misc/dist/ios_xcode/godot_ios.xcodeproj/xcshareddata/xcschemes/godot_ios.xcscheme
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ LastUpgradeVersion = "0710"
+ version = "1.3">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "A340BDFEBCA49239A941883D"
+ BuildableName = "$binary.app"
+ BlueprintName = "$binary"
+ ReferencedContainer = "container:$binary.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ buildConfiguration = "Development"
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ shouldUseLaunchSchemeArgsEnv = "YES">
+ <Testables>
+ </Testables>
+ <MacroExpansion>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "A340BDFEBCA49239A941883D"
+ BuildableName = "$binary.app"
+ BlueprintName = "$binary"
+ ReferencedContainer = "container:$binary.xcodeproj">
+ </BuildableReference>
+ </MacroExpansion>
+ <AdditionalOptions>
+ </AdditionalOptions>
+ </TestAction>
+ <LaunchAction
+ buildConfiguration = "Development"
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ ignoresPersistentStateOnLaunch = "NO"
+ debugDocumentVersioning = "YES"
+ debugServiceExtension = "internal"
+ allowLocationSimulation = "YES">
+ <BuildableProductRunnable
+ runnableDebuggingMode = "0">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "A340BDFEBCA49239A941883D"
+ BuildableName = "$binary.app"
+ BlueprintName = "$binary"
+ ReferencedContainer = "container:$binary.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ <CommandLineArguments>
+ </CommandLineArguments>
+ <AdditionalOptions>
+ </AdditionalOptions>
+ </LaunchAction>
+ <ProfileAction
+ buildConfiguration = "Development"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ debugDocumentVersioning = "YES">
+ <BuildableProductRunnable
+ runnableDebuggingMode = "0">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "A340BDFEBCA49239A941883D"
+ BuildableName = "$binary.app"
+ BlueprintName = "$binary"
+ ReferencedContainer = "container:$binary.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Development">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Development"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
diff --git a/misc/dist/ios_xcode/godot_ios/Default-568h@2x~iphone.png b/misc/dist/ios_xcode/godot_ios/Default-568h@2x.png
index 1d5e472665..1d5e472665 100644
--- a/misc/dist/ios_xcode/godot_ios/Default-568h@2x~iphone.png
+++ b/misc/dist/ios_xcode/godot_ios/Default-568h@2x.png
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Default-667h.png b/misc/dist/ios_xcode/godot_ios/Default-667h.png
deleted file mode 100644
index b13a399c83..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Default-667h.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Default-736h@3x.png b/misc/dist/ios_xcode/godot_ios/Default-736h@3x.png
deleted file mode 100644
index 33847ac136..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Default-736h@3x.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Default-Landscape-1366h@2x.png b/misc/dist/ios_xcode/godot_ios/Default-Landscape-1366h@2x.png
new file mode 100644
index 0000000000..ec5b4f7888
--- /dev/null
+++ b/misc/dist/ios_xcode/godot_ios/Default-Landscape-1366h@2x.png
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Default-Landscape-736h.png b/misc/dist/ios_xcode/godot_ios/Default-Landscape-736h@3x.png
index 2a025b745b..2a025b745b 100644
--- a/misc/dist/ios_xcode/godot_ios/Default-Landscape-736h.png
+++ b/misc/dist/ios_xcode/godot_ios/Default-Landscape-736h@3x.png
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Default-Landscape@2x~ipad.png b/misc/dist/ios_xcode/godot_ios/Default-Landscape@2x.png
index 7099f3e18d..7099f3e18d 100644
--- a/misc/dist/ios_xcode/godot_ios/Default-Landscape@2x~ipad.png
+++ b/misc/dist/ios_xcode/godot_ios/Default-Landscape@2x.png
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Default-Landscape~ipad.png b/misc/dist/ios_xcode/godot_ios/Default-Landscape~ipad.png
deleted file mode 100644
index 4a761c339a..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Default-Landscape~ipad.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Default-Portrait-1366h@2x.png b/misc/dist/ios_xcode/godot_ios/Default-Portrait-1366h@2x.png
new file mode 100644
index 0000000000..a6d054ba2a
--- /dev/null
+++ b/misc/dist/ios_xcode/godot_ios/Default-Portrait-1366h@2x.png
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Default-736h.png b/misc/dist/ios_xcode/godot_ios/Default-Portrait-736h@3x.png
index 8c44edbccd..8c44edbccd 100644
--- a/misc/dist/ios_xcode/godot_ios/Default-736h.png
+++ b/misc/dist/ios_xcode/godot_ios/Default-Portrait-736h@3x.png
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Default-Portrait@2x.png b/misc/dist/ios_xcode/godot_ios/Default-Portrait@2x.png
new file mode 100644
index 0000000000..a6d054ba2a
--- /dev/null
+++ b/misc/dist/ios_xcode/godot_ios/Default-Portrait@2x.png
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Default-Portrait@2x~ipad.png b/misc/dist/ios_xcode/godot_ios/Default-Portrait@2x~ipad.png
deleted file mode 100644
index b09cf21186..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Default-Portrait@2x~ipad.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Default-Portrait~ipad.png b/misc/dist/ios_xcode/godot_ios/Default-Portrait~ipad.png
deleted file mode 100644
index fa698eb70c..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Default-Portrait~ipad.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Default@2x~iphone.png b/misc/dist/ios_xcode/godot_ios/Default@2x~iphone.png
deleted file mode 100644
index ddf2861f4d..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Default@2x~iphone.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Default~iphone.png b/misc/dist/ios_xcode/godot_ios/Default~iphone.png
deleted file mode 100644
index c485a33b03..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Default~iphone.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Contents.json b/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Contents.json
deleted file mode 100644
index a458b67873..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Contents.json
+++ /dev/null
@@ -1,128 +0,0 @@
-{
- "images" : [
- {
- "idiom" : "iphone",
- "size" : "29x29",
- "scale" : "1x",
- "filename": "Icon-29.png",
- },
- {
- "idiom" : "iphone",
- "size" : "29x29",
- "scale" : "2x",
- "filename": "Icon-58.png",
- },
- {
- "idiom" : "iphone",
- "size" : "29x29",
- "scale" : "3x",
- "filename": "icon-87.png",
- },
- {
- "idiom" : "iphone",
- "size" : "40x40",
- "scale" : "2x",
- "filename": "Icon-80.png",
- },
- {
- "idiom" : "iphone",
- "size" : "40x40",
- "scale" : "3x",
- "filename": "Icon-120.png",
- },
- {
- "idiom" : "iphone",
- "size" : "57x57",
- "scale" : "1x",
- "filename": "Icon-57.png",
- },
- {
- "idiom" : "iphone",
- "size" : "57x57",
- "scale" : "2x",
- "filename": "Icon-114.png",
- },
- {
- "idiom" : "iphone",
- "size" : "60x60",
- "scale" : "2x",
- "filename": "Icon-120.png",
- },
- {
- "idiom" : "iphone",
- "size" : "60x60",
- "scale" : "3x",
- "filename": "Icon-180.png",
- },
- {
- "idiom" : "ipad",
- "size" : "29x29",
- "scale" : "1x",
- "filename": "Icon-29.png",
- },
- {
- "idiom" : "ipad",
- "size" : "29x29",
- "scale" : "2x",
- "filename": "Icon-58.png",
- },
- {
- "idiom" : "ipad",
- "size" : "40x40",
- "scale" : "1x",
- "filename": "Icon-40.png",
- },
- {
- "idiom" : "ipad",
- "size" : "40x40",
- "scale" : "2x",
- "filename": "Icon-80.png",
- },
- {
- "idiom" : "ipad",
- "size" : "50x50",
- "scale" : "1x",
- "filename": "Icon-50.png",
- },
- {
- "idiom" : "ipad",
- "size" : "50x50",
- "scale" : "2x",
- "filename": "Icon-100.png",
- },
- {
- "idiom" : "ipad",
- "size" : "72x72",
- "scale" : "1x",
- "filename": "Icon-72.png",
- },
- {
- "idiom" : "ipad",
- "size" : "72x72",
- "scale" : "2x",
- "filename": "Icon-144.png",
- },
- {
- "size" : "76x76",
- "idiom" : "ipad",
- "filename" : "Icon-76.png",
- "scale" : "1x",
- },
- {
- "idiom" : "ipad",
- "size" : "76x76",
- "scale" : "2x",
- "filename": "Icon-152.png",
- },
- {
- "idiom" : "ipad",
- "size" : "83.5x83.5",
- "scale" : "2x",
- "filename": "icon-167.png",
- }
- ],
- "info" : {
- "version" : 1,
- "author" : "xcode"
- }
-}
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-100.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-100.png
deleted file mode 100644
index 165f4423b3..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-100.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-114.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-114.png
deleted file mode 100644
index 2e205e920c..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-114.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-120.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-120.png
deleted file mode 100644
index 6245f83f48..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-120.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-144.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-144.png
deleted file mode 100644
index 7b24e01bc6..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-144.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-152.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-152.png
deleted file mode 100644
index 344b470fa3..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-152.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-180.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-180.png
deleted file mode 100644
index 0dcebbc3f2..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-180.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-29.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-29.png
deleted file mode 100644
index 9ae94e9aaf..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-29.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-40.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-40.png
deleted file mode 100644
index 569f24df91..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-40.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-50.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-50.png
deleted file mode 100644
index 9e69ed3121..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-50.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-57.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-57.png
deleted file mode 100644
index b970fa3067..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-57.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-58.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-58.png
deleted file mode 100644
index 6097a6c73b..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-58.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-60.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-60.png
deleted file mode 100644
index 21b9622eb6..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-60.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-72.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-72.png
deleted file mode 100644
index 34dea8e6ad..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-72.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-76.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-76.png
deleted file mode 100644
index f72eb0b345..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-76.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-80.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-80.png
deleted file mode 100644
index 793c9b1f5f..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-80.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-167.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-167.png
deleted file mode 100644
index 7cd0e054ab..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-167.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-87.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-87.png
deleted file mode 100644
index e9b2429754..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-87.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/sizes b/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/sizes
deleted file mode 100644
index e328a62cb6..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/sizes
+++ /dev/null
@@ -1,17 +0,0 @@
-100
-114
-120
-144
-152
-167
-180
-29
-40
-50
-57
-58
-60
-72
-76
-80
-87
diff --git a/misc/dist/ios_xcode/godot_ios/godot_ios-Info.plist b/misc/dist/ios_xcode/godot_ios/godot_ios-Info.plist
index f97b0fca36..1531a41bd0 100644
--- a/misc/dist/ios_xcode/godot_ios/godot_ios-Info.plist
+++ b/misc/dist/ios_xcode/godot_ios/godot_ios-Info.plist
@@ -5,32 +5,33 @@
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
- <string>Insert Name Here</string>
+ <string>$name</string>
<key>CFBundleExecutable</key>
- <string>godot_opt.iphone</string>
+ <string>$binary.iphone</string>
<key>CFBundleIcons</key>
<dict/>
<key>CFBundleIcons~ipad</key>
<dict/>
<key>CFBundleIdentifier</key>
- <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <string>$identifier</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
- <string>${PRODUCT_NAME}</string>
+ <string>$name</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>1.0</string>
+ <string>$short_version</string>
<key>CFBundleSignature</key>
- <string>????</string>
+ <string>$signature</string>
<key>CFBundleVersion</key>
- <string>1.0</string>
+ <string>$version</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
+ <string>gamekit</string>
</array>
<key>UIRequiresFullScreen</key>
<true/>
diff --git a/misc/dist/ios_xcode/godot_ios/godot_ios.entitlements b/misc/dist/ios_xcode/godot_ios/godot_ios.entitlements
new file mode 100644
index 0000000000..903def2af5
--- /dev/null
+++ b/misc/dist/ios_xcode/godot_ios/godot_ios.entitlements
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>aps-environment</key>
+ <string>development</string>
+</dict>
+</plist>
diff --git a/misc/dist/linux/godot.6 b/misc/dist/linux/godot.6
new file mode 100644
index 0000000000..946fa6c913
--- /dev/null
+++ b/misc/dist/linux/godot.6
@@ -0,0 +1,165 @@
+.TH GODOT "6" "September 2017" "godot 3.0-alpha" "Games"
+.SH NAME
+godot \- multi\-platform 2D and 3D game engine with a feature\-rich editor
+.SH SYNOPSIS
+.B godot
+[\fI\,options\/\fR] [path to scene or 'project.godot' file]
+.SH DESCRIPTION
+Godot Engine is an advanced, feature\-packed, multi\-platform 2D and 3D game
+engine.
+.br
+It provides a huge set of common tools, so you can just focus on making
+your game without reinventing the wheel.
+.SS "General options:"
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+Display this help message.
+.TP
+\fB\-\-version\fR
+Display the version string.
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+Use verbose stdout mode.
+.TP
+\fB\-\-quiet\fR
+Quiet mode, silences stdout messages. Errors are still displayed.
+.SS "Run options:"
+.TP
+\fB\-e\fR, \fB\-\-editor\fR
+Start the editor instead of running the scene.
+.TP
+\fB\-p\fR, \fB\-\-project\-manager\fR
+Start the project manager, even if a project is auto\-detected.
+.TP
+\fB\-l\fR, \fB\-\-language\fR <locale>
+Use a specific locale (<locale> being a two\-letter code).
+.TP
+\fB\-\-path\fR <directory>
+Path to a project (<directory> must contain a 'project.godot' file).
+.TP
+\fB\-\-main\-pack\fR <file>
+Path to a pack (.pck) file to load.
+.TP
+\fB\-\-render\-thread\fR <mode>
+Render thread mode ('unsafe', 'safe', 'separate').
+.TP
+\fB\-\-remote\-fs\fR <address>
+Remote filesystem (<host/IP>[:<port>] address).
+.TP
+\fB\-\-remote\-fs\-password\fR <password>
+Password for remote filesystem.
+.TP
+\fB\-\-audio\-driver\fR <driver>
+Audio driver ('PulseAudio', 'ALSA').
+.TP
+\fB\-\-video\-driver\fR <driver>
+Video driver ('GLES3').
+.SS "Display options:"
+.TP
+\fB\-f\fR, \fB\-\-fullscreen\fR
+Request fullscreen mode.
+.TP
+\fB\-m\fR, \fB\-\-maximized\fR
+Request a maximized window.
+.TP
+\fB\-w\fR, \fB\-\-windowed\fR
+Request windowed mode.
+.TP
+\fB\-\-resolution\fR <W>x<H>
+Request window resolution.
+.TP
+\fB\-\-position\fR <X>,<Y>
+Request window position.
+.TP
+\fB\-\-low\-dpi\fR
+Force low\-DPI mode (macOS and Windows only).
+.TP
+\fB\-\-no\-window\fR
+Disable window creation (Windows only). Useful together with \fB\-\-script\fR.
+.SS "Debug options:"
+.TP
+\fB\-d\fR, \fB\-\-debug\fR
+Debug (local stdout debugger).
+.TP
+\fB\-b\fR, \fB\-\-breakpoints\fR
+Breakpoint list as source::line comma\-separated pairs, no spaces (use %20 instead).
+.TP
+\fB\-\-profiling\fR
+Enable profiling in the script debugger.
+.TP
+\fB\-\-remote\-debug\fR <address>
+Remote debug (<host/IP>:<port> address).
+.TP
+\fB\-\-debug\-collisions\fR
+Show collisions shapes when running the scene.
+.TP
+\fB\-\-debug\-navigation\fR
+Show navigation polygons when running the scene.
+.TP
+\fB\-\-frame\-delay\fR <ms>
+Simulate high CPU load (delay each frame by <ms> milliseconds).
+.TP
+\fB\-\-time\-scale\fR <scale>
+Force time scale (higher values are faster, 1.0 is normal speed).
+.TP
+\fB\-\-disable\-render\-loop\fR
+Disable render loop so rendering only occurs when called explicitly from script.
+.TP
+\fB\-\-disable\-crash\-handler\fR
+Disable crash handler when supported by the platform code.
+.TP
+\fB\-\-fixed\-fps\fR <fps>
+Force a fixed number of frames per second. This setting disables real\-time synchronization.
+.SS "Standalone tools:"
+.TP
+\fB\-s\fR, \fB\-\-script\fR <script>
+Run a script.
+.TP
+\fB\-\-export\fR <target>
+Export the project using the given export target.
+.TP
+\fB\-\-export\-debug\fR
+Use together with \fB\-\-export\fR, enables debug mode for the template.
+.TP
+\fB\-\-doctool\fR <path>
+Dump the engine API reference to the given <path> in XML format, merging if existing files are found.
+.TP
+\fB\-\-no\-docbase\fR
+Disallow dumping the base types (used with \fB\-\-doctool\fR).
+.TP
+\fB\-\-gdnative\-generate\-json\-api\fR
+Generate JSON dump of the Godot API for GDNative bindings.
+.TP
+\fB\-\-test\fR <test>
+Run a unit test ('string', 'containers', 'math', 'render', 'multimesh', 'gui', 'io', 'shaderlang', 'physics', 'oa_hash_map').
+.SH FILES
+~/.godot/
+.RS
+User\-specific configuration and cache folder, contains persistent editor and game configuration and saved files, temporary metadata, etc.
+.RE
+~/.godot/app_userdata/
+.RS
+Contains the default configuration and user data folders for Godot\-made games (\fIuser://\fR path).
+.RE
+~/.godot/templates/
+.RS
+Installation folder for "export templates", compiled binaries of the engine to deploy on the many supported platforms.
+.RE
+/usr/share/doc/godot/
+.RS
+Additional documentation files.
+.RE
+/usr/share/licenses/godot/
+.RS
+Detailed licensing information.
+.RE
+.SH "SEE ALSO"
+See the project website at \fIhttps://godotengine.org\fR and the source
+code repository at \fIhttps://github.com/godotengine/godot\fR for more details.
+.SH BUGS
+Godot Engine is a free and open source project and welcomes any kind of
+contributions. In particular, you can report issues or make suggestions on
+Godot's issue tracker at \fIhttps://github.com/godotengine/godot/issues\fR.
+.SH AUTHOR
+Man page written by Rémi Verschelde <akien@godotengine.org> on behalf of the
+Godot Engine development team.
diff --git a/misc/dist/linux/godot.appdata.xml b/misc/dist/linux/godot.appdata.xml
new file mode 100644
index 0000000000..907fe1f3be
--- /dev/null
+++ b/misc/dist/linux/godot.appdata.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright 2017 Rémi Verschelde <akien@godotengine.org> -->
+<component type="desktop">
+ <id>godot.desktop</id>
+ <metadata_license>CC0-1.0</metadata_license>
+ <project_license>MIT</project_license>
+ <name>Godot Engine</name>
+ <summary>Multi-platform 2D and 3D game engine with a feature-rich editor</summary>
+ <description>
+ <p>
+ Godot is an advanced, feature-packed, multi-platform 2D and 3D game
+ engine. It provides a huge set of common tools, so you can just focus on
+ making your game without reinventing the wheel.
+ </p>
+ <p>
+ Godot is completely free and open source under the very permissive MIT
+ license. No strings attached, no royalties, nothing. Your game is yours,
+ down to the last line of engine code.
+ </p>
+ </description>
+ <screenshots>
+ <screenshot type="default" width="1330" height="720">
+ <caption>3D project loaded in the Godot Engine editor</caption>
+ <image>https://download.tuxfamily.org/godotengine/media/screenshots/editor_3d_fracteed-720p.jpg</image>
+ </screenshot>
+ </screenshots>
+ <url type="homepage">https://godotengine.org</url>
+ <url type="bugtracker">https://github.com/godotengine/godot/issues</url>
+ <url type="help">http://docs.godotengine.org</url>
+ <url type="donation">https://godotengine.org/donate</url>
+ <url type="translate">https://hosted.weblate.org/projects/godot-engine/godot</url>
+ <developer_name>The Godot Engine Community</developer_name>
+ <update_contact>akien_at_godotengine_dot_org</update_contact>
+</component>
diff --git a/misc/dist/linux/godot.desktop b/misc/dist/linux/godot.desktop
new file mode 100644
index 0000000000..545c491256
--- /dev/null
+++ b/misc/dist/linux/godot.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=Godot Engine
+GenericName=Libre game engine
+Comment=Multi-platform 2D and 3D game engine with a feature rich editor
+Exec=godot -pm
+Icon=godot
+Terminal=false
+Type=Application
+Categories=Development;IDE;
diff --git a/misc/dist/osx_tools.app/Contents/Info.plist b/misc/dist/osx_tools.app/Contents/Info.plist
index 4d88e97503..5012d17c37 100755
--- a/misc/dist/osx_tools.app/Contents/Info.plist
+++ b/misc/dist/osx_tools.app/Contents/Info.plist
@@ -19,11 +19,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>2.2-dev</string>
+ <string>3.0-dev</string>
<key>CFBundleSignature</key>
<string>godot</string>
<key>CFBundleVersion</key>
- <string>2.2-dev</string>
+ <string>3.0-dev</string>
<key>NSHumanReadableCopyright</key>
<string>© 2007-2017 Juan Linietsky, Ariel Manzur</string>
<key>LSMinimumSystemVersion</key>
diff --git a/modules/enet/SCsub b/modules/enet/SCsub
index 42a933a66d..4790c5099f 100644
--- a/modules/enet/SCsub
+++ b/modules/enet/SCsub
@@ -7,7 +7,7 @@ Import('env_modules')
env_enet = env_modules.Clone()
-if (env['builtin_enet'] != 'no'):
+if env['builtin_enet']:
thirdparty_dir = "#thirdparty/enet/"
thirdparty_sources = [
"godot.cpp",
diff --git a/modules/etc/config.py b/modules/etc/config.py
index 4b0b01b78e..7dc2cb59c1 100644
--- a/modules/etc/config.py
+++ b/modules/etc/config.py
@@ -6,6 +6,6 @@ def can_build(platform):
def configure(env):
# Tools only, disabled for non-tools
# TODO: Find a cleaner way to achieve that
- if (env["tools"] == "no"):
- env["module_etc_enabled"] = "no"
+ if not env['tools']:
+ env['module_etc_enabled'] = False
env.disabled_modules.append("etc")
diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub
index f22df4407c..19e384af73 100644
--- a/modules/freetype/SCsub
+++ b/modules/freetype/SCsub
@@ -6,7 +6,7 @@ from compat import isbasestring
# Not building in a separate env as scene needs it
# Thirdparty source files
-if (env['builtin_freetype'] != 'no'):
+if env['builtin_freetype']:
thirdparty_dir = "#thirdparty/freetype/"
thirdparty_sources = [
"src/autofit/autofit.c",
@@ -65,7 +65,7 @@ if (env['builtin_freetype'] != 'no'):
env.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "/include"])
# also requires libpng headers
- if (env['builtin_libpng'] != 'no'):
+ if env['builtin_libpng']:
env.Append(CPPPATH=["#thirdparty/libpng"])
lib = env.Library("freetype_builtin", thirdparty_sources)
diff --git a/modules/gdnative/SCsub b/modules/gdnative/SCsub
index f386f2b542..6592d0ae1d 100644
--- a/modules/gdnative/SCsub
+++ b/modules/gdnative/SCsub
@@ -4,14 +4,149 @@ Import('env')
gdn_env = env.Clone()
-gdn_env.add_source_files(env.modules_sources, "*.cpp")
+gdn_env.add_source_files(env.modules_sources, "gd_native_library_editor.cpp")
+gdn_env.add_source_files(env.modules_sources, "gdnative.cpp")
+gdn_env.add_source_files(env.modules_sources, "register_types.cpp")
gdn_env.add_source_files(env.modules_sources, "gdnative/*.cpp")
gdn_env.add_source_files(env.modules_sources, "nativescript/*.cpp")
-gdn_env.Append(CPPFLAGS=['-DGDAPI_BUILT_IN'])
gdn_env.Append(CPPPATH=['#modules/gdnative/include/'])
-if "platform" in env and env["platform"] == "x11": # there has to be a better solution?
- env.Append(LINKFLAGS=["-rdynamic"])
+def _spaced(e):
+ return e if e[-1] == '*' else e + ' '
+
+def _build_gdnative_api_struct_header(api):
+ out = [
+ '/* THIS FILE IS GENERATED DO NOT EDIT */',
+ '#ifndef GODOT_GDNATIVE_API_STRUCT_H',
+ '#define GODOT_GDNATIVE_API_STRUCT_H',
+ '',
+ '#include <gdnative/gdnative.h>',
+ '#include <nativescript/godot_nativescript.h>',
+ '',
+ '#define GDNATIVE_API_INIT(options) do { extern const godot_gdnative_api_struct *_gdnative_wrapper_api_struct; _gdnative_wrapper_api_struct = options->api_struct; } while (0)',
+ '',
+ '#ifdef __cplusplus',
+ 'extern "C" {',
+ '#endif',
+ '',
+ 'typedef struct godot_gdnative_api_struct {',
+ '\tvoid *next;',
+ '\tconst char *version;',
+ ]
+
+ for funcdef in api['api']:
+ args = ', '.join(['%s%s' % (_spaced(t), n) for t, n in funcdef['arguments']])
+ out.append('\t%s(*%s)(%s);' % (_spaced(funcdef['return_type']), funcdef['name'], args))
+
+ out += [
+ '} godot_gdnative_api_struct;',
+ '',
+ '#ifdef __cplusplus',
+ '}',
+ '#endif',
+ '',
+ '#endif // GODOT_GDNATIVE_API_STRUCT_H',
+ ''
+ ]
+ return '\n'.join(out)
+
+def _build_gdnative_api_struct_source(api):
+ out = [
+ '/* THIS FILE IS GENERATED DO NOT EDIT */',
+ '',
+ '#include <gdnative_api_struct.gen.h>',
+ '',
+ 'const char *_gdnative_api_version = "%s";' % api['version'],
+ 'extern const godot_gdnative_api_struct api_struct = {',
+ '\tNULL,',
+ '\t_gdnative_api_version,',
+ ]
+
+ for funcdef in api['api']:
+ out.append('\t%s,' % funcdef['name'])
+ out.append('};\n')
+
+ return '\n'.join(out)
+
+def build_gdnative_api_struct(target, source, env):
+ import json
+ from collections import OrderedDict
+
+ with open(source[0].path, 'r') as fd:
+ api = json.load(fd)
+
+ header, source = target
+ with open(header.path, 'w') as fd:
+ fd.write(_build_gdnative_api_struct_header(api))
+ with open(source.path, 'w') as fd:
+ fd.write(_build_gdnative_api_struct_source(api))
+
+_, gensource = gdn_env.Command(['include/gdnative_api_struct.gen.h', 'gdnative_api_struct.gen.cpp'],
+ 'gdnative_api.json', build_gdnative_api_struct)
+gdn_env.add_source_files(env.modules_sources, [gensource])
env.use_ptrcall = True
+
+
+def _build_gdnative_wrapper_code(api):
+ out = [
+ '/* THIS FILE IS GENERATED DO NOT EDIT */',
+ '',
+ '#include <gdnative/gdnative.h>',
+ '#include <nativescript/godot_nativescript.h>',
+ '',
+ '#include <gdnative_api_struct.gen.h>',
+ '',
+ 'godot_gdnative_api_struct *_gdnative_wrapper_api_struct = 0;',
+ '',
+ '#ifdef __cplusplus',
+ 'extern "C" {',
+ '#endif',
+ ''
+ ]
+
+ for funcdef in api['api']:
+ args = ', '.join(['%s%s' % (_spaced(t), n) for t, n in funcdef['arguments']])
+ out.append('%s%s(%s) {' % (_spaced(funcdef['return_type']), funcdef['name'], args))
+
+ args = ', '.join(['%s' % n for t, n in funcdef['arguments']])
+
+ return_line = '\treturn ' if funcdef['return_type'] != 'void' else '\t'
+ return_line += '_gdnative_wrapper_api_struct->' + funcdef['name'] + '(' + args + ');'
+
+ out.append(return_line)
+ out.append('}')
+ out.append('')
+
+ out += [
+ '#ifdef __cplusplus',
+ '}',
+ '#endif'
+ ]
+
+ return '\n'.join(out)
+
+
+def build_gdnative_wrapper_code(target, source, env):
+ import json
+ with open(source[0].path, 'r') as fd:
+ api = json.load(fd)
+
+ wrapper_file = target[0]
+ with open(wrapper_file.path, 'w') as fd:
+ fd.write(_build_gdnative_wrapper_code(api))
+
+
+
+if ARGUMENTS.get('gdnative_wrapper', False):
+ #build wrapper code
+ gensource, = gdn_env.Command('gdnative_wrapper_code.gen.cpp', 'gdnative_api.json', build_gdnative_wrapper_code)
+
+ gd_wrapper_env = env.Clone()
+ gd_wrapper_env.Append(CPPPATH=['#modules/gdnative/include/'])
+
+ # I think this doesn't work on MSVC yet...
+ gd_wrapper_env.Append(CCFLAGS=['-fPIC'])
+
+ gd_wrapper_env.Library("#bin/gdnative_wrapper_code", [gensource])
diff --git a/modules/gdnative/gd_native_library_editor.cpp b/modules/gdnative/gd_native_library_editor.cpp
index cc2c2b69a6..c37b7f473d 100644
--- a/modules/gdnative/gd_native_library_editor.cpp
+++ b/modules/gdnative/gd_native_library_editor.cpp
@@ -72,7 +72,7 @@ void GDNativeLibraryEditor::_update_libraries() {
libraries->create_item(); //rppt
Vector<String> enabled_paths;
- if (ProjectSettings::get_singleton()->has("gdnative/singletons")) {
+ if (ProjectSettings::get_singleton()->has_setting("gdnative/singletons")) {
enabled_paths = ProjectSettings::get_singleton()->get("gdnative/singletons");
}
Set<String> enabled_list;
@@ -100,7 +100,7 @@ void GDNativeLibraryEditor::_item_edited() {
String path = item->get_metadata(0);
Vector<String> enabled_paths;
- if (ProjectSettings::get_singleton()->has("gdnative/singletons")) {
+ if (ProjectSettings::get_singleton()->has_setting("gdnative/singletons")) {
enabled_paths = ProjectSettings::get_singleton()->get("gdnative/singletons");
}
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index 93a9bac11c..373b98dc8b 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -40,15 +40,8 @@
const String init_symbol = "godot_gdnative_init";
const String terminate_symbol = "godot_gdnative_terminate";
-#define GDAPI_FUNC(name, ret_type, ...) name,
-#define GDAPI_FUNC_VOID(name, ...) name,
-
-const godot_gdnative_api_struct api_struct = {
- GODOT_GDNATIVE_API_FUNCTIONS
-};
-
-#undef GDAPI_FUNC
-#undef GDAPI_FUNC_VOID
+// Defined in gdnative_api_struct.gen.cpp
+extern const godot_gdnative_api_struct api_struct;
String GDNativeLibrary::platform_names[NUM_PLATFORMS + 1] = {
"X11_32bit",
@@ -110,6 +103,7 @@ GDNativeLibrary::~GDNativeLibrary() {
void GDNativeLibrary::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_library_path", "platform", "path"), &GDNativeLibrary::set_library_path);
ClassDB::bind_method(D_METHOD("get_library_path", "platform"), &GDNativeLibrary::get_library_path);
+ ClassDB::bind_method(D_METHOD("get_active_library_path"), &GDNativeLibrary::get_active_library_path);
ClassDB::bind_method(D_METHOD("is_singleton_gdnative"), &GDNativeLibrary::is_singleton_gdnative);
ClassDB::bind_method(D_METHOD("set_singleton_gdnative", "singleton"), &GDNativeLibrary::set_singleton_gdnative);
@@ -234,8 +228,11 @@ bool GDNative::initialize() {
ERR_PRINT("No library set for this platform");
return false;
}
-
+#ifdef IPHONE_ENABLED
+ String path = lib_path.replace("res://", "dylibs/");
+#else
String path = ProjectSettings::get_singleton()->globalize_path(lib_path);
+#endif
Error err = OS::get_singleton()->open_dynamic_library(path, native_handle);
if (err != OK) {
return false;
@@ -265,6 +262,7 @@ bool GDNative::initialize() {
options.editor_api_hash = ClassDB::get_api_hash(ClassDB::API_EDITOR);
options.no_api_hash = ClassDB::get_api_hash(ClassDB::API_NONE);
options.gd_native_library = (godot_object *)(get_library().ptr());
+ options.active_library_path = (godot_string *)&path;
library_init_fpointer(&options);
diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h
index 29c6201641..7bbad842eb 100644
--- a/modules/gdnative/gdnative.h
+++ b/modules/gdnative/gdnative.h
@@ -36,7 +36,7 @@
#include "resource.h"
#include "gdnative/gdnative.h"
-#include "gdnative_api_struct.h"
+#include "gdnative_api_struct.gen.h"
class GDNativeLibrary : public Resource {
GDCLASS(GDNativeLibrary, Resource)
diff --git a/modules/gdnative/gdnative/gdnative.cpp b/modules/gdnative/gdnative/gdnative.cpp
index cf1f6a4f16..64a7c33cf8 100644
--- a/modules/gdnative/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative/gdnative.cpp
@@ -41,6 +41,7 @@ extern "C" {
#endif
extern "C" void _string_api_anchor();
+extern "C" void _string_name_api_anchor();
extern "C" void _vector2_api_anchor();
extern "C" void _rect2_api_anchor();
extern "C" void _vector3_api_anchor();
@@ -61,6 +62,7 @@ extern "C" void _variant_api_anchor();
void _api_anchor() {
_string_api_anchor();
+ _string_name_api_anchor();
_vector2_api_anchor();
_rect2_api_anchor();
_vector3_api_anchor();
diff --git a/modules/gdnative/gdnative/string_name.cpp b/modules/gdnative/gdnative/string_name.cpp
new file mode 100644
index 0000000000..5c00fdfc2f
--- /dev/null
+++ b/modules/gdnative/gdnative/string_name.cpp
@@ -0,0 +1,91 @@
+/*************************************************************************/
+/* string_name.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "gdnative/string_name.h"
+
+#include "core/string_db.h"
+#include "core/ustring.h"
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _string_name_api_anchor() {
+}
+
+void GDAPI godot_string_name_new(godot_string_name *r_dest, const godot_string *p_name) {
+ StringName *dest = (StringName *)r_dest;
+ const String *name = (const String *)p_name;
+ memnew_placement(dest, StringName(*name));
+}
+
+void GDAPI godot_string_name_new_data(godot_string_name *r_dest, const char *p_name) {
+ StringName *dest = (StringName *)r_dest;
+ memnew_placement(dest, StringName(p_name));
+}
+
+godot_string GDAPI godot_string_name_get_name(const godot_string_name *p_self) {
+ godot_string ret;
+ const StringName *self = (const StringName *)p_self;
+ memnew_placement(&ret, String(*self));
+ return ret;
+}
+
+uint32_t GDAPI godot_string_name_get_hash(const godot_string_name *p_self) {
+ const StringName *self = (const StringName *)p_self;
+ return self->hash();
+}
+
+const void GDAPI *godot_string_name_get_data_unique_pointer(const godot_string_name *p_self) {
+ const StringName *self = (const StringName *)p_self;
+ return self->data_unique_pointer();
+}
+
+godot_bool GDAPI godot_string_name_operator_equal(const godot_string_name *p_self, const godot_string_name *p_other) {
+ const StringName *self = (const StringName *)p_self;
+ const StringName *other = (const StringName *)p_other;
+ return self == other;
+}
+
+godot_bool GDAPI godot_string_name_operator_less(const godot_string_name *p_self, const godot_string_name *p_other) {
+ const StringName *self = (const StringName *)p_self;
+ const StringName *other = (const StringName *)p_other;
+ return self < other;
+}
+
+void GDAPI godot_string_name_destroy(godot_string_name *p_self) {
+ StringName *self = (StringName *)p_self;
+ self->~StringName();
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json
new file mode 100644
index 0000000000..4d3c024a8f
--- /dev/null
+++ b/modules/gdnative/gdnative_api.json
@@ -0,0 +1,5234 @@
+{
+ "version": "1.0.0",
+ "api": [
+ {
+ "name": "godot_color_new_rgba",
+ "return_type": "void",
+ "arguments": [
+ ["godot_color *", "r_dest"],
+ ["const godot_real", "p_r"],
+ ["const godot_real", "p_g"],
+ ["const godot_real", "p_b"],
+ ["const godot_real", "p_a"]
+ ]
+ },
+ {
+ "name": "godot_color_new_rgb",
+ "return_type": "void",
+ "arguments": [
+ ["godot_color *", "r_dest"],
+ ["const godot_real", "p_r"],
+ ["const godot_real", "p_g"],
+ ["const godot_real", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_color_get_r",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_color *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_color_set_r",
+ "return_type": "void",
+ "arguments": [
+ ["godot_color *", "p_self"],
+ ["const godot_real", "r"]
+ ]
+ },
+ {
+ "name": "godot_color_get_g",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_color *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_color_set_g",
+ "return_type": "void",
+ "arguments": [
+ ["godot_color *", "p_self"],
+ ["const godot_real", "g"]
+ ]
+ },
+ {
+ "name": "godot_color_get_b",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_color *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_color_set_b",
+ "return_type": "void",
+ "arguments": [
+ ["godot_color *", "p_self"],
+ ["const godot_real", "b"]
+ ]
+ },
+ {
+ "name": "godot_color_get_a",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_color *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_color_set_a",
+ "return_type": "void",
+ "arguments": [
+ ["godot_color *", "p_self"],
+ ["const godot_real", "a"]
+ ]
+ },
+ {
+ "name": "godot_color_get_h",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_color *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_color_get_s",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_color *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_color_get_v",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_color *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_color_as_string",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_color *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_color_to_rgba32",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_color *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_color_to_argb32",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_color *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_color_gray",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_color *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_color_inverted",
+ "return_type": "godot_color",
+ "arguments": [
+ ["const godot_color *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_color_contrasted",
+ "return_type": "godot_color",
+ "arguments": [
+ ["const godot_color *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_color_linear_interpolate",
+ "return_type": "godot_color",
+ "arguments": [
+ ["const godot_color *", "p_self"],
+ ["const godot_color *", "p_b"],
+ ["const godot_real", "p_t"]
+ ]
+ },
+ {
+ "name": "godot_color_blend",
+ "return_type": "godot_color",
+ "arguments": [
+ ["const godot_color *", "p_self"],
+ ["const godot_color *", "p_over"]
+ ]
+ },
+ {
+ "name": "godot_color_to_html",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_color *", "p_self"],
+ ["const godot_bool", "p_with_alpha"]
+ ]
+ },
+ {
+ "name": "godot_color_operator_equal",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_color *", "p_self"],
+ ["const godot_color *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_color_operator_less",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_color *", "p_self"],
+ ["const godot_color *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_vector2_new",
+ "return_type": "void",
+ "arguments": [
+ ["godot_vector2 *", "r_dest"],
+ ["const godot_real", "p_x"],
+ ["const godot_real", "p_y"]
+ ]
+ },
+ {
+ "name": "godot_vector2_as_string",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_vector2_normalized",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_vector2_length",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_vector2_angle",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_vector2_length_squared",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_vector2_is_normalized",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_vector2_distance_to",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"],
+ ["const godot_vector2 *", "p_to"]
+ ]
+ },
+ {
+ "name": "godot_vector2_distance_squared_to",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"],
+ ["const godot_vector2 *", "p_to"]
+ ]
+ },
+ {
+ "name": "godot_vector2_angle_to",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"],
+ ["const godot_vector2 *", "p_to"]
+ ]
+ },
+ {
+ "name": "godot_vector2_angle_to_point",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"],
+ ["const godot_vector2 *", "p_to"]
+ ]
+ },
+ {
+ "name": "godot_vector2_linear_interpolate",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"],
+ ["const godot_vector2 *", "p_b"],
+ ["const godot_real", "p_t"]
+ ]
+ },
+ {
+ "name": "godot_vector2_cubic_interpolate",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"],
+ ["const godot_vector2 *", "p_b"],
+ ["const godot_vector2 *", "p_pre_a"],
+ ["const godot_vector2 *", "p_post_b"],
+ ["const godot_real", "p_t"]
+ ]
+ },
+ {
+ "name": "godot_vector2_rotated",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"],
+ ["const godot_real", "p_phi"]
+ ]
+ },
+ {
+ "name": "godot_vector2_tangent",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_vector2_floor",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_vector2_snapped",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"],
+ ["const godot_vector2 *", "p_by"]
+ ]
+ },
+ {
+ "name": "godot_vector2_aspect",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_vector2_dot",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"],
+ ["const godot_vector2 *", "p_with"]
+ ]
+ },
+ {
+ "name": "godot_vector2_slide",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"],
+ ["const godot_vector2 *", "p_n"]
+ ]
+ },
+ {
+ "name": "godot_vector2_bounce",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"],
+ ["const godot_vector2 *", "p_n"]
+ ]
+ },
+ {
+ "name": "godot_vector2_reflect",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"],
+ ["const godot_vector2 *", "p_n"]
+ ]
+ },
+ {
+ "name": "godot_vector2_abs",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_vector2_clamped",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"],
+ ["const godot_real", "p_length"]
+ ]
+ },
+ {
+ "name": "godot_vector2_operator_add",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"],
+ ["const godot_vector2 *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_vector2_operator_substract",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"],
+ ["const godot_vector2 *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_vector2_operator_multiply_vector",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"],
+ ["const godot_vector2 *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_vector2_operator_multiply_scalar",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"],
+ ["const godot_real", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_vector2_operator_divide_vector",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"],
+ ["const godot_vector2 *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_vector2_operator_divide_scalar",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"],
+ ["const godot_real", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_vector2_operator_equal",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"],
+ ["const godot_vector2 *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_vector2_operator_less",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"],
+ ["const godot_vector2 *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_vector2_operator_neg",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_vector2_set_x",
+ "return_type": "void",
+ "arguments": [
+ ["godot_vector2 *", "p_self"],
+ ["const godot_real", "p_x"]
+ ]
+ },
+ {
+ "name": "godot_vector2_set_y",
+ "return_type": "void",
+ "arguments": [
+ ["godot_vector2 *", "p_self"],
+ ["const godot_real", "p_y"]
+ ]
+ },
+ {
+ "name": "godot_vector2_get_x",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_vector2_get_y",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_vector2 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_quat_new",
+ "return_type": "void",
+ "arguments": [
+ ["godot_quat *", "r_dest"],
+ ["const godot_real", "p_x"],
+ ["const godot_real", "p_y"],
+ ["const godot_real", "p_z"],
+ ["const godot_real", "p_w"]
+ ]
+ },
+ {
+ "name": "godot_quat_new_with_axis_angle",
+ "return_type": "void",
+ "arguments": [
+ ["godot_quat *", "r_dest"],
+ ["const godot_vector3 *", "p_axis"],
+ ["const godot_real", "p_angle"]
+ ]
+ },
+ {
+ "name": "godot_quat_get_x",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_quat *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_quat_set_x",
+ "return_type": "void",
+ "arguments": [
+ ["godot_quat *", "p_self"],
+ ["const godot_real", "val"]
+ ]
+ },
+ {
+ "name": "godot_quat_get_y",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_quat *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_quat_set_y",
+ "return_type": "void",
+ "arguments": [
+ ["godot_quat *", "p_self"],
+ ["const godot_real", "val"]
+ ]
+ },
+ {
+ "name": "godot_quat_get_z",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_quat *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_quat_set_z",
+ "return_type": "void",
+ "arguments": [
+ ["godot_quat *", "p_self"],
+ ["const godot_real", "val"]
+ ]
+ },
+ {
+ "name": "godot_quat_get_w",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_quat *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_quat_set_w",
+ "return_type": "void",
+ "arguments": [
+ ["godot_quat *", "p_self"],
+ ["const godot_real", "val"]
+ ]
+ },
+ {
+ "name": "godot_quat_as_string",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_quat *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_quat_length",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_quat *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_quat_length_squared",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_quat *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_quat_normalized",
+ "return_type": "godot_quat",
+ "arguments": [
+ ["const godot_quat *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_quat_is_normalized",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_quat *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_quat_inverse",
+ "return_type": "godot_quat",
+ "arguments": [
+ ["const godot_quat *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_quat_dot",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_quat *", "p_self"],
+ ["const godot_quat *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_quat_xform",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_quat *", "p_self"],
+ ["const godot_vector3 *", "p_v"]
+ ]
+ },
+ {
+ "name": "godot_quat_slerp",
+ "return_type": "godot_quat",
+ "arguments": [
+ ["const godot_quat *", "p_self"],
+ ["const godot_quat *", "p_b"],
+ ["const godot_real", "p_t"]
+ ]
+ },
+ {
+ "name": "godot_quat_slerpni",
+ "return_type": "godot_quat",
+ "arguments": [
+ ["const godot_quat *", "p_self"],
+ ["const godot_quat *", "p_b"],
+ ["const godot_real", "p_t"]
+ ]
+ },
+ {
+ "name": "godot_quat_cubic_slerp",
+ "return_type": "godot_quat",
+ "arguments": [
+ ["const godot_quat *", "p_self"],
+ ["const godot_quat *", "p_b"],
+ ["const godot_quat *", "p_pre_a"],
+ ["const godot_quat *", "p_post_b"],
+ ["const godot_real", "p_t"]
+ ]
+ },
+ {
+ "name": "godot_quat_operator_multiply",
+ "return_type": "godot_quat",
+ "arguments": [
+ ["const godot_quat *", "p_self"],
+ ["const godot_real", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_quat_operator_add",
+ "return_type": "godot_quat",
+ "arguments": [
+ ["const godot_quat *", "p_self"],
+ ["const godot_quat *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_quat_operator_substract",
+ "return_type": "godot_quat",
+ "arguments": [
+ ["const godot_quat *", "p_self"],
+ ["const godot_quat *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_quat_operator_divide",
+ "return_type": "godot_quat",
+ "arguments": [
+ ["const godot_quat *", "p_self"],
+ ["const godot_real", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_quat_operator_equal",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_quat *", "p_self"],
+ ["const godot_quat *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_quat_operator_neg",
+ "return_type": "godot_quat",
+ "arguments": [
+ ["const godot_quat *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_basis_new_with_rows",
+ "return_type": "void",
+ "arguments": [
+ ["godot_basis *", "r_dest"],
+ ["const godot_vector3 *", "p_x_axis"],
+ ["const godot_vector3 *", "p_y_axis"],
+ ["const godot_vector3 *", "p_z_axis"]
+ ]
+ },
+ {
+ "name": "godot_basis_new_with_axis_and_angle",
+ "return_type": "void",
+ "arguments": [
+ ["godot_basis *", "r_dest"],
+ ["const godot_vector3 *", "p_axis"],
+ ["const godot_real", "p_phi"]
+ ]
+ },
+ {
+ "name": "godot_basis_new_with_euler",
+ "return_type": "void",
+ "arguments": [
+ ["godot_basis *", "r_dest"],
+ ["const godot_vector3 *", "p_euler"]
+ ]
+ },
+ {
+ "name": "godot_basis_as_string",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_basis *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_basis_inverse",
+ "return_type": "godot_basis",
+ "arguments": [
+ ["const godot_basis *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_basis_transposed",
+ "return_type": "godot_basis",
+ "arguments": [
+ ["const godot_basis *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_basis_orthonormalized",
+ "return_type": "godot_basis",
+ "arguments": [
+ ["const godot_basis *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_basis_determinant",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_basis *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_basis_rotated",
+ "return_type": "godot_basis",
+ "arguments": [
+ ["const godot_basis *", "p_self"],
+ ["const godot_vector3 *", "p_axis"],
+ ["const godot_real", "p_phi"]
+ ]
+ },
+ {
+ "name": "godot_basis_scaled",
+ "return_type": "godot_basis",
+ "arguments": [
+ ["const godot_basis *", "p_self"],
+ ["const godot_vector3 *", "p_scale"]
+ ]
+ },
+ {
+ "name": "godot_basis_get_scale",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_basis *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_basis_get_euler",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_basis *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_basis_tdotx",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_basis *", "p_self"],
+ ["const godot_vector3 *", "p_with"]
+ ]
+ },
+ {
+ "name": "godot_basis_tdoty",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_basis *", "p_self"],
+ ["const godot_vector3 *", "p_with"]
+ ]
+ },
+ {
+ "name": "godot_basis_tdotz",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_basis *", "p_self"],
+ ["const godot_vector3 *", "p_with"]
+ ]
+ },
+ {
+ "name": "godot_basis_xform",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_basis *", "p_self"],
+ ["const godot_vector3 *", "p_v"]
+ ]
+ },
+ {
+ "name": "godot_basis_xform_inv",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_basis *", "p_self"],
+ ["const godot_vector3 *", "p_v"]
+ ]
+ },
+ {
+ "name": "godot_basis_get_orthogonal_index",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_basis *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_basis_new",
+ "return_type": "void",
+ "arguments": [
+ ["godot_basis *", "r_dest"]
+ ]
+ },
+ {
+ "name": "godot_basis_new_with_euler_quat",
+ "return_type": "void",
+ "arguments": [
+ ["godot_basis *", "r_dest"],
+ ["const godot_quat *", "p_euler"]
+ ]
+ },
+ {
+ "name": "godot_basis_get_elements",
+ "return_type": "void",
+ "arguments": [
+ ["godot_basis *", "p_self"],
+ ["godot_vector3 *", "p_elements"]
+ ]
+ },
+ {
+ "name": "godot_basis_get_axis",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_basis *", "p_self"],
+ ["const godot_int", "p_axis"]
+ ]
+ },
+ {
+ "name": "godot_basis_set_axis",
+ "return_type": "void",
+ "arguments": [
+ ["godot_basis *", "p_self"],
+ ["const godot_int", "p_axis"],
+ ["const godot_vector3 *", "p_value"]
+ ]
+ },
+ {
+ "name": "godot_basis_get_row",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_basis *", "p_self"],
+ ["const godot_int", "p_row"]
+ ]
+ },
+ {
+ "name": "godot_basis_set_row",
+ "return_type": "void",
+ "arguments": [
+ ["godot_basis *", "p_self"],
+ ["const godot_int", "p_row"],
+ ["const godot_vector3 *", "p_value"]
+ ]
+ },
+ {
+ "name": "godot_basis_operator_equal",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_basis *", "p_self"],
+ ["const godot_basis *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_basis_operator_add",
+ "return_type": "godot_basis",
+ "arguments": [
+ ["const godot_basis *", "p_self"],
+ ["const godot_basis *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_basis_operator_substract",
+ "return_type": "godot_basis",
+ "arguments": [
+ ["const godot_basis *", "p_self"],
+ ["const godot_basis *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_basis_operator_multiply_vector",
+ "return_type": "godot_basis",
+ "arguments": [
+ ["const godot_basis *", "p_self"],
+ ["const godot_basis *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_basis_operator_multiply_scalar",
+ "return_type": "godot_basis",
+ "arguments": [
+ ["const godot_basis *", "p_self"],
+ ["const godot_real", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_vector3_new",
+ "return_type": "void",
+ "arguments": [
+ ["godot_vector3 *", "r_dest"],
+ ["const godot_real", "p_x"],
+ ["const godot_real", "p_y"],
+ ["const godot_real", "p_z"]
+ ]
+ },
+ {
+ "name": "godot_vector3_as_string",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_vector3_min_axis",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_vector3_max_axis",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_vector3_length",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_vector3_length_squared",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_vector3_is_normalized",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_vector3_normalized",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_vector3_inverse",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_vector3_snapped",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"],
+ ["const godot_vector3 *", "p_by"]
+ ]
+ },
+ {
+ "name": "godot_vector3_rotated",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"],
+ ["const godot_vector3 *", "p_axis"],
+ ["const godot_real", "p_phi"]
+ ]
+ },
+ {
+ "name": "godot_vector3_linear_interpolate",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"],
+ ["const godot_vector3 *", "p_b"],
+ ["const godot_real", "p_t"]
+ ]
+ },
+ {
+ "name": "godot_vector3_cubic_interpolate",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"],
+ ["const godot_vector3 *", "p_b"],
+ ["const godot_vector3 *", "p_pre_a"],
+ ["const godot_vector3 *", "p_post_b"],
+ ["const godot_real", "p_t"]
+ ]
+ },
+ {
+ "name": "godot_vector3_dot",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"],
+ ["const godot_vector3 *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_vector3_cross",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"],
+ ["const godot_vector3 *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_vector3_outer",
+ "return_type": "godot_basis",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"],
+ ["const godot_vector3 *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_vector3_to_diagonal_matrix",
+ "return_type": "godot_basis",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_vector3_abs",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_vector3_floor",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_vector3_ceil",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_vector3_distance_to",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"],
+ ["const godot_vector3 *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_vector3_distance_squared_to",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"],
+ ["const godot_vector3 *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_vector3_angle_to",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"],
+ ["const godot_vector3 *", "p_to"]
+ ]
+ },
+ {
+ "name": "godot_vector3_slide",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"],
+ ["const godot_vector3 *", "p_n"]
+ ]
+ },
+ {
+ "name": "godot_vector3_bounce",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"],
+ ["const godot_vector3 *", "p_n"]
+ ]
+ },
+ {
+ "name": "godot_vector3_reflect",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"],
+ ["const godot_vector3 *", "p_n"]
+ ]
+ },
+ {
+ "name": "godot_vector3_operator_add",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"],
+ ["const godot_vector3 *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_vector3_operator_substract",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"],
+ ["const godot_vector3 *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_vector3_operator_multiply_vector",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"],
+ ["const godot_vector3 *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_vector3_operator_multiply_scalar",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"],
+ ["const godot_real", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_vector3_operator_divide_vector",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"],
+ ["const godot_vector3 *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_vector3_operator_divide_scalar",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"],
+ ["const godot_real", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_vector3_operator_equal",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"],
+ ["const godot_vector3 *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_vector3_operator_less",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"],
+ ["const godot_vector3 *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_vector3_operator_neg",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_vector3_set_axis",
+ "return_type": "void",
+ "arguments": [
+ ["godot_vector3 *", "p_self"],
+ ["const godot_vector3_axis", "p_axis"],
+ ["const godot_real", "p_val"]
+ ]
+ },
+ {
+ "name": "godot_vector3_get_axis",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_vector3 *", "p_self"],
+ ["const godot_vector3_axis", "p_axis"]
+ ]
+ },
+ {
+ "name": "godot_pool_byte_array_new",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_byte_array *", "r_dest"]
+ ]
+ },
+ {
+ "name": "godot_pool_byte_array_new_copy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_byte_array *", "r_dest"],
+ ["const godot_pool_byte_array *", "p_src"]
+ ]
+ },
+ {
+ "name": "godot_pool_byte_array_new_with_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_byte_array *", "r_dest"],
+ ["const godot_array *", "p_a"]
+ ]
+ },
+ {
+ "name": "godot_pool_byte_array_append",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_byte_array *", "p_self"],
+ ["const uint8_t", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_byte_array_append_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_byte_array *", "p_self"],
+ ["const godot_pool_byte_array *", "p_array"]
+ ]
+ },
+ {
+ "name": "godot_pool_byte_array_insert",
+ "return_type": "godot_error",
+ "arguments": [
+ ["godot_pool_byte_array *", "p_self"],
+ ["const godot_int", "p_idx"],
+ ["const uint8_t", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_byte_array_invert",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_byte_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_pool_byte_array_push_back",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_byte_array *", "p_self"],
+ ["const uint8_t", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_byte_array_remove",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_byte_array *", "p_self"],
+ ["const godot_int", "p_idx"]
+ ]
+ },
+ {
+ "name": "godot_pool_byte_array_resize",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_byte_array *", "p_self"],
+ ["const godot_int", "p_size"]
+ ]
+ },
+ {
+ "name": "godot_pool_byte_array_set",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_byte_array *", "p_self"],
+ ["const godot_int", "p_idx"],
+ ["const uint8_t", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_byte_array_get",
+ "return_type": "uint8_t",
+ "arguments": [
+ ["const godot_pool_byte_array *", "p_self"],
+ ["const godot_int", "p_idx"]
+ ]
+ },
+ {
+ "name": "godot_pool_byte_array_size",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_pool_byte_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_pool_byte_array_destroy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_byte_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_pool_int_array_new",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_int_array *", "r_dest"]
+ ]
+ },
+ {
+ "name": "godot_pool_int_array_new_copy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_int_array *", "r_dest"],
+ ["const godot_pool_int_array *", "p_src"]
+ ]
+ },
+ {
+ "name": "godot_pool_int_array_new_with_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_int_array *", "r_dest"],
+ ["const godot_array *", "p_a"]
+ ]
+ },
+ {
+ "name": "godot_pool_int_array_append",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_int_array *", "p_self"],
+ ["const godot_int", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_int_array_append_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_int_array *", "p_self"],
+ ["const godot_pool_int_array *", "p_array"]
+ ]
+ },
+ {
+ "name": "godot_pool_int_array_insert",
+ "return_type": "godot_error",
+ "arguments": [
+ ["godot_pool_int_array *", "p_self"],
+ ["const godot_int", "p_idx"],
+ ["const godot_int", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_int_array_invert",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_int_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_pool_int_array_push_back",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_int_array *", "p_self"],
+ ["const godot_int", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_int_array_remove",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_int_array *", "p_self"],
+ ["const godot_int", "p_idx"]
+ ]
+ },
+ {
+ "name": "godot_pool_int_array_resize",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_int_array *", "p_self"],
+ ["const godot_int", "p_size"]
+ ]
+ },
+ {
+ "name": "godot_pool_int_array_set",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_int_array *", "p_self"],
+ ["const godot_int", "p_idx"],
+ ["const godot_int", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_int_array_get",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_pool_int_array *", "p_self"],
+ ["const godot_int", "p_idx"]
+ ]
+ },
+ {
+ "name": "godot_pool_int_array_size",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_pool_int_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_pool_int_array_destroy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_int_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_pool_real_array_new",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_real_array *", "r_dest"]
+ ]
+ },
+ {
+ "name": "godot_pool_real_array_new_copy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_real_array *", "r_dest"],
+ ["const godot_pool_real_array *", "p_src"]
+ ]
+ },
+ {
+ "name": "godot_pool_real_array_new_with_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_real_array *", "r_dest"],
+ ["const godot_array *", "p_a"]
+ ]
+ },
+ {
+ "name": "godot_pool_real_array_append",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_real_array *", "p_self"],
+ ["const godot_real", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_real_array_append_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_real_array *", "p_self"],
+ ["const godot_pool_real_array *", "p_array"]
+ ]
+ },
+ {
+ "name": "godot_pool_real_array_insert",
+ "return_type": "godot_error",
+ "arguments": [
+ ["godot_pool_real_array *", "p_self"],
+ ["const godot_int", "p_idx"],
+ ["const godot_real", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_real_array_invert",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_real_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_pool_real_array_push_back",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_real_array *", "p_self"],
+ ["const godot_real", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_real_array_remove",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_real_array *", "p_self"],
+ ["const godot_int", "p_idx"]
+ ]
+ },
+ {
+ "name": "godot_pool_real_array_resize",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_real_array *", "p_self"],
+ ["const godot_int", "p_size"]
+ ]
+ },
+ {
+ "name": "godot_pool_real_array_set",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_real_array *", "p_self"],
+ ["const godot_int", "p_idx"],
+ ["const godot_real", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_real_array_get",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_pool_real_array *", "p_self"],
+ ["const godot_int", "p_idx"]
+ ]
+ },
+ {
+ "name": "godot_pool_real_array_size",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_pool_real_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_pool_real_array_destroy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_real_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_pool_string_array_new",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_string_array *", "r_dest"]
+ ]
+ },
+ {
+ "name": "godot_pool_string_array_new_copy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_string_array *", "r_dest"],
+ ["const godot_pool_string_array *", "p_src"]
+ ]
+ },
+ {
+ "name": "godot_pool_string_array_new_with_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_string_array *", "r_dest"],
+ ["const godot_array *", "p_a"]
+ ]
+ },
+ {
+ "name": "godot_pool_string_array_append",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_string_array *", "p_self"],
+ ["const godot_string *", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_string_array_append_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_string_array *", "p_self"],
+ ["const godot_pool_string_array *", "p_array"]
+ ]
+ },
+ {
+ "name": "godot_pool_string_array_insert",
+ "return_type": "godot_error",
+ "arguments": [
+ ["godot_pool_string_array *", "p_self"],
+ ["const godot_int", "p_idx"],
+ ["const godot_string *", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_string_array_invert",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_string_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_pool_string_array_push_back",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_string_array *", "p_self"],
+ ["const godot_string *", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_string_array_remove",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_string_array *", "p_self"],
+ ["const godot_int", "p_idx"]
+ ]
+ },
+ {
+ "name": "godot_pool_string_array_resize",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_string_array *", "p_self"],
+ ["const godot_int", "p_size"]
+ ]
+ },
+ {
+ "name": "godot_pool_string_array_set",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_string_array *", "p_self"],
+ ["const godot_int", "p_idx"],
+ ["const godot_string *", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_string_array_get",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_pool_string_array *", "p_self"],
+ ["const godot_int", "p_idx"]
+ ]
+ },
+ {
+ "name": "godot_pool_string_array_size",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_pool_string_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_pool_string_array_destroy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_string_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector2_array_new",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_vector2_array *", "r_dest"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector2_array_new_copy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_vector2_array *", "r_dest"],
+ ["const godot_pool_vector2_array *", "p_src"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector2_array_new_with_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_vector2_array *", "r_dest"],
+ ["const godot_array *", "p_a"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector2_array_append",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_vector2_array *", "p_self"],
+ ["const godot_vector2 *", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector2_array_append_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_vector2_array *", "p_self"],
+ ["const godot_pool_vector2_array *", "p_array"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector2_array_insert",
+ "return_type": "godot_error",
+ "arguments": [
+ ["godot_pool_vector2_array *", "p_self"],
+ ["const godot_int", "p_idx"],
+ ["const godot_vector2 *", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector2_array_invert",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_vector2_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector2_array_push_back",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_vector2_array *", "p_self"],
+ ["const godot_vector2 *", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector2_array_remove",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_vector2_array *", "p_self"],
+ ["const godot_int", "p_idx"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector2_array_resize",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_vector2_array *", "p_self"],
+ ["const godot_int", "p_size"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector2_array_set",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_vector2_array *", "p_self"],
+ ["const godot_int", "p_idx"],
+ ["const godot_vector2 *", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector2_array_get",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_pool_vector2_array *", "p_self"],
+ ["const godot_int", "p_idx"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector2_array_size",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_pool_vector2_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector2_array_destroy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_vector2_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector3_array_new",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_vector3_array *", "r_dest"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector3_array_new_copy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_vector3_array *", "r_dest"],
+ ["const godot_pool_vector3_array *", "p_src"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector3_array_new_with_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_vector3_array *", "r_dest"],
+ ["const godot_array *", "p_a"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector3_array_append",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_vector3_array *", "p_self"],
+ ["const godot_vector3 *", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector3_array_append_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_vector3_array *", "p_self"],
+ ["const godot_pool_vector3_array *", "p_array"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector3_array_insert",
+ "return_type": "godot_error",
+ "arguments": [
+ ["godot_pool_vector3_array *", "p_self"],
+ ["const godot_int", "p_idx"],
+ ["const godot_vector3 *", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector3_array_invert",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_vector3_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector3_array_push_back",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_vector3_array *", "p_self"],
+ ["const godot_vector3 *", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector3_array_remove",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_vector3_array *", "p_self"],
+ ["const godot_int", "p_idx"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector3_array_resize",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_vector3_array *", "p_self"],
+ ["const godot_int", "p_size"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector3_array_set",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_vector3_array *", "p_self"],
+ ["const godot_int", "p_idx"],
+ ["const godot_vector3 *", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector3_array_get",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_pool_vector3_array *", "p_self"],
+ ["const godot_int", "p_idx"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector3_array_size",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_pool_vector3_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_pool_vector3_array_destroy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_vector3_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_pool_color_array_new",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_color_array *", "r_dest"]
+ ]
+ },
+ {
+ "name": "godot_pool_color_array_new_copy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_color_array *", "r_dest"],
+ ["const godot_pool_color_array *", "p_src"]
+ ]
+ },
+ {
+ "name": "godot_pool_color_array_new_with_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_color_array *", "r_dest"],
+ ["const godot_array *", "p_a"]
+ ]
+ },
+ {
+ "name": "godot_pool_color_array_append",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_color_array *", "p_self"],
+ ["const godot_color *", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_color_array_append_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_color_array *", "p_self"],
+ ["const godot_pool_color_array *", "p_array"]
+ ]
+ },
+ {
+ "name": "godot_pool_color_array_insert",
+ "return_type": "godot_error",
+ "arguments": [
+ ["godot_pool_color_array *", "p_self"],
+ ["const godot_int", "p_idx"],
+ ["const godot_color *", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_color_array_invert",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_color_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_pool_color_array_push_back",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_color_array *", "p_self"],
+ ["const godot_color *", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_color_array_remove",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_color_array *", "p_self"],
+ ["const godot_int", "p_idx"]
+ ]
+ },
+ {
+ "name": "godot_pool_color_array_resize",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_color_array *", "p_self"],
+ ["const godot_int", "p_size"]
+ ]
+ },
+ {
+ "name": "godot_pool_color_array_set",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_color_array *", "p_self"],
+ ["const godot_int", "p_idx"],
+ ["const godot_color *", "p_data"]
+ ]
+ },
+ {
+ "name": "godot_pool_color_array_get",
+ "return_type": "godot_color",
+ "arguments": [
+ ["const godot_pool_color_array *", "p_self"],
+ ["const godot_int", "p_idx"]
+ ]
+ },
+ {
+ "name": "godot_pool_color_array_size",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_pool_color_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_pool_color_array_destroy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_pool_color_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_array_new",
+ "return_type": "void",
+ "arguments": [
+ ["godot_array *", "r_dest"]
+ ]
+ },
+ {
+ "name": "godot_array_new_copy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_array *", "r_dest"],
+ ["const godot_array *", "p_src"]
+ ]
+ },
+ {
+ "name": "godot_array_new_pool_color_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_array *", "r_dest"],
+ ["const godot_pool_color_array *", "p_pca"]
+ ]
+ },
+ {
+ "name": "godot_array_new_pool_vector3_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_array *", "r_dest"],
+ ["const godot_pool_vector3_array *", "p_pv3a"]
+ ]
+ },
+ {
+ "name": "godot_array_new_pool_vector2_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_array *", "r_dest"],
+ ["const godot_pool_vector2_array *", "p_pv2a"]
+ ]
+ },
+ {
+ "name": "godot_array_new_pool_string_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_array *", "r_dest"],
+ ["const godot_pool_string_array *", "p_psa"]
+ ]
+ },
+ {
+ "name": "godot_array_new_pool_real_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_array *", "r_dest"],
+ ["const godot_pool_real_array *", "p_pra"]
+ ]
+ },
+ {
+ "name": "godot_array_new_pool_int_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_array *", "r_dest"],
+ ["const godot_pool_int_array *", "p_pia"]
+ ]
+ },
+ {
+ "name": "godot_array_new_pool_byte_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_array *", "r_dest"],
+ ["const godot_pool_byte_array *", "p_pba"]
+ ]
+ },
+ {
+ "name": "godot_array_set",
+ "return_type": "void",
+ "arguments": [
+ ["godot_array *", "p_self"],
+ ["const godot_int", "p_idx"],
+ ["const godot_variant *", "p_value"]
+ ]
+ },
+ {
+ "name": "godot_array_get",
+ "return_type": "godot_variant",
+ "arguments": [
+ ["const godot_array *", "p_self"],
+ ["const godot_int", "p_idx"]
+ ]
+ },
+ {
+ "name": "godot_array_operator_index",
+ "return_type": "godot_variant *",
+ "arguments": [
+ ["godot_array *", "p_self"],
+ ["const godot_int", "p_idx"]
+ ]
+ },
+ {
+ "name": "godot_array_append",
+ "return_type": "void",
+ "arguments": [
+ ["godot_array *", "p_self"],
+ ["const godot_variant *", "p_value"]
+ ]
+ },
+ {
+ "name": "godot_array_clear",
+ "return_type": "void",
+ "arguments": [
+ ["godot_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_array_count",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_array *", "p_self"],
+ ["const godot_variant *", "p_value"]
+ ]
+ },
+ {
+ "name": "godot_array_empty",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_array_erase",
+ "return_type": "void",
+ "arguments": [
+ ["godot_array *", "p_self"],
+ ["const godot_variant *", "p_value"]
+ ]
+ },
+ {
+ "name": "godot_array_front",
+ "return_type": "godot_variant",
+ "arguments": [
+ ["const godot_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_array_back",
+ "return_type": "godot_variant",
+ "arguments": [
+ ["const godot_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_array_find",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_array *", "p_self"],
+ ["const godot_variant *", "p_what"],
+ ["const godot_int", "p_from"]
+ ]
+ },
+ {
+ "name": "godot_array_find_last",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_array *", "p_self"],
+ ["const godot_variant *", "p_what"]
+ ]
+ },
+ {
+ "name": "godot_array_has",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_array *", "p_self"],
+ ["const godot_variant *", "p_value"]
+ ]
+ },
+ {
+ "name": "godot_array_hash",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_array_insert",
+ "return_type": "void",
+ "arguments": [
+ ["godot_array *", "p_self"],
+ ["const godot_int", "p_pos"],
+ ["const godot_variant *", "p_value"]
+ ]
+ },
+ {
+ "name": "godot_array_invert",
+ "return_type": "void",
+ "arguments": [
+ ["godot_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_array_pop_back",
+ "return_type": "godot_variant",
+ "arguments": [
+ ["godot_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_array_pop_front",
+ "return_type": "godot_variant",
+ "arguments": [
+ ["godot_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_array_push_back",
+ "return_type": "void",
+ "arguments": [
+ ["godot_array *", "p_self"],
+ ["const godot_variant *", "p_value"]
+ ]
+ },
+ {
+ "name": "godot_array_push_front",
+ "return_type": "void",
+ "arguments": [
+ ["godot_array *", "p_self"],
+ ["const godot_variant *", "p_value"]
+ ]
+ },
+ {
+ "name": "godot_array_remove",
+ "return_type": "void",
+ "arguments": [
+ ["godot_array *", "p_self"],
+ ["const godot_int", "p_idx"]
+ ]
+ },
+ {
+ "name": "godot_array_resize",
+ "return_type": "void",
+ "arguments": [
+ ["godot_array *", "p_self"],
+ ["const godot_int", "p_size"]
+ ]
+ },
+ {
+ "name": "godot_array_rfind",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_array *", "p_self"],
+ ["const godot_variant *", "p_what"],
+ ["const godot_int", "p_from"]
+ ]
+ },
+ {
+ "name": "godot_array_size",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_array_sort",
+ "return_type": "void",
+ "arguments": [
+ ["godot_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_array_sort_custom",
+ "return_type": "void",
+ "arguments": [
+ ["godot_array *", "p_self"],
+ ["godot_object *", "p_obj"],
+ ["const godot_string *", "p_func"]
+ ]
+ },
+ {
+ "name": "godot_array_destroy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_dictionary_new",
+ "return_type": "void",
+ "arguments": [
+ ["godot_dictionary *", "r_dest"]
+ ]
+ },
+ {
+ "name": "godot_dictionary_new_copy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_dictionary *", "r_dest"],
+ ["const godot_dictionary *", "p_src"]
+ ]
+ },
+ {
+ "name": "godot_dictionary_destroy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_dictionary *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_dictionary_size",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_dictionary *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_dictionary_empty",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_dictionary *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_dictionary_clear",
+ "return_type": "void",
+ "arguments": [
+ ["godot_dictionary *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_dictionary_has",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_dictionary *", "p_self"],
+ ["const godot_variant *", "p_key"]
+ ]
+ },
+ {
+ "name": "godot_dictionary_has_all",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_dictionary *", "p_self"],
+ ["const godot_array *", "p_keys"]
+ ]
+ },
+ {
+ "name": "godot_dictionary_erase",
+ "return_type": "void",
+ "arguments": [
+ ["godot_dictionary *", "p_self"],
+ ["const godot_variant *", "p_key"]
+ ]
+ },
+ {
+ "name": "godot_dictionary_hash",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_dictionary *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_dictionary_keys",
+ "return_type": "godot_array",
+ "arguments": [
+ ["const godot_dictionary *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_dictionary_values",
+ "return_type": "godot_array",
+ "arguments": [
+ ["const godot_dictionary *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_dictionary_get",
+ "return_type": "godot_variant",
+ "arguments": [
+ ["const godot_dictionary *", "p_self"],
+ ["const godot_variant *", "p_key"]
+ ]
+ },
+ {
+ "name": "godot_dictionary_set",
+ "return_type": "void",
+ "arguments": [
+ ["godot_dictionary *", "p_self"],
+ ["const godot_variant *", "p_key"],
+ ["const godot_variant *", "p_value"]
+ ]
+ },
+ {
+ "name": "godot_dictionary_operator_index",
+ "return_type": "godot_variant *",
+ "arguments": [
+ ["godot_dictionary *", "p_self"],
+ ["const godot_variant *", "p_key"]
+ ]
+ },
+ {
+ "name": "godot_dictionary_next",
+ "return_type": "godot_variant *",
+ "arguments": [
+ ["const godot_dictionary *", "p_self"],
+ ["const godot_variant *", "p_key"]
+ ]
+ },
+ {
+ "name": "godot_dictionary_operator_equal",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_dictionary *", "p_self"],
+ ["const godot_dictionary *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_dictionary_to_json",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_dictionary *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_node_path_new",
+ "return_type": "void",
+ "arguments": [
+ ["godot_node_path *", "r_dest"],
+ ["const godot_string *", "p_from"]
+ ]
+ },
+ {
+ "name": "godot_node_path_new_copy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_node_path *", "r_dest"],
+ ["const godot_node_path *", "p_src"]
+ ]
+ },
+ {
+ "name": "godot_node_path_destroy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_node_path *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_node_path_as_string",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_node_path *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_node_path_is_absolute",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_node_path *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_node_path_get_name_count",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_node_path *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_node_path_get_name",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_node_path *", "p_self"],
+ ["const godot_int", "p_idx"]
+ ]
+ },
+ {
+ "name": "godot_node_path_get_subname_count",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_node_path *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_node_path_get_subname",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_node_path *", "p_self"],
+ ["const godot_int", "p_idx"]
+ ]
+ },
+ {
+ "name": "godot_node_path_get_property",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_node_path *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_node_path_is_empty",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_node_path *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_node_path_operator_equal",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_node_path *", "p_self"],
+ ["const godot_node_path *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_plane_new_with_reals",
+ "return_type": "void",
+ "arguments": [
+ ["godot_plane *", "r_dest"],
+ ["const godot_real", "p_a"],
+ ["const godot_real", "p_b"],
+ ["const godot_real", "p_c"],
+ ["const godot_real", "p_d"]
+ ]
+ },
+ {
+ "name": "godot_plane_new_with_vectors",
+ "return_type": "void",
+ "arguments": [
+ ["godot_plane *", "r_dest"],
+ ["const godot_vector3 *", "p_v1"],
+ ["const godot_vector3 *", "p_v2"],
+ ["const godot_vector3 *", "p_v3"]
+ ]
+ },
+ {
+ "name": "godot_plane_new_with_normal",
+ "return_type": "void",
+ "arguments": [
+ ["godot_plane *", "r_dest"],
+ ["const godot_vector3 *", "p_normal"],
+ ["const godot_real", "p_d"]
+ ]
+ },
+ {
+ "name": "godot_plane_as_string",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_plane *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_plane_normalized",
+ "return_type": "godot_plane",
+ "arguments": [
+ ["const godot_plane *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_plane_center",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_plane *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_plane_get_any_point",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_plane *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_plane_is_point_over",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_plane *", "p_self"],
+ ["const godot_vector3 *", "p_point"]
+ ]
+ },
+ {
+ "name": "godot_plane_distance_to",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_plane *", "p_self"],
+ ["const godot_vector3 *", "p_point"]
+ ]
+ },
+ {
+ "name": "godot_plane_has_point",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_plane *", "p_self"],
+ ["const godot_vector3 *", "p_point"],
+ ["const godot_real", "p_epsilon"]
+ ]
+ },
+ {
+ "name": "godot_plane_project",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_plane *", "p_self"],
+ ["const godot_vector3 *", "p_point"]
+ ]
+ },
+ {
+ "name": "godot_plane_intersect_3",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_plane *", "p_self"],
+ ["godot_vector3 *", "r_dest"],
+ ["const godot_plane *", "p_b"],
+ ["const godot_plane *", "p_c"]
+ ]
+ },
+ {
+ "name": "godot_plane_intersects_ray",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_plane *", "p_self"],
+ ["godot_vector3 *", "r_dest"],
+ ["const godot_vector3 *", "p_from"],
+ ["const godot_vector3 *", "p_dir"]
+ ]
+ },
+ {
+ "name": "godot_plane_intersects_segment",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_plane *", "p_self"],
+ ["godot_vector3 *", "r_dest"],
+ ["const godot_vector3 *", "p_begin"],
+ ["const godot_vector3 *", "p_end"]
+ ]
+ },
+ {
+ "name": "godot_plane_operator_neg",
+ "return_type": "godot_plane",
+ "arguments": [
+ ["const godot_plane *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_plane_operator_equal",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_plane *", "p_self"],
+ ["const godot_plane *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_plane_set_normal",
+ "return_type": "void",
+ "arguments": [
+ ["godot_plane *", "p_self"],
+ ["const godot_vector3 *", "p_normal"]
+ ]
+ },
+ {
+ "name": "godot_plane_get_normal",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_plane *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_plane_get_d",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_plane *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_plane_set_d",
+ "return_type": "void",
+ "arguments": [
+ ["godot_plane *", "p_self"],
+ ["const godot_real", "p_d"]
+ ]
+ },
+ {
+ "name": "godot_rect2_new_with_position_and_size",
+ "return_type": "void",
+ "arguments": [
+ ["godot_rect2 *", "r_dest"],
+ ["const godot_vector2 *", "p_pos"],
+ ["const godot_vector2 *", "p_size"]
+ ]
+ },
+ {
+ "name": "godot_rect2_new",
+ "return_type": "void",
+ "arguments": [
+ ["godot_rect2 *", "r_dest"],
+ ["const godot_real", "p_x"],
+ ["const godot_real", "p_y"],
+ ["const godot_real", "p_width"],
+ ["const godot_real", "p_height"]
+ ]
+ },
+ {
+ "name": "godot_rect2_as_string",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_rect2 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_rect2_get_area",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_rect2 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_rect2_intersects",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_rect2 *", "p_self"],
+ ["const godot_rect2 *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_rect2_encloses",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_rect2 *", "p_self"],
+ ["const godot_rect2 *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_rect2_has_no_area",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_rect2 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_rect2_clip",
+ "return_type": "godot_rect2",
+ "arguments": [
+ ["const godot_rect2 *", "p_self"],
+ ["const godot_rect2 *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_rect2_merge",
+ "return_type": "godot_rect2",
+ "arguments": [
+ ["const godot_rect2 *", "p_self"],
+ ["const godot_rect2 *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_rect2_has_point",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_rect2 *", "p_self"],
+ ["const godot_vector2 *", "p_point"]
+ ]
+ },
+ {
+ "name": "godot_rect2_grow",
+ "return_type": "godot_rect2",
+ "arguments": [
+ ["const godot_rect2 *", "p_self"],
+ ["const godot_real", "p_by"]
+ ]
+ },
+ {
+ "name": "godot_rect2_expand",
+ "return_type": "godot_rect2",
+ "arguments": [
+ ["const godot_rect2 *", "p_self"],
+ ["const godot_vector2 *", "p_to"]
+ ]
+ },
+ {
+ "name": "godot_rect2_operator_equal",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_rect2 *", "p_self"],
+ ["const godot_rect2 *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_rect2_get_position",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_rect2 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_rect2_get_size",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_rect2 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_rect2_set_position",
+ "return_type": "void",
+ "arguments": [
+ ["godot_rect2 *", "p_self"],
+ ["const godot_vector2 *", "p_pos"]
+ ]
+ },
+ {
+ "name": "godot_rect2_set_size",
+ "return_type": "void",
+ "arguments": [
+ ["godot_rect2 *", "p_self"],
+ ["const godot_vector2 *", "p_size"]
+ ]
+ },
+ {
+ "name": "godot_rect3_new",
+ "return_type": "void",
+ "arguments": [
+ ["godot_rect3 *", "r_dest"],
+ ["const godot_vector3 *", "p_pos"],
+ ["const godot_vector3 *", "p_size"]
+ ]
+ },
+ {
+ "name": "godot_rect3_get_position",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_rect3_set_position",
+ "return_type": "void",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"],
+ ["const godot_vector3 *", "p_v"]
+ ]
+ },
+ {
+ "name": "godot_rect3_get_size",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_rect3_set_size",
+ "return_type": "void",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"],
+ ["const godot_vector3 *", "p_v"]
+ ]
+ },
+ {
+ "name": "godot_rect3_as_string",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_rect3_get_area",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_rect3_has_no_area",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_rect3_has_no_surface",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_rect3_intersects",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"],
+ ["const godot_rect3 *", "p_with"]
+ ]
+ },
+ {
+ "name": "godot_rect3_encloses",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"],
+ ["const godot_rect3 *", "p_with"]
+ ]
+ },
+ {
+ "name": "godot_rect3_merge",
+ "return_type": "godot_rect3",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"],
+ ["const godot_rect3 *", "p_with"]
+ ]
+ },
+ {
+ "name": "godot_rect3_intersection",
+ "return_type": "godot_rect3",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"],
+ ["const godot_rect3 *", "p_with"]
+ ]
+ },
+ {
+ "name": "godot_rect3_intersects_plane",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"],
+ ["const godot_plane *", "p_plane"]
+ ]
+ },
+ {
+ "name": "godot_rect3_intersects_segment",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"],
+ ["const godot_vector3 *", "p_from"],
+ ["const godot_vector3 *", "p_to"]
+ ]
+ },
+ {
+ "name": "godot_rect3_has_point",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"],
+ ["const godot_vector3 *", "p_point"]
+ ]
+ },
+ {
+ "name": "godot_rect3_get_support",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"],
+ ["const godot_vector3 *", "p_dir"]
+ ]
+ },
+ {
+ "name": "godot_rect3_get_longest_axis",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_rect3_get_longest_axis_index",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_rect3_get_longest_axis_size",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_rect3_get_shortest_axis",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_rect3_get_shortest_axis_index",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_rect3_get_shortest_axis_size",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_rect3_expand",
+ "return_type": "godot_rect3",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"],
+ ["const godot_vector3 *", "p_to_point"]
+ ]
+ },
+ {
+ "name": "godot_rect3_grow",
+ "return_type": "godot_rect3",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"],
+ ["const godot_real", "p_by"]
+ ]
+ },
+ {
+ "name": "godot_rect3_get_endpoint",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"],
+ ["const godot_int", "p_idx"]
+ ]
+ },
+ {
+ "name": "godot_rect3_operator_equal",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_rect3 *", "p_self"],
+ ["const godot_rect3 *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_rid_new",
+ "return_type": "void",
+ "arguments": [
+ ["godot_rid *", "r_dest"]
+ ]
+ },
+ {
+ "name": "godot_rid_get_id",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_rid *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_rid_new_with_resource",
+ "return_type": "void",
+ "arguments": [
+ ["godot_rid *", "r_dest"],
+ ["const godot_object *", "p_from"]
+ ]
+ },
+ {
+ "name": "godot_rid_operator_equal",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_rid *", "p_self"],
+ ["const godot_rid *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_rid_operator_less",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_rid *", "p_self"],
+ ["const godot_rid *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_transform_new_with_axis_origin",
+ "return_type": "void",
+ "arguments": [
+ ["godot_transform *", "r_dest"],
+ ["const godot_vector3 *", "p_x_axis"],
+ ["const godot_vector3 *", "p_y_axis"],
+ ["const godot_vector3 *", "p_z_axis"],
+ ["const godot_vector3 *", "p_origin"]
+ ]
+ },
+ {
+ "name": "godot_transform_new",
+ "return_type": "void",
+ "arguments": [
+ ["godot_transform *", "r_dest"],
+ ["const godot_basis *", "p_basis"],
+ ["const godot_vector3 *", "p_origin"]
+ ]
+ },
+ {
+ "name": "godot_transform_get_basis",
+ "return_type": "godot_basis",
+ "arguments": [
+ ["const godot_transform *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_transform_set_basis",
+ "return_type": "void",
+ "arguments": [
+ ["godot_transform *", "p_self"],
+ ["godot_basis *", "p_v"]
+ ]
+ },
+ {
+ "name": "godot_transform_get_origin",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_transform *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_transform_set_origin",
+ "return_type": "void",
+ "arguments": [
+ ["godot_transform *", "p_self"],
+ ["godot_vector3 *", "p_v"]
+ ]
+ },
+ {
+ "name": "godot_transform_as_string",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_transform *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_transform_inverse",
+ "return_type": "godot_transform",
+ "arguments": [
+ ["const godot_transform *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_transform_affine_inverse",
+ "return_type": "godot_transform",
+ "arguments": [
+ ["const godot_transform *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_transform_orthonormalized",
+ "return_type": "godot_transform",
+ "arguments": [
+ ["const godot_transform *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_transform_rotated",
+ "return_type": "godot_transform",
+ "arguments": [
+ ["const godot_transform *", "p_self"],
+ ["const godot_vector3 *", "p_axis"],
+ ["const godot_real", "p_phi"]
+ ]
+ },
+ {
+ "name": "godot_transform_scaled",
+ "return_type": "godot_transform",
+ "arguments": [
+ ["const godot_transform *", "p_self"],
+ ["const godot_vector3 *", "p_scale"]
+ ]
+ },
+ {
+ "name": "godot_transform_translated",
+ "return_type": "godot_transform",
+ "arguments": [
+ ["const godot_transform *", "p_self"],
+ ["const godot_vector3 *", "p_ofs"]
+ ]
+ },
+ {
+ "name": "godot_transform_looking_at",
+ "return_type": "godot_transform",
+ "arguments": [
+ ["const godot_transform *", "p_self"],
+ ["const godot_vector3 *", "p_target"],
+ ["const godot_vector3 *", "p_up"]
+ ]
+ },
+ {
+ "name": "godot_transform_xform_plane",
+ "return_type": "godot_plane",
+ "arguments": [
+ ["const godot_transform *", "p_self"],
+ ["const godot_plane *", "p_v"]
+ ]
+ },
+ {
+ "name": "godot_transform_xform_inv_plane",
+ "return_type": "godot_plane",
+ "arguments": [
+ ["const godot_transform *", "p_self"],
+ ["const godot_plane *", "p_v"]
+ ]
+ },
+ {
+ "name": "godot_transform_new_identity",
+ "return_type": "void",
+ "arguments": [
+ ["godot_transform *", "r_dest"]
+ ]
+ },
+ {
+ "name": "godot_transform_operator_equal",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_transform *", "p_self"],
+ ["const godot_transform *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_transform_operator_multiply",
+ "return_type": "godot_transform",
+ "arguments": [
+ ["const godot_transform *", "p_self"],
+ ["const godot_transform *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_transform_xform_vector3",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_transform *", "p_self"],
+ ["const godot_vector3 *", "p_v"]
+ ]
+ },
+ {
+ "name": "godot_transform_xform_inv_vector3",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_transform *", "p_self"],
+ ["const godot_vector3 *", "p_v"]
+ ]
+ },
+ {
+ "name": "godot_transform_xform_rect3",
+ "return_type": "godot_rect3",
+ "arguments": [
+ ["const godot_transform *", "p_self"],
+ ["const godot_rect3 *", "p_v"]
+ ]
+ },
+ {
+ "name": "godot_transform_xform_inv_rect3",
+ "return_type": "godot_rect3",
+ "arguments": [
+ ["const godot_transform *", "p_self"],
+ ["const godot_rect3 *", "p_v"]
+ ]
+ },
+ {
+ "name": "godot_transform2d_new",
+ "return_type": "void",
+ "arguments": [
+ ["godot_transform2d *", "r_dest"],
+ ["const godot_real", "p_rot"],
+ ["const godot_vector2 *", "p_pos"]
+ ]
+ },
+ {
+ "name": "godot_transform2d_new_axis_origin",
+ "return_type": "void",
+ "arguments": [
+ ["godot_transform2d *", "r_dest"],
+ ["const godot_vector2 *", "p_x_axis"],
+ ["const godot_vector2 *", "p_y_axis"],
+ ["const godot_vector2 *", "p_origin"]
+ ]
+ },
+ {
+ "name": "godot_transform2d_as_string",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_transform2d *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_transform2d_inverse",
+ "return_type": "godot_transform2d",
+ "arguments": [
+ ["const godot_transform2d *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_transform2d_affine_inverse",
+ "return_type": "godot_transform2d",
+ "arguments": [
+ ["const godot_transform2d *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_transform2d_get_rotation",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_transform2d *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_transform2d_get_origin",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_transform2d *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_transform2d_get_scale",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_transform2d *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_transform2d_orthonormalized",
+ "return_type": "godot_transform2d",
+ "arguments": [
+ ["const godot_transform2d *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_transform2d_rotated",
+ "return_type": "godot_transform2d",
+ "arguments": [
+ ["const godot_transform2d *", "p_self"],
+ ["const godot_real", "p_phi"]
+ ]
+ },
+ {
+ "name": "godot_transform2d_scaled",
+ "return_type": "godot_transform2d",
+ "arguments": [
+ ["const godot_transform2d *", "p_self"],
+ ["const godot_vector2 *", "p_scale"]
+ ]
+ },
+ {
+ "name": "godot_transform2d_translated",
+ "return_type": "godot_transform2d",
+ "arguments": [
+ ["const godot_transform2d *", "p_self"],
+ ["const godot_vector2 *", "p_offset"]
+ ]
+ },
+ {
+ "name": "godot_transform2d_xform_vector2",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_transform2d *", "p_self"],
+ ["const godot_vector2 *", "p_v"]
+ ]
+ },
+ {
+ "name": "godot_transform2d_xform_inv_vector2",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_transform2d *", "p_self"],
+ ["const godot_vector2 *", "p_v"]
+ ]
+ },
+ {
+ "name": "godot_transform2d_basis_xform_vector2",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_transform2d *", "p_self"],
+ ["const godot_vector2 *", "p_v"]
+ ]
+ },
+ {
+ "name": "godot_transform2d_basis_xform_inv_vector2",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_transform2d *", "p_self"],
+ ["const godot_vector2 *", "p_v"]
+ ]
+ },
+ {
+ "name": "godot_transform2d_interpolate_with",
+ "return_type": "godot_transform2d",
+ "arguments": [
+ ["const godot_transform2d *", "p_self"],
+ ["const godot_transform2d *", "p_m"],
+ ["const godot_real", "p_c"]
+ ]
+ },
+ {
+ "name": "godot_transform2d_operator_equal",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_transform2d *", "p_self"],
+ ["const godot_transform2d *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_transform2d_operator_multiply",
+ "return_type": "godot_transform2d",
+ "arguments": [
+ ["const godot_transform2d *", "p_self"],
+ ["const godot_transform2d *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_transform2d_new_identity",
+ "return_type": "void",
+ "arguments": [
+ ["godot_transform2d *", "r_dest"]
+ ]
+ },
+ {
+ "name": "godot_transform2d_xform_rect2",
+ "return_type": "godot_rect2",
+ "arguments": [
+ ["const godot_transform2d *", "p_self"],
+ ["const godot_rect2 *", "p_v"]
+ ]
+ },
+ {
+ "name": "godot_transform2d_xform_inv_rect2",
+ "return_type": "godot_rect2",
+ "arguments": [
+ ["const godot_transform2d *", "p_self"],
+ ["const godot_rect2 *", "p_v"]
+ ]
+ },
+ {
+ "name": "godot_variant_get_type",
+ "return_type": "godot_variant_type",
+ "arguments": [
+ ["const godot_variant *", "p_v"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_copy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const godot_variant *", "p_src"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_nil",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_bool",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "p_v"],
+ ["const godot_bool", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_uint",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const uint64_t", "p_i"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_int",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const int64_t", "p_i"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_real",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const double", "p_r"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_string",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const godot_string *", "p_s"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_vector2",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const godot_vector2 *", "p_v2"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_rect2",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const godot_rect2 *", "p_rect2"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_vector3",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const godot_vector3 *", "p_v3"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_transform2d",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const godot_transform2d *", "p_t2d"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_plane",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const godot_plane *", "p_plane"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_quat",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const godot_quat *", "p_quat"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_rect3",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const godot_rect3 *", "p_rect3"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_basis",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const godot_basis *", "p_basis"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_transform",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const godot_transform *", "p_trans"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_color",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const godot_color *", "p_color"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_node_path",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const godot_node_path *", "p_np"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_rid",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const godot_rid *", "p_rid"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_object",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const godot_object *", "p_obj"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_dictionary",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const godot_dictionary *", "p_dict"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const godot_array *", "p_arr"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_pool_byte_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const godot_pool_byte_array *", "p_pba"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_pool_int_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const godot_pool_int_array *", "p_pia"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_pool_real_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const godot_pool_real_array *", "p_pra"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_pool_string_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const godot_pool_string_array *", "p_psa"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_pool_vector2_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const godot_pool_vector2_array *", "p_pv2a"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_pool_vector3_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const godot_pool_vector3_array *", "p_pv3a"]
+ ]
+ },
+ {
+ "name": "godot_variant_new_pool_color_array",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "r_dest"],
+ ["const godot_pool_color_array *", "p_pca"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_bool",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_uint",
+ "return_type": "uint64_t",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_int",
+ "return_type": "int64_t",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_real",
+ "return_type": "double",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_string",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_vector2",
+ "return_type": "godot_vector2",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_rect2",
+ "return_type": "godot_rect2",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_vector3",
+ "return_type": "godot_vector3",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_transform2d",
+ "return_type": "godot_transform2d",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_plane",
+ "return_type": "godot_plane",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_quat",
+ "return_type": "godot_quat",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_rect3",
+ "return_type": "godot_rect3",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_basis",
+ "return_type": "godot_basis",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_transform",
+ "return_type": "godot_transform",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_color",
+ "return_type": "godot_color",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_node_path",
+ "return_type": "godot_node_path",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_rid",
+ "return_type": "godot_rid",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_object",
+ "return_type": "godot_object *",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_dictionary",
+ "return_type": "godot_dictionary",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_array",
+ "return_type": "godot_array",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_pool_byte_array",
+ "return_type": "godot_pool_byte_array",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_pool_int_array",
+ "return_type": "godot_pool_int_array",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_pool_real_array",
+ "return_type": "godot_pool_real_array",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_pool_string_array",
+ "return_type": "godot_pool_string_array",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_pool_vector2_array",
+ "return_type": "godot_pool_vector2_array",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_pool_vector3_array",
+ "return_type": "godot_pool_vector3_array",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_as_pool_color_array",
+ "return_type": "godot_pool_color_array",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_call",
+ "return_type": "godot_variant",
+ "arguments": [
+ ["godot_variant *", "p_self"],
+ ["const godot_string *", "p_method"],
+ ["const godot_variant **", "p_args"],
+ ["const godot_int", "p_argcount"],
+ ["godot_variant_call_error *", "r_error"]
+ ]
+ },
+ {
+ "name": "godot_variant_has_method",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_variant *", "p_self"],
+ ["const godot_string *", "p_method"]
+ ]
+ },
+ {
+ "name": "godot_variant_operator_equal",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_variant *", "p_self"],
+ ["const godot_variant *", "p_other"]
+ ]
+ },
+ {
+ "name": "godot_variant_operator_less",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_variant *", "p_self"],
+ ["const godot_variant *", "p_other"]
+ ]
+ },
+ {
+ "name": "godot_variant_hash_compare",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_variant *", "p_self"],
+ ["const godot_variant *", "p_other"]
+ ]
+ },
+ {
+ "name": "godot_variant_booleanize",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_variant_destroy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_new",
+ "return_type": "void",
+ "arguments": [
+ ["godot_string *", "r_dest"]
+ ]
+ },
+ {
+ "name": "godot_string_new_copy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_string *", "r_dest"],
+ ["const godot_string *", "p_src"]
+ ]
+ },
+ {
+ "name": "godot_string_new_data",
+ "return_type": "void",
+ "arguments": [
+ ["godot_string *", "r_dest"],
+ ["const char *", "p_contents"],
+ ["const int", "p_size"]
+ ]
+ },
+ {
+ "name": "godot_string_new_unicode_data",
+ "return_type": "void",
+ "arguments": [
+ ["godot_string *", "r_dest"],
+ ["const wchar_t *", "p_contents"],
+ ["const int", "p_size"]
+ ]
+ },
+ {
+ "name": "godot_string_get_data",
+ "return_type": "void",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["char *", "p_dest"],
+ ["int *", "p_size"]
+ ]
+ },
+ {
+ "name": "godot_string_operator_index",
+ "return_type": "wchar_t *",
+ "arguments": [
+ ["godot_string *", "p_self"],
+ ["const godot_int", "p_idx"]
+ ]
+ },
+ {
+ "name": "godot_string_c_str",
+ "return_type": "const char *",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_unicode_str",
+ "return_type": "const wchar_t *",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_operator_equal",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_string *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_string_operator_less",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_string *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_string_operator_plus",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_string *", "p_b"]
+ ]
+ },
+ {
+ "name": "godot_string_length",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_begins_with",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_string *", "p_string"]
+ ]
+ },
+ {
+ "name": "godot_string_begins_with_char_array",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const char *", "p_char_array"]
+ ]
+ },
+ {
+ "name": "godot_string_bigrams",
+ "return_type": "godot_array",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_chr",
+ "return_type": "godot_string",
+ "arguments": [
+ ["wchar_t", "p_character"]
+ ]
+ },
+ {
+ "name": "godot_string_ends_with",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_string *", "p_string"]
+ ]
+ },
+ {
+ "name": "godot_string_find",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_string", "p_what"]
+ ]
+ },
+ {
+ "name": "godot_string_find_from",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_string", "p_what"],
+ ["godot_int", "p_from"]
+ ]
+ },
+ {
+ "name": "godot_string_findmk",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_array *", "p_keys"]
+ ]
+ },
+ {
+ "name": "godot_string_findmk_from",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_array *", "p_keys"],
+ ["godot_int", "p_from"]
+ ]
+ },
+ {
+ "name": "godot_string_findmk_from_in_place",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_array *", "p_keys"],
+ ["godot_int", "p_from"],
+ ["godot_int *", "r_key"]
+ ]
+ },
+ {
+ "name": "godot_string_findn",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_string", "p_what"]
+ ]
+ },
+ {
+ "name": "godot_string_findn_from",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_string", "p_what"],
+ ["godot_int", "p_from"]
+ ]
+ },
+ {
+ "name": "godot_string_find_last",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_string", "p_what"]
+ ]
+ },
+ {
+ "name": "godot_string_format",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_variant *", "p_values"]
+ ]
+ },
+ {
+ "name": "godot_string_format_with_custom_placeholder",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_variant *", "p_values"],
+ ["const char *", "p_placeholder"]
+ ]
+ },
+ {
+ "name": "godot_string_hex_encode_buffer",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const uint8_t *", "p_buffer"],
+ ["godot_int", "p_len"]
+ ]
+ },
+ {
+ "name": "godot_string_hex_to_int",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_hex_to_int_without_prefix",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_insert",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_int", "p_at_pos"],
+ ["godot_string", "p_string"]
+ ]
+ },
+ {
+ "name": "godot_string_is_numeric",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_is_subsequence_of",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_string *", "p_string"]
+ ]
+ },
+ {
+ "name": "godot_string_is_subsequence_ofi",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_string *", "p_string"]
+ ]
+ },
+ {
+ "name": "godot_string_lpad",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_int", "p_min_length"]
+ ]
+ },
+ {
+ "name": "godot_string_lpad_with_custom_character",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_int", "p_min_length"],
+ ["const godot_string *", "p_character"]
+ ]
+ },
+ {
+ "name": "godot_string_match",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_string *", "p_wildcard"]
+ ]
+ },
+ {
+ "name": "godot_string_matchn",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_string *", "p_wildcard"]
+ ]
+ },
+ {
+ "name": "godot_string_md5",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const uint8_t *", "p_md5"]
+ ]
+ },
+ {
+ "name": "godot_string_num",
+ "return_type": "godot_string",
+ "arguments": [
+ ["double", "p_num"]
+ ]
+ },
+ {
+ "name": "godot_string_num_int64",
+ "return_type": "godot_string",
+ "arguments": [
+ ["int64_t", "p_num"],
+ ["godot_int", "p_base"]
+ ]
+ },
+ {
+ "name": "godot_string_num_int64_capitalized",
+ "return_type": "godot_string",
+ "arguments": [
+ ["int64_t", "p_num"],
+ ["godot_int", "p_base"],
+ ["godot_bool", "p_capitalize_hex"]
+ ]
+ },
+ {
+ "name": "godot_string_num_real",
+ "return_type": "godot_string",
+ "arguments": [
+ ["double", "p_num"]
+ ]
+ },
+ {
+ "name": "godot_string_num_scientific",
+ "return_type": "godot_string",
+ "arguments": [
+ ["double", "p_num"]
+ ]
+ },
+ {
+ "name": "godot_string_num_with_decimals",
+ "return_type": "godot_string",
+ "arguments": [
+ ["double", "p_num"],
+ ["godot_int", "p_decimals"]
+ ]
+ },
+ {
+ "name": "godot_string_pad_decimals",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_int", "p_digits"]
+ ]
+ },
+ {
+ "name": "godot_string_pad_zeros",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_int", "p_digits"]
+ ]
+ },
+ {
+ "name": "godot_string_replace_first",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_string", "p_key"],
+ ["godot_string", "p_with"]
+ ]
+ },
+ {
+ "name": "godot_string_replace",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_string", "p_key"],
+ ["godot_string", "p_with"]
+ ]
+ },
+ {
+ "name": "godot_string_replacen",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_string", "p_key"],
+ ["godot_string", "p_with"]
+ ]
+ },
+ {
+ "name": "godot_string_rfind",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_string", "p_what"]
+ ]
+ },
+ {
+ "name": "godot_string_rfindn",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_string", "p_what"]
+ ]
+ },
+ {
+ "name": "godot_string_rfind_from",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_string", "p_what"],
+ ["godot_int", "p_from"]
+ ]
+ },
+ {
+ "name": "godot_string_rfindn_from",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_string", "p_what"],
+ ["godot_int", "p_from"]
+ ]
+ },
+ {
+ "name": "godot_string_rpad",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_int", "p_min_length"]
+ ]
+ },
+ {
+ "name": "godot_string_rpad_with_custom_character",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_int", "p_min_length"],
+ ["const godot_string *", "p_character"]
+ ]
+ },
+ {
+ "name": "godot_string_similarity",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_string *", "p_string"]
+ ]
+ },
+ {
+ "name": "godot_string_sprintf",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_array *", "p_values"],
+ ["godot_bool *", "p_error"]
+ ]
+ },
+ {
+ "name": "godot_string_substr",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_int", "p_from"],
+ ["godot_int", "p_chars"]
+ ]
+ },
+ {
+ "name": "godot_string_to_double",
+ "return_type": "double",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_to_float",
+ "return_type": "godot_real",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_to_int",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_camelcase_to_underscore",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_camelcase_to_underscore_lowercased",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_capitalize",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_char_to_double",
+ "return_type": "double",
+ "arguments": [
+ ["const char *", "p_what"]
+ ]
+ },
+ {
+ "name": "godot_string_char_to_int",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const char *", "p_what"]
+ ]
+ },
+ {
+ "name": "godot_string_wchar_to_int",
+ "return_type": "int64_t",
+ "arguments": [
+ ["const wchar_t *", "p_str"]
+ ]
+ },
+ {
+ "name": "godot_string_char_to_int_with_len",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const char *", "p_what"],
+ ["godot_int", "p_len"]
+ ]
+ },
+ {
+ "name": "godot_string_char_to_int64_with_len",
+ "return_type": "int64_t",
+ "arguments": [
+ ["const wchar_t *", "p_str"],
+ ["int", "p_len"]
+ ]
+ },
+ {
+ "name": "godot_string_hex_to_int64",
+ "return_type": "int64_t",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_hex_to_int64_with_prefix",
+ "return_type": "int64_t",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_to_int64",
+ "return_type": "int64_t",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_unicode_char_to_double",
+ "return_type": "double",
+ "arguments": [
+ ["const wchar_t *", "p_str"],
+ ["const wchar_t **", "r_end"]
+ ]
+ },
+ {
+ "name": "godot_string_get_slice_count",
+ "return_type": "godot_int",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_string", "p_splitter"]
+ ]
+ },
+ {
+ "name": "godot_string_get_slice",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_string", "p_splitter"],
+ ["godot_int", "p_slice"]
+ ]
+ },
+ {
+ "name": "godot_string_get_slicec",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["wchar_t", "p_splitter"],
+ ["godot_int", "p_slice"]
+ ]
+ },
+ {
+ "name": "godot_string_split",
+ "return_type": "godot_array",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_string *", "p_splitter"]
+ ]
+ },
+ {
+ "name": "godot_string_split_allow_empty",
+ "return_type": "godot_array",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_string *", "p_splitter"]
+ ]
+ },
+ {
+ "name": "godot_string_split_floats",
+ "return_type": "godot_array",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_string *", "p_splitter"]
+ ]
+ },
+ {
+ "name": "godot_string_split_floats_allows_empty",
+ "return_type": "godot_array",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_string *", "p_splitter"]
+ ]
+ },
+ {
+ "name": "godot_string_split_floats_mk",
+ "return_type": "godot_array",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_array *", "p_splitters"]
+ ]
+ },
+ {
+ "name": "godot_string_split_floats_mk_allows_empty",
+ "return_type": "godot_array",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_array *", "p_splitters"]
+ ]
+ },
+ {
+ "name": "godot_string_split_ints",
+ "return_type": "godot_array",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_string *", "p_splitter"]
+ ]
+ },
+ {
+ "name": "godot_string_split_ints_allows_empty",
+ "return_type": "godot_array",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_string *", "p_splitter"]
+ ]
+ },
+ {
+ "name": "godot_string_split_ints_mk",
+ "return_type": "godot_array",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_array *", "p_splitters"]
+ ]
+ },
+ {
+ "name": "godot_string_split_ints_mk_allows_empty",
+ "return_type": "godot_array",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_array *", "p_splitters"]
+ ]
+ },
+ {
+ "name": "godot_string_split_spaces",
+ "return_type": "godot_array",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_char_lowercase",
+ "return_type": "wchar_t",
+ "arguments": [
+ ["wchar_t", "p_char"]
+ ]
+ },
+ {
+ "name": "godot_string_char_uppercase",
+ "return_type": "wchar_t",
+ "arguments": [
+ ["wchar_t", "p_char"]
+ ]
+ },
+ {
+ "name": "godot_string_to_lower",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_to_upper",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_get_basename",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_get_extension",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_left",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_int", "p_pos"]
+ ]
+ },
+ {
+ "name": "godot_string_ord_at",
+ "return_type": "wchar_t",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_int", "p_idx"]
+ ]
+ },
+ {
+ "name": "godot_string_plus_file",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_string *", "p_file"]
+ ]
+ },
+ {
+ "name": "godot_string_right",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_int", "p_pos"]
+ ]
+ },
+ {
+ "name": "godot_string_strip_edges",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_bool", "p_left"],
+ ["godot_bool", "p_right"]
+ ]
+ },
+ {
+ "name": "godot_string_strip_escapes",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_erase",
+ "return_type": "void",
+ "arguments": [
+ ["godot_string *", "p_self"],
+ ["godot_int", "p_pos"],
+ ["godot_int", "p_chars"]
+ ]
+ },
+ {
+ "name": "godot_string_ascii",
+ "return_type": "void",
+ "arguments": [
+ ["godot_string *", "p_self"],
+ ["char *", "result"]
+ ]
+ },
+ {
+ "name": "godot_string_ascii_extended",
+ "return_type": "void",
+ "arguments": [
+ ["godot_string *", "p_self"],
+ ["char *", "result"]
+ ]
+ },
+ {
+ "name": "godot_string_utf8",
+ "return_type": "void",
+ "arguments": [
+ ["godot_string *", "p_self"],
+ ["char *", "result"]
+ ]
+ },
+ {
+ "name": "godot_string_parse_utf8",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["godot_string *", "p_self"],
+ ["const char *", "p_utf8"]
+ ]
+ },
+ {
+ "name": "godot_string_parse_utf8_with_len",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["godot_string *", "p_self"],
+ ["const char *", "p_utf8"],
+ ["godot_int", "p_len"]
+ ]
+ },
+ {
+ "name": "godot_string_chars_to_utf8",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const char *", "p_utf8"]
+ ]
+ },
+ {
+ "name": "godot_string_chars_to_utf8_with_len",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const char *", "p_utf8"],
+ ["godot_int", "p_len"]
+ ]
+ },
+ {
+ "name": "godot_string_hash",
+ "return_type": "uint32_t",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_hash64",
+ "return_type": "uint64_t",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_hash_chars",
+ "return_type": "uint32_t",
+ "arguments": [
+ ["const char *", "p_cstr"]
+ ]
+ },
+ {
+ "name": "godot_string_hash_chars_with_len",
+ "return_type": "uint32_t",
+ "arguments": [
+ ["const char *", "p_cstr"],
+ ["godot_int", "p_len"]
+ ]
+ },
+ {
+ "name": "godot_string_hash_utf8_chars",
+ "return_type": "uint32_t",
+ "arguments": [
+ ["const wchar_t *", "p_str"]
+ ]
+ },
+ {
+ "name": "godot_string_hash_utf8_chars_with_len",
+ "return_type": "uint32_t",
+ "arguments": [
+ ["const wchar_t *", "p_str"],
+ ["godot_int", "p_len"]
+ ]
+ },
+ {
+ "name": "godot_string_md5_buffer",
+ "return_type": "godot_pool_byte_array",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_md5_text",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_sha256_buffer",
+ "return_type": "godot_pool_byte_array",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_sha256_text",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_empty",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_get_base_dir",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_get_file",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_humanize_size",
+ "return_type": "godot_string",
+ "arguments": [
+ ["size_t", "p_size"]
+ ]
+ },
+ {
+ "name": "godot_string_is_abs_path",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_is_rel_path",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_is_resource_file",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_path_to",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_string *", "p_path"]
+ ]
+ },
+ {
+ "name": "godot_string_path_to_file",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["const godot_string *", "p_path"]
+ ]
+ },
+ {
+ "name": "godot_string_simplify_path",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_c_escape",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_c_escape_multiline",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_c_unescape",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_http_escape",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_http_unescape",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_json_escape",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_word_wrap",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_int", "p_chars_per_line"]
+ ]
+ },
+ {
+ "name": "godot_string_xml_escape",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_xml_escape_with_quotes",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_xml_unescape",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_percent_decode",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_percent_encode",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_is_valid_float",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_is_valid_hex_number",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_string *", "p_self"],
+ ["godot_bool", "p_with_prefix"]
+ ]
+ },
+ {
+ "name": "godot_string_is_valid_html_color",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_is_valid_identifier",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_is_valid_integer",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_is_valid_ip_address",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_destroy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_string *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_name_new",
+ "return_type": "void",
+ "arguments": [
+ ["godot_string_name *", "r_dest"],
+ ["const godot_string *", "p_name"]
+ ]
+ },
+ {
+ "name": "godot_string_name_new_data",
+ "return_type": "void",
+ "arguments": [
+ ["godot_string_name *", "r_dest"],
+ ["const char *", "p_name"]
+ ]
+ },
+ {
+ "name": "godot_string_name_get_name",
+ "return_type": "godot_string",
+ "arguments": [
+ ["const godot_string_name *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_name_get_hash",
+ "return_type": "uint32_t",
+ "arguments": [
+ ["const godot_string_name *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_name_get_data_unique_pointer",
+ "return_type": "const void *",
+ "arguments": [
+ ["const godot_string_name *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_string_name_operator_equal",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_string_name *", "p_self"],
+ ["const godot_string_name *", "p_other"]
+ ]
+ },
+ {
+ "name": "godot_string_name_operator_less",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["const godot_string_name *", "p_self"],
+ ["const godot_string_name *", "p_other"]
+ ]
+ },
+ {
+ "name": "godot_string_name_destroy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_string_name *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_object_destroy",
+ "return_type": "void",
+ "arguments": [
+ ["godot_object *", "p_o"]
+ ]
+ },
+ {
+ "name": "godot_global_get_singleton",
+ "return_type": "godot_object *",
+ "arguments": [
+ ["char *", "p_name"]
+ ]
+ },
+ {
+ "name": "godot_method_bind_get_method",
+ "return_type": "godot_method_bind *",
+ "arguments": [
+ ["const char *", "p_classname"],
+ ["const char *", "p_methodname"]
+ ]
+ },
+ {
+ "name": "godot_method_bind_ptrcall",
+ "return_type": "void",
+ "arguments": [
+ ["godot_method_bind *", "p_method_bind"],
+ ["godot_object *", "p_instance"],
+ ["const void **", "p_args"],
+ ["void *", "p_ret"]
+ ]
+ },
+ {
+ "name": "godot_method_bind_call",
+ "return_type": "godot_variant",
+ "arguments": [
+ ["godot_method_bind *", "p_method_bind"],
+ ["godot_object *", "p_instance"],
+ ["const godot_variant **", "p_args"],
+ ["const int", "p_arg_count"],
+ ["godot_variant_call_error *", "p_call_error"]
+ ]
+ },
+ {
+ "name": "godot_get_class_constructor",
+ "return_type": "godot_class_constructor",
+ "arguments": [
+ ["const char *", "p_classname"]
+ ]
+ },
+ {
+ "name": "godot_alloc",
+ "return_type": "void *",
+ "arguments": [
+ ["int", "p_bytes"]
+ ]
+ },
+ {
+ "name": "godot_realloc",
+ "return_type": "void *",
+ "arguments": [
+ ["void *", "p_ptr"],
+ ["int", "p_bytes"]
+ ]
+ },
+ {
+ "name": "godot_free",
+ "return_type": "void",
+ "arguments": [
+ ["void *", "p_ptr"]
+ ]
+ },
+ {
+ "name": "godot_print_error",
+ "return_type": "void",
+ "arguments": [
+ ["const char *", "p_description"],
+ ["const char *", "p_function"],
+ ["const char *", "p_file"],
+ ["int", "p_line"]
+ ]
+ },
+ {
+ "name": "godot_print_warning",
+ "return_type": "void",
+ "arguments": [
+ ["const char *", "p_description"],
+ ["const char *", "p_function"],
+ ["const char *", "p_file"],
+ ["int", "p_line"]
+ ]
+ },
+ {
+ "name": "godot_print",
+ "return_type": "void",
+ "arguments": [
+ ["const godot_string *", "p_message"]
+ ]
+ },
+ {
+ "name": "godot_nativescript_register_class",
+ "return_type": "void",
+ "arguments": [
+ ["void *", "p_gdnative_handle"],
+ ["const char *", "p_name"],
+ ["const char *", "p_base"],
+ ["godot_instance_create_func", "p_create_func"],
+ ["godot_instance_destroy_func", "p_destroy_func"]
+ ]
+ },
+ {
+ "name": "godot_nativescript_register_tool_class",
+ "return_type": "void",
+ "arguments": [
+ ["void *", "p_gdnative_handle"],
+ ["const char *", "p_name"],
+ ["const char *", "p_base"],
+ ["godot_instance_create_func", "p_create_func"],
+ ["godot_instance_destroy_func", "p_destroy_func"]
+ ]
+ },
+ {
+ "name": "godot_nativescript_register_method",
+ "return_type": "void",
+ "arguments": [
+ ["void *", "p_gdnative_handle"],
+ ["const char *", "p_name"],
+ ["const char *", "p_function_name"],
+ ["godot_method_attributes", "p_attr"],
+ ["godot_instance_method", "p_method"]
+ ]
+ },
+ {
+ "name": "godot_nativescript_register_property",
+ "return_type": "void",
+ "arguments": [
+ ["void *", "p_gdnative_handle"],
+ ["const char *", "p_name"],
+ ["const char *", "p_path"],
+ ["godot_property_attributes *", "p_attr"],
+ ["godot_property_set_func", "p_set_func"],
+ ["godot_property_get_func", "p_get_func"]
+ ]
+ },
+ {
+ "name": "godot_nativescript_register_signal",
+ "return_type": "void",
+ "arguments": [
+ ["void *", "p_gdnative_handle"],
+ ["const char *", "p_name"],
+ ["const godot_signal *", "p_signal"]
+ ]
+ },
+ {
+ "name": "godot_nativescript_get_userdata",
+ "return_type": "void *",
+ "arguments": [
+ ["godot_object *", "p_instance"]
+ ]
+ }
+ ]
+}
diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h
index 1c5e91d733..2d8726e5db 100644
--- a/modules/gdnative/include/gdnative/gdnative.h
+++ b/modules/gdnative/include/gdnative/gdnative.h
@@ -34,23 +34,14 @@
extern "C" {
#endif
-#ifdef GDAPI_BUILT_IN
-#define GDAPI_EXPORT
-#endif
-
#ifdef _WIN32
-#if defined(GDAPI_EXPORT)
#define GDCALLINGCONV
-#define GDAPI __declspec(dllexport) GDCALLINGCONV
-#else
-#define GDCALLINGCONV
-#define GDAPI __declspec(dllimport) GDCALLINGCONV
-#endif
+#define GDAPI GDCALLINGCONV
#elif defined(__APPLE__)
#include "TargetConditionals.h"
#if TARGET_OS_IPHONE
-#define GDCALLINGCONV
-#define GDAPI
+#define GDCALLINGCONV __attribute__((visibility("default")))
+#define GDAPI GDCALLINGCONV
#elif TARGET_OS_MAC
#define GDCALLINGCONV __attribute__((sysv_abi))
#define GDAPI GDCALLINGCONV
@@ -103,7 +94,7 @@ typedef enum {
GODOT_ERR_CANT_CONNECT, // (25)
GODOT_ERR_CANT_RESOLVE,
GODOT_ERR_CONNECTION_ERROR,
- GODOT_ERR_CANT_AQUIRE_RESOURCE,
+ GODOT_ERR_CANT_ACQUIRE_RESOURCE,
GODOT_ERR_CANT_FORK,
GODOT_ERR_INVALID_DATA, ///< Data passed is invalid (30)
GODOT_ERR_INVALID_PARAMETER, ///< Parameter passed is invalid
@@ -150,6 +141,10 @@ typedef void godot_object;
#include <gdnative/string.h>
+/////// String name
+
+#include <gdnative/string_name.h>
+
////// Vector2
#include <gdnative/vector2.h>
@@ -243,6 +238,7 @@ typedef struct {
uint64_t no_api_hash;
godot_object *gd_native_library; // pointer to GDNativeLibrary that is being initialized
const struct godot_gdnative_api_struct *api_struct;
+ const godot_string *active_library_path;
} godot_gdnative_init_options;
typedef struct {
diff --git a/modules/gdnative/include/gdnative/string_name.h b/modules/gdnative/include/gdnative/string_name.h
new file mode 100644
index 0000000000..e217487250
--- /dev/null
+++ b/modules/gdnative/include/gdnative/string_name.h
@@ -0,0 +1,68 @@
+/*************************************************************************/
+/* string_name.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef GODOT_STRING_NAME_H
+#define GODOT_STRING_NAME_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <wchar.h>
+
+#define GODOT_STRING_NAME_SIZE sizeof(void *)
+
+#ifndef GODOT_CORE_API_GODOT_STRING_NAME_TYPE_DEFINED
+#define GODOT_CORE_API_GODOT_STRING_NAME_TYPE_DEFINED
+typedef struct {
+ uint8_t _dont_touch_that[GODOT_STRING_NAME_SIZE];
+} godot_string_name;
+#endif
+
+#include <gdnative/gdnative.h>
+
+void GDAPI godot_string_name_new(godot_string_name *r_dest, const godot_string *p_name);
+void GDAPI godot_string_name_new_data(godot_string_name *r_dest, const char *p_name);
+
+godot_string GDAPI godot_string_name_get_name(const godot_string_name *p_self);
+
+uint32_t GDAPI godot_string_name_get_hash(const godot_string_name *p_self);
+const void GDAPI *godot_string_name_get_data_unique_pointer(const godot_string_name *p_self);
+
+godot_bool GDAPI godot_string_name_operator_equal(const godot_string_name *p_self, const godot_string_name *p_other);
+godot_bool GDAPI godot_string_name_operator_less(const godot_string_name *p_self, const godot_string_name *p_other);
+
+void GDAPI godot_string_name_destroy(godot_string_name *p_self);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_STRING_NAME_H
diff --git a/modules/gdnative/include/gdnative_api_struct.h b/modules/gdnative/include/gdnative_api_struct.h
deleted file mode 100644
index c345e27227..0000000000
--- a/modules/gdnative/include/gdnative_api_struct.h
+++ /dev/null
@@ -1,723 +0,0 @@
-/*************************************************************************/
-/* gdnative_api_struct.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-#ifndef GODOT_GDNATIVE_API_STRUCT_H
-#define GODOT_GDNATIVE_API_STRUCT_H
-
-#include <gdnative/gdnative.h>
-#include <nativescript/godot_nativescript.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Using X_MACRO to keep api function signatures in a single list
-#define GODOT_GDNATIVE_API_FUNCTIONS \
- GDAPI_FUNC_VOID(godot_color_new_rgba, godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b, const godot_real p_a) \
- GDAPI_FUNC_VOID(godot_color_new_rgb, godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b) \
- GDAPI_FUNC(godot_color_get_r, godot_real, const godot_color *p_self) \
- GDAPI_FUNC_VOID(godot_color_set_r, godot_color *p_self, const godot_real r) \
- GDAPI_FUNC(godot_color_get_g, godot_real, const godot_color *p_self) \
- GDAPI_FUNC_VOID(godot_color_set_g, godot_color *p_self, const godot_real g) \
- GDAPI_FUNC(godot_color_get_b, godot_real, const godot_color *p_self) \
- GDAPI_FUNC_VOID(godot_color_set_b, godot_color *p_self, const godot_real b) \
- GDAPI_FUNC(godot_color_get_a, godot_real, const godot_color *p_self) \
- GDAPI_FUNC_VOID(godot_color_set_a, godot_color *p_self, const godot_real a) \
- GDAPI_FUNC(godot_color_get_h, godot_real, const godot_color *p_self) \
- GDAPI_FUNC(godot_color_get_s, godot_real, const godot_color *p_self) \
- GDAPI_FUNC(godot_color_get_v, godot_real, const godot_color *p_self) \
- GDAPI_FUNC(godot_color_as_string, godot_string, const godot_color *p_self) \
- GDAPI_FUNC(godot_color_to_rgba32, godot_int, const godot_color *p_self) \
- GDAPI_FUNC(godot_color_to_argb32, godot_int, const godot_color *p_self) \
- GDAPI_FUNC(godot_color_gray, godot_real, const godot_color *p_self) \
- GDAPI_FUNC(godot_color_inverted, godot_color, const godot_color *p_self) \
- GDAPI_FUNC(godot_color_contrasted, godot_color, const godot_color *p_self) \
- GDAPI_FUNC(godot_color_linear_interpolate, godot_color, const godot_color *p_self, const godot_color *p_b, const godot_real p_t) \
- GDAPI_FUNC(godot_color_blend, godot_color, const godot_color *p_self, const godot_color *p_over) \
- GDAPI_FUNC(godot_color_to_html, godot_string, const godot_color *p_self, const godot_bool p_with_alpha) \
- GDAPI_FUNC(godot_color_operator_equal, godot_bool, const godot_color *p_self, const godot_color *p_b) \
- GDAPI_FUNC(godot_color_operator_less, godot_bool, const godot_color *p_self, const godot_color *p_b) \
- GDAPI_FUNC_VOID(godot_vector2_new, godot_vector2 *r_dest, const godot_real p_x, const godot_real p_y) \
- GDAPI_FUNC(godot_vector2_as_string, godot_string, const godot_vector2 *p_self) \
- GDAPI_FUNC(godot_vector2_normalized, godot_vector2, const godot_vector2 *p_self) \
- GDAPI_FUNC(godot_vector2_length, godot_real, const godot_vector2 *p_self) \
- GDAPI_FUNC(godot_vector2_angle, godot_real, const godot_vector2 *p_self) \
- GDAPI_FUNC(godot_vector2_length_squared, godot_real, const godot_vector2 *p_self) \
- GDAPI_FUNC(godot_vector2_is_normalized, godot_bool, const godot_vector2 *p_self) \
- GDAPI_FUNC(godot_vector2_distance_to, godot_real, const godot_vector2 *p_self, const godot_vector2 *p_to) \
- GDAPI_FUNC(godot_vector2_distance_squared_to, godot_real, const godot_vector2 *p_self, const godot_vector2 *p_to) \
- GDAPI_FUNC(godot_vector2_angle_to, godot_real, const godot_vector2 *p_self, const godot_vector2 *p_to) \
- GDAPI_FUNC(godot_vector2_angle_to_point, godot_real, const godot_vector2 *p_self, const godot_vector2 *p_to) \
- GDAPI_FUNC(godot_vector2_linear_interpolate, godot_vector2, const godot_vector2 *p_self, const godot_vector2 *p_b, const godot_real p_t) \
- GDAPI_FUNC(godot_vector2_cubic_interpolate, godot_vector2, const godot_vector2 *p_self, const godot_vector2 *p_b, const godot_vector2 *p_pre_a, const godot_vector2 *p_post_b, const godot_real p_t) \
- GDAPI_FUNC(godot_vector2_rotated, godot_vector2, const godot_vector2 *p_self, const godot_real p_phi) \
- GDAPI_FUNC(godot_vector2_tangent, godot_vector2, const godot_vector2 *p_self) \
- GDAPI_FUNC(godot_vector2_floor, godot_vector2, const godot_vector2 *p_self) \
- GDAPI_FUNC(godot_vector2_snapped, godot_vector2, const godot_vector2 *p_self, const godot_vector2 *p_by) \
- GDAPI_FUNC(godot_vector2_aspect, godot_real, const godot_vector2 *p_self) \
- GDAPI_FUNC(godot_vector2_dot, godot_real, const godot_vector2 *p_self, const godot_vector2 *p_with) \
- GDAPI_FUNC(godot_vector2_slide, godot_vector2, const godot_vector2 *p_self, const godot_vector2 *p_n) \
- GDAPI_FUNC(godot_vector2_bounce, godot_vector2, const godot_vector2 *p_self, const godot_vector2 *p_n) \
- GDAPI_FUNC(godot_vector2_reflect, godot_vector2, const godot_vector2 *p_self, const godot_vector2 *p_n) \
- GDAPI_FUNC(godot_vector2_abs, godot_vector2, const godot_vector2 *p_self) \
- GDAPI_FUNC(godot_vector2_clamped, godot_vector2, const godot_vector2 *p_self, const godot_real p_length) \
- GDAPI_FUNC(godot_vector2_operator_add, godot_vector2, const godot_vector2 *p_self, const godot_vector2 *p_b) \
- GDAPI_FUNC(godot_vector2_operator_substract, godot_vector2, const godot_vector2 *p_self, const godot_vector2 *p_b) \
- GDAPI_FUNC(godot_vector2_operator_multiply_vector, godot_vector2, const godot_vector2 *p_self, const godot_vector2 *p_b) \
- GDAPI_FUNC(godot_vector2_operator_multiply_scalar, godot_vector2, const godot_vector2 *p_self, const godot_real p_b) \
- GDAPI_FUNC(godot_vector2_operator_divide_vector, godot_vector2, const godot_vector2 *p_self, const godot_vector2 *p_b) \
- GDAPI_FUNC(godot_vector2_operator_divide_scalar, godot_vector2, const godot_vector2 *p_self, const godot_real p_b) \
- GDAPI_FUNC(godot_vector2_operator_equal, godot_bool, const godot_vector2 *p_self, const godot_vector2 *p_b) \
- GDAPI_FUNC(godot_vector2_operator_less, godot_bool, const godot_vector2 *p_self, const godot_vector2 *p_b) \
- GDAPI_FUNC(godot_vector2_operator_neg, godot_vector2, const godot_vector2 *p_self) \
- GDAPI_FUNC_VOID(godot_vector2_set_x, godot_vector2 *p_self, const godot_real p_x) \
- GDAPI_FUNC_VOID(godot_vector2_set_y, godot_vector2 *p_self, const godot_real p_y) \
- GDAPI_FUNC(godot_vector2_get_x, godot_real, const godot_vector2 *p_self) \
- GDAPI_FUNC(godot_vector2_get_y, godot_real, const godot_vector2 *p_self) \
- GDAPI_FUNC_VOID(godot_quat_new, godot_quat *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z, const godot_real p_w) \
- GDAPI_FUNC_VOID(godot_quat_new_with_axis_angle, godot_quat *r_dest, const godot_vector3 *p_axis, const godot_real p_angle) \
- GDAPI_FUNC(godot_quat_get_x, godot_real, const godot_quat *p_self) \
- GDAPI_FUNC_VOID(godot_quat_set_x, godot_quat *p_self, const godot_real val) \
- GDAPI_FUNC(godot_quat_get_y, godot_real, const godot_quat *p_self) \
- GDAPI_FUNC_VOID(godot_quat_set_y, godot_quat *p_self, const godot_real val) \
- GDAPI_FUNC(godot_quat_get_z, godot_real, const godot_quat *p_self) \
- GDAPI_FUNC_VOID(godot_quat_set_z, godot_quat *p_self, const godot_real val) \
- GDAPI_FUNC(godot_quat_get_w, godot_real, const godot_quat *p_self) \
- GDAPI_FUNC_VOID(godot_quat_set_w, godot_quat *p_self, const godot_real val) \
- GDAPI_FUNC(godot_quat_as_string, godot_string, const godot_quat *p_self) \
- GDAPI_FUNC(godot_quat_length, godot_real, const godot_quat *p_self) \
- GDAPI_FUNC(godot_quat_length_squared, godot_real, const godot_quat *p_self) \
- GDAPI_FUNC(godot_quat_normalized, godot_quat, const godot_quat *p_self) \
- GDAPI_FUNC(godot_quat_is_normalized, godot_bool, const godot_quat *p_self) \
- GDAPI_FUNC(godot_quat_inverse, godot_quat, const godot_quat *p_self) \
- GDAPI_FUNC(godot_quat_dot, godot_real, const godot_quat *p_self, const godot_quat *p_b) \
- GDAPI_FUNC(godot_quat_xform, godot_vector3, const godot_quat *p_self, const godot_vector3 *p_v) \
- GDAPI_FUNC(godot_quat_slerp, godot_quat, const godot_quat *p_self, const godot_quat *p_b, const godot_real p_t) \
- GDAPI_FUNC(godot_quat_slerpni, godot_quat, const godot_quat *p_self, const godot_quat *p_b, const godot_real p_t) \
- GDAPI_FUNC(godot_quat_cubic_slerp, godot_quat, const godot_quat *p_self, const godot_quat *p_b, const godot_quat *p_pre_a, const godot_quat *p_post_b, const godot_real p_t) \
- GDAPI_FUNC(godot_quat_operator_multiply, godot_quat, const godot_quat *p_self, const godot_real p_b) \
- GDAPI_FUNC(godot_quat_operator_add, godot_quat, const godot_quat *p_self, const godot_quat *p_b) \
- GDAPI_FUNC(godot_quat_operator_substract, godot_quat, const godot_quat *p_self, const godot_quat *p_b) \
- GDAPI_FUNC(godot_quat_operator_divide, godot_quat, const godot_quat *p_self, const godot_real p_b) \
- GDAPI_FUNC(godot_quat_operator_equal, godot_bool, const godot_quat *p_self, const godot_quat *p_b) \
- GDAPI_FUNC(godot_quat_operator_neg, godot_quat, const godot_quat *p_self) \
- GDAPI_FUNC_VOID(godot_basis_new_with_rows, godot_basis *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis) \
- GDAPI_FUNC_VOID(godot_basis_new_with_axis_and_angle, godot_basis *r_dest, const godot_vector3 *p_axis, const godot_real p_phi) \
- GDAPI_FUNC_VOID(godot_basis_new_with_euler, godot_basis *r_dest, const godot_vector3 *p_euler) \
- GDAPI_FUNC(godot_basis_as_string, godot_string, const godot_basis *p_self) \
- GDAPI_FUNC(godot_basis_inverse, godot_basis, const godot_basis *p_self) \
- GDAPI_FUNC(godot_basis_transposed, godot_basis, const godot_basis *p_self) \
- GDAPI_FUNC(godot_basis_orthonormalized, godot_basis, const godot_basis *p_self) \
- GDAPI_FUNC(godot_basis_determinant, godot_real, const godot_basis *p_self) \
- GDAPI_FUNC(godot_basis_rotated, godot_basis, const godot_basis *p_self, const godot_vector3 *p_axis, const godot_real p_phi) \
- GDAPI_FUNC(godot_basis_scaled, godot_basis, const godot_basis *p_self, const godot_vector3 *p_scale) \
- GDAPI_FUNC(godot_basis_get_scale, godot_vector3, const godot_basis *p_self) \
- GDAPI_FUNC(godot_basis_get_euler, godot_vector3, const godot_basis *p_self) \
- GDAPI_FUNC(godot_basis_tdotx, godot_real, const godot_basis *p_self, const godot_vector3 *p_with) \
- GDAPI_FUNC(godot_basis_tdoty, godot_real, const godot_basis *p_self, const godot_vector3 *p_with) \
- GDAPI_FUNC(godot_basis_tdotz, godot_real, const godot_basis *p_self, const godot_vector3 *p_with) \
- GDAPI_FUNC(godot_basis_xform, godot_vector3, const godot_basis *p_self, const godot_vector3 *p_v) \
- GDAPI_FUNC(godot_basis_xform_inv, godot_vector3, const godot_basis *p_self, const godot_vector3 *p_v) \
- GDAPI_FUNC(godot_basis_get_orthogonal_index, godot_int, const godot_basis *p_self) \
- GDAPI_FUNC_VOID(godot_basis_new, godot_basis *r_dest) \
- GDAPI_FUNC_VOID(godot_basis_new_with_euler_quat, godot_basis *r_dest, const godot_quat *p_euler) \
- GDAPI_FUNC_VOID(godot_basis_get_elements, godot_basis *p_self, godot_vector3 *p_elements) \
- GDAPI_FUNC(godot_basis_get_axis, godot_vector3, const godot_basis *p_self, const godot_int p_axis) \
- GDAPI_FUNC_VOID(godot_basis_set_axis, godot_basis *p_self, const godot_int p_axis, const godot_vector3 *p_value) \
- GDAPI_FUNC(godot_basis_get_row, godot_vector3, const godot_basis *p_self, const godot_int p_row) \
- GDAPI_FUNC_VOID(godot_basis_set_row, godot_basis *p_self, const godot_int p_row, const godot_vector3 *p_value) \
- GDAPI_FUNC(godot_basis_operator_equal, godot_bool, const godot_basis *p_self, const godot_basis *p_b) \
- GDAPI_FUNC(godot_basis_operator_add, godot_basis, const godot_basis *p_self, const godot_basis *p_b) \
- GDAPI_FUNC(godot_basis_operator_substract, godot_basis, const godot_basis *p_self, const godot_basis *p_b) \
- GDAPI_FUNC(godot_basis_operator_multiply_vector, godot_basis, const godot_basis *p_self, const godot_basis *p_b) \
- GDAPI_FUNC(godot_basis_operator_multiply_scalar, godot_basis, const godot_basis *p_self, const godot_real p_b) \
- GDAPI_FUNC_VOID(godot_vector3_new, godot_vector3 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z) \
- GDAPI_FUNC(godot_vector3_as_string, godot_string, const godot_vector3 *p_self) \
- GDAPI_FUNC(godot_vector3_min_axis, godot_int, const godot_vector3 *p_self) \
- GDAPI_FUNC(godot_vector3_max_axis, godot_int, const godot_vector3 *p_self) \
- GDAPI_FUNC(godot_vector3_length, godot_real, const godot_vector3 *p_self) \
- GDAPI_FUNC(godot_vector3_length_squared, godot_real, const godot_vector3 *p_self) \
- GDAPI_FUNC(godot_vector3_is_normalized, godot_bool, const godot_vector3 *p_self) \
- GDAPI_FUNC(godot_vector3_normalized, godot_vector3, const godot_vector3 *p_self) \
- GDAPI_FUNC(godot_vector3_inverse, godot_vector3, const godot_vector3 *p_self) \
- GDAPI_FUNC(godot_vector3_snapped, godot_vector3, const godot_vector3 *p_self, const godot_vector3 *p_by) \
- GDAPI_FUNC(godot_vector3_rotated, godot_vector3, const godot_vector3 *p_self, const godot_vector3 *p_axis, const godot_real p_phi) \
- GDAPI_FUNC(godot_vector3_linear_interpolate, godot_vector3, const godot_vector3 *p_self, const godot_vector3 *p_b, const godot_real p_t) \
- GDAPI_FUNC(godot_vector3_cubic_interpolate, godot_vector3, const godot_vector3 *p_self, const godot_vector3 *p_b, const godot_vector3 *p_pre_a, const godot_vector3 *p_post_b, const godot_real p_t) \
- GDAPI_FUNC(godot_vector3_dot, godot_real, const godot_vector3 *p_self, const godot_vector3 *p_b) \
- GDAPI_FUNC(godot_vector3_cross, godot_vector3, const godot_vector3 *p_self, const godot_vector3 *p_b) \
- GDAPI_FUNC(godot_vector3_outer, godot_basis, const godot_vector3 *p_self, const godot_vector3 *p_b) \
- GDAPI_FUNC(godot_vector3_to_diagonal_matrix, godot_basis, const godot_vector3 *p_self) \
- GDAPI_FUNC(godot_vector3_abs, godot_vector3, const godot_vector3 *p_self) \
- GDAPI_FUNC(godot_vector3_floor, godot_vector3, const godot_vector3 *p_self) \
- GDAPI_FUNC(godot_vector3_ceil, godot_vector3, const godot_vector3 *p_self) \
- GDAPI_FUNC(godot_vector3_distance_to, godot_real, const godot_vector3 *p_self, const godot_vector3 *p_b) \
- GDAPI_FUNC(godot_vector3_distance_squared_to, godot_real, const godot_vector3 *p_self, const godot_vector3 *p_b) \
- GDAPI_FUNC(godot_vector3_angle_to, godot_real, const godot_vector3 *p_self, const godot_vector3 *p_to) \
- GDAPI_FUNC(godot_vector3_slide, godot_vector3, const godot_vector3 *p_self, const godot_vector3 *p_n) \
- GDAPI_FUNC(godot_vector3_bounce, godot_vector3, const godot_vector3 *p_self, const godot_vector3 *p_n) \
- GDAPI_FUNC(godot_vector3_reflect, godot_vector3, const godot_vector3 *p_self, const godot_vector3 *p_n) \
- GDAPI_FUNC(godot_vector3_operator_add, godot_vector3, const godot_vector3 *p_self, const godot_vector3 *p_b) \
- GDAPI_FUNC(godot_vector3_operator_substract, godot_vector3, const godot_vector3 *p_self, const godot_vector3 *p_b) \
- GDAPI_FUNC(godot_vector3_operator_multiply_vector, godot_vector3, const godot_vector3 *p_self, const godot_vector3 *p_b) \
- GDAPI_FUNC(godot_vector3_operator_multiply_scalar, godot_vector3, const godot_vector3 *p_self, const godot_real p_b) \
- GDAPI_FUNC(godot_vector3_operator_divide_vector, godot_vector3, const godot_vector3 *p_self, const godot_vector3 *p_b) \
- GDAPI_FUNC(godot_vector3_operator_divide_scalar, godot_vector3, const godot_vector3 *p_self, const godot_real p_b) \
- GDAPI_FUNC(godot_vector3_operator_equal, godot_bool, const godot_vector3 *p_self, const godot_vector3 *p_b) \
- GDAPI_FUNC(godot_vector3_operator_less, godot_bool, const godot_vector3 *p_self, const godot_vector3 *p_b) \
- GDAPI_FUNC(godot_vector3_operator_neg, godot_vector3, const godot_vector3 *p_self) \
- GDAPI_FUNC_VOID(godot_vector3_set_axis, godot_vector3 *p_self, const godot_vector3_axis p_axis, const godot_real p_val) \
- GDAPI_FUNC(godot_vector3_get_axis, godot_real, const godot_vector3 *p_self, const godot_vector3_axis p_axis) \
- GDAPI_FUNC_VOID(godot_pool_byte_array_new, godot_pool_byte_array *r_dest) \
- GDAPI_FUNC_VOID(godot_pool_byte_array_new_copy, godot_pool_byte_array *r_dest, const godot_pool_byte_array *p_src) \
- GDAPI_FUNC_VOID(godot_pool_byte_array_new_with_array, godot_pool_byte_array *r_dest, const godot_array *p_a) \
- GDAPI_FUNC_VOID(godot_pool_byte_array_append, godot_pool_byte_array *p_self, const uint8_t p_data) \
- GDAPI_FUNC_VOID(godot_pool_byte_array_append_array, godot_pool_byte_array *p_self, const godot_pool_byte_array *p_array) \
- GDAPI_FUNC(godot_pool_byte_array_insert, godot_error, godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data) \
- GDAPI_FUNC_VOID(godot_pool_byte_array_invert, godot_pool_byte_array *p_self) \
- GDAPI_FUNC_VOID(godot_pool_byte_array_push_back, godot_pool_byte_array *p_self, const uint8_t p_data) \
- GDAPI_FUNC_VOID(godot_pool_byte_array_remove, godot_pool_byte_array *p_self, const godot_int p_idx) \
- GDAPI_FUNC_VOID(godot_pool_byte_array_resize, godot_pool_byte_array *p_self, const godot_int p_size) \
- GDAPI_FUNC_VOID(godot_pool_byte_array_set, godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data) \
- GDAPI_FUNC(godot_pool_byte_array_get, uint8_t, const godot_pool_byte_array *p_self, const godot_int p_idx) \
- GDAPI_FUNC(godot_pool_byte_array_size, godot_int, const godot_pool_byte_array *p_self) \
- GDAPI_FUNC_VOID(godot_pool_byte_array_destroy, godot_pool_byte_array *p_self) \
- GDAPI_FUNC_VOID(godot_pool_int_array_new, godot_pool_int_array *r_dest) \
- GDAPI_FUNC_VOID(godot_pool_int_array_new_copy, godot_pool_int_array *r_dest, const godot_pool_int_array *p_src) \
- GDAPI_FUNC_VOID(godot_pool_int_array_new_with_array, godot_pool_int_array *r_dest, const godot_array *p_a) \
- GDAPI_FUNC_VOID(godot_pool_int_array_append, godot_pool_int_array *p_self, const godot_int p_data) \
- GDAPI_FUNC_VOID(godot_pool_int_array_append_array, godot_pool_int_array *p_self, const godot_pool_int_array *p_array) \
- GDAPI_FUNC(godot_pool_int_array_insert, godot_error, godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data) \
- GDAPI_FUNC_VOID(godot_pool_int_array_invert, godot_pool_int_array *p_self) \
- GDAPI_FUNC_VOID(godot_pool_int_array_push_back, godot_pool_int_array *p_self, const godot_int p_data) \
- GDAPI_FUNC_VOID(godot_pool_int_array_remove, godot_pool_int_array *p_self, const godot_int p_idx) \
- GDAPI_FUNC_VOID(godot_pool_int_array_resize, godot_pool_int_array *p_self, const godot_int p_size) \
- GDAPI_FUNC_VOID(godot_pool_int_array_set, godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data) \
- GDAPI_FUNC(godot_pool_int_array_get, godot_int, const godot_pool_int_array *p_self, const godot_int p_idx) \
- GDAPI_FUNC(godot_pool_int_array_size, godot_int, const godot_pool_int_array *p_self) \
- GDAPI_FUNC_VOID(godot_pool_int_array_destroy, godot_pool_int_array *p_self) \
- GDAPI_FUNC_VOID(godot_pool_real_array_new, godot_pool_real_array *r_dest) \
- GDAPI_FUNC_VOID(godot_pool_real_array_new_copy, godot_pool_real_array *r_dest, const godot_pool_real_array *p_src) \
- GDAPI_FUNC_VOID(godot_pool_real_array_new_with_array, godot_pool_real_array *r_dest, const godot_array *p_a) \
- GDAPI_FUNC_VOID(godot_pool_real_array_append, godot_pool_real_array *p_self, const godot_real p_data) \
- GDAPI_FUNC_VOID(godot_pool_real_array_append_array, godot_pool_real_array *p_self, const godot_pool_real_array *p_array) \
- GDAPI_FUNC(godot_pool_real_array_insert, godot_error, godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data) \
- GDAPI_FUNC_VOID(godot_pool_real_array_invert, godot_pool_real_array *p_self) \
- GDAPI_FUNC_VOID(godot_pool_real_array_push_back, godot_pool_real_array *p_self, const godot_real p_data) \
- GDAPI_FUNC_VOID(godot_pool_real_array_remove, godot_pool_real_array *p_self, const godot_int p_idx) \
- GDAPI_FUNC_VOID(godot_pool_real_array_resize, godot_pool_real_array *p_self, const godot_int p_size) \
- GDAPI_FUNC_VOID(godot_pool_real_array_set, godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data) \
- GDAPI_FUNC(godot_pool_real_array_get, godot_real, const godot_pool_real_array *p_self, const godot_int p_idx) \
- GDAPI_FUNC(godot_pool_real_array_size, godot_int, const godot_pool_real_array *p_self) \
- GDAPI_FUNC_VOID(godot_pool_real_array_destroy, godot_pool_real_array *p_self) \
- GDAPI_FUNC_VOID(godot_pool_string_array_new, godot_pool_string_array *r_dest) \
- GDAPI_FUNC_VOID(godot_pool_string_array_new_copy, godot_pool_string_array *r_dest, const godot_pool_string_array *p_src) \
- GDAPI_FUNC_VOID(godot_pool_string_array_new_with_array, godot_pool_string_array *r_dest, const godot_array *p_a) \
- GDAPI_FUNC_VOID(godot_pool_string_array_append, godot_pool_string_array *p_self, const godot_string *p_data) \
- GDAPI_FUNC_VOID(godot_pool_string_array_append_array, godot_pool_string_array *p_self, const godot_pool_string_array *p_array) \
- GDAPI_FUNC(godot_pool_string_array_insert, godot_error, godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data) \
- GDAPI_FUNC_VOID(godot_pool_string_array_invert, godot_pool_string_array *p_self) \
- GDAPI_FUNC_VOID(godot_pool_string_array_push_back, godot_pool_string_array *p_self, const godot_string *p_data) \
- GDAPI_FUNC_VOID(godot_pool_string_array_remove, godot_pool_string_array *p_self, const godot_int p_idx) \
- GDAPI_FUNC_VOID(godot_pool_string_array_resize, godot_pool_string_array *p_self, const godot_int p_size) \
- GDAPI_FUNC_VOID(godot_pool_string_array_set, godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data) \
- GDAPI_FUNC(godot_pool_string_array_get, godot_string, const godot_pool_string_array *p_self, const godot_int p_idx) \
- GDAPI_FUNC(godot_pool_string_array_size, godot_int, const godot_pool_string_array *p_self) \
- GDAPI_FUNC_VOID(godot_pool_string_array_destroy, godot_pool_string_array *p_self) \
- GDAPI_FUNC_VOID(godot_pool_vector2_array_new, godot_pool_vector2_array *r_dest) \
- GDAPI_FUNC_VOID(godot_pool_vector2_array_new_copy, godot_pool_vector2_array *r_dest, const godot_pool_vector2_array *p_src) \
- GDAPI_FUNC_VOID(godot_pool_vector2_array_new_with_array, godot_pool_vector2_array *r_dest, const godot_array *p_a) \
- GDAPI_FUNC_VOID(godot_pool_vector2_array_append, godot_pool_vector2_array *p_self, const godot_vector2 *p_data) \
- GDAPI_FUNC_VOID(godot_pool_vector2_array_append_array, godot_pool_vector2_array *p_self, const godot_pool_vector2_array *p_array) \
- GDAPI_FUNC(godot_pool_vector2_array_insert, godot_error, godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data) \
- GDAPI_FUNC_VOID(godot_pool_vector2_array_invert, godot_pool_vector2_array *p_self) \
- GDAPI_FUNC_VOID(godot_pool_vector2_array_push_back, godot_pool_vector2_array *p_self, const godot_vector2 *p_data) \
- GDAPI_FUNC_VOID(godot_pool_vector2_array_remove, godot_pool_vector2_array *p_self, const godot_int p_idx) \
- GDAPI_FUNC_VOID(godot_pool_vector2_array_resize, godot_pool_vector2_array *p_self, const godot_int p_size) \
- GDAPI_FUNC_VOID(godot_pool_vector2_array_set, godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data) \
- GDAPI_FUNC(godot_pool_vector2_array_get, godot_vector2, const godot_pool_vector2_array *p_self, const godot_int p_idx) \
- GDAPI_FUNC(godot_pool_vector2_array_size, godot_int, const godot_pool_vector2_array *p_self) \
- GDAPI_FUNC_VOID(godot_pool_vector2_array_destroy, godot_pool_vector2_array *p_self) \
- GDAPI_FUNC_VOID(godot_pool_vector3_array_new, godot_pool_vector3_array *r_dest) \
- GDAPI_FUNC_VOID(godot_pool_vector3_array_new_copy, godot_pool_vector3_array *r_dest, const godot_pool_vector3_array *p_src) \
- GDAPI_FUNC_VOID(godot_pool_vector3_array_new_with_array, godot_pool_vector3_array *r_dest, const godot_array *p_a) \
- GDAPI_FUNC_VOID(godot_pool_vector3_array_append, godot_pool_vector3_array *p_self, const godot_vector3 *p_data) \
- GDAPI_FUNC_VOID(godot_pool_vector3_array_append_array, godot_pool_vector3_array *p_self, const godot_pool_vector3_array *p_array) \
- GDAPI_FUNC(godot_pool_vector3_array_insert, godot_error, godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data) \
- GDAPI_FUNC_VOID(godot_pool_vector3_array_invert, godot_pool_vector3_array *p_self) \
- GDAPI_FUNC_VOID(godot_pool_vector3_array_push_back, godot_pool_vector3_array *p_self, const godot_vector3 *p_data) \
- GDAPI_FUNC_VOID(godot_pool_vector3_array_remove, godot_pool_vector3_array *p_self, const godot_int p_idx) \
- GDAPI_FUNC_VOID(godot_pool_vector3_array_resize, godot_pool_vector3_array *p_self, const godot_int p_size) \
- GDAPI_FUNC_VOID(godot_pool_vector3_array_set, godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data) \
- GDAPI_FUNC(godot_pool_vector3_array_get, godot_vector3, const godot_pool_vector3_array *p_self, const godot_int p_idx) \
- GDAPI_FUNC(godot_pool_vector3_array_size, godot_int, const godot_pool_vector3_array *p_self) \
- GDAPI_FUNC_VOID(godot_pool_vector3_array_destroy, godot_pool_vector3_array *p_self) \
- GDAPI_FUNC_VOID(godot_pool_color_array_new, godot_pool_color_array *r_dest) \
- GDAPI_FUNC_VOID(godot_pool_color_array_new_copy, godot_pool_color_array *r_dest, const godot_pool_color_array *p_src) \
- GDAPI_FUNC_VOID(godot_pool_color_array_new_with_array, godot_pool_color_array *r_dest, const godot_array *p_a) \
- GDAPI_FUNC_VOID(godot_pool_color_array_append, godot_pool_color_array *p_self, const godot_color *p_data) \
- GDAPI_FUNC_VOID(godot_pool_color_array_append_array, godot_pool_color_array *p_self, const godot_pool_color_array *p_array) \
- GDAPI_FUNC(godot_pool_color_array_insert, godot_error, godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data) \
- GDAPI_FUNC_VOID(godot_pool_color_array_invert, godot_pool_color_array *p_self) \
- GDAPI_FUNC_VOID(godot_pool_color_array_push_back, godot_pool_color_array *p_self, const godot_color *p_data) \
- GDAPI_FUNC_VOID(godot_pool_color_array_remove, godot_pool_color_array *p_self, const godot_int p_idx) \
- GDAPI_FUNC_VOID(godot_pool_color_array_resize, godot_pool_color_array *p_self, const godot_int p_size) \
- GDAPI_FUNC_VOID(godot_pool_color_array_set, godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data) \
- GDAPI_FUNC(godot_pool_color_array_get, godot_color, const godot_pool_color_array *p_self, const godot_int p_idx) \
- GDAPI_FUNC(godot_pool_color_array_size, godot_int, const godot_pool_color_array *p_self) \
- GDAPI_FUNC_VOID(godot_pool_color_array_destroy, godot_pool_color_array *p_self) \
- GDAPI_FUNC_VOID(godot_array_new, godot_array *r_dest) \
- GDAPI_FUNC_VOID(godot_array_new_copy, godot_array *r_dest, const godot_array *p_src) \
- GDAPI_FUNC_VOID(godot_array_new_pool_color_array, godot_array *r_dest, const godot_pool_color_array *p_pca) \
- GDAPI_FUNC_VOID(godot_array_new_pool_vector3_array, godot_array *r_dest, const godot_pool_vector3_array *p_pv3a) \
- GDAPI_FUNC_VOID(godot_array_new_pool_vector2_array, godot_array *r_dest, const godot_pool_vector2_array *p_pv2a) \
- GDAPI_FUNC_VOID(godot_array_new_pool_string_array, godot_array *r_dest, const godot_pool_string_array *p_psa) \
- GDAPI_FUNC_VOID(godot_array_new_pool_real_array, godot_array *r_dest, const godot_pool_real_array *p_pra) \
- GDAPI_FUNC_VOID(godot_array_new_pool_int_array, godot_array *r_dest, const godot_pool_int_array *p_pia) \
- GDAPI_FUNC_VOID(godot_array_new_pool_byte_array, godot_array *r_dest, const godot_pool_byte_array *p_pba) \
- GDAPI_FUNC_VOID(godot_array_set, godot_array *p_self, const godot_int p_idx, const godot_variant *p_value) \
- GDAPI_FUNC(godot_array_get, godot_variant, const godot_array *p_self, const godot_int p_idx) \
- GDAPI_FUNC(godot_array_operator_index, godot_variant *, godot_array *p_self, const godot_int p_idx) \
- GDAPI_FUNC_VOID(godot_array_append, godot_array *p_self, const godot_variant *p_value) \
- GDAPI_FUNC_VOID(godot_array_clear, godot_array *p_self) \
- GDAPI_FUNC(godot_array_count, godot_int, const godot_array *p_self, const godot_variant *p_value) \
- GDAPI_FUNC(godot_array_empty, godot_bool, const godot_array *p_self) \
- GDAPI_FUNC_VOID(godot_array_erase, godot_array *p_self, const godot_variant *p_value) \
- GDAPI_FUNC(godot_array_front, godot_variant, const godot_array *p_self) \
- GDAPI_FUNC(godot_array_back, godot_variant, const godot_array *p_self) \
- GDAPI_FUNC(godot_array_find, godot_int, const godot_array *p_self, const godot_variant *p_what, const godot_int p_from) \
- GDAPI_FUNC(godot_array_find_last, godot_int, const godot_array *p_self, const godot_variant *p_what) \
- GDAPI_FUNC(godot_array_has, godot_bool, const godot_array *p_self, const godot_variant *p_value) \
- GDAPI_FUNC(godot_array_hash, godot_int, const godot_array *p_self) \
- GDAPI_FUNC_VOID(godot_array_insert, godot_array *p_self, const godot_int p_pos, const godot_variant *p_value) \
- GDAPI_FUNC_VOID(godot_array_invert, godot_array *p_self) \
- GDAPI_FUNC(godot_array_pop_back, godot_variant, godot_array *p_self) \
- GDAPI_FUNC(godot_array_pop_front, godot_variant, godot_array *p_self) \
- GDAPI_FUNC_VOID(godot_array_push_back, godot_array *p_self, const godot_variant *p_value) \
- GDAPI_FUNC_VOID(godot_array_push_front, godot_array *p_self, const godot_variant *p_value) \
- GDAPI_FUNC_VOID(godot_array_remove, godot_array *p_self, const godot_int p_idx) \
- GDAPI_FUNC_VOID(godot_array_resize, godot_array *p_self, const godot_int p_size) \
- GDAPI_FUNC(godot_array_rfind, godot_int, const godot_array *p_self, const godot_variant *p_what, const godot_int p_from) \
- GDAPI_FUNC(godot_array_size, godot_int, const godot_array *p_self) \
- GDAPI_FUNC_VOID(godot_array_sort, godot_array *p_self) \
- GDAPI_FUNC_VOID(godot_array_sort_custom, godot_array *p_self, godot_object *p_obj, const godot_string *p_func) \
- GDAPI_FUNC_VOID(godot_array_destroy, godot_array *p_self) \
- GDAPI_FUNC_VOID(godot_dictionary_new, godot_dictionary *r_dest) \
- GDAPI_FUNC_VOID(godot_dictionary_new_copy, godot_dictionary *r_dest, const godot_dictionary *p_src) \
- GDAPI_FUNC_VOID(godot_dictionary_destroy, godot_dictionary *p_self) \
- GDAPI_FUNC(godot_dictionary_size, godot_int, const godot_dictionary *p_self) \
- GDAPI_FUNC(godot_dictionary_empty, godot_bool, const godot_dictionary *p_self) \
- GDAPI_FUNC_VOID(godot_dictionary_clear, godot_dictionary *p_self) \
- GDAPI_FUNC(godot_dictionary_has, godot_bool, const godot_dictionary *p_self, const godot_variant *p_key) \
- GDAPI_FUNC(godot_dictionary_has_all, godot_bool, const godot_dictionary *p_self, const godot_array *p_keys) \
- GDAPI_FUNC_VOID(godot_dictionary_erase, godot_dictionary *p_self, const godot_variant *p_key) \
- GDAPI_FUNC(godot_dictionary_hash, godot_int, const godot_dictionary *p_self) \
- GDAPI_FUNC(godot_dictionary_keys, godot_array, const godot_dictionary *p_self) \
- GDAPI_FUNC(godot_dictionary_values, godot_array, const godot_dictionary *p_self) \
- GDAPI_FUNC(godot_dictionary_get, godot_variant, const godot_dictionary *p_self, const godot_variant *p_key) \
- GDAPI_FUNC_VOID(godot_dictionary_set, godot_dictionary *p_self, const godot_variant *p_key, const godot_variant *p_value) \
- GDAPI_FUNC(godot_dictionary_operator_index, godot_variant *, godot_dictionary *p_self, const godot_variant *p_key) \
- GDAPI_FUNC(godot_dictionary_next, godot_variant *, const godot_dictionary *p_self, const godot_variant *p_key) \
- GDAPI_FUNC(godot_dictionary_operator_equal, godot_bool, const godot_dictionary *p_self, const godot_dictionary *p_b) \
- GDAPI_FUNC(godot_dictionary_to_json, godot_string, const godot_dictionary *p_self) \
- GDAPI_FUNC_VOID(godot_node_path_new, godot_node_path *r_dest, const godot_string *p_from) \
- GDAPI_FUNC_VOID(godot_node_path_new_copy, godot_node_path *r_dest, const godot_node_path *p_src) \
- GDAPI_FUNC_VOID(godot_node_path_destroy, godot_node_path *p_self) \
- GDAPI_FUNC(godot_node_path_as_string, godot_string, const godot_node_path *p_self) \
- GDAPI_FUNC(godot_node_path_is_absolute, godot_bool, const godot_node_path *p_self) \
- GDAPI_FUNC(godot_node_path_get_name_count, godot_int, const godot_node_path *p_self) \
- GDAPI_FUNC(godot_node_path_get_name, godot_string, const godot_node_path *p_self, const godot_int p_idx) \
- GDAPI_FUNC(godot_node_path_get_subname_count, godot_int, const godot_node_path *p_self) \
- GDAPI_FUNC(godot_node_path_get_subname, godot_string, const godot_node_path *p_self, const godot_int p_idx) \
- GDAPI_FUNC(godot_node_path_get_property, godot_string, const godot_node_path *p_self) \
- GDAPI_FUNC(godot_node_path_is_empty, godot_bool, const godot_node_path *p_self) \
- GDAPI_FUNC(godot_node_path_operator_equal, godot_bool, const godot_node_path *p_self, const godot_node_path *p_b) \
- GDAPI_FUNC_VOID(godot_plane_new_with_reals, godot_plane *r_dest, const godot_real p_a, const godot_real p_b, const godot_real p_c, const godot_real p_d) \
- GDAPI_FUNC_VOID(godot_plane_new_with_vectors, godot_plane *r_dest, const godot_vector3 *p_v1, const godot_vector3 *p_v2, const godot_vector3 *p_v3) \
- GDAPI_FUNC_VOID(godot_plane_new_with_normal, godot_plane *r_dest, const godot_vector3 *p_normal, const godot_real p_d) \
- GDAPI_FUNC(godot_plane_as_string, godot_string, const godot_plane *p_self) \
- GDAPI_FUNC(godot_plane_normalized, godot_plane, const godot_plane *p_self) \
- GDAPI_FUNC(godot_plane_center, godot_vector3, const godot_plane *p_self) \
- GDAPI_FUNC(godot_plane_get_any_point, godot_vector3, const godot_plane *p_self) \
- GDAPI_FUNC(godot_plane_is_point_over, godot_bool, const godot_plane *p_self, const godot_vector3 *p_point) \
- GDAPI_FUNC(godot_plane_distance_to, godot_real, const godot_plane *p_self, const godot_vector3 *p_point) \
- GDAPI_FUNC(godot_plane_has_point, godot_bool, const godot_plane *p_self, const godot_vector3 *p_point, const godot_real p_epsilon) \
- GDAPI_FUNC(godot_plane_project, godot_vector3, const godot_plane *p_self, const godot_vector3 *p_point) \
- GDAPI_FUNC(godot_plane_intersect_3, godot_bool, const godot_plane *p_self, godot_vector3 *r_dest, const godot_plane *p_b, const godot_plane *p_c) \
- GDAPI_FUNC(godot_plane_intersects_ray, godot_bool, const godot_plane *p_self, godot_vector3 *r_dest, const godot_vector3 *p_from, const godot_vector3 *p_dir) \
- GDAPI_FUNC(godot_plane_intersects_segment, godot_bool, const godot_plane *p_self, godot_vector3 *r_dest, const godot_vector3 *p_begin, const godot_vector3 *p_end) \
- GDAPI_FUNC(godot_plane_operator_neg, godot_plane, const godot_plane *p_self) \
- GDAPI_FUNC(godot_plane_operator_equal, godot_bool, const godot_plane *p_self, const godot_plane *p_b) \
- GDAPI_FUNC_VOID(godot_plane_set_normal, godot_plane *p_self, const godot_vector3 *p_normal) \
- GDAPI_FUNC(godot_plane_get_normal, godot_vector3, const godot_plane *p_self) \
- GDAPI_FUNC(godot_plane_get_d, godot_real, const godot_plane *p_self) \
- GDAPI_FUNC_VOID(godot_plane_set_d, godot_plane *p_self, const godot_real p_d) \
- GDAPI_FUNC_VOID(godot_rect2_new_with_position_and_size, godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size) \
- GDAPI_FUNC_VOID(godot_rect2_new, godot_rect2 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_width, const godot_real p_height) \
- GDAPI_FUNC(godot_rect2_as_string, godot_string, const godot_rect2 *p_self) \
- GDAPI_FUNC(godot_rect2_get_area, godot_real, const godot_rect2 *p_self) \
- GDAPI_FUNC(godot_rect2_intersects, godot_bool, const godot_rect2 *p_self, const godot_rect2 *p_b) \
- GDAPI_FUNC(godot_rect2_encloses, godot_bool, const godot_rect2 *p_self, const godot_rect2 *p_b) \
- GDAPI_FUNC(godot_rect2_has_no_area, godot_bool, const godot_rect2 *p_self) \
- GDAPI_FUNC(godot_rect2_clip, godot_rect2, const godot_rect2 *p_self, const godot_rect2 *p_b) \
- GDAPI_FUNC(godot_rect2_merge, godot_rect2, const godot_rect2 *p_self, const godot_rect2 *p_b) \
- GDAPI_FUNC(godot_rect2_has_point, godot_bool, const godot_rect2 *p_self, const godot_vector2 *p_point) \
- GDAPI_FUNC(godot_rect2_grow, godot_rect2, const godot_rect2 *p_self, const godot_real p_by) \
- GDAPI_FUNC(godot_rect2_expand, godot_rect2, const godot_rect2 *p_self, const godot_vector2 *p_to) \
- GDAPI_FUNC(godot_rect2_operator_equal, godot_bool, const godot_rect2 *p_self, const godot_rect2 *p_b) \
- GDAPI_FUNC(godot_rect2_get_position, godot_vector2, const godot_rect2 *p_self) \
- GDAPI_FUNC(godot_rect2_get_size, godot_vector2, const godot_rect2 *p_self) \
- GDAPI_FUNC_VOID(godot_rect2_set_position, godot_rect2 *p_self, const godot_vector2 *p_pos) \
- GDAPI_FUNC_VOID(godot_rect2_set_size, godot_rect2 *p_self, const godot_vector2 *p_size) \
- GDAPI_FUNC_VOID(godot_rect3_new, godot_rect3 *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size) \
- GDAPI_FUNC(godot_rect3_get_position, godot_vector3, const godot_rect3 *p_self) \
- GDAPI_FUNC_VOID(godot_rect3_set_position, const godot_rect3 *p_self, const godot_vector3 *p_v) \
- GDAPI_FUNC(godot_rect3_get_size, godot_vector3, const godot_rect3 *p_self) \
- GDAPI_FUNC_VOID(godot_rect3_set_size, const godot_rect3 *p_self, const godot_vector3 *p_v) \
- GDAPI_FUNC(godot_rect3_as_string, godot_string, const godot_rect3 *p_self) \
- GDAPI_FUNC(godot_rect3_get_area, godot_real, const godot_rect3 *p_self) \
- GDAPI_FUNC(godot_rect3_has_no_area, godot_bool, const godot_rect3 *p_self) \
- GDAPI_FUNC(godot_rect3_has_no_surface, godot_bool, const godot_rect3 *p_self) \
- GDAPI_FUNC(godot_rect3_intersects, godot_bool, const godot_rect3 *p_self, const godot_rect3 *p_with) \
- GDAPI_FUNC(godot_rect3_encloses, godot_bool, const godot_rect3 *p_self, const godot_rect3 *p_with) \
- GDAPI_FUNC(godot_rect3_merge, godot_rect3, const godot_rect3 *p_self, const godot_rect3 *p_with) \
- GDAPI_FUNC(godot_rect3_intersection, godot_rect3, const godot_rect3 *p_self, const godot_rect3 *p_with) \
- GDAPI_FUNC(godot_rect3_intersects_plane, godot_bool, const godot_rect3 *p_self, const godot_plane *p_plane) \
- GDAPI_FUNC(godot_rect3_intersects_segment, godot_bool, const godot_rect3 *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to) \
- GDAPI_FUNC(godot_rect3_has_point, godot_bool, const godot_rect3 *p_self, const godot_vector3 *p_point) \
- GDAPI_FUNC(godot_rect3_get_support, godot_vector3, const godot_rect3 *p_self, const godot_vector3 *p_dir) \
- GDAPI_FUNC(godot_rect3_get_longest_axis, godot_vector3, const godot_rect3 *p_self) \
- GDAPI_FUNC(godot_rect3_get_longest_axis_index, godot_int, const godot_rect3 *p_self) \
- GDAPI_FUNC(godot_rect3_get_longest_axis_size, godot_real, const godot_rect3 *p_self) \
- GDAPI_FUNC(godot_rect3_get_shortest_axis, godot_vector3, const godot_rect3 *p_self) \
- GDAPI_FUNC(godot_rect3_get_shortest_axis_index, godot_int, const godot_rect3 *p_self) \
- GDAPI_FUNC(godot_rect3_get_shortest_axis_size, godot_real, const godot_rect3 *p_self) \
- GDAPI_FUNC(godot_rect3_expand, godot_rect3, const godot_rect3 *p_self, const godot_vector3 *p_to_point) \
- GDAPI_FUNC(godot_rect3_grow, godot_rect3, const godot_rect3 *p_self, const godot_real p_by) \
- GDAPI_FUNC(godot_rect3_get_endpoint, godot_vector3, const godot_rect3 *p_self, const godot_int p_idx) \
- GDAPI_FUNC(godot_rect3_operator_equal, godot_bool, const godot_rect3 *p_self, const godot_rect3 *p_b) \
- GDAPI_FUNC_VOID(godot_rid_new, godot_rid *r_dest) \
- GDAPI_FUNC(godot_rid_get_id, godot_int, const godot_rid *p_self) \
- GDAPI_FUNC_VOID(godot_rid_new_with_resource, godot_rid *r_dest, const godot_object *p_from) \
- GDAPI_FUNC(godot_rid_operator_equal, godot_bool, const godot_rid *p_self, const godot_rid *p_b) \
- GDAPI_FUNC(godot_rid_operator_less, godot_bool, const godot_rid *p_self, const godot_rid *p_b) \
- GDAPI_FUNC_VOID(godot_transform_new_with_axis_origin, godot_transform *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis, const godot_vector3 *p_origin) \
- GDAPI_FUNC_VOID(godot_transform_new, godot_transform *r_dest, const godot_basis *p_basis, const godot_vector3 *p_origin) \
- GDAPI_FUNC(godot_transform_get_basis, godot_basis, const godot_transform *p_self) \
- GDAPI_FUNC_VOID(godot_transform_set_basis, godot_transform *p_self, godot_basis *p_v) \
- GDAPI_FUNC(godot_transform_get_origin, godot_vector3, const godot_transform *p_self) \
- GDAPI_FUNC_VOID(godot_transform_set_origin, godot_transform *p_self, godot_vector3 *p_v) \
- GDAPI_FUNC(godot_transform_as_string, godot_string, const godot_transform *p_self) \
- GDAPI_FUNC(godot_transform_inverse, godot_transform, const godot_transform *p_self) \
- GDAPI_FUNC(godot_transform_affine_inverse, godot_transform, const godot_transform *p_self) \
- GDAPI_FUNC(godot_transform_orthonormalized, godot_transform, const godot_transform *p_self) \
- GDAPI_FUNC(godot_transform_rotated, godot_transform, const godot_transform *p_self, const godot_vector3 *p_axis, const godot_real p_phi) \
- GDAPI_FUNC(godot_transform_scaled, godot_transform, const godot_transform *p_self, const godot_vector3 *p_scale) \
- GDAPI_FUNC(godot_transform_translated, godot_transform, const godot_transform *p_self, const godot_vector3 *p_ofs) \
- GDAPI_FUNC(godot_transform_looking_at, godot_transform, const godot_transform *p_self, const godot_vector3 *p_target, const godot_vector3 *p_up) \
- GDAPI_FUNC(godot_transform_xform_plane, godot_plane, const godot_transform *p_self, const godot_plane *p_v) \
- GDAPI_FUNC(godot_transform_xform_inv_plane, godot_plane, const godot_transform *p_self, const godot_plane *p_v) \
- GDAPI_FUNC_VOID(godot_transform_new_identity, godot_transform *r_dest) \
- GDAPI_FUNC(godot_transform_operator_equal, godot_bool, const godot_transform *p_self, const godot_transform *p_b) \
- GDAPI_FUNC(godot_transform_operator_multiply, godot_transform, const godot_transform *p_self, const godot_transform *p_b) \
- GDAPI_FUNC(godot_transform_xform_vector3, godot_vector3, const godot_transform *p_self, const godot_vector3 *p_v) \
- GDAPI_FUNC(godot_transform_xform_inv_vector3, godot_vector3, const godot_transform *p_self, const godot_vector3 *p_v) \
- GDAPI_FUNC(godot_transform_xform_rect3, godot_rect3, const godot_transform *p_self, const godot_rect3 *p_v) \
- GDAPI_FUNC(godot_transform_xform_inv_rect3, godot_rect3, const godot_transform *p_self, const godot_rect3 *p_v) \
- GDAPI_FUNC_VOID(godot_transform2d_new, godot_transform2d *r_dest, const godot_real p_rot, const godot_vector2 *p_pos) \
- GDAPI_FUNC_VOID(godot_transform2d_new_axis_origin, godot_transform2d *r_dest, const godot_vector2 *p_x_axis, const godot_vector2 *p_y_axis, const godot_vector2 *p_origin) \
- GDAPI_FUNC(godot_transform2d_as_string, godot_string, const godot_transform2d *p_self) \
- GDAPI_FUNC(godot_transform2d_inverse, godot_transform2d, const godot_transform2d *p_self) \
- GDAPI_FUNC(godot_transform2d_affine_inverse, godot_transform2d, const godot_transform2d *p_self) \
- GDAPI_FUNC(godot_transform2d_get_rotation, godot_real, const godot_transform2d *p_self) \
- GDAPI_FUNC(godot_transform2d_get_origin, godot_vector2, const godot_transform2d *p_self) \
- GDAPI_FUNC(godot_transform2d_get_scale, godot_vector2, const godot_transform2d *p_self) \
- GDAPI_FUNC(godot_transform2d_orthonormalized, godot_transform2d, const godot_transform2d *p_self) \
- GDAPI_FUNC(godot_transform2d_rotated, godot_transform2d, const godot_transform2d *p_self, const godot_real p_phi) \
- GDAPI_FUNC(godot_transform2d_scaled, godot_transform2d, const godot_transform2d *p_self, const godot_vector2 *p_scale) \
- GDAPI_FUNC(godot_transform2d_translated, godot_transform2d, const godot_transform2d *p_self, const godot_vector2 *p_offset) \
- GDAPI_FUNC(godot_transform2d_xform_vector2, godot_vector2, const godot_transform2d *p_self, const godot_vector2 *p_v) \
- GDAPI_FUNC(godot_transform2d_xform_inv_vector2, godot_vector2, const godot_transform2d *p_self, const godot_vector2 *p_v) \
- GDAPI_FUNC(godot_transform2d_basis_xform_vector2, godot_vector2, const godot_transform2d *p_self, const godot_vector2 *p_v) \
- GDAPI_FUNC(godot_transform2d_basis_xform_inv_vector2, godot_vector2, const godot_transform2d *p_self, const godot_vector2 *p_v) \
- GDAPI_FUNC(godot_transform2d_interpolate_with, godot_transform2d, const godot_transform2d *p_self, const godot_transform2d *p_m, const godot_real p_c) \
- GDAPI_FUNC(godot_transform2d_operator_equal, godot_bool, const godot_transform2d *p_self, const godot_transform2d *p_b) \
- GDAPI_FUNC(godot_transform2d_operator_multiply, godot_transform2d, const godot_transform2d *p_self, const godot_transform2d *p_b) \
- GDAPI_FUNC_VOID(godot_transform2d_new_identity, godot_transform2d *r_dest) \
- GDAPI_FUNC(godot_transform2d_xform_rect2, godot_rect2, const godot_transform2d *p_self, const godot_rect2 *p_v) \
- GDAPI_FUNC(godot_transform2d_xform_inv_rect2, godot_rect2, const godot_transform2d *p_self, const godot_rect2 *p_v) \
- GDAPI_FUNC(godot_variant_get_type, godot_variant_type, const godot_variant *p_v) \
- GDAPI_FUNC_VOID(godot_variant_new_copy, godot_variant *r_dest, const godot_variant *p_src) \
- GDAPI_FUNC_VOID(godot_variant_new_nil, godot_variant *r_dest) \
- GDAPI_FUNC_VOID(godot_variant_new_bool, godot_variant *p_v, const godot_bool p_b) \
- GDAPI_FUNC_VOID(godot_variant_new_uint, godot_variant *r_dest, const uint64_t p_i) \
- GDAPI_FUNC_VOID(godot_variant_new_int, godot_variant *r_dest, const int64_t p_i) \
- GDAPI_FUNC_VOID(godot_variant_new_real, godot_variant *r_dest, const double p_r) \
- GDAPI_FUNC_VOID(godot_variant_new_string, godot_variant *r_dest, const godot_string *p_s) \
- GDAPI_FUNC_VOID(godot_variant_new_vector2, godot_variant *r_dest, const godot_vector2 *p_v2) \
- GDAPI_FUNC_VOID(godot_variant_new_rect2, godot_variant *r_dest, const godot_rect2 *p_rect2) \
- GDAPI_FUNC_VOID(godot_variant_new_vector3, godot_variant *r_dest, const godot_vector3 *p_v3) \
- GDAPI_FUNC_VOID(godot_variant_new_transform2d, godot_variant *r_dest, const godot_transform2d *p_t2d) \
- GDAPI_FUNC_VOID(godot_variant_new_plane, godot_variant *r_dest, const godot_plane *p_plane) \
- GDAPI_FUNC_VOID(godot_variant_new_quat, godot_variant *r_dest, const godot_quat *p_quat) \
- GDAPI_FUNC_VOID(godot_variant_new_rect3, godot_variant *r_dest, const godot_rect3 *p_rect3) \
- GDAPI_FUNC_VOID(godot_variant_new_basis, godot_variant *r_dest, const godot_basis *p_basis) \
- GDAPI_FUNC_VOID(godot_variant_new_transform, godot_variant *r_dest, const godot_transform *p_trans) \
- GDAPI_FUNC_VOID(godot_variant_new_color, godot_variant *r_dest, const godot_color *p_color) \
- GDAPI_FUNC_VOID(godot_variant_new_node_path, godot_variant *r_dest, const godot_node_path *p_np) \
- GDAPI_FUNC_VOID(godot_variant_new_rid, godot_variant *r_dest, const godot_rid *p_rid) \
- GDAPI_FUNC_VOID(godot_variant_new_object, godot_variant *r_dest, const godot_object *p_obj) \
- GDAPI_FUNC_VOID(godot_variant_new_dictionary, godot_variant *r_dest, const godot_dictionary *p_dict) \
- GDAPI_FUNC_VOID(godot_variant_new_array, godot_variant *r_dest, const godot_array *p_arr) \
- GDAPI_FUNC_VOID(godot_variant_new_pool_byte_array, godot_variant *r_dest, const godot_pool_byte_array *p_pba) \
- GDAPI_FUNC_VOID(godot_variant_new_pool_int_array, godot_variant *r_dest, const godot_pool_int_array *p_pia) \
- GDAPI_FUNC_VOID(godot_variant_new_pool_real_array, godot_variant *r_dest, const godot_pool_real_array *p_pra) \
- GDAPI_FUNC_VOID(godot_variant_new_pool_string_array, godot_variant *r_dest, const godot_pool_string_array *p_psa) \
- GDAPI_FUNC_VOID(godot_variant_new_pool_vector2_array, godot_variant *r_dest, const godot_pool_vector2_array *p_pv2a) \
- GDAPI_FUNC_VOID(godot_variant_new_pool_vector3_array, godot_variant *r_dest, const godot_pool_vector3_array *p_pv3a) \
- GDAPI_FUNC_VOID(godot_variant_new_pool_color_array, godot_variant *r_dest, const godot_pool_color_array *p_pca) \
- GDAPI_FUNC(godot_variant_as_bool, godot_bool, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_uint, uint64_t, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_int, int64_t, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_real, double, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_string, godot_string, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_vector2, godot_vector2, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_rect2, godot_rect2, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_vector3, godot_vector3, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_transform2d, godot_transform2d, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_plane, godot_plane, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_quat, godot_quat, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_rect3, godot_rect3, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_basis, godot_basis, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_transform, godot_transform, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_color, godot_color, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_node_path, godot_node_path, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_rid, godot_rid, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_object, godot_object *, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_dictionary, godot_dictionary, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_array, godot_array, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_pool_byte_array, godot_pool_byte_array, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_pool_int_array, godot_pool_int_array, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_pool_real_array, godot_pool_real_array, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_pool_string_array, godot_pool_string_array, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_pool_vector2_array, godot_pool_vector2_array, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_pool_vector3_array, godot_pool_vector3_array, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_as_pool_color_array, godot_pool_color_array, const godot_variant *p_self) \
- GDAPI_FUNC(godot_variant_call, godot_variant, godot_variant *p_self, const godot_string *p_method, const godot_variant **p_args, const godot_int p_argcount, godot_variant_call_error *r_error) \
- GDAPI_FUNC(godot_variant_has_method, godot_bool, const godot_variant *p_self, const godot_string *p_method) \
- GDAPI_FUNC(godot_variant_operator_equal, godot_bool, const godot_variant *p_self, const godot_variant *p_other) \
- GDAPI_FUNC(godot_variant_operator_less, godot_bool, const godot_variant *p_self, const godot_variant *p_other) \
- GDAPI_FUNC(godot_variant_hash_compare, godot_bool, const godot_variant *p_self, const godot_variant *p_other) \
- GDAPI_FUNC(godot_variant_booleanize, godot_bool, const godot_variant *p_self) \
- GDAPI_FUNC_VOID(godot_variant_destroy, godot_variant *p_self) \
- GDAPI_FUNC_VOID(godot_string_new, godot_string *r_dest) \
- GDAPI_FUNC_VOID(godot_string_new_copy, godot_string *r_dest, const godot_string *p_src) \
- GDAPI_FUNC_VOID(godot_string_new_data, godot_string *r_dest, const char *p_contents, const int p_size) \
- GDAPI_FUNC_VOID(godot_string_new_unicode_data, godot_string *r_dest, const wchar_t *p_contents, const int p_size) \
- GDAPI_FUNC_VOID(godot_string_get_data, const godot_string *p_self, char *p_dest, int *p_size) \
- GDAPI_FUNC(godot_string_operator_index, wchar_t *, godot_string *p_self, const godot_int p_idx) \
- GDAPI_FUNC(godot_string_c_str, const char *, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_unicode_str, const wchar_t *, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_operator_equal, godot_bool, const godot_string *p_self, const godot_string *p_b) \
- GDAPI_FUNC(godot_string_operator_less, godot_bool, const godot_string *p_self, const godot_string *p_b) \
- GDAPI_FUNC(godot_string_operator_plus, godot_string, const godot_string *p_self, const godot_string *p_b) \
- GDAPI_FUNC(godot_string_length, godot_int, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_begins_with, godot_bool, const godot_string *p_self, const godot_string *p_string) \
- GDAPI_FUNC(godot_string_begins_with_char_array, godot_bool, const godot_string *p_self, const char *p_char_array) \
- GDAPI_FUNC(godot_string_bigrams, godot_array, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_chr, godot_string, wchar_t p_character) \
- GDAPI_FUNC(godot_string_ends_with, godot_bool, const godot_string *p_self, const godot_string *p_string) \
- GDAPI_FUNC(godot_string_find, godot_int, const godot_string *p_self, godot_string p_what) \
- GDAPI_FUNC(godot_string_find_from, godot_int, const godot_string *p_self, godot_string p_what, godot_int p_from) \
- GDAPI_FUNC(godot_string_findmk, godot_int, const godot_string *p_self, const godot_array *p_keys) \
- GDAPI_FUNC(godot_string_findmk_from, godot_int, const godot_string *p_self, const godot_array *p_keys, godot_int p_from) \
- GDAPI_FUNC(godot_string_findmk_from_in_place, godot_int, const godot_string *p_self, const godot_array *p_keys, godot_int p_from, godot_int *r_key) \
- GDAPI_FUNC(godot_string_findn, godot_int, const godot_string *p_self, godot_string p_what) \
- GDAPI_FUNC(godot_string_findn_from, godot_int, const godot_string *p_self, godot_string p_what, godot_int p_from) \
- GDAPI_FUNC(godot_string_find_last, godot_int, const godot_string *p_self, godot_string p_what) \
- GDAPI_FUNC(godot_string_format, godot_string, const godot_string *p_self, const godot_variant *p_values) \
- GDAPI_FUNC(godot_string_format_with_custom_placeholder, godot_string, const godot_string *p_self, const godot_variant *p_values, const char *p_placeholder) \
- GDAPI_FUNC(godot_string_hex_encode_buffer, godot_string, const uint8_t *p_buffer, godot_int p_len) \
- GDAPI_FUNC(godot_string_hex_to_int, godot_int, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_hex_to_int_without_prefix, godot_int, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_insert, godot_string, const godot_string *p_self, godot_int p_at_pos, godot_string p_string) \
- GDAPI_FUNC(godot_string_is_numeric, godot_bool, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_is_subsequence_of, godot_bool, const godot_string *p_self, const godot_string *p_string) \
- GDAPI_FUNC(godot_string_is_subsequence_ofi, godot_bool, const godot_string *p_self, const godot_string *p_string) \
- GDAPI_FUNC(godot_string_lpad, godot_string, const godot_string *p_self, godot_int p_min_length) \
- GDAPI_FUNC(godot_string_lpad_with_custom_character, godot_string, const godot_string *p_self, godot_int p_min_length, const godot_string *p_character) \
- GDAPI_FUNC(godot_string_match, godot_bool, const godot_string *p_self, const godot_string *p_wildcard) \
- GDAPI_FUNC(godot_string_matchn, godot_bool, const godot_string *p_self, const godot_string *p_wildcard) \
- GDAPI_FUNC(godot_string_md5, godot_string, const uint8_t *p_md5) \
- GDAPI_FUNC(godot_string_num, godot_string, double p_num) \
- GDAPI_FUNC(godot_string_num_int64, godot_string, int64_t p_num, godot_int p_base) \
- GDAPI_FUNC(godot_string_num_int64_capitalized, godot_string, int64_t p_num, godot_int p_base, godot_bool p_capitalize_hex) \
- GDAPI_FUNC(godot_string_num_real, godot_string, double p_num) \
- GDAPI_FUNC(godot_string_num_scientific, godot_string, double p_num) \
- GDAPI_FUNC(godot_string_num_with_decimals, godot_string, double p_num, godot_int p_decimals) \
- GDAPI_FUNC(godot_string_pad_decimals, godot_string, const godot_string *p_self, godot_int p_digits) \
- GDAPI_FUNC(godot_string_pad_zeros, godot_string, const godot_string *p_self, godot_int p_digits) \
- GDAPI_FUNC(godot_string_replace_first, godot_string, const godot_string *p_self, godot_string p_key, godot_string p_with) \
- GDAPI_FUNC(godot_string_replace, godot_string, const godot_string *p_self, godot_string p_key, godot_string p_with) \
- GDAPI_FUNC(godot_string_replacen, godot_string, const godot_string *p_self, godot_string p_key, godot_string p_with) \
- GDAPI_FUNC(godot_string_rfind, godot_int, const godot_string *p_self, godot_string p_what) \
- GDAPI_FUNC(godot_string_rfindn, godot_int, const godot_string *p_self, godot_string p_what) \
- GDAPI_FUNC(godot_string_rfind_from, godot_int, const godot_string *p_self, godot_string p_what, godot_int p_from) \
- GDAPI_FUNC(godot_string_rfindn_from, godot_int, const godot_string *p_self, godot_string p_what, godot_int p_from) \
- GDAPI_FUNC(godot_string_rpad, godot_string, const godot_string *p_self, godot_int p_min_length) \
- GDAPI_FUNC(godot_string_rpad_with_custom_character, godot_string, const godot_string *p_self, godot_int p_min_length, const godot_string *p_character) \
- GDAPI_FUNC(godot_string_similarity, godot_real, const godot_string *p_self, const godot_string *p_string) \
- GDAPI_FUNC(godot_string_sprintf, godot_string, const godot_string *p_self, const godot_array *p_values, godot_bool *p_error) \
- GDAPI_FUNC(godot_string_substr, godot_string, const godot_string *p_self, godot_int p_from, godot_int p_chars) \
- GDAPI_FUNC(godot_string_to_double, double, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_to_float, godot_real, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_to_int, godot_int, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_camelcase_to_underscore, godot_string, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_camelcase_to_underscore_lowercased, godot_string, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_capitalize, godot_string, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_char_to_double, double, const char *p_what) \
- GDAPI_FUNC(godot_string_char_to_int, godot_int, const char *p_what) \
- GDAPI_FUNC(godot_string_wchar_to_int, int64_t, const wchar_t *p_str) \
- GDAPI_FUNC(godot_string_char_to_int_with_len, godot_int, const char *p_what, godot_int p_len) \
- GDAPI_FUNC(godot_string_char_to_int64_with_len, int64_t, const wchar_t *p_str, int p_len) \
- GDAPI_FUNC(godot_string_hex_to_int64, int64_t, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_hex_to_int64_with_prefix, int64_t, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_to_int64, int64_t, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_unicode_char_to_double, double, const wchar_t *p_str, const wchar_t **r_end) \
- GDAPI_FUNC(godot_string_get_slice_count, godot_int, const godot_string *p_self, godot_string p_splitter) \
- GDAPI_FUNC(godot_string_get_slice, godot_string, const godot_string *p_self, godot_string p_splitter, godot_int p_slice) \
- GDAPI_FUNC(godot_string_get_slicec, godot_string, const godot_string *p_self, wchar_t p_splitter, godot_int p_slice) \
- GDAPI_FUNC(godot_string_split, godot_array, const godot_string *p_self, const godot_string *p_splitter) \
- GDAPI_FUNC(godot_string_split_allow_empty, godot_array, const godot_string *p_self, const godot_string *p_splitter) \
- GDAPI_FUNC(godot_string_split_floats, godot_array, const godot_string *p_self, const godot_string *p_splitter) \
- GDAPI_FUNC(godot_string_split_floats_allows_empty, godot_array, const godot_string *p_self, const godot_string *p_splitter) \
- GDAPI_FUNC(godot_string_split_floats_mk, godot_array, const godot_string *p_self, const godot_array *p_splitters) \
- GDAPI_FUNC(godot_string_split_floats_mk_allows_empty, godot_array, const godot_string *p_self, const godot_array *p_splitters) \
- GDAPI_FUNC(godot_string_split_ints, godot_array, const godot_string *p_self, const godot_string *p_splitter) \
- GDAPI_FUNC(godot_string_split_ints_allows_empty, godot_array, const godot_string *p_self, const godot_string *p_splitter) \
- GDAPI_FUNC(godot_string_split_ints_mk, godot_array, const godot_string *p_self, const godot_array *p_splitters) \
- GDAPI_FUNC(godot_string_split_ints_mk_allows_empty, godot_array, const godot_string *p_self, const godot_array *p_splitters) \
- GDAPI_FUNC(godot_string_split_spaces, godot_array, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_char_lowercase, wchar_t, wchar_t p_char) \
- GDAPI_FUNC(godot_string_char_uppercase, wchar_t, wchar_t p_char) \
- GDAPI_FUNC(godot_string_to_lower, godot_string, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_to_upper, godot_string, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_get_basename, godot_string, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_get_extension, godot_string, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_left, godot_string, const godot_string *p_self, godot_int p_pos) \
- GDAPI_FUNC(godot_string_ord_at, wchar_t, const godot_string *p_self, godot_int p_idx) \
- GDAPI_FUNC(godot_string_plus_file, godot_string, const godot_string *p_self, const godot_string *p_file) \
- GDAPI_FUNC(godot_string_right, godot_string, const godot_string *p_self, godot_int p_pos) \
- GDAPI_FUNC(godot_string_strip_edges, godot_string, const godot_string *p_self, godot_bool p_left, godot_bool p_right) \
- GDAPI_FUNC(godot_string_strip_escapes, godot_string, const godot_string *p_self) \
- GDAPI_FUNC_VOID(godot_string_erase, godot_string *p_self, godot_int p_pos, godot_int p_chars) \
- GDAPI_FUNC_VOID(godot_string_ascii, godot_string *p_self, char *result) \
- GDAPI_FUNC_VOID(godot_string_ascii_extended, godot_string *p_self, char *result) \
- GDAPI_FUNC_VOID(godot_string_utf8, godot_string *p_self, char *result) \
- GDAPI_FUNC(godot_string_parse_utf8, godot_bool, godot_string *p_self, const char *p_utf8) \
- GDAPI_FUNC(godot_string_parse_utf8_with_len, godot_bool, godot_string *p_self, const char *p_utf8, godot_int p_len) \
- GDAPI_FUNC(godot_string_chars_to_utf8, godot_string, const char *p_utf8) \
- GDAPI_FUNC(godot_string_chars_to_utf8_with_len, godot_string, const char *p_utf8, godot_int p_len) \
- GDAPI_FUNC(godot_string_hash, uint32_t, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_hash64, uint64_t, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_hash_chars, uint32_t, const char *p_cstr) \
- GDAPI_FUNC(godot_string_hash_chars_with_len, uint32_t, const char *p_cstr, godot_int p_len) \
- GDAPI_FUNC(godot_string_hash_utf8_chars, uint32_t, const wchar_t *p_str) \
- GDAPI_FUNC(godot_string_hash_utf8_chars_with_len, uint32_t, const wchar_t *p_str, godot_int p_len) \
- GDAPI_FUNC(godot_string_md5_buffer, godot_pool_byte_array, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_md5_text, godot_string, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_sha256_buffer, godot_pool_byte_array, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_sha256_text, godot_string, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_empty, godot_bool, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_get_base_dir, godot_string, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_get_file, godot_string, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_humanize_size, godot_string, size_t p_size) \
- GDAPI_FUNC(godot_string_is_abs_path, godot_bool, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_is_rel_path, godot_bool, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_is_resource_file, godot_bool, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_path_to, godot_string, const godot_string *p_self, const godot_string *p_path) \
- GDAPI_FUNC(godot_string_path_to_file, godot_string, const godot_string *p_self, const godot_string *p_path) \
- GDAPI_FUNC(godot_string_simplify_path, godot_string, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_c_escape, godot_string, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_c_escape_multiline, godot_string, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_c_unescape, godot_string, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_http_escape, godot_string, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_http_unescape, godot_string, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_json_escape, godot_string, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_word_wrap, godot_string, const godot_string *p_self, godot_int p_chars_per_line) \
- GDAPI_FUNC(godot_string_xml_escape, godot_string, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_xml_escape_with_quotes, godot_string, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_xml_unescape, godot_string, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_percent_decode, godot_string, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_percent_encode, godot_string, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_is_valid_float, godot_bool, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_is_valid_hex_number, godot_bool, const godot_string *p_self, godot_bool p_with_prefix) \
- GDAPI_FUNC(godot_string_is_valid_html_color, godot_bool, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_is_valid_identifier, godot_bool, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_is_valid_integer, godot_bool, const godot_string *p_self) \
- GDAPI_FUNC(godot_string_is_valid_ip_address, godot_bool, const godot_string *p_self) \
- GDAPI_FUNC_VOID(godot_string_destroy, godot_string *p_self) \
- GDAPI_FUNC_VOID(godot_object_destroy, godot_object *p_o) \
- GDAPI_FUNC(godot_global_get_singleton, godot_object *, char *p_name) \
- GDAPI_FUNC(godot_get_stack_bottom, void *) \
- GDAPI_FUNC(godot_method_bind_get_method, godot_method_bind *, const char *p_classname, const char *p_methodname) \
- GDAPI_FUNC_VOID(godot_method_bind_ptrcall, godot_method_bind *p_method_bind, godot_object *p_instance, const void **p_args, void *p_ret) \
- GDAPI_FUNC(godot_method_bind_call, godot_variant, godot_method_bind *p_method_bind, godot_object *p_instance, const godot_variant **p_args, const int p_arg_count, godot_variant_call_error *p_call_error) \
- GDAPI_FUNC(godot_get_class_constructor, godot_class_constructor, const char *p_classname) \
- GDAPI_FUNC(godot_get_global_constants, godot_dictionary) \
- GDAPI_FUNC(godot_alloc, void *, int p_bytes) \
- GDAPI_FUNC(godot_realloc, void *, void *p_ptr, int p_bytes) \
- GDAPI_FUNC_VOID(godot_free, void *p_ptr) \
- GDAPI_FUNC_VOID(godot_print_error, const char *p_description, const char *p_function, const char *p_file, int p_line) \
- GDAPI_FUNC_VOID(godot_print_warning, const char *p_description, const char *p_function, const char *p_file, int p_line) \
- GDAPI_FUNC_VOID(godot_print, const godot_string *p_message) \
- GDAPI_FUNC_VOID(godot_nativescript_register_class, void *p_gdnative_handle, const char *p_name, const char *p_base, godot_instance_create_func p_create_func, godot_instance_destroy_func p_destroy_func) \
- GDAPI_FUNC_VOID(godot_nativescript_register_tool_class, void *p_gdnative_handle, const char *p_name, const char *p_base, godot_instance_create_func p_create_func, godot_instance_destroy_func p_destroy_func) \
- GDAPI_FUNC_VOID(godot_nativescript_register_method, void *p_gdnative_handle, const char *p_name, const char *p_function_name, godot_method_attributes p_attr, godot_instance_method p_method) \
- GDAPI_FUNC_VOID(godot_nativescript_register_property, void *p_gdnative_handle, const char *p_name, const char *p_path, godot_property_attributes *p_attr, godot_property_set_func p_set_func, godot_property_get_func p_get_func) \
- GDAPI_FUNC_VOID(godot_nativescript_register_signal, void *p_gdnative_handle, const char *p_name, const godot_signal *p_signal) \
- GDAPI_FUNC(godot_nativescript_get_userdata, void *, godot_object *p_instance)
-
-#define GDAPI_FUNC(name, ret_type, ...) \
- ret_type (*name)(__VA_ARGS__);
-#define GDAPI_FUNC_VOID(name, ...) \
- void (*name)(__VA_ARGS__);
-
-typedef struct godot_gdnative_api_struct {
- GODOT_GDNATIVE_API_FUNCTIONS
-} godot_gdnative_api_struct;
-
-#undef GDAPI_FUNC
-#undef GDAPI_FUNC_VOID
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // GODOT_GDNATIVE_API_STRUCT_H
diff --git a/modules/gdnative/include/nativescript/godot_nativescript.h b/modules/gdnative/include/nativescript/godot_nativescript.h
index 96f213ead7..8baff0fff9 100644
--- a/modules/gdnative/include/nativescript/godot_nativescript.h
+++ b/modules/gdnative/include/nativescript/godot_nativescript.h
@@ -36,42 +36,6 @@
extern "C" {
#endif
-#ifdef GDAPI_BUILT_IN
-#define GDAPI_EXPORT
-#endif
-
-#ifdef _WIN32
-#if defined(GDAPI_EXPORT)
-#define GDCALLINGCONV
-#define GDAPI __declspec(dllexport) GDCALLINGCONV
-#else
-#define GDCALLINGCONV
-#define GDAPI __declspec(dllimport) GDCALLINGCONV
-#endif
-#elif defined(__APPLE__)
-#include "TargetConditionals.h"
-#if TARGET_OS_IPHONE
-#define GDCALLINGCONV
-#define GDAPI
-#elif TARGET_OS_MAC
-#define GDCALLINGCONV __attribute__((sysv_abi))
-#define GDAPI GDCALLINGCONV
-#endif
-#else
-#define GDCALLINGCONV __attribute__((sysv_abi, visibility("default")))
-#define GDAPI GDCALLINGCONV
-#endif
-
-// This is for libraries *using* the header, NOT GODOT EXPOSING STUFF!!
-#ifdef _WIN32
-#define GDN_EXPORT __declspec(dllexport)
-#else
-#define GDN_EXPORT
-#endif
-
-#include <stdbool.h>
-#include <stdint.h>
-
typedef enum {
GODOT_METHOD_RPC_MODE_DISABLED,
GODOT_METHOD_RPC_MODE_REMOTE,
diff --git a/modules/gdnative/nativescript/SCsub b/modules/gdnative/nativescript/SCsub
index e980e40e8e..178afec64a 100644
--- a/modules/gdnative/nativescript/SCsub
+++ b/modules/gdnative/nativescript/SCsub
@@ -7,4 +7,7 @@ mod_env.add_source_files(env.modules_sources, "*.cpp")
mod_env.Append(CPPPATH='#modules/gdnative')
mod_env.Append(CPPFLAGS=['-DGDAPI_BUILT_IN'])
+if "platform" in env and env["platform"] in ["x11", "iphone"]:
+ env.Append(LINKFLAGS=["-rdynamic"])
+
Export('mod_env')
diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp
index fdd5a2ea19..9a956ff594 100644
--- a/modules/gdnative/nativescript/api_generator.cpp
+++ b/modules/gdnative/nativescript/api_generator.cpp
@@ -80,6 +80,7 @@ struct PropertyAPI {
String getter;
String setter;
String type;
+ int index;
};
struct ConstantAPI {
@@ -259,6 +260,8 @@ List<ClassAPI> generate_c_api_classes() {
property_api.type = get_type_name(p->get());
}
+ property_api.index = ClassDB::get_property_index(class_name, p->get().name);
+
if (!property_api.setter.empty() || !property_api.getter.empty()) {
class_api.properties.push_back(property_api);
}
@@ -395,7 +398,8 @@ static List<String> generate_c_api_json(const List<ClassAPI> &p_api) {
source.push_back("\t\t\t\t\"name\": \"" + e->get().name + "\",\n");
source.push_back("\t\t\t\t\"type\": \"" + e->get().type + "\",\n");
source.push_back("\t\t\t\t\"getter\": \"" + e->get().getter + "\",\n");
- source.push_back("\t\t\t\t\"setter\": \"" + e->get().setter + "\"\n");
+ source.push_back("\t\t\t\t\"setter\": \"" + e->get().setter + "\",\n");
+ source.push_back(String("\t\t\t\t\"index\": ") + itos(e->get().index) + "\n");
source.push_back(String("\t\t\t}") + (e->next() ? "," : "") + "\n");
}
source.push_back("\t\t],\n");
diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp
index 997c342045..059cd197d1 100644
--- a/modules/gdnative/register_types.cpp
+++ b/modules/gdnative/register_types.cpp
@@ -247,6 +247,7 @@ void unregister_gdnative_types() {
singleton_gdnatives[i]->terminate();
}
+ singleton_gdnatives.clear();
unregister_nativescript_types();
diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp
index aa39ad92c4..b0408917a4 100644
--- a/modules/gdscript/gd_editor.cpp
+++ b/modules/gdscript/gd_editor.cpp
@@ -1952,7 +1952,6 @@ static void _find_call_arguments(GDCompletionContext &context, const GDParser::N
//make sure identifier exists...
const GDParser::IdentifierNode *id = static_cast<const GDParser::IdentifierNode *>(op->arguments[1]);
-
if (op->arguments[0]->type == GDParser::Node::TYPE_SELF) {
//self, look up
@@ -2021,7 +2020,7 @@ static void _find_call_arguments(GDCompletionContext &context, const GDParser::N
base = script->get_native();
} else if (nc.is_valid()) {
- if (context.function && !context.function->_static) {
+ if (!(context.function && context.function->_static)) {
GDCompletionIdentifier ci;
ci.type = Variant::OBJECT;
diff --git a/modules/gdscript/gd_function.cpp b/modules/gdscript/gd_function.cpp
index df7b16c96e..ce503b62f2 100644
--- a/modules/gdscript/gd_function.cpp
+++ b/modules/gdscript/gd_function.cpp
@@ -41,11 +41,12 @@ Variant *GDFunction::_get_variant(int p_address, GDInstance *p_instance, GDScrip
switch ((p_address & ADDR_TYPE_MASK) >> ADDR_BITS) {
case ADDR_TYPE_SELF: {
-
- if (!p_instance) {
+#ifdef DEBUG_ENABLED
+ if (unlikely(!p_instance)) {
r_error = "Cannot access self without instance.";
return NULL;
}
+#endif
return &self;
} break;
case ADDR_TYPE_CLASS: {
@@ -53,18 +54,22 @@ Variant *GDFunction::_get_variant(int p_address, GDInstance *p_instance, GDScrip
return &p_script->_static_ref;
} break;
case ADDR_TYPE_MEMBER: {
- //member indexing is O(1)
- if (!p_instance) {
+#ifdef DEBUG_ENABLED
+ if (unlikely(!p_instance)) {
r_error = "Cannot access member without instance.";
return NULL;
}
+#endif
+ //member indexing is O(1)
return &p_instance->members[address];
} break;
case ADDR_TYPE_CLASS_CONSTANT: {
//todo change to index!
GDScript *o = p_script;
+#ifdef DEBUG_ENABLED
ERR_FAIL_INDEX_V(address, _global_names_count, NULL);
+#endif
const StringName *sn = &_global_names_ptr[address];
while (o) {
@@ -84,18 +89,22 @@ Variant *GDFunction::_get_variant(int p_address, GDInstance *p_instance, GDScrip
ERR_FAIL_V(NULL);
} break;
case ADDR_TYPE_LOCAL_CONSTANT: {
+#ifdef DEBUG_ENABLED
ERR_FAIL_INDEX_V(address, _constant_count, NULL);
+#endif
return &_constants_ptr[address];
} break;
case ADDR_TYPE_STACK:
case ADDR_TYPE_STACK_VARIABLE: {
+#ifdef DEBUG_ENABLED
ERR_FAIL_INDEX_V(address, _stack_size, NULL);
+#endif
return &p_stack[address];
} break;
case ADDR_TYPE_GLOBAL: {
-
+#ifdef DEBUG_ENABLED
ERR_FAIL_INDEX_V(address, GDScriptLanguage::get_singleton()->get_global_array_size(), NULL);
-
+#endif
return &GDScriptLanguage::get_singleton()->get_global_array()[address];
} break;
case ADDR_TYPE_NIL: {
@@ -161,8 +170,71 @@ static String _get_var_type(const Variant *p_type) {
return basestr;
}
+#if defined(__GNUC__) && !defined(__clang__)
+#define OPCODES_TABLE \
+ static const void *switch_table_ops[] = { \
+ &&OPCODE_OPERATOR, \
+ &&OPCODE_EXTENDS_TEST, \
+ &&OPCODE_SET, \
+ &&OPCODE_GET, \
+ &&OPCODE_SET_NAMED, \
+ &&OPCODE_GET_NAMED, \
+ &&OPCODE_SET_MEMBER, \
+ &&OPCODE_GET_MEMBER, \
+ &&OPCODE_ASSIGN, \
+ &&OPCODE_ASSIGN_TRUE, \
+ &&OPCODE_ASSIGN_FALSE, \
+ &&OPCODE_CONSTRUCT, \
+ &&OPCODE_CONSTRUCT_ARRAY, \
+ &&OPCODE_CONSTRUCT_DICTIONARY, \
+ &&OPCODE_CALL, \
+ &&OPCODE_CALL_RETURN, \
+ &&OPCODE_CALL_BUILT_IN, \
+ &&OPCODE_CALL_SELF, \
+ &&OPCODE_CALL_SELF_BASE, \
+ &&OPCODE_YIELD, \
+ &&OPCODE_YIELD_SIGNAL, \
+ &&OPCODE_YIELD_RESUME, \
+ &&OPCODE_JUMP, \
+ &&OPCODE_JUMP_IF, \
+ &&OPCODE_JUMP_IF_NOT, \
+ &&OPCODE_JUMP_TO_DEF_ARGUMENT, \
+ &&OPCODE_RETURN, \
+ &&OPCODE_ITERATE_BEGIN, \
+ &&OPCODE_ITERATE, \
+ &&OPCODE_ASSERT, \
+ &&OPCODE_BREAKPOINT, \
+ &&OPCODE_LINE, \
+ &&OPCODE_END \
+ };
+
+#define OPCODE(m_op) \
+ m_op:
+#define OPCODE_WHILE(m_test)
+#define OPCODES_END \
+ OPSEXIT:
+#define OPCODES_OUT \
+ OPSOUT:
+#define DISPATCH_OPCODE goto *switch_table_ops[_code_ptr[ip]]
+#define OPCODE_SWITCH(m_test) DISPATCH_OPCODE;
+#define OPCODE_BREAK goto OPSEXIT
+#define OPCODE_OUT goto OPSOUT
+#else
+#define OPCODES_TABLE
+#define OPCODE(m_op) case m_op:
+#define OPCODE_WHILE(m_test) while (m_test)
+#define OPCODES_END
+#define OPCODES_OUT
+#define DISPATCH_OPCODE continue
+#define OPCODE_SWITCH(m_test) switch (m_test)
+#define OPCODE_BREAK break
+#define OPCODE_OUT break
+#endif
+
Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_argcount, Variant::CallError &r_err, CallState *p_state) {
+ OPCODES_TABLE;
+
if (!_code_ptr) {
return Variant();
@@ -271,16 +343,23 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
if (ScriptDebugger::get_singleton())
GDScriptLanguage::get_singleton()->enter_function(p_instance, this, stack, &ip, &line);
-#define GD_ERR_BREAK(m_cond) ERR_BREAK(m_cond)
+#define GD_ERR_BREAK(m_cond) \
+ { \
+ if (unlikely(m_cond)) { \
+ _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition ' " _STR(m_cond) " ' is true. Breaking..:"); \
+ OPCODE_BREAK; \
+ } else \
+ _err_error_exists = false; \
+ }
#define CHECK_SPACE(m_space) \
- ERR_BREAK((ip + m_space) > _code_size)
+ GD_ERR_BREAK((ip + m_space) > _code_size)
#define GET_VARIANT_PTR(m_v, m_code_ofs) \
Variant *m_v; \
m_v = _get_variant(_code_ptr[ip + m_code_ofs], p_instance, _class, self, stack, err_text); \
- if (!m_v) \
- break;
+ if (unlikely(!m_v)) \
+ OPCODE_BREAK;
#else
#define GD_ERR_BREAK(m_cond)
@@ -306,15 +385,15 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
bool exit_ok = false;
#ifdef DEBUG_ENABLED
- while (ip < _code_size) {
+ OPCODE_WHILE(ip < _code_size) {
int last_opcode = _code_ptr[ip];
#else
- while (true) {
+ OPCODE_WHILE(true) {
#endif
- switch (_code_ptr[ip]) {
+ OPCODE_SWITCH(_code_ptr[ip]) {
- case OPCODE_OPERATOR: {
+ OPCODE(OPCODE_OPERATOR) {
CHECK_SPACE(5);
@@ -343,14 +422,14 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
} else {
err_text = "Invalid operands '" + Variant::get_type_name(a->get_type()) + "' and '" + Variant::get_type_name(b->get_type()) + "' in operator '" + Variant::get_operator_name(op) + "'.";
}
- break;
+ OPCODE_BREAK;
}
*dst = ret;
#endif
ip += 5;
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_EXTENDS_TEST: {
+ OPCODE(OPCODE_EXTENDS_TEST) {
CHECK_SPACE(4);
@@ -362,12 +441,12 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
if (a->get_type() != Variant::OBJECT || a->operator Object *() == NULL) {
err_text = "Left operand of 'is' is not an instance of anything.";
- break;
+ OPCODE_BREAK;
}
if (b->get_type() != Variant::OBJECT || b->operator Object *() == NULL) {
err_text = "Right operand of 'is' is not a class.";
- break;
+ OPCODE_BREAK;
}
#endif
Object *obj_A = *a;
@@ -405,7 +484,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
if (!nc) {
err_text = "Right operand of 'is' is not a class (type: '" + obj_B->get_class() + "').";
- break;
+ OPCODE_BREAK;
}
#endif
extends_ok = ClassDB::is_parent_class(obj_A->get_class_name(), nc->get_name());
@@ -413,9 +492,9 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
*dst = extends_ok;
ip += 4;
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_SET: {
+ OPCODE(OPCODE_SET) {
CHECK_SPACE(3);
@@ -435,13 +514,13 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
v = "of type '" + _get_var_type(index) + "'";
}
err_text = "Invalid set index " + v + " (on base: '" + _get_var_type(dst) + "').";
- break;
+ OPCODE_BREAK;
}
#endif
ip += 4;
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_GET: {
+ OPCODE(OPCODE_GET) {
CHECK_SPACE(3);
@@ -466,14 +545,14 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
v = "of type '" + _get_var_type(index) + "'";
}
err_text = "Invalid get index " + v + " (on base: '" + _get_var_type(src) + "').";
- break;
+ OPCODE_BREAK;
}
*dst = ret;
#endif
ip += 4;
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_SET_NAMED: {
+ OPCODE(OPCODE_SET_NAMED) {
CHECK_SPACE(3);
@@ -492,13 +571,13 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
if (!valid) {
String err_type;
err_text = "Invalid set index '" + String(*index) + "' (on base: '" + _get_var_type(dst) + "').";
- break;
+ OPCODE_BREAK;
}
#endif
ip += 4;
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_GET_NAMED: {
+ OPCODE(OPCODE_GET_NAMED) {
CHECK_SPACE(4);
@@ -525,14 +604,14 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
} else {
err_text = "Invalid get index '" + index->operator String() + "' (on base: '" + _get_var_type(src) + "').";
}
- break;
+ OPCODE_BREAK;
}
*dst = ret;
#endif
ip += 4;
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_SET_MEMBER: {
+ OPCODE(OPCODE_SET_MEMBER) {
CHECK_SPACE(3);
int indexname = _code_ptr[ip + 1];
@@ -545,16 +624,16 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
#ifdef DEBUG_ENABLED
if (!ok) {
err_text = "Internal error setting property: " + String(*index);
- break;
+ OPCODE_BREAK;
} else if (!valid) {
err_text = "Error setting property '" + String(*index) + "' with value of type " + Variant::get_type_name(src->get_type()) + ".";
- break;
+ OPCODE_BREAK;
}
#endif
ip += 3;
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_GET_MEMBER: {
+ OPCODE(OPCODE_GET_MEMBER) {
CHECK_SPACE(3);
int indexname = _code_ptr[ip + 1];
@@ -566,13 +645,13 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
#ifdef DEBUG_ENABLED
if (!ok) {
err_text = "Internal error getting property: " + String(*index);
- break;
+ OPCODE_BREAK;
}
#endif
ip += 3;
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_ASSIGN: {
+ OPCODE(OPCODE_ASSIGN) {
CHECK_SPACE(3);
GET_VARIANT_PTR(dst, 1);
@@ -581,9 +660,9 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
*dst = *src;
ip += 3;
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_ASSIGN_TRUE: {
+ OPCODE(OPCODE_ASSIGN_TRUE) {
CHECK_SPACE(2);
GET_VARIANT_PTR(dst, 1);
@@ -591,9 +670,9 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
*dst = true;
ip += 2;
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_ASSIGN_FALSE: {
+ OPCODE(OPCODE_ASSIGN_FALSE) {
CHECK_SPACE(2);
GET_VARIANT_PTR(dst, 1);
@@ -601,9 +680,9 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
*dst = false;
ip += 2;
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_CONSTRUCT: {
+ OPCODE(OPCODE_CONSTRUCT) {
CHECK_SPACE(2);
Variant::Type t = Variant::Type(_code_ptr[ip + 1]);
@@ -623,15 +702,15 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
if (err.error != Variant::CallError::CALL_OK) {
err_text = _get_call_error(err, "'" + Variant::get_type_name(t) + "' constructor", (const Variant **)argptrs);
- break;
+ OPCODE_BREAK;
}
#endif
ip += 4 + argc;
//construct a basic type
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_CONSTRUCT_ARRAY: {
+ OPCODE(OPCODE_CONSTRUCT_ARRAY) {
CHECK_SPACE(1);
int argc = _code_ptr[ip + 1];
@@ -649,9 +728,9 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
*dst = array;
ip += 3 + argc;
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_CONSTRUCT_DICTIONARY: {
+ OPCODE(OPCODE_CONSTRUCT_DICTIONARY) {
CHECK_SPACE(1);
int argc = _code_ptr[ip + 1];
@@ -671,10 +750,10 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
*dst = dict;
ip += 3 + argc * 2;
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_CALL_RETURN:
- case OPCODE_CALL: {
+ OPCODE(OPCODE_CALL_RETURN)
+ OPCODE(OPCODE_CALL) {
CHECK_SPACE(4);
bool call_ret = _code_ptr[ip] == OPCODE_CALL_RETURN;
@@ -736,24 +815,24 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
if (base->is_ref()) {
err_text = "Attempted to free a reference.";
- break;
+ OPCODE_BREAK;
} else if (base->get_type() == Variant::OBJECT) {
err_text = "Attempted to free a locked object (calling or emitting).";
- break;
+ OPCODE_BREAK;
}
}
}
err_text = _get_call_error(err, "function '" + methodstr + "' in base '" + basestr + "'", (const Variant **)argptrs);
- break;
+ OPCODE_BREAK;
}
#endif
//_call_func(NULL,base,*methodname,ip,argc,p_instance,stack);
ip += argc + 1;
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_CALL_BUILT_IN: {
+ OPCODE(OPCODE_CALL_BUILT_IN) {
CHECK_SPACE(4);
@@ -786,17 +865,17 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
} else {
err_text = _get_call_error(err, "built-in function '" + methodstr + "'", (const Variant **)argptrs);
}
- break;
+ OPCODE_BREAK;
}
#endif
ip += argc + 1;
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_CALL_SELF: {
+ OPCODE(OPCODE_CALL_SELF) {
- break;
+ OPCODE_BREAK;
}
- case OPCODE_CALL_SELF_BASE: {
+ OPCODE(OPCODE_CALL_SELF_BASE) {
CHECK_SPACE(2);
int self_fun = _code_ptr[ip + 1];
@@ -805,7 +884,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
if (self_fun < 0 || self_fun >= _global_names_count) {
err_text = "compiler bug, function name not found";
- break;
+ OPCODE_BREAK;
}
#endif
const StringName *methodname = &_global_names_ptr[self_fun];
@@ -865,14 +944,14 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
String methodstr = *methodname;
err_text = _get_call_error(err, "function '" + methodstr + "'", (const Variant **)argptrs);
- break;
+ OPCODE_BREAK;
}
ip += 4 + argc;
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_YIELD:
- case OPCODE_YIELD_SIGNAL: {
+ OPCODE(OPCODE_YIELD)
+ OPCODE(OPCODE_YIELD_SIGNAL) {
int ipofs = 1;
if (_code_ptr[ip] == OPCODE_YIELD_SIGNAL) {
@@ -913,11 +992,11 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
#ifdef DEBUG_ENABLED
if (argobj->get_type() != Variant::OBJECT) {
err_text = "First argument of yield() not of type object.";
- break;
+ OPCODE_BREAK;
}
if (argname->get_type() != Variant::STRING) {
err_text = "Second argument of yield() not a string (for signal name).";
- break;
+ OPCODE_BREAK;
}
#endif
Object *obj = argobj->operator Object *();
@@ -926,18 +1005,18 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
if (!obj) {
err_text = "First argument of yield() is null.";
- break;
+ OPCODE_BREAK;
}
if (ScriptDebugger::get_singleton()) {
if (!ObjectDB::instance_validate(obj)) {
err_text = "First argument of yield() is a previously freed instance.";
- break;
+ OPCODE_BREAK;
}
}
if (signal.length() == 0) {
err_text = "Second argument of yield() is an empty string (for signal name).";
- break;
+ OPCODE_BREAK;
}
#endif
@@ -945,38 +1024,38 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
#ifdef DEBUG_ENABLED
if (err != OK) {
err_text = "Error connecting to signal: " + signal + " during yield().";
- break;
+ OPCODE_BREAK;
}
#endif
}
exit_ok = true;
- break;
+ OPCODE_BREAK;
}
- case OPCODE_YIELD_RESUME: {
+ OPCODE(OPCODE_YIELD_RESUME) {
CHECK_SPACE(2);
#ifdef DEBUG_ENABLED
if (!p_state) {
err_text = ("Invalid Resume (bug?)");
- break;
+ OPCODE_BREAK;
}
#endif
GET_VARIANT_PTR(result, 1);
*result = p_state->result;
ip += 2;
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_JUMP: {
+ OPCODE(OPCODE_JUMP) {
CHECK_SPACE(2);
int to = _code_ptr[ip + 1];
GD_ERR_BREAK(to < 0 || to > _code_size);
ip = to;
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_JUMP_IF: {
+ OPCODE(OPCODE_JUMP_IF) {
CHECK_SPACE(3);
@@ -988,12 +1067,12 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
int to = _code_ptr[ip + 2];
GD_ERR_BREAK(to < 0 || to > _code_size);
ip = to;
- continue;
+ DISPATCH_OPCODE;
}
ip += 3;
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_JUMP_IF_NOT: {
+ OPCODE(OPCODE_JUMP_IF_NOT) {
CHECK_SPACE(3);
@@ -1005,26 +1084,26 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
int to = _code_ptr[ip + 2];
GD_ERR_BREAK(to < 0 || to > _code_size);
ip = to;
- continue;
+ DISPATCH_OPCODE;
}
ip += 3;
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_JUMP_TO_DEF_ARGUMENT: {
+ OPCODE(OPCODE_JUMP_TO_DEF_ARGUMENT) {
CHECK_SPACE(2);
ip = _default_arg_ptr[defarg];
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_RETURN: {
+ OPCODE(OPCODE_RETURN) {
CHECK_SPACE(2);
GET_VARIANT_PTR(r, 1);
retvalue = *r;
exit_ok = true;
- break;
+ OPCODE_BREAK;
}
- case OPCODE_ITERATE_BEGIN: {
+ OPCODE(OPCODE_ITERATE_BEGIN) {
CHECK_SPACE(8); //space for this a regular iterate
@@ -1036,13 +1115,13 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
#ifdef DEBUG_ENABLED
if (!valid) {
err_text = "Unable to iterate on object of type " + Variant::get_type_name(container->get_type()) + "'.";
- break;
+ OPCODE_BREAK;
}
#endif
int jumpto = _code_ptr[ip + 3];
GD_ERR_BREAK(jumpto < 0 || jumpto > _code_size);
ip = jumpto;
- continue;
+ DISPATCH_OPCODE;
}
GET_VARIANT_PTR(iterator, 4);
@@ -1050,13 +1129,13 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
#ifdef DEBUG_ENABLED
if (!valid) {
err_text = "Unable to obtain iterator object of type " + Variant::get_type_name(container->get_type()) + "'.";
- break;
+ OPCODE_BREAK;
}
#endif
ip += 5; //skip regular iterate which is always next
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_ITERATE: {
+ OPCODE(OPCODE_ITERATE) {
CHECK_SPACE(4);
@@ -1068,13 +1147,13 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
#ifdef DEBUG_ENABLED
if (!valid) {
err_text = "Unable to iterate on object of type " + Variant::get_type_name(container->get_type()) + "' (type changed since first iteration?).";
- break;
+ OPCODE_BREAK;
}
#endif
int jumpto = _code_ptr[ip + 3];
GD_ERR_BREAK(jumpto < 0 || jumpto > _code_size);
ip = jumpto;
- continue;
+ DISPATCH_OPCODE;
}
GET_VARIANT_PTR(iterator, 4);
@@ -1082,13 +1161,13 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
#ifdef DEBUG_ENABLED
if (!valid) {
err_text = "Unable to obtain iterator object of type " + Variant::get_type_name(container->get_type()) + "' (but was obtained on first iteration?).";
- break;
+ OPCODE_BREAK;
}
#endif
ip += 5; //loop again
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_ASSERT: {
+ OPCODE(OPCODE_ASSERT) {
CHECK_SPACE(2);
GET_VARIANT_PTR(test, 1);
@@ -1098,23 +1177,23 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
if (!result) {
err_text = "Assertion failed.";
- break;
+ OPCODE_BREAK;
}
#endif
ip += 2;
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_BREAKPOINT: {
+ OPCODE(OPCODE_BREAKPOINT) {
#ifdef DEBUG_ENABLED
if (ScriptDebugger::get_singleton()) {
GDScriptLanguage::get_singleton()->debug_break("Breakpoint Statement", true);
}
#endif
ip += 1;
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_LINE: {
+ OPCODE(OPCODE_LINE) {
CHECK_SPACE(2);
line = _code_ptr[ip + 1];
@@ -1141,23 +1220,26 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
ScriptDebugger::get_singleton()->line_poll();
}
- continue;
+ DISPATCH_OPCODE;
}
- case OPCODE_END: {
+ OPCODE(OPCODE_END) {
exit_ok = true;
- break;
+ OPCODE_BREAK;
}
+#if 0
default: {
err_text = "Illegal opcode " + itos(_code_ptr[ip]) + " at address " + itos(ip);
- break;
+ OPCODE_BREAK;
}
+#endif
}
+ OPCODES_END
#ifdef DEBUG_ENABLED
if (exit_ok)
- break;
+ OPCODE_OUT;
//error
// function, file, line, error, explanation
String err_file;
@@ -1182,9 +1264,10 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
}
#endif
- break;
+ OPCODE_OUT;
}
+ OPCODES_OUT
#ifdef DEBUG_ENABLED
if (GDScriptLanguage::get_singleton()->profiling) {
uint64_t time_taken = OS::get_singleton()->get_ticks_usec() - function_start_time;
@@ -1495,7 +1578,7 @@ void GDFunctionState::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_valid", "extended_check"), &GDFunctionState::is_valid, DEFVAL(false));
ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "_signal_callback", &GDFunctionState::_signal_callback, MethodInfo("_signal_callback"));
- ADD_SIGNAL(MethodInfo("completed", PropertyInfo(Variant::NIL, "result")));
+ ADD_SIGNAL(MethodInfo("completed", PropertyInfo(Variant::NIL, "result", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT)));
}
GDFunctionState::GDFunctionState() {
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp
index 4f7545a11d..4e8b67e4e8 100644
--- a/modules/gridmap/grid_map.cpp
+++ b/modules/gridmap/grid_map.cpp
@@ -769,6 +769,8 @@ void GridMap::_bind_methods() {
ClassDB::bind_method(D_METHOD("clear"), &GridMap::clear);
+ ClassDB::bind_method(D_METHOD("get_used_cells"), &GridMap::get_used_cells);
+
ClassDB::bind_method(D_METHOD("get_meshes"), &GridMap::get_meshes);
BIND_CONSTANT(INVALID_CELL_ITEM);
@@ -807,6 +809,19 @@ float GridMap::get_cell_scale() const {
return cell_scale;
}
+Array GridMap::get_used_cells() const {
+
+ Array a;
+ a.resize(cell_map.size());
+ int i = 0;
+ for (Map<IndexKey, Cell>::Element *E = cell_map.front(); E; E = E->next()) {
+ Vector3 p(E->key().x, E->key().y, E->key().z);
+ a[i++] = p;
+ }
+
+ return a;
+}
+
Array GridMap::get_meshes() {
if (theme.is_null())
diff --git a/modules/gridmap/grid_map.h b/modules/gridmap/grid_map.h
index eb1b215696..296956ff5d 100644
--- a/modules/gridmap/grid_map.h
+++ b/modules/gridmap/grid_map.h
@@ -223,6 +223,8 @@ public:
void set_cell_scale(float p_scale);
float get_cell_scale() const;
+ Array get_used_cells() const;
+
Array get_meshes();
void clear();
diff --git a/modules/mobile_vr/SCsub b/modules/mobile_vr/SCsub
new file mode 100644
index 0000000000..b4e2edcca1
--- /dev/null
+++ b/modules/mobile_vr/SCsub
@@ -0,0 +1,13 @@
+#!/usr/bin/env python
+
+import os
+import methods
+
+Import('env')
+Import('env_modules')
+
+env_mobile_vr = env_modules.Clone()
+
+env_mobile_vr.add_source_files(env.modules_sources, '*.cpp')
+
+SConscript("shaders/SCsub")
diff --git a/modules/mobile_vr/config.py b/modules/mobile_vr/config.py
new file mode 100644
index 0000000000..cf96c66125
--- /dev/null
+++ b/modules/mobile_vr/config.py
@@ -0,0 +1,12 @@
+def can_build(platform):
+ # should probably change this to only be true on iOS and Android
+ return True
+
+def configure(env):
+ pass
+
+def get_doc_classes():
+ return ["MobileVRInterface"]
+
+def get_doc_path():
+ return "doc_classes"
diff --git a/modules/mobile_vr/doc_classes/MobileVRInterface.xml b/modules/mobile_vr/doc_classes/MobileVRInterface.xml
new file mode 100644
index 0000000000..c945a99a9a
--- /dev/null
+++ b/modules/mobile_vr/doc_classes/MobileVRInterface.xml
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="MobileVRInterface" inherits="ARVRInterface" category="Core" version="3.0.alpha.custom_build">
+ <brief_description>
+ Generic mobile VR implementation
+ </brief_description>
+ <description>
+ This is a generic mobile VR implementation where you need to provide details about the phone and HMD used. It does not rely on any existing framework. This is the most basic interface we have. For the best effect you do need a mobile phone with a gyroscope and accelerometer.
+ Note that even though there is no positional tracking the camera will assume the headset is at a height of 1.85 meters.
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_display_to_lens" qualifiers="const">
+ <return type="float">
+ </return>
+ <description>
+ Returns the distance between the display and the lens.
+ </description>
+ </method>
+ <method name="get_display_width" qualifiers="const">
+ <return type="float">
+ </return>
+ <description>
+ Return the width of the LCD screen of the device.
+ </description>
+ </method>
+ <method name="get_iod" qualifiers="const">
+ <return type="float">
+ </return>
+ <description>
+ Returns the interocular distance.
+ </description>
+ </method>
+ <method name="get_k1" qualifiers="const">
+ <return type="float">
+ </return>
+ <description>
+ Returns the k1 lens constant.
+ </description>
+ </method>
+ <method name="get_k2" qualifiers="const">
+ <return type="float">
+ </return>
+ <description>
+ Retuns the k2 lens constant
+ </description>
+ </method>
+ <method name="get_oversample" qualifiers="const">
+ <return type="float">
+ </return>
+ <description>
+ Returns the oversampling setting.
+ </description>
+ </method>
+ <method name="set_display_to_lens">
+ <return type="void">
+ </return>
+ <argument index="0" name="display_to_lens" type="float">
+ </argument>
+ <description>
+ Sets the distance between display and the lens.
+ </description>
+ </method>
+ <method name="set_display_width">
+ <return type="void">
+ </return>
+ <argument index="0" name="display_width" type="float">
+ </argument>
+ <description>
+ Sets the width of the LCD screen of the device.
+ </description>
+ </method>
+ <method name="set_iod">
+ <return type="void">
+ </return>
+ <argument index="0" name="iod" type="float">
+ </argument>
+ <description>
+ Sets the interocular distance.
+ </description>
+ </method>
+ <method name="set_k1">
+ <return type="void">
+ </return>
+ <argument index="0" name="k" type="float">
+ </argument>
+ <description>
+ Sets the k1 lens constant.
+ </description>
+ </method>
+ <method name="set_k2">
+ <return type="void">
+ </return>
+ <argument index="0" name="k" type="float">
+ </argument>
+ <description>
+ Sets the k2 lens constant.
+ </description>
+ </method>
+ <method name="set_oversample">
+ <return type="void">
+ </return>
+ <argument index="0" name="oversample" type="float">
+ </argument>
+ <description>
+ Sets the oversampling setting.
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="display_to_lens" type="float" setter="set_display_to_lens" getter="get_display_to_lens">
+ The distance between the display and the lenses inside of the device in centimeters.
+ </member>
+ <member name="display_width" type="float" setter="set_display_width" getter="get_display_width">
+ The width of the display in centimeters.
+ </member>
+ <member name="iod" type="float" setter="set_iod" getter="get_iod">
+ The interocular distance, also known as the interpupillary distance. The distance between the pupils of the left and right eye.
+ </member>
+ <member name="k1" type="float" setter="set_k1" getter="get_k1">
+ The k1 lens factor is one of the two constants that define the strength of the lens used and directly influences the lens distortion effect.
+ </member>
+ <member name="k2" type="float" setter="set_k2" getter="get_k2">
+ The k2 lens factor, see k1.
+ </member>
+ <member name="oversample" type="float" setter="set_oversample" getter="get_oversample">
+ The oversample setting. Because of the lens distortion we have to render our buffers at a higher resolution then the screen can natively handle. A value between 1.5 and 2.0 often provides good results but at the cost of performance.
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/mobile_vr/mobile_interface.cpp b/modules/mobile_vr/mobile_interface.cpp
new file mode 100644
index 0000000000..eb87bb2cf0
--- /dev/null
+++ b/modules/mobile_vr/mobile_interface.cpp
@@ -0,0 +1,504 @@
+/*************************************************************************/
+/* mobile_interface.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "mobile_interface.h"
+#include "core/os/input.h"
+#include "core/os/os.h"
+#include "servers/visual/visual_server_global.h"
+
+StringName MobileVRInterface::get_name() const {
+ return "Native mobile";
+};
+
+int MobileVRInterface::get_capabilities() const {
+ return ARVRInterface::ARVR_STEREO;
+};
+
+Vector3 MobileVRInterface::scale_magneto(const Vector3 &p_magnetometer) {
+ // Our magnetometer doesn't give us nice clean data.
+ // Well it may on Mac OS X because we're getting a calibrated value in the current implementation but Android we're getting raw data.
+ // This is a fairly simple adjustment we can do to correct for the magnetometer data being elliptical
+
+ Vector3 mag_raw = p_magnetometer;
+ Vector3 mag_scaled = p_magnetometer;
+
+ // update our variables every x frames
+ if (mag_count > 20) {
+ mag_current_min = mag_next_min;
+ mag_current_max = mag_next_max;
+ mag_count = 0;
+ } else {
+ mag_count++;
+ };
+
+ // adjust our min and max
+ if (mag_raw.x > mag_next_max.x) mag_next_max.x = mag_raw.x;
+ if (mag_raw.y > mag_next_max.y) mag_next_max.y = mag_raw.y;
+ if (mag_raw.z > mag_next_max.z) mag_next_max.z = mag_raw.z;
+
+ if (mag_raw.x < mag_next_min.x) mag_next_min.x = mag_raw.x;
+ if (mag_raw.y < mag_next_min.y) mag_next_min.y = mag_raw.y;
+ if (mag_raw.z < mag_next_min.z) mag_next_min.z = mag_raw.z;
+
+ // scale our x, y and z
+ if (!(mag_current_max.x - mag_current_min.x)) {
+ mag_raw.x -= (mag_current_min.x + mag_current_max.x) / 2.0;
+ mag_scaled.x = (mag_raw.x - mag_current_min.x) / ((mag_current_max.x - mag_current_min.x) * 2.0 - 1.0);
+ };
+
+ if (!(mag_current_max.y - mag_current_min.y)) {
+ mag_raw.y -= (mag_current_min.y + mag_current_max.y) / 2.0;
+ mag_scaled.y = (mag_raw.y - mag_current_min.y) / ((mag_current_max.y - mag_current_min.y) * 2.0 - 1.0);
+ };
+
+ if (!(mag_current_max.z - mag_current_min.z)) {
+ mag_raw.z -= (mag_current_min.z + mag_current_max.z) / 2.0;
+ mag_scaled.z = (mag_raw.z - mag_current_min.z) / ((mag_current_max.z - mag_current_min.z) * 2.0 - 1.0);
+ };
+
+ return mag_scaled;
+};
+
+Basis MobileVRInterface::combine_acc_mag(const Vector3 &p_grav, const Vector3 &p_magneto) {
+ // yup, stock standard cross product solution...
+ Vector3 up = -p_grav.normalized();
+
+ Vector3 magneto_east = up.cross(p_magneto.normalized()); // or is this west?, but should be horizon aligned now
+ magneto_east.normalize();
+
+ Vector3 magneto = up.cross(magneto_east); // and now we have a horizon aligned north
+ magneto.normalize();
+
+ // We use our gravity and magnetometer vectors to construct our matrix
+ Basis acc_mag_m3;
+ acc_mag_m3.elements[0] = -magneto_east;
+ acc_mag_m3.elements[1] = up;
+ acc_mag_m3.elements[2] = magneto;
+
+ return acc_mag_m3;
+};
+
+void MobileVRInterface::set_position_from_sensors() {
+ _THREAD_SAFE_METHOD_
+
+ // this is a helper function that attempts to adjust our transform using our 9dof sensors
+ // 9dof is a misleading marketing term coming from 3 accelerometer axis + 3 gyro axis + 3 magnetometer axis = 9 axis
+ // but in reality this only offers 3 dof (yaw, pitch, roll) orientation
+
+ uint64_t ticks = OS::get_singleton()->get_ticks_usec();
+ uint64_t ticks_elapsed = ticks - last_ticks;
+ float delta_time = (double)ticks_elapsed / 1000000.0;
+
+ // few things we need
+ Input *input = Input::get_singleton();
+ Vector3 down(0.0, -1.0, 0.0); // Down is Y negative
+ Vector3 north(0.0, 0.0, 1.0); // North is Z positive
+
+ // make copies of our inputs
+ Vector3 acc = input->get_accelerometer();
+ Vector3 gyro = input->get_gyroscope();
+ Vector3 grav = input->get_gravity();
+ Vector3 magneto = scale_magneto(input->get_magnetometer()); // this may be overkill on iOS because we're already getting a calibrated magnetometer reading
+
+ if (sensor_first) {
+ sensor_first = false;
+ } else {
+ acc = scrub(acc, last_accerometer_data, 2, 0.2);
+ magneto = scrub(magneto, last_magnetometer_data, 3, 0.3);
+ };
+
+ last_accerometer_data = acc;
+ last_magnetometer_data = magneto;
+
+ if (grav.length() < 0.1) {
+ // not ideal but use our accelerometer, this will contain shakey shakey user behaviour
+ // maybe look into some math but I'm guessing that if this isn't available, its because we lack the gyro sensor to actually work out
+ // what a stable gravity vector is
+ grav = acc;
+ if (grav.length() > 0.1) {
+ has_gyro = true;
+ };
+ } else {
+ has_gyro = true;
+ };
+
+ bool has_magneto = magneto.length() > 0.1;
+ bool has_grav = grav.length() > 0.1;
+
+#ifdef ANDROID_ENABLED
+ ///@TODO needs testing, i don't have a gyro, potentially can be removed depending on what comes out of issue #8101
+ // On Android x and z axis seem inverted
+ gyro.x = -gyro.x;
+ gyro.z = -gyro.z;
+ grav.x = -grav.x;
+ grav.z = -grav.z;
+ magneto.x = -magneto.x;
+ magneto.z = -magneto.z;
+#endif
+
+ if (has_gyro) {
+ // start with applying our gyro (do NOT smooth our gyro!)
+ Basis rotate;
+ rotate.rotate(orientation.get_axis(0), gyro.x * delta_time);
+ rotate.rotate(orientation.get_axis(1), gyro.y * delta_time);
+ rotate.rotate(orientation.get_axis(2), gyro.z * delta_time);
+ orientation = rotate * orientation;
+
+ tracking_state = ARVRInterface::ARVR_NORMAL_TRACKING;
+ };
+
+ ///@TODO improve this, the magnetometer is very fidgity sometimes flipping the axis for no apparent reason (probably a bug on my part)
+ // if you have a gyro + accelerometer that combo tends to be better then combining all three but without a gyro you need the magnetometer..
+ if (has_magneto && has_grav && !has_gyro) {
+ // convert to quaternions, easier to smooth those out
+ Quat transform_quat(orientation);
+ Quat acc_mag_quat(combine_acc_mag(grav, magneto));
+ transform_quat = transform_quat.slerp(acc_mag_quat, 0.1);
+ orientation = Basis(transform_quat);
+
+ tracking_state = ARVRInterface::ARVR_NORMAL_TRACKING;
+ } else if (has_grav) {
+ // use gravity vector to make sure down is down...
+ // transform gravity into our world space
+ grav.normalize();
+ Vector3 grav_adj = orientation.xform(grav);
+ float dot = grav_adj.dot(down);
+ if ((dot > -1.0) && (dot < 1.0)) {
+ // axis around which we have this rotation
+ Vector3 axis = grav_adj.cross(down);
+ axis.normalize();
+
+ Basis drift_compensation(axis, acos(dot) * delta_time * 10);
+ orientation = drift_compensation * orientation;
+ };
+ };
+
+ // JIC
+ orientation.orthonormalize();
+
+ last_ticks = ticks;
+};
+
+void MobileVRInterface::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_iod", "iod"), &MobileVRInterface::set_iod);
+ ClassDB::bind_method(D_METHOD("get_iod"), &MobileVRInterface::get_iod);
+
+ ClassDB::bind_method(D_METHOD("set_display_width", "display_width"), &MobileVRInterface::set_display_width);
+ ClassDB::bind_method(D_METHOD("get_display_width"), &MobileVRInterface::get_display_width);
+
+ ClassDB::bind_method(D_METHOD("set_display_to_lens", "display_to_lens"), &MobileVRInterface::set_display_to_lens);
+ ClassDB::bind_method(D_METHOD("get_display_to_lens"), &MobileVRInterface::get_display_to_lens);
+
+ ClassDB::bind_method(D_METHOD("set_oversample", "oversample"), &MobileVRInterface::set_oversample);
+ ClassDB::bind_method(D_METHOD("get_oversample"), &MobileVRInterface::get_oversample);
+
+ ClassDB::bind_method(D_METHOD("set_k1", "k"), &MobileVRInterface::set_k1);
+ ClassDB::bind_method(D_METHOD("get_k1"), &MobileVRInterface::get_k1);
+
+ ClassDB::bind_method(D_METHOD("set_k2", "k"), &MobileVRInterface::set_k2);
+ ClassDB::bind_method(D_METHOD("get_k2"), &MobileVRInterface::get_k2);
+
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "iod", PROPERTY_HINT_RANGE, "4.0,10.0,0.1"), "set_iod", "get_iod");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "display_width", PROPERTY_HINT_RANGE, "5.0,25.0,0.1"), "set_display_width", "get_display_width");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "display_to_lens", PROPERTY_HINT_RANGE, "5.0,25.0,0.1"), "set_display_to_lens", "get_display_to_lens");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "oversample", PROPERTY_HINT_RANGE, "1.0,2.0,0.1"), "set_oversample", "get_oversample");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "k1", PROPERTY_HINT_RANGE, "0.1,10.0,0.0001"), "set_k1", "get_k1");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "k2", PROPERTY_HINT_RANGE, "0.1,10.0,0.0001"), "set_k2", "get_k2");
+}
+
+void MobileVRInterface::set_iod(const real_t p_iod) {
+ intraocular_dist = p_iod;
+};
+
+real_t MobileVRInterface::get_iod() const {
+ return intraocular_dist;
+};
+
+void MobileVRInterface::set_display_width(const real_t p_display_width) {
+ display_width = p_display_width;
+};
+
+real_t MobileVRInterface::get_display_width() const {
+ return display_width;
+};
+
+void MobileVRInterface::set_display_to_lens(const real_t p_display_to_lens) {
+ display_to_lens = p_display_to_lens;
+};
+
+real_t MobileVRInterface::get_display_to_lens() const {
+ return display_to_lens;
+};
+
+void MobileVRInterface::set_oversample(const real_t p_oversample) {
+ oversample = p_oversample;
+};
+
+real_t MobileVRInterface::get_oversample() const {
+ return oversample;
+};
+
+void MobileVRInterface::set_k1(const real_t p_k1) {
+ k1 = p_k1;
+};
+
+real_t MobileVRInterface::get_k1() const {
+ return k1;
+};
+
+void MobileVRInterface::set_k2(const real_t p_k2) {
+ k2 = p_k2;
+};
+
+real_t MobileVRInterface::get_k2() const {
+ return k2;
+};
+
+bool MobileVRInterface::is_stereo() {
+ // needs stereo...
+ return true;
+};
+
+bool MobileVRInterface::is_initialized() {
+ return (initialized);
+};
+
+bool MobileVRInterface::initialize() {
+ ARVRServer *arvr_server = ARVRServer::get_singleton();
+ ERR_FAIL_NULL_V(arvr_server, false);
+
+ if (!initialized) {
+ // reset our sensor data and orientation
+ mag_count = 0;
+ has_gyro = false;
+ sensor_first = true;
+ mag_next_min = Vector3(10000, 10000, 10000);
+ mag_next_max = Vector3(-10000, -10000, -10000);
+ mag_current_min = Vector3(0, 0, 0);
+ mag_current_max = Vector3(0, 0, 0);
+
+ // reset our orientation
+ orientation = Basis();
+
+ // make this our primary interface
+ arvr_server->set_primary_interface(this);
+
+ last_ticks = OS::get_singleton()->get_ticks_usec();
+ ;
+ initialized = true;
+ };
+
+ return true;
+};
+
+void MobileVRInterface::uninitialize() {
+ if (initialized) {
+ ARVRServer *arvr_server = ARVRServer::get_singleton();
+ if (arvr_server != NULL) {
+ // no longer our primary interface
+ arvr_server->clear_primary_interface_if(this);
+ }
+
+ initialized = false;
+ };
+};
+
+Size2 MobileVRInterface::get_recommended_render_targetsize() {
+ _THREAD_SAFE_METHOD_
+
+ // we use half our window size
+ Size2 target_size = OS::get_singleton()->get_window_size();
+ target_size.x *= 0.5 * oversample;
+ target_size.y *= oversample;
+
+ return target_size;
+};
+
+Transform MobileVRInterface::get_transform_for_eye(ARVRInterface::Eyes p_eye, const Transform &p_cam_transform) {
+ _THREAD_SAFE_METHOD_
+
+ Transform transform_for_eye;
+
+ ARVRServer *arvr_server = ARVRServer::get_singleton();
+ ERR_FAIL_NULL_V(arvr_server, transform_for_eye);
+
+ if (initialized) {
+ float world_scale = arvr_server->get_world_scale();
+
+ // we don't need to check for the existance of our HMD, doesn't effect our values...
+ // note * 0.01 to convert cm to m and * 0.5 as we're moving half in each direction...
+ if (p_eye == ARVRInterface::EYE_LEFT) {
+ transform_for_eye.origin.x = -(intraocular_dist * 0.01 * 0.5 * world_scale);
+ } else if (p_eye == ARVRInterface::EYE_RIGHT) {
+ transform_for_eye.origin.x = intraocular_dist * 0.01 * 0.5 * world_scale;
+ } else {
+ // for mono we don't reposition, we want our center position.
+ };
+
+ // just scale our origin point of our transform
+ Transform hmd_transform;
+ hmd_transform.basis = orientation;
+ hmd_transform.origin = Vector3(0.0, eye_height * world_scale, 0.0);
+
+ transform_for_eye = p_cam_transform * (arvr_server->get_reference_frame()) * hmd_transform * transform_for_eye;
+ } else {
+ // huh? well just return what we got....
+ transform_for_eye = p_cam_transform;
+ };
+
+ return transform_for_eye;
+};
+
+CameraMatrix MobileVRInterface::get_projection_for_eye(ARVRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far) {
+ _THREAD_SAFE_METHOD_
+
+ CameraMatrix eye;
+
+ if (p_eye == ARVRInterface::EYE_MONO) {
+ ///@TODO for now hardcode some of this, what is really needed here is that this needs to be in sync with the real cameras properties
+ // which probably means implementing a specific class for iOS and Android. For now this is purely here as an example.
+ // Note also that if you use a normal viewport with AR/VR turned off you can still use the tracker output of this interface
+ // to position a stock standard Godot camera and have control over this.
+ // This will make more sense when we implement ARkit on iOS (probably a separate interface).
+ eye.set_perspective(60.0, p_aspect, p_z_near, p_z_far, false);
+ } else {
+ eye.set_for_hmd(p_eye == ARVRInterface::EYE_LEFT ? 1 : 2, p_aspect, intraocular_dist, display_width, display_to_lens, oversample, p_z_near, p_z_far);
+ };
+
+ return eye;
+};
+
+void MobileVRInterface::commit_for_eye(ARVRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) {
+ _THREAD_SAFE_METHOD_
+
+ // We must have a valid render target
+ ERR_FAIL_COND(!p_render_target.is_valid());
+
+ // Because we are rendering to our device we must use our main viewport!
+ ERR_FAIL_COND(p_screen_rect == Rect2());
+
+ float offset_x = 0.0;
+ float aspect_ratio = 0.5 * p_screen_rect.size.x / p_screen_rect.size.y;
+ Vector2 eye_center;
+
+ if (p_eye == ARVRInterface::EYE_LEFT) {
+ offset_x = -1.0;
+ eye_center.x = ((-intraocular_dist / 2.0) + (display_width / 4.0)) / (display_width / 2.0);
+ } else if (p_eye == ARVRInterface::EYE_RIGHT) {
+ eye_center.x = ((intraocular_dist / 2.0) - (display_width / 4.0)) / (display_width / 2.0);
+ }
+
+ // unset our render target so we are outputting to our main screen by making RasterizerStorageGLES3::system_fbo our current FBO
+ VSG::rasterizer->set_current_render_target(RID());
+
+ // now output to screen
+ // VSG::rasterizer->blit_render_target_to_screen(p_render_target, screen_rect, 0);
+
+ // get our render target
+ RID eye_texture = VSG::storage->render_target_get_texture(p_render_target);
+ uint32_t texid = VS::get_singleton()->texture_get_texid(eye_texture);
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, texid);
+
+ lens_shader.bind();
+ lens_shader.set_uniform(LensDistortedShaderGLES3::OFFSET_X, offset_x);
+ lens_shader.set_uniform(LensDistortedShaderGLES3::K1, k1);
+ lens_shader.set_uniform(LensDistortedShaderGLES3::K2, k2);
+ lens_shader.set_uniform(LensDistortedShaderGLES3::EYE_CENTER, eye_center);
+ lens_shader.set_uniform(LensDistortedShaderGLES3::UPSCALE, oversample);
+ lens_shader.set_uniform(LensDistortedShaderGLES3::ASPECT_RATIO, aspect_ratio);
+
+ glBindVertexArray(half_screen_array);
+ glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+ glBindVertexArray(0);
+};
+
+void MobileVRInterface::process() {
+ _THREAD_SAFE_METHOD_
+
+ if (initialized) {
+ set_position_from_sensors();
+ };
+};
+
+MobileVRInterface::MobileVRInterface() {
+ initialized = false;
+
+ // Just set some defaults for these. At some point we need to look at adding a lookup table for common device + headset combos and/or support reading cardboard QR codes
+ eye_height = 1.85;
+ intraocular_dist = 6.0;
+ display_width = 14.5;
+ display_to_lens = 4.0;
+ oversample = 1.5;
+ k1 = 0.215;
+ k2 = 0.215;
+ last_ticks = 0;
+
+ // create our shader stuff
+ lens_shader.init();
+
+ {
+ glGenBuffers(1, &half_screen_quad);
+ glBindBuffer(GL_ARRAY_BUFFER, half_screen_quad);
+ {
+ const float qv[16] = {
+ 0, -1,
+ -1, -1,
+ 0, 1,
+ -1, 1,
+ 1, 1,
+ 1, 1,
+ 1, -1,
+ 1, -1,
+ };
+
+ glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 16, qv, GL_STATIC_DRAW);
+ }
+
+ glBindBuffer(GL_ARRAY_BUFFER, 0); //unbind
+
+ glGenVertexArrays(1, &half_screen_array);
+ glBindVertexArray(half_screen_array);
+ glBindBuffer(GL_ARRAY_BUFFER, half_screen_quad);
+ glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, 0);
+ glEnableVertexAttribArray(0);
+ glVertexAttribPointer(VS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, ((uint8_t *)NULL) + 8);
+ glEnableVertexAttribArray(4);
+ glBindVertexArray(0);
+ glBindBuffer(GL_ARRAY_BUFFER, 0); //unbind
+ }
+};
+
+MobileVRInterface::~MobileVRInterface() {
+ // and make sure we cleanup if we haven't already
+ if (is_initialized()) {
+ uninitialize();
+ };
+};
diff --git a/modules/mobile_vr/mobile_interface.h b/modules/mobile_vr/mobile_interface.h
new file mode 100644
index 0000000000..6a5e01c163
--- /dev/null
+++ b/modules/mobile_vr/mobile_interface.h
@@ -0,0 +1,152 @@
+/*************************************************************************/
+/* mobile_interface.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef MOBILE_VR_INTERFACE_H
+#define MOBILE_VR_INTERFACE_H
+
+#include "servers/arvr/arvr_interface.h"
+#include "servers/arvr/arvr_positional_tracker.h"
+
+#include "shaders/lens_distorted.glsl.gen.h"
+
+/**
+ @author Bastiaan Olij <mux213@gmail.com>
+
+ The mobile interface is a native VR interface that can be used on Android and iOS phones.
+ It contains a basic implementation supporting 3DOF tracking if a gyroscope and accelerometer are
+ present and sets up the proper projection matrices based on the values provided.
+
+ We're planning to eventually do separate interfaces towards mobile SDKs that have far more capabilities and
+ do not rely on the user providing most of these settings (though enhancing this with auto detection features
+ based on the device we're running on would be cool). I'm mostly adding this as an example or base plate for
+ more advanced interfaces.
+*/
+
+class MobileVRInterface : public ARVRInterface {
+ GDCLASS(MobileVRInterface, ARVRInterface);
+
+private:
+ bool initialized;
+ Basis orientation;
+ float eye_height;
+ uint64_t last_ticks;
+
+ LensDistortedShaderGLES3 lens_shader;
+ GLuint half_screen_quad;
+ GLuint half_screen_array;
+
+ real_t intraocular_dist;
+ real_t display_width;
+ real_t display_to_lens;
+ real_t oversample;
+
+ //@TODO not yet used, these are needed in our distortion shader...
+ real_t k1;
+ real_t k2;
+
+ /*
+ logic for processing our sensor data, this was originally in our positional tracker logic but I think
+ that doesn't make sense in hindsight. It only makes marginally more sense to park it here for now,
+ this probably deserves an object of its own
+ */
+ Vector3 scale_magneto(const Vector3 &p_magnetometer);
+ Basis combine_acc_mag(const Vector3 &p_grav, const Vector3 &p_magneto);
+
+ int mag_count;
+ bool has_gyro;
+ bool sensor_first;
+ Vector3 last_accerometer_data;
+ Vector3 last_magnetometer_data;
+ Vector3 mag_current_min;
+ Vector3 mag_current_max;
+ Vector3 mag_next_min;
+ Vector3 mag_next_max;
+
+ ///@TODO a few support functions for trackers, most are math related and should likely be moved elsewhere
+ float floor_decimals(float p_value, float p_decimals) {
+ float power_of_10 = pow(10.0, p_decimals);
+ return floor(p_value * power_of_10) / power_of_10;
+ };
+
+ Vector3 floor_decimals(const Vector3 &p_vector, float p_decimals) {
+ return Vector3(floor_decimals(p_vector.x, p_decimals), floor_decimals(p_vector.y, p_decimals), floor_decimals(p_vector.z, p_decimals));
+ };
+
+ Vector3 low_pass(const Vector3 &p_vector, const Vector3 &p_last_vector, float p_factor) {
+ return p_vector + (p_factor * (p_last_vector - p_vector));
+ };
+
+ Vector3 scrub(const Vector3 &p_vector, const Vector3 &p_last_vector, float p_decimals, float p_factor) {
+ return low_pass(floor_decimals(p_vector, p_decimals), p_last_vector, p_factor);
+ };
+
+ void set_position_from_sensors();
+
+protected:
+ static void _bind_methods();
+
+public:
+ void set_iod(const real_t p_iod);
+ real_t get_iod() const;
+
+ void set_display_width(const real_t p_display_width);
+ real_t get_display_width() const;
+
+ void set_display_to_lens(const real_t p_display_to_lens);
+ real_t get_display_to_lens() const;
+
+ void set_oversample(const real_t p_oversample);
+ real_t get_oversample() const;
+
+ void set_k1(const real_t p_k1);
+ real_t get_k1() const;
+
+ void set_k2(const real_t p_k2);
+ real_t get_k2() const;
+
+ virtual StringName get_name() const;
+ virtual int get_capabilities() const;
+
+ virtual bool is_initialized();
+ virtual bool initialize();
+ virtual void uninitialize();
+
+ virtual Size2 get_recommended_render_targetsize();
+ virtual bool is_stereo();
+ virtual Transform get_transform_for_eye(ARVRInterface::Eyes p_eye, const Transform &p_cam_transform);
+ virtual CameraMatrix get_projection_for_eye(ARVRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far);
+ virtual void commit_for_eye(ARVRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect);
+
+ virtual void process();
+
+ MobileVRInterface();
+ ~MobileVRInterface();
+};
+
+#endif // MOBILE_VR_INTERFACE_H
diff --git a/modules/mobile_vr/register_types.cpp b/modules/mobile_vr/register_types.cpp
new file mode 100644
index 0000000000..f742ecbf00
--- /dev/null
+++ b/modules/mobile_vr/register_types.cpp
@@ -0,0 +1,43 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "register_types.h"
+
+#include "mobile_interface.h"
+
+void register_mobile_vr_types() {
+ ClassDB::register_class<MobileVRInterface>();
+
+ Ref<MobileVRInterface> mobile_vr;
+ mobile_vr.instance();
+ ARVRServer::get_singleton()->add_interface(mobile_vr);
+}
+
+void unregister_mobile_vr_types() {
+}
diff --git a/modules/mobile_vr/register_types.h b/modules/mobile_vr/register_types.h
new file mode 100644
index 0000000000..a492fff397
--- /dev/null
+++ b/modules/mobile_vr/register_types.h
@@ -0,0 +1,31 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_mobile_vr_types();
+void unregister_mobile_vr_types();
diff --git a/modules/mobile_vr/shaders/SCsub b/modules/mobile_vr/shaders/SCsub
new file mode 100644
index 0000000000..cf53c9ebe0
--- /dev/null
+++ b/modules/mobile_vr/shaders/SCsub
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+
+Import('env')
+
+if 'GLES3_GLSL' in env['BUILDERS']:
+ env.GLES3_GLSL('lens_distorted.glsl');
+
diff --git a/modules/mobile_vr/shaders/lens_distorted.glsl b/modules/mobile_vr/shaders/lens_distorted.glsl
new file mode 100644
index 0000000000..5a2975d737
--- /dev/null
+++ b/modules/mobile_vr/shaders/lens_distorted.glsl
@@ -0,0 +1,59 @@
+[vertex]
+
+layout(location=0) in highp vec4 vertex_attrib;
+layout(location=4) in vec2 uv_in;
+
+uniform float offset_x;
+
+out vec2 uv_interp;
+
+void main() {
+
+ uv_interp = uv_in;
+ gl_Position = vec4(vertex_attrib.x + offset_x, vertex_attrib.y, 0.0, 1.0);
+}
+
+[fragment]
+
+uniform sampler2D source; //texunit:0
+
+uniform vec2 eye_center;
+uniform float k1;
+uniform float k2;
+uniform float upscale;
+uniform float aspect_ratio;
+
+in vec2 uv_interp;
+
+layout(location = 0) out vec4 frag_color;
+
+void main() {
+ vec2 coords = uv_interp;
+ vec2 offset = coords - eye_center;
+
+ // take aspect ratio into account
+ offset.y /= aspect_ratio;
+
+ // distort
+ vec2 offset_sq = offset * offset;
+ float radius_sq = offset_sq.x + offset_sq.y;
+ float radius_s4 = radius_sq * radius_sq;
+ float distortion_scale = 1.0 + (k1 * radius_sq) + (k2 * radius_s4);
+ offset *= distortion_scale;
+
+ // reapply aspect ratio
+ offset.y *= aspect_ratio;
+
+ // add our eye center back in
+ coords = offset + eye_center;
+ coords /= upscale;
+
+ // and check our color
+ if (coords.x < -1.0 || coords.y < -1.0 || coords.x > 1.0 || coords.y > 1.0) {
+ frag_color = vec4(0.0, 0.0, 0.0, 1.0);
+ } else {
+ coords = (coords + vec2(1.0)) / vec2(2.0);
+ frag_color = textureLod(source, coords, 0.0);
+ }
+}
+
diff --git a/modules/mono/SCsub b/modules/mono/SCsub
new file mode 100644
index 0000000000..caf4fdb3ca
--- /dev/null
+++ b/modules/mono/SCsub
@@ -0,0 +1,121 @@
+#!/usr/bin/env python
+
+Import('env')
+
+from compat import byte_to_str
+
+def make_cs_files_header(src, dst):
+ with open(dst, 'w') as header:
+ header.write('/* This is an automatically generated file; DO NOT EDIT! OK THX */\n')
+ header.write('#ifndef _CS_FILES_DATA_H\n')
+ header.write('#define _CS_FILES_DATA_H\n\n')
+ header.write('#include "map.h"\n')
+ header.write('#include "ustring.h"\n')
+ inserted_files = ''
+ import os
+ for file in os.listdir(src):
+ if file.endswith('.cs'):
+ with open(os.path.join(src, file), 'rb') as f:
+ buf = f.read()
+ decomp_size = len(buf)
+ import zlib
+ buf = zlib.compress(buf)
+ name = os.path.splitext(file)[0]
+ header.write('\nstatic const int _cs_' + name + '_compressed_size = ' + str(len(buf)) + ';\n')
+ header.write('static const int _cs_' + name + '_uncompressed_size = ' + str(decomp_size) + ';\n')
+ header.write('static const unsigned char _cs_' + name + '_compressed[] = { ')
+ for i, buf_idx in enumerate(range(len(buf))):
+ if i > 0:
+ header.write(', ')
+ header.write(byte_to_str(buf[buf_idx]))
+ inserted_files += '\tr_files.insert(\"' + file + '\", ' \
+ 'CompressedFile(_cs_' + name + '_compressed_size, ' \
+ '_cs_' + name + '_uncompressed_size, ' \
+ '_cs_' + name + '_compressed));\n'
+ header.write(' };\n')
+ header.write('\nstruct CompressedFile\n' '{\n'
+ '\tint compressed_size;\n' '\tint uncompressed_size;\n' '\tconst unsigned char* data;\n'
+ '\n\tCompressedFile(int p_comp_size, int p_uncomp_size, const unsigned char* p_data)\n'
+ '\t{\n' '\t\tcompressed_size = p_comp_size;\n' '\t\tuncompressed_size = p_uncomp_size;\n'
+ '\t\tdata = p_data;\n' '\t}\n' '\n\tCompressedFile() {}\n' '};\n'
+ '\nvoid get_compressed_files(Map<String, CompressedFile>& r_files)\n' '{\n' + inserted_files + '}\n'
+ )
+ header.write('#endif // _CS_FILES_DATA_H')
+
+
+env.add_source_files(env.modules_sources, '*.cpp')
+env.add_source_files(env.modules_sources, 'mono_gd/*.cpp')
+env.add_source_files(env.modules_sources, 'utils/*.cpp')
+
+if env['tools']:
+ env.add_source_files(env.modules_sources, 'editor/*.cpp')
+ make_cs_files_header('glue/cs_files', 'glue/cs_compressed.gen.h')
+
+vars = Variables()
+vars.Add(BoolVariable('mono_glue', 'Build with the mono glue sources', True))
+vars.Update(env)
+
+# Glue sources
+if env['mono_glue']:
+ env.add_source_files(env.modules_sources, 'glue/*.cpp')
+else:
+ env.Append(CPPDEFINES = [ 'MONO_GLUE_DISABLED' ])
+
+if ARGUMENTS.get('yolo_copy', False):
+ env.Append(CPPDEFINES = [ 'YOLO_COPY' ])
+
+# Build GodotSharpTools solution
+
+import os
+import subprocess
+import mono_reg_utils as monoreg
+
+
+def mono_build_solution(source, target, env):
+ if os.name == 'nt':
+ msbuild_tools_path = monoreg.find_msbuild_tools_path_reg()
+ if not msbuild_tools_path:
+ raise RuntimeError('Cannot find MSBuild Tools Path in the registry')
+ msbuild_path = os.path.join(msbuild_tools_path, 'MSBuild.exe')
+ else:
+ msbuild_path = 'msbuild'
+
+ output_path = os.path.abspath(os.path.join(str(target[0]), os.pardir))
+
+ msbuild_args = [
+ msbuild_path,
+ os.path.abspath(str(source[0])),
+ '/p:Configuration=Release',
+ '/p:OutputPath=' + output_path
+ ]
+
+ msbuild_env = os.environ.copy()
+
+ # Needed when running from Developer Command Prompt for VS
+ if 'PLATFORM' in msbuild_env:
+ del msbuild_env['PLATFORM']
+
+ msbuild_alt_paths = [ 'xbuild' ]
+
+ while True:
+ try:
+ subprocess.check_call(msbuild_args, env = msbuild_env)
+ break
+ except subprocess.CalledProcessError:
+ raise RuntimeError('GodotSharpTools build failed')
+ except OSError:
+ if os.name != 'nt':
+ if not msbuild_alt_paths:
+ raise RuntimeError('Could not find commands msbuild or xbuild')
+ # Try xbuild
+ msbuild_args[0] = msbuild_alt_paths.pop(0)
+ else:
+ raise RuntimeError('Could not find command MSBuild.exe')
+
+
+mono_sln_builder = Builder(action = mono_build_solution)
+env.Append(BUILDERS = { 'MonoBuildSolution' : mono_sln_builder })
+env.MonoBuildSolution(
+ os.path.join(Dir('#bin').abspath, 'GodotSharpTools.dll'),
+ 'editor/GodotSharpTools/GodotSharpTools.sln'
+)
diff --git a/modules/mono/config.py b/modules/mono/config.py
new file mode 100644
index 0000000000..9de199bb5a
--- /dev/null
+++ b/modules/mono/config.py
@@ -0,0 +1,143 @@
+
+import imp
+import os
+import sys
+from shutil import copyfile
+
+from SCons.Script import BoolVariable, Environment, Variables
+
+
+monoreg = imp.load_source('mono_reg_utils', 'modules/mono/mono_reg_utils.py')
+
+
+def find_file_in_dir(directory, files, prefix='', extension=''):
+ if not extension.startswith('.'):
+ extension = '.' + extension
+ for curfile in files:
+ if os.path.isfile(os.path.join(directory, prefix + curfile + extension)):
+ return curfile
+
+ return None
+
+
+def can_build(platform):
+ if platform in ["javascript"]:
+ return False # Not yet supported
+ return True
+
+
+def is_enabled():
+ # The module is disabled by default. Use module_mono_enabled=yes to enable it.
+ return False
+
+
+def configure(env):
+ env.use_ptrcall = True
+
+ envvars = Variables()
+ envvars.Add(BoolVariable('mono_static', 'Statically link mono', False))
+ envvars.Update(env)
+
+ mono_static = env['mono_static']
+
+ mono_lib_names = ['mono-2.0-sgen', 'monosgen-2.0']
+
+ if env['platform'] == 'windows':
+ if mono_static:
+ raise RuntimeError('mono-static: Not supported on Windows')
+
+ if env['bits'] == '32':
+ if os.getenv('MONO32_PREFIX'):
+ mono_root = os.getenv('MONO32_PREFIX')
+ elif os.name == 'nt':
+ mono_root = monoreg.find_mono_root_dir()
+ else:
+ if os.getenv('MONO64_PREFIX'):
+ mono_root = os.getenv('MONO64_PREFIX')
+ elif os.name == 'nt':
+ mono_root = monoreg.find_mono_root_dir()
+
+ if mono_root is None:
+ raise RuntimeError('Mono installation directory not found')
+
+ mono_lib_path = os.path.join(mono_root, 'lib')
+
+ env.Append(LIBPATH=mono_lib_path)
+ env.Append(CPPPATH=os.path.join(mono_root, 'include', 'mono-2.0'))
+
+ mono_lib_name = find_file_in_dir(mono_lib_path, mono_lib_names, extension='.lib')
+
+ if mono_lib_name is None:
+ raise RuntimeError('Could not find mono library in: ' + mono_lib_path)
+
+ if os.getenv('VCINSTALLDIR'):
+ env.Append(LINKFLAGS=mono_lib_name + Environment()['LIBSUFFIX'])
+ else:
+ env.Append(LIBS=mono_lib_name)
+
+ mono_bin_path = os.path.join(mono_root, 'bin')
+
+ mono_dll_name = find_file_in_dir(mono_bin_path, mono_lib_names, extension='.dll')
+
+ mono_dll_src = os.path.join(mono_bin_path, mono_dll_name + '.dll')
+ mono_dll_dst = os.path.join('bin', mono_dll_name + '.dll')
+ copy_mono_dll = True
+
+ if not os.path.isdir('bin'):
+ os.mkdir('bin')
+ elif os.path.exists(mono_dll_dst):
+ copy_mono_dll = False
+
+ if copy_mono_dll:
+ copyfile(mono_dll_src, mono_dll_dst)
+ else:
+ mono_root = None
+
+ if env['bits'] == '32':
+ if os.getenv('MONO32_PREFIX'):
+ mono_root = os.getenv('MONO32_PREFIX')
+ else:
+ if os.getenv('MONO64_PREFIX'):
+ mono_root = os.getenv('MONO64_PREFIX')
+
+ if mono_root is not None:
+ mono_lib_path = os.path.join(mono_root, 'lib')
+
+ env.Append(LIBPATH=mono_lib_path)
+ env.Append(CPPPATH=os.path.join(mono_root, 'include', 'mono-2.0'))
+
+ mono_lib = find_file_in_dir(mono_lib_path, mono_lib_names, prefix='lib', extension='.a')
+
+ if mono_lib is None:
+ raise RuntimeError('Could not find mono library in: ' + mono_lib_path)
+
+ env.Append(CPPFLAGS=['-D_REENTRANT'])
+
+ if mono_static:
+ mono_lib_file = os.path.join(mono_lib_path, 'lib' + mono_lib + '.a')
+
+ if sys.platform == "darwin":
+ env.Append(LINKFLAGS=['-Wl,-force_load,' + mono_lib_file])
+ elif sys.platform == "linux" or sys.platform == "linux2":
+ env.Append(LINKFLAGS=['-Wl,-whole-archive', mono_lib_file, '-Wl,-no-whole-archive'])
+ else:
+ raise RuntimeError('mono-static: Not supported on this platform')
+ else:
+ env.Append(LIBS=[mono_lib])
+
+ env.Append(LIBS=['m', 'rt', 'dl', 'pthread'])
+ else:
+ if mono_static:
+ raise RuntimeError('mono-static: Not supported with pkg-config. Specify a mono prefix manually')
+
+ env.ParseConfig('pkg-config mono-2 --cflags --libs')
+
+ env.Append(LINKFLAGS='-rdynamic')
+
+
+def get_doc_classes():
+ return ["@C#", "CSharpScript", "GodotSharp"]
+
+
+def get_doc_path():
+ return "doc_classes"
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
new file mode 100644
index 0000000000..b475782729
--- /dev/null
+++ b/modules/mono/csharp_script.cpp
@@ -0,0 +1,1923 @@
+/*************************************************************************/
+/* csharp_script.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "csharp_script.h"
+
+#include <mono/metadata/threads.h>
+
+#include "os/file_access.h"
+#include "os/os.h"
+#include "os/thread.h"
+#include "project_settings.h"
+
+#ifdef TOOLS_ENABLED
+#include "editor/bindings_generator.h"
+#include "editor/csharp_project.h"
+#include "editor/editor_node.h"
+#include "editor/godotsharp_editor.h"
+#endif
+
+#include "godotsharp_dirs.h"
+#include "mono_gd/gd_mono_class.h"
+#include "mono_gd/gd_mono_marshal.h"
+#include "signal_awaiter_utils.h"
+
+#define CACHED_STRING_NAME(m_var) (CSharpLanguage::get_singleton()->string_names.m_var)
+
+static bool _create_project_solution_if_needed() {
+
+ String sln_path = GodotSharpDirs::get_project_sln_path();
+ String csproj_path = GodotSharpDirs::get_project_csproj_path();
+
+ if (!FileAccess::exists(sln_path) || !FileAccess::exists(csproj_path)) {
+ // A solution does not yet exist, create a new one
+
+ CRASH_COND(GodotSharpEditor::get_singleton() == NULL);
+ return GodotSharpEditor::get_singleton()->call("_create_project_solution");
+ }
+
+ return true;
+}
+
+CSharpLanguage *CSharpLanguage::singleton = NULL;
+
+String CSharpLanguage::get_name() const {
+
+ return "C#";
+}
+
+String CSharpLanguage::get_type() const {
+
+ return "CSharpScript";
+}
+
+String CSharpLanguage::get_extension() const {
+
+ return "cs";
+}
+
+Error CSharpLanguage::execute_file(const String &p_path) {
+
+ // ??
+ return OK;
+}
+
+#ifdef TOOLS_ENABLED
+void gdsharp_editor_init_callback() {
+
+ EditorNode *editor = EditorNode::get_singleton();
+ editor->add_child(memnew(GodotSharpEditor(editor)));
+}
+#endif
+
+void CSharpLanguage::init() {
+
+ gdmono = memnew(GDMono);
+ gdmono->initialize();
+
+#ifdef MONO_GLUE_DISABLED
+ WARN_PRINT("This binary is built with `mono_glue=no` and cannot be used for scripting");
+#endif
+
+#if defined(TOOLS_ENABLED) && defined(DEBUG_METHODS_ENABLED)
+ if (gdmono->get_editor_tools_assembly() != NULL) {
+ List<String> cmdline_args = OS::get_singleton()->get_cmdline_args();
+ BindingsGenerator::handle_cmdline_args(cmdline_args);
+ }
+#endif
+
+#ifdef TOOLS_ENABLED
+ EditorNode::add_init_callback(&gdsharp_editor_init_callback);
+#endif
+}
+
+void CSharpLanguage::finish() {
+
+ if (gdmono) {
+ memdelete(gdmono);
+ gdmono = NULL;
+ }
+}
+
+void CSharpLanguage::get_reserved_words(List<String> *p_words) const {
+
+ static const char *_reserved_words[] = {
+ // Reserved keywords
+ "abstract",
+ "as",
+ "base",
+ "bool",
+ "break",
+ "byte",
+ "case",
+ "catch",
+ "char",
+ "checked",
+ "class",
+ "const",
+ "continue",
+ "decimal",
+ "default",
+ "delegate",
+ "do",
+ "double",
+ "else",
+ "enum",
+ "event",
+ "explicit",
+ "extern",
+ "false",
+ "finally",
+ "fixed",
+ "float",
+ "for",
+ "forech",
+ "goto",
+ "if",
+ "implicit",
+ "in",
+ "int",
+ "interface",
+ "internal",
+ "is",
+ "lock",
+ "long",
+ "namespace",
+ "new",
+ "null",
+ "object",
+ "operator",
+ "out",
+ "override",
+ "params",
+ "private",
+ "protected",
+ "public",
+ "readonly",
+ "ref",
+ "return",
+ "sbyte",
+ "sealed",
+ "short",
+ "sizeof",
+ "stackalloc",
+ "static",
+ "string",
+ "struct",
+ "switch",
+ "this",
+ "throw",
+ "true",
+ "try",
+ "typeof",
+ "uint",
+ "ulong",
+ "unchecked",
+ "unsafe",
+ "ushort",
+ "using",
+ "virtual",
+ "volatile",
+ "void",
+ "while",
+
+ // Contextual keywords. Not reserved words, but I guess we should include
+ // them because this seems to be used only for syntax highlighting.
+ "add",
+ "ascending",
+ "by",
+ "descending",
+ "dynamic",
+ "equals",
+ "from",
+ "get",
+ "global",
+ "group",
+ "in",
+ "into",
+ "join",
+ "let",
+ "on",
+ "orderby",
+ "partial",
+ "remove",
+ "select",
+ "set",
+ "value",
+ "var",
+ "where",
+ "yield",
+ 0
+ };
+
+ const char **w = _reserved_words;
+
+ while (*w) {
+ p_words->push_back(*w);
+ w++;
+ }
+}
+
+void CSharpLanguage::get_comment_delimiters(List<String> *p_delimiters) const {
+
+ p_delimiters->push_back("//"); // single-line comment
+ p_delimiters->push_back("/* */"); // delimited comment
+}
+
+void CSharpLanguage::get_string_delimiters(List<String> *p_delimiters) const {
+
+ p_delimiters->push_back("' '"); // character literal
+ p_delimiters->push_back("\" \""); // regular string literal
+ p_delimiters->push_back("@\" \""); // verbatim string literal
+}
+
+Ref<Script> CSharpLanguage::get_template(const String &p_class_name, const String &p_base_class_name) const {
+
+ String script_template = "using " BINDINGS_NAMESPACE ";\n"
+ "using System;\n"
+ "\n"
+ "public class %CLASS_NAME% : %BASE_CLASS_NAME%\n"
+ "{\n"
+ " // Member variables here, example:\n"
+ " // private int a = 2;\n"
+ " // private string b = \"textvar\";\n"
+ "\n"
+ " public override void _Ready()\n"
+ " {\n"
+ " // Called every time the node is added to the scene.\n"
+ " // Initialization here\n"
+ " \n"
+ " }\n"
+ "}\n";
+
+ script_template = script_template.replace("%BASE_CLASS_NAME%", p_base_class_name).replace("%CLASS_NAME%", p_class_name);
+
+ Ref<CSharpScript> script;
+ script.instance();
+ script->set_source_code(script_template);
+
+ return script;
+}
+
+Script *CSharpLanguage::create_script() const {
+
+ return memnew(CSharpScript);
+}
+
+bool CSharpLanguage::has_named_classes() const {
+
+ return true;
+}
+
+String CSharpLanguage::make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const {
+
+ // FIXME
+ // Due to Godot's API limitation this just appends the function to the end of the file
+ // Another limitation is that the parameter types are not specified, so we must use System.Object
+ String s = "private void " + p_name + "(";
+ for (int i = 0; i < p_args.size(); i++) {
+ if (i > 0)
+ s += ", ";
+ s += "object " + p_args[i];
+ }
+ s += ")\n{\n // Replace with function body\n}\n";
+
+ return s;
+}
+
+void CSharpLanguage::frame() {
+
+ const Ref<MonoGCHandle> &task_scheduler_handle = GDMonoUtils::mono_cache.task_scheduler_handle;
+
+ if (task_scheduler_handle.is_valid()) {
+ MonoObject *task_scheduler = task_scheduler_handle->get_target();
+
+ if (task_scheduler) {
+ GDMonoUtils::GodotTaskScheduler_Activate thunk = CACHED_METHOD_THUNK(GodotTaskScheduler, Activate);
+
+ ERR_FAIL_NULL(thunk);
+
+ MonoObject *ex;
+ thunk(task_scheduler, &ex);
+
+ if (ex) {
+ mono_print_unhandled_exception(ex);
+ ERR_FAIL();
+ }
+ }
+ }
+}
+
+struct CSharpScriptDepSort {
+
+ // must support sorting so inheritance works properly (parent must be reloaded first)
+ bool operator()(const Ref<CSharpScript> &A, const Ref<CSharpScript> &B) const {
+ if (A == B)
+ return false; // shouldn't happen but..
+ GDMonoClass *I = B->base;
+ while (I) {
+ if (I == A->script_class) {
+ // A is a base of B
+ return true;
+ }
+
+ I = I->get_parent_class();
+ }
+
+ return false; // not a base
+ }
+};
+
+void CSharpLanguage::reload_all_scripts() {
+
+#ifdef DEBUG_ENABLED
+
+#ifndef NO_THREADS
+ lock->lock();
+#endif
+
+ List<Ref<CSharpScript> > scripts;
+
+ SelfList<CSharpScript> *elem = script_list.first();
+ while (elem) {
+ if (elem->self()->get_path().is_resource_file()) {
+ scripts.push_back(Ref<CSharpScript>(elem->self())); //cast to gdscript to avoid being erased by accident
+ }
+ elem = elem->next();
+ }
+
+#ifndef NO_THREADS
+ lock->unlock();
+#endif
+
+ //as scripts are going to be reloaded, must proceed without locking here
+
+ scripts.sort_custom<CSharpScriptDepSort>(); //update in inheritance dependency order
+
+ for (List<Ref<CSharpScript> >::Element *E = scripts.front(); E; E = E->next()) {
+ E->get()->load_source_code(E->get()->get_path());
+ E->get()->reload(true);
+ }
+#endif
+}
+
+void CSharpLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_soft_reload) {
+
+ (void)p_script; // UNUSED
+
+#ifdef TOOLS_ENABLED
+ reload_assemblies_if_needed(p_soft_reload);
+#endif
+}
+
+#ifdef TOOLS_ENABLED
+void CSharpLanguage::reload_assemblies_if_needed(bool p_soft_reload) {
+
+ if (gdmono->is_runtime_initialized()) {
+
+ GDMonoAssembly *proj_assembly = gdmono->get_project_assembly();
+
+ if (proj_assembly) {
+ String proj_asm_path = proj_assembly->get_path();
+
+ if (!FileAccess::exists(proj_assembly->get_path())) {
+ // Maybe it wasn't loaded from the default path, so check this as well
+ String proj_asm_name = ProjectSettings::get_singleton()->get("application/config/name");
+ proj_asm_path = GodotSharpDirs::get_res_temp_assemblies_dir().plus_file(proj_asm_name);
+ if (!FileAccess::exists(proj_asm_path))
+ return; // No assembly to load
+ }
+
+ if (FileAccess::get_modified_time(proj_asm_path) <= proj_assembly->get_modified_time())
+ return; // Already up to date
+ } else {
+ String proj_asm_name = ProjectSettings::get_singleton()->get("application/config/name");
+ if (!FileAccess::exists(GodotSharpDirs::get_res_temp_assemblies_dir().plus_file(proj_asm_name)))
+ return; // No assembly to load
+ }
+ }
+
+#ifndef NO_THREADS
+ lock->lock();
+#endif
+
+ List<Ref<CSharpScript> > scripts;
+
+ SelfList<CSharpScript> *elem = script_list.first();
+ while (elem) {
+ if (elem->self()->get_path().is_resource_file()) {
+
+ scripts.push_back(Ref<CSharpScript>(elem->self())); //cast to CSharpScript to avoid being erased by accident
+ }
+ elem = elem->next();
+ }
+
+#ifndef NO_THREADS
+ lock->unlock();
+#endif
+
+ //when someone asks you why dynamically typed languages are easier to write....
+
+ Map<Ref<CSharpScript>, Map<ObjectID, List<Pair<StringName, Variant> > > > to_reload;
+
+ //as scripts are going to be reloaded, must proceed without locking here
+
+ scripts.sort_custom<CSharpScriptDepSort>(); //update in inheritance dependency order
+
+ for (List<Ref<CSharpScript> >::Element *E = scripts.front(); E; E = E->next()) {
+
+ to_reload.insert(E->get(), Map<ObjectID, List<Pair<StringName, Variant> > >());
+
+ if (!p_soft_reload) {
+
+ //save state and remove script from instances
+ Map<ObjectID, List<Pair<StringName, Variant> > > &map = to_reload[E->get()];
+
+ while (E->get()->instances.front()) {
+ Object *obj = E->get()->instances.front()->get();
+ //save instance info
+ List<Pair<StringName, Variant> > state;
+ if (obj->get_script_instance()) {
+
+ obj->get_script_instance()->get_property_state(state);
+
+ Ref<MonoGCHandle> gchandle = CAST_CSHARP_INSTANCE(obj->get_script_instance())->gchandle;
+ if (gchandle.is_valid())
+ gchandle->release();
+
+ map[obj->get_instance_id()] = state;
+ obj->set_script(RefPtr());
+ }
+ }
+
+ //same thing for placeholders
+ while (E->get()->placeholders.size()) {
+
+ Object *obj = E->get()->placeholders.front()->get()->get_owner();
+ //save instance info
+ List<Pair<StringName, Variant> > state;
+ if (obj->get_script_instance()) {
+ obj->get_script_instance()->get_property_state(state);
+ map[obj->get_instance_id()] = state;
+ obj->set_script(RefPtr());
+ }
+ }
+
+ for (Map<ObjectID, List<Pair<StringName, Variant> > >::Element *F = E->get()->pending_reload_state.front(); F; F = F->next()) {
+ map[F->key()] = F->get(); //pending to reload, use this one instead
+ }
+
+ E->get()->_clear();
+ }
+ }
+
+ if (gdmono->reload_scripts_domain() != OK)
+ return;
+
+ for (Map<Ref<CSharpScript>, Map<ObjectID, List<Pair<StringName, Variant> > > >::Element *E = to_reload.front(); E; E = E->next()) {
+
+ Ref<CSharpScript> scr = E->key();
+ scr->exports_invalidated = true;
+ scr->reload(p_soft_reload);
+ scr->update_exports();
+
+ //restore state if saved
+ for (Map<ObjectID, List<Pair<StringName, Variant> > >::Element *F = E->get().front(); F; F = F->next()) {
+
+ Object *obj = ObjectDB::get_instance(F->key());
+ if (!obj)
+ continue;
+
+ if (!p_soft_reload) {
+ //clear it just in case (may be a pending reload state)
+ obj->set_script(RefPtr());
+ }
+ obj->set_script(scr.get_ref_ptr());
+ if (!obj->get_script_instance()) {
+ //failed, save reload state for next time if not saved
+ if (!scr->pending_reload_state.has(obj->get_instance_id())) {
+ scr->pending_reload_state[obj->get_instance_id()] = F->get();
+ }
+ continue;
+ }
+
+ for (List<Pair<StringName, Variant> >::Element *G = F->get().front(); G; G = G->next()) {
+ obj->get_script_instance()->set(G->get().first, G->get().second);
+ }
+
+ scr->pending_reload_state.erase(obj->get_instance_id()); //as it reloaded, remove pending state
+ }
+
+ //if instance states were saved, set them!
+ }
+}
+#endif
+
+void CSharpLanguage::get_recognized_extensions(List<String> *p_extensions) const {
+
+ p_extensions->push_back("cs");
+}
+
+#ifdef TOOLS_ENABLED
+Error CSharpLanguage::open_in_external_editor(const Ref<Script> &p_script, int p_line, int p_col) {
+
+ return GodotSharpEditor::get_singleton()->open_in_external_editor(p_script, p_line, p_col);
+}
+
+bool CSharpLanguage::overrides_external_editor() {
+
+ return GodotSharpEditor::get_singleton()->overrides_external_editor();
+}
+#endif
+
+void CSharpLanguage::thread_enter() {
+
+#if 0
+ if (mono->is_runtime_initialized()) {
+ GDMonoUtils::attach_current_thread();
+ }
+#endif
+}
+
+void CSharpLanguage::thread_exit() {
+
+#if 0
+ if (mono->is_runtime_initialized()) {
+ GDMonoUtils::detach_current_thread();
+ }
+#endif
+}
+
+bool CSharpLanguage::debug_break_parse(const String &p_file, int p_line, const String &p_error) {
+
+ // Break because of parse error
+ if (ScriptDebugger::get_singleton() && Thread::get_caller_id() == Thread::get_main_id()) {
+ // TODO
+ //_debug_parse_err_line = p_line;
+ //_debug_parse_err_file = p_file;
+ //_debug_error = p_error;
+ ScriptDebugger::get_singleton()->debug(this, false);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+bool CSharpLanguage::debug_break(const String &p_error, bool p_allow_continue) {
+
+ if (ScriptDebugger::get_singleton() && Thread::get_caller_id() == Thread::get_main_id()) {
+ // TODO
+ //_debug_parse_err_line = -1;
+ //_debug_parse_err_file = "";
+ //_debug_error = p_error;
+ ScriptDebugger::get_singleton()->debug(this, p_allow_continue);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+void CSharpLanguage::set_language_index(int p_idx) {
+
+ ERR_FAIL_COND(lang_idx != -1);
+ lang_idx = p_idx;
+}
+
+CSharpLanguage::CSharpLanguage() {
+
+ ERR_FAIL_COND(singleton);
+ singleton = this;
+
+ gdmono = NULL;
+
+#ifdef NO_THREADS
+ lock = NULL;
+ gchandle_bind_lock = NULL;
+#else
+ lock = Mutex::create();
+ script_bind_lock = Mutex::create();
+#endif
+
+ lang_idx = -1;
+}
+
+CSharpLanguage::~CSharpLanguage() {
+
+ finish();
+
+ if (lock) {
+ memdelete(lock);
+ lock = NULL;
+ }
+
+ if (script_bind_lock) {
+ memdelete(script_bind_lock);
+ script_bind_lock = NULL;
+ }
+
+ singleton = NULL;
+}
+
+void *CSharpLanguage::alloc_instance_binding_data(Object *p_object) {
+
+#ifdef DEBUG_ENABLED
+ // I don't trust you
+ if (p_object->get_script_instance())
+ CRASH_COND(NULL != CAST_CSHARP_INSTANCE(p_object->get_script_instance()));
+#endif
+
+ StringName type_name = p_object->get_class_name();
+
+ // ¯\_(ツ)_/¯
+ const ClassDB::ClassInfo *classinfo = ClassDB::classes.getptr(type_name);
+ while (classinfo && !classinfo->exposed)
+ classinfo = classinfo->inherits_ptr;
+ ERR_FAIL_NULL_V(classinfo, NULL);
+ type_name = classinfo->name;
+
+ GDMonoClass *type_class = GDMonoUtils::type_get_proxy_class(type_name);
+
+ ERR_FAIL_NULL_V(type_class, NULL);
+
+ MonoObject *mono_object = GDMonoUtils::create_managed_for_godot_object(type_class, type_name, p_object);
+
+ ERR_FAIL_NULL_V(mono_object, NULL);
+
+ // Tie managed to unmanaged
+ bool strong_handle = true;
+ Reference *ref = Object::cast_to<Reference>(p_object);
+
+ if (ref) {
+ strong_handle = false;
+
+ // Unsafe refcount increment. The managed instance also counts as a reference.
+ // This way if the unmanaged world has no references to our owner
+ // but the managed instance is alive, the refcount will be 1 instead of 0.
+ // See: _GodotSharp::_dispose_object(Object *p_object)
+
+ ref->reference();
+ }
+
+ Ref<MonoGCHandle> gchandle = strong_handle ? MonoGCHandle::create_strong(mono_object) :
+ MonoGCHandle::create_weak(mono_object);
+
+#ifndef NO_THREADS
+ script_bind_lock->lock();
+#endif
+
+ void *data = (void *)gchandle_bindings.insert(p_object, gchandle);
+
+#ifndef NO_THREADS
+ script_bind_lock->unlock();
+#endif
+
+ return data;
+}
+
+void CSharpLanguage::free_instance_binding_data(void *p_data) {
+
+#ifndef NO_THREADS
+ script_bind_lock->lock();
+#endif
+
+ gchandle_bindings.erase((Map<Object *, Ref<MonoGCHandle> >::Element *)p_data);
+
+#ifndef NO_THREADS
+ script_bind_lock->unlock();
+#endif
+}
+
+void CSharpInstance::_ml_call_reversed(GDMonoClass *klass, const StringName &p_method, const Variant **p_args, int p_argcount) {
+
+ GDMonoClass *base = klass->get_parent_class();
+ if (base && base != script->native)
+ _ml_call_reversed(base, p_method, p_args, p_argcount);
+
+ GDMonoMethod *method = klass->get_method(p_method, p_argcount);
+
+ if (method) {
+ method->invoke(get_mono_object(), p_args);
+ }
+}
+
+CSharpInstance *CSharpInstance::create_for_managed_type(Object *p_owner, CSharpScript *p_script, const Ref<MonoGCHandle> &p_gchandle) {
+
+ CSharpInstance *instance = memnew(CSharpInstance);
+
+ Reference *ref = Object::cast_to<Reference>(p_owner);
+
+ instance->base_ref = ref != NULL;
+ instance->script = Ref<CSharpScript>(p_script);
+ instance->owner = p_owner;
+ instance->gchandle = p_gchandle;
+
+ if (instance->base_ref)
+ instance->_reference_owner_unsafe();
+
+ p_script->instances.insert(p_owner);
+
+ return instance;
+}
+
+MonoObject *CSharpInstance::get_mono_object() const {
+#ifdef DEBUG_ENABLED
+ CRASH_COND(gchandle.is_null());
+#endif
+ return gchandle->get_target();
+}
+
+bool CSharpInstance::set(const StringName &p_name, const Variant &p_value) {
+
+ ERR_FAIL_COND_V(!script.is_valid(), false);
+
+ GDMonoClass *top = script->script_class;
+
+ while (top && top != script->native) {
+ GDMonoField *field = script->script_class->get_field(p_name);
+
+ if (field) {
+ MonoObject *mono_object = get_mono_object();
+
+ ERR_EXPLAIN("Reference has been garbage collected?");
+ ERR_FAIL_NULL_V(mono_object, false);
+
+ field->set_value(mono_object, p_value);
+
+ return true;
+ }
+
+ top = top->get_parent_class();
+ }
+
+ // Call _set
+
+ Variant name = p_name;
+ const Variant *args[2] = { &name, &p_value };
+
+ MonoObject *mono_object = get_mono_object();
+ top = script->script_class;
+
+ while (top && top != script->native) {
+ GDMonoMethod *method = top->get_method(CACHED_STRING_NAME(_set), 2);
+
+ if (method) {
+ MonoObject *ret = method->invoke(mono_object, args);
+
+ if (ret && GDMonoMarshal::unbox<MonoBoolean>(ret) == true)
+ return true;
+ }
+
+ top = top->get_parent_class();
+ }
+
+ return false;
+}
+
+bool CSharpInstance::get(const StringName &p_name, Variant &r_ret) const {
+
+ ERR_FAIL_COND_V(!script.is_valid(), false);
+
+ GDMonoClass *top = script->script_class;
+
+ while (top && top != script->native) {
+ GDMonoField *field = top->get_field(p_name);
+
+ if (field) {
+ MonoObject *mono_object = get_mono_object();
+
+ ERR_EXPLAIN("Reference has been garbage collected?");
+ ERR_FAIL_NULL_V(mono_object, false);
+
+ MonoObject *value = field->get_value(mono_object);
+ r_ret = GDMonoMarshal::mono_object_to_variant(value, field->get_type());
+ return true;
+ }
+
+ // Call _get
+
+ GDMonoMethod *method = top->get_method(CACHED_STRING_NAME(_get), 1);
+
+ if (method) {
+ Variant name = p_name;
+ const Variant *args[1] = { &name };
+
+ MonoObject *ret = method->invoke(get_mono_object(), args);
+
+ if (ret) {
+ r_ret = GDMonoMarshal::mono_object_to_variant(ret);
+ return true;
+ }
+ }
+
+ top = top->get_parent_class();
+ }
+
+ return false;
+}
+
+void CSharpInstance::get_property_list(List<PropertyInfo> *p_properties) const {
+
+ for (Map<StringName, PropertyInfo>::Element *E = script->member_info.front(); E; E = E->next()) {
+ p_properties->push_back(E->value());
+ }
+}
+
+Variant::Type CSharpInstance::get_property_type(const StringName &p_name, bool *r_is_valid) const {
+
+ if (script->member_info.has(p_name)) {
+ if (r_is_valid)
+ *r_is_valid = true;
+ return script->member_info[p_name].type;
+ }
+
+ if (r_is_valid)
+ *r_is_valid = false;
+
+ return Variant::NIL;
+}
+
+bool CSharpInstance::has_method(const StringName &p_method) const {
+
+ if (!script.is_valid())
+ return false;
+
+ GDMonoClass *top = script->script_class;
+
+ while (top && top != script->native) {
+ if (top->has_method(p_method)) {
+ return true;
+ }
+
+ top = top->get_parent_class();
+ }
+
+ return false;
+}
+
+Variant CSharpInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
+
+ MonoObject *mono_object = get_mono_object();
+
+ ERR_EXPLAIN("Reference has been garbage collected?");
+ ERR_FAIL_NULL_V(mono_object, Variant());
+
+ if (!script.is_valid())
+ return Variant();
+
+ GDMonoClass *top = script->script_class;
+
+ while (top && top != script->native) {
+ GDMonoMethod *method = top->get_method(p_method, p_argcount);
+
+ if (method) {
+ MonoObject *return_value = method->invoke(mono_object, p_args);
+
+ if (return_value) {
+ return GDMonoMarshal::mono_object_to_variant(return_value, method->get_return_type());
+ } else {
+ return Variant();
+ }
+ } else if (p_method == CACHED_STRING_NAME(_awaited_signal_callback)) {
+ // shitty hack..
+ // TODO move to its own function, thx
+
+ if (p_argcount < 1) {
+ r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
+ r_error.argument = 1;
+ return Variant();
+ }
+
+ Ref<SignalAwaiterHandle> awaiter = *p_args[p_argcount - 1];
+
+ if (awaiter.is_null()) {
+ r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_error.argument = p_argcount - 1;
+ r_error.expected = Variant::OBJECT;
+ return Variant();
+ }
+
+ awaiter->set_completed(true);
+
+ int extra_argc = p_argcount - 1;
+ MonoArray *extra_args = mono_array_new(SCRIPTS_DOMAIN, CACHED_CLASS_RAW(MonoObject), extra_argc);
+
+ for (int i = 0; i < extra_argc; i++) {
+ MonoObject *boxed = GDMonoMarshal::variant_to_mono_object(*p_args[i]);
+ mono_array_set(extra_args, MonoObject *, i, boxed);
+ }
+
+ GDMonoUtils::GodotObject__AwaitedSignalCallback thunk = CACHED_METHOD_THUNK(GodotObject, _AwaitedSignalCallback);
+
+ MonoObject *ex = NULL;
+ thunk(mono_object, &extra_args, awaiter->get_target(), &ex);
+
+ if (ex) {
+ mono_print_unhandled_exception(ex);
+ ERR_FAIL_V(Variant());
+ }
+
+ return Variant();
+ }
+
+ top = top->get_parent_class();
+ }
+
+ r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
+
+ return Variant();
+}
+
+void CSharpInstance::call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount) {
+
+ if (script.is_valid()) {
+ MonoObject *mono_object = get_mono_object();
+
+ GDMonoClass *top = script->script_class;
+
+ while (top && top != script->native) {
+ GDMonoMethod *method = top->get_method(p_method, p_argcount);
+
+ if (method)
+ method->invoke(mono_object, p_args);
+
+ top = top->get_parent_class();
+ }
+ }
+}
+
+void CSharpInstance::call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount) {
+
+ if (script.is_valid()) {
+ _ml_call_reversed(script->script_class, p_method, p_args, p_argcount);
+ }
+}
+
+void CSharpInstance::_reference_owner_unsafe() {
+
+#ifdef DEBUG_ENABLED
+ CRASH_COND(!base_ref);
+#endif
+
+ // Unsafe refcount increment. The managed instance also counts as a reference.
+ // This way if the unmanaged world has no references to our owner
+ // but the managed instance is alive, the refcount will be 1 instead of 0.
+ // See: _unreference_owner_unsafe()
+
+ // May not me referenced yet, so we must use init_ref() instead of reference()
+ Object::cast_to<Reference>(owner)->init_ref();
+}
+
+void CSharpInstance::_unreference_owner_unsafe() {
+
+#ifdef DEBUG_ENABLED
+ CRASH_COND(!base_ref);
+#endif
+
+ // Called from CSharpInstance::mono_object_disposed() or ~CSharpInstance()
+
+ // Unsafe refcount decrement. The managed instance also counts as a reference.
+ // See: _reference_owner_unsafe()
+
+ if (Object::cast_to<Reference>(owner)->unreference()) {
+ memdelete(owner);
+ owner = NULL;
+ }
+}
+
+void CSharpInstance::mono_object_disposed() {
+
+ if (base_ref)
+ _unreference_owner_unsafe();
+}
+
+void CSharpInstance::refcount_incremented() {
+
+ CRASH_COND(!base_ref);
+
+ Reference *ref_owner = Object::cast_to<Reference>(owner);
+
+ if (ref_owner->reference_get_count() > 1) { // Remember the managed side holds a reference, hence 1 instead of 0 here
+ // The reference count was increased after the managed side was the only one referencing our owner.
+ // This means the owner is being referenced again by the unmanaged side,
+ // so the owner must hold the managed side alive again to avoid it from being GCed.
+
+ // Release the current weak handle and replace it with a strong handle.
+ uint32_t strong_gchandle = MonoGCHandle::make_strong_handle(gchandle->get_target());
+ gchandle->release();
+ gchandle->set_handle(strong_gchandle);
+ }
+}
+
+bool CSharpInstance::refcount_decremented() {
+
+ CRASH_COND(!base_ref);
+
+ Reference *ref_owner = Object::cast_to<Reference>(owner);
+
+ int refcount = ref_owner->reference_get_count();
+
+ if (refcount == 1) { // Remember the managed side holds a reference, hence 1 instead of 0 here
+ // If owner owner is no longer referenced by the unmanaged side,
+ // the managed instance takes responsibility of deleting the owner when GCed.
+
+ // Release the current strong handle and replace it with a weak handle.
+ uint32_t weak_gchandle = MonoGCHandle::make_weak_handle(gchandle->get_target());
+ gchandle->release();
+ gchandle->set_handle(weak_gchandle);
+
+ return false;
+ }
+
+ ref_dying = (refcount == 0);
+
+ return ref_dying;
+}
+
+ScriptInstance::RPCMode CSharpInstance::get_rpc_mode(const StringName &p_method) const {
+
+ GDMonoClass *top = script->script_class;
+
+ while (top && top != script->native) {
+ GDMonoMethod *method = top->get_method(p_method);
+
+ if (method) { // TODO should we reject static methods?
+ // TODO cache result
+ if (method->has_attribute(CACHED_CLASS(RemoteAttribute)))
+ return RPC_MODE_REMOTE;
+ if (method->has_attribute(CACHED_CLASS(SyncAttribute)))
+ return RPC_MODE_SYNC;
+ if (method->has_attribute(CACHED_CLASS(MasterAttribute)))
+ return RPC_MODE_MASTER;
+ if (method->has_attribute(CACHED_CLASS(SlaveAttribute)))
+ return RPC_MODE_SLAVE;
+ }
+
+ top = top->get_parent_class();
+ }
+
+ return RPC_MODE_DISABLED;
+}
+
+ScriptInstance::RPCMode CSharpInstance::get_rset_mode(const StringName &p_variable) const {
+
+ GDMonoClass *top = script->script_class;
+
+ while (top && top != script->native) {
+ GDMonoField *field = top->get_field(p_variable);
+
+ if (field) { // TODO should we reject static fields?
+ // TODO cache result
+ if (field->has_attribute(CACHED_CLASS(RemoteAttribute)))
+ return RPC_MODE_REMOTE;
+ if (field->has_attribute(CACHED_CLASS(SyncAttribute)))
+ return RPC_MODE_SYNC;
+ if (field->has_attribute(CACHED_CLASS(MasterAttribute)))
+ return RPC_MODE_MASTER;
+ if (field->has_attribute(CACHED_CLASS(SlaveAttribute)))
+ return RPC_MODE_SLAVE;
+ }
+
+ top = top->get_parent_class();
+ }
+
+ return RPC_MODE_DISABLED;
+}
+
+void CSharpInstance::notification(int p_notification) {
+
+ Variant value = p_notification;
+ const Variant *args[1] = { &value };
+
+ call_multilevel(CACHED_STRING_NAME(_notification), args, 1);
+}
+
+Ref<Script> CSharpInstance::get_script() const {
+
+ return script;
+}
+
+ScriptLanguage *CSharpInstance::get_language() {
+
+ return CSharpLanguage::get_singleton();
+}
+
+CSharpInstance::CSharpInstance() {
+
+ owner = NULL;
+ base_ref = false;
+ ref_dying = false;
+}
+
+CSharpInstance::~CSharpInstance() {
+
+ if (gchandle.is_valid()) {
+ gchandle->release(); // Make sure it's released
+ }
+
+ if (base_ref && !ref_dying) { // it may be called from the owner's destructor
+#ifdef DEBUG_ENABLED
+ CRASH_COND(!owner); // dunno, just in case
+#endif
+ _unreference_owner_unsafe();
+ }
+
+ if (script.is_valid() && owner) {
+#ifndef NO_THREADS
+ CSharpLanguage::singleton->lock->lock();
+#endif
+
+#ifdef DEBUG_ENABLED
+ // CSharpInstance must not be created unless it's going to be added to the list for sure
+ Set<Object *>::Element *match = script->instances.find(owner);
+ CRASH_COND(!match);
+ script->instances.erase(match);
+#else
+ script->instances.erase(owner);
+#endif
+
+#ifndef NO_THREADS
+ CSharpLanguage::singleton->lock->unlock();
+#endif
+ }
+}
+
+#ifdef TOOLS_ENABLED
+void CSharpScript::_placeholder_erased(PlaceHolderScriptInstance *p_placeholder) {
+
+ placeholders.erase(p_placeholder);
+}
+#endif
+
+#ifdef TOOLS_ENABLED
+void CSharpScript::_update_exports_values(Map<StringName, Variant> &values, List<PropertyInfo> &propnames) {
+
+ if (base_cache.is_valid()) {
+ base_cache->_update_exports_values(values, propnames);
+ }
+
+ for (Map<StringName, Variant>::Element *E = exported_members_defval_cache.front(); E; E = E->next()) {
+ values[E->key()] = E->get();
+ }
+
+ for (List<PropertyInfo>::Element *E = exported_members_cache.front(); E; E = E->next()) {
+ propnames.push_back(E->get());
+ }
+}
+#endif
+
+bool CSharpScript::_update_exports() {
+
+#ifdef TOOLS_ENABLED
+ if (!valid)
+ return false;
+
+ bool changed = false;
+
+ if (exports_invalidated) {
+ exports_invalidated = false;
+
+ changed = true;
+
+ member_info.clear();
+ exported_members_cache.clear();
+ exported_members_defval_cache.clear();
+
+ // We are creating a temporary new instance of the class here to get the default value
+ // TODO Workaround. Should be replaced with IL opcodes analysis
+
+ MonoObject *tmp_object = mono_object_new(SCRIPTS_DOMAIN, script_class->get_raw());
+
+ if (tmp_object) {
+ CACHED_FIELD(GodotObject, ptr)->set_value_raw(tmp_object, tmp_object); // FIXME WTF is this workaround
+
+ GDMonoMethod *ctor = script_class->get_method(CACHED_STRING_NAME(dotctor), 0);
+ MonoObject *ex = NULL;
+ ctor->invoke(tmp_object, NULL, &ex);
+
+ if (ex) {
+ ERR_PRINT("Exception thrown from constructor of temporary MonoObject:");
+ mono_print_unhandled_exception(ex);
+ tmp_object = NULL;
+ ERR_FAIL_V(false);
+ }
+ } else {
+ ERR_PRINT("Failed to create temporary MonoObject");
+ return false;
+ }
+
+ GDMonoClass *top = script_class;
+
+ while (top && top != native) {
+ const Vector<GDMonoField *> &fields = top->get_all_fields();
+
+ for (int i = 0; i < fields.size(); i++) {
+ GDMonoField *field = fields[i];
+
+ if (field->is_static() || field->get_visibility() != GDMono::PUBLIC)
+ continue;
+
+ String name = field->get_name();
+ StringName cname = name;
+
+ if (member_info.has(cname))
+ continue;
+
+ Variant::Type type = GDMonoMarshal::managed_to_variant_type(field->get_type());
+
+ if (field->has_attribute(CACHED_CLASS(ExportAttribute))) {
+ MonoObject *attr = field->get_attribute(CACHED_CLASS(ExportAttribute));
+
+ // Field has Export attribute
+ int hint = CACHED_FIELD(ExportAttribute, hint)->get_int_value(attr);
+ String hint_string = CACHED_FIELD(ExportAttribute, hint_string)->get_string_value(attr);
+ int usage = CACHED_FIELD(ExportAttribute, usage)->get_int_value(attr);
+
+ PropertyInfo prop_info = PropertyInfo(type, name, PropertyHint(hint), hint_string, PropertyUsageFlags(usage));
+
+ member_info[cname] = prop_info;
+ exported_members_cache.push_back(prop_info);
+
+ if (tmp_object) {
+ exported_members_defval_cache[cname] = GDMonoMarshal::mono_object_to_variant(field->get_value(tmp_object));
+ }
+ } else {
+ member_info[cname] = PropertyInfo(type, name, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_SCRIPT_VARIABLE);
+ }
+ }
+
+ top = top->get_parent_class();
+ }
+ }
+
+ if (placeholders.size()) {
+ // Update placeholders if any
+ Map<StringName, Variant> values;
+ List<PropertyInfo> propnames;
+ _update_exports_values(values, propnames);
+
+ for (Set<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) {
+ E->get()->update(propnames, values);
+ }
+ }
+
+ return changed;
+#endif
+ return false;
+}
+
+void CSharpScript::_clear() {
+
+ tool = false;
+ valid = false;
+
+ base = NULL;
+ native = NULL;
+ script_class = NULL;
+}
+
+Variant CSharpScript::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
+
+ GDMonoClass *top = script_class;
+
+ while (top && top != native) {
+ GDMonoMethod *method = top->get_method(p_method, p_argcount);
+
+ if (method && method->is_static()) {
+ MonoObject *result = method->invoke(NULL, p_args);
+
+ if (result) {
+ return GDMonoMarshal::mono_object_to_variant(result, method->get_return_type());
+ } else {
+ return Variant();
+ }
+ }
+
+ top = top->get_parent_class();
+ }
+
+ // No static method found. Try regular instance calls
+ return Script::call(p_method, p_args, p_argcount, r_error);
+}
+
+void CSharpScript::_resource_path_changed() {
+
+ String path = get_path();
+
+ if (!path.empty()) {
+ name = get_path().get_file().get_basename();
+ }
+}
+
+void CSharpScript::_bind_methods() {
+
+ ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "new", &CSharpScript::_new, MethodInfo(Variant::OBJECT, "new"));
+}
+
+Ref<CSharpScript> CSharpScript::create_for_managed_type(GDMonoClass *p_class) {
+
+ // This method should not fail
+
+ CRASH_COND(!p_class);
+
+ Ref<CSharpScript> script = memnew(CSharpScript);
+
+ script->name = p_class->get_name();
+ script->script_class = p_class;
+ script->native = GDMonoUtils::get_class_native_base(script->script_class);
+
+ CRASH_COND(script->native == NULL);
+
+ GDMonoClass *base = script->script_class->get_parent_class();
+
+ if (base != script->native)
+ script->base = base;
+
+#ifdef DEBUG_ENABLED
+ // For debug builds, we must fetch from all native base methods as well.
+ // Native base methods must be fetched before the current class.
+ // Not needed if the script class itself is a native class.
+
+ if (script->script_class != script->native) {
+ GDMonoClass *native_top = script->native;
+ while (native_top) {
+ native_top->fetch_methods_with_godot_api_checks(script->native);
+
+ if (native_top == CACHED_CLASS(GodotObject))
+ break;
+
+ native_top = native_top->get_parent_class();
+ }
+ }
+#endif
+
+ script->script_class->fetch_methods_with_godot_api_checks(script->native);
+
+ // Need to fetch method from base classes as well
+ GDMonoClass *top = script->script_class;
+ while (top && top != script->native) {
+ top->fetch_methods_with_godot_api_checks(script->native);
+ top = top->get_parent_class();
+ }
+
+ return script;
+}
+
+bool CSharpScript::can_instance() const {
+
+#ifdef TOOLS_ENABLED
+ if (Engine::get_singleton()->is_editor_hint()) {
+ if (_create_project_solution_if_needed()) {
+ CSharpProject::add_item(GodotSharpDirs::get_project_csproj_path(),
+ "Compile",
+ ProjectSettings::get_singleton()->globalize_path(get_path()));
+ } else {
+ ERR_PRINTS("Cannot add " + get_path() + " to the C# project because it could not be created.");
+ }
+ }
+#endif
+
+ return valid || (!tool && !ScriptServer::is_scripting_enabled());
+}
+
+StringName CSharpScript::get_instance_base_type() const {
+
+ if (native)
+ return native->get_name();
+ else
+ return StringName();
+}
+
+CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Variant::CallError &r_error) {
+
+ /* STEP 1, CREATE */
+
+ CSharpInstance *instance = memnew(CSharpInstance);
+ instance->base_ref = p_isref;
+ instance->script = Ref<CSharpScript>(this);
+ instance->owner = p_owner;
+ instance->owner->set_script_instance(instance);
+
+ if (instance->base_ref)
+ instance->_reference_owner_unsafe();
+
+ /* STEP 2, INITIALIZE AND CONSTRUCT */
+
+ MonoObject *mono_object = mono_object_new(SCRIPTS_DOMAIN, script_class->get_raw());
+
+ if (!mono_object) {
+ instance->script = Ref<CSharpScript>();
+ instance->owner->set_script_instance(NULL);
+ r_error.error = Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL;
+ ERR_EXPLAIN("Failed to allocate memory for the object");
+ ERR_FAIL_V(NULL);
+ }
+
+#ifndef NO_THREADS
+ CSharpLanguage::singleton->lock->lock();
+#endif
+
+ instances.insert(instance->owner);
+
+#ifndef NO_THREADS
+ CSharpLanguage::singleton->lock->unlock();
+#endif
+
+ CACHED_FIELD(GodotObject, ptr)->set_value_raw(mono_object, instance->owner);
+
+ // Construct
+ GDMonoMethod *ctor = script_class->get_method(CACHED_STRING_NAME(dotctor), p_argcount);
+ ctor->invoke(mono_object, p_args, NULL);
+
+ // Tie managed to unmanaged
+ instance->gchandle = MonoGCHandle::create_strong(mono_object);
+
+ /* STEP 3, PARTY */
+
+ //@TODO make thread safe
+ return instance;
+}
+
+Variant CSharpScript::_new(const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
+
+ if (!valid) {
+ r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
+ return Variant();
+ }
+
+ r_error.error = Variant::CallError::CALL_OK;
+ REF ref;
+ Object *owner = NULL;
+
+ ERR_FAIL_NULL_V(native, Variant());
+
+ owner = ClassDB::instance(NATIVE_GDMONOCLASS_NAME(native));
+
+ Reference *r = Object::cast_to<Reference>(owner);
+ if (r) {
+ ref = REF(r);
+ }
+
+ CSharpInstance *instance = _create_instance(p_args, p_argcount, owner, r != NULL, r_error);
+ if (!instance) {
+ if (ref.is_null()) {
+ memdelete(owner); //no owner, sorry
+ }
+ return Variant();
+ }
+
+ if (ref.is_valid()) {
+ return ref;
+ } else {
+ return owner;
+ }
+}
+
+ScriptInstance *CSharpScript::instance_create(Object *p_this) {
+
+ if (!valid)
+ return NULL;
+
+ if (!tool && !ScriptServer::is_scripting_enabled()) {
+#ifdef TOOLS_ENABLED
+ PlaceHolderScriptInstance *si = memnew(PlaceHolderScriptInstance(CSharpLanguage::get_singleton(), Ref<Script>(this), p_this));
+ placeholders.insert(si);
+ _update_exports();
+ return si;
+#else
+ return NULL;
+#endif
+ }
+
+ if (native) {
+ String native_name = native->get_name();
+ if (!ClassDB::is_parent_class(p_this->get_class_name(), native_name)) {
+ if (ScriptDebugger::get_singleton()) {
+ CSharpLanguage::get_singleton()->debug_break_parse(get_path(), 0, "Script inherits from native type '" + native_name + "', so it can't be instanced in object of type: '" + p_this->get_class() + "'");
+ }
+ ERR_EXPLAIN("Script inherits from native type '" + native_name + "', so it can't be instanced in object of type: '" + p_this->get_class() + "'");
+ ERR_FAIL_V(NULL);
+ }
+ }
+
+ Variant::CallError unchecked_error;
+ return _create_instance(NULL, 0, p_this, Object::cast_to<Reference>(p_this), unchecked_error);
+}
+
+bool CSharpScript::instance_has(const Object *p_this) const {
+
+#ifndef NO_THREADS
+ CSharpLanguage::singleton->lock->lock();
+#endif
+
+ bool ret = instances.has((Object *)p_this);
+
+#ifndef NO_THREADS
+ CSharpLanguage::singleton->lock->unlock();
+#endif
+
+ return ret;
+}
+
+bool CSharpScript::has_source_code() const {
+
+ return !source.empty();
+}
+
+String CSharpScript::get_source_code() const {
+
+ return source;
+}
+
+void CSharpScript::set_source_code(const String &p_code) {
+
+ if (source == p_code)
+ return;
+ source = p_code;
+#ifdef TOOLS_ENABLED
+ source_changed_cache = true;
+#endif
+}
+
+bool CSharpScript::has_method(const StringName &p_method) const {
+
+ return script_class->has_method(p_method);
+}
+
+Error CSharpScript::reload(bool p_keep_state) {
+
+#ifndef NO_THREADS
+ CSharpLanguage::singleton->lock->lock();
+#endif
+
+ bool has_instances = instances.size();
+
+#ifndef NO_THREADS
+ CSharpLanguage::singleton->lock->unlock();
+#endif
+
+ ERR_FAIL_COND_V(!p_keep_state && has_instances, ERR_ALREADY_IN_USE);
+
+ GDMonoAssembly *project_assembly = GDMono::get_singleton()->get_project_assembly();
+
+ if (project_assembly) {
+ script_class = project_assembly->get_object_derived_class(name);
+
+ if (!script_class) {
+ ERR_PRINTS("Cannot find class " + name + " for script " + get_path());
+ }
+#ifdef DEBUG_ENABLED
+ else if (OS::get_singleton()->is_stdout_verbose()) {
+ OS::get_singleton()->print(String("Found class " + script_class->get_namespace() + "." +
+ script_class->get_name() + " for script " + get_path() + "\n")
+ .utf8());
+ }
+#endif
+
+ valid = script_class != NULL;
+
+ if (script_class) {
+ tool = script_class->has_attribute(CACHED_CLASS(ToolAttribute));
+
+ native = GDMonoUtils::get_class_native_base(script_class);
+
+ CRASH_COND(native == NULL);
+
+ GDMonoClass *base_class = script_class->get_parent_class();
+
+ if (base_class != native)
+ base = base_class;
+
+#ifdef DEBUG_ENABLED
+ // For debug builds, we must fetch from all native base methods as well.
+ // Native base methods must be fetched before the current class.
+ // Not needed if the script class itself is a native class.
+
+ if (script_class != native) {
+ GDMonoClass *native_top = native;
+ while (native_top) {
+ native_top->fetch_methods_with_godot_api_checks(native);
+
+ if (native_top == CACHED_CLASS(GodotObject))
+ break;
+
+ native_top = native_top->get_parent_class();
+ }
+ }
+#endif
+
+ script_class->fetch_methods_with_godot_api_checks(native);
+
+ // Need to fetch method from base classes as well
+ GDMonoClass *top = script_class;
+ while (top && top != native) {
+ top->fetch_methods_with_godot_api_checks(native);
+ top = top->get_parent_class();
+ }
+ }
+
+ return OK;
+ }
+
+ return ERR_FILE_MISSING_DEPENDENCIES;
+}
+
+String CSharpScript::get_node_type() const {
+
+ return ""; // ?
+}
+
+ScriptLanguage *CSharpScript::get_language() const {
+
+ return CSharpLanguage::get_singleton();
+}
+
+bool CSharpScript::get_property_default_value(const StringName &p_property, Variant &r_value) const {
+
+#ifdef TOOLS_ENABLED
+
+ const Map<StringName, Variant>::Element *E = exported_members_defval_cache.find(p_property);
+ if (E) {
+ r_value = E->get();
+ return true;
+ }
+
+ if (base_cache.is_valid()) {
+ return base_cache->get_property_default_value(p_property, r_value);
+ }
+
+#endif
+ return false;
+}
+
+void CSharpScript::update_exports() {
+
+#ifdef TOOLS_ENABLED
+ _update_exports();
+
+ if (placeholders.size()) {
+ Map<StringName, Variant> values;
+ List<PropertyInfo> propnames;
+ _update_exports_values(values, propnames);
+
+ for (Set<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) {
+ E->get()->update(propnames, values);
+ }
+ }
+#endif
+}
+
+Ref<Script> CSharpScript::get_base_script() const {
+
+ // TODO search in metadata file once we have it, not important any way?
+ return Ref<Script>();
+}
+
+void CSharpScript::get_script_property_list(List<PropertyInfo> *p_list) const {
+
+ for (Map<StringName, PropertyInfo>::Element *E = member_info.front(); E; E = E->next()) {
+ p_list->push_back(E->value());
+ }
+}
+
+int CSharpScript::get_member_line(const StringName &p_member) const {
+
+ // TODO omnisharp
+ return -1;
+}
+
+Error CSharpScript::load_source_code(const String &p_path) {
+
+ PoolVector<uint8_t> sourcef;
+ Error err;
+ FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err);
+ ERR_FAIL_COND_V(err != OK, err);
+
+ int len = f->get_len();
+ sourcef.resize(len + 1);
+ PoolVector<uint8_t>::Write w = sourcef.write();
+ int r = f->get_buffer(w.ptr(), len);
+ f->close();
+ memdelete(f);
+ ERR_FAIL_COND_V(r != len, ERR_CANT_OPEN);
+ w[len] = 0;
+
+ String s;
+ if (s.parse_utf8((const char *)w.ptr())) {
+
+ ERR_EXPLAIN("Script '" + p_path + "' contains invalid unicode (utf-8), so it was not loaded. Please ensure that scripts are saved in valid utf-8 unicode.");
+ ERR_FAIL_V(ERR_INVALID_DATA);
+ }
+
+ source = s;
+
+#ifdef TOOLS_ENABLED
+ source_changed_cache = true;
+#endif
+
+ return OK;
+}
+
+StringName CSharpScript::get_script_name() const {
+
+ return name;
+}
+
+CSharpScript::CSharpScript()
+ : script_list(this) {
+
+ _clear();
+
+#ifdef TOOLS_ENABLED
+ source_changed_cache = false;
+ exports_invalidated = true;
+#endif
+
+ _resource_path_changed();
+
+#ifdef DEBUG_ENABLED
+
+#ifndef NO_THREADS
+ CSharpLanguage::get_singleton()->lock->lock();
+#endif
+
+ CSharpLanguage::get_singleton()->script_list.add(&script_list);
+
+#ifndef NO_THREADS
+ CSharpLanguage::get_singleton()->lock->unlock();
+#endif
+
+#endif // DEBUG_ENABLED
+}
+
+CSharpScript::~CSharpScript() {
+
+#ifdef DEBUG_ENABLED
+
+#ifndef NO_THREADS
+ CSharpLanguage::get_singleton()->lock->lock();
+#endif
+
+ CSharpLanguage::get_singleton()->script_list.remove(&script_list);
+
+#ifndef NO_THREADS
+ CSharpLanguage::get_singleton()->lock->unlock();
+#endif
+
+#endif // DEBUG_ENABLED
+}
+
+/*************** RESOURCE ***************/
+
+RES ResourceFormatLoaderCSharpScript::load(const String &p_path, const String &p_original_path, Error *r_error) {
+
+ if (r_error)
+ *r_error = ERR_FILE_CANT_OPEN;
+
+ // TODO ignore anything inside bin/ and obj/ in tools builds?
+
+ CSharpScript *script = memnew(CSharpScript);
+
+ Ref<CSharpScript> scriptres(script);
+
+#if defined(DEBUG_ENABLED) || defined(TOOLS_ENABLED)
+ Error err = script->load_source_code(p_path);
+ ERR_FAIL_COND_V(err != OK, RES());
+#endif
+
+ script->set_path(p_original_path);
+
+#ifndef TOOLS_ENABLED
+
+#ifdef DEBUG_ENABLED
+ // User is responsible for thread attach/detach
+ ERR_EXPLAIN("Thread is not attached");
+ CRASH_COND(mono_domain_get() == NULL);
+#endif
+
+#else
+ if (Engine::get_singleton()->is_editor_hint() && mono_domain_get() == NULL) {
+
+ CRASH_COND(Thread::get_caller_id() == Thread::get_main_id());
+
+ // Thread is not attached, but we will make an exception in this case
+ // because this may be called by one of the editor's worker threads.
+ // Attach this thread temporarily to reload the script.
+
+ MonoThread *mono_thread = mono_thread_attach(SCRIPTS_DOMAIN);
+ CRASH_COND(mono_thread == NULL);
+ script->reload();
+ mono_thread_detach(mono_thread);
+
+ } else // just reload it normally
+#endif
+ script->reload();
+
+ if (r_error)
+ *r_error = OK;
+
+ return scriptres;
+}
+
+void ResourceFormatLoaderCSharpScript::get_recognized_extensions(List<String> *p_extensions) const {
+
+ p_extensions->push_back("cs");
+}
+
+bool ResourceFormatLoaderCSharpScript::handles_type(const String &p_type) const {
+
+ return p_type == "Script" || p_type == CSharpLanguage::get_singleton()->get_type();
+}
+
+String ResourceFormatLoaderCSharpScript::get_resource_type(const String &p_path) const {
+
+ return p_path.get_extension().to_lower() == "cs" ? CSharpLanguage::get_singleton()->get_type() : "";
+}
+
+Error ResourceFormatSaverCSharpScript::save(const String &p_path, const RES &p_resource, uint32_t p_flags) {
+
+ Ref<CSharpScript> sqscr = p_resource;
+ ERR_FAIL_COND_V(sqscr.is_null(), ERR_INVALID_PARAMETER);
+
+ String source = sqscr->get_source_code();
+
+#ifdef TOOLS_ENABLED
+ if (!FileAccess::exists(p_path)) {
+ // The file does not yet exists, let's assume the user just created this script
+
+ if (_create_project_solution_if_needed()) {
+ CSharpProject::add_item(GodotSharpDirs::get_project_csproj_path(),
+ "Compile",
+ ProjectSettings::get_singleton()->globalize_path(p_path));
+ } else {
+ ERR_PRINTS("Cannot add " + p_path + " to the C# project because it could not be created.");
+ }
+ }
+#endif
+
+ Error err;
+ FileAccess *file = FileAccess::open(p_path, FileAccess::WRITE, &err);
+ ERR_FAIL_COND_V(err, err);
+
+ file->store_string(source);
+
+ if (file->get_error() != OK && file->get_error() != ERR_FILE_EOF) {
+ memdelete(file);
+ return ERR_CANT_CREATE;
+ }
+
+ file->close();
+ memdelete(file);
+
+ if (ScriptServer::is_reload_scripts_on_save_enabled()) {
+ CSharpLanguage::get_singleton()->reload_tool_script(p_resource, false);
+ }
+
+ return OK;
+}
+
+void ResourceFormatSaverCSharpScript::get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const {
+
+ if (Object::cast_to<CSharpScript>(p_resource.ptr())) {
+ p_extensions->push_back("cs");
+ }
+}
+
+bool ResourceFormatSaverCSharpScript::recognize(const RES &p_resource) const {
+
+ return Object::cast_to<CSharpScript>(p_resource.ptr()) != NULL;
+}
+
+CSharpLanguage::StringNameCache::StringNameCache() {
+
+ _awaited_signal_callback = StaticCString::create("_AwaitedSignalCallback");
+ _set = StaticCString::create("_set");
+ _get = StaticCString::create("_get");
+ _notification = StaticCString::create("_notification");
+ dotctor = StaticCString::create(".ctor");
+}
diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h
new file mode 100644
index 0000000000..3fcc3bdf04
--- /dev/null
+++ b/modules/mono/csharp_script.h
@@ -0,0 +1,338 @@
+/*************************************************************************/
+/* csharp_script.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef CSHARP_SCRIPT_H
+#define CSHARP_SCRIPT_H
+
+#include "io/resource_loader.h"
+#include "io/resource_saver.h"
+#include "script_language.h"
+#include "self_list.h"
+
+#include "mono_gc_handle.h"
+#include "mono_gd/gd_mono.h"
+#include "mono_gd/gd_mono_header.h"
+#include "mono_gd/gd_mono_internals.h"
+
+class CSharpScript;
+class CSharpInstance;
+class CSharpLanguage;
+
+#ifdef NO_SAFE_CAST
+template <typename TScriptInstance, typename TScriptLanguage>
+TScriptInstance *cast_script_instance(ScriptInstance *p_inst) {
+ return p_inst->get_language() == TScriptLanguage::get_singleton() ? static_cast<TScriptInstance *>(p_inst) : NULL;
+}
+#else
+template <typename TScriptInstance, typename TScriptLanguage>
+TScriptInstance *cast_script_instance(ScriptInstance *p_inst) {
+ return dynamic_cast<TScriptInstance *>(p_inst);
+}
+#endif
+
+#define CAST_CSHARP_INSTANCE(m_inst) (cast_script_instance<CSharpInstance, CSharpLanguage>(m_inst))
+
+class CSharpScript : public Script {
+
+ GDCLASS(CSharpScript, Script)
+
+ friend class CSharpInstance;
+ friend class CSharpLanguage;
+ friend class CSharpScriptDepSort;
+
+ bool tool;
+ bool valid;
+
+ bool builtin;
+
+ GDMonoClass *base;
+ GDMonoClass *native;
+ GDMonoClass *script_class;
+
+ Ref<CSharpScript> base_cache; // TODO what's this for?
+
+ Set<Object *> instances;
+
+ String source;
+ StringName name;
+
+ SelfList<CSharpScript> script_list;
+
+#ifdef TOOLS_ENABLED
+ List<PropertyInfo> exported_members_cache; // members_cache
+ Map<StringName, Variant> exported_members_defval_cache; // member_default_values_cache
+ Set<PlaceHolderScriptInstance *> placeholders;
+ bool source_changed_cache;
+ bool exports_invalidated;
+
+ void _update_exports_values(Map<StringName, Variant> &values, List<PropertyInfo> &propnames);
+ virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder);
+#endif
+
+#ifdef DEBUG_ENABLED
+ Map<ObjectID, List<Pair<StringName, Variant> > > pending_reload_state;
+#endif
+
+ Map<StringName, PropertyInfo> member_info;
+
+ void _clear();
+
+ bool _update_exports();
+ CSharpInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Variant::CallError &r_error);
+ Variant _new(const Variant **p_args, int p_argcount, Variant::CallError &r_error);
+
+ // Do not use unless you know what you are doing
+ friend void GDMonoInternals::tie_managed_to_unmanaged(MonoObject *, Object *);
+ static Ref<CSharpScript> create_for_managed_type(GDMonoClass *p_class);
+
+protected:
+ static void _bind_methods();
+
+ Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error);
+ virtual void _resource_path_changed();
+
+public:
+ virtual bool can_instance() const;
+ virtual StringName get_instance_base_type() const;
+ virtual ScriptInstance *instance_create(Object *p_this);
+ virtual bool instance_has(const Object *p_this) const;
+
+ virtual bool has_source_code() const;
+ virtual String get_source_code() const;
+ virtual void set_source_code(const String &p_code);
+
+ virtual Error reload(bool p_keep_state = false);
+
+ /* TODO */ virtual bool has_script_signal(const StringName &p_signal) const { return false; }
+ /* TODO */ virtual void get_script_signal_list(List<MethodInfo> *r_signals) const {}
+
+ /* TODO */ virtual bool get_property_default_value(const StringName &p_property, Variant &r_value) const;
+ virtual void get_script_property_list(List<PropertyInfo> *p_list) const;
+ virtual void update_exports();
+
+ virtual bool is_tool() const { return tool; }
+ virtual Ref<Script> get_base_script() const;
+ virtual String get_node_type() const;
+ virtual ScriptLanguage *get_language() const;
+
+ /* TODO */ virtual void get_script_method_list(List<MethodInfo> *p_list) const {}
+ bool has_method(const StringName &p_method) const;
+ /* TODO */ MethodInfo get_method_info(const StringName &p_method) const { return MethodInfo(); }
+
+ virtual int get_member_line(const StringName &p_member) const;
+
+ Error load_source_code(const String &p_path);
+
+ StringName get_script_name() const;
+
+ CSharpScript();
+ ~CSharpScript();
+};
+
+class CSharpInstance : public ScriptInstance {
+
+ friend class CSharpScript;
+ friend class CSharpLanguage;
+ Object *owner;
+ Ref<CSharpScript> script;
+ Ref<MonoGCHandle> gchandle;
+ bool base_ref;
+ bool ref_dying;
+
+ void _ml_call_reversed(GDMonoClass *klass, const StringName &p_method, const Variant **p_args, int p_argcount);
+
+ void _reference_owner_unsafe();
+ void _unreference_owner_unsafe();
+
+ // Do not use unless you know what you are doing
+ friend void GDMonoInternals::tie_managed_to_unmanaged(MonoObject *, Object *);
+ static CSharpInstance *create_for_managed_type(Object *p_owner, CSharpScript *p_script, const Ref<MonoGCHandle> &p_gchandle);
+
+public:
+ MonoObject *get_mono_object() const;
+
+ virtual bool set(const StringName &p_name, const Variant &p_value);
+ virtual bool get(const StringName &p_name, Variant &r_ret) const;
+ virtual void get_property_list(List<PropertyInfo> *p_properties) const;
+ virtual Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid) const;
+
+ /* TODO */ virtual void get_method_list(List<MethodInfo> *p_list) const {}
+ virtual bool has_method(const StringName &p_method) const;
+ virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error);
+ virtual void call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount);
+ virtual void call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount);
+
+ void mono_object_disposed();
+
+ void refcount_incremented();
+ bool refcount_decremented();
+
+ RPCMode get_rpc_mode(const StringName &p_method) const;
+ RPCMode get_rset_mode(const StringName &p_variable) const;
+
+ virtual void notification(int p_notification);
+
+ virtual Ref<Script> get_script() const;
+
+ virtual ScriptLanguage *get_language();
+
+ CSharpInstance();
+ ~CSharpInstance();
+};
+
+class CSharpLanguage : public ScriptLanguage {
+
+ friend class CSharpScript;
+ friend class CSharpInstance;
+
+ static CSharpLanguage *singleton;
+
+ GDMono *gdmono;
+ SelfList<CSharpScript>::List script_list;
+
+ Mutex *lock;
+ Mutex *script_bind_lock;
+
+ Map<Ref<CSharpScript>, Map<ObjectID, List<Pair<StringName, Variant> > > > to_reload;
+
+ Map<Object *, Ref<MonoGCHandle> > gchandle_bindings;
+
+ struct StringNameCache {
+
+ StringName _awaited_signal_callback;
+ StringName _set;
+ StringName _get;
+ StringName _notification;
+ StringName dotctor; // .ctor
+
+ StringNameCache();
+ };
+
+ StringNameCache string_names;
+
+ int lang_idx;
+
+public:
+ _FORCE_INLINE_ int get_language_index() { return lang_idx; }
+ void set_language_index(int p_idx);
+
+ _FORCE_INLINE_ static CSharpLanguage *get_singleton() { return singleton; }
+
+ bool debug_break(const String &p_error, bool p_allow_continue = true);
+ bool debug_break_parse(const String &p_file, int p_line, const String &p_error);
+
+#ifdef TOOLS_ENABLED
+ void reload_assemblies_if_needed(bool p_soft_reload);
+#endif
+
+ virtual String get_name() const;
+
+ /* LANGUAGE FUNCTIONS */
+ virtual String get_type() const;
+ virtual String get_extension() const;
+ virtual Error execute_file(const String &p_path);
+ virtual void init();
+ virtual void finish();
+
+ /* EDITOR FUNCTIONS */
+ virtual void get_reserved_words(List<String> *p_words) const;
+ virtual void get_comment_delimiters(List<String> *p_delimiters) const;
+ virtual void get_string_delimiters(List<String> *p_delimiters) const;
+ virtual Ref<Script> get_template(const String &p_class_name, const String &p_base_class_name) const;
+ /* TODO */ virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions) const { return true; }
+ virtual Script *create_script() const;
+ virtual bool has_named_classes() const;
+ /* TODO? */ virtual int find_function(const String &p_function, const String &p_code) const { return -1; }
+ virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const;
+ /* TODO? */ Error complete_code(const String &p_code, const String &p_base_path, Object *p_owner, List<String> *r_options, String &r_call_hint) { return ERR_UNAVAILABLE; }
+ /* TODO? */ virtual void auto_indent_code(String &p_code, int p_from_line, int p_to_line) const {}
+ /* TODO */ virtual void add_global_constant(const StringName &p_variable, const Variant &p_value) {}
+
+ /* DEBUGGER FUNCTIONS */
+ /* TODO */ virtual String debug_get_error() const { return ""; }
+ /* TODO */ virtual int debug_get_stack_level_count() const { return 1; }
+ /* TODO */ virtual int debug_get_stack_level_line(int p_level) const { return 1; }
+ /* TODO */ virtual String debug_get_stack_level_function(int p_level) const { return ""; }
+ /* TODO */ virtual String debug_get_stack_level_source(int p_level) const { return ""; }
+ /* TODO */ virtual void debug_get_stack_level_locals(int p_level, List<String> *p_locals, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {}
+ /* TODO */ virtual void debug_get_stack_level_members(int p_level, List<String> *p_members, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {}
+ /* TODO */ virtual void debug_get_globals(List<String> *p_locals, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {}
+ /* TODO */ virtual String debug_parse_stack_level_expression(int p_level, const String &p_expression, int p_max_subitems, int p_max_depth) { return ""; }
+ /* TODO */ virtual Vector<StackInfo> debug_get_current_stack_info() { return Vector<StackInfo>(); }
+
+ /* PROFILING FUNCTIONS */
+ /* TODO */ virtual void profiling_start() {}
+ /* TODO */ virtual void profiling_stop() {}
+ /* TODO */ virtual int profiling_get_accumulated_data(ProfilingInfo *p_info_arr, int p_info_max) { return 0; }
+ /* TODO */ virtual int profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_info_max) { return 0; }
+
+ virtual void frame();
+
+ /* TODO? */ virtual void get_public_functions(List<MethodInfo> *p_functions) const {}
+ /* TODO? */ virtual void get_public_constants(List<Pair<String, Variant> > *p_constants) const {}
+
+ virtual void reload_all_scripts();
+ virtual void reload_tool_script(const Ref<Script> &p_script, bool p_soft_reload);
+
+ /* LOADER FUNCTIONS */
+ virtual void get_recognized_extensions(List<String> *p_extensions) const;
+
+#ifdef TOOLS_ENABLED
+ virtual Error open_in_external_editor(const Ref<Script> &p_script, int p_line, int p_col);
+ virtual bool overrides_external_editor();
+#endif
+
+ /* THREAD ATTACHING */
+ virtual void thread_enter();
+ virtual void thread_exit();
+
+ // Don't use these. I'm watching you
+ virtual void *alloc_instance_binding_data(Object *p_object);
+ virtual void free_instance_binding_data(void *p_data);
+
+ CSharpLanguage();
+ ~CSharpLanguage();
+};
+
+class ResourceFormatLoaderCSharpScript : public ResourceFormatLoader {
+public:
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
+ virtual void get_recognized_extensions(List<String> *p_extensions) const;
+ virtual bool handles_type(const String &p_type) const;
+ virtual String get_resource_type(const String &p_path) const;
+};
+
+class ResourceFormatSaverCSharpScript : public ResourceFormatSaver {
+public:
+ virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0);
+ virtual void get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const;
+ virtual bool recognize(const RES &p_resource) const;
+};
+
+#endif // CSHARP_SCRIPT_H
diff --git a/modules/mono/doc_classes/@C#.xml b/modules/mono/doc_classes/@C#.xml
new file mode 100644
index 0000000000..487ba9835f
--- /dev/null
+++ b/modules/mono/doc_classes/@C#.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="@C#" category="Core" version="3.0.alpha.custom_build">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/mono/doc_classes/CSharpScript.xml b/modules/mono/doc_classes/CSharpScript.xml
new file mode 100644
index 0000000000..5f21c9774d
--- /dev/null
+++ b/modules/mono/doc_classes/CSharpScript.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="CSharpScript" inherits="Script" category="Core" version="3.0.alpha.custom_build">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="new" qualifiers="vararg">
+ <return type="Object">
+ </return>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/mono/doc_classes/GodotSharp.xml b/modules/mono/doc_classes/GodotSharp.xml
new file mode 100644
index 0000000000..e7e06ddd8f
--- /dev/null
+++ b/modules/mono/doc_classes/GodotSharp.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="GodotSharp" inherits="Object" category="Core" version="3.0.alpha.custom_build">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="attach_thread">
+ <return type="void">
+ </return>
+ <description>
+ Attaches the current thread to the mono runtime.
+ </description>
+ </method>
+ <method name="detach_thread">
+ <return type="void">
+ </return>
+ <description>
+ Detaches the current thread from the mono runtime.
+ </description>
+ </method>
+ <method name="is_domain_loaded">
+ <return type="bool">
+ </return>
+ <description>
+ Returns whether the scripts domain is loaded.
+ </description>
+ </method>
+ <method name="is_finalizing_domain">
+ <return type="bool">
+ </return>
+ <description>
+ Returns whether the scripts domain is being finalized.
+ </description>
+ </method>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/mono/editor/GodotSharpTools/Build/BuildSystem.cs b/modules/mono/editor/GodotSharpTools/Build/BuildSystem.cs
new file mode 100644
index 0000000000..5544233eb7
--- /dev/null
+++ b/modules/mono/editor/GodotSharpTools/Build/BuildSystem.cs
@@ -0,0 +1,343 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Diagnostics;
+using System.IO;
+using System.Runtime.CompilerServices;
+using System.Security;
+using Microsoft.Build.Framework;
+
+namespace GodotSharpTools.Build
+{
+ public class BuildInstance : IDisposable
+ {
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static void godot_icall_BuildInstance_ExitCallback(string solution, string config, int exitCode);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static string godot_icall_BuildInstance_get_MSBuildPath();
+
+ private static string MSBuildPath
+ {
+ get
+ {
+ string ret = godot_icall_BuildInstance_get_MSBuildPath();
+
+ if (ret == null)
+ throw new FileNotFoundException("Cannot find the MSBuild executable.");
+
+ return ret;
+ }
+ }
+
+ private string solution;
+ private string config;
+
+ private Process process;
+
+ private int exitCode;
+ public int ExitCode { get { return exitCode; } }
+
+ public bool IsRunning { get { return process != null && !process.HasExited; } }
+
+ public BuildInstance(string solution, string config)
+ {
+ this.solution = solution;
+ this.config = config;
+ }
+
+ public bool Build(string loggerAssemblyPath, string loggerOutputDir, string[] customProperties = null)
+ {
+ string compilerArgs = BuildArguments(loggerAssemblyPath, loggerOutputDir, customProperties);
+
+ ProcessStartInfo startInfo = new ProcessStartInfo(MSBuildPath, compilerArgs);
+
+ // No console output, thanks
+ startInfo.RedirectStandardOutput = true;
+ startInfo.RedirectStandardError = true;
+ startInfo.UseShellExecute = false;
+
+ // Needed when running from Developer Command Prompt for VS
+ RemovePlatformVariable(startInfo.EnvironmentVariables);
+
+ using (Process process = new Process())
+ {
+ process.StartInfo = startInfo;
+
+ process.Start();
+
+ process.BeginOutputReadLine();
+ process.BeginErrorReadLine();
+
+ process.WaitForExit();
+
+ exitCode = process.ExitCode;
+ }
+
+ return true;
+ }
+
+ public bool BuildAsync(string loggerAssemblyPath, string loggerOutputDir, string[] customProperties = null)
+ {
+ if (process != null)
+ throw new InvalidOperationException("Already in use");
+
+ string compilerArgs = BuildArguments(loggerAssemblyPath, loggerOutputDir, customProperties);
+
+ ProcessStartInfo startInfo = new ProcessStartInfo("msbuild", compilerArgs);
+
+ // No console output, thanks
+ startInfo.RedirectStandardOutput = true;
+ startInfo.RedirectStandardError = true;
+ startInfo.UseShellExecute = false;
+
+ // Needed when running from Developer Command Prompt for VS
+ RemovePlatformVariable(startInfo.EnvironmentVariables);
+
+ process = new Process();
+ process.StartInfo = startInfo;
+ process.EnableRaisingEvents = true;
+ process.Exited += new EventHandler(BuildProcess_Exited);
+
+ process.Start();
+
+ return true;
+ }
+
+ private string BuildArguments(string loggerAssemblyPath, string loggerOutputDir, string[] customProperties)
+ {
+ string arguments = string.Format(@"""{0}"" /v:normal /t:Build ""/p:{1}"" ""/l:{2},{3};{4}""",
+ solution,
+ "Configuration=" + config,
+ typeof(GodotBuildLogger).FullName,
+ loggerAssemblyPath,
+ loggerOutputDir
+ );
+
+ if (customProperties != null)
+ {
+ foreach (string customProperty in customProperties)
+ {
+ arguments += " /p:" + customProperty;
+ }
+ }
+
+ return arguments;
+ }
+
+ private void RemovePlatformVariable(StringDictionary environmentVariables)
+ {
+ // EnvironmentVariables is case sensitive? Seriously?
+
+ List<string> platformEnvironmentVariables = new List<string>();
+
+ foreach (string env in environmentVariables.Keys)
+ {
+ if (env.ToUpper() == "PLATFORM")
+ platformEnvironmentVariables.Add(env);
+ }
+
+ foreach (string env in platformEnvironmentVariables)
+ environmentVariables.Remove(env);
+ }
+
+ private void BuildProcess_Exited(object sender, System.EventArgs e)
+ {
+ exitCode = process.ExitCode;
+
+ godot_icall_BuildInstance_ExitCallback(solution, config, exitCode);
+
+ Dispose();
+ }
+
+ public void Dispose()
+ {
+ if (process != null)
+ {
+ process.Dispose();
+ process = null;
+ }
+ }
+ }
+
+ public class GodotBuildLogger : ILogger
+ {
+ public string Parameters { get; set; }
+ public LoggerVerbosity Verbosity { get; set; }
+
+ public void Initialize(IEventSource eventSource)
+ {
+ if (null == Parameters)
+ throw new LoggerException("Log directory was not set.");
+
+ string[] parameters = Parameters.Split(';');
+
+ string logDir = parameters[0];
+
+ if (String.IsNullOrEmpty(logDir))
+ throw new LoggerException("Log directory was not set.");
+
+ if (parameters.Length > 1)
+ throw new LoggerException("Too many parameters passed.");
+
+ string logFile = Path.Combine(logDir, "msbuild_log.txt");
+ string issuesFile = Path.Combine(logDir, "msbuild_issues.csv");
+
+ try
+ {
+ if (!Directory.Exists(logDir))
+ Directory.CreateDirectory(logDir);
+
+ this.logStreamWriter = new StreamWriter(logFile);
+ this.issuesStreamWriter = new StreamWriter(issuesFile);
+ }
+ catch (Exception ex)
+ {
+ if
+ (
+ ex is UnauthorizedAccessException
+ || ex is ArgumentNullException
+ || ex is PathTooLongException
+ || ex is DirectoryNotFoundException
+ || ex is NotSupportedException
+ || ex is ArgumentException
+ || ex is SecurityException
+ || ex is IOException
+ )
+ {
+ throw new LoggerException("Failed to create log file: " + ex.Message);
+ }
+ else
+ {
+ // Unexpected failure
+ throw;
+ }
+ }
+
+ eventSource.ProjectStarted += new ProjectStartedEventHandler(eventSource_ProjectStarted);
+ eventSource.TaskStarted += new TaskStartedEventHandler(eventSource_TaskStarted);
+ eventSource.MessageRaised += new BuildMessageEventHandler(eventSource_MessageRaised);
+ eventSource.WarningRaised += new BuildWarningEventHandler(eventSource_WarningRaised);
+ eventSource.ErrorRaised += new BuildErrorEventHandler(eventSource_ErrorRaised);
+ eventSource.ProjectFinished += new ProjectFinishedEventHandler(eventSource_ProjectFinished);
+ }
+
+ void eventSource_ErrorRaised(object sender, BuildErrorEventArgs e)
+ {
+ string line = String.Format("{0}({1},{2}): error {3}: {4}", e.File, e.LineNumber, e.ColumnNumber, e.Code, e.Message);
+
+ if (e.ProjectFile.Length > 0)
+ line += string.Format(" [{0}]", e.ProjectFile);
+
+ WriteLine(line);
+
+ string errorLine = String.Format(@"error,{0},{1},{2},{3},{4},{5}",
+ e.File.CsvEscape(), e.LineNumber, e.ColumnNumber,
+ e.Code.CsvEscape(), e.Message.CsvEscape(), e.ProjectFile.CsvEscape());
+ issuesStreamWriter.WriteLine(errorLine);
+ }
+
+ void eventSource_WarningRaised(object sender, BuildWarningEventArgs e)
+ {
+ string line = String.Format("{0}({1},{2}): warning {3}: {4}", e.File, e.LineNumber, e.ColumnNumber, e.Code, e.Message, e.ProjectFile);
+
+ if (e.ProjectFile != null && e.ProjectFile.Length > 0)
+ line += string.Format(" [{0}]", e.ProjectFile);
+
+ WriteLine(line);
+
+ string warningLine = String.Format(@"warning,{0},{1},{2},{3},{4},{5}",
+ e.File.CsvEscape(), e.LineNumber, e.ColumnNumber,
+ e.Code.CsvEscape(), e.Message.CsvEscape(), e.ProjectFile != null ? e.ProjectFile.CsvEscape() : string.Empty);
+ issuesStreamWriter.WriteLine(warningLine);
+ }
+
+ void eventSource_MessageRaised(object sender, BuildMessageEventArgs e)
+ {
+ // BuildMessageEventArgs adds Importance to BuildEventArgs
+ // Let's take account of the verbosity setting we've been passed in deciding whether to log the message
+ if ((e.Importance == MessageImportance.High && IsVerbosityAtLeast(LoggerVerbosity.Minimal))
+ || (e.Importance == MessageImportance.Normal && IsVerbosityAtLeast(LoggerVerbosity.Normal))
+ || (e.Importance == MessageImportance.Low && IsVerbosityAtLeast(LoggerVerbosity.Detailed))
+ )
+ {
+ WriteLineWithSenderAndMessage(String.Empty, e);
+ }
+ }
+
+ void eventSource_TaskStarted(object sender, TaskStartedEventArgs e)
+ {
+ // TaskStartedEventArgs adds ProjectFile, TaskFile, TaskName
+ // To keep this log clean, this logger will ignore these events.
+ }
+
+ void eventSource_ProjectStarted(object sender, ProjectStartedEventArgs e)
+ {
+ WriteLine(e.Message);
+ indent++;
+ }
+
+ void eventSource_ProjectFinished(object sender, ProjectFinishedEventArgs e)
+ {
+ indent--;
+ WriteLine(e.Message);
+ }
+
+ /// <summary>
+ /// Write a line to the log, adding the SenderName
+ /// </summary>
+ private void WriteLineWithSender(string line, BuildEventArgs e)
+ {
+ if (0 == String.Compare(e.SenderName, "MSBuild", true /*ignore case*/))
+ {
+ // Well, if the sender name is MSBuild, let's leave it out for prettiness
+ WriteLine(line);
+ }
+ else
+ {
+ WriteLine(e.SenderName + ": " + line);
+ }
+ }
+
+ /// <summary>
+ /// Write a line to the log, adding the SenderName and Message
+ /// (these parameters are on all MSBuild event argument objects)
+ /// </summary>
+ private void WriteLineWithSenderAndMessage(string line, BuildEventArgs e)
+ {
+ if (0 == String.Compare(e.SenderName, "MSBuild", true /*ignore case*/))
+ {
+ // Well, if the sender name is MSBuild, let's leave it out for prettiness
+ WriteLine(line + e.Message);
+ }
+ else
+ {
+ WriteLine(e.SenderName + ": " + line + e.Message);
+ }
+ }
+
+ private void WriteLine(string line)
+ {
+ for (int i = indent; i > 0; i--)
+ {
+ logStreamWriter.Write("\t");
+ }
+ logStreamWriter.WriteLine(line);
+ }
+
+ public void Shutdown()
+ {
+ logStreamWriter.Close();
+ issuesStreamWriter.Close();
+ }
+
+ public bool IsVerbosityAtLeast(LoggerVerbosity checkVerbosity)
+ {
+ return this.Verbosity >= checkVerbosity;
+ }
+
+ private StreamWriter logStreamWriter;
+ private StreamWriter issuesStreamWriter;
+ private int indent;
+ }
+}
diff --git a/modules/mono/editor/GodotSharpTools/Editor/MonoDevelopInstance.cs b/modules/mono/editor/GodotSharpTools/Editor/MonoDevelopInstance.cs
new file mode 100644
index 0000000000..303be3b732
--- /dev/null
+++ b/modules/mono/editor/GodotSharpTools/Editor/MonoDevelopInstance.cs
@@ -0,0 +1,58 @@
+using System;
+using System.IO;
+using System.Collections.Generic;
+using System.Diagnostics;
+
+namespace GodotSharpTools.Editor
+{
+ public class MonoDevelopInstance
+ {
+ private Process process;
+ private string solutionFile;
+
+ public void Execute(string[] files)
+ {
+ bool newWindow = process == null || process.HasExited;
+
+ List<string> args = new List<string>();
+
+ args.Add("--ipc-tcp");
+
+ if (newWindow)
+ args.Add("\"" + Path.GetFullPath(solutionFile) + "\"");
+
+ foreach (var file in files)
+ {
+ int semicolonIndex = file.IndexOf(';');
+
+ string filePath = semicolonIndex < 0 ? file : file.Substring(0, semicolonIndex);
+ string cursor = semicolonIndex < 0 ? string.Empty : file.Substring(semicolonIndex);
+
+ args.Add("\"" + Path.GetFullPath(filePath.NormalizePath()) + cursor + "\"");
+ }
+
+ if (newWindow)
+ {
+ ProcessStartInfo startInfo = new ProcessStartInfo(MonoDevelopFile, string.Join(" ", args));
+ process = Process.Start(startInfo);
+ }
+ else
+ {
+ Process.Start(MonoDevelopFile, string.Join(" ", args));
+ }
+ }
+
+ public MonoDevelopInstance(string solutionFile)
+ {
+ this.solutionFile = solutionFile;
+ }
+
+ private static string MonoDevelopFile
+ {
+ get
+ {
+ return "monodevelop";
+ }
+ }
+ }
+}
diff --git a/modules/mono/editor/GodotSharpTools/GodotSharpTools.csproj b/modules/mono/editor/GodotSharpTools/GodotSharpTools.csproj
new file mode 100644
index 0000000000..981083a3c2
--- /dev/null
+++ b/modules/mono/editor/GodotSharpTools/GodotSharpTools.csproj
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{A8CDAD94-C6D4-4B19-A7E7-76C53CC92984}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <RootNamespace>GodotSharpTools</RootNamespace>
+ <AssemblyName>GodotSharpTools</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug</OutputPath>
+ <DefineConstants>DEBUG;</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>false</ConsolePause>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>full</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>false</ConsolePause>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="Microsoft.Build" />
+ <Reference Include="Microsoft.Build.Framework" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="StringExtensions.cs" />
+ <Compile Include="Build\BuildSystem.cs" />
+ <Compile Include="Editor\MonoDevelopInstance.cs" />
+ <Compile Include="Project\ProjectExtensions.cs" />
+ <Compile Include="Project\ProjectGenerator.cs" />
+ <Compile Include="Project\ProjectUtils.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+</Project> \ No newline at end of file
diff --git a/modules/mono/editor/GodotSharpTools/GodotSharpTools.sln b/modules/mono/editor/GodotSharpTools/GodotSharpTools.sln
new file mode 100644
index 0000000000..7eabcdff5d
--- /dev/null
+++ b/modules/mono/editor/GodotSharpTools/GodotSharpTools.sln
@@ -0,0 +1,17 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GodotSharpTools", "GodotSharpTools.csproj", "{A8CDAD94-C6D4-4B19-A7E7-76C53CC92984}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {A8CDAD94-C6D4-4B19-A7E7-76C53CC92984}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A8CDAD94-C6D4-4B19-A7E7-76C53CC92984}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A8CDAD94-C6D4-4B19-A7E7-76C53CC92984}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A8CDAD94-C6D4-4B19-A7E7-76C53CC92984}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+EndGlobal
diff --git a/modules/mono/editor/GodotSharpTools/GodotSharpTools.userprefs b/modules/mono/editor/GodotSharpTools/GodotSharpTools.userprefs
new file mode 100644
index 0000000000..0cbafdc20d
--- /dev/null
+++ b/modules/mono/editor/GodotSharpTools/GodotSharpTools.userprefs
@@ -0,0 +1,14 @@
+<Properties StartupItem="GodotSharpTools.csproj">
+ <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
+ <MonoDevelop.Ide.Workbench ActiveDocument="Build/BuildSystem.cs">
+ <Files>
+ <File FileName="Build/ProjectExtensions.cs" Line="1" Column="1" />
+ <File FileName="Build/ProjectGenerator.cs" Line="1" Column="1" />
+ <File FileName="Build/BuildSystem.cs" Line="37" Column="14" />
+ </Files>
+ </MonoDevelop.Ide.Workbench>
+ <MonoDevelop.Ide.DebuggingService.Breakpoints>
+ <BreakpointStore />
+ </MonoDevelop.Ide.DebuggingService.Breakpoints>
+ <MonoDevelop.Ide.DebuggingService.PinnedWatches />
+</Properties> \ No newline at end of file
diff --git a/modules/mono/editor/GodotSharpTools/Project/ProjectExtensions.cs b/modules/mono/editor/GodotSharpTools/Project/ProjectExtensions.cs
new file mode 100644
index 0000000000..f00ec5a2ad
--- /dev/null
+++ b/modules/mono/editor/GodotSharpTools/Project/ProjectExtensions.cs
@@ -0,0 +1,52 @@
+using System;
+using Microsoft.Build.Construction;
+
+namespace GodotSharpTools.Project
+{
+ public static class ProjectExtensions
+ {
+ public static bool HasItem(this ProjectRootElement root, string itemType, string include)
+ {
+ string includeNormalized = include.NormalizePath();
+
+ foreach (var itemGroup in root.ItemGroups)
+ {
+ if (itemGroup.Condition.Length != 0)
+ continue;
+
+ foreach (var item in itemGroup.Items)
+ {
+ if (item.ItemType == itemType)
+ {
+ if (item.Include.NormalizePath() == includeNormalized)
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ public static bool AddItemChecked(this ProjectRootElement root, string itemType, string include)
+ {
+ if (!root.HasItem(itemType, include))
+ {
+ root.AddItem(itemType, include);
+ return true;
+ }
+
+ return false;
+ }
+
+ public static Guid GetGuid(this ProjectRootElement root)
+ {
+ foreach (var property in root.Properties)
+ {
+ if (property.Name == "ProjectGuid")
+ return Guid.Parse(property.Value);
+ }
+
+ return Guid.Empty;
+ }
+ }
+}
diff --git a/modules/mono/editor/GodotSharpTools/Project/ProjectGenerator.cs b/modules/mono/editor/GodotSharpTools/Project/ProjectGenerator.cs
new file mode 100644
index 0000000000..6bf54a0156
--- /dev/null
+++ b/modules/mono/editor/GodotSharpTools/Project/ProjectGenerator.cs
@@ -0,0 +1,216 @@
+using System;
+using System.IO;
+using Microsoft.Build.Construction;
+
+namespace GodotSharpTools.Project
+{
+ public static class ProjectGenerator
+ {
+ public static string GenCoreApiProject(string dir, string[] compileItems)
+ {
+ string path = Path.Combine(dir, CoreApiProject + ".csproj");
+
+ ProjectPropertyGroupElement mainGroup;
+ var root = CreateLibraryProject(CoreApiProject, out mainGroup);
+
+ mainGroup.AddProperty("DocumentationFile", Path.Combine("$(OutputPath)", "$(AssemblyName).xml"));
+ mainGroup.SetProperty("RootNamespace", "Godot");
+
+ GenAssemblyInfoFile(root, dir, CoreApiProject,
+ new string[] { "[assembly: InternalsVisibleTo(\"" + EditorApiProject + "\")]" },
+ new string[] { "System.Runtime.CompilerServices" });
+
+ foreach (var item in compileItems)
+ {
+ root.AddItem("Compile", item.RelativeToPath(dir).Replace("/", "\\"));
+ }
+
+ root.Save(path);
+
+ return root.GetGuid().ToString().ToUpper();
+ }
+
+ public static string GenEditorApiProject(string dir, string coreApiHintPath, string[] compileItems)
+ {
+ string path = Path.Combine(dir, EditorApiProject + ".csproj");
+
+ ProjectPropertyGroupElement mainGroup;
+ var root = CreateLibraryProject(EditorApiProject, out mainGroup);
+
+ mainGroup.AddProperty("DocumentationFile", Path.Combine("$(OutputPath)", "$(AssemblyName).xml"));
+ mainGroup.SetProperty("RootNamespace", "Godot");
+
+ GenAssemblyInfoFile(root, dir, EditorApiProject);
+
+ foreach (var item in compileItems)
+ {
+ root.AddItem("Compile", item.RelativeToPath(dir).Replace("/", "\\"));
+ }
+
+ var coreApiRef = root.AddItem("Reference", CoreApiProject);
+ coreApiRef.AddMetadata("HintPath", coreApiHintPath);
+ coreApiRef.AddMetadata("Private", "False");
+
+ root.Save(path);
+
+ return root.GetGuid().ToString().ToUpper();
+ }
+
+ public static string GenGameProject(string dir, string name, string[] compileItems)
+ {
+ string path = Path.Combine(dir, name + ".csproj");
+
+ ProjectPropertyGroupElement mainGroup;
+ var root = CreateLibraryProject(name, out mainGroup);
+
+ mainGroup.SetProperty("OutputPath", Path.Combine(".mono", "temp", "bin", "$(Configuration)"));
+ mainGroup.SetProperty("BaseIntermediateOutputPath", Path.Combine(".mono", "temp", "obj"));
+ mainGroup.SetProperty("IntermediateOutputPath", Path.Combine("$(BaseIntermediateOutputPath)", "$(Configuration)"));
+
+ var toolsGroup = root.AddPropertyGroup();
+ toolsGroup.Condition = " '$(Configuration)|$(Platform)' == 'Tools|AnyCPU' ";
+ toolsGroup.AddProperty("DebugSymbols", "true");
+ toolsGroup.AddProperty("DebugType", "full");
+ toolsGroup.AddProperty("Optimize", "false");
+ toolsGroup.AddProperty("DefineConstants", "DEBUG;TOOLS;");
+ toolsGroup.AddProperty("ErrorReport", "prompt");
+ toolsGroup.AddProperty("WarningLevel", "4");
+ toolsGroup.AddProperty("ConsolePause", "false");
+
+ var coreApiRef = root.AddItem("Reference", CoreApiProject);
+ coreApiRef.AddMetadata("HintPath", Path.Combine("$(ProjectDir)", ".mono", "assemblies", CoreApiProject + ".dll"));
+ coreApiRef.AddMetadata("Private", "False");
+
+ var editorApiRef = root.AddItem("Reference", EditorApiProject);
+ editorApiRef.Condition = " '$(Configuration)' == 'Tools' ";
+ editorApiRef.AddMetadata("HintPath", Path.Combine("$(ProjectDir)", ".mono", "assemblies", EditorApiProject + ".dll"));
+ editorApiRef.AddMetadata("Private", "False");
+
+ GenAssemblyInfoFile(root, dir, name);
+
+ foreach (var item in compileItems)
+ {
+ root.AddItem("Compile", item.RelativeToPath(dir).Replace("/", "\\"));
+ }
+
+ root.Save(path);
+
+ return root.GetGuid().ToString().ToUpper();
+ }
+
+ public static void GenAssemblyInfoFile(ProjectRootElement root, string dir, string name, string[] assemblyLines = null, string[] usingDirectives = null)
+ {
+
+ string propertiesDir = Path.Combine(dir, "Properties");
+ if (!Directory.Exists(propertiesDir))
+ Directory.CreateDirectory(propertiesDir);
+
+ string usingDirectivesText = string.Empty;
+
+ if (usingDirectives != null)
+ {
+ foreach (var usingDirective in usingDirectives)
+ usingDirectivesText += "\nusing " + usingDirective + ";";
+ }
+
+ string assemblyLinesText = string.Empty;
+
+ if (assemblyLines != null)
+ {
+ foreach (var assemblyLine in assemblyLines)
+ assemblyLinesText += string.Join("\n", assemblyLines) + "\n";
+ }
+
+ string content = string.Format(assemblyInfoTemplate, usingDirectivesText, name, assemblyLinesText);
+
+ string assemblyInfoFile = Path.Combine(propertiesDir, "AssemblyInfo.cs");
+
+ File.WriteAllText(assemblyInfoFile, content);
+
+ root.AddItem("Compile", assemblyInfoFile.RelativeToPath(dir).Replace("/", "\\"));
+ }
+
+ public static ProjectRootElement CreateLibraryProject(string name, out ProjectPropertyGroupElement mainGroup)
+ {
+ var root = ProjectRootElement.Create();
+ root.DefaultTargets = "Build";
+
+ mainGroup = root.AddPropertyGroup();
+ mainGroup.AddProperty("Configuration", "Debug").Condition = " '$(Configuration)' == '' ";
+ mainGroup.AddProperty("Platform", "AnyCPU").Condition = " '$(Platform)' == '' ";
+ mainGroup.AddProperty("ProjectGuid", "{" + Guid.NewGuid().ToString().ToUpper() + "}");
+ mainGroup.AddProperty("OutputType", "Library");
+ mainGroup.AddProperty("OutputPath", Path.Combine("bin", "$(Configuration)"));
+ mainGroup.AddProperty("RootNamespace", name);
+ mainGroup.AddProperty("AssemblyName", name);
+ mainGroup.AddProperty("TargetFrameworkVersion", "v4.5");
+
+ var debugGroup = root.AddPropertyGroup();
+ debugGroup.Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ";
+ debugGroup.AddProperty("DebugSymbols", "true");
+ debugGroup.AddProperty("DebugType", "full");
+ debugGroup.AddProperty("Optimize", "false");
+ debugGroup.AddProperty("DefineConstants", "DEBUG;");
+ debugGroup.AddProperty("ErrorReport", "prompt");
+ debugGroup.AddProperty("WarningLevel", "4");
+ debugGroup.AddProperty("ConsolePause", "false");
+
+ var releaseGroup = root.AddPropertyGroup();
+ releaseGroup.Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ";
+ releaseGroup.AddProperty("DebugType", "full");
+ releaseGroup.AddProperty("Optimize", "true");
+ releaseGroup.AddProperty("ErrorReport", "prompt");
+ releaseGroup.AddProperty("WarningLevel", "4");
+ releaseGroup.AddProperty("ConsolePause", "false");
+
+ // References
+ var referenceGroup = root.AddItemGroup();
+ referenceGroup.AddItem("Reference", "System");
+
+ root.AddImport(Path.Combine("$(MSBuildBinPath)", "Microsoft.CSharp.targets").Replace("/", "\\"));
+
+ return root;
+ }
+
+ private static void AddItems(ProjectRootElement elem, string groupName, params string[] items)
+ {
+ var group = elem.AddItemGroup();
+
+ foreach (var item in items)
+ {
+ group.AddItem(groupName, item);
+ }
+ }
+
+ public const string CoreApiProject = "GodotSharp";
+ public const string EditorApiProject = "GodotSharpEditor";
+
+ private const string assemblyInfoTemplate =
+@"using System.Reflection;{0}
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle(""{1}"")]
+[assembly: AssemblyDescription("""")]
+[assembly: AssemblyConfiguration("""")]
+[assembly: AssemblyCompany("""")]
+[assembly: AssemblyProduct("""")]
+[assembly: AssemblyCopyright("""")]
+[assembly: AssemblyTrademark("""")]
+[assembly: AssemblyCulture("""")]
+
+// The assembly version has the format ""{{Major}}.{{Minor}}.{{Build}}.{{Revision}}"".
+// The form ""{{Major}}.{{Minor}}.*"" will automatically update the build and revision,
+// and ""{{Major}}.{{Minor}}.{{Build}}.*"" will update just the revision.
+
+[assembly: AssemblyVersion(""1.0.*"")]
+
+// The following attributes are used to specify the signing key for the assembly,
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("""")]
+{2}";
+ }
+}
diff --git a/modules/mono/editor/GodotSharpTools/Project/ProjectUtils.cs b/modules/mono/editor/GodotSharpTools/Project/ProjectUtils.cs
new file mode 100644
index 0000000000..6889ea715f
--- /dev/null
+++ b/modules/mono/editor/GodotSharpTools/Project/ProjectUtils.cs
@@ -0,0 +1,17 @@
+using System;
+using System.IO;
+using Microsoft.Build.Construction;
+
+namespace GodotSharpTools.Project
+{
+ public static class ProjectUtils
+ {
+ public static void AddItemToProjectChecked(string projectPath, string itemType, string include)
+ {
+ var dir = Directory.GetParent(projectPath).FullName;
+ var root = ProjectRootElement.Open(projectPath);
+ if (root.AddItemChecked(itemType, include.RelativeToPath(dir).Replace("/", "\\")))
+ root.Save();
+ }
+ }
+}
diff --git a/modules/mono/editor/GodotSharpTools/Properties/AssemblyInfo.cs b/modules/mono/editor/GodotSharpTools/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..7115d8fc71
--- /dev/null
+++ b/modules/mono/editor/GodotSharpTools/Properties/AssemblyInfo.cs
@@ -0,0 +1,27 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle("GodotSharpTools")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("ignacio")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion("1.0.*")]
+
+// The following attributes are used to specify the signing key for the assembly,
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
+
diff --git a/modules/mono/editor/GodotSharpTools/StringExtensions.cs b/modules/mono/editor/GodotSharpTools/StringExtensions.cs
new file mode 100644
index 0000000000..b66c86f8ce
--- /dev/null
+++ b/modules/mono/editor/GodotSharpTools/StringExtensions.cs
@@ -0,0 +1,52 @@
+using System;
+using System.IO;
+
+namespace GodotSharpTools
+{
+ public static class StringExtensions
+ {
+ public static string RelativeToPath(this string path, string dir)
+ {
+ // Make sure the directory ends with a path separator
+ dir = Path.Combine(dir, " ").TrimEnd();
+
+ if (Path.DirectorySeparatorChar == '\\')
+ dir = dir.Replace("/", "\\") + "\\";
+
+ Uri fullPath = new Uri(Path.GetFullPath(path), UriKind.Absolute);
+ Uri relRoot = new Uri(Path.GetFullPath(dir), UriKind.Absolute);
+
+ return relRoot.MakeRelativeUri(fullPath).ToString();
+ }
+
+ public static string NormalizePath(this string path)
+ {
+ bool rooted = path.IsAbsolutePath();
+
+ path = path.Replace('\\', '/');
+
+ string[] parts = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
+
+ path = string.Join(Path.DirectorySeparatorChar.ToString(), parts).Trim();
+
+ return rooted ? Path.DirectorySeparatorChar.ToString() + path : path;
+ }
+
+ private static readonly string driveRoot = Path.GetPathRoot(Environment.CurrentDirectory);
+
+ public static bool IsAbsolutePath(this string path)
+ {
+ return path.StartsWith("/") || path.StartsWith("\\") || path.StartsWith(driveRoot);
+ }
+
+ public static string CsvEscape(this string value, char delimiter = ',')
+ {
+ bool hasSpecialChar = value.IndexOfAny(new char[] { '\"', '\n', '\r', delimiter }) != -1;
+
+ if (hasSpecialChar)
+ return "\"" + value.Replace("\"", "\"\"") + "\"";
+
+ return value;
+ }
+ }
+}
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
new file mode 100644
index 0000000000..704910c5b9
--- /dev/null
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -0,0 +1,2142 @@
+/*************************************************************************/
+/* bindings_generator.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "bindings_generator.h"
+
+#ifdef DEBUG_METHODS_ENABLED
+
+#include "global_constants.h"
+#include "io/compression.h"
+#include "os/dir_access.h"
+#include "os/file_access.h"
+#include "os/os.h"
+#include "project_settings.h"
+#include "ucaps.h"
+
+#include "../glue/cs_compressed.gen.h"
+#include "../godotsharp_defs.h"
+#include "../mono_gd/gd_mono_marshal.h"
+#include "../utils/path_utils.h"
+#include "../utils/string_utils.h"
+#include "csharp_project.h"
+#include "net_solution.h"
+
+#define CS_INDENT " "
+
+#define INDENT1 CS_INDENT
+#define INDENT2 INDENT1 INDENT1
+#define INDENT3 INDENT2 INDENT1
+#define INDENT4 INDENT3 INDENT1
+#define INDENT5 INDENT4 INDENT1
+
+#define MEMBER_BEGIN "\n" INDENT2
+
+#define OPEN_BLOCK "{\n"
+#define CLOSE_BLOCK "}\n"
+
+#define OPEN_BLOCK_L2 INDENT2 OPEN_BLOCK INDENT3
+#define OPEN_BLOCK_L3 INDENT3 OPEN_BLOCK INDENT4
+#define OPEN_BLOCK_L4 INDENT4 OPEN_BLOCK INDENT5
+#define CLOSE_BLOCK_L2 INDENT2 CLOSE_BLOCK
+#define CLOSE_BLOCK_L3 INDENT3 CLOSE_BLOCK
+#define CLOSE_BLOCK_L4 INDENT4 CLOSE_BLOCK
+
+#define LOCAL_RET "ret"
+
+#define CS_CLASS_NATIVECALLS "NativeCalls"
+#define CS_CLASS_NATIVECALLS_EDITOR "EditorNativeCalls"
+#define CS_FIELD_MEMORYOWN "memoryOwn"
+#define CS_PARAM_METHODBIND "method"
+#define CS_PARAM_INSTANCE "ptr"
+#define CS_SMETHOD_GETINSTANCE "GetPtr"
+#define CS_FIELD_SINGLETON "instance"
+#define CS_PROP_SINGLETON "Instance"
+#define CS_CLASS_SIGNALAWAITER "SignalAwaiter"
+#define CS_METHOD_CALL "Call"
+
+#define GLUE_HEADER_FILE "glue_header.h"
+#define ICALL_PREFIX "godot_icall_"
+#define SINGLETON_ICALL_SUFFIX "_get_singleton"
+#define ICALL_GET_METHODBIND ICALL_PREFIX "ClassDB_get_method"
+#define ICALL_CONNECT_SIGNAL_AWAITER ICALL_PREFIX "Object_connect_signal_awaiter"
+#define ICALL_OBJECT_DTOR ICALL_PREFIX "Object_Dtor"
+#define C_LOCAL_PTRCALL_ARGS "call_args"
+#define C_MACRO_OBJECT_CONSTRUCT "GODOTSHARP_INSTANCE_OBJECT"
+
+#define C_NS_MONOUTILS "GDMonoUtils"
+#define C_NS_MONOINTERNALS "GDMonoInternals"
+#define C_METHOD_TIE_MANAGED_TO_UNMANAGED C_NS_MONOINTERNALS "::tie_managed_to_unmanaged"
+#define C_METHOD_UNMANAGED_GET_MANAGED C_NS_MONOUTILS "::unmanaged_get_managed"
+
+#define C_NS_MONOMARSHAL "GDMonoMarshal"
+#define C_METHOD_MANAGED_TO_VARIANT C_NS_MONOMARSHAL "::mono_object_to_variant"
+#define C_METHOD_MANAGED_FROM_VARIANT C_NS_MONOMARSHAL "::variant_to_mono_object"
+#define C_METHOD_MONOSTR_TO_GODOT C_NS_MONOMARSHAL "::mono_string_to_godot"
+#define C_METHOD_MONOSTR_FROM_GODOT C_NS_MONOMARSHAL "::mono_string_from_godot"
+#define C_METHOD_MONOARRAY_TO(m_type) C_NS_MONOMARSHAL "::mono_array_to_" #m_type
+#define C_METHOD_MONOARRAY_FROM(m_type) C_NS_MONOMARSHAL "::" #m_type "_to_mono_array"
+#define C_METHOD_MANAGED_TO_DICT C_NS_MONOMARSHAL "::mono_object_to_Dictionary"
+#define C_METHOD_MANAGED_FROM_DICT C_NS_MONOMARSHAL "::Dictionary_to_mono_object"
+
+const char *BindingsGenerator::TypeInterface::DEFAULT_VARARG_C_IN = "\t%0 %1_in = %1;\n";
+
+bool BindingsGenerator::verbose_output = false;
+
+static bool is_csharp_keyword(const String &p_name) {
+
+ // Reserved keywords
+
+ return p_name == "abstract" || p_name == "as" || p_name == "base" || p_name == "bool" ||
+ p_name == "break" || p_name == "byte" || p_name == "case" || p_name == "catch" ||
+ p_name == "char" || p_name == "checked" || p_name == "class" || p_name == "const" ||
+ p_name == "continue" || p_name == "decimal" || p_name == "default" || p_name == "delegate" ||
+ p_name == "do" || p_name == "double" || p_name == "else" || p_name == "enum" ||
+ p_name == "event" || p_name == "explicit" || p_name == "extern" || p_name == "false" ||
+ p_name == "finally" || p_name == "fixed" || p_name == "float" || p_name == "for" ||
+ p_name == "forech" || p_name == "goto" || p_name == "if" || p_name == "implicit" ||
+ p_name == "in" || p_name == "int" || p_name == "interface" || p_name == "internal" ||
+ p_name == "is" || p_name == "lock" || p_name == "long" || p_name == "namespace" ||
+ p_name == "new" || p_name == "null" || p_name == "object" || p_name == "operator" ||
+ p_name == "out" || p_name == "override" || p_name == "params" || p_name == "private" ||
+ p_name == "protected" || p_name == "public" || p_name == "readonly" || p_name == "ref" ||
+ p_name == "return" || p_name == "sbyte" || p_name == "sealed" || p_name == "short" ||
+ p_name == "sizeof" || p_name == "stackalloc" || p_name == "static" || p_name == "string" ||
+ p_name == "struct" || p_name == "switch" || p_name == "this" || p_name == "throw" ||
+ p_name == "true" || p_name == "try" || p_name == "typeof" || p_name == "uint" || p_name == "ulong" ||
+ p_name == "unchecked" || p_name == "unsafe" || p_name == "ushort" || p_name == "using" ||
+ p_name == "virtual" || p_name == "volatile" || p_name == "void" || p_name == "while";
+}
+
+inline static String escape_csharp_keyword(const String &p_name) {
+
+ return is_csharp_keyword(p_name) ? "@" + p_name : p_name;
+}
+
+static String snake_to_pascal_case(const String &p_identifier) {
+
+ String ret;
+ Vector<String> parts = p_identifier.split("_", true);
+
+ for (int i = 0; i < parts.size(); i++) {
+ String part = parts[i];
+
+ if (part.length()) {
+ part[0] = _find_upper(part[0]);
+ ret += part;
+ } else {
+ if (i == 0 || i == (parts.size() - 1)) {
+ // Preserve underscores at the beginning and end
+ ret += "_";
+ } else {
+ // Preserve contiguous underscores
+ if (parts[i - 1].length()) {
+ ret += "__";
+ } else {
+ ret += "_";
+ }
+ }
+ }
+ }
+
+ return ret;
+}
+
+static String snake_to_camel_case(const String &p_identifier) {
+
+ String ret;
+ Vector<String> parts = p_identifier.split("_", true);
+
+ for (int i = 0; i < parts.size(); i++) {
+ String part = parts[i];
+
+ if (part.length()) {
+ if (i != 0)
+ part[0] = _find_upper(part[0]);
+ ret += part;
+ } else {
+ if (i == 0 || i == (parts.size() - 1)) {
+ // Preserve underscores at the beginning and end
+ ret += "_";
+ } else {
+ // Preserve contiguous underscores
+ if (parts[i - 1].length()) {
+ ret += "__";
+ } else {
+ ret += "_";
+ }
+ }
+ }
+ }
+
+ return ret;
+}
+
+void BindingsGenerator::_generate_header_icalls() {
+
+ core_custom_icalls.clear();
+
+ core_custom_icalls.push_back(InternalCall(ICALL_GET_METHODBIND, "IntPtr", "string type, string method"));
+ core_custom_icalls.push_back(InternalCall(ICALL_OBJECT_DTOR, "void", "IntPtr ptr"));
+
+ core_custom_icalls.push_back(InternalCall(ICALL_CONNECT_SIGNAL_AWAITER, "Error",
+ "IntPtr source, string signal, IntPtr target, " CS_CLASS_SIGNALAWAITER " awaiter"));
+
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "NodePath_Ctor", "IntPtr", "string path"));
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "NodePath_Dtor", "void", "IntPtr ptr"));
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "NodePath_operator_String", "string", "IntPtr ptr"));
+
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "RID_Ctor", "IntPtr", "IntPtr from"));
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "RID_Dtor", "void", "IntPtr ptr"));
+
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "String_md5_buffer", "byte[]", "string str"));
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "String_md5_text", "string", "string str"));
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "String_rfind", "int", "string str, string what, int from"));
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "String_rfindn", "int", "string str, string what, int from"));
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "String_sha256_buffer", "byte[]", "string str"));
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "String_sha256_text", "string", "string str"));
+
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_bytes2var", "object", "byte[] bytes"));
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_convert", "object", "object what, int type"));
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_hash", "int", "object var"));
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_instance_from_id", "Object", "int instance_id"));
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_print", "void", "object[] what"));
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_printerr", "void", "object[] what"));
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_printraw", "void", "object[] what"));
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_prints", "void", "object[] what"));
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_printt", "void", "object[] what"));
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_seed", "void", "int seed"));
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_str", "string", "object[] what"));
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_str2var", "object", "string str"));
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_type_exists", "bool", "string type"));
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_var2bytes", "byte[]", "object what"));
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_var2str", "string", "object var"));
+ core_custom_icalls.push_back(InternalCall(ICALL_PREFIX "Godot_weakref", "WeakRef", "IntPtr obj"));
+}
+
+void BindingsGenerator::_generate_method_icalls(const TypeInterface &p_itype) {
+
+ for (const List<MethodInterface>::Element *E = p_itype.methods.front(); E; E = E->next()) {
+ const MethodInterface &imethod = E->get();
+
+ if (imethod.is_virtual)
+ continue;
+
+ const TypeInterface *return_type = _get_type_by_name_or_placeholder(imethod.return_type);
+
+ String im_sig = "IntPtr " CS_PARAM_METHODBIND ", IntPtr " CS_PARAM_INSTANCE;
+ String im_unique_sig = imethod.return_type + ",IntPtr,IntPtr";
+
+ // Get arguments information
+ int i = 0;
+ for (const List<ArgumentInterface>::Element *F = imethod.arguments.front(); F; F = F->next()) {
+ const TypeInterface *arg_type = _get_type_by_name_or_placeholder(F->get().type);
+
+ im_sig += ", ";
+ im_sig += arg_type->im_type_in;
+ im_sig += " arg";
+ im_sig += itos(i + 1);
+
+ im_unique_sig += ",";
+ im_unique_sig += get_unique_sig(*arg_type);
+
+ i++;
+ }
+
+ // godot_icall_{argc}_{icallcount}
+ String icall_method = ICALL_PREFIX + itos(imethod.arguments.size()) + "_" + itos(method_icalls.size());
+
+ InternalCall im_icall = InternalCall(p_itype.api_type, icall_method, return_type->im_type_out, im_sig, im_unique_sig);
+
+ List<InternalCall>::Element *match = method_icalls.find(im_icall);
+
+ if (match) {
+ if (p_itype.api_type != ClassDB::API_EDITOR)
+ match->get().editor_only = false;
+ method_icalls_map.insert(&E->get(), &match->get());
+ } else {
+ List<InternalCall>::Element *added = method_icalls.push_back(im_icall);
+ method_icalls_map.insert(&E->get(), &added->get());
+ }
+ }
+}
+
+Error BindingsGenerator::generate_cs_core_project(const String &p_output_dir, bool p_verbose_output) {
+
+ verbose_output = p_verbose_output;
+
+ DirAccessRef da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+ ERR_FAIL_COND_V(!da, ERR_CANT_CREATE);
+
+ if (!DirAccess::exists(p_output_dir)) {
+ Error err = da->make_dir_recursive(p_output_dir);
+ ERR_FAIL_COND_V(err != OK, ERR_CANT_CREATE);
+ }
+
+ da->change_dir(p_output_dir);
+ da->make_dir("Core");
+ da->make_dir("ObjectType");
+
+ String core_dir = path_join(p_output_dir, "Core");
+ String obj_type_dir = path_join(p_output_dir, "ObjectType");
+
+ Vector<String> compile_items;
+
+ NETSolution solution(API_ASSEMBLY_NAME);
+
+ if (!solution.set_path(p_output_dir))
+ return ERR_FILE_NOT_FOUND;
+
+ for (Map<String, TypeInterface>::Element *E = obj_types.front(); E; E = E->next()) {
+ const TypeInterface &itype = E->get();
+
+ if (itype.api_type == ClassDB::API_EDITOR)
+ continue;
+
+ String output_file = path_join(obj_type_dir, E->get().proxy_name + ".cs");
+ Error err = _generate_cs_type(E->get(), output_file);
+
+ if (err == ERR_SKIP)
+ continue;
+
+ if (err != OK)
+ return err;
+
+ compile_items.push_back(output_file);
+ }
+
+#define GENERATE_BUILTIN_TYPE(m_name) \
+ { \
+ String output_file = path_join(core_dir, #m_name ".cs"); \
+ Error err = _generate_cs_type(builtin_types[#m_name], output_file); \
+ if (err != OK) \
+ return err; \
+ compile_items.push_back(output_file); \
+ }
+
+ GENERATE_BUILTIN_TYPE(NodePath);
+ GENERATE_BUILTIN_TYPE(RID);
+
+#undef GENERATE_BUILTIN_TYPE
+
+ // Generate source for GlobalConstants
+
+ String constants_source;
+ int global_constants_count = GlobalConstants::get_global_constant_count();
+
+ if (global_constants_count > 0) {
+ Map<String, DocData::ClassDoc>::Element *match = EditorHelp::get_doc_data()->class_list.find("@Global Scope");
+
+ ERR_EXPLAIN("Could not find `@Global Scope` in DocData");
+ ERR_FAIL_COND_V(!match, ERR_BUG);
+
+ const DocData::ClassDoc &global_scope_doc = match->value();
+
+ for (int i = 0; i < global_constants_count; i++) {
+ const DocData::ConstantDoc &const_doc = global_scope_doc.constants[i];
+
+ if (i > 0)
+ constants_source += MEMBER_BEGIN;
+
+ if (const_doc.description.size()) {
+ constants_source += "/// <summary>\n";
+
+ Vector<String> description_lines = const_doc.description.split("\n");
+
+ for (int i = 0; i < description_lines.size(); i++) {
+ if (description_lines[i].size()) {
+ constants_source += INDENT2 "/// ";
+ constants_source += description_lines[i].strip_edges().xml_escape();
+ constants_source += "\n";
+ }
+ }
+
+ constants_source += INDENT2 "/// </summary>" MEMBER_BEGIN;
+ }
+
+ constants_source += "public const int ";
+ constants_source += GlobalConstants::get_global_constant_name(i);
+ constants_source += " = ";
+ constants_source += itos(GlobalConstants::get_global_constant_value(i));
+ constants_source += ";";
+ }
+ }
+
+ // Generate sources from compressed files
+
+ Map<String, CompressedFile> compressed_files;
+ get_compressed_files(compressed_files);
+
+ for (Map<String, CompressedFile>::Element *E = compressed_files.front(); E; E = E->next()) {
+ const String &file_name = E->key();
+ const CompressedFile &file_data = E->value();
+
+ String output_file = path_join(core_dir, file_name);
+
+ Vector<uint8_t> data;
+ data.resize(file_data.uncompressed_size);
+ Compression::decompress(data.ptr(), file_data.uncompressed_size, file_data.data, file_data.compressed_size, Compression::MODE_DEFLATE);
+
+ if (file_name.get_basename() == BINDINGS_GLOBAL_SCOPE_CLASS) {
+ // GD.cs must be formatted to include the generated global constants
+ String data_str = String::utf8(reinterpret_cast<const char *>(data.ptr()), data.size());
+
+ Dictionary format_keys;
+ format_keys["GodotGlobalConstants"] = constants_source;
+ data_str = data_str.format(format_keys, "/*{_}*/");
+
+ CharString data_utf8 = data_str.utf8();
+ data.resize(data_utf8.length());
+ copymem(data.ptr(), reinterpret_cast<const uint8_t *>(data_utf8.get_data()), data_utf8.length());
+ }
+
+ FileAccessRef file = FileAccess::open(output_file, FileAccess::WRITE);
+ ERR_FAIL_COND_V(!file, ERR_FILE_CANT_WRITE);
+ file->store_buffer(data.ptr(), data.size());
+ file->close();
+
+ compile_items.push_back(output_file);
+ }
+
+ List<String> cs_icalls_content;
+
+ cs_icalls_content.push_back("using System;\n"
+ "using System.Runtime.CompilerServices;\n"
+ "using System.Collections.Generic;\n"
+ "\n");
+ cs_icalls_content.push_back("namespace " BINDINGS_NAMESPACE "\n" OPEN_BLOCK);
+ cs_icalls_content.push_back(INDENT1 "internal static class " CS_CLASS_NATIVECALLS "\n" INDENT1 OPEN_BLOCK);
+
+#define ADD_INTERNAL_CALL(m_icall) \
+ if (!m_icall.editor_only) { \
+ cs_icalls_content.push_back(INDENT2 "[MethodImpl(MethodImplOptions.InternalCall)]\n"); \
+ cs_icalls_content.push_back(INDENT2 "internal extern static "); \
+ cs_icalls_content.push_back(m_icall.im_type_out + " "); \
+ cs_icalls_content.push_back(m_icall.name + "("); \
+ cs_icalls_content.push_back(m_icall.im_sig + ");\n"); \
+ }
+
+ for (const List<InternalCall>::Element *E = core_custom_icalls.front(); E; E = E->next())
+ ADD_INTERNAL_CALL(E->get());
+ for (const List<InternalCall>::Element *E = method_icalls.front(); E; E = E->next())
+ ADD_INTERNAL_CALL(E->get());
+
+#undef ADD_INTERNAL_CALL
+
+ cs_icalls_content.push_back(INDENT1 CLOSE_BLOCK CLOSE_BLOCK);
+
+ String internal_methods_file = path_join(core_dir, CS_CLASS_NATIVECALLS ".cs");
+
+ Error err = _save_file(internal_methods_file, cs_icalls_content);
+ if (err != OK)
+ return err;
+
+ compile_items.push_back(internal_methods_file);
+
+ String guid = CSharpProject::generate_core_api_project(p_output_dir, compile_items);
+
+ solution.add_new_project(API_ASSEMBLY_NAME, guid);
+
+ Error sln_error = solution.save();
+ if (sln_error != OK) {
+ ERR_PRINT("Could not to save .NET solution.");
+ return sln_error;
+ }
+
+ return OK;
+}
+
+Error BindingsGenerator::generate_cs_editor_project(const String &p_output_dir, const String &p_core_dll_path, bool p_verbose_output) {
+
+ verbose_output = p_verbose_output;
+
+ DirAccessRef da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+ ERR_FAIL_COND_V(!da, ERR_CANT_CREATE);
+
+ if (!DirAccess::exists(p_output_dir)) {
+ Error err = da->make_dir_recursive(p_output_dir);
+ ERR_FAIL_COND_V(err != OK, ERR_CANT_CREATE);
+ }
+
+ da->change_dir(p_output_dir);
+ da->make_dir("Core");
+ da->make_dir("ObjectType");
+
+ String core_dir = path_join(p_output_dir, "Core");
+ String obj_type_dir = path_join(p_output_dir, "ObjectType");
+
+ Vector<String> compile_items;
+
+ NETSolution solution(EDITOR_API_ASSEMBLY_NAME);
+
+ if (!solution.set_path(p_output_dir))
+ return ERR_FILE_NOT_FOUND;
+
+ for (Map<String, TypeInterface>::Element *E = obj_types.front(); E; E = E->next()) {
+ const TypeInterface &itype = E->get();
+
+ if (itype.api_type != ClassDB::API_EDITOR)
+ continue;
+
+ String output_file = path_join(obj_type_dir, E->get().proxy_name + ".cs");
+ Error err = _generate_cs_type(E->get(), output_file);
+
+ if (err == ERR_SKIP)
+ continue;
+
+ if (err != OK)
+ return err;
+
+ compile_items.push_back(output_file);
+ }
+
+ List<String> cs_icalls_content;
+
+ cs_icalls_content.push_back("using System;\n"
+ "using System.Runtime.CompilerServices;\n"
+ "using System.Collections.Generic;\n"
+ "\n");
+ cs_icalls_content.push_back("namespace " BINDINGS_NAMESPACE "\n" OPEN_BLOCK);
+ cs_icalls_content.push_back(INDENT1 "internal static class " CS_CLASS_NATIVECALLS_EDITOR "\n" INDENT1 OPEN_BLOCK);
+
+#define ADD_INTERNAL_CALL(m_icall) \
+ if (m_icall.editor_only) { \
+ cs_icalls_content.push_back(INDENT2 "[MethodImpl(MethodImplOptions.InternalCall)]\n"); \
+ cs_icalls_content.push_back(INDENT2 "internal extern static "); \
+ cs_icalls_content.push_back(m_icall.im_type_out + " "); \
+ cs_icalls_content.push_back(m_icall.name + "("); \
+ cs_icalls_content.push_back(m_icall.im_sig + ");\n"); \
+ }
+
+ for (const List<InternalCall>::Element *E = editor_custom_icalls.front(); E; E = E->next())
+ ADD_INTERNAL_CALL(E->get());
+ for (const List<InternalCall>::Element *E = method_icalls.front(); E; E = E->next())
+ ADD_INTERNAL_CALL(E->get());
+
+#undef ADD_INTERNAL_CALL
+
+ cs_icalls_content.push_back(INDENT1 CLOSE_BLOCK CLOSE_BLOCK);
+
+ String internal_methods_file = path_join(core_dir, CS_CLASS_NATIVECALLS_EDITOR ".cs");
+
+ Error err = _save_file(internal_methods_file, cs_icalls_content);
+ if (err != OK)
+ return err;
+
+ compile_items.push_back(internal_methods_file);
+
+ String guid = CSharpProject::generate_editor_api_project(p_output_dir, p_core_dll_path, compile_items);
+
+ solution.add_new_project(EDITOR_API_ASSEMBLY_NAME, guid);
+
+ Error sln_error = solution.save();
+ if (sln_error != OK) {
+ ERR_PRINT("Could not to save .NET solution.");
+ return sln_error;
+ }
+
+ return OK;
+}
+
+// TODO: there are constants that hide inherited members. must explicitly use `new` to avoid warnings
+// e.g.: warning CS0108: 'SpriteBase3D.FLAG_MAX' hides inherited member 'GeometryInstance.FLAG_MAX'. Use the new keyword if hiding was intended.
+Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const String &p_output_file) {
+
+ int method_bind_count = 0;
+
+ bool is_derived_type = itype.base_name.length();
+
+ List<InternalCall> &custom_icalls = itype.api_type == ClassDB::API_EDITOR ? editor_custom_icalls : core_custom_icalls;
+
+ if (verbose_output)
+ OS::get_singleton()->print(String("Generating " + itype.proxy_name + ".cs...\n").utf8());
+
+ String ctor_method(ICALL_PREFIX + itype.proxy_name + "_Ctor");
+
+ List<String> cs_file;
+
+ cs_file.push_back("using System;\n"); // IntPtr
+
+ if (itype.requires_collections)
+ cs_file.push_back("using System.Collections.Generic;\n"); // Dictionary
+
+ cs_file.push_back("\nnamespace " BINDINGS_NAMESPACE "\n" OPEN_BLOCK);
+
+ const DocData::ClassDoc *class_doc = itype.class_doc;
+
+ if (class_doc && class_doc->description.size()) {
+ cs_file.push_back(INDENT1 "/// <summary>\n");
+
+ Vector<String> description_lines = class_doc->description.split("\n");
+
+ for (int i = 0; i < description_lines.size(); i++) {
+ if (description_lines[i].size()) {
+ cs_file.push_back(INDENT1 "/// ");
+ cs_file.push_back(description_lines[i].strip_edges().xml_escape());
+ cs_file.push_back("\n");
+ }
+ }
+
+ cs_file.push_back(INDENT1 "/// </summary>\n");
+ }
+
+ cs_file.push_back(INDENT1 "public ");
+ cs_file.push_back(itype.is_singleton ? "static class " : "class ");
+ cs_file.push_back(itype.proxy_name);
+
+ if (itype.is_singleton || !itype.is_object_type) {
+ cs_file.push_back("\n");
+ } else if (!is_derived_type) {
+ cs_file.push_back(" : IDisposable\n");
+ } else if (obj_types.has(itype.base_name)) {
+ cs_file.push_back(" : ");
+ cs_file.push_back(obj_types[itype.base_name].proxy_name);
+ cs_file.push_back("\n");
+ } else {
+ ERR_PRINTS("Base type ' " + itype.base_name + "' does not exist");
+ return ERR_INVALID_DATA;
+ }
+
+ cs_file.push_back(INDENT1 "{");
+
+ if (class_doc) {
+
+ // Add constants
+
+ for (int i = 0; i < class_doc->constants.size(); i++) {
+ const DocData::ConstantDoc &const_doc = class_doc->constants[i];
+
+ if (const_doc.description.size()) {
+ cs_file.push_back(MEMBER_BEGIN "/// <summary>\n");
+
+ Vector<String> description_lines = const_doc.description.split("\n");
+
+ for (int i = 0; i < description_lines.size(); i++) {
+ if (description_lines[i].size()) {
+ cs_file.push_back(INDENT2 "/// ");
+ cs_file.push_back(description_lines[i].strip_edges().xml_escape());
+ cs_file.push_back("\n");
+ }
+ }
+
+ cs_file.push_back(INDENT2 "/// </summary>");
+ }
+
+ cs_file.push_back(MEMBER_BEGIN "public const int ");
+ cs_file.push_back(const_doc.name);
+ cs_file.push_back(" = ");
+ cs_file.push_back(const_doc.value);
+ cs_file.push_back(";");
+ }
+
+ if (class_doc->constants.size())
+ cs_file.push_back("\n");
+
+ // Add properties
+
+ const Vector<DocData::PropertyDoc> &properties = itype.class_doc->properties;
+
+ for (int i = 0; i < properties.size(); i++) {
+ const DocData::PropertyDoc &prop_doc = properties[i];
+
+ const MethodInterface *setter = itype.find_method_by_name(prop_doc.setter);
+
+ // Search it in base types too
+ const TypeInterface *current_type = &itype;
+ while (!setter && current_type->base_name.length()) {
+ Map<String, TypeInterface>::Element *base_match = obj_types.find(current_type->base_name);
+ ERR_FAIL_NULL_V(base_match, ERR_BUG);
+ current_type = &base_match->get();
+ setter = current_type->find_method_by_name(prop_doc.setter);
+ }
+
+ const MethodInterface *getter = itype.find_method_by_name(prop_doc.getter);
+
+ // Search it in base types too
+ current_type = &itype;
+ while (!getter && current_type->base_name.length()) {
+ Map<String, TypeInterface>::Element *base_match = obj_types.find(current_type->base_name);
+ ERR_FAIL_NULL_V(base_match, ERR_BUG);
+ current_type = &base_match->get();
+ getter = current_type->find_method_by_name(prop_doc.getter);
+ }
+
+ ERR_FAIL_COND_V(!setter && !getter, ERR_BUG);
+
+ bool is_valid = false;
+ int prop_index = ClassDB::get_property_index(itype.name, prop_doc.name, &is_valid);
+ ERR_FAIL_COND_V(!is_valid, ERR_BUG);
+
+ if (setter) {
+ int setter_argc = prop_index != -1 ? 2 : 1;
+ ERR_FAIL_COND_V(setter->arguments.size() != setter_argc, ERR_BUG);
+ }
+
+ if (getter) {
+ int getter_argc = prop_index != -1 ? 1 : 0;
+ ERR_FAIL_COND_V(getter->arguments.size() != getter_argc, ERR_BUG);
+ }
+
+ if (getter && setter) {
+ ERR_FAIL_COND_V(getter->return_type != setter->arguments.back()->get().type, ERR_BUG);
+ }
+
+ // Let's not trust PropertyDoc::type
+ String proptype_name = getter ? getter->return_type : setter->arguments.back()->get().type;
+
+ const TypeInterface *prop_itype = _get_type_by_name_or_null(proptype_name);
+ if (!prop_itype) {
+ // Try with underscore prefix
+ prop_itype = _get_type_by_name_or_null("_" + proptype_name);
+ }
+
+ ERR_FAIL_NULL_V(prop_itype, ERR_BUG);
+
+ String prop_proxy_name = escape_csharp_keyword(snake_to_pascal_case(prop_doc.name));
+
+ // Prevent property and enclosing type from sharing the same name
+ if (prop_proxy_name == itype.proxy_name) {
+ if (verbose_output) {
+ WARN_PRINTS("Name of property `" + prop_proxy_name + "` is ambiguous with the name of its class `" +
+ itype.proxy_name + "`. Renaming property to `" + prop_proxy_name + "_`");
+ }
+
+ prop_proxy_name += "_";
+ }
+
+ if (prop_doc.description.size()) {
+ cs_file.push_back(MEMBER_BEGIN "/// <summary>\n");
+
+ Vector<String> description_lines = prop_doc.description.split("\n");
+
+ for (int i = 0; i < description_lines.size(); i++) {
+ if (description_lines[i].size()) {
+ cs_file.push_back(INDENT2 "/// ");
+ cs_file.push_back(description_lines[i].strip_edges().xml_escape());
+ cs_file.push_back("\n");
+ }
+ }
+
+ cs_file.push_back(INDENT2 "/// </summary>");
+ }
+
+ cs_file.push_back(MEMBER_BEGIN "public ");
+
+ if (itype.is_singleton)
+ cs_file.push_back("static ");
+
+ cs_file.push_back(prop_itype->cs_type);
+ cs_file.push_back(" ");
+ cs_file.push_back(prop_proxy_name.replace("/", "__"));
+ cs_file.push_back("\n" INDENT2 OPEN_BLOCK);
+
+ if (getter) {
+ cs_file.push_back(INDENT3 "get\n" OPEN_BLOCK_L3);
+ cs_file.push_back("return ");
+ cs_file.push_back(getter->proxy_name + "(");
+ if (prop_index != -1)
+ cs_file.push_back(itos(prop_index));
+ cs_file.push_back(");\n" CLOSE_BLOCK_L3);
+ }
+
+ if (setter) {
+ cs_file.push_back(INDENT3 "set\n" OPEN_BLOCK_L3);
+ cs_file.push_back(setter->proxy_name + "(");
+ if (prop_index != -1)
+ cs_file.push_back(itos(prop_index) + ", ");
+ cs_file.push_back("value);\n" CLOSE_BLOCK_L3);
+ }
+
+ cs_file.push_back(CLOSE_BLOCK_L2);
+ }
+
+ if (class_doc->properties.size())
+ cs_file.push_back("\n");
+ }
+
+ if (!itype.is_object_type) {
+ cs_file.push_back(MEMBER_BEGIN "private const string " BINDINGS_NATIVE_NAME_FIELD " = \"" + itype.name + "\";\n");
+ cs_file.push_back(MEMBER_BEGIN "private bool disposed = false;\n");
+ cs_file.push_back(MEMBER_BEGIN "internal IntPtr " BINDINGS_PTR_FIELD ";\n");
+
+ cs_file.push_back(MEMBER_BEGIN "internal static IntPtr " CS_SMETHOD_GETINSTANCE "(");
+ cs_file.push_back(itype.proxy_name);
+ cs_file.push_back(" instance)\n" OPEN_BLOCK_L2 "return instance == null ? IntPtr.Zero : instance." BINDINGS_PTR_FIELD ";\n" CLOSE_BLOCK_L2);
+
+ // Add Destructor
+ cs_file.push_back(MEMBER_BEGIN "~");
+ cs_file.push_back(itype.proxy_name);
+ cs_file.push_back("()\n" OPEN_BLOCK_L2 "Dispose(false);\n" CLOSE_BLOCK_L2);
+
+ // Add the Dispose from IDisposable
+ cs_file.push_back(MEMBER_BEGIN "public void Dispose()\n" OPEN_BLOCK_L2 "Dispose(true);\n" INDENT3 "GC.SuppressFinalize(this);\n" CLOSE_BLOCK_L2);
+
+ // Add the virtual Dispose
+ cs_file.push_back(MEMBER_BEGIN "public virtual void Dispose(bool disposing)\n" OPEN_BLOCK_L2
+ "if (disposed) return;\n" INDENT3
+ "if (" BINDINGS_PTR_FIELD " != IntPtr.Zero)\n" OPEN_BLOCK_L3 "NativeCalls.godot_icall_");
+ cs_file.push_back(itype.proxy_name);
+ cs_file.push_back("_Dtor(" BINDINGS_PTR_FIELD ");\n" INDENT5 BINDINGS_PTR_FIELD " = IntPtr.Zero;\n" CLOSE_BLOCK_L3 INDENT3
+ "GC.SuppressFinalize(this);\n" INDENT3 "disposed = true;\n" CLOSE_BLOCK_L2);
+
+ cs_file.push_back(MEMBER_BEGIN "internal ");
+ cs_file.push_back(itype.proxy_name);
+ cs_file.push_back("(IntPtr " BINDINGS_PTR_FIELD ")\n" OPEN_BLOCK_L2 "this." BINDINGS_PTR_FIELD " = " BINDINGS_PTR_FIELD ";\n" CLOSE_BLOCK_L2);
+
+ cs_file.push_back(MEMBER_BEGIN "public bool HasValidHandle()\n" OPEN_BLOCK_L2
+ "return " BINDINGS_PTR_FIELD " == IntPtr.Zero;\n" CLOSE_BLOCK_L2);
+ } else if (itype.is_singleton) {
+ // Add the type name and the singleton pointer as static fields
+
+ cs_file.push_back(MEMBER_BEGIN "private const string " BINDINGS_NATIVE_NAME_FIELD " = \"");
+ cs_file.push_back(itype.name);
+ cs_file.push_back("\";\n");
+
+ cs_file.push_back(INDENT2 "internal static IntPtr " BINDINGS_PTR_FIELD " = ");
+ cs_file.push_back(itype.api_type == ClassDB::API_EDITOR ? CS_CLASS_NATIVECALLS_EDITOR : CS_CLASS_NATIVECALLS);
+ cs_file.push_back("." ICALL_PREFIX);
+ cs_file.push_back(itype.name);
+ cs_file.push_back(SINGLETON_ICALL_SUFFIX "();\n");
+ } else {
+ // Add member fields
+
+ cs_file.push_back(MEMBER_BEGIN "private const string " BINDINGS_NATIVE_NAME_FIELD " = \"");
+ cs_file.push_back(itype.name);
+ cs_file.push_back("\";\n");
+
+ // Only the base class stores the pointer to the native object
+ // This pointer is expected to be and must be of type Object*
+ if (!is_derived_type) {
+ cs_file.push_back(MEMBER_BEGIN "private bool disposed = false;\n");
+ cs_file.push_back(INDENT2 "internal IntPtr " BINDINGS_PTR_FIELD ";\n");
+ cs_file.push_back(INDENT2 "internal bool " CS_FIELD_MEMORYOWN ";\n");
+ }
+
+ // Add default constructor
+ if (itype.is_instantiable) {
+ cs_file.push_back(MEMBER_BEGIN "public ");
+ cs_file.push_back(itype.proxy_name);
+ cs_file.push_back("() : this(");
+ cs_file.push_back(itype.memory_own ? "true" : "false");
+
+ // The default constructor may also be called by the engine when instancing existing native objects
+ // The engine will initialize the pointer field of the managed side before calling the constructor
+ // This is why we only allocate a new native object from the constructor if the pointer field is not set
+ cs_file.push_back(")\n" OPEN_BLOCK_L2 "if (" BINDINGS_PTR_FIELD " == IntPtr.Zero)\n" INDENT4 BINDINGS_PTR_FIELD " = ");
+ cs_file.push_back(itype.api_type == ClassDB::API_EDITOR ? CS_CLASS_NATIVECALLS_EDITOR : CS_CLASS_NATIVECALLS);
+ cs_file.push_back("." + ctor_method);
+ cs_file.push_back("(this);\n" CLOSE_BLOCK_L2);
+ } else {
+ // Hide the constructor
+ cs_file.push_back(MEMBER_BEGIN "internal ");
+ cs_file.push_back(itype.proxy_name);
+ cs_file.push_back("() {}\n");
+ }
+
+ // Add.. em.. trick constructor. Sort of.
+ cs_file.push_back(MEMBER_BEGIN "internal ");
+ cs_file.push_back(itype.proxy_name);
+ if (is_derived_type) {
+ cs_file.push_back("(bool " CS_FIELD_MEMORYOWN ") : base(" CS_FIELD_MEMORYOWN ") {}\n");
+ } else {
+ cs_file.push_back("(bool " CS_FIELD_MEMORYOWN ")\n" OPEN_BLOCK_L2
+ "this." CS_FIELD_MEMORYOWN " = " CS_FIELD_MEMORYOWN ";\n" CLOSE_BLOCK_L2);
+ }
+
+ // Add methods
+
+ if (!is_derived_type) {
+ cs_file.push_back(MEMBER_BEGIN "public bool HasValidHandle()\n" OPEN_BLOCK_L2
+ "return " BINDINGS_PTR_FIELD " == IntPtr.Zero;\n" CLOSE_BLOCK_L2);
+
+ cs_file.push_back(MEMBER_BEGIN "internal static IntPtr " CS_SMETHOD_GETINSTANCE "(Object instance)\n" OPEN_BLOCK_L2
+ "return instance == null ? IntPtr.Zero : instance." BINDINGS_PTR_FIELD ";\n" CLOSE_BLOCK_L2);
+ }
+
+ if (!is_derived_type) {
+ // Add destructor
+ cs_file.push_back(MEMBER_BEGIN "~");
+ cs_file.push_back(itype.proxy_name);
+ cs_file.push_back("()\n" OPEN_BLOCK_L2 "Dispose(false);\n" CLOSE_BLOCK_L2);
+
+ // Add the Dispose from IDisposable
+ cs_file.push_back(MEMBER_BEGIN "public void Dispose()\n" OPEN_BLOCK_L2 "Dispose(true);\n" INDENT3 "GC.SuppressFinalize(this);\n" CLOSE_BLOCK_L2);
+
+ // Add the virtual Dispose
+ cs_file.push_back(MEMBER_BEGIN "public virtual void Dispose(bool disposing)\n" OPEN_BLOCK_L2
+ "if (disposed) return;\n" INDENT3
+ "if (" BINDINGS_PTR_FIELD " != IntPtr.Zero)\n" OPEN_BLOCK_L3
+ "if (" CS_FIELD_MEMORYOWN ")\n" OPEN_BLOCK_L4 CS_FIELD_MEMORYOWN
+ " = false;\n" INDENT5 CS_CLASS_NATIVECALLS "." ICALL_OBJECT_DTOR
+ "(" BINDINGS_PTR_FIELD ");\n" INDENT5 BINDINGS_PTR_FIELD
+ " = IntPtr.Zero;\n" CLOSE_BLOCK_L4 CLOSE_BLOCK_L3 INDENT3
+ "GC.SuppressFinalize(this);\n" INDENT3 "disposed = true;\n" CLOSE_BLOCK_L2);
+
+ Map<String, TypeInterface>::Element *array_itype = builtin_types.find("Array");
+
+ if (!array_itype) {
+ ERR_PRINT("BUG: Array type interface not found!");
+ return ERR_BUG;
+ }
+
+ cs_file.push_back(MEMBER_BEGIN "private void _AwaitedSignalCallback(");
+ cs_file.push_back(array_itype->get().cs_type);
+ cs_file.push_back(" args, SignalAwaiter awaiter)\n" OPEN_BLOCK_L2 "awaiter.SignalCallback(args);\n" CLOSE_BLOCK_L2);
+
+ Map<String, TypeInterface>::Element *object_itype = obj_types.find("Object");
+
+ if (!object_itype) {
+ ERR_PRINT("BUG: Array type interface not found!");
+ return ERR_BUG;
+ }
+
+ cs_file.push_back(MEMBER_BEGIN "public " CS_CLASS_SIGNALAWAITER " ToSignal(");
+ cs_file.push_back(object_itype->get().cs_type);
+ cs_file.push_back(" source, string signal)\n" OPEN_BLOCK_L2
+ "return new " CS_CLASS_SIGNALAWAITER "(source, signal, this);\n" CLOSE_BLOCK_L2);
+ }
+ }
+
+ Map<String, String>::Element *extra_member = extra_members.find(itype.name);
+ if (extra_member)
+ cs_file.push_back(extra_member->get());
+
+ for (const List<MethodInterface>::Element *E = itype.methods.front(); E; E = E->next()) {
+ const MethodInterface &imethod = E->get();
+
+ const TypeInterface *return_type = _get_type_by_name_or_placeholder(imethod.return_type);
+
+ String method_bind_field = "method_bind_" + itos(method_bind_count);
+
+ String icall_params = method_bind_field + ", " + sformat(itype.cs_in, "this");
+ String arguments_sig;
+ String cs_in_statements;
+
+ List<String> default_args_doc;
+
+ // Retrieve information from the arguments
+ for (const List<ArgumentInterface>::Element *F = imethod.arguments.front(); F; F = F->next()) {
+ const ArgumentInterface &iarg = F->get();
+ const TypeInterface *arg_type = _get_type_by_name_or_placeholder(iarg.type);
+
+ // Add the current arguments to the signature
+ // If the argument has a default value which is not a constant, we will make it Nullable
+ {
+ if (F != imethod.arguments.front())
+ arguments_sig += ", ";
+
+ if (iarg.def_param_mode == ArgumentInterface::NULLABLE_VAL)
+ arguments_sig += "Nullable<";
+
+ arguments_sig += arg_type->cs_type;
+
+ if (iarg.def_param_mode == ArgumentInterface::NULLABLE_VAL)
+ arguments_sig += "> ";
+ else
+ arguments_sig += " ";
+
+ arguments_sig += iarg.name;
+
+ if (iarg.default_argument.size()) {
+ if (iarg.def_param_mode != ArgumentInterface::CONSTANT)
+ arguments_sig += " = null";
+ else
+ arguments_sig += " = " + sformat(iarg.default_argument, arg_type->cs_type);
+ }
+ }
+
+ icall_params += ", ";
+
+ if (iarg.default_argument.size() && iarg.def_param_mode != ArgumentInterface::CONSTANT) {
+ // The default value of an argument must be constant. Otherwise we make it Nullable and do the following:
+ // Type arg_in = arg.HasValue ? arg.Value : <non-const default value>;
+ String arg_in = iarg.name;
+ arg_in += "_in";
+
+ cs_in_statements += arg_type->cs_type;
+ cs_in_statements += " ";
+ cs_in_statements += arg_in;
+ cs_in_statements += " = ";
+ cs_in_statements += iarg.name;
+
+ if (iarg.def_param_mode == ArgumentInterface::NULLABLE_VAL)
+ cs_in_statements += ".HasValue ? ";
+ else
+ cs_in_statements += " != null ? ";
+
+ cs_in_statements += iarg.name;
+
+ if (iarg.def_param_mode == ArgumentInterface::NULLABLE_VAL)
+ cs_in_statements += ".Value : ";
+ else
+ cs_in_statements += " : ";
+
+ String def_arg = sformat(iarg.default_argument, arg_type->cs_type);
+
+ cs_in_statements += def_arg;
+ cs_in_statements += ";\n" INDENT3;
+
+ icall_params += arg_type->cs_in.empty() ? arg_in : sformat(arg_type->cs_in, arg_in);
+
+ default_args_doc.push_back(INDENT2 "/// <param name=\"" + iarg.name + "\">If the param is null, then the default value is " + def_arg + "</param>\n");
+ } else {
+ icall_params += arg_type->cs_in.empty() ? iarg.name : sformat(arg_type->cs_in, iarg.name);
+ }
+ }
+
+ // Generate method
+ {
+ if (!imethod.is_virtual && !imethod.requires_object_call) {
+ cs_file.push_back(MEMBER_BEGIN "private ");
+ cs_file.push_back(itype.is_singleton ? "static IntPtr " : "IntPtr ");
+ cs_file.push_back(method_bind_field + " = " CS_CLASS_NATIVECALLS "." ICALL_GET_METHODBIND "(" BINDINGS_NATIVE_NAME_FIELD ", \"");
+ cs_file.push_back(imethod.name);
+ cs_file.push_back("\");\n");
+ }
+
+ if (imethod.method_doc && imethod.method_doc->description.size()) {
+ cs_file.push_back(MEMBER_BEGIN "/// <summary>\n");
+
+ Vector<String> description_lines = imethod.method_doc->description.split("\n");
+
+ for (int i = 0; i < description_lines.size(); i++) {
+ if (description_lines[i].size()) {
+ cs_file.push_back(INDENT2 "/// ");
+ cs_file.push_back(description_lines[i].strip_edges().xml_escape());
+ cs_file.push_back("\n");
+ }
+ }
+
+ for (List<String>::Element *E = default_args_doc.front(); E; E = E->next()) {
+ cs_file.push_back(E->get().xml_escape());
+ }
+
+ cs_file.push_back(INDENT2 "/// </summary>");
+ }
+
+ if (!imethod.is_internal) {
+ cs_file.push_back(MEMBER_BEGIN "[GodotMethod(\"");
+ cs_file.push_back(imethod.name);
+ cs_file.push_back("\")]");
+ }
+
+ cs_file.push_back(MEMBER_BEGIN);
+ cs_file.push_back(imethod.is_internal ? "internal " : "public ");
+
+ if (itype.is_singleton) {
+ cs_file.push_back("static ");
+ } else if (imethod.is_virtual) {
+ cs_file.push_back("virtual ");
+ }
+
+ cs_file.push_back(return_type->cs_type + " ");
+ cs_file.push_back(imethod.proxy_name + "(");
+ cs_file.push_back(arguments_sig + ")\n" OPEN_BLOCK_L2);
+
+ if (imethod.is_virtual) {
+ // Godot virtual method must be overridden, therefore we return a default value by default.
+
+ if (return_type->name == "void") {
+ cs_file.push_back("return;\n" CLOSE_BLOCK_L2);
+ } else {
+ cs_file.push_back("return default(");
+ cs_file.push_back(return_type->cs_type);
+ cs_file.push_back(");\n" CLOSE_BLOCK_L2);
+ }
+
+ continue;
+ }
+
+ if (imethod.requires_object_call) {
+ // Fallback to Godot's object.Call(string, params)
+
+ cs_file.push_back(CS_METHOD_CALL "(\"");
+ cs_file.push_back(imethod.name);
+ cs_file.push_back("\"");
+
+ for (const List<ArgumentInterface>::Element *F = imethod.arguments.front(); F; F = F->next()) {
+ cs_file.push_back(", ");
+ cs_file.push_back(F->get().name);
+ }
+
+ cs_file.push_back(");\n" CLOSE_BLOCK_L2);
+
+ continue;
+ }
+
+ const Map<const MethodInterface *, const InternalCall *>::Element *match = method_icalls_map.find(&E->get());
+ ERR_FAIL_NULL_V(match, ERR_BUG);
+
+ const InternalCall *im_icall = match->value();
+
+ String im_call = im_icall->editor_only ? CS_CLASS_NATIVECALLS_EDITOR : CS_CLASS_NATIVECALLS;
+ im_call += "." + im_icall->name + "(" + icall_params + ");\n";
+
+ if (imethod.arguments.size())
+ cs_file.push_back(cs_in_statements);
+
+ if (return_type->name == "void") {
+ cs_file.push_back(im_call);
+ } else if (return_type->cs_out.empty()) {
+ cs_file.push_back("return " + im_call);
+ } else {
+ cs_file.push_back(return_type->im_type_out);
+ cs_file.push_back(" " LOCAL_RET " = ");
+ cs_file.push_back(im_call);
+ cs_file.push_back(INDENT3);
+ cs_file.push_back(sformat(return_type->cs_out, LOCAL_RET) + "\n");
+ }
+
+ cs_file.push_back(CLOSE_BLOCK_L2);
+ }
+
+ method_bind_count++;
+ }
+
+ if (itype.is_singleton) {
+ InternalCall singleton_icall = InternalCall(itype.api_type, ICALL_PREFIX + itype.name + SINGLETON_ICALL_SUFFIX, "IntPtr");
+
+ if (!find_icall_by_name(singleton_icall.name, custom_icalls))
+ custom_icalls.push_back(singleton_icall);
+ }
+
+ if (itype.is_instantiable) {
+ InternalCall ctor_icall = InternalCall(itype.api_type, ctor_method, "IntPtr", itype.proxy_name + " obj");
+
+ if (!find_icall_by_name(ctor_icall.name, custom_icalls))
+ custom_icalls.push_back(ctor_icall);
+ }
+
+ cs_file.push_back(INDENT1 CLOSE_BLOCK CLOSE_BLOCK);
+
+ return _save_file(p_output_file, cs_file);
+}
+
+Error BindingsGenerator::generate_glue(const String &p_output_dir) {
+
+ verbose_output = true;
+
+ bool dir_exists = DirAccess::exists(p_output_dir);
+ ERR_EXPLAIN("The output directory does not exist.");
+ ERR_FAIL_COND_V(!dir_exists, ERR_FILE_BAD_PATH);
+
+ List<String> cpp_file;
+
+ cpp_file.push_back("#include \"" GLUE_HEADER_FILE "\"\n"
+ "\n");
+
+ List<const InternalCall *> generated_icall_funcs;
+
+ for (Map<String, TypeInterface>::Element *type_elem = obj_types.front(); type_elem; type_elem = type_elem->next()) {
+ const TypeInterface &itype = type_elem->get();
+
+ List<InternalCall> &custom_icalls = itype.api_type == ClassDB::API_EDITOR ? editor_custom_icalls : core_custom_icalls;
+
+ OS::get_singleton()->print(String("Generating " + itype.name + "...\n").utf8());
+
+ String ctor_method(ICALL_PREFIX + itype.proxy_name + "_Ctor");
+
+ for (const List<MethodInterface>::Element *E = itype.methods.front(); E; E = E->next()) {
+ const MethodInterface &imethod = E->get();
+
+ if (imethod.is_virtual)
+ continue;
+
+ bool ret_void = imethod.return_type == "void";
+
+ const TypeInterface *return_type = _get_type_by_name_or_placeholder(imethod.return_type);
+
+ String argc_str = itos(imethod.arguments.size());
+
+ String c_func_sig = "MethodBind* " CS_PARAM_METHODBIND ", " + itype.c_type_in + " " CS_PARAM_INSTANCE;
+ String c_in_statements;
+ String c_args_var_content;
+
+ // Get arguments information
+ int i = 0;
+ for (const List<ArgumentInterface>::Element *F = imethod.arguments.front(); F; F = F->next()) {
+ const ArgumentInterface &iarg = F->get();
+ const TypeInterface *arg_type = _get_type_by_name_or_placeholder(iarg.type);
+
+ String c_param_name = "arg" + itos(i + 1);
+
+ if (imethod.is_vararg) {
+ if (i < imethod.arguments.size() - 1) {
+ c_in_statements += sformat(arg_type->c_in.size() ? arg_type->c_in : TypeInterface::DEFAULT_VARARG_C_IN, "Variant", c_param_name);
+ c_in_statements += "\t" C_LOCAL_PTRCALL_ARGS ".set(0, ";
+ c_in_statements += sformat("&%s_in", c_param_name);
+ c_in_statements += ");\n";
+ }
+ } else {
+ if (i > 0)
+ c_args_var_content += ", ";
+ if (arg_type->c_in.size())
+ c_in_statements += sformat(arg_type->c_in, arg_type->c_type, c_param_name);
+ c_args_var_content += sformat(arg_type->c_arg_in, c_param_name);
+ }
+
+ c_func_sig += ", ";
+ c_func_sig += arg_type->c_type_in;
+ c_func_sig += " ";
+ c_func_sig += c_param_name;
+
+ i++;
+ }
+
+ const Map<const MethodInterface *, const InternalCall *>::Element *match = method_icalls_map.find(&E->get());
+ ERR_FAIL_NULL_V(match, ERR_BUG);
+
+ const InternalCall *im_icall = match->value();
+ String icall_method = im_icall->name;
+
+ if (!generated_icall_funcs.find(im_icall)) {
+ generated_icall_funcs.push_back(im_icall);
+
+ if (im_icall->editor_only)
+ cpp_file.push_back("#ifdef TOOLS_ENABLED\n");
+
+ // Generate icall function
+
+ cpp_file.push_back(ret_void ? "void " : return_type->c_type_out + " ");
+ cpp_file.push_back(icall_method);
+ cpp_file.push_back("(");
+ cpp_file.push_back(c_func_sig);
+ cpp_file.push_back(") " OPEN_BLOCK);
+
+ String fail_ret = ret_void ? "" : ", " + (return_type->c_type_out.ends_with("*") ? "NULL" : return_type->c_type_out + "()");
+
+ if (!ret_void) {
+ String ptrcall_return_type;
+ String initialization;
+
+ if (return_type->is_object_type) {
+ ptrcall_return_type = return_type->is_reference ? "Ref<Reference>" : return_type->c_type;
+ initialization = return_type->is_reference ? "" : " = NULL";
+ } else {
+ ptrcall_return_type = return_type->c_type;
+ }
+
+ cpp_file.push_back("\t" + ptrcall_return_type);
+ cpp_file.push_back(" " LOCAL_RET);
+ cpp_file.push_back(initialization + ";\n");
+ cpp_file.push_back("\tERR_FAIL_NULL_V(" CS_PARAM_INSTANCE);
+ cpp_file.push_back(fail_ret);
+ cpp_file.push_back(");\n");
+ } else {
+ cpp_file.push_back("\tERR_FAIL_NULL(" CS_PARAM_INSTANCE ");\n");
+ }
+
+ if (imethod.arguments.size()) {
+ if (imethod.is_vararg) {
+ String err_fail_macro = ret_void ? "ERR_FAIL_COND" : "ERR_FAIL_COND_V";
+ String vararg_arg = "arg" + argc_str;
+ String real_argc_str = itos(imethod.arguments.size() - 1); // Arguments count without vararg
+
+ cpp_file.push_back("\tVector<Variant> varargs;\n"
+ "\tint vararg_length = mono_array_length(");
+ cpp_file.push_back(vararg_arg);
+ cpp_file.push_back(");\n\tint total_length = ");
+ cpp_file.push_back(real_argc_str);
+ cpp_file.push_back(" + vararg_length;\n\t");
+ cpp_file.push_back(err_fail_macro);
+ cpp_file.push_back("(varargs.resize(vararg_length) != OK");
+ cpp_file.push_back(fail_ret);
+ cpp_file.push_back(");\n\tVector<Variant*> " C_LOCAL_PTRCALL_ARGS ";\n\t");
+ cpp_file.push_back(err_fail_macro);
+ cpp_file.push_back("(call_args.resize(total_length) != OK");
+ cpp_file.push_back(fail_ret);
+ cpp_file.push_back(");\n");
+ cpp_file.push_back(c_in_statements);
+ cpp_file.push_back("\tfor (int i = 0; i < vararg_length; i++) " OPEN_BLOCK
+ "\t\tMonoObject* elem = mono_array_get(");
+ cpp_file.push_back(vararg_arg);
+ cpp_file.push_back(", MonoObject*, i);\n"
+ "\t\tvarargs.set(i, GDMonoMarshal::mono_object_to_variant(elem));\n"
+ "\t\t" C_LOCAL_PTRCALL_ARGS ".set(");
+ cpp_file.push_back(real_argc_str);
+ cpp_file.push_back(" + i, &varargs[i]);\n\t" CLOSE_BLOCK);
+ } else {
+ cpp_file.push_back(c_in_statements);
+ cpp_file.push_back("\tconst void* " C_LOCAL_PTRCALL_ARGS "[");
+ cpp_file.push_back(argc_str + "] = { ");
+ cpp_file.push_back(c_args_var_content + " };\n");
+ }
+ }
+
+ if (imethod.is_vararg) {
+ cpp_file.push_back("\tVariant::CallError vcall_error;\n\t");
+
+ if (!ret_void)
+ cpp_file.push_back(LOCAL_RET " = ");
+
+ cpp_file.push_back(CS_PARAM_METHODBIND "->call(" CS_PARAM_INSTANCE ", ");
+ cpp_file.push_back(imethod.arguments.size() ? "(const Variant**)" C_LOCAL_PTRCALL_ARGS ".ptr()" : "NULL");
+ cpp_file.push_back(", total_length, vcall_error);\n");
+ } else {
+ cpp_file.push_back("\t" CS_PARAM_METHODBIND "->ptrcall(" CS_PARAM_INSTANCE ", ");
+ cpp_file.push_back(imethod.arguments.size() ? C_LOCAL_PTRCALL_ARGS ", " : "NULL, ");
+ cpp_file.push_back(!ret_void ? "&" LOCAL_RET ");\n" : "NULL);\n");
+ }
+
+ if (!ret_void) {
+ if (return_type->c_out.empty())
+ cpp_file.push_back("\treturn " LOCAL_RET ";\n");
+ else
+ cpp_file.push_back(sformat(return_type->c_out, return_type->c_type_out, LOCAL_RET, return_type->name));
+ }
+
+ cpp_file.push_back(CLOSE_BLOCK "\n");
+
+ if (im_icall->editor_only)
+ cpp_file.push_back("#endif // TOOLS_ENABLED\n");
+ }
+ }
+
+ if (itype.is_singleton) {
+ String singleton_icall_name = ICALL_PREFIX + itype.name + SINGLETON_ICALL_SUFFIX;
+ InternalCall singleton_icall = InternalCall(itype.api_type, singleton_icall_name, "IntPtr");
+
+ if (!find_icall_by_name(singleton_icall.name, custom_icalls))
+ custom_icalls.push_back(singleton_icall);
+
+ cpp_file.push_back("Object* ");
+ cpp_file.push_back(singleton_icall_name);
+ cpp_file.push_back("() " OPEN_BLOCK "\treturn ProjectSettings::get_singleton()->get_singleton_object(\"");
+ cpp_file.push_back(itype.proxy_name);
+ cpp_file.push_back("\");\n" CLOSE_BLOCK "\n");
+ }
+
+ if (itype.is_instantiable) {
+ InternalCall ctor_icall = InternalCall(itype.api_type, ctor_method, "IntPtr", itype.proxy_name + " obj");
+
+ if (!find_icall_by_name(ctor_icall.name, custom_icalls))
+ custom_icalls.push_back(ctor_icall);
+
+ cpp_file.push_back("Object* ");
+ cpp_file.push_back(ctor_method);
+ cpp_file.push_back("(MonoObject* obj) " OPEN_BLOCK
+ "\t" C_MACRO_OBJECT_CONSTRUCT "(instance, \"");
+ cpp_file.push_back(itype.name);
+ cpp_file.push_back("\");\n"
+ "\t" C_METHOD_TIE_MANAGED_TO_UNMANAGED "(obj, instance);\n"
+ "\treturn instance;\n" CLOSE_BLOCK "\n");
+ }
+ }
+
+ cpp_file.push_back("namespace GodotSharpBindings\n" OPEN_BLOCK);
+ cpp_file.push_back("uint64_t get_core_api_hash() { return ");
+ cpp_file.push_back(itos(GDMono::get_singleton()->get_api_core_hash()) + "; }\n");
+ cpp_file.push_back("#ifdef TOOLS_ENABLED\n"
+ "uint64_t get_editor_api_hash() { return ");
+ cpp_file.push_back(itos(GDMono::get_singleton()->get_api_editor_hash()) +
+ "; }\n#endif // TOOLS_ENABLED\n");
+ cpp_file.push_back("void register_generated_icalls() " OPEN_BLOCK);
+
+#define ADD_INTERNAL_CALL_REGISTRATION(m_icall) \
+ { \
+ cpp_file.push_back("\tmono_add_internal_call("); \
+ cpp_file.push_back("\"" BINDINGS_NAMESPACE "."); \
+ cpp_file.push_back(m_icall.editor_only ? CS_CLASS_NATIVECALLS_EDITOR : CS_CLASS_NATIVECALLS); \
+ cpp_file.push_back("::"); \
+ cpp_file.push_back(m_icall.name); \
+ cpp_file.push_back("\", (void*)"); \
+ cpp_file.push_back(m_icall.name); \
+ cpp_file.push_back(");\n"); \
+ }
+
+ bool tools_sequence = false;
+ for (const List<InternalCall>::Element *E = core_custom_icalls.front(); E; E = E->next()) {
+
+ if (tools_sequence) {
+ if (!E->get().editor_only) {
+ tools_sequence = false;
+ cpp_file.push_back("#endif\n");
+ }
+ } else {
+ if (E->get().editor_only) {
+ cpp_file.push_back("#ifdef TOOLS_ENABLED\n");
+ tools_sequence = true;
+ }
+ }
+
+ ADD_INTERNAL_CALL_REGISTRATION(E->get());
+ }
+
+ if (tools_sequence) {
+ tools_sequence = false;
+ cpp_file.push_back("#endif\n");
+ }
+
+ cpp_file.push_back("#ifdef TOOLS_ENABLED\n");
+ for (const List<InternalCall>::Element *E = editor_custom_icalls.front(); E; E = E->next())
+ ADD_INTERNAL_CALL_REGISTRATION(E->get());
+ cpp_file.push_back("#endif // TOOLS_ENABLED\n");
+
+ for (const List<InternalCall>::Element *E = method_icalls.front(); E; E = E->next()) {
+
+ if (tools_sequence) {
+ if (!E->get().editor_only) {
+ tools_sequence = false;
+ cpp_file.push_back("#endif\n");
+ }
+ } else {
+ if (E->get().editor_only) {
+ cpp_file.push_back("#ifdef TOOLS_ENABLED\n");
+ tools_sequence = true;
+ }
+ }
+
+ ADD_INTERNAL_CALL_REGISTRATION(E->get());
+ }
+
+ if (tools_sequence) {
+ tools_sequence = false;
+ cpp_file.push_back("#endif\n");
+ }
+
+#undef ADD_INTERNAL_CALL_REGISTRATION
+
+ cpp_file.push_back(CLOSE_BLOCK "}\n");
+
+ return _save_file(path_join(p_output_dir, "mono_glue.gen.cpp"), cpp_file);
+}
+
+Error BindingsGenerator::_save_file(const String &p_path, const List<String> &p_content) {
+
+ FileAccessRef file = FileAccess::open(p_path, FileAccess::WRITE);
+
+ ERR_FAIL_COND_V(!file, ERR_FILE_CANT_WRITE);
+
+ for (const List<String>::Element *E = p_content.front(); E; E = E->next()) {
+ file->store_string(E->get());
+ }
+
+ file->close();
+
+ return OK;
+}
+
+const BindingsGenerator::TypeInterface *BindingsGenerator::_get_type_by_name_or_null(const String &p_name) {
+
+ const Map<String, TypeInterface>::Element *match = builtin_types.find(p_name);
+
+ if (match)
+ return &match->get();
+
+ match = obj_types.find(p_name);
+
+ if (match)
+ return &match->get();
+
+ return NULL;
+}
+
+const BindingsGenerator::TypeInterface *BindingsGenerator::_get_type_by_name_or_placeholder(const String &p_name) {
+
+ const TypeInterface *found = _get_type_by_name_or_null(p_name);
+
+ if (found)
+ return found;
+
+ ERR_PRINTS(String() + "Type not found. Creating placeholder: " + p_name);
+
+ const Map<String, TypeInterface>::Element *match = placeholder_types.find(p_name);
+
+ if (match)
+ return &match->get();
+
+ TypeInterface placeholder;
+ TypeInterface::create_placeholder_type(placeholder, p_name);
+
+ return &placeholder_types.insert(placeholder.name, placeholder)->get();
+}
+
+void BindingsGenerator::_populate_object_type_interfaces() {
+
+ obj_types.clear();
+
+ List<StringName> class_list;
+ ClassDB::get_class_list(&class_list);
+ class_list.sort_custom<StringName::AlphCompare>();
+
+ StringName refclass_name = String("Reference");
+
+ while (class_list.size()) {
+ StringName type_cname = class_list.front()->get();
+
+ ClassDB::APIType api_type = ClassDB::get_api_type(type_cname);
+
+ if (api_type == ClassDB::API_NONE) {
+ class_list.pop_front();
+ continue;
+ }
+
+ TypeInterface itype = TypeInterface::create_object_type(type_cname, api_type);
+
+ itype.base_name = ClassDB::get_parent_class(type_cname);
+ itype.is_singleton = ProjectSettings::get_singleton()->has_singleton(itype.proxy_name);
+ itype.is_instantiable = ClassDB::can_instance(type_cname) && !itype.is_singleton;
+ itype.is_reference = ClassDB::is_parent_class(type_cname, refclass_name);
+ itype.memory_own = itype.is_reference;
+
+ if (!ClassDB::is_class_exposed(type_cname)) {
+ WARN_PRINTS("Ignoring type " + String(type_cname) + " because it's not exposed");
+ class_list.pop_front();
+ continue;
+ }
+
+ itype.c_out = "\treturn ";
+ itype.c_out += C_METHOD_UNMANAGED_GET_MANAGED;
+ itype.c_out += itype.is_reference ? "(%1.ptr());\n" : "(%1);\n";
+
+ itype.cs_in = itype.is_singleton ? BINDINGS_PTR_FIELD : "Object." CS_SMETHOD_GETINSTANCE "(%0)";
+
+ itype.c_type = "Object*";
+ itype.c_type_in = itype.c_type;
+ itype.c_type_out = "MonoObject*";
+ itype.cs_type = itype.proxy_name;
+ itype.im_type_in = "IntPtr";
+ itype.im_type_out = itype.proxy_name;
+
+ List<MethodInfo> virtual_method_list;
+ ClassDB::get_virtual_methods(type_cname, &virtual_method_list, true);
+
+ List<MethodInfo> method_list;
+ ClassDB::get_method_list(type_cname, &method_list, true);
+ method_list.sort();
+
+ for (List<MethodInfo>::Element *E = method_list.front(); E; E = E->next()) {
+ const MethodInfo &method_info = E->get();
+
+ int argc = method_info.arguments.size();
+
+ if (method_info.name.empty())
+ continue;
+
+ MethodInterface imethod;
+ imethod.name = method_info.name;
+
+ if (method_info.flags & METHOD_FLAG_VIRTUAL)
+ imethod.is_virtual = true;
+
+ PropertyInfo return_info = method_info.return_val;
+
+ MethodBind *m = imethod.is_virtual ? NULL : ClassDB::get_method(type_cname, method_info.name);
+
+ imethod.is_vararg = m && m->is_vararg();
+
+ if (!m && !imethod.is_virtual) {
+ if (virtual_method_list.find(method_info)) {
+ // A virtual method without the virtual flag. This is a special case.
+
+ // This type of method can only be found in Object derived types.
+ ERR_FAIL_COND(!itype.is_object_type);
+
+ // There is no method bind, so let's fallback to Godot's object.Call(string, params)
+ imethod.requires_object_call = true;
+
+ // The method Object.free is registered as a virtual method, but without the virtual flag.
+ // This is because this method is not supposed to be overridden, but called.
+ // We assume the return type is void.
+ imethod.return_type = "void";
+
+ // Actually, more methods like this may be added in the future,
+ // which could actually will return something differnet.
+ // Let's put this to notify us if that ever happens.
+ if (itype.name != "Object" || imethod.name != "free") {
+ WARN_PRINTS("Notification: New unexpected virtual non-overridable method found.\n"
+ "We only expected Object.free, but found " +
+ itype.name + "." + imethod.name);
+ }
+ } else {
+ ERR_PRINTS("Missing MethodBind for non-virtual method: " + itype.name + "." + imethod.name);
+ }
+ } else if (return_info.type == Variant::INT && return_info.usage & PROPERTY_USAGE_CLASS_IS_ENUM) {
+ //imethod.return_type = return_info.class_name;
+ imethod.return_type = "int";
+ } else if (return_info.class_name != StringName()) {
+ imethod.return_type = return_info.class_name;
+ } else if (return_info.hint == PROPERTY_HINT_RESOURCE_TYPE) {
+ imethod.return_type = return_info.hint_string;
+ } else if (return_info.type == Variant::NIL && return_info.usage & PROPERTY_USAGE_NIL_IS_VARIANT) {
+ imethod.return_type = "Variant";
+ } else if (return_info.type == Variant::NIL) {
+ imethod.return_type = "void";
+ } else {
+ imethod.return_type = Variant::get_type_name(return_info.type);
+ }
+
+ if (!itype.requires_collections && imethod.return_type == "Dictionary")
+ itype.requires_collections = true;
+
+ for (int i = 0; i < argc; i++) {
+ PropertyInfo arginfo = method_info.arguments[i];
+
+ ArgumentInterface iarg;
+ iarg.name = arginfo.name;
+
+ if (arginfo.type == Variant::INT && arginfo.usage & PROPERTY_USAGE_CLASS_IS_ENUM) {
+ //iarg.type = arginfo.class_name;
+ iarg.type = "int";
+ } else if (arginfo.class_name != StringName()) {
+ iarg.type = arginfo.class_name;
+ } else if (arginfo.hint == PROPERTY_HINT_RESOURCE_TYPE) {
+ iarg.type = arginfo.hint_string;
+ } else if (arginfo.type == Variant::NIL) {
+ iarg.type = "Variant";
+ } else {
+ iarg.type = Variant::get_type_name(arginfo.type);
+ }
+
+ iarg.name = escape_csharp_keyword(snake_to_camel_case(iarg.name));
+
+ if (!itype.requires_collections && iarg.type == "Dictionary")
+ itype.requires_collections = true;
+
+ if (m && m->has_default_argument(i)) {
+ _default_argument_from_variant(m->get_default_argument(i), iarg);
+ }
+
+ imethod.add_argument(iarg);
+ }
+
+ if (imethod.is_vararg) {
+ ArgumentInterface ivararg;
+ ivararg.type = "VarArg";
+ ivararg.name = "@args";
+ imethod.add_argument(ivararg);
+ }
+
+ imethod.proxy_name = escape_csharp_keyword(snake_to_pascal_case(imethod.name));
+
+ // Prevent naming the property and its enclosing type from sharing the same name
+ if (imethod.proxy_name == itype.proxy_name) {
+ if (verbose_output) {
+ WARN_PRINTS("Name of method `" + imethod.proxy_name + "` is ambiguous with the name of its class `" +
+ itype.proxy_name + "`. Renaming method to `" + imethod.proxy_name + "_`");
+ }
+
+ imethod.proxy_name += "_";
+ }
+
+ if (itype.class_doc) {
+ for (int i = 0; i < itype.class_doc->methods.size(); i++) {
+ if (itype.class_doc->methods[i].name == imethod.name) {
+ imethod.method_doc = &itype.class_doc->methods[i];
+ break;
+ }
+ }
+ }
+
+ if (!imethod.is_virtual && imethod.name[0] == '_') {
+ const Vector<DocData::PropertyDoc> &properties = itype.class_doc->properties;
+
+ for (int i = 0; i < properties.size(); i++) {
+ const DocData::PropertyDoc &prop_doc = properties[i];
+
+ if (prop_doc.getter == imethod.name || prop_doc.setter == imethod.name) {
+ imethod.is_internal = true;
+ itype.methods.push_back(imethod);
+ break;
+ }
+ }
+ } else {
+ itype.methods.push_back(imethod);
+ }
+ }
+
+ obj_types.insert(itype.name, itype);
+
+ class_list.pop_front();
+ }
+}
+
+void BindingsGenerator::_default_argument_from_variant(const Variant &p_val, ArgumentInterface &r_iarg) {
+
+ r_iarg.default_argument = p_val;
+
+ switch (p_val.get_type()) {
+ case Variant::NIL:
+ if (ClassDB::class_exists(r_iarg.type)) {
+ // Object type
+ r_iarg.default_argument = "null";
+ } else {
+ // Variant
+ r_iarg.default_argument = "null";
+ }
+ break;
+ // Atomic types
+ case Variant::BOOL:
+ r_iarg.default_argument = bool(p_val) ? "true" : "false";
+ break;
+ case Variant::INT:
+ break; // Keep it
+ case Variant::REAL:
+#ifndef REAL_T_IS_DOUBLE
+ r_iarg.default_argument += "f";
+#endif
+ break;
+ case Variant::STRING:
+ case Variant::NODE_PATH:
+ r_iarg.default_argument = "\"" + r_iarg.default_argument + "\"";
+ break;
+ case Variant::TRANSFORM:
+ if (p_val.operator Transform() == Transform())
+ r_iarg.default_argument.clear();
+ r_iarg.default_argument = "new %s(" + r_iarg.default_argument + ")";
+ r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
+ break;
+ case Variant::PLANE:
+ case Variant::RECT3:
+ case Variant::COLOR:
+ r_iarg.default_argument = "new Color(1, 1, 1, 1)";
+ r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
+ break;
+ case Variant::VECTOR2:
+ case Variant::RECT2:
+ case Variant::VECTOR3:
+ r_iarg.default_argument = "new %s" + r_iarg.default_argument;
+ r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
+ break;
+ case Variant::OBJECT:
+ if (p_val.is_zero()) {
+ r_iarg.default_argument = "null";
+ break;
+ }
+ case Variant::DICTIONARY:
+ case Variant::_RID:
+ r_iarg.default_argument = "new %s()";
+ r_iarg.def_param_mode = ArgumentInterface::NULLABLE_REF;
+ break;
+ case Variant::ARRAY:
+ case Variant::POOL_BYTE_ARRAY:
+ case Variant::POOL_INT_ARRAY:
+ case Variant::POOL_REAL_ARRAY:
+ case Variant::POOL_STRING_ARRAY:
+ case Variant::POOL_VECTOR2_ARRAY:
+ case Variant::POOL_VECTOR3_ARRAY:
+ case Variant::POOL_COLOR_ARRAY:
+ r_iarg.default_argument = "new %s {}";
+ r_iarg.def_param_mode = ArgumentInterface::NULLABLE_REF;
+ break;
+ case Variant::TRANSFORM2D:
+ case Variant::BASIS:
+ case Variant::QUAT:
+ r_iarg.default_argument = Variant::get_type_name(p_val.get_type()) + ".Identity";
+ r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
+ break;
+ default: {}
+ }
+
+ if (r_iarg.def_param_mode == ArgumentInterface::CONSTANT && r_iarg.type == "Variant" && r_iarg.default_argument != "null")
+ r_iarg.def_param_mode = ArgumentInterface::NULLABLE_REF;
+}
+
+void BindingsGenerator::_populate_builtin_type_interfaces() {
+
+ builtin_types.clear();
+
+ TypeInterface itype;
+
+#define INSERT_STRUCT_TYPE(m_type, m_type_in) \
+ { \
+ itype = TypeInterface::create_value_type(#m_type); \
+ itype.c_in = "\tMARSHALLED_IN(" #m_type ", %1, %1_in);\n"; \
+ itype.c_out = "\tMARSHALLED_OUT(" #m_type ", %1, ret_out)\n" \
+ "\treturn mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(%2), ret_out);\n"; \
+ itype.c_arg_in = "&%s_in"; \
+ itype.c_type_in = m_type_in; \
+ itype.cs_in = "ref %s"; \
+ itype.cs_out = "return (" #m_type ")%0;"; \
+ itype.im_type_out = "object"; \
+ builtin_types.insert(#m_type, itype); \
+ }
+
+ INSERT_STRUCT_TYPE(Vector2, "real_t*")
+ INSERT_STRUCT_TYPE(Rect2, "real_t*")
+ INSERT_STRUCT_TYPE(Transform2D, "real_t*")
+ INSERT_STRUCT_TYPE(Vector3, "real_t*")
+ INSERT_STRUCT_TYPE(Basis, "real_t*")
+ INSERT_STRUCT_TYPE(Quat, "real_t*")
+ INSERT_STRUCT_TYPE(Transform, "real_t*")
+ INSERT_STRUCT_TYPE(Rect3, "real_t*")
+ INSERT_STRUCT_TYPE(Color, "real_t*")
+ INSERT_STRUCT_TYPE(Plane, "real_t*")
+
+#undef INSERT_STRUCT_TYPE
+
+#define INSERT_PRIMITIVE_TYPE(m_type) \
+ { \
+ itype = TypeInterface::create_value_type(#m_type); \
+ itype.c_arg_in = "&%s"; \
+ itype.c_type_in = #m_type; \
+ itype.c_type_out = #m_type; \
+ itype.im_type_in = #m_type; \
+ itype.im_type_out = #m_type; \
+ builtin_types.insert(#m_type, itype); \
+ }
+
+ INSERT_PRIMITIVE_TYPE(bool)
+ //INSERT_PRIMITIVE_TYPE(int)
+
+ // int
+ itype = TypeInterface::create_value_type("int");
+ itype.c_arg_in = "&%s_in";
+ //* ptrcall only supports int64_t and uint64_t
+ itype.c_in = "\t%0 %1_in = (%0)%1;\n";
+ itype.c_out = "\treturn (%0)%1;\n";
+ itype.c_type = "int64_t";
+ //*/
+ itype.c_type_in = itype.name;
+ itype.c_type_out = itype.name;
+ itype.im_type_in = itype.name;
+ itype.im_type_out = itype.name;
+ builtin_types.insert(itype.name, itype);
+
+#undef INSERT_PRIMITIVE_TYPE
+
+ // real_t
+ itype = TypeInterface();
+#ifdef REAL_T_IS_DOUBLE
+ itype.name = "double";
+#else
+ itype.name = "float";
+#endif
+ itype.proxy_name = itype.name;
+ itype.c_arg_in = "&%s_in";
+ //* ptrcall only supports double
+ itype.c_in = "\t%0 %1_in = (%0)%1;\n";
+ itype.c_out = "\treturn (%0)%1;\n";
+ itype.c_type = "double";
+ //*/
+ itype.c_type_in = "real_t";
+ itype.c_type_out = "real_t";
+ itype.cs_type = itype.proxy_name;
+ itype.im_type_in = itype.proxy_name;
+ itype.im_type_out = itype.proxy_name;
+ builtin_types.insert(itype.name, itype);
+
+ // String
+ itype = TypeInterface();
+ itype.name = "String";
+ itype.proxy_name = "string";
+ itype.c_in = "\t%0 %1_in = " C_METHOD_MONOSTR_TO_GODOT "(%1);\n";
+ itype.c_out = "\treturn " C_METHOD_MONOSTR_FROM_GODOT "(%1);\n";
+ itype.c_arg_in = "&%s_in";
+ itype.c_type = itype.name;
+ itype.c_type_in = "MonoString*";
+ itype.c_type_out = "MonoString*";
+ itype.cs_type = itype.proxy_name;
+ itype.im_type_in = itype.proxy_name;
+ itype.im_type_out = itype.proxy_name;
+ builtin_types.insert(itype.name, itype);
+
+ // NodePath
+ itype = TypeInterface();
+ itype.name = "NodePath";
+ itype.proxy_name = "NodePath";
+ itype.c_out = "\treturn memnew(NodePath(%1));\n";
+ itype.c_type = itype.name;
+ itype.c_type_in = itype.c_type + "*";
+ itype.c_type_out = itype.c_type + "*";
+ itype.cs_type = itype.proxy_name;
+ itype.cs_in = "NodePath." CS_SMETHOD_GETINSTANCE "(%0)";
+ itype.cs_out = "return new NodePath(%0);";
+ itype.im_type_in = "IntPtr";
+ itype.im_type_out = "IntPtr";
+ _populate_builtin_type(itype, Variant::NODE_PATH);
+ extra_members.insert(itype.name, MEMBER_BEGIN "public NodePath() : this(string.Empty) {}\n" MEMBER_BEGIN "public NodePath(string path)\n" OPEN_BLOCK_L2
+ "this." BINDINGS_PTR_FIELD " = NativeCalls.godot_icall_NodePath_Ctor(path);\n" CLOSE_BLOCK_L2
+ MEMBER_BEGIN "public static implicit operator NodePath(string from)\n" OPEN_BLOCK_L2 "return new NodePath(from);\n" CLOSE_BLOCK_L2
+ MEMBER_BEGIN "public static implicit operator string(NodePath from)\n" OPEN_BLOCK_L2
+ "return NativeCalls." ICALL_PREFIX "NodePath_operator_String(NodePath." CS_SMETHOD_GETINSTANCE "(from));\n" CLOSE_BLOCK_L2);
+ builtin_types.insert(itype.name, itype);
+
+ // RID
+ itype = TypeInterface();
+ itype.name = "RID";
+ itype.proxy_name = "RID";
+ itype.c_out = "\treturn memnew(RID(%1));\n";
+ itype.c_type = itype.name;
+ itype.c_type_in = itype.c_type + "*";
+ itype.c_type_out = itype.c_type + "*";
+ itype.cs_type = itype.proxy_name;
+ itype.cs_in = "RID." CS_SMETHOD_GETINSTANCE "(%0)";
+ itype.cs_out = "return new RID(%0);";
+ itype.im_type_in = "IntPtr";
+ itype.im_type_out = "IntPtr";
+ _populate_builtin_type(itype, Variant::_RID);
+ extra_members.insert(itype.name, MEMBER_BEGIN "internal RID()\n" OPEN_BLOCK_L2
+ "this." BINDINGS_PTR_FIELD " = IntPtr.Zero;\n" CLOSE_BLOCK_L2);
+ builtin_types.insert(itype.name, itype);
+
+ // Variant
+ itype = TypeInterface();
+ itype.name = "Variant";
+ itype.proxy_name = "object";
+ itype.c_in = "\t%0 %1_in = " C_METHOD_MANAGED_TO_VARIANT "(%1);\n";
+ itype.c_out = "\treturn " C_METHOD_MANAGED_FROM_VARIANT "(%1);\n";
+ itype.c_arg_in = "&%s_in";
+ itype.c_type = itype.name;
+ itype.c_type_in = "MonoObject*";
+ itype.c_type_out = "MonoObject*";
+ itype.cs_type = itype.proxy_name;
+ itype.im_type_in = "object";
+ itype.im_type_out = itype.proxy_name;
+ builtin_types.insert(itype.name, itype);
+
+ // VarArg (fictitious type to represent variable arguments)
+ itype = TypeInterface();
+ itype.name = "VarArg";
+ itype.proxy_name = "object[]";
+ itype.c_in = "\t%0 %1_in = " C_METHOD_MONOARRAY_TO(Array) "(%1);\n";
+ itype.c_arg_in = "&%s_in";
+ itype.c_type = "Array";
+ itype.c_type_in = "MonoArray*";
+ itype.cs_type = "params object[]";
+ itype.im_type_in = "object[]";
+ builtin_types.insert(itype.name, itype);
+
+#define INSERT_ARRAY_FULL(m_name, m_type, m_proxy_t) \
+ { \
+ itype = TypeInterface(); \
+ itype.name = #m_name; \
+ itype.proxy_name = #m_proxy_t "[]"; \
+ itype.c_in = "\t%0 %1_in = " C_METHOD_MONOARRAY_TO(m_type) "(%1);\n"; \
+ itype.c_out = "\treturn " C_METHOD_MONOARRAY_FROM(m_type) "(%1);\n"; \
+ itype.c_arg_in = "&%s_in"; \
+ itype.c_type = #m_type; \
+ itype.c_type_in = "MonoArray*"; \
+ itype.c_type_out = "MonoArray*"; \
+ itype.cs_type = itype.proxy_name; \
+ itype.im_type_in = itype.proxy_name; \
+ itype.im_type_out = itype.proxy_name; \
+ builtin_types.insert(itype.name, itype); \
+ }
+
+#define INSERT_ARRAY(m_type, m_proxy_t) INSERT_ARRAY_FULL(m_type, m_type, m_proxy_t)
+
+ INSERT_ARRAY(Array, object);
+ INSERT_ARRAY(PoolIntArray, int);
+ INSERT_ARRAY_FULL(PoolByteArray, PoolByteArray, byte);
+
+#ifdef REAL_T_IS_DOUBLE
+ INSERT_ARRAY(PoolRealArray, double);
+#else
+ INSERT_ARRAY(PoolRealArray, float);
+#endif
+
+ INSERT_ARRAY(PoolStringArray, string);
+
+ INSERT_ARRAY(PoolColorArray, Color);
+ INSERT_ARRAY(PoolVector2Array, Vector2);
+ INSERT_ARRAY(PoolVector3Array, Vector3);
+
+#undef INSERT_ARRAY
+
+ // Dictionary
+ itype = TypeInterface();
+ itype.name = "Dictionary";
+ itype.proxy_name = "Dictionary<object, object>";
+ itype.c_in = "\t%0 %1_in = " C_METHOD_MANAGED_TO_DICT "(%1);\n";
+ itype.c_out = "\treturn " C_METHOD_MANAGED_FROM_DICT "(%1);\n";
+ itype.c_arg_in = "&%s_in";
+ itype.c_type = itype.name;
+ itype.c_type_in = "MonoObject*";
+ itype.c_type_out = "MonoObject*";
+ itype.cs_type = itype.proxy_name;
+ itype.im_type_in = itype.proxy_name;
+ itype.im_type_out = itype.proxy_name;
+ builtin_types.insert(itype.name, itype);
+
+ // void (fictitious type to represent the return type of methods that do not return anything)
+ itype = TypeInterface();
+ itype.name = "void";
+ itype.proxy_name = itype.name;
+ itype.c_type = itype.name;
+ itype.c_type_in = itype.c_type;
+ itype.c_type_out = itype.c_type;
+ itype.cs_type = itype.proxy_name;
+ itype.im_type_in = itype.proxy_name;
+ itype.im_type_out = itype.proxy_name;
+ builtin_types.insert(itype.name, itype);
+
+ // Error
+ itype = TypeInterface();
+ itype.name = "Error";
+ itype.proxy_name = "Error";
+ itype.c_type = itype.name;
+ itype.c_type_in = itype.c_type;
+ itype.c_type_out = itype.c_type;
+ itype.cs_type = itype.proxy_name;
+ itype.cs_in = "(int)%0";
+ itype.cs_out = "return (Error)%s;";
+ itype.im_type_in = "int";
+ itype.im_type_out = "int";
+ builtin_types.insert(itype.name, itype);
+}
+
+void BindingsGenerator::_populate_builtin_type(TypeInterface &r_itype, Variant::Type vtype) {
+
+ Variant::CallError cerror;
+ Variant v = Variant::construct(vtype, NULL, 0, cerror);
+
+ List<MethodInfo> method_list;
+ v.get_method_list(&method_list);
+ method_list.sort();
+
+ for (List<MethodInfo>::Element *E = method_list.front(); E; E = E->next()) {
+ MethodInfo &mi = E->get();
+ MethodInterface imethod;
+
+ imethod.name = mi.name;
+ imethod.proxy_name = mi.name;
+
+ for (int i = 0; i < mi.arguments.size(); i++) {
+ ArgumentInterface iarg;
+ PropertyInfo pi = mi.arguments[i];
+
+ iarg.name = pi.name;
+
+ if (pi.type == Variant::NIL)
+ iarg.type = "Variant";
+ else
+ iarg.type = Variant::get_type_name(pi.type);
+
+ if (!r_itype.requires_collections && iarg.type == "Dictionary")
+ r_itype.requires_collections = true;
+
+ if ((mi.default_arguments.size() - mi.arguments.size() + i) >= 0)
+ _default_argument_from_variant(Variant::construct(pi.type, NULL, 0, cerror), iarg);
+
+ imethod.add_argument(iarg);
+ }
+
+ if (mi.return_val.type == Variant::NIL) {
+ if (mi.return_val.name != "")
+ imethod.return_type = "Variant";
+ } else {
+ imethod.return_type = Variant::get_type_name(mi.return_val.type);
+ }
+
+ if (!r_itype.requires_collections && imethod.return_type == "Dictionary")
+ r_itype.requires_collections = true;
+
+ if (r_itype.class_doc) {
+ for (int i = 0; i < r_itype.class_doc->methods.size(); i++) {
+ if (r_itype.class_doc->methods[i].name == imethod.name) {
+ imethod.method_doc = &r_itype.class_doc->methods[i];
+ break;
+ }
+ }
+ }
+
+ r_itype.methods.push_back(imethod);
+ }
+}
+
+BindingsGenerator::BindingsGenerator() {
+
+ EditorHelp::generate_doc();
+
+ _populate_object_type_interfaces();
+ _populate_builtin_type_interfaces();
+ _generate_header_icalls();
+
+ for (Map<String, TypeInterface>::Element *E = obj_types.front(); E; E = E->next())
+ _generate_method_icalls(E->get());
+
+ _generate_method_icalls(builtin_types["NodePath"]);
+ _generate_method_icalls(builtin_types["RID"]);
+}
+
+void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args) {
+
+ int options_count = 3;
+
+ String mono_glue_option = "--generate-mono-glue";
+ String cs_core_api_option = "--generate-cs-core-api";
+ String cs_editor_api_option = "--generate-cs-editor-api";
+
+ verbose_output = true;
+
+ const List<String>::Element *elem = p_cmdline_args.front();
+
+ while (elem && options_count) {
+
+ if (elem->get() == mono_glue_option) {
+
+ const List<String>::Element *path_elem = elem->next();
+
+ if (path_elem) {
+ get_singleton().generate_glue(path_elem->get());
+ elem = elem->next();
+ } else {
+ ERR_PRINTS("--generate-mono-glue: No output directory specified");
+ }
+
+ --options_count;
+
+ } else if (elem->get() == cs_core_api_option) {
+
+ const List<String>::Element *path_elem = elem->next();
+
+ if (path_elem) {
+ get_singleton().generate_cs_core_project(path_elem->get());
+ elem = elem->next();
+ } else {
+ ERR_PRINTS(cs_core_api_option + ": No output directory specified");
+ }
+
+ --options_count;
+
+ } else if (elem->get() == cs_editor_api_option) {
+
+ const List<String>::Element *path_elem = elem->next();
+
+ if (path_elem) {
+ if (path_elem->next()) {
+ get_singleton().generate_cs_editor_project(path_elem->get(), path_elem->next()->get());
+ elem = path_elem->next();
+ } else {
+ ERR_PRINTS(cs_editor_api_option + ": No hint path for the Core API dll specified");
+ }
+ } else {
+ ERR_PRINTS(cs_editor_api_option + ": No output directory specified");
+ }
+
+ --options_count;
+ }
+
+ elem = elem->next();
+ }
+
+ verbose_output = false;
+}
+
+#endif
diff --git a/modules/mono/editor/bindings_generator.h b/modules/mono/editor/bindings_generator.h
new file mode 100644
index 0000000000..437a566556
--- /dev/null
+++ b/modules/mono/editor/bindings_generator.h
@@ -0,0 +1,429 @@
+/*************************************************************************/
+/* bindings_generator.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef BINDINGS_GENERATOR_H
+#define BINDINGS_GENERATOR_H
+
+#include "class_db.h"
+#include "editor/doc/doc_data.h"
+#include "editor/editor_help.h"
+
+#ifdef DEBUG_METHODS_ENABLED
+
+#include "ustring.h"
+
+class BindingsGenerator {
+ struct ArgumentInterface {
+ enum DefaultParamMode {
+ CONSTANT,
+ NULLABLE_VAL,
+ NULLABLE_REF
+ };
+
+ String type;
+ String name;
+ String default_argument;
+ DefaultParamMode def_param_mode;
+
+ ArgumentInterface() {
+ def_param_mode = CONSTANT;
+ }
+ };
+
+ struct MethodInterface {
+ String name;
+
+ /**
+ * Name of the C# method
+ */
+ String proxy_name;
+
+ /**
+ * [TypeInterface::name] of the return type
+ */
+ String return_type;
+
+ /**
+ * Determines if the method has a variable number of arguments (VarArg)
+ */
+ bool is_vararg;
+
+ /**
+ * Virtual methods ("virtual" as defined by the Godot API) are methods that by default do nothing,
+ * but can be overridden by the user to add custom functionality.
+ * e.g.: _ready, _process, etc.
+ */
+ bool is_virtual;
+
+ /**
+ * Determines if the call should fallback to Godot's object.Call(string, params) in C#.
+ */
+ bool requires_object_call;
+
+ /**
+ * Determines if the method visibility is `internal` (visible only to files in the same assembly).
+ * Currently, we only use this for methods that are not meant to be exposed,
+ * but are required by properties as getters or setters.
+ * Methods that are not meant to be exposed are those that begin with underscore and are not virtual.
+ */
+ bool is_internal;
+
+ List<ArgumentInterface> arguments;
+
+ const DocData::MethodDoc *method_doc;
+
+ void add_argument(const ArgumentInterface &argument) {
+ arguments.push_back(argument);
+ }
+
+ MethodInterface() {
+ return_type = "void";
+ is_vararg = false;
+ is_virtual = false;
+ requires_object_call = false;
+ is_internal = false;
+ method_doc = NULL;
+ }
+ };
+
+ struct TypeInterface {
+ /**
+ * Identifier name for this type.
+ * Also used to format [c_out].
+ */
+ String name;
+
+ /**
+ * Identifier name of the base class.
+ */
+ String base_name;
+
+ /**
+ * Name of the C# class
+ */
+ String proxy_name;
+
+ ClassDB::APIType api_type;
+
+ bool is_object_type;
+ bool is_singleton;
+ bool is_reference;
+
+ /**
+ * Used only by Object-derived types.
+ * Determines if this type is not virtual (incomplete).
+ * e.g.: CanvasItem cannot be instantiated.
+ */
+ bool is_instantiable;
+
+ /**
+ * Used only by Object-derived types.
+ * Determines if the C# class owns the native handle and must free it somehow when disposed.
+ * e.g.: Reference types must notify when the C# instance is disposed, for proper refcounting.
+ */
+ bool memory_own;
+
+ /**
+ * Determines if the file must have a using directive for System.Collections.Generic
+ * e.g.: When the generated class makes use of Dictionary
+ */
+ bool requires_collections;
+
+ // !! The comments of the following fields make reference to other fields via square brackets, e.g.: [field_name]
+ // !! When renaming those fields, make sure to rename their references in the comments
+
+ // --- C INTERFACE ---
+
+ static const char *DEFAULT_VARARG_C_IN;
+
+ /**
+ * One or more statements that manipulate the parameter before being passed as argument of a ptrcall.
+ * If the statement adds a local that must be passed as the argument instead of the parameter,
+ * the name of that local must be specified with [c_arg_in].
+ * For variadic methods, this field is required and, if empty, [DEFAULT_VARARG_C_IN] is used instead.
+ * Formatting elements:
+ * %0: [c_type] of the parameter
+ * %1: name of the parameter
+ */
+ String c_in;
+
+ /**
+ * Determines the name of the variable that will be passed as argument to a ptrcall.
+ * By default the value equals the name of the parameter,
+ * this varies for types that require special manipulation via [c_in].
+ * Formatting elements:
+ * %0 or %s: name of the parameter
+ */
+ String c_arg_in;
+
+ /**
+ * One or more statements that determine how a variable of this type is returned from a function.
+ * It must contain the return statement(s).
+ * Formatting elements:
+ * %0: [c_type_out] of the return type
+ * %1: name of the variable to be returned
+ * %2: [name] of the return type
+ */
+ String c_out;
+
+ /**
+ * The actual expected type, as seen (in most cases) in Variant copy constructors
+ * Used for the type of the return variable and to format [c_in].
+ * The value must be the following depending of the type:
+ * Object-derived types: Object*
+ * Other types: [name]
+ * -- Exceptions --
+ * VarArg (fictitious type to represent variable arguments): Array
+ * float: double (because ptrcall only supports double)
+ * int: int64_t (because ptrcall only supports int64_t and uint64_t)
+ * Reference types override this for the type of the return variable: Ref<Reference>
+ */
+ String c_type;
+
+ /**
+ * Determines the type used for parameters in function signatures.
+ */
+ String c_type_in;
+
+ /**
+ * Determines the return type used for function signatures.
+ * Also used to construct a default value to return in case of errors,
+ * and to format [c_out].
+ */
+ String c_type_out;
+
+ // --- C# INTERFACE ---
+
+ /**
+ * An expression that overrides the way the parameter is passed to the internal call.
+ * If empty, the parameter is passed as is.
+ * Formatting elements:
+ * %0 or %s: name of the parameter
+ */
+ String cs_in;
+
+ /**
+ * One or more statements that determine how a variable of this type is returned from a method.
+ * It must contain the return statement(s).
+ * Formatting elements:
+ * %0 or %s: name of the variable to be returned
+ */
+ String cs_out;
+
+ /**
+ * Type used for method signatures, both for parameters and the return type.
+ * Same as [proxy_name] except for variable arguments (VarArg).
+ */
+ String cs_type;
+
+ /**
+ * Type used for parameters of internal call methods.
+ */
+ String im_type_in;
+
+ /**
+ * Type used for the return type of internal call methods.
+ * If [cs_out] is not empty and the method return type is not void,
+ * it is also used for the type of the return variable.
+ */
+ String im_type_out;
+
+ const DocData::ClassDoc *class_doc;
+
+ List<MethodInterface> methods;
+
+ const MethodInterface *find_method_by_name(const String &p_name) const {
+
+ for (const List<MethodInterface>::Element *E = methods.front(); E; E = E->next()) {
+ if (E->get().name == p_name)
+ return &E->get();
+ }
+
+ return NULL;
+ }
+
+ static TypeInterface create_value_type(const String &p_name) {
+ TypeInterface itype;
+
+ itype.name = p_name;
+ itype.proxy_name = p_name;
+
+ itype.c_type = itype.name;
+ itype.c_type_in = "void*";
+ itype.c_type_out = "MonoObject*";
+ itype.cs_type = itype.proxy_name;
+ itype.im_type_in = "ref " + itype.proxy_name;
+ itype.im_type_out = itype.proxy_name;
+ itype.class_doc = &EditorHelp::get_doc_data()->class_list[itype.proxy_name];
+
+ return itype;
+ }
+
+ static TypeInterface create_object_type(const String &p_name, ClassDB::APIType p_api_type) {
+ TypeInterface itype;
+
+ itype.name = p_name;
+ itype.proxy_name = p_name.begins_with("_") ? p_name.substr(1, p_name.length()) : p_name;
+ itype.api_type = p_api_type;
+ itype.is_object_type = true;
+ itype.class_doc = &EditorHelp::get_doc_data()->class_list[itype.proxy_name];
+
+ return itype;
+ }
+
+ static void create_placeholder_type(TypeInterface &r_itype, const String &p_name) {
+ r_itype.name = p_name;
+ r_itype.proxy_name = p_name;
+
+ r_itype.c_type = r_itype.name;
+ r_itype.c_type_in = "MonoObject*";
+ r_itype.c_type_out = "MonoObject*";
+ r_itype.cs_type = r_itype.proxy_name;
+ r_itype.im_type_in = r_itype.proxy_name;
+ r_itype.im_type_out = r_itype.proxy_name;
+ }
+
+ TypeInterface() {
+
+ api_type = ClassDB::API_NONE;
+
+ is_object_type = false;
+ is_singleton = false;
+ is_reference = false;
+ is_instantiable = false;
+
+ memory_own = false;
+ requires_collections = false;
+
+ c_arg_in = "%s";
+
+ class_doc = NULL;
+ }
+ };
+
+ struct InternalCall {
+ String name;
+ String im_type_out; // Return type for the C# method declaration. Also used as companion of [unique_siq]
+ String im_sig; // Signature for the C# method declaration
+ String unique_sig; // Unique signature to avoid duplicates in containers
+ bool editor_only;
+
+ InternalCall() {}
+
+ InternalCall(const String &p_name, const String &p_im_type_out, const String &p_im_sig = String(), const String &p_unique_sig = String()) {
+ name = p_name;
+ im_type_out = p_im_type_out;
+ im_sig = p_im_sig;
+ unique_sig = p_unique_sig;
+ editor_only = false;
+ }
+
+ InternalCall(ClassDB::APIType api_type, const String &p_name, const String &p_im_type_out, const String &p_im_sig = String(), const String &p_unique_sig = String()) {
+ name = p_name;
+ im_type_out = p_im_type_out;
+ im_sig = p_im_sig;
+ unique_sig = p_unique_sig;
+ editor_only = api_type == ClassDB::API_EDITOR;
+ }
+
+ inline bool operator==(const InternalCall &p_a) const {
+ return p_a.unique_sig == unique_sig;
+ }
+ };
+
+ static bool verbose_output;
+
+ Map<String, TypeInterface> placeholder_types;
+ Map<String, TypeInterface> builtin_types;
+ Map<String, TypeInterface> obj_types;
+
+ Map<String, String> extra_members;
+
+ List<InternalCall> method_icalls;
+ Map<const MethodInterface *, const InternalCall *> method_icalls_map;
+
+ List<InternalCall> core_custom_icalls;
+ List<InternalCall> editor_custom_icalls;
+
+ const List<InternalCall>::Element *find_icall_by_name(const String &p_name, const List<InternalCall> &p_list) {
+
+ const List<InternalCall>::Element *it = p_list.front();
+ while (it) {
+ if (it->get().name == p_name) return it;
+ it = it->next();
+ }
+ return NULL;
+ }
+
+ inline String get_unique_sig(const TypeInterface &p_type) {
+ if (p_type.is_reference)
+ return "Ref";
+ else if (p_type.is_object_type)
+ return "Obj";
+
+ return p_type.name;
+ }
+
+ void _generate_header_icalls();
+ void _generate_method_icalls(const TypeInterface &p_itype);
+
+ const TypeInterface *_get_type_by_name_or_null(const String &p_name);
+ const TypeInterface *_get_type_by_name_or_placeholder(const String &p_name);
+
+ void _default_argument_from_variant(const Variant &p_var, ArgumentInterface &r_iarg);
+ void _populate_builtin_type(TypeInterface &r_type, Variant::Type vtype);
+
+ void _populate_object_type_interfaces();
+ void _populate_builtin_type_interfaces();
+
+ Error _generate_cs_type(const TypeInterface &itype, const String &p_output_file);
+
+ Error _save_file(const String &path, const List<String> &content);
+
+ BindingsGenerator();
+
+ BindingsGenerator(const BindingsGenerator &);
+ BindingsGenerator &operator=(const BindingsGenerator &);
+
+public:
+ Error generate_cs_core_project(const String &p_output_dir, bool p_verbose_output = true);
+ Error generate_cs_editor_project(const String &p_output_dir, const String &p_core_dll_path, bool p_verbose_output = true);
+ Error generate_glue(const String &p_output_dir);
+
+ static BindingsGenerator &get_singleton() {
+ static BindingsGenerator singleton;
+ return singleton;
+ }
+
+ static void handle_cmdline_args(const List<String> &p_cmdline_args);
+};
+
+#endif
+
+#endif // BINDINGS_GENERATOR_H
diff --git a/modules/mono/editor/csharp_project.cpp b/modules/mono/editor/csharp_project.cpp
new file mode 100644
index 0000000000..bde5f0fd0b
--- /dev/null
+++ b/modules/mono/editor/csharp_project.cpp
@@ -0,0 +1,120 @@
+/*************************************************************************/
+/* csharp_project.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "csharp_project.h"
+
+#include "os/os.h"
+#include "project_settings.h"
+
+#include "../mono_gd/gd_mono_class.h"
+#include "../mono_gd/gd_mono_marshal.h"
+
+namespace CSharpProject {
+
+String generate_core_api_project(const String &p_dir, const Vector<String> &p_files) {
+
+ _GDMONO_SCOPE_DOMAIN_(TOOLS_DOMAIN)
+
+ GDMonoClass *klass = GDMono::get_singleton()->get_editor_tools_assembly()->get_class("GodotSharpTools.Project", "ProjectGenerator");
+
+ Variant dir = p_dir;
+ Variant compile_items = p_files;
+ const Variant *args[2] = { &dir, &compile_items };
+ MonoObject *ex = NULL;
+ MonoObject *ret = klass->get_method("GenCoreApiProject", 2)->invoke(NULL, args, &ex);
+
+ if (ex) {
+ mono_print_unhandled_exception(ex);
+ ERR_FAIL_V(String());
+ }
+
+ return ret ? GDMonoMarshal::mono_string_to_godot((MonoString *)ret) : "";
+}
+
+String generate_editor_api_project(const String &p_dir, const String &p_core_dll_path, const Vector<String> &p_files) {
+
+ _GDMONO_SCOPE_DOMAIN_(TOOLS_DOMAIN)
+
+ GDMonoClass *klass = GDMono::get_singleton()->get_editor_tools_assembly()->get_class("GodotSharpTools.Project", "ProjectGenerator");
+
+ Variant dir = p_dir;
+ Variant core_dll_path = p_core_dll_path;
+ Variant compile_items = p_files;
+ const Variant *args[3] = { &dir, &core_dll_path, &compile_items };
+ MonoObject *ex = NULL;
+ MonoObject *ret = klass->get_method("GenEditorApiProject", 3)->invoke(NULL, args, &ex);
+
+ if (ex) {
+ mono_print_unhandled_exception(ex);
+ ERR_FAIL_V(String());
+ }
+
+ return ret ? GDMonoMarshal::mono_string_to_godot((MonoString *)ret) : "";
+}
+
+String generate_game_project(const String &p_dir, const String &p_name, const Vector<String> &p_files) {
+
+ _GDMONO_SCOPE_DOMAIN_(TOOLS_DOMAIN)
+
+ GDMonoClass *klass = GDMono::get_singleton()->get_editor_tools_assembly()->get_class("GodotSharpTools.Project", "ProjectGenerator");
+
+ Variant dir = p_dir;
+ Variant name = p_name;
+ Variant compile_items = p_files;
+ const Variant *args[3] = { &dir, &name, &compile_items };
+ MonoObject *ex = NULL;
+ MonoObject *ret = klass->get_method("GenGameProject", 3)->invoke(NULL, args, &ex);
+
+ if (ex) {
+ mono_print_unhandled_exception(ex);
+ ERR_FAIL_V(String());
+ }
+
+ return ret ? GDMonoMarshal::mono_string_to_godot((MonoString *)ret) : "";
+}
+
+void add_item(const String &p_project_path, const String &p_item_type, const String &p_include) {
+
+ _GDMONO_SCOPE_DOMAIN_(TOOLS_DOMAIN)
+
+ GDMonoClass *klass = GDMono::get_singleton()->get_editor_tools_assembly()->get_class("GodotSharpTools.Project", "ProjectUtils");
+
+ Variant project_path = p_project_path;
+ Variant item_type = p_item_type;
+ Variant include = p_include;
+ const Variant *args[3] = { &project_path, &item_type, &include };
+ MonoObject *ex = NULL;
+ klass->get_method("AddItemToProjectChecked", 3)->invoke(NULL, args, &ex);
+
+ if (ex) {
+ mono_print_unhandled_exception(ex);
+ ERR_FAIL();
+ }
+}
+} // CSharpProject
diff --git a/modules/mono/editor/csharp_project.h b/modules/mono/editor/csharp_project.h
new file mode 100644
index 0000000000..4832d2251e
--- /dev/null
+++ b/modules/mono/editor/csharp_project.h
@@ -0,0 +1,44 @@
+/*************************************************************************/
+/* csharp_project.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef CSHARP_PROJECT_H
+#define CSHARP_PROJECT_H
+
+#include "ustring.h"
+
+namespace CSharpProject {
+
+String generate_core_api_project(const String &p_dir, const Vector<String> &p_files = Vector<String>());
+String generate_editor_api_project(const String &p_dir, const String &p_core_dll_path, const Vector<String> &p_files = Vector<String>());
+String generate_game_project(const String &p_dir, const String &p_name, const Vector<String> &p_files = Vector<String>());
+
+void add_item(const String &p_project_path, const String &p_item_type, const String &p_include);
+}
+
+#endif // CSHARP_PROJECT_H
diff --git a/modules/mono/editor/godotsharp_builds.cpp b/modules/mono/editor/godotsharp_builds.cpp
new file mode 100644
index 0000000000..1bad8a3f85
--- /dev/null
+++ b/modules/mono/editor/godotsharp_builds.cpp
@@ -0,0 +1,482 @@
+/*************************************************************************/
+/* godotsharp_builds.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "godotsharp_builds.h"
+
+#include "main/main.h"
+
+#include "../godotsharp_dirs.h"
+#include "../mono_gd/gd_mono_class.h"
+#include "../mono_gd/gd_mono_marshal.h"
+#include "../utils/path_utils.h"
+#include "bindings_generator.h"
+#include "godotsharp_editor.h"
+
+void godot_icall_BuildInstance_ExitCallback(MonoString *p_solution, MonoString *p_config, int p_exit_code) {
+
+ String solution = GDMonoMarshal::mono_string_to_godot(p_solution);
+ String config = GDMonoMarshal::mono_string_to_godot(p_config);
+ GodotSharpBuilds::get_singleton()->build_exit_callback(MonoBuildInfo(solution, config), p_exit_code);
+}
+
+#ifdef UNIX_ENABLED
+String _find_build_engine_on_unix(const String &p_name) {
+ String ret = path_which(p_name);
+
+ if (ret.length())
+ return ret;
+
+ const char *locations[] = {
+#ifdef OSX_ENABLED
+ "/Library/Frameworks/Mono.framework/Versions/Current/bin/",
+#endif
+ "/opt/novell/mono/bin/"
+ };
+
+ for (int i = 0; i < sizeof(locations) / sizeof(const char *); i++) {
+ String location = locations[i];
+
+ if (FileAccess::exists(location + p_name)) {
+ return location;
+ }
+ }
+
+ return String();
+}
+#endif
+
+MonoString *godot_icall_BuildInstance_get_MSBuildPath() {
+
+ GodotSharpBuilds::BuildTool build_tool = GodotSharpBuilds::BuildTool(int(EditorSettings::get_singleton()->get("mono/builds/build_tool")));
+
+#if defined(WINDOWS_ENABLED)
+ switch (build_tool) {
+ case GodotSharpBuilds::MSBUILD: {
+ static String msbuild_tools_path = MonoRegUtils::find_msbuild_tools_path();
+
+ if (msbuild_tools_path.length()) {
+ if (!msbuild_tools_path.ends_with("\\"))
+ msbuild_tools_path += "\\";
+
+ return GDMonoMarshal::mono_string_from_godot(msbuild_tools_path + "MSBuild.exe");
+ }
+
+ OS::get_singleton()->print("Cannot find System's MSBuild. Trying with Mono's...\n");
+ }
+ case GodotSharpBuilds::MSBUILD_MONO: {
+ String msbuild_path = GDMono::get_singleton()->get_mono_reg_info().bin_dir.plus_file("msbuild.bat");
+
+ if (!FileAccess::exists(msbuild_path)) {
+ WARN_PRINTS("Cannot find msbuild ('mono/builds/build_tool'). Tried with path: " + msbuild_path);
+ }
+
+ return GDMonoMarshal::mono_string_from_godot(msbuild_path);
+ }
+ case GodotSharpBuilds::XBUILD: {
+ String xbuild_path = GDMono::get_singleton()->get_mono_reg_info().bin_dir.plus_file("xbuild.bat");
+
+ if (!FileAccess::exists(xbuild_path)) {
+ WARN_PRINTS("Cannot find xbuild ('mono/builds/build_tool'). Tried with path: " + xbuild_path);
+ }
+
+ return GDMonoMarshal::mono_string_from_godot(xbuild_path);
+ }
+ default:
+ ERR_EXPLAIN("You don't deserve to live");
+ CRASH_NOW();
+ }
+#elif defined(UNIX_ENABLED)
+ static String msbuild_path = _find_build_engine_on_unix("msbuild");
+ static String xbuild_path = _find_build_engine_on_unix("xbuild");
+
+ if (build_tool != GodotSharpBuilds::XBUILD) {
+ if (msbuild_path.empty()) {
+ WARN_PRINT("Cannot find msbuild ('mono/builds/build_tool').");
+ return NULL;
+ }
+ } else {
+ if (xbuild_path.empty()) {
+ WARN_PRINT("Cannot find xbuild ('mono/builds/build_tool').");
+ return NULL;
+ }
+ }
+
+ return GDMonoMarshal::mono_string_from_godot(build_tool != GodotSharpBuilds::XBUILD ? msbuild_path : xbuild_path);
+#else
+ return NULL;
+#endif
+}
+
+void GodotSharpBuilds::_register_internal_calls() {
+
+ mono_add_internal_call("GodotSharpTools.Build.BuildSystem::godot_icall_BuildInstance_ExitCallback", (void *)godot_icall_BuildInstance_ExitCallback);
+ mono_add_internal_call("GodotSharpTools.Build.BuildInstance::godot_icall_BuildInstance_get_MSBuildPath", (void *)godot_icall_BuildInstance_get_MSBuildPath);
+}
+
+void GodotSharpBuilds::show_build_error_dialog(const String &p_message) {
+
+ GodotSharpEditor::get_singleton()->show_error_dialog(p_message, "Build error");
+ MonoBottomPanel::get_singleton()->show_build_tab();
+}
+
+bool GodotSharpBuilds::build_api_sln(const String &p_name, const String &p_api_sln_dir, const String &p_config) {
+
+ String api_sln_file = p_api_sln_dir.plus_file(p_name + ".sln");
+ String api_assembly_dir = p_api_sln_dir.plus_file("bin").plus_file(p_config);
+ String api_assembly_file = api_assembly_dir.plus_file(p_name + ".dll");
+
+ if (!FileAccess::exists(api_assembly_file)) {
+ MonoBuildInfo api_build_info(api_sln_file, p_config);
+ api_build_info.custom_props.push_back("NoWarn=1591"); // Ignore missing documentation warnings
+
+ if (!GodotSharpBuilds::get_singleton()->build(api_build_info)) {
+ show_build_error_dialog("Failed to build " + p_name + " solution.");
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool GodotSharpBuilds::copy_api_assembly(const String &p_src_dir, const String &p_dst_dir, const String &p_assembly_name) {
+
+ String assembly_file = p_assembly_name + ".dll";
+ String assembly_src = p_src_dir.plus_file(assembly_file);
+ String assembly_dst = p_dst_dir.plus_file(assembly_file);
+
+ if (!FileAccess::exists(assembly_dst) || FileAccess::get_modified_time(assembly_src) > FileAccess::get_modified_time(assembly_dst)) {
+ DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+
+ String xml_file = p_assembly_name + ".xml";
+ if (da->copy(p_src_dir.plus_file(xml_file), p_dst_dir.plus_file(xml_file)) != OK)
+ WARN_PRINTS("Failed to copy " + xml_file);
+
+ String pdb_file = p_assembly_name + ".pdb";
+ if (da->copy(p_src_dir.plus_file(pdb_file), p_dst_dir.plus_file(pdb_file)) != OK)
+ WARN_PRINTS("Failed to copy " + pdb_file);
+
+ Error err = da->copy(assembly_src, assembly_dst);
+
+ memdelete(da);
+
+ if (err != OK) {
+ show_build_error_dialog("Failed to copy " API_ASSEMBLY_NAME ".dll");
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool GodotSharpBuilds::make_api_sln(GodotSharpBuilds::APIType p_api_type) {
+
+ String api_name = p_api_type == API_CORE ? API_ASSEMBLY_NAME : EDITOR_API_ASSEMBLY_NAME;
+ String api_build_config = "Release";
+
+ EditorProgress pr("mono_build_release_" + api_name, "Building " + api_name + " solution...", 4);
+
+ pr.step("Generating " + api_name + " solution");
+
+ uint64_t core_hash = GDMono::get_singleton()->get_api_core_hash();
+ uint64_t editor_hash = GDMono::get_singleton()->get_api_editor_hash();
+
+ String core_api_sln_dir = GodotSharpDirs::get_mono_solutions_dir().plus_file(API_ASSEMBLY_NAME "_" + itos(core_hash));
+ String editor_api_sln_dir = GodotSharpDirs::get_mono_solutions_dir().plus_file(EDITOR_API_ASSEMBLY_NAME "_" + itos(editor_hash));
+
+ String api_sln_dir = p_api_type == API_CORE ? core_api_sln_dir : editor_api_sln_dir;
+ String api_sln_file = api_sln_dir.plus_file(api_name + ".sln");
+
+ if (!DirAccess::exists(api_sln_dir) || !FileAccess::exists(api_sln_file)) {
+ String core_api_assembly;
+
+ if (p_api_type == API_EDITOR) {
+ core_api_assembly = core_api_sln_dir.plus_file("bin")
+ .plus_file(api_build_config)
+ .plus_file(API_ASSEMBLY_NAME ".dll");
+ }
+
+#ifndef DEBUG_METHODS_ENABLED
+#error "How am I supposed to generate the bindings?"
+#endif
+
+ BindingsGenerator &gen = BindingsGenerator::get_singleton();
+ bool gen_verbose = OS::get_singleton()->is_stdout_verbose();
+
+ Error err = p_api_type == API_CORE ?
+ gen.generate_cs_core_project(api_sln_dir, gen_verbose) :
+ gen.generate_cs_editor_project(api_sln_dir, core_api_assembly, gen_verbose);
+
+ if (err != OK) {
+ show_build_error_dialog("Failed to generate " + api_name + " solution. Error: " + itos(err));
+ return false;
+ }
+ }
+
+ pr.step("Building " + api_name + " solution");
+
+ if (!GodotSharpBuilds::build_api_sln(api_name, api_sln_dir, api_build_config))
+ return false;
+
+ pr.step("Copying " + api_name + " assembly");
+
+ String res_assemblies_dir = GodotSharpDirs::get_res_assemblies_dir();
+
+ // Create assemblies directory if needed
+ if (!DirAccess::exists(res_assemblies_dir)) {
+ DirAccess *da = DirAccess::create_for_path(res_assemblies_dir);
+ Error err = da->make_dir_recursive(res_assemblies_dir);
+ memdelete(da);
+
+ if (err != OK) {
+ show_build_error_dialog("Failed to create assemblies directory. Error: " + itos(err));
+ return false;
+ }
+ }
+
+ // Copy the built assembly to the assemblies directory
+ String api_assembly_dir = api_sln_dir.plus_file("bin").plus_file(api_build_config);
+ if (!GodotSharpBuilds::copy_api_assembly(api_assembly_dir, res_assemblies_dir, api_name))
+ return false;
+
+ pr.step("Done");
+
+ return true;
+}
+
+bool godotsharp_build_callback() {
+
+ if (!FileAccess::exists(GodotSharpDirs::get_project_sln_path()))
+ return true; // No solution to build
+
+ if (!GodotSharpBuilds::make_api_sln(GodotSharpBuilds::API_CORE))
+ return false;
+
+ if (!GodotSharpBuilds::make_api_sln(GodotSharpBuilds::API_EDITOR))
+ return false;
+
+ EditorProgress pr("mono_project_debug_build", "Building project solution...", 2);
+
+ pr.step("Building project solution");
+
+ MonoBuildInfo build_info(GodotSharpDirs::get_project_sln_path(), "Tools");
+ if (!GodotSharpBuilds::get_singleton()->build(build_info)) {
+ GodotSharpBuilds::show_build_error_dialog("Failed to build project solution");
+ return false;
+ }
+
+ pr.step("Done");
+
+ return true;
+}
+
+GodotSharpBuilds *GodotSharpBuilds::singleton = NULL;
+
+void GodotSharpBuilds::build_exit_callback(const MonoBuildInfo &p_build_info, int p_exit_code) {
+
+ BuildProcess *match = builds.getptr(p_build_info);
+ ERR_FAIL_COND(!match);
+
+ BuildProcess &bp = *match;
+ bp.on_exit(p_exit_code);
+}
+
+void GodotSharpBuilds::restart_build(MonoBuildTab *p_build_tab) {
+}
+
+void GodotSharpBuilds::stop_build(MonoBuildTab *p_build_tab) {
+}
+
+bool GodotSharpBuilds::build(const MonoBuildInfo &p_build_info) {
+
+ BuildProcess *match = builds.getptr(p_build_info);
+
+ if (match) {
+ BuildProcess &bp = *match;
+ bp.start(true);
+ return bp.exit_code == 0;
+ } else {
+ BuildProcess bp = BuildProcess(p_build_info);
+ bp.start(true);
+ builds.set(p_build_info, bp);
+ return bp.exit_code == 0;
+ }
+}
+
+bool GodotSharpBuilds::build_async(const MonoBuildInfo &p_build_info, GodotSharpBuild_ExitCallback p_callback) {
+
+ BuildProcess *match = builds.getptr(p_build_info);
+
+ if (match) {
+ BuildProcess &bp = *match;
+ bp.start();
+ return !bp.exited; // failed to start
+ } else {
+ BuildProcess bp = BuildProcess(p_build_info, p_callback);
+ bp.start();
+ builds.set(p_build_info, bp);
+ return !bp.exited; // failed to start
+ }
+}
+
+GodotSharpBuilds::GodotSharpBuilds() {
+
+ singleton = this;
+
+ EditorNode::get_singleton()->add_build_callback(&godotsharp_build_callback);
+
+ // Build tool settings
+ EditorSettings *ed_settings = EditorSettings::get_singleton();
+ if (!ed_settings->has_setting("mono/builds/build_tool")) {
+ ed_settings->set_setting("mono/builds/build_tool", MSBUILD);
+ }
+ ed_settings->add_property_hint(PropertyInfo(Variant::INT, "mono/builds/build_tool", PROPERTY_HINT_ENUM, "MSBuild (System),MSBuild (Mono),xbuild"));
+}
+
+GodotSharpBuilds::~GodotSharpBuilds() {
+
+ singleton = NULL;
+}
+
+void GodotSharpBuilds::BuildProcess::on_exit(int p_exit_code) {
+
+ exited = true;
+ exit_code = p_exit_code;
+ build_tab->on_build_exit(p_exit_code == 0 ? MonoBuildTab::RESULT_SUCCESS : MonoBuildTab::RESULT_ERROR);
+ build_instance.unref();
+
+ if (exit_callback)
+ exit_callback(exit_code);
+}
+
+void GodotSharpBuilds::BuildProcess::start(bool p_blocking) {
+
+ _GDMONO_SCOPE_DOMAIN_(TOOLS_DOMAIN)
+
+ exit_code = -1;
+
+ String logs_dir = GodotSharpDirs::get_build_logs_dir().plus_file(build_info.solution.md5_text() + "_" + build_info.configuration);
+
+ if (build_tab) {
+ build_tab->on_build_start();
+ } else {
+ build_tab = memnew(MonoBuildTab(build_info, logs_dir));
+ MonoBottomPanel::get_singleton()->add_build_tab(build_tab);
+ }
+
+ if (p_blocking) {
+ // Required in order to update the build tasks list
+ Main::iteration();
+ }
+
+ if (!exited) {
+ ERR_PRINT("BuildProcess::start called, but process still running");
+ exited = true;
+ build_tab->on_build_exec_failed("!exited");
+ return;
+ }
+
+ exited = false;
+
+ // Remove old issues file
+
+ String issues_file = "msbuild_issues.csv";
+ DirAccessRef d = DirAccess::create_for_path(logs_dir);
+ if (d->file_exists(issues_file)) {
+ Error err = d->remove(issues_file);
+ if (err != OK) {
+ ERR_PRINTS("Cannot remove file: " + logs_dir.plus_file(issues_file));
+ exited = true;
+ build_tab->on_build_exec_failed("Cannot remove file: " + issues_file);
+ return;
+ }
+ }
+
+ GDMonoClass *klass = GDMono::get_singleton()->get_editor_tools_assembly()->get_class("GodotSharpTools.Build", "BuildInstance");
+
+ MonoObject *mono_object = mono_object_new(mono_domain_get(), klass->get_raw());
+
+ // Construct
+
+ Variant solution = build_info.solution;
+ Variant config = build_info.configuration;
+
+ const Variant *ctor_args[2] = { &solution, &config };
+
+ MonoObject *ex = NULL;
+ GDMonoMethod *ctor = klass->get_method(".ctor", 2);
+ ctor->invoke(mono_object, ctor_args, &ex);
+
+ if (ex) {
+ exited = true;
+ build_tab->on_build_exec_failed("The build constructor threw an exception.\n" + GDMonoUtils::get_exception_name_and_message(ex));
+ ERR_FAIL();
+ }
+
+ // Call Build
+
+ Variant logger_assembly = OS::get_singleton()->get_executable_path().get_base_dir().plus_file(EDITOR_TOOLS_ASSEMBLY_NAME) + ".dll";
+ Variant logger_output_dir = logs_dir;
+ Variant custom_props = build_info.custom_props;
+
+ const Variant *args[3] = { &logger_assembly, &logger_output_dir, &custom_props };
+
+ ex = NULL;
+ GDMonoMethod *build_method = klass->get_method(p_blocking ? "Build" : "BuildAsync", 3);
+ build_method->invoke(mono_object, args, &ex);
+
+ if (ex) {
+ exited = true;
+ build_tab->on_build_exec_failed("The build method threw an exception.\n" + GDMonoUtils::get_exception_name_and_message(ex));
+ ERR_FAIL();
+ }
+
+ // Build returned
+
+ if (p_blocking) {
+ exited = true;
+ exit_code = klass->get_field("exitCode")->get_int_value(mono_object);
+
+ if (exit_code != 0 && OS::get_singleton()->is_stdout_verbose())
+ OS::get_singleton()->print(String("MSBuild finished with exit code " + itos(exit_code) + "\n").utf8());
+
+ build_tab->on_build_exit(exit_code == 0 ? MonoBuildTab::RESULT_SUCCESS : MonoBuildTab::RESULT_ERROR);
+ } else {
+ build_instance = MonoGCHandle::create_strong(mono_object);
+ exited = false;
+ }
+}
+
+GodotSharpBuilds::BuildProcess::BuildProcess(const MonoBuildInfo &p_build_info, GodotSharpBuild_ExitCallback p_callback) {
+
+ build_info = p_build_info;
+ build_tab = NULL;
+ exit_callback = p_callback;
+ exited = true;
+ exit_code = -1;
+}
diff --git a/modules/mono/editor/godotsharp_builds.h b/modules/mono/editor/godotsharp_builds.h
new file mode 100644
index 0000000000..6d5fa3b44a
--- /dev/null
+++ b/modules/mono/editor/godotsharp_builds.h
@@ -0,0 +1,96 @@
+/*************************************************************************/
+/* godotsharp_builds.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef GODOTSHARP_BUILDS_H
+#define GODOTSHARP_BUILDS_H
+
+#include "mono_bottom_panel.h"
+#include "mono_build_info.h"
+
+typedef void (*GodotSharpBuild_ExitCallback)(int);
+
+class GodotSharpBuilds {
+
+private:
+ struct BuildProcess {
+ Ref<MonoGCHandle> build_instance;
+ MonoBuildInfo build_info;
+ MonoBuildTab *build_tab;
+ GodotSharpBuild_ExitCallback exit_callback;
+ bool exited;
+ int exit_code;
+
+ void on_exit(int p_exit_code);
+ void start(bool p_blocking = false);
+
+ BuildProcess() {}
+ BuildProcess(const MonoBuildInfo &p_build_info, GodotSharpBuild_ExitCallback p_callback = NULL);
+ };
+
+ HashMap<MonoBuildInfo, BuildProcess, MonoBuildInfo::Hasher> builds;
+
+ static GodotSharpBuilds *singleton;
+
+ friend class GDMono;
+ static void _register_internal_calls();
+
+public:
+ enum APIType {
+ API_CORE,
+ API_EDITOR
+ };
+
+ enum BuildTool {
+ MSBUILD,
+ MSBUILD_MONO,
+ XBUILD
+ };
+
+ _FORCE_INLINE_ static GodotSharpBuilds *get_singleton() { return singleton; }
+
+ static void show_build_error_dialog(const String &p_message);
+
+ void build_exit_callback(const MonoBuildInfo &p_build_info, int p_exit_code);
+
+ void restart_build(MonoBuildTab *p_build_tab);
+ void stop_build(MonoBuildTab *p_build_tab);
+
+ bool build(const MonoBuildInfo &p_build_info);
+ bool build_async(const MonoBuildInfo &p_build_info, GodotSharpBuild_ExitCallback p_callback = NULL);
+
+ static bool build_api_sln(const String &p_name, const String &p_api_sln_dir, const String &p_config);
+ static bool copy_api_assembly(const String &p_src_dir, const String &p_dst_dir, const String &p_assembly_name);
+
+ static bool make_api_sln(APIType p_api_type);
+
+ GodotSharpBuilds();
+ ~GodotSharpBuilds();
+};
+
+#endif // GODOTSHARP_BUILDS_H
diff --git a/modules/mono/editor/godotsharp_editor.cpp b/modules/mono/editor/godotsharp_editor.cpp
new file mode 100644
index 0000000000..30e7653256
--- /dev/null
+++ b/modules/mono/editor/godotsharp_editor.cpp
@@ -0,0 +1,256 @@
+/*************************************************************************/
+/* godotsharp_editor.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "godotsharp_editor.h"
+
+#include "core/os/os.h"
+#include "core/project_settings.h"
+#include "scene/gui/control.h"
+#include "scene/main/node.h"
+
+#include "../csharp_script.h"
+#include "../godotsharp_dirs.h"
+#include "../mono_gd/gd_mono.h"
+#include "../utils/path_utils.h"
+#include "bindings_generator.h"
+#include "csharp_project.h"
+#include "net_solution.h"
+
+#ifdef WINDOWS_ENABLED
+#include "../utils/mono_reg_utils.h"
+#endif
+
+class MonoReloadNode : public Node {
+ GDCLASS(MonoReloadNode, Node)
+
+protected:
+ void _notification(int p_what) {
+ switch (p_what) {
+ case MainLoop::NOTIFICATION_WM_FOCUS_IN: {
+ CSharpLanguage::get_singleton()->reload_assemblies_if_needed(true);
+ } break;
+ default: {
+ } break;
+ };
+ }
+};
+
+GodotSharpEditor *GodotSharpEditor::singleton = NULL;
+
+bool GodotSharpEditor::_create_project_solution() {
+
+ EditorProgress pr("create_csharp_solution", "Generating solution...", 2);
+
+ pr.step("Generating C# project...");
+
+ String path = OS::get_singleton()->get_resource_dir();
+ String name = ProjectSettings::get_singleton()->get("application/config/name");
+ String guid = CSharpProject::generate_game_project(path, name);
+
+ if (guid.length()) {
+
+ NETSolution solution(name);
+
+ if (!solution.set_path(path)) {
+ show_error_dialog("Failed to create solution.");
+ return false;
+ }
+
+ Vector<String> extra_configs;
+ extra_configs.push_back("Tools");
+
+ solution.add_new_project(name, guid, extra_configs);
+
+ Error sln_error = solution.save();
+
+ if (sln_error != OK) {
+ show_error_dialog("Failed to save solution.");
+ return false;
+ }
+
+ if (!GodotSharpBuilds::make_api_sln(GodotSharpBuilds::API_CORE))
+ return false;
+
+ if (!GodotSharpBuilds::make_api_sln(GodotSharpBuilds::API_EDITOR))
+ return false;
+
+ pr.step("Done");
+
+ // Here, after all calls to progress_task_step
+ call_deferred("_remove_create_sln_menu_option");
+
+ } else {
+ show_error_dialog("Failed to create C# project.");
+ }
+
+ return true;
+}
+
+void GodotSharpEditor::_remove_create_sln_menu_option() {
+
+ menu_popup->remove_item(menu_popup->get_item_index(MENU_CREATE_SLN));
+
+ if (menu_popup->get_item_count() == 0)
+ menu_button->hide();
+
+ bottom_panel_btn->show();
+}
+
+void GodotSharpEditor::_menu_option_pressed(int p_id) {
+
+ switch (p_id) {
+ case MENU_CREATE_SLN: {
+
+ _create_project_solution();
+ } break;
+ default:
+ ERR_FAIL();
+ }
+}
+
+void GodotSharpEditor::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_create_project_solution"), &GodotSharpEditor::_create_project_solution);
+ ClassDB::bind_method(D_METHOD("_remove_create_sln_menu_option"), &GodotSharpEditor::_remove_create_sln_menu_option);
+ ClassDB::bind_method(D_METHOD("_menu_option_pressed", "id"), &GodotSharpEditor::_menu_option_pressed);
+}
+
+void GodotSharpEditor::show_error_dialog(const String &p_message, const String &p_title) {
+
+ error_dialog->set_title(p_title);
+ error_dialog->set_text(p_message);
+ error_dialog->popup_centered_minsize();
+}
+
+Error GodotSharpEditor::open_in_external_editor(const Ref<Script> &p_script, int p_line, int p_col) {
+
+ ExternalEditor editor = ExternalEditor(int(EditorSettings::get_singleton()->get("mono/editor/external_editor")));
+
+ switch (editor) {
+ case EDITOR_CODE: {
+ List<String> args;
+ args.push_back(ProjectSettings::get_singleton()->get_resource_path());
+
+ String script_path = ProjectSettings::get_singleton()->globalize_path(p_script->get_path());
+
+ if (p_line >= 0) {
+ args.push_back("-g");
+ args.push_back(script_path + ":" + itos(p_line) + ":" + itos(p_col));
+ } else {
+ args.push_back(script_path);
+ }
+
+ static String program = path_which("code");
+
+ Error err = OS::get_singleton()->execute(program.length() ? program : "code", args, false);
+
+ if (err != OK) {
+ ERR_PRINT("GodotSharp: Could not execute external editor");
+ return err;
+ }
+ } break;
+ case EDITOR_MONODEVELOP: {
+ if (!monodevel_instance)
+ monodevel_instance = memnew(MonoDevelopInstance(GodotSharpDirs::get_project_sln_path()));
+
+ String script_path = ProjectSettings::get_singleton()->globalize_path(p_script->get_path());
+ monodevel_instance->execute(script_path);
+ } break;
+ case EDITOR_VISUAL_STUDIO:
+ // TODO
+ // devenv <PathToSolutionFolder>
+ // devenv /edit <PathToCsFile> /command "edit.goto <Line>"
+ // HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7
+ default:
+ return ERR_UNAVAILABLE;
+ }
+
+ return OK;
+}
+
+bool GodotSharpEditor::overrides_external_editor() {
+
+ return ExternalEditor(int(EditorSettings::get_singleton()->get("mono/editor/external_editor"))) != EDITOR_NONE;
+}
+
+GodotSharpEditor::GodotSharpEditor(EditorNode *p_editor) {
+
+ singleton = this;
+
+ monodevel_instance = NULL;
+
+ editor = p_editor;
+
+ error_dialog = memnew(AcceptDialog);
+ editor->get_gui_base()->add_child(error_dialog);
+
+ bottom_panel_btn = editor->add_bottom_panel_item("Mono", memnew(MonoBottomPanel(editor)));
+
+ godotsharp_builds = memnew(GodotSharpBuilds);
+
+ editor->add_child(memnew(MonoReloadNode));
+
+ menu_button = memnew(MenuButton);
+ menu_button->set_text("Mono");
+ menu_popup = menu_button->get_popup();
+
+ String sln_path = GodotSharpDirs::get_project_sln_path();
+ String csproj_path = GodotSharpDirs::get_project_csproj_path();
+
+ if (!FileAccess::exists(sln_path) || !FileAccess::exists(csproj_path)) {
+ bottom_panel_btn->hide();
+ menu_popup->add_item("Create C# solution", MENU_CREATE_SLN);
+ }
+
+ menu_popup->connect("id_pressed", this, "_menu_option_pressed");
+
+ if (menu_popup->get_item_count() == 0)
+ menu_button->hide();
+
+ editor->get_menu_hb()->add_child(menu_button);
+
+ // External editor settings
+ EditorSettings *ed_settings = EditorSettings::get_singleton();
+ if (!ed_settings->has_setting("mono/editor/external_editor")) {
+ ed_settings->set_setting("mono/editor/external_editor", EDITOR_NONE);
+ }
+ ed_settings->add_property_hint(PropertyInfo(Variant::INT, "mono/editor/external_editor", PROPERTY_HINT_ENUM, "None,MonoDevelop,Visual Studio,Visual Studio Code"));
+}
+
+GodotSharpEditor::~GodotSharpEditor() {
+
+ singleton = NULL;
+
+ memdelete(godotsharp_builds);
+
+ if (monodevel_instance) {
+ memdelete(monodevel_instance);
+ monodevel_instance = NULL;
+ }
+}
diff --git a/modules/mono/editor/godotsharp_editor.h b/modules/mono/editor/godotsharp_editor.h
new file mode 100644
index 0000000000..1ecb8c7a94
--- /dev/null
+++ b/modules/mono/editor/godotsharp_editor.h
@@ -0,0 +1,87 @@
+/*************************************************************************/
+/* godotsharp_editor.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef GODOTSHARP_EDITOR_H
+#define GODOTSHARP_EDITOR_H
+
+#include "godotsharp_builds.h"
+
+#include "monodevelop_instance.h"
+
+class GodotSharpEditor : public Node {
+ GDCLASS(GodotSharpEditor, Object)
+
+ EditorNode *editor;
+
+ MenuButton *menu_button;
+ PopupMenu *menu_popup;
+
+ AcceptDialog *error_dialog;
+
+ ToolButton *bottom_panel_btn;
+
+ GodotSharpBuilds *godotsharp_builds;
+
+ MonoDevelopInstance *monodevel_instance;
+
+ bool _create_project_solution();
+
+ void _remove_create_sln_menu_option();
+
+ void _menu_option_pressed(int p_id);
+
+ static GodotSharpEditor *singleton;
+
+protected:
+ static void _bind_methods();
+
+public:
+ enum MenuOptions {
+ MENU_CREATE_SLN
+ };
+
+ enum ExternalEditor {
+ EDITOR_NONE,
+ EDITOR_MONODEVELOP,
+ EDITOR_VISUAL_STUDIO,
+ EDITOR_CODE,
+ };
+
+ _FORCE_INLINE_ static GodotSharpEditor *get_singleton() { return singleton; }
+
+ void show_error_dialog(const String &p_message, const String &p_title = "Error");
+
+ Error open_in_external_editor(const Ref<Script> &p_script, int p_line, int p_col);
+ bool overrides_external_editor();
+
+ GodotSharpEditor(EditorNode *p_editor);
+ ~GodotSharpEditor();
+};
+
+#endif // GODOTSHARP_EDITOR_H
diff --git a/modules/mono/editor/mono_bottom_panel.cpp b/modules/mono/editor/mono_bottom_panel.cpp
new file mode 100644
index 0000000000..07109eaac7
--- /dev/null
+++ b/modules/mono/editor/mono_bottom_panel.cpp
@@ -0,0 +1,441 @@
+/*************************************************************************/
+/* mono_bottom_panel.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "mono_bottom_panel.h"
+
+#include "../csharp_script.h"
+#include "godotsharp_editor.h"
+
+MonoBottomPanel *MonoBottomPanel::singleton = NULL;
+
+void MonoBottomPanel::_update_build_tabs_list() {
+
+ build_tabs_list->clear();
+
+ int current_tab = build_tabs->get_current_tab();
+
+ bool no_current_tab = current_tab < 0 || current_tab >= build_tabs->get_tab_count();
+
+ for (int i = 0; i < build_tabs->get_child_count(); i++) {
+
+ MonoBuildTab *tab = Object::cast_to<MonoBuildTab>(build_tabs->get_child(i));
+
+ if (tab) {
+ String item_name = tab->build_info.solution.get_file().get_basename();
+ item_name += " [" + tab->build_info.configuration + "]";
+
+ build_tabs_list->add_item(item_name, tab->get_icon_texture());
+
+ String item_tooltip = String("Solution: ") + tab->build_info.solution;
+ item_tooltip += String("\nConfiguration: ") + tab->build_info.configuration;
+ item_tooltip += String("\nStatus: ");
+
+ if (tab->build_exited) {
+ item_tooltip += tab->build_result == MonoBuildTab::RESULT_SUCCESS ? "Succeeded" : "Errored";
+ } else {
+ item_tooltip += "Running";
+ }
+
+ if (!tab->build_exited || !tab->build_result == MonoBuildTab::RESULT_SUCCESS) {
+ item_tooltip += "\nErrors: " + itos(tab->error_count);
+ }
+
+ item_tooltip += "\nWarnings: " + itos(tab->warning_count);
+
+ build_tabs_list->set_item_tooltip(i, item_tooltip);
+
+ if (no_current_tab || current_tab == i) {
+ build_tabs_list->select(i);
+ _build_tab_item_selected(i);
+ }
+ }
+ }
+}
+
+void MonoBottomPanel::add_build_tab(MonoBuildTab *p_build_tab) {
+
+ build_tabs->add_child(p_build_tab);
+ raise_build_tab(p_build_tab);
+}
+
+void MonoBottomPanel::raise_build_tab(MonoBuildTab *p_build_tab) {
+
+ ERR_FAIL_COND(p_build_tab->get_parent() != build_tabs);
+ build_tabs->move_child(p_build_tab, 0);
+ _update_build_tabs_list();
+}
+
+void MonoBottomPanel::show_build_tab() {
+
+ for (int i = 0; i < panel_tabs->get_tab_count(); i++) {
+ if (panel_tabs->get_tab_control(i) == panel_builds_tab) {
+ panel_tabs->set_current_tab(i);
+ editor->make_bottom_panel_item_visible(this);
+ return;
+ }
+ }
+
+ ERR_PRINT("Builds tab not found");
+}
+
+void MonoBottomPanel::_build_tab_item_selected(int p_idx) {
+
+ ERR_FAIL_INDEX(p_idx, build_tabs->get_tab_count());
+ build_tabs->set_current_tab(p_idx);
+}
+
+void MonoBottomPanel::_build_tab_changed(int p_idx) {
+
+ if (p_idx < 0 || p_idx >= build_tabs->get_tab_count()) {
+ warnings_btn->set_visible(false);
+ errors_btn->set_visible(false);
+ } else {
+ warnings_btn->set_visible(true);
+ errors_btn->set_visible(true);
+ }
+}
+
+void MonoBottomPanel::_warnings_toggled(bool p_pressed) {
+
+ int current_tab = build_tabs->get_current_tab();
+ ERR_FAIL_INDEX(current_tab, build_tabs->get_tab_count());
+ MonoBuildTab *build_tab = Object::cast_to<MonoBuildTab>(build_tabs->get_child(current_tab));
+ build_tab->warnings_visible = p_pressed;
+ build_tab->_update_issues_list();
+}
+
+void MonoBottomPanel::_errors_toggled(bool p_pressed) {
+
+ int current_tab = build_tabs->get_current_tab();
+ ERR_FAIL_INDEX(current_tab, build_tabs->get_tab_count());
+ MonoBuildTab *build_tab = Object::cast_to<MonoBuildTab>(build_tabs->get_child(current_tab));
+ build_tab->errors_visible = p_pressed;
+ build_tab->_update_issues_list();
+}
+
+void MonoBottomPanel::_notification(int p_what) {
+
+ switch (p_what) {
+
+ case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
+ panel_tabs->add_style_override("panel", editor->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles"));
+ panel_tabs->add_style_override("tab_fg", editor->get_gui_base()->get_stylebox("DebuggerTabFG", "EditorStyles"));
+ panel_tabs->add_style_override("tab_bg", editor->get_gui_base()->get_stylebox("DebuggerTabBG", "EditorStyles"));
+ } break;
+ }
+}
+
+void MonoBottomPanel::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_warnings_toggled", "pressed"), &MonoBottomPanel::_warnings_toggled);
+ ClassDB::bind_method(D_METHOD("_errors_toggled", "pressed"), &MonoBottomPanel::_errors_toggled);
+ ClassDB::bind_method(D_METHOD("_build_tab_item_selected", "idx"), &MonoBottomPanel::_build_tab_item_selected);
+ ClassDB::bind_method(D_METHOD("_build_tab_changed", "idx"), &MonoBottomPanel::_build_tab_changed);
+}
+
+MonoBottomPanel::MonoBottomPanel(EditorNode *p_editor) {
+
+ singleton = this;
+
+ editor = p_editor;
+
+ set_v_size_flags(SIZE_EXPAND_FILL);
+ set_anchors_and_margins_preset(Control::PRESET_WIDE);
+
+ panel_tabs = memnew(TabContainer);
+ panel_tabs->set_tab_align(TabContainer::ALIGN_LEFT);
+ panel_tabs->add_style_override("panel", editor->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles"));
+ panel_tabs->add_style_override("tab_fg", editor->get_gui_base()->get_stylebox("DebuggerTabFG", "EditorStyles"));
+ panel_tabs->add_style_override("tab_bg", editor->get_gui_base()->get_stylebox("DebuggerTabBG", "EditorStyles"));
+ panel_tabs->set_custom_minimum_size(Size2(0, 228) * EDSCALE);
+ panel_tabs->set_v_size_flags(SIZE_EXPAND_FILL);
+ add_child(panel_tabs);
+
+ { // Builds
+ panel_builds_tab = memnew(VBoxContainer);
+ panel_builds_tab->set_name(TTR("Builds"));
+ panel_builds_tab->set_h_size_flags(SIZE_EXPAND_FILL);
+ panel_tabs->add_child(panel_builds_tab);
+
+ HBoxContainer *toolbar_hbc = memnew(HBoxContainer);
+ toolbar_hbc->set_h_size_flags(SIZE_EXPAND_FILL);
+ panel_builds_tab->add_child(toolbar_hbc);
+
+ toolbar_hbc->add_spacer();
+
+ warnings_btn = memnew(ToolButton);
+ warnings_btn->set_text("Warnings");
+ warnings_btn->set_toggle_mode(true);
+ warnings_btn->set_pressed(true);
+ warnings_btn->set_visible(false);
+ warnings_btn->set_focus_mode(FOCUS_NONE);
+ warnings_btn->connect("toggled", this, "_warnings_toggled");
+ toolbar_hbc->add_child(warnings_btn);
+
+ errors_btn = memnew(ToolButton);
+ errors_btn->set_text("Errors");
+ errors_btn->set_toggle_mode(true);
+ errors_btn->set_pressed(true);
+ errors_btn->set_visible(false);
+ errors_btn->set_focus_mode(FOCUS_NONE);
+ errors_btn->connect("toggled", this, "_errors_toggled");
+ toolbar_hbc->add_child(errors_btn);
+
+ HSplitContainer *hsc = memnew(HSplitContainer);
+ hsc->set_h_size_flags(SIZE_EXPAND_FILL);
+ hsc->set_v_size_flags(SIZE_EXPAND_FILL);
+ panel_builds_tab->add_child(hsc);
+
+ build_tabs_list = memnew(ItemList);
+ build_tabs_list->set_h_size_flags(SIZE_EXPAND_FILL);
+ build_tabs_list->connect("item_selected", this, "_build_tab_item_selected");
+ hsc->add_child(build_tabs_list);
+
+ build_tabs = memnew(TabContainer);
+ build_tabs->set_tab_align(TabContainer::ALIGN_LEFT);
+ build_tabs->set_h_size_flags(SIZE_EXPAND_FILL);
+ build_tabs->set_tabs_visible(false);
+ build_tabs->connect("tab_changed", this, "_build_tab_changed");
+ hsc->add_child(build_tabs);
+ }
+}
+
+MonoBottomPanel::~MonoBottomPanel() {
+
+ singleton = NULL;
+}
+
+void MonoBuildTab::_load_issues_from_file(const String &p_csv_file) {
+
+ FileAccessRef f = FileAccess::open(p_csv_file, FileAccess::READ);
+
+ if (!f)
+ return;
+
+ while (!f->eof_reached()) {
+ Vector<String> csv_line = f->get_csv_line();
+
+ if (csv_line.size() == 1 && csv_line[0].empty())
+ return;
+
+ ERR_CONTINUE(csv_line.size() != 7);
+
+ BuildIssue issue;
+ issue.warning = csv_line[0] == "warning";
+ issue.file = csv_line[1];
+ issue.line = csv_line[2].to_int();
+ issue.column = csv_line[3].to_int();
+ issue.code = csv_line[4];
+ issue.message = csv_line[5];
+ issue.project_file = csv_line[6];
+
+ if (issue.warning)
+ warning_count += 1;
+ else
+ error_count += 1;
+
+ issues.push_back(issue);
+ }
+}
+
+void MonoBuildTab::_update_issues_list() {
+
+ issues_list->clear();
+
+ Ref<Texture> warning_icon = get_icon("Warning", "EditorIcons");
+ Ref<Texture> error_icon = get_icon("Error", "EditorIcons");
+
+ for (int i = 0; i < issues.size(); i++) {
+
+ const BuildIssue &issue = issues[i];
+
+ if (!(issue.warning ? warnings_visible : errors_visible))
+ continue;
+
+ String tooltip;
+ tooltip += String("Message: ") + issue.message;
+ tooltip += String("\nCode: ") + issue.code;
+ tooltip += String("\nType: ") + (issue.warning ? "warning" : "error");
+
+ String text;
+
+ if (issue.file.length()) {
+ String sline = String::num_int64(issue.line);
+ String scolumn = String::num_int64(issue.column);
+
+ text += issue.file + "(";
+ text += sline + ",";
+ text += scolumn + "): ";
+
+ tooltip += "\nFile: " + issue.file;
+ tooltip += "\nLine: " + sline;
+ tooltip += "\nColumn: " + scolumn;
+ }
+
+ if (issue.project_file.length()) {
+ tooltip += "\nProject: " + issue.project_file;
+ }
+
+ text += issue.message;
+
+ int line_break_idx = text.find("\n");
+ issues_list->add_item(line_break_idx == -1 ? text : text.substr(0, line_break_idx),
+ issue.warning ? warning_icon : error_icon);
+ int index = issues_list->get_item_count() - 1;
+ issues_list->set_item_tooltip(index, tooltip);
+ issues_list->set_item_metadata(index, i);
+ }
+}
+
+Ref<Texture> MonoBuildTab::get_icon_texture() const {
+
+ // FIXME these icons were removed... find something better
+
+ if (build_exited) {
+ if (build_result == RESULT_ERROR) {
+ return get_icon("DependencyChangedHl", "EditorIcons");
+ } else {
+ return get_icon("DependencyOkHl", "EditorIcons");
+ }
+ } else {
+ return get_icon("GraphTime", "EditorIcons");
+ }
+}
+
+MonoBuildInfo MonoBuildTab::get_build_info() {
+
+ return build_info;
+}
+
+void MonoBuildTab::on_build_start() {
+
+ build_exited = false;
+
+ issues.clear();
+ warning_count = 0;
+ error_count = 0;
+ _update_issues_list();
+
+ MonoBottomPanel::get_singleton()->raise_build_tab(this);
+}
+
+void MonoBuildTab::on_build_exit(BuildResult result) {
+
+ build_exited = true;
+ build_result = result;
+
+ _load_issues_from_file(logs_dir.plus_file("msbuild_issues.csv"));
+ _update_issues_list();
+
+ MonoBottomPanel::get_singleton()->raise_build_tab(this);
+}
+
+void MonoBuildTab::on_build_exec_failed(const String &p_cause, const String &p_detailed) {
+
+ build_exited = true;
+ build_result = RESULT_ERROR;
+
+ issues_list->clear();
+
+ String tooltip;
+
+ tooltip += "Message: " + (p_detailed.length() ? p_detailed : p_cause);
+ tooltip += "\nType: error";
+
+ int line_break_idx = p_cause.find("\n");
+ issues_list->add_item(line_break_idx == -1 ? p_cause : p_cause.substr(0, line_break_idx),
+ get_icon("Error", "EditorIcons"));
+ int index = issues_list->get_item_count() - 1;
+ issues_list->set_item_tooltip(index, tooltip);
+
+ MonoBottomPanel::get_singleton()->raise_build_tab(this);
+}
+
+void MonoBuildTab::restart_build() {
+
+ ERR_FAIL_COND(!build_exited);
+ GodotSharpBuilds::get_singleton()->restart_build(this);
+}
+
+void MonoBuildTab::stop_build() {
+
+ ERR_FAIL_COND(build_exited);
+ GodotSharpBuilds::get_singleton()->stop_build(this);
+}
+
+void MonoBuildTab::_issue_activated(int p_idx) {
+
+ ERR_FAIL_INDEX(p_idx, issues.size());
+
+ const BuildIssue &issue = issues[p_idx];
+
+ if (issue.project_file.empty() && issue.file.empty())
+ return;
+
+ String project_dir = issue.project_file.length() ? issue.project_file.get_base_dir() : build_info.solution.get_base_dir();
+
+ String file = project_dir.simplify_path().plus_file(issue.file.simplify_path());
+
+ if (!FileAccess::exists(file))
+ return;
+
+ file = ProjectSettings::get_singleton()->localize_path(file);
+
+ if (file.begins_with("res://")) {
+ Ref<Script> script = ResourceLoader::load(file, CSharpLanguage::get_singleton()->get_type());
+
+ if (script.is_valid() && ScriptEditor::get_singleton()->edit(script, issue.line, issue.column)) {
+ EditorNode::get_singleton()->call("_editor_select", EditorNode::EDITOR_SCRIPT);
+ }
+ }
+}
+
+void MonoBuildTab::_bind_methods() {
+
+ ClassDB::bind_method("_issue_activated", &MonoBuildTab::_issue_activated);
+}
+
+MonoBuildTab::MonoBuildTab(const MonoBuildInfo &p_build_info, const String &p_logs_dir) {
+
+ build_info = p_build_info;
+ logs_dir = p_logs_dir;
+
+ build_exited = false;
+
+ issues_list = memnew(ItemList);
+ issues_list->set_v_size_flags(SIZE_EXPAND_FILL);
+ issues_list->connect("item_activated", this, "_issue_activated");
+ add_child(issues_list);
+
+ error_count = 0;
+ warning_count = 0;
+
+ errors_visible = true;
+ warnings_visible = true;
+}
diff --git a/modules/mono/editor/mono_bottom_panel.h b/modules/mono/editor/mono_bottom_panel.h
new file mode 100644
index 0000000000..909fa4b385
--- /dev/null
+++ b/modules/mono/editor/mono_bottom_panel.h
@@ -0,0 +1,145 @@
+/*************************************************************************/
+/* mono_bottom_panel.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef MONO_BOTTOM_PANEL_H
+#define MONO_BOTTOM_PANEL_H
+
+#include "editor/editor_node.h"
+#include "scene/gui/control.h"
+
+#include "mono_build_info.h"
+
+class MonoBuildTab;
+
+class MonoBottomPanel : public VBoxContainer {
+
+ GDCLASS(MonoBottomPanel, VBoxContainer)
+
+ EditorNode *editor;
+
+ TabContainer *panel_tabs;
+
+ VBoxContainer *panel_builds_tab;
+
+ ItemList *build_tabs_list;
+ TabContainer *build_tabs;
+
+ Button *warnings_btn;
+ Button *errors_btn;
+
+ void _update_build_tabs_list();
+
+ void _build_tab_item_selected(int p_idx);
+ void _build_tab_changed(int p_idx);
+
+ void _warnings_toggled(bool p_pressed);
+ void _errors_toggled(bool p_pressed);
+
+ static MonoBottomPanel *singleton;
+
+protected:
+ void _notification(int p_what);
+
+ static void _bind_methods();
+
+public:
+ _FORCE_INLINE_ static MonoBottomPanel *get_singleton() { return singleton; }
+
+ void add_build_tab(MonoBuildTab *p_build_tab);
+ void raise_build_tab(MonoBuildTab *p_build_tab);
+
+ void show_build_tab();
+
+ MonoBottomPanel(EditorNode *p_editor = NULL);
+ ~MonoBottomPanel();
+};
+
+class MonoBuildTab : public VBoxContainer {
+
+ GDCLASS(MonoBuildTab, VBoxContainer)
+
+public:
+ enum BuildResult {
+ RESULT_ERROR,
+ RESULT_SUCCESS
+ };
+
+ struct BuildIssue {
+ bool warning;
+ String file;
+ int line;
+ int column;
+ String code;
+ String message;
+ String project_file;
+ };
+
+private:
+ friend class MonoBottomPanel;
+
+ bool build_exited;
+ BuildResult build_result;
+
+ Vector<BuildIssue> issues;
+ ItemList *issues_list;
+
+ int error_count;
+ int warning_count;
+
+ bool errors_visible;
+ bool warnings_visible;
+
+ String logs_dir;
+
+ MonoBuildInfo build_info;
+
+ void _load_issues_from_file(const String &p_csv_file);
+ void _update_issues_list();
+
+ void _issue_activated(int p_idx);
+
+protected:
+ static void _bind_methods();
+
+public:
+ Ref<Texture> get_icon_texture() const;
+
+ MonoBuildInfo get_build_info();
+
+ void on_build_start();
+ void on_build_exit(BuildResult result);
+ void on_build_exec_failed(const String &p_cause, const String &p_detailed = String());
+
+ void restart_build();
+ void stop_build();
+
+ MonoBuildTab(const MonoBuildInfo &p_build_info, const String &p_logs_dir);
+};
+
+#endif // MONO_BOTTOM_PANEL_H
diff --git a/modules/mono/editor/mono_build_info.h b/modules/mono/editor/mono_build_info.h
new file mode 100644
index 0000000000..f3b3e43b6d
--- /dev/null
+++ b/modules/mono/editor/mono_build_info.h
@@ -0,0 +1,64 @@
+/*************************************************************************/
+/* mono_build_info.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef MONO_BUILD_INFO_H
+#define MONO_BUILD_INFO_H
+
+#include "../mono_gd/gd_mono_utils.h"
+
+struct MonoBuildInfo {
+
+ struct Hasher {
+ static _FORCE_INLINE_ uint32_t hash(const MonoBuildInfo &p_key) {
+ uint32_t hash = 0;
+
+ GDMonoUtils::hash_combine(hash, p_key.solution.hash());
+ GDMonoUtils::hash_combine(hash, p_key.configuration.hash());
+
+ return hash;
+ }
+ };
+
+ String solution;
+ String configuration;
+ Vector<String> custom_props;
+
+ MonoBuildInfo() {}
+
+ MonoBuildInfo(const String &p_solution, const String &p_config) {
+ solution = p_solution;
+ configuration = p_config;
+ }
+
+ bool operator==(const MonoBuildInfo &p_b) const {
+ return p_b.solution == solution && p_b.configuration == configuration;
+ }
+};
+
+#endif // MONO_BUILD_INFO_H
diff --git a/modules/mono/editor/monodevelop_instance.cpp b/modules/mono/editor/monodevelop_instance.cpp
new file mode 100644
index 0000000000..a34d82ffcb
--- /dev/null
+++ b/modules/mono/editor/monodevelop_instance.cpp
@@ -0,0 +1,81 @@
+/*************************************************************************/
+/* monodevelop_instance.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "monodevelop_instance.h"
+
+#include "../mono_gd/gd_mono.h"
+#include "../mono_gd/gd_mono_class.h"
+
+void MonoDevelopInstance::execute(const Vector<String> &p_files) {
+
+ ERR_FAIL_NULL(execute_method);
+ ERR_FAIL_COND(gc_handle.is_null());
+
+ MonoObject *ex = NULL;
+
+ Variant files = p_files;
+ const Variant *args[1] = { &files };
+ execute_method->invoke(gc_handle->get_target(), args, &ex);
+
+ if (ex) {
+ mono_print_unhandled_exception(ex);
+ ERR_FAIL();
+ }
+}
+
+void MonoDevelopInstance::execute(const String &p_file) {
+
+ Vector<String> files;
+ files.push_back(p_file);
+ execute(files);
+}
+
+MonoDevelopInstance::MonoDevelopInstance(const String &p_solution) {
+
+ _GDMONO_SCOPE_DOMAIN_(TOOLS_DOMAIN)
+
+ GDMonoClass *klass = GDMono::get_singleton()->get_editor_tools_assembly()->get_class("GodotSharpTools.Editor", "MonoDevelopInstance");
+
+ MonoObject *obj = mono_object_new(TOOLS_DOMAIN, klass->get_raw());
+
+ GDMonoMethod *ctor = klass->get_method(".ctor", 1);
+ MonoObject *ex = NULL;
+
+ Variant solution = p_solution;
+ const Variant *args[1] = { &solution };
+ ctor->invoke(obj, args, &ex);
+
+ if (ex) {
+ mono_print_unhandled_exception(ex);
+ ERR_FAIL();
+ }
+
+ gc_handle = MonoGCHandle::create_strong(obj);
+ execute_method = klass->get_method("Execute", 1);
+}
diff --git a/modules/mono/editor/monodevelop_instance.h b/modules/mono/editor/monodevelop_instance.h
new file mode 100644
index 0000000000..9eb154eba1
--- /dev/null
+++ b/modules/mono/editor/monodevelop_instance.h
@@ -0,0 +1,50 @@
+/*************************************************************************/
+/* monodevelop_instance.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef MONODEVELOP_INSTANCE_H
+#define MONODEVELOP_INSTANCE_H
+
+#include "reference.h"
+
+#include "../mono_gc_handle.h"
+#include "../mono_gd/gd_mono_method.h"
+
+class MonoDevelopInstance {
+
+ Ref<MonoGCHandle> gc_handle;
+ GDMonoMethod *execute_method;
+
+public:
+ void execute(const Vector<String> &p_files);
+ void execute(const String &p_files);
+
+ MonoDevelopInstance(const String &p_solution);
+};
+
+#endif // MONODEVELOP_INSTANCE_H
diff --git a/modules/mono/editor/net_solution.cpp b/modules/mono/editor/net_solution.cpp
new file mode 100644
index 0000000000..fa60c310db
--- /dev/null
+++ b/modules/mono/editor/net_solution.cpp
@@ -0,0 +1,130 @@
+/*************************************************************************/
+/* net_solution.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "net_solution.h"
+
+#include "os/dir_access.h"
+#include "os/file_access.h"
+
+#include "../utils/path_utils.h"
+#include "../utils/string_utils.h"
+#include "csharp_project.h"
+
+#define SOLUTION_TEMPLATE \
+ "Microsoft Visual Studio Solution File, Format Version 12.00\n" \
+ "# Visual Studio 2012\n" \
+ "%0\n" \
+ "Global\n" \
+ "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n" \
+ "%1\n" \
+ "\tEndGlobalSection\n" \
+ "\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n" \
+ "%2\n" \
+ "\tEndGlobalSection\n" \
+ "EndGlobal\n"
+
+#define PROJECT_DECLARATION "Project(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"%0\", \"%1\", \"{%2}\"\nEndProject"
+
+#define SOLUTION_PLATFORMS_CONFIG "\t\%0|Any CPU = %0|Any CPU"
+
+#define PROJECT_PLATFORMS_CONFIG \
+ "\t\t{%0}.%1|Any CPU.ActiveCfg = %1|Any CPU\n" \
+ "\t\t{%0}.%1|Any CPU.Build.0 = %1|Any CPU"
+
+void NETSolution::add_new_project(const String &p_name, const String &p_guid, const Vector<String> &p_extra_configs) {
+ if (projects.has(p_name))
+ WARN_PRINT("Overriding existing project.");
+
+ ProjectInfo procinfo;
+ procinfo.guid = p_guid;
+
+ procinfo.configs.push_back("Debug");
+ procinfo.configs.push_back("Release");
+
+ for (int i = 0; i < p_extra_configs.size(); i++) {
+ procinfo.configs.push_back(p_extra_configs[i]);
+ }
+
+ projects[p_name] = procinfo;
+}
+
+Error NETSolution::save() {
+ bool dir_exists = DirAccess::exists(path);
+ ERR_EXPLAIN("The directory does not exist.");
+ ERR_FAIL_COND_V(!dir_exists, ERR_FILE_BAD_PATH);
+
+ String projs_decl;
+ String sln_platform_cfg;
+ String proj_platform_cfg;
+
+ for (Map<String, ProjectInfo>::Element *E = projects.front(); E; E = E->next()) {
+ const String &name = E->key();
+ const ProjectInfo &procinfo = E->value();
+
+ projs_decl += sformat(PROJECT_DECLARATION, name, name + ".csproj", procinfo.guid);
+
+ for (int i = 0; i < procinfo.configs.size(); i++) {
+ const String &config = procinfo.configs[i];
+
+ if (i != 0) {
+ sln_platform_cfg += "\n";
+ proj_platform_cfg += "\n";
+ }
+
+ sln_platform_cfg += sformat(SOLUTION_PLATFORMS_CONFIG, config);
+ proj_platform_cfg += sformat(PROJECT_PLATFORMS_CONFIG, procinfo.guid, config);
+ }
+ }
+
+ String content = sformat(SOLUTION_TEMPLATE, projs_decl, sln_platform_cfg, proj_platform_cfg);
+
+ FileAccessRef file = FileAccess::open(path_join(path, name + ".sln"), FileAccess::WRITE);
+ ERR_FAIL_COND_V(!file, ERR_FILE_CANT_WRITE);
+ file->store_string(content);
+ file->close();
+
+ return OK;
+}
+
+bool NETSolution::set_path(const String &p_existing_path) {
+ if (p_existing_path.is_abs_path()) {
+ path = p_existing_path;
+ } else {
+ String abspath;
+ if (!rel_path_to_abs(p_existing_path, abspath))
+ return false;
+ path = abspath;
+ }
+
+ return true;
+}
+
+NETSolution::NETSolution(const String &p_name) {
+ name = p_name;
+}
diff --git a/modules/mono/editor/net_solution.h b/modules/mono/editor/net_solution.h
new file mode 100644
index 0000000000..d7ccebb7df
--- /dev/null
+++ b/modules/mono/editor/net_solution.h
@@ -0,0 +1,57 @@
+/*************************************************************************/
+/* net_solution.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef NET_SOLUTION_H
+#define NET_SOLUTION_H
+
+#include "map.h"
+#include "ustring.h"
+
+struct NETSolution {
+ String name;
+
+ void add_new_project(const String &p_name, const String &p_guid, const Vector<String> &p_extra_configs = Vector<String>());
+
+ Error save();
+
+ bool set_path(const String &p_existing_path);
+
+ NETSolution(const String &p_name);
+
+private:
+ struct ProjectInfo {
+ String guid;
+ Vector<String> configs;
+ };
+
+ String path;
+ Map<String, ProjectInfo> projects;
+};
+
+#endif // NET_SOLUTION_H
diff --git a/modules/mono/glue/cs_files/Basis.cs b/modules/mono/glue/cs_files/Basis.cs
new file mode 100644
index 0000000000..c50e783349
--- /dev/null
+++ b/modules/mono/glue/cs_files/Basis.cs
@@ -0,0 +1,520 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace Godot
+{
+ [StructLayout(LayoutKind.Sequential)]
+ public struct Basis : IEquatable<Basis>
+ {
+ private static readonly Basis identity = new Basis
+ (
+ new Vector3(1f, 0f, 0f),
+ new Vector3(0f, 1f, 0f),
+ new Vector3(0f, 0f, 1f)
+ );
+
+ private static readonly Basis[] orthoBases = new Basis[24]
+ {
+ new Basis(1f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 1f),
+ new Basis(0f, -1f, 0f, 1f, 0f, 0f, 0f, 0f, 1f),
+ new Basis(-1f, 0f, 0f, 0f, -1f, 0f, 0f, 0f, 1f),
+ new Basis(0f, 1f, 0f, -1f, 0f, 0f, 0f, 0f, 1f),
+ new Basis(1f, 0f, 0f, 0f, 0f, -1f, 0f, 1f, 0f),
+ new Basis(0f, 0f, 1f, 1f, 0f, 0f, 0f, 1f, 0f),
+ new Basis(-1f, 0f, 0f, 0f, 0f, 1f, 0f, 1f, 0f),
+ new Basis(0f, 0f, -1f, -1f, 0f, 0f, 0f, 1f, 0f),
+ new Basis(1f, 0f, 0f, 0f, -1f, 0f, 0f, 0f, -1f),
+ new Basis(0f, 1f, 0f, 1f, 0f, 0f, 0f, 0f, -1f),
+ new Basis(-1f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, -1f),
+ new Basis(0f, -1f, 0f, -1f, 0f, 0f, 0f, 0f, -1f),
+ new Basis(1f, 0f, 0f, 0f, 0f, 1f, 0f, -1f, 0f),
+ new Basis(0f, 0f, -1f, 1f, 0f, 0f, 0f, -1f, 0f),
+ new Basis(-1f, 0f, 0f, 0f, 0f, -1f, 0f, -1f, 0f),
+ new Basis(0f, 0f, 1f, -1f, 0f, 0f, 0f, -1f, 0f),
+ new Basis(0f, 0f, 1f, 0f, 1f, 0f, -1f, 0f, 0f),
+ new Basis(0f, -1f, 0f, 0f, 0f, 1f, -1f, 0f, 0f),
+ new Basis(0f, 0f, -1f, 0f, -1f, 0f, -1f, 0f, 0f),
+ new Basis(0f, 1f, 0f, 0f, 0f, -1f, -1f, 0f, 0f),
+ new Basis(0f, 0f, 1f, 0f, -1f, 0f, 1f, 0f, 0f),
+ new Basis(0f, 1f, 0f, 0f, 0f, 1f, 1f, 0f, 0f),
+ new Basis(0f, 0f, -1f, 0f, 1f, 0f, 1f, 0f, 0f),
+ new Basis(0f, -1f, 0f, 0f, 0f, -1f, 1f, 0f, 0f)
+ };
+
+ public Vector3 x;
+ public Vector3 y;
+ public Vector3 z;
+
+ public static Basis Identity
+ {
+ get { return identity; }
+ }
+
+ public Vector3 Scale
+ {
+ get
+ {
+ return new Vector3
+ (
+ new Vector3(this[0, 0], this[1, 0], this[2, 0]).length(),
+ new Vector3(this[0, 1], this[1, 1], this[2, 1]).length(),
+ new Vector3(this[0, 2], this[1, 2], this[2, 2]).length()
+ );
+ }
+ }
+
+ public Vector3 this[int index]
+ {
+ get
+ {
+ switch (index)
+ {
+ case 0:
+ return x;
+ case 1:
+ return y;
+ case 2:
+ return z;
+ default:
+ throw new IndexOutOfRangeException();
+ }
+ }
+ set
+ {
+ switch (index)
+ {
+ case 0:
+ x = value;
+ return;
+ case 1:
+ y = value;
+ return;
+ case 2:
+ z = value;
+ return;
+ default:
+ throw new IndexOutOfRangeException();
+ }
+ }
+ }
+
+ public float this[int index, int axis]
+ {
+ get
+ {
+ switch (index)
+ {
+ case 0:
+ return x[axis];
+ case 1:
+ return y[axis];
+ case 2:
+ return z[axis];
+ default:
+ throw new IndexOutOfRangeException();
+ }
+ }
+ set
+ {
+ switch (index)
+ {
+ case 0:
+ x[axis] = value;
+ return;
+ case 1:
+ y[axis] = value;
+ return;
+ case 2:
+ z[axis] = value;
+ return;
+ default:
+ throw new IndexOutOfRangeException();
+ }
+ }
+ }
+
+ internal static Basis create_from_axes(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis)
+ {
+ return new Basis
+ (
+ new Vector3(xAxis.x, yAxis.x, zAxis.x),
+ new Vector3(xAxis.y, yAxis.y, zAxis.y),
+ new Vector3(xAxis.z, yAxis.z, zAxis.z)
+ );
+ }
+
+ public float determinant()
+ {
+ return this[0, 0] * (this[1, 1] * this[2, 2] - this[2, 1] * this[1, 2]) -
+ this[1, 0] * (this[0, 1] * this[2, 2] - this[2, 1] * this[0, 2]) +
+ this[2, 0] * (this[0, 1] * this[1, 2] - this[1, 1] * this[0, 2]);
+ }
+
+ public Vector3 get_axis(int axis)
+ {
+ return new Vector3(this[0, axis], this[1, axis], this[2, axis]);
+ }
+
+ public Vector3 get_euler()
+ {
+ Basis m = this.orthonormalized();
+
+ Vector3 euler;
+ euler.z = 0.0f;
+
+ float mxy = m.y[2];
+
+
+ if (mxy < 1.0f)
+ {
+ if (mxy > -1.0f)
+ {
+ euler.x = Mathf.asin(-mxy);
+ euler.y = Mathf.atan2(m.x[2], m.z[2]);
+ euler.z = Mathf.atan2(m.y[0], m.y[1]);
+ }
+ else
+ {
+ euler.x = Mathf.PI * 0.5f;
+ euler.y = -Mathf.atan2(-m.x[1], m.x[0]);
+ }
+ }
+ else
+ {
+ euler.x = -Mathf.PI * 0.5f;
+ euler.y = -Mathf.atan2(m.x[1], m.x[0]);
+ }
+
+ return euler;
+ }
+
+ public int get_orthogonal_index()
+ {
+ Basis orth = this;
+
+ for (int i = 0; i < 3; i++)
+ {
+ for (int j = 0; j < 3; j++)
+ {
+ float v = orth[i, j];
+
+ if (v > 0.5f)
+ v = 1.0f;
+ else if (v < -0.5f)
+ v = -1.0f;
+ else
+ v = 0f;
+
+ orth[i, j] = v;
+ }
+ }
+
+ for (int i = 0; i < 24; i++)
+ {
+ if (orthoBases[i] == orth)
+ return i;
+ }
+
+ return 0;
+ }
+
+ public Basis inverse()
+ {
+ Basis inv = this;
+
+ float[] co = new float[3]
+ {
+ inv[1, 1] * inv[2, 2] - inv[1, 2] * inv[2, 1],
+ inv[1, 2] * inv[2, 0] - inv[1, 0] * inv[2, 2],
+ inv[1, 0] * inv[2, 1] - inv[1, 1] * inv[2, 0]
+ };
+
+ float det = inv[0, 0] * co[0] + inv[0, 1] * co[1] + inv[0, 2] * co[2];
+
+ if (det == 0)
+ {
+ return new Basis
+ (
+ float.NaN, float.NaN, float.NaN,
+ float.NaN, float.NaN, float.NaN,
+ float.NaN, float.NaN, float.NaN
+ );
+ }
+
+ float s = 1.0f / det;
+
+ inv = new Basis
+ (
+ co[0] * s,
+ inv[0, 2] * inv[2, 1] - inv[0, 1] * inv[2, 2] * s,
+ inv[0, 1] * inv[1, 2] - inv[0, 2] * inv[1, 1] * s,
+ co[1] * s,
+ inv[0, 0] * inv[2, 2] - inv[0, 2] * inv[2, 0] * s,
+ inv[0, 2] * inv[1, 0] - inv[0, 0] * inv[1, 2] * s,
+ co[2] * s,
+ inv[0, 1] * inv[2, 0] - inv[0, 0] * inv[2, 1] * s,
+ inv[0, 0] * inv[1, 1] - inv[0, 1] * inv[1, 0] * s
+ );
+
+ return inv;
+ }
+
+ public Basis orthonormalized()
+ {
+ Vector3 xAxis = get_axis(0);
+ Vector3 yAxis = get_axis(1);
+ Vector3 zAxis = get_axis(2);
+
+ xAxis.normalize();
+ yAxis = (yAxis - xAxis * (xAxis.dot(yAxis)));
+ yAxis.normalize();
+ zAxis = (zAxis - xAxis * (xAxis.dot(zAxis)) - yAxis * (yAxis.dot(zAxis)));
+ zAxis.normalize();
+
+ return Basis.create_from_axes(xAxis, yAxis, zAxis);
+ }
+
+ public Basis rotated(Vector3 axis, float phi)
+ {
+ return new Basis(axis, phi) * this;
+ }
+
+ public Basis scaled(Vector3 scale)
+ {
+ Basis m = this;
+
+ m[0, 0] *= scale.x;
+ m[0, 1] *= scale.x;
+ m[0, 2] *= scale.x;
+ m[1, 0] *= scale.y;
+ m[1, 1] *= scale.y;
+ m[1, 2] *= scale.y;
+ m[2, 0] *= scale.z;
+ m[2, 1] *= scale.z;
+ m[2, 2] *= scale.z;
+
+ return m;
+ }
+
+ public float tdotx(Vector3 with)
+ {
+ return this[0, 0] * with[0] + this[1, 0] * with[1] + this[2, 0] * with[2];
+ }
+
+ public float tdoty(Vector3 with)
+ {
+ return this[0, 1] * with[0] + this[1, 1] * with[1] + this[2, 1] * with[2];
+ }
+
+ public float tdotz(Vector3 with)
+ {
+ return this[0, 2] * with[0] + this[1, 2] * with[1] + this[2, 2] * with[2];
+ }
+
+ public Basis transposed()
+ {
+ Basis tr = this;
+
+ float temp = this[0, 1];
+ this[0, 1] = this[1, 0];
+ this[1, 0] = temp;
+
+ temp = this[0, 2];
+ this[0, 2] = this[2, 0];
+ this[2, 0] = temp;
+
+ temp = this[1, 2];
+ this[1, 2] = this[2, 1];
+ this[2, 1] = temp;
+
+ return tr;
+ }
+
+ public Vector3 xform(Vector3 v)
+ {
+ return new Vector3
+ (
+ this[0].dot(v),
+ this[1].dot(v),
+ this[2].dot(v)
+ );
+ }
+
+ public Vector3 xform_inv(Vector3 v)
+ {
+ return new Vector3
+ (
+ (this[0, 0] * v.x) + (this[1, 0] * v.y) + (this[2, 0] * v.z),
+ (this[0, 1] * v.x) + (this[1, 1] * v.y) + (this[2, 1] * v.z),
+ (this[0, 2] * v.x) + (this[1, 2] * v.y) + (this[2, 2] * v.z)
+ );
+ }
+
+ public Quat Quat() {
+ float trace = x[0] + y[1] + z[2];
+
+ if (trace > 0.0f) {
+ float s = Mathf.sqrt(trace + 1.0f) * 2f;
+ float inv_s = 1f / s;
+ return new Quat(
+ (z[1] - y[2]) * inv_s,
+ (x[2] - z[0]) * inv_s,
+ (y[0] - x[1]) * inv_s,
+ s * 0.25f
+ );
+ } else if (x[0] > y[1] && x[0] > z[2]) {
+ float s = Mathf.sqrt(x[0] - y[1] - z[2] + 1.0f) * 2f;
+ float inv_s = 1f / s;
+ return new Quat(
+ s * 0.25f,
+ (x[1] + y[0]) * inv_s,
+ (x[2] + z[0]) * inv_s,
+ (z[1] - y[2]) * inv_s
+ );
+ } else if (y[1] > z[2]) {
+ float s = Mathf.sqrt(-x[0] + y[1] - z[2] + 1.0f) * 2f;
+ float inv_s = 1f / s;
+ return new Quat(
+ (x[1] + y[0]) * inv_s,
+ s * 0.25f,
+ (y[2] + z[1]) * inv_s,
+ (x[2] - z[0]) * inv_s
+ );
+ } else {
+ float s = Mathf.sqrt(-x[0] - y[1] + z[2] + 1.0f) * 2f;
+ float inv_s = 1f / s;
+ return new Quat(
+ (x[2] + z[0]) * inv_s,
+ (y[2] + z[1]) * inv_s,
+ s * 0.25f,
+ (y[0] - x[1]) * inv_s
+ );
+ }
+ }
+
+ public Basis(Quat quat)
+ {
+ float s = 2.0f / quat.length_squared();
+
+ float xs = quat.x * s;
+ float ys = quat.y * s;
+ float zs = quat.z * s;
+ float wx = quat.w * xs;
+ float wy = quat.w * ys;
+ float wz = quat.w * zs;
+ float xx = quat.x * xs;
+ float xy = quat.x * ys;
+ float xz = quat.x * zs;
+ float yy = quat.y * ys;
+ float yz = quat.y * zs;
+ float zz = quat.z * zs;
+
+ this.x = new Vector3(1.0f - (yy + zz), xy - wz, xz + wy);
+ this.y = new Vector3(xy + wz, 1.0f - (xx + zz), yz - wx);
+ this.z = new Vector3(xz - wy, yz + wx, 1.0f - (xx + yy));
+ }
+
+ public Basis(Vector3 axis, float phi)
+ {
+ Vector3 axis_sq = new Vector3(axis.x * axis.x, axis.y * axis.y, axis.z * axis.z);
+
+ float cosine = Mathf.cos(phi);
+ float sine = Mathf.sin(phi);
+
+ this.x = new Vector3
+ (
+ axis_sq.x + cosine * (1.0f - axis_sq.x),
+ axis.x * axis.y * (1.0f - cosine) - axis.z * sine,
+ axis.z * axis.x * (1.0f - cosine) + axis.y * sine
+ );
+
+ this.y = new Vector3
+ (
+ axis.x * axis.y * (1.0f - cosine) + axis.z * sine,
+ axis_sq.y + cosine * (1.0f - axis_sq.y),
+ axis.y * axis.z * (1.0f - cosine) - axis.x * sine
+ );
+
+ this.z = new Vector3
+ (
+ axis.z * axis.x * (1.0f - cosine) - axis.y * sine,
+ axis.y * axis.z * (1.0f - cosine) + axis.x * sine,
+ axis_sq.z + cosine * (1.0f - axis_sq.z)
+ );
+ }
+
+ public Basis(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis)
+ {
+ this.x = xAxis;
+ this.y = yAxis;
+ this.z = zAxis;
+ }
+
+ public Basis(float xx, float xy, float xz, float yx, float yy, float yz, float zx, float zy, float zz)
+ {
+ this.x = new Vector3(xx, xy, xz);
+ this.y = new Vector3(yx, yy, yz);
+ this.z = new Vector3(zx, zy, zz);
+ }
+
+ public static Basis operator *(Basis left, Basis right)
+ {
+ return new Basis
+ (
+ right.tdotx(left[0]), right.tdoty(left[0]), right.tdotz(left[0]),
+ right.tdotx(left[1]), right.tdoty(left[1]), right.tdotz(left[1]),
+ right.tdotx(left[2]), right.tdoty(left[2]), right.tdotz(left[2])
+ );
+ }
+
+ public static bool operator ==(Basis left, Basis right)
+ {
+ return left.Equals(right);
+ }
+
+ public static bool operator !=(Basis left, Basis right)
+ {
+ return !left.Equals(right);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (obj is Basis)
+ {
+ return Equals((Basis)obj);
+ }
+
+ return false;
+ }
+
+ public bool Equals(Basis other)
+ {
+ return x.Equals(other.x) && y.Equals(other.y) && z.Equals(other.z);
+ }
+
+ public override int GetHashCode()
+ {
+ return x.GetHashCode() ^ y.GetHashCode() ^ z.GetHashCode();
+ }
+
+ public override string ToString()
+ {
+ return String.Format("({0}, {1}, {2})", new object[]
+ {
+ this.x.ToString(),
+ this.y.ToString(),
+ this.z.ToString()
+ });
+ }
+
+ public string ToString(string format)
+ {
+ return String.Format("({0}, {1}, {2})", new object[]
+ {
+ this.x.ToString(format),
+ this.y.ToString(format),
+ this.z.ToString(format)
+ });
+ }
+ }
+}
diff --git a/modules/mono/glue/cs_files/Color.cs b/modules/mono/glue/cs_files/Color.cs
new file mode 100644
index 0000000000..df88a46832
--- /dev/null
+++ b/modules/mono/glue/cs_files/Color.cs
@@ -0,0 +1,590 @@
+using System;
+
+namespace Godot
+{
+ public struct Color : IEquatable<Color>
+ {
+ public float r;
+ public float g;
+ public float b;
+ public float a;
+
+ public int r8
+ {
+ get
+ {
+ return (int)(r * 255.0f);
+ }
+ }
+
+ public int g8
+ {
+ get
+ {
+ return (int)(g * 255.0f);
+ }
+ }
+
+ public int b8
+ {
+ get
+ {
+ return (int)(b * 255.0f);
+ }
+ }
+
+ public int a8
+ {
+ get
+ {
+ return (int)(a * 255.0f);
+ }
+ }
+
+ public float h
+ {
+ get
+ {
+ float max = Mathf.max(r, Mathf.max(g, b));
+ float min = Mathf.min(r, Mathf.min(g, b));
+
+ float delta = max - min;
+
+ if (delta == 0)
+ return 0;
+
+ float h;
+
+ if (r == max)
+ h = (g - b) / delta; // Between yellow & magenta
+ else if (g == max)
+ h = 2 + (b - r) / delta; // Between cyan & yellow
+ else
+ h = 4 + (r - g) / delta; // Between magenta & cyan
+
+ h /= 6.0f;
+
+ if (h < 0)
+ h += 1.0f;
+
+ return h;
+ }
+ set
+ {
+ this = from_hsv(value, s, v);
+ }
+ }
+
+ public float s
+ {
+ get
+ {
+ float max = Mathf.max(r, Mathf.max(g, b));
+ float min = Mathf.min(r, Mathf.min(g, b));
+
+ float delta = max - min;
+
+ return max != 0 ? delta / max : 0;
+ }
+ set
+ {
+ this = from_hsv(h, value, v);
+ }
+ }
+
+ public float v
+ {
+ get
+ {
+ return Mathf.max(r, Mathf.max(g, b));
+ }
+ set
+ {
+ this = from_hsv(h, s, value);
+ }
+ }
+
+ private static readonly Color black = new Color(0f, 0f, 0f, 1.0f);
+
+ public Color Black
+ {
+ get
+ {
+ return black;
+ }
+ }
+
+ public float this [int index]
+ {
+ get
+ {
+ switch (index)
+ {
+ case 0:
+ return r;
+ case 1:
+ return g;
+ case 2:
+ return b;
+ case 3:
+ return a;
+ default:
+ throw new IndexOutOfRangeException();
+ }
+ }
+ set
+ {
+ switch (index)
+ {
+ case 0:
+ r = value;
+ return;
+ case 1:
+ g = value;
+ return;
+ case 2:
+ b = value;
+ return;
+ case 3:
+ a = value;
+ return;
+ default:
+ throw new IndexOutOfRangeException();
+ }
+ }
+ }
+
+ public static void to_hsv(Color color, out float hue, out float saturation, out float value)
+ {
+ int max = Mathf.max(color.r8, Mathf.max(color.g8, color.b8));
+ int min = Mathf.min(color.r8, Mathf.min(color.g8, color.b8));
+
+ float delta = max - min;
+
+ if (delta == 0)
+ {
+ hue = 0;
+ }
+ else
+ {
+ if (color.r == max)
+ hue = (color.g - color.b) / delta; // Between yellow & magenta
+ else if (color.g == max)
+ hue = 2 + (color.b - color.r) / delta; // Between cyan & yellow
+ else
+ hue = 4 + (color.r - color.g) / delta; // Between magenta & cyan
+
+ hue /= 6.0f;
+
+ if (hue < 0)
+ hue += 1.0f;
+ }
+
+ saturation = (max == 0) ? 0 : 1f - (1f * min / max);
+ value = max / 255f;
+ }
+
+ public static Color from_hsv(float hue, float saturation, float value, float alpha = 1.0f)
+ {
+ if (saturation == 0)
+ {
+ // acp_hromatic (grey)
+ return new Color(value, value, value, alpha);
+ }
+
+ int i;
+ float f, p, q, t;
+
+ hue *= 6.0f;
+ hue %= 6f;
+ i = (int)hue;
+
+ f = hue - i;
+ p = value * (1 - saturation);
+ q = value * (1 - saturation * f);
+ t = value * (1 - saturation * (1 - f));
+
+ switch (i)
+ {
+ case 0: // Red is the dominant color
+ return new Color(value, t, p, alpha);
+ case 1: // Green is the dominant color
+ return new Color(q, value, p, alpha);
+ case 2:
+ return new Color(p, value, t, alpha);
+ case 3: // Blue is the dominant color
+ return new Color(p, q, value, alpha);
+ case 4:
+ return new Color(t, p, value, alpha);
+ default: // (5) Red is the dominant color
+ return new Color(value, p, q, alpha);
+ }
+ }
+
+ public Color blend(Color over)
+ {
+ Color res;
+
+ float sa = 1.0f - over.a;
+ res.a = a * sa + over.a;
+
+ if (res.a == 0)
+ {
+ return new Color(0, 0, 0, 0);
+ }
+ else
+ {
+ res.r = (r * a * sa + over.r * over.a) / res.a;
+ res.g = (g * a * sa + over.g * over.a) / res.a;
+ res.b = (b * a * sa + over.b * over.a) / res.a;
+ }
+
+ return res;
+ }
+
+ public Color contrasted()
+ {
+ return new Color(
+ (r + 0.5f) % 1.0f,
+ (g + 0.5f) % 1.0f,
+ (b + 0.5f) % 1.0f
+ );
+ }
+
+ public float gray()
+ {
+ return (r + g + b) / 3.0f;
+ }
+
+ public Color inverted()
+ {
+ return new Color(
+ 1.0f - r,
+ 1.0f - g,
+ 1.0f - b
+ );
+ }
+
+ public Color linear_interpolate(Color b, float t)
+ {
+ Color res = this;
+
+ res.r += (t * (b.r - this.r));
+ res.g += (t * (b.g - this.g));
+ res.b += (t * (b.b - this.b));
+ res.a += (t * (b.a - this.a));
+
+ return res;
+ }
+
+ public int to_32()
+ {
+ int c = (byte)(a * 255);
+ c <<= 8;
+ c |= (byte)(r * 255);
+ c <<= 8;
+ c |= (byte)(g * 255);
+ c <<= 8;
+ c |= (byte)(b * 255);
+
+ return c;
+ }
+
+ public int to_ARGB32()
+ {
+ int c = (byte)(a * 255);
+ c <<= 8;
+ c |= (byte)(r * 255);
+ c <<= 8;
+ c |= (byte)(g * 255);
+ c <<= 8;
+ c |= (byte)(b * 255);
+
+ return c;
+ }
+
+ public string to_html(bool include_alpha = true)
+ {
+ String txt = string.Empty;
+
+ txt += _to_hex(r);
+ txt += _to_hex(g);
+ txt += _to_hex(b);
+
+ if (include_alpha)
+ txt = _to_hex(a) + txt;
+
+ return txt;
+ }
+
+ public Color(float r, float g, float b, float a = 1.0f)
+ {
+ this.r = r;
+ this.g = g;
+ this.b = b;
+ this.a = a;
+ }
+
+ public Color(int rgba)
+ {
+ this.a = (rgba & 0xFF) / 255.0f;
+ rgba >>= 8;
+ this.b = (rgba & 0xFF) / 255.0f;
+ rgba >>= 8;
+ this.g = (rgba & 0xFF) / 255.0f;
+ rgba >>= 8;
+ this.r = (rgba & 0xFF) / 255.0f;
+ }
+
+ private static float _parse_col(string str, int ofs)
+ {
+ int ig = 0;
+
+ for (int i = 0; i < 2; i++)
+ {
+ int c = str[i + ofs];
+ int v = 0;
+
+ if (c >= '0' && c <= '9')
+ {
+ v = c - '0';
+ }
+ else if (c >= 'a' && c <= 'f')
+ {
+ v = c - 'a';
+ v += 10;
+ }
+ else if (c >= 'A' && c <= 'F')
+ {
+ v = c - 'A';
+ v += 10;
+ }
+ else
+ {
+ return -1;
+ }
+
+ if (i == 0)
+ ig += v * 16;
+ else
+ ig += v;
+ }
+
+ return ig;
+ }
+
+ private String _to_hex(float val)
+ {
+ int v = (int)Mathf.clamp(val * 255.0f, 0, 255);
+
+ string ret = string.Empty;
+
+ for (int i = 0; i < 2; i++)
+ {
+ char[] c = { (char)0, (char)0 };
+ int lv = v & 0xF;
+
+ if (lv < 10)
+ c[0] = (char)('0' + lv);
+ else
+ c[0] = (char)('a' + lv - 10);
+
+ v >>= 4;
+ ret = c + ret;
+ }
+
+ return ret;
+ }
+
+ internal static bool html_is_valid(string color)
+ {
+ if (color.Length == 0)
+ return false;
+
+ if (color[0] == '#')
+ color = color.Substring(1, color.Length - 1);
+
+ bool alpha = false;
+
+ if (color.Length == 8)
+ alpha = true;
+ else if (color.Length == 6)
+ alpha = false;
+ else
+ return false;
+
+ if (alpha)
+ {
+ if ((int)_parse_col(color, 0) < 0)
+ return false;
+ }
+
+ int from = alpha ? 2 : 0;
+
+ if ((int)_parse_col(color, from + 0) < 0)
+ return false;
+ if ((int)_parse_col(color, from + 2) < 0)
+ return false;
+ if ((int)_parse_col(color, from + 4) < 0)
+ return false;
+
+ return true;
+ }
+
+ public static Color Color8(byte r8, byte g8, byte b8, byte a8)
+ {
+ return new Color((float)r8 / 255f, (float)g8 / 255f, (float)b8 / 255f, (float)a8 / 255f);
+ }
+
+ public Color(string rgba)
+ {
+ if (rgba.Length == 0)
+ {
+ r = 0f;
+ g = 0f;
+ b = 0f;
+ a = 1.0f;
+ return;
+ }
+
+ if (rgba[0] == '#')
+ rgba = rgba.Substring(1);
+
+ bool alpha = false;
+
+ if (rgba.Length == 8)
+ {
+ alpha = true;
+ }
+ else if (rgba.Length == 6)
+ {
+ alpha = false;
+ }
+ else
+ {
+ throw new ArgumentOutOfRangeException("Invalid color code. Length is " + rgba.Length + " but a length of 6 or 8 is expected: " + rgba);
+ }
+
+ if (alpha)
+ {
+ a = _parse_col(rgba, 0);
+
+ if (a < 0)
+ throw new ArgumentOutOfRangeException("Invalid color code. Alpha is " + a + " but zero or greater is expected: " + rgba);
+ }
+ else
+ {
+ a = 1.0f;
+ }
+
+ int from = alpha ? 2 : 0;
+
+ r = _parse_col(rgba, from + 0);
+
+ if (r < 0)
+ throw new ArgumentOutOfRangeException("Invalid color code. Red is " + r + " but zero or greater is expected: " + rgba);
+
+ g = _parse_col(rgba, from + 2);
+
+ if (g < 0)
+ throw new ArgumentOutOfRangeException("Invalid color code. Green is " + g + " but zero or greater is expected: " + rgba);
+
+ b = _parse_col(rgba, from + 4);
+
+ if (b < 0)
+ throw new ArgumentOutOfRangeException("Invalid color code. Blue is " + b + " but zero or greater is expected: " + rgba);
+ }
+
+ public static bool operator ==(Color left, Color right)
+ {
+ return left.Equals(right);
+ }
+
+ public static bool operator !=(Color left, Color right)
+ {
+ return !left.Equals(right);
+ }
+
+ public static bool operator <(Color left, Color right)
+ {
+ if (left.r == right.r)
+ {
+ if (left.g == right.g)
+ {
+ if (left.b == right.b)
+ return (left.a < right.a);
+ else
+ return (left.b < right.b);
+ }
+ else
+ {
+ return left.g < right.g;
+ }
+ }
+
+ return left.r < right.r;
+ }
+
+ public static bool operator >(Color left, Color right)
+ {
+ if (left.r == right.r)
+ {
+ if (left.g == right.g)
+ {
+ if (left.b == right.b)
+ return (left.a > right.a);
+ else
+ return (left.b > right.b);
+ }
+ else
+ {
+ return left.g > right.g;
+ }
+ }
+
+ return left.r > right.r;
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (obj is Color)
+ {
+ return Equals((Color)obj);
+ }
+
+ return false;
+ }
+
+ public bool Equals(Color other)
+ {
+ return r == other.r && g == other.g && b == other.b && a == other.a;
+ }
+
+ public override int GetHashCode()
+ {
+ return r.GetHashCode() ^ g.GetHashCode() ^ b.GetHashCode() ^ a.GetHashCode();
+ }
+
+ public override string ToString()
+ {
+ return String.Format("{0},{1},{2},{3}", new object[]
+ {
+ this.r.ToString(),
+ this.g.ToString(),
+ this.b.ToString(),
+ this.a.ToString()
+ });
+ }
+
+ public string ToString(string format)
+ {
+ return String.Format("{0},{1},{2},{3}", new object[]
+ {
+ this.r.ToString(format),
+ this.g.ToString(format),
+ this.b.ToString(format),
+ this.a.ToString(format)
+ });
+ }
+ }
+}
diff --git a/modules/mono/glue/cs_files/Error.cs b/modules/mono/glue/cs_files/Error.cs
new file mode 100644
index 0000000000..3f4a92603d
--- /dev/null
+++ b/modules/mono/glue/cs_files/Error.cs
@@ -0,0 +1,48 @@
+namespace Godot
+{
+ public enum Error : int
+ {
+ OK = 0,
+ FAILED = 1,
+ ERR_UNAVAILABLE = 2,
+ ERR_UNCONFIGURED = 3,
+ ERR_UNAUTHORIZED = 4,
+ ERR_PARAMETER_RANGE_ERROR = 5,
+ ERR_OUT_OF_MEMORY = 6,
+ ERR_FILE_NOT_FOUND = 7,
+ ERR_FILE_BAD_DRIVE = 8,
+ ERR_FILE_BAD_PATH = 9,
+ ERR_FILE_NO_PERMISSION = 10,
+ ERR_FILE_ALREADY_IN_USE = 11,
+ ERR_FILE_CANT_OPEN = 12,
+ ERR_FILE_CANT_WRITE = 13,
+ ERR_FILE_CANT_READ = 14,
+ ERR_FILE_UNRECOGNIZED = 15,
+ ERR_FILE_CORRUPT = 16,
+ ERR_FILE_MISSING_DEPENDENCIES = 17,
+ ERR_FILE_EOF = 18,
+ ERR_CANT_OPEN = 19,
+ ERR_CANT_CREATE = 20,
+ ERR_PARSE_ERROR = 43,
+ ERROR_QUERY_FAILED = 21,
+ ERR_ALREADY_IN_USE = 22,
+ ERR_LOCKED = 23,
+ ERR_TIMEOUT = 24,
+ ERR_CANT_AQUIRE_RESOURCE = 28,
+ ERR_INVALID_DATA = 30,
+ ERR_INVALID_PARAMETER = 31,
+ ERR_ALREADY_EXISTS = 32,
+ ERR_DOES_NOT_EXIST = 33,
+ ERR_DATABASE_CANT_READ = 34,
+ ERR_DATABASE_CANT_WRITE = 35,
+ ERR_COMPILATION_FAILED = 36,
+ ERR_METHOD_NOT_FOUND = 37,
+ ERR_LINK_FAILED = 38,
+ ERR_SCRIPT_FAILED = 39,
+ ERR_CYCLIC_LINK = 40,
+ ERR_BUSY = 44,
+ ERR_HELP = 46,
+ ERR_BUG = 47,
+ ERR_WTF = 49
+ }
+}
diff --git a/modules/mono/glue/cs_files/ExportAttribute.cs b/modules/mono/glue/cs_files/ExportAttribute.cs
new file mode 100644
index 0000000000..af3f603d6d
--- /dev/null
+++ b/modules/mono/glue/cs_files/ExportAttribute.cs
@@ -0,0 +1,19 @@
+using System;
+
+namespace Godot
+{
+ [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
+ public class ExportAttribute : Attribute
+ {
+ private int hint;
+ private string hint_string;
+ private int usage;
+
+ public ExportAttribute(int hint = GD.PROPERTY_HINT_NONE, string hint_string = "", int usage = GD.PROPERTY_USAGE_DEFAULT)
+ {
+ this.hint = hint;
+ this.hint_string = hint_string;
+ this.usage = usage;
+ }
+ }
+}
diff --git a/modules/mono/glue/cs_files/GD.cs b/modules/mono/glue/cs_files/GD.cs
new file mode 100644
index 0000000000..40a42d23b4
--- /dev/null
+++ b/modules/mono/glue/cs_files/GD.cs
@@ -0,0 +1,191 @@
+using System;
+
+namespace Godot
+{
+ public static class GD
+ {
+ /*{GodotGlobalConstants}*/
+
+ public static object bytes2var(byte[] bytes)
+ {
+ return NativeCalls.godot_icall_Godot_bytes2var(bytes);
+ }
+
+ public static object convert(object what, int type)
+ {
+ return NativeCalls.godot_icall_Godot_convert(what, type);
+ }
+
+ public static float db2linear(float db)
+ {
+ return (float)Math.Exp(db * 0.11512925464970228420089957273422);
+ }
+
+ public static float dectime(float value, float amount, float step)
+ {
+ float sgn = value < 0 ? -1.0f : 1.0f;
+ float val = Mathf.abs(value);
+ val -= amount * step;
+ if (val < 0.0f)
+ val = 0.0f;
+ return val * sgn;
+ }
+
+ public static FuncRef funcref(Object instance, string funcname)
+ {
+ var ret = new FuncRef();
+ ret.SetInstance(instance);
+ ret.SetFunction(funcname);
+ return ret;
+ }
+
+ public static int hash(object var)
+ {
+ return NativeCalls.godot_icall_Godot_hash(var);
+ }
+
+ public static Object instance_from_id(int instance_id)
+ {
+ return NativeCalls.godot_icall_Godot_instance_from_id(instance_id);
+ }
+
+ public static double linear2db(double linear)
+ {
+ return Math.Log(linear) * 8.6858896380650365530225783783321;
+ }
+
+ public static Resource load(string path)
+ {
+ return ResourceLoader.Load(path);
+ }
+
+ public static void print(params object[] what)
+ {
+ NativeCalls.godot_icall_Godot_print(what);
+ }
+
+ public static void print_stack()
+ {
+ print(System.Environment.StackTrace);
+ }
+
+ public static void printerr(params object[] what)
+ {
+ NativeCalls.godot_icall_Godot_printerr(what);
+ }
+
+ public static void printraw(params object[] what)
+ {
+ NativeCalls.godot_icall_Godot_printraw(what);
+ }
+
+ public static void prints(params object[] what)
+ {
+ NativeCalls.godot_icall_Godot_prints(what);
+ }
+
+ public static void printt(params object[] what)
+ {
+ NativeCalls.godot_icall_Godot_printt(what);
+ }
+
+ public static int[] range(int length)
+ {
+ int[] ret = new int[length];
+
+ for (int i = 0; i < length; i++)
+ {
+ ret[i] = i;
+ }
+
+ return ret;
+ }
+
+ public static int[] range(int from, int to)
+ {
+ if (to < from)
+ return new int[0];
+
+ int[] ret = new int[to - from];
+
+ for (int i = from; i < to; i++)
+ {
+ ret[i - from] = i;
+ }
+
+ return ret;
+ }
+
+ public static int[] range(int from, int to, int increment)
+ {
+ if (to < from && increment > 0)
+ return new int[0];
+ if (to > from && increment < 0)
+ return new int[0];
+
+ // Calculate count
+ int count = 0;
+
+ if (increment > 0)
+ count = ((to - from - 1) / increment) + 1;
+ else
+ count = ((from - to - 1) / -increment) + 1;
+
+ int[] ret = new int[count];
+
+ if (increment > 0)
+ {
+ int idx = 0;
+ for (int i = from; i < to; i += increment)
+ {
+ ret[idx++] = i;
+ }
+ }
+ else
+ {
+ int idx = 0;
+ for (int i = from; i > to; i += increment)
+ {
+ ret[idx++] = i;
+ }
+ }
+
+ return ret;
+ }
+
+ public static void seed(int seed)
+ {
+ NativeCalls.godot_icall_Godot_seed(seed);
+ }
+
+ public static string str(params object[] what)
+ {
+ return NativeCalls.godot_icall_Godot_str(what);
+ }
+
+ public static object str2var(string str)
+ {
+ return NativeCalls.godot_icall_Godot_str2var(str);
+ }
+
+ public static bool type_exists(string type)
+ {
+ return NativeCalls.godot_icall_Godot_type_exists(type);
+ }
+
+ public static byte[] var2bytes(object var)
+ {
+ return NativeCalls.godot_icall_Godot_var2bytes(var);
+ }
+
+ public static string var2str(object var)
+ {
+ return NativeCalls.godot_icall_Godot_var2str(var);
+ }
+
+ public static WeakRef weakref(Object obj)
+ {
+ return NativeCalls.godot_icall_Godot_weakref(Object.GetPtr(obj));
+ }
+ }
+}
diff --git a/modules/mono/glue/cs_files/GodotMethodAttribute.cs b/modules/mono/glue/cs_files/GodotMethodAttribute.cs
new file mode 100644
index 0000000000..21333c8dab
--- /dev/null
+++ b/modules/mono/glue/cs_files/GodotMethodAttribute.cs
@@ -0,0 +1,17 @@
+using System;
+
+namespace Godot
+{
+ [AttributeUsage(AttributeTargets.Method, Inherited = true)]
+ internal class GodotMethodAttribute : Attribute
+ {
+ private string methodName;
+
+ public string MethodName { get { return methodName; } }
+
+ public GodotMethodAttribute(string methodName)
+ {
+ this.methodName = methodName;
+ }
+ }
+}
diff --git a/modules/mono/glue/cs_files/GodotSynchronizationContext.cs b/modules/mono/glue/cs_files/GodotSynchronizationContext.cs
new file mode 100644
index 0000000000..eb4d0bed1c
--- /dev/null
+++ b/modules/mono/glue/cs_files/GodotSynchronizationContext.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Threading;
+
+namespace Godot
+{
+ public class GodotSynchronizationContext : SynchronizationContext
+ {
+ private readonly BlockingCollection<KeyValuePair<SendOrPostCallback, object>> queue = new BlockingCollection<KeyValuePair<SendOrPostCallback, object>>();
+
+ public override void Post(SendOrPostCallback d, object state)
+ {
+ queue.Add(new KeyValuePair<SendOrPostCallback, object>(d, state));
+ }
+
+ public void ExecutePendingContinuations()
+ {
+ KeyValuePair<SendOrPostCallback, object> workItem;
+ while (queue.TryTake(out workItem))
+ {
+ workItem.Key(workItem.Value);
+ }
+ }
+ }
+}
diff --git a/modules/mono/glue/cs_files/GodotTaskScheduler.cs b/modules/mono/glue/cs_files/GodotTaskScheduler.cs
new file mode 100644
index 0000000000..f587645a49
--- /dev/null
+++ b/modules/mono/glue/cs_files/GodotTaskScheduler.cs
@@ -0,0 +1,94 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Godot
+{
+ public class GodotTaskScheduler : TaskScheduler
+ {
+ private GodotSynchronizationContext Context { get; set; }
+ private readonly LinkedList<Task> _tasks = new LinkedList<Task>();
+
+ public GodotTaskScheduler()
+ {
+ Context = new GodotSynchronizationContext();
+ }
+
+ protected sealed override void QueueTask(Task task)
+ {
+ lock (_tasks)
+ {
+ _tasks.AddLast(task);
+ }
+ }
+
+ protected sealed override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)
+ {
+ if (SynchronizationContext.Current != Context)
+ {
+ return false;
+ }
+
+ if (taskWasPreviouslyQueued)
+ {
+ TryDequeue(task);
+ }
+
+ return base.TryExecuteTask(task);
+ }
+
+ protected sealed override bool TryDequeue(Task task)
+ {
+ lock (_tasks)
+ {
+ return _tasks.Remove(task);
+ }
+ }
+
+ protected sealed override IEnumerable<Task> GetScheduledTasks()
+ {
+ lock (_tasks)
+ {
+ return _tasks.ToArray();
+ }
+ }
+
+ public void Activate()
+ {
+ SynchronizationContext.SetSynchronizationContext(Context);
+ ExecuteQueuedTasks();
+ Context.ExecutePendingContinuations();
+ }
+
+ private void ExecuteQueuedTasks()
+ {
+ while (true)
+ {
+ Task task;
+
+ lock (_tasks)
+ {
+ if (_tasks.Any())
+ {
+ task = _tasks.First.Value;
+ _tasks.RemoveFirst();
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ if (task != null)
+ {
+ if (!TryExecuteTask(task))
+ {
+ throw new InvalidOperationException();
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/modules/mono/glue/cs_files/IAwaitable.cs b/modules/mono/glue/cs_files/IAwaitable.cs
new file mode 100644
index 0000000000..0397957d00
--- /dev/null
+++ b/modules/mono/glue/cs_files/IAwaitable.cs
@@ -0,0 +1,12 @@
+namespace Godot
+{
+ public interface IAwaitable
+ {
+ IAwaiter GetAwaiter();
+ }
+
+ public interface IAwaitable<out TResult>
+ {
+ IAwaiter<TResult> GetAwaiter();
+ }
+}
diff --git a/modules/mono/glue/cs_files/IAwaiter.cs b/modules/mono/glue/cs_files/IAwaiter.cs
new file mode 100644
index 0000000000..73c71b5634
--- /dev/null
+++ b/modules/mono/glue/cs_files/IAwaiter.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Runtime.CompilerServices;
+
+namespace Godot
+{
+ public interface IAwaiter : INotifyCompletion
+ {
+ bool IsCompleted { get; }
+
+ void GetResult();
+ }
+
+ public interface IAwaiter<out TResult> : INotifyCompletion
+ {
+ bool IsCompleted { get; }
+
+ TResult GetResult();
+ }
+}
diff --git a/modules/mono/glue/cs_files/MarshalUtils.cs b/modules/mono/glue/cs_files/MarshalUtils.cs
new file mode 100644
index 0000000000..5d40111339
--- /dev/null
+++ b/modules/mono/glue/cs_files/MarshalUtils.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+
+namespace Godot
+{
+ internal static class MarshalUtils
+ {
+ private static Dictionary<object, object> ArraysToDictionary(object[] keys, object[] values)
+ {
+ Dictionary<object, object> ret = new Dictionary<object, object>();
+
+ for (int i = 0; i < keys.Length; i++)
+ {
+ ret.Add(keys[i], values[i]);
+ }
+
+ return ret;
+ }
+
+ private static void DictionaryToArrays(Dictionary<object, object> from, out object[] keysTo, out object[] valuesTo)
+ {
+ Dictionary<object, object>.KeyCollection keys = from.Keys;
+ keysTo = new object[keys.Count];
+ keys.CopyTo(keysTo, 0);
+
+ Dictionary<object, object>.ValueCollection values = from.Values;
+ valuesTo = new object[values.Count];
+ values.CopyTo(valuesTo, 0);
+ }
+
+ private static Type GetDictionaryType()
+ {
+ return typeof(Dictionary<object, object>);
+ }
+ }
+}
diff --git a/modules/mono/glue/cs_files/Mathf.cs b/modules/mono/glue/cs_files/Mathf.cs
new file mode 100644
index 0000000000..cb0eb1acdd
--- /dev/null
+++ b/modules/mono/glue/cs_files/Mathf.cs
@@ -0,0 +1,234 @@
+using System;
+
+namespace Godot
+{
+ public static class Mathf
+ {
+ public const float PI = 3.14159274f;
+ public const float Epsilon = 1e-06f;
+
+ private const float Deg2RadConst = 0.0174532924f;
+ private const float Rad2DegConst = 57.29578f;
+
+ public static float abs(float s)
+ {
+ return Math.Abs(s);
+ }
+
+ public static float acos(float s)
+ {
+ return (float)Math.Acos(s);
+ }
+
+ public static float asin(float s)
+ {
+ return (float)Math.Asin(s);
+ }
+
+ public static float atan(float s)
+ {
+ return (float)Math.Atan(s);
+ }
+
+ public static float atan2(float x, float y)
+ {
+ return (float)Math.Atan2(x, y);
+ }
+
+ public static float ceil(float s)
+ {
+ return (float)Math.Ceiling(s);
+ }
+
+ public static float clamp(float val, float min, float max)
+ {
+ if (val < min)
+ {
+ return min;
+ }
+ else if (val > max)
+ {
+ return max;
+ }
+
+ return val;
+ }
+
+ public static float cos(float s)
+ {
+ return (float)Math.Cos(s);
+ }
+
+ public static float cosh(float s)
+ {
+ return (float)Math.Cosh(s);
+ }
+
+ public static int decimals(float step)
+ {
+ return decimals(step);
+ }
+
+ public static int decimals(decimal step)
+ {
+ return BitConverter.GetBytes(decimal.GetBits(step)[3])[2];
+ }
+
+ public static float deg2rad(float deg)
+ {
+ return deg * Deg2RadConst;
+ }
+
+ public static float ease(float s, float curve)
+ {
+ if (s < 0f)
+ {
+ s = 0f;
+ }
+ else if (s > 1.0f)
+ {
+ s = 1.0f;
+ }
+
+ if (curve > 0f)
+ {
+ if (curve < 1.0f)
+ {
+ return 1.0f - pow(1.0f - s, 1.0f / curve);
+ }
+
+ return pow(s, curve);
+ }
+ else if (curve < 0f)
+ {
+ if (s < 0.5f)
+ {
+ return pow(s * 2.0f, -curve) * 0.5f;
+ }
+
+ return (1.0f - pow(1.0f - (s - 0.5f) * 2.0f, -curve)) * 0.5f + 0.5f;
+ }
+
+ return 0f;
+ }
+
+ public static float exp(float s)
+ {
+ return (float)Math.Exp(s);
+ }
+
+ public static float floor(float s)
+ {
+ return (float)Math.Floor(s);
+ }
+
+ public static float fposmod(float x, float y)
+ {
+ if (x >= 0f)
+ {
+ return x % y;
+ }
+ else
+ {
+ return y - (-x % y);
+ }
+ }
+
+ public static float lerp(float from, float to, float weight)
+ {
+ return from + (to - from) * clamp(weight, 0f, 1f);
+ }
+
+ public static float log(float s)
+ {
+ return (float)Math.Log(s);
+ }
+
+ public static int max(int a, int b)
+ {
+ return (a > b) ? a : b;
+ }
+
+ public static float max(float a, float b)
+ {
+ return (a > b) ? a : b;
+ }
+
+ public static int min(int a, int b)
+ {
+ return (a < b) ? a : b;
+ }
+
+ public static float min(float a, float b)
+ {
+ return (a < b) ? a : b;
+ }
+
+ public static int nearest_po2(int val)
+ {
+ val--;
+ val |= val >> 1;
+ val |= val >> 2;
+ val |= val >> 4;
+ val |= val >> 8;
+ val |= val >> 16;
+ val++;
+ return val;
+ }
+
+ public static float pow(float x, float y)
+ {
+ return (float)Math.Pow(x, y);
+ }
+
+ public static float rad2deg(float rad)
+ {
+ return rad * Rad2DegConst;
+ }
+
+ public static float round(float s)
+ {
+ return (float)Math.Round(s);
+ }
+
+ public static float sign(float s)
+ {
+ return (s < 0f) ? -1f : 1f;
+ }
+
+ public static float sin(float s)
+ {
+ return (float)Math.Sin(s);
+ }
+
+ public static float sinh(float s)
+ {
+ return (float)Math.Sinh(s);
+ }
+
+ public static float sqrt(float s)
+ {
+ return (float)Math.Sqrt(s);
+ }
+
+ public static float stepify(float s, float step)
+ {
+ if (step != 0f)
+ {
+ s = floor(s / step + 0.5f) * step;
+ }
+
+ return s;
+ }
+
+ public static float tan(float s)
+ {
+ return (float)Math.Tan(s);
+ }
+
+ public static float tanh(float s)
+ {
+ return (float)Math.Tanh(s);
+ }
+ }
+}
diff --git a/modules/mono/glue/cs_files/Plane.cs b/modules/mono/glue/cs_files/Plane.cs
new file mode 100644
index 0000000000..ada6e465ac
--- /dev/null
+++ b/modules/mono/glue/cs_files/Plane.cs
@@ -0,0 +1,209 @@
+using System;
+
+namespace Godot
+{
+ public struct Plane : IEquatable<Plane>
+ {
+ Vector3 normal;
+
+ public float x
+ {
+ get
+ {
+ return normal.x;
+ }
+ set
+ {
+ normal.x = value;
+ }
+ }
+
+ public float y
+ {
+ get
+ {
+ return normal.y;
+ }
+ set
+ {
+ normal.y = value;
+ }
+ }
+
+ public float z
+ {
+ get
+ {
+ return normal.z;
+ }
+ set
+ {
+ normal.z = value;
+ }
+ }
+
+ float d;
+
+ public Vector3 Center
+ {
+ get
+ {
+ return normal * d;
+ }
+ }
+
+ public float distance_to(Vector3 point)
+ {
+ return normal.dot(point) - d;
+ }
+
+ public Vector3 get_any_point()
+ {
+ return normal * d;
+ }
+
+ public bool has_point(Vector3 point, float epsilon = Mathf.Epsilon)
+ {
+ float dist = normal.dot(point) - d;
+ return Mathf.abs(dist) <= epsilon;
+ }
+
+ public Vector3 intersect_3(Plane b, Plane c)
+ {
+ float denom = normal.cross(b.normal).dot(c.normal);
+
+ if (Mathf.abs(denom) <= Mathf.Epsilon)
+ return new Vector3();
+
+ Vector3 result = (b.normal.cross(c.normal) * this.d) +
+ (c.normal.cross(normal) * b.d) +
+ (normal.cross(b.normal) * c.d);
+
+ return result / denom;
+ }
+
+ public Vector3 intersect_ray(Vector3 from, Vector3 dir)
+ {
+ float den = normal.dot(dir);
+
+ if (Mathf.abs(den) <= Mathf.Epsilon)
+ return new Vector3();
+
+ float dist = (normal.dot(from) - d) / den;
+
+ // This is a ray, before the emiting pos (from) does not exist
+ if (dist > Mathf.Epsilon)
+ return new Vector3();
+
+ return from + dir * -dist;
+ }
+
+ public Vector3 intersect_segment(Vector3 begin, Vector3 end)
+ {
+ Vector3 segment = begin - end;
+ float den = normal.dot(segment);
+
+ if (Mathf.abs(den) <= Mathf.Epsilon)
+ return new Vector3();
+
+ float dist = (normal.dot(begin) - d) / den;
+
+ if (dist < -Mathf.Epsilon || dist > (1.0f + Mathf.Epsilon))
+ return new Vector3();
+
+ return begin + segment * -dist;
+ }
+
+ public bool is_point_over(Vector3 point)
+ {
+ return normal.dot(point) > d;
+ }
+
+ public Plane normalized()
+ {
+ float len = normal.length();
+
+ if (len == 0)
+ return new Plane(0, 0, 0, 0);
+
+ return new Plane(normal / len, d / len);
+ }
+
+ public Vector3 project(Vector3 point)
+ {
+ return point - normal * distance_to(point);
+ }
+
+ public Plane(float a, float b, float c, float d)
+ {
+ normal = new Vector3(a, b, c);
+ this.d = d;
+ }
+
+ public Plane(Vector3 normal, float d)
+ {
+ this.normal = normal;
+ this.d = d;
+ }
+
+ public Plane(Vector3 v1, Vector3 v2, Vector3 v3)
+ {
+ normal = (v1 - v3).cross(v1 - v2);
+ normal.normalize();
+ d = normal.dot(v1);
+ }
+
+ public static Plane operator -(Plane plane)
+ {
+ return new Plane(-plane.normal, -plane.d);
+ }
+
+ public static bool operator ==(Plane left, Plane right)
+ {
+ return left.Equals(right);
+ }
+
+ public static bool operator !=(Plane left, Plane right)
+ {
+ return !left.Equals(right);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (obj is Plane)
+ {
+ return Equals((Plane)obj);
+ }
+
+ return false;
+ }
+
+ public bool Equals(Plane other)
+ {
+ return normal == other.normal && d == other.d;
+ }
+
+ public override int GetHashCode()
+ {
+ return normal.GetHashCode() ^ d.GetHashCode();
+ }
+
+ public override string ToString()
+ {
+ return String.Format("({0}, {1})", new object[]
+ {
+ this.normal.ToString(),
+ this.d.ToString()
+ });
+ }
+
+ public string ToString(string format)
+ {
+ return String.Format("({0}, {1})", new object[]
+ {
+ this.normal.ToString(format),
+ this.d.ToString(format)
+ });
+ }
+ }
+}
diff --git a/modules/mono/glue/cs_files/Quat.cs b/modules/mono/glue/cs_files/Quat.cs
new file mode 100644
index 0000000000..9b4b7fb297
--- /dev/null
+++ b/modules/mono/glue/cs_files/Quat.cs
@@ -0,0 +1,328 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace Godot
+{
+ [StructLayout(LayoutKind.Sequential)]
+ public struct Quat : IEquatable<Quat>
+ {
+ private static readonly Quat identity = new Quat(0f, 0f, 0f, 1f);
+
+ public float x;
+ public float y;
+ public float z;
+ public float w;
+
+ public static Quat Identity
+ {
+ get { return identity; }
+ }
+
+ public float this[int index]
+ {
+ get
+ {
+ switch (index)
+ {
+ case 0:
+ return x;
+ case 1:
+ return y;
+ case 2:
+ return z;
+ case 3:
+ return w;
+ default:
+ throw new IndexOutOfRangeException();
+ }
+ }
+ set
+ {
+ switch (index)
+ {
+ case 0:
+ x = value;
+ break;
+ case 1:
+ y = value;
+ break;
+ case 2:
+ z = value;
+ break;
+ case 3:
+ w = value;
+ break;
+ default:
+ throw new IndexOutOfRangeException();
+ }
+ }
+ }
+
+ public Quat cubic_slerp(Quat b, Quat preA, Quat postB, float t)
+ {
+ float t2 = (1.0f - t) * t * 2f;
+ Quat sp = slerp(b, t);
+ Quat sq = preA.slerpni(postB, t);
+ return sp.slerpni(sq, t2);
+ }
+
+ public float dot(Quat b)
+ {
+ return x * b.x + y * b.y + z * b.z + w * b.w;
+ }
+
+ public Quat inverse()
+ {
+ return new Quat(-x, -y, -z, w);
+ }
+
+ public float length()
+ {
+ return Mathf.sqrt(length_squared());
+ }
+
+ public float length_squared()
+ {
+ return dot(this);
+ }
+
+ public Quat normalized()
+ {
+ return this / length();
+ }
+
+ public void set(float x, float y, float z, float w)
+ {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.w = w;
+ }
+
+ public Quat slerp(Quat b, float t)
+ {
+ // Calculate cosine
+ float cosom = x * b.x + y * b.y + z * b.z + w * b.w;
+
+ float[] to1 = new float[4];
+
+ // Adjust signs if necessary
+ if (cosom < 0.0)
+ {
+ cosom = -cosom; to1[0] = -b.x;
+ to1[1] = -b.y;
+ to1[2] = -b.z;
+ to1[3] = -b.w;
+ }
+ else
+ {
+ to1[0] = b.x;
+ to1[1] = b.y;
+ to1[2] = b.z;
+ to1[3] = b.w;
+ }
+
+ float sinom, scale0, scale1;
+
+ // Calculate coefficients
+ if ((1.0 - cosom) > Mathf.Epsilon)
+ {
+ // Standard case (Slerp)
+ float omega = Mathf.acos(cosom);
+ sinom = Mathf.sin(omega);
+ scale0 = Mathf.sin((1.0f - t) * omega) / sinom;
+ scale1 = Mathf.sin(t * omega) / sinom;
+ }
+ else
+ {
+ // Quaternions are very close so we can do a linear interpolation
+ scale0 = 1.0f - t;
+ scale1 = t;
+ }
+
+ // Calculate final values
+ return new Quat
+ (
+ scale0 * x + scale1 * to1[0],
+ scale0 * y + scale1 * to1[1],
+ scale0 * z + scale1 * to1[2],
+ scale0 * w + scale1 * to1[3]
+ );
+ }
+
+ public Quat slerpni(Quat b, float t)
+ {
+ float dot = this.dot(b);
+
+ if (Mathf.abs(dot) > 0.9999f)
+ {
+ return this;
+ }
+
+ float theta = Mathf.acos(dot);
+ float sinT = 1.0f / Mathf.sin(theta);
+ float newFactor = Mathf.sin(t * theta) * sinT;
+ float invFactor = Mathf.sin((1.0f - t) * theta) * sinT;
+
+ return new Quat
+ (
+ invFactor * this.x + newFactor * b.x,
+ invFactor * this.y + newFactor * b.y,
+ invFactor * this.z + newFactor * b.z,
+ invFactor * this.w + newFactor * b.w
+ );
+ }
+
+ public Vector3 xform(Vector3 v)
+ {
+ Quat q = this * v;
+ q *= this.inverse();
+ return new Vector3(q.x, q.y, q.z);
+ }
+
+ public Quat(float x, float y, float z, float w)
+ {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.w = w;
+ }
+
+ public Quat(Vector3 axis, float angle)
+ {
+ float d = axis.length();
+
+ if (d == 0f)
+ {
+ x = 0f;
+ y = 0f;
+ z = 0f;
+ w = 0f;
+ }
+ else
+ {
+ float s = Mathf.sin(angle * 0.5f) / d;
+
+ x = axis.x * s;
+ y = axis.y * s;
+ z = axis.z * s;
+ w = Mathf.cos(angle * 0.5f);
+ }
+ }
+
+ public static Quat operator *(Quat left, Quat right)
+ {
+ return new Quat
+ (
+ left.w * right.x + left.x * right.w + left.y * right.z - left.z * right.y,
+ left.w * right.y + left.y * right.w + left.z * right.x - left.x * right.z,
+ left.w * right.z + left.z * right.w + left.x * right.y - left.y * right.x,
+ left.w * right.w - left.x * right.x - left.y * right.y - left.z * right.z
+ );
+ }
+
+ public static Quat operator +(Quat left, Quat right)
+ {
+ return new Quat(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w);
+ }
+
+ public static Quat operator -(Quat left, Quat right)
+ {
+ return new Quat(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w);
+ }
+
+ public static Quat operator -(Quat left)
+ {
+ return new Quat(-left.x, -left.y, -left.z, -left.w);
+ }
+
+ public static Quat operator *(Quat left, Vector3 right)
+ {
+ return new Quat
+ (
+ left.w * right.x + left.y * right.z - left.z * right.y,
+ left.w * right.y + left.z * right.x - left.x * right.z,
+ left.w * right.z + left.x * right.y - left.y * right.x,
+ -left.x * right.x - left.y * right.y - left.z * right.z
+ );
+ }
+
+ public static Quat operator *(Vector3 left, Quat right)
+ {
+ return new Quat
+ (
+ right.w * left.x + right.y * left.z - right.z * left.y,
+ right.w * left.y + right.z * left.x - right.x * left.z,
+ right.w * left.z + right.x * left.y - right.y * left.x,
+ -right.x * left.x - right.y * left.y - right.z * left.z
+ );
+ }
+
+ public static Quat operator *(Quat left, float right)
+ {
+ return new Quat(left.x * right, left.y * right, left.z * right, left.w * right);
+ }
+
+ public static Quat operator *(float left, Quat right)
+ {
+ return new Quat(right.x * left, right.y * left, right.z * left, right.w * left);
+ }
+
+ public static Quat operator /(Quat left, float right)
+ {
+ return left * (1.0f / right);
+ }
+
+ public static bool operator ==(Quat left, Quat right)
+ {
+ return left.Equals(right);
+ }
+
+ public static bool operator !=(Quat left, Quat right)
+ {
+ return !left.Equals(right);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (obj is Vector2)
+ {
+ return Equals((Vector2)obj);
+ }
+
+ return false;
+ }
+
+ public bool Equals(Quat other)
+ {
+ return x == other.x && y == other.y && z == other.z && w == other.w;
+ }
+
+ public override int GetHashCode()
+ {
+ return y.GetHashCode() ^ x.GetHashCode() ^ z.GetHashCode() ^ w.GetHashCode();
+ }
+
+ public override string ToString()
+ {
+ return String.Format("({0}, {1}, {2}, {3})", new object[]
+ {
+ this.x.ToString(),
+ this.y.ToString(),
+ this.z.ToString(),
+ this.w.ToString()
+ });
+ }
+
+ public string ToString(string format)
+ {
+ return String.Format("({0}, {1}, {2}, {3})", new object[]
+ {
+ this.x.ToString(format),
+ this.y.ToString(format),
+ this.z.ToString(format),
+ this.w.ToString(format)
+ });
+ }
+ }
+}
diff --git a/modules/mono/glue/cs_files/RPCAttributes.cs b/modules/mono/glue/cs_files/RPCAttributes.cs
new file mode 100644
index 0000000000..08841ffd76
--- /dev/null
+++ b/modules/mono/glue/cs_files/RPCAttributes.cs
@@ -0,0 +1,16 @@
+using System;
+
+namespace Godot
+{
+ [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)]
+ public class RemoteAttribute : Attribute {}
+
+ [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)]
+ public class SyncAttribute : Attribute {}
+
+ [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)]
+ public class MasterAttribute : Attribute {}
+
+ [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)]
+ public class SlaveAttribute : Attribute {}
+}
diff --git a/modules/mono/glue/cs_files/Rect2.cs b/modules/mono/glue/cs_files/Rect2.cs
new file mode 100644
index 0000000000..019342134a
--- /dev/null
+++ b/modules/mono/glue/cs_files/Rect2.cs
@@ -0,0 +1,233 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace Godot
+{
+ [StructLayout(LayoutKind.Sequential)]
+ public struct Rect2 : IEquatable<Rect2>
+ {
+ private Vector2 position;
+ private Vector2 size;
+
+ public Vector2 Position
+ {
+ get { return position; }
+ set { position = value; }
+ }
+
+ public Vector2 Size
+ {
+ get { return size; }
+ set { size = value; }
+ }
+
+ public Vector2 End
+ {
+ get { return position + size; }
+ }
+
+ public float Area
+ {
+ get { return get_area(); }
+ }
+
+ public Rect2 clip(Rect2 b)
+ {
+ Rect2 newRect = b;
+
+ if (!intersects(newRect))
+ return new Rect2();
+
+ newRect.position.x = Mathf.max(b.position.x, position.x);
+ newRect.position.y = Mathf.max(b.position.y, position.y);
+
+ Vector2 bEnd = b.position + b.size;
+ Vector2 end = position + size;
+
+ newRect.size.x = Mathf.min(bEnd.x, end.x) - newRect.position.x;
+ newRect.size.y = Mathf.min(bEnd.y, end.y) - newRect.position.y;
+
+ return newRect;
+ }
+
+ public bool encloses(Rect2 b)
+ {
+ return (b.position.x >= position.x) && (b.position.y >= position.y) &&
+ ((b.position.x + b.size.x) < (position.x + size.x)) &&
+ ((b.position.y + b.size.y) < (position.y + size.y));
+ }
+
+ public Rect2 expand(Vector2 to)
+ {
+ Rect2 expanded = this;
+
+ Vector2 begin = expanded.position;
+ Vector2 end = expanded.position + expanded.size;
+
+ if (to.x < begin.x)
+ begin.x = to.x;
+ if (to.y < begin.y)
+ begin.y = to.y;
+
+ if (to.x > end.x)
+ end.x = to.x;
+ if (to.y > end.y)
+ end.y = to.y;
+
+ expanded.position = begin;
+ expanded.size = end - begin;
+
+ return expanded;
+ }
+
+ public float get_area()
+ {
+ return size.x * size.y;
+ }
+
+ public Rect2 grow(float by)
+ {
+ Rect2 g = this;
+
+ g.position.x -= by;
+ g.position.y -= by;
+ g.size.x += by * 2;
+ g.size.y += by * 2;
+
+ return g;
+ }
+
+ public Rect2 grow_individual(float left, float top, float right, float bottom)
+ {
+ Rect2 g = this;
+
+ g.position.x -= left;
+ g.position.y -= top;
+ g.size.x += left + right;
+ g.size.y += top + bottom;
+
+ return g;
+ }
+
+ public Rect2 grow_margin(int margin, float by)
+ {
+ Rect2 g = this;
+
+ g.grow_individual((GD.MARGIN_LEFT == margin) ? by : 0,
+ (GD.MARGIN_TOP == margin) ? by : 0,
+ (GD.MARGIN_RIGHT == margin) ? by : 0,
+ (GD.MARGIN_BOTTOM == margin) ? by : 0);
+
+ return g;
+ }
+
+ public bool has_no_area()
+ {
+ return size.x <= 0 || size.y <= 0;
+ }
+
+ public bool has_point(Vector2 point)
+ {
+ if (point.x < position.x)
+ return false;
+ if (point.y < position.y)
+ return false;
+
+ if (point.x >= (position.x + size.x))
+ return false;
+ if (point.y >= (position.y + size.y))
+ return false;
+
+ return true;
+ }
+
+ public bool intersects(Rect2 b)
+ {
+ if (position.x > (b.position.x + b.size.x))
+ return false;
+ if ((position.x + size.x) < b.position.x)
+ return false;
+ if (position.y > (b.position.y + b.size.y))
+ return false;
+ if ((position.y + size.y) < b.position.y)
+ return false;
+
+ return true;
+ }
+
+ public Rect2 merge(Rect2 b)
+ {
+ Rect2 newRect;
+
+ newRect.position.x = Mathf.min(b.position.x, position.x);
+ newRect.position.y = Mathf.min(b.position.y, position.y);
+
+ newRect.size.x = Mathf.max(b.position.x + b.size.x, position.x + size.x);
+ newRect.size.y = Mathf.max(b.position.y + b.size.y, position.y + size.y);
+
+ newRect.size = newRect.size - newRect.position; // Make relative again
+
+ return newRect;
+ }
+
+ public Rect2(Vector2 position, Vector2 size)
+ {
+ this.position = position;
+ this.size = size;
+ }
+
+ public Rect2(float x, float y, float width, float height)
+ {
+ this.position = new Vector2(x, y);
+ this.size = new Vector2(width, height);
+ }
+
+ public static bool operator ==(Rect2 left, Rect2 right)
+ {
+ return left.Equals(right);
+ }
+
+ public static bool operator !=(Rect2 left, Rect2 right)
+ {
+ return !left.Equals(right);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (obj is Rect2)
+ {
+ return Equals((Rect2)obj);
+ }
+
+ return false;
+ }
+
+ public bool Equals(Rect2 other)
+ {
+ return position.Equals(other.position) && size.Equals(other.size);
+ }
+
+ public override int GetHashCode()
+ {
+ return position.GetHashCode() ^ size.GetHashCode();
+ }
+
+ public override string ToString()
+ {
+ return String.Format("({0}, {1})", new object[]
+ {
+ this.position.ToString(),
+ this.size.ToString()
+ });
+ }
+
+ public string ToString(string format)
+ {
+ return String.Format("({0}, {1})", new object[]
+ {
+ this.position.ToString(format),
+ this.size.ToString(format)
+ });
+ }
+ }
+} \ No newline at end of file
diff --git a/modules/mono/glue/cs_files/Rect3.cs b/modules/mono/glue/cs_files/Rect3.cs
new file mode 100644
index 0000000000..0d25de1ec6
--- /dev/null
+++ b/modules/mono/glue/cs_files/Rect3.cs
@@ -0,0 +1,477 @@
+using System;
+
+// file: core/math/rect3.h
+// commit: 7ad14e7a3e6f87ddc450f7e34621eb5200808451
+// file: core/math/rect3.cpp
+// commit: bd282ff43f23fe845f29a3e25c8efc01bd65ffb0
+// file: core/variant_call.cpp
+// commit: 5ad9be4c24e9d7dc5672fdc42cea896622fe5685
+
+namespace Godot
+{
+ public struct Rect3 : IEquatable<Rect3>
+ {
+ private Vector3 position;
+ private Vector3 size;
+
+ public Vector3 Position
+ {
+ get
+ {
+ return position;
+ }
+ }
+
+ public Vector3 Size
+ {
+ get
+ {
+ return size;
+ }
+ }
+
+ public Vector3 End
+ {
+ get
+ {
+ return position + size;
+ }
+ }
+
+ public bool encloses(Rect3 with)
+ {
+ Vector3 src_min = position;
+ Vector3 src_max = position + size;
+ Vector3 dst_min = with.position;
+ Vector3 dst_max = with.position + with.size;
+
+ return ((src_min.x <= dst_min.x) &&
+ (src_max.x > dst_max.x) &&
+ (src_min.y <= dst_min.y) &&
+ (src_max.y > dst_max.y) &&
+ (src_min.z <= dst_min.z) &&
+ (src_max.z > dst_max.z));
+ }
+
+ public Rect3 expand(Vector3 to_point)
+ {
+ Vector3 begin = position;
+ Vector3 end = position + size;
+
+ if (to_point.x < begin.x)
+ begin.x = to_point.x;
+ if (to_point.y < begin.y)
+ begin.y = to_point.y;
+ if (to_point.z < begin.z)
+ begin.z = to_point.z;
+
+ if (to_point.x > end.x)
+ end.x = to_point.x;
+ if (to_point.y > end.y)
+ end.y = to_point.y;
+ if (to_point.z > end.z)
+ end.z = to_point.z;
+
+ return new Rect3(begin, end - begin);
+ }
+
+ public float get_area()
+ {
+ return size.x * size.y * size.z;
+ }
+
+ public Vector3 get_endpoint(int idx)
+ {
+ switch (idx)
+ {
+ case 0:
+ return new Vector3(position.x, position.y, position.z);
+ case 1:
+ return new Vector3(position.x, position.y, position.z + size.z);
+ case 2:
+ return new Vector3(position.x, position.y + size.y, position.z);
+ case 3:
+ return new Vector3(position.x, position.y + size.y, position.z + size.z);
+ case 4:
+ return new Vector3(position.x + size.x, position.y, position.z);
+ case 5:
+ return new Vector3(position.x + size.x, position.y, position.z + size.z);
+ case 6:
+ return new Vector3(position.x + size.x, position.y + size.y, position.z);
+ case 7:
+ return new Vector3(position.x + size.x, position.y + size.y, position.z + size.z);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(idx), String.Format("Index is {0}, but a value from 0 to 7 is expected.", idx));
+ }
+ }
+
+ public Vector3 get_longest_axis()
+ {
+ Vector3 axis = new Vector3(1f, 0f, 0f);
+ float max_size = size.x;
+
+ if (size.y > max_size)
+ {
+ axis = new Vector3(0f, 1f, 0f);
+ max_size = size.y;
+ }
+
+ if (size.z > max_size)
+ {
+ axis = new Vector3(0f, 0f, 1f);
+ max_size = size.z;
+ }
+
+ return axis;
+ }
+
+ public Vector3.Axis get_longest_axis_index()
+ {
+ Vector3.Axis axis = Vector3.Axis.X;
+ float max_size = size.x;
+
+ if (size.y > max_size)
+ {
+ axis = Vector3.Axis.Y;
+ max_size = size.y;
+ }
+
+ if (size.z > max_size)
+ {
+ axis = Vector3.Axis.Z;
+ max_size = size.z;
+ }
+
+ return axis;
+ }
+
+ public float get_longest_axis_size()
+ {
+ float max_size = size.x;
+
+ if (size.y > max_size)
+ max_size = size.y;
+
+ if (size.z > max_size)
+ max_size = size.z;
+
+ return max_size;
+ }
+
+ public Vector3 get_shortest_axis()
+ {
+ Vector3 axis = new Vector3(1f, 0f, 0f);
+ float max_size = size.x;
+
+ if (size.y < max_size)
+ {
+ axis = new Vector3(0f, 1f, 0f);
+ max_size = size.y;
+ }
+
+ if (size.z < max_size)
+ {
+ axis = new Vector3(0f, 0f, 1f);
+ max_size = size.z;
+ }
+
+ return axis;
+ }
+
+ public Vector3.Axis get_shortest_axis_index()
+ {
+ Vector3.Axis axis = Vector3.Axis.X;
+ float max_size = size.x;
+
+ if (size.y < max_size)
+ {
+ axis = Vector3.Axis.Y;
+ max_size = size.y;
+ }
+
+ if (size.z < max_size)
+ {
+ axis = Vector3.Axis.Z;
+ max_size = size.z;
+ }
+
+ return axis;
+ }
+
+ public float get_shortest_axis_size()
+ {
+ float max_size = size.x;
+
+ if (size.y < max_size)
+ max_size = size.y;
+
+ if (size.z < max_size)
+ max_size = size.z;
+
+ return max_size;
+ }
+
+ public Vector3 get_support(Vector3 dir)
+ {
+ Vector3 half_extents = size * 0.5f;
+ Vector3 ofs = position + half_extents;
+
+ return ofs + new Vector3(
+ (dir.x > 0f) ? -half_extents.x : half_extents.x,
+ (dir.y > 0f) ? -half_extents.y : half_extents.y,
+ (dir.z > 0f) ? -half_extents.z : half_extents.z);
+ }
+
+ public Rect3 grow(float by)
+ {
+ Rect3 res = this;
+
+ res.position.x -= by;
+ res.position.y -= by;
+ res.position.z -= by;
+ res.size.x += 2.0f * by;
+ res.size.y += 2.0f * by;
+ res.size.z += 2.0f * by;
+
+ return res;
+ }
+
+ public bool has_no_area()
+ {
+ return size.x <= 0f || size.y <= 0f || size.z <= 0f;
+ }
+
+ public bool has_no_surface()
+ {
+ return size.x <= 0f && size.y <= 0f && size.z <= 0f;
+ }
+
+ public bool has_point(Vector3 point)
+ {
+ if (point.x < position.x)
+ return false;
+ if (point.y < position.y)
+ return false;
+ if (point.z < position.z)
+ return false;
+ if (point.x > position.x + size.x)
+ return false;
+ if (point.y > position.y + size.y)
+ return false;
+ if (point.z > position.z + size.z)
+ return false;
+
+ return true;
+ }
+
+ public Rect3 intersection(Rect3 with)
+ {
+ Vector3 src_min = position;
+ Vector3 src_max = position + size;
+ Vector3 dst_min = with.position;
+ Vector3 dst_max = with.position + with.size;
+
+ Vector3 min, max;
+
+ if (src_min.x > dst_max.x || src_max.x < dst_min.x)
+ {
+ return new Rect3();
+ }
+ else
+ {
+ min.x = (src_min.x > dst_min.x) ? src_min.x : dst_min.x;
+ max.x = (src_max.x < dst_max.x) ? src_max.x : dst_max.x;
+ }
+
+ if (src_min.y > dst_max.y || src_max.y < dst_min.y)
+ {
+ return new Rect3();
+ }
+ else
+ {
+ min.y = (src_min.y > dst_min.y) ? src_min.y : dst_min.y;
+ max.y = (src_max.y < dst_max.y) ? src_max.y : dst_max.y;
+ }
+
+ if (src_min.z > dst_max.z || src_max.z < dst_min.z)
+ {
+ return new Rect3();
+ }
+ else
+ {
+ min.z = (src_min.z > dst_min.z) ? src_min.z : dst_min.z;
+ max.z = (src_max.z < dst_max.z) ? src_max.z : dst_max.z;
+ }
+
+ return new Rect3(min, max - min);
+ }
+
+ public bool intersects(Rect3 with)
+ {
+ if (position.x >= (with.position.x + with.size.x))
+ return false;
+ if ((position.x + size.x) <= with.position.x)
+ return false;
+ if (position.y >= (with.position.y + with.size.y))
+ return false;
+ if ((position.y + size.y) <= with.position.y)
+ return false;
+ if (position.z >= (with.position.z + with.size.z))
+ return false;
+ if ((position.z + size.z) <= with.position.z)
+ return false;
+
+ return true;
+ }
+
+ public bool intersects_plane(Plane plane)
+ {
+ Vector3[] points =
+ {
+ new Vector3(position.x, position.y, position.z),
+ new Vector3(position.x, position.y, position.z + size.z),
+ new Vector3(position.x, position.y + size.y, position.z),
+ new Vector3(position.x, position.y + size.y, position.z + size.z),
+ new Vector3(position.x + size.x, position.y, position.z),
+ new Vector3(position.x + size.x, position.y, position.z + size.z),
+ new Vector3(position.x + size.x, position.y + size.y, position.z),
+ new Vector3(position.x + size.x, position.y + size.y, position.z + size.z),
+ };
+
+ bool over = false;
+ bool under = false;
+
+ for (int i = 0; i < 8; i++)
+ {
+ if (plane.distance_to(points[i]) > 0)
+ over = true;
+ else
+ under = true;
+ }
+
+ return under && over;
+ }
+
+ public bool intersects_segment(Vector3 from, Vector3 to)
+ {
+ float min = 0f;
+ float max = 1f;
+
+ for (int i = 0; i < 3; i++)
+ {
+ float seg_from = from[i];
+ float seg_to = to[i];
+ float box_begin = position[i];
+ float box_end = box_begin + size[i];
+ float cmin, cmax;
+
+ if (seg_from < seg_to)
+ {
+ if (seg_from > box_end || seg_to < box_begin)
+ return false;
+
+ float length = seg_to - seg_from;
+ cmin = seg_from < box_begin ? (box_begin - seg_from) / length : 0f;
+ cmax = seg_to > box_end ? (box_end - seg_from) / length : 1f;
+ }
+ else
+ {
+ if (seg_to > box_end || seg_from < box_begin)
+ return false;
+
+ float length = seg_to - seg_from;
+ cmin = seg_from > box_end ? (box_end - seg_from) / length : 0f;
+ cmax = seg_to < box_begin ? (box_begin - seg_from) / length : 1f;
+ }
+
+ if (cmin > min)
+ {
+ min = cmin;
+ }
+
+ if (cmax < max)
+ max = cmax;
+ if (max < min)
+ return false;
+ }
+
+ return true;
+ }
+
+ public Rect3 merge(Rect3 with)
+ {
+ Vector3 beg_1 = position;
+ Vector3 beg_2 = with.position;
+ Vector3 end_1 = new Vector3(size.x, size.y, size.z) + beg_1;
+ Vector3 end_2 = new Vector3(with.size.x, with.size.y, with.size.z) + beg_2;
+
+ Vector3 min = new Vector3(
+ (beg_1.x < beg_2.x) ? beg_1.x : beg_2.x,
+ (beg_1.y < beg_2.y) ? beg_1.y : beg_2.y,
+ (beg_1.z < beg_2.z) ? beg_1.z : beg_2.z
+ );
+
+ Vector3 max = new Vector3(
+ (end_1.x > end_2.x) ? end_1.x : end_2.x,
+ (end_1.y > end_2.y) ? end_1.y : end_2.y,
+ (end_1.z > end_2.z) ? end_1.z : end_2.z
+ );
+
+ return new Rect3(min, max - min);
+ }
+
+ public Rect3(Vector3 position, Vector3 size)
+ {
+ this.position = position;
+ this.size = size;
+ }
+
+ public static bool operator ==(Rect3 left, Rect3 right)
+ {
+ return left.Equals(right);
+ }
+
+ public static bool operator !=(Rect3 left, Rect3 right)
+ {
+ return !left.Equals(right);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (obj is Rect3)
+ {
+ return Equals((Rect3)obj);
+ }
+
+ return false;
+ }
+
+ public bool Equals(Rect3 other)
+ {
+ return position == other.position && size == other.size;
+ }
+
+ public override int GetHashCode()
+ {
+ return position.GetHashCode() ^ size.GetHashCode();
+ }
+
+ public override string ToString()
+ {
+ return String.Format("{0} - {1}", new object[]
+ {
+ this.position.ToString(),
+ this.size.ToString()
+ });
+ }
+
+ public string ToString(string format)
+ {
+ return String.Format("{0} - {1}", new object[]
+ {
+ this.position.ToString(format),
+ this.size.ToString(format)
+ });
+ }
+ }
+}
diff --git a/modules/mono/glue/cs_files/SignalAwaiter.cs b/modules/mono/glue/cs_files/SignalAwaiter.cs
new file mode 100644
index 0000000000..19ccc26e79
--- /dev/null
+++ b/modules/mono/glue/cs_files/SignalAwaiter.cs
@@ -0,0 +1,59 @@
+using System;
+
+namespace Godot
+{
+ public class SignalAwaiter : IAwaiter<object[]>, IAwaitable<object[]>
+ {
+ private bool completed = false;
+ private object[] result = null;
+ private Action action = null;
+
+ public SignalAwaiter(Godot.Object source, string signal, Godot.Object target)
+ {
+ NativeCalls.godot_icall_Object_connect_signal_awaiter(
+ Godot.Object.GetPtr(source),
+ signal, Godot.Object.GetPtr(target), this
+ );
+ }
+
+ public bool IsCompleted
+ {
+ get
+ {
+ return completed;
+ }
+ }
+
+ public void OnCompleted(Action action)
+ {
+ this.action = action;
+ }
+
+ public object[] GetResult()
+ {
+ return result;
+ }
+
+ public IAwaiter<object[]> GetAwaiter()
+ {
+ return this;
+ }
+
+ internal void SignalCallback(object[] args)
+ {
+ completed = true;
+ result = args;
+
+ if (action != null)
+ {
+ action();
+ }
+ }
+
+ internal void FailureCallback()
+ {
+ action = null;
+ completed = true;
+ }
+ }
+}
diff --git a/modules/mono/glue/cs_files/StringExtensions.cs b/modules/mono/glue/cs_files/StringExtensions.cs
new file mode 100644
index 0000000000..96041827aa
--- /dev/null
+++ b/modules/mono/glue/cs_files/StringExtensions.cs
@@ -0,0 +1,962 @@
+//using System;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Security;
+using System.Text;
+using System.Text.RegularExpressions;
+
+namespace Godot
+{
+ public static class StringExtensions
+ {
+ private static int get_slice_count(this string instance, string splitter)
+ {
+ if (instance.empty() || splitter.empty())
+ return 0;
+
+ int pos = 0;
+ int slices = 1;
+
+ while ((pos = instance.find(splitter, pos)) >= 0)
+ {
+ slices++;
+ pos += splitter.Length;
+ }
+
+ return slices;
+ }
+
+ private static string get_slicec(this string instance, char splitter, int slice)
+ {
+ if (!instance.empty() && slice >= 0)
+ {
+ int i = 0;
+ int prev = 0;
+ int count = 0;
+
+ while (true)
+ {
+ if (instance[i] == 0 || instance[i] == splitter)
+ {
+ if (slice == count)
+ {
+ return instance.Substring(prev, i - prev);
+ }
+ else
+ {
+ count++;
+ prev = i + 1;
+ }
+ }
+
+ i++;
+ }
+ }
+
+ return string.Empty;
+ }
+
+ // <summary>
+ // If the string is a path to a file, return the path to the file without the extension.
+ // </summary>
+ public static string basename(this string instance)
+ {
+ int index = instance.LastIndexOf('.');
+
+ if (index > 0)
+ return instance.Substring(0, index);
+
+ return instance;
+ }
+
+ // <summary>
+ // Return true if the strings begins with the given string.
+ // </summary>
+ public static bool begins_with(this string instance, string text)
+ {
+ return instance.StartsWith(text);
+ }
+
+ // <summary>
+ // Return the bigrams (pairs of consecutive letters) of this string.
+ // </summary>
+ public static string[] bigrams(this string instance)
+ {
+ string[] b = new string[instance.Length - 1];
+
+ for (int i = 0; i < b.Length; i++)
+ {
+ b[i] = instance.Substring(i, 2);
+ }
+
+ return b;
+ }
+
+ // <summary>
+ // Return a copy of the string with special characters escaped using the C language standard.
+ // </summary>
+ public static string c_escape(this string instance)
+ {
+ StringBuilder sb = new StringBuilder(string.Copy(instance));
+
+ sb.Replace("\\", "\\\\");
+ sb.Replace("\a", "\\a");
+ sb.Replace("\b", "\\b");
+ sb.Replace("\f", "\\f");
+ sb.Replace("\n", "\\n");
+ sb.Replace("\r", "\\r");
+ sb.Replace("\t", "\\t");
+ sb.Replace("\v", "\\v");
+ sb.Replace("\'", "\\'");
+ sb.Replace("\"", "\\\"");
+ sb.Replace("?", "\\?");
+
+ return sb.ToString();
+ }
+
+ // <summary>
+ // Return a copy of the string with escaped characters replaced by their meanings according to the C language standard.
+ // </summary>
+ public static string c_unescape(this string instance)
+ {
+ StringBuilder sb = new StringBuilder(string.Copy(instance));
+
+ sb.Replace("\\a", "\a");
+ sb.Replace("\\b", "\b");
+ sb.Replace("\\f", "\f");
+ sb.Replace("\\n", "\n");
+ sb.Replace("\\r", "\r");
+ sb.Replace("\\t", "\t");
+ sb.Replace("\\v", "\v");
+ sb.Replace("\\'", "\'");
+ sb.Replace("\\\"", "\"");
+ sb.Replace("\\?", "?");
+ sb.Replace("\\\\", "\\");
+
+ return sb.ToString();
+ }
+
+ // <summary>
+ // Change the case of some letters. Replace underscores with spaces, convert all letters to lowercase then capitalize first and every letter following the space character. For [code]capitalize camelCase mixed_with_underscores[/code] it will return [code]Capitalize Camelcase Mixed With Underscores[/code].
+ // </summary>
+ public static string capitalize(this string instance)
+ {
+ string aux = instance.Replace("_", " ").ToLower();
+ string cap = string.Empty;
+
+ for (int i = 0; i < aux.get_slice_count(" "); i++)
+ {
+ string slice = aux.get_slicec(' ', i);
+ if (slice.Length > 0)
+ {
+ slice = char.ToUpper(slice[0]) + slice.Substring(1);
+ if (i > 0)
+ cap += " ";
+ cap += slice;
+ }
+ }
+
+ return cap;
+ }
+
+ // <summary>
+ // Perform a case-sensitive comparison to another string, return -1 if less, 0 if equal and +1 if greater.
+ // </summary>
+ public static int casecmp_to(this string instance, string to)
+ {
+ if (instance.empty())
+ return to.empty() ? 0 : -1;
+
+ if (to.empty())
+ return 1;
+
+ int instance_idx = 0;
+ int to_idx = 0;
+
+ while (true)
+ {
+ if (to[to_idx] == 0 && instance[instance_idx] == 0)
+ return 0; // We're equal
+ else if (instance[instance_idx] == 0)
+ return -1; // If this is empty, and the other one is not, then we're less... I think?
+ else if (to[to_idx] == 0)
+ return 1; // Otherwise the other one is smaller...
+ else if (instance[instance_idx] < to[to_idx]) // More than
+ return -1;
+ else if (instance[instance_idx] > to[to_idx]) // Less than
+ return 1;
+
+ instance_idx++;
+ to_idx++;
+ }
+ }
+
+ // <summary>
+ // Return true if the string is empty.
+ // </summary>
+ public static bool empty(this string instance)
+ {
+ return string.IsNullOrEmpty(instance);
+ }
+
+ // <summary>
+ // Return true if the strings ends with the given string.
+ // </summary>
+ public static bool ends_with(this string instance, string text)
+ {
+ return instance.EndsWith(text);
+ }
+
+ // <summary>
+ // Erase [code]chars[/code] characters from the string starting from [code]pos[/code].
+ // </summary>
+ public static void erase(this StringBuilder instance, int pos, int chars)
+ {
+ instance.Remove(pos, chars);
+ }
+
+ // <summary>
+ // If the string is a path to a file, return the extension.
+ // </summary>
+ public static string extension(this string instance)
+ {
+ int pos = instance.find_last(".");
+
+ if (pos < 0)
+ return instance;
+
+ return instance.Substring(pos + 1, instance.Length);
+ }
+
+ // <summary>
+ // Find the first occurrence of a substring, return the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed.
+ // </summary>
+ public static int find(this string instance, string what, int from = 0)
+ {
+ return instance.IndexOf(what, StringComparison.OrdinalIgnoreCase);
+ }
+
+ // <summary>
+ // Find the last occurrence of a substring, return the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed.
+ // </summary>
+ public static int find_last(this string instance, string what)
+ {
+ return instance.LastIndexOf(what, StringComparison.OrdinalIgnoreCase);
+ }
+
+ // <summary>
+ // Find the first occurrence of a substring but search as case-insensitive, return the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed.
+ // </summary>
+ public static int findn(this string instance, string what, int from = 0)
+ {
+ return instance.IndexOf(what, StringComparison.Ordinal);
+ }
+
+ // <summary>
+ // If the string is a path to a file, return the base directory.
+ // </summary>
+ public static string get_base_dir(this string instance)
+ {
+ int basepos = instance.find("://");
+
+ string rs = string.Empty;
+ string @base = string.Empty;
+
+ if (basepos != -1)
+ {
+ int end = basepos + 3;
+ rs = instance.Substring(end, instance.Length);
+ @base = instance.Substring(0, end);
+ }
+ else
+ {
+ if (instance.begins_with("/"))
+ {
+ rs = instance.Substring(1, instance.Length);
+ @base = "/";
+ }
+ else
+ {
+ rs = instance;
+ }
+ }
+
+ int sep = Mathf.max(rs.find_last("/"), rs.find_last("\\"));
+
+ if (sep == -1)
+ return @base;
+
+ return @base + rs.substr(0, sep);
+ }
+
+ // <summary>
+ // If the string is a path to a file, return the file and ignore the base directory.
+ // </summary>
+ public static string get_file(this string instance)
+ {
+ int sep = Mathf.max(instance.find_last("/"), instance.find_last("\\"));
+
+ if (sep == -1)
+ return instance;
+
+ return instance.Substring(sep + 1, instance.Length);
+ }
+
+ // <summary>
+ // Hash the string and return a 32 bits integer.
+ // </summary>
+ public static int hash(this string instance)
+ {
+ int index = 0;
+ int hashv = 5381;
+ int c;
+
+ while ((c = (int)instance[index++]) != 0)
+ hashv = ((hashv << 5) + hashv) + c; // hash * 33 + c
+
+ return hashv;
+ }
+
+ // <summary>
+ // Convert a string containing an hexadecimal number into an int.
+ // </summary>
+ public static int hex_to_int(this string instance)
+ {
+ int sign = 1;
+
+ if (instance[0] == '-')
+ {
+ sign = -1;
+ instance = instance.Substring(1);
+ }
+
+ if (!instance.StartsWith("0x"))
+ return 0;
+
+ return sign * int.Parse(instance.Substring(2), NumberStyles.HexNumber);
+ }
+
+ // <summary>
+ // Insert a substring at a given position.
+ // </summary>
+ public static string insert(this string instance, int pos, string what)
+ {
+ return instance.Insert(pos, what);
+ }
+
+ // <summary>
+ // If the string is a path to a file or directory, return true if the path is absolute.
+ // </summary>
+ public static bool is_abs_path(this string instance)
+ {
+ return System.IO.Path.IsPathRooted(instance);
+ }
+
+ // <summary>
+ // If the string is a path to a file or directory, return true if the path is relative.
+ // </summary>
+ public static bool is_rel_path(this string instance)
+ {
+ return !System.IO.Path.IsPathRooted(instance);
+ }
+
+ // <summary>
+ // Check whether this string is a subsequence of the given string.
+ // </summary>
+ public static bool is_subsequence_of(this string instance, string text, bool case_insensitive)
+ {
+ int len = instance.Length;
+
+ if (len == 0)
+ return true; // Technically an empty string is subsequence of any string
+
+ if (len > text.Length)
+ return false;
+
+ int src = 0;
+ int tgt = 0;
+
+ while (instance[src] != 0 && text[tgt] != 0)
+ {
+ bool match = false;
+
+ if (case_insensitive)
+ {
+ char srcc = char.ToLower(instance[src]);
+ char tgtc = char.ToLower(text[tgt]);
+ match = srcc == tgtc;
+ }
+ else
+ {
+ match = instance[src] == text[tgt];
+ }
+ if (match)
+ {
+ src++;
+ if (instance[src] == 0)
+ return true;
+ }
+
+ tgt++;
+ }
+
+ return false;
+ }
+
+ // <summary>
+ // Check whether this string is a subsequence of the given string, considering case.
+ // </summary>
+ public static bool is_subsequence_of(this string instance, string text)
+ {
+ return instance.is_subsequence_of(text, false);
+ }
+
+ // <summary>
+ // Check whether this string is a subsequence of the given string, without considering case.
+ // </summary>
+ public static bool is_subsequence_ofi(this string instance, string text)
+ {
+ return instance.is_subsequence_of(text, true);
+ }
+
+ // <summary>
+ // Check whether the string contains a valid float.
+ // </summary>
+ public static bool is_valid_float(this string instance)
+ {
+ float f;
+ return float.TryParse(instance, out f);
+ }
+
+ // <summary>
+ // Check whether the string contains a valid color in HTML notation.
+ // </summary>
+ public static bool is_valid_html_color(this string instance)
+ {
+ return Color.html_is_valid(instance);
+ }
+
+ // <summary>
+ // Check whether the string is a valid identifier. As is common in programming languages, a valid identifier may contain only letters, digits and underscores (_) and the first character may not be a digit.
+ // </summary>
+ public static bool is_valid_identifier(this string instance)
+ {
+ int len = instance.Length;
+
+ if (len == 0)
+ return false;
+
+ for (int i = 0; i < len; i++)
+ {
+ if (i == 0)
+ {
+ if (instance[0] >= '0' && instance[0] <= '9')
+ return false; // Don't start with number plz
+ }
+
+ bool valid_char = (instance[i] >= '0' && instance[i] <= '9') || (instance[i] >= 'a' && instance[i] <= 'z') || (instance[i] >= 'A' && instance[i] <= 'Z') || instance[i] == '_';
+
+ if (!valid_char)
+ return false;
+ }
+
+ return true;
+ }
+
+ // <summary>
+ // Check whether the string contains a valid integer.
+ // </summary>
+ public static bool is_valid_integer(this string instance)
+ {
+ int f;
+ return int.TryParse(instance, out f);
+ }
+
+ // <summary>
+ // Check whether the string contains a valid IP address.
+ // </summary>
+ public static bool is_valid_ip_address(this string instance)
+ {
+ string[] ip = instance.split(".");
+
+ if (ip.Length != 4)
+ return false;
+
+ for (int i = 0; i < ip.Length; i++)
+ {
+ string n = ip[i];
+ if (!n.is_valid_integer())
+ return false;
+
+ int val = n.to_int();
+ if (val < 0 || val > 255)
+ return false;
+ }
+
+ return true;
+ }
+
+ // <summary>
+ // Return a copy of the string with special characters escaped using the JSON standard.
+ // </summary>
+ public static string json_escape(this string instance)
+ {
+ StringBuilder sb = new StringBuilder(string.Copy(instance));
+
+ sb.Replace("\\", "\\\\");
+ sb.Replace("\b", "\\b");
+ sb.Replace("\f", "\\f");
+ sb.Replace("\n", "\\n");
+ sb.Replace("\r", "\\r");
+ sb.Replace("\t", "\\t");
+ sb.Replace("\v", "\\v");
+ sb.Replace("\"", "\\\"");
+
+ return sb.ToString();
+ }
+
+ // <summary>
+ // Return an amount of characters from the left of the string.
+ // </summary>
+ public static string left(this string instance, int pos)
+ {
+ if (pos <= 0)
+ return string.Empty;
+
+ if (pos >= instance.Length)
+ return instance;
+
+ return instance.Substring(0, pos);
+ }
+
+ /// <summary>
+ /// Return the length of the string in characters.
+ /// </summary>
+ public static int length(this string instance)
+ {
+ return instance.Length;
+ }
+
+ // <summary>
+ // Do a simple expression match, where '*' matches zero or more arbitrary characters and '?' matches any single character except '.'.
+ // </summary>
+ public static bool expr_match(this string instance, string expr, bool case_sensitive)
+ {
+ if (expr.Length == 0 || instance.Length == 0)
+ return false;
+
+ switch (expr[0])
+ {
+ case '\0':
+ return instance[0] == 0;
+ case '*':
+ return expr_match(expr + 1, instance, case_sensitive) || (instance[0] != 0 && expr_match(expr, instance + 1, case_sensitive));
+ case '?':
+ return instance[0] != 0 && instance[0] != '.' && expr_match(expr + 1, instance + 1, case_sensitive);
+ default:
+ return (case_sensitive ? instance[0] == expr[0] : char.ToUpper(instance[0]) == char.ToUpper(expr[0])) &&
+ expr_match(expr + 1, instance + 1, case_sensitive);
+ }
+ }
+
+ // <summary>
+ // Do a simple case sensitive expression match, using ? and * wildcards (see [method expr_match]).
+ // </summary>
+ public static bool match(this string instance, string expr)
+ {
+ return instance.expr_match(expr, true);
+ }
+
+ // <summary>
+ // Do a simple case insensitive expression match, using ? and * wildcards (see [method expr_match]).
+ // </summary>
+ public static bool matchn(this string instance, string expr)
+ {
+ return instance.expr_match(expr, false);
+ }
+
+ // <summary>
+ // Return the MD5 hash of the string as an array of bytes.
+ // </summary>
+ public static byte[] md5_buffer(this string instance)
+ {
+ return NativeCalls.godot_icall_String_md5_buffer(instance);
+ }
+
+ // <summary>
+ // Return the MD5 hash of the string as a string.
+ // </summary>
+ public static string md5_text(this string instance)
+ {
+ return NativeCalls.godot_icall_String_md5_text(instance);
+ }
+
+ // <summary>
+ // Perform a case-insensitive comparison to another string, return -1 if less, 0 if equal and +1 if greater.
+ // </summary>
+ public static int nocasecmp_to(this string instance, string to)
+ {
+ if (instance.empty())
+ return to.empty() ? 0 : -1;
+
+ if (to.empty())
+ return 1;
+
+ int instance_idx = 0;
+ int to_idx = 0;
+
+ while (true)
+ {
+ if (to[to_idx] == 0 && instance[instance_idx] == 0)
+ return 0; // We're equal
+ else if (instance[instance_idx] == 0)
+ return -1; // If this is empty, and the other one is not, then we're less... I think?
+ else if (to[to_idx] == 0)
+ return 1; // Otherwise the other one is smaller..
+ else if (char.ToUpper(instance[instance_idx]) < char.ToUpper(to[to_idx])) // More than
+ return -1;
+ else if (char.ToUpper(instance[instance_idx]) > char.ToUpper(to[to_idx])) // Less than
+ return 1;
+
+ instance_idx++;
+ to_idx++;
+ }
+ }
+
+ // <summary>
+ // Return the character code at position [code]at[/code].
+ // </summary>
+ public static int ord_at(this string instance, int at)
+ {
+ return instance[at];
+ }
+
+ // <summary>
+ // Format a number to have an exact number of [code]digits[/code] after the decimal point.
+ // </summary>
+ public static string pad_decimals(this string instance, int digits)
+ {
+ int c = instance.find(".");
+
+ if (c == -1)
+ {
+ if (digits <= 0)
+ return instance;
+
+ instance += ".";
+ c = instance.Length - 1;
+ }
+ else
+ {
+ if (digits <= 0)
+ return instance.Substring(0, c);
+ }
+
+ if (instance.Length - (c + 1) > digits)
+ {
+ instance = instance.Substring(0, c + digits + 1);
+ }
+ else
+ {
+ while (instance.Length - (c + 1) < digits)
+ {
+ instance += "0";
+ }
+ }
+
+ return instance;
+ }
+
+ // <summary>
+ // Format a number to have an exact number of [code]digits[/code] before the decimal point.
+ // </summary>
+ public static string pad_zeros(this string instance, int digits)
+ {
+ string s = instance;
+ int end = s.find(".");
+
+ if (end == -1)
+ end = s.Length;
+
+ if (end == 0)
+ return s;
+
+ int begin = 0;
+
+ while (begin < end && (s[begin] < '0' || s[begin] > '9'))
+ {
+ begin++;
+ }
+
+ if (begin >= end)
+ return s;
+
+ while (end - begin < digits)
+ {
+ s = s.Insert(begin, "0");
+ end++;
+ }
+
+ return s;
+ }
+
+ // <summary>
+ // Decode a percent-encoded string. See [method percent_encode].
+ // </summary>
+ public static string percent_decode(this string instance)
+ {
+ return Uri.UnescapeDataString(instance);
+ }
+
+ // <summary>
+ // Percent-encode a string. This is meant to encode parameters in a URL when sending a HTTP GET request and bodies of form-urlencoded POST request.
+ // </summary>
+ public static string percent_encode(this string instance)
+ {
+ return Uri.EscapeDataString(instance);
+ }
+
+ // <summary>
+ // If the string is a path, this concatenates [code]file[/code] at the end of the string as a subpath. E.g. [code]"this/is".plus_file("path") == "this/is/path"[/code].
+ // </summary>
+ public static string plus_file(this string instance, string file)
+ {
+ if (instance.Length > 0 && instance[instance.Length - 1] == '/')
+ return instance + file;
+ else
+ return instance + "/" + file;
+ }
+
+ // <summary>
+ // Replace occurrences of a substring for different ones inside the string.
+ // </summary>
+ public static string replace(this string instance, string what, string forwhat)
+ {
+ return instance.Replace(what, forwhat);
+ }
+
+ // <summary>
+ // Replace occurrences of a substring for different ones inside the string, but search case-insensitive.
+ // </summary>
+ public static string replacen(this string instance, string what, string forwhat)
+ {
+ return Regex.Replace(instance, what, forwhat, RegexOptions.IgnoreCase);
+ }
+
+ // <summary>
+ // Perform a search for a substring, but start from the end of the string instead of the beginning.
+ // </summary>
+ public static int rfind(this string instance, string what, int from = -1)
+ {
+ return NativeCalls.godot_icall_String_rfind(instance, what, from);
+ }
+
+ // <summary>
+ // Perform a search for a substring, but start from the end of the string instead of the beginning. Also search case-insensitive.
+ // </summary>
+ public static int rfindn(this string instance, string what, int from = -1)
+ {
+ return NativeCalls.godot_icall_String_rfindn(instance, what, from);
+ }
+
+ // <summary>
+ // Return the right side of the string from a given position.
+ // </summary>
+ public static string right(this string instance, int pos)
+ {
+ if (pos >= instance.Length)
+ return instance;
+
+ if (pos < 0)
+ return string.Empty;
+
+ return instance.Substring(pos, (instance.Length - pos));
+ }
+
+ public static byte[] sha256_buffer(this string instance)
+ {
+ return NativeCalls.godot_icall_String_sha256_buffer(instance);
+ }
+
+ // <summary>
+ // Return the SHA-256 hash of the string as a string.
+ // </summary>
+ public static string sha256_text(this string instance)
+ {
+ return NativeCalls.godot_icall_String_sha256_text(instance);
+ }
+
+ // <summary>
+ // Return the similarity index of the text compared to this string. 1 means totally similar and 0 means totally dissimilar.
+ // </summary>
+ public static float similarity(this string instance, string text)
+ {
+ if (instance == text)
+ {
+ // Equal strings are totally similar
+ return 1.0f;
+ }
+ if (instance.Length < 2 || text.Length < 2)
+ {
+ // No way to calculate similarity without a single bigram
+ return 0.0f;
+ }
+
+ string[] src_bigrams = instance.bigrams();
+ string[] tgt_bigrams = text.bigrams();
+
+ int src_size = src_bigrams.Length;
+ int tgt_size = tgt_bigrams.Length;
+
+ float sum = src_size + tgt_size;
+ float inter = 0;
+
+ for (int i = 0; i < src_size; i++)
+ {
+ for (int j = 0; j < tgt_size; j++)
+ {
+ if (src_bigrams[i] == tgt_bigrams[j])
+ {
+ inter++;
+ break;
+ }
+ }
+ }
+
+ return (2.0f * inter) / sum;
+ }
+
+ // <summary>
+ // Split the string by a divisor string, return an array of the substrings. Example "One,Two,Three" will return ["One","Two","Three"] if split by ",".
+ // </summary>
+ public static string[] split(this string instance, string divisor, bool allow_empty = true)
+ {
+ return instance.Split(new string[] { divisor }, StringSplitOptions.RemoveEmptyEntries);
+ }
+
+ // <summary>
+ // Split the string in floats by using a divisor string, return an array of the substrings. Example "1,2.5,3" will return [1,2.5,3] if split by ",".
+ // </summary>
+ public static float[] split_floats(this string instance, string divisor, bool allow_empty = true)
+ {
+ List<float> ret = new List<float>();
+ int from = 0;
+ int len = instance.Length;
+
+ while (true)
+ {
+ int end = instance.find(divisor, from);
+ if (end < 0)
+ end = len;
+ if (allow_empty || (end > from))
+ ret.Add(float.Parse(instance.Substring(from)));
+ if (end == len)
+ break;
+
+ from = end + divisor.Length;
+ }
+
+ return ret.ToArray();
+ }
+
+ private static readonly char[] non_printable = {
+ (char)00, (char)01, (char)02, (char)03, (char)04, (char)05,
+ (char)06, (char)07, (char)08, (char)09, (char)10, (char)11,
+ (char)12, (char)13, (char)14, (char)15, (char)16, (char)17,
+ (char)18, (char)19, (char)20, (char)21, (char)22, (char)23,
+ (char)24, (char)25, (char)26, (char)27, (char)28, (char)29,
+ (char)30, (char)31, (char)32
+ };
+
+ // <summary>
+ // Return a copy of the string stripped of any non-printable character at the beginning and the end. The optional arguments are used to toggle stripping on the left and right edges respectively.
+ // </summary>
+ public static string strip_edges(this string instance, bool left = true, bool right = true)
+ {
+ if (left)
+ {
+ if (right)
+ return instance.Trim(non_printable);
+ else
+ return instance.TrimStart(non_printable);
+ }
+ else
+ {
+ return instance.TrimEnd(non_printable);
+ }
+ }
+
+ // <summary>
+ // Return part of the string from the position [code]from[/code], with length [code]len[/code].
+ // </summary>
+ public static string substr(this string instance, int from, int len)
+ {
+ return instance.Substring(from, len);
+ }
+
+ // <summary>
+ // Convert the String (which is a character array) to PoolByteArray (which is an array of bytes). The conversion is speeded up in comparison to to_utf8() with the assumption that all the characters the String contains are only ASCII characters.
+ // </summary>
+ public static byte[] to_ascii(this string instance)
+ {
+ return Encoding.ASCII.GetBytes(instance);
+ }
+
+ // <summary>
+ // Convert a string, containing a decimal number, into a [code]float[/code].
+ // </summary>
+ public static float to_float(this string instance)
+ {
+ return float.Parse(instance);
+ }
+
+ // <summary>
+ // Convert a string, containing an integer number, into an [code]int[/code].
+ // </summary>
+ public static int to_int(this string instance)
+ {
+ return int.Parse(instance);
+ }
+
+ // <summary>
+ // Return the string converted to lowercase.
+ // </summary>
+ public static string to_lower(this string instance)
+ {
+ return instance.ToLower();
+ }
+
+ // <summary>
+ // Return the string converted to uppercase.
+ // </summary>
+ public static string to_upper(this string instance)
+ {
+ return instance.ToUpper();
+ }
+
+ // <summary>
+ // Convert the String (which is an array of characters) to PoolByteArray (which is an array of bytes). The conversion is a bit slower than to_ascii(), but supports all UTF-8 characters. Therefore, you should prefer this function over to_ascii().
+ // </summary>
+ public static byte[] to_utf8(this string instance)
+ {
+ return Encoding.UTF8.GetBytes(instance);
+ }
+
+ // <summary>
+ // Return a copy of the string with special characters escaped using the XML standard.
+ // </summary>
+ public static string xml_escape(this string instance)
+ {
+ return SecurityElement.Escape(instance);
+ }
+
+ // <summary>
+ // Return a copy of the string with escaped characters replaced by their meanings according to the XML standard.
+ // </summary>
+ public static string xml_unescape(this string instance)
+ {
+ return SecurityElement.FromString(instance).Text;
+ }
+ }
+}
diff --git a/modules/mono/glue/cs_files/ToolAttribute.cs b/modules/mono/glue/cs_files/ToolAttribute.cs
new file mode 100644
index 0000000000..0275982c7f
--- /dev/null
+++ b/modules/mono/glue/cs_files/ToolAttribute.cs
@@ -0,0 +1,7 @@
+using System;
+
+namespace Godot
+{
+ [AttributeUsage(AttributeTargets.Class)]
+ public class ToolAttribute : Attribute {}
+}
diff --git a/modules/mono/glue/cs_files/Transform.cs b/modules/mono/glue/cs_files/Transform.cs
new file mode 100644
index 0000000000..74271e758b
--- /dev/null
+++ b/modules/mono/glue/cs_files/Transform.cs
@@ -0,0 +1,174 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace Godot
+{
+ [StructLayout(LayoutKind.Sequential)]
+ public struct Transform : IEquatable<Transform>
+ {
+ public Basis basis;
+ public Vector3 origin;
+
+ public Transform affine_inverse()
+ {
+ Basis basisInv = basis.inverse();
+ return new Transform(basisInv, basisInv.xform(-origin));
+ }
+
+ public Transform inverse()
+ {
+ Basis basisTr = basis.transposed();
+ return new Transform(basisTr, basisTr.xform(-origin));
+ }
+
+ public Transform looking_at(Vector3 target, Vector3 up)
+ {
+ Transform t = this;
+ t.set_look_at(origin, target, up);
+ return t;
+ }
+
+ public Transform orthonormalized()
+ {
+ return new Transform(basis.orthonormalized(), origin);
+ }
+
+ public Transform rotated(Vector3 axis, float phi)
+ {
+ return new Transform(new Basis(axis, phi), new Vector3()) * this;
+ }
+
+ public Transform scaled(Vector3 scale)
+ {
+ return new Transform(basis.scaled(scale), origin * scale);
+ }
+
+ public void set_look_at(Vector3 eye, Vector3 target, Vector3 up)
+ {
+ // Make rotation matrix
+ // Z vector
+ Vector3 zAxis = eye - target;
+
+ zAxis.normalize();
+
+ Vector3 yAxis = up;
+
+ Vector3 xAxis = yAxis.cross(zAxis);
+
+ // Recompute Y = Z cross X
+ yAxis = zAxis.cross(xAxis);
+
+ xAxis.normalize();
+ yAxis.normalize();
+
+ basis = Basis.create_from_axes(xAxis, yAxis, zAxis);
+
+ origin = eye;
+ }
+
+ public Transform translated(Vector3 ofs)
+ {
+ return new Transform(basis, new Vector3
+ (
+ origin[0] += basis[0].dot(ofs),
+ origin[1] += basis[1].dot(ofs),
+ origin[2] += basis[2].dot(ofs)
+ ));
+ }
+
+ public Vector3 xform(Vector3 v)
+ {
+ return new Vector3
+ (
+ basis[0].dot(v) + origin.x,
+ basis[1].dot(v) + origin.y,
+ basis[2].dot(v) + origin.z
+ );
+ }
+
+ public Vector3 xform_inv(Vector3 v)
+ {
+ Vector3 vInv = v - origin;
+
+ return new Vector3
+ (
+ (basis[0, 0] * vInv.x) + (basis[1, 0] * vInv.y) + (basis[2, 0] * vInv.z),
+ (basis[0, 1] * vInv.x) + (basis[1, 1] * vInv.y) + (basis[2, 1] * vInv.z),
+ (basis[0, 2] * vInv.x) + (basis[1, 2] * vInv.y) + (basis[2, 2] * vInv.z)
+ );
+ }
+
+ public Transform(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis, Vector3 origin)
+ {
+ this.basis = Basis.create_from_axes(xAxis, yAxis, zAxis);
+ this.origin = origin;
+ }
+
+ public Transform(Quat quat, Vector3 origin)
+ {
+ this.basis = new Basis(quat);
+ this.origin = origin;
+ }
+
+ public Transform(Basis basis, Vector3 origin)
+ {
+ this.basis = basis;
+ this.origin = origin;
+ }
+
+ public static Transform operator *(Transform left, Transform right)
+ {
+ left.origin = left.xform(right.origin);
+ left.basis *= right.basis;
+ return left;
+ }
+
+ public static bool operator ==(Transform left, Transform right)
+ {
+ return left.Equals(right);
+ }
+
+ public static bool operator !=(Transform left, Transform right)
+ {
+ return !left.Equals(right);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (obj is Transform)
+ {
+ return Equals((Transform)obj);
+ }
+
+ return false;
+ }
+
+ public bool Equals(Transform other)
+ {
+ return basis.Equals(other.basis) && origin.Equals(other.origin);
+ }
+
+ public override int GetHashCode()
+ {
+ return basis.GetHashCode() ^ origin.GetHashCode();
+ }
+
+ public override string ToString()
+ {
+ return String.Format("{0} - {1}", new object[]
+ {
+ this.basis.ToString(),
+ this.origin.ToString()
+ });
+ }
+
+ public string ToString(string format)
+ {
+ return String.Format("{0} - {1}", new object[]
+ {
+ this.basis.ToString(format),
+ this.origin.ToString(format)
+ });
+ }
+ }
+}
diff --git a/modules/mono/glue/cs_files/Transform2D.cs b/modules/mono/glue/cs_files/Transform2D.cs
new file mode 100644
index 0000000000..526dc767c6
--- /dev/null
+++ b/modules/mono/glue/cs_files/Transform2D.cs
@@ -0,0 +1,356 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace Godot
+{
+ [StructLayout(LayoutKind.Sequential)]
+ public struct Transform2D : IEquatable<Transform2D>
+ {
+ private static readonly Transform2D identity = new Transform2D
+ (
+ new Vector2(1f, 0f),
+ new Vector2(0f, 1f),
+ new Vector2(0f, 0f)
+ );
+
+ public Vector2 x;
+ public Vector2 y;
+ public Vector2 o;
+
+ public static Transform2D Identity
+ {
+ get { return identity; }
+ }
+
+ public Vector2 Origin
+ {
+ get { return o; }
+ }
+
+ public float Rotation
+ {
+ get { return Mathf.atan2(y.x, o.y); }
+ }
+
+ public Vector2 Scale
+ {
+ get { return new Vector2(x.length(), y.length()); }
+ }
+
+ public Vector2 this[int index]
+ {
+ get
+ {
+ switch (index)
+ {
+ case 0:
+ return x;
+ case 1:
+ return y;
+ case 2:
+ return o;
+ default:
+ throw new IndexOutOfRangeException();
+ }
+ }
+ set
+ {
+ switch (index)
+ {
+ case 0:
+ x = value;
+ return;
+ case 1:
+ y = value;
+ return;
+ case 2:
+ o = value;
+ return;
+ default:
+ throw new IndexOutOfRangeException();
+ }
+ }
+ }
+
+
+ public float this[int index, int axis]
+ {
+ get
+ {
+ switch (index)
+ {
+ case 0:
+ return x[axis];
+ case 1:
+ return y[axis];
+ default:
+ throw new IndexOutOfRangeException();
+ }
+ }
+ set
+ {
+ switch (index)
+ {
+ case 0:
+ x[axis] = value;
+ return;
+ case 1:
+ y[axis] = value;
+ return;
+ default:
+ throw new IndexOutOfRangeException();
+ }
+ }
+ }
+
+ public Transform2D affine_inverse()
+ {
+ Transform2D inv = this;
+
+ float det = this[0, 0] * this[1, 1] - this[1, 0] * this[0, 1];
+
+ if (det == 0)
+ {
+ return new Transform2D
+ (
+ float.NaN, float.NaN,
+ float.NaN, float.NaN,
+ float.NaN, float.NaN
+ );
+ }
+
+ float idet = 1.0f / det;
+
+ float temp = this[0, 0];
+ this[0, 0] = this[1, 1];
+ this[1, 1] = temp;
+
+ this[0] *= new Vector2(idet, -idet);
+ this[1] *= new Vector2(-idet, idet);
+
+ this[2] = basis_xform(-this[2]);
+
+ return inv;
+ }
+
+ public Vector2 basis_xform(Vector2 v)
+ {
+ return new Vector2(tdotx(v), tdoty(v));
+ }
+
+ public Vector2 basis_xform_inv(Vector2 v)
+ {
+ return new Vector2(x.dot(v), y.dot(v));
+ }
+
+ public Transform2D interpolate_with(Transform2D m, float c)
+ {
+ float r1 = Rotation;
+ float r2 = m.Rotation;
+
+ Vector2 s1 = Scale;
+ Vector2 s2 = m.Scale;
+
+ // Slerp rotation
+ Vector2 v1 = new Vector2(Mathf.cos(r1), Mathf.sin(r1));
+ Vector2 v2 = new Vector2(Mathf.cos(r2), Mathf.sin(r2));
+
+ float dot = v1.dot(v2);
+
+ // Clamp dot to [-1, 1]
+ dot = (dot < -1.0f) ? -1.0f : ((dot > 1.0f) ? 1.0f : dot);
+
+ Vector2 v = new Vector2();
+
+ if (dot > 0.9995f)
+ {
+ // Linearly interpolate to avoid numerical precision issues
+ v = v1.linear_interpolate(v2, c).normalized();
+ }
+ else
+ {
+ float angle = c * Mathf.acos(dot);
+ Vector2 v3 = (v2 - v1 * dot).normalized();
+ v = v1 * Mathf.cos(angle) + v3 * Mathf.sin(angle);
+ }
+
+ // Extract parameters
+ Vector2 p1 = Origin;
+ Vector2 p2 = m.Origin;
+
+ // Construct matrix
+ Transform2D res = new Transform2D(Mathf.atan2(v.y, v.x), p1.linear_interpolate(p2, c));
+ Vector2 scale = s1.linear_interpolate(s2, c);
+ res.x *= scale;
+ res.y *= scale;
+
+ return res;
+ }
+
+ public Transform2D inverse()
+ {
+ Transform2D inv = this;
+
+ // Swap
+ float temp = inv.x.y;
+ inv.x.y = inv.y.x;
+ inv.y.x = temp;
+
+ inv.o = inv.basis_xform(-inv.o);
+
+ return inv;
+ }
+
+ public Transform2D orthonormalized()
+ {
+ Transform2D on = this;
+
+ Vector2 onX = on.x;
+ Vector2 onY = on.y;
+
+ onX.normalize();
+ onY = onY - onX * (onX.dot(onY));
+ onY.normalize();
+
+ on.x = onX;
+ on.y = onY;
+
+ return on;
+ }
+
+ public Transform2D rotated(float phi)
+ {
+ return this * new Transform2D(phi, new Vector2());
+ }
+
+ public Transform2D scaled(Vector2 scale)
+ {
+ Transform2D copy = this;
+ copy.x *= scale;
+ copy.y *= scale;
+ copy.o *= scale;
+ return copy;
+ }
+
+ private float tdotx(Vector2 with)
+ {
+ return this[0, 0] * with[0] + this[1, 0] * with[1];
+ }
+
+ private float tdoty(Vector2 with)
+ {
+ return this[0, 1] * with[0] + this[1, 1] * with[1];
+ }
+
+ public Transform2D translated(Vector2 offset)
+ {
+ Transform2D copy = this;
+ copy.o += copy.basis_xform(offset);
+ return copy;
+ }
+
+ public Vector2 xform(Vector2 v)
+ {
+ return new Vector2(tdotx(v), tdoty(v)) + o;
+ }
+
+ public Vector2 xform_inv(Vector2 v)
+ {
+ Vector2 vInv = v - o;
+ return new Vector2(x.dot(vInv), y.dot(vInv));
+ }
+
+ public Transform2D(Vector2 xAxis, Vector2 yAxis, Vector2 origin)
+ {
+ this.x = xAxis;
+ this.y = yAxis;
+ this.o = origin;
+ }
+ public Transform2D(float xx, float xy, float yx, float yy, float ox, float oy)
+ {
+ this.x = new Vector2(xx, xy);
+ this.y = new Vector2(yx, yy);
+ this.o = new Vector2(ox, oy);
+ }
+
+ public Transform2D(float rot, Vector2 pos)
+ {
+ float cr = Mathf.cos(rot);
+ float sr = Mathf.sin(rot);
+ x.x = cr;
+ y.y = cr;
+ x.y = -sr;
+ y.x = sr;
+ o = pos;
+ }
+
+ public static Transform2D operator *(Transform2D left, Transform2D right)
+ {
+ left.o = left.xform(right.o);
+
+ float x0, x1, y0, y1;
+
+ x0 = left.tdotx(right.x);
+ x1 = left.tdoty(right.x);
+ y0 = left.tdotx(right.y);
+ y1 = left.tdoty(right.y);
+
+ left.x.x = x0;
+ left.x.y = x1;
+ left.y.x = y0;
+ left.y.y = y1;
+
+ return left;
+ }
+
+ public static bool operator ==(Transform2D left, Transform2D right)
+ {
+ return left.Equals(right);
+ }
+
+ public static bool operator !=(Transform2D left, Transform2D right)
+ {
+ return !left.Equals(right);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (obj is Transform2D)
+ {
+ return Equals((Transform2D)obj);
+ }
+
+ return false;
+ }
+
+ public bool Equals(Transform2D other)
+ {
+ return x.Equals(other.x) && y.Equals(other.y) && o.Equals(other.o);
+ }
+
+ public override int GetHashCode()
+ {
+ return x.GetHashCode() ^ y.GetHashCode() ^ o.GetHashCode();
+ }
+
+ public override string ToString()
+ {
+ return String.Format("({0}, {1}, {2})", new object[]
+ {
+ this.x.ToString(),
+ this.y.ToString(),
+ this.o.ToString()
+ });
+ }
+
+ public string ToString(string format)
+ {
+ return String.Format("({0}, {1}, {2})", new object[]
+ {
+ this.x.ToString(format),
+ this.y.ToString(format),
+ this.o.ToString(format)
+ });
+ }
+ }
+}
diff --git a/modules/mono/glue/cs_files/Vector2.cs b/modules/mono/glue/cs_files/Vector2.cs
new file mode 100644
index 0000000000..28fedc365b
--- /dev/null
+++ b/modules/mono/glue/cs_files/Vector2.cs
@@ -0,0 +1,362 @@
+using System;
+using System.Runtime.InteropServices;
+
+// file: core/math/math_2d.h
+// commit: 7ad14e7a3e6f87ddc450f7e34621eb5200808451
+// file: core/math/math_2d.cpp
+// commit: 7ad14e7a3e6f87ddc450f7e34621eb5200808451
+// file: core/variant_call.cpp
+// commit: 5ad9be4c24e9d7dc5672fdc42cea896622fe5685
+
+namespace Godot
+{
+ [StructLayout(LayoutKind.Sequential)]
+ public struct Vector2 : IEquatable<Vector2>
+ {
+ public float x;
+ public float y;
+
+ public float this[int index]
+ {
+ get
+ {
+ switch (index)
+ {
+ case 0:
+ return x;
+ case 1:
+ return y;
+ default:
+ throw new IndexOutOfRangeException();
+ }
+ }
+ set
+ {
+ switch (index)
+ {
+ case 0:
+ x = value;
+ return;
+ case 1:
+ y = value;
+ return;
+ default:
+ throw new IndexOutOfRangeException();
+ }
+ }
+ }
+
+ internal void normalize()
+ {
+ float length = x * x + y * y;
+
+ if (length != 0f)
+ {
+ length = Mathf.sqrt(length);
+ x /= length;
+ y /= length;
+ }
+ }
+
+ private float cross(Vector2 b)
+ {
+ return x * b.y - y * b.x;
+ }
+
+ public Vector2 abs()
+ {
+ return new Vector2(Mathf.abs(x), Mathf.abs(y));
+ }
+
+ public float angle()
+ {
+ return Mathf.atan2(y, x);
+ }
+
+ public float angle_to(Vector2 to)
+ {
+ return Mathf.atan2(cross(to), dot(to));
+ }
+
+ public float angle_to_point(Vector2 to)
+ {
+ return Mathf.atan2(x - to.x, y - to.y);
+ }
+
+ public float aspect()
+ {
+ return x / y;
+ }
+
+ public Vector2 bounce(Vector2 n)
+ {
+ return -reflect(n);
+ }
+
+ public Vector2 clamped(float length)
+ {
+ Vector2 v = this;
+ float l = this.length();
+
+ if (l > 0 && length < l)
+ {
+ v /= l;
+ v *= length;
+ }
+
+ return v;
+ }
+
+ public Vector2 cubic_interpolate(Vector2 b, Vector2 preA, Vector2 postB, float t)
+ {
+ Vector2 p0 = preA;
+ Vector2 p1 = this;
+ Vector2 p2 = b;
+ Vector2 p3 = postB;
+
+ float t2 = t * t;
+ float t3 = t2 * t;
+
+ return 0.5f * ((p1 * 2.0f) +
+ (-p0 + p2) * t +
+ (2.0f * p0 - 5.0f * p1 + 4 * p2 - p3) * t2 +
+ (-p0 + 3.0f * p1 - 3.0f * p2 + p3) * t3);
+ }
+
+ public float distance_squared_to(Vector2 to)
+ {
+ return (x - to.x) * (x - to.x) + (y - to.y) * (y - to.y);
+ }
+
+ public float distance_to(Vector2 to)
+ {
+ return Mathf.sqrt((x - to.x) * (x - to.x) + (y - to.y) * (y - to.y));
+ }
+
+ public float dot(Vector2 with)
+ {
+ return x * with.x + y * with.y;
+ }
+
+ public Vector2 floor()
+ {
+ return new Vector2(Mathf.floor(x), Mathf.floor(y));
+ }
+
+ public bool is_normalized()
+ {
+ return Mathf.abs(length_squared() - 1.0f) < Mathf.Epsilon;
+ }
+
+ public float length()
+ {
+ return Mathf.sqrt(x * x + y * y);
+ }
+
+ public float length_squared()
+ {
+ return x * x + y * y;
+ }
+
+ public Vector2 linear_interpolate(Vector2 b, float t)
+ {
+ Vector2 res = this;
+
+ res.x += (t * (b.x - x));
+ res.y += (t * (b.y - y));
+
+ return res;
+ }
+
+ public Vector2 normalized()
+ {
+ Vector2 result = this;
+ result.normalize();
+ return result;
+ }
+
+ public Vector2 reflect(Vector2 n)
+ {
+ return 2.0f * n * dot(n) - this;
+ }
+
+ public Vector2 rotated(float phi)
+ {
+ float rads = angle() + phi;
+ return new Vector2(Mathf.cos(rads), Mathf.sin(rads)) * length();
+ }
+
+ public Vector2 slide(Vector2 n)
+ {
+ return this - n * dot(n);
+ }
+
+ public Vector2 snapped(Vector2 by)
+ {
+ return new Vector2(Mathf.stepify(x, by.x), Mathf.stepify(y, by.y));
+ }
+
+ public Vector2 tangent()
+ {
+ return new Vector2(y, -x);
+ }
+
+ public Vector2(float x, float y)
+ {
+ this.x = x;
+ this.y = y;
+ }
+
+ public static Vector2 operator +(Vector2 left, Vector2 right)
+ {
+ left.x += right.x;
+ left.y += right.y;
+ return left;
+ }
+
+ public static Vector2 operator -(Vector2 left, Vector2 right)
+ {
+ left.x -= right.x;
+ left.y -= right.y;
+ return left;
+ }
+
+ public static Vector2 operator -(Vector2 vec)
+ {
+ vec.x = -vec.x;
+ vec.y = -vec.y;
+ return vec;
+ }
+
+ public static Vector2 operator *(Vector2 vec, float scale)
+ {
+ vec.x *= scale;
+ vec.y *= scale;
+ return vec;
+ }
+
+ public static Vector2 operator *(float scale, Vector2 vec)
+ {
+ vec.x *= scale;
+ vec.y *= scale;
+ return vec;
+ }
+
+ public static Vector2 operator *(Vector2 left, Vector2 right)
+ {
+ left.x *= right.x;
+ left.y *= right.y;
+ return left;
+ }
+
+ public static Vector2 operator /(Vector2 vec, float scale)
+ {
+ vec.x /= scale;
+ vec.y /= scale;
+ return vec;
+ }
+
+ public static Vector2 operator /(Vector2 left, Vector2 right)
+ {
+ left.x /= right.x;
+ left.y /= right.y;
+ return left;
+ }
+
+ public static bool operator ==(Vector2 left, Vector2 right)
+ {
+ return left.Equals(right);
+ }
+
+ public static bool operator !=(Vector2 left, Vector2 right)
+ {
+ return !left.Equals(right);
+ }
+
+ public static bool operator <(Vector2 left, Vector2 right)
+ {
+ if (left.x.Equals(right.x))
+ {
+ return left.y < right.y;
+ }
+ else
+ {
+ return left.x < right.x;
+ }
+ }
+
+ public static bool operator >(Vector2 left, Vector2 right)
+ {
+ if (left.x.Equals(right.x))
+ {
+ return left.y > right.y;
+ }
+ else
+ {
+ return left.x > right.x;
+ }
+ }
+
+ public static bool operator <=(Vector2 left, Vector2 right)
+ {
+ if (left.x.Equals(right.x))
+ {
+ return left.y <= right.y;
+ }
+ else
+ {
+ return left.x <= right.x;
+ }
+ }
+
+ public static bool operator >=(Vector2 left, Vector2 right)
+ {
+ if (left.x.Equals(right.x))
+ {
+ return left.y >= right.y;
+ }
+ else
+ {
+ return left.x >= right.x;
+ }
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (obj is Vector2)
+ {
+ return Equals((Vector2)obj);
+ }
+
+ return false;
+ }
+
+ public bool Equals(Vector2 other)
+ {
+ return x == other.x && y == other.y;
+ }
+
+ public override int GetHashCode()
+ {
+ return y.GetHashCode() ^ x.GetHashCode();
+ }
+
+ public override string ToString()
+ {
+ return String.Format("({0}, {1})", new object[]
+ {
+ this.x.ToString(),
+ this.y.ToString()
+ });
+ }
+
+ public string ToString(string format)
+ {
+ return String.Format("({0}, {1})", new object[]
+ {
+ this.x.ToString(format),
+ this.y.ToString(format)
+ });
+ }
+ }
+}
diff --git a/modules/mono/glue/cs_files/Vector3.cs b/modules/mono/glue/cs_files/Vector3.cs
new file mode 100644
index 0000000000..c023cd83cf
--- /dev/null
+++ b/modules/mono/glue/cs_files/Vector3.cs
@@ -0,0 +1,420 @@
+using System;
+using System.Runtime.InteropServices;
+
+// file: core/math/vector3.h
+// commit: bd282ff43f23fe845f29a3e25c8efc01bd65ffb0
+// file: core/math/vector3.cpp
+// commit: 7ad14e7a3e6f87ddc450f7e34621eb5200808451
+// file: core/variant_call.cpp
+// commit: 5ad9be4c24e9d7dc5672fdc42cea896622fe5685
+
+namespace Godot
+{
+ [StructLayout(LayoutKind.Sequential)]
+ public struct Vector3 : IEquatable<Vector3>
+ {
+ public enum Axis
+ {
+ X = 0,
+ Y,
+ Z
+ }
+
+ public float x;
+ public float y;
+ public float z;
+
+ public float this[int index]
+ {
+ get
+ {
+ switch (index)
+ {
+ case 0:
+ return x;
+ case 1:
+ return y;
+ case 2:
+ return z;
+ default:
+ throw new IndexOutOfRangeException();
+ }
+ }
+ set
+ {
+ switch (index)
+ {
+ case 0:
+ x = value;
+ return;
+ case 1:
+ y = value;
+ return;
+ case 2:
+ z = value;
+ return;
+ default:
+ throw new IndexOutOfRangeException();
+ }
+ }
+ }
+
+ internal void normalize()
+ {
+ float length = this.length();
+
+ if (length == 0f)
+ {
+ x = y = z = 0f;
+ }
+ else
+ {
+ x /= length;
+ y /= length;
+ z /= length;
+ }
+ }
+
+ public Vector3 abs()
+ {
+ return new Vector3(Mathf.abs(x), Mathf.abs(y), Mathf.abs(z));
+ }
+
+ public float angle_to(Vector3 to)
+ {
+ return Mathf.atan2(cross(to).length(), dot(to));
+ }
+
+ public Vector3 bounce(Vector3 n)
+ {
+ return -reflect(n);
+ }
+
+ public Vector3 ceil()
+ {
+ return new Vector3(Mathf.ceil(x), Mathf.ceil(y), Mathf.ceil(z));
+ }
+
+ public Vector3 cross(Vector3 b)
+ {
+ return new Vector3
+ (
+ (y * b.z) - (z * b.y),
+ (z * b.x) - (x * b.z),
+ (x * b.y) - (y * b.x)
+ );
+ }
+
+ public Vector3 cubic_interpolate(Vector3 b, Vector3 preA, Vector3 postB, float t)
+ {
+ Vector3 p0 = preA;
+ Vector3 p1 = this;
+ Vector3 p2 = b;
+ Vector3 p3 = postB;
+
+ float t2 = t * t;
+ float t3 = t2 * t;
+
+ return 0.5f * (
+ (p1 * 2.0f) + (-p0 + p2) * t +
+ (2.0f * p0 - 5.0f * p1 + 4f * p2 - p3) * t2 +
+ (-p0 + 3.0f * p1 - 3.0f * p2 + p3) * t3
+ );
+ }
+
+ public float distance_squared_to(Vector3 b)
+ {
+ return (b - this).length_squared();
+ }
+
+ public float distance_to(Vector3 b)
+ {
+ return (b - this).length();
+ }
+
+ public float dot(Vector3 b)
+ {
+ return x * b.x + y * b.y + z * b.z;
+ }
+
+ public Vector3 floor()
+ {
+ return new Vector3(Mathf.floor(x), Mathf.floor(y), Mathf.floor(z));
+ }
+
+ public Vector3 inverse()
+ {
+ return new Vector3(1.0f / x, 1.0f / y, 1.0f / z);
+ }
+
+ public bool is_normalized()
+ {
+ return Mathf.abs(length_squared() - 1.0f) < Mathf.Epsilon;
+ }
+
+ public float length()
+ {
+ float x2 = x * x;
+ float y2 = y * y;
+ float z2 = z * z;
+
+ return Mathf.sqrt(x2 + y2 + z2);
+ }
+
+ public float length_squared()
+ {
+ float x2 = x * x;
+ float y2 = y * y;
+ float z2 = z * z;
+
+ return x2 + y2 + z2;
+ }
+
+ public Vector3 linear_interpolate(Vector3 b, float t)
+ {
+ return new Vector3
+ (
+ x + (t * (b.x - x)),
+ y + (t * (b.y - y)),
+ z + (t * (b.z - z))
+ );
+ }
+
+ public Axis max_axis()
+ {
+ return x < y ? (y < z ? Axis.Z : Axis.Y) : (x < z ? Axis.Z : Axis.X);
+ }
+
+ public Axis min_axis()
+ {
+ return x < y ? (x < z ? Axis.X : Axis.Z) : (y < z ? Axis.Y : Axis.Z);
+ }
+
+ public Vector3 normalized()
+ {
+ Vector3 v = this;
+ v.normalize();
+ return v;
+ }
+
+ public Basis outer(Vector3 b)
+ {
+ return new Basis(
+ new Vector3(x * b.x, x * b.y, x * b.z),
+ new Vector3(y * b.x, y * b.y, y * b.z),
+ new Vector3(z * b.x, z * b.y, z * b.z)
+ );
+ }
+
+ public Vector3 reflect(Vector3 n)
+ {
+#if DEBUG
+ if (!n.is_normalized())
+ throw new ArgumentException(String.Format("{0} is not normalized", n), nameof(n));
+#endif
+ return 2.0f * n * dot(n) - this;
+ }
+
+ public Vector3 rotated(Vector3 axis, float phi)
+ {
+ return new Basis(axis, phi).xform(this);
+ }
+
+ public Vector3 slide(Vector3 n)
+ {
+ return this - n * dot(n);
+ }
+
+ public Vector3 snapped(Vector3 by)
+ {
+ return new Vector3
+ (
+ Mathf.stepify(x, by.x),
+ Mathf.stepify(y, by.y),
+ Mathf.stepify(z, by.z)
+ );
+ }
+
+ public Basis to_diagonal_matrix()
+ {
+ return new Basis(
+ x, 0f, 0f,
+ 0f, y, 0f,
+ 0f, 0f, z
+ );
+ }
+
+ public Vector3(float x, float y, float z)
+ {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ }
+
+ public static Vector3 operator +(Vector3 left, Vector3 right)
+ {
+ left.x += right.x;
+ left.y += right.y;
+ left.z += right.z;
+ return left;
+ }
+
+ public static Vector3 operator -(Vector3 left, Vector3 right)
+ {
+ left.x -= right.x;
+ left.y -= right.y;
+ left.z -= right.z;
+ return left;
+ }
+
+ public static Vector3 operator -(Vector3 vec)
+ {
+ vec.x = -vec.x;
+ vec.y = -vec.y;
+ vec.z = -vec.z;
+ return vec;
+ }
+
+ public static Vector3 operator *(Vector3 vec, float scale)
+ {
+ vec.x *= scale;
+ vec.y *= scale;
+ vec.z *= scale;
+ return vec;
+ }
+
+ public static Vector3 operator *(float scale, Vector3 vec)
+ {
+ vec.x *= scale;
+ vec.y *= scale;
+ vec.z *= scale;
+ return vec;
+ }
+
+ public static Vector3 operator *(Vector3 left, Vector3 right)
+ {
+ left.x *= right.x;
+ left.y *= right.y;
+ left.z *= right.z;
+ return left;
+ }
+
+ public static Vector3 operator /(Vector3 vec, float scale)
+ {
+ vec.x /= scale;
+ vec.y /= scale;
+ vec.z /= scale;
+ return vec;
+ }
+
+ public static Vector3 operator /(Vector3 left, Vector3 right)
+ {
+ left.x /= right.x;
+ left.y /= right.y;
+ left.z /= right.z;
+ return left;
+ }
+
+ public static bool operator ==(Vector3 left, Vector3 right)
+ {
+ return left.Equals(right);
+ }
+
+ public static bool operator !=(Vector3 left, Vector3 right)
+ {
+ return !left.Equals(right);
+ }
+
+ public static bool operator <(Vector3 left, Vector3 right)
+ {
+ if (left.x == right.x)
+ {
+ if (left.y == right.y)
+ return left.z < right.z;
+ else
+ return left.y < right.y;
+ }
+
+ return left.x < right.x;
+ }
+
+ public static bool operator >(Vector3 left, Vector3 right)
+ {
+ if (left.x == right.x)
+ {
+ if (left.y == right.y)
+ return left.z > right.z;
+ else
+ return left.y > right.y;
+ }
+
+ return left.x > right.x;
+ }
+
+ public static bool operator <=(Vector3 left, Vector3 right)
+ {
+ if (left.x == right.x)
+ {
+ if (left.y == right.y)
+ return left.z <= right.z;
+ else
+ return left.y < right.y;
+ }
+
+ return left.x < right.x;
+ }
+
+ public static bool operator >=(Vector3 left, Vector3 right)
+ {
+ if (left.x == right.x)
+ {
+ if (left.y == right.y)
+ return left.z >= right.z;
+ else
+ return left.y > right.y;
+ }
+
+ return left.x > right.x;
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (obj is Vector3)
+ {
+ return Equals((Vector3)obj);
+ }
+
+ return false;
+ }
+
+ public bool Equals(Vector3 other)
+ {
+ return x == other.x && y == other.y && z == other.z;
+ }
+
+ public override int GetHashCode()
+ {
+ return y.GetHashCode() ^ x.GetHashCode() ^ z.GetHashCode();
+ }
+
+ public override string ToString()
+ {
+ return String.Format("({0}, {1}, {2})", new object[]
+ {
+ this.x.ToString(),
+ this.y.ToString(),
+ this.z.ToString()
+ });
+ }
+
+ public string ToString(string format)
+ {
+ return String.Format("({0}, {1}, {2})", new object[]
+ {
+ this.x.ToString(format),
+ this.y.ToString(format),
+ this.z.ToString(format)
+ });
+ }
+ }
+}
diff --git a/modules/mono/glue/glue_header.h b/modules/mono/glue/glue_header.h
new file mode 100644
index 0000000000..0751a0160f
--- /dev/null
+++ b/modules/mono/glue/glue_header.h
@@ -0,0 +1,302 @@
+/*************************************************************************/
+/* glue_header.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "../csharp_script.h"
+#include "../mono_gd/gd_mono_class.h"
+#include "../mono_gd/gd_mono_internals.h"
+#include "../mono_gd/gd_mono_marshal.h"
+#include "../signal_awaiter_utils.h"
+
+#include "bind/core_bind.h"
+#include "class_db.h"
+#include "io/marshalls.h"
+#include "object.h"
+#include "os/os.h"
+#include "project_settings.h"
+#include "reference.h"
+#include "variant_parser.h"
+
+#ifdef TOOLS_ENABLED
+#include "editor/editor_node.h"
+#endif
+
+#define GODOTSHARP_INSTANCE_OBJECT(m_instance, m_type) \
+ static ClassDB::ClassInfo *ci = NULL; \
+ if (!ci) { \
+ ci = ClassDB::classes.getptr(m_type); \
+ } \
+ Object *m_instance = ci->creation_func();
+
+void godot_icall_Object_Dtor(Object *ptr) {
+ ERR_FAIL_NULL(ptr);
+ _GodotSharp::get_singleton()->queue_dispose(ptr);
+}
+
+// -- ClassDB --
+
+MethodBind *godot_icall_ClassDB_get_method(MonoString *p_type, MonoString *p_method) {
+ StringName type(GDMonoMarshal::mono_string_to_godot(p_type));
+ StringName method(GDMonoMarshal::mono_string_to_godot(p_method));
+ return ClassDB::get_method(type, method);
+}
+
+// -- SignalAwaiter --
+
+Error godot_icall_Object_connect_signal_awaiter(Object *p_source, MonoString *p_signal, Object *p_target, MonoObject *p_awaiter) {
+ String signal = GDMonoMarshal::mono_string_to_godot(p_signal);
+ return SignalAwaiterUtils::connect_signal_awaiter(p_source, signal, p_target, p_awaiter);
+}
+
+// -- NodePath --
+
+NodePath *godot_icall_NodePath_Ctor(MonoString *p_path) {
+ return memnew(NodePath(GDMonoMarshal::mono_string_to_godot(p_path)));
+}
+
+void godot_icall_NodePath_Dtor(NodePath *p_ptr) {
+ ERR_FAIL_NULL(p_ptr);
+ _GodotSharp::get_singleton()->queue_dispose(p_ptr);
+}
+
+MonoString *godot_icall_NodePath_operator_String(NodePath *p_np) {
+ return GDMonoMarshal::mono_string_from_godot(p_np->operator String());
+}
+
+MonoArray *godot_icall_String_md5_buffer(MonoString *p_str) {
+ Vector<uint8_t> ret = GDMonoMarshal::mono_string_to_godot(p_str).md5_buffer();
+ // TODO Check possible Array/Vector<uint8_t> problem?
+ return GDMonoMarshal::Array_to_mono_array(Variant(ret));
+}
+
+// -- RID --
+
+RID *godot_icall_RID_Ctor(Object *p_from) {
+ Resource *res_from = Object::cast_to<Resource>(p_from);
+
+ if (res_from)
+ return memnew(RID(res_from->get_rid()));
+
+ return memnew(RID);
+}
+
+void godot_icall_RID_Dtor(RID *p_ptr) {
+ ERR_FAIL_NULL(p_ptr);
+ _GodotSharp::get_singleton()->queue_dispose(p_ptr);
+}
+
+// -- String --
+
+MonoString *godot_icall_String_md5_text(MonoString *p_str) {
+ String ret = GDMonoMarshal::mono_string_to_godot(p_str).md5_text();
+ return GDMonoMarshal::mono_string_from_godot(ret);
+}
+
+int godot_icall_String_rfind(MonoString *p_str, MonoString *p_what, int p_from) {
+ String what = GDMonoMarshal::mono_string_to_godot(p_what);
+ return GDMonoMarshal::mono_string_to_godot(p_str).rfind(what, p_from);
+}
+
+int godot_icall_String_rfindn(MonoString *p_str, MonoString *p_what, int p_from) {
+ String what = GDMonoMarshal::mono_string_to_godot(p_what);
+ return GDMonoMarshal::mono_string_to_godot(p_str).rfindn(what, p_from);
+}
+
+MonoArray *godot_icall_String_sha256_buffer(MonoString *p_str) {
+ Vector<uint8_t> ret = GDMonoMarshal::mono_string_to_godot(p_str).sha256_buffer();
+ return GDMonoMarshal::Array_to_mono_array(Variant(ret));
+}
+
+MonoString *godot_icall_String_sha256_text(MonoString *p_str) {
+ String ret = GDMonoMarshal::mono_string_to_godot(p_str).sha256_text();
+ return GDMonoMarshal::mono_string_from_godot(ret);
+}
+
+// -- Global Scope --
+
+MonoObject *godot_icall_Godot_bytes2var(MonoArray *p_bytes) {
+ Variant ret;
+ PoolByteArray varr = GDMonoMarshal::mono_array_to_PoolByteArray(p_bytes);
+ PoolByteArray::Read r = varr.read();
+ Error err = decode_variant(ret, r.ptr(), varr.size(), NULL);
+ if (err != OK) {
+ ret = RTR("Not enough bytes for decoding bytes, or invalid format.");
+ }
+ return GDMonoMarshal::variant_to_mono_object(ret);
+}
+
+MonoObject *godot_icall_Godot_convert(MonoObject *p_what, int p_type) {
+ Variant what = GDMonoMarshal::mono_object_to_variant(p_what);
+ const Variant *args[1] = { &what };
+ Variant::CallError ce;
+ Variant ret = Variant::construct(Variant::Type(p_type), args, 1, ce);
+ ERR_FAIL_COND_V(ce.error != Variant::CallError::CALL_OK, NULL);
+ return GDMonoMarshal::variant_to_mono_object(ret);
+}
+
+int godot_icall_Godot_hash(MonoObject *p_var) {
+ return GDMonoMarshal::mono_object_to_variant(p_var).hash();
+}
+
+MonoObject *godot_icall_Godot_instance_from_id(int p_instance_id) {
+ return GDMonoUtils::unmanaged_get_managed(ObjectDB::get_instance(p_instance_id));
+}
+
+void godot_icall_Godot_print(MonoArray *p_what) {
+ Array what = GDMonoMarshal::mono_array_to_Array(p_what);
+ String str;
+ for (int i = 0; i < what.size(); i++)
+ str += what[i].operator String();
+ print_line(str);
+}
+
+void godot_icall_Godot_printerr(MonoArray *p_what) {
+ Array what = GDMonoMarshal::mono_array_to_Array(p_what);
+ String str;
+ for (int i = 0; i < what.size(); i++)
+ str += what[i].operator String();
+ OS::get_singleton()->printerr("%s\n", str.utf8().get_data());
+}
+
+void godot_icall_Godot_printraw(MonoArray *p_what) {
+ Array what = GDMonoMarshal::mono_array_to_Array(p_what);
+ String str;
+ for (int i = 0; i < what.size(); i++)
+ str += what[i].operator String();
+ OS::get_singleton()->print("%s", str.utf8().get_data());
+}
+
+void godot_icall_Godot_prints(MonoArray *p_what) {
+ Array what = GDMonoMarshal::mono_array_to_Array(p_what);
+ String str;
+ for (int i = 0; i < what.size(); i++) {
+ if (i)
+ str += " ";
+ str += what[i].operator String();
+ }
+ print_line(str);
+}
+
+void godot_icall_Godot_printt(MonoArray *p_what) {
+ Array what = GDMonoMarshal::mono_array_to_Array(p_what);
+ String str;
+ for (int i = 0; i < what.size(); i++) {
+ if (i)
+ str += "\t";
+ str += what[i].operator String();
+ }
+ print_line(str);
+}
+
+void godot_icall_Godot_seed(int p_seed) {
+ Math::seed(p_seed);
+}
+
+MonoString *godot_icall_Godot_str(MonoArray *p_what) {
+ String str;
+ Array what = GDMonoMarshal::mono_array_to_Array(p_what);
+
+ for (int i = 0; i < what.size(); i++) {
+ String os = what[i].operator String();
+
+ if (i == 0)
+ str = os;
+ else
+ str += os;
+ }
+
+ return GDMonoMarshal::mono_string_from_godot(str);
+}
+
+MonoObject *godot_icall_Godot_str2var(MonoString *p_str) {
+ Variant ret;
+
+ VariantParser::StreamString ss;
+ ss.s = GDMonoMarshal::mono_string_to_godot(p_str);
+
+ String errs;
+ int line;
+ Error err = VariantParser::parse(&ss, ret, errs, line);
+ if (err != OK) {
+ String err_str = "Parse error at line " + itos(line) + ": " + errs;
+ ERR_PRINTS(err_str);
+ ret = err_str;
+ }
+
+ return GDMonoMarshal::variant_to_mono_object(ret);
+}
+
+bool godot_icall_Godot_type_exists(MonoString *p_type) {
+ return ClassDB::class_exists(GDMonoMarshal::mono_string_to_godot(p_type));
+}
+
+MonoArray *godot_icall_Godot_var2bytes(MonoObject *p_var) {
+ Variant var = GDMonoMarshal::mono_object_to_variant(p_var);
+
+ PoolByteArray barr;
+ int len;
+ Error err = encode_variant(var, NULL, len);
+ ERR_EXPLAIN("Unexpected error encoding variable to bytes, likely unserializable type found (Object or RID).");
+ ERR_FAIL_COND_V(err != OK, NULL);
+
+ barr.resize(len);
+ {
+ PoolByteArray::Write w = barr.write();
+ encode_variant(var, w.ptr(), len);
+ }
+
+ return GDMonoMarshal::PoolByteArray_to_mono_array(barr);
+}
+
+MonoString *godot_icall_Godot_var2str(MonoObject *p_var) {
+ String vars;
+ VariantWriter::write_to_string(GDMonoMarshal::mono_object_to_variant(p_var), vars);
+ return GDMonoMarshal::mono_string_from_godot(vars);
+}
+
+MonoObject *godot_icall_Godot_weakref(Object *p_obj) {
+ if (!p_obj)
+ return NULL;
+
+ Ref<WeakRef> wref;
+ Reference *ref = Object::cast_to<Reference>(p_obj);
+
+ if (ref) {
+ REF r = ref;
+ if (!r.is_valid())
+ return NULL;
+
+ wref.instance();
+ wref->set_ref(r);
+ } else {
+ wref.instance();
+ wref->set_obj(p_obj);
+ }
+
+ return GDMonoUtils::create_managed_for_godot_object(CACHED_CLASS(WeakRef), Reference::get_class_static(), Object::cast_to<Object>(wref.ptr()));
+}
diff --git a/modules/mono/godotsharp_defs.h b/modules/mono/godotsharp_defs.h
new file mode 100644
index 0000000000..f941a4d6c5
--- /dev/null
+++ b/modules/mono/godotsharp_defs.h
@@ -0,0 +1,41 @@
+/*************************************************************************/
+/* godotsharp_defs.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef GODOTSHARP_DEFS_H
+#define GODOTSHARP_DEFS_H
+
+#define BINDINGS_NAMESPACE "Godot"
+#define BINDINGS_GLOBAL_SCOPE_CLASS "GD"
+#define BINDINGS_PTR_FIELD "ptr"
+#define BINDINGS_NATIVE_NAME_FIELD "nativeName"
+#define API_ASSEMBLY_NAME "GodotSharp"
+#define EDITOR_API_ASSEMBLY_NAME "GodotSharpEditor"
+#define EDITOR_TOOLS_ASSEMBLY_NAME "GodotSharpTools"
+
+#endif // GODOTSHARP_DEFS_H
diff --git a/modules/mono/godotsharp_dirs.cpp b/modules/mono/godotsharp_dirs.cpp
new file mode 100644
index 0000000000..0a2010e99d
--- /dev/null
+++ b/modules/mono/godotsharp_dirs.cpp
@@ -0,0 +1,185 @@
+/*************************************************************************/
+/* godotsharp_dirs.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "godotsharp_dirs.h"
+
+#include "os/os.h"
+
+#ifdef TOOLS_ENABLED
+#include "editor/editor_settings.h"
+#include "project_settings.h"
+#include "version.h"
+#endif
+
+namespace GodotSharpDirs {
+
+String _get_expected_build_config() {
+#ifdef TOOLS_ENABLED
+ return "Tools";
+#else
+
+#ifdef DEBUG_ENABLED
+ return "Debug";
+#else
+ return "Release";
+#endif
+
+#endif
+}
+
+String _get_mono_user_dir() {
+#ifdef TOOLS_ENABLED
+ if (EditorSettings::get_singleton()) {
+ return EditorSettings::get_singleton()->get_settings_path().plus_file("mono");
+ } else {
+ String settings_path;
+
+ if (OS::get_singleton()->has_environment("APPDATA")) {
+ String app_data = OS::get_singleton()->get_environment("APPDATA").replace("\\", "/");
+ settings_path = app_data.plus_file(String(_MKSTR(VERSION_SHORT_NAME)).capitalize());
+ } else if (OS::get_singleton()->has_environment("HOME")) {
+ String home = OS::get_singleton()->get_environment("HOME");
+ settings_path = home.plus_file("." + String(_MKSTR(VERSION_SHORT_NAME)).to_lower());
+ }
+
+ return settings_path.plus_file("mono");
+ }
+#else
+ return OS::get_singleton()->get_data_dir().plus_file("mono");
+#endif
+}
+
+class _GodotSharpDirs {
+
+public:
+ String res_data_dir;
+ String res_metadata_dir;
+ String res_assemblies_dir;
+ String res_config_dir;
+ String res_temp_dir;
+ String res_temp_assemblies_base_dir;
+ String res_temp_assemblies_dir;
+ String mono_user_dir;
+ String mono_logs_dir;
+
+#ifdef TOOLS_ENABLED
+ String mono_solutions_dir;
+ String build_logs_dir;
+ String sln_filepath;
+ String csproj_filepath;
+#endif
+
+private:
+ _GodotSharpDirs() {
+ res_data_dir = "res://.mono";
+ res_metadata_dir = res_data_dir.plus_file("metadata");
+ res_assemblies_dir = res_data_dir.plus_file("assemblies");
+ res_config_dir = res_data_dir.plus_file("etc").plus_file("mono");
+
+ // TODO use paths from csproj
+ res_temp_dir = res_data_dir.plus_file("temp");
+ res_temp_assemblies_base_dir = res_temp_dir.plus_file("bin");
+ res_temp_assemblies_dir = res_temp_assemblies_base_dir.plus_file(_get_expected_build_config());
+
+ mono_user_dir = _get_mono_user_dir();
+ mono_logs_dir = mono_user_dir.plus_file("mono_logs");
+
+#ifdef TOOLS_ENABLED
+ mono_solutions_dir = mono_user_dir.plus_file("solutions");
+ build_logs_dir = mono_user_dir.plus_file("build_logs");
+ String base_path = String("res://") + ProjectSettings::get_singleton()->get("application/config/name");
+ sln_filepath = ProjectSettings::get_singleton()->globalize_path(base_path + ".sln");
+ csproj_filepath = ProjectSettings::get_singleton()->globalize_path(base_path + ".csproj");
+#endif
+ }
+
+ _GodotSharpDirs(const _GodotSharpDirs &);
+ _GodotSharpDirs &operator=(const _GodotSharpDirs &);
+
+public:
+ static _GodotSharpDirs &get_singleton() {
+ static _GodotSharpDirs singleton;
+ return singleton;
+ }
+};
+
+String get_res_data_dir() {
+ return _GodotSharpDirs::get_singleton().res_data_dir;
+}
+
+String get_res_metadata_dir() {
+ return _GodotSharpDirs::get_singleton().res_metadata_dir;
+}
+
+String get_res_assemblies_dir() {
+ return _GodotSharpDirs::get_singleton().res_assemblies_dir;
+}
+
+String get_res_config_dir() {
+ return _GodotSharpDirs::get_singleton().res_config_dir;
+}
+
+String get_res_temp_dir() {
+ return _GodotSharpDirs::get_singleton().res_temp_dir;
+}
+
+String get_res_temp_assemblies_base_dir() {
+ return _GodotSharpDirs::get_singleton().res_temp_assemblies_base_dir;
+}
+
+String get_res_temp_assemblies_dir() {
+ return _GodotSharpDirs::get_singleton().res_temp_assemblies_dir;
+}
+
+String get_mono_user_dir() {
+ return _GodotSharpDirs::get_singleton().mono_user_dir;
+}
+
+String get_mono_logs_dir() {
+ return _GodotSharpDirs::get_singleton().mono_logs_dir;
+}
+
+#ifdef TOOLS_ENABLED
+String get_mono_solutions_dir() {
+ return _GodotSharpDirs::get_singleton().mono_solutions_dir;
+}
+
+String get_build_logs_dir() {
+ return _GodotSharpDirs::get_singleton().build_logs_dir;
+}
+
+String get_project_sln_path() {
+ return _GodotSharpDirs::get_singleton().sln_filepath;
+}
+
+String get_project_csproj_path() {
+ return _GodotSharpDirs::get_singleton().csproj_filepath;
+}
+#endif
+}
diff --git a/modules/mono/godotsharp_dirs.h b/modules/mono/godotsharp_dirs.h
new file mode 100644
index 0000000000..ba2c065210
--- /dev/null
+++ b/modules/mono/godotsharp_dirs.h
@@ -0,0 +1,58 @@
+/*************************************************************************/
+/* godotsharp_dirs.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef GODOTSHARP_DIRS_H
+#define GODOTSHARP_DIRS_H
+
+#include "ustring.h"
+
+namespace GodotSharpDirs {
+
+String get_res_data_dir();
+String get_res_metadata_dir();
+String get_res_assemblies_dir();
+String get_res_config_dir();
+String get_res_temp_dir();
+String get_res_temp_assemblies_base_dir();
+String get_res_temp_assemblies_dir();
+
+String get_mono_user_dir();
+String get_mono_logs_dir();
+
+#ifdef TOOLS_ENABLED
+String get_mono_solutions_dir();
+String get_build_logs_dir();
+String get_custom_project_settings_dir();
+#endif
+
+String get_project_sln_path();
+String get_project_csproj_path();
+}
+
+#endif // GODOTSHARP_DIRS_H
diff --git a/modules/mono/mono_gc_handle.cpp b/modules/mono/mono_gc_handle.cpp
new file mode 100644
index 0000000000..d3ad968135
--- /dev/null
+++ b/modules/mono/mono_gc_handle.cpp
@@ -0,0 +1,77 @@
+/*************************************************************************/
+/* mono_gc_handle.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "mono_gc_handle.h"
+
+#include "mono_gd/gd_mono.h"
+
+uint32_t MonoGCHandle::make_strong_handle(MonoObject *p_object) {
+
+ return mono_gchandle_new(
+ p_object,
+ false /* do not pin the object */
+ );
+}
+
+uint32_t MonoGCHandle::make_weak_handle(MonoObject *p_object) {
+
+ return mono_gchandle_new_weakref(
+ p_object,
+ true /* track_resurrection: allows us to invoke _notification(NOTIFICATION_PREDELETE) while disposing */
+ );
+}
+
+Ref<MonoGCHandle> MonoGCHandle::create_strong(MonoObject *p_object) {
+
+ return memnew(MonoGCHandle(make_strong_handle(p_object)));
+}
+
+Ref<MonoGCHandle> MonoGCHandle::create_weak(MonoObject *p_object) {
+
+ return memnew(MonoGCHandle(make_weak_handle(p_object)));
+}
+
+void MonoGCHandle::release() {
+
+ if (!released && GDMono::get_singleton()->is_runtime_initialized()) {
+ mono_gchandle_free(handle);
+ released = true;
+ }
+}
+
+MonoGCHandle::MonoGCHandle(uint32_t p_handle) {
+
+ released = false;
+ handle = p_handle;
+}
+
+MonoGCHandle::~MonoGCHandle() {
+
+ release();
+}
diff --git a/modules/mono/mono_gc_handle.h b/modules/mono/mono_gc_handle.h
new file mode 100644
index 0000000000..cf5b6cec21
--- /dev/null
+++ b/modules/mono/mono_gc_handle.h
@@ -0,0 +1,63 @@
+/*************************************************************************/
+/* mono_gc_handle.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef CSHARP_GC_HANDLE_H
+#define CSHARP_GC_HANDLE_H
+
+#include <mono/jit/jit.h>
+
+#include "reference.h"
+
+class MonoGCHandle : public Reference {
+
+ GDCLASS(MonoGCHandle, Reference)
+
+ bool released;
+ uint32_t handle;
+
+public:
+ static uint32_t make_strong_handle(MonoObject *p_object);
+ static uint32_t make_weak_handle(MonoObject *p_object);
+
+ static Ref<MonoGCHandle> create_strong(MonoObject *p_object);
+ static Ref<MonoGCHandle> create_weak(MonoObject *p_object);
+
+ _FORCE_INLINE_ MonoObject *get_target() const { return released ? NULL : mono_gchandle_get_target(handle); }
+
+ _FORCE_INLINE_ void set_handle(uint32_t p_handle) {
+ handle = p_handle;
+ released = false;
+ }
+ void release();
+
+ MonoGCHandle(uint32_t p_handle);
+ ~MonoGCHandle();
+};
+
+#endif // CSHARP_GC_HANDLE_H
diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp
new file mode 100644
index 0000000000..98b57adc50
--- /dev/null
+++ b/modules/mono/mono_gd/gd_mono.cpp
@@ -0,0 +1,767 @@
+/*************************************************************************/
+/* gd_mono.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "gd_mono.h"
+
+#include <mono/metadata/mono-config.h>
+#include <mono/metadata/mono-debug.h>
+#include <mono/metadata/mono-gc.h>
+
+#include "os/dir_access.h"
+#include "os/file_access.h"
+#include "os/os.h"
+#include "os/thread.h"
+#include "project_settings.h"
+
+#include "../csharp_script.h"
+#include "../utils/path_utils.h"
+#include "gd_mono_utils.h"
+
+#ifdef TOOLS_ENABLED
+#include "../editor/godotsharp_editor.h"
+#endif
+
+#ifdef MONO_PRINT_HANDLER_ENABLED
+void gdmono_MonoPrintCallback(const char *string, mono_bool is_stdout) {
+
+ if (is_stdout) {
+ OS::get_singleton()->print(string);
+ } else {
+ OS::get_singleton()->printerr(string);
+ }
+}
+#endif
+
+GDMono *GDMono::singleton = NULL;
+
+#ifdef DEBUG_ENABLED
+static bool _wait_for_debugger_msecs(uint32_t p_msecs) {
+
+ do {
+ if (mono_is_debugger_attached())
+ return true;
+
+ int last_tick = OS::get_singleton()->get_ticks_msec();
+
+ OS::get_singleton()->delay_usec((p_msecs < 25 ? p_msecs : 25) * 1000);
+
+ int tdiff = OS::get_singleton()->get_ticks_msec() - last_tick;
+
+ if (tdiff > p_msecs) {
+ p_msecs = 0;
+ } else {
+ p_msecs -= tdiff;
+ }
+ } while (p_msecs > 0);
+
+ return mono_is_debugger_attached();
+}
+#endif
+
+#ifdef TOOLS_ENABLED
+// temporary workaround. should be provided from Main::setup/setup2 instead
+bool _is_project_manager_requested() {
+
+ List<String> cmdline_args = OS::get_singleton()->get_cmdline_args();
+ for (List<String>::Element *E = cmdline_args.front(); E; E = E->next()) {
+ const String &arg = E->get();
+ if (arg == "-p" || arg == "--project-manager")
+ return true;
+ }
+
+ return false;
+}
+#endif
+
+#ifdef DEBUG_ENABLED
+void gdmono_debug_init() {
+
+ mono_debug_init(MONO_DEBUG_FORMAT_MONO);
+
+ int da_port = GLOBAL_DEF("mono/debugger_agent/port", 23685);
+ bool da_suspend = GLOBAL_DEF("mono/debugger_agent/wait_for_debugger", false);
+ int da_timeout = GLOBAL_DEF("mono/debugger_agent/wait_timeout", 3000);
+
+#ifdef TOOLS_ENABLED
+ if (Engine::get_singleton()->is_editor_hint() ||
+ ProjectSettings::get_singleton()->get_resource_path().empty() ||
+ _is_project_manager_requested()) {
+ return;
+ }
+#endif
+
+ CharString da_args = String("--debugger-agent=transport=dt_socket,address=127.0.0.1:" + itos(da_port) +
+ ",embedding=1,server=y,suspend=" + (da_suspend ? "y,timeout=" + itos(da_timeout) : "n"))
+ .utf8();
+ // --debugger-agent=help
+ const char *options[] = {
+ "--soft-breakpoints",
+ da_args.get_data()
+ };
+ mono_jit_parse_options(2, (char **)options);
+}
+#endif
+
+void GDMono::initialize() {
+
+ ERR_FAIL_NULL(Engine::get_singleton());
+
+ OS::get_singleton()->print("Initializing mono...\n");
+
+#ifdef DEBUG_METHODS_ENABLED
+ _initialize_and_check_api_hashes();
+#endif
+
+ GDMonoLog::get_singleton()->initialize();
+
+#ifdef MONO_PRINT_HANDLER_ENABLED
+ mono_trace_set_print_handler(gdmono_MonoPrintCallback);
+ mono_trace_set_printerr_handler(gdmono_MonoPrintCallback);
+#endif
+
+#ifdef WINDOWS_ENABLED
+ mono_reg_info = MonoRegUtils::find_mono();
+
+ CharString assembly_dir;
+ CharString config_dir;
+
+ if (mono_reg_info.assembly_dir.length() && DirAccess::exists(mono_reg_info.assembly_dir)) {
+ assembly_dir = mono_reg_info.assembly_dir.utf8();
+ }
+
+ if (mono_reg_info.config_dir.length() && DirAccess::exists(mono_reg_info.config_dir)) {
+ config_dir = mono_reg_info.config_dir.utf8();
+ }
+
+ mono_set_dirs(assembly_dir.length() ? assembly_dir.get_data() : NULL,
+ config_dir.length() ? config_dir.get_data() : NULL);
+#else
+ mono_set_dirs(NULL, NULL);
+#endif
+
+ GDMonoAssembly::initialize();
+
+#ifdef DEBUG_ENABLED
+ gdmono_debug_init();
+#endif
+
+ mono_config_parse(NULL);
+
+ root_domain = mono_jit_init_version("GodotEngine.RootDomain", "v4.0.30319");
+
+ ERR_EXPLAIN("Mono: Failed to initialize runtime");
+ ERR_FAIL_NULL(root_domain);
+
+ GDMonoUtils::set_main_thread(GDMonoUtils::get_current_thread());
+
+ runtime_initialized = true;
+
+ OS::get_singleton()->print("Mono: Runtime initialized\n");
+
+ // mscorlib assembly MUST be present at initialization
+ ERR_EXPLAIN("Mono: Failed to load mscorlib assembly");
+ ERR_FAIL_COND(!_load_corlib_assembly());
+
+#ifdef TOOLS_ENABLED
+ // The tools domain must be loaded here, before the scripts domain.
+ // Otherwise domain unload on the scripts domain will hang indefinitely.
+
+ ERR_EXPLAIN("Mono: Failed to load tools domain");
+ ERR_FAIL_COND(_load_tools_domain() != OK);
+
+ // TODO move to editor init callback, and do it lazily when required before editor init (e.g.: bindings generation)
+ ERR_EXPLAIN("Mono: Failed to load Editor Tools assembly");
+ ERR_FAIL_COND(!_load_editor_tools_assembly());
+#endif
+
+ ERR_EXPLAIN("Mono: Failed to load scripts domain");
+ ERR_FAIL_COND(_load_scripts_domain() != OK);
+
+#ifdef DEBUG_ENABLED
+ bool debugger_attached = _wait_for_debugger_msecs(500);
+ if (!debugger_attached && OS::get_singleton()->is_stdout_verbose())
+ OS::get_singleton()->printerr("Mono: Debugger wait timeout\n");
+#endif
+
+ _register_internal_calls();
+
+ // The following assemblies are not required at initialization
+ _load_all_script_assemblies();
+
+ OS::get_singleton()->print("Mono: EVERYTHING OK\n");
+}
+
+#ifndef MONO_GLUE_DISABLED
+namespace GodotSharpBindings {
+
+uint64_t get_core_api_hash();
+uint64_t get_editor_api_hash();
+
+void register_generated_icalls();
+} // namespace GodotSharpBindings
+#endif
+
+void GDMono::_register_internal_calls() {
+#ifndef MONO_GLUE_DISABLED
+ GodotSharpBindings::register_generated_icalls();
+#endif
+
+#ifdef TOOLS_ENABLED
+ GodotSharpBuilds::_register_internal_calls();
+#endif
+}
+
+#ifdef DEBUG_METHODS_ENABLED
+void GDMono::_initialize_and_check_api_hashes() {
+
+ api_core_hash = ClassDB::get_api_hash(ClassDB::API_CORE);
+
+#ifndef MONO_GLUE_DISABLED
+ if (api_core_hash != GodotSharpBindings::get_core_api_hash()) {
+ ERR_PRINT("Mono: Core API hash mismatch!");
+ }
+#endif
+
+#ifdef TOOLS_ENABLED
+ api_editor_hash = ClassDB::get_api_hash(ClassDB::API_EDITOR);
+
+#ifndef MONO_GLUE_DISABLED
+ if (api_editor_hash != GodotSharpBindings::get_editor_api_hash()) {
+ ERR_PRINT("Mono: Editor API hash mismatch!");
+ }
+#endif
+
+#endif // TOOLS_ENABLED
+}
+#endif // DEBUG_METHODS_ENABLED
+
+void GDMono::add_assembly(uint32_t p_domain_id, GDMonoAssembly *p_assembly) {
+
+ assemblies[p_domain_id][p_assembly->get_name()] = p_assembly;
+}
+
+GDMonoAssembly **GDMono::get_loaded_assembly(const String &p_name) {
+
+ MonoDomain *domain = mono_domain_get();
+ uint32_t domain_id = domain ? mono_domain_get_id(domain) : 0;
+ return assemblies[domain_id].getptr(p_name);
+}
+
+bool GDMono::_load_assembly(const String &p_name, GDMonoAssembly **r_assembly) {
+
+ CRASH_COND(!r_assembly);
+
+ if (OS::get_singleton()->is_stdout_verbose())
+ OS::get_singleton()->print((String() + "Mono: Loading assembly " + p_name + "...\n").utf8());
+
+ MonoImageOpenStatus status = MONO_IMAGE_OK;
+ MonoAssemblyName *aname = mono_assembly_name_new(p_name.utf8());
+ MonoAssembly *assembly = mono_assembly_load_full(aname, NULL, &status, false);
+ mono_assembly_name_free(aname);
+
+ if (!assembly)
+ return false;
+
+ uint32_t domain_id = mono_domain_get_id(mono_domain_get());
+
+ GDMonoAssembly **stored_assembly = assemblies[domain_id].getptr(p_name);
+
+ ERR_FAIL_COND_V(status != MONO_IMAGE_OK, false);
+ ERR_FAIL_COND_V(stored_assembly == NULL, false);
+
+ ERR_FAIL_COND_V((*stored_assembly)->get_assembly() != assembly, false);
+ *r_assembly = *stored_assembly;
+
+ if (OS::get_singleton()->is_stdout_verbose())
+ OS::get_singleton()->print(String("Mono: Assembly " + p_name + " loaded from path: " + (*r_assembly)->get_path() + "\n").utf8());
+
+ return true;
+}
+
+bool GDMono::_load_corlib_assembly() {
+
+ if (corlib_assembly)
+ return true;
+
+ bool success = _load_assembly("mscorlib", &corlib_assembly);
+
+ if (success)
+ GDMonoUtils::update_corlib_cache();
+
+ return success;
+}
+
+bool GDMono::_load_core_api_assembly() {
+
+ if (api_assembly)
+ return true;
+
+ bool success = _load_assembly(API_ASSEMBLY_NAME, &api_assembly);
+
+ if (success)
+ GDMonoUtils::update_godot_api_cache();
+
+ return success;
+}
+
+#ifdef TOOLS_ENABLED
+bool GDMono::_load_editor_api_assembly() {
+
+ if (editor_api_assembly)
+ return true;
+
+ return _load_assembly(EDITOR_API_ASSEMBLY_NAME, &editor_api_assembly);
+}
+#endif
+
+#ifdef TOOLS_ENABLED
+bool GDMono::_load_editor_tools_assembly() {
+
+ if (editor_tools_assembly)
+ return true;
+
+ _GDMONO_SCOPE_DOMAIN_(tools_domain)
+
+ return _load_assembly(EDITOR_TOOLS_ASSEMBLY_NAME, &editor_tools_assembly);
+}
+#endif
+
+bool GDMono::_load_project_assembly() {
+
+ if (project_assembly)
+ return true;
+
+ String project_assembly_name = ProjectSettings::get_singleton()->get("application/config/name");
+
+ bool success = _load_assembly(project_assembly_name, &project_assembly);
+
+ if (success)
+ mono_assembly_set_main(project_assembly->get_assembly());
+
+ return success;
+}
+
+bool GDMono::_load_all_script_assemblies() {
+
+#ifndef MONO_GLUE_DISABLED
+ if (!_load_core_api_assembly()) {
+ if (OS::get_singleton()->is_stdout_verbose())
+ OS::get_singleton()->printerr("Mono: Failed to load Core API assembly\n");
+ return false;
+ } else {
+#ifdef TOOLS_ENABLED
+ if (!_load_editor_api_assembly()) {
+ if (OS::get_singleton()->is_stdout_verbose())
+ OS::get_singleton()->printerr("Mono: Failed to load Editor API assembly\n");
+ return false;
+ }
+#endif
+ }
+
+ if (!_load_project_assembly()) {
+ if (OS::get_singleton()->is_stdout_verbose())
+ OS::get_singleton()->printerr("Mono: Failed to load project assembly\n");
+ return false;
+ }
+
+ return true;
+#else
+ if (OS::get_singleton()->is_stdout_verbose())
+ OS::get_singleton()->print("Mono: Glue disbled, ignoring script assemblies\n");
+
+ return true;
+#endif
+}
+
+Error GDMono::_load_scripts_domain() {
+
+ ERR_FAIL_COND_V(scripts_domain != NULL, ERR_BUG);
+
+ if (OS::get_singleton()->is_stdout_verbose()) {
+ OS::get_singleton()->print("Mono: Loading scripts domain...\n");
+ }
+
+ scripts_domain = GDMonoUtils::create_domain("GodotEngine.ScriptsDomain");
+
+ ERR_EXPLAIN("Mono: Could not create scripts app domain");
+ ERR_FAIL_NULL_V(scripts_domain, ERR_CANT_CREATE);
+
+ mono_domain_set(scripts_domain, true);
+
+ return OK;
+}
+
+Error GDMono::_unload_scripts_domain() {
+
+ ERR_FAIL_NULL_V(scripts_domain, ERR_BUG);
+
+ if (OS::get_singleton()->is_stdout_verbose()) {
+ OS::get_singleton()->print("Mono: Unloading scripts domain...\n");
+ }
+
+ _GodotSharp::get_singleton()->_dispose_callback();
+
+ if (mono_domain_get() != root_domain)
+ mono_domain_set(root_domain, true);
+
+ mono_gc_collect(mono_gc_max_generation());
+
+ finalizing_scripts_domain = true;
+ mono_domain_finalize(scripts_domain, 2000);
+ finalizing_scripts_domain = false;
+
+ mono_gc_collect(mono_gc_max_generation());
+
+ _domain_assemblies_cleanup(mono_domain_get_id(scripts_domain));
+
+ api_assembly = NULL;
+ project_assembly = NULL;
+#ifdef TOOLS_ENABLED
+ editor_api_assembly = NULL;
+#endif
+
+ MonoDomain *domain = scripts_domain;
+ scripts_domain = NULL;
+
+ _GodotSharp::get_singleton()->_dispose_callback();
+
+ MonoObject *ex = NULL;
+ mono_domain_try_unload(domain, &ex);
+
+ if (ex) {
+ ERR_PRINT("Exception thrown when unloading scripts domain:");
+ mono_print_unhandled_exception(ex);
+ return FAILED;
+ }
+
+ return OK;
+}
+
+#ifdef TOOLS_ENABLED
+Error GDMono::_load_tools_domain() {
+
+ ERR_FAIL_COND_V(tools_domain != NULL, ERR_BUG);
+
+ if (OS::get_singleton()->is_stdout_verbose()) {
+ OS::get_singleton()->print("Mono: Loading tools domain...\n");
+ }
+
+ tools_domain = GDMonoUtils::create_domain("GodotEngine.ToolsDomain");
+
+ ERR_EXPLAIN("Mono: Could not create tools app domain");
+ ERR_FAIL_NULL_V(tools_domain, ERR_CANT_CREATE);
+
+ return OK;
+}
+#endif
+
+#ifdef TOOLS_ENABLED
+Error GDMono::reload_scripts_domain() {
+
+ ERR_FAIL_COND_V(!runtime_initialized, ERR_BUG);
+
+ if (scripts_domain) {
+ Error err = _unload_scripts_domain();
+ if (err != OK) {
+ ERR_PRINT("Mono: Failed to unload scripts domain");
+ return err;
+ }
+ }
+
+ Error err = _load_scripts_domain();
+ if (err != OK) {
+ ERR_PRINT("Mono: Failed to load scripts domain");
+ return err;
+ }
+
+ if (!_load_all_script_assemblies()) {
+ if (OS::get_singleton()->is_stdout_verbose())
+ OS::get_singleton()->printerr("Mono: Failed to load script assemblies\n");
+ return ERR_CANT_OPEN;
+ }
+
+ return OK;
+}
+#endif
+
+GDMonoClass *GDMono::get_class(MonoClass *p_raw_class) {
+
+ MonoImage *image = mono_class_get_image(p_raw_class);
+
+ if (image == corlib_assembly->get_image())
+ return corlib_assembly->get_class(p_raw_class);
+
+ uint32_t domain_id = mono_domain_get_id(mono_domain_get());
+ HashMap<String, GDMonoAssembly *> &domain_assemblies = assemblies[domain_id];
+
+ const String *k = NULL;
+ while ((k = domain_assemblies.next(k))) {
+ GDMonoAssembly *assembly = domain_assemblies.get(*k);
+ if (assembly->get_image() == image) {
+ GDMonoClass *klass = assembly->get_class(p_raw_class);
+
+ if (klass)
+ return klass;
+ }
+ }
+
+ return NULL;
+}
+
+void GDMono::_domain_assemblies_cleanup(uint32_t p_domain_id) {
+
+ HashMap<String, GDMonoAssembly *> &domain_assemblies = assemblies[p_domain_id];
+
+ const String *k = NULL;
+ while ((k = domain_assemblies.next(k))) {
+ memdelete(domain_assemblies.get(*k));
+ }
+
+ assemblies.erase(p_domain_id);
+}
+
+GDMono::GDMono() {
+
+ singleton = this;
+
+ gdmono_log = memnew(GDMonoLog);
+
+ runtime_initialized = false;
+ finalizing_scripts_domain = false;
+
+ root_domain = NULL;
+ scripts_domain = NULL;
+#ifdef TOOLS_ENABLED
+ tools_domain = NULL;
+#endif
+
+ corlib_assembly = NULL;
+ api_assembly = NULL;
+ project_assembly = NULL;
+#ifdef TOOLS_ENABLED
+ editor_api_assembly = NULL;
+ editor_tools_assembly = NULL;
+#endif
+
+#ifdef DEBUG_METHODS_ENABLED
+ api_core_hash = 0;
+#ifdef TOOLS_ENABLED
+ api_editor_hash = 0;
+#endif
+#endif
+}
+
+GDMono::~GDMono() {
+
+ if (runtime_initialized) {
+
+ if (scripts_domain) {
+
+ Error err = _unload_scripts_domain();
+ if (err != OK) {
+ WARN_PRINT("Mono: Failed to unload scripts domain");
+ }
+ }
+
+ const uint32_t *k = NULL;
+ while ((k = assemblies.next(k))) {
+ HashMap<String, GDMonoAssembly *> &domain_assemblies = assemblies.get(*k);
+
+ const String *kk = NULL;
+ while ((kk = domain_assemblies.next(kk))) {
+ memdelete(domain_assemblies.get(*kk));
+ }
+ }
+ assemblies.clear();
+
+ GDMonoUtils::clear_cache();
+
+ OS::get_singleton()->print("Mono: Runtime cleanup...\n");
+
+ runtime_initialized = false;
+ mono_jit_cleanup(root_domain);
+ }
+
+ if (gdmono_log)
+ memdelete(gdmono_log);
+}
+
+_GodotSharp *_GodotSharp::singleton = NULL;
+
+void _GodotSharp::_dispose_object(Object *p_object) {
+
+ if (p_object->get_script_instance()) {
+ CSharpInstance *cs_instance = CAST_CSHARP_INSTANCE(p_object->get_script_instance());
+ if (cs_instance) {
+ cs_instance->mono_object_disposed();
+ return;
+ }
+ }
+
+ // Unsafe refcount decrement. The managed instance also counts as a reference.
+ // See: CSharpLanguage::alloc_instance_binding_data(Object *p_object)
+ if (Object::cast_to<Reference>(p_object)->unreference()) {
+ memdelete(p_object);
+ }
+}
+
+void _GodotSharp::_dispose_callback() {
+
+#ifndef NO_THREADS
+ queue_mutex->lock();
+#endif
+
+ for (List<Object *>::Element *E = obj_delete_queue.front(); E; E = E->next()) {
+ _dispose_object(E->get());
+ }
+
+ for (List<NodePath *>::Element *E = np_delete_queue.front(); E; E = E->next()) {
+ memdelete(E->get());
+ }
+
+ for (List<RID *>::Element *E = rid_delete_queue.front(); E; E = E->next()) {
+ memdelete(E->get());
+ }
+
+ obj_delete_queue.clear();
+ np_delete_queue.clear();
+ rid_delete_queue.clear();
+ queue_empty = true;
+
+#ifndef NO_THREADS
+ queue_mutex->unlock();
+#endif
+}
+
+void _GodotSharp::attach_thread() {
+
+ GDMonoUtils::attach_current_thread();
+}
+
+void _GodotSharp::detach_thread() {
+
+ GDMonoUtils::detach_current_thread();
+}
+
+bool _GodotSharp::is_finalizing_domain() {
+
+ return GDMono::get_singleton()->is_finalizing_scripts_domain();
+}
+
+bool _GodotSharp::is_domain_loaded() {
+
+ return GDMono::get_singleton()->get_scripts_domain() != NULL;
+}
+
+#define ENQUEUE_FOR_DISPOSAL(m_queue, m_inst) \
+ m_queue.push_back(m_inst); \
+ if (queue_empty) { \
+ queue_empty = false; \
+ call_deferred("_dispose_callback"); \
+ }
+
+void _GodotSharp::queue_dispose(Object *p_object) {
+
+ if (Thread::get_main_id() == Thread::get_caller_id() && !GDMono::get_singleton()->is_finalizing_scripts_domain()) {
+ _dispose_object(p_object);
+ } else {
+#ifndef NO_THREADS
+ queue_mutex->lock();
+#endif
+
+ ENQUEUE_FOR_DISPOSAL(obj_delete_queue, p_object);
+
+#ifndef NO_THREADS
+ queue_mutex->unlock();
+#endif
+ }
+}
+
+void _GodotSharp::queue_dispose(NodePath *p_node_path) {
+
+ if (Thread::get_main_id() == Thread::get_caller_id() && !GDMono::get_singleton()->is_finalizing_scripts_domain()) {
+ memdelete(p_node_path);
+ } else {
+#ifndef NO_THREADS
+ queue_mutex->lock();
+#endif
+
+ ENQUEUE_FOR_DISPOSAL(np_delete_queue, p_node_path);
+
+#ifndef NO_THREADS
+ queue_mutex->unlock();
+#endif
+ }
+}
+
+void _GodotSharp::queue_dispose(RID *p_rid) {
+
+ if (Thread::get_main_id() == Thread::get_caller_id() && !GDMono::get_singleton()->is_finalizing_scripts_domain()) {
+ memdelete(p_rid);
+ } else {
+#ifndef NO_THREADS
+ queue_mutex->lock();
+#endif
+
+ ENQUEUE_FOR_DISPOSAL(rid_delete_queue, p_rid);
+
+#ifndef NO_THREADS
+ queue_mutex->unlock();
+#endif
+ }
+}
+
+void _GodotSharp::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("attach_thread"), &_GodotSharp::attach_thread);
+ ClassDB::bind_method(D_METHOD("detach_thread"), &_GodotSharp::detach_thread);
+
+ ClassDB::bind_method(D_METHOD("is_finalizing_domain"), &_GodotSharp::is_finalizing_domain);
+ ClassDB::bind_method(D_METHOD("is_domain_loaded"), &_GodotSharp::is_domain_loaded);
+
+ ClassDB::bind_method(D_METHOD("_dispose_callback"), &_GodotSharp::_dispose_callback);
+}
+
+_GodotSharp::_GodotSharp() {
+
+ singleton = this;
+ queue_empty = true;
+#ifndef NO_THREADS
+ queue_mutex = Mutex::create();
+#endif
+}
+
+_GodotSharp::~_GodotSharp() {
+
+ singleton = NULL;
+
+ if (queue_mutex) {
+ memdelete(queue_mutex);
+ }
+}
diff --git a/modules/mono/mono_gd/gd_mono.h b/modules/mono/mono_gd/gd_mono.h
new file mode 100644
index 0000000000..b188c0730a
--- /dev/null
+++ b/modules/mono/mono_gd/gd_mono.h
@@ -0,0 +1,226 @@
+/*************************************************************************/
+/* gd_mono.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef GD_MONO_H
+#define GD_MONO_H
+
+#include "../godotsharp_defs.h"
+#include "gd_mono_assembly.h"
+#include "gd_mono_log.h"
+
+#ifdef WINDOWS_ENABLED
+#include "../utils/mono_reg_utils.h"
+#endif
+
+#define SCRIPTS_DOMAIN GDMono::get_singleton()->get_scripts_domain()
+#ifdef TOOLS_ENABLED
+#define TOOLS_DOMAIN GDMono::get_singleton()->get_tools_domain()
+#endif
+
+class GDMono {
+
+ bool runtime_initialized;
+ bool finalizing_scripts_domain;
+
+ MonoDomain *root_domain;
+ MonoDomain *scripts_domain;
+#ifdef TOOLS_ENABLED
+ MonoDomain *tools_domain;
+#endif
+
+ GDMonoAssembly *corlib_assembly;
+ GDMonoAssembly *api_assembly;
+ GDMonoAssembly *project_assembly;
+#ifdef TOOLS_ENABLED
+ GDMonoAssembly *editor_api_assembly;
+ GDMonoAssembly *editor_tools_assembly;
+#endif
+
+ HashMap<uint32_t, HashMap<String, GDMonoAssembly *> > assemblies;
+
+ void _domain_assemblies_cleanup(uint32_t p_domain_id);
+
+ bool _load_corlib_assembly();
+ bool _load_core_api_assembly();
+#ifdef TOOLS_ENABLED
+ bool _load_editor_api_assembly();
+ bool _load_editor_tools_assembly();
+#endif
+ bool _load_project_assembly();
+
+ bool _load_all_script_assemblies();
+
+ void _register_internal_calls();
+
+ Error _load_scripts_domain();
+ Error _unload_scripts_domain();
+
+#ifdef TOOLS_ENABLED
+ Error _load_tools_domain();
+#endif
+
+#ifdef DEBUG_METHODS_ENABLED
+ uint64_t api_core_hash;
+#ifdef TOOLS_ENABLED
+ uint64_t api_editor_hash;
+#endif
+ void _initialize_and_check_api_hashes();
+#endif
+
+ bool _load_assembly(const String &p_name, GDMonoAssembly **r_assembly);
+
+ GDMonoLog *gdmono_log;
+
+#ifdef WINDOWS_ENABLED
+ MonoRegInfo mono_reg_info;
+#endif
+
+protected:
+ static GDMono *singleton;
+
+public:
+#ifdef DEBUG_METHODS_ENABLED
+ uint64_t get_api_core_hash() { return api_core_hash; }
+#ifdef TOOLS_ENABLED
+ uint64_t get_api_editor_hash() { return api_editor_hash; }
+#endif
+#endif
+
+ enum MemberVisibility {
+ PRIVATE,
+ PROTECTED_AND_INTERNAL, // FAM_AND_ASSEM
+ INTERNAL, // ASSEMBLY
+ PROTECTED, // FAMILY
+ PUBLIC
+ };
+
+ static GDMono *get_singleton() { return singleton; }
+
+ // Do not use these, unless you know what you're doing
+ void add_assembly(uint32_t p_domain_id, GDMonoAssembly *p_assembly);
+ GDMonoAssembly **get_loaded_assembly(const String &p_name);
+
+ _FORCE_INLINE_ bool is_runtime_initialized() const { return runtime_initialized; }
+ _FORCE_INLINE_ bool is_finalizing_scripts_domain() const { return finalizing_scripts_domain; }
+
+ _FORCE_INLINE_ MonoDomain *get_scripts_domain() { return scripts_domain; }
+#ifdef TOOLS_ENABLED
+ _FORCE_INLINE_ MonoDomain *get_tools_domain() { return tools_domain; }
+#endif
+
+ _FORCE_INLINE_ GDMonoAssembly *get_corlib_assembly() const { return corlib_assembly; }
+ _FORCE_INLINE_ GDMonoAssembly *get_api_assembly() const { return api_assembly; }
+ _FORCE_INLINE_ GDMonoAssembly *get_project_assembly() const { return project_assembly; }
+#ifdef TOOLS_ENABLED
+ _FORCE_INLINE_ GDMonoAssembly *get_editor_api_assembly() const { return editor_api_assembly; }
+ _FORCE_INLINE_ GDMonoAssembly *get_editor_tools_assembly() const { return editor_tools_assembly; }
+#endif
+
+#ifdef WINDOWS_ENABLED
+ const MonoRegInfo &get_mono_reg_info() { return mono_reg_info; }
+#endif
+
+ GDMonoClass *get_class(MonoClass *p_raw_class);
+
+#ifdef TOOLS_ENABLED
+ Error reload_scripts_domain();
+#endif
+
+ void initialize();
+
+ GDMono();
+ ~GDMono();
+};
+
+class GDMonoScopeDomain {
+
+ MonoDomain *prev_domain;
+
+public:
+ GDMonoScopeDomain(MonoDomain *p_domain) {
+ MonoDomain *prev_domain = mono_domain_get();
+ if (prev_domain != p_domain) {
+ this->prev_domain = prev_domain;
+ mono_domain_set(p_domain, false);
+ } else {
+ this->prev_domain = NULL;
+ }
+ }
+
+ ~GDMonoScopeDomain() {
+ if (prev_domain)
+ mono_domain_set(prev_domain, false);
+ }
+};
+
+#define _GDMONO_SCOPE_DOMAIN_(m_mono_domain) \
+ GDMonoScopeDomain __gdmono__scope__domain__(m_mono_domain); \
+ (void)__gdmono__scope__domain__;
+
+class _GodotSharp : public Object {
+ GDCLASS(_GodotSharp, Object)
+
+ friend class GDMono;
+
+ void _dispose_object(Object *p_object);
+
+ void _dispose_callback();
+
+ List<Object *> obj_delete_queue;
+ List<NodePath *> np_delete_queue;
+ List<RID *> rid_delete_queue;
+
+ bool queue_empty;
+
+#ifndef NO_THREADS
+ Mutex *queue_mutex;
+#endif
+
+protected:
+ static _GodotSharp *singleton;
+ static void _bind_methods();
+
+public:
+ static _GodotSharp *get_singleton() { return singleton; }
+
+ void attach_thread();
+ void detach_thread();
+
+ bool is_finalizing_domain();
+ bool is_domain_loaded();
+
+ void queue_dispose(Object *p_object);
+ void queue_dispose(NodePath *p_node_path);
+ void queue_dispose(RID *p_rid);
+
+ _GodotSharp();
+ ~_GodotSharp();
+};
+
+#endif // GD_MONO_H
diff --git a/modules/mono/mono_gd/gd_mono_assembly.cpp b/modules/mono/mono_gd/gd_mono_assembly.cpp
new file mode 100644
index 0000000000..4b370295f3
--- /dev/null
+++ b/modules/mono/mono_gd/gd_mono_assembly.cpp
@@ -0,0 +1,356 @@
+/*************************************************************************/
+/* gd_mono_assembly.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "gd_mono_assembly.h"
+
+#include <mono/metadata/mono-debug.h>
+#include <mono/metadata/tokentype.h>
+
+#include "list.h"
+#include "os/file_access.h"
+#include "os/os.h"
+
+#include "../godotsharp_dirs.h"
+#include "gd_mono_class.h"
+
+bool GDMonoAssembly::no_search = false;
+Vector<String> GDMonoAssembly::search_dirs;
+
+MonoAssembly *GDMonoAssembly::_search_hook(MonoAssemblyName *aname, void *user_data) {
+
+ (void)user_data; // UNUSED
+
+ String name = mono_assembly_name_get_name(aname);
+ bool has_extension = name.ends_with(".dll") || name.ends_with(".exe");
+
+ if (no_search)
+ return NULL;
+
+ GDMonoAssembly **loaded_asm = GDMono::get_singleton()->get_loaded_assembly(has_extension ? name.get_basename() : name);
+ if (loaded_asm)
+ return (*loaded_asm)->get_assembly();
+
+ no_search = true; // Avoid the recursion madness
+
+ String path;
+ MonoAssembly *res = NULL;
+
+ for (int i = 0; i < search_dirs.size(); i++) {
+ const String &search_dir = search_dirs[i];
+
+ if (has_extension) {
+ path = search_dir.plus_file(name);
+ if (FileAccess::exists(path)) {
+ res = _load_assembly_from(name.get_basename(), path);
+ break;
+ }
+ } else {
+ path = search_dir.plus_file(name + ".dll");
+ if (FileAccess::exists(path)) {
+ res = _load_assembly_from(name, path);
+ break;
+ }
+
+ path = search_dir.plus_file(name + ".exe");
+ if (FileAccess::exists(path)) {
+ res = _load_assembly_from(name, path);
+ break;
+ }
+ }
+ }
+
+ no_search = false;
+
+ return res;
+}
+
+MonoAssembly *GDMonoAssembly::_preload_hook(MonoAssemblyName *aname, char **assemblies_path, void *user_data) {
+
+ (void)user_data; // UNUSED
+
+ if (search_dirs.empty()) {
+ search_dirs.push_back(GodotSharpDirs::get_res_temp_assemblies_dir());
+ search_dirs.push_back(GodotSharpDirs::get_res_assemblies_dir());
+ search_dirs.push_back(OS::get_singleton()->get_resource_dir());
+ search_dirs.push_back(OS::get_singleton()->get_executable_path().get_base_dir());
+
+ const char *rootdir = mono_assembly_getrootdir();
+ if (rootdir) {
+ search_dirs.push_back(String(rootdir).plus_file("mono").plus_file("4.5"));
+ }
+
+ while (assemblies_path) {
+ if (*assemblies_path)
+ search_dirs.push_back(*assemblies_path);
+ ++assemblies_path;
+ }
+ }
+
+ return NULL;
+}
+
+MonoAssembly *GDMonoAssembly::_load_assembly_from(const String &p_name, const String &p_path) {
+
+ GDMonoAssembly *assembly = memnew(GDMonoAssembly(p_name, p_path));
+
+ MonoDomain *domain = mono_domain_get();
+
+ Error err = assembly->load(domain);
+
+ if (err != OK) {
+ memdelete(assembly);
+ ERR_FAIL_V(NULL);
+ }
+
+ GDMono::get_singleton()->add_assembly(domain ? mono_domain_get_id(domain) : 0, assembly);
+
+ return assembly->get_assembly();
+}
+
+void GDMonoAssembly::initialize() {
+
+ // TODO refonly as well?
+ mono_install_assembly_preload_hook(&GDMonoAssembly::_preload_hook, NULL);
+ mono_install_assembly_search_hook(&GDMonoAssembly::_search_hook, NULL);
+}
+
+Error GDMonoAssembly::load(MonoDomain *p_domain) {
+
+ ERR_FAIL_COND_V(loaded, ERR_FILE_ALREADY_IN_USE);
+
+ uint64_t last_modified_time = FileAccess::get_modified_time(path);
+
+ Vector<uint8_t> data = FileAccess::get_file_as_array(path);
+ ERR_FAIL_COND_V(data.empty(), ERR_FILE_CANT_READ);
+
+ String image_filename(path);
+
+ MonoImageOpenStatus status;
+
+ image = mono_image_open_from_data_with_name(
+ (char *)&data[0], data.size(),
+ true, &status, false,
+ image_filename.utf8().get_data());
+
+ ERR_FAIL_COND_V(status != MONO_IMAGE_OK || image == NULL, ERR_FILE_CANT_OPEN);
+
+#ifdef DEBUG_ENABLED
+ String pdb_path(path + ".pdb");
+
+ if (!FileAccess::exists(pdb_path)) {
+ pdb_path = path.get_basename() + ".pdb"; // without .dll
+
+ if (!FileAccess::exists(pdb_path))
+ goto no_pdb;
+ }
+
+ pdb_data.clear();
+ pdb_data = FileAccess::get_file_as_array(pdb_path);
+ mono_debug_open_image_from_memory(image, &pdb_data[0], pdb_data.size());
+
+no_pdb:
+
+#endif
+
+ assembly = mono_assembly_load_from_full(image, image_filename.utf8().get_data(), &status, false);
+
+ ERR_FAIL_COND_V(status != MONO_IMAGE_OK || assembly == NULL, ERR_FILE_CANT_OPEN);
+
+ if (p_domain && mono_image_get_entry_point(image)) {
+ // TODO should this be removed? do we want to call main? what other effects does this have?
+ mono_jit_exec(p_domain, assembly, 0, NULL);
+ }
+
+ loaded = true;
+ modified_time = last_modified_time;
+
+ return OK;
+}
+
+Error GDMonoAssembly::wrapper_for_image(MonoImage *p_image) {
+
+ ERR_FAIL_COND_V(loaded, ERR_FILE_ALREADY_IN_USE);
+
+ assembly = mono_image_get_assembly(p_image);
+ ERR_FAIL_NULL_V(assembly, FAILED);
+
+ image = p_image;
+
+ mono_image_addref(image);
+
+ loaded = true;
+
+ return OK;
+}
+
+void GDMonoAssembly::unload() {
+
+ ERR_FAIL_COND(!loaded);
+
+#ifdef DEBUG_ENABLED
+ if (pdb_data.size()) {
+ mono_debug_close_image(image);
+ pdb_data.clear();
+ }
+#endif
+
+ for (Map<MonoClass *, GDMonoClass *>::Element *E = cached_raw.front(); E; E = E->next()) {
+ memdelete(E->value());
+ }
+
+ cached_classes.clear();
+ cached_raw.clear();
+
+ mono_image_close(image);
+
+ assembly = NULL;
+ image = NULL;
+ loaded = false;
+}
+
+GDMonoClass *GDMonoAssembly::get_class(const StringName &p_namespace, const StringName &p_name) {
+
+ ERR_FAIL_COND_V(!loaded, NULL);
+
+ ClassKey key(p_namespace, p_name);
+
+ GDMonoClass **match = cached_classes.getptr(key);
+
+ if (match)
+ return *match;
+
+ MonoClass *mono_class = mono_class_from_name(image, String(p_namespace).utf8(), String(p_name).utf8());
+
+ if (!mono_class)
+ return NULL;
+
+ GDMonoClass *wrapped_class = memnew(GDMonoClass(p_namespace, p_name, mono_class, this));
+
+ cached_classes[key] = wrapped_class;
+ cached_raw[mono_class] = wrapped_class;
+
+ return wrapped_class;
+}
+
+GDMonoClass *GDMonoAssembly::get_class(MonoClass *p_mono_class) {
+
+ ERR_FAIL_COND_V(!loaded, NULL);
+
+ Map<MonoClass *, GDMonoClass *>::Element *match = cached_raw.find(p_mono_class);
+
+ if (match)
+ return match->value();
+
+ StringName namespace_name = mono_class_get_namespace(p_mono_class);
+ StringName class_name = mono_class_get_name(p_mono_class);
+
+ GDMonoClass *wrapped_class = memnew(GDMonoClass(namespace_name, class_name, p_mono_class, this));
+
+ cached_classes[ClassKey(namespace_name, class_name)] = wrapped_class;
+ cached_raw[p_mono_class] = wrapped_class;
+
+ return wrapped_class;
+}
+
+GDMonoClass *GDMonoAssembly::get_object_derived_class(const StringName &p_class) {
+
+ GDMonoClass *match = NULL;
+
+ if (gdobject_class_cache_updated) {
+ Map<StringName, GDMonoClass *>::Element *result = gdobject_class_cache.find(p_class);
+
+ if (result)
+ match = result->get();
+ } else {
+ List<GDMonoClass *> nested_classes;
+
+ int rows = mono_image_get_table_rows(image, MONO_TABLE_TYPEDEF);
+
+ for (int i = 1; i < rows; i++) {
+ MonoClass *mono_class = mono_class_get(image, (i + 1) | MONO_TOKEN_TYPE_DEF);
+
+ if (!mono_class_is_assignable_from(CACHED_CLASS_RAW(GodotObject), mono_class))
+ continue;
+
+ GDMonoClass *current = get_class(mono_class);
+
+ if (!current)
+ continue;
+
+ nested_classes.push_back(current);
+
+ if (!match && current->get_name() == p_class)
+ match = current;
+
+ while (!nested_classes.empty()) {
+ GDMonoClass *current_nested = nested_classes.front()->get();
+ nested_classes.pop_back();
+
+ void *iter = NULL;
+
+ while (true) {
+ MonoClass *raw_nested = mono_class_get_nested_types(current_nested->get_raw(), &iter);
+
+ if (!raw_nested)
+ break;
+
+ GDMonoClass *nested_class = get_class(raw_nested);
+
+ if (nested_class) {
+ gdobject_class_cache.insert(nested_class->get_name(), nested_class);
+ nested_classes.push_back(nested_class);
+ }
+ }
+ }
+
+ gdobject_class_cache.insert(current->get_name(), current);
+ }
+
+ gdobject_class_cache_updated = true;
+ }
+
+ return match;
+}
+
+GDMonoAssembly::GDMonoAssembly(const String &p_name, const String &p_path) {
+
+ loaded = false;
+ gdobject_class_cache_updated = false;
+ name = p_name;
+ path = p_path;
+ modified_time = 0;
+ assembly = NULL;
+ image = NULL;
+}
+
+GDMonoAssembly::~GDMonoAssembly() {
+
+ if (loaded)
+ unload();
+}
diff --git a/modules/mono/mono_gd/gd_mono_assembly.h b/modules/mono/mono_gd/gd_mono_assembly.h
new file mode 100644
index 0000000000..710b674622
--- /dev/null
+++ b/modules/mono/mono_gd/gd_mono_assembly.h
@@ -0,0 +1,121 @@
+/*************************************************************************/
+/* gd_mono_assembly.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef GD_MONO_ASSEMBLY_H
+#define GD_MONO_ASSEMBLY_H
+
+#include <mono/jit/jit.h>
+#include <mono/metadata/assembly.h>
+
+#include "gd_mono_utils.h"
+#include "hash_map.h"
+#include "map.h"
+#include "ustring.h"
+
+class GDMonoAssembly {
+
+ struct ClassKey {
+ struct Hasher {
+ static _FORCE_INLINE_ uint32_t hash(const ClassKey &p_key) {
+ uint32_t hash = 0;
+
+ GDMonoUtils::hash_combine(hash, p_key.namespace_name.hash());
+ GDMonoUtils::hash_combine(hash, p_key.class_name.hash());
+
+ return hash;
+ }
+ };
+
+ _FORCE_INLINE_ bool operator==(const ClassKey &p_a) const {
+ return p_a.class_name == class_name && p_a.namespace_name == namespace_name;
+ }
+
+ ClassKey() {}
+
+ ClassKey(const StringName &p_namespace_name, const StringName &p_class_name) {
+ namespace_name = p_namespace_name;
+ class_name = p_class_name;
+ }
+
+ StringName namespace_name;
+ StringName class_name;
+ };
+
+ MonoAssembly *assembly;
+ MonoImage *image;
+
+ bool loaded;
+
+ String name;
+ String path;
+ uint64_t modified_time;
+
+ HashMap<ClassKey, GDMonoClass *, ClassKey::Hasher> cached_classes;
+ Map<MonoClass *, GDMonoClass *> cached_raw;
+
+ bool gdobject_class_cache_updated;
+ Map<StringName, GDMonoClass *> gdobject_class_cache;
+
+#ifdef DEBUG_ENABLED
+ Vector<uint8_t> pdb_data;
+#endif
+
+ static bool no_search;
+ static Vector<String> search_dirs;
+
+ static MonoAssembly *_search_hook(MonoAssemblyName *aname, void *user_data);
+ static MonoAssembly *_preload_hook(MonoAssemblyName *aname, char **assemblies_path, void *user_data);
+
+ static MonoAssembly *_load_assembly_from(const String &p_name, const String &p_path);
+
+ friend class GDMono;
+ static void initialize();
+
+public:
+ Error load(MonoDomain *p_domain);
+ Error wrapper_for_image(MonoImage *p_image);
+ void unload();
+
+ _FORCE_INLINE_ bool is_loaded() const { return loaded; }
+ _FORCE_INLINE_ MonoImage *get_image() const { return image; }
+ _FORCE_INLINE_ MonoAssembly *get_assembly() const { return assembly; }
+ _FORCE_INLINE_ String get_name() const { return name; }
+ _FORCE_INLINE_ String get_path() const { return path; }
+ _FORCE_INLINE_ uint64_t get_modified_time() const { return modified_time; }
+
+ GDMonoClass *get_class(const StringName &p_namespace, const StringName &p_class);
+ GDMonoClass *get_class(MonoClass *p_mono_class);
+
+ GDMonoClass *get_object_derived_class(const StringName &p_class);
+
+ GDMonoAssembly(const String &p_name, const String &p_path = String());
+ ~GDMonoAssembly();
+};
+
+#endif // GD_MONO_ASSEMBLY_H
diff --git a/modules/mono/mono_gd/gd_mono_class.cpp b/modules/mono/mono_gd/gd_mono_class.cpp
new file mode 100644
index 0000000000..0134ace5d7
--- /dev/null
+++ b/modules/mono/mono_gd/gd_mono_class.cpp
@@ -0,0 +1,381 @@
+/*************************************************************************/
+/* gd_mono_class.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "gd_mono_class.h"
+
+#include <mono/metadata/attrdefs.h>
+
+#include "gd_mono_assembly.h"
+
+MonoType *GDMonoClass::get_raw_type(GDMonoClass *p_class) {
+
+ return mono_class_get_type(p_class->get_raw());
+}
+
+bool GDMonoClass::is_assignable_from(GDMonoClass *p_from) const {
+
+ return mono_class_is_assignable_from(mono_class, p_from->mono_class);
+}
+
+GDMonoClass *GDMonoClass::get_parent_class() {
+
+ if (assembly) {
+ MonoClass *parent_mono_class = mono_class_get_parent(mono_class);
+
+ if (parent_mono_class) {
+ return GDMono::get_singleton()->get_class(parent_mono_class);
+ }
+ }
+
+ return NULL;
+}
+
+bool GDMonoClass::has_method(const StringName &p_name) {
+
+ return get_method(p_name) != NULL;
+}
+
+bool GDMonoClass::has_attribute(GDMonoClass *p_attr_class) {
+
+#ifdef DEBUG_ENABLED
+ ERR_FAIL_NULL_V(p_attr_class, false);
+#endif
+
+ if (!attrs_fetched)
+ fetch_attributes();
+
+ if (!attributes)
+ return false;
+
+ return mono_custom_attrs_has_attr(attributes, p_attr_class->get_raw());
+}
+
+MonoObject *GDMonoClass::get_attribute(GDMonoClass *p_attr_class) {
+
+#ifdef DEBUG_ENABLED
+ ERR_FAIL_NULL_V(p_attr_class, NULL);
+#endif
+
+ if (!attrs_fetched)
+ fetch_attributes();
+
+ if (!attributes)
+ return NULL;
+
+ return mono_custom_attrs_get_attr(attributes, p_attr_class->get_raw());
+}
+
+void GDMonoClass::fetch_attributes() {
+
+ ERR_FAIL_COND(attributes != NULL);
+
+ attributes = mono_custom_attrs_from_class(get_raw());
+ attrs_fetched = true;
+}
+
+void GDMonoClass::fetch_methods_with_godot_api_checks(GDMonoClass *p_native_base) {
+
+ CRASH_COND(!CACHED_CLASS(GodotObject)->is_assignable_from(this));
+
+ if (methods_fetched)
+ return;
+
+ void *iter = NULL;
+ MonoMethod *raw_method = NULL;
+ while ((raw_method = mono_class_get_methods(get_raw(), &iter)) != NULL) {
+ StringName name = mono_method_get_name(raw_method);
+
+ GDMonoMethod *method = get_method(raw_method, name);
+ ERR_CONTINUE(!method);
+
+ if (method->get_name() != name) {
+
+#ifdef DEBUG_ENABLED
+ String fullname = method->get_ret_type_full_name() + " " + name + "(" + method->get_signature_desc(true) + ")";
+ WARN_PRINTS("Method `" + fullname + "` is hidden by Godot API method. Should be `" +
+ method->get_full_name_no_class() + "`. In class `" + namespace_name + "." + class_name + "`.");
+#endif
+ continue;
+ }
+
+#ifdef DEBUG_ENABLED
+ // For debug builds, we also fetched from native base classes as well before if this is not a native base class.
+ // This allows us to warn the user here if he is using snake_case by mistake.
+
+ if (p_native_base != this) {
+
+ GDMonoClass *native_top = p_native_base;
+ while (native_top) {
+ GDMonoMethod *m = native_top->get_method(name, method->get_parameters_count());
+
+ if (m && m->get_name() != name) {
+ // found
+ String fullname = m->get_ret_type_full_name() + " " + name + "(" + m->get_signature_desc(true) + ")";
+ WARN_PRINTS("Method `" + fullname + "` should be `" + m->get_full_name_no_class() +
+ "`. In class `" + namespace_name + "." + class_name + "`.");
+ break;
+ }
+
+ if (native_top == CACHED_CLASS(GodotObject))
+ break;
+
+ native_top = native_top->get_parent_class();
+ }
+ }
+#endif
+
+ uint32_t flags = mono_method_get_flags(method->mono_method, NULL);
+
+ if (!(flags & MONO_METHOD_ATTR_VIRTUAL))
+ continue;
+
+ // Virtual method of Godot Object derived type, let's try to find GodotMethod attribute
+
+ GDMonoClass *top = p_native_base;
+
+ while (top) {
+ GDMonoMethod *base_method = top->get_method(name, method->get_parameters_count());
+
+ if (base_method && base_method->has_attribute(CACHED_CLASS(GodotMethodAttribute))) {
+ // Found base method with GodotMethod attribute.
+ // We get the original API method name from this attribute.
+ // This name must point to the virtual method.
+
+ MonoObject *attr = base_method->get_attribute(CACHED_CLASS(GodotMethodAttribute));
+
+ StringName godot_method_name = CACHED_FIELD(GodotMethodAttribute, methodName)->get_string_value(attr);
+#ifdef DEBUG_ENABLED
+ CRASH_COND(godot_method_name == StringName());
+#endif
+ MethodKey key = MethodKey(godot_method_name, method->get_parameters_count());
+ GDMonoMethod **existing_method = methods.getptr(key);
+ if (existing_method)
+ memdelete(*existing_method); // Must delete old one
+ methods.set(key, method);
+
+ break;
+ }
+
+ if (top == CACHED_CLASS(GodotObject))
+ break;
+
+ top = top->get_parent_class();
+ }
+ }
+
+ methods_fetched = true;
+}
+
+GDMonoMethod *GDMonoClass::get_method(const StringName &p_name) {
+
+ ERR_FAIL_COND_V(!methods_fetched, NULL);
+
+ const MethodKey *k = NULL;
+
+ while ((k = methods.next(k))) {
+ if (k->name == p_name)
+ return methods.get(*k);
+ }
+
+ return NULL;
+}
+
+GDMonoMethod *GDMonoClass::get_method(const StringName &p_name, int p_params_count) {
+
+ MethodKey key = MethodKey(p_name, p_params_count);
+
+ GDMonoMethod **match = methods.getptr(key);
+
+ if (match)
+ return *match;
+
+ if (methods_fetched)
+ return NULL;
+
+ MonoMethod *raw_method = mono_class_get_method_from_name(mono_class, String(p_name).utf8().get_data(), p_params_count);
+
+ if (raw_method) {
+ GDMonoMethod *method = memnew(GDMonoMethod(p_name, raw_method));
+ methods.set(key, method);
+
+ return method;
+ }
+
+ return NULL;
+}
+
+GDMonoMethod *GDMonoClass::get_method(MonoMethod *p_raw_method) {
+
+ MonoMethodSignature *sig = mono_method_signature(p_raw_method);
+
+ int params_count = mono_signature_get_param_count(sig);
+ StringName method_name = mono_method_get_name(p_raw_method);
+
+ return get_method(p_raw_method, method_name, params_count);
+}
+
+GDMonoMethod *GDMonoClass::get_method(MonoMethod *p_raw_method, const StringName &p_name) {
+
+ MonoMethodSignature *sig = mono_method_signature(p_raw_method);
+ int params_count = mono_signature_get_param_count(sig);
+ return get_method(p_raw_method, p_name, params_count);
+}
+
+GDMonoMethod *GDMonoClass::get_method(MonoMethod *p_raw_method, const StringName &p_name, int p_params_count) {
+
+ ERR_FAIL_NULL_V(p_raw_method, NULL);
+
+ MethodKey key = MethodKey(p_name, p_params_count);
+
+ GDMonoMethod **match = methods.getptr(key);
+
+ if (match)
+ return *match;
+
+ GDMonoMethod *method = memnew(GDMonoMethod(p_name, p_raw_method));
+ methods.set(key, method);
+
+ return method;
+}
+
+GDMonoMethod *GDMonoClass::get_method_with_desc(const String &p_description, bool p_include_namespace) {
+
+ MonoMethodDesc *desc = mono_method_desc_new(p_description.utf8().get_data(), p_include_namespace);
+ MonoMethod *method = mono_method_desc_search_in_class(desc, mono_class);
+ mono_method_desc_free(desc);
+
+ return get_method(method);
+}
+
+GDMonoField *GDMonoClass::get_field(const StringName &p_name) {
+
+ Map<StringName, GDMonoField *>::Element *result = fields.find(p_name);
+
+ if (result)
+ return result->value();
+
+ if (fields_fetched)
+ return NULL;
+
+ MonoClassField *raw_field = mono_class_get_field_from_name(mono_class, String(p_name).utf8().get_data());
+
+ if (raw_field) {
+ GDMonoField *field = memnew(GDMonoField(raw_field, this));
+ fields.insert(p_name, field);
+
+ return field;
+ }
+
+ return NULL;
+}
+
+const Vector<GDMonoField *> &GDMonoClass::get_all_fields() {
+
+ if (fields_fetched)
+ return fields_list;
+
+ void *iter = NULL;
+ MonoClassField *raw_field = NULL;
+ while ((raw_field = mono_class_get_fields(get_raw(), &iter)) != NULL) {
+ StringName name = mono_field_get_name(raw_field);
+
+ Map<StringName, GDMonoField *>::Element *match = fields.find(name);
+
+ if (match) {
+ fields_list.push_back(match->get());
+ } else {
+ GDMonoField *field = memnew(GDMonoField(raw_field, this));
+ fields.insert(name, field);
+ fields_list.push_back(field);
+ }
+ }
+
+ fields_fetched = true;
+
+ return fields_list;
+}
+
+GDMonoClass::GDMonoClass(const StringName &p_namespace, const StringName &p_name, MonoClass *p_class, GDMonoAssembly *p_assembly) {
+
+ namespace_name = p_namespace;
+ class_name = p_name;
+ mono_class = p_class;
+ assembly = p_assembly;
+
+ attrs_fetched = false;
+ attributes = NULL;
+
+ methods_fetched = false;
+ fields_fetched = false;
+}
+
+GDMonoClass::~GDMonoClass() {
+
+ if (attributes) {
+ mono_custom_attrs_free(attributes);
+ }
+
+ for (Map<StringName, GDMonoField *>::Element *E = fields.front(); E; E = E->next()) {
+ memdelete(E->value());
+ }
+
+ {
+ // Ugly workaround...
+ // We may have duplicated values, because we redirect snake_case methods to PascalCasel (only Godot API methods).
+ // This way, we end with both the snake_case name and the PascalCasel name paired with the same method.
+ // Therefore, we must avoid deleting the same pointer twice.
+
+ int offset = 0;
+ Vector<GDMonoMethod *> deleted_methods;
+ deleted_methods.resize(methods.size());
+
+ const MethodKey *k = NULL;
+ while ((k = methods.next(k))) {
+ GDMonoMethod *method = methods.get(*k);
+
+ if (method) {
+ for (int i = 0; i < offset; i++) {
+ if (deleted_methods[i] == method) {
+ // Already deleted
+ goto already_deleted;
+ }
+ }
+
+ deleted_methods[offset] = method;
+ ++offset;
+
+ memdelete(method);
+ }
+
+ already_deleted:;
+ }
+
+ methods.clear();
+ }
+}
diff --git a/modules/mono/mono_gd/gd_mono_class.h b/modules/mono/mono_gd/gd_mono_class.h
new file mode 100644
index 0000000000..1e72553879
--- /dev/null
+++ b/modules/mono/mono_gd/gd_mono_class.h
@@ -0,0 +1,124 @@
+/*************************************************************************/
+/* gd_mono_class.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef GD_MONO_CLASS_H
+#define GD_MONO_CLASS_H
+
+#include <mono/metadata/debug-helpers.h>
+
+#include "map.h"
+#include "ustring.h"
+
+#include "gd_mono_field.h"
+#include "gd_mono_header.h"
+#include "gd_mono_method.h"
+#include "gd_mono_utils.h"
+
+class GDMonoClass {
+ struct MethodKey {
+ struct Hasher {
+ static _FORCE_INLINE_ uint32_t hash(const MethodKey &p_key) {
+ uint32_t hash = 0;
+
+ GDMonoUtils::hash_combine(hash, p_key.name.hash());
+ GDMonoUtils::hash_combine(hash, HashMapHasherDefault::hash(p_key.params_count));
+
+ return hash;
+ }
+ };
+
+ _FORCE_INLINE_ bool operator==(const MethodKey &p_a) const {
+ return p_a.params_count == params_count && p_a.name == name;
+ }
+
+ MethodKey() {}
+
+ MethodKey(const StringName &p_name, int p_params_count) {
+ name = p_name;
+ params_count = p_params_count;
+ }
+
+ StringName name;
+ int params_count;
+ };
+
+ StringName namespace_name;
+ StringName class_name;
+
+ MonoClass *mono_class;
+ GDMonoAssembly *assembly;
+
+ bool attrs_fetched;
+ MonoCustomAttrInfo *attributes;
+
+ bool methods_fetched;
+ HashMap<MethodKey, GDMonoMethod *, MethodKey::Hasher> methods;
+
+ bool fields_fetched;
+ Map<StringName, GDMonoField *> fields;
+ Vector<GDMonoField *> fields_list;
+
+ friend class GDMonoAssembly;
+ GDMonoClass(const StringName &p_namespace, const StringName &p_name, MonoClass *p_class, GDMonoAssembly *p_assembly);
+
+public:
+ static MonoType *get_raw_type(GDMonoClass *p_class);
+
+ bool is_assignable_from(GDMonoClass *p_from) const;
+
+ _FORCE_INLINE_ StringName get_namespace() const { return namespace_name; }
+ _FORCE_INLINE_ StringName get_name() const { return class_name; }
+
+ _FORCE_INLINE_ MonoClass *get_raw() const { return mono_class; }
+ _FORCE_INLINE_ const GDMonoAssembly *get_assembly() const { return assembly; }
+
+ GDMonoClass *get_parent_class();
+
+ bool has_method(const StringName &p_name);
+
+ bool has_attribute(GDMonoClass *p_attr_class);
+ MonoObject *get_attribute(GDMonoClass *p_attr_class);
+
+ void fetch_attributes();
+ void fetch_methods_with_godot_api_checks(GDMonoClass *p_native_base);
+
+ GDMonoMethod *get_method(const StringName &p_name);
+ GDMonoMethod *get_method(const StringName &p_name, int p_params_count);
+ GDMonoMethod *get_method(MonoMethod *p_raw_method);
+ GDMonoMethod *get_method(MonoMethod *p_raw_method, const StringName &p_name);
+ GDMonoMethod *get_method(MonoMethod *p_raw_method, const StringName &p_name, int p_params_count);
+ GDMonoMethod *get_method_with_desc(const String &p_description, bool p_includes_namespace);
+
+ GDMonoField *get_field(const StringName &p_name);
+ const Vector<GDMonoField *> &get_all_fields();
+
+ ~GDMonoClass();
+};
+
+#endif // GD_MONO_CLASS_H
diff --git a/modules/mono/mono_gd/gd_mono_field.cpp b/modules/mono/mono_gd/gd_mono_field.cpp
new file mode 100644
index 0000000000..c2d8eeaa32
--- /dev/null
+++ b/modules/mono/mono_gd/gd_mono_field.cpp
@@ -0,0 +1,362 @@
+/*************************************************************************/
+/* gd_mono_field.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "gd_mono_field.h"
+
+#include <mono/metadata/attrdefs.h>
+
+#include "gd_mono_class.h"
+#include "gd_mono_marshal.h"
+
+void GDMonoField::set_value_raw(MonoObject *p_object, void *p_ptr) {
+ mono_field_set_value(p_object, mono_field, &p_ptr);
+}
+
+void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) {
+#define SET_FROM_STRUCT_AND_BREAK(m_type) \
+ { \
+ const m_type &val = p_value.operator m_type(); \
+ MARSHALLED_OUT(m_type, val, raw); \
+ mono_field_set_value(p_object, mono_field, raw); \
+ break; \
+ }
+
+#define SET_FROM_PRIMITIVE(m_type) \
+ { \
+ m_type val = p_value.operator m_type(); \
+ mono_field_set_value(p_object, mono_field, &val); \
+ }
+
+#define SET_FROM_ARRAY_AND_BREAK(m_type) \
+ { \
+ MonoArray *managed = GDMonoMarshal::m_type##_to_mono_array(p_value.operator m_type()); \
+ mono_field_set_value(p_object, mono_field, &managed); \
+ break; \
+ }
+
+ switch (type.type_encoding) {
+ case MONO_TYPE_BOOLEAN: {
+ SET_FROM_PRIMITIVE(bool);
+ } break;
+
+ case MONO_TYPE_I1: {
+ SET_FROM_PRIMITIVE(signed char);
+ } break;
+ case MONO_TYPE_I2: {
+ SET_FROM_PRIMITIVE(signed short);
+ } break;
+ case MONO_TYPE_I4: {
+ SET_FROM_PRIMITIVE(signed int);
+ } break;
+ case MONO_TYPE_I8: {
+ SET_FROM_PRIMITIVE(int64_t);
+ } break;
+
+ case MONO_TYPE_U1: {
+ SET_FROM_PRIMITIVE(unsigned char);
+ } break;
+ case MONO_TYPE_U2: {
+ SET_FROM_PRIMITIVE(unsigned short);
+ } break;
+ case MONO_TYPE_U4: {
+ SET_FROM_PRIMITIVE(unsigned int);
+ } break;
+ case MONO_TYPE_U8: {
+ SET_FROM_PRIMITIVE(uint64_t);
+ } break;
+
+ case MONO_TYPE_R4: {
+ SET_FROM_PRIMITIVE(float);
+ } break;
+
+ case MONO_TYPE_R8: {
+ SET_FROM_PRIMITIVE(double);
+ } break;
+
+ case MONO_TYPE_STRING: {
+ MonoString *mono_string = GDMonoMarshal::mono_string_from_godot(p_value);
+ mono_field_set_value(p_object, mono_field, mono_string);
+ } break;
+
+ case MONO_TYPE_VALUETYPE: {
+ GDMonoClass *tclass = type.type_class;
+
+ if (tclass == CACHED_CLASS(Vector2))
+ SET_FROM_STRUCT_AND_BREAK(Vector2);
+
+ if (tclass == CACHED_CLASS(Rect2))
+ SET_FROM_STRUCT_AND_BREAK(Rect2);
+
+ if (tclass == CACHED_CLASS(Transform2D))
+ SET_FROM_STRUCT_AND_BREAK(Transform2D);
+
+ if (tclass == CACHED_CLASS(Vector3))
+ SET_FROM_STRUCT_AND_BREAK(Vector3);
+
+ if (tclass == CACHED_CLASS(Basis))
+ SET_FROM_STRUCT_AND_BREAK(Basis);
+
+ if (tclass == CACHED_CLASS(Quat))
+ SET_FROM_STRUCT_AND_BREAK(Quat);
+
+ if (tclass == CACHED_CLASS(Transform))
+ SET_FROM_STRUCT_AND_BREAK(Transform);
+
+ if (tclass == CACHED_CLASS(Rect3))
+ SET_FROM_STRUCT_AND_BREAK(Rect3);
+
+ if (tclass == CACHED_CLASS(Color))
+ SET_FROM_STRUCT_AND_BREAK(Color);
+
+ if (tclass == CACHED_CLASS(Plane))
+ SET_FROM_STRUCT_AND_BREAK(Plane);
+
+ ERR_EXPLAIN(String() + "Attempted to set the value of a field of unmarshallable type: " + tclass->get_name());
+ ERR_FAIL();
+ } break;
+
+ case MONO_TYPE_ARRAY:
+ case MONO_TYPE_SZARRAY: {
+ MonoArrayType *array_type = mono_type_get_array_type(GDMonoClass::get_raw_type(type.type_class));
+
+ if (array_type->eklass == CACHED_CLASS_RAW(MonoObject))
+ SET_FROM_ARRAY_AND_BREAK(Array);
+
+ if (array_type->eklass == CACHED_CLASS_RAW(uint8_t))
+ SET_FROM_ARRAY_AND_BREAK(PoolByteArray);
+
+ if (array_type->eklass == CACHED_CLASS_RAW(int32_t))
+ SET_FROM_ARRAY_AND_BREAK(PoolIntArray);
+
+ if (array_type->eklass == REAL_T_MONOCLASS)
+ SET_FROM_ARRAY_AND_BREAK(PoolRealArray);
+
+ if (array_type->eklass == CACHED_CLASS_RAW(String))
+ SET_FROM_ARRAY_AND_BREAK(PoolStringArray);
+
+ if (array_type->eklass == CACHED_CLASS_RAW(Vector2))
+ SET_FROM_ARRAY_AND_BREAK(PoolVector2Array);
+
+ if (array_type->eklass == CACHED_CLASS_RAW(Vector3))
+ SET_FROM_ARRAY_AND_BREAK(PoolVector3Array);
+
+ if (array_type->eklass == CACHED_CLASS_RAW(Color))
+ SET_FROM_ARRAY_AND_BREAK(PoolColorArray);
+
+ ERR_EXPLAIN(String() + "Attempted to convert Variant to a managed array of unmarshallable element type.");
+ ERR_FAIL();
+ } break;
+
+ case MONO_TYPE_CLASS: {
+ GDMonoClass *type_class = type.type_class;
+
+ // GodotObject
+ if (CACHED_CLASS(GodotObject)->is_assignable_from(type_class)) {
+ MonoObject *managed = GDMonoUtils::unmanaged_get_managed(p_value.operator Object *());
+ mono_field_set_value(p_object, mono_field, &managed);
+ break;
+ }
+
+ if (CACHED_CLASS(NodePath) == type_class) {
+ MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator NodePath());
+ mono_field_set_value(p_object, mono_field, &managed);
+ break;
+ }
+
+ if (CACHED_CLASS(RID) == type_class) {
+ MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator RID());
+ mono_field_set_value(p_object, mono_field, &managed);
+ break;
+ }
+
+ ERR_EXPLAIN(String() + "Attempted to set the value of a field of unmarshallable type: " + type_class->get_name());
+ ERR_FAIL();
+ } break;
+
+ case MONO_TYPE_OBJECT: {
+ GDMonoClass *type_class = type.type_class;
+
+ // Variant
+ switch (p_value.get_type()) {
+ case Variant::BOOL: {
+ SET_FROM_PRIMITIVE(bool);
+ } break;
+ case Variant::INT: {
+ SET_FROM_PRIMITIVE(int);
+ } break;
+ case Variant::REAL: {
+#ifdef REAL_T_IS_DOUBLE
+ SET_FROM_PRIMITIVE(double);
+#else
+ SET_FROM_PRIMITIVE(float);
+#endif
+ } break;
+ case Variant::STRING: {
+ MonoString *mono_string = GDMonoMarshal::mono_string_from_godot(p_value);
+ mono_field_set_value(p_object, mono_field, mono_string);
+ } break;
+ case Variant::VECTOR2: SET_FROM_STRUCT_AND_BREAK(Vector2);
+ case Variant::RECT2: SET_FROM_STRUCT_AND_BREAK(Rect2);
+ case Variant::VECTOR3: SET_FROM_STRUCT_AND_BREAK(Vector3);
+ case Variant::TRANSFORM2D: SET_FROM_STRUCT_AND_BREAK(Transform2D);
+ case Variant::PLANE: SET_FROM_STRUCT_AND_BREAK(Plane);
+ case Variant::QUAT: SET_FROM_STRUCT_AND_BREAK(Quat);
+ case Variant::RECT3: SET_FROM_STRUCT_AND_BREAK(Rect3);
+ case Variant::BASIS: SET_FROM_STRUCT_AND_BREAK(Basis);
+ case Variant::TRANSFORM: SET_FROM_STRUCT_AND_BREAK(Transform);
+ case Variant::COLOR: SET_FROM_STRUCT_AND_BREAK(Color);
+ case Variant::NODE_PATH: {
+ MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator NodePath());
+ mono_field_set_value(p_object, mono_field, &managed);
+ } break;
+ case Variant::_RID: {
+ MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator RID());
+ mono_field_set_value(p_object, mono_field, &managed);
+ } break;
+ case Variant::OBJECT: {
+ MonoObject *managed = GDMonoUtils::unmanaged_get_managed(p_value.operator Object *());
+ mono_field_set_value(p_object, mono_field, managed);
+ break;
+ }
+ case Variant::DICTIONARY: {
+ MonoObject *managed = GDMonoMarshal::Dictionary_to_mono_object(p_value.operator Dictionary());
+ mono_field_set_value(p_object, mono_field, &managed);
+ } break;
+ case Variant::ARRAY: SET_FROM_ARRAY_AND_BREAK(Array);
+ case Variant::POOL_BYTE_ARRAY: SET_FROM_ARRAY_AND_BREAK(PoolByteArray);
+ case Variant::POOL_INT_ARRAY: SET_FROM_ARRAY_AND_BREAK(PoolIntArray);
+ case Variant::POOL_REAL_ARRAY: SET_FROM_ARRAY_AND_BREAK(PoolRealArray);
+ case Variant::POOL_STRING_ARRAY: SET_FROM_ARRAY_AND_BREAK(PoolStringArray);
+ case Variant::POOL_VECTOR2_ARRAY: SET_FROM_ARRAY_AND_BREAK(PoolVector2Array);
+ case Variant::POOL_VECTOR3_ARRAY: SET_FROM_ARRAY_AND_BREAK(PoolVector3Array);
+ case Variant::POOL_COLOR_ARRAY: SET_FROM_ARRAY_AND_BREAK(PoolColorArray);
+#undef SET_FROM_ARRAY_AND_BREAK
+ default: break;
+ }
+ } break;
+
+ case MONO_TYPE_GENERICINST: {
+ if (CACHED_RAW_MONO_CLASS(Dictionary) == type.type_class->get_raw()) {
+ MonoObject *managed = GDMonoMarshal::Dictionary_to_mono_object(p_value.operator Dictionary());
+ mono_field_set_value(p_object, mono_field, &managed);
+ break;
+ }
+ } break;
+
+ default: {
+ ERR_PRINTS(String() + "Attempted to set the value of a field of unexpected type encoding: " + itos(type.type_encoding));
+ } break;
+ }
+
+#undef SET_FROM_STRUCT_AND_BREAK
+#undef SET_FROM_PRIMITIVE
+}
+
+bool GDMonoField::get_bool_value(MonoObject *p_object) {
+ return (bool)GDMonoMarshal::unbox<MonoBoolean>(get_value(p_object));
+}
+
+int GDMonoField::get_int_value(MonoObject *p_object) {
+ return GDMonoMarshal::unbox<int32_t>(get_value(p_object));
+}
+
+String GDMonoField::get_string_value(MonoObject *p_object) {
+ MonoObject *val = get_value(p_object);
+ return val ? GDMonoMarshal::mono_string_to_godot((MonoString *)val) : String();
+}
+
+bool GDMonoField::has_attribute(GDMonoClass *p_attr_class) {
+ ERR_FAIL_NULL_V(p_attr_class, false);
+
+ if (!attrs_fetched)
+ fetch_attributes();
+
+ if (!attributes)
+ return false;
+
+ return mono_custom_attrs_has_attr(attributes, p_attr_class->get_raw());
+}
+
+MonoObject *GDMonoField::get_attribute(GDMonoClass *p_attr_class) {
+ ERR_FAIL_NULL_V(p_attr_class, NULL);
+
+ if (!attrs_fetched)
+ fetch_attributes();
+
+ if (!attributes)
+ return NULL;
+
+ return mono_custom_attrs_get_attr(attributes, p_attr_class->get_raw());
+}
+
+void GDMonoField::fetch_attributes() {
+ ERR_FAIL_COND(attributes != NULL);
+ attributes = mono_custom_attrs_from_field(owner->get_raw(), get_raw());
+ attrs_fetched = true;
+}
+
+bool GDMonoField::is_static() {
+ return mono_field_get_flags(mono_field) & MONO_FIELD_ATTR_STATIC;
+}
+
+GDMono::MemberVisibility GDMonoField::get_visibility() {
+ switch (mono_field_get_flags(mono_field) & MONO_FIELD_ATTR_FIELD_ACCESS_MASK) {
+ case MONO_FIELD_ATTR_PRIVATE:
+ return GDMono::PRIVATE;
+ case MONO_FIELD_ATTR_FAM_AND_ASSEM:
+ return GDMono::PROTECTED_AND_INTERNAL;
+ case MONO_FIELD_ATTR_ASSEMBLY:
+ return GDMono::INTERNAL;
+ case MONO_FIELD_ATTR_FAMILY:
+ return GDMono::PROTECTED;
+ case MONO_FIELD_ATTR_PUBLIC:
+ return GDMono::PUBLIC;
+ default:
+ ERR_FAIL_V(GDMono::PRIVATE);
+ }
+}
+
+GDMonoField::GDMonoField(MonoClassField *p_raw_field, GDMonoClass *p_owner) {
+ owner = p_owner;
+ mono_field = p_raw_field;
+ name = mono_field_get_name(mono_field);
+ MonoType *field_type = mono_field_get_type(mono_field);
+ type.type_encoding = mono_type_get_type(field_type);
+ MonoClass *field_type_class = mono_class_from_mono_type(field_type);
+ type.type_class = GDMono::get_singleton()->get_class(field_type_class);
+
+ attrs_fetched = false;
+ attributes = NULL;
+}
+
+GDMonoField::~GDMonoField() {
+ if (attributes) {
+ mono_custom_attrs_free(attributes);
+ }
+}
diff --git a/modules/mono/mono_gd/gd_mono_field.h b/modules/mono/mono_gd/gd_mono_field.h
new file mode 100644
index 0000000000..b7e1942d71
--- /dev/null
+++ b/modules/mono/mono_gd/gd_mono_field.h
@@ -0,0 +1,74 @@
+/*************************************************************************/
+/* gd_mono_field.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef GDMONOFIELD_H
+#define GDMONOFIELD_H
+
+#include "gd_mono.h"
+#include "gd_mono_header.h"
+
+class GDMonoField {
+ GDMonoClass *owner;
+ MonoClassField *mono_field;
+
+ String name;
+ ManagedType type;
+
+ bool attrs_fetched;
+ MonoCustomAttrInfo *attributes;
+
+public:
+ _FORCE_INLINE_ String get_name() const { return name; }
+ _FORCE_INLINE_ ManagedType get_type() const { return type; }
+
+ _FORCE_INLINE_ MonoClassField *get_raw() const { return mono_field; }
+
+ void set_value_raw(MonoObject *p_object, void *p_ptr);
+ void set_value(MonoObject *p_object, const Variant &p_value);
+
+ _FORCE_INLINE_ MonoObject *get_value(MonoObject *p_object) {
+ return mono_field_get_value_object(mono_domain_get(), mono_field, p_object);
+ }
+
+ bool get_bool_value(MonoObject *p_object);
+ int get_int_value(MonoObject *p_object);
+ String get_string_value(MonoObject *p_object);
+
+ bool has_attribute(GDMonoClass *p_attr_class);
+ MonoObject *get_attribute(GDMonoClass *p_attr_class);
+ void fetch_attributes();
+
+ bool is_static();
+ GDMono::MemberVisibility get_visibility();
+
+ GDMonoField(MonoClassField *p_raw_field, GDMonoClass *p_owner);
+ ~GDMonoField();
+};
+
+#endif // GDMONOFIELD_H
diff --git a/modules/mono/mono_gd/gd_mono_header.h b/modules/mono/mono_gd/gd_mono_header.h
new file mode 100644
index 0000000000..803d394f96
--- /dev/null
+++ b/modules/mono/mono_gd/gd_mono_header.h
@@ -0,0 +1,59 @@
+/*************************************************************************/
+/* gd_mono_header.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef GD_MONO_HEADER_H
+#define GD_MONO_HEADER_H
+
+#include "int_types.h"
+
+class GDMonoAssembly;
+class GDMonoClass;
+class GDMonoMethod;
+class GDMonoField;
+
+struct ManagedType {
+ int type_encoding;
+ GDMonoClass *type_class;
+
+ ManagedType() {
+ type_class = 0;
+ }
+};
+
+typedef union {
+ uint32_t _uint32;
+ float _float;
+} mono_float;
+
+typedef union {
+ uint64_t _uint64;
+ float _double;
+} mono_double;
+
+#endif // GD_MONO_HEADER_H
diff --git a/modules/mono/mono_gd/gd_mono_internals.cpp b/modules/mono/mono_gd/gd_mono_internals.cpp
new file mode 100644
index 0000000000..cfe2148b80
--- /dev/null
+++ b/modules/mono/mono_gd/gd_mono_internals.cpp
@@ -0,0 +1,66 @@
+/*************************************************************************/
+/* godotsharp_internals.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "gd_mono_internals.h"
+
+#include "../csharp_script.h"
+#include "../mono_gc_handle.h"
+#include "gd_mono_utils.h"
+
+namespace GDMonoInternals {
+
+void tie_managed_to_unmanaged(MonoObject *managed, Object *unmanaged) {
+
+ // This method should not fail
+
+ CRASH_COND(!unmanaged);
+
+ // All mono objects created from the managed world (e.g.: `new Player()`)
+ // need to have a CSharpScript in order for their methods to be callable from the unmanaged side
+
+ Reference *ref = Object::cast_to<Reference>(unmanaged);
+
+ GDMonoClass *klass = GDMonoUtils::get_object_class(managed);
+
+ CRASH_COND(!klass);
+
+ Ref<MonoGCHandle> gchandle = ref ? MonoGCHandle::create_weak(managed) :
+ MonoGCHandle::create_strong(managed);
+
+ Ref<CSharpScript> script = CSharpScript::create_for_managed_type(klass);
+
+ CRASH_COND(script.is_null());
+
+ ScriptInstance *si = CSharpInstance::create_for_managed_type(unmanaged, script.ptr(), gchandle);
+
+ unmanaged->set_script_and_instance(script.get_ref_ptr(), si);
+
+ return;
+}
+}
diff --git a/modules/mono/mono_gd/gd_mono_internals.h b/modules/mono/mono_gd/gd_mono_internals.h
new file mode 100644
index 0000000000..6bdf4a6c46
--- /dev/null
+++ b/modules/mono/mono_gd/gd_mono_internals.h
@@ -0,0 +1,42 @@
+/*************************************************************************/
+/* godotsharp_internals.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef GD_MONO_INTERNALS_H
+#define GD_MONO_INTERNALS_H
+
+#include <mono/jit/jit.h>
+
+#include "core/object.h"
+
+namespace GDMonoInternals {
+
+void tie_managed_to_unmanaged(MonoObject *managed, Object *unmanaged);
+}
+
+#endif // GD_MONO_INTERNALS_H
diff --git a/modules/mono/mono_gd/gd_mono_log.cpp b/modules/mono/mono_gd/gd_mono_log.cpp
new file mode 100644
index 0000000000..e473348897
--- /dev/null
+++ b/modules/mono/mono_gd/gd_mono_log.cpp
@@ -0,0 +1,175 @@
+/*************************************************************************/
+/* gd_mono_log.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "gd_mono_log.h"
+
+#include <mono/utils/mono-logger.h>
+#include <stdlib.h> // abort
+
+#include "os/dir_access.h"
+#include "os/os.h"
+
+#include "../godotsharp_dirs.h"
+
+static int log_level_get_id(const char *p_log_level) {
+
+ const char *valid_log_levels[] = { "error", "critical", "warning", "message", "info", "debug", NULL };
+
+ int i = 0;
+ while (valid_log_levels[i]) {
+ if (!strcmp(valid_log_levels[i], p_log_level))
+ return i;
+ i++;
+ }
+
+ return -1;
+}
+
+void gdmono_MonoLogCallback(const char *log_domain, const char *log_level, const char *message, mono_bool fatal, void *user_data) {
+
+ FileAccess *f = GDMonoLog::get_singleton()->get_log_file();
+
+ if (GDMonoLog::get_singleton()->get_log_level_id() >= log_level_get_id(log_level)) {
+ String text(message);
+ text += " (in domain ";
+ text += log_domain;
+ if (log_level) {
+ text += ", ";
+ text += log_level;
+ }
+ text += ")\n";
+
+ f->seek_end();
+ f->store_string(text);
+ }
+
+ if (fatal) {
+ ERR_PRINTS("Mono: FALTAL ERROR, ABORTING! Logfile: " + GDMonoLog::get_singleton()->get_log_file_path() + "\n");
+ abort();
+ }
+}
+
+GDMonoLog *GDMonoLog::singleton = NULL;
+
+bool GDMonoLog::_try_create_logs_dir(const String &p_logs_dir) {
+
+ if (!DirAccess::exists(p_logs_dir)) {
+ DirAccessRef diraccess = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+ ERR_FAIL_COND_V(!diraccess, false);
+ Error logs_mkdir_err = diraccess->make_dir_recursive(p_logs_dir);
+ ERR_EXPLAIN("Failed to create mono logs directory");
+ ERR_FAIL_COND_V(logs_mkdir_err != OK, false);
+ }
+
+ return true;
+}
+
+void GDMonoLog::_open_log_file(const String &p_file_path) {
+
+ log_file = FileAccess::open(p_file_path, FileAccess::WRITE);
+
+ ERR_EXPLAIN("Failed to create log file");
+ ERR_FAIL_COND(!log_file);
+}
+
+void GDMonoLog::_delete_old_log_files(const String &p_logs_dir) {
+
+ static const uint64_t MAX_SECS = 5 * 86400;
+
+ DirAccessRef da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+ ERR_FAIL_COND(!da);
+
+ Error err = da->change_dir(p_logs_dir);
+ ERR_FAIL_COND(err != OK);
+
+ ERR_FAIL_COND(da->list_dir_begin() != OK);
+
+ String current;
+ while ((current = da->get_next()).length()) {
+ if (da->current_is_dir())
+ continue;
+ if (!current.ends_with(".txt"))
+ continue;
+
+ String name = current.get_basename();
+ uint64_t unixtime = (uint64_t)name.to_int64();
+
+ if (OS::get_singleton()->get_unix_time() - unixtime > MAX_SECS) {
+ da->remove(current);
+ }
+ }
+
+ da->list_dir_end();
+}
+
+void GDMonoLog::initialize() {
+
+#ifdef DEBUG_ENABLED
+ const char *log_level = "debug";
+#else
+ const char *log_level = "warning";
+#endif
+
+ String logs_dir = GodotSharpDirs::get_mono_logs_dir();
+
+ if (_try_create_logs_dir(logs_dir)) {
+ _delete_old_log_files(logs_dir);
+
+ log_file_path = logs_dir.plus_file(String::num_int64(OS::get_singleton()->get_unix_time()) + ".txt");
+ _open_log_file(log_file_path);
+ }
+
+ mono_trace_set_level_string(log_level);
+ log_level_id = log_level_get_id(log_level);
+
+ if (log_file) {
+ if (OS::get_singleton()->is_stdout_verbose())
+ OS::get_singleton()->print(String("Mono: Logfile is " + log_file_path + "\n").utf8());
+ mono_trace_set_log_handler(gdmono_MonoLogCallback, this);
+ } else {
+ OS::get_singleton()->printerr("Mono: No log file, using default log handler\n");
+ }
+}
+
+GDMonoLog::GDMonoLog() {
+
+ singleton = this;
+
+ log_level_id = -1;
+}
+
+GDMonoLog::~GDMonoLog() {
+
+ singleton = NULL;
+
+ if (log_file) {
+ log_file->close();
+ memdelete(log_file);
+ }
+}
diff --git a/platform/iphone/audio_driver_iphone.h b/modules/mono/mono_gd/gd_mono_log.h
index 930ed168f7..497f1e5317 100644
--- a/platform/iphone/audio_driver_iphone.h
+++ b/modules/mono/mono_gd/gd_mono_log.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* audio_driver_iphone.h */
+/* gd_mono_log.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -27,40 +27,35 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef GD_MONO_LOG_H
+#define GD_MONO_LOG_H
-#include "servers/audio_server.h"
+#include "os/file_access.h"
-#include <AudioUnit/AudioUnit.h>
+class GDMonoLog {
-class AudioDriverIphone : public AudioDriver {
+ int log_level_id;
- AudioComponentInstance audio_unit;
- bool active;
- Mutex *mutex;
+ FileAccess *log_file;
+ String log_file_path;
- int channels;
- int32_t *samples_in;
- int buffer_frames;
+ bool _try_create_logs_dir(const String &p_logs_dir);
+ void _open_log_file(const String &p_file_path);
+ void _delete_old_log_files(const String &p_logs_dir);
- static OSStatus output_callback(void *inRefCon,
- AudioUnitRenderActionFlags *ioActionFlags,
- const AudioTimeStamp *inTimeStamp,
- UInt32 inBusNumber, UInt32 inNumberFrames,
- AudioBufferList *ioData);
+ static GDMonoLog *singleton;
public:
- const char *get_name() const {
- return "IPhone";
- };
+ _FORCE_INLINE_ static GDMonoLog *get_singleton() { return singleton; }
- virtual Error init();
- virtual void start();
- virtual int get_mix_rate() const;
- virtual SpeakerMode get_speaker_mode() const;
- virtual void lock();
- virtual void unlock();
- virtual void finish();
+ void initialize();
- AudioDriverIphone();
- ~AudioDriverIphone();
+ _FORCE_INLINE_ FileAccess *get_log_file() { return log_file; }
+ _FORCE_INLINE_ String get_log_file_path() { return log_file_path; }
+ _FORCE_INLINE_ int get_log_level_id() { return log_level_id; }
+
+ GDMonoLog();
+ ~GDMonoLog();
};
+
+#endif // GD_MONO_LOG_H
diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp
new file mode 100644
index 0000000000..9a6c8f0cd6
--- /dev/null
+++ b/modules/mono/mono_gd/gd_mono_marshal.cpp
@@ -0,0 +1,845 @@
+/*************************************************************************/
+/* gd_mono_marshal.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "gd_mono_marshal.h"
+
+#include "gd_mono.h"
+#include "gd_mono_class.h"
+
+namespace GDMonoMarshal {
+
+#define RETURN_BOXED_STRUCT(m_t, m_var_in) \
+ { \
+ const m_t &m_in = m_var_in->operator m_t(); \
+ MARSHALLED_OUT(m_t, m_in, raw); \
+ return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(m_t), raw); \
+ }
+
+#define RETURN_UNBOXED_STRUCT(m_t, m_var_in) \
+ { \
+ float *raw = (float *)mono_object_unbox(m_var_in); \
+ MARSHALLED_IN(m_t, raw, ret); \
+ return ret; \
+ }
+
+Variant::Type managed_to_variant_type(const ManagedType &p_type) {
+ switch (p_type.type_encoding) {
+ case MONO_TYPE_BOOLEAN:
+ return Variant::BOOL;
+
+ case MONO_TYPE_I1:
+ return Variant::INT;
+ case MONO_TYPE_I2:
+ return Variant::INT;
+ case MONO_TYPE_I4:
+ return Variant::INT;
+ case MONO_TYPE_I8:
+ return Variant::INT;
+
+ case MONO_TYPE_U1:
+ return Variant::INT;
+ case MONO_TYPE_U2:
+ return Variant::INT;
+ case MONO_TYPE_U4:
+ return Variant::INT;
+ case MONO_TYPE_U8:
+ return Variant::INT;
+
+ case MONO_TYPE_R4:
+ return Variant::REAL;
+ case MONO_TYPE_R8:
+ return Variant::REAL;
+
+ case MONO_TYPE_STRING: {
+ return Variant::STRING;
+ } break;
+
+ case MONO_TYPE_VALUETYPE: {
+ GDMonoClass *tclass = p_type.type_class;
+
+ if (tclass == CACHED_CLASS(Vector2))
+ return Variant::VECTOR2;
+
+ if (tclass == CACHED_CLASS(Rect2))
+ return Variant::RECT2;
+
+ if (tclass == CACHED_CLASS(Transform2D))
+ return Variant::TRANSFORM2D;
+
+ if (tclass == CACHED_CLASS(Vector3))
+ return Variant::VECTOR3;
+
+ if (tclass == CACHED_CLASS(Basis))
+ return Variant::BASIS;
+
+ if (tclass == CACHED_CLASS(Quat))
+ return Variant::QUAT;
+
+ if (tclass == CACHED_CLASS(Transform))
+ return Variant::TRANSFORM;
+
+ if (tclass == CACHED_CLASS(Rect3))
+ return Variant::RECT3;
+
+ if (tclass == CACHED_CLASS(Color))
+ return Variant::COLOR;
+
+ if (tclass == CACHED_CLASS(Plane))
+ return Variant::PLANE;
+ } break;
+
+ case MONO_TYPE_ARRAY:
+ case MONO_TYPE_SZARRAY: {
+ MonoArrayType *array_type = mono_type_get_array_type(GDMonoClass::get_raw_type(p_type.type_class));
+
+ if (array_type->eklass == CACHED_CLASS_RAW(MonoObject))
+ return Variant::ARRAY;
+
+ if (array_type->eklass == CACHED_CLASS_RAW(uint8_t))
+ return Variant::POOL_BYTE_ARRAY;
+
+ if (array_type->eklass == CACHED_CLASS_RAW(int32_t))
+ return Variant::POOL_INT_ARRAY;
+
+ if (array_type->eklass == REAL_T_MONOCLASS)
+ return Variant::POOL_REAL_ARRAY;
+
+ if (array_type->eklass == CACHED_CLASS_RAW(String))
+ return Variant::POOL_STRING_ARRAY;
+
+ if (array_type->eklass == CACHED_CLASS_RAW(Vector2))
+ return Variant::POOL_VECTOR2_ARRAY;
+
+ if (array_type->eklass == CACHED_CLASS_RAW(Vector3))
+ return Variant::POOL_VECTOR3_ARRAY;
+
+ if (array_type->eklass == CACHED_CLASS_RAW(Color))
+ return Variant::POOL_COLOR_ARRAY;
+ } break;
+
+ case MONO_TYPE_CLASS: {
+ GDMonoClass *type_class = p_type.type_class;
+
+ // GodotObject
+ if (CACHED_CLASS(GodotObject)->is_assignable_from(type_class)) {
+ return Variant::OBJECT;
+ }
+
+ if (CACHED_CLASS(NodePath) == type_class) {
+ return Variant::NODE_PATH;
+ }
+
+ if (CACHED_CLASS(RID) == type_class) {
+ return Variant::_RID;
+ }
+ } break;
+
+ case MONO_TYPE_GENERICINST: {
+ if (CACHED_RAW_MONO_CLASS(Dictionary) == p_type.type_class->get_raw()) {
+ return Variant::DICTIONARY;
+ }
+ } break;
+ }
+
+ // No error, the caller will decide what to do in this case
+ return Variant::NIL;
+}
+
+String mono_to_utf8_string(MonoString *p_mono_string) {
+ MonoError error;
+ char *utf8 = mono_string_to_utf8_checked(p_mono_string, &error);
+
+ ERR_EXPLAIN("Conversion of MonoString to UTF8 failed.");
+ ERR_FAIL_COND_V(!mono_error_ok(&error), String());
+
+ String ret = String::utf8(utf8);
+
+ mono_free(utf8);
+
+ return ret;
+}
+
+String mono_to_utf16_string(MonoString *p_mono_string) {
+ int len = mono_string_length(p_mono_string);
+ String ret;
+
+ if (len == 0)
+ return ret;
+
+ ret.resize(len + 1);
+ ret.set(len, 0);
+
+ CharType *src = (CharType *)mono_string_chars(p_mono_string);
+ CharType *dst = &(ret.operator[](0));
+
+ for (int i = 0; i < len; i++) {
+ dst[i] = src[i];
+ }
+
+ return ret;
+}
+
+MonoObject *variant_to_mono_object(const Variant *p_var) {
+ ManagedType type;
+
+ type.type_encoding = MONO_TYPE_OBJECT;
+
+ return variant_to_mono_object(p_var, type);
+}
+
+MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_type) {
+ switch (p_type.type_encoding) {
+ case MONO_TYPE_BOOLEAN: {
+ MonoBoolean val = p_var->operator bool();
+ return BOX_BOOLEAN(val);
+ }
+
+ case MONO_TYPE_I1: {
+ char val = p_var->operator signed char();
+ return BOX_INT8(val);
+ }
+ case MONO_TYPE_I2: {
+ short val = p_var->operator signed short();
+ return BOX_INT16(val);
+ }
+ case MONO_TYPE_I4: {
+ int val = p_var->operator signed int();
+ return BOX_INT32(val);
+ }
+ case MONO_TYPE_I8: {
+ int64_t val = p_var->operator int64_t();
+ return BOX_INT64(val);
+ }
+
+ case MONO_TYPE_U1: {
+ char val = p_var->operator unsigned char();
+ return BOX_UINT8(val);
+ }
+ case MONO_TYPE_U2: {
+ short val = p_var->operator unsigned short();
+ return BOX_UINT16(val);
+ }
+ case MONO_TYPE_U4: {
+ int val = p_var->operator unsigned int();
+ return BOX_UINT32(val);
+ }
+ case MONO_TYPE_U8: {
+ uint64_t val = p_var->operator uint64_t();
+ return BOX_UINT64(val);
+ }
+
+ case MONO_TYPE_R4: {
+ float val = p_var->operator float();
+ return BOX_FLOAT(val);
+ }
+ case MONO_TYPE_R8: {
+ double val = p_var->operator double();
+ return BOX_DOUBLE(val);
+ }
+
+ case MONO_TYPE_STRING: {
+ return (MonoObject *)mono_string_from_godot(p_var->operator String());
+ } break;
+
+ case MONO_TYPE_VALUETYPE: {
+ GDMonoClass *tclass = p_type.type_class;
+
+ if (tclass == CACHED_CLASS(Vector2))
+ RETURN_BOXED_STRUCT(Vector2, p_var);
+
+ if (tclass == CACHED_CLASS(Rect2))
+ RETURN_BOXED_STRUCT(Rect2, p_var);
+
+ if (tclass == CACHED_CLASS(Transform2D))
+ RETURN_BOXED_STRUCT(Transform2D, p_var);
+
+ if (tclass == CACHED_CLASS(Vector3))
+ RETURN_BOXED_STRUCT(Vector3, p_var);
+
+ if (tclass == CACHED_CLASS(Basis))
+ RETURN_BOXED_STRUCT(Basis, p_var);
+
+ if (tclass == CACHED_CLASS(Quat))
+ RETURN_BOXED_STRUCT(Quat, p_var);
+
+ if (tclass == CACHED_CLASS(Transform))
+ RETURN_BOXED_STRUCT(Transform, p_var);
+
+ if (tclass == CACHED_CLASS(Rect3))
+ RETURN_BOXED_STRUCT(Rect3, p_var);
+
+ if (tclass == CACHED_CLASS(Color))
+ RETURN_BOXED_STRUCT(Color, p_var);
+
+ if (tclass == CACHED_CLASS(Plane))
+ RETURN_BOXED_STRUCT(Plane, p_var);
+ } break;
+
+ case MONO_TYPE_ARRAY:
+ case MONO_TYPE_SZARRAY: {
+ MonoArrayType *array_type = mono_type_get_array_type(GDMonoClass::get_raw_type(p_type.type_class));
+
+ if (array_type->eklass == CACHED_CLASS_RAW(MonoObject))
+ return (MonoObject *)Array_to_mono_array(p_var->operator Array());
+
+ if (array_type->eklass == CACHED_CLASS_RAW(uint8_t))
+ return (MonoObject *)PoolByteArray_to_mono_array(p_var->operator PoolByteArray());
+
+ if (array_type->eklass == CACHED_CLASS_RAW(int32_t))
+ return (MonoObject *)PoolIntArray_to_mono_array(p_var->operator PoolIntArray());
+
+ if (array_type->eklass == REAL_T_MONOCLASS)
+ return (MonoObject *)PoolRealArray_to_mono_array(p_var->operator PoolRealArray());
+
+ if (array_type->eklass == CACHED_CLASS_RAW(String))
+ return (MonoObject *)PoolStringArray_to_mono_array(p_var->operator PoolStringArray());
+
+ if (array_type->eklass == CACHED_CLASS_RAW(Vector2))
+ return (MonoObject *)PoolVector2Array_to_mono_array(p_var->operator PoolVector2Array());
+
+ if (array_type->eklass == CACHED_CLASS_RAW(Vector3))
+ return (MonoObject *)PoolVector3Array_to_mono_array(p_var->operator PoolVector3Array());
+
+ if (array_type->eklass == CACHED_CLASS_RAW(Color))
+ return (MonoObject *)PoolColorArray_to_mono_array(p_var->operator PoolColorArray());
+
+ ERR_EXPLAIN(String() + "Attempted to convert Variant to a managed array of unmarshallable element type.");
+ ERR_FAIL_V(NULL);
+ } break;
+
+ case MONO_TYPE_CLASS: {
+ GDMonoClass *type_class = p_type.type_class;
+
+ // GodotObject
+ if (CACHED_CLASS(GodotObject)->is_assignable_from(type_class)) {
+ return GDMonoUtils::unmanaged_get_managed(p_var->operator Object *());
+ }
+
+ if (CACHED_CLASS(NodePath) == type_class) {
+ return GDMonoUtils::create_managed_from(p_var->operator NodePath());
+ }
+
+ if (CACHED_CLASS(RID) == type_class) {
+ return GDMonoUtils::create_managed_from(p_var->operator RID());
+ }
+ } break;
+ case MONO_TYPE_OBJECT: {
+ // Variant
+ switch (p_var->get_type()) {
+ case Variant::BOOL: {
+ MonoBoolean val = p_var->operator bool();
+ return BOX_BOOLEAN(val);
+ }
+ case Variant::INT: {
+ int val = p_var->operator signed int();
+ return BOX_INT32(val);
+ }
+ case Variant::REAL: {
+#ifdef REAL_T_IS_DOUBLE
+ double val = p_var->operator double();
+ return BOX_DOUBLE(val);
+#else
+ float val = p_var->operator float();
+ return BOX_FLOAT(val);
+#endif
+ }
+ case Variant::STRING:
+ return (MonoObject *)mono_string_from_godot(p_var->operator String());
+ case Variant::VECTOR2:
+ RETURN_BOXED_STRUCT(Vector2, p_var);
+ case Variant::RECT2:
+ RETURN_BOXED_STRUCT(Rect2, p_var);
+ case Variant::VECTOR3:
+ RETURN_BOXED_STRUCT(Vector3, p_var);
+ case Variant::TRANSFORM2D:
+ RETURN_BOXED_STRUCT(Transform2D, p_var);
+ case Variant::PLANE:
+ RETURN_BOXED_STRUCT(Plane, p_var);
+ case Variant::QUAT:
+ RETURN_BOXED_STRUCT(Quat, p_var);
+ case Variant::RECT3:
+ RETURN_BOXED_STRUCT(Rect3, p_var);
+ case Variant::BASIS:
+ RETURN_BOXED_STRUCT(Basis, p_var);
+ case Variant::TRANSFORM:
+ RETURN_BOXED_STRUCT(Transform, p_var);
+ case Variant::COLOR:
+ RETURN_BOXED_STRUCT(Color, p_var);
+ case Variant::NODE_PATH:
+ return GDMonoUtils::create_managed_from(p_var->operator NodePath());
+ case Variant::_RID:
+ return GDMonoUtils::create_managed_from(p_var->operator RID());
+ case Variant::OBJECT: {
+ return GDMonoUtils::unmanaged_get_managed(p_var->operator Object *());
+ }
+ case Variant::DICTIONARY:
+ return Dictionary_to_mono_object(p_var->operator Dictionary());
+ case Variant::ARRAY:
+ return (MonoObject *)Array_to_mono_array(p_var->operator Array());
+ case Variant::POOL_BYTE_ARRAY:
+ return (MonoObject *)PoolByteArray_to_mono_array(p_var->operator PoolByteArray());
+ case Variant::POOL_INT_ARRAY:
+ return (MonoObject *)PoolIntArray_to_mono_array(p_var->operator PoolIntArray());
+ case Variant::POOL_REAL_ARRAY:
+ return (MonoObject *)PoolRealArray_to_mono_array(p_var->operator PoolRealArray());
+ case Variant::POOL_STRING_ARRAY:
+ return (MonoObject *)PoolStringArray_to_mono_array(p_var->operator PoolStringArray());
+ case Variant::POOL_VECTOR2_ARRAY:
+ return (MonoObject *)PoolVector2Array_to_mono_array(p_var->operator PoolVector2Array());
+ case Variant::POOL_VECTOR3_ARRAY:
+ return (MonoObject *)PoolVector3Array_to_mono_array(p_var->operator PoolVector3Array());
+ case Variant::POOL_COLOR_ARRAY:
+ return (MonoObject *)PoolColorArray_to_mono_array(p_var->operator PoolColorArray());
+ default:
+ return NULL;
+ }
+ break;
+ case MONO_TYPE_GENERICINST: {
+ if (CACHED_RAW_MONO_CLASS(Dictionary) == p_type.type_class->get_raw()) {
+ return Dictionary_to_mono_object(p_var->operator Dictionary());
+ }
+ } break;
+ } break;
+ }
+
+ ERR_EXPLAIN(String() + "Attempted to convert Variant to an unmarshallable managed type. Name: \'" +
+ p_type.type_class->get_name() + "\' Encoding: " + itos(p_type.type_encoding));
+ ERR_FAIL_V(NULL);
+}
+
+Variant mono_object_to_variant(MonoObject *p_obj) {
+ if (!p_obj)
+ return Variant();
+
+ GDMonoClass *tclass = GDMono::get_singleton()->get_class(mono_object_get_class(p_obj));
+ ERR_FAIL_COND_V(!tclass, Variant());
+
+ MonoType *raw_type = tclass->get_raw_type(tclass);
+
+ ManagedType type;
+
+ type.type_encoding = mono_type_get_type(raw_type);
+ type.type_class = tclass;
+
+ return mono_object_to_variant(p_obj, type);
+}
+
+Variant mono_object_to_variant(MonoObject *p_obj, const ManagedType &p_type) {
+ switch (p_type.type_encoding) {
+ case MONO_TYPE_BOOLEAN:
+ return (bool)unbox<MonoBoolean>(p_obj);
+
+ case MONO_TYPE_I1:
+ return unbox<int8_t>(p_obj);
+ case MONO_TYPE_I2:
+ return unbox<int16_t>(p_obj);
+ case MONO_TYPE_I4:
+ return unbox<int32_t>(p_obj);
+ case MONO_TYPE_I8:
+ return unbox<int64_t>(p_obj);
+
+ case MONO_TYPE_U1:
+ return unbox<uint8_t>(p_obj);
+ case MONO_TYPE_U2:
+ return unbox<uint16_t>(p_obj);
+ case MONO_TYPE_U4:
+ return unbox<uint32_t>(p_obj);
+ case MONO_TYPE_U8:
+ return unbox<uint64_t>(p_obj);
+
+ case MONO_TYPE_R4:
+ return unbox<float>(p_obj);
+ case MONO_TYPE_R8:
+ return unbox<double>(p_obj);
+
+ case MONO_TYPE_STRING: {
+ String str = mono_string_to_godot((MonoString *)p_obj);
+ return str;
+ } break;
+
+ case MONO_TYPE_VALUETYPE: {
+ GDMonoClass *tclass = p_type.type_class;
+
+ if (tclass == CACHED_CLASS(Vector2))
+ RETURN_UNBOXED_STRUCT(Vector2, p_obj);
+
+ if (tclass == CACHED_CLASS(Rect2))
+ RETURN_UNBOXED_STRUCT(Rect2, p_obj);
+
+ if (tclass == CACHED_CLASS(Transform2D))
+ RETURN_UNBOXED_STRUCT(Transform2D, p_obj);
+
+ if (tclass == CACHED_CLASS(Vector3))
+ RETURN_UNBOXED_STRUCT(Vector3, p_obj);
+
+ if (tclass == CACHED_CLASS(Basis))
+ RETURN_UNBOXED_STRUCT(Basis, p_obj);
+
+ if (tclass == CACHED_CLASS(Quat))
+ RETURN_UNBOXED_STRUCT(Quat, p_obj);
+
+ if (tclass == CACHED_CLASS(Transform))
+ RETURN_UNBOXED_STRUCT(Transform, p_obj);
+
+ if (tclass == CACHED_CLASS(Rect3))
+ RETURN_UNBOXED_STRUCT(Rect3, p_obj);
+
+ if (tclass == CACHED_CLASS(Color))
+ RETURN_UNBOXED_STRUCT(Color, p_obj);
+
+ if (tclass == CACHED_CLASS(Plane))
+ RETURN_UNBOXED_STRUCT(Plane, p_obj);
+ } break;
+
+ case MONO_TYPE_ARRAY:
+ case MONO_TYPE_SZARRAY: {
+ MonoArrayType *array_type = mono_type_get_array_type(GDMonoClass::get_raw_type(p_type.type_class));
+
+ if (array_type->eklass == CACHED_CLASS_RAW(MonoObject))
+ return mono_array_to_Array((MonoArray *)p_obj);
+
+ if (array_type->eklass == CACHED_CLASS_RAW(uint8_t))
+ return mono_array_to_PoolByteArray((MonoArray *)p_obj);
+
+ if (array_type->eklass == CACHED_CLASS_RAW(int32_t))
+ return mono_array_to_PoolIntArray((MonoArray *)p_obj);
+
+ if (array_type->eklass == REAL_T_MONOCLASS)
+ return mono_array_to_PoolRealArray((MonoArray *)p_obj);
+
+ if (array_type->eklass == CACHED_CLASS_RAW(String))
+ return mono_array_to_PoolStringArray((MonoArray *)p_obj);
+
+ if (array_type->eklass == CACHED_CLASS_RAW(Vector2))
+ return mono_array_to_PoolVector2Array((MonoArray *)p_obj);
+
+ if (array_type->eklass == CACHED_CLASS_RAW(Vector3))
+ return mono_array_to_PoolVector3Array((MonoArray *)p_obj);
+
+ if (array_type->eklass == CACHED_CLASS_RAW(Color))
+ return mono_array_to_PoolColorArray((MonoArray *)p_obj);
+
+ ERR_EXPLAIN(String() + "Attempted to convert a managed array of unmarshallable element type to Variant.");
+ ERR_FAIL_V(Variant());
+ } break;
+
+ case MONO_TYPE_CLASS: {
+ GDMonoClass *type_class = p_type.type_class;
+
+ // GodotObject
+ if (CACHED_CLASS(GodotObject)->is_assignable_from(type_class)) {
+ Object *ptr = unbox<Object *>(CACHED_FIELD(GodotObject, ptr)->get_value(p_obj));
+ return ptr ? Variant(ptr) : Variant();
+ }
+
+ if (CACHED_CLASS(NodePath) == type_class) {
+ NodePath *ptr = unbox<NodePath *>(CACHED_FIELD(NodePath, ptr)->get_value(p_obj));
+ return ptr ? Variant(*ptr) : Variant();
+ }
+
+ if (CACHED_CLASS(RID) == type_class) {
+ RID *ptr = unbox<RID *>(CACHED_FIELD(RID, ptr)->get_value(p_obj));
+ return ptr ? Variant(*ptr) : Variant();
+ }
+ } break;
+
+ case MONO_TYPE_GENERICINST: {
+ if (CACHED_RAW_MONO_CLASS(Dictionary) == p_type.type_class->get_raw()) {
+ return mono_object_to_Dictionary(p_obj);
+ }
+ } break;
+ }
+
+ ERR_EXPLAIN(String() + "Attempted to convert an unmarshallable managed type to Variant. Name: \'" +
+ p_type.type_class->get_name() + "\' Encoding: " + itos(p_type.type_encoding));
+ ERR_FAIL_V(Variant());
+}
+
+MonoArray *Array_to_mono_array(const Array &p_array) {
+ MonoArray *ret = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(MonoObject), p_array.size());
+
+ for (int i = 0; i < p_array.size(); i++) {
+ MonoObject *boxed = variant_to_mono_object(p_array[i]);
+ mono_array_set(ret, MonoObject *, i, boxed);
+ }
+
+ return ret;
+}
+
+Array mono_array_to_Array(MonoArray *p_array) {
+ Array ret;
+ int length = mono_array_length(p_array);
+
+ for (int i = 0; i < length; i++) {
+ MonoObject *elem = mono_array_get(p_array, MonoObject *, i);
+ ret.push_back(mono_object_to_variant(elem));
+ }
+
+ return ret;
+}
+
+// TODO Optimize reading/writing from/to PoolArrays
+
+MonoArray *PoolIntArray_to_mono_array(const PoolIntArray &p_array) {
+ MonoArray *ret = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(int32_t), p_array.size());
+
+ for (int i = 0; i < p_array.size(); i++) {
+ mono_array_set(ret, int32_t, i, p_array[i]);
+ }
+
+ return ret;
+}
+
+PoolIntArray mono_array_to_PoolIntArray(MonoArray *p_array) {
+ PoolIntArray ret;
+ int length = mono_array_length(p_array);
+
+ for (int i = 0; i < length; i++) {
+ int32_t elem = mono_array_get(p_array, int32_t, i);
+ ret.push_back(elem);
+ }
+
+ return ret;
+}
+
+MonoArray *PoolByteArray_to_mono_array(const PoolByteArray &p_array) {
+ MonoArray *ret = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(uint8_t), p_array.size());
+
+ for (int i = 0; i < p_array.size(); i++) {
+ mono_array_set(ret, uint8_t, i, p_array[i]);
+ }
+
+ return ret;
+}
+
+PoolByteArray mono_array_to_PoolByteArray(MonoArray *p_array) {
+ PoolByteArray ret;
+ int length = mono_array_length(p_array);
+
+ for (int i = 0; i < length; i++) {
+ uint8_t elem = mono_array_get(p_array, uint8_t, i);
+ ret.push_back(elem);
+ }
+
+ return ret;
+}
+
+MonoArray *PoolRealArray_to_mono_array(const PoolRealArray &p_array) {
+ MonoArray *ret = mono_array_new(mono_domain_get(), REAL_T_MONOCLASS, p_array.size());
+
+ for (int i = 0; i < p_array.size(); i++) {
+ mono_array_set(ret, real_t, i, p_array[i]);
+ }
+
+ return ret;
+}
+
+PoolRealArray mono_array_to_PoolRealArray(MonoArray *p_array) {
+ PoolRealArray ret;
+ int length = mono_array_length(p_array);
+
+ for (int i = 0; i < length; i++) {
+ real_t elem = mono_array_get(p_array, real_t, i);
+ ret.push_back(elem);
+ }
+
+ return ret;
+}
+
+MonoArray *PoolStringArray_to_mono_array(const PoolStringArray &p_array) {
+ MonoArray *ret = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(String), p_array.size());
+
+ for (int i = 0; i < p_array.size(); i++) {
+ MonoString *boxed = mono_string_from_godot(p_array[i]);
+ mono_array_set(ret, MonoString *, i, boxed);
+ }
+
+ return ret;
+}
+
+PoolStringArray mono_array_to_PoolStringArray(MonoArray *p_array) {
+ PoolStringArray ret;
+ int length = mono_array_length(p_array);
+
+ for (int i = 0; i < length; i++) {
+ MonoString *elem = mono_array_get(p_array, MonoString *, i);
+ ret.push_back(mono_string_to_godot(elem));
+ }
+
+ return ret;
+}
+
+MonoArray *PoolColorArray_to_mono_array(const PoolColorArray &p_array) {
+ MonoArray *ret = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(Color), p_array.size());
+
+ for (int i = 0; i < p_array.size(); i++) {
+#ifdef YOLOCOPY
+ mono_array_set(ret, Color, i, p_array[i]);
+#else
+ real_t *raw = (real_t *)mono_array_addr_with_size(ret, sizeof(real_t) * 4, i);
+ const Color &elem = p_array[i];
+ raw[0] = elem.r;
+ raw[1] = elem.g;
+ raw[2] = elem.b;
+ raw[3] = elem.a;
+#endif
+ }
+
+ return ret;
+}
+
+PoolColorArray mono_array_to_PoolColorArray(MonoArray *p_array) {
+ PoolColorArray ret;
+ int length = mono_array_length(p_array);
+
+ for (int i = 0; i < length; i++) {
+ real_t *raw_elem = (real_t *)mono_array_addr_with_size(p_array, sizeof(real_t) * 4, i);
+ MARSHALLED_IN(Color, raw_elem, elem);
+ ret.push_back(elem);
+ }
+
+ return ret;
+}
+
+MonoArray *PoolVector2Array_to_mono_array(const PoolVector2Array &p_array) {
+ MonoArray *ret = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(Vector2), p_array.size());
+
+ for (int i = 0; i < p_array.size(); i++) {
+#ifdef YOLOCOPY
+ mono_array_set(ret, Vector2, i, p_array[i]);
+#else
+ real_t *raw = (real_t *)mono_array_addr_with_size(ret, sizeof(real_t) * 2, i);
+ const Vector2 &elem = p_array[i];
+ raw[0] = elem.x;
+ raw[1] = elem.y;
+#endif
+ }
+
+ return ret;
+}
+
+PoolVector2Array mono_array_to_PoolVector2Array(MonoArray *p_array) {
+ PoolVector2Array ret;
+ int length = mono_array_length(p_array);
+
+ for (int i = 0; i < length; i++) {
+ real_t *raw_elem = (real_t *)mono_array_addr_with_size(p_array, sizeof(real_t) * 2, i);
+ MARSHALLED_IN(Vector2, raw_elem, elem);
+ ret.push_back(elem);
+ }
+
+ return ret;
+}
+
+MonoArray *PoolVector3Array_to_mono_array(const PoolVector3Array &p_array) {
+ MonoArray *ret = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(Vector3), p_array.size());
+
+ for (int i = 0; i < p_array.size(); i++) {
+#ifdef YOLOCOPY
+ mono_array_set(ret, Vector3, i, p_array[i]);
+#else
+ real_t *raw = (real_t *)mono_array_addr_with_size(ret, sizeof(real_t) * 3, i);
+ const Vector3 &elem = p_array[i];
+ raw[0] = elem.x;
+ raw[1] = elem.y;
+ raw[2] = elem.z;
+#endif
+ }
+
+ return ret;
+}
+
+PoolVector3Array mono_array_to_PoolVector3Array(MonoArray *p_array) {
+ PoolVector3Array ret;
+ int length = mono_array_length(p_array);
+
+ for (int i = 0; i < length; i++) {
+ real_t *raw_elem = (real_t *)mono_array_addr_with_size(p_array, sizeof(real_t) * 3, i);
+ MARSHALLED_IN(Vector3, raw_elem, elem);
+ ret.push_back(elem);
+ }
+
+ return ret;
+}
+
+MonoObject *Dictionary_to_mono_object(const Dictionary &p_dict) {
+ MonoArray *keys = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(MonoObject), p_dict.size());
+ MonoArray *values = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(MonoObject), p_dict.size());
+
+ int i = 0;
+ const Variant *dkey = NULL;
+ while ((dkey = p_dict.next(dkey))) {
+ mono_array_set(keys, MonoObject *, i, variant_to_mono_object(dkey));
+ mono_array_set(values, MonoObject *, i, variant_to_mono_object(p_dict[*dkey]));
+ i++;
+ }
+
+ GDMonoUtils::MarshalUtils_ArraysToDict arrays_to_dict = CACHED_METHOD_THUNK(MarshalUtils, ArraysToDictionary);
+
+ MonoObject *ex = NULL;
+ MonoObject *ret = arrays_to_dict(keys, values, &ex);
+
+ if (ex) {
+ mono_print_unhandled_exception(ex);
+ ERR_FAIL_V(NULL);
+ }
+
+ return ret;
+}
+
+Dictionary mono_object_to_Dictionary(MonoObject *p_dict) {
+ Dictionary ret;
+
+ GDMonoUtils::MarshalUtils_DictToArrays dict_to_arrays = CACHED_METHOD_THUNK(MarshalUtils, DictionaryToArrays);
+
+ MonoArray *keys = NULL;
+ MonoArray *values = NULL;
+ MonoObject *ex = NULL;
+ dict_to_arrays(p_dict, &keys, &values, &ex);
+
+ if (ex) {
+ mono_print_unhandled_exception(ex);
+ ERR_FAIL_V(Dictionary());
+ }
+
+ int length = mono_array_length(keys);
+
+ for (int i = 0; i < length; i++) {
+ MonoObject *key_obj = mono_array_get(keys, MonoObject *, i);
+ MonoObject *value_obj = mono_array_get(values, MonoObject *, i);
+
+ Variant key = key_obj ? mono_object_to_variant(key_obj) : Variant();
+ Variant value = value_obj ? mono_object_to_variant(value_obj) : Variant();
+
+ ret[key] = value;
+ }
+
+ return ret;
+}
+}
diff --git a/modules/mono/mono_gd/gd_mono_marshal.h b/modules/mono/mono_gd/gd_mono_marshal.h
new file mode 100644
index 0000000000..38dd22357d
--- /dev/null
+++ b/modules/mono/mono_gd/gd_mono_marshal.h
@@ -0,0 +1,218 @@
+/*************************************************************************/
+/* gd_mono_marshal.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef GDMONOMARSHAL_H
+#define GDMONOMARSHAL_H
+
+#include "gd_mono.h"
+#include "gd_mono_utils.h"
+#include "variant.h"
+
+namespace GDMonoMarshal {
+
+template <typename T>
+T unbox(MonoObject *p_obj) {
+ return *(T *)mono_object_unbox(p_obj);
+}
+
+#define BOX_DOUBLE(x) mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(double), &x)
+#define BOX_FLOAT(x) mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(float), &x)
+#define BOX_INT64(x) mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(int64_t), &x)
+#define BOX_INT32(x) mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(int32_t), &x)
+#define BOX_INT16(x) mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(int16_t), &x)
+#define BOX_INT8(x) mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(int8_t), &x)
+#define BOX_UINT64(x) mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(uint64_t), &x)
+#define BOX_UINT32(x) mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(uint32_t), &x)
+#define BOX_UINT16(x) mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(uint16_t), &x)
+#define BOX_UINT8(x) mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(uint8_t), &x)
+#define BOX_BOOLEAN(x) mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(bool), &x)
+#define BOX_PTR(x) mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(IntPtr), x)
+
+Variant::Type managed_to_variant_type(const ManagedType &p_type);
+
+// String
+
+String mono_to_utf8_string(MonoString *p_mono_string);
+String mono_to_utf16_string(MonoString *p_mono_string);
+
+_FORCE_INLINE_ String mono_string_to_godot(MonoString *p_mono_string) {
+ if (sizeof(CharType) == 2)
+ return mono_to_utf16_string(p_mono_string);
+
+ return mono_to_utf8_string(p_mono_string);
+}
+
+_FORCE_INLINE_ MonoString *mono_from_utf8_string(const String &p_string) {
+ return mono_string_new(mono_domain_get(), p_string.utf8().get_data());
+}
+
+_FORCE_INLINE_ MonoString *mono_from_utf16_string(const String &p_string) {
+ return mono_string_from_utf16((mono_unichar2 *)p_string.c_str());
+}
+
+_FORCE_INLINE_ MonoString *mono_string_from_godot(const String &p_string) {
+ if (sizeof(CharType) == 2)
+ return mono_from_utf16_string(p_string);
+
+ return mono_from_utf8_string(p_string);
+}
+
+// Variant
+
+MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_type);
+MonoObject *variant_to_mono_object(const Variant *p_var);
+
+_FORCE_INLINE_ MonoObject *variant_to_mono_object(Variant p_var) {
+ return variant_to_mono_object(&p_var);
+}
+
+Variant mono_object_to_variant(MonoObject *p_obj);
+Variant mono_object_to_variant(MonoObject *p_obj, const ManagedType &p_type);
+
+// Array
+
+MonoArray *Array_to_mono_array(const Array &p_array);
+Array mono_array_to_Array(MonoArray *p_array);
+
+// PoolIntArray
+
+MonoArray *PoolIntArray_to_mono_array(const PoolIntArray &p_array);
+PoolIntArray mono_array_to_PoolIntArray(MonoArray *p_array);
+
+// PoolByteArray
+
+MonoArray *PoolByteArray_to_mono_array(const PoolByteArray &p_array);
+PoolByteArray mono_array_to_PoolByteArray(MonoArray *p_array);
+
+// PoolRealArray
+
+MonoArray *PoolRealArray_to_mono_array(const PoolRealArray &p_array);
+PoolRealArray mono_array_to_PoolRealArray(MonoArray *p_array);
+
+// PoolStringArray
+
+MonoArray *PoolStringArray_to_mono_array(const PoolStringArray &p_array);
+PoolStringArray mono_array_to_PoolStringArray(MonoArray *p_array);
+
+// PoolColorArray
+
+MonoArray *PoolColorArray_to_mono_array(const PoolColorArray &p_array);
+PoolColorArray mono_array_to_PoolColorArray(MonoArray *p_array);
+
+// PoolVector2Array
+
+MonoArray *PoolVector2Array_to_mono_array(const PoolVector2Array &p_array);
+PoolVector2Array mono_array_to_PoolVector2Array(MonoArray *p_array);
+
+// PoolVector3Array
+
+MonoArray *PoolVector3Array_to_mono_array(const PoolVector3Array &p_array);
+PoolVector3Array mono_array_to_PoolVector3Array(MonoArray *p_array);
+
+// Dictionary
+
+MonoObject *Dictionary_to_mono_object(const Dictionary &p_dict);
+Dictionary mono_object_to_Dictionary(MonoObject *p_dict);
+
+#ifdef YOLO_COPY
+#define MARSHALLED_OUT(m_t, m_in, m_out) m_t *m_out = (m_t *)&m_in;
+#define MARSHALLED_IN(m_t, m_in, m_out) m_t m_out = *reinterpret_cast<m_t *>(m_in);
+#else
+
+// Expects m_in to be of type float*
+
+#define MARSHALLED_OUT(m_t, m_in, m_out) MARSHALLED_OUT_##m_t(m_in, m_out)
+#define MARSHALLED_IN(m_t, m_in, m_out) MARSHALLED_IN_##m_t(m_in, m_out)
+
+// Vector2
+
+#define MARSHALLED_OUT_Vector2(m_in, m_out) real_t m_out[2] = { m_in.x, m_in.y };
+#define MARSHALLED_IN_Vector2(m_in, m_out) Vector2 m_out(m_in[0], m_in[1]);
+
+// Rect2
+
+#define MARSHALLED_OUT_Rect2(m_in, m_out) real_t m_out[4] = { m_in.position.x, m_in.position.y, m_in.size.width, m_in.size.height };
+#define MARSHALLED_IN_Rect2(m_in, m_out) Rect2 m_out(m_in[0], m_in[1], m_in[2], m_in[3]);
+
+// Transform2D
+
+#define MARSHALLED_OUT_Transform2D(m_in, m_out) real_t m_out[6] = { m_in[0].x, m_in[0].y, m_in[1].x, m_in[1].y, m_in[2].x, m_in[2].y };
+#define MARSHALLED_IN_Transform2D(m_in, m_out) Transform2D m_out(m_in[0], m_in[1], m_in[2], m_in[3], m_in[4], m_in[5]);
+
+// Vector3
+
+#define MARSHALLED_OUT_Vector3(m_in, m_out) real_t m_out[3] = { m_in.x, m_in.y, m_in.z };
+#define MARSHALLED_IN_Vector3(m_in, m_out) Vector3 m_out(m_in[0], m_in[1], m_in[2]);
+
+// Basis
+
+#define MARSHALLED_OUT_Basis(m_in, m_out) real_t m_out[9] = { \
+ m_in[0].x, m_in[0].y, m_in[0].z, \
+ m_in[1].x, m_in[1].y, m_in[1].z, \
+ m_in[2].x, m_in[2].y, m_in[2].z \
+};
+#define MARSHALLED_IN_Basis(m_in, m_out) Basis m_out(m_in[0], m_in[1], m_in[2], m_in[3], m_in[4], m_in[5], m_in[6], m_in[7], m_in[8]);
+
+// Quat
+
+#define MARSHALLED_OUT_Quat(m_in, m_out) real_t m_out[4] = { m_in.x, m_in.y, m_in.z, m_in.w };
+#define MARSHALLED_IN_Quat(m_in, m_out) Quat m_out(m_in[0], m_in[1], m_in[2], m_in[3]);
+
+// Transform
+
+#define MARSHALLED_OUT_Transform(m_in, m_out) real_t m_out[12] = { \
+ m_in.basis[0].x, m_in.basis[0].y, m_in.basis[0].z, \
+ m_in.basis[1].x, m_in.basis[1].y, m_in.basis[1].z, \
+ m_in.basis[2].x, m_in.basis[2].y, m_in.basis[2].z, \
+ m_in.origin.x, m_in.origin.y, m_in.origin.z \
+};
+#define MARSHALLED_IN_Transform(m_in, m_out) Transform m_out( \
+ Basis(m_in[0], m_in[1], m_in[2], m_in[3], m_in[4], m_in[5], m_in[6], m_in[7], m_in[8]), \
+ Vector3(m_in[9], m_in[10], m_in[11]));
+
+// Rect3
+
+#define MARSHALLED_OUT_Rect3(m_in, m_out) real_t m_out[6] = { m_in.position.x, m_in.position.y, m_in.position.z, m_in.size.x, m_in.size.y, m_in.size.z };
+#define MARSHALLED_IN_Rect3(m_in, m_out) Rect3 m_out(Vector3(m_in[0], m_in[1], m_in[2]), Vector3(m_in[3], m_in[4], m_in[5]));
+
+// Color
+
+#define MARSHALLED_OUT_Color(m_in, m_out) real_t m_out[4] = { m_in.r, m_in.g, m_in.b, m_in.a };
+#define MARSHALLED_IN_Color(m_in, m_out) Color m_out(m_in[0], m_in[1], m_in[2], m_in[3]);
+
+// Plane
+
+#define MARSHALLED_OUT_Plane(m_in, m_out) real_t m_out[4] = { m_in.normal.x, m_in.normal.y, m_in.normal.z, m_in.d };
+#define MARSHALLED_IN_Plane(m_in, m_out) Plane m_out(m_in[0], m_in[1], m_in[2], m_in[3]);
+
+#endif
+
+} // GDMonoMarshal
+
+#endif // GDMONOMARSHAL_H
diff --git a/modules/mono/mono_gd/gd_mono_method.cpp b/modules/mono/mono_gd/gd_mono_method.cpp
new file mode 100644
index 0000000000..6468e0d3d9
--- /dev/null
+++ b/modules/mono/mono_gd/gd_mono_method.cpp
@@ -0,0 +1,192 @@
+/*************************************************************************/
+/* gd_mono_method.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "gd_mono_method.h"
+
+#include "gd_mono_class.h"
+#include "gd_mono_marshal.h"
+
+void GDMonoMethod::_update_signature() {
+ // Apparently MonoMethodSignature needs not to be freed.
+ // mono_method_signature caches the result, we don't need to cache it ourselves.
+
+ MonoMethodSignature *method_sig = mono_method_signature(mono_method);
+ _update_signature(method_sig);
+}
+
+void GDMonoMethod::_update_signature(MonoMethodSignature *p_method_sig) {
+ is_instance = mono_signature_is_instance(p_method_sig);
+ params_count = mono_signature_get_param_count(p_method_sig);
+
+ MonoType *ret_type = mono_signature_get_return_type(p_method_sig);
+ if (ret_type) {
+ return_type.type_encoding = mono_type_get_type(ret_type);
+
+ if (return_type.type_encoding != MONO_TYPE_VOID) {
+ MonoClass *ret_type_class = mono_class_from_mono_type(ret_type);
+ return_type.type_class = GDMono::get_singleton()->get_class(ret_type_class);
+ }
+ }
+
+ void *iter = NULL;
+ MonoType *param_raw_type;
+ while ((param_raw_type = mono_signature_get_params(p_method_sig, &iter)) != NULL) {
+ ManagedType param_type;
+
+ param_type.type_encoding = mono_type_get_type(param_raw_type);
+
+ if (param_type.type_encoding != MONO_TYPE_VOID) {
+ MonoClass *param_type_class = mono_class_from_mono_type(param_raw_type);
+ param_type.type_class = GDMono::get_singleton()->get_class(param_type_class);
+ }
+
+ param_types.push_back(param_type);
+ }
+}
+
+void *GDMonoMethod::get_thunk() {
+ return mono_method_get_unmanaged_thunk(mono_method);
+}
+
+MonoObject *GDMonoMethod::invoke(MonoObject *p_object, const Variant **p_params, MonoObject **r_exc) {
+ if (get_return_type().type_encoding != MONO_TYPE_VOID || get_parameters_count() > 0) {
+ MonoArray *params = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(MonoObject), get_parameters_count());
+
+ for (int i = 0; i < params_count; i++) {
+ MonoObject *boxed_param = GDMonoMarshal::variant_to_mono_object(p_params[i], param_types[i]);
+ mono_array_set(params, MonoObject *, i, boxed_param);
+ }
+
+ return mono_runtime_invoke_array(mono_method, p_object, params, r_exc);
+ } else {
+ mono_runtime_invoke(mono_method, p_object, NULL, r_exc);
+ return NULL;
+ }
+}
+
+MonoObject *GDMonoMethod::invoke(MonoObject *p_object, MonoObject **r_exc) {
+ ERR_FAIL_COND_V(get_parameters_count() > 0, NULL);
+ return invoke_raw(p_object, NULL, r_exc);
+}
+
+MonoObject *GDMonoMethod::invoke_raw(MonoObject *p_object, void **p_params, MonoObject **r_exc) {
+ return mono_runtime_invoke(mono_method, p_object, p_params, r_exc);
+}
+
+bool GDMonoMethod::has_attribute(GDMonoClass *p_attr_class) {
+ ERR_FAIL_NULL_V(p_attr_class, false);
+
+ if (!attrs_fetched)
+ fetch_attributes();
+
+ if (!attributes)
+ return false;
+
+ return mono_custom_attrs_has_attr(attributes, p_attr_class->get_raw());
+}
+
+MonoObject *GDMonoMethod::get_attribute(GDMonoClass *p_attr_class) {
+ ERR_FAIL_NULL_V(p_attr_class, NULL);
+
+ if (!attrs_fetched)
+ fetch_attributes();
+
+ if (!attributes)
+ return NULL;
+
+ return mono_custom_attrs_get_attr(attributes, p_attr_class->get_raw());
+}
+
+void GDMonoMethod::fetch_attributes() {
+ ERR_FAIL_COND(attributes != NULL);
+ attributes = mono_custom_attrs_from_method(mono_method);
+ attrs_fetched = true;
+}
+
+String GDMonoMethod::get_full_name(bool p_signature) const {
+ char *res = mono_method_full_name(mono_method, p_signature);
+ String full_name(res);
+ mono_free(res);
+ return full_name;
+}
+
+String GDMonoMethod::get_full_name_no_class() const {
+ String res;
+
+ MonoMethodSignature *method_sig = mono_method_signature(mono_method);
+
+ char *ret_str = mono_type_full_name(mono_signature_get_return_type(method_sig));
+ res += ret_str;
+ mono_free(ret_str);
+
+ res += " ";
+ res += name;
+ res += "(";
+
+ char *sig_desc = mono_signature_get_desc(method_sig, true);
+ res += sig_desc;
+ mono_free(sig_desc);
+
+ res += ")";
+
+ return res;
+}
+
+String GDMonoMethod::get_ret_type_full_name() const {
+ MonoMethodSignature *method_sig = mono_method_signature(mono_method);
+ char *ret_str = mono_type_full_name(mono_signature_get_return_type(method_sig));
+ String res = ret_str;
+ mono_free(ret_str);
+ return res;
+}
+
+String GDMonoMethod::get_signature_desc(bool p_namespaces) const {
+ MonoMethodSignature *method_sig = mono_method_signature(mono_method);
+ char *sig_desc = mono_signature_get_desc(method_sig, p_namespaces);
+ String res = sig_desc;
+ mono_free(sig_desc);
+ return res;
+}
+
+GDMonoMethod::GDMonoMethod(StringName p_name, MonoMethod *p_method) {
+ name = p_name;
+
+ mono_method = p_method;
+
+ attrs_fetched = false;
+ attributes = NULL;
+
+ _update_signature();
+}
+
+GDMonoMethod::~GDMonoMethod() {
+ if (attributes) {
+ mono_custom_attrs_free(attributes);
+ }
+}
diff --git a/modules/mono/mono_gd/gd_mono_method.h b/modules/mono/mono_gd/gd_mono_method.h
new file mode 100644
index 0000000000..ea4bc8e707
--- /dev/null
+++ b/modules/mono/mono_gd/gd_mono_method.h
@@ -0,0 +1,81 @@
+/*************************************************************************/
+/* gd_mono_method.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef GD_MONO_METHOD_H
+#define GD_MONO_METHOD_H
+
+#include "gd_mono.h"
+#include "gd_mono_header.h"
+
+class GDMonoMethod {
+
+ StringName name;
+
+ bool is_instance;
+ int params_count;
+ ManagedType return_type;
+ Vector<ManagedType> param_types;
+
+ bool attrs_fetched;
+ MonoCustomAttrInfo *attributes;
+
+ void _update_signature();
+ void _update_signature(MonoMethodSignature *p_method_sig);
+
+ friend class GDMonoClass;
+
+ MonoMethod *mono_method;
+
+public:
+ _FORCE_INLINE_ StringName get_name() { return name; }
+
+ _FORCE_INLINE_ bool is_static() { return !is_instance; }
+ _FORCE_INLINE_ int get_parameters_count() { return params_count; }
+ _FORCE_INLINE_ ManagedType get_return_type() { return return_type; }
+
+ void *get_thunk();
+
+ MonoObject *invoke(MonoObject *p_object, const Variant **p_params, MonoObject **r_exc = NULL);
+ MonoObject *invoke(MonoObject *p_object, MonoObject **r_exc = NULL);
+ MonoObject *invoke_raw(MonoObject *p_object, void **p_params, MonoObject **r_exc = NULL);
+
+ bool has_attribute(GDMonoClass *p_attr_class);
+ MonoObject *get_attribute(GDMonoClass *p_attr_class);
+ void fetch_attributes();
+
+ String get_full_name(bool p_signature = false) const;
+ String get_full_name_no_class() const;
+ String get_ret_type_full_name() const;
+ String get_signature_desc(bool p_namespaces = false) const;
+
+ GDMonoMethod(StringName p_name, MonoMethod *p_method);
+ ~GDMonoMethod();
+};
+
+#endif // GD_MONO_METHOD_H
diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp
new file mode 100644
index 0000000000..5deca8e64d
--- /dev/null
+++ b/modules/mono/mono_gd/gd_mono_utils.cpp
@@ -0,0 +1,367 @@
+/*************************************************************************/
+/* gd_mono_utils.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "gd_mono_utils.h"
+
+#include "os/dir_access.h"
+#include "project_settings.h"
+#include "reference.h"
+
+#include "../csharp_script.h"
+#include "gd_mono.h"
+#include "gd_mono_class.h"
+#include "gd_mono_marshal.h"
+
+namespace GDMonoUtils {
+
+MonoCache mono_cache;
+
+#define CACHE_AND_CHECK(m_var, m_val) \
+ { \
+ m_var = m_val; \
+ if (!m_var) ERR_PRINT("Mono Cache: Member " #m_var " is null. This is really bad!"); \
+ }
+
+#define CACHE_CLASS_AND_CHECK(m_class, m_val) CACHE_AND_CHECK(GDMonoUtils::mono_cache.class_##m_class, m_val)
+#define CACHE_NS_CLASS_AND_CHECK(m_ns, m_class, m_val) CACHE_AND_CHECK(GDMonoUtils::mono_cache.class_##m_ns##_##m_class, m_val)
+#define CACHE_RAW_MONO_CLASS_AND_CHECK(m_class, m_val) CACHE_AND_CHECK(GDMonoUtils::mono_cache.rawclass_##m_class, m_val)
+#define CACHE_FIELD_AND_CHECK(m_class, m_field, m_val) CACHE_AND_CHECK(GDMonoUtils::mono_cache.field_##m_class##_##m_field, m_val)
+#define CACHE_METHOD_THUNK_AND_CHECK(m_class, m_method, m_val) CACHE_AND_CHECK(GDMonoUtils::mono_cache.methodthunk_##m_class##_##m_method, m_val)
+
+void MonoCache::clear_members() {
+
+ class_MonoObject = NULL;
+ class_bool = NULL;
+ class_int8_t = NULL;
+ class_int16_t = NULL;
+ class_int32_t = NULL;
+ class_int64_t = NULL;
+ class_uint8_t = NULL;
+ class_uint16_t = NULL;
+ class_uint32_t = NULL;
+ class_uint64_t = NULL;
+ class_float = NULL;
+ class_double = NULL;
+ class_String = NULL;
+ class_IntPtr = NULL;
+
+ rawclass_Dictionary = NULL;
+
+ class_Vector2 = NULL;
+ class_Rect2 = NULL;
+ class_Transform2D = NULL;
+ class_Vector3 = NULL;
+ class_Basis = NULL;
+ class_Quat = NULL;
+ class_Transform = NULL;
+ class_Rect3 = NULL;
+ class_Color = NULL;
+ class_Plane = NULL;
+ class_NodePath = NULL;
+ class_RID = NULL;
+ class_GodotObject = NULL;
+ class_Node = NULL;
+ class_Control = NULL;
+ class_Spatial = NULL;
+ class_WeakRef = NULL;
+ class_MarshalUtils = NULL;
+
+ class_ExportAttribute = NULL;
+ field_ExportAttribute_hint = NULL;
+ field_ExportAttribute_hint_string = NULL;
+ field_ExportAttribute_usage = NULL;
+ class_ToolAttribute = NULL;
+ class_RemoteAttribute = NULL;
+ class_SyncAttribute = NULL;
+ class_MasterAttribute = NULL;
+ class_SlaveAttribute = NULL;
+ class_GodotMethodAttribute = NULL;
+ field_GodotMethodAttribute_methodName = NULL;
+
+ field_GodotObject_ptr = NULL;
+ field_NodePath_ptr = NULL;
+ field_Image_ptr = NULL;
+ field_RID_ptr = NULL;
+
+ methodthunk_MarshalUtils_DictionaryToArrays = NULL;
+ methodthunk_MarshalUtils_ArraysToDictionary = NULL;
+ methodthunk_GodotObject__AwaitedSignalCallback = NULL;
+ methodthunk_SignalAwaiter_FailureCallback = NULL;
+ methodthunk_GodotTaskScheduler_Activate = NULL;
+
+ task_scheduler_handle = Ref<MonoGCHandle>();
+}
+
+#define GODOT_API_CLASS(m_class) (GDMono::get_singleton()->get_api_assembly()->get_class(BINDINGS_NAMESPACE, #m_class))
+
+void update_corlib_cache() {
+
+ CACHE_CLASS_AND_CHECK(MonoObject, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_object_class()));
+ CACHE_CLASS_AND_CHECK(bool, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_boolean_class()));
+ CACHE_CLASS_AND_CHECK(int8_t, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_sbyte_class()));
+ CACHE_CLASS_AND_CHECK(int16_t, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_int16_class()));
+ CACHE_CLASS_AND_CHECK(int32_t, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_int32_class()));
+ CACHE_CLASS_AND_CHECK(int64_t, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_int64_class()));
+ CACHE_CLASS_AND_CHECK(uint8_t, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_byte_class()));
+ CACHE_CLASS_AND_CHECK(uint16_t, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_uint16_class()));
+ CACHE_CLASS_AND_CHECK(uint32_t, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_uint32_class()));
+ CACHE_CLASS_AND_CHECK(uint64_t, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_uint64_class()));
+ CACHE_CLASS_AND_CHECK(float, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_single_class()));
+ CACHE_CLASS_AND_CHECK(double, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_double_class()));
+ CACHE_CLASS_AND_CHECK(String, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_string_class()));
+ CACHE_CLASS_AND_CHECK(IntPtr, GDMono::get_singleton()->get_corlib_assembly()->get_class(mono_get_intptr_class()));
+}
+
+void update_godot_api_cache() {
+
+ CACHE_CLASS_AND_CHECK(Vector2, GODOT_API_CLASS(Vector2));
+ CACHE_CLASS_AND_CHECK(Rect2, GODOT_API_CLASS(Rect2));
+ CACHE_CLASS_AND_CHECK(Transform2D, GODOT_API_CLASS(Transform2D));
+ CACHE_CLASS_AND_CHECK(Vector3, GODOT_API_CLASS(Vector3));
+ CACHE_CLASS_AND_CHECK(Basis, GODOT_API_CLASS(Basis));
+ CACHE_CLASS_AND_CHECK(Quat, GODOT_API_CLASS(Quat));
+ CACHE_CLASS_AND_CHECK(Transform, GODOT_API_CLASS(Transform));
+ CACHE_CLASS_AND_CHECK(Rect3, GODOT_API_CLASS(Rect3));
+ CACHE_CLASS_AND_CHECK(Color, GODOT_API_CLASS(Color));
+ CACHE_CLASS_AND_CHECK(Plane, GODOT_API_CLASS(Plane));
+ CACHE_CLASS_AND_CHECK(NodePath, GODOT_API_CLASS(NodePath));
+ CACHE_CLASS_AND_CHECK(RID, GODOT_API_CLASS(NodePath));
+ CACHE_CLASS_AND_CHECK(GodotObject, GODOT_API_CLASS(Object));
+ CACHE_CLASS_AND_CHECK(Node, GODOT_API_CLASS(Node));
+ CACHE_CLASS_AND_CHECK(Control, GODOT_API_CLASS(Control));
+ CACHE_CLASS_AND_CHECK(Spatial, GODOT_API_CLASS(Spatial));
+ CACHE_CLASS_AND_CHECK(WeakRef, GODOT_API_CLASS(WeakRef));
+ CACHE_CLASS_AND_CHECK(MarshalUtils, GODOT_API_CLASS(MarshalUtils));
+
+ // Attributes
+ CACHE_CLASS_AND_CHECK(ExportAttribute, GODOT_API_CLASS(ExportAttribute));
+ CACHE_FIELD_AND_CHECK(ExportAttribute, hint, CACHED_CLASS(ExportAttribute)->get_field("hint"));
+ CACHE_FIELD_AND_CHECK(ExportAttribute, hint_string, CACHED_CLASS(ExportAttribute)->get_field("hint_string"));
+ CACHE_FIELD_AND_CHECK(ExportAttribute, usage, CACHED_CLASS(ExportAttribute)->get_field("usage"));
+ CACHE_CLASS_AND_CHECK(ToolAttribute, GODOT_API_CLASS(ToolAttribute));
+ CACHE_CLASS_AND_CHECK(RemoteAttribute, GODOT_API_CLASS(RemoteAttribute));
+ CACHE_CLASS_AND_CHECK(SyncAttribute, GODOT_API_CLASS(SyncAttribute));
+ CACHE_CLASS_AND_CHECK(MasterAttribute, GODOT_API_CLASS(MasterAttribute));
+ CACHE_CLASS_AND_CHECK(SlaveAttribute, GODOT_API_CLASS(SlaveAttribute));
+ CACHE_CLASS_AND_CHECK(GodotMethodAttribute, GODOT_API_CLASS(GodotMethodAttribute));
+ CACHE_FIELD_AND_CHECK(GodotMethodAttribute, methodName, CACHED_CLASS(GodotMethodAttribute)->get_field("methodName"));
+
+ CACHE_FIELD_AND_CHECK(GodotObject, ptr, CACHED_CLASS(GodotObject)->get_field(BINDINGS_PTR_FIELD));
+ CACHE_FIELD_AND_CHECK(NodePath, ptr, CACHED_CLASS(NodePath)->get_field(BINDINGS_PTR_FIELD));
+ CACHE_FIELD_AND_CHECK(RID, ptr, CACHED_CLASS(RID)->get_field(BINDINGS_PTR_FIELD));
+
+ CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, DictionaryToArrays, (MarshalUtils_DictToArrays)CACHED_CLASS(MarshalUtils)->get_method("DictionaryToArrays", 3)->get_thunk());
+ CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, ArraysToDictionary, (MarshalUtils_ArraysToDict)CACHED_CLASS(MarshalUtils)->get_method("ArraysToDictionary", 2)->get_thunk());
+ CACHE_METHOD_THUNK_AND_CHECK(GodotObject, _AwaitedSignalCallback, (GodotObject__AwaitedSignalCallback)CACHED_CLASS(GodotObject)->get_method("_AwaitedSignalCallback", 2)->get_thunk());
+ CACHE_METHOD_THUNK_AND_CHECK(SignalAwaiter, FailureCallback, (SignalAwaiter_FailureCallback)GODOT_API_CLASS(SignalAwaiter)->get_method("FailureCallback", 0)->get_thunk());
+ CACHE_METHOD_THUNK_AND_CHECK(GodotTaskScheduler, Activate, (GodotTaskScheduler_Activate)GODOT_API_CLASS(GodotTaskScheduler)->get_method("Activate", 0)->get_thunk());
+
+ {
+ /*
+ * TODO Right now we only support Dictionary<object, object>.
+ * It would be great if we could support other key/value types
+ * without forcing the user to copy the entries.
+ */
+ GDMonoMethod *method_get_dict_type = CACHED_CLASS(MarshalUtils)->get_method("GetDictionaryType", 0);
+ ERR_FAIL_NULL(method_get_dict_type);
+ MonoReflectionType *dict_refl_type = (MonoReflectionType *)method_get_dict_type->invoke(NULL);
+ ERR_FAIL_NULL(dict_refl_type);
+ MonoType *dict_type = mono_reflection_type_get_type(dict_refl_type);
+ ERR_FAIL_NULL(dict_type);
+
+ CACHE_RAW_MONO_CLASS_AND_CHECK(Dictionary, mono_class_from_mono_type(dict_type));
+ }
+
+ MonoObject *task_scheduler = mono_object_new(SCRIPTS_DOMAIN, GODOT_API_CLASS(GodotTaskScheduler)->get_raw());
+ mono_runtime_object_init(task_scheduler);
+ mono_cache.task_scheduler_handle = MonoGCHandle::create_strong(task_scheduler);
+}
+
+void clear_cache() {
+ mono_cache.cleanup();
+ mono_cache.clear_members();
+}
+
+MonoObject *unmanaged_get_managed(Object *unmanaged) {
+ if (unmanaged) {
+ if (unmanaged->get_script_instance()) {
+ CSharpInstance *cs_instance = CAST_CSHARP_INSTANCE(unmanaged->get_script_instance());
+
+ if (cs_instance) {
+ return cs_instance->get_mono_object();
+ }
+ }
+
+ // Only called if the owner does not have a CSharpInstance
+ void *data = unmanaged->get_script_instance_binding(CSharpLanguage::get_singleton()->get_language_index());
+
+ if (data) {
+ return ((Map<Object *, Ref<MonoGCHandle> >::Element *)data)->value()->get_target();
+ }
+ }
+
+ return NULL;
+}
+
+void set_main_thread(MonoThread *p_thread) {
+ mono_thread_set_main(p_thread);
+}
+
+void attach_current_thread() {
+ ERR_FAIL_COND(!GDMono::get_singleton()->is_runtime_initialized());
+ MonoThread *mono_thread = mono_thread_attach(SCRIPTS_DOMAIN);
+ ERR_FAIL_NULL(mono_thread);
+}
+
+void detach_current_thread() {
+ ERR_FAIL_COND(!GDMono::get_singleton()->is_runtime_initialized());
+ MonoThread *mono_thread = mono_thread_current();
+ ERR_FAIL_NULL(mono_thread);
+ mono_thread_detach(mono_thread);
+}
+
+MonoThread *get_current_thread() {
+ return mono_thread_current();
+}
+
+GDMonoClass *get_object_class(MonoObject *p_object) {
+ return GDMono::get_singleton()->get_class(mono_object_get_class(p_object));
+}
+
+GDMonoClass *type_get_proxy_class(const StringName &p_type) {
+ String class_name = p_type;
+
+ if (class_name[0] == '_')
+ class_name = class_name.substr(1, class_name.length());
+
+ GDMonoClass *klass = GDMono::get_singleton()->get_api_assembly()->get_class(BINDINGS_NAMESPACE, class_name);
+
+#ifdef TOOLS_ENABLED
+ if (!klass) {
+ return GDMono::get_singleton()->get_editor_api_assembly()->get_class(BINDINGS_NAMESPACE, class_name);
+ }
+#endif
+
+ return klass;
+}
+
+GDMonoClass *get_class_native_base(GDMonoClass *p_class) {
+ GDMonoClass *klass = p_class;
+
+ do {
+ const GDMonoAssembly *assembly = klass->get_assembly();
+ if (assembly == GDMono::get_singleton()->get_api_assembly())
+ return klass;
+#ifdef TOOLS_ENABLED
+ if (assembly == GDMono::get_singleton()->get_editor_api_assembly())
+ return klass;
+#endif
+ } while ((klass = klass->get_parent_class()) != NULL);
+
+ return NULL;
+}
+
+MonoObject *create_managed_for_godot_object(GDMonoClass *p_class, const StringName &p_native, Object *p_object) {
+ String object_type = p_object->get_class_name();
+
+ if (object_type[0] == '_')
+ object_type = object_type.substr(1, object_type.length());
+
+ if (!ClassDB::is_parent_class(object_type, p_native)) {
+ ERR_EXPLAIN("Type inherits from native type '" + p_native + "', so it can't be instanced in object of type: '" + p_object->get_class() + "'");
+ ERR_FAIL_V(NULL);
+ }
+
+ MonoObject *mono_object = mono_object_new(SCRIPTS_DOMAIN, p_class->get_raw());
+ ERR_FAIL_NULL_V(mono_object, NULL);
+
+ CACHED_FIELD(GodotObject, ptr)->set_value_raw(mono_object, p_object);
+
+ // Construct
+ mono_runtime_object_init(mono_object);
+
+ return mono_object;
+}
+
+MonoObject *create_managed_from(const NodePath &p_from) {
+ MonoObject *mono_object = mono_object_new(SCRIPTS_DOMAIN, CACHED_CLASS_RAW(NodePath));
+ ERR_FAIL_NULL_V(mono_object, NULL);
+
+ // Construct
+ mono_runtime_object_init(mono_object);
+
+ CACHED_FIELD(NodePath, ptr)->set_value_raw(mono_object, memnew(NodePath(p_from)));
+
+ return mono_object;
+}
+
+MonoObject *create_managed_from(const RID &p_from) {
+ MonoObject *mono_object = mono_object_new(SCRIPTS_DOMAIN, CACHED_CLASS_RAW(RID));
+ ERR_FAIL_NULL_V(mono_object, NULL);
+
+ // Construct
+ mono_runtime_object_init(mono_object);
+
+ CACHED_FIELD(RID, ptr)->set_value_raw(mono_object, memnew(RID(p_from)));
+
+ return mono_object;
+}
+
+MonoDomain *create_domain(const String &p_friendly_name) {
+ MonoDomain *domain = mono_domain_create_appdomain((char *)p_friendly_name.utf8().get_data(), NULL);
+
+ if (domain) {
+ // Workaround to avoid this exception:
+ // System.Configuration.ConfigurationErrorsException: Error Initializing the configuration system.
+ // ---> System.ArgumentException: The 'ExeConfigFilename' argument cannot be null.
+ mono_domain_set_config(domain, ".", "");
+ }
+
+ return domain;
+}
+
+String get_exception_name_and_message(MonoObject *p_ex) {
+ String res;
+
+ MonoClass *klass = mono_object_get_class(p_ex);
+ MonoType *type = mono_class_get_type(klass);
+
+ char *full_name = mono_type_full_name(type);
+ res += full_name;
+ mono_free(full_name);
+
+ res += ": ";
+
+ MonoProperty *prop = mono_class_get_property_from_name(klass, "Message");
+ MonoString *msg = (MonoString *)mono_property_get_value(prop, p_ex, NULL, NULL);
+ res += GDMonoMarshal::mono_string_to_godot(msg);
+
+ return res;
+}
+}
diff --git a/modules/mono/mono_gd/gd_mono_utils.h b/modules/mono/mono_gd/gd_mono_utils.h
new file mode 100644
index 0000000000..f97f048aa9
--- /dev/null
+++ b/modules/mono/mono_gd/gd_mono_utils.h
@@ -0,0 +1,182 @@
+/*************************************************************************/
+/* gd_mono_utils.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef GD_MONOUTILS_H
+#define GD_MONOUTILS_H
+
+#include <mono/metadata/threads.h>
+
+#include "../mono_gc_handle.h"
+#include "gd_mono_header.h"
+
+#include "object.h"
+#include "reference.h"
+
+namespace GDMonoUtils {
+
+typedef MonoObject *(*MarshalUtils_DictToArrays)(MonoObject *, MonoArray **, MonoArray **, MonoObject **);
+typedef MonoObject *(*MarshalUtils_ArraysToDict)(MonoArray *, MonoArray *, MonoObject **);
+typedef MonoObject *(*GodotObject__AwaitedSignalCallback)(MonoObject *, MonoArray **, MonoObject *, MonoObject **);
+typedef MonoObject *(*SignalAwaiter_FailureCallback)(MonoObject *, MonoObject **);
+typedef MonoObject *(*GodotTaskScheduler_Activate)(MonoObject *, MonoObject **);
+
+struct MonoCache {
+ // Format for cached classes in the Godot namespace: class_<Class>
+ // Macro: CACHED_CLASS(<Class>)
+
+ // Format for cached classes in a different namespace: class_<Namespace>_<Class>
+ // Macro: CACHED_NS_CLASS(<Namespace>, <Class>)
+
+ // -----------------------------------------------
+ // corlib classes
+
+ // Let's use the no-namespace format for these too
+ GDMonoClass *class_MonoObject;
+ GDMonoClass *class_bool;
+ GDMonoClass *class_int8_t;
+ GDMonoClass *class_int16_t;
+ GDMonoClass *class_int32_t;
+ GDMonoClass *class_int64_t;
+ GDMonoClass *class_uint8_t;
+ GDMonoClass *class_uint16_t;
+ GDMonoClass *class_uint32_t;
+ GDMonoClass *class_uint64_t;
+ GDMonoClass *class_float;
+ GDMonoClass *class_double;
+ GDMonoClass *class_String;
+ GDMonoClass *class_IntPtr;
+
+ MonoClass *rawclass_Dictionary;
+ // -----------------------------------------------
+
+ GDMonoClass *class_Vector2;
+ GDMonoClass *class_Rect2;
+ GDMonoClass *class_Transform2D;
+ GDMonoClass *class_Vector3;
+ GDMonoClass *class_Basis;
+ GDMonoClass *class_Quat;
+ GDMonoClass *class_Transform;
+ GDMonoClass *class_Rect3;
+ GDMonoClass *class_Color;
+ GDMonoClass *class_Plane;
+ GDMonoClass *class_NodePath;
+ GDMonoClass *class_RID;
+ GDMonoClass *class_GodotObject;
+ GDMonoClass *class_Node;
+ GDMonoClass *class_Control;
+ GDMonoClass *class_Spatial;
+ GDMonoClass *class_WeakRef;
+ GDMonoClass *class_MarshalUtils;
+
+ GDMonoClass *class_ExportAttribute;
+ GDMonoField *field_ExportAttribute_hint;
+ GDMonoField *field_ExportAttribute_hint_string;
+ GDMonoField *field_ExportAttribute_usage;
+ GDMonoClass *class_ToolAttribute;
+ GDMonoClass *class_RemoteAttribute;
+ GDMonoClass *class_SyncAttribute;
+ GDMonoClass *class_MasterAttribute;
+ GDMonoClass *class_SlaveAttribute;
+ GDMonoClass *class_GodotMethodAttribute;
+ GDMonoField *field_GodotMethodAttribute_methodName;
+
+ GDMonoField *field_GodotObject_ptr;
+ GDMonoField *field_NodePath_ptr;
+ GDMonoField *field_Image_ptr;
+ GDMonoField *field_RID_ptr;
+
+ MarshalUtils_DictToArrays methodthunk_MarshalUtils_DictionaryToArrays;
+ MarshalUtils_ArraysToDict methodthunk_MarshalUtils_ArraysToDictionary;
+ GodotObject__AwaitedSignalCallback methodthunk_GodotObject__AwaitedSignalCallback;
+ SignalAwaiter_FailureCallback methodthunk_SignalAwaiter_FailureCallback;
+ GodotTaskScheduler_Activate methodthunk_GodotTaskScheduler_Activate;
+
+ Ref<MonoGCHandle> task_scheduler_handle;
+
+ void clear_members();
+ void cleanup() {}
+
+ MonoCache() {
+ clear_members();
+ }
+};
+
+extern MonoCache mono_cache;
+
+void update_corlib_cache();
+void update_godot_api_cache();
+void clear_cache();
+
+_FORCE_INLINE_ void hash_combine(uint32_t &p_hash, const uint32_t &p_with_hash) {
+ p_hash ^= p_with_hash + 0x9e3779b9 + (p_hash << 6) + (p_hash >> 2);
+}
+
+/**
+ * If the object has a csharp script, returns the target of the gchandle stored in the script instance
+ * Otherwise returns a newly constructed MonoObject* which is attached to the object
+ * Returns NULL on error
+ */
+MonoObject *unmanaged_get_managed(Object *unmanaged);
+
+void set_main_thread(MonoThread *p_thread);
+void attach_current_thread();
+void detach_current_thread();
+MonoThread *get_current_thread();
+
+GDMonoClass *get_object_class(MonoObject *p_object);
+GDMonoClass *type_get_proxy_class(const StringName &p_type);
+GDMonoClass *get_class_native_base(GDMonoClass *p_class);
+
+MonoObject *create_managed_for_godot_object(GDMonoClass *p_class, const StringName &p_native, Object *p_object);
+
+MonoObject *create_managed_from(const NodePath &p_from);
+MonoObject *create_managed_from(const RID &p_from);
+
+MonoDomain *create_domain(const String &p_friendly_name);
+
+String get_exception_name_and_message(MonoObject *p_ex);
+
+} // GDMonoUtils
+
+#define NATIVE_GDMONOCLASS_NAME(m_class) (GDMonoMarshal::mono_string_to_godot((MonoString *)m_class->get_field("nativeName")->get_value(NULL)))
+
+#define CACHED_CLASS(m_class) (GDMonoUtils::mono_cache.class_##m_class)
+#define CACHED_CLASS_RAW(m_class) (GDMonoUtils::mono_cache.class_##m_class->get_raw())
+#define CACHED_NS_CLASS(m_ns, m_class) (GDMonoUtils::mono_cache.class_##m_ns##_##m_class)
+#define CACHED_RAW_MONO_CLASS(m_class) (GDMonoUtils::mono_cache.rawclass_##m_class)
+#define CACHED_FIELD(m_class, m_field) (GDMonoUtils::mono_cache.field_##m_class##_##m_field)
+#define CACHED_METHOD_THUNK(m_class, m_method) (GDMonoUtils::mono_cache.methodthunk_##m_class##_##m_method)
+
+#ifdef REAL_T_IS_DOUBLE
+#define REAL_T_MONOCLASS CACHED_CLASS_RAW(double)
+#else
+#define REAL_T_MONOCLASS CACHED_CLASS_RAW(float)
+#endif
+
+#endif // GD_MONOUTILS_H
diff --git a/modules/mono/mono_reg_utils.py b/modules/mono/mono_reg_utils.py
new file mode 100644
index 0000000000..e9988625f5
--- /dev/null
+++ b/modules/mono/mono_reg_utils.py
@@ -0,0 +1,58 @@
+import os
+
+if os.name == 'nt':
+ import sys
+ if sys.version_info < (3,):
+ import _winreg as winreg
+ else:
+ import winreg
+
+
+def _reg_open_key(key, subkey):
+ try:
+ return winreg.OpenKey(key, subkey)
+ except (WindowsError, EnvironmentError) as e:
+ import platform
+ if platform.architecture()[0] == '32bit':
+ bitness_sam = winreg.KEY_WOW64_64KEY
+ else:
+ bitness_sam = winreg.KEY_WOW64_32KEY
+ return winreg.OpenKey(key, subkey, 0, winreg.KEY_READ | bitness_sam)
+
+
+def _find_mono_in_reg(subkey):
+ try:
+ with _reg_open_key(winreg.HKEY_LOCAL_MACHINE, subkey) as hKey:
+ value, regtype = winreg.QueryValueEx(hKey, 'SdkInstallRoot')
+ return value
+ except (WindowsError, EnvironmentError) as e:
+ return None
+
+def _find_mono_in_reg_old(subkey):
+ try:
+ with _reg_open_key(winreg.HKEY_LOCAL_MACHINE, subkey) as hKey:
+ default_clr, regtype = winreg.QueryValueEx(hKey, 'DefaultCLR')
+ if default_clr:
+ return _find_mono_in_reg(subkey + '\\' + default_clr)
+ return None
+ except (WindowsError, EnvironmentError):
+ return None
+
+
+def find_mono_root_dir():
+ dir = _find_mono_in_reg(r'SOFTWARE\Mono')
+ if dir:
+ return dir
+ dir = _find_mono_in_reg_old(r'SOFTWARE\Novell\Mono')
+ if dir:
+ return dir
+ return None
+
+
+def find_msbuild_tools_path_reg():
+ try:
+ with _reg_open_key(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0') as hKey:
+ value, regtype = winreg.QueryValueEx(hKey, 'MSBuildToolsPath')
+ return value
+ except (WindowsError, EnvironmentError) as e:
+ return None
diff --git a/modules/mono/register_types.cpp b/modules/mono/register_types.cpp
new file mode 100644
index 0000000000..2656de5b14
--- /dev/null
+++ b/modules/mono/register_types.cpp
@@ -0,0 +1,72 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "register_types.h"
+
+#include "project_settings.h"
+
+#include "csharp_script.h"
+
+CSharpLanguage *script_language_cs = NULL;
+ResourceFormatLoaderCSharpScript *resource_loader_cs = NULL;
+ResourceFormatSaverCSharpScript *resource_saver_cs = NULL;
+
+_GodotSharp *_godotsharp = NULL;
+
+void register_mono_types() {
+ ClassDB::register_class<CSharpScript>();
+
+ _godotsharp = memnew(_GodotSharp);
+
+ ClassDB::register_class<_GodotSharp>();
+ ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("GodotSharp", _GodotSharp::get_singleton()));
+
+ script_language_cs = memnew(CSharpLanguage);
+ script_language_cs->set_language_index(ScriptServer::get_language_count());
+ ScriptServer::register_language(script_language_cs);
+
+ resource_loader_cs = memnew(ResourceFormatLoaderCSharpScript);
+ ResourceLoader::add_resource_format_loader(resource_loader_cs);
+ resource_saver_cs = memnew(ResourceFormatSaverCSharpScript);
+ ResourceSaver::add_resource_format_saver(resource_saver_cs);
+}
+
+void unregister_mono_types() {
+ ScriptServer::unregister_language(script_language_cs);
+
+ if (script_language_cs)
+ memdelete(script_language_cs);
+ if (resource_loader_cs)
+ memdelete(resource_loader_cs);
+ if (resource_saver_cs)
+ memdelete(resource_saver_cs);
+
+ if (_godotsharp)
+ memdelete(_godotsharp);
+}
diff --git a/modules/mono/register_types.h b/modules/mono/register_types.h
new file mode 100644
index 0000000000..6cf706b944
--- /dev/null
+++ b/modules/mono/register_types.h
@@ -0,0 +1,31 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_mono_types();
+void unregister_mono_types();
diff --git a/modules/mono/signal_awaiter_utils.cpp b/modules/mono/signal_awaiter_utils.cpp
new file mode 100644
index 0000000000..012dd119b1
--- /dev/null
+++ b/modules/mono/signal_awaiter_utils.cpp
@@ -0,0 +1,77 @@
+/*************************************************************************/
+/* signal_awaiter_utils.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "signal_awaiter_utils.h"
+
+#include "mono_gd/gd_mono_utils.h"
+
+namespace SignalAwaiterUtils {
+
+Error connect_signal_awaiter(Object *p_source, const String &p_signal, Object *p_target, MonoObject *p_awaiter) {
+
+ ERR_FAIL_NULL_V(p_source, ERR_INVALID_DATA);
+ ERR_FAIL_NULL_V(p_target, ERR_INVALID_DATA);
+
+ uint32_t awaiter_handle = MonoGCHandle::make_strong_handle(p_awaiter);
+ Ref<SignalAwaiterHandle> sa_con = memnew(SignalAwaiterHandle(awaiter_handle));
+ Vector<Variant> binds;
+ binds.push_back(sa_con);
+ Error err = p_source->connect(p_signal, p_target, "_AwaitedSignalCallback", binds, Object::CONNECT_ONESHOT);
+
+ if (err != OK) {
+ // set it as completed to prevent it from calling the failure callback when deleted
+ // the awaiter will be aware of the failure by checking the returned error
+ sa_con->set_completed(true);
+ }
+
+ return err;
+}
+}
+
+SignalAwaiterHandle::SignalAwaiterHandle(uint32_t p_handle)
+ : MonoGCHandle(p_handle) {
+}
+
+SignalAwaiterHandle::~SignalAwaiterHandle() {
+ if (!completed) {
+ GDMonoUtils::SignalAwaiter_FailureCallback thunk = CACHED_METHOD_THUNK(SignalAwaiter, FailureCallback);
+
+ MonoObject *awaiter = get_target();
+
+ if (awaiter) {
+ MonoObject *ex = NULL;
+ thunk(awaiter, &ex);
+
+ if (ex) {
+ mono_print_unhandled_exception(ex);
+ ERR_FAIL_V();
+ }
+ }
+ }
+}
diff --git a/modules/mono/signal_awaiter_utils.h b/modules/mono/signal_awaiter_utils.h
new file mode 100644
index 0000000000..422ed4754f
--- /dev/null
+++ b/modules/mono/signal_awaiter_utils.h
@@ -0,0 +1,53 @@
+/*************************************************************************/
+/* signal_awaiter_utils.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef SIGNAL_AWAITER_UTILS_H
+#define SIGNAL_AWAITER_UTILS_H
+
+#include "mono_gc_handle.h"
+#include "reference.h"
+
+namespace SignalAwaiterUtils {
+
+Error connect_signal_awaiter(Object *p_source, const String &p_signal, Object *p_target, MonoObject *p_awaiter);
+}
+
+class SignalAwaiterHandle : public MonoGCHandle {
+
+ bool completed;
+
+public:
+ _FORCE_INLINE_ bool is_completed() { return completed; }
+ _FORCE_INLINE_ void set_completed(bool p_completed) { completed = p_completed; }
+
+ SignalAwaiterHandle(uint32_t p_handle);
+ ~SignalAwaiterHandle();
+};
+
+#endif // SIGNAL_AWAITER_UTILS_H
diff --git a/modules/mono/utils/mono_reg_utils.cpp b/modules/mono/utils/mono_reg_utils.cpp
new file mode 100644
index 0000000000..2e90b3b716
--- /dev/null
+++ b/modules/mono/utils/mono_reg_utils.cpp
@@ -0,0 +1,228 @@
+/*************************************************************************/
+/* mono_reg_utils.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "mono_reg_utils.h"
+
+#ifdef WINDOWS_ENABLED
+
+#include "os/os.h"
+
+// Here, after os/os.h
+#include <windows.h>
+
+namespace MonoRegUtils {
+
+template <int>
+REGSAM bitness_sam_impl();
+
+template <>
+REGSAM bitness_sam_impl<4>() {
+ return KEY_WOW64_64KEY;
+}
+
+template <>
+REGSAM bitness_sam_impl<8>() {
+ return KEY_WOW64_32KEY;
+}
+
+REGSAM _get_bitness_sam() {
+ return bitness_sam_impl<sizeof(size_t)>();
+}
+
+LONG _RegOpenKey(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult) {
+
+ LONG res = RegOpenKeyExW(hKey, lpSubKey, 0, KEY_READ, phkResult);
+
+ if (res != ERROR_SUCCESS)
+ res = RegOpenKeyExW(hKey, lpSubKey, 0, KEY_READ | _get_bitness_sam(), phkResult);
+
+ return res;
+}
+
+LONG _RegKeyQueryString(HKEY hKey, const String &p_value_name, String &r_value) {
+
+ Vector<WCHAR> buffer;
+ buffer.resize(512);
+ DWORD dwBufferSize = buffer.size();
+
+ LONG res = RegQueryValueExW(hKey, p_value_name.c_str(), 0, NULL, (LPBYTE)buffer.ptr(), &dwBufferSize);
+
+ if (res == ERROR_MORE_DATA) {
+ // dwBufferSize now contains the actual size
+ Vector<WCHAR> buffer;
+ buffer.resize(dwBufferSize);
+ res = RegQueryValueExW(hKey, p_value_name.c_str(), 0, NULL, (LPBYTE)buffer.ptr(), &dwBufferSize);
+ }
+
+ if (res == ERROR_SUCCESS) {
+ r_value = String(buffer.ptr(), buffer.size());
+ } else {
+ r_value = String();
+ }
+
+ return res;
+}
+
+LONG _find_mono_in_reg(const String &p_subkey, MonoRegInfo &r_info, bool p_old_reg = false) {
+
+ HKEY hKey;
+ LONG res = _RegOpenKey(HKEY_LOCAL_MACHINE, p_subkey.c_str(), &hKey);
+
+ if (res != ERROR_SUCCESS)
+ goto cleanup;
+
+ if (!p_old_reg) {
+ res = _RegKeyQueryString(hKey, "Version", r_info.version);
+ if (res != ERROR_SUCCESS)
+ goto cleanup;
+ }
+
+ res = _RegKeyQueryString(hKey, "SdkInstallRoot", r_info.install_root_dir);
+ if (res != ERROR_SUCCESS)
+ goto cleanup;
+
+ res = _RegKeyQueryString(hKey, "FrameworkAssemblyDirectory", r_info.assembly_dir);
+ if (res != ERROR_SUCCESS)
+ goto cleanup;
+
+ res = _RegKeyQueryString(hKey, "MonoConfigDir", r_info.config_dir);
+ if (res != ERROR_SUCCESS)
+ goto cleanup;
+
+ if (r_info.install_root_dir.ends_with("\\"))
+ r_info.bin_dir = r_info.install_root_dir + "bin";
+ else
+ r_info.bin_dir = r_info.install_root_dir + "\\bin";
+
+cleanup:
+ RegCloseKey(hKey);
+ return res;
+}
+
+LONG _find_mono_in_reg_old(const String &p_subkey, MonoRegInfo &r_info) {
+
+ String default_clr;
+
+ HKEY hKey;
+ LONG res = _RegOpenKey(HKEY_LOCAL_MACHINE, p_subkey.c_str(), &hKey);
+
+ if (res != ERROR_SUCCESS)
+ goto cleanup;
+
+ res = _RegKeyQueryString(hKey, "DefaultCLR", default_clr);
+
+ if (res == ERROR_SUCCESS && default_clr.length()) {
+ r_info.version = default_clr;
+ res = _find_mono_in_reg(p_subkey + "\\" + default_clr, r_info, true);
+ }
+
+cleanup:
+ RegCloseKey(hKey);
+ return res;
+}
+
+MonoRegInfo find_mono() {
+
+ MonoRegInfo info;
+
+ if (_find_mono_in_reg("Software\\Mono", info) == ERROR_SUCCESS)
+ return info;
+
+ if (_find_mono_in_reg_old("Software\\Novell\\Mono", info) == ERROR_SUCCESS)
+ return info;
+
+ ERR_PRINT("Cannot find mono in the registry");
+
+ return MonoRegInfo();
+}
+
+String find_msbuild_tools_path() {
+
+ String msbuild_tools_path;
+
+ // Try to find 15.0 with vswhere
+
+ String vswhere_path = OS::get_singleton()->get_environment(sizeof(size_t) == 8 ? "ProgramFiles(x86)" : "ProgramFiles");
+ vswhere_path += "\\Microsoft Visual Studio\\Installer\\vswhere.exe";
+
+ List<String> vswhere_args;
+ vswhere_args.push_back("-latest");
+ vswhere_args.push_back("-requires");
+ vswhere_args.push_back("Microsoft.Component.MSBuild");
+
+ String output;
+ int exit_code;
+ OS::get_singleton()->execute(vswhere_path, vswhere_args, true, NULL, &output, &exit_code);
+
+ if (exit_code == 0) {
+ Vector<String> lines = output.split("\n");
+
+ for (int i = 0; i < lines.size(); i++) {
+ const String &line = lines[i];
+ int sep_idx = line.find(":");
+
+ if (sep_idx > 0) {
+ String key = line.substr(0, sep_idx); // No need to trim
+
+ if (key == "installationPath") {
+ String val = line.substr(sep_idx + 1, line.length()).strip_edges();
+
+ ERR_BREAK(val.empty());
+
+ if (!val.ends_with("\\")) {
+ val += "\\";
+ }
+
+ return val + "MSBuild\\15.0\\Bin";
+ }
+ }
+ }
+ }
+
+ // Try to find 14.0 in the Registry
+
+ HKEY hKey;
+ LONG res = _RegOpenKey(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\14.0", &hKey);
+
+ if (res != ERROR_SUCCESS)
+ goto cleanup;
+
+ res = _RegKeyQueryString(hKey, "MSBuildToolsPath", msbuild_tools_path);
+
+ if (res != ERROR_SUCCESS)
+ goto cleanup;
+
+cleanup:
+ RegCloseKey(hKey);
+
+ return msbuild_tools_path;
+}
+} // namespace MonoRegUtils
+
+#endif WINDOWS_ENABLED
diff --git a/modules/mono/utils/mono_reg_utils.h b/modules/mono/utils/mono_reg_utils.h
new file mode 100644
index 0000000000..4cc4965acb
--- /dev/null
+++ b/modules/mono/utils/mono_reg_utils.h
@@ -0,0 +1,54 @@
+/*************************************************************************/
+/* mono_reg_utils.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef MONO_REG_UTILS_H
+#define MONO_REG_UTILS_H
+
+#ifdef WINDOWS_ENABLED
+
+#include "ustring.h"
+
+struct MonoRegInfo {
+
+ String version;
+ String install_root_dir;
+ String assembly_dir;
+ String config_dir;
+ String bin_dir;
+};
+
+namespace MonoRegUtils {
+
+MonoRegInfo find_mono();
+String find_msbuild_tools_path();
+} // MonoRegUtils
+
+#endif // WINDOWS_ENABLED
+
+#endif // MONO_REG_UTILS_H
diff --git a/modules/mono/utils/path_utils.cpp b/modules/mono/utils/path_utils.cpp
new file mode 100644
index 0000000000..c8581f6122
--- /dev/null
+++ b/modules/mono/utils/path_utils.cpp
@@ -0,0 +1,111 @@
+/*************************************************************************/
+/* path_utils.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "path_utils.h"
+
+#include "os/dir_access.h"
+#include "os/file_access.h"
+#include "os/os.h"
+#include "project_settings.h"
+
+#ifdef WINDOWS_ENABLED
+#define ENV_PATH_SEP ";"
+#else
+#define ENV_PATH_SEP ":"
+#include <limits.h>
+#endif
+
+#include <stdlib.h>
+
+String path_which(const String &p_name) {
+
+#ifdef WINDOWS_ENABLED
+ Vector<String> exts = OS::get_singleton()->get_environment("PATHEXT").split(ENV_PATH_SEP, false);
+#endif
+ Vector<String> env_path = OS::get_singleton()->get_environment("PATH").split(ENV_PATH_SEP, false);
+
+ if (env_path.empty())
+ return String();
+
+ for (int i = 0; i < env_path.size(); i++) {
+ String p = path_join(env_path[i], p_name);
+
+ if (FileAccess::exists(p))
+ return p;
+
+#ifdef WINDOWS_ENABLED
+ for (int j = 0; j < exts.size(); j++) {
+ String p2 = p + exts[j];
+
+ if (FileAccess::exists(p2))
+ return p2;
+ }
+#endif
+ }
+
+ return String();
+}
+
+void fix_path(const String &p_path, String &r_out) {
+ r_out = p_path.replace("\\", "/");
+
+ while (true) { // in case of using 2 or more slash
+ String compare = r_out.replace("//", "/");
+ if (r_out == compare)
+ break;
+ else
+ r_out = compare;
+ }
+}
+
+bool rel_path_to_abs(const String &p_existing_path, String &r_abs_path) {
+#ifdef WINDOWS_ENABLED
+ CharType ret[_MAX_PATH];
+ if (_wfullpath(ret, p_existing_path.c_str(), _MAX_PATH)) {
+ String abspath = String(ret).replace("\\", "/");
+ int pos = abspath.find(":/");
+ if (pos != -1) {
+ r_abs_path = abspath.substr(pos - 1, abspath.length());
+ } else {
+ r_abs_path = abspath;
+ }
+ return true;
+ }
+#else
+ char ret[PATH_MAX];
+ if (realpath(p_existing_path.utf8().get_data(), ret)) {
+ String retstr;
+ if (!retstr.parse_utf8(ret)) {
+ r_abs_path = retstr;
+ return true;
+ }
+ }
+#endif
+ return false;
+}
diff --git a/modules/mono/utils/path_utils.h b/modules/mono/utils/path_utils.h
new file mode 100644
index 0000000000..445604300d
--- /dev/null
+++ b/modules/mono/utils/path_utils.h
@@ -0,0 +1,53 @@
+/*************************************************************************/
+/* path_utils.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef PATH_UTILS_H
+#define PATH_UTILS_H
+
+#include "ustring.h"
+
+_FORCE_INLINE_ String path_join(const String &e1, const String &e2) {
+ return e1.plus_file(e2);
+}
+
+_FORCE_INLINE_ String path_join(const String &e1, const String &e2, const String &e3) {
+ return e1.plus_file(e2).plus_file(e3);
+}
+
+_FORCE_INLINE_ String path_join(const String &e1, const String &e2, const String &e3, const String &e4) {
+ return e1.plus_file(e2).plus_file(e3).plus_file(e4);
+}
+
+String path_which(const String &p_name);
+
+void fix_path(const String &p_path, String &r_out);
+
+bool rel_path_to_abs(const String &p_existing_path, String &r_abs_path);
+
+#endif // PATH_UTILS_H
diff --git a/modules/mono/utils/string_utils.cpp b/modules/mono/utils/string_utils.cpp
new file mode 100644
index 0000000000..de1a60dbd1
--- /dev/null
+++ b/modules/mono/utils/string_utils.cpp
@@ -0,0 +1,128 @@
+/*************************************************************************/
+/* string_utils.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "string_utils.h"
+
+namespace {
+
+int sfind(const String &p_text, int p_from) {
+ if (p_from < 0)
+ return -1;
+
+ int src_len = 2;
+ int len = p_text.length();
+
+ if (src_len == 0 || len == 0)
+ return -1;
+
+ const CharType *src = p_text.c_str();
+
+ for (int i = p_from; i <= (len - src_len); i++) {
+ bool found = true;
+
+ for (int j = 0; j < src_len; j++) {
+ int read_pos = i + j;
+
+ if (read_pos >= len) {
+ ERR_PRINT("read_pos >= len");
+ return -1;
+ };
+
+ switch (j) {
+ case 0:
+ found = src[read_pos] == '%';
+ break;
+ case 1: {
+ CharType c = src[read_pos];
+ found = src[read_pos] == 's' || (c >= '0' || c <= '4');
+ break;
+ }
+ default:
+ found = false;
+ }
+
+ if (!found) {
+ break;
+ }
+ }
+
+ if (found)
+ return i;
+ }
+
+ return -1;
+}
+}
+
+String sformat(const String &p_text, const Variant &p1, const Variant &p2, const Variant &p3, const Variant &p4, const Variant &p5) {
+ if (p_text.length() < 2)
+ return p_text;
+
+ Array args;
+
+ if (p1.get_type() != Variant::NIL) {
+ args.push_back(p1);
+
+ if (p2.get_type() != Variant::NIL) {
+ args.push_back(p2);
+
+ if (p3.get_type() != Variant::NIL) {
+ args.push_back(p3);
+
+ if (p4.get_type() != Variant::NIL) {
+ args.push_back(p4);
+
+ if (p5.get_type() != Variant::NIL) {
+ args.push_back(p5);
+ }
+ }
+ }
+ }
+ }
+
+ String new_string;
+
+ int findex = 0;
+ int search_from = 0;
+ int result = 0;
+
+ while ((result = sfind(p_text, search_from)) >= 0) {
+ CharType c = p_text[result + 1];
+
+ int req_index = (c == 's' ? findex++ : c - '0');
+
+ new_string += p_text.substr(search_from, result - search_from);
+ new_string += args[req_index].operator String();
+ search_from = result + 2;
+ }
+
+ new_string += p_text.substr(search_from, p_text.length() - search_from);
+
+ return new_string;
+}
diff --git a/modules/mono/utils/string_utils.h b/modules/mono/utils/string_utils.h
new file mode 100644
index 0000000000..2f2c3c2d89
--- /dev/null
+++ b/modules/mono/utils/string_utils.h
@@ -0,0 +1,38 @@
+/*************************************************************************/
+/* string_utils.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef STRING_FORMAT_H
+#define STRING_FORMAT_H
+
+#include "ustring.h"
+#include "variant.h"
+
+String sformat(const String &p_text, const Variant &p1 = Variant(), const Variant &p2 = Variant(), const Variant &p3 = Variant(), const Variant &p4 = Variant(), const Variant &p5 = Variant());
+
+#endif // STRING_FORMAT_H
diff --git a/modules/ogg/SCsub b/modules/ogg/SCsub
index 5eabaf6f2b..5e559bd4db 100644
--- a/modules/ogg/SCsub
+++ b/modules/ogg/SCsub
@@ -6,7 +6,7 @@ Import('env_modules')
env_ogg = env_modules.Clone()
# Thirdparty source files
-if (env['builtin_libogg'] != 'no'):
+if env['builtin_libogg']:
thirdparty_dir = "#thirdparty/libogg/"
thirdparty_sources = [
"bitwise.c",
diff --git a/modules/openssl/SCsub b/modules/openssl/SCsub
index eb3c0e64d8..84c5e68439 100644
--- a/modules/openssl/SCsub
+++ b/modules/openssl/SCsub
@@ -6,7 +6,7 @@ Import('env_modules')
env_openssl = env_modules.Clone()
# Thirdparty source files
-if (env['builtin_openssl'] != 'no'):
+if env['builtin_openssl']:
thirdparty_dir = "#thirdparty/openssl/"
thirdparty_sources = [
diff --git a/modules/openssl/stream_peer_openssl.cpp b/modules/openssl/stream_peer_openssl.cpp
index d40bf73883..c19bdc4214 100644
--- a/modules/openssl/stream_peer_openssl.cpp
+++ b/modules/openssl/stream_peer_openssl.cpp
@@ -29,6 +29,17 @@
/*************************************************************************/
#include "stream_peer_openssl.h"
+// Compatibility with OpenSSL 1.1.0.
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+#define BIO_set_num(b, n)
+#else
+#define BIO_set_num(b, n) ((b)->num = (n))
+
+#define BIO_set_init(b, i) ((b)->init = (i))
+#define BIO_set_data(b, p) ((b)->ptr = (p))
+#define BIO_get_data(b) ((b)->ptr)
+#endif
+
//hostname matching code from curl
bool StreamPeerOpenSSL::_match_host_name(const char *name, const char *hostname) {
@@ -157,10 +168,10 @@ int StreamPeerOpenSSL::_cert_verify_callback(X509_STORE_CTX *x509_ctx, void *arg
}
int StreamPeerOpenSSL::_bio_create(BIO *b) {
- b->init = 1;
- b->num = 0;
- b->ptr = NULL;
- b->flags = 0;
+ BIO_set_init(b, 1);
+ BIO_set_num(b, 0);
+ BIO_set_data(b, NULL);
+ BIO_clear_flags(b, ~0);
return 1;
}
@@ -168,9 +179,9 @@ int StreamPeerOpenSSL::_bio_destroy(BIO *b) {
if (b == NULL)
return 0;
- b->ptr = NULL; /* sb_tls_remove() will free it */
- b->init = 0;
- b->flags = 0;
+ BIO_set_data(b, NULL); /* sb_tls_remove() will free it */
+ BIO_set_init(b, 0);
+ BIO_clear_flags(b, ~0);
return 1;
}
@@ -178,7 +189,7 @@ int StreamPeerOpenSSL::_bio_read(BIO *b, char *buf, int len) {
if (buf == NULL || len <= 0) return 0;
- StreamPeerOpenSSL *sp = (StreamPeerOpenSSL *)b->ptr;
+ StreamPeerOpenSSL *sp = (StreamPeerOpenSSL *)BIO_get_data(b);
ERR_FAIL_COND_V(sp == NULL, 0);
@@ -212,7 +223,7 @@ int StreamPeerOpenSSL::_bio_write(BIO *b, const char *buf, int len) {
if (buf == NULL || len <= 0) return 0;
- StreamPeerOpenSSL *sp = (StreamPeerOpenSSL *)b->ptr;
+ StreamPeerOpenSSL *sp = (StreamPeerOpenSSL *)BIO_get_data(b);
ERR_FAIL_COND_V(sp == NULL, 0);
@@ -258,6 +269,26 @@ int StreamPeerOpenSSL::_bio_puts(BIO *b, const char *str) {
return _bio_write(b, str, strlen(str));
}
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+BIO_METHOD *StreamPeerOpenSSL::_bio_method = NULL;
+
+BIO_METHOD *StreamPeerOpenSSL::_get_bio_method() {
+ if (_bio_method) // already initialized.
+ return _bio_method;
+
+ /* it's a source/sink BIO */
+ _bio_method = BIO_meth_new(100 | 0x400, "streampeer glue");
+ BIO_meth_set_write(_bio_method, _bio_write);
+ BIO_meth_set_read(_bio_method, _bio_read);
+ BIO_meth_set_puts(_bio_method, _bio_puts);
+ BIO_meth_set_gets(_bio_method, _bio_gets);
+ BIO_meth_set_ctrl(_bio_method, _bio_ctrl);
+ BIO_meth_set_create(_bio_method, _bio_create);
+ BIO_meth_set_destroy(_bio_method, _bio_destroy);
+
+ return _bio_method;
+}
+#else
BIO_METHOD StreamPeerOpenSSL::_bio_method = {
/* it's a source/sink BIO */
(100 | 0x400),
@@ -271,6 +302,11 @@ BIO_METHOD StreamPeerOpenSSL::_bio_method = {
_bio_destroy
};
+BIO_METHOD *StreamPeerOpenSSL::_get_bio_method() {
+ return &_bio_method;
+}
+#endif
+
Error StreamPeerOpenSSL::connect_to_stream(Ref<StreamPeer> p_base, bool p_validate_certs, const String &p_for_hostname) {
if (connected)
@@ -330,8 +366,8 @@ Error StreamPeerOpenSSL::connect_to_stream(Ref<StreamPeer> p_base, bool p_valida
}
ssl = SSL_new(ctx);
- bio = BIO_new(&_bio_method);
- bio->ptr = this;
+ bio = BIO_new(_get_bio_method());
+ BIO_set_data(bio, this);
SSL_set_bio(ssl, bio, bio);
if (p_for_hostname != String()) {
@@ -532,7 +568,9 @@ void StreamPeerOpenSSL::initialize_ssl() {
load_certs_func = _load_certs;
_create = _create_func;
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
CRYPTO_malloc_init(); // Initialize malloc, free, etc for OpenSSL's use
+#endif
SSL_library_init(); // Initialize OpenSSL's SSL libraries
SSL_load_error_strings(); // Load SSL error strings
ERR_load_BIO_strings(); // Load BIO error strings
diff --git a/modules/openssl/stream_peer_openssl.h b/modules/openssl/stream_peer_openssl.h
index 1e445ef681..535114058d 100644
--- a/modules/openssl/stream_peer_openssl.h
+++ b/modules/openssl/stream_peer_openssl.h
@@ -53,7 +53,12 @@ private:
static int _bio_gets(BIO *b, char *buf, int len);
static int _bio_puts(BIO *b, const char *str);
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+ static BIO_METHOD *_bio_method;
+#else
static BIO_METHOD _bio_method;
+#endif
+ static BIO_METHOD *_get_bio_method();
static bool _match_host_name(const char *name, const char *hostname);
static Error _match_common_name(const char *hostname, const X509 *server_cert);
diff --git a/modules/opus/SCsub b/modules/opus/SCsub
index 4d3053c7ec..fee06bd267 100644
--- a/modules/opus/SCsub
+++ b/modules/opus/SCsub
@@ -6,7 +6,7 @@ Import('env_modules')
env_opus = env_modules.Clone()
# Thirdparty source files
-if (env['builtin_opus'] != 'no'):
+if env['builtin_opus']:
thirdparty_dir = "#thirdparty/opus/"
thirdparty_sources = [
@@ -209,7 +209,7 @@ if (env['builtin_opus'] != 'no'):
env_opus.Append(CPPPATH=[thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
# also requires libogg
- if (env['builtin_libogg'] != 'no'):
+ if env['builtin_libogg']:
env_opus.Append(CPPPATH=["#thirdparty/libogg"])
# Module files
diff --git a/modules/opus/audio_stream_opus.cpp b/modules/opus/audio_stream_opus.cpp
index 995f4ddcc6..c7748b9b21 100644
--- a/modules/opus/audio_stream_opus.cpp
+++ b/modules/opus/audio_stream_opus.cpp
@@ -247,7 +247,7 @@ void AudioStreamPlaybackOpus::play(float p_from) {
frames_mixed = pre_skip;
playing = true;
if (p_from > 0) {
- seek_pos(p_from);
+ seek(p_from);
}
}
@@ -256,7 +256,7 @@ void AudioStreamPlaybackOpus::stop() {
playing = false;
}
-void AudioStreamPlaybackOpus::seek_pos(float p_time) {
+void AudioStreamPlaybackOpus::seek(float p_time) {
if (!playing) return;
ogg_int64_t pcm_offset = (ogg_int64_t)(p_time * osrate);
bool ok = op_pcm_seek(opus_file, pcm_offset) == 0;
@@ -340,7 +340,7 @@ float AudioStreamPlaybackOpus::get_length() const {
return length;
}
-float AudioStreamPlaybackOpus::get_position() const {
+float AudioStreamPlaybackOpus::get_playback_position() const {
int32_t frames = int32_t(frames_mixed);
if (frames < 0)
diff --git a/modules/opus/audio_stream_opus.h b/modules/opus/audio_stream_opus.h
index c7a053acd3..7b7740a804 100644
--- a/modules/opus/audio_stream_opus.h
+++ b/modules/opus/audio_stream_opus.h
@@ -99,8 +99,8 @@ public:
virtual int get_loop_count() const { return repeats; }
- virtual float get_position() const;
- virtual void seek_pos(float p_time);
+ virtual float get_playback_position() const;
+ virtual void seek(float p_time);
virtual int get_channels() const { return stream_channels; }
virtual int get_mix_rate() const { return osrate; }
diff --git a/modules/recast/SCsub b/modules/recast/SCsub
index 349bd22efb..500c0ec055 100644
--- a/modules/recast/SCsub
+++ b/modules/recast/SCsub
@@ -5,7 +5,7 @@ Import('env')
# Not building in a separate env as core needs it
# Thirdparty source files
-if (env['builtin_recast'] != 'no'):
+if env['builtin_recast']:
thirdparty_dir = "#thirdparty/recastnavigation/Recast/"
thirdparty_sources = [
"Source/Recast.cpp",
@@ -24,10 +24,6 @@ if (env['builtin_recast'] != 'no'):
env.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "/Include"])
- # also requires recast headers
- if (env['builtin_recast'] != 'no'):
- env.Append(CPPPATH=["#thirdparty/recastnavigation/Recast"])
-
lib = env.Library("recast_builtin", thirdparty_sources)
env.Append(LIBS=[lib])
diff --git a/modules/regex/SCsub b/modules/regex/SCsub
index 2dfc2739e9..2bab144a28 100644
--- a/modules/regex/SCsub
+++ b/modules/regex/SCsub
@@ -7,7 +7,7 @@ env_regex = env_modules.Clone()
env_regex.Append(CPPFLAGS=["-DPCRE2_CODE_UNIT_WIDTH=0"])
env_regex.add_source_files(env.modules_sources, "*.cpp")
-if (env['builtin_pcre2'] != 'no'):
+if env['builtin_pcre2']:
jit_blacklist = ['javascript']
thirdparty_dir = '#thirdparty/pcre2/src/'
thirdparty_flags = ['-DPCRE2_STATIC', '-DHAVE_CONFIG_H']
diff --git a/modules/squish/SCsub b/modules/squish/SCsub
index cca7c038f1..127f22d798 100644
--- a/modules/squish/SCsub
+++ b/modules/squish/SCsub
@@ -6,7 +6,7 @@ Import('env_modules')
env_squish = env_modules.Clone()
# Thirdparty source files
-if (env['builtin_squish'] != 'no'):
+if env['builtin_squish']:
thirdparty_dir = "#thirdparty/squish/"
thirdparty_sources = [
"alpha.cpp",
diff --git a/modules/squish/config.py b/modules/squish/config.py
index cc8f098010..9b7729bda4 100644
--- a/modules/squish/config.py
+++ b/modules/squish/config.py
@@ -6,6 +6,6 @@ def can_build(platform):
def configure(env):
# Tools only, disabled for non-tools
# TODO: Find a cleaner way to achieve that
- if (env["tools"] == "no"):
- env["module_squish_enabled"] = "no"
+ if not env['tools']:
+ env['module_squish_enabled'] = False
env.disabled_modules.append("squish")
diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
index a3206187c0..27ea310780 100644
--- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
+++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
@@ -58,7 +58,7 @@ void AudioStreamPlaybackOGGVorbis::_mix_internal(AudioFrame *p_buffer, int p_fra
//end of file!
if (vorbis_stream->loop) {
//loop
- seek_pos(vorbis_stream->loop_offset);
+ seek(vorbis_stream->loop_offset);
loops++;
} else {
for (int i = mixed; i < p_frames; i++) {
@@ -78,7 +78,7 @@ float AudioStreamPlaybackOGGVorbis::get_stream_sampling_rate() {
void AudioStreamPlaybackOGGVorbis::start(float p_from_pos) {
active = true;
- seek_pos(p_from_pos);
+ seek(p_from_pos);
loops = 0;
_begin_resample();
}
@@ -97,11 +97,11 @@ int AudioStreamPlaybackOGGVorbis::get_loop_count() const {
return loops;
}
-float AudioStreamPlaybackOGGVorbis::get_position() const {
+float AudioStreamPlaybackOGGVorbis::get_playback_position() const {
return float(frames_mixed) / vorbis_stream->sample_rate;
}
-void AudioStreamPlaybackOGGVorbis::seek_pos(float p_time) {
+void AudioStreamPlaybackOGGVorbis::seek(float p_time) {
if (!active)
return;
diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.h b/modules/stb_vorbis/audio_stream_ogg_vorbis.h
index c38402fb3a..f4d381897b 100644
--- a/modules/stb_vorbis/audio_stream_ogg_vorbis.h
+++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.h
@@ -67,8 +67,8 @@ public:
virtual int get_loop_count() const; //times it looped
- virtual float get_position() const;
- virtual void seek_pos(float p_time);
+ virtual float get_playback_position() const;
+ virtual void seek(float p_time);
virtual float get_length() const; //if supported, otherwise return 0
diff --git a/modules/svg/image_loader_svg.cpp b/modules/svg/image_loader_svg.cpp
index e27452354b..9c198ea98e 100644
--- a/modules/svg/image_loader_svg.cpp
+++ b/modules/svg/image_loader_svg.cpp
@@ -51,7 +51,7 @@ inline void change_nsvg_paint_color(NSVGpaint *p_paint, const uint32_t p_old, co
if (p_paint->type == NSVG_PAINT_COLOR) {
if (p_paint->color << 8 == p_old << 8) {
- p_paint->color = p_new;
+ p_paint->color = (p_paint->color & 0xFF000000) | (p_new & 0x00FFFFFF);
}
}
diff --git a/modules/theora/SCsub b/modules/theora/SCsub
index 2de4d29640..9015c2c354 100644
--- a/modules/theora/SCsub
+++ b/modules/theora/SCsub
@@ -6,7 +6,7 @@ Import('env_modules')
env_theora = env_modules.Clone()
# Thirdparty source files
-if (env['builtin_libtheora'] != 'no'):
+if env['builtin_libtheora']:
thirdparty_dir = "#thirdparty/libtheora/"
thirdparty_sources = [
#"analyze.c",
@@ -74,9 +74,9 @@ if (env['builtin_libtheora'] != 'no'):
env_theora.Append(CPPPATH=[thirdparty_dir])
# also requires libogg and libvorbis
- if (env['builtin_libogg'] != 'no'):
+ if env['builtin_libogg']:
env_theora.Append(CPPPATH=["#thirdparty/libogg"])
- if (env['builtin_libvorbis'] != 'no'):
+ if env['builtin_libvorbis']:
env_theora.Append(CPPPATH=["#thirdparty/libvorbis"])
# Godot source files
diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp
index 603c31195d..c75bec31df 100644
--- a/modules/theora/video_stream_theora.cpp
+++ b/modules/theora/video_stream_theora.cpp
@@ -634,12 +634,12 @@ int VideoStreamPlaybackTheora::get_loop_count() const {
return 0;
};
-float VideoStreamPlaybackTheora::get_position() const {
+float VideoStreamPlaybackTheora::get_playback_position() const {
return get_time();
};
-void VideoStreamPlaybackTheora::seek_pos(float p_time){
+void VideoStreamPlaybackTheora::seek(float p_time){
// no
};
diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h
index aeb5fa3511..484a1a7fb9 100644
--- a/modules/theora/video_stream_theora.h
+++ b/modules/theora/video_stream_theora.h
@@ -140,8 +140,8 @@ public:
virtual int get_loop_count() const;
- virtual float get_position() const;
- virtual void seek_pos(float p_time);
+ virtual float get_playback_position() const;
+ virtual void seek(float p_time);
void set_file(const String &p_file);
diff --git a/modules/tinyexr/config.py b/modules/tinyexr/config.py
index 2e4b96a6b0..3e16fd725e 100644
--- a/modules/tinyexr/config.py
+++ b/modules/tinyexr/config.py
@@ -6,6 +6,6 @@ def can_build(platform):
def configure(env):
# Tools only, disabled for non-tools
# TODO: Find a cleaner way to achieve that
- if (env["tools"] == "no"):
- env["module_tinyexr_enabled"] = "no"
+ if not env['tools']:
+ env['module_tinyexr_enabled'] = False
env.disabled_modules.append("tinyexr")
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index c665fa12cf..48145495e4 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -125,6 +125,7 @@ void VisualScriptNode::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_visual_script"), &VisualScriptNode::get_visual_script);
ClassDB::bind_method(D_METHOD("set_default_input_value", "port_idx", "value"), &VisualScriptNode::set_default_input_value);
ClassDB::bind_method(D_METHOD("get_default_input_value", "port_idx"), &VisualScriptNode::get_default_input_value);
+ ClassDB::bind_method(D_METHOD("ports_changed_notify"), &VisualScriptNode::ports_changed_notify);
ClassDB::bind_method(D_METHOD("_set_default_input_values", "values"), &VisualScriptNode::_set_default_input_values);
ClassDB::bind_method(D_METHOD("_get_default_input_values"), &VisualScriptNode::_get_default_input_values);
@@ -2008,8 +2009,8 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
Node *node = Object::cast_to<Node>(p_owner);
if (p_script->functions.has("_process"))
node->set_process(true);
- if (p_script->functions.has("_fixed_process"))
- node->set_fixed_process(true);
+ if (p_script->functions.has("_physics_process"))
+ node->set_physics_process(true);
if (p_script->functions.has("_input"))
node->set_process_input(true);
if (p_script->functions.has("_unhandled_input"))
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index d0ab29f184..47ef0182dc 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -331,44 +331,83 @@ public:
VisualScriptEditorVariableEdit() { undo_redo = NULL; }
};
-static Color _color_from_type(Variant::Type p_type) {
+static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) {
Color color;
- switch (p_type) {
- case Variant::NIL: color = Color::html("69ecbd"); break;
-
- case Variant::BOOL: color = Color::html("8da6f0"); break;
- case Variant::INT: color = Color::html("7dc6ef"); break;
- case Variant::REAL: color = Color::html("61daf4"); break;
- case Variant::STRING: color = Color::html("6ba7ec"); break;
-
- case Variant::VECTOR2: color = Color::html("bd91f1"); break;
- case Variant::RECT2: color = Color::html("f191a5"); break;
- case Variant::VECTOR3: color = Color::html("d67dee"); break;
- case Variant::TRANSFORM2D: color = Color::html("c4ec69"); break;
- case Variant::PLANE: color = Color::html("f77070"); break;
- case Variant::QUAT: color = Color::html("ec69a3"); break;
- case Variant::RECT3: color = Color::html("ee7991"); break;
- case Variant::BASIS: color = Color::html("e3ec69"); break;
- case Variant::TRANSFORM: color = Color::html("f6a86e"); break;
-
- case Variant::COLOR: color = Color::html("9dff70"); break;
- case Variant::NODE_PATH: color = Color::html("6993ec"); break;
- case Variant::_RID: color = Color::html("69ec9a"); break;
- case Variant::OBJECT: color = Color::html("79f3e8"); break;
- case Variant::DICTIONARY: color = Color::html("77edb1"); break;
-
- case Variant::ARRAY: color = Color::html("e0e0e0"); break;
- case Variant::POOL_BYTE_ARRAY: color = Color::html("aaf4c8"); break;
- case Variant::POOL_INT_ARRAY: color = Color::html("afdcf5"); break;
- case Variant::POOL_REAL_ARRAY: color = Color::html("97e7f8"); break;
- case Variant::POOL_STRING_ARRAY: color = Color::html("9dc4f2"); break;
- case Variant::POOL_VECTOR2_ARRAY: color = Color::html("d1b3f5"); break;
- case Variant::POOL_VECTOR3_ARRAY: color = Color::html("df9bf2"); break;
- case Variant::POOL_COLOR_ARRAY: color = Color::html("e9ff97"); break;
-
- default:
- color.set_hsv(p_type / float(Variant::VARIANT_MAX), 0.7, 0.7);
- }
+ if (dark_theme)
+ switch (p_type) {
+ case Variant::NIL: color = Color::html("#69ecbd"); break;
+
+ case Variant::BOOL: color = Color::html("#8da6f0"); break;
+ case Variant::INT: color = Color::html("#7dc6ef"); break;
+ case Variant::REAL: color = Color::html("#61daf4"); break;
+ case Variant::STRING: color = Color::html("#6ba7ec"); break;
+
+ case Variant::VECTOR2: color = Color::html("#bd91f1"); break;
+ case Variant::RECT2: color = Color::html("#f191a5"); break;
+ case Variant::VECTOR3: color = Color::html("#d67dee"); break;
+ case Variant::TRANSFORM2D: color = Color::html("#c4ec69"); break;
+ case Variant::PLANE: color = Color::html("#f77070"); break;
+ case Variant::QUAT: color = Color::html("#ec69a3"); break;
+ case Variant::RECT3: color = Color::html("#ee7991"); break;
+ case Variant::BASIS: color = Color::html("#e3ec69"); break;
+ case Variant::TRANSFORM: color = Color::html("#f6a86e"); break;
+
+ case Variant::COLOR: color = Color::html("#9dff70"); break;
+ case Variant::NODE_PATH: color = Color::html("#6993ec"); break;
+ case Variant::_RID: color = Color::html("#69ec9a"); break;
+ case Variant::OBJECT: color = Color::html("#79f3e8"); break;
+ case Variant::DICTIONARY: color = Color::html("#77edb1"); break;
+
+ case Variant::ARRAY: color = Color::html("#e0e0e0"); break;
+ case Variant::POOL_BYTE_ARRAY: color = Color::html("#aaf4c8"); break;
+ case Variant::POOL_INT_ARRAY: color = Color::html("#afdcf5"); break;
+ case Variant::POOL_REAL_ARRAY: color = Color::html("#97e7f8"); break;
+ case Variant::POOL_STRING_ARRAY: color = Color::html("#9dc4f2"); break;
+ case Variant::POOL_VECTOR2_ARRAY: color = Color::html("#d1b3f5"); break;
+ case Variant::POOL_VECTOR3_ARRAY: color = Color::html("#df9bf2"); break;
+ case Variant::POOL_COLOR_ARRAY: color = Color::html("#e9ff97"); break;
+
+ default:
+ color.set_hsv(p_type / float(Variant::VARIANT_MAX), 0.7, 0.7);
+ }
+ else
+ switch (p_type) {
+ case Variant::NIL: color = Color::html("#25e3a0"); break;
+
+ case Variant::BOOL: color = Color::html("#6d8eeb"); break;
+ case Variant::INT: color = Color::html("#4fb2e9"); break;
+ case Variant::REAL: color = Color::html("#27ccf0"); break;
+ case Variant::STRING: color = Color::html("#4690e7"); break;
+
+ case Variant::VECTOR2: color = Color::html("#ad76ee"); break;
+ case Variant::RECT2: color = Color::html("#ee758e"); break;
+ case Variant::VECTOR3: color = Color::html("#dc6aed"); break;
+ case Variant::TRANSFORM2D: color = Color::html("#96ce1a"); break;
+ case Variant::PLANE: color = Color::html("#f77070"); break;
+ case Variant::QUAT: color = Color::html("#ec69a3"); break;
+ case Variant::RECT3: color = Color::html("#ee7991"); break;
+ case Variant::BASIS: color = Color::html("#b2bb19"); break;
+ case Variant::TRANSFORM: color = Color::html("#f49047"); break;
+
+ case Variant::COLOR: color = Color::html("#3cbf00"); break;
+ case Variant::NODE_PATH: color = Color::html("#6993ec"); break;
+ case Variant::_RID: color = Color::html("#2ce573"); break;
+ case Variant::OBJECT: color = Color::html("#12d5c3"); break;
+ case Variant::DICTIONARY: color = Color::html("#57e99f"); break;
+
+ case Variant::ARRAY: color = Color::html("#737373"); break;
+ case Variant::POOL_BYTE_ARRAY: color = Color::html("#61ea98"); break;
+ case Variant::POOL_INT_ARRAY: color = Color::html("#61baeb"); break;
+ case Variant::POOL_REAL_ARRAY: color = Color::html("#40d3f2"); break;
+ case Variant::POOL_STRING_ARRAY: color = Color::html("#609fea"); break;
+ case Variant::POOL_VECTOR2_ARRAY: color = Color::html("#9d5dea"); break;
+ case Variant::POOL_VECTOR3_ARRAY: color = Color::html("#ca5aea"); break;
+ case Variant::POOL_COLOR_ARRAY: color = Color::html("#92ba00"); break;
+
+ default:
+ color.set_hsv(p_type / float(Variant::VARIANT_MAX), 0.3, 0.3);
+ }
+
return color;
}
@@ -531,7 +570,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
Color c = sbf->get_border_color(MARGIN_TOP);
c.a = 1;
if (EditorSettings::get_singleton()->get("interface/theme/use_graph_node_headers")) {
- Color mono_color = ((c.r + c.g + c.b) / 3) < 0.5 ? Color(1.0, 1.0, 1.0) : Color(0, 0, 0);
+ Color mono_color = ((c.r + c.g + c.b) / 3) < 0.7 ? Color(1.0, 1.0, 1.0) : Color(0.0, 0.0, 0.0);
mono_color.a = 0.85;
c = mono_color;
}
@@ -542,10 +581,12 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
gnode->add_style_override("frame", sbf);
}
+ const Color mono_color = get_color("mono_color", "Editor");
+
int slot_idx = 0;
bool single_seq_output = node->get_output_sequence_port_count() == 1 && node->get_output_sequence_port_text(0) == String();
- gnode->set_slot(0, node->has_input_sequence_port(), TYPE_SEQUENCE, Color(1, 1, 1, 1), single_seq_output, TYPE_SEQUENCE, Color(1, 1, 1, 1), seq_port, seq_port);
+ gnode->set_slot(0, node->has_input_sequence_port(), TYPE_SEQUENCE, mono_color, single_seq_output, TYPE_SEQUENCE, mono_color, seq_port, seq_port);
gnode->set_offset(pos * EDSCALE);
slot_idx++;
@@ -562,7 +603,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
text2->set_text(node->get_output_sequence_port_text(i));
text2->set_align(Label::ALIGN_RIGHT);
gnode->add_child(text2);
- gnode->set_slot(slot_idx, false, 0, Color(), true, TYPE_SEQUENCE, Color(1, 1, 1, 1), seq_port, seq_port);
+ gnode->set_slot(slot_idx, false, 0, Color(), true, TYPE_SEQUENCE, mono_color, seq_port, seq_port);
slot_idx++;
}
}
@@ -677,10 +718,11 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
gnode->add_child(hbc);
+ bool dark_theme = get_constant("dark_theme", "Editor");
if (i < mixed_seq_ports) {
- gnode->set_slot(slot_idx, left_ok, left_type, _color_from_type(left_type), true, TYPE_SEQUENCE, Color(1, 1, 1, 1), Ref<Texture>(), seq_port);
+ gnode->set_slot(slot_idx, left_ok, left_type, _color_from_type(left_type, dark_theme), true, TYPE_SEQUENCE, mono_color, Ref<Texture>(), seq_port);
} else {
- gnode->set_slot(slot_idx, left_ok, left_type, _color_from_type(left_type), right_ok, right_type, _color_from_type(right_type));
+ gnode->set_slot(slot_idx, left_ok, left_type, _color_from_type(left_type, dark_theme), right_ok, right_type, _color_from_type(right_type, dark_theme));
}
slot_idx++;
@@ -710,7 +752,7 @@ void VisualScriptEditor::_update_members() {
functions->set_text(0, TTR("Functions:"));
functions->add_button(0, Control::get_icon("Override", "EditorIcons"), 1);
functions->add_button(0, Control::get_icon("Add", "EditorIcons"), 0);
- functions->set_custom_bg_color(0, Control::get_color("prop_section", "Editor"));
+ functions->set_custom_color(0, Control::get_color("mono_color", "Editor"));
List<StringName> func_names;
script->get_function_list(&func_names);
@@ -719,13 +761,7 @@ void VisualScriptEditor::_update_members() {
ti->set_text(0, E->get());
ti->set_selectable(0, true);
ti->set_editable(0, true);
- //ti->add_button(0,Control::get_icon("Edit","EditorIcons"),0); function arguments are in the node now
- //ti->add_button(0, Control::get_icon("Del", "EditorIcons"), 1);
ti->set_metadata(0, E->get());
- if (E->get() == edited_func) {
- ti->set_custom_bg_color(0, get_color("prop_category", "Editor"));
- ti->set_custom_color(0, Color(1, 1, 1, 1));
- }
if (selected == E->get())
ti->select(0);
}
@@ -734,7 +770,7 @@ void VisualScriptEditor::_update_members() {
variables->set_selectable(0, false);
variables->set_text(0, TTR("Variables:"));
variables->add_button(0, Control::get_icon("Add", "EditorIcons"));
- variables->set_custom_bg_color(0, Control::get_color("prop_section", "Editor"));
+ variables->set_custom_color(0, Control::get_color("mono_color", "Editor"));
Ref<Texture> type_icons[Variant::VARIANT_MAX] = {
Control::get_icon("MiniVariant", "EditorIcons"),
@@ -778,8 +814,6 @@ void VisualScriptEditor::_update_members() {
ti->set_selectable(0, true);
ti->set_editable(0, true);
- //ti->add_button(0, Control::get_icon("Edit", "EditorIcons"), 0);
- //ti->add_button(0, Control::get_icon("Del", "EditorIcons"), 1);
ti->set_metadata(0, E->get());
if (selected == E->get())
ti->select(0);
@@ -789,7 +823,7 @@ void VisualScriptEditor::_update_members() {
_signals->set_selectable(0, false);
_signals->set_text(0, TTR("Signals:"));
_signals->add_button(0, Control::get_icon("Add", "EditorIcons"));
- _signals->set_custom_bg_color(0, Control::get_color("prop_section", "Editor"));
+ _signals->set_custom_color(0, Control::get_color("mono_color", "Editor"));
List<StringName> signal_names;
script->get_custom_signal_list(&signal_names);
@@ -798,8 +832,6 @@ void VisualScriptEditor::_update_members() {
ti->set_text(0, E->get());
ti->set_selectable(0, true);
ti->set_editable(0, true);
- //ti->add_button(0, Control::get_icon("Edit", "EditorIcons"), 0);
- //ti->add_button(0, Control::get_icon("Del", "EditorIcons"), 1);
ti->set_metadata(0, E->get());
if (selected == E->get())
ti->select(0);
@@ -2767,18 +2799,30 @@ void VisualScriptEditor::_notification(int p_what) {
variable_editor->connect("changed", this, "_update_members");
signal_editor->connect("changed", this, "_update_members");
+ Ref<Theme> tm = EditorNode::get_singleton()->get_theme_base()->get_theme();
+
+ bool dark_theme = tm->get_constant("dark_theme", "Editor");
+
List<Pair<String, Color> > colors;
- colors.push_back(Pair<String, Color>("flow_control", Color::html("#f4f4f4")));
- colors.push_back(Pair<String, Color>("functions", Color::html("#f58581")));
- colors.push_back(Pair<String, Color>("data", Color::html("#80f6cf")));
- colors.push_back(Pair<String, Color>("operators", Color::html("#ab97df")));
- colors.push_back(Pair<String, Color>("custom", Color::html("#80bbf6")));
- colors.push_back(Pair<String, Color>("constants", Color::html("#f680b0")));
+ if (dark_theme) {
+ colors.push_back(Pair<String, Color>("flow_control", Color::html("#f4f4f4")));
+ colors.push_back(Pair<String, Color>("functions", Color::html("#f58581")));
+ colors.push_back(Pair<String, Color>("data", Color::html("#80f6cf")));
+ colors.push_back(Pair<String, Color>("operators", Color::html("#ab97df")));
+ colors.push_back(Pair<String, Color>("custom", Color::html("#80bbf6")));
+ colors.push_back(Pair<String, Color>("constants", Color::html("#f680b0")));
+ } else {
+ colors.push_back(Pair<String, Color>("flow_control", Color::html("#424242")));
+ colors.push_back(Pair<String, Color>("functions", Color::html("#f26661")));
+ colors.push_back(Pair<String, Color>("data", Color::html("#13bb83")));
+ colors.push_back(Pair<String, Color>("operators", Color::html("#8265d0")));
+ colors.push_back(Pair<String, Color>("custom", Color::html("#4ea0f2")));
+ colors.push_back(Pair<String, Color>("constants", Color::html("#f02f7d")));
+ }
for (List<Pair<String, Color> >::Element *E = colors.front(); E; E = E->next()) {
- print_line(E->get().first);
- Ref<StyleBoxFlat> sb = EditorNode::get_singleton()->get_theme_base()->get_theme()->get_stylebox("frame", "GraphNode");
- if (sb != NULL) {
+ Ref<StyleBoxFlat> sb = tm->get_stylebox("frame", "GraphNode");
+ if (!sb.is_null()) {
Ref<StyleBoxFlat> frame_style = sb->duplicate();
Color c = sb->get_border_color(MARGIN_TOP);
Color cn = E->get().second;
@@ -3267,8 +3311,7 @@ VisualScriptEditor::VisualScriptEditor() {
graph = memnew(GraphEdit);
add_child(graph);
- graph->set_area_as_parent_rect();
- graph->set_h_size_flags(SIZE_EXPAND_FILL);
+ graph->set_anchors_and_margins_preset(Control::PRESET_WIDE);
graph->connect("node_selected", this, "_node_selected");
graph->connect("_begin_node_move", this, "_begin_node_move");
graph->connect("_end_node_move", this, "_end_node_move");
diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp
index f02e797fe6..8d73de9889 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -42,7 +42,7 @@
int VisualScriptFunctionCall::get_output_sequence_port_count() const {
- if (method_cache.flags & METHOD_FLAG_CONST || call_mode == CALL_MODE_BASIC_TYPE)
+ if (method_cache.flags & METHOD_FLAG_CONST || (call_mode == CALL_MODE_BASIC_TYPE && Variant::is_method_const(basic_type, function)))
return 0;
else
return 1;
@@ -50,7 +50,7 @@ int VisualScriptFunctionCall::get_output_sequence_port_count() const {
bool VisualScriptFunctionCall::has_input_sequence_port() const {
- if (method_cache.flags & METHOD_FLAG_CONST || call_mode == CALL_MODE_BASIC_TYPE)
+ if (method_cache.flags & METHOD_FLAG_CONST || (call_mode == CALL_MODE_BASIC_TYPE && Variant::is_method_const(basic_type, function)))
return false;
else
return true;
@@ -763,7 +763,7 @@ public:
NodePath node_path;
int input_args;
bool validate;
- bool returns;
+ int returns;
VisualScriptFunctionCall::RPCCallMode rpc_mode;
StringName function;
StringName singleton;
@@ -856,7 +856,13 @@ public:
}
} else if (returns) {
if (call_mode == VisualScriptFunctionCall::CALL_MODE_INSTANCE) {
- *p_outputs[1] = v.call(function, p_inputs + 1, input_args, r_error);
+ if (returns >= 2) {
+ *p_outputs[1] = v.call(function, p_inputs + 1, input_args, r_error);
+ } else {
+ r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
+ r_error_str = "Invalid returns count for call_mode == CALL_MODE_INSTANCE";
+ return 0;
+ }
} else {
*p_outputs[0] = v.call(function, p_inputs + 1, input_args, r_error);
}
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index 16aec76e57..5a34fc3cd9 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -1109,7 +1109,7 @@ void VisualScriptConstant::_bind_methods() {
}
ADD_PROPERTY(PropertyInfo(Variant::INT, "type", PROPERTY_HINT_ENUM, argt), "set_constant_type", "get_constant_type");
- ADD_PROPERTY(PropertyInfo(Variant::NIL, "value"), "set_constant_value", "get_constant_value");
+ ADD_PROPERTY(PropertyInfo(Variant::NIL, "value", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT), "set_constant_value", "get_constant_value");
}
class VisualScriptNodeInstanceConstant : public VisualScriptNodeInstance {
@@ -1598,7 +1598,7 @@ VisualScriptNodeInstance *VisualScriptClassConstant::instance(VisualScriptInstan
void VisualScriptClassConstant::_validate_property(PropertyInfo &property) const {
- if (property.name == "constant/constant") {
+ if (property.name == "constant") {
List<String> constants;
ClassDB::get_integer_constant_list(base_type, &constants, true);
@@ -1727,7 +1727,7 @@ VisualScriptNodeInstance *VisualScriptBasicTypeConstant::instance(VisualScriptIn
void VisualScriptBasicTypeConstant::_validate_property(PropertyInfo &property) const {
- if (property.name == "constant/constant") {
+ if (property.name == "constant") {
List<StringName> constants;
Variant::get_numeric_constants_for_type(type, &constants);
@@ -2689,7 +2689,7 @@ VisualScriptNodeInstance *VisualScriptCustomNode::instance(VisualScriptInstance
}
void VisualScriptCustomNode::_script_changed() {
- ports_changed_notify();
+ call_deferred("ports_changed_notify");
}
void VisualScriptCustomNode::_bind_methods() {
diff --git a/modules/visual_script/visual_script_yield_nodes.cpp b/modules/visual_script/visual_script_yield_nodes.cpp
index b6d4021ca3..bc033418ba 100644
--- a/modules/visual_script/visual_script_yield_nodes.cpp
+++ b/modules/visual_script/visual_script_yield_nodes.cpp
@@ -82,7 +82,7 @@ String VisualScriptYield::get_text() const {
switch (yield_mode) {
case YIELD_RETURN: return ""; break;
case YIELD_FRAME: return "Next Frame"; break;
- case YIELD_FIXED_FRAME: return "Next Fixed Frame"; break;
+ case YIELD_PHYSICS_FRAME: return "Next Fixed Frame"; break;
case YIELD_WAIT: return rtos(wait_time) + " sec(s)"; break;
}
@@ -122,7 +122,7 @@ public:
ret = STEP_EXIT_FUNCTION_BIT;
break; //return the yield
case VisualScriptYield::YIELD_FRAME: state->connect_to_signal(tree, "idle_frame", Array()); break;
- case VisualScriptYield::YIELD_FIXED_FRAME: state->connect_to_signal(tree, "fixed_frame", Array()); break;
+ case VisualScriptYield::YIELD_PHYSICS_FRAME: state->connect_to_signal(tree, "physics_frame", Array()); break;
case VisualScriptYield::YIELD_WAIT: state->connect_to_signal(tree->create_timer(wait_time).ptr(), "timeout", Array()); break;
}
@@ -190,7 +190,7 @@ void VisualScriptYield::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "wait_time"), "set_wait_time", "get_wait_time");
BIND_ENUM_CONSTANT(YIELD_FRAME);
- BIND_ENUM_CONSTANT(YIELD_FIXED_FRAME);
+ BIND_ENUM_CONSTANT(YIELD_PHYSICS_FRAME);
BIND_ENUM_CONSTANT(YIELD_WAIT);
}
@@ -597,7 +597,7 @@ static Ref<VisualScriptNode> create_yield_signal_node(const String &p_name) {
void register_visual_script_yield_nodes() {
VisualScriptLanguage::singleton->add_register_func("functions/wait/wait_frame", create_yield_node<VisualScriptYield::YIELD_FRAME>);
- VisualScriptLanguage::singleton->add_register_func("functions/wait/wait_fixed_frame", create_yield_node<VisualScriptYield::YIELD_FIXED_FRAME>);
+ VisualScriptLanguage::singleton->add_register_func("functions/wait/wait_physics_frame", create_yield_node<VisualScriptYield::YIELD_PHYSICS_FRAME>);
VisualScriptLanguage::singleton->add_register_func("functions/wait/wait_time", create_yield_node<VisualScriptYield::YIELD_WAIT>);
VisualScriptLanguage::singleton->add_register_func("functions/yield", create_yield_node<VisualScriptYield::YIELD_RETURN>);
diff --git a/modules/visual_script/visual_script_yield_nodes.h b/modules/visual_script/visual_script_yield_nodes.h
index d074962471..4a595a875a 100644
--- a/modules/visual_script/visual_script_yield_nodes.h
+++ b/modules/visual_script/visual_script_yield_nodes.h
@@ -39,7 +39,7 @@ public:
enum YieldMode {
YIELD_RETURN,
YIELD_FRAME,
- YIELD_FIXED_FRAME,
+ YIELD_PHYSICS_FRAME,
YIELD_WAIT
};
diff --git a/modules/vorbis/SCsub b/modules/vorbis/SCsub
index d3e4f7e15a..9d2d0feb92 100644
--- a/modules/vorbis/SCsub
+++ b/modules/vorbis/SCsub
@@ -6,7 +6,7 @@ Import('env_modules')
env_vorbis = env_modules.Clone()
# Thirdparty source files
-if (env['builtin_libvorbis'] != 'no'):
+if env['builtin_libvorbis']:
thirdparty_dir = "#thirdparty/libvorbis/"
thirdparty_sources = [
#"analysis.c",
@@ -42,7 +42,7 @@ if (env['builtin_libvorbis'] != 'no'):
env_vorbis.Append(CPPPATH=[thirdparty_dir])
# also requires libogg
- if (env['builtin_libogg'] != 'no'):
+ if env['builtin_libogg']:
env_vorbis.Append(CPPPATH=["#thirdparty/libogg"])
# Godot source files
diff --git a/modules/vorbis/audio_stream_ogg_vorbis.cpp b/modules/vorbis/audio_stream_ogg_vorbis.cpp
index 52aa2c5ee0..0afb889199 100644
--- a/modules/vorbis/audio_stream_ogg_vorbis.cpp
+++ b/modules/vorbis/audio_stream_ogg_vorbis.cpp
@@ -180,7 +180,7 @@ void AudioStreamPlaybackOGGVorbis::play(float p_from) {
frames_mixed = 0;
playing = true;
if (p_from > 0) {
- seek_pos(p_from);
+ seek(p_from);
}
}
@@ -203,7 +203,7 @@ void AudioStreamPlaybackOGGVorbis::stop() {
//_clear();
}
-float AudioStreamPlaybackOGGVorbis::get_position() const {
+float AudioStreamPlaybackOGGVorbis::get_playback_position() const {
int32_t frames = int32_t(frames_mixed);
if (frames < 0)
@@ -211,7 +211,7 @@ float AudioStreamPlaybackOGGVorbis::get_position() const {
return double(frames) / stream_srate;
}
-void AudioStreamPlaybackOGGVorbis::seek_pos(float p_time) {
+void AudioStreamPlaybackOGGVorbis::seek(float p_time) {
if (!playing)
return;
diff --git a/modules/vorbis/audio_stream_ogg_vorbis.h b/modules/vorbis/audio_stream_ogg_vorbis.h
index 9f1d78850d..929b2651e9 100644
--- a/modules/vorbis/audio_stream_ogg_vorbis.h
+++ b/modules/vorbis/audio_stream_ogg_vorbis.h
@@ -96,8 +96,8 @@ public:
virtual int get_loop_count() const;
- virtual float get_position() const;
- virtual void seek_pos(float p_time);
+ virtual float get_playback_position() const;
+ virtual void seek(float p_time);
virtual int get_channels() const { return stream_channels; }
virtual int get_mix_rate() const { return stream_srate; }
diff --git a/modules/webm/SCsub b/modules/webm/SCsub
index 889f5e83aa..2f1a28a54c 100644
--- a/modules/webm/SCsub
+++ b/modules/webm/SCsub
@@ -19,14 +19,14 @@ env_webm.add_source_files(env.modules_sources, thirdparty_libsimplewebm_sources)
env_webm.Append(CPPPATH=[thirdparty_libsimplewebm_dir, thirdparty_libsimplewebm_dir + "libwebm/"])
# also requires libogg, libvorbis and libopus
-if (env['builtin_libogg'] != 'no'):
+if env['builtin_libogg']:
env_webm.Append(CPPPATH=["#thirdparty/libogg"])
-if (env['builtin_libvorbis'] != 'no'):
+if env['builtin_libvorbis']:
env_webm.Append(CPPPATH=["#thirdparty/libvorbis"])
-if (env['builtin_opus'] != 'no'):
+if env['builtin_opus']:
env_webm.Append(CPPPATH=["#thirdparty/opus"])
-if (env['builtin_libvpx'] != 'no'):
+if env['builtin_libvpx']:
Export('env_webm')
SConscript("libvpx/SCsub")
diff --git a/modules/webm/libvpx/SCsub b/modules/webm/libvpx/SCsub
index 0ee2ed45b8..fd8d762a5e 100644
--- a/modules/webm/libvpx/SCsub
+++ b/modules/webm/libvpx/SCsub
@@ -265,7 +265,7 @@ if env["platform"] == 'uwp':
else:
import platform
is_x11_or_server_arm = ((env["platform"] == 'x11' or env["platform"] == 'server') and platform.machine().startswith('arm'))
- is_ios_x86 = (env["platform"] == 'iphone' and env["ios_sim"] == "yes")
+ is_ios_x86 = (env["platform"] == 'iphone' and env["ios_sim"])
is_android_x86 = (env["platform"] == 'android' and env["android_arch"] == 'x86')
if is_android_x86:
cpu_bits = '32'
diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp
index 0b33ab6a70..2ec6b27471 100644
--- a/modules/webm/video_stream_webm.cpp
+++ b/modules/webm/video_stream_webm.cpp
@@ -204,11 +204,11 @@ float VideoStreamPlaybackWebm::get_length() const {
return 0.0f;
}
-float VideoStreamPlaybackWebm::get_position() const {
+float VideoStreamPlaybackWebm::get_playback_position() const {
return video_pos;
}
-void VideoStreamPlaybackWebm::seek_pos(float p_time) {
+void VideoStreamPlaybackWebm::seek(float p_time) {
//Not implemented
}
diff --git a/modules/webm/video_stream_webm.h b/modules/webm/video_stream_webm.h
index 36b0f02c5c..fc0720967a 100644
--- a/modules/webm/video_stream_webm.h
+++ b/modules/webm/video_stream_webm.h
@@ -81,8 +81,8 @@ public:
virtual float get_length() const;
- virtual float get_position() const;
- virtual void seek_pos(float p_time);
+ virtual float get_playback_position() const;
+ virtual void seek(float p_time);
virtual void set_audio_track(int p_idx);
diff --git a/modules/webp/SCsub b/modules/webp/SCsub
index aa3486a2c5..f9295fed47 100644
--- a/modules/webp/SCsub
+++ b/modules/webp/SCsub
@@ -6,7 +6,7 @@ Import('env_modules')
env_webp = env_modules.Clone()
# Thirdparty source files
-if (env['builtin_libwebp'] != 'no'):
+if env['builtin_libwebp']:
thirdparty_dir = "#thirdparty/libwebp/"
thirdparty_sources = [
"dec/alpha_dec.c",
diff --git a/platform/android/SCsub b/platform/android/SCsub
index e9a370869f..7fa0262359 100644
--- a/platform/android/SCsub
+++ b/platform/android/SCsub
@@ -46,8 +46,18 @@ gradle_baseout = open_utf8(abspath + "/java/build.gradle", "w")
gradle_text = gradle_basein.read()
-
+gradle_maven_flat_text = ""
+if len(env.android_flat_dirs) > 0:
+ gradle_maven_flat_text += "flatDir {\n"
+ gradle_maven_flat_text += "\tdirs "
+ for x in env.android_flat_dirs:
+ gradle_maven_flat_text += "'" + x + "',"
+
+ gradle_maven_flat_text = gradle_maven_flat_text[:-1]
+ gradle_maven_flat_text += "\n\t}\n"
+
gradle_maven_repos_text = ""
+gradle_maven_repos_text += gradle_maven_flat_text
if len(env.android_maven_repos) > 0:
gradle_maven_repos_text += ""
diff --git a/platform/android/build.gradle.template b/platform/android/build.gradle.template
index 1df56ce621..7cb6cf860a 100644
--- a/platform/android/build.gradle.template
+++ b/platform/android/build.gradle.template
@@ -1,6 +1,7 @@
buildscript {
repositories {
jcenter()
+ $$GRADLE_REPOSITORY_URLS$$
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
@@ -54,11 +55,11 @@ android {
]
res.srcDirs = [
'res'
- $$GRADLE_RES_DIRS$$
+ $$GRADLE_RES_DIRS$$
]
aidl.srcDirs = [
'aidl'
- $$GRADLE_AIDL_DIRS$$
+ $$GRADLE_AIDL_DIRS$$
]
assets.srcDirs = [
'assets'
diff --git a/platform/android/detect.py b/platform/android/detect.py
index c1ac54c587..13fc4ee810 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -18,20 +18,21 @@ def can_build():
def get_opts():
+ from SCons.Variables import BoolVariable, EnumVariable
return [
('ANDROID_NDK_ROOT', 'Path to the Android NDK', os.environ.get("ANDROID_NDK_ROOT", 0)),
('ndk_platform', 'Target platform (android-<api>, e.g. "android-18")', "android-18"),
- ('android_arch', 'Target architecture (armv7/armv6/arm64v8/x86)', "armv7"),
- ('android_neon', 'Enable NEON support (armv7 only)', "yes"),
- ('android_stl', 'Enable Android STL support (for modules)', "no")
+ EnumVariable('android_arch', 'Target architecture', "armv7", ('armv7', 'armv6', 'arm64v8', 'x86')),
+ BoolVariable('android_neon', 'Enable NEON support (armv7 only)', True),
+ BoolVariable('android_stl', 'Enable Android STL support (for modules)', False),
]
def get_flags():
return [
- ('tools', 'no'),
+ ('tools', False),
]
@@ -93,7 +94,7 @@ def configure(env):
env['android_arch'] = 'armv7'
neon_text = ""
- if env["android_arch"] == "armv7" and env['android_neon'] == 'yes':
+ if env["android_arch"] == "armv7" and env['android_neon']:
neon_text = " (with NEON)"
print("Building for Android (" + env['android_arch'] + ")" + neon_text)
@@ -117,7 +118,7 @@ def configure(env):
target_subpath = "arm-linux-androideabi-4.9"
abi_subpath = "arm-linux-androideabi"
arch_subpath = "armeabi-v7a"
- if env['android_neon'] == 'yes':
+ if env['android_neon']:
env.extra_suffix = ".armv7.neon" + env.extra_suffix
else:
env.extra_suffix = ".armv7" + env.extra_suffix
@@ -199,7 +200,7 @@ def configure(env):
elif env["android_arch"] == "armv7":
target_opts = ['-target', 'armv7-none-linux-androideabi']
env.Append(CPPFLAGS='-D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -march=armv7-a -mfloat-abi=softfp'.split())
- if env['android_neon'] == 'yes':
+ if env['android_neon']:
env['neon_enabled'] = True
env.Append(CPPFLAGS=['-mfpu=neon', '-D__ARM_NEON__'])
else:
@@ -213,7 +214,7 @@ def configure(env):
env.Append(CPPFLAGS=target_opts)
env.Append(CPPFLAGS=common_opts)
- if (env['android_stl'] == 'yes'):
+ if env['android_stl']:
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/include"])
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/" + arch_subpath + "/include"])
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/" + arch_subpath])
@@ -243,7 +244,7 @@ def configure(env):
env.Append(LIBS=['OpenSLES', 'EGL', 'GLESv3', 'android', 'log', 'z', 'dl'])
# TODO: Move that to opus module's config
- if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"):
+ if 'module_opus_enabled' in env and env['module_opus_enabled']:
if (env["android_arch"] == "armv6" or env["android_arch"] == "armv7"):
env.Append(CFLAGS=["-DOPUS_ARM_OPT"])
env.opus_fixed_point = "yes"
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index e3615e2298..9fe1f291d6 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -871,7 +871,7 @@ class EditorExportAndroid : public EditorExportPlatform {
String lang = str.substr(str.find_last("-") + 1, str.length()).replace("-", "_");
String prop = "application/config/name_" + lang;
- if (ProjectSettings::get_singleton()->has(prop)) {
+ if (ProjectSettings::get_singleton()->has_setting(prop)) {
str = ProjectSettings::get_singleton()->get(prop);
} else {
str = get_project_name(package_name);
diff --git a/platform/android/file_access_android.cpp b/platform/android/file_access_android.cpp
index c7b0d9afcd..0fdf9002d7 100644
--- a/platform/android/file_access_android.cpp
+++ b/platform/android/file_access_android.cpp
@@ -146,6 +146,11 @@ Error FileAccessAndroid::get_error() const {
return eof ? ERR_FILE_EOF : OK; //not sure what else it may happen
}
+void FileAccessAndroid::flush() {
+
+ ERR_FAIL();
+}
+
void FileAccessAndroid::store_8(uint8_t p_dest) {
ERR_FAIL();
diff --git a/platform/android/file_access_android.h b/platform/android/file_access_android.h
index beccf494dd..c8fedbe684 100644
--- a/platform/android/file_access_android.h
+++ b/platform/android/file_access_android.h
@@ -63,6 +63,7 @@ public:
virtual Error get_error() const; ///< get last error
+ virtual void flush();
virtual void store_8(uint8_t p_dest); ///< store a byte
virtual bool file_exists(const String &p_path); ///< return true if a file exists
diff --git a/platform/android/file_access_jandroid.cpp b/platform/android/file_access_jandroid.cpp
index fe934c89fb..980afd8f46 100644
--- a/platform/android/file_access_jandroid.cpp
+++ b/platform/android/file_access_jandroid.cpp
@@ -157,6 +157,9 @@ Error FileAccessJAndroid::get_error() const {
return OK;
}
+void FileAccessJAndroid::flush() {
+}
+
void FileAccessJAndroid::store_8(uint8_t p_dest) {
}
diff --git a/platform/android/file_access_jandroid.h b/platform/android/file_access_jandroid.h
index 75a6a21335..368d2c98fa 100644
--- a/platform/android/file_access_jandroid.h
+++ b/platform/android/file_access_jandroid.h
@@ -67,6 +67,7 @@ public:
virtual Error get_error() const; ///< get last error
+ virtual void flush();
virtual void store_8(uint8_t p_dest); ///< store a byte
virtual bool file_exists(const String &p_path); ///< return true if a file exists
diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java
index 53a90e4cfe..053dfa631a 100644
--- a/platform/android/java/src/org/godotengine/godot/Godot.java
+++ b/platform/android/java/src/org/godotengine/godot/Godot.java
@@ -277,6 +277,21 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
edittext.setView(mView);
io.setEdit(edittext);
+ final Godot godot = this;
+ mView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
+ @Override
+ public void onGlobalLayout() {
+ Point fullSize = new Point();
+ godot.getWindowManager().getDefaultDisplay().getSize(fullSize);
+ Rect gameSize = new Rect();
+ godot.mView.getWindowVisibleDisplayFrame(gameSize);
+
+ final int keyboardHeight = fullSize.y - gameSize.bottom;
+ Log.d("GODOT", "setVirtualKeyboardHeight: " + keyboardHeight);
+ GodotLib.setVirtualKeyboardHeight(keyboardHeight);
+ }
+ });
+
// Ad layout
adLayout = new RelativeLayout(this);
adLayout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
diff --git a/platform/android/java/src/org/godotengine/godot/GodotLib.java b/platform/android/java/src/org/godotengine/godot/GodotLib.java
index 47a690140f..e0ed4cd38c 100644
--- a/platform/android/java/src/org/godotengine/godot/GodotLib.java
+++ b/platform/android/java/src/org/godotengine/godot/GodotLib.java
@@ -69,4 +69,6 @@ public class GodotLib {
public static native void callobject(int p_ID, String p_method, Object[] p_params);
public static native void calldeferred(int p_ID, String p_method, Object[] p_params);
+ public static native void setVirtualKeyboardHeight(int p_height);
+
}
diff --git a/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java b/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java
index 04669a3b0c..ac424ab9f8 100644
--- a/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java
+++ b/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java
@@ -88,79 +88,48 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
public void beforeTextChanged(final CharSequence pCharSequence, final int start, final int count, final int after) {
//Log.d(TAG, "beforeTextChanged(" + pCharSequence + ")start: " + start + ",count: " + count + ",after: " + after);
- for (int i=0;i<count;i++){
- mView.queueEvent(new Runnable() {
- @Override
- public void run() {
+ mView.queueEvent(new Runnable() {
+ @Override
+ public void run() {
+ for (int i = 0; i < count; ++i) {
GodotLib.key(KeyEvent.KEYCODE_DEL, 0, true);
GodotLib.key(KeyEvent.KEYCODE_DEL, 0, false);
}
- });
- }
+ }
+ });
}
@Override
public void onTextChanged(final CharSequence pCharSequence, final int start, final int before, final int count) {
//Log.d(TAG, "onTextChanged(" + pCharSequence + ")start: " + start + ",count: " + count + ",before: " + before);
- for (int i=start;i<start+count;i++){
- final int ch = pCharSequence.charAt(i);
- mView.queueEvent(new Runnable() {
- @Override
- public void run() {
+ mView.queueEvent(new Runnable() {
+ @Override
+ public void run() {
+ for (int i = start; i < start + count; ++i) {
+ final int ch = pCharSequence.charAt(i);
GodotLib.key(0, ch, true);
GodotLib.key(0, ch, false);
}
- });
- }
-
+ }
+ });
}
@Override
public boolean onEditorAction(final TextView pTextView, final int pActionID, final KeyEvent pKeyEvent) {
if (this.mEdit == pTextView && this.isFullScreenEdit()) {
- // user press the action button, delete all old text and insert new text
- for (int i = this.mOriginText.length(); i > 0; i--) {
- mView.queueEvent(new Runnable() {
- @Override
- public void run() {
- GodotLib.key(KeyEvent.KEYCODE_DEL, 0, true);
- GodotLib.key(KeyEvent.KEYCODE_DEL, 0, false);
- }
- });
+ final String characters = pKeyEvent.getCharacters();
- /*
- if (BuildConfig.DEBUG) {
- Log.d(TAG, "deleteBackward");
- }
- */
- }
- String text = pTextView.getText().toString();
-
- /* If user input nothing, translate "\n" to engine. */
- if (text.compareTo("") == 0) {
- text = "\n";
- }
-
- if ('\n' != text.charAt(text.length() - 1)) {
- text += '\n';
- }
-
- for(int i = 0; i < text.length(); i++) {
- final int ch = text.codePointAt(i);
- mView.queueEvent(new Runnable() {
- @Override
- public void run() {
+ mView.queueEvent(new Runnable() {
+ @Override
+ public void run() {
+ for (int i = 0; i < characters.length(); i++) {
+ final int ch = characters.codePointAt(i);
GodotLib.key(0, ch, true);
GodotLib.key(0, ch, false);
}
- });
- }
- /*
- if (BuildConfig.DEBUG) {
- Log.d(TAG, "insertText(" + insertText + ")");
- }
- */
+ }
+ });
}
if (pActionID == EditorInfo.IME_ACTION_DONE) {
diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp
index 509d1bf123..0b193f5882 100644
--- a/platform/android/java_glue.cpp
+++ b/platform/android/java_glue.cpp
@@ -602,21 +602,10 @@ struct TST {
TST tst;
-struct JAndroidPointerEvent {
-
- Vector<OS_Android::TouchPos> points;
- int pointer;
- int what;
-};
-
-static List<JAndroidPointerEvent> pointer_events;
-static List<Ref<InputEvent> > key_events;
-static List<OS_Android::JoypadEvent> joy_events;
static bool initialized = false;
static int step = 0;
static bool resized = false;
static bool resized_reload = false;
-static bool go_back_request = false;
static Size2 new_size;
static Vector3 accelerometer;
static Vector3 magnetometer;
@@ -624,8 +613,6 @@ static Vector3 gyroscope;
static HashMap<String, JNISingleton *> jni_singletons;
static jobject godot_io;
-static Vector<int> joy_device_ids;
-
typedef void (*GFXInitFunc)(void *ud, bool gl2);
static jmethodID _on_video_init = 0;
@@ -754,6 +741,18 @@ static void _alert(const String &p_message, const String &p_title) {
env->CallVoidMethod(_godot_instance, _alertDialog, jStrMessage, jStrTitle);
}
+// volatile because it can be changed from non-main thread and we need to
+// ensure the change is immediately visible to other threads.
+static volatile int virtual_keyboard_height;
+
+static int _get_vk_height() {
+ return virtual_keyboard_height;
+}
+
+JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setVirtualKeyboardHeight(JNIEnv *env, jobject obj, jint p_height) {
+ virtual_keyboard_height = p_height;
+}
+
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *env, jobject obj, jobject activity, jboolean p_need_reload_hook, jobject p_asset_manager, jboolean p_use_apk_expansion) {
__android_log_print(ANDROID_LOG_INFO, "godot", "**INIT EVENT! - %p\n", env);
@@ -824,7 +823,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en
AudioDriverAndroid::setup(gob);
}
- os_android = new OS_Android(_gfx_init_func, env, _open_uri, _get_data_dir, _get_locale, _get_model, _get_screen_dpi, _show_vk, _hide_vk, _set_screen_orient, _get_unique_id, _get_system_dir, _play_video, _is_video_playing, _pause_video, _stop_video, _set_keep_screen_on, _alert, p_use_apk_expansion);
+ os_android = new OS_Android(_gfx_init_func, env, _open_uri, _get_data_dir, _get_locale, _get_model, _get_screen_dpi, _show_vk, _hide_vk, _get_vk_height, _set_screen_orient, _get_unique_id, _get_system_dir, _play_video, _is_video_playing, _pause_video, _stop_video, _set_keep_screen_on, _alert, p_use_apk_expansion);
os_android->set_need_reload_hooks(p_need_reload_hook);
char wd[500];
@@ -841,7 +840,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en
static void _initialize_java_modules() {
- if (!ProjectSettings::get_singleton()->has("android/modules")) {
+ if (!ProjectSettings::get_singleton()->has_setting("android/modules")) {
print_line("ANDROID MODULES: Nothing to load, aborting");
return;
}
@@ -986,7 +985,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_newcontext(JNIEnv *en
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_back(JNIEnv *env, jobject obj) {
- go_back_request = true;
+ os_android->main_loop_request_go_back();
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, jobject obj) {
@@ -1011,36 +1010,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, job
//__android_log_print(ANDROID_LOG_INFO,"godot","**STEP EVENT! - %p-%i\n",env,Thread::get_caller_id());
- while (pointer_events.size()) {
-
- JAndroidPointerEvent jpe = pointer_events.front()->get();
- os_android->process_touch(jpe.what, jpe.pointer, jpe.points);
-
- pointer_events.pop_front();
- }
-
- while (key_events.size()) {
-
- Ref<InputEvent> event = key_events.front()->get();
- os_android->process_event(event);
-
- key_events.pop_front();
- };
-
- while (joy_events.size()) {
-
- OS_Android::JoypadEvent event = joy_events.front()->get();
- os_android->process_joy_event(event);
-
- joy_events.pop_front();
- }
-
- if (go_back_request) {
-
- os_android->main_loop_request_go_back();
- go_back_request = false;
- }
-
os_android->process_accelerometer(accelerometer);
os_android->process_magnetometer(magnetometer);
@@ -1071,12 +1040,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_touch(JNIEnv *env, jo
points.push_back(tp);
}
- JAndroidPointerEvent jpe;
- jpe.pointer = pointer;
- jpe.points = points;
- jpe.what = ev;
+ os_android->process_touch(ev, pointer, points);
- pointer_events.push_back(jpe);
/*
if (os_android)
os_android->process_touch(ev,pointer,points);
@@ -1346,7 +1311,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joybutton(JNIEnv *env
jevent.index = p_button;
jevent.pressed = p_pressed;
- joy_events.push_back(jevent);
+ os_android->process_joy_event(jevent);
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyaxis(JNIEnv *env, jobject obj, jint p_device, jint p_axis, jfloat p_value) {
@@ -1357,7 +1322,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyaxis(JNIEnv *env,
jevent.index = p_axis;
jevent.value = p_value;
- joy_events.push_back(jevent);
+ os_android->process_joy_event(jevent);
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyhat(JNIEnv *env, jobject obj, jint p_device, jint p_hat_x, jint p_hat_y) {
@@ -1378,7 +1343,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyhat(JNIEnv *env, j
hat |= InputDefault::HAT_MASK_DOWN;
}
jevent.hat = hat;
- joy_events.push_back(jevent);
+
+ os_android->process_joy_event(jevent);
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyconnectionchanged(JNIEnv *env, jobject obj, jint p_device, jboolean p_connected, jstring p_name) {
@@ -1391,6 +1357,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyconnectionchanged(
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_key(JNIEnv *env, jobject obj, jint p_scancode, jint p_unicode_char, jboolean p_pressed) {
Ref<InputEventKey> ievent;
+ ievent.instance();
int val = p_unicode_char;
int scancode = android_get_keysym(p_scancode);
ievent->set_scancode(scancode);
@@ -1409,10 +1376,10 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_key(JNIEnv *env, jobj
ievent->set_unicode(KEY_ENTER);
} else if (p_scancode == 4) {
- go_back_request = true;
+ os_android->main_loop_request_go_back();
}
- key_events.push_back(ievent);
+ os_android->process_event(ievent);
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_accelerometer(JNIEnv *env, jobject obj, jfloat x, jfloat y, jfloat z) {
diff --git a/platform/android/java_glue.h b/platform/android/java_glue.h
index ec8ae9a0a6..0aa2489813 100644
--- a/platform/android/java_glue.h
+++ b/platform/android/java_glue.h
@@ -59,6 +59,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_method(JNIEnv *env, j
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 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);
+JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setVirtualKeyboardHeight(JNIEnv *env, jobject obj, jint p_height);
}
#endif
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index dbea2d7531..473a093077 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -47,6 +47,15 @@
#include "file_access_jandroid.h"
#endif
+class AndroidLogger : public Logger {
+public:
+ virtual void logv(const char *p_format, va_list p_list, bool p_err) {
+ __android_log_vprint(p_err ? ANDROID_LOG_ERROR : ANDROID_LOG_INFO, "godot", p_format, p_list);
+ }
+
+ virtual ~AndroidLogger() {}
+};
+
int OS_Android::get_video_driver_count() const {
return 1;
@@ -111,6 +120,13 @@ void OS_Android::initialize_core() {
#endif
}
+void OS_Android::initialize_logger() {
+ Vector<Logger *> loggers;
+ loggers.push_back(memnew(AndroidLogger));
+ loggers.push_back(memnew(RotatedFileLogger("user://logs/log.txt")));
+ _set_logger(memnew(CompositeLogger(loggers)));
+}
+
void OS_Android::set_opengl_extensions(const char *p_gl_extensions) {
ERR_FAIL_COND(!p_gl_extensions);
@@ -162,23 +178,9 @@ void OS_Android::delete_main_loop() {
}
void OS_Android::finalize() {
-
memdelete(input);
}
-void OS_Android::vprint(const char *p_format, va_list p_list, bool p_stderr) {
-
- __android_log_vprint(p_stderr ? ANDROID_LOG_ERROR : ANDROID_LOG_INFO, "godot", p_format, p_list);
-}
-
-void OS_Android::print(const char *p_format, ...) {
-
- va_list argp;
- va_start(argp, p_format);
- __android_log_vprint(ANDROID_LOG_INFO, "godot", p_format, argp);
- va_end(argp);
-}
-
void OS_Android::alert(const String &p_alert, const String &p_title) {
//print("ALERT: %s\n", p_alert.utf8().get_data());
@@ -517,6 +519,15 @@ bool OS_Android::has_virtual_keyboard() const {
return true;
}
+int OS_Android::get_virtual_keyboard_height() const {
+ if (get_virtual_keyboard_height_func) {
+ return get_virtual_keyboard_height_func();
+ }
+
+ ERR_PRINT("Cannot obtain virtual keyboard height.");
+ return 0;
+}
+
void OS_Android::show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect) {
if (show_virtual_keyboard_func) {
@@ -702,7 +713,7 @@ bool OS_Android::_check_internal_feature_support(const String &p_feature) {
return p_feature == "mobile" || p_feature == "etc" || p_feature == "etc2"; //TODO support etc2 only if GLES3 driver is selected
}
-OS_Android::OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetDataDirFunc p_get_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, bool p_use_apk_expansion) {
+OS_Android::OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetDataDirFunc p_get_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, VirtualKeyboardHeightFunc p_vk_height_func, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, bool p_use_apk_expansion) {
use_apk_expansion = p_use_apk_expansion;
default_videomode.width = 800;
@@ -732,11 +743,14 @@ OS_Android::OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURI
show_virtual_keyboard_func = p_show_vk;
hide_virtual_keyboard_func = p_hide_vk;
+ get_virtual_keyboard_height_func = p_vk_height_func;
set_screen_orientation_func = p_screen_orient;
set_keep_screen_on_func = p_set_keep_screen_on_func;
alert_func = p_alert_func;
use_reload_hooks = false;
+
+ _set_logger(memnew(AndroidLogger));
}
OS_Android::~OS_Android() {
diff --git a/platform/android/os_android.h b/platform/android/os_android.h
index 119c14bff3..0c78c198a8 100644
--- a/platform/android/os_android.h
+++ b/platform/android/os_android.h
@@ -67,6 +67,7 @@ typedef void (*VideoPauseFunc)();
typedef void (*VideoStopFunc)();
typedef void (*SetKeepScreenOnFunc)(bool p_enabled);
typedef void (*AlertFunc)(const String &, const String &);
+typedef int (*VirtualKeyboardHeightFunc)();
class OS_Android : public OS_Unix {
public:
@@ -126,6 +127,7 @@ private:
GetScreenDPIFunc get_screen_dpi_func;
ShowVirtualKeyboardFunc show_virtual_keyboard_func;
HideVirtualKeyboardFunc hide_virtual_keyboard_func;
+ VirtualKeyboardHeightFunc get_virtual_keyboard_height_func;
SetScreenOrientationFunc set_screen_orientation_func;
GetUniqueIDFunc get_unique_id_func;
GetSystemDirFunc get_system_dir_func;
@@ -149,6 +151,7 @@ public:
virtual int get_audio_driver_count() const;
virtual const char *get_audio_driver_name(int p_driver) const;
+ virtual void initialize_logger();
virtual void initialize_core();
virtual void initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
@@ -161,8 +164,6 @@ public:
static OS *get_singleton();
- virtual void vprint(const char *p_format, va_list p_list, bool p_stderr = false);
- virtual void print(const char *p_format, ...);
virtual void alert(const String &p_alert, const String &p_title = "ALERT!");
virtual void set_mouse_show(bool p_show);
@@ -202,6 +203,7 @@ public:
virtual bool has_virtual_keyboard() const;
virtual void show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect = Rect2());
virtual void hide_virtual_keyboard();
+ virtual int get_virtual_keyboard_height() const;
void set_opengl_extensions(const char *p_gl_extensions);
void set_display_size(Size2 p_size);
@@ -241,7 +243,7 @@ public:
void joy_connection_changed(int p_device, bool p_connected, String p_name);
virtual bool _check_internal_feature_support(const String &p_feature);
- OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetDataDirFunc p_get_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, bool p_use_apk_expansion);
+ OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetDataDirFunc p_get_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, VirtualKeyboardHeightFunc p_vk_height_func, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, bool p_use_apk_expansion);
~OS_Android();
};
diff --git a/platform/haiku/detect.py b/platform/haiku/detect.py
index 61ee32d2dd..50f9783dd2 100644
--- a/platform/haiku/detect.py
+++ b/platform/haiku/detect.py
@@ -19,9 +19,10 @@ def can_build():
def get_opts():
+ from SCons.Variables import EnumVariable
return [
- ('debug_symbols', 'Add debug symbols to release version (yes/no/full)', 'yes')
+ EnumVariable('debug_symbols', 'Add debug symbols to release version', 'yes', ('yes', 'no', 'full')),
]
diff --git a/platform/iphone/SCsub b/platform/iphone/SCsub
index 998d0a3f0d..61798c5f87 100644
--- a/platform/iphone/SCsub
+++ b/platform/iphone/SCsub
@@ -5,7 +5,6 @@ Import('env')
iphone_lib = [
'os_iphone.cpp',
- 'audio_driver_iphone.cpp',
'sem_iphone.cpp',
'gl_view.mm',
'main.m',
diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm
index c7b65b476b..65cafbd6d4 100644
--- a/platform/iphone/app_delegate.mm
+++ b/platform/iphone/app_delegate.mm
@@ -29,8 +29,8 @@
/*************************************************************************/
#import "app_delegate.h"
-#include "audio_driver_iphone.h"
#include "core/project_settings.h"
+#include "drivers/coreaudio/audio_driver_coreaudio.h"
#import "gl_view.h"
#include "main/main.h"
#include "os_iphone.h"
@@ -81,7 +81,7 @@ void _set_keep_screen_on(bool p_enabled) {
extern int gargc;
extern char **gargv;
-extern int iphone_main(int, int, int, char **);
+extern int iphone_main(int, int, int, char **, String);
extern void iphone_finish();
CMMotionManager *motionManager;
@@ -393,15 +393,6 @@ static int frame_count = 0;
};
++frame_count;
- NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
- NSUserDomainMask, YES);
- NSString *documentsDirectory = [paths objectAtIndex:0];
- // NSString *documentsDirectory = [[[NSFileManager defaultManager]
- // URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask]
- // lastObject];
- OSIPhone::get_singleton()->set_data_dir(
- String::utf8([documentsDirectory UTF8String]));
-
NSString *locale_code = [[NSLocale currentLocale] localeIdentifier];
OSIPhone::get_singleton()->set_locale(
String::utf8([locale_code UTF8String]));
@@ -604,7 +595,11 @@ static int frame_count = 0;
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES,
GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
- int err = iphone_main(backingWidth, backingHeight, gargc, gargv);
+ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
+ NSUserDomainMask, YES);
+ NSString *documentsDirectory = [paths objectAtIndex:0];
+
+ int err = iphone_main(backingWidth, backingHeight, gargc, gargv, String::utf8([documentsDirectory UTF8String]));
if (err != 0) {
// bail, things did not go very well for us, should probably output a message on screen with our error code...
exit(0);
@@ -736,8 +731,8 @@ static int frame_count = 0;
};
// Fixed audio can not resume if it is interrupted cause by an incoming phone call
- if (AudioDriverIphone::get_singleton() != NULL)
- AudioDriverIphone::get_singleton()->start();
+ if (AudioDriverCoreAudio::get_singleton() != NULL)
+ AudioDriverCoreAudio::get_singleton()->start();
}
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
diff --git a/platform/iphone/audio_driver_iphone.cpp b/platform/iphone/audio_driver_iphone.cpp
deleted file mode 100644
index dbc5bdb654..0000000000
--- a/platform/iphone/audio_driver_iphone.cpp
+++ /dev/null
@@ -1,187 +0,0 @@
-/*************************************************************************/
-/* audio_driver_iphone.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-#include "audio_driver_iphone.h"
-
-Error AudioDriverIphone::init() {
-
- active = false;
- channels = 2;
-
- AudioStreamBasicDescription strdesc;
- strdesc.mFormatID = kAudioFormatLinearPCM;
- strdesc.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked;
- strdesc.mChannelsPerFrame = channels;
- strdesc.mSampleRate = 44100;
- strdesc.mFramesPerPacket = 1;
- strdesc.mBitsPerChannel = 16;
- strdesc.mBytesPerFrame =
- strdesc.mBitsPerChannel * strdesc.mChannelsPerFrame / 8;
- strdesc.mBytesPerPacket =
- strdesc.mBytesPerFrame * strdesc.mFramesPerPacket;
-
- AURenderCallbackStruct callback;
- AudioComponentDescription desc;
- 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_RemoteIO; /* !!! FIXME: ? */
- AudioComponent comp = AudioComponentFindNext(NULL, &desc);
- desc.componentManufacturer = kAudioUnitManufacturer_Apple;
-
- OSStatus result = AudioComponentInstanceNew(comp, &audio_unit);
- ERR_FAIL_COND_V(result != noErr, FAILED);
- ERR_FAIL_COND_V(comp == NULL, FAILED);
-
- result = AudioUnitSetProperty(audio_unit,
- kAudioUnitProperty_StreamFormat,
- scope, bus, &strdesc, sizeof(strdesc));
- ERR_FAIL_COND_V(result != noErr, FAILED);
-
- zeromem(&callback, sizeof(AURenderCallbackStruct));
- callback.inputProc = &AudioDriverIphone::output_callback;
- callback.inputProcRefCon = this;
- result = AudioUnitSetProperty(audio_unit,
- kAudioUnitProperty_SetRenderCallback,
- scope, bus, &callback, sizeof(callback));
- ERR_FAIL_COND_V(result != noErr, FAILED);
-
- result = AudioUnitInitialize(audio_unit);
- ERR_FAIL_COND_V(result != noErr, FAILED);
-
- result = AudioOutputUnitStart(audio_unit);
- ERR_FAIL_COND_V(result != noErr, FAILED);
-
- const int samples = 1024;
- samples_in = memnew_arr(int32_t, samples); // whatever
- buffer_frames = samples / channels;
-
- return FAILED;
-};
-
-OSStatus AudioDriverIphone::output_callback(void *inRefCon,
- AudioUnitRenderActionFlags *ioActionFlags,
- const AudioTimeStamp *inTimeStamp,
- UInt32 inBusNumber, UInt32 inNumberFrames,
- AudioBufferList *ioData) {
-
- AudioBuffer *abuf;
- AudioDriverIphone *ad = (AudioDriverIphone *)inRefCon;
-
- bool mix = true;
-
- if (!ad->active)
- mix = false;
- else if (ad->mutex) {
- mix = ad->mutex->try_lock() == OK;
- };
-
- if (!mix) {
- for (unsigned int i = 0; i < ioData->mNumberBuffers; i++) {
- abuf = &ioData->mBuffers[i];
- zeromem(abuf->mData, abuf->mDataByteSize);
- };
- return 0;
- };
-
- int frames_left;
-
- for (unsigned int i = 0; i < ioData->mNumberBuffers; i++) {
-
- abuf = &ioData->mBuffers[i];
- frames_left = inNumberFrames;
- int16_t *out = (int16_t *)abuf->mData;
-
- while (frames_left) {
-
- int frames = MIN(frames_left, ad->buffer_frames);
- //ad->lock();
- ad->audio_server_process(frames, ad->samples_in);
- //ad->unlock();
-
- for (int i = 0; i < frames * ad->channels; i++) {
-
- out[i] = ad->samples_in[i] >> 16;
- }
-
- frames_left -= frames;
- out += frames * ad->channels;
- };
- };
-
- if (ad->mutex)
- ad->mutex->unlock();
-
- return 0;
-};
-
-void AudioDriverIphone::start() {
- active = true;
- // Resume audio
- // iOS audio-thread stoped if it is interrupted cause by an incoming phone call
- // Use AudioOutputUnitStart to re-create audio-thread
- OSStatus result = AudioOutputUnitStart(audio_unit);
- ERR_FAIL_COND(result != noErr);
-};
-
-int AudioDriverIphone::get_mix_rate() const {
- return 44100;
-};
-
-AudioDriver::SpeakerMode AudioDriverIphone::get_speaker_mode() const {
- return SPEAKER_MODE_STEREO;
-};
-
-void AudioDriverIphone::lock() {
-
- if (active && mutex)
- mutex->lock();
-};
-
-void AudioDriverIphone::unlock() {
- if (active && mutex)
- mutex->unlock();
-};
-
-void AudioDriverIphone::finish() {
-
- memdelete_arr(samples_in);
-};
-
-AudioDriverIphone::AudioDriverIphone() {
-
- mutex = Mutex::create(); //NULL;
-};
-
-AudioDriverIphone::~AudioDriverIphone(){
-
-};
diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py
index 0b81422fa3..00d8a59f74 100644
--- a/platform/iphone/detect.py
+++ b/platform/iphone/detect.py
@@ -20,24 +20,24 @@ def can_build():
def get_opts():
-
+ from SCons.Variables import BoolVariable
return [
('IPHONEPLATFORM', 'Name of the iPhone platform', 'iPhoneOS'),
('IPHONEPATH', 'Path to iPhone toolchain', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain'),
('IPHONESDK', 'Path to the iPhone SDK', '/Applications/Xcode.app/Contents/Developer/Platforms/${IPHONEPLATFORM}.platform/Developer/SDKs/${IPHONEPLATFORM}.sdk/'),
- ('game_center', 'Support for game center', 'yes'),
- ('store_kit', 'Support for in-app store', 'yes'),
- ('icloud', 'Support for iCloud', 'yes'),
- ('ios_exceptions', 'Enable exceptions', 'no'),
+ BoolVariable('game_center', 'Support for game center', True),
+ BoolVariable('store_kit', 'Support for in-app store', True),
+ BoolVariable('icloud', 'Support for iCloud', True),
+ BoolVariable('ios_exceptions', 'Enable exceptions', False),
('ios_triple', 'Triple for ios toolchain', ''),
- ('ios_sim', 'Build simulator binary', 'no'),
+ BoolVariable('ios_sim', 'Build simulator binary', False),
]
def get_flags():
return [
- ('tools', 'no'),
+ ('tools', False),
]
@@ -58,7 +58,7 @@ def configure(env):
## Architecture
- if (env["ios_sim"] == "yes" or env["arch"] == "x86"): # i386, simulator
+ if env["ios_sim"] or env["arch"] == "x86": # i386, simulator
env["arch"] = "x86"
env["bits"] = "32"
elif (env["arch"] == "arm" or env["arch"] == "arm32" or env["arch"] == "armv7" or env["bits"] == "32"): # arm
@@ -91,7 +91,7 @@ def configure(env):
env.Append(CPPFLAGS=['-DNEED_LONG_INT'])
env.Append(CPPFLAGS=['-DLIBYUV_DISABLE_NEON'])
- if env['ios_exceptions'] == 'yes':
+ if env['ios_exceptions']:
env.Append(CPPFLAGS=['-fexceptions'])
else:
env.Append(CPPFLAGS=['-fno-exceptions'])
@@ -129,15 +129,15 @@ def configure(env):
])
# Feature options
- if env['game_center'] == 'yes':
+ if env['game_center']:
env.Append(CPPFLAGS=['-DGAME_CENTER_ENABLED'])
env.Append(LINKFLAGS=['-framework', 'GameKit'])
- if env['store_kit'] == 'yes':
+ if env['store_kit']:
env.Append(CPPFLAGS=['-DSTOREKIT_ENABLED'])
env.Append(LINKFLAGS=['-framework', 'StoreKit'])
- if env['icloud'] == 'yes':
+ if env['icloud']:
env.Append(CPPFLAGS=['-DICLOUD_ENABLED'])
env.Append(CPPPATH=['$IPHONESDK/usr/include',
@@ -148,10 +148,10 @@ def configure(env):
env['ENV']['CODESIGN_ALLOCATE'] = '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate'
env.Append(CPPPATH=['#platform/iphone'])
- env.Append(CPPFLAGS=['-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DMPC_FIXED_POINT'])
+ env.Append(CPPFLAGS=['-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DMPC_FIXED_POINT', '-DCOREAUDIO_ENABLED'])
# TODO: Move that to opus module's config
- if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"):
+ if 'module_opus_enabled' in env and env['module_opus_enabled']:
env.opus_fixed_point = "yes"
if (env["arch"] == "arm"):
env.Append(CFLAGS=["-DOPUS_ARM_OPT"])
diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp
index 8bb7f23ead..c91781ce1d 100644
--- a/platform/iphone/export/export.cpp
+++ b/platform/iphone/export/export.cpp
@@ -52,7 +52,14 @@ class EditorExportPlatformIOS : public EditorExportPlatform {
Ref<ImageTexture> logo;
- void _fix_config_file(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &pfile, const String &p_name, const String &p_binary);
+ typedef Error (*FileHandler)(String p_file, void *p_userdata);
+ static Error _walk_dir_recursive(DirAccess *p_da, FileHandler p_handler, void *p_userdata);
+ static Error _codesign(String p_file, void *p_userdata);
+
+ void _fix_config_file(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &pfile, const String &p_name, const String &p_binary, bool p_debug);
+ static Error _export_dylibs(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total);
+ Error _export_loading_screens(const Ref<EditorExportPreset> &p_preset, const String &p_dest_dir);
+ Error _export_icons(const Ref<EditorExportPreset> &p_preset, const String &p_iconset_dir);
protected:
virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features);
@@ -63,7 +70,7 @@ public:
virtual String get_os_name() const { return "iOS"; }
virtual Ref<Texture> get_logo() const { return logo; }
- virtual String get_binary_extension() const { return "xcodeproj"; }
+ virtual String get_binary_extension() const { return "ipa"; }
virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0);
virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const;
@@ -96,16 +103,44 @@ void EditorExportPlatformIOS::get_export_options(List<ExportOption> *r_options)
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/debug", PROPERTY_HINT_GLOBAL_FILE, "zip"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/release", PROPERTY_HINT_GLOBAL_FILE, "zip"), ""));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/app_store_team_id"), ""));
+
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/provisioning_profile_uuid_debug"), ""));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/code_sign_identity_debug"), "iPhone Developer"));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "application/export_method_debug", PROPERTY_HINT_ENUM, "App Store,Development,Ad-Hoc,Enterprise"), 1));
+
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/provisioning_profile_uuid_release"), ""));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/code_sign_identity_release"), "iPhone Distribution"));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "application/export_method_release", PROPERTY_HINT_ENUM, "App Store,Development,Ad-Hoc,Enterprise"), 0));
+
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/name"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/info"), "Made with Godot Engine"));
- // r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/icon", PROPERTY_HINT_FILE, "png"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/identifier"), "org.godotengine.iosgame"));
- r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/signature"), "godotiosgame"));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/signature"), "????"));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/short_version"), "1.0"));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/version"), "1.0"));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/copyright"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "application/bits_mode", PROPERTY_HINT_ENUM, "Fat (32 & 64 bits),64 bits,32 bits"), 1));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "required_icons/iphone_120x120", PROPERTY_HINT_FILE, "png"), "")); // Home screen on iPhone/iPod Touch with retina display
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "required_icons/ipad_76x76", PROPERTY_HINT_FILE, "png"), "")); // Home screen on iPad
+
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/iphone_180x180", PROPERTY_HINT_FILE, "png"), "")); // Home screen on iPhone with retina HD display
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/ipad_152x152", PROPERTY_HINT_FILE, "png"), "")); // Home screen on iPad with retina display
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/ipad_167x167", PROPERTY_HINT_FILE, "png"), "")); // Home screen on iPad Pro
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/spotlight_40x40", PROPERTY_HINT_FILE, "png"), "")); // Spotlight
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/spotlight_80x80", PROPERTY_HINT_FILE, "png"), "")); // Spotlight on devices with retina display
+
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "landscape_launch_screens/iphone_2208x1242", PROPERTY_HINT_FILE, "png"), "")); // iPhone 6 Plus, 6s Plus, 7 Plus
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "landscape_launch_screens/ipad_2732x2048", PROPERTY_HINT_FILE, "png"), "")); // 12.9-inch iPad Pro
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "landscape_launch_screens/ipad_2048x1536", PROPERTY_HINT_FILE, "png"), "")); // Other iPads
+
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "portrait_launch_screens/iphone_640x1136", PROPERTY_HINT_FILE, "png"), "")); // iPhone 5, 5s, SE
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "portrait_launch_screens/iphone_750x1334", PROPERTY_HINT_FILE, "png"), "")); // iPhone 6, 6s, 7
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "portrait_launch_screens/iphone_1242x2208", PROPERTY_HINT_FILE, "png"), "")); // iPhone 6 Plus, 6s Plus, 7 Plus
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "portrait_launch_screens/ipad_2048x2732", PROPERTY_HINT_FILE, "png"), "")); // 12.9-inch iPad Pro
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "portrait_launch_screens/ipad_1536x2048", PROPERTY_HINT_FILE, "png"), "")); // Other iPads
+
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/s3tc"), false));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc"), false));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc2"), true));
@@ -113,11 +148,17 @@ void EditorExportPlatformIOS::get_export_options(List<ExportOption> *r_options)
/* probably need some more info */
}
-void EditorExportPlatformIOS::_fix_config_file(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &pfile, const String &p_name, const String &p_binary) {
-
+void EditorExportPlatformIOS::_fix_config_file(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &pfile, const String &p_name, const String &p_binary, bool p_debug) {
+ static const String export_method_string[] = {
+ "app-store",
+ "development",
+ "ad-hoc",
+ "enterprise"
+ };
String str;
String strnew;
str.parse_utf8((const char *)pfile.ptr(), pfile.size());
+ print_line(str);
Vector<String> lines = str.split("\n");
for (int i = 0; i < lines.size(); i++) {
if (lines[i].find("$binary") != -1) {
@@ -136,6 +177,19 @@ void EditorExportPlatformIOS::_fix_config_file(const Ref<EditorExportPreset> &p_
strnew += lines[i].replace("$signature", p_preset->get("application/signature")) + "\n";
} else if (lines[i].find("$copyright") != -1) {
strnew += lines[i].replace("$copyright", p_preset->get("application/copyright")) + "\n";
+ } else if (lines[i].find("$team_id") != -1) {
+ strnew += lines[i].replace("$team_id", p_preset->get("application/app_store_team_id")) + "\n";
+ } else if (lines[i].find("$export_method") != -1) {
+ int export_method = p_preset->get(p_debug ? "application/export_method_debug" : "application/export_method_release");
+ strnew += lines[i].replace("$export_method", export_method_string[export_method]) + "\n";
+ } else if (lines[i].find("$provisioning_profile_uuid_release") != -1) {
+ strnew += lines[i].replace("$provisioning_profile_uuid_release", p_preset->get("application/provisioning_profile_uuid_release")) + "\n";
+ } else if (lines[i].find("$provisioning_profile_uuid_debug") != -1) {
+ strnew += lines[i].replace("$provisioning_profile_uuid_debug", p_preset->get("application/provisioning_profile_uuid_debug")) + "\n";
+ } else if (lines[i].find("$code_sign_identity_debug") != -1) {
+ strnew += lines[i].replace("$code_sign_identity_debug", p_preset->get("application/code_sign_identity_debug")) + "\n";
+ } else if (lines[i].find("$code_sign_identity_release") != -1) {
+ strnew += lines[i].replace("$code_sign_identity_release", p_preset->get("application/code_sign_identity_release")) + "\n";
} else {
strnew += lines[i] + "\n";
}
@@ -150,12 +204,214 @@ void EditorExportPlatformIOS::_fix_config_file(const Ref<EditorExportPreset> &p_
}
}
+Error EditorExportPlatformIOS::_export_dylibs(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total) {
+ if (!p_path.ends_with(".dylib")) return OK;
+ const String &dest_dir = *(String *)p_userdata;
+ String rel_path = p_path.replace_first("res://", "dylibs/");
+ DirAccess *dest_dir_access = DirAccess::open(dest_dir);
+ ERR_FAIL_COND_V(!dest_dir_access, ERR_CANT_OPEN);
+
+ String base_dir = rel_path.get_base_dir();
+ Error make_dir_err = OK;
+ if (!dest_dir_access->dir_exists(base_dir)) {
+ make_dir_err = dest_dir_access->make_dir_recursive(base_dir);
+ }
+ if (make_dir_err != OK) {
+ memdelete(dest_dir_access);
+ return make_dir_err;
+ }
+
+ Error copy_err = dest_dir_access->copy(p_path, dest_dir + rel_path);
+ memdelete(dest_dir_access);
+
+ return copy_err;
+}
+
+struct IconInfo {
+ const char *preset_key;
+ const char *idiom;
+ const char *export_name;
+ const char *actual_size_side;
+ const char *scale;
+ const char *unscaled_size;
+ bool is_required;
+};
+
+static const IconInfo icon_infos[] = {
+ { "required_icons/iphone_120x120", "iphone", "Icon-120.png", "120", "2x", "60x60", true },
+ { "required_icons/iphone_120x120", "iphone", "Icon-120.png", "120", "3x", "40x40", true },
+
+ { "required_icons/ipad_76x76", "ipad", "Icon-76.png", "76", "1x", "76x76", false },
+
+ { "optional_icons/iphone_180x180", "iphone", "Icon-180.png", "180", "3x", "60x60", false },
+
+ { "optional_icons/ipad_152x152", "ipad", "Icon-152.png", "152", "2x", "76x76", false },
+
+ { "optional_icons/ipad_167x167", "ipad", "Icon-167.png", "167", "2x", "83.5x83.5", false },
+
+ { "optional_icons/spotlight_40x40", "ipad", "Icon-40.png", "40", "1x", "40x40", false },
+
+ { "optional_icons/spotlight_80x80", "iphone", "Icon-80.png", "80", "2x", "40x40", false },
+ { "optional_icons/spotlight_80x80", "ipad", "Icon-80.png", "80", "2x", "40x40", false }
+
+};
+
+Error EditorExportPlatformIOS::_export_icons(const Ref<EditorExportPreset> &p_preset, const String &p_iconset_dir) {
+ String json_description = "{\"images\":[";
+ String sizes;
+
+ DirAccess *da = DirAccess::open(p_iconset_dir);
+ ERR_FAIL_COND_V(!da, ERR_CANT_OPEN);
+
+ for (int i = 0; i < (sizeof(icon_infos) / sizeof(icon_infos[0])); ++i) {
+ IconInfo info = icon_infos[i];
+ String icon_path = p_preset->get(info.preset_key);
+ if (icon_path.length() == 0) {
+ if (info.is_required) {
+ ERR_PRINT("Required icon is not specified in the preset");
+ return ERR_UNCONFIGURED;
+ }
+ continue;
+ }
+ Error err = da->copy(icon_path, p_iconset_dir + info.export_name);
+ if (err) {
+ memdelete(da);
+ String err_str = String("Failed to export icon: ") + icon_path;
+ ERR_PRINT(err_str.utf8().get_data());
+ return err;
+ }
+ sizes += String(info.actual_size_side) + "\n";
+ if (i > 0) {
+ json_description += ",";
+ }
+ json_description += String("{");
+ json_description += String("\"idiom\":") + "\"" + info.idiom + "\",";
+ json_description += String("\"size\":") + "\"" + info.unscaled_size + "\",";
+ json_description += String("\"scale\":") + "\"" + info.scale + "\",";
+ json_description += String("\"filename\":") + "\"" + info.export_name + "\"";
+ json_description += String("}");
+ }
+ json_description += "]}";
+ memdelete(da);
+
+ FileAccess *json_file = FileAccess::open(p_iconset_dir + "Contents.json", FileAccess::WRITE);
+ ERR_FAIL_COND_V(!json_file, ERR_CANT_CREATE);
+ CharString json_utf8 = json_description.utf8();
+ json_file->store_buffer((const uint8_t *)json_utf8.get_data(), json_utf8.length());
+ memdelete(json_file);
+
+ FileAccess *sizes_file = FileAccess::open(p_iconset_dir + "sizes", FileAccess::WRITE);
+ ERR_FAIL_COND_V(!sizes_file, ERR_CANT_CREATE);
+ CharString sizes_utf8 = sizes.utf8();
+ sizes_file->store_buffer((const uint8_t *)sizes_utf8.get_data(), sizes_utf8.length());
+ memdelete(sizes_file);
+
+ return OK;
+}
+
+struct LoadingScreenInfo {
+ const char *preset_key;
+ const char *export_name;
+};
+
+static const LoadingScreenInfo loading_screen_infos[] = {
+ { "landscape_launch_screens/iphone_2208x1242", "Default-Landscape-736h@3x.png" },
+ { "landscape_launch_screens/ipad_2732x2048", "Default-Landscape-1366h@2x.png" },
+ { "landscape_launch_screens/ipad_2048x1536", "Default-Landscape@2x.png" },
+
+ { "portrait_launch_screens/iphone_640x1136", "Default-568h@2x.png" },
+ { "portrait_launch_screens/iphone_750x1334", "Default-667h@2x.png" },
+ { "portrait_launch_screens/iphone_1242x2208", "Default-Portrait-736h@3x.png" },
+ { "portrait_launch_screens/ipad_2048x2732", "Default-Portrait-1366h@2x.png" },
+ { "portrait_launch_screens/ipad_1536x2048", "Default-Portrait@2x.png" }
+};
+
+Error EditorExportPlatformIOS::_export_loading_screens(const Ref<EditorExportPreset> &p_preset, const String &p_dest_dir) {
+ DirAccess *da = DirAccess::open(p_dest_dir);
+ ERR_FAIL_COND_V(!da, ERR_CANT_OPEN);
+
+ for (int i = 0; i < sizeof(loading_screen_infos) / sizeof(loading_screen_infos[0]); ++i) {
+ LoadingScreenInfo info = loading_screen_infos[i];
+ String loading_screen_file = p_preset->get(info.preset_key);
+ Error err = da->copy(loading_screen_file, p_dest_dir + info.export_name);
+ if (err) {
+ memdelete(da);
+ String err_str = String("Failed to export loading screen: ") + loading_screen_file;
+ ERR_PRINT(err_str.utf8().get_data());
+ return err;
+ }
+ }
+ memdelete(da);
+
+ return OK;
+}
+
+Error EditorExportPlatformIOS::_walk_dir_recursive(DirAccess *p_da, FileHandler p_handler, void *p_userdata) {
+ Vector<String> dirs;
+ String path;
+ String current_dir = p_da->get_current_dir();
+ p_da->list_dir_begin();
+ while ((path = p_da->get_next()).length() != 0) {
+ if (p_da->current_is_dir()) {
+ if (path != "." && path != "..") {
+ dirs.push_back(path);
+ }
+ } else {
+ Error err = p_handler(current_dir + "/" + path, p_userdata);
+ if (err) {
+ p_da->list_dir_end();
+ return err;
+ }
+ }
+ }
+ p_da->list_dir_end();
+
+ for (int i = 0; i < dirs.size(); ++i) {
+ String dir = dirs[i];
+ p_da->change_dir(dir);
+ Error err = _walk_dir_recursive(p_da, p_handler, p_userdata);
+ p_da->change_dir("..");
+ if (err) {
+ return err;
+ }
+ }
+
+ return OK;
+}
+
+struct CodesignData {
+ const Ref<EditorExportPreset> &preset;
+ bool debug;
+
+ CodesignData(const Ref<EditorExportPreset> &p_preset, bool p_debug)
+ : preset(p_preset), debug(p_debug) {
+ }
+};
+
+Error EditorExportPlatformIOS::_codesign(String p_file, void *p_userdata) {
+ if (p_file.ends_with(".dylib")) {
+ CodesignData *data = (CodesignData *)p_userdata;
+ print_line(String("Signing ") + p_file);
+ List<String> codesign_args;
+ codesign_args.push_back("-f");
+ codesign_args.push_back("-s");
+ codesign_args.push_back(data->preset->get(data->debug ? "application/code_sign_identity_debug" : "application/code_sign_identity_release"));
+ codesign_args.push_back(p_file);
+ return OS::get_singleton()->execute("/usr/bin/codesign", codesign_args, true);
+ }
+ return OK;
+}
+
Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) {
String src_pkg_name;
String dest_dir = p_path.get_base_dir() + "/";
String binary_name = p_path.get_file().get_basename();
- EditorProgress ep("export", "Exporting for iOS", 3);
+ EditorProgress ep("export", "Exporting for iOS", 5);
+
+ String team_id = p_preset->get("application/app_store_team_id");
+ ERR_EXPLAIN("App Store Team ID not specified - cannot configure the project.");
+ ERR_FAIL_COND_V(team_id.length() == 0, ERR_CANT_OPEN);
if (p_debug)
src_pkg_name = p_preset->get("custom_package/debug");
@@ -206,6 +462,15 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
bool found_binary = false;
int total_size = 0;
+ Set<String> files_to_parse;
+ files_to_parse.insert("godot_ios/godot_ios-Info.plist");
+ files_to_parse.insert("godot_ios.xcodeproj/project.pbxproj");
+ files_to_parse.insert("export_options.plist");
+ files_to_parse.insert("godot_ios.xcodeproj/project.xcworkspace/contents.xcworkspacedata");
+ files_to_parse.insert("godot_ios.xcodeproj/xcshareddata/xcschemes/godot_ios.xcscheme");
+
+ print_line("Unzipping...");
+
while (ret == UNZ_OK) {
bool is_execute = false;
@@ -229,12 +494,9 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
file = file.replace_first("iphone/", "");
- if (file == "godot_ios.xcodeproj/project.pbxproj") {
- print_line("parse pbxproj");
- _fix_config_file(p_preset, data, pkg_name, binary_name);
- } else if (file == "godot_ios/godot_ios-Info.plist") {
- print_line("parse plist");
- _fix_config_file(p_preset, data, pkg_name, binary_name);
+ if (files_to_parse.has(file)) {
+ print_line(String("parse ") + file);
+ _fix_config_file(p_preset, data, pkg_name, binary_name, p_debug);
} else if (file.begins_with("godot.iphone")) {
if (file != binary_to_use) {
ret = unzGoToNextFile(src_pkg_zip);
@@ -264,6 +526,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
if (dir_err) {
ERR_PRINTS("Can't create '" + dir_name + "'.");
unzClose(src_pkg_zip);
+ memdelete(tmp_app_path);
return ERR_CANT_CREATE;
}
}
@@ -273,6 +536,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
if (!f) {
ERR_PRINTS("Can't write '" + file + "'.");
unzClose(src_pkg_zip);
+ memdelete(tmp_app_path);
return ERR_CANT_CREATE;
};
f->store_buffer(data.ptr(), data.size());
@@ -295,26 +559,79 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
if (!found_binary) {
ERR_PRINTS("Requested template binary '" + binary_to_use + "' not found. It might be missing from your template archive.");
- unzClose(src_pkg_zip);
+ memdelete(tmp_app_path);
return ERR_FILE_NOT_FOUND;
}
- ep.step("Making PKG", 1);
+ String iconset_dir = dest_dir + binary_name + "/Images.xcassets/AppIcon.appiconset/";
+ Error err = OK;
+ if (!tmp_app_path->dir_exists(iconset_dir)) {
+ Error err = tmp_app_path->make_dir_recursive(iconset_dir);
+ }
+ memdelete(tmp_app_path);
+ if (err)
+ return err;
+
+ err = _export_icons(p_preset, iconset_dir);
+ if (err)
+ return err;
+
+ err = _export_loading_screens(p_preset, dest_dir + binary_name + "/");
+ if (err)
+ return err;
+
+ ep.step("Making .pck", 1);
String pack_path = dest_dir + binary_name + ".pck";
- Error err = save_pack(p_preset, pack_path);
+ err = save_pack(p_preset, pack_path);
+ if (err)
+ return err;
- if (err) {
+ err = export_project_files(p_preset, _export_dylibs, &dest_dir);
+ if (err)
return err;
- }
#ifdef OSX_ENABLED
- /* and open up xcode with our new project.... */
- List<String> args;
- args.push_back(p_path);
- err = OS::get_singleton()->execute("/usr/bin/open", args, false);
+ ep.step("Making .xcarchive", 2);
+ String archive_path = p_path.get_basename() + ".xcarchive";
+ List<String> archive_args;
+ archive_args.push_back("-project");
+ archive_args.push_back(dest_dir + binary_name + ".xcodeproj");
+ archive_args.push_back("-scheme");
+ archive_args.push_back(binary_name);
+ archive_args.push_back("-sdk");
+ archive_args.push_back("iphoneos");
+ archive_args.push_back("-configuration");
+ archive_args.push_back(p_debug ? "Debug" : "Release");
+ archive_args.push_back("-destination");
+ archive_args.push_back("generic/platform=iOS");
+ archive_args.push_back("archive");
+ archive_args.push_back("-archivePath");
+ archive_args.push_back(archive_path);
+ err = OS::get_singleton()->execute("/usr/bin/xcodebuild", archive_args, true);
ERR_FAIL_COND_V(err, err);
+ ep.step("Code-signing dylibs", 3);
+ DirAccess *dylibs_dir = DirAccess::open(archive_path + "/Products/Applications/" + binary_name + ".app/dylibs");
+ ERR_FAIL_COND_V(!dylibs_dir, ERR_CANT_OPEN);
+ CodesignData codesign_data(p_preset, p_debug);
+ err = _walk_dir_recursive(dylibs_dir, _codesign, &codesign_data);
+ memdelete(dylibs_dir);
+ ERR_FAIL_COND_V(err, err);
+
+ ep.step("Making .ipa", 4);
+ List<String> export_args;
+ export_args.push_back("-exportArchive");
+ export_args.push_back("-archivePath");
+ export_args.push_back(archive_path);
+ export_args.push_back("-exportOptionsPlist");
+ export_args.push_back(dest_dir + "export_options.plist");
+ export_args.push_back("-exportPath");
+ export_args.push_back(dest_dir);
+ err = OS::get_singleton()->execute("/usr/bin/xcodebuild", export_args, true);
+ ERR_FAIL_COND_V(err, err);
+#else
+ print_line(".ipa can only be built on macOS. Leaving XCode project without building the package.");
#endif
return OK;
diff --git a/platform/iphone/game_center.mm b/platform/iphone/game_center.mm
index 821ef2a3ab..3955b9f0aa 100644
--- a/platform/iphone/game_center.mm
+++ b/platform/iphone/game_center.mm
@@ -89,7 +89,7 @@ Error GameCenter::connect() {
ret["type"] = "authentication";
if (player.isAuthenticated) {
ret["result"] = "ok";
- ret["player_id"] = player.playerID;
+ ret["player_id"] = [player.playerID UTF8String];
GameCenter::get_singleton()->connected = true;
} else {
ret["result"] = "error";
diff --git a/platform/iphone/gl_view.h b/platform/iphone/gl_view.h
index a9fd8d5711..f7309396c6 100644
--- a/platform/iphone/gl_view.h
+++ b/platform/iphone/gl_view.h
@@ -100,6 +100,8 @@
- (void)destroyFramebuffer;
- (void)audioRouteChangeListenerCallback:(NSNotification *)notification;
+- (void)keyboardOnScreen:(NSNotification *)notification;
+- (void)keyboardHidden:(NSNotification *)notification;
@property NSTimeInterval animationInterval;
@property(nonatomic, assign) BOOL useCADisplayLink;
diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm
index 3e206c3a2c..02da706cc5 100644
--- a/platform/iphone/gl_view.mm
+++ b/platform/iphone/gl_view.mm
@@ -63,6 +63,7 @@ void _pause_video();
void _focus_out_video();
void _unpause_video();
void _stop_video();
+CGFloat _points_to_pixels(CGFloat);
void _show_keyboard(String p_existing) {
keyboard_text = p_existing;
@@ -174,6 +175,19 @@ void _stop_video() {
video_playing = false;
}
+CGFloat _points_to_pixels(CGFloat points) {
+ float pixelPerInch;
+ if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
+ pixelPerInch = 132;
+ } else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
+ pixelPerInch = 163;
+ } else {
+ pixelPerInch = 160;
+ }
+ CGFloat pointsPerInch = 72.0;
+ return (points / pointsPerInch * pixelPerInch);
+}
+
@implementation GLView
@synthesize animationInterval;
@@ -537,6 +551,20 @@ static void clear_touches() {
[self resignFirstResponder];
};
+- (void)keyboardOnScreen:(NSNotification *)notification {
+ NSDictionary *info = notification.userInfo;
+ NSValue *value = info[UIKeyboardFrameEndUserInfoKey];
+
+ CGRect rawFrame = [value CGRectValue];
+ CGRect keyboardFrame = [self convertRect:rawFrame fromView:nil];
+
+ OSIPhone::get_singleton()->set_virtual_keyboard_height(_points_to_pixels(keyboardFrame.size.height));
+}
+
+- (void)keyboardHidden:(NSNotification *)notification {
+ OSIPhone::get_singleton()->set_virtual_keyboard_height(0);
+}
+
- (void)deleteBackward {
if (keyboard_text.length())
keyboard_text.erase(keyboard_text.length() - 1, 1);
@@ -606,6 +634,18 @@ static void clear_touches() {
name:AVAudioSessionRouteChangeNotification
object:nil];
+ printf("******** adding observer for keyboard show/hide\n");
+ [[NSNotificationCenter defaultCenter]
+ addObserver:self
+ selector:@selector(keyboardOnScreen:)
+ name:UIKeyboardDidShowNotification
+ object:nil];
+ [[NSNotificationCenter defaultCenter]
+ addObserver:self
+ selector:@selector(keyboardHidden:)
+ name:UIKeyboardDidHideNotification
+ object:nil];
+
//self.autoresizesSubviews = YES;
//[self setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleWidth];
diff --git a/platform/iphone/godot_iphone.cpp b/platform/iphone/godot_iphone.cpp
index 8c6d6d8da4..7d21d35e18 100644
--- a/platform/iphone/godot_iphone.cpp
+++ b/platform/iphone/godot_iphone.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "main/main.h"
#include "os_iphone.h"
+#include "ustring.h"
#include <stdio.h>
#include <string.h>
@@ -41,9 +42,9 @@ int add_path(int p_argc, char **p_args);
int add_cmdline(int p_argc, char **p_args);
};
-int iphone_main(int, int, int, char **);
+int iphone_main(int, int, int, char **, String);
-int iphone_main(int width, int height, int argc, char **argv) {
+int iphone_main(int width, int height, int argc, char **argv, String data_dir) {
int len = strlen(argv[0]);
@@ -63,7 +64,7 @@ int iphone_main(int width, int height, int argc, char **argv) {
char cwd[512];
getcwd(cwd, sizeof(cwd));
printf("cwd %s\n", cwd);
- os = new OSIPhone(width, height);
+ os = new OSIPhone(width, height, data_dir);
char *fargv[64];
for (int i = 0; i < argc; i++) {
diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp
index 0e3eeed114..08792b8631 100644
--- a/platform/iphone/os_iphone.cpp
+++ b/platform/iphone/os_iphone.cpp
@@ -35,13 +35,13 @@
#include "servers/visual/visual_server_raster.h"
//#include "servers/visual/visual_server_wrap_mt.h"
-#include "audio_driver_iphone.h"
#include "main/main.h"
#include "core/io/file_access_pack.h"
#include "core/os/dir_access.h"
#include "core/os/file_access.h"
#include "core/project_settings.h"
+#include "drivers/unix/syslog_logger.h"
#include "sem_iphone.h"
@@ -97,8 +97,17 @@ void OSIPhone::initialize_core() {
OS_Unix::initialize_core();
SemaphoreIphone::make_default();
+
+ set_data_dir(data_dir);
};
+void OSIPhone::initialize_logger() {
+ Vector<Logger *> loggers;
+ loggers.push_back(memnew(SyslogLogger));
+ loggers.push_back(memnew(RotatedFileLogger("user://logs/log.txt")));
+ _set_logger(memnew(CompositeLogger(loggers)));
+}
+
void OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
supported_orientations = 0;
@@ -124,9 +133,8 @@ void OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p_
// reset this to what it should be, it will have been set to 0 after visual_server->init() is called
RasterizerStorageGLES3::system_fbo = gl_view_base_fb;
- audio_driver = memnew(AudioDriverIphone);
- audio_driver->set_singleton();
- audio_driver->init();
+ AudioDriverManager::add_driver(&audio_driver);
+ AudioDriverManager::initialize(p_audio_driver);
// init physics servers
physics_server = memnew(PhysicsServerSW);
@@ -457,6 +465,14 @@ void OSIPhone::hide_virtual_keyboard() {
_hide_keyboard();
};
+void OSIPhone::set_virtual_keyboard_height(int p_height) {
+ virtual_keyboard_height = p_height;
+}
+
+int OSIPhone::get_virtual_keyboard_height() const {
+ return virtual_keyboard_height;
+}
+
Error OSIPhone::shell_open(String p_uri) {
return _shell_open(p_uri);
};
@@ -558,7 +574,7 @@ bool OSIPhone::_check_internal_feature_support(const String &p_feature) {
return p_feature == "mobile" || p_feature == "etc" || p_feature == "pvrtc" || p_feature == "etc2";
}
-OSIPhone::OSIPhone(int width, int height) {
+OSIPhone::OSIPhone(int width, int height, String p_data_dir) {
main_loop = NULL;
visual_server = NULL;
@@ -570,6 +586,13 @@ OSIPhone::OSIPhone(int width, int height) {
vm.resizable = false;
set_video_mode(vm);
event_count = 0;
+ virtual_keyboard_height = 0;
+
+ // can't call set_data_dir from here, since it requires DirAccess
+ // which is initialized in initialize_core
+ data_dir = p_data_dir;
+
+ _set_logger(memnew(SyslogLogger));
};
OSIPhone::~OSIPhone() {
diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h
index 475dceebf2..e70ac9ba98 100644
--- a/platform/iphone/os_iphone.h
+++ b/platform/iphone/os_iphone.h
@@ -32,6 +32,7 @@
#ifndef OS_IPHONE_H
#define OS_IPHONE_H
+#include "drivers/coreaudio/audio_driver_coreaudio.h"
#include "drivers/unix/os_unix.h"
#include "os/input.h"
@@ -46,8 +47,6 @@
#include "servers/visual/rasterizer.h"
#include "servers/visual_server.h"
-class AudioDriverIphone;
-
class OSIPhone : public OS_Unix {
public:
@@ -70,7 +69,7 @@ private:
PhysicsServer *physics_server;
Physics2DServer *physics_2d_server;
- AudioDriverIphone *audio_driver;
+ AudioDriverCoreAudio audio_driver;
#ifdef GAME_CENTER_ENABLED
GameCenter *game_center;
@@ -91,6 +90,7 @@ private:
virtual VideoMode get_default_video_mode() const;
+ virtual void initialize_logger();
virtual void initialize_core();
virtual void initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
@@ -124,6 +124,8 @@ private:
InputDefault *input;
+ int virtual_keyboard_height;
+
public:
bool iterate();
@@ -133,6 +135,7 @@ public:
void mouse_move(int p_idx, int p_prev_x, int p_prev_y, int p_x, int p_y, bool p_use_as_mouse);
void touches_cancelled();
void key(uint32_t p_key, bool p_pressed);
+ void set_virtual_keyboard_height(int p_height);
int set_base_framebuffer(int p_fb);
@@ -168,6 +171,7 @@ public:
virtual bool has_virtual_keyboard() const;
virtual void show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect = Rect2());
virtual void hide_virtual_keyboard();
+ virtual int get_virtual_keyboard_height() const;
virtual void set_cursor_shape(CursorShape p_shape);
@@ -197,7 +201,7 @@ public:
virtual void native_video_stop();
virtual bool _check_internal_feature_support(const String &p_feature);
- OSIPhone(int width, int height);
+ OSIPhone(int width, int height, String p_data_dir);
~OSIPhone();
};
diff --git a/platform/javascript/SCsub b/platform/javascript/SCsub
index e282041745..f01d9367d2 100644
--- a/platform/javascript/SCsub
+++ b/platform/javascript/SCsub
@@ -29,7 +29,7 @@ zip_dir = target_dir.Dir('.javascript_zip')
zip_files = env.InstallAs(zip_dir.File('godot.html'), '#misc/dist/html/default.html')
implicit_targets = []
-if env['wasm'] == 'yes':
+if env['wasm']:
wasm = target_dir.File(basename + '.wasm')
implicit_targets.append(wasm)
zip_files.append(InstallAs(zip_dir.File('godot.wasm'), wasm))
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py
index bea8f156af..cc29ad8956 100644
--- a/platform/javascript/detect.py
+++ b/platform/javascript/detect.py
@@ -17,18 +17,18 @@ def can_build():
def get_opts():
-
+ from SCons.Variables import BoolVariable
return [
- ['wasm', 'Compile to WebAssembly', 'no'],
- ['javascript_eval', 'Enable JavaScript eval interface', 'yes'],
+ BoolVariable('wasm', 'Compile to WebAssembly', False),
+ BoolVariable('javascript_eval', 'Enable JavaScript eval interface', True),
]
def get_flags():
return [
- ('tools', 'no'),
- ('module_theora_enabled', 'no'),
+ ('tools', False),
+ ('module_theora_enabled', False),
]
@@ -95,7 +95,7 @@ def configure(env):
# These flags help keep the file size down
env.Append(CPPFLAGS=["-fno-exceptions", '-DNO_SAFE_CAST', '-fno-rtti'])
- if env['javascript_eval'] == 'yes':
+ if env['javascript_eval']:
env.Append(CPPFLAGS=['-DJAVASCRIPT_EVAL_ENABLED'])
## Link flags
@@ -103,7 +103,7 @@ def configure(env):
env.Append(LINKFLAGS=['-s', 'EXTRA_EXPORTED_RUNTIME_METHODS="[\'FS\']"'])
env.Append(LINKFLAGS=['-s', 'USE_WEBGL2=1'])
- if (env['wasm'] == 'yes'):
+ if env['wasm']:
env.Append(LINKFLAGS=['-s', 'BINARYEN=1'])
# In contrast to asm.js, enabling memory growth on WebAssembly has no
# major performance impact, and causes only a negligible increase in
@@ -116,5 +116,5 @@ def configure(env):
env.Append(LINKFLAGS=['--memory-init-file', '1'])
# TODO: Move that to opus module's config
- if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"):
+ if 'module_opus_enabled' in env and env['module_opus_enabled']:
env.opus_fixed_point = "yes"
diff --git a/platform/javascript/engine.js b/platform/javascript/engine.js
index 552f5a7e02..99d1c20bbd 100644
--- a/platform/javascript/engine.js
+++ b/platform/javascript/engine.js
@@ -84,10 +84,10 @@
rtenvOpts.print = stdout;
if (typeof stderr === 'function')
rtenvOpts.printErr = stderr;
- if (typeof WebAssembly === 'object' && initializer instanceof WebAssembly.Module) {
+ if (typeof WebAssembly === 'object' && initializer instanceof ArrayBuffer) {
rtenvOpts.instantiateWasm = function(imports, onSuccess) {
WebAssembly.instantiate(initializer, imports).then(function(result) {
- onSuccess(result);
+ onSuccess(result.instance);
});
return {};
};
@@ -241,7 +241,7 @@
return Promise.reject(new Error("Browser doesn't support WebAssembly"));
// TODO cache/retrieve module to/from idb
engineLoadPromise = loadPromise(basePath + '.wasm').then(function(xhr) {
- return WebAssembly.compile(xhr.response);
+ return xhr.response;
});
} else {
var asmjsPromise = loadPromise(basePath + '.asm.js').then(function(xhr) {
diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp
index 4c948bf181..ed4f416cfd 100644
--- a/platform/javascript/javascript_main.cpp
+++ b/platform/javascript/javascript_main.cpp
@@ -39,8 +39,13 @@ static void main_loop() {
os->main_loop_iterate();
}
-extern "C" void main_after_fs_sync() {
+extern "C" void main_after_fs_sync(char *p_idbfs_err) {
+ String idbfs_err = String::utf8(p_idbfs_err);
+ if (!idbfs_err.empty()) {
+ print_line("IndexedDB not available: " + idbfs_err);
+ }
+ os->set_idbfs_available(idbfs_err.empty());
// Ease up compatibility
ResourceLoader::set_abort_on_missing_resources(false);
Main::start();
@@ -60,14 +65,7 @@ int main(int argc, char *argv[]) {
FS.mkdir('/userfs');
FS.mount(IDBFS, {}, '/userfs');
FS.syncfs(true, function(err) {
- if (err) {
- Module.setStatus('Failed to load persistent data\nPlease allow (third-party) cookies');
- Module.printErr('Failed to populate IDB file system: ' + err.message);
- Module.noExitRuntime = false;
- } else {
- Module.print('Successfully populated IDB file system');
- ccall('main_after_fs_sync', null);
- }
+ Module['ccall']('main_after_fs_sync', null, ['string'], [err ? err.message : ""])
});
);
/* clang-format on */
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index f103035b27..f6446e77da 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -85,6 +85,10 @@ void OS_JavaScript::initialize_core() {
FileAccess::make_default<FileAccessBufferedFA<FileAccessUnix> >(FileAccess::ACCESS_RESOURCES);
}
+void OS_JavaScript::initialize_logger() {
+ _set_logger(memnew(StdLogger));
+}
+
void OS_JavaScript::set_opengl_extensions(const char *p_gl_extensions) {
ERR_FAIL_COND(!p_gl_extensions);
@@ -821,7 +825,7 @@ bool OS_JavaScript::main_loop_iterate() {
if (!main_loop)
return false;
- if (time_to_save_sync >= 0) {
+ if (idbfs_available && time_to_save_sync >= 0) {
int64_t newtime = get_ticks_msec();
int64_t elapsed = newtime - last_sync_time;
last_sync_time = newtime;
@@ -911,10 +915,10 @@ String OS_JavaScript::get_executable_path() const {
void OS_JavaScript::_close_notification_funcs(const String &p_file, int p_flags) {
- print_line("close " + p_file + " flags " + itos(p_flags));
- if (p_file.begins_with("/userfs") && p_flags & FileAccess::WRITE) {
- static_cast<OS_JavaScript *>(get_singleton())->last_sync_time = OS::get_singleton()->get_ticks_msec();
- static_cast<OS_JavaScript *>(get_singleton())->time_to_save_sync = 5000; //five seconds since last save
+ OS_JavaScript *os = static_cast<OS_JavaScript *>(get_singleton());
+ if (os->idbfs_available && p_file.begins_with("/userfs") && p_flags & FileAccess::WRITE) {
+ os->last_sync_time = OS::get_singleton()->get_ticks_msec();
+ os->time_to_save_sync = 5000; //five seconds since last save
}
}
@@ -989,6 +993,16 @@ bool OS_JavaScript::_check_internal_feature_support(const String &p_feature) {
return p_feature == "web" || p_feature == "s3tc"; // TODO check for these features really being available
}
+void OS_JavaScript::set_idbfs_available(bool p_idbfs_available) {
+
+ idbfs_available = p_idbfs_available;
+}
+
+bool OS_JavaScript::is_userfs_persistent() const {
+
+ return idbfs_available;
+}
+
OS_JavaScript::OS_JavaScript(const char *p_execpath, GetDataDirFunc p_get_data_dir_func) {
set_cmdline(p_execpath, get_cmdline_args());
main_loop = NULL;
@@ -1000,6 +1014,7 @@ OS_JavaScript::OS_JavaScript(const char *p_execpath, GetDataDirFunc p_get_data_d
get_data_dir_func = p_get_data_dir_func;
FileAccessUnix::close_notification_func = _close_notification_funcs;
+ idbfs_available = false;
time_to_save_sync = -1;
}
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index 4c6469cb58..1c939d3fd5 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -49,6 +49,7 @@ typedef String (*GetDataDirFunc)();
class OS_JavaScript : public OS_Unix {
+ bool idbfs_available;
int64_t time_to_save_sync;
int64_t last_sync_time;
@@ -92,6 +93,7 @@ public:
virtual int get_audio_driver_count() const;
virtual const char *get_audio_driver_name(int p_driver) const;
+ virtual void initialize_logger();
virtual void initialize_core();
virtual void initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
@@ -104,11 +106,6 @@ public:
//static OS* get_singleton();
- 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) {
-
- OS::print_error(p_function, p_file, p_line, p_code, p_rationale, p_type);
- }
-
virtual void alert(const String &p_alert, const String &p_title = "ALERT!");
virtual void set_mouse_mode(MouseMode p_mode);
@@ -140,6 +137,8 @@ public:
virtual bool can_draw() const;
+ virtual bool is_userfs_persistent() const;
+
virtual void set_cursor_shape(CursorShape p_shape);
void main_loop_begin();
@@ -171,6 +170,8 @@ public:
virtual bool _check_internal_feature_support(const String &p_feature);
+ void set_idbfs_available(bool p_idbfs_available);
+
OS_JavaScript(const char *p_execpath, GetDataDirFunc p_get_data_dir_func);
~OS_JavaScript();
};
diff --git a/platform/osx/SCsub b/platform/osx/SCsub
index 27bffbe80e..be3950bc6d 100644
--- a/platform/osx/SCsub
+++ b/platform/osx/SCsub
@@ -10,7 +10,6 @@ files = [
'crash_handler_osx.mm',
'os_osx.mm',
'godot_main_osx.mm',
- 'audio_driver_osx.cpp',
'sem_osx.cpp',
'dir_access_osx.mm',
'joypad_osx.cpp',
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index 24302b5ff9..31032659b6 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -19,10 +19,11 @@ def can_build():
def get_opts():
+ from SCons.Variables import EnumVariable
return [
('osxcross_sdk', 'OSXCross SDK version', 'darwin14'),
- ('debug_symbols', 'Add debug symbols to release version (yes/no/full)', 'yes'),
+ EnumVariable('debug_symbols', 'Add debug symbols to release version', 'yes', ('yes', 'no', 'full')),
]
@@ -61,7 +62,7 @@ def configure(env):
## Compiler configuration
- if (not os.environ.has_key("OSXCROSS_ROOT")): # regular native build
+ if "OSXCROSS_ROOT" not in os.environ: # regular native build
if (env["bits"] == "fat"):
env.Append(CCFLAGS=['-arch', 'i386', '-arch', 'x86_64'])
env.Append(LINKFLAGS=['-arch', 'i386', '-arch', 'x86_64'])
@@ -96,13 +97,13 @@ def configure(env):
## Dependencies
- if (env['builtin_libtheora'] != 'no'):
+ if env['builtin_libtheora']:
env["x86_libtheora_opt_gcc"] = True
## Flags
env.Append(CPPPATH=['#platform/osx'])
- env.Append(CPPFLAGS=['-DOSX_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DAPPLE_STYLE_KEYS'])
+ env.Append(CPPFLAGS=['-DOSX_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DAPPLE_STYLE_KEYS', '-DCOREAUDIO_ENABLED'])
env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'OpenGL', '-framework', 'AGL', '-framework', 'AudioUnit', '-framework', 'CoreAudio', '-lz', '-framework', 'IOKit', '-framework', 'ForceFeedback'])
env.Append(LIBS=['pthread'])
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index 2ec76fe0dd..0ba0ddec7d 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -53,9 +53,16 @@ class EditorExportPlatformOSX : public EditorExportPlatform {
void _fix_plist(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &plist, const String &p_binary);
void _make_icon(const Ref<Image> &p_icon, Vector<uint8_t> &p_data);
-#ifdef OSX_ENABLED
+
Error _code_sign(const Ref<EditorExportPreset> &p_preset, const String &p_path);
Error _create_dmg(const String &p_dmg_path, const String &p_pkg_name, const String &p_app_path_name);
+
+#ifdef OSX_ENABLED
+ bool use_codesign() const { return true; }
+ bool use_dmg() const { return true; }
+#else
+ bool use_codesign() const { return false; }
+ bool use_dmg() const { return false; }
#endif
protected:
@@ -67,11 +74,7 @@ public:
virtual String get_os_name() const { return "OSX"; }
virtual Ref<Texture> get_logo() const { return logo; }
-#ifdef OSX_ENABLED
- virtual String get_binary_extension() const { return "dmg"; }
-#else
- virtual String get_binary_extension() const { return "zip"; }
-#endif
+ virtual String get_binary_extension() const { return use_dmg() ? "dmg" : "zip"; }
virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0);
virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const;
@@ -97,6 +100,16 @@ void EditorExportPlatformOSX::get_preset_features(const Ref<EditorExportPreset>
if (p_preset->get("texture_format/etc2")) {
r_features->push_back("etc2");
}
+
+ int bits = p_preset->get("application/bits_mode");
+
+ if (bits == 0 || bits == 1) {
+ r_features->push_back("64");
+ }
+
+ if (bits == 0 || bits == 2) {
+ r_features->push_back("32");
+ }
}
void EditorExportPlatformOSX::get_export_options(List<ExportOption> *r_options) {
@@ -210,7 +223,6 @@ void EditorExportPlatformOSX::_fix_plist(const Ref<EditorExportPreset> &p_preset
}
}
-#ifdef OSX_ENABLED
/**
If we're running the OSX version of the Godot editor we'll:
- export our application bundle to a temporary folder
@@ -220,6 +232,7 @@ void EditorExportPlatformOSX::_fix_plist(const Ref<EditorExportPreset> &p_preset
Error EditorExportPlatformOSX::_code_sign(const Ref<EditorExportPreset> &p_preset, const String &p_path) {
List<String> args;
+
if (p_preset->get("codesign/entitlements") != "") {
/* this should point to our entitlements.plist file that sandboxes our application, I don't know if this should also be placed in our app bundle */
args.push_back("-entitlements");
@@ -229,14 +242,25 @@ Error EditorExportPlatformOSX::_code_sign(const Ref<EditorExportPreset> &p_prese
args.push_back(p_preset->get("codesign/identity"));
args.push_back("-v"); /* provide some more feedback */
args.push_back(p_path);
- Error err = OS::get_singleton()->execute("/usr/bin/codesign", args, true);
- ERR_FAIL_COND_V(err, err);
+
+ String str;
+ Error err = OS::get_singleton()->execute("/usr/bin/codesign", args, true, NULL, &str, NULL, true);
+ ERR_FAIL_COND_V(err != OK, err);
+
+ print_line("codesign: " + str);
+ if (str.find("no identity found") != -1) {
+ EditorNode::add_io_error("codesign: no identity found");
+ return FAILED;
+ }
return OK;
}
Error EditorExportPlatformOSX::_create_dmg(const String &p_dmg_path, const String &p_pkg_name, const String &p_app_path_name) {
List<String> args;
+
+ OS::get_singleton()->move_to_trash(p_dmg_path);
+
args.push_back("create");
args.push_back(p_dmg_path);
args.push_back("-volname");
@@ -245,8 +269,20 @@ Error EditorExportPlatformOSX::_create_dmg(const String &p_dmg_path, const Strin
args.push_back("HFS+");
args.push_back("-srcfolder");
args.push_back(p_app_path_name);
- Error err = OS::get_singleton()->execute("/usr/bin/hdiutil", args, true);
- ERR_FAIL_COND_V(err, err);
+
+ String str;
+ Error err = OS::get_singleton()->execute("/usr/bin/hdiutil", args, true, NULL, &str, NULL, true);
+ ERR_FAIL_COND_V(err != OK, err);
+
+ print_line("hdiutil returned: " + str);
+ if (str.find("create failed") != -1) {
+ if (str.find("File exists") != -1) {
+ EditorNode::add_io_error("hdiutil: create failed - file exists");
+ } else {
+ EditorNode::add_io_error("hdiutil: create failed");
+ }
+ return FAILED;
+ }
return OK;
}
@@ -299,28 +335,45 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
else
pkg_name = "Unnamed";
- // We're on OSX so we can export to DMG, but first we create our application bundle
- String tmp_app_path_name = p_path.get_base_dir() + "/" + pkg_name + ".app";
- print_line("Exporting to " + tmp_app_path_name);
- DirAccess *tmp_app_path = DirAccess::create_for_path(tmp_app_path_name);
- ERR_FAIL_COND_V(!tmp_app_path, ERR_CANT_CREATE)
+ Error err = OK;
+ String tmp_app_path_name = "";
+ zlib_filefunc_def io2 = io;
+ FileAccess *dst_f = NULL;
+ io2.opaque = &dst_f;
+ zipFile dst_pkg_zip = NULL;
+
+ if (use_dmg()) {
+ // We're on OSX so we can export to DMG, but first we create our application bundle
+ tmp_app_path_name = EditorSettings::get_singleton()->get_settings_path() + "/tmp/" + pkg_name + ".app";
+ print_line("Exporting to " + tmp_app_path_name);
+ DirAccess *tmp_app_path = DirAccess::create_for_path(tmp_app_path_name);
+ if (!tmp_app_path) {
+ err = ERR_CANT_CREATE;
+ }
- ///@TODO We should delete the existing application bundle especially if we attempt to code sign it, but what is a safe way to do this? Maybe call system function so it moves to trash?
- // tmp_app_path->erase_contents_recursive();
+ // Create our folder structure or rely on unzip?
+ if (err == OK) {
+ print_line("Creating " + tmp_app_path_name + "/Contents/MacOS");
+ err = tmp_app_path->make_dir_recursive(tmp_app_path_name + "/Contents/MacOS");
+ }
- // Create our folder structure or rely on unzip?
- print_line("Creating " + tmp_app_path_name + "/Contents/MacOS");
- Error dir_err = tmp_app_path->make_dir_recursive(tmp_app_path_name + "/Contents/MacOS");
- ERR_FAIL_COND_V(dir_err, ERR_CANT_CREATE)
- print_line("Creating " + tmp_app_path_name + "/Contents/Resources");
- dir_err = tmp_app_path->make_dir_recursive(tmp_app_path_name + "/Contents/Resources");
- ERR_FAIL_COND_V(dir_err, ERR_CANT_CREATE)
+ if (err == OK) {
+ print_line("Creating " + tmp_app_path_name + "/Contents/Resources");
+ err = tmp_app_path->make_dir_recursive(tmp_app_path_name + "/Contents/Resources");
+ }
+ } else {
+ // Open our destination zip file
+ dst_pkg_zip = zipOpen2(p_path.utf8().get_data(), APPEND_STATUS_CREATE, NULL, &io2);
+ if (!dst_pkg_zip) {
+ err = ERR_CANT_CREATE;
+ }
+ }
- /* Now process our template */
+ // Now process our template
bool found_binary = false;
int total_size = 0;
- while (ret == UNZ_OK) {
+ while (ret == UNZ_OK && err == OK) {
bool is_execute = false;
//get filename
@@ -382,287 +435,152 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
print_line("ADDING: " + file + " size: " + itos(data.size()));
total_size += data.size();
- /* write it into our application bundle */
- file = tmp_app_path_name + "/" + file;
-
- /* write the file, need to add chmod */
- FileAccess *f = FileAccess::open(file, FileAccess::WRITE);
- ERR_FAIL_COND_V(!f, ERR_CANT_CREATE)
- f->store_buffer(data.ptr(), data.size());
- f->close();
- memdelete(f);
-
- if (is_execute) {
- // we need execute rights on this file
- chmod(file.utf8().get_data(), 0755);
+ if (use_dmg()) {
+ // write it into our application bundle
+ file = tmp_app_path_name + "/" + file;
+
+ // write the file, need to add chmod
+ FileAccess *f = FileAccess::open(file, FileAccess::WRITE);
+ if (f) {
+ f->store_buffer(data.ptr(), data.size());
+ f->close();
+ if (is_execute) {
+ // Chmod with 0755 if the file is executable
+ f->_chmod(file, 0755);
+ }
+ memdelete(f);
+ } else {
+ err = ERR_CANT_CREATE;
+ }
} else {
- // seems to already be set correctly
- // chmod(file.utf8().get_data(), 0644);
+ // add it to our zip file
+ file = pkg_name + ".app/" + file;
+
+ zip_fileinfo fi;
+ fi.tmz_date.tm_hour = info.tmu_date.tm_hour;
+ fi.tmz_date.tm_min = info.tmu_date.tm_min;
+ fi.tmz_date.tm_sec = info.tmu_date.tm_sec;
+ fi.tmz_date.tm_mon = info.tmu_date.tm_mon;
+ fi.tmz_date.tm_mday = info.tmu_date.tm_mday;
+ fi.tmz_date.tm_year = info.tmu_date.tm_year;
+ fi.dosDate = info.dosDate;
+ fi.internal_fa = info.internal_fa;
+ fi.external_fa = info.external_fa;
+
+ int zerr = zipOpenNewFileInZip(dst_pkg_zip,
+ file.utf8().get_data(),
+ &fi,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ NULL,
+ Z_DEFLATED,
+ Z_DEFAULT_COMPRESSION);
+
+ print_line("OPEN ERR: " + itos(zerr));
+ zerr = zipWriteInFileInZip(dst_pkg_zip, data.ptr(), data.size());
+ print_line("WRITE ERR: " + itos(zerr));
+ zipCloseFileInZip(dst_pkg_zip);
}
}
ret = unzGoToNextFile(src_pkg_zip);
}
- /* we're done with our source zip */
+ // we're done with our source zip
unzClose(src_pkg_zip);
if (!found_binary) {
ERR_PRINTS("Requested template binary '" + binary_to_use + "' not found. It might be missing from your template archive.");
- unzClose(src_pkg_zip);
- return ERR_FILE_NOT_FOUND;
- }
-
- ep.step("Making PKG", 1);
-
- String pack_path = tmp_app_path_name + "/Contents/Resources/" + pkg_name + ".pck";
- Error err = save_pack(p_preset, pack_path);
- // chmod(pack_path.utf8().get_data(), 0644);
-
- if (err) {
- return err;
- }
-
- /* see if we can code sign our new package */
- if (p_preset->get("codesign/identity") != "") {
- ep.step("Code signing bundle", 2);
-
- /* the order in which we code sign is important, this is a bit of a shame or we could do this in our loop that extracts the files from our ZIP */
-
- // start with our application
- err = _code_sign(p_preset, tmp_app_path_name + "/Contents/MacOS/" + pkg_name);
- ERR_FAIL_COND_V(err, err);
-
- ///@TODO we should check the contents of /Contents/Frameworks for frameworks to sign
-
- // we should probably loop through all resources and sign them?
- err = _code_sign(p_preset, tmp_app_path_name + "/Contents/Resources/icon.icns");
- ERR_FAIL_COND_V(err, err);
- err = _code_sign(p_preset, pack_path);
- ERR_FAIL_COND_V(err, err);
- err = _code_sign(p_preset, tmp_app_path_name + "/Contents/Info.plist");
- ERR_FAIL_COND_V(err, err);
- }
-
- /* and finally create a DMG */
- ep.step("Making DMG", 3);
- err = _create_dmg(p_path, pkg_name, tmp_app_path_name);
- ERR_FAIL_COND_V(err, err);
-
- return OK;
-}
-
-#else
-
-/**
- When exporting for OSX from any other platform we don't have access to code signing or creating DMGs so we'll wrap the bundle into a zip file.
-
- Should probably find a nicer way to have just one export method instead of duplicating the method like this but I would the code got very
- messy with switches inside of it.
-**/
-Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) {
-
- String src_pkg_name;
-
- EditorProgress ep("export", "Exporting for OSX", 104);
-
- if (p_debug)
- src_pkg_name = p_preset->get("custom_package/debug");
- else
- src_pkg_name = p_preset->get("custom_package/release");
-
- if (src_pkg_name == "") {
- String err;
- src_pkg_name = find_export_template("osx.zip", &err);
- if (src_pkg_name == "") {
- EditorNode::add_io_error(err);
- return ERR_FILE_NOT_FOUND;
- }
- }
-
- FileAccess *src_f = NULL;
- zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
-
- ep.step("Creating app", 0);
-
- unzFile src_pkg_zip = unzOpen2(src_pkg_name.utf8().get_data(), &io);
- if (!src_pkg_zip) {
-
- EditorNode::add_io_error("Could not find template app to export:\n" + src_pkg_name);
- return ERR_FILE_NOT_FOUND;
+ err = ERR_FILE_NOT_FOUND;
}
- ERR_FAIL_COND_V(!src_pkg_zip, ERR_CANT_OPEN);
- int ret = unzGoToFirstFile(src_pkg_zip);
+ if (err == OK) {
+ ep.step("Making PKG", 1);
- String binary_to_use = "godot_osx_" + String(p_debug ? "debug" : "release") + ".";
- int bits_mode = p_preset->get("application/bits_mode");
- binary_to_use += String(bits_mode == 0 ? "fat" : bits_mode == 1 ? "64" : "32");
+ if (use_dmg()) {
+ String pack_path = tmp_app_path_name + "/Contents/Resources/" + pkg_name + ".pck";
+ err = save_pack(p_preset, pack_path);
- print_line("binary: " + binary_to_use);
- String pkg_name;
- if (p_preset->get("application/name") != "")
- pkg_name = p_preset->get("application/name"); // app_name
- else if (String(ProjectSettings::get_singleton()->get("application/config/name")) != "")
- pkg_name = String(ProjectSettings::get_singleton()->get("application/config/name"));
- else
- pkg_name = "Unnamed";
-
- /* Open our destination zip file */
- zlib_filefunc_def io2 = io;
- FileAccess *dst_f = NULL;
- io2.opaque = &dst_f;
- zipFile dst_pkg_zip = zipOpen2(p_path.utf8().get_data(), APPEND_STATUS_CREATE, NULL, &io2);
+ // see if we can code sign our new package
+ String identity = p_preset->get("codesign/identity");
+ if (err == OK && identity != "") {
+ ep.step("Code signing bundle", 2);
- bool found_binary = false;
+ // the order in which we code sign is important, this is a bit of a shame or we could do this in our loop that extracts the files from our ZIP
- while (ret == UNZ_OK) {
-
- //get filename
- unz_file_info info;
- char fname[16384];
- ret = unzGetCurrentFileInfo(src_pkg_zip, &info, fname, 16384, NULL, 0, NULL, 0);
+ // start with our application
+ err = _code_sign(p_preset, tmp_app_path_name + "/Contents/MacOS/" + pkg_name);
- String file = fname;
-
- print_line("READ: " + file);
- Vector<uint8_t> data;
- data.resize(info.uncompressed_size);
-
- //read
- unzOpenCurrentFile(src_pkg_zip);
- unzReadCurrentFile(src_pkg_zip, data.ptr(), data.size());
- unzCloseCurrentFile(src_pkg_zip);
-
- //write
+ ///@TODO we should check the contents of /Contents/Frameworks for frameworks to sign
+ }
- file = file.replace_first("osx_template.app/", "");
+ if (err == OK && identity != "") {
+ // we should probably loop through all resources and sign them?
+ err = _code_sign(p_preset, tmp_app_path_name + "/Contents/Resources/icon.icns");
+ }
- if (file == "Contents/Info.plist") {
- print_line("parse plist");
- _fix_plist(p_preset, data, pkg_name);
- }
+ if (err == OK && identity != "") {
+ err = _code_sign(p_preset, pack_path);
+ }
- if (file.begins_with("Contents/MacOS/godot_")) {
- if (file != "Contents/MacOS/" + binary_to_use) {
- ret = unzGoToNextFile(src_pkg_zip);
- continue; //ignore!
+ if (err == OK && identity != "") {
+ err = _code_sign(p_preset, tmp_app_path_name + "/Contents/Info.plist");
}
- found_binary = true;
- file = "Contents/MacOS/" + pkg_name;
- }
- if (file == "Contents/Resources/icon.icns") {
- //see if there is an icon
- String iconpath;
- if (p_preset->get("application/icon") != "")
- iconpath = p_preset->get("application/icon");
- else
- iconpath = ProjectSettings::get_singleton()->get("application/config/icon");
- print_line("icon? " + iconpath);
- if (iconpath != "") {
- Ref<Image> icon;
- icon.instance();
- icon->load(iconpath);
- if (!icon->empty()) {
- print_line("loaded?");
- _make_icon(icon, data);
- }
+ // and finally create a DMG
+ if (err == OK) {
+ ep.step("Making DMG", 3);
+ err = _create_dmg(p_path, pkg_name, tmp_app_path_name);
}
- //bleh?
- }
- if (data.size() > 0) {
- print_line("ADDING: " + file + " size: " + itos(data.size()));
+ // Clean up temporary .app dir
+ OS::get_singleton()->move_to_trash(tmp_app_path_name);
+ } else {
- /* add it to our zip file */
- file = pkg_name + ".app/" + file;
-
- zip_fileinfo fi;
- fi.tmz_date.tm_hour = info.tmu_date.tm_hour;
- fi.tmz_date.tm_min = info.tmu_date.tm_min;
- fi.tmz_date.tm_sec = info.tmu_date.tm_sec;
- fi.tmz_date.tm_mon = info.tmu_date.tm_mon;
- fi.tmz_date.tm_mday = info.tmu_date.tm_mday;
- fi.tmz_date.tm_year = info.tmu_date.tm_year;
- fi.dosDate = info.dosDate;
- fi.internal_fa = info.internal_fa;
- fi.external_fa = info.external_fa;
-
- int err = zipOpenNewFileInZip(dst_pkg_zip,
- file.utf8().get_data(),
- &fi,
- NULL,
- 0,
- NULL,
- 0,
- NULL,
- Z_DEFLATED,
- Z_DEFAULT_COMPRESSION);
-
- print_line("OPEN ERR: " + itos(err));
- err = zipWriteInFileInZip(dst_pkg_zip, data.ptr(), data.size());
- print_line("WRITE ERR: " + itos(err));
- zipCloseFileInZip(dst_pkg_zip);
+ String pack_path = EditorSettings::get_singleton()->get_settings_path() + "/tmp/" + pkg_name + ".pck";
+ Error err = save_pack(p_preset, pack_path);
+
+ if (err == OK) {
+ zipOpenNewFileInZip(dst_pkg_zip,
+ (pkg_name + ".app/Contents/Resources/" + pkg_name + ".pck").utf8().get_data(),
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ NULL,
+ Z_DEFLATED,
+ Z_DEFAULT_COMPRESSION);
+
+ FileAccess *pf = FileAccess::open(pack_path, FileAccess::READ);
+ if (pf) {
+ const int BSIZE = 16384;
+ uint8_t buf[BSIZE];
+
+ while (true) {
+
+ int r = pf->get_buffer(buf, BSIZE);
+ if (r <= 0)
+ break;
+ zipWriteInFileInZip(dst_pkg_zip, buf, r);
+ }
+ zipCloseFileInZip(dst_pkg_zip);
+ memdelete(pf);
+ } else {
+ err = ERR_CANT_OPEN;
+ }
+ }
}
-
- ret = unzGoToNextFile(src_pkg_zip);
- }
-
- if (!found_binary) {
- ERR_PRINTS("Requested template binary '" + binary_to_use + "' not found. It might be missing from your template archive.");
- zipClose(dst_pkg_zip, NULL);
- unzClose(src_pkg_zip);
- return ERR_FILE_NOT_FOUND;
}
- ep.step("Making PKG", 1);
-
- String pack_path = EditorSettings::get_singleton()->get_settings_path() + "/tmp/" + pkg_name + ".pck";
- Error err = save_pack(p_preset, pack_path);
-
- if (err) {
+ if (dst_pkg_zip) {
zipClose(dst_pkg_zip, NULL);
- unzClose(src_pkg_zip);
- return err;
}
- {
- //write datapack
-
- zipOpenNewFileInZip(dst_pkg_zip,
- (pkg_name + ".app/Contents/Resources/" + pkg_name + ".pck").utf8().get_data(),
- NULL,
- NULL,
- 0,
- NULL,
- 0,
- NULL,
- Z_DEFLATED,
- Z_DEFAULT_COMPRESSION);
-
- FileAccess *pf = FileAccess::open(pack_path, FileAccess::READ);
- ERR_FAIL_COND_V(!pf, ERR_CANT_OPEN);
- const int BSIZE = 16384;
- uint8_t buf[BSIZE];
-
- while (true) {
-
- int r = pf->get_buffer(buf, BSIZE);
- if (r <= 0)
- break;
- zipWriteInFileInZip(dst_pkg_zip, buf, r);
- }
- zipCloseFileInZip(dst_pkg_zip);
- memdelete(pf);
- }
-
- zipClose(dst_pkg_zip, NULL);
- unzClose(src_pkg_zip);
-
return OK;
}
-#endif
bool EditorExportPlatformOSX::can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const {
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index c6a9aeba88..05adfeb0f5 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -31,13 +31,11 @@
#define OS_OSX_H
#include "crash_handler_osx.h"
-#include "drivers/alsa/audio_driver_alsa.h"
-#include "drivers/rtaudio/audio_driver_rtaudio.h"
+#include "drivers/coreaudio/audio_driver_coreaudio.h"
#include "drivers/unix/os_unix.h"
#include "joypad_osx.h"
#include "main/input_default.h"
#include "os/input.h"
-#include "platform/osx/audio_driver_osx.h"
#include "power_osx.h"
#include "servers/audio_server.h"
#include "servers/physics_2d/physics_2d_server_sw.h"
@@ -69,7 +67,7 @@ public:
IP_Unix *ip_unix;
- AudioDriverOSX audio_driver_osx;
+ AudioDriverCoreAudio audio_driver;
InputDefault *input;
JoypadOSX *joypad_osx;
@@ -114,21 +112,23 @@ public:
CrashHandler crash_handler;
float _mouse_scale(float p_scale) {
- if (display_scale > 1.0)
+ if (_display_scale() > 1.0)
return p_scale;
else
return 1.0;
}
- void _update_window();
+ float _display_scale() const;
+ float _display_scale(id screen) const;
- float display_scale;
+ void _update_window();
protected:
virtual int get_video_driver_count() const;
virtual const char *get_video_driver_name(int p_driver) const;
virtual VideoMode get_default_video_mode() const;
+ virtual void initialize_logger();
virtual void initialize_core();
virtual void initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
virtual void finalize();
@@ -143,8 +143,6 @@ public:
virtual String get_name();
- 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 alert(const String &p_alert, const String &p_title = "ALERT!");
virtual void set_cursor_shape(CursorShape p_shape);
@@ -184,7 +182,6 @@ public:
virtual void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen = 0) const;
virtual String get_executable_path() const;
- virtual String get_resource_dir() const;
virtual LatinKeyboardVariant get_latin_keyboard_variant() const;
@@ -230,6 +227,8 @@ public:
void disable_crash_handler();
bool is_disable_crash_handler() const;
+ virtual Error move_to_trash(const String &p_path);
+
OS_OSX();
};
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index da7321d72a..2c81a02014 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -180,13 +180,13 @@ static bool mouse_down_control = false;
if (newBackingScaleFactor != oldBackingScaleFactor) {
//Set new display scale and window size
- OS_OSX::singleton->display_scale = newBackingScaleFactor;
+ float newDisplayScale = OS_OSX::singleton->is_hidpi_allowed() ? newBackingScaleFactor : 1.0;
const NSRect contentRect = [OS_OSX::singleton->window_view frame];
const NSRect fbRect = contentRect; //convertRectToBacking(contentRect);
- OS_OSX::singleton->window_size.width = fbRect.size.width * OS_OSX::singleton->display_scale;
- OS_OSX::singleton->window_size.height = fbRect.size.height * OS_OSX::singleton->display_scale;
+ OS_OSX::singleton->window_size.width = fbRect.size.width * newDisplayScale;
+ OS_OSX::singleton->window_size.height = fbRect.size.height * newDisplayScale;
//Update context
if (OS_OSX::singleton->main_loop) {
@@ -206,8 +206,9 @@ static bool mouse_down_control = false;
const NSRect contentRect = [OS_OSX::singleton->window_view frame];
const NSRect fbRect = contentRect; //convertRectToBacking(contentRect);
- OS_OSX::singleton->window_size.width = fbRect.size.width * OS_OSX::singleton->display_scale;
- OS_OSX::singleton->window_size.height = fbRect.size.height * OS_OSX::singleton->display_scale;
+ float displayScale = OS_OSX::singleton->_display_scale();
+ OS_OSX::singleton->window_size.width = fbRect.size.width * displayScale;
+ OS_OSX::singleton->window_size.height = fbRect.size.height * displayScale;
if (OS_OSX::singleton->main_loop) {
Main::force_redraw();
@@ -352,7 +353,8 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
- (NSRect)firstRectForCharacterRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange {
const NSRect contentRect = [OS_OSX::singleton->window_view frame];
- NSRect pointInWindowRect = NSMakeRect(OS_OSX::singleton->im_position.x / OS_OSX::singleton->display_scale, contentRect.size.height - (OS_OSX::singleton->im_position.y / OS_OSX::singleton->display_scale) - 1, 0, 0);
+ float displayScale = OS_OSX::singleton->_display_scale();
+ NSRect pointInWindowRect = NSMakeRect(OS_OSX::singleton->im_position.x / displayScale, contentRect.size.height - (OS_OSX::singleton->im_position.y / displayScale) - 1, 0, 0);
NSPoint pointOnScreen = [[OS_OSX::singleton->window_view window] convertRectToScreen:pointInWindowRect].origin;
return NSMakeRect(pointOnScreen.x, pointOnScreen.y, 0, 0);
@@ -940,15 +942,6 @@ void OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
kTISNotifySelectedKeyboardInputSourceChanged, NULL,
CFNotificationSuspensionBehaviorDeliverImmediately);
- if (is_hidpi_allowed() && [[NSScreen mainScreen] respondsToSelector:@selector(backingScaleFactor)]) {
- for (NSScreen *screen in [NSScreen screens]) {
- float s = [screen backingScaleFactor];
- if (s > display_scale) {
- display_scale = s;
- }
- }
- }
-
window_delegate = [[GodotWindowDelegate alloc] init];
// Don't use accumulation buffer support; it's not accelerated
@@ -972,10 +965,19 @@ void OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
window_view = [[GodotContentView alloc] init];
- window_size.width = p_desired.width * display_scale;
- window_size.height = p_desired.height * display_scale;
+ float displayScale = 1.0;
+ if (is_hidpi_allowed()) {
+ // note that mainScreen is not screen #0 but the one with the keyboard focus.
+ NSScreen *screen = [NSScreen mainScreen];
+ if ([screen respondsToSelector:@selector(backingScaleFactor)]) {
+ displayScale = fmax(displayScale, [screen backingScaleFactor]);
+ }
+ }
+
+ window_size.width = p_desired.width * displayScale;
+ window_size.height = p_desired.height * displayScale;
- if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6 && display_scale > 1) {
+ if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6 && displayScale > 1.0) {
[window_view setWantsBestResolutionOpenGLSurface:YES];
//if (current_videomode.resizable)
[window_object setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
@@ -1071,7 +1073,7 @@ void OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
bool use_gl2 = p_video_driver != 1;
- AudioDriverManager::add_driver(&audio_driver_osx);
+ AudioDriverManager::add_driver(&audio_driver);
// only opengl support here...
RasterizerGLES3::register_config();
@@ -1145,43 +1147,67 @@ String OS_OSX::get_name() {
return "OSX";
}
-void OS_OSX::print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type) {
-
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101200
- if (!_print_error_enabled)
- return;
-
- const char *err_details;
- if (p_rationale && p_rationale[0])
- err_details = p_rationale;
- else
- err_details = p_code;
+class OSXTerminalLogger : public StdLogger {
+public:
+ virtual void log_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) {
+ if (!should_log(true)) {
+ return;
+ }
- switch (p_type) {
- case ERR_ERROR:
- os_log_error(OS_LOG_DEFAULT, "ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.", p_function, err_details, p_file, p_line);
- print("\E[1;31mERROR: %s: \E[0m\E[1m%s\n", p_function, err_details);
- print("\E[0;31m At: %s:%i.\E[0m\n", p_file, p_line);
- break;
- case ERR_WARNING:
- os_log_info(OS_LOG_DEFAULT, "WARNING: %{public}s: %{public}s\nAt: %{public}s:%i.", p_function, err_details, p_file, p_line);
- print("\E[1;33mWARNING: %s: \E[0m\E[1m%s\n", p_function, err_details);
- print("\E[0;33m At: %s:%i.\E[0m\n", p_file, p_line);
- break;
- case ERR_SCRIPT:
- os_log_error(OS_LOG_DEFAULT, "SCRIPT ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.", p_function, err_details, p_file, p_line);
- print("\E[1;35mSCRIPT ERROR: %s: \E[0m\E[1m%s\n", p_function, err_details);
- print("\E[0;35m At: %s:%i.\E[0m\n", p_file, p_line);
- break;
- case ERR_SHADER:
- os_log_error(OS_LOG_DEFAULT, "SHADER ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.", p_function, err_details, p_file, p_line);
- print("\E[1;36mSHADER ERROR: %s: \E[0m\E[1m%s\n", p_function, err_details);
- print("\E[0;36m At: %s:%i.\E[0m\n", p_file, p_line);
- break;
+ const char *err_details;
+ if (p_rationale && p_rationale[0])
+ err_details = p_rationale;
+ else
+ err_details = p_code;
+
+ switch (p_type) {
+ case ERR_WARNING:
+ os_log_info(OS_LOG_DEFAULT,
+ "WARNING: %{public}s: %{public}s\nAt: %{public}s:%i.",
+ p_function, err_details, p_file, p_line);
+ logf_error("\E[1;33mWARNING: %s: \E[0m\E[1m%s\n", p_function,
+ err_details);
+ logf_error("\E[0;33m At: %s:%i.\E[0m\n", p_file, p_line);
+ break;
+ case ERR_SCRIPT:
+ os_log_error(OS_LOG_DEFAULT,
+ "SCRIPT ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.",
+ p_function, err_details, p_file, p_line);
+ logf_error("\E[1;35mSCRIPT ERROR: %s: \E[0m\E[1m%s\n", p_function,
+ err_details);
+ logf_error("\E[0;35m At: %s:%i.\E[0m\n", p_file, p_line);
+ break;
+ case ERR_SHADER:
+ os_log_error(OS_LOG_DEFAULT,
+ "SHADER ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.",
+ p_function, err_details, p_file, p_line);
+ logf_error("\E[1;36mSHADER ERROR: %s: \E[0m\E[1m%s\n", p_function,
+ err_details);
+ logf_error("\E[0;36m At: %s:%i.\E[0m\n", p_file, p_line);
+ break;
+ case ERR_ERROR:
+ default:
+ os_log_error(OS_LOG_DEFAULT,
+ "ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.",
+ p_function, err_details, p_file, p_line);
+ logf_error("\E[1;31mERROR: %s: \E[0m\E[1m%s\n", p_function, err_details);
+ logf_error("\E[0;31m At: %s:%i.\E[0m\n", p_file, p_line);
+ break;
+ }
}
+};
+
#else
- OS_Unix::print_error(p_function, p_file, p_line, p_code, p_rationale, p_type);
+
+typedef UnixTerminalLogger OSXTerminalLogger;
#endif
+
+void OS_OSX::initialize_logger() {
+ Vector<Logger *> loggers;
+ loggers.push_back(memnew(OSXTerminalLogger));
+ loggers.push_back(memnew(RotatedFileLogger("user://logs/log.txt")));
+ _set_logger(memnew(CompositeLogger(loggers)));
}
void OS_OSX::alert(const String &p_alert, const String &p_title) {
@@ -1250,7 +1276,8 @@ void OS_OSX::warp_mouse_position(const Point2 &p_to) {
//local point in window coords
const NSRect contentRect = [window_view frame];
- NSRect pointInWindowRect = NSMakeRect(p_to.x / display_scale, contentRect.size.height - (p_to.y / display_scale) - 1, 0, 0);
+ float displayScale = _display_scale();
+ NSRect pointInWindowRect = NSMakeRect(p_to.x / displayScale, contentRect.size.height - (p_to.y / displayScale) - 1, 0, 0);
NSPoint pointOnScreen = [[window_view window] convertRectToScreen:pointInWindowRect].origin;
//point in scren coords
@@ -1451,17 +1478,17 @@ int OS_OSX::get_screen_count() const {
return [screenArray count];
};
+static int get_screen_index(NSScreen *screen) {
+ const NSUInteger index = [[NSScreen screens] indexOfObject:screen];
+ return index == NSNotFound ? 0 : index;
+}
+
int OS_OSX::get_current_screen() const {
- Vector2 wpos = get_window_position();
-
- int count = get_screen_count();
- for (int i = 0; i < count; i++) {
- Point2 pos = get_screen_position(i);
- Size2 size = get_screen_size(i);
- if ((wpos.x >= pos.x && wpos.x < pos.x + size.width) && (wpos.y >= pos.y && wpos.y < pos.y + size.height))
- return i;
+ if (window_object) {
+ return get_screen_index([window_object screen]);
+ } else {
+ return get_screen_index([NSScreen mainScreen]);
}
- return 0;
};
void OS_OSX::set_current_screen(int p_screen) {
@@ -1476,12 +1503,7 @@ Point2 OS_OSX::get_screen_position(int p_screen) const {
NSArray *screenArray = [NSScreen screens];
if (p_screen < [screenArray count]) {
- float displayScale = 1.0;
-
- if (display_scale > 1.0 && [[screenArray objectAtIndex:p_screen] respondsToSelector:@selector(backingScaleFactor)]) {
- displayScale = [[screenArray objectAtIndex:p_screen] backingScaleFactor];
- }
-
+ float displayScale = _display_scale([screenArray objectAtIndex:p_screen]);
NSRect nsrect = [[screenArray objectAtIndex:p_screen] frame];
return Point2(nsrect.origin.x, nsrect.origin.y) * displayScale;
}
@@ -1496,12 +1518,7 @@ int OS_OSX::get_screen_dpi(int p_screen) const {
NSArray *screenArray = [NSScreen screens];
if (p_screen < [screenArray count]) {
- float displayScale = 1.0;
-
- if (display_scale > 1.0 && [[screenArray objectAtIndex:p_screen] respondsToSelector:@selector(backingScaleFactor)]) {
- displayScale = [[screenArray objectAtIndex:p_screen] backingScaleFactor];
- }
-
+ float displayScale = _display_scale([screenArray objectAtIndex:p_screen]);
NSDictionary *description = [[screenArray objectAtIndex:p_screen] deviceDescription];
NSSize displayPixelSize = [[description objectForKey:NSDeviceSize] sizeValue];
CGSize displayPhysicalSize = CGDisplayScreenSize(
@@ -1520,12 +1537,7 @@ Size2 OS_OSX::get_screen_size(int p_screen) const {
NSArray *screenArray = [NSScreen screens];
if (p_screen < [screenArray count]) {
- float displayScale = 1.0;
-
- if (display_scale > 1.0 && [[screenArray objectAtIndex:p_screen] respondsToSelector:@selector(backingScaleFactor)]) {
- displayScale = [[screenArray objectAtIndex:p_screen] backingScaleFactor];
- }
-
+ float displayScale = _display_scale([screenArray objectAtIndex:p_screen]);
// Note: Use frame to get the whole screen size
NSRect nsrect = [[screenArray objectAtIndex:p_screen] frame];
return Size2(nsrect.size.width, nsrect.size.height) * displayScale;
@@ -1559,10 +1571,28 @@ void OS_OSX::_update_window() {
}
}
+float OS_OSX::_display_scale() const {
+ if (window_object) {
+ return _display_scale([window_object screen]);
+ } else {
+ return _display_scale([NSScreen mainScreen]);
+ }
+}
+
+float OS_OSX::_display_scale(id screen) const {
+ if (is_hidpi_allowed()) {
+ if ([screen respondsToSelector:@selector(backingScaleFactor)]) {
+ return fmax(1.0, [screen backingScaleFactor]);
+ }
+ } else {
+ return 1.0;
+ }
+}
+
Point2 OS_OSX::get_window_position() const {
Size2 wp([window_object frame].origin.x, [window_object frame].origin.y);
- wp *= display_scale;
+ wp *= _display_scale();
return wp;
};
@@ -1570,10 +1600,11 @@ void OS_OSX::set_window_position(const Point2 &p_position) {
Size2 scr = get_screen_size();
NSPoint pos;
+ float displayScale = _display_scale();
- pos.x = p_position.x / display_scale;
+ pos.x = p_position.x / displayScale;
// For OS X the y starts at the bottom
- pos.y = (scr.height - p_position.y) / display_scale;
+ pos.y = (scr.height - p_position.y) / displayScale;
[window_object setFrameTopLeftPoint:pos];
@@ -1733,17 +1764,6 @@ String OS_OSX::get_executable_path() const {
}
}
-String OS_OSX::get_resource_dir() const {
- // start with our executable path
- String path = get_executable_path();
-
- int pos = path.find_last("/Contents/MacOS/");
- if (pos < 0)
- return OS::get_resource_dir();
-
- return path.substr(0, pos) + "/Contents/Resources/";
-}
-
// Returns string representation of keys, if they are printable.
//
static NSString *createStringForKeys(const CGKeyCode *keyCode, int length) {
@@ -1921,6 +1941,19 @@ int OS_OSX::get_power_percent_left() {
return power_manager->get_power_percent_left();
}
+Error OS_OSX::move_to_trash(const String &p_path) {
+ NSFileManager *fm = [NSFileManager defaultManager];
+ NSURL *url = [NSURL fileURLWithPath:@(p_path.utf8().get_data())];
+ NSError *err;
+
+ if (![fm trashItemAtURL:url resultingItemURL:nil error:&err]) {
+ ERR_PRINTS("trashItemAtURL error: " + String(err.localizedDescription.UTF8String));
+ return FAILED;
+ }
+
+ return OK;
+}
+
OS_OSX *OS_OSX::singleton = NULL;
OS_OSX::OS_OSX() {
@@ -2013,7 +2046,8 @@ OS_OSX::OS_OSX() {
minimized = false;
window_size = Vector2(1024, 600);
zoomed = false;
- display_scale = 1.0;
+
+ _set_logger(memnew(OSXTerminalLogger));
}
bool OS_OSX::_check_internal_feature_support(const String &p_feature) {
diff --git a/platform/server/detect.py b/platform/server/detect.py
index 2bb4b59e94..04b38f280d 100644
--- a/platform/server/detect.py
+++ b/platform/server/detect.py
@@ -19,9 +19,9 @@ def can_build():
def get_opts():
-
+ from SCons.Variables import BoolVariable
return [
- ('use_llvm', 'Use the LLVM compiler', 'no'),
+ BoolVariable('use_llvm', 'Use the LLVM compiler', False),
]
@@ -52,7 +52,7 @@ def configure(env):
## Compiler configuration
- if (env["use_llvm"] == "yes"):
+ if env['use_llvm']:
if ('clang++' not in env['CXX']):
env["CC"] = "clang"
env["CXX"] = "clang++"
@@ -64,66 +64,60 @@ def configure(env):
# FIXME: Check for existence of the libs before parsing their flags with pkg-config
- if (env['builtin_openssl'] == 'no'):
- # Currently not compatible with OpenSSL 1.1.0+
- # https://github.com/godotengine/godot/issues/8624
- import subprocess
- openssl_version = subprocess.check_output(['pkg-config', 'openssl', '--modversion']).strip('\n')
- if (openssl_version >= "1.1.0"):
- print("Error: Found system-installed OpenSSL %s, currently only supporting version 1.0.x." % openssl_version)
- print("Aborting.. You can compile with 'builtin_openssl=yes' to use the bundled version.\n")
- sys.exit(255)
-
+ if not env['builtin_openssl']:
env.ParseConfig('pkg-config openssl --cflags --libs')
- if (env['builtin_libwebp'] == 'no'):
+ if not env['builtin_libwebp']:
env.ParseConfig('pkg-config libwebp --cflags --libs')
# freetype depends on libpng and zlib, so bundling one of them while keeping others
# as shared libraries leads to weird issues
- if (env['builtin_freetype'] == 'yes' or env['builtin_libpng'] == 'yes' or env['builtin_zlib'] == 'yes'):
- env['builtin_freetype'] = 'yes'
- env['builtin_libpng'] = 'yes'
- env['builtin_zlib'] = 'yes'
+ if env['builtin_freetype'] or env['builtin_libpng'] or env['builtin_zlib']:
+ env['builtin_freetype'] = True
+ env['builtin_libpng'] = True
+ env['builtin_zlib'] = True
- if (env['builtin_freetype'] == 'no'):
+ if not env['builtin_freetype']:
env.ParseConfig('pkg-config freetype2 --cflags --libs')
- if (env['builtin_libpng'] == 'no'):
+ if not env['builtin_libpng']:
env.ParseConfig('pkg-config libpng --cflags --libs')
- if (env['builtin_enet'] == 'no'):
+ if not env['builtin_enet']:
env.ParseConfig('pkg-config libenet --cflags --libs')
- if (env['builtin_squish'] == 'no' and env["tools"] == "yes"):
+ if not env['builtin_squish'] and env['tools']:
env.ParseConfig('pkg-config libsquish --cflags --libs')
+ if not env['builtin_zstd']:
+ env.ParseConfig('pkg-config libzstd --cflags --libs')
+
# Sound and video libraries
# Keep the order as it triggers chained dependencies (ogg needed by others, etc.)
- if (env['builtin_libtheora'] == 'no'):
- env['builtin_libogg'] = 'no' # Needed to link against system libtheora
- env['builtin_libvorbis'] = 'no' # Needed to link against system libtheora
+ if not env['builtin_libtheora']:
+ env['builtin_libogg'] = False # Needed to link against system libtheora
+ env['builtin_libvorbis'] = False # Needed to link against system libtheora
env.ParseConfig('pkg-config theora theoradec --cflags --libs')
- if (env['builtin_libvpx'] == 'no'):
+ if not env['builtin_libvpx']:
env.ParseConfig('pkg-config vpx --cflags --libs')
- if (env['builtin_libvorbis'] == 'no'):
- env['builtin_libogg'] = 'no' # Needed to link against system libvorbis
+ if not env['builtin_libvorbis']:
+ env['builtin_libogg'] = False # Needed to link against system libvorbis
env.ParseConfig('pkg-config vorbis vorbisfile --cflags --libs')
- if (env['builtin_opus'] == 'no'):
- env['builtin_libogg'] = 'no' # Needed to link against system opus
+ if not env['builtin_opus']:
+ env['builtin_libogg'] = False # Needed to link against system opus
env.ParseConfig('pkg-config opus opusfile --cflags --libs')
- if (env['builtin_libogg'] == 'no'):
+ if not env['builtin_libogg']:
env.ParseConfig('pkg-config ogg --cflags --libs')
## Flags
# Linkflags below this line should typically stay the last ones
- if (env['builtin_zlib'] == 'no'):
+ if not env['builtin_zlib']:
env.ParseConfig('pkg-config zlib --cflags --libs')
env.Append(CPPPATH=['#platform/server'])
diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py
index 23929dd804..af53f97446 100644
--- a/platform/uwp/detect.py
+++ b/platform/uwp/detect.py
@@ -33,8 +33,8 @@ def get_opts():
def get_flags():
return [
- ('tools', 'no'),
- ('xaudio2', 'yes'),
+ ('tools', False),
+ ('xaudio2', True),
]
diff --git a/platform/uwp/gl_context_egl.cpp b/platform/uwp/gl_context_egl.cpp
index dd186c97d6..ed3db65cdf 100644
--- a/platform/uwp/gl_context_egl.cpp
+++ b/platform/uwp/gl_context_egl.cpp
@@ -31,7 +31,7 @@
#include "EGL/eglext.h"
-using namespace Platform;
+using Platform::Exception;
void ContextEGL::release_current() {
@@ -103,23 +103,23 @@ Error ContextEGL::initialize() {
const EGLint displayAttributes[] =
{
- /*EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
- EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, 9,
- EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE, 3,
- EGL_NONE,*/
- // These are the default display attributes, used to request ANGLE's D3D11 renderer.
- // eglInitialize will only succeed with these attributes if the hardware supports D3D11 Feature Level 10_0+.
- EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
-
- // EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER is an optimization that can have large performance benefits on mobile devices.
- // Its syntax is subject to change, though. Please update your Visual Studio templates if you experience compilation issues with it.
- //EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER, EGL_TRUE,
-
- // EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE is an option that enables ANGLE to automatically call
- // the IDXGIDevice3::Trim method on behalf of the application when it gets suspended.
- // Calling IDXGIDevice3::Trim when an application is suspended is a Windows Store application certification requirement.
- EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE, EGL_TRUE,
- EGL_NONE,
+ /*EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
+ EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, 9,
+ EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE, 3,
+ EGL_NONE,*/
+ // These are the default display attributes, used to request ANGLE's D3D11 renderer.
+ // eglInitialize will only succeed with these attributes if the hardware supports D3D11 Feature Level 10_0+.
+ EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
+
+ // EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER is an optimization that can have large performance benefits on mobile devices.
+ // Its syntax is subject to change, though. Please update your Visual Studio templates if you experience compilation issues with it.
+ //EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER, EGL_TRUE,
+
+ // EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE is an option that enables ANGLE to automatically call
+ // the IDXGIDevice3::Trim method on behalf of the application when it gets suspended.
+ // Calling IDXGIDevice3::Trim when an application is suspended is a Windows Store application certification requirement.
+ EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE, EGL_TRUE,
+ EGL_NONE,
};
PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT = reinterpret_cast<PFNEGLGETPLATFORMDISPLAYEXTPROC>(eglGetProcAddress("eglGetPlatformDisplayEXT"));
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index b909ccccd6..ff5a935229 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -40,6 +40,7 @@
#include "platform/windows/packet_peer_udp_winsock.h"
#include "platform/windows/stream_peer_winsock.h"
#include "platform/windows/tcp_server_winsock.h"
+#include "platform/windows/windows_terminal_logger.h"
#include "project_settings.h"
#include "servers/audio_server.h"
#include "servers/visual/visual_server_raster.h"
@@ -182,6 +183,13 @@ void OSUWP::initialize_core() {
cursor_shape = CURSOR_ARROW;
}
+void OSUWP::initialize_logger() {
+ Vector<Logger *> loggers;
+ loggers.push_back(memnew(WindowsTerminalLogger));
+ loggers.push_back(memnew(RotatedFileLogger("user://logs/log.txt")));
+ _set_logger(memnew(CompositeLogger(loggers)));
+}
+
bool OSUWP::can_draw() const {
return !minimized;
@@ -371,32 +379,6 @@ void OSUWP::finalize() {
void OSUWP::finalize_core() {
}
-void OSUWP::vprint(const char *p_format, va_list p_list, bool p_stderr) {
-
- char buf[16384 + 1];
- int len = vsnprintf(buf, 16384, p_format, p_list);
- if (len <= 0)
- return;
- buf[len] = 0;
-
- int wlen = MultiByteToWideChar(CP_UTF8, 0, buf, len, NULL, 0);
- if (wlen < 0)
- return;
-
- wchar_t *wbuf = (wchar_t *)malloc((len + 1) * sizeof(wchar_t));
- MultiByteToWideChar(CP_UTF8, 0, buf, len, wbuf, wlen);
- wbuf[wlen] = 0;
-
- if (p_stderr)
- fwprintf(stderr, L"%s", wbuf);
- else
- wprintf(L"%s", wbuf);
-
- free(wbuf);
-
- fflush(stdout);
-};
-
void OSUWP::alert(const String &p_alert, const String &p_title) {
Platform::String ^ alert = ref new Platform::String(p_alert.c_str());
@@ -520,30 +502,6 @@ OS::VideoMode OSUWP::get_video_mode(int p_screen) const {
void OSUWP::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen) const {
}
-void OSUWP::print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type) {
-
- const char *err_details;
- if (p_rationale && p_rationale[0])
- err_details = p_rationale;
- else
- err_details = p_code;
-
- switch (p_type) {
- case ERR_ERROR:
- print("ERROR: %s: %s\n", p_function, err_details);
- print(" At: %s:%i\n", p_file, p_line);
- break;
- case ERR_WARNING:
- print("WARNING: %s: %s\n", p_function, err_details);
- print(" At: %s:%i\n", p_file, p_line);
- break;
- case ERR_SCRIPT:
- print("SCRIPT ERROR: %s: %s\n", p_function, err_details);
- print(" At: %s:%i\n", p_file, p_line);
- break;
- }
-}
-
String OSUWP::get_name() {
return "UWP";
@@ -716,7 +674,7 @@ void OSUWP::set_cursor_shape(CursorShape p_shape) {
cursor_shape = p_shape;
}
-Error OSUWP::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode) {
+Error OSUWP::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode, bool read_stderr) {
return FAILED;
};
@@ -890,6 +848,8 @@ OSUWP::OSUWP() {
mouse_mode_changed = CreateEvent(NULL, TRUE, FALSE, L"os_mouse_mode_changed");
AudioDriverManager::add_driver(&audio_driver);
+
+ _set_logger(memnew(WindowsTerminalLogger));
}
OSUWP::~OSUWP() {
diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h
index a7a5d32cb9..22f8938049 100644
--- a/platform/uwp/os_uwp.h
+++ b/platform/uwp/os_uwp.h
@@ -163,6 +163,7 @@ protected:
virtual int get_audio_driver_count() const;
virtual const char *get_audio_driver_name(int p_driver) const;
+ virtual void initialize_logger();
virtual void initialize_core();
virtual void initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
@@ -180,9 +181,6 @@ public:
// Event to send to the app wrapper
HANDLE mouse_mode_changed;
- 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);
-
- virtual void vprint(const char *p_format, va_list p_list, bool p_stderr = false);
virtual void alert(const String &p_alert, const String &p_title = "ALERT!");
String get_stdin_string(bool p_block);
@@ -217,7 +215,7 @@ public:
virtual void delay_usec(uint32_t p_usec) const;
virtual uint64_t get_ticks_usec() const;
- virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL);
+ virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false);
virtual Error kill(const ProcessID &p_pid);
virtual bool has_environment(const String &p_var) const;
diff --git a/platform/windows/SCsub b/platform/windows/SCsub
index fd041e096e..aa9eb3e69b 100644
--- a/platform/windows/SCsub
+++ b/platform/windows/SCsub
@@ -19,6 +19,7 @@ common_win = [
"stream_peer_winsock.cpp",
"joypad.cpp",
"power_windows.cpp",
+ "windows_terminal_logger.cpp"
]
restarget = "godot_res" + env["OBJSUFFIX"]
@@ -30,7 +31,7 @@ common_win.append(obj)
binary = env.Program('#bin/godot', ['godot_win.cpp'] + common_win, PROGSUFFIX=env["PROGSUFFIX"])
# Microsoft Visual Studio Project Generation
-if (env['vsproj']) == "yes":
+if env['vsproj']:
env.vs_srcs = env.vs_srcs + ["platform/windows/godot_win.cpp"]
for x in common_win:
env.vs_srcs = env.vs_srcs + ["platform/windows/" + str(x)]
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 65eb51a2f3..031b397988 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -49,6 +49,7 @@ def can_build():
def get_opts():
+ from SCons.Variables import BoolVariable, EnumVariable
mingw32 = ""
mingw64 = ""
@@ -64,7 +65,8 @@ def get_opts():
return [
('mingw_prefix_32', 'MinGW prefix (Win32)', mingw32),
('mingw_prefix_64', 'MinGW prefix (Win64)', mingw64),
- ('debug_symbols', 'Add debug symbols to release version (yes/no/full)', 'yes')
+ BoolVariable('use_lto', 'Use link time optimization (when using MingW)', False),
+ EnumVariable('debug_symbols', 'Add debug symbols to release version', 'yes', ('yes', 'no', 'full')),
]
@@ -256,11 +258,18 @@ def configure(env):
env["CC"] = mingw_prefix + "gcc"
env['AS'] = mingw_prefix + "as"
env['CXX'] = mingw_prefix + "g++"
- env['AR'] = mingw_prefix + "ar"
- env['RANLIB'] = mingw_prefix + "ranlib"
+ env['AR'] = mingw_prefix + "gcc-ar"
+ env['RANLIB'] = mingw_prefix + "gcc-ranlib"
env['LD'] = mingw_prefix + "g++"
env["x86_libtheora_opt_gcc"] = True
+ if env['use_lto']:
+ env.Append(CCFLAGS=['-flto'])
+ if not env['use_llvm'] and env.GetOption("num_jobs") > 1:
+ env.Append(LINKFLAGS=['-flto=' + str(env.GetOption("num_jobs"))])
+ else:
+ env.Append(LINKFLAGS=['-flto'])
+
## Compile flags
env.Append(CCFLAGS=['-DWINDOWS_ENABLED', '-mwindows'])
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index db7cd0b938..c27e7c0d2b 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -48,6 +48,7 @@
#include "servers/visual/visual_server_wrap_mt.h"
#include "stream_peer_winsock.h"
#include "tcp_server_winsock.h"
+#include "windows_terminal_logger.h"
#include <process.h>
#include <regstr.h>
@@ -205,6 +206,13 @@ void OS_Windows::initialize_core() {
cursor_shape = CURSOR_ARROW;
}
+void OS_Windows::initialize_logger() {
+ Vector<Logger *> loggers;
+ loggers.push_back(memnew(WindowsTerminalLogger));
+ loggers.push_back(memnew(RotatedFileLogger("user://logs/log.txt")));
+ _set_logger(memnew(CompositeLogger(loggers)));
+}
+
bool OS_Windows::can_draw() const {
return !minimized;
@@ -1231,38 +1239,6 @@ void OS_Windows::finalize_core() {
StreamPeerWinsock::cleanup();
}
-void OS_Windows::vprint(const char *p_format, va_list p_list, bool p_stderr) {
-
- const unsigned int BUFFER_SIZE = 16384;
- char buf[BUFFER_SIZE + 1]; // +1 for the terminating character
- int len = vsnprintf(buf, BUFFER_SIZE, p_format, p_list);
- if (len <= 0)
- return;
- if (len >= BUFFER_SIZE)
- len = BUFFER_SIZE; // Output is too big, will be truncated
- buf[len] = 0;
-
- int wlen = MultiByteToWideChar(CP_UTF8, 0, buf, len, NULL, 0);
- if (wlen < 0)
- return;
-
- wchar_t *wbuf = (wchar_t *)malloc((len + 1) * sizeof(wchar_t));
- MultiByteToWideChar(CP_UTF8, 0, buf, len, wbuf, wlen);
- wbuf[wlen] = 0;
-
- if (p_stderr)
- fwprintf(stderr, L"%ls", wbuf);
- else
- wprintf(L"%ls", wbuf);
-
-#ifdef STDOUT_FILE
-//vwfprintf(stdo,p_format,p_list);
-#endif
- free(wbuf);
-
- fflush(stdout);
-};
-
void OS_Windows::alert(const String &p_alert, const String &p_title) {
if (!is_no_window_mode_enabled())
@@ -1676,107 +1652,6 @@ void OS_Windows::request_attention() {
FlashWindowEx(&info);
}
-void OS_Windows::print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type) {
-
- HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE);
- if (!hCon || hCon == INVALID_HANDLE_VALUE) {
-
- const char *err_details;
- if (p_rationale && p_rationale[0])
- err_details = p_rationale;
- else
- err_details = p_code;
-
- switch (p_type) {
- case ERR_ERROR:
- print("ERROR: %s: %s\n", p_function, err_details);
- print(" At: %s:%i\n", p_file, p_line);
- break;
- case ERR_WARNING:
- print("WARNING: %s: %s\n", p_function, err_details);
- print(" At: %s:%i\n", p_file, p_line);
- break;
- case ERR_SCRIPT:
- print("SCRIPT ERROR: %s: %s\n", p_function, err_details);
- print(" At: %s:%i\n", p_file, p_line);
- break;
- case ERR_SHADER:
- print("SHADER ERROR: %s: %s\n", p_function, err_details);
- print(" At: %s:%i\n", p_file, p_line);
- break;
- }
-
- } else {
-
- CONSOLE_SCREEN_BUFFER_INFO sbi; //original
- GetConsoleScreenBufferInfo(hCon, &sbi);
-
- WORD current_fg = sbi.wAttributes & (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
- WORD current_bg = sbi.wAttributes & (BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY);
-
- uint32_t basecol = 0;
- switch (p_type) {
- case ERR_ERROR: basecol = FOREGROUND_RED; break;
- case ERR_WARNING: basecol = FOREGROUND_RED | FOREGROUND_GREEN; break;
- case ERR_SCRIPT: basecol = FOREGROUND_RED | FOREGROUND_BLUE; break;
- case ERR_SHADER: basecol = FOREGROUND_GREEN | FOREGROUND_BLUE; break;
- }
-
- basecol |= current_bg;
-
- if (p_rationale && p_rationale[0]) {
-
- SetConsoleTextAttribute(hCon, basecol | FOREGROUND_INTENSITY);
- switch (p_type) {
- case ERR_ERROR: print("ERROR: "); break;
- case ERR_WARNING: print("WARNING: "); break;
- case ERR_SCRIPT: print("SCRIPT ERROR: "); break;
- case ERR_SHADER: print("SHADER ERROR: "); break;
- }
-
- SetConsoleTextAttribute(hCon, current_fg | current_bg | FOREGROUND_INTENSITY);
- print("%s\n", p_rationale);
-
- SetConsoleTextAttribute(hCon, basecol);
- switch (p_type) {
- case ERR_ERROR: print(" At: "); break;
- case ERR_WARNING: print(" At: "); break;
- case ERR_SCRIPT: print(" At: "); break;
- case ERR_SHADER: print(" At: "); break;
- }
-
- SetConsoleTextAttribute(hCon, current_fg | current_bg);
- print("%s:%i\n", p_file, p_line);
-
- } else {
-
- SetConsoleTextAttribute(hCon, basecol | FOREGROUND_INTENSITY);
- switch (p_type) {
- case ERR_ERROR: print("ERROR: %s: ", p_function); break;
- case ERR_WARNING: print("WARNING: %s: ", p_function); break;
- case ERR_SCRIPT: print("SCRIPT ERROR: %s: ", p_function); break;
- case ERR_SHADER: print("SCRIPT ERROR: %s: ", p_function); break;
- }
-
- SetConsoleTextAttribute(hCon, current_fg | current_bg | FOREGROUND_INTENSITY);
- print("%s\n", p_code);
-
- SetConsoleTextAttribute(hCon, basecol);
- switch (p_type) {
- case ERR_ERROR: print(" At: "); break;
- case ERR_WARNING: print(" At: "); break;
- case ERR_SCRIPT: print(" At: "); break;
- case ERR_SHADER: print(" At: "); break;
- }
-
- SetConsoleTextAttribute(hCon, current_fg | current_bg);
- print("%s:%i\n", p_file, p_line);
- }
-
- SetConsoleTextAttribute(hCon, sbi.wAttributes);
- }
-}
-
String OS_Windows::get_name() {
return "Windows";
@@ -1937,7 +1812,7 @@ void OS_Windows::set_cursor_shape(CursorShape p_shape) {
cursor_shape = p_shape;
}
-Error OS_Windows::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode) {
+Error OS_Windows::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode, bool read_stderr) {
if (p_blocking && r_pipe) {
@@ -2373,6 +2248,33 @@ bool OS_Windows::is_disable_crash_handler() const {
return crash_handler.is_disabled();
}
+Error OS_Windows::move_to_trash(const String &p_path) {
+ SHFILEOPSTRUCTA sf;
+ TCHAR *from = new TCHAR[p_path.length() + 2];
+ strcpy(from, p_path.utf8().get_data());
+ from[p_path.length()] = 0;
+ from[p_path.length() + 1] = 0;
+
+ sf.hwnd = hWnd;
+ sf.wFunc = FO_DELETE;
+ sf.pFrom = from;
+ sf.pTo = NULL;
+ sf.fFlags = FOF_ALLOWUNDO | FOF_NOCONFIRMATION;
+ sf.fAnyOperationsAborted = FALSE;
+ sf.hNameMappings = NULL;
+ sf.lpszProgressTitle = NULL;
+
+ int ret = SHFileOperation(&sf);
+ delete[] from;
+
+ if (ret) {
+ ERR_PRINTS("SHFileOperation error: " + itos(ret));
+ return FAILED;
+ }
+
+ return OK;
+}
+
OS_Windows::OS_Windows(HINSTANCE _hInstance) {
key_event_pos = 0;
@@ -2402,6 +2304,8 @@ OS_Windows::OS_Windows(HINSTANCE _hInstance) {
#ifdef XAUDIO2_ENABLED
AudioDriverManager::add_driver(&driver_xaudio2);
#endif
+
+ _set_logger(memnew(WindowsTerminalLogger));
}
OS_Windows::~OS_Windows() {
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 8a955aa224..c0b8dfc691 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -152,6 +152,7 @@ protected:
virtual int get_audio_driver_count() const;
virtual const char *get_audio_driver_name(int p_driver) const;
+ virtual void initialize_logger();
virtual void initialize_core();
virtual void initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
@@ -180,9 +181,6 @@ protected:
public:
LRESULT WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
- 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);
-
- virtual void vprint(const char *p_format, va_list p_list, bool p_stderr = false);
virtual void alert(const String &p_alert, const String &p_title = "ALERT!");
String get_stdin_string(bool p_block);
@@ -242,7 +240,7 @@ public:
virtual void delay_usec(uint32_t p_usec) const;
virtual uint64_t get_ticks_usec() const;
- virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL);
+ virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false);
virtual Error kill(const ProcessID &p_pid);
virtual int get_process_id() const;
@@ -290,6 +288,8 @@ public:
void disable_crash_handler();
bool is_disable_crash_handler() const;
+ virtual Error move_to_trash(const String &p_path);
+
OS_Windows(HINSTANCE _hInstance);
~OS_Windows();
};
diff --git a/platform/windows/windows_terminal_logger.cpp b/platform/windows/windows_terminal_logger.cpp
new file mode 100644
index 0000000000..ef8140ffa7
--- /dev/null
+++ b/platform/windows/windows_terminal_logger.cpp
@@ -0,0 +1,157 @@
+/*************************************************************************/
+/* windows_terminal_logger.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "windows_terminal_logger.h"
+
+#ifdef WINDOWS_ENABLED
+
+#include <stdio.h>
+#include <windows.h>
+
+void WindowsTerminalLogger::logv(const char *p_format, va_list p_list, bool p_err) {
+ if (!should_log(p_err)) {
+ return;
+ }
+
+ const unsigned int BUFFER_SIZE = 16384;
+ char buf[BUFFER_SIZE + 1]; // +1 for the terminating character
+ int len = vsnprintf(buf, BUFFER_SIZE, p_format, p_list);
+ if (len <= 0)
+ return;
+ if (len >= BUFFER_SIZE)
+ len = BUFFER_SIZE; // Output is too big, will be truncated
+ buf[len] = 0;
+
+ int wlen = MultiByteToWideChar(CP_UTF8, 0, buf, len, NULL, 0);
+ if (wlen < 0)
+ return;
+
+ wchar_t *wbuf = (wchar_t *)malloc((len + 1) * sizeof(wchar_t));
+ MultiByteToWideChar(CP_UTF8, 0, buf, len, wbuf, wlen);
+ wbuf[wlen] = 0;
+
+ if (p_err)
+ fwprintf(stderr, L"%ls", wbuf);
+ else
+ wprintf(L"%ls", wbuf);
+
+ free(wbuf);
+
+#ifdef DEBUG_ENABLED
+ fflush(stdout);
+#endif
+}
+
+void WindowsTerminalLogger::log_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type) {
+ if (!should_log(true)) {
+ return;
+ }
+
+#ifndef UWP_ENABLED
+ HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE);
+ if (!hCon || hCon == INVALID_HANDLE_VALUE) {
+#endif
+ StdLogger::log_error(p_function, p_file, p_line, p_code, p_rationale, p_type);
+#ifndef UWP_ENABLED
+ } else {
+
+ CONSOLE_SCREEN_BUFFER_INFO sbi; //original
+ GetConsoleScreenBufferInfo(hCon, &sbi);
+
+ WORD current_fg = sbi.wAttributes & (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
+ WORD current_bg = sbi.wAttributes & (BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY);
+
+ uint32_t basecol = 0;
+ switch (p_type) {
+ case ERR_ERROR: basecol = FOREGROUND_RED; break;
+ case ERR_WARNING: basecol = FOREGROUND_RED | FOREGROUND_GREEN; break;
+ case ERR_SCRIPT: basecol = FOREGROUND_RED | FOREGROUND_BLUE; break;
+ case ERR_SHADER: basecol = FOREGROUND_GREEN | FOREGROUND_BLUE; break;
+ }
+
+ basecol |= current_bg;
+
+ if (p_rationale && p_rationale[0]) {
+
+ SetConsoleTextAttribute(hCon, basecol | FOREGROUND_INTENSITY);
+ switch (p_type) {
+ case ERR_ERROR: logf("ERROR: "); break;
+ case ERR_WARNING: logf("WARNING: "); break;
+ case ERR_SCRIPT: logf("SCRIPT ERROR: "); break;
+ case ERR_SHADER: logf("SHADER ERROR: "); break;
+ }
+
+ SetConsoleTextAttribute(hCon, current_fg | current_bg | FOREGROUND_INTENSITY);
+ logf("%s\n", p_rationale);
+
+ SetConsoleTextAttribute(hCon, basecol);
+ switch (p_type) {
+ case ERR_ERROR: logf(" At: "); break;
+ case ERR_WARNING: logf(" At: "); break;
+ case ERR_SCRIPT: logf(" At: "); break;
+ case ERR_SHADER: logf(" At: "); break;
+ }
+
+ SetConsoleTextAttribute(hCon, current_fg | current_bg);
+ logf("%s:%i\n", p_file, p_line);
+
+ } else {
+
+ SetConsoleTextAttribute(hCon, basecol | FOREGROUND_INTENSITY);
+ switch (p_type) {
+ case ERR_ERROR: logf("ERROR: %s: ", p_function); break;
+ case ERR_WARNING: logf("WARNING: %s: ", p_function); break;
+ case ERR_SCRIPT: logf("SCRIPT ERROR: %s: ", p_function); break;
+ case ERR_SHADER: logf("SCRIPT ERROR: %s: ", p_function); break;
+ }
+
+ SetConsoleTextAttribute(hCon, current_fg | current_bg | FOREGROUND_INTENSITY);
+ logf("%s\n", p_code);
+
+ SetConsoleTextAttribute(hCon, basecol);
+ switch (p_type) {
+ case ERR_ERROR: logf(" At: "); break;
+ case ERR_WARNING: logf(" At: "); break;
+ case ERR_SCRIPT: logf(" At: "); break;
+ case ERR_SHADER: logf(" At: "); break;
+ }
+
+ SetConsoleTextAttribute(hCon, current_fg | current_bg);
+ logf("%s:%i\n", p_file, p_line);
+ }
+
+ SetConsoleTextAttribute(hCon, sbi.wAttributes);
+ }
+#endif
+}
+
+WindowsTerminalLogger::~WindowsTerminalLogger() {}
+
+#endif \ No newline at end of file
diff --git a/platform/windows/windows_terminal_logger.h b/platform/windows/windows_terminal_logger.h
new file mode 100644
index 0000000000..f6b1a68d18
--- /dev/null
+++ b/platform/windows/windows_terminal_logger.h
@@ -0,0 +1,47 @@
+/*************************************************************************/
+/* windows_terminal_logger.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef WINDOWS_TERMINAL_LOGGER_H
+#define WINDOWS_TERMINAL_LOGGER_H
+
+#ifdef WINDOWS_ENABLED
+
+#include "io/logger.h"
+
+class WindowsTerminalLogger : public StdLogger {
+public:
+ virtual void logv(const char *p_format, va_list p_list, bool p_err);
+ virtual void log_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 ~WindowsTerminalLogger();
+};
+
+#endif
+
+#endif \ No newline at end of file
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index efd388e44f..1f7f67fe10 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -45,26 +45,27 @@ def can_build():
return True
def get_opts():
+ from SCons.Variables import BoolVariable, EnumVariable
return [
- ('use_llvm', 'Use the LLVM compiler', 'no'),
- ('use_static_cpp', 'Link stdc++ statically', 'no'),
- ('use_sanitizer', 'Use LLVM compiler address sanitizer', 'no'),
- ('use_leak_sanitizer', 'Use LLVM compiler memory leaks sanitizer (implies use_sanitizer)', 'no'),
- ('use_lto', 'Use link time optimization', 'no'),
- ('pulseaudio', 'Detect & use pulseaudio', 'yes'),
- ('udev', 'Use udev for gamepad connection callbacks', 'no'),
- ('debug_symbols', 'Add debug symbols to release version (yes/no/full)', 'yes')
+ BoolVariable('use_llvm', 'Use the LLVM compiler', False),
+ BoolVariable('use_static_cpp', 'Link stdc++ statically', False),
+ BoolVariable('use_sanitizer', 'Use LLVM compiler address sanitizer', False),
+ BoolVariable('use_leak_sanitizer', 'Use LLVM compiler memory leaks sanitizer (implies use_sanitizer)', False),
+ BoolVariable('use_lto', 'Use link time optimization', False),
+ BoolVariable('pulseaudio', 'Detect & use pulseaudio', True),
+ BoolVariable('udev', 'Use udev for gamepad connection callbacks', False),
+ EnumVariable('debug_symbols', 'Add debug symbols to release version', 'yes', ('yes', 'no', 'full')),
]
def get_flags():
return [
- ('builtin_freetype', 'no'),
- ('builtin_libpng', 'no'),
- ('builtin_openssl', 'no'),
- ('builtin_zlib', 'no'),
+ ('builtin_freetype', False),
+ ('builtin_libpng', False),
+ ('builtin_openssl', False),
+ ('builtin_zlib', False),
]
@@ -100,7 +101,7 @@ def configure(env):
## Compiler configuration
- if (env["use_llvm"] == "yes"):
+ if env['use_llvm']:
if ('clang++' not in env['CXX']):
env["CC"] = "clang"
env["CXX"] = "clang++"
@@ -109,17 +110,23 @@ def configure(env):
env.extra_suffix = ".llvm" + env.extra_suffix
# leak sanitizer requires (address) sanitizer
- if (env["use_sanitizer"] == "yes" or env["use_leak_sanitizer"] == "yes"):
+ if env['use_sanitizer'] or env['use_leak_sanitizer']:
env.Append(CCFLAGS=['-fsanitize=address', '-fno-omit-frame-pointer'])
env.Append(LINKFLAGS=['-fsanitize=address'])
env.extra_suffix += "s"
- if (env["use_leak_sanitizer"] == "yes"):
+ if env['use_leak_sanitizer']:
env.Append(CCFLAGS=['-fsanitize=leak'])
env.Append(LINKFLAGS=['-fsanitize=leak'])
- if (env["use_lto"] == "yes"):
+ if env['use_lto']:
env.Append(CCFLAGS=['-flto'])
- env.Append(LINKFLAGS=['-flto'])
+ if not env['use_llvm'] and env.GetOption("num_jobs") > 1:
+ env.Append(LINKFLAGS=['-flto=' + str(env.GetOption("num_jobs"))])
+ else:
+ env.Append(LINKFLAGS=['-flto'])
+ if not env['use_llvm']:
+ env['RANLIB'] = 'gcc-ranlib'
+ env['AR'] = 'gcc-ar'
env.Append(CCFLAGS=['-pipe'])
env.Append(LINKFLAGS=['-pipe'])
@@ -133,70 +140,64 @@ def configure(env):
# FIXME: Check for existence of the libs before parsing their flags with pkg-config
- if (env['builtin_openssl'] == 'no'):
- # Currently not compatible with OpenSSL 1.1.0+
- # https://github.com/godotengine/godot/issues/8624
- import subprocess
- openssl_version = subprocess.check_output(['pkg-config', 'openssl', '--modversion']).strip('\n')
- if (openssl_version >= "1.1.0"):
- print("Error: Found system-installed OpenSSL %s, currently only supporting version 1.0.x." % openssl_version)
- print("Aborting.. You can compile with 'builtin_openssl=yes' to use the bundled version.\n")
- sys.exit(255)
-
+ if not env['builtin_openssl']:
env.ParseConfig('pkg-config openssl --cflags --libs')
- if (env['builtin_libwebp'] == 'no'):
+ if not env['builtin_libwebp']:
env.ParseConfig('pkg-config libwebp --cflags --libs')
# freetype depends on libpng and zlib, so bundling one of them while keeping others
# as shared libraries leads to weird issues
- if (env['builtin_freetype'] == 'yes' or env['builtin_libpng'] == 'yes' or env['builtin_zlib'] == 'yes'):
- env['builtin_freetype'] = 'yes'
- env['builtin_libpng'] = 'yes'
- env['builtin_zlib'] = 'yes'
+ if env['builtin_freetype'] or env['builtin_libpng'] or env['builtin_zlib']:
+ env['builtin_freetype'] = True
+ env['builtin_libpng'] = True
+ env['builtin_zlib'] = True
- if (env['builtin_freetype'] == 'no'):
+ if not env['builtin_freetype']:
env.ParseConfig('pkg-config freetype2 --cflags --libs')
- if (env['builtin_libpng'] == 'no'):
+ if not env['builtin_libpng']:
env.ParseConfig('pkg-config libpng --cflags --libs')
- if (env['builtin_enet'] == 'no'):
+ if not env['builtin_enet']:
env.ParseConfig('pkg-config libenet --cflags --libs')
- if (env['builtin_squish'] == 'no' and env["tools"] == "yes"):
+ if not env['builtin_squish'] and env['tools']:
env.ParseConfig('pkg-config libsquish --cflags --libs')
+ if not env['builtin_zstd']:
+ env.ParseConfig('pkg-config libzstd --cflags --libs')
+
# Sound and video libraries
# Keep the order as it triggers chained dependencies (ogg needed by others, etc.)
- if (env['builtin_libtheora'] == 'no'):
- env['builtin_libogg'] = 'no' # Needed to link against system libtheora
- env['builtin_libvorbis'] = 'no' # Needed to link against system libtheora
+ if not env['builtin_libtheora']:
+ env['builtin_libogg'] = False # Needed to link against system libtheora
+ env['builtin_libvorbis'] = False # Needed to link against system libtheora
env.ParseConfig('pkg-config theora theoradec --cflags --libs')
- if (env['builtin_libvpx'] == 'no'):
+ if not env['builtin_libvpx']:
env.ParseConfig('pkg-config vpx --cflags --libs')
- if (env['builtin_libvorbis'] == 'no'):
- env['builtin_libogg'] = 'no' # Needed to link against system libvorbis
+ if not env['builtin_libvorbis']:
+ env['builtin_libogg'] = False # Needed to link against system libvorbis
env.ParseConfig('pkg-config vorbis vorbisfile --cflags --libs')
- if (env['builtin_opus'] == 'no'):
- env['builtin_libogg'] = 'no' # Needed to link against system opus
+ if not env['builtin_opus']:
+ env['builtin_libogg'] = False # Needed to link against system opus
env.ParseConfig('pkg-config opus opusfile --cflags --libs')
- if (env['builtin_libogg'] == 'no'):
+ if not env['builtin_libogg']:
env.ParseConfig('pkg-config ogg --cflags --libs')
- if (env['builtin_libtheora'] != 'no'):
+ if env['builtin_libtheora']:
list_of_x86 = ['x86_64', 'x86', 'i386', 'i586']
if any(platform.machine() in s for s in list_of_x86):
env["x86_libtheora_opt_gcc"] = True
# On Linux wchar_t should be 32-bits
# 16-bit library shouldn't be required due to compiler optimisations
- if (env['builtin_pcre2'] == 'no'):
+ if not env['builtin_pcre2']:
env.ParseConfig('pkg-config libpcre2-32 --cflags --libs')
## Flags
@@ -208,7 +209,7 @@ def configure(env):
else:
print("ALSA libraries not found, disabling driver")
- if (env["pulseaudio"] == "yes"):
+ if env['pulseaudio']:
if (os.system("pkg-config --exists libpulse-simple") == 0): # 0 means found
print("Enabling PulseAudio")
env.Append(CPPFLAGS=["-DPULSEAUDIO_ENABLED"])
@@ -219,7 +220,7 @@ def configure(env):
if (platform.system() == "Linux"):
env.Append(CPPFLAGS=["-DJOYDEV_ENABLED"])
- if (env["udev"] == "yes"):
+ if env['udev']:
if (os.system("pkg-config --exists libudev") == 0): # 0 means found
print("Enabling udev support")
env.Append(CPPFLAGS=["-DUDEV_ENABLED"])
@@ -228,7 +229,7 @@ def configure(env):
print("libudev development libraries not found, disabling udev support")
# Linkflags below this line should typically stay the last ones
- if (env['builtin_zlib'] == 'no'):
+ if not env['builtin_zlib']:
env.ParseConfig('pkg-config zlib --cflags --libs')
env.Append(CPPPATH=['#platform/x11'])
@@ -247,5 +248,5 @@ def configure(env):
env.Append(CPPFLAGS=['-m64'])
env.Append(LINKFLAGS=['-m64', '-L/usr/lib/i686-linux-gnu'])
- if (env["use_static_cpp"] == "yes"):
+ if env['use_static_cpp']:
env.Append(LINKFLAGS=['-static-libstdc++'])
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 599c0d2278..041666a594 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -35,6 +35,7 @@
#include "servers/physics/physics_server_sw.h"
#include "servers/visual/visual_server_raster.h"
#include "servers/visual/visual_server_wrap_mt.h"
+#include <mntent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -2175,6 +2176,77 @@ bool OS_X11::is_disable_crash_handler() const {
return crash_handler.is_disabled();
}
+static String get_mountpoint(const String &p_path) {
+ struct stat s;
+ if (stat(p_path.utf8().get_data(), &s)) {
+ return "";
+ }
+
+ dev_t dev = s.st_dev;
+ FILE *fd = setmntent("/proc/mounts", "r");
+ if (!fd) {
+ return "";
+ }
+
+ struct mntent mnt;
+ char buf[1024];
+ size_t buflen = 1024;
+ while (getmntent_r(fd, &mnt, buf, buflen)) {
+ if (!stat(mnt.mnt_dir, &s) && s.st_dev == dev) {
+ endmntent(fd);
+ return String(mnt.mnt_dir);
+ }
+ }
+
+ endmntent(fd);
+ return "";
+}
+
+Error OS_X11::move_to_trash(const String &p_path) {
+ String trashcan = "";
+ String mnt = get_mountpoint(p_path);
+
+ if (mnt != "") {
+ String path(mnt + "/.Trash-" + itos(getuid()) + "/files");
+ struct stat s;
+ if (!stat(path.utf8().get_data(), &s)) {
+ trashcan = path;
+ }
+ }
+
+ if (trashcan == "") {
+ char *dhome = getenv("XDG_DATA_HOME");
+ if (dhome) {
+ trashcan = String(dhome) + "/Trash/files";
+ }
+ }
+
+ if (trashcan == "") {
+ char *home = getenv("HOME");
+ if (home) {
+ trashcan = String(home) + "/.local/share/Trash/files";
+ }
+ }
+
+ if (trashcan == "") {
+ ERR_PRINTS("move_to_trash: Could not determine trashcan location");
+ return FAILED;
+ }
+
+ List<String> args;
+ args.push_back("-p");
+ args.push_back(trashcan);
+ Error err = execute("/bin/mkdir", args, true);
+ if (err == OK) {
+ List<String> args2;
+ args2.push_back(p_path);
+ args2.push_back(trashcan);
+ err = execute("/bin/mv", args2, true);
+ }
+
+ return err;
+}
+
OS_X11::OS_X11() {
#ifdef PULSEAUDIO_ENABLED
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index a0338dacf1..0d5c272ed4 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -273,6 +273,8 @@ public:
void disable_crash_handler();
bool is_disable_crash_handler() const;
+ virtual Error move_to_trash(const String &p_path);
+
OS_X11();
};
diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp
index c2edb173d7..5982556c18 100644
--- a/scene/2d/animated_sprite.cpp
+++ b/scene/2d/animated_sprite.cpp
@@ -298,10 +298,8 @@ void AnimatedSprite::_validate_property(PropertyInfo &property) const {
property.hint = PROPERTY_HINT_SPRITE_FRAME;
- if (frames->has_animation(animation)) {
+ if (frames->has_animation(animation) && frames->get_frame_count(animation) > 1) {
property.hint_string = "0," + itos(frames->get_frame_count(animation) - 1) + ",1";
- } else {
- property.hint_string = "0,0,0";
}
}
}
diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp
index 9fc6c8d23a..9ee77a710c 100644
--- a/scene/2d/area_2d.cpp
+++ b/scene/2d/area_2d.cpp
@@ -557,12 +557,12 @@ bool Area2D::is_overriding_audio_bus() const {
return audio_bus_override;
}
-void Area2D::set_audio_bus(const StringName &p_audio_bus) {
+void Area2D::set_audio_bus_name(const StringName &p_audio_bus) {
audio_bus = p_audio_bus;
}
-StringName Area2D::get_audio_bus() const {
+StringName Area2D::get_audio_bus_name() const {
for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) {
if (AudioServer::get_singleton()->get_bus_name(i) == audio_bus) {
@@ -644,8 +644,8 @@ void Area2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("overlaps_body", "body"), &Area2D::overlaps_body);
ClassDB::bind_method(D_METHOD("overlaps_area", "area"), &Area2D::overlaps_area);
- ClassDB::bind_method(D_METHOD("set_audio_bus", "name"), &Area2D::set_audio_bus);
- ClassDB::bind_method(D_METHOD("get_audio_bus"), &Area2D::get_audio_bus);
+ ClassDB::bind_method(D_METHOD("set_audio_bus_name", "name"), &Area2D::set_audio_bus_name);
+ ClassDB::bind_method(D_METHOD("get_audio_bus_name"), &Area2D::get_audio_bus_name);
ClassDB::bind_method(D_METHOD("set_audio_bus_override", "enable"), &Area2D::set_audio_bus_override);
ClassDB::bind_method(D_METHOD("is_overriding_audio_bus"), &Area2D::is_overriding_audio_bus);
@@ -679,7 +679,7 @@ void Area2D::_bind_methods() {
ADD_GROUP("Audio Bus", "audio_bus_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "audio_bus_override"), "set_audio_bus_override", "is_overriding_audio_bus");
- ADD_PROPERTY(PropertyInfo(Variant::STRING, "audio_bus_name", PROPERTY_HINT_ENUM, ""), "set_audio_bus", "get_audio_bus");
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "audio_bus_name", PROPERTY_HINT_ENUM, ""), "set_audio_bus_name", "get_audio_bus_name");
BIND_ENUM_CONSTANT(SPACE_OVERRIDE_DISABLED);
BIND_ENUM_CONSTANT(SPACE_OVERRIDE_COMBINE);
diff --git a/scene/2d/area_2d.h b/scene/2d/area_2d.h
index c56cf651a1..09ccb364e6 100644
--- a/scene/2d/area_2d.h
+++ b/scene/2d/area_2d.h
@@ -186,8 +186,8 @@ public:
void set_audio_bus_override(bool p_override);
bool is_overriding_audio_bus() const;
- void set_audio_bus(const StringName &p_audio_bus);
- StringName get_audio_bus() const;
+ void set_audio_bus_name(const StringName &p_audio_bus);
+ StringName get_audio_bus_name() const;
Area2D();
~Area2D();
diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp
index 4b108996f0..73e633139b 100644
--- a/scene/2d/audio_stream_player_2d.cpp
+++ b/scene/2d/audio_stream_player_2d.cpp
@@ -113,7 +113,7 @@ void AudioStreamPlayer2D::_notification(int p_what) {
AudioServer::get_singleton()->remove_callback(_mix_audios, this);
}
- if (p_what == NOTIFICATION_INTERNAL_FIXED_PROCESS) {
+ if (p_what == NOTIFICATION_INTERNAL_PHYSICS_PROCESS) {
//update anything related to position first, if possible of course
@@ -145,7 +145,7 @@ void AudioStreamPlayer2D::_notification(int p_what) {
if (!area2d->is_overriding_audio_bus())
continue;
- StringName bus_name = area2d->get_audio_bus();
+ StringName bus_name = area2d->get_audio_bus_name();
bus_index = AudioServer::get_singleton()->thread_find_bus_index(bus_name);
break;
}
@@ -203,7 +203,7 @@ void AudioStreamPlayer2D::_notification(int p_what) {
//stop playing if no longer active
if (!active) {
- set_fixed_process_internal(false);
+ set_physics_process_internal(false);
//do not update, this makes it easier to animate (will shut off otherise)
//_change_notify("playing"); //update property in editor
emit_signal("finished");
@@ -255,7 +255,7 @@ void AudioStreamPlayer2D::play(float p_from_pos) {
if (stream_playback.is_valid()) {
setplay = p_from_pos;
output_ready = false;
- set_fixed_process_internal(true);
+ set_physics_process_internal(true);
}
}
@@ -270,7 +270,7 @@ void AudioStreamPlayer2D::stop() {
if (stream_playback.is_valid()) {
active = false;
- set_fixed_process_internal(false);
+ set_physics_process_internal(false);
setplay = -1;
}
}
@@ -284,10 +284,10 @@ bool AudioStreamPlayer2D::is_playing() const {
return false;
}
-float AudioStreamPlayer2D::get_position() {
+float AudioStreamPlayer2D::get_playback_position() {
if (stream_playback.is_valid()) {
- return stream_playback->get_position();
+ return stream_playback->get_playback_position();
}
return 0;
@@ -395,7 +395,7 @@ void AudioStreamPlayer2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("stop"), &AudioStreamPlayer2D::stop);
ClassDB::bind_method(D_METHOD("is_playing"), &AudioStreamPlayer2D::is_playing);
- ClassDB::bind_method(D_METHOD("get_position"), &AudioStreamPlayer2D::get_position);
+ ClassDB::bind_method(D_METHOD("get_playback_position"), &AudioStreamPlayer2D::get_playback_position);
ClassDB::bind_method(D_METHOD("set_bus", "bus"), &AudioStreamPlayer2D::set_bus);
ClassDB::bind_method(D_METHOD("get_bus"), &AudioStreamPlayer2D::get_bus);
diff --git a/scene/2d/audio_stream_player_2d.h b/scene/2d/audio_stream_player_2d.h
index 112d05856b..85104fce21 100644
--- a/scene/2d/audio_stream_player_2d.h
+++ b/scene/2d/audio_stream_player_2d.h
@@ -72,7 +72,7 @@ public:
void seek(float p_seconds);
void stop();
bool is_playing() const;
- float get_position();
+ float get_playback_position();
void set_bus(const StringName &p_bus);
StringName get_bus() const;
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index 0d04967f1c..4fcd6893b8 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -138,7 +138,7 @@ Transform2D Camera2D::get_camera_transform() {
if (smoothing_enabled && !Engine::get_singleton()->is_editor_hint()) {
- float c = smoothing * get_fixed_process_delta_time();
+ float c = smoothing * get_physics_process_delta_time();
smoothed_camera_pos = ((camera_pos - smoothed_camera_pos) * c) + smoothed_camera_pos;
ret_camera_pos = smoothed_camera_pos;
//camera_pos=camera_pos*(1.0-smoothing)+new_camera_pos*smoothing;
@@ -212,14 +212,14 @@ void Camera2D::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_FIXED_PROCESS: {
+ case NOTIFICATION_PHYSICS_PROCESS: {
_update_scroll();
} break;
case NOTIFICATION_TRANSFORM_CHANGED: {
- if (!is_fixed_processing())
+ if (!is_physics_processing())
_update_scroll();
} break;
@@ -241,7 +241,7 @@ void Camera2D::_notification(int p_what) {
add_to_group(canvas_group_name);
if (Engine::get_singleton()->is_editor_hint()) {
- set_fixed_process(false);
+ set_physics_process(false);
}
_update_scroll();
@@ -498,9 +498,9 @@ void Camera2D::set_follow_smoothing(float p_speed) {
smoothing = p_speed;
if (smoothing > 0 && !(is_inside_tree() && Engine::get_singleton()->is_editor_hint()))
- set_fixed_process(true);
+ set_physics_process(true);
else
- set_fixed_process(false);
+ set_physics_process(false);
}
float Camera2D::get_follow_smoothing() const {
diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp
index ce56b85a9e..73e5dc6021 100644
--- a/scene/2d/collision_object_2d.cpp
+++ b/scene/2d/collision_object_2d.cpp
@@ -82,7 +82,7 @@ uint32_t CollisionObject2D::create_shape_owner(Object *p_owner) {
uint32_t id;
if (shapes.size() == 0) {
- id = 1;
+ id = 0;
} else {
id = shapes.back()->key() + 1;
}
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index c6cd3677cd..d3b37ae903 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -999,7 +999,7 @@ bool KinematicBody2D::move_and_collide(const Vector2 &p_motion, Collision &r_col
Vector2 KinematicBody2D::move_and_slide(const Vector2 &p_linear_velocity, const Vector2 &p_floor_direction, float p_slope_stop_min_velocity, int p_max_slides, float p_floor_max_angle) {
- Vector2 motion = (floor_velocity + p_linear_velocity) * get_fixed_process_delta_time();
+ Vector2 motion = (floor_velocity + p_linear_velocity) * get_physics_process_delta_time();
Vector2 lv = p_linear_velocity;
on_floor = false;
diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp
index f90331c411..b272da46f8 100644
--- a/scene/2d/ray_cast_2d.cpp
+++ b/scene/2d/ray_cast_2d.cpp
@@ -95,7 +95,7 @@ void RayCast2D::set_enabled(bool p_enabled) {
enabled = p_enabled;
if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint())
- set_fixed_process(p_enabled);
+ set_physics_process(p_enabled);
if (!p_enabled)
collided = false;
}
@@ -135,9 +135,9 @@ void RayCast2D::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
if (enabled && !Engine::get_singleton()->is_editor_hint())
- set_fixed_process(true);
+ set_physics_process(true);
else
- set_fixed_process(false);
+ set_physics_process(false);
if (Object::cast_to<PhysicsBody2D>(get_parent())) {
if (exclude_parent_body)
@@ -149,7 +149,7 @@ void RayCast2D::_notification(int p_what) {
case NOTIFICATION_EXIT_TREE: {
if (enabled)
- set_fixed_process(false);
+ set_physics_process(false);
} break;
@@ -177,7 +177,7 @@ void RayCast2D::_notification(int p_what) {
} break;
- case NOTIFICATION_FIXED_PROCESS: {
+ case NOTIFICATION_PHYSICS_PROCESS: {
if (!enabled)
break;
diff --git a/scene/2d/visibility_notifier_2d.cpp b/scene/2d/visibility_notifier_2d.cpp
index 8fc8b65217..ca7b6aa0e4 100644
--- a/scene/2d/visibility_notifier_2d.cpp
+++ b/scene/2d/visibility_notifier_2d.cpp
@@ -154,8 +154,8 @@ void VisibilityEnabler2D::_screen_enter() {
_change_node_state(E->key(), true);
}
- if (enabler[ENABLER_PARENT_FIXED_PROCESS] && get_parent())
- get_parent()->set_fixed_process(true);
+ if (enabler[ENABLER_PARENT_PHYSICS_PROCESS] && get_parent())
+ get_parent()->set_physics_process(true);
if (enabler[ENABLER_PARENT_PROCESS] && get_parent())
get_parent()->set_process(true);
@@ -169,8 +169,8 @@ void VisibilityEnabler2D::_screen_exit() {
_change_node_state(E->key(), false);
}
- if (enabler[ENABLER_PARENT_FIXED_PROCESS] && get_parent())
- get_parent()->set_fixed_process(false);
+ if (enabler[ENABLER_PARENT_PHYSICS_PROCESS] && get_parent())
+ get_parent()->set_physics_process(false);
if (enabler[ENABLER_PARENT_PROCESS] && get_parent())
get_parent()->set_process(false);
@@ -246,8 +246,8 @@ void VisibilityEnabler2D::_notification(int p_what) {
_find_nodes(from);
- if (enabler[ENABLER_PARENT_FIXED_PROCESS] && get_parent())
- get_parent()->set_fixed_process(false);
+ if (enabler[ENABLER_PARENT_PHYSICS_PROCESS] && get_parent())
+ get_parent()->set_physics_process(false);
if (enabler[ENABLER_PARENT_PROCESS] && get_parent())
get_parent()->set_process(false);
}
@@ -339,14 +339,14 @@ void VisibilityEnabler2D::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "pause_particles"), "set_enabler", "is_enabler_enabled", ENABLER_PAUSE_PARTICLES);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "pause_animated_sprites"), "set_enabler", "is_enabler_enabled", ENABLER_PAUSE_ANIMATED_SPRITES);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "process_parent"), "set_enabler", "is_enabler_enabled", ENABLER_PARENT_PROCESS);
- ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "fixed_process_parent"), "set_enabler", "is_enabler_enabled", ENABLER_PARENT_FIXED_PROCESS);
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "physics_process_parent"), "set_enabler", "is_enabler_enabled", ENABLER_PARENT_PHYSICS_PROCESS);
BIND_ENUM_CONSTANT(ENABLER_FREEZE_BODIES);
BIND_ENUM_CONSTANT(ENABLER_PAUSE_ANIMATIONS);
BIND_ENUM_CONSTANT(ENABLER_PAUSE_PARTICLES);
BIND_ENUM_CONSTANT(ENABLER_PAUSE_ANIMATED_SPRITES);
BIND_ENUM_CONSTANT(ENABLER_PARENT_PROCESS);
- BIND_ENUM_CONSTANT(ENABLER_PARENT_FIXED_PROCESS);
+ BIND_ENUM_CONSTANT(ENABLER_PARENT_PHYSICS_PROCESS);
BIND_ENUM_CONSTANT(ENABLER_MAX);
}
@@ -366,7 +366,7 @@ VisibilityEnabler2D::VisibilityEnabler2D() {
for (int i = 0; i < ENABLER_MAX; i++)
enabler[i] = true;
enabler[ENABLER_PARENT_PROCESS] = false;
- enabler[ENABLER_PARENT_FIXED_PROCESS] = false;
+ enabler[ENABLER_PARENT_PHYSICS_PROCESS] = false;
visible = false;
}
diff --git a/scene/2d/visibility_notifier_2d.h b/scene/2d/visibility_notifier_2d.h
index ef0e1affd3..ee5152978b 100644
--- a/scene/2d/visibility_notifier_2d.h
+++ b/scene/2d/visibility_notifier_2d.h
@@ -74,7 +74,7 @@ public:
ENABLER_FREEZE_BODIES,
ENABLER_PAUSE_PARTICLES,
ENABLER_PARENT_PROCESS,
- ENABLER_PARENT_FIXED_PROCESS,
+ ENABLER_PARENT_PHYSICS_PROCESS,
ENABLER_PAUSE_ANIMATED_SPRITES,
ENABLER_MAX
};
diff --git a/scene/3d/SCsub b/scene/3d/SCsub
index 90e78ba8d3..72739b527e 100644
--- a/scene/3d/SCsub
+++ b/scene/3d/SCsub
@@ -3,7 +3,7 @@
Import('env')
-if (env["disable_3d"] == "yes"):
+if env['disable_3d']:
env.scene_sources.append("3d/spatial.cpp")
env.scene_sources.append("3d/skeleton.cpp")
diff --git a/scene/3d/arvr_nodes.cpp b/scene/3d/arvr_nodes.cpp
index 147d3bf115..c6b6c02129 100644
--- a/scene/3d/arvr_nodes.cpp
+++ b/scene/3d/arvr_nodes.cpp
@@ -67,6 +67,105 @@ String ARVRCamera::get_configuration_warning() const {
return String();
};
+Vector3 ARVRCamera::project_local_ray_normal(const Point2 &p_pos) const {
+ // get our ARVRServer
+ ARVRServer *arvr_server = ARVRServer::get_singleton();
+ ERR_FAIL_NULL_V(arvr_server, Vector3());
+
+ Ref<ARVRInterface> arvr_interface = arvr_server->get_primary_interface();
+ ERR_FAIL_COND_V(arvr_interface.is_null(), Vector3());
+
+ if (!is_inside_tree()) {
+ ERR_EXPLAIN("Camera is not inside scene.");
+ ERR_FAIL_COND_V(!is_inside_tree(), Vector3());
+ };
+
+ Size2 viewport_size = get_viewport()->get_camera_rect_size();
+ Vector2 cpos = get_viewport()->get_camera_coords(p_pos);
+ Vector3 ray;
+
+ CameraMatrix cm = arvr_interface->get_projection_for_eye(ARVRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar());
+ float screen_w, screen_h;
+ cm.get_viewport_size(screen_w, screen_h);
+ ray = Vector3(((cpos.x / viewport_size.width) * 2.0 - 1.0) * screen_w, ((1.0 - (cpos.y / viewport_size.height)) * 2.0 - 1.0) * screen_h, -get_znear()).normalized();
+
+ return ray;
+};
+
+Point2 ARVRCamera::unproject_position(const Vector3 &p_pos) const {
+ // get our ARVRServer
+ ARVRServer *arvr_server = ARVRServer::get_singleton();
+ ERR_FAIL_NULL_V(arvr_server, Vector2());
+
+ Ref<ARVRInterface> arvr_interface = arvr_server->get_primary_interface();
+ ERR_FAIL_COND_V(arvr_interface.is_null(), Vector2());
+
+ if (!is_inside_tree()) {
+ ERR_EXPLAIN("Camera is not inside scene.");
+ ERR_FAIL_COND_V(!is_inside_tree(), Vector2());
+ };
+
+ Size2 viewport_size = get_viewport()->get_visible_rect().size;
+
+ CameraMatrix cm = arvr_interface->get_projection_for_eye(ARVRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar());
+
+ Plane p(get_camera_transform().xform_inv(p_pos), 1.0);
+
+ p = cm.xform4(p);
+ p.normal /= p.d;
+
+ Point2 res;
+ res.x = (p.normal.x * 0.5 + 0.5) * viewport_size.x;
+ res.y = (-p.normal.y * 0.5 + 0.5) * viewport_size.y;
+
+ return res;
+};
+
+Vector3 ARVRCamera::project_position(const Point2 &p_point) const {
+ // get our ARVRServer
+ ARVRServer *arvr_server = ARVRServer::get_singleton();
+ ERR_FAIL_NULL_V(arvr_server, Vector3());
+
+ Ref<ARVRInterface> arvr_interface = arvr_server->get_primary_interface();
+ ERR_FAIL_COND_V(arvr_interface.is_null(), Vector3());
+
+ if (!is_inside_tree()) {
+ ERR_EXPLAIN("Camera is not inside scene.");
+ ERR_FAIL_COND_V(!is_inside_tree(), Vector3());
+ };
+
+ Size2 viewport_size = get_viewport()->get_visible_rect().size;
+
+ CameraMatrix cm = arvr_interface->get_projection_for_eye(ARVRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar());
+
+ Size2 vp_size;
+ cm.get_viewport_size(vp_size.x, vp_size.y);
+
+ Vector2 point;
+ point.x = (p_point.x / viewport_size.x) * 2.0 - 1.0;
+ point.y = (1.0 - (p_point.y / viewport_size.y)) * 2.0 - 1.0;
+ point *= vp_size;
+
+ Vector3 p(point.x, point.y, -get_znear());
+
+ return get_camera_transform().xform(p);
+};
+
+Vector<Plane> ARVRCamera::get_frustum() const {
+ // get our ARVRServer
+ ARVRServer *arvr_server = ARVRServer::get_singleton();
+ ERR_FAIL_NULL_V(arvr_server, Vector<Plane>());
+
+ Ref<ARVRInterface> arvr_interface = arvr_server->get_primary_interface();
+ ERR_FAIL_COND_V(arvr_interface.is_null(), Vector<Plane>());
+
+ ERR_FAIL_COND_V(!is_inside_world(), Vector<Plane>());
+
+ Size2 viewport_size = get_viewport()->get_visible_rect().size;
+ CameraMatrix cm = arvr_interface->get_projection_for_eye(ARVRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar());
+ return cm.get_projection_planes(get_camera_transform());
+};
+
ARVRCamera::ARVRCamera(){
// nothing to do here yet for now..
};
@@ -297,6 +396,8 @@ void ARVRAnchor::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_is_active"), &ARVRAnchor::get_is_active);
ClassDB::bind_method(D_METHOD("get_size"), &ARVRAnchor::get_size);
+
+ ClassDB::bind_method(D_METHOD("get_plane"), &ARVRAnchor::get_plane);
};
void ARVRAnchor::set_anchor_id(int p_anchor_id) {
@@ -346,6 +447,15 @@ String ARVRAnchor::get_configuration_warning() const {
return String();
};
+Plane ARVRAnchor::get_plane() const {
+ Vector3 location = get_translation();
+ Basis orientation = get_transform().basis;
+
+ Plane plane(location, orientation.get_axis(1).normalized());
+
+ return plane;
+};
+
ARVRAnchor::ARVRAnchor() {
anchor_id = 0;
is_active = true;
diff --git a/scene/3d/arvr_nodes.h b/scene/3d/arvr_nodes.h
index 5269ec0248..e0ccfab58b 100644
--- a/scene/3d/arvr_nodes.h
+++ b/scene/3d/arvr_nodes.h
@@ -52,6 +52,11 @@ protected:
public:
String get_configuration_warning() const;
+ virtual Vector3 project_local_ray_normal(const Point2 &p_pos) const;
+ virtual Point2 unproject_position(const Vector3 &p_pos) const;
+ virtual Vector3 project_position(const Point2 &p_point) const;
+ virtual Vector<Plane> get_frustum() const;
+
ARVRCamera();
~ARVRCamera();
};
@@ -118,6 +123,8 @@ public:
bool get_is_active() const;
Vector3 get_size() const;
+ Plane get_plane() const;
+
String get_configuration_warning() const;
ARVRAnchor();
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index c8c478ae18..3c92814c87 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -214,7 +214,7 @@ void AudioStreamPlayer3D::_notification(int p_what) {
}
}
- if (p_what == NOTIFICATION_INTERNAL_FIXED_PROCESS) {
+ if (p_what == NOTIFICATION_INTERNAL_PHYSICS_PROCESS) {
//update anything related to position first, if possible of course
@@ -512,7 +512,7 @@ void AudioStreamPlayer3D::_notification(int p_what) {
//stop playing if no longer active
if (!active) {
- set_fixed_process_internal(false);
+ set_physics_process_internal(false);
//do not update, this makes it easier to animate (will shut off otherise)
//_change_notify("playing"); //update property in editor
emit_signal("finished");
@@ -582,7 +582,7 @@ void AudioStreamPlayer3D::play(float p_from_pos) {
if (stream_playback.is_valid()) {
setplay = p_from_pos;
output_ready = false;
- set_fixed_process_internal(true);
+ set_physics_process_internal(true);
}
}
@@ -597,7 +597,7 @@ void AudioStreamPlayer3D::stop() {
if (stream_playback.is_valid()) {
active = false;
- set_fixed_process_internal(false);
+ set_physics_process_internal(false);
setplay = -1;
}
}
@@ -611,10 +611,10 @@ bool AudioStreamPlayer3D::is_playing() const {
return false;
}
-float AudioStreamPlayer3D::get_position() {
+float AudioStreamPlayer3D::get_playback_position() {
if (stream_playback.is_valid()) {
- return stream_playback->get_position();
+ return stream_playback->get_playback_position();
}
return 0;
@@ -776,7 +776,7 @@ void AudioStreamPlayer3D::set_doppler_tracking(DopplerTracking p_tracking) {
if (doppler_tracking != DOPPLER_TRACKING_DISABLED) {
set_notify_transform(true);
- velocity_tracker->set_track_fixed_step(doppler_tracking == DOPPLER_TRACKING_FIXED_STEP);
+ velocity_tracker->set_track_physics_step(doppler_tracking == DOPPLER_TRACKING_PHYSICS_STEP);
velocity_tracker->reset(get_global_transform().origin);
} else {
set_notify_transform(false);
@@ -807,7 +807,7 @@ void AudioStreamPlayer3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("stop"), &AudioStreamPlayer3D::stop);
ClassDB::bind_method(D_METHOD("is_playing"), &AudioStreamPlayer3D::is_playing);
- ClassDB::bind_method(D_METHOD("get_position"), &AudioStreamPlayer3D::get_position);
+ ClassDB::bind_method(D_METHOD("get_playback_position"), &AudioStreamPlayer3D::get_playback_position);
ClassDB::bind_method(D_METHOD("set_bus", "bus"), &AudioStreamPlayer3D::set_bus);
ClassDB::bind_method(D_METHOD("get_bus"), &AudioStreamPlayer3D::get_bus);
@@ -880,7 +880,7 @@ void AudioStreamPlayer3D::_bind_methods() {
BIND_ENUM_CONSTANT(DOPPLER_TRACKING_DISABLED);
BIND_ENUM_CONSTANT(DOPPLER_TRACKING_IDLE_STEP);
- BIND_ENUM_CONSTANT(DOPPLER_TRACKING_FIXED_STEP);
+ BIND_ENUM_CONSTANT(DOPPLER_TRACKING_PHYSICS_STEP);
ADD_SIGNAL(MethodInfo("finished"));
}
diff --git a/scene/3d/audio_stream_player_3d.h b/scene/3d/audio_stream_player_3d.h
index a6ce123790..5982d7a3ac 100644
--- a/scene/3d/audio_stream_player_3d.h
+++ b/scene/3d/audio_stream_player_3d.h
@@ -26,7 +26,7 @@ public:
enum DopplerTracking {
DOPPLER_TRACKING_DISABLED,
DOPPLER_TRACKING_IDLE_STEP,
- DOPPLER_TRACKING_FIXED_STEP
+ DOPPLER_TRACKING_PHYSICS_STEP
};
private:
@@ -127,7 +127,7 @@ public:
void seek(float p_seconds);
void stop();
bool is_playing() const;
- float get_position();
+ float get_playback_position();
void set_bus(const StringName &p_bus);
StringName get_bus() const;
diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp
index 02a7845e0b..7baf9a9deb 100644
--- a/scene/3d/camera.cpp
+++ b/scene/3d/camera.cpp
@@ -507,7 +507,7 @@ void Camera::set_doppler_tracking(DopplerTracking p_tracking) {
doppler_tracking = p_tracking;
if (p_tracking != DOPPLER_TRACKING_DISABLED) {
- velocity_tracker->set_track_fixed_step(doppler_tracking == DOPPLER_TRACKING_FIXED_STEP);
+ velocity_tracker->set_track_physics_step(doppler_tracking == DOPPLER_TRACKING_PHYSICS_STEP);
velocity_tracker->reset(get_global_transform().origin);
}
}
@@ -557,7 +557,7 @@ void Camera::_bind_methods() {
BIND_ENUM_CONSTANT(DOPPLER_TRACKING_DISABLED)
BIND_ENUM_CONSTANT(DOPPLER_TRACKING_IDLE_STEP)
- BIND_ENUM_CONSTANT(DOPPLER_TRACKING_FIXED_STEP)
+ BIND_ENUM_CONSTANT(DOPPLER_TRACKING_PHYSICS_STEP)
}
float Camera::get_fov() const {
diff --git a/scene/3d/camera.h b/scene/3d/camera.h
index 243a7b9b39..73c6844c1a 100644
--- a/scene/3d/camera.h
+++ b/scene/3d/camera.h
@@ -56,7 +56,7 @@ public:
enum DopplerTracking {
DOPPLER_TRACKING_DISABLED,
DOPPLER_TRACKING_IDLE_STEP,
- DOPPLER_TRACKING_FIXED_STEP
+ DOPPLER_TRACKING_PHYSICS_STEP
};
private:
@@ -127,16 +127,16 @@ public:
virtual Transform get_camera_transform() const;
Vector3 project_ray_normal(const Point2 &p_pos) const;
- Vector3 project_ray_origin(const Point2 &p_pos) const;
+ virtual 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;
+ virtual 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;
+ virtual Vector3 project_position(const Point2 &p_point) const;
void set_cull_mask(uint32_t p_layers);
uint32_t get_cull_mask() const;
- Vector<Plane> get_frustum() const;
+ virtual Vector<Plane> get_frustum() const;
void set_environment(const Ref<Environment> &p_environment);
Ref<Environment> get_environment() const;
diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp
index 1c0633fba7..7b4770e435 100644
--- a/scene/3d/collision_object.cpp
+++ b/scene/3d/collision_object.cpp
@@ -161,7 +161,7 @@ uint32_t CollisionObject::create_shape_owner(Object *p_owner) {
uint32_t id;
if (shapes.size() == 0) {
- id = 1;
+ id = 0;
} else {
id = shapes.back()->key() + 1;
}
diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp
index 66364d40f9..9d55a82824 100644
--- a/scene/3d/gi_probe.cpp
+++ b/scene/3d/gi_probe.cpp
@@ -1486,8 +1486,8 @@ GIProbe::GIProbe() {
subdiv = SUBDIV_128;
dynamic_range = 4;
energy = 1.0;
- bias = 0.0;
- normal_bias = 0.8;
+ bias = 1.5;
+ normal_bias = 0.0;
propagation = 1.0;
extents = Vector3(10, 10, 10);
color_scan_cell_width = 4;
diff --git a/scene/3d/immediate_geometry.h b/scene/3d/immediate_geometry.h
index 6db825bf54..93ef726c6d 100644
--- a/scene/3d/immediate_geometry.h
+++ b/scene/3d/immediate_geometry.h
@@ -38,7 +38,7 @@ class ImmediateGeometry : public GeometryInstance {
GDCLASS(ImmediateGeometry, GeometryInstance);
RID im;
- //a list of texures drawn need to be kept, to avoid references
+ //a list of textures drawn need to be kept, to avoid references
// in VisualServer from becoming invalid if the texture is no longer used
List<Ref<Texture> > cached_textures;
bool empty;
diff --git a/scene/3d/interpolated_camera.cpp b/scene/3d/interpolated_camera.cpp
index 0f281b694d..3ff8317732 100644
--- a/scene/3d/interpolated_camera.cpp
+++ b/scene/3d/interpolated_camera.cpp
@@ -37,7 +37,7 @@ void InterpolatedCamera::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
if (Engine::get_singleton()->is_editor_hint() && enabled)
- set_fixed_process(false);
+ set_physics_process(false);
} break;
case NOTIFICATION_PROCESS: {
diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp
index 7402e664d9..b7cd9bd2dc 100644
--- a/scene/3d/light.cpp
+++ b/scene/3d/light.cpp
@@ -369,6 +369,12 @@ DirectionalLight::DirectionalLight()
set_shadow_depth_range(SHADOW_DEPTH_RANGE_STABLE);
blend_splits = false;
+
+#ifdef TOOLS_ENABLED
+ if (Engine::get_singleton()->is_editor_hint())
+ // Create light with a default natural "sun" orientation in editor, instead of looking horizontally on X
+ set_rotation_in_degrees(Vector3(-50, 25, 30));
+#endif
}
void OmniLight::set_shadow_mode(ShadowMode p_mode) {
diff --git a/scene/3d/navigation.cpp b/scene/3d/navigation.cpp
index d8c7a78648..b226cca02b 100644
--- a/scene/3d/navigation.cpp
+++ b/scene/3d/navigation.cpp
@@ -35,8 +35,6 @@ void Navigation::_navmesh_link(int p_id) {
NavMesh &nm = navmesh_map[p_id];
ERR_FAIL_COND(nm.linked);
- print_line("LINK");
-
PoolVector<Vector3> vertices = nm.navmesh->get_vertices();
int len = vertices.size();
if (len == 0)
@@ -144,8 +142,6 @@ void Navigation::_navmesh_unlink(int p_id) {
NavMesh &nm = navmesh_map[p_id];
ERR_FAIL_COND(!nm.linked);
- print_line("UNLINK");
-
for (List<Polygon>::Element *E = nm.polygons.front(); E; E = E->next()) {
Polygon &p = E->get();
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp
index 005ea1f8d1..d7fdf94d40 100644
--- a/scene/3d/physics_body.cpp
+++ b/scene/3d/physics_body.cpp
@@ -960,7 +960,7 @@ bool KinematicBody::move_and_collide(const Vector3 &p_motion, Collision &r_colli
Vector3 KinematicBody::move_and_slide(const Vector3 &p_linear_velocity, const Vector3 &p_floor_direction, float p_slope_stop_min_velocity, int p_max_slides, float p_floor_max_angle) {
- Vector3 motion = (floor_velocity + p_linear_velocity) * get_fixed_process_delta_time();
+ Vector3 motion = (floor_velocity + p_linear_velocity) * get_physics_process_delta_time();
Vector3 lv = p_linear_velocity;
on_floor = false;
diff --git a/scene/3d/ray_cast.cpp b/scene/3d/ray_cast.cpp
index 72b7706b77..df6764ee1a 100644
--- a/scene/3d/ray_cast.cpp
+++ b/scene/3d/ray_cast.cpp
@@ -97,7 +97,7 @@ void RayCast::set_enabled(bool p_enabled) {
enabled = p_enabled;
if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint())
- set_fixed_process(p_enabled);
+ set_physics_process(p_enabled);
if (!p_enabled)
collided = false;
@@ -121,25 +121,25 @@ void RayCast::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
if (enabled && !Engine::get_singleton()->is_editor_hint()) {
- set_fixed_process(true);
+ set_physics_process(true);
if (get_tree()->is_debugging_collisions_hint())
_update_debug_shape();
} else
- set_fixed_process(false);
+ set_physics_process(false);
} break;
case NOTIFICATION_EXIT_TREE: {
if (enabled) {
- set_fixed_process(false);
+ set_physics_process(false);
}
if (debug_shape)
_clear_debug_shape();
} break;
- case NOTIFICATION_FIXED_PROCESS: {
+ case NOTIFICATION_PHYSICS_PROCESS: {
if (!enabled)
break;
diff --git a/scene/3d/spatial_velocity_tracker.cpp b/scene/3d/spatial_velocity_tracker.cpp
index dc822d0446..1c7423e645 100644
--- a/scene/3d/spatial_velocity_tracker.cpp
+++ b/scene/3d/spatial_velocity_tracker.cpp
@@ -1,21 +1,21 @@
#include "spatial_velocity_tracker.h"
#include "engine.h"
-void SpatialVelocityTracker::set_track_fixed_step(bool p_track_fixed_step) {
+void SpatialVelocityTracker::set_track_physics_step(bool p_track_physics_step) {
- fixed_step = p_track_fixed_step;
+ physics_step = p_track_physics_step;
}
-bool SpatialVelocityTracker::is_tracking_fixed_step() const {
+bool SpatialVelocityTracker::is_tracking_physics_step() const {
- return fixed_step;
+ return physics_step;
}
void SpatialVelocityTracker::update_position(const Vector3 &p_position) {
PositionHistory ph;
ph.position = p_position;
- if (fixed_step) {
- ph.frame = Engine::get_singleton()->get_fixed_frames();
+ if (physics_step) {
+ ph.frame = Engine::get_singleton()->get_physics_frames();
} else {
ph.frame = Engine::get_singleton()->get_idle_frame_ticks();
}
@@ -40,8 +40,8 @@ Vector3 SpatialVelocityTracker::get_tracked_linear_velocity() const {
float base_time = 0.0;
if (position_history_len) {
- if (fixed_step) {
- uint64_t base = Engine::get_singleton()->get_fixed_frames();
+ if (physics_step) {
+ uint64_t base = Engine::get_singleton()->get_physics_frames();
base_time = float(base - position_history[0].frame) / Engine::get_singleton()->get_iterations_per_second();
} else {
uint64_t base = Engine::get_singleton()->get_idle_frame_ticks();
@@ -54,7 +54,7 @@ Vector3 SpatialVelocityTracker::get_tracked_linear_velocity() const {
uint64_t diff = position_history[i].frame - position_history[i + 1].frame;
Vector3 distance = position_history[i].position - position_history[i + 1].position;
- if (fixed_step) {
+ if (physics_step) {
delta = float(diff) / Engine::get_singleton()->get_iterations_per_second();
} else {
delta = double(diff) / 1000000.0;
@@ -78,8 +78,8 @@ void SpatialVelocityTracker::reset(const Vector3 &p_new_pos) {
PositionHistory ph;
ph.position = p_new_pos;
- if (fixed_step) {
- ph.frame = Engine::get_singleton()->get_fixed_frames();
+ if (physics_step) {
+ ph.frame = Engine::get_singleton()->get_physics_frames();
} else {
ph.frame = Engine::get_singleton()->get_idle_frame_ticks();
}
@@ -90,8 +90,8 @@ void SpatialVelocityTracker::reset(const Vector3 &p_new_pos) {
void SpatialVelocityTracker::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_track_fixed_step", "enable"), &SpatialVelocityTracker::set_track_fixed_step);
- ClassDB::bind_method(D_METHOD("is_tracking_fixed_step"), &SpatialVelocityTracker::is_tracking_fixed_step);
+ ClassDB::bind_method(D_METHOD("set_track_physics_step", "enable"), &SpatialVelocityTracker::set_track_physics_step);
+ ClassDB::bind_method(D_METHOD("is_tracking_physics_step"), &SpatialVelocityTracker::is_tracking_physics_step);
ClassDB::bind_method(D_METHOD("update_position", "position"), &SpatialVelocityTracker::update_position);
ClassDB::bind_method(D_METHOD("get_tracked_linear_velocity"), &SpatialVelocityTracker::get_tracked_linear_velocity);
ClassDB::bind_method(D_METHOD("reset", "position"), &SpatialVelocityTracker::reset);
@@ -100,5 +100,5 @@ void SpatialVelocityTracker::_bind_methods() {
SpatialVelocityTracker::SpatialVelocityTracker() {
position_history.resize(4); // should be configurable
position_history_len = 0;
- fixed_step = false;
+ physics_step = false;
}
diff --git a/scene/3d/spatial_velocity_tracker.h b/scene/3d/spatial_velocity_tracker.h
index b8237613a7..c4371ff1f7 100644
--- a/scene/3d/spatial_velocity_tracker.h
+++ b/scene/3d/spatial_velocity_tracker.h
@@ -11,7 +11,7 @@ class SpatialVelocityTracker : public Reference {
Vector3 position;
};
- bool fixed_step;
+ bool physics_step;
Vector<PositionHistory> position_history;
int position_history_len;
@@ -20,8 +20,8 @@ protected:
public:
void reset(const Vector3 &p_new_pos);
- void set_track_fixed_step(bool p_track_fixed_step);
- bool is_tracking_fixed_step() const;
+ void set_track_physics_step(bool p_track_physics_step);
+ bool is_tracking_physics_step() const;
void update_position(const Vector3 &p_position);
Vector3 get_tracked_linear_velocity() const;
diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp
index 3518113130..a072572142 100644
--- a/scene/3d/vehicle_body.cpp
+++ b/scene/3d/vehicle_body.cpp
@@ -267,6 +267,8 @@ void VehicleWheel::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_roll_influence", "roll_influence"), &VehicleWheel::set_roll_influence);
ClassDB::bind_method(D_METHOD("get_roll_influence"), &VehicleWheel::get_roll_influence);
+ ClassDB::bind_method(D_METHOD("get_skidinfo"), &VehicleWheel::get_skidinfo);
+
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_as_traction"), "set_use_as_traction", "is_used_as_traction");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_as_steering"), "set_use_as_steering", "is_used_as_steering");
ADD_GROUP("Wheel", "wheel_");
@@ -303,6 +305,11 @@ bool VehicleWheel::is_used_as_steering() const {
return steers;
}
+float VehicleWheel::get_skidinfo() const {
+
+ return m_skidInfo;
+}
+
VehicleWheel::VehicleWheel() {
steers = false;
diff --git a/scene/3d/vehicle_body.h b/scene/3d/vehicle_body.h
index eb661adb90..c642eb61b8 100644
--- a/scene/3d/vehicle_body.h
+++ b/scene/3d/vehicle_body.h
@@ -131,6 +131,8 @@ public:
void set_roll_influence(float p_value);
float get_roll_influence() const;
+ float get_skidinfo() const;
+
String get_configuration_warning() const;
VehicleWheel();
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index cadbd086bc..05963acf56 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -192,7 +192,7 @@ void AnimationPlayer::_notification(int p_what) {
if (!processing) {
//make sure that a previous process state was not saved
//only process if "processing" is set
- set_fixed_process(false);
+ set_physics_process(false);
set_process(false);
}
//_set_process(false);
@@ -207,19 +207,19 @@ void AnimationPlayer::_notification(int p_what) {
}
} break;
case NOTIFICATION_INTERNAL_PROCESS: {
- if (animation_process_mode == ANIMATION_PROCESS_FIXED)
+ if (animation_process_mode == ANIMATION_PROCESS_PHYSICS)
break;
if (processing)
_animation_process(get_process_delta_time());
} break;
- case NOTIFICATION_INTERNAL_FIXED_PROCESS: {
+ case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
if (animation_process_mode == ANIMATION_PROCESS_IDLE)
break;
if (processing)
- _animation_process(get_fixed_process_delta_time());
+ _animation_process(get_physics_process_delta_time());
} break;
case NOTIFICATION_EXIT_TREE: {
@@ -434,7 +434,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float
pa->object->set(pa->prop, value, &valid); //you are not speshul
#ifdef DEBUG_ENABLED
if (!valid) {
- ERR_PRINTS("Failed setting track value '" + String(pa->owner->path) + "'. Check if property exists or the type of key is valid");
+ ERR_PRINTS("Failed setting track value '" + String(pa->owner->path) + "'. Check if property exists or the type of key is valid. Animation '" + a->get_name() + "' at node '" + get_path() + "'.");
}
#endif
@@ -442,7 +442,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float
case SP_NODE2D_POS: {
#ifdef DEBUG_ENABLED
if (value.get_type() != Variant::VECTOR2) {
- ERR_PRINTS("Position key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not of type Vector2()");
+ ERR_PRINTS("Position key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not of type Vector2(). Animation '" + a->get_name() + "' at node '" + get_path() + "'.");
}
#endif
static_cast<Node2D *>(pa->object)->set_position(value);
@@ -450,7 +450,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float
case SP_NODE2D_ROT: {
#ifdef DEBUG_ENABLED
if (value.is_num()) {
- ERR_PRINTS("Rotation key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not numerical");
+ ERR_PRINTS("Rotation key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not numerical. Animation '" + a->get_name() + "' at node '" + get_path() + "'.");
}
#endif
@@ -459,7 +459,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float
case SP_NODE2D_SCALE: {
#ifdef DEBUG_ENABLED
if (value.get_type() != Variant::VECTOR2) {
- ERR_PRINTS("Scale key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not of type Vector2()");
+ ERR_PRINTS("Scale key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not of type Vector2()." + a->get_name() + "' at node '" + get_path() + "'.");
}
#endif
@@ -615,7 +615,7 @@ void AnimationPlayer::_animation_update_transforms() {
pa->object->set(pa->prop, pa->value_accum, &valid); //you are not speshul
#ifdef DEBUG_ENABLED
if (!valid) {
- ERR_PRINTS("Failed setting key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "', Track '" + String(pa->owner->path) + "'. Check if property exists or the type of key is right for the property");
+ ERR_PRINTS("Failed setting key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "' at Node '" + get_path() + "', Track '" + String(pa->owner->path) + "'. Check if property exists or the type of key is right for the property");
}
#endif
@@ -623,7 +623,7 @@ void AnimationPlayer::_animation_update_transforms() {
case SP_NODE2D_POS: {
#ifdef DEBUG_ENABLED
if (pa->value_accum.get_type() != Variant::VECTOR2) {
- ERR_PRINTS("Position key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "', Track '" + String(pa->owner->path) + "' not of type Vector2()");
+ ERR_PRINTS("Position key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "' at Node '" + get_path() + "', Track '" + String(pa->owner->path) + "' not of type Vector2()");
}
#endif
static_cast<Node2D *>(pa->object)->set_position(pa->value_accum);
@@ -631,7 +631,7 @@ void AnimationPlayer::_animation_update_transforms() {
case SP_NODE2D_ROT: {
#ifdef DEBUG_ENABLED
if (pa->value_accum.is_num()) {
- ERR_PRINTS("Rotation key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "', Track '" + String(pa->owner->path) + "' not numerical");
+ ERR_PRINTS("Rotation key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "' at Node '" + get_path() + "', Track '" + String(pa->owner->path) + "' not numerical");
}
#endif
@@ -640,7 +640,7 @@ void AnimationPlayer::_animation_update_transforms() {
case SP_NODE2D_SCALE: {
#ifdef DEBUG_ENABLED
if (pa->value_accum.get_type() != Variant::VECTOR2) {
- ERR_PRINTS("Scale key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "', Track '" + String(pa->owner->path) + "' not of type Vector2()");
+ ERR_PRINTS("Scale key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "' at Node '" + get_path() + "', Track '" + String(pa->owner->path) + "' not of type Vector2()");
}
#endif
@@ -1140,7 +1140,7 @@ void AnimationPlayer::_set_process(bool p_process, bool p_force) {
switch (animation_process_mode) {
- case ANIMATION_PROCESS_FIXED: set_fixed_process_internal(p_process && active); break;
+ case ANIMATION_PROCESS_PHYSICS: set_physics_process_internal(p_process && active); break;
case ANIMATION_PROCESS_IDLE: set_process_internal(p_process && active); break;
}
@@ -1262,7 +1262,7 @@ void AnimationPlayer::_bind_methods() {
ADD_SIGNAL(MethodInfo("animation_changed", PropertyInfo(Variant::STRING, "old_name"), PropertyInfo(Variant::STRING, "new_name")));
ADD_SIGNAL(MethodInfo("animation_started", PropertyInfo(Variant::STRING, "name")));
- BIND_ENUM_CONSTANT(ANIMATION_PROCESS_FIXED);
+ BIND_ENUM_CONSTANT(ANIMATION_PROCESS_PHYSICS);
BIND_ENUM_CONSTANT(ANIMATION_PROCESS_IDLE);
}
diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h
index bface7aabb..83da3b2e5c 100644
--- a/scene/animation/animation_player.h
+++ b/scene/animation/animation_player.h
@@ -44,7 +44,7 @@ class AnimationPlayer : public Node {
public:
enum AnimationProcessMode {
- ANIMATION_PROCESS_FIXED,
+ ANIMATION_PROCESS_PHYSICS,
ANIMATION_PROCESS_IDLE,
};
diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp
index a2a8adb653..d564671bcf 100644
--- a/scene/animation/animation_tree_player.cpp
+++ b/scene/animation/animation_tree_player.cpp
@@ -56,7 +56,7 @@ void AnimationTreePlayer::_set_process(bool p_process, bool p_force) {
switch (animation_process_mode) {
- case ANIMATION_PROCESS_FIXED: set_fixed_process_internal(p_process && active); break;
+ case ANIMATION_PROCESS_PHYSICS: set_physics_process_internal(p_process && active); break;
case ANIMATION_PROCESS_IDLE: set_process_internal(p_process && active); break;
}
@@ -405,7 +405,7 @@ void AnimationTreePlayer::_notification(int p_what) {
if (!processing) {
//make sure that a previous process state was not saved
//only process if "processing" is set
- set_fixed_process_internal(false);
+ set_physics_process_internal(false);
set_process_internal(false);
}
} break;
@@ -416,19 +416,19 @@ void AnimationTreePlayer::_notification(int p_what) {
}
} break;
case NOTIFICATION_INTERNAL_PROCESS: {
- if (animation_process_mode == ANIMATION_PROCESS_FIXED)
+ if (animation_process_mode == ANIMATION_PROCESS_PHYSICS)
break;
if (processing)
_process_animation(get_process_delta_time());
} break;
- case NOTIFICATION_INTERNAL_FIXED_PROCESS: {
+ case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
if (animation_process_mode == ANIMATION_PROCESS_IDLE)
break;
if (processing)
- _process_animation(get_fixed_process_delta_time());
+ _process_animation(get_physics_process_delta_time());
} break;
}
}
@@ -1809,7 +1809,7 @@ void AnimationTreePlayer::_bind_methods() {
BIND_ENUM_CONSTANT(NODE_TIMESEEK);
BIND_ENUM_CONSTANT(NODE_TRANSITION);
- BIND_ENUM_CONSTANT(ANIMATION_PROCESS_FIXED);
+ BIND_ENUM_CONSTANT(ANIMATION_PROCESS_PHYSICS);
BIND_ENUM_CONSTANT(ANIMATION_PROCESS_IDLE);
}
diff --git a/scene/animation/animation_tree_player.h b/scene/animation/animation_tree_player.h
index 806a4f6604..3e2bb88198 100644
--- a/scene/animation/animation_tree_player.h
+++ b/scene/animation/animation_tree_player.h
@@ -42,7 +42,7 @@ class AnimationTreePlayer : public Node {
public:
enum AnimationProcessMode {
- ANIMATION_PROCESS_FIXED,
+ ANIMATION_PROCESS_PHYSICS,
ANIMATION_PROCESS_IDLE,
};
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp
index fb61c43d5c..fb327191b9 100644
--- a/scene/animation/tween.cpp
+++ b/scene/animation/tween.cpp
@@ -152,7 +152,7 @@ void Tween::_notification(int p_what) {
if (!processing) {
//make sure that a previous process state was not saved
//only process if "processing" is set
- set_fixed_process_internal(false);
+ set_physics_process_internal(false);
set_process_internal(false);
}
} break;
@@ -160,19 +160,19 @@ void Tween::_notification(int p_what) {
} break;
case NOTIFICATION_INTERNAL_PROCESS: {
- if (tween_process_mode == TWEEN_PROCESS_FIXED)
+ if (tween_process_mode == TWEEN_PROCESS_PHYSICS)
break;
if (processing)
_tween_process(get_process_delta_time());
} break;
- case NOTIFICATION_INTERNAL_FIXED_PROCESS: {
+ case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
if (tween_process_mode == TWEEN_PROCESS_IDLE)
break;
if (processing)
- _tween_process(get_fixed_process_delta_time());
+ _tween_process(get_physics_process_delta_time());
} break;
case NOTIFICATION_EXIT_TREE: {
@@ -224,7 +224,7 @@ void Tween::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "playback_process_mode", PROPERTY_HINT_ENUM, "Fixed,Idle"), "set_tween_process_mode", "get_tween_process_mode");
- BIND_ENUM_CONSTANT(TWEEN_PROCESS_FIXED);
+ BIND_ENUM_CONSTANT(TWEEN_PROCESS_PHYSICS);
BIND_ENUM_CONSTANT(TWEEN_PROCESS_IDLE);
BIND_ENUM_CONSTANT(TRANS_LINEAR);
@@ -642,7 +642,7 @@ void Tween::_set_process(bool p_process, bool p_force) {
switch (tween_process_mode) {
- case TWEEN_PROCESS_FIXED: set_fixed_process_internal(p_process && active); break;
+ case TWEEN_PROCESS_PHYSICS: set_physics_process_internal(p_process && active); break;
case TWEEN_PROCESS_IDLE: set_process_internal(p_process && active); break;
}
diff --git a/scene/animation/tween.h b/scene/animation/tween.h
index 929d63a7fc..fac1d346b4 100644
--- a/scene/animation/tween.h
+++ b/scene/animation/tween.h
@@ -38,7 +38,7 @@ class Tween : public Node {
public:
enum TweenProcessMode {
- TWEEN_PROCESS_FIXED,
+ TWEEN_PROCESS_PHYSICS,
TWEEN_PROCESS_IDLE,
};
diff --git a/scene/audio/audio_player.cpp b/scene/audio/audio_player.cpp
index 11e6c1b2e1..058b162e83 100644
--- a/scene/audio/audio_player.cpp
+++ b/scene/audio/audio_player.cpp
@@ -122,7 +122,6 @@ void AudioStreamPlayer::_notification(int p_what) {
void AudioStreamPlayer::set_stream(Ref<AudioStream> p_stream) {
- ERR_FAIL_COND(!p_stream.is_valid());
AudioServer::get_singleton()->lock();
mix_buffer.resize(AudioServer::get_singleton()->thread_get_mix_buffer_size());
@@ -134,12 +133,14 @@ void AudioStreamPlayer::set_stream(Ref<AudioStream> p_stream) {
setseek = -1;
}
- stream = p_stream;
- stream_playback = p_stream->instance_playback();
+ if (p_stream.is_valid()) {
+ stream = p_stream;
+ stream_playback = p_stream->instance_playback();
+ }
AudioServer::get_singleton()->unlock();
- if (stream_playback.is_null()) {
+ if (p_stream.is_valid() && stream_playback.is_null()) {
stream.unref();
ERR_FAIL_COND(stream_playback.is_null());
}
@@ -193,10 +194,10 @@ bool AudioStreamPlayer::is_playing() const {
return false;
}
-float AudioStreamPlayer::get_position() {
+float AudioStreamPlayer::get_playback_position() {
if (stream_playback.is_valid()) {
- return stream_playback->get_position();
+ return stream_playback->get_playback_position();
}
return 0;
@@ -284,7 +285,7 @@ void AudioStreamPlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("stop"), &AudioStreamPlayer::stop);
ClassDB::bind_method(D_METHOD("is_playing"), &AudioStreamPlayer::is_playing);
- ClassDB::bind_method(D_METHOD("get_position"), &AudioStreamPlayer::get_position);
+ ClassDB::bind_method(D_METHOD("get_playback_position"), &AudioStreamPlayer::get_playback_position);
ClassDB::bind_method(D_METHOD("set_bus", "bus"), &AudioStreamPlayer::set_bus);
ClassDB::bind_method(D_METHOD("get_bus"), &AudioStreamPlayer::get_bus);
diff --git a/scene/audio/audio_player.h b/scene/audio/audio_player.h
index 19b61ea5d8..4bfc44730d 100644
--- a/scene/audio/audio_player.h
+++ b/scene/audio/audio_player.h
@@ -83,7 +83,7 @@ public:
void seek(float p_seconds);
void stop();
bool is_playing() const;
- float get_position();
+ float get_playback_position();
void set_bus(const StringName &p_bus);
StringName get_bus() const;
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index 5713a35b7a..148277f2dd 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -39,7 +39,9 @@ void BaseButton::_unpress_group() {
if (!button_group.is_valid())
return;
- status.pressed = true;
+ if (toggle_mode) {
+ status.pressed = true;
+ }
for (Set<BaseButton *>::Element *E = button_group->buttons.front(); E; E = E->next()) {
if (E->get() == this)
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 704c00b1d6..e58cbe373b 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -177,29 +177,14 @@ void ColorPicker::_update_color() {
void ColorPicker::_update_presets() {
Size2 size = bt_add_preset->get_size();
- preset->set_custom_minimum_size(Size2(size.width * presets.size(), size.height));
-
- PoolVector<uint8_t> img;
- img.resize(size.x * presets.size() * size.y * 3);
-
- {
- PoolVector<uint8_t>::Write w = img.write();
- for (int y = 0; y < size.y; y++) {
- for (int x = 0; x < size.x * presets.size(); x++) {
- int ofs = (y * (size.x * presets.size()) + x) * 3;
- w[ofs + 0] = uint8_t(CLAMP(presets[(int)x / size.x].r * 255.0, 0, 255));
- w[ofs + 1] = uint8_t(CLAMP(presets[(int)x / size.x].g * 255.0, 0, 255));
- w[ofs + 2] = uint8_t(CLAMP(presets[(int)x / size.x].b * 255.0, 0, 255));
- }
- }
- }
+ Size2 preset_size = Size2(size.width * presets.size(), size.height);
+ preset->set_custom_minimum_size(preset_size);
- Ref<Image> i = memnew(Image(size.x * presets.size(), size.y, false, Image::FORMAT_RGB8, img));
+ preset->draw_texture_rect(get_icon("preset_bg", "ColorPicker"), Rect2(Point2(), preset_size), true);
- Ref<ImageTexture> t;
- t.instance();
- t->create_from_image(i);
- preset->set_texture(t);
+ for (int i = 0; i < presets.size(); i++) {
+ preset->draw_rect(Rect2(Point2(size.width * i, 0), size), presets[i]);
+ }
}
void ColorPicker::_text_type_toggled() {
@@ -227,7 +212,7 @@ void ColorPicker::add_preset(const Color &p_color) {
} else {
presets.push_back(p_color);
}
- _update_presets();
+ preset->update();
if (presets.size() == 10)
bt_add_preset->hide();
}
@@ -266,7 +251,11 @@ void ColorPicker::_update_text_value() {
}
void ColorPicker::_sample_draw() {
- sample->draw_rect(Rect2(Point2(), Size2(uv_edit->get_size().width, sample->get_size().height * 0.95)), color);
+ Rect2 r = Rect2(Point2(), Size2(uv_edit->get_size().width, sample->get_size().height * 0.95));
+ if (color.a < 1.0) {
+ sample->draw_texture_rect(get_icon("preset_bg", "ColorPicker"), r, true);
+ }
+ sample->draw_rect(r, color);
}
void ColorPicker::_hsv_draw(int p_which, Control *c) {
@@ -399,7 +388,7 @@ void ColorPicker::_preset_input(const Ref<InputEvent> &p_event) {
} else if (bev->is_pressed() && bev->get_button_index() == BUTTON_RIGHT) {
int index = bev->get_position().x / (preset->get_size().x / presets.size());
presets.erase(presets[index]);
- _update_presets();
+ preset->update();
bt_add_preset->show();
}
_update_color();
@@ -461,7 +450,7 @@ void ColorPicker::_screen_pick_pressed() {
screen = memnew(Control);
r->add_child(screen);
screen->set_as_toplevel(true);
- screen->set_area_as_parent_rect();
+ screen->set_anchors_and_margins_preset(Control::PRESET_WIDE);
screen->set_default_cursor_shape(CURSOR_POINTING_HAND);
screen->connect("gui_input", this, "_screen_input");
}
@@ -484,6 +473,7 @@ void ColorPicker::_bind_methods() {
ClassDB::bind_method(D_METHOD("_add_preset_pressed"), &ColorPicker::_add_preset_pressed);
ClassDB::bind_method(D_METHOD("_screen_pick_pressed"), &ColorPicker::_screen_pick_pressed);
ClassDB::bind_method(D_METHOD("_sample_draw"), &ColorPicker::_sample_draw);
+ ClassDB::bind_method(D_METHOD("_update_presets"), &ColorPicker::_update_presets);
ClassDB::bind_method(D_METHOD("_hsv_draw"), &ColorPicker::_hsv_draw);
ClassDB::bind_method(D_METHOD("_uv_input"), &ColorPicker::_uv_input);
ClassDB::bind_method(D_METHOD("_w_input"), &ColorPicker::_w_input);
@@ -608,6 +598,7 @@ ColorPicker::ColorPicker()
bbc->add_child(preset);
//preset->set_ignore_mouse(false);
preset->connect("gui_input", this, "_preset_input");
+ preset->connect("draw", this, "_update_presets");
bt_add_preset = memnew(Button);
bt_add_preset->set_icon(get_icon("add_preset"));
@@ -636,7 +627,9 @@ void ColorPickerButton::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
Ref<StyleBox> normal = get_stylebox("normal");
- draw_rect(Rect2(normal->get_offset(), get_size() - normal->get_minimum_size()), picker->get_pick_color());
+ Rect2 r = Rect2(normal->get_offset(), get_size() - normal->get_minimum_size());
+ draw_texture_rect(Control::get_icon("bg", "ColorPickerButton"), r, true);
+ draw_rect(r, picker->get_pick_color());
}
if (p_what == MainLoop::NOTIFICATION_WM_QUIT_REQUEST) {
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 2c01a0e2d1..91c5263bf5 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -1471,6 +1471,140 @@ void Control::set_anchors_preset(LayoutPreset p_preset, bool p_keep_margin) {
}
}
+void Control::set_margins_preset(LayoutPreset p_preset, LayoutPresetMode p_resize_mode, int p_margin) {
+ // Calculate the size if the node is not resized
+ Size2 min_size = get_minimum_size();
+ Size2 new_size = get_size();
+ if (p_resize_mode == PRESET_MODE_MINSIZE || p_resize_mode == PRESET_MODE_KEEP_HEIGHT) {
+ new_size.x = min_size.x;
+ }
+ if (p_resize_mode == PRESET_MODE_MINSIZE || p_resize_mode == PRESET_MODE_KEEP_WIDTH) {
+ new_size.y = min_size.y;
+ }
+
+ float pw = _get_parent_range(0);
+ float ph = _get_parent_range(1);
+
+ //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:
+ data.margin[0] = pw * (0.0 - data.anchor[0]) + p_margin;
+ break;
+
+ case PRESET_CENTER_TOP:
+ case PRESET_CENTER_BOTTOM:
+ case PRESET_CENTER:
+ case PRESET_VCENTER_WIDE:
+ data.margin[0] = pw * (0.5 - data.anchor[0]) - new_size.x / 2;
+ break;
+
+ case PRESET_TOP_RIGHT:
+ case PRESET_BOTTOM_RIGHT:
+ case PRESET_CENTER_RIGHT:
+ case PRESET_RIGHT_WIDE:
+ data.margin[0] = pw * (1.0 - data.anchor[0]) - new_size.x - p_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:
+ data.margin[1] = ph * (0.0 - data.anchor[1]) + p_margin;
+ break;
+
+ case PRESET_CENTER_LEFT:
+ case PRESET_CENTER_RIGHT:
+ case PRESET_CENTER:
+ case PRESET_HCENTER_WIDE:
+ data.margin[1] = ph * (0.5 - data.anchor[1]) - new_size.y / 2;
+ break;
+
+ case PRESET_BOTTOM_LEFT:
+ case PRESET_BOTTOM_RIGHT:
+ case PRESET_CENTER_BOTTOM:
+ case PRESET_BOTTOM_WIDE:
+ data.margin[1] = ph * (1.0 - data.anchor[1]) - new_size.y - p_margin;
+ break;
+ }
+
+ // Right
+ switch (p_preset) {
+ case PRESET_TOP_LEFT:
+ case PRESET_BOTTOM_LEFT:
+ case PRESET_CENTER_LEFT:
+ case PRESET_LEFT_WIDE:
+ data.margin[2] = pw * (0.0 - data.anchor[2]) + new_size.x + p_margin;
+ break;
+
+ case PRESET_CENTER_TOP:
+ case PRESET_CENTER_BOTTOM:
+ case PRESET_CENTER:
+ case PRESET_VCENTER_WIDE:
+ data.margin[2] = pw * (0.5 - data.anchor[2]) + new_size.x / 2;
+ 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:
+ data.margin[2] = pw * (1.0 - data.anchor[2]) - p_margin;
+ break;
+ }
+
+ // Bottom
+ switch (p_preset) {
+ case PRESET_TOP_LEFT:
+ case PRESET_TOP_RIGHT:
+ case PRESET_CENTER_TOP:
+ case PRESET_TOP_WIDE:
+ data.margin[3] = ph * (0.0 - data.anchor[3]) + new_size.y + p_margin;
+ break;
+
+ case PRESET_CENTER_LEFT:
+ case PRESET_CENTER_RIGHT:
+ case PRESET_CENTER:
+ case PRESET_HCENTER_WIDE:
+ data.margin[3] = ph * (0.5 - data.anchor[3]) + new_size.y / 2;
+ 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:
+ data.margin[3] = ph * (1.0 - data.anchor[3]) - p_margin;
+ break;
+ }
+
+ _size_changed();
+}
+
+void Control::set_anchors_and_margins_preset(LayoutPreset p_preset, LayoutPresetMode p_resize_mode, int p_margin) {
+ set_anchors_preset(p_preset);
+ set_margins_preset(p_preset, p_resize_mode, p_margin);
+}
+
float Control::get_anchor(Margin p_margin) const {
return data.anchor[p_margin];
@@ -1622,20 +1756,6 @@ Rect2 Control::get_item_rect() const {
return Rect2(Point2(), get_size());
}
-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;
- data.margin[MARGIN_BOTTOM] = -p_margin;
-
- _size_changed();
-}
-
void Control::add_icon_override(const StringName &p_name, const Ref<Texture> &p_icon) {
ERR_FAIL_COND(p_icon.is_null());
@@ -2471,9 +2591,11 @@ 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_anchors_preset", "preset", "keep_margin"), &Control::set_anchors_preset, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("set_margins_preset", "preset", "resize_mode", "margin"), &Control::set_margins_preset, DEFVAL(PRESET_MODE_MINSIZE), DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("set_anchors_and_margins_preset", "preset", "resize_mode", "margin"), &Control::set_anchors_and_margins_preset, DEFVAL(PRESET_MODE_MINSIZE), DEFVAL(0));
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", "offset", "push_opposite_anchor"), &Control::set_anchor_and_margin, DEFVAL(false));
@@ -2505,7 +2627,6 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_global_position"), &Control::get_global_position);
ClassDB::bind_method(D_METHOD("get_rect"), &Control::get_rect);
ClassDB::bind_method(D_METHOD("get_global_rect"), &Control::get_global_rect);
- ClassDB::bind_method(D_METHOD("set_area_as_parent_rect", "margin"), &Control::set_area_as_parent_rect, DEFVAL(0));
ClassDB::bind_method(D_METHOD("show_modal", "exclusive"), &Control::show_modal, DEFVAL(false));
ClassDB::bind_method(D_METHOD("set_focus_mode", "mode"), &Control::set_focus_mode);
ClassDB::bind_method(D_METHOD("get_focus_mode"), &Control::get_focus_mode);
@@ -2689,6 +2810,11 @@ void Control::_bind_methods() {
BIND_ENUM_CONSTANT(PRESET_HCENTER_WIDE);
BIND_ENUM_CONSTANT(PRESET_WIDE);
+ BIND_ENUM_CONSTANT(PRESET_MODE_MINSIZE);
+ BIND_ENUM_CONSTANT(PRESET_MODE_KEEP_HEIGHT);
+ BIND_ENUM_CONSTANT(PRESET_MODE_KEEP_WIDTH);
+ BIND_ENUM_CONSTANT(PRESET_MODE_KEEP_SIZE);
+
BIND_ENUM_CONSTANT(SIZE_EXPAND);
BIND_ENUM_CONSTANT(SIZE_FILL);
BIND_ENUM_CONSTANT(SIZE_EXPAND_FILL);
diff --git a/scene/gui/control.h b/scene/gui/control.h
index da5c4d0908..5b146b4454 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -124,6 +124,13 @@ public:
PRESET_WIDE
};
+ enum LayoutPresetMode {
+ PRESET_MODE_MINSIZE,
+ PRESET_MODE_KEEP_WIDTH,
+ PRESET_MODE_KEEP_HEIGHT,
+ PRESET_MODE_KEEP_SIZE
+ };
+
private:
struct CComparator {
@@ -294,34 +301,32 @@ public:
/* POSITIONING */
- 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);
+ void set_margins_preset(LayoutPreset p_preset, LayoutPresetMode p_resize_mode = PRESET_MODE_MINSIZE, int p_margin = 0);
+ void set_anchors_and_margins_preset(LayoutPreset p_preset, LayoutPresetMode p_resize_mode = PRESET_MODE_MINSIZE, int p_margin = 0);
+ void set_anchor(Margin p_margin, float p_anchor, bool p_keep_margin = false, bool p_push_opposite_anchor = true);
float get_anchor(Margin p_margin) const;
void set_margin(Margin p_margin, float p_value);
+ float get_margin(Margin p_margin) const;
+
+ void set_anchor_and_margin(Margin p_margin, float p_anchor, float p_pos, bool p_push_opposite_anchor = true);
void set_begin(const Point2 &p_point); // helper
void set_end(const Point2 &p_point); // helper
- void set_h_grow_direction(GrowDirection p_direction);
- GrowDirection get_h_grow_direction() const;
-
- void set_v_grow_direction(GrowDirection p_direction);
- GrowDirection get_v_grow_direction() const;
-
- float get_margin(Margin p_margin) const;
Point2 get_begin() const;
Point2 get_end() const;
void set_position(const Point2 &p_point);
- void set_size(const Size2 &p_size);
void set_global_position(const Point2 &p_point);
-
Point2 get_position() const;
Point2 get_global_position() const;
+
+ void set_size(const Size2 &p_size);
Size2 get_size() const;
+
Rect2 get_rect() const;
Rect2 get_global_rect() const;
Rect2 get_window_rect() const; ///< use with care, as it blocks waiting for the visual server
@@ -331,14 +336,18 @@ public:
float get_rotation() const;
float get_rotation_deg() const;
+ void set_h_grow_direction(GrowDirection p_direction);
+ GrowDirection get_h_grow_direction() const;
+
+ void set_v_grow_direction(GrowDirection p_direction);
+ GrowDirection get_v_grow_direction() const;
+
void set_pivot_offset(const Vector2 &p_pivot);
Vector2 get_pivot_offset() const;
void set_scale(const Vector2 &p_scale);
Vector2 get_scale() const;
- void set_area_as_parent_rect(int p_margin = 0);
-
void show_modal(bool p_exclusive = false);
void set_theme(const Ref<Theme> &p_theme);
@@ -449,6 +458,7 @@ VARIANT_ENUM_CAST(Control::FocusMode);
VARIANT_ENUM_CAST(Control::SizeFlags);
VARIANT_ENUM_CAST(Control::CursorShape);
VARIANT_ENUM_CAST(Control::LayoutPreset);
+VARIANT_ENUM_CAST(Control::LayoutPresetMode);
VARIANT_ENUM_CAST(Control::MouseFilter);
VARIANT_ENUM_CAST(Control::GrowDirection);
VARIANT_ENUM_CAST(Control::Anchor);
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 87a232e766..d8ff048dfb 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -115,6 +115,9 @@ Vector<String> FileDialog::get_selected_files() const {
void FileDialog::update_dir() {
dir->set_text(dir_access->get_current_dir());
+ if (drives->is_visible()) {
+ drives->select(dir_access->get_current_drive());
+ }
}
void FileDialog::_dir_entered(String p_dir) {
@@ -666,7 +669,6 @@ void FileDialog::_update_drives() {
drives->show();
for (int i = 0; i < dir_access->get_drive_count(); i++) {
- String d = dir_access->get_drive(i);
drives->add_item(dir_access->get_drive(i));
}
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 3ffa6d57a4..0d3cccc2b5 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -941,17 +941,17 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
//too difficult to get right
//set_zoom(zoom/ZOOM_SCALE);
}
- if (b->get_button_index() == BUTTON_WHEEL_UP) {
- h_scroll->set_value(h_scroll->get_value() - h_scroll->get_page() * b->get_factor() / 8);
- }
- if (b->get_button_index() == BUTTON_WHEEL_DOWN) {
- h_scroll->set_value(h_scroll->get_value() + h_scroll->get_page() * b->get_factor() / 8);
+ if (b->get_button_index() == BUTTON_WHEEL_UP && !Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
+ v_scroll->set_value(v_scroll->get_value() - v_scroll->get_page() * b->get_factor() / 8);
}
- if (b->get_button_index() == BUTTON_WHEEL_RIGHT) {
+ if (b->get_button_index() == BUTTON_WHEEL_DOWN && !Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
v_scroll->set_value(v_scroll->get_value() + v_scroll->get_page() * b->get_factor() / 8);
}
- if (b->get_button_index() == BUTTON_WHEEL_LEFT) {
- v_scroll->set_value(v_scroll->get_value() - v_scroll->get_page() * b->get_factor() / 8);
+ if (b->get_button_index() == BUTTON_WHEEL_RIGHT || (b->get_button_index() == BUTTON_WHEEL_DOWN && Input::get_singleton()->is_key_pressed(KEY_SHIFT))) {
+ h_scroll->set_value(h_scroll->get_value() + h_scroll->get_page() * b->get_factor() / 8);
+ }
+ if (b->get_button_index() == BUTTON_WHEEL_LEFT || (b->get_button_index() == BUTTON_WHEEL_UP && Input::get_singleton()->is_key_pressed(KEY_SHIFT))) {
+ h_scroll->set_value(h_scroll->get_value() - h_scroll->get_page() * b->get_factor() / 8);
}
}
@@ -1182,7 +1182,7 @@ GraphEdit::GraphEdit() {
top_layer = memnew(GraphEditFilter(this));
add_child(top_layer);
top_layer->set_mouse_filter(MOUSE_FILTER_PASS);
- top_layer->set_area_as_parent_rect();
+ top_layer->set_anchors_and_margins_preset(Control::PRESET_WIDE);
top_layer->connect("draw", this, "_top_layer_draw");
top_layer->set_mouse_filter(MOUSE_FILTER_PASS);
top_layer->connect("gui_input", this, "_top_layer_input");
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 74cc09d0a6..a034c7224f 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -524,11 +524,6 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
}
return;
- } else {
- Vector<int> sItems = get_selected_items();
- for (int i = 0; i < sItems.size(); i++) {
- unselect(sItems[i]);
- }
}
}
if (mb.is_valid() && mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed()) {
@@ -750,8 +745,8 @@ 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);
+ scroll_bar->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0);
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));
@@ -838,6 +833,10 @@ void ItemList::_notification(int p_what) {
if (fixed_column_width > 0)
minsize.x = fixed_column_width;
max_column_width = MAX(max_column_width, minsize.x);
+
+ // elements need to adapt to the selected size
+ minsize.y += vseparation;
+ minsize.x += hseparation;
items[i].rect_cache.size = minsize;
items[i].min_rect_cache.size = minsize;
}
@@ -851,7 +850,6 @@ void ItemList::_notification(int p_what) {
while (true) {
//repeat util all fits
- //print_line("try with "+itos(current_columns));
bool all_fit = true;
Vector2 ofs;
int col = 0;
@@ -866,13 +864,11 @@ void ItemList::_notification(int p_what) {
break;
}
- items[i].rect_cache = items[i].min_rect_cache;
if (same_column_width)
items[i].rect_cache.size.x = max_column_width;
items[i].rect_cache.position = ofs;
max_h = MAX(max_h, items[i].rect_cache.size.y);
ofs.x += items[i].rect_cache.size.x + hseparation;
- //print_line("item "+itos(i)+" ofs "+rtos(items[i].rect_cache.size.x));
col++;
if (col == current_columns) {
@@ -901,7 +897,6 @@ void ItemList::_notification(int p_what) {
auto_height_value = ofs.y + max_h + bg->get_minimum_size().height;
scroll_bar->set_max(max);
scroll_bar->set_page(page);
- //print_line("max: "+rtos(max)+" page "+rtos(page));
if (max <= page) {
scroll_bar->set_value(0);
scroll_bar->hide();
@@ -950,23 +945,23 @@ void ItemList::_notification(int p_what) {
if (items[i].selected) {
Rect2 r = rcache;
r.position += base_ofs;
+ r.position.y -= vseparation / 2;
+ r.size.y += vseparation;
+ r.position.x -= hseparation / 2;
+ r.size.x += hseparation;
- // Use stylebox to dimension potential bg color
- r.position.x -= sbsel->get_margin(MARGIN_LEFT);
- r.size.x += sbsel->get_margin(MARGIN_LEFT) + sbsel->get_margin(MARGIN_RIGHT);
- r.position.y -= sbsel->get_margin(MARGIN_TOP);
- r.size.y += sbsel->get_margin(MARGIN_TOP) + sbsel->get_margin(MARGIN_BOTTOM);
draw_style_box(sbsel, r);
}
-
if (items[i].custom_bg.a > 0.001) {
-
Rect2 r = rcache;
r.position += base_ofs;
// Size rect to make the align the temperature colors
r.position.y -= vseparation / 2;
r.size.y += vseparation;
+ r.position.x -= hseparation / 2;
+ r.size.x += hseparation;
+
draw_rect(r, items[i].custom_bg);
}
@@ -1103,12 +1098,16 @@ void ItemList::_notification(int p_what) {
Rect2 r = rcache;
r.position += base_ofs;
+ r.position.y -= vseparation / 2;
+ r.size.y += vseparation;
+ r.position.x -= hseparation / 2;
+ r.size.x += hseparation;
draw_style_box(cursor, r);
}
}
for (int i = 0; i < separators.size(); i++) {
- draw_line(Vector2(bg->get_margin(MARGIN_LEFT), base_ofs.y + separators[i]), Vector2(size.width - bg->get_margin(MARGIN_LEFT), base_ofs.y + separators[i]), guide_color);
+ draw_line(Vector2(bg->get_margin(MARGIN_LEFT), base_ofs.y + separators[i]), Vector2(size.width - bg->get_margin(MARGIN_RIGHT), base_ofs.y + separators[i]), guide_color);
}
}
}
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 7493ea95a8..ed8eff436c 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -534,7 +534,7 @@ void LineEdit::_notification(int p_what) {
switch (p_what) {
#ifdef TOOLS_ENABLED
case NOTIFICATION_ENTER_TREE: {
- if (Engine::get_singleton()->is_editor_hint()) {
+ if (Engine::get_singleton()->is_editor_hint() && !get_tree()->is_node_being_edited(this)) {
cursor_set_blink_enabled(EDITOR_DEF("text_editor/cursor/caret_blink", false));
cursor_set_blink_speed(EDITOR_DEF("text_editor/cursor/caret_blink_speed", 0.65));
@@ -601,7 +601,10 @@ void LineEdit::_notification(int p_what) {
} break;
case ALIGN_CENTER: {
- x_ofs = int(size.width - (cached_width)) / 2;
+ if (window_pos != 0)
+ x_ofs = style->get_offset().x;
+ else
+ x_ofs = int(size.width - (cached_width)) / 2;
} break;
case ALIGN_RIGHT: {
@@ -846,7 +849,10 @@ void LineEdit::set_cursor_at_pixel_pos(int p_x) {
} break;
case ALIGN_CENTER: {
- pixel_ofs = int(size.width - (cached_width)) / 2;
+ if (window_pos != 0)
+ pixel_ofs = int(style->get_offset().x);
+ else
+ pixel_ofs = int(size.width - (cached_width)) / 2;
} break;
case ALIGN_RIGHT: {
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp
index 5a2a552943..2110298950 100644
--- a/scene/gui/popup.cpp
+++ b/scene/gui/popup.cpp
@@ -265,7 +265,7 @@ void PopupPanel::set_child_rect(Control *p_child) {
ERR_FAIL_NULL(p_child);
Ref<StyleBox> p = get_stylebox("panel");
- p_child->set_area_as_parent_rect();
+ p_child->set_anchors_preset(Control::PRESET_WIDE);
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));
diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp
index 1dbec6e5a1..f8fb786fa7 100644
--- a/scene/gui/range.cpp
+++ b/scene/gui/range.cpp
@@ -208,10 +208,12 @@ void Range::_ref_shared(Shared *p_shared) {
void Range::_unref_shared() {
- shared->owners.erase(this);
- if (shared->owners.size() == 0) {
- memdelete(shared);
- shared = NULL;
+ if (shared) {
+ shared->owners.erase(this);
+ if (shared->owners.size() == 0) {
+ memdelete(shared);
+ shared = NULL;
+ }
}
}
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 71b9c4ec72..c2ce2a633e 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -84,7 +84,7 @@ Rect2 RichTextLabel::_get_text_rect() {
Ref<StyleBox> style = get_stylebox("normal");
return Rect2(style->get_offset(), get_size() - style->get_minimum_size());
}
-void RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &y, int p_width, int p_line, ProcessMode p_mode, const Ref<Font> &p_base_font, const Color &p_base_color, const Point2i &p_click_pos, Item **r_click_item, int *r_click_char, bool *r_outside, int p_char_count) {
+int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &y, int p_width, int p_line, ProcessMode p_mode, const Ref<Font> &p_base_font, const Color &p_base_color, const Point2i &p_click_pos, Item **r_click_item, int *r_click_char, bool *r_outside, int p_char_count) {
RID ci;
if (r_outside)
@@ -104,9 +104,11 @@ void RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int
int line = 0;
int spaces = 0;
+ int height = get_size().y;
+
if (p_mode != PROCESS_CACHE) {
- ERR_FAIL_INDEX(line, l.offset_caches.size());
+ ERR_FAIL_INDEX_V(line, l.offset_caches.size(), 0);
line_ofs = l.offset_caches[line];
}
@@ -133,12 +135,20 @@ void RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int
//line height should be the font height for the first time, this ensures that an empty line will never have zero height and successive newlines are displayed
int line_height = cfont->get_height();
+ int nonblank_line_count = 0; //number of nonblank lines as counted during PROCESS_DRAW
+
Variant meta;
+#define RETURN return nonblank_line_count
+
#define NEW_LINE \
{ \
if (p_mode != PROCESS_CACHE) { \
line++; \
+ if (!line_is_blank) { \
+ nonblank_line_count++; \
+ } \
+ line_is_blank = true; \
if (line < l.offset_caches.size()) \
line_ofs = l.offset_caches[line]; \
wofs = margin; \
@@ -168,7 +178,7 @@ void RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int
if (r_outside) *r_outside = true; \
*r_click_item = it; \
*r_click_char = rchar; \
- return; \
+ RETURN; \
} \
}
@@ -185,7 +195,7 @@ void RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int
if (r_outside) *r_outside = true; \
*r_click_item = it; \
*r_click_char = rchar; \
- return; \
+ RETURN; \
} \
NEW_LINE \
}
@@ -196,7 +206,7 @@ void RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int
if (r_outside) *r_outside = false; \
*r_click_item = it; \
*r_click_char = rchar; \
- return; \
+ RETURN; \
} \
wofs += m_width; \
}
@@ -206,6 +216,9 @@ void RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int
line_height = m_height; \
}
+#define YRANGE_VISIBLE(m_top, m_height) \
+ (m_height > 0 && ((m_top >= 0 && m_top < height) || ((m_top + m_height - 1) >= 0 && (m_top + m_height - 1) < height)))
+
Color selection_fg;
Color selection_bg;
@@ -214,8 +227,10 @@ void RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int
selection_fg = get_color("font_color_selected");
selection_bg = get_color("selection_color");
}
+
int rchar = 0;
int lh = 0;
+ bool line_is_blank = true;
while (it) {
@@ -327,7 +342,10 @@ void RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int
int cw = 0;
- bool visible = visible_characters < 0 || p_char_count < visible_characters;
+ bool visible = visible_characters < 0 || p_char_count < visible_characters && YRANGE_VISIBLE(y + lh - (fh - 0 * ascent), fh); //getting rid of ascent seems to work??
+ if (visible)
+ line_is_blank = false;
+
if (c[i] == '\t')
visible = false;
@@ -384,7 +402,9 @@ void RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int
ENSURE_WIDTH(img->image->get_width());
- bool visible = visible_characters < 0 || p_char_count < visible_characters;
+ bool visible = visible_characters < 0 || p_char_count < visible_characters && YRANGE_VISIBLE(y + lh - font->get_descent() - img->image->get_height(), img->image->get_height());
+ if (visible)
+ line_is_blank = false;
if (p_mode == PROCESS_DRAW && visible) {
img->image->draw(ci, p_ofs + Point2(align_ofs + wofs, y + lh - font->get_descent() - img->image->get_height()));
@@ -398,8 +418,10 @@ void RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int
case ITEM_NEWLINE: {
lh = 0;
- if (p_mode != PROCESS_CACHE)
+ if (p_mode != PROCESS_CACHE) {
lh = line < l.height_caches.size() ? l.height_caches[line] : 1;
+ line_is_blank = true;
+ }
} break;
case ITEM_TABLE: {
@@ -436,7 +458,7 @@ void RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int
idx++;
}
- //compute available width and total radio (for expanders)
+ //compute available width and total ratio (for expanders)
int total_ratio = 0;
int available_width = p_width - hseparation * (table->columns.size() - 1);
@@ -494,12 +516,14 @@ void RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int
int lines_ofs = p_ofs.y + offset.y + draw_ofs.y;
bool visible = lines_ofs < get_size().height && lines_ofs + lines_h >= 0;
+ if (visible)
+ line_is_blank = false;
for (int i = 0; i < frame->lines.size(); i++) {
if (visible) {
if (p_mode == PROCESS_DRAW) {
- _process_line(frame, p_ofs + offset + draw_ofs + Vector2(0, yofs), ly, table->columns[column].width, i, PROCESS_DRAW, cfont, ccolor);
+ nonblank_line_count += _process_line(frame, p_ofs + offset + draw_ofs + Vector2(0, yofs), ly, table->columns[column].width, i, PROCESS_DRAW, cfont, ccolor);
} else if (p_mode == PROCESS_POINTER) {
_process_line(frame, p_ofs + offset + draw_ofs + Vector2(0, yofs), ly, table->columns[column].width, i, PROCESS_POINTER, cfont, ccolor, p_click_pos, r_click_item, r_click_char, r_outside);
}
@@ -547,15 +571,17 @@ void RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int
if (r_outside) *r_outside = true;
*r_click_item = itp;
*r_click_char = rchar;
- return;
+ RETURN;
}
break;
}
}
-
NEW_LINE;
+ RETURN;
+
+#undef RETURN
#undef NEW_LINE
#undef ENSURE_WIDTH
#undef ADVANCE
@@ -665,14 +691,14 @@ void RichTextLabel::_notification(int p_what) {
if (from_line >= main->lines.size())
break; //nothing to draw
-
int y = (main->lines[from_line].height_accum_cache - main->lines[from_line].height_cache) - ofs;
Ref<Font> base_font = get_font("normal_font");
Color base_color = get_color("default_color");
+ visible_line_count = 0;
while (y < size.height && from_line < main->lines.size()) {
- _process_line(main, text_rect.get_position(), y, text_rect.get_size().width - scroll_w, from_line, PROCESS_DRAW, base_font, base_color, Point2i(), NULL, NULL, NULL, total_chars);
+ visible_line_count += _process_line(main, text_rect.get_position(), y, text_rect.get_size().width - scroll_w, from_line, PROCESS_DRAW, base_font, base_color, Point2i(), NULL, NULL, NULL, total_chars);
total_chars += main->lines[from_line].char_count;
from_line++;
}
@@ -1013,7 +1039,7 @@ void RichTextLabel::_validate_line_caches(ItemFrame *p_frame) {
if (p_frame->first_invalid_line == p_frame->lines.size())
return;
- //validate invalid lines!s
+ //validate invalid lines
Size2 size = get_size();
Rect2 text_rect = _get_text_rect();
@@ -1665,6 +1691,12 @@ int RichTextLabel::get_line_count() const {
return current_frame->lines.size();
}
+int RichTextLabel::get_visible_line_count() const {
+ if (!is_visible())
+ return 0;
+ return visible_line_count;
+}
+
void RichTextLabel::set_selection_enabled(bool p_enabled) {
selection.enabled = p_enabled;
@@ -1907,6 +1939,9 @@ void RichTextLabel::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_use_bbcode", "enable"), &RichTextLabel::set_use_bbcode);
ClassDB::bind_method(D_METHOD("is_using_bbcode"), &RichTextLabel::is_using_bbcode);
+ ClassDB::bind_method(D_METHOD("get_line_count"), &RichTextLabel::get_line_count);
+ ClassDB::bind_method(D_METHOD("get_visible_line_count"), &RichTextLabel::get_visible_line_count);
+
ADD_GROUP("BBCode", "bbcode_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "bbcode_enabled"), "set_use_bbcode", "is_using_bbcode");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "bbcode_text", PROPERTY_HINT_MULTILINE_TEXT), "set_bbcode", "get_bbcode");
@@ -1914,7 +1949,7 @@ void RichTextLabel::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "visible_characters", PROPERTY_HINT_RANGE, "-1,128000,1"), "set_visible_characters", "get_visible_characters");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "percent_visible", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_percent_visible", "get_percent_visible");
- ADD_SIGNAL(MethodInfo("meta_clicked", PropertyInfo(Variant::NIL, "meta")));
+ ADD_SIGNAL(MethodInfo("meta_clicked", PropertyInfo(Variant::NIL, "meta", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT)));
BIND_ENUM_CONSTANT(ALIGN_LEFT);
BIND_ENUM_CONSTANT(ALIGN_CENTER);
@@ -1995,6 +2030,7 @@ RichTextLabel::RichTextLabel() {
visible_characters = -1;
percent_visible = 1;
+ visible_line_count = 0;
set_clip_contents(true);
}
diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h
index 4db2c3a8e9..24c1e5eb59 100644
--- a/scene/gui/rich_text_label.h
+++ b/scene/gui/rich_text_label.h
@@ -217,6 +217,7 @@ private:
int scroll_w;
bool updating_scroll;
int current_idx;
+ int visible_line_count;
int tab_size;
bool underline_meta;
@@ -260,7 +261,7 @@ private:
int visible_characters;
float percent_visible;
- void _process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &y, int p_width, int p_line, ProcessMode p_mode, const Ref<Font> &p_base_font, const Color &p_base_color, const Point2i &p_click_pos = Point2i(), Item **r_click_item = NULL, int *r_click_char = NULL, bool *r_outside = NULL, int p_char_count = 0);
+ int _process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &y, int p_width, int p_line, ProcessMode p_mode, const Ref<Font> &p_base_font, const Color &p_base_color, const Point2i &p_click_pos = Point2i(), Item **r_click_item = NULL, int *r_click_char = NULL, bool *r_outside = NULL, int p_char_count = 0);
void _find_click(ItemFrame *p_frame, const Point2i &p_click, Item **r_click_item = NULL, int *r_click_char = NULL, bool *r_outside = NULL);
Ref<Font> _find_font(Item *p_item);
@@ -325,6 +326,7 @@ public:
void scroll_to_line(int p_line);
int get_line_count() const;
+ int get_visible_line_count() const;
VScrollBar *get_v_scroll() { return vscroll; }
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index 41f4beb1c9..c5ffec2d5e 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -113,7 +113,7 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
if (smooth_scroll_enabled) {
scrolling = true;
- set_fixed_process(true);
+ set_physics_process(true);
} else {
set_value(target_scroll);
}
@@ -137,7 +137,7 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
if (smooth_scroll_enabled) {
scrolling = true;
- set_fixed_process(true);
+ set_physics_process(true);
} else {
set_value(target_scroll);
}
@@ -335,29 +335,29 @@ void ScrollBar::_notification(int p_what) {
drag_slave = NULL;
}
- if (p_what == NOTIFICATION_FIXED_PROCESS) {
+ if (p_what == NOTIFICATION_PHYSICS_PROCESS) {
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();
+ double vel = ((target / dist) * 500) * get_physics_process_delta_time();
- if (vel >= dist) {
+ if (Math::abs(vel) >= dist) {
set_value(target_scroll);
} else {
set_value(get_value() + vel);
}
} else {
scrolling = false;
- set_fixed_process(false);
+ set_physics_process(false);
}
} else if (drag_slave_touching) {
if (drag_slave_touching_deaccel) {
Vector2 pos = Vector2(orientation == HORIZONTAL ? get_value() : 0, orientation == VERTICAL ? get_value() : 0);
- pos += drag_slave_speed * get_fixed_process_delta_time();
+ pos += drag_slave_speed * get_physics_process_delta_time();
bool turnoff = false;
@@ -377,7 +377,7 @@ void ScrollBar::_notification(int p_what) {
float sgn_x = drag_slave_speed.x < 0 ? -1 : 1;
float val_x = Math::abs(drag_slave_speed.x);
- val_x -= 1000 * get_fixed_process_delta_time();
+ val_x -= 1000 * get_physics_process_delta_time();
if (val_x < 0) {
turnoff = true;
@@ -401,7 +401,7 @@ void ScrollBar::_notification(int p_what) {
float sgn_y = drag_slave_speed.y < 0 ? -1 : 1;
float val_y = Math::abs(drag_slave_speed.y);
- val_y -= 1000 * get_fixed_process_delta_time();
+ val_y -= 1000 * get_physics_process_delta_time();
if (val_y < 0) {
turnoff = true;
@@ -410,7 +410,7 @@ void ScrollBar::_notification(int p_what) {
}
if (turnoff) {
- set_fixed_process(false);
+ set_physics_process(false);
drag_slave_touching = false;
drag_slave_touching_deaccel = false;
}
@@ -421,10 +421,10 @@ void ScrollBar::_notification(int p_what) {
Vector2 diff = drag_slave_accum - last_drag_slave_accum;
last_drag_slave_accum = drag_slave_accum;
- drag_slave_speed = diff / get_fixed_process_delta_time();
+ drag_slave_speed = diff / get_physics_process_delta_time();
}
- time_since_motion += get_fixed_process_delta_time();
+ time_since_motion += get_physics_process_delta_time();
}
}
}
@@ -579,7 +579,7 @@ void ScrollBar::_drag_slave_input(const Ref<InputEvent> &p_input) {
if (mb->is_pressed()) {
if (drag_slave_touching) {
- set_fixed_process(false);
+ set_physics_process(false);
drag_slave_touching_deaccel = false;
drag_slave_touching = false;
drag_slave_speed = Vector2();
@@ -599,7 +599,7 @@ void ScrollBar::_drag_slave_input(const Ref<InputEvent> &p_input) {
drag_slave_touching_deaccel = false;
time_since_motion = 0;
if (drag_slave_touching) {
- set_fixed_process(true);
+ set_physics_process(true);
time_since_motion = 0;
}
}
@@ -611,7 +611,7 @@ void ScrollBar::_drag_slave_input(const Ref<InputEvent> &p_input) {
if (drag_slave_speed == Vector2()) {
drag_slave_touching_deaccel = false;
drag_slave_touching = false;
- set_fixed_process(false);
+ set_physics_process(false);
} else {
drag_slave_touching_deaccel = true;
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index c71093b947..1ad1e3f638 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -67,7 +67,7 @@ Size2 ScrollContainer::get_minimum_size() const {
};
void ScrollContainer::_cancel_drag() {
- set_fixed_process(false);
+ set_physics_process(false);
drag_touching_deaccel = false;
drag_touching = false;
drag_speed = Vector2();
@@ -121,7 +121,7 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (mb->is_pressed()) {
if (drag_touching) {
- set_fixed_process(false);
+ set_physics_process(false);
drag_touching_deaccel = false;
drag_touching = false;
drag_speed = Vector2();
@@ -139,7 +139,7 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
drag_touching_deaccel = false;
time_since_motion = 0;
if (drag_touching) {
- set_fixed_process(true);
+ set_physics_process(true);
time_since_motion = 0;
}
}
@@ -150,7 +150,7 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (drag_speed == Vector2()) {
drag_touching_deaccel = false;
drag_touching = false;
- set_fixed_process(false);
+ set_physics_process(false);
} else {
drag_touching_deaccel = true;
@@ -257,14 +257,14 @@ void ScrollContainer::_notification(int p_what) {
update_scrollbars();
}
- if (p_what == NOTIFICATION_FIXED_PROCESS) {
+ if (p_what == NOTIFICATION_PHYSICS_PROCESS) {
if (drag_touching) {
if (drag_touching_deaccel) {
Vector2 pos = Vector2(h_scroll->get_value(), v_scroll->get_value());
- pos += drag_speed * get_fixed_process_delta_time();
+ pos += drag_speed * get_physics_process_delta_time();
bool turnoff_h = false;
bool turnoff_v = false;
@@ -294,7 +294,7 @@ void ScrollContainer::_notification(int p_what) {
float sgn_x = drag_speed.x < 0 ? -1 : 1;
float val_x = Math::abs(drag_speed.x);
- val_x -= 1000 * get_fixed_process_delta_time();
+ val_x -= 1000 * get_physics_process_delta_time();
if (val_x < 0) {
turnoff_h = true;
@@ -302,7 +302,7 @@ void ScrollContainer::_notification(int p_what) {
float sgn_y = drag_speed.y < 0 ? -1 : 1;
float val_y = Math::abs(drag_speed.y);
- val_y -= 1000 * get_fixed_process_delta_time();
+ val_y -= 1000 * get_physics_process_delta_time();
if (val_y < 0) {
turnoff_v = true;
@@ -311,7 +311,7 @@ void ScrollContainer::_notification(int p_what) {
drag_speed = Vector2(sgn_x * val_x, sgn_y * val_y);
if (turnoff_h && turnoff_v) {
- set_fixed_process(false);
+ set_physics_process(false);
drag_touching = false;
drag_touching_deaccel = false;
}
@@ -322,10 +322,10 @@ void ScrollContainer::_notification(int p_what) {
Vector2 diff = drag_accum - last_drag_accum;
last_drag_accum = drag_accum;
- drag_speed = diff / get_fixed_process_delta_time();
+ drag_speed = diff / get_physics_process_delta_time();
}
- time_since_motion += get_fixed_process_delta_time();
+ time_since_motion += get_physics_process_delta_time();
}
}
}
diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp
index 8fda5df53c..116e0ac354 100644
--- a/scene/gui/slider.cpp
+++ b/scene/gui/slider.cpp
@@ -181,7 +181,7 @@ void Slider::_notification(int p_what) {
for (int i = 0; i < ticks; i++) {
if (!ticks_on_borders && (i == 0 || i + 1 == ticks)) continue;
int ofs = i * tickarea / (ticks - 1);
- tick->draw(ci, Point2(0, ofs));
+ tick->draw(ci, Point2i((size.width - widget_width) / 2, ofs));
}
}
grabber->draw(ci, Point2i(size.width / 2 - grabber->get_size().width / 2, size.height - get_as_ratio() * areasize - grabber->get_size().height));
@@ -202,7 +202,7 @@ void Slider::_notification(int p_what) {
for (int i = 0; i < ticks; i++) {
if ((!ticks_on_borders) && ((i == 0) || ((i + 1) == ticks))) continue;
int ofs = i * tickarea / (ticks - 1);
- tick->draw(ci, Point2(ofs, 0));
+ tick->draw(ci, Point2i(ofs, (size.height - widget_height) / 2));
}
}
grabber->draw(ci, Point2i(get_as_ratio() * areasize, size.height / 2 - grabber->get_size().height / 2));
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index 60b6746ae8..05f2809bfc 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -268,7 +268,7 @@ SpinBox::SpinBox() {
line_edit = memnew(LineEdit);
add_child(line_edit);
- line_edit->set_area_as_parent_rect();
+ line_edit->set_anchors_and_margins_preset(Control::PRESET_WIDE);
//connect("value_changed",this,"_value_changed");
line_edit->connect("text_entered", this, "_text_entered", Vector<Variant>(), CONNECT_DEFERRED);
line_edit->connect("focus_exited", this, "_line_edit_focus_exit", Vector<Variant>(), CONNECT_DEFERRED);
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index 98a8db336e..6e50614e8f 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -264,9 +264,9 @@ void TabContainer::_notification(int p_what) {
if (popup) {
x -= menu->get_width();
if (mouse_x_cache > x)
- menu_hl->draw(get_canvas_item(), Size2(x, 0));
+ menu_hl->draw(get_canvas_item(), Size2(x, (header_height - menu_hl->get_height()) / 2));
else
- menu->draw(get_canvas_item(), Size2(x, 0));
+ menu->draw(get_canvas_item(), Size2(x, (header_height - menu->get_height()) / 2));
}
// Draw the navigation buttons.
@@ -367,7 +367,7 @@ void TabContainer::add_child_notify(Node *p_child) {
current = 0;
previous = 0;
}
- c->set_area_as_parent_rect();
+ c->set_anchors_and_margins_preset(Control::PRESET_WIDE);
if (tabs_visible)
c->set_margin(MARGIN_TOP, _get_top_margin());
Ref<StyleBox> sb = get_stylebox("panel");
@@ -401,7 +401,7 @@ void TabContainer::set_current_tab(int p_current) {
Control *c = tabs[i];
if (i == current) {
c->show();
- c->set_area_as_parent_rect();
+ c->set_anchors_and_margins_preset(Control::PRESET_WIDE);
if (tabs_visible)
c->set_margin(MARGIN_TOP, _get_top_margin());
c->set_margin(Margin(MARGIN_TOP), c->get_margin(Margin(MARGIN_TOP)) + sb->get_margin(Margin(MARGIN_TOP)));
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index d79ce25344..33c29547be 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -428,22 +428,22 @@ void TextEdit::_notification(int p_what) {
draw_caret = false;
update();
} break;
- case NOTIFICATION_FIXED_PROCESS: {
+ case NOTIFICATION_PHYSICS_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) * v_scroll_speed) * get_fixed_process_delta_time();
+ double vel = ((target_y / dist) * v_scroll_speed) * get_physics_process_delta_time();
if (Math::abs(vel) >= dist) {
v_scroll->set_value(target_v_scroll);
scrolling = false;
- set_fixed_process(false);
+ set_physics_process(false);
} else {
v_scroll->set_value(v_scroll->get_value() + vel);
}
} else {
scrolling = false;
- set_fixed_process(false);
+ set_physics_process(false);
}
} break;
case NOTIFICATION_DRAW: {
@@ -501,8 +501,7 @@ void TextEdit::_notification(int p_what) {
if (cache.background_color.a > 0.01) {
- Point2i ofs = Point2i(cache.style_normal->get_offset()) / 2.0;
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(ofs, get_size() - cache.style_normal->get_minimum_size() + ofs), cache.background_color);
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(), get_size()), cache.background_color);
}
//compute actual region to start (may be inside say, a comment).
//slow in very large documments :( but ok for source!
@@ -1611,7 +1610,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
target_v_scroll = 0;
}
scrolling = true;
- set_fixed_process(true);
+ set_physics_process(true);
} else {
v_scroll->set_value(target_v_scroll);
}
@@ -1633,7 +1632,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
target_v_scroll = max_v_scroll;
}
scrolling = true;
- set_fixed_process(true);
+ set_physics_process(true);
} else {
v_scroll->set_value(target_v_scroll);
}
@@ -4288,6 +4287,14 @@ int TextEdit::get_v_scroll() const {
}
void TextEdit::set_v_scroll(int p_scroll) {
+ if (p_scroll < 0) {
+ p_scroll = 0;
+ }
+ if (!scroll_past_end_of_file_enabled) {
+ if (p_scroll + get_visible_rows() > get_line_count()) {
+ p_scroll = get_line_count() - get_visible_rows();
+ }
+ }
v_scroll->set_value(p_scroll);
cursor.line_ofs = p_scroll;
}
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 8d6eb0f8e2..178a1c272b 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -862,6 +862,7 @@ void Tree::update_cache() {
cache.arrow_collapsed = get_icon("arrow_collapsed");
cache.arrow = get_icon("arrow");
cache.select_arrow = get_icon("select_arrow");
+ cache.select_option = get_icon("select_option");
cache.updown = get_icon("updown");
cache.custom_button = get_stylebox("custom_button");
@@ -2135,8 +2136,15 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
if (selected_item->get_children() != NULL && !selected_item->is_collapsed()) {
selected_item->set_collapsed(true);
} else {
- selected_col = columns.size() - 1;
- dobreak = false; // fall through to key_up
+ if (columns.size() == 1) { // goto parent with one column
+ TreeItem *parent = selected_item->get_parent();
+ if (selected_item != get_root() && parent && parent->is_selectable(selected_col) && !(hide_root && parent == get_root())) {
+ select_single_item(parent, get_root(), selected_col);
+ }
+ } else {
+ selected_col = columns.size() - 1;
+ dobreak = false; // fall through to key_up
+ }
}
} else {
if (select_mode == SELECT_MULTI) {
@@ -2149,6 +2157,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
}
update();
accept_event();
+ ensure_cursor_is_visible();
if (dobreak) {
break;
@@ -2484,7 +2493,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
if (drag_speed == 0) {
drag_touching_deaccel = false;
drag_touching = false;
- set_fixed_process(false);
+ set_physics_process(false);
} else {
drag_touching_deaccel = true;
@@ -2550,7 +2559,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
break;
if (drag_touching) {
- set_fixed_process(false);
+ set_physics_process(false);
drag_touching_deaccel = false;
drag_touching = false;
drag_speed = 0;
@@ -2565,7 +2574,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
drag_touching = OS::get_singleton()->has_touchscreen_ui_hint();
drag_touching_deaccel = false;
if (drag_touching) {
- set_fixed_process(true);
+ set_physics_process(true);
}
}
@@ -2756,7 +2765,7 @@ void Tree::_notification(int p_what) {
drop_mode_flags = 0;
scrolling = false;
- set_fixed_process(false);
+ set_physics_process(false);
update();
}
if (p_what == NOTIFICATION_DRAG_BEGIN) {
@@ -2764,23 +2773,23 @@ void Tree::_notification(int p_what) {
single_select_defer = NULL;
if (cache.scroll_speed > 0 && get_rect().has_point(get_viewport()->get_mouse_position() - get_global_position())) {
scrolling = true;
- set_fixed_process(true);
+ set_physics_process(true);
}
}
- if (p_what == NOTIFICATION_FIXED_PROCESS) {
+ if (p_what == NOTIFICATION_PHYSICS_PROCESS) {
if (drag_touching) {
if (drag_touching_deaccel) {
float pos = v_scroll->get_value();
- pos += drag_speed * get_fixed_process_delta_time();
+ pos += drag_speed * get_physics_process_delta_time();
bool turnoff = false;
if (pos < 0) {
pos = 0;
turnoff = true;
- set_fixed_process(false);
+ set_physics_process(false);
drag_touching = false;
drag_touching_deaccel = false;
}
@@ -2792,7 +2801,7 @@ void Tree::_notification(int p_what) {
v_scroll->set_value(pos);
float sgn = drag_speed < 0 ? -1 : 1;
float val = Math::abs(drag_speed);
- val -= 1000 * get_fixed_process_delta_time();
+ val -= 1000 * get_physics_process_delta_time();
if (val < 0) {
turnoff = true;
@@ -2800,7 +2809,7 @@ void Tree::_notification(int p_what) {
drag_speed = sgn * val;
if (turnoff) {
- set_fixed_process(false);
+ set_physics_process(false);
drag_touching = false;
drag_touching_deaccel = false;
}
@@ -2825,7 +2834,7 @@ void Tree::_notification(int p_what) {
} else {
point.y = 0;
}
- point *= cache.scroll_speed * get_fixed_process_delta_time();
+ point *= cache.scroll_speed * get_physics_process_delta_time();
point += get_scroll();
h_scroll->set_value(point.x);
v_scroll->set_value(point.y);
diff --git a/scene/gui/tree.h b/scene/gui/tree.h
index e723fa227b..2ee91a8b73 100644
--- a/scene/gui/tree.h
+++ b/scene/gui/tree.h
@@ -418,6 +418,7 @@ private:
Ref<Texture> arrow_collapsed;
Ref<Texture> arrow;
Ref<Texture> select_arrow;
+ Ref<Texture> select_option;
Ref<Texture> updown;
Color font_color;
diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp
index e08d050ca7..190ccd50d5 100644
--- a/scene/gui/video_player.cpp
+++ b/scene/gui/video_player.cpp
@@ -282,9 +282,15 @@ float VideoPlayer::get_stream_position() const {
if (playback.is_null())
return 0;
- return playback->get_position();
+ return playback->get_playback_position();
};
+void VideoPlayer::set_stream_position(float p_position) {
+
+ if (playback.is_valid())
+ playback->seek(p_position);
+}
+
Ref<Texture> VideoPlayer::get_video_texture() {
if (playback.is_valid())
@@ -327,6 +333,7 @@ void VideoPlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_stream_name"), &VideoPlayer::get_stream_name);
+ ClassDB::bind_method(D_METHOD("set_stream_position", "position"), &VideoPlayer::set_stream_position);
ClassDB::bind_method(D_METHOD("get_stream_position"), &VideoPlayer::get_stream_position);
ClassDB::bind_method(D_METHOD("set_autoplay", "enabled"), &VideoPlayer::set_autoplay);
diff --git a/scene/gui/video_player.h b/scene/gui/video_player.h
index bea10907bb..f04e90365f 100644
--- a/scene/gui/video_player.h
+++ b/scene/gui/video_player.h
@@ -93,6 +93,7 @@ public:
String get_stream_name() const;
float get_stream_position() const;
+ void set_stream_position(float p_position);
void set_autoplay(bool p_enable);
bool has_autoplay() const;
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 658701dcc7..c2a31b4a8b 100755
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -54,13 +54,13 @@ void Node::_notification(int p_notification) {
get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_process, ptr, 1);
}
} break;
- case NOTIFICATION_FIXED_PROCESS: {
+ case NOTIFICATION_PHYSICS_PROCESS: {
if (get_script_instance()) {
- Variant time = get_fixed_process_delta_time();
+ Variant time = get_physics_process_delta_time();
const Variant *ptr[1] = { &time };
- get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_fixed_process, ptr, 1);
+ get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_physics_process, ptr, 1);
}
} break;
@@ -129,8 +129,8 @@ void Node::_notification(int p_notification) {
set_process(true);
}
- if (get_script_instance()->has_method(SceneStringNames::get_singleton()->_fixed_process)) {
- set_fixed_process(true);
+ if (get_script_instance()->has_method(SceneStringNames::get_singleton()->_physics_process)) {
+ set_physics_process(true);
}
get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_ready, NULL, 0);
@@ -367,46 +367,46 @@ void Node::move_child_notify(Node *p_child) {
// to be used when not wanted
}
-void Node::set_fixed_process(bool p_process) {
+void Node::set_physics_process(bool p_process) {
- if (data.fixed_process == p_process)
+ if (data.physics_process == p_process)
return;
- data.fixed_process = p_process;
+ data.physics_process = p_process;
- if (data.fixed_process)
- add_to_group("fixed_process", false);
+ if (data.physics_process)
+ add_to_group("physics_process", false);
else
- remove_from_group("fixed_process");
+ remove_from_group("physics_process");
- data.fixed_process = p_process;
- _change_notify("fixed_process");
+ data.physics_process = p_process;
+ _change_notify("physics_process");
}
-bool Node::is_fixed_processing() const {
+bool Node::is_physics_processing() const {
- return data.fixed_process;
+ return data.physics_process;
}
-void Node::set_fixed_process_internal(bool p_process_internal) {
+void Node::set_physics_process_internal(bool p_process_internal) {
- if (data.fixed_process_internal == p_process_internal)
+ if (data.physics_process_internal == p_process_internal)
return;
- data.fixed_process_internal = p_process_internal;
+ data.physics_process_internal = p_process_internal;
- if (data.fixed_process_internal)
- add_to_group("fixed_process_internal", false);
+ if (data.physics_process_internal)
+ add_to_group("physics_process_internal", false);
else
- remove_from_group("fixed_process_internal");
+ remove_from_group("physics_process_internal");
- data.fixed_process_internal = p_process_internal;
- _change_notify("fixed_process_internal");
+ data.physics_process_internal = p_process_internal;
+ _change_notify("physics_process_internal");
}
-bool Node::is_fixed_processing_internal() const {
+bool Node::is_physics_processing_internal() const {
- return data.fixed_process_internal;
+ return data.physics_process_internal;
}
void Node::set_pause_mode(PauseMode p_mode) {
@@ -1010,10 +1010,10 @@ bool Node::can_process() const {
return true;
}
-float Node::get_fixed_process_delta_time() const {
+float Node::get_physics_process_delta_time() const {
if (data.tree)
- return data.tree->get_fixed_process_time();
+ return data.tree->get_physics_process_time();
else
return 0;
}
@@ -2719,9 +2719,9 @@ void Node::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_filename"), &Node::get_filename);
ClassDB::bind_method(D_METHOD("propagate_notification", "what"), &Node::propagate_notification);
ClassDB::bind_method(D_METHOD("propagate_call", "method", "args", "parent_first"), &Node::propagate_call, DEFVAL(Array()), DEFVAL(false));
- ClassDB::bind_method(D_METHOD("set_fixed_process", "enable"), &Node::set_fixed_process);
- ClassDB::bind_method(D_METHOD("get_fixed_process_delta_time"), &Node::get_fixed_process_delta_time);
- ClassDB::bind_method(D_METHOD("is_fixed_processing"), &Node::is_fixed_processing);
+ ClassDB::bind_method(D_METHOD("set_physics_process", "enable"), &Node::set_physics_process);
+ ClassDB::bind_method(D_METHOD("get_physics_process_delta_time"), &Node::get_physics_process_delta_time);
+ ClassDB::bind_method(D_METHOD("is_physics_processing"), &Node::is_physics_processing);
ClassDB::bind_method(D_METHOD("get_process_delta_time"), &Node::get_process_delta_time);
ClassDB::bind_method(D_METHOD("set_process", "enable"), &Node::set_process);
ClassDB::bind_method(D_METHOD("is_processing"), &Node::is_processing);
@@ -2742,8 +2742,8 @@ void Node::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_process_internal", "enable"), &Node::set_process_internal);
ClassDB::bind_method(D_METHOD("is_processing_internal"), &Node::is_processing_internal);
- ClassDB::bind_method(D_METHOD("set_fixed_process_internal", "enable"), &Node::set_fixed_process_internal);
- ClassDB::bind_method(D_METHOD("is_fixed_processing_internal"), &Node::is_fixed_processing_internal);
+ ClassDB::bind_method(D_METHOD("set_physics_process_internal", "enable"), &Node::set_physics_process_internal);
+ ClassDB::bind_method(D_METHOD("is_physics_processing_internal"), &Node::is_physics_processing_internal);
ClassDB::bind_method(D_METHOD("get_tree"), &Node::get_tree);
@@ -2801,7 +2801,7 @@ void Node::_bind_methods() {
BIND_CONSTANT(NOTIFICATION_EXIT_TREE);
BIND_CONSTANT(NOTIFICATION_MOVED_IN_PARENT);
BIND_CONSTANT(NOTIFICATION_READY);
- BIND_CONSTANT(NOTIFICATION_FIXED_PROCESS);
+ BIND_CONSTANT(NOTIFICATION_PHYSICS_PROCESS);
BIND_CONSTANT(NOTIFICATION_PROCESS);
BIND_CONSTANT(NOTIFICATION_PARENTED);
BIND_CONSTANT(NOTIFICATION_UNPARENTED);
@@ -2813,7 +2813,7 @@ void Node::_bind_methods() {
BIND_CONSTANT(NOTIFICATION_PATH_CHANGED);
BIND_CONSTANT(NOTIFICATION_TRANSLATION_CHANGED);
BIND_CONSTANT(NOTIFICATION_INTERNAL_PROCESS);
- BIND_CONSTANT(NOTIFICATION_INTERNAL_FIXED_PROCESS);
+ BIND_CONSTANT(NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
BIND_ENUM_CONSTANT(RPC_MODE_DISABLED);
BIND_ENUM_CONSTANT(RPC_MODE_REMOTE);
@@ -2835,7 +2835,7 @@ void Node::_bind_methods() {
ADD_SIGNAL(MethodInfo("tree_exited"));
//ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/process" ),"set_process","is_processing") ;
- //ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/fixed_process" ), "set_fixed_process","is_fixed_processing") ;
+ //ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/physics_process" ), "set_physics_process","is_physics_processing") ;
//ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/input" ), "set_process_input","is_processing_input" ) ;
//ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/unhandled_input" ), "set_process_unhandled_input","is_processing_unhandled_input" ) ;
ADD_GROUP("Pause", "pause_");
@@ -2843,7 +2843,7 @@ void Node::_bind_methods() {
ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "editor/display_folded", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_display_folded", "is_displayed_folded");
BIND_VMETHOD(MethodInfo("_process", PropertyInfo(Variant::REAL, "delta")));
- BIND_VMETHOD(MethodInfo("_fixed_process", PropertyInfo(Variant::REAL, "delta")));
+ BIND_VMETHOD(MethodInfo("_physics_process", PropertyInfo(Variant::REAL, "delta")));
BIND_VMETHOD(MethodInfo("_enter_tree"));
BIND_VMETHOD(MethodInfo("_exit_tree"));
BIND_VMETHOD(MethodInfo("_ready"));
@@ -2872,9 +2872,9 @@ Node::Node() {
data.blocked = 0;
data.parent = NULL;
data.tree = NULL;
- data.fixed_process = false;
+ data.physics_process = false;
data.idle_process = false;
- data.fixed_process_internal = false;
+ data.physics_process_internal = false;
data.idle_process_internal = false;
data.inside_tree = false;
data.ready_notified = false;
diff --git a/scene/main/node.h b/scene/main/node.h
index 12d6310062..c43e96063f 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -121,10 +121,10 @@ private:
// variables used to properly sort the node when processing, ignored otherwise
//should move all the stuff below to bits
- bool fixed_process;
+ bool physics_process;
bool idle_process;
- bool fixed_process_internal;
+ bool physics_process_internal;
bool idle_process_internal;
bool input;
@@ -213,7 +213,7 @@ public:
NOTIFICATION_READY = 13,
NOTIFICATION_PAUSED = 14,
NOTIFICATION_UNPAUSED = 15,
- NOTIFICATION_FIXED_PROCESS = 16,
+ NOTIFICATION_PHYSICS_PROCESS = 16,
NOTIFICATION_PROCESS = 17,
NOTIFICATION_PARENTED = 18,
NOTIFICATION_UNPARENTED = 19,
@@ -223,7 +223,7 @@ public:
NOTIFICATION_PATH_CHANGED = 23,
NOTIFICATION_TRANSLATION_CHANGED = 24,
NOTIFICATION_INTERNAL_PROCESS = 25,
- NOTIFICATION_INTERNAL_FIXED_PROCESS = 26,
+ NOTIFICATION_INTERNAL_PHYSICS_PROCESS = 26,
};
@@ -299,16 +299,16 @@ public:
void propagate_call(const StringName &p_method, const Array &p_args = Array(), const bool p_parent_first = false);
/* PROCESSING */
- void set_fixed_process(bool p_process);
- float get_fixed_process_delta_time() const;
- bool is_fixed_processing() const;
+ void set_physics_process(bool p_process);
+ float get_physics_process_delta_time() const;
+ bool is_physics_processing() const;
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_internal);
- bool is_fixed_processing_internal() const;
+ void set_physics_process_internal(bool p_process_internal);
+ bool is_physics_processing_internal() const;
void set_process_internal(bool p_idle_process_internal);
bool is_processing_internal() const;
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 4f62d88934..7a28e2a6f8 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -446,12 +446,12 @@ bool SceneTree::iteration(float p_time) {
_flush_transform_notifications();
MainLoop::iteration(p_time);
- fixed_process_time = p_time;
+ physics_process_time = p_time;
- emit_signal("fixed_frame");
+ emit_signal("physics_frame");
- _notify_group_pause("fixed_process_internal", Node::NOTIFICATION_INTERNAL_FIXED_PROCESS);
- _notify_group_pause("fixed_process", Node::NOTIFICATION_FIXED_PROCESS);
+ _notify_group_pause("physics_process_internal", Node::NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
+ _notify_group_pause("physics_process", Node::NOTIFICATION_PHYSICS_PROCESS);
_flush_ugc();
MessageQueue::get_singleton()->flush(); //small little hack
_flush_transform_notifications();
@@ -650,7 +650,7 @@ void SceneTree::set_quit_on_go_back(bool p_enable) {
bool SceneTree::is_node_being_edited(const Node *p_node) const {
- return Engine::get_singleton()->is_editor_hint() && edited_scene_root && edited_scene_root->is_a_parent_of(p_node);
+ return Engine::get_singleton()->is_editor_hint() && edited_scene_root && (edited_scene_root->is_a_parent_of(p_node) || edited_scene_root == p_node);
}
#endif
@@ -2194,7 +2194,7 @@ void SceneTree::_bind_methods() {
ADD_SIGNAL(MethodInfo("node_configuration_warning_changed", PropertyInfo(Variant::OBJECT, "node")));
ADD_SIGNAL(MethodInfo("idle_frame"));
- ADD_SIGNAL(MethodInfo("fixed_frame"));
+ ADD_SIGNAL(MethodInfo("physics_frame"));
ADD_SIGNAL(MethodInfo("files_dropped", PropertyInfo(Variant::POOL_STRING_ARRAY, "files"), PropertyInfo(Variant::INT, "screen")));
ADD_SIGNAL(MethodInfo("network_peer_connected", PropertyInfo(Variant::INT, "id")));
@@ -2216,6 +2216,7 @@ void SceneTree::_bind_methods() {
BIND_ENUM_CONSTANT(STRETCH_ASPECT_KEEP);
BIND_ENUM_CONSTANT(STRETCH_ASPECT_KEEP_WIDTH);
BIND_ENUM_CONSTANT(STRETCH_ASPECT_KEEP_HEIGHT);
+ BIND_ENUM_CONSTANT(STRETCH_ASPECT_EXPAND);
}
SceneTree *SceneTree::singleton = NULL;
@@ -2253,7 +2254,7 @@ SceneTree::SceneTree() {
collision_debug_contacts = GLOBAL_DEF("debug/shapes/collision/max_contacts_displayed", 10000);
tree_version = 1;
- fixed_process_time = 1;
+ physics_process_time = 1;
idle_process_time = 1;
last_id = 1;
root = NULL;
diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h
index c116bec4fc..f3e689adab 100644
--- a/scene/main/scene_tree.h
+++ b/scene/main/scene_tree.h
@@ -105,7 +105,7 @@ private:
Viewport *root;
uint64_t tree_version;
- float fixed_process_time;
+ float physics_process_time;
float idle_process_time;
bool accept_quit;
bool quit_on_go_back;
@@ -358,7 +358,7 @@ public:
void set_input_as_handled();
bool is_input_handled();
- _FORCE_INLINE_ float get_fixed_process_time() const { return fixed_process_time; }
+ _FORCE_INLINE_ float get_physics_process_time() const { return physics_process_time; }
_FORCE_INLINE_ float get_idle_process_time() const { return idle_process_time; }
#ifdef TOOLS_ENABLED
diff --git a/scene/main/timer.cpp b/scene/main/timer.cpp
index df7d609ac0..23854b5f59 100755
--- a/scene/main/timer.cpp
+++ b/scene/main/timer.cpp
@@ -47,7 +47,7 @@ void Timer::_notification(int p_what) {
}
} break;
case NOTIFICATION_INTERNAL_PROCESS: {
- if (timer_process_mode == TIMER_PROCESS_FIXED || !is_processing_internal())
+ if (timer_process_mode == TIMER_PROCESS_PHYSICS || !is_processing_internal())
return;
time_left -= get_process_delta_time();
@@ -61,10 +61,10 @@ void Timer::_notification(int p_what) {
}
} break;
- case NOTIFICATION_INTERNAL_FIXED_PROCESS: {
- if (timer_process_mode == TIMER_PROCESS_IDLE || !is_fixed_processing_internal())
+ case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
+ if (timer_process_mode == TIMER_PROCESS_IDLE || !is_physics_processing_internal())
return;
- time_left -= get_fixed_process_delta_time();
+ time_left -= get_physics_process_delta_time();
if (time_left < 0) {
if (!one_shot)
@@ -144,16 +144,16 @@ void Timer::set_timer_process_mode(TimerProcessMode p_mode) {
return;
switch (timer_process_mode) {
- case TIMER_PROCESS_FIXED:
- if (is_fixed_processing_internal()) {
- set_fixed_process_internal(false);
+ case TIMER_PROCESS_PHYSICS:
+ if (is_physics_processing_internal()) {
+ set_physics_process_internal(false);
set_process_internal(true);
}
break;
case TIMER_PROCESS_IDLE:
if (is_processing_internal()) {
set_process_internal(false);
- set_fixed_process_internal(true);
+ set_physics_process_internal(true);
}
break;
}
@@ -167,7 +167,7 @@ Timer::TimerProcessMode Timer::get_timer_process_mode() const {
void Timer::_set_process(bool p_process, bool p_force) {
switch (timer_process_mode) {
- case TIMER_PROCESS_FIXED: set_fixed_process_internal(p_process && !paused); break;
+ case TIMER_PROCESS_PHYSICS: set_physics_process_internal(p_process && !paused); break;
case TIMER_PROCESS_IDLE: set_process_internal(p_process && !paused); break;
}
processing = p_process;
@@ -204,7 +204,7 @@ void Timer::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "one_shot"), "set_one_shot", "is_one_shot");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "autostart"), "set_autostart", "has_autostart");
- BIND_ENUM_CONSTANT(TIMER_PROCESS_FIXED);
+ BIND_ENUM_CONSTANT(TIMER_PROCESS_PHYSICS);
BIND_ENUM_CONSTANT(TIMER_PROCESS_IDLE);
}
diff --git a/scene/main/timer.h b/scene/main/timer.h
index 0cd92f12de..a02adbb0a3 100755
--- a/scene/main/timer.h
+++ b/scene/main/timer.h
@@ -50,7 +50,7 @@ protected:
public:
enum TimerProcessMode {
- TIMER_PROCESS_FIXED,
+ TIMER_PROCESS_PHYSICS,
TIMER_PROCESS_IDLE,
};
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index e19f2031dd..37a393b55b 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -456,10 +456,10 @@ void Viewport::_notification(int p_what) {
VS::get_singleton()->viewport_set_active(viewport, false);
} break;
- case NOTIFICATION_FIXED_PROCESS: {
+ case NOTIFICATION_PHYSICS_PROCESS: {
if (gui.tooltip_timer >= 0) {
- gui.tooltip_timer -= get_fixed_process_delta_time();
+ gui.tooltip_timer -= get_physics_process_delta_time();
if (gui.tooltip_timer < 0) {
_gui_show_tooltip();
}
@@ -2453,7 +2453,7 @@ Rect2 Viewport::get_attach_to_screen_rect() const {
void Viewport::set_physics_object_picking(bool p_enable) {
physics_object_picking = p_enable;
- set_fixed_process(physics_object_picking);
+ set_physics_process(physics_object_picking);
if (!physics_object_picking)
physics_picking_events.clear();
}
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index b9dfbd6bb0..75268aad1f 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -222,13 +222,18 @@ void register_scene_types() {
String font_path = GLOBAL_DEF("gui/theme/custom_font", "");
ProjectSettings::get_singleton()->set_custom_property_info("gui/theme/custom_font", PropertyInfo(Variant::STRING, "gui/theme/custom_font", PROPERTY_HINT_FILE, "*.tres,*.res,*.font", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED));
+ bool has_theme = false;
if (theme_path != String()) {
Ref<Theme> theme = ResourceLoader::load(theme_path);
if (theme.is_valid()) {
Theme::set_default(theme);
+ has_theme = true;
+ } else {
+ ERR_PRINTS("Error loading custom theme '" + theme_path + "'");
}
- } else {
+ }
+ if (!has_theme) {
Ref<Font> font;
if (font_path != String()) {
font = ResourceLoader::load(font_path);
@@ -261,9 +266,11 @@ void register_scene_types() {
ClassDB::register_class<Control>();
ClassDB::register_class<Button>();
ClassDB::register_class<Label>();
+ ClassDB::register_class<ScrollBar>();
ClassDB::register_class<HScrollBar>();
ClassDB::register_class<VScrollBar>();
ClassDB::register_class<ProgressBar>();
+ ClassDB::register_class<Slider>();
ClassDB::register_class<HSlider>();
ClassDB::register_class<VSlider>();
ClassDB::register_class<Popup>();
@@ -347,6 +354,7 @@ void register_scene_types() {
#ifndef _3D_DISABLED
ClassDB::register_class<BoneAttachment>();
ClassDB::register_virtual_class<VisualInstance>();
+ ClassDB::register_virtual_class<GeometryInstance>();
ClassDB::register_class<Camera>();
ClassDB::register_class<Listener>();
ClassDB::register_class<ARVRCamera>();
@@ -356,6 +364,7 @@ void register_scene_types() {
ClassDB::register_class<InterpolatedCamera>();
ClassDB::register_class<MeshInstance>();
ClassDB::register_class<ImmediateGeometry>();
+ ClassDB::register_virtual_class<SpriteBase3D>();
ClassDB::register_class<Sprite3D>();
ClassDB::register_class<AnimatedSprite3D>();
ClassDB::register_virtual_class<Light>();
@@ -375,6 +384,7 @@ void register_scene_types() {
OS::get_singleton()->yield(); //may take time to init
ClassDB::register_virtual_class<CollisionObject>();
+ ClassDB::register_virtual_class<PhysicsBody>();
ClassDB::register_class<StaticBody>();
ClassDB::register_class<RigidBody>();
ClassDB::register_class<KinematicCollision>();
@@ -489,6 +499,7 @@ void register_scene_types() {
OS::get_singleton()->yield(); //may take time to init
+ ClassDB::register_virtual_class<Shape>();
ClassDB::register_class<RayShape>();
ClassDB::register_class<SphereShape>();
ClassDB::register_class<BoxShape>();
@@ -526,6 +537,7 @@ void register_scene_types() {
ClassDB::register_class<DynamicFontData>();
ClassDB::register_class<DynamicFont>();
+ ClassDB::register_virtual_class<StyleBox>();
ClassDB::register_class<StyleBoxEmpty>();
ClassDB::register_class<StyleBoxTexture>();
ClassDB::register_class<StyleBoxFlat>();
diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp
index e47cb971ae..fdc3b79db6 100644
--- a/scene/resources/audio_stream_sample.cpp
+++ b/scene/resources/audio_stream_sample.cpp
@@ -41,7 +41,7 @@ void AudioStreamPlaybackSample::start(float p_from_pos) {
ima_adpcm[i].window_ofs = 0;
}
- seek_pos(p_from_pos);
+ seek(p_from_pos);
sign = 1;
active = true;
}
@@ -61,11 +61,11 @@ int AudioStreamPlaybackSample::get_loop_count() const {
return 0;
}
-float AudioStreamPlaybackSample::get_position() const {
+float AudioStreamPlaybackSample::get_playback_position() const {
return float(offset >> MIX_FRAC_BITS) / base->mix_rate;
}
-void AudioStreamPlaybackSample::seek_pos(float p_time) {
+void AudioStreamPlaybackSample::seek(float p_time) {
if (base->format == AudioStreamSample::FORMAT_IMA_ADPCM)
return; //no seeking in ima-adpcm
@@ -486,7 +486,8 @@ PoolVector<uint8_t> AudioStreamSample::get_data() const {
{
PoolVector<uint8_t>::Write w = pv.write();
- copymem(w.ptr(), data, data_bytes);
+ uint8_t *dataptr = (uint8_t *)data;
+ copymem(w.ptr(), dataptr + DATA_PAD, data_bytes);
}
}
diff --git a/scene/resources/audio_stream_sample.h b/scene/resources/audio_stream_sample.h
index 46fa78ddcf..fbb8010a9c 100644
--- a/scene/resources/audio_stream_sample.h
+++ b/scene/resources/audio_stream_sample.h
@@ -71,8 +71,8 @@ public:
virtual int get_loop_count() const; //times it looped
- virtual float get_position() const;
- virtual void seek_pos(float p_time);
+ virtual float get_playback_position() const;
+ virtual void seek(float p_time);
virtual void mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames);
diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp
index daa8fc1874..79cc94c911 100644
--- a/scene/resources/curve.cpp
+++ b/scene/resources/curve.cpp
@@ -485,17 +485,17 @@ void Curve::_bind_methods() {
ClassDB::bind_method(D_METHOD("clear_points"), &Curve::clear_points);
ClassDB::bind_method(D_METHOD("get_point_position", "index"), &Curve::get_point_position);
ClassDB::bind_method(D_METHOD("set_point_value", "index", "y"), &Curve::set_point_value);
- ClassDB::bind_method(D_METHOD("set_point_offset", "index", "offset"), &Curve::set_point_value);
+ ClassDB::bind_method(D_METHOD("set_point_offset", "index", "offset"), &Curve::set_point_offset);
ClassDB::bind_method(D_METHOD("interpolate", "offset"), &Curve::interpolate);
ClassDB::bind_method(D_METHOD("interpolate_baked", "offset"), &Curve::interpolate_baked);
ClassDB::bind_method(D_METHOD("get_point_left_tangent", "index"), &Curve::get_point_left_tangent);
- ClassDB::bind_method(D_METHOD("get_point_right_tangent", "index"), &Curve::get_point_left_tangent);
+ ClassDB::bind_method(D_METHOD("get_point_right_tangent", "index"), &Curve::get_point_right_tangent);
ClassDB::bind_method(D_METHOD("get_point_left_mode", "index"), &Curve::get_point_left_mode);
- ClassDB::bind_method(D_METHOD("get_point_right_mode", "index"), &Curve::get_point_left_mode);
+ ClassDB::bind_method(D_METHOD("get_point_right_mode", "index"), &Curve::get_point_right_mode);
ClassDB::bind_method(D_METHOD("set_point_left_tangent", "index", "tangent"), &Curve::set_point_left_tangent);
- ClassDB::bind_method(D_METHOD("set_point_right_tangent", "index", "tangent"), &Curve::set_point_left_tangent);
+ ClassDB::bind_method(D_METHOD("set_point_right_tangent", "index", "tangent"), &Curve::set_point_right_tangent);
ClassDB::bind_method(D_METHOD("set_point_left_mode", "index", "mode"), &Curve::set_point_left_mode);
- ClassDB::bind_method(D_METHOD("set_point_right_mode", "index", "mode"), &Curve::set_point_left_mode);
+ ClassDB::bind_method(D_METHOD("set_point_right_mode", "index", "mode"), &Curve::set_point_right_mode);
ClassDB::bind_method(D_METHOD("get_min_value"), &Curve::get_min_value);
ClassDB::bind_method(D_METHOD("set_min_value", "min"), &Curve::set_min_value);
ClassDB::bind_method(D_METHOD("get_max_value"), &Curve::get_max_value);
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index 2fbd5ebdd3..923639bc79 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -774,6 +774,9 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
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));
+ theme->set_icon("preset_bg", "ColorPicker", make_icon(mini_checkerboard_png));
+
+ theme->set_icon("bg", "ColorPickerButton", make_icon(mini_checkerboard_png));
// TooltipPanel
diff --git a/scene/resources/default_theme/mini_checkerboard.png b/scene/resources/default_theme/mini_checkerboard.png
new file mode 100644
index 0000000000..3e53183847
--- /dev/null
+++ b/scene/resources/default_theme/mini_checkerboard.png
Binary files differ
diff --git a/scene/resources/default_theme/source/arrow_down.svg b/scene/resources/default_theme/source/arrow_down.svg
deleted file mode 100644
index 354040b548..0000000000
--- a/scene/resources/default_theme/source/arrow_down.svg
+++ /dev/null
@@ -1,80 +0,0 @@
-<?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 12"
- id="svg2"
- version="1.1"
- inkscape:version="0.91 r13725"
- inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collapse.png"
- inkscape:export-xdpi="45"
- inkscape:export-ydpi="45"
- sodipodi:docname="arrow_down.svg">
- <defs
- id="defs4" />
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="64"
- inkscape:cx="5.7299355"
- inkscape:cy="6.6875366"
- 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="false"
- inkscape:snap-object-midpoints="true"
- inkscape:snap-center="true"
- inkscape:window-width="1920"
- inkscape:window-height="1016"
- inkscape:window-x="0"
- inkscape:window-y="27"
- inkscape:window-maximized="1"
- inkscape:snap-smooth-nodes="true"
- inkscape:object-nodes="true">
- <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,-1040.3622)">
- <path
- style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:6;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="m 2,1043.3622 0,3 4,3 4,-3 0,-3 z"
- id="rect4174"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="cccccc" />
- </g>
-</svg>
diff --git a/scene/resources/default_theme/source/arrow_right.svg b/scene/resources/default_theme/source/arrow_right.svg
deleted file mode 100644
index 4c4bc05e28..0000000000
--- a/scene/resources/default_theme/source/arrow_right.svg
+++ /dev/null
@@ -1,80 +0,0 @@
-<?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 12"
- id="svg2"
- version="1.1"
- inkscape:version="0.91 r13725"
- inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collapse.png"
- inkscape:export-xdpi="45"
- inkscape:export-ydpi="45"
- sodipodi:docname="arrow_right.svg">
- <defs
- id="defs4" />
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="45.254836"
- inkscape:cx="3.0018179"
- inkscape:cy="6.0349408"
- 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="false"
- inkscape:snap-object-midpoints="true"
- inkscape:snap-center="true"
- inkscape:window-width="1920"
- inkscape:window-height="1016"
- inkscape:window-x="0"
- inkscape:window-y="27"
- inkscape:window-maximized="1"
- inkscape:snap-smooth-nodes="true"
- inkscape:object-nodes="true">
- <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,-1040.3622)">
- <path
- style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:6;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="m 3,1050.3622 3,0 3,-4 -3,-4 -3,0 z"
- id="rect4174"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="cccccc" />
- </g>
-</svg>
diff --git a/scene/resources/default_theme/source/graph_node_close.svg b/scene/resources/default_theme/source/graph_node_close.svg
deleted file mode 100644
index 52a35a5b8a..0000000000
--- a/scene/resources/default_theme/source/graph_node_close.svg
+++ /dev/null
@@ -1,94 +0,0 @@
-<?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 12"
- id="svg2"
- version="1.1"
- inkscape:version="0.91 r13725"
- inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
- inkscape:export-xdpi="45"
- inkscape:export-ydpi="45"
- sodipodi:docname="graph_node_close.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.627418"
- inkscape:cx="-1.9715406"
- inkscape:cy="8.1466063"
- 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="false"
- inkscape:snap-object-midpoints="true"
- inkscape:snap-center="true"
- inkscape:window-width="1920"
- inkscape:window-height="1016"
- inkscape:window-x="0"
- inkscape:window-y="27"
- inkscape:window-maximized="1">
- <inkscape:grid
- type="xygrid"
- id="grid3336"
- 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.3622)">
- <g
- id="layer1-4"
- inkscape:label="Layer 1"
- transform="matrix(0.70710678,-0.70710678,0.70710678,0.70710678,-738.13242,313.54349)"
- style="fill:#080808;fill-opacity:1">
- <rect
- y="1043.3622"
- x="1"
- height="1.9999478"
- width="14"
- id="rect4137"
- style="fill:#080808;fill-opacity:1;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <rect
- transform="matrix(0,1,-1,0,0,0)"
- style="fill:#080808;fill-opacity:1;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="rect4158"
- width="13.999966"
- height="2.0000017"
- x="1037.3622"
- y="-9" />
- </g>
- </g>
-</svg>
diff --git a/scene/resources/default_theme/source/graph_port.svg b/scene/resources/default_theme/source/graph_port.svg
deleted file mode 100644
index de9b1d4827..0000000000
--- a/scene/resources/default_theme/source/graph_port.svg
+++ /dev/null
@@ -1,80 +0,0 @@
-<?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="10"
- height="10"
- viewBox="0 0 10 10"
- id="svg2"
- version="1.1"
- inkscape:version="0.91 r13725"
- inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collapse.png"
- inkscape:export-xdpi="45"
- inkscape:export-ydpi="45"
- sodipodi:docname="graph_port.svg">
- <defs
- id="defs4" />
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="32.000001"
- inkscape:cx="-5.0080069"
- inkscape:cy="6.2185379"
- 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="false"
- inkscape:snap-object-midpoints="true"
- inkscape:snap-center="true"
- inkscape:window-width="1920"
- inkscape:window-height="1016"
- inkscape:window-x="0"
- inkscape:window-y="27"
- inkscape:window-maximized="1"
- inkscape:snap-smooth-nodes="true"
- inkscape:object-nodes="true">
- <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,-1042.3622)">
- <circle
- style="fill:#f3f3f3;fill-rule:evenodd;stroke:#d8d8d8;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;fill-opacity:1"
- id="path3335"
- cx="5"
- cy="1047.3622"
- r="4" />
- </g>
-</svg>
diff --git a/scene/resources/default_theme/source/icon_close.svg b/scene/resources/default_theme/source/icon_close.svg
deleted file mode 100644
index 6e6ec16638..0000000000
--- a/scene/resources/default_theme/source/icon_close.svg
+++ /dev/null
@@ -1,94 +0,0 @@
-<?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.91 r13725"
- inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
- inkscape:export-xdpi="45"
- inkscape:export-ydpi="45"
- sodipodi:docname="icon_close.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.627418"
- inkscape:cx="1.8501874"
- inkscape:cy="8.0543329"
- 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="false"
- inkscape:snap-object-midpoints="true"
- inkscape:snap-center="true"
- inkscape:window-width="1920"
- inkscape:window-height="1016"
- inkscape:window-x="0"
- inkscape:window-y="27"
- inkscape:window-maximized="1">
- <inkscape:grid
- type="xygrid"
- id="grid3336"
- 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 />
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g
- inkscape:label="Layer 1"
- inkscape:groupmode="layer"
- id="layer1"
- transform="translate(0,-1036.3622)">
- <g
- id="layer1-4"
- inkscape:label="Layer 1"
- transform="matrix(0.70710678,-0.70710678,0.70710678,0.70710678,-736.13242,311.54347)"
- style="fill:#080808;fill-opacity:1">
- <rect
- y="1043.3622"
- x="1"
- height="1.9999478"
- width="14"
- id="rect4137"
- style="fill:#080808;fill-opacity:1;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <rect
- transform="matrix(0,1,-1,0,0,0)"
- style="fill:#080808;fill-opacity:1;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="rect4158"
- width="13.999966"
- height="2.0000017"
- x="1037.3622"
- y="-9" />
- </g>
- </g>
-</svg>
diff --git a/scene/resources/default_theme/source/option_arrow.svg b/scene/resources/default_theme/source/option_arrow.svg
deleted file mode 100644
index cd78404ff1..0000000000
--- a/scene/resources/default_theme/source/option_arrow.svg
+++ /dev/null
@@ -1,86 +0,0 @@
-<?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 12"
- id="svg2"
- version="1.1"
- inkscape:version="0.91 r13725"
- inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collapse.png"
- inkscape:export-xdpi="45"
- inkscape:export-ydpi="45"
- sodipodi:docname="option_arrow.svg">
- <defs
- id="defs4" />
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="45.254836"
- inkscape:cx="6.0969578"
- inkscape:cy="7.5632913"
- 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="false"
- inkscape:snap-object-midpoints="true"
- inkscape:snap-center="true"
- inkscape:window-width="1920"
- inkscape:window-height="1016"
- inkscape:window-x="0"
- inkscape:window-y="27"
- inkscape:window-maximized="1"
- inkscape:snap-smooth-nodes="true"
- inkscape:object-nodes="true">
- <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></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g
- inkscape:label="Layer 1"
- inkscape:groupmode="layer"
- id="layer1"
- transform="translate(0,-1040.3622)">
- <path
- style="fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- d="m 3,1045.3622 6,0 -3,-4 z"
- id="path4158"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="cccc" />
- <path
- inkscape:connector-curvature="0"
- id="path4160"
- d="m 3,1047.3622 6,0 -3,4 z"
- style="fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- sodipodi:nodetypes="cccc" />
- </g>
-</svg>
diff --git a/scene/resources/default_theme/source/popup_checked.svg b/scene/resources/default_theme/source/popup_checked.svg
deleted file mode 100644
index fbefd4138d..0000000000
--- a/scene/resources/default_theme/source/popup_checked.svg
+++ /dev/null
@@ -1,81 +0,0 @@
-<?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="8"
- height="8"
- viewBox="0 0 8 8"
- id="svg2"
- version="1.1"
- inkscape:version="0.91 r13725"
- inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_folder.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90"
- sodipodi:docname="popup_checked.svg">
- <defs
- id="defs4" />
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="45.254834"
- inkscape:cx="2.6626803"
- inkscape:cy="5.227737"
- 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="false"
- inkscape:snap-object-midpoints="true"
- inkscape:snap-center="true"
- inkscape:window-width="1920"
- inkscape:window-height="1016"
- inkscape:window-x="0"
- inkscape:window-y="27"
- inkscape:window-maximized="1"
- inkscape:object-paths="true"
- inkscape:snap-intersection-paths="true"
- inkscape:object-nodes="true"
- inkscape:snap-smooth-nodes="true">
- <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></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g
- inkscape:label="Layer 1"
- inkscape:groupmode="layer"
- id="layer1"
- transform="translate(0,-1044.3622)">
- <path
- style="fill:none;fill-rule:evenodd;stroke:#e0e0e0;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="m 7,1046.3622 -4,5 -2,-2"
- id="path4154"
- inkscape:connector-curvature="0" />
- </g>
-</svg>
diff --git a/scene/resources/default_theme/source/spinbox_updown.svg b/scene/resources/default_theme/source/spinbox_updown.svg
deleted file mode 100644
index 5b8e0a83eb..0000000000
--- a/scene/resources/default_theme/source/spinbox_updown.svg
+++ /dev/null
@@ -1,86 +0,0 @@
-<?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.91 r13725"
- inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collapse.png"
- inkscape:export-xdpi="45"
- inkscape:export-ydpi="45"
- sodipodi:docname="spinbox_updown.svg">
- <defs
- id="defs4" />
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="45.254834"
- inkscape:cx="5.7914867"
- inkscape:cy="9.8174296"
- 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="false"
- inkscape:snap-object-midpoints="true"
- inkscape:snap-center="true"
- inkscape:window-width="1920"
- inkscape:window-height="1016"
- inkscape:window-x="0"
- inkscape:window-y="27"
- inkscape:window-maximized="1"
- inkscape:snap-smooth-nodes="true"
- inkscape:object-nodes="true">
- <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:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- d="m 4,1042.3622 8,0 -4,-5 z"
- id="path4158"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="cccc" />
- <path
- inkscape:connector-curvature="0"
- id="path4160"
- d="m 4,1046.3622 8,0 -4,5 z"
- style="fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- sodipodi:nodetypes="cccc" />
- </g>
-</svg>
diff --git a/scene/resources/default_theme/source/submenu.svg b/scene/resources/default_theme/source/submenu.svg
deleted file mode 100644
index ef7f696571..0000000000
--- a/scene/resources/default_theme/source/submenu.svg
+++ /dev/null
@@ -1,80 +0,0 @@
-<?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="8"
- height="8"
- viewBox="0 0 8 8"
- id="svg2"
- version="1.1"
- inkscape:version="0.91 r13725"
- inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collapse.png"
- inkscape:export-xdpi="45"
- inkscape:export-ydpi="45"
- sodipodi:docname="submenu.svg">
- <defs
- id="defs4" />
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="64.000003"
- inkscape:cx="1.4039962"
- inkscape:cy="5.6866955"
- 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="false"
- inkscape:snap-object-midpoints="true"
- inkscape:snap-center="true"
- inkscape:window-width="1920"
- inkscape:window-height="1016"
- inkscape:window-x="0"
- inkscape:window-y="27"
- inkscape:window-maximized="1"
- inkscape:snap-smooth-nodes="true"
- inkscape:object-nodes="true">
- <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,-1044.3622)">
- <path
- style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:6;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="m 1,1052.3622 3,0 3,-4 -3,-4 -3,0 z"
- id="rect4174"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="cccccc" />
- </g>
-</svg>
diff --git a/scene/resources/default_theme/source/tab_close.svg b/scene/resources/default_theme/source/tab_close.svg
deleted file mode 100644
index 65b71ae860..0000000000
--- a/scene/resources/default_theme/source/tab_close.svg
+++ /dev/null
@@ -1,93 +0,0 @@
-<?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.91 r13725"
- inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
- inkscape:export-xdpi="45"
- inkscape:export-ydpi="45"
- sodipodi:docname="icon_close.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.627418"
- inkscape:cx="3.3969834"
- inkscape:cy="11.678255"
- 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="false"
- inkscape:snap-object-midpoints="true"
- inkscape:snap-center="true"
- inkscape:window-width="1920"
- inkscape:window-height="1016"
- inkscape:window-x="0"
- inkscape:window-y="27"
- inkscape:window-maximized="1">
- <inkscape:grid
- type="xygrid"
- id="grid3336"
- 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,-1036.3622)">
- <g
- id="layer1-4"
- inkscape:label="Layer 1"
- transform="matrix(0.70710678,-0.70710678,0.70710678,0.70710678,-736.13242,311.54347)">
- <rect
- y="1043.3622"
- x="1"
- height="1.9999478"
- width="14"
- id="rect4137"
- style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <rect
- transform="matrix(0,1,-1,0,0,0)"
- style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="rect4158"
- width="13.999966"
- height="2.0000017"
- x="1037.3622"
- y="-9" />
- </g>
- </g>
-</svg>
diff --git a/scene/resources/default_theme/source/tab_menu.svg b/scene/resources/default_theme/source/tab_menu.svg
deleted file mode 100644
index 84f7c8095a..0000000000
--- a/scene/resources/default_theme/source/tab_menu.svg
+++ /dev/null
@@ -1,80 +0,0 @@
-<?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.91 r13725"
- inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collapse.png"
- inkscape:export-xdpi="45"
- inkscape:export-ydpi="45"
- sodipodi:docname="tab_menu.svg">
- <defs
- id="defs4" />
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="45.254836"
- inkscape:cx="6.2944765"
- inkscape:cy="7.7343939"
- 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="false"
- inkscape:snap-object-midpoints="true"
- inkscape:snap-center="true"
- inkscape:window-width="1920"
- inkscape:window-height="1016"
- inkscape:window-x="0"
- inkscape:window-y="27"
- inkscape:window-maximized="1"
- inkscape:snap-smooth-nodes="true"
- inkscape:object-nodes="true">
- <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:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:6;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="m 4,1044.3622 0,3 4,3 4,-3 0,-3 z"
- id="rect4174"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="cccccc" />
- </g>
-</svg>
diff --git a/scene/resources/default_theme/source/updown.svg b/scene/resources/default_theme/source/updown.svg
deleted file mode 100644
index adc72b405d..0000000000
--- a/scene/resources/default_theme/source/updown.svg
+++ /dev/null
@@ -1,86 +0,0 @@
-<?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="8"
- height="16"
- viewBox="0 0 8 16"
- id="svg2"
- version="1.1"
- inkscape:version="0.91 r13725"
- inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collapse.png"
- inkscape:export-xdpi="45"
- inkscape:export-ydpi="45"
- sodipodi:docname="updown.svg">
- <defs
- id="defs4" />
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="32.000001"
- inkscape:cx="-3.4436559"
- inkscape:cy="10.099799"
- 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="false"
- inkscape:snap-object-midpoints="true"
- inkscape:snap-center="true"
- inkscape:window-width="1920"
- inkscape:window-height="1016"
- inkscape:window-x="0"
- inkscape:window-y="27"
- inkscape:window-maximized="1"
- inkscape:snap-smooth-nodes="true"
- inkscape:object-nodes="true">
- <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:none;fill-rule:evenodd;stroke:#e0e0e0;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="m 1,1042.3565 3,-2.9943 3,2.9943"
- id="path4155"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="ccc" />
- <path
- inkscape:connector-curvature="0"
- id="path4159"
- d="m 1,1046.3622 3,3 3,-3"
- style="fill:none;fill-rule:evenodd;stroke:#e0e0e0;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- sodipodi:nodetypes="ccc" />
- </g>
-</svg>
diff --git a/scene/resources/default_theme/theme_data.h b/scene/resources/default_theme/theme_data.h
index 6643b4ccc1..38e5f58b0d 100644
--- a/scene/resources/default_theme/theme_data.h
+++ b/scene/resources/default_theme/theme_data.h
@@ -218,6 +218,10 @@ static const unsigned char logo_png[] = {
0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x80, 0x0, 0x0, 0x0, 0x80, 0x8, 0x6, 0x0, 0x0, 0x0, 0xc3, 0x3e, 0x61, 0xcb, 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, 0x6, 0x62, 0x4b, 0x47, 0x44, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0xa0, 0xbd, 0xa7, 0x93, 0x0, 0x0, 0x0, 0x9, 0x70, 0x48, 0x59, 0x73, 0x0, 0x0, 0x2e, 0x23, 0x0, 0x0, 0x2e, 0x23, 0x1, 0x78, 0xa5, 0x3f, 0x76, 0x0, 0x0, 0x0, 0x7, 0x74, 0x49, 0x4d, 0x45, 0x7, 0xdc, 0x9, 0x7, 0x13, 0x2, 0x0, 0x15, 0xb9, 0x53, 0x97, 0x0, 0x0, 0x21, 0x58, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0xed, 0x7d, 0x79, 0x9c, 0x1c, 0x55, 0xb5, 0xff, 0xf7, 0x7b, 0xab, 0x7b, 0x66, 0x48, 0x8, 0x61, 0xd1, 0x90, 0xb0, 0x88, 0x91, 0x27, 0x24, 0x24, 0x21, 0x3b, 0x8, 0x4, 0x42, 0x58, 0x54, 0xe0, 0x91, 0x80, 0x24, 0x1, 0x2, 0x9, 0x42, 0x80, 0x4, 0x11, 0x90, 0x9f, 0xf2, 0xd3, 0xa7, 0xcf, 0xe7, 0xf3, 0x3d, 0x1f, 0x1f, 0x7f, 0xea, 0xd3, 0x48, 0x4c, 0x8, 0x61, 0xd, 0x49, 0x64, 0x89, 0x82, 0x40, 0x58, 0x4, 0x64, 0xb, 0x44, 0x25, 0x9b, 0xd9, 0x51, 0x14, 0x41, 0x3, 0xc8, 0x16, 0x20, 0xfb, 0x4c, 0x77, 0xdd, 0xef, 0xef, 0x8f, 0xaa, 0xea, 0xae, 0xee, 0xa9, 0xea, 0x9e, 0xee, 0xae, 0x99, 0xe9, 0xe0, 0x9c, 0xf9, 0xd4, 0x74, 0xd5, 0xad, 0x5b, 0x77, 0x39, 0xe7, 0xdc, 0x7b, 0xcf, 0x39, 0xf7, 0xdc, 0x7b, 0x81, 0x2e, 0xe8, 0x82, 0x2e, 0xe8, 0x82, 0x2e, 0xe8, 0x82, 0x2e, 0xe8, 0x82, 0x2e, 0xe8, 0x82, 0x2e, 0xf8, 0xe7, 0x2, 0x76, 0x76, 0x1, 0xea, 0x1, 0xe, 0xff, 0xc2, 0xcc, 0xbd, 0x60, 0x5b, 0x6e, 0xb6, 0xd6, 0xf6, 0x2, 0xb8, 0x8d, 0xc6, 0x6c, 0x36, 0x34, 0x6f, 0x81, 0x7c, 0x43, 0x30, 0x7f, 0x27, 0xcd, 0xdf, 0x8c, 0xe3, 0x6c, 0xda, 0x70, 0xef, 0xf4, 0x37, 0x3b, 0xbb, 0xac, 0x49, 0x43, 0xaa, 0xb3, 0xb, 0x50, 0xf, 0x20, 0x9b, 0xfd, 0x96, 0xcd, 0xb6, 0x4c, 0x40, 0xd0, 0x20, 0x2c, 0xac, 0x4b, 0xb3, 0x3, 0xc0, 0x36, 0x80, 0x5b, 0x41, 0x6c, 0x75, 0x5b, 0xb8, 0xed, 0xb0, 0x71, 0xff, 0xbb, 0x83, 0xc6, 0x6c, 0x26, 0x9d, 0x65, 0x74, 0xd2, 0x4f, 0x6e, 0x5c, 0x74, 0xc5, 0xba, 0xce, 0x2e, 0x7b, 0xad, 0xf0, 0x4f, 0xdf, 0x3, 0xf4, 0x9f, 0x38, 0xb7, 0x5b, 0x76, 0xd7, 0x7, 0x2f, 0xcb, 0xda, 0x3, 0xc8, 0x42, 0x94, 0x48, 0x6a, 0x15, 0x9f, 0x24, 0x0, 0xbe, 0x43, 0xe3, 0xfc, 0xc1, 0x49, 0x37, 0x4d, 0xdd, 0xf8, 0x8b, 0x2b, 0xff, 0xde, 0xd9, 0x75, 0xa8, 0x5, 0x76, 0x2b, 0x6, 0xe8, 0x37, 0x7e, 0xf6, 0x18, 0xeb, 0xb6, 0x9c, 0x6, 0x69, 0xf, 0x1a, 0xf3, 0xc1, 0x1f, 0xef, 0xbb, 0xe6, 0xdb, 0xb5, 0xa4, 0x37, 0xf2, 0x9a, 0xa5, 0xdc, 0xb2, 0x69, 0xe5, 0x69, 0xca, 0xec, 0xf8, 0xa5, 0xa4, 0x26, 0x48, 0xf2, 0x29, 0x8c, 0x82, 0x7b, 0x40, 0x3e, 0xae, 0xfc, 0x5f, 0x41, 0x82, 0x4d, 0x37, 0xf5, 0x18, 0xb7, 0xd7, 0xc1, 0xc3, 0x1f, 0xfe, 0xfd, 0x4f, 0x3e, 0xa3, 0x2a, 0x8b, 0xd0, 0xe9, 0x50, 0xf7, 0xc, 0x70, 0xf8, 0x39, 0xb3, 0x3e, 0x9, 0xb9, 0xa7, 0x48, 0xf6, 0x70, 0xb9, 0xd9, 0xd1, 0x90, 0x3b, 0xd2, 0x2b, 0x39, 0x9b, 0x4d, 0xaa, 0x69, 0xfa, 0x1f, 0xef, 0xbb, 0xfa, 0x8e, 0x5a, 0xd2, 0x3f, 0x6c, 0xdc, 0x8f, 0x9f, 0x91, 0xcd, 0x8c, 0x2, 0xe9, 0xe4, 0x43, 0x3, 0x7a, 0xc7, 0x80, 0x4, 0x80, 0xbb, 0x9c, 0x74, 0xd3, 0x77, 0xdd, 0xcc, 0xce, 0x1f, 0xbc, 0xfc, 0xd0, 0xd7, 0x6d, 0x67, 0xe3, 0xa9, 0x5a, 0xa8, 0x5b, 0x19, 0xa0, 0xdf, 0xf8, 0xd9, 0x47, 0x42, 0xee, 0x51, 0x72, 0x5b, 0x3e, 0x6b, 0xdd, 0xcc, 0x69, 0x0, 0xf6, 0xf4, 0x8, 0xe3, 0x75, 0xc3, 0x92, 0x1a, 0x6d, 0x66, 0xd7, 0x8f, 0xfa, 0x8d, 0x9f, 0xf5, 0xe7, 0x97, 0x7e, 0x71, 0xe5, 0xf3, 0x55, 0xe5, 0x31, 0xe1, 0xc6, 0x83, 0xdc, 0x5d, 0x5b, 0x46, 0x3, 0x7e, 0xb3, 0xce, 0x51, 0xbd, 0x74, 0xbb, 0xf0, 0x9b, 0xbb, 0x23, 0xd9, 0x23, 0x59, 0xf7, 0x4d, 0xa8, 0x34, 0xd4, 0x1d, 0x3, 0xf4, 0x3b, 0x67, 0xf6, 0x20, 0xc0, 0x1d, 0x65, 0xb3, 0xcd, 0x67, 0xc9, 0xcd, 0x9c, 0xa, 0x9f, 0x1a, 0xfe, 0xd8, 0x5b, 0xd0, 0x15, 0xb, 0xda, 0xcf, 0x66, 0x9a, 0x7f, 0xd8, 0x7f, 0xc2, 0x9c, 0xb1, 0x1b, 0x17, 0x4d, 0x7f, 0xa7, 0x92, 0x7c, 0xe, 0xff, 0xc2, 0xd, 0x69, 0x58, 0x77, 0x1c, 0x40, 0x17, 0x84, 0x3, 0x54, 0x48, 0x4a, 0xd2, 0x91, 0x75, 0x7, 0x38, 0x4d, 0x7b, 0xef, 0xd6, 0x2c, 0x50, 0x37, 0xc, 0xd0, 0x7f, 0xc2, 0x8d, 0x7, 0x3, 0x1a, 0x65, 0x33, 0xcd, 0x97, 0x58, 0x9b, 0x3d, 0x5, 0x0, 0x40, 0xe6, 0x5a, 0xa6, 0x82, 0x47, 0xbf, 0x13, 0x0, 0x21, 0x82, 0x90, 0xdc, 0xcf, 0xc8, 0x66, 0xbe, 0xd6, 0x6f, 0xfc, 0xac, 0xef, 0xbc, 0xf4, 0x8b, 0x2b, 0x77, 0xb5, 0x35, 0x3f, 0x93, 0x6a, 0xb4, 0x36, 0xb3, 0xe3, 0x7c, 0x1a, 0xe3, 0x8f, 0xe9, 0xe1, 0x21, 0x3f, 0x4, 0xe1, 0xd1, 0x40, 0x80, 0x24, 0xd1, 0x90, 0x10, 0x8c, 0x64, 0xf, 0x31, 0xa9, 0xa6, 0x2e, 0x6, 0x48, 0x2, 0x64, 0xb3, 0xdf, 0xb0, 0xd9, 0xe6, 0x2f, 0x1, 0x41, 0x6b, 0xf7, 0x9, 0x2f, 0x91, 0x1e, 0x23, 0x78, 0x40, 0x9f, 0x8, 0x34, 0x41, 0x90, 0x75, 0x33, 0xbb, 0xfe, 0xaf, 0xd3, 0xd0, 0x7d, 0xd9, 0x61, 0xe3, 0x7e, 0x78, 0xdf, 0x9f, 0x1e, 0xb8, 0x2e, 0x72, 0x3c, 0x1e, 0x30, 0xe9, 0xce, 0x94, 0xdb, 0xb2, 0x7d, 0x1f, 0xd2, 0xf4, 0x0, 0x6c, 0x1a, 0xb2, 0xbd, 0x65, 0xdd, 0xcf, 0x0, 0x30, 0x0, 0x41, 0x42, 0x91, 0xbd, 0x0, 0xb, 0xef, 0x49, 0x52, 0x9e, 0x7a, 0x40, 0x48, 0x7b, 0xee, 0x6, 0x62, 0x54, 0x49, 0xa8, 0x1b, 0x6, 0xb0, 0xd9, 0xcc, 0x39, 0x7e, 0x6b, 0xb, 0xda, 0x5c, 0xa8, 0xeb, 0x2f, 0x4, 0x7a, 0x81, 0x41, 0x3c, 0x3, 0x10, 0x36, 0xbb, 0xeb, 0xc7, 0x4e, 0x43, 0x8f, 0xd7, 0xfa, 0x4f, 0xb8, 0x71, 0x3, 0x68, 0xf6, 0x7, 0xb0, 0x37, 0x81, 0x34, 0x8, 0xca, 0xda, 0x46, 0xb7, 0x65, 0xeb, 0x27, 0x20, 0x3b, 0xd8, 0x75, 0xdd, 0xbe, 0x4, 0xf6, 0x83, 0x74, 0x30, 0x80, 0x40, 0xf0, 0x53, 0x25, 0x43, 0x0, 0xfd, 0xff, 0x22, 0xad, 0xcd, 0xee, 0xac, 0x59, 0x3, 0xe8, 0x7f, 0xee, 0x2d, 0xdd, 0x36, 0xde, 0x73, 0xe9, 0x8e, 0xce, 0xc0, 0x7b, 0xdd, 0x30, 0x0, 0x8d, 0xf3, 0xb2, 0xac, 0x3e, 0xe, 0xc0, 0x20, 0x4e, 0xc, 0xf, 0xc8, 0x1e, 0x3c, 0xf9, 0x8a, 0x3a, 0x49, 0x40, 0xf6, 0x60, 0xeb, 0xb6, 0xfc, 0x1f, 0xd2, 0xac, 0xb3, 0xb6, 0xf9, 0x24, 0x78, 0xad, 0xbb, 0x9b, 0x17, 0xb5, 0x90, 0x46, 0xca, 0x25, 0x46, 0x85, 0x52, 0x8e, 0xcb, 0xa7, 0x30, 0xdc, 0x4a, 0xa0, 0x21, 0xe8, 0x7d, 0xed, 0x36, 0x6f, 0xad, 0x89, 0x1, 0x8e, 0x38, 0x77, 0x6e, 0x5f, 0xeb, 0xb6, 0x9c, 0xde, 0x7f, 0xc2, 0x9c, 0xe7, 0x36, 0x2e, 0x9a, 0xbe, 0xb6, 0xc3, 0xf1, 0xde, 0xd1, 0x19, 0xc6, 0x41, 0xff, 0x9, 0xb3, 0xbf, 0x67, 0x33, 0xcd, 0x5f, 0x96, 0x6c, 0xcf, 0x70, 0xab, 0x8f, 0xa3, 0x43, 0x41, 0xb8, 0x4, 0x90, 0x16, 0x80, 0x41, 0xd8, 0x78, 0x43, 0x6, 0xef, 0x8a, 0xf4, 0x7a, 0x9, 0xf2, 0xfa, 0x7d, 0xff, 0xb1, 0x40, 0x0, 0x60, 0x51, 0xde, 0xc5, 0xf9, 0x11, 0x39, 0x23, 0x51, 0xd6, 0x69, 0xdc, 0xf3, 0x18, 0xc9, 0xbe, 0x61, 0x9c, 0x86, 0xad, 0x1b, 0xee, 0x9e, 0xba, 0xb5, 0xad, 0xf5, 0x3d, 0xe2, 0xbc, 0x5b, 0xbb, 0xc1, 0xba, 0x9f, 0xc8, 0x66, 0xb6, 0x2f, 0x86, 0x74, 0x28, 0x80, 0xb7, 0x4d, 0xba, 0xdb, 0xb9, 0xc6, 0x38, 0x4b, 0x37, 0xdc, 0x73, 0x59, 0x4b, 0x47, 0xe1, 0xbd, 0x6e, 0x18, 0xa0, 0xdf, 0x84, 0x39, 0xa7, 0x2b, 0xb3, 0x73, 0x2e, 0xa0, 0x3, 0x81, 0x60, 0x9c, 0x6f, 0x73, 0xb7, 0x1c, 0xc8, 0xb, 0x20, 0xf3, 0xad, 0x3a, 0xf4, 0x9c, 0x78, 0x3d, 0x95, 0x37, 0x13, 0x92, 0xc6, 0xf9, 0xb, 0x9d, 0xf4, 0x22, 0x63, 0x52, 0xb7, 0x3, 0x78, 0x3d, 0xdb, 0xbc, 0x6d, 0xe7, 0x9f, 0x1e, 0xf8, 0x6a, 0xac, 0x6d, 0xa0, 0xff, 0x84, 0x39, 0xfb, 0x4b, 0xee, 0x14, 0x9b, 0x69, 0xfe, 0x41, 0x90, 0x9a, 0x2f, 0x5b, 0xc0, 0xa4, 0x9b, 0xfe, 0xcd, 0x18, 0xe7, 0x96, 0xd, 0xf7, 0x4e, 0x7f, 0xb7, 0x23, 0xf0, 0x5e, 0x37, 0xc, 0xd0, 0xff, 0xdc, 0x9b, 0x3f, 0x65, 0x5b, 0xb6, 0x3f, 0x21, 0xd9, 0x4f, 0x41, 0x8, 0x24, 0xed, 0xb6, 0x95, 0x56, 0x65, 0xde, 0x25, 0x55, 0x53, 0x3f, 0xad, 0x9c, 0x26, 0xe0, 0x3f, 0x14, 0xf4, 0x1e, 0x26, 0x75, 0x3f, 0x9d, 0x86, 0x9f, 0xd2, 0x49, 0xaf, 0xec, 0xd1, 0xfb, 0x88, 0x6d, 0xc5, 0x56, 0xc2, 0xfe, 0x13, 0x6f, 0x3a, 0xcc, 0x66, 0x9b, 0xe7, 0x40, 0xee, 0x18, 0x0, 0x5e, 0xaf, 0x15, 0x24, 0x3, 0x8, 0x24, 0x8d, 0xd3, 0x70, 0x13, 0x4c, 0xea, 0xfb, 0x1b, 0xef, 0x9d, 0xf6, 0x6a, 0x7b, 0xe3, 0xdd, 0xb4, 0x77, 0x6, 0x6d, 0x85, 0x8d, 0xf7, 0x5c, 0xf6, 0xa, 0x69, 0x9a, 0x3d, 0x51, 0x3b, 0xc0, 0x26, 0xfd, 0xb, 0xa5, 0x9, 0x58, 0xaa, 0xa3, 0x28, 0xf7, 0x6d, 0x25, 0xe0, 0xa7, 0x95, 0x27, 0x3e, 0x94, 0xcf, 0xc0, 0xd3, 0x26, 0xad, 0x9b, 0x3d, 0xdb, 0x6d, 0xd9, 0xf1, 0x8c, 0x6d, 0xd9, 0xfe, 0xdc, 0x96, 0xd7, 0x57, 0x9f, 0x11, 0xfe, 0xfc, 0x88, 0x73, 0xe7, 0x9e, 0xec, 0xb6, 0xec, 0xd8, 0x28, 0xeb, 0x8e, 0xf1, 0xbe, 0xf5, 0xf1, 0x2f, 0x88, 0xa0, 0xcf, 0x48, 0xb4, 0xd6, 0x6d, 0x99, 0x66, 0xb3, 0x2d, 0xf3, 0xfb, 0x4f, 0x9c, 0x7b, 0x5c, 0x7b, 0xe3, 0xbd, 0x6e, 0x7a, 0x0, 0x0, 0xe8, 0x77, 0xce, 0xcf, 0x9e, 0xb3, 0x6e, 0xe6, 0x78, 0x20, 0x5a, 0xfa, 0xaf, 0x3f, 0x8, 0x86, 0x81, 0x7c, 0x61, 0xfd, 0x91, 0x41, 0x64, 0xa0, 0x5a, 0x38, 0x2b, 0x4c, 0xba, 0xf1, 0x3b, 0x4, 0x7a, 0x66, 0x5b, 0x76, 0x2c, 0xf4, 0xf8, 0xbb, 0xd5, 0xb0, 0x54, 0xd0, 0x4f, 0x5, 0x6a, 0x26, 0x8d, 0x79, 0x8d, 0x4e, 0xd3, 0xbf, 0xbd, 0xb4, 0x68, 0xda, 0x5d, 0xed, 0x55, 0x3, 0xa7, 0xf6, 0x24, 0x92, 0x83, 0x8f, 0xf, 0x1c, 0x9b, 0x2, 0x34, 0x9c, 0x40, 0x8f, 0x78, 0xcb, 0x4c, 0x3d, 0x41, 0xd0, 0x45, 0xf9, 0xe0, 0xcb, 0x2d, 0xbe, 0xd5, 0x92, 0x14, 0x24, 0xa2, 0xb7, 0x6c, 0x76, 0x82, 0xac, 0x7b, 0x16, 0x29, 0x27, 0x50, 0x21, 0x1, 0x85, 0xba, 0xba, 0x5c, 0x37, 0xe2, 0xdb, 0xbb, 0x72, 0x36, 0xb0, 0xbd, 0x61, 0xdd, 0x13, 0xf7, 0x3f, 0xf2, 0xec, 0x96, 0x77, 0xd6, 0x2f, 0xfe, 0x5d, 0x7b, 0xd4, 0xa0, 0x6e, 0x86, 0x0, 0xaf, 0x34, 0xce, 0x12, 0x0, 0xef, 0x7b, 0xf7, 0x86, 0xf9, 0x21, 0x60, 0x37, 0xb9, 0x8c, 0xf1, 0x94, 0xc3, 0x80, 0x71, 0x69, 0x40, 0xd2, 0x90, 0x6c, 0x0, 0xd4, 0x0, 0x18, 0x79, 0x17, 0x8, 0x18, 0x45, 0xa4, 0xe1, 0x31, 0x81, 0x31, 0xfe, 0x7b, 0x3, 0x40, 0xfb, 0x65, 0x33, 0xbb, 0xbe, 0xde, 0x6f, 0xc2, 0x9c, 0xaf, 0xb4, 0x7, 0xca, 0xeb, 0xa6, 0x7, 0xe8, 0x3f, 0x71, 0xee, 0x4, 0x4f, 0x38, 0x52, 0x3f, 0xf8, 0xb6, 0x9e, 0xd0, 0xe8, 0xba, 0xfb, 0x5c, 0x44, 0xae, 0xfd, 0xe7, 0xee, 0x1, 0xbf, 0x67, 0x80, 0x7f, 0x11, 0xa1, 0x77, 0x45, 0xdf, 0x93, 0xa1, 0x74, 0x82, 0x1e, 0x61, 0x4f, 0xca, 0xe, 0xea, 0x35, 0xe8, 0x2c, 0xe7, 0x9d, 0xf5, 0x8b, 0x97, 0x26, 0x89, 0xf7, 0xba, 0x30, 0x4, 0xf5, 0x9f, 0x78, 0xd3, 0x2c, 0x9b, 0xdd, 0x75, 0x36, 0xa0, 0x3e, 0xde, 0x18, 0x69, 0x24, 0x28, 0x6c, 0x0, 0xde, 0x1d, 0x81, 0x31, 0xf7, 0x6d, 0x6, 0x6f, 0x14, 0xf4, 0x70, 0x21, 0xb0, 0x1b, 0xc8, 0xee, 0x49, 0x17, 0xb2, 0xd3, 0x19, 0xe0, 0xf0, 0x73, 0x66, 0x3d, 0xad, 0x6c, 0xcb, 0x48, 0x0, 0xdd, 0xbd, 0x39, 0x1e, 0xdf, 0x74, 0x53, 0xef, 0xc3, 0x7f, 0x87, 0x40, 0xce, 0xe4, 0xd, 0x1a, 0x67, 0xb5, 0x71, 0xd2, 0xd7, 0x27, 0x9d, 0x43, 0x62, 0xc, 0x70, 0xc4, 0xb9, 0x73, 0x7f, 0x24, 0x61, 0x1b, 0x8d, 0xf3, 0xd3, 0xd, 0x77, 0x4f, 0x7d, 0xbf, 0x5c, 0xfc, 0x81, 0x93, 0xee, 0xd8, 0x23, 0xdb, 0xb2, 0xe3, 0x31, 0xd9, 0xec, 0x9, 0x5e, 0x3f, 0x97, 0x13, 0x80, 0xbb, 0x88, 0xef, 0x83, 0x6f, 0xc0, 0x24, 0xe9, 0xbc, 0x63, 0x9c, 0xf4, 0xe2, 0x75, 0x3f, 0xbf, 0x38, 0x71, 0xb, 0x61, 0x22, 0x98, 0x3e, 0xe2, 0xbc, 0x5b, 0x47, 0xd8, 0xcc, 0xce, 0x7, 0x25, 0x75, 0xa3, 0x71, 0xd6, 0x80, 0xe6, 0x75, 0xd2, 0xfc, 0x99, 0xc6, 0x99, 0xb7, 0xe1, 0xee, 0xa9, 0x7f, 0x2e, 0x8e, 0xdf, 0xff, 0xdc, 0x5b, 0xe, 0x95, 0xdb, 0x72, 0x87, 0x6c, 0x76, 0x14, 0xe9, 0xab, 0xc2, 0x5e, 0x4d, 0xe1, 0x49, 0xc7, 0x51, 0xc5, 0x8c, 0x33, 0xb9, 0x87, 0xe7, 0x85, 0x54, 0xe2, 0x9b, 0x62, 0x3, 0x6f, 0xb9, 0xb4, 0x63, 0xb5, 0xb4, 0x88, 0xf0, 0xa8, 0xef, 0x2a, 0x29, 0x6f, 0xeb, 0x6f, 0x72, 0xbe, 0x67, 0x0, 0x41, 0xe7, 0x91, 0x74, 0xd3, 0x9e, 0xe3, 0xd7, 0x2e, 0x98, 0xb2, 0xb3, 0x1a, 0xfa, 0x94, 0x82, 0x9a, 0x19, 0xe0, 0x88, 0xf3, 0xe7, 0xf5, 0x50, 0x76, 0xc7, 0xc3, 0xb2, 0xee, 0x71, 0x80, 0x42, 0x5a, 0x85, 0xd9, 0x42, 0x63, 0xd6, 0x80, 0xce, 0x4a, 0x1a, 0xe7, 0x77, 0x26, 0x95, 0x7e, 0x74, 0xdd, 0x82, 0x29, 0x1f, 0x1c, 0x71, 0xfe, 0x6d, 0x43, 0x6c, 0x66, 0xd7, 0x4d, 0x90, 0x7b, 0x54, 0xa8, 0x18, 0xc2, 0x6e, 0x3e, 0xe0, 0x27, 0xa, 0xca, 0xd9, 0x1c, 0x9, 0x3a, 0xaf, 0x9a, 0x54, 0xc3, 0xbf, 0x6f, 0xb8, 0xfb, 0xd2, 0x85, 0xed, 0x91, 0x55, 0xcd, 0x43, 0x80, 0xdc, 0xe6, 0x1f, 0xcb, 0xba, 0xbe, 0xf1, 0xc6, 0x84, 0xed, 0xf0, 0x7b, 0xc9, 0xba, 0xa3, 0x0, 0x77, 0x94, 0xac, 0x73, 0x86, 0xac, 0x3b, 0xae, 0xff, 0xc4, 0xb9, 0x7f, 0x57, 0xb6, 0x79, 0x38, 0x64, 0x8f, 0xf2, 0x6c, 0xf4, 0xb9, 0x7e, 0xdf, 0x17, 0xf8, 0xca, 0xb5, 0xe0, 0xb6, 0x98, 0xf5, 0x2b, 0x69, 0x95, 0xc5, 0x3e, 0x9f, 0xe1, 0xfb, 0x72, 0x71, 0xdb, 0x52, 0xd6, 0xf0, 0x77, 0x71, 0xe5, 0x2c, 0xec, 0x11, 0x3c, 0xe9, 0x97, 0xb9, 0xf9, 0x26, 0x1a, 0xe7, 0xa9, 0xc6, 0x6e, 0x3d, 0xef, 0xa9, 0x95, 0x4e, 0x71, 0x50, 0x53, 0xab, 0x1b, 0x70, 0xfe, 0x6d, 0x5f, 0xb0, 0x99, 0x9d, 0xbf, 0x90, 0x37, 0x8b, 0x9f, 0xa3, 0x62, 0x48, 0x82, 0x97, 0x82, 0x3c, 0xa, 0x3c, 0xee, 0x68, 0x25, 0x85, 0xad, 0xfd, 0x5d, 0xad, 0x3f, 0x4, 0x9e, 0x25, 0x90, 0x34, 0x4e, 0xea, 0x45, 0x3a, 0xd, 0xd7, 0xad, 0xbf, 0xeb, 0xe2, 0xe7, 0xda, 0x2b, 0xaf, 0xaa, 0x7b, 0x80, 0x81, 0x93, 0xee, 0x38, 0xd8, 0xcd, 0xec, 0xfc, 0xbe, 0x2, 0xa3, 0x95, 0xef, 0x58, 0xc5, 0x90, 0xff, 0x4e, 0xce, 0x98, 0x27, 0x8, 0x26, 0x4f, 0x64, 0x8f, 0xf8, 0x7e, 0xb7, 0x5f, 0xcd, 0x5c, 0x5d, 0x12, 0xf3, 0x7b, 0xd5, 0xb0, 0x5e, 0xa9, 0x6f, 0x8a, 0x1c, 0xc7, 0x2b, 0xae, 0x47, 0xe1, 0x77, 0xde, 0x9d, 0x71, 0xee, 0x69, 0x4f, 0xe2, 0x3, 0x55, 0x5a, 0x2, 0x7, 0x4c, 0x9a, 0xd7, 0x60, 0x6d, 0xf6, 0x5a, 0x59, 0xfb, 0x69, 0x7f, 0xf2, 0xc6, 0x9b, 0x5d, 0x2f, 0x12, 0xdf, 0x73, 0xcf, 0x45, 0xe3, 0xbb, 0x37, 0xe7, 0x91, 0x73, 0xac, 0xa9, 0x1c, 0x2a, 0xfc, 0x46, 0x2a, 0xe8, 0x9f, 0x15, 0xfc, 0x13, 0x50, 0xe0, 0x3e, 0x20, 0x95, 0x49, 0xa8, 0xd4, 0xc4, 0x12, 0x8b, 0x7e, 0x2b, 0xad, 0x7, 0x8b, 0x5f, 0x30, 0x5e, 0x8e, 0x4c, 0x10, 0x2a, 0x66, 0x80, 0x81, 0x17, 0xce, 0x77, 0x20, 0x3b, 0xda, 0x66, 0x5b, 0xae, 0xcd, 0x9b, 0xc1, 0xc3, 0x53, 0x76, 0x9d, 0x7b, 0x29, 0x34, 0x43, 0xe7, 0xdf, 0xfb, 0x73, 0xed, 0x1e, 0x81, 0x25, 0xd0, 0x37, 0x34, 0xe4, 0xae, 0xe0, 0x1d, 0xa3, 0x6d, 0x73, 0xf2, 0xd3, 0xca, 0xdd, 0xb7, 0xff, 0xe5, 0x33, 0xa9, 0xdc, 0x2f, 0xc, 0x98, 0x74, 0xc7, 0xf1, 0xed, 0xc9, 0x0, 0x15, 0xb7, 0xbf, 0x41, 0x17, 0xce, 0xef, 0x93, 0x6d, 0xd9, 0xf9, 0x0, 0xac, 0x3b, 0xd2, 0xeb, 0xc0, 0xe3, 0x54, 0xb7, 0x4a, 0x8a, 0x50, 0x4a, 0x65, 0x2, 0x4a, 0xb, 0x5c, 0x39, 0xc8, 0x77, 0xa2, 0xa, 0xd4, 0xa7, 0x82, 0xb4, 0x3e, 0x0, 0xf9, 0x3e, 0x80, 0x6d, 0x0, 0x76, 0x92, 0xdc, 0x5, 0xd2, 0x42, 0x8, 0xe4, 0x91, 0x14, 0x80, 0x26, 0x9, 0xdd, 0x20, 0xbb, 0xf, 0xa0, 0x5e, 0x90, 0x6f, 0x2a, 0x67, 0x4c, 0x1e, 0x35, 0x6b, 0x2e, 0x11, 0xf5, 0x93, 0xe7, 0x13, 0x0, 0xc2, 0x42, 0x32, 0x34, 0xce, 0x93, 0x26, 0xd5, 0x78, 0xd9, 0xba, 0x85, 0x17, 0xbd, 0x5a, 0x5b, 0x5e, 0xa5, 0x4b, 0xd0, 0x26, 0x18, 0x7c, 0xc5, 0x33, 0xcc, 0x7e, 0xf8, 0xea, 0x19, 0x36, 0xb3, 0xf3, 0x21, 0x0, 0x16, 0x81, 0x12, 0x1f, 0xae, 0x8a, 0xe2, 0x13, 0x2d, 0x18, 0xf2, 0x22, 0x4, 0xe7, 0x3c, 0xef, 0x7, 0xe6, 0xaf, 0xfc, 0x87, 0xad, 0xc8, 0xee, 0x8b, 0x1d, 0xa, 0xd6, 0x8a, 0x84, 0xe6, 0x66, 0xfd, 0x98, 0x2d, 0x34, 0xce, 0x3f, 0x24, 0xbc, 0x4d, 0x9a, 0x4d, 0x30, 0x66, 0x1d, 0xc0, 0x97, 0x48, 0xfe, 0x15, 0xe0, 0x3b, 0x20, 0xdf, 0x23, 0xd4, 0xec, 0x5a, 0x65, 0xd2, 0xe9, 0x86, 0x46, 0xeb, 0x66, 0xba, 0x1, 0xd8, 0xd7, 0x5a, 0xdb, 0x7, 0xd2, 0x0, 0xc9, 0x8e, 0x24, 0x74, 0xb0, 0xa4, 0x8f, 0x1, 0x3a, 0x0, 0xb2, 0xfb, 0x86, 0xab, 0xc2, 0x90, 0xcf, 0x7a, 0x1, 0x33, 0xa8, 0x75, 0x7d, 0xa, 0xe4, 0xfd, 0x8, 0x33, 0x40, 0x41, 0x13, 0xa, 0x3b, 0xc6, 0x7a, 0x35, 0xb2, 0x74, 0x1a, 0xe6, 0x34, 0xef, 0xdc, 0x7e, 0xd5, 0x5f, 0x1e, 0xb8, 0x3a, 0xf1, 0x15, 0x48, 0x15, 0x9, 0x81, 0xee, 0x96, 0xbf, 0xd, 0x92, 0xdb, 0xf2, 0x7d, 0x80, 0xa0, 0x6f, 0xb0, 0xf7, 0xb0, 0x9f, 0x9b, 0xb7, 0x40, 0xde, 0x23, 0xab, 0x88, 0x82, 0xb9, 0xa7, 0xd0, 0xff, 0x1c, 0xc5, 0x43, 0x2c, 0xc3, 0xa8, 0xc6, 0xdb, 0x2a, 0x2c, 0xb0, 0x93, 0x4, 0x62, 0x86, 0xfc, 0x29, 0x78, 0x80, 0x7c, 0xf, 0x30, 0x9b, 0x4, 0xb3, 0x96, 0x4e, 0x6a, 0x71, 0x3a, 0xd5, 0xf0, 0xe0, 0xea, 0x3b, 0x27, 0x95, 0x33, 0xa0, 0xb4, 0x0, 0xd8, 0xa, 0xe0, 0x2d, 0x0, 0x1b, 0x1, 0x3c, 0x15, 0xbc, 0x18, 0x30, 0xe9, 0xce, 0x7e, 0xb2, 0x99, 0x89, 0x80, 0x8e, 0x83, 0xec, 0xa1, 0x92, 0x3d, 0x8, 0x42, 0x63, 0xa0, 0xc1, 0x7a, 0x79, 0x2a, 0x50, 0x79, 0x42, 0x66, 0xcc, 0xbc, 0xab, 0x40, 0x58, 0xd, 0xca, 0xd7, 0x3b, 0xa8, 0x17, 0xfc, 0x70, 0xbf, 0x4a, 0xfe, 0xa, 0x88, 0xc0, 0x30, 0x26, 0xc1, 0x48, 0xee, 0x99, 0x4d, 0xdd, 0xf7, 0x5a, 0xe, 0xe0, 0xf6, 0xa4, 0x19, 0xa0, 0xa2, 0x1e, 0x60, 0xe0, 0x5, 0x77, 0x9e, 0xea, 0x66, 0x76, 0x3e, 0x26, 0xc9, 0x84, 0xb1, 0xdf, 0x91, 0x10, 0xb2, 0x15, 0xcb, 0xd7, 0x32, 0x7c, 0xe, 0xe0, 0xfb, 0x24, 0xdf, 0xa2, 0x49, 0xdd, 0x6c, 0x1c, 0x67, 0xf6, 0xda, 0x5, 0x53, 0xda, 0xbc, 0x48, 0xa4, 0xad, 0x30, 0x60, 0xd2, 0xbc, 0x43, 0x21, 0xf7, 0xbb, 0x92, 0x1d, 0x29, 0xeb, 0x7e, 0x2, 0x52, 0x93, 0xbf, 0x4c, 0x2d, 0xd4, 0x10, 0x12, 0xad, 0x6b, 0xde, 0xa7, 0x91, 0xce, 0x12, 0xa6, 0xf6, 0x38, 0x75, 0xfd, 0xc2, 0xb, 0x9a, 0x93, 0xcc, 0xa3, 0x32, 0x6, 0x98, 0x7c, 0x57, 0xa3, 0xcd, 0x36, 0x9f, 0x23, 0xb7, 0xe5, 0x4e, 0x40, 0x4e, 0xe0, 0x80, 0xd9, 0x51, 0xf6, 0xfb, 0x80, 0xf8, 0x61, 0x84, 0x4b, 0xd8, 0x49, 0x60, 0x87, 0x49, 0x37, 0x7e, 0x7b, 0xdd, 0xc2, 0x8b, 0x6e, 0x6c, 0xf7, 0x42, 0x0, 0x18, 0x30, 0xf9, 0xee, 0x94, 0x32, 0xdb, 0xe7, 0xca, 0xba, 0xa7, 0x1, 0xda, 0x3f, 0xb7, 0x78, 0x25, 0xef, 0x26, 0x98, 0x38, 0x42, 0x24, 0xb9, 0x34, 0xa9, 0x7b, 0x36, 0xdc, 0x3d, 0xf5, 0x82, 0x24, 0xd3, 0xad, 0x5c, 0x8, 0x9c, 0xbc, 0x70, 0xf, 0xeb, 0x66, 0x2f, 0xb3, 0xd9, 0xe6, 0x19, 0xf0, 0xc7, 0x5b, 0x4f, 0x14, 0xc8, 0x69, 0x57, 0x25, 0xd2, 0x2c, 0x67, 0x15, 0xb, 0xc7, 0x29, 0xf2, 0xe5, 0xf7, 0xa7, 0x46, 0xe1, 0x59, 0x19, 0xe1, 0x79, 0xd2, 0x3a, 0x5b, 0x61, 0x9c, 0xdb, 0x68, 0x52, 0x5f, 0x5f, 0xbf, 0x70, 0x72, 0x87, 0xb9, 0x52, 0x7, 0x30, 0x70, 0xf2, 0xcf, 0xbb, 0xb9, 0x2d, 0xdb, 0x97, 0x41, 0xb6, 0x2f, 0xc0, 0x3d, 0x2, 0xe7, 0x64, 0x32, 0xf0, 0x48, 0xe, 0x44, 0xa4, 0x52, 0xe, 0xe6, 0xc5, 0x78, 0x88, 0x14, 0x72, 0x25, 0x89, 0xa0, 0x59, 0xed, 0xa4, 0x1a, 0x3f, 0xb7, 0x6e, 0xe1, 0x94, 0xb7, 0xc2, 0x2f, 0x47, 0x5e, 0xb3, 0x94, 0x3b, 0xdf, 0x7b, 0xc5, 0xd0, 0x69, 0xa0, 0xcd, 0x6c, 0x27, 0x4d, 0x9a, 0x0, 0xdd, 0x75, 0xb, 0x2e, 0x70, 0xcb, 0xd5, 0xa1, 0x2a, 0x2e, 0x1d, 0x34, 0xf9, 0xe7, 0x7b, 0x58, 0xb7, 0xe5, 0xdb, 0x36, 0xdb, 0xf2, 0x75, 0x2, 0x26, 0x34, 0xf0, 0x33, 0x69, 0x57, 0xae, 0x70, 0x97, 0xf, 0x8f, 0xf8, 0x2, 0x0, 0x63, 0xcc, 0x66, 0xa6, 0x1a, 0xc7, 0xae, 0x5b, 0x30, 0x39, 0x51, 0x7, 0x89, 0x6a, 0x60, 0xc0, 0xa4, 0x79, 0xd7, 0xd9, 0x6c, 0xf3, 0x37, 0x0, 0xed, 0xcb, 0xb0, 0x47, 0x50, 0x72, 0x26, 0xab, 0x80, 0xe9, 0x41, 0x93, 0x7a, 0x7e, 0xc3, 0xdd, 0x53, 0x8f, 0x1f, 0x34, 0xe5, 0xee, 0x46, 0x9b, 0x6d, 0xa6, 0x71, 0x1a, 0x9a, 0x24, 0xb7, 0x2f, 0xa4, 0x8f, 0x9, 0xea, 0x49, 0xa0, 0x87, 0xa4, 0x3, 0x69, 0x9c, 0x17, 0x20, 0xf7, 0xf9, 0x75, 0xb, 0x2f, 0xca, 0x94, 0x4a, 0xbc, 0xea, 0xc2, 0xd, 0xbc, 0x70, 0x61, 0x83, 0x6c, 0xf6, 0xdf, 0xe5, 0xb6, 0x7c, 0x13, 0x64, 0xb0, 0x20, 0x23, 0xbf, 0xd8, 0x22, 0x49, 0x8, 0x98, 0x4a, 0x82, 0xa4, 0xac, 0x71, 0x52, 0xcf, 0x3b, 0xd, 0xdd, 0xce, 0x5e, 0x33, 0xef, 0xbc, 0xf, 0x92, 0xcf, 0xac, 0x5a, 0x7c, 0x2c, 0x18, 0x63, 0xb3, 0xbb, 0xe6, 0xc9, 0xda, 0x83, 0x3d, 0x43, 0x17, 0x3, 0x49, 0xbe, 0xf6, 0x6, 0x91, 0x5f, 0xdc, 0x2, 0x1, 0xbb, 0x48, 0xf3, 0x1a, 0xa4, 0xde, 0x80, 0x7a, 0x2, 0x28, 0xd2, 0x81, 0x82, 0x7b, 0xae, 0x34, 0xa9, 0xc6, 0xeb, 0xd6, 0x2d, 0x9c, 0xfc, 0x54, 0xa9, 0xa4, 0xab, 0xf6, 0x9, 0x5c, 0xb7, 0xe0, 0x82, 0x16, 0xa7, 0xb1, 0xfb, 0x7f, 0x99, 0x54, 0xe3, 0x75, 0x4, 0xb2, 0x8, 0x69, 0x33, 0x89, 0x9b, 0x45, 0x7c, 0x24, 0x90, 0xcc, 0x1a, 0x27, 0xfd, 0xf0, 0xfa, 0xbb, 0x2e, 0x19, 0x53, 0x4f, 0xc4, 0xf7, 0xf0, 0x71, 0xe1, 0xd3, 0x26, 0xd5, 0x78, 0xa, 0xe9, 0x6c, 0x40, 0x41, 0xd9, 0x6b, 0x77, 0x6d, 0x43, 0xe1, 0x6f, 0x23, 0x64, 0xf, 0x3, 0xb4, 0x17, 0x8a, 0xde, 0x15, 0xde, 0x6b, 0x88, 0xa0, 0x7f, 0x29, 0x57, 0xee, 0x9a, 0x9c, 0x42, 0xd7, 0xdc, 0x3e, 0x3e, 0xeb, 0x34, 0x74, 0x9f, 0x69, 0x52, 0x4d, 0x53, 0x4, 0xbe, 0xdf, 0x76, 0x8b, 0x60, 0x18, 0x4a, 0x85, 0x31, 0xc7, 0xd6, 0x5e, 0xbf, 0x9f, 0x7a, 0x72, 0xfd, 0x5d, 0x17, 0x9f, 0x95, 0x18, 0xd5, 0x12, 0x86, 0x75, 0xb, 0x26, 0xff, 0xc9, 0x34, 0x34, 0x9d, 0x49, 0xe3, 0x2c, 0xf7, 0x2d, 0x8e, 0xfe, 0xf0, 0x15, 0x26, 0x63, 0x31, 0x59, 0x4b, 0x85, 0x79, 0xcf, 0x7e, 0x7, 0x2b, 0xd2, 0xc8, 0xf3, 0x31, 0xd, 0x2e, 0x8a, 0x34, 0xc1, 0xd4, 0x51, 0x51, 0x47, 0x6c, 0xc, 0x81, 0x4f, 0x7e, 0xea, 0xc2, 0x87, 0x4a, 0xf6, 0x3e, 0x35, 0x7b, 0x5, 0xaf, 0xbe, 0xfd, 0x9c, 0x2c, 0x53, 0xd, 0xf7, 0x93, 0xdc, 0x51, 0x64, 0xa, 0x29, 0x1, 0x51, 0xcc, 0x50, 0x18, 0x26, 0xbf, 0x1f, 0x83, 0xe7, 0x2b, 0x0, 0xe3, 0xa4, 0x9f, 0x6c, 0x49, 0xf7, 0x3a, 0xbd, 0xdd, 0xa8, 0x97, 0x10, 0xac, 0x9b, 0x7f, 0xc1, 0x2b, 0x26, 0xd5, 0x38, 0x85, 0xc6, 0x59, 0x82, 0xfc, 0xec, 0x28, 0xa2, 0x99, 0x1c, 0x65, 0xc2, 0xf2, 0xcf, 0xcc, 0xdb, 0xa9, 0xc3, 0xef, 0x99, 0x7f, 0x95, 0x8b, 0x27, 0x4f, 0x39, 0x12, 0xac, 0xcd, 0x9e, 0xd7, 0x9d, 0x1f, 0x4e, 0x2c, 0x55, 0xde, 0x44, 0xdc, 0xc2, 0x6d, 0x36, 0xd3, 0xf, 0x40, 0xda, 0xa3, 0x17, 0x13, 0x71, 0xe7, 0x26, 0xd, 0x5, 0x58, 0x6f, 0x4a, 0x3c, 0xfd, 0xa8, 0x93, 0x6e, 0x1a, 0xff, 0xf2, 0xbc, 0xd3, 0x77, 0x8b, 0xcd, 0x98, 0xd6, 0xce, 0xbf, 0x60, 0x23, 0x4c, 0x6a, 0x16, 0xe9, 0xbc, 0xec, 0x4d, 0x31, 0x18, 0xc9, 0x53, 0x97, 0x6a, 0xc6, 0x4b, 0x1b, 0x2e, 0x6, 0xb3, 0x6d, 0x90, 0xfa, 0xca, 0xaa, 0x7f, 0xfb, 0x33, 0x80, 0x9b, 0x99, 0x1, 0x70, 0xdf, 0x9a, 0x13, 0x2a, 0x4, 0x1, 0x34, 0x34, 0xce, 0x5a, 0x9a, 0xf4, 0xd, 0x6b, 0xe6, 0x9d, 0xf7, 0x61, 0x7b, 0x11, 0xac, 0x3d, 0x60, 0xfd, 0xc2, 0xc9, 0xf7, 0xc0, 0xa4, 0x6e, 0x7, 0xb9, 0xcd, 0xb7, 0x57, 0x75, 0x98, 0xd1, 0x2c, 0xbc, 0x48, 0x56, 0x50, 0x8f, 0x52, 0x71, 0x6b, 0x66, 0x80, 0x23, 0xa7, 0xdc, 0xb5, 0x17, 0x60, 0x87, 0x92, 0x48, 0xe5, 0xf5, 0xde, 0x44, 0xc4, 0x1e, 0x92, 0xdc, 0x42, 0x93, 0x5a, 0xb0, 0x76, 0xfe, 0xa4, 0xc7, 0x3a, 0xa, 0x79, 0x49, 0x82, 0x31, 0xce, 0x2c, 0x9a, 0xd4, 0xbd, 0xbe, 0x8d, 0x3a, 0x98, 0x25, 0x69, 0xf7, 0x19, 0xc5, 0x80, 0xf8, 0xbe, 0xf6, 0x7c, 0xe4, 0xc0, 0xc9, 0xb, 0x87, 0xc4, 0x96, 0xb1, 0x96, 0xa, 0x1e, 0x7d, 0xed, 0xef, 0x8, 0x72, 0x38, 0x80, 0xb4, 0x97, 0xa1, 0xd7, 0xcd, 0xd5, 0xd2, 0x83, 0xf9, 0x5, 0xf7, 0x2a, 0xe0, 0xa4, 0x1e, 0x0, 0x4d, 0xe2, 0xf6, 0xef, 0x8e, 0x82, 0xb5, 0xf3, 0x27, 0x6d, 0x31, 0x4e, 0xfa, 0x36, 0x18, 0x67, 0x29, 0xfc, 0x3e, 0xd9, 0x9f, 0xe9, 0xab, 0xc, 0x27, 0x11, 0xf7, 0x88, 0x9, 0xf7, 0x47, 0x1, 0xff, 0x3f, 0x1, 0x6b, 0x4f, 0x80, 0x74, 0x76, 0x5c, 0x19, 0x6b, 0x62, 0x80, 0x6d, 0xff, 0xd8, 0x48, 0xeb, 0x66, 0xcf, 0x25, 0x4d, 0xca, 0x2f, 0x51, 0xcd, 0xeb, 0x79, 0x7c, 0x75, 0x9f, 0xa0, 0x79, 0x15, 0x30, 0xf7, 0xaf, 0x9b, 0x3f, 0xa9, 0xa2, 0xdd, 0xbf, 0xea, 0xd, 0xd6, 0xde, 0x79, 0xfe, 0xb, 0x34, 0xa9, 0xc5, 0x0, 0x0, 0x1a, 0x11, 0xac, 0x58, 0x31, 0x64, 0xc4, 0x3d, 0x63, 0xc2, 0x8b, 0xf0, 0x28, 0x92, 0xd, 0x24, 0xfa, 0xc6, 0x95, 0xaf, 0x26, 0x6, 0x58, 0x7f, 0xd7, 0xc5, 0x56, 0x6e, 0x76, 0x2c, 0xa0, 0x34, 0x69, 0xc2, 0x5b, 0xaf, 0x54, 0x7e, 0x91, 0x81, 0xe4, 0xef, 0xf5, 0x22, 0xc6, 0x59, 0x44, 0x63, 0x1e, 0xef, 0x6c, 0x2, 0x26, 0x1, 0xa4, 0x59, 0x4c, 0x93, 0x7a, 0x12, 0xfe, 0x7e, 0x46, 0x28, 0x35, 0xc, 0xb0, 0xb6, 0x6, 0x54, 0x98, 0x16, 0x82, 0x6e, 0xb5, 0xf1, 0xd3, 0xe3, 0xe7, 0x46, 0xd2, 0xba, 0x26, 0x6, 0x18, 0x74, 0xd1, 0x3d, 0x7d, 0x41, 0xf4, 0xf6, 0xc4, 0x76, 0x28, 0xa7, 0xf2, 0x56, 0x39, 0xec, 0xfb, 0x92, 0x3f, 0x49, 0xf3, 0x16, 0x8d, 0xf3, 0xd4, 0xda, 0x3b, 0xcf, 0xdf, 0xde, 0xd9, 0xc4, 0x4b, 0x2, 0xd6, 0xde, 0x79, 0xfe, 0x5a, 0x3a, 0xa9, 0xf9, 0x5e, 0x25, 0x73, 0xe, 0x1f, 0x25, 0xc4, 0x9f, 0xda, 0x2f, 0xcf, 0xaf, 0xc4, 0x50, 0x9e, 0xf5, 0xb4, 0x67, 0x63, 0xb7, 0x1e, 0x7, 0x46, 0x95, 0xad, 0x6a, 0x6, 0x18, 0x7c, 0xc9, 0xfd, 0x29, 0x59, 0x3b, 0xa, 0xa0, 0x4d, 0xa2, 0xe4, 0x81, 0x1, 0x3, 0x20, 0x68, 0x9c, 0xf9, 0x34, 0xce, 0x8a, 0xce, 0x26, 0x5c, 0xa2, 0x40, 0xf3, 0x57, 0xd2, 0xbc, 0x8b, 0x76, 0x76, 0x9f, 0xb, 0x5c, 0xe2, 0xfc, 0x1d, 0x67, 0xe0, 0x73, 0xc3, 0xc1, 0x10, 0x3e, 0x1d, 0x55, 0xac, 0xaa, 0x19, 0x60, 0xf5, 0x6d, 0x67, 0x67, 0x9, 0x7d, 0x26, 0x34, 0xd3, 0x55, 0x93, 0x9a, 0xc3, 0xdc, 0x46, 0x4e, 0x0, 0x4d, 0x6a, 0xd9, 0x9a, 0x3b, 0x26, 0xee, 0xd6, 0x63, 0x7f, 0x31, 0x18, 0x63, 0xd6, 0x9b, 0x54, 0xc3, 0x6c, 0xff, 0x51, 0x91, 0x5b, 0x91, 0xd7, 0x0, 0x85, 0x3e, 0x9, 0x9e, 0x22, 0xe8, 0xd, 0xa5, 0xe6, 0x15, 0x3a, 0xa9, 0xfb, 0x49, 0xf3, 0x46, 0xd4, 0x77, 0x6d, 0xf6, 0x8, 0x1a, 0x74, 0xd1, 0xdd, 0x4d, 0xa4, 0xb3, 0xbf, 0xac, 0xed, 0x2b, 0xe8, 0x40, 0x2, 0x7b, 0x43, 0xee, 0x98, 0xdc, 0x86, 0x8d, 0xc9, 0xa8, 0xb9, 0x24, 0xb9, 0x9, 0xe0, 0xa6, 0x24, 0x91, 0x53, 0xf, 0xb0, 0xfa, 0xf6, 0x9, 0x9b, 0x7, 0x7f, 0x71, 0xd1, 0x43, 0x0, 0xfe, 0x3, 0x0, 0x61, 0x12, 0x30, 0xc1, 0x84, 0x26, 0x80, 0x48, 0x12, 0xb2, 0xca, 0xeb, 0x1, 0x7c, 0x97, 0xc6, 0x79, 0x96, 0x74, 0x16, 0x64, 0x65, 0x16, 0x6f, 0xb8, 0x73, 0x42, 0x36, 0x2a, 0x89, 0x58, 0x6, 0x18, 0x74, 0xd1, 0xbd, 0x3d, 0x21, 0x1d, 0xe, 0xe8, 0x40, 0x90, 0x7b, 0x41, 0xea, 0x25, 0x65, 0x8f, 0x90, 0x75, 0x8f, 0x83, 0xf4, 0xe9, 0x60, 0xe1, 0x7a, 0x68, 0x51, 0x67, 0xad, 0x1e, 0x31, 0x9e, 0x3b, 0x21, 0x53, 0x33, 0x4, 0xac, 0x69, 0x2f, 0x42, 0x74, 0x26, 0x8, 0xb0, 0xa0, 0x79, 0x1f, 0xd2, 0x3e, 0x9, 0x35, 0x97, 0xc0, 0x21, 0xc7, 0x73, 0x8e, 0x1, 0x29, 0x70, 0x33, 0xc9, 0x55, 0x34, 0xa9, 0x87, 0x8c, 0x93, 0x9a, 0xbf, 0xfa, 0xf6, 0xf1, 0x9b, 0x4b, 0x25, 0x11, 0xc9, 0x0, 0x83, 0xbf, 0xb8, 0x68, 0x7f, 0x2b, 0xf7, 0x7c, 0x59, 0x77, 0x3a, 0x64, 0xf, 0x2f, 0xcc, 0x33, 0xa7, 0xb0, 0x7b, 0x4e, 0xa, 0xf0, 0xf9, 0xad, 0xb6, 0x1e, 0x20, 0x67, 0x2c, 0x37, 0x8e, 0xf3, 0xfc, 0x9a, 0x3b, 0x26, 0x6e, 0x4b, 0x8, 0xe7, 0x75, 0x5, 0x92, 0xb6, 0x3, 0xf8, 0x33, 0x80, 0x91, 0x40, 0xa2, 0xdb, 0xd7, 0x51, 0xe0, 0x3f, 0xe8, 0x38, 0xaf, 0x11, 0xe6, 0x41, 0x90, 0x3f, 0x5d, 0x3b, 0xef, 0xdc, 0x36, 0x9, 0xd0, 0x31, 0x3d, 0x80, 0xc6, 0xcb, 0x75, 0xbf, 0x5, 0xe8, 0x63, 0x60, 0xd8, 0xf1, 0xb3, 0xc0, 0x41, 0x23, 0x34, 0x3f, 0xd1, 0x26, 0xb7, 0xed, 0x92, 0x15, 0xc8, 0xff, 0x7c, 0x74, 0xd7, 0x86, 0x93, 0x7c, 0x1b, 0x26, 0xf5, 0x88, 0x6c, 0x76, 0x24, 0x22, 0x5d, 0xca, 0x83, 0xa0, 0x72, 0x4b, 0x90, 0x82, 0x77, 0xca, 0xe1, 0x8d, 0x4e, 0xfa, 0x47, 0xae, 0xab, 0x19, 0x1b, 0x16, 0x9c, 0x57, 0xd6, 0xb, 0x28, 0xc, 0x91, 0x3, 0x91, 0x80, 0x5e, 0x0, 0x1a, 0xbc, 0x42, 0x7b, 0x53, 0x8f, 0x79, 0xe9, 0xd2, 0x14, 0x49, 0xb1, 0x40, 0xe9, 0xe7, 0x8a, 0x6c, 0x1, 0xbb, 0x4, 0x54, 0x54, 0x81, 0xdd, 0x9, 0xd6, 0xdc, 0x31, 0xe1, 0x7d, 0x1a, 0xe7, 0x49, 0x1f, 0x47, 0x11, 0xb6, 0x80, 0x0, 0x8a, 0x9f, 0x11, 0xf3, 0x2e, 0xf7, 0xed, 0x7, 0x80, 0xb9, 0xad, 0x52, 0xe2, 0x3, 0x31, 0x3d, 0x80, 0x64, 0xf, 0x0, 0xb0, 0x97, 0x37, 0xbf, 0xac, 0xfc, 0xc6, 0x36, 0xde, 0x5b, 0x54, 0xd6, 0x73, 0xb5, 0x69, 0x95, 0x6c, 0xb0, 0x2e, 0xe7, 0x1d, 0x82, 0x1d, 0xee, 0xdb, 0xd7, 0x91, 0x40, 0xf2, 0x3d, 0x1f, 0xaf, 0x3e, 0x46, 0x8b, 0x5b, 0x7d, 0x2e, 0x66, 0x4c, 0xa, 0xa1, 0xb5, 0x29, 0xc1, 0xa2, 0x8, 0xc3, 0xb4, 0xe3, 0x38, 0x4d, 0xd5, 0x94, 0x27, 0x7a, 0x8, 0x10, 0x7a, 0xe6, 0xed, 0xcb, 0xc5, 0x63, 0x55, 0xa5, 0x3d, 0x74, 0xb9, 0xf8, 0x61, 0x2c, 0xf0, 0x75, 0x10, 0x89, 0xbb, 0x73, 0xd7, 0x15, 0xd0, 0x8, 0x84, 0x65, 0x68, 0x51, 0x4d, 0x8, 0xf, 0x6d, 0x49, 0x20, 0x7f, 0x97, 0x1f, 0x2d, 0x53, 0x81, 0x3c, 0x56, 0x29, 0x44, 0x32, 0x0, 0x8d, 0x69, 0x90, 0x6b, 0xbd, 0x1d, 0x2c, 0x3b, 0x60, 0x1a, 0x33, 0xe7, 0xf2, 0x47, 0xf3, 0x6, 0xc0, 0x8f, 0x34, 0x3, 0x10, 0x70, 0x9, 0xbe, 0x2f, 0x69, 0xbf, 0x4, 0x51, 0x9b, 0xaa, 0x56, 0x9c, 0x4c, 0x68, 0x9f, 0xc0, 0x72, 0xe3, 0x15, 0x4b, 0xbe, 0xf3, 0x1a, 0x3, 0x41, 0xf2, 0x4d, 0x48, 0x1f, 0x69, 0x6, 0x10, 0xe0, 0xa, 0xfc, 0xb0, 0xd0, 0xc1, 0x27, 0x6a, 0xfc, 0x8f, 0xc3, 0x1d, 0xc3, 0x69, 0xe5, 0xce, 0x2f, 0xaa, 0xd6, 0x1b, 0x37, 0x46, 0xb, 0xc8, 0xa9, 0x7a, 0x68, 0xd5, 0xfb, 0xc7, 0xa, 0xf8, 0x8c, 0x7e, 0x9f, 0xb, 0x63, 0xc9, 0xef, 0xe5, 0x2f, 0xa2, 0xfb, 0xe8, 0xea, 0x0, 0x7e, 0x3d, 0x73, 0xf5, 0x67, 0xcc, 0x6f, 0x14, 0xc4, 0x31, 0x41, 0x58, 0xbe, 0xaa, 0xe, 0x71, 0xd1, 0x43, 0x0, 0x0, 0x5, 0xd4, 0x8a, 0xcc, 0x3b, 0x1c, 0xa8, 0x88, 0xf7, 0x25, 0xca, 0xcf, 0xf0, 0x4d, 0x78, 0x55, 0x2c, 0x1, 0xe0, 0x0, 0xd0, 0x54, 0x25, 0xcc, 0xec, 0x2e, 0x40, 0xd2, 0x11, 0xb0, 0x77, 0x69, 0x7a, 0x85, 0x9, 0x1c, 0x77, 0xf, 0xd0, 0x3f, 0x5b, 0x43, 0x82, 0x6b, 0xad, 0xad, 0xca, 0xb4, 0x1c, 0xad, 0x5, 0x0, 0x2d, 0x79, 0xcb, 0x5e, 0x39, 0x83, 0x45, 0x2d, 0x4d, 0xb6, 0x90, 0x91, 0x8, 0xf4, 0x21, 0xf9, 0x91, 0x67, 0x0, 0x92, 0xfb, 0xb4, 0x6d, 0xb9, 0x0, 0xdb, 0x78, 0xaf, 0x6c, 0xb5, 0x64, 0x88, 0x1e, 0x2, 0xc8, 0xf, 0x19, 0xd8, 0xaa, 0xb, 0x8e, 0xef, 0x8, 0xfa, 0xe8, 0xfc, 0x26, 0x56, 0x5e, 0x9c, 0x10, 0x8f, 0x94, 0xdd, 0x46, 0xa5, 0x88, 0x9f, 0x7c, 0x63, 0xa6, 0x9f, 0xcf, 0x81, 0x0, 0x1a, 0x13, 0xc1, 0x74, 0xdd, 0x82, 0xf2, 0x7b, 0xa9, 0x28, 0x68, 0x5f, 0xc5, 0x50, 0xac, 0x71, 0x17, 0xf5, 0x94, 0x2c, 0x5a, 0x73, 0xe, 0x66, 0x43, 0x1b, 0x74, 0x55, 0x4, 0x91, 0x42, 0x20, 0x61, 0xde, 0x20, 0xb8, 0x85, 0xe1, 0x15, 0x27, 0x40, 0x91, 0x5c, 0x10, 0xb2, 0x7, 0x15, 0xcb, 0x9, 0xa5, 0x64, 0xc2, 0xe2, 0x97, 0x21, 0x9b, 0xa2, 0xa4, 0x8f, 0xeb, 0x23, 0xcf, 0x0, 0xec, 0x5, 0x20, 0xd8, 0x53, 0x0, 0x28, 0x25, 0xf4, 0x15, 0xc, 0x97, 0x21, 0x9c, 0x7, 0x32, 0x9a, 0x2f, 0x48, 0x12, 0xcc, 0x0, 0xa8, 0xea, 0xd0, 0xa9, 0x18, 0x4b, 0xa0, 0xde, 0x2, 0xd9, 0x82, 0x60, 0xc1, 0x81, 0xc7, 0xb6, 0x8, 0x76, 0x44, 0x60, 0x3b, 0xfc, 0xf9, 0x5a, 0x40, 0x13, 0xeb, 0x68, 0x3, 0xeb, 0xa4, 0x61, 0xf0, 0xd4, 0x5f, 0xed, 0x6b, 0xad, 0x7b, 0x8a, 0x8f, 0x57, 0x26, 0x85, 0x3b, 0x49, 0x7b, 0x3, 0xfa, 0xe6, 0xe0, 0x8b, 0x7f, 0x51, 0xb1, 0x56, 0x17, 0xed, 0x26, 0xe4, 0xa4, 0x1e, 0x4, 0x9d, 0x6f, 0xd3, 0x38, 0xcf, 0x6, 0x3e, 0x5a, 0xde, 0xaf, 0xaf, 0xaf, 0x3, 0x40, 0xfe, 0x8, 0xc7, 0x3c, 0x37, 0x16, 0x34, 0xee, 0x98, 0x6e, 0x20, 0x1c, 0x3f, 0xb0, 0x68, 0x41, 0xa2, 0x31, 0x5, 0x61, 0x1f, 0x45, 0x20, 0x4d, 0x2f, 0x40, 0xa7, 0xe5, 0x10, 0x17, 0x65, 0xd5, 0xcd, 0xbd, 0x63, 0x99, 0x9e, 0x34, 0x7f, 0x43, 0x43, 0xc8, 0xba, 0x97, 0x3, 0x7c, 0x7a, 0xf0, 0x25, 0xf7, 0xfd, 0xf7, 0xe0, 0xa9, 0xf, 0xec, 0xdd, 0xe6, 0x32, 0xc5, 0xbd, 0x18, 0x3c, 0xf5, 0x57, 0xdd, 0x1, 0xf6, 0x85, 0xec, 0x41, 0x20, 0x7a, 0x43, 0x38, 0x4, 0xd0, 0x27, 0x25, 0x7b, 0x24, 0x81, 0x81, 0xf0, 0xe7, 0xa, 0x80, 0xf0, 0x36, 0xaf, 0x35, 0x51, 0xcf, 0x3f, 0xf, 0x32, 0xf5, 0x75, 0xe3, 0xa4, 0x6f, 0x5c, 0x75, 0xf3, 0xbf, 0xb6, 0xf9, 0x4, 0xae, 0xdd, 0x5, 0x86, 0x5c, 0xfa, 0xc0, 0x30, 0x9b, 0x6d, 0xf9, 0xd, 0x80, 0xbd, 0x93, 0x30, 0x2, 0x85, 0xf6, 0xc7, 0x9, 0x6f, 0xba, 0xb9, 0x85, 0x34, 0x2b, 0x5, 0x3e, 0x44, 0x63, 0xee, 0x5c, 0x7d, 0xeb, 0x59, 0x25, 0xf, 0x9f, 0x6a, 0x73, 0x29, 0x86, 0x5d, 0xfe, 0x70, 0xf, 0x6b, 0xdd, 0x7d, 0x65, 0xed, 0x1, 0x34, 0x66, 0x7f, 0x59, 0xdb, 0xb, 0x72, 0xaf, 0x96, 0x6c, 0xff, 0xd6, 0x66, 0xcd, 0x1a, 0x2a, 0x44, 0xbe, 0xe9, 0x38, 0xd, 0x13, 0x56, 0xdd, 0x32, 0xf6, 0x85, 0x24, 0xd2, 0xac, 0x27, 0x18, 0x3c, 0xf5, 0x57, 0x23, 0xe5, 0x66, 0x5e, 0xf4, 0x77, 0x15, 0x49, 0x62, 0x15, 0x7d, 0xab, 0xa3, 0x66, 0x82, 0xd3, 0xc7, 0x4, 0x6c, 0x26, 0xcd, 0xb, 0x34, 0xce, 0x42, 0xc7, 0x98, 0xfb, 0x56, 0xde, 0x3c, 0x36, 0x72, 0x99, 0x78, 0x9b, 0x3d, 0x82, 0x56, 0xce, 0x3d, 0x63, 0x2b, 0xbc, 0x7d, 0x74, 0x5e, 0xb, 0x55, 0x68, 0x20, 0x2d, 0xfa, 0x79, 0x25, 0x49, 0x64, 0xd3, 0x2c, 0x1, 0xe8, 0x63, 0xa5, 0x83, 0x6a, 0xc5, 0x4c, 0xbd, 0xc1, 0xd0, 0xcb, 0x16, 0xef, 0x67, 0x6d, 0x76, 0x9c, 0x3f, 0xcc, 0x55, 0x61, 0x62, 0x8f, 0xd4, 0xc6, 0xb, 0xf4, 0xe8, 0xd0, 0xbe, 0x8c, 0x22, 0xb0, 0x2f, 0xa0, 0x33, 0x61, 0xdd, 0xc1, 0x2e, 0x30, 0x74, 0xf0, 0xd4, 0x7, 0x17, 0xac, 0xbe, 0x75, 0xec, 0xba, 0xe2, 0x4, 0xaa, 0x6e, 0xb9, 0xc3, 0xa6, 0x3f, 0x96, 0x32, 0x34, 0xbf, 0xf7, 0x48, 0xef, 0x2f, 0x45, 0xaa, 0x68, 0xf6, 0x37, 0x34, 0xce, 0xf9, 0xaa, 0x65, 0xde, 0xb1, 0x44, 0x9f, 0x19, 0x7a, 0xd9, 0x83, 0xfb, 0x77, 0x14, 0x71, 0x3a, 0x6, 0x34, 0x0, 0xd6, 0x9d, 0xee, 0xf, 0x94, 0x2c, 0xa8, 0x7b, 0x9b, 0xfc, 0x44, 0x59, 0x6, 0x87, 0x41, 0xfb, 0xcb, 0x9d, 0x5b, 0x24, 0x6f, 0x22, 0x4f, 0x9f, 0x80, 0xec, 0x38, 0x52, 0x7d, 0xa2, 0x4a, 0x55, 0x35, 0x3, 0xac, 0x9c, 0xf3, 0xf9, 0xac, 0x80, 0x17, 0xe0, 0x9f, 0xa3, 0x5a, 0x9d, 0xdc, 0x9f, 0x2f, 0xb7, 0xa7, 0x6d, 0x4, 0x9a, 0x86, 0xbd, 0x40, 0xc2, 0x88, 0xce, 0x26, 0x59, 0x92, 0x20, 0xd9, 0x43, 0x1, 0xec, 0x7, 0x50, 0x85, 0xcb, 0x3b, 0xc2, 0x78, 0xa8, 0x1c, 0x87, 0x28, 0xfe, 0xb6, 0x50, 0xbb, 0xa0, 0xdf, 0xad, 0xbe, 0x4a, 0xe3, 0x6c, 0x8c, 0x2a, 0x57, 0x4d, 0x63, 0xf7, 0x1f, 0x6e, 0x19, 0xfb, 0x2a, 0x8d, 0x79, 0x33, 0x98, 0x32, 0x8e, 0x76, 0x74, 0x8d, 0x9a, 0xf4, 0x88, 0xb3, 0x6d, 0x53, 0x0, 0x5, 0xe9, 0xe3, 0xb2, 0xf6, 0xe4, 0x21, 0x97, 0x2d, 0xee, 0xd9, 0xb9, 0x64, 0x4b, 0x6, 0x6, 0x5f, 0xfa, 0xe0, 0x60, 0x59, 0x4d, 0xf6, 0x55, 0xdd, 0xdc, 0x36, 0x37, 0x49, 0x40, 0xac, 0xd7, 0x40, 0xce, 0x96, 0xf, 0x10, 0xdc, 0xd2, 0xd0, 0xfd, 0x63, 0xaf, 0x47, 0xc5, 0xab, 0x89, 0x1, 0x6, 0x5f, 0x72, 0x9f, 0x1, 0xcc, 0x3, 0x2, 0x32, 0x2, 0x90, 0x53, 0xe5, 0xa, 0x2e, 0x14, 0x75, 0x61, 0xc5, 0x5d, 0x5f, 0x41, 0x78, 0x9e, 0x71, 0xa1, 0xf1, 0xb2, 0xf6, 0xd4, 0xc4, 0xa9, 0xd1, 0x9, 0x40, 0xe0, 0xc, 0xc0, 0x8e, 0xf1, 0x1c, 0xab, 0x0, 0x76, 0xc0, 0x89, 0x68, 0x34, 0x39, 0x5f, 0x3e, 0x90, 0x66, 0x57, 0xf1, 0x9, 0xa6, 0x1, 0xd4, 0xc4, 0x0, 0xd, 0x3d, 0x7a, 0xb, 0x34, 0xf7, 0x4a, 0xc8, 0xfa, 0x54, 0x8c, 0x98, 0x19, 0x2a, 0x35, 0x25, 0x5c, 0x1c, 0xb7, 0x60, 0x37, 0xb0, 0x83, 0x49, 0x9d, 0x3d, 0xe4, 0xd2, 0x87, 0x7a, 0x77, 0x36, 0x1, 0x6b, 0x81, 0x21, 0x97, 0x3e, 0x74, 0x2, 0x64, 0xc7, 0xe6, 0x25, 0xff, 0xf0, 0xa, 0xea, 0xb6, 0xe0, 0xaa, 0x54, 0x58, 0xdc, 0xb7, 0x61, 0x13, 0x2d, 0x77, 0xd1, 0x98, 0x57, 0xe2, 0xca, 0x57, 0x13, 0x3, 0x2c, 0xfb, 0xe9, 0xb1, 0xa2, 0x71, 0x56, 0x80, 0x39, 0x37, 0x2e, 0x86, 0x57, 0xf8, 0xb4, 0x86, 0x52, 0x52, 0x8e, 0xf7, 0x3e, 0xef, 0x2e, 0x45, 0x48, 0x1a, 0x7, 0xe0, 0x92, 0x76, 0xa0, 0x4b, 0x87, 0xc0, 0xb0, 0x69, 0x8f, 0xf4, 0x4, 0xf4, 0x45, 0x49, 0x47, 0x7b, 0x92, 0xbf, 0x9, 0x26, 0x4f, 0x22, 0xf0, 0x11, 0x87, 0xab, 0x52, 0x61, 0xb1, 0xd, 0xcb, 0x77, 0x15, 0x20, 0x40, 0x2e, 0x91, 0x70, 0x7f, 0x5c, 0x19, 0x6b, 0xd6, 0xdf, 0x57, 0xcd, 0x3d, 0x7d, 0xab, 0x31, 0xce, 0x8b, 0x20, 0x4b, 0xc, 0x3, 0x95, 0x76, 0x5f, 0x26, 0x30, 0x3e, 0x76, 0x87, 0xec, 0x85, 0x43, 0x2e, 0x7d, 0x68, 0x6c, 0x47, 0x10, 0x2c, 0x69, 0x90, 0xb5, 0x57, 0x49, 0xf6, 0xdc, 0xd0, 0xce, 0x1d, 0x55, 0xe2, 0x4, 0x95, 0xc6, 0xb, 0xe5, 0x65, 0x56, 0xff, 0xe1, 0x96, 0x33, 0x63, 0xd7, 0x59, 0x24, 0x62, 0xc0, 0x31, 0x4e, 0xea, 0x1a, 0x0, 0x9b, 0xdb, 0xd2, 0xc9, 0xc7, 0x89, 0x7f, 0x45, 0xcf, 0x7e, 0x55, 0x68, 0x25, 0xdb, 0x1f, 0xd0, 0x15, 0xc3, 0xa7, 0x3f, 0xba, 0x17, 0x76, 0x23, 0x18, 0x7a, 0xf9, 0xc3, 0x17, 0xc9, 0xba, 0x97, 0x90, 0xec, 0xe6, 0x1f, 0x22, 0xdb, 0xca, 0x15, 0x24, 0xa, 0x3f, 0xa5, 0xde, 0xb0, 0x8d, 0xf1, 0x82, 0x85, 0x96, 0xfe, 0x53, 0xc9, 0x35, 0x16, 0xc9, 0x30, 0x80, 0x49, 0xfd, 0x15, 0x60, 0x16, 0x2c, 0xa7, 0xb4, 0xb4, 0x56, 0x78, 0xe2, 0x9e, 0x7d, 0x7f, 0x44, 0x43, 0x1a, 0x40, 0xfa, 0xbc, 0xeb, 0x66, 0xef, 0x4e, 0x88, 0x36, 0xed, 0xe, 0xc3, 0xa6, 0x3d, 0x72, 0x34, 0x64, 0xaf, 0x4, 0xd1, 0x97, 0x9e, 0xda, 0xc7, 0xb0, 0x7a, 0x86, 0x12, 0xf8, 0x29, 0x3b, 0x61, 0x56, 0x3e, 0x9e, 0x48, 0xe3, 0xef, 0x4b, 0x65, 0x5e, 0x26, 0xcd, 0xba, 0x52, 0x65, 0xad, 0x99, 0x1, 0x86, 0x5f, 0xf1, 0x44, 0xca, 0x75, 0x33, 0x17, 0x93, 0xdc, 0xb3, 0x60, 0x82, 0xa3, 0xc6, 0x8b, 0x86, 0x14, 0x4, 0x1a, 0x7a, 0x9b, 0x2b, 0xc9, 0x9e, 0x36, 0xf4, 0xf2, 0xc5, 0x8b, 0x3b, 0x9b, 0xb8, 0xe5, 0x60, 0xd8, 0xb4, 0x47, 0x87, 0x59, 0xd7, 0x9d, 0x2b, 0xd9, 0x91, 0xb9, 0x63, 0x71, 0x88, 0xa, 0x8d, 0x64, 0x85, 0x97, 0x2, 0xa5, 0x2e, 0x3e, 0x9d, 0x70, 0x78, 0x4e, 0x93, 0x22, 0x9d, 0x7b, 0xff, 0x70, 0xf3, 0xbf, 0xfe, 0xb2, 0x54, 0x79, 0x6b, 0x62, 0x80, 0x61, 0x57, 0x3c, 0x9e, 0x92, 0xcd, 0x5c, 0x27, 0xeb, 0xde, 0x0, 0xa0, 0x67, 0xc1, 0x92, 0xe4, 0x4, 0x2e, 0x7f, 0xdf, 0x3b, 0xfa, 0x27, 0x8c, 0xc1, 0xba, 0xf6, 0xb3, 0x43, 0x2e, 0x5b, 0x7c, 0x7f, 0x65, 0xa5, 0xec, 0x38, 0x18, 0x7a, 0xf9, 0xa3, 0x43, 0x25, 0xf7, 0x2e, 0x40, 0x47, 0xfa, 0x36, 0xd, 0x86, 0x7e, 0x6b, 0xc1, 0x3, 0xbd, 0x65, 0xfe, 0x8, 0x7e, 0xc3, 0x57, 0xee, 0x14, 0x94, 0xf0, 0x5, 0xc0, 0xa5, 0xe1, 0xdf, 0xca, 0x95, 0xb9, 0x6a, 0x6, 0x18, 0x7a, 0xf9, 0xa3, 0xd, 0x72, 0x33, 0xdf, 0xb3, 0xae, 0xfb, 0xdf, 0x0, 0xd3, 0x5e, 0x68, 0xb4, 0x64, 0x5f, 0x9d, 0x2a, 0xd3, 0x3a, 0xdc, 0x18, 0xa6, 0x21, 0x9d, 0x39, 0xe4, 0xd2, 0x87, 0x7e, 0x3b, 0xf4, 0xf2, 0x47, 0x92, 0xde, 0x95, 0xac, 0x26, 0x18, 0x36, 0xed, 0xb1, 0x93, 0xad, 0xcd, 0x3c, 0x28, 0xab, 0xc3, 0xa, 0xd7, 0x52, 0x94, 0xd2, 0x7a, 0xe2, 0x70, 0x81, 0xd6, 0x71, 0xf3, 0x9a, 0xdd, 0x2e, 0x92, 0x1b, 0x40, 0xf3, 0xa6, 0x84, 0x5d, 0xa, 0xb6, 0x53, 0x4, 0x43, 0x62, 0x86, 0x27, 0xfc, 0x9, 0x6c, 0x75, 0x68, 0x67, 0x31, 0x54, 0xc5, 0x0, 0xc3, 0xaf, 0x78, 0xbc, 0x1b, 0xa0, 0x1f, 0x59, 0x6b, 0xaf, 0x3, 0xe1, 0xd0, 0x10, 0xc1, 0x21, 0xc7, 0x85, 0x2b, 0xc7, 0xa2, 0x18, 0x9f, 0x45, 0xe1, 0xcc, 0x8b, 0x2b, 0x5, 0x78, 0x8, 0xb8, 0x9f, 0xa1, 0x74, 0x9, 0x10, 0x46, 0xd0, 0xd1, 0xd6, 0xba, 0x2f, 0xf, 0xb9, 0xfc, 0x91, 0xe3, 0x3a, 0x8c, 0xc2, 0x25, 0x60, 0xc8, 0x65, 0xf, 0xff, 0xa7, 0xb5, 0xd9, 0x45, 0x24, 0xf, 0xa, 0xd4, 0x6f, 0x1a, 0xe3, 0xf9, 0x39, 0x17, 0x8a, 0x3f, 0x85, 0xf5, 0x46, 0xc, 0x2e, 0xa, 0xf1, 0x26, 0x3f, 0x2e, 0x7d, 0x7c, 0xac, 0x5c, 0x75, 0xf3, 0x99, 0x3, 0x8d, 0x93, 0xfe, 0x94, 0x49, 0x35, 0xee, 0x63, 0x52, 0x4d, 0x4d, 0x26, 0x95, 0xee, 0x63, 0x9c, 0xf4, 0x20, 0x3a, 0xe9, 0xd1, 0x74, 0xd2, 0x67, 0xd1, 0x38, 0x5f, 0xa6, 0x71, 0xbe, 0x44, 0xf0, 0xd9, 0x72, 0x65, 0x2f, 0x27, 0xb8, 0x47, 0x10, 0xff, 0xd7, 0x7b, 0xca, 0xda, 0xaf, 0x4a, 0xf6, 0x3b, 0x8, 0x56, 0xa3, 0xb0, 0xd2, 0x95, 0xae, 0x55, 0x2d, 0x8c, 0xf5, 0xd8, 0x5b, 0x62, 0xc8, 0xb9, 0x70, 0x2b, 0x68, 0x1e, 0x4b, 0x77, 0xdb, 0xe7, 0xbc, 0x17, 0x67, 0x1c, 0xd3, 0xe1, 0x9b, 0x48, 0xe, 0xbf, 0xe2, 0x89, 0x46, 0xeb, 0x66, 0xd6, 0xca, 0xba, 0x7, 0x91, 0xdc, 0x23, 0x98, 0x92, 0x87, 0xc4, 0x44, 0x71, 0x12, 0x78, 0xe8, 0x92, 0xab, 0x40, 0xe7, 0xe4, 0x95, 0x73, 0x3e, 0xf7, 0x7e, 0x71, 0x94, 0xa3, 0xbe, 0xf2, 0x5b, 0xb6, 0x6c, 0x7b, 0x97, 0x4e, 0xba, 0x81, 0xb2, 0xd6, 0x48, 0xd6, 0x5d, 0x35, 0xf7, 0x8c, 0xb2, 0x47, 0xcc, 0x54, 0x44, 0x85, 0xa1, 0xd3, 0x1e, 0xed, 0xe, 0x60, 0x32, 0xac, 0x9d, 0x5, 0xf8, 0x67, 0xff, 0xa1, 0xe3, 0xf, 0x8c, 0x40, 0xe1, 0x3c, 0x78, 0xb, 0xc8, 0xb7, 0x4, 0xde, 0xea, 0x66, 0xb3, 0xd7, 0xaf, 0xb9, 0xf5, 0xcc, 0x4c, 0xd, 0x59, 0xb4, 0x9, 0x86, 0x5c, 0xfe, 0x48, 0x9a, 0xc0, 0x22, 0x12, 0x47, 0xc9, 0xda, 0xdc, 0x2c, 0x1b, 0x2b, 0x26, 0x7a, 0x25, 0x55, 0x46, 0x56, 0xe0, 0x5d, 0xab, 0xe6, 0x9e, 0x3e, 0x25, 0xc9, 0xba, 0x54, 0x54, 0xd8, 0x61, 0xd3, 0x1e, 0x3b, 0x49, 0x72, 0x7f, 0xe3, 0x89, 0xb5, 0x1e, 0x9b, 0xb7, 0x4a, 0x2d, 0xee, 0xec, 0x87, 0x70, 0xcc, 0xb8, 0xc5, 0x23, 0x2c, 0x8a, 0xab, 0xc8, 0x38, 0x91, 0xa7, 0x83, 0x49, 0xda, 0x4a, 0x9a, 0xd7, 0x40, 0x2e, 0x2, 0xcc, 0x4f, 0x56, 0xce, 0xf9, 0x6c, 0xe2, 0x1e, 0x45, 0xc3, 0xaf, 0x78, 0x7c, 0xa8, 0xb5, 0xee, 0xb5, 0xde, 0xde, 0x48, 0x3a, 0x88, 0xa4, 0xbf, 0x3f, 0x62, 0x20, 0xaa, 0x7b, 0xc7, 0x27, 0xb6, 0xaa, 0x53, 0xb8, 0x2e, 0x51, 0x38, 0x2a, 0xf6, 0xa4, 0x2e, 0xc4, 0x97, 0xbf, 0xf, 0x3, 0x9f, 0x4d, 0x35, 0x34, 0x7d, 0x6e, 0xd9, 0xcf, 0x4e, 0x4a, 0xf4, 0xc8, 0x98, 0x8a, 0xe, 0x8d, 0x12, 0xf0, 0x16, 0xc0, 0x55, 0x20, 0x86, 0x12, 0x85, 0x47, 0xb7, 0x14, 0x54, 0xa8, 0x18, 0xca, 0x59, 0x7f, 0xc2, 0x61, 0x2c, 0xfb, 0x5d, 0x1e, 0xb5, 0xb9, 0x19, 0x70, 0x89, 0x64, 0xf, 0xc9, 0xe, 0x84, 0x78, 0x10, 0xa9, 0xb, 0x87, 0x4e, 0x7b, 0x74, 0x29, 0xc0, 0xc5, 0x0, 0x9f, 0x58, 0x75, 0xd3, 0xe7, 0x3e, 0xac, 0x16, 0x41, 0x43, 0xa7, 0x3d, 0x76, 0x24, 0x81, 0x33, 0x41, 0x9c, 0x62, 0xdd, 0xec, 0x27, 0x1, 0xf4, 0x26, 0xd1, 0xe4, 0x17, 0x26, 0xe7, 0xa, 0x17, 0xb9, 0x8c, 0x92, 0x6d, 0xb8, 0x8f, 0x7f, 0xe, 0xed, 0xba, 0xc2, 0xd7, 0x68, 0xcc, 0x6d, 0x49, 0x13, 0x3f, 0x8e, 0x14, 0x25, 0x61, 0xd8, 0xf4, 0x5f, 0x9f, 0x2e, 0xeb, 0x3e, 0xc, 0x44, 0xad, 0x70, 0xed, 0x70, 0x28, 0x68, 0x57, 0xa1, 0x1d, 0x4b, 0x20, 0xa9, 0x19, 0xe4, 0x3f, 0x0, 0xbc, 0xb, 0xe0, 0x6d, 0x80, 0x7f, 0x34, 0xc6, 0xbc, 0x28, 0x61, 0x83, 0x64, 0x37, 0x1b, 0x63, 0xb6, 0x9, 0xcc, 0x2, 0x70, 0x8d, 0x31, 0x8e, 0x9b, 0xcd, 0x34, 0x2, 0xec, 0x66, 0xc, 0xf, 0x4, 0x74, 0x8c, 0xb5, 0x3a, 0xe, 0xd0, 0x1, 0x0, 0x7a, 0xc8, 0xda, 0xde, 0x24, 0xf7, 0xcb, 0x21, 0x2d, 0x7c, 0x42, 0xa, 0xa, 0xfb, 0xe9, 0x44, 0x2a, 0x15, 0x4a, 0x4f, 0x92, 0x5, 0xcd, 0x8d, 0x3d, 0xf7, 0xeb, 0x73, 0xd5, 0x33, 0xd7, 0xf, 0x4e, 0x5c, 0xce, 0xa9, 0xf8, 0xec, 0x60, 0x9, 0x2b, 0x40, 0xf3, 0x2, 0xa0, 0xe3, 0x2, 0x4f, 0x9e, 0xf0, 0x69, 0xd1, 0xed, 0xf, 0x5, 0x63, 0x49, 0xee, 0xc1, 0x3b, 0x69, 0x3b, 0x68, 0x3a, 0x10, 0xd, 0x1b, 0x25, 0x1c, 0x2, 0xe0, 0x10, 0x3f, 0xc6, 0x9, 0x92, 0x1d, 0x27, 0xe1, 0x7d, 0x48, 0xcd, 0x90, 0xcd, 0x10, 0xb4, 0x0, 0xe4, 0x66, 0xb2, 0x24, 0xe9, 0x0, 0x4a, 0x59, 0xab, 0xee, 0x80, 0xf6, 0x7, 0x90, 0xf3, 0x48, 0xa, 0x16, 0xc9, 0xf8, 0xe, 0xd1, 0x2c, 0x76, 0xe7, 0xab, 0x9c, 0xf8, 0xc5, 0xe3, 0x40, 0x1, 0x7e, 0x45, 0x43, 0x4a, 0xb0, 0x0, 0xc, 0x69, 0x9e, 0x14, 0xf9, 0x83, 0xf6, 0x20, 0x3e, 0x50, 0x5, 0x3, 0x90, 0x7c, 0x17, 0xe4, 0x77, 0x64, 0xdd, 0x27, 0xdb, 0xeb, 0xb8, 0xb4, 0xa, 0x4a, 0x13, 0x2a, 0x57, 0x48, 0x81, 0x24, 0xc2, 0x4e, 0x97, 0xc1, 0x88, 0xda, 0x1d, 0x40, 0x5f, 0x40, 0x7d, 0xc1, 0x9c, 0x4a, 0x91, 0x4b, 0x26, 0x70, 0x79, 0xf, 0x8c, 0x6e, 0xc8, 0x7f, 0x9b, 0xcb, 0x28, 0xbf, 0x59, 0x46, 0xb2, 0x65, 0x2f, 0xc4, 0x6f, 0xee, 0x5c, 0x24, 0x43, 0x72, 0x9, 0x8d, 0xf3, 0x5f, 0x2b, 0x67, 0x9f, 0x5a, 0xd6, 0xa0, 0x53, 0x2d, 0x54, 0xdc, 0x85, 0xaf, 0x9c, 0xf3, 0x59, 0x57, 0x56, 0xcf, 0x1, 0xe6, 0x7, 0xcc, 0x4f, 0x3b, 0x29, 0xce, 0xae, 0xf, 0xc4, 0xdb, 0xb2, 0x11, 0x11, 0x16, 0xf5, 0x1e, 0x31, 0xdf, 0x44, 0x7d, 0xe7, 0x3f, 0x33, 0x58, 0x72, 0xe, 0x7f, 0x5b, 0x4e, 0x7f, 0x7e, 0x1, 0x86, 0x6, 0x86, 0x26, 0xbf, 0xb6, 0xda, 0xf, 0xf3, 0xe6, 0x1c, 0x20, 0xd2, 0x0, 0xfe, 0x7d, 0xb1, 0x52, 0x5e, 0x6c, 0xcf, 0x47, 0x4c, 0x19, 0x4b, 0xc5, 0x61, 0x89, 0xfa, 0x86, 0x5d, 0xb9, 0xe8, 0x19, 0x73, 0x1e, 0x58, 0x31, 0xfb, 0xd4, 0x76, 0xf5, 0x8e, 0xae, 0x6a, 0xc, 0x5f, 0x75, 0xd3, 0xe7, 0x32, 0xc6, 0x71, 0x66, 0xd0, 0x98, 0x3f, 0x7a, 0x1e, 0x81, 0xf0, 0x14, 0x83, 0xbc, 0xcd, 0x1a, 0xa0, 0x77, 0x94, 0x27, 0x3, 0x79, 0x3d, 0xf8, 0xf1, 0xc3, 0xe4, 0x1b, 0x11, 0x7c, 0xbb, 0x49, 0x7e, 0x4d, 0x8, 0xb, 0xc3, 0xa, 0xec, 0x61, 0x21, 0x3b, 0x49, 0x2e, 0x6e, 0x48, 0x78, 0x6c, 0x65, 0x53, 0x2a, 0x8e, 0x1b, 0x32, 0x52, 0x79, 0xc6, 0x2b, 0x22, 0xbc, 0xcd, 0xa1, 0x77, 0xa, 0x8b, 0x1f, 0x25, 0x7c, 0x5f, 0x9c, 0x6f, 0x51, 0x18, 0x23, 0xca, 0x15, 0x67, 0xe3, 0x29, 0x28, 0x77, 0x44, 0x1d, 0xa, 0x3b, 0x6, 0x56, 0xdc, 0x43, 0x77, 0x8, 0x3, 0x0, 0xc0, 0x8a, 0xd9, 0xa7, 0xbc, 0x9, 0x98, 0x6f, 0x48, 0xb0, 0xc1, 0x4a, 0x97, 0x90, 0xcd, 0x3a, 0xa8, 0x72, 0x40, 0x71, 0xff, 0x40, 0x54, 0x13, 0xd8, 0xaa, 0x3d, 0xd3, 0x5e, 0xb0, 0xb5, 0x1d, 0x22, 0x30, 0x57, 0x80, 0xc5, 0x8, 0xec, 0xc6, 0xc5, 0x47, 0x1b, 0xe2, 0x17, 0x7f, 0xc7, 0x32, 0xf9, 0x97, 0xcb, 0xaf, 0x5c, 0x1e, 0x95, 0x94, 0xc5, 0xbb, 0xf7, 0x27, 0xc0, 0x34, 0x61, 0xd8, 0x15, 0x4f, 0x8c, 0xa9, 0x4b, 0x6, 0x0, 0x80, 0x15, 0x37, 0x9e, 0xf2, 0x2b, 0x81, 0x73, 0xfd, 0x59, 0x89, 0xe0, 0xbc, 0xdb, 0x9c, 0xdf, 0xa3, 0x1f, 0x6, 0x1, 0xaf, 0xd0, 0x38, 0xf3, 0x40, 0xf3, 0x3d, 0x90, 0x8f, 0xa3, 0x50, 0x4b, 0x66, 0x72, 0x3e, 0x92, 0x9d, 0x24, 0x8a, 0x24, 0x8, 0x61, 0x1c, 0x2, 0x1a, 0xe, 0x60, 0xca, 0x51, 0x57, 0x3d, 0x9d, 0x6e, 0xaf, 0xfc, 0x6a, 0x56, 0xe3, 0x68, 0x9c, 0xaf, 0xd2, 0x38, 0xbf, 0x1, 0xe8, 0x2, 0xc, 0x66, 0xa5, 0x8, 0xf0, 0x3, 0x81, 0x4f, 0x1, 0x9c, 0x4d, 0x9a, 0xff, 0x30, 0xc6, 0x4c, 0x5f, 0x31, 0xfb, 0x94, 0x6f, 0x3, 0xe6, 0x6b, 0xa0, 0xf9, 0x6d, 0x28, 0xae, 0xef, 0x27, 0x17, 0xb5, 0x6d, 0x5a, 0xa5, 0x17, 0x6a, 0xfc, 0xbe, 0xf3, 0x2f, 0x7f, 0xd2, 0x43, 0x79, 0xbc, 0x68, 0x8c, 0x9b, 0x75, 0xcf, 0x6b, 0x2f, 0x6, 0x48, 0xa4, 0xc9, 0x8c, 0xb8, 0xf2, 0xa9, 0x23, 0x24, 0xfb, 0x6b, 0x49, 0x69, 0x49, 0x1b, 0xc, 0xb9, 0x95, 0xc6, 0xac, 0x0, 0x78, 0xf3, 0xf2, 0x59, 0x27, 0xbd, 0x19, 0x11, 0xff, 0x13, 0xd6, 0xba, 0xf3, 0x25, 0x9d, 0x60, 0x72, 0xaa, 0x5b, 0xe8, 0xa0, 0xe4, 0x92, 0xc5, 0x6d, 0x4b, 0x6f, 0xd1, 0xd6, 0x78, 0x51, 0x71, 0xc3, 0xcf, 0x95, 0xa4, 0x53, 0xd, 0x4, 0x55, 0x8d, 0xcd, 0x43, 0x5e, 0x2f, 0xca, 0x47, 0x68, 0xcc, 0xf8, 0x95, 0xb3, 0x4f, 0x2e, 0x77, 0xa, 0x7a, 0xd5, 0x25, 0xa8, 0x19, 0x46, 0x5c, 0xf9, 0xd4, 0xf5, 0x92, 0x5e, 0x7, 0x39, 0x6f, 0xc5, 0xac, 0x93, 0xca, 0x6e, 0xf5, 0x3a, 0xfc, 0x4b, 0x4f, 0x35, 0x42, 0xf6, 0x69, 0x41, 0xc7, 0x78, 0x2, 0x1e, 0x73, 0x15, 0x66, 0x58, 0xa7, 0x8b, 0x41, 0x51, 0x78, 0xc, 0x29, 0x45, 0x22, 0x96, 0xf9, 0xbe, 0x38, 0x4e, 0x71, 0xfc, 0x28, 0x4, 0x29, 0x26, 0x8d, 0xf6, 0x60, 0x15, 0x7f, 0x78, 0x7c, 0x97, 0x34, 0x3f, 0x58, 0x31, 0xfb, 0xe4, 0x1f, 0x26, 0x9d, 0x7e, 0xa7, 0xe, 0x9a, 0x23, 0xaf, 0x59, 0x4a, 0xb7, 0x65, 0xfb, 0xe3, 0x24, 0x8e, 0x6, 0xd0, 0xc3, 0xdb, 0x3c, 0x23, 0xd8, 0x87, 0x24, 0x8a, 0x5, 0x18, 0xf1, 0x5c, 0xe9, 0xe4, 0x43, 0x5c, 0xba, 0xa5, 0x58, 0x24, 0xa, 0x65, 0xc5, 0xdf, 0x95, 0xcb, 0x2f, 0xae, 0x4c, 0x8c, 0xf9, 0x46, 0xc1, 0x7a, 0x4b, 0xff, 0xe0, 0x68, 0x3e, 0x63, 0x85, 0xcf, 0xaf, 0xba, 0xf1, 0x94, 0x44, 0xcd, 0xc1, 0x9d, 0x6a, 0xca, 0x5d, 0xf6, 0xd3, 0x63, 0xb5, 0xf2, 0xc6, 0x53, 0x4f, 0x25, 0x53, 0xb7, 0x4a, 0x7c, 0xc3, 0x57, 0xd5, 0x19, 0xbd, 0xce, 0x90, 0x31, 0xcf, 0x61, 0x4d, 0xa1, 0x54, 0xdc, 0x8, 0xbd, 0x32, 0x36, 0x9d, 0xb8, 0x30, 0x96, 0xf8, 0xae, 0x5c, 0x7e, 0x71, 0x71, 0xe2, 0xbe, 0xf1, 0xe4, 0xe3, 0x90, 0x6e, 0x3b, 0x84, 0xe4, 0xb7, 0x92, 0xa6, 0x41, 0x67, 0xdb, 0xf2, 0x1, 0x0, 0xcb, 0x67, 0x8d, 0xb9, 0x16, 0x34, 0xd7, 0x4a, 0x58, 0xf, 0xef, 0x4, 0x92, 0x28, 0x4a, 0xed, 0x56, 0x57, 0xb0, 0xb7, 0x72, 0xb9, 0xb0, 0x52, 0xdf, 0x6, 0x2e, 0x71, 0x7e, 0xf8, 0x36, 0x0, 0x1f, 0x24, 0x8d, 0xfb, 0xba, 0xd2, 0x9b, 0x86, 0x7f, 0xe9, 0xe9, 0xde, 0xa0, 0x1e, 0x25, 0x30, 0x24, 0x5f, 0xbc, 0xb8, 0x3d, 0x74, 0x6b, 0x19, 0x71, 0x4b, 0xa5, 0xd1, 0x16, 0xa9, 0x22, 0x4e, 0x7a, 0xc8, 0x7d, 0x17, 0xac, 0x95, 0xf4, 0x67, 0x2d, 0x73, 0x5d, 0x9b, 0xef, 0xc9, 0x62, 0x5b, 0x4f, 0xa5, 0x7, 0xdd, 0xbe, 0xb7, 0x4b, 0x46, 0xfe, 0x5b, 0x0, 0x92, 0x5e, 0x27, 0xf9, 0xff, 0x56, 0xcc, 0x3e, 0x69, 0x66, 0xd2, 0x38, 0x6f, 0x77, 0x4b, 0x53, 0x25, 0x60, 0xc, 0xcf, 0x12, 0xb0, 0x7f, 0xa1, 0x46, 0x10, 0xc7, 0xa3, 0x49, 0xf0, 0x6e, 0xb5, 0x69, 0xb3, 0xd5, 0x73, 0x89, 0x19, 0x41, 0x17, 0x40, 0xd6, 0x6f, 0xdc, 0x8d, 0x3e, 0x81, 0x63, 0x36, 0x88, 0x28, 0xdc, 0x37, 0xc0, 0x8f, 0xf3, 0xf, 0xc7, 0x38, 0xd7, 0x2f, 0xfb, 0xd9, 0x89, 0xb3, 0xd1, 0xe, 0x50, 0x17, 0x43, 0x40, 0x0, 0x56, 0x9a, 0x2, 0xb0, 0x4f, 0xcc, 0xa0, 0x19, 0x46, 0x54, 0x95, 0x57, 0xf8, 0xfb, 0xa8, 0xb4, 0xa2, 0xde, 0x17, 0x43, 0x41, 0x9a, 0xf2, 0xaf, 0x90, 0x15, 0x34, 0x6c, 0x14, 0x33, 0x24, 0xcd, 0x12, 0x63, 0x9c, 0x13, 0x49, 0x73, 0xa9, 0xf2, 0x7b, 0x39, 0xd2, 0x5b, 0xff, 0x58, 0xd0, 0xe5, 0xe7, 0xbc, 0x87, 0x83, 0xd6, 0xef, 0xf9, 0xf4, 0xf3, 0xb2, 0xf6, 0x22, 0x3e, 0x50, 0x6f, 0x3d, 0x0, 0xb9, 0xb7, 0x7f, 0xab, 0xe8, 0xa6, 0x5f, 0x6b, 0xab, 0x2f, 0x47, 0xe4, 0x36, 0x30, 0x41, 0x99, 0x11, 0x42, 0xc1, 0xc6, 0xf7, 0xc4, 0x12, 0x49, 0xff, 0x43, 0xf2, 0xe9, 0x65, 0x33, 0x47, 0x67, 0x0, 0xfc, 0x6e, 0xe4, 0x55, 0xcf, 0xbe, 0x2d, 0x6b, 0x7f, 0x9, 0x61, 0xcf, 0x12, 0xbe, 0x23, 0x16, 0xa0, 0x1, 0xf9, 0x24, 0xc9, 0x6f, 0x2e, 0x9b, 0x39, 0x7a, 0x59, 0x72, 0x18, 0x6e, 0xd, 0x75, 0xd3, 0x3, 0xc, 0xbf, 0xf2, 0x99, 0x43, 0xad, 0xd4, 0xd8, 0x7a, 0x7d, 0x21, 0x4a, 0x48, 0xe2, 0x40, 0xbc, 0x74, 0x8f, 0x98, 0x6f, 0xa3, 0x24, 0x7d, 0xc4, 0xe4, 0x17, 0x91, 0x6, 0x10, 0x78, 0xfb, 0x22, 0x98, 0xb4, 0xb, 0xc9, 0x76, 0xa4, 0x31, 0xf, 0xd2, 0x38, 0xa3, 0x40, 0xf3, 0x79, 0x3a, 0xd, 0x4f, 0x2c, 0xff, 0xd9, 0x89, 0x39, 0x1f, 0xc5, 0x65, 0x33, 0x47, 0x3f, 0xe, 0x9a, 0xa1, 0x2, 0x7e, 0xed, 0x37, 0x79, 0x81, 0x94, 0x37, 0xc9, 0xc8, 0x60, 0x1, 0x89, 0x1, 0x79, 0x9b, 0x80, 0x69, 0xed, 0x4d, 0x7c, 0xa0, 0x9e, 0x7a, 0x0, 0xa2, 0x1f, 0xc1, 0xc6, 0xdc, 0x53, 0x4e, 0xb2, 0x2a, 0xd7, 0x52, 0x5b, 0x79, 0xd0, 0xf8, 0xdd, 0x27, 0x83, 0x77, 0x88, 0x77, 0x57, 0x60, 0x44, 0x7a, 0xe5, 0x7b, 0x89, 0xfc, 0x9c, 0x7d, 0xe0, 0xe, 0x61, 0xfe, 0xa, 0x70, 0x11, 0xa8, 0x5b, 0x1, 0xbc, 0xe, 0x68, 0xe7, 0xf2, 0x99, 0xa3, 0x23, 0x3d, 0x72, 0x97, 0xff, 0x6c, 0xf4, 0x9f, 0x47, 0x5c, 0xf5, 0xec, 0x64, 0x8, 0x93, 0x24, 0x3b, 0x23, 0xa8, 0x82, 0xef, 0xdc, 0x42, 0x80, 0x5f, 0x3, 0x79, 0xc7, 0x8a, 0x99, 0x27, 0xbc, 0xd7, 0x11, 0x68, 0xaf, 0x1f, 0x6, 0x0, 0x8e, 0x5, 0xd8, 0xc3, 0xf7, 0xc9, 0xa8, 0xc8, 0xc9, 0xc4, 0x9f, 0x7d, 0xa, 0x3c, 0x68, 0x2, 0x46, 0x0, 0x80, 0xd0, 0x92, 0x6c, 0x0, 0x21, 0x71, 0xbd, 0x48, 0x66, 0xab, 0xc6, 0x9b, 0x97, 0x0, 0xb2, 0x20, 0x7, 0x81, 0xdc, 0x22, 0x69, 0xeb, 0xf2, 0x99, 0xa3, 0xdb, 0xe4, 0x88, 0xba, 0x7c, 0xe6, 0xe8, 0x77, 0x46, 0x5e, 0xbd, 0x64, 0x2e, 0xc4, 0xc5, 0x90, 0x9e, 0x5, 0x70, 0xa0, 0xa4, 0x77, 0x40, 0x4e, 0x4, 0xf4, 0xc2, 0xa, 0x6f, 0xc8, 0xe8, 0x10, 0xa8, 0x1b, 0x35, 0x70, 0xf8, 0x97, 0x9f, 0x7d, 0x9e, 0xc4, 0x31, 0xbe, 0x27, 0x47, 0x5b, 0x9, 0x92, 0xd7, 0xbb, 0x3c, 0xcf, 0xd9, 0xdb, 0x1, 0x2c, 0x5, 0x70, 0x32, 0xa0, 0xb3, 0x51, 0x62, 0xdb, 0xd9, 0x90, 0xb7, 0x50, 0x45, 0x6e, 0xed, 0x45, 0xbd, 0x4d, 0x66, 0xf9, 0xcc, 0xd1, 0xd, 0x6d, 0xfa, 0x30, 0x6, 0x46, 0x5e, 0xbd, 0xe4, 0x50, 0x49, 0xc3, 0x0, 0xac, 0x5f, 0x3e, 0xf3, 0x84, 0xd, 0xed, 0x89, 0xe3, 0x48, 0x3c, 0x74, 0x74, 0x86, 0x71, 0x30, 0xe2, 0xaa, 0xe7, 0xde, 0x2, 0xd0, 0x2b, 0xbc, 0xdf, 0x50, 0x29, 0xa2, 0x14, 0xbf, 0x97, 0xf4, 0x17, 0x80, 0x13, 0x1, 0xac, 0xa1, 0x77, 0x9e, 0x71, 0x2f, 0x0, 0x7b, 0x4a, 0x6a, 0x80, 0x77, 0xbc, 0x7d, 0xf, 0x0, 0x9f, 0x2, 0xd4, 0x17, 0xc0, 0xbe, 0x0, 0x3e, 0x9, 0x78, 0x1b, 0x51, 0x55, 0xea, 0xcf, 0x1f, 0xc, 0x33, 0x92, 0x32, 0xa4, 0xe9, 0xb6, 0x7c, 0xe6, 0xf1, 0xd9, 0xb6, 0x7e, 0x1b, 0x5, 0x47, 0x7f, 0x65, 0x69, 0xea, 0xf7, 0x33, 0x8e, 0xad, 0x29, 0x8d, 0x6a, 0xa1, 0x6e, 0x86, 0x0, 0x82, 0x3f, 0x17, 0xf4, 0x15, 0xf9, 0xb, 0xa1, 0x3c, 0xbf, 0x48, 0x8f, 0x28, 0x11, 0x94, 0xf1, 0x37, 0x44, 0xf4, 0x5, 0x32, 0x6f, 0x14, 0xb8, 0xce, 0xcd, 0xba, 0x7f, 0x58, 0x39, 0xfb, 0x44, 0xb, 0x60, 0x93, 0x7f, 0xe5, 0x60, 0xc4, 0xd5, 0x2f, 0x90, 0xb0, 0x3d, 0x0, 0xee, 0x9, 0x8f, 0x21, 0xfa, 0xc8, 0x6a, 0x89, 0x31, 0x74, 0x0, 0x6f, 0x71, 0x65, 0x5, 0x83, 0x8e, 0x7f, 0xca, 0x6d, 0x32, 0xde, 0x81, 0x9d, 0x45, 0x7c, 0xa0, 0x8e, 0x18, 0x40, 0xc0, 0x8f, 0x48, 0xb3, 0x44, 0xb2, 0x97, 0x82, 0x3c, 0x2d, 0x24, 0x4, 0x14, 0xf4, 0xba, 0x7e, 0x80, 0xbf, 0xf, 0x1e, 0x20, 0x6b, 0x9, 0xe0, 0xfb, 0x12, 0x1f, 0xf5, 0x89, 0x1f, 0x9, 0xcb, 0x6f, 0x38, 0x4e, 0x0, 0xb6, 0xf8, 0x17, 0x46, 0x5c, 0xb5, 0xe4, 0x75, 0x92, 0xbf, 0x15, 0x70, 0x1c, 0x80, 0x22, 0x51, 0xa1, 0x75, 0xe1, 0x42, 0x5c, 0xa8, 0xd0, 0x9e, 0x8c, 0xdb, 0xea, 0xa8, 0x13, 0xad, 0xa, 0xea, 0x46, 0xd, 0x5c, 0x3e, 0xf3, 0xf8, 0xd7, 0x97, 0xdd, 0x30, 0xea, 0x3e, 0x80, 0xd7, 0x1, 0xbc, 0x58, 0xc2, 0xaf, 0x3, 0xe7, 0x92, 0x22, 0x87, 0x11, 0x92, 0x46, 0xa1, 0x77, 0xbf, 0x7, 0xf8, 0xbf, 0xcb, 0x67, 0x1e, 0x5f, 0xd1, 0x59, 0x43, 0xc6, 0x18, 0xd2, 0x98, 0xbb, 0x42, 0xf6, 0xf9, 0x78, 0x3b, 0x7d, 0xa1, 0x4b, 0x97, 0x6f, 0xac, 0x81, 0x5, 0xf8, 0x1a, 0xda, 0xd7, 0x61, 0xa0, 0xdd, 0xa1, 0x6e, 0xd9, 0x77, 0xc4, 0x55, 0x4b, 0x8e, 0x4, 0x30, 0x82, 0xe4, 0x89, 0x0, 0xc6, 0x1, 0x8, 0x6f, 0x11, 0x13, 0x8c, 0xc1, 0x9b, 0x1, 0x9c, 0xb5, 0x7c, 0xe6, 0xf1, 0x4b, 0xaa, 0xc9, 0x63, 0xe4, 0xd5, 0x2f, 0x1c, 0x28, 0xd9, 0x4d, 0xfe, 0xb9, 0x88, 0xa5, 0x5c, 0x0, 0xa, 0xc0, 0xd7, 0x30, 0x32, 0x92, 0x16, 0x1, 0x98, 0xbc, 0x7c, 0xe6, 0xf1, 0x65, 0x17, 0x61, 0xd6, 0x2b, 0xd4, 0x2d, 0x3, 0x4, 0x30, 0xe2, 0xea, 0xe7, 0xfb, 0x0, 0x38, 0x3, 0xc0, 0xbf, 0x10, 0x3c, 0xa, 0xc0, 0x18, 0xdf, 0x4a, 0xb0, 0x43, 0xd0, 0x95, 0xcb, 0x6f, 0x18, 0x75, 0x47, 0x8d, 0xe9, 0x3f, 0x65, 0x68, 0x8e, 0x87, 0x77, 0xf6, 0x9e, 0xe7, 0x25, 0x1c, 0xc3, 0xa, 0xb2, 0x5, 0xea, 0xc2, 0x2e, 0x2b, 0xfb, 0x9f, 0x0, 0x7e, 0xb8, 0xfc, 0x86, 0x51, 0x5d, 0xc, 0xd0, 0x11, 0x70, 0xd4, 0x57, 0x96, 0xe, 0x7, 0x30, 0x9, 0x5e, 0x6f, 0xb0, 0xe9, 0xc5, 0x19, 0xc7, 0x7e, 0xb7, 0x96, 0xf4, 0x46, 0x5e, 0xb3, 0x94, 0x92, 0x3d, 0x95, 0xe4, 0xaf, 0x0, 0xec, 0x11, 0xee, 0x5, 0x22, 0xb4, 0x90, 0x9c, 0xfc, 0xe1, 0x3f, 0x5b, 0x0, 0x63, 0x49, 0xf3, 0x48, 0x67, 0x2c, 0x4d, 0x4f, 0xa, 0x76, 0x2b, 0x6, 0x68, 0xf, 0x18, 0x79, 0xcd, 0xd2, 0x3d, 0x24, 0xbd, 0x4c, 0xf2, 0xc0, 0x62, 0xb5, 0x33, 0xce, 0x5b, 0x59, 0xd2, 0x26, 0x92, 0x2f, 0x91, 0xbc, 0xf8, 0xc5, 0x19, 0xc7, 0x6c, 0x6a, 0x4b, 0x3e, 0xf5, 0xa, 0xff, 0xf4, 0xc, 0x0, 0x0, 0x23, 0xaf, 0x7e, 0xe1, 0x7a, 0x1a, 0x5e, 0x7, 0x20, 0xe5, 0xfb, 0x61, 0x65, 0x0, 0xec, 0x82, 0xb0, 0xb, 0xc4, 0xe, 0x0, 0x5b, 0x24, 0x6d, 0x26, 0xb9, 0xd, 0xc2, 0x66, 0x41, 0x4b, 0x8c, 0x31, 0xbf, 0xfb, 0xfd, 0x4f, 0x8e, 0x59, 0x57, 0x63, 0xd6, 0x9d, 0xe, 0x75, 0xa3, 0x6, 0x76, 0x26, 0xd0, 0x98, 0xff, 0x91, 0x74, 0x8, 0x80, 0x1e, 0x24, 0xb7, 0xc0, 0xdb, 0x5b, 0x6f, 0x33, 0xd, 0xdf, 0x3, 0xf0, 0xb6, 0xa4, 0x57, 0x1, 0xbc, 0xf4, 0xe2, 0x8c, 0x63, 0xdf, 0xe9, 0xec, 0xb2, 0x76, 0x41, 0x17, 0x74, 0x41, 0x17, 0x74, 0x41, 0x17, 0x74, 0x41, 0x17, 0x74, 0x41, 0x17, 0x74, 0x41, 0x17, 0xd4, 0x6, 0xff, 0x1f, 0x32, 0x68, 0x5, 0x7e, 0x99, 0xd5, 0x97, 0x49, 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 mini_checkerboard_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, 0x8, 0x6, 0x0, 0x0, 0x0, 0x1f, 0xf3, 0xff, 0x61, 0x0, 0x0, 0x0, 0x9, 0x70, 0x48, 0x59, 0x73, 0x0, 0x0, 0xe, 0xc3, 0x0, 0x0, 0xe, 0xc3, 0x1, 0xc7, 0x6f, 0xa8, 0x64, 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, 0x33, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0x63, 0x7c, 0xf0, 0xe0, 0xc1, 0x7f, 0x6, 0x3c, 0x40, 0x5e, 0x5e, 0x1e, 0x9f, 0x34, 0x3, 0x13, 0x5e, 0x59, 0x22, 0xc0, 0xa8, 0x1, 0x83, 0xc1, 0x0, 0xc6, 0xff, 0xff, 0xff, 0xe3, 0x4d, 0x7, 0xf, 0x1f, 0x3e, 0xa4, 0xad, 0xb, 0x46, 0xd, 0x18, 0xc, 0x6, 0x0, 0x0, 0x6e, 0x41, 0xa, 0xba, 0x94, 0xaa, 0x47, 0x57, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
+};
+
static const unsigned char option_arrow_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, 0x6, 0x62, 0x4b, 0x47, 0x44, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0xa0, 0xbd, 0xa7, 0x93, 0x0, 0x0, 0x0, 0x98, 0x49, 0x44, 0x41, 0x54, 0x28, 0x91, 0xbd, 0x91, 0xb1, 0xd, 0xc2, 0x30, 0x10, 0x45, 0xdf, 0xd1, 0xb8, 0xf0, 0x2, 0xee, 0xdc, 0x87, 0x1, 0xd8, 0x24, 0xb5, 0xe9, 0x19, 0x87, 0x1e, 0xea, 0x6c, 0xc2, 0x0, 0xa4, 0xb5, 0xdc, 0x79, 0x1, 0x17, 0xae, 0x8e, 0x26, 0x48, 0x76, 0x14, 0x40, 0x48, 0x88, 0xdf, 0xfd, 0xf7, 0xef, 0x4b, 0x77, 0x3a, 0xf8, 0x85, 0x62, 0x8c, 0x21, 0xc6, 0x18, 0xb6, 0x32, 0x59, 0x83, 0x94, 0xd2, 0x5e, 0x55, 0x6f, 0x0, 0x22, 0x72, 0xf0, 0xde, 0xdf, 0xdb, 0x7c, 0xd7, 0x9a, 0x9c, 0xb3, 0x55, 0xd5, 0x9, 0xb0, 0x80, 0x55, 0xd5, 0x29, 0xe7, 0x6c, 0x5f, 0x16, 0x6a, 0xad, 0x67, 0x60, 0x68, 0xd0, 0xb0, 0xb0, 0x3f, 0xaa, 0x3b, 0x3a, 0xa5, 0x74, 0x51, 0xd5, 0xd0, 0xd, 0x88, 0x5c, 0xbd, 0xf7, 0xc7, 0xa7, 0xef, 0x6e, 0x30, 0xc6, 0x9c, 0x80, 0xb9, 0x41, 0xf3, 0xc2, 0xd8, 0x2c, 0x38, 0xe7, 0x8a, 0x88, 0x8c, 0x40, 0x1, 0x8a, 0x88, 0x8c, 0xce, 0xb9, 0xf2, 0x71, 0xcf, 0x77, 0x8f, 0xfb, 0x5a, 0xf, 0x28, 0x4a, 0x37, 0xff, 0x58, 0x46, 0x7b, 0x50, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp
index da3bc6a95b..4c6fa7c8a1 100644
--- a/scene/resources/environment.cpp
+++ b/scene/resources/environment.cpp
@@ -55,12 +55,11 @@ void Environment::set_sky(const Ref<Sky> &p_sky) {
VS::get_singleton()->environment_set_sky(environment, sb_rid);
}
-void Environment::set_sky_scale(float p_scale) {
+void Environment::set_sky_custom_fov(float p_scale) {
- bg_sky_scale = p_scale;
- VS::get_singleton()->environment_set_sky_scale(environment, p_scale);
+ bg_sky_custom_fov = p_scale;
+ VS::get_singleton()->environment_set_sky_custom_fov(environment, p_scale);
}
-
void Environment::set_bg_color(const Color &p_color) {
bg_color = p_color;
@@ -101,9 +100,9 @@ Ref<Sky> Environment::get_sky() const {
return bg_sky;
}
-float Environment::get_sky_scale() const {
+float Environment::get_sky_custom_fov() const {
- return bg_sky_scale;
+ return bg_sky_custom_fov;
}
Color Environment::get_bg_color() const {
@@ -268,7 +267,7 @@ Ref<Texture> Environment::get_adjustment_color_correction() const {
void Environment::_validate_property(PropertyInfo &property) const {
- if (property.name == "background_sky" || property.name == "background_sky_scale" || property.name == "ambient_light/sky_contribution") {
+ if (property.name == "background_sky" || property.name == "background_sky_custom_fov" || property.name == "ambient_light/sky_contribution") {
if (bg_mode != BG_SKY && bg_mode != BG_COLOR_SKY) {
property.usage = PROPERTY_USAGE_NOEDITOR;
}
@@ -820,7 +819,7 @@ void Environment::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_background", "mode"), &Environment::set_background);
ClassDB::bind_method(D_METHOD("set_sky", "sky"), &Environment::set_sky);
- ClassDB::bind_method(D_METHOD("set_sky_scale", "scale"), &Environment::set_sky_scale);
+ ClassDB::bind_method(D_METHOD("set_sky_custom_fov", "scale"), &Environment::set_sky_custom_fov);
ClassDB::bind_method(D_METHOD("set_bg_color", "color"), &Environment::set_bg_color);
ClassDB::bind_method(D_METHOD("set_bg_energy", "energy"), &Environment::set_bg_energy);
ClassDB::bind_method(D_METHOD("set_canvas_max_layer", "layer"), &Environment::set_canvas_max_layer);
@@ -830,7 +829,7 @@ void Environment::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_background"), &Environment::get_background);
ClassDB::bind_method(D_METHOD("get_sky"), &Environment::get_sky);
- ClassDB::bind_method(D_METHOD("get_sky_scale"), &Environment::get_sky_scale);
+ ClassDB::bind_method(D_METHOD("get_sky_custom_fov"), &Environment::get_sky_custom_fov);
ClassDB::bind_method(D_METHOD("get_bg_color"), &Environment::get_bg_color);
ClassDB::bind_method(D_METHOD("get_bg_energy"), &Environment::get_bg_energy);
ClassDB::bind_method(D_METHOD("get_canvas_max_layer"), &Environment::get_canvas_max_layer);
@@ -841,7 +840,7 @@ void Environment::_bind_methods() {
ADD_GROUP("Background", "background_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "background_mode", PROPERTY_HINT_ENUM, "Clear Color,Custom Color,Sky,Color+Sky,Canvas,Keep"), "set_background", "get_background");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "background_sky", PROPERTY_HINT_RESOURCE_TYPE, "Sky"), "set_sky", "get_sky");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "background_sky_scale", PROPERTY_HINT_RANGE, "0,32,0.01"), "set_sky_scale", "get_sky_scale");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "background_sky_custom_fov", PROPERTY_HINT_RANGE, "0,180,0.1"), "set_sky_custom_fov", "get_sky_custom_fov");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "background_color"), "set_bg_color", "get_bg_color");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "background_energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_bg_energy", "get_bg_energy");
ADD_PROPERTY(PropertyInfo(Variant::INT, "background_canvas_max_layer", PROPERTY_HINT_RANGE, "-1000,1000,1"), "set_canvas_max_layer", "get_canvas_max_layer");
@@ -1142,7 +1141,7 @@ Environment::Environment() {
environment = VS::get_singleton()->environment_create();
bg_mode = BG_CLEAR_COLOR;
- bg_sky_scale = 1.0;
+ bg_sky_custom_fov = 0;
bg_energy = 1.0;
bg_canvas_max_layer = 0;
ambient_energy = 1.0;
diff --git a/scene/resources/environment.h b/scene/resources/environment.h
index 9046ec1e49..5909846074 100644
--- a/scene/resources/environment.h
+++ b/scene/resources/environment.h
@@ -76,7 +76,7 @@ private:
BGMode bg_mode;
Ref<Sky> bg_sky;
- float bg_sky_scale;
+ float bg_sky_custom_fov;
Color bg_color;
float bg_energy;
int bg_canvas_max_layer;
@@ -162,7 +162,7 @@ protected:
public:
void set_background(BGMode p_bg);
void set_sky(const Ref<Sky> &p_sky);
- void set_sky_scale(float p_scale);
+ void set_sky_custom_fov(float p_scale);
void set_bg_color(const Color &p_color);
void set_bg_energy(float p_energy);
void set_canvas_max_layer(int p_max_layer);
@@ -172,7 +172,7 @@ public:
BGMode get_background() const;
Ref<Sky> get_sky() const;
- float get_sky_scale() const;
+ float get_sky_custom_fov() const;
Color get_bg_color() const;
float get_bg_energy() const;
int get_canvas_max_layer() const;
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index abe9a00c3f..2936df7a51 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -268,6 +268,12 @@ void SpatialMaterial::init_shaders() {
shader_names->grow = "grow";
+ shader_names->ao_light_affect = "ao_light_affect";
+
+ shader_names->proximity_fade_distance = "proximity_fade_distance";
+ shader_names->distance_fade_min = "distance_fade_min";
+ shader_names->distance_fade_max = "distance_fade_max";
+
shader_names->metallic_texture_channel = "metallic_texture_channel";
shader_names->roughness_texture_channel = "roughness_texture_channel";
shader_names->ao_texture_channel = "ao_texture_channel";
@@ -364,10 +370,10 @@ void SpatialMaterial::_update_shader() {
case CULL_DISABLED: code += ",cull_disabled"; break;
}
switch (diffuse_mode) {
+ case DIFFUSE_BURLEY: code += ",diffuse_burley"; break;
case DIFFUSE_LAMBERT: code += ",diffuse_lambert"; break;
case DIFFUSE_LAMBERT_WRAP: code += ",diffuse_lambert_wrap"; break;
case DIFFUSE_OREN_NAYAR: code += ",diffuse_oren_nayar"; break;
- case DIFFUSE_BURLEY: code += ",diffuse_burley"; break;
case DIFFUSE_TOON: code += ",diffuse_toon"; break;
}
switch (specular_mode) {
@@ -401,6 +407,14 @@ void SpatialMaterial::_update_shader() {
code += "uniform float grow;\n";
}
+ if (proximity_fade_enabled) {
+ code += "uniform float proximity_fade_distance;\n";
+ }
+ if (distance_fade_enabled) {
+ code += "uniform float distance_fade_min;\n";
+ code += "uniform float distance_fade_max;\n";
+ }
+
if (flags[FLAG_USE_ALPHA_SCISSOR]) {
code += "uniform float alpha_scissor_threshold;\n";
}
@@ -450,6 +464,7 @@ void SpatialMaterial::_update_shader() {
if (features[FEATURE_AMBIENT_OCCLUSION]) {
code += "uniform sampler2D texture_ambient_occlusion : hint_white;\n";
code += "uniform vec4 ao_texture_channel;\n";
+ code += "uniform float ao_light_affect;\n";
}
if (features[FEATURE_DETAIL]) {
@@ -725,10 +740,21 @@ void SpatialMaterial::_update_shader() {
code += "\tALBEDO *= 1.0 - ref_amount;\n";
code += "\tALPHA = 1.0;\n";
- } else if (features[FEATURE_TRANSPARENT] || features[FLAG_USE_ALPHA_SCISSOR]) {
+ } else if (features[FEATURE_TRANSPARENT] || flags[FLAG_USE_ALPHA_SCISSOR] || distance_fade_enabled || proximity_fade_enabled) {
code += "\tALPHA = albedo.a * albedo_tex.a;\n";
}
+ if (proximity_fade_enabled) {
+ code += "\tfloat depth_tex = textureLod(DEPTH_TEXTURE,SCREEN_UV,0.0).r;\n";
+ code += "\tvec4 world_pos = INV_PROJECTION_MATRIX * vec4(SCREEN_UV*2.0-1.0,depth_tex*2.0-1.0,1.0);\n";
+ code += "\tworld_pos.xyz/=world_pos.w;\n";
+ code += "\tALPHA*=clamp(1.0-smoothstep(world_pos.z+proximity_fade_distance,world_pos.z,VERTEX.z),0.0,1.0);\n";
+ }
+
+ if (distance_fade_enabled) {
+ code += "\tALPHA*=clamp(smoothstep(distance_fade_min,distance_fade_max,-VERTEX.z),0.0,1.0);\n";
+ }
+
if (features[FEATURE_RIM]) {
if (flags[FLAG_UV1_USE_TRIPLANAR]) {
code += "\tvec2 rim_tex = triplanar_texture(texture_rim,uv1_power_normal,uv1_triplanar_pos).xy;\n";
@@ -773,6 +799,8 @@ void SpatialMaterial::_update_shader() {
code += "\tAO = dot(texture(texture_ambient_occlusion,base_uv),ao_texture_channel);\n";
}
}
+
+ code += "\tAO_LIGHT_AFFECT = ao_light_affect;\n";
}
if (features[FEATURE_SUBSURACE_SCATTERING]) {
@@ -834,10 +862,10 @@ void SpatialMaterial::_update_shader() {
code += "\tvec3 detail_norm = mix(NORMALMAP,detail_norm_tex.rgb,detail_tex.a);\n";
code += "\tNORMALMAP = mix(NORMALMAP,detail_norm,detail_mask_tex.r);\n";
code += "\tALBEDO.rgb = mix(ALBEDO.rgb,detail,detail_mask_tex.r);\n";
+ }
- if (flags[FLAG_USE_ALPHA_SCISSOR]) {
- code += "\tALPHA_SCISSOR=alpha_scissor_threshold;\n";
- }
+ if (flags[FLAG_USE_ALPHA_SCISSOR]) {
+ code += "\tALPHA_SCISSOR=alpha_scissor_threshold;\n";
}
code += "}\n";
@@ -989,6 +1017,16 @@ float SpatialMaterial::get_rim_tint() const {
return rim_tint;
}
+void SpatialMaterial::set_ao_light_affect(float p_ao_light_affect) {
+
+ ao_light_affect = p_ao_light_affect;
+ VS::get_singleton()->material_set_param(_get_material(), shader_names->ao_light_affect, p_ao_light_affect);
+}
+float SpatialMaterial::get_ao_light_affect() const {
+
+ return ao_light_affect;
+}
+
void SpatialMaterial::set_clearcoat(float p_clearcoat) {
clearcoat = p_clearcoat;
@@ -1231,6 +1269,14 @@ void SpatialMaterial::_validate_property(PropertyInfo &property) const {
property.usage = 0;
}
+ if (property.name == "proximity_fade_distacne" && !proximity_fade_enabled) {
+ property.usage = 0;
+ }
+
+ if ((property.name == "distance_fade_max_distance" || property.name == "distance_fade_min_distance") && !distance_fade_enabled) {
+ property.usage = 0;
+ }
+
if (property.name == "params_alpha_scissor_threshold" && !flags[FLAG_USE_ALPHA_SCISSOR]) {
property.usage = 0;
}
@@ -1526,6 +1572,66 @@ void SpatialMaterial::set_on_top_of_alpha() {
set_flag(FLAG_DISABLE_DEPTH_TEST, true);
}
+void SpatialMaterial::set_proximity_fade(bool p_enable) {
+
+ proximity_fade_enabled = p_enable;
+ _queue_shader_change();
+ _change_notify();
+}
+
+bool SpatialMaterial::is_proximity_fade_enabled() const {
+
+ return proximity_fade_enabled;
+}
+
+void SpatialMaterial::set_proximity_fade_distance(float p_distance) {
+
+ proximity_fade_distance = p_distance;
+ VS::get_singleton()->material_set_param(_get_material(), shader_names->proximity_fade_distance, p_distance);
+}
+float SpatialMaterial::get_proximity_fade_distance() const {
+
+ return proximity_fade_distance;
+}
+
+void SpatialMaterial::set_distance_fade(bool p_enable) {
+
+ distance_fade_enabled = p_enable;
+ _queue_shader_change();
+ _change_notify();
+}
+bool SpatialMaterial::is_distance_fade_enabled() const {
+
+ return distance_fade_enabled;
+}
+
+void SpatialMaterial::set_distance_fade_max_distance(float p_distance) {
+
+ distance_fade_max_distance = p_distance;
+ VS::get_singleton()->material_set_param(_get_material(), shader_names->distance_fade_max, distance_fade_max_distance);
+}
+float SpatialMaterial::get_distance_fade_max_distance() const {
+
+ return distance_fade_max_distance;
+}
+
+void SpatialMaterial::set_distance_fade_min_distance(float p_distance) {
+
+ distance_fade_min_distance = p_distance;
+ VS::get_singleton()->material_set_param(_get_material(), shader_names->distance_fade_min, distance_fade_min_distance);
+}
+
+float SpatialMaterial::get_distance_fade_min_distance() const {
+
+ return distance_fade_min_distance;
+}
+
+RID SpatialMaterial::get_shader_rid() const {
+
+ ERR_FAIL_COND_V(!shader_map.has(current_key), RID());
+ return shader_map[current_key].shader;
+}
+
void SpatialMaterial::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_albedo", "albedo"), &SpatialMaterial::set_albedo);
@@ -1654,6 +1760,9 @@ void SpatialMaterial::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_grow", "amount"), &SpatialMaterial::set_grow);
ClassDB::bind_method(D_METHOD("get_grow"), &SpatialMaterial::get_grow);
+ ClassDB::bind_method(D_METHOD("set_ao_light_affect", "amount"), &SpatialMaterial::set_ao_light_affect);
+ ClassDB::bind_method(D_METHOD("get_ao_light_affect"), &SpatialMaterial::get_ao_light_affect);
+
ClassDB::bind_method(D_METHOD("set_alpha_scissor_threshold", "threshold"), &SpatialMaterial::set_alpha_scissor_threshold);
ClassDB::bind_method(D_METHOD("get_alpha_scissor_threshold"), &SpatialMaterial::get_alpha_scissor_threshold);
@@ -1672,6 +1781,21 @@ void SpatialMaterial::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_refraction_texture_channel", "channel"), &SpatialMaterial::set_refraction_texture_channel);
ClassDB::bind_method(D_METHOD("get_refraction_texture_channel"), &SpatialMaterial::get_refraction_texture_channel);
+ ClassDB::bind_method(D_METHOD("set_proximity_fade", "enabled"), &SpatialMaterial::set_proximity_fade);
+ ClassDB::bind_method(D_METHOD("is_proximity_fade_enabled"), &SpatialMaterial::is_proximity_fade_enabled);
+
+ ClassDB::bind_method(D_METHOD("set_proximity_fade_distance", "distance"), &SpatialMaterial::set_proximity_fade_distance);
+ ClassDB::bind_method(D_METHOD("get_proximity_fade_distance"), &SpatialMaterial::get_proximity_fade_distance);
+
+ ClassDB::bind_method(D_METHOD("set_distance_fade", "enabled"), &SpatialMaterial::set_distance_fade);
+ ClassDB::bind_method(D_METHOD("is_distance_fade_enabled"), &SpatialMaterial::is_distance_fade_enabled);
+
+ ClassDB::bind_method(D_METHOD("set_distance_fade_max_distance", "distance"), &SpatialMaterial::set_distance_fade_max_distance);
+ ClassDB::bind_method(D_METHOD("get_distance_fade_max_distance"), &SpatialMaterial::get_distance_fade_max_distance);
+
+ ClassDB::bind_method(D_METHOD("set_distance_fade_min_distance", "distance"), &SpatialMaterial::set_distance_fade_min_distance);
+ ClassDB::bind_method(D_METHOD("get_distance_fade_min_distance"), &SpatialMaterial::get_distance_fade_min_distance);
+
ADD_GROUP("Flags", "flags_");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_transparent"), "set_feature", "get_feature", FEATURE_TRANSPARENT);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_unshaded"), "set_flag", "get_flag", FLAG_UNSHADED);
@@ -1685,7 +1809,7 @@ void SpatialMaterial::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "vertex_color_is_srgb"), "set_flag", "get_flag", FLAG_SRGB_VERTEX_COLOR);
ADD_GROUP("Parameters", "params_");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "params_diffuse_mode", PROPERTY_HINT_ENUM, "Lambert,Lambert Wrap,Oren Nayar,Burley,Toon"), "set_diffuse_mode", "get_diffuse_mode");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "params_diffuse_mode", PROPERTY_HINT_ENUM, "Burley,Lambert,Lambert Wrap,Oren Nayar,Toon"), "set_diffuse_mode", "get_diffuse_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "params_specular_mode", PROPERTY_HINT_ENUM, "SchlickGGX,Blinn,Phong,Toon,Disabled"), "set_specular_mode", "get_specular_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "params_blend_mode", PROPERTY_HINT_ENUM, "Mix,Add,Sub,Mul"), "set_blend_mode", "get_blend_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "params_cull_mode", PROPERTY_HINT_ENUM, "Back,Front,Disabled"), "set_cull_mode", "get_cull_mode");
@@ -1747,6 +1871,7 @@ void SpatialMaterial::_bind_methods() {
ADD_GROUP("Ambient Occlusion", "ao_");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "ao_enabled"), "set_feature", "get_feature", FEATURE_AMBIENT_OCCLUSION);
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "ao_light_affect", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_ao_light_affect", "get_ao_light_affect");
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "ao_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture", TEXTURE_AMBIENT_OCCLUSION);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "ao_on_uv2"), "set_flag", "get_flag", FLAG_AO_ON_UV2);
ADD_PROPERTY(PropertyInfo(Variant::INT, "ao_texture_channel", PROPERTY_HINT_ENUM, "Red,Green,Blue,Alpha,Gray"), "set_ao_texture_channel", "get_ao_texture_channel");
@@ -1795,6 +1920,14 @@ void SpatialMaterial::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "uv2_triplanar"), "set_flag", "get_flag", FLAG_UV2_USE_TRIPLANAR);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "uv2_triplanar_sharpness", PROPERTY_HINT_EXP_EASING), "set_uv2_triplanar_blend_sharpness", "get_uv2_triplanar_blend_sharpness");
+ ADD_GROUP("Proximity Fade", "proximity_fade_");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "proximity_fade_enable"), "set_proximity_fade", "is_proximity_fade_enabled");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "proximity_fade_distance", PROPERTY_HINT_RANGE, "0,4096,0.1"), "set_proximity_fade_distance", "get_proximity_fade_distance");
+ ADD_GROUP("Distance Fade", "distance_fade_");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "distance_fade_enable"), "set_distance_fade", "is_distance_fade_enabled");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "distance_fade_min_distance", PROPERTY_HINT_RANGE, "0,4096,0.1"), "set_distance_fade_min_distance", "get_distance_fade_min_distance");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "distance_fade_max_distance", PROPERTY_HINT_RANGE, "0,4096,0.1"), "set_distance_fade_max_distance", "get_distance_fade_max_distance");
+
BIND_ENUM_CONSTANT(TEXTURE_ALBEDO);
BIND_ENUM_CONSTANT(TEXTURE_METALLIC);
BIND_ENUM_CONSTANT(TEXTURE_ROUGHNESS);
@@ -1858,10 +1991,10 @@ void SpatialMaterial::_bind_methods() {
BIND_ENUM_CONSTANT(FLAG_TRIPLANAR_USE_WORLD);
BIND_ENUM_CONSTANT(FLAG_MAX);
+ BIND_ENUM_CONSTANT(DIFFUSE_BURLEY);
BIND_ENUM_CONSTANT(DIFFUSE_LAMBERT);
BIND_ENUM_CONSTANT(DIFFUSE_LAMBERT_WRAP);
BIND_ENUM_CONSTANT(DIFFUSE_OREN_NAYAR);
- BIND_ENUM_CONSTANT(DIFFUSE_BURLEY);
BIND_ENUM_CONSTANT(DIFFUSE_TOON);
BIND_ENUM_CONSTANT(SPECULAR_SCHLICK_GGX);
@@ -1916,6 +2049,14 @@ SpatialMaterial::SpatialMaterial()
set_particles_anim_loop(false);
set_alpha_scissor_threshold(0.98);
+ proximity_fade_enabled = false;
+ distance_fade_enabled = false;
+ set_proximity_fade_distance(1);
+ set_distance_fade_min_distance(0);
+ set_distance_fade_max_distance(10);
+
+ set_ao_light_affect(0.0);
+
set_metallic_texture_channel(TEXTURE_CHANNEL_RED);
set_roughness_texture_channel(TEXTURE_CHANNEL_RED);
set_ao_texture_channel(TEXTURE_CHANNEL_RED);
diff --git a/scene/resources/material.h b/scene/resources/material.h
index fdb11982a8..c0e007ac5f 100644
--- a/scene/resources/material.h
+++ b/scene/resources/material.h
@@ -185,10 +185,10 @@ public:
};
enum DiffuseMode {
+ DIFFUSE_BURLEY,
DIFFUSE_LAMBERT,
DIFFUSE_LAMBERT_WRAP,
DIFFUSE_OREN_NAYAR,
- DIFFUSE_BURLEY,
DIFFUSE_TOON,
};
@@ -232,6 +232,8 @@ private:
uint64_t deep_parallax : 1;
uint64_t billboard_mode : 2;
uint64_t grow : 1;
+ uint64_t proximity_fade : 1;
+ uint64_t distance_fade : 1;
};
uint64_t key;
@@ -274,6 +276,8 @@ private:
mk.billboard_mode = billboard_mode;
mk.deep_parallax = deep_parallax ? 1 : 0;
mk.grow = grow_enabled;
+ mk.proximity_fade = proximity_fade_enabled;
+ mk.distance_fade = distance_fade_enabled;
return mk;
}
@@ -308,6 +312,10 @@ private:
StringName uv1_blend_sharpness;
StringName uv2_blend_sharpness;
StringName grow;
+ StringName proximity_fade_distance;
+ StringName distance_fade_min;
+ StringName distance_fade_max;
+ StringName ao_light_affect;
StringName metallic_texture_channel;
StringName roughness_texture_channel;
@@ -351,6 +359,7 @@ private:
float point_size;
float alpha_scissor_threshold;
bool grow_enabled;
+ float ao_light_affect;
float grow;
int particles_anim_h_frames;
int particles_anim_v_frames;
@@ -370,6 +379,13 @@ private:
int deep_parallax_min_layers;
int deep_parallax_max_layers;
+ bool proximity_fade_enabled;
+ float proximity_fade_distance;
+
+ bool distance_fade_enabled;
+ float distance_fade_max_distance;
+ float distance_fade_min_distance;
+
BlendMode blend_mode;
BlendMode detail_blend_mode;
DepthDrawMode depth_draw_mode;
@@ -429,6 +445,9 @@ public:
void set_rim_tint(float p_rim_tint);
float get_rim_tint() const;
+ void set_ao_light_affect(float p_ao_light_affect);
+ float get_ao_light_affect() const;
+
void set_clearcoat(float p_clearcoat);
float get_clearcoat() const;
@@ -535,6 +554,21 @@ public:
void set_on_top_of_alpha();
+ void set_proximity_fade(bool p_enable);
+ bool is_proximity_fade_enabled() const;
+
+ void set_proximity_fade_distance(float p_distance);
+ float get_proximity_fade_distance() const;
+
+ void set_distance_fade(bool p_enable);
+ bool is_distance_fade_enabled() const;
+
+ void set_distance_fade_max_distance(float p_distance);
+ float get_distance_fade_max_distance() const;
+
+ void set_distance_fade_min_distance(float p_distance);
+ float get_distance_fade_min_distance() const;
+
void set_metallic_texture_channel(TextureChannel p_channel);
TextureChannel get_metallic_texture_channel() const;
void set_roughness_texture_channel(TextureChannel p_channel);
@@ -550,6 +584,8 @@ public:
static RID get_material_rid_for_2d(bool p_shaded, bool p_transparent, bool p_double_sided, bool p_cut_alpha, bool p_opaque_prepass);
+ RID get_shader_rid() const;
+
SpatialMaterial();
virtual ~SpatialMaterial();
};
diff --git a/scene/resources/video_stream.h b/scene/resources/video_stream.h
index 30264691ee..0f07233185 100644
--- a/scene/resources/video_stream.h
+++ b/scene/resources/video_stream.h
@@ -55,8 +55,8 @@ public:
virtual float get_length() const = 0;
- virtual float get_position() const = 0;
- virtual void seek_pos(float p_time) = 0;
+ virtual float get_playback_position() const = 0;
+ virtual void seek(float p_time) = 0;
virtual void set_audio_track(int p_idx) = 0;
diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp
index 6b7168a529..d9770ec3f3 100644
--- a/scene/scene_string_names.cpp
+++ b/scene/scene_string_names.cpp
@@ -87,7 +87,7 @@ SceneStringNames::SceneStringNames() {
_get_gizmo_geometry = StaticCString::create("_get_gizmo_geometry");
_can_gizmo_scale = StaticCString::create("_can_gizmo_scale");
- _fixed_process = StaticCString::create("_fixed_process");
+ _physics_process = StaticCString::create("_physics_process");
_process = StaticCString::create("_process");
_enter_tree = StaticCString::create("_enter_tree");
diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h
index 8676b8436e..3b110e7a62 100644
--- a/scene/scene_string_names.h
+++ b/scene/scene_string_names.h
@@ -106,7 +106,7 @@ public:
StringName _get_gizmo_geometry;
StringName _can_gizmo_scale;
- StringName _fixed_process;
+ StringName _physics_process;
StringName _process;
StringName _enter_world;
StringName _exit_world;
diff --git a/servers/arvr/arvr_interface.cpp b/servers/arvr/arvr_interface.cpp
index 0705df17b1..55707def7c 100644
--- a/servers/arvr/arvr_interface.cpp
+++ b/servers/arvr/arvr_interface.cpp
@@ -31,29 +31,49 @@
void ARVRInterface::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_name"), &ARVRInterface::get_name);
+ ClassDB::bind_method(D_METHOD("get_capabilities"), &ARVRInterface::get_capabilities);
ClassDB::bind_method(D_METHOD("is_primary"), &ARVRInterface::is_primary);
ClassDB::bind_method(D_METHOD("set_is_primary", "enable"), &ARVRInterface::set_is_primary);
- ClassDB::bind_method(D_METHOD("is_installed"), &ARVRInterface::is_installed);
- ClassDB::bind_method(D_METHOD("hmd_is_present"), &ARVRInterface::hmd_is_present);
- ClassDB::bind_method(D_METHOD("supports_hmd"), &ARVRInterface::supports_hmd);
ClassDB::bind_method(D_METHOD("is_initialized"), &ARVRInterface::is_initialized);
+ ClassDB::bind_method(D_METHOD("set_is_initialized", "initialized"), &ARVRInterface::set_is_initialized);
ClassDB::bind_method(D_METHOD("initialize"), &ARVRInterface::initialize);
ClassDB::bind_method(D_METHOD("uninitialize"), &ARVRInterface::uninitialize);
+ ClassDB::bind_method(D_METHOD("get_tracking_status"), &ARVRInterface::get_tracking_status);
+
ClassDB::bind_method(D_METHOD("get_recommended_render_targetsize"), &ARVRInterface::get_recommended_render_targetsize);
+ ClassDB::bind_method(D_METHOD("is_stereo"), &ARVRInterface::is_stereo);
+
+ ADD_GROUP("Interface", "interface_");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "interface_is_primary"), "set_is_primary", "is_primary");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "interface_is_initialized"), "set_is_initialized", "is_initialized");
+
+ // we don't have any properties specific to VR yet....
- // These are now purely used internally, we may expose them again if we expose CameraMatrix through Variant but reduz is not a fan for good reasons :)
- // ClassDB::bind_method(D_METHOD("get_transform_for_eye", "eye", "cam_transform"), &ARVRInterface::get_transform_for_eye);
- // ClassDB::bind_method(D_METHOD("get_projection_for_eye", "eye"), &ARVRInterface::get_projection_for_eye);
- // ClassDB::bind_method(D_METHOD("commit_for_eye", "node:viewport"), &ARVRInterface::commit_for_eye);
+ // but we do have properties specific to AR....
+ ClassDB::bind_method(D_METHOD("get_anchor_detection_is_enabled"), &ARVRInterface::get_anchor_detection_is_enabled);
+ ClassDB::bind_method(D_METHOD("set_anchor_detection_is_enabled", "enable"), &ARVRInterface::set_anchor_detection_is_enabled);
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "primary"), "set_is_primary", "is_primary");
+ ADD_GROUP("AR", "ar_");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ar_is_anchor_detection_enabled"), "set_anchor_detection_is_enabled", "get_anchor_detection_is_enabled");
+
+ BIND_ENUM_CONSTANT(ARVR_NONE);
+ BIND_ENUM_CONSTANT(ARVR_MONO);
+ BIND_ENUM_CONSTANT(ARVR_STEREO);
+ BIND_ENUM_CONSTANT(ARVR_AR);
+ BIND_ENUM_CONSTANT(ARVR_EXTERNAL);
BIND_ENUM_CONSTANT(EYE_MONO);
BIND_ENUM_CONSTANT(EYE_LEFT);
BIND_ENUM_CONSTANT(EYE_RIGHT);
+
+ BIND_ENUM_CONSTANT(ARVR_NORMAL_TRACKING);
+ BIND_ENUM_CONSTANT(ARVR_EXCESSIVE_MOTION);
+ BIND_ENUM_CONSTANT(ARVR_INSUFFICIENT_FEATURES);
+ BIND_ENUM_CONSTANT(ARVR_UNKNOWN_TRACKING);
+ BIND_ENUM_CONSTANT(ARVR_NOT_TRACKING);
};
StringName ARVRInterface::get_name() const {
@@ -73,10 +93,40 @@ void ARVRInterface::set_is_primary(bool p_is_primary) {
if (p_is_primary) {
ERR_FAIL_COND(!is_initialized());
- ERR_FAIL_COND(!supports_hmd());
arvr_server->set_primary_interface(this);
} else {
arvr_server->clear_primary_interface_if(this);
};
};
+
+void ARVRInterface::set_is_initialized(bool p_initialized) {
+ if (p_initialized) {
+ if (!is_initialized()) {
+ initialize();
+ };
+ } else {
+ if (is_initialized()) {
+ uninitialize();
+ };
+ };
+};
+
+ARVRInterface::Tracking_status ARVRInterface::get_tracking_status() const {
+ return tracking_state;
+};
+
+ARVRInterface::ARVRInterface() {
+ tracking_state = ARVR_UNKNOWN_TRACKING;
+};
+
+ARVRInterface::~ARVRInterface(){};
+
+/** these will only be implemented on AR interfaces, so we want dummies for VR **/
+bool ARVRInterface::get_anchor_detection_is_enabled() const {
+ return false;
+};
+
+void ARVRInterface::set_anchor_detection_is_enabled(bool p_enable){
+ // don't do anything here, this needs to be implemented on AR interface to enable/disable things like plane detection etc.
+};
diff --git a/servers/arvr/arvr_interface.h b/servers/arvr/arvr_interface.h
index d4fb383bbc..880f6e4595 100644
--- a/servers/arvr/arvr_interface.h
+++ b/servers/arvr/arvr_interface.h
@@ -50,31 +50,59 @@
class ARVRInterface : public Reference {
GDCLASS(ARVRInterface, Reference);
-protected:
- _THREAD_SAFE_CLASS_
-
- static void _bind_methods();
-
public:
+ enum Capabilities { /* purely meta data, provides some info about what this interface supports */
+ ARVR_NONE = 0, /* no capabilities */
+ ARVR_MONO = 1, /* can be used with mono output */
+ ARVR_STEREO = 2, /* can be used with stereo output */
+ ARVR_AR = 4, /* offers a camera feed for AR */
+ ARVR_EXTERNAL = 8 /* renders to external device */
+ };
+
enum Eyes {
EYE_MONO, /* my son says we should call this EYE_CYCLOPS */
EYE_LEFT,
EYE_RIGHT
};
+ enum Tracking_status { /* tracking status currently based on AR but we can start doing more with this for VR as well */
+ ARVR_NORMAL_TRACKING,
+ ARVR_EXCESSIVE_MOTION,
+ ARVR_INSUFFICIENT_FEATURES,
+ ARVR_UNKNOWN_TRACKING,
+ ARVR_NOT_TRACKING
+ };
+
+protected:
+ _THREAD_SAFE_CLASS_
+
+ Tracking_status tracking_state;
+ static void _bind_methods();
+
+public:
+ /** general interface information **/
virtual StringName get_name() const;
+ virtual int get_capabilities() const = 0;
bool is_primary();
void set_is_primary(bool p_is_primary);
- virtual bool is_installed() = 0; /* returns true if the middle ware related to this interface has been installed */
- virtual bool hmd_is_present() = 0; /* returns true if our HMD is connected */
- virtual bool supports_hmd() = 0; /* returns true is this interface handles output to an HMD or only handles positioning */
-
virtual bool is_initialized() = 0; /* returns true if we've initialized this interface */
+ void set_is_initialized(bool p_initialized); /* helper function, will call initialize or uninitialize */
virtual bool initialize() = 0; /* initialize this interface, if this has an HMD it becomes the primary interface */
virtual void uninitialize() = 0; /* deinitialize this interface */
+ Tracking_status get_tracking_status() const; /* get the status of our current tracking */
+
+ /** specific to VR **/
+ // nothing yet
+
+ /** specific to AR **/
+ virtual bool get_anchor_detection_is_enabled() const;
+ virtual void set_anchor_detection_is_enabled(bool p_enable);
+
+ /** rendering and internal **/
+
virtual Size2 get_recommended_render_targetsize() = 0; /* returns the recommended render target size per eye for this device */
virtual bool is_stereo() = 0; /* returns true if this interface requires stereo rendering (for VR HMDs) or mono rendering (for mobile AR) */
virtual Transform get_transform_for_eye(ARVRInterface::Eyes p_eye, const Transform &p_cam_transform) = 0; /* get each eyes camera transform, also implement EYE_MONO */
@@ -82,8 +110,13 @@ public:
virtual void commit_for_eye(ARVRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) = 0; /* output the left or right eye */
virtual void process() = 0;
+
+ ARVRInterface();
+ ~ARVRInterface();
};
+VARIANT_ENUM_CAST(ARVRInterface::Capabilities);
VARIANT_ENUM_CAST(ARVRInterface::Eyes);
+VARIANT_ENUM_CAST(ARVRInterface::Tracking_status);
#endif
diff --git a/servers/arvr/arvr_script_interface.cpp b/servers/arvr/arvr_script_interface.cpp
index 16e607920e..2755605a14 100644
--- a/servers/arvr/arvr_script_interface.cpp
+++ b/servers/arvr/arvr_script_interface.cpp
@@ -23,20 +23,26 @@ StringName ARVRScriptInterface::get_name() const {
}
}
-bool ARVRScriptInterface::is_installed() {
- ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("is_installed")), false);
- return get_script_instance()->call("is_installed");
-}
+int ARVRScriptInterface::get_capabilities() const {
+ ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_capabilities")), ARVRInterface::ARVR_NONE);
+ return get_script_instance()->call("get_capabilities");
+};
-bool ARVRScriptInterface::hmd_is_present() {
- ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("hmd_is_present")), false);
- return get_script_instance()->call("hmd_is_present");
+ARVRInterface::Tracking_status ARVRScriptInterface::get_tracking_status() const {
+ ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_tracking_status")), ARVRInterface::ARVR_NOT_TRACKING);
+ int status = get_script_instance()->call("get_tracking_status");
+ return (ARVRInterface::Tracking_status)status;
}
-bool ARVRScriptInterface::supports_hmd() {
- ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("supports_hmd")), false);
- return get_script_instance()->call("supports_hmd");
-}
+bool ARVRScriptInterface::get_anchor_detection_is_enabled() const {
+ ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_anchor_detection_is_enabled")), false);
+ return get_script_instance()->call("get_anchor_detection_is_enabled");
+};
+
+void ARVRScriptInterface::set_anchor_detection_is_enabled(bool p_enable) {
+ ERR_FAIL_COND(!(get_script_instance() && get_script_instance()->has_method("set_anchor_detection_is_enabled")));
+ get_script_instance()->call("set_anchor_detection_is_enabled");
+};
bool ARVRScriptInterface::is_stereo() {
ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("is_stereo")), false);
@@ -110,14 +116,17 @@ void ARVRScriptInterface::process() {
}
void ARVRScriptInterface::_bind_methods() {
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "is_installed"));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "hmd_is_present"));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "supports_hmd"));
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::INT, "get_capabilities"));
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "is_initialized"));
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "initialize"));
ClassDB::add_virtual_method(get_class_static(), MethodInfo("uninitialize"));
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::INT, "get_tracking_status"));
+
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "get_anchor_detection_is_enabled"));
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo("set_anchor_detection_is_enabled", PropertyInfo(Variant::BOOL, "enabled")));
+
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "is_stereo"));
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::VECTOR2, "get_recommended_render_targetsize"));
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::TRANSFORM, "get_transform_for_eye", PropertyInfo(Variant::INT, "eye"), PropertyInfo(Variant::TRANSFORM, "cam_transform")));
diff --git a/servers/arvr/arvr_script_interface.h b/servers/arvr/arvr_script_interface.h
index 04ca33901a..b1393b4fdb 100644
--- a/servers/arvr/arvr_script_interface.h
+++ b/servers/arvr/arvr_script_interface.h
@@ -16,19 +16,24 @@ protected:
static void _bind_methods();
public:
+ /** general interface information **/
ARVRScriptInterface();
~ARVRScriptInterface();
virtual StringName get_name() const;
-
- virtual bool is_installed();
- virtual bool hmd_is_present();
- virtual bool supports_hmd();
+ virtual int get_capabilities() const;
virtual bool is_initialized();
virtual bool initialize();
virtual void uninitialize();
+ ARVRInterface::Tracking_status get_tracking_status() const; /* get the status of our current tracking */
+
+ /** specific to AR **/
+ virtual bool get_anchor_detection_is_enabled() const;
+ virtual void set_anchor_detection_is_enabled(bool p_enable);
+
+ /** rendering and internal **/
virtual Size2 get_recommended_render_targetsize();
virtual bool is_stereo();
virtual Transform get_transform_for_eye(ARVRInterface::Eyes p_eye, const Transform &p_cam_transform);
diff --git a/servers/arvr_server.cpp b/servers/arvr_server.cpp
index 5d8cf20c92..aa879f8aed 100644
--- a/servers/arvr_server.cpp
+++ b/servers/arvr_server.cpp
@@ -43,7 +43,7 @@ void ARVRServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_world_scale"), &ARVRServer::get_world_scale);
ClassDB::bind_method(D_METHOD("set_world_scale"), &ARVRServer::set_world_scale);
ClassDB::bind_method(D_METHOD("get_reference_frame"), &ARVRServer::get_reference_frame);
- ClassDB::bind_method(D_METHOD("request_reference_frame", "ignore_tilt", "keep_height"), &ARVRServer::request_reference_frame);
+ ClassDB::bind_method(D_METHOD("center_on_hmd", "ignore_tilt", "keep_height"), &ARVRServer::center_on_hmd);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "world_scale"), "set_world_scale", "get_world_scale");
@@ -98,7 +98,7 @@ Transform ARVRServer::get_reference_frame() const {
return reference_frame;
};
-void ARVRServer::request_reference_frame(bool p_ignore_tilt, bool p_keep_height) {
+void ARVRServer::center_on_hmd(bool p_ignore_tilt, bool p_keep_height) {
if (primary_interface != NULL) {
// clear our current reference frame or we'll end up double adjusting it
reference_frame = Transform();
diff --git a/servers/arvr_server.h b/servers/arvr_server.h
index 2645637ad5..948895cb27 100644
--- a/servers/arvr_server.h
+++ b/servers/arvr_server.h
@@ -117,14 +117,17 @@ public:
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)
+ center_on_hmd calculates a new reference frame. This ensures the HMD is positioned to 0,0,0 facing 0,0,-1 (need to verify this direction)
in the virtual world.
+ You can ignore the tilt of the device ensuring you're looking straight forward even if the player is looking down or sideways.
+ You can chose to keep the height the tracking provides which is important for room scale capable tracking.
+
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_reference_frame() const;
- void request_reference_frame(bool p_ignore_tilt, bool p_keep_height);
+ void center_on_hmd(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.
diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp
index b6be2fb9d6..0e3d5824d9 100644
--- a/servers/audio/audio_stream.cpp
+++ b/servers/audio/audio_stream.cpp
@@ -178,16 +178,16 @@ int AudioStreamPlaybackRandomPitch::get_loop_count() const {
return 0;
}
-float AudioStreamPlaybackRandomPitch::get_position() const {
+float AudioStreamPlaybackRandomPitch::get_playback_position() const {
if (playing.is_valid()) {
- return playing->get_position();
+ return playing->get_playback_position();
}
return 0;
}
-void AudioStreamPlaybackRandomPitch::seek_pos(float p_time) {
+void AudioStreamPlaybackRandomPitch::seek(float p_time) {
if (playing.is_valid()) {
- playing->seek_pos(p_time);
+ playing->seek(p_time);
}
}
diff --git a/servers/audio/audio_stream.h b/servers/audio/audio_stream.h
index 97178ebd7c..3324597b41 100644
--- a/servers/audio/audio_stream.h
+++ b/servers/audio/audio_stream.h
@@ -45,8 +45,8 @@ public:
virtual int get_loop_count() const = 0; //times it looped
- virtual float get_position() const = 0;
- virtual void seek_pos(float p_time) = 0;
+ virtual float get_playback_position() const = 0;
+ virtual void seek(float p_time) = 0;
virtual void mix(AudioFrame *p_bufer, float p_rate_scale, int p_frames) = 0;
@@ -133,8 +133,8 @@ public:
virtual int get_loop_count() const; //times it looped
- virtual float get_position() const;
- virtual void seek_pos(float p_time);
+ virtual float get_playback_position() const;
+ virtual void seek(float p_time);
virtual void mix(AudioFrame *p_bufer, float p_rate_scale, int p_frames);
diff --git a/servers/audio/effects/audio_effect_chorus.cpp b/servers/audio/effects/audio_effect_chorus.cpp
index 76dd585ffa..32631beb2c 100644
--- a/servers/audio/effects/audio_effect_chorus.cpp
+++ b/servers/audio/effects/audio_effect_chorus.cpp
@@ -182,9 +182,8 @@ Ref<AudioEffectInstance> AudioEffectChorus::instance() {
void AudioEffectChorus::set_voice_count(int p_voices) {
- ERR_FAIL_COND(p_voices < 1 || p_voices >= MAX_VOICES);
+ ERR_FAIL_COND(p_voices < 1 || p_voices > MAX_VOICES);
voice_count = p_voices;
- _change_notify();
}
int AudioEffectChorus::get_voice_count() const {
diff --git a/servers/audio/effects/audio_effect_limiter.cpp b/servers/audio/effects/audio_effect_limiter.cpp
index 9787ba8109..c50dd804f2 100644
--- a/servers/audio/effects/audio_effect_limiter.cpp
+++ b/servers/audio/effects/audio_effect_limiter.cpp
@@ -110,7 +110,7 @@ void AudioEffectLimiter::set_soft_clip_ratio(float p_soft_clip) {
}
float AudioEffectLimiter::get_soft_clip_ratio() const {
- return soft_clip;
+ return soft_clip_ratio;
}
void AudioEffectLimiter::_bind_methods() {
diff --git a/servers/physics/physics_server_sw.cpp b/servers/physics/physics_server_sw.cpp
index a0c9f9cd42..a7c31cf16c 100644
--- a/servers/physics/physics_server_sw.cpp
+++ b/servers/physics/physics_server_sw.cpp
@@ -183,7 +183,7 @@ PhysicsDirectSpaceState *PhysicsServerSW::space_get_direct_state(RID p_space) {
ERR_FAIL_COND_V(!space, NULL);
if (!doing_sync || space->is_locked()) {
- ERR_EXPLAIN("Space state is inaccessible right now, wait for iteration or fixed process notification.");
+ ERR_EXPLAIN("Space state is inaccessible right now, wait for iteration or physics process notification.");
ERR_FAIL_V(NULL);
}
@@ -914,6 +914,21 @@ bool PhysicsServerSW::body_test_motion(RID p_body, const Transform &p_from, cons
return body->get_space()->test_body_motion(body, p_from, p_motion, p_margin, r_result);
}
+PhysicsDirectBodyState *PhysicsServerSW::body_get_direct_state(RID p_body) {
+
+ BodySW *body = body_owner.get(p_body);
+ ERR_FAIL_COND_V(!body, NULL);
+
+ if (!doing_sync || body->get_space()->is_locked()) {
+
+ ERR_EXPLAIN("Body state is inaccessible right now, wait for iteration or physics process notification.");
+ ERR_FAIL_V(NULL);
+ }
+
+ direct_state->body = body;
+ return direct_state;
+}
+
/* JOINT API */
RID PhysicsServerSW::joint_create_pin(RID p_body_A, const Vector3 &p_local_A, RID p_body_B, const Vector3 &p_local_B) {
diff --git a/servers/physics/physics_server_sw.h b/servers/physics/physics_server_sw.h
index 99ba302acd..f9eb8fa454 100644
--- a/servers/physics/physics_server_sw.h
+++ b/servers/physics/physics_server_sw.h
@@ -95,7 +95,7 @@ public:
virtual void space_set_param(RID p_space, SpaceParameter p_param, real_t p_value);
virtual real_t space_get_param(RID p_space, SpaceParameter p_param) const;
- // this function only works on fixed process, errors and returns null otherwise
+ // this function only works on physics process, errors and returns null otherwise
virtual PhysicsDirectSpaceState *space_get_direct_state(RID p_space);
virtual void space_set_debug_contacts(RID p_space, int p_max_contacts);
@@ -223,6 +223,9 @@ public:
virtual bool body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, float p_margin = 0.001, MotionResult *r_result = NULL);
+ // this function only works on physics process, errors and returns null otherwise
+ virtual PhysicsDirectBodyState *body_get_direct_state(RID p_body);
+
/* JOINT API */
virtual RID joint_create_pin(RID p_body_A, const Vector3 &p_local_A, RID p_body_B, const Vector3 &p_local_B);
diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp
index e9e7122af3..df3bf72a31 100644
--- a/servers/physics_2d/physics_2d_server_sw.cpp
+++ b/servers/physics_2d/physics_2d_server_sw.cpp
@@ -270,7 +270,7 @@ Physics2DDirectSpaceState *Physics2DServerSW::space_get_direct_state(RID p_space
ERR_FAIL_COND_V(!space, NULL);
if ((using_threads && !doing_sync) || space->is_locked()) {
- ERR_EXPLAIN("Space state is inaccessible right now, wait for iteration or fixed process notification.");
+ ERR_EXPLAIN("Space state is inaccessible right now, wait for iteration or physics process notification.");
ERR_FAIL_V(NULL);
}
@@ -954,6 +954,21 @@ bool Physics2DServerSW::body_test_motion(RID p_body, const Transform2D &p_from,
return body->get_space()->test_body_motion(body, p_from, p_motion, p_margin, r_result);
}
+Physics2DDirectBodyState *Physics2DServerSW::body_get_direct_state(RID p_body) {
+
+ Body2DSW *body = body_owner.get(p_body);
+ ERR_FAIL_COND_V(!body, NULL);
+
+ if ((using_threads && !doing_sync) || body->get_space()->is_locked()) {
+
+ ERR_EXPLAIN("Body state is inaccessible right now, wait for iteration or physics process notification.");
+ ERR_FAIL_V(NULL);
+ }
+
+ direct_state->body = body;
+ return direct_state;
+}
+
/* JOINT API */
void Physics2DServerSW::joint_set_param(RID p_joint, JointParam p_param, real_t p_value) {
diff --git a/servers/physics_2d/physics_2d_server_sw.h b/servers/physics_2d/physics_2d_server_sw.h
index dd310d7a93..c40cf0e3e0 100644
--- a/servers/physics_2d/physics_2d_server_sw.h
+++ b/servers/physics_2d/physics_2d_server_sw.h
@@ -103,7 +103,7 @@ public:
virtual Vector<Vector2> space_get_contacts(RID p_space) const;
virtual int space_get_contact_count(RID p_space) const;
- // this function only works on fixed process, errors and returns null otherwise
+ // this function only works on physics process, errors and returns null otherwise
virtual Physics2DDirectSpaceState *space_get_direct_state(RID p_space);
/* AREA API */
@@ -222,6 +222,9 @@ public:
virtual bool body_test_motion(RID p_body, const Transform2D &p_from, const Vector2 &p_motion, real_t p_margin = 0.001, MotionResult *r_result = NULL);
+ // this function only works on physics process, errors and returns null otherwise
+ virtual Physics2DDirectBodyState *body_get_direct_state(RID p_body);
+
/* JOINT API */
virtual void joint_set_param(RID p_joint, JointParam p_param, real_t p_value);
diff --git a/servers/physics_2d/physics_2d_server_wrap_mt.cpp b/servers/physics_2d/physics_2d_server_wrap_mt.cpp
index a4e6abfd45..f8f3b620d4 100644
--- a/servers/physics_2d/physics_2d_server_wrap_mt.cpp
+++ b/servers/physics_2d/physics_2d_server_wrap_mt.cpp
@@ -109,16 +109,13 @@ void Physics2DServerWrapMT::init() {
if (create_thread) {
step_sem = Semaphore::create();
- print_line("CREATING PHYSICS 2D THREAD");
//OS::get_singleton()->release_rendering_thread();
if (create_thread) {
thread = Thread::create(_thread_callback, this);
- print_line("STARTING PHYISICS 2D THREAD");
}
while (!step_thread_up) {
OS::get_singleton()->delay_usec(1000);
}
- print_line("DONE PHYSICS 2D THREAD");
} else {
physics_2d_server->init();
diff --git a/servers/physics_2d/physics_2d_server_wrap_mt.h b/servers/physics_2d/physics_2d_server_wrap_mt.h
index 189419e8e4..50e9ab1005 100644
--- a/servers/physics_2d/physics_2d_server_wrap_mt.h
+++ b/servers/physics_2d/physics_2d_server_wrap_mt.h
@@ -111,7 +111,7 @@ public:
FUNC3(space_set_param, RID, SpaceParameter, real_t);
FUNC2RC(real_t, space_get_param, RID, SpaceParameter);
- // this function only works on fixed process, errors and returns null otherwise
+ // this function only works on physics process, errors and returns null otherwise
Physics2DDirectSpaceState *space_get_direct_state(RID p_space) {
ERR_FAIL_COND_V(main_thread != Thread::get_caller_id(), NULL);
@@ -253,6 +253,13 @@ public:
return physics_2d_server->body_test_motion(p_body, p_from, p_motion, p_margin, r_result);
}
+ // this function only works on physics process, errors and returns null otherwise
+ Physics2DDirectBodyState *body_get_direct_state(RID p_body) {
+
+ ERR_FAIL_COND_V(main_thread != Thread::get_caller_id(), NULL);
+ return physics_2d_server->body_get_direct_state(p_body);
+ }
+
/* JOINT API */
FUNC3(joint_set_param, RID, JointParam, real_t);
diff --git a/servers/physics_2d_server.cpp b/servers/physics_2d_server.cpp
index b42b85b1be..671c31e6a3 100644
--- a/servers/physics_2d_server.cpp
+++ b/servers/physics_2d_server.cpp
@@ -579,6 +579,8 @@ void Physics2DServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("body_test_motion", "body", "from", "motion", "margin", "result"), &Physics2DServer::_body_test_motion, DEFVAL(0.08), DEFVAL(Variant()));
+ ClassDB::bind_method(D_METHOD("body_get_direct_state", "body"), &Physics2DServer::body_get_direct_state);
+
/* JOINT API */
ClassDB::bind_method(D_METHOD("joint_set_param", "joint", "param", "value"), &Physics2DServer::joint_set_param);
diff --git a/servers/physics_2d_server.h b/servers/physics_2d_server.h
index ddf89663c0..18f4f460b6 100644
--- a/servers/physics_2d_server.h
+++ b/servers/physics_2d_server.h
@@ -283,7 +283,7 @@ public:
virtual void space_set_param(RID p_space, SpaceParameter p_param, real_t p_value) = 0;
virtual real_t space_get_param(RID p_space, SpaceParameter p_param) const = 0;
- // this function only works on fixed process, errors and returns null otherwise
+ // this function only works on physics process, errors and returns null otherwise
virtual Physics2DDirectSpaceState *space_get_direct_state(RID p_space) = 0;
virtual void space_set_debug_contacts(RID p_space, int p_max_contacts) = 0;
@@ -468,6 +468,9 @@ public:
virtual void body_set_pickable(RID p_body, bool p_pickable) = 0;
+ // this function only works on physics process, errors and returns null otherwise
+ virtual Physics2DDirectBodyState *body_get_direct_state(RID p_body) = 0;
+
struct MotionResult {
Vector2 motion;
diff --git a/servers/physics_server.cpp b/servers/physics_server.cpp
index 0e54867ee1..6d192886a5 100644
--- a/servers/physics_server.cpp
+++ b/servers/physics_server.cpp
@@ -504,6 +504,8 @@ void PhysicsServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("body_set_ray_pickable", "body", "enable"), &PhysicsServer::body_set_ray_pickable);
ClassDB::bind_method(D_METHOD("body_is_ray_pickable", "body"), &PhysicsServer::body_is_ray_pickable);
+ ClassDB::bind_method(D_METHOD("body_get_direct_state", "body"), &PhysicsServer::body_get_direct_state);
+
/* JOINT API */
BIND_ENUM_CONSTANT(JOINT_PIN);
diff --git a/servers/physics_server.h b/servers/physics_server.h
index 32aaafa28c..8cec125646 100644
--- a/servers/physics_server.h
+++ b/servers/physics_server.h
@@ -276,7 +276,7 @@ public:
virtual void space_set_param(RID p_space, SpaceParameter p_param, real_t p_value) = 0;
virtual real_t space_get_param(RID p_space, SpaceParameter p_param) const = 0;
- // this function only works on fixed process, errors and returns null otherwise
+ // this function only works on physics process, errors and returns null otherwise
virtual PhysicsDirectSpaceState *space_get_direct_state(RID p_space) = 0;
virtual void space_set_debug_contacts(RID p_space, int p_max_contacts) = 0;
@@ -464,6 +464,9 @@ public:
virtual void body_set_ray_pickable(RID p_body, bool p_enable) = 0;
virtual bool body_is_ray_pickable(RID p_body) const = 0;
+ // this function only works on physics process, errors and returns null otherwise
+ virtual PhysicsDirectBodyState *body_get_direct_state(RID p_body) = 0;
+
struct MotionResult {
Vector3 motion;
diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp
index 845a3443b7..1aee2144aa 100644
--- a/servers/register_server_types.cpp
+++ b/servers/register_server_types.cpp
@@ -79,6 +79,12 @@ ARVRServer *arvr_server = NULL;
void register_server_types() {
arvr_server = memnew(ARVRServer);
+ ClassDB::register_virtual_class<VisualServer>();
+ ClassDB::register_class<AudioServer>();
+ ClassDB::register_virtual_class<PhysicsServer>();
+ ClassDB::register_virtual_class<Physics2DServer>();
+ ClassDB::register_class<ARVRServer>();
+
ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("VisualServer", VisualServer::get_singleton()));
ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("AudioServer", AudioServer::get_singleton()));
ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("PhysicsServer", PhysicsServer::get_singleton()));
@@ -95,6 +101,8 @@ void register_server_types() {
ClassDB::register_virtual_class<AudioStreamPlayback>();
ClassDB::register_class<AudioStreamRandomPitch>();
ClassDB::register_virtual_class<AudioEffect>();
+ ClassDB::register_class<AudioEffectEQ>();
+ ClassDB::register_class<AudioEffectFilter>();
ClassDB::register_class<AudioBusLayout>();
{
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index 344c10089a..b3f6b243de 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -53,7 +53,7 @@ public:
virtual void environment_set_background(RID p_env, VS::EnvironmentBG p_bg) = 0;
virtual void environment_set_sky(RID p_env, RID p_sky) = 0;
- virtual void environment_set_sky_scale(RID p_env, float p_scale) = 0;
+ virtual void environment_set_sky_custom_fov(RID p_env, float p_scale) = 0;
virtual void environment_set_bg_color(RID p_env, const Color &p_color) = 0;
virtual void environment_set_bg_energy(RID p_env, float p_energy) = 0;
virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer) = 0;
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp
index 6ad433268f..b2a11deea1 100644
--- a/servers/visual/shader_language.cpp
+++ b/servers/visual/shader_language.cpp
@@ -267,6 +267,7 @@ const ShaderLanguage::KeyWord ShaderLanguage::keyword_list[] = {
{ TK_CF_BREAK, "break" },
{ TK_CF_CONTINUE, "continue" },
{ TK_CF_RETURN, "return" },
+ { TK_CF_DISCARD, "discard" },
{ TK_UNIFORM, "uniform" },
{ TK_VARYING, "varying" },
{ TK_ARG_IN, "in" },
@@ -1377,6 +1378,10 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = {
{ "sqrt", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID } },
{ "sqrt", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID } },
{ "sqrt", TYPE_VEC4, { TYPE_VEC4, TYPE_VOID } },
+ { "inversesqrt", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID } },
+ { "inversesqrt", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID } },
+ { "inversesqrt", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID } },
+ { "inversesqrt", TYPE_VEC4, { TYPE_VEC4, TYPE_VOID } },
//builtins - common
{ "abs", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID } },
{ "abs", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID } },
@@ -1740,8 +1745,6 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = {
{ "textureGrad", TYPE_UVEC4, { TYPE_USAMPLER2D, TYPE_VEC2, TYPE_VEC2, TYPE_VEC2, TYPE_VOID } },
{ "textureGrad", TYPE_VEC4, { TYPE_SAMPLERCUBE, TYPE_VEC3, TYPE_VEC3, TYPE_VEC3, TYPE_VOID } },
- { "textureScreen", TYPE_VEC4, { TYPE_VEC2, TYPE_VOID } },
-
{ "dFdx", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID } },
{ "dFdx", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID } },
{ "dFdx", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID } },
@@ -3800,6 +3803,10 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
func_node->return_type = type;
func_node->return_precision = precision;
+ if (p_functions.has(name)) {
+ func_node->can_discard = p_functions[name].can_discard;
+ }
+
func_node->body = alloc_node<BlockNode>();
func_node->body->parent_function = func_node;
diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp
index 91c5d430f5..7489ca7e3e 100644
--- a/servers/visual/shader_types.cpp
+++ b/servers/visual/shader_types.cpp
@@ -50,12 +50,6 @@ ShaderTypes::ShaderTypes() {
/*************** SPATIAL ***********************/
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["SRC_VERTEX"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["SRC_NORMAL"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["SRC_BONES"] = ShaderLanguage::TYPE_IVEC4;
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["SRC_WEIGHTS"] = ShaderLanguage::TYPE_VEC4;
-
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["POSITION"] = ShaderLanguage::TYPE_VEC4;
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["VERTEX"] = ShaderLanguage::TYPE_VEC3;
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["NORMAL"] = ShaderLanguage::TYPE_VEC3;
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["TANGENT"] = ShaderLanguage::TYPE_VEC3;
@@ -75,6 +69,7 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["CAMERA_MATRIX"] = ShaderLanguage::TYPE_MAT4;
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["PROJECTION_MATRIX"] = ShaderLanguage::TYPE_MAT4;
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["MODELVIEW_MATRIX"] = ShaderLanguage::TYPE_MAT4;
+ shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["INV_PROJECTION_MATRIX"] = ShaderLanguage::TYPE_MAT4;
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["TIME"] = ShaderLanguage::TYPE_FLOAT;
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["VIEWPORT_SIZE"] = ShaderLanguage::TYPE_VEC2;
@@ -89,7 +84,6 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["UV"] = ShaderLanguage::TYPE_VEC2;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["UV2"] = ShaderLanguage::TYPE_VEC2;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["COLOR"] = ShaderLanguage::TYPE_VEC4;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["NORMAL"] = ShaderLanguage::TYPE_VEC3;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["ALBEDO"] = ShaderLanguage::TYPE_VEC3;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["ALPHA"] = ShaderLanguage::TYPE_FLOAT;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["METALLIC"] = ShaderLanguage::TYPE_FLOAT;
@@ -104,6 +98,7 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["SSS_STRENGTH"] = ShaderLanguage::TYPE_FLOAT;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["TRANSMISSION"] = ShaderLanguage::TYPE_VEC3;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["AO"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["AO_LIGHT_AFFECT"] = ShaderLanguage::TYPE_FLOAT;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["EMISSION"] = ShaderLanguage::TYPE_VEC3;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["SCREEN_TEXTURE"] = ShaderLanguage::TYPE_SAMPLER2D;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["DEPTH_TEXTURE"] = ShaderLanguage::TYPE_SAMPLER2D;
@@ -115,10 +110,31 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["WORLD_MATRIX"] = ShaderLanguage::TYPE_MAT4;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["INV_CAMERA_MATRIX"] = ShaderLanguage::TYPE_MAT4;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["PROJECTION_MATRIX"] = ShaderLanguage::TYPE_MAT4;
+ shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["INV_PROJECTION_MATRIX"] = ShaderLanguage::TYPE_MAT4;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["TIME"] = ShaderLanguage::TYPE_FLOAT;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["VIEWPORT_SIZE"] = ShaderLanguage::TYPE_VEC2;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].can_discard = true;
+ shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["WORLD_MATRIX"] = ShaderLanguage::TYPE_MAT4;
+ shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["INV_CAMERA_MATRIX"] = ShaderLanguage::TYPE_MAT4;
+ shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["PROJECTION_MATRIX"] = ShaderLanguage::TYPE_MAT4;
+ shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["INV_PROJECTION_MATRIX"] = ShaderLanguage::TYPE_MAT4;
+ shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["TIME"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["VIEWPORT_SIZE"] = ShaderLanguage::TYPE_VEC2;
+
+ shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["NORMAL"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["VIEW"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["LIGHT"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["LIGHT_COLOR"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["ATTENUATION"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["ALBEDO"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["TRANSMISSION"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["ROUGHNESS"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["DIFFUSE_LIGHT"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["SPECULAR_LIGHT"] = ShaderLanguage::TYPE_VEC3;
+
+ shader_modes[VS::SHADER_SPATIAL].functions["light"].can_discard = true;
+
shader_modes[VS::SHADER_SPATIAL].modes.insert("blend_mix");
shader_modes[VS::SHADER_SPATIAL].modes.insert("blend_add");
shader_modes[VS::SHADER_SPATIAL].modes.insert("blend_sub");
@@ -156,21 +172,19 @@ ShaderTypes::ShaderTypes() {
/************ CANVAS ITEM **************************/
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["SRC_VERTEX"] = ShaderLanguage::TYPE_VEC2;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["VERTEX"] = ShaderLanguage::TYPE_VEC2;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["UV"] = ShaderLanguage::TYPE_VEC2;
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["VERTEX_COLOR"] = ShaderLanguage::TYPE_VEC4;
+ shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["COLOR"] = ShaderLanguage::TYPE_VEC4;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["POINT_SIZE"] = ShaderLanguage::TYPE_FLOAT;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["WORLD_MATRIX"] = ShaderLanguage::TYPE_MAT4;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["PROJECTION_MATRIX"] = ShaderLanguage::TYPE_MAT4;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["EXTRA_MATRIX"] = ShaderLanguage::TYPE_MAT4;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["TIME"] = ShaderLanguage::TYPE_FLOAT;
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["PARTICLE_CUSTOM"] = ShaderLanguage::TYPE_VEC4;
+ shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["INSTANCE_CUSTOM"] = ShaderLanguage::TYPE_VEC4;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["AT_LIGHT_PASS"] = ShaderLanguage::TYPE_BOOL;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].can_discard = false;
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["SRC_COLOR"] = ShaderLanguage::TYPE_VEC4;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["FRAGCOORD"] = ShaderLanguage::TYPE_VEC4;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["NORMAL"] = ShaderLanguage::TYPE_VEC3;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["NORMALMAP"] = ShaderLanguage::TYPE_VEC3;
@@ -179,13 +193,13 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["COLOR"] = ShaderLanguage::TYPE_VEC4;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["TEXTURE"] = ShaderLanguage::TYPE_SAMPLER2D;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["TEXTURE_PIXEL_SIZE"] = ShaderLanguage::TYPE_VEC2;
+ shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["NORMAL_TEXTURE"] = ShaderLanguage::TYPE_SAMPLER2D;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["SCREEN_UV"] = ShaderLanguage::TYPE_VEC2;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["SCREEN_PIXEL_SIZE"] = ShaderLanguage::TYPE_VEC2;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["POINT_COORD"] = ShaderLanguage::TYPE_VEC2;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["TIME"] = ShaderLanguage::TYPE_FLOAT;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["AT_LIGHT_PASS"] = ShaderLanguage::TYPE_BOOL;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["SCREEN_TEXTURE"] = ShaderLanguage::TYPE_SAMPLER2D;
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["SCREEN_UV"] = ShaderLanguage::TYPE_VEC2;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].can_discard = true;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["POSITION"] = ShaderLanguage::TYPE_VEC2;
diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h
index 7c7ce46268..888fb29f93 100644
--- a/servers/visual/visual_server_raster.h
+++ b/servers/visual/visual_server_raster.h
@@ -589,11 +589,29 @@ class VisualServerRaster : public VisualServer {
#endif
void _draw_margins();
+ static void _changes_changed() {}
public:
+//if editor is redrawing when it shouldn't, enable this and put a breakpoint in _changes_changed()
+//#define DEBUG_CHANGES
+
+#ifdef DEBUG_CHANGES
+ _FORCE_INLINE_ static void redraw_request() {
+ changes++;
+ _changes_changed();
+ }
+
+#define DISPLAY_CHANGED \
+ changes++; \
+ _changes_changed();
+
+#else
_FORCE_INLINE_ static void redraw_request() { changes++; }
-#define DISPLAY_CHANGED changes++;
+#define DISPLAY_CHANGED \
+ changes++;
+#endif
+// print_line(String("CHANGED: ") + __FUNCTION__);
#define BIND0R(m_r, m_name) \
m_r m_name() { return BINDBASE->m_name(); }
@@ -950,7 +968,7 @@ public:
BIND2(environment_set_background, RID, EnvironmentBG)
BIND2(environment_set_sky, RID, RID)
- BIND2(environment_set_sky_scale, RID, float)
+ BIND2(environment_set_sky_custom_fov, RID, float)
BIND2(environment_set_bg_color, RID, const Color &)
BIND2(environment_set_bg_energy, RID, float)
BIND2(environment_set_canvas_max_layer, RID, int)
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp
index 9fb4dc524d..e49baf0763 100644
--- a/servers/visual/visual_server_scene.cpp
+++ b/servers/visual/visual_server_scene.cpp
@@ -2348,7 +2348,7 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) {
RID rid = E->key();
const InstanceGIProbeData::LightCache &lc = E->get();
- if (!probe_data->dynamic.light_cache_changes.has(rid) || !(probe_data->dynamic.light_cache_changes[rid] == lc)) {
+ if ((!probe_data->dynamic.light_cache_changes.has(rid) || !(probe_data->dynamic.light_cache_changes[rid] == lc)) && lc.visible) {
//erase light data
_bake_gi_probe_light(header, cells, local_data, leaves, leaf_count, lc, -1);
@@ -2361,7 +2361,7 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) {
RID rid = E->key();
const InstanceGIProbeData::LightCache &lc = E->get();
- if (!probe_data->dynamic.light_cache.has(rid) || !(probe_data->dynamic.light_cache[rid] == lc)) {
+ if ((!probe_data->dynamic.light_cache.has(rid) || !(probe_data->dynamic.light_cache[rid] == lc)) && lc.visible) {
//add light data
_bake_gi_probe_light(header, cells, local_data, leaves, leaf_count, lc, 1);
@@ -2568,6 +2568,7 @@ bool VisualServerScene::_check_gi_probe(Instance *p_gi_probe) {
lc.spot_angle = VSG::storage->light_get_param(E->get()->base, VS::LIGHT_PARAM_SPOT_ANGLE);
lc.spot_attenuation = VSG::storage->light_get_param(E->get()->base, VS::LIGHT_PARAM_SPOT_ATTENUATION);
lc.transform = probe_data->dynamic.light_to_cell_xform * E->get()->transform;
+ lc.visible = E->get()->visible;
if (!probe_data->dynamic.light_cache.has(E->get()->self) || !(probe_data->dynamic.light_cache[E->get()->self] == lc)) {
all_equal = false;
@@ -2587,6 +2588,7 @@ bool VisualServerScene::_check_gi_probe(Instance *p_gi_probe) {
lc.spot_angle = VSG::storage->light_get_param(E->get()->base, VS::LIGHT_PARAM_SPOT_ANGLE);
lc.spot_attenuation = VSG::storage->light_get_param(E->get()->base, VS::LIGHT_PARAM_SPOT_ATTENUATION);
lc.transform = probe_data->dynamic.light_to_cell_xform * E->get()->transform;
+ lc.visible = E->get()->visible;
if (!probe_data->dynamic.light_cache.has(E->get()->self) || !(probe_data->dynamic.light_cache[E->get()->self] == lc)) {
all_equal = false;
diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h
index ac771030cf..d30a2108a5 100644
--- a/servers/visual/visual_server_scene.h
+++ b/servers/visual/visual_server_scene.h
@@ -359,6 +359,7 @@ public:
float attenuation;
float spot_angle;
float spot_attenuation;
+ bool visible;
bool operator==(const LightCache &p_cache) {
@@ -369,7 +370,8 @@ public:
radius == p_cache.radius &&
attenuation == p_cache.attenuation &&
spot_angle == p_cache.spot_angle &&
- spot_attenuation == p_cache.spot_attenuation);
+ spot_attenuation == p_cache.spot_attenuation &&
+ visible == p_cache.visible);
}
LightCache() {
@@ -380,6 +382,7 @@ public:
attenuation = 1.0;
spot_angle = 1.0;
spot_attenuation = 1.0;
+ visible = true;
}
};
diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h
index 5cf941b93d..caec890217 100644
--- a/servers/visual/visual_server_wrap_mt.h
+++ b/servers/visual/visual_server_wrap_mt.h
@@ -381,7 +381,7 @@ public:
FUNC2(environment_set_background, RID, EnvironmentBG)
FUNC2(environment_set_sky, RID, RID)
- FUNC2(environment_set_sky_scale, RID, float)
+ FUNC2(environment_set_sky_custom_fov, RID, float)
FUNC2(environment_set_bg_color, RID, const Color &)
FUNC2(environment_set_bg_energy, RID, float)
FUNC2(environment_set_canvas_max_layer, RID, int)
diff --git a/servers/visual_server.h b/servers/visual_server.h
index 72f36f6b65..1cc097f50e 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -85,7 +85,7 @@ public:
enum TextureFlags {
TEXTURE_FLAG_MIPMAPS = 1, /// Enable automatic mipmap generation - when available
TEXTURE_FLAG_REPEAT = 2, /// Repeat texture (Tiling), otherwise Clamping
- TEXTURE_FLAG_FILTER = 4, /// Create texure with linear (or available) filter
+ TEXTURE_FLAG_FILTER = 4, /// Create texture with linear (or available) filter
TEXTURE_FLAG_ANISOTROPIC_FILTER = 8,
TEXTURE_FLAG_CONVERT_TO_LINEAR = 16,
TEXTURE_FLAG_MIRRORED_REPEAT = 32, /// Repeat texture, with alternate sections mirrored
@@ -637,7 +637,7 @@ public:
virtual void environment_set_background(RID p_env, EnvironmentBG p_bg) = 0;
virtual void environment_set_sky(RID p_env, RID p_sky) = 0;
- virtual void environment_set_sky_scale(RID p_env, float p_scale) = 0;
+ virtual void environment_set_sky_custom_fov(RID p_env, float p_scale) = 0;
virtual void environment_set_bg_color(RID p_env, const Color &p_color) = 0;
virtual void environment_set_bg_energy(RID p_env, float p_energy) = 0;
virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer) = 0;
diff --git a/thirdparty/README.md b/thirdparty/README.md
index c081ad29b6..6e1dcb8df4 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -73,7 +73,7 @@ Use UI font if exists, because it has tight vertial metrix and good for UI.
## freetype
- Upstream: https://www.freetype.org
-- Version: 2.8
+- Version: 2.8.1
- License: FreeType License (BSD-like)
Files extracted from upstream source:
diff --git a/thirdparty/freetype/include/freetype/config/ftoption.h b/thirdparty/freetype/include/freetype/config/ftoption.h
index 1bf6e8f534..2fbe80b9b4 100644
--- a/thirdparty/freetype/include/freetype/config/ftoption.h
+++ b/thirdparty/freetype/include/freetype/config/ftoption.h
@@ -107,20 +107,17 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
- /* Uncomment the line below if you want to activate sub-pixel rendering */
- /* (a.k.a. LCD rendering, or ClearType) in this build of the library. */
+ /* Uncomment the line below if you want to activate LCD rendering */
+ /* technology similar to ClearType in this build of the library. This */
+ /* technology triples the resolution in the direction color subpixels. */
+ /* To mitigate color fringes inherent to this technology, you also need */
+ /* to explicitly set up LCD filtering. */
/* */
/* Note that this feature is covered by several Microsoft patents */
/* and should not be activated in any default build of the library. */
- /* */
- /* This macro has no impact on the FreeType API, only on its */
- /* _implementation_. For example, using FT_RENDER_MODE_LCD when calling */
- /* FT_Render_Glyph still generates a bitmap that is 3 times wider than */
- /* the original size in case this macro isn't defined; however, each */
- /* triplet of subpixels has R=G=B. */
- /* */
- /* This is done to allow FreeType clients to run unmodified, forcing */
- /* them to display normal gray-level anti-aliased glyphs. */
+ /* When this macro is not defined, FreeType offers alternative LCD */
+ /* rendering technology that produces excellent output without LCD */
+ /* filtering. */
/* */
/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
@@ -327,7 +324,7 @@ FT_BEGIN_HEADER
/* */
/* - The TrueType driver will provide its own set of glyph names, */
/* if you build it to support postscript names in the TrueType */
- /* `post' table. */
+ /* `post' table, but will not synthesize a missing Unicode charmap. */
/* */
/* - The Type 1 driver will not be able to synthesize a Unicode */
/* charmap out of the glyphs found in the fonts. */
diff --git a/thirdparty/freetype/include/freetype/freetype.h b/thirdparty/freetype/include/freetype/freetype.h
index 2989fbb5e1..b0c261799a 100644
--- a/thirdparty/freetype/include/freetype/freetype.h
+++ b/thirdparty/freetype/include/freetype/freetype.h
@@ -575,7 +575,8 @@ FT_BEGIN_HEADER
/* <Note> */
/* When a new face is created (either through @FT_New_Face or */
/* @FT_Open_Face), the library looks for a Unicode charmap within */
- /* the list and automatically activates it. */
+ /* the list and automatically activates it. If there is no Unicode */
+ /* charmap, FreeType doesn't set an `active' charmap. */
/* */
/* <Also> */
/* See @FT_CharMapRec for the publicly accessible fields of a given */
@@ -1529,7 +1530,13 @@ FT_BEGIN_HEADER
/* values of the corresponding fields in @FT_FaceRec. Some values */
/* like ascender or descender are rounded for historical reasons; */
/* more precise values (for outline fonts) can be derived by scaling */
- /* the corresponding @FT_FaceRec values manually. */
+ /* the corresponding @FT_FaceRec values manually, with code similar */
+ /* to the following. */
+ /* */
+ /* { */
+ /* scaled_ascender = FT_MulFix( face->root.ascender, */
+ /* size_metrics->y_scale ); */
+ /* } */
/* */
/* Note that due to glyph hinting and the selected rendering mode */
/* these values are usually not exact; consequently, they must be */
@@ -1774,7 +1781,7 @@ FT_BEGIN_HEADER
/* and add it to `origin_x'> */
/* */
/* origin_x += slot->advance.x; */
- /* origin_x += slot->rsb_delta - slot->lsb_relta; */
+ /* origin_x += slot->rsb_delta - slot->lsb_delta; */
/* endfor */
/* } */
/* */
@@ -1794,9 +1801,9 @@ FT_BEGIN_HEADER
/* */
/* <load glyph with `FT_Load_Glyph'> */
/* */
- /* if ( prev_rsb_delta - slot->lsb_delta >= 32 ) */
+ /* if ( prev_rsb_delta - slot->lsb_delta > 32 ) */
/* origin_x -= 64; */
- /* else if ( prev_rsb_delta - slot->lsb_delta < -32 ) */
+ /* else if ( prev_rsb_delta - slot->lsb_delta < -31 ) */
/* origin_x += 64; */
/* */
/* prev_rsb_delta = slot->rsb_delta; */
@@ -3124,11 +3131,13 @@ FT_BEGIN_HEADER
/* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */
/* */
/* <Note> */
- /* The LCD-optimized glyph bitmaps produced by `FT_Render_Glyph' can */
- /* be filtered to reduce color-fringes by using */
- /* @FT_Library_SetLcdFilter (not active in the default builds). It */
- /* is up to the caller to either call `FT_Library_SetLcdFilter' (if */
- /* available) or do the filtering itself. */
+ /* Should you define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your */
+ /* `ftoption.h', which enables patented ClearType-style rendering, */
+ /* the LCD-optimized glyph bitmaps should be filtered to reduce color */
+ /* fringes inherent to this technology. You can either set up LCD */
+ /* filtering with @FT_Library_SetLcdFilter or @FT_Face_Properties, */
+ /* or do the filtering yourself. The default FreeType LCD rendering */
+ /* technology does not require filtering. */
/* */
/* The selected render mode only affects vector glyphs of a font. */
/* Embedded bitmaps often have a different pixel mode like */
@@ -4327,6 +4336,9 @@ FT_BEGIN_HEADER
/* `a' rounded to the nearest 16.16 fixed integer, halfway cases away */
/* from zero. */
/* */
+ /* <Note> */
+ /* The function uses wrap-around arithmetic. */
+ /* */
FT_EXPORT( FT_Fixed )
FT_RoundFix( FT_Fixed a );
@@ -4345,6 +4357,9 @@ FT_BEGIN_HEADER
/* <Return> */
/* `a' rounded towards plus infinity. */
/* */
+ /* <Note> */
+ /* The function uses wrap-around arithmetic. */
+ /* */
FT_EXPORT( FT_Fixed )
FT_CeilFix( FT_Fixed a );
@@ -4442,7 +4457,7 @@ FT_BEGIN_HEADER
*/
#define FREETYPE_MAJOR 2
#define FREETYPE_MINOR 8
-#define FREETYPE_PATCH 0
+#define FREETYPE_PATCH 1
/*************************************************************************/
diff --git a/thirdparty/freetype/include/freetype/ftautoh.h b/thirdparty/freetype/include/freetype/ftautoh.h
index abd540f0b5..2bb675ae46 100644
--- a/thirdparty/freetype/include/freetype/ftautoh.h
+++ b/thirdparty/freetype/include/freetype/ftautoh.h
@@ -404,12 +404,12 @@ FT_BEGIN_HEADER
* activate the warp hinting code in the auto-hinter, this property
* switches warping on and off.
*
- * Warping only works in `light' auto-hinting mode. The idea of the
- * code is to slightly scale and shift a glyph along the non-hinted
- * dimension (which is usually the horizontal axis) so that as much of
- * its segments are aligned (more or less) to the grid. To find out a
- * glyph's optimal scaling and shifting value, various parameter
- * combinations are tried and scored.
+ * Warping only works in `normal' auto-hinting mode replacing it.
+ * The idea of the code is to slightly scale and shift a glyph along
+ * the non-hinted dimension (which is usually the horizontal axis) so
+ * that as much of its segments are aligned (more or less) to the grid.
+ * To find out a glyph's optimal scaling and shifting value, various
+ * parameter combinations are tried and scored.
*
* By default, warping is off. The example below shows how to switch on
* warping (omitting the error handling).
@@ -437,7 +437,7 @@ FT_BEGIN_HEADER
*
* Since warping is a global property of the auto-hinter it is best to
* change its value before rendering any face. Otherwise, you should
- * reload all faces that get auto-hinted in `light' hinting mode.
+ * reload all faces that get auto-hinted in `normal' hinting mode.
*
*/
diff --git a/thirdparty/freetype/include/freetype/fterrdef.h b/thirdparty/freetype/include/freetype/fterrdef.h
index cabbac8273..6a6dc85b87 100644
--- a/thirdparty/freetype/include/freetype/fterrdef.h
+++ b/thirdparty/freetype/include/freetype/fterrdef.h
@@ -233,6 +233,8 @@
"invalid PostScript (post) table" )
FT_ERRORDEF_( DEF_In_Glyf_Bytecode, 0x9C,
"found FDEF or IDEF opcode in glyf bytecode" )
+ FT_ERRORDEF_( Missing_Bitmap, 0x9D,
+ "missing bitmap in strike" )
/* CFF, CID, and Type 1 errors */
diff --git a/thirdparty/freetype/include/freetype/fterrors.h b/thirdparty/freetype/include/freetype/fterrors.h
index 42769fa7bf..ae382c419f 100644
--- a/thirdparty/freetype/include/freetype/fterrors.h
+++ b/thirdparty/freetype/include/freetype/fterrors.h
@@ -38,15 +38,15 @@
/* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */
/* defined in `ftoption.h' in order to make the higher byte indicate */
/* the module where the error has happened (this is not compatible */
- /* with standard builds of FreeType&nbsp;2, however). See the file */
+ /* with standard builds of FreeType~2, however). See the file */
/* `ftmoderr.h' for more details. */
/* */
/* *Error* *Message* *Strings* */
/* */
/* Error definitions are set up with special macros that allow client */
/* applications to build a table of error message strings. The */
- /* strings are not included in a normal build of FreeType&nbsp;2 to */
- /* save space (most client applications do not use them). */
+ /* strings are not included in a normal build of FreeType~2 to save */
+ /* space (most client applications do not use them). */
/* */
/* To do so, you have to define the following macros before including */
/* this file. */
diff --git a/thirdparty/freetype/include/freetype/ftglyph.h b/thirdparty/freetype/include/freetype/ftglyph.h
index 79879a7ac7..db1a2c8ba5 100644
--- a/thirdparty/freetype/include/freetype/ftglyph.h
+++ b/thirdparty/freetype/include/freetype/ftglyph.h
@@ -231,6 +231,12 @@ FT_BEGIN_HEADER
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
+ /* <Note> */
+ /* Because `*aglyph->advance.x' and '*aglyph->advance.y' are 16.16 */
+ /* fixed-point numbers, `slot->advance.x' and `slot->advance.y' */
+ /* (which are in 26.6 fixed-point format) must be in the range */
+ /* ]-32768;32768[. */
+ /* */
FT_EXPORT( FT_Error )
FT_Get_Glyph( FT_GlyphSlot slot,
FT_Glyph *aglyph );
@@ -566,6 +572,9 @@ FT_BEGIN_HEADER
/* <Note> */
/* The result is undefined if either `a' or `b' is zero. */
/* */
+ /* Since the function uses wrap-around arithmetic, results become */
+ /* meaningless if the arguments are very large. */
+ /* */
FT_EXPORT( void )
FT_Matrix_Multiply( const FT_Matrix* a,
FT_Matrix* b );
diff --git a/thirdparty/freetype/include/freetype/ftimage.h b/thirdparty/freetype/include/freetype/ftimage.h
index 1a049ef16d..1c789e5a44 100644
--- a/thirdparty/freetype/include/freetype/ftimage.h
+++ b/thirdparty/freetype/include/freetype/ftimage.h
@@ -1064,24 +1064,24 @@ FT_BEGIN_HEADER
/* */
/* <Description> */
/* FreeType used to provide an area of memory called the `render */
- /* pool' available to all registered rasters. This was not thread */
- /* safe however and now FreeType never allocates this pool. NULL */
- /* is always passed in as pool_base. */
+ /* pool' available to all registered rasterizers. This was not */
+ /* thread safe, however, and now FreeType never allocates this pool. */
/* */
- /* This function is called each time the render pool changes, or just */
- /* after a new raster object is created. */
+ /* This function is called after a new raster object is created. */
/* */
/* <Input> */
/* raster :: A handle to the new raster object. */
/* */
- /* pool_base :: The address in memory of the render pool. */
+ /* pool_base :: Previously, the address in memory of the render pool. */
+ /* Set this to NULL. */
/* */
- /* pool_size :: The size in bytes of the render pool. */
+ /* pool_size :: Previously, the size in bytes of the render pool. */
+ /* Set this to 0. */
/* */
/* <Note> */
- /* Rasters should ignore the render pool and rely on dynamic or stack */
- /* allocation if they want to (a handle to the memory allocator is */
- /* passed to the raster constructor). */
+ /* Rasterizers should rely on dynamic or stack allocation if they */
+ /* want to (a handle to the memory allocator is passed to the */
+ /* rasterizer constructor). */
/* */
typedef void
(*FT_Raster_ResetFunc)( FT_Raster raster,
diff --git a/thirdparty/freetype/include/freetype/ftlcdfil.h b/thirdparty/freetype/include/freetype/ftlcdfil.h
index 680bd90c89..bdaf9af906 100644
--- a/thirdparty/freetype/include/freetype/ftlcdfil.h
+++ b/thirdparty/freetype/include/freetype/ftlcdfil.h
@@ -44,9 +44,16 @@ FT_BEGIN_HEADER
* Reduce color fringes of subpixel-rendered bitmaps.
*
* @description:
- * Subpixel rendering exploits the color-striped structure of LCD
- * pixels, increasing the available resolution in the direction of the
- * stripe (usually horizontal RGB) by a factor of~3. Since these
+ * Should you #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your
+ * `ftoption.h', which enables patented ClearType-style rendering,
+ * the LCD-optimized glyph bitmaps should be filtered to reduce color
+ * fringes inherent to this technology. The default FreeType LCD
+ * rendering uses different technology, and API described below,
+ * although available, does nothing.
+ *
+ * ClearType-style LCD rendering exploits the color-striped structure of
+ * LCD pixels, increasing the available resolution in the direction of
+ * the stripe (usually horizontal RGB) by a factor of~3. Since these
* subpixels are color pixels, using them unfiltered creates severe
* color fringes. Use the @FT_Library_SetLcdFilter API to specify a
* low-pass filter, which is then applied to subpixel-rendered bitmaps
@@ -54,12 +61,6 @@ FT_BEGIN_HEADER
* the higher resolution to reduce color fringes, making the glyph image
* slightly blurrier. Positional improvements will remain.
*
- * Note that no filter is active by default, and that this function is
- * *not* implemented in default builds of the library. You need to
- * #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your `ftoption.h' file
- * in order to activate it and explicitly call @FT_Library_SetLcdFilter
- * to enable it.
- *
* A filter should have two properties:
*
* 1) It should be normalized, meaning the sum of the 5~components
diff --git a/thirdparty/freetype/include/freetype/ftmac.h b/thirdparty/freetype/include/freetype/ftmac.h
index ad97c6e4c3..a1656eec0e 100644
--- a/thirdparty/freetype/include/freetype/ftmac.h
+++ b/thirdparty/freetype/include/freetype/ftmac.h
@@ -35,11 +35,12 @@
FT_BEGIN_HEADER
-/* gcc-3.4.1 and later can warn about functions tagged as deprecated */
+ /* gcc-3.1 and later can warn about functions tagged as deprecated */
#ifndef FT_DEPRECATED_ATTRIBUTE
-#if defined(__GNUC__) && \
- ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
-#define FT_DEPRECATED_ATTRIBUTE __attribute__((deprecated))
+#if defined( __GNUC__ ) && \
+ ( ( __GNUC__ >= 4 ) || \
+ ( ( __GNUC__ == 3 ) && ( __GNUC_MINOR__ >= 1 ) ) )
+#define FT_DEPRECATED_ATTRIBUTE __attribute__(( deprecated ))
#else
#define FT_DEPRECATED_ATTRIBUTE
#endif
diff --git a/thirdparty/freetype/include/freetype/ftmm.h b/thirdparty/freetype/include/freetype/ftmm.h
index c41b80ea67..80ac98d612 100644
--- a/thirdparty/freetype/include/freetype/ftmm.h
+++ b/thirdparty/freetype/include/freetype/ftmm.h
@@ -178,7 +178,8 @@ FT_BEGIN_HEADER
/* strid :: The entry in `name' table identifying this instance. */
/* */
/* psid :: The entry in `name' table identifying a PostScript name */
- /* for this instance. */
+ /* for this instance. Value 0xFFFF indicates a missing */
+ /* entry. */
/* */
typedef struct FT_Var_Named_Style_
{
@@ -195,7 +196,7 @@ FT_BEGIN_HEADER
/* FT_MM_Var */
/* */
/* <Description> */
- /* A structure to model the axes and space of a Adobe MM, TrueType */
+ /* A structure to model the axes and space of an Adobe MM, TrueType */
/* GX, or OpenType variation font. */
/* */
/* Some fields are specific to one format and not to the others. */
@@ -321,6 +322,11 @@ FT_BEGIN_HEADER
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
+ /* <Note> */
+ /* To reset all axes to the default values, call the function with */
+ /* `num_coords' set to zero and `coords' set to NULL (new feature in */
+ /* FreeType version 2.8.1). */
+ /* */
FT_EXPORT( FT_Error )
FT_Set_MM_Design_Coordinates( FT_Face face,
FT_UInt num_coords,
@@ -351,6 +357,11 @@ FT_BEGIN_HEADER
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
+ /* <Note> */
+ /* To reset all axes to the default values, call the function with */
+ /* `num_coords' set to zero and `coords' set to NULL (new feature in */
+ /* FreeType version 2.8.1). */
+ /* */
FT_EXPORT( FT_Error )
FT_Set_Var_Design_Coordinates( FT_Face face,
FT_UInt num_coords,
@@ -415,6 +426,11 @@ FT_BEGIN_HEADER
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
+ /* <Note> */
+ /* To reset all axes to the default values, call the function with */
+ /* `num_coords' set to zero and `coords' set to NULL (new feature in */
+ /* FreeType version 2.8.1). */
+ /* */
FT_EXPORT( FT_Error )
FT_Set_MM_Blend_Coordinates( FT_Face face,
FT_UInt num_coords,
@@ -479,6 +495,50 @@ FT_BEGIN_HEADER
FT_UInt num_coords,
FT_Fixed* coords );
+
+ /*************************************************************************/
+ /* */
+ /* <Enum> */
+ /* FT_VAR_AXIS_FLAG_XXX */
+ /* */
+ /* <Description> */
+ /* A list of bit flags used in the return value of */
+ /* @FT_Get_Var_Axis_Flags. */
+ /* */
+ /* <Values> */
+ /* FT_VAR_AXIS_FLAG_HIDDEN :: */
+ /* The variation axis should not be exposed to user interfaces. */
+ /* */
+#define FT_VAR_AXIS_FLAG_HIDDEN 1
+
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* FT_Get_Var_Axis_Flags */
+ /* */
+ /* <Description> */
+ /* Get the `flags' field of an OpenType Variation Axis Record. */
+ /* */
+ /* Not meaningful for Adobe MM fonts (`*flags' is always zero). */
+ /* */
+ /* <Input> */
+ /* master :: The variation descriptor. */
+ /* */
+ /* axis_index :: The index of the requested variation axis. */
+ /* */
+ /* <Output> */
+ /* flags :: The `flags' field. See @FT_VAR_AXIS_FLAG_XXX for */
+ /* possible values. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0~means success. */
+ /* */
+ FT_EXPORT( FT_Error )
+ FT_Get_Var_Axis_Flags( FT_MM_Var* master,
+ FT_UInt axis_index,
+ FT_UInt* flags );
+
/* */
diff --git a/thirdparty/freetype/include/freetype/ftoutln.h b/thirdparty/freetype/include/freetype/ftoutln.h
index 07f73ebb1b..56f56a9603 100644
--- a/thirdparty/freetype/include/freetype/ftoutln.h
+++ b/thirdparty/freetype/include/freetype/ftoutln.h
@@ -385,6 +385,9 @@ FT_BEGIN_HEADER
/* @FT_Outline_Embolden, which uses the same strength in both */
/* directions. */
/* */
+ /* <Since> */
+ /* 2.4.10 */
+ /* */
FT_EXPORT( FT_Error )
FT_Outline_EmboldenXY( FT_Outline* outline,
FT_Pos xstrength,
diff --git a/thirdparty/freetype/include/freetype/internal/ftcalc.h b/thirdparty/freetype/include/freetype/internal/ftcalc.h
index c9ac9d8246..8b35f03d88 100644
--- a/thirdparty/freetype/include/freetype/internal/ftcalc.h
+++ b/thirdparty/freetype/include/freetype/internal/ftcalc.h
@@ -399,16 +399,42 @@ FT_BEGIN_HEADER
#endif /* 0 */
-#define INT_TO_F26DOT6( x ) ( (FT_Long)(x) << 6 )
-#define INT_TO_F2DOT14( x ) ( (FT_Long)(x) << 14 )
-#define INT_TO_FIXED( x ) ( (FT_Long)(x) << 16 )
-#define F2DOT14_TO_FIXED( x ) ( (FT_Long)(x) << 2 )
-#define FLOAT_TO_FIXED( x ) ( (FT_Long)( x * 65536.0 ) )
+#define INT_TO_F26DOT6( x ) ( (FT_Long)(x) * 64 ) /* << 6 */
+#define INT_TO_F2DOT14( x ) ( (FT_Long)(x) * 16384 ) /* << 14 */
+#define INT_TO_FIXED( x ) ( (FT_Long)(x) * 65536 ) /* << 16 */
+#define F2DOT14_TO_FIXED( x ) ( (FT_Long)(x) * 4 ) /* << 2 */
#define FIXED_TO_INT( x ) ( FT_RoundFix( x ) >> 16 )
#define ROUND_F26DOT6( x ) ( x >= 0 ? ( ( (x) + 32 ) & -64 ) \
: ( -( ( 32 - (x) ) & -64 ) ) )
+ /*
+ * The following macros have two purposes.
+ *
+ * . Tag places where overflow is expected and harmless.
+ *
+ * . Avoid run-time sanitizer errors.
+ *
+ * Use with care!
+ */
+#define ADD_LONG( a, b ) \
+ (FT_Long)( (FT_ULong)(a) + (FT_ULong)(b) )
+#define SUB_LONG( a, b ) \
+ (FT_Long)( (FT_ULong)(a) - (FT_ULong)(b) )
+#define MUL_LONG( a, b ) \
+ (FT_Long)( (FT_ULong)(a) * (FT_ULong)(b) )
+#define NEG_LONG( a ) \
+ (FT_Long)( (FT_ULong)0 - (FT_ULong)(a) )
+
+#define ADD_INT32( a, b ) \
+ (FT_Int32)( (FT_UInt32)(a) + (FT_UInt32)(b) )
+#define SUB_INT32( a, b ) \
+ (FT_Int32)( (FT_UInt32)(a) - (FT_UInt32)(b) )
+#define MUL_INT32( a, b ) \
+ (FT_Int32)( (FT_UInt32)(a) * (FT_UInt32)(b) )
+#define NEG_INT32( a ) \
+ (FT_Int32)( (FT_UInt32)0 - (FT_UInt32)(a) )
+
FT_END_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/ftobjs.h b/thirdparty/freetype/include/freetype/internal/ftobjs.h
index 558409166d..4231be238a 100644
--- a/thirdparty/freetype/include/freetype/internal/ftobjs.h
+++ b/thirdparty/freetype/include/freetype/internal/ftobjs.h
@@ -36,6 +36,7 @@
#include FT_INTERNAL_AUTOHINT_H
#include FT_INTERNAL_SERVICE_H
#include FT_INTERNAL_PIC_H
+#include FT_INTERNAL_CALC_H
#ifdef FT_CONFIG_OPTION_INCREMENTAL
#include FT_INCREMENTAL_H
@@ -85,13 +86,29 @@ FT_BEGIN_HEADER
/* we use FT_TYPEOF to suppress signedness compilation warnings */
#define FT_PAD_FLOOR( x, n ) ( (x) & ~FT_TYPEOF( x )( (n)-1 ) )
-#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + ((n)/2), n )
-#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + ((n)-1), n )
+#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + (n)/2, n )
+#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + (n)-1, n )
#define FT_PIX_FLOOR( x ) ( (x) & ~FT_TYPEOF( x )63 )
#define FT_PIX_ROUND( x ) FT_PIX_FLOOR( (x) + 32 )
#define FT_PIX_CEIL( x ) FT_PIX_FLOOR( (x) + 63 )
+ /* specialized versions (for signed values) */
+ /* that don't produce run-time errors due to integer overflow */
+#define FT_PAD_ROUND_LONG( x, n ) FT_PAD_FLOOR( ADD_LONG( (x), (n) / 2 ), \
+ n )
+#define FT_PAD_CEIL_LONG( x, n ) FT_PAD_FLOOR( ADD_LONG( (x), (n) - 1 ), \
+ n )
+#define FT_PIX_ROUND_LONG( x ) FT_PIX_FLOOR( ADD_LONG( (x), 32 ) )
+#define FT_PIX_CEIL_LONG( x ) FT_PIX_FLOOR( ADD_LONG( (x), 63 ) )
+
+#define FT_PAD_ROUND_INT32( x, n ) FT_PAD_FLOOR( ADD_INT32( (x), (n) / 2 ), \
+ n )
+#define FT_PAD_CEIL_INT32( x, n ) FT_PAD_FLOOR( ADD_INT32( (x), (n) - 1 ), \
+ n )
+#define FT_PIX_ROUND_INT32( x ) FT_PIX_FLOOR( ADD_INT32( (x), 32 ) )
+#define FT_PIX_CEIL_INT32( x ) FT_PIX_FLOOR( ADD_INT32( (x), 63 ) )
+
/*
* character classification functions -- since these are used to parse
@@ -856,11 +873,6 @@ FT_BEGIN_HEADER
/* */
/* auto_hinter :: The auto-hinter module interface. */
/* */
- /* raster_pool :: The raster object's render pool. This can */
- /* ideally be changed dynamically at run-time. */
- /* */
- /* raster_pool_size :: The size of the render pool in bytes. */
- /* */
/* debug_hooks :: An array of four function pointers that allow */
/* debuggers to hook into a font format's */
/* interpreter. Currently, only the TrueType */
@@ -869,9 +881,6 @@ FT_BEGIN_HEADER
/* lcd_filter :: If subpixel rendering is activated, the */
/* selected LCD filter mode. */
/* */
- /* lcd_extra :: If subpixel rendering is activated, the number */
- /* of extra pixels needed for the LCD filter. */
- /* */
/* lcd_weights :: If subpixel rendering is activated, the LCD */
/* filter weights, if any. */
/* */
@@ -903,15 +912,10 @@ FT_BEGIN_HEADER
FT_Renderer cur_renderer; /* current outline renderer */
FT_Module auto_hinter;
- FT_Byte* raster_pool; /* scan-line conversion */
- /* render pool */
- FT_ULong raster_pool_size; /* size of render pool in bytes */
-
FT_DebugHook_Func debug_hooks[4];
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
FT_LcdFilter lcd_filter;
- FT_Int lcd_extra; /* number of extra pixels */
FT_LcdFiveTapFilter lcd_weights; /* filter weights, if any */
FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */
#endif
diff --git a/thirdparty/freetype/include/freetype/tttags.h b/thirdparty/freetype/include/freetype/tttags.h
index 32eb2fdc26..b7d3bac0f1 100644
--- a/thirdparty/freetype/include/freetype/tttags.h
+++ b/thirdparty/freetype/include/freetype/tttags.h
@@ -106,6 +106,12 @@ FT_BEGIN_HEADER
#define TTAG_VVAR FT_MAKE_TAG( 'V', 'V', 'A', 'R' )
#define TTAG_wOFF FT_MAKE_TAG( 'w', 'O', 'F', 'F' )
+/* used by "Keyboard.dfont" on legacy Mac OS X */
+#define TTAG_0xA5kbd FT_MAKE_TAG( 0xA5, 'k', 'b', 'd' )
+
+/* used by "LastResort.dfont" on legacy Mac OS X */
+#define TTAG_0xA5lst FT_MAKE_TAG( 0xA5, 'l', 's', 't' )
+
FT_END_HEADER
diff --git a/thirdparty/freetype/src/autofit/afblue.c b/thirdparty/freetype/src/autofit/afblue.c
index a00c3a0765..fedeacf797 100644
--- a/thirdparty/freetype/src/autofit/afblue.c
+++ b/thirdparty/freetype/src/autofit/afblue.c
@@ -592,9 +592,6 @@
{ AF_BLUE_STRING_KAYAH_LI_DESCENDER, 0 },
{ AF_BLUE_STRING_KAYAH_LI_LARGE_DESCENDER, 0 },
{ AF_BLUE_STRING_MAX, 0 },
- { AF_BLUE_STRING_KANNADA_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
- { AF_BLUE_STRING_KANNADA_BOTTOM, 0 },
- { AF_BLUE_STRING_MAX, 0 },
{ AF_BLUE_STRING_KHMER_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
{ AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP, AF_BLUE_PROPERTY_LATIN_SUB_TOP },
@@ -606,6 +603,9 @@
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
{ AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM, 0 },
{ AF_BLUE_STRING_MAX, 0 },
+ { AF_BLUE_STRING_KANNADA_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
+ { AF_BLUE_STRING_KANNADA_BOTTOM, 0 },
+ { AF_BLUE_STRING_MAX, 0 },
{ AF_BLUE_STRING_LAO_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
{ AF_BLUE_STRING_LAO_BOTTOM, 0 },
@@ -701,6 +701,9 @@
{ AF_BLUE_STRING_TELUGU_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
{ AF_BLUE_STRING_TELUGU_BOTTOM, 0 },
{ AF_BLUE_STRING_MAX, 0 },
+ { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP },
+ { AF_BLUE_STRING_TIFINAGH, 0 },
+ { AF_BLUE_STRING_MAX, 0 },
{ AF_BLUE_STRING_THAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
{ AF_BLUE_STRING_THAI_BOTTOM, 0 },
@@ -710,9 +713,6 @@
{ AF_BLUE_STRING_THAI_LARGE_DESCENDER, 0 },
{ AF_BLUE_STRING_THAI_DIGIT_TOP, 0 },
{ AF_BLUE_STRING_MAX, 0 },
- { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP },
- { AF_BLUE_STRING_TIFINAGH, 0 },
- { AF_BLUE_STRING_MAX, 0 },
{ AF_BLUE_STRING_VAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
{ AF_BLUE_STRING_VAI_BOTTOM, 0 },
{ AF_BLUE_STRING_MAX, 0 },
diff --git a/thirdparty/freetype/src/autofit/afblue.dat b/thirdparty/freetype/src/autofit/afblue.dat
index 454923e9ca..f62eb82a1a 100644
--- a/thirdparty/freetype/src/autofit/afblue.dat
+++ b/thirdparty/freetype/src/autofit/afblue.dat
@@ -872,11 +872,6 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN:
{ AF_BLUE_STRING_KAYAH_LI_LARGE_DESCENDER, 0 }
{ AF_BLUE_STRING_MAX, 0 }
- AF_BLUE_STRINGSET_KNDA
- { AF_BLUE_STRING_KANNADA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }
- { AF_BLUE_STRING_KANNADA_BOTTOM, 0 }
- { AF_BLUE_STRING_MAX, 0 }
-
AF_BLUE_STRINGSET_KHMR
{ AF_BLUE_STRING_KHMER_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
AF_BLUE_PROPERTY_LATIN_X_HEIGHT }
@@ -892,6 +887,11 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN:
{ AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM, 0 }
{ AF_BLUE_STRING_MAX, 0 }
+ AF_BLUE_STRINGSET_KNDA
+ { AF_BLUE_STRING_KANNADA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }
+ { AF_BLUE_STRING_KANNADA_BOTTOM, 0 }
+ { AF_BLUE_STRING_MAX, 0 }
+
AF_BLUE_STRINGSET_LAO
{ AF_BLUE_STRING_LAO_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
AF_BLUE_PROPERTY_LATIN_X_HEIGHT }
@@ -1027,6 +1027,11 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN:
{ AF_BLUE_STRING_TELUGU_BOTTOM, 0 }
{ AF_BLUE_STRING_MAX, 0 }
+ AF_BLUE_STRINGSET_TFNG
+ { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP }
+ { AF_BLUE_STRING_TIFINAGH, 0 }
+ { AF_BLUE_STRING_MAX, 0 }
+
AF_BLUE_STRINGSET_THAI
{ AF_BLUE_STRING_THAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
AF_BLUE_PROPERTY_LATIN_X_HEIGHT }
@@ -1038,11 +1043,6 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN:
{ AF_BLUE_STRING_THAI_DIGIT_TOP, 0 }
{ AF_BLUE_STRING_MAX, 0 }
- AF_BLUE_STRINGSET_TFNG
- { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP }
- { AF_BLUE_STRING_TIFINAGH, 0 }
- { AF_BLUE_STRING_MAX, 0 }
-
AF_BLUE_STRINGSET_VAII
{ AF_BLUE_STRING_VAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP }
{ AF_BLUE_STRING_VAI_BOTTOM, 0 }
diff --git a/thirdparty/freetype/src/autofit/afblue.h b/thirdparty/freetype/src/autofit/afblue.h
index e227dbf50b..99ef51cd4a 100644
--- a/thirdparty/freetype/src/autofit/afblue.h
+++ b/thirdparty/freetype/src/autofit/afblue.h
@@ -344,9 +344,9 @@ FT_BEGIN_HEADER
AF_BLUE_STRINGSET_GURU = 116,
AF_BLUE_STRINGSET_HEBR = 122,
AF_BLUE_STRINGSET_KALI = 126,
- AF_BLUE_STRINGSET_KNDA = 132,
- AF_BLUE_STRINGSET_KHMR = 135,
- AF_BLUE_STRINGSET_KHMS = 141,
+ AF_BLUE_STRINGSET_KHMR = 132,
+ AF_BLUE_STRINGSET_KHMS = 138,
+ AF_BLUE_STRINGSET_KNDA = 141,
AF_BLUE_STRINGSET_LAO = 144,
AF_BLUE_STRINGSET_LATN = 150,
AF_BLUE_STRINGSET_LATB = 157,
@@ -367,8 +367,8 @@ FT_BEGIN_HEADER
AF_BLUE_STRINGSET_TAML = 222,
AF_BLUE_STRINGSET_TAVT = 225,
AF_BLUE_STRINGSET_TELU = 228,
- AF_BLUE_STRINGSET_THAI = 231,
- AF_BLUE_STRINGSET_TFNG = 239,
+ AF_BLUE_STRINGSET_TFNG = 231,
+ AF_BLUE_STRINGSET_THAI = 234,
AF_BLUE_STRINGSET_VAII = 242,
af_blue_2_1 = 245,
#ifdef AF_CONFIG_OPTION_CJK
diff --git a/thirdparty/freetype/src/autofit/afcjk.c b/thirdparty/freetype/src/autofit/afcjk.c
index 61e29cdeda..897533d148 100644
--- a/thirdparty/freetype/src/autofit/afcjk.c
+++ b/thirdparty/freetype/src/autofit/afcjk.c
@@ -2272,13 +2272,7 @@
goto Exit;
/* analyze glyph outline */
-#ifdef AF_CONFIG_OPTION_USE_WARPER
- if ( ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT &&
- AF_HINTS_DO_WARP( hints ) ) ||
- AF_HINTS_DO_HORIZONTAL( hints ) )
-#else
if ( AF_HINTS_DO_HORIZONTAL( hints ) )
-#endif
{
error = af_cjk_hints_detect_features( hints, AF_DIMENSION_HORZ );
if ( error )
@@ -2304,9 +2298,9 @@
{
#ifdef AF_CONFIG_OPTION_USE_WARPER
- if ( dim == AF_DIMENSION_HORZ &&
- metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT &&
- AF_HINTS_DO_WARP( hints ) )
+ if ( dim == AF_DIMENSION_HORZ &&
+ metrics->root.scaler.render_mode == FT_RENDER_MODE_NORMAL &&
+ AF_HINTS_DO_WARP( hints ) )
{
AF_WarperRec warper;
FT_Fixed scale;
diff --git a/thirdparty/freetype/src/autofit/afhints.c b/thirdparty/freetype/src/autofit/afhints.c
index f1ff0baef8..1b21c06c2c 100644
--- a/thirdparty/freetype/src/autofit/afhints.c
+++ b/thirdparty/freetype/src/autofit/afhints.c
@@ -507,15 +507,15 @@
return FT_THROW( Invalid_Argument );
seg = &axis->segments[idx];
- *offset = ( dim == AF_DIMENSION_HORZ ) ? seg->first->ox
- : seg->first->oy;
+ *offset = ( dim == AF_DIMENSION_HORZ ) ? seg->first->fx
+ : seg->first->fy;
if ( seg->edge )
*is_blue = (FT_Bool)( seg->edge->blue_edge != 0 );
else
*is_blue = FALSE;
if ( *is_blue )
- *blue_offset = seg->edge->blue_edge->cur;
+ *blue_offset = seg->edge->blue_edge->org;
else
*blue_offset = 0;
diff --git a/thirdparty/freetype/src/autofit/aflatin.c b/thirdparty/freetype/src/autofit/aflatin.c
index 11fa523c83..02b3b8bbd3 100644
--- a/thirdparty/freetype/src/autofit/aflatin.c
+++ b/thirdparty/freetype/src/autofit/aflatin.c
@@ -1690,9 +1690,11 @@
if ( prev_max_on_coord > max_on_coord )
max_on_coord = prev_max_on_coord;
- prev_segment->last = point;
- prev_segment->pos = (FT_Short)( ( min_pos +
- max_pos ) >> 1 );
+ prev_segment->last = point;
+ prev_segment->pos = (FT_Short)( ( min_pos +
+ max_pos ) >> 1 );
+ prev_segment->delta = (FT_Short)( ( max_pos -
+ min_pos ) >> 1 );
if ( ( min_flags | max_flags ) & AF_FLAG_CONTROL &&
( max_on_coord - min_on_coord ) < flat_threshold )
@@ -1720,9 +1722,11 @@
if ( max_pos > prev_max_pos )
prev_max_pos = max_pos;
- prev_segment->last = point;
- prev_segment->pos = (FT_Short)( ( prev_min_pos +
- prev_max_pos ) >> 1 );
+ prev_segment->last = point;
+ prev_segment->pos = (FT_Short)( ( prev_min_pos +
+ prev_max_pos ) >> 1 );
+ prev_segment->delta = (FT_Short)( ( prev_max_pos -
+ prev_min_pos ) >> 1 );
}
else
{
@@ -1733,8 +1737,9 @@
if ( prev_max_pos > max_pos )
max_pos = prev_max_pos;
- segment->last = point;
- segment->pos = (FT_Short)( ( min_pos + max_pos ) >> 1 );
+ segment->last = point;
+ segment->pos = (FT_Short)( ( min_pos + max_pos ) >> 1 );
+ segment->delta = (FT_Short)( ( max_pos - min_pos ) >> 1 );
if ( ( min_flags | max_flags ) & AF_FLAG_CONTROL &&
( max_on_coord - min_on_coord ) < flat_threshold )
@@ -3492,13 +3497,7 @@
goto Exit;
/* analyze glyph outline */
-#ifdef AF_CONFIG_OPTION_USE_WARPER
- if ( ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT &&
- AF_HINTS_DO_WARP( hints ) ) ||
- AF_HINTS_DO_HORIZONTAL( hints ) )
-#else
if ( AF_HINTS_DO_HORIZONTAL( hints ) )
-#endif
{
axis = &metrics->axis[AF_DIMENSION_HORZ];
error = af_latin_hints_detect_features( hints,
@@ -3528,9 +3527,9 @@
for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ )
{
#ifdef AF_CONFIG_OPTION_USE_WARPER
- if ( dim == AF_DIMENSION_HORZ &&
- metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT &&
- AF_HINTS_DO_WARP( hints ) )
+ if ( dim == AF_DIMENSION_HORZ &&
+ metrics->root.scaler.render_mode == FT_RENDER_MODE_NORMAL &&
+ AF_HINTS_DO_WARP( hints ) )
{
AF_WarperRec warper;
FT_Fixed scale;
diff --git a/thirdparty/freetype/src/autofit/aflatin2.c b/thirdparty/freetype/src/autofit/aflatin2.c
index 0607278b1e..fb42445116 100644
--- a/thirdparty/freetype/src/autofit/aflatin2.c
+++ b/thirdparty/freetype/src/autofit/aflatin2.c
@@ -2340,13 +2340,7 @@
goto Exit;
/* analyze glyph outline */
-#ifdef AF_CONFIG_OPTION_USE_WARPER
- if ( ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT &&
- AF_HINTS_DO_WARP( hints ) ) ||
- AF_HINTS_DO_HORIZONTAL( hints ) )
-#else
if ( AF_HINTS_DO_HORIZONTAL( hints ) )
-#endif
{
error = af_latin2_hints_detect_features( hints, AF_DIMENSION_HORZ );
if ( error )
@@ -2366,9 +2360,9 @@
for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ )
{
#ifdef AF_CONFIG_OPTION_USE_WARPER
- if ( dim == AF_DIMENSION_HORZ &&
- metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT &&
- AF_HINTS_DO_WARP( hints ) )
+ if ( dim == AF_DIMENSION_HORZ &&
+ metrics->root.scaler.render_mode == FT_RENDER_MODE_NORMAL &&
+ AF_HINTS_DO_WARP( hints ) )
{
AF_WarperRec warper;
FT_Fixed scale;
diff --git a/thirdparty/freetype/src/autofit/afloader.c b/thirdparty/freetype/src/autofit/afloader.c
index 78c4368b61..067ebd17f6 100644
--- a/thirdparty/freetype/src/autofit/afloader.c
+++ b/thirdparty/freetype/src/autofit/afloader.c
@@ -483,8 +483,8 @@
FT_Pos pp2x = loader->pp2.x;
- loader->pp1.x = FT_PIX_ROUND( pp1x );
- loader->pp2.x = FT_PIX_ROUND( pp2x );
+ loader->pp1.x = FT_PIX_ROUND( pp1x + hints->xmin_delta );
+ loader->pp2.x = FT_PIX_ROUND( pp2x + hints->xmax_delta );
slot->lsb_delta = loader->pp1.x - pp1x;
slot->rsb_delta = loader->pp2.x - pp2x;
@@ -498,8 +498,8 @@
FT_Pos pp2x = loader->pp2.x;
- loader->pp1.x = FT_PIX_ROUND( pp1x + hints->xmin_delta );
- loader->pp2.x = FT_PIX_ROUND( pp2x + hints->xmax_delta );
+ loader->pp1.x = FT_PIX_ROUND( pp1x );
+ loader->pp2.x = FT_PIX_ROUND( pp2x );
slot->lsb_delta = loader->pp1.x - pp1x;
slot->rsb_delta = loader->pp2.x - pp2x;
diff --git a/thirdparty/freetype/src/autofit/afscript.h b/thirdparty/freetype/src/autofit/afscript.h
index 7547a9e6f9..cb815dbb40 100644
--- a/thirdparty/freetype/src/autofit/afscript.h
+++ b/thirdparty/freetype/src/autofit/afscript.h
@@ -187,12 +187,6 @@
HINTING_BOTTOM_TO_TOP,
"\xEA\xA4\x8D \xEA\xA4\x80" ) /* ꤍ ꤀ */
- SCRIPT( knda, KNDA,
- "Kannada",
- HB_SCRIPT_KANNADA,
- HINTING_BOTTOM_TO_TOP,
- "\xE0\xB3\xA6 \xE0\xB2\xAC" ) /* ೦ ಬ */
-
/* only digit zero has a simple shape in the Khmer script */
SCRIPT( khmr, KHMR,
"Khmer",
@@ -206,6 +200,12 @@
HINTING_BOTTOM_TO_TOP,
"\xE1\xA7\xA1 \xE1\xA7\xAA" ) /* ᧡ ᧪ */
+ SCRIPT( knda, KNDA,
+ "Kannada",
+ HB_SCRIPT_KANNADA,
+ HINTING_BOTTOM_TO_TOP,
+ "\xE0\xB3\xA6 \xE0\xB2\xAC" ) /* ೦ ಬ */
+
/* only digit zero has a simple shape in the Lao script */
SCRIPT( lao, LAO,
"Lao",
@@ -330,18 +330,18 @@
HINTING_BOTTOM_TO_TOP,
"\xE0\xB1\xA6 \xE0\xB1\xA7" ) /* ౦ ౧ */
- SCRIPT( thai, THAI,
- "Thai",
- HB_SCRIPT_THAI,
- HINTING_BOTTOM_TO_TOP,
- "\xE0\xB8\xB2 \xE0\xB9\x85 \xE0\xB9\x90" ) /* า ๅ ๐ */
-
SCRIPT( tfng, TFNG,
"Tifinagh",
HB_SCRIPT_TIFINAGH,
HINTING_BOTTOM_TO_TOP,
"\xE2\xB5\x94" ) /* ⵔ */
+ SCRIPT( thai, THAI,
+ "Thai",
+ HB_SCRIPT_THAI,
+ HINTING_BOTTOM_TO_TOP,
+ "\xE0\xB8\xB2 \xE0\xB9\x85 \xE0\xB9\x90" ) /* า ๅ ๐ */
+
SCRIPT( vaii, VAII,
"Vai",
HB_SCRIPT_VAI,
diff --git a/thirdparty/freetype/src/autofit/afshaper.c b/thirdparty/freetype/src/autofit/afshaper.c
index da92fad3ed..d259964217 100644
--- a/thirdparty/freetype/src/autofit/afshaper.c
+++ b/thirdparty/freetype/src/autofit/afshaper.c
@@ -18,6 +18,7 @@
#include <ft2build.h>
#include FT_FREETYPE_H
+#include FT_ADVANCES_H
#include "afglobal.h"
#include "aftypes.h"
#include "afshaper.h"
diff --git a/thirdparty/freetype/src/autofit/afstyles.h b/thirdparty/freetype/src/autofit/afstyles.h
index a5e13d8944..281559eea2 100644
--- a/thirdparty/freetype/src/autofit/afstyles.h
+++ b/thirdparty/freetype/src/autofit/afstyles.h
@@ -255,13 +255,6 @@
AF_BLUE_STRINGSET_KALI,
AF_COVERAGE_DEFAULT )
- STYLE( knda_dflt, KNDA_DFLT,
- "Kannada default style",
- AF_WRITING_SYSTEM_LATIN,
- AF_SCRIPT_KNDA,
- AF_BLUE_STRINGSET_KNDA,
- AF_COVERAGE_DEFAULT )
-
STYLE( khmr_dflt, KHMR_DFLT,
"Khmer default style",
AF_WRITING_SYSTEM_LATIN,
@@ -276,6 +269,13 @@
AF_BLUE_STRINGSET_KHMS,
AF_COVERAGE_DEFAULT )
+ STYLE( knda_dflt, KNDA_DFLT,
+ "Kannada default style",
+ AF_WRITING_SYSTEM_LATIN,
+ AF_SCRIPT_KNDA,
+ AF_BLUE_STRINGSET_KNDA,
+ AF_COVERAGE_DEFAULT )
+
STYLE( lao_dflt, LAO_DFLT,
"Lao default style",
AF_WRITING_SYSTEM_LATIN,
@@ -420,13 +420,6 @@
AF_BLUE_STRINGSET_TELU,
AF_COVERAGE_DEFAULT )
- STYLE( thai_dflt, THAI_DFLT,
- "Thai default style",
- AF_WRITING_SYSTEM_LATIN,
- AF_SCRIPT_THAI,
- AF_BLUE_STRINGSET_THAI,
- AF_COVERAGE_DEFAULT )
-
STYLE( tfng_dflt, TFNG_DFLT,
"Tifinagh default style",
AF_WRITING_SYSTEM_LATIN,
@@ -434,6 +427,13 @@
AF_BLUE_STRINGSET_TFNG,
AF_COVERAGE_DEFAULT )
+ STYLE( thai_dflt, THAI_DFLT,
+ "Thai default style",
+ AF_WRITING_SYSTEM_LATIN,
+ AF_SCRIPT_THAI,
+ AF_BLUE_STRINGSET_THAI,
+ AF_COVERAGE_DEFAULT )
+
STYLE( vaii_dflt, VAII_DFLT,
"Vai default style",
AF_WRITING_SYSTEM_LATIN,
diff --git a/thirdparty/freetype/src/base/ftbitmap.c b/thirdparty/freetype/src/base/ftbitmap.c
index 88c88c4c1b..e567a0453e 100644
--- a/thirdparty/freetype/src/base/ftbitmap.c
+++ b/thirdparty/freetype/src/base/ftbitmap.c
@@ -226,7 +226,7 @@
}
/* otherwise allocate new buffer */
- if ( FT_QALLOC_MULT( buffer, new_pitch, bitmap->rows + ypixels ) )
+ if ( FT_QALLOC_MULT( buffer, bitmap->rows + ypixels, new_pitch ) )
return error;
/* new rows get added at the top of the bitmap, */
@@ -534,8 +534,7 @@
(FT_ULong)target->rows > FT_ULONG_MAX / (FT_ULong)target_pitch )
return FT_THROW( Invalid_Argument );
- if ( target->rows * (FT_ULong)target_pitch > old_size &&
- FT_QREALLOC( target->buffer,
+ if ( FT_QREALLOC( target->buffer,
old_size, target->rows * (FT_UInt)target_pitch ) )
return error;
diff --git a/thirdparty/freetype/src/base/ftcalc.c b/thirdparty/freetype/src/base/ftcalc.c
index f0525502f3..00d63c6e6b 100644
--- a/thirdparty/freetype/src/base/ftcalc.c
+++ b/thirdparty/freetype/src/base/ftcalc.c
@@ -68,14 +68,15 @@
#define FT_COMPONENT trace_calc
- /* transfer sign leaving a positive number */
-#define FT_MOVE_SIGN( x, s ) \
- FT_BEGIN_STMNT \
- if ( x < 0 ) \
- { \
- x = -x; \
- s = -s; \
- } \
+ /* transfer sign, leaving a positive number; */
+ /* we need an unsigned value to safely negate INT_MIN (or LONG_MIN) */
+#define FT_MOVE_SIGN( x, x_unsigned, s ) \
+ FT_BEGIN_STMNT \
+ if ( x < 0 ) \
+ { \
+ x_unsigned = 0U - (x_unsigned); \
+ s = -s; \
+ } \
FT_END_STMNT
/* The following three functions are available regardless of whether */
@@ -86,7 +87,7 @@
FT_EXPORT_DEF( FT_Fixed )
FT_RoundFix( FT_Fixed a )
{
- return ( a + 0x8000L - ( a < 0 ) ) & ~0xFFFFL;
+ return ( ADD_LONG( a, 0x8000L - ( a < 0 ) ) ) & ~0xFFFFL;
}
@@ -95,7 +96,7 @@
FT_EXPORT_DEF( FT_Fixed )
FT_CeilFix( FT_Fixed a )
{
- return ( a + 0xFFFFL ) & ~0xFFFFL;
+ return ( ADD_LONG( a, 0xFFFFL ) ) & ~0xFFFFL;
}
@@ -179,20 +180,20 @@
FT_Long d_;
- FT_MOVE_SIGN( a_, s );
- FT_MOVE_SIGN( b_, s );
- FT_MOVE_SIGN( c_, s );
-
a = (FT_UInt64)a_;
b = (FT_UInt64)b_;
c = (FT_UInt64)c_;
+ FT_MOVE_SIGN( a_, a, s );
+ FT_MOVE_SIGN( b_, b, s );
+ FT_MOVE_SIGN( c_, c, s );
+
d = c > 0 ? ( a * b + ( c >> 1 ) ) / c
: 0x7FFFFFFFUL;
d_ = (FT_Long)d;
- return s < 0 ? -d_ : d_;
+ return s < 0 ? NEG_LONG( d_ ) : d_;
}
@@ -208,20 +209,20 @@
FT_Long d_;
- FT_MOVE_SIGN( a_, s );
- FT_MOVE_SIGN( b_, s );
- FT_MOVE_SIGN( c_, s );
-
a = (FT_UInt64)a_;
b = (FT_UInt64)b_;
c = (FT_UInt64)c_;
+ FT_MOVE_SIGN( a_, a, s );
+ FT_MOVE_SIGN( b_, b, s );
+ FT_MOVE_SIGN( c_, c, s );
+
d = c > 0 ? a * b / c
: 0x7FFFFFFFUL;
d_ = (FT_Long)d;
- return s < 0 ? -d_ : d_;
+ return s < 0 ? NEG_LONG( d_ ) : d_;
}
@@ -257,18 +258,18 @@
FT_Long q_;
- FT_MOVE_SIGN( a_, s );
- FT_MOVE_SIGN( b_, s );
-
a = (FT_UInt64)a_;
b = (FT_UInt64)b_;
+ FT_MOVE_SIGN( a_, a, s );
+ FT_MOVE_SIGN( b_, b, s );
+
q = b > 0 ? ( ( a << 16 ) + ( b >> 1 ) ) / b
: 0x7FFFFFFFUL;
q_ = (FT_Long)q;
- return s < 0 ? -q_ : q_;
+ return s < 0 ? NEG_LONG( q_ ) : q_;
}
@@ -422,14 +423,14 @@
/* XXX: this function does not allow 64-bit arguments */
- FT_MOVE_SIGN( a_, s );
- FT_MOVE_SIGN( b_, s );
- FT_MOVE_SIGN( c_, s );
-
a = (FT_UInt32)a_;
b = (FT_UInt32)b_;
c = (FT_UInt32)c_;
+ FT_MOVE_SIGN( a_, a, s );
+ FT_MOVE_SIGN( b_, b, s );
+ FT_MOVE_SIGN( c_, c, s );
+
if ( c == 0 )
a = 0x7FFFFFFFUL;
@@ -455,7 +456,7 @@
a_ = (FT_Long)a;
- return s < 0 ? -a_ : a_;
+ return s < 0 ? NEG_LONG( a_ ) : a_;
}
@@ -470,14 +471,14 @@
/* XXX: this function does not allow 64-bit arguments */
- FT_MOVE_SIGN( a_, s );
- FT_MOVE_SIGN( b_, s );
- FT_MOVE_SIGN( c_, s );
-
a = (FT_UInt32)a_;
b = (FT_UInt32)b_;
c = (FT_UInt32)c_;
+ FT_MOVE_SIGN( a_, a, s );
+ FT_MOVE_SIGN( b_, b, s );
+ FT_MOVE_SIGN( c_, c, s );
+
if ( c == 0 )
a = 0x7FFFFFFFUL;
@@ -498,7 +499,7 @@
a_ = (FT_Long)a;
- return s < 0 ? -a_ : a_;
+ return s < 0 ? NEG_LONG( a_ ) : a_;
}
@@ -575,12 +576,12 @@
/* XXX: this function does not allow 64-bit arguments */
- FT_MOVE_SIGN( a_, s );
- FT_MOVE_SIGN( b_, s );
-
a = (FT_UInt32)a_;
b = (FT_UInt32)b_;
+ FT_MOVE_SIGN( a_, a, s );
+ FT_MOVE_SIGN( b_, b, s );
+
if ( a + ( b >> 8 ) <= 8190UL )
a = ( a * b + 0x8000UL ) >> 16;
else
@@ -594,7 +595,7 @@
a_ = (FT_Long)a;
- return s < 0 ? -a_ : a_;
+ return s < 0 ? NEG_LONG( a_ ) : a_;
#endif /* 0 */
@@ -614,12 +615,12 @@
/* XXX: this function does not allow 64-bit arguments */
- FT_MOVE_SIGN( a_, s );
- FT_MOVE_SIGN( b_, s );
-
a = (FT_UInt32)a_;
b = (FT_UInt32)b_;
+ FT_MOVE_SIGN( a_, a, s );
+ FT_MOVE_SIGN( b_, b, s );
+
if ( b == 0 )
{
/* check for division by 0 */
@@ -647,7 +648,7 @@
q_ = (FT_Long)q;
- return s < 0 ? -q_ : q_;
+ return s < 0 ? NEG_LONG( q_ ) : q_;
}
@@ -666,13 +667,19 @@
if ( !a || !b )
return;
- xx = FT_MulFix( a->xx, b->xx ) + FT_MulFix( a->xy, b->yx );
- xy = FT_MulFix( a->xx, b->xy ) + FT_MulFix( a->xy, b->yy );
- yx = FT_MulFix( a->yx, b->xx ) + FT_MulFix( a->yy, b->yx );
- yy = FT_MulFix( a->yx, b->xy ) + FT_MulFix( a->yy, b->yy );
-
- b->xx = xx; b->xy = xy;
- b->yx = yx; b->yy = yy;
+ xx = ADD_LONG( FT_MulFix( a->xx, b->xx ),
+ FT_MulFix( a->xy, b->yx ) );
+ xy = ADD_LONG( FT_MulFix( a->xx, b->xy ),
+ FT_MulFix( a->xy, b->yy ) );
+ yx = ADD_LONG( FT_MulFix( a->yx, b->xx ),
+ FT_MulFix( a->yy, b->yx ) );
+ yy = ADD_LONG( FT_MulFix( a->yx, b->xy ),
+ FT_MulFix( a->yy, b->yy ) );
+
+ b->xx = xx;
+ b->xy = xy;
+ b->yx = yx;
+ b->yy = yy;
}
@@ -722,13 +729,19 @@
if ( !a || !b )
return;
- xx = FT_MulDiv( a->xx, b->xx, val ) + FT_MulDiv( a->xy, b->yx, val );
- xy = FT_MulDiv( a->xx, b->xy, val ) + FT_MulDiv( a->xy, b->yy, val );
- yx = FT_MulDiv( a->yx, b->xx, val ) + FT_MulDiv( a->yy, b->yx, val );
- yy = FT_MulDiv( a->yx, b->xy, val ) + FT_MulDiv( a->yy, b->yy, val );
-
- b->xx = xx; b->xy = xy;
- b->yx = yx; b->yy = yy;
+ xx = ADD_LONG( FT_MulDiv( a->xx, b->xx, val ),
+ FT_MulDiv( a->xy, b->yx, val ) );
+ xy = ADD_LONG( FT_MulDiv( a->xx, b->xy, val ),
+ FT_MulDiv( a->xy, b->yy, val ) );
+ yx = ADD_LONG( FT_MulDiv( a->yx, b->xx, val ),
+ FT_MulDiv( a->yy, b->yx, val ) );
+ yy = ADD_LONG( FT_MulDiv( a->yx, b->xy, val ),
+ FT_MulDiv( a->yy, b->yy, val ) );
+
+ b->xx = xx;
+ b->xy = xy;
+ b->yx = yx;
+ b->yy = yy;
}
@@ -747,11 +760,10 @@
if ( !vector || !matrix )
return;
- xz = FT_MulDiv( vector->x, matrix->xx, val ) +
- FT_MulDiv( vector->y, matrix->xy, val );
-
- yz = FT_MulDiv( vector->x, matrix->yx, val ) +
- FT_MulDiv( vector->y, matrix->yy, val );
+ xz = ADD_LONG( FT_MulDiv( vector->x, matrix->xx, val ),
+ FT_MulDiv( vector->y, matrix->xy, val ) );
+ yz = ADD_LONG( FT_MulDiv( vector->x, matrix->yx, val ),
+ FT_MulDiv( vector->y, matrix->yy, val ) );
vector->x = xz;
vector->y = yz;
@@ -770,12 +782,12 @@
FT_Int sx = 1, sy = 1, shift;
- FT_MOVE_SIGN( x_, sx );
- FT_MOVE_SIGN( y_, sy );
-
x = (FT_UInt32)x_;
y = (FT_UInt32)y_;
+ FT_MOVE_SIGN( x_, x, sx );
+ FT_MOVE_SIGN( y_, y, sy );
+
/* trivial cases */
if ( x == 0 )
{
@@ -913,11 +925,13 @@
FT_Int result;
- if ( (FT_ULong)FT_ABS( in_x ) + (FT_ULong)FT_ABS( out_y ) <= 131071UL &&
- (FT_ULong)FT_ABS( in_y ) + (FT_ULong)FT_ABS( out_x ) <= 131071UL )
+ /* we silently ignore overflow errors, since such large values */
+ /* lead to even more (harmless) rendering errors later on */
+ if ( ADD_LONG( FT_ABS( in_x ), FT_ABS( out_y ) ) <= 131071L &&
+ ADD_LONG( FT_ABS( in_y ), FT_ABS( out_x ) ) <= 131071L )
{
- FT_Long z1 = in_x * out_y;
- FT_Long z2 = in_y * out_x;
+ FT_Long z1 = MUL_LONG( in_x, out_y );
+ FT_Long z2 = MUL_LONG( in_y, out_x );
if ( z1 > z2 )
diff --git a/thirdparty/freetype/src/base/ftglyph.c b/thirdparty/freetype/src/base/ftglyph.c
index 9bfb330508..3f78a8c36b 100644
--- a/thirdparty/freetype/src/base/ftglyph.c
+++ b/thirdparty/freetype/src/base/ftglyph.c
@@ -408,12 +408,28 @@
goto Exit;
/* copy advance while converting 26.6 to 16.16 format */
+ if ( slot->advance.x >= 0x8000L * 64 ||
+ slot->advance.x <= -0x8000L * 64 )
+ {
+ FT_ERROR(( "FT_Get_Glyph: advance width too large\n" ));
+ error = FT_THROW( Invalid_Argument );
+ goto Exit2;
+ }
+ if ( slot->advance.y >= 0x8000L * 64 ||
+ slot->advance.y <= -0x8000L * 64 )
+ {
+ FT_ERROR(( "FT_Get_Glyph: advance height too large\n" ));
+ error = FT_THROW( Invalid_Argument );
+ goto Exit2;
+ }
+
glyph->advance.x = slot->advance.x * 1024;
glyph->advance.y = slot->advance.y * 1024;
/* now import the image from the glyph slot */
error = clazz->glyph_init( glyph, slot );
+ Exit2:
/* if an error occurred, destroy the glyph */
if ( error )
FT_Done_Glyph( glyph );
diff --git a/thirdparty/freetype/src/base/ftlcdfil.c b/thirdparty/freetype/src/base/ftlcdfil.c
index 611b39f570..60c813fd9e 100644
--- a/thirdparty/freetype/src/base/ftlcdfil.c
+++ b/thirdparty/freetype/src/base/ftlcdfil.c
@@ -29,141 +29,107 @@
/* define USE_LEGACY to implement the legacy filter */
#define USE_LEGACY
+#define FT_SHIFTCLAMP( x ) ( x >>= 8, (FT_Byte)( x > 255 ? 255 : x ) )
+
/* FIR filter used by the default and light filters */
FT_BASE( void )
ft_lcd_filter_fir( FT_Bitmap* bitmap,
FT_Render_Mode mode,
FT_LcdFiveTapFilter weights )
{
- FT_UInt width = (FT_UInt)bitmap->width;
- FT_UInt height = (FT_UInt)bitmap->rows;
+ FT_UInt width = (FT_UInt)bitmap->width;
+ FT_UInt height = (FT_UInt)bitmap->rows;
+ FT_Int pitch = bitmap->pitch;
+ FT_Byte* origin = bitmap->buffer;
+
+ /* take care of bitmap flow */
+ if ( pitch > 0 )
+ origin += pitch * (FT_Int)( height - 1 );
/* horizontal in-place FIR filter */
- if ( mode == FT_RENDER_MODE_LCD && width >= 4 )
+ if ( mode == FT_RENDER_MODE_LCD && width >= 2 )
{
- FT_Byte* line = bitmap->buffer;
-
+ FT_Byte* line = origin;
- /* take care of bitmap flow */
- if ( bitmap->pitch < 0 )
- line -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 );
- /* `fir' and `pix' must be at least 32 bit wide, since the sum of */
- /* the values in `weights' can exceed 0xFF */
+ /* `fir' must be at least 32 bit wide, since the sum of */
+ /* the values in `weights' can exceed 0xFF */
- for ( ; height > 0; height--, line += bitmap->pitch )
+ for ( ; height > 0; height--, line -= pitch )
{
- FT_UInt fir[4]; /* below, `pix' is used as the 5th element */
- FT_UInt val1, xx;
+ FT_UInt fir[5];
+ FT_UInt val, xx;
- val1 = line[0];
- fir[0] = weights[2] * val1;
- fir[1] = weights[3] * val1;
- fir[2] = weights[4] * val1;
- fir[3] = 0;
+ val = line[0];
+ fir[2] = weights[2] * val;
+ fir[3] = weights[3] * val;
+ fir[4] = weights[4] * val;
- val1 = line[1];
- fir[0] += weights[1] * val1;
- fir[1] += weights[2] * val1;
- fir[2] += weights[3] * val1;
- fir[3] += weights[4] * val1;
+ val = line[1];
+ fir[1] = fir[2] + weights[1] * val;
+ fir[2] = fir[3] + weights[2] * val;
+ fir[3] = fir[4] + weights[3] * val;
+ fir[4] = weights[4] * val;
for ( xx = 2; xx < width; xx++ )
{
- FT_UInt val, pix;
-
-
val = line[xx];
- pix = fir[0] + weights[0] * val;
- fir[0] = fir[1] + weights[1] * val;
- fir[1] = fir[2] + weights[2] * val;
- fir[2] = fir[3] + weights[3] * val;
- fir[3] = weights[4] * val;
-
- pix >>= 8;
- pix |= (FT_UInt)-(FT_Int)( pix >> 8 );
- line[xx - 2] = (FT_Byte)pix;
- }
+ fir[0] = fir[1] + weights[0] * val;
+ fir[1] = fir[2] + weights[1] * val;
+ fir[2] = fir[3] + weights[2] * val;
+ fir[3] = fir[4] + weights[3] * val;
+ fir[4] = weights[4] * val;
- {
- FT_UInt pix;
-
-
- pix = fir[0] >> 8;
- pix |= (FT_UInt)-(FT_Int)( pix >> 8 );
- line[xx - 2] = (FT_Byte)pix;
-
- pix = fir[1] >> 8;
- pix |= (FT_UInt)-(FT_Int)( pix >> 8 );
- line[xx - 1] = (FT_Byte)pix;
+ line[xx - 2] = FT_SHIFTCLAMP( fir[0] );
}
+
+ line[xx - 2] = FT_SHIFTCLAMP( fir[1] );
+ line[xx - 1] = FT_SHIFTCLAMP( fir[2] );
}
}
/* vertical in-place FIR filter */
- else if ( mode == FT_RENDER_MODE_LCD_V && height >= 4 )
+ else if ( mode == FT_RENDER_MODE_LCD_V && height >= 2 )
{
- FT_Byte* column = bitmap->buffer;
- FT_Int pitch = bitmap->pitch;
-
+ FT_Byte* column = origin;
- /* take care of bitmap flow */
- if ( bitmap->pitch < 0 )
- column -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 );
for ( ; width > 0; width--, column++ )
{
FT_Byte* col = column;
- FT_UInt fir[4]; /* below, `pix' is used as the 5th element */
- FT_UInt val1, yy;
+ FT_UInt fir[5];
+ FT_UInt val, yy;
- val1 = col[0];
- fir[0] = weights[2] * val1;
- fir[1] = weights[3] * val1;
- fir[2] = weights[4] * val1;
- fir[3] = 0;
- col += pitch;
+ val = col[0];
+ fir[2] = weights[2] * val;
+ fir[3] = weights[3] * val;
+ fir[4] = weights[4] * val;
+ col -= pitch;
- val1 = col[0];
- fir[0] += weights[1] * val1;
- fir[1] += weights[2] * val1;
- fir[2] += weights[3] * val1;
- fir[3] += weights[4] * val1;
- col += pitch;
+ val = col[0];
+ fir[1] = fir[2] + weights[1] * val;
+ fir[2] = fir[3] + weights[2] * val;
+ fir[3] = fir[4] + weights[3] * val;
+ fir[4] = weights[4] * val;
+ col -= pitch;
- for ( yy = 2; yy < height; yy++ )
+ for ( yy = 2; yy < height; yy++, col -= pitch )
{
- FT_UInt val, pix;
-
-
val = col[0];
- pix = fir[0] + weights[0] * val;
- fir[0] = fir[1] + weights[1] * val;
- fir[1] = fir[2] + weights[2] * val;
- fir[2] = fir[3] + weights[3] * val;
- fir[3] = weights[4] * val;
-
- pix >>= 8;
- pix |= (FT_UInt)-(FT_Int)( pix >> 8 );
- col[-2 * pitch] = (FT_Byte)pix;
- col += pitch;
- }
-
- {
- FT_UInt pix;
-
+ fir[0] = fir[1] + weights[0] * val;
+ fir[1] = fir[2] + weights[1] * val;
+ fir[2] = fir[3] + weights[2] * val;
+ fir[3] = fir[4] + weights[3] * val;
+ fir[4] = weights[4] * val;
- pix = fir[0] >> 8;
- pix |= (FT_UInt)-(FT_Int)( pix >> 8 );
- col[-2 * pitch] = (FT_Byte)pix;
-
- pix = fir[1] >> 8;
- pix |= (FT_UInt)-(FT_Int)( pix >> 8 );
- col[-pitch] = (FT_Byte)pix;
+ col[pitch * 2] = FT_SHIFTCLAMP( fir[0] );
}
+
+ col[pitch * 2] = FT_SHIFTCLAMP( fir[1] );
+ col[pitch] = FT_SHIFTCLAMP( fir[2] );
}
}
}
@@ -177,9 +143,10 @@
FT_Render_Mode mode,
FT_Byte* weights )
{
- FT_UInt width = (FT_UInt)bitmap->width;
- FT_UInt height = (FT_UInt)bitmap->rows;
- FT_Int pitch = bitmap->pitch;
+ FT_UInt width = (FT_UInt)bitmap->width;
+ FT_UInt height = (FT_UInt)bitmap->rows;
+ FT_Int pitch = bitmap->pitch;
+ FT_Byte* origin = bitmap->buffer;
static const unsigned int filters[3][3] =
{
@@ -191,33 +158,31 @@
FT_UNUSED( weights );
+ /* take care of bitmap flow */
+ if ( pitch > 0 )
+ origin += pitch * (FT_Int)( height - 1 );
+
/* horizontal in-place intra-pixel filter */
if ( mode == FT_RENDER_MODE_LCD && width >= 3 )
{
- FT_Byte* line = bitmap->buffer;
+ FT_Byte* line = origin;
- /* take care of bitmap flow */
- if ( bitmap->pitch < 0 )
- line -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 );
-
- for ( ; height > 0; height--, line += pitch )
+ for ( ; height > 0; height--, line -= pitch )
{
FT_UInt xx;
for ( xx = 0; xx < width; xx += 3 )
{
- FT_UInt r = 0;
- FT_UInt g = 0;
- FT_UInt b = 0;
+ FT_UInt r, g, b;
FT_UInt p;
p = line[xx];
- r += filters[0][0] * p;
- g += filters[0][1] * p;
- b += filters[0][2] * p;
+ r = filters[0][0] * p;
+ g = filters[0][1] * p;
+ b = filters[0][2] * p;
p = line[xx + 1];
r += filters[1][0] * p;
@@ -237,31 +202,24 @@
}
else if ( mode == FT_RENDER_MODE_LCD_V && height >= 3 )
{
- FT_Byte* column = bitmap->buffer;
-
+ FT_Byte* column = origin;
- /* take care of bitmap flow */
- if ( bitmap->pitch < 0 )
- column -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 );
for ( ; width > 0; width--, column++ )
{
- FT_Byte* col = column;
- FT_Byte* col_end = col + (FT_Int)height * pitch;
+ FT_Byte* col = column - 2 * pitch;
- for ( ; col < col_end; col += 3 * pitch )
+ for ( ; height > 0; height -= 3, col -= 3 * pitch )
{
- FT_UInt r = 0;
- FT_UInt g = 0;
- FT_UInt b = 0;
+ FT_UInt r, g, b;
FT_UInt p;
p = col[0];
- r += filters[0][0] * p;
- g += filters[0][1] * p;
- b += filters[0][2] * p;
+ r = filters[0][0] * p;
+ g = filters[0][1] * p;
+ b = filters[0][2] * p;
p = col[pitch];
r += filters[1][0] * p;
@@ -275,7 +233,7 @@
col[0] = (FT_Byte)( r / 65536 );
col[pitch] = (FT_Byte)( g / 65536 );
- col[2 * pitch] = (FT_Byte)( b / 65536 );
+ col[pitch * 2] = (FT_Byte)( b / 65536 );
}
}
}
@@ -296,7 +254,6 @@
ft_memcpy( library->lcd_weights, weights, FT_LCD_FILTER_FIVE_TAPS );
library->lcd_filter_func = ft_lcd_filter_fir;
- library->lcd_extra = 2;
return FT_Err_Ok;
}
@@ -319,7 +276,6 @@
{
case FT_LCD_FILTER_NONE:
library->lcd_filter_func = NULL;
- library->lcd_extra = 0;
break;
case FT_LCD_FILTER_DEFAULT:
@@ -327,7 +283,6 @@
default_weights,
FT_LCD_FILTER_FIVE_TAPS );
library->lcd_filter_func = ft_lcd_filter_fir;
- library->lcd_extra = 2;
break;
case FT_LCD_FILTER_LIGHT:
@@ -335,7 +290,6 @@
light_weights,
FT_LCD_FILTER_FIVE_TAPS );
library->lcd_filter_func = ft_lcd_filter_fir;
- library->lcd_extra = 2;
break;
#ifdef USE_LEGACY
@@ -343,7 +297,6 @@
case FT_LCD_FILTER_LEGACY:
case FT_LCD_FILTER_LEGACY1:
library->lcd_filter_func = _ft_lcd_filter_legacy;
- library->lcd_extra = 0;
break;
#endif
diff --git a/thirdparty/freetype/src/base/ftmac.c b/thirdparty/freetype/src/base/ftmac.c
index 4b92066da3..4e76585e5f 100644
--- a/thirdparty/freetype/src/base/ftmac.c
+++ b/thirdparty/freetype/src/base/ftmac.c
@@ -1005,7 +1005,7 @@
/* accepts an FSRef instead of a path. */
/* */
/* This function is deprecated because Carbon data types (FSRef) */
- /* are not cross-platform, and thus not suitable for the freetype API. */
+ /* are not cross-platform, and thus not suitable for the FreeType API. */
FT_EXPORT_DEF( FT_Error )
FT_New_Face_From_FSRef( FT_Library library,
const FSRef* ref,
diff --git a/thirdparty/freetype/src/base/ftmm.c b/thirdparty/freetype/src/base/ftmm.c
index 2cb56a39be..43877ece45 100644
--- a/thirdparty/freetype/src/base/ftmm.c
+++ b/thirdparty/freetype/src/base/ftmm.c
@@ -158,7 +158,7 @@
/* check of `face' delayed to `ft_face_get_mm_service' */
- if ( !coords )
+ if ( num_coords && !coords )
return FT_THROW( Invalid_Argument );
error = ft_face_get_mm_service( face, &service );
@@ -194,7 +194,7 @@
/* check of `face' delayed to `ft_face_get_mm_service' */
- if ( !coords )
+ if ( num_coords && !coords )
return FT_THROW( Invalid_Argument );
error = ft_face_get_mm_service( face, &service_mm );
@@ -266,7 +266,7 @@
/* check of `face' delayed to `ft_face_get_mm_service' */
- if ( !coords )
+ if ( num_coords && !coords )
return FT_THROW( Invalid_Argument );
error = ft_face_get_mm_service( face, &service_mm );
@@ -313,7 +313,7 @@
/* check of `face' delayed to `ft_face_get_mm_service' */
- if ( !coords )
+ if ( num_coords && !coords )
return FT_THROW( Invalid_Argument );
error = ft_face_get_mm_service( face, &service_mm );
@@ -402,4 +402,28 @@
}
+ /* documentation is in ftmm.h */
+
+ FT_EXPORT_DEF( FT_Error )
+ FT_Get_Var_Axis_Flags( FT_MM_Var* master,
+ FT_UInt axis_index,
+ FT_UInt* flags )
+ {
+ FT_UShort* axis_flags;
+
+
+ if ( !master || !flags )
+ return FT_THROW( Invalid_Argument );
+
+ if ( axis_index >= master->num_axis )
+ return FT_THROW( Invalid_Argument );
+
+ /* the axis flags array immediately follows the data of `master' */
+ axis_flags = (FT_UShort*)&( master[1] );
+ *flags = axis_flags[axis_index];
+
+ return FT_Err_Ok;
+ }
+
+
/* END */
diff --git a/thirdparty/freetype/src/base/ftobjs.c b/thirdparty/freetype/src/base/ftobjs.c
index 539116e85c..6db8136cfc 100644
--- a/thirdparty/freetype/src/base/ftobjs.c
+++ b/thirdparty/freetype/src/base/ftobjs.c
@@ -579,34 +579,42 @@
if ( vertical )
{
metrics->horiBearingX = FT_PIX_FLOOR( metrics->horiBearingX );
- metrics->horiBearingY = FT_PIX_CEIL ( metrics->horiBearingY );
+ metrics->horiBearingY = FT_PIX_CEIL_LONG( metrics->horiBearingY );
- right = FT_PIX_CEIL( metrics->vertBearingX + metrics->width );
- bottom = FT_PIX_CEIL( metrics->vertBearingY + metrics->height );
+ right = FT_PIX_CEIL_LONG( ADD_LONG( metrics->vertBearingX,
+ metrics->width ) );
+ bottom = FT_PIX_CEIL_LONG( ADD_LONG( metrics->vertBearingY,
+ metrics->height ) );
metrics->vertBearingX = FT_PIX_FLOOR( metrics->vertBearingX );
metrics->vertBearingY = FT_PIX_FLOOR( metrics->vertBearingY );
- metrics->width = right - metrics->vertBearingX;
- metrics->height = bottom - metrics->vertBearingY;
+ metrics->width = SUB_LONG( right,
+ metrics->vertBearingX );
+ metrics->height = SUB_LONG( bottom,
+ metrics->vertBearingY );
}
else
{
metrics->vertBearingX = FT_PIX_FLOOR( metrics->vertBearingX );
metrics->vertBearingY = FT_PIX_FLOOR( metrics->vertBearingY );
- right = FT_PIX_CEIL ( metrics->horiBearingX + metrics->width );
- bottom = FT_PIX_FLOOR( metrics->horiBearingY - metrics->height );
+ right = FT_PIX_CEIL_LONG( ADD_LONG( metrics->horiBearingX,
+ metrics->width ) );
+ bottom = FT_PIX_FLOOR( SUB_LONG( metrics->horiBearingY,
+ metrics->height ) );
metrics->horiBearingX = FT_PIX_FLOOR( metrics->horiBearingX );
- metrics->horiBearingY = FT_PIX_CEIL ( metrics->horiBearingY );
+ metrics->horiBearingY = FT_PIX_CEIL_LONG( metrics->horiBearingY );
- metrics->width = right - metrics->horiBearingX;
- metrics->height = metrics->horiBearingY - bottom;
+ metrics->width = SUB_LONG( right,
+ metrics->horiBearingX );
+ metrics->height = SUB_LONG( metrics->horiBearingY,
+ bottom );
}
- metrics->horiAdvance = FT_PIX_ROUND( metrics->horiAdvance );
- metrics->vertAdvance = FT_PIX_ROUND( metrics->vertAdvance );
+ metrics->horiAdvance = FT_PIX_ROUND_LONG( metrics->horiAdvance );
+ metrics->vertAdvance = FT_PIX_ROUND_LONG( metrics->vertAdvance );
}
#endif /* GRID_FIT_METRICS */
@@ -4549,7 +4557,7 @@
if ( !clazz )
return FT_THROW( Invalid_Argument );
- /* check freetype version */
+ /* check FreeType version */
if ( clazz->module_requires > FREETYPE_VER_FIXED )
return FT_THROW( Invalid_Version );
@@ -4973,10 +4981,6 @@
goto Fail;
#endif
- /* we don't use raster_pool anymore. */
- library->raster_pool_size = 0;
- library->raster_pool = NULL;
-
library->version_major = FREETYPE_MAJOR;
library->version_minor = FREETYPE_MINOR;
library->version_patch = FREETYPE_PATCH;
diff --git a/thirdparty/freetype/src/base/ftoutln.c b/thirdparty/freetype/src/base/ftoutln.c
index 464a066dcc..9ceb9cf1ba 100644
--- a/thirdparty/freetype/src/base/ftoutln.c
+++ b/thirdparty/freetype/src/base/ftoutln.c
@@ -1088,7 +1088,8 @@
v_cur.x = points[n].x >> xshift;
v_cur.y = points[n].y >> yshift;
- area += ( v_cur.y - v_prev.y ) * ( v_cur.x + v_prev.x );
+ area = ADD_LONG( area,
+ ( v_cur.y - v_prev.y ) * ( v_cur.x + v_prev.x ) );
v_prev = v_cur;
}
diff --git a/thirdparty/freetype/src/base/ftrfork.c b/thirdparty/freetype/src/base/ftrfork.c
index f7b81375dd..f5ad2874d8 100644
--- a/thirdparty/freetype/src/base/ftrfork.c
+++ b/thirdparty/freetype/src/base/ftrfork.c
@@ -271,7 +271,13 @@
if ( FT_STREAM_SKIP( 4 ) ) /* mbz */
goto Exit;
- if ( ref[j].res_id < 0 || temp < 0 )
+ /*
+ * According to Inside Macintosh: More Macintosh Toolbox,
+ * "Resource IDs" (1-46), there are some reserved IDs.
+ * However, FreeType2 is not a font synthesizer, no need
+ * to check the acceptable resource ID.
+ */
+ if ( temp < 0 )
{
error = FT_THROW( Invalid_Table );
goto Exit;
@@ -281,7 +287,7 @@
FT_TRACE3(( " [%d]:"
" resource_id=0x%04x, offset=0x%08x\n",
- j, ref[j].res_id, ref[j].offset ));
+ j, (FT_UShort)ref[j].res_id, ref[j].offset ));
}
if ( sort_by_res_id )
diff --git a/thirdparty/freetype/src/base/ftsynth.c b/thirdparty/freetype/src/base/ftsynth.c
index 66dae6037a..5cf386f48d 100644
--- a/thirdparty/freetype/src/base/ftsynth.c
+++ b/thirdparty/freetype/src/base/ftsynth.c
@@ -123,7 +123,7 @@
/*
* XXX: overflow check for 16-bit system, for compatibility
- * with FT_GlyphSlot_Embolden() since freetype-2.1.10.
+ * with FT_GlyphSlot_Embolden() since FreeType 2.1.10.
* unfortunately, this function return no informations
* about the cause of error.
*/
diff --git a/thirdparty/freetype/src/base/ftutil.c b/thirdparty/freetype/src/base/ftutil.c
index dccc209f4d..7bd5bee87c 100644
--- a/thirdparty/freetype/src/base/ftutil.c
+++ b/thirdparty/freetype/src/base/ftutil.c
@@ -135,7 +135,7 @@
ft_mem_free( memory, block );
block = NULL;
}
- else if ( new_count > FT_INT_MAX/item_size )
+ else if ( new_count > FT_INT_MAX / item_size )
{
error = FT_THROW( Array_Too_Large );
}
@@ -143,13 +143,15 @@
{
FT_ASSERT( !block );
- block = ft_mem_alloc( memory, new_count*item_size, &error );
+ block = memory->alloc( memory, new_count * item_size );
+ if ( block == NULL )
+ error = FT_THROW( Out_Of_Memory );
}
else
{
FT_Pointer block2;
- FT_Long cur_size = cur_count*item_size;
- FT_Long new_size = new_count*item_size;
+ FT_Long cur_size = cur_count * item_size;
+ FT_Long new_size = new_count * item_size;
block2 = memory->realloc( memory, cur_size, new_size, block );
diff --git a/thirdparty/freetype/src/bdf/bdfdrivr.c b/thirdparty/freetype/src/bdf/bdfdrivr.c
index a2242be014..fb77810007 100644
--- a/thirdparty/freetype/src/bdf/bdfdrivr.c
+++ b/thirdparty/freetype/src/bdf/bdfdrivr.c
@@ -373,7 +373,7 @@ THE SOFTWARE.
/* we have a bdf font: let's construct the face object */
face->bdffont = font;
- /* BDF could not have multiple face in single font file.
+ /* BDF cannot have multiple faces in a single font file.
* XXX: non-zero face_index is already invalid argument, but
* Type1, Type42 driver has a convention to return
* an invalid argument error when the font could be
@@ -437,46 +437,156 @@ THE SOFTWARE.
{
FT_Bitmap_Size* bsize = bdfface->available_sizes;
FT_Short resolution_x = 0, resolution_y = 0;
+ long value;
FT_ZERO( bsize );
+ /* sanity checks */
+ if ( font->font_ascent > 0x7FFF || font->font_ascent < -0x7FFF )
+ {
+ font->font_ascent = font->font_ascent < 0 ? -0x7FFF : 0x7FFF;
+ FT_TRACE0(( "BDF_Face_Init: clamping font ascent to value %d\n",
+ font->font_ascent ));
+ }
+ if ( font->font_descent > 0x7FFF || font->font_descent < -0x7FFF )
+ {
+ font->font_descent = font->font_descent < 0 ? -0x7FFF : 0x7FFF;
+ FT_TRACE0(( "BDF_Face_Init: clamping font descent to value %d\n",
+ font->font_descent ));
+ }
+
bsize->height = (FT_Short)( font->font_ascent + font->font_descent );
prop = bdf_get_font_property( font, "AVERAGE_WIDTH" );
if ( prop )
- bsize->width = (FT_Short)( ( prop->value.l + 5 ) / 10 );
+ {
+#ifdef FT_DEBUG_LEVEL_TRACE
+ if ( prop->value.l < 0 )
+ FT_TRACE0(( "BDF_Face_Init: negative average width\n" ));
+#endif
+ if ( prop->value.l > 0x7FFFL * 10 - 5 ||
+ prop->value.l < -( 0x7FFFL * 10 - 5 ) )
+ {
+ bsize->width = 0x7FFF;
+ FT_TRACE0(( "BDF_Face_Init: clamping average width to value %d\n",
+ bsize->width ));
+ }
+ else
+ bsize->width = FT_ABS( (FT_Short)( ( prop->value.l + 5 ) / 10 ) );
+ }
else
- bsize->width = (FT_Short)( bsize->height * 2/3 );
+ {
+ /* this is a heuristical value */
+ bsize->width = (FT_Short)FT_MulDiv( bsize->height, 2, 3 );
+ }
prop = bdf_get_font_property( font, "POINT_SIZE" );
if ( prop )
+ {
+#ifdef FT_DEBUG_LEVEL_TRACE
+ if ( prop->value.l < 0 )
+ FT_TRACE0(( "BDF_Face_Init: negative point size\n" ));
+#endif
/* convert from 722.7 decipoints to 72 points per inch */
- bsize->size =
- (FT_Pos)( ( prop->value.l * 64 * 7200 + 36135L ) / 72270L );
+ if ( prop->value.l > 0x504C2L || /* 0x7FFF * 72270/7200 */
+ prop->value.l < -0x504C2L )
+ {
+ bsize->size = 0x7FFF;
+ FT_TRACE0(( "BDF_Face_Init: clamping point size to value %d\n",
+ bsize->size ));
+ }
+ else
+ bsize->size = FT_MulDiv( FT_ABS( prop->value.l ),
+ 64 * 7200,
+ 72270L );
+ }
+ else if ( font->point_size )
+ {
+ if ( font->point_size > 0x7FFF )
+ {
+ bsize->size = 0x7FFF;
+ FT_TRACE0(( "BDF_Face_Init: clamping point size to value %d\n",
+ bsize->size ));
+ }
+ else
+ bsize->size = (FT_Pos)font->point_size << 6;
+ }
else
- bsize->size = bsize->width << 6;
+ {
+ /* this is a heuristical value */
+ bsize->size = bsize->width * 64;
+ }
prop = bdf_get_font_property( font, "PIXEL_SIZE" );
if ( prop )
- bsize->y_ppem = (FT_Short)prop->value.l << 6;
+ {
+#ifdef FT_DEBUG_LEVEL_TRACE
+ if ( prop->value.l < 0 )
+ FT_TRACE0(( "BDF_Face_Init: negative pixel size\n" ));
+#endif
+ if ( prop->value.l > 0x7FFF || prop->value.l < -0x7FFF )
+ {
+ bsize->y_ppem = 0x7FFF << 6;
+ FT_TRACE0(( "BDF_Face_Init: clamping pixel size to value %d\n",
+ bsize->y_ppem ));
+ }
+ else
+ bsize->y_ppem = FT_ABS( (FT_Short)prop->value.l ) << 6;
+ }
prop = bdf_get_font_property( font, "RESOLUTION_X" );
if ( prop )
- resolution_x = (FT_Short)prop->value.l;
+ value = prop->value.l;
+ else
+ value = (long)font->resolution_x;
+ if ( value )
+ {
+#ifdef FT_DEBUG_LEVEL_TRACE
+ if ( value < 0 )
+ FT_TRACE0(( "BDF_Face_Init: negative X resolution\n" ));
+#endif
+ if ( value > 0x7FFF || value < -0x7FFF )
+ {
+ resolution_x = 0x7FFF;
+ FT_TRACE0(( "BDF_Face_Init: clamping X resolution to value %d\n",
+ resolution_x ));
+ }
+ else
+ resolution_x = FT_ABS( (FT_Short)value );
+ }
prop = bdf_get_font_property( font, "RESOLUTION_Y" );
if ( prop )
- resolution_y = (FT_Short)prop->value.l;
+ value = prop->value.l;
+ else
+ value = (long)font->resolution_y;
+ if ( value )
+ {
+#ifdef FT_DEBUG_LEVEL_TRACE
+ if ( value < 0 )
+ FT_TRACE0(( "BDF_Face_Init: negative Y resolution\n" ));
+#endif
+ if ( value > 0x7FFF || value < -0x7FFF )
+ {
+ resolution_y = 0x7FFF;
+ FT_TRACE0(( "BDF_Face_Init: clamping Y resolution to value %d\n",
+ resolution_y ));
+ }
+ else
+ resolution_y = FT_ABS( (FT_Short)value );
+ }
if ( bsize->y_ppem == 0 )
{
bsize->y_ppem = bsize->size;
if ( resolution_y )
- bsize->y_ppem = bsize->y_ppem * resolution_y / 72;
+ bsize->y_ppem = FT_MulDiv( bsize->y_ppem, resolution_y, 72 );
}
if ( resolution_x && resolution_y )
- bsize->x_ppem = bsize->y_ppem * resolution_x / resolution_y;
+ bsize->x_ppem = FT_MulDiv( bsize->y_ppem,
+ resolution_x,
+ resolution_y );
else
bsize->x_ppem = bsize->y_ppem;
}
@@ -545,7 +655,11 @@ THE SOFTWARE.
if ( !ft_strcmp( s, "10646" ) ||
( !ft_strcmp( s, "8859" ) &&
!ft_strcmp( face->charset_encoding, "1" ) ) )
- unicode_charmap = 1;
+ unicode_charmap = 1;
+ /* another name for ASCII */
+ else if ( !ft_strcmp( s, "646.1991" ) &&
+ !ft_strcmp( face->charset_encoding, "IRV" ) )
+ unicode_charmap = 1;
}
{
@@ -566,12 +680,6 @@ THE SOFTWARE.
}
error = FT_CMap_New( &bdf_cmap_class, NULL, &charmap, NULL );
-
-#if 0
- /* Select default charmap */
- if ( bdfface->num_charmaps )
- bdfface->charmap = bdfface->charmaps[0];
-#endif
}
goto Exit;
diff --git a/thirdparty/freetype/src/bdf/bdflib.c b/thirdparty/freetype/src/bdf/bdflib.c
index 7fd95a7385..bf10887fd4 100644
--- a/thirdparty/freetype/src/bdf/bdflib.c
+++ b/thirdparty/freetype/src/bdf/bdflib.c
@@ -704,7 +704,15 @@
return 0;
for ( v = 0; sbitset( ddigits, *s ); s++ )
- v = v * 10 + a2i[(int)*s];
+ {
+ if ( v < ( ULONG_MAX - 9 ) / 10 )
+ v = v * 10 + a2i[(int)*s];
+ else
+ {
+ v = ULONG_MAX;
+ break;
+ }
+ }
return v;
}
@@ -729,7 +737,15 @@
}
for ( v = 0; sbitset( ddigits, *s ); s++ )
- v = v * 10 + a2i[(int)*s];
+ {
+ if ( v < ( LONG_MAX - 9 ) / 10 )
+ v = v * 10 + a2i[(int)*s];
+ else
+ {
+ v = LONG_MAX;
+ break;
+ }
+ }
return ( !neg ) ? v : -v;
}
@@ -746,7 +762,15 @@
return 0;
for ( v = 0; sbitset( ddigits, *s ); s++ )
- v = (unsigned short)( v * 10 + a2i[(int)*s] );
+ {
+ if ( v < ( USHRT_MAX - 9 ) / 10 )
+ v = (unsigned short)( v * 10 + a2i[(int)*s] );
+ else
+ {
+ v = USHRT_MAX;
+ break;
+ }
+ }
return v;
}
@@ -771,7 +795,15 @@
}
for ( v = 0; sbitset( ddigits, *s ); s++ )
- v = (short)( v * 10 + a2i[(int)*s] );
+ {
+ if ( v < ( SHRT_MAX - 9 ) / 10 )
+ v = (short)( v * 10 + a2i[(int)*s] );
+ else
+ {
+ v = SHRT_MAX;
+ break;
+ }
+ }
return (short)( ( !neg ) ? v : -v );
}
diff --git a/thirdparty/freetype/src/cache/ftcbasic.c b/thirdparty/freetype/src/cache/ftcbasic.c
index 289bd5c430..e804776ab4 100644
--- a/thirdparty/freetype/src/cache/ftcbasic.c
+++ b/thirdparty/freetype/src/cache/ftcbasic.c
@@ -304,10 +304,18 @@
if ( anode )
*anode = NULL;
- if ( (FT_ULong)( type->flags - FT_INT_MIN ) > FT_UINT_MAX )
+ /*
+ * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt',
+ * but public `FT_ImageType->flags' is of type `FT_Int32'.
+ *
+ * On 16bit systems, higher bits of type->flags cannot be handled.
+ */
+#if 0xFFFFFFFFUL > FT_UINT_MAX
+ if ( (type->flags & (FT_ULong)FT_UINT_MAX) )
FT_TRACE1(( "FTC_ImageCache_Lookup:"
" higher bits in load_flags 0x%x are dropped\n",
(FT_ULong)type->flags & ~((FT_ULong)FT_UINT_MAX) ));
+#endif
query.attrs.scaler.face_id = type->face_id;
query.attrs.scaler.width = type->width;
@@ -377,11 +385,18 @@
if ( anode )
*anode = NULL;
- /* `FT_Load_Glyph' and `FT_Load_Char' take FT_UInt flags */
+ /*
+ * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt',
+ * but public `FT_Face->face_flags' is of type `FT_Long'.
+ *
+ * On long > int systems, higher bits of load_flags cannot be handled.
+ */
+#if FT_ULONG_MAX > FT_UINT_MAX
if ( load_flags > FT_UINT_MAX )
FT_TRACE1(( "FTC_ImageCache_LookupScaler:"
" higher bits in load_flags 0x%x are dropped\n",
load_flags & ~((FT_ULong)FT_UINT_MAX) ));
+#endif
query.attrs.scaler = scaler[0];
query.attrs.load_flags = (FT_UInt)load_flags;
@@ -487,10 +502,18 @@
*ansbit = NULL;
- if ( (FT_ULong)( type->flags - FT_INT_MIN ) > FT_UINT_MAX )
+ /*
+ * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt',
+ * but public `FT_ImageType->flags' is of type `FT_Int32'.
+ *
+ * On 16bit systems, higher bits of type->flags cannot be handled.
+ */
+#if 0xFFFFFFFFUL > FT_UINT_MAX
+ if ( (type->flags & (FT_ULong)FT_UINT_MAX) )
FT_TRACE1(( "FTC_ImageCache_Lookup:"
" higher bits in load_flags 0x%x are dropped\n",
(FT_ULong)type->flags & ~((FT_ULong)FT_UINT_MAX) ));
+#endif
query.attrs.scaler.face_id = type->face_id;
query.attrs.scaler.width = type->width;
@@ -562,11 +585,18 @@
*ansbit = NULL;
- /* `FT_Load_Glyph' and `FT_Load_Char' take FT_UInt flags */
+ /*
+ * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt',
+ * but public `FT_Face->face_flags' is of type `FT_Long'.
+ *
+ * On long > int systems, higher bits of load_flags cannot be handled.
+ */
+#if FT_ULONG_MAX > FT_UINT_MAX
if ( load_flags > FT_UINT_MAX )
FT_TRACE1(( "FTC_ImageCache_LookupScaler:"
" higher bits in load_flags 0x%x are dropped\n",
load_flags & ~((FT_ULong)FT_UINT_MAX) ));
+#endif
query.attrs.scaler = scaler[0];
query.attrs.load_flags = (FT_UInt)load_flags;
diff --git a/thirdparty/freetype/src/cff/cf2blues.c b/thirdparty/freetype/src/cff/cf2blues.c
index 250f89e0df..c491f2f9e5 100644
--- a/thirdparty/freetype/src/cff/cf2blues.c
+++ b/thirdparty/freetype/src/cff/cf2blues.c
@@ -194,8 +194,8 @@
blues->zone[blues->count].csTopEdge =
cf2_blueToFixed( blueValues[i + 1] );
- zoneHeight = blues->zone[blues->count].csTopEdge -
- blues->zone[blues->count].csBottomEdge;
+ zoneHeight = SUB_INT32( blues->zone[blues->count].csTopEdge,
+ blues->zone[blues->count].csBottomEdge );
if ( zoneHeight < 0 )
{
@@ -243,8 +243,8 @@
blues->zone[blues->count].csTopEdge =
cf2_blueToFixed( otherBlues[i + 1] );
- zoneHeight = blues->zone[blues->count].csTopEdge -
- blues->zone[blues->count].csBottomEdge;
+ zoneHeight = SUB_INT32( blues->zone[blues->count].csTopEdge,
+ blues->zone[blues->count].csBottomEdge );
if ( zoneHeight < 0 )
{
@@ -301,7 +301,7 @@
/* top edge */
flatFamilyEdge = cf2_blueToFixed( familyOtherBlues[j + 1] );
- diff = cf2_fixedAbs( flatEdge - flatFamilyEdge );
+ diff = cf2_fixedAbs( SUB_INT32( flatEdge, flatFamilyEdge ) );
if ( diff < minDiff && diff < csUnitsPerPixel )
{
@@ -319,7 +319,7 @@
/* top edge */
flatFamilyEdge = cf2_blueToFixed( familyBlues[1] );
- diff = cf2_fixedAbs( flatEdge - flatFamilyEdge );
+ diff = cf2_fixedAbs( SUB_INT32( flatEdge, flatFamilyEdge ) );
if ( diff < minDiff && diff < csUnitsPerPixel )
blues->zone[i].csFlatEdge = flatFamilyEdge;
@@ -342,7 +342,7 @@
/* adjust edges of top zone upward by twice darkening amount */
flatFamilyEdge += 2 * font->darkenY; /* bottom edge */
- diff = cf2_fixedAbs( flatEdge - flatFamilyEdge );
+ diff = cf2_fixedAbs( SUB_INT32( flatEdge, flatFamilyEdge ) );
if ( diff < minDiff && diff < csUnitsPerPixel )
{
@@ -408,8 +408,8 @@
/* Note: constant changed from 0.5 to 0.6 to avoid a problem with */
/* 10ppem Arial */
- blues->boost = cf2_floatToFixed( .6 ) -
- FT_MulDiv( cf2_floatToFixed ( .6 ),
+ blues->boost = cf2_doubleToFixed( .6 ) -
+ FT_MulDiv( cf2_doubleToFixed ( .6 ),
blues->scale,
blues->blueScale );
if ( blues->boost > 0x7FFF )
@@ -489,17 +489,18 @@
if ( blues->zone[i].bottomZone &&
cf2_hint_isBottom( bottomHintEdge ) )
{
- if ( ( blues->zone[i].csBottomEdge - csFuzz ) <=
- bottomHintEdge->csCoord &&
+ if ( SUB_INT32( blues->zone[i].csBottomEdge, csFuzz ) <=
+ bottomHintEdge->csCoord &&
bottomHintEdge->csCoord <=
- ( blues->zone[i].csTopEdge + csFuzz ) )
+ ADD_INT32( blues->zone[i].csTopEdge, csFuzz ) )
{
/* bottom edge captured by bottom zone */
if ( blues->suppressOvershoot )
dsNew = blues->zone[i].dsFlatEdge;
- else if ( ( blues->zone[i].csTopEdge - bottomHintEdge->csCoord ) >=
+ else if ( SUB_INT32( blues->zone[i].csTopEdge,
+ bottomHintEdge->csCoord ) >=
blues->blueShift )
{
/* guarantee minimum of 1 pixel overshoot */
@@ -514,7 +515,7 @@
dsNew = cf2_fixedRound( bottomHintEdge->dsCoord );
}
- dsMove = dsNew - bottomHintEdge->dsCoord;
+ dsMove = SUB_INT32( dsNew, bottomHintEdge->dsCoord );
captured = TRUE;
break;
@@ -523,17 +524,18 @@
if ( !blues->zone[i].bottomZone && cf2_hint_isTop( topHintEdge ) )
{
- if ( ( blues->zone[i].csBottomEdge - csFuzz ) <=
- topHintEdge->csCoord &&
+ if ( SUB_INT32( blues->zone[i].csBottomEdge, csFuzz ) <=
+ topHintEdge->csCoord &&
topHintEdge->csCoord <=
- ( blues->zone[i].csTopEdge + csFuzz ) )
+ ADD_INT32( blues->zone[i].csTopEdge, csFuzz ) )
{
/* top edge captured by top zone */
if ( blues->suppressOvershoot )
dsNew = blues->zone[i].dsFlatEdge;
- else if ( ( topHintEdge->csCoord - blues->zone[i].csBottomEdge ) >=
+ else if ( SUB_INT32( topHintEdge->csCoord,
+ blues->zone[i].csBottomEdge ) >=
blues->blueShift )
{
/* guarantee minimum of 1 pixel overshoot */
@@ -548,7 +550,7 @@
dsNew = cf2_fixedRound( topHintEdge->dsCoord );
}
- dsMove = dsNew - topHintEdge->dsCoord;
+ dsMove = SUB_INT32( dsNew, topHintEdge->dsCoord );
captured = TRUE;
break;
@@ -561,13 +563,14 @@
/* move both edges and flag them `locked' */
if ( cf2_hint_isValid( bottomHintEdge ) )
{
- bottomHintEdge->dsCoord += dsMove;
+ bottomHintEdge->dsCoord = ADD_INT32( bottomHintEdge->dsCoord,
+ dsMove );
cf2_hint_lock( bottomHintEdge );
}
if ( cf2_hint_isValid( topHintEdge ) )
{
- topHintEdge->dsCoord += dsMove;
+ topHintEdge->dsCoord = ADD_INT32( topHintEdge->dsCoord, dsMove );
cf2_hint_lock( topHintEdge );
}
}
diff --git a/thirdparty/freetype/src/cff/cf2blues.h b/thirdparty/freetype/src/cff/cf2blues.h
index 96fb60f38d..a6bcd9de57 100644
--- a/thirdparty/freetype/src/cff/cf2blues.h
+++ b/thirdparty/freetype/src/cff/cf2blues.h
@@ -111,7 +111,7 @@ FT_BEGIN_HEADER
* Constant used for hint adjustment and for synthetic em box hint
* placement.
*/
-#define CF2_MIN_COUNTER cf2_floatToFixed( 0.5 )
+#define CF2_MIN_COUNTER cf2_doubleToFixed( 0.5 )
/* shared typedef is in cf2glue.h */
diff --git a/thirdparty/freetype/src/cff/cf2fixed.h b/thirdparty/freetype/src/cff/cf2fixed.h
index 2e4b5032fa..a041184bda 100644
--- a/thirdparty/freetype/src/cff/cf2fixed.h
+++ b/thirdparty/freetype/src/cff/cf2fixed.h
@@ -63,10 +63,10 @@ FT_BEGIN_HEADER
( (FT_Short)( ( (FT_UInt32)(x) + 0x8000U ) >> 16 ) )
#define cf2_fixedRound( x ) \
( (CF2_Fixed)( ( (FT_UInt32)(x) + 0x8000U ) & 0xFFFF0000UL ) )
-#define cf2_floatToFixed( f ) \
+#define cf2_doubleToFixed( f ) \
( (CF2_Fixed)( (f) * 65536.0 + 0.5 ) )
#define cf2_fixedAbs( x ) \
- ( (x) < 0 ? -(x) : (x) )
+ ( (x) < 0 ? NEG_INT32( x ) : (x) )
#define cf2_fixedFloor( x ) \
( (CF2_Fixed)( (FT_UInt32)(x) & 0xFFFF0000UL ) )
#define cf2_fixedFraction( x ) \
diff --git a/thirdparty/freetype/src/cff/cf2font.c b/thirdparty/freetype/src/cff/cf2font.c
index a86e3619b4..4ac71a8d71 100644
--- a/thirdparty/freetype/src/cff/cf2font.c
+++ b/thirdparty/freetype/src/cff/cf2font.c
@@ -117,7 +117,7 @@
return;
/* protect against range problems and divide by zero */
- if ( emRatio < cf2_floatToFixed( .01 ) )
+ if ( emRatio < cf2_doubleToFixed( .01 ) )
return;
if ( stemDarkened )
@@ -447,7 +447,7 @@
/* choose a constant for StdHW that depends on font contrast */
stdHW = cf2_getStdHW( decoder );
- if ( stdHW > 0 && font->stdVW > 2 * stdHW )
+ if ( stdHW > 0 && font->stdVW > MUL_INT32( 2, stdHW ) )
font->stdHW = FT_DivFix( cf2_intToFixed( 75 ), emRatio );
else
{
diff --git a/thirdparty/freetype/src/cff/cf2ft.c b/thirdparty/freetype/src/cff/cf2ft.c
index eb8472f119..c6c00d1623 100644
--- a/thirdparty/freetype/src/cff/cf2ft.c
+++ b/thirdparty/freetype/src/cff/cf2ft.c
@@ -267,8 +267,8 @@
if ( *hinted )
{
- *x_scale = ( decoder->builder.glyph->x_scale + 32 ) / 64;
- *y_scale = ( decoder->builder.glyph->y_scale + 32 ) / 64;
+ *x_scale = ADD_INT32( decoder->builder.glyph->x_scale, 32 ) / 64;
+ *y_scale = ADD_INT32( decoder->builder.glyph->y_scale, 32 ) / 64;
}
else
{
diff --git a/thirdparty/freetype/src/cff/cf2hints.c b/thirdparty/freetype/src/cff/cf2hints.c
index c8f7dfeba6..656eb2cff1 100644
--- a/thirdparty/freetype/src/cff/cf2hints.c
+++ b/thirdparty/freetype/src/cff/cf2hints.c
@@ -74,8 +74,8 @@
/* cross product of pt1 position from origin with pt2 position from */
/* pt1; we reduce the precision so that the result fits into 32 bits */
- return ( x1 >> 16 ) * ( ( y2 - y1 ) >> 16 ) -
- ( y1 >> 16 ) * ( ( x2 - x1 ) >> 16 );
+ return ( x1 >> 16 ) * ( SUB_INT32( y2, y1 ) >> 16 ) -
+ ( y1 >> 16 ) * ( SUB_INT32( x2, x1 ) >> 16 );
}
@@ -105,7 +105,7 @@
stemHintArray,
indexStemHint );
- width = stemHint->max - stemHint->min;
+ width = SUB_INT32( stemHint->max, stemHint->min );
if ( width == cf2_intToFixed( -21 ) )
{
@@ -185,11 +185,11 @@
/* darkening. Bottoms are not changed; tops are incremented by twice */
/* `darkenY'. */
if ( cf2_hint_isTop( hint ) )
- hint->csCoord += 2 * font->darkenY;
+ hint->csCoord = ADD_INT32( hint->csCoord, 2 * font->darkenY );
- hint->csCoord += hintOrigin;
- hint->scale = scale;
- hint->index = indexStemHint; /* index in original stem hint array */
+ hint->csCoord = ADD_INT32( hint->csCoord, hintOrigin );
+ hint->scale = scale;
+ hint->index = indexStemHint; /* index in original stem hint array */
/* if original stem hint has been used, use the same position */
if ( hint->flags != 0 && stemHint->used )
@@ -314,6 +314,7 @@
/* start linear search from last hit */
CF2_UInt i = hintmap->lastIndex;
+
FT_ASSERT( hintmap->lastIndex < CF2_MAX_HINT_EDGES );
/* search up */
@@ -330,9 +331,10 @@
if ( i == 0 && csCoord < hintmap->edge[0].csCoord )
{
/* special case for points below first edge: use uniform scale */
- return FT_MulFix( csCoord - hintmap->edge[0].csCoord,
- hintmap->scale ) +
- hintmap->edge[0].dsCoord;
+ return ADD_INT32( FT_MulFix( SUB_INT32( csCoord,
+ hintmap->edge[0].csCoord ),
+ hintmap->scale ),
+ hintmap->edge[0].dsCoord );
}
else
{
@@ -340,9 +342,10 @@
* Note: entries with duplicate csCoord are allowed.
* Use edge[i], the highest entry where csCoord >= entry[i].csCoord
*/
- return FT_MulFix( csCoord - hintmap->edge[i].csCoord,
- hintmap->edge[i].scale ) +
- hintmap->edge[i].dsCoord;
+ return ADD_INT32( FT_MulFix( SUB_INT32( csCoord,
+ hintmap->edge[i].csCoord ),
+ hintmap->edge[i].scale ),
+ hintmap->edge[i].dsCoord );
}
}
}
@@ -437,14 +440,16 @@
/* is there room to move up? */
/* there is if we are at top of array or the next edge is at or */
/* beyond proposed move up? */
- if ( j >= hintmap->count - 1 ||
+ if ( j >= hintmap->count - 1 ||
hintmap->edge[j + 1].dsCoord >=
- hintmap->edge[j].dsCoord + moveUp + upMinCounter )
+ ADD_INT32( hintmap->edge[j].dsCoord,
+ moveUp + upMinCounter ) )
{
/* there is room to move up; is there also room to move down? */
- if ( i == 0 ||
+ if ( i == 0 ||
hintmap->edge[i - 1].dsCoord <=
- hintmap->edge[i].dsCoord + moveDown - downMinCounter )
+ ADD_INT32( hintmap->edge[i].dsCoord,
+ moveDown - downMinCounter ) )
{
/* move smaller absolute amount */
move = ( -moveDown < moveUp ) ? moveDown : moveUp; /* optimum */
@@ -455,9 +460,10 @@
else
{
/* is there room to move down? */
- if ( i == 0 ||
+ if ( i == 0 ||
hintmap->edge[i - 1].dsCoord <=
- hintmap->edge[i].dsCoord + moveDown - downMinCounter )
+ ADD_INT32( hintmap->edge[i].dsCoord,
+ moveDown - downMinCounter ) )
{
move = moveDown;
/* true if non-optimum move */
@@ -491,9 +497,11 @@
}
/* move the edge(s) */
- hintmap->edge[i].dsCoord += move;
+ hintmap->edge[i].dsCoord = ADD_INT32( hintmap->edge[i].dsCoord,
+ move );
if ( isPair )
- hintmap->edge[j].dsCoord += move;
+ hintmap->edge[j].dsCoord = ADD_INT32( hintmap->edge[j].dsCoord,
+ move );
}
/* assert there are no overlaps in device space */
@@ -507,18 +515,20 @@
{
if ( hintmap->edge[i].csCoord != hintmap->edge[i - 1].csCoord )
hintmap->edge[i - 1].scale =
- FT_DivFix(
- hintmap->edge[i].dsCoord - hintmap->edge[i - 1].dsCoord,
- hintmap->edge[i].csCoord - hintmap->edge[i - 1].csCoord );
+ FT_DivFix( SUB_INT32( hintmap->edge[i].dsCoord,
+ hintmap->edge[i - 1].dsCoord ),
+ SUB_INT32( hintmap->edge[i].csCoord,
+ hintmap->edge[i - 1].csCoord ) );
}
if ( isPair )
{
if ( hintmap->edge[j].csCoord != hintmap->edge[j - 1].csCoord )
hintmap->edge[j - 1].scale =
- FT_DivFix(
- hintmap->edge[j].dsCoord - hintmap->edge[j - 1].dsCoord,
- hintmap->edge[j].csCoord - hintmap->edge[j - 1].csCoord );
+ FT_DivFix( SUB_INT32( hintmap->edge[j].dsCoord,
+ hintmap->edge[j - 1].dsCoord ),
+ SUB_INT32( hintmap->edge[j].csCoord,
+ hintmap->edge[j - 1].csCoord ) );
i += 1; /* skip upper edge on next loop */
}
@@ -539,15 +549,18 @@
/* is there room to move up? */
if ( hintmap->edge[j + 1].dsCoord >=
- hintmap->edge[j].dsCoord + hintMove->moveUp + CF2_MIN_COUNTER )
+ ADD_INT32( hintmap->edge[j].dsCoord,
+ hintMove->moveUp + CF2_MIN_COUNTER ) )
{
/* there is more room now, move edge up */
- hintmap->edge[j].dsCoord += hintMove->moveUp;
+ hintmap->edge[j].dsCoord = ADD_INT32( hintmap->edge[j].dsCoord,
+ hintMove->moveUp );
if ( cf2_hint_isPair( &hintmap->edge[j] ) )
{
FT_ASSERT( j > 0 );
- hintmap->edge[j - 1].dsCoord += hintMove->moveUp;
+ hintmap->edge[j - 1].dsCoord =
+ ADD_INT32( hintmap->edge[j - 1].dsCoord, hintMove->moveUp );
}
}
}
@@ -635,18 +648,19 @@
{
/* Use hint map to position the center of stem, and nominal scale */
/* to position the two edges. This preserves the stem width. */
- CF2_Fixed midpoint = cf2_hintmap_map(
- hintmap->initialHintMap,
- ( secondHintEdge->csCoord +
- firstHintEdge->csCoord ) / 2 );
- CF2_Fixed halfWidth = FT_MulFix(
- ( secondHintEdge->csCoord -
- firstHintEdge->csCoord ) / 2,
- hintmap->scale );
-
-
- firstHintEdge->dsCoord = midpoint - halfWidth;
- secondHintEdge->dsCoord = midpoint + halfWidth;
+ CF2_Fixed midpoint =
+ cf2_hintmap_map(
+ hintmap->initialHintMap,
+ ADD_INT32( secondHintEdge->csCoord,
+ firstHintEdge->csCoord ) / 2 );
+ CF2_Fixed halfWidth =
+ FT_MulFix( SUB_INT32( secondHintEdge->csCoord,
+ firstHintEdge->csCoord ) / 2,
+ hintmap->scale );
+
+
+ firstHintEdge->dsCoord = SUB_INT32( midpoint, halfWidth );
+ secondHintEdge->dsCoord = ADD_INT32( midpoint, halfWidth );
}
else
firstHintEdge->dsCoord = cf2_hintmap_map( hintmap->initialHintMap,
@@ -715,7 +729,7 @@
/* insert first edge */
hintmap->edge[indexInsert] = *firstHintEdge; /* copy struct */
- hintmap->count += 1;
+ hintmap->count += 1;
if ( isPair )
{
@@ -781,7 +795,7 @@
cf2_arrstack_size( hStemHintArray ) +
cf2_arrstack_size( vStemHintArray ) );
if ( !cf2_hintmask_isValid( hintMask ) )
- return; /* too many stem hints */
+ return; /* too many stem hints */
}
/* begin by clearing the map */
@@ -797,7 +811,7 @@
/* Defense-in-depth. Should never return here. */
if ( bitCount > hintMask->bitCount )
- return;
+ return;
/* synthetic embox hints get highest priority */
if ( font->blues.doEmBoxHints )
@@ -1063,7 +1077,7 @@
cf2_fixedAbs( glyphpath->yOffset ) );
/* .1 character space unit */
- glyphpath->snapThreshold = cf2_floatToFixed( 0.1f );
+ glyphpath->snapThreshold = cf2_doubleToFixed( 0.1 );
glyphpath->moveIsPending = TRUE;
glyphpath->pathIsOpen = FALSE;
@@ -1095,16 +1109,20 @@
FT_Vector pt; /* hinted point in upright DS */
- pt.x = FT_MulFix( glyphpath->scaleX, x ) +
- FT_MulFix( glyphpath->scaleC, y );
+ pt.x = ADD_INT32( FT_MulFix( glyphpath->scaleX, x ),
+ FT_MulFix( glyphpath->scaleC, y ) );
pt.y = cf2_hintmap_map( hintmap, y );
- ppt->x = FT_MulFix( glyphpath->font->outerTransform.a, pt.x ) +
- FT_MulFix( glyphpath->font->outerTransform.c, pt.y ) +
- glyphpath->fractionalTranslation.x;
- ppt->y = FT_MulFix( glyphpath->font->outerTransform.b, pt.x ) +
- FT_MulFix( glyphpath->font->outerTransform.d, pt.y ) +
- glyphpath->fractionalTranslation.y;
+ ppt->x = ADD_INT32(
+ FT_MulFix( glyphpath->font->outerTransform.a, pt.x ),
+ ADD_INT32(
+ FT_MulFix( glyphpath->font->outerTransform.c, pt.y ),
+ glyphpath->fractionalTranslation.x ) );
+ ppt->y = ADD_INT32(
+ FT_MulFix( glyphpath->font->outerTransform.b, pt.x ),
+ ADD_INT32(
+ FT_MulFix( glyphpath->font->outerTransform.d, pt.y ),
+ glyphpath->fractionalTranslation.y ) );
}
@@ -1154,12 +1172,12 @@
CF2_Fixed denominator, s;
- u.x = CF2_CS_SCALE( u2->x - u1->x );
- u.y = CF2_CS_SCALE( u2->y - u1->y );
- v.x = CF2_CS_SCALE( v2->x - v1->x );
- v.y = CF2_CS_SCALE( v2->y - v1->y );
- w.x = CF2_CS_SCALE( v1->x - u1->x );
- w.y = CF2_CS_SCALE( v1->y - u1->y );
+ u.x = CF2_CS_SCALE( SUB_INT32( u2->x, u1->x ) );
+ u.y = CF2_CS_SCALE( SUB_INT32( u2->y, u1->y ) );
+ v.x = CF2_CS_SCALE( SUB_INT32( v2->x, v1->x ) );
+ v.y = CF2_CS_SCALE( SUB_INT32( v2->y, v1->y ) );
+ w.x = CF2_CS_SCALE( SUB_INT32( v1->x, u1->x ) );
+ w.y = CF2_CS_SCALE( SUB_INT32( v1->y, u1->y ) );
denominator = cf2_perp( u, v );
@@ -1168,8 +1186,11 @@
s = FT_DivFix( cf2_perp( w, v ), denominator );
- intersection->x = u1->x + FT_MulFix( s, u2->x - u1->x );
- intersection->y = u1->y + FT_MulFix( s, u2->y - u1->y );
+ intersection->x = ADD_INT32( u1->x,
+ FT_MulFix( s, SUB_INT32( u2->x, u1->x ) ) );
+ intersection->y = ADD_INT32( u1->y,
+ FT_MulFix( s, SUB_INT32( u2->y, u1->y ) ) );
+
/*
* Special case snapping for horizontal and vertical lines.
@@ -1180,25 +1201,29 @@
*
*/
- if ( u1->x == u2->x &&
- cf2_fixedAbs( intersection->x - u1->x ) < glyphpath->snapThreshold )
+ if ( u1->x == u2->x &&
+ cf2_fixedAbs( SUB_INT32( intersection->x,
+ u1->x ) ) < glyphpath->snapThreshold )
intersection->x = u1->x;
- if ( u1->y == u2->y &&
- cf2_fixedAbs( intersection->y - u1->y ) < glyphpath->snapThreshold )
+ if ( u1->y == u2->y &&
+ cf2_fixedAbs( SUB_INT32( intersection->y,
+ u1->y ) ) < glyphpath->snapThreshold )
intersection->y = u1->y;
- if ( v1->x == v2->x &&
- cf2_fixedAbs( intersection->x - v1->x ) < glyphpath->snapThreshold )
+ if ( v1->x == v2->x &&
+ cf2_fixedAbs( SUB_INT32( intersection->x,
+ v1->x ) ) < glyphpath->snapThreshold )
intersection->x = v1->x;
- if ( v1->y == v2->y &&
- cf2_fixedAbs( intersection->y - v1->y ) < glyphpath->snapThreshold )
+ if ( v1->y == v2->y &&
+ cf2_fixedAbs( SUB_INT32( intersection->y,
+ v1->y ) ) < glyphpath->snapThreshold )
intersection->y = v1->y;
/* limit the intersection distance from midpoint of u2 and v1 */
- if ( cf2_fixedAbs( intersection->x - ( u2->x + v1->x ) / 2 ) >
- glyphpath->miterLimit ||
- cf2_fixedAbs( intersection->y - ( u2->y + v1->y ) / 2 ) >
- glyphpath->miterLimit )
+ if ( cf2_fixedAbs( intersection->x - ADD_INT32( u2->x, v1->x ) / 2 ) >
+ glyphpath->miterLimit ||
+ cf2_fixedAbs( intersection->y - ADD_INT32( u2->y, v1->y ) / 2 ) >
+ glyphpath->miterLimit )
return FALSE;
return TRUE;
@@ -1446,16 +1471,16 @@
CF2_Fixed* x,
CF2_Fixed* y )
{
- CF2_Fixed dx = x2 - x1;
- CF2_Fixed dy = y2 - y1;
+ CF2_Fixed dx = SUB_INT32( x2, x1 );
+ CF2_Fixed dy = SUB_INT32( y2, y1 );
/* note: negative offsets don't work here; negate deltas to change */
/* quadrants, below */
if ( glyphpath->font->reverseWinding )
{
- dx = -dx;
- dy = -dy;
+ dx = NEG_INT32( dx );
+ dy = NEG_INT32( dy );
}
*x = *y = 0;
@@ -1464,8 +1489,9 @@
return;
/* add momentum for this path element */
- glyphpath->callbacks->windingMomentum +=
- cf2_getWindingMomentum( x1, y1, x2, y2 );
+ glyphpath->callbacks->windingMomentum =
+ ADD_INT32( glyphpath->callbacks->windingMomentum,
+ cf2_getWindingMomentum( x1, y1, x2, y2 ) );
/* note: allow mixed integer and fixed multiplication here */
if ( dx >= 0 )
@@ -1474,13 +1500,13 @@
{
/* first quadrant, +x +y */
- if ( dx > 2 * dy )
+ if ( dx > MUL_INT32( 2, dy ) )
{
/* +x */
*x = 0;
*y = 0;
}
- else if ( dy > 2 * dx )
+ else if ( dy > MUL_INT32( 2, dx ) )
{
/* +y */
*x = glyphpath->xOffset;
@@ -1489,9 +1515,9 @@
else
{
/* +x +y */
- *x = FT_MulFix( cf2_floatToFixed( 0.7 ),
+ *x = FT_MulFix( cf2_doubleToFixed( 0.7 ),
glyphpath->xOffset );
- *y = FT_MulFix( cf2_floatToFixed( 1.0 - 0.7 ),
+ *y = FT_MulFix( cf2_doubleToFixed( 1.0 - 0.7 ),
glyphpath->yOffset );
}
}
@@ -1499,24 +1525,24 @@
{
/* fourth quadrant, +x -y */
- if ( dx > -2 * dy )
+ if ( dx > MUL_INT32( -2, dy ) )
{
/* +x */
*x = 0;
*y = 0;
}
- else if ( -dy > 2 * dx )
+ else if ( NEG_INT32( dy ) > MUL_INT32( 2, dx ) )
{
/* -y */
- *x = -glyphpath->xOffset;
+ *x = NEG_INT32( glyphpath->xOffset );
*y = glyphpath->yOffset;
}
else
{
/* +x -y */
- *x = FT_MulFix( cf2_floatToFixed( -0.7 ),
+ *x = FT_MulFix( cf2_doubleToFixed( -0.7 ),
glyphpath->xOffset );
- *y = FT_MulFix( cf2_floatToFixed( 1.0 - 0.7 ),
+ *y = FT_MulFix( cf2_doubleToFixed( 1.0 - 0.7 ),
glyphpath->yOffset );
}
}
@@ -1527,13 +1553,13 @@
{
/* second quadrant, -x +y */
- if ( -dx > 2 * dy )
+ if ( NEG_INT32( dx ) > MUL_INT32( 2, dy ) )
{
/* -x */
*x = 0;
- *y = 2 * glyphpath->yOffset;
+ *y = MUL_INT32( 2, glyphpath->yOffset );
}
- else if ( dy > -2 * dx )
+ else if ( dy > MUL_INT32( -2, dx ) )
{
/* +y */
*x = glyphpath->xOffset;
@@ -1542,9 +1568,9 @@
else
{
/* -x +y */
- *x = FT_MulFix( cf2_floatToFixed( 0.7 ),
+ *x = FT_MulFix( cf2_doubleToFixed( 0.7 ),
glyphpath->xOffset );
- *y = FT_MulFix( cf2_floatToFixed( 1.0 + 0.7 ),
+ *y = FT_MulFix( cf2_doubleToFixed( 1.0 + 0.7 ),
glyphpath->yOffset );
}
}
@@ -1552,24 +1578,24 @@
{
/* third quadrant, -x -y */
- if ( -dx > -2 * dy )
+ if ( NEG_INT32( dx ) > MUL_INT32( -2, dy ) )
{
/* -x */
*x = 0;
- *y = 2 * glyphpath->yOffset;
+ *y = MUL_INT32( 2, glyphpath->yOffset );
}
- else if ( -dy > -2 * dx )
+ else if ( NEG_INT32( dy ) > MUL_INT32( -2, dx ) )
{
/* -y */
- *x = -glyphpath->xOffset;
+ *x = NEG_INT32( glyphpath->xOffset );
*y = glyphpath->yOffset;
}
else
{
/* -x -y */
- *x = FT_MulFix( cf2_floatToFixed( -0.7 ),
+ *x = FT_MulFix( cf2_doubleToFixed( -0.7 ),
glyphpath->xOffset );
- *y = FT_MulFix( cf2_floatToFixed( 1.0 + 0.7 ),
+ *y = FT_MulFix( cf2_doubleToFixed( 1.0 + 0.7 ),
glyphpath->yOffset );
}
}
@@ -1675,10 +1701,10 @@
&yOffset );
/* construct offset points */
- P0.x = glyphpath->currentCS.x + xOffset;
- P0.y = glyphpath->currentCS.y + yOffset;
- P1.x = x + xOffset;
- P1.y = y + yOffset;
+ P0.x = ADD_INT32( glyphpath->currentCS.x, xOffset );
+ P0.y = ADD_INT32( glyphpath->currentCS.y, yOffset );
+ P1.x = ADD_INT32( x, xOffset );
+ P1.y = ADD_INT32( y, yOffset );
if ( glyphpath->moveIsPending )
{
@@ -1753,19 +1779,20 @@
&yOffset3 );
/* add momentum from the middle segment */
- glyphpath->callbacks->windingMomentum +=
- cf2_getWindingMomentum( x1, y1, x2, y2 );
+ glyphpath->callbacks->windingMomentum =
+ ADD_INT32( glyphpath->callbacks->windingMomentum,
+ cf2_getWindingMomentum( x1, y1, x2, y2 ) );
/* construct offset points */
- P0.x = glyphpath->currentCS.x + xOffset1;
- P0.y = glyphpath->currentCS.y + yOffset1;
- P1.x = x1 + xOffset1;
- P1.y = y1 + yOffset1;
+ P0.x = ADD_INT32( glyphpath->currentCS.x, xOffset1 );
+ P0.y = ADD_INT32( glyphpath->currentCS.y, yOffset1 );
+ P1.x = ADD_INT32( x1, xOffset1 );
+ P1.y = ADD_INT32( y1, yOffset1 );
/* note: preserve angle of final segment by using offset3 at both ends */
- P2.x = x2 + xOffset3;
- P2.y = y2 + yOffset3;
- P3.x = x3 + xOffset3;
- P3.y = y3 + yOffset3;
+ P2.x = ADD_INT32( x2, xOffset3 );
+ P2.y = ADD_INT32( y2, yOffset3 );
+ P3.x = ADD_INT32( x3, xOffset3 );
+ P3.y = ADD_INT32( y3, yOffset3 );
if ( glyphpath->moveIsPending )
{
diff --git a/thirdparty/freetype/src/cff/cf2intrp.c b/thirdparty/freetype/src/cff/cf2intrp.c
index 40bd9059a1..a816280748 100644
--- a/thirdparty/freetype/src/cff/cf2intrp.c
+++ b/thirdparty/freetype/src/cff/cf2intrp.c
@@ -304,10 +304,12 @@
CF2_StemHintRec stemhint;
- stemhint.min =
- position += cf2_stack_getReal( opStack, i );
- stemhint.max =
- position += cf2_stack_getReal( opStack, i + 1 );
+ stemhint.min =
+ position = ADD_INT32( position,
+ cf2_stack_getReal( opStack, i ) );
+ stemhint.max =
+ position = ADD_INT32( position,
+ cf2_stack_getReal( opStack, i + 1 ) );
stemhint.used = FALSE;
stemhint.maxDS =
@@ -348,7 +350,8 @@
{
vals[i + 2] = vals[i];
if ( readFromStack[i] )
- vals[i + 2] += cf2_stack_getReal( opStack, idx++ );
+ vals[i + 2] = ADD_INT32( vals[i + 2], cf2_stack_getReal( opStack,
+ idx++ ) );
}
if ( isHFlex )
@@ -356,31 +359,34 @@
if ( doConditionalLastRead )
{
- FT_Bool lastIsX = (FT_Bool)( cf2_fixedAbs( vals[10] - *curX ) >
- cf2_fixedAbs( vals[11] - *curY ) );
+ FT_Bool lastIsX = (FT_Bool)(
+ cf2_fixedAbs( SUB_INT32( vals[10], *curX ) ) >
+ cf2_fixedAbs( SUB_INT32( vals[11], *curY ) ) );
CF2_Fixed lastVal = cf2_stack_getReal( opStack, idx );
if ( lastIsX )
{
- vals[12] = vals[10] + lastVal;
+ vals[12] = ADD_INT32( vals[10], lastVal );
vals[13] = *curY;
}
else
{
vals[12] = *curX;
- vals[13] = vals[11] + lastVal;
+ vals[13] = ADD_INT32( vals[11], lastVal );
}
}
else
{
if ( readFromStack[10] )
- vals[12] = vals[10] + cf2_stack_getReal( opStack, idx++ );
+ vals[12] = ADD_INT32( vals[10],
+ cf2_stack_getReal( opStack, idx++ ) );
else
vals[12] = *curX;
if ( readFromStack[11] )
- vals[13] = vals[11] + cf2_stack_getReal( opStack, idx );
+ vals[13] = ADD_INT32( vals[11],
+ cf2_stack_getReal( opStack, idx ) );
else
vals[13] = *curY;
}
@@ -426,7 +432,10 @@
for ( j = 1; j < blend->lenBV; j++ )
- sum += FT_MulFix( *weight++, cf2_stack_getReal( opStack, delta++ ) );
+ sum = ADD_INT32( sum,
+ FT_MulFix( *weight++,
+ cf2_stack_getReal( opStack,
+ delta++ ) ) );
/* store blended result */
cf2_stack_setReal( opStack, i + base, sum );
@@ -759,7 +768,8 @@
FT_TRACE4(( " vmoveto\n" ));
if ( cf2_stack_count( opStack ) > 1 && !haveWidth )
- *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX;
+ *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ),
+ nominalWidthX );
/* width is defined or default after this */
haveWidth = TRUE;
@@ -767,7 +777,7 @@
if ( font->decoder->width_only )
goto exit;
- curY += cf2_stack_popFixed( opStack );
+ curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) );
cf2_glyphpath_moveTo( &glyphPath, curX, curY );
@@ -783,8 +793,10 @@
for ( idx = 0; idx < count; idx += 2 )
{
- curX += cf2_stack_getReal( opStack, idx + 0 );
- curY += cf2_stack_getReal( opStack, idx + 1 );
+ curX = ADD_INT32( curX, cf2_stack_getReal( opStack,
+ idx + 0 ) );
+ curY = ADD_INT32( curY, cf2_stack_getReal( opStack,
+ idx + 1 ) );
cf2_glyphpath_lineTo( &glyphPath, curX, curY );
}
@@ -810,9 +822,9 @@
if ( isX )
- curX += v;
+ curX = ADD_INT32( curX, v );
else
- curY += v;
+ curY = ADD_INT32( curY, v );
isX = !isX;
@@ -835,13 +847,15 @@
while ( idx + 6 <= count )
{
- CF2_Fixed x1 = cf2_stack_getReal( opStack, idx + 0 ) + curX;
- CF2_Fixed y1 = cf2_stack_getReal( opStack, idx + 1 ) + curY;
- CF2_Fixed x2 = cf2_stack_getReal( opStack, idx + 2 ) + x1;
- CF2_Fixed y2 = cf2_stack_getReal( opStack, idx + 3 ) + y1;
- CF2_Fixed x3 = cf2_stack_getReal( opStack, idx + 4 ) + x2;
- CF2_Fixed y3 = cf2_stack_getReal( opStack, idx + 5 ) + y2;
+ CF2_Fixed x1, y1, x2, y2, x3, y3;
+
+ x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX );
+ y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), curY );
+ x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), x1 );
+ y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y1 );
+ x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), x2 );
+ y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 5 ), y2 );
cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
@@ -852,8 +866,10 @@
if ( op1 == cf2_cmdRCURVELINE )
{
- curX += cf2_stack_getReal( opStack, idx + 0 );
- curY += cf2_stack_getReal( opStack, idx + 1 );
+ curX = ADD_INT32( curX, cf2_stack_getReal( opStack,
+ idx + 0 ) );
+ curY = ADD_INT32( curY, cf2_stack_getReal( opStack,
+ idx + 1 ) );
cf2_glyphpath_lineTo( &glyphPath, curX, curY );
}
@@ -1129,7 +1145,10 @@
arg = cf2_stack_popFixed( opStack );
- cf2_stack_pushFixed( opStack, FT_ABS( arg ) );
+ if ( arg < -CF2_FIXED_MAX )
+ cf2_stack_pushFixed( opStack, CF2_FIXED_MAX );
+ else
+ cf2_stack_pushFixed( opStack, FT_ABS( arg ) );
}
continue; /* do not clear the stack */
@@ -1144,7 +1163,9 @@
summand2 = cf2_stack_popFixed( opStack );
summand1 = cf2_stack_popFixed( opStack );
- cf2_stack_pushFixed( opStack, summand1 + summand2 );
+ cf2_stack_pushFixed( opStack,
+ ADD_INT32( summand1,
+ summand2 ) );
}
continue; /* do not clear the stack */
@@ -1159,7 +1180,8 @@
subtrahend = cf2_stack_popFixed( opStack );
minuend = cf2_stack_popFixed( opStack );
- cf2_stack_pushFixed( opStack, minuend - subtrahend );
+ cf2_stack_pushFixed( opStack,
+ SUB_INT32( minuend, subtrahend ) );
}
continue; /* do not clear the stack */
@@ -1174,7 +1196,8 @@
divisor = cf2_stack_popFixed( opStack );
dividend = cf2_stack_popFixed( opStack );
- cf2_stack_pushFixed( opStack, FT_DivFix( dividend, divisor ) );
+ cf2_stack_pushFixed( opStack,
+ FT_DivFix( dividend, divisor ) );
}
continue; /* do not clear the stack */
@@ -1187,7 +1210,10 @@
arg = cf2_stack_popFixed( opStack );
- cf2_stack_pushFixed( opStack, -arg );
+ if ( arg < -CF2_FIXED_MAX )
+ cf2_stack_pushFixed( opStack, CF2_FIXED_MAX );
+ else
+ cf2_stack_pushFixed( opStack, -arg );
}
continue; /* do not clear the stack */
@@ -1257,7 +1283,8 @@
arg2 = cf2_stack_popFixed( opStack );
arg1 = cf2_stack_popFixed( opStack );
- cf2_stack_pushFixed( opStack, cond1 <= cond2 ? arg1 : arg2 );
+ cf2_stack_pushFixed( opStack,
+ cond1 <= cond2 ? arg1 : arg2 );
}
continue; /* do not clear the stack */
@@ -1291,7 +1318,8 @@
factor2 = cf2_stack_popFixed( opStack );
factor1 = cf2_stack_popFixed( opStack );
- cf2_stack_pushFixed( opStack, FT_MulFix( factor1, factor2 ) );
+ cf2_stack_pushFixed( opStack,
+ FT_MulFix( factor1, factor2 ) );
}
continue; /* do not clear the stack */
@@ -1305,7 +1333,9 @@
arg = cf2_stack_popFixed( opStack );
if ( arg > 0 )
{
- FT_Fixed root = arg;
+ /* use a start value that doesn't make */
+ /* the algorithm's addition overflow */
+ FT_Fixed root = arg < 10 ? arg : arg >> 1;
FT_Fixed new_root;
@@ -1369,7 +1399,8 @@
if ( size > 0 )
{
- /* for `cf2_stack_getReal', index 0 is bottom of stack */
+ /* for `cf2_stack_getReal', */
+ /* index 0 is bottom of stack */
CF2_UInt gr_idx;
@@ -1381,7 +1412,8 @@
gr_idx = size - 1 - (CF2_UInt)idx;
cf2_stack_pushFixed( opStack,
- cf2_stack_getReal( opStack, gr_idx ) );
+ cf2_stack_getReal( opStack,
+ gr_idx ) );
}
}
continue; /* do not clear the stack */
@@ -1416,7 +1448,8 @@
cf2_stack_count( opStack ) == 5 )
{
if ( !haveWidth )
- *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX;
+ *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ),
+ nominalWidthX );
}
/* width is defined or default after this */
@@ -1564,7 +1597,8 @@
FT_TRACE4(( " rmoveto\n" ));
if ( cf2_stack_count( opStack ) > 2 && !haveWidth )
- *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX;
+ *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ),
+ nominalWidthX );
/* width is defined or default after this */
haveWidth = TRUE;
@@ -1572,8 +1606,8 @@
if ( font->decoder->width_only )
goto exit;
- curY += cf2_stack_popFixed( opStack );
- curX += cf2_stack_popFixed( opStack );
+ curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) );
+ curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) );
cf2_glyphpath_moveTo( &glyphPath, curX, curY );
@@ -1583,7 +1617,8 @@
FT_TRACE4(( " hmoveto\n" ));
if ( cf2_stack_count( opStack ) > 1 && !haveWidth )
- *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX;
+ *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ),
+ nominalWidthX );
/* width is defined or default after this */
haveWidth = TRUE;
@@ -1591,7 +1626,7 @@
if ( font->decoder->width_only )
goto exit;
- curX += cf2_stack_popFixed( opStack );
+ curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) );
cf2_glyphpath_moveTo( &glyphPath, curX, curY );
@@ -1607,8 +1642,10 @@
while ( idx + 6 < count )
{
- curX += cf2_stack_getReal( opStack, idx + 0 );
- curY += cf2_stack_getReal( opStack, idx + 1 );
+ curX = ADD_INT32( curX, cf2_stack_getReal( opStack,
+ idx + 0 ) );
+ curY = ADD_INT32( curY, cf2_stack_getReal( opStack,
+ idx + 1 ) );
cf2_glyphpath_lineTo( &glyphPath, curX, curY );
idx += 2;
@@ -1616,13 +1653,15 @@
while ( idx < count )
{
- CF2_Fixed x1 = cf2_stack_getReal( opStack, idx + 0 ) + curX;
- CF2_Fixed y1 = cf2_stack_getReal( opStack, idx + 1 ) + curY;
- CF2_Fixed x2 = cf2_stack_getReal( opStack, idx + 2 ) + x1;
- CF2_Fixed y2 = cf2_stack_getReal( opStack, idx + 3 ) + y1;
- CF2_Fixed x3 = cf2_stack_getReal( opStack, idx + 4 ) + x2;
- CF2_Fixed y3 = cf2_stack_getReal( opStack, idx + 5 ) + y2;
+ CF2_Fixed x1, y1, x2, y2, x3, y3;
+
+ x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX );
+ y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), curY );
+ x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), x1 );
+ y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y1 );
+ x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), x2 );
+ y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 5 ), y2 );
cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
@@ -1656,18 +1695,18 @@
if ( ( count - idx ) & 1 )
{
- x1 = cf2_stack_getReal( opStack, idx ) + curX;
+ x1 = ADD_INT32( cf2_stack_getReal( opStack, idx ), curX );
idx++;
}
else
x1 = curX;
- y1 = cf2_stack_getReal( opStack, idx + 0 ) + curY;
- x2 = cf2_stack_getReal( opStack, idx + 1 ) + x1;
- y2 = cf2_stack_getReal( opStack, idx + 2 ) + y1;
+ y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curY );
+ x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 );
+ y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 );
x3 = x2;
- y3 = cf2_stack_getReal( opStack, idx + 3 ) + y2;
+ y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y2 );
cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
@@ -1701,17 +1740,17 @@
if ( ( count - idx ) & 1 )
{
- y1 = cf2_stack_getReal( opStack, idx ) + curY;
+ y1 = ADD_INT32( cf2_stack_getReal( opStack, idx ), curY );
idx++;
}
else
y1 = curY;
- x1 = cf2_stack_getReal( opStack, idx + 0 ) + curX;
- x2 = cf2_stack_getReal( opStack, idx + 1 ) + x1;
- y2 = cf2_stack_getReal( opStack, idx + 2 ) + y1;
- x3 = cf2_stack_getReal( opStack, idx + 3 ) + x2;
+ x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX );
+ x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 );
+ y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 );
+ x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), x2 );
y3 = y2;
cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
@@ -1750,15 +1789,15 @@
if ( alternate )
{
- x1 = cf2_stack_getReal( opStack, idx + 0 ) + curX;
+ x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX );
y1 = curY;
- x2 = cf2_stack_getReal( opStack, idx + 1 ) + x1;
- y2 = cf2_stack_getReal( opStack, idx + 2 ) + y1;
- y3 = cf2_stack_getReal( opStack, idx + 3 ) + y2;
+ x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 );
+ y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 );
+ y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y2 );
if ( count - idx == 5 )
{
- x3 = cf2_stack_getReal( opStack, idx + 4 ) + x2;
+ x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), x2 );
idx++;
}
@@ -1770,14 +1809,14 @@
else
{
x1 = curX;
- y1 = cf2_stack_getReal( opStack, idx + 0 ) + curY;
- x2 = cf2_stack_getReal( opStack, idx + 1 ) + x1;
- y2 = cf2_stack_getReal( opStack, idx + 2 ) + y1;
- x3 = cf2_stack_getReal( opStack, idx + 3 ) + x2;
+ y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curY );
+ x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 );
+ y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 );
+ x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), x2 );
if ( count - idx == 5 )
{
- y3 = cf2_stack_getReal( opStack, idx + 4 ) + y2;
+ y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), y2 );
idx++;
}
diff --git a/thirdparty/freetype/src/cff/cffgload.c b/thirdparty/freetype/src/cff/cffgload.c
index 940804850e..20f3a2c28e 100644
--- a/thirdparty/freetype/src/cff/cffgload.c
+++ b/thirdparty/freetype/src/cff/cffgload.c
@@ -20,6 +20,7 @@
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_SFNT_H
+#include FT_INTERNAL_CALC_H
#include FT_OUTLINE_H
#include FT_CFF_DRIVER_H
@@ -1450,8 +1451,8 @@
cff_builder_close_contour( builder );
builder->path_begun = 0;
- x += args[-2];
- y += args[-1];
+ x = ADD_LONG( x, args[-2] );
+ y = ADD_LONG( y, args[-1] );
args = stack;
break;
@@ -1460,7 +1461,7 @@
cff_builder_close_contour( builder );
builder->path_begun = 0;
- y += args[-1];
+ y = ADD_LONG( y, args[-1] );
args = stack;
break;
@@ -1469,7 +1470,7 @@
cff_builder_close_contour( builder );
builder->path_begun = 0;
- x += args[-1];
+ x = ADD_LONG( x, args[-1] );
args = stack;
break;
@@ -1486,8 +1487,8 @@
args -= num_args & ~1;
while ( args < decoder->top )
{
- x += args[0];
- y += args[1];
+ x = ADD_LONG( x, args[0] );
+ y = ADD_LONG( y, args[1] );
cff_builder_add_point( builder, x, y, 1 );
args += 2;
}
@@ -1519,9 +1520,9 @@
while ( args < decoder->top )
{
if ( phase )
- x += args[0];
+ x = ADD_LONG( x, args[0] );
else
- y += args[0];
+ y = ADD_LONG( y, args[0] );
if ( cff_builder_add_point1( builder, x, y ) )
goto Fail;
@@ -1552,15 +1553,18 @@
args -= nargs;
while ( args < decoder->top )
{
- x += args[0];
- y += args[1];
+ x = ADD_LONG( x, args[0] );
+ y = ADD_LONG( y, args[1] );
cff_builder_add_point( builder, x, y, 0 );
- x += args[2];
- y += args[3];
+
+ x = ADD_LONG( x, args[2] );
+ y = ADD_LONG( y, args[3] );
cff_builder_add_point( builder, x, y, 0 );
- x += args[4];
- y += args[5];
+
+ x = ADD_LONG( x, args[4] );
+ y = ADD_LONG( y, args[5] );
cff_builder_add_point( builder, x, y, 1 );
+
args += 6;
}
args = stack;
@@ -1589,7 +1593,7 @@
if ( nargs & 1 )
{
- x += args[0];
+ x = ADD_LONG( x, args[0] );
args++;
nargs--;
}
@@ -1599,13 +1603,16 @@
while ( args < decoder->top )
{
- y += args[0];
+ y = ADD_LONG( y, args[0] );
cff_builder_add_point( builder, x, y, 0 );
- x += args[1];
- y += args[2];
+
+ x = ADD_LONG( x, args[1] );
+ y = ADD_LONG( y, args[2] );
cff_builder_add_point( builder, x, y, 0 );
- y += args[3];
+
+ y = ADD_LONG( y, args[3] );
cff_builder_add_point( builder, x, y, 1 );
+
args += 4;
}
args = stack;
@@ -1633,7 +1640,7 @@
args -= nargs;
if ( nargs & 1 )
{
- y += args[0];
+ y = ADD_LONG( y, args[0] );
args++;
nargs--;
}
@@ -1643,13 +1650,16 @@
while ( args < decoder->top )
{
- x += args[0];
+ x = ADD_LONG( x, args[0] );
cff_builder_add_point( builder, x, y, 0 );
- x += args[1];
- y += args[2];
+
+ x = ADD_LONG( x, args[1] );
+ y = ADD_LONG( y, args[2] );
cff_builder_add_point( builder, x, y, 0 );
- x += args[3];
+
+ x = ADD_LONG( x, args[3] );
cff_builder_add_point( builder, x, y, 1 );
+
args += 4;
}
args = stack;
@@ -1688,26 +1698,30 @@
nargs -= 4;
if ( phase )
{
- x += args[0];
+ x = ADD_LONG( x, args[0] );
cff_builder_add_point( builder, x, y, 0 );
- x += args[1];
- y += args[2];
+
+ x = ADD_LONG( x, args[1] );
+ y = ADD_LONG( y, args[2] );
cff_builder_add_point( builder, x, y, 0 );
- y += args[3];
+
+ y = ADD_LONG( y, args[3] );
if ( nargs == 1 )
- x += args[4];
+ x = ADD_LONG( x, args[4] );
cff_builder_add_point( builder, x, y, 1 );
}
else
{
- y += args[0];
+ y = ADD_LONG( y, args[0] );
cff_builder_add_point( builder, x, y, 0 );
- x += args[1];
- y += args[2];
+
+ x = ADD_LONG( x, args[1] );
+ y = ADD_LONG( y, args[2] );
cff_builder_add_point( builder, x, y, 0 );
- x += args[3];
+
+ x = ADD_LONG( x, args[3] );
if ( nargs == 1 )
- y += args[4];
+ y = ADD_LONG( y, args[4] );
cff_builder_add_point( builder, x, y, 1 );
}
args += 4;
@@ -1740,23 +1754,27 @@
/* first, add the line segments */
while ( num_lines > 0 )
{
- x += args[0];
- y += args[1];
+ x = ADD_LONG( x, args[0] );
+ y = ADD_LONG( y, args[1] );
cff_builder_add_point( builder, x, y, 1 );
+
args += 2;
num_lines--;
}
/* then the curve */
- x += args[0];
- y += args[1];
+ x = ADD_LONG( x, args[0] );
+ y = ADD_LONG( y, args[1] );
cff_builder_add_point( builder, x, y, 0 );
- x += args[2];
- y += args[3];
+
+ x = ADD_LONG( x, args[2] );
+ y = ADD_LONG( y, args[3] );
cff_builder_add_point( builder, x, y, 0 );
- x += args[4];
- y += args[5];
+
+ x = ADD_LONG( x, args[4] );
+ y = ADD_LONG( y, args[5] );
cff_builder_add_point( builder, x, y, 1 );
+
args = stack;
}
break;
@@ -1785,23 +1803,27 @@
/* first, add the curves */
while ( num_curves > 0 )
{
- x += args[0];
- y += args[1];
+ x = ADD_LONG( x, args[0] );
+ y = ADD_LONG( y, args[1] );
cff_builder_add_point( builder, x, y, 0 );
- x += args[2];
- y += args[3];
+
+ x = ADD_LONG( x, args[2] );
+ y = ADD_LONG( y, args[3] );
cff_builder_add_point( builder, x, y, 0 );
- x += args[4];
- y += args[5];
+
+ x = ADD_LONG( x, args[4] );
+ y = ADD_LONG( y, args[5] );
cff_builder_add_point( builder, x, y, 1 );
+
args += 6;
num_curves--;
}
/* then the final line */
- x += args[0];
- y += args[1];
+ x = ADD_LONG( x, args[0] );
+ y = ADD_LONG( y, args[1] );
cff_builder_add_point( builder, x, y, 1 );
+
args = stack;
}
break;
@@ -1824,33 +1846,33 @@
start_y = y;
/* first control point */
- x += args[0];
- y += args[1];
+ x = ADD_LONG( x, args[0] );
+ y = ADD_LONG( y, args[1] );
cff_builder_add_point( builder, x, y, 0 );
/* second control point */
- x += args[2];
- y += args[3];
+ x = ADD_LONG( x, args[2] );
+ y = ADD_LONG( y, args[3] );
cff_builder_add_point( builder, x, y, 0 );
/* join point; on curve, with y-value the same as the last */
/* control point's y-value */
- x += args[4];
+ x = ADD_LONG( x, args[4] );
cff_builder_add_point( builder, x, y, 1 );
/* third control point, with y-value the same as the join */
/* point's y-value */
- x += args[5];
+ x = ADD_LONG( x, args[5] );
cff_builder_add_point( builder, x, y, 0 );
/* fourth control point */
- x += args[6];
- y += args[7];
+ x = ADD_LONG( x, args[6] );
+ y = ADD_LONG( y, args[7] );
cff_builder_add_point( builder, x, y, 0 );
/* ending point, with y-value the same as the start */
- x += args[8];
- y = start_y;
+ x = ADD_LONG( x, args[8] );
+ y = start_y;
cff_builder_add_point( builder, x, y, 1 );
args = stack;
@@ -1873,32 +1895,32 @@
start_y = y;
/* first control point */
- x += args[0];
+ x = ADD_LONG( x, args[0] );
cff_builder_add_point( builder, x, y, 0 );
/* second control point */
- x += args[1];
- y += args[2];
+ x = ADD_LONG( x, args[1] );
+ y = ADD_LONG( y, args[2] );
cff_builder_add_point( builder, x, y, 0 );
/* join point; on curve, with y-value the same as the last */
/* control point's y-value */
- x += args[3];
+ x = ADD_LONG( x, args[3] );
cff_builder_add_point( builder, x, y, 1 );
/* third control point, with y-value the same as the join */
/* point's y-value */
- x += args[4];
+ x = ADD_LONG( x, args[4] );
cff_builder_add_point( builder, x, y, 0 );
/* fourth control point */
- x += args[5];
- y = start_y;
+ x = ADD_LONG( x, args[5] );
+ y = start_y;
cff_builder_add_point( builder, x, y, 0 );
/* ending point, with y-value the same as the start point's */
/* y-value -- we don't add this point, though */
- x += args[6];
+ x = ADD_LONG( x, args[6] );
cff_builder_add_point( builder, x, y, 1 );
args = stack;
@@ -1934,8 +1956,8 @@
/* grab up to the last argument */
for ( count = 5; count > 0; count-- )
{
- dx += temp[0];
- dy += temp[1];
+ dx = ADD_LONG( dx, temp[0] );
+ dy = ADD_LONG( dy, temp[1] );
temp += 2;
}
@@ -1949,8 +1971,8 @@
for ( count = 5; count > 0; count-- )
{
- x += args[0];
- y += args[1];
+ x = ADD_LONG( x, args[0] );
+ y = ADD_LONG( y, args[1] );
cff_builder_add_point( builder, x, y,
(FT_Bool)( count == 3 ) );
args += 2;
@@ -1959,13 +1981,13 @@
/* is last operand an x- or y-delta? */
if ( horizontal )
{
- x += args[0];
- y = start_y;
+ x = ADD_LONG( x, args[0] );
+ y = start_y;
}
else
{
- x = start_x;
- y += args[0];
+ x = start_x;
+ y = ADD_LONG( y, args[0] );
}
cff_builder_add_point( builder, x, y, 1 );
@@ -1987,8 +2009,8 @@
for ( count = 6; count > 0; count-- )
{
- x += args[0];
- y += args[1];
+ x = ADD_LONG( x, args[0] );
+ y = ADD_LONG( y, args[1] );
cff_builder_add_point( builder, x, y,
(FT_Bool)( count == 4 || count == 1 ) );
args += 2;
@@ -2066,21 +2088,26 @@
FT_TRACE4(( " abs\n" ));
if ( args[0] < 0 )
- args[0] = -args[0];
+ {
+ if ( args[0] == FT_LONG_MIN )
+ args[0] = FT_LONG_MAX;
+ else
+ args[0] = -args[0];
+ }
args++;
break;
case cff_op_add:
FT_TRACE4(( " add\n" ));
- args[0] += args[1];
+ args[0] = ADD_LONG( args[0], args[1] );
args++;
break;
case cff_op_sub:
FT_TRACE4(( " sub\n" ));
- args[0] -= args[1];
+ args[0] = SUB_LONG( args[0], args[1] );
args++;
break;
@@ -2094,6 +2121,8 @@
case cff_op_neg:
FT_TRACE4(( " neg\n" ));
+ if ( args[0] == FT_LONG_MIN )
+ args[0] = FT_LONG_MAX;
args[0] = -args[0];
args++;
break;
@@ -2350,12 +2379,13 @@
FT_TRACE4(( " hsbw (invalid op)\n" ));
- decoder->glyph_width = decoder->nominal_width + ( args[1] >> 16 );
+ decoder->glyph_width =
+ ADD_LONG( decoder->nominal_width, ( args[1] >> 16 ) );
decoder->builder.left_bearing.x = args[0];
decoder->builder.left_bearing.y = 0;
- x = decoder->builder.pos_x + args[0];
+ x = ADD_LONG( decoder->builder.pos_x, args[0] );
y = decoder->builder.pos_y;
args = stack;
break;
@@ -2367,13 +2397,14 @@
FT_TRACE4(( " sbw (invalid op)\n" ));
- decoder->glyph_width = decoder->nominal_width + ( args[2] >> 16 );
+ decoder->glyph_width =
+ ADD_LONG( decoder->nominal_width, ( args[2] >> 16 ) );
decoder->builder.left_bearing.x = args[0];
decoder->builder.left_bearing.y = args[1];
- x = decoder->builder.pos_x + args[0];
- y = decoder->builder.pos_y + args[1];
+ x = ADD_LONG( decoder->builder.pos_x, args[0] );
+ y = ADD_LONG( decoder->builder.pos_y, args[1] );
args = stack;
break;
@@ -2384,8 +2415,8 @@
FT_TRACE4(( " setcurrentpoint (invalid op)\n" ));
- x = decoder->builder.pos_x + args[0];
- y = decoder->builder.pos_y + args[1];
+ x = ADD_LONG( decoder->builder.pos_x, args[0] );
+ y = ADD_LONG( decoder->builder.pos_y, args[1] );
args = stack;
break;
diff --git a/thirdparty/freetype/src/cff/cffload.c b/thirdparty/freetype/src/cff/cffload.c
index 3beaeb1c8e..12420384af 100644
--- a/thirdparty/freetype/src/cff/cffload.c
+++ b/thirdparty/freetype/src/cff/cffload.c
@@ -1352,9 +1352,12 @@
sum = cff_parse_num( parser, &parser->stack[i + base] ) * 65536;
for ( j = 1; j < blend->lenBV; j++ )
- sum += FT_MulFix( *weight++,
- cff_parse_num( parser,
- &parser->stack[delta++] ) * 65536 );
+ sum = ADD_INT32(
+ sum,
+ FT_MulFix(
+ *weight++,
+ cff_parse_num( parser,
+ &parser->stack[delta++] ) * 65536 ) );
/* point parser stack to new value on blend_stack */
parser->stack[i + base] = subFont->blend_top;
diff --git a/thirdparty/freetype/src/cff/cffparse.c b/thirdparty/freetype/src/cff/cffparse.c
index e1511bdbd1..9d7bf6d22c 100644
--- a/thirdparty/freetype/src/cff/cffparse.c
+++ b/thirdparty/freetype/src/cff/cffparse.c
@@ -20,6 +20,7 @@
#include "cffparse.h"
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_DEBUG_H
+#include FT_INTERNAL_CALC_H
#include "cfferrs.h"
#include "cffpic.h"
@@ -156,6 +157,22 @@
1000000000L
};
+ /* maximum values allowed for multiplying */
+ /* with the corresponding `power_tens' element */
+ static const FT_Long power_ten_limits[] =
+ {
+ FT_LONG_MAX / 1L,
+ FT_LONG_MAX / 10L,
+ FT_LONG_MAX / 100L,
+ FT_LONG_MAX / 1000L,
+ FT_LONG_MAX / 10000L,
+ FT_LONG_MAX / 100000L,
+ FT_LONG_MAX / 1000000L,
+ FT_LONG_MAX / 10000000L,
+ FT_LONG_MAX / 100000000L,
+ FT_LONG_MAX / 1000000000L,
+ };
+
/* read a real */
static FT_Fixed
@@ -484,7 +501,15 @@
if ( scaling )
+ {
+ if ( FT_ABS( val ) > power_ten_limits[scaling] )
+ {
+ val = val > 0 ? 0x7FFFFFFFL : -0x7FFFFFFFL;
+ goto Overflow;
+ }
+
val *= power_tens[scaling];
+ }
if ( val > 0x7FFF )
{
@@ -1585,7 +1610,7 @@
val = 0;
while ( num_args > 0 )
{
- val += cff_parse_num( parser, data++ );
+ val = ADD_LONG( val, cff_parse_num( parser, data++ ) );
switch ( field->size )
{
case (8 / FT_CHAR_BIT):
diff --git a/thirdparty/freetype/src/gxvalid/README b/thirdparty/freetype/src/gxvalid/README
index 7201459aaf..200f66cb12 100644
--- a/thirdparty/freetype/src/gxvalid/README
+++ b/thirdparty/freetype/src/gxvalid/README
@@ -9,7 +9,7 @@ gxvalid: TrueType GX validator
additional tables in TrueType font which are used by `QuickDraw GX
Text', Apple Advanced Typography (AAT). In addition, gxvalid can
validates `kern' tables which have been extended for AAT. Like the
- otvalid module, gxvalid uses Freetype 2's validator framework
+ otvalid module, gxvalid uses FreeType 2's validator framework
(ftvalid).
You can link gxvalid with your program; before running your own layout
diff --git a/thirdparty/freetype/src/pcf/README b/thirdparty/freetype/src/pcf/README
index 10eff15fbe..09ea970eda 100644
--- a/thirdparty/freetype/src/pcf/README
+++ b/thirdparty/freetype/src/pcf/README
@@ -41,8 +41,8 @@ value given as argument into the corresponding glyph number.
Known problems
**************
-- dealing explicitly with encodings breaks the uniformity of freetype2
- api.
+- dealing explicitly with encodings breaks the uniformity of FreeType 2
+ API.
- except for encodings properties, client applications have no
visibility of the PCF_Face object. This means that applications
diff --git a/thirdparty/freetype/src/pcf/pcfdrivr.c b/thirdparty/freetype/src/pcf/pcfdrivr.c
index 9f4d36d111..169f75e950 100644
--- a/thirdparty/freetype/src/pcf/pcfdrivr.c
+++ b/thirdparty/freetype/src/pcf/pcfdrivr.c
@@ -387,7 +387,11 @@ THE SOFTWARE.
if ( !ft_strcmp( s, "10646" ) ||
( !ft_strcmp( s, "8859" ) &&
!ft_strcmp( face->charset_encoding, "1" ) ) )
- unicode_charmap = 1;
+ unicode_charmap = 1;
+ /* another name for ASCII */
+ else if ( !ft_strcmp( s, "646.1991" ) &&
+ !ft_strcmp( face->charset_encoding, "IRV" ) )
+ unicode_charmap = 1;
}
}
@@ -409,12 +413,6 @@ THE SOFTWARE.
}
error = FT_CMap_New( &pcf_cmap_class, NULL, &charmap, NULL );
-
-#if 0
- /* Select default charmap */
- if ( pcfface->num_charmaps )
- pcfface->charmap = pcfface->charmaps[0];
-#endif
}
}
diff --git a/thirdparty/freetype/src/pcf/pcfread.c b/thirdparty/freetype/src/pcf/pcfread.c
index 3eacf2baf6..da216b05f4 100644
--- a/thirdparty/freetype/src/pcf/pcfread.c
+++ b/thirdparty/freetype/src/pcf/pcfread.c
@@ -1162,6 +1162,20 @@ THE SOFTWARE.
accel->fontDescent,
accel->maxOverlap ));
+ /* sanity checks */
+ if ( FT_ABS( accel->fontAscent ) > 0x7FFF )
+ {
+ accel->fontAscent = accel->fontAscent < 0 ? -0x7FFF : 0x7FFF;
+ FT_TRACE0(( "pfc_get_accel: clamping font ascent to value %d\n",
+ accel->fontAscent ));
+ }
+ if ( FT_ABS( accel->fontDescent ) > 0x7FFF )
+ {
+ accel->fontDescent = accel->fontDescent < 0 ? -0x7FFF : 0x7FFF;
+ FT_TRACE0(( "pfc_get_accel: clamping font descent to value %d\n",
+ accel->fontDescent ));
+ }
+
FT_TRACE5(( " minbounds:" ));
error = pcf_get_metric( stream,
format & ( ~PCF_FORMAT_MASK ),
@@ -1496,8 +1510,16 @@ THE SOFTWARE.
if ( face->accel.fontAscent + face->accel.fontDescent < 0 )
FT_TRACE0(( "pcf_load_font: negative height\n" ));
#endif
- bsize->height = FT_ABS( (FT_Short)( face->accel.fontAscent +
- face->accel.fontDescent ) );
+ if ( FT_ABS( face->accel.fontAscent +
+ face->accel.fontDescent ) > 0x7FFF )
+ {
+ bsize->height = 0x7FFF;
+ FT_TRACE0(( "pcf_load_font: clamping height to value %d\n",
+ bsize->height ));
+ }
+ else
+ bsize->height = FT_ABS( (FT_Short)( face->accel.fontAscent +
+ face->accel.fontDescent ) );
prop = pcf_find_property( face, "AVERAGE_WIDTH" );
if ( prop )
@@ -1506,10 +1528,20 @@ THE SOFTWARE.
if ( prop->value.l < 0 )
FT_TRACE0(( "pcf_load_font: negative average width\n" ));
#endif
- bsize->width = FT_ABS( (FT_Short)( ( prop->value.l ) + 5 ) / 10 );
+ if ( ( FT_ABS( prop->value.l ) > 0x7FFFL * 10 - 5 ) )
+ {
+ bsize->width = 0x7FFF;
+ FT_TRACE0(( "pcf_load_font: clamping average width to value %d\n",
+ bsize->width ));
+ }
+ else
+ bsize->width = FT_ABS( (FT_Short)( ( prop->value.l + 5 ) / 10 ) );
}
else
+ {
+ /* this is a heuristical value */
bsize->width = (FT_Short)FT_MulDiv( bsize->height, 2, 3 );
+ }
prop = pcf_find_property( face, "POINT_SIZE" );
if ( prop )
@@ -1519,9 +1551,16 @@ THE SOFTWARE.
FT_TRACE0(( "pcf_load_font: negative point size\n" ));
#endif
/* convert from 722.7 decipoints to 72 points per inch */
- bsize->size = FT_MulDiv( FT_ABS( prop->value.l ),
- 64 * 7200,
- 72270L );
+ if ( FT_ABS( prop->value.l ) > 0x504C2L ) /* 0x7FFF * 72270/7200 */
+ {
+ bsize->size = 0x7FFF;
+ FT_TRACE0(( "pcf_load_font: clamping point size to value %d\n",
+ bsize->size ));
+ }
+ else
+ bsize->size = FT_MulDiv( FT_ABS( prop->value.l ),
+ 64 * 7200,
+ 72270L );
}
prop = pcf_find_property( face, "PIXEL_SIZE" );
@@ -1531,7 +1570,14 @@ THE SOFTWARE.
if ( prop->value.l < 0 )
FT_TRACE0(( "pcf_load_font: negative pixel size\n" ));
#endif
- bsize->y_ppem = FT_ABS( (FT_Short)prop->value.l ) << 6;
+ if ( FT_ABS( prop->value.l ) > 0x7FFF )
+ {
+ bsize->y_ppem = 0x7FFF << 6;
+ FT_TRACE0(( "pcf_load_font: clamping pixel size to value %d\n",
+ bsize->y_ppem ));
+ }
+ else
+ bsize->y_ppem = FT_ABS( (FT_Short)prop->value.l ) << 6;
}
prop = pcf_find_property( face, "RESOLUTION_X" );
@@ -1541,7 +1587,14 @@ THE SOFTWARE.
if ( prop->value.l < 0 )
FT_TRACE0(( "pcf_load_font: negative X resolution\n" ));
#endif
- resolution_x = FT_ABS( (FT_Short)prop->value.l );
+ if ( FT_ABS( prop->value.l ) > 0x7FFF )
+ {
+ resolution_x = 0x7FFF;
+ FT_TRACE0(( "pcf_load_font: clamping X resolution to value %d\n",
+ resolution_x ));
+ }
+ else
+ resolution_x = FT_ABS( (FT_Short)prop->value.l );
}
prop = pcf_find_property( face, "RESOLUTION_Y" );
@@ -1551,7 +1604,14 @@ THE SOFTWARE.
if ( prop->value.l < 0 )
FT_TRACE0(( "pcf_load_font: negative Y resolution\n" ));
#endif
- resolution_y = FT_ABS( (FT_Short)prop->value.l );
+ if ( FT_ABS( prop->value.l ) > 0x7FFF )
+ {
+ resolution_y = 0x7FFF;
+ FT_TRACE0(( "pcf_load_font: clamping Y resolution to value %d\n",
+ resolution_y ));
+ }
+ else
+ resolution_y = FT_ABS( (FT_Short)prop->value.l );
}
if ( bsize->y_ppem == 0 )
diff --git a/thirdparty/freetype/src/pfr/pfrobjs.c b/thirdparty/freetype/src/pfr/pfrobjs.c
index 4b1703f51c..514af8050d 100644
--- a/thirdparty/freetype/src/pfr/pfrobjs.c
+++ b/thirdparty/freetype/src/pfr/pfrobjs.c
@@ -264,12 +264,6 @@
charmap.encoding = FT_ENCODING_UNICODE;
error = FT_CMap_New( &pfr_cmap_class_rec, NULL, &charmap, NULL );
-
-#if 0
- /* select default charmap */
- if ( pfrface->num_charmaps )
- pfrface->charmap = pfrface->charmaps[0];
-#endif
}
/* check whether we have loaded any kerning pairs */
diff --git a/thirdparty/freetype/src/psaux/psconv.c b/thirdparty/freetype/src/psaux/psconv.c
index b092482194..d125b0834a 100644
--- a/thirdparty/freetype/src/psaux/psconv.c
+++ b/thirdparty/freetype/src/psaux/psconv.c
@@ -111,6 +111,10 @@
p++;
if ( p == limit )
goto Bad;
+
+ /* only a single sign is allowed */
+ if ( *p == '-' || *p == '+' )
+ return 0;
}
num_limit = 0x7FFFFFFFL / base;
@@ -215,6 +219,10 @@
p++;
if ( p == limit )
goto Bad;
+
+ /* only a single sign is allowed */
+ if ( *p == '-' || *p == '+' )
+ return 0;
}
/* read the integer part */
diff --git a/thirdparty/freetype/src/psaux/t1decode.c b/thirdparty/freetype/src/psaux/t1decode.c
index 7dd45135de..1250b53f5d 100644
--- a/thirdparty/freetype/src/psaux/t1decode.c
+++ b/thirdparty/freetype/src/psaux/t1decode.c
@@ -864,7 +864,9 @@
for ( mm = 1; mm < blend->num_designs; mm++ )
- tmp += FT_MulFix( *delta++, blend->weight_vector[mm] );
+ tmp = ADD_LONG( tmp,
+ FT_MulFix( *delta++,
+ blend->weight_vector[mm] ) );
*values++ = tmp;
}
@@ -904,7 +906,7 @@
if ( arg_cnt != 2 )
goto Unexpected_OtherSubr;
- top[0] += top[1]; /* XXX (over|under)flow */
+ top[0] = ADD_LONG( top[0], top[1] );
known_othersubr_result_cnt = 1;
break;
@@ -915,7 +917,7 @@
if ( arg_cnt != 2 )
goto Unexpected_OtherSubr;
- top[0] -= top[1]; /* XXX (over|under)flow */
+ top[0] = SUB_LONG( top[0], top[1] );
known_othersubr_result_cnt = 1;
break;
@@ -1147,11 +1149,13 @@
builder->parse_state = T1_Parse_Have_Width;
- builder->left_bearing.x += top[0];
- builder->advance.x = top[1];
- builder->advance.y = 0;
+ builder->left_bearing.x = ADD_LONG( builder->left_bearing.x,
+ top[0] );
- orig_x = x = builder->pos_x + top[0];
+ builder->advance.x = top[1];
+ builder->advance.y = 0;
+
+ orig_x = x = ADD_LONG( builder->pos_x, top[0] );
orig_y = y = builder->pos_y;
FT_UNUSED( orig_y );
@@ -1177,13 +1181,16 @@
builder->parse_state = T1_Parse_Have_Width;
- builder->left_bearing.x += top[0];
- builder->left_bearing.y += top[1];
- builder->advance.x = top[2];
- builder->advance.y = top[3];
+ builder->left_bearing.x = ADD_LONG( builder->left_bearing.x,
+ top[0] );
+ builder->left_bearing.y = ADD_LONG( builder->left_bearing.y,
+ top[1] );
+
+ builder->advance.x = top[2];
+ builder->advance.y = top[3];
- x = builder->pos_x + top[0];
- y = builder->pos_y + top[1];
+ x = ADD_LONG( builder->pos_x, top[0] );
+ y = ADD_LONG( builder->pos_y, top[1] );
/* the `metrics_only' indicates that we only want to compute */
/* the glyph's metrics (lsb + advance width), not load the */
@@ -1210,13 +1217,14 @@
if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) )
goto Fail;
- x += top[0];
+ x = ADD_LONG( x, top[0] );
goto Add_Line;
case op_hmoveto:
FT_TRACE4(( " hmoveto" ));
- x += top[0];
+ x = ADD_LONG( x, top[0] );
+
if ( !decoder->flex_state )
{
if ( builder->parse_state == T1_Parse_Start )
@@ -1232,12 +1240,14 @@
FT_SET_ERROR( t1_builder_check_points( builder, 3 ) ) )
goto Fail;
- x += top[0];
+ x = ADD_LONG( x, top[0] );
t1_builder_add_point( builder, x, y, 0 );
- x += top[1];
- y += top[2];
+
+ x = ADD_LONG( x, top[1] );
+ y = ADD_LONG( y, top[2] );
t1_builder_add_point( builder, x, y, 0 );
- y += top[3];
+
+ y = ADD_LONG( y, top[3] );
t1_builder_add_point( builder, x, y, 1 );
break;
@@ -1247,8 +1257,8 @@
if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) )
goto Fail;
- x += top[0];
- y += top[1];
+ x = ADD_LONG( x, top[0] );
+ y = ADD_LONG( y, top[1] );
Add_Line:
if ( FT_SET_ERROR( t1_builder_add_point1( builder, x, y ) ) )
@@ -1258,8 +1268,9 @@
case op_rmoveto:
FT_TRACE4(( " rmoveto" ));
- x += top[0];
- y += top[1];
+ x = ADD_LONG( x, top[0] );
+ y = ADD_LONG( y, top[1] );
+
if ( !decoder->flex_state )
{
if ( builder->parse_state == T1_Parse_Start )
@@ -1275,16 +1286,16 @@
FT_SET_ERROR( t1_builder_check_points( builder, 3 ) ) )
goto Fail;
- x += top[0];
- y += top[1];
+ x = ADD_LONG( x, top[0] );
+ y = ADD_LONG( y, top[1] );
t1_builder_add_point( builder, x, y, 0 );
- x += top[2];
- y += top[3];
+ x = ADD_LONG( x, top[2] );
+ y = ADD_LONG( y, top[3] );
t1_builder_add_point( builder, x, y, 0 );
- x += top[4];
- y += top[5];
+ x = ADD_LONG( x, top[4] );
+ y = ADD_LONG( y, top[5] );
t1_builder_add_point( builder, x, y, 1 );
break;
@@ -1295,12 +1306,14 @@
FT_SET_ERROR( t1_builder_check_points( builder, 3 ) ) )
goto Fail;
- y += top[0];
+ y = ADD_LONG( y, top[0] );
t1_builder_add_point( builder, x, y, 0 );
- x += top[1];
- y += top[2];
+
+ x = ADD_LONG( x, top[1] );
+ y = ADD_LONG( y, top[2] );
t1_builder_add_point( builder, x, y, 0 );
- x += top[3];
+
+ x = ADD_LONG( x, top[3] );
t1_builder_add_point( builder, x, y, 1 );
break;
@@ -1310,13 +1323,14 @@
if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) )
goto Fail;
- y += top[0];
+ y = ADD_LONG( y, top[0] );
goto Add_Line;
case op_vmoveto:
FT_TRACE4(( " vmoveto" ));
- y += top[0];
+ y = ADD_LONG( y, top[0] );
+
if ( !decoder->flex_state )
{
if ( builder->parse_state == T1_Parse_Start )
@@ -1473,7 +1487,7 @@
/* record vertical hint */
if ( hinter )
{
- top[0] += orig_x;
+ top[0] = ADD_LONG( top[0], orig_x );
hinter->stem( hinter->hints, 0, top );
}
break;
@@ -1487,9 +1501,9 @@
FT_Pos dx = orig_x;
- top[0] += dx;
- top[2] += dx;
- top[4] += dx;
+ top[0] = ADD_LONG( top[0], dx );
+ top[2] = ADD_LONG( top[2], dx );
+ top[4] = ADD_LONG( top[4], dx );
hinter->stem3( hinter->hints, 0, top );
}
break;
diff --git a/thirdparty/freetype/src/psnames/psmodule.c b/thirdparty/freetype/src/psnames/psmodule.c
index 3ff8cb911b..44ba9ec6ab 100644
--- a/thirdparty/freetype/src/psnames/psmodule.c
+++ b/thirdparty/freetype/src/psnames/psmodule.c
@@ -23,8 +23,21 @@
#include "psmodule.h"
+ /*
+ * The file `pstables.h' with its arrays and its function
+ * `ft_get_adobe_glyph_index' is useful for other projects also (for
+ * example, `pdfium' is using it). However, if used as a C++ header,
+ * including it in two different source files makes it necessary to use
+ * `extern const' for the declaration of its arrays, otherwise the data
+ * would be duplicated as mandated by the C++ standard.
+ *
+ * For this reason, we use `DEFINE_PS_TABLES' to guard the function
+ * definitions, and `DEFINE_PS_TABLES_DATA' to provide both proper array
+ * declarations and definitions.
+ */
#include "pstables.h"
#define DEFINE_PS_TABLES
+#define DEFINE_PS_TABLES_DATA
#include "pstables.h"
#include "psnamerr.h"
diff --git a/thirdparty/freetype/src/psnames/pstables.h b/thirdparty/freetype/src/psnames/pstables.h
index e0f5e30804..2a2b717d8f 100644
--- a/thirdparty/freetype/src/psnames/pstables.h
+++ b/thirdparty/freetype/src/psnames/pstables.h
@@ -19,7 +19,7 @@
/* This file has been generated automatically -- do not edit! */
-#ifndef DEFINE_PS_TABLES
+#ifndef DEFINE_PS_TABLES_DATA
#ifdef __cplusplus
extern "C"
#else
@@ -27,7 +27,7 @@
#endif
#endif
const char ft_standard_glyph_names[3696]
-#ifdef DEFINE_PS_TABLES
+#ifdef DEFINE_PS_TABLES_DATA
=
{
'.','n','u','l','l', 0,
@@ -451,7 +451,7 @@
'R','o','m','a','n', 0,
'S','e','m','i','b','o','l','d', 0,
}
-#endif /* DEFINE_PS_TABLES */
+#endif /* DEFINE_PS_TABLES_DATA */
;
@@ -459,7 +459,7 @@
/* Values are offsets into the `ft_standard_glyph_names' table */
-#ifndef DEFINE_PS_TABLES
+#ifndef DEFINE_PS_TABLES_DATA
#ifdef __cplusplus
extern "C"
#else
@@ -467,7 +467,7 @@
#endif
#endif
const short ft_mac_names[FT_NUM_MAC_NAMES]
-#ifdef DEFINE_PS_TABLES
+#ifdef DEFINE_PS_TABLES_DATA
=
{
253, 0, 6, 261, 267, 274, 283, 294, 301, 309, 758, 330, 340, 351,
@@ -490,7 +490,7 @@
1270,1313,1323,1171,1290,1332,1211,1235,1276, 169, 175, 182, 189, 200,
209, 218, 225, 232, 239, 246
}
-#endif /* DEFINE_PS_TABLES */
+#endif /* DEFINE_PS_TABLES_DATA */
;
@@ -498,7 +498,7 @@
/* Values are offsets into the `ft_standard_glyph_names' table */
-#ifndef DEFINE_PS_TABLES
+#ifndef DEFINE_PS_TABLES_DATA
#ifdef __cplusplus
extern "C"
#else
@@ -506,7 +506,7 @@
#endif
#endif
const short ft_sid_names[FT_NUM_SID_NAMES]
-#ifdef DEFINE_PS_TABLES
+#ifdef DEFINE_PS_TABLES_DATA
=
{
253, 261, 267, 274, 283, 294, 301, 309, 319, 330, 340, 351, 360, 365,
@@ -538,12 +538,12 @@
3418,3430,3442,3454,3471,3483,3498,3506,3518,3530,3542,3559,3574,3586,
3597,3612,3620,3628,3636,3644,3650,3655,3660,3666,3673,3681,3687
}
-#endif /* DEFINE_PS_TABLES */
+#endif /* DEFINE_PS_TABLES_DATA */
;
/* the following are indices into the SID name table */
-#ifndef DEFINE_PS_TABLES
+#ifndef DEFINE_PS_TABLES_DATA
#ifdef __cplusplus
extern "C"
#else
@@ -551,7 +551,7 @@
#endif
#endif
const unsigned short t1_standard_encoding[256]
-#ifdef DEFINE_PS_TABLES
+#ifdef DEFINE_PS_TABLES_DATA
=
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -571,12 +571,12 @@
0,138, 0,139, 0, 0, 0, 0,140,141,142,143, 0, 0, 0, 0,
0,144, 0, 0, 0,145, 0, 0,146,147,148,149, 0, 0, 0, 0
}
-#endif /* DEFINE_PS_TABLES */
+#endif /* DEFINE_PS_TABLES_DATA */
;
/* the following are indices into the SID name table */
-#ifndef DEFINE_PS_TABLES
+#ifndef DEFINE_PS_TABLES_DATA
#ifdef __cplusplus
extern "C"
#else
@@ -584,7 +584,7 @@
#endif
#endif
const unsigned short t1_expert_encoding[256]
-#ifdef DEFINE_PS_TABLES
+#ifdef DEFINE_PS_TABLES_DATA
=
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -604,7 +604,7 @@
347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,
363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378
}
-#endif /* DEFINE_PS_TABLES */
+#endif /* DEFINE_PS_TABLES_DATA */
;
@@ -619,7 +619,7 @@
#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
-#ifndef DEFINE_PS_TABLES
+#ifndef DEFINE_PS_TABLES_DATA
#ifdef __cplusplus
extern "C"
#else
@@ -627,7 +627,7 @@
#endif
#endif
const unsigned char ft_adobe_glyph_list[55997L]
-#ifdef DEFINE_PS_TABLES
+#ifdef DEFINE_PS_TABLES_DATA
=
{
0, 52, 0,106, 2,167, 3, 63, 4,220, 6,125, 9,143, 10, 23,
@@ -4131,7 +4131,7 @@
182,117, 2,218,167,218,178,232,233,242,225,231,225,238, 97,128,
48, 90,235,225,244,225,235,225,238, 97,128, 48,186
}
-#endif /* DEFINE_PS_TABLES */
+#endif /* DEFINE_PS_TABLES_DATA */
;
diff --git a/thirdparty/freetype/src/raster/ftrend1.c b/thirdparty/freetype/src/raster/ftrend1.c
index 1a83e9e477..185a7f6fc2 100644
--- a/thirdparty/freetype/src/raster/ftrend1.c
+++ b/thirdparty/freetype/src/raster/ftrend1.c
@@ -31,12 +31,7 @@
static FT_Error
ft_raster1_init( FT_Renderer render )
{
- FT_Library library = FT_MODULE_LIBRARY( render );
-
-
- render->clazz->raster_class->raster_reset( render->raster,
- library->raster_pool,
- library->raster_pool_size );
+ render->clazz->raster_class->raster_reset( render->raster, NULL, 0 );
return FT_Err_Ok;
}
@@ -194,7 +189,7 @@
bitmap->rows = height;
bitmap->pitch = (int)pitch;
- if ( FT_ALLOC_MULT( bitmap->buffer, pitch, height ) )
+ if ( FT_ALLOC_MULT( bitmap->buffer, height, pitch ) )
goto Exit;
slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
diff --git a/thirdparty/freetype/src/sfnt/pngshim.c b/thirdparty/freetype/src/sfnt/pngshim.c
index b9b296ea5f..560db4835a 100644
--- a/thirdparty/freetype/src/sfnt/pngshim.c
+++ b/thirdparty/freetype/src/sfnt/pngshim.c
@@ -49,18 +49,82 @@
}
- /* Premultiplies data and converts RGBA bytes => native endian. */
+ /* Premultiplies data and converts RGBA bytes => BGRA. */
static void
premultiply_data( png_structp png,
png_row_infop row_info,
png_bytep data )
{
- unsigned int i;
+ unsigned int i = 0, limit;
+
+ /* The `vector_size' attribute was introduced in gcc 3.1, which */
+ /* predates clang; the `__BYTE_ORDER__' preprocessor symbol was */
+ /* introduced in gcc 4.6 and clang 3.2, respectively. */
+ /* `__builtin_shuffle' for gcc was introduced in gcc 4.7.0. */
+#if ( ( defined( __GNUC__ ) && \
+ ( ( __GNUC__ >= 5 ) || \
+ ( ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ >= 7 ) ) ) ) || \
+ ( defined( __clang__ ) && \
+ ( ( __clang_major__ >= 4 ) || \
+ ( ( __clang_major__ == 3 ) && ( __clang_minor__ >= 2 ) ) ) ) ) && \
+ defined( __OPTIMIZE__ ) && \
+ __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+
+#ifdef __clang__
+ /* the clang documentation doesn't cover the two-argument case of */
+ /* `__builtin_shufflevector'; however, it is is implemented since */
+ /* version 2.8 */
+#define vector_shuffle __builtin_shufflevector
+#else
+#define vector_shuffle __builtin_shuffle
+#endif
- FT_UNUSED( png );
+ typedef unsigned short v82 __attribute__(( vector_size( 16 ) ));
- for ( i = 0; i < row_info->rowbytes; i += 4 )
+ /* process blocks of 16 bytes in one rush, which gives a nice speed-up */
+ limit = row_info->rowbytes - 16 + 1;
+ for ( ; i < limit; i += 16 )
+ {
+ unsigned char* base = &data[i];
+
+ v82 s, s0, s1, a;
+
+ /* clang <= 3.9 can't apply scalar values to vectors */
+ /* (or rather, it needs a different syntax) */
+ v82 n0x80 = { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 };
+ v82 n0xFF = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
+ v82 n8 = { 8, 8, 8, 8, 8, 8, 8, 8 };
+
+ v82 ma = { 1, 1, 3, 3, 5, 5, 7, 7 };
+ v82 o1 = { 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF };
+ v82 m0 = { 1, 0, 3, 2, 5, 4, 7, 6 };
+
+
+ memcpy( &s, base, 16 ); /* RGBA RGBA RGBA RGBA */
+ s0 = s & n0xFF; /* R B R B R B R B */
+ s1 = s >> n8; /* G A G A G A G A */
+
+ a = vector_shuffle( s1, ma ); /* A A A A A A A A */
+ s1 |= o1; /* G 1 G 1 G 1 G 1 */
+ s0 = vector_shuffle( s0, m0 ); /* B R B R B R B R */
+
+ s0 *= a;
+ s1 *= a;
+ s0 += n0x80;
+ s1 += n0x80;
+ s0 = ( s0 + ( s0 >> n8 ) ) >> n8;
+ s1 = ( s1 + ( s1 >> n8 ) ) >> n8;
+
+ s = s0 | ( s1 << n8 );
+ memcpy( base, &s, 16 );
+ }
+#endif /* use `vector_size' */
+
+ FT_UNUSED( png );
+
+ limit = row_info->rowbytes;
+ for ( ; i < limit; i += 4 )
{
unsigned char* base = &data[i];
unsigned int alpha = base[3];
diff --git a/thirdparty/freetype/src/sfnt/sfobjs.c b/thirdparty/freetype/src/sfnt/sfobjs.c
index ac2e620e5d..69bf0a5c3d 100644
--- a/thirdparty/freetype/src/sfnt/sfobjs.c
+++ b/thirdparty/freetype/src/sfnt/sfobjs.c
@@ -787,6 +787,8 @@
tag != TTAG_OTTO &&
tag != TTAG_true &&
tag != TTAG_typ1 &&
+ tag != TTAG_0xA5kbd &&
+ tag != TTAG_0xA5lst &&
tag != 0x00020000UL )
{
FT_TRACE2(( " not a font using the SFNT container format\n" ));
@@ -1224,7 +1226,10 @@
goto Exit;
}
- if ( face->header.Units_Per_EM == 0 )
+ /* OpenType 1.8.2 introduced limits to this value; */
+ /* however, they make sense for older SFNT fonts also */
+ if ( face->header.Units_Per_EM < 16 ||
+ face->header.Units_Per_EM > 16384 )
{
error = FT_THROW( Invalid_Table );
@@ -1464,7 +1469,8 @@
/* Polish the charmaps. */
/* */
/* Try to set the charmap encoding according to the platform & */
- /* encoding ID of each charmap. */
+ /* encoding ID of each charmap. Emulate Unicode charmap if one */
+ /* is missing. */
/* */
tt_face_build_cmaps( face ); /* ignore errors */
@@ -1472,7 +1478,10 @@
/* set the encoding fields */
{
- FT_Int m;
+ FT_Int m;
+#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
+ FT_Bool has_unicode = FALSE;
+#endif
for ( m = 0; m < root->num_charmaps; m++ )
@@ -1483,14 +1492,34 @@
charmap->encoding = sfnt_find_encoding( charmap->platform_id,
charmap->encoding_id );
-#if 0
- if ( !root->charmap &&
- charmap->encoding == FT_ENCODING_UNICODE )
- {
- /* set 'root->charmap' to the first Unicode encoding we find */
- root->charmap = charmap;
- }
-#endif
+#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
+
+ if ( charmap->encoding == FT_ENCODING_UNICODE ||
+ charmap->encoding == FT_ENCODING_MS_SYMBOL ) /* PUA */
+ has_unicode = TRUE;
+ }
+
+ /* synthesize Unicode charmap if one is missing */
+ if ( !has_unicode )
+ {
+ FT_CharMapRec cmaprec;
+
+
+ cmaprec.face = root;
+ cmaprec.platform_id = TT_PLATFORM_MICROSOFT;
+ cmaprec.encoding_id = TT_MS_ID_UNICODE_CS;
+ cmaprec.encoding = FT_ENCODING_UNICODE;
+
+
+ error = FT_CMap_New( (FT_CMap_Class)&tt_cmap_unicode_class_rec,
+ NULL, &cmaprec, NULL );
+ if ( error &&
+ FT_ERR_NEQ( error, No_Unicode_Glyph_Name ) )
+ goto Exit;
+ error = FT_Err_Ok;
+
+#endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */
+
}
}
diff --git a/thirdparty/freetype/src/sfnt/ttcmap.c b/thirdparty/freetype/src/sfnt/ttcmap.c
index 5afa6ae4b7..b995e5c050 100644
--- a/thirdparty/freetype/src/sfnt/ttcmap.c
+++ b/thirdparty/freetype/src/sfnt/ttcmap.c
@@ -23,8 +23,10 @@
#include FT_INTERNAL_VALIDATE_H
#include FT_INTERNAL_STREAM_H
+#include FT_SERVICE_POSTSCRIPT_CMAPS_H
#include "ttload.h"
#include "ttcmap.h"
+#include "ttpost.h"
#include "sfntpic.h"
@@ -3622,6 +3624,110 @@
#endif /* TT_CONFIG_CMAP_FORMAT_14 */
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** SYNTHETIC UNICODE *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+ /* This charmap is generated using postscript glyph names. */
+
+#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
+
+ FT_CALLBACK_DEF( const char * )
+ tt_get_glyph_name( TT_Face face,
+ FT_UInt idx )
+ {
+ FT_String* PSname;
+
+
+ tt_face_get_ps_name( face, idx, &PSname );
+
+ return PSname;
+ }
+
+
+ FT_CALLBACK_DEF( FT_Error )
+ tt_cmap_unicode_init( PS_Unicodes unicodes,
+ FT_Pointer pointer )
+ {
+ TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes );
+ FT_Memory memory = FT_FACE_MEMORY( face );
+ FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames;
+
+ FT_UNUSED( pointer );
+
+
+ return psnames->unicodes_init( memory,
+ unicodes,
+ face->root.num_glyphs,
+ (PS_GetGlyphNameFunc)&tt_get_glyph_name,
+ (PS_FreeGlyphNameFunc)NULL,
+ (FT_Pointer)face );
+ }
+
+
+ FT_CALLBACK_DEF( void )
+ tt_cmap_unicode_done( PS_Unicodes unicodes )
+ {
+ FT_Face face = FT_CMAP_FACE( unicodes );
+ FT_Memory memory = FT_FACE_MEMORY( face );
+
+
+ FT_FREE( unicodes->maps );
+ unicodes->num_maps = 0;
+ }
+
+
+ FT_CALLBACK_DEF( FT_UInt )
+ tt_cmap_unicode_char_index( PS_Unicodes unicodes,
+ FT_UInt32 char_code )
+ {
+ TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes );
+ FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames;
+
+
+ return psnames->unicodes_char_index( unicodes, char_code );
+ }
+
+
+ FT_CALLBACK_DEF( FT_UInt32 )
+ tt_cmap_unicode_char_next( PS_Unicodes unicodes,
+ FT_UInt32 *pchar_code )
+ {
+ TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes );
+ FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames;
+
+
+ return psnames->unicodes_char_next( unicodes, pchar_code );
+ }
+
+
+ FT_DEFINE_TT_CMAP(
+ tt_cmap_unicode_class_rec,
+
+ sizeof ( PS_UnicodesRec ),
+
+ (FT_CMap_InitFunc) tt_cmap_unicode_init, /* init */
+ (FT_CMap_DoneFunc) tt_cmap_unicode_done, /* done */
+ (FT_CMap_CharIndexFunc)tt_cmap_unicode_char_index, /* char_index */
+ (FT_CMap_CharNextFunc) tt_cmap_unicode_char_next, /* char_next */
+
+ (FT_CMap_CharVarIndexFunc) NULL, /* char_var_index */
+ (FT_CMap_CharVarIsDefaultFunc)NULL, /* char_var_default */
+ (FT_CMap_VariantListFunc) NULL, /* variant_list */
+ (FT_CMap_CharVariantListFunc) NULL, /* charvariant_list */
+ (FT_CMap_VariantCharListFunc) NULL, /* variantchar_list */
+
+ ~0U,
+ (TT_CMap_ValidateFunc)NULL, /* validate */
+ (TT_CMap_Info_GetFunc)NULL /* get_cmap_info */
+ )
+
+#endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */
+
#ifndef FT_CONFIG_OPTION_PIC
static const TT_CMap_Class tt_cmap_classes[] =
@@ -3801,8 +3907,10 @@
FT_CMap cmap = (FT_CMap)charmap;
TT_CMap_Class clazz = (TT_CMap_Class)cmap->clazz;
-
- return clazz->get_cmap_info( charmap, cmap_info );
+ if ( clazz->get_cmap_info )
+ return clazz->get_cmap_info( charmap, cmap_info );
+ else
+ return FT_THROW( Invalid_CharMap_Format );
}
diff --git a/thirdparty/freetype/src/sfnt/ttcmap.h b/thirdparty/freetype/src/sfnt/ttcmap.h
index 83f12df241..f7de0437b0 100644
--- a/thirdparty/freetype/src/sfnt/ttcmap.h
+++ b/thirdparty/freetype/src/sfnt/ttcmap.h
@@ -141,6 +141,8 @@ FT_BEGIN_HEADER
#define TT_VALID_GLYPH_COUNT( x ) TT_VALIDATOR( x )->num_glyphs
+ FT_CALLBACK_TABLE const TT_CMap_ClassRec tt_cmap_unicode_class_rec;
+
FT_LOCAL( FT_Error )
tt_face_build_cmaps( TT_Face face );
diff --git a/thirdparty/freetype/src/sfnt/ttkern.c b/thirdparty/freetype/src/sfnt/ttkern.c
index c97e5789ac..53d2436ae5 100644
--- a/thirdparty/freetype/src/sfnt/ttkern.c
+++ b/thirdparty/freetype/src/sfnt/ttkern.c
@@ -85,7 +85,7 @@
for ( nn = 0; nn < num_tables; nn++ )
{
- FT_UInt num_pairs, length, coverage;
+ FT_UInt num_pairs, length, coverage, format;
FT_Byte* p_next;
FT_UInt32 mask = (FT_UInt32)1UL << nn;
@@ -107,6 +107,12 @@
if ( p_next > p_limit ) /* handle broken table */
p_next = p_limit;
+ format = coverage >> 8;
+
+ /* we currently only support format 0 kerning tables */
+ if ( format != 0 )
+ goto NextTable;
+
/* only use horizontal kerning tables */
if ( ( coverage & 3U ) != 0x0001 ||
p + 8 > p_next )
diff --git a/thirdparty/freetype/src/sfnt/ttpost.c b/thirdparty/freetype/src/sfnt/ttpost.c
index 540d5f2546..69929c8d45 100644
--- a/thirdparty/freetype/src/sfnt/ttpost.c
+++ b/thirdparty/freetype/src/sfnt/ttpost.c
@@ -325,7 +325,6 @@
FT_UNUSED( post_limit );
- /* UNDOCUMENTED! This value appears only in the Apple TT specs. */
if ( FT_READ_USHORT( num_glyphs ) )
goto Exit;
@@ -408,7 +407,7 @@
/* now read postscript table */
if ( format == 0x00020000L )
error = load_format_20( face, stream, post_limit );
- else if ( format == 0x00028000L )
+ else if ( format == 0x00025000L )
error = load_format_25( face, stream, post_limit );
else
error = FT_THROW( Invalid_File_Format );
@@ -447,7 +446,7 @@
FT_FREE( table->glyph_names );
table->num_names = 0;
}
- else if ( format == 0x00028000L )
+ else if ( format == 0x00025000L )
{
TT_Post_25 table = &names->names.format_25;
@@ -543,7 +542,7 @@
*PSname = (FT_String*)table->glyph_names[name_index - 258];
}
}
- else if ( format == 0x00028000L )
+ else if ( format == 0x00025000L )
{
TT_Post_25 table = &names->names.format_25;
diff --git a/thirdparty/freetype/src/sfnt/ttsbit.c b/thirdparty/freetype/src/sfnt/ttsbit.c
index 0c76a55779..f41847b0af 100644
--- a/thirdparty/freetype/src/sfnt/ttsbit.c
+++ b/thirdparty/freetype/src/sfnt/ttsbit.c
@@ -448,6 +448,15 @@
metrics->max_advance =
FT_MulDiv( hori->advance_Width_Max, ppem_ * 64, upem );
+ /* set the scale values (in 16.16 units) so advances */
+ /* from the hmtx and vmtx table are scaled correctly */
+ metrics->x_scale = FT_MulDiv( metrics->x_ppem,
+ 64 * 0x10000,
+ face->header.Units_Per_EM );
+ metrics->y_scale = FT_MulDiv( metrics->y_ppem,
+ 64 * 0x10000,
+ face->header.Units_Per_EM );
+
return error;
}
@@ -1439,10 +1448,17 @@
return FT_THROW( Invalid_Table );
NoBitmap:
+ if ( recurse_count )
+ {
+ FT_TRACE4(( "tt_sbit_decoder_load_image:"
+ " missing subglyph sbit with glyph index %d\n",
+ glyph_index ));
+ return FT_THROW( Invalid_Composite );
+ }
+
FT_TRACE4(( "tt_sbit_decoder_load_image:"
" no sbit found for glyph index %d\n", glyph_index ));
-
- return FT_THROW( Invalid_Argument );
+ return FT_THROW( Missing_Bitmap );
}
diff --git a/thirdparty/freetype/src/smooth/ftgrays.c b/thirdparty/freetype/src/smooth/ftgrays.c
index e9a3ce7a7c..df645e66c9 100644
--- a/thirdparty/freetype/src/smooth/ftgrays.c
+++ b/thirdparty/freetype/src/smooth/ftgrays.c
@@ -141,6 +141,16 @@
#define FT_INT_MAX INT_MAX
#define FT_ULONG_MAX ULONG_MAX
+#define ADD_LONG( a, b ) \
+ (long)( (unsigned long)(a) + (unsigned long)(b) )
+#define SUB_LONG( a, b ) \
+ (long)( (unsigned long)(a) - (unsigned long)(b) )
+#define MUL_LONG( a, b ) \
+ (long)( (unsigned long)(a) * (unsigned long)(b) )
+#define NEG_LONG( a ) \
+ (long)( -(unsigned long)(a) )
+
+
#define ft_memset memset
#define ft_setjmp setjmp
@@ -264,6 +274,7 @@ typedef ptrdiff_t FT_PtrDist;
#include "ftgrays.h"
#include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_DEBUG_H
+#include FT_INTERNAL_CALC_H
#include FT_OUTLINE_H
#include "ftsmerrs.h"
@@ -1135,7 +1146,7 @@ typedef ptrdiff_t FT_PtrDist;
/* s is L * the perpendicular distance from P1 to the line P0-P3. */
dx1 = arc[1].x - arc[0].x;
dy1 = arc[1].y - arc[0].y;
- s = FT_ABS( dy * dx1 - dx * dy1 );
+ s = FT_ABS( SUB_LONG( MUL_LONG( dy, dx1 ), MUL_LONG( dx, dy1 ) ) );
if ( s > s_limit )
goto Split;
@@ -1143,7 +1154,7 @@ typedef ptrdiff_t FT_PtrDist;
/* s is L * the perpendicular distance from P2 to the line P0-P3. */
dx2 = arc[2].x - arc[0].x;
dy2 = arc[2].y - arc[0].y;
- s = FT_ABS( dy * dx2 - dx * dy2 );
+ s = FT_ABS( SUB_LONG( MUL_LONG( dy, dx2 ), MUL_LONG( dx, dy2 ) ) );
if ( s > s_limit )
goto Split;
diff --git a/thirdparty/freetype/src/smooth/ftsmooth.c b/thirdparty/freetype/src/smooth/ftsmooth.c
index 435854e673..963435de15 100644
--- a/thirdparty/freetype/src/smooth/ftsmooth.c
+++ b/thirdparty/freetype/src/smooth/ftsmooth.c
@@ -31,12 +31,7 @@
static FT_Error
ft_smooth_init( FT_Renderer render )
{
- FT_Library library = FT_MODULE_LIBRARY( render );
-
-
- render->clazz->raster_class->raster_reset( render->raster,
- library->raster_pool,
- library->raster_pool_size );
+ render->clazz->raster_class->raster_reset( render->raster, NULL, 0 );
return 0;
}
@@ -111,9 +106,6 @@
FT_Pos y_shift = 0;
FT_Pos x_left, y_top;
FT_Pos width, height, pitch;
-#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
- FT_Pos height_org, width_org;
-#endif
FT_Int hmul = ( mode == FT_RENDER_MODE_LCD );
FT_Int vmul = ( mode == FT_RENDER_MODE_LCD_V );
@@ -124,7 +116,6 @@
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
- FT_Int lcd_extra = 0;
FT_LcdFiveTapFilter lcd_weights = { 0 };
FT_Bool have_custom_weight = FALSE;
FT_Bitmap_LcdFilterFunc lcd_filter_func = NULL;
@@ -152,13 +143,12 @@
{
/*
* A per-font filter is set. It always uses the default 5-tap
- * in-place FIR filter that needs 2 extra pixels.
+ * in-place FIR filter.
*/
ft_memcpy( lcd_weights,
slot->face->internal->lcd_weights,
FT_LCD_FILTER_FIVE_TAPS );
lcd_filter_func = ft_lcd_filter_fir;
- lcd_extra = 2;
}
else
{
@@ -172,7 +162,6 @@
slot->library->lcd_weights,
FT_LCD_FILTER_FIVE_TAPS );
lcd_filter_func = slot->library->lcd_filter_func;
- lcd_extra = slot->library->lcd_extra;
}
#endif /*FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
@@ -201,6 +190,45 @@
/* taking into account the origin shift */
FT_Outline_Get_CBox( outline, &cbox );
+#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
+
+ /* add minimal padding for LCD rendering */
+ if ( hmul )
+ {
+ cbox.xMax += 21;
+ cbox.xMin -= 21;
+ }
+
+ if ( vmul )
+ {
+ cbox.yMax += 21;
+ cbox.yMin -= 21;
+ }
+
+#else /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
+
+ /* add minimal padding for LCD filter depending on specific weights */
+ if ( lcd_filter_func )
+ {
+ if ( hmul )
+ {
+ cbox.xMax += lcd_weights[4] ? 43
+ : lcd_weights[3] ? 22 : 0;
+ cbox.xMin -= lcd_weights[0] ? 43
+ : lcd_weights[1] ? 22 : 0;
+ }
+
+ if ( vmul )
+ {
+ cbox.yMax += lcd_weights[4] ? 43
+ : lcd_weights[3] ? 22 : 0;
+ cbox.yMin -= lcd_weights[0] ? 43
+ : lcd_weights[1] ? 22 : 0;
+ }
+ }
+
+#endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
+
cbox.xMin = FT_PIX_FLOOR( cbox.xMin + x_shift );
cbox.yMin = FT_PIX_FLOOR( cbox.yMin + y_shift );
cbox.xMax = FT_PIX_CEIL( cbox.xMax + x_shift );
@@ -215,11 +243,6 @@
width = (FT_ULong)( cbox.xMax - cbox.xMin ) >> 6;
height = (FT_ULong)( cbox.yMax - cbox.yMin ) >> 6;
-#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
- width_org = width;
- height_org = height;
-#endif
-
pitch = width;
if ( hmul )
{
@@ -230,26 +253,6 @@
if ( vmul )
height *= 3;
-#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
- if ( lcd_filter_func )
- {
- if ( hmul )
- {
- x_shift += 64 * ( lcd_extra >> 1 );
- x_left -= lcd_extra >> 1;
- width += 3 * lcd_extra;
- pitch = FT_PAD_CEIL( width, 4 );
- }
-
- if ( vmul )
- {
- y_shift += 64 * ( lcd_extra >> 1 );
- y_top += lcd_extra >> 1;
- height += 3 * lcd_extra;
- }
- }
-#endif
-
/*
* XXX: on 16bit system, we return an error for huge bitmap
* to prevent an overflow.
@@ -353,57 +356,98 @@
#else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
- /* render outline into bitmap */
- error = render->raster_render( render->raster, &params );
- if ( error )
- goto Exit;
-
- /* expand it horizontally */
- if ( hmul )
+ if ( hmul ) /* lcd */
{
- FT_Byte* line = bitmap->buffer;
- FT_UInt hh;
+ FT_Byte* line;
+ FT_Byte* temp;
+ FT_Int i, j;
- for ( hh = height_org; hh > 0; hh--, line += pitch )
- {
- FT_UInt xx;
- FT_Byte* end = line + width;
+ /* Render 3 separate monochrome bitmaps, shifting the outline */
+ /* by 1/3 pixel. */
+ width /= 3;
+ FT_Outline_Translate( outline, 21, 0 );
- for ( xx = width_org; xx > 0; xx-- )
- {
- FT_UInt pixel = line[xx-1];
+ error = render->raster_render( render->raster, &params );
+ if ( error )
+ goto Exit;
+
+ FT_Outline_Translate( outline, -21, 0 );
+ bitmap->buffer += width;
+
+ error = render->raster_render( render->raster, &params );
+ if ( error )
+ goto Exit;
+
+ FT_Outline_Translate( outline, -21, 0 );
+ bitmap->buffer += width;
+ error = render->raster_render( render->raster, &params );
+ if ( error )
+ goto Exit;
- end[-3] = (FT_Byte)pixel;
- end[-2] = (FT_Byte)pixel;
- end[-1] = (FT_Byte)pixel;
- end -= 3;
+ FT_Outline_Translate( outline, 21, 0 );
+ bitmap->buffer -= 2 * width;
+
+ /* XXX: Rearrange the bytes according to FT_PIXEL_MODE_LCD. */
+ /* XXX: It is more efficient to render every third byte above. */
+
+ if ( FT_ALLOC( temp, (FT_ULong)pitch ) )
+ goto Exit;
+
+ for ( i = 0; i < height; i++ )
+ {
+ line = bitmap->buffer + i * pitch;
+ for ( j = 0; j < width; j++ )
+ {
+ temp[3 * j ] = line[j];
+ temp[3 * j + 1] = line[j + width];
+ temp[3 * j + 2] = line[j + width + width];
}
+ FT_MEM_COPY( line, temp, pitch );
}
- }
- /* expand it vertically */
- if ( vmul )
+ FT_FREE( temp );
+ }
+ else if ( vmul ) /* lcd_v */
{
- FT_Byte* read = bitmap->buffer + ( height - height_org ) * pitch;
- FT_Byte* write = bitmap->buffer;
- FT_UInt hh;
+ /* Render 3 separate monochrome bitmaps, shifting the outline */
+ /* by 1/3 pixel. Triple the pitch to render on each third row. */
+ bitmap->pitch *= 3;
+ bitmap->rows /= 3;
+ FT_Outline_Translate( outline, 0, 21 );
+ bitmap->buffer += 2 * pitch;
- for ( hh = height_org; hh > 0; hh-- )
- {
- ft_memcpy( write, read, pitch );
- write += pitch;
+ error = render->raster_render( render->raster, &params );
+ if ( error )
+ goto Exit;
- ft_memcpy( write, read, pitch );
- write += pitch;
+ FT_Outline_Translate( outline, 0, -21 );
+ bitmap->buffer -= pitch;
- ft_memcpy( write, read, pitch );
- write += pitch;
- read += pitch;
- }
+ error = render->raster_render( render->raster, &params );
+ if ( error )
+ goto Exit;
+
+ FT_Outline_Translate( outline, 0, -21 );
+ bitmap->buffer -= pitch;
+
+ error = render->raster_render( render->raster, &params );
+ if ( error )
+ goto Exit;
+
+ FT_Outline_Translate( outline, 0, 21 );
+
+ bitmap->pitch /= 3;
+ bitmap->rows *= 3;
+ }
+ else /* grayscale */
+ {
+ error = render->raster_render( render->raster, &params );
+ if ( error )
+ goto Exit;
}
#endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
diff --git a/thirdparty/freetype/src/truetype/ttgload.c b/thirdparty/freetype/src/truetype/ttgload.c
index b7a844a6c7..5e102c6151 100644
--- a/thirdparty/freetype/src/truetype/ttgload.c
+++ b/thirdparty/freetype/src/truetype/ttgload.c
@@ -87,7 +87,7 @@
/*************************************************************************/
/* */
/* Return the vertical metrics in font units for a given glyph. */
- /* See macro `TT_LOADER_SET_PP' below for explanations. */
+ /* See function `tt_loader_set_pp' below for explanations. */
/* */
FT_LOCAL_DEF( void )
TT_Get_VMetrics( TT_Face face,
@@ -825,7 +825,7 @@
/* compatibility mode, where no movement on the x axis means no reason */
/* to change bearings or advance widths. */
if ( !( driver->interpreter_version == TT_INTERPRETER_VERSION_40 &&
- !loader->exec->backward_compatibility ) )
+ loader->exec->backward_compatibility ) )
{
#endif
loader->pp1 = zone->cur[zone->n_points - 4];
@@ -1686,7 +1686,7 @@
/***********************************************************************/
/* otherwise, load a composite! */
- else if ( loader->n_contours == -1 )
+ else if ( loader->n_contours < 0 )
{
FT_Memory memory = face->root.memory;
@@ -1697,6 +1697,9 @@
FT_ListNode node, node2;
+ /* normalize the `n_contours' value */
+ loader->n_contours = -1;
+
/*
* We store the glyph index directly in the `node->data' pointer,
* following the glib solution (cf. macro `GUINT_TO_POINTER') with a
@@ -1991,12 +1994,6 @@
}
}
}
- else
- {
- /* invalid composite count (negative but not -1) */
- error = FT_THROW( Invalid_Outline );
- goto Exit;
- }
/***********************************************************************/
/***********************************************************************/
@@ -2100,8 +2097,8 @@
}
/* set glyph dimensions */
- glyph->metrics.width = bbox.xMax - bbox.xMin;
- glyph->metrics.height = bbox.yMax - bbox.yMin;
+ glyph->metrics.width = SUB_LONG( bbox.xMax, bbox.xMin );
+ glyph->metrics.height = SUB_LONG( bbox.yMax, bbox.yMin );
/* Now take care of vertical metrics. In the case where there is */
/* no vertical information within the font (relatively common), */
@@ -2137,7 +2134,8 @@
/* table in the font. Otherwise, we use the */
/* values defined in the horizontal header. */
- height = (FT_Short)FT_DivFix( bbox.yMax - bbox.yMin,
+ height = (FT_Short)FT_DivFix( SUB_LONG( bbox.yMax,
+ bbox.yMin ),
y_scale );
if ( face->os2.version != 0xFFFFU )
advance = (FT_Pos)( face->os2.sTypoAscender -
@@ -2339,13 +2337,19 @@
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 )
{
- subpixel_hinting_lean = TRUE;
- grayscale_cleartype = !FT_BOOL( load_flags &
- FT_LOAD_TARGET_LCD ||
- load_flags &
- FT_LOAD_TARGET_LCD_V );
- exec->vertical_lcd_lean = FT_BOOL( load_flags &
- FT_LOAD_TARGET_LCD_V );
+ subpixel_hinting_lean =
+ FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
+ FT_RENDER_MODE_MONO );
+ grayscale_cleartype =
+ FT_BOOL( subpixel_hinting_lean &&
+ !( ( load_flags &
+ FT_LOAD_TARGET_LCD ) ||
+ ( load_flags &
+ FT_LOAD_TARGET_LCD_V ) ) );
+ exec->vertical_lcd_lean =
+ FT_BOOL( subpixel_hinting_lean &&
+ ( load_flags &
+ FT_LOAD_TARGET_LCD_V ) );
}
else
{
@@ -2621,7 +2625,64 @@
IS_DEFAULT_INSTANCE )
{
error = load_sbit_image( size, glyph, glyph_index, load_flags );
- if ( !error )
+ if ( FT_ERR_EQ( error, Missing_Bitmap ) )
+ {
+ /* the bitmap strike is incomplete and misses the requested glyph; */
+ /* if we have a bitmap-only font, return an empty glyph */
+ if ( !FT_IS_SCALABLE( glyph->face ) )
+ {
+ TT_Face face = (TT_Face)glyph->face;
+ FT_Short left_bearing = 0, top_bearing = 0;
+ FT_UShort advance_width = 0, advance_height = 0;
+
+
+ /* to return an empty glyph, however, we need metrics data */
+ /* from the `hmtx' (or `vmtx') table; the assumption is that */
+ /* empty glyphs are missing intentionally, representing */
+ /* whitespace - not having at least horizontal metrics is */
+ /* thus considered an error */
+ if ( !face->horz_metrics_size )
+ return error;
+
+ /* we now construct an empty bitmap glyph */
+ TT_Get_HMetrics( face, glyph_index,
+ &left_bearing,
+ &advance_width );
+ TT_Get_VMetrics( face, glyph_index,
+ 0,
+ &top_bearing,
+ &advance_height );
+
+ glyph->outline.n_points = 0;
+ glyph->outline.n_contours = 0;
+
+ glyph->metrics.width = 0;
+ glyph->metrics.height = 0;
+
+ glyph->metrics.horiBearingX = left_bearing;
+ glyph->metrics.horiBearingY = 0;
+ glyph->metrics.horiAdvance = advance_width;
+
+ glyph->metrics.vertBearingX = 0;
+ glyph->metrics.vertBearingY = top_bearing;
+ glyph->metrics.vertAdvance = advance_height;
+
+ glyph->format = FT_GLYPH_FORMAT_BITMAP;
+ glyph->bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
+
+ glyph->bitmap_left = 0;
+ glyph->bitmap_top = 0;
+
+ return FT_Err_Ok;
+ }
+ }
+ else if ( error )
+ {
+ /* return error if font is not scalable */
+ if ( !FT_IS_SCALABLE( glyph->face ) )
+ return error;
+ }
+ else
{
if ( FT_IS_SCALABLE( glyph->face ) )
{
diff --git a/thirdparty/freetype/src/truetype/ttgxvar.c b/thirdparty/freetype/src/truetype/ttgxvar.c
index 0cedb6bdfa..49aa53a687 100644
--- a/thirdparty/freetype/src/truetype/ttgxvar.c
+++ b/thirdparty/freetype/src/truetype/ttgxvar.c
@@ -60,8 +60,11 @@
#define FT_Stream_FTell( stream ) \
(FT_ULong)( (stream)->cursor - (stream)->base )
-#define FT_Stream_SeekSet( stream, off ) \
- ( (stream)->cursor = (stream)->base + (off) )
+#define FT_Stream_SeekSet( stream, off ) \
+ (stream)->cursor = \
+ ( (off) < (FT_ULong)( (stream)->limit - (stream)->base ) ) \
+ ? (stream)->base + (off) \
+ : (stream)->limit
/*************************************************************************/
@@ -392,14 +395,14 @@
/* some macros we need */
- #define FT_FIXED_ONE ( (FT_Fixed)0x10000 )
+#define FT_FIXED_ONE ( (FT_Fixed)0x10000 )
- #define FT_fdot14ToFixed( x ) \
- ( (FT_Fixed)( (FT_ULong)(x) << 2 ) )
- #define FT_intToFixed( i ) \
- ( (FT_Fixed)( (FT_ULong)(i) << 16 ) )
- #define FT_fixedToInt( x ) \
- ( (FT_Short)( ( (FT_UInt32)(x) + 0x8000U ) >> 16 ) )
+#define FT_fdot14ToFixed( x ) \
+ ( (FT_Fixed)( (FT_ULong)(x) << 2 ) )
+#define FT_intToFixed( i ) \
+ ( (FT_Fixed)( (FT_ULong)(i) << 16 ) )
+#define FT_fixedToInt( x ) \
+ ( (FT_Short)( ( (FT_UInt32)(x) + 0x8000U ) >> 16 ) )
static FT_Error
@@ -1953,6 +1956,7 @@
GX_FVar_Head fvar_head;
FT_Bool usePsName;
FT_UInt num_instances;
+ FT_UShort* axis_flags;
static const FT_Frame_Field fvar_fields[] =
{
@@ -2038,14 +2042,16 @@
/* in fvar's table of named instances */
num_instances = face->root.style_flags >> 16;
- /* cannot overflow 32-bit arithmetic because of the size limits */
- /* used in the `fvar' table validity check in `sfnt_init_face' */
+ /* prepare storage area for MM data; this cannot overflow */
+ /* 32-bit arithmetic because of the size limits used in the */
+ /* `fvar' table validity check in `sfnt_init_face' */
face->blend->mmvar_len =
sizeof ( FT_MM_Var ) +
+ fvar_head.axisCount * sizeof ( FT_UShort ) +
fvar_head.axisCount * sizeof ( FT_Var_Axis ) +
num_instances * sizeof ( FT_Var_Named_Style ) +
num_instances * fvar_head.axisCount * sizeof ( FT_Fixed ) +
- 5 * fvar_head.axisCount;
+ fvar_head.axisCount * 5;
if ( FT_ALLOC( mmvar, face->blend->mmvar_len ) )
goto Exit;
@@ -2062,8 +2068,12 @@
/* (or tuples, as called by Apple) */
mmvar->num_namedstyles =
num_instances;
+
+ /* alas, no public field in `FT_Var_Axis' for axis flags */
+ axis_flags =
+ (FT_UShort*)&( mmvar[1] );
mmvar->axis =
- (FT_Var_Axis*)&( mmvar[1] );
+ (FT_Var_Axis*)&( axis_flags[fvar_head.axisCount] );
mmvar->namedstyle =
(FT_Var_Named_Style*)&( mmvar->axis[fvar_head.axisCount] );
@@ -2107,6 +2117,8 @@
a->name[3] = (FT_String)( ( a->tag ) & 0xFF );
a->name[4] = '\0';
+ *axis_flags = axis_rec.flags;
+
if ( a->minimum > a->def ||
a->def > a->maximum )
{
@@ -2118,13 +2130,17 @@
a->maximum = a->def;
}
- FT_TRACE5(( " \"%s\": minimum=%.5f, default=%.5f, maximum=%.5f\n",
+ FT_TRACE5(( " \"%s\":"
+ " minimum=%.5f, default=%.5f, maximum=%.5f,"
+ " flags=0x%04X\n",
a->name,
a->minimum / 65536.0,
a->def / 65536.0,
- a->maximum / 65536.0 ));
+ a->maximum / 65536.0,
+ *axis_flags ));
a++;
+ axis_flags++;
}
FT_TRACE5(( "\n" ));
@@ -2136,8 +2152,16 @@
goto Exit;
if ( fvar_head.instanceCount && !face->blend->avar_loaded )
+ {
+ FT_ULong offset = FT_STREAM_POS();
+
+
ft_var_load_avar( face );
+ if ( FT_STREAM_SEEK( offset ) )
+ goto Exit;
+ }
+
ns = mmvar->namedstyle;
nsc = face->blend->normalized_stylecoords;
for ( i = 0; i < fvar_head.instanceCount; i++, ns++ )
@@ -2154,8 +2178,11 @@
for ( j = 0; j < fvar_head.axisCount; j++, c++ )
*c = FT_GET_LONG();
+ /* valid psid values are 6, [256;32767], and 0xFFFF */
if ( usePsName )
ns->psid = FT_GET_USHORT();
+ else
+ ns->psid = 0xFFFF;
ft_var_to_normalized( face,
fvar_head.axisCount,
@@ -2171,7 +2198,7 @@
SFNT_Service sfnt = (SFNT_Service)face->sfnt;
FT_Int found, dummy1, dummy2;
- FT_UInt strid = 0xFFFFFFFFUL;
+ FT_UInt strid = ~0U;
/* the default instance is missing in array the */
@@ -2230,13 +2257,15 @@
goto Exit;
FT_MEM_COPY( mmvar, face->blend->mmvar, face->blend->mmvar_len );
+ axis_flags =
+ (FT_UShort*)&( mmvar[1] );
mmvar->axis =
- (FT_Var_Axis*)&( mmvar[1] );
+ (FT_Var_Axis*)&( axis_flags[mmvar->num_axis] );
mmvar->namedstyle =
(FT_Var_Named_Style*)&( mmvar->axis[mmvar->num_axis] );
+
next_coords =
(FT_Fixed*)&( mmvar->namedstyle[mmvar->num_namedstyles] );
-
for ( n = 0; n < mmvar->num_namedstyles; n++ )
{
mmvar->namedstyle[n].coords = next_coords;
@@ -2281,7 +2310,10 @@
GX_Blend blend;
FT_MM_Var* mmvar;
FT_UInt i, j;
- FT_Bool is_default_instance = 1;
+
+ FT_Bool is_default_instance = TRUE;
+ FT_Bool all_design_coords = FALSE;
+
FT_Memory memory = face->root.memory;
enum
@@ -2327,7 +2359,7 @@
}
if ( coords[i] != 0 )
- is_default_instance = 0;
+ is_default_instance = FALSE;
}
FT_TRACE5(( "\n" ));
@@ -2340,6 +2372,9 @@
{
if ( FT_NEW_ARRAY( blend->coords, mmvar->num_axis ) )
goto Exit;
+
+ /* the first time we have to compute all design coordinates */
+ all_design_coords = TRUE;
}
if ( !blend->normalizedcoords )
@@ -2388,7 +2423,7 @@
if ( set_design_coords )
ft_var_to_design( face,
- num_coords,
+ all_design_coords ? blend->num_axis : num_coords,
blend->normalizedcoords,
blend->coords );
@@ -2529,6 +2564,14 @@
blend = face->blend;
+ if ( !blend->coords )
+ {
+ /* select default instance coordinates */
+ /* if no instance is selected yet */
+ if ( FT_SET_ERROR( tt_set_mm_blend( face, 0, NULL, 1 ) ) )
+ return error;
+ }
+
nc = num_coords;
if ( num_coords > blend->num_axis )
{
@@ -2626,7 +2669,7 @@
num_coords * sizeof ( FT_Fixed ) );
a = mmvar->axis + num_coords;
- c = coords + num_coords;
+ c = blend->coords + num_coords;
for ( i = num_coords; i < mmvar->num_axis; i++, a++, c++ )
*c = a->def;
@@ -2636,7 +2679,7 @@
if ( !face->blend->avar_loaded )
ft_var_load_avar( face );
- ft_var_to_normalized( face, num_coords, coords, normalized );
+ ft_var_to_normalized( face, num_coords, blend->coords, normalized );
error = tt_set_mm_blend( face, mmvar->num_axis, normalized, 0 );
@@ -2686,6 +2729,14 @@
blend = face->blend;
+ if ( !blend->coords )
+ {
+ /* select default instance coordinates */
+ /* if no instance is selected yet */
+ if ( FT_SET_ERROR( tt_set_mm_blend( face, 0, NULL, 1 ) ) )
+ return error;
+ }
+
nc = num_coords;
if ( num_coords > blend->num_axis )
{
diff --git a/thirdparty/freetype/src/truetype/ttinterp.c b/thirdparty/freetype/src/truetype/ttinterp.c
index af31408cbf..ddcc839bb3 100644
--- a/thirdparty/freetype/src/truetype/ttinterp.c
+++ b/thirdparty/freetype/src/truetype/ttinterp.c
@@ -65,11 +65,15 @@
TT_INTERPRETER_VERSION_40 )
#endif
-#define PROJECT( v1, v2 ) \
- exc->func_project( exc, (v1)->x - (v2)->x, (v1)->y - (v2)->y )
+#define PROJECT( v1, v2 ) \
+ exc->func_project( exc, \
+ SUB_LONG( (v1)->x, (v2)->x ), \
+ SUB_LONG( (v1)->y, (v2)->y ) )
-#define DUALPROJ( v1, v2 ) \
- exc->func_dualproj( exc, (v1)->x - (v2)->x, (v1)->y - (v2)->y )
+#define DUALPROJ( v1, v2 ) \
+ exc->func_dualproj( exc, \
+ SUB_LONG( (v1)->x, (v2)->x ), \
+ SUB_LONG( (v1)->y, (v2)->y ) )
#define FAST_PROJECT( v ) \
exc->func_project( exc, (v)->x, (v)->y )
@@ -1676,7 +1680,10 @@
if ( SUBPIXEL_HINTING_INFINALITY &&
( !exc->ignore_x_mode ||
( exc->sph_tweak_flags & SPH_TWEAK_ALLOW_X_DMOVE ) ) )
- zone->cur[point].x += FT_MulDiv( distance, v, exc->F_dot_P );
+ zone->cur[point].x = ADD_LONG( zone->cur[point].x,
+ FT_MulDiv( distance,
+ v,
+ exc->F_dot_P ) );
else
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
@@ -1685,12 +1692,18 @@
/* diagonal moves, but only post-IUP. DejaVu tries to adjust */
/* diagonal stems like on `Z' and `z' post-IUP. */
if ( SUBPIXEL_HINTING_MINIMAL && !exc->backward_compatibility )
- zone->cur[point].x += FT_MulDiv( distance, v, exc->F_dot_P );
+ zone->cur[point].x = ADD_LONG( zone->cur[point].x,
+ FT_MulDiv( distance,
+ v,
+ exc->F_dot_P ) );
else
#endif
if ( NO_SUBPIXEL_HINTING )
- zone->cur[point].x += FT_MulDiv( distance, v, exc->F_dot_P );
+ zone->cur[point].x = ADD_LONG( zone->cur[point].x,
+ FT_MulDiv( distance,
+ v,
+ exc->F_dot_P ) );
zone->tags[point] |= FT_CURVE_TAG_TOUCH_X;
}
@@ -1705,7 +1718,10 @@
exc->iupx_called &&
exc->iupy_called ) )
#endif
- zone->cur[point].y += FT_MulDiv( distance, v, exc->F_dot_P );
+ zone->cur[point].y = ADD_LONG( zone->cur[point].y,
+ FT_MulDiv( distance,
+ v,
+ exc->F_dot_P ) );
zone->tags[point] |= FT_CURVE_TAG_TOUCH_Y;
}
@@ -1741,12 +1757,18 @@
v = exc->GS.freeVector.x;
if ( v != 0 )
- zone->org[point].x += FT_MulDiv( distance, v, exc->F_dot_P );
+ zone->org[point].x = ADD_LONG( zone->org[point].x,
+ FT_MulDiv( distance,
+ v,
+ exc->F_dot_P ) );
v = exc->GS.freeVector.y;
if ( v != 0 )
- zone->org[point].y += FT_MulDiv( distance, v, exc->F_dot_P );
+ zone->org[point].y = ADD_LONG( zone->org[point].y,
+ FT_MulDiv( distance,
+ v,
+ exc->F_dot_P ) );
}
@@ -1769,18 +1791,18 @@
{
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
if ( SUBPIXEL_HINTING_INFINALITY && !exc->ignore_x_mode )
- zone->cur[point].x += distance;
+ zone->cur[point].x = ADD_LONG( zone->cur[point].x, distance );
else
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
if ( SUBPIXEL_HINTING_MINIMAL && !exc->backward_compatibility )
- zone->cur[point].x += distance;
+ zone->cur[point].x = ADD_LONG( zone->cur[point].x, distance );
else
#endif
if ( NO_SUBPIXEL_HINTING )
- zone->cur[point].x += distance;
+ zone->cur[point].x = ADD_LONG( zone->cur[point].x, distance );
zone->tags[point] |= FT_CURVE_TAG_TOUCH_X;
}
@@ -1799,7 +1821,7 @@
exc->backward_compatibility &&
exc->iupx_called && exc->iupy_called ) )
#endif
- zone->cur[point].y += distance;
+ zone->cur[point].y = ADD_LONG( zone->cur[point].y, distance );
zone->tags[point] |= FT_CURVE_TAG_TOUCH_Y;
}
@@ -1823,7 +1845,7 @@
{
FT_UNUSED( exc );
- zone->org[point].x += distance;
+ zone->org[point].x = ADD_LONG( zone->org[point].x, distance );
}
@@ -1835,7 +1857,7 @@
{
FT_UNUSED( exc );
- zone->org[point].y += distance;
+ zone->org[point].y = ADD_LONG( zone->org[point].y, distance );
}
@@ -1873,13 +1895,13 @@
if ( distance >= 0 )
{
- val = distance + compensation;
+ val = ADD_LONG( distance, compensation );
if ( val < 0 )
val = 0;
}
else
{
- val = distance - compensation;
+ val = SUB_LONG( distance, compensation );
if ( val > 0 )
val = 0;
}
@@ -1915,13 +1937,14 @@
if ( distance >= 0 )
{
- val = FT_PIX_ROUND( distance + compensation );
+ val = FT_PIX_ROUND_LONG( ADD_LONG( distance, compensation ) );
if ( val < 0 )
val = 0;
}
else
{
- val = -FT_PIX_ROUND( compensation - distance );
+ val = NEG_LONG( FT_PIX_ROUND_LONG( SUB_LONG( compensation,
+ distance ) ) );
if ( val > 0 )
val = 0;
}
@@ -1958,13 +1981,16 @@
if ( distance >= 0 )
{
- val = FT_PIX_FLOOR( distance + compensation ) + 32;
+ val = ADD_LONG( FT_PIX_FLOOR( ADD_LONG( distance, compensation ) ),
+ 32 );
if ( val < 0 )
val = 32;
}
else
{
- val = -( FT_PIX_FLOOR( compensation - distance ) + 32 );
+ val = NEG_LONG( ADD_LONG( FT_PIX_FLOOR( SUB_LONG( compensation,
+ distance ) ),
+ 32 ) );
if ( val > 0 )
val = -32;
}
@@ -2001,13 +2027,13 @@
if ( distance >= 0 )
{
- val = FT_PIX_FLOOR( distance + compensation );
+ val = FT_PIX_FLOOR( ADD_LONG( distance, compensation ) );
if ( val < 0 )
val = 0;
}
else
{
- val = -FT_PIX_FLOOR( compensation - distance );
+ val = NEG_LONG( FT_PIX_FLOOR( SUB_LONG( compensation, distance ) ) );
if ( val > 0 )
val = 0;
}
@@ -2044,13 +2070,14 @@
if ( distance >= 0 )
{
- val = FT_PIX_CEIL( distance + compensation );
+ val = FT_PIX_CEIL_LONG( ADD_LONG( distance, compensation ) );
if ( val < 0 )
val = 0;
}
else
{
- val = -FT_PIX_CEIL( compensation - distance );
+ val = NEG_LONG( FT_PIX_CEIL_LONG( SUB_LONG( compensation,
+ distance ) ) );
if ( val > 0 )
val = 0;
}
@@ -2087,13 +2114,14 @@
if ( distance >= 0 )
{
- val = FT_PAD_ROUND( distance + compensation, 32 );
+ val = FT_PAD_ROUND_LONG( ADD_LONG( distance, compensation ), 32 );
if ( val < 0 )
val = 0;
}
else
{
- val = -FT_PAD_ROUND( compensation - distance, 32 );
+ val = NEG_LONG( FT_PAD_ROUND_LONG( SUB_LONG( compensation, distance ),
+ 32 ) );
if ( val > 0 )
val = 0;
}
@@ -2134,7 +2162,8 @@
if ( distance >= 0 )
{
- val = ( distance - exc->phase + exc->threshold + compensation ) &
+ val = ADD_LONG( distance,
+ exc->threshold - exc->phase + compensation ) &
-exc->period;
val += exc->phase;
if ( val < 0 )
@@ -2142,8 +2171,9 @@
}
else
{
- val = -( ( exc->threshold - exc->phase - distance + compensation ) &
- -exc->period );
+ val = NEG_LONG( SUB_LONG( exc->threshold - exc->phase + compensation,
+ distance ) &
+ -exc->period );
val -= exc->phase;
if ( val > 0 )
val = -exc->phase;
@@ -2183,7 +2213,8 @@
if ( distance >= 0 )
{
- val = ( ( distance - exc->phase + exc->threshold + compensation ) /
+ val = ( ADD_LONG( distance,
+ exc->threshold - exc->phase + compensation ) /
exc->period ) * exc->period;
val += exc->phase;
if ( val < 0 )
@@ -2191,8 +2222,9 @@
}
else
{
- val = -( ( ( exc->threshold - exc->phase - distance + compensation ) /
- exc->period ) * exc->period );
+ val = NEG_LONG( ( SUB_LONG( exc->threshold - exc->phase + compensation,
+ distance ) /
+ exc->period ) * exc->period );
val -= exc->phase;
if ( val > 0 )
val = -exc->phase;
@@ -2826,7 +2858,7 @@
static void
Ins_ADD( FT_Long* args )
{
- args[0] += args[1];
+ args[0] = ADD_LONG( args[0], args[1] );
}
@@ -2839,7 +2871,7 @@
static void
Ins_SUB( FT_Long* args )
{
- args[0] -= args[1];
+ args[0] = SUB_LONG( args[0], args[1] );
}
@@ -2882,7 +2914,8 @@
static void
Ins_ABS( FT_Long* args )
{
- args[0] = FT_ABS( args[0] );
+ if ( args[0] < 0 )
+ args[0] = NEG_LONG( args[0] );
}
@@ -2895,7 +2928,7 @@
static void
Ins_NEG( FT_Long* args )
{
- args[0] = -args[0];
+ args[0] = NEG_LONG( args[0] );
}
@@ -4211,8 +4244,8 @@
p1 = exc->zp1.cur + aIdx2;
p2 = exc->zp2.cur + aIdx1;
- A = p1->x - p2->x;
- B = p1->y - p2->y;
+ A = SUB_LONG( p1->x, p2->x );
+ B = SUB_LONG( p1->y, p2->y );
/* If p1 == p2, SPvTL and SFvTL behave the same as */
/* SPvTCA[X] and SFvTCA[X], respectively. */
@@ -4227,9 +4260,9 @@
if ( ( opcode & 1 ) != 0 )
{
- C = B; /* counter clockwise rotation */
- B = A;
- A = -C;
+ C = B; /* counter clockwise rotation */
+ B = A;
+ A = NEG_LONG( C );
}
Normalize( A, B, Vec );
@@ -4770,7 +4803,7 @@
K = FAST_PROJECT( &exc->zp2.cur[L] );
- exc->func_move( exc, &exc->zp2, L, args[1] - K );
+ exc->func_move( exc, &exc->zp2, L, SUB_LONG( args[1], K ) );
/* UNDOCUMENTED! The MS rasterizer does that with */
/* twilight points (confirmed by Greg Hitchcock) */
@@ -4894,12 +4927,12 @@
}
{
- FT_Vector* v1 = exc->zp1.org + p2;
- FT_Vector* v2 = exc->zp2.org + p1;
+ FT_Vector* v1 = exc->zp1.org + p2;
+ FT_Vector* v2 = exc->zp2.org + p1;
- A = v1->x - v2->x;
- B = v1->y - v2->y;
+ A = SUB_LONG( v1->x, v2->x );
+ B = SUB_LONG( v1->y, v2->y );
/* If v1 == v2, SDPvTL behaves the same as */
/* SVTCA[X], respectively. */
@@ -4915,9 +4948,9 @@
if ( ( opcode & 1 ) != 0 )
{
- C = B; /* counter clockwise rotation */
- B = A;
- A = -C;
+ C = B; /* counter clockwise rotation */
+ B = A;
+ A = NEG_LONG( C );
}
Normalize( A, B, &exc->GS.dualVector );
@@ -4927,8 +4960,8 @@
FT_Vector* v2 = exc->zp2.cur + p1;
- A = v1->x - v2->x;
- B = v1->y - v2->y;
+ A = SUB_LONG( v1->x, v2->x );
+ B = SUB_LONG( v1->y, v2->y );
if ( A == 0 && B == 0 )
{
@@ -4939,9 +4972,9 @@
if ( ( opcode & 1 ) != 0 )
{
- C = B; /* counter clockwise rotation */
- B = A;
- A = -C;
+ C = B; /* counter clockwise rotation */
+ B = A;
+ A = NEG_LONG( C );
}
Normalize( A, B, &exc->GS.projVector );
@@ -5392,7 +5425,7 @@
if ( !( SUBPIXEL_HINTING_MINIMAL &&
exc->backward_compatibility ) )
#endif
- exc->zp2.cur[point].x += dx;
+ exc->zp2.cur[point].x = ADD_LONG( exc->zp2.cur[point].x, dx );
if ( touch )
exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_X;
@@ -5406,7 +5439,7 @@
exc->iupx_called &&
exc->iupy_called ) )
#endif
- exc->zp2.cur[point].y += dy;
+ exc->zp2.cur[point].y = ADD_LONG( exc->zp2.cur[point].y, dy );
if ( touch )
exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_Y;
@@ -5781,14 +5814,17 @@
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
/* subpixel hinting - make MSIRP respect CVT cut-in; */
- if ( SUBPIXEL_HINTING_INFINALITY &&
- exc->ignore_x_mode &&
- exc->GS.freeVector.x != 0 &&
- FT_ABS( distance - args[1] ) >= control_value_cutin )
+ if ( SUBPIXEL_HINTING_INFINALITY &&
+ exc->ignore_x_mode &&
+ exc->GS.freeVector.x != 0 &&
+ FT_ABS( SUB_LONG( distance, args[1] ) ) >= control_value_cutin )
distance = args[1];
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
- exc->func_move( exc, &exc->zp1, point, args[1] - distance );
+ exc->func_move( exc,
+ &exc->zp1,
+ point,
+ SUB_LONG( args[1], distance ) );
exc->GS.rp1 = exc->GS.rp0;
exc->GS.rp2 = point;
@@ -6027,8 +6063,10 @@
FT_Vector vec;
- vec.x = FT_MulFix( vec1->x - vec2->x, exc->metrics.x_scale );
- vec.y = FT_MulFix( vec1->y - vec2->y, exc->metrics.y_scale );
+ vec.x = FT_MulFix( SUB_LONG( vec1->x, vec2->x ),
+ exc->metrics.x_scale );
+ vec.y = FT_MulFix( SUB_LONG( vec1->y, vec2->y ),
+ exc->metrics.y_scale );
org_dist = FAST_DUALPROJ( &vec );
}
@@ -6081,8 +6119,8 @@
}
else
{
- if ( distance > -minimum_distance )
- distance = -minimum_distance;
+ if ( distance > NEG_LONG( minimum_distance ) )
+ distance = NEG_LONG( minimum_distance );
}
}
@@ -6090,7 +6128,7 @@
org_dist = PROJECT( exc->zp1.cur + point, exc->zp0.cur + exc->GS.rp0 );
- exc->func_move( exc, &exc->zp1, point, distance - org_dist );
+ exc->func_move( exc, &exc->zp1, point, SUB_LONG( distance, org_dist ) );
Fail:
exc->GS.rp1 = exc->GS.rp0;
@@ -6265,8 +6303,8 @@
}
else
{
- if ( distance > -minimum_distance )
- distance = -minimum_distance;
+ if ( distance > NEG_LONG( minimum_distance ) )
+ distance = NEG_LONG( minimum_distance );
}
}
@@ -6290,7 +6328,10 @@
}
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
- exc->func_move( exc, &exc->zp1, point, distance - cur_dist );
+ exc->func_move( exc,
+ &exc->zp1,
+ point,
+ SUB_LONG( distance, cur_dist ) );
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
if ( SUBPIXEL_HINTING_INFINALITY )
@@ -6314,7 +6355,10 @@
}
if ( reverse_move )
- exc->func_move( exc, &exc->zp1, point, -( distance - cur_dist ) );
+ exc->func_move( exc,
+ &exc->zp1,
+ point,
+ SUB_LONG( cur_dist, distance ) );
}
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
@@ -6380,7 +6424,7 @@
distance = PROJECT( exc->zp1.cur + point,
exc->zp0.cur + exc->GS.rp0 );
- exc->func_move( exc, &exc->zp1, point, -distance );
+ exc->func_move( exc, &exc->zp1, point, NEG_LONG( distance ) );
}
exc->GS.loop--;
@@ -6437,19 +6481,19 @@
/* Cramer's rule */
- dbx = exc->zp0.cur[b1].x - exc->zp0.cur[b0].x;
- dby = exc->zp0.cur[b1].y - exc->zp0.cur[b0].y;
+ dbx = SUB_LONG( exc->zp0.cur[b1].x, exc->zp0.cur[b0].x );
+ dby = SUB_LONG( exc->zp0.cur[b1].y, exc->zp0.cur[b0].y );
- dax = exc->zp1.cur[a1].x - exc->zp1.cur[a0].x;
- day = exc->zp1.cur[a1].y - exc->zp1.cur[a0].y;
+ dax = SUB_LONG( exc->zp1.cur[a1].x, exc->zp1.cur[a0].x );
+ day = SUB_LONG( exc->zp1.cur[a1].y, exc->zp1.cur[a0].y );
- dx = exc->zp0.cur[b0].x - exc->zp1.cur[a0].x;
- dy = exc->zp0.cur[b0].y - exc->zp1.cur[a0].y;
+ dx = SUB_LONG( exc->zp0.cur[b0].x, exc->zp1.cur[a0].x );
+ dy = SUB_LONG( exc->zp0.cur[b0].y, exc->zp1.cur[a0].y );
- discriminant = FT_MulDiv( dax, -dby, 0x40 ) +
- FT_MulDiv( day, dbx, 0x40 );
- dotproduct = FT_MulDiv( dax, dbx, 0x40 ) +
- FT_MulDiv( day, dby, 0x40 );
+ discriminant = ADD_LONG( FT_MulDiv( dax, NEG_LONG( dby ), 0x40 ),
+ FT_MulDiv( day, dbx, 0x40 ) );
+ dotproduct = ADD_LONG( FT_MulDiv( dax, dbx, 0x40 ),
+ FT_MulDiv( day, dby, 0x40 ) );
/* The discriminant above is actually a cross product of vectors */
/* da and db. Together with the dot product, they can be used as */
@@ -6459,30 +6503,29 @@
/* discriminant = |da||db|sin(angle) . */
/* We use these equations to reject grazing intersections by */
/* thresholding abs(tan(angle)) at 1/19, corresponding to 3 degrees. */
- if ( 19 * FT_ABS( discriminant ) > FT_ABS( dotproduct ) )
+ if ( MUL_LONG( 19, FT_ABS( discriminant ) ) > FT_ABS( dotproduct ) )
{
- val = FT_MulDiv( dx, -dby, 0x40 ) + FT_MulDiv( dy, dbx, 0x40 );
+ val = ADD_LONG( FT_MulDiv( dx, NEG_LONG( dby ), 0x40 ),
+ FT_MulDiv( dy, dbx, 0x40 ) );
R.x = FT_MulDiv( val, dax, discriminant );
R.y = FT_MulDiv( val, day, discriminant );
/* XXX: Block in backward_compatibility and/or post-IUP? */
- exc->zp2.cur[point].x = exc->zp1.cur[a0].x + R.x;
- exc->zp2.cur[point].y = exc->zp1.cur[a0].y + R.y;
+ exc->zp2.cur[point].x = ADD_LONG( exc->zp1.cur[a0].x, R.x );
+ exc->zp2.cur[point].y = ADD_LONG( exc->zp1.cur[a0].y, R.y );
}
else
{
/* else, take the middle of the middles of A and B */
/* XXX: Block in backward_compatibility and/or post-IUP? */
- exc->zp2.cur[point].x = ( exc->zp1.cur[a0].x +
- exc->zp1.cur[a1].x +
- exc->zp0.cur[b0].x +
- exc->zp0.cur[b1].x ) / 4;
- exc->zp2.cur[point].y = ( exc->zp1.cur[a0].y +
- exc->zp1.cur[a1].y +
- exc->zp0.cur[b0].y +
- exc->zp0.cur[b1].y ) / 4;
+ exc->zp2.cur[point].x =
+ ADD_LONG( ADD_LONG( exc->zp1.cur[a0].x, exc->zp1.cur[a1].x ),
+ ADD_LONG( exc->zp0.cur[b0].x, exc->zp0.cur[b1].x ) ) / 4;
+ exc->zp2.cur[point].y =
+ ADD_LONG( ADD_LONG( exc->zp1.cur[a0].y, exc->zp1.cur[a1].y ),
+ ADD_LONG( exc->zp0.cur[b0].y, exc->zp0.cur[b1].y ) ) / 4;
}
exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_BOTH;
@@ -6517,7 +6560,7 @@
distance = PROJECT( exc->zp0.cur + p2, exc->zp1.cur + p1 ) / 2;
exc->func_move( exc, &exc->zp1, p1, distance );
- exc->func_move( exc, &exc->zp0, p2, -distance );
+ exc->func_move( exc, &exc->zp0, p2, NEG_LONG( distance ) );
}
@@ -6590,9 +6633,11 @@
FT_Vector vec;
- vec.x = FT_MulFix( exc->zp1.orus[exc->GS.rp2].x - orus_base->x,
+ vec.x = FT_MulFix( SUB_LONG( exc->zp1.orus[exc->GS.rp2].x,
+ orus_base->x ),
exc->metrics.x_scale );
- vec.y = FT_MulFix( exc->zp1.orus[exc->GS.rp2].y - orus_base->y,
+ vec.y = FT_MulFix( SUB_LONG( exc->zp1.orus[exc->GS.rp2].y,
+ orus_base->y ),
exc->metrics.y_scale );
old_range = FAST_DUALPROJ( &vec );
@@ -6627,9 +6672,11 @@
FT_Vector vec;
- vec.x = FT_MulFix( exc->zp2.orus[point].x - orus_base->x,
+ vec.x = FT_MulFix( SUB_LONG( exc->zp2.orus[point].x,
+ orus_base->x ),
exc->metrics.x_scale );
- vec.y = FT_MulFix( exc->zp2.orus[point].y - orus_base->y,
+ vec.y = FT_MulFix( SUB_LONG( exc->zp2.orus[point].y,
+ orus_base->y ),
exc->metrics.y_scale );
org_dist = FAST_DUALPROJ( &vec );
@@ -6668,7 +6715,7 @@
exc->func_move( exc,
&exc->zp2,
(FT_UShort)point,
- new_dist - cur_dist );
+ SUB_LONG( new_dist, cur_dist ) );
}
Fail:
@@ -6733,14 +6780,14 @@
FT_F26Dot6 dx;
- dx = worker->curs[p].x - worker->orgs[p].x;
+ dx = SUB_LONG( worker->curs[p].x, worker->orgs[p].x );
if ( dx != 0 )
{
for ( i = p1; i < p; i++ )
- worker->curs[i].x += dx;
+ worker->curs[i].x = ADD_LONG( worker->curs[i].x, dx );
for ( i = p + 1; i <= p2; i++ )
- worker->curs[i].x += dx;
+ worker->curs[i].x = ADD_LONG( worker->curs[i].x, dx );
}
}
@@ -6785,8 +6832,8 @@
org2 = worker->orgs[ref2].x;
cur1 = worker->curs[ref1].x;
cur2 = worker->curs[ref2].x;
- delta1 = cur1 - org1;
- delta2 = cur2 - org2;
+ delta1 = SUB_LONG( cur1, org1 );
+ delta2 = SUB_LONG( cur2, org2 );
if ( cur1 == cur2 || orus1 == orus2 )
{
@@ -6798,10 +6845,10 @@
if ( x <= org1 )
- x += delta1;
+ x = ADD_LONG( x, delta1 );
else if ( x >= org2 )
- x += delta2;
+ x = ADD_LONG( x, delta2 );
else
x = cur1;
@@ -6822,20 +6869,23 @@
if ( x <= org1 )
- x += delta1;
+ x = ADD_LONG( x, delta1 );
else if ( x >= org2 )
- x += delta2;
+ x = ADD_LONG( x, delta2 );
else
{
if ( !scale_valid )
{
scale_valid = 1;
- scale = FT_DivFix( cur2 - cur1, orus2 - orus1 );
+ scale = FT_DivFix( SUB_LONG( cur2, cur1 ),
+ SUB_LONG( orus2, orus1 ) );
}
- x = cur1 + FT_MulFix( worker->orus[i].x - orus1, scale );
+ x = ADD_LONG( cur1,
+ FT_MulFix( SUB_LONG( worker->orus[i].x, orus1 ),
+ scale ) );
}
worker->curs[i].x = x;
}
@@ -7310,7 +7360,11 @@
K |= 1 << 12;
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
- if ( SUBPIXEL_HINTING_MINIMAL )
+ /* Toggle the following flags only outside of monochrome mode. */
+ /* Otherwise, instructions may behave weirdly and rendering results */
+ /* may differ between v35 and v40 mode, e.g., in `Times New Roman */
+ /* Bold Italic'. */
+ if ( SUBPIXEL_HINTING_MINIMAL && exc->subpixel_hinting_lean )
{
/********************************/
/* HINTING FOR SUBPIXEL */
@@ -7345,7 +7399,7 @@
/* */
/* The only smoothing method FreeType supports unless someone sets */
/* FT_LOAD_TARGET_MONO. */
- if ( ( args[0] & 2048 ) != 0 )
+ if ( ( args[0] & 2048 ) != 0 && exc->subpixel_hinting_lean )
K |= 1 << 18;
/********************************/
@@ -7589,11 +7643,21 @@
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
- /* Toggle backward compatibility according to what font says, except */
- /* when it's a `tricky' font that heavily relies on the interpreter to */
- /* render glyphs correctly, e.g. DFKai-SB. Backward compatibility */
- /* hacks may break it. */
+ /*
+ * Toggle backward compatibility according to what font wants, except
+ * when
+ *
+ * 1) we have a `tricky' font that heavily relies on the interpreter to
+ * render glyphs correctly, for example DFKai-SB, or
+ * 2) FT_RENDER_MODE_MONO (i.e, monochome rendering) is requested.
+ *
+ * In those cases, backward compatibility needs to be turned off to get
+ * correct rendering. The rendering is then completely up to the
+ * font's programming.
+ *
+ */
if ( SUBPIXEL_HINTING_MINIMAL &&
+ exc->subpixel_hinting_lean &&
!FT_IS_TRICKY( &exc->face->root ) )
exc->backward_compatibility = !( exc->GS.instruct_control & 4 );
else
@@ -7639,8 +7703,7 @@
FT_MAX( 50,
exc->cvtSize / 10 );
else
- exc->loopcall_counter_max = FT_MAX( 100,
- 10 * exc->cvtSize );
+ exc->loopcall_counter_max = 300 + 8 * exc->cvtSize;
/* as a protection against an unreasonable number of CVT entries */
/* we assume at most 100 control values per glyph for the counter */
diff --git a/thirdparty/freetype/src/truetype/ttinterp.h b/thirdparty/freetype/src/truetype/ttinterp.h
index 55e472091c..abbecfcee3 100644
--- a/thirdparty/freetype/src/truetype/ttinterp.h
+++ b/thirdparty/freetype/src/truetype/ttinterp.h
@@ -253,23 +253,38 @@ FT_BEGIN_HEADER
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
/*
- * Modern TrueType fonts are usually rendered through Microsoft's
- * collection of rendering techniques called ClearType (e.g., subpixel
- * rendering and subpixel hinting). When ClearType was introduced, most
- * fonts were not ready. Microsoft decided to implement a backward
- * compatibility mode that employed several simple to complicated
- * assumptions and tricks that modified the interpretation of the
- * bytecode contained in these fonts to make them look ClearType-y
- * somehow. Most (web)fonts that were released since then have come to
- * rely on these hacks to render correctly, even some of Microsoft's
- * flagship ClearType fonts (Calibri, Cambria, Segoe UI).
+ * FreeType supports ClearType-like hinting of TrueType fonts through
+ * the version 40 interpreter. This is achieved through several hacks
+ * in the base (v35) interpreter, as detailed below.
*
- * The minimal subpixel hinting code (interpreter version 40) employs a
- * small list of font-agnostic hacks to bludgeon non-native-ClearType
- * fonts (except tricky ones[1]) into submission. It will not try to
- * toggle hacks for specific fonts for performance and complexity
- * reasons. The focus is on modern (web)fonts rather than legacy fonts
- * that were made for black-and-white rendering.
+ * ClearType is an umbrella term for several rendering techniques
+ * employed by Microsoft's various GUI and rendering toolkit
+ * implementations, most importantly: subpixel rendering for using the
+ * RGB subpixels of LCDs to approximately triple the perceived
+ * resolution on the x-axis and subpixel hinting for positioning stems
+ * on subpixel borders. TrueType programming is explicit, i.e., fonts
+ * must be programmed to take advantage of ClearType's possibilities.
+ *
+ * When ClearType was introduced, it seemed unlikely that all fonts
+ * would be reprogrammed, so Microsoft decided to implement a backward
+ * compatibility mode. It employs several simple to complicated
+ * assumptions and tricks, many of them font-dependent, that modify the
+ * interpretation of the bytecode contained in these fonts to retrofit
+ * them into a ClearType-y look. The quality of the results varies.
+ * Most (web)fonts that were released since then have come to rely on
+ * these hacks to render correctly, even some of Microsoft's flagship
+ * fonts (e.g., Calibri, Cambria, Segoe UI).
+ *
+ * FreeType's minimal subpixel hinting code (interpreter version 40)
+ * employs a small list of font-agnostic hacks loosely based on the
+ * public information available on Microsoft's compatibility mode[2].
+ * The focus is on modern (web)fonts rather than legacy fonts that were
+ * made for monochrome rendering. It will not match ClearType rendering
+ * exactly. Unlike the `Infinality' code (interpreter version 38) that
+ * came before, it will not try to toggle hacks for specific fonts for
+ * performance and complexity reasons. It will fall back to version 35
+ * behavior for tricky fonts[1] or when monochrome rendering is
+ * requested.
*
* Major hacks
*
@@ -347,7 +362,8 @@ FT_BEGIN_HEADER
*
*/
- /* Using v40 implies subpixel hinting. Used to detect interpreter */
+ /* Using v40 implies subpixel hinting, unless FT_RENDER_MODE_MONO has been
+ * requested. Used to detect interpreter */
/* version switches. `_lean' to differentiate from the Infinality */
/* `subpixel_hinting', which is managed differently. */
FT_Bool subpixel_hinting_lean;
diff --git a/thirdparty/freetype/src/truetype/ttobjs.c b/thirdparty/freetype/src/truetype/ttobjs.c
index 4db0f289f8..081fa2f1a5 100644
--- a/thirdparty/freetype/src/truetype/ttobjs.c
+++ b/thirdparty/freetype/src/truetype/ttobjs.c
@@ -576,9 +576,11 @@
/* We must also be able to accept Mac/GX fonts, as well as OT ones. */
/* The 0x00020000 tag is completely undocumented; some fonts from */
/* Arphic made for Chinese Windows 3.1 have this. */
- if ( face->format_tag != 0x00010000L && /* MS fonts */
- face->format_tag != 0x00020000L && /* CJK fonts for Win 3.1 */
- face->format_tag != TTAG_true ) /* Mac fonts */
+ if ( face->format_tag != 0x00010000L && /* MS fonts */
+ face->format_tag != 0x00020000L && /* CJK fonts for Win 3.1 */
+ face->format_tag != TTAG_true && /* Mac fonts */
+ face->format_tag != TTAG_0xA5kbd && /* `Keyboard.dfont' (legacy Mac OS X) */
+ face->format_tag != TTAG_0xA5lst ) /* `LastResort.dfont' (legacy Mac OS X) */
{
FT_TRACE2(( " not a TTF font\n" ));
goto Bad_Format;
@@ -1230,7 +1232,9 @@
/* <Input> */
/* size :: A handle to the target size object. */
/* */
- /* only_height :: Only recompute ascender, descender, and height. */
+ /* only_height :: Only recompute ascender, descender, and height; */
+ /* this flag is used for variation fonts where */
+ /* `tt_size_reset' is used as an iterator function. */
/* */
FT_LOCAL_DEF( FT_Error )
tt_size_reset( TT_Size size,
@@ -1277,7 +1281,11 @@
size->ttmetrics.valid = TRUE;
if ( only_height )
+ {
+ /* we must not recompute the scaling values here since */
+ /* `tt_size_reset' was already called (with only_height = 0) */
return FT_Err_Ok;
+ }
if ( face->header.Flags & 8 )
{
diff --git a/thirdparty/freetype/src/truetype/ttpload.c b/thirdparty/freetype/src/truetype/ttpload.c
index 70ac15da4a..bcf6b34f67 100644
--- a/thirdparty/freetype/src/truetype/ttpload.c
+++ b/thirdparty/freetype/src/truetype/ttpload.c
@@ -247,13 +247,13 @@
if ( pos2 > face->glyf_len )
{
/* We try to sanitize the last `loca' entry. */
- if ( gindex == face->num_locations - 1 )
+ if ( gindex == face->num_locations - 2 )
{
FT_TRACE1(( "tt_face_get_location:"
- " too large offset (0x%08lx) found for glyph index %ld,\n"
+ " too large size (%ld bytes) found for glyph index %ld,\n"
" "
- " truncating at the end of `glyf' table (0x%08lx)\n",
- pos2, gindex + 1, face->glyf_len ));
+ " truncating at the end of `glyf' table to %ld bytes\n",
+ pos2 - pos1, gindex, face->glyf_len - pos1 ));
pos2 = face->glyf_len;
}
else
diff --git a/thirdparty/freetype/src/type1/t1load.c b/thirdparty/freetype/src/type1/t1load.c
index f5c661f7de..f569d6bec3 100644
--- a/thirdparty/freetype/src/type1/t1load.c
+++ b/thirdparty/freetype/src/type1/t1load.c
@@ -329,8 +329,8 @@
for ( i = 0; i < mmaster.num_axis; i++ )
{
mmvar->axis[i].name = mmaster.axis[i].name;
- mmvar->axis[i].minimum = INT_TO_FIXED( mmaster.axis[i].minimum);
- mmvar->axis[i].maximum = INT_TO_FIXED( mmaster.axis[i].maximum);
+ mmvar->axis[i].minimum = INT_TO_FIXED( mmaster.axis[i].minimum );
+ mmvar->axis[i].maximum = INT_TO_FIXED( mmaster.axis[i].maximum );
mmvar->axis[i].def = ( mmvar->axis[i].minimum +
mmvar->axis[i].maximum ) / 2;
/* Does not apply. But this value is in range */
diff --git a/thirdparty/freetype/src/type1/t1objs.c b/thirdparty/freetype/src/type1/t1objs.c
index 97c16b0fdf..5ac1292ae0 100644
--- a/thirdparty/freetype/src/type1/t1objs.c
+++ b/thirdparty/freetype/src/type1/t1objs.c
@@ -555,12 +555,6 @@
if ( clazz )
error = FT_CMap_New( clazz, NULL, &charmap, NULL );
-
-#if 0
- /* Select default charmap */
- if (root->num_charmaps)
- root->charmap = root->charmaps[0];
-#endif
}
}
diff --git a/thirdparty/freetype/src/type42/t42objs.c b/thirdparty/freetype/src/type42/t42objs.c
index 87e5206b7f..1c4ebd768a 100644
--- a/thirdparty/freetype/src/type42/t42objs.c
+++ b/thirdparty/freetype/src/type42/t42objs.c
@@ -394,12 +394,6 @@
if ( clazz )
error = FT_CMap_New( clazz, NULL, &charmap, NULL );
-
-#if 0
- /* Select default charmap */
- if ( root->num_charmaps )
- root->charmap = root->charmaps[0];
-#endif
}
}
Exit:
diff --git a/thirdparty/freetype/src/winfonts/winfnt.c b/thirdparty/freetype/src/winfonts/winfnt.c
index 9811fbb05a..4c47962319 100644
--- a/thirdparty/freetype/src/winfonts/winfnt.c
+++ b/thirdparty/freetype/src/winfonts/winfnt.c
@@ -859,10 +859,6 @@
NULL );
if ( error )
goto Fail;
-
- /* Select default charmap */
- if ( root->num_charmaps )
- root->charmap = root->charmaps[0];
}
/* set up remaining flags */
@@ -1095,7 +1091,7 @@
/* note: since glyphs are stored in columns and not in rows we */
/* can't use ft_glyphslot_set_bitmap */
- if ( FT_ALLOC_MULT( bitmap->buffer, pitch, bitmap->rows ) )
+ if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, pitch ) )
goto Exit;
column = (FT_Byte*)bitmap->buffer;
diff --git a/thirdparty/zstd/SCsub b/thirdparty/zstd/SCsub
new file mode 100644
index 0000000000..e8be1aaf44
--- /dev/null
+++ b/thirdparty/zstd/SCsub
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+Import('env')
+
+thirdparty_zstd_dir = "#thirdparty/zstd/"
+thirdparty_zstd_sources = [
+ "common/entropy_common.c",
+ "common/error_private.c",
+ "common/fse_decompress.c",
+ "common/pool.c",
+ "common/threading.c",
+ "common/xxhash.c",
+ "common/zstd_common.c",
+ "compress/fse_compress.c",
+ "compress/huf_compress.c",
+ "compress/zstd_compress.c",
+ "compress/zstdmt_compress.c",
+ "decompress/huf_decompress.c",
+ "decompress/zstd_decompress.c",
+]
+thirdparty_zstd_sources = [thirdparty_zstd_dir + file for file in thirdparty_zstd_sources]
+env.add_source_files(env.core_sources, thirdparty_zstd_sources)
+env.Append(CPPPATH=["#thirdparty/zstd", "#thirdparty/zstd/common"])