summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--COPYRIGHT.txt8
-rw-r--r--SConstruct14
-rw-r--r--core/bind/core_bind.cpp110
-rw-r--r--core/bind/core_bind.h59
-rw-r--r--core/color.cpp127
-rw-r--r--core/color.h17
-rw-r--r--core/hash_map.h33
-rw-r--r--core/hashfuncs.h34
-rw-r--r--core/io/file_access_buffered.cpp2
-rw-r--r--core/io/file_access_buffered.h2
-rw-r--r--core/io/file_access_compressed.cpp4
-rw-r--r--core/io/file_access_compressed.h2
-rw-r--r--core/io/file_access_encrypted.cpp4
-rw-r--r--core/io/file_access_encrypted.h2
-rw-r--r--core/io/file_access_memory.cpp2
-rw-r--r--core/io/file_access_memory.h2
-rw-r--r--core/io/file_access_network.cpp2
-rw-r--r--core/io/file_access_network.h2
-rw-r--r--core/io/file_access_pack.cpp8
-rw-r--r--core/io/file_access_pack.h2
-rw-r--r--core/io/file_access_zip.cpp6
-rw-r--r--core/io/file_access_zip.h2
-rw-r--r--core/io/pck_packer.cpp8
-rw-r--r--core/io/resource_format_binary.cpp8
-rw-r--r--core/io/resource_import.cpp29
-rw-r--r--core/io/resource_import.h7
-rw-r--r--core/io/resource_loader.cpp25
-rw-r--r--core/io/resource_loader.h2
-rw-r--r--core/io/stream_peer.cpp6
-rw-r--r--core/io/stream_peer.h2
-rw-r--r--core/io/xml_parser.cpp2
-rw-r--r--core/io/zip_io.h4
-rw-r--r--core/math/a_star.cpp12
-rw-r--r--core/math/a_star.h4
-rw-r--r--core/math/camera_matrix.cpp2
-rw-r--r--core/math/math_funcs.h40
-rw-r--r--core/oa_hash_map.h593
-rw-r--r--core/object.cpp12
-rw-r--r--core/object.h5
-rw-r--r--core/os/dir_access.cpp9
-rw-r--r--core/os/dir_access.h2
-rw-r--r--core/os/file_access.h4
-rw-r--r--core/os/input.cpp2
-rw-r--r--core/os/input.h2
-rw-r--r--core/os/input_event.cpp2
-rw-r--r--core/os/os.h2
-rw-r--r--core/project_settings.cpp6
-rw-r--r--core/register_core_types.cpp6
-rw-r--r--core/set.h245
-rw-r--r--core/undo_redo.cpp4
-rw-r--r--core/variant.cpp161
-rw-r--r--core/variant.h6
-rw-r--r--core/variant_call.cpp20
-rw-r--r--core/variant_op.cpp1787
-rw-r--r--doc/classes/@GDScript.xml379
-rw-r--r--doc/classes/@Global Scope.xml2
-rw-r--r--doc/classes/AStar.xml16
-rw-r--r--doc/classes/AcceptDialog.xml12
-rw-r--r--doc/classes/Animation.xml6
-rw-r--r--doc/classes/AnimationPlayer.xml6
-rw-r--r--doc/classes/AnimationTreePlayer.xml12
-rw-r--r--doc/classes/Area.xml10
-rw-r--r--doc/classes/Array.xml6
-rw-r--r--doc/classes/AudioEffectDistortion.xml10
-rw-r--r--doc/classes/AudioEffectFilter.xml8
-rw-r--r--doc/classes/AudioServer.xml10
-rw-r--r--doc/classes/AudioStreamOGGVorbis.xml3
-rw-r--r--doc/classes/AudioStreamPlayer.xml23
-rw-r--r--doc/classes/AudioStreamPlayer2D.xml21
-rw-r--r--doc/classes/AudioStreamPlayer3D.xml38
-rw-r--r--doc/classes/AudioStreamRandomPitch.xml4
-rw-r--r--doc/classes/AudioStreamSample.xml27
-rw-r--r--doc/classes/BitMap.xml4
-rw-r--r--doc/classes/BoxContainer.xml14
-rw-r--r--doc/classes/BoxShape.xml3
-rw-r--r--doc/classes/Camera2D.xml2
-rw-r--r--doc/classes/CanvasItem.xml14
-rw-r--r--doc/classes/CanvasLayer.xml8
-rw-r--r--doc/classes/CapsuleShape.xml6
-rw-r--r--doc/classes/CapsuleShape2D.xml6
-rw-r--r--doc/classes/CircleShape2D.xml5
-rw-r--r--doc/classes/CollisionObject.xml4
-rw-r--r--doc/classes/CollisionPolygon.xml5
-rw-r--r--doc/classes/CollisionPolygon2D.xml12
-rw-r--r--doc/classes/Control.xml20
-rw-r--r--doc/classes/Curve.xml10
-rw-r--r--doc/classes/Curve2D.xml18
-rw-r--r--doc/classes/Curve3D.xml18
-rw-r--r--doc/classes/EditorExportPlugin.xml61
-rw-r--r--doc/classes/EditorFileDialog.xml4
-rw-r--r--doc/classes/EditorPlugin.xml16
-rw-r--r--doc/classes/File.xml6
-rw-r--r--doc/classes/Font.xml8
-rw-r--r--doc/classes/Geometry.xml6
-rw-r--r--doc/classes/GeometryInstance.xml12
-rw-r--r--doc/classes/GraphEdit.xml4
-rw-r--r--doc/classes/GraphNode.xml4
-rw-r--r--doc/classes/ImmediateGeometry.xml2
-rw-r--r--doc/classes/Input.xml2
-rw-r--r--doc/classes/InputEventScreenTouch.xml2
-rw-r--r--doc/classes/ItemList.xml6
-rw-r--r--doc/classes/JSON.xml31
-rw-r--r--doc/classes/JSONParseResult.xml81
-rw-r--r--doc/classes/KinematicBody2D.xml3
-rw-r--r--doc/classes/KinematicCollision.xml14
-rw-r--r--doc/classes/KinematicCollision2D.xml14
-rw-r--r--doc/classes/Label.xml21
-rw-r--r--doc/classes/Light2D.xml33
-rw-r--r--doc/classes/Line2D.xml32
-rw-r--r--doc/classes/LineEdit.xml6
-rw-r--r--doc/classes/LineShape2D.xml6
-rw-r--r--doc/classes/Mesh.xml68
-rw-r--r--doc/classes/NinePatchRect.xml15
-rw-r--r--doc/classes/Node.xml2
-rw-r--r--doc/classes/Node2D.xml4
-rw-r--r--doc/classes/OS.xml8
-rw-r--r--doc/classes/OmniLight.xml8
-rw-r--r--doc/classes/Physics2DDirectBodyState.xml6
-rw-r--r--doc/classes/Physics2DServer.xml2
-rw-r--r--doc/classes/PhysicsBody.xml12
-rw-r--r--doc/classes/PhysicsBody2D.xml9
-rw-r--r--doc/classes/PhysicsDirectBodyState.xml10
-rw-r--r--doc/classes/PhysicsServer.xml26
-rw-r--r--doc/classes/ProjectSettings.xml2
-rw-r--r--doc/classes/RayShape2D.xml5
-rw-r--r--doc/classes/Rect2.xml2
-rw-r--r--doc/classes/Rect3.xml2
-rw-r--r--doc/classes/RectangleShape2D.xml5
-rw-r--r--doc/classes/Reference.xml2
-rw-r--r--doc/classes/RigidBody.xml45
-rw-r--r--doc/classes/RigidBody2D.xml27
-rw-r--r--doc/classes/SegmentShape2D.xml6
-rw-r--r--doc/classes/Spatial.xml76
-rw-r--r--doc/classes/SpriteFrames.xml2
-rw-r--r--doc/classes/StreamPeerBuffer.xml4
-rw-r--r--doc/classes/String.xml10
-rw-r--r--doc/classes/TabContainer.xml6
-rw-r--r--doc/classes/Texture.xml2
-rw-r--r--doc/classes/TextureProgress.xml16
-rw-r--r--doc/classes/TextureRect.xml18
-rw-r--r--doc/classes/TileMap.xml8
-rw-r--r--doc/classes/TouchScreenButton.xml4
-rw-r--r--doc/classes/Transform.xml22
-rw-r--r--doc/classes/Transform2D.xml20
-rw-r--r--doc/classes/Tree.xml16
-rw-r--r--doc/classes/TreeItem.xml6
-rw-r--r--doc/classes/Tween.xml2
-rw-r--r--doc/classes/UndoRedo.xml26
-rw-r--r--doc/classes/VideoPlayer.xml2
-rw-r--r--doc/classes/Viewport.xml16
-rw-r--r--doc/classes/VisibilityNotifier.xml9
-rw-r--r--doc/classes/VisibilityNotifier2D.xml9
-rw-r--r--doc/classes/VisualScript.xml8
-rw-r--r--doc/classes/VisualScriptBuiltinFunc.xml116
-rw-r--r--doc/classes/VisualScriptFunctionCall.xml12
-rw-r--r--doc/classes/VisualScriptInputAction.xml8
-rw-r--r--doc/classes/VisualScriptMathConstant.xml18
-rw-r--r--doc/classes/VisualScriptPropertySet.xml24
-rw-r--r--doc/classes/XMLParser.xml2
-rw-r--r--doc/tools/doc_status.py54
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.h2
-rw-r--r--drivers/rtaudio/audio_driver_rtaudio.cpp2
-rw-r--r--drivers/unix/dir_access_unix.cpp9
-rw-r--r--drivers/unix/file_access_unix.cpp11
-rw-r--r--drivers/unix/file_access_unix.h4
-rw-r--r--drivers/windows/file_access_windows.cpp6
-rw-r--r--drivers/windows/file_access_windows.h2
-rw-r--r--editor/SCsub8
-rw-r--r--editor/animation_editor.cpp57
-rw-r--r--editor/animation_editor.h2
-rw-r--r--editor/code_editor.cpp21
-rw-r--r--editor/collada/collada.cpp2
-rw-r--r--editor/create_dialog.cpp45
-rw-r--r--editor/create_dialog.h2
-rw-r--r--editor/doc/doc_data.cpp4
-rw-r--r--editor/editor_audio_buses.cpp8
-rw-r--r--editor/editor_autoload_settings.cpp8
-rw-r--r--editor/editor_dir_dialog.cpp4
-rw-r--r--editor/editor_export.cpp22
-rw-r--r--editor/editor_export.h4
-rw-r--r--editor/editor_file_dialog.cpp3
-rw-r--r--editor/editor_file_system.cpp16
-rw-r--r--editor/editor_file_system.h8
-rw-r--r--editor/editor_fonts.cpp11
-rw-r--r--editor/editor_log.cpp6
-rw-r--r--editor/editor_node.cpp81
-rw-r--r--editor/editor_node.h4
-rw-r--r--editor/editor_profiler.cpp11
-rw-r--r--editor/editor_settings.cpp94
-rw-r--r--editor/editor_themes.cpp308
-rw-r--r--editor/filesystem_dock.cpp22
-rw-r--r--editor/icons/icon_GUI_tab.svg5
-rw-r--r--editor/icons/icon_a_r_v_r_camera.svg3
-rw-r--r--editor/icons/icon_area.svg2
-rw-r--r--editor/icons/icon_error.svg2
-rw-r--r--editor/icons/icon_error_sign.svg5
-rw-r--r--editor/icons/icon_file_broken.svg2
-rw-r--r--editor/icons/icon_file_broken_big_thumb.svg2
-rw-r--r--editor/icons/icon_file_dead.svg2
-rw-r--r--editor/icons/icon_file_dead_big_thumb.svg2
-rw-r--r--editor/icons/icon_file_dead_medium_thumb.svg2
-rw-r--r--editor/icons/icon_gui_close_customizable.svg5
-rw-r--r--editor/icons/icon_gui_graph_node_port.svg5
-rw-r--r--editor/icons/icon_gui_resizer.svg3
-rw-r--r--editor/icons/icon_import_check.svg2
-rw-r--r--editor/icons/icon_import_fail.svg2
-rw-r--r--editor/icons/icon_key_invalid.svg2
-rw-r--r--editor/icons/icon_key_move_disabled.svg4
-rw-r--r--editor/icons/icon_key_move_enabled.svg4
-rw-r--r--editor/icons/icon_key_rotate_disabled.svg4
-rw-r--r--editor/icons/icon_key_rotate_enabled.svg4
-rw-r--r--editor/icons/icon_key_scale_disabled.svg4
-rw-r--r--editor/icons/icon_key_scale_enabled.svg4
-rw-r--r--editor/icons/icon_node_warning.svg2
-rw-r--r--editor/icons/icon_sample_library.svg5
-rw-r--r--editor/icons/icon_slider_joint.svg7
-rw-r--r--editor/icons/icon_snap.svg101
-rw-r--r--editor/icons/icon_snap_grid.svg92
-rw-r--r--editor/icons/icon_warning.svg2
-rw-r--r--editor/import/editor_import_collada.cpp15
-rw-r--r--editor/import/resource_importer_scene.cpp18
-rw-r--r--editor/import/resource_importer_scene.h10
-rw-r--r--editor/import/resource_importer_wav.cpp2
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp14
-rw-r--r--editor/plugins/animation_tree_editor_plugin.cpp22
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp1436
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h119
-rw-r--r--editor/plugins/curve_editor_plugin.cpp22
-rw-r--r--editor/plugins/line_2d_editor_plugin.cpp16
-rw-r--r--editor/plugins/navigation_mesh_editor_plugin.h6
-rw-r--r--editor/plugins/navigation_mesh_generator.h2
-rw-r--r--editor/plugins/path_2d_editor_plugin.cpp28
-rw-r--r--editor/plugins/path_editor_plugin.cpp40
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.cpp2
-rw-r--r--editor/plugins/script_editor_plugin.cpp3
-rw-r--r--editor/plugins/script_text_editor.cpp134
-rw-r--r--editor/plugins/shader_editor_plugin.cpp115
-rw-r--r--editor/plugins/shader_graph_editor_plugin.cpp16
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp159
-rw-r--r--editor/plugins/spatial_editor_plugin.h2
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp6
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp36
-rw-r--r--editor/plugins/tile_map_editor_plugin.h3
-rw-r--r--editor/project_export.cpp14
-rw-r--r--editor/project_manager.cpp8
-rw-r--r--editor/project_manager.h2
-rw-r--r--editor/property_editor.cpp20
-rw-r--r--editor/quick_open.cpp2
-rw-r--r--editor/scene_tree_dock.cpp1
-rw-r--r--editor/scene_tree_editor.cpp10
-rw-r--r--editor/script_editor_debugger.cpp1
-rw-r--r--editor/script_editor_debugger.h2
-rw-r--r--editor/spatial_editor_gizmos.cpp34
-rw-r--r--editor/spatial_editor_gizmos.h3
-rw-r--r--editor/translations/ar.po6
-rw-r--r--editor/translations/bg.po6
-rw-r--r--editor/translations/bn.po6
-rw-r--r--editor/translations/ca.po6
-rw-r--r--editor/translations/cs.po6
-rw-r--r--editor/translations/da.po6
-rw-r--r--editor/translations/de.po6
-rw-r--r--editor/translations/de_CH.po6
-rw-r--r--editor/translations/editor.pot6
-rw-r--r--editor/translations/el.po6
-rw-r--r--editor/translations/es.po6
-rw-r--r--editor/translations/es_AR.po6
-rw-r--r--editor/translations/fa.po6
-rw-r--r--editor/translations/fi.po6
-rw-r--r--editor/translations/fr.po6
-rw-r--r--editor/translations/hu.po6
-rw-r--r--editor/translations/id.po6
-rw-r--r--editor/translations/it.po6
-rw-r--r--editor/translations/ja.po6
-rw-r--r--editor/translations/ko.po6
-rw-r--r--editor/translations/nb.po6
-rw-r--r--editor/translations/nl.po6
-rw-r--r--editor/translations/pl.po6
-rw-r--r--editor/translations/pr.po6
-rw-r--r--editor/translations/pt_BR.po6
-rw-r--r--editor/translations/pt_PT.po6
-rw-r--r--editor/translations/ru.po6
-rw-r--r--editor/translations/sk.po6
-rw-r--r--editor/translations/sl.po6
-rw-r--r--editor/translations/th.po6
-rw-r--r--editor/translations/tr.po6
-rw-r--r--editor/translations/ur_PK.po6
-rw-r--r--editor/translations/zh_CN.po6
-rw-r--r--editor/translations/zh_HK.po6
-rw-r--r--editor/translations/zh_TW.po6
-rw-r--r--main/input_default.cpp17
-rw-r--r--main/input_default.h2
-rw-r--r--main/main.cpp14
-rw-r--r--main/tests/test_main.cpp7
-rw-r--r--main/tests/test_oa_hash_map.cpp97
-rw-r--r--main/tests/test_oa_hash_map.h39
-rw-r--r--modules/dds/texture_loader_dds.cpp2
-rw-r--r--modules/gdnative/gd_native_library_editor.cpp94
-rw-r--r--modules/gdnative/gd_native_library_editor.h39
-rw-r--r--modules/gdnative/gdnative.cpp13
-rw-r--r--modules/gdnative/gdnative.h3
-rw-r--r--modules/gdnative/gdnative/variant.cpp5
-rw-r--r--modules/gdnative/include/gdnative/gdnative.h3
-rw-r--r--modules/gdnative/include/gdnative/variant.h2
-rw-r--r--modules/gdnative/include/gdnative_api_struct.h723
-rw-r--r--modules/gdnative/register_types.cpp4
-rw-r--r--modules/gdscript/gd_compiler.cpp4
-rw-r--r--modules/gdscript/gd_editor.cpp2
-rw-r--r--modules/gdscript/gd_function.cpp114
-rw-r--r--modules/gdscript/gd_parser.cpp2
-rw-r--r--modules/opus/audio_stream_opus.cpp6
-rw-r--r--modules/opus/audio_stream_opus.h2
-rw-r--r--modules/pvr/texture_loader_pvr.cpp2
-rw-r--r--modules/recast/config.py2
-rw-r--r--modules/regex/regex.h4
-rw-r--r--modules/stb_vorbis/audio_stream_ogg_vorbis.cpp2
-rw-r--r--modules/stb_vorbis/audio_stream_ogg_vorbis.h2
-rw-r--r--modules/svg/image_loader_svg.cpp8
-rw-r--r--modules/svg/image_loader_svg.h2
-rw-r--r--modules/tga/image_loader_tga.cpp4
-rw-r--r--modules/theora/video_stream_theora.cpp2
-rw-r--r--modules/theora/video_stream_theora.h2
-rw-r--r--modules/visual_script/visual_script.cpp10
-rw-r--r--modules/visual_script/visual_script.h4
-rw-r--r--modules/visual_script/visual_script_editor.cpp57
-rw-r--r--modules/visual_script/visual_script_expression.cpp4
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp2
-rw-r--r--modules/visual_script/visual_script_nodes.cpp2
-rw-r--r--modules/vorbis/audio_stream_ogg_vorbis.cpp6
-rw-r--r--modules/vorbis/audio_stream_ogg_vorbis.h2
-rw-r--r--modules/webm/video_stream_webm.cpp4
-rw-r--r--modules/webm/video_stream_webm.h2
-rw-r--r--platform/android/AndroidManifest.xml.template10
-rw-r--r--platform/android/SCsub8
-rw-r--r--platform/android/file_access_android.cpp2
-rw-r--r--platform/android/file_access_android.h2
-rw-r--r--platform/android/file_access_jandroid.cpp2
-rw-r--r--platform/android/file_access_jandroid.h2
-rw-r--r--platform/android/os_android.cpp7
-rw-r--r--platform/haiku/detect.py15
-rw-r--r--platform/haiku/haiku_direct_window.cpp8
-rw-r--r--platform/haiku/os_haiku.cpp6
-rw-r--r--platform/iphone/game_center.mm1
-rw-r--r--platform/javascript/os_javascript.cpp22
-rw-r--r--platform/osx/SCsub13
-rw-r--r--platform/osx/crash_handler_osx.mm3
-rw-r--r--platform/osx/detect.py11
-rw-r--r--platform/osx/os_osx.h2
-rw-r--r--platform/osx/os_osx.mm9
-rw-r--r--platform/server/os_server.cpp8
-rw-r--r--platform/server/os_server.h2
-rw-r--r--platform/uwp/export/export.cpp6
-rw-r--r--platform/uwp/os_uwp.cpp7
-rw-r--r--platform/windows/SCsub11
-rw-r--r--platform/windows/crash_handler_win.cpp4
-rw-r--r--platform/windows/detect.py12
-rw-r--r--platform/windows/godot_win.cpp38
-rw-r--r--platform/windows/os_windows.cpp9
-rw-r--r--platform/windows/os_windows.h2
-rw-r--r--platform/x11/SCsub9
-rw-r--r--platform/x11/crash_handler_x11.cpp3
-rw-r--r--platform/x11/detect.py13
-rw-r--r--platform/x11/export/export.cpp1
-rw-r--r--platform/x11/os_x11.cpp45
-rw-r--r--platform/x11/os_x11.h9
-rw-r--r--scene/2d/animated_sprite.cpp2
-rw-r--r--scene/2d/audio_stream_player_2d.cpp10
-rw-r--r--scene/2d/audio_stream_player_2d.h2
-rw-r--r--scene/2d/camera_2d.cpp4
-rw-r--r--scene/2d/camera_2d.h2
-rw-r--r--scene/2d/canvas_item.cpp20
-rw-r--r--scene/2d/canvas_item.h4
-rw-r--r--scene/2d/line_2d.cpp10
-rw-r--r--scene/2d/line_2d.h4
-rw-r--r--scene/2d/node_2d.cpp4
-rw-r--r--scene/2d/path_2d.cpp2
-rw-r--r--scene/2d/tile_map.cpp8
-rw-r--r--scene/3d/audio_stream_player_3d.cpp10
-rw-r--r--scene/3d/audio_stream_player_3d.h2
-rw-r--r--scene/3d/collision_object.cpp4
-rw-r--r--scene/3d/immediate_geometry.cpp2
-rw-r--r--scene/3d/light.h2
-rw-r--r--scene/3d/physics_body.cpp2
-rw-r--r--scene/3d/spatial.cpp4
-rw-r--r--scene/3d/spatial.h2
-rw-r--r--scene/animation/animation_player.cpp8
-rw-r--r--scene/animation/animation_player.h2
-rw-r--r--scene/animation/animation_tree_player.cpp16
-rw-r--r--scene/animation/animation_tree_player.h4
-rw-r--r--scene/audio/audio_player.cpp10
-rw-r--r--scene/audio/audio_player.h2
-rw-r--r--scene/gui/control.cpp36
-rw-r--r--scene/gui/graph_edit.cpp36
-rw-r--r--scene/gui/graph_node.cpp17
-rw-r--r--scene/gui/graph_node.h4
-rw-r--r--scene/gui/item_list.cpp8
-rw-r--r--scene/gui/item_list.h2
-rw-r--r--scene/gui/line_edit.cpp48
-rw-r--r--scene/gui/line_edit.h4
-rw-r--r--scene/gui/rich_text_label.cpp8
-rw-r--r--scene/gui/scroll_bar.cpp8
-rw-r--r--scene/gui/scroll_container.cpp6
-rw-r--r--scene/gui/scroll_container.h2
-rw-r--r--scene/gui/spin_box.cpp2
-rw-r--r--scene/gui/tab_container.cpp6
-rw-r--r--scene/gui/text_edit.cpp35
-rw-r--r--scene/gui/text_edit.h2
-rw-r--r--scene/gui/tree.cpp129
-rw-r--r--scene/gui/tree.h6
-rw-r--r--scene/gui/video_player.cpp6
-rw-r--r--scene/gui/video_player.h2
-rwxr-xr-xscene/main/node.cpp2
-rw-r--r--scene/main/viewport.cpp4
-rw-r--r--scene/resources/animation.cpp28
-rw-r--r--scene/resources/animation.h2
-rw-r--r--scene/resources/audio_stream_sample.cpp2
-rw-r--r--scene/resources/audio_stream_sample.h2
-rw-r--r--scene/resources/bit_mask.cpp4
-rw-r--r--scene/resources/curve.cpp41
-rw-r--r--scene/resources/curve.h10
-rw-r--r--scene/resources/default_theme/default_theme.cpp2
-rw-r--r--scene/resources/default_theme/icon_snap_grid.png (renamed from scene/resources/default_theme/icon_snap.png)bin269 -> 325 bytes
-rw-r--r--scene/resources/default_theme/theme_data.h4
-rw-r--r--scene/resources/dynamic_font.cpp2
-rw-r--r--scene/resources/font.cpp4
-rw-r--r--scene/resources/scene_format_text.cpp4
-rw-r--r--scene/resources/shader_graph.cpp14
-rw-r--r--scene/resources/shader_graph.h4
-rw-r--r--scene/resources/sky_box.cpp6
-rw-r--r--scene/resources/style_box.h4
-rw-r--r--scene/resources/texture.cpp6
-rw-r--r--scene/resources/video_stream.h2
-rw-r--r--servers/audio/audio_stream.cpp4
-rw-r--r--servers/audio/audio_stream.h4
-rw-r--r--servers/audio_server.cpp43
-rw-r--r--servers/audio_server.h5
-rw-r--r--servers/physics/body_sw.h6
-rw-r--r--servers/physics/broad_phase_basic.h2
-rw-r--r--servers/physics/joints/pin_joint_sw.h4
-rw-r--r--servers/physics/physics_server_sw.cpp4
-rw-r--r--servers/physics_2d/body_2d_sw.h6
-rw-r--r--servers/physics_2d/space_2d_sw.cpp12
-rw-r--r--servers/physics_2d/space_2d_sw.h6
-rw-r--r--servers/physics_2d_server.cpp8
-rw-r--r--servers/physics_2d_server.h6
-rw-r--r--servers/physics_server.cpp12
-rw-r--r--servers/physics_server.h6
-rw-r--r--thirdparty/README.md8
-rw-r--r--thirdparty/fonts/Hack_Regular.ttfbin0 -> 399724 bytes
-rw-r--r--thirdparty/fonts/LICENSE_Hack.md64
-rw-r--r--thirdparty/fonts/LICENSE_Mononoki94
-rw-r--r--thirdparty/fonts/mononoki_Regular.ttfbin90216 -> 0 bytes
453 files changed, 8071 insertions, 3462 deletions
diff --git a/.gitignore b/.gitignore
index 315dc7950f..d27b8b2b4b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -80,6 +80,8 @@ build/
bld/
[Bb]in/
[Oo]bj/
+*.debug
+*.dSYM
# MSTest test Results
[Tt]est[Rr]esult*/
diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt
index 16ef854f1f..21cbdd9860 100644
--- a/COPYRIGHT.txt
+++ b/COPYRIGHT.txt
@@ -150,10 +150,10 @@ Comment: Noto Sans font
Copyright: 2012, Google Inc.
License: OFL-1.1
-Files: ./thirdparty/fonts/mononoki_Regular.ttf
-Comment: Mononoki font
-Copyright: 2013, Matthias Tellen
-License: OFL-1.1
+Files: ./thirdparty/fonts/Hack_Regular.ttf
+Comment: Hack font
+Copyright: 2015-2017, Christopher Simpkins (with Reserved Font Name Hack).
+License: Hack Open Font License v2.0
Files: ./thirdparty/freetype/
Comment: The FreeType Project
diff --git a/SConstruct b/SConstruct
index bc89aa7540..f2f1ea57f3 100644
--- a/SConstruct
+++ b/SConstruct
@@ -367,13 +367,13 @@ if selected_platform in platform_list:
if (config.can_build(selected_platform)):
config.configure(env)
env.module_list.append(x)
- try:
- doc_classes = config.get_doc_classes()
- doc_path = config.get_doc_path()
- for c in doc_classes:
- env.doc_class_path[c]="modules/"+x+"/"+doc_path
- except:
- pass
+ try:
+ doc_classes = config.get_doc_classes()
+ doc_path = config.get_doc_path()
+ for c in doc_classes:
+ env.doc_class_path[c]="modules/"+x+"/"+doc_path
+ except:
+ pass
sys.path.remove(tmppath)
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index d0acd04497..2477b1b187 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -33,6 +33,7 @@
#include "geometry.h"
#include "io/file_access_compressed.h"
#include "io/file_access_encrypted.h"
+#include "io/json.h"
#include "io/marshalls.h"
#include "os/keyboard.h"
#include "os/os.h"
@@ -440,8 +441,8 @@ bool _OS::is_vsync_enabled() const {
return OS::get_singleton()->is_vsync_enabled();
}
-OS::PowerState _OS::get_power_state() {
- return OS::get_singleton()->get_power_state();
+_OS::PowerState _OS::get_power_state() {
+ return _OS::PowerState(OS::get_singleton()->get_power_state());
}
int _OS::get_power_seconds_left() {
@@ -1032,10 +1033,8 @@ void _OS::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_time", "utc"), &_OS::get_time, DEFVAL(false));
ClassDB::bind_method(D_METHOD("get_time_zone_info"), &_OS::get_time_zone_info);
ClassDB::bind_method(D_METHOD("get_unix_time"), &_OS::get_unix_time);
- ClassDB::bind_method(D_METHOD("get_datetime_from_unix_time", "unix_time_val"),
- &_OS::get_datetime_from_unix_time);
- ClassDB::bind_method(D_METHOD("get_unix_time_from_datetime", "datetime"),
- &_OS::get_unix_time_from_datetime);
+ ClassDB::bind_method(D_METHOD("get_datetime_from_unix_time", "unix_time_val"), &_OS::get_datetime_from_unix_time);
+ ClassDB::bind_method(D_METHOD("get_unix_time_from_datetime", "datetime"), &_OS::get_unix_time_from_datetime);
ClassDB::bind_method(D_METHOD("get_system_time_secs"), &_OS::get_system_time_secs);
ClassDB::bind_method(D_METHOD("set_icon", "icon"), &_OS::set_icon);
@@ -1142,11 +1141,11 @@ void _OS::_bind_methods() {
BIND_ENUM_CONSTANT(SYSTEM_DIR_PICTURES);
BIND_ENUM_CONSTANT(SYSTEM_DIR_RINGTONES);
- BIND_ENUM_CONSTANT(OS::POWERSTATE_UNKNOWN);
- BIND_ENUM_CONSTANT(OS::POWERSTATE_ON_BATTERY);
- BIND_ENUM_CONSTANT(OS::POWERSTATE_NO_BATTERY);
- BIND_ENUM_CONSTANT(OS::POWERSTATE_CHARGING);
- BIND_ENUM_CONSTANT(OS::POWERSTATE_CHARGED);
+ BIND_ENUM_CONSTANT(POWERSTATE_UNKNOWN);
+ BIND_ENUM_CONSTANT(POWERSTATE_ON_BATTERY);
+ BIND_ENUM_CONSTANT(POWERSTATE_NO_BATTERY);
+ BIND_ENUM_CONSTANT(POWERSTATE_CHARGING);
+ BIND_ENUM_CONSTANT(POWERSTATE_CHARGED);
}
_OS::_OS() {
@@ -1336,7 +1335,7 @@ void _Geometry::_bind_methods() {
ClassDB::bind_method(D_METHOD("build_box_planes", "extents"), &_Geometry::build_box_planes);
ClassDB::bind_method(D_METHOD("build_cylinder_planes", "radius", "height", "sides", "axis"), &_Geometry::build_cylinder_planes, DEFVAL(Vector3::AXIS_Z));
ClassDB::bind_method(D_METHOD("build_capsule_planes", "radius", "height", "sides", "lats", "axis"), &_Geometry::build_capsule_planes, DEFVAL(Vector3::AXIS_Z));
- ClassDB::bind_method(D_METHOD("segment_intersects_circle", "segment_from", "segment_to", "circle_pos", "circle_radius"), &_Geometry::segment_intersects_circle);
+ ClassDB::bind_method(D_METHOD("segment_intersects_circle", "segment_from", "segment_to", "circle_position", "circle_radius"), &_Geometry::segment_intersects_circle);
ClassDB::bind_method(D_METHOD("segment_intersects_segment_2d", "from_a", "to_a", "from_b", "to_b"), &_Geometry::segment_intersects_segment_2d);
ClassDB::bind_method(D_METHOD("get_closest_points_between_segments_2d", "p1", "q1", "p2", "q2"), &_Geometry::get_closest_points_between_segments_2d);
@@ -1352,7 +1351,7 @@ void _Geometry::_bind_methods() {
ClassDB::bind_method(D_METHOD("ray_intersects_triangle", "from", "dir", "a", "b", "c"), &_Geometry::ray_intersects_triangle);
ClassDB::bind_method(D_METHOD("segment_intersects_triangle", "from", "to", "a", "b", "c"), &_Geometry::segment_intersects_triangle);
- ClassDB::bind_method(D_METHOD("segment_intersects_sphere", "from", "to", "spos", "sradius"), &_Geometry::segment_intersects_sphere);
+ ClassDB::bind_method(D_METHOD("segment_intersects_sphere", "from", "to", "sphere_position", "sphere_radius"), &_Geometry::segment_intersects_sphere);
ClassDB::bind_method(D_METHOD("segment_intersects_cylinder", "from", "to", "height", "radius"), &_Geometry::segment_intersects_cylinder);
ClassDB::bind_method(D_METHOD("segment_intersects_convex", "from", "to", "planes"), &_Geometry::segment_intersects_convex);
ClassDB::bind_method(D_METHOD("point_is_inside_triangle", "point", "a", "b", "c"), &_Geometry::point_is_inside_triangle);
@@ -1451,10 +1450,10 @@ void _File::seek_end(int64_t p_position) {
ERR_FAIL_COND(!f);
f->seek_end(p_position);
}
-int64_t _File::get_pos() const {
+int64_t _File::get_position() const {
ERR_FAIL_COND_V(!f, 0);
- return f->get_pos();
+ return f->get_position();
}
int64_t _File::get_len() const {
@@ -1533,7 +1532,7 @@ String _File::get_as_text() const {
ERR_FAIL_COND_V(!f, String());
String text;
- size_t original_pos = f->get_pos();
+ size_t original_pos = f->get_position();
f->seek(0);
String l = get_line();
@@ -1730,9 +1729,9 @@ void _File::_bind_methods() {
ClassDB::bind_method(D_METHOD("open", "path", "flags"), &_File::open);
ClassDB::bind_method(D_METHOD("close"), &_File::close);
ClassDB::bind_method(D_METHOD("is_open"), &_File::is_open);
- ClassDB::bind_method(D_METHOD("seek", "pos"), &_File::seek);
- ClassDB::bind_method(D_METHOD("seek_end", "pos"), &_File::seek_end, DEFVAL(0));
- ClassDB::bind_method(D_METHOD("get_pos"), &_File::get_pos);
+ ClassDB::bind_method(D_METHOD("seek", "position"), &_File::seek);
+ ClassDB::bind_method(D_METHOD("seek_end", "position"), &_File::seek_end, DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("get_position"), &_File::get_position);
ClassDB::bind_method(D_METHOD("get_len"), &_File::get_len);
ClassDB::bind_method(D_METHOD("eof_reached"), &_File::eof_reached);
ClassDB::bind_method(D_METHOD("get_8"), &_File::get_8);
@@ -2600,3 +2599,76 @@ _Engine *_Engine::singleton = NULL;
_Engine::_Engine() {
singleton = this;
}
+
+void JSONParseResult::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("get_error"), &JSONParseResult::get_error);
+ ClassDB::bind_method(D_METHOD("get_error_string"), &JSONParseResult::get_error_string);
+ ClassDB::bind_method(D_METHOD("get_error_line"), &JSONParseResult::get_error_line);
+ ClassDB::bind_method(D_METHOD("get_result"), &JSONParseResult::get_result);
+
+ ClassDB::bind_method(D_METHOD("set_error", "error"), &JSONParseResult::set_error);
+ ClassDB::bind_method(D_METHOD("set_error_string", "error_string"), &JSONParseResult::set_error_string);
+ ClassDB::bind_method(D_METHOD("set_error_line", "error_line"), &JSONParseResult::set_error_line);
+ ClassDB::bind_method(D_METHOD("set_result", "result"), &JSONParseResult::set_result);
+
+ ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "error", PROPERTY_HINT_NONE, "Error", PROPERTY_USAGE_CLASS_IS_ENUM), "set_error", "get_error");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "error_string"), "set_error_string", "get_error_string");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "error_line"), "set_error_line", "get_error_line");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::NIL, "result", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT), "set_result", "get_result");
+}
+
+void JSONParseResult::set_error(Error p_error) {
+ error = p_error;
+}
+
+Error JSONParseResult::get_error() const {
+ return error;
+}
+
+void JSONParseResult::set_error_string(const String &p_error_string) {
+ error_string = p_error_string;
+}
+
+String JSONParseResult::get_error_string() const {
+ return error_string;
+}
+
+void JSONParseResult::set_error_line(int p_error_line) {
+ error_line = p_error_line;
+}
+
+int JSONParseResult::get_error_line() const {
+ return error_line;
+}
+
+void JSONParseResult::set_result(const Variant &p_result) {
+ result = p_result;
+}
+
+Variant JSONParseResult::get_result() const {
+ return result;
+}
+
+void _JSON::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("print", "value"), &_JSON::print);
+ ClassDB::bind_method(D_METHOD("parse", "json"), &_JSON::parse);
+}
+
+String _JSON::print(const Variant &p_value) {
+ return JSON::print(p_value);
+}
+
+Ref<JSONParseResult> _JSON::parse(const String &p_json) {
+ Ref<JSONParseResult> result;
+ result.instance();
+
+ result->error = JSON::parse(p_json, result->result, result->error_string, result->error_line);
+
+ return result;
+}
+
+_JSON *_JSON::singleton = NULL;
+
+_JSON::_JSON() {
+ singleton = this;
+}
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index 0578c2b80f..1a22d45932 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -97,6 +97,14 @@ protected:
static _OS *singleton;
public:
+ enum PowerState {
+ POWERSTATE_UNKNOWN, /**< cannot determine power status */
+ POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */
+ POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */
+ POWERSTATE_CHARGING, /**< Plugged in, charging battery */
+ POWERSTATE_CHARGED /**< Plugged in, battery charged */
+ };
+
enum Weekday {
DAY_SUNDAY,
DAY_MONDAY,
@@ -303,7 +311,7 @@ public:
void set_use_vsync(bool p_enable);
bool is_vsync_enabled() const;
- OS::PowerState get_power_state();
+ PowerState get_power_state();
int get_power_seconds_left();
int get_power_percent_left();
@@ -312,6 +320,7 @@ public:
_OS();
};
+VARIANT_ENUM_CAST(_OS::PowerState);
VARIANT_ENUM_CAST(_OS::Weekday);
VARIANT_ENUM_CAST(_OS::Month);
VARIANT_ENUM_CAST(_OS::SystemDir);
@@ -390,7 +399,7 @@ public:
void seek(int64_t p_position); ///< seek to a given position
void seek_end(int64_t p_position = 0); ///< seek from the end of file
- int64_t get_pos() const; ///< get position in the file
+ int64_t get_position() const; ///< get position in the file
int64_t get_len() const; ///< get size of the file
bool eof_reached() const; ///< reading passed EOF
@@ -660,4 +669,50 @@ public:
_Engine();
};
+class _JSON;
+
+class JSONParseResult : public Reference {
+ GDCLASS(JSONParseResult, Reference)
+
+ friend class _JSON;
+
+ Error error;
+ String error_string;
+ int error_line;
+
+ Variant result;
+
+protected:
+ static void _bind_methods();
+
+public:
+ void set_error(Error p_error);
+ Error get_error() const;
+
+ void set_error_string(const String &p_error_string);
+ String get_error_string() const;
+
+ void set_error_line(int p_error_line);
+ int get_error_line() const;
+
+ void set_result(const Variant &p_result);
+ Variant get_result() const;
+};
+
+class _JSON : public Object {
+ GDCLASS(_JSON, Object)
+
+protected:
+ static void _bind_methods();
+ static _JSON *singleton;
+
+public:
+ static _JSON *get_singleton() { return singleton; }
+
+ String print(const Variant &p_value);
+ Ref<JSONParseResult> parse(const String &p_json);
+
+ _JSON();
+};
+
#endif // CORE_BIND_H
diff --git a/core/color.cpp b/core/color.cpp
index 259a4988b1..78b11a84df 100644
--- a/core/color.cpp
+++ b/core/color.cpp
@@ -250,6 +250,14 @@ Color Color::html(const String &p_color) {
return Color();
if (color[0] == '#')
color = color.substr(1, color.length() - 1);
+ if (color.length() == 3 || color.length() == 4) {
+ String exp_color;
+ for (int i = 0; i < color.length(); i++) {
+ exp_color += color[i];
+ exp_color += color[i];
+ }
+ color = exp_color;
+ }
bool alpha = false;
@@ -400,3 +408,122 @@ Color::operator String() const {
return rtos(r) + ", " + rtos(g) + ", " + rtos(b) + ", " + rtos(a);
}
+
+Color Color::operator+(const Color &p_color) const {
+
+ return Color(
+ CLAMP(r + p_color.r, 0.0, 1.0),
+ CLAMP(g + p_color.g, 0.0, 1.0),
+ CLAMP(b + p_color.b, 0.0, 1.0),
+ CLAMP(a + p_color.a, 0.0, 1.0));
+}
+
+void Color::operator+=(const Color &p_color) {
+
+ r = CLAMP(r + p_color.r, 0.0, 1.0);
+ g = CLAMP(g + p_color.g, 0.0, 1.0);
+ b = CLAMP(b + p_color.b, 0.0, 1.0);
+ a = CLAMP(a + p_color.a, 0.0, 1.0);
+}
+
+Color Color::operator-(const Color &p_color) const {
+
+ return Color(
+ CLAMP(r - p_color.r, 0.0, 1.0),
+ CLAMP(g - p_color.g, 0.0, 1.0),
+ CLAMP(b - p_color.b, 0.0, 1.0),
+ CLAMP(a - p_color.a, 0.0, 1.0));
+}
+
+void Color::operator-=(const Color &p_color) {
+
+ r = CLAMP(r - p_color.r, 0.0, 1.0);
+ g = CLAMP(g - p_color.g, 0.0, 1.0);
+ b = CLAMP(b - p_color.b, 0.0, 1.0);
+ a = CLAMP(a - p_color.a, 0.0, 1.0);
+}
+
+Color Color::operator*(const Color &p_color) const {
+
+ return Color(
+ CLAMP(r * p_color.r, 0.0, 1.0),
+ CLAMP(g * p_color.g, 0.0, 1.0),
+ CLAMP(b * p_color.b, 0.0, 1.0),
+ CLAMP(a * p_color.a, 0.0, 1.0));
+}
+
+Color Color::operator*(const real_t &rvalue) const {
+
+ return Color(
+ CLAMP(r * rvalue, 0.0, 1.0),
+ CLAMP(g * rvalue, 0.0, 1.0),
+ CLAMP(b * rvalue, 0.0, 1.0),
+ CLAMP(a * rvalue, 0.0, 1.0));
+}
+
+void Color::operator*=(const Color &p_color) {
+
+ r = CLAMP(r * p_color.r, 0.0, 1.0);
+ g = CLAMP(g * p_color.g, 0.0, 1.0);
+ b = CLAMP(b * p_color.b, 0.0, 1.0);
+ a = CLAMP(a * p_color.a, 0.0, 1.0);
+}
+
+void Color::operator*=(const real_t &rvalue) {
+
+ r = CLAMP(r * rvalue, 0.0, 1.0);
+ g = CLAMP(g * rvalue, 0.0, 1.0);
+ b = CLAMP(b * rvalue, 0.0, 1.0);
+ a = CLAMP(a * rvalue, 0.0, 1.0);
+};
+
+Color Color::operator/(const Color &p_color) const {
+
+ return Color(
+ p_color.r == 0 ? 1 : CLAMP(r / p_color.r, 0.0, 1.0),
+ p_color.g == 0 ? 1 : CLAMP(g / p_color.g, 0.0, 1.0),
+ p_color.b == 0 ? 1 : CLAMP(b / p_color.b, 0.0, 1.0),
+ p_color.a == 0 ? 1 : CLAMP(a / p_color.a, 0.0, 1.0));
+}
+
+Color Color::operator/(const real_t &rvalue) const {
+
+ if (rvalue == 0) return Color(1.0, 1.0, 1.0, 1.0);
+ return Color(
+ CLAMP(r / rvalue, 0.0, 1.0),
+ CLAMP(g / rvalue, 0.0, 1.0),
+ CLAMP(b / rvalue, 0.0, 1.0),
+ CLAMP(a / rvalue, 0.0, 1.0));
+}
+
+void Color::operator/=(const Color &p_color) {
+
+ r = p_color.r == 0 ? 1 : CLAMP(r / p_color.r, 0.0, 1.0);
+ g = p_color.g == 0 ? 1 : CLAMP(g / p_color.g, 0.0, 1.0);
+ b = p_color.b == 0 ? 1 : CLAMP(b / p_color.b, 0.0, 1.0);
+ a = p_color.a == 0 ? 1 : CLAMP(a / p_color.a, 0.0, 1.0);
+}
+
+void Color::operator/=(const real_t &rvalue) {
+
+ if (rvalue == 0) {
+ r = 1.0;
+ g = 1.0;
+ b = 1.0;
+ a = 1.0;
+ } else {
+ r = CLAMP(r / rvalue, 0.0, 1.0);
+ g = CLAMP(g / rvalue, 0.0, 1.0);
+ b = CLAMP(b / rvalue, 0.0, 1.0);
+ a = CLAMP(a / rvalue, 0.0, 1.0);
+ }
+};
+
+Color Color::operator-() const {
+
+ return Color(
+ CLAMP(1.0 - r, 0.0, 1.0),
+ CLAMP(1.0 - g, 0.0, 1.0),
+ CLAMP(1.0 - b, 0.0, 1.0),
+ CLAMP(1.0 - a, 0.0, 1.0));
+}
diff --git a/core/color.h b/core/color.h
index d3d5db09f9..972b6a1b33 100644
--- a/core/color.h
+++ b/core/color.h
@@ -67,6 +67,23 @@ struct Color {
return components[idx];
}
+ Color operator+(const Color &p_color) const;
+ void operator+=(const Color &p_color);
+
+ Color operator-() const;
+ Color operator-(const Color &p_color) const;
+ void operator-=(const Color &p_color);
+
+ Color operator*(const Color &p_color) const;
+ Color operator*(const real_t &rvalue) const;
+ void operator*=(const Color &p_color);
+ void operator*=(const real_t &rvalue);
+
+ Color operator/(const Color &p_color) const;
+ Color operator/(const real_t &rvalue) const;
+ void operator/=(const Color &p_color);
+ void operator/=(const real_t &rvalue);
+
void invert();
void contrast();
Color inverted() const;
diff --git a/core/hash_map.h b/core/hash_map.h
index 37391a4c83..e100d7a904 100644
--- a/core/hash_map.h
+++ b/core/hash_map.h
@@ -37,39 +37,6 @@
#include "os/memory.h"
#include "ustring.h"
-struct HashMapHasherDefault {
- static _FORCE_INLINE_ uint32_t hash(const String &p_string) { return p_string.hash(); }
- static _FORCE_INLINE_ uint32_t hash(const char *p_cstr) { return hash_djb2(p_cstr); }
- static _FORCE_INLINE_ uint32_t hash(const uint64_t p_int) { return hash_one_uint64(p_int); }
-
- static _FORCE_INLINE_ uint32_t hash(const int64_t p_int) { return hash(uint64_t(p_int)); }
- static _FORCE_INLINE_ uint32_t hash(const float p_float) { return hash_djb2_one_float(p_float); }
- static _FORCE_INLINE_ uint32_t hash(const double p_double) { return hash_djb2_one_float(p_double); }
- static _FORCE_INLINE_ uint32_t hash(const uint32_t p_int) { return p_int; }
- static _FORCE_INLINE_ uint32_t hash(const int32_t p_int) { return (uint32_t)p_int; }
- static _FORCE_INLINE_ uint32_t hash(const uint16_t p_int) { return p_int; }
- static _FORCE_INLINE_ uint32_t hash(const int16_t p_int) { return (uint32_t)p_int; }
- static _FORCE_INLINE_ uint32_t hash(const uint8_t p_int) { return p_int; }
- static _FORCE_INLINE_ uint32_t hash(const int8_t p_int) { return (uint32_t)p_int; }
- static _FORCE_INLINE_ uint32_t hash(const wchar_t p_wchar) { return (uint32_t)p_wchar; }
- //static _FORCE_INLINE_ uint32_t hash(const void* p_ptr) { return uint32_t(uint64_t(p_ptr))*(0x9e3779b1L); }
-};
-
-template <typename T>
-struct HashMapComparatorDefault {
- static bool compare(const T &p_lhs, const T &p_rhs) {
- return p_lhs == p_rhs;
- }
-
- bool compare(const float &p_lhs, const float &p_rhs) {
- return (p_lhs == p_rhs) || (Math::is_nan(p_lhs) && Math::is_nan(p_rhs));
- }
-
- bool compare(const double &p_lhs, const double &p_rhs) {
- return (p_lhs == p_rhs) || (Math::is_nan(p_lhs) && Math::is_nan(p_rhs));
- }
-};
-
/**
* @class HashMap
* @author Juan Linietsky <reduzio@gmail.com>
diff --git a/core/hashfuncs.h b/core/hashfuncs.h
index 56d40f1dd7..2880cc451e 100644
--- a/core/hashfuncs.h
+++ b/core/hashfuncs.h
@@ -33,6 +33,7 @@
#include "math_defs.h"
#include "math_funcs.h"
#include "typedefs.h"
+#include "ustring.h"
/**
* Hashing functions
@@ -128,4 +129,37 @@ static inline uint64_t make_uint64_t(T p_in) {
return _u._u64;
}
+struct HashMapHasherDefault {
+ static _FORCE_INLINE_ uint32_t hash(const String &p_string) { return p_string.hash(); }
+ static _FORCE_INLINE_ uint32_t hash(const char *p_cstr) { return hash_djb2(p_cstr); }
+ static _FORCE_INLINE_ uint32_t hash(const uint64_t p_int) { return hash_one_uint64(p_int); }
+
+ static _FORCE_INLINE_ uint32_t hash(const int64_t p_int) { return hash(uint64_t(p_int)); }
+ static _FORCE_INLINE_ uint32_t hash(const float p_float) { return hash_djb2_one_float(p_float); }
+ static _FORCE_INLINE_ uint32_t hash(const double p_double) { return hash_djb2_one_float(p_double); }
+ static _FORCE_INLINE_ uint32_t hash(const uint32_t p_int) { return p_int; }
+ static _FORCE_INLINE_ uint32_t hash(const int32_t p_int) { return (uint32_t)p_int; }
+ static _FORCE_INLINE_ uint32_t hash(const uint16_t p_int) { return p_int; }
+ static _FORCE_INLINE_ uint32_t hash(const int16_t p_int) { return (uint32_t)p_int; }
+ static _FORCE_INLINE_ uint32_t hash(const uint8_t p_int) { return p_int; }
+ static _FORCE_INLINE_ uint32_t hash(const int8_t p_int) { return (uint32_t)p_int; }
+ static _FORCE_INLINE_ uint32_t hash(const wchar_t p_wchar) { return (uint32_t)p_wchar; }
+ //static _FORCE_INLINE_ uint32_t hash(const void* p_ptr) { return uint32_t(uint64_t(p_ptr))*(0x9e3779b1L); }
+};
+
+template <typename T>
+struct HashMapComparatorDefault {
+ static bool compare(const T &p_lhs, const T &p_rhs) {
+ return p_lhs == p_rhs;
+ }
+
+ bool compare(const float &p_lhs, const float &p_rhs) {
+ return (p_lhs == p_rhs) || (Math::is_nan(p_lhs) && Math::is_nan(p_rhs));
+ }
+
+ bool compare(const double &p_lhs, const double &p_rhs) {
+ return (p_lhs == p_rhs) || (Math::is_nan(p_lhs) && Math::is_nan(p_rhs));
+ }
+};
+
#endif
diff --git a/core/io/file_access_buffered.cpp b/core/io/file_access_buffered.cpp
index 859f2e3f8c..9ec03bf32b 100644
--- a/core/io/file_access_buffered.cpp
+++ b/core/io/file_access_buffered.cpp
@@ -76,7 +76,7 @@ void FileAccessBuffered::seek_end(int64_t p_position) {
file.offset = file.size + p_position;
};
-size_t FileAccessBuffered::get_pos() const {
+size_t FileAccessBuffered::get_position() const {
return file.offset;
};
diff --git a/core/io/file_access_buffered.h b/core/io/file_access_buffered.h
index d3137058fb..70aaeb8ae0 100644
--- a/core/io/file_access_buffered.h
+++ b/core/io/file_access_buffered.h
@@ -72,7 +72,7 @@ protected:
int get_cache_size();
public:
- virtual size_t get_pos() const; ///< get position in the file
+ virtual size_t get_position() const; ///< get position in the file
virtual size_t get_len() const; ///< get size of the file
virtual void seek(size_t p_position); ///< seek to a given position
diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp
index 70430ca5d3..4750945854 100644
--- a/core/io/file_access_compressed.cpp
+++ b/core/io/file_access_compressed.cpp
@@ -62,7 +62,7 @@ Error FileAccessCompressed::open_after_magic(FileAccess *p_base) {
block_size = f->get_32();
read_total = f->get_32();
int bc = (read_total / block_size) + 1;
- int acc_ofs = f->get_pos() + bc * 4;
+ int acc_ofs = f->get_position() + bc * 4;
int max_bs = 0;
for (int i = 0; i < bc; i++) {
@@ -232,7 +232,7 @@ void FileAccessCompressed::seek_end(int64_t p_position) {
seek(read_total + p_position);
}
}
-size_t FileAccessCompressed::get_pos() const {
+size_t FileAccessCompressed::get_position() const {
ERR_FAIL_COND_V(!f, 0);
if (writing) {
diff --git a/core/io/file_access_compressed.h b/core/io/file_access_compressed.h
index ba84c9767c..1a57e2d4ee 100644
--- a/core/io/file_access_compressed.h
+++ b/core/io/file_access_compressed.h
@@ -74,7 +74,7 @@ public:
virtual void seek(size_t p_position); ///< seek to a given position
virtual void seek_end(int64_t p_position = 0); ///< seek from the end of file
- virtual size_t get_pos() const; ///< get position in the file
+ virtual size_t get_position() const; ///< get position in the file
virtual size_t get_len() const; ///< get size of the file
virtual bool eof_reached() const; ///< reading passed EOF
diff --git a/core/io/file_access_encrypted.cpp b/core/io/file_access_encrypted.cpp
index 12503f3be4..461c5bafe2 100644
--- a/core/io/file_access_encrypted.cpp
+++ b/core/io/file_access_encrypted.cpp
@@ -71,7 +71,7 @@ Error FileAccessEncrypted::open_and_parse(FileAccess *p_base, const Vector<uint8
unsigned char md5d[16];
p_base->get_buffer(md5d, 16);
length = p_base->get_64();
- base = p_base->get_pos();
+ base = p_base->get_position();
ERR_FAIL_COND_V(p_base->get_len() < base + length, ERR_FILE_CORRUPT);
uint32_t ds = length;
if (ds % 16) {
@@ -199,7 +199,7 @@ void FileAccessEncrypted::seek_end(int64_t p_position) {
seek(data.size() + p_position);
}
-size_t FileAccessEncrypted::get_pos() const {
+size_t FileAccessEncrypted::get_position() const {
return pos;
}
diff --git a/core/io/file_access_encrypted.h b/core/io/file_access_encrypted.h
index 74d00a5a8f..82f60ac654 100644
--- a/core/io/file_access_encrypted.h
+++ b/core/io/file_access_encrypted.h
@@ -61,7 +61,7 @@ public:
virtual void seek(size_t p_position); ///< seek to a given position
virtual void seek_end(int64_t p_position = 0); ///< seek from the end of file
- virtual size_t get_pos() const; ///< get position in the file
+ virtual size_t get_position() const; ///< get position in the file
virtual size_t get_len() const; ///< get size of the file
virtual bool eof_reached() const; ///< reading passed EOF
diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp
index 5b186b7798..b948394385 100644
--- a/core/io/file_access_memory.cpp
+++ b/core/io/file_access_memory.cpp
@@ -120,7 +120,7 @@ void FileAccessMemory::seek_end(int64_t p_position) {
pos = length + p_position;
}
-size_t FileAccessMemory::get_pos() const {
+size_t FileAccessMemory::get_position() const {
ERR_FAIL_COND_V(!data, 0);
return pos;
diff --git a/core/io/file_access_memory.h b/core/io/file_access_memory.h
index 7feb16461b..b7b8430089 100644
--- a/core/io/file_access_memory.h
+++ b/core/io/file_access_memory.h
@@ -51,7 +51,7 @@ public:
virtual void seek(size_t p_position); ///< seek to a given position
virtual void seek_end(int64_t p_position); ///< seek from the end of file
- virtual size_t get_pos() const; ///< get position in the file
+ virtual size_t get_position() const; ///< get position in the file
virtual size_t get_len() const; ///< get size of the file
virtual bool eof_reached() const; ///< reading passed EOF
diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp
index 58ca2d4c58..8c624226a1 100644
--- a/core/io/file_access_network.cpp
+++ b/core/io/file_access_network.cpp
@@ -350,7 +350,7 @@ void FileAccessNetwork::seek_end(int64_t p_position) {
seek(total_size + p_position);
}
-size_t FileAccessNetwork::get_pos() const {
+size_t FileAccessNetwork::get_position() const {
ERR_FAIL_COND_V(!opened, 0);
return pos;
diff --git a/core/io/file_access_network.h b/core/io/file_access_network.h
index cd5046f007..abbe378b60 100644
--- a/core/io/file_access_network.h
+++ b/core/io/file_access_network.h
@@ -145,7 +145,7 @@ public:
virtual void seek(size_t p_position); ///< seek to a given position
virtual void seek_end(int64_t p_position = 0); ///< seek from the end of file
- virtual size_t get_pos() const; ///< get position in the file
+ virtual size_t get_position() const; ///< get position in the file
virtual size_t get_len() const; ///< get size of the file
virtual bool eof_reached() const; ///< reading passed EOF
diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp
index e511085ac5..ff4c28ec39 100644
--- a/core/io/file_access_pack.cpp
+++ b/core/io/file_access_pack.cpp
@@ -140,17 +140,17 @@ bool PackedSourcePCK::try_open_pack(const String &p_path) {
if (magic != 0x43504447) {
//maybe at he end.... self contained exe
f->seek_end();
- f->seek(f->get_pos() - 4);
+ f->seek(f->get_position() - 4);
magic = f->get_32();
if (magic != 0x43504447) {
memdelete(f);
return false;
}
- f->seek(f->get_pos() - 12);
+ f->seek(f->get_position() - 12);
uint64_t ds = f->get_64();
- f->seek(f->get_pos() - ds - 8);
+ f->seek(f->get_position() - ds - 8);
magic = f->get_32();
if (magic != 0x43504447) {
@@ -236,7 +236,7 @@ void FileAccessPack::seek_end(int64_t p_position) {
seek(pf.size + p_position);
}
-size_t FileAccessPack::get_pos() const {
+size_t FileAccessPack::get_position() const {
return pos;
}
diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h
index 758e9afa8e..3deb0d2bd3 100644
--- a/core/io/file_access_pack.h
+++ b/core/io/file_access_pack.h
@@ -148,7 +148,7 @@ public:
virtual void seek(size_t p_position);
virtual void seek_end(int64_t p_position = 0);
- virtual size_t get_pos() const;
+ virtual size_t get_position() const;
virtual size_t get_len() const;
virtual bool eof_reached() const;
diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp
index 8c99ef2983..73b23ac702 100644
--- a/core/io/file_access_zip.cpp
+++ b/core/io/file_access_zip.cpp
@@ -65,7 +65,7 @@ static uLong godot_write(voidpf opaque, voidpf stream, const void *buf, uLong si
static long godot_tell(voidpf opaque, voidpf stream) {
FileAccess *f = (FileAccess *)opaque;
- return f->get_pos();
+ return f->get_position();
};
static long godot_seek(voidpf opaque, voidpf stream, uLong offset, int origin) {
@@ -76,7 +76,7 @@ static long godot_seek(voidpf opaque, voidpf stream, uLong offset, int origin) {
switch (origin) {
case ZLIB_FILEFUNC_SEEK_CUR:
- pos = f->get_pos() + offset;
+ pos = f->get_position() + offset;
break;
case ZLIB_FILEFUNC_SEEK_END:
pos = f->get_len() + offset;
@@ -301,7 +301,7 @@ void FileAccessZip::seek_end(int64_t p_position) {
unzSeekCurrentFile(zfile, get_len() + p_position);
};
-size_t FileAccessZip::get_pos() const {
+size_t FileAccessZip::get_position() const {
ERR_FAIL_COND_V(!zfile, 0);
return unztell(zfile);
diff --git a/core/io/file_access_zip.h b/core/io/file_access_zip.h
index 2a8ec3fca5..a40e1a753d 100644
--- a/core/io/file_access_zip.h
+++ b/core/io/file_access_zip.h
@@ -98,7 +98,7 @@ public:
virtual void seek(size_t p_position); ///< seek to a given position
virtual void seek_end(int64_t p_position = 0); ///< seek from the end of file
- virtual size_t get_pos() const; ///< get position in the file
+ virtual size_t get_position() const; ///< get position in the file
virtual size_t get_len() const; ///< get size of the file
virtual bool eof_reached() const; ///< reading passed EOF
diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp
index f1f5b6f538..23e86580d1 100644
--- a/core/io/pck_packer.cpp
+++ b/core/io/pck_packer.cpp
@@ -119,7 +119,7 @@ Error PCKPacker::flush(bool p_verbose) {
for (int i = 0; i < files.size(); i++) {
file->store_pascal_string(files[i].path);
- files[i].offset_offset = file->get_pos();
+ files[i].offset_offset = file->get_position();
file->store_64(0); // offset
file->store_64(files[i].size); // size
@@ -130,10 +130,10 @@ Error PCKPacker::flush(bool p_verbose) {
file->store_32(0);
};
- uint64_t ofs = file->get_pos();
+ uint64_t ofs = file->get_position();
ofs = _align(ofs, alignment);
- _pad(file, ofs - file->get_pos());
+ _pad(file, ofs - file->get_position());
const uint32_t buf_max = 65536;
uint8_t *buf = memnew_arr(uint8_t, buf_max);
@@ -150,7 +150,7 @@ Error PCKPacker::flush(bool p_verbose) {
to_write -= read;
};
- uint64_t pos = file->get_pos();
+ uint64_t pos = file->get_position();
file->seek(files[i].offset_offset); // go back to store the file's offset
file->store_64(ofs);
file->seek(pos);
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index 16ec6cd3c5..900db7c2dc 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -1179,7 +1179,7 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons
save_ustring(fw, get_ustring(f)); //type
- size_t md_ofs = f->get_pos();
+ size_t md_ofs = f->get_position();
size_t importmd_ofs = f->get_64();
fw->store_64(0); //metadata offset
@@ -1227,7 +1227,7 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons
save_ustring(fw, path);
}
- int64_t size_diff = (int64_t)fw->get_pos() - (int64_t)f->get_pos();
+ int64_t size_diff = (int64_t)fw->get_position() - (int64_t)f->get_position();
//internal resources
uint32_t int_resources_size = f->get_32();
@@ -1880,7 +1880,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const RES &p
} else {
save_unicode_string(r->get_path()); //actual external
}
- ofs_pos.push_back(f->get_pos());
+ ofs_pos.push_back(f->get_position());
f->store_64(0); //offset in 64 bits
}
@@ -1891,7 +1891,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const RES &p
ResourceData &rd = E->get();
- ofs_table.push_back(f->get_pos());
+ ofs_table.push_back(f->get_position());
save_unicode_string(rd.type);
f->store_32(rd.properties.size());
diff --git a/core/io/resource_import.cpp b/core/io/resource_import.cpp
index be486a86a3..bc7ea47762 100644
--- a/core/io/resource_import.cpp
+++ b/core/io/resource_import.cpp
@@ -87,6 +87,8 @@ Error ResourceFormatImporter::_get_path_and_type(const String &p_path, PathAndTy
path_found = true; //first match must have priority
} else if (assign == "type") {
r_path_and_type.type = value;
+ } else if (assign == "importer") {
+ r_path_and_type.importer = value;
} else if (assign == "valid") {
if (r_valid) {
*r_valid = value;
@@ -184,6 +186,29 @@ bool ResourceFormatImporter::can_be_imported(const String &p_path) const {
return ResourceFormatLoader::recognize_path(p_path);
}
+int ResourceFormatImporter::get_import_order(const String &p_path) const {
+
+ Ref<ResourceImporter> importer;
+
+ if (FileAccess::exists(p_path + ".import")) {
+
+ PathAndType pat;
+ Error err = _get_path_and_type(p_path, pat);
+
+ if (err == OK) {
+ importer = get_importer_by_name(pat.importer);
+ }
+ } else {
+
+ importer = get_importer_by_extension(p_path.get_extension().to_lower());
+ }
+
+ if (importer.is_valid())
+ return importer->get_import_order();
+
+ return 0;
+}
+
bool ResourceFormatImporter::handles_type(const String &p_type) const {
for (Set<Ref<ResourceImporter> >::Element *E = importers.front(); E; E = E->next()) {
@@ -291,7 +316,7 @@ void ResourceFormatImporter::get_dependencies(const String &p_path, List<String>
return ResourceLoader::get_dependencies(pat.path, p_dependencies, p_add_types);
}
-Ref<ResourceImporter> ResourceFormatImporter::get_importer_by_name(const String &p_name) {
+Ref<ResourceImporter> ResourceFormatImporter::get_importer_by_name(const String &p_name) const {
for (Set<Ref<ResourceImporter> >::Element *E = importers.front(); E; E = E->next()) {
if (E->get()->get_importer_name() == p_name) {
@@ -315,7 +340,7 @@ void ResourceFormatImporter::get_importers_for_extension(const String &p_extensi
}
}
-Ref<ResourceImporter> ResourceFormatImporter::get_importer_by_extension(const String &p_extension) {
+Ref<ResourceImporter> ResourceFormatImporter::get_importer_by_extension(const String &p_extension) const {
Ref<ResourceImporter> importer;
float priority = 0;
diff --git a/core/io/resource_import.h b/core/io/resource_import.h
index b10255fbab..28489b5d34 100644
--- a/core/io/resource_import.h
+++ b/core/io/resource_import.h
@@ -38,6 +38,7 @@ class ResourceFormatImporter : public ResourceFormatLoader {
struct PathAndType {
String path;
String type;
+ String importer;
};
Error _get_path_and_type(const String &p_path, PathAndType &r_path_and_type, bool *r_valid = NULL) const;
@@ -58,14 +59,15 @@ public:
virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false);
virtual bool can_be_imported(const String &p_path) const;
+ virtual int get_import_order(const String &p_path) const;
String get_internal_resource_path(const String &p_path) const;
void get_internal_resource_path_list(const String &p_path, List<String> *r_paths);
void add_importer(const Ref<ResourceImporter> &p_importer) { importers.insert(p_importer); }
void remove_importer(const Ref<ResourceImporter> &p_importer) { importers.erase(p_importer); }
- Ref<ResourceImporter> get_importer_by_name(const String &p_name);
- Ref<ResourceImporter> get_importer_by_extension(const String &p_extension);
+ Ref<ResourceImporter> get_importer_by_name(const String &p_name) const;
+ Ref<ResourceImporter> get_importer_by_extension(const String &p_extension) const;
void get_importers_for_extension(const String &p_extension, List<Ref<ResourceImporter> > *r_importers);
String get_import_base_path(const String &p_for_file) const;
@@ -82,6 +84,7 @@ public:
virtual String get_save_extension() const = 0;
virtual String get_resource_type() const = 0;
virtual float get_priority() const { return 1.0; }
+ virtual int get_import_order() const { return 0; }
struct ImportOption {
PropertyInfo option;
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index 4f266df43e..89cb4a22c2 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -308,6 +308,31 @@ void ResourceLoader::add_resource_format_loader(ResourceFormatLoader *p_format_l
}
}
+int ResourceLoader::get_import_order(const String &p_path) {
+
+ String path = _path_remap(p_path);
+
+ String local_path;
+ if (path.is_rel_path())
+ local_path = "res://" + path;
+ else
+ local_path = ProjectSettings::get_singleton()->localize_path(path);
+
+ for (int i = 0; i < loader_count; i++) {
+
+ if (!loader[i]->recognize_path(local_path))
+ continue;
+ /*
+ if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint))
+ continue;
+ */
+
+ return loader[i]->get_import_order(p_path);
+ }
+
+ return 0;
+}
+
bool ResourceLoader::is_import_valid(const String &p_path) {
String path = _path_remap(p_path);
diff --git a/core/io/resource_loader.h b/core/io/resource_loader.h
index a71a568569..5deffbca1a 100644
--- a/core/io/resource_loader.h
+++ b/core/io/resource_loader.h
@@ -67,6 +67,7 @@ public:
virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false);
virtual Error rename_dependencies(const String &p_path, const Map<String, String> &p_map) { return OK; }
virtual bool is_import_valid(const String &p_path) const { return true; }
+ virtual int get_import_order(const String &p_path) const { return 0; }
virtual ~ResourceFormatLoader() {}
};
@@ -110,6 +111,7 @@ public:
static void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false);
static Error rename_dependencies(const String &p_path, const Map<String, String> &p_map);
static bool is_import_valid(const String &p_path);
+ static int get_import_order(const String &p_path);
static void set_timestamp_on_load(bool p_timestamp) { timestamp_on_load = p_timestamp; }
diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp
index f4f81f0807..2583eb369d 100644
--- a/core/io/stream_peer.cpp
+++ b/core/io/stream_peer.cpp
@@ -405,9 +405,9 @@ void StreamPeer::_bind_methods() {
void StreamPeerBuffer::_bind_methods() {
- ClassDB::bind_method(D_METHOD("seek", "pos"), &StreamPeerBuffer::seek);
+ ClassDB::bind_method(D_METHOD("seek", "position"), &StreamPeerBuffer::seek);
ClassDB::bind_method(D_METHOD("get_size"), &StreamPeerBuffer::get_size);
- ClassDB::bind_method(D_METHOD("get_pos"), &StreamPeerBuffer::get_pos);
+ ClassDB::bind_method(D_METHOD("get_position"), &StreamPeerBuffer::get_position);
ClassDB::bind_method(D_METHOD("resize", "size"), &StreamPeerBuffer::resize);
ClassDB::bind_method(D_METHOD("set_data_array", "data"), &StreamPeerBuffer::set_data_array);
ClassDB::bind_method(D_METHOD("get_data_array"), &StreamPeerBuffer::get_data_array);
@@ -484,7 +484,7 @@ int StreamPeerBuffer::get_size() const {
return data.size();
}
-int StreamPeerBuffer::get_pos() const {
+int StreamPeerBuffer::get_position() const {
return pointer;
}
diff --git a/core/io/stream_peer.h b/core/io/stream_peer.h
index 1ee997c123..b120d18501 100644
--- a/core/io/stream_peer.h
+++ b/core/io/stream_peer.h
@@ -111,7 +111,7 @@ public:
void seek(int p_pos);
int get_size() const;
- int get_pos() const;
+ int get_position() const;
void resize(int p_size);
void set_data_array(const PoolVector<uint8_t> &p_data);
diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp
index 3a4be7cd13..8ae68183d7 100644
--- a/core/io/xml_parser.cpp
+++ b/core/io/xml_parser.cpp
@@ -369,7 +369,7 @@ void XMLParser::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_empty"), &XMLParser::is_empty);
ClassDB::bind_method(D_METHOD("get_current_line"), &XMLParser::get_current_line);
ClassDB::bind_method(D_METHOD("skip_section"), &XMLParser::skip_section);
- ClassDB::bind_method(D_METHOD("seek", "pos"), &XMLParser::seek);
+ ClassDB::bind_method(D_METHOD("seek", "position"), &XMLParser::seek);
ClassDB::bind_method(D_METHOD("open", "file"), &XMLParser::open);
ClassDB::bind_method(D_METHOD("open_buffer", "buffer"), &XMLParser::open_buffer);
diff --git a/core/io/zip_io.h b/core/io/zip_io.h
index 8cf971ee08..ce3c919b77 100644
--- a/core/io/zip_io.h
+++ b/core/io/zip_io.h
@@ -72,7 +72,7 @@ static uLong zipio_write(voidpf opaque, voidpf stream, const void *buf, uLong si
static long zipio_tell(voidpf opaque, voidpf stream) {
FileAccess *f = *(FileAccess **)opaque;
- return f->get_pos();
+ return f->get_position();
};
static long zipio_seek(voidpf opaque, voidpf stream, uLong offset, int origin) {
@@ -83,7 +83,7 @@ static long zipio_seek(voidpf opaque, voidpf stream, uLong offset, int origin) {
switch (origin) {
case ZLIB_FILEFUNC_SEEK_CUR:
- pos = f->get_pos() + offset;
+ pos = f->get_position() + offset;
break;
case ZLIB_FILEFUNC_SEEK_END:
pos = f->get_len() + offset;
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp
index d1afcec18f..4f80fb2491 100644
--- a/core/math/a_star.cpp
+++ b/core/math/a_star.cpp
@@ -58,7 +58,7 @@ void AStar::add_point(int p_id, const Vector3 &p_pos, real_t p_weight_scale) {
}
}
-Vector3 AStar::get_point_pos(int p_id) const {
+Vector3 AStar::get_point_position(int p_id) const {
ERR_FAIL_COND_V(!points.has(p_id), Vector3());
@@ -171,7 +171,7 @@ int AStar::get_closest_point(const Vector3 &p_point) const {
return closest_id;
}
-Vector3 AStar::get_closest_pos_in_segment(const Vector3 &p_point) const {
+Vector3 AStar::get_closest_position_in_segment(const Vector3 &p_point) const {
real_t closest_dist = 1e20;
bool found = false;
@@ -412,8 +412,8 @@ PoolVector<int> AStar::get_id_path(int p_from_id, int p_to_id) {
void AStar::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_available_point_id"), &AStar::get_available_point_id);
- ClassDB::bind_method(D_METHOD("add_point", "id", "pos", "weight_scale"), &AStar::add_point, DEFVAL(1.0));
- ClassDB::bind_method(D_METHOD("get_point_pos", "id"), &AStar::get_point_pos);
+ ClassDB::bind_method(D_METHOD("add_point", "id", "position", "weight_scale"), &AStar::add_point, DEFVAL(1.0));
+ ClassDB::bind_method(D_METHOD("get_point_position", "id"), &AStar::get_point_position);
ClassDB::bind_method(D_METHOD("get_point_weight_scale", "id"), &AStar::get_point_weight_scale);
ClassDB::bind_method(D_METHOD("remove_point", "id"), &AStar::remove_point);
ClassDB::bind_method(D_METHOD("has_point", "id"), &AStar::has_point);
@@ -425,8 +425,8 @@ void AStar::_bind_methods() {
ClassDB::bind_method(D_METHOD("clear"), &AStar::clear);
- ClassDB::bind_method(D_METHOD("get_closest_point", "to_pos"), &AStar::get_closest_point);
- ClassDB::bind_method(D_METHOD("get_closest_pos_in_segment", "to_pos"), &AStar::get_closest_pos_in_segment);
+ ClassDB::bind_method(D_METHOD("get_closest_point", "to_position"), &AStar::get_closest_point);
+ ClassDB::bind_method(D_METHOD("get_closest_position_in_segment", "to_position"), &AStar::get_closest_position_in_segment);
ClassDB::bind_method(D_METHOD("get_point_path", "from_id", "to_id"), &AStar::get_point_path);
ClassDB::bind_method(D_METHOD("get_id_path", "from_id", "to_id"), &AStar::get_id_path);
diff --git a/core/math/a_star.h b/core/math/a_star.h
index 38d13d510b..2c1e2e2cf7 100644
--- a/core/math/a_star.h
+++ b/core/math/a_star.h
@@ -101,7 +101,7 @@ public:
int get_available_point_id() const;
void add_point(int p_id, const Vector3 &p_pos, real_t p_weight_scale = 1);
- Vector3 get_point_pos(int p_id) const;
+ Vector3 get_point_position(int p_id) const;
real_t get_point_weight_scale(int p_id) const;
void remove_point(int p_id);
bool has_point(int p_id) const;
@@ -114,7 +114,7 @@ public:
void clear();
int get_closest_point(const Vector3 &p_point) const;
- Vector3 get_closest_pos_in_segment(const Vector3 &p_point) const;
+ Vector3 get_closest_position_in_segment(const Vector3 &p_point) const;
PoolVector<Vector3> get_point_path(int p_from_id, int p_to_id);
PoolVector<int> get_id_path(int p_from_id, int p_to_id);
diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp
index 7132b6573e..2c587762e8 100644
--- a/core/math/camera_matrix.cpp
+++ b/core/math/camera_matrix.cpp
@@ -577,7 +577,7 @@ real_t CameraMatrix::get_fov() const {
if ((matrix[8] == 0) && (matrix[9] == 0)) {
return Math::rad2deg(Math::acos(Math::abs(right_plane.normal.x))) * 2.0;
} else {
- // our frustum is asymetrical need to calculate the left planes angle seperately..
+ // our frustum is asymmetrical need to calculate the left planes angle separately..
Plane left_plane = Plane(matrix[3] + matrix[0],
matrix[7] + matrix[4],
matrix[11] + matrix[8],
diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h
index 9651e37f3e..d63da322a5 100644
--- a/core/math/math_funcs.h
+++ b/core/math/math_funcs.h
@@ -104,8 +104,44 @@ public:
static _ALWAYS_INLINE_ double exp(double p_x) { return ::exp(p_x); }
static _ALWAYS_INLINE_ float exp(float p_x) { return ::expf(p_x); }
- static _ALWAYS_INLINE_ bool is_nan(double p_val) { return (p_val != p_val); }
- static _ALWAYS_INLINE_ bool is_nan(float p_val) { return (p_val != p_val); }
+ static _ALWAYS_INLINE_ bool is_nan(double p_val) {
+#ifdef _MSC_VER
+ return _isnan(p_val);
+#elif defined(__GNUC__) && __GNUC__ < 6
+ union {
+ uint64_t u;
+ double f;
+ } ieee754;
+ ieee754.f = p_val;
+ // (unsigned)(0x7ff0000000000001 >> 32) : 0x7ff00000
+ return ((((unsigned)(ieee754.u >> 32) & 0x7fffffff) + ((unsigned)ieee754.u != 0)) > 0x7ff00000);
+#else
+ return isnan(p_val);
+#endif
+ }
+
+ static _ALWAYS_INLINE_ bool is_nan(float p_val) {
+#ifdef _MSC_VER
+ return _isnan(p_val);
+#elif defined(__GNUC__) && __GNUC__ < 6
+ union {
+ uint32_t u;
+ float f;
+ } ieee754;
+ ieee754.f = p_val;
+ // -----------------------------------
+ // (single-precision floating-point)
+ // NaN : s111 1111 1xxx xxxx xxxx xxxx xxxx xxxx
+ // : (> 0x7f800000)
+ // where,
+ // s : sign
+ // x : non-zero number
+ // -----------------------------------
+ return ((ieee754.u & 0x7fffffff) > 0x7f800000);
+#else
+ return isnan(p_val);
+#endif
+ }
static _ALWAYS_INLINE_ bool is_inf(double p_val) {
#ifdef _MSC_VER
diff --git a/core/oa_hash_map.h b/core/oa_hash_map.h
new file mode 100644
index 0000000000..66a1e348a1
--- /dev/null
+++ b/core/oa_hash_map.h
@@ -0,0 +1,593 @@
+/*************************************************************************/
+/* oa_hash_map.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 OA_HASH_MAP_H
+#define OA_HASH_MAP_H
+
+#include "hashfuncs.h"
+#include "math_funcs.h"
+#include "os/copymem.h"
+#include "os/memory.h"
+
+// uncomment this to disable intial local storage.
+#define OA_HASH_MAP_INITIAL_LOCAL_STORAGE
+
+/**
+ * This class implements a hash map datastructure that uses open addressing with
+ * local probing.
+ *
+ * It can give huge performance improvements over a chained HashMap because of
+ * the increased data locality.
+ *
+ * Because of that locality property it's important to not use "large" value
+ * types as the "TData" type. If TData values are too big it can cause more
+ * cache misses then chaining. If larger values are needed then storing those
+ * in a separate array and using pointers or indices to reference them is the
+ * better solution.
+ *
+ * This hash map also implements real-time incremental rehashing.
+ *
+ */
+template <class TKey, class TData,
+ uint16_t INITIAL_NUM_ELEMENTS = 64,
+ class Hasher = HashMapHasherDefault,
+ class Comparator = HashMapComparatorDefault<TKey> >
+class OAHashMap {
+
+private:
+#ifdef OA_HASH_MAP_INITIAL_LOCAL_STORAGE
+ TData local_data[INITIAL_NUM_ELEMENTS];
+ TKey local_keys[INITIAL_NUM_ELEMENTS];
+ uint32_t local_hashes[INITIAL_NUM_ELEMENTS];
+ uint8_t local_flags[INITIAL_NUM_ELEMENTS / 4 + (INITIAL_NUM_ELEMENTS % 4 != 0 ? 1 : 0)];
+#endif
+
+ struct {
+ TData *data;
+ TKey *keys;
+ uint32_t *hashes;
+
+ // This is actually an array of bits, 4 bit pairs per octet.
+ // | ba ba ba ba | ba ba ba ba | ....
+ //
+ // if a is set it means that there is an element present.
+ // if b is set it means that an element was deleted. This is needed for
+ // the local probing to work without relocating any succeeding and
+ // colliding entries.
+ uint8_t *flags;
+
+ uint32_t capacity;
+ } table, old_table;
+
+ bool is_rehashing;
+ uint32_t rehash_position;
+ uint32_t rehash_amount;
+
+ uint32_t elements;
+
+ /* Methods */
+
+ // returns true if the value already existed, false if it's a new entry
+ bool _raw_set_with_hash(uint32_t p_hash, const TKey &p_key, const TData &p_data) {
+ for (int i = 0; i < table.capacity; i++) {
+
+ int pos = (p_hash + i) % table.capacity;
+
+ int flags_pos = pos / 4;
+ int flags_pos_offset = pos % 4;
+
+ bool is_filled_flag = table.flags[flags_pos] & (1 << (2 * flags_pos_offset));
+ bool is_deleted_flag = table.flags[flags_pos] & (1 << (2 * flags_pos_offset + 1));
+
+ if (is_filled_flag) {
+ if (table.hashes[pos] == p_hash && Comparator::compare(table.keys[pos], p_key)) {
+ table.data[pos] = p_data;
+ return true;
+ }
+ continue;
+ }
+
+ table.keys[pos] = p_key;
+ table.data[pos] = p_data;
+ table.hashes[pos] = p_hash;
+
+ table.flags[flags_pos] |= (1 << (2 * flags_pos_offset));
+ table.flags[flags_pos] &= ~(1 << (2 * flags_pos_offset + 1));
+
+ return false;
+ }
+ return false;
+ }
+
+public:
+ _FORCE_INLINE_ uint32_t get_capacity() const { return table.capacity; }
+ _FORCE_INLINE_ uint32_t get_num_elements() const { return elements; }
+
+ void set(const TKey &p_key, const TData &p_data) {
+
+ uint32_t hash = Hasher::hash(p_key);
+
+ // We don't progress the rehashing if the table just got resized
+ // to keep the cost of this function low.
+ if (is_rehashing) {
+
+ // rehash progress
+
+ for (int i = 0; i <= rehash_amount && rehash_position < old_table.capacity; rehash_position++) {
+
+ int flags_pos = rehash_position / 4;
+ int flags_pos_offset = rehash_position % 4;
+
+ bool is_filled_flag = (old_table.flags[flags_pos] & (1 << (2 * flags_pos_offset))) > 0;
+ bool is_deleted_flag = (old_table.flags[flags_pos] & (1 << (2 * flags_pos_offset + 1))) > 0;
+
+ if (is_filled_flag) {
+ _raw_set_with_hash(old_table.hashes[rehash_position], old_table.keys[rehash_position], old_table.data[rehash_position]);
+
+ old_table.keys[rehash_position].~TKey();
+ old_table.data[rehash_position].~TData();
+
+ memnew_placement(&old_table.keys[rehash_position], TKey);
+ memnew_placement(&old_table.data[rehash_position], TData);
+
+ old_table.flags[flags_pos] &= ~(1 << (2 * flags_pos_offset));
+ old_table.flags[flags_pos] |= (1 << (2 * flags_pos_offset + 1));
+ }
+ }
+
+ if (rehash_position >= old_table.capacity) {
+
+ // wohooo, we can get rid of the old table.
+ is_rehashing = false;
+
+#ifdef OA_HASH_MAP_INITIAL_LOCAL_STORAGE
+ if (old_table.data == local_data) {
+ // Everything is local, so no cleanup :P
+ } else
+#endif
+ {
+ memdelete_arr(old_table.data);
+ memdelete_arr(old_table.keys);
+ memdelete_arr(old_table.hashes);
+ memdelete_arr(old_table.flags);
+ }
+ }
+ }
+
+ // Table is almost full, resize and start rehashing process.
+ if (elements >= table.capacity * 0.7) {
+
+ old_table.capacity = table.capacity;
+ old_table.data = table.data;
+ old_table.flags = table.flags;
+ old_table.hashes = table.hashes;
+ old_table.keys = table.keys;
+
+ table.capacity = old_table.capacity * 2;
+
+ table.data = memnew_arr(TData, table.capacity);
+ table.flags = memnew_arr(uint8_t, table.capacity / 4 + (table.capacity % 4 != 0 ? 1 : 0));
+ table.hashes = memnew_arr(uint32_t, table.capacity);
+ table.keys = memnew_arr(TKey, table.capacity);
+
+ zeromem(table.flags, table.capacity / 4 + (table.capacity % 4 != 0 ? 1 : 0));
+
+ is_rehashing = true;
+ rehash_position = 0;
+ rehash_amount = (elements * 2) / (table.capacity * 0.7 - old_table.capacity);
+ }
+
+ if (!_raw_set_with_hash(hash, p_key, p_data))
+ elements++;
+ }
+
+ /**
+ * returns true if the value was found, false otherwise.
+ *
+ * if r_data is not NULL then the value will be written to the object
+ * it points to.
+ */
+ bool lookup(const TKey &p_key, TData *r_data) {
+
+ uint32_t hash = Hasher::hash(p_key);
+
+ bool check_old_table = is_rehashing;
+ bool check_new_table = true;
+
+ // search for the key and return the value associated with it
+ //
+ // if we're rehashing we need to check both the old and the
+ // current table. If we find a value in the old table we still
+ // need to continue searching in the new table as it might have
+ // been added after
+
+ TData *value = NULL;
+
+ for (int i = 0; i < table.capacity; i++) {
+
+ if (!check_new_table && !check_old_table) {
+
+ break;
+ }
+
+ // if we're rehashing check the old table
+ if (check_old_table && i < old_table.capacity) {
+
+ int pos = (hash + i) % old_table.capacity;
+
+ int flags_pos = pos / 4;
+ int flags_pos_offset = pos % 4;
+
+ bool is_filled_flag = (old_table.flags[flags_pos] & (1 << (2 * flags_pos_offset))) > 0;
+ bool is_deleted_flag = (old_table.flags[flags_pos] & (1 << (2 * flags_pos_offset + 1))) > 0;
+
+ if (is_filled_flag) {
+ // found our entry?
+ if (old_table.hashes[pos] == hash && Comparator::compare(old_table.keys[pos], p_key)) {
+ value = &old_table.data[pos];
+ check_old_table = false;
+ }
+ } else if (!is_deleted_flag) {
+
+ // we hit an empty field here, we don't
+ // need to further check this old table
+ // because we know it's not in here.
+
+ check_old_table = false;
+ }
+ }
+
+ if (check_new_table) {
+
+ int pos = (hash + i) % table.capacity;
+
+ int flags_pos = pos / 4;
+ int flags_pos_offset = pos % 4;
+
+ bool is_filled_flag = (table.flags[flags_pos] & (1 << (2 * flags_pos_offset))) > 0;
+ bool is_deleted_flag = (table.flags[flags_pos] & (1 << (2 * flags_pos_offset + 1))) > 0;
+
+ if (is_filled_flag) {
+ // found our entry?
+ if (table.hashes[pos] == hash && Comparator::compare(table.keys[pos], p_key)) {
+ if (r_data != NULL)
+ *r_data = table.data[pos];
+ return true;
+ }
+ continue;
+ } else if (is_deleted_flag) {
+ continue;
+ } else if (value != NULL) {
+
+ // We found a value in the old table
+ if (r_data != NULL)
+ *r_data = *value;
+ return true;
+ } else {
+ check_new_table = false;
+ }
+ }
+ }
+
+ if (value != NULL) {
+ if (r_data != NULL)
+ *r_data = *value;
+ return true;
+ }
+ return false;
+ }
+
+ _FORCE_INLINE_ bool has(const TKey &p_key) {
+ return lookup(p_key, NULL);
+ }
+
+ void remove(const TKey &p_key) {
+ uint32_t hash = Hasher::hash(p_key);
+
+ bool check_old_table = is_rehashing;
+ bool check_new_table = true;
+
+ for (int i = 0; i < table.capacity; i++) {
+
+ if (!check_new_table && !check_old_table) {
+ return;
+ }
+
+ // if we're rehashing check the old table
+ if (check_old_table && i < old_table.capacity) {
+
+ int pos = (hash + i) % old_table.capacity;
+
+ int flags_pos = pos / 4;
+ int flags_pos_offset = pos % 4;
+
+ bool is_filled_flag = (old_table.flags[flags_pos] & (1 << (2 * flags_pos_offset))) > 0;
+ bool is_deleted_flag = (old_table.flags[flags_pos] & (1 << (2 * flags_pos_offset + 1))) > 0;
+
+ if (is_filled_flag) {
+ // found our entry?
+ if (old_table.hashes[pos] == hash && Comparator::compare(old_table.keys[pos], p_key)) {
+ old_table.keys[pos].~TKey();
+ old_table.data[pos].~TData();
+
+ memnew_placement(&old_table.keys[pos], TKey);
+ memnew_placement(&old_table.data[pos], TData);
+
+ old_table.flags[flags_pos] &= ~(1 << (2 * flags_pos_offset));
+ old_table.flags[flags_pos] |= (1 << (2 * flags_pos_offset + 1));
+
+ elements--;
+ return;
+ }
+ } else if (!is_deleted_flag) {
+
+ // we hit an empty field here, we don't
+ // need to further check this old table
+ // because we know it's not in here.
+
+ check_old_table = false;
+ }
+ }
+
+ if (check_new_table) {
+
+ int pos = (hash + i) % table.capacity;
+
+ int flags_pos = pos / 4;
+ int flags_pos_offset = pos % 4;
+
+ bool is_filled_flag = (table.flags[flags_pos] & (1 << (2 * flags_pos_offset))) > 0;
+ bool is_deleted_flag = (table.flags[flags_pos] & (1 << (2 * flags_pos_offset + 1))) > 0;
+
+ if (is_filled_flag) {
+ // found our entry?
+ if (table.hashes[pos] == hash && Comparator::compare(table.keys[pos], p_key)) {
+ table.keys[pos].~TKey();
+ table.data[pos].~TData();
+
+ memnew_placement(&table.keys[pos], TKey);
+ memnew_placement(&table.data[pos], TData);
+
+ table.flags[flags_pos] &= ~(1 << (2 * flags_pos_offset));
+ table.flags[flags_pos] |= (1 << (2 * flags_pos_offset + 1));
+
+ // don't return here, this value might still be in the old table
+ // if it was already relocated.
+
+ elements--;
+ return;
+ }
+ continue;
+ } else if (is_deleted_flag) {
+ continue;
+ } else {
+ check_new_table = false;
+ }
+ }
+ }
+ }
+
+ struct Iterator {
+ bool valid;
+
+ uint32_t hash;
+
+ const TKey *key;
+ const TData *data;
+
+ private:
+ friend class OAHashMap;
+ bool was_from_old_table;
+ };
+
+ Iterator iter() const {
+ Iterator it;
+
+ it.valid = false;
+ it.was_from_old_table = false;
+
+ bool check_old_table = is_rehashing;
+
+ for (int i = 0; i < table.capacity; i++) {
+
+ // if we're rehashing check the old table first
+ if (check_old_table && i < old_table.capacity) {
+
+ int pos = i;
+
+ int flags_pos = pos / 4;
+ int flags_pos_offset = pos % 4;
+
+ bool is_filled_flag = (old_table.flags[flags_pos] & (1 << (2 * flags_pos_offset))) > 0;
+
+ if (is_filled_flag) {
+ it.valid = true;
+ it.hash = old_table.hashes[pos];
+ it.data = &old_table.data[pos];
+ it.key = &old_table.keys[pos];
+
+ it.was_from_old_table = true;
+
+ return it;
+ }
+ }
+
+ {
+
+ int pos = i;
+
+ int flags_pos = pos / 4;
+ int flags_pos_offset = pos % 4;
+
+ bool is_filled_flag = (table.flags[flags_pos] & (1 << (2 * flags_pos_offset))) > 0;
+
+ if (is_filled_flag) {
+ it.valid = true;
+ it.hash = table.hashes[pos];
+ it.data = &table.data[pos];
+ it.key = &table.keys[pos];
+
+ return it;
+ }
+ }
+ }
+
+ return it;
+ }
+
+ Iterator next_iter(const Iterator &p_iter) const {
+ if (!p_iter.valid) {
+ return p_iter;
+ }
+
+ Iterator it;
+
+ it.valid = false;
+ it.was_from_old_table = false;
+
+ bool check_old_table = is_rehashing;
+
+ // we use this to skip the first check or not
+ bool was_from_old_table = p_iter.was_from_old_table;
+
+ int prev_index = (p_iter.data - (p_iter.was_from_old_table ? old_table.data : table.data));
+
+ if (!was_from_old_table) {
+ prev_index++;
+ }
+
+ for (int i = prev_index; i < table.capacity; i++) {
+
+ // if we're rehashing check the old table first
+ if (check_old_table && i < old_table.capacity && !was_from_old_table) {
+
+ int pos = i;
+
+ int flags_pos = pos / 4;
+ int flags_pos_offset = pos % 4;
+
+ bool is_filled_flag = (old_table.flags[flags_pos] & (1 << (2 * flags_pos_offset))) > 0;
+
+ if (is_filled_flag) {
+ it.valid = true;
+ it.hash = old_table.hashes[pos];
+ it.data = &old_table.data[pos];
+ it.key = &old_table.keys[pos];
+
+ it.was_from_old_table = true;
+
+ return it;
+ }
+ }
+
+ was_from_old_table = false;
+
+ {
+ int pos = i;
+
+ int flags_pos = pos / 4;
+ int flags_pos_offset = pos % 4;
+
+ bool is_filled_flag = (table.flags[flags_pos] & (1 << (2 * flags_pos_offset))) > 0;
+
+ if (is_filled_flag) {
+ it.valid = true;
+ it.hash = table.hashes[pos];
+ it.data = &table.data[pos];
+ it.key = &table.keys[pos];
+
+ return it;
+ }
+ }
+ }
+
+ return it;
+ }
+
+ OAHashMap(uint32_t p_initial_capacity = INITIAL_NUM_ELEMENTS) {
+
+#ifdef OA_HASH_MAP_INITIAL_LOCAL_STORAGE
+
+ if (p_initial_capacity <= INITIAL_NUM_ELEMENTS) {
+ table.data = local_data;
+ table.keys = local_keys;
+ table.hashes = local_hashes;
+ table.flags = local_flags;
+
+ zeromem(table.flags, INITIAL_NUM_ELEMENTS / 4 + (INITIAL_NUM_ELEMENTS % 4 != 0 ? 1 : 0));
+
+ table.capacity = INITIAL_NUM_ELEMENTS;
+ elements = 0;
+ } else
+#endif
+ {
+ table.data = memnew_arr(TData, p_initial_capacity);
+ table.keys = memnew_arr(TKey, p_initial_capacity);
+ table.hashes = memnew_arr(uint32_t, p_initial_capacity);
+ table.flags = memnew_arr(uint8_t, p_initial_capacity / 4 + (p_initial_capacity % 4 != 0 ? 1 : 0));
+
+ zeromem(table.flags, p_initial_capacity / 4 + (p_initial_capacity % 4 != 0 ? 1 : 0));
+
+ table.capacity = p_initial_capacity;
+ elements = 0;
+ }
+
+ is_rehashing = false;
+ rehash_position = 0;
+ }
+
+ ~OAHashMap() {
+#ifdef OA_HASH_MAP_INITIAL_LOCAL_STORAGE
+ if (table.capacity <= INITIAL_NUM_ELEMENTS) {
+ return; // Everything is local, so no cleanup :P
+ }
+#endif
+ if (is_rehashing) {
+
+#ifdef OA_HASH_MAP_INITIAL_LOCAL_STORAGE
+ if (old_table.data == local_data) {
+ // Everything is local, so no cleanup :P
+ } else
+#endif
+ {
+ memdelete_arr(old_table.data);
+ memdelete_arr(old_table.keys);
+ memdelete_arr(old_table.hashes);
+ memdelete_arr(old_table.flags);
+ }
+ }
+
+ memdelete_arr(table.data);
+ memdelete_arr(table.keys);
+ memdelete_arr(table.hashes);
+ memdelete_arr(table.flags);
+ }
+};
+
+#endif
diff --git a/core/object.cpp b/core/object.cpp
index 23e32a214a..b1770f1d7a 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -277,32 +277,32 @@ MethodInfo::MethodInfo(Variant::Type ret, const String &p_name, const PropertyIn
MethodInfo::MethodInfo(const PropertyInfo &p_ret, const String &p_name)
: name(p_name),
flags(METHOD_FLAG_NORMAL),
+ return_val(p_ret),
id(0) {
- return_val = p_ret;
}
MethodInfo::MethodInfo(const PropertyInfo &p_ret, const String &p_name, const PropertyInfo &p_param1)
: name(p_name),
+ return_val(p_ret),
flags(METHOD_FLAG_NORMAL),
id(0) {
- return_val = p_ret;
arguments.push_back(p_param1);
}
MethodInfo::MethodInfo(const PropertyInfo &p_ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2)
: name(p_name),
+ return_val(p_ret),
flags(METHOD_FLAG_NORMAL),
id(0) {
- return_val = p_ret;
arguments.push_back(p_param1);
arguments.push_back(p_param2);
}
MethodInfo::MethodInfo(const PropertyInfo &p_ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3)
: name(p_name),
+ return_val(p_ret),
flags(METHOD_FLAG_NORMAL),
id(0) {
- return_val = p_ret;
arguments.push_back(p_param1);
arguments.push_back(p_param2);
arguments.push_back(p_param3);
@@ -310,9 +310,9 @@ MethodInfo::MethodInfo(const PropertyInfo &p_ret, const String &p_name, const Pr
MethodInfo::MethodInfo(const PropertyInfo &p_ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3, const PropertyInfo &p_param4)
: name(p_name),
+ return_val(p_ret),
flags(METHOD_FLAG_NORMAL),
id(0) {
- return_val = p_ret;
arguments.push_back(p_param1);
arguments.push_back(p_param2);
arguments.push_back(p_param3);
@@ -321,9 +321,9 @@ MethodInfo::MethodInfo(const PropertyInfo &p_ret, const String &p_name, const Pr
MethodInfo::MethodInfo(const PropertyInfo &p_ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3, const PropertyInfo &p_param4, const PropertyInfo &p_param5)
: name(p_name),
+ return_val(p_ret),
flags(METHOD_FLAG_NORMAL),
id(0) {
- return_val = p_ret;
arguments.push_back(p_param1);
arguments.push_back(p_param2);
arguments.push_back(p_param3);
diff --git a/core/object.h b/core/object.h
index 644e2b8270..3070439138 100644
--- a/core/object.h
+++ b/core/object.h
@@ -148,6 +148,7 @@ struct PropertyInfo {
hint(PROPERTY_HINT_NONE),
usage(PROPERTY_USAGE_DEFAULT) {
}
+
PropertyInfo(Variant::Type p_type, const String p_name, PropertyHint p_hint = PROPERTY_HINT_NONE, const String &p_hint_string = "", uint32_t p_usage = PROPERTY_USAGE_DEFAULT, const StringName &p_class_name = StringName())
: type(p_type),
name(p_name),
@@ -161,12 +162,12 @@ struct PropertyInfo {
class_name = p_class_name;
}
}
+
PropertyInfo(const StringName &p_class_name)
: type(Variant::OBJECT),
+ class_name(p_class_name),
hint(PROPERTY_HINT_NONE),
usage(PROPERTY_USAGE_DEFAULT) {
-
- class_name = p_class_name;
}
bool operator<(const PropertyInfo &p_info) const {
diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp
index f24d6d16ca..0875f78478 100644
--- a/core/os/dir_access.cpp
+++ b/core/os/dir_access.cpp
@@ -292,7 +292,7 @@ String DirAccess::get_full_path(const String &p_path, AccessType p_access) {
return full;
}
-Error DirAccess::copy(String p_from, String p_to) {
+Error DirAccess::copy(String p_from, String p_to, int chmod_flags) {
//printf("copy %s -> %s\n",p_from.ascii().get_data(),p_to.ascii().get_data());
Error err;
@@ -312,7 +312,7 @@ Error DirAccess::copy(String p_from, String p_to) {
}
fsrc->seek_end(0);
- int size = fsrc->get_pos();
+ int size = fsrc->get_position();
fsrc->seek(0);
err = OK;
while (size--) {
@@ -329,6 +329,11 @@ Error DirAccess::copy(String p_from, String p_to) {
fdst->store_8(fsrc->get_8());
}
+ if (err == OK && chmod_flags != -1) {
+ fdst->close();
+ err = fdst->_chmod(p_to, chmod_flags);
+ }
+
memdelete(fsrc);
memdelete(fdst);
diff --git a/core/os/dir_access.h b/core/os/dir_access.h
index 6ad8b4c49b..7fa3ce5cf1 100644
--- a/core/os/dir_access.h
+++ b/core/os/dir_access.h
@@ -89,7 +89,7 @@ public:
static bool exists(String p_dir);
virtual size_t get_space_left() = 0;
- virtual Error copy(String p_from, String p_to);
+ virtual Error copy(String p_from, String p_to, int chmod_flags = -1);
virtual Error rename(String p_from, String p_to) = 0;
virtual Error remove(String p_name) = 0;
diff --git a/core/os/file_access.h b/core/os/file_access.h
index 8e5728f525..34e7549fa3 100644
--- a/core/os/file_access.h
+++ b/core/os/file_access.h
@@ -90,7 +90,7 @@ public:
virtual void seek(size_t p_position) = 0; ///< seek to a given position
virtual void seek_end(int64_t p_position = 0) = 0; ///< seek from the end of file
- virtual size_t get_pos() const = 0; ///< get position in the file
+ virtual size_t get_position() const = 0; ///< get position in the file
virtual size_t get_len() const = 0; ///< get size of the file
virtual bool eof_reached() const = 0; ///< reading passed EOF
@@ -140,6 +140,8 @@ public:
virtual Error reopen(const String &p_path, int p_mode_flags); ///< does not change the AccessType
+ virtual Error _chmod(const String &p_path, int p_mod) { return FAILED; }
+
static FileAccess *create(AccessType p_access); /// Create a file access (for the current platform) this is the only portable way of accessing files.
static FileAccess *create_for_path(const String &p_path);
static FileAccess *open(const String &p_path, int p_mode_flags, Error *r_error = NULL); /// Create a file access (for the current platform) this is the only portable way of accessing files.
diff --git a/core/os/input.cpp b/core/os/input.cpp
index 65752662d7..a4b82299a7 100644
--- a/core/os/input.cpp
+++ b/core/os/input.cpp
@@ -80,7 +80,7 @@ void Input::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_mouse_button_mask"), &Input::get_mouse_button_mask);
ClassDB::bind_method(D_METHOD("set_mouse_mode", "mode"), &Input::set_mouse_mode);
ClassDB::bind_method(D_METHOD("get_mouse_mode"), &Input::get_mouse_mode);
- ClassDB::bind_method(D_METHOD("warp_mouse_pos", "to"), &Input::warp_mouse_pos);
+ ClassDB::bind_method(D_METHOD("warp_mouse_position", "to"), &Input::warp_mouse_position);
ClassDB::bind_method(D_METHOD("action_press", "action"), &Input::action_press);
ClassDB::bind_method(D_METHOD("action_release", "action"), &Input::action_release);
ClassDB::bind_method(D_METHOD("set_custom_mouse_cursor", "image", "hotspot"), &Input::set_custom_mouse_cursor, DEFVAL(Vector2()));
diff --git a/core/os/input.h b/core/os/input.h
index f98b97e647..97d3bef4f9 100644
--- a/core/os/input.h
+++ b/core/os/input.h
@@ -81,7 +81,7 @@ public:
virtual Point2 get_last_mouse_speed() const = 0;
virtual int get_mouse_button_mask() const = 0;
- virtual void warp_mouse_pos(const Vector2 &p_to) = 0;
+ virtual void warp_mouse_position(const Vector2 &p_to) = 0;
virtual Point2i warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, const Rect2 &p_rect) = 0;
virtual Vector3 get_gravity() const = 0;
diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp
index 88037859aa..bef98ac3f2 100644
--- a/core/os/input_event.cpp
+++ b/core/os/input_event.cpp
@@ -781,7 +781,7 @@ void InputEventScreenTouch::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_index", "index"), &InputEventScreenTouch::set_index);
ClassDB::bind_method(D_METHOD("get_index"), &InputEventScreenTouch::get_index);
- ClassDB::bind_method(D_METHOD("set_position", "pos"), &InputEventScreenTouch::set_position);
+ ClassDB::bind_method(D_METHOD("set_position", "position"), &InputEventScreenTouch::set_position);
ClassDB::bind_method(D_METHOD("get_position"), &InputEventScreenTouch::get_position);
ClassDB::bind_method(D_METHOD("set_pressed", "pressed"), &InputEventScreenTouch::set_pressed);
diff --git a/core/os/os.h b/core/os/os.h
index 2fc87e44a0..38bbbc0a57 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -156,7 +156,7 @@ public:
virtual void set_mouse_mode(MouseMode p_mode);
virtual MouseMode get_mouse_mode() const;
- virtual void warp_mouse_pos(const Point2 &p_to) {}
+ virtual void warp_mouse_position(const Point2 &p_to) {}
virtual Point2 get_mouse_position() const = 0;
virtual int get_mouse_button_state() const = 0;
virtual void set_window_title(const String &p_title) = 0;
diff --git a/core/project_settings.cpp b/core/project_settings.cpp
index 72d40b42c3..14ebe87dc5 100644
--- a/core/project_settings.cpp
+++ b/core/project_settings.cpp
@@ -307,8 +307,8 @@ Error ProjectSettings::setup(const String &p_path, const String &p_main_pack) {
if (exec_path != "") {
bool found = false;
- // get our filename without our path (note, not using exec_path.get_basename anymore because not all file systems have dots in their file names!)
- String filebase_name = exec_path.get_file();
+ // get our filename without our path (note, using exec_path.get_file before get_basename anymore because not all file systems have dots in their file names!)
+ String filebase_name = exec_path.get_file().get_basename();
// try to open at the location of executable
String datapack_name = exec_path.get_base_dir().plus_file(filebase_name) + ".pck";
@@ -910,7 +910,7 @@ Variant ProjectSettings::property_get_revert(const String &p_name) {
void ProjectSettings::_bind_methods() {
ClassDB::bind_method(D_METHOD("has", "name"), &ProjectSettings::has);
- ClassDB::bind_method(D_METHOD("set_order", "name", "pos"), &ProjectSettings::set_order);
+ 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);
ClassDB::bind_method(D_METHOD("add_property_info", "hint"), &ProjectSettings::_add_property_info_bind);
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index 27c31127a4..0e34a3eea5 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -68,6 +68,7 @@ static _Engine *_engine = NULL;
static _ClassDB *_classdb = NULL;
static _Marshalls *_marshalls = NULL;
static TranslationLoaderPO *resource_format_po = NULL;
+static _JSON *_json = NULL;
static IP *ip = NULL;
@@ -162,6 +163,8 @@ void register_core_types() {
ClassDB::register_class<AStar>();
ClassDB::register_class<EncodedObjectAsID>();
+ ClassDB::register_class<JSONParseResult>();
+
ip = IP::create();
_geometry = memnew(_Geometry);
@@ -172,6 +175,7 @@ void register_core_types() {
_engine = memnew(_Engine);
_classdb = memnew(_ClassDB);
_marshalls = memnew(_Marshalls);
+ _json = memnew(_JSON);
}
void register_core_settings() {
@@ -193,6 +197,7 @@ void register_core_singletons() {
ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("TranslationServer", TranslationServer::get_singleton()));
ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("Input", Input::get_singleton()));
ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("InputMap", InputMap::get_singleton()));
+ ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("JSON", _JSON::get_singleton()));
}
void unregister_core_types() {
@@ -203,6 +208,7 @@ void unregister_core_types() {
memdelete(_engine);
memdelete(_classdb);
memdelete(_marshalls);
+ memdelete(_json);
memdelete(_geometry);
diff --git a/core/set.h b/core/set.h
index f68d78cea1..d91dd9b3ea 100644
--- a/core/set.h
+++ b/core/set.h
@@ -135,7 +135,6 @@ private:
#ifdef GLOBALNIL_DISABLED
memdelete_allocator<Element, A>(_nil);
#endif
- //memdelete_allocator<Element,A>(_root);
}
};
@@ -146,6 +145,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;
@@ -194,8 +194,9 @@ private:
while (node == node->parent->right) {
node = node->parent;
}
+
if (node->parent == _data._root)
- return NULL;
+ return NULL; // No successor, as p_node is the last node.
return node->parent;
}
}
@@ -213,11 +214,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 is the first node.
return node->parent;
}
}
@@ -228,16 +229,15 @@ private:
C less;
while (node != _data._nil) {
-
if (less(p_value, node->value))
node = node->left;
else if (less(node->value, p_value))
node = node->right;
else
- break; // found
+ return node; // found
}
- return (node != _data._nil) ? node : NULL;
+ return NULL;
}
Element *_lower_bound(const T &p_value) const {
@@ -254,21 +254,16 @@ private:
else if (less(node->value, p_value))
node = node->right;
else
- break; // found
+ return node; // found
}
- if (node == _data._nil) {
- if (prev == NULL)
- return NULL;
- if (less(prev->value, p_value)) {
-
- prev = prev->_next;
- }
+ if (prev == NULL)
+ return NULL; // tree empty
- return prev;
+ if (less(prev->value, p_value))
+ prev = prev->_next;
- } else
- return node;
+ return prev;
}
Element *_insert(const T &p_value, bool &r_exists) {
@@ -291,22 +286,21 @@ private:
}
}
- Element *new_node = memnew_allocator(Element, A);
+ r_exists = false;
+ 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)) {
+ if (new_parent == _data._root || less(p_value, new_parent->value)) {
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)
@@ -324,154 +318,159 @@ private:
if (exists)
return new_node;
- Element *node = new_node;
_data.size_cache++;
+ Element *node = new_node;
+ Element *nparent = node->parent;
+ Element *ngrand_parent;
- while (node->parent->color == RED) {
-
- if (node->parent == node->parent->parent->left) {
+ while (nparent->color == RED) {
- Element *aux = node->parent->parent->right;
+ ngrand_parent = nparent->parent;
- if (aux->color == RED) {
- _set_color(node->parent, BLACK);
- _set_color(aux, BLACK);
- _set_color(node->parent->parent, RED);
- node = node->parent->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 == node->parent->right) {
- node = node->parent;
- _rotate_left(node);
+ if (node == nparent->right) {
+ _rotate_left(nparent);
+ node = nparent;
+ nparent = node->parent;
}
- _set_color(node->parent, BLACK);
- _set_color(node->parent->parent, RED);
- _rotate_right(node->parent->parent);
+ _set_color(nparent, BLACK);
+ _set_color(ngrand_parent, RED);
+ _rotate_right(ngrand_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;
+ 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 == node->parent->left) {
- node = node->parent;
- _rotate_right(node);
+ if (node == nparent->left) {
+ _rotate_right(nparent);
+ node = nparent;
+ nparent = node->parent;
}
- _set_color(node->parent, BLACK);
- _set_color(node->parent->parent, RED);
- _rotate_left(node->parent->parent);
+ _set_color(nparent, BLACK);
+ _set_color(ngrand_parent, RED);
+ _rotate_left(ngrand_parent);
}
}
}
+
_set_color(_data._root->left, BLACK);
+
return new_node;
}
void _erase_fix(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(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)
@@ -529,6 +528,7 @@ public:
if (!_data._root)
return NULL;
+
Element *res = _find(p_value);
return res;
}
@@ -549,8 +549,9 @@ public:
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();
@@ -560,9 +561,11 @@ public:
if (!_data._root)
return false;
+
Element *e = find(p_value);
if (!e)
return false;
+
_erase(e);
if (_data.size_cache == 0 && _data._root)
_data._free_root();
@@ -573,6 +576,7 @@ public:
if (!_data._root)
return NULL;
+
Element *e = _data._root->left;
if (e == _data._nil)
return NULL;
@@ -587,6 +591,7 @@ public:
if (!_data._root)
return NULL;
+
Element *e = _data._root->left;
if (e == _data._nil)
return NULL;
@@ -603,10 +608,12 @@ public:
}
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;
@@ -620,7 +627,6 @@ public:
_cleanup_tree(_data._root->left);
_data._root->left = _data._nil;
_data.size_cache = 0;
- _data._nil->parent = _data._nil;
_data._free_root();
}
@@ -633,6 +639,7 @@ public:
_copy_from(p_set);
}
+
_FORCE_INLINE_ Set() {
}
diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp
index 4760047959..27fc73ec63 100644
--- a/core/undo_redo.cpp
+++ b/core/undo_redo.cpp
@@ -503,6 +503,10 @@ void UndoRedo::_bind_methods() {
ClassDB::bind_method(D_METHOD("clear_history"), &UndoRedo::clear_history);
ClassDB::bind_method(D_METHOD("get_current_action_name"), &UndoRedo::get_current_action_name);
ClassDB::bind_method(D_METHOD("get_version"), &UndoRedo::get_version);
+ ClassDB::bind_method(D_METHOD("set_max_steps", "max_steps"), &UndoRedo::set_max_steps);
+ ClassDB::bind_method(D_METHOD("get_max_steps"), &UndoRedo::get_max_steps);
+ ClassDB::bind_method(D_METHOD("redo"), &UndoRedo::redo);
+ ClassDB::bind_method(D_METHOD("undo"), &UndoRedo::undo);
BIND_ENUM_CONSTANT(MERGE_DISABLE);
BIND_ENUM_CONSTANT(MERGE_ENDS);
diff --git a/core/variant.cpp b/core/variant.cpp
index 10d86152ee..52bdd4e22d 100644
--- a/core/variant.cpp
+++ b/core/variant.cpp
@@ -903,9 +903,6 @@ bool Variant::is_one() const {
void Variant::reference(const Variant &p_variant) {
- if (this == &p_variant)
- return;
-
clear();
type = p_variant.type;
@@ -924,17 +921,14 @@ void Variant::reference(const Variant &p_variant) {
case INT: {
_data._int = p_variant._data._int;
-
} break;
case REAL: {
_data._real = p_variant._data._real;
-
} break;
case STRING: {
memnew_placement(_data._mem, String(*reinterpret_cast<const String *>(p_variant._data._mem)));
-
} break;
// math types
@@ -942,33 +936,24 @@ void Variant::reference(const Variant &p_variant) {
case VECTOR2: {
memnew_placement(_data._mem, Vector2(*reinterpret_cast<const Vector2 *>(p_variant._data._mem)));
-
} break;
case RECT2: {
memnew_placement(_data._mem, Rect2(*reinterpret_cast<const Rect2 *>(p_variant._data._mem)));
-
} break;
case TRANSFORM2D: {
_data._transform2d = memnew(Transform2D(*p_variant._data._transform2d));
-
} break;
case VECTOR3: {
memnew_placement(_data._mem, Vector3(*reinterpret_cast<const Vector3 *>(p_variant._data._mem)));
-
} break;
case PLANE: {
memnew_placement(_data._mem, Plane(*reinterpret_cast<const Plane *>(p_variant._data._mem)));
-
} break;
- /*
- case QUAT: {
-
- } break;*/
case RECT3: {
_data._rect3 = memnew(Rect3(*p_variant._data._rect3));
@@ -986,7 +971,6 @@ void Variant::reference(const Variant &p_variant) {
case TRANSFORM: {
_data._transform = memnew(Transform(*p_variant._data._transform));
-
} break;
// misc types
@@ -1058,6 +1042,7 @@ void Variant::reference(const Variant &p_variant) {
default: {}
}
}
+
void Variant::zero() {
switch (type) {
case NIL: break;
@@ -1073,6 +1058,7 @@ void Variant::zero() {
default: this->clear(); break;
}
}
+
void Variant::clear() {
switch (type) {
@@ -1092,12 +1078,10 @@ void Variant::clear() {
case TRANSFORM2D: {
memdelete(_data._transform2d);
-
} break;
case RECT3: {
memdelete(_data._rect3);
-
} break;
case BASIS: {
@@ -1106,14 +1090,12 @@ void Variant::clear() {
case TRANSFORM: {
memdelete(_data._transform);
-
} break;
// misc types
case NODE_PATH: {
reinterpret_cast<NodePath *>(_data._mem)->~NodePath();
-
} break;
case OBJECT: {
@@ -1127,48 +1109,39 @@ void Variant::clear() {
case DICTIONARY: {
reinterpret_cast<Dictionary *>(_data._mem)->~Dictionary();
-
} break;
case ARRAY: {
reinterpret_cast<Array *>(_data._mem)->~Array();
-
} break;
// arrays
case POOL_BYTE_ARRAY: {
reinterpret_cast<PoolVector<uint8_t> *>(_data._mem)->~PoolVector<uint8_t>();
-
} break;
case POOL_INT_ARRAY: {
reinterpret_cast<PoolVector<int> *>(_data._mem)->~PoolVector<int>();
-
} break;
case POOL_REAL_ARRAY: {
reinterpret_cast<PoolVector<real_t> *>(_data._mem)->~PoolVector<real_t>();
-
} break;
case POOL_STRING_ARRAY: {
reinterpret_cast<PoolVector<String> *>(_data._mem)->~PoolVector<String>();
-
} break;
case POOL_VECTOR2_ARRAY: {
reinterpret_cast<PoolVector<Vector2> *>(_data._mem)->~PoolVector<Vector2>();
-
} break;
case POOL_VECTOR3_ARRAY: {
reinterpret_cast<PoolVector<Vector3> *>(_data._mem)->~PoolVector<Vector3>();
-
} break;
case POOL_COLOR_ARRAY: {
reinterpret_cast<PoolVector<Color> *>(_data._mem)->~PoolVector<Color>();
-
} break;
default: {} /* not needed */
}
@@ -2496,7 +2469,135 @@ Variant::Variant(const Vector<Color> &p_array) {
void Variant::operator=(const Variant &p_variant) {
- reference(p_variant);
+ if (this == &p_variant)
+ return;
+
+ if (type != p_variant.type) {
+ reference(p_variant);
+ return;
+ }
+
+ switch (p_variant.type) {
+ case NIL: {
+
+ // none
+ } break;
+
+ // atomic types
+ case BOOL: {
+
+ _data._bool = p_variant._data._bool;
+ } break;
+ case INT: {
+
+ _data._int = p_variant._data._int;
+ } break;
+ case REAL: {
+
+ _data._real = p_variant._data._real;
+ } break;
+ case STRING: {
+
+ *reinterpret_cast<String *>(_data._mem) = *reinterpret_cast<const String *>(p_variant._data._mem);
+ } break;
+
+ // math types
+
+ case VECTOR2: {
+
+ *reinterpret_cast<Vector2 *>(_data._mem) = *reinterpret_cast<const Vector2 *>(p_variant._data._mem);
+ } break;
+ case RECT2: {
+
+ *reinterpret_cast<Rect2 *>(_data._mem) = *reinterpret_cast<const Rect2 *>(p_variant._data._mem);
+ } break;
+ case TRANSFORM2D: {
+
+ *_data._transform2d = *(p_variant._data._transform2d);
+ } break;
+ case VECTOR3: {
+
+ *reinterpret_cast<Vector3 *>(_data._mem) = *reinterpret_cast<const Vector3 *>(p_variant._data._mem);
+ } break;
+ case PLANE: {
+
+ *reinterpret_cast<Plane *>(_data._mem) = *reinterpret_cast<const Plane *>(p_variant._data._mem);
+ } break;
+
+ case RECT3: {
+
+ *_data._rect3 = *(p_variant._data._rect3);
+ } break;
+ case QUAT: {
+
+ *reinterpret_cast<Quat *>(_data._mem) = *reinterpret_cast<const Quat *>(p_variant._data._mem);
+ } break;
+ case BASIS: {
+
+ *_data._basis = *(p_variant._data._basis);
+ } break;
+ case TRANSFORM: {
+
+ *_data._transform = *(p_variant._data._transform);
+ } break;
+
+ // misc types
+ case COLOR: {
+
+ *reinterpret_cast<Color *>(_data._mem) = *reinterpret_cast<const Color *>(p_variant._data._mem);
+ } break;
+ case _RID: {
+
+ *reinterpret_cast<RID *>(_data._mem) = *reinterpret_cast<const RID *>(p_variant._data._mem);
+ } break;
+ case OBJECT: {
+
+ *reinterpret_cast<ObjData *>(_data._mem) = p_variant._get_obj();
+ } break;
+ case NODE_PATH: {
+
+ *reinterpret_cast<NodePath *>(_data._mem) = *reinterpret_cast<const NodePath *>(p_variant._data._mem);
+ } break;
+ case DICTIONARY: {
+
+ *reinterpret_cast<Dictionary *>(_data._mem) = *reinterpret_cast<const Dictionary *>(p_variant._data._mem);
+ } break;
+ case ARRAY: {
+
+ *reinterpret_cast<Array *>(_data._mem) = *reinterpret_cast<const Array *>(p_variant._data._mem);
+ } break;
+
+ // arrays
+ case POOL_BYTE_ARRAY: {
+
+ *reinterpret_cast<PoolVector<uint8_t> *>(_data._mem) = *reinterpret_cast<const PoolVector<uint8_t> *>(p_variant._data._mem);
+ } break;
+ case POOL_INT_ARRAY: {
+
+ *reinterpret_cast<PoolVector<int> *>(_data._mem) = *reinterpret_cast<const PoolVector<int> *>(p_variant._data._mem);
+ } break;
+ case POOL_REAL_ARRAY: {
+
+ *reinterpret_cast<PoolVector<real_t> *>(_data._mem) = *reinterpret_cast<const PoolVector<real_t> *>(p_variant._data._mem);
+ } break;
+ case POOL_STRING_ARRAY: {
+
+ *reinterpret_cast<PoolVector<String> *>(_data._mem) = *reinterpret_cast<const PoolVector<String> *>(p_variant._data._mem);
+ } break;
+ case POOL_VECTOR2_ARRAY: {
+
+ *reinterpret_cast<PoolVector<Vector2> *>(_data._mem) = *reinterpret_cast<const PoolVector<Vector2> *>(p_variant._data._mem);
+ } break;
+ case POOL_VECTOR3_ARRAY: {
+
+ *reinterpret_cast<PoolVector<Vector3> *>(_data._mem) = *reinterpret_cast<const PoolVector<Vector3> *>(p_variant._data._mem);
+ } break;
+ case POOL_COLOR_ARRAY: {
+
+ *reinterpret_cast<PoolVector<Color> *>(_data._mem) = *reinterpret_cast<const PoolVector<Color> *>(p_variant._data._mem);
+ } break;
+ default: {}
+ }
}
Variant::Variant(const IP_Address &p_address) {
diff --git a/core/variant.h b/core/variant.h
index e77e2e93c4..5ea540a63f 100644
--- a/core/variant.h
+++ b/core/variant.h
@@ -70,6 +70,7 @@ typedef PoolVector<Color> PoolColorArray;
class Variant {
public:
+ // If this changes the table in variant_op must be updated
enum Type {
NIL,
@@ -288,6 +289,7 @@ public:
Variant(const IP_Address &p_address);
+ // If this changes the table in variant_op must be updated
enum Operator {
//comparation
@@ -299,7 +301,7 @@ public:
OP_GREATER_EQUAL,
//mathematic
OP_ADD,
- OP_SUBSTRACT,
+ OP_SUBTRACT,
OP_MULTIPLY,
OP_DIVIDE,
OP_NEGATE,
@@ -388,7 +390,7 @@ public:
uint32_t hash() const;
bool hash_compare(const Variant &p_variant) const;
- bool booleanize(bool &valid) const;
+ bool booleanize() const;
void static_assign(const Variant &p_variant);
static void get_constructor_list(Variant::Type p_type, List<MethodInfo> *p_list);
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 19d9b0297f..7205280938 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -1394,7 +1394,7 @@ void register_variant_methods() {
ADDFUNC2(STRING, STRING, String, format, NIL, "values", STRING, "placeholder", varray("{_}"));
ADDFUNC2(STRING, STRING, String, replace, STRING, "what", STRING, "forwhat", varray());
ADDFUNC2(STRING, STRING, String, replacen, STRING, "what", STRING, "forwhat", varray());
- ADDFUNC2(STRING, STRING, String, insert, INT, "pos", STRING, "what", varray());
+ ADDFUNC2(STRING, STRING, String, insert, INT, "position", STRING, "what", varray());
ADDFUNC0(STRING, STRING, String, capitalize, varray());
ADDFUNC2(STRING, POOL_STRING_ARRAY, String, split, STRING, "divisor", BOOL, "allow_empty", varray(true));
ADDFUNC2(STRING, POOL_REAL_ARRAY, String, split_floats, STRING, "divisor", BOOL, "allow_empty", varray(true));
@@ -1402,14 +1402,14 @@ void register_variant_methods() {
ADDFUNC0(STRING, STRING, String, to_upper, varray());
ADDFUNC0(STRING, STRING, String, to_lower, varray());
- ADDFUNC1(STRING, STRING, String, left, INT, "pos", varray());
- ADDFUNC1(STRING, STRING, String, right, INT, "pos", varray());
+ ADDFUNC1(STRING, STRING, String, left, INT, "position", varray());
+ ADDFUNC1(STRING, STRING, String, right, INT, "position", varray());
ADDFUNC2(STRING, STRING, String, strip_edges, BOOL, "left", BOOL, "right", varray(true, true));
ADDFUNC0(STRING, STRING, String, get_extension, varray());
ADDFUNC0(STRING, STRING, String, get_basename, varray());
ADDFUNC1(STRING, STRING, String, plus_file, STRING, "file", varray());
ADDFUNC1(STRING, INT, String, ord_at, INT, "at", varray());
- ADDFUNC2(STRING, NIL, String, erase, INT, "pos", INT, "chars", varray());
+ ADDFUNC2(STRING, NIL, String, erase, INT, "position", INT, "chars", varray());
ADDFUNC0(STRING, INT, String, hash, varray());
ADDFUNC0(STRING, STRING, String, md5_text, varray());
ADDFUNC0(STRING, STRING, String, sha256_text, varray());
@@ -1560,9 +1560,9 @@ void register_variant_methods() {
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, "pos", varray());
- ADDFUNC2(ARRAY, NIL, Array, insert, INT, "pos", NIL, "value", varray());
- ADDFUNC1(ARRAY, NIL, Array, remove, INT, "pos", 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());
ADDFUNC0(ARRAY, NIL, Array, front, varray());
ADDFUNC0(ARRAY, NIL, Array, back, varray());
@@ -1728,10 +1728,10 @@ void register_variant_methods() {
_VariantCall::add_constructor(_VariantCall::Vector2_init1, Variant::VECTOR2, "x", Variant::REAL, "y", Variant::REAL);
- _VariantCall::add_constructor(_VariantCall::Rect2_init1, Variant::RECT2, "pos", Variant::VECTOR2, "size", Variant::VECTOR2);
+ _VariantCall::add_constructor(_VariantCall::Rect2_init1, Variant::RECT2, "position", Variant::VECTOR2, "size", Variant::VECTOR2);
_VariantCall::add_constructor(_VariantCall::Rect2_init2, Variant::RECT2, "x", Variant::REAL, "y", Variant::REAL, "width", Variant::REAL, "height", Variant::REAL);
- _VariantCall::add_constructor(_VariantCall::Transform2D_init2, Variant::TRANSFORM2D, "rot", Variant::REAL, "pos", Variant::VECTOR2);
+ _VariantCall::add_constructor(_VariantCall::Transform2D_init2, Variant::TRANSFORM2D, "rotation", Variant::REAL, "position", Variant::VECTOR2);
_VariantCall::add_constructor(_VariantCall::Transform2D_init3, Variant::TRANSFORM2D, "x_axis", Variant::VECTOR2, "y_axis", Variant::VECTOR2, "origin", Variant::VECTOR2);
_VariantCall::add_constructor(_VariantCall::Vector3_init1, Variant::VECTOR3, "x", Variant::REAL, "y", Variant::REAL, "z", Variant::REAL);
@@ -1746,7 +1746,7 @@ void register_variant_methods() {
_VariantCall::add_constructor(_VariantCall::Color_init1, Variant::COLOR, "r", Variant::REAL, "g", Variant::REAL, "b", Variant::REAL, "a", Variant::REAL);
_VariantCall::add_constructor(_VariantCall::Color_init2, Variant::COLOR, "r", Variant::REAL, "g", Variant::REAL, "b", Variant::REAL);
- _VariantCall::add_constructor(_VariantCall::Rect3_init1, Variant::RECT3, "pos", Variant::VECTOR3, "size", Variant::VECTOR3);
+ _VariantCall::add_constructor(_VariantCall::Rect3_init1, Variant::RECT3, "position", Variant::VECTOR3, "size", Variant::VECTOR3);
_VariantCall::add_constructor(_VariantCall::Basis_init1, Variant::BASIS, "x_axis", Variant::VECTOR3, "y_axis", Variant::VECTOR3, "z_axis", Variant::VECTOR3);
_VariantCall::add_constructor(_VariantCall::Basis_init2, Variant::BASIS, "axis", Variant::VECTOR3, "phi", Variant::REAL);
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index b6e114b853..1c5a4ce8d0 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -33,49 +33,123 @@
#include "object.h"
#include "script_language.h"
-Variant::operator bool() const {
-
- bool b;
- return booleanize(b);
+#define CASE_TYPE_ALL(PREFIX, OP) \
+ CASE_TYPE(PREFIX, OP, INT) \
+ CASE_TYPE_ALL_BUT_INT(PREFIX, OP)
+
+#define CASE_TYPE_ALL_BUT_INT(PREFIX, OP) \
+ CASE_TYPE(PREFIX, OP, NIL) \
+ CASE_TYPE(PREFIX, OP, BOOL) \
+ CASE_TYPE(PREFIX, OP, REAL) \
+ CASE_TYPE(PREFIX, OP, STRING) \
+ CASE_TYPE(PREFIX, OP, VECTOR2) \
+ CASE_TYPE(PREFIX, OP, RECT2) \
+ CASE_TYPE(PREFIX, OP, VECTOR3) \
+ CASE_TYPE(PREFIX, OP, TRANSFORM2D) \
+ CASE_TYPE(PREFIX, OP, PLANE) \
+ CASE_TYPE(PREFIX, OP, QUAT) \
+ CASE_TYPE(PREFIX, OP, RECT3) \
+ CASE_TYPE(PREFIX, OP, BASIS) \
+ CASE_TYPE(PREFIX, OP, TRANSFORM) \
+ CASE_TYPE(PREFIX, OP, COLOR) \
+ CASE_TYPE(PREFIX, OP, NODE_PATH) \
+ CASE_TYPE(PREFIX, OP, _RID) \
+ CASE_TYPE(PREFIX, OP, OBJECT) \
+ CASE_TYPE(PREFIX, OP, DICTIONARY) \
+ CASE_TYPE(PREFIX, OP, ARRAY) \
+ CASE_TYPE(PREFIX, OP, POOL_BYTE_ARRAY) \
+ CASE_TYPE(PREFIX, OP, POOL_INT_ARRAY) \
+ CASE_TYPE(PREFIX, OP, POOL_REAL_ARRAY) \
+ CASE_TYPE(PREFIX, OP, POOL_STRING_ARRAY) \
+ CASE_TYPE(PREFIX, OP, POOL_VECTOR2_ARRAY) \
+ CASE_TYPE(PREFIX, OP, POOL_VECTOR3_ARRAY) \
+ CASE_TYPE(PREFIX, OP, POOL_COLOR_ARRAY)
+
+#ifdef __GNUC__
+#define TYPE(PREFIX, OP, TYPE) &&PREFIX##_##OP##_##TYPE
+
+/* clang-format off */
+#define TYPES(PREFIX, OP) { \
+ TYPE(PREFIX, OP, NIL), \
+ TYPE(PREFIX, OP, BOOL), \
+ TYPE(PREFIX, OP, INT), \
+ TYPE(PREFIX, OP, REAL), \
+ TYPE(PREFIX, OP, STRING), \
+ TYPE(PREFIX, OP, VECTOR2), \
+ TYPE(PREFIX, OP, RECT2), \
+ TYPE(PREFIX, OP, VECTOR3), \
+ TYPE(PREFIX, OP, TRANSFORM2D), \
+ TYPE(PREFIX, OP, PLANE), \
+ TYPE(PREFIX, OP, QUAT), \
+ TYPE(PREFIX, OP, RECT3), \
+ TYPE(PREFIX, OP, BASIS), \
+ TYPE(PREFIX, OP, TRANSFORM), \
+ TYPE(PREFIX, OP, COLOR), \
+ TYPE(PREFIX, OP, NODE_PATH), \
+ TYPE(PREFIX, OP, _RID), \
+ TYPE(PREFIX, OP, OBJECT), \
+ TYPE(PREFIX, OP, DICTIONARY), \
+ TYPE(PREFIX, OP, ARRAY), \
+ TYPE(PREFIX, OP, POOL_BYTE_ARRAY), \
+ TYPE(PREFIX, OP, POOL_INT_ARRAY), \
+ TYPE(PREFIX, OP, POOL_REAL_ARRAY), \
+ TYPE(PREFIX, OP, POOL_STRING_ARRAY), \
+ TYPE(PREFIX, OP, POOL_VECTOR2_ARRAY), \
+ TYPE(PREFIX, OP, POOL_VECTOR3_ARRAY), \
+ TYPE(PREFIX, OP, POOL_COLOR_ARRAY), \
+}
+/* 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), \
}
-bool Variant::booleanize(bool &r_valid) const {
+#define SWITCH(PREFIX, op, val) goto *switch_table_##PREFIX[op][val];
+#define SWITCH_OP(PREFIX, OP, val)
+#define CASE_TYPE(PREFIX, OP, TYPE) PREFIX##_##OP##_##TYPE:
+
+#else
+#define CASES(PREFIX)
+#define SWITCH(PREFIX, op, val) switch (op)
+#define SWITCH_OP(PREFIX, OP, val) \
+ case OP: \
+ switch (val)
+#define CASE_TYPE(PREFIX, OP, TYPE) case TYPE:
+#endif
- r_valid = true;
- switch (type) {
- case NIL: return false;
- case BOOL: return _data._bool;
- case INT: return _data._int;
- case REAL: return _data._real;
- case STRING: return (*reinterpret_cast<const String *>(_data._mem)) != "";
- case VECTOR2:
- case RECT2:
- case TRANSFORM2D:
- case VECTOR3:
- case PLANE:
- case RECT3:
- case QUAT:
- case BASIS:
- case TRANSFORM:
- case COLOR:
- case _RID: return (*reinterpret_cast<const RID *>(_data._mem)).is_valid();
- case OBJECT: return _get_obj().obj;
- case NODE_PATH: return (*reinterpret_cast<const NodePath *>(_data._mem)) != NodePath();
- case DICTIONARY:
- case ARRAY:
- case POOL_BYTE_ARRAY:
- case POOL_INT_ARRAY:
- case POOL_REAL_ARRAY:
- case POOL_STRING_ARRAY:
- case POOL_VECTOR2_ARRAY:
- case POOL_VECTOR3_ARRAY:
- case POOL_COLOR_ARRAY:
- r_valid = false;
- return false;
- default: {}
- }
+Variant::operator bool() const {
- return false;
+ return booleanize();
+}
+
+// We consider all unitialized or empty types to be false based on the type's
+// zeroiness.
+bool Variant::booleanize() const {
+ return !is_zero();
}
#define _RETURN(m_what) \
@@ -84,146 +158,221 @@ bool Variant::booleanize(bool &r_valid) const {
return; \
}
-#define DEFAULT_OP_NUM(m_op, m_name, m_type) \
- case m_name: { \
- switch (p_b.type) { \
- case BOOL: _RETURN(p_a._data.m_type m_op p_b._data._bool); \
- case INT: _RETURN(p_a._data.m_type m_op p_b._data._int); \
- case REAL: _RETURN(p_a._data.m_type m_op p_b._data._real); \
- default: {} \
- } \
- r_valid = false; \
- return; \
+#define _RETURN_FAIL \
+ { \
+ r_valid = false; \
+ return; \
+ }
+
+#define DEFAULT_OP_NUM(m_prefix, m_op_name, m_name, m_op, m_type) \
+ CASE_TYPE(m_prefix, m_op_name, m_name) { \
+ if (p_b.type == INT) _RETURN(p_a._data.m_type m_op p_b._data._int); \
+ if (p_b.type == REAL) _RETURN(p_a._data.m_type m_op p_b._data._real); \
+ \
+ _RETURN_FAIL \
};
-#define DEFAULT_OP_NUM_NEG(m_name, m_type) \
- case m_name: { \
- \
- _RETURN(-p_a._data.m_type); \
+#define DEFAULT_OP_NUM_NULL(m_prefix, m_op_name, m_name, m_op, m_type) \
+ CASE_TYPE(m_prefix, m_op_name, m_name) { \
+ if (p_b.type == INT) _RETURN(p_a._data.m_type m_op p_b._data._int); \
+ if (p_b.type == REAL) _RETURN(p_a._data.m_type m_op p_b._data._real); \
+ if (p_b.type == NIL) _RETURN(!p_b.type m_op NIL); \
+ \
+ _RETURN_FAIL \
};
-#define DEFAULT_OP_NUM_POS(m_name, m_type) \
- case m_name: { \
- \
- _RETURN(p_a._data.m_type); \
+#ifdef DEBUG_ENABLED
+#define DEFAULT_OP_NUM_DIV(m_prefix, m_op_name, m_name, m_type) \
+ CASE_TYPE(m_prefix, m_op_name, m_name) { \
+ if (p_b.type == INT) { \
+ if (p_b._data._int == 0) { \
+ r_valid = false; \
+ _RETURN("Division By Zero"); \
+ } \
+ _RETURN(p_a._data.m_type / p_b._data._int); \
+ } \
+ if (p_b.type == REAL) { \
+ if (p_b._data._real == 0) { \
+ r_valid = false; \
+ _RETURN("Division By Zero"); \
+ } \
+ _RETURN(p_a._data.m_type / p_b._data._real); \
+ } \
+ \
+ _RETURN_FAIL \
+ };
+#else
+#define DEFAULT_OP_NUM_DIV(m_prefix, m_op_name, m_name, m_type) \
+ CASE_TYPE(m_prefix, m_op_name, m_name) { \
+ if (p_b.type == INT) _RETURN(p_a._data.m_type / p_b._data._int); \
+ if (p_b.type == REAL) _RETURN(p_a._data.m_type / p_b._data._real); \
+ \
+ _RETURN_FAIL \
};
+#endif
-#define DEFAULT_OP_NUM_VEC(m_op, m_name, m_type) \
- case m_name: { \
- switch (p_b.type) { \
- case BOOL: _RETURN(p_a._data.m_type m_op p_b._data._bool); \
- case INT: _RETURN(p_a._data.m_type m_op p_b._data._int); \
- case REAL: _RETURN(p_a._data.m_type m_op p_b._data._real); \
- case VECTOR2: _RETURN(p_a._data.m_type m_op *reinterpret_cast<const Vector2 *>(p_b._data._mem)); \
- case VECTOR3: _RETURN(p_a._data.m_type m_op *reinterpret_cast<const Vector3 *>(p_b._data._mem)); \
- default: {} \
- } \
- r_valid = false; \
- return; \
+#define DEFAULT_OP_NUM_NEG(m_prefix, m_op_name, m_name, m_type) \
+ CASE_TYPE(m_prefix, m_op_name, m_name) { \
+ _RETURN(-p_a._data.m_type); \
};
-#define DEFAULT_OP_STR(m_op, m_name, m_type) \
- case m_name: { \
- switch (p_b.type) { \
- case STRING: _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const String *>(p_b._data._mem)); \
- case NODE_PATH: _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const NodePath *>(p_b._data._mem)); \
- default: {} \
- } \
- r_valid = false; \
- return; \
+#define DEFAULT_OP_NUM_POS(m_prefix, m_op_name, m_name, m_type) \
+ CASE_TYPE(m_prefix, m_op_name, m_name) { \
+ _RETURN(p_a._data.m_type); \
};
-#define DEFAULT_OP_LOCALMEM(m_op, m_name, m_type) \
- case m_name: { \
- switch (p_b.type) { \
- case m_name: _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const m_type *>(p_b._data._mem)); \
- default: {} \
- } \
- r_valid = false; \
- return; \
- }
+#define DEFAULT_OP_NUM_VEC(m_prefix, m_op_name, m_name, m_op, m_type) \
+ CASE_TYPE(m_prefix, m_op_name, m_name) { \
+ if (p_b.type == INT) _RETURN(p_a._data.m_type m_op p_b._data._int); \
+ if (p_b.type == REAL) _RETURN(p_a._data.m_type m_op p_b._data._real); \
+ if (p_b.type == VECTOR2) _RETURN(p_a._data.m_type m_op *reinterpret_cast<const Vector2 *>(p_b._data._mem)); \
+ if (p_b.type == VECTOR3) _RETURN(p_a._data.m_type m_op *reinterpret_cast<const Vector3 *>(p_b._data._mem)); \
+ \
+ _RETURN_FAIL \
+ };
-#define DEFAULT_OP_LOCALMEM_NEG(m_name, m_type) \
- case m_name: { \
+#define DEFAULT_OP_STR_REV(m_prefix, m_op_name, m_name, m_op, m_type) \
+ CASE_TYPE(m_prefix, m_op_name, m_name) { \
+ if (p_b.type == STRING) _RETURN(*reinterpret_cast<const m_type *>(p_b._data._mem) m_op *reinterpret_cast<const String *>(p_a._data._mem)); \
+ if (p_b.type == NODE_PATH) _RETURN(*reinterpret_cast<const m_type *>(p_b._data._mem) m_op *reinterpret_cast<const NodePath *>(p_a._data._mem)); \
+ \
+ _RETURN_FAIL \
+ };
+
+#define DEFAULT_OP_STR(m_prefix, m_op_name, m_name, m_op, m_type) \
+ CASE_TYPE(m_prefix, m_op_name, m_name) { \
+ if (p_b.type == STRING) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const String *>(p_b._data._mem)); \
+ if (p_b.type == NODE_PATH) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const NodePath *>(p_b._data._mem)); \
+ \
+ _RETURN_FAIL \
+ };
+
+#define DEFAULT_OP_STR_NULL(m_prefix, m_op_name, m_name, m_op, m_type) \
+ CASE_TYPE(m_prefix, m_op_name, m_name) { \
+ if (p_b.type == STRING) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const String *>(p_b._data._mem)); \
+ if (p_b.type == NODE_PATH) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const NodePath *>(p_b._data._mem)); \
+ if (p_b.type == NIL) _RETURN(!p_b.type m_op NIL); \
+ \
+ _RETURN_FAIL \
+ };
+
+#define DEFAULT_OP_LOCALMEM_REV(m_prefix, m_op_name, m_name, m_op, m_type) \
+ CASE_TYPE(m_prefix, m_op_name, m_name) { \
+ if (p_b.type == m_name) \
+ _RETURN(*reinterpret_cast<const m_type *>(p_b._data._mem) m_op *reinterpret_cast<const m_type *>(p_a._data._mem)); \
+ \
+ _RETURN_FAIL \
+ };
+
+#define DEFAULT_OP_LOCALMEM(m_prefix, m_op_name, m_name, m_op, m_type) \
+ CASE_TYPE(m_prefix, m_op_name, m_name) { \
+ if (p_b.type == m_name) \
+ _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const m_type *>(p_b._data._mem)); \
+ \
+ _RETURN_FAIL \
+ };
+
+#define DEFAULT_OP_LOCALMEM_NULL(m_prefix, m_op_name, m_name, m_op, m_type) \
+ CASE_TYPE(m_prefix, m_op_name, m_name) { \
+ if (p_b.type == m_name) \
+ _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const m_type *>(p_b._data._mem)); \
+ if (p_b.type == NIL) \
+ _RETURN(!p_b.type m_op NIL); \
+ \
+ _RETURN_FAIL \
+ };
+
+#define DEFAULT_OP_LOCALMEM_NEG(m_prefix, m_op_name, m_name, m_type) \
+ CASE_TYPE(m_prefix, m_op_name, m_name) { \
_RETURN(-*reinterpret_cast<const m_type *>(p_a._data._mem)); \
}
-#define DEFAULT_OP_LOCALMEM_POS(m_name, m_type) \
- case m_name: { \
- _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem)); \
+#define DEFAULT_OP_LOCALMEM_POS(m_prefix, m_op_name, m_name, m_type) \
+ CASE_TYPE(m_prefix, m_op_name, m_name) { \
+ _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem)); \
}
-#define DEFAULT_OP_LOCALMEM_NUM(m_op, m_name, m_type) \
- case m_name: { \
- switch (p_b.type) { \
- case m_name: _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const m_type *>(p_b._data._mem)); \
- case BOOL: _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op p_b._data._bool); \
- case INT: _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op p_b._data._int); \
- case REAL: _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op p_b._data._real); \
- default: {} \
- } \
- r_valid = false; \
- return; \
+#define DEFAULT_OP_LOCALMEM_NUM(m_prefix, m_op_name, m_name, m_op, m_type) \
+ CASE_TYPE(m_prefix, m_op_name, m_name) { \
+ if (p_b.type == m_name) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const m_type *>(p_b._data._mem)); \
+ if (p_b.type == INT) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op p_b._data._int); \
+ if (p_b.type == REAL) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op p_b._data._real); \
+ \
+ _RETURN_FAIL \
}
-#define DEFAULT_OP_PTR(m_op, m_name, m_sub) \
- case m_name: { \
- switch (p_b.type) { \
- case m_name: _RETURN(p_a._data.m_sub m_op p_b._data.m_sub); \
- default: {} \
- } \
- r_valid = false; \
- return; \
+#define DEFAULT_OP_PTR(m_op, m_name, m_sub) \
+ CASE_TYPE(m_prefix, m_op_name, m_name) { \
+ if (p_b.type == m_name) \
+ _RETURN(p_a._data.m_sub m_op p_b._data.m_sub); \
+ \
+ _RETURN_FAIL \
}
-#define DEFAULT_OP_PTRREF(m_op, m_name, m_sub) \
- case m_name: { \
- switch (p_b.type) { \
- case m_name: _RETURN(*p_a._data.m_sub m_op *p_b._data.m_sub); \
- default: {} \
- } \
- r_valid = false; \
- return; \
+#define DEFAULT_OP_PTRREF(m_prefix, m_op_name, m_name, m_op, m_sub) \
+ CASE_TYPE(m_prefix, m_op_name, m_name) { \
+ if (p_b.type == m_name) \
+ _RETURN(*p_a._data.m_sub m_op *p_b._data.m_sub); \
+ \
+ _RETURN_FAIL \
}
-#define DEFAULT_OP_ARRAY_EQ(m_name, m_type) \
- DEFAULT_OP_ARRAY_OP(m_name, m_type, !=, !=, true, false, false)
+#define DEFAULT_OP_PTRREF_NULL(m_prefix, m_op_name, m_name, m_op, m_sub) \
+ CASE_TYPE(m_prefix, m_op_name, m_name) { \
+ if (p_b.type == m_name) \
+ _RETURN(*p_a._data.m_sub m_op *p_b._data.m_sub); \
+ if (p_b.type == NIL) \
+ _RETURN(!p_b.type m_op NIL); \
+ \
+ _RETURN_FAIL \
+ }
-#define DEFAULT_OP_ARRAY_LT(m_name, m_type) \
- DEFAULT_OP_ARRAY_OP(m_name, m_type, <, !=, false, a_len < array_b.size(), true)
+#define DEFAULT_OP_ARRAY_EQ(m_prefix, m_op_name, m_name, m_type) \
+ CASE_TYPE(m_prefix, m_op_name, m_name) { \
+ if (p_b.type == NIL) \
+ _RETURN(false) \
+ DEFAULT_OP_ARRAY_OP_BODY(m_prefix, m_op_name, m_name, m_type, !=, !=, true, false, false) \
+ }
-#define DEFAULT_OP_ARRAY_OP(m_name, m_type, m_opa, m_opb, m_ret_def, m_ret_s, m_ret_f) \
- case m_name: { \
- if (p_a.type != p_b.type) { \
- r_valid = false; \
- return; \
- } \
- const PoolVector<m_type> &array_a = *reinterpret_cast<const PoolVector<m_type> *>(p_a._data._mem); \
- const PoolVector<m_type> &array_b = *reinterpret_cast<const PoolVector<m_type> *>(p_b._data._mem); \
- \
- int a_len = array_a.size(); \
- if (a_len m_opa array_b.size()) { \
- _RETURN(m_ret_s); \
- } else { \
- \
- PoolVector<m_type>::Read ra = array_a.read(); \
- PoolVector<m_type>::Read rb = array_b.read(); \
- \
- for (int i = 0; i < a_len; i++) { \
- if (ra[i] m_opb rb[i]) \
- _RETURN(m_ret_f); \
- } \
- \
- _RETURN(m_ret_def); \
- } \
+#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)
+
+#define DEFAULT_OP_ARRAY_GT(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)
+
+#define DEFAULT_OP_ARRAY_OP(m_prefix, m_op_name, m_name, m_type, m_opa, m_opb, m_ret_def, m_ret_s, m_ret_f) \
+ CASE_TYPE(m_prefix, m_op_name, m_name) { \
+ DEFAULT_OP_ARRAY_OP_BODY(m_prefix, m_op_name, m_name, m_type, m_opa, m_opb, m_ret_def, m_ret_s, m_ret_f) \
}
-#define DEFAULT_OP_ARRAY_ADD(m_name, m_type) \
- case m_name: { \
- if (p_a.type != p_b.type) { \
- r_valid = false; \
- _RETURN(NIL); \
- } \
+#define DEFAULT_OP_ARRAY_OP_BODY(m_prefix, m_op_name, m_name, m_type, m_opa, m_opb, m_ret_def, m_ret_s, m_ret_f) \
+ if (p_a.type != p_b.type) \
+ _RETURN_FAIL \
+ \
+ const PoolVector<m_type> &array_a = *reinterpret_cast<const PoolVector<m_type> *>(p_a._data._mem); \
+ const PoolVector<m_type> &array_b = *reinterpret_cast<const PoolVector<m_type> *>(p_b._data._mem); \
+ \
+ int a_len = array_a.size(); \
+ if (a_len m_opa array_b.size()) { \
+ _RETURN(m_ret_s); \
+ } else { \
+ \
+ PoolVector<m_type>::Read ra = array_a.read(); \
+ PoolVector<m_type>::Read rb = array_b.read(); \
+ \
+ for (int i = 0; i < a_len; i++) { \
+ if (ra[i] m_opb rb[i]) \
+ _RETURN(m_ret_f); \
+ } \
+ \
+ _RETURN(m_ret_def); \
+ }
+
+#define DEFAULT_OP_ARRAY_ADD(m_prefix, m_op_name, m_name, m_type) \
+ CASE_TYPE(m_prefix, m_op_name, m_name) { \
+ if (p_a.type != p_b.type) \
+ _RETURN_FAIL; \
+ \
const PoolVector<m_type> &array_a = *reinterpret_cast<const PoolVector<m_type> *>(p_a._data._mem); \
const PoolVector<m_type> &array_b = *reinterpret_cast<const PoolVector<m_type> *>(p_b._data._mem); \
PoolVector<m_type> sum = array_a; \
@@ -231,595 +380,671 @@ bool Variant::booleanize(bool &r_valid) const {
_RETURN(sum); \
}
-#define DEFAULT_OP_FAIL(m_name) \
- case m_name: { \
- r_valid = false; \
- return; \
- }
-
-void Variant::evaluate(const Operator &p_op, const Variant &p_a, const Variant &p_b, Variant &r_ret, bool &r_valid) {
+void Variant::evaluate(const Operator &p_op, const Variant &p_a,
+ const Variant &p_b, Variant &r_ret, bool &r_valid) {
+ CASES(math);
r_valid = true;
- switch (p_op) {
+ SWITCH(math, p_op, p_a.type) {
+ SWITCH_OP(math, OP_EQUAL, p_a.type) {
+ CASE_TYPE(math, OP_EQUAL, NIL) {
+ if (p_b.type == NIL) _RETURN(true);
+ if (p_b.type == OBJECT)
+ _RETURN(p_b._get_obj().obj == NULL);
- case OP_EQUAL: {
+ _RETURN(false);
+ }
- if ((int(p_a.type) * int(p_b.type)) == 0) {
- //null case is an exception, one of both is null
- if (p_a.type == p_b.type) //null against null is true
- _RETURN(true);
- //only against object is allowed
- if (p_a.type == Variant::OBJECT) {
- _RETURN(p_a._get_obj().obj == NULL);
- } else if (p_b.type == Variant::OBJECT) {
- _RETURN(p_b._get_obj().obj == NULL);
+ CASE_TYPE(math, OP_EQUAL, BOOL) {
+ if (p_b.type != BOOL) {
+ if (p_b.type == NIL)
+ _RETURN(false);
+ _RETURN_FAIL;
}
- //otherwise, always false
- _RETURN(false);
+
+ _RETURN(p_a._data._bool == p_b._data._bool);
}
- switch (p_a.type) {
+ CASE_TYPE(math, OP_EQUAL, OBJECT) {
+ if (p_b.type == OBJECT)
+ _RETURN((p_a._get_obj().obj == p_b._get_obj().obj));
+ if (p_b.type == NIL)
+ _RETURN(p_a._get_obj().obj == NULL);
- case NIL: {
+ _RETURN_FAIL;
+ }
- _RETURN(p_b.type == NIL || (p_b.type == Variant::OBJECT && !p_b._get_obj().obj));
- } break;
+ CASE_TYPE(math, OP_EQUAL, DICTIONARY) {
+ if (p_b.type != DICTIONARY) {
+ if (p_b.type == NIL)
+ _RETURN(false);
+ _RETURN_FAIL;
+ }
- DEFAULT_OP_NUM(==, BOOL, _bool);
- DEFAULT_OP_NUM(==, INT, _int);
- DEFAULT_OP_NUM(==, REAL, _real);
- DEFAULT_OP_STR(==, STRING, String);
- DEFAULT_OP_LOCALMEM(==, VECTOR2, Vector2);
- DEFAULT_OP_LOCALMEM(==, RECT2, Rect2);
- DEFAULT_OP_PTRREF(==, TRANSFORM2D, _transform2d);
- DEFAULT_OP_LOCALMEM(==, VECTOR3, Vector3);
- DEFAULT_OP_LOCALMEM(==, PLANE, Plane);
- DEFAULT_OP_LOCALMEM(==, QUAT, Quat);
- DEFAULT_OP_PTRREF(==, RECT3, _rect3);
- DEFAULT_OP_PTRREF(==, BASIS, _basis);
- DEFAULT_OP_PTRREF(==, TRANSFORM, _transform);
+ const Dictionary *arr_a = reinterpret_cast<const Dictionary *>(p_a._data._mem);
+ const Dictionary *arr_b = reinterpret_cast<const Dictionary *>(p_b._data._mem);
- DEFAULT_OP_LOCALMEM(==, COLOR, Color);
- DEFAULT_OP_STR(==, NODE_PATH, NodePath);
- DEFAULT_OP_LOCALMEM(==, _RID, RID);
- case OBJECT: {
+ _RETURN(*arr_a == *arr_b);
+ }
- if (p_b.type == OBJECT)
- _RETURN((p_a._get_obj().obj == p_b._get_obj().obj));
+ CASE_TYPE(math, OP_EQUAL, ARRAY) {
+ if (p_b.type != ARRAY) {
if (p_b.type == NIL)
- _RETURN(!p_a._get_obj().obj);
- } break;
-
- case DICTIONARY: {
+ _RETURN(false);
+ _RETURN_FAIL;
+ }
+ const Array *arr_a = reinterpret_cast<const Array *>(p_a._data._mem);
+ const Array *arr_b = reinterpret_cast<const Array *>(p_b._data._mem);
- if (p_b.type != DICTIONARY)
+ int l = arr_a->size();
+ if (arr_b->size() != l)
+ _RETURN(false);
+ for (int i = 0; i < l; i++) {
+ if (!((*arr_a)[i] == (*arr_b)[i])) {
_RETURN(false);
+ }
+ }
- const Dictionary *arr_a = reinterpret_cast<const Dictionary *>(p_a._data._mem);
- const Dictionary *arr_b = reinterpret_cast<const Dictionary *>(p_b._data._mem);
+ _RETURN(true);
+ }
+
+ DEFAULT_OP_NUM_NULL(math, OP_EQUAL, INT, ==, _int);
+ DEFAULT_OP_NUM_NULL(math, OP_EQUAL, REAL, ==, _real);
+ DEFAULT_OP_STR_NULL(math, OP_EQUAL, STRING, ==, String);
+ DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, VECTOR2, ==, Vector2);
+ DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, RECT2, ==, Rect2);
+ DEFAULT_OP_PTRREF_NULL(math, OP_EQUAL, TRANSFORM2D, ==, _transform2d);
+ DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, VECTOR3, ==, Vector3);
+ DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, PLANE, ==, Plane);
+ DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, QUAT, ==, Quat);
+ DEFAULT_OP_PTRREF_NULL(math, OP_EQUAL, RECT3, ==, _rect3);
+ DEFAULT_OP_PTRREF_NULL(math, OP_EQUAL, BASIS, ==, _basis);
+ DEFAULT_OP_PTRREF_NULL(math, OP_EQUAL, TRANSFORM, ==, _transform);
+ DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, COLOR, ==, Color);
+ DEFAULT_OP_STR_NULL(math, OP_EQUAL, NODE_PATH, ==, NodePath);
+ DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, _RID, ==, RID);
+
+ DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, POOL_BYTE_ARRAY, uint8_t);
+ DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, POOL_INT_ARRAY, int);
+ DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, POOL_REAL_ARRAY, real_t);
+ DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, POOL_STRING_ARRAY, String);
+ DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, POOL_VECTOR2_ARRAY, Vector2);
+ DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, POOL_VECTOR3_ARRAY, Vector3);
+ DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, POOL_COLOR_ARRAY, Color);
+ }
- _RETURN(*arr_a == *arr_b);
+ SWITCH_OP(math, OP_NOT_EQUAL, p_a.type) {
+ CASE_TYPE(math, OP_NOT_EQUAL, NIL) {
+ if (p_b.type == NIL) _RETURN(false);
+ if (p_b.type == OBJECT)
+ _RETURN(p_b._get_obj().obj != NULL);
- } break;
- case ARRAY: {
+ _RETURN(true);
+ }
- if (p_b.type != ARRAY)
- _RETURN(false);
+ CASE_TYPE(math, OP_NOT_EQUAL, BOOL) {
+ if (p_b.type != BOOL) {
+ if (p_b.type == NIL)
+ _RETURN(true);
- const Array *arr_a = reinterpret_cast<const Array *>(p_a._data._mem);
- const Array *arr_b = reinterpret_cast<const Array *>(p_b._data._mem);
+ _RETURN_FAIL;
+ }
- int l = arr_a->size();
- if (arr_b->size() != l)
- _RETURN(false);
- for (int i = 0; i < l; i++) {
- if (!((*arr_a)[i] == (*arr_b)[i])) {
- _RETURN(false);
- }
- }
+ _RETURN(p_a._data._bool != p_b._data._bool);
+ }
- _RETURN(true);
+ CASE_TYPE(math, OP_NOT_EQUAL, OBJECT) {
+ if (p_b.type == OBJECT)
+ _RETURN((p_a._get_obj().obj != p_b._get_obj().obj));
+ if (p_b.type == NIL)
+ _RETURN(p_a._get_obj().obj != NULL);
- } break;
+ _RETURN_FAIL;
+ }
- DEFAULT_OP_ARRAY_EQ(POOL_BYTE_ARRAY, uint8_t);
- DEFAULT_OP_ARRAY_EQ(POOL_INT_ARRAY, int);
- DEFAULT_OP_ARRAY_EQ(POOL_REAL_ARRAY, real_t);
- DEFAULT_OP_ARRAY_EQ(POOL_STRING_ARRAY, String);
- DEFAULT_OP_ARRAY_EQ(POOL_VECTOR2_ARRAY, Vector3);
- DEFAULT_OP_ARRAY_EQ(POOL_VECTOR3_ARRAY, Vector3);
- DEFAULT_OP_ARRAY_EQ(POOL_COLOR_ARRAY, Color);
+ CASE_TYPE(math, OP_NOT_EQUAL, DICTIONARY) {
+ if (p_b.type != DICTIONARY) {
+ if (p_b.type == NIL)
+ _RETURN(true);
+ _RETURN_FAIL;
+ }
- case VARIANT_MAX: {
- r_valid = false;
- return;
+ const Dictionary *arr_a = reinterpret_cast<const Dictionary *>(p_a._data._mem);
+ const Dictionary *arr_b = reinterpret_cast<const Dictionary *>(p_b._data._mem);
- } break;
+ _RETURN((*arr_a == *arr_b) == false);
}
- } break;
- case OP_NOT_EQUAL: {
- Variant res;
- evaluate(OP_EQUAL, p_a, p_b, res, r_valid);
- if (!r_valid)
- return;
- if (res.type == BOOL)
- res._data._bool = !res._data._bool;
- _RETURN(res);
-
- } break;
- case OP_LESS: {
-
- switch (p_a.type) {
-
- DEFAULT_OP_FAIL(NIL);
- DEFAULT_OP_NUM(<, BOOL, _bool);
- DEFAULT_OP_NUM(<, INT, _int);
- DEFAULT_OP_NUM(<, REAL, _real);
- DEFAULT_OP_STR(<, STRING, String);
- DEFAULT_OP_LOCALMEM(<, VECTOR2, Vector2);
- DEFAULT_OP_FAIL(RECT2);
- DEFAULT_OP_FAIL(TRANSFORM2D);
- DEFAULT_OP_LOCALMEM(<, VECTOR3, Vector3);
- DEFAULT_OP_FAIL(PLANE);
- DEFAULT_OP_FAIL(QUAT);
- DEFAULT_OP_FAIL(RECT3);
- DEFAULT_OP_FAIL(BASIS);
- DEFAULT_OP_FAIL(TRANSFORM);
-
- DEFAULT_OP_FAIL(COLOR);
-
- DEFAULT_OP_FAIL(NODE_PATH);
- DEFAULT_OP_LOCALMEM(<, _RID, RID);
- case OBJECT: {
-
- if (p_b.type == OBJECT)
- _RETURN((p_a._get_obj().obj < p_b._get_obj().obj));
- } break;
- DEFAULT_OP_FAIL(DICTIONARY);
- case ARRAY: {
-
- if (p_b.type != ARRAY)
- _RETURN(false);
- const Array *arr_a = reinterpret_cast<const Array *>(p_a._data._mem);
- const Array *arr_b = reinterpret_cast<const Array *>(p_b._data._mem);
+ CASE_TYPE(math, OP_NOT_EQUAL, ARRAY) {
+ if (p_b.type != ARRAY) {
+ if (p_b.type == NIL)
+ _RETURN(true);
+
+ _RETURN_FAIL;
+ }
+
+ const Array *arr_a = reinterpret_cast<const Array *>(p_a._data._mem);
+ const Array *arr_b = reinterpret_cast<const Array *>(p_b._data._mem);
- int l = arr_a->size();
- if (arr_b->size() < l)
+ int l = arr_a->size();
+ if (arr_b->size() != l)
+ _RETURN(true);
+ for (int i = 0; i < l; i++) {
+ if (((*arr_a)[i] == (*arr_b)[i])) {
_RETURN(false);
- for (int i = 0; i < l; i++) {
- if (!((*arr_a)[i] < (*arr_b)[i])) {
- _RETURN(true);
- }
}
+ }
- _RETURN(false);
+ _RETURN(true);
+ }
+
+ DEFAULT_OP_NUM_NULL(math, OP_NOT_EQUAL, INT, !=, _int);
+ DEFAULT_OP_NUM_NULL(math, OP_NOT_EQUAL, REAL, !=, _real);
+ DEFAULT_OP_STR_NULL(math, OP_NOT_EQUAL, STRING, !=, String);
+ DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, VECTOR2, !=, Vector2);
+ DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, RECT2, !=, Rect2);
+ DEFAULT_OP_PTRREF_NULL(math, OP_NOT_EQUAL, TRANSFORM2D, !=, _transform2d);
+ DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, VECTOR3, !=, Vector3);
+ DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, PLANE, !=, Plane);
+ DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, QUAT, !=, Quat);
+ DEFAULT_OP_PTRREF_NULL(math, OP_NOT_EQUAL, RECT3, !=, _rect3);
+ DEFAULT_OP_PTRREF_NULL(math, OP_NOT_EQUAL, BASIS, !=, _basis);
+ DEFAULT_OP_PTRREF_NULL(math, OP_NOT_EQUAL, TRANSFORM, !=, _transform);
+ DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, COLOR, !=, Color);
+ 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;
+ }
- } break;
- DEFAULT_OP_ARRAY_LT(POOL_BYTE_ARRAY, uint8_t);
- DEFAULT_OP_ARRAY_LT(POOL_INT_ARRAY, int);
- DEFAULT_OP_ARRAY_LT(POOL_REAL_ARRAY, real_t);
- DEFAULT_OP_ARRAY_LT(POOL_STRING_ARRAY, String);
- DEFAULT_OP_ARRAY_LT(POOL_VECTOR2_ARRAY, Vector3);
- DEFAULT_OP_ARRAY_LT(POOL_VECTOR3_ARRAY, Vector3);
- DEFAULT_OP_ARRAY_LT(POOL_COLOR_ARRAY, Color);
- case VARIANT_MAX: {
- r_valid = false;
- return;
+ SWITCH_OP(math, OP_LESS, p_a.type) {
+ CASE_TYPE(math, OP_LESS, BOOL) {
+ if (p_b.type != BOOL)
+ _RETURN_FAIL;
- } break;
- }
-
- } break;
- case OP_LESS_EQUAL: {
-
- switch (p_a.type) {
-
- DEFAULT_OP_FAIL(NIL);
- DEFAULT_OP_NUM(<=, BOOL, _bool);
- DEFAULT_OP_NUM(<=, INT, _int);
- DEFAULT_OP_NUM(<=, REAL, _real);
- DEFAULT_OP_STR(<=, STRING, String);
- DEFAULT_OP_LOCALMEM(<=, VECTOR2, Vector2);
- DEFAULT_OP_FAIL(RECT2);
- DEFAULT_OP_FAIL(TRANSFORM2D);
- DEFAULT_OP_LOCALMEM(<=, VECTOR3, Vector3);
- DEFAULT_OP_FAIL(PLANE);
- DEFAULT_OP_FAIL(QUAT);
- DEFAULT_OP_FAIL(RECT3);
- DEFAULT_OP_FAIL(BASIS);
- DEFAULT_OP_FAIL(TRANSFORM);
-
- DEFAULT_OP_FAIL(COLOR);
-
- DEFAULT_OP_FAIL(NODE_PATH);
- DEFAULT_OP_LOCALMEM(<=, _RID, RID);
- case OBJECT: {
-
- if (p_b.type == OBJECT)
- _RETURN((p_a._get_obj().obj <= p_b._get_obj().obj));
- } break;
- DEFAULT_OP_FAIL(DICTIONARY);
- DEFAULT_OP_FAIL(ARRAY);
- DEFAULT_OP_FAIL(POOL_BYTE_ARRAY);
- DEFAULT_OP_FAIL(POOL_INT_ARRAY);
- DEFAULT_OP_FAIL(POOL_REAL_ARRAY);
- DEFAULT_OP_FAIL(POOL_STRING_ARRAY);
- DEFAULT_OP_FAIL(POOL_VECTOR2_ARRAY);
- DEFAULT_OP_FAIL(POOL_VECTOR3_ARRAY);
- DEFAULT_OP_FAIL(POOL_COLOR_ARRAY);
- case VARIANT_MAX: {
- r_valid = false;
- return;
+ if (p_a._data._bool == p_b._data._bool)
+ _RETURN(false);
+
+ if (p_a._data._bool && !p_b._data._bool)
+ _RETURN(false);
- } break;
+ _RETURN(true);
}
- } break;
- case OP_GREATER: {
+ CASE_TYPE(math, OP_LESS, OBJECT) {
+ if (p_b.type != OBJECT)
+ _RETURN_FAIL;
+ _RETURN((p_a._get_obj().obj < p_b._get_obj().obj));
+ }
- Variant res;
- evaluate(OP_LESS, p_b, p_a, res, r_valid);
- if (!r_valid)
- return;
- _RETURN(res);
+ CASE_TYPE(math, OP_LESS, ARRAY) {
+ if (p_b.type != ARRAY)
+ _RETURN_FAIL;
- } break;
- case OP_GREATER_EQUAL: {
+ const Array *arr_a = reinterpret_cast<const Array *>(p_a._data._mem);
+ const Array *arr_b = reinterpret_cast<const Array *>(p_b._data._mem);
- Variant res;
- evaluate(OP_LESS_EQUAL, p_b, p_a, res, r_valid);
- if (!r_valid)
- return;
- _RETURN(res);
- } break;
- //mathematic
- case OP_ADD: {
- switch (p_a.type) {
-
- DEFAULT_OP_FAIL(NIL);
- DEFAULT_OP_NUM(+, BOOL, _bool);
- DEFAULT_OP_NUM(+, INT, _int);
- DEFAULT_OP_NUM(+, REAL, _real);
- DEFAULT_OP_STR(+, STRING, String);
- DEFAULT_OP_LOCALMEM(+, VECTOR2, Vector2);
- DEFAULT_OP_FAIL(RECT2);
- DEFAULT_OP_FAIL(TRANSFORM2D);
- DEFAULT_OP_LOCALMEM(+, VECTOR3, Vector3);
- DEFAULT_OP_FAIL(PLANE);
- DEFAULT_OP_LOCALMEM(+, QUAT, Quat);
- DEFAULT_OP_FAIL(RECT3);
- DEFAULT_OP_FAIL(BASIS);
- DEFAULT_OP_FAIL(TRANSFORM);
-
- DEFAULT_OP_FAIL(COLOR);
-
- DEFAULT_OP_FAIL(NODE_PATH);
- DEFAULT_OP_FAIL(_RID);
- DEFAULT_OP_FAIL(OBJECT);
- DEFAULT_OP_FAIL(DICTIONARY);
-
- case ARRAY: {
- if (p_a.type != p_b.type) {
- r_valid = false;
- return;
+ int l = arr_a->size();
+ if (arr_b->size() < l)
+ _RETURN(false);
+ for (int i = 0; i < l; i++) {
+ if (!((*arr_a)[i] < (*arr_b)[i])) {
+ _RETURN(true);
}
- const Array &array_a = *reinterpret_cast<const Array *>(p_a._data._mem);
- const Array &array_b = *reinterpret_cast<const Array *>(p_b._data._mem);
- Array sum;
- int asize = array_a.size();
- int bsize = array_b.size();
- sum.resize(asize + bsize);
- for (int i = 0; i < asize; i++)
- sum[i] = array_a[i];
- for (int i = 0; i < bsize; i++)
- sum[i + asize] = array_b[i];
- _RETURN(sum);
- }
- DEFAULT_OP_ARRAY_ADD(POOL_BYTE_ARRAY, uint8_t);
- DEFAULT_OP_ARRAY_ADD(POOL_INT_ARRAY, int);
- DEFAULT_OP_ARRAY_ADD(POOL_REAL_ARRAY, real_t);
- DEFAULT_OP_ARRAY_ADD(POOL_STRING_ARRAY, String);
- DEFAULT_OP_ARRAY_ADD(POOL_VECTOR2_ARRAY, Vector2);
- DEFAULT_OP_ARRAY_ADD(POOL_VECTOR3_ARRAY, Vector3);
- DEFAULT_OP_ARRAY_ADD(POOL_COLOR_ARRAY, Color);
- case VARIANT_MAX: {
- r_valid = false;
- return;
-
- } break;
- }
- } break;
- case OP_SUBSTRACT: {
- switch (p_a.type) {
-
- DEFAULT_OP_FAIL(NIL);
- DEFAULT_OP_NUM(-, BOOL, _bool);
- DEFAULT_OP_NUM(-, INT, _int);
- DEFAULT_OP_NUM(-, REAL, _real);
- DEFAULT_OP_FAIL(STRING);
- DEFAULT_OP_LOCALMEM(-, VECTOR2, Vector2);
- DEFAULT_OP_FAIL(RECT2);
- DEFAULT_OP_FAIL(TRANSFORM2D);
- DEFAULT_OP_LOCALMEM(-, VECTOR3, Vector3);
- DEFAULT_OP_FAIL(PLANE);
- DEFAULT_OP_LOCALMEM(-, QUAT, Quat);
- DEFAULT_OP_FAIL(RECT3);
- DEFAULT_OP_FAIL(BASIS);
- DEFAULT_OP_FAIL(TRANSFORM);
-
- DEFAULT_OP_FAIL(COLOR);
-
- DEFAULT_OP_FAIL(NODE_PATH);
- DEFAULT_OP_FAIL(_RID);
- DEFAULT_OP_FAIL(OBJECT);
- DEFAULT_OP_FAIL(DICTIONARY);
- DEFAULT_OP_FAIL(ARRAY);
- DEFAULT_OP_FAIL(POOL_BYTE_ARRAY);
- DEFAULT_OP_FAIL(POOL_INT_ARRAY);
- DEFAULT_OP_FAIL(POOL_REAL_ARRAY);
- DEFAULT_OP_FAIL(POOL_STRING_ARRAY);
- DEFAULT_OP_FAIL(POOL_VECTOR2_ARRAY);
- DEFAULT_OP_FAIL(POOL_VECTOR3_ARRAY);
- DEFAULT_OP_FAIL(POOL_COLOR_ARRAY);
- case VARIANT_MAX: {
- r_valid = false;
- return;
+ }
- } break;
+ _RETURN(false);
}
- } break;
- case OP_MULTIPLY: {
- switch (p_a.type) {
- DEFAULT_OP_FAIL(NIL);
- DEFAULT_OP_NUM(*, BOOL, _bool);
- DEFAULT_OP_NUM_VEC(*, INT, _int);
- DEFAULT_OP_NUM_VEC(*, REAL, _real);
- DEFAULT_OP_FAIL(STRING);
- DEFAULT_OP_LOCALMEM_NUM(*, VECTOR2, Vector2);
- DEFAULT_OP_FAIL(RECT2);
- case TRANSFORM2D: {
+ DEFAULT_OP_NUM(math, OP_LESS, INT, <, _int);
+ DEFAULT_OP_NUM(math, OP_LESS, REAL, <, _real);
+ DEFAULT_OP_STR(math, OP_LESS, STRING, <, String);
+ DEFAULT_OP_LOCALMEM(math, OP_LESS, VECTOR2, <, Vector2);
+ DEFAULT_OP_LOCALMEM(math, OP_LESS, VECTOR3, <, Vector3);
+ DEFAULT_OP_LOCALMEM(math, OP_LESS, _RID, <, RID);
+ DEFAULT_OP_ARRAY_LT(math, OP_LESS, POOL_BYTE_ARRAY, uint8_t);
+ DEFAULT_OP_ARRAY_LT(math, OP_LESS, POOL_INT_ARRAY, int);
+ DEFAULT_OP_ARRAY_LT(math, OP_LESS, POOL_REAL_ARRAY, real_t);
+ DEFAULT_OP_ARRAY_LT(math, OP_LESS, POOL_STRING_ARRAY, String);
+ DEFAULT_OP_ARRAY_LT(math, OP_LESS, POOL_VECTOR2_ARRAY, Vector3);
+ DEFAULT_OP_ARRAY_LT(math, OP_LESS, POOL_VECTOR3_ARRAY, Vector3);
+ DEFAULT_OP_ARRAY_LT(math, OP_LESS, POOL_COLOR_ARRAY, Color);
+
+ CASE_TYPE(math, OP_LESS, NIL)
+ CASE_TYPE(math, OP_LESS, RECT2)
+ CASE_TYPE(math, OP_LESS, TRANSFORM2D)
+ CASE_TYPE(math, OP_LESS, PLANE)
+ CASE_TYPE(math, OP_LESS, QUAT)
+ CASE_TYPE(math, OP_LESS, RECT3)
+ CASE_TYPE(math, OP_LESS, BASIS)
+ CASE_TYPE(math, OP_LESS, TRANSFORM)
+ CASE_TYPE(math, OP_LESS, COLOR)
+ CASE_TYPE(math, OP_LESS, NODE_PATH)
+ CASE_TYPE(math, OP_LESS, DICTIONARY)
+ _RETURN_FAIL;
+ }
- if (p_b.type == TRANSFORM2D) {
- _RETURN(*p_a._data._transform2d * *p_b._data._transform2d);
- };
- if (p_b.type == VECTOR2) {
- _RETURN(p_a._data._transform2d->xform(*(const Vector2 *)p_b._data._mem));
- };
- r_valid = false;
- return;
- } break;
- DEFAULT_OP_LOCALMEM_NUM(*, VECTOR3, Vector3);
- DEFAULT_OP_FAIL(PLANE);
- case QUAT: {
-
- switch (p_b.type) {
- case VECTOR3: {
-
- _RETURN(reinterpret_cast<const Quat *>(p_a._data._mem)->xform(*(const Vector3 *)p_b._data._mem));
- } break;
- case QUAT: {
-
- _RETURN(*reinterpret_cast<const Quat *>(p_a._data._mem) * *reinterpret_cast<const Quat *>(p_b._data._mem));
- } break;
- case REAL: {
- _RETURN(*reinterpret_cast<const Quat *>(p_a._data._mem) * p_b._data._real);
- } break;
- default: {}
- };
- r_valid = false;
- return;
- } break;
- DEFAULT_OP_FAIL(RECT3);
- case BASIS: {
+ SWITCH_OP(math, OP_LESS_EQUAL, p_a.type) {
+ CASE_TYPE(math, OP_LESS_EQUAL, OBJECT) {
+ if (p_b.type != OBJECT)
+ _RETURN_FAIL;
+ _RETURN((p_a._get_obj().obj <= p_b._get_obj().obj));
+ }
+
+ DEFAULT_OP_NUM(math, OP_LESS_EQUAL, INT, <=, _int);
+ DEFAULT_OP_NUM(math, OP_LESS_EQUAL, REAL, <=, _real);
+ DEFAULT_OP_STR(math, OP_LESS_EQUAL, STRING, <=, String);
+ DEFAULT_OP_LOCALMEM(math, OP_LESS_EQUAL, VECTOR2, <=, Vector2);
+ DEFAULT_OP_LOCALMEM(math, OP_LESS_EQUAL, VECTOR3, <=, Vector3);
+ DEFAULT_OP_LOCALMEM(math, OP_LESS_EQUAL, _RID, <=, RID);
+
+ CASE_TYPE(math, OP_LESS_EQUAL, NIL)
+ CASE_TYPE(math, OP_LESS_EQUAL, BOOL)
+ CASE_TYPE(math, OP_LESS_EQUAL, RECT2)
+ CASE_TYPE(math, OP_LESS_EQUAL, TRANSFORM2D)
+ CASE_TYPE(math, OP_LESS_EQUAL, PLANE)
+ CASE_TYPE(math, OP_LESS_EQUAL, QUAT)
+ CASE_TYPE(math, OP_LESS_EQUAL, RECT3)
+ CASE_TYPE(math, OP_LESS_EQUAL, BASIS)
+ CASE_TYPE(math, OP_LESS_EQUAL, TRANSFORM)
+ CASE_TYPE(math, OP_LESS_EQUAL, COLOR)
+ CASE_TYPE(math, OP_LESS_EQUAL, NODE_PATH)
+ CASE_TYPE(math, OP_LESS_EQUAL, DICTIONARY)
+ CASE_TYPE(math, OP_LESS_EQUAL, ARRAY)
+ CASE_TYPE(math, OP_LESS_EQUAL, POOL_BYTE_ARRAY);
+ CASE_TYPE(math, OP_LESS_EQUAL, POOL_INT_ARRAY);
+ CASE_TYPE(math, OP_LESS_EQUAL, POOL_REAL_ARRAY);
+ CASE_TYPE(math, OP_LESS_EQUAL, POOL_STRING_ARRAY);
+ CASE_TYPE(math, OP_LESS_EQUAL, POOL_VECTOR2_ARRAY);
+ CASE_TYPE(math, OP_LESS_EQUAL, POOL_VECTOR3_ARRAY);
+ CASE_TYPE(math, OP_LESS_EQUAL, POOL_COLOR_ARRAY);
+ _RETURN_FAIL;
+ }
- switch (p_b.type) {
- case VECTOR3: {
+ SWITCH_OP(math, OP_GREATER, p_a.type) {
+ CASE_TYPE(math, OP_GREATER, BOOL) {
+ if (p_b.type != BOOL)
+ _RETURN_FAIL;
- _RETURN(p_a._data._basis->xform(*(const Vector3 *)p_b._data._mem));
- };
- case BASIS: {
+ if (p_a._data._bool == p_b._data._bool)
+ _RETURN(false);
- _RETURN(*p_a._data._basis * *p_b._data._basis);
- };
- default: {}
- };
- r_valid = false;
- return;
- } break;
- case TRANSFORM: {
+ if (!p_a._data._bool && p_b._data._bool)
+ _RETURN(false);
- switch (p_b.type) {
- case VECTOR3: {
+ _RETURN(true);
+ }
- _RETURN(p_a._data._transform->xform(*(const Vector3 *)p_b._data._mem));
- };
- case TRANSFORM: {
+ CASE_TYPE(math, OP_GREATER, OBJECT) {
+ if (p_b.type != OBJECT)
+ _RETURN_FAIL;
+ _RETURN((p_a._get_obj().obj > p_b._get_obj().obj));
+ }
- _RETURN(*p_a._data._transform * *p_b._data._transform);
- };
- default: {}
- };
- r_valid = false;
- return;
- } break;
- DEFAULT_OP_FAIL(COLOR);
-
- DEFAULT_OP_FAIL(NODE_PATH);
- DEFAULT_OP_FAIL(_RID);
- DEFAULT_OP_FAIL(OBJECT);
- DEFAULT_OP_FAIL(DICTIONARY);
- DEFAULT_OP_FAIL(ARRAY);
- DEFAULT_OP_FAIL(POOL_BYTE_ARRAY);
- DEFAULT_OP_FAIL(POOL_INT_ARRAY);
- DEFAULT_OP_FAIL(POOL_REAL_ARRAY);
- DEFAULT_OP_FAIL(POOL_STRING_ARRAY);
- DEFAULT_OP_FAIL(POOL_VECTOR2_ARRAY);
- DEFAULT_OP_FAIL(POOL_VECTOR3_ARRAY);
- DEFAULT_OP_FAIL(POOL_COLOR_ARRAY);
- case VARIANT_MAX: {
- r_valid = false;
- return;
+ CASE_TYPE(math, OP_GREATER, ARRAY) {
+ if (p_b.type != ARRAY)
+ _RETURN_FAIL;
- } break;
- }
- } break;
- case OP_DIVIDE: {
- switch (p_a.type) {
+ const Array *arr_a = reinterpret_cast<const Array *>(p_a._data._mem);
+ const Array *arr_b = reinterpret_cast<const Array *>(p_b._data._mem);
- DEFAULT_OP_FAIL(NIL);
- DEFAULT_OP_NUM(/, BOOL, _bool);
- case INT: {
- switch (p_b.type) {
- case BOOL: {
- int64_t b = p_b._data._bool;
- if (b == 0) {
+ int l = arr_a->size();
+ if (arr_b->size() > l)
+ _RETURN(false);
+ for (int i = 0; i < l; i++) {
+ if (((*arr_a)[i] < (*arr_b)[i])) {
+ _RETURN(false);
+ }
+ }
+
+ _RETURN(true);
+ }
+
+ DEFAULT_OP_NUM(math, OP_GREATER, INT, >, _int);
+ DEFAULT_OP_NUM(math, OP_GREATER, REAL, >, _real);
+ DEFAULT_OP_STR_REV(math, OP_GREATER, STRING, <, String);
+ DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER, VECTOR2, <, Vector2);
+ DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER, VECTOR3, <, Vector3);
+ DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER, _RID, <, RID);
+ DEFAULT_OP_ARRAY_GT(math, OP_GREATER, POOL_BYTE_ARRAY, uint8_t);
+ DEFAULT_OP_ARRAY_GT(math, OP_GREATER, POOL_INT_ARRAY, int);
+ DEFAULT_OP_ARRAY_GT(math, OP_GREATER, POOL_REAL_ARRAY, real_t);
+ DEFAULT_OP_ARRAY_GT(math, OP_GREATER, POOL_STRING_ARRAY, String);
+ DEFAULT_OP_ARRAY_GT(math, OP_GREATER, POOL_VECTOR2_ARRAY, Vector3);
+ DEFAULT_OP_ARRAY_GT(math, OP_GREATER, POOL_VECTOR3_ARRAY, Vector3);
+ DEFAULT_OP_ARRAY_GT(math, OP_GREATER, POOL_COLOR_ARRAY, Color);
+
+ CASE_TYPE(math, OP_GREATER, NIL)
+ CASE_TYPE(math, OP_GREATER, RECT2)
+ CASE_TYPE(math, OP_GREATER, TRANSFORM2D)
+ CASE_TYPE(math, OP_GREATER, PLANE)
+ CASE_TYPE(math, OP_GREATER, QUAT)
+ CASE_TYPE(math, OP_GREATER, RECT3)
+ CASE_TYPE(math, OP_GREATER, BASIS)
+ CASE_TYPE(math, OP_GREATER, TRANSFORM)
+ CASE_TYPE(math, OP_GREATER, COLOR)
+ CASE_TYPE(math, OP_GREATER, NODE_PATH)
+ CASE_TYPE(math, OP_GREATER, DICTIONARY)
+ _RETURN_FAIL;
+ }
- r_valid = false;
- _RETURN("Division By False");
- }
- _RETURN(p_a._data._int / b);
+ SWITCH_OP(math, OP_GREATER_EQUAL, p_a.type) {
+ CASE_TYPE(math, OP_GREATER_EQUAL, OBJECT) {
+ if (p_b.type != OBJECT)
+ _RETURN_FAIL;
+ _RETURN((p_a._get_obj().obj >= p_b._get_obj().obj));
+ }
+
+ DEFAULT_OP_NUM(math, OP_GREATER_EQUAL, INT, >=, _int);
+ DEFAULT_OP_NUM(math, OP_GREATER_EQUAL, REAL, >=, _real);
+ DEFAULT_OP_STR_REV(math, OP_GREATER_EQUAL, STRING, <=, String);
+ DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER_EQUAL, VECTOR2, <=, Vector2);
+ DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER_EQUAL, VECTOR3, <=, Vector3);
+ DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER_EQUAL, _RID, <=, RID);
+
+ CASE_TYPE(math, OP_GREATER_EQUAL, NIL)
+ CASE_TYPE(math, OP_GREATER_EQUAL, BOOL)
+ CASE_TYPE(math, OP_GREATER_EQUAL, RECT2)
+ CASE_TYPE(math, OP_GREATER_EQUAL, TRANSFORM2D)
+ CASE_TYPE(math, OP_GREATER_EQUAL, PLANE)
+ CASE_TYPE(math, OP_GREATER_EQUAL, QUAT)
+ CASE_TYPE(math, OP_GREATER_EQUAL, RECT3)
+ CASE_TYPE(math, OP_GREATER_EQUAL, BASIS)
+ CASE_TYPE(math, OP_GREATER_EQUAL, TRANSFORM)
+ CASE_TYPE(math, OP_GREATER_EQUAL, COLOR)
+ CASE_TYPE(math, OP_GREATER_EQUAL, NODE_PATH)
+ CASE_TYPE(math, OP_GREATER_EQUAL, DICTIONARY)
+ CASE_TYPE(math, OP_GREATER_EQUAL, ARRAY)
+ CASE_TYPE(math, OP_GREATER_EQUAL, POOL_BYTE_ARRAY);
+ CASE_TYPE(math, OP_GREATER_EQUAL, POOL_INT_ARRAY);
+ CASE_TYPE(math, OP_GREATER_EQUAL, POOL_REAL_ARRAY);
+ CASE_TYPE(math, OP_GREATER_EQUAL, POOL_STRING_ARRAY);
+ CASE_TYPE(math, OP_GREATER_EQUAL, POOL_VECTOR2_ARRAY);
+ CASE_TYPE(math, OP_GREATER_EQUAL, POOL_VECTOR3_ARRAY);
+ CASE_TYPE(math, OP_GREATER_EQUAL, POOL_COLOR_ARRAY);
+ _RETURN_FAIL;
+ }
- } break;
- case INT: {
- int64_t b = p_b._data._int;
- if (b == 0) {
+ SWITCH_OP(math, OP_ADD, p_a.type) {
+ CASE_TYPE(math, OP_ADD, ARRAY) {
+ if (p_a.type != p_b.type)
+ _RETURN_FAIL;
+
+ const Array &array_a = *reinterpret_cast<const Array *>(p_a._data._mem);
+ const Array &array_b = *reinterpret_cast<const Array *>(p_b._data._mem);
+ Array sum;
+ int asize = array_a.size();
+ int bsize = array_b.size();
+ sum.resize(asize + bsize);
+ for (int i = 0; i < asize; i++)
+ sum[i] = array_a[i];
+ for (int i = 0; i < bsize; i++)
+ sum[i + asize] = array_b[i];
+ _RETURN(sum);
+ }
+
+ DEFAULT_OP_NUM(math, OP_ADD, INT, +, _int);
+ DEFAULT_OP_NUM(math, OP_ADD, REAL, +, _real);
+ DEFAULT_OP_STR(math, OP_ADD, STRING, +, String);
+ DEFAULT_OP_LOCALMEM(math, OP_ADD, VECTOR2, +, Vector2);
+ DEFAULT_OP_LOCALMEM(math, OP_ADD, VECTOR3, +, Vector3);
+ DEFAULT_OP_LOCALMEM(math, OP_ADD, QUAT, +, Quat);
+ DEFAULT_OP_LOCALMEM(math, OP_ADD, COLOR, +, Color);
+
+ DEFAULT_OP_ARRAY_ADD(math, OP_ADD, POOL_BYTE_ARRAY, uint8_t);
+ DEFAULT_OP_ARRAY_ADD(math, OP_ADD, POOL_INT_ARRAY, int);
+ DEFAULT_OP_ARRAY_ADD(math, OP_ADD, POOL_REAL_ARRAY, real_t);
+ DEFAULT_OP_ARRAY_ADD(math, OP_ADD, POOL_STRING_ARRAY, String);
+ DEFAULT_OP_ARRAY_ADD(math, OP_ADD, POOL_VECTOR2_ARRAY, Vector2);
+ DEFAULT_OP_ARRAY_ADD(math, OP_ADD, POOL_VECTOR3_ARRAY, Vector3);
+ DEFAULT_OP_ARRAY_ADD(math, OP_ADD, POOL_COLOR_ARRAY, Color);
+
+ CASE_TYPE(math, OP_ADD, NIL)
+ CASE_TYPE(math, OP_ADD, BOOL)
+ CASE_TYPE(math, OP_ADD, RECT2)
+ CASE_TYPE(math, OP_ADD, TRANSFORM2D)
+ CASE_TYPE(math, OP_ADD, PLANE)
+ CASE_TYPE(math, OP_ADD, RECT3)
+ CASE_TYPE(math, OP_ADD, BASIS)
+ CASE_TYPE(math, OP_ADD, TRANSFORM)
+ CASE_TYPE(math, OP_ADD, NODE_PATH)
+ CASE_TYPE(math, OP_ADD, _RID)
+ CASE_TYPE(math, OP_ADD, OBJECT)
+ CASE_TYPE(math, OP_ADD, DICTIONARY)
+ _RETURN_FAIL;
+ }
- r_valid = false;
- _RETURN("Division By Zero");
- }
- _RETURN(p_a._data._int / b);
+ SWITCH_OP(math, OP_SUBTRACT, p_a.type) {
+ DEFAULT_OP_NUM(math, OP_SUBTRACT, INT, -, _int);
+ DEFAULT_OP_NUM(math, OP_SUBTRACT, REAL, -, _real);
+ DEFAULT_OP_LOCALMEM(math, OP_SUBTRACT, VECTOR2, -, Vector2);
+ DEFAULT_OP_LOCALMEM(math, OP_SUBTRACT, VECTOR3, -, Vector3);
+ DEFAULT_OP_LOCALMEM(math, OP_SUBTRACT, QUAT, -, Quat);
+ DEFAULT_OP_LOCALMEM(math, OP_SUBTRACT, COLOR, -, Color);
+
+ CASE_TYPE(math, OP_SUBTRACT, NIL)
+ CASE_TYPE(math, OP_SUBTRACT, BOOL)
+ CASE_TYPE(math, OP_SUBTRACT, STRING)
+ CASE_TYPE(math, OP_SUBTRACT, RECT2)
+ CASE_TYPE(math, OP_SUBTRACT, TRANSFORM2D)
+ CASE_TYPE(math, OP_SUBTRACT, PLANE)
+ CASE_TYPE(math, OP_SUBTRACT, RECT3)
+ CASE_TYPE(math, OP_SUBTRACT, BASIS)
+ CASE_TYPE(math, OP_SUBTRACT, TRANSFORM)
+ CASE_TYPE(math, OP_SUBTRACT, NODE_PATH)
+ CASE_TYPE(math, OP_SUBTRACT, _RID)
+ CASE_TYPE(math, OP_SUBTRACT, OBJECT)
+ CASE_TYPE(math, OP_SUBTRACT, DICTIONARY)
+ CASE_TYPE(math, OP_SUBTRACT, ARRAY)
+ CASE_TYPE(math, OP_SUBTRACT, POOL_BYTE_ARRAY);
+ CASE_TYPE(math, OP_SUBTRACT, POOL_INT_ARRAY);
+ CASE_TYPE(math, OP_SUBTRACT, POOL_REAL_ARRAY);
+ CASE_TYPE(math, OP_SUBTRACT, POOL_STRING_ARRAY);
+ CASE_TYPE(math, OP_SUBTRACT, POOL_VECTOR2_ARRAY);
+ CASE_TYPE(math, OP_SUBTRACT, POOL_VECTOR3_ARRAY);
+ CASE_TYPE(math, OP_SUBTRACT, POOL_COLOR_ARRAY);
+ _RETURN_FAIL;
+ }
- } break;
- case REAL: _RETURN(p_a._data._int / p_b._data._real);
- default: {}
+ SWITCH_OP(math, OP_MULTIPLY, p_a.type) {
+ CASE_TYPE(math, OP_MULTIPLY, TRANSFORM2D) {
+ switch (p_b.type) {
+ case TRANSFORM2D: {
+ _RETURN(*p_a._data._transform2d * *p_b._data._transform2d);
}
- r_valid = false;
- return;
- };
- DEFAULT_OP_NUM(/, REAL, _real);
- DEFAULT_OP_FAIL(STRING);
- DEFAULT_OP_LOCALMEM_NUM(/, VECTOR2, Vector2);
- DEFAULT_OP_FAIL(RECT2);
- DEFAULT_OP_FAIL(TRANSFORM2D);
- DEFAULT_OP_LOCALMEM_NUM(/, VECTOR3, Vector3);
- DEFAULT_OP_FAIL(PLANE);
- case QUAT: {
- if (p_b.type != REAL) {
- r_valid = false;
- return;
+ case VECTOR2: {
+ _RETURN(p_a._data._transform2d->xform(*(const Vector2 *)p_b._data._mem));
}
- _RETURN(*reinterpret_cast<const Quat *>(p_a._data._mem) / p_b._data._real);
- } break;
- DEFAULT_OP_FAIL(RECT3);
- DEFAULT_OP_FAIL(BASIS);
- DEFAULT_OP_FAIL(TRANSFORM);
-
- DEFAULT_OP_FAIL(COLOR);
-
- DEFAULT_OP_FAIL(NODE_PATH);
- DEFAULT_OP_FAIL(_RID);
- DEFAULT_OP_FAIL(OBJECT);
- DEFAULT_OP_FAIL(DICTIONARY);
- DEFAULT_OP_FAIL(ARRAY);
- DEFAULT_OP_FAIL(POOL_BYTE_ARRAY);
- DEFAULT_OP_FAIL(POOL_INT_ARRAY);
- DEFAULT_OP_FAIL(POOL_REAL_ARRAY);
- DEFAULT_OP_FAIL(POOL_STRING_ARRAY);
- DEFAULT_OP_FAIL(POOL_VECTOR2_ARRAY);
- DEFAULT_OP_FAIL(POOL_VECTOR3_ARRAY);
- DEFAULT_OP_FAIL(POOL_COLOR_ARRAY);
- case VARIANT_MAX: {
- r_valid = false;
- return;
+ default: _RETURN_FAIL;
+ }
+ }
- } break;
- }
-
- } break;
- case OP_POSITIVE: {
- // Simple case when user defines variable as +value.
- switch (p_a.type) {
-
- DEFAULT_OP_FAIL(NIL);
- DEFAULT_OP_FAIL(STRING);
- DEFAULT_OP_FAIL(RECT2);
- DEFAULT_OP_FAIL(TRANSFORM2D);
- DEFAULT_OP_FAIL(RECT3);
- DEFAULT_OP_FAIL(BASIS);
- DEFAULT_OP_FAIL(TRANSFORM);
- DEFAULT_OP_NUM_POS(BOOL, _bool);
- DEFAULT_OP_NUM_POS(INT, _int);
- DEFAULT_OP_NUM_POS(REAL, _real);
- DEFAULT_OP_LOCALMEM_POS(VECTOR3, Vector3);
- DEFAULT_OP_LOCALMEM_POS(PLANE, Plane);
- DEFAULT_OP_LOCALMEM_POS(QUAT, Quat);
- DEFAULT_OP_LOCALMEM_POS(VECTOR2, Vector2);
-
- DEFAULT_OP_FAIL(COLOR);
-
- DEFAULT_OP_FAIL(NODE_PATH);
- DEFAULT_OP_FAIL(_RID);
- DEFAULT_OP_FAIL(OBJECT);
- DEFAULT_OP_FAIL(DICTIONARY);
- DEFAULT_OP_FAIL(ARRAY);
- DEFAULT_OP_FAIL(POOL_BYTE_ARRAY);
- DEFAULT_OP_FAIL(POOL_INT_ARRAY);
- DEFAULT_OP_FAIL(POOL_REAL_ARRAY);
- DEFAULT_OP_FAIL(POOL_STRING_ARRAY);
- DEFAULT_OP_FAIL(POOL_VECTOR2_ARRAY);
- DEFAULT_OP_FAIL(POOL_VECTOR3_ARRAY);
- DEFAULT_OP_FAIL(POOL_COLOR_ARRAY);
- case VARIANT_MAX: {
- r_valid = false;
- return;
+ CASE_TYPE(math, OP_MULTIPLY, QUAT) {
+ switch (p_b.type) {
+ case VECTOR3: {
+ _RETURN(reinterpret_cast<const Quat *>(p_a._data._mem)->xform(*(const Vector3 *)p_b._data._mem));
+ }
+ case QUAT: {
+ _RETURN(*reinterpret_cast<const Quat *>(p_a._data._mem) * *reinterpret_cast<const Quat *>(p_b._data._mem));
+ }
+ case REAL: {
+ _RETURN(*reinterpret_cast<const Quat *>(p_a._data._mem) * p_b._data._real);
+ }
+ default: _RETURN_FAIL;
+ }
+ }
- } break;
- }
- } break;
- case OP_NEGATE: {
- switch (p_a.type) {
-
- DEFAULT_OP_FAIL(NIL);
- DEFAULT_OP_NUM_NEG(BOOL, _bool);
- DEFAULT_OP_NUM_NEG(INT, _int);
- DEFAULT_OP_NUM_NEG(REAL, _real);
- DEFAULT_OP_FAIL(STRING);
- DEFAULT_OP_LOCALMEM_NEG(VECTOR2, Vector2);
- DEFAULT_OP_FAIL(RECT2);
- DEFAULT_OP_FAIL(TRANSFORM2D);
- DEFAULT_OP_LOCALMEM_NEG(VECTOR3, Vector3);
- DEFAULT_OP_LOCALMEM_NEG(PLANE, Plane);
- DEFAULT_OP_LOCALMEM_NEG(QUAT, Quat);
- DEFAULT_OP_FAIL(RECT3);
- DEFAULT_OP_FAIL(BASIS);
- DEFAULT_OP_FAIL(TRANSFORM);
-
- DEFAULT_OP_FAIL(COLOR);
-
- DEFAULT_OP_FAIL(NODE_PATH);
- DEFAULT_OP_FAIL(_RID);
- DEFAULT_OP_FAIL(OBJECT);
- DEFAULT_OP_FAIL(DICTIONARY);
- DEFAULT_OP_FAIL(ARRAY);
- DEFAULT_OP_FAIL(POOL_BYTE_ARRAY);
- DEFAULT_OP_FAIL(POOL_INT_ARRAY);
- DEFAULT_OP_FAIL(POOL_REAL_ARRAY);
- DEFAULT_OP_FAIL(POOL_STRING_ARRAY);
- DEFAULT_OP_FAIL(POOL_VECTOR2_ARRAY);
- DEFAULT_OP_FAIL(POOL_VECTOR3_ARRAY);
- DEFAULT_OP_FAIL(POOL_COLOR_ARRAY);
- case VARIANT_MAX: {
- r_valid = false;
- return;
+ CASE_TYPE(math, OP_MULTIPLY, BASIS) {
+ switch (p_b.type) {
+ case VECTOR3: {
+ _RETURN(p_a._data._basis->xform(*(const Vector3 *)p_b._data._mem));
+ }
+ case BASIS: {
+ _RETURN(*p_a._data._basis * *p_b._data._basis);
+ }
+ default: _RETURN_FAIL;
+ }
+ }
- } break;
+ CASE_TYPE(math, OP_MULTIPLY, TRANSFORM) {
+ switch (p_b.type) {
+ case VECTOR3: {
+ _RETURN(p_a._data._transform->xform(*(const Vector3 *)p_b._data._mem));
+ }
+ case TRANSFORM: {
+ _RETURN(*p_a._data._transform * *p_b._data._transform);
+ }
+ default: _RETURN_FAIL;
+ }
}
- } break;
- case OP_MODULE: {
- if (p_a.type == INT && p_b.type == INT) {
+
+ DEFAULT_OP_NUM_VEC(math, OP_MULTIPLY, INT, *, _int);
+ DEFAULT_OP_NUM_VEC(math, OP_MULTIPLY, REAL, *, _real);
+ DEFAULT_OP_LOCALMEM_NUM(math, OP_MULTIPLY, VECTOR2, *, Vector2);
+ DEFAULT_OP_LOCALMEM_NUM(math, OP_MULTIPLY, VECTOR3, *, Vector3);
+ DEFAULT_OP_LOCALMEM_NUM(math, OP_MULTIPLY, COLOR, *, Color);
+
+ CASE_TYPE(math, OP_MULTIPLY, NIL)
+ CASE_TYPE(math, OP_MULTIPLY, BOOL)
+ CASE_TYPE(math, OP_MULTIPLY, STRING)
+ CASE_TYPE(math, OP_MULTIPLY, RECT2)
+ CASE_TYPE(math, OP_MULTIPLY, PLANE)
+ CASE_TYPE(math, OP_MULTIPLY, RECT3)
+ CASE_TYPE(math, OP_MULTIPLY, NODE_PATH)
+ CASE_TYPE(math, OP_MULTIPLY, _RID)
+ CASE_TYPE(math, OP_MULTIPLY, OBJECT)
+ CASE_TYPE(math, OP_MULTIPLY, DICTIONARY)
+ CASE_TYPE(math, OP_MULTIPLY, ARRAY)
+ CASE_TYPE(math, OP_MULTIPLY, POOL_BYTE_ARRAY);
+ CASE_TYPE(math, OP_MULTIPLY, POOL_INT_ARRAY);
+ CASE_TYPE(math, OP_MULTIPLY, POOL_REAL_ARRAY);
+ CASE_TYPE(math, OP_MULTIPLY, POOL_STRING_ARRAY);
+ CASE_TYPE(math, OP_MULTIPLY, POOL_VECTOR2_ARRAY);
+ CASE_TYPE(math, OP_MULTIPLY, POOL_VECTOR3_ARRAY);
+ CASE_TYPE(math, OP_MULTIPLY, POOL_COLOR_ARRAY);
+ _RETURN_FAIL;
+ }
+
+ SWITCH_OP(math, OP_DIVIDE, p_a.type) {
+ CASE_TYPE(math, OP_DIVIDE, QUAT) {
+ if (p_b.type != REAL)
+ _RETURN_FAIL;
+#ifdef DEBUG_ENABLED
+ if (p_b._data._real == 0) {
+ r_valid = false;
+ _RETURN("Division By Zero");
+ }
+#endif
+ _RETURN(*reinterpret_cast<const Quat *>(p_a._data._mem) / p_b._data._real);
+ }
+
+ DEFAULT_OP_NUM_DIV(math, OP_DIVIDE, INT, _int);
+ DEFAULT_OP_NUM_DIV(math, OP_DIVIDE, REAL, _real);
+ DEFAULT_OP_LOCALMEM_NUM(math, OP_DIVIDE, VECTOR2, /, Vector2);
+ DEFAULT_OP_LOCALMEM_NUM(math, OP_DIVIDE, VECTOR3, /, Vector3);
+ DEFAULT_OP_LOCALMEM_NUM(math, OP_DIVIDE, COLOR, /, Color);
+
+ CASE_TYPE(math, OP_DIVIDE, NIL)
+ CASE_TYPE(math, OP_DIVIDE, BOOL)
+ CASE_TYPE(math, OP_DIVIDE, STRING)
+ CASE_TYPE(math, OP_DIVIDE, RECT2)
+ CASE_TYPE(math, OP_DIVIDE, TRANSFORM2D)
+ CASE_TYPE(math, OP_DIVIDE, PLANE)
+ CASE_TYPE(math, OP_DIVIDE, RECT3)
+ CASE_TYPE(math, OP_DIVIDE, BASIS)
+ CASE_TYPE(math, OP_DIVIDE, TRANSFORM)
+ CASE_TYPE(math, OP_DIVIDE, NODE_PATH)
+ CASE_TYPE(math, OP_DIVIDE, _RID)
+ CASE_TYPE(math, OP_DIVIDE, OBJECT)
+ CASE_TYPE(math, OP_DIVIDE, DICTIONARY)
+ CASE_TYPE(math, OP_DIVIDE, ARRAY)
+ CASE_TYPE(math, OP_DIVIDE, POOL_BYTE_ARRAY);
+ CASE_TYPE(math, OP_DIVIDE, POOL_INT_ARRAY);
+ CASE_TYPE(math, OP_DIVIDE, POOL_REAL_ARRAY);
+ CASE_TYPE(math, OP_DIVIDE, POOL_STRING_ARRAY);
+ CASE_TYPE(math, OP_DIVIDE, POOL_VECTOR2_ARRAY);
+ CASE_TYPE(math, OP_DIVIDE, POOL_VECTOR3_ARRAY);
+ CASE_TYPE(math, OP_DIVIDE, POOL_COLOR_ARRAY);
+ _RETURN_FAIL;
+ }
+
+ SWITCH_OP(math, OP_POSITIVE, p_a.type) {
+ DEFAULT_OP_NUM_POS(math, OP_POSITIVE, INT, _int);
+ DEFAULT_OP_NUM_POS(math, OP_POSITIVE, REAL, _real);
+ DEFAULT_OP_LOCALMEM_POS(math, OP_POSITIVE, VECTOR3, Vector3);
+ DEFAULT_OP_LOCALMEM_POS(math, OP_POSITIVE, PLANE, Plane);
+ DEFAULT_OP_LOCALMEM_POS(math, OP_POSITIVE, QUAT, Quat);
+ DEFAULT_OP_LOCALMEM_POS(math, OP_POSITIVE, VECTOR2, Vector2);
+
+ CASE_TYPE(math, OP_POSITIVE, NIL)
+ CASE_TYPE(math, OP_POSITIVE, BOOL)
+ CASE_TYPE(math, OP_POSITIVE, STRING)
+ CASE_TYPE(math, OP_POSITIVE, RECT2)
+ CASE_TYPE(math, OP_POSITIVE, TRANSFORM2D)
+ CASE_TYPE(math, OP_POSITIVE, RECT3)
+ CASE_TYPE(math, OP_POSITIVE, BASIS)
+ CASE_TYPE(math, OP_POSITIVE, TRANSFORM)
+ CASE_TYPE(math, OP_POSITIVE, COLOR)
+ CASE_TYPE(math, OP_POSITIVE, NODE_PATH)
+ CASE_TYPE(math, OP_POSITIVE, _RID)
+ CASE_TYPE(math, OP_POSITIVE, OBJECT)
+ CASE_TYPE(math, OP_POSITIVE, DICTIONARY)
+ CASE_TYPE(math, OP_POSITIVE, ARRAY)
+ CASE_TYPE(math, OP_POSITIVE, POOL_BYTE_ARRAY)
+ CASE_TYPE(math, OP_POSITIVE, POOL_INT_ARRAY)
+ CASE_TYPE(math, OP_POSITIVE, POOL_REAL_ARRAY)
+ CASE_TYPE(math, OP_POSITIVE, POOL_STRING_ARRAY)
+ CASE_TYPE(math, OP_POSITIVE, POOL_VECTOR2_ARRAY)
+ CASE_TYPE(math, OP_POSITIVE, POOL_VECTOR3_ARRAY)
+ CASE_TYPE(math, OP_POSITIVE, POOL_COLOR_ARRAY)
+ _RETURN_FAIL;
+ }
+
+ SWITCH_OP(math, OP_NEGATE, p_a.type) {
+ DEFAULT_OP_NUM_NEG(math, OP_NEGATE, INT, _int);
+ DEFAULT_OP_NUM_NEG(math, OP_NEGATE, REAL, _real);
+
+ DEFAULT_OP_LOCALMEM_NEG(math, OP_NEGATE, VECTOR2, Vector2);
+ DEFAULT_OP_LOCALMEM_NEG(math, OP_NEGATE, VECTOR3, Vector3);
+ DEFAULT_OP_LOCALMEM_NEG(math, OP_NEGATE, PLANE, Plane);
+ DEFAULT_OP_LOCALMEM_NEG(math, OP_NEGATE, QUAT, Quat);
+ DEFAULT_OP_LOCALMEM_NEG(math, OP_NEGATE, COLOR, Color);
+
+ CASE_TYPE(math, OP_NEGATE, NIL)
+ CASE_TYPE(math, OP_NEGATE, BOOL)
+ CASE_TYPE(math, OP_NEGATE, STRING)
+ CASE_TYPE(math, OP_NEGATE, RECT2)
+ CASE_TYPE(math, OP_NEGATE, TRANSFORM2D)
+ CASE_TYPE(math, OP_NEGATE, RECT3)
+ CASE_TYPE(math, OP_NEGATE, BASIS)
+ CASE_TYPE(math, OP_NEGATE, TRANSFORM)
+ CASE_TYPE(math, OP_NEGATE, NODE_PATH)
+ CASE_TYPE(math, OP_NEGATE, _RID)
+ CASE_TYPE(math, OP_NEGATE, OBJECT)
+ CASE_TYPE(math, OP_NEGATE, DICTIONARY)
+ CASE_TYPE(math, OP_NEGATE, ARRAY)
+ CASE_TYPE(math, OP_NEGATE, POOL_BYTE_ARRAY)
+ CASE_TYPE(math, OP_NEGATE, POOL_INT_ARRAY)
+ CASE_TYPE(math, OP_NEGATE, POOL_REAL_ARRAY)
+ CASE_TYPE(math, OP_NEGATE, POOL_STRING_ARRAY)
+ CASE_TYPE(math, OP_NEGATE, POOL_VECTOR2_ARRAY)
+ CASE_TYPE(math, OP_NEGATE, POOL_VECTOR3_ARRAY)
+ CASE_TYPE(math, OP_NEGATE, POOL_COLOR_ARRAY)
+ _RETURN_FAIL;
+ }
+
+ SWITCH_OP(math, OP_MODULE, p_a.type) {
+ CASE_TYPE(math, OP_MODULE, INT) {
+ if (p_b.type != INT)
+ _RETURN_FAIL;
#ifdef DEBUG_ENABLED
if (p_b._data._int == 0) {
r_valid = false;
@@ -827,8 +1052,9 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, const Variant &
}
#endif
_RETURN(p_a._data._int % p_b._data._int);
+ }
- } else if (p_a.type == STRING) {
+ CASE_TYPE(math, OP_MODULE, STRING) {
const String *format = reinterpret_cast<const String *>(p_a._data._mem);
String result;
@@ -847,119 +1073,143 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, const Variant &
_RETURN(result);
}
- r_valid = false;
- return;
+ CASE_TYPE(math, OP_MODULE, NIL)
+ CASE_TYPE(math, OP_MODULE, BOOL)
+ CASE_TYPE(math, OP_MODULE, REAL)
+ CASE_TYPE(math, OP_MODULE, VECTOR2)
+ CASE_TYPE(math, OP_MODULE, RECT2)
+ CASE_TYPE(math, OP_MODULE, VECTOR3)
+ CASE_TYPE(math, OP_MODULE, TRANSFORM2D)
+ CASE_TYPE(math, OP_MODULE, PLANE)
+ CASE_TYPE(math, OP_MODULE, QUAT)
+ CASE_TYPE(math, OP_MODULE, RECT3)
+ CASE_TYPE(math, OP_MODULE, BASIS)
+ CASE_TYPE(math, OP_MODULE, TRANSFORM)
+ CASE_TYPE(math, OP_MODULE, COLOR)
+ CASE_TYPE(math, OP_MODULE, NODE_PATH)
+ CASE_TYPE(math, OP_MODULE, _RID)
+ CASE_TYPE(math, OP_MODULE, OBJECT)
+ CASE_TYPE(math, OP_MODULE, DICTIONARY)
+ CASE_TYPE(math, OP_MODULE, ARRAY)
+ CASE_TYPE(math, OP_MODULE, POOL_BYTE_ARRAY)
+ CASE_TYPE(math, OP_MODULE, POOL_INT_ARRAY)
+ CASE_TYPE(math, OP_MODULE, POOL_REAL_ARRAY)
+ CASE_TYPE(math, OP_MODULE, POOL_STRING_ARRAY)
+ CASE_TYPE(math, OP_MODULE, POOL_VECTOR2_ARRAY)
+ CASE_TYPE(math, OP_MODULE, POOL_VECTOR3_ARRAY)
+ CASE_TYPE(math, OP_MODULE, POOL_COLOR_ARRAY)
+ _RETURN_FAIL;
+ }
- } break;
- case OP_STRING_CONCAT: {
+ SWITCH_OP(math, OP_STRING_CONCAT, p_a.type) {
+ CASE_TYPE_ALL(math, OP_STRING_CONCAT)
_RETURN(p_a.operator String() + p_b.operator String());
- } break;
- //bitwise
- case OP_SHIFT_LEFT: {
- if (p_a.type == INT && p_b.type == INT)
+ }
+
+ SWITCH_OP(math, OP_SHIFT_LEFT, p_a.type) {
+ CASE_TYPE(math, OP_SHIFT_LEFT, INT) {
+ if (p_b.type != INT)
+ _RETURN_FAIL;
_RETURN(p_a._data._int << p_b._data._int);
+ }
- r_valid = false;
- return;
+ CASE_TYPE_ALL_BUT_INT(math, OP_SHIFT_LEFT)
+ _RETURN_FAIL;
+ }
- } break;
- case OP_SHIFT_RIGHT: {
- if (p_a.type == INT && p_b.type == INT)
+ SWITCH_OP(math, OP_SHIFT_RIGHT, p_a.type) {
+ CASE_TYPE(math, OP_SHIFT_RIGHT, INT) {
+ if (p_b.type != INT)
+ _RETURN_FAIL;
_RETURN(p_a._data._int >> p_b._data._int);
+ }
- r_valid = false;
- return;
+ CASE_TYPE_ALL_BUT_INT(math, OP_SHIFT_RIGHT)
+ _RETURN_FAIL;
+ }
- } break;
- case OP_BIT_AND: {
- if (p_a.type == INT && p_b.type == INT)
+ SWITCH_OP(math, OP_BIT_AND, p_a.type) {
+ CASE_TYPE(math, OP_BIT_AND, INT) {
+ if (p_b.type != INT)
+ _RETURN_FAIL;
_RETURN(p_a._data._int & p_b._data._int);
+ }
- r_valid = false;
- return;
-
- } break;
- case OP_BIT_OR: {
+ CASE_TYPE_ALL_BUT_INT(math, OP_BIT_AND)
+ _RETURN_FAIL;
+ }
- if (p_a.type == INT && p_b.type == INT)
+ SWITCH_OP(math, OP_BIT_OR, p_a.type) {
+ CASE_TYPE(math, OP_BIT_OR, INT) {
+ if (p_b.type != INT)
+ _RETURN_FAIL;
_RETURN(p_a._data._int | p_b._data._int);
+ }
- r_valid = false;
- return;
-
- } break;
- case OP_BIT_XOR: {
+ CASE_TYPE_ALL_BUT_INT(math, OP_BIT_OR)
+ _RETURN_FAIL;
+ }
- if (p_a.type == INT && p_b.type == INT)
+ SWITCH_OP(math, OP_BIT_XOR, p_a.type) {
+ CASE_TYPE(math, OP_BIT_XOR, INT) {
+ if (p_b.type != INT)
+ _RETURN_FAIL;
_RETURN(p_a._data._int ^ p_b._data._int);
+ }
- r_valid = false;
- return;
-
- } break;
- case OP_BIT_NEGATE: {
+ CASE_TYPE_ALL_BUT_INT(math, OP_BIT_XOR)
+ _RETURN_FAIL;
+ }
- if (p_a.type == INT)
+ SWITCH_OP(math, OP_BIT_NEGATE, p_a.type) {
+ CASE_TYPE(math, OP_BIT_NEGATE, INT) {
_RETURN(~p_a._data._int);
+ }
- r_valid = false;
- return;
+ CASE_TYPE_ALL_BUT_INT(math, OP_BIT_NEGATE)
+ _RETURN_FAIL;
+ }
- } break;
- //logic
- case OP_AND: {
- bool l = p_a.booleanize(r_valid);
- if (!r_valid)
- return;
- bool r = p_b.booleanize(r_valid);
- if (!r_valid)
- return;
+ SWITCH_OP(math, OP_AND, p_a.type) {
+ CASE_TYPE_ALL(math, OP_AND) {
+ bool l = p_a.booleanize();
+ bool r = p_b.booleanize();
- _RETURN(l && r);
- } break;
- case OP_OR: {
- bool l = p_a.booleanize(r_valid);
- if (!r_valid)
- return;
- bool r = p_b.booleanize(r_valid);
- if (!r_valid)
- return;
+ _RETURN(l && r);
+ }
+ }
- _RETURN(l || r);
+ SWITCH_OP(math, OP_OR, p_a.type) {
+ CASE_TYPE_ALL(math, OP_OR) {
+ bool l = p_a.booleanize();
+ bool r = p_b.booleanize();
- } break;
- case OP_XOR: {
- bool l = p_a.booleanize(r_valid);
- if (!r_valid)
- return;
- bool r = p_b.booleanize(r_valid);
- if (!r_valid)
- return;
+ _RETURN(l || r);
+ }
+ }
- _RETURN((l || r) && !(l && r));
- } break;
- case OP_NOT: {
+ SWITCH_OP(math, OP_XOR, p_a.type) {
+ CASE_TYPE_ALL(math, OP_XOR) {
+ bool l = p_a.booleanize();
+ bool r = p_b.booleanize();
- bool l = p_a.booleanize(r_valid);
- if (!r_valid)
- return;
- _RETURN(!l);
+ _RETURN((l || r) && !(l && r));
+ }
+ }
- } break;
- case OP_IN: {
+ SWITCH_OP(math, OP_NOT, p_a.type) {
+ CASE_TYPE_ALL(math, OP_NOT) {
+ bool l = p_a.booleanize();
+ _RETURN(!l);
+ }
+ }
+ SWITCH_OP(math, OP_IN, p_a.type) {
+ CASE_TYPE_ALL(math, OP_IN)
_RETURN(p_b.in(p_a, &r_valid));
-
- } break;
- case OP_MAX: {
-
- r_valid = false;
- ERR_FAIL();
}
}
-
- r_valid = false;
}
void Variant::set_named(const StringName &p_index, const Variant &p_value, bool *r_valid) {
@@ -1512,7 +1762,8 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid)
DEFAULT_OP_DVECTOR_SET(POOL_VECTOR2_ARRAY, Vector2, p_value.type != Variant::VECTOR2) // 25
DEFAULT_OP_DVECTOR_SET(POOL_VECTOR3_ARRAY, Vector3, p_value.type != Variant::VECTOR3)
DEFAULT_OP_DVECTOR_SET(POOL_COLOR_ARRAY, Color, p_value.type != Variant::COLOR)
- default: return;
+ default:
+ return;
}
}
@@ -1885,7 +2136,8 @@ Variant Variant::get(const Variant &p_index, bool *r_valid) const {
DEFAULT_OP_DVECTOR_GET(POOL_VECTOR2_ARRAY, Vector2) // 25
DEFAULT_OP_DVECTOR_GET(POOL_VECTOR3_ARRAY, Vector3)
DEFAULT_OP_DVECTOR_GET(POOL_COLOR_ARRAY, Color)
- default: return Variant();
+ default:
+ return Variant();
}
return Variant();
@@ -2374,7 +2626,8 @@ bool Variant::iter_init(Variant &r_iter, bool &valid) const {
return true;
} break;
- default: {}
+ default: {
+ }
}
valid = false;
@@ -2401,7 +2654,7 @@ bool Variant::iter_next(Variant &r_iter, bool &valid) const {
return true;
} break;
case VECTOR2: {
- int64_t to = reinterpret_cast<const Vector3 *>(_data._mem)->y;
+ int64_t to = reinterpret_cast<const Vector2 *>(_data._mem)->y;
int64_t idx = r_iter;
idx++;
@@ -2793,7 +3046,9 @@ void Variant::blend(const Variant &a, const Variant &b, float c, Variant &r_dst)
r_dst = Color(r, g, b, a);
}
return;
- default: { r_dst = c < 0.5 ? a : b; }
+ default: {
+ r_dst = c < 0.5 ? a : b;
+ }
return;
}
}
diff --git a/doc/classes/@GDScript.xml b/doc/classes/@GDScript.xml
index 52df939fc5..b61cf93ef7 100644
--- a/doc/classes/@GDScript.xml
+++ b/doc/classes/@GDScript.xml
@@ -23,11 +23,11 @@
<argument index="3" name="a8" type="int">
</argument>
<description>
- Returns a 32 bit color with red, green, blue and alpha channels. Each channel has 8bits of information ranging from 0 to 255.
- 'r8' red channel
- 'g8' green channel
- 'b8' blue channel
- 'a8' alpha channel
+ Returns a 32 bit color with red, green, blue and alpha channels. Each channel has 8 bits of information ranging from 0 to 255.
+ [code]r8[/code] red channel
+ [code]g8[/code] green channel
+ [code]b8[/code] blue channel
+ [code]a8[/code] alpha channel
[codeblock]
red = Color8(255, 0, 0)
[/codeblock]
@@ -41,7 +41,7 @@
<argument index="1" name="alpha" type="float">
</argument>
<description>
- Returns color 'name' with alpha ranging from 0 to 1. Note: 'name' is defined in color_names.inc.
+ Returns color [code]name[/code] with [code]alpha[/code] ranging from 0 to 1. Note: [code]name[/code] is defined in color_names.inc.
[codeblock]
red = ColorN('red')
[/codeblock]
@@ -53,7 +53,7 @@
<argument index="0" name="s" type="float">
</argument>
<description>
- Returns the absolute value of parameter 's' (i.e. unsigned value, works for integer and float).
+ Returns the absolute value of parameter [code]s[/code] (i.e. unsigned value, works for integer and float).
[codeblock]
# a is 1
a = abs(-1)
@@ -66,7 +66,7 @@
<argument index="0" name="s" type="float">
</argument>
<description>
- Returns the arc cosine of 's' in radians. Use to get the angle of cosine 's'.
+ Returns the arc cosine of [code]s[/code] in radians. Use to get the angle of cosine [code]s[/code].
[codeblock]
# c is 0.523599 or 30 degrees if converted with rad2deg(s)
c = acos(0.866025)
@@ -79,10 +79,10 @@
<argument index="0" name="s" type="float">
</argument>
<description>
- Returns the arc sine of 's' in radians. Use to get the angle of sine 's'.
+ Returns the arc sine of [code]s[/code] in radians. Use to get the angle of sine [code]s[/code].
[codeblock]
# s is 0.523599 or 30 degrees if converted with rad2deg(s)
- s = asin(0.5)
+ s = asin(0.5)
[/codeblock]
</description>
</method>
@@ -92,6 +92,14 @@
<argument index="0" name="condition" type="bool">
</argument>
<description>
+ Assert that the [code]condition[/code] is true. If the [code]condition[/code] is false a fatal error is generated and the program is halted. Useful for debugging to make sure a value is always true.
+ [codeblock]
+ # Speed should always be between 0 and 20
+ speed = -10
+ assert(speed &lt; 20) # Is true and program continues
+ assert(speed &gt;= 0) # Is false and program stops
+ assert(speed &gt;= 0 &amp;&amp; speed &lt; 20) # Or combined
+ [/codeblock]
</description>
</method>
<method name="atan">
@@ -100,6 +108,11 @@
<argument index="0" name="s" type="float">
</argument>
<description>
+ Returns the arc tangent of [code]s[/code] in radians. Use it to get the angle from an angle's tangent in trigonometry: [code]atan(tan(angle)) == angle[/code].
+ The method cannot know in which quadrant the angle should fall. See [method atan2] if you always want an exact angle.
+ [codeblock]
+ a = atan(0.5) # a is 0.463648
+ [/codeblock]
</description>
</method>
<method name="atan2">
@@ -110,10 +123,9 @@
<argument index="1" name="y" type="float">
</argument>
<description>
- Returns the arc tangent of y/x in radians. Use to get the angle of tangent y/x. To compute the value, the function takes into account the sign of both arguments in order to determine the quadrant.
+ Returns the arc tangent of [code]y/x[/code] in radians. Use to get the angle of tangent [code]y/x[/code]. To compute the value, the method takes into account the sign of both arguments in order to determine the quadrant.
[codeblock]
- # a is 3.141593
- a = atan(0,-1)
+ a = atan(0,-1) # a is 3.141593
[/codeblock]
</description>
</method>
@@ -123,7 +135,7 @@
<argument index="0" name="bytes" type="PoolByteArray">
</argument>
<description>
- Decode a byte array back to a value.
+ Decodes a byte array back to a value.
</description>
</method>
<method name="ceil">
@@ -132,12 +144,10 @@
<argument index="0" name="s" type="float">
</argument>
<description>
- Rounds 's' upward, returning the smallest integral value that is not less than 's'.
+ Rounds [code]s[/code] upward, returning the smallest integral value that is not less than [code]s[/code].
[codeblock]
- # i is 2
- i = ceil(1.45)
- # i is 2
- i = ceil(1.001)
+ i = ceil(1.45) # i is 2
+ i = ceil(1.001) # i is 2
[/codeblock]
</description>
</method>
@@ -147,7 +157,7 @@
<argument index="0" name="ascii" type="int">
</argument>
<description>
- Returns a character as String of the given ASCII code.
+ Returns a character as a String of the given ASCII code.
[codeblock]
# a is 'A'
a = char(65)
@@ -166,7 +176,7 @@
<argument index="2" name="max" type="float">
</argument>
<description>
- Clamp 'val' and return a value not less than 'min' and not more than 'max'.
+ Clamps [code]val[/code] and returns a value not less than [code]min[/code] and not more than [code]max[/code].
[codeblock]
speed = 1000
# a is 20
@@ -186,7 +196,7 @@
<argument index="1" name="type" type="int">
</argument>
<description>
- Convert from a type to another in the best way possible. The "type" parameter uses the enum TYPE_* in [@Global Scope].
+ Converts from a type to another in the best way possible. The [code]type[/code] parameter uses the enum TYPE_* in [@Global Scope].
[codeblock]
a = Vector2(1, 0)
# prints 1
@@ -204,7 +214,7 @@
<argument index="0" name="s" type="float">
</argument>
<description>
- Returns the cosine of angle 's' in radians.
+ Returns the cosine of angle [code]s[/code] in radians.
[codeblock]
# prints 1 and -1
print(cos(PI*2))
@@ -218,7 +228,7 @@
<argument index="0" name="s" type="float">
</argument>
<description>
- Returns the hyperbolic cosine of 's' in radians.
+ Returns the hyperbolic cosine of [code]s[/code] in radians.
[codeblock]
# prints 1.543081
print(cosh(1))
@@ -231,7 +241,7 @@
<argument index="0" name="db" type="float">
</argument>
<description>
- Convert from decibels to linear energy (audio).
+ Converts from decibels to linear energy (audio).
</description>
</method>
<method name="decimals">
@@ -240,7 +250,7 @@
<argument index="0" name="step" type="float">
</argument>
<description>
- Returns the number of digit places after the decimal that the first non-zero digit occurs.
+ Returns the position of the first non-zero digit, after the decimal point.
[codeblock]
# n is 2
n = decimals(0.035)
@@ -257,7 +267,7 @@
<argument index="2" name="step" type="float">
</argument>
<description>
- Returns the result of 'value' decreased by 'step' * 'amount'.
+ Returns the result of [code]value[/code] decreased by [code]step[/code] * [code]amount[/code].
[codeblock]
# a = 59
a = dectime(60, 10, 0.1))
@@ -283,7 +293,7 @@
<argument index="0" name="dict" type="Dictionary">
</argument>
<description>
- Convert a previously converted instance to dictionary back into an instance. Useful for deserializing.
+ Converts a previously converted instance to a dictionary, back into an instance. Useful for deserializing.
</description>
</method>
<method name="ease">
@@ -303,7 +313,10 @@
<argument index="0" name="s" type="float">
</argument>
<description>
- Returns [b]e[/b] raised to the power of 's'. [b]e[/b] sometimes called "Euler's number" is a mathematical constant whose value is approximately 2.71828.
+ Raises the Euler's constant [b]e[/b] to the power of [code]s[/code] and returns it. [b]e[/b] has an approximate value of 2.71828.
+ [codeblock]
+ a = exp(2) # approximately 7.39
+ [/codeblock]
</description>
</method>
<method name="floor">
@@ -312,7 +325,13 @@
<argument index="0" name="s" type="float">
</argument>
<description>
- Returns the largest integer value (rounded down) that is less than or equal to 's'.
+ Rounds [code]s[/code] to the closest smaller integer and returns it.
+ [codeblock]
+ # a is 2
+ a = floor(2.99)
+ # a is -3
+ a = floor(-2.99)
+ [/codeblock]
</description>
</method>
<method name="fmod">
@@ -323,11 +342,11 @@
<argument index="1" name="y" type="float">
</argument>
<description>
- Returns the floating-point remainder of x/y (rounded towards zero):
+ Returns the floating-point remainder of [code]x/y[/code].
[codeblock]
- fmod = x - tquot * y
+ # remainder is 1.5
+ var remainder = fmod(7, 5.5)
[/codeblock]
- Where tquot is the truncated (i.e., rounded towards zero) result of: x/y.
</description>
</method>
<method name="fposmod">
@@ -338,6 +357,26 @@
<argument index="1" name="y" type="float">
</argument>
<description>
+ Returns the floating-point remainder of [code]x/y[/code] that wraps equally in positive and negative.
+ [codeblock]
+ var i = -10;
+ while i &lt; 0:
+ prints(i, fposmod(i, 10))
+ i += 1
+ [/codeblock]
+ Produces:
+ [codeblock]
+ -10 10
+ -9 1
+ -8 2
+ -7 3
+ -6 4
+ -5 5
+ -4 6
+ -3 7
+ -2 8
+ -1 9
+ [/codeblock]
</description>
</method>
<method name="funcref">
@@ -348,6 +387,14 @@
<argument index="1" name="funcname" type="String">
</argument>
<description>
+ Returns a reference to the specified function [code]funcname[/code] in the [code]instance[/code] node. As functions aren't first-class objects in GDscript, use [code]funcref[/code] to store a [FuncRef] in a variable and call it later.
+ [codeblock]
+ func foo():
+ return("bar")
+
+ a = funcref(self, "foo")
+ print(a.call_func()) # prints bar
+ [/codeblock]
</description>
</method>
<method name="hash">
@@ -358,8 +405,7 @@
<description>
Returns the integer hash of the variable passed.
[codeblock]
- # print 177670
- print(hash("a"))
+ print(hash("a")) # prints 177670
[/codeblock]
</description>
</method>
@@ -369,7 +415,7 @@
<argument index="0" name="inst" type="Object">
</argument>
<description>
- Returns the passed instance converted a dictionary (useful for serializing).
+ Returns the passed instance converted to a dictionary (useful for serializing).
[codeblock]
var foo = "bar"
func _ready():
@@ -390,15 +436,14 @@
<argument index="0" name="instance_id" type="int">
</argument>
<description>
- Returns the Object that corresponds to 'instance_id'. All Objects have a unique instance ID.
+ Returns the Object that corresponds to [code]instance_id[/code]. All Objects have a unique instance ID.
[codeblock]
var foo = "bar"
func _ready():
var id = get_instance_id()
var inst = instance_from_id(id)
- print(inst.foo)
+ print(inst.foo) # prints bar
[/codeblock]
- Prints "bar"
</description>
</method>
<method name="inverse_lerp">
@@ -413,7 +458,7 @@
<description>
Returns a normalized value considering the given range.
[codeblock]
- inverse_lerp(3, 5, 4) # return 0.5
+ inverse_lerp(3, 5, 4) # returns 0.5
[/codeblock]
</description>
</method>
@@ -423,7 +468,7 @@
<argument index="0" name="s" type="float">
</argument>
<description>
- Returns True/False whether 's' is an infinity value (either positive infinity or negative infinity).
+ Returns True/False whether [code]s[/code] is an infinity value (either positive infinity or negative infinity).
</description>
</method>
<method name="is_nan">
@@ -432,7 +477,7 @@
<argument index="0" name="s" type="float">
</argument>
<description>
- Returns True/False whether 's' is a NaN (Not-A-Number) value.
+ Returns True/False whether [code]s[/code] is a NaN (Not-A-Number) value.
</description>
</method>
<method name="len">
@@ -441,12 +486,11 @@
<argument index="0" name="var" type="Variant">
</argument>
<description>
- Returns length of Variant 'var'. Length is the character count of String, element count of Array, size of Dictionary, etc. Note: Generates a fatal error if Variant can not provide a length.
+ Returns length of Variant [code]var[/code]. Length is the character count of String, element count of Array, size of Dictionary, etc. Note: Generates a fatal error if Variant can not provide a length.
[codeblock]
a = [1, 2, 3, 4]
- print(len(a))
+ len(a) # returns 4
[/codeblock]
- Prints 4
</description>
</method>
<method name="lerp">
@@ -459,7 +503,10 @@
<argument index="2" name="weight" type="float">
</argument>
<description>
- Linear interpolates between two values by a normalized value.
+ Linearly interpolates between two values by a normalized value.
+ [codeblock]
+ lerp(1, 3, 0.5) # returns 2
+ [/codeblock]
</description>
</method>
<method name="linear2db">
@@ -468,7 +515,7 @@
<argument index="0" name="nrg" type="float">
</argument>
<description>
- Convert from linear energy to decibels (audio).
+ Converts from linear energy to decibels (audio).
</description>
</method>
<method name="load">
@@ -477,7 +524,7 @@
<argument index="0" name="path" type="String">
</argument>
<description>
- Load a resource from the filesystem located at 'path'. Note: resource paths can be obtained by right clicking on a resource in the Assets Pannel and choosing "Copy Path".
+ Loads a resource from the filesystem located at 'path'. Note: resource paths can be obtained by right clicking on a resource in the Assets Panel and choosing "Copy Path".
[codeblock]
# load a scene called main located in the root of the project directory
var main = load("res://main.tscn")
@@ -490,10 +537,9 @@
<argument index="0" name="s" type="float">
</argument>
<description>
- Natural logarithm. The amount of time needed to reach a certain level of continuous growth. Note: This is not the same as the log funcation on your calculator which is a base 10 logarithm.
+ Natural logarithm. The amount of time needed to reach a certain level of continuous growth. Note: This is not the same as the log function on your calculator which is a base 10 logarithm.
[codeblock]
- # a is 2.302585
- a = log(10)
+ log(10) # returns 2.302585
[/codeblock]
</description>
</method>
@@ -507,10 +553,8 @@
<description>
Returns the maximum of two values.
[codeblock]
- # a is 2
- a = max(1,2)
- # a is -3.99
- a = max(-3.99, -4)
+ max(1,2) # returns 2
+ max(-3.99, -4) # returns -3.99
[/codeblock]
</description>
</method>
@@ -524,10 +568,8 @@
<description>
Returns the minimum of two values.
[codeblock]
- # a is 1
- a = min(1,2)
- # a is -4
- a = min(-3.99, -4)
+ min(1,2) # returns 1
+ min(-3.99, -4) # returns -4
[/codeblock]
</description>
</method>
@@ -537,14 +579,11 @@
<argument index="0" name="val" type="int">
</argument>
<description>
- Returns the nearest larger power of 2 for an integer.
+ Returns the nearest larger power of 2 for integer [code]val[/code].
[codeblock]
- # a is 4
- a = nearest_po2(3)
- # a is 4
- a = nearest_po2(4)
- # a is 8
- a = nearest_po2(5)
+ nearest_po2(3) # returns 4
+ nearest_po2(4) # returns 4
+ nearest_po2(5) # returns 8
[/codeblock]
</description>
</method>
@@ -555,11 +594,11 @@
</argument>
<description>
Parse JSON text to a Variant (use [method typeof] to check if it is what you expect).
- 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 every numerical values to [float] types.
+ 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.
[codeblock]
p = parse_json('["a", "b", "c"]')
if typeof(p) == TYPE_ARRAY:
- print(p[0])
+ print(p[0]) # prints a
else:
print("unexpected results")
[/codeblock]
@@ -573,10 +612,9 @@
<argument index="1" name="y" type="float">
</argument>
<description>
- Returns the result of 'x' raised to the power of 'y'.
+ Returns the result of [code]x[/code] raised to the power of [code]y[/code].
[codeblock]
- # a is 32
- a = pow(2,5)
+ pow(2,5) # returns 32
[/codeblock]
</description>
</method>
@@ -586,10 +624,11 @@
<argument index="0" name="path" type="String">
</argument>
<description>
- Returns a resource from the filesystem that is loaded during script parsing. Note: resource paths can be obtained by right clicking on a resource in the Assets Pannel and choosing "Copy Path".
+ Returns a resource from the filesystem that is loaded during script parsing. Note: resource paths can be obtained by right clicking on a resource in the Assets Panel and choosing "Copy Path".
[codeblock]
# load a scene called main located in the root of the project directory
var main = preload("res://main.tscn")
+ [/codeblock]
</description>
</method>
<method name="print" qualifiers="vararg">
@@ -599,44 +638,61 @@
Converts one or more arguments to strings in the best way possible and prints them to the console.
[codeblock]
a = [1,2,3]
- print("a","b",a)
+ print("a","b",a) # prints ab[1, 2, 3]
[/codeblock]
- Prints ab[1, 2, 3]
</description>
</method>
<method name="print_stack">
<return type="void">
</return>
<description>
- Print a stack track at code location, only works when running with debugger turned on.
+ Prints a stack track at code location, only works when running with debugger turned on.
+ Output in the console would look something like this:
+ [codeblock]
+ Frame 0 - res://test.gd:16 in function '_process'
+ [/codeblock]
</description>
</method>
<method name="printerr" qualifiers="vararg">
<return type="void">
</return>
<description>
- Print one or more arguments to strings in the best way possible to standard error line.
+ Prints one or more arguments to strings in the best way possible to standard error line.
+ [codeblock]
+ printerr("prints to stderr")
+ [/codeblock]
</description>
</method>
<method name="printraw" qualifiers="vararg">
<return type="void">
</return>
<description>
- Print one or more arguments to strings in the best way possible to console. No newline is added at the end.
+ Prints one or more arguments to strings in the best way possible to console. No newline is added at the end.
+ [codeblock]
+ printraw("A")
+ printraw("B")
+ # prints AB
+ [/codeblock]
</description>
</method>
<method name="prints" qualifiers="vararg">
<return type="void">
</return>
<description>
- Print one or more arguments to the console with a space between each argument.
+ Prints one or more arguments to the console with a space between each argument.
+ [codeblock]
+ prints("A", "B", "C") # prints A B C
+ [/codeblock]
</description>
</method>
<method name="printt" qualifiers="vararg">
<return type="void">
</return>
<description>
- Print one or more arguments to the console with a tab between each argument.
+ Prints one or more arguments to the console with a tab between each argument.
+ [codeblock]
+ printt("A", "B", "C") # prints A B C
+ [/codeblock]
</description>
</method>
<method name="rad2deg">
@@ -645,7 +701,10 @@
<argument index="0" name="rad" type="float">
</argument>
<description>
- Convert from radians to degrees.
+ Converts from radians to degrees.
+ [codeblock]
+ rad2deg(0.523599) # returns 30
+ [/codeblock]
</description>
</method>
<method name="rand_range">
@@ -656,7 +715,10 @@
<argument index="1" name="to" type="float">
</argument>
<description>
- Random range, any floating point value between 'from' and 'to'.
+ Random range, any floating point value between [code]from[/code] and [code]to[/code].
+ [codeblock]
+ prints(rand_range(0, 1), rand_range(0, 1)) # prints 0.135591 0.405263
+ [/codeblock]
</description>
</method>
<method name="rand_seed">
@@ -665,35 +727,70 @@
<argument index="0" name="seed" type="int">
</argument>
<description>
- Random from seed: pass a seed, and an array with both number and new seed is returned. "Seed" here refers to the internal state of the pseudo random number generator. The internal state of the current implementation is 64 bits.
+ Random from seed: pass a [code]seed[/code], and an array with both number and new seed is returned. "Seed" here refers to the internal state of the pseudo random number generator. The internal state of the current implementation is 64 bits.
</description>
</method>
<method name="randf">
<return type="float">
</return>
<description>
- Return a random floating point value between 0 and 1.
+ Returns a random floating point value between 0 and 1.
+ [codeblock]
+ randf() # returns 0.375671
+ [/codeblock]
</description>
</method>
<method name="randi">
<return type="int">
</return>
<description>
- 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 remainder. For example, to get a random integer between 0 and 19 inclusive, you can use randi() % 20.
+ Returns a random 32 bit integer. Use remainder to obtain a random value between 0 and N (where N is smaller than 2^32 -1).
+ [codeblock]
+ randi() % 20 # returns random number between 0 and 19
+ randi() % 100 # returns random number between 0 and 99
+ randi() % 100 + 1 # returns random number between 1 and 100
+ [/codeblock]
</description>
</method>
<method name="randomize">
<return type="void">
</return>
<description>
- Randomize the seed (or the internal state) of the random number generator. Current implementation reseeds using a number based on time.
+ Randomizes the seed (or the internal state) of the random number generator. Current implementation reseeds using a number based on time.
+ [codeblock]
+ func _ready():
+ randomize()
+ [/codeblock]
</description>
</method>
<method name="range" qualifiers="vararg">
<return type="Array">
</return>
<description>
- Return an array with the given range. Range can be 1 argument N (0 to N-1), two arguments (initial, final-1) or three arguments (initial, final-1, increment).
+ Returns an array with the given range. Range can be 1 argument N (0 to N-1), two arguments (initial, final-1) or three arguments (initial, final-1, increment).
+ [codeblock]
+ for i in range(4):
+ print(i)
+ for i in range(2, 5):
+ print(i)
+ for i in range(0, 6, 2):
+ print(i)
+ [/codeblock]
+ Output:
+ [codeblock]
+ 0
+ 1
+ 2
+ 3
+
+ 2
+ 3
+ 4
+
+ 0
+ 2
+ 4
+ [/codeblock]
</description>
</method>
<method name="range_lerp">
@@ -710,7 +807,7 @@
<argument index="4" name="ostop" type="float">
</argument>
<description>
- Maps a value from range [istart, istop] to [ostart, ostop].
+ Maps a [code]value[/code] from range [code][istart, istop][/code] to [code][ostart, ostop][/code].
[codeblock]
range_lerp(75, 0, 100, -1, 1) # returns 0.5
[/codeblock]
@@ -722,7 +819,10 @@
<argument index="0" name="s" type="float">
</argument>
<description>
- Returns the integral value that is nearest to s, with halfway cases rounded away from zero.
+ Returns the integral value that is nearest to [code]s[/code], with halfway cases rounded away from zero.
+ [codeblock]
+ round(2.6) # returns 3
+ [/codeblock]
</description>
</method>
<method name="seed">
@@ -731,7 +831,11 @@
<argument index="0" name="seed" type="int">
</argument>
<description>
- Set seed for the random number generator.
+ Sets seed for the random number generator.
+ [codeblock]
+ my_seed = "Godot Rocks"
+ seed(my_seed.hash())
+ [/codeblock]
</description>
</method>
<method name="sign">
@@ -740,7 +844,11 @@
<argument index="0" name="s" type="float">
</argument>
<description>
- Return sign (-1 or +1).
+ Returns sign of [code]s[/code] -1 or 1.
+ [codeblock]
+ sign(-6) # returns -1
+ sign(6) # returns 1
+ [/codeblock]
</description>
</method>
<method name="sin">
@@ -749,7 +857,10 @@
<argument index="0" name="s" type="float">
</argument>
<description>
- Returns the sine of an angle of s radians.
+ Returns the sine of angle [code]s[/code] in radians.
+ [codeblock]
+ sin(0.523599) # returns 0.5
+ [/codeblock]
</description>
</method>
<method name="sinh">
@@ -758,7 +869,11 @@
<argument index="0" name="s" type="float">
</argument>
<description>
- Returns the hyperbolic sine of s.
+ Returns the hyperbolic sine of [code]s[/code].
+ [codeblock]
+ a = log(2.0) # returns 0.693147
+ sinh(a) # returns 0.75
+ [/codeblock]
</description>
</method>
<method name="sqrt">
@@ -767,7 +882,10 @@
<argument index="0" name="s" type="float">
</argument>
<description>
- Returns the square root of s.
+ Returns the square root of [code]s[/code].
+ [codeblock]
+ sqrt(9) # returns 3
+ [/codeblock]
</description>
</method>
<method name="stepify">
@@ -778,14 +896,20 @@
<argument index="1" name="step" type="float">
</argument>
<description>
- Snap float value to a given step.
+ Snaps float value [code]s[/code] to a given [code]step[/code].
</description>
</method>
<method name="str" qualifiers="vararg">
<return type="String">
</return>
<description>
- Convert one or more arguments to string in the best way possible.
+ Converts one or more arguments to string in the best way possible.
+ [codeblock]
+ var a = [10, 20, 30]
+ var b = str(a);
+ len(a) # returns 3
+ len(b) # returns 12
+ [/codeblock]
</description>
</method>
<method name="str2var">
@@ -794,7 +918,12 @@
<argument index="0" name="string" type="String">
</argument>
<description>
- Convert a formatted string that was returned by [method var2str] to the original value.
+ Converts a formatted string that was returned by [method var2str] to the original value.
+ [codeblock]
+ a = '{ "a": 1, "b": 2 }'
+ b = str2var(a)
+ print(b['a']) # prints 1
+ [/codeblock]
</description>
</method>
<method name="tan">
@@ -803,7 +932,10 @@
<argument index="0" name="s" type="float">
</argument>
<description>
- Returns the tangent of an angle of s radians.
+ Returns the tangent of angle [code]s[/code] in radians.
+ [codeblock]
+ tan( deg2rad(45) ) # returns 1
+ [/codeblock]
</description>
</method>
<method name="tanh">
@@ -812,7 +944,11 @@
<argument index="0" name="s" type="float">
</argument>
<description>
- Returns the hyperbolic tangent of s.
+ Returns the hyperbolic tangent of [code]s[/code].
+ [codeblock]
+ a = log(2.0) # returns 0.693147
+ tanh(a) # returns 0.6
+ [/codeblock]
</description>
</method>
<method name="to_json">
@@ -821,7 +957,12 @@
<argument index="0" name="var" type="Variant">
</argument>
<description>
- Convert a Variant to json text.
+ Converts a Variant [code]var[/code] to JSON text and return the result. Useful for serializing data to store or send over the network.
+ [codeblock]
+ a = { 'a': 1, 'b': 2 }
+ b = to_json(a)
+ print(b) # {"a":1, "b":2}
+ [/codeblock]
</description>
</method>
<method name="type_exists">
@@ -830,7 +971,7 @@
<argument index="0" name="type" type="String">
</argument>
<description>
- Returns whether the given class is exist in [ClassDB].
+ Returns whether the given class exists in [ClassDB].
[codeblock]
type_exists("Sprite") # returns true
type_exists("Variant") # returns false
@@ -843,7 +984,14 @@
<argument index="0" name="what" type="Variant">
</argument>
<description>
- Return the internal type of the given Variant object, using the TYPE_* enum in [@Global Scope].
+ Returns the internal type of the given Variant object, using the TYPE_* enum in [@Global Scope].
+ [codeblock]
+ p = parse_json('["a", "b", "c"]')
+ if typeof(p) == TYPE_ARRAY:
+ print(p[0]) # prints a
+ else:
+ print("unexpected results")
+ [/codeblock]
</description>
</method>
<method name="validate_json">
@@ -852,7 +1000,15 @@
<argument index="0" name="json" type="String">
</argument>
<description>
- This method is used to validate the structure and data types of a piece of JSON, similar to XML Schema for XML.
+ Checks that [code]json[/code] is valid JSON data. Returns empty string if valid. Returns error message if not valid.
+ [codeblock]
+ j = to_json([1, 2, 3])
+ v = validate_json(j)
+ if not v:
+ print("valid")
+ else:
+ prints("invalid", v)
+ [/codeblock]
</description>
</method>
<method name="var2bytes">
@@ -861,7 +1017,7 @@
<argument index="0" name="var" type="Variant">
</argument>
<description>
- Encode a variable value to a byte array.
+ Encodes a variable value to a byte array.
</description>
</method>
<method name="var2str">
@@ -870,7 +1026,18 @@
<argument index="0" name="var" type="Variant">
</argument>
<description>
- Convert a value to a formatted string that can later be parsed using [method str2var].
+ Converts a Variant [code]var[/code] to a formatted string that can later be parsed using [method str2var].
+ [codeblock]
+ a = { 'a': 1, 'b': 2 }
+ print(var2str(a))
+ [/codeblock]
+ prints
+ [codeblock]
+ {
+ "a": 1,
+ "b": 2
+ }
+ [/codeblock]
</description>
</method>
<method name="weakref">
@@ -879,7 +1046,7 @@
<argument index="0" name="obj" type="Object">
</argument>
<description>
- Return a weak reference to an object.
+ Returns a weak reference to an object.
A weak reference to an object is not enough to keep the object alive: when the only remaining references to a referent are weak references, garbage collection is free to destroy the referent and reuse its memory for something else. However, until the object is actually destroyed the weak reference may return the object even if there are no strong references to it.
</description>
</method>
@@ -891,7 +1058,7 @@
<argument index="1" name="signal" type="String">
</argument>
<description>
- Stop the function execution and return the current state. Call [method GDFunctionState.resume] on the state to resume execution. This invalidates the state.
+ Stops the function execution and returns the current state. Call [method GDFunctionState.resume] on the state to resume execution. This invalidates the state.
Returns anything that was passed to the resume function call. If passed an object and a signal, the execution is resumed when the object's signal is emitted.
</description>
</method>
diff --git a/doc/classes/@Global Scope.xml b/doc/classes/@Global Scope.xml
index 4044c4ed1f..a8fd377ecf 100644
--- a/doc/classes/@Global Scope.xml
+++ b/doc/classes/@Global Scope.xml
@@ -38,6 +38,8 @@
<member name="InputMap" type="InputMap" setter="" getter="">
[InputMap] singleton
</member>
+ <member name="JSON" type="JSON" setter="" getter="">
+ </member>
<member name="Marshalls" type="Reference" setter="" getter="">
[Marshalls] singleton
</member>
diff --git a/doc/classes/AStar.xml b/doc/classes/AStar.xml
index d94b8355ba..9b15afbbd4 100644
--- a/doc/classes/AStar.xml
+++ b/doc/classes/AStar.xml
@@ -39,7 +39,7 @@
</return>
<argument index="0" name="id" type="int">
</argument>
- <argument index="1" name="pos" type="Vector3">
+ <argument index="1" name="position" type="Vector3">
</argument>
<argument index="2" name="weight_scale" type="float" default="1.0">
</argument>
@@ -113,19 +113,19 @@
<method name="get_closest_point" qualifiers="const">
<return type="int">
</return>
- <argument index="0" name="to_pos" type="Vector3">
+ <argument index="0" name="to_position" type="Vector3">
</argument>
<description>
- Returns the id of the closest point to [code]to_pos[/code]. Returns -1 if there are no points in the points pool.
+ Returns the id of the closest point to [code]to_position[/code]. Returns -1 if there are no points in the points pool.
</description>
</method>
- <method name="get_closest_pos_in_segment" qualifiers="const">
+ <method name="get_closest_position_in_segment" qualifiers="const">
<return type="Vector3">
</return>
- <argument index="0" name="to_pos" type="Vector3">
+ <argument index="0" name="to_position" type="Vector3">
</argument>
<description>
- Returns the closest position to [code]to_pos[/code] that resides inside a segment between two connected points.
+ Returns the closest position to [code]to_position[/code] that resides inside a segment between two connected points.
[codeblock]
var as = AStar.new()
@@ -134,7 +134,7 @@
as.connect_points(1, 2)
- var res = as.get_closest_pos_in_segment(Vector3(3,3,0)) # returns (0, 3, 0)
+ var res = as.get_closest_position_in_segment(Vector3(3,3,0)) # returns (0, 3, 0)
[/codeblock]
The result is in the segment that goes from [code]y=0[/code] to [code]y=5[/code]. It's the closest position in the segment to the given point.
</description>
@@ -178,7 +178,7 @@
Returns an array with the points that are in the path found by AStar between the given points. The array is ordered from the starting point to the ending point of the path.
</description>
</method>
- <method name="get_point_pos" qualifiers="const">
+ <method name="get_point_position" qualifiers="const">
<return type="Vector3">
</return>
<argument index="0" name="id" type="int">
diff --git a/doc/classes/AcceptDialog.xml b/doc/classes/AcceptDialog.xml
index 8821a450e5..4244e66a35 100644
--- a/doc/classes/AcceptDialog.xml
+++ b/doc/classes/AcceptDialog.xml
@@ -21,8 +21,8 @@
<argument index="2" name="action" type="String" default="&quot;&quot;">
</argument>
<description>
- Add custom button to the dialog and return the created button.
- The button titled with [i]text[/i] and the [i]action[/i] will be passed to [custom_action] signal when it is pressed.
+ Adds a button with label [i]text[/i] and a custom [i]action[/i] to the dialog and returns the created button. [i]action[/i] will be passed to the [custom_action] signal when pressed.
+ If [code]true[/code], [i]right[/i] will place the button to the right of any sibling buttons. Default value: [code]false[/code].
</description>
</method>
<method name="add_cancel">
@@ -31,7 +31,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
- Add custom cancel button to the dialog and return the created button.
+ Adds a button with label [i]name[/i] and a cancel action to the dialog and returns the created button.
</description>
</method>
<method name="get_hide_on_ok" qualifiers="const">
@@ -68,7 +68,7 @@
<argument index="0" name="line_edit" type="Node">
</argument>
<description>
- Register a [LineEdit] in the dialog. When the enter key is pressed, the dialog will be accepted.
+ Registers a [LineEdit] in the dialog. When the enter key is pressed, the dialog will be accepted.
</description>
</method>
<method name="set_hide_on_ok">
@@ -99,14 +99,14 @@
<signals>
<signal name="confirmed">
<description>
- Emitted when accepted.
+ Emitted when the dialog is accepted.
</description>
</signal>
<signal name="custom_action">
<argument index="0" name="action" type="String">
</argument>
<description>
- Emitted with a custom button is added.
+ Emitted when a custom button is pressed. See [method add_button].
</description>
</signal>
</signals>
diff --git a/doc/classes/Animation.xml b/doc/classes/Animation.xml
index b80edb24da..6cb4fd5b17 100644
--- a/doc/classes/Animation.xml
+++ b/doc/classes/Animation.xml
@@ -17,7 +17,7 @@
</return>
<argument index="0" name="type" type="int" enum="Animation.TrackType">
</argument>
- <argument index="1" name="at_pos" type="int" default="-1">
+ <argument index="1" name="at_position" type="int" default="-1">
</argument>
<description>
Add a track to the Animation. The track type must be specified as any of the values in the TYPE_* enumeration.
@@ -281,12 +281,12 @@
Remove a key by index in a given track.
</description>
</method>
- <method name="track_remove_key_at_pos">
+ <method name="track_remove_key_at_position">
<return type="void">
</return>
<argument index="0" name="idx" type="int">
</argument>
- <argument index="1" name="pos" type="float">
+ <argument index="1" name="position" type="float">
</argument>
<description>
Remove a key by position (seconds) in a given track.
diff --git a/doc/classes/AnimationPlayer.xml b/doc/classes/AnimationPlayer.xml
index 746462380b..74a7f6c8a4 100644
--- a/doc/classes/AnimationPlayer.xml
+++ b/doc/classes/AnimationPlayer.xml
@@ -129,7 +129,7 @@
Get the length (in seconds) of the currently being played animation.
</description>
</method>
- <method name="get_current_animation_pos" qualifiers="const">
+ <method name="get_current_animation_position" qualifiers="const">
<return type="float">
</return>
<description>
@@ -143,7 +143,7 @@
Return the default blend time between animations.
</description>
</method>
- <method name="get_pos" qualifiers="const">
+ <method name="get_position" qualifiers="const">
<return type="float">
</return>
<description>
@@ -245,7 +245,7 @@
<method name="seek">
<return type="void">
</return>
- <argument index="0" name="pos_sec" type="float">
+ <argument index="0" name="seconds" type="float">
</argument>
<argument index="1" name="update" type="bool" default="false">
</argument>
diff --git a/doc/classes/AnimationTreePlayer.xml b/doc/classes/AnimationTreePlayer.xml
index ad9bc922e4..f088d21e41 100644
--- a/doc/classes/AnimationTreePlayer.xml
+++ b/doc/classes/AnimationTreePlayer.xml
@@ -271,7 +271,7 @@
Return the input source for a given node input.
</description>
</method>
- <method name="node_get_pos" qualifiers="const">
+ <method name="node_get_position" qualifiers="const">
<return type="Vector2">
</return>
<argument index="0" name="id" type="String">
@@ -300,12 +300,12 @@
Rename a node in the graph.
</description>
</method>
- <method name="node_set_pos">
+ <method name="node_set_position">
<return type="void">
</return>
<argument index="0" name="id" type="String">
</argument>
- <argument index="1" name="screen_pos" type="Vector2">
+ <argument index="1" name="screen_position" type="Vector2">
</argument>
<description>
Sets position of a node in the graph given its name and position.
@@ -531,7 +531,7 @@
</return>
<argument index="0" name="id" type="String">
</argument>
- <argument index="1" name="pos_sec" type="float">
+ <argument index="1" name="seconds" type="float">
</argument>
<description>
Sets time seek value of a TimeSeek node given its name and value.
@@ -659,5 +659,9 @@
<constant name="NODE_TRANSITION" value="9">
Transition node.
</constant>
+ <constant name="ANIMATION_PROCESS_FIXED" value="0">
+ </constant>
+ <constant name="ANIMATION_PROCESS_IDLE" value="1">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/Area.xml b/doc/classes/Area.xml
index 4e366e124e..c59bbee084 100644
--- a/doc/classes/Area.xml
+++ b/doc/classes/Area.xml
@@ -493,5 +493,15 @@
</signal>
</signals>
<constants>
+ <constant name="SPACE_OVERRIDE_DISABLED" value="0">
+ </constant>
+ <constant name="SPACE_OVERRIDE_COMBINE" value="1">
+ </constant>
+ <constant name="SPACE_OVERRIDE_COMBINE_REPLACE" value="2">
+ </constant>
+ <constant name="SPACE_OVERRIDE_REPLACE" value="3">
+ </constant>
+ <constant name="SPACE_OVERRIDE_REPLACE_COMBINE" value="4">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml
index 042dfb3e12..f833764141 100644
--- a/doc/classes/Array.xml
+++ b/doc/classes/Array.xml
@@ -168,7 +168,7 @@
</description>
</method>
<method name="insert">
- <argument index="0" name="pos" type="int">
+ <argument index="0" name="position" type="int">
</argument>
<argument index="1" name="value" type="var">
</argument>
@@ -206,14 +206,14 @@
</description>
</method>
<method name="remove">
- <argument index="0" name="pos" type="int">
+ <argument index="0" name="position" type="int">
</argument>
<description>
Remove an element from the array by index.
</description>
</method>
<method name="resize">
- <argument index="0" name="pos" type="int">
+ <argument index="0" name="position" 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.
diff --git a/doc/classes/AudioEffectDistortion.xml b/doc/classes/AudioEffectDistortion.xml
index d8b9dee9dc..e5c5a3b50e 100644
--- a/doc/classes/AudioEffectDistortion.xml
+++ b/doc/classes/AudioEffectDistortion.xml
@@ -93,5 +93,15 @@
</member>
</members>
<constants>
+ <constant name="MODE_CLIP" value="0">
+ </constant>
+ <constant name="MODE_ATAN" value="1">
+ </constant>
+ <constant name="MODE_LOFI" value="2">
+ </constant>
+ <constant name="MODE_OVERDRIVE" value="3">
+ </constant>
+ <constant name="MODE_WAVESHAPE" value="4">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/AudioEffectFilter.xml b/doc/classes/AudioEffectFilter.xml
index 6285539a61..17aa01d60a 100644
--- a/doc/classes/AudioEffectFilter.xml
+++ b/doc/classes/AudioEffectFilter.xml
@@ -77,5 +77,13 @@
</member>
</members>
<constants>
+ <constant name="FILTER_6DB" value="0">
+ </constant>
+ <constant name="FILTER_12DB" value="1">
+ </constant>
+ <constant name="FILTER_18DB" value="2">
+ </constant>
+ <constant name="FILTER_24DB" value="3">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/AudioServer.xml b/doc/classes/AudioServer.xml
index 7856537804..768987fd0b 100644
--- a/doc/classes/AudioServer.xml
+++ b/doc/classes/AudioServer.xml
@@ -14,7 +14,7 @@
<method name="add_bus">
<return type="void">
</return>
- <argument index="0" name="at_pos" type="int" default="-1">
+ <argument index="0" name="at_position" type="int" default="-1">
</argument>
<description>
</description>
@@ -26,7 +26,7 @@
</argument>
<argument index="1" name="effect" type="AudioEffect">
</argument>
- <argument index="2" name="at_pos" type="int" default="-1">
+ <argument index="2" name="at_position" type="int" default="-1">
</argument>
<description>
</description>
@@ -307,5 +307,11 @@
</signal>
</signals>
<constants>
+ <constant name="SPEAKER_MODE_STEREO" value="0">
+ </constant>
+ <constant name="SPEAKER_SURROUND_51" value="2">
+ </constant>
+ <constant name="SPEAKER_SURROUND_71" value="3">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/AudioStreamOGGVorbis.xml b/doc/classes/AudioStreamOGGVorbis.xml
index fd9018764d..679438b66b 100644
--- a/doc/classes/AudioStreamOGGVorbis.xml
+++ b/doc/classes/AudioStreamOGGVorbis.xml
@@ -56,10 +56,13 @@
</methods>
<members>
<member name="data" type="PoolByteArray" setter="set_data" getter="get_data">
+ Raw audio data.
</member>
<member name="loop" type="bool" setter="set_loop" getter="has_loop">
+ If [code]true[/code], audio will loop continuously. Default value: [code]false[/code].
</member>
<member name="loop_offset" type="float" setter="set_loop_offset" getter="get_loop_offset">
+ If loop is [code]true[/code], loop starts from this position, in seconds.
</member>
</members>
<constants>
diff --git a/doc/classes/AudioStreamPlayer.xml b/doc/classes/AudioStreamPlayer.xml
index 64823c3be5..2dba35bec0 100644
--- a/doc/classes/AudioStreamPlayer.xml
+++ b/doc/classes/AudioStreamPlayer.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AudioStreamPlayer" inherits="Node" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Plays back audio.
</brief_description>
<description>
+ Plays background audio.
</description>
<tutorials>
</tutorials>
@@ -21,7 +23,7 @@
<description>
</description>
</method>
- <method name="get_pos">
+ <method name="get_position">
<return type="float">
</return>
<description>
@@ -54,17 +56,19 @@
<method name="play">
<return type="void">
</return>
- <argument index="0" name="from_pos" type="float" default="0.0">
+ <argument index="0" name="from_position" type="float" default="0.0">
</argument>
<description>
+ Plays the audio from the given position 'from_position', in seconds.
</description>
</method>
<method name="seek">
<return type="void">
</return>
- <argument index="0" name="to_pos" type="float">
+ <argument index="0" name="to_position" type="float">
</argument>
<description>
+ Sets the position from which audio will be played, in seconds.
</description>
</method>
<method name="set_autoplay">
@@ -111,29 +115,42 @@
<return type="void">
</return>
<description>
+ Stops the audio.
</description>
</method>
</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].
</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">
</member>
<member name="playing" type="bool" setter="_set_playing" getter="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.
</member>
<member name="volume_db" type="float" setter="set_volume_db" getter="get_volume_db">
+ Volume of sound, in dB.
</member>
</members>
<signals>
<signal name="finished">
<description>
+ Emitted when the audio stops playing.
</description>
</signal>
</signals>
<constants>
+ <constant name="MIX_TARGET_STEREO" value="0">
+ </constant>
+ <constant name="MIX_TARGET_SURROUND" value="1">
+ </constant>
+ <constant name="MIX_TARGET_CENTER" value="2">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/AudioStreamPlayer2D.xml b/doc/classes/AudioStreamPlayer2D.xml
index f2464ddac4..68afffdb41 100644
--- a/doc/classes/AudioStreamPlayer2D.xml
+++ b/doc/classes/AudioStreamPlayer2D.xml
@@ -1,10 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AudioStreamPlayer2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Plays audio in 2D.
</brief_description>
<description>
+ Plays audio that dampens with distance from screen center.
</description>
<tutorials>
+ http://docs.godotengine.org/en/latest/learning/features/audio/index.html
</tutorials>
<demos>
</demos>
@@ -33,7 +36,7 @@
<description>
</description>
</method>
- <method name="get_pos">
+ <method name="get_position">
<return type="float">
</return>
<description>
@@ -66,17 +69,19 @@
<method name="play">
<return type="void">
</return>
- <argument index="0" name="from_pos" type="float" default="0.0">
+ <argument index="0" name="from_position" type="float" default="0.0">
</argument>
<description>
+ Plays the audio from the given position 'from_position', in seconds.
</description>
</method>
<method name="seek">
<return type="void">
</return>
- <argument index="0" name="to_pos" type="float">
+ <argument index="0" name="to_position" type="float">
</argument>
<description>
+ Sets the position from which audio will be played, in seconds.
</description>
</method>
<method name="set_area_mask">
@@ -139,30 +144,40 @@
<return type="void">
</return>
<description>
+ Stops the audio.
</description>
</method>
</methods>
<members>
<member name="area_mask" type="int" setter="set_area_mask" getter="get_area_mask">
+ Areas in which this sound plays.
</member>
<member name="attenuation" type="float" setter="set_attenuation" getter="get_attenuation">
+ 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].
</member>
<member name="bus" type="String" setter="set_bus" getter="get_bus">
+ Bus on which this audio is playing.
</member>
<member name="max_distance" type="float" setter="set_max_distance" getter="get_max_distance">
+ 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.
</member>
<member name="stream" type="AudioStream" setter="set_stream" getter="get_stream">
+ The [AudioStream] object to be played.
</member>
<member name="volume_db" type="float" setter="set_volume_db" getter="get_volume_db">
+ Base volume without dampening.
</member>
</members>
<signals>
<signal name="finished">
<description>
+ Emitted when the audio stops playing.
</description>
</signal>
</signals>
diff --git a/doc/classes/AudioStreamPlayer3D.xml b/doc/classes/AudioStreamPlayer3D.xml
index 668e0cc0d2..1577c1e4d3 100644
--- a/doc/classes/AudioStreamPlayer3D.xml
+++ b/doc/classes/AudioStreamPlayer3D.xml
@@ -1,10 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AudioStreamPlayer3D" inherits="Spatial" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Plays 3D sound in 3D space
</brief_description>
<description>
+ Plays a sound effect with directed sound effects, dampens with distance if needed, generates effect of hearable position in space.
</description>
<tutorials>
+ http://docs.godotengine.org/en/latest/learning/features/audio/index.html
</tutorials>
<demos>
</demos>
@@ -75,7 +78,7 @@
<description>
</description>
</method>
- <method name="get_pos">
+ <method name="get_position">
<return type="float">
</return>
<description>
@@ -120,17 +123,19 @@
<method name="play">
<return type="void">
</return>
- <argument index="0" name="from_pos" type="float" default="0.0">
+ <argument index="0" name="from_position" type="float" default="0.0">
</argument>
<description>
+ Plays the audio from the given position 'from_position', in seconds.
</description>
</method>
<method name="seek">
<return type="void">
</return>
- <argument index="0" name="to_pos" type="float">
+ <argument index="0" name="to_position" type="float">
</argument>
<description>
+ Sets the position from which audio will be played, in seconds.
</description>
</method>
<method name="set_area_mask">
@@ -265,67 +270,94 @@
<return type="void">
</return>
<description>
+ Stops the audio.
</description>
</method>
</methods>
<members>
<member name="area_mask" type="int" setter="set_area_mask" getter="get_area_mask">
+ Areas in which this sound plays.
</member>
<member name="attenuation_filter_cutoff_hz" type="float" setter="set_attenuation_filter_cutoff_hz" getter="get_attenuation_filter_cutoff_hz">
+ Dampens audio above this frequency, in Hz.
</member>
<member name="attenuation_filter_db" type="float" setter="set_attenuation_filter_db" getter="get_attenuation_filter_db">
+ Amount how much the filter affects the loudness, in dB.
</member>
<member name="attenuation_model" type="int" setter="set_attenuation_model" getter="get_attenuation_model" enum="AudioStreamPlayer3D.AttenuationModel">
+ 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].
</member>
<member name="bus" type="String" setter="set_bus" getter="get_bus">
+ Bus on which this audio is playing.
</member>
<member name="doppler_tracking" type="int" setter="set_doppler_tracking" getter="get_doppler_tracking" enum="AudioStreamPlayer3D.DopplerTracking">
+ Decides in which step the Doppler effect should be calculated.
</member>
<member name="emission_angle_degrees" type="float" setter="set_emission_angle" getter="get_emission_angle">
+ 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.
</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.
</member>
<member name="max_db" type="float" setter="set_max_db" getter="get_max_db">
+ Sets the absolute maximum of the soundlevel, in dB.
</member>
<member name="max_distance" type="float" setter="set_max_distance" getter="get_max_distance">
+ Sets the distance from wich the 'out_of_range_mode' takes effect. Has no effect if set to 0.
</member>
<member name="out_of_range_mode" type="int" setter="set_out_of_range_mode" getter="get_out_of_range_mode" enum="AudioStreamPlayer3D.OutOfRangeMode">
+ Decides if audio should pause when source is outside of 'max_distance' range.
</member>
<member name="playing" type="bool" setter="_set_playing" getter="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.
</member>
<member name="unit_db" type="float" setter="set_unit_db" getter="get_unit_db">
+ Base sound level unaffected by dampening, in dB.
</member>
<member name="unit_size" type="float" setter="set_unit_size" getter="get_unit_size">
+ Factor for the attenuation effect.
</member>
</members>
<signals>
<signal name="finished">
<description>
+ Fires when the audio stops playing.
</description>
</signal>
</signals>
<constants>
<constant name="ATTENUATION_INVERSE_DISTANCE" value="0">
+ Linear dampening of loudness according to distance.
</constant>
<constant name="ATTENUATION_INVERSE_SQUARE_DISTANCE" value="1">
+ Squared dampening of loudness according to distance.
</constant>
<constant name="ATTENUATION_LOGARITHMIC" value="2">
+ Logarithmic dampening of loudness according to distance.
</constant>
<constant name="OUT_OF_RANGE_MIX" value="0">
+ Mix this audio in, even when it's out of range.
</constant>
<constant name="OUT_OF_RANGE_PAUSE" value="1">
+ Pause this audio when it gets out of range.
</constant>
<constant name="DOPPLER_TRACKING_DISABLED" value="0">
+ Disables doppler tracking.
</constant>
<constant name="DOPPLER_TRACKING_IDLE_STEP" value="1">
+ Executes doppler trackin in idle step.
</constant>
<constant name="DOPPLER_TRACKING_FIXED_STEP" value="2">
+ Executes doppler tracking in fixed step.
</constant>
</constants>
</class>
diff --git a/doc/classes/AudioStreamRandomPitch.xml b/doc/classes/AudioStreamRandomPitch.xml
index 91856682e6..1573a78d1f 100644
--- a/doc/classes/AudioStreamRandomPitch.xml
+++ b/doc/classes/AudioStreamRandomPitch.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AudioStreamRandomPitch" inherits="AudioStream" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Plays audio with random pitch tweaking.
</brief_description>
<description>
+ Randomly varies pitch on each start.
</description>
<tutorials>
</tutorials>
@@ -40,8 +42,10 @@
</methods>
<members>
<member name="audio_stream" type="AudioStream" setter="set_audio_stream" getter="get_audio_stream">
+ The current [AudioStream].
</member>
<member name="random_pitch" type="float" setter="set_random_pitch" getter="get_random_pitch">
+ The intensity of random pitch variation.
</member>
</members>
<constants>
diff --git a/doc/classes/AudioStreamSample.xml b/doc/classes/AudioStreamSample.xml
index e14a17a05c..7f7414e4d3 100644
--- a/doc/classes/AudioStreamSample.xml
+++ b/doc/classes/AudioStreamSample.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AudioStreamSample" inherits="AudioStream" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Plays audio.
</brief_description>
<description>
+ Plays audio, can loop.
</description>
<tutorials>
</tutorials>
@@ -110,20 +112,45 @@
</methods>
<members>
<member name="data" type="PoolByteArray" setter="set_data" getter="get_data">
+ Raw audio data.
</member>
<member name="format" type="int" setter="set_format" getter="get_format" enum="AudioStreamSample.Format">
+ Audio format. See FORMAT_* constants for values.
</member>
<member name="loop_begin" type="int" setter="set_loop_begin" getter="get_loop_begin">
+ Loop start in bytes.
</member>
<member name="loop_end" type="int" setter="set_loop_end" getter="get_loop_end">
+ Loop end in bytes.
</member>
<member name="loop_mode" type="int" setter="set_loop_mode" getter="get_loop_mode" enum="AudioStreamSample.LoopMode">
+ Loop mode. See LOOP_* constants for values.
</member>
<member name="mix_rate" type="int" setter="set_mix_rate" getter="get_mix_rate">
+ The sample rate for mixing this audio.
</member>
<member name="stereo" type="bool" setter="set_stereo" getter="is_stereo">
+ If [code]true[/code], audio is stereo. Default value: [code]false[/code].
</member>
</members>
<constants>
+ <constant name="FORMAT_8_BITS" value="0">
+ Audio codec 8 bit.
+ </constant>
+ <constant name="FORMAT_16_BITS" value="1">
+ Audio codec 16 bit.
+ </constant>
+ <constant name="FORMAT_IMA_ADPCM" value="2">
+ Audio codec IMA ADPCM.
+ </constant>
+ <constant name="LOOP_DISABLED" value="0">
+ Audio does not loop.
+ </constant>
+ <constant name="LOOP_FORWARD" value="1">
+ Audio loops the data between loop_begin and loop_end playing forward only.
+ </constant>
+ <constant name="LOOP_PING_PONG" value="2">
+ Audio loops the data between loop_begin and loop_end playing back and forth.
+ </constant>
</constants>
</class>
diff --git a/doc/classes/BitMap.xml b/doc/classes/BitMap.xml
index 62b1c9ff4f..d872d0892d 100644
--- a/doc/classes/BitMap.xml
+++ b/doc/classes/BitMap.xml
@@ -32,7 +32,7 @@
<method name="get_bit" qualifiers="const">
<return type="bool">
</return>
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<description>
Returns bitmap's value at the specified position.
@@ -55,7 +55,7 @@
<method name="set_bit">
<return type="void">
</return>
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<argument index="1" name="bit" type="bool">
</argument>
diff --git a/doc/classes/BoxContainer.xml b/doc/classes/BoxContainer.xml
index f7e50f02d8..0c70d919f3 100644
--- a/doc/classes/BoxContainer.xml
+++ b/doc/classes/BoxContainer.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="BoxContainer" inherits="Container" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Base class for Box containers.
+ Base class for box containers.
</brief_description>
<description>
- Base class for Box containers. It arranges children controls vertically or horizontally, and rearranges them automatically when their minimum size changes.
+ Arranges child controls vertically or horizontally, and rearranges the controls automatically when their minimum size changes.
</description>
<tutorials>
</tutorials>
@@ -17,8 +17,7 @@
<argument index="0" name="begin" type="bool">
</argument>
<description>
- Add a control to the box as a spacer.
- If [i]begin[/i] is true the spacer control will be inserted in front of other children.
+ Adds a control to the box as a spacer. If [code]true[/code], [i]begin[/i] will insert the spacer control in front of other children.
</description>
</method>
<method name="get_alignment" qualifiers="const">
@@ -40,17 +39,18 @@
</methods>
<members>
<member name="alignment" type="int" setter="set_alignment" getter="get_alignment" enum="BoxContainer.AlignMode">
+ The alignment of the container's children (must be one of ALIGN_BEGIN, ALIGN_CENTER, or ALIGN_END).
</member>
</members>
<constants>
<constant name="ALIGN_BEGIN" value="0">
- Align children with beginning of the container.
+ Aligns children with the beginning of the container.
</constant>
<constant name="ALIGN_CENTER" value="1">
- Align children with center of the container.
+ Aligns children with the center of the container.
</constant>
<constant name="ALIGN_END" value="2">
- Align children with end of the container.
+ Aligns children with the end of the container.
</constant>
</constants>
</class>
diff --git a/doc/classes/BoxShape.xml b/doc/classes/BoxShape.xml
index 8c98c93b57..4e8eb0ba6f 100644
--- a/doc/classes/BoxShape.xml
+++ b/doc/classes/BoxShape.xml
@@ -4,7 +4,7 @@
Box shape resource.
</brief_description>
<description>
- Box shape resource, which can be set into a [PhysicsBody] or area.
+ 3D box shape that can be a child of a [PhysicsBody] or [Area].
</description>
<tutorials>
</tutorials>
@@ -30,6 +30,7 @@
</methods>
<members>
<member name="extents" type="Vector3" setter="set_extents" getter="get_extents">
+ The shape's half extents.
</member>
</members>
<constants>
diff --git a/doc/classes/Camera2D.xml b/doc/classes/Camera2D.xml
index 659efa860d..b6b699612e 100644
--- a/doc/classes/Camera2D.xml
+++ b/doc/classes/Camera2D.xml
@@ -38,7 +38,7 @@
<description>
</description>
</method>
- <method name="get_camera_pos" qualifiers="const">
+ <method name="get_camera_position" qualifiers="const">
<return type="Vector2">
</return>
<description>
diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml
index 26a9e1519b..8fc2ff2bc2 100644
--- a/doc/classes/CanvasItem.xml
+++ b/doc/classes/CanvasItem.xml
@@ -27,7 +27,7 @@
</return>
<argument index="0" name="font" type="Font">
</argument>
- <argument index="1" name="pos" type="Vector2">
+ <argument index="1" name="position" type="Vector2">
</argument>
<argument index="2" name="char" type="String">
</argument>
@@ -42,7 +42,7 @@
<method name="draw_circle">
<return type="void">
</return>
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<argument index="1" name="radius" type="float">
</argument>
@@ -170,7 +170,7 @@
<method name="draw_set_transform">
<return type="void">
</return>
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<argument index="1" name="rot" type="float">
</argument>
@@ -193,7 +193,7 @@
</return>
<argument index="0" name="font" type="Font">
</argument>
- <argument index="1" name="pos" type="Vector2">
+ <argument index="1" name="position" type="Vector2">
</argument>
<argument index="2" name="text" type="String">
</argument>
@@ -221,7 +221,7 @@
</return>
<argument index="0" name="texture" type="Texture">
</argument>
- <argument index="1" name="pos" type="Vector2">
+ <argument index="1" name="position" type="Vector2">
</argument>
<argument index="2" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )">
</argument>
@@ -367,7 +367,7 @@
Get this item's light mask number.
</description>
</method>
- <method name="get_local_mouse_pos" qualifiers="const">
+ <method name="get_local_mouse_position" qualifiers="const">
<return type="Vector2">
</return>
<description>
@@ -476,7 +476,7 @@
<description>
</description>
</method>
- <method name="make_canvas_pos_local" qualifiers="const">
+ <method name="make_canvas_position_local" qualifiers="const">
<return type="Vector2">
</return>
<argument index="0" name="screen_point" type="Vector2">
diff --git a/doc/classes/CanvasLayer.xml b/doc/classes/CanvasLayer.xml
index f19e7ef041..3ee1f10536 100644
--- a/doc/classes/CanvasLayer.xml
+++ b/doc/classes/CanvasLayer.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="CanvasLayer" inherits="Node" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Canvas Item layer.
+ Canvas drawing layer.
</brief_description>
<description>
- Canvas Item layer. [CanvasItem] nodes that are direct or indirect children of a [CanvasLayer] will be drawn in that layer. The layer is a numeric index that defines the draw order. The default 2D scene renders with index 0, so a [CanvasLayer] with index -1 will be drawn below, and one with index 1 will be drawn above. This is very useful for HUDs (in layer 1+ or above), or backgrounds (in layer -1 or below).
+ Canvas drawing layer. [CanvasItem] nodes that are direct or indirect children of a [CanvasLayer] will be drawn in that layer. The layer is a numeric index that defines the draw order. The default 2D scene renders with index 0, so a [CanvasLayer] with index -1 will be drawn below, and one with index 1 will be drawn above. This is very useful for HUDs (in layer 1+ or above), or backgrounds (in layer -1 or below).
</description>
<tutorials>
</tutorials>
@@ -131,12 +131,16 @@
</methods>
<members>
<member name="layer" type="int" setter="set_layer" getter="get_layer">
+ Layer index for draw order. Lower values are drawn first. Default value: [code]1[/code].
</member>
<member name="offset" type="Vector2" setter="set_offset" getter="get_offset">
+ The layer's base offset.
</member>
<member name="rotation" type="float" setter="set_rotationd" getter="get_rotationd">
+ The layer's rotation in degrees.
</member>
<member name="scale" type="Vector2" setter="set_scale" getter="get_scale">
+ The layer's scale.
</member>
</members>
<constants>
diff --git a/doc/classes/CapsuleShape.xml b/doc/classes/CapsuleShape.xml
index 29072203ea..db075a504c 100644
--- a/doc/classes/CapsuleShape.xml
+++ b/doc/classes/CapsuleShape.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="CapsuleShape" inherits="Shape" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Capsule shape resource.
+ Capsule shape for collisions.
</brief_description>
<description>
- Capsule shape resource, which can be set into a [PhysicsBody] or area.
+ Capsule shape for collisions.
</description>
<tutorials>
</tutorials>
@@ -46,8 +46,10 @@
</methods>
<members>
<member name="height" type="float" setter="set_height" getter="get_height">
+ The capsule's height.
</member>
<member name="radius" type="float" setter="set_radius" getter="get_radius">
+ The capsule's radius.
</member>
</members>
<constants>
diff --git a/doc/classes/CapsuleShape2D.xml b/doc/classes/CapsuleShape2D.xml
index 9c2b1c4a3d..df833e0582 100644
--- a/doc/classes/CapsuleShape2D.xml
+++ b/doc/classes/CapsuleShape2D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="CapsuleShape2D" inherits="Shape2D" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Capsule 2D shape resource for physics.
+ Capsule shape for 2D collisions.
</brief_description>
<description>
- Capsule 2D shape resource for physics. A capsule (or sometimes called "pill") is like a line grown in all directions. It has a radius and a height, and is often useful for modeling biped characters.
+ Capsule shape for 2D collisions.
</description>
<tutorials>
</tutorials>
@@ -46,8 +46,10 @@
</methods>
<members>
<member name="height" type="float" setter="set_height" getter="get_height">
+ The capsule's height.
</member>
<member name="radius" type="float" setter="set_radius" getter="get_radius">
+ The capsules's radius.
</member>
</members>
<constants>
diff --git a/doc/classes/CircleShape2D.xml b/doc/classes/CircleShape2D.xml
index c3d4bdae03..1ed54f0705 100644
--- a/doc/classes/CircleShape2D.xml
+++ b/doc/classes/CircleShape2D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="CircleShape2D" inherits="Shape2D" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Circular Shape for 2D Physics.
+ Circular shape for 2D collisions.
</brief_description>
<description>
- Circular Shape for 2D Physics. This shape is useful for modeling balls or small characters and its collision detection with everything else is very fast.
+ Circular shape for 2D collisions. This shape is useful for modeling balls or small characters and its collision detection with everything else is very fast.
</description>
<tutorials>
</tutorials>
@@ -30,6 +30,7 @@
</methods>
<members>
<member name="radius" type="float" setter="set_radius" getter="get_radius">
+ The circle's radius.
</member>
</members>
<constants>
diff --git a/doc/classes/CollisionObject.xml b/doc/classes/CollisionObject.xml
index 791978993c..98023a5898 100644
--- a/doc/classes/CollisionObject.xml
+++ b/doc/classes/CollisionObject.xml
@@ -16,7 +16,7 @@
</argument>
<argument index="1" name="event" type="InputEvent">
</argument>
- <argument index="2" name="click_pos" type="Vector3">
+ <argument index="2" name="click_position" type="Vector3">
</argument>
<argument index="3" name="click_normal" type="Vector3">
</argument>
@@ -209,7 +209,7 @@
</argument>
<argument index="1" name="event" type="Object">
</argument>
- <argument index="2" name="click_pos" type="Vector3">
+ <argument index="2" name="click_position" type="Vector3">
</argument>
<argument index="3" name="click_normal" type="Vector3">
</argument>
diff --git a/doc/classes/CollisionPolygon.xml b/doc/classes/CollisionPolygon.xml
index cf425e3d60..c2496424d6 100644
--- a/doc/classes/CollisionPolygon.xml
+++ b/doc/classes/CollisionPolygon.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="CollisionPolygon" inherits="Spatial" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Editor-only class for defining a collision polygon in 3D space.
</brief_description>
<description>
+ Allows editing a collision polygon's vertices on a selected plane. Can also set a depth perpendicular to that plane. This class is only available in the editor. It will not appear in the scene tree at runtime. Creates a [Shape] for gameplay. Properties modified during gameplay will have no effect.
</description>
<tutorials>
</tutorials>
@@ -54,10 +56,13 @@
</methods>
<members>
<member name="depth" type="float" setter="set_depth" getter="get_depth">
+ Length that the resulting collision extends in either direction perpendicular to its polygon.
</member>
<member name="disabled" type="bool" setter="set_disabled" getter="is_disabled">
+ If true, no collision will be produced.
</member>
<member name="polygon" type="PoolVector2Array" setter="set_polygon" getter="get_polygon">
+ Array of vertices which define the polygon.
</member>
</members>
<constants>
diff --git a/doc/classes/CollisionPolygon2D.xml b/doc/classes/CollisionPolygon2D.xml
index ef0f1ce451..d3dee1e9bb 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 easy editing of collision polygons.
+ Editor-only class for defining a collision polygon in 2D space.
</brief_description>
<description>
- Editor-only class. This is not present when running the game. It's used in the editor to properly edit and position collision shapes in [CollisionObject2D]. This is not accessible from regular code. This class is for editing custom shape polygons.
+ 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.
</description>
<tutorials>
</tutorials>
@@ -75,14 +75,22 @@
</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.
</member>
<member name="disabled" type="bool" setter="set_disabled" getter="is_disabled">
+ If true, no collision will be produced.
</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.
</member>
<member name="polygon" type="PoolVector2Array" setter="set_polygon" getter="get_polygon">
+ Array of vertices which define the polygon.
</member>
</members>
<constants>
+ <constant name="BUILD_SOLIDS" value="0">
+ </constant>
+ <constant name="BUILD_SEGMENTS" value="1">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml
index 5d77f3a450..59c3bd30c7 100644
--- a/doc/classes/Control.xml
+++ b/doc/classes/Control.xml
@@ -106,7 +106,7 @@
<method name="can_drop_data" qualifiers="virtual">
<return type="bool">
</return>
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<argument index="1" name="data" type="Variant">
</argument>
@@ -116,7 +116,7 @@
<method name="drop_data" qualifiers="virtual">
<return type="void">
</return>
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<argument index="1" name="data" type="Variant">
</argument>
@@ -177,7 +177,7 @@
<method name="get_cursor_shape" qualifiers="const">
<return type="int" enum="Control.CursorShape">
</return>
- <argument index="0" name="pos" type="Vector2" default="Vector2( 0, 0 )">
+ <argument index="0" name="position" type="Vector2" default="Vector2( 0, 0 )">
</argument>
<description>
Return the cursor shape at a certain position in the control.
@@ -199,7 +199,7 @@
<method name="get_drag_data" qualifiers="virtual">
<return type="Object">
</return>
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<description>
</description>
@@ -390,7 +390,7 @@
<method name="get_tooltip" qualifiers="const">
<return type="String">
</return>
- <argument index="0" name="atpos" type="Vector2" default="Vector2( 0, 0 )">
+ <argument index="0" name="at_position" type="Vector2" default="Vector2( 0, 0 )">
</argument>
<description>
Return the tooltip, which will appear when the cursor is resting over this control.
@@ -596,7 +596,7 @@
<method name="set_begin">
<return type="void">
</return>
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<description>
Sets MARGIN_LEFT and MARGIN_TOP at the same time. This is a helper (see [method set_margin]).
@@ -646,7 +646,7 @@
<method name="set_end">
<return type="void">
</return>
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<description>
Sets MARGIN_RIGHT and MARGIN_BOTTOM at the same time. This is a helper (see [method set_margin]).
@@ -675,7 +675,7 @@
<method name="set_global_position">
<return type="void">
</return>
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<description>
Move the Control to a new position, relative to the top-left corner of the [i]window[/i] Control, and without changing current anchor mode. (see [method set_margin]).
@@ -729,7 +729,7 @@
<method name="set_position">
<return type="void">
</return>
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<description>
Move the Control to a new position, relative to the top-left corner of the parent Control, changing all margins if needed and without changing current anchor mode. This is a helper (see [method set_margin]).
@@ -826,7 +826,7 @@
<method name="warp_mouse">
<return type="void">
</return>
- <argument index="0" name="to_pos" type="Vector2">
+ <argument index="0" name="to_position" type="Vector2">
</argument>
<description>
</description>
diff --git a/doc/classes/Curve.xml b/doc/classes/Curve.xml
index bf9f7598e0..ef43d9024c 100644
--- a/doc/classes/Curve.xml
+++ b/doc/classes/Curve.xml
@@ -12,7 +12,7 @@
<method name="add_point">
<return type="int">
</return>
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<argument index="1" name="left_tangent" type="float" default="0">
</argument>
@@ -77,7 +77,7 @@
<description>
</description>
</method>
- <method name="get_point_pos" qualifiers="const">
+ <method name="get_point_position" qualifiers="const">
<return type="Vector2">
</return>
<argument index="0" name="index" type="int">
@@ -227,5 +227,11 @@
</signal>
</signals>
<constants>
+ <constant name="TANGENT_FREE" value="0">
+ </constant>
+ <constant name="TANGENT_LINEAR" value="1">
+ </constant>
+ <constant name="TANGENT_MODE_COUNT" value="2">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/Curve2D.xml b/doc/classes/Curve2D.xml
index ccf6101829..4362887be3 100644
--- a/doc/classes/Curve2D.xml
+++ b/doc/classes/Curve2D.xml
@@ -15,17 +15,17 @@
<method name="add_point">
<return type="void">
</return>
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<argument index="1" name="in" type="Vector2" default="Vector2( 0, 0 )">
</argument>
<argument index="2" name="out" type="Vector2" default="Vector2( 0, 0 )">
</argument>
- <argument index="3" name="atpos" type="int" default="-1">
+ <argument index="3" name="at_position" type="int" default="-1">
</argument>
<description>
- Adds a point to a curve, at position "pos", with control points "in" and "out".
- If "atpos" is given, the point is inserted before the point number "atpos", moving that point (and every point after) after the inserted point. If "atpos" is not given, or is an illegal value (atpos &lt;0 or atpos &gt;= [method get_point_count]), the point will be appended at the end of the point list.
+ Adds a point to a curve, at "position", with control points "in" and "out".
+ If "at_position" is given, the point is inserted before the point number "at_position", moving that point (and every point after) after the inserted point. If "at_position" is not given, or is an illegal value (at_position &lt;0 or at_position &gt;= [method get_point_count]), the point will be appended at the end of the point list.
</description>
</method>
<method name="clear_points">
@@ -80,7 +80,7 @@
Returns the position of the control point leading out of the vertex "idx". If the index is out of bounds, the function sends an error to the console, and returns (0, 0).
</description>
</method>
- <method name="get_point_pos" qualifiers="const">
+ <method name="get_point_position" qualifiers="const">
<return type="Vector2">
</return>
<argument index="0" name="idx" type="int">
@@ -146,7 +146,7 @@
</return>
<argument index="0" name="idx" type="int">
</argument>
- <argument index="1" name="pos" type="Vector2">
+ <argument index="1" name="position" type="Vector2">
</argument>
<description>
Sets the position of the control point leading to the vertex "idx". If the index is out of bounds, the function sends an error to the console.
@@ -157,18 +157,18 @@
</return>
<argument index="0" name="idx" type="int">
</argument>
- <argument index="1" name="pos" type="Vector2">
+ <argument index="1" name="position" type="Vector2">
</argument>
<description>
Sets the position of the control point leading out of the vertex "idx". If the index is out of bounds, the function sends an error to the console.
</description>
</method>
- <method name="set_point_pos">
+ <method name="set_point_position">
<return type="void">
</return>
<argument index="0" name="idx" type="int">
</argument>
- <argument index="1" name="pos" type="Vector2">
+ <argument index="1" name="position" type="Vector2">
</argument>
<description>
Sets the position for the vertex "idx". If the index is out of bounds, the function sends an error to the console.
diff --git a/doc/classes/Curve3D.xml b/doc/classes/Curve3D.xml
index 8ea0e04b14..02299753cf 100644
--- a/doc/classes/Curve3D.xml
+++ b/doc/classes/Curve3D.xml
@@ -15,17 +15,17 @@
<method name="add_point">
<return type="void">
</return>
- <argument index="0" name="pos" type="Vector3">
+ <argument index="0" name="position" type="Vector3">
</argument>
<argument index="1" name="in" type="Vector3" default="Vector3( 0, 0, 0 )">
</argument>
<argument index="2" name="out" type="Vector3" default="Vector3( 0, 0, 0 )">
</argument>
- <argument index="3" name="atpos" type="int" default="-1">
+ <argument index="3" name="at_position" type="int" default="-1">
</argument>
<description>
- Adds a point to a curve, at position "pos", with control points "in" and "out".
- If "atpos" is given, the point is inserted before the point number "atpos", moving that point (and every point after) after the inserted point. If "atpos" is not given, or is an illegal value (atpos &lt;0 or atpos &gt;= [method get_point_count]), the point will be appended at the end of the point list.
+ Adds a point to a curve, at "position", with control points "in" and "out".
+ If "at_position" is given, the point is inserted before the point number "at_position", moving that point (and every point after) after the inserted point. If "at_position" is not given, or is an illegal value (at_position &lt;0 or at_position &gt;= [method get_point_count]), the point will be appended at the end of the point list.
</description>
</method>
<method name="clear_points">
@@ -87,7 +87,7 @@
Returns the position of the control point leading out of the vertex "idx". If the index is out of bounds, the function sends an error to the console, and returns (0, 0, 0).
</description>
</method>
- <method name="get_point_pos" qualifiers="const">
+ <method name="get_point_position" qualifiers="const">
<return type="Vector3">
</return>
<argument index="0" name="idx" type="int">
@@ -162,7 +162,7 @@
</return>
<argument index="0" name="idx" type="int">
</argument>
- <argument index="1" name="pos" type="Vector3">
+ <argument index="1" name="position" type="Vector3">
</argument>
<description>
Sets the position of the control point leading to the vertex "idx". If the index is out of bounds, the function sends an error to the console.
@@ -173,18 +173,18 @@
</return>
<argument index="0" name="idx" type="int">
</argument>
- <argument index="1" name="pos" type="Vector3">
+ <argument index="1" name="position" type="Vector3">
</argument>
<description>
Sets the position of the control point leading out of the vertex "idx". If the index is out of bounds, the function sends an error to the console.
</description>
</method>
- <method name="set_point_pos">
+ <method name="set_point_position">
<return type="void">
</return>
<argument index="0" name="idx" type="int">
</argument>
- <argument index="1" name="pos" type="Vector3">
+ <argument index="1" name="position" type="Vector3">
</argument>
<description>
Sets the position for the vertex "idx". If the index is out of bounds, the function sends an error to the console.
diff --git a/doc/classes/EditorExportPlugin.xml b/doc/classes/EditorExportPlugin.xml
new file mode 100644
index 0000000000..b0ed24b767
--- /dev/null
+++ b/doc/classes/EditorExportPlugin.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="EditorExportPlugin" inherits="Reference" category="Core" version="3.0.alpha.custom_build">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="_export_begin" qualifiers="virtual">
+ <return type="void">
+ </return>
+ <argument index="0" name="features" type="PoolStringArray">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="_export_file" qualifiers="virtual">
+ <return type="void">
+ </return>
+ <argument index="0" name="path" type="String">
+ </argument>
+ <argument index="1" name="type" type="String">
+ </argument>
+ <argument index="2" name="features" type="PoolStringArray">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="add_file">
+ <return type="void">
+ </return>
+ <argument index="0" name="path" type="String">
+ </argument>
+ <argument index="1" name="file" type="PoolByteArray">
+ </argument>
+ <argument index="2" name="remap" type="bool">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="add_shared_object">
+ <return type="void">
+ </return>
+ <argument index="0" name="path" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="skip">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/doc/classes/EditorFileDialog.xml b/doc/classes/EditorFileDialog.xml
index 1e0f27ef7f..6ae893f189 100644
--- a/doc/classes/EditorFileDialog.xml
+++ b/doc/classes/EditorFileDialog.xml
@@ -185,5 +185,9 @@
</constant>
<constant name="ACCESS_FILESYSTEM" value="2">
</constant>
+ <constant name="DISPLAY_THUMBNAILS" value="0">
+ </constant>
+ <constant name="DISPLAY_LIST" value="1">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml
index f620c33f7a..2831555d41 100644
--- a/doc/classes/EditorPlugin.xml
+++ b/doc/classes/EditorPlugin.xml
@@ -66,6 +66,14 @@
During run-time, this will be a simple object with a script so this function does not need to be called then.
</description>
</method>
+ <method name="add_export_plugin">
+ <return type="void">
+ </return>
+ <argument index="0" name="exporter" type="EditorExportPlugin">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="add_import_plugin">
<return type="void">
</return>
@@ -266,6 +274,14 @@
Remove a custom type added by [method EditorPlugin.add_custom_type]
</description>
</method>
+ <method name="remove_export_plugin">
+ <return type="void">
+ </return>
+ <argument index="0" name="exporter" type="EditorExportPlugin">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="remove_import_plugin">
<return type="void">
</return>
diff --git a/doc/classes/File.xml b/doc/classes/File.xml
index 4e73cd8ae2..e1a024270e 100644
--- a/doc/classes/File.xml
+++ b/doc/classes/File.xml
@@ -168,7 +168,7 @@
Get a [String] saved in Pascal format from the file.
</description>
</method>
- <method name="get_pos" qualifiers="const">
+ <method name="get_position" qualifiers="const">
<return type="int">
</return>
<description>
@@ -258,7 +258,7 @@
<method name="seek">
<return type="void">
</return>
- <argument index="0" name="pos" type="int">
+ <argument index="0" name="position" type="int">
</argument>
<description>
Change the file reading/writing cursor to the specified position (in bytes from the beginning of the file).
@@ -267,7 +267,7 @@
<method name="seek_end">
<return type="void">
</return>
- <argument index="0" name="pos" type="int" default="0">
+ <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.
diff --git a/doc/classes/Font.xml b/doc/classes/Font.xml
index 420756975f..2e2124cbd6 100644
--- a/doc/classes/Font.xml
+++ b/doc/classes/Font.xml
@@ -16,7 +16,7 @@
</return>
<argument index="0" name="canvas_item" type="RID">
</argument>
- <argument index="1" name="pos" type="Vector2">
+ <argument index="1" name="position" type="Vector2">
</argument>
<argument index="2" name="string" type="String">
</argument>
@@ -25,7 +25,7 @@
<argument index="4" name="clip_w" type="int" default="-1">
</argument>
<description>
- Draw "string" into a canvas item using the font at a given "pos" position, with "modulate" color, and optionally clipping the width. "pos" specifies the baseline, not the top. To draw from the top, [i]ascent[/i] must be added to the Y axis.
+ Draw "string" into a canvas item using the font at a given position, with "modulate" color, and optionally clipping the width. "position" specifies the baseline, not the top. To draw from the top, [i]ascent[/i] must be added to the Y axis.
</description>
</method>
<method name="draw_char" qualifiers="const">
@@ -33,7 +33,7 @@
</return>
<argument index="0" name="canvas_item" type="RID">
</argument>
- <argument index="1" name="pos" type="Vector2">
+ <argument index="1" name="position" type="Vector2">
</argument>
<argument index="2" name="char" type="int">
</argument>
@@ -42,7 +42,7 @@
<argument index="4" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )">
</argument>
<description>
- Draw character "char" into a canvas item using the font at a given "pos" position, with "modulate" color, and optionally kerning if "next" is passed. clipping the width. "pos" specifies the baseline, not the top. To draw from the top, [i]ascent[/i] must be added to the Y axis. The width used by the character is returned, making this function useful for drawing strings character by character.
+ Draw character "char" into a canvas item using the font at a given position, with "modulate" color, and optionally kerning if "next" is passed. clipping the width. "position" specifies the baseline, not the top. To draw from the top, [i]ascent[/i] must be added to the Y axis. The width used by the character is returned, making this function useful for drawing strings character by character.
</description>
</method>
<method name="get_ascent" qualifiers="const">
diff --git a/doc/classes/Geometry.xml b/doc/classes/Geometry.xml
index 6c301cb928..49f32bc68f 100644
--- a/doc/classes/Geometry.xml
+++ b/doc/classes/Geometry.xml
@@ -176,7 +176,7 @@
</argument>
<argument index="1" name="segment_to" type="Vector2">
</argument>
- <argument index="2" name="circle_pos" type="Vector2">
+ <argument index="2" name="circle_position" type="Vector2">
</argument>
<argument index="3" name="circle_radius" type="float">
</argument>
@@ -230,9 +230,9 @@
</argument>
<argument index="1" name="to" type="Vector3">
</argument>
- <argument index="2" name="spos" type="Vector3">
+ <argument index="2" name="sphere_position" type="Vector3">
</argument>
- <argument index="3" name="sradius" type="float">
+ <argument index="3" name="sphere_radius" type="float">
</argument>
<description>
</description>
diff --git a/doc/classes/GeometryInstance.xml b/doc/classes/GeometryInstance.xml
index 550a1e97d7..57aec8be41 100644
--- a/doc/classes/GeometryInstance.xml
+++ b/doc/classes/GeometryInstance.xml
@@ -149,15 +149,17 @@
</member>
</members>
<constants>
- <constant name="FLAG_MAX" value="1" enum="">
+ <constant name="SHADOW_CASTING_SETTING_OFF" value="0">
</constant>
- <constant name="SHADOW_CASTING_SETTING_OFF" value="0" enum="">
+ <constant name="SHADOW_CASTING_SETTING_ON" value="1">
</constant>
- <constant name="SHADOW_CASTING_SETTING_ON" value="1" enum="">
+ <constant name="SHADOW_CASTING_SETTING_DOUBLE_SIDED" value="2">
</constant>
- <constant name="SHADOW_CASTING_SETTING_DOUBLE_SIDED" value="2" enum="">
+ <constant name="SHADOW_CASTING_SETTING_SHADOWS_ONLY" value="3">
</constant>
- <constant name="SHADOW_CASTING_SETTING_SHADOWS_ONLY" value="3" enum="">
+ <constant name="FLAG_USE_BAKED_LIGHT" value="0">
+ </constant>
+ <constant name="FLAG_MAX" value="1">
</constant>
</constants>
</class>
diff --git a/doc/classes/GraphEdit.xml b/doc/classes/GraphEdit.xml
index bd594033ee..c9771f1ada 100644
--- a/doc/classes/GraphEdit.xml
+++ b/doc/classes/GraphEdit.xml
@@ -177,7 +177,7 @@
</argument>
<argument index="1" name="from_slot" type="int">
</argument>
- <argument index="2" name="release_pos" type="Vector2">
+ <argument index="2" name="release_position" type="Vector2">
</argument>
<description>
</description>
@@ -230,7 +230,7 @@
<theme_items>
<theme_item name="bezier_len_neg" type="int">
</theme_item>
- <theme_item name="bezier_len_pos" type="int">
+ <theme_item name="bezier_len_position" type="int">
</theme_item>
<theme_item name="bg" type="StyleBox">
</theme_item>
diff --git a/doc/classes/GraphNode.xml b/doc/classes/GraphNode.xml
index de1d9c1194..e230390882 100644
--- a/doc/classes/GraphNode.xml
+++ b/doc/classes/GraphNode.xml
@@ -43,7 +43,7 @@
Return the number of enabled input slots (connections) to the GraphNode.
</description>
</method>
- <method name="get_connection_input_pos">
+ <method name="get_connection_input_position">
<return type="Vector2">
</return>
<argument index="0" name="idx" type="int">
@@ -77,7 +77,7 @@
Return the number of enabled output slots (connections) of the GraphNode.
</description>
</method>
- <method name="get_connection_output_pos">
+ <method name="get_connection_output_position">
<return type="Vector2">
</return>
<argument index="0" name="idx" type="int">
diff --git a/doc/classes/ImmediateGeometry.xml b/doc/classes/ImmediateGeometry.xml
index 7b45c0c678..b12f9c99a9 100644
--- a/doc/classes/ImmediateGeometry.xml
+++ b/doc/classes/ImmediateGeometry.xml
@@ -28,7 +28,7 @@
<method name="add_vertex">
<return type="void">
</return>
- <argument index="0" name="pos" type="Vector3">
+ <argument index="0" name="position" type="Vector3">
</argument>
<description>
Add a vertex with the currently set color/uv/etc.
diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml
index f636000242..3d8b4154f8 100644
--- a/doc/classes/Input.xml
+++ b/doc/classes/Input.xml
@@ -298,7 +298,7 @@
Stops the vibration of the joypad.
</description>
</method>
- <method name="warp_mouse_pos">
+ <method name="warp_mouse_position">
<return type="void">
</return>
<argument index="0" name="to" type="Vector2">
diff --git a/doc/classes/InputEventScreenTouch.xml b/doc/classes/InputEventScreenTouch.xml
index 97c3537364..48c5626f14 100644
--- a/doc/classes/InputEventScreenTouch.xml
+++ b/doc/classes/InputEventScreenTouch.xml
@@ -33,7 +33,7 @@
<method name="set_position">
<return type="void">
</return>
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<description>
</description>
diff --git a/doc/classes/ItemList.xml b/doc/classes/ItemList.xml
index 3423b8fb9c..a8d879888f 100644
--- a/doc/classes/ItemList.xml
+++ b/doc/classes/ItemList.xml
@@ -85,10 +85,10 @@
<description>
</description>
</method>
- <method name="get_item_at_pos" qualifiers="const">
+ <method name="get_item_at_position" qualifiers="const">
<return type="int">
</return>
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<argument index="1" name="exact" type="bool" default="false">
</argument>
@@ -490,7 +490,7 @@
<signal name="item_rmb_selected">
<argument index="0" name="index" type="int">
</argument>
- <argument index="1" name="atpos" type="Vector2">
+ <argument index="1" name="at_position" type="Vector2">
</argument>
<description>
Fired when specified list item has been selected via right mouse clicking.
diff --git a/doc/classes/JSON.xml b/doc/classes/JSON.xml
new file mode 100644
index 0000000000..a38b2f61cf
--- /dev/null
+++ b/doc/classes/JSON.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="JSON" inherits="Object" category="Core" version="3.0.alpha.custom_build">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="parse">
+ <return type="JSONParseResult">
+ </return>
+ <argument index="0" name="json" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="print">
+ <return type="String">
+ </return>
+ <argument index="0" name="value" type="Variant">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/doc/classes/JSONParseResult.xml b/doc/classes/JSONParseResult.xml
new file mode 100644
index 0000000000..6aeb614508
--- /dev/null
+++ b/doc/classes/JSONParseResult.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="JSONParseResult" inherits="Reference" category="Core" version="3.0.alpha.custom_build">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_error" qualifiers="const">
+ <return type="int" enum="Error">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_error_line" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_error_string" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_result" qualifiers="const">
+ <return type="Variant">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_error">
+ <return type="void">
+ </return>
+ <argument index="0" name="error" type="int" enum="Error">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_error_line">
+ <return type="void">
+ </return>
+ <argument index="0" name="error_line" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_error_string">
+ <return type="void">
+ </return>
+ <argument index="0" name="error_string" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_result">
+ <return type="void">
+ </return>
+ <argument index="0" name="result" type="Variant">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="error" type="int" setter="set_error" getter="get_error" enum="Error">
+ </member>
+ <member name="error_line" type="int" setter="set_error_line" getter="get_error_line">
+ </member>
+ <member name="error_string" type="String" setter="set_error_string" getter="get_error_string">
+ </member>
+ <member name="result" type="Variant" setter="set_result" getter="get_result">
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/doc/classes/KinematicBody2D.xml b/doc/classes/KinematicBody2D.xml
index 26c7c6125d..dddae2c0fc 100644
--- a/doc/classes/KinematicBody2D.xml
+++ b/doc/classes/KinematicBody2D.xml
@@ -63,6 +63,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.
</description>
</method>
<method name="move_and_slide">
@@ -97,7 +98,7 @@
<argument index="1" name="rel_vec" type="Vector2">
</argument>
<description>
- Return true if there would be a collision if the body moved from the given point in the given direction.
+ Returns true if there would be a collision if the body moved from the given point in the given direction.
</description>
</method>
</methods>
diff --git a/doc/classes/KinematicCollision.xml b/doc/classes/KinematicCollision.xml
index 5e5b125654..b7269a646e 100644
--- a/doc/classes/KinematicCollision.xml
+++ b/doc/classes/KinematicCollision.xml
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="KinematicCollision" inherits="Reference" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Collision data for KinematicBody2D collisions.
</brief_description>
<description>
+ Contains collision data for KinematicBody collisions. When a [KinematicBody] is moved using [method KinematicBody.move_and_collide], it stops if it detects a collision with another body. If a collision is detected, a KinematicCollision object is returned.
+ This object contains information about the collision, including the colliding object, the remaining motion, and the collision position. This information can be used to calculate a collision response.
</description>
<tutorials>
</tutorials>
@@ -78,26 +81,37 @@
</methods>
<members>
<member name="collider" type="Object" setter="" getter="get_collider">
+ The colliding body.
</member>
<member name="collider_id" type="int" setter="" getter="get_collider_id">
+ The colliding body's unique [RID].
</member>
<member name="collider_metadata" type="Variant" setter="" getter="get_collider_metadata">
+ The colliding body's metadata. See [Object].
</member>
<member name="collider_shape" type="Object" setter="" getter="get_collider_shape">
+ The colliding body's shape.
</member>
<member name="collider_shape_index" type="int" setter="" getter="get_collider_shape_index">
+ The colliding shape's index. See [CollisionObject].
</member>
<member name="collider_velocity" type="Vector3" setter="" getter="get_collider_velocity">
+ The colliding object's velocity.
</member>
<member name="local_shape" type="Object" setter="" getter="get_local_shape">
+ The moving object's colliding shape.
</member>
<member name="normal" type="Vector3" setter="" getter="get_normal">
+ The colliding body's shape's normal at the point of collision.
</member>
<member name="position" type="Vector3" setter="" getter="get_position">
+ The point of collision.
</member>
<member name="remainder" type="Vector3" setter="" getter="get_remainder">
+ The moving object's remaining movement vector.
</member>
<member name="travel" type="Vector3" setter="" getter="get_travel">
+ The distance the moving object traveled before collision.
</member>
</members>
<constants>
diff --git a/doc/classes/KinematicCollision2D.xml b/doc/classes/KinematicCollision2D.xml
index 4ef35066d0..7a40a39292 100644
--- a/doc/classes/KinematicCollision2D.xml
+++ b/doc/classes/KinematicCollision2D.xml
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="KinematicCollision2D" inherits="Reference" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Collision data for KinematicBody2D collisions.
</brief_description>
<description>
+ Contains collision data for KinematicBody2D collisions. When a [KinematicBody2D] is moved using [method KinematicBody2D.move_and_collide], it stops if it detects a collision with another body. If a collision is detected, a KinematicCollision2D object is returned.
+ This object contains information about the collision, including the colliding object, the remaining motion, and the collision position. This information can be used to calculate a collision response.
</description>
<tutorials>
</tutorials>
@@ -78,26 +81,37 @@
</methods>
<members>
<member name="collider" type="Object" setter="" getter="get_collider">
+ The colliding body.
</member>
<member name="collider_id" type="int" setter="" getter="get_collider_id">
+ The colliding body's unique [RID].
</member>
<member name="collider_metadata" type="Variant" setter="" getter="get_collider_metadata">
+ The colliding body's metadata. See [Object].
</member>
<member name="collider_shape" type="Object" setter="" getter="get_collider_shape">
+ The colliding body's shape.
</member>
<member name="collider_shape_index" type="int" setter="" getter="get_collider_shape_index">
+ The colliding shape's index. See [CollisionObject2D].
</member>
<member name="collider_velocity" type="Vector2" setter="" getter="get_collider_velocity">
+ The colliding object's velocity.
</member>
<member name="local_shape" type="Object" setter="" getter="get_local_shape">
+ The moving object's colliding shape.
</member>
<member name="normal" type="Vector2" setter="" getter="get_normal">
+ The colliding body's shape's normal at the point of collision.
</member>
<member name="position" type="Vector2" setter="" getter="get_position">
+ The point of collision.
</member>
<member name="remainder" type="Vector2" setter="" getter="get_remainder">
+ The moving object's remaining movement vector.
</member>
<member name="travel" type="Vector2" setter="" getter="get_travel">
+ The distance the moving object traveled before collision.
</member>
</members>
<constants>
diff --git a/doc/classes/Label.xml b/doc/classes/Label.xml
index 2e860aac0c..8c5e69b407 100644
--- a/doc/classes/Label.xml
+++ b/doc/classes/Label.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Label" inherits="Control" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Control that displays formatted text.
+ Displays plain text in a line or wrapped inside a rectangle. For formatted text, use [RichTextLabel].
</brief_description>
<description>
- Label is a control that displays formatted text, optionally autowrapping it to the [Control] area. It inherits from range to be able to scroll wrapped text vertically.
+ Label displays plain text on the screen. It gives you control over the horizontal and vertical alignment, and can wrap the text inside the node's bounding rectangle. It doesn't support bold, italics or other formatting. For that, use [RichTextLabel] instead.
</description>
<tutorials>
</tutorials>
@@ -22,14 +22,14 @@
<return type="int">
</return>
<description>
- Return the amount of lines.
+ Returns the amount of lines of text the Label has.
</description>
</method>
<method name="get_line_height" qualifiers="const">
<return type="int">
</return>
<description>
- Return the height of a line.
+ Returns the font size in pixels.
</description>
</method>
<method name="get_lines_skipped" qualifiers="const">
@@ -98,14 +98,14 @@
<return type="bool">
</return>
<description>
- Return true if text would be cut off if it is too wide.
+ Return [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 true if text is displayed in all capitals.
+ Return [code]true[/code] if text is displayed in all capitals.
</description>
</method>
<method name="set_align">
@@ -201,22 +201,31 @@
</methods>
<members>
<member name="align" type="int" setter="set_align" getter="get_align" enum="Label.Align">
+ Controls the text's horizontal align. Supports left, center, right, and fill, or justify. Set it to one of the [code]ALIGN_*[/code] constants.
</member>
<member name="autowrap" type="bool" setter="set_autowrap" getter="has_autowrap">
+ If [code]true[/code], wraps the text inside the node's bounding rectangle. If you resize the node, it will change its height automatically to show all the text. Default: false.
</member>
<member name="clip_text" type="bool" setter="set_clip_text" getter="is_clipping_text">
+ If [code]true[/code], the Label only shows the text that fits inside its bounding rectangle. It also lets you scale the node down freely.
</member>
<member name="lines_skipped" type="int" setter="set_lines_skipped" getter="get_lines_skipped">
+ The node ignores the first [code]lines_skipped[/code] lines before it starts to display text.
</member>
<member name="max_lines_visible" type="int" setter="set_max_lines_visible" getter="get_max_lines_visible">
+ Limits the lines of text the node shows on screen.
</member>
<member name="percent_visible" type="float" setter="set_percent_visible" getter="get_percent_visible">
+ Limits the count of visible characters. If you set [code]percent_visible[/code] to 50, only up to half of the text's characters will display on screen. Useful to animate the text in a dialog box.
</member>
<member name="text" type="String" setter="set_text" getter="get_text">
+ The text to display on screen.
</member>
<member name="uppercase" type="bool" setter="set_uppercase" getter="is_uppercase">
+ If [code]true[/code], all the text displays as UPPERCASE.
</member>
<member name="valign" type="int" setter="set_valign" getter="get_valign" enum="Label.VAlign">
+ Controls the text's vertical align. Supports top, center, bottom, and fill. Set it to one of the [code]VALIGN_*[/code] constants.
</member>
</members>
<constants>
diff --git a/doc/classes/Light2D.xml b/doc/classes/Light2D.xml
index 593799b57d..7ce7cef7c1 100644
--- a/doc/classes/Light2D.xml
+++ b/doc/classes/Light2D.xml
@@ -340,46 +340,67 @@
</methods>
<members>
<member name="color" type="Color" setter="set_color" getter="get_color">
+ The Light2D's [Color].
</member>
<member name="editor_only" type="bool" setter="set_editor_only" getter="is_editor_only">
+ If [code]true[/code] Light2D will only appear when editing the scene. Default value: [code]false[/code].
</member>
<member name="enabled" type="bool" setter="set_enabled" getter="is_enabled">
+ If [code]true[/code] Light2D will emit light. Default value: [code]true[/code].
</member>
<member name="energy" type="float" setter="set_energy" getter="get_energy">
+ The Light2D's energy value. The larger the value, the stronger the light.
</member>
<member name="mode" type="int" setter="set_mode" getter="get_mode" enum="Light2D.Mode">
+ The Light2D's mode. See MODE_* constants for values.
</member>
<member name="offset" type="Vector2" setter="set_texture_offset" getter="get_texture_offset">
+ The offset of the Light2D's [code]texture[/code].
</member>
<member name="range_height" type="float" setter="set_height" getter="get_height">
+ The height of the Light2D. Used with 2D normal mapping.
</member>
<member name="range_item_cull_mask" type="int" setter="set_item_cull_mask" getter="get_item_cull_mask">
+ The layer mask. Only objects with a matching mask will be affected by the Light2D.
</member>
<member name="range_layer_max" type="int" setter="set_layer_range_max" getter="get_layer_range_max">
+ Maximum layer value of objects that are affected by the Light2D. Default value: [code]0[/code].
</member>
<member name="range_layer_min" type="int" setter="set_layer_range_min" getter="get_layer_range_min">
+ Minimum layer value of objects that are affected by the Light2D. Default value: [code]0[/code].
</member>
<member name="range_z_max" type="int" setter="set_z_range_max" getter="get_z_range_max">
+ Maximum [code]Z[/code] value of objects that are affected by the Light2D. Default value: [code]1024[/code].
</member>
<member name="range_z_min" type="int" setter="set_z_range_min" getter="get_z_range_min">
+ Minimum [code]z[/code] value of objects that are affected by the Light2D. Default value: [code]-1024[/code].
</member>
<member name="shadow_buffer_size" type="int" setter="set_shadow_buffer_size" getter="get_shadow_buffer_size">
+ Shadow buffer size. Default value: [code]2048[/code].
</member>
<member name="shadow_color" type="Color" setter="set_shadow_color" getter="get_shadow_color">
+ [Color] of shadows cast by the Light2D.
</member>
<member name="shadow_enabled" type="bool" setter="set_shadow_enabled" getter="is_shadow_enabled">
+ 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].
</member>
<member name="shadow_filter_smooth" type="float" setter="set_shadow_smooth" getter="get_shadow_smooth">
+ Smoothing value for shadows.
</member>
<member name="shadow_gradient_length" type="float" setter="set_shadow_gradient_length" getter="get_shadow_gradient_length">
+ Smooth shadow gradient length.
</member>
<member name="shadow_item_cull_mask" type="int" setter="set_item_shadow_cull_mask" getter="get_item_shadow_cull_mask">
+ The shadow mask. Used with [LightOccluder2D] to cast shadows. Only occluders with a matching shadow mask will cast shadows.
</member>
<member name="texture" type="Texture" setter="set_texture" getter="get_texture">
+ [Texture] used for the Light2D's appearance.
</member>
<member name="texture_scale" type="float" setter="set_texture_scale" getter="get_texture_scale">
+ The [code]texture[/code]'s scale factor.
</member>
</members>
<constants>
@@ -395,5 +416,17 @@
<constant name="MODE_MASK" value="3">
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">
+ </constant>
+ <constant name="SHADOW_FILTER_PCF3" value="1">
+ </constant>
+ <constant name="SHADOW_FILTER_PCF5" value="2">
+ </constant>
+ <constant name="SHADOW_FILTER_PCF7" value="3">
+ </constant>
+ <constant name="SHADOW_FILTER_PCF9" value="4">
+ </constant>
+ <constant name="SHADOW_FILTER_PCF13" value="5">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/Line2D.xml b/doc/classes/Line2D.xml
index e954173047..e6e615ccf1 100644
--- a/doc/classes/Line2D.xml
+++ b/doc/classes/Line2D.xml
@@ -14,14 +14,14 @@
<method name="add_point">
<return type="void">
</return>
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<description>
Add a point at the x/y position in the supplied [Vector2]
</description>
</method>
<method name="get_begin_cap_mode" qualifiers="const">
- <return type="int" enum="LineCapMode">
+ <return type="int" enum="Line2D.LineCapMode">
</return>
<description>
</description>
@@ -33,7 +33,7 @@
</description>
</method>
<method name="get_end_cap_mode" qualifiers="const">
- <return type="int" enum="LineCapMode">
+ <return type="int" enum="Line2D.LineCapMode">
</return>
<description>
</description>
@@ -45,7 +45,7 @@
</description>
</method>
<method name="get_joint_mode" qualifiers="const">
- <return type="int" enum="LineJointMode">
+ <return type="int" enum="Line2D.LineJointMode">
</return>
<description>
</description>
@@ -56,7 +56,7 @@
<description>
</description>
</method>
- <method name="get_point_pos" qualifiers="const">
+ <method name="get_point_position" qualifiers="const">
<return type="Vector2">
</return>
<argument index="0" name="i" type="int">
@@ -89,7 +89,7 @@
</description>
</method>
<method name="get_texture_mode" qualifiers="const">
- <return type="int" enum="LineTextureMode">
+ <return type="int" enum="Line2D.LineTextureMode">
</return>
<description>
</description>
@@ -112,7 +112,7 @@
<method name="set_begin_cap_mode">
<return type="void">
</return>
- <argument index="0" name="mode" type="int" enum="LineCapMode">
+ <argument index="0" name="mode" type="int" enum="Line2D.LineCapMode">
</argument>
<description>
</description>
@@ -128,7 +128,7 @@
<method name="set_end_cap_mode">
<return type="void">
</return>
- <argument index="0" name="mode" type="int" enum="LineCapMode">
+ <argument index="0" name="mode" type="int" enum="Line2D.LineCapMode">
</argument>
<description>
</description>
@@ -144,17 +144,17 @@
<method name="set_joint_mode">
<return type="void">
</return>
- <argument index="0" name="mode" type="int" enum="LineJointMode">
+ <argument index="0" name="mode" type="int" enum="Line2D.LineJointMode">
</argument>
<description>
</description>
</method>
- <method name="set_point_pos">
+ <method name="set_point_position">
<return type="void">
</return>
<argument index="0" name="i" type="int">
</argument>
- <argument index="1" name="pos" type="Vector2">
+ <argument index="1" name="position" type="Vector2">
</argument>
<description>
</description>
@@ -194,7 +194,7 @@
<method name="set_texture_mode">
<return type="void">
</return>
- <argument index="0" name="mode" type="int" enum="LineTextureMode">
+ <argument index="0" name="mode" type="int" enum="Line2D.LineTextureMode">
</argument>
<description>
</description>
@@ -209,15 +209,15 @@
</method>
</methods>
<members>
- <member name="begin_cap_mode" type="int" setter="set_begin_cap_mode" getter="get_begin_cap_mode" enum="LineCapMode">
+ <member name="begin_cap_mode" type="int" setter="set_begin_cap_mode" getter="get_begin_cap_mode" enum="Line2D.LineCapMode">
</member>
<member name="default_color" type="Color" setter="set_default_color" getter="get_default_color">
</member>
- <member name="end_cap_mode" type="int" setter="set_end_cap_mode" getter="get_end_cap_mode" enum="LineCapMode">
+ <member name="end_cap_mode" type="int" setter="set_end_cap_mode" getter="get_end_cap_mode" enum="Line2D.LineCapMode">
</member>
<member name="gradient" type="Gradient" setter="set_gradient" getter="get_gradient">
</member>
- <member name="joint_mode" type="int" setter="set_joint_mode" getter="get_joint_mode" enum="LineJointMode">
+ <member name="joint_mode" type="int" setter="set_joint_mode" getter="get_joint_mode" enum="Line2D.LineJointMode">
</member>
<member name="points" type="PoolVector2Array" setter="set_points" getter="get_points">
</member>
@@ -227,7 +227,7 @@
</member>
<member name="texture" type="Texture" setter="set_texture" getter="get_texture">
</member>
- <member name="texture_mode" type="int" setter="set_texture_mode" getter="get_texture_mode" enum="LineTextureMode">
+ <member name="texture_mode" type="int" setter="set_texture_mode" getter="get_texture_mode" enum="Line2D.LineTextureMode">
</member>
<member name="width" type="float" setter="set_width" getter="get_width">
</member>
diff --git a/doc/classes/LineEdit.xml b/doc/classes/LineEdit.xml
index 0577e1ba37..e6c26e3248 100644
--- a/doc/classes/LineEdit.xml
+++ b/doc/classes/LineEdit.xml
@@ -66,7 +66,7 @@
Return the align mode of the [LineEdit].
</description>
</method>
- <method name="get_cursor_pos" qualifiers="const">
+ <method name="get_cursor_position" qualifiers="const">
<return type="int">
</return>
<description>
@@ -169,10 +169,10 @@
Set text alignment of the [LineEdit].
</description>
</method>
- <method name="set_cursor_pos">
+ <method name="set_cursor_position">
<return type="void">
</return>
- <argument index="0" name="pos" type="int">
+ <argument index="0" name="position" type="int">
</argument>
<description>
Set the cursor position inside the [LineEdit], causing it to scroll if needed.
diff --git a/doc/classes/LineShape2D.xml b/doc/classes/LineShape2D.xml
index 3346c46a19..5596c48162 100644
--- a/doc/classes/LineShape2D.xml
+++ b/doc/classes/LineShape2D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="LineShape2D" inherits="Shape2D" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Line shape for 2D collision objects.
+ Line shape for 2D collisions.
</brief_description>
<description>
- Line shape for 2D collision objects. It works like a 2D plane and will not allow any body to go to the negative side. Not recommended for rigid bodies, and usually not recommended for static bodies either because it forces checks against it on every frame.
+ Line shape for 2D collisions. It works like a 2D plane and will not allow any body to go to the negative side. Not recommended for rigid bodies, and usually not recommended for static bodies either because it forces checks against it on every frame.
</description>
<tutorials>
</tutorials>
@@ -46,8 +46,10 @@
</methods>
<members>
<member name="d" type="float" setter="set_d" getter="get_d">
+ The line's distance from the origin.
</member>
<member name="normal" type="Vector2" setter="set_normal" getter="get_normal">
+ The line's normal.
</member>
</members>
<constants>
diff --git a/doc/classes/Mesh.xml b/doc/classes/Mesh.xml
index 66b52e7f48..658265d242 100644
--- a/doc/classes/Mesh.xml
+++ b/doc/classes/Mesh.xml
@@ -71,5 +71,73 @@
<constant name="PRIMITIVE_TRIANGLE_FAN" value="6">
Render array as triangle fans.
</constant>
+ <constant name="BLEND_SHAPE_MODE_NORMALIZED" value="0">
+ </constant>
+ <constant name="BLEND_SHAPE_MODE_RELATIVE" value="1">
+ </constant>
+ <constant name="ARRAY_FORMAT_VERTEX" value="1">
+ </constant>
+ <constant name="ARRAY_FORMAT_NORMAL" value="2">
+ </constant>
+ <constant name="ARRAY_FORMAT_TANGENT" value="4">
+ </constant>
+ <constant name="ARRAY_FORMAT_COLOR" value="8">
+ </constant>
+ <constant name="ARRAY_FORMAT_TEX_UV" value="16">
+ </constant>
+ <constant name="ARRAY_FORMAT_TEX_UV2" value="32">
+ </constant>
+ <constant name="ARRAY_FORMAT_BONES" value="64">
+ </constant>
+ <constant name="ARRAY_FORMAT_WEIGHTS" value="128">
+ </constant>
+ <constant name="ARRAY_FORMAT_INDEX" value="256">
+ </constant>
+ <constant name="ARRAY_COMPRESS_BASE" value="9">
+ </constant>
+ <constant name="ARRAY_COMPRESS_VERTEX" value="512">
+ </constant>
+ <constant name="ARRAY_COMPRESS_NORMAL" value="1024">
+ </constant>
+ <constant name="ARRAY_COMPRESS_TANGENT" value="2048">
+ </constant>
+ <constant name="ARRAY_COMPRESS_COLOR" value="4096">
+ </constant>
+ <constant name="ARRAY_COMPRESS_TEX_UV" value="8192">
+ </constant>
+ <constant name="ARRAY_COMPRESS_TEX_UV2" value="16384">
+ </constant>
+ <constant name="ARRAY_COMPRESS_BONES" value="32768">
+ </constant>
+ <constant name="ARRAY_COMPRESS_WEIGHTS" value="65536">
+ </constant>
+ <constant name="ARRAY_COMPRESS_INDEX" value="131072">
+ </constant>
+ <constant name="ARRAY_FLAG_USE_2D_VERTICES" value="262144">
+ </constant>
+ <constant name="ARRAY_FLAG_USE_16_BIT_BONES" value="524288">
+ </constant>
+ <constant name="ARRAY_COMPRESS_DEFAULT" value="97792">
+ </constant>
+ <constant name="ARRAY_VERTEX" value="0">
+ </constant>
+ <constant name="ARRAY_NORMAL" value="1">
+ </constant>
+ <constant name="ARRAY_TANGENT" value="2">
+ </constant>
+ <constant name="ARRAY_COLOR" value="3">
+ </constant>
+ <constant name="ARRAY_TEX_UV" value="4">
+ </constant>
+ <constant name="ARRAY_TEX_UV2" value="5">
+ </constant>
+ <constant name="ARRAY_BONES" value="6">
+ </constant>
+ <constant name="ARRAY_WEIGHTS" value="7">
+ </constant>
+ <constant name="ARRAY_INDEX" value="8">
+ </constant>
+ <constant name="ARRAY_MAX" value="9">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/NinePatchRect.xml b/doc/classes/NinePatchRect.xml
index 092e928ef9..6829b36e14 100644
--- a/doc/classes/NinePatchRect.xml
+++ b/doc/classes/NinePatchRect.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="NinePatchRect" inherits="Control" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Scalable texture-based frame that tiles the texture's centers and sides, but keeps the corners' original size. Perfect for panels and dialog boxes.
</brief_description>
<description>
+ Better known as 9-slice panels, NinePatchRect produces clean panels of any size, based on a small texture. To do so, it splits the texture in a 3 by 3 grid. When you scale the node, it tiles the texture's sides horizontally or vertically, the center on both axes but it doesn't scale or tile the corners.
</description>
<tutorials>
</tutorials>
@@ -100,36 +102,49 @@
</methods>
<members>
<member name="axis_stretch_horizontal" type="int" setter="set_h_axis_stretch_mode" getter="get_h_axis_stretch_mode" enum="NinePatchRect.AxisStretchMode">
+ Doesn't do anything at the time of writing.
</member>
<member name="axis_stretch_vertical" type="int" setter="set_v_axis_stretch_mode" getter="get_v_axis_stretch_mode" enum="NinePatchRect.AxisStretchMode">
+ Doesn't do anything at the time of writing.
</member>
<member name="draw_center" type="bool" setter="set_draw_center" getter="is_draw_center_enabled">
+ If [code]true[/code], draw the panel's center. Else, only draw the 9-slice's borders. Default value: [code]true[/code]
</member>
<member name="patch_margin_bottom" type="int" setter="set_patch_margin" getter="get_patch_margin">
+ The height of the 9-slice'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 indivually to create panels with non-uniform borders.
</member>
<member name="patch_margin_left" type="int" setter="set_patch_margin" getter="get_patch_margin">
+ The height of the 9-slice's left column.
</member>
<member name="patch_margin_right" type="int" setter="set_patch_margin" getter="get_patch_margin">
+ The height of the 9-slice's right column.
</member>
<member name="patch_margin_top" type="int" setter="set_patch_margin" getter="get_patch_margin">
+ The height of the 9-slice's top row.
</member>
<member name="region_rect" type="Rect2" setter="set_region_rect" getter="get_region_rect">
+ Rectangular region of the texture to sample from. If you're working with an atlas, use this property to define the area the 9-slice should use. All other properties are relative to this one.
</member>
<member name="texture" type="Texture" setter="set_texture" getter="get_texture">
+ The node's texture resource.
</member>
</members>
<signals>
<signal name="texture_changed">
<description>
+ Fired when the node's texture changes.
</description>
</signal>
</signals>
<constants>
<constant name="AXIS_STRETCH_MODE_STRETCH" value="0">
+ Doesn't do anything at the time of writing. Default value for [code]axis_stretch_horizontal[/code] and [code]axis_stretch_vertical[/code].
</constant>
<constant name="AXIS_STRETCH_MODE_TILE" value="1">
+ Doesn't do anything at the time of writing.
</constant>
<constant name="AXIS_STRETCH_MODE_TILE_FIT" value="2">
+ Doesn't do anything at the time of writing.
</constant>
</constants>
</class>
diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml
index 5a99263f1e..e35f64a9c0 100644
--- a/doc/classes/Node.xml
+++ b/doc/classes/Node.xml
@@ -441,7 +441,7 @@
</return>
<argument index="0" name="child_node" type="Node">
</argument>
- <argument index="1" name="to_pos" type="int">
+ <argument index="1" name="to_position" type="int">
</argument>
<description>
Move a child node to a different position (order) amongst the other children. Since calls, signals, etc are performed by tree order, changing the order of children nodes may be useful.
diff --git a/doc/classes/Node2D.xml b/doc/classes/Node2D.xml
index 2ba312b301..084bee92df 100644
--- a/doc/classes/Node2D.xml
+++ b/doc/classes/Node2D.xml
@@ -169,7 +169,7 @@
<method name="set_global_position">
<return type="void">
</return>
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<description>
Set the node's global position.
@@ -214,7 +214,7 @@
<method name="set_position">
<return type="void">
</return>
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<description>
Set the node's position.
diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml
index 38f1eb8ce1..65200c4769 100644
--- a/doc/classes/OS.xml
+++ b/doc/classes/OS.xml
@@ -233,7 +233,7 @@
</description>
</method>
<method name="get_power_state">
- <return type="int" enum="PowerState">
+ <return type="int" enum="OS.PowerState">
</return>
<description>
</description>
@@ -286,7 +286,7 @@
</description>
</method>
<method name="get_screen_orientation" qualifiers="const">
- <return type="int" enum="_OS.ScreenOrientation">
+ <return type="int" enum="OS.ScreenOrientation">
</return>
<description>
Returns the current screen orientation, the return value will be one of the SCREEN_ORIENTATION constants in this class.
@@ -331,7 +331,7 @@
<method name="get_system_dir" qualifiers="const">
<return type="String">
</return>
- <argument index="0" name="dir" type="int" enum="_OS.SystemDir">
+ <argument index="0" name="dir" type="int" enum="OS.SystemDir">
</argument>
<description>
</description>
@@ -660,7 +660,7 @@
<method name="set_screen_orientation">
<return type="void">
</return>
- <argument index="0" name="orientation" type="int" enum="_OS.ScreenOrientation">
+ <argument index="0" name="orientation" type="int" enum="OS.ScreenOrientation">
</argument>
<description>
Sets the current screen orientation, the argument value must be one of the SCREEN_ORIENTATION constants in this class.
diff --git a/doc/classes/OmniLight.xml b/doc/classes/OmniLight.xml
index 8750fd7e99..cb8e756a4c 100644
--- a/doc/classes/OmniLight.xml
+++ b/doc/classes/OmniLight.xml
@@ -51,5 +51,13 @@
</member>
</members>
<constants>
+ <constant name="SHADOW_DUAL_PARABOLOID" value="0">
+ </constant>
+ <constant name="SHADOW_CUBE" value="1">
+ </constant>
+ <constant name="SHADOW_DETAIL_VERTICAL" value="0">
+ </constant>
+ <constant name="SHADOW_DETAIL_HORIZONTAL" value="1">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/Physics2DDirectBodyState.xml b/doc/classes/Physics2DDirectBodyState.xml
index 9b6fe69b4a..cc68aaab1f 100644
--- a/doc/classes/Physics2DDirectBodyState.xml
+++ b/doc/classes/Physics2DDirectBodyState.xml
@@ -45,7 +45,7 @@
Return the collider object, this depends on how it was created (will return a scene node if such was used to create it).
</description>
</method>
- <method name="get_contact_collider_pos" qualifiers="const">
+ <method name="get_contact_collider_position" qualifiers="const">
<return type="Vector2">
</return>
<argument index="0" name="contact_idx" type="int">
@@ -72,7 +72,7 @@
Return the metadata of the collided shape. This metadata is different from [method Object.get_meta], and is set with [method Physics2DServer.shape_set_data].
</description>
</method>
- <method name="get_contact_collider_velocity_at_pos" qualifiers="const">
+ <method name="get_contact_collider_velocity_at_position" qualifiers="const">
<return type="Vector2">
</return>
<argument index="0" name="contact_idx" type="int">
@@ -97,7 +97,7 @@
Return the local normal (of this body) of the contact point.
</description>
</method>
- <method name="get_contact_local_pos" qualifiers="const">
+ <method name="get_contact_local_position" qualifiers="const">
<return type="Vector2">
</return>
<argument index="0" name="contact_idx" type="int">
diff --git a/doc/classes/Physics2DServer.xml b/doc/classes/Physics2DServer.xml
index ab63089691..fd093edc84 100644
--- a/doc/classes/Physics2DServer.xml
+++ b/doc/classes/Physics2DServer.xml
@@ -306,7 +306,7 @@
</return>
<argument index="0" name="body" type="RID">
</argument>
- <argument index="1" name="pos" type="Vector2">
+ <argument index="1" name="position" type="Vector2">
</argument>
<argument index="2" name="impulse" type="Vector2">
</argument>
diff --git a/doc/classes/PhysicsBody.xml b/doc/classes/PhysicsBody.xml
index e8ae986346..e75fbb8e2d 100644
--- a/doc/classes/PhysicsBody.xml
+++ b/doc/classes/PhysicsBody.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="PhysicsBody" inherits="CollisionObject" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Base class for different types of Physics bodies.
+ Base class for all objects affected by physics in 3D space.
</brief_description>
<description>
- PhysicsBody is an abstract base class for implementing a physics body. All PhysicsBody types inherit from it.
+ PhysicsBody is an abstract base class for implementing a physics body. All *Body types inherit from it.
</description>
<tutorials>
</tutorials>
@@ -17,7 +17,7 @@
<argument index="0" name="body" type="Node">
</argument>
<description>
- Adds a body to the collision exception list. This list contains bodies that this body will not collide with.
+ Adds a body to the list of bodies that this body can't collide with.
</description>
</method>
<method name="get_collision_layer" qualifiers="const">
@@ -54,7 +54,7 @@
<argument index="0" name="body" type="Node">
</argument>
<description>
- Removes a body from the collision exception list.
+ Removes a body from the list of bodies that this body can't collide with.
</description>
</method>
<method name="set_collision_layer">
@@ -96,8 +96,12 @@
</methods>
<members>
<member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer">
+ The physics layers this area is in.
+ Collidable objects can exist in any of 32 different layers. These layers work like a tagging system, and are not visual. A collidable can use these layers to select with which objects it can collide, using the collision_mask property.
+ A contact is detected if object A is in any of the layers that object B scans, or object B is in any layer scanned by object A.
</member>
<member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask">
+ The physics layers this area can scan for collisions.
</member>
</members>
<constants>
diff --git a/doc/classes/PhysicsBody2D.xml b/doc/classes/PhysicsBody2D.xml
index e160311090..748506baa9 100644
--- a/doc/classes/PhysicsBody2D.xml
+++ b/doc/classes/PhysicsBody2D.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="PhysicsBody2D" inherits="CollisionObject2D" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Base class for all objects affected by physics.
+ Base class for all objects affected by physics in 2D space.
</brief_description>
<description>
PhysicsBody2D is an abstract base class for implementing a physics body. All *Body2D types inherit from it.
@@ -17,6 +17,7 @@
<argument index="0" name="body" type="Node">
</argument>
<description>
+ Adds a body to the list of bodies that this body can't collide with.
</description>
</method>
<method name="get_collision_layer" qualifiers="const">
@@ -57,6 +58,7 @@
<argument index="0" name="body" type="Node">
</argument>
<description>
+ Removes a body from the list of bodies that this body can't collide with.
</description>
</method>
<method name="set_collision_layer">
@@ -104,10 +106,15 @@
</methods>
<members>
<member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer">
+ The physics layers this area is in.
+ Collidable objects can exist in any of 32 different layers. These layers work like a tagging system, and are not visual. A collidable can use these layers to select with which objects it can collide, using the collision_mask property.
+ A contact is detected if object A is in any of the layers that object B scans, or object B is in any layer scanned by object A.
</member>
<member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask">
+ The physics layers this area can scan for collisions.
</member>
<member name="layers" type="int" setter="_set_layers" getter="_get_layers">
+ Both collision_layer and collision_mask. Returns collision_layer when accessed. Updates collision_layers and collision_mask when modified.
</member>
</members>
<constants>
diff --git a/doc/classes/PhysicsDirectBodyState.xml b/doc/classes/PhysicsDirectBodyState.xml
index de51d0e958..349b7e7c3f 100644
--- a/doc/classes/PhysicsDirectBodyState.xml
+++ b/doc/classes/PhysicsDirectBodyState.xml
@@ -14,7 +14,7 @@
</return>
<argument index="0" name="force" type="Vector3">
</argument>
- <argument index="1" name="pos" type="Vector3">
+ <argument index="1" name="position" type="Vector3">
</argument>
<description>
</description>
@@ -22,7 +22,7 @@
<method name="apply_impulse">
<return type="void">
</return>
- <argument index="0" name="pos" type="Vector3">
+ <argument index="0" name="position" type="Vector3">
</argument>
<argument index="1" name="j" type="Vector3">
</argument>
@@ -73,7 +73,7 @@
<description>
</description>
</method>
- <method name="get_contact_collider_pos" qualifiers="const">
+ <method name="get_contact_collider_position" qualifiers="const">
<return type="Vector3">
</return>
<argument index="0" name="contact_idx" type="int">
@@ -89,7 +89,7 @@
<description>
</description>
</method>
- <method name="get_contact_collider_velocity_at_pos" qualifiers="const">
+ <method name="get_contact_collider_velocity_at_position" qualifiers="const">
<return type="Vector3">
</return>
<argument index="0" name="contact_idx" type="int">
@@ -111,7 +111,7 @@
<description>
</description>
</method>
- <method name="get_contact_local_pos" qualifiers="const">
+ <method name="get_contact_local_position" qualifiers="const">
<return type="Vector3">
</return>
<argument index="0" name="contact_idx" type="int">
diff --git a/doc/classes/PhysicsServer.xml b/doc/classes/PhysicsServer.xml
index 93a50eb1bf..145f5a0163 100644
--- a/doc/classes/PhysicsServer.xml
+++ b/doc/classes/PhysicsServer.xml
@@ -268,7 +268,7 @@
</return>
<argument index="0" name="body" type="RID">
</argument>
- <argument index="1" name="pos" type="Vector3">
+ <argument index="1" name="position" type="Vector3">
</argument>
<argument index="2" name="impulse" type="Vector3">
</argument>
@@ -1248,5 +1248,29 @@
</constant>
<constant name="INFO_ISLAND_COUNT" value="2">
</constant>
+ <constant name="SPACE_PARAM_CONTACT_RECYCLE_RADIUS" value="0">
+ </constant>
+ <constant name="SPACE_PARAM_CONTACT_MAX_SEPARATION" value="1">
+ </constant>
+ <constant name="SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION" value="2">
+ </constant>
+ <constant name="SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD" value="3">
+ </constant>
+ <constant name="SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD" value="4">
+ </constant>
+ <constant name="SPACE_PARAM_BODY_TIME_TO_SLEEP" value="5">
+ </constant>
+ <constant name="SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO" value="6">
+ </constant>
+ <constant name="SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS" value="7">
+ </constant>
+ <constant name="BODY_AXIS_LOCK_DISABLED" value="0">
+ </constant>
+ <constant name="BODY_AXIS_LOCK_X" value="1">
+ </constant>
+ <constant name="BODY_AXIS_LOCK_Y" value="2">
+ </constant>
+ <constant name="BODY_AXIS_LOCK_Z" value="3">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index bec9525a45..1a3ea5c5c7 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -147,7 +147,7 @@
</return>
<argument index="0" name="name" type="String">
</argument>
- <argument index="1" name="pos" type="int">
+ <argument index="1" name="position" type="int">
</argument>
<description>
Set the order of a configuration value (influences when saved to the config file).
diff --git a/doc/classes/RayShape2D.xml b/doc/classes/RayShape2D.xml
index 8414ee2348..4f6313a1d2 100644
--- a/doc/classes/RayShape2D.xml
+++ b/doc/classes/RayShape2D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="RayShape2D" inherits="Shape2D" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Ray 2D shape resource for physics.
+ Ray shape for 2D collisions.
</brief_description>
<description>
- Ray 2D shape resource for physics. 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.
+ Ray shape for 2D collisions. 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>
@@ -30,6 +30,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/Rect2.xml b/doc/classes/Rect2.xml
index 1a467861b3..80f7830a16 100644
--- a/doc/classes/Rect2.xml
+++ b/doc/classes/Rect2.xml
@@ -14,7 +14,7 @@
<method name="Rect2">
<return type="Rect2">
</return>
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<argument index="1" name="size" type="Vector2">
</argument>
diff --git a/doc/classes/Rect3.xml b/doc/classes/Rect3.xml
index 8837b8f812..f41665db34 100644
--- a/doc/classes/Rect3.xml
+++ b/doc/classes/Rect3.xml
@@ -14,7 +14,7 @@
<method name="Rect3">
<return type="Rect3">
</return>
- <argument index="0" name="pos" type="Vector3">
+ <argument index="0" name="position" type="Vector3">
</argument>
<argument index="1" name="size" type="Vector3">
</argument>
diff --git a/doc/classes/RectangleShape2D.xml b/doc/classes/RectangleShape2D.xml
index 9c18df970b..7a1aec2021 100644
--- a/doc/classes/RectangleShape2D.xml
+++ b/doc/classes/RectangleShape2D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="RectangleShape2D" inherits="Shape2D" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Rectangle Shape for 2D Physics.
+ Rectangle shape for 2D collisions.
</brief_description>
<description>
- Rectangle Shape for 2D Physics. This shape is useful for modeling box-like 2D objects.
+ Rectangle shape for 2D collisions. This shape is useful for modeling box-like 2D objects.
</description>
<tutorials>
</tutorials>
@@ -30,6 +30,7 @@
</methods>
<members>
<member name="extents" type="Vector2" setter="set_extents" getter="get_extents">
+ The rectangle's half extents. The width and height of this shape is twice the half extents.
</member>
</members>
<constants>
diff --git a/doc/classes/Reference.xml b/doc/classes/Reference.xml
index a8ca4cde0c..2531ea88ad 100644
--- a/doc/classes/Reference.xml
+++ b/doc/classes/Reference.xml
@@ -18,7 +18,7 @@
</description>
</method>
<method name="reference">
- <return type="void">
+ <return type="bool">
</return>
<description>
Increase the internal reference counter. Use this only if you really know what you are doing.
diff --git a/doc/classes/RigidBody.xml b/doc/classes/RigidBody.xml
index 446c6d14cb..76a93248fb 100644
--- a/doc/classes/RigidBody.xml
+++ b/doc/classes/RigidBody.xml
@@ -1,10 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="RigidBody" inherits="PhysicsBody" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Rigid body node.
+ Physics Body whose position is determined through physics simulation in 3D space.
</brief_description>
<description>
- Rigid body node. This node is used for placing rigid bodies in the scene. It can contain a number of shapes, and also shift mode between regular Rigid body, Kinematic, Character or Static.
+ This is the node that implements full 3D physics. This means that you do not control a RigidBody directly. Instead you can apply forces to it (gravity, impulses, etc.), and the physics simulation will calculate the resulting movement, collision, bouncing, rotating, etc.
+ This node can use custom force integration, for writing complex physics motion behavior per node.
+ This node can shift state between regular Rigid body, Kinematic, Character or Static.
+ Character mode forbids this node from being rotated.
+ As a warning, don't change RigidBody's position every frame or very often. Sporadic changes work fine, but physics runs at a different granularity (fixed hz) than usual rendering (process callback) and maybe even in a separate thread, so changing this from a process loop will yield strange behavior.
</description>
<tutorials>
</tutorials>
@@ -23,7 +27,7 @@
<method name="apply_impulse">
<return type="void">
</return>
- <argument index="0" name="pos" type="Vector3">
+ <argument index="0" name="position" type="Vector3">
</argument>
<argument index="1" name="impulse" type="Vector3">
</argument>
@@ -324,55 +328,56 @@
</methods>
<members>
<member name="angular_damp" type="float" setter="set_angular_damp" getter="get_angular_damp">
- Dampens rotational forces of the Rigid body by the 'angular_damp' rate.
+ Damps RigidBody's rotational forces.
</member>
<member name="angular_velocity" type="Vector3" setter="set_angular_velocity" getter="get_angular_velocity">
- The current rotational velocity of the Rigid body
+ RigidBody's rotational velocity.
</member>
<member name="axis_lock" type="int" setter="set_axis_lock" getter="get_axis_lock" enum="RigidBody.AxisLock">
Locks the rotational forces to a particular axis, preventing rotations on other axes.
</member>
<member name="bounce" type="float" setter="set_bounce" getter="get_bounce">
- Bounciness of the Rigid body.
+ RigidBody's bounciness.
</member>
<member name="can_sleep" type="bool" setter="set_can_sleep" getter="is_able_to_sleep">
- If true, the Rigid body will no longer calculate forces when there is no movement and will act as a static body. It will wake up when other forces are applied through other collisions or when the 'apply_impulse' method is used.
+ If [code]true[/code] the RigidBody will not calculate forces and will act as a static body while there is no movement. It will wake up when forces are applied through other collisions or when the [code]apply_impulse[/code] method is used.
</member>
<member name="contact_monitor" type="bool" setter="set_contact_monitor" getter="is_contact_monitor_enabled">
- If true, the Rigid body will emit signals when it collides with another Rigid body.
+ If true, the RigidBody will emit signals when it collides with another RigidBody.
</member>
<member name="contacts_reported" type="int" setter="set_max_contacts_reported" getter="get_max_contacts_reported">
The maximum contacts to report. Bodies can keep a log of the contacts with other bodies, this is enabled by setting the maximum amount of contacts reported to a number greater than 0.
</member>
<member name="continuous_cd" type="bool" setter="set_use_continuous_collision_detection" getter="is_using_continuous_collision_detection">
- Continuous collision detection tries to predict where a moving body will collide, instead of moving it and correcting its movement if it collided. The first is more precise, and misses less impacts by small, fast-moving objects. The second is faster to compute, but can miss small, fast-moving objects.
+ If [code]true[/code] continuous collision detection is used.
+ Continuous collision detection tries to predict where a moving body will collide, instead of moving it and correcting its movement if it collided. Continuous collision detection is more precise, and misses less impacts by small, fast-moving objects. Not using continuous collision detection is faster to compute, but can miss small, fast-moving objects.
</member>
<member name="custom_integrator" type="bool" setter="set_use_custom_integrator" getter="is_using_custom_integrator">
- If true, internal force integration will be disabled (like gravity or air friction) for this body. Other than collision response, the body will only move as determined by the [method _integrate_forces] function, if defined.
+ If [code]true[/code] internal force integration will be disabled (like gravity or air friction) for this body. Other than collision response, the body will only move as determined by the [method _integrate_forces] function, if defined.
</member>
<member name="friction" type="float" setter="set_friction" getter="get_friction">
The body friction, from 0 (frictionless) to 1 (max friction).
</member>
<member name="gravity_scale" type="float" setter="set_gravity_scale" getter="get_gravity_scale">
- The 'gravity_scale' for this Rigid body will be multiplied by the global 3d gravity setting found in "Project &gt; Project Settings &gt; Physics &gt; 3d". A value of 1 will be normal gravity, 2 will apply double gravity, and 0.5 will apply half gravity to this object.
+ This is multiplied by the global 3D gravity setting found in "Project &gt; Project Settings &gt; Physics &gt; 3d" to produce RigidBody's gravity. E.g. a value of 1 will be normal gravity, 2 will apply double gravity, and 0.5 will apply half gravity to this object.
</member>
<member name="linear_damp" type="float" setter="set_linear_damp" getter="get_linear_damp">
- The linear damp for this body. Default of -1, cannot be less than -1. If this value is different from -1, any linear damp derived from the world or areas will be overridden.
+ RigidBody's linear damp. Default value: -1, cannot be less than -1. If this value is different from -1, any linear damp derived from the world or areas will be overridden.
</member>
<member name="linear_velocity" type="Vector3" setter="set_linear_velocity" getter="get_linear_velocity">
- The body linear velocity. Can be used sporadically, but [b]DON'T SET THIS IN EVERY FRAME[/b], because physics may run in another thread and runs at a different granularity. Use [method _integrate_forces] as your process loop for precise control of the body state.
+ RigidBody's linear velocity. Can be used sporadically, but [b]DON'T SET THIS IN EVERY FRAME[/b], because physics may run in another thread and runs at a different granularity. Use [method _integrate_forces] as your process loop for precise control of the body state.
</member>
<member name="mass" type="float" setter="set_mass" getter="get_mass">
- The body mass.
+ RigidBody's mass.
</member>
<member name="mode" type="int" setter="set_mode" getter="get_mode" enum="RigidBody.Mode">
The body mode from the MODE_* enum. Modes include: MODE_STATIC, MODE_KINEMATIC, MODE_RIGID, and MODE_CHARACTER.
</member>
<member name="sleeping" type="bool" setter="set_sleeping" getter="is_sleeping">
- The current 'sleeping' state of the Rigid body.
+ If [code]true[/code] RigidBody is sleeping and will not calculate forces until woken up by a collision or the [code]apply_impulse[/code] method.
</member>
<member name="weight" type="float" setter="set_weight" getter="get_weight">
- The body weight given standard earth-weight (gravity 9.8).
+ RigidBody's weight based on its mass and the global 3D gravity. Global values are set in "Project &gt; Project Settings &gt; Physics &gt; 3d".
</member>
</members>
<signals>
@@ -437,5 +442,13 @@
<constant name="MODE_CHARACTER" value="2">
Character body. This behaves like a rigid body, but can not rotate.
</constant>
+ <constant name="AXIS_LOCK_DISABLED" value="0">
+ </constant>
+ <constant name="AXIS_LOCK_X" value="1">
+ </constant>
+ <constant name="AXIS_LOCK_Y" value="2">
+ </constant>
+ <constant name="AXIS_LOCK_Z" value="3">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/RigidBody2D.xml b/doc/classes/RigidBody2D.xml
index e92c417323..a4faa697de 100644
--- a/doc/classes/RigidBody2D.xml
+++ b/doc/classes/RigidBody2D.xml
@@ -1,12 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="RigidBody2D" inherits="PhysicsBody2D" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Rigid body 2D node.
+ Physics Body whose position is determined through physics simulation in 2D space.
</brief_description>
<description>
- Rigid body 2D node. This node is used for placing rigid bodies in the scene. It can contain a number of shapes, and also shift state between regular Rigid body, Kinematic, Character or Static.
- Character mode forbids the node from being rotated. This node can have a custom force integrator function, for writing complex physics motion behavior per node.
- As a warning, don't change this node position every frame or very often. Sporadic changes work fine, but physics runs at a different granularity (fixed hz) than usual rendering (process callback) and maybe even in a separate thread, so changing this from a process loop will yield strange behavior.
+ This is the node that implements full 2D physics. This means that you do not control a RigidBody2D directly. Instead you can apply forces to it (gravity, impulses, etc.), and the physics simulation will calculate the resulting movement, collision, bouncing, rotating, etc.
+ This node can use custom force integration, for writing complex physics motion behavior per node.
+ This node can shift state between regular Rigid body, Kinematic, Character or Static.
+ Character mode forbids this node from being rotated.
+ As a warning, don't change RigidBody2D's position every frame or very often. Sporadic changes work fine, but physics runs at a different granularity (fixed hz) than usual rendering (process callback) and maybe even in a separate thread, so changing this from a process loop will yield strange behavior.
</description>
<tutorials>
</tutorials>
@@ -382,36 +384,53 @@
</methods>
<members>
<member name="angular_damp" type="float" setter="set_angular_damp" getter="get_angular_damp">
+ Damps RigidBody2D's rotational forces.
</member>
<member name="angular_velocity" type="float" setter="set_angular_velocity" getter="get_angular_velocity">
+ RigidBody2D's rotational velocity.
</member>
<member name="bounce" type="float" setter="set_bounce" getter="get_bounce">
+ RigidBody2D's bounciness.
</member>
<member name="can_sleep" type="bool" setter="set_can_sleep" getter="is_able_to_sleep">
+ If [code]true[/code] RigidBody2D will not calculate forces and will act as a static body while there is no movement. It will wake up when other forces are applied through other collisions or when the [code]apply_impulse[/code] method is used. Default value: [code]true[/code]
</member>
<member name="contact_monitor" type="bool" setter="set_contact_monitor" getter="is_contact_monitor_enabled">
+ If [code]true[/code] RigidBody2D will emit signals when it collides with another RigidBody2D.
</member>
<member name="contacts_reported" type="int" setter="set_max_contacts_reported" getter="get_max_contacts_reported">
+ The maximum contacts to report. Bodies can keep a log of the contacts with other bodies, this is enabled by setting the maximum amount of contacts reported to a number greater than 0.
</member>
<member name="continuous_cd" type="int" setter="set_continuous_collision_detection_mode" getter="get_continuous_collision_detection_mode" enum="RigidBody2D.CCDMode">
+ If [code]true[/code] continuous collision detection is used. Default value: [code]false[/code]
+ Continuous collision detection tries to predict where a moving body will collide, instead of moving it and correcting its movement if it collided. Continuous collision detection is more precise, and misses less impacts by small, fast-moving objects. Not using continuous collision detection is faster to compute, but can miss small, fast-moving objects.
</member>
<member name="custom_integrator" type="bool" setter="set_use_custom_integrator" getter="is_using_custom_integrator">
+ If [code]true[/code] internal force integration will be disabled (like gravity or air friction) for this body. Other than collision response, the body will only move as determined by the [method _integrate_forces] function, if defined.
</member>
<member name="friction" type="float" setter="set_friction" getter="get_friction">
+ The body friction, from 0 (frictionless) to 1 (max friction).
</member>
<member name="gravity_scale" type="float" setter="set_gravity_scale" getter="get_gravity_scale">
+ This is multiplied by the global 2D gravity setting found in "Project &gt; Project Settings &gt; Physics &gt; 2d" to produce RigidBody2D's gravity. E.g. a value of 1 will be normal gravity, 2 will apply double gravity, and 0.5 will apply half gravity to this object.
</member>
<member name="linear_damp" type="float" setter="set_linear_damp" getter="get_linear_damp">
+ RigidBody2D's linear damp. Default of -1, cannot be less than -1. If this value is different from -1, any linear damp derived from the world or areas will be overridden.
</member>
<member name="linear_velocity" type="Vector2" setter="set_linear_velocity" getter="get_linear_velocity">
+ RigidBody2D's linear velocity. Can be used sporadically, but [b]DON'T SET THIS IN EVERY FRAME[/b], because physics may run in another thread and runs at a different granularity. Use [method _integrate_forces] as your process loop for precise control of the body state.
</member>
<member name="mass" type="float" setter="set_mass" getter="get_mass">
+ RigidBody2D's mass.
</member>
<member name="mode" type="int" setter="set_mode" getter="get_mode" enum="RigidBody2D.Mode">
+ The body mode from the MODE_* enum. Modes include: MODE_STATIC, MODE_KINEMATIC, MODE_RIGID, and MODE_CHARACTER.
</member>
<member name="sleeping" type="bool" setter="set_sleeping" getter="is_sleeping">
+ If [code]true[/code] RigidBody2D is sleeping and will not calculate forces until woken up by a collision or the [code]apply_impulse[/code] method.
</member>
<member name="weight" type="float" setter="set_weight" getter="get_weight">
+ RigidBody2D's weight based on its mass and the global 2D gravity. Global values are set in "Project &gt; Project Settings &gt; Physics &gt; 2d".
</member>
</members>
<signals>
diff --git a/doc/classes/SegmentShape2D.xml b/doc/classes/SegmentShape2D.xml
index 0e2c5c86f3..3b7a747bcb 100644
--- a/doc/classes/SegmentShape2D.xml
+++ b/doc/classes/SegmentShape2D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="SegmentShape2D" inherits="Shape2D" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Segment Shape for 2D Collision Detection.
+ Segment shape for 2D collisions.
</brief_description>
<description>
- Segment Shape for 2D Collision Detection, consists of two points, 'a' and 'b'.
+ Segment shape for 2D collisions. Consists of two points, [code]a[/code] and [code]b[/code].
</description>
<tutorials>
</tutorials>
@@ -46,8 +46,10 @@
</methods>
<members>
<member name="a" type="Vector2" setter="set_a" getter="get_a">
+ The segment's first point position.
</member>
<member name="b" type="Vector2" setter="set_b" getter="get_b">
+ The segment's second point position.
</member>
</members>
<constants>
diff --git a/doc/classes/Spatial.xml b/doc/classes/Spatial.xml
index 076d0b9bc3..54eb82fbff 100644
--- a/doc/classes/Spatial.xml
+++ b/doc/classes/Spatial.xml
@@ -4,7 +4,7 @@
Most basic 3D game object, parent of all 3D related nodes.
</brief_description>
<description>
- Most basic 3D game object, with a 3D [Transform] and visibility settings. All 3D physics nodes and sprites inherit from Spatial. Use Spatial as a parent node to move, scale, rotate and show/hide children in a 3D project.
+ Most basic 3D game object, with a 3D [Transform] and visibility settings. All other 3D game objects inherit from Spatial. Use Spatial as a parent node to move, scale, rotate and show/hide children in a 3D project.
</description>
<tutorials>
</tutorials>
@@ -15,35 +15,35 @@
<return type="SpatialGizmo">
</return>
<description>
- Return the SpatialGizmo for this node. Used for example in [EditorSpatialGizmo] as custom visualization and editing handles in Editor.
+ Returns the SpatialGizmo for this node. Used for example in [EditorSpatialGizmo] as custom visualization and editing handles in Editor.
</description>
</method>
<method name="get_global_transform" qualifiers="const">
<return type="Transform">
</return>
<description>
- Return the global transform, relative to worldspace.
+ Returns the global transform, relative to worldspace.
</description>
</method>
<method name="get_parent_spatial" qualifiers="const">
<return type="Spatial">
</return>
<description>
- Return the parent [Spatial], or an empty [Object] if no parent exists or parent is not of type [Spatial].
+ Returns the parent [Spatial], or an empty [Object] if no parent exists or parent is not of type [Spatial].
</description>
</method>
<method name="get_rotation" qualifiers="const">
<return type="Vector3">
</return>
<description>
- Return the rotation (in radians).
+ Returns the rotation (in radians).
</description>
</method>
<method name="get_rotation_deg" qualifiers="const">
<return type="Vector3">
</return>
<description>
- Return the rotation (in degrees).
+ Returns the rotation (in degrees).
</description>
</method>
<method name="get_scale" qualifiers="const">
@@ -56,7 +56,7 @@
<return type="Transform">
</return>
<description>
- Return the local transform, relative to the bone parent.
+ Returns the local transform, relative to the bone parent.
</description>
</method>
<method name="get_translation" qualifiers="const">
@@ -69,7 +69,7 @@
<return type="World">
</return>
<description>
- Return current [World] resource this Spatial node is registered to.
+ Returns the current [World] resource this Spatial node is registered to.
</description>
</method>
<method name="global_rotate">
@@ -80,7 +80,7 @@
<argument index="1" name="radians" type="float">
</argument>
<description>
- Rotate current node along normal [Vector3] by angle in radians in Global space.
+ Rotates the current node along normal [Vector3] by angle in radians in Global space.
</description>
</method>
<method name="global_translate">
@@ -89,49 +89,49 @@
<argument index="0" name="offset" type="Vector3">
</argument>
<description>
- Move current node by [Vector3] offset in Global space.
+ Moves the node by [Vector3] offset in Global space.
</description>
</method>
<method name="hide">
<return type="void">
</return>
<description>
- Disable rendering of this node. Change Spatial Visible property to false.
+ Disables rendering of this node. Change Spatial Visible property to false.
</description>
</method>
<method name="is_local_transform_notification_enabled" qualifiers="const">
<return type="bool">
</return>
<description>
- Returns whether node sends notification that its local transformation changed. Spatial will not propagate this by default.
+ Returns whether node notifies about its local transformation changes. Spatial will not propagate this by default.
</description>
</method>
<method name="is_set_as_toplevel" qualifiers="const">
<return type="bool">
</return>
<description>
- Returns whether this node is set as Toplevel, ignoring its parent node transformations.
+ Returns whether this node is set as Toplevel, that is whether it ignores its parent nodes transformations.
</description>
</method>
<method name="is_transform_notification_enabled" qualifiers="const">
<return type="bool">
</return>
<description>
- Returns whether node sends notification that its transformation changed. Spatial will not propagate this by default.
+ Returns whether the node notifies about its global and local transformation changes. Spatial will not propagate this by default.
</description>
</method>
<method name="is_visible" qualifiers="const">
<return type="bool">
</return>
<description>
- Returns whether this node is set to be visible.
+ Returns whether the node is set to be visible.
</description>
</method>
<method name="is_visible_in_tree" qualifiers="const">
<return type="bool">
</return>
<description>
- Returns whether this node is visible, taking into consideration that its parents visibility.
+ Returns whether the node is visible, taking into consideration that its parents visibility.
</description>
</method>
<method name="look_at">
@@ -145,24 +145,24 @@
Rotates itself to point into direction of target position. Operations take place in global space.
</description>
</method>
- <method name="look_at_from_pos">
+ <method name="look_at_from_position">
<return type="void">
</return>
- <argument index="0" name="pos" type="Vector3">
+ <argument index="0" name="position" type="Vector3">
</argument>
<argument index="1" name="target" type="Vector3">
</argument>
<argument index="2" name="up" type="Vector3">
</argument>
<description>
- Moves itself to specified position and then rotates itself to point into direction of target position. Operations take place in global space.
+ Moves the node to specified position and then rotates itself to point into direction of target position. Operations take place in global space.
</description>
</method>
<method name="orthonormalize">
<return type="void">
</return>
<description>
- Reset this node transformations (like scale, skew and taper) preserving its rotation and translation. Performs orthonormalization on this node [Transform3D].
+ Resets this node's transformations (like scale, skew and taper) preserving its rotation and translation. Performs orthonormalization on this node [Transform3D].
</description>
</method>
<method name="rotate">
@@ -173,7 +173,7 @@
<argument index="1" name="radians" type="float">
</argument>
<description>
- Rotates node in local space on given normal [Vector3] by angle in radians.
+ Rotates the node in local space on given normal [Vector3] by angle in radians.
</description>
</method>
<method name="rotate_x">
@@ -182,7 +182,7 @@
<argument index="0" name="radians" type="float">
</argument>
<description>
- Rotates node in local space on X axis by angle in radians.
+ Rotates the node in local space on X axis by angle in radians.
</description>
</method>
<method name="rotate_y">
@@ -191,7 +191,7 @@
<argument index="0" name="radians" type="float">
</argument>
<description>
- Rotates node in local space on Y axis by angle in radians.
+ Rotates the node in local space on Y axis by angle in radians.
</description>
</method>
<method name="rotate_z">
@@ -200,7 +200,7 @@
<argument index="0" name="radians" type="float">
</argument>
<description>
- Rotates node in local space on Z axis by angle in radians.
+ Rotates the node in local space on Z axis by angle in radians.
</description>
</method>
<method name="set_as_toplevel">
@@ -209,7 +209,7 @@
<argument index="0" name="enable" type="bool">
</argument>
<description>
- Makes this node ignore its parents tranformations. Node tranformations are only in global space.
+ Makes the node ignore its parents tranformations. Node tranformations are only in global space.
</description>
</method>
<method name="set_gizmo">
@@ -243,7 +243,7 @@
<argument index="0" name="enabled" type="bool">
</argument>
<description>
- Set whether this node ignores notification that its transformation changed.
+ Set whether the node ignores notification that its transformation (global or local) changed.
</description>
</method>
<method name="set_notify_local_transform">
@@ -252,7 +252,7 @@
<argument index="0" name="enable" type="bool">
</argument>
<description>
- Set whether this node sends notification that its local transformation changed. Spatial will not propagate this by default.
+ Set whether the node notifies about its local transformation changes. Spatial will not propagate this by default.
</description>
</method>
<method name="set_notify_transform">
@@ -261,7 +261,7 @@
<argument index="0" name="enable" type="bool">
</argument>
<description>
- Set whether this node sends notification that its transformation changed. Spatial will not propagate this by default.
+ Set whether the node notifies about its global and local transformation changes. Spatial will not propagate this by default.
</description>
</method>
<method name="set_rotation">
@@ -320,7 +320,7 @@
<return type="void">
</return>
<description>
- Enable rendering of this node. Change Spatial Visible property to false.
+ Enables rendering of this node. Change Spatial Visible property to "True".
</description>
</method>
<method name="to_global" qualifiers="const">
@@ -329,7 +329,7 @@
<argument index="0" name="local_point" type="Vector3">
</argument>
<description>
- Tranform [Vector3] from this node local space to world space.
+ Tranforms [Vector3] "local_point" from this node's local space to world space.
</description>
</method>
<method name="to_local" qualifiers="const">
@@ -338,7 +338,7 @@
<argument index="0" name="global_point" type="Vector3">
</argument>
<description>
- Tranform [Vector3] from world space to this node local space.
+ Tranforms [Vector3] "global_point" from world space to this node's local space.
</description>
</method>
<method name="translate">
@@ -347,14 +347,14 @@
<argument index="0" name="offset" type="Vector3">
</argument>
<description>
- Change node position by given offset [Vector3].
+ Changes the node's position by given offset [Vector3].
</description>
</method>
<method name="update_gizmo">
<return type="void">
</return>
<description>
- Update [SpatialGizmo] of this node.
+ Updates the [SpatialGizmo] of this node.
</description>
</method>
</methods>
@@ -384,23 +384,23 @@
<signals>
<signal name="visibility_changed">
<description>
- Emitted when node visibility changed.
+ Emitted when node visibility changes.
</description>
</signal>
</signals>
<constants>
<constant name="NOTIFICATION_TRANSFORM_CHANGED" value="29" enum="">
- Spatial nodes receive this notification when their global transform changes. This means that either the current or a parent node changed its transform.
+ Spatial nodes receives this notification when their global transform changes. This means that either the current or a parent node changed its transform.
In order for NOTIFICATION_TRANSFORM_CHANGED to work user first needs to ask for it, with set_notify_transform(true).
</constant>
<constant name="NOTIFICATION_ENTER_WORLD" value="41" enum="">
- Spatial nodes receive this notification when they are registered to new [World] resource.
+ Spatial nodes receives this notification when they are registered to new [World] resource.
</constant>
<constant name="NOTIFICATION_EXIT_WORLD" value="42" enum="">
- Spatial nodes receive this notification when they are unregistered from current [World] resource.
+ Spatial nodes receives this notification when they are unregistered from current [World] resource.
</constant>
<constant name="NOTIFICATION_VISIBILITY_CHANGED" value="43" enum="">
- Spatial nodes receive this notification when their visibility changes.
+ Spatial nodes receives this notification when their visibility changes.
</constant>
</constants>
</class>
diff --git a/doc/classes/SpriteFrames.xml b/doc/classes/SpriteFrames.xml
index 1c5669b898..f4a8eeabe4 100644
--- a/doc/classes/SpriteFrames.xml
+++ b/doc/classes/SpriteFrames.xml
@@ -26,7 +26,7 @@
</argument>
<argument index="1" name="frame" type="Texture">
</argument>
- <argument index="2" name="atpos" type="int" default="-1">
+ <argument index="2" name="at_position" type="int" default="-1">
</argument>
<description>
</description>
diff --git a/doc/classes/StreamPeerBuffer.xml b/doc/classes/StreamPeerBuffer.xml
index 70a4c781c9..141d46564c 100644
--- a/doc/classes/StreamPeerBuffer.xml
+++ b/doc/classes/StreamPeerBuffer.xml
@@ -27,7 +27,7 @@
<description>
</description>
</method>
- <method name="get_pos" qualifiers="const">
+ <method name="get_position" qualifiers="const">
<return type="int">
</return>
<description>
@@ -50,7 +50,7 @@
<method name="seek">
<return type="void">
</return>
- <argument index="0" name="pos" type="int">
+ <argument index="0" name="position" type="int">
</argument>
<description>
</description>
diff --git a/doc/classes/String.xml b/doc/classes/String.xml
index ce3dc1db2f..c7c19997b9 100644
--- a/doc/classes/String.xml
+++ b/doc/classes/String.xml
@@ -266,12 +266,12 @@
</description>
</method>
<method name="erase">
- <argument index="0" name="pos" type="int">
+ <argument index="0" name="position" type="int">
</argument>
<argument index="1" name="chars" type="int">
</argument>
<description>
- Erase [code]chars[/code] characters from the string starting from [code]pos[/code].
+ Erase [code]chars[/code] characters from the string starting from [code]position[/code].
</description>
</method>
<method name="find">
@@ -360,7 +360,7 @@
<method name="insert">
<return type="String">
</return>
- <argument index="0" name="pos" type="int">
+ <argument index="0" name="position" type="int">
</argument>
<argument index="1" name="what" type="String">
</argument>
@@ -445,7 +445,7 @@
<method name="left">
<return type="String">
</return>
- <argument index="0" name="pos" type="int">
+ <argument index="0" name="position" type="int">
</argument>
<description>
Return an amount of characters from the left of the string.
@@ -596,7 +596,7 @@
<method name="right">
<return type="String">
</return>
- <argument index="0" name="pos" type="int">
+ <argument index="0" name="position" type="int">
</argument>
<description>
Return the right side of the string from a given position.
diff --git a/doc/classes/TabContainer.xml b/doc/classes/TabContainer.xml
index f96b31262c..ffe99eb82b 100644
--- a/doc/classes/TabContainer.xml
+++ b/doc/classes/TabContainer.xml
@@ -190,6 +190,12 @@
</signal>
</signals>
<constants>
+ <constant name="ALIGN_LEFT" value="0">
+ </constant>
+ <constant name="ALIGN_CENTER" value="1">
+ </constant>
+ <constant name="ALIGN_RIGHT" value="2">
+ </constant>
</constants>
<theme_items>
<theme_item name="decrement" type="Texture">
diff --git a/doc/classes/Texture.xml b/doc/classes/Texture.xml
index d09236bbc9..cbf72eb991 100644
--- a/doc/classes/Texture.xml
+++ b/doc/classes/Texture.xml
@@ -16,7 +16,7 @@
</return>
<argument index="0" name="canvas_item" type="RID">
</argument>
- <argument index="1" name="pos" type="Vector2">
+ <argument index="1" name="position" type="Vector2">
</argument>
<argument index="2" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )">
</argument>
diff --git a/doc/classes/TextureProgress.xml b/doc/classes/TextureProgress.xml
index 1ac031c411..0a6ffcdeb8 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 implementation.
+ Textured progress bar.
</brief_description>
<description>
- [ProgressBar] implementation that is easier to theme (by just passing a few textures).
+ A [ProgressBar] that uses textures to display fill percentage. Can be set to linear or radial mode.
</description>
<tutorials>
</tutorials>
@@ -148,28 +148,40 @@
</methods>
<members>
<member name="fill_mode" type="int" setter="set_fill_mode" getter="get_fill_mode">
+ 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]
</member>
<member name="radial_center_offset" type="Vector2" setter="set_radial_center_offset" getter="get_radial_center_offset">
+ The offset amount for radial mode.
</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.
</member>
<member name="radial_initial_angle" type="float" setter="set_radial_initial_angle" getter="get_radial_initial_angle">
+ Start angle for radial mode.
</member>
<member name="stretch_margin_bottom" type="int" setter="set_stretch_margin" getter="get_stretch_margin">
+ Nine-patch texture offset for bottom margin.
</member>
<member name="stretch_margin_left" type="int" setter="set_stretch_margin" getter="get_stretch_margin">
+ Nine-patch texture offset for left margin.
</member>
<member name="stretch_margin_right" type="int" setter="set_stretch_margin" getter="get_stretch_margin">
+ Nine-patch texture offset for right margin.
</member>
<member name="stretch_margin_top" type="int" setter="set_stretch_margin" getter="get_stretch_margin">
+ Nine-patch texture offset for top margin.
</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.
</member>
<member name="texture_progress" type="Texture" setter="set_progress_texture" getter="get_progress_texture">
+ The [Texture] used to display [code]value[/code].
</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.
</member>
</members>
<constants>
diff --git a/doc/classes/TextureRect.xml b/doc/classes/TextureRect.xml
index 6d137cb14c..af5626ae84 100644
--- a/doc/classes/TextureRect.xml
+++ b/doc/classes/TextureRect.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="TextureRect" inherits="Control" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Control that draws a texture.
+ Draws a sprite or a texture inside a User Interface. The texture can tile or not.
</brief_description>
<description>
- Control that draws a texture.
+ Use TextureRect to draw icons and sprites in your User Interfaces. To create panels and menu boxes, take a look at [NinePatchFrame]. Its Stretch Mode property controls the texture's scale and placement. It can scale, tile and stay centered inside its bounding rectangle. TextureRect is one of the 5 most common nodes to create game UI.
</description>
<tutorials>
</tutorials>
@@ -56,31 +56,39 @@
</methods>
<members>
<member name="expand" type="bool" setter="set_expand" getter="has_expand">
- If [code]true[/code] texture will expand to fit. Default value: [code]false[/code].
+ If [code]true[/code], the texture scales to fit its bounding rectangle. Default value: [code]false[/code].
</member>
<member name="stretch_mode" type="int" setter="set_stretch_mode" getter="get_stretch_mode" enum="TextureRect.StretchMode">
- Stretch mode of the texture. Use STRETCH_* constants as value.
+ Controls the texture's behavior when you resize the node's bounding rectangle. Set it to one of the [code]STRETCH_*[/code] constants. See the constants to learn more.
</member>
<member name="texture" type="Texture" setter="set_texture" getter="get_texture">
- The [Texture] resource for the node.
+ The node's [Texture] resource.
</member>
</members>
<constants>
<constant name="STRETCH_SCALE_ON_EXPAND" value="0">
+ Scale to fit the node's bounding rectangle, only if [code]expand[/code] is [code]true[/code]. Default [code]stretch_mode[/code], for backwards compatibility. Until you set [code]expand[/code] to [code]true[/code], the texture will behave like [code]STRETCH_KEEP[/code].
</constant>
<constant name="STRETCH_SCALE" value="1">
+ Scale to fit the node's bounding rectangle.
</constant>
<constant name="STRETCH_TILE" value="2">
+ Tile inside the node's bounding rectangle.
</constant>
<constant name="STRETCH_KEEP" value="3">
+ The texture keeps its original size and stays in the bounding rectangle's top-left corner.
</constant>
<constant name="STRETCH_KEEP_CENTERED" value="4">
+ The texture keeps its original size and stays centered in the node's bounding rectangle.
</constant>
<constant name="STRETCH_KEEP_ASPECT" value="5">
+ 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="6">
+ 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="7">
+ 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/TileMap.xml b/doc/classes/TileMap.xml
index e1a6c0b523..c44fa500cd 100644
--- a/doc/classes/TileMap.xml
+++ b/doc/classes/TileMap.xml
@@ -39,7 +39,7 @@
<method name="get_cellv" qualifiers="const">
<return type="int">
</return>
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<description>
Return the tile index of the cell referenced by a Vector2.
@@ -222,7 +222,7 @@
<method name="map_to_world" qualifiers="const">
<return type="Vector2">
</return>
- <argument index="0" name="mappos" type="Vector2">
+ <argument index="0" name="map_position" type="Vector2">
</argument>
<argument index="1" name="ignore_half_ofs" type="bool" default="false">
</argument>
@@ -264,7 +264,7 @@
<method name="set_cellv">
<return type="void">
</return>
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<argument index="1" name="tile" type="int">
</argument>
@@ -442,7 +442,7 @@
<method name="world_to_map" qualifiers="const">
<return type="Vector2">
</return>
- <argument index="0" name="worldpos" type="Vector2">
+ <argument index="0" name="world_position" type="Vector2">
</argument>
<description>
Return the tilemap (grid-based) coordinates corresponding to the absolute world position given as an argument.
diff --git a/doc/classes/TouchScreenButton.xml b/doc/classes/TouchScreenButton.xml
index bf8af20da9..8a96fa1454 100644
--- a/doc/classes/TouchScreenButton.xml
+++ b/doc/classes/TouchScreenButton.xml
@@ -173,5 +173,9 @@
</signal>
</signals>
<constants>
+ <constant name="VISIBILITY_ALWAYS" value="0">
+ </constant>
+ <constant name="VISIBILITY_TOUCHSCREEN_ONLY" value="1">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/Transform.xml b/doc/classes/Transform.xml
index d632eee70a..6780de1943 100644
--- a/doc/classes/Transform.xml
+++ b/doc/classes/Transform.xml
@@ -23,7 +23,7 @@
<argument index="3" name="origin" type="Vector3">
</argument>
<description>
- Construct the Transform from four [Vector3]. Each axis corresponds to local basis vectors (some of which may be scaled).
+ Constructs the Transform from four [Vector3]. Each axis corresponds to local basis vectors (some of which may be scaled).
</description>
</method>
<method name="Transform">
@@ -34,7 +34,7 @@
<argument index="1" name="origin" type="Vector3">
</argument>
<description>
- Construct the Transform from a [Basis] and [Vector3].
+ Constructs the Transform from a [Basis] and [Vector3].
</description>
</method>
<method name="Transform">
@@ -43,7 +43,7 @@
<argument index="0" name="from" type="Transform2D">
</argument>
<description>
- Construct the Transform from a [Transform2D].
+ Constructs the Transform from a [Transform2D].
</description>
</method>
<method name="Transform">
@@ -52,7 +52,7 @@
<argument index="0" name="from" type="Quat">
</argument>
<description>
- Construct the Transform from a [Quat]. The origin will be Vector3(0, 0, 0).
+ Constructs the Transform from a [Quat]. The origin will be Vector3(0, 0, 0).
</description>
</method>
<method name="Transform">
@@ -61,7 +61,7 @@
<argument index="0" name="from" type="Basis">
</argument>
<description>
- Construct the Transform from a [Basis]. The origin will be Vector3(0, 0, 0).
+ Constructs the Transform from a [Basis]. The origin will be Vector3(0, 0, 0).
</description>
</method>
<method name="affine_inverse">
@@ -79,7 +79,7 @@
<argument index="1" name="weight" type="float">
</argument>
<description>
- Interpolate to other Transform by weight amount (0-1).
+ Interpolates the transform to other Transform by weight amount (0-1).
</description>
</method>
<method name="inverse">
@@ -104,7 +104,7 @@
<return type="Transform">
</return>
<description>
- Returns a transfrom with the basis orthogonal (90 degrees), and normalized axis vectors.
+ Returns the transfrom with the basis orthogonal (90 degrees), and normalized axis vectors.
</description>
</method>
<method name="rotated">
@@ -115,7 +115,7 @@
<argument index="1" name="phi" type="float">
</argument>
<description>
- Rotate the transform around given axis by phi. The axis must be a normalized vector.
+ Rotates the transform around given axis by phi. The axis must be a normalized vector.
</description>
</method>
<method name="scaled">
@@ -124,7 +124,7 @@
<argument index="0" name="scale" type="Vector3">
</argument>
<description>
- Scale the transform by the specified 3D scaling factors.
+ Scales the transform by the specified 3D scaling factors.
</description>
</method>
<method name="translated">
@@ -133,7 +133,7 @@
<argument index="0" name="ofs" type="Vector3">
</argument>
<description>
- Translate the transform by the specified offset.
+ Translates the transform by the specified offset.
</description>
</method>
<method name="xform">
@@ -151,7 +151,7 @@
<argument index="0" name="v" type="var">
</argument>
<description>
- Inverse-transforms vector "v" by this transform.
+ Inverse-transforms the given vector "v" by this transform.
</description>
</method>
</methods>
diff --git a/doc/classes/Transform2D.xml b/doc/classes/Transform2D.xml
index b3b752c1da..a90013f922 100644
--- a/doc/classes/Transform2D.xml
+++ b/doc/classes/Transform2D.xml
@@ -38,7 +38,7 @@
</return>
<argument index="0" name="rot" type="float">
</argument>
- <argument index="1" name="pos" type="Vector2">
+ <argument index="1" name="position" type="Vector2">
</argument>
<description>
Constructs the [Transform2D] from rotation angle in radians and position [Vector2].
@@ -66,28 +66,28 @@
<argument index="0" name="v" type="var">
</argument>
<description>
- Inverse-transforms vector "v" by this transform basis (no translation).
+ Inverse-transforms the given vector "v" by this transform basis (no translation).
</description>
</method>
<method name="get_origin">
<return type="Vector2">
</return>
<description>
- Return the origin [Vector2] (translation).
+ Returns the origin [Vector2] (translation).
</description>
</method>
<method name="get_rotation">
<return type="float">
</return>
<description>
- Return the rotation (in radians).
+ Returns the rotation (in radians).
</description>
</method>
<method name="get_scale">
<return type="Vector2">
</return>
<description>
- Return the scale.
+ Returns the scale.
</description>
</method>
<method name="interpolate_with">
@@ -98,7 +98,7 @@
<argument index="1" name="weight" type="float">
</argument>
<description>
- Interpolate to other Transform2D by weight amount (0-1).
+ Interpolates the transform to other Transform2D by weight amount (0-1).
</description>
</method>
<method name="inverse">
@@ -112,7 +112,7 @@
<return type="Transform2D">
</return>
<description>
- Returns a transfrom with the basis orthogonal (90 degrees), and normalized axis vectors.
+ Returns the transfrom with the basis orthogonal (90 degrees), and normalized axis vectors.
</description>
</method>
<method name="rotated">
@@ -121,7 +121,7 @@
<argument index="0" name="phi" type="float">
</argument>
<description>
- Rotate the transform by phi.
+ Rotates the transform by phi.
</description>
</method>
<method name="scaled">
@@ -130,7 +130,7 @@
<argument index="0" name="scale" type="Vector2">
</argument>
<description>
- Scale the transform by the specified 2D scaling factors.
+ Scales the transform by the specified 2D scaling factors.
</description>
</method>
<method name="translated">
@@ -139,7 +139,7 @@
<argument index="0" name="offset" type="Vector2">
</argument>
<description>
- Translate the transform by the specified offset.
+ Translates the transform by the specified offset.
</description>
</method>
<method name="xform">
diff --git a/doc/classes/Tree.xml b/doc/classes/Tree.xml
index a92a51049b..82e85126cc 100644
--- a/doc/classes/Tree.xml
+++ b/doc/classes/Tree.xml
@@ -65,10 +65,10 @@
Get whether a right click can select items.
</description>
</method>
- <method name="get_column_at_pos" qualifiers="const">
+ <method name="get_column_at_position" qualifiers="const">
<return type="int">
</return>
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<description>
Get the column index under the given point.
@@ -113,10 +113,10 @@
Get the flags of the current drop mode.
</description>
</method>
- <method name="get_drop_section_at_pos" qualifiers="const">
+ <method name="get_drop_section_at_position" qualifiers="const">
<return type="int">
</return>
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<description>
</description>
@@ -146,10 +146,10 @@
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.
</description>
</method>
- <method name="get_item_at_pos" qualifiers="const">
+ <method name="get_item_at_position" qualifiers="const">
<return type="TreeItem">
</return>
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<description>
Get the tree item at the specified position (relative to the tree origin position).
@@ -342,7 +342,7 @@
</description>
</signal>
<signal name="empty_tree_rmb_selected">
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<description>
Emitted when the right mouse button is pressed if RMB selection is active and the tree is empty.
@@ -378,7 +378,7 @@
</description>
</signal>
<signal name="item_rmb_selected">
- <argument index="0" name="pos" type="Vector2">
+ <argument index="0" name="position" type="Vector2">
</argument>
<description>
Emitted when an item is selected with right mouse button.
diff --git a/doc/classes/TreeItem.xml b/doc/classes/TreeItem.xml
index 02c264cbff..d1e45bd10f 100644
--- a/doc/classes/TreeItem.xml
+++ b/doc/classes/TreeItem.xml
@@ -545,5 +545,11 @@
</constant>
<constant name="CELL_MODE_CUSTOM" value="5">
</constant>
+ <constant name="ALIGN_LEFT" value="0">
+ </constant>
+ <constant name="ALIGN_CENTER" value="1">
+ </constant>
+ <constant name="ALIGN_RIGHT" value="2">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/Tween.xml b/doc/classes/Tween.xml
index 790a82a60a..d291f44de3 100644
--- a/doc/classes/Tween.xml
+++ b/doc/classes/Tween.xml
@@ -8,7 +8,7 @@
Because it is easy to get it wrong, here is a quick usage example:
[codeblock]
var tween = get_node("Tween")
- tween.interpolate_property(get_node("Node2D_to_move"), "transform/pos", Vector2(0,0), Vector2(100,100), 1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
+ tween.interpolate_property(get_node("Node2D_to_move"), "transform/origin", Vector2(0,0), Vector2(100,100), 1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
tween.start()
[/codeblock]
Some of the methods of this class require a property name. You can get the property name by hovering over the property in the inspector of the editor.
diff --git a/doc/classes/UndoRedo.xml b/doc/classes/UndoRedo.xml
index 43e0ad7873..d450a8812e 100644
--- a/doc/classes/UndoRedo.xml
+++ b/doc/classes/UndoRedo.xml
@@ -108,6 +108,12 @@
Get the name of the current action.
</description>
</method>
+ <method name="get_max_steps" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="get_version" qualifiers="const">
<return type="int">
</return>
@@ -116,6 +122,26 @@
This is useful mostly to check if something changed from a saved version.
</description>
</method>
+ <method name="redo">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_max_steps">
+ <return type="void">
+ </return>
+ <argument index="0" name="max_steps" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="undo">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
</methods>
<constants>
<constant name="MERGE_DISABLE" value="0">
diff --git a/doc/classes/VideoPlayer.xml b/doc/classes/VideoPlayer.xml
index 7994c1b65a..57e417974e 100644
--- a/doc/classes/VideoPlayer.xml
+++ b/doc/classes/VideoPlayer.xml
@@ -39,7 +39,7 @@
Get the name of the video stream.
</description>
</method>
- <method name="get_stream_pos" qualifiers="const">
+ <method name="get_stream_position" qualifiers="const">
<return type="float">
</return>
<description>
diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml
index c12ec86cbb..2cf36ba69b 100644
--- a/doc/classes/Viewport.xml
+++ b/doc/classes/Viewport.xml
@@ -528,7 +528,7 @@
<method name="warp_mouse">
<return type="void">
</return>
- <argument index="0" name="to_pos" type="Vector2">
+ <argument index="0" name="to_position" type="Vector2">
</argument>
<description>
Warp the mouse to a position, relative to the viewport.
@@ -650,5 +650,19 @@
</constant>
<constant name="MSAA_16X" value="4">
</constant>
+ <constant name="USAGE_2D" value="0">
+ </constant>
+ <constant name="USAGE_2D_NO_SAMPLING" value="1">
+ </constant>
+ <constant name="USAGE_3D" value="2">
+ </constant>
+ <constant name="USAGE_3D_NO_EFFECTS" value="3">
+ </constant>
+ <constant name="CLEAR_MODE_ALWAYS" value="0">
+ </constant>
+ <constant name="CLEAR_MODE_NEVER" value="1">
+ </constant>
+ <constant name="CLEAR_MODE_ONLY_NEXT_FRAME" value="2">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/VisibilityNotifier.xml b/doc/classes/VisibilityNotifier.xml
index 4d76c7c927..816523fc27 100644
--- a/doc/classes/VisibilityNotifier.xml
+++ b/doc/classes/VisibilityNotifier.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisibilityNotifier" inherits="Spatial" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Detect when the node is visible on screen.
+ Detects when the node is visible on screen.
</brief_description>
<description>
- The VisibilityNotifier is used to notify when its bounding box enters the screen, is visible on the screen, or when it exits the screen.
+ The VisibilityNotifier detects when it is visible on the screen. It also notifies when its bounding rectangle enters or exits the screen or a [Camera]'s view.
</description>
<tutorials>
</tutorials>
@@ -15,14 +15,14 @@
<return type="Rect3">
</return>
<description>
- Return the visibility bounding box of the VisibilityNotifier.
+ Returns the bounding box of the VisibilityNotifier.
</description>
</method>
<method name="is_on_screen" qualifiers="const">
<return type="bool">
</return>
<description>
- Return true if any part of the bounding box is on the screen.
+ If [code]true[/code] the bounding box is on the screen.
</description>
</method>
<method name="set_aabb">
@@ -37,6 +37,7 @@
</methods>
<members>
<member name="aabb" type="Rect3" setter="set_aabb" getter="get_aabb">
+ The VisibilityNotifier's bounding box.
</member>
</members>
<signals>
diff --git a/doc/classes/VisibilityNotifier2D.xml b/doc/classes/VisibilityNotifier2D.xml
index 1058e3d6d4..86227a0277 100644
--- a/doc/classes/VisibilityNotifier2D.xml
+++ b/doc/classes/VisibilityNotifier2D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisibilityNotifier2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Detect when the node is visible on screen.
+ Detects when the node is visible on screen.
</brief_description>
<description>
- The VisibilityNotifier2D is used to notify when its bounding rectangle enters the screen, is visible on the screen, or when it exits the screen.
+ The VisibilityNotifier2D detects when it is visible on the screen. It also notifies when its bounding rectangle enters or exits the screen or a viewport.
</description>
<tutorials>
</tutorials>
@@ -15,14 +15,14 @@
<return type="Rect2">
</return>
<description>
- Return the visibility bounding rectangle of the VisibilityNotifier2D.
+ Returns the bounding rectangle of the VisibilityNotifier2D.
</description>
</method>
<method name="is_on_screen" qualifiers="const">
<return type="bool">
</return>
<description>
- Return true if any part of the bounding rectangle is on the screen.
+ If [code]true[/code] the bounding rectangle is on the screen.
</description>
</method>
<method name="set_rect">
@@ -37,6 +37,7 @@
</methods>
<members>
<member name="rect" type="Rect2" setter="set_rect" getter="get_rect">
+ The VisibilityNotifier2D's bounding rectangle.
</member>
</members>
<signals>
diff --git a/doc/classes/VisualScript.xml b/doc/classes/VisualScript.xml
index 0875aafcff..6473b074d3 100644
--- a/doc/classes/VisualScript.xml
+++ b/doc/classes/VisualScript.xml
@@ -34,7 +34,7 @@
</argument>
<argument index="2" name="node" type="VisualScriptNode">
</argument>
- <argument index="3" name="pos" type="Vector2" default="Vector2( 0, 0 )">
+ <argument index="3" name="position" type="Vector2" default="Vector2( 0, 0 )">
</argument>
<description>
</description>
@@ -197,7 +197,7 @@
<description>
</description>
</method>
- <method name="get_node_pos" qualifiers="const">
+ <method name="get_node_position" qualifiers="const">
<return type="Vector2">
</return>
<argument index="0" name="func" type="String">
@@ -405,14 +405,14 @@
<description>
</description>
</method>
- <method name="set_node_pos">
+ <method name="set_node_position">
<return type="void">
</return>
<argument index="0" name="func" type="String">
</argument>
<argument index="1" name="id" type="int">
</argument>
- <argument index="2" name="pos" type="Vector2">
+ <argument index="2" name="position" type="Vector2">
</argument>
<description>
</description>
diff --git a/doc/classes/VisualScriptBuiltinFunc.xml b/doc/classes/VisualScriptBuiltinFunc.xml
index eb9af69ea9..a88633749e 100644
--- a/doc/classes/VisualScriptBuiltinFunc.xml
+++ b/doc/classes/VisualScriptBuiltinFunc.xml
@@ -29,5 +29,121 @@
</member>
</members>
<constants>
+ <constant name="MATH_SIN" value="0">
+ </constant>
+ <constant name="MATH_COS" value="1">
+ </constant>
+ <constant name="MATH_TAN" value="2">
+ </constant>
+ <constant name="MATH_SINH" value="3">
+ </constant>
+ <constant name="MATH_COSH" value="4">
+ </constant>
+ <constant name="MATH_TANH" value="5">
+ </constant>
+ <constant name="MATH_ASIN" value="6">
+ </constant>
+ <constant name="MATH_ACOS" value="7">
+ </constant>
+ <constant name="MATH_ATAN" value="8">
+ </constant>
+ <constant name="MATH_ATAN2" value="9">
+ </constant>
+ <constant name="MATH_SQRT" value="10">
+ </constant>
+ <constant name="MATH_FMOD" value="11">
+ </constant>
+ <constant name="MATH_FPOSMOD" value="12">
+ </constant>
+ <constant name="MATH_FLOOR" value="13">
+ </constant>
+ <constant name="MATH_CEIL" value="14">
+ </constant>
+ <constant name="MATH_ROUND" value="15">
+ </constant>
+ <constant name="MATH_ABS" value="16">
+ </constant>
+ <constant name="MATH_SIGN" value="17">
+ </constant>
+ <constant name="MATH_POW" value="18">
+ </constant>
+ <constant name="MATH_LOG" value="19">
+ </constant>
+ <constant name="MATH_EXP" value="20">
+ </constant>
+ <constant name="MATH_ISNAN" value="21">
+ </constant>
+ <constant name="MATH_ISINF" value="22">
+ </constant>
+ <constant name="MATH_EASE" value="23">
+ </constant>
+ <constant name="MATH_DECIMALS" value="24">
+ </constant>
+ <constant name="MATH_STEPIFY" value="25">
+ </constant>
+ <constant name="MATH_LERP" value="26">
+ </constant>
+ <constant name="MATH_DECTIME" value="27">
+ </constant>
+ <constant name="MATH_RANDOMIZE" value="28">
+ </constant>
+ <constant name="MATH_RAND" value="29">
+ </constant>
+ <constant name="MATH_RANDF" value="30">
+ </constant>
+ <constant name="MATH_RANDOM" value="31">
+ </constant>
+ <constant name="MATH_SEED" value="32">
+ </constant>
+ <constant name="MATH_RANDSEED" value="33">
+ </constant>
+ <constant name="MATH_DEG2RAD" value="34">
+ </constant>
+ <constant name="MATH_RAD2DEG" value="35">
+ </constant>
+ <constant name="MATH_LINEAR2DB" value="36">
+ </constant>
+ <constant name="MATH_DB2LINEAR" value="37">
+ </constant>
+ <constant name="LOGIC_MAX" value="38">
+ </constant>
+ <constant name="LOGIC_MIN" value="39">
+ </constant>
+ <constant name="LOGIC_CLAMP" value="40">
+ </constant>
+ <constant name="LOGIC_NEAREST_PO2" value="41">
+ </constant>
+ <constant name="OBJ_WEAKREF" value="42">
+ </constant>
+ <constant name="FUNC_FUNCREF" value="43">
+ </constant>
+ <constant name="TYPE_CONVERT" value="44">
+ </constant>
+ <constant name="TYPE_OF" value="45">
+ </constant>
+ <constant name="TYPE_EXISTS" value="46">
+ </constant>
+ <constant name="TEXT_CHAR" value="47">
+ </constant>
+ <constant name="TEXT_STR" value="48">
+ </constant>
+ <constant name="TEXT_PRINT" value="49">
+ </constant>
+ <constant name="TEXT_PRINTERR" value="50">
+ </constant>
+ <constant name="TEXT_PRINTRAW" value="51">
+ </constant>
+ <constant name="VAR_TO_STR" value="52">
+ </constant>
+ <constant name="STR_TO_VAR" value="53">
+ </constant>
+ <constant name="VAR_TO_BYTES" value="54">
+ </constant>
+ <constant name="BYTES_TO_VAR" value="55">
+ </constant>
+ <constant name="COLORN" value="56">
+ </constant>
+ <constant name="FUNC_MAX" value="57">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/VisualScriptFunctionCall.xml b/doc/classes/VisualScriptFunctionCall.xml
index 9a56831253..36c808afce 100644
--- a/doc/classes/VisualScriptFunctionCall.xml
+++ b/doc/classes/VisualScriptFunctionCall.xml
@@ -183,5 +183,17 @@
</constant>
<constant name="CALL_MODE_BASIC_TYPE" value="3">
</constant>
+ <constant name="CALL_MODE_SINGLETON" value="4">
+ </constant>
+ <constant name="RPC_DISABLED" value="0">
+ </constant>
+ <constant name="RPC_RELIABLE" value="1">
+ </constant>
+ <constant name="RPC_UNRELIABLE" value="2">
+ </constant>
+ <constant name="RPC_RELIABLE_TO_ID" value="3">
+ </constant>
+ <constant name="RPC_UNRELIABLE_TO_ID" value="4">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/VisualScriptInputAction.xml b/doc/classes/VisualScriptInputAction.xml
index b0f7827024..b555a0228b 100644
--- a/doc/classes/VisualScriptInputAction.xml
+++ b/doc/classes/VisualScriptInputAction.xml
@@ -45,5 +45,13 @@
</member>
</members>
<constants>
+ <constant name="MODE_PRESSED" value="0">
+ </constant>
+ <constant name="MODE_RELEASED" value="1">
+ </constant>
+ <constant name="MODE_JUST_PRESSED" value="2">
+ </constant>
+ <constant name="MODE_JUST_RELEASED" value="3">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/VisualScriptMathConstant.xml b/doc/classes/VisualScriptMathConstant.xml
index 8e0436edfa..1ef7d71e10 100644
--- a/doc/classes/VisualScriptMathConstant.xml
+++ b/doc/classes/VisualScriptMathConstant.xml
@@ -29,5 +29,23 @@
</member>
</members>
<constants>
+ <constant name="MATH_CONSTANT_ONE" value="0">
+ </constant>
+ <constant name="MATH_CONSTANT_PI" value="1">
+ </constant>
+ <constant name="MATH_CONSTANT_2PI" value="2">
+ </constant>
+ <constant name="MATH_CONSTANT_HALF_PI" value="3">
+ </constant>
+ <constant name="MATH_CONSTANT_E" value="4">
+ </constant>
+ <constant name="MATH_CONSTANT_SQRT2" value="5">
+ </constant>
+ <constant name="MATH_CONSTANT_INF" value="6">
+ </constant>
+ <constant name="MATH_CONSTANT_NAN" value="7">
+ </constant>
+ <constant name="MATH_CONSTANT_MAX" value="8">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/VisualScriptPropertySet.xml b/doc/classes/VisualScriptPropertySet.xml
index a129cc36f8..88d47a7463 100644
--- a/doc/classes/VisualScriptPropertySet.xml
+++ b/doc/classes/VisualScriptPropertySet.xml
@@ -149,5 +149,29 @@
</constant>
<constant name="CALL_MODE_INSTANCE" value="2">
</constant>
+ <constant name="CALL_MODE_BASIC_TYPE" value="3">
+ </constant>
+ <constant name="ASSIGN_OP_NONE" value="0">
+ </constant>
+ <constant name="ASSIGN_OP_ADD" value="1">
+ </constant>
+ <constant name="ASSIGN_OP_SUB" value="2">
+ </constant>
+ <constant name="ASSIGN_OP_MUL" value="3">
+ </constant>
+ <constant name="ASSIGN_OP_DIV" value="4">
+ </constant>
+ <constant name="ASSIGN_OP_MOD" value="5">
+ </constant>
+ <constant name="ASSIGN_OP_SHIFT_LEFT" value="6">
+ </constant>
+ <constant name="ASSIGN_OP_SHIFT_RIGHT" value="7">
+ </constant>
+ <constant name="ASSIGN_OP_BIT_AND" value="8">
+ </constant>
+ <constant name="ASSIGN_OP_BIT_OR" value="9">
+ </constant>
+ <constant name="ASSIGN_OP_BIT_XOR" value="10">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/XMLParser.xml b/doc/classes/XMLParser.xml
index 6ab84ef345..bb9599e273 100644
--- a/doc/classes/XMLParser.xml
+++ b/doc/classes/XMLParser.xml
@@ -133,7 +133,7 @@
<method name="seek">
<return type="int" enum="Error">
</return>
- <argument index="0" name="pos" type="int">
+ <argument index="0" name="position" type="int">
</argument>
<description>
Move the buffer cursor to a certain offset (since the beginning) and read the next node there. This returns an error code.
diff --git a/doc/tools/doc_status.py b/doc/tools/doc_status.py
index 1386e91ce1..6b6b794f11 100644
--- a/doc/tools/doc_status.py
+++ b/doc/tools/doc_status.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
+import os
import sys
import re
import math
@@ -220,6 +221,21 @@ class ClassStatus:
def generate_for_class(c):
status = ClassStatus()
status.name = c.attrib['name']
+
+ # setgets do not count
+ methods = []
+ for tag in list(c):
+ if tag.tag in ['methods']:
+ for sub_tag in list(tag):
+ methods.append(sub_tag.find('name'))
+ if tag.tag in ['members']:
+ for sub_tag in list(tag):
+ try:
+ methods.remove(sub_tag.find('setter'))
+ methods.remove(sub_tag.find('getter'))
+ except:
+ pass
+
for tag in list(c):
if tag.tag == 'brief_description':
@@ -230,13 +246,16 @@ class ClassStatus:
elif tag.tag in ['methods', 'signals']:
for sub_tag in list(tag):
- descr = sub_tag.find('description')
- status.progresses[tag.tag].increment(len(descr.text.strip()) > 0)
-
+ if sub_tag.find('name') in methods or tag.tag == 'signals':
+ descr = sub_tag.find('description')
+ status.progresses[tag.tag].increment(len(descr.text.strip()) > 0)
elif tag.tag in ['constants', 'members']:
for sub_tag in list(tag):
status.progresses[tag.tag].increment(len(sub_tag.text.strip()) > 0)
+ elif tag.tag in ['tutorials', 'demos']:
+ pass # Ignore those tags for now
+
elif tag.tag in ['theme_items']:
pass # Ignore those tags, since they seem to lack description at all
@@ -252,6 +271,7 @@ class ClassStatus:
input_file_list = []
input_class_list = []
+merged_file = ""
for arg in sys.argv[1:]:
if arg.startswith('--'):
@@ -259,8 +279,10 @@ for arg in sys.argv[1:]:
elif arg.startswith('-'):
for f in arg[1:]:
flags[f] = not flags[f]
- elif arg.endswith('.xml'):
- input_file_list.append(arg)
+ 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)
@@ -287,10 +309,9 @@ if flags['u']:
if len(input_file_list) < 1 or flags['h']:
if not flags['h']:
- print(color('section', 'Invalid usage') + ': At least one classes.xml file is required')
- print(color('section', 'Usage') + ': doc_status.py [flags] <classes.xml> [class names]')
+ print(color('section', 'Invalid usage') + ': Please specify a classes directory')
+ print(color('section', 'Usage') + ': doc_status.py [flags] <classes_dir> [class names]')
print('\t< and > signify required parameters, while [ and ] signify optional parameters.')
- print('\tNote that you can give more than one classes file, in which case they will be merged on-the-fly.')
print(color('section', 'Available flags') + ':')
possible_synonym_list = list(long_flags)
possible_synonym_list.sort()
@@ -327,11 +348,10 @@ for file in input_file_list:
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()
@@ -344,7 +364,7 @@ if len(input_class_list) < 1:
################################################################################
table = [table_column_names]
-table_row_chars = '+- '
+table_row_chars = '| - '
table_column_chars = '|'
total_status = ClassStatus('Total')
@@ -406,7 +426,7 @@ for row in table:
divider_string = table_row_chars[0]
for cell_i in range(len(table[0])):
- divider_string += table_row_chars[1] * (table_column_sizes[cell_i] + 2) + table_row_chars[0]
+ divider_string += table_row_chars[1] + table_row_chars[2] * (table_column_sizes[cell_i]) + table_row_chars[1] + table_row_chars[0]
print(divider_string)
for row_i, row in enumerate(table):
@@ -414,9 +434,9 @@ for row_i, row in enumerate(table):
for cell_i, cell in enumerate(row):
padding_needed = table_column_sizes[cell_i] - nonescape_len(cell) + 2
if cell_i == 0:
- row_string += table_row_chars[2] + cell + table_row_chars[2] * (padding_needed - 1)
+ row_string += table_row_chars[3] + cell + table_row_chars[3] * (padding_needed - 1)
else:
- row_string += table_row_chars[2] * math.floor(padding_needed / 2) + cell + table_row_chars[2] * math.ceil((padding_needed / 2))
+ row_string += table_row_chars[3] * math.floor(padding_needed / 2) + cell + table_row_chars[3] * math.ceil((padding_needed / 2))
row_string += table_column_chars
print(row_string)
diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h
index b3fd6fa2a0..8669c42a7a 100644
--- a/drivers/gles3/rasterizer_scene_gles3.h
+++ b/drivers/gles3/rasterizer_scene_gles3.h
@@ -806,7 +806,7 @@ public:
void _render_list(RenderList::Element **p_elements, int p_element_count, const Transform &p_view_transform, const CameraMatrix &p_projection, GLuint p_base_env, bool p_reverse_cull, bool p_alpha_pass, bool p_shadow, bool p_directional_add, bool p_directional_shadows);
- _FORCE_INLINE_ void _add_geometry(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, int p_material, bool p_depth_passs);
+ _FORCE_INLINE_ void _add_geometry(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, int p_material, bool p_depth_pass);
_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);
diff --git a/drivers/rtaudio/audio_driver_rtaudio.cpp b/drivers/rtaudio/audio_driver_rtaudio.cpp
index ae5fdd28b6..a184c9e9cf 100644
--- a/drivers/rtaudio/audio_driver_rtaudio.cpp
+++ b/drivers/rtaudio/audio_driver_rtaudio.cpp
@@ -143,7 +143,7 @@ Error AudioDriverRtAudio::init() {
}
}
- return OK;
+ return active ? OK : ERR_UNAVAILABLE;
}
int AudioDriverRtAudio::get_mix_rate() const {
diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp
index 45ea654bad..e7054e11a3 100644
--- a/drivers/unix/dir_access_unix.cpp
+++ b/drivers/unix/dir_access_unix.cpp
@@ -183,17 +183,18 @@ void DirAccessUnix::list_dir_end() {
_cisdir = false;
}
-#ifdef HAVE_MNTENT
+#if defined(HAVE_MNTENT) && defined(X11_ENABLED)
static bool _filter_drive(struct mntent *mnt) {
// Ignore devices that don't point to /dev
if (strncmp(mnt->mnt_fsname, "/dev", 4) != 0) {
return false;
}
- // Accept devices mounted at /media, /mnt or /home
+ // Accept devices mounted at common locations
if (strncmp(mnt->mnt_dir, "/media", 6) == 0 ||
strncmp(mnt->mnt_dir, "/mnt", 4) == 0 ||
- strncmp(mnt->mnt_dir, "/home", 5) == 0) {
+ strncmp(mnt->mnt_dir, "/home", 5) == 0 ||
+ strncmp(mnt->mnt_dir, "/run/media", 10) == 0) {
return true;
}
@@ -204,7 +205,7 @@ static bool _filter_drive(struct mntent *mnt) {
static void _get_drives(List<String> *list) {
-#ifdef HAVE_MNTENT
+#if defined(HAVE_MNTENT) && defined(X11_ENABLED)
// Check /etc/mtab for the list of mounted partitions
FILE *mtab = setmntent("/etc/mtab", "r");
if (mtab) {
diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp
index 80565c5b02..649f874cf4 100644
--- a/drivers/unix/file_access_unix.cpp
+++ b/drivers/unix/file_access_unix.cpp
@@ -168,7 +168,7 @@ void FileAccessUnix::seek_end(int64_t p_position) {
check_errors();
}
-size_t FileAccessUnix::get_pos() const {
+size_t FileAccessUnix::get_position() const {
ERR_FAIL_COND_V(!f, 0);
@@ -274,6 +274,15 @@ uint64_t FileAccessUnix::_get_modified_time(const String &p_file) {
};
}
+Error FileAccessUnix::_chmod(const String &p_path, int p_mod) {
+ int err = chmod(p_path.utf8().get_data(), p_mod);
+ if (!err) {
+ return OK;
+ }
+
+ return FAILED;
+}
+
FileAccess *FileAccessUnix::create_libc() {
return memnew(FileAccessUnix);
diff --git a/drivers/unix/file_access_unix.h b/drivers/unix/file_access_unix.h
index 6e5110431f..e2848e4128 100644
--- a/drivers/unix/file_access_unix.h
+++ b/drivers/unix/file_access_unix.h
@@ -62,7 +62,7 @@ public:
virtual void seek(size_t p_position); ///< seek to a given position
virtual void seek_end(int64_t p_position = 0); ///< seek from the end of file
- virtual size_t get_pos() const; ///< get position in the file
+ virtual size_t get_position() const; ///< get position in the file
virtual size_t get_len() const; ///< get size of the file
virtual bool eof_reached() const; ///< reading passed EOF
@@ -78,6 +78,8 @@ public:
virtual uint64_t _get_modified_time(const String &p_file);
+ virtual Error _chmod(const String &p_path, int p_mod);
+
FileAccessUnix();
virtual ~FileAccessUnix();
};
diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp
index fe2069089c..d128b58244 100644
--- a/drivers/windows/file_access_windows.cpp
+++ b/drivers/windows/file_access_windows.cpp
@@ -156,7 +156,7 @@ void FileAccessWindows::seek_end(int64_t p_position) {
if (fseek(f, p_position, SEEK_END))
check_errors();
}
-size_t FileAccessWindows::get_pos() const {
+size_t FileAccessWindows::get_position() const {
size_t aux_position = 0;
aux_position = ftell(f);
@@ -169,9 +169,9 @@ size_t FileAccessWindows::get_len() const {
ERR_FAIL_COND_V(!f, 0);
- size_t pos = get_pos();
+ size_t pos = get_position();
fseek(f, 0, SEEK_END);
- int size = get_pos();
+ int size = get_position();
fseek(f, pos, SEEK_SET);
return size;
diff --git a/drivers/windows/file_access_windows.h b/drivers/windows/file_access_windows.h
index 6956e7855a..15cbdca739 100644
--- a/drivers/windows/file_access_windows.h
+++ b/drivers/windows/file_access_windows.h
@@ -54,7 +54,7 @@ public:
virtual void seek(size_t p_position); ///< seek to a given position
virtual void seek_end(int64_t p_position = 0); ///< seek from the end of file
- virtual size_t get_pos() const; ///< get position in the file
+ virtual size_t get_position() const; ///< get position in the file
virtual size_t get_len() const; ///< get size of the file
virtual bool eof_reached() const; ///< reading passed EOF
diff --git a/editor/SCsub b/editor/SCsub
index 839d8e74c1..315865ad32 100644
--- a/editor/SCsub
+++ b/editor/SCsub
@@ -41,7 +41,7 @@ def make_doc_header(target, source, env):
src = s.srcnode().abspath
f = open_utf8(src, "r")
content = f.read()
- buf+=content
+ buf+=content
buf = encode_utf8(docbegin + buf + docend)
decomp_size = len(buf)
@@ -385,13 +385,13 @@ def make_license_header(target, source, env):
def _make_doc_data_class_path(to_path):
- g = open_utf8(os.path.join(to_path,"doc_data_class_path.gen.h"), "wb")
+ g = open_utf8(os.path.join(to_path,"doc_data_class_path.gen.h"), "w")
g.write("static const int _doc_data_class_path_count="+str(len(env.doc_class_path))+";\n")
g.write("struct _DocDataClassPath { const char* name; const char* path; };\n")
g.write("static const _DocDataClassPath _doc_data_class_paths["+str(len(env.doc_class_path)+1)+"]={\n");
for c in env.doc_class_path:
- g.write("{\""+c+"\",\""+env.doc_class_path[c]+"\"},\n")
+ g.write("{\""+c+"\",\""+env.doc_class_path[c]+"\"},\n")
g.write("{NULL,NULL}\n")
g.write("};\n")
@@ -414,7 +414,7 @@ if (env["tools"] == "yes"):
docs=[]
print("cdir is: "+env.Dir('#').abspath)
for f in os.listdir(os.path.join(env.Dir('#').abspath,"doc/classes")):
- docs.append("#doc/classes/"+f)
+ docs.append("#doc/classes/"+f)
_make_doc_data_class_path(os.path.join(env.Dir('#').abspath,"editor/doc"))
diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp
index 47360ff7fb..2965003645 100644
--- a/editor/animation_editor.cpp
+++ b/editor/animation_editor.cpp
@@ -322,7 +322,7 @@ public:
undo_redo->add_do_method(animation.ptr(), "track_remove_key", track, key);
undo_redo->add_do_method(animation.ptr(), "track_insert_key", track, new_time, val, trans);
undo_redo->add_do_method(this, "_key_ofs_changed", animation, key_ofs, new_time);
- undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_pos", track, new_time);
+ undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", track, new_time);
undo_redo->add_undo_method(animation.ptr(), "track_insert_key", track, key_ofs, val, trans);
undo_redo->add_undo_method(this, "_key_ofs_changed", animation, new_time, key_ofs);
@@ -563,8 +563,8 @@ public:
case Animation::TYPE_TRANSFORM: {
- p_list->push_back(PropertyInfo(Variant::VECTOR3, "loc"));
- p_list->push_back(PropertyInfo(Variant::QUAT, "rot"));
+ p_list->push_back(PropertyInfo(Variant::VECTOR3, "location"));
+ p_list->push_back(PropertyInfo(Variant::QUAT, "rotation"));
p_list->push_back(PropertyInfo(Variant::VECTOR3, "scale"));
} break;
@@ -719,7 +719,7 @@ void AnimationKeyEditor::_anim_duplicate_keys(bool transpose) {
int existing_idx = animation->track_find_key(dst_track, dst_time, true);
undo_redo->add_do_method(animation.ptr(), "track_insert_key", dst_track, dst_time, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
- undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_pos", dst_track, dst_time);
+ undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", dst_track, dst_time);
Pair<int, float> p;
p.first = dst_track;
@@ -1016,7 +1016,7 @@ float AnimationKeyEditor::_get_zoom_scale() const {
}
}
-void AnimationKeyEditor::_track_pos_draw() {
+void AnimationKeyEditor::_track_position_draw() {
if (!animation.is_valid()) {
return;
@@ -2301,8 +2301,8 @@ void AnimationKeyEditor::_track_editor_gui_input(const Ref<InputEvent> &p_input)
if (tt == Animation::TYPE_TRANSFORM) {
Dictionary d;
- d["loc"] = Vector3();
- d["rot"] = Quat();
+ d["location"] = Vector3();
+ d["rotation"] = Quat();
d["scale"] = Vector3();
newval = d;
@@ -2337,7 +2337,7 @@ void AnimationKeyEditor::_track_editor_gui_input(const Ref<InputEvent> &p_input)
undo_redo->create_action(TTR("Anim Add Key"));
undo_redo->add_do_method(animation.ptr(), "track_insert_key", idx, pos, newval, 1);
- undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_pos", idx, pos);
+ undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", idx, pos);
if (existing != -1) {
Variant v = animation->track_get_key_value(idx, existing);
@@ -2506,7 +2506,7 @@ void AnimationKeyEditor::_track_editor_gui_input(const Ref<InputEvent> &p_input)
if (selection.has(sk))
continue; //already in selection, don't save
- undo_redo->add_do_method(animation.ptr(), "track_remove_key_at_pos", E->key().track, newtime);
+ undo_redo->add_do_method(animation.ptr(), "track_remove_key_at_position", E->key().track, newtime);
_AnimMoveRestore amr;
amr.key = animation->track_get_key_value(E->key().track, idx);
@@ -2536,7 +2536,7 @@ void AnimationKeyEditor::_track_editor_gui_input(const Ref<InputEvent> &p_input)
if (newpos<0)
continue; //no remove what no inserted
*/
- undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_pos", E->key().track, newpos);
+ undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", E->key().track, newpos);
}
// 5-(undo) reinsert keys
@@ -2753,10 +2753,10 @@ void AnimationKeyEditor::_track_editor_gui_input(const Ref<InputEvent> &p_input)
case Animation::TYPE_TRANSFORM: {
Dictionary d = animation->track_get_key_value(idx, mouse_over.over_key);
- if (d.has("loc"))
- text += "loc: " + String(d["loc"]) + "\n";
- if (d.has("rot"))
- text += "rot: " + String(d["rot"]) + "\n";
+ if (d.has("location"))
+ text += "location: " + String(d["location"]) + "\n";
+ if (d.has("rotation"))
+ text += "rot: " + String(d["rotation"]) + "\n";
if (d.has("scale"))
text += "scale: " + String(d["scale"]) + "\n";
} break;
@@ -2898,10 +2898,6 @@ void AnimationKeyEditor::_notification(int p_what) {
zoomicon->set_custom_minimum_size(Size2(24 * EDSCALE, 0));
zoomicon->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED);
- menu_add_track->get_popup()->add_icon_item(get_icon("KeyValue", "EditorIcons"), "Add Normal Track", ADD_TRACK_MENU_ADD_VALUE_TRACK);
- menu_add_track->get_popup()->add_icon_item(get_icon("KeyXform", "EditorIcons"), "Add Transform Track", ADD_TRACK_MENU_ADD_TRANSFORM_TRACK);
- menu_add_track->get_popup()->add_icon_item(get_icon("KeyCall", "EditorIcons"), "Add Call Func Track", ADD_TRACK_MENU_ADD_CALL_TRACK);
-
menu_track->set_icon(get_icon("Tools", "EditorIcons"));
menu_track->get_popup()->add_item(TTR("Scale Selection"), TRACK_MENU_SCALE);
menu_track->get_popup()->add_item(TTR("Scale From Cursor"), TRACK_MENU_SCALE_PIVOT);
@@ -3363,9 +3359,9 @@ int AnimationKeyEditor::_confirm_insert(InsertData p_id, int p_last_track) {
Transform tr = p_id.value;
Dictionary d;
- d["loc"] = tr.origin;
+ d["location"] = tr.origin;
d["scale"] = tr.basis.get_scale();
- d["rot"] = Quat(tr.basis); //.orthonormalized();
+ d["rotation"] = Quat(tr.basis); //.orthonormalized();
value = d;
} break;
default: {}
@@ -3380,7 +3376,7 @@ int AnimationKeyEditor::_confirm_insert(InsertData p_id, int p_last_track) {
p_last_track++;
} else {
- undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_pos", p_id.track_idx, time);
+ undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", p_id.track_idx, time);
int existing = animation->track_find_key(p_id.track_idx, time, true);
if (existing != -1) {
Variant v = animation->track_get_key_value(p_id.track_idx, existing);
@@ -3455,7 +3451,7 @@ void AnimationKeyEditor::_create_value_item(int p_type) {
Variant::CallError ce;
Variant v = Variant::construct(Variant::Type(p_type), NULL, 0, ce);
undo_redo->add_do_method(animation.ptr(), "track_insert_key", cvi_track, cvi_pos, v);
- undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_pos", cvi_track, cvi_pos);
+ undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", cvi_track, cvi_pos);
int existing = animation->track_find_key(cvi_track, cvi_pos, true);
@@ -3590,7 +3586,7 @@ void AnimationKeyEditor::_scale() {
if (selection.has(sk))
continue; //already in selection, don't save
- undo_redo->add_do_method(animation.ptr(), "track_remove_key_at_pos", E->key().track, newtime);
+ undo_redo->add_do_method(animation.ptr(), "track_remove_key_at_position", E->key().track, newtime);
_AnimMoveRestore amr;
amr.key = animation->track_get_key_value(E->key().track, idx);
@@ -3613,7 +3609,7 @@ void AnimationKeyEditor::_scale() {
for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
float newpos = _NEW_POS(E->get().pos);
- undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_pos", E->key().track, newpos);
+ undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", E->key().track, newpos);
}
// 5-(undo) reinsert keys
@@ -3700,7 +3696,7 @@ void AnimationKeyEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_menu_track"), &AnimationKeyEditor::_menu_track);
ClassDB::bind_method(D_METHOD("_clear_selection_for_anim"), &AnimationKeyEditor::_clear_selection_for_anim);
ClassDB::bind_method(D_METHOD("_select_at_anim"), &AnimationKeyEditor::_select_at_anim);
- ClassDB::bind_method(D_METHOD("_track_pos_draw"), &AnimationKeyEditor::_track_pos_draw);
+ ClassDB::bind_method(D_METHOD("_track_position_draw"), &AnimationKeyEditor::_track_position_draw);
ClassDB::bind_method(D_METHOD("_insert_delay"), &AnimationKeyEditor::_insert_delay);
ClassDB::bind_method(D_METHOD("_step_changed"), &AnimationKeyEditor::_step_changed);
@@ -3719,7 +3715,7 @@ void AnimationKeyEditor::_bind_methods() {
ADD_SIGNAL(MethodInfo("resource_selected", PropertyInfo(Variant::OBJECT, "res"), PropertyInfo(Variant::STRING, "prop")));
ADD_SIGNAL(MethodInfo("keying_changed"));
- ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::REAL, "pos"), PropertyInfo(Variant::BOOL, "drag")));
+ ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::REAL, "position"), PropertyInfo(Variant::BOOL, "drag")));
ADD_SIGNAL(MethodInfo("animation_len_changed", PropertyInfo(Variant::REAL, "len")));
ADD_SIGNAL(MethodInfo("animation_step_changed", PropertyInfo(Variant::REAL, "step")));
ADD_SIGNAL(MethodInfo("key_edited", PropertyInfo(Variant::INT, "track"), PropertyInfo(Variant::INT, "key")));
@@ -3817,6 +3813,9 @@ AnimationKeyEditor::AnimationKeyEditor() {
hb->add_child(menu_add_track);
menu_add_track->get_popup()->connect("id_pressed", this, "_menu_add_track");
menu_add_track->set_tooltip(TTR("Add new tracks."));
+ menu_add_track->get_popup()->add_icon_item(get_icon("KeyValue", "EditorIcons"), "Add Normal Track", ADD_TRACK_MENU_ADD_VALUE_TRACK);
+ menu_add_track->get_popup()->add_icon_item(get_icon("KeyXform", "EditorIcons"), "Add Transform Track", ADD_TRACK_MENU_ADD_TRANSFORM_TRACK);
+ menu_add_track->get_popup()->add_icon_item(get_icon("KeyCall", "EditorIcons"), "Add Call Func Track", ADD_TRACK_MENU_ADD_CALL_TRACK);
move_up_button = memnew(ToolButton);
hb->add_child(move_up_button);
@@ -3916,7 +3915,7 @@ AnimationKeyEditor::AnimationKeyEditor() {
track_pos->set_area_as_parent_rect();
track_pos->set_mouse_filter(MOUSE_FILTER_IGNORE);
track_editor->add_child(track_pos);
- track_pos->connect("draw", this, "_track_pos_draw");
+ track_pos->connect("draw", this, "_track_position_draw");
select_anim_warning = memnew(Label);
track_editor->add_child(select_anim_warning);
@@ -3934,7 +3933,7 @@ AnimationKeyEditor::AnimationKeyEditor() {
key_editor_tab = memnew(TabContainer);
key_editor_tab->set_tab_align(TabContainer::ALIGN_LEFT);
hb->add_child(key_editor_tab);
- key_editor_tab->set_custom_minimum_size(Size2(200, 0));
+ key_editor_tab->set_custom_minimum_size(Size2(200, 0) * EDSCALE);
key_editor = memnew(PropertyEditor);
key_editor->set_area_as_parent_rect();
@@ -4052,8 +4051,6 @@ AnimationKeyEditor::AnimationKeyEditor() {
cleanup_dialog->connect("confirmed", this, "_menu_track", varray(TRACK_MENU_CLEAN_UP_CONFIRM));
- add_constant_override("separation", get_constant("separation", "VBoxContainer"));
-
track_editor->set_clip_contents(true);
}
diff --git a/editor/animation_editor.h b/editor/animation_editor.h
index c16072502b..8a89dc1a1c 100644
--- a/editor/animation_editor.h
+++ b/editor/animation_editor.h
@@ -273,7 +273,7 @@ class AnimationKeyEditor : public VBoxContainer {
void _track_editor_draw();
void _track_editor_gui_input(const Ref<InputEvent> &p_input);
- void _track_pos_draw();
+ void _track_position_draw();
void _track_name_changed(const String &p_name);
void _track_menu_selected(int p_idx);
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 8c153d2745..0e77d2097e 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -367,7 +367,7 @@ void FindReplaceBar::_show_search() {
if (!get_search_text().empty()) {
search_text->select_all();
- search_text->set_cursor_pos(search_text->get_text().length());
+ search_text->set_cursor_position(search_text->get_text().length());
search_current();
}
}
@@ -993,14 +993,14 @@ void CodeTextEditor::_text_editor_gui_input(const Ref<InputEvent> &p_event) {
}
void CodeTextEditor::_zoom_in() {
- font_resize_val += 1;
+ font_resize_val += EDSCALE;
if (font_resize_timer->get_time_left() == 0)
font_resize_timer->start();
}
void CodeTextEditor::_zoom_out() {
- font_resize_val -= 1;
+ font_resize_val -= EDSCALE;
if (font_resize_timer->get_time_left() == 0)
font_resize_timer->start();
@@ -1023,8 +1023,10 @@ void CodeTextEditor::_line_col_changed() {
void CodeTextEditor::_text_changed() {
- code_complete_timer->start();
- idle->start();
+ if (text_editor->is_insert_text_operation()) {
+ code_complete_timer->start();
+ idle->start();
+ }
}
void CodeTextEditor::_code_complete_timer_timeout() {
@@ -1062,11 +1064,10 @@ void CodeTextEditor::_font_resize_timeout() {
Ref<DynamicFont> font = text_editor->get_font("font");
if (font.is_valid()) {
- int size = font->get_size() + font_resize_val;
-
- if (size >= 8 && size <= 96) {
- EditorSettings::get_singleton()->set("interface/source_font_size", size);
- font->set_size(size);
+ 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);
+ font->set_size(new_size);
}
font_resize_val = 0;
diff --git a/editor/collada/collada.cpp b/editor/collada/collada.cpp
index 4986d97e8f..2d49840683 100644
--- a/editor/collada/collada.cpp
+++ b/editor/collada/collada.cpp
@@ -1918,7 +1918,7 @@ void Collada::_parse_animation(XMLParser &parser) {
for (int j = 0; j < key_count; j++) {
track.keys[j].data.resize(output_len);
for (int k = 0; k < output_len; k++)
- track.keys[j].data[k] = output[l + j * stride + k]; //super weird but should work
+ track.keys[j].data[k] = output[l + j * stride + k]; //super weird but should work:
}
if (sampler.has("INTERPOLATION")) {
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index 344cb87aa6..bb5f5e9175 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -54,12 +54,7 @@ void CreateDialog::popup_create(bool p_dontclear) {
TreeItem *ti = recent->create_item(root);
ti->set_text(0, l);
- if (has_icon(l, "EditorIcons")) {
-
- ti->set_icon(0, get_icon(l, "EditorIcons"));
- } else {
- ti->set_icon(0, get_icon("Object", "EditorIcons"));
- }
+ ti->set_icon(0, _get_editor_icon(l));
}
}
@@ -122,6 +117,29 @@ void CreateDialog::_sbox_input(const Ref<InputEvent> &p_ie) {
}
}
+Ref<Texture> CreateDialog::_get_editor_icon(const String &p_type) const {
+
+ if (has_icon(p_type, "EditorIcons")) {
+ return get_icon(p_type, "EditorIcons");
+ }
+
+ const Map<String, Vector<EditorData::CustomType> > &p_map = EditorNode::get_editor_data().get_custom_types();
+ for (const Map<String, Vector<EditorData::CustomType> >::Element *E = p_map.front(); E; E = E->next()) {
+ const Vector<EditorData::CustomType> &ct = E->value();
+ for (int i = 0; i < ct.size(); ++i) {
+ if (ct[i].name == p_type) {
+ if (ct[i].icon.is_valid()) {
+ return ct[i].icon;
+ } else {
+ return get_icon("Object", "EditorIcons");
+ }
+ }
+ }
+ }
+
+ return get_icon("Object", "EditorIcons");
+}
+
void CreateDialog::add_type(const String &p_type, HashMap<String, TreeItem *> &p_types, TreeItem *p_root, TreeItem **to_select) {
if (p_types.has(p_type))
@@ -457,13 +475,7 @@ void CreateDialog::_update_favorite_list() {
TreeItem *ti = favorites->create_item(root);
String l = favorite_list[i];
ti->set_text(0, l);
-
- if (has_icon(l, "EditorIcons")) {
-
- ti->set_icon(0, get_icon(l, "EditorIcons"));
- } else {
- ti->set_icon(0, get_icon("Object", "EditorIcons"));
- }
+ ti->set_icon(0, _get_editor_icon(l));
}
}
@@ -501,7 +513,7 @@ void CreateDialog::_favorite_activated() {
Variant CreateDialog::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
- TreeItem *ti = favorites->get_item_at_pos(p_point);
+ TreeItem *ti = favorites->get_item_at_position(p_point);
if (ti) {
Dictionary d;
d["type"] = "create_favorite_drag";
@@ -532,12 +544,12 @@ void CreateDialog::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co
Dictionary d = p_data;
- TreeItem *ti = favorites->get_item_at_pos(p_point);
+ TreeItem *ti = favorites->get_item_at_position(p_point);
if (!ti)
return;
String drop_at = ti->get_text(0);
- int ds = favorites->get_drop_section_at_pos(p_point);
+ int ds = favorites->get_drop_section_at_position(p_point);
int drop_idx = favorite_list.find(drop_at);
if (drop_idx < 0)
@@ -625,6 +637,7 @@ CreateDialog::CreateDialog() {
search_box->set_h_size_flags(SIZE_EXPAND_FILL);
search_hb->add_child(search_box);
favorite = memnew(Button);
+ favorite->set_flat(true);
favorite->set_toggle_mode(true);
search_hb->add_child(favorite);
favorite->connect("pressed", this, "_favorite_toggled");
diff --git a/editor/create_dialog.h b/editor/create_dialog.h
index 31f106ea22..a523539ba0 100644
--- a/editor/create_dialog.h
+++ b/editor/create_dialog.h
@@ -74,6 +74,8 @@ class CreateDialog : public ConfirmationDialog {
void _confirmed();
void _text_changed(const String &p_newtext);
+ Ref<Texture> _get_editor_icon(const String &p_type) const;
+
void add_type(const String &p_type, HashMap<String, TreeItem *> &p_types, TreeItem *p_root, TreeItem **to_select);
Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp
index 272a5af59b..d35dc53ae1 100644
--- a/editor/doc/doc_data.cpp
+++ b/editor/doc/doc_data.cpp
@@ -170,6 +170,8 @@ static void return_doc_from_retinfo(DocData::MethodDoc &p_method, const Property
if (p_retinfo.type == Variant::INT && p_retinfo.usage & PROPERTY_USAGE_CLASS_IS_ENUM) {
p_method.return_enum = p_retinfo.class_name;
+ if (p_method.return_enum.begins_with("_")) //proxy class
+ p_method.return_enum = p_method.return_enum.substr(1, p_method.return_enum.length());
p_method.return_type = "int";
} else if (p_retinfo.class_name != StringName()) {
p_method.return_type = p_retinfo.class_name;
@@ -190,6 +192,8 @@ static void argument_doc_from_arginfo(DocData::ArgumentDoc &p_argument, const Pr
if (p_arginfo.type == Variant::INT && p_arginfo.usage & PROPERTY_USAGE_CLASS_IS_ENUM) {
p_argument.enumeration = p_arginfo.class_name;
+ if (p_argument.enumeration.begins_with("_")) //proxy class
+ p_argument.enumeration = p_argument.enumeration.substr(1, p_argument.enumeration.length());
p_argument.type = "int";
} else if (p_arginfo.class_name != StringName()) {
p_argument.type = p_arginfo.class_name;
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index a36faeb0de..b74bd3ab43 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -459,7 +459,7 @@ void EditorAudioBus::drop_data(const Point2 &p_point, const Variant &p_data) {
Variant EditorAudioBus::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
print_line("drag fw");
- TreeItem *item = effects->get_item_at_pos(p_point);
+ TreeItem *item = effects->get_item_at_position(p_point);
if (!item) {
print_line("no item");
return Variant();
@@ -489,7 +489,7 @@ bool EditorAudioBus::can_drop_data_fw(const Point2 &p_point, const Variant &p_da
if (!d.has("type") || String(d["type"]) != "audio_bus_effect")
return false;
- TreeItem *item = effects->get_item_at_pos(p_point);
+ TreeItem *item = effects->get_item_at_position(p_point);
if (!item)
return false;
@@ -502,10 +502,10 @@ void EditorAudioBus::drop_data_fw(const Point2 &p_point, const Variant &p_data,
Dictionary d = p_data;
- TreeItem *item = effects->get_item_at_pos(p_point);
+ TreeItem *item = effects->get_item_at_position(p_point);
if (!item)
return;
- int pos = effects->get_drop_section_at_pos(p_point);
+ int pos = effects->get_drop_section_at_position(p_point);
Variant md = item->get_metadata(0);
int paste_at;
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp
index 82a7fa734a..ee537f4228 100644
--- a/editor/editor_autoload_settings.cpp
+++ b/editor/editor_autoload_settings.cpp
@@ -419,12 +419,12 @@ bool EditorAutoloadSettings::can_drop_data_fw(const Point2 &p_point, const Varia
return false;
if (drop_data.has("type")) {
- TreeItem *ti = tree->get_item_at_pos(p_point);
+ TreeItem *ti = tree->get_item_at_position(p_point);
if (!ti)
return false;
- int section = tree->get_drop_section_at_pos(p_point);
+ int section = tree->get_drop_section_at_position(p_point);
if (section < -1)
return false;
@@ -437,12 +437,12 @@ bool EditorAutoloadSettings::can_drop_data_fw(const Point2 &p_point, const Varia
void EditorAutoloadSettings::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_control) {
- TreeItem *ti = tree->get_item_at_pos(p_point);
+ TreeItem *ti = tree->get_item_at_position(p_point);
if (!ti)
return;
- int section = tree->get_drop_section_at_pos(p_point);
+ int section = tree->get_drop_section_at_position(p_point);
if (section < -1)
return;
diff --git a/editor/editor_dir_dialog.cpp b/editor/editor_dir_dialog.cpp
index cfb3abfd1d..658c12d4d0 100644
--- a/editor/editor_dir_dialog.cpp
+++ b/editor/editor_dir_dialog.cpp
@@ -64,7 +64,7 @@ void EditorDirDialog::_update_dir(TreeItem *p_item, EditorFileSystemDirectory *p
}
}
-void EditorDirDialog::reload(const String &p_with_path) {
+void EditorDirDialog::reload(const String &p_path) {
if (!is_visible_in_tree()) {
must_reload = true;
@@ -73,7 +73,7 @@ void EditorDirDialog::reload(const String &p_with_path) {
tree->clear();
TreeItem *root = tree->create_item();
- _update_dir(root, EditorFileSystem::get_singleton()->get_filesystem(), p_with_path);
+ _update_dir(root, EditorFileSystem::get_singleton()->get_filesystem(), p_path);
_item_collapsed(root);
must_reload = false;
}
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index d08a595fd2..4caf2641fc 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -278,7 +278,7 @@ Error EditorExportPlatform::_save_pack_file(void *p_userdata, const String &p_pa
SavedData sd;
sd.path_utf8 = p_path.utf8();
- sd.ofs = pd->f->get_pos();
+ sd.ofs = pd->f->get_position();
sd.size = p_data.size();
pd->f->store_buffer(p_data.ptr(), p_data.size());
@@ -736,7 +736,7 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c
f->store_32(pd.file_ofs.size()); //amount of files
- size_t header_size = f->get_pos();
+ size_t header_size = f->get_position();
//precalculate header size
@@ -1246,9 +1246,13 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_pr
}
DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
- da->copy(template_path, p_path);
+ Error err = da->copy(template_path, p_path, get_chmod_flags());
memdelete(da);
+ if (err != OK) {
+ return err;
+ }
+
String pck_path = p_path.get_basename() + ".pck";
return save_pack(p_preset, pck_path);
@@ -1302,5 +1306,17 @@ void EditorExportPlatformPC::get_platform_features(List<String> *r_features) {
}
}
+int EditorExportPlatformPC::get_chmod_flags() const {
+
+ return chmod_flags;
+}
+
+void EditorExportPlatformPC::set_chmod_flags(int p_flags) {
+
+ chmod_flags = p_flags;
+}
+
EditorExportPlatformPC::EditorExportPlatformPC() {
+
+ chmod_flags = -1;
}
diff --git a/editor/editor_export.h b/editor/editor_export.h
index b6ea4fd889..50379b9683 100644
--- a/editor/editor_export.h
+++ b/editor/editor_export.h
@@ -319,6 +319,7 @@ class EditorExportPlatformPC : public EditorExportPlatform {
Set<String> extra_features;
bool use64;
+ int chmod_flags;
public:
virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features);
@@ -347,6 +348,9 @@ public:
void add_platform_feature(const String &p_feature);
virtual void get_platform_features(List<String> *r_features);
+ int get_chmod_flags() const;
+ void set_chmod_flags(int p_flags);
+
EditorExportPlatformPC();
};
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index 9d1756a7ec..8d13153128 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -107,8 +107,6 @@ void EditorFileDialog::_notification(int p_what) {
fav_down->set_icon(get_icon("MoveDown", "EditorIcons"));
fav_rm->set_icon(get_icon("RemoveSmall", "EditorIcons"));
- Theme::get_default()->clear_icon("ResizedFile", "EditorIcons");
- Theme::get_default()->clear_icon("ResizedFolder", "EditorIcons");
update_file_list();
}
}
@@ -1301,6 +1299,7 @@ EditorFileDialog::EditorFileDialog() {
pathhb->add_child(refresh);
favorite = memnew(ToolButton);
+ favorite->set_flat(true);
favorite->set_toggle_mode(true);
favorite->connect("toggled", this, "_favorite_toggled");
pathhb->add_child(favorite);
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index 6e12a8fd02..481f2a8179 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -1498,10 +1498,22 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
importing = true;
EditorProgress pr("reimport", TTR("(Re)Importing Assets"), p_files.size());
+
+ Vector<ImportFile> files;
+
for (int i = 0; i < p_files.size(); i++) {
- pr.step(p_files[i].get_file(), i);
+ ImportFile ifile;
+ ifile.path = p_files[i];
+ ifile.order = ResourceFormatImporter::get_singleton()->get_import_order(p_files[i]);
+ files.push_back(ifile);
+ }
+
+ files.sort();
+
+ for (int i = 0; i < files.size(); i++) {
+ pr.step(files[i].path.get_file(), i);
- _reimport_file(p_files[i]);
+ _reimport_file(files[i].path);
}
_save_filesystem_cache();
diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h
index cee3219b43..ebcc091b0a 100644
--- a/editor/editor_file_system.h
+++ b/editor/editor_file_system.h
@@ -206,6 +206,14 @@ class EditorFileSystem : public Node {
Vector<String> _get_dependencies(const String &p_path);
+ struct ImportFile {
+ String path;
+ int order;
+ bool operator<(const ImportFile &p_if) const {
+ return order < p_if.order;
+ }
+ };
+
protected:
void _notification(int p_what);
static void _bind_methods();
diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp
index d806b825ba..6e5726a16d 100644
--- a/editor/editor_fonts.cpp
+++ b/editor/editor_fonts.cpp
@@ -119,7 +119,7 @@ void editor_register_fonts(Ref<Theme> p_theme) {
Ref<DynamicFontData> dfmono;
dfmono.instance();
- dfmono->set_font_ptr(_font_mononoki_Regular, _font_mononoki_Regular_size);
+ 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);
@@ -130,13 +130,16 @@ void editor_register_fonts(Ref<Theme> p_theme) {
//Ref<BitmapFont> doc_title_font = make_font(_bi_font_doc_title_font_height,_bi_font_doc_title_font_ascent,0,_bi_font_doc_title_font_charcount,_bi_font_doc_title_font_characters,p_theme->get_icon("DocTitleFont","EditorIcons"));
//Ref<BitmapFont> doc_code_font = make_font(_bi_font_doc_code_font_height,_bi_font_doc_code_font_ascent,0,_bi_font_doc_code_font_charcount,_bi_font_doc_code_font_characters,p_theme->get_icon("DocCodeFont","EditorIcons"));
- MAKE_DEFAULT_FONT(df_title, int(EDITOR_DEF("text_editor/help/help_title_font_size", 18)) * EDSCALE);
+ MAKE_DEFAULT_FONT(df_title, int(EDITOR_DEF("text_editor/help/help_title_font_size", 16)) * EDSCALE);
- MAKE_DEFAULT_FONT(df_doc, int(EDITOR_DEF("text_editor/help/help_font_size", 16)) * EDSCALE);
+ MAKE_DEFAULT_FONT(df_doc, int(EDITOR_DEF("text_editor/help/help_font_size", 14)) * EDSCALE);
p_theme->set_font("doc", "EditorFonts", df_doc);
p_theme->set_font("doc_title", "EditorFonts", df_title);
+ MAKE_DEFAULT_FONT(df_rulers, int(EDITOR_DEF("canvas_item_editor/rulers", 8)) * EDSCALE);
+ p_theme->set_font("rulers", "EditorFonts", df_rulers);
+
Ref<DynamicFont> df_code;
df_code.instance();
df_code->set_size(int(EditorSettings::get_singleton()->get("interface/source_font_size")) * EDSCALE);
@@ -147,7 +150,7 @@ void editor_register_fonts(Ref<Theme> p_theme) {
Ref<DynamicFont> df_doc_code;
df_doc_code.instance();
- df_doc_code->set_size(int(EDITOR_DEF("text_editor/help/help_source_font_size", 18)) * EDSCALE);
+ df_doc_code->set_size(int(EDITOR_DEF("text_editor/help/help_source_font_size", 16)) * EDSCALE);
df_doc_code->set_spacing(DynamicFont::SPACING_TOP, -EDSCALE);
df_doc_code->set_spacing(DynamicFont::SPACING_BOTTOM, -EDSCALE);
df_doc_code->set_font_data(dfmono);
diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp
index 035819f503..481f2aaecf 100644
--- a/editor/editor_log.cpp
+++ b/editor/editor_log.cpp
@@ -85,7 +85,11 @@ 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");
@@ -100,6 +104,8 @@ void EditorLog::add_message(const String &p_msg, bool p_error) {
if (p_error)
log->pop();
+
+ log->pop(); // pop font;
}
/*
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 3f0520379a..54c6ff79ea 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -2780,14 +2780,6 @@ Dictionary EditorNode::_get_main_scene_state() {
state["property_edit_offset"] = get_property_editor()->get_scene_tree()->get_vscroll_bar()->get_value();
state["saved_version"] = saved_version;
state["node_filter"] = scene_tree_dock->get_filter();
- int current = -1;
- for (int i = 0; i < editor_table.size(); i++) {
- if (editor_plugin_screen == editor_table[i]) {
- current = i;
- break;
- }
- }
- state["editor_index"] = current;
return state;
}
@@ -2798,29 +2790,32 @@ void EditorNode::_set_main_scene_state(Dictionary p_state, Node *p_for_scene) {
changing_scene = false;
- if (p_state.has("editor_index")) {
-
- int index = p_state["editor_index"];
- int current = -1;
- for (int i = 0; i < editor_table.size(); i++) {
- if (editor_plugin_screen == editor_table[i]) {
- current = i;
- break;
- }
+ int current = -1;
+ for (int i = 0; i < editor_table.size(); i++) {
+ if (editor_plugin_screen == editor_table[i]) {
+ current = i;
+ break;
}
+ }
+ if (p_state.has("editor_index")) {
+ int index = p_state["editor_index"];
if (current < 2) { //if currently in spatial/2d, only switch to spatial/2d. if curently in script, stay there
if (index < 2 || !get_edited_scene()) {
_editor_select(index);
- } else {
- //use heuristic instead
- int n2d = 0, n3d = 0;
- _find_node_types(get_edited_scene(), n2d, n3d);
- if (n2d > n3d) {
- _editor_select(EDITOR_2D);
- } else if (n3d > n2d) {
- _editor_select(EDITOR_3D);
- }
+ }
+ }
+ }
+
+ if (get_edited_scene()) {
+ if (current < 2) {
+ //use heuristic instead
+ int n2d = 0, n3d = 0;
+ _find_node_types(get_edited_scene(), n2d, n3d);
+ if (n2d > n3d) {
+ _editor_select(EDITOR_2D);
+ } else if (n3d > n2d) {
+ _editor_select(EDITOR_3D);
}
}
}
@@ -3343,9 +3338,9 @@ void EditorNode::_editor_file_dialog_unregister(EditorFileDialog *p_dialog) {
Vector<EditorNodeInitCallback> EditorNode::_init_callbacks;
-Error EditorNode::export_preset(const String &preset, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after) {
+Error EditorNode::export_preset(const String &p_preset, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after) {
- export_defer.preset = preset;
+ export_defer.preset = p_preset;
export_defer.path = p_path;
export_defer.debug = p_debug;
export_defer.password = p_password;
@@ -4066,6 +4061,13 @@ 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);
@@ -4074,11 +4076,14 @@ void EditorNode::_bottom_panel_switch(bool p_enable, int p_idx) {
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);
}
@@ -4421,22 +4426,6 @@ void EditorNode::_dim_timeout() {
}
}
-void EditorNode::_check_gui_base_size() {
- if (gui_base->get_size().width > 1200 * EDSCALE) {
- for (int i = 0; i < singleton->main_editor_button_vb->get_child_count(); i++) {
- ToolButton *btn = Object::cast_to<ToolButton>(singleton->main_editor_button_vb->get_child(i));
- if (btn == singleton->distraction_free) continue;
- btn->set_text(btn->get_name());
- }
- } else {
- for (int i = 0; i < singleton->main_editor_button_vb->get_child_count(); i++) {
- ToolButton *btn = Object::cast_to<ToolButton>(singleton->main_editor_button_vb->get_child(i));
- if (btn == singleton->distraction_free) continue;
- btn->set_text("");
- }
- }
-}
-
void EditorNode::open_export_template_manager() {
export_template_manager->popup_manager();
@@ -4516,7 +4505,6 @@ void EditorNode::_bind_methods() {
ClassDB::bind_method(D_METHOD("_open_imported"), &EditorNode::_open_imported);
ClassDB::bind_method(D_METHOD("_inherit_imported"), &EditorNode::_inherit_imported);
ClassDB::bind_method(D_METHOD("_dim_timeout"), &EditorNode::_dim_timeout);
- ClassDB::bind_method(D_METHOD("_check_gui_base_size"), &EditorNode::_check_gui_base_size);
ClassDB::bind_method(D_METHOD("_resources_reimported"), &EditorNode::_resources_reimported);
@@ -4666,7 +4654,6 @@ EditorNode::EditorNode() {
gui_base = memnew(Panel);
theme_base->add_child(gui_base);
gui_base->set_area_as_parent_rect();
- gui_base->connect("item_rect_changed", this, "_check_gui_base_size");
Ref<Theme> theme = create_editor_theme();
theme_base->set_theme(theme);
@@ -4854,7 +4841,7 @@ EditorNode::EditorNode() {
scene_root_parent = memnew(PanelContainer);
scene_root_parent->set_custom_minimum_size(Size2(0, 80) * EDSCALE);
scene_root_parent->add_style_override("panel", gui_base->get_stylebox("Content", "EditorStyles"));
-
+ scene_root_parent->set_draw_behind_parent(true);
srt->add_child(scene_root_parent);
scene_root_parent->set_v_size_flags(Control::SIZE_EXPAND_FILL);
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 5c6c5be4c8..e7853a27ba 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -605,11 +605,9 @@ private:
void _start_dimming(bool p_dimming);
void _dim_timeout();
- void _check_gui_base_size();
void _license_tree_selected();
-
protected:
void _notification(int p_what);
static void _bind_methods();
@@ -716,7 +714,7 @@ public:
void show_warning(const String &p_text, const String &p_title = "Warning!");
- Error export_preset(const String &p_platform, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after = false);
+ Error export_preset(const String &p_preset, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after = false);
static void register_editor_types();
static void unregister_editor_types();
diff --git a/editor/editor_profiler.cpp b/editor/editor_profiler.cpp
index 6b972262b9..247775fa1d 100644
--- a/editor/editor_profiler.cpp
+++ b/editor/editor_profiler.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "editor_profiler.h"
+#include "editor_scale.h"
#include "editor_settings.h"
#include "os/os.h"
@@ -656,14 +657,14 @@ EditorProfiler::EditorProfiler() {
hb->add_child(cursor_metric_edit);
cursor_metric_edit->connect("value_changed", this, "_cursor_metric_changed");
- hb->add_constant_override("separation", 8);
+ hb->add_constant_override("separation", 8 * EDSCALE);
h_split = memnew(HSplitContainer);
add_child(h_split);
h_split->set_v_size_flags(SIZE_EXPAND_FILL);
variables = memnew(Tree);
- variables->set_custom_minimum_size(Size2(300, 0));
+ variables->set_custom_minimum_size(Size2(300, 0) * EDSCALE);
variables->set_hide_folding(true);
h_split->add_child(variables);
variables->set_hide_root(true);
@@ -674,10 +675,10 @@ EditorProfiler::EditorProfiler() {
variables->set_column_min_width(0, 60);
variables->set_column_title(1, "Time");
variables->set_column_expand(1, false);
- variables->set_column_min_width(1, 60);
+ variables->set_column_min_width(1, 60 * EDSCALE);
variables->set_column_title(2, "Calls");
variables->set_column_expand(2, false);
- variables->set_column_min_width(2, 60);
+ variables->set_column_min_width(2, 60 * EDSCALE);
variables->connect("item_edited", this, "_item_edited");
graph = memnew(TextureRect);
@@ -691,8 +692,6 @@ EditorProfiler::EditorProfiler() {
h_split->add_child(graph);
graph->set_h_size_flags(SIZE_EXPAND_FILL);
- add_constant_override("separation", 3);
-
int metric_size = CLAMP(int(EDITOR_DEF("debugger/profiler_frame_history_size", 600)), 60, 1024);
frame_metrics.resize(metric_size);
last_metric = -1;
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index d7266df67c..4de1c32fe7 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -460,7 +460,7 @@ void EditorSettings::setup_network() {
List<IP_Address> local_ip;
IP::get_singleton()->get_local_addresses(&local_ip);
- String lip;
+ 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;
@@ -469,8 +469,9 @@ void EditorSettings::setup_network() {
String ip = E->get();
- if (lip == "")
- lip = ip;
+ // link-local IPv6 addresses don't work, skipping them
+ if (ip.begins_with("fe80:0:0:0:")) // fe80::/64
+ continue;
if (ip == current)
lip = current; //so it saves
if (hint != "")
@@ -581,7 +582,10 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
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);
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);
+ 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", "");
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);
@@ -599,8 +603,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
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);
- set("text_editor/theme/color_theme", "Default");
- hints["text_editor/theme/color_theme"] = PropertyInfo(Variant::STRING, "text_editor/theme/color_theme", PROPERTY_HINT_ENUM, "Default");
+ 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);
@@ -661,35 +665,47 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
set("editors/3d/default_z_near", 0.1);
set("editors/3d/default_z_far", 500.0);
- set("editors/3d/navigation_scheme", 0);
- hints["editors/3d/navigation_scheme"] = PropertyInfo(Variant::INT, "editors/3d/navigation_scheme", PROPERTY_HINT_ENUM, "Godot,Maya,Modo");
- set("editors/3d/zoom_style", 0);
- hints["editors/3d/zoom_style"] = PropertyInfo(Variant::INT, "editors/3d/zoom_style", PROPERTY_HINT_ENUM, "Vertical, Horizontal");
- set("editors/3d/orbit_modifier", 0);
- hints["editors/3d/orbit_modifier"] = PropertyInfo(Variant::INT, "editors/3d/orbit_modifier", PROPERTY_HINT_ENUM, "None,Shift,Alt,Meta,Ctrl");
- set("editors/3d/pan_modifier", 1);
- hints["editors/3d/pan_modifier"] = PropertyInfo(Variant::INT, "editors/3d/pan_modifier", PROPERTY_HINT_ENUM, "None,Shift,Alt,Meta,Ctrl");
- set("editors/3d/zoom_modifier", 4);
- hints["editors/3d/zoom_modifier"] = PropertyInfo(Variant::INT, "editors/3d/zoom_modifier", PROPERTY_HINT_ENUM, "None,Shift,Alt,Meta,Ctrl");
- set("editors/3d/emulate_numpad", false);
- set("editors/3d/emulate_3_button_mouse", false);
- set("editors/3d/warped_mouse_panning", true);
-
- set("editors/3d/orbit_sensitivity", 0.4);
-
- set("editors/3d/orbit_inertia", 0.2);
- hints["editors/3d/orbit_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/orbit_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
-
- set("editors/3d/freelook_inertia", 0.2);
- hints["editors/3d/freelook_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/freelook_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
-
- set("editors/3d/freelook_base_speed", 0.5);
- hints["editors/3d/freelook_base_speed"] = PropertyInfo(Variant::REAL, "editors/3d/freelook_base_speed", PROPERTY_HINT_RANGE, "0.0, 10, 0.1");
-
- set("editors/3d/freelook_activation_modifier", 0);
- hints["editors/3d/freelook_activation_modifier"] = PropertyInfo(Variant::INT, "editors/3d/freelook_activation_modifier", PROPERTY_HINT_ENUM, "None,Shift,Alt,Meta,Ctrl");
-
- set("editors/3d/freelook_modifier_speed_factor", 5.0);
+ // navigation
+ 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);
+ 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", 3);
+ 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);
+ 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);
+ 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);
+
+ // navigation feel
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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));
@@ -924,13 +940,13 @@ void EditorSettings::load_favorites() {
}
void EditorSettings::list_text_editor_themes() {
- String themes = "Default";
+ String themes = "Adaptive,Default";
DirAccess *d = DirAccess::open(settings_path + "/text_editor_themes");
if (d) {
d->list_dir_begin();
String file = d->get_next();
while (file != String()) {
- if (file.get_extension() == "tet" && file.get_basename().to_lower() != "default") {
+ if (file.get_extension() == "tet" && file.get_basename().to_lower() != "default" && file.get_basename().to_lower() != "adaptive") {
themes += "," + file.get_basename();
}
file = d->get_next();
@@ -942,7 +958,7 @@ void EditorSettings::list_text_editor_themes() {
}
void EditorSettings::load_text_editor_theme() {
- if (get("text_editor/theme/color_theme") == "Default") {
+ if (get("text_editor/theme/color_theme") == "Default" || get("text_editor/theme/color_theme") == "Adaptive") {
_load_default_text_editor_theme(); // sorry for "Settings changed" console spam
return;
}
@@ -999,7 +1015,7 @@ bool EditorSettings::save_text_editor_theme() {
String p_file = get("text_editor/theme/color_theme");
- if (p_file.get_file().to_lower() == "default") {
+ if (p_file.get_file().to_lower() == "default" || p_file.get_file().to_lower() == "adaptive") {
return false;
}
String theme_path = get_settings_path() + "/text_editor_themes/" + p_file + ".tet";
@@ -1011,7 +1027,7 @@ bool EditorSettings::save_text_editor_theme_as(String p_file) {
p_file += ".tet";
}
- if (p_file.get_file().to_lower() == "default.tet") {
+ if (p_file.get_file().to_lower() == "default.tet" || p_file.get_file().to_lower() == "adaptive.tet") {
return false;
}
if (_save_text_editor_theme(p_file)) {
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 304d6acd62..a4f2368794 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -112,41 +112,49 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool dark_theme = tr
#ifdef SVG_ENABLED
Dictionary dark_icon_color_dictionary;
- //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
- ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#b4b4b4", "#000000"); // script darker color
-
- ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#cea4f1", "#bb6dff"); // animation
- ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#fc9c9c", "#ff5f5f"); // spatial
- ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#a5b7f3", "#6d90ff"); // 2d
- ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#708cea", "#0843ff"); // 2d dark
- ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#a5efac", "#29d739"); // control
-
- ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#ff8484", "#ff3333"); // error
- ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#84ffb1", "#00db50"); // success
- ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#ffd684", "#ffad07"); // warning
-
- // rainbow
- ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#ff7070", "#ff2929"); // red
- ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#ffeb70", "#ffe337"); // yellow
- ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#9dff70", "#74ff34"); // green
- ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#70ffb9", "#2cff98"); // aqua
- ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#70deff", "#22ccff"); // blue
- ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#9f70ff", "#702aff"); // purple
- ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#ff70ac", "#ff2781"); // pink
-
- // audio gradient
- ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#ff8484", "#ff4040"); // red
- ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#e1dc7a", "#d6cf4b"); // yellow
- ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#84ffb1", "#00f010"); // green
-
- ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#ffd684", "#fea900"); // mesh (orange)
- ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#40a2ff", "#68b6ff"); // shape (blue)
-
- ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#84c2ff", "#5caeff"); // selection (blue)
-
- ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#ea686c", "#e3383d"); // key xform (red)
+ if (!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
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#b4b4b4", "#000000"); // script darker color
+
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#cea4f1", "#bb6dff"); // animation
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#fc9c9c", "#ff5f5f"); // spatial
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#a5b7f3", "#6d90ff"); // 2d
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#708cea", "#0843ff"); // 2d dark
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#a5efac", "#29d739"); // control
+
+ // rainbow
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#ff7070", "#ff2929"); // red
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#ffeb70", "#ffe337"); // yellow
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#9dff70", "#74ff34"); // green
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#70ffb9", "#2cff98"); // aqua
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#70deff", "#22ccff"); // blue
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#9f70ff", "#702aff"); // purple
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#ff70ac", "#ff2781"); // pink
+
+ // audio gradient
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#ff8484", "#ff4040"); // red
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#e1dc7a", "#d6cf4b"); // yellow
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#84ffb1", "#00f010"); // green
+
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#ffd684", "#fea900"); // mesh (orange)
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#40a2ff", "#68b6ff"); // shape (blue)
+
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#ff8484", "#ff3333"); // remove (red)
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#84ffb1", "#00db50"); // add (green)
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#84c2ff", "#5caeff"); // selection (blue)
+
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#ea686c", "#e3383d"); // key xform (red)
+ }
+
+ // these ones should be converted even if we are using a dark theme
+ const Color error_color = p_theme->get_color("error_color", "Editor");
+ const Color success_color = p_theme->get_color("success_color", "Editor");
+ const Color warning_color = p_theme->get_color("warning_color", "Editor");
+ dark_icon_color_dictionary[Color::html("#ff5d5d")] = error_color;
+ dark_icon_color_dictionary[Color::html("#45ff8b")] = success_color;
+ dark_icon_color_dictionary[Color::html("#ffdd65")] = warning_color;
List<String> exceptions;
exceptions.push_back("EditorPivot");
@@ -157,17 +165,20 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool dark_theme = tr
exceptions.push_back("ProceduralSky");
exceptions.push_back("EditorControlAnchor");
exceptions.push_back("DefaultProjectIcon");
+ exceptions.push_back("GuiCloseCustomizable");
+ exceptions.push_back("GuiGraphNodePort");
+ exceptions.push_back("GuiResizer");
clock_t begin_time = clock();
- ImageLoaderSVG::set_convert_colors(dark_theme ? NULL : &dark_icon_color_dictionary);
+ ImageLoaderSVG::set_convert_colors(&dark_icon_color_dictionary);
// generate icons
if (!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);
- Ref<ImageTexture> icon = editor_generate_icon(i, !dark_theme && !is_exception);
+ Ref<ImageTexture> icon = editor_generate_icon(i, !is_exception);
p_theme->set_icon(editor_icons_names[i], "EditorIcons", icon);
}
@@ -220,6 +231,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
bool highlight_tabs = EDITOR_DEF("interface/theme/highlight_tabs", false);
int border_size = EDITOR_DEF("interface/theme/border_size", 1);
+ bool use_gn_headers = EDITOR_DEF("interface/theme/use_graph_node_headers", false);
+
Color script_bg_color = EDITOR_DEF("text_editor/highlighting/background_color", Color(0, 0, 0, 0));
switch (preset) {
@@ -322,6 +335,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
const int border_width = CLAMP(border_size, 0, 3) * EDSCALE;
const int default_margin_size = 4;
+ const int margin_size_extra = default_margin_size + CLAMP(border_size, 0, 3);
// styleboxes
// this is the most commonly used stylebox, variations should be made as duplicate of this
@@ -331,13 +345,14 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
style_default->set_draw_center(true);
// Button and widgets
- Ref<StyleBoxFlat> style_widget = style_default->duplicate();
+ const float extra_spacing = EDITOR_DEF("interface/theme/additional_spacing", 0.0);
- // style_widget->set_bg_color(dark_color_1.linear_interpolate(base_color, 0.4));
+ Ref<StyleBoxFlat> style_widget = style_default->duplicate();
+ style_widget->set_default_margin(MARGIN_LEFT, (extra_spacing + 6) * EDSCALE);
+ style_widget->set_default_margin(MARGIN_TOP, (extra_spacing + default_margin_size) * EDSCALE);
+ style_widget->set_default_margin(MARGIN_RIGHT, (extra_spacing + 6) * EDSCALE);
+ style_widget->set_default_margin(MARGIN_BOTTOM, (extra_spacing + default_margin_size) * EDSCALE);
style_widget->set_bg_color(dark_color_1);
- style_widget->set_default_margin(MARGIN_LEFT, 6 * EDSCALE);
- style_widget->set_default_margin(MARGIN_RIGHT, 6 * EDSCALE);
- // style_widget->set_border_color_all(contrast_color_1);
style_widget->set_border_color_all(dark_color_2);
Ref<StyleBoxFlat> style_widget_disabled = style_widget->duplicate();
@@ -368,14 +383,19 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
Ref<StyleBoxEmpty> style_empty = make_empty_stylebox(default_margin_size, default_margin_size, default_margin_size, default_margin_size);
// Tabs
- Ref<StyleBoxFlat> style_tab_selected = style_default->duplicate();
- style_tab_selected->set_default_margin(MARGIN_LEFT, 10 * EDSCALE);
- style_tab_selected->set_default_margin(MARGIN_RIGHT, 10 * EDSCALE);
+ const int tab_default_margin_side = 10 * 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_bg_color(tab_color);
- Ref<StyleBoxEmpty> style_tab_unselected = style_empty->duplicate();
- style_tab_unselected->set_default_margin(MARGIN_LEFT, 10 * EDSCALE);
- style_tab_unselected->set_default_margin(MARGIN_RIGHT, 10 * EDSCALE);
+ 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));
// Editor background
theme->set_stylebox("Background", "EditorStyles", make_flat_stylebox(background_color, default_margin_size, default_margin_size, default_margin_size, default_margin_size));
@@ -387,7 +407,9 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("Focus", "EditorStyles", style_focus);
// Menu
- Ref<StyleBoxEmpty> style_menu = style_empty;
+ Ref<StyleBoxFlat> style_menu = style_widget->duplicate();
+ style_menu->set_draw_center(false);
+ style_menu->set_border_width_all(0);
theme->set_stylebox("panel", "PanelContainer", style_menu);
theme->set_stylebox("MenuPanel", "EditorStyles", style_menu);
@@ -399,13 +421,13 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("PlayButtonPanel", "EditorStyles", style_empty); //make_stylebox(theme->get_icon("GuiPlayButtonGroup", "EditorIcons"), 16, 16, 16, 16, 8, 4, 8, 4));
//MenuButton
- Ref<StyleBoxFlat> style_menu_hover_border = style_default->duplicate();
+ Ref<StyleBoxFlat> style_menu_hover_border = style_widget->duplicate();
style_menu_hover_border->set_draw_center(false);
style_menu_hover_border->set_border_width_all(0);
style_menu_hover_border->set_border_width(MARGIN_BOTTOM, border_width);
style_menu_hover_border->set_border_color_all(accent_color);
- Ref<StyleBoxFlat> style_menu_hover_bg = style_default->duplicate();
+ Ref<StyleBoxFlat> style_menu_hover_bg = style_widget->duplicate();
style_menu_hover_bg->set_border_width_all(0);
style_menu_hover_bg->set_bg_color(dark_color_1);
@@ -435,19 +457,6 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("MenuHover", "EditorStyles", style_menu_hover_border);
- // Content of each tab
- Ref<StyleBoxFlat> style_content_panel = style_default->duplicate();
- style_content_panel->set_border_color_all(base_color);
-
- // this is the stylebox used in 3d and 2d viewports (no borders)
- Ref<StyleBoxFlat> style_content_panel_vp = style_content_panel->duplicate();
- style_content_panel_vp->set_default_margin(MARGIN_LEFT, border_width);
- style_content_panel_vp->set_default_margin(MARGIN_TOP, default_margin_size);
- style_content_panel_vp->set_default_margin(MARGIN_RIGHT, border_width);
- style_content_panel_vp->set_default_margin(MARGIN_BOTTOM, border_width);
- theme->set_stylebox("panel", "TabContainer", style_content_panel);
- theme->set_stylebox("Content", "EditorStyles", style_content_panel_vp);
-
// Buttons
theme->set_stylebox("normal", "Button", style_widget);
theme->set_stylebox("hover", "Button", style_widget_hover);
@@ -513,7 +522,7 @@ 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_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);
@@ -533,6 +542,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
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_constant("vseparation", "Tree", (extra_spacing + default_margin_size) * EDSCALE);
Ref<StyleBoxFlat> style_tree_btn = style_default->duplicate();
style_tree_btn->set_bg_color(contrast_color_1);
@@ -588,7 +598,7 @@ 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", 5 * EDSCALE);
+ theme->set_constant("vseparation", "ItemList", (extra_spacing + default_margin_size) * EDSCALE);
theme->set_color("font_color", "ItemList", font_color);
// Tabs & TabContainer
@@ -608,19 +618,52 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("button_pressed", "Tabs", style_menu);
theme->set_stylebox("button", "Tabs", style_menu);
+ // Content of each tab
+ Ref<StyleBoxFlat> style_content_panel = style_default->duplicate();
+ style_content_panel->set_border_color_all(dark_color_3);
+ style_content_panel->set_border_width_all(border_width);
+ // compensate the border
+ style_content_panel->set_default_margin(MARGIN_TOP, margin_size_extra * EDSCALE);
+ style_content_panel->set_default_margin(MARGIN_RIGHT, margin_size_extra * EDSCALE);
+ style_content_panel->set_default_margin(MARGIN_BOTTOM, margin_size_extra * EDSCALE);
+ style_content_panel->set_default_margin(MARGIN_LEFT, margin_size_extra * EDSCALE);
+
+ // this is the stylebox used in 3d and 2d viewports (no borders)
+ Ref<StyleBoxFlat> style_content_panel_vp = style_content_panel->duplicate();
+ style_content_panel_vp->set_default_margin(MARGIN_LEFT, border_width * 2);
+ style_content_panel_vp->set_default_margin(MARGIN_TOP, default_margin_size * EDSCALE);
+ style_content_panel_vp->set_default_margin(MARGIN_RIGHT, border_width * 2);
+ style_content_panel_vp->set_default_margin(MARGIN_BOTTOM, border_width * 2);
+ theme->set_stylebox("panel", "TabContainer", style_content_panel);
+ theme->set_stylebox("Content", "EditorStyles", style_content_panel_vp);
+
// Separators (no 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));
- // Debugger
- Ref<StyleBoxFlat> style_panel_debugger = style_default->duplicate();
- theme->set_stylebox("DebuggerPanel", "EditorStyles", style_panel_debugger);
+ // HACK Debuger panel
+ 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);
+ // 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_border_width_all(0);
-
+ 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);
- theme->set_stylebox("DebuggerTabBG", "EditorStyles", style_tab_unselected);
+ 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);
// LineEdit
theme->set_stylebox("normal", "LineEdit", style_widget);
@@ -634,6 +677,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("normal", "TextEdit", style_widget);
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"));
// H/VSplitContainer
theme->set_stylebox("bg", "VSplitContainer", make_stylebox(theme->get_icon("GuiVsplitBg", "EditorIcons"), 1, 1, 1, 1));
@@ -645,6 +689,17 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_constant("separation", "HSplitContainer", default_margin_size * 2 * EDSCALE);
theme->set_constant("separation", "VSplitContainer", default_margin_size * 2 * EDSCALE);
+ // Containers
+ theme->set_constant("separation", "BoxContainer", default_margin_size * EDSCALE);
+ theme->set_constant("separation", "HBoxContainer", default_margin_size * EDSCALE);
+ theme->set_constant("separation", "VBoxContainer", default_margin_size * EDSCALE);
+ theme->set_constant("margin_left", "MarginContainer", 0);
+ theme->set_constant("margin_top", "MarginContainer", 0);
+ theme->set_constant("margin_right", "MarginContainer", 0);
+ theme->set_constant("margin_bottom", "MarginContainer", 0);
+ theme->set_constant("hseparation", "GridContainer", default_margin_size * EDSCALE);
+ theme->set_constant("vseparation", "GridContainer", default_margin_size * EDSCALE);
+
// WindowDialog
Ref<StyleBoxFlat> style_window = style_popup->duplicate();
style_window->set_border_color_all(tab_color);
@@ -756,32 +811,121 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// GraphNode
- Ref<StyleBoxFlat> graphsb = make_flat_stylebox(Color(0, 0, 0, 0.3), 16, 24, 16, 5);
+ 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);
graphsb->set_border_width_all(border_width);
- graphsb->set_border_color_all(Color(1, 1, 1, 0.6));
- graphsb->set_border_width(MARGIN_TOP, 22 * EDSCALE + border_width);
- Ref<StyleBoxFlat> graphsbselected = make_flat_stylebox(Color(0, 0, 0, 0.4), 16, 24, 16, 5);
+ 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);
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);
- graphsbselected->set_border_width(MARGIN_TOP, 22 * EDSCALE + border_width);
- Ref<StyleBoxFlat> graphsbcomment = make_flat_stylebox(Color(0, 0, 0, 0.3), 16, 24, 16, 5);
+ Ref<StyleBoxFlat> graphsbcomment = make_flat_stylebox(Color(0, 0, 0, 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.6));
- graphsbcomment->set_border_width(MARGIN_TOP, 22 * EDSCALE + border_width);
- Ref<StyleBoxFlat> graphsbcommentselected = make_flat_stylebox(Color(0, 0, 0, 0.4), 16, 24, 16, 5);
+ 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);
graphsbcommentselected->set_border_width_all(border_width);
graphsbcommentselected->set_border_color_all(Color(1, 1, 1, 0.9));
- graphsbcommentselected->set_border_width(MARGIN_TOP, 22 * EDSCALE + border_width);
+
+ if (use_gn_headers) {
+ graphsb->set_border_width(MARGIN_TOP, 24 * EDSCALE);
+ graphsbselected->set_border_width(MARGIN_TOP, 24 * EDSCALE);
+ graphsbcomment->set_border_width(MARGIN_TOP, 24 * EDSCALE);
+ graphsbcommentselected->set_border_width(MARGIN_TOP, 24 * EDSCALE);
+ }
+
theme->set_stylebox("frame", "GraphNode", graphsb);
theme->set_stylebox("selectedframe", "GraphNode", graphsbselected);
theme->set_stylebox("comment", "GraphNode", graphsbcomment);
theme->set_stylebox("commentfocus", "GraphNode", graphsbcommentselected);
+ 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);
+ theme->set_constant("close_offset", "GraphNode", 20 * EDSCALE);
+ theme->set_icon("close", "GraphNode", theme->get_icon("GuiCloseCustomizable", "EditorIcons"));
+ theme->set_icon("resizer", "GraphNode", theme->get_icon("GuiResizer", "EditorIcons"));
+ theme->set_icon("port", "GraphNode", theme->get_icon("GuiGraphNodePort", "EditorIcons"));
+
+ // GridContainer
+ theme->set_constant("vseperation", "GridContainer", (extra_spacing + default_margin_size) * EDSCALE);
// FileDialog
theme->set_color("files_disabled", "FileDialog", font_color_disabled);
+ // 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);
+
+ const float mono_value = mono_color.r;
+ const Color alpha1 = Color(mono_value, mono_value, mono_value, 0.1);
+ const Color alpha2 = Color(mono_value, mono_value, mono_value, 0.3);
+ const Color alpha3 = Color(mono_value, mono_value, mono_value, 0.5);
+ const Color alpha4 = Color(mono_value, mono_value, mono_value, 0.7);
+
+ // editor main color
+ const Color main_color = Color::html(dark_theme ? "#57b3ff" : "#0480ff");
+
+ const Color symbol_color = Color::html("#5792ff").linear_interpolate(mono_color, dark_theme ? 0.5 : 0.3);
+ const Color keyword_color = main_color.linear_interpolate(mono_color, 0.4);
+ const Color basetype_color = Color::html(dark_theme ? "#42ffc2" : "#00c161");
+ const Color type_color = basetype_color.linear_interpolate(mono_color, dark_theme ? 0.7 : 0.5);
+ const Color comment_color = dim_color;
+ const Color string_color = Color::html(dark_theme ? "#ffd942" : "#ffd118").linear_interpolate(mono_color, dark_theme ? 0.5 : 0.3);
+
+ const Color te_background_color = Color(0, 0, 0, 0);
+ const Color completion_background_color = base_color;
+ const Color completion_selected_color = alpha1;
+ const Color completion_existing_color = alpha2;
+ const Color completion_scroll_color = alpha1;
+ const Color completion_font_color = font_color;
+ const Color text_color = font_color;
+ const Color line_number_color = dim_color;
+ const Color caret_color = mono_color;
+ const Color caret_background_color = mono_color.inverted();
+ const Color text_selected_color = dark_color_3;
+ const Color selection_color = alpha3;
+ const Color brace_mismatch_color = error_color;
+ const Color current_line_color = alpha1;
+ const Color line_length_guideline_color = warning_color;
+ const Color word_highlighted_color = alpha1;
+ const Color number_color = basetype_color.linear_interpolate(mono_color, dark_theme ? 0.5 : 0.3);
+ const Color function_color = main_color;
+ const Color member_variable_color = mono_color;
+ const Color mark_color = Color(error_color.r, error_color.g, error_color.b, 0.3);
+ const Color breakpoint_color = error_color;
+ const Color search_result_color = alpha1;
+ const Color search_result_border_color = alpha4;
+
+ theme->set_color("text_editor/theme/symbol_color", "Editor", symbol_color);
+ theme->set_color("text_editor/theme/keyword_color", "Editor", keyword_color);
+ theme->set_color("text_editor/theme/basetype_color", "Editor", basetype_color);
+ theme->set_color("text_editor/theme/type_color", "Editor", type_color);
+ theme->set_color("text_editor/theme/comment_color", "Editor", comment_color);
+ theme->set_color("text_editor/theme/string_color", "Editor", string_color);
+ theme->set_color("text_editor/theme/background_color", "Editor", te_background_color);
+ theme->set_color("text_editor/theme/completion_background_color", "Editor", completion_background_color);
+ theme->set_color("text_editor/theme/completion_selected_color", "Editor", completion_selected_color);
+ theme->set_color("text_editor/theme/completion_existing_color", "Editor", completion_existing_color);
+ theme->set_color("text_editor/theme/completion_scroll_color", "Editor", completion_scroll_color);
+ theme->set_color("text_editor/theme/completion_font_color", "Editor", completion_font_color);
+ theme->set_color("text_editor/theme/text_color", "Editor", text_color);
+ theme->set_color("text_editor/theme/line_number_color", "Editor", line_number_color);
+ theme->set_color("text_editor/theme/caret_color", "Editor", caret_color);
+ theme->set_color("text_editor/theme/caret_background_color", "Editor", caret_background_color);
+ theme->set_color("text_editor/theme/text_selected_color", "Editor", text_selected_color);
+ theme->set_color("text_editor/theme/selection_color", "Editor", selection_color);
+ theme->set_color("text_editor/theme/brace_mismatch_color", "Editor", brace_mismatch_color);
+ theme->set_color("text_editor/theme/current_line_color", "Editor", current_line_color);
+ theme->set_color("text_editor/theme/line_length_guideline_color", "Editor", line_length_guideline_color);
+ theme->set_color("text_editor/theme/word_highlighted_color", "Editor", word_highlighted_color);
+ theme->set_color("text_editor/theme/number_color", "Editor", number_color);
+ theme->set_color("text_editor/theme/function_color", "Editor", function_color);
+ theme->set_color("text_editor/theme/member_variable_color", "Editor", member_variable_color);
+ theme->set_color("text_editor/theme/mark_color", "Editor", mark_color);
+ theme->set_color("text_editor/theme/breakpoint_color", "Editor", breakpoint_color);
+ theme->set_color("text_editor/theme/search_result_color", "Editor", search_result_color);
+ theme->set_color("text_editor/theme/search_result_border_color", "Editor", search_result_border_color);
+
return theme;
}
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index f0ace864e4..5f9f109a2e 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -1258,11 +1258,11 @@ bool FileSystemDock::can_drop_data_fw(const Point2 &p_point, const Variant &p_da
if (drag_data.has("type") && String(drag_data["type"]) == "favorite") {
//moving favorite around
- TreeItem *ti = tree->get_item_at_pos(p_point);
+ TreeItem *ti = tree->get_item_at_position(p_point);
if (!ti)
return false;
- int what = tree->get_drop_section_at_pos(p_point);
+ int what = tree->get_drop_section_at_position(p_point);
if (ti == tree->get_root()->get_children()) {
return (what == 1); //the parent, first fav
@@ -1288,7 +1288,7 @@ bool FileSystemDock::can_drop_data_fw(const Point2 &p_point, const Variant &p_da
if (p_from == files) {
- int at_pos = files->get_item_at_pos(p_point);
+ int at_pos = files->get_item_at_position(p_point);
if (at_pos != -1) {
String dir = files->get_item_metadata(at_pos);
@@ -1299,7 +1299,7 @@ bool FileSystemDock::can_drop_data_fw(const Point2 &p_point, const Variant &p_da
if (p_from == tree) {
- TreeItem *ti = tree->get_item_at_pos(p_point);
+ TreeItem *ti = tree->get_item_at_position(p_point);
if (!ti)
return false;
String path = ti->get_metadata(0);
@@ -1323,7 +1323,7 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data,
if (drag_data.has("type") && String(drag_data["type"]) == "favorite") {
//moving favorite around
- TreeItem *ti = tree->get_item_at_pos(p_point);
+ TreeItem *ti = tree->get_item_at_position(p_point);
if (!ti)
return;
@@ -1336,7 +1336,7 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data,
swap = swap.substr(0, swap.length() - 1);
}
- int what = tree->get_drop_section_at_pos(p_point);
+ int what = tree->get_drop_section_at_position(p_point);
TreeItem *swap_item = NULL;
@@ -1391,7 +1391,7 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data,
if (p_from == tree) {
- TreeItem *ti = tree->get_item_at_pos(p_point);
+ TreeItem *ti = tree->get_item_at_position(p_point);
if (!ti)
return;
String path = ti->get_metadata(0);
@@ -1406,7 +1406,7 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data,
if (p_from == files) {
String save_path = path;
- int at_pos = files->get_item_at_pos(p_point);
+ int at_pos = files->get_item_at_position(p_point);
if (at_pos != -1) {
String to_dir = files->get_item_metadata(at_pos);
if (to_dir.ends_with("/")) {
@@ -1429,11 +1429,11 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data,
if (p_from == files) {
- int at_pos = files->get_item_at_pos(p_point);
+ int at_pos = files->get_item_at_position(p_point);
ERR_FAIL_COND(at_pos == -1);
to_dir = files->get_item_metadata(at_pos);
} else {
- TreeItem *ti = tree->get_item_at_pos(p_point);
+ TreeItem *ti = tree->get_item_at_position(p_point);
if (!ti)
return;
to_dir = ti->get_metadata(0);
@@ -1812,8 +1812,6 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
display_mode = DISPLAY_THUMBNAILS;
path = "res://";
-
- add_constant_override("separation", 4);
}
FileSystemDock::~FileSystemDock() {
diff --git a/editor/icons/icon_GUI_tab.svg b/editor/icons/icon_GUI_tab.svg
new file mode 100644
index 0000000000..3eed0680c0
--- /dev/null
+++ b/editor/icons/icon_GUI_tab.svg
@@ -0,0 +1,5 @@
+<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)">
+<path transform="translate(0 1044.4)" d="m6 0v8h2v-8h-2zm-5.0137 0.0019531a1 1 0 0 0 -0.69336 0.29102 1 1 0 0 0 0 1.4141l2.293 2.293-2.293 2.293a1 1 0 0 0 0 1.4141 1 1 0 0 0 1.4141 0l3-3a1.0001 1.0001 0 0 0 0 -1.4141l-3-3a1 1 0 0 0 -0.7207 -0.29102z" fill="#fff" fill-opacity=".19608"/>
+</g>
+</svg>
diff --git a/editor/icons/icon_a_r_v_r_camera.svg b/editor/icons/icon_a_r_v_r_camera.svg
new file mode 100644
index 0000000000..a02b4d983c
--- /dev/null
+++ b/editor/icons/icon_a_r_v_r_camera.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="m2 1c-0.55401 0-1 0.446-1 1v7c0 0.554 0.44599 1 1 1h4l1-2c0.24699-0.494 0.44772-1 1-1s0.75301 0.506 1 1l1 2h4c0.55401 0 1-0.446 1-1v-7c0-0.554-0.44599-1-1-1h-12zm2 3a2 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 -2zm8 0a2 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 -2zm-8 7v4h2c0.502 4e-4 0.9265-0.37144 0.99219-0.86914 0.0059-0.047 0.0085325-0.094025 0.0078125-0.14062v-2.9902h-1v3h-1v-3h-1zm5 0v4h1v-1h1v1h1v-1c-7.73e-4 -0.1811-0.05073-0.35867-0.14453-0.51367 0.08369-0.1462 0.14453-0.30573 0.14453-0.48633v-1c0-0.5523-0.4485-1.0293-1-1h-2zm1 1h1v1h-1v-1z" fill="#fc9c9c"/>
+</svg>
diff --git a/editor/icons/icon_area.svg b/editor/icons/icon_area.svg
index 22348d50c1..ac673d10fc 100644
--- a/editor/icons/icon_area.svg
+++ b/editor/icons/icon_area.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="m1 1v2 2h2v-2h2v-2h-4zm10 0v2h2v2h2v-4h-4zm-7 3v2 4 2h8v-2-6h-8zm2 2h4v4h-4v-4zm-5 5v2 2h2 2v-2h-2v-2h-2zm12 0v2h-2v2h4v-2-2h-2z" fill="#fc9c9c" fill-opacity=".99608"/>
+<path transform="translate(0 1036.4)" d="m1 1v2 2h2v-2h2v-2h-4zm10 0v2h2v2h2v-4h-4zm-7 3v2 4 2h8v-2-6h-8zm2 2h4v4h-4v-4zm-5 5v2 2h2 2v-2h-2v-2h-2zm12 0v2h-2v2h4v-2-2h-2z" fill="#fc9c9c"/>
</g>
</svg>
diff --git a/editor/icons/icon_error.svg b/editor/icons/icon_error.svg
index 771a418cfa..846bd88cb1 100644
--- a/editor/icons/icon_error.svg
+++ b/editor/icons/icon_error.svg
@@ -1,5 +1,5 @@
<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)">
-<rect x="2.2204e-16" y="1044.4" width="8" height="8" ry="4" fill="#ff8484"/>
+<rect x="2.2204e-16" y="1044.4" width="8" height="8" ry="4" fill="#ff5d5d"/>
</g>
</svg>
diff --git a/editor/icons/icon_error_sign.svg b/editor/icons/icon_error_sign.svg
index a2d714c31a..bde0494a93 100644
--- a/editor/icons/icon_error_sign.svg
+++ b/editor/icons/icon_error_sign.svg
@@ -1,7 +1,6 @@
<svg width="32" height="32" version="1.1" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 -1020.4)">
-<path d="m10 1048.4h12l6-6v-12l-6-6h-12l-6 6v12z" fill="#ff8484" fill-rule="evenodd"/>
-<rect x="14" y="1028.4" width="4" height="9" fill="#fff"/>
-<rect x="14" y="1040.4" width="4" height="4" fill="#fff"/>
+<path d="m10 1048.4h12l6-6v-12l-6-6h-12l-6 6v12z" fill="#ff5d5d" fill-rule="evenodd"/>
+<path transform="translate(0 1020.4)" d="m14 8l1 10h2l1-10h-4zm2 12a2 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"/>
</g>
</svg>
diff --git a/editor/icons/icon_file_broken.svg b/editor/icons/icon_file_broken.svg
index f352eeb001..7b05ab625e 100644
--- a/editor/icons/icon_file_broken.svg
+++ b/editor/icons/icon_file_broken.svg
@@ -1,7 +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)">
<g transform="translate(0 -1.6949e-5)">
-<path transform="translate(0 1036.4)" d="m2 1v8.5859l1.293-1.293a1.0001 1.0001 0 0 1 0.69141 -0.29102 1.0001 1.0001 0 0 1 0.72266 0.29102l2.293 2.293 2.293-2.293a1.0001 1.0001 0 0 1 1.4141 0l2.293 2.293 1-1v-3.5859h-5v-5h-7zm8 0v4h4l-4-4zm-6 9.4141l-2 2v2.5859h12v-2.5859l-0.29297 0.29297a1.0001 1.0001 0 0 1 -1.4141 0l-2.293-2.293-2.293 2.293a1.0001 1.0001 0 0 1 -1.4141 0l-2.293-2.293z" fill="#ff8484"/>
+<path transform="translate(0 1036.4)" d="m2 1v8.5859l1.293-1.293a1.0001 1.0001 0 0 1 0.69141 -0.29102 1.0001 1.0001 0 0 1 0.72266 0.29102l2.293 2.293 2.293-2.293a1.0001 1.0001 0 0 1 1.4141 0l2.293 2.293 1-1v-3.5859h-5v-5h-7zm8 0v4h4l-4-4zm-6 9.4141l-2 2v2.5859h12v-2.5859l-0.29297 0.29297a1.0001 1.0001 0 0 1 -1.4141 0l-2.293-2.293-2.293 2.293a1.0001 1.0001 0 0 1 -1.4141 0l-2.293-2.293z" fill="#ff5d5d"/>
</g>
</g>
</svg>
diff --git a/editor/icons/icon_file_broken_big_thumb.svg b/editor/icons/icon_file_broken_big_thumb.svg
index 167bb1bb5f..5e8fa607c1 100644
--- a/editor/icons/icon_file_broken_big_thumb.svg
+++ b/editor/icons/icon_file_broken_big_thumb.svg
@@ -1,7 +1,7 @@
<svg width="64" height="64" version="1.1" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 -988.36)">
<g transform="translate(0 -1.6949e-5)">
-<path transform="translate(0 988.36)" d="m14 5c-2.1987 0-4 1.8013-4 4v26.172a1.0001 1.0001 0 0 0 1.707 0.70703l3.293-3.293 9.293 9.293a1.0001 1.0001 0 0 0 1.4141 0l9.293-9.293 9.293 9.293a1.0001 1.0001 0 0 0 1.4141 0l8-8a1.0001 1.0001 0 0 0 0.29297 -0.70703v-11.172a1.0001 1.0001 0 0 0 -0.29297 -0.70703l-16-16a1.0001 1.0001 0 0 0 -0.70703 -0.29297h-23zm0 2h22v12c0 2.1987 1.8013 4 4 4h12v9.7578l-7 7-9.293-9.293a1.0001 1.0001 0 0 0 -1.4141 0l-9.293 9.293-9.293-9.293a1.0001 1.0001 0 0 0 -1.4141 0l-2.293 2.293v-23.758c0-1.1253 0.87473-2 2-2zm0.98438 28.83a1.0001 1.0001 0 0 0 -0.69141 0.29297l-4 4a1.0001 1.0001 0 0 0 -0.29297 0.70703v14.17c0 2.1987 1.8013 4 4 4h36c2.1987 0 4-1.8013 4-4v-16.17a1.0001 1.0001 0 0 0 -1.707 -0.70703l-7.293 7.293-9.293-9.293a1.0001 1.0001 0 0 0 -1.4141 0l-9.293 9.293-9.293-9.293a1.0001 1.0001 0 0 0 -0.72266 -0.29297zm0.015625 2.4141l9.293 9.293a1.0001 1.0001 0 0 0 1.4141 0l9.293-9.293 9.293 9.293a1.0001 1.0001 0 0 0 1.4141 0l6.293-6.293v13.756c0 1.1253-0.87473 2-2 2h-36c-1.1253 0-2-0.87473-2-2v-13.756l3-3z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#ff8484" 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 988.36)" d="m14 5c-2.1987 0-4 1.8013-4 4v26.172a1.0001 1.0001 0 0 0 1.707 0.70703l3.293-3.293 9.293 9.293a1.0001 1.0001 0 0 0 1.4141 0l9.293-9.293 9.293 9.293a1.0001 1.0001 0 0 0 1.4141 0l8-8a1.0001 1.0001 0 0 0 0.29297 -0.70703v-11.172a1.0001 1.0001 0 0 0 -0.29297 -0.70703l-16-16a1.0001 1.0001 0 0 0 -0.70703 -0.29297h-23zm0 2h22v12c0 2.1987 1.8013 4 4 4h12v9.7578l-7 7-9.293-9.293a1.0001 1.0001 0 0 0 -1.4141 0l-9.293 9.293-9.293-9.293a1.0001 1.0001 0 0 0 -1.4141 0l-2.293 2.293v-23.758c0-1.1253 0.87473-2 2-2zm0.98438 28.83a1.0001 1.0001 0 0 0 -0.69141 0.29297l-4 4a1.0001 1.0001 0 0 0 -0.29297 0.70703v14.17c0 2.1987 1.8013 4 4 4h36c2.1987 0 4-1.8013 4-4v-16.17a1.0001 1.0001 0 0 0 -1.707 -0.70703l-7.293 7.293-9.293-9.293a1.0001 1.0001 0 0 0 -1.4141 0l-9.293 9.293-9.293-9.293a1.0001 1.0001 0 0 0 -0.72266 -0.29297zm0.015625 2.4141l9.293 9.293a1.0001 1.0001 0 0 0 1.4141 0l9.293-9.293 9.293 9.293a1.0001 1.0001 0 0 0 1.4141 0l6.293-6.293v13.756c0 1.1253-0.87473 2-2 2h-36c-1.1253 0-2-0.87473-2-2v-13.756l3-3z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#ff5d5d" 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>
</g>
</svg>
diff --git a/editor/icons/icon_file_dead.svg b/editor/icons/icon_file_dead.svg
index e0aee6fd90..ec13e7087f 100644
--- a/editor/icons/icon_file_dead.svg
+++ b/editor/icons/icon_file_dead.svg
@@ -1,7 +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)">
<g transform="translate(0 -1.6949e-5)">
-<path transform="translate(0 1036.4)" d="m2 1v14h12v-9h-5v-5zm8 0v4h4zm-6.0078 6c0.1353-0.0020779 0.26567 0.050774 0.36133 0.14648l0.64648 0.64648 0.64648-0.64648c0.09183-0.091882 0.21582-0.14442 0.3457-0.14648 0.1353-0.00208 0.26567 0.050774 0.36133 0.14648 0.19521 0.19525 0.19521 0.51178 0 0.70703l-0.64648 0.64648 0.64648 0.64648c0.19521 0.19525 0.19521 0.51178 0 0.70703-0.19525 0.19521-0.51178 0.19521-0.70703 0l-0.64648-0.64648-0.64648 0.64648c-0.19525 0.19521-0.51178 0.19521-0.70703 0-0.19521-0.19525-0.19521-0.51178 0-0.70703l0.64648-0.64648-0.64648-0.64648c-0.19521-0.19525-0.19521-0.51178 0-0.70703 0.09183-0.091882 0.21582-0.14442 0.3457-0.14648zm6 0c0.1353-0.00208 0.26567 0.050774 0.36133 0.14648l0.64648 0.64648 0.64648-0.64648c0.09183-0.091883 0.21582-0.14442 0.3457-0.14648 0.1353-0.00208 0.26567 0.050774 0.36133 0.14648 0.19521 0.19525 0.19521 0.51178 0 0.70703l-0.64648 0.64648 0.64648 0.64648c0.19521 0.19525 0.19521 0.51178 0 0.70703-0.19525 0.19521-0.51178 0.19521-0.70703 0l-0.64648-0.64648-0.64648 0.64648c-0.19525 0.19521-0.51178 0.19521-0.70703 0-0.19521-0.19525-0.19521-0.51178 0-0.70703l0.64648-0.64648-0.64648-0.64648c-0.19521-0.19525-0.19521-0.51178 0-0.70703 0.09183-0.091882 0.21582-0.14442 0.3457-0.14648zm-6.4922 4h9c0.277 0 0.5 0.223 0.5 0.5s-0.223 0.5-0.5 0.5h-4.5c0 1.1046-0.89543 2-2 2s-2-0.8954-2-2h-0.5c-0.277 0-0.5-0.223-0.5-0.5s0.223-0.5 0.5-0.5zm1.5 1c-1.9e-5 0.5523 0.44771 1 1 1s1-0.4477 1-1z" fill="#ff8484"/>
+<path transform="translate(0 1036.4)" d="m2 1v14h12v-9h-5v-5zm8 0v4h4zm-6.0078 6c0.1353-0.0020779 0.26567 0.050774 0.36133 0.14648l0.64648 0.64648 0.64648-0.64648c0.09183-0.091882 0.21582-0.14442 0.3457-0.14648 0.1353-0.00208 0.26567 0.050774 0.36133 0.14648 0.19521 0.19525 0.19521 0.51178 0 0.70703l-0.64648 0.64648 0.64648 0.64648c0.19521 0.19525 0.19521 0.51178 0 0.70703-0.19525 0.19521-0.51178 0.19521-0.70703 0l-0.64648-0.64648-0.64648 0.64648c-0.19525 0.19521-0.51178 0.19521-0.70703 0-0.19521-0.19525-0.19521-0.51178 0-0.70703l0.64648-0.64648-0.64648-0.64648c-0.19521-0.19525-0.19521-0.51178 0-0.70703 0.09183-0.091882 0.21582-0.14442 0.3457-0.14648zm6 0c0.1353-0.00208 0.26567 0.050774 0.36133 0.14648l0.64648 0.64648 0.64648-0.64648c0.09183-0.091883 0.21582-0.14442 0.3457-0.14648 0.1353-0.00208 0.26567 0.050774 0.36133 0.14648 0.19521 0.19525 0.19521 0.51178 0 0.70703l-0.64648 0.64648 0.64648 0.64648c0.19521 0.19525 0.19521 0.51178 0 0.70703-0.19525 0.19521-0.51178 0.19521-0.70703 0l-0.64648-0.64648-0.64648 0.64648c-0.19525 0.19521-0.51178 0.19521-0.70703 0-0.19521-0.19525-0.19521-0.51178 0-0.70703l0.64648-0.64648-0.64648-0.64648c-0.19521-0.19525-0.19521-0.51178 0-0.70703 0.09183-0.091882 0.21582-0.14442 0.3457-0.14648zm-6.4922 4h9c0.277 0 0.5 0.223 0.5 0.5s-0.223 0.5-0.5 0.5h-4.5c0 1.1046-0.89543 2-2 2s-2-0.8954-2-2h-0.5c-0.277 0-0.5-0.223-0.5-0.5s0.223-0.5 0.5-0.5zm1.5 1c-1.9e-5 0.5523 0.44771 1 1 1s1-0.4477 1-1z" fill="#ff5d5d"/>
</g>
</g>
</svg>
diff --git a/editor/icons/icon_file_dead_big_thumb.svg b/editor/icons/icon_file_dead_big_thumb.svg
index c8aab912f1..2ac8d1e9df 100644
--- a/editor/icons/icon_file_dead_big_thumb.svg
+++ b/editor/icons/icon_file_dead_big_thumb.svg
@@ -1,7 +1,7 @@
<svg width="64" height="64" version="1.1" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 -988.36)">
<g transform="translate(0 -1.6949e-5)">
-<path d="m14 993.36c-2.1987 0-4 1.8013-4 4v46c0 2.1987 1.8013 4 4 4h36c2.1987 0 4-1.8013 4-4v-33h-0.0078c2e-3 -0.2483-0.0793-0.501-0.28516-0.707l-16-16c-0.18788-0.18693-0.44247-0.28939-0.70704-0.28907v-4e-3zm0 2h22v12c0 2.1987 1.8013 4 4 4h12v32c0 1.1253-0.87472 2-2 2h-36c-1.1253 0-2-0.8747-2-2v-46c0-1.1253 0.87472-2 2-2zm2.9512 22.002a1 1 0 0 0 -0.60938 0.2461 1 1 0 0 0 -0.09375 1.4121l2.9238 3.3398-2.9238 3.3418a1 1 0 0 0 0.09375 1.4121 1 1 0 0 0 1.4102 -0.094l2.748-3.1407 2.748 3.1407a1 1 0 0 0 1.4102 0.094 1 1 0 0 0 0.09375 -1.4121l-2.9238-3.3418 2.9238-3.3398a1 1 0 0 0 -0.09375 -1.4121 1 1 0 0 0 -0.63867 -0.2461 1 1 0 0 0 -0.77148 0.3398l-2.748 3.1406-2.748-3.1406a1 1 0 0 0 -0.80078 -0.3398zm23 0a1 1 0 0 0 -0.60938 0.2461 1 1 0 0 0 -0.09375 1.4121l2.9238 3.3398-2.9238 3.3418a1 1 0 0 0 0.09375 1.4121 1 1 0 0 0 1.4102 -0.094l2.748-3.1407 2.748 3.1407a1 1 0 0 0 1.4102 0.094 1 1 0 0 0 0.09375 -1.4121l-2.9238-3.3418 2.9238-3.3398a1 1 0 0 0 -0.09375 -1.4121 1 1 0 0 0 -0.63867 -0.2461 1 1 0 0 0 -0.77148 0.3398l-2.748 3.1406-2.748-3.1406a1 1 0 0 0 -0.80078 -0.3398zm-18.951 13.998a1 1 0 0 0 -1 1 1 1 0 0 0 1 1h3v3c0 2.7527 2.2473 5 5 5s5-2.2473 5-5v-3h9a1 1 0 0 0 1 -1 1 1 0 0 0 -1 -1zm5 2h6v3c0 1.6793-1.3207 3-3 3s-3-1.3207-3-3z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#ff8484" 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="m14 993.36c-2.1987 0-4 1.8013-4 4v46c0 2.1987 1.8013 4 4 4h36c2.1987 0 4-1.8013 4-4v-33h-0.0078c2e-3 -0.2483-0.0793-0.501-0.28516-0.707l-16-16c-0.18788-0.18693-0.44247-0.28939-0.70704-0.28907v-4e-3zm0 2h22v12c0 2.1987 1.8013 4 4 4h12v32c0 1.1253-0.87472 2-2 2h-36c-1.1253 0-2-0.8747-2-2v-46c0-1.1253 0.87472-2 2-2zm2.9512 22.002a1 1 0 0 0 -0.60938 0.2461 1 1 0 0 0 -0.09375 1.4121l2.9238 3.3398-2.9238 3.3418a1 1 0 0 0 0.09375 1.4121 1 1 0 0 0 1.4102 -0.094l2.748-3.1407 2.748 3.1407a1 1 0 0 0 1.4102 0.094 1 1 0 0 0 0.09375 -1.4121l-2.9238-3.3418 2.9238-3.3398a1 1 0 0 0 -0.09375 -1.4121 1 1 0 0 0 -0.63867 -0.2461 1 1 0 0 0 -0.77148 0.3398l-2.748 3.1406-2.748-3.1406a1 1 0 0 0 -0.80078 -0.3398zm23 0a1 1 0 0 0 -0.60938 0.2461 1 1 0 0 0 -0.09375 1.4121l2.9238 3.3398-2.9238 3.3418a1 1 0 0 0 0.09375 1.4121 1 1 0 0 0 1.4102 -0.094l2.748-3.1407 2.748 3.1407a1 1 0 0 0 1.4102 0.094 1 1 0 0 0 0.09375 -1.4121l-2.9238-3.3418 2.9238-3.3398a1 1 0 0 0 -0.09375 -1.4121 1 1 0 0 0 -0.63867 -0.2461 1 1 0 0 0 -0.77148 0.3398l-2.748 3.1406-2.748-3.1406a1 1 0 0 0 -0.80078 -0.3398zm-18.951 13.998a1 1 0 0 0 -1 1 1 1 0 0 0 1 1h3v3c0 2.7527 2.2473 5 5 5s5-2.2473 5-5v-3h9a1 1 0 0 0 1 -1 1 1 0 0 0 -1 -1zm5 2h6v3c0 1.6793-1.3207 3-3 3s-3-1.3207-3-3z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#ff5d5d" 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"/>
</g>
</g>
</svg>
diff --git a/editor/icons/icon_file_dead_medium_thumb.svg b/editor/icons/icon_file_dead_medium_thumb.svg
index 60a456a600..010019ae03 100644
--- a/editor/icons/icon_file_dead_medium_thumb.svg
+++ b/editor/icons/icon_file_dead_medium_thumb.svg
@@ -1,7 +1,7 @@
<svg width="32" height="32" version="1.1" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 -1020.4)">
<g transform="translate(0 -1.6949e-5)">
-<path transform="translate(0 1020.4)" d="m5 1c-1.6447 0-3 1.3553-3 3v24c0 1.6447 1.3553 3 3 3h22c1.6447 0 3-1.3553 3-3v-16.809c-5.1e-5 -0.2652-0.10543-0.51952-0.29297-0.70703l-9.1816-9.1895c-0.18719-0.18825-0.44155-0.29435-0.70703-0.29492h-14.818zm0 2h14v6c0 1.6447 1.3553 3 3 3h6v16c0 0.5713-0.42868 1-1 1h-22c-0.57133 0-1-0.4287-1-1v-24c0-0.5713 0.42867-1 1-1zm1.9863 11.002a1 1 0 0 0 -0.69336 0.29102 1 1 0 0 0 0 1.4141l1.293 1.293-1.293 1.293a1 1 0 0 0 0 1.4141 1 1 0 0 0 1.4141 0l1.293-1.293 1.293 1.293a1 1 0 0 0 1.4141 0 1 1 0 0 0 0 -1.4141l-1.293-1.293 1.293-1.293a1 1 0 0 0 0 -1.4141 1 1 0 0 0 -0.7207 -0.29102 1 1 0 0 0 -0.69336 0.29102l-1.293 1.293-1.293-1.293a1 1 0 0 0 -0.7207 -0.29102zm14 0a1 1 0 0 0 -0.69336 0.29102 1 1 0 0 0 0 1.4141l1.293 1.293-1.293 1.293a1 1 0 0 0 0 1.4141 1 1 0 0 0 1.4141 0l1.293-1.293 1.293 1.293a1 1 0 0 0 1.4141 0 1 1 0 0 0 0 -1.4141l-1.293-1.293 1.293-1.293a1 1 0 0 0 0 -1.4141 1 1 0 0 0 -0.7207 -0.29102 1 1 0 0 0 -0.69336 0.29102l-1.293 1.293-1.293-1.293a1 1 0 0 0 -0.7207 -0.29102zm-13.986 7.998a1 1 0 0 0 -1 1 1 1 0 0 0 1 1h1a4 4 0 0 0 2 3.4648 4 4 0 0 0 4 0 4 4 0 0 0 2 -3.4648h9a1 1 0 0 0 1 -1 1 1 0 0 0 -1 -1h-18zm3 2h4a2 2 0 0 1 -2 2 2 2 0 0 1 -2 -2z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#ff8484" 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 1020.4)" d="m5 1c-1.6447 0-3 1.3553-3 3v24c0 1.6447 1.3553 3 3 3h22c1.6447 0 3-1.3553 3-3v-16.809c-5.1e-5 -0.2652-0.10543-0.51952-0.29297-0.70703l-9.1816-9.1895c-0.18719-0.18825-0.44155-0.29435-0.70703-0.29492h-14.818zm0 2h14v6c0 1.6447 1.3553 3 3 3h6v16c0 0.5713-0.42868 1-1 1h-22c-0.57133 0-1-0.4287-1-1v-24c0-0.5713 0.42867-1 1-1zm1.9863 11.002a1 1 0 0 0 -0.69336 0.29102 1 1 0 0 0 0 1.4141l1.293 1.293-1.293 1.293a1 1 0 0 0 0 1.4141 1 1 0 0 0 1.4141 0l1.293-1.293 1.293 1.293a1 1 0 0 0 1.4141 0 1 1 0 0 0 0 -1.4141l-1.293-1.293 1.293-1.293a1 1 0 0 0 0 -1.4141 1 1 0 0 0 -0.7207 -0.29102 1 1 0 0 0 -0.69336 0.29102l-1.293 1.293-1.293-1.293a1 1 0 0 0 -0.7207 -0.29102zm14 0a1 1 0 0 0 -0.69336 0.29102 1 1 0 0 0 0 1.4141l1.293 1.293-1.293 1.293a1 1 0 0 0 0 1.4141 1 1 0 0 0 1.4141 0l1.293-1.293 1.293 1.293a1 1 0 0 0 1.4141 0 1 1 0 0 0 0 -1.4141l-1.293-1.293 1.293-1.293a1 1 0 0 0 0 -1.4141 1 1 0 0 0 -0.7207 -0.29102 1 1 0 0 0 -0.69336 0.29102l-1.293 1.293-1.293-1.293a1 1 0 0 0 -0.7207 -0.29102zm-13.986 7.998a1 1 0 0 0 -1 1 1 1 0 0 0 1 1h1a4 4 0 0 0 2 3.4648 4 4 0 0 0 4 0 4 4 0 0 0 2 -3.4648h9a1 1 0 0 0 1 -1 1 1 0 0 0 -1 -1h-18zm3 2h4a2 2 0 0 1 -2 2 2 2 0 0 1 -2 -2z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#ff5d5d" 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>
</g>
</svg>
diff --git a/editor/icons/icon_gui_close_customizable.svg b/editor/icons/icon_gui_close_customizable.svg
new file mode 100644
index 0000000000..ac023b7030
--- /dev/null
+++ b/editor/icons/icon_gui_close_customizable.svg
@@ -0,0 +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="m3.7578 2.3438l-1.4141 1.4141 4.2422 4.2422-4.2422 4.2422 1.4141 1.4141 4.2422-4.2422 4.2422 4.2422 1.4141-1.4141-4.2422-4.2422 4.2422-4.2422-1.4141-1.4141-4.2422 4.2422-4.2422-4.2422z" fill="#fff" fill-opacity=".89804"/>
+</g>
+</svg>
diff --git a/editor/icons/icon_gui_graph_node_port.svg b/editor/icons/icon_gui_graph_node_port.svg
new file mode 100644
index 0000000000..1120218844
--- /dev/null
+++ b/editor/icons/icon_gui_graph_node_port.svg
@@ -0,0 +1,5 @@
+<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)">
+<circle cx="5" cy="1047.4" r="5" fill="#fff" fill-rule="evenodd"/>
+</g>
+</svg>
diff --git a/editor/icons/icon_gui_resizer.svg b/editor/icons/icon_gui_resizer.svg
new file mode 100644
index 0000000000..d9af047213
--- /dev/null
+++ b/editor/icons/icon_gui_resizer.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="m11 3c-0.55228 0-1 0.44772-1 1v6h-6c-0.55228 0-1 0.44772-1 1s0.44772 1 1 1h7c0.55226-5.5e-5 0.99994-0.44774 1-1v-7c0-0.55228-0.44772-1-1-1z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#fff" fill-opacity=".58824" 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"/>
+</svg>
diff --git a/editor/icons/icon_import_check.svg b/editor/icons/icon_import_check.svg
index e3ad9ec37e..c9f51bb6e0 100644
--- a/editor/icons/icon_import_check.svg
+++ b/editor/icons/icon_import_check.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 d="m2 1044.4 4 4 8-8" fill="none" stroke="#84ffb1" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
+<path d="m2 1044.4 4 4 8-8" fill="none" stroke="#45ff8b" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
</g>
</svg>
diff --git a/editor/icons/icon_import_fail.svg b/editor/icons/icon_import_fail.svg
index e088126043..f4aa212c20 100644
--- a/editor/icons/icon_import_fail.svg
+++ b/editor/icons/icon_import_fail.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="m2.9902 1.9902a1.0001 1.0001 0 0 0 -0.69727 1.7168l4.293 4.293-4.293 4.293a1.0001 1.0001 0 1 0 1.4141 1.4141l4.293-4.293 4.293 4.293a1.0001 1.0001 0 1 0 1.4141 -1.4141l-4.293-4.293 4.293-4.293a1.0001 1.0001 0 0 0 -0.72656 -1.7148 1.0001 1.0001 0 0 0 -0.6875 0.30078l-4.293 4.293-4.293-4.293a1.0001 1.0001 0 0 0 -0.7168 -0.30273z" color="#000000" color-rendering="auto" fill="#ff8484" 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"/>
+<path transform="translate(0 1036.4)" d="m2.9902 1.9902a1.0001 1.0001 0 0 0 -0.69727 1.7168l4.293 4.293-4.293 4.293a1.0001 1.0001 0 1 0 1.4141 1.4141l4.293-4.293 4.293 4.293a1.0001 1.0001 0 1 0 1.4141 -1.4141l-4.293-4.293 4.293-4.293a1.0001 1.0001 0 0 0 -0.72656 -1.7148 1.0001 1.0001 0 0 0 -0.6875 0.30078l-4.293 4.293-4.293-4.293a1.0001 1.0001 0 0 0 -0.7168 -0.30273z" color="#000000" color-rendering="auto" fill="#ff5d5d" 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>
</svg>
diff --git a/editor/icons/icon_key_invalid.svg b/editor/icons/icon_key_invalid.svg
index f1df51f7c3..742859bac5 100644
--- a/editor/icons/icon_key_invalid.svg
+++ b/editor/icons/icon_key_invalid.svg
@@ -1,5 +1,5 @@
<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)">
-<path d="m0.46447 1046.2 2.1213 2.1213-2.1213 2.1213 1.4142 1.4142l2.1213-2.1213 2.1213 2.1213 1.4142-1.4142-2.1213-2.1213 2.1213-2.1213-1.4142-1.4142-2.1213 2.1213-2.1213-2.1213-1.4142 1.4142z" fill="#ff8484"/>
+<path d="m0.46447 1046.2 2.1213 2.1213-2.1213 2.1213 1.4142 1.4142l2.1213-2.1213 2.1213 2.1213 1.4142-1.4142-2.1213-2.1213 2.1213-2.1213-1.4142-1.4142-2.1213 2.1213-2.1213-2.1213-1.4142 1.4142z" fill="#ff5d5d"/>
</g>
</svg>
diff --git a/editor/icons/icon_key_move_disabled.svg b/editor/icons/icon_key_move_disabled.svg
new file mode 100644
index 0000000000..05c158dc3c
--- /dev/null
+++ b/editor/icons/icon_key_move_disabled.svg
@@ -0,0 +1,4 @@
+<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
new file mode 100644
index 0000000000..2d455f2d81
--- /dev/null
+++ b/editor/icons/icon_key_move_enabled.svg
@@ -0,0 +1,4 @@
+<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>
diff --git a/editor/icons/icon_key_rotate_disabled.svg b/editor/icons/icon_key_rotate_disabled.svg
new file mode 100644
index 0000000000..6394bfd82d
--- /dev/null
+++ b/editor/icons/icon_key_rotate_disabled.svg
@@ -0,0 +1,4 @@
+<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
new file mode 100644
index 0000000000..1dcb12c8ab
--- /dev/null
+++ b/editor/icons/icon_key_rotate_enabled.svg
@@ -0,0 +1,4 @@
+<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>
diff --git a/editor/icons/icon_key_scale_disabled.svg b/editor/icons/icon_key_scale_disabled.svg
new file mode 100644
index 0000000000..9601e4925b
--- /dev/null
+++ b/editor/icons/icon_key_scale_disabled.svg
@@ -0,0 +1,4 @@
+<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
new file mode 100644
index 0000000000..f00f3db35f
--- /dev/null
+++ b/editor/icons/icon_key_scale_enabled.svg
@@ -0,0 +1,4 @@
+<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>
diff --git a/editor/icons/icon_node_warning.svg b/editor/icons/icon_node_warning.svg
index 5c03bad343..66663f7d62 100644
--- a/editor/icons/icon_node_warning.svg
+++ b/editor/icons/icon_node_warning.svg
@@ -1,7 +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)">
<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="#ffd684" 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"/>
+<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>
</svg>
diff --git a/editor/icons/icon_sample_library.svg b/editor/icons/icon_sample_library.svg
index b5ec2bb43c..403ea5ff42 100644
--- a/editor/icons/icon_sample_library.svg
+++ b/editor/icons/icon_sample_library.svg
@@ -1,6 +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="#ff8484">
-<path transform="translate(0 1036.4)" d="m9 8v1 5 1h5c0.55228 0 1-0.44772 1-1v-5c0-0.55228-0.44772-1-1-1v4l-1-1-1 1v-4z"/>
-<path d="m7.0215 1037.4a1.0001 1.0001 0 0 0 -1 0.875l-0.58984 4.7226-0.52344-1.0468a1.0001 1.0001 0 0 0 -0.89453 -0.5528h-2a1.0001 1.0001 0 1 0 0 2h1.3828l1.7227 3.4473a1.0001 1.0001 0 0 0 1.8867 -0.3223l0.58984-4.7226 0.52344 1.0449a1.0001 1.0001 0 0 0 0.89453 0.5527h3a1.0001 1.0001 0 1 0 0 -2h-2.3809l-1.7246-3.4472a1.0001 1.0001 0 0 0 -0.88672 -0.5508z" color="#000000" color-rendering="auto" 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 -1036.4)">
+<path transform="translate(0 1036.4)" d="m7.0215 1.002a1.0001 1.0001 0 0 0 -1 0.875l-0.58984 4.7227-0.52344-1.0469a1.0001 1.0001 0 0 0 -0.89453 -0.55273h-2a1.0001 1.0001 0 1 0 0 2h1.3828l1.7227 3.4473a1.0001 1.0001 0 0 0 1.8867 -0.32227l0.58984-4.7227 0.52344 1.0449a1.0001 1.0001 0 0 0 0.89453 0.55273h3a1.0001 1.0001 0 1 0 0 -2h-2.3809l-1.7246-3.4473a1.0001 1.0001 0 0 0 -0.88672 -0.55078zm1.9785 6.998v1 5 1h5c0.55228 0 1-0.44772 1-1v-5c0-0.55228-0.44772-1-1-1v4l-1-1-1 1v-4h-3z" fill="#ff8484"/>
</g>
</svg>
diff --git a/editor/icons/icon_slider_joint.svg b/editor/icons/icon_slider_joint.svg
index 479323bf9a..d1469058d1 100644
--- a/editor/icons/icon_slider_joint.svg
+++ b/editor/icons/icon_slider_joint.svg
@@ -1,10 +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 d="m3 1051.4h5l-1-4z" fill="#fc9c9c" fill-opacity=".99608"/>
-<path d="m6 1048.4 9-9v3l-8 8z" fill="#fb9b9b"/>
-<path d="m10 1040.4-9 9v-3l8-8z" fill="#fb9b9b"/>
-<path d="m13 1037.4h-5l1 4z" fill="#fc9c9c" fill-opacity=".99608"/>
-<path d="m10 1038.4h-5" fill="none" stroke="#fb9b9b" stroke-linecap="round" stroke-width="2"/>
-<path d="m11 1050.4h-5" fill="none" stroke="#fb9b9b" stroke-linecap="round" stroke-width="2"/>
+<path transform="translate(0 1036.4)" d="m5 1c-0.55228 0-1 0.44772-1 1s0.44772 1 1 1h3l-7 7v3l12-12zm10 2-12 12h8c0.55228 0 1-0.44772 1-1s-0.44772-1-1-1h-3l7-7z" fill="#fc9c9c"/>
</g>
</svg>
diff --git a/editor/icons/icon_snap.svg b/editor/icons/icon_snap.svg
index b1f36cfe43..0195f7cfc6 100644
--- a/editor/icons/icon_snap.svg
+++ b/editor/icons/icon_snap.svg
@@ -1,10 +1,93 @@
-<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 d="m3 1036.4v3h-3v2h3v4h-3v2h3v3h2v-3-2-4h4 2 3v-2h-3v-3h-2v3h-4v-3h-2z" fill="#f3f3f3"/>
-<path d="m11 1043.4a4 4 0 0 0 -4 4h2a2 2 0 0 1 2 -2 2 2 0 0 1 2 2h2a4 4 0 0 0 -4 -4z" fill="#ff8484"/>
-<rect x="7" y="1047.4" width="2" height="2" fill="#ff8484"/>
-<rect x="13" y="1047.4" width="2" height="2" fill="#ff8484"/>
-<rect x="7" y="1049.4" width="2" height="2" fill="#fff"/>
-<rect x="13" y="1049.4" width="2" height="2" fill="#fff"/>
-</g>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<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"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg848"
+ sodipodi:docname="icon_snap.svg"
+ inkscape:version="0.92.2 5c3e80d, 2017-08-06">
+ <metadata
+ id="metadata854">
+ <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>
+ <defs
+ id="defs852" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="2558"
+ inkscape:window-height="1422"
+ id="namedview850"
+ showgrid="true"
+ inkscape:pagecheckerboard="true"
+ inkscape:zoom="26.317631"
+ inkscape:cx="-14.078109"
+ inkscape:cy="-1.3201296"
+ inkscape:window-x="1366"
+ inkscape:window-y="16"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg848">
+ <inkscape:grid
+ type="xygrid"
+ id="grid862" />
+ </sodipodi:namedview>
+ <path
+ style="fill:#ff8484;stroke-width:1.48039925"
+ inkscape:connector-curvature="0"
+ id="path836"
+ d="m 3.9501321,14.20668 a 5.9215969,5.9215969 0 0 0 8.0890509,-2.167455 l -2.5641252,-1.4804 A 2.9607985,2.9607985 0 0 1 5.4305313,11.642553 2.9607985,2.9607985 0 0 1 4.3468039,7.5980268 L 1.7826772,6.1176278 A 5.9215969,5.9215969 0 0 0 3.9501321,14.20668 Z" />
+ <rect
+ style="fill:#ff8484;stroke-width:1.48039925"
+ id="rect838"
+ height="2.9607985"
+ width="2.9607985"
+ y="-4.4066463"
+ x="-16.44585"
+ transform="rotate(-150)" />
+ <rect
+ style="fill:#ff8484;stroke-width:1.48039925"
+ id="rect840"
+ height="2.9607985"
+ width="2.9607985"
+ y="-4.4066463"
+ x="-7.5634551"
+ transform="rotate(-150)" />
+ <rect
+ style="fill:#ffffff;stroke-width:1.48039925"
+ id="rect842"
+ height="2.9607985"
+ width="2.9607985"
+ y="-1.4458472"
+ x="-16.44585"
+ transform="rotate(-150)" />
+ <rect
+ style="fill:#ffffff;stroke-width:1.48039925"
+ id="rect844"
+ height="2.9607985"
+ width="2.9607985"
+ y="-1.4458472"
+ x="-7.5634551"
+ transform="rotate(-150)" />
</svg>
diff --git a/editor/icons/icon_snap_grid.svg b/editor/icons/icon_snap_grid.svg
new file mode 100644
index 0000000000..b479496327
--- /dev/null
+++ b/editor/icons/icon_snap_grid.svg
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<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"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg913"
+ sodipodi:docname="icon_snap_grid.svg"
+ inkscape:version="0.92.2 5c3e80d, 2017-08-06">
+ <metadata
+ id="metadata919">
+ <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>
+ <defs
+ id="defs917" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="2558"
+ inkscape:window-height="1422"
+ id="namedview915"
+ showgrid="false"
+ inkscape:pagecheckerboard="true"
+ inkscape:zoom="52.635261"
+ inkscape:cx="6.4374987"
+ inkscape:cy="5.7074131"
+ inkscape:window-x="1366"
+ inkscape:window-y="16"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg913" />
+ <g
+ transform="translate(0 -1036.4)"
+ id="g911">
+ <path
+ d="m3 1036.4v3h-3v2h3v4h-3v2h3v3h2v-3-2-4h4 2 3v-2h-3v-3h-2v3h-4v-3h-2z"
+ fill="#f3f3f3"
+ id="path899" />
+ <path
+ d="m11 1043.4a4 4 0 0 0 -4 4h2a2 2 0 0 1 2 -2 2 2 0 0 1 2 2h2a4 4 0 0 0 -4 -4z"
+ fill="#ff8484"
+ id="path901" />
+ <rect
+ x="7"
+ y="1047.4"
+ width="2"
+ height="2"
+ fill="#ff8484"
+ id="rect903" />
+ <rect
+ x="13"
+ y="1047.4"
+ width="2"
+ height="2"
+ fill="#ff8484"
+ id="rect905" />
+ <rect
+ x="7"
+ y="1049.4"
+ width="2"
+ height="2"
+ fill="#fff"
+ id="rect907" />
+ <rect
+ x="13"
+ y="1049.4"
+ width="2"
+ height="2"
+ fill="#fff"
+ id="rect909" />
+ </g>
+</svg>
diff --git a/editor/icons/icon_warning.svg b/editor/icons/icon_warning.svg
index 455e7b1877..8f6bf2184a 100644
--- a/editor/icons/icon_warning.svg
+++ b/editor/icons/icon_warning.svg
@@ -1,5 +1,5 @@
<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)">
-<rect y="1044.4" width="8" height="8" ry="4" fill="#ffd684"/>
+<rect y="1044.4" width="8" height="8" ry="4" fill="#ffdd65"/>
</g>
</svg>
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index b1991d755b..6ef1758363 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -381,6 +381,9 @@ Error ColladaImport::_create_material(const String &p_target) {
String texfile = effect.get_texture_path(effect.diffuse.texture, collada);
if (texfile != "") {
+ if (texfile.begins_with("/")) {
+ texfile = texfile.replace_first("/", "res://");
+ }
Ref<Texture> texture = ResourceLoader::load(texfile, "Texture");
if (texture.is_valid()) {
@@ -402,6 +405,10 @@ Error ColladaImport::_create_material(const String &p_target) {
String texfile = effect.get_texture_path(effect.specular.texture, collada);
if (texfile != "") {
+ if (texfile.begins_with("/")) {
+ texfile = texfile.replace_first("/", "res://");
+ }
+
Ref<Texture> texture = ResourceLoader::load(texfile, "Texture");
if (texture.is_valid()) {
material->set_texture(SpatialMaterial::TEXTURE_METALLIC, texture);
@@ -425,6 +432,10 @@ Error ColladaImport::_create_material(const String &p_target) {
String texfile = effect.get_texture_path(effect.emission.texture, collada);
if (texfile != "") {
+ if (texfile.begins_with("/")) {
+ texfile = texfile.replace_first("/", "res://");
+ }
+
Ref<Texture> texture = ResourceLoader::load(texfile, "Texture");
if (texture.is_valid()) {
@@ -451,6 +462,10 @@ Error ColladaImport::_create_material(const String &p_target) {
String texfile = effect.get_texture_path(effect.bump.texture, collada);
if (texfile != "") {
+ if (texfile.begins_with("/")) {
+ texfile = texfile.replace_first("/", "res://");
+ }
+
Ref<Texture> texture = ResourceLoader::load(texfile, "Texture");
if (texture.is_valid()) {
material->set_feature(SpatialMaterial::FEATURE_NORMAL_MAPPING, true);
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index cc519c1c4b..6d5ff822ef 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -114,19 +114,19 @@ bool ResourceImporterScene::get_option_visibility(const String &p_option, const
}
int ResourceImporterScene::get_preset_count() const {
- return 6;
+ return PRESET_MAX;
}
String ResourceImporterScene::get_preset_name(int p_idx) const {
switch (p_idx) {
case PRESET_SINGLE_SCENE: return TTR("Import as Single Scene");
- case PRESET_SEPERATE_ANIMATIONS: return TTR("Import with Seperate Animations");
+ case PRESET_SEPARATE_ANIMATIONS: return TTR("Import with Separate Animations");
case PRESET_SEPARATE_MATERIALS: return TTR("Import with Separate Materials");
case PRESET_SEPARATE_MESHES: return TTR("Import with Separate Objects");
case PRESET_SEPARATE_MESHES_AND_MATERIALS: return TTR("Import with Separate Objects+Materials");
- case PRESET_SEPARATE_MESHES_AND_ANIMATIONS: return TTR("Import with Seperate Objects+Animations");
- case PRESET_SEPERATE_MATERIALS_AND_ANIMATIONS: return TTR("Import with Seperate Materials+Animations");
- case PRESET_SEPERATE_MESHES_MATERIALS_AND_ANIMATIONS: return TTR("Import with Seperate Objects+Materials+Animations");
+ case PRESET_SEPARATE_MESHES_AND_ANIMATIONS: return TTR("Import with Separate Objects+Animations");
+ case PRESET_SEPARATE_MATERIALS_AND_ANIMATIONS: return TTR("Import with Separate Materials+Animations");
+ case PRESET_SEPARATE_MESHES_MATERIALS_AND_ANIMATIONS: return TTR("Import with Separate Objects+Materials+Animations");
case PRESET_MULTIPLE_SCENES: return TTR("Import as Multiple Scenes");
case PRESET_MULTIPLE_SCENES_AND_MATERIALS: return TTR("Import as Multiple Scenes+Materials");
}
@@ -954,10 +954,10 @@ void ResourceImporterScene::get_import_options(List<ImportOption> *r_options, in
script_ext_hint += "*." + E->get();
}
- bool materials_out = p_preset == PRESET_SEPARATE_MATERIALS || p_preset == PRESET_SEPARATE_MESHES_AND_MATERIALS || p_preset == PRESET_MULTIPLE_SCENES_AND_MATERIALS || p_preset == PRESET_SEPERATE_MATERIALS_AND_ANIMATIONS || p_preset == PRESET_SEPERATE_MESHES_MATERIALS_AND_ANIMATIONS;
- bool meshes_out = p_preset == PRESET_SEPARATE_MESHES || p_preset == PRESET_SEPARATE_MESHES_AND_MATERIALS || PRESET_SEPARATE_MESHES_AND_ANIMATIONS || PRESET_SEPERATE_MESHES_MATERIALS_AND_ANIMATIONS;
+ bool materials_out = p_preset == PRESET_SEPARATE_MATERIALS || p_preset == PRESET_SEPARATE_MESHES_AND_MATERIALS || p_preset == PRESET_MULTIPLE_SCENES_AND_MATERIALS || p_preset == PRESET_SEPARATE_MATERIALS_AND_ANIMATIONS || p_preset == PRESET_SEPARATE_MESHES_MATERIALS_AND_ANIMATIONS;
+ bool meshes_out = p_preset == PRESET_SEPARATE_MESHES || p_preset == PRESET_SEPARATE_MESHES_AND_MATERIALS || p_preset == PRESET_SEPARATE_MESHES_AND_ANIMATIONS || p_preset == PRESET_SEPARATE_MESHES_MATERIALS_AND_ANIMATIONS;
bool scenes_out = p_preset == PRESET_MULTIPLE_SCENES || p_preset == PRESET_MULTIPLE_SCENES_AND_MATERIALS;
- bool animations_out = p_preset == PRESET_SEPERATE_ANIMATIONS || PRESET_SEPARATE_MESHES_AND_ANIMATIONS || p_preset == PRESET_SEPERATE_MATERIALS_AND_ANIMATIONS || p_preset == PRESET_SEPERATE_MESHES_MATERIALS_AND_ANIMATIONS;
+ bool animations_out = p_preset == PRESET_SEPARATE_ANIMATIONS || p_preset == PRESET_SEPARATE_MESHES_AND_ANIMATIONS || p_preset == PRESET_SEPARATE_MATERIALS_AND_ANIMATIONS || p_preset == PRESET_SEPARATE_MESHES_MATERIALS_AND_ANIMATIONS;
r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "nodes/custom_script", PROPERTY_HINT_FILE, script_ext_hint), ""));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "nodes/storage", PROPERTY_HINT_ENUM, "Single Scene,Instanced Sub-Scenes"), scenes_out ? 1 : 0));
@@ -966,7 +966,7 @@ void ResourceImporterScene::get_import_options(List<ImportOption> *r_options, in
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "materials/keep_on_reimport"), materials_out ? true : false));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "meshes/compress"), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "meshes/ensure_tangents"), true));
- r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "meshes/storage", PROPERTY_HINT_ENUM, "Built-In,Files"), meshes_out ? true : false));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "meshes/storage", PROPERTY_HINT_ENUM, "Built-In,Files"), meshes_out ? 1 : 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "external_files/store_in_subdir"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/import", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "animation/fps", PROPERTY_HINT_RANGE, "1,120,1"), 15));
diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h
index a483c3776f..9c7e791719 100644
--- a/editor/import/resource_importer_scene.h
+++ b/editor/import/resource_importer_scene.h
@@ -85,17 +85,18 @@ class ResourceImporterScene : public ResourceImporter {
enum Presets {
PRESET_SEPARATE_MATERIALS,
PRESET_SEPARATE_MESHES,
- PRESET_SEPERATE_ANIMATIONS,
+ PRESET_SEPARATE_ANIMATIONS,
PRESET_SINGLE_SCENE,
PRESET_SEPARATE_MESHES_AND_MATERIALS,
PRESET_SEPARATE_MESHES_AND_ANIMATIONS,
- PRESET_SEPERATE_MATERIALS_AND_ANIMATIONS,
- PRESET_SEPERATE_MESHES_MATERIALS_AND_ANIMATIONS,
+ PRESET_SEPARATE_MATERIALS_AND_ANIMATIONS,
+ PRESET_SEPARATE_MESHES_MATERIALS_AND_ANIMATIONS,
PRESET_MULTIPLE_SCENES,
PRESET_MULTIPLE_SCENES_AND_MATERIALS,
+ PRESET_MAX
};
void _replace_owner(Node *p_node, Node *p_scene, Node *p_new_owner);
@@ -118,8 +119,9 @@ public:
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 int get_import_order() const { return 100; } //after everything
- void _make_external_resources(Node *p_node, const String &p_base_path, bool p_make_animations, bool p_make_materials, bool p_keep_materials, bool p_make_meshes, Map<Ref<Animation>, Ref<Animation> > &p_animation, Map<Ref<Material>, Ref<Material> > &p_materials, Map<Ref<ArrayMesh>, Ref<ArrayMesh> > &p_meshes);
+ void _make_external_resources(Node *p_node, const String &p_base_path, bool p_make_animations, bool p_make_materials, bool p_keep_materials, bool p_make_meshes, Map<Ref<Animation>, Ref<Animation> > &p_animations, Map<Ref<Material>, Ref<Material> > &p_materials, Map<Ref<ArrayMesh>, Ref<ArrayMesh> > &p_meshes);
Node *_fix_node(Node *p_node, Node *p_root, Map<Ref<ArrayMesh>, Ref<Shape> > &collision_map);
diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp
index 025dbbaacf..bd15ed535b 100644
--- a/editor/import/resource_importer_wav.cpp
+++ b/editor/import/resource_importer_wav.cpp
@@ -141,7 +141,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
/* chunk size */
uint32_t chunksize = file->get_32();
- uint32_t file_pos = file->get_pos(); //save file pos, so we can skip to next chunk safely
+ uint32_t file_pos = file->get_position(); //save file pos, so we can skip to next chunk safely
if (file->eof_reached()) {
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index d7762a66df..de905d80ef 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -76,14 +76,14 @@ void AnimationPlayerEditor::_notification(int p_what) {
}
}
}
- frame->set_value(player->get_current_animation_pos());
- key_editor->set_anim_pos(player->get_current_animation_pos());
+ frame->set_value(player->get_current_animation_position());
+ key_editor->set_anim_pos(player->get_current_animation_position());
EditorNode::get_singleton()->get_property_editor()->refresh();
} else if (last_active) {
//need the last frame after it stopped
- frame->set_value(player->get_current_animation_pos());
+ frame->set_value(player->get_current_animation_position());
}
last_active = player->is_playing();
@@ -103,13 +103,11 @@ void AnimationPlayerEditor::_notification(int p_what) {
get_tree()->connect("node_removed", this, "_node_removed");
add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel"));
- add_constant_override("separation", get_constant("separation", "VBoxContainer"));
} break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel"));
- add_constant_override("separation", get_constant("separation", "VBoxContainer"));
} break;
case NOTIFICATION_THEME_CHANGED: {
@@ -199,7 +197,7 @@ void AnimationPlayerEditor::_play_from_pressed() {
if (current != "") {
- float time = player->get_current_animation_pos();
+ float time = player->get_current_animation_position();
if (current == player->get_current_animation() && player->is_playing()) {
@@ -247,7 +245,7 @@ void AnimationPlayerEditor::_play_bw_from_pressed() {
if (current != "") {
- float time = player->get_current_animation_pos();
+ float time = player->get_current_animation_position();
if (current == player->get_current_animation())
player->stop(); //so it wont blend with itself
@@ -946,7 +944,7 @@ void AnimationPlayerEditor::_seek_value_changed(float p_value, bool p_set) {
}
if (player->is_valid() && !p_set) {
- float cpos = player->get_current_animation_pos();
+ float cpos = player->get_current_animation_position();
player->seek_delta(pos, pos - cpos);
} else {
diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp
index 054124da8f..4dd877a6ee 100644
--- a/editor/plugins/animation_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_tree_editor_plugin.cpp
@@ -63,7 +63,7 @@ Size2 AnimationTreeEditor::_get_maximum_size() {
for (List<StringName>::Element *E = order.front(); E; E = E->next()) {
- Point2 pos = anim_tree->node_get_pos(E->get());
+ Point2 pos = anim_tree->node_get_position(E->get());
if (click_type == CLICK_NODE && click_node == E->get()) {
@@ -257,7 +257,7 @@ void AnimationTreeEditor::_popup_edit_dialog() {
filter_button->hide();
edit_check->hide();
- Point2 pos = anim_tree->node_get_pos(edited_node) - Point2(h_scroll->get_value(), v_scroll->get_value());
+ Point2 pos = anim_tree->node_get_position(edited_node) - Point2(h_scroll->get_value(), v_scroll->get_value());
Ref<StyleBox> style = get_stylebox("panel", "PopupMenu");
Size2 size = get_node_size(edited_node);
Point2 popup_pos(pos.x + style->get_margin(MARGIN_LEFT), pos.y + size.y - style->get_margin(MARGIN_BOTTOM));
@@ -476,10 +476,10 @@ void AnimationTreeEditor::_draw_node(const StringName &p_node) {
Color font_color = get_color("font_color", "PopupMenu");
Color font_color_title = get_color("font_color_hover", "PopupMenu");
font_color_title.a *= 0.8;
- Ref<Texture> slot_icon = get_icon("NodeRealSlot", "EditorIcons");
+ Ref<Texture> slot_icon = get_icon("VisualShaderPort", "EditorIcons");
Size2 size = get_node_size(p_node);
- Point2 pos = anim_tree->node_get_pos(p_node);
+ Point2 pos = anim_tree->node_get_position(p_node);
if (click_type == CLICK_NODE && click_node == p_node) {
pos += click_motion - click_pos;
@@ -599,7 +599,7 @@ void AnimationTreeEditor::_draw_node(const StringName &p_node) {
if (editable) {
- Ref<Texture> arrow = get_icon("arrow", "Tree");
+ Ref<Texture> arrow = get_icon("GuiDropdown", "EditorIcons");
Point2 arrow_ofs(w - arrow->get_width(), Math::floor((h - arrow->get_height()) / 2));
arrow->draw(ci, ofs + arrow_ofs);
}
@@ -618,7 +618,7 @@ AnimationTreeEditor::ClickType AnimationTreeEditor::_locate_click(const Point2 &
AnimationTreePlayer::NodeType type = anim_tree->node_get_type(node);
- Point2 pos = anim_tree->node_get_pos(node);
+ Point2 pos = anim_tree->node_get_position(node);
Size2 size = get_node_size(node);
pos -= Point2(h_scroll->get_value(), v_scroll->get_value());
@@ -671,10 +671,10 @@ Point2 AnimationTreeEditor::_get_slot_pos(const StringName &p_node_id, bool p_in
Ref<StyleBox> style = get_stylebox("panel", "PopupMenu");
Ref<Font> font = get_font("font", "PopupMenu");
- Ref<Texture> slot_icon = get_icon("NodeRealSlot", "EditorIcons");
+ Ref<Texture> slot_icon = get_icon("VisualShaderPort", "EditorIcons");
Size2 size = get_node_size(p_node_id);
- Point2 pos = anim_tree->node_get_pos(p_node_id);
+ Point2 pos = anim_tree->node_get_position(p_node_id);
if (click_type == CLICK_NODE && click_node == p_node_id) {
@@ -806,12 +806,12 @@ void AnimationTreeEditor::_gui_input(Ref<InputEvent> p_event) {
} break;
case CLICK_NODE: {
- Point2 new_pos = anim_tree->node_get_pos(click_node) + (click_motion - click_pos);
+ Point2 new_pos = anim_tree->node_get_position(click_node) + (click_motion - click_pos);
if (new_pos.x < 5)
new_pos.x = 5;
if (new_pos.y < 5)
new_pos.y = 5;
- anim_tree->node_set_pos(click_node, new_pos);
+ anim_tree->node_set_position(click_node, new_pos);
} break;
default: {}
@@ -1081,7 +1081,7 @@ StringName AnimationTreeEditor::_add_node(int p_item) {
}
anim_tree->add_node((AnimationTreePlayer::NodeType)p_item, name);
- anim_tree->node_set_pos(name, Point2(last_x, last_y));
+ anim_tree->node_set_position(name, Point2(last_x, last_y));
order.push_back(name);
last_x += 10;
last_y += 10;
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index ad01d0a31e..bb25576007 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -53,6 +53,8 @@
#define MIN_ZOOM 0.01
#define MAX_ZOOM 100
+#define RULER_WIDTH 15 * EDSCALE
+
class SnapDialog : public ConfirmationDialog {
GDCLASS(SnapDialog, ConfirmationDialog);
@@ -109,13 +111,13 @@ public:
label->set_h_size_flags(SIZE_EXPAND_FILL);
grid_step_x = memnew(SpinBox);
- grid_step_x->set_min(-SPIN_BOX_GRID_RANGE);
+ grid_step_x->set_min(0.01);
grid_step_x->set_max(SPIN_BOX_GRID_RANGE);
grid_step_x->set_suffix("px");
child_container->add_child(grid_step_x);
grid_step_y = memnew(SpinBox);
- grid_step_y->set_min(-SPIN_BOX_GRID_RANGE);
+ grid_step_y->set_min(0.01);
grid_step_y->set_max(SPIN_BOX_GRID_RANGE);
grid_step_y->set_suffix("px");
child_container->add_child(grid_step_y);
@@ -149,7 +151,7 @@ public:
child_container->add_child(rotation_step);
}
- void set_fields(const Point2 p_grid_offset, const Size2 p_grid_step, const float p_rotation_offset, const float p_rotation_step) {
+ void set_fields(const Point2 p_grid_offset, const Point2 p_grid_step, const float p_rotation_offset, const float p_rotation_step) {
grid_offset_x->set_value(p_grid_offset.x);
grid_offset_y->set_value(p_grid_offset.y);
grid_step_x->set_value(p_grid_step.x);
@@ -158,11 +160,9 @@ public:
rotation_step->set_value(p_rotation_step * (180 / Math_PI));
}
- void get_fields(Point2 &p_grid_offset, Size2 &p_grid_step, float &p_rotation_offset, float &p_rotation_step) {
- p_grid_offset.x = grid_offset_x->get_value();
- p_grid_offset.y = grid_offset_y->get_value();
- p_grid_step.x = grid_step_x->get_value();
- p_grid_step.y = grid_step_y->get_value();
+ void get_fields(Point2 &p_grid_offset, Point2 &p_grid_step, float &p_rotation_offset, float &p_rotation_step) {
+ p_grid_offset = Point2(grid_offset_x->get_value(), grid_offset_y->get_value());
+ p_grid_step = Point2(grid_step_x->get_value(), grid_step_y->get_value());
p_rotation_offset = rotation_offset->get_value() / (180 / Math_PI);
p_rotation_step = rotation_step->get_value() / (180 / Math_PI);
}
@@ -222,6 +222,135 @@ void CanvasItemEditor::_edit_set_pivot(const Vector2 &mouse_pos) {
undo_redo->commit_action();
}
+void CanvasItemEditor::_snap_if_closer(Point2 p_value, Point2 p_target_snap, Point2 &r_current_snap, bool (&r_snapped)[2], real_t rotation, float p_radius) {
+ float radius = p_radius / zoom;
+ float dist;
+
+ Transform2D rot_trans = Transform2D(rotation, Point2());
+ p_value = rot_trans.inverse().xform(p_value);
+ p_target_snap = rot_trans.inverse().xform(p_target_snap);
+ r_current_snap = rot_trans.inverse().xform(r_current_snap);
+
+ dist = Math::abs(p_value.x - p_target_snap.x);
+ if (p_radius < 0 || dist < radius && (!r_snapped[0] || dist < Math::abs(r_current_snap.x - p_value.x))) {
+ r_current_snap.x = p_target_snap.x;
+ r_snapped[0] = true;
+ }
+
+ dist = Math::abs(p_value.y - p_target_snap.y);
+ if (p_radius < 0 || dist < radius && (!r_snapped[1] || dist < Math::abs(r_current_snap.y - p_value.y))) {
+ r_current_snap.y = p_target_snap.y;
+ r_snapped[1] = true;
+ }
+
+ r_current_snap = rot_trans.xform(r_current_snap);
+}
+
+void CanvasItemEditor::_snap_other_nodes(Point2 p_value, Point2 &r_current_snap, bool (&r_snapped)[2], const Node *p_current, const CanvasItem *p_to_snap) {
+ const CanvasItem *canvas_item = Object::cast_to<CanvasItem>(p_current);
+ if (canvas_item && p_current != p_to_snap) {
+ Transform2D ci_transform = canvas_item->get_global_transform_with_canvas();
+ Transform2D to_snap_transform = p_to_snap->get_global_transform_with_canvas();
+ if (ci_transform.get_rotation() == to_snap_transform.get_rotation()) {
+ Point2 begin = ci_transform.xform(canvas_item->get_item_rect().get_position());
+ Point2 end = ci_transform.xform(canvas_item->get_item_rect().get_position() + canvas_item->get_item_rect().get_size());
+
+ _snap_if_closer(p_value, begin, r_current_snap, r_snapped, ci_transform.get_rotation());
+ _snap_if_closer(p_value, end, r_current_snap, r_snapped, ci_transform.get_rotation());
+ }
+ }
+ for (int i = 0; i < p_current->get_child_count(); i++) {
+ _snap_other_nodes(p_value, r_current_snap, r_snapped, p_current->get_child(i), p_to_snap);
+ }
+}
+
+Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, const CanvasItem *p_canvas_item, unsigned int p_forced_modes) {
+ Point2 dist[2];
+ bool snapped[2] = { false, false };
+
+ // Smart snap using the canvas position
+ Vector2 output = p_target;
+ real_t rotation = 0.0;
+
+ if (p_canvas_item) {
+ Point2 begin;
+ Point2 end;
+ rotation = p_canvas_item->get_global_transform_with_canvas().get_rotation();
+
+ if ((snap_active && snap_node_parent && (p_modes & SNAP_NODE_PARENT)) || (p_forced_modes & SNAP_NODE_PARENT)) {
+ // Parent sides and center
+ bool can_snap = false;
+ if (const Control *c = Object::cast_to<Control>(p_canvas_item)) {
+ begin = p_canvas_item->get_global_transform_with_canvas().xform(_anchor_to_position(c, Point2(0, 0)));
+ end = p_canvas_item->get_global_transform_with_canvas().xform(_anchor_to_position(c, Point2(1, 1)));
+ can_snap = true;
+ } else if (const CanvasItem *parent_ci = Object::cast_to<CanvasItem>(p_canvas_item->get_parent())) {
+ begin = p_canvas_item->get_transform().affine_inverse().xform(parent_ci->get_item_rect().get_position());
+ end = p_canvas_item->get_transform().affine_inverse().xform(parent_ci->get_item_rect().get_position() + parent_ci->get_item_rect().get_size());
+ can_snap = true;
+ }
+
+ if (can_snap) {
+ _snap_if_closer(p_target, begin, output, snapped, rotation);
+ _snap_if_closer(p_target, (begin + end) / 2.0, output, snapped, rotation);
+ _snap_if_closer(p_target, end, output, snapped, rotation);
+ }
+ }
+
+ // Self anchors (for sides)
+ if ((snap_active && snap_node_anchors && (p_modes & SNAP_NODE_ANCHORS)) || (p_forced_modes & SNAP_NODE_ANCHORS)) {
+ if (const Control *c = Object::cast_to<Control>(p_canvas_item)) {
+ begin = p_canvas_item->get_global_transform_with_canvas().xform(_anchor_to_position(c, Point2(c->get_anchor(MARGIN_LEFT), c->get_anchor(MARGIN_TOP))));
+ end = p_canvas_item->get_global_transform_with_canvas().xform(_anchor_to_position(c, Point2(c->get_anchor(MARGIN_RIGHT), c->get_anchor(MARGIN_BOTTOM))));
+ _snap_if_closer(p_target, begin, output, snapped, rotation);
+ _snap_if_closer(p_target, end, output, snapped, rotation);
+ }
+ }
+
+ // Self sides (for anchors)
+ if ((snap_active && snap_node_sides && (p_modes & SNAP_NODE_SIDES)) || (p_forced_modes & SNAP_NODE_SIDES)) {
+ begin = p_canvas_item->get_global_transform_with_canvas().xform(p_canvas_item->get_item_rect().get_position());
+ end = p_canvas_item->get_global_transform_with_canvas().xform(p_canvas_item->get_item_rect().get_position() + p_canvas_item->get_item_rect().get_size());
+ _snap_if_closer(p_target, begin, output, snapped, rotation);
+ _snap_if_closer(p_target, end, output, snapped, rotation);
+ }
+
+ // Other nodes sides
+ if ((snap_active && snap_other_nodes && (p_modes & SNAP_OTHER_NODES)) || (p_forced_modes & SNAP_OTHER_NODES)) {
+ _snap_other_nodes(p_target, output, snapped, get_tree()->get_edited_scene_root(), p_canvas_item);
+ }
+ }
+
+ if (((snap_active && snap_grid && (p_modes & SNAP_GRID)) || (p_forced_modes & SNAP_GRID)) && rotation == 0.0) {
+ // Grid
+ Point2 offset = grid_offset;
+ if (snap_relative) {
+ List<Node *> &selection = editor_selection->get_selected_node_list();
+ if (selection.size() == 1 && Object::cast_to<Node2D>(selection[0])) {
+ offset = Object::cast_to<Node2D>(selection[0])->get_global_position();
+ } else {
+ offset = _find_topleftmost_point();
+ }
+ }
+ Point2 grid_output;
+ grid_output.x = Math::stepify(p_target.x - offset.x, grid_step.x * Math::pow(2.0, grid_step_multiplier)) + offset.x;
+ grid_output.y = Math::stepify(p_target.y - offset.y, grid_step.y * Math::pow(2.0, grid_step_multiplier)) + offset.y;
+ _snap_if_closer(p_target, grid_output, output, snapped, 0.0, -1.0);
+ }
+
+ if (((snap_pixel && (p_modes & SNAP_PIXEL)) || (p_forced_modes & SNAP_PIXEL)) && rotation == 0.0) {
+ // Pixel
+ output = output.snapped(Size2(1, 1));
+ }
+
+ return output;
+}
+
+float CanvasItemEditor::snap_angle(float p_target, float p_start) const {
+ float offset = snap_relative ? p_start : p_target;
+ return (snap_rotation && snap_rotation_step != 0) ? Math::stepify(p_target - snap_rotation_offset, snap_rotation_step) + snap_rotation_offset : p_target;
+}
+
void CanvasItemEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
Ref<InputEventKey> k = p_ev;
@@ -232,22 +361,34 @@ void CanvasItemEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
if (k->get_control())
return;
- if (k->is_pressed() && !k->is_echo() && k->get_scancode() == KEY_V && drag == DRAG_NONE && can_move_pivot) {
-
- if (k->get_shift()) {
+ if (k->is_pressed() && !k->is_echo()) {
+ if (drag_pivot_shortcut.is_valid() && drag_pivot_shortcut->is_shortcut(p_ev) && drag == DRAG_NONE && can_move_pivot) {
//move drag pivot
drag = DRAG_PIVOT;
- } else if (!Input::get_singleton()->is_mouse_button_pressed(0)) {
-
- List<Node *> &selection = editor_selection->get_selected_node_list();
- Vector2 mouse_pos = viewport->get_local_mouse_pos();
- if (selection.size() && viewport->get_rect().has_point(mouse_pos)) {
- //just in case, make it work if over viewport
- mouse_pos = transform.affine_inverse().xform(mouse_pos);
- mouse_pos = snap_point(mouse_pos);
-
- _edit_set_pivot(mouse_pos);
+ } else if (set_pivot_shortcut.is_valid() && set_pivot_shortcut->is_shortcut(p_ev) && drag == DRAG_NONE && can_move_pivot) {
+ if (!Input::get_singleton()->is_mouse_button_pressed(0)) {
+ List<Node *> &selection = editor_selection->get_selected_node_list();
+ Vector2 mouse_pos = viewport->get_local_mouse_position();
+ if (selection.size() && viewport->get_rect().has_point(mouse_pos)) {
+ //just in case, make it work if over viewport
+ mouse_pos = transform.affine_inverse().xform(mouse_pos);
+ mouse_pos = snap_point(mouse_pos, SNAP_DEFAULT, _get_single_item());
+
+ _edit_set_pivot(mouse_pos);
+ }
}
+ } else if ((snap_grid || show_grid) && multiply_grid_step_shortcut.is_valid() && multiply_grid_step_shortcut->is_shortcut(p_ev)) {
+ // Multiply the grid size
+ grid_step_multiplier = MIN(grid_step_multiplier + 1, 12);
+ viewport_base->update();
+ viewport->update();
+ } else if ((snap_grid || show_grid) && divide_grid_step_shortcut.is_valid() && divide_grid_step_shortcut->is_shortcut(p_ev)) {
+ // Divide the grid size
+ Point2 new_grid_step = grid_step * Math::pow(2.0, grid_step_multiplier - 1);
+ if (new_grid_step.x >= 1.0 && new_grid_step.y >= 1.0)
+ grid_step_multiplier--;
+ viewport_base->update();
+ viewport->update();
}
}
}
@@ -272,38 +413,25 @@ Object *CanvasItemEditor::_get_editor_data(Object *p_what) {
return memnew(CanvasItemEditorSelectedItem);
}
-inline float _snap_scalar(float p_offset, float p_step, bool p_snap_relative, float p_target, float p_start) {
- float offset = p_snap_relative ? p_start : p_offset;
- return p_step != 0 ? Math::stepify(p_target - offset, p_step) + offset : p_target;
-}
-
-Vector2 CanvasItemEditor::snap_point(Vector2 p_target, Vector2 p_start) const {
- if (snap_grid) {
- p_target.x = _snap_scalar(snap_offset.x, snap_step.x, snap_relative, p_target.x, p_start.x);
- p_target.y = _snap_scalar(snap_offset.y, snap_step.y, snap_relative, p_target.y, p_start.y);
- }
- if (snap_pixel)
- p_target = p_target.snapped(Size2(1, 1));
-
- return p_target;
-}
-
-float CanvasItemEditor::snap_angle(float p_target, float p_start) const {
- return snap_rotation ? _snap_scalar(snap_rotation_offset, snap_rotation_step, snap_relative, p_target, p_start) : p_target;
-}
-
Dictionary CanvasItemEditor::get_state() const {
Dictionary state;
state["zoom"] = zoom;
state["ofs"] = Point2(h_scroll->get_value(), v_scroll->get_value());
//state["ofs"]=-transform.get_origin();
- state["snap_offset"] = snap_offset;
- state["snap_step"] = snap_step;
+ state["grid_offset"] = grid_offset;
+ state["grid_step"] = grid_step;
state["snap_rotation_offset"] = snap_rotation_offset;
state["snap_rotation_step"] = snap_rotation_step;
+ state["snap_active"] = snap_active;
+ state["snap_node_parent"] = snap_node_parent;
+ state["snap_node_anchors"] = snap_node_anchors;
+ state["snap_node_sides"] = snap_node_sides;
+ state["snap_other_nodes"] = snap_other_nodes;
state["snap_grid"] = snap_grid;
- state["snap_show_grid"] = snap_show_grid;
+ state["show_grid"] = show_grid;
+ state["show_rulers"] = show_rulers;
+ state["show_helpers"] = show_helpers;
state["snap_rotation"] = snap_rotation;
state["snap_relative"] = snap_relative;
state["snap_pixel"] = snap_pixel;
@@ -324,12 +452,12 @@ void CanvasItemEditor::set_state(const Dictionary &p_state) {
v_scroll->set_value(ofs.y);
}
- if (state.has("snap_step")) {
- snap_step = state["snap_step"];
+ if (state.has("grid_offset")) {
+ grid_offset = state["grid_offset"];
}
- if (state.has("snap_offset")) {
- snap_offset = state["snap_offset"];
+ if (state.has("grid_step")) {
+ grid_step = state["grid_step"];
}
if (state.has("snap_rotation_step")) {
@@ -340,40 +468,81 @@ void CanvasItemEditor::set_state(const Dictionary &p_state) {
snap_rotation_offset = state["snap_rotation_offset"];
}
+ if (state.has("snap_active")) {
+ snap_active = state["snap_active"];
+ snap_button->set_pressed(snap_active);
+ }
+
+ if (state.has("snap_node_parent")) {
+ snap_node_parent = state["snap_node_parent"];
+ int idx = smartsnap_config_popup->get_item_index(SNAP_USE_NODE_PARENT);
+ smartsnap_config_popup->set_item_checked(idx, snap_node_parent);
+ }
+
+ if (state.has("snap_node_anchors")) {
+ snap_node_anchors = state["snap_node_anchors"];
+ int idx = smartsnap_config_popup->get_item_index(SNAP_USE_NODE_ANCHORS);
+ smartsnap_config_popup->set_item_checked(idx, snap_node_anchors);
+ }
+
+ if (state.has("snap_node_sides")) {
+ snap_node_sides = state["snap_node_sides"];
+ int idx = smartsnap_config_popup->get_item_index(SNAP_USE_NODE_SIDES);
+ smartsnap_config_popup->set_item_checked(idx, snap_node_sides);
+ }
+
+ if (state.has("snap_other_nodes")) {
+ snap_other_nodes = state["snap_other_nodes"];
+ int idx = smartsnap_config_popup->get_item_index(SNAP_USE_OTHER_NODES);
+ smartsnap_config_popup->set_item_checked(idx, snap_other_nodes);
+ }
+
if (state.has("snap_grid")) {
snap_grid = state["snap_grid"];
- int idx = edit_menu->get_popup()->get_item_index(SNAP_USE);
- edit_menu->get_popup()->set_item_checked(idx, snap_grid);
+ int idx = snap_config_menu->get_popup()->get_item_index(SNAP_USE_GRID);
+ snap_config_menu->get_popup()->set_item_checked(idx, snap_grid);
+ }
+
+ if (state.has("show_grid")) {
+ show_grid = state["show_grid"];
+ int idx = view_menu->get_popup()->get_item_index(SHOW_GRID);
+ view_menu->get_popup()->set_item_checked(idx, show_grid);
}
- if (state.has("snap_show_grid")) {
- snap_show_grid = state["snap_show_grid"];
- int idx = edit_menu->get_popup()->get_item_index(SNAP_SHOW_GRID);
- edit_menu->get_popup()->set_item_checked(idx, snap_show_grid);
+ if (state.has("show_rulers")) {
+ show_rulers = state["show_rulers"];
+ int idx = view_menu->get_popup()->get_item_index(SHOW_RULERS);
+ view_menu->get_popup()->set_item_checked(idx, show_rulers);
+ }
+
+ if (state.has("show_helpers")) {
+ show_helpers = state["show_helpers"];
+ int idx = view_menu->get_popup()->get_item_index(SHOW_HELPERS);
+ view_menu->get_popup()->set_item_checked(idx, show_helpers);
}
if (state.has("snap_rotation")) {
snap_rotation = state["snap_rotation"];
- int idx = edit_menu->get_popup()->get_item_index(SNAP_USE_ROTATION);
- edit_menu->get_popup()->set_item_checked(idx, snap_rotation);
+ int idx = snap_config_menu->get_popup()->get_item_index(SNAP_USE_ROTATION);
+ snap_config_menu->get_popup()->set_item_checked(idx, snap_rotation);
}
if (state.has("snap_relative")) {
snap_relative = state["snap_relative"];
- int idx = edit_menu->get_popup()->get_item_index(SNAP_RELATIVE);
- edit_menu->get_popup()->set_item_checked(idx, snap_relative);
+ int idx = snap_config_menu->get_popup()->get_item_index(SNAP_RELATIVE);
+ snap_config_menu->get_popup()->set_item_checked(idx, snap_relative);
}
if (state.has("snap_pixel")) {
snap_pixel = state["snap_pixel"];
- int idx = edit_menu->get_popup()->get_item_index(SNAP_USE_PIXEL);
- edit_menu->get_popup()->set_item_checked(idx, snap_pixel);
+ int idx = snap_config_menu->get_popup()->get_item_index(SNAP_USE_PIXEL);
+ snap_config_menu->get_popup()->set_item_checked(idx, snap_pixel);
}
if (state.has("skeleton_show_bones")) {
skeleton_show_bones = state["skeleton_show_bones"];
- int idx = skeleton_menu->get_item_index(SKELETON_SHOW_BONES);
- skeleton_menu->set_item_checked(idx, skeleton_show_bones);
+ int idx = skeleton_menu->get_popup()->get_item_index(SKELETON_SHOW_BONES);
+ skeleton_menu->get_popup()->set_item_checked(idx, skeleton_show_bones);
}
viewport->update();
@@ -495,6 +664,7 @@ void CanvasItemEditor::_select_click_on_empty_area(Point2 p_click_pos, bool p_ap
if (!p_append) {
editor_selection->clear();
viewport->update();
+ viewport_base->update();
};
if (p_box_selection) {
@@ -534,6 +704,7 @@ bool CanvasItemEditor::_select_click_on_item(CanvasItem *item, Point2 p_click_po
}
viewport->update();
+ viewport_base->update();
return still_selected;
}
@@ -566,7 +737,7 @@ void CanvasItemEditor::_key_move(const Vector2 &p_dir, bool p_snap, KeyMoveMODE
Vector2 drag = p_dir;
if (p_snap)
- drag *= snap_step;
+ drag *= grid_step * Math::pow(2.0, grid_step_multiplier);
undo_redo->add_undo_method(canvas_item, "edit_set_state", canvas_item->edit_get_state());
@@ -649,7 +820,7 @@ int CanvasItemEditor::get_item_count() {
return ic;
}
-CanvasItem *CanvasItemEditor::get_single_item() {
+CanvasItem *CanvasItemEditor::_get_single_item() {
Map<Node *, Object *> &selection = editor_selection->get_selection();
@@ -674,7 +845,7 @@ CanvasItem *CanvasItemEditor::get_single_item() {
CanvasItemEditor::DragType CanvasItemEditor::_get_resize_handle_drag_type(const Point2 &p_click, Vector2 &r_point) {
// Returns a drag type if a resize handle is clicked
- CanvasItem *canvas_item = get_single_item();
+ CanvasItem *canvas_item = _get_single_item();
ERR_FAIL_COND_V(!canvas_item, DRAG_NONE);
@@ -738,35 +909,7 @@ CanvasItemEditor::DragType CanvasItemEditor::_get_resize_handle_drag_type(const
return DRAG_NONE;
}
-float CanvasItemEditor::_anchor_snap(float p_anchor, bool *p_snapped, float p_opposite_anchor) {
- bool snapped = false;
- float dist, dist_min = 0.0;
- float radius = 0.05 / zoom;
- float basic_anchors[3] = { 0.0, 0.5, 1.0 };
- for (int i = 0; i < 3; i++) {
- dist = fabs(p_anchor - basic_anchors[i]);
- if (dist < radius) {
- if (!snapped || dist <= dist_min) {
- p_anchor = basic_anchors[i];
- dist_min = dist;
- snapped = true;
- }
- }
- }
- dist = fabs(p_anchor - p_opposite_anchor);
- if (p_opposite_anchor >= 0 && dist < radius) {
- if (!snapped || dist <= dist_min) {
- p_anchor = p_opposite_anchor;
- dist_min = dist;
- snapped = true;
- }
- }
- if (p_snapped)
- *p_snapped = snapped;
- return p_anchor;
-}
-
-Vector2 CanvasItemEditor::_anchor_to_position(Control *p_control, Vector2 anchor) {
+Vector2 CanvasItemEditor::_anchor_to_position(const Control *p_control, Vector2 anchor) {
ERR_FAIL_COND_V(!p_control, Vector2());
Transform2D parent_transform = p_control->get_transform().affine_inverse();
@@ -775,7 +918,7 @@ Vector2 CanvasItemEditor::_anchor_to_position(Control *p_control, Vector2 anchor
return parent_transform.xform(Vector2(parent_size.x * anchor.x, parent_size.y * anchor.y));
}
-Vector2 CanvasItemEditor::_position_to_anchor(Control *p_control, Vector2 position) {
+Vector2 CanvasItemEditor::_position_to_anchor(const Control *p_control, Vector2 position) {
ERR_FAIL_COND_V(!p_control, Vector2());
Size2 parent_size = p_control->get_parent_area_size();
@@ -784,7 +927,7 @@ Vector2 CanvasItemEditor::_position_to_anchor(Control *p_control, Vector2 positi
CanvasItemEditor::DragType CanvasItemEditor::_get_anchor_handle_drag_type(const Point2 &p_click, Vector2 &r_point) {
// Returns a drag type if an anchor handle is clicked
- CanvasItem *canvas_item = get_single_item();
+ CanvasItem *canvas_item = _get_single_item();
ERR_FAIL_COND_V(!canvas_item, DRAG_NONE);
Control *control = Object::cast_to<Control>(canvas_item);
@@ -845,6 +988,8 @@ void CanvasItemEditor::_prepare_drag(const Point2 &p_click_pos) {
se->undo_pivot = Object::cast_to<Node2D>(canvas_item)->edit_get_pivot();
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();
}
if (selection.size() == 1 && Object::cast_to<Node2D>(selection[0])) {
@@ -918,28 +1063,12 @@ void CanvasItemEditor::_append_canvas_item(CanvasItem *p_item) {
}
void CanvasItemEditor::_snap_changed() {
- ((SnapDialog *)snap_dialog)->get_fields(snap_offset, snap_step, snap_rotation_offset, snap_rotation_step);
+ ((SnapDialog *)snap_dialog)->get_fields(grid_offset, grid_step, snap_rotation_offset, snap_rotation_step);
+ grid_step_multiplier = 0;
+ viewport_base->update();
viewport->update();
}
-void CanvasItemEditor::_dialog_value_changed(double) {
-
- if (updating_value_dialog)
- return;
-
- switch (last_option) {
-
- case ZOOM_SET: {
-
- zoom = dialog_val->get_value() / 100.0;
- _update_scroll(0);
- viewport->update();
-
- } break;
- default: {}
- }
-}
-
void CanvasItemEditor::_selection_result_pressed(int p_result) {
if (selection_results.size() <= p_result)
@@ -960,7 +1089,7 @@ void CanvasItemEditor::_selection_menu_hide() {
void CanvasItemEditor::_list_select(const Ref<InputEventMouseButton> &b) {
- Point2 click = b->get_position();
+ Point2 click = viewport_scrollable->get_transform().affine_inverse().xform(b->get_position());
Node *scene = editor->get_edited_scene();
if (!scene)
@@ -1068,7 +1197,7 @@ void CanvasItemEditor::_update_cursor() {
viewport->set_default_cursor_shape(c);
}
-void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
+void CanvasItemEditor::_viewport_base_gui_input(const Ref<InputEvent> &p_event) {
{
EditorNode *en = editor;
@@ -1101,7 +1230,7 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
float prev_zoom = zoom;
zoom = zoom * (1 - (0.05 * b->get_factor()));
{
- Point2 ofs = b->get_position();
+ 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);
@@ -1125,7 +1254,7 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
float prev_zoom = zoom;
zoom = zoom * ((0.95 + (0.05 * b->get_factor())) / 0.95);
{
- Point2 ofs = b->get_position();
+ 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);
@@ -1214,9 +1343,9 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
if (b->get_button_index() == BUTTON_LEFT && tool == TOOL_EDIT_PIVOT) {
if (b->is_pressed()) {
// Set the pivot point
- Point2 mouse_pos = b->get_position();
+ Point2 mouse_pos = viewport_scrollable->get_transform().affine_inverse().xform(b->get_position());
mouse_pos = transform.affine_inverse().xform(mouse_pos);
- mouse_pos = snap_point(mouse_pos);
+ mouse_pos = snap_point(mouse_pos, SNAP_DEFAULT, _get_single_item());
_edit_set_pivot(mouse_pos);
}
return;
@@ -1337,8 +1466,8 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
E->get().to
};
- Vector2 p = Geometry::get_closest_point_to_segment_2d(b->get_position(), s);
- float d = p.distance_to(b->get_position());
+ Vector2 p = Geometry::get_closest_point_to_segment_2d(viewport_scrollable->get_transform().affine_inverse().xform(b->get_position()), s);
+ float d = p.distance_to(viewport_scrollable->get_transform().affine_inverse().xform(b->get_position()));
if (d < bone_width && d < closest_dist) {
Cbone = E;
closest_dist = d;
@@ -1395,12 +1524,12 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
}
// Single selected item
- CanvasItem *canvas_item = get_single_item();
+ CanvasItem *canvas_item = _get_single_item();
if (canvas_item) {
CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
ERR_FAIL_COND(!se);
- Point2 click = b->get_position();
+ Point2 click = viewport_scrollable->get_transform().affine_inverse().xform(b->get_position());
// Rotation
if ((b->get_control() && tool == TOOL_SELECT) || tool == TOOL_ROTATE) {
@@ -1411,6 +1540,7 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
se->undo_pivot = Object::cast_to<Node2D>(canvas_item)->edit_get_pivot();
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();
return;
}
@@ -1432,15 +1562,18 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
se->undo_pivot = Object::cast_to<Node2D>(canvas_item)->edit_get_pivot();
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();
return;
}
// Drag anchor handles
- if (Object::cast_to<Control>(canvas_item)) {
+ Control *control = Object::cast_to<Control>(canvas_item);
+ if (control && show_helpers && !Object::cast_to<Container>(control->get_parent())) {
drag = _get_anchor_handle_drag_type(click, drag_point_from);
if (drag != DRAG_NONE) {
drag_from = transform.affine_inverse().xform(click);
se->undo_state = canvas_item->edit_get_state();
+ se->pre_drag_xform = canvas_item->get_global_transform_with_canvas();
return;
}
}
@@ -1448,7 +1581,7 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
}
// Multiple selected items
- Point2 click = b->get_position();
+ Point2 click = viewport_scrollable->get_transform().affine_inverse().xform(b->get_position());
if ((b->get_alt() || tool == TOOL_MOVE) && get_item_count()) {
// Drag the nodes
@@ -1508,12 +1641,12 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
// Mouse motion event
_update_cursor();
- if (!viewport->has_focus() && (!get_focus_owner() || !get_focus_owner()->is_text_field()))
- viewport->call_deferred("grab_focus");
+ if (!viewport_base->has_focus() && (!get_focus_owner() || !get_focus_owner()->is_text_field()))
+ viewport_base->call_deferred("grab_focus");
if (box_selecting) {
// Update box selection
- box_selecting_to = transform.affine_inverse().xform(m->get_position());
+ box_selecting_to = transform.affine_inverse().xform(viewport_scrollable->get_transform().affine_inverse().xform(m->get_position()));
viewport->update();
return;
}
@@ -1559,7 +1692,7 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
}
Vector2 dfrom = drag_from;
- Vector2 dto = transform.affine_inverse().xform(m->get_position());
+ Vector2 dto = transform.affine_inverse().xform(viewport_scrollable->get_transform().affine_inverse().xform(m->get_position()));
if (canvas_item->has_meta("_edit_lock_"))
continue;
@@ -1593,60 +1726,74 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
continue;
}
+ bool uniform = m->get_shift();
+ bool symmetric = m->get_alt();
+
+ Vector2 drag_vector =
+ canvas_item->get_global_transform_with_canvas().affine_inverse().xform(dto) -
+ canvas_item->get_global_transform_with_canvas().affine_inverse().xform(dfrom);
+
+ switch (drag) {
+ case DRAG_ALL:
+ case DRAG_NODE_2D:
+ dto -= drag_from - drag_point_from;
+ if (uniform) {
+ if (ABS(dto.x - drag_point_from.x) > ABS(dto.y - drag_point_from.y)) {
+ dto.y = drag_point_from.y;
+ } else {
+ dto.x = drag_point_from.x;
+ }
+ }
+ break;
+ }
+
Control *control = Object::cast_to<Control>(canvas_item);
if (control) {
// Drag and snap the anchor
- Vector2 anchor = _position_to_anchor(control, canvas_item->get_global_transform_with_canvas().affine_inverse().xform(dto - drag_from + drag_point_from));
+ Transform2D c_trans_rev = canvas_item->get_global_transform_with_canvas().affine_inverse();
+
+ Vector2 anchor = c_trans_rev.xform(dto - drag_from + drag_point_from);
+ anchor = _position_to_anchor(control, anchor);
+
+ Vector2 anchor_snapped = c_trans_rev.xform(snap_point(dto - drag_from + drag_point_from, SNAP_GRID | SNAP_OTHER_NODES, _get_single_item(), SNAP_NODE_PARENT | SNAP_NODE_SIDES));
+ anchor_snapped = _position_to_anchor(control, anchor_snapped).snapped(Vector2(0.00001, 0.00001));
+
+ bool use_y = Math::abs(drag_vector.y) > Math::abs(drag_vector.x);
switch (drag) {
case DRAG_ANCHOR_TOP_LEFT:
- control->set_anchor(MARGIN_LEFT, _anchor_snap(anchor.x, NULL, control->get_anchor(MARGIN_RIGHT)), false, false);
- control->set_anchor(MARGIN_TOP, _anchor_snap(anchor.y, NULL, control->get_anchor(MARGIN_BOTTOM)), false, false);
+ if (!uniform || (uniform && !use_y)) control->set_anchor(MARGIN_LEFT, anchor_snapped.x);
+ if (!uniform || (uniform && use_y)) control->set_anchor(MARGIN_TOP, anchor_snapped.y);
continue;
break;
case DRAG_ANCHOR_TOP_RIGHT:
- control->set_anchor(MARGIN_RIGHT, _anchor_snap(anchor.x, NULL, control->get_anchor(MARGIN_LEFT)), false, false);
- control->set_anchor(MARGIN_TOP, _anchor_snap(anchor.y, NULL, control->get_anchor(MARGIN_BOTTOM)), false, false);
+ if (!uniform || (uniform && !use_y)) control->set_anchor(MARGIN_RIGHT, anchor_snapped.x);
+ if (!uniform || (uniform && use_y)) control->set_anchor(MARGIN_TOP, anchor_snapped.y);
continue;
break;
case DRAG_ANCHOR_BOTTOM_RIGHT:
- control->set_anchor(MARGIN_RIGHT, _anchor_snap(anchor.x, NULL, control->get_anchor(MARGIN_LEFT)), false, false);
- control->set_anchor(MARGIN_BOTTOM, _anchor_snap(anchor.y, NULL, control->get_anchor(MARGIN_TOP)), false, false);
- continue;
+ if (!uniform || (uniform && !use_y)) control->set_anchor(MARGIN_RIGHT, anchor_snapped.x);
+ if (!uniform || (uniform && use_y)) control->set_anchor(MARGIN_BOTTOM, anchor_snapped.y);
break;
case DRAG_ANCHOR_BOTTOM_LEFT:
- control->set_anchor(MARGIN_LEFT, _anchor_snap(anchor.x, NULL, control->get_anchor(MARGIN_RIGHT)), false, false);
- control->set_anchor(MARGIN_BOTTOM, _anchor_snap(anchor.y, NULL, control->get_anchor(MARGIN_TOP)), false, false);
+ if (!uniform || (uniform && !use_y)) control->set_anchor(MARGIN_LEFT, anchor_snapped.x);
+ if (!uniform || (uniform && use_y)) control->set_anchor(MARGIN_BOTTOM, anchor_snapped.y);
continue;
break;
case DRAG_ANCHOR_ALL:
- control->set_anchor(MARGIN_LEFT, _anchor_snap(anchor.x));
- control->set_anchor(MARGIN_RIGHT, _anchor_snap(anchor.x));
- control->set_anchor(MARGIN_TOP, _anchor_snap(anchor.y));
- control->set_anchor(MARGIN_BOTTOM, _anchor_snap(anchor.y));
+ if (!uniform || (uniform && !use_y)) control->set_anchor(MARGIN_LEFT, anchor_snapped.x);
+ if (!uniform || (uniform && !use_y)) control->set_anchor(MARGIN_RIGHT, anchor_snapped.x);
+ if (!uniform || (uniform && use_y)) control->set_anchor(MARGIN_TOP, anchor_snapped.y);
+ if (!uniform || (uniform && use_y)) control->set_anchor(MARGIN_BOTTOM, anchor_snapped.y);
continue;
break;
}
}
- bool uniform = m->get_shift();
- bool symmetric = m->get_alt();
-
- if (drag == DRAG_ALL || drag == DRAG_NODE_2D)
- dto -= drag_from - drag_point_from;
-
- if (uniform && (drag == DRAG_ALL || drag == DRAG_NODE_2D)) {
- if (ABS(dto.x - drag_point_from.x) > ABS(dto.y - drag_point_from.y)) {
- dto.y = drag_point_from.y;
- } else {
- dto.x = drag_point_from.x;
- }
- }
-
dfrom = drag_point_from;
- dto = snap_point(dto, drag_point_from);
+ dto = snap_point(dto, SNAP_NODE_ANCHORS | SNAP_NODE_PARENT | SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, _get_single_item());
- Vector2 drag_vector =
+ drag_vector =
canvas_item->get_global_transform_with_canvas().affine_inverse().xform(dto) -
canvas_item->get_global_transform_with_canvas().affine_inverse().xform(dfrom);
@@ -1896,56 +2043,148 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
}
}
+void CanvasItemEditor::_draw_text_at_position(Point2 p_position, String p_string, Margin p_side) {
+ Color color = Color(0.8, 0.8, 0.8, 0.5);
+ Ref<Font> font = get_font("font", "Label");
+ Size2 text_size = font->get_string_size(p_string);
+ switch (p_side) {
+ case MARGIN_LEFT:
+ p_position += Vector2(-text_size.x - 5, text_size.y / 2);
+ break;
+ case MARGIN_TOP:
+ p_position += Vector2(-text_size.x / 2, -5);
+ break;
+ case MARGIN_RIGHT:
+ p_position += Vector2(5, text_size.y / 2);
+ break;
+ case MARGIN_BOTTOM:
+ p_position += Vector2(-text_size.x / 2, text_size.y + 5);
+ break;
+ }
+ viewport->draw_string(font, p_position, p_string, color);
+}
+
+void CanvasItemEditor::_draw_margin_at_position(int p_value, Point2 p_position, Margin p_side) {
+ String str = vformat("%d px", p_value);
+ if (p_value != 0) {
+ _draw_text_at_position(p_position, str, p_side);
+ }
+}
+
void CanvasItemEditor::_draw_percentage_at_position(float p_value, Point2 p_position, Margin p_side) {
+ String str = vformat("%.1f %%", p_value * 100.0);
if (p_value != 0) {
- Color color = Color(0.8, 0.8, 0.8, 0.5);
- Ref<Font> font = get_font("font", "Label");
- String str = vformat("%.1f %%", p_value * 100.0);
- Size2 text_size = font->get_string_size(str);
- switch (p_side) {
- case MARGIN_LEFT:
- p_position += Vector2(-text_size.x - 5, text_size.y / 2);
- break;
- case MARGIN_TOP:
- p_position += Vector2(-text_size.x / 2, -5);
- break;
- case MARGIN_RIGHT:
- p_position += Vector2(5, text_size.y / 2);
- break;
- case MARGIN_BOTTOM:
- p_position += Vector2(-text_size.x / 2, text_size.y + 5);
- break;
- }
- viewport->draw_string(font, p_position, str, color);
+ _draw_text_at_position(p_position, str, p_side);
}
}
-void CanvasItemEditor::_viewport_draw() {
+void CanvasItemEditor::_draw_rulers() {
+ Color graduation_color = Color(0.5, 0.5, 0.5, 1);
+ Color bg_color = get_color("dark_color_2", "Editor");
+ Color font_color = Color(0.8, 0.8, 0.8, 1);
+ Ref<Font> font = get_font("rulers", "EditorFonts");
+
+ // The rule transform
+ Transform2D ruler_transform;
+ if (show_grid || snap_grid) {
+ ruler_transform = Transform2D();
+ if (snap_relative && get_item_count() > 0) {
+ ruler_transform.translate(_find_topleftmost_point());
+ ruler_transform.scale_basis(grid_step * Math::pow(2.0, grid_step_multiplier));
+ } else {
+ ruler_transform.translate(grid_offset);
+ ruler_transform.scale_basis(grid_step * Math::pow(2.0, grid_step_multiplier));
+ }
+ while ((transform * ruler_transform).get_scale().x < 50 || (transform * ruler_transform).get_scale().y < 50) {
- // TODO fetch the viewport?
+ ruler_transform.scale_basis(Point2(2, 2));
+ }
+ } else {
+ float basic_rule = 100;
+ for (int i = 0; basic_rule * zoom > 100; i++) {
+ basic_rule /= (i % 2) ? 5.0 : 2.0;
+ }
+ for (int i = 0; basic_rule * zoom < 100; i++) {
+ basic_rule *= (i % 2) ? 2.0 : 5.0;
+ }
+ ruler_transform = Transform2D();
+ ruler_transform.scale(Size2(basic_rule, basic_rule));
+ }
- Ref<Texture> pivot = get_icon("EditorPivot", "EditorIcons");
- _update_scrollbars();
- RID ci = viewport->get_canvas_item();
+ // Subdivisions
+ int major_subdivision = 2;
+ Transform2D major_subdivide = Transform2D();
+ major_subdivide.scale(Size2(1.0 / major_subdivision, 1.0 / major_subdivision));
+
+ int minor_subdivision = 5;
+ Transform2D minor_subdivide = Transform2D();
+ minor_subdivide.scale(Size2(1.0 / minor_subdivision, 1.0 / minor_subdivision));
+
+ // First and last graduations to draw (in the ruler space)
+ Point2 first = (transform * ruler_transform * major_subdivide * minor_subdivide).affine_inverse().xform(Point2());
+ Point2 last = (transform * ruler_transform * major_subdivide * minor_subdivide).affine_inverse().xform(viewport->get_size());
+
+ // Draw top ruler
+ viewport_base->draw_rect(Rect2(Point2(RULER_WIDTH, 0), Size2(viewport->get_size().x, RULER_WIDTH)), bg_color);
+ for (int i = Math::ceil(first.x); i < last.x; i++) {
+ Point2 position = (transform * ruler_transform * major_subdivide * minor_subdivide).xform(Point2(i, 0));
+ if (i % (major_subdivision * minor_subdivision) == 0) {
+ viewport_base->draw_line(Point2(position.x + RULER_WIDTH, 0), Point2(position.x + RULER_WIDTH, RULER_WIDTH), graduation_color);
+ float val = (ruler_transform * major_subdivide * minor_subdivide).xform(Point2(i, 0)).x;
+ viewport_base->draw_string(font, Point2(position.x + RULER_WIDTH + 2, font->get_height()), vformat(((int)val == val) ? "%d" : "%.1f", val), font_color);
+ } else {
+ if (i % minor_subdivision == 0) {
+ viewport_base->draw_line(Point2(position.x + RULER_WIDTH, RULER_WIDTH * 0.33), Point2(position.x + RULER_WIDTH, RULER_WIDTH), graduation_color);
+ } else {
+ viewport_base->draw_line(Point2(position.x + RULER_WIDTH, RULER_WIDTH * 0.66), Point2(position.x + RULER_WIDTH, RULER_WIDTH), graduation_color);
+ }
+ }
+ }
- if (snap_show_grid) {
+ // Draw left ruler
+ viewport_base->draw_rect(Rect2(Point2(0, RULER_WIDTH), Size2(RULER_WIDTH, viewport->get_size().y)), bg_color);
+ for (int i = Math::ceil(first.y); i < last.y; i++) {
+ Point2 position = (transform * ruler_transform * major_subdivide * minor_subdivide).xform(Point2(0, i));
+ if (i % (major_subdivision * minor_subdivision) == 0) {
+ viewport_base->draw_line(Point2(0, position.y + RULER_WIDTH), Point2(RULER_WIDTH, position.y + RULER_WIDTH), graduation_color);
+ float val = (ruler_transform * major_subdivide * minor_subdivide).xform(Point2(0, i)).y;
+ viewport_base->draw_string(font, Point2(2, position.y + RULER_WIDTH + 2 + font->get_height()), vformat(((int)val == val) ? "%d" : "%.1f", val), font_color);
+ } else {
+ if (i % minor_subdivision == 0) {
+ viewport_base->draw_line(Point2(RULER_WIDTH * 0.33, position.y + RULER_WIDTH), Point2(RULER_WIDTH, position.y + RULER_WIDTH), graduation_color);
+ } else {
+ viewport_base->draw_line(Point2(RULER_WIDTH * 0.66, position.y + RULER_WIDTH), Point2(RULER_WIDTH, position.y + RULER_WIDTH), graduation_color);
+ }
+ }
+ }
+ viewport_base->draw_rect(Rect2(Point2(), Size2(RULER_WIDTH, RULER_WIDTH)), graduation_color);
+}
+
+void CanvasItemEditor::_draw_focus() {
+ if (viewport_base->has_focus()) {
+ get_stylebox("Focus", "EditorStyles")->draw(viewport_base->get_canvas_item(), Rect2(Point2(), viewport_base->get_size()));
+ }
+}
+
+void CanvasItemEditor::_draw_grid() {
+ if (show_grid) {
//Draw the grid
Size2 s = viewport->get_size();
int last_cell = 0;
Transform2D xform = transform.affine_inverse();
- Vector2 grid_offset;
- if (snap_relative && snap_grid && get_item_count() > 0) {
+ Vector2 real_grid_offset;
+ if (snap_relative && get_item_count() > 0) {
Vector2 topleft = _find_topleftmost_point();
- grid_offset.x = fmod(topleft.x, snap_step.x);
- grid_offset.y = fmod(topleft.y, snap_step.y);
+ real_grid_offset.x = fmod(topleft.x, grid_step.x * Math::pow(2.0, grid_step_multiplier));
+ real_grid_offset.y = fmod(topleft.y, grid_step.y * Math::pow(2.0, grid_step_multiplier));
} else {
- grid_offset = snap_offset;
+ real_grid_offset = grid_offset;
}
- if (snap_step.x != 0) {
+ if (grid_step.x != 0) {
for (int i = 0; i < s.width; i++) {
- int cell = Math::fast_ftoi(Math::floor((xform.xform(Vector2(i, 0)).x - grid_offset.x) / snap_step.x));
+ int cell = Math::fast_ftoi(Math::floor((xform.xform(Vector2(i, 0)).x - real_grid_offset.x) / (grid_step.x * Math::pow(2.0, grid_step_multiplier))));
if (i == 0)
last_cell = cell;
if (last_cell != cell)
@@ -1954,9 +2193,9 @@ void CanvasItemEditor::_viewport_draw() {
}
}
- if (snap_step.y != 0) {
+ if (grid_step.y != 0) {
for (int i = 0; i < s.height; i++) {
- int cell = Math::fast_ftoi(Math::floor((xform.xform(Vector2(0, i)).y - grid_offset.y) / snap_step.y));
+ int cell = Math::fast_ftoi(Math::floor((xform.xform(Vector2(0, i)).y - real_grid_offset.y) / (grid_step.y * Math::pow(2.0, grid_step_multiplier))));
if (i == 0)
last_cell = cell;
if (last_cell != cell)
@@ -1965,21 +2204,15 @@ void CanvasItemEditor::_viewport_draw() {
}
}
}
+}
- if (viewport->has_focus()) {
- Size2 size = viewport->get_size();
- get_stylebox("Focus", "EditorStyles")->draw(ci, Rect2(Point2(), size));
- }
-
- Ref<Texture> lock = get_icon("Lock", "EditorIcons");
- Ref<Texture> group = get_icon("Group", "EditorIcons");
-
- bool single = get_single_item() != NULL;
-
- Map<Node *, Object *> &selection = editor_selection->get_selection();
-
+void CanvasItemEditor::_draw_selection() {
bool pivot_found = false;
+ Ref<Texture> pivot_icon = get_icon("EditorPivot", "EditorIcons");
+ bool single = _get_single_item() != NULL;
+ RID ci = viewport->get_canvas_item();
+ Map<Node *, Object *> &selection = editor_selection->get_selection();
for (Map<Node *, Object *>::Element *E = selection.front(); E; E = E->next()) {
CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E->key());
@@ -1993,6 +2226,23 @@ void CanvasItemEditor::_viewport_draw() {
Rect2 rect = canvas_item->get_item_rect();
+ if (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))
+ };
+
+ for (int i = 0; i < 4; i++) {
+ viewport->draw_line(pre_drag_endpoints[i], pre_drag_endpoints[(i + 1) % 4], pre_drag_color, 2);
+ }
+ }
+
Transform2D xform = transform * canvas_item->get_global_transform_with_canvas();
VisualServer::get_singleton()->canvas_item_add_set_transform(ci, xform);
@@ -2014,10 +2264,10 @@ void CanvasItemEditor::_viewport_draw() {
if (single && (tool == TOOL_SELECT || tool == TOOL_MOVE || tool == TOOL_ROTATE || tool == TOOL_EDIT_PIVOT)) { //kind of sucks
- if (Object::cast_to<Node2D>(canvas_item)) {
-
- if (Object::cast_to<Node2D>(canvas_item)->edit_has_pivot()) {
- viewport->draw_texture(pivot, xform.get_origin() + (-pivot->get_size() / 2).floor());
+ Node2D *node2d = Object::cast_to<Node2D>(canvas_item);
+ if (node2d) {
+ if (node2d->edit_has_pivot()) {
+ viewport->draw_texture(pivot_icon, xform.get_origin() + (-pivot_icon->get_size() / 2).floor());
can_move_pivot = true;
pivot_found = true;
}
@@ -2027,12 +2277,15 @@ void CanvasItemEditor::_viewport_draw() {
if (control) {
Vector2 pivot_ofs = control->get_pivot_offset();
if (pivot_ofs != Vector2()) {
- viewport->draw_texture(pivot, xform.xform(pivot_ofs) + (-pivot->get_size() / 2).floor());
+ viewport->draw_texture(pivot_icon, xform.xform(pivot_ofs) + (-pivot_icon->get_size() / 2).floor());
}
can_move_pivot = true;
pivot_found = true;
- if (tool == TOOL_SELECT) {
+ if (tool == TOOL_SELECT && show_helpers && !Object::cast_to<Container>(control->get_parent())) {
+ // Draw the helpers
+ Color color_base = Color(0.8, 0.8, 0.8, 0.5);
+
float anchors_values[4];
anchors_values[0] = control->get_anchor(MARGIN_LEFT);
anchors_values[1] = control->get_anchor(MARGIN_TOP);
@@ -2047,6 +2300,7 @@ void CanvasItemEditor::_viewport_draw() {
anchors_pos[i] = xform.xform(_anchor_to_position(control, anchors[i]));
}
+ Map<Node *, Object *> &selection = editor_selection->get_selection();
// Get which anchor is dragged
int dragged_anchor = -1;
switch (drag) {
@@ -2069,7 +2323,6 @@ void CanvasItemEditor::_viewport_draw() {
// Draw the 4 lines when dragged
bool snapped;
Color color_snapped = Color(0.64, 0.93, 0.67, 0.5);
- Color color_base = Color(0.8, 0.8, 0.8, 0.5);
Vector2 corners_pos[4];
for (int i = 0; i < 4; i++) {
@@ -2082,7 +2335,7 @@ void CanvasItemEditor::_viewport_draw() {
float anchor_val = (i >= 2) ? ANCHOR_END - anchors_values[i] : anchors_values[i];
line_starts[i] = Vector2::linear_interpolate(corners_pos[i], corners_pos[(i + 1) % 4], anchor_val);
line_ends[i] = Vector2::linear_interpolate(corners_pos[(i + 3) % 4], corners_pos[(i + 2) % 4], anchor_val);
- _anchor_snap(anchors_values[i], &snapped);
+ snapped = anchors_values[i] == 0.0 || anchors_values[i] == 0.5 || anchors_values[i] == 1.0;
viewport->draw_line(line_starts[i], line_ends[i], snapped ? color_snapped : color_base, (i == dragged_anchor || (i + 3) % 4 == dragged_anchor) ? 2 : 1);
}
@@ -2114,6 +2367,83 @@ void CanvasItemEditor::_viewport_draw() {
for (int i = 0; i < 4; i++) {
anchor_handle->draw_rect(ci, anchor_rects[i]);
}
+
+ // Draw the margin values and the node width/height when dragging control side
+ float ratio = 0.33;
+ Transform2D parent_transform = xform * control->get_transform().affine_inverse();
+ float node_pos_in_parent[4];
+
+ node_pos_in_parent[0] = control->get_anchor(MARGIN_LEFT) * control->get_parent_area_size().width + control->get_margin(MARGIN_LEFT);
+ node_pos_in_parent[1] = control->get_anchor(MARGIN_TOP) * control->get_parent_area_size().height + control->get_margin(MARGIN_TOP);
+ node_pos_in_parent[2] = control->get_anchor(MARGIN_RIGHT) * control->get_parent_area_size().width + control->get_margin(MARGIN_RIGHT);
+ node_pos_in_parent[3] = control->get_anchor(MARGIN_BOTTOM) * control->get_parent_area_size().height + control->get_margin(MARGIN_BOTTOM);
+
+ switch (drag) {
+ case DRAG_LEFT:
+ case DRAG_TOP_LEFT:
+ case DRAG_BOTTOM_LEFT:
+ _draw_margin_at_position(control->get_size().width, parent_transform.xform(Vector2((node_pos_in_parent[0] + node_pos_in_parent[2]) / 2, node_pos_in_parent[3])) + Vector2(0, 5), MARGIN_BOTTOM);
+ case DRAG_ALL:
+ Point2 start = Vector2(node_pos_in_parent[0], Math::lerp(node_pos_in_parent[1], node_pos_in_parent[3], ratio));
+ Point2 end = start - Vector2(control->get_margin(MARGIN_LEFT), 0);
+ _draw_margin_at_position(control->get_margin(MARGIN_LEFT), parent_transform.xform((start + end) / 2), MARGIN_TOP);
+ viewport->draw_line(parent_transform.xform(start), parent_transform.xform(end), color_base, 1);
+ break;
+ }
+ switch (drag) {
+ case DRAG_RIGHT:
+ case DRAG_TOP_RIGHT:
+ case DRAG_BOTTOM_RIGHT:
+ _draw_margin_at_position(control->get_size().width, parent_transform.xform(Vector2((node_pos_in_parent[0] + node_pos_in_parent[2]) / 2, node_pos_in_parent[3])) + Vector2(0, 5), MARGIN_BOTTOM);
+ case DRAG_ALL:
+ Point2 start = Vector2(node_pos_in_parent[2], Math::lerp(node_pos_in_parent[3], node_pos_in_parent[1], ratio));
+ Point2 end = start - Vector2(control->get_margin(MARGIN_RIGHT), 0);
+ _draw_margin_at_position(control->get_margin(MARGIN_RIGHT), parent_transform.xform((start + end) / 2), MARGIN_BOTTOM);
+ viewport->draw_line(parent_transform.xform(start), parent_transform.xform(end), color_base, 1);
+ break;
+ }
+ switch (drag) {
+ case DRAG_TOP:
+ case DRAG_TOP_LEFT:
+ case DRAG_TOP_RIGHT:
+ _draw_margin_at_position(control->get_size().height, parent_transform.xform(Vector2(node_pos_in_parent[2], (node_pos_in_parent[1] + node_pos_in_parent[3]) / 2)) + Vector2(5, 0), MARGIN_RIGHT);
+ case DRAG_ALL:
+ Point2 start = Vector2(Math::lerp(node_pos_in_parent[0], node_pos_in_parent[2], ratio), node_pos_in_parent[1]);
+ Point2 end = start - Vector2(0, control->get_margin(MARGIN_TOP));
+ _draw_margin_at_position(control->get_margin(MARGIN_TOP), parent_transform.xform((start + end) / 2), MARGIN_LEFT);
+ viewport->draw_line(parent_transform.xform(start), parent_transform.xform(end), color_base, 1);
+ break;
+ }
+ switch (drag) {
+ case DRAG_BOTTOM:
+ case DRAG_BOTTOM_LEFT:
+ case DRAG_BOTTOM_RIGHT:
+ _draw_margin_at_position(control->get_size().height, parent_transform.xform(Vector2(node_pos_in_parent[2], (node_pos_in_parent[1] + node_pos_in_parent[3]) / 2) + Vector2(5, 0)), MARGIN_RIGHT);
+ case DRAG_ALL:
+ Point2 start = Vector2(Math::lerp(node_pos_in_parent[2], node_pos_in_parent[0], ratio), node_pos_in_parent[3]);
+ Point2 end = start - Vector2(0, control->get_margin(MARGIN_BOTTOM));
+ _draw_margin_at_position(control->get_margin(MARGIN_BOTTOM), parent_transform.xform((start + end) / 2), MARGIN_RIGHT);
+ viewport->draw_line(parent_transform.xform(start), parent_transform.xform(end), color_base, 1);
+ break;
+ }
+
+ switch (drag) {
+ //Draw the ghost rect if the node if rotated/scaled
+ case DRAG_LEFT:
+ case DRAG_TOP_LEFT:
+ case DRAG_TOP:
+ case DRAG_TOP_RIGHT:
+ case DRAG_RIGHT:
+ case DRAG_BOTTOM_RIGHT:
+ case DRAG_BOTTOM:
+ case DRAG_BOTTOM_LEFT:
+ case DRAG_ALL:
+ if (control->get_rotation() != 0.0 || control->get_scale() != Vector2(1, 1)) {
+ Rect2 rect = Rect2(Vector2(node_pos_in_parent[0], node_pos_in_parent[1]), control->get_size());
+ viewport->draw_rect(parent_transform.xform(rect), color_base, false);
+ }
+ break;
+ }
}
}
@@ -2136,33 +2466,32 @@ void CanvasItemEditor::_viewport_draw() {
}
}
}
-
- //DRAW_EMPTY_RECT( Rect2( current_window->get_scroll()-Point2(1,1), get_size()+Size2(2,2)), Color(0.8,0.8,1.0,0.8) );
- //E->get().last_rect = rect;
}
-
pivot_button->set_disabled(!pivot_found);
- VisualServer::get_singleton()->canvas_item_add_set_transform(ci, Transform2D());
-
- Color x_axis_color(1.0, 0.4, 0.4, 0.6);
- Color y_axis_color(0.4, 1.0, 0.4, 0.6);
- Color area_axis_color(0.4, 0.4, 1.0, 0.4);
- Color rotate_color(0.4, 0.7, 1.0, 0.8);
-
- VisualServer::get_singleton()->canvas_item_add_line(ci, Point2(h_scroll->get_min(), 0) + transform.get_origin(), Point2(h_scroll->get_max(), 0) + transform.get_origin(), x_axis_color);
- VisualServer::get_singleton()->canvas_item_add_line(ci, Point2(0, v_scroll->get_min()) + transform.get_origin(), Point2(0, v_scroll->get_max()) + transform.get_origin(), y_axis_color);
if (box_selecting) {
-
Point2 bsfrom = transform.xform(drag_from);
Point2 bsto = transform.xform(box_selecting_to);
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(bsfrom, bsto - bsfrom), Color(0.7, 0.7, 1.0, 0.3));
}
+ Color rotate_color(0.4, 0.7, 1.0, 0.8);
if (drag == DRAG_ROTATE) {
VisualServer::get_singleton()->canvas_item_add_line(ci, transform.xform(display_rotate_from), transform.xform(display_rotate_to), rotate_color);
}
+}
+
+void CanvasItemEditor::_draw_axis() {
+ RID ci = viewport->get_canvas_item();
+
+ Color x_axis_color(1.0, 0.4, 0.4, 0.6);
+ Color y_axis_color(0.4, 1.0, 0.4, 0.6);
+ Color area_axis_color(0.4, 0.4, 1.0, 0.4);
+
+ Point2 origin = transform.get_origin();
+ VisualServer::get_singleton()->canvas_item_add_line(ci, Point2(0, origin.y), Point2(viewport->get_size().x, origin.y), x_axis_color);
+ VisualServer::get_singleton()->canvas_item_add_line(ci, Point2(origin.x, 0), Point2(origin.x, viewport->get_size().y), y_axis_color);
Size2 screen_size = Size2(ProjectSettings::get_singleton()->get("display/window/size/width"), ProjectSettings::get_singleton()->get("display/window/size/height"));
@@ -2174,34 +2503,12 @@ void CanvasItemEditor::_viewport_draw() {
};
for (int i = 0; i < 4; i++) {
-
VisualServer::get_singleton()->canvas_item_add_line(ci, screen_endpoints[i], screen_endpoints[(i + 1) % 4], area_axis_color);
}
+}
- for (List<LockList>::Element *E = lock_list.front(); E; E = E->next()) {
-
- Vector2 ofs = transform.xform(E->get().pos);
- if (E->get().lock) {
-
- lock->draw(ci, ofs);
- ofs.x += lock->get_width();
- }
- if (E->get().group) {
-
- group->draw(ci, ofs);
- }
- }
-
- {
-
- EditorNode *en = editor;
- EditorPluginList *over_plugin_list = en->get_editor_plugins_over();
-
- if (!over_plugin_list->empty()) {
-
- over_plugin_list->forward_draw_over_canvas(transform, viewport);
- }
- }
+void CanvasItemEditor::_draw_bones() {
+ RID ci = viewport->get_canvas_item();
if (skeleton_show_bones) {
int bone_width = EditorSettings::get_singleton()->get("editors/2d/bone_width");
@@ -2269,6 +2576,131 @@ void CanvasItemEditor::_viewport_draw() {
}
}
+void CanvasItemEditor::_draw_locks_and_groups(Node *p_node, const Transform2D &p_xform) {
+ ERR_FAIL_COND(!p_node);
+
+ RID viewport_ci = viewport->get_canvas_item();
+
+ Transform2D transform_ci = p_xform;
+ CanvasItem *ci = Object::cast_to<CanvasItem>(p_node);
+ if (ci)
+ transform_ci = transform_ci * ci->get_transform();
+
+ for (int i = p_node->get_child_count() - 1; i >= 0; i--) {
+ _draw_locks_and_groups(p_node->get_child(i), transform_ci);
+ }
+
+ if (ci) {
+ Ref<Texture> lock = get_icon("Lock", "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");
+ if (ci->has_meta("_edit_group_")) {
+ Vector2 ofs = transform_ci.xform(Point2(0, 0));
+ if (ci->has_meta("_edit_lock_"))
+ ofs = Point2(ofs.x + lock->get_size().x, ofs.y);
+ group->draw(viewport_ci, ofs);
+ }
+ }
+}
+
+void CanvasItemEditor::_build_bones_list(Node *p_node) {
+ ERR_FAIL_COND(!p_node);
+
+ for (int i = 0; i < p_node->get_child_count(); i++) {
+ _build_bones_list(p_node->get_child(i));
+ }
+
+ CanvasItem *c = Object::cast_to<CanvasItem>(p_node);
+ if (c && c->is_visible_in_tree()) {
+ if (c->has_meta("_edit_bone_")) {
+
+ ObjectID id = c->get_instance_id();
+ if (!bone_list.has(id)) {
+ BoneList bone;
+ bone.bone = id;
+ bone_list[id] = bone;
+ }
+
+ bone_list[id].last_pass = bone_last_frame;
+ }
+ }
+}
+
+void CanvasItemEditor::_get_encompassing_rect(Node *p_node, Rect2 &r_rect, const Transform2D &p_xform) {
+ ERR_FAIL_COND(!p_node);
+
+ for (int i = 0; i < p_node->get_child_count(); i++) {
+ _get_encompassing_rect(p_node->get_child(i), r_rect, p_xform);
+ }
+
+ CanvasItem *c = Object::cast_to<CanvasItem>(p_node);
+ if (c && c->is_visible_in_tree()) {
+ Rect2 rect = c->get_item_rect();
+ Transform2D xform = p_xform * c->get_transform();
+ r_rect.expand_to(xform.xform(rect.position));
+ r_rect.expand_to(xform.xform(rect.position + Point2(rect.size.x, 0)));
+ r_rect.expand_to(xform.xform(rect.position + Point2(0, rect.size.y)));
+ r_rect.expand_to(xform.xform(rect.position + rect.size));
+ }
+}
+
+void CanvasItemEditor::_draw_viewport_base() {
+ if (show_rulers)
+ _draw_rulers();
+ _draw_focus();
+}
+
+void CanvasItemEditor::_draw_viewport() {
+
+ // hide/show buttons depending on the selection
+ bool all_locked = true;
+ bool all_group = true;
+ List<Node *> &selection = editor_selection->get_selected_node_list();
+ if (selection.empty()) {
+ all_locked = false;
+ 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_")) {
+ 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_")) {
+ all_group = false;
+ break;
+ }
+ }
+ }
+
+ lock_button->set_visible(!all_locked);
+ lock_button->set_disabled(selection.empty());
+ unlock_button->set_visible(all_locked);
+ group_button->set_visible(!all_group);
+ group_button->set_disabled(selection.empty());
+ ungroup_button->set_visible(all_group);
+
+ _update_scrollbars();
+
+ _draw_grid();
+ _draw_selection();
+ _draw_axis();
+ _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());
+
+ EditorPluginList *over_plugin_list = editor->get_editor_plugins_over();
+ if (!over_plugin_list->empty()) {
+ over_plugin_list->forward_draw_over_canvas(transform, viewport);
+ }
+ _draw_focus();
+}
+
void CanvasItemEditor::_notification(int p_what) {
if (p_what == NOTIFICATION_FIXED_PROCESS) {
@@ -2319,6 +2751,7 @@ void CanvasItemEditor::_notification(int p_what) {
if (pivot != se->prev_pivot || anchors[MARGIN_LEFT] != se->prev_anchors[MARGIN_LEFT] || anchors[MARGIN_RIGHT] != se->prev_anchors[MARGIN_RIGHT] || anchors[MARGIN_TOP] != se->prev_anchors[MARGIN_TOP] || anchors[MARGIN_BOTTOM] != se->prev_anchors[MARGIN_BOTTOM]) {
viewport->update();
+ viewport_base->update();
se->prev_pivot = pivot;
se->prev_anchors[MARGIN_LEFT] = anchors[MARGIN_LEFT];
se->prev_anchors[MARGIN_RIGHT] = anchors[MARGIN_RIGHT];
@@ -2367,6 +2800,9 @@ void CanvasItemEditor::_notification(int p_what) {
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");
@@ -2377,6 +2813,10 @@ void CanvasItemEditor::_notification(int p_what) {
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();
@@ -2411,6 +2851,9 @@ void CanvasItemEditor::_notification(int p_what) {
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");
@@ -2452,66 +2895,23 @@ void CanvasItemEditor::edit(CanvasItem *p_canvas_item) {
drag = DRAG_NONE;
+ // Clear the selection
editor_selection->clear(); //_clear_canvas_items();
editor_selection->add_node(p_canvas_item);
//_add_canvas_item(p_canvas_item);
viewport->update();
-}
-
-void CanvasItemEditor::_find_canvas_items_span(Node *p_node, Rect2 &r_rect, const Transform2D &p_xform) {
-
- if (!p_node)
- return;
-
- CanvasItem *c = Object::cast_to<CanvasItem>(p_node);
-
- for (int i = p_node->get_child_count() - 1; i >= 0; i--) {
-
- //CanvasItem *r=NULL;
-
- if (c && !c->is_set_as_toplevel())
- _find_canvas_items_span(p_node->get_child(i), r_rect, p_xform * c->get_transform());
- else
- _find_canvas_items_span(p_node->get_child(i), r_rect, Transform2D());
- }
-
- if (c && c->is_visible_in_tree()) {
-
- Rect2 rect = c->get_item_rect();
- Transform2D xform = p_xform * c->get_transform();
-
- LockList lock;
- lock.lock = c->has_meta("_edit_lock_");
- lock.group = c->has_meta("_edit_group_");
-
- if (lock.group || lock.lock) {
- lock.pos = xform.xform(rect.position);
- lock_list.push_back(lock);
- }
-
- if (c->has_meta("_edit_bone_")) {
-
- ObjectID id = c->get_instance_id();
- if (!bone_list.has(id)) {
- BoneList bone;
- bone.bone = id;
- bone_list[id] = bone;
- }
-
- bone_list[id].last_pass = bone_last_frame;
- }
-
- r_rect.expand_to(xform.xform(rect.position));
- r_rect.expand_to(xform.xform(rect.position + Point2(rect.size.x, 0)));
- r_rect.expand_to(xform.xform(rect.position + Point2(0, rect.size.y)));
- r_rect.expand_to(xform.xform(rect.position + rect.size));
- }
+ viewport_base->update();
}
void CanvasItemEditor::_update_scrollbars() {
updating_scroll = true;
+ if (show_rulers)
+ viewport_scrollable->set_begin(Point2(RULER_WIDTH, RULER_WIDTH));
+ else
+ viewport_scrollable->set_begin(Point2());
+
Size2 size = viewport->get_size();
Size2 hmin = h_scroll->get_minimum_size();
Size2 vmin = v_scroll->get_minimum_size();
@@ -2528,11 +2928,12 @@ void CanvasItemEditor::_update_scrollbars() {
Rect2 canvas_item_rect = Rect2(Point2(), screen_rect);
- lock_list.clear();
bone_last_frame++;
- if (editor->get_edited_scene())
- _find_canvas_items_span(editor->get_edited_scene(), canvas_item_rect, Transform2D());
+ if (editor->get_edited_scene()) {
+ _build_bones_list(editor->get_edited_scene());
+ _get_encompassing_rect(editor->get_edited_scene(), canvas_item_rect, Transform2D());
+ }
List<Map<ObjectID, BoneList>::Element *> bone_to_erase;
@@ -2555,7 +2956,6 @@ void CanvasItemEditor::_update_scrollbars() {
Point2 ofs;
if (canvas_item_rect.size.height <= (local_rect.size.y / zoom)) {
-
v_scroll->hide();
ofs.y = canvas_item_rect.position.y;
} else {
@@ -2616,6 +3016,7 @@ void CanvasItemEditor::_update_scroll(float) {
editor->get_scene_root()->set_global_canvas_transform(transform);
viewport->update();
+ viewport_base->update();
}
void CanvasItemEditor::_set_anchors_preset(Control::LayoutPreset p_preset) {
@@ -2662,88 +3063,117 @@ void CanvasItemEditor::_set_full_rect() {
undo_redo->commit_action();
}
+void CanvasItemEditor::_zoom_minus() {
+ if (zoom < MIN_ZOOM)
+ return;
+ zoom /= 2.0;
+
+ _update_scroll(0);
+ viewport->update();
+ viewport_base->update();
+}
+
+void CanvasItemEditor::_zoom_reset() {
+ zoom = 1;
+ _update_scroll(0);
+ viewport->update();
+ viewport_base->update();
+}
+
+void CanvasItemEditor::_zoom_plus() {
+ if (zoom > MAX_ZOOM)
+ return;
+
+ zoom *= 2.0;
+ _update_scroll(0);
+ viewport->update();
+ viewport_base->update();
+}
+
+void CanvasItemEditor::_toggle_snap(bool p_status) {
+ snap_active = p_status;
+ viewport->update();
+ viewport_base->update();
+}
+
void CanvasItemEditor::_popup_callback(int p_op) {
last_option = MenuOption(p_op);
switch (p_op) {
- case SNAP_USE: {
- snap_grid = !snap_grid;
- int idx = edit_menu->get_popup()->get_item_index(SNAP_USE);
- edit_menu->get_popup()->set_item_checked(idx, snap_grid);
+ case SHOW_GRID: {
+ show_grid = !show_grid;
+ int idx = view_menu->get_popup()->get_item_index(SHOW_GRID);
+ view_menu->get_popup()->set_item_checked(idx, show_grid);
viewport->update();
+ viewport_base->update();
} break;
- case SNAP_SHOW_GRID: {
- snap_show_grid = !snap_show_grid;
- int idx = edit_menu->get_popup()->get_item_index(SNAP_SHOW_GRID);
- edit_menu->get_popup()->set_item_checked(idx, snap_show_grid);
- viewport->update();
+ case SNAP_USE_NODE_PARENT: {
+ snap_node_parent = !snap_node_parent;
+ int idx = smartsnap_config_popup->get_item_index(SNAP_USE_NODE_PARENT);
+ smartsnap_config_popup->set_item_checked(idx, snap_node_parent);
+ } break;
+ case SNAP_USE_NODE_ANCHORS: {
+ snap_node_anchors = !snap_node_anchors;
+ int idx = smartsnap_config_popup->get_item_index(SNAP_USE_NODE_ANCHORS);
+ smartsnap_config_popup->set_item_checked(idx, snap_node_anchors);
+ } break;
+ case SNAP_USE_NODE_SIDES: {
+ snap_node_sides = !snap_node_sides;
+ int idx = smartsnap_config_popup->get_item_index(SNAP_USE_NODE_SIDES);
+ smartsnap_config_popup->set_item_checked(idx, snap_node_sides);
+ } break;
+ case SNAP_USE_OTHER_NODES: {
+ snap_other_nodes = !snap_other_nodes;
+ int idx = smartsnap_config_popup->get_item_index(SNAP_USE_OTHER_NODES);
+ smartsnap_config_popup->set_item_checked(idx, snap_other_nodes);
+ } break;
+ case SNAP_USE_GRID: {
+ snap_grid = !snap_grid;
+ int idx = snap_config_menu->get_popup()->get_item_index(SNAP_USE_GRID);
+ snap_config_menu->get_popup()->set_item_checked(idx, snap_grid);
} break;
case SNAP_USE_ROTATION: {
snap_rotation = !snap_rotation;
- int idx = edit_menu->get_popup()->get_item_index(SNAP_USE_ROTATION);
- edit_menu->get_popup()->set_item_checked(idx, snap_rotation);
+ int idx = snap_config_menu->get_popup()->get_item_index(SNAP_USE_ROTATION);
+ snap_config_menu->get_popup()->set_item_checked(idx, snap_rotation);
} break;
case SNAP_RELATIVE: {
snap_relative = !snap_relative;
- int idx = edit_menu->get_popup()->get_item_index(SNAP_RELATIVE);
- edit_menu->get_popup()->set_item_checked(idx, snap_relative);
+ int idx = snap_config_menu->get_popup()->get_item_index(SNAP_RELATIVE);
+ snap_config_menu->get_popup()->set_item_checked(idx, snap_relative);
viewport->update();
+ viewport_base->update();
} break;
case SNAP_USE_PIXEL: {
snap_pixel = !snap_pixel;
- int idx = edit_menu->get_popup()->get_item_index(SNAP_USE_PIXEL);
- edit_menu->get_popup()->set_item_checked(idx, snap_pixel);
+ int idx = snap_config_menu->get_popup()->get_item_index(SNAP_USE_PIXEL);
+ snap_config_menu->get_popup()->set_item_checked(idx, snap_pixel);
} break;
case SNAP_CONFIGURE: {
- ((SnapDialog *)snap_dialog)->set_fields(snap_offset, snap_step, snap_rotation_offset, snap_rotation_step);
+ ((SnapDialog *)snap_dialog)->set_fields(grid_offset, grid_step, snap_rotation_offset, snap_rotation_step);
snap_dialog->popup_centered(Size2(220, 160));
} break;
case SKELETON_SHOW_BONES: {
skeleton_show_bones = !skeleton_show_bones;
- int idx = skeleton_menu->get_item_index(SKELETON_SHOW_BONES);
- skeleton_menu->set_item_checked(idx, skeleton_show_bones);
- viewport->update();
- } break;
- case ZOOM_IN: {
- if (zoom > MAX_ZOOM)
- return;
- zoom = zoom * (1.0 / 0.5);
- _update_scroll(0);
+ int idx = skeleton_menu->get_popup()->get_item_index(SKELETON_SHOW_BONES);
+ skeleton_menu->get_popup()->set_item_checked(idx, skeleton_show_bones);
viewport->update();
- return;
} break;
- case ZOOM_OUT: {
- if (zoom < MIN_ZOOM)
- return;
-
- zoom = zoom * 0.5;
- _update_scroll(0);
+ case SHOW_HELPERS: {
+ show_helpers = !show_helpers;
+ int idx = view_menu->get_popup()->get_item_index(SHOW_HELPERS);
+ view_menu->get_popup()->set_item_checked(idx, show_helpers);
viewport->update();
- return;
-
} break;
- case ZOOM_RESET: {
-
- zoom = 1;
- _update_scroll(0);
+ case SHOW_RULERS: {
+ show_rulers = !show_rulers;
+ int idx = view_menu->get_popup()->get_item_index(SHOW_RULERS);
+ view_menu->get_popup()->set_item_checked(idx, show_rulers);
viewport->update();
- return;
-
+ viewport_base->update();
} break;
- case ZOOM_SET: {
-
- updating_value_dialog = true;
-
- dialog_label->set_text(TTR("Zoom (%):"));
- dialog_val->set_min(0.1);
- dialog_val->set_step(0.1);
- dialog_val->set_max(800);
- dialog_val->set_value(zoom * 100);
- value_dialog->popup_centered(Size2(200, 85));
- updating_value_dialog = false;
- } break;
case LOCK_SELECTED: {
List<Node *> &selection = editor_selection->get_selected_node_list();
@@ -3090,7 +3520,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
n2d->set_meta("_edit_bone_", true);
if (!skeleton_show_bones)
- skeleton_menu->activate_item(skeleton_menu->get_item_index(SKELETON_SHOW_BONES));
+ skeleton_menu->get_popup()->activate_item(skeleton_menu->get_popup()->get_item_index(SKELETON_SHOW_BONES));
}
viewport->update();
@@ -3109,7 +3539,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
n2d->set_meta("_edit_bone_", Variant());
if (!skeleton_show_bones)
- skeleton_menu->activate_item(skeleton_menu->get_item_index(SKELETON_SHOW_BONES));
+ skeleton_menu->get_popup()->activate_item(skeleton_menu->get_popup()->get_item_index(SKELETON_SHOW_BONES));
}
viewport->update();
@@ -3129,7 +3559,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
canvas_item->set_meta("_edit_ik_", true);
if (!skeleton_show_bones)
- skeleton_menu->activate_item(skeleton_menu->get_item_index(SKELETON_SHOW_BONES));
+ skeleton_menu->get_popup()->activate_item(skeleton_menu->get_popup()->get_item_index(SKELETON_SHOW_BONES));
}
viewport->update();
@@ -3149,7 +3579,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
n2d->set_meta("_edit_ik_", Variant());
if (!skeleton_show_bones)
- skeleton_menu->activate_item(skeleton_menu->get_item_index(SKELETON_SHOW_BONES));
+ skeleton_menu->get_popup()->activate_item(skeleton_menu->get_popup()->get_item_index(SKELETON_SHOW_BONES));
}
viewport->update();
@@ -3212,15 +3642,19 @@ void CanvasItemEditor::_focus_selection(int p_op) {
void CanvasItemEditor::_bind_methods() {
+ ClassDB::bind_method("_zoom_minus", &CanvasItemEditor::_zoom_minus);
+ ClassDB::bind_method("_zoom_reset", &CanvasItemEditor::_zoom_reset);
+ ClassDB::bind_method("_zoom_plus", &CanvasItemEditor::_zoom_plus);
+ ClassDB::bind_method("_toggle_snap", &CanvasItemEditor::_toggle_snap);
ClassDB::bind_method("_update_scroll", &CanvasItemEditor::_update_scroll);
ClassDB::bind_method("_popup_callback", &CanvasItemEditor::_popup_callback);
- ClassDB::bind_method("_dialog_value_changed", &CanvasItemEditor::_dialog_value_changed);
ClassDB::bind_method("_get_editor_data", &CanvasItemEditor::_get_editor_data);
ClassDB::bind_method("_tool_select", &CanvasItemEditor::_tool_select);
ClassDB::bind_method("_keying_changed", &CanvasItemEditor::_keying_changed);
ClassDB::bind_method("_unhandled_key_input", &CanvasItemEditor::_unhandled_key_input);
- ClassDB::bind_method("_viewport_draw", &CanvasItemEditor::_viewport_draw);
- ClassDB::bind_method("_viewport_gui_input", &CanvasItemEditor::_viewport_gui_input);
+ ClassDB::bind_method("_draw_viewport", &CanvasItemEditor::_draw_viewport);
+ ClassDB::bind_method("_draw_viewport_base", &CanvasItemEditor::_draw_viewport_base);
+ ClassDB::bind_method("_viewport_base_gui_input", &CanvasItemEditor::_viewport_base_gui_input);
ClassDB::bind_method("_snap_changed", &CanvasItemEditor::_snap_changed);
ClassDB::bind_method(D_METHOD("_selection_result_pressed"), &CanvasItemEditor::_selection_result_pressed);
ClassDB::bind_method(D_METHOD("_selection_menu_hide"), &CanvasItemEditor::_selection_menu_hide);
@@ -3262,64 +3696,92 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
hb->set_area_as_parent_rect();
bottom_split = memnew(VSplitContainer);
- bottom_split->set_v_size_flags(SIZE_EXPAND_FILL);
add_child(bottom_split);
+ bottom_split->set_v_size_flags(SIZE_EXPAND_FILL);
palette_split = memnew(HSplitContainer);
- palette_split->set_v_size_flags(SIZE_EXPAND_FILL);
bottom_split->add_child(palette_split);
+ palette_split->set_v_size_flags(SIZE_EXPAND_FILL);
- Control *vp_base = memnew(Control);
- vp_base->set_v_size_flags(SIZE_EXPAND_FILL);
- palette_split->add_child(vp_base);
-
- ViewportContainer *vp = memnew(ViewportContainer);
- vp->set_stretch(true);
- vp_base->add_child(vp);
- vp->set_area_as_parent_rect();
- vp->add_child(p_editor->get_scene_root());
+ viewport_base = memnew(Control);
+ palette_split->add_child(viewport_base);
+ 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);
+ viewport_base->set_v_size_flags(SIZE_EXPAND_FILL);
+ viewport_base->set_h_size_flags(SIZE_EXPAND_FILL);
+
+ viewport_scrollable = memnew(Control);
+ 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_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->add_child(p_editor->get_scene_root());
viewport = memnew(CanvasItemEditorViewport(p_editor, this));
- vp_base->add_child(viewport);
+ viewport_scrollable->add_child(viewport);
+ viewport->set_mouse_filter(MOUSE_FILTER_PASS);
viewport->set_area_as_parent_rect();
viewport->set_clip_contents(true);
+ viewport->connect("draw", this, "_draw_viewport");
h_scroll = memnew(HScrollBar);
- v_scroll = memnew(VScrollBar);
-
viewport->add_child(h_scroll);
- viewport->add_child(v_scroll);
- viewport->connect("draw", this, "_viewport_draw");
- viewport->connect("gui_input", this, "_viewport_gui_input");
-
h_scroll->connect("value_changed", this, "_update_scroll", Vector<Variant>(), Object::CONNECT_DEFERRED);
- v_scroll->connect("value_changed", this, "_update_scroll", Vector<Variant>(), Object::CONNECT_DEFERRED);
-
h_scroll->hide();
+
+ v_scroll = memnew(VScrollBar);
+ viewport->add_child(v_scroll);
+ v_scroll->connect("value_changed", this, "_update_scroll", Vector<Variant>(), Object::CONNECT_DEFERRED);
v_scroll->hide();
+
+ HBoxContainer *zoom_hb = memnew(HBoxContainer);
+ viewport->add_child(zoom_hb);
+ zoom_hb->set_begin(Point2(5, 5));
+
+ zoom_minus = memnew(ToolButton);
+ zoom_hb->add_child(zoom_minus);
+ zoom_minus->connect("pressed", this, "_zoom_minus");
+ zoom_minus->set_focus_mode(FOCUS_NONE);
+
+ zoom_reset = memnew(ToolButton);
+ zoom_hb->add_child(zoom_reset);
+ zoom_reset->connect("pressed", this, "_zoom_reset");
+ zoom_reset->set_focus_mode(FOCUS_NONE);
+
+ zoom_plus = memnew(ToolButton);
+ zoom_hb->add_child(zoom_plus);
+ zoom_plus->connect("pressed", this, "_zoom_plus");
+ zoom_plus->set_focus_mode(FOCUS_NONE);
+
updating_scroll = false;
- viewport->set_focus_mode(FOCUS_ALL);
handle_len = 10;
first_update = true;
select_button = memnew(ToolButton);
- select_button->set_toggle_mode(true);
hb->add_child(select_button);
+ select_button->set_toggle_mode(true);
select_button->connect("pressed", this, "_tool_select", make_binds(TOOL_SELECT));
select_button->set_pressed(true);
select_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/select_mode", TTR("Select Mode"), KEY_Q));
select_button->set_tooltip(TTR("Select Mode") + " $sc\n" + keycode_get_string(KEY_MASK_CMD) + TTR("Drag: Rotate") + "\n" + TTR("Alt+Drag: Move") + "\n" + TTR("Press 'v' to Change Pivot, 'Shift+v' to Drag Pivot (while moving).") + "\n" + TTR("Alt+RMB: Depth list selection"));
move_button = memnew(ToolButton);
- move_button->set_toggle_mode(true);
hb->add_child(move_button);
+ move_button->set_toggle_mode(true);
move_button->connect("pressed", this, "_tool_select", make_binds(TOOL_MOVE));
move_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/move_mode", TTR("Move Mode"), KEY_W));
move_button->set_tooltip(TTR("Move Mode"));
rotate_button = memnew(ToolButton);
- rotate_button->set_toggle_mode(true);
hb->add_child(rotate_button);
+ rotate_button->set_toggle_mode(true);
rotate_button->connect("pressed", this, "_tool_select", make_binds(TOOL_ROTATE));
rotate_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/rotate_mode", TTR("Rotate Mode"), KEY_E));
rotate_button->set_tooltip(TTR("Rotate Mode"));
@@ -3327,25 +3789,60 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
hb->add_child(memnew(VSeparator));
list_select_button = memnew(ToolButton);
- list_select_button->set_toggle_mode(true);
hb->add_child(list_select_button);
+ list_select_button->set_toggle_mode(true);
list_select_button->connect("pressed", this, "_tool_select", make_binds(TOOL_LIST_SELECT));
list_select_button->set_tooltip(TTR("Show a list of all objects at the position clicked\n(same as Alt+RMB in select mode)."));
pivot_button = memnew(ToolButton);
- pivot_button->set_toggle_mode(true);
hb->add_child(pivot_button);
+ pivot_button->set_toggle_mode(true);
pivot_button->connect("pressed", this, "_tool_select", make_binds(TOOL_EDIT_PIVOT));
pivot_button->set_tooltip(TTR("Click to change object's rotation pivot."));
pan_button = memnew(ToolButton);
- pan_button->set_toggle_mode(true);
hb->add_child(pan_button);
+ pan_button->set_toggle_mode(true);
pan_button->connect("pressed", this, "_tool_select", make_binds(TOOL_PAN));
pan_button->set_tooltip(TTR("Pan Mode"));
hb->add_child(memnew(VSeparator));
+ snap_button = memnew(ToolButton);
+ hb->add_child(snap_button);
+ snap_button->set_toggle_mode(true);
+ snap_button->connect("toggled", this, "_toggle_snap");
+ snap_button->set_tooltip(TTR("Toggles snapping"));
+ snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_snap", TTR("Use Snap"), KEY_S));
+
+ 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"));
+
+ PopupMenu *p = snap_config_menu->get_popup();
+ p->connect("id_pressed", this, "_popup_callback");
+ p->set_hide_on_checkable_item_selection(false);
+ p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_grid", TTR("Snap to grid")), SNAP_USE_GRID);
+ p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/use_rotation_snap", TTR("Use Rotation Snap")), SNAP_USE_ROTATION);
+ p->add_shortcut(ED_SHORTCUT("canvas_item_editor/configure_snap", TTR("Configure Snap...")), SNAP_CONFIGURE);
+ p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_relative", TTR("Snap Relative")), SNAP_RELATIVE);
+ p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/use_pixel_snap", TTR("Use Pixel Snap")), SNAP_USE_PIXEL);
+ p->add_submenu_item(TTR("Smart snapping"), "SmartSnapping");
+
+ smartsnap_config_popup = memnew(PopupMenu);
+ p->add_child(smartsnap_config_popup);
+ smartsnap_config_popup->set_name("SmartSnapping");
+ smartsnap_config_popup->connect("id_pressed", this, "_popup_callback");
+ smartsnap_config_popup->set_hide_on_checkable_item_selection(false);
+ smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_node_parent", TTR("Snap to parent")), SNAP_USE_NODE_PARENT);
+ smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_node_anchors", TTR("Snap to node anchor")), SNAP_USE_NODE_ANCHORS);
+ smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_node_sides", TTR("Snap to node sides")), SNAP_USE_NODE_SIDES);
+ smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_other_nodes", TTR("Snap to other nodes")), SNAP_USE_OTHER_NODES);
+
+ hb->add_child(memnew(VSeparator));
+
lock_button = memnew(ToolButton);
hb->add_child(lock_button);
@@ -3369,35 +3866,23 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
hb->add_child(memnew(VSeparator));
- edit_menu = memnew(MenuButton);
- edit_menu->set_text(TTR("Edit"));
- hb->add_child(edit_menu);
- edit_menu->get_popup()->connect("id_pressed", this, "_popup_callback");
+ skeleton_menu = memnew(MenuButton);
+ hb->add_child(skeleton_menu);
- PopupMenu *p;
- p = edit_menu->get_popup();
+ p = skeleton_menu->get_popup();
p->set_hide_on_checkable_item_selection(false);
- p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/use_snap", TTR("Use Snap")), SNAP_USE);
- p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_grid", TTR("Show Grid")), SNAP_SHOW_GRID);
- p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/use_rotation_snap", TTR("Use Rotation Snap")), SNAP_USE_ROTATION);
- p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_relative", TTR("Snap Relative")), SNAP_RELATIVE);
- p->add_shortcut(ED_SHORTCUT("canvas_item_editor/configure_snap", TTR("Configure Snap..")), SNAP_CONFIGURE);
+ 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();
- p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/use_pixel_snap", TTR("Use Pixel Snap")), SNAP_USE_PIXEL);
+ p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_show_bones", TTR("Show Bones")), SKELETON_SHOW_BONES);
p->add_separator();
- p->add_submenu_item(TTR("Skeleton.."), "skeleton");
- skeleton_menu = memnew(PopupMenu);
- p->add_child(skeleton_menu);
- skeleton_menu->set_name("skeleton");
- skeleton_menu->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_make_bones", TTR("Make Bones"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_B), SKELETON_MAKE_BONES);
- skeleton_menu->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_clear_bones", TTR("Clear Bones")), SKELETON_CLEAR_BONES);
- skeleton_menu->add_separator();
- skeleton_menu->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_show_bones", TTR("Show Bones")), SKELETON_SHOW_BONES);
- skeleton_menu->add_separator();
- skeleton_menu->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_set_ik_chain", TTR("Make IK Chain")), SKELETON_SET_IK_CHAIN);
- skeleton_menu->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_clear_ik_chain", TTR("Clear IK Chain")), SKELETON_CLEAR_IK_CHAIN);
- skeleton_menu->set_hide_on_checkable_item_selection(false);
- skeleton_menu->connect("id_pressed", this, "_popup_callback");
+ 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));
view_menu = memnew(MenuButton);
view_menu->set_text(TTR("View"));
@@ -3405,11 +3890,9 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
view_menu->get_popup()->connect("id_pressed", this, "_popup_callback");
p = view_menu->get_popup();
-
- p->add_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_in", TTR("Zoom In")), ZOOM_IN);
- p->add_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_out", TTR("Zoom Out")), ZOOM_OUT);
- p->add_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_reset", TTR("Zoom Reset")), ZOOM_RESET);
- p->add_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_set", TTR("Zoom Set..")), ZOOM_SET);
+ p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_grid", TTR("Show Grid"), KEY_G), SHOW_GRID);
+ p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_helpers", TTR("Show helpers"), KEY_H), SHOW_HELPERS);
+ p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_rulers", TTR("Show rulers"), KEY_R), SHOW_RULERS);
p->add_separator();
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);
@@ -3480,23 +3963,6 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
snap_dialog->connect("confirmed", this, "_snap_changed");
add_child(snap_dialog);
- value_dialog = memnew(AcceptDialog);
- value_dialog->set_title(TTR("Set a Value"));
- value_dialog->get_ok()->set_text(TTR("Close"));
- add_child(value_dialog);
-
- Label *l = memnew(Label);
- l->set_text(TTR("Snap (Pixels):"));
- l->set_position(Point2(5, 5));
- value_dialog->add_child(l);
- dialog_label = l;
-
- dialog_val = memnew(SpinBox);
- dialog_val->set_anchor(MARGIN_RIGHT, ANCHOR_END);
- dialog_val->set_begin(Point2(15, 25));
- dialog_val->set_end(Point2(-10, 25));
- value_dialog->add_child(dialog_val);
- dialog_val->connect("value_changed", this, "_dialog_value_changed");
select_sb = Ref<StyleBoxTexture>(memnew(StyleBoxTexture));
selection_menu = memnew(PopupMenu);
@@ -3505,22 +3971,35 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
selection_menu->connect("id_pressed", this, "_selection_result_pressed");
selection_menu->connect("popup_hide", this, "_selection_menu_hide");
+ drag_pivot_shortcut = ED_SHORTCUT("canvas_item_editor/drag_pivot", TTR("Drag pivot from mouse position"), KEY_MASK_SHIFT | KEY_V);
+ set_pivot_shortcut = ED_SHORTCUT("canvas_item_editor/set_pivot", TTR("Set pivot at mouse position"), KEY_V);
+
+ multiply_grid_step_shortcut = ED_SHORTCUT("canvas_item_editor/multiply_grid_step", TTR("Multiply grid step by 2"), KEY_KP_MULTIPLY);
+ divide_grid_step_shortcut = ED_SHORTCUT("canvas_item_editor/divide_grid_step", TTR("Divide grid step by 2"), KEY_KP_DIVIDE);
+
key_pos = true;
key_rot = true;
key_scale = false;
+ show_grid = false;
+ show_helpers = false;
+ show_rulers = false;
zoom = 1;
- snap_offset = Vector2(0, 0);
- snap_step = Vector2(10, 10);
+ grid_offset = Point2();
+ grid_step = Point2(10, 10);
+ grid_step_multiplier = 0;
snap_rotation_offset = 0;
snap_rotation_step = 15 / (180 / Math_PI);
- snap_grid = false;
- snap_show_grid = false;
+ snap_active = false;
+ snap_node_parent = true;
+ snap_node_anchors = true;
+ snap_node_sides = true;
+ snap_other_nodes = true;
+ snap_grid = true;
snap_rotation = false;
snap_pixel = false;
skeleton_show_bones = true;
- skeleton_menu->set_item_checked(skeleton_menu->get_item_index(SKELETON_SHOW_BONES), true);
- updating_value_dialog = false;
+ skeleton_menu->get_popup()->set_item_checked(skeleton_menu->get_popup()->get_item_index(SKELETON_SHOW_BONES), true);
box_selecting = false;
//zoom=0.5;
singleton = this;
@@ -3551,7 +4030,7 @@ void CanvasItemEditorPlugin::make_visible(bool p_visible) {
canvas_item_editor->show();
canvas_item_editor->set_fixed_process(true);
VisualServer::get_singleton()->viewport_set_hide_canvas(editor->get_scene_root()->get_viewport_rid(), false);
- canvas_item_editor->viewport->grab_focus();
+ canvas_item_editor->viewport_base->grab_focus();
} else {
@@ -3715,13 +4194,13 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String &
pos = parent->call("get_global_position");
}
Transform2D trans = canvas->get_canvas_transform();
- Point2 target_pos = (p_point - trans.get_origin()) / trans.get_scale().x - pos;
+ 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") {
- target_pos -= texture_size / 2;
+ target_position -= texture_size / 2;
}
// there's nothing to be used as source position so snapping will work as absolute if enabled
- target_pos = canvas->snap_point(target_pos, Vector2());
- editor_data->get_undo_redo().add_do_method(child, "set_position", target_pos);
+ target_position = canvas->snap_point(target_position);
+ editor_data->get_undo_redo().add_do_method(child, "set_position", target_position);
}
bool CanvasItemEditorViewport::_create_instance(Node *parent, String &path, const Point2 &p_point) {
@@ -3754,22 +4233,13 @@ bool CanvasItemEditorViewport::_create_instance(Node *parent, String &path, cons
editor_data->get_undo_redo().add_do_method(sed, "live_debug_instance_node", editor->get_edited_scene()->get_path_to(parent), path, new_name);
editor_data->get_undo_redo().add_undo_method(sed, "live_debug_remove_node", NodePath(String(editor->get_edited_scene()->get_path_to(parent)) + "/" + new_name));
- Point2 pos;
- Node2D *parent_node2d = Object::cast_to<Node2D>(parent);
- if (parent_node2d) {
- pos = parent_node2d->get_global_position();
- } else {
- Control *parent_control = Object::cast_to<Control>(parent);
- if (parent_control) {
- pos = parent_control->get_global_position();
- }
+ CanvasItem *parent_ci = Object::cast_to<CanvasItem>(parent);
+ if (parent_ci) {
+ Vector2 target_pos = canvas->get_canvas_transform().affine_inverse().xform(p_point);
+ target_pos = canvas->snap_point(target_pos);
+ target_pos = parent_ci->get_global_transform_with_canvas().affine_inverse().xform(target_pos);
+ editor_data->get_undo_redo().add_do_method(instanced_scene, "set_position", target_pos);
}
- Transform2D trans = canvas->get_canvas_transform();
- Vector2 target_pos = (p_point - trans.get_origin()) / trans.get_scale().x - pos;
- // in relative snapping it may be useful for the user to take the original node position into account
- Vector2 start_pos = Object::cast_to<Node2D>(instanced_scene) ? Object::cast_to<Node2D>(instanced_scene)->get_position() : target_pos;
- target_pos = canvas->snap_point(target_pos, start_pos);
- editor_data->get_undo_redo().add_do_method(instanced_scene, "set_position", target_pos);
return true;
}
@@ -3848,6 +4318,20 @@ bool CanvasItemEditorViewport::can_drop_data(const Point2 &p_point, const Varian
continue;
}
memdelete(instanced_scene);
+ } else if (type == "Texture" ||
+ type == "ImageTexture" ||
+ type == "ViewportTexture" ||
+ type == "CurveTexture" ||
+ type == "GradientTexture" ||
+ type == "StreamTexture" ||
+ type == "AtlasTexture" ||
+ type == "LargeTexture") {
+ Ref<Texture> texture = ResourceLoader::load(files[i]);
+ if (texture.is_valid() == false) {
+ continue;
+ }
+ } else {
+ continue;
}
can_instance = true;
break;
@@ -3956,41 +4440,39 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte
editor_data = editor->get_scene_tree_dock()->get_editor_data();
canvas = p_canvas;
preview_node = memnew(Node2D);
+
accept = memnew(AcceptDialog);
editor->get_gui_base()->add_child(accept);
selector = memnew(AcceptDialog);
+ editor->get_gui_base()->add_child(selector);
selector->set_title(TTR("Change default type"));
+ selector->connect("confirmed", this, "_on_change_type");
VBoxContainer *vbc = memnew(VBoxContainer);
+ selector->add_child(vbc);
vbc->set_h_size_flags(SIZE_EXPAND_FILL);
vbc->set_v_size_flags(SIZE_EXPAND_FILL);
vbc->set_custom_minimum_size(Size2(200, 260) * EDSCALE);
selector_label = memnew(Label);
+ vbc->add_child(selector_label);
selector_label->set_align(Label::ALIGN_CENTER);
selector_label->set_valign(Label::VALIGN_BOTTOM);
selector_label->set_custom_minimum_size(Size2(0, 30) * EDSCALE);
- vbc->add_child(selector_label);
-
- button_group.instance();
btn_group = memnew(VBoxContainer);
+ vbc->add_child(btn_group);
btn_group->set_h_size_flags(0);
+ button_group.instance();
for (int i = 0; i < types.size(); i++) {
CheckBox *check = memnew(CheckBox);
+ btn_group->add_child(check);
check->set_text(types[i]);
check->connect("button_down", this, "_on_select_type", varray(check));
- btn_group->add_child(check);
check->set_button_group(button_group);
}
- vbc->add_child(btn_group);
-
- selector->connect("confirmed", this, "_on_change_type");
-
- selector->add_child(vbc);
- editor->get_gui_base()->add_child(selector);
label = memnew(Label);
label->add_color_override("font_color_shadow", Color(0, 0, 0, 1));
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index 2e1a2eac5f..af834507e0 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -58,6 +58,8 @@ public:
Vector2 prev_pivot;
float prev_anchors[4];
+ Transform2D pre_drag_xform;
+
CanvasItemEditorSelectedItem() { prev_rot = 0; }
};
@@ -68,7 +70,6 @@ class CanvasItemEditor : public VBoxContainer {
EditorNode *editor;
enum Tool {
-
TOOL_SELECT,
TOOL_LIST_SELECT,
TOOL_MOVE,
@@ -80,15 +81,18 @@ class CanvasItemEditor : public VBoxContainer {
enum MenuOption {
SNAP_USE,
- SNAP_SHOW_GRID,
+ SNAP_USE_NODE_PARENT,
+ SNAP_USE_NODE_ANCHORS,
+ SNAP_USE_NODE_SIDES,
+ SNAP_USE_OTHER_NODES,
+ SNAP_USE_GRID,
SNAP_USE_ROTATION,
SNAP_RELATIVE,
SNAP_CONFIGURE,
SNAP_USE_PIXEL,
- ZOOM_IN,
- ZOOM_OUT,
- ZOOM_RESET,
- ZOOM_SET,
+ SHOW_GRID,
+ SHOW_HELPERS,
+ SHOW_RULERS,
LOCK_SELECTED,
UNLOCK_SELECTED,
GROUP_SELECTED,
@@ -161,6 +165,8 @@ class CanvasItemEditor : public VBoxContainer {
Tool tool;
bool first_update;
Control *viewport;
+ Control *viewport_base;
+ Control *viewport_scrollable;
bool can_move_pivot;
@@ -168,14 +174,28 @@ class CanvasItemEditor : public VBoxContainer {
VScrollBar *v_scroll;
HBoxContainer *hb;
+ ToolButton *zoom_minus;
+ ToolButton *zoom_reset;
+ ToolButton *zoom_plus;
+
Transform2D transform;
+ bool show_grid;
+ bool show_rulers;
+ bool show_helpers;
float zoom;
- Vector2 snap_offset;
- Vector2 snap_step;
+
+ Point2 grid_offset;
+ Point2 grid_step;
+ int grid_step_multiplier;
+
float snap_rotation_step;
float snap_rotation_offset;
+ bool snap_active;
+ bool snap_node_parent;
+ bool snap_node_anchors;
+ bool snap_node_sides;
+ bool snap_other_nodes;
bool snap_grid;
- bool snap_show_grid;
bool snap_rotation;
bool snap_relative;
bool snap_pixel;
@@ -202,18 +222,6 @@ class CanvasItemEditor : public VBoxContainer {
Vector<_SelectResult> selection_results;
- struct LockList {
- Point2 pos;
- bool lock;
- bool group;
- LockList() {
- lock = false;
- group = false;
- }
- };
-
- List<LockList> lock_list;
-
struct BoneList {
Transform2D xform;
@@ -253,6 +261,10 @@ class CanvasItemEditor : public VBoxContainer {
ToolButton *move_button;
ToolButton *rotate_button;
+ ToolButton *snap_button;
+ MenuButton *snap_config_menu;
+ PopupMenu *smartsnap_config_popup;
+
ToolButton *pivot_button;
ToolButton *pan_button;
@@ -262,8 +274,7 @@ class CanvasItemEditor : public VBoxContainer {
ToolButton *group_button;
ToolButton *ungroup_button;
- MenuButton *edit_menu;
- PopupMenu *skeleton_menu;
+ MenuButton *skeleton_menu;
MenuButton *view_menu;
HBoxContainer *animation_hb;
MenuButton *animation_menu;
@@ -276,6 +287,9 @@ class CanvasItemEditor : public VBoxContainer {
PopupMenu *selection_menu;
+ Control *top_ruler;
+ Control *left_ruler;
+
//PopupMenu *popup;
DragType drag;
Point2 drag_from;
@@ -288,6 +302,11 @@ class CanvasItemEditor : public VBoxContainer {
Ref<Texture> select_handle;
Ref<Texture> anchor_handle;
+ Ref<ShortCut> drag_pivot_shortcut;
+ Ref<ShortCut> set_pivot_shortcut;
+ Ref<ShortCut> multiply_grid_step_shortcut;
+ Ref<ShortCut> divide_grid_step_shortcut;
+
int handle_len;
bool _is_part_of_subscene(CanvasItem *p_item);
void _find_canvas_items_at_pos(const Point2 &p_pos, Node *p_node, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform, Vector<_SelectResult> &r_items, int limit = 0);
@@ -298,10 +317,6 @@ class CanvasItemEditor : public VBoxContainer {
ConfirmationDialog *snap_dialog;
- AcceptDialog *value_dialog;
- Label *dialog_label;
- SpinBox *dialog_val;
-
CanvasItem *ref_item;
void _edit_set_pivot(const Vector2 &mouse_pos);
@@ -315,9 +330,8 @@ class CanvasItemEditor : public VBoxContainer {
void _prepare_drag(const Point2 &p_click_pos);
DragType _get_anchor_handle_drag_type(const Point2 &p_click, Vector2 &r_point);
- float _anchor_snap(float anchor, bool *snapped = NULL, float p_opposite_anchor = -1);
- Vector2 _anchor_to_position(Control *p_control, Vector2 anchor);
- Vector2 _position_to_anchor(Control *p_control, Vector2 position);
+ Vector2 _anchor_to_position(const Control *p_control, Vector2 anchor);
+ Vector2 _position_to_anchor(const Control *p_control, Vector2 position);
void _popup_callback(int p_op);
bool updating_scroll;
@@ -328,7 +342,6 @@ class CanvasItemEditor : public VBoxContainer {
void incend(float &beg, float &end, float inc, float minsize, bool p_symmetric);
void _append_canvas_item(CanvasItem *p_item);
- void _dialog_value_changed(double);
void _snap_changed();
void _selection_result_pressed(int);
void _selection_menu_hide();
@@ -337,26 +350,49 @@ class CanvasItemEditor : public VBoxContainer {
Point2 _find_topleftmost_point();
- void _find_canvas_items_span(Node *p_node, Rect2 &r_rect, const Transform2D &p_xform);
+ void _build_bones_list(Node *p_node);
+
+ void _get_encompassing_rect(Node *p_node, Rect2 &r_rect, const Transform2D &p_xform);
Object *_get_editor_data(Object *p_what);
- CanvasItem *get_single_item();
+ CanvasItem *_get_single_item();
int get_item_count();
void _keying_changed();
void _unhandled_key_input(const Ref<InputEvent> &p_ev);
+ void _draw_text_at_position(Point2 p_position, String p_string, Margin p_side);
+ void _draw_margin_at_position(int p_value, Point2 p_position, Margin p_side);
void _draw_percentage_at_position(float p_value, Point2 p_position, Margin p_side);
- void _viewport_gui_input(const Ref<InputEvent> &p_event);
- void _viewport_draw();
+ void _draw_rulers();
+ void _draw_focus();
+ void _draw_grid();
+ void _draw_selection();
+ void _draw_axis();
+ void _draw_bones();
+ void _draw_locks_and_groups(Node *p_node, const Transform2D &p_xform);
+
+ void _draw_viewport();
+
+ void _viewport_base_gui_input(const Ref<InputEvent> &p_event);
+ void _draw_viewport_base();
void _focus_selection(int p_op);
+ void _snap_if_closer(Point2 p_value, Point2 p_target_snap, Point2 &r_current_snap, bool (&r_snapped)[2], real_t rotation = 0.0, float p_radius = 10.0);
+ 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 _zoom_minus();
+ void _zoom_reset();
+ void _zoom_plus();
+
+ void _toggle_snap(bool p_status);
+
HSplitContainer *palette_split;
VSplitContainer *bottom_split;
@@ -400,7 +436,18 @@ protected:
static CanvasItemEditor *singleton;
public:
- Vector2 snap_point(Vector2 p_target, Vector2 p_start = Vector2(0, 0)) const;
+ enum SnapMode {
+ SNAP_GRID = 1 << 0,
+ SNAP_PIXEL = 1 << 1,
+ SNAP_NODE_PARENT = 1 << 2,
+ SNAP_NODE_ANCHORS = 1 << 3,
+ SNAP_NODE_SIDES = 1 << 4,
+ SNAP_OTHER_NODES = 1 << 5,
+
+ SNAP_DEFAULT = 0x03,
+ };
+
+ Point2 snap_point(Point2 p_target, unsigned int p_modes = SNAP_DEFAULT, const CanvasItem *p_canvas_item = NULL, unsigned int p_forced_modes = 0);
float snap_angle(float p_target, float p_start = 0) const;
Transform2D get_canvas_transform() const { return transform; }
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp
index 615cf85aa4..70d771afc8 100644
--- a/editor/plugins/curve_editor_plugin.cpp
+++ b/editor/plugins/curve_editor_plugin.cpp
@@ -188,7 +188,7 @@ void CurveEditor::on_gui_input(const Ref<InputEvent> &p_event) {
} else {
// Drag tangent
- Vector2 point_pos = curve.get_point_pos(_selected_point);
+ Vector2 point_pos = curve.get_point_position(_selected_point);
Vector2 control_pos = get_world_pos(mpos);
Vector2 dir = (control_pos - point_pos).normalized();
@@ -378,7 +378,7 @@ int CurveEditor::get_point_at(Vector2 pos) const {
const float r = _hover_radius * _hover_radius;
for (int i = 0; i < curve.get_point_count(); ++i) {
- Vector2 p = get_view_pos(curve.get_point_pos(i));
+ Vector2 p = get_view_pos(curve.get_point_position(i));
if (p.distance_squared_to(pos) <= r) {
return i;
}
@@ -525,8 +525,8 @@ Vector2 CurveEditor::get_tangent_view_pos(int i, TangentIndex tangent) const {
else
dir = Vector2(1, _curve_ref->get_point_right_tangent(i));
- Vector2 point_pos = get_view_pos(_curve_ref->get_point_pos(i));
- Vector2 control_pos = get_view_pos(_curve_ref->get_point_pos(i) + dir);
+ Vector2 point_pos = get_view_pos(_curve_ref->get_point_position(i));
+ Vector2 control_pos = get_view_pos(_curve_ref->get_point_position(i) + dir);
return point_pos + _tangents_length * (control_pos - point_pos).normalized();
}
@@ -549,8 +549,8 @@ static void plot_curve_accurate(const Curve &curve, float step, T plot_func) {
plot_func(Vector2(0, y), Vector2(1.f, y), true);
} else {
- Vector2 first_point = curve.get_point_pos(0);
- Vector2 last_point = curve.get_point_pos(curve.get_point_count() - 1);
+ Vector2 first_point = curve.get_point_position(0);
+ Vector2 last_point = curve.get_point_position(curve.get_point_count() - 1);
// Edge lines
plot_func(Vector2(0, first_point.y), first_point, false);
@@ -559,8 +559,8 @@ static void plot_curve_accurate(const Curve &curve, float step, T plot_func) {
// Draw section by section, so that we get maximum precision near points.
// It's an accurate representation, but slower than using the baked one.
for (int i = 1; i < curve.get_point_count(); ++i) {
- Vector2 a = curve.get_point_pos(i - 1);
- Vector2 b = curve.get_point_pos(i);
+ Vector2 a = curve.get_point_position(i - 1);
+ Vector2 b = curve.get_point_position(i);
Vector2 pos = a;
Vector2 prev_pos = a;
@@ -667,7 +667,7 @@ void CurveEditor::_draw() {
const Color tangent_color(0.5, 0.5, 1, 1);
int i = _selected_point;
- Vector2 pos = curve.get_point_pos(i);
+ Vector2 pos = curve.get_point_position(i);
if (i != 0) {
Vector2 control_pos = get_tangent_view_pos(i, TANGENT_LEFT);
@@ -718,7 +718,7 @@ void CurveEditor::_draw() {
const Color selected_point_color(1, 0.5, 0.5);
for (int i = 0; i < curve.get_point_count(); ++i) {
- Vector2 pos = curve.get_point_pos(i);
+ Vector2 pos = curve.get_point_position(i);
draw_rect(Rect2(get_view_pos(pos), Vector2(1, 1)).grow(3), i == _selected_point ? selected_point_color : point_color);
// TODO Circles are prettier. Needs a fix! Or a texture
//draw_circle(pos, 2, point_color);
@@ -728,7 +728,7 @@ void CurveEditor::_draw() {
if (_hover_point != -1) {
const Color hover_color = line_color;
- Vector2 pos = curve.get_point_pos(_hover_point);
+ Vector2 pos = curve.get_point_position(_hover_point);
stroke_rect(Rect2(get_view_pos(pos), Vector2(1, 1)).grow(_hover_radius), hover_color);
}
diff --git a/editor/plugins/line_2d_editor_plugin.cpp b/editor/plugins/line_2d_editor_plugin.cpp
index 84620a75a5..ef3ee6a78f 100644
--- a/editor/plugins/line_2d_editor_plugin.cpp
+++ b/editor/plugins/line_2d_editor_plugin.cpp
@@ -66,7 +66,7 @@ int Line2DEditor::get_point_index_at(Vector2 gpos) {
Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
for (int i = 0; i < node->get_point_count(); ++i) {
- Point2 p = xform.xform(node->get_point_pos(i));
+ Point2 p = xform.xform(node->get_point_position(i));
if (gpos.distance_to(p) < grab_threshold) {
return i;
}
@@ -96,12 +96,12 @@ bool Line2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (mb->get_button_index() == BUTTON_LEFT && !mb->get_shift() && mode == MODE_EDIT) {
_dragging = true;
action_point = i;
- moving_from = node->get_point_pos(i);
+ moving_from = node->get_point_position(i);
moving_screen_from = gpoint;
} else if ((mb->get_button_index() == BUTTON_RIGHT && mode == MODE_EDIT) || (mb->get_button_index() == BUTTON_LEFT && mode == MODE_DELETE)) {
undo_redo->create_action(TTR("Remove Point from Line2D"));
undo_redo->add_do_method(node, "remove_point", i);
- undo_redo->add_undo_method(node, "add_point", node->get_point_pos(i), i);
+ undo_redo->add_undo_method(node, "add_point", node->get_point_position(i), i);
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();
@@ -121,7 +121,7 @@ bool Line2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
_dragging = true;
action_point = node->get_point_count() - 1;
- moving_from = node->get_point_pos(action_point);
+ moving_from = node->get_point_position(action_point);
moving_screen_from = gpoint;
canvas_item_editor->get_viewport_control()->update();
@@ -131,8 +131,8 @@ bool Line2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (!mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && _dragging) {
undo_redo->create_action(TTR("Move Point in Line2D"));
- undo_redo->add_do_method(node, "set_point_pos", action_point, cpoint);
- undo_redo->add_undo_method(node, "set_point_pos", action_point, moving_from);
+ undo_redo->add_do_method(node, "set_point_position", action_point, cpoint);
+ undo_redo->add_undo_method(node, "set_point_position", action_point, moving_from);
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();
@@ -147,7 +147,7 @@ bool Line2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (_dragging) {
Vector2 cpoint = mouse_to_local_pos(mm->get_position(), mm->get_alt());
- node->set_point_pos(action_point, cpoint);
+ node->set_point_position(action_point, cpoint);
canvas_item_editor->get_viewport_control()->update();
return true;
}
@@ -172,7 +172,7 @@ void Line2DEditor::_canvas_draw() {
Control *vpc = canvas_item_editor->get_viewport_control();
for (int i = 0; i < len; ++i) {
- Vector2 point = xform.xform(node->get_point_pos(i));
+ Vector2 point = xform.xform(node->get_point_position(i));
vpc->draw_texture_rect(handle, Rect2(point - handle_size * 0.5, handle_size), false);
}
}
diff --git a/editor/plugins/navigation_mesh_editor_plugin.h b/editor/plugins/navigation_mesh_editor_plugin.h
index 3009e2addc..bac7f608ab 100644
--- a/editor/plugins/navigation_mesh_editor_plugin.h
+++ b/editor/plugins/navigation_mesh_editor_plugin.h
@@ -56,7 +56,7 @@ class NavigationMeshEditor : public Control {
protected:
void _node_removed(Node *p_node);
static void _bind_methods();
- void _notification(int p_what);
+ void _notification(int p_option);
public:
void edit(NavigationMeshInstance *p_nav_mesh_instance);
@@ -74,8 +74,8 @@ class NavigationMeshEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "NavigationMesh"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
NavigationMeshEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/navigation_mesh_generator.h b/editor/plugins/navigation_mesh_generator.h
index 48e7dfe53f..0a1c497f8f 100644
--- a/editor/plugins/navigation_mesh_generator.h
+++ b/editor/plugins/navigation_mesh_generator.h
@@ -56,7 +56,7 @@ protected:
rcPolyMeshDetail *detail_mesh, Vector<float> &verticies, Vector<int> &indices);
public:
- static void bake(Ref<NavigationMesh> p_nav_mesh, Node *p_base);
+ static void bake(Ref<NavigationMesh> p_nav_mesh, Node *p_node);
static void clear(Ref<NavigationMesh> p_nav_mesh);
};
diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp
index adc8d4f091..1160e90384 100644
--- a/editor/plugins/path_2d_editor_plugin.cpp
+++ b/editor/plugins/path_2d_editor_plugin.cpp
@@ -89,9 +89,9 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
for (int i = 0; i < curve->get_point_count(); i++) {
- real_t dist_to_p = gpoint.distance_to(xform.xform(curve->get_point_pos(i)));
- real_t dist_to_p_out = gpoint.distance_to(xform.xform(curve->get_point_pos(i) + curve->get_point_out(i)));
- real_t dist_to_p_in = gpoint.distance_to(xform.xform(curve->get_point_pos(i) + curve->get_point_in(i)));
+ real_t dist_to_p = gpoint.distance_to(xform.xform(curve->get_point_position(i)));
+ real_t dist_to_p_out = gpoint.distance_to(xform.xform(curve->get_point_position(i) + curve->get_point_out(i)));
+ real_t dist_to_p_in = gpoint.distance_to(xform.xform(curve->get_point_position(i) + curve->get_point_in(i)));
// Check for point movement start (for point + in/out controls).
if (mb->get_button_index() == BUTTON_LEFT) {
@@ -100,7 +100,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
action = ACTION_MOVING_POINT;
action_point = i;
- moving_from = curve->get_point_pos(i);
+ moving_from = curve->get_point_position(i);
moving_screen_from = gpoint;
return true;
} else if (mode == MODE_EDIT || mode == MODE_EDIT_CURVE) {
@@ -129,7 +129,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
undo_redo->create_action(TTR("Remove Point from Curve"));
undo_redo->add_do_method(curve.ptr(), "remove_point", i);
- undo_redo->add_undo_method(curve.ptr(), "add_point", curve->get_point_pos(i), curve->get_point_in(i), curve->get_point_out(i), i);
+ undo_redo->add_undo_method(curve.ptr(), "add_point", curve->get_point_position(i), curve->get_point_in(i), curve->get_point_out(i), i);
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();
@@ -171,7 +171,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
action = ACTION_MOVING_POINT;
action_point = curve->get_point_count() - 1;
- moving_from = curve->get_point_pos(action_point);
+ moving_from = curve->get_point_position(action_point);
moving_screen_from = gpoint;
canvas_item_editor->get_viewport_control()->update();
@@ -194,8 +194,8 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
case ACTION_MOVING_POINT: {
undo_redo->create_action(TTR("Move Point in Curve"));
- undo_redo->add_do_method(curve.ptr(), "set_point_pos", action_point, cpoint);
- undo_redo->add_undo_method(curve.ptr(), "set_point_pos", action_point, moving_from);
+ undo_redo->add_do_method(curve.ptr(), "set_point_position", action_point, cpoint);
+ undo_redo->add_undo_method(curve.ptr(), "set_point_position", action_point, moving_from);
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();
@@ -255,7 +255,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
break;
case ACTION_MOVING_POINT: {
- curve->set_point_pos(action_point, cpoint);
+ curve->set_point_position(action_point, cpoint);
} break;
case ACTION_MOVING_IN: {
@@ -296,17 +296,17 @@ void Path2DEditor::_canvas_draw() {
for (int i = 0; i < len; i++) {
- Vector2 point = xform.xform(curve->get_point_pos(i));
+ Vector2 point = xform.xform(curve->get_point_position(i));
vpc->draw_texture_rect(handle, Rect2(point - handle_size * 0.5, handle_size), false, Color(1, 1, 1, 1));
if (i < len - 1) {
- Vector2 pointout = xform.xform(curve->get_point_pos(i) + curve->get_point_out(i));
+ Vector2 pointout = xform.xform(curve->get_point_position(i) + curve->get_point_out(i));
vpc->draw_line(point, pointout, Color(0.5, 0.5, 1.0, 0.8), 1.0);
vpc->draw_texture_rect(handle, Rect2(pointout - handle_size * 0.5, handle_size), false, Color(1, 0.5, 1, 0.3));
}
if (i > 0) {
- Vector2 pointin = xform.xform(curve->get_point_pos(i) + curve->get_point_in(i));
+ Vector2 pointin = xform.xform(curve->get_point_position(i) + curve->get_point_in(i));
vpc->draw_line(point, pointin, Color(0.5, 0.5, 1.0, 0.8), 1.0);
vpc->draw_texture_rect(handle, Rect2(pointin - handle_size * 0.5, handle_size), false, Color(1, 0.5, 1, 0.3));
}
@@ -389,8 +389,8 @@ void Path2DEditor::_mode_selected(int p_mode) {
if (node->get_curve()->get_point_count() < 3)
return;
- Vector2 begin = node->get_curve()->get_point_pos(0);
- Vector2 end = node->get_curve()->get_point_pos(node->get_curve()->get_point_count() - 1);
+ Vector2 begin = node->get_curve()->get_point_position(0);
+ Vector2 end = node->get_curve()->get_point_position(node->get_curve()->get_point_count() - 1);
if (begin.distance_to(end) < CMP_EPSILON)
return;
diff --git a/editor/plugins/path_editor_plugin.cpp b/editor/plugins/path_editor_plugin.cpp
index d0f2b19ed3..fa97c96614 100644
--- a/editor/plugins/path_editor_plugin.cpp
+++ b/editor/plugins/path_editor_plugin.cpp
@@ -64,7 +64,7 @@ Variant PathSpatialGizmo::get_handle_value(int p_idx) const {
if (p_idx < c->get_point_count()) {
- original = c->get_point_pos(p_idx);
+ original = c->get_point_position(p_idx);
return original;
}
@@ -79,7 +79,7 @@ Variant PathSpatialGizmo::get_handle_value(int p_idx) const {
else
ofs = c->get_point_out(idx);
- original = ofs + c->get_point_pos(idx);
+ original = ofs + c->get_point_position(idx);
return ofs;
}
@@ -108,7 +108,7 @@ void PathSpatialGizmo::set_handle(int p_idx, Camera *p_camera, const Point2 &p_p
}
Vector3 local = gi.xform(inters);
- c->set_point_pos(p_idx, local);
+ c->set_point_position(p_idx, local);
}
return;
@@ -119,7 +119,7 @@ void PathSpatialGizmo::set_handle(int p_idx, Camera *p_camera, const Point2 &p_p
int idx = p_idx / 2;
int t = p_idx % 2;
- Vector3 base = c->get_point_pos(idx);
+ Vector3 base = c->get_point_position(idx);
Plane p(gt.xform(original), p_camera->get_transform().basis.get_axis(2));
@@ -148,12 +148,12 @@ void PathSpatialGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p
if (p_cancel) {
- c->set_point_pos(p_idx, p_restore);
+ c->set_point_position(p_idx, p_restore);
return;
}
- ur->create_action(TTR("Set Curve Point Pos"));
- ur->add_do_method(c.ptr(), "set_point_pos", p_idx, c->get_point_pos(p_idx));
- ur->add_undo_method(c.ptr(), "set_point_pos", p_idx, p_restore);
+ ur->create_action(TTR("Set Curve Point Position"));
+ ur->add_do_method(c.ptr(), "set_point_position", p_idx, c->get_point_position(p_idx));
+ ur->add_undo_method(c.ptr(), "set_point_position", p_idx, p_restore);
ur->commit_action();
return;
@@ -178,7 +178,7 @@ void PathSpatialGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p
c->set_point_in(p_idx, p_restore);
return;
}
- ur->create_action(TTR("Set Curve In Pos"));
+ ur->create_action(TTR("Set Curve In Position"));
ur->add_do_method(c.ptr(), "set_point_in", idx, c->get_point_in(idx));
ur->add_undo_method(c.ptr(), "set_point_in", idx, p_restore);
ur->commit_action();
@@ -189,7 +189,7 @@ void PathSpatialGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p
c->set_point_out(idx, p_restore);
return;
}
- ur->create_action(TTR("Set Curve Out Pos"));
+ ur->create_action(TTR("Set Curve Out Position"));
ur->add_do_method(c.ptr(), "set_point_out", idx, c->get_point_out(idx));
ur->add_undo_method(c.ptr(), "set_point_out", idx, p_restore);
ur->commit_action();
@@ -234,7 +234,7 @@ void PathSpatialGizmo::redraw() {
for (int i = 0; i < c->get_point_count(); i++) {
- Vector3 p = c->get_point_pos(i);
+ Vector3 p = c->get_point_position(i);
handles.push_back(p);
if (i > 0) {
v3p.push_back(p);
@@ -307,16 +307,16 @@ bool PathEditorPlugin::forward_spatial_gui_input(Camera *p_camera, const Ref<Inp
if (rc >= 2) {
PoolVector<Vector3>::Read r = v3a.read();
- if (p_camera->unproject_position(gt.xform(c->get_point_pos(0))).distance_to(mbpos) < click_dist)
+ if (p_camera->unproject_position(gt.xform(c->get_point_position(0))).distance_to(mbpos) < click_dist)
return false; //nope, existing
for (int i = 0; i < c->get_point_count() - 1; i++) {
//find the offset and point index of the place to break up
int j = idx;
- if (p_camera->unproject_position(gt.xform(c->get_point_pos(i + 1))).distance_to(mbpos) < click_dist)
+ if (p_camera->unproject_position(gt.xform(c->get_point_position(i + 1))).distance_to(mbpos) < click_dist)
return false; //nope, existing
- while (j < rc && c->get_point_pos(i + 1) != r[j]) {
+ while (j < rc && c->get_point_position(i + 1) != r[j]) {
Vector3 from = r[j];
Vector3 to = r[j + 1];
@@ -371,7 +371,7 @@ bool PathEditorPlugin::forward_spatial_gui_input(Camera *p_camera, const Ref<Inp
if (c->get_point_count() == 0)
org = path->get_transform().get_origin();
else
- org = gt.xform(c->get_point_pos(c->get_point_count() - 1));
+ org = gt.xform(c->get_point_position(c->get_point_count() - 1));
Plane p(org, p_camera->get_transform().basis.get_axis(2));
Vector3 ray_from = p_camera->project_ray_origin(mbpos);
Vector3 ray_dir = p_camera->project_ray_normal(mbpos);
@@ -392,9 +392,9 @@ bool PathEditorPlugin::forward_spatial_gui_input(Camera *p_camera, const Ref<Inp
} else if (mb->is_pressed() && ((mb->get_button_index() == BUTTON_LEFT && curve_del->is_pressed()) || (mb->get_button_index() == BUTTON_RIGHT && curve_edit->is_pressed()))) {
for (int i = 0; i < c->get_point_count(); i++) {
- real_t dist_to_p = p_camera->unproject_position(gt.xform(c->get_point_pos(i))).distance_to(mbpos);
- real_t dist_to_p_out = p_camera->unproject_position(gt.xform(c->get_point_pos(i) + c->get_point_out(i))).distance_to(mbpos);
- real_t dist_to_p_in = p_camera->unproject_position(gt.xform(c->get_point_pos(i) + c->get_point_in(i))).distance_to(mbpos);
+ real_t dist_to_p = p_camera->unproject_position(gt.xform(c->get_point_position(i))).distance_to(mbpos);
+ real_t dist_to_p_out = p_camera->unproject_position(gt.xform(c->get_point_position(i) + c->get_point_out(i))).distance_to(mbpos);
+ real_t dist_to_p_in = p_camera->unproject_position(gt.xform(c->get_point_position(i) + c->get_point_in(i))).distance_to(mbpos);
// Find the offset and point index of the place to break up.
// Also check for the control points.
@@ -403,7 +403,7 @@ bool PathEditorPlugin::forward_spatial_gui_input(Camera *p_camera, const Ref<Inp
UndoRedo *ur = editor->get_undo_redo();
ur->create_action(TTR("Remove Path Point"));
ur->add_do_method(c.ptr(), "remove_point", i);
- ur->add_undo_method(c.ptr(), "add_point", c->get_point_pos(i), c->get_point_in(i), c->get_point_out(i), i);
+ ur->add_undo_method(c.ptr(), "add_point", c->get_point_position(i), c->get_point_in(i), c->get_point_out(i), i);
ur->commit_action();
return true;
} else if (dist_to_p_out < click_dist) {
@@ -496,7 +496,7 @@ void PathEditorPlugin::_close_curve() {
return;
if (c->get_point_count() < 2)
return;
- c->add_point(c->get_point_pos(0), c->get_point_in(0), c->get_point_out(0));
+ c->add_point(c->get_point_position(0), c->get_point_in(0), c->get_point_out(0));
}
void PathEditorPlugin::_notification(int p_what) {
diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp
index 3917c700f0..8c4e1b8f27 100644
--- a/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -52,7 +52,7 @@ void Polygon2DEditor::_notification(int p_what) {
uv_button[UV_MODE_SCALE]->set_icon(get_icon("ToolScale", "EditorIcons"));
b_snap_grid->set_icon(get_icon("Grid", "EditorIcons"));
- b_snap_enable->set_icon(get_icon("Snap", "EditorIcons"));
+ 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");
diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp
index e157ddbf90..da4a3f84d6 100644
--- a/editor/plugins/resource_preloader_editor_plugin.cpp
+++ b/editor/plugins/resource_preloader_editor_plugin.cpp
@@ -254,7 +254,7 @@ void ResourcePreloaderEditor::edit(ResourcePreloader *p_preloader) {
Variant ResourcePreloaderEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
- TreeItem *ti = tree->get_item_at_pos(p_point);
+ TreeItem *ti = tree->get_item_at_position(p_point);
if (!ti)
return Variant();
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 44a9bc6d2e..9af5885a17 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -1682,9 +1682,10 @@ bool ScriptEditor::edit(const Ref<Script> &p_script, int p_line, int p_col, bool
break;
}
ERR_FAIL_COND_V(!se, false);
- tab_container->add_child(se);
+ // 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_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 d2cb96bf3b..d3c75d1c42 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -75,35 +75,98 @@ void ScriptTextEditor::_load_theme_settings() {
text_edit->clear_colors();
- /* keyword color */
-
- text_edit->add_color_override("background_color", EDITOR_DEF("text_editor/highlighting/background_color", Color(0, 0, 0, 0)));
- text_edit->add_color_override("completion_background_color", EDITOR_DEF("text_editor/highlighting/completion_background_color", Color(0, 0, 0, 0)));
- text_edit->add_color_override("completion_selected_color", EDITOR_DEF("text_editor/highlighting/completion_selected_color", Color::html("434244")));
- text_edit->add_color_override("completion_existing_color", EDITOR_DEF("text_editor/highlighting/completion_existing_color", Color::html("21dfdfdf")));
- text_edit->add_color_override("completion_scroll_color", EDITOR_DEF("text_editor/highlighting/completion_scroll_color", Color::html("ffffff")));
- text_edit->add_color_override("completion_font_color", EDITOR_DEF("text_editor/highlighting/completion_font_color", Color::html("aaaaaa")));
- text_edit->add_color_override("font_color", EDITOR_DEF("text_editor/highlighting/text_color", Color(0, 0, 0)));
- text_edit->add_color_override("line_number_color", EDITOR_DEF("text_editor/highlighting/line_number_color", Color(0, 0, 0)));
- text_edit->add_color_override("caret_color", EDITOR_DEF("text_editor/highlighting/caret_color", Color(0, 0, 0)));
- text_edit->add_color_override("caret_background_color", EDITOR_DEF("text_editor/highlighting/caret_background_color", Color(0, 0, 0)));
- text_edit->add_color_override("font_selected_color", EDITOR_DEF("text_editor/highlighting/text_selected_color", Color(1, 1, 1)));
- text_edit->add_color_override("selection_color", EDITOR_DEF("text_editor/highlighting/selection_color", Color(0.2, 0.2, 1)));
- text_edit->add_color_override("brace_mismatch_color", EDITOR_DEF("text_editor/highlighting/brace_mismatch_color", Color(1, 0.2, 0.2)));
- text_edit->add_color_override("current_line_color", EDITOR_DEF("text_editor/highlighting/current_line_color", Color(0.3, 0.5, 0.8, 0.15)));
- text_edit->add_color_override("line_length_guideline_color", EDITOR_DEF("text_editor/highlighting/line_length_guideline_color", Color(0, 0, 0)));
- text_edit->add_color_override("word_highlighted_color", EDITOR_DEF("text_editor/highlighting/word_highlighted_color", Color(0.8, 0.9, 0.9, 0.15)));
- text_edit->add_color_override("number_color", EDITOR_DEF("text_editor/highlighting/number_color", Color(0.9, 0.6, 0.0, 2)));
- text_edit->add_color_override("function_color", EDITOR_DEF("text_editor/highlighting/function_color", Color(0.4, 0.6, 0.8)));
- text_edit->add_color_override("member_variable_color", EDITOR_DEF("text_editor/highlighting/member_variable_color", Color(0.9, 0.3, 0.3)));
- text_edit->add_color_override("mark_color", EDITOR_DEF("text_editor/highlighting/mark_color", Color(1.0, 0.4, 0.4, 0.4)));
- text_edit->add_color_override("breakpoint_color", EDITOR_DEF("text_editor/highlighting/breakpoint_color", Color(0.8, 0.8, 0.4, 0.2)));
- text_edit->add_color_override("search_result_color", EDITOR_DEF("text_editor/highlighting/search_result_color", Color(0.05, 0.25, 0.05, 1)));
- text_edit->add_color_override("search_result_border_color", EDITOR_DEF("text_editor/highlighting/search_result_border_color", Color(0.1, 0.45, 0.1, 1)));
- text_edit->add_color_override("symbol_color", EDITOR_DEF("text_editor/highlighting/symbol_color", Color::hex(0x005291ff)));
- text_edit->add_constant_override("line_spacing", EDITOR_DEF("text_editor/theme/line_spacing", 4));
+ Color background_color = EDITOR_DEF("text_editor/highlighting/background_color", Color(0, 0, 0, 0));
+ Color completion_background_color = EDITOR_DEF("text_editor/highlighting/completion_background_color", Color(0, 0, 0, 0));
+ Color completion_selected_color = EDITOR_DEF("text_editor/highlighting/completion_selected_color", Color::html("434244"));
+ Color completion_existing_color = EDITOR_DEF("text_editor/highlighting/completion_existing_color", Color::html("21dfdfdf"));
+ Color completion_scroll_color = EDITOR_DEF("text_editor/highlighting/completion_scroll_color", Color::html("ffffff"));
+ Color completion_font_color = EDITOR_DEF("text_editor/highlighting/completion_font_color", Color::html("aaaaaa"));
+ Color text_color = EDITOR_DEF("text_editor/highlighting/text_color", Color(0, 0, 0));
+ Color line_number_color = EDITOR_DEF("text_editor/highlighting/line_number_color", Color(0, 0, 0));
+ Color caret_color = EDITOR_DEF("text_editor/highlighting/caret_color", Color(0, 0, 0));
+ Color caret_background_color = EDITOR_DEF("text_editor/highlighting/caret_background_color", Color(0, 0, 0));
+ Color text_selected_color = EDITOR_DEF("text_editor/highlighting/text_selected_color", Color(1, 1, 1));
+ Color selection_color = EDITOR_DEF("text_editor/highlighting/selection_color", Color(0.2, 0.2, 1));
+ Color brace_mismatch_color = EDITOR_DEF("text_editor/highlighting/brace_mismatch_color", Color(1, 0.2, 0.2));
+ Color current_line_color = EDITOR_DEF("text_editor/highlighting/current_line_color", Color(0.3, 0.5, 0.8, 0.15));
+ Color line_length_guideline_color = EDITOR_DEF("text_editor/highlighting/line_length_guideline_color", Color(0, 0, 0));
+ Color word_highlighted_color = EDITOR_DEF("text_editor/highlighting/word_highlighted_color", Color(0.8, 0.9, 0.9, 0.15));
+ Color number_color = EDITOR_DEF("text_editor/highlighting/number_color", Color(0.9, 0.6, 0.0, 2));
+ Color function_color = EDITOR_DEF("text_editor/highlighting/function_color", Color(0.4, 0.6, 0.8));
+ Color member_variable_color = EDITOR_DEF("text_editor/highlighting/member_variable_color", Color(0.9, 0.3, 0.3));
+ Color mark_color = EDITOR_DEF("text_editor/highlighting/mark_color", Color(1.0, 0.4, 0.4, 0.4));
+ Color breakpoint_color = EDITOR_DEF("text_editor/highlighting/breakpoint_color", Color(0.8, 0.8, 0.4, 0.2));
+ Color search_result_color = EDITOR_DEF("text_editor/highlighting/search_result_color", Color(0.05, 0.25, 0.05, 1));
+ Color search_result_border_color = EDITOR_DEF("text_editor/highlighting/search_result_border_color", Color(0.1, 0.45, 0.1, 1));
+ Color symbol_color = EDITOR_DEF("text_editor/highlighting/symbol_color", Color::hex(0x005291ff));
Color keyword_color = EDITOR_DEF("text_editor/highlighting/keyword_color", Color(0.5, 0.0, 0.2));
+ Color basetype_color = EDITOR_DEF("text_editor/highlighting/base_type_color", Color(0.3, 0.3, 0.0));
+ Color type_color = EDITOR_DEF("text_editor/highlighting/engine_type_color", Color(0.0, 0.2, 0.4));
+ Color comment_color = EDITOR_DEF("text_editor/highlighting/comment_color", Color::hex(0x797e7eff));
+ Color string_color = EDITOR_DEF("text_editor/highlighting/string_color", Color::hex(0x6b6f00ff));
+
+ // Adapt
+ if (EditorSettings::get_singleton()->get("text_editor/theme/color_theme") == "Adaptive") {
+ Ref<Theme> tm = EditorNode::get_singleton()->get_theme_base()->get_theme();
+
+ symbol_color = tm->get_color("text_editor/theme/symbol_color", "Editor");
+ keyword_color = tm->get_color("text_editor/theme/keyword_color", "Editor");
+ basetype_color = tm->get_color("text_editor/theme/basetype_color", "Editor");
+ type_color = tm->get_color("text_editor/theme/type_color", "Editor");
+ comment_color = tm->get_color("text_editor/theme/comment_color", "Editor");
+ string_color = tm->get_color("text_editor/theme/string_color", "Editor");
+ background_color = tm->get_color("text_editor/theme/background_color", "Editor");
+ completion_background_color = tm->get_color("text_editor/theme/completion_background_color", "Editor");
+ completion_selected_color = tm->get_color("text_editor/theme/completion_selected_color", "Editor");
+ completion_existing_color = tm->get_color("text_editor/theme/completion_existing_color", "Editor");
+ completion_scroll_color = tm->get_color("text_editor/theme/completion_scroll_color", "Editor");
+ completion_font_color = tm->get_color("text_editor/theme/completion_font_color", "Editor");
+ text_color = tm->get_color("text_editor/theme/text_color", "Editor");
+ line_number_color = tm->get_color("text_editor/theme/line_number_color", "Editor");
+ caret_color = tm->get_color("text_editor/theme/caret_color", "Editor");
+ caret_background_color = tm->get_color("text_editor/theme/caret_background_color", "Editor");
+ text_selected_color = tm->get_color("text_editor/theme/text_selected_color", "Editor");
+ selection_color = tm->get_color("text_editor/theme/selection_color", "Editor");
+ brace_mismatch_color = tm->get_color("text_editor/theme/brace_mismatch_color", "Editor");
+ current_line_color = tm->get_color("text_editor/theme/current_line_color", "Editor");
+ line_length_guideline_color = tm->get_color("text_editor/theme/line_length_guideline_color", "Editor");
+ word_highlighted_color = tm->get_color("text_editor/theme/word_highlighted_color", "Editor");
+ number_color = tm->get_color("text_editor/theme/number_color", "Editor");
+ function_color = tm->get_color("text_editor/theme/function_color", "Editor");
+ member_variable_color = tm->get_color("text_editor/theme/member_variable_color", "Editor");
+ mark_color = tm->get_color("text_editor/theme/mark_color", "Editor");
+ breakpoint_color = tm->get_color("text_editor/theme/breakpoint_color", "Editor");
+ search_result_color = tm->get_color("text_editor/theme/search_result_color", "Editor");
+ search_result_border_color = tm->get_color("text_editor/theme/search_result_border_color", "Editor");
+ }
+
+ text_edit->add_color_override("background_color", background_color);
+ text_edit->add_color_override("completion_background_color", completion_background_color);
+ text_edit->add_color_override("completion_selected_color", completion_selected_color);
+ text_edit->add_color_override("completion_existing_color", completion_existing_color);
+ text_edit->add_color_override("completion_scroll_color", completion_scroll_color);
+ text_edit->add_color_override("completion_font_color", completion_font_color);
+ text_edit->add_color_override("font_color", text_color);
+ text_edit->add_color_override("line_number_color", line_number_color);
+ text_edit->add_color_override("caret_color", caret_color);
+ text_edit->add_color_override("caret_background_color", caret_background_color);
+ text_edit->add_color_override("font_selected_color", text_selected_color);
+ text_edit->add_color_override("selection_color", selection_color);
+ text_edit->add_color_override("brace_mismatch_color", brace_mismatch_color);
+ text_edit->add_color_override("current_line_color", current_line_color);
+ text_edit->add_color_override("line_length_guideline_color", line_length_guideline_color);
+ text_edit->add_color_override("word_highlighted_color", word_highlighted_color);
+ text_edit->add_color_override("number_color", number_color);
+ text_edit->add_color_override("function_color", function_color);
+ text_edit->add_color_override("member_variable_color", member_variable_color);
+ text_edit->add_color_override("mark_color", mark_color);
+ text_edit->add_color_override("breakpoint_color", breakpoint_color);
+ text_edit->add_color_override("search_result_color", search_result_color);
+ text_edit->add_color_override("search_result_border_color", search_result_border_color);
+ text_edit->add_color_override("symbol_color", symbol_color);
+
+ text_edit->add_constant_override("line_spacing", EDITOR_DEF("text_editor/theme/line_spacing", 4));
List<String> keywords;
script->get_language()->get_reserved_words(&keywords);
@@ -113,8 +176,6 @@ void ScriptTextEditor::_load_theme_settings() {
}
//colorize core types
- Color basetype_color = EDITOR_DEF("text_editor/highlighting/base_type_color", Color(0.3, 0.3, 0.0));
-
text_edit->add_keyword_color("String", basetype_color);
text_edit->add_keyword_color("Vector2", basetype_color);
text_edit->add_keyword_color("Rect2", basetype_color);
@@ -140,8 +201,6 @@ void ScriptTextEditor::_load_theme_settings() {
text_edit->add_keyword_color("PoolColorArray", basetype_color);
//colorize engine types
- Color type_color = EDITOR_DEF("text_editor/highlighting/engine_type_color", Color(0.0, 0.2, 0.4));
-
List<StringName> types;
ClassDB::get_class_list(&types);
@@ -155,7 +214,6 @@ void ScriptTextEditor::_load_theme_settings() {
}
//colorize comments
- Color comment_color = EDITOR_DEF("text_editor/highlighting/comment_color", Color::hex(0x797e7eff));
List<String> comments;
script->get_language()->get_comment_delimiters(&comments);
@@ -169,7 +227,6 @@ void ScriptTextEditor::_load_theme_settings() {
}
//colorize strings
- Color string_color = EDITOR_DEF("text_editor/highlighting/string_color", Color::hex(0x6b6f00ff));
List<String> strings;
script->get_language()->get_string_delimiters(&strings);
@@ -209,6 +266,7 @@ void ScriptTextEditor::_notification(int p_what) {
if (p_what == NOTIFICATION_READY) {
//emit_signal("name_changed");
+ _load_theme_settings();
}
}
@@ -248,7 +306,7 @@ Variant ScriptTextEditor::get_edit_state() {
Dictionary state;
- state["scroll_pos"] = code_editor->get_text_edit()->get_v_scroll();
+ state["scroll_position"] = code_editor->get_text_edit()->get_v_scroll();
state["column"] = code_editor->get_text_edit()->cursor_get_column();
state["row"] = code_editor->get_text_edit()->cursor_get_line();
@@ -451,7 +509,7 @@ 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_pos"]);
+ 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()->grab_focus();
@@ -492,8 +550,6 @@ void ScriptTextEditor::set_edited_script(const Ref<Script> &p_script) {
script = p_script;
- _load_theme_settings();
-
code_editor->get_text_edit()->set_text(script->get_source_code());
code_editor->get_text_edit()->clear_undo_history();
code_editor->get_text_edit()->tag_saved_version();
@@ -1341,7 +1397,7 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
float alpha = color.size() > 3 ? color[3] : 1.0f;
color_picker->set_pick_color(Color(color[0], color[1], color[2], alpha));
}
- color_panel->set_position(get_global_transform().xform(get_local_mouse_pos()));
+ color_panel->set_position(get_global_transform().xform(get_local_mouse_position()));
} else {
have_color = false;
}
@@ -1389,7 +1445,7 @@ void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color) {
context_menu->add_separator();
context_menu->add_item(TTR("Pick Color"), EDIT_PICK_COLOR);
}
- context_menu->set_position(get_global_transform().xform(get_local_mouse_pos()));
+ context_menu->set_position(get_global_transform().xform(get_local_mouse_position()));
context_menu->set_size(Vector2(1, 1));
context_menu->popup();
}
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 1b02f18d85..b0ee1a32ca 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -60,33 +60,96 @@ void ShaderTextEditor::_load_theme_settings() {
get_text_edit()->clear_colors();
- /* keyword color */
-
- get_text_edit()->add_color_override("background_color", EDITOR_DEF("text_editor/highlighting/background_color", Color(0, 0, 0, 0)));
- get_text_edit()->add_color_override("completion_background_color", EDITOR_DEF("text_editor/highlighting/completion_background_color", Color(0, 0, 0, 0)));
- get_text_edit()->add_color_override("completion_selected_color", EDITOR_DEF("text_editor/highlighting/completion_selected_color", Color::html("434244")));
- get_text_edit()->add_color_override("completion_existing_color", EDITOR_DEF("text_editor/highlighting/completion_existing_color", Color::html("21dfdfdf")));
- get_text_edit()->add_color_override("completion_scroll_color", EDITOR_DEF("text_editor/highlighting/completion_scroll_color", Color::html("ffffff")));
- get_text_edit()->add_color_override("completion_font_color", EDITOR_DEF("text_editor/highlighting/completion_font_color", Color::html("aaaaaa")));
- get_text_edit()->add_color_override("font_color", EDITOR_DEF("text_editor/highlighting/text_color", Color(0, 0, 0)));
- get_text_edit()->add_color_override("line_number_color", EDITOR_DEF("text_editor/highlighting/line_number_color", Color(0, 0, 0)));
- get_text_edit()->add_color_override("caret_color", EDITOR_DEF("text_editor/highlighting/caret_color", Color(0, 0, 0)));
- get_text_edit()->add_color_override("caret_background_color", EDITOR_DEF("text_editor/highlighting/caret_background_color", Color(0, 0, 0)));
- get_text_edit()->add_color_override("font_selected_color", EDITOR_DEF("text_editor/highlighting/text_selected_color", Color(1, 1, 1)));
- get_text_edit()->add_color_override("selection_color", EDITOR_DEF("text_editor/highlighting/selection_color", Color(0.2, 0.2, 1)));
- get_text_edit()->add_color_override("brace_mismatch_color", EDITOR_DEF("text_editor/highlighting/brace_mismatch_color", Color(1, 0.2, 0.2)));
- get_text_edit()->add_color_override("current_line_color", EDITOR_DEF("text_editor/highlighting/current_line_color", Color(0.3, 0.5, 0.8, 0.15)));
- get_text_edit()->add_color_override("word_highlighted_color", EDITOR_DEF("text_editor/highlighting/word_highlighted_color", Color(0.8, 0.9, 0.9, 0.15)));
- get_text_edit()->add_color_override("number_color", EDITOR_DEF("text_editor/highlighting/number_color", Color(0.9, 0.6, 0.0, 2)));
- get_text_edit()->add_color_override("function_color", EDITOR_DEF("text_editor/highlighting/function_color", Color(0.4, 0.6, 0.8)));
- get_text_edit()->add_color_override("member_variable_color", EDITOR_DEF("text_editor/highlighting/member_variable_color", Color(0.9, 0.3, 0.3)));
- get_text_edit()->add_color_override("mark_color", EDITOR_DEF("text_editor/highlighting/mark_color", Color(1.0, 0.4, 0.4, 0.4)));
- get_text_edit()->add_color_override("breakpoint_color", EDITOR_DEF("text_editor/highlighting/breakpoint_color", Color(0.8, 0.8, 0.4, 0.2)));
- get_text_edit()->add_color_override("search_result_color", EDITOR_DEF("text_editor/highlighting/search_result_color", Color(0.05, 0.25, 0.05, 1)));
- get_text_edit()->add_color_override("search_result_border_color", EDITOR_DEF("text_editor/highlighting/search_result_border_color", Color(0.1, 0.45, 0.1, 1)));
- get_text_edit()->add_color_override("symbol_color", EDITOR_DEF("text_editor/highlighting/symbol_color", Color::hex(0x005291ff)));
+ Color background_color = EDITOR_DEF("text_editor/highlighting/background_color", Color(0, 0, 0, 0));
+ Color completion_background_color = EDITOR_DEF("text_editor/highlighting/completion_background_color", Color(0, 0, 0, 0));
+ Color completion_selected_color = EDITOR_DEF("text_editor/highlighting/completion_selected_color", Color::html("434244"));
+ Color completion_existing_color = EDITOR_DEF("text_editor/highlighting/completion_existing_color", Color::html("21dfdfdf"));
+ Color completion_scroll_color = EDITOR_DEF("text_editor/highlighting/completion_scroll_color", Color::html("ffffff"));
+ Color completion_font_color = EDITOR_DEF("text_editor/highlighting/completion_font_color", Color::html("aaaaaa"));
+ Color text_color = EDITOR_DEF("text_editor/highlighting/text_color", Color(0, 0, 0));
+ Color line_number_color = EDITOR_DEF("text_editor/highlighting/line_number_color", Color(0, 0, 0));
+ Color caret_color = EDITOR_DEF("text_editor/highlighting/caret_color", Color(0, 0, 0));
+ Color caret_background_color = EDITOR_DEF("text_editor/highlighting/caret_background_color", Color(0, 0, 0));
+ Color text_selected_color = EDITOR_DEF("text_editor/highlighting/text_selected_color", Color(1, 1, 1));
+ Color selection_color = EDITOR_DEF("text_editor/highlighting/selection_color", Color(0.2, 0.2, 1));
+ Color brace_mismatch_color = EDITOR_DEF("text_editor/highlighting/brace_mismatch_color", Color(1, 0.2, 0.2));
+ Color current_line_color = EDITOR_DEF("text_editor/highlighting/current_line_color", Color(0.3, 0.5, 0.8, 0.15));
+ Color line_length_guideline_color = EDITOR_DEF("text_editor/highlighting/line_length_guideline_color", Color(0, 0, 0));
+ Color word_highlighted_color = EDITOR_DEF("text_editor/highlighting/word_highlighted_color", Color(0.8, 0.9, 0.9, 0.15));
+ Color number_color = EDITOR_DEF("text_editor/highlighting/number_color", Color(0.9, 0.6, 0.0, 2));
+ Color function_color = EDITOR_DEF("text_editor/highlighting/function_color", Color(0.4, 0.6, 0.8));
+ Color member_variable_color = EDITOR_DEF("text_editor/highlighting/member_variable_color", Color(0.9, 0.3, 0.3));
+ Color mark_color = EDITOR_DEF("text_editor/highlighting/mark_color", Color(1.0, 0.4, 0.4, 0.4));
+ Color breakpoint_color = EDITOR_DEF("text_editor/highlighting/breakpoint_color", Color(0.8, 0.8, 0.4, 0.2));
+ Color search_result_color = EDITOR_DEF("text_editor/highlighting/search_result_color", Color(0.05, 0.25, 0.05, 1));
+ Color search_result_border_color = EDITOR_DEF("text_editor/highlighting/search_result_border_color", Color(0.1, 0.45, 0.1, 1));
+ Color symbol_color = EDITOR_DEF("text_editor/highlighting/symbol_color", Color::hex(0x005291ff));
Color keyword_color = EDITOR_DEF("text_editor/highlighting/keyword_color", Color(0.5, 0.0, 0.2));
+ Color basetype_color = EDITOR_DEF("text_editor/highlighting/base_type_color", Color(0.3, 0.3, 0.0));
+ Color type_color = EDITOR_DEF("text_editor/highlighting/engine_type_color", Color(0.0, 0.2, 0.4));
+ Color comment_color = EDITOR_DEF("text_editor/highlighting/comment_color", Color::hex(0x797e7eff));
+ Color string_color = EDITOR_DEF("text_editor/highlighting/string_color", Color::hex(0x6b6f00ff));
+
+ // Adapt
+ if (EditorSettings::get_singleton()->get("text_editor/theme/color_theme") == "Adaptive") {
+ Ref<Theme> tm = EditorNode::get_singleton()->get_theme_base()->get_theme();
+
+ symbol_color = tm->get_color("text_editor/theme/symbol_color", "Editor");
+ keyword_color = tm->get_color("text_editor/theme/keyword_color", "Editor");
+ basetype_color = tm->get_color("text_editor/theme/basetype_color", "Editor");
+ type_color = tm->get_color("text_editor/theme/type_color", "Editor");
+ comment_color = tm->get_color("text_editor/theme/comment_color", "Editor");
+ string_color = tm->get_color("text_editor/theme/string_color", "Editor");
+ background_color = tm->get_color("text_editor/theme/background_color", "Editor");
+ completion_background_color = tm->get_color("text_editor/theme/completion_background_color", "Editor");
+ completion_selected_color = tm->get_color("text_editor/theme/completion_selected_color", "Editor");
+ completion_existing_color = tm->get_color("text_editor/theme/completion_existing_color", "Editor");
+ completion_scroll_color = tm->get_color("text_editor/theme/completion_scroll_color", "Editor");
+ completion_font_color = tm->get_color("text_editor/theme/completion_font_color", "Editor");
+ text_color = tm->get_color("text_editor/theme/text_color", "Editor");
+ line_number_color = tm->get_color("text_editor/theme/line_number_color", "Editor");
+ caret_color = tm->get_color("text_editor/theme/caret_color", "Editor");
+ caret_background_color = tm->get_color("text_editor/theme/caret_background_color", "Editor");
+ text_selected_color = tm->get_color("text_editor/theme/text_selected_color", "Editor");
+ selection_color = tm->get_color("text_editor/theme/selection_color", "Editor");
+ brace_mismatch_color = tm->get_color("text_editor/theme/brace_mismatch_color", "Editor");
+ current_line_color = tm->get_color("text_editor/theme/current_line_color", "Editor");
+ line_length_guideline_color = tm->get_color("text_editor/theme/line_length_guideline_color", "Editor");
+ word_highlighted_color = tm->get_color("text_editor/theme/word_highlighted_color", "Editor");
+ number_color = tm->get_color("text_editor/theme/number_color", "Editor");
+ function_color = tm->get_color("text_editor/theme/function_color", "Editor");
+ member_variable_color = tm->get_color("text_editor/theme/member_variable_color", "Editor");
+ mark_color = tm->get_color("text_editor/theme/mark_color", "Editor");
+ breakpoint_color = tm->get_color("text_editor/theme/breakpoint_color", "Editor");
+ search_result_color = tm->get_color("text_editor/theme/search_result_color", "Editor");
+ search_result_border_color = tm->get_color("text_editor/theme/search_result_border_color", "Editor");
+ }
+
+ get_text_edit()->add_color_override("background_color", background_color);
+ get_text_edit()->add_color_override("completion_background_color", completion_background_color);
+ get_text_edit()->add_color_override("completion_selected_color", completion_selected_color);
+ get_text_edit()->add_color_override("completion_existing_color", completion_existing_color);
+ get_text_edit()->add_color_override("completion_scroll_color", completion_scroll_color);
+ get_text_edit()->add_color_override("completion_font_color", completion_font_color);
+ get_text_edit()->add_color_override("font_color", text_color);
+ get_text_edit()->add_color_override("line_number_color", line_number_color);
+ get_text_edit()->add_color_override("caret_color", caret_color);
+ get_text_edit()->add_color_override("caret_background_color", caret_background_color);
+ get_text_edit()->add_color_override("font_selected_color", text_selected_color);
+ get_text_edit()->add_color_override("selection_color", selection_color);
+ get_text_edit()->add_color_override("brace_mismatch_color", brace_mismatch_color);
+ get_text_edit()->add_color_override("current_line_color", current_line_color);
+ get_text_edit()->add_color_override("line_length_guideline_color", line_length_guideline_color);
+ get_text_edit()->add_color_override("word_highlighted_color", word_highlighted_color);
+ get_text_edit()->add_color_override("number_color", number_color);
+ get_text_edit()->add_color_override("function_color", function_color);
+ get_text_edit()->add_color_override("member_variable_color", member_variable_color);
+ get_text_edit()->add_color_override("mark_color", mark_color);
+ get_text_edit()->add_color_override("breakpoint_color", breakpoint_color);
+ get_text_edit()->add_color_override("search_result_color", search_result_color);
+ get_text_edit()->add_color_override("search_result_border_color", search_result_border_color);
+ get_text_edit()->add_color_override("symbol_color", symbol_color);
List<String> keywords;
ShaderLanguage::get_keyword_list(&keywords);
@@ -115,8 +178,6 @@ void ShaderTextEditor::_load_theme_settings() {
//Color basetype_color= EDITOR_DEF("text_editor/base_type_color",Color(0.3,0.3,0.0));
//colorize comments
- Color comment_color = EDITOR_DEF("text_editor/highlighting/comment_color", Color::hex(0x797e7eff));
-
get_text_edit()->add_color_region("/*", "*/", comment_color, false);
get_text_edit()->add_color_region("//", "", comment_color, false);
diff --git a/editor/plugins/shader_graph_editor_plugin.cpp b/editor/plugins/shader_graph_editor_plugin.cpp
index 732344cb78..f1863c3ca4 100644
--- a/editor/plugins/shader_graph_editor_plugin.cpp
+++ b/editor/plugins/shader_graph_editor_plugin.cpp
@@ -54,7 +54,7 @@ void GraphColorRampEdit::_gui_input(const InputEvent& p_event) {
if (p_event.type==InputEvent::MOUSE_BUTTON && p_event->get_button_index()==1 && p_event->is_pressed()) {
update();
- int x = p_event->get_pos().x;
+ int x = p_event->get_position().x;
int total_w = get_size().width-get_size().height-3;
if (x>total_w+3) {
@@ -333,7 +333,7 @@ void GraphCurveMapEdit::_gui_input(const InputEvent& p_event) {
if (p_event.type==InputEvent::MOUSE_BUTTON && p_event->get_button_index()==1 && p_event->is_pressed()) {
update();
- Point2 p = Vector2(p_event->get_pos().x,p_event->get_pos().y)/get_size();
+ Point2 p = Vector2(p_event->get_position().x,p_event->get_position().y)/get_size();
p.y=1.0-p.y;
grabbed=-1;
grabbing=true;
@@ -384,7 +384,7 @@ void GraphCurveMapEdit::_gui_input(const InputEvent& p_event) {
if (p_event.type==InputEvent::MOUSE_MOTION && grabbing && grabbed != -1) {
- Point2 p = Vector2(p_event->get_pos().x,p_event->get_pos().y)/get_size();
+ Point2 p = Vector2(p_event->get_position().x,p_event->get_position().y)/get_size();
p.y=1.0-p.y;
p.x = CLAMP(p.x,0.0,1.0);
@@ -1205,7 +1205,7 @@ void ShaderGraphView::_move_node(int p_id,const Vector2& p_to) {
ERR_FAIL_COND(!node_map.has(p_id));
node_map[p_id]->set_offset(p_to);
- graph->node_set_pos(type,p_id,p_to);
+ graph->node_set_position(type,p_id,p_to);
}
void ShaderGraphView::_duplicate_nodes_request()
@@ -2463,7 +2463,7 @@ void ShaderGraphView::_create_node(int p_id) {
gn->connect("close_request",this,"_node_removed",varray(p_id),CONNECT_DEFERRED);
graph_edit->add_child(gn);
node_map[p_id]=gn;
- gn->set_offset(graph->node_get_pos(type,p_id));
+ gn->set_offset(graph->node_get_position(type,p_id));
}
@@ -2657,7 +2657,7 @@ void ShaderGraphView::add_node(int p_type, const Vector2 &location) {
while(true) {
bool valid=true;
for(List<int>::Element *E=existing.front();E;E=E->next()) {
- Vector2 pos = graph->node_get_pos(type,E->get());
+ Vector2 pos = graph->node_get_position(type,E->get());
if (init_ofs==pos) {
init_ofs+=Vector2(20,20);
valid=false;
@@ -2672,7 +2672,7 @@ void ShaderGraphView::add_node(int p_type, const Vector2 &location) {
UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
ur->create_action(TTR("Add Shader Graph Node"));
ur->add_do_method(graph.ptr(),"node_add",type,p_type,newid);
- ur->add_do_method(graph.ptr(),"node_set_pos",type,newid,init_ofs);
+ ur->add_do_method(graph.ptr(),"node_set_position",type,newid,init_ofs);
ur->add_undo_method(graph.ptr(),"node_remove",type,newid);
ur->add_do_method(this,"_update_graph");
ur->add_undo_method(this,"_update_graph");
@@ -2765,7 +2765,7 @@ void ShaderGraphEditor::_add_node(int p_type) {
void ShaderGraphEditor::_popup_requested(const Vector2 &p_position)
{
Vector2 scroll_ofs=graph_edits[tabs->get_current_tab()]->get_graph_edit()->get_scroll_ofs();
- next_location = get_local_mouse_pos() + scroll_ofs;
+ next_location = get_local_mouse_position() + scroll_ofs;
popup->set_global_position(p_position);
popup->set_size( Size2( 200, 0) );
popup->popup();
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 704d474746..008dcac2c1 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -76,18 +76,31 @@ void SpatialEditorViewport::_update_camera(float p_interp_delta) {
} else
camera->set_perspective(get_fov(), get_znear(), get_zfar());
- float inertia = EDITOR_DEF("editors/3d/orbit_inertia", 0.5);
- inertia = MAX(0, inertia);
+ //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);
+ //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 zoom_inertia = EDITOR_DEF("editors/3d/navigation_feel/zoom_inertia", 0.1);
+
+ //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);
+
+ float orbit_inertia = MAX(0.00001, manipulated ? manip_orbit_inertia : free_orbit_inertia);
+ float translation_inertia = MAX(0.0001, manipulated ? manip_translation_inertia : free_translation_inertia);
Cursor old_camera_cursor = camera_cursor;
camera_cursor = cursor;
- camera_cursor.x_rot = Math::lerp(old_camera_cursor.x_rot, cursor.x_rot, p_interp_delta * (1 / inertia));
- camera_cursor.y_rot = Math::lerp(old_camera_cursor.y_rot, cursor.y_rot, p_interp_delta * (1 / inertia));
+ camera_cursor.x_rot = Math::lerp(old_camera_cursor.x_rot, cursor.x_rot, MIN(1.f, p_interp_delta * (1 / orbit_inertia)));
+ camera_cursor.y_rot = Math::lerp(old_camera_cursor.y_rot, cursor.y_rot, MIN(1.f, p_interp_delta * (1 / orbit_inertia)));
- bool disable_interp = (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);
+ camera_cursor.pos = old_camera_cursor.pos.linear_interpolate(cursor.pos, MIN(1.f, p_interp_delta * (1 / translation_inertia)));
+ camera_cursor.distance = Math::lerp(old_camera_cursor.distance, cursor.distance, MIN(1.f, p_interp_delta * (1 / zoom_inertia)));
- if (p_interp_delta == 0 || disable_interp || is_freelook_active()) {
+ if (p_interp_delta == 0 || is_freelook_active()) {
camera_cursor = cursor;
}
@@ -206,7 +219,7 @@ Transform SpatialEditorViewport::_get_camera_transform() const {
return camera->get_global_transform();
}
-Vector3 SpatialEditorViewport::_get_camera_pos() const {
+Vector3 SpatialEditorViewport::_get_camera_position() const {
return _get_camera_transform().origin;
}
@@ -453,8 +466,7 @@ void SpatialEditorViewport::_select_region() {
Vector<Plane> frustum;
- Vector3 cam_pos = _get_camera_pos();
- Set<Ref<SpatialEditorGizmo> > found_gizmos;
+ Vector3 cam_pos = _get_camera_position();
for (int i = 0; i < 4; i++) {
@@ -474,6 +486,9 @@ void SpatialEditorViewport::_select_region() {
frustum.push_back(far);
Vector<ObjectID> instances = VisualServer::get_singleton()->instances_cull_convex(frustum, get_tree()->get_root()->get_world()->get_scenario());
+ Vector<Spatial *> selected;
+
+ Node *edited_scene = get_tree()->get_edited_scene_root();
for (int i = 0; i < instances.size(); i++) {
@@ -486,11 +501,14 @@ void SpatialEditorViewport::_select_region() {
if (!seg.is_valid())
continue;
- if (found_gizmos.has(seg))
- continue;
+ Spatial *root_sp = sp;
+ while (root_sp && root_sp != edited_scene && root_sp->get_owner() != edited_scene && !edited_scene->is_editable_instance(root_sp->get_owner())) {
+ root_sp = Object::cast_to<Spatial>(root_sp->get_owner());
+ }
- if (seg->intersect_frustum(camera, frustum))
- _select(sp, true, false);
+ if (selected.find(root_sp) == -1)
+ if (seg->intersect_frustum(camera, frustum))
+ _select(root_sp, true, false);
}
}
@@ -786,20 +804,20 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseButton> b = p_event;
if (b.is_valid()) {
-
+ float zoom_factor = 1 + (ZOOM_MULTIPLIER - 1) * b->get_factor();
switch (b->get_button_index()) {
case BUTTON_WHEEL_UP: {
- scale_cursor_distance(is_freelook_active() ? ZOOM_MULTIPLIER : 1.0 / ZOOM_MULTIPLIER);
+ scale_cursor_distance(is_freelook_active() ? zoom_factor : 1.0 / zoom_factor);
} break;
case BUTTON_WHEEL_DOWN: {
- scale_cursor_distance(is_freelook_active() ? 1.0 / ZOOM_MULTIPLIER : ZOOM_MULTIPLIER);
+ scale_cursor_distance(is_freelook_active() ? 1.0 / zoom_factor : zoom_factor);
} break;
case BUTTON_RIGHT: {
- NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation_scheme").operator int();
+ NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int();
if (b->is_pressed() && _edit.gizmo.is_valid()) {
//restore
@@ -845,7 +863,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (b->is_pressed()) {
int mod = _get_key_modifier(b);
- if (mod == _get_key_modifier_setting("editors/3d/freelook_activation_modifier")) {
+ if (mod == _get_key_modifier_setting("editors/3d/freelook/freelook_activation_modifier")) {
freelook_active = true;
}
} else {
@@ -897,7 +915,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (b->is_pressed()) {
- NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation_scheme").operator int();
+ NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int();
if ((nav_scheme == NAVIGATION_MAYA || nav_scheme == NAVIGATION_MODO) && b->get_alt()) {
break;
}
@@ -1106,7 +1124,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
_gizmo_select(_edit.mouse_pos, true);
}
- NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation_scheme").operator int();
+ NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int();
NavigationMode nav_mode = NAVIGATION_NONE;
if (_edit.gizmo.is_valid()) {
@@ -1429,11 +1447,11 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
int mod = _get_key_modifier(m);
- if (mod == _get_key_modifier_setting("editors/3d/pan_modifier"))
+ if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier"))
nav_mode = NAVIGATION_PAN;
- else if (mod == _get_key_modifier_setting("editors/3d/zoom_modifier"))
+ else if (mod == _get_key_modifier_setting("editors/3d/navigation/zoom_modifier"))
nav_mode = NAVIGATION_ZOOM;
- else if (mod == _get_key_modifier_setting("editors/3d/orbit_modifier"))
+ else if (mod == _get_key_modifier_setting("editors/3d/navigation/orbit_modifier"))
nav_mode = NAVIGATION_ORBIT;
} else if (nav_scheme == NAVIGATION_MAYA) {
@@ -1441,16 +1459,16 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
nav_mode = NAVIGATION_PAN;
}
- } else if (EditorSettings::get_singleton()->get("editors/3d/emulate_3_button_mouse")) {
+ } else if (EditorSettings::get_singleton()->get("editors/3d/navigation/emulate_3_button_mouse")) {
// Handle trackpad (no external mouse) use case
int mod = _get_key_modifier(m);
if (mod) {
- if (mod == _get_key_modifier_setting("editors/3d/pan_modifier"))
+ if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier"))
nav_mode = NAVIGATION_PAN;
- else if (mod == _get_key_modifier_setting("editors/3d/zoom_modifier"))
+ else if (mod == _get_key_modifier_setting("editors/3d/navigation/zoom_modifier"))
nav_mode = NAVIGATION_ZOOM;
- else if (mod == _get_key_modifier_setting("editors/3d/orbit_modifier"))
+ else if (mod == _get_key_modifier_setting("editors/3d/navigation/orbit_modifier"))
nav_mode = NAVIGATION_ORBIT;
}
}
@@ -1483,7 +1501,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (nav_scheme == NAVIGATION_MAYA && m->get_shift())
zoom_speed *= zoom_speed_modifier;
- NavigationZoomStyle zoom_style = (NavigationZoomStyle)EditorSettings::get_singleton()->get("editors/3d/zoom_style").operator int();
+ NavigationZoomStyle zoom_style = (NavigationZoomStyle)EditorSettings::get_singleton()->get("editors/3d/navigation/zoom_style").operator int();
if (zoom_style == NAVIGATION_ZOOM_HORIZONTAL) {
if (m->get_relative().x > 0)
scale_cursor_distance(1 - m->get_relative().x * zoom_speed);
@@ -1501,7 +1519,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
case NAVIGATION_ORBIT: {
Point2i relative = _get_warped_mouse_motion(m);
- real_t degrees_per_pixel = EditorSettings::get_singleton()->get("editors/3d/orbit_sensitivity");
+ real_t degrees_per_pixel = EditorSettings::get_singleton()->get("editors/3d/navigation_feel/orbit_sensitivity");
real_t radians_per_pixel = Math::deg2rad(degrees_per_pixel);
cursor.x_rot += relative.y * radians_per_pixel;
@@ -1520,7 +1538,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (!orthogonal) {
Point2i relative = _get_warped_mouse_motion(m);
- real_t degrees_per_pixel = EditorSettings::get_singleton()->get("editors/3d/orbit_sensitivity");
+ real_t degrees_per_pixel = EditorSettings::get_singleton()->get("editors/3d/navigation_feel/orbit_sensitivity");
real_t radians_per_pixel = Math::deg2rad(degrees_per_pixel);
cursor.x_rot += relative.y * radians_per_pixel;
@@ -1657,7 +1675,7 @@ void SpatialEditorViewport::scale_cursor_distance(real_t scale) {
Point2i SpatialEditorViewport::_get_warped_mouse_motion(const Ref<InputEventMouseMotion> &p_ev_mouse_motion) const {
Point2i relative;
- if (bool(EDITOR_DEF("editors/3d/warped_mouse_panning", false))) {
+ if (bool(EDITOR_DEF("editors/3d/navigation/warped_mouse_panning", false))) {
relative = Input::get_singleton()->warp_mouse_motion(p_ev_mouse_motion, surface->get_global_rect());
} else {
relative = p_ev_mouse_motion->get_relative();
@@ -1711,10 +1729,10 @@ void SpatialEditorViewport::_update_freelook(real_t delta) {
speed_modifier = true;
}
- real_t inertia = EDITOR_DEF("editors/3d/freelook_inertia", 0.2);
+ real_t inertia = EDITOR_DEF("editors/3d/freelook/freelook_inertia", 0.1);
inertia = MAX(0, inertia);
- const real_t base_speed = EDITOR_DEF("editors/3d/freelook_base_speed", 0.5);
- const real_t modifier_speed_factor = EDITOR_DEF("editors/3d/freelook_modifier_speed_factor", 5);
+ const real_t base_speed = EDITOR_DEF("editors/3d/freelook/freelook_base_speed", 0.5);
+ const real_t modifier_speed_factor = EDITOR_DEF("editors/3d/freelook/freelook_modifier_speed_factor", 3);
real_t speed = base_speed * cursor.distance;
if (speed_modifier)
@@ -2355,9 +2373,9 @@ void SpatialEditorViewport::update_transform_gizmo_view() {
void SpatialEditorViewport::set_state(const Dictionary &p_state) {
- cursor.pos = p_state["pos"];
- cursor.x_rot = p_state["x_rot"];
- cursor.y_rot = p_state["y_rot"];
+ cursor.pos = p_state["position"];
+ cursor.x_rot = p_state["x_rotation"];
+ cursor.y_rot = p_state["y_rotation"];
cursor.distance = p_state["distance"];
bool env = p_state["use_environment"];
bool orth = p_state["use_orthogonal"];
@@ -2399,9 +2417,9 @@ void SpatialEditorViewport::set_state(const Dictionary &p_state) {
Dictionary SpatialEditorViewport::get_state() const {
Dictionary d;
- d["pos"] = cursor.pos;
- d["x_rot"] = cursor.x_rot;
- d["y_rot"] = cursor.y_rot;
+ d["position"] = cursor.pos;
+ d["x_rotation"] = cursor.x_rot;
+ d["y_rotation"] = cursor.y_rot;
d["distance"] = cursor.distance;
d["use_environment"] = camera->get_environment().is_valid();
d["use_orthogonal"] = camera->get_projection() == Camera::PROJECTION_ORTHOGONAL;
@@ -2555,11 +2573,18 @@ void SpatialEditorViewport::_create_preview(const Vector<String> &files) const {
String path = files[i];
RES res = ResourceLoader::load(path);
Ref<PackedScene> scene = Ref<PackedScene>(Object::cast_to<PackedScene>(*res));
- if (scene != NULL) {
- if (scene.is_valid()) {
- Node *instance = scene->instance();
- if (instance) {
- preview_node->add_child(instance);
+ Ref<Mesh> mesh = Ref<Mesh>(Object::cast_to<Mesh>(*res));
+ if (mesh != NULL || scene != NULL) {
+ if (mesh != NULL) {
+ MeshInstance *mesh_instance = memnew(MeshInstance);
+ mesh_instance->set_mesh(mesh);
+ preview_node->add_child(mesh_instance);
+ } else {
+ if (scene.is_valid()) {
+ Node *instance = scene->instance();
+ if (instance) {
+ preview_node->add_child(instance);
+ }
}
}
editor->get_scene_root()->add_child(preview_node);
@@ -2595,13 +2620,29 @@ bool SpatialEditorViewport::_cyclical_dependency_exists(const String &p_target_s
}
bool SpatialEditorViewport::_create_instance(Node *parent, String &path, const Point2 &p_point) {
- Ref<PackedScene> sdata = ResourceLoader::load(path);
- if (!sdata.is_valid()) { // invalid scene
- return false;
+ RES res = ResourceLoader::load(path);
+
+ Ref<PackedScene> scene = Ref<PackedScene>(Object::cast_to<PackedScene>(*res));
+ Ref<Mesh> mesh = Ref<Mesh>(Object::cast_to<Mesh>(*res));
+
+ Node *instanced_scene = NULL;
+
+ if (mesh != NULL || scene != NULL) {
+ if (mesh != NULL) {
+ MeshInstance *mesh_instance = memnew(MeshInstance);
+ mesh_instance->set_mesh(mesh);
+ mesh_instance->set_name(mesh->get_name());
+ instanced_scene = mesh_instance;
+ } else {
+ if (!scene.is_valid()) { // invalid scene
+ return false;
+ } else {
+ instanced_scene = scene->instance();
+ }
+ }
}
- Node *instanced_scene = sdata->instance(PackedScene::GEN_EDIT_STATE_INSTANCE);
- if (!instanced_scene) { // error on instancing
+ if (instanced_scene == NULL) {
return false;
}
@@ -2650,7 +2691,8 @@ void SpatialEditorViewport::_perform_drop_data() {
continue;
}
Ref<PackedScene> scene = Ref<PackedScene>(Object::cast_to<PackedScene>(*res));
- if (scene != NULL) {
+ Ref<Mesh> mesh = Ref<Mesh>(Object::cast_to<Mesh>(*res));
+ if (mesh != NULL || scene != NULL) {
bool success = _create_instance(target_node, path, drop_pos);
if (!success) {
error_files.push_back(path);
@@ -2683,9 +2725,11 @@ bool SpatialEditorViewport::can_drop_data_fw(const Point2 &p_point, const Varian
List<String> scene_extensions;
ResourceLoader::get_recognized_extensions_for_type("PackedScene", &scene_extensions);
+ List<String> mesh_extensions;
+ ResourceLoader::get_recognized_extensions_for_type("Mesh", &mesh_extensions);
for (int i = 0; i < files.size(); i++) {
- if (scene_extensions.find(files[i].get_extension())) {
+ if (mesh_extensions.find(files[i].get_extension()) || scene_extensions.find(files[i].get_extension())) {
RES res = ResourceLoader::load(files[i]);
if (res.is_null()) {
continue;
@@ -2699,6 +2743,13 @@ bool SpatialEditorViewport::can_drop_data_fw(const Point2 &p_point, const Varian
continue;
}
memdelete(instanced_scene);
+ } else if (type == "Mesh" || "ArrayMesh" || "PrimitiveMesh") {
+ Ref<Mesh> mesh = ResourceLoader::load(files[i]);
+ if (!mesh.is_valid()) {
+ continue;
+ }
+ } else {
+ continue;
}
can_instance = true;
break;
@@ -2843,8 +2894,8 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
ED_SHORTCUT("spatial_editor/freelook_right", TTR("Freelook Right"), KEY_D);
ED_SHORTCUT("spatial_editor/freelook_forward", TTR("Freelook Forward"), KEY_W);
ED_SHORTCUT("spatial_editor/freelook_backwards", TTR("Freelook Backwards"), KEY_S);
- ED_SHORTCUT("spatial_editor/freelook_up", TTR("Freelook Up"), KEY_Q);
- ED_SHORTCUT("spatial_editor/freelook_down", TTR("Freelook Down"), KEY_E);
+ ED_SHORTCUT("spatial_editor/freelook_up", TTR("Freelook Up"), KEY_E);
+ ED_SHORTCUT("spatial_editor/freelook_down", TTR("Freelook Down"), KEY_Q);
ED_SHORTCUT("spatial_editor/freelook_speed_modifier", TTR("Freelook Speed Modifier"), KEY_SHIFT);
preview_camera = memnew(Button);
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index 5f3ef2dbee..e0ded6e646 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -157,7 +157,7 @@ private:
Transform _get_camera_transform() const;
int get_selected_count() const;
- Vector3 _get_camera_pos() const;
+ Vector3 _get_camera_position() const;
Vector3 _get_camera_normal() const;
Vector3 _get_screen_to_space(const Vector3 &p_vector3);
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index 7b40f69082..b9cb1788f0 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -544,7 +544,7 @@ Variant SpriteFramesEditor::get_drag_data_fw(const Point2 &p_point, Control *p_f
if (!frames->has_animation(edited_anim))
return false;
- int idx = tree->get_item_at_pos(p_point, true);
+ int idx = tree->get_item_at_position(p_point, true);
if (idx < 0 || idx >= frames->get_frame_count(edited_anim))
return Variant();
@@ -609,7 +609,7 @@ void SpriteFramesEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da
if (!d.has("type"))
return;
- int at_pos = tree->get_item_at_pos(p_point, true);
+ int at_pos = tree->get_item_at_position(p_point, true);
if (String(d["type"]) == "resource" && d.has("resource")) {
RES r = d["resource"];
@@ -643,7 +643,7 @@ void SpriteFramesEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_empty2_pressed"), &SpriteFramesEditor::_empty2_pressed);
ClassDB::bind_method(D_METHOD("_delete_pressed"), &SpriteFramesEditor::_delete_pressed);
ClassDB::bind_method(D_METHOD("_paste_pressed"), &SpriteFramesEditor::_paste_pressed);
- ClassDB::bind_method(D_METHOD("_file_load_request", "files", "atpos"), &SpriteFramesEditor::_file_load_request, DEFVAL(-1));
+ ClassDB::bind_method(D_METHOD("_file_load_request", "files", "at_position"), &SpriteFramesEditor::_file_load_request, DEFVAL(-1));
ClassDB::bind_method(D_METHOD("_update_library", "skipsel"), &SpriteFramesEditor::_update_library, DEFVAL(false));
ClassDB::bind_method(D_METHOD("_up_pressed"), &SpriteFramesEditor::_up_pressed);
ClassDB::bind_method(D_METHOD("_down_pressed"), &SpriteFramesEditor::_down_pressed);
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index 43856116a6..b85ffd6c67 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -72,6 +72,14 @@ void TileMapEditor::_menu_option(int p_option) {
switch (p_option) {
+ case OPTION_PAINTING: {
+ // NOTE: We do not set tool = TOOL_PAINTING as this begins painting
+ // immediately without pressing the left mouse button first
+ tool = TOOL_NONE;
+
+ canvas_item_editor->update();
+
+ } break;
case OPTION_BUCKET: {
tool = TOOL_BUCKET;
@@ -703,7 +711,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
return true;
} else {
-
+ // Mousebutton was released
if (tool != TOOL_NONE) {
if (tool == TOOL_PAINTING) {
@@ -801,6 +809,9 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
undo_redo->add_undo_method(this, "_fill_points", points, pop);
undo_redo->commit_action();
+
+ // We want to keep the bucket-tool active
+ return true;
}
tool = TOOL_NONE;
@@ -1046,9 +1057,25 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
return true;
}
- if (tool != TOOL_NONE || !mouse_over)
+ if (!mouse_over) {
+ // Editor shortcuts should not fire if mouse not in viewport
return false;
+ }
+ if (ED_IS_SHORTCUT("tile_map_editor/paint_tile", p_event)) {
+ // NOTE: We do not set tool = TOOL_PAINTING as this begins painting
+ // immediately without pressing the left mouse button first
+ tool = TOOL_NONE;
+ canvas_item_editor->update();
+
+ return true;
+ }
+ if (ED_IS_SHORTCUT("tile_map_editor/bucket_fill", p_event)) {
+ tool = TOOL_BUCKET;
+ canvas_item_editor->update();
+
+ return true;
+ }
if (ED_IS_SHORTCUT("tile_map_editor/erase_selection", p_event)) {
_menu_option(OPTION_ERASE_SELECTION);
@@ -1458,7 +1485,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
ED_SHORTCUT("tile_map_editor/erase_selection", TTR("Erase selection"), KEY_DELETE);
ED_SHORTCUT("tile_map_editor/find_tile", TTR("Find tile"), KEY_MASK_CMD + KEY_F);
- ED_SHORTCUT("tile_map_editor/transpose", TTR("Transpose"));
+ ED_SHORTCUT("tile_map_editor/transpose", TTR("Transpose"), KEY_T);
ED_SHORTCUT("tile_map_editor/mirror_x", TTR("Mirror X"), KEY_A);
ED_SHORTCUT("tile_map_editor/mirror_y", TTR("Mirror Y"), KEY_S);
@@ -1512,7 +1539,8 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
PopupMenu *p = options->get_popup();
- p->add_item(TTR("Bucket"), OPTION_BUCKET);
+ p->add_shortcut(ED_SHORTCUT("tile_map_editor/paint_tile", TTR("Paint Tile"), KEY_P), OPTION_PAINTING);
+ p->add_shortcut(ED_SHORTCUT("tile_map_editor/bucket_fill", TTR("Bucket Fill"), KEY_G), OPTION_BUCKET);
p->add_separator();
p->add_item(TTR("Pick Tile"), OPTION_PICK_TILE, KEY_CONTROL);
p->add_separator();
diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h
index e863c4bf3d..de9b9e8e0d 100644
--- a/editor/plugins/tile_map_editor_plugin.h
+++ b/editor/plugins/tile_map_editor_plugin.h
@@ -68,7 +68,8 @@ class TileMapEditor : public VBoxContainer {
OPTION_PICK_TILE,
OPTION_SELECT,
OPTION_DUPLICATE,
- OPTION_ERASE_SELECTION
+ OPTION_ERASE_SELECTION,
+ OPTION_PAINTING,
};
TileMap *node;
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index f4318a670c..c3b50657f9 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -434,7 +434,7 @@ void ProjectExportDialog::_delete_preset_confirm() {
Variant ProjectExportDialog::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
if (p_from == presets) {
- int pos = presets->get_item_at_pos(p_point, true);
+ int pos = presets->get_item_at_position(p_point, true);
if (pos >= 0) {
Dictionary d;
@@ -455,7 +455,7 @@ Variant ProjectExportDialog::get_drag_data_fw(const Point2 &p_point, Control *p_
}
} else if (p_from == patches) {
- TreeItem *item = patches->get_item_at_pos(p_point);
+ TreeItem *item = patches->get_item_at_position(p_point);
if (item && item->get_cell_mode(0) == TreeItem::CELL_MODE_CHECK) {
@@ -482,7 +482,7 @@ bool ProjectExportDialog::can_drop_data_fw(const Point2 &p_point, const Variant
if (!d.has("type") || String(d["type"]) != "export_preset")
return false;
- if (presets->get_item_at_pos(p_point, true) < 0 && !presets->is_pos_at_end_of_items(p_point))
+ if (presets->get_item_at_position(p_point, true) < 0 && !presets->is_pos_at_end_of_items(p_point))
return false;
} else if (p_from == patches) {
@@ -492,7 +492,7 @@ bool ProjectExportDialog::can_drop_data_fw(const Point2 &p_point, const Variant
patches->set_drop_mode_flags(Tree::DROP_MODE_ON_ITEM);
- TreeItem *item = patches->get_item_at_pos(p_point);
+ TreeItem *item = patches->get_item_at_position(p_point);
if (!item) {
@@ -511,8 +511,8 @@ void ProjectExportDialog::drop_data_fw(const Point2 &p_point, const Variant &p_d
int to_pos = -1;
- if (presets->get_item_at_pos(p_point, true) >= 0) {
- to_pos = presets->get_item_at_pos(p_point, true);
+ if (presets->get_item_at_position(p_point, true) >= 0) {
+ to_pos = presets->get_item_at_position(p_point, true);
}
if (to_pos == -1 && !presets->is_pos_at_end_of_items(p_point))
@@ -541,7 +541,7 @@ void ProjectExportDialog::drop_data_fw(const Point2 &p_point, const Variant &p_d
int from_pos = d["patch"];
- TreeItem *item = patches->get_item_at_pos(p_point);
+ TreeItem *item = patches->get_item_at_position(p_point);
if (!item)
return;
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 78d544fdcf..f8f222ac2e 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -987,15 +987,15 @@ void ProjectManager::_on_project_created(const String &dir) {
}
}
if (has_already) {
- _update_scroll_pos(dir);
+ _update_scroll_position(dir);
} else {
_load_recent_projects();
- _update_scroll_pos(dir);
+ _update_scroll_position(dir);
}
_open_project();
}
-void ProjectManager::_update_scroll_pos(const String &dir) {
+void ProjectManager::_update_scroll_position(const String &dir) {
for (int i = 0; i < scroll_childs->get_child_count(); i++) {
HBoxContainer *hb = Object::cast_to<HBoxContainer>(scroll_childs->get_child(i));
Label *fpath = Object::cast_to<Label>(hb->get_node(NodePath("project/path")));
@@ -1294,7 +1294,7 @@ void ProjectManager::_bind_methods() {
ClassDB::bind_method("_load_recent_projects", &ProjectManager::_load_recent_projects);
ClassDB::bind_method("_on_project_renamed", &ProjectManager::_on_project_renamed);
ClassDB::bind_method("_on_project_created", &ProjectManager::_on_project_created);
- ClassDB::bind_method("_update_scroll_pos", &ProjectManager::_update_scroll_pos);
+ ClassDB::bind_method("_update_scroll_position", &ProjectManager::_update_scroll_position);
ClassDB::bind_method("_panel_draw", &ProjectManager::_panel_draw);
ClassDB::bind_method("_panel_input", &ProjectManager::_panel_input);
ClassDB::bind_method("_unhandled_input", &ProjectManager::_unhandled_input);
diff --git a/editor/project_manager.h b/editor/project_manager.h
index 67fe0b503f..8a3e7c0457 100644
--- a/editor/project_manager.h
+++ b/editor/project_manager.h
@@ -90,7 +90,7 @@ class ProjectManager : public Control {
void _load_recent_projects();
void _on_project_created(const String &dir);
void _on_project_renamed();
- void _update_scroll_pos(const String &dir);
+ void _update_scroll_position(const String &dir);
void _scan_dir(DirAccess *da, float pos, float total, List<String> *r_projects);
void _install_project(const String &p_zip_path, const String &p_title);
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index c7a4e1fc3b..1a3a7ff430 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -861,13 +861,13 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
menu->add_separator();
}
- menu->add_icon_item(get_icon("Load", "EditorIcons"), "Load", OBJ_MENU_LOAD);
+ menu->add_icon_item(get_icon("Load", "EditorIcons"), TTR("Load"), OBJ_MENU_LOAD);
if (!RES(v).is_null()) {
- menu->add_icon_item(get_icon("Edit", "EditorIcons"), "Edit", OBJ_MENU_EDIT);
- menu->add_icon_item(get_icon("Clear", "EditorIcons"), "Clear", OBJ_MENU_CLEAR);
- menu->add_icon_item(get_icon("Duplicate", "EditorIcons"), "Make Unique", OBJ_MENU_MAKE_UNIQUE);
+ menu->add_icon_item(get_icon("Edit", "EditorIcons"), TTR("Edit"), OBJ_MENU_EDIT);
+ menu->add_icon_item(get_icon("Clear", "EditorIcons"), TTR("Clear"), OBJ_MENU_CLEAR);
+ menu->add_icon_item(get_icon("Duplicate", "EditorIcons"), TTR("Make Unique"), OBJ_MENU_MAKE_UNIQUE);
RES r = v;
if (r.is_valid() && r->get_path().is_resource_file()) {
menu->add_separator();
@@ -2368,7 +2368,7 @@ void PropertyEditor::_mark_drop_fields(TreeItem *p_at) {
Variant PropertyEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
- TreeItem *item = tree->get_item_at_pos(p_point);
+ TreeItem *item = tree->get_item_at_position(p_point);
if (!item)
return Variant();
@@ -2376,7 +2376,7 @@ Variant PropertyEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from)
if (!d.has("name"))
return Variant();
- int col = tree->get_column_at_pos(p_point);
+ int col = tree->get_column_at_position(p_point);
if (col == 0) {
Dictionary dp;
@@ -2407,11 +2407,11 @@ Variant PropertyEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from)
bool PropertyEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const {
- TreeItem *item = tree->get_item_at_pos(p_point);
+ TreeItem *item = tree->get_item_at_position(p_point);
if (!item)
return false;
- int col = tree->get_column_at_pos(p_point);
+ int col = tree->get_column_at_position(p_point);
if (col != 1)
return false;
@@ -2419,11 +2419,11 @@ bool PropertyEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_da
}
void PropertyEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
- TreeItem *item = tree->get_item_at_pos(p_point);
+ TreeItem *item = tree->get_item_at_position(p_point);
if (!item)
return;
- int col = tree->get_column_at_pos(p_point);
+ int col = tree->get_column_at_position(p_point);
if (col != 1)
return;
diff --git a/editor/quick_open.cpp b/editor/quick_open.cpp
index b92ebed167..4bcbe073ee 100644
--- a/editor/quick_open.cpp
+++ b/editor/quick_open.cpp
@@ -189,7 +189,7 @@ Vector<Pair<String, Ref<Texture> > > EditorQuickOpen::_sort_fs(Vector<Pair<Strin
Vector<Pair<String, Ref<Texture> > > sorted_list;
if (search_text == String() || list.size() == 0)
- return sorted_list;
+ return list;
Vector<float> scores;
scores.resize(list.size());
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 5b783493cb..2fcba7e3c0 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -2016,6 +2016,5 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
clear_inherit_confirm->get_ok()->set_text(TTR("Clear!"));
add_child(clear_inherit_confirm);
- vbc->add_constant_override("separation", 4);
set_process_input(true);
}
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index 87b4d2a867..cfc563f470 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -817,11 +817,11 @@ bool SceneTreeEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_d
if (!d.has("type"))
return false;
- TreeItem *item = tree->get_item_at_pos(p_point);
+ TreeItem *item = tree->get_item_at_position(p_point);
if (!item)
return false;
- int section = tree->get_drop_section_at_pos(p_point);
+ int section = tree->get_drop_section_at_position(p_point);
if (section < -1 || (section == -1 && !item->get_parent()))
return false;
@@ -860,10 +860,10 @@ void SceneTreeEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data,
if (!can_drop_data_fw(p_point, p_data, p_from))
return;
- TreeItem *item = tree->get_item_at_pos(p_point);
+ TreeItem *item = tree->get_item_at_position(p_point);
if (!item)
return;
- int section = tree->get_drop_section_at_pos(p_point);
+ int section = tree->get_drop_section_at_position(p_point);
if (section < -1)
return;
@@ -950,7 +950,7 @@ void SceneTreeEditor::_bind_methods() {
ADD_SIGNAL(MethodInfo("nodes_rearranged", PropertyInfo(Variant::ARRAY, "paths"), PropertyInfo(Variant::NODE_PATH, "to_path"), PropertyInfo(Variant::INT, "type")));
ADD_SIGNAL(MethodInfo("files_dropped", PropertyInfo(Variant::POOL_STRING_ARRAY, "files"), PropertyInfo(Variant::NODE_PATH, "to_path"), PropertyInfo(Variant::INT, "type")));
ADD_SIGNAL(MethodInfo("script_dropped", PropertyInfo(Variant::STRING, "file"), PropertyInfo(Variant::NODE_PATH, "to_path")));
- ADD_SIGNAL(MethodInfo("rmb_pressed", PropertyInfo(Variant::VECTOR2, "pos")));
+ ADD_SIGNAL(MethodInfo("rmb_pressed", PropertyInfo(Variant::VECTOR2, "position")));
ADD_SIGNAL(MethodInfo("open"));
ADD_SIGNAL(MethodInfo("open_script"));
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index 284b25801c..76e75cff0a 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -1622,7 +1622,6 @@ 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_v_size_flags(SIZE_EXPAND_FILL);
tabs->set_area_as_parent_rect();
add_child(tabs);
diff --git a/editor/script_editor_debugger.h b/editor/script_editor_debugger.h
index 6cb5f0a70c..64ac2535a9 100644
--- a/editor/script_editor_debugger.h
+++ b/editor/script_editor_debugger.h
@@ -150,7 +150,7 @@ class ScriptEditorDebugger : public Control {
void _scene_tree_selected();
void _scene_tree_request();
void _parse_message(const String &p_msg, const Array &p_data);
- void _set_reason_text(const String &p_msg, MessageType p_type);
+ void _set_reason_text(const String &p_reason, MessageType p_type);
void _scene_tree_property_select_object(ObjectID p_object);
void _scene_tree_property_value_edited(const String &p_prop, const Variant &p_value);
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp
index 9c7ea506aa..450c9f4b3c 100644
--- a/editor/spatial_editor_gizmos.cpp
+++ b/editor/spatial_editor_gizmos.cpp
@@ -211,9 +211,10 @@ void EditorSpatialGizmo::add_unscaled_billboard(const Ref<Material> &p_material,
instances.push_back(ins);
}
-void EditorSpatialGizmo::add_collision_triangles(const Ref<TriangleMesh> &p_tmesh) {
+void EditorSpatialGizmo::add_collision_triangles(const Ref<TriangleMesh> &p_tmesh, const Rect3 &p_bounds) {
collision_mesh = p_tmesh;
+ collision_mesh_bounds = p_bounds;
}
void EditorSpatialGizmo::add_collision_segments(const Vector<Vector3> &p_lines) {
@@ -359,6 +360,29 @@ bool EditorSpatialGizmo::intersect_frustum(const Camera *p_camera, const Vector<
return false;
}
+ if (collision_mesh_bounds.size != Vector3(0.0, 0.0, 0.0)) {
+ Transform t = spatial_node->get_global_transform();
+ const Plane *p = p_frustum.ptr();
+ int fc = p_frustum.size();
+
+ Vector3 mins = t.xform(collision_mesh_bounds.get_position());
+ Vector3 max = t.xform(collision_mesh_bounds.get_position() + collision_mesh_bounds.get_size());
+
+ bool any_out = false;
+
+ for (int j = 0; j < fc; j++) {
+
+ if (p[j].distance_to(mins) > 0 || p[j].distance_to(max) > 0) {
+
+ any_out = true;
+ break;
+ }
+ }
+
+ if (!any_out)
+ return true;
+ }
+
return false;
}
@@ -637,7 +661,7 @@ void EditorSpatialGizmo::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_lines", "lines", "material", "billboard"), &EditorSpatialGizmo::add_lines, DEFVAL(false));
ClassDB::bind_method(D_METHOD("add_mesh", "mesh", "billboard", "skeleton"), &EditorSpatialGizmo::add_mesh, DEFVAL(false), DEFVAL(RID()));
ClassDB::bind_method(D_METHOD("add_collision_segments", "segments"), &EditorSpatialGizmo::add_collision_segments);
- ClassDB::bind_method(D_METHOD("add_collision_triangles", "triangles"), &EditorSpatialGizmo::add_collision_triangles);
+ ClassDB::bind_method(D_METHOD("add_collision_triangles", "triangles", "bounds"), &EditorSpatialGizmo::add_collision_triangles);
ClassDB::bind_method(D_METHOD("add_unscaled_billboard", "material", "default_scale"), &EditorSpatialGizmo::add_unscaled_billboard, DEFVAL(1));
ClassDB::bind_method(D_METHOD("add_handles", "handles", "billboard", "secondary"), &EditorSpatialGizmo::add_handles, DEFVAL(false), DEFVAL(false));
ClassDB::bind_method(D_METHOD("set_spatial_node", "node"), &EditorSpatialGizmo::_set_spatial_node);
@@ -1249,8 +1273,10 @@ void MeshInstanceSpatialGizmo::redraw() {
return; //none
Ref<TriangleMesh> tm = m->generate_triangle_mesh();
- if (tm.is_valid())
- add_collision_triangles(tm);
+ if (tm.is_valid()) {
+ Rect3 aabb;
+ add_collision_triangles(tm, aabb);
+ }
}
MeshInstanceSpatialGizmo::MeshInstanceSpatialGizmo(MeshInstance *p_mesh) {
diff --git a/editor/spatial_editor_gizmos.h b/editor/spatial_editor_gizmos.h
index d63a804055..afe64c723c 100644
--- a/editor/spatial_editor_gizmos.h
+++ b/editor/spatial_editor_gizmos.h
@@ -78,6 +78,7 @@ class EditorSpatialGizmo : public SpatialEditorGizmo {
Vector<Vector3> collision_segments;
Ref<TriangleMesh> collision_mesh;
+ Rect3 collision_mesh_bounds;
struct Handle {
Vector3 pos;
@@ -99,7 +100,7 @@ protected:
void add_lines(const Vector<Vector3> &p_lines, const Ref<Material> &p_material, bool p_billboard = false);
void add_mesh(const Ref<ArrayMesh> &p_mesh, bool p_billboard = false, const RID &p_skeleton = RID());
void add_collision_segments(const Vector<Vector3> &p_lines);
- void add_collision_triangles(const Ref<TriangleMesh> &p_tmesh);
+ void add_collision_triangles(const Ref<TriangleMesh> &p_tmesh, const Rect3 &p_bounds = Rect3());
void add_unscaled_billboard(const Ref<Material> &p_material, float p_scale = 1);
void add_handles(const Vector<Vector3> &p_handles, bool p_billboard = false, bool p_secondary = false);
void add_solid_box(Ref<Material> &p_material, Vector3 size);
diff --git a/editor/translations/ar.po b/editor/translations/ar.po
index ac273ea41e..f98fa91e30 100644
--- a/editor/translations/ar.po
+++ b/editor/translations/ar.po
@@ -4449,15 +4449,15 @@ msgid "Curve Point #"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/bg.po b/editor/translations/bg.po
index 2ac4e53dd8..4e119a5fad 100644
--- a/editor/translations/bg.po
+++ b/editor/translations/bg.po
@@ -4470,15 +4470,15 @@ msgid "Curve Point #"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/bn.po b/editor/translations/bn.po
index 64b0c0c528..7be067aedd 100644
--- a/editor/translations/bn.po
+++ b/editor/translations/bn.po
@@ -4621,15 +4621,15 @@ msgid "Curve Point #"
msgstr "বক্ররেখার বিন্দু #"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr "বক্ররেখার বিন্দুর স্থান নির্ধারণ করুন"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr "আন্ত-বক্ররেখার স্থান নির্ধারণ করুন"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr "বহিঃ-বক্ররেখার স্থান নির্ধারণ করুন"
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/ca.po b/editor/translations/ca.po
index 4b126e3b16..80f4b246b5 100644
--- a/editor/translations/ca.po
+++ b/editor/translations/ca.po
@@ -4582,15 +4582,15 @@ msgid "Curve Point #"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/cs.po b/editor/translations/cs.po
index c7871ef60d..929aa6eb30 100644
--- a/editor/translations/cs.po
+++ b/editor/translations/cs.po
@@ -4495,15 +4495,15 @@ msgid "Curve Point #"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/da.po b/editor/translations/da.po
index d33fef1743..47409d5293 100644
--- a/editor/translations/da.po
+++ b/editor/translations/da.po
@@ -4485,15 +4485,15 @@ msgid "Curve Point #"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/de.po b/editor/translations/de.po
index 837df7d62b..98e2e35922 100644
--- a/editor/translations/de.po
+++ b/editor/translations/de.po
@@ -4593,15 +4593,15 @@ msgid "Curve Point #"
msgstr "Kurvenpunkt #"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr "Position des Kurvenpunkts setzen"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr "Position der Eingangskurve setzen"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr "Position der Ausgangskurve setzen"
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/de_CH.po b/editor/translations/de_CH.po
index 4e40c4c9bb..c5234c20d9 100644
--- a/editor/translations/de_CH.po
+++ b/editor/translations/de_CH.po
@@ -4496,15 +4496,15 @@ msgid "Curve Point #"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/editor.pot b/editor/translations/editor.pot
index 7227b0ec2d..a1247ab925 100644
--- a/editor/translations/editor.pot
+++ b/editor/translations/editor.pot
@@ -4436,15 +4436,15 @@ msgid "Curve Point #"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/el.po b/editor/translations/el.po
index 21adc08c3f..0532753542 100644
--- a/editor/translations/el.po
+++ b/editor/translations/el.po
@@ -4577,15 +4577,15 @@ msgid "Curve Point #"
msgstr "Σημείο καμπύλης #"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr "Ορισμός θέσης σημείου καμπύλης"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr "Ορισμός θέσης εισόδου καμπύλης"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr "Ορισμός θέσης εξόδου καμπύλης"
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/es.po b/editor/translations/es.po
index da7bd97b83..8b2cab5fb9 100644
--- a/editor/translations/es.po
+++ b/editor/translations/es.po
@@ -4672,15 +4672,15 @@ msgid "Curve Point #"
msgstr "Nº de punto en curva"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr "Establecer pos. de punto de curva"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr "Establecer pos. de entrada de curva"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr "Establecer pos. de salida de curva"
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/es_AR.po b/editor/translations/es_AR.po
index 64d65f70bb..dd5f8ad597 100644
--- a/editor/translations/es_AR.po
+++ b/editor/translations/es_AR.po
@@ -4572,15 +4572,15 @@ msgid "Curve Point #"
msgstr "Punto # de Curva"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr "Setear Pos. de Punto de Curva"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr "Setear Pos. In de Curva"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr "Setear Pos. Out de Curva"
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/fa.po b/editor/translations/fa.po
index 8afc7bc844..7b77165a53 100644
--- a/editor/translations/fa.po
+++ b/editor/translations/fa.po
@@ -4514,15 +4514,15 @@ msgid "Curve Point #"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/fi.po b/editor/translations/fi.po
index 6cd55dbc6a..af1d46eae0 100644
--- a/editor/translations/fi.po
+++ b/editor/translations/fi.po
@@ -4577,15 +4577,15 @@ msgid "Curve Point #"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/fr.po b/editor/translations/fr.po
index c499138c77..4e3aad6cf6 100644
--- a/editor/translations/fr.po
+++ b/editor/translations/fr.po
@@ -4662,15 +4662,15 @@ msgid "Curve Point #"
msgstr "Point de courbe #"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr "Définir la position du point de la courbe"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/hu.po b/editor/translations/hu.po
index d21541c339..a8681feaf5 100644
--- a/editor/translations/hu.po
+++ b/editor/translations/hu.po
@@ -4441,15 +4441,15 @@ msgid "Curve Point #"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/id.po b/editor/translations/id.po
index 6fbf6fabde..2f13c11082 100644
--- a/editor/translations/id.po
+++ b/editor/translations/id.po
@@ -4564,15 +4564,15 @@ msgid "Curve Point #"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/it.po b/editor/translations/it.po
index 9ca5debd55..060e9551e0 100644
--- a/editor/translations/it.po
+++ b/editor/translations/it.po
@@ -4573,15 +4573,15 @@ msgid "Curve Point #"
msgstr "Punto Curva #"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr "Imposta Posizione Punti curva"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr "Imposta Posizione Curve In"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr "Imposta Posizione Curve Out"
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/ja.po b/editor/translations/ja.po
index 0cbbe217bb..51c481f3d4 100644
--- a/editor/translations/ja.po
+++ b/editor/translations/ja.po
@@ -5250,17 +5250,17 @@ msgstr "曲線のポイント#"
#: editor/plugins/path_editor_plugin.cpp
#, fuzzy
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr "曲線のポイントの位置を指定"
#: editor/plugins/path_editor_plugin.cpp
#, fuzzy
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr "曲線のIn-ハンドルの位置を指定"
#: editor/plugins/path_editor_plugin.cpp
#, fuzzy
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr "曲線のOut-ハンドルの位置を指定"
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/ko.po b/editor/translations/ko.po
index b531720ebd..f559faf1f3 100644
--- a/editor/translations/ko.po
+++ b/editor/translations/ko.po
@@ -4606,15 +4606,15 @@ msgid "Curve Point #"
msgstr "커브 포인트 #"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr "커브 포인트 위치 설정"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr "커브 포인트 In 설정"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr "커브 포인트 Out 설정"
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/nb.po b/editor/translations/nb.po
index eb230cc1ac..6dc635daa6 100644
--- a/editor/translations/nb.po
+++ b/editor/translations/nb.po
@@ -4454,15 +4454,15 @@ msgid "Curve Point #"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/nl.po b/editor/translations/nl.po
index 0b8a154735..b13d86e0f2 100644
--- a/editor/translations/nl.po
+++ b/editor/translations/nl.po
@@ -4517,15 +4517,15 @@ msgid "Curve Point #"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/pl.po b/editor/translations/pl.po
index d9234269fd..baffd09f33 100644
--- a/editor/translations/pl.po
+++ b/editor/translations/pl.po
@@ -4644,15 +4644,15 @@ msgid "Curve Point #"
msgstr "Punkt Krzywej #"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr "Ustaw pozycje punktu krzywej"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/pr.po b/editor/translations/pr.po
index 418072c117..9fbc17c9ca 100644
--- a/editor/translations/pr.po
+++ b/editor/translations/pr.po
@@ -4452,15 +4452,15 @@ msgid "Curve Point #"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/pt_BR.po b/editor/translations/pt_BR.po
index 7d0ff7cb95..ed2bbb2fd3 100644
--- a/editor/translations/pt_BR.po
+++ b/editor/translations/pt_BR.po
@@ -4599,15 +4599,15 @@ msgid "Curve Point #"
msgstr "Ponto da Curva nº"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr "Definir Pos do Ponto da Curva"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr "Definir Pos da Entrada da Curva"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr "Definir Pos da Saída da Curva"
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/pt_PT.po b/editor/translations/pt_PT.po
index 527bff68fd..7a178acdd5 100644
--- a/editor/translations/pt_PT.po
+++ b/editor/translations/pt_PT.po
@@ -4451,15 +4451,15 @@ msgid "Curve Point #"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/ru.po b/editor/translations/ru.po
index 92755d427b..61d7ae7dae 100644
--- a/editor/translations/ru.po
+++ b/editor/translations/ru.po
@@ -4571,15 +4571,15 @@ msgid "Curve Point #"
msgstr "Точка Кривой #"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr "Установить позицию точки кривой"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr "Установить позицию входа кривой"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr "Установить позицию выхода кривой"
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/sk.po b/editor/translations/sk.po
index b7ac0a7864..381e5c53d1 100644
--- a/editor/translations/sk.po
+++ b/editor/translations/sk.po
@@ -4462,15 +4462,15 @@ msgid "Curve Point #"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/sl.po b/editor/translations/sl.po
index daa7533a8c..ff62db99ae 100644
--- a/editor/translations/sl.po
+++ b/editor/translations/sl.po
@@ -4452,15 +4452,15 @@ msgid "Curve Point #"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/th.po b/editor/translations/th.po
index e89bbf043a..0ccaf81e71 100644
--- a/editor/translations/th.po
+++ b/editor/translations/th.po
@@ -4531,15 +4531,15 @@ msgid "Curve Point #"
msgstr "จุดเส้นโค้ง #"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr "กำหนดพิกัดจุดเส้นโค้ง"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr "กำหนดเส้นโค้งขาเข้า"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr "กำหนดเส้นโค้งขาออก"
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/tr.po b/editor/translations/tr.po
index df749f5c9b..dd10336bca 100644
--- a/editor/translations/tr.po
+++ b/editor/translations/tr.po
@@ -4610,15 +4610,15 @@ msgid "Curve Point #"
msgstr "Eğrisel Nokta #"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr "Eğri Noktası Konumu Ayarla"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr "Eğriyi Konumda Ayarla"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr "Eğri Çıkış Konumunu Ayarla"
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/ur_PK.po b/editor/translations/ur_PK.po
index 24796e1f32..41384a79da 100644
--- a/editor/translations/ur_PK.po
+++ b/editor/translations/ur_PK.po
@@ -4455,15 +4455,15 @@ msgid "Curve Point #"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/zh_CN.po b/editor/translations/zh_CN.po
index cf9013091a..f725bf6a5e 100644
--- a/editor/translations/zh_CN.po
+++ b/editor/translations/zh_CN.po
@@ -4525,15 +4525,15 @@ msgid "Curve Point #"
msgstr "曲线定点 #"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr "设置曲线顶点坐标"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr "设置的曲线输入位置(Pos)"
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr "设置曲线输出位置(Pos)"
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/zh_HK.po b/editor/translations/zh_HK.po
index f04322ff3c..ceb21d7b85 100644
--- a/editor/translations/zh_HK.po
+++ b/editor/translations/zh_HK.po
@@ -4515,15 +4515,15 @@ msgid "Curve Point #"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
diff --git a/editor/translations/zh_TW.po b/editor/translations/zh_TW.po
index 8ed54a0798..f845efea17 100644
--- a/editor/translations/zh_TW.po
+++ b/editor/translations/zh_TW.po
@@ -4474,15 +4474,15 @@ msgid "Curve Point #"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Point Pos"
+msgid "Set Curve Point Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve In Pos"
+msgid "Set Curve In Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-msgid "Set Curve Out Pos"
+msgid "Set Curve Out Position"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
diff --git a/main/input_default.cpp b/main/input_default.cpp
index b4c9a6207f..18979c844a 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -80,7 +80,7 @@ bool InputDefault::is_key_pressed(int p_scancode) const {
bool InputDefault::is_mouse_button_pressed(int p_button) const {
_THREAD_SAFE_METHOD_
- return (mouse_button_mask & (1 << p_button)) != 0;
+ return (mouse_button_mask & (1 << (p_button - 1))) != 0;
}
static int _combine_device(int p_value, int p_device) {
@@ -265,10 +265,11 @@ void InputDefault::parse_input_event(const Ref<InputEvent> &p_event) {
if (mb.is_valid() && !mb->is_doubleclick()) {
- if (mb->is_pressed())
- mouse_button_mask |= (1 << mb->get_button_index());
- else
- mouse_button_mask &= ~(1 << mb->get_button_index());
+ if (mb->is_pressed()) {
+ mouse_button_mask |= (1 << (mb->get_button_index() - 1));
+ } else {
+ mouse_button_mask &= ~(1 << (mb->get_button_index() - 1));
+ }
if (main_loop && emulate_touch && mb->get_button_index() == 1) {
Ref<InputEventScreenTouch> touch_event;
@@ -421,9 +422,9 @@ int InputDefault::get_mouse_button_mask() const {
return mouse_button_mask; // do not trust OS implementaiton, should remove it - OS::get_singleton()->get_mouse_button_state();
}
-void InputDefault::warp_mouse_pos(const Vector2 &p_to) {
+void InputDefault::warp_mouse_position(const Vector2 &p_to) {
- OS::get_singleton()->warp_mouse_pos(p_to);
+ OS::get_singleton()->warp_mouse_position(p_to);
}
Point2i InputDefault::warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, const Rect2 &p_rect) {
@@ -446,7 +447,7 @@ Point2i InputDefault::warp_mouse_motion(const Ref<InputEventMouseMotion> &p_moti
const Point2i pos_local = p_motion->get_global_position() - p_rect.position;
const Point2i pos_warped(Math::fposmod(pos_local.x, p_rect.size.x), Math::fposmod(pos_local.y, p_rect.size.y));
if (pos_warped != pos_local) {
- OS::get_singleton()->warp_mouse_pos(pos_warped + p_rect.position);
+ OS::get_singleton()->warp_mouse_position(pos_warped + p_rect.position);
}
return rel_warped;
diff --git a/main/input_default.h b/main/input_default.h
index 345c34c55e..480e78e971 100644
--- a/main/input_default.h
+++ b/main/input_default.h
@@ -200,7 +200,7 @@ public:
virtual Point2 get_last_mouse_speed() const;
virtual int get_mouse_button_mask() const;
- virtual void warp_mouse_pos(const Vector2 &p_to);
+ virtual void warp_mouse_position(const Vector2 &p_to);
virtual Point2i warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, const Rect2 &p_rect);
virtual void parse_input_event(const Ref<InputEvent> &p_event);
diff --git a/main/main.cpp b/main/main.cpp
index bb601198db..1f7418ba2a 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -248,7 +248,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
performance = memnew(Performance);
globals->add_singleton(ProjectSettings::Singleton("Performance", performance));
- GLOBAL_DEF("debug/settings/backtrace/message", String("Please include this when reporting the bug on https://github.com/godotengine/godot/issues"));
+ GLOBAL_DEF("debug/settings/crash_handler/message", String("Please include this when reporting the bug on https://github.com/godotengine/godot/issues"));
MAIN_PRINT("Main: Parse CMDLine");
@@ -990,8 +990,10 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
#endif
}
+#ifdef TOOLS_ENABLED
Ref<Image> icon = memnew(Image(app_icon_png));
OS::get_singleton()->set_icon(icon);
+#endif
}
MAIN_PRINT("Main: DCC");
@@ -1082,6 +1084,7 @@ bool Main::start() {
ERR_FAIL_COND_V(!_start_success, false);
+ bool hasicon = false;
bool editor = false;
String doc_tool;
List<String> removal_docs;
@@ -1519,8 +1522,10 @@ bool Main::start() {
if (iconpath != "") {
Ref<Image> icon;
icon.instance();
- if (icon->load(iconpath) == OK)
+ if (icon->load(iconpath) == OK) {
OS::get_singleton()->set_icon(icon);
+ hasicon = true;
+ }
}
}
}
@@ -1537,6 +1542,11 @@ bool Main::start() {
#endif
}
+ if (!hasicon) {
+ Ref<Image> icon = memnew(Image(app_icon_png));
+ OS::get_singleton()->set_icon(icon);
+ }
+
OS::get_singleton()->set_main_loop(main_loop);
return true;
diff --git a/main/tests/test_main.cpp b/main/tests/test_main.cpp
index 645db2826e..d9b20254a8 100644
--- a/main/tests/test_main.cpp
+++ b/main/tests/test_main.cpp
@@ -37,6 +37,7 @@
#include "test_image.h"
#include "test_io.h"
#include "test_math.h"
+#include "test_oa_hash_map.h"
#include "test_ordered_hash_map.h"
#include "test_physics.h"
#include "test_physics_2d.h"
@@ -56,6 +57,7 @@ const char **tests_get_names() {
"io",
"shaderlang",
"physics",
+ "oa_hash_map",
NULL
};
@@ -89,6 +91,11 @@ MainLoop *test_main(String p_test, const List<String> &p_args) {
return TestRender::test();
}
+ if (p_test == "oa_hash_map") {
+
+ return TestOAHashMap::test();
+ }
+
#ifndef _3D_DISABLED
if (p_test == "gui") {
diff --git a/main/tests/test_oa_hash_map.cpp b/main/tests/test_oa_hash_map.cpp
new file mode 100644
index 0000000000..302c259262
--- /dev/null
+++ b/main/tests/test_oa_hash_map.cpp
@@ -0,0 +1,97 @@
+/*************************************************************************/
+/* test_oa_hash_map.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 "test_oa_hash_map.h"
+
+#include "core/os/os.h"
+
+#include "core/oa_hash_map.h"
+
+namespace TestOAHashMap {
+
+MainLoop *test() {
+
+ OS::get_singleton()->print("\n\n\nHello from test\n");
+
+ // test element tracking.
+ {
+ OAHashMap<int, int> map;
+
+ map.set(42, 1337);
+ map.set(1337, 21);
+ map.set(42, 11880);
+
+ int value;
+ map.lookup(42, &value);
+
+ OS::get_singleton()->print("capacity %d\n", map.get_capacity());
+ OS::get_singleton()->print("elements %d\n", map.get_num_elements());
+
+ OS::get_singleton()->print("map[42] = %d\n", value);
+ }
+
+ // rehashing and deletion
+ {
+ OAHashMap<int, int> map;
+
+ for (int i = 0; i < 500; i++) {
+ map.set(i, i * 2);
+ }
+
+ for (int i = 0; i < 500; i += 2) {
+ map.remove(i);
+ }
+
+ uint32_t num_elems = 0;
+ for (int i = 0; i < 500; i++) {
+ int tmp;
+ if (map.lookup(i, &tmp))
+ num_elems++;
+ }
+
+ OS::get_singleton()->print("elements %d == %d.\n", map.get_num_elements(), num_elems);
+ }
+
+ // iteration
+ {
+ OAHashMap<String, int> map;
+
+ map.set("Hello", 1);
+ map.set("World", 2);
+ map.set("Godot rocks", 42);
+
+ for (OAHashMap<String, int>::Iterator it = map.iter(); it.valid; it = map.next_iter(it)) {
+ OS::get_singleton()->print("map[\"%s\"] = %d\n", it.key->utf8().get_data(), *it.data);
+ }
+ }
+
+ return NULL;
+}
+} // namespace TestOAHashMap
diff --git a/main/tests/test_oa_hash_map.h b/main/tests/test_oa_hash_map.h
new file mode 100644
index 0000000000..92b4bc5e5a
--- /dev/null
+++ b/main/tests/test_oa_hash_map.h
@@ -0,0 +1,39 @@
+/*************************************************************************/
+/* test_oa_hash_map.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 TEST_OA_HASH_MAP_H
+#define TEST_OA_HASH_MAP_H
+
+#include "os/main_loop.h"
+
+namespace TestOAHashMap {
+
+MainLoop *test();
+}
+#endif // TEST_OA_HASH_MAP_H
diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp
index 95d93e6af6..ae9daa802f 100644
--- a/modules/dds/texture_loader_dds.cpp
+++ b/modules/dds/texture_loader_dds.cpp
@@ -152,7 +152,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path,
*/
//must avoid this later
- while (f->get_pos() < 128)
+ while (f->get_position() < 128)
f->get_8();
DDSFormat dds_format;
diff --git a/modules/gdnative/gd_native_library_editor.cpp b/modules/gdnative/gd_native_library_editor.cpp
index 8aa931d6c9..cc2c2b69a6 100644
--- a/modules/gdnative/gd_native_library_editor.cpp
+++ b/modules/gdnative/gd_native_library_editor.cpp
@@ -1,9 +1,39 @@
+/*************************************************************************/
+/* gd_native_library_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. */
+/*************************************************************************/
+#ifdef TOOLS_ENABLED
#include "gd_native_library_editor.h"
+
#include "gdnative.h"
void GDNativeLibraryEditor::_find_gdnative_singletons(EditorFileSystemDirectory *p_dir, const Set<String> &enabled_list) {
-
// check children
for (int i = 0; i < p_dir->get_file_count(); i++) {
@@ -17,48 +47,45 @@ void GDNativeLibraryEditor::_find_gdnative_singletons(EditorFileSystemDirectory
if (lib.is_valid() && lib->is_singleton_gdnative()) {
String path = p_dir->get_file_path(i);
TreeItem *ti = libraries->create_item(libraries->get_root());
- ti->set_text(0,path.get_file());
- ti->set_tooltip(0,path);
- ti->set_metadata(0,path);
- ti->set_cell_mode(1,TreeItem::CELL_MODE_RANGE);
- ti->set_text(1,"Disabled,Enabled");
- bool enabled = enabled_list.has(path)?true:false;
-
- ti->set_range(1,enabled?1:0);
- ti->set_custom_color(1,enabled?Color(0,1,0):Color(1,0,0));
+ ti->set_text(0, path.get_file());
+ ti->set_tooltip(0, path);
+ ti->set_metadata(0, path);
+ ti->set_cell_mode(1, TreeItem::CELL_MODE_RANGE);
+ ti->set_text(1, "Disabled,Enabled");
+ bool enabled = enabled_list.has(path) ? true : false;
+
+ ti->set_range(1, enabled ? 1 : 0);
+ ti->set_custom_color(1, enabled ? Color(0, 1, 0) : Color(1, 0, 0));
}
}
// check subdirectories
for (int i = 0; i < p_dir->get_subdir_count(); i++) {
- _find_gdnative_singletons(p_dir->get_subdir(i),enabled_list);
+ _find_gdnative_singletons(p_dir->get_subdir(i), enabled_list);
}
-
-
}
void GDNativeLibraryEditor::_update_libraries() {
- updating=true;
+ updating = true;
libraries->clear();
libraries->create_item(); //rppt
Vector<String> enabled_paths;
if (ProjectSettings::get_singleton()->has("gdnative/singletons")) {
- enabled_paths=ProjectSettings::get_singleton()->get("gdnative/singletons");
+ enabled_paths = ProjectSettings::get_singleton()->get("gdnative/singletons");
}
Set<String> enabled_list;
- for(int i=0;i<enabled_paths.size();i++) {
+ for (int i = 0; i < enabled_paths.size(); i++) {
enabled_list.insert(enabled_paths[i]);
}
EditorFileSystemDirectory *fs = EditorFileSystem::get_singleton()->get_filesystem();
if (fs) {
- _find_gdnative_singletons(fs,enabled_list);
+ _find_gdnative_singletons(fs, enabled_list);
}
- updating=false;
-
+ updating = false;
}
void GDNativeLibraryEditor::_item_edited() {
@@ -74,11 +101,11 @@ void GDNativeLibraryEditor::_item_edited() {
Vector<String> enabled_paths;
if (ProjectSettings::get_singleton()->has("gdnative/singletons")) {
- enabled_paths=ProjectSettings::get_singleton()->get("gdnative/singletons");
+ enabled_paths = ProjectSettings::get_singleton()->get("gdnative/singletons");
}
if (enabled) {
- if (enabled_paths.find(path)==-1) {
+ if (enabled_paths.find(path) == -1) {
enabled_paths.push_back(path);
}
} else {
@@ -86,15 +113,15 @@ void GDNativeLibraryEditor::_item_edited() {
}
if (enabled_paths.size()) {
- ProjectSettings::get_singleton()->set("gdnative/singletons",enabled_paths);
+ ProjectSettings::get_singleton()->set("gdnative/singletons", enabled_paths);
} else {
- ProjectSettings::get_singleton()->set("gdnative/singletons",Variant());
+ ProjectSettings::get_singleton()->set("gdnative/singletons", Variant());
}
}
void GDNativeLibraryEditor::_notification(int p_what) {
- if (p_what==NOTIFICATION_VISIBILITY_CHANGED) {
+ if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
if (is_visible_in_tree()) {
_update_libraries();
}
@@ -103,18 +130,19 @@ void GDNativeLibraryEditor::_notification(int p_what) {
void GDNativeLibraryEditor::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_item_edited"),&GDNativeLibraryEditor::_item_edited);
+ ClassDB::bind_method(D_METHOD("_item_edited"), &GDNativeLibraryEditor::_item_edited);
}
-GDNativeLibraryEditor::GDNativeLibraryEditor()
-{
- libraries = memnew( Tree );
+GDNativeLibraryEditor::GDNativeLibraryEditor() {
+ libraries = memnew(Tree);
libraries->set_columns(2);
libraries->set_column_titles_visible(true);
- libraries->set_column_title(0,TTR("Library"));
- libraries->set_column_title(1,TTR("Status"));
+ libraries->set_column_title(0, TTR("Library"));
+ libraries->set_column_title(1, TTR("Status"));
libraries->set_hide_root(true);
- add_margin_child(TTR("Libraries: "),libraries,true);
- updating=false;
- libraries->connect("item_edited",this,"_item_edited");
+ add_margin_child(TTR("Libraries: "), libraries, true);
+ updating = false;
+ libraries->connect("item_edited", this, "_item_edited");
}
+
+#endif // TOOLS_ENABLED
diff --git a/modules/gdnative/gd_native_library_editor.h b/modules/gdnative/gd_native_library_editor.h
index a6c8f31790..a11c4620dd 100644
--- a/modules/gdnative/gd_native_library_editor.h
+++ b/modules/gdnative/gd_native_library_editor.h
@@ -1,23 +1,52 @@
+/*************************************************************************/
+/* gd_native_library_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 GD_NATIVE_LIBRARY_EDITOR_H
#define GD_NATIVE_LIBRARY_EDITOR_H
#ifdef TOOLS_ENABLED
-#include "editor/project_settings_editor.h"
#include "editor/editor_file_system.h"
+#include "editor/project_settings_editor.h"
-class GDNativeLibraryEditor : public VBoxContainer
-{
+class GDNativeLibraryEditor : public VBoxContainer {
Tree *libraries;
bool updating;
void _update_libraries();
- void _find_gdnative_singletons(EditorFileSystemDirectory *p_dir,const Set<String>& enabled_list);
+ void _find_gdnative_singletons(EditorFileSystemDirectory *p_dir, const Set<String> &enabled_list);
void _item_edited();
-protected:
+protected:
void _notification(int p_what);
static void _bind_methods();
+
public:
GDNativeLibraryEditor();
};
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index 6da538844a..93a9bac11c 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -40,6 +40,16 @@
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
+
String GDNativeLibrary::platform_names[NUM_PLATFORMS + 1] = {
"X11_32bit",
"X11_64bit",
@@ -91,7 +101,7 @@ GDNativeLibrary::Platform GDNativeLibrary::current_platform =
#endif
GDNativeLibrary::GDNativeLibrary()
- : library_paths() {
+ : library_paths(), singleton_gdnative(false) {
}
GDNativeLibrary::~GDNativeLibrary() {
@@ -249,6 +259,7 @@ bool GDNative::initialize() {
godot_gdnative_init_options options;
+ options.api_struct = &api_struct;
options.in_editor = Engine::get_singleton()->is_editor_hint();
options.core_api_hash = ClassDB::get_api_hash(ClassDB::API_CORE);
options.editor_api_hash = ClassDB::get_api_hash(ClassDB::API_EDITOR);
diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h
index 4753c7efe5..29c6201641 100644
--- a/modules/gdnative/gdnative.h
+++ b/modules/gdnative/gdnative.h
@@ -36,6 +36,7 @@
#include "resource.h"
#include "gdnative/gdnative.h"
+#include "gdnative_api_struct.h"
class GDNativeLibrary : public Resource {
GDCLASS(GDNativeLibrary, Resource)
@@ -77,7 +78,7 @@ class GDNativeLibrary : public Resource {
String library_paths[NUM_PLATFORMS];
- bool singleton_gdnative = false;
+ bool singleton_gdnative;
protected:
bool _set(const StringName &p_name, const Variant &p_value);
diff --git a/modules/gdnative/gdnative/variant.cpp b/modules/gdnative/gdnative/variant.cpp
index 1b2aae607f..9ba4166c1d 100644
--- a/modules/gdnative/gdnative/variant.cpp
+++ b/modules/gdnative/gdnative/variant.cpp
@@ -480,10 +480,9 @@ godot_bool GDAPI godot_variant_hash_compare(const godot_variant *p_self, const g
return self->hash_compare(*other);
}
-godot_bool GDAPI godot_variant_booleanize(const godot_variant *p_self, godot_bool *r_valid) {
+godot_bool GDAPI godot_variant_booleanize(const godot_variant *p_self) {
const Variant *self = (const Variant *)p_self;
- bool &valid = *r_valid;
- return self->booleanize(valid);
+ return self->booleanize();
}
void GDAPI godot_variant_destroy(godot_variant *p_self) {
diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h
index c574c56d5a..1c5e91d733 100644
--- a/modules/gdnative/include/gdnative/gdnative.h
+++ b/modules/gdnative/include/gdnative/gdnative.h
@@ -234,12 +234,15 @@ void GDAPI godot_method_bind_ptrcall(godot_method_bind *p_method_bind, godot_obj
godot_variant GDAPI godot_method_bind_call(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);
////// Script API
+struct godot_gdnative_api_struct; // Forward declaration
+
typedef struct {
godot_bool in_editor;
uint64_t core_api_hash;
uint64_t editor_api_hash;
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;
} godot_gdnative_init_options;
typedef struct {
diff --git a/modules/gdnative/include/gdnative/variant.h b/modules/gdnative/include/gdnative/variant.h
index 969506585d..7b804c1eaf 100644
--- a/modules/gdnative/include/gdnative/variant.h
+++ b/modules/gdnative/include/gdnative/variant.h
@@ -190,7 +190,7 @@ godot_bool GDAPI godot_variant_operator_less(const godot_variant *p_self, const
godot_bool GDAPI godot_variant_hash_compare(const godot_variant *p_self, const godot_variant *p_other);
-godot_bool GDAPI godot_variant_booleanize(const godot_variant *p_self, godot_bool *r_valid);
+godot_bool GDAPI godot_variant_booleanize(const godot_variant *p_self);
void GDAPI godot_variant_destroy(godot_variant *p_self);
diff --git a/modules/gdnative/include/gdnative_api_struct.h b/modules/gdnative/include/gdnative_api_struct.h
new file mode 100644
index 0000000000..c345e27227
--- /dev/null
+++ b/modules/gdnative/include/gdnative_api_struct.h
@@ -0,0 +1,723 @@
+/*************************************************************************/
+/* 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/register_types.cpp b/modules/gdnative/register_types.cpp
index dc0da5021d..997c342045 100644
--- a/modules/gdnative/register_types.cpp
+++ b/modules/gdnative/register_types.cpp
@@ -99,7 +99,6 @@ Set<String> get_gdnative_singletons(EditorFileSystemDirectory *p_dir) {
void actual_discoverer_handler() {
EditorFileSystemDirectory *dir = EditorFileSystem::get_singleton()->get_filesystem();
-
Set<String> file_paths = get_gdnative_singletons(dir);
Array files;
@@ -118,11 +117,10 @@ GDNativeSingletonDiscover *discoverer = NULL;
static void editor_init_callback() {
- GDNativeLibraryEditor *library_editor = memnew( GDNativeLibraryEditor );
+ GDNativeLibraryEditor *library_editor = memnew(GDNativeLibraryEditor);
library_editor->set_name(TTR("GDNative"));
ProjectSettingsEditor::get_singleton()->get_tabs()->add_child(library_editor);
-
discoverer = memnew(GDNativeSingletonDiscover);
EditorFileSystem::get_singleton()->connect("filesystem_changed", discoverer, "get_class");
}
diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp
index 4803781c67..7036a708e5 100644
--- a/modules/gdscript/gd_compiler.cpp
+++ b/modules/gdscript/gd_compiler.cpp
@@ -131,7 +131,7 @@ int GDCompiler::_parse_assign_right_expression(CodeGen &codegen, const GDParser:
switch (p_expression->op) {
case GDParser::OperatorNode::OP_ASSIGN_ADD: var_op = Variant::OP_ADD; break;
- case GDParser::OperatorNode::OP_ASSIGN_SUB: var_op = Variant::OP_SUBSTRACT; break;
+ case GDParser::OperatorNode::OP_ASSIGN_SUB: var_op = Variant::OP_SUBTRACT; break;
case GDParser::OperatorNode::OP_ASSIGN_MUL: var_op = Variant::OP_MULTIPLY; break;
case GDParser::OperatorNode::OP_ASSIGN_DIV: var_op = Variant::OP_DIVIDE; break;
case GDParser::OperatorNode::OP_ASSIGN_MOD: var_op = Variant::OP_MODULE; break;
@@ -759,7 +759,7 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr
if (!_create_binary_operator(codegen, on, Variant::OP_ADD, p_stack_level)) return -1;
} break;
case GDParser::OperatorNode::OP_SUB: {
- if (!_create_binary_operator(codegen, on, Variant::OP_SUBSTRACT, p_stack_level)) return -1;
+ if (!_create_binary_operator(codegen, on, Variant::OP_SUBTRACT, p_stack_level)) return -1;
} break;
case GDParser::OperatorNode::OP_MUL: {
if (!_create_binary_operator(codegen, on, Variant::OP_MULTIPLY, p_stack_level)) return -1;
diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp
index bc51b84047..aa39ad92c4 100644
--- a/modules/gdscript/gd_editor.cpp
+++ b/modules/gdscript/gd_editor.cpp
@@ -908,7 +908,7 @@ static bool _guess_expression_type(GDCompletionContext &context, const GDParser:
Variant::Operator vop = Variant::OP_MAX;
switch (op->op) {
case GDParser::OperatorNode::OP_ADD: vop = Variant::OP_ADD; break;
- case GDParser::OperatorNode::OP_SUB: vop = Variant::OP_SUBSTRACT; break;
+ case GDParser::OperatorNode::OP_SUB: vop = Variant::OP_SUBTRACT; break;
case GDParser::OperatorNode::OP_MUL: vop = Variant::OP_MULTIPLY; break;
case GDParser::OperatorNode::OP_DIV: vop = Variant::OP_DIVIDE; break;
case GDParser::OperatorNode::OP_MOD: vop = Variant::OP_MODULE; break;
diff --git a/modules/gdscript/gd_function.cpp b/modules/gdscript/gd_function.cpp
index ddee7b2521..df7b16c96e 100644
--- a/modules/gdscript/gd_function.cpp
+++ b/modules/gdscript/gd_function.cpp
@@ -271,6 +271,8 @@ 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 CHECK_SPACE(m_space) \
ERR_BREAK((ip + m_space) > _code_size)
@@ -281,6 +283,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
break;
#else
+#define GD_ERR_BREAK(m_cond)
#define CHECK_SPACE(m_space)
#define GET_VARIANT_PTR(m_v, m_code_ofs) \
Variant *m_v; \
@@ -302,9 +305,13 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
#endif
bool exit_ok = false;
+#ifdef DEBUG_ENABLED
while (ip < _code_size) {
-
int last_opcode = _code_ptr[ip];
+#else
+ while (true) {
+#endif
+
switch (_code_ptr[ip]) {
case OPCODE_OPERATOR: {
@@ -313,21 +320,21 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
bool valid;
Variant::Operator op = (Variant::Operator)_code_ptr[ip + 1];
- ERR_BREAK(op >= Variant::OP_MAX);
+ GD_ERR_BREAK(op >= Variant::OP_MAX);
GET_VARIANT_PTR(a, 2);
GET_VARIANT_PTR(b, 3);
GET_VARIANT_PTR(dst, 4);
#ifdef DEBUG_ENABLED
+
Variant ret;
Variant::evaluate(op, *a, *b, ret, valid);
#else
Variant::evaluate(op, *a, *b, *dst, valid);
#endif
-
- if (!valid) {
#ifdef DEBUG_ENABLED
+ if (!valid) {
if (ret.get_type() == Variant::STRING) {
//return a string when invalid with the error
@@ -336,13 +343,10 @@ 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) + "'.";
}
-#endif
break;
}
-#ifdef DEBUG_ENABLED
*dst = ret;
#endif
-
ip += 5;
continue;
}
@@ -355,7 +359,6 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
GET_VARIANT_PTR(dst, 3);
#ifdef DEBUG_ENABLED
-
if (a->get_type() != Variant::OBJECT || a->operator Object *() == NULL) {
err_text = "Left operand of 'is' is not an instance of anything.";
@@ -367,7 +370,6 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
break;
}
#endif
-
Object *obj_A = *a;
Object *obj_B = *b;
@@ -399,12 +401,13 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
GDNativeClass *nc = Object::cast_to<GDNativeClass>(obj_B);
+#ifdef DEBUG_ENABLED
if (!nc) {
err_text = "Right operand of 'is' is not a class (type: '" + obj_B->get_class() + "').";
break;
}
-
+#endif
extends_ok = ClassDB::is_parent_class(obj_A->get_class_name(), nc->get_name());
}
@@ -423,6 +426,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
bool valid;
dst->set(*index, *value, &valid);
+#ifdef DEBUG_ENABLED
if (!valid) {
String v = index->operator String();
if (v != "") {
@@ -433,7 +437,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
err_text = "Invalid set index " + v + " (on base: '" + _get_var_type(dst) + "').";
break;
}
-
+#endif
ip += 4;
continue;
}
@@ -453,6 +457,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
*dst = src->get(*index, &valid);
#endif
+#ifdef DEBUG_ENABLED
if (!valid) {
String v = index->operator String();
if (v != "") {
@@ -463,7 +468,6 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
err_text = "Invalid get index " + v + " (on base: '" + _get_var_type(src) + "').";
break;
}
-#ifdef DEBUG_ENABLED
*dst = ret;
#endif
ip += 4;
@@ -478,18 +482,19 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
int indexname = _code_ptr[ip + 2];
- ERR_BREAK(indexname < 0 || indexname >= _global_names_count);
+ GD_ERR_BREAK(indexname < 0 || indexname >= _global_names_count);
const StringName *index = &_global_names_ptr[indexname];
bool valid;
dst->set_named(*index, *value, &valid);
+#ifdef DEBUG_ENABLED
if (!valid) {
String err_type;
err_text = "Invalid set index '" + String(*index) + "' (on base: '" + _get_var_type(dst) + "').";
break;
}
-
+#endif
ip += 4;
continue;
}
@@ -502,7 +507,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
int indexname = _code_ptr[ip + 2];
- ERR_BREAK(indexname < 0 || indexname >= _global_names_count);
+ GD_ERR_BREAK(indexname < 0 || indexname >= _global_names_count);
const StringName *index = &_global_names_ptr[indexname];
bool valid;
@@ -513,7 +518,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
#else
*dst = src->get_named(*index, &valid);
#endif
-
+#ifdef DEBUG_ENABLED
if (!valid) {
if (src->has_method(*index)) {
err_text = "Invalid get index '" + index->operator String() + "' (on base: '" + _get_var_type(src) + "'). Did you mean '." + index->operator String() + "()' ?";
@@ -522,7 +527,6 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
}
break;
}
-#ifdef DEBUG_ENABLED
*dst = ret;
#endif
ip += 4;
@@ -532,7 +536,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
CHECK_SPACE(3);
int indexname = _code_ptr[ip + 1];
- ERR_BREAK(indexname < 0 || indexname >= _global_names_count);
+ GD_ERR_BREAK(indexname < 0 || indexname >= _global_names_count);
const StringName *index = &_global_names_ptr[indexname];
GET_VARIANT_PTR(src, 2);
@@ -554,7 +558,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
CHECK_SPACE(3);
int indexname = _code_ptr[ip + 1];
- ERR_BREAK(indexname < 0 || indexname >= _global_names_count);
+ GD_ERR_BREAK(indexname < 0 || indexname >= _global_names_count);
const StringName *index = &_global_names_ptr[indexname];
GET_VARIANT_PTR(dst, 2);
bool ok = ClassDB::get_property(p_instance->owner, *index, *dst);
@@ -615,11 +619,13 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
Variant::CallError err;
*dst = Variant::construct(t, (const Variant **)argptrs, argc, err);
+#ifdef DEBUG_ENABLED
if (err.error != Variant::CallError::CALL_OK) {
err_text = _get_call_error(err, "'" + Variant::get_type_name(t) + "' constructor", (const Variant **)argptrs);
break;
}
+#endif
ip += 4 + argc;
//construct a basic type
@@ -677,10 +683,10 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
GET_VARIANT_PTR(base, 2);
int nameg = _code_ptr[ip + 3];
- ERR_BREAK(nameg < 0 || nameg >= _global_names_count);
+ GD_ERR_BREAK(nameg < 0 || nameg >= _global_names_count);
const StringName *methodname = &_global_names_ptr[nameg];
- ERR_BREAK(argc < 0);
+ GD_ERR_BREAK(argc < 0);
ip += 4;
CHECK_SPACE(argc + 1);
Variant **argptrs = call_args;
@@ -711,7 +717,6 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
if (GDScriptLanguage::get_singleton()->profiling) {
function_call_time += OS::get_singleton()->get_ticks_usec() - call_time;
}
-#endif
if (err.error != Variant::CallError::CALL_OK) {
@@ -742,6 +747,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
err_text = _get_call_error(err, "function '" + methodstr + "' in base '" + basestr + "'", (const Variant **)argptrs);
break;
}
+#endif
//_call_func(NULL,base,*methodname,ip,argc,p_instance,stack);
ip += argc + 1;
@@ -753,7 +759,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
GDFunctions::Function func = GDFunctions::Function(_code_ptr[ip + 1]);
int argc = _code_ptr[ip + 2];
- ERR_BREAK(argc < 0);
+ GD_ERR_BREAK(argc < 0);
ip += 3;
CHECK_SPACE(argc + 1);
@@ -770,6 +776,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
GDFunctions::call(func, (const Variant **)argptrs, argc, *dst, err);
+#ifdef DEBUG_ENABLED
if (err.error != Variant::CallError::CALL_OK) {
String methodstr = GDFunctions::get_func_name(func);
@@ -781,6 +788,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
}
break;
}
+#endif
ip += argc + 1;
continue;
}
@@ -792,8 +800,8 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
CHECK_SPACE(2);
int self_fun = _code_ptr[ip + 1];
-#ifdef DEBUG_ENABLED
+#ifdef DEBUG_ENABLED
if (self_fun < 0 || self_fun >= _global_names_count) {
err_text = "compiler bug, function name not found";
@@ -898,10 +906,11 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
retvalue = gdfs;
if (_code_ptr[ip] == OPCODE_YIELD_SIGNAL) {
+ //do the oneshot connect
GET_VARIANT_PTR(argobj, 1);
GET_VARIANT_PTR(argname, 2);
- //do the oneshot connect
+#ifdef DEBUG_ENABLED
if (argobj->get_type() != Variant::OBJECT) {
err_text = "First argument of yield() not of type object.";
break;
@@ -910,6 +919,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
err_text = "Second argument of yield() not a string (for signal name).";
break;
}
+#endif
Object *obj = argobj->operator Object *();
String signal = argname->operator String();
#ifdef DEBUG_ENABLED
@@ -932,10 +942,12 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
#endif
Error err = obj->connect(signal, gdfs.ptr(), "_signal_callback", varray(gdfs), Object::CONNECT_ONESHOT);
+#ifdef DEBUG_ENABLED
if (err != OK) {
err_text = "Error connecting to signal: " + signal + " during yield().";
break;
}
+#endif
}
exit_ok = true;
@@ -944,10 +956,12 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
case OPCODE_YIELD_RESUME: {
CHECK_SPACE(2);
+#ifdef DEBUG_ENABLED
if (!p_state) {
err_text = ("Invalid Resume (bug?)");
break;
}
+#endif
GET_VARIANT_PTR(result, 1);
*result = p_state->result;
ip += 2;
@@ -958,7 +972,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
CHECK_SPACE(2);
int to = _code_ptr[ip + 1];
- ERR_BREAK(to < 0 || to > _code_size);
+ GD_ERR_BREAK(to < 0 || to > _code_size);
ip = to;
continue;
}
@@ -968,18 +982,11 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
GET_VARIANT_PTR(test, 1);
- bool valid;
- bool result = test->booleanize(valid);
-#ifdef DEBUG_ENABLED
- if (!valid) {
+ bool result = test->booleanize();
- err_text = "cannot evaluate conditional expression of type: " + Variant::get_type_name(test->get_type());
- break;
- }
-#endif
if (result) {
int to = _code_ptr[ip + 2];
- ERR_BREAK(to < 0 || to > _code_size);
+ GD_ERR_BREAK(to < 0 || to > _code_size);
ip = to;
continue;
}
@@ -992,18 +999,11 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
GET_VARIANT_PTR(test, 1);
- bool valid;
- bool result = test->booleanize(valid);
-#ifdef DEBUG_ENABLED
- if (!valid) {
+ bool result = test->booleanize();
- err_text = "cannot evaluate conditional expression of type: " + Variant::get_type_name(test->get_type());
- break;
- }
-#endif
if (!result) {
int to = _code_ptr[ip + 2];
- ERR_BREAK(to < 0 || to > _code_size);
+ GD_ERR_BREAK(to < 0 || to > _code_size);
ip = to;
continue;
}
@@ -1033,23 +1033,26 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
bool valid;
if (!container->iter_init(*counter, valid)) {
+#ifdef DEBUG_ENABLED
if (!valid) {
err_text = "Unable to iterate on object of type " + Variant::get_type_name(container->get_type()) + "'.";
break;
}
+#endif
int jumpto = _code_ptr[ip + 3];
- ERR_BREAK(jumpto < 0 || jumpto > _code_size);
+ GD_ERR_BREAK(jumpto < 0 || jumpto > _code_size);
ip = jumpto;
continue;
}
GET_VARIANT_PTR(iterator, 4);
*iterator = container->iter_get(*counter, valid);
+#ifdef DEBUG_ENABLED
if (!valid) {
err_text = "Unable to obtain iterator object of type " + Variant::get_type_name(container->get_type()) + "'.";
break;
}
-
+#endif
ip += 5; //skip regular iterate which is always next
continue;
}
@@ -1062,23 +1065,26 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
bool valid;
if (!container->iter_next(*counter, valid)) {
+#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;
}
+#endif
int jumpto = _code_ptr[ip + 3];
- ERR_BREAK(jumpto < 0 || jumpto > _code_size);
+ GD_ERR_BREAK(jumpto < 0 || jumpto > _code_size);
ip = jumpto;
continue;
}
GET_VARIANT_PTR(iterator, 4);
*iterator = container->iter_get(*counter, valid);
+#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;
}
-
+#endif
ip += 5; //loop again
continue;
}
@@ -1087,14 +1093,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
GET_VARIANT_PTR(test, 1);
#ifdef DEBUG_ENABLED
- bool valid;
- bool result = test->booleanize(valid);
-
- if (!valid) {
-
- err_text = "cannot evaluate conditional expression of type: " + Variant::get_type_name(test->get_type());
- break;
- }
+ bool result = test->booleanize();
if (!result) {
@@ -1103,7 +1102,6 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
}
#endif
-
ip += 2;
continue;
}
@@ -1157,6 +1155,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
}
}
+#ifdef DEBUG_ENABLED
if (exit_ok)
break;
//error
@@ -1182,6 +1181,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
_err_print_error(err_func.utf8().get_data(), err_file.utf8().get_data(), err_line, err_text.utf8().get_data(), ERR_HANDLER_SCRIPT);
}
+#endif
break;
}
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp
index 72c3f9612a..36aaa1f807 100644
--- a/modules/gdscript/gd_parser.cpp
+++ b/modules/gdscript/gd_parser.cpp
@@ -1699,7 +1699,7 @@ GDParser::Node *GDParser::_reduce_expression(Node *p_node, bool p_to_const) {
_REDUCE_BINARY(Variant::OP_ADD);
} break;
case OperatorNode::OP_SUB: {
- _REDUCE_BINARY(Variant::OP_SUBSTRACT);
+ _REDUCE_BINARY(Variant::OP_SUBTRACT);
} break;
case OperatorNode::OP_MUL: {
_REDUCE_BINARY(Variant::OP_MULTIPLY);
diff --git a/modules/opus/audio_stream_opus.cpp b/modules/opus/audio_stream_opus.cpp
index 1dac890eb8..995f4ddcc6 100644
--- a/modules/opus/audio_stream_opus.cpp
+++ b/modules/opus/audio_stream_opus.cpp
@@ -56,7 +56,7 @@ int AudioStreamPlaybackOpus::_op_seek_func(void *_stream, opus_int64 _offset, in
fa->seek(_offset);
} break;
case SEEK_CUR: {
- fa->seek(fa->get_pos() + _offset);
+ fa->seek(fa->get_position() + _offset);
} break;
case SEEK_END: {
fa->seek_end(_offset);
@@ -83,7 +83,7 @@ int AudioStreamPlaybackOpus::_op_close_func(void *_stream) {
opus_int64 AudioStreamPlaybackOpus::_op_tell_func(void *_stream) {
FileAccess *_fa = (FileAccess *)_stream;
- return (opus_int64)_fa->get_pos();
+ return (opus_int64)_fa->get_position();
}
void AudioStreamPlaybackOpus::_clear_stream() {
@@ -340,7 +340,7 @@ float AudioStreamPlaybackOpus::get_length() const {
return length;
}
-float AudioStreamPlaybackOpus::get_pos() const {
+float AudioStreamPlaybackOpus::get_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 ccfe04e84e..c7a053acd3 100644
--- a/modules/opus/audio_stream_opus.h
+++ b/modules/opus/audio_stream_opus.h
@@ -99,7 +99,7 @@ public:
virtual int get_loop_count() const { return repeats; }
- virtual float get_pos() const;
+ virtual float get_position() const;
virtual void seek_pos(float p_time);
virtual int get_channels() const { return stream_channels; }
diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp
index 90ee164b6f..03592047ad 100644
--- a/modules/pvr/texture_loader_pvr.cpp
+++ b/modules/pvr/texture_loader_pvr.cpp
@@ -74,7 +74,7 @@ RES ResourceFormatPVR::load(const String &p_path, const String &p_original_path,
uint32_t mipmaps = f->get_32();
uint32_t flags = f->get_32();
uint32_t surfsize = f->get_32();
- f->seek(f->get_pos() + 20); // bpp, rmask, gmask, bmask, amask
+ f->seek(f->get_position() + 20); // bpp, rmask, gmask, bmask, amask
uint8_t pvrid[5] = { 0, 0, 0, 0, 0 };
f->get_buffer(pvrid, 4);
ERR_FAIL_COND_V(String((char *)pvrid) != "PVR!", RES());
diff --git a/modules/recast/config.py b/modules/recast/config.py
index fb920482f5..d42f07b2a9 100644
--- a/modules/recast/config.py
+++ b/modules/recast/config.py
@@ -1,6 +1,6 @@
def can_build(platform):
- return True
+ return platform != "android"
def configure(env):
diff --git a/modules/regex/regex.h b/modules/regex/regex.h
index 0d97bcce54..bfa9c84042 100644
--- a/modules/regex/regex.h
+++ b/modules/regex/regex.h
@@ -87,8 +87,8 @@ public:
Error compile(const String &p_pattern);
void _init(const String &p_pattern = "");
- Ref<RegExMatch> search(const String &p_subject, int offset = 0, int end = -1) const;
- String sub(const String &p_subject, const String &p_replacement, bool p_all = false, int p_start = 0, int p_end = -1) const;
+ Ref<RegExMatch> search(const String &p_subject, int p_offset = 0, int p_end = -1) const;
+ String sub(const String &p_subject, const String &p_replacement, bool p_all = false, int p_offset = 0, int p_end = -1) const;
bool is_valid() const;
String get_pattern() const;
diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
index 9457fbfaf6..a3206187c0 100644
--- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
+++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
@@ -97,7 +97,7 @@ int AudioStreamPlaybackOGGVorbis::get_loop_count() const {
return loops;
}
-float AudioStreamPlaybackOGGVorbis::get_pos() const {
+float AudioStreamPlaybackOGGVorbis::get_position() const {
return float(frames_mixed) / vorbis_stream->sample_rate;
}
diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.h b/modules/stb_vorbis/audio_stream_ogg_vorbis.h
index bcd829a56a..c38402fb3a 100644
--- a/modules/stb_vorbis/audio_stream_ogg_vorbis.h
+++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.h
@@ -67,7 +67,7 @@ public:
virtual int get_loop_count() const; //times it looped
- virtual float get_pos() const;
+ virtual float get_position() const;
virtual void seek_pos(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 c575edbba3..e27452354b 100644
--- a/modules/svg/image_loader_svg.cpp
+++ b/modules/svg/image_loader_svg.cpp
@@ -128,13 +128,13 @@ Error ImageLoaderSVG::_create_image(Ref<Image> p_image, const PoolVector<uint8_t
return OK;
}
-Error ImageLoaderSVG::create_image_from_string(Ref<Image> p_image, const char *svg_str, float p_scale, bool upsample, bool convert_colors) {
+Error ImageLoaderSVG::create_image_from_string(Ref<Image> p_image, const char *p_svg_str, float p_scale, bool upsample, bool convert_colors) {
- size_t str_len = strlen(svg_str);
+ size_t str_len = strlen(p_svg_str);
PoolVector<uint8_t> src_data;
src_data.resize(str_len + 1);
PoolVector<uint8_t>::Write src_w = src_data.write();
- memcpy(src_w.ptr(), svg_str, str_len + 1);
+ memcpy(src_w.ptr(), p_svg_str, str_len + 1);
return _create_image(p_image, &src_data, p_scale, upsample, convert_colors);
}
@@ -160,4 +160,4 @@ void ImageLoaderSVG::get_recognized_extensions(List<String> *p_extensions) const
ImageLoaderSVG::ImageLoaderSVG() {
}
-ImageLoaderSVG::ReplaceColors ImageLoaderSVG::replace_colors; \ No newline at end of file
+ImageLoaderSVG::ReplaceColors ImageLoaderSVG::replace_colors;
diff --git a/modules/svg/image_loader_svg.h b/modules/svg/image_loader_svg.h
index 332ac214a5..cf44cd8c50 100644
--- a/modules/svg/image_loader_svg.h
+++ b/modules/svg/image_loader_svg.h
@@ -57,7 +57,7 @@ class ImageLoaderSVG : public ImageFormatLoader {
List<uint32_t> new_colors;
} replace_colors;
static SVGRasterizer rasterizer;
- static void _convert_colors(NSVGimage *p_svg_imge);
+ static void _convert_colors(NSVGimage *p_svg_image);
static Error _create_image(Ref<Image> p_image, const PoolVector<uint8_t> *p_data, float p_scale, bool upsample, bool convert_colors = false);
public:
diff --git a/modules/tga/image_loader_tga.cpp b/modules/tga/image_loader_tga.cpp
index 7c7cf5bcbe..d7a1ce7308 100644
--- a/modules/tga/image_loader_tga.cpp
+++ b/modules/tga/image_loader_tga.cpp
@@ -253,7 +253,7 @@ Error ImageLoaderTGA::load_image(Ref<Image> p_image, FileAccess *f, bool p_force
err = FAILED;
if (err == OK) {
- f->seek(f->get_pos() + tga_header.id_length);
+ f->seek(f->get_position() + tga_header.id_length);
PoolVector<uint8_t> palette;
@@ -269,7 +269,7 @@ Error ImageLoaderTGA::load_image(Ref<Image> p_image, FileAccess *f, bool p_force
}
PoolVector<uint8_t>::Write src_image_w = src_image.write();
- f->get_buffer(&src_image_w[0], src_image_len - f->get_pos());
+ f->get_buffer(&src_image_w[0], src_image_len - f->get_position());
PoolVector<uint8_t>::Read src_image_r = src_image.read();
diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp
index 02b994f8db..603c31195d 100644
--- a/modules/theora/video_stream_theora.cpp
+++ b/modules/theora/video_stream_theora.cpp
@@ -634,7 +634,7 @@ int VideoStreamPlaybackTheora::get_loop_count() const {
return 0;
};
-float VideoStreamPlaybackTheora::get_pos() const {
+float VideoStreamPlaybackTheora::get_position() const {
return get_time();
};
diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h
index f04e49c662..aeb5fa3511 100644
--- a/modules/theora/video_stream_theora.h
+++ b/modules/theora/video_stream_theora.h
@@ -140,7 +140,7 @@ public:
virtual int get_loop_count() const;
- virtual float get_pos() const;
+ virtual float get_position() const;
virtual void seek_pos(float p_time);
void set_file(const String &p_file);
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index 88012d2031..c665fa12cf 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -423,7 +423,7 @@ Ref<VisualScriptNode> VisualScript::get_node(const StringName &p_func, int p_id)
return func.nodes[p_id].node;
}
-void VisualScript::set_node_pos(const StringName &p_func, int p_id, const Point2 &p_pos) {
+void VisualScript::set_node_position(const StringName &p_func, int p_id, const Point2 &p_pos) {
ERR_FAIL_COND(instances.size());
ERR_FAIL_COND(!functions.has(p_func));
@@ -433,7 +433,7 @@ void VisualScript::set_node_pos(const StringName &p_func, int p_id, const Point2
func.nodes[p_id].pos = p_pos;
}
-Point2 VisualScript::get_node_pos(const StringName &p_func, int p_id) const {
+Point2 VisualScript::get_node_position(const StringName &p_func, int p_id) const {
ERR_FAIL_COND_V(!functions.has(p_func), Point2());
const Function &func = functions[p_func];
@@ -1273,14 +1273,14 @@ void VisualScript::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_function_scroll", "name", "ofs"), &VisualScript::set_function_scroll);
ClassDB::bind_method(D_METHOD("get_function_scroll", "name"), &VisualScript::get_function_scroll);
- ClassDB::bind_method(D_METHOD("add_node", "func", "id", "node", "pos"), &VisualScript::add_node, DEFVAL(Point2()));
+ ClassDB::bind_method(D_METHOD("add_node", "func", "id", "node", "position"), &VisualScript::add_node, DEFVAL(Point2()));
ClassDB::bind_method(D_METHOD("remove_node", "func", "id"), &VisualScript::remove_node);
ClassDB::bind_method(D_METHOD("get_function_node_id", "name"), &VisualScript::get_function_node_id);
ClassDB::bind_method(D_METHOD("get_node", "func", "id"), &VisualScript::get_node);
ClassDB::bind_method(D_METHOD("has_node", "func", "id"), &VisualScript::has_node);
- ClassDB::bind_method(D_METHOD("set_node_pos", "func", "id", "pos"), &VisualScript::set_node_pos);
- ClassDB::bind_method(D_METHOD("get_node_pos", "func", "id"), &VisualScript::get_node_pos);
+ ClassDB::bind_method(D_METHOD("set_node_position", "func", "id", "position"), &VisualScript::set_node_position);
+ ClassDB::bind_method(D_METHOD("get_node_position", "func", "id"), &VisualScript::get_node_position);
ClassDB::bind_method(D_METHOD("sequence_connect", "func", "from_node", "from_output", "to_node"), &VisualScript::sequence_connect);
ClassDB::bind_method(D_METHOD("sequence_disconnect", "func", "from_node", "from_output", "to_node"), &VisualScript::sequence_disconnect);
diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h
index 297e9e510f..4ae50ee829 100644
--- a/modules/visual_script/visual_script.h
+++ b/modules/visual_script/visual_script.h
@@ -278,8 +278,8 @@ public:
void remove_node(const StringName &p_func, int p_id);
bool has_node(const StringName &p_func, int p_id) const;
Ref<VisualScriptNode> get_node(const StringName &p_func, int p_id) const;
- void set_node_pos(const StringName &p_func, int p_id, const Point2 &p_pos);
- Point2 get_node_pos(const StringName &p_func, int p_id) const;
+ void set_node_position(const StringName &p_func, int p_id, const Point2 &p_pos);
+ Point2 get_node_position(const StringName &p_func, int p_id) const;
void get_node_list(const StringName &p_func, List<int> *r_nodes) const;
void sequence_connect(const StringName &p_func, int p_from_node, int p_from_output, int p_to_node);
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 671a507377..d0ab29f184 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -481,7 +481,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
continue;
Ref<VisualScriptNode> node = script->get_node(edited_func, E->get());
- Vector2 pos = script->get_node_pos(edited_func, E->get());
+ Vector2 pos = script->get_node_position(edited_func, E->get());
GraphNode *gnode = memnew(GraphNode);
gnode->set_title(node->get_caption());
@@ -491,10 +491,6 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
gnode->set_overlay(GraphNode::OVERLAY_BREAKPOINT);
}
- if (node_styles.has(node->get_category())) {
- gnode->add_style_override("frame", node_styles[node->get_category()]);
- }
-
gnode->set_meta("__vnode", node);
gnode->set_name(itos(E->get()));
gnode->connect("dragged", this, "_node_moved", varray(E->get()));
@@ -527,6 +523,25 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
gnode->connect("resize_request", this, "_comment_node_resized", varray(E->get()));
}
+ if (node_styles.has(node->get_category())) {
+ Ref<StyleBoxFlat> sbf = node_styles[node->get_category()];
+ if (gnode->is_comment())
+ sbf = EditorNode::get_singleton()->get_theme_base()->get_theme()->get_stylebox("comment", "GraphNode");
+
+ 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);
+ mono_color.a = 0.85;
+ c = mono_color;
+ }
+
+ gnode->add_color_override("title_color", c);
+ c.a = 0.7;
+ gnode->add_color_override("close_color", c);
+ gnode->add_style_override("frame", sbf);
+ }
+
int slot_idx = 0;
bool single_seq_output = node->get_output_sequence_port_count() == 1 && node->get_output_sequence_port_text(0) == String();
@@ -1050,7 +1065,7 @@ void VisualScriptEditor::_available_node_doubleclicked() {
List<int> existing;
script->get_node_list(edited_func, &existing);
for (List<int>::Element *E = existing.front(); E; E = E->next()) {
- Point2 pos = script->get_node_pos(edited_func, E->get());
+ Point2 pos = script->get_node_position(edited_func, E->get());
if (pos.distance_to(ofs) < 15) {
ofs += Vector2(graph->get_snap(), graph->get_snap());
exists = true;
@@ -1171,7 +1186,7 @@ void VisualScriptEditor::_on_nodes_delete() {
for (List<int>::Element *F = to_erase.front(); F; F = F->next()) {
undo_redo->add_do_method(script.ptr(), "remove_node", edited_func, F->get());
- undo_redo->add_undo_method(script.ptr(), "add_node", edited_func, F->get(), script->get_node(edited_func, F->get()), script->get_node_pos(edited_func, F->get()));
+ undo_redo->add_undo_method(script.ptr(), "add_node", edited_func, F->get(), script->get_node(edited_func, F->get()), script->get_node_position(edited_func, F->get()));
List<VisualScript::SequenceConnection> sequence_conns;
script->get_sequence_connection_list(edited_func, &sequence_conns);
@@ -1228,7 +1243,7 @@ void VisualScriptEditor::_on_nodes_duplicate() {
int new_id = idc++;
to_select.insert(new_id);
- undo_redo->add_do_method(script.ptr(), "add_node", edited_func, new_id, dupe, script->get_node_pos(edited_func, F->get()) + Vector2(20, 20));
+ undo_redo->add_do_method(script.ptr(), "add_node", edited_func, new_id, dupe, script->get_node_position(edited_func, F->get()) + Vector2(20, 20));
undo_redo->add_undo_method(script.ptr(), "remove_node", edited_func, new_id);
}
undo_redo->add_do_method(this, "_update_graph");
@@ -1262,7 +1277,7 @@ Variant VisualScriptEditor::get_drag_data_fw(const Point2 &p_point, Control *p_f
if (p_from == nodes) {
- TreeItem *it = nodes->get_item_at_pos(p_point);
+ TreeItem *it = nodes->get_item_at_position(p_point);
if (!it)
return Variant();
String type = it->get_metadata(0);
@@ -1281,7 +1296,7 @@ Variant VisualScriptEditor::get_drag_data_fw(const Point2 &p_point, Control *p_f
if (p_from == members) {
- TreeItem *it = members->get_item_at_pos(p_point);
+ TreeItem *it = members->get_item_at_position(p_point);
if (!it)
return Variant();
@@ -2182,7 +2197,7 @@ void VisualScriptEditor::_move_node(String func, int p_id, const Vector2 &p_to)
if (Object::cast_to<GraphNode>(node))
Object::cast_to<GraphNode>(node)->set_offset(p_to);
}
- script->set_node_pos(edited_func, p_id, p_to / EDSCALE);
+ script->set_node_position(edited_func, p_id, p_to / EDSCALE);
}
void VisualScriptEditor::_node_moved(Vector2 p_from, Vector2 p_to, int p_id) {
@@ -2196,7 +2211,7 @@ void VisualScriptEditor::_remove_node(int p_id) {
undo_redo->create_action(TTR("Remove VisualScript Node"));
undo_redo->add_do_method(script.ptr(), "remove_node", edited_func, p_id);
- undo_redo->add_undo_method(script.ptr(), "add_node", edited_func, p_id, script->get_node(edited_func, p_id), script->get_node_pos(edited_func, p_id));
+ undo_redo->add_undo_method(script.ptr(), "add_node", edited_func, p_id, script->get_node(edited_func, p_id), script->get_node_position(edited_func, p_id));
List<VisualScript::SequenceConnection> sequence_conns;
script->get_sequence_connection_list(edited_func, &sequence_conns);
@@ -2753,12 +2768,12 @@ void VisualScriptEditor::_notification(int p_what) {
signal_editor->connect("changed", this, "_update_members");
List<Pair<String, Color> > colors;
- colors.push_back(Pair<String, Color>("functions", Color(1, 0.9, 0.9)));
- colors.push_back(Pair<String, Color>("data", Color(0.9, 1.0, 0.9)));
- colors.push_back(Pair<String, Color>("operators", Color(0.9, 0.9, 1.0)));
- colors.push_back(Pair<String, Color>("flow_control", Color(1.0, 1.0, 1.0)));
- colors.push_back(Pair<String, Color>("custom", Color(0.8, 1.0, 1.0)));
- colors.push_back(Pair<String, Color>("constants", Color(1.0, 0.8, 1.0)));
+ 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")));
for (List<Pair<String, Color> >::Element *E = colors.front(); E; E = E->next()) {
print_line(E->get().first);
@@ -2880,7 +2895,7 @@ void VisualScriptEditor::_menu_option(int p_what) {
}
if (node.is_valid()) {
clipboard->nodes[id] = node->duplicate();
- clipboard->nodes_positions[id] = script->get_node_pos(edited_func, id);
+ clipboard->nodes_positions[id] = script->get_node_position(edited_func, id);
}
}
}
@@ -2940,7 +2955,7 @@ void VisualScriptEditor::_menu_option(int p_what) {
List<int> nodes;
script->get_node_list(edited_func, &nodes);
for (List<int>::Element *E = nodes.front(); E; E = E->next()) {
- Vector2 pos = script->get_node_pos(edited_func, E->get()).snapped(Vector2(2, 2));
+ Vector2 pos = script->get_node_position(edited_func, E->get()).snapped(Vector2(2, 2));
existing_positions.insert(pos);
}
}
@@ -3054,7 +3069,7 @@ void VisualScriptEditor::_member_option(int p_option) {
List<int> nodes;
script->get_node_list(name, &nodes);
for (List<int>::Element *E = nodes.front(); E; E = E->next()) {
- undo_redo->add_undo_method(script.ptr(), "add_node", name, E->get(), script->get_node(name, E->get()), script->get_node_pos(name, E->get()));
+ undo_redo->add_undo_method(script.ptr(), "add_node", name, E->get(), script->get_node(name, E->get()), script->get_node_position(name, E->get()));
}
List<VisualScript::SequenceConnection> seq_connections;
diff --git a/modules/visual_script/visual_script_expression.cpp b/modules/visual_script/visual_script_expression.cpp
index eae866d167..897e910f20 100644
--- a/modules/visual_script/visual_script_expression.cpp
+++ b/modules/visual_script/visual_script_expression.cpp
@@ -1023,7 +1023,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
case TK_OP_OR: op = Variant::OP_OR; break;
case TK_OP_NOT: op = Variant::OP_NOT; break;
case TK_OP_ADD: op = Variant::OP_ADD; break;
- case TK_OP_SUB: op = Variant::OP_SUBSTRACT; break;
+ case TK_OP_SUB: op = Variant::OP_SUBTRACT; break;
case TK_OP_MUL: op = Variant::OP_MULTIPLY; break;
case TK_OP_DIV: op = Variant::OP_DIVIDE; break;
case TK_OP_MOD: op = Variant::OP_MODULE; break;
@@ -1085,7 +1085,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
case Variant::OP_MODULE: priority = 2; break;
case Variant::OP_ADD: priority = 3; break;
- case Variant::OP_SUBSTRACT: priority = 3; break;
+ case Variant::OP_SUBTRACT: priority = 3; break;
case Variant::OP_SHIFT_LEFT: priority = 4; break;
case Variant::OP_SHIFT_RIGHT: priority = 4; break;
diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp
index 267946750f..f02e797fe6 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -1546,7 +1546,7 @@ public:
value = Variant::evaluate(Variant::OP_ADD, value, p_argument);
} break;
case VisualScriptPropertySet::ASSIGN_OP_SUB: {
- value = Variant::evaluate(Variant::OP_SUBSTRACT, value, p_argument);
+ value = Variant::evaluate(Variant::OP_SUBTRACT, value, p_argument);
} break;
case VisualScriptPropertySet::ASSIGN_OP_MUL: {
value = Variant::evaluate(Variant::OP_MULTIPLY, value, p_argument);
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index b617c11bab..16aec76e57 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -3762,7 +3762,7 @@ void register_visual_script_nodes() {
VisualScriptLanguage::singleton->add_register_func("operators/compare/greater_equal", create_op_node<Variant::OP_GREATER_EQUAL>);
//mathematic
VisualScriptLanguage::singleton->add_register_func("operators/math/add", create_op_node<Variant::OP_ADD>);
- VisualScriptLanguage::singleton->add_register_func("operators/math/subtract", create_op_node<Variant::OP_SUBSTRACT>);
+ VisualScriptLanguage::singleton->add_register_func("operators/math/subtract", create_op_node<Variant::OP_SUBTRACT>);
VisualScriptLanguage::singleton->add_register_func("operators/math/multiply", create_op_node<Variant::OP_MULTIPLY>);
VisualScriptLanguage::singleton->add_register_func("operators/math/divide", create_op_node<Variant::OP_DIVIDE>);
VisualScriptLanguage::singleton->add_register_func("operators/math/negate", create_op_node<Variant::OP_NEGATE>);
diff --git a/modules/vorbis/audio_stream_ogg_vorbis.cpp b/modules/vorbis/audio_stream_ogg_vorbis.cpp
index 6389c286c2..52aa2c5ee0 100644
--- a/modules/vorbis/audio_stream_ogg_vorbis.cpp
+++ b/modules/vorbis/audio_stream_ogg_vorbis.cpp
@@ -58,7 +58,7 @@ int AudioStreamPlaybackOGGVorbis::_ov_seek_func(void *_f, ogg_int64_t offs, int
fa->seek(offs);
} else if (whence == SEEK_CUR) {
- fa->seek(fa->get_pos() + offs);
+ fa->seek(fa->get_position() + offs);
} else if (whence == SEEK_END) {
fa->seek_end(offs);
@@ -89,7 +89,7 @@ long AudioStreamPlaybackOGGVorbis::_ov_tell_func(void *_f) {
//printf("close %p\n",_f);
FileAccess *fa = (FileAccess *)_f;
- return fa->get_pos();
+ return fa->get_position();
}
int AudioStreamPlaybackOGGVorbis::mix(int16_t *p_bufer, int p_frames) {
@@ -203,7 +203,7 @@ void AudioStreamPlaybackOGGVorbis::stop() {
//_clear();
}
-float AudioStreamPlaybackOGGVorbis::get_pos() const {
+float AudioStreamPlaybackOGGVorbis::get_position() const {
int32_t frames = int32_t(frames_mixed);
if (frames < 0)
diff --git a/modules/vorbis/audio_stream_ogg_vorbis.h b/modules/vorbis/audio_stream_ogg_vorbis.h
index 03b3726b52..9f1d78850d 100644
--- a/modules/vorbis/audio_stream_ogg_vorbis.h
+++ b/modules/vorbis/audio_stream_ogg_vorbis.h
@@ -96,7 +96,7 @@ public:
virtual int get_loop_count() const;
- virtual float get_pos() const;
+ virtual float get_position() const;
virtual void seek_pos(float p_time);
virtual int get_channels() const { return stream_channels; }
diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp
index 0178ebab84..0b33ab6a70 100644
--- a/modules/webm/video_stream_webm.cpp
+++ b/modules/webm/video_stream_webm.cpp
@@ -59,7 +59,7 @@ public:
if (file) {
- if (file->get_pos() != (size_t)pos)
+ if (file->get_position() != (size_t)pos)
file->seek(pos);
if (file->get_buffer(buf, len) == len)
return 0;
@@ -204,7 +204,7 @@ float VideoStreamPlaybackWebm::get_length() const {
return 0.0f;
}
-float VideoStreamPlaybackWebm::get_pos() const {
+float VideoStreamPlaybackWebm::get_position() const {
return video_pos;
}
diff --git a/modules/webm/video_stream_webm.h b/modules/webm/video_stream_webm.h
index 9a331849be..36b0f02c5c 100644
--- a/modules/webm/video_stream_webm.h
+++ b/modules/webm/video_stream_webm.h
@@ -81,7 +81,7 @@ public:
virtual float get_length() const;
- virtual float get_pos() const;
+ virtual float get_position() const;
virtual void seek_pos(float p_time);
virtual void set_audio_track(int p_idx);
diff --git a/platform/android/AndroidManifest.xml.template b/platform/android/AndroidManifest.xml.template
index be5afb406a..9d8eb951c4 100644
--- a/platform/android/AndroidManifest.xml.template
+++ b/platform/android/AndroidManifest.xml.template
@@ -17,7 +17,7 @@
android:launchMode="singleTask"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize">
-
+
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
@@ -26,7 +26,7 @@
<service android:name="org.godotengine.godot.GodotDownloaderService" />
-
+
$$ADD_APPLICATION_CHUNKS$$
@@ -200,6 +200,6 @@ $$ADD_PERMISSION_CHUNKS$$
<uses-permission android:name="godot.custom.18"/>
<uses-permission android:name="godot.custom.19"/>
-<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="23"/>
-
-</manifest>
+<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="23"/>
+
+</manifest>
diff --git a/platform/android/SCsub b/platform/android/SCsub
index 87e7ee4747..e9a370869f 100644
--- a/platform/android/SCsub
+++ b/platform/android/SCsub
@@ -73,7 +73,7 @@ for x in env.android_gradle_plugins:
gradle_classpath = ""
for x in env.android_gradle_classpath:
gradle_classpath += "\t\tclasspath \"" + x + "\"\n"
-
+
gradle_res_dirs_text = ""
for x in env.android_res_dirs:
@@ -93,13 +93,13 @@ gradle_asset_dirs_text = ""
gradle_default_config_text = ""
-minSdk = 14
+minSdk = 18
targetSdk = 23
for x in env.android_default_config:
- if x.startswith("minSdkVersion") and int(x.split(" ")[-1]) < minSdk:
+ if x.startswith("minSdkVersion") and int(x.split(" ")[-1]) < minSdk:
x = "minSdkVersion " + str(minSdk)
- if x.startswith("targetSdkVersion") and int(x.split(" ")[-1]) > targetSdk:
+ if x.startswith("targetSdkVersion") and int(x.split(" ")[-1]) > targetSdk:
x = "targetSdkVersion " + str(targetSdk)
gradle_default_config_text += x + "\n\t\t"
diff --git a/platform/android/file_access_android.cpp b/platform/android/file_access_android.cpp
index f207b81b4b..c7b0d9afcd 100644
--- a/platform/android/file_access_android.cpp
+++ b/platform/android/file_access_android.cpp
@@ -95,7 +95,7 @@ void FileAccessAndroid::seek_end(int64_t p_position) {
pos = len + p_position;
}
-size_t FileAccessAndroid::get_pos() const {
+size_t FileAccessAndroid::get_position() const {
return pos;
}
diff --git a/platform/android/file_access_android.h b/platform/android/file_access_android.h
index c2ce2b0bfe..beccf494dd 100644
--- a/platform/android/file_access_android.h
+++ b/platform/android/file_access_android.h
@@ -53,7 +53,7 @@ public:
virtual void seek(size_t p_position); ///< seek to a given position
virtual void seek_end(int64_t p_position = 0); ///< seek from the end of file
- virtual size_t get_pos() const; ///< get position in the file
+ virtual size_t get_position() const; ///< get position in the file
virtual size_t get_len() const; ///< get size of the file
virtual bool eof_reached() const; ///< reading passed EOF
diff --git a/platform/android/file_access_jandroid.cpp b/platform/android/file_access_jandroid.cpp
index ad855c790d..fe934c89fb 100644
--- a/platform/android/file_access_jandroid.cpp
+++ b/platform/android/file_access_jandroid.cpp
@@ -106,7 +106,7 @@ void FileAccessJAndroid::seek_end(int64_t p_position) {
seek(get_len());
}
-size_t FileAccessJAndroid::get_pos() const {
+size_t FileAccessJAndroid::get_position() const {
JNIEnv *env = ThreadAndroid::get_env();
ERR_FAIL_COND_V(!is_open(), 0);
diff --git a/platform/android/file_access_jandroid.h b/platform/android/file_access_jandroid.h
index 8060312182..75a6a21335 100644
--- a/platform/android/file_access_jandroid.h
+++ b/platform/android/file_access_jandroid.h
@@ -57,7 +57,7 @@ public:
virtual void seek(size_t p_position); ///< seek to a given position
virtual void seek_end(int64_t p_position = 0); ///< seek from the end of file
- virtual size_t get_pos() const; ///< get position in the file
+ virtual size_t get_position() const; ///< get position in the file
virtual size_t get_len() const; ///< get size of the file
virtual bool eof_reached() const; ///< reading passed EOF
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 1de2608b9e..dbea2d7531 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -137,12 +137,7 @@ void OS_Android::initialize(const VideoMode &p_desired, int p_video_driver, int
visual_server->init();
// visual_server->cursor_set_visible(false, 0);
- AudioDriverManager::get_driver(p_audio_driver)->set_singleton();
-
- if (AudioDriverManager::get_driver(p_audio_driver)->init() != OK) {
-
- ERR_PRINT("Initializing audio failed.");
- }
+ AudioDriverManager::initialize(p_audio_driver);
physics_server = memnew(PhysicsServerSW);
physics_server->init();
diff --git a/platform/haiku/detect.py b/platform/haiku/detect.py
index c0e003a3d2..61ee32d2dd 100644
--- a/platform/haiku/detect.py
+++ b/platform/haiku/detect.py
@@ -21,7 +21,7 @@ def can_build():
def get_opts():
return [
- ('debug_release', 'Add debug symbols to release version', 'no')
+ ('debug_symbols', 'Add debug symbols to release version (yes/no/full)', 'yes')
]
@@ -36,16 +36,21 @@ def configure(env):
## Build type
if (env["target"] == "release"):
- if (env["debug_release"] == "yes"):
+ env.Prepend(CCFLAGS=['-O3', '-ffast-math'])
+ if (env["debug_symbols"] == "yes"):
+ env.Prepend(CCFLAGS=['-g1'])
+ if (env["debug_symbols"] == "full"):
env.Prepend(CCFLAGS=['-g2'])
- else:
- env.Prepend(CCFLAGS=['-O3', '-ffast-math'])
elif (env["target"] == "release_debug"):
env.Prepend(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
+ if (env["debug_symbols"] == "yes"):
+ env.Prepend(CCFLAGS=['-g1'])
+ if (env["debug_symbols"] == "full"):
+ env.Prepend(CCFLAGS=['-g2'])
elif (env["target"] == "debug"):
- env.Prepend(CCFLAGS=['-g2', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
+ env.Prepend(CCFLAGS=['-g3', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
## Architecture
diff --git a/platform/haiku/haiku_direct_window.cpp b/platform/haiku/haiku_direct_window.cpp
index 572df493ff..24a8a4b17b 100644
--- a/platform/haiku/haiku_direct_window.cpp
+++ b/platform/haiku/haiku_direct_window.cpp
@@ -157,8 +157,8 @@ void HaikuDirectWindow::HandleMouseButton(BMessage *message) {
mouse_event.mouse_button.mod = GetKeyModifierState(modifiers);
mouse_event->get_button_mask() = GetMouseButtonState(buttons);
- mouse_event->get_pos().x = where.x;
- mouse_event->get_pos().y = where.y;
+ mouse_event->get_position().x = where.x;
+ mouse_event->get_position().y = where.y;
mouse_event.mouse_button.global_x = where.x;
mouse_event.mouse_button.global_y = where.y;
@@ -242,8 +242,8 @@ void HaikuDirectWindow::HandleMouseWheelChanged(BMessage *message) {
mouse_event->get_button_index() = wheel_delta_y < 0 ? 4 : 5;
mouse_event.mouse_button.mod = GetKeyModifierState(last_key_modifier_state);
mouse_event->get_button_mask() = last_button_mask;
- mouse_event->get_pos().x = last_mouse_position.x;
- mouse_event->get_pos().y = last_mouse_position.y;
+ mouse_event->get_position().x = last_mouse_position.x;
+ mouse_event->get_position().y = last_mouse_position.y;
mouse_event.mouse_button.global_x = last_mouse_position.x;
mouse_event.mouse_button.global_y = last_mouse_position.y;
diff --git a/platform/haiku/os_haiku.cpp b/platform/haiku/os_haiku.cpp
index de2f79a0ac..9f2f88bb4e 100644
--- a/platform/haiku/os_haiku.cpp
+++ b/platform/haiku/os_haiku.cpp
@@ -137,11 +137,7 @@ void OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p_
//physics_2d_server = Physics2DServerWrapMT::init_server<Physics2DServerSW>();
physics_2d_server->init();
- AudioDriverManager::get_driver(p_audio_driver)->set_singleton();
-
- if (AudioDriverManager::get_driver(p_audio_driver)->init() != OK) {
- ERR_PRINT("Initializing audio failed.");
- }
+ AudioDriverManager::initialize(p_audio_driver);
power_manager = memnew(PowerHaiku);
}
diff --git a/platform/iphone/game_center.mm b/platform/iphone/game_center.mm
index c05bdea005..821ef2a3ab 100644
--- a/platform/iphone/game_center.mm
+++ b/platform/iphone/game_center.mm
@@ -89,6 +89,7 @@ Error GameCenter::connect() {
ret["type"] = "authentication";
if (player.isAuthenticated) {
ret["result"] = "ok";
+ ret["player_id"] = player.playerID;
GameCenter::get_singleton()->connected = true;
} else {
ret["result"] = "error";
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index 543d028576..f103035b27 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -172,14 +172,14 @@ static EM_BOOL _mousebutton_callback(int event_type, const EmscriptenMouseEvent
if (!is_canvas_focused()) {
focus_canvas();
}
- mask |= 1 << ev->get_button_index();
- } else if (mask & (1 << ev->get_button_index())) {
- mask &= ~(1 << ev->get_button_index());
+ mask |= ev->get_button_index();
+ } else if (mask & ev->get_button_index()) {
+ mask &= ~ev->get_button_index();
} else {
// release event, but press was outside the canvas, so ignore
return false;
}
- ev->set_button_mask(mask >> 1);
+ ev->set_button_mask(mask);
_input->parse_input_event(ev);
// prevent selection dragging
@@ -200,7 +200,7 @@ static EM_BOOL _mousemove_callback(int event_type, const EmscriptenMouseEvent *m
Ref<InputEventMouseMotion> ev;
ev.instance();
dom2godot_mod(mouse_event, ev);
- ev->set_button_mask(input_mask >> 1);
+ ev->set_button_mask(input_mask);
ev->set_position(pos);
ev->set_global_position(ev->get_position());
@@ -227,7 +227,7 @@ static EM_BOOL _wheel_callback(int event_type, const EmscriptenWheelEvent *wheel
Ref<InputEventMouseButton> ev;
ev.instance();
- ev->set_button_mask(_input->get_mouse_button_mask() >> 1);
+ ev->set_button_mask(_input->get_mouse_button_mask());
ev->set_position(_input->get_mouse_position());
ev->set_global_position(ev->get_position());
@@ -291,7 +291,7 @@ static EM_BOOL _touchpress_callback(int event_type, const EmscriptenTouchEvent *
Ref<InputEventMouseButton> ev_mouse;
ev_mouse.instance();
- ev_mouse->set_button_mask(_input->get_mouse_button_mask() >> 1);
+ ev_mouse->set_button_mask(_input->get_mouse_button_mask());
dom2godot_mod(touch_event, ev_mouse);
const EmscriptenTouchPoint &first_touch = touch_event->touches[lowest_id_index];
@@ -334,7 +334,7 @@ static EM_BOOL _touchmove_callback(int event_type, const EmscriptenTouchEvent *t
Ref<InputEventMouseMotion> ev_mouse;
ev_mouse.instance();
dom2godot_mod(touch_event, ev_mouse);
- ev_mouse->set_button_mask(_input->get_mouse_button_mask() >> 1);
+ ev_mouse->set_button_mask(_input->get_mouse_button_mask());
const EmscriptenTouchPoint &first_touch = touch_event->touches[lowest_id_index];
ev_mouse->set_position(Point2(first_touch.canvasX, first_touch.canvasY));
@@ -464,11 +464,7 @@ void OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver, i
print_line("Init Audio");
AudioDriverManager::add_driver(&audio_driver_javascript);
- audio_driver_javascript.set_singleton();
- if (audio_driver_javascript.init() != OK) {
-
- ERR_PRINT("Initializing audio failed.");
- }
+ AudioDriverManager::initialize(p_audio_driver);
RasterizerGLES3::register_config();
RasterizerGLES3::make_current();
diff --git a/platform/osx/SCsub b/platform/osx/SCsub
index 5b2de54535..27bffbe80e 100644
--- a/platform/osx/SCsub
+++ b/platform/osx/SCsub
@@ -1,7 +1,11 @@
#!/usr/bin/env python
+import os
Import('env')
+def make_debug(target, source, env):
+ os.system('dsymutil %s -o %s.dSYM' % (target[0], target[0]))
+
files = [
'crash_handler_osx.mm',
'os_osx.mm',
@@ -13,8 +17,7 @@ files = [
'power_osx.cpp',
]
-prog = env.Program('#bin/godot', files)
-if (env['target'] == "debug" or env['target'] == "release_debug"):
- # Build the .dSYM file for atos
- action = "dsymutil " + File(prog)[0].path + " -o " + File(prog)[0].path + ".dSYM"
- env.AddPostAction(prog, action)
+binary = env.Program('#bin/godot', files)
+if env["debug_symbols"] == "full" or env["debug_symbols"] == "yes":
+ env.AddPostAction(binary, make_debug)
+
diff --git a/platform/osx/crash_handler_osx.mm b/platform/osx/crash_handler_osx.mm
index 9239573734..2ed88db309 100644
--- a/platform/osx/crash_handler_osx.mm
+++ b/platform/osx/crash_handler_osx.mm
@@ -43,6 +43,7 @@
#include <dlfcn.h>
#include <execinfo.h>
#include <signal.h>
+#include <stdlib.h>
#include <mach-o/dyld.h>
#include <mach-o/getsect.h>
@@ -77,7 +78,7 @@ static void handle_crash(int sig) {
void *bt_buffer[256];
size_t size = backtrace(bt_buffer, 256);
String _execpath = OS::get_singleton()->get_executable_path();
- String msg = GLOBAL_GET("debug/settings/backtrace/message");
+ String msg = GLOBAL_GET("debug/settings/crash_handler/message");
// Dump the backtrace to stderr with a message to the user
fprintf(stderr, "%s: Program crashed with signal %d\n", __FUNCTION__, sig);
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index d3ebdfe992..24302b5ff9 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -22,6 +22,7 @@ def get_opts():
return [
('osxcross_sdk', 'OSXCross SDK version', 'darwin14'),
+ ('debug_symbols', 'Add debug symbols to release version (yes/no/full)', 'yes'),
]
@@ -36,10 +37,18 @@ def configure(env):
## Build type
if (env["target"] == "release"):
- env.Prepend(CCFLAGS=['-O2', '-ffast-math', '-fomit-frame-pointer', '-ftree-vectorize', '-msse2'])
+ env.Prepend(CCFLAGS=['-O3', '-ffast-math', '-fomit-frame-pointer', '-ftree-vectorize', '-msse2'])
+ if (env["debug_symbols"] == "yes"):
+ env.Prepend(CCFLAGS=['-g1'])
+ if (env["debug_symbols"] == "full"):
+ env.Prepend(CCFLAGS=['-g2'])
elif (env["target"] == "release_debug"):
env.Prepend(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
+ if (env["debug_symbols"] == "yes"):
+ env.Prepend(CCFLAGS=['-g1'])
+ if (env["debug_symbols"] == "full"):
+ env.Prepend(CCFLAGS=['-g2'])
elif (env["target"] == "debug"):
env.Prepend(CCFLAGS=['-g3', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index 059dd5afd0..c6a9aeba88 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -152,7 +152,7 @@ public:
virtual void set_mouse_show(bool p_show);
virtual void set_mouse_grab(bool p_grab);
virtual bool is_mouse_grab_enabled() const;
- virtual void warp_mouse_pos(const Point2 &p_to);
+ virtual void warp_mouse_position(const Point2 &p_to);
virtual Point2 get_mouse_position() const;
virtual int get_mouse_button_state() const;
virtual void set_window_title(const String &p_title);
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 5a23d76755..da7321d72a 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -1088,12 +1088,7 @@ void OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
visual_server->init();
// visual_server->cursor_set_visible(false, 0);
- AudioDriverManager::get_driver(p_audio_driver)->set_singleton();
-
- if (AudioDriverManager::get_driver(p_audio_driver)->init() != OK) {
-
- ERR_PRINT("Initializing audio failed.");
- }
+ AudioDriverManager::initialize(p_audio_driver);
//
physics_server = memnew(PhysicsServerSW);
@@ -1245,7 +1240,7 @@ bool OS_OSX::is_mouse_grab_enabled() const {
return mouse_grab;
}
-void OS_OSX::warp_mouse_pos(const Point2 &p_to) {
+void OS_OSX::warp_mouse_position(const Point2 &p_to) {
//copied from windows impl with osx native calls
if (mouse_mode == MOUSE_MODE_CAPTURED) {
diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp
index e2bb464e76..300c5cffcc 100644
--- a/platform/server/os_server.cpp
+++ b/platform/server/os_server.cpp
@@ -62,12 +62,7 @@ void OS_Server::initialize(const VideoMode &p_desired, int p_video_driver, int p
//visual_server = memnew( VisualServerRaster(rasterizer) );
- AudioDriverManager::get_driver(p_audio_driver)->set_singleton();
-
- if (AudioDriverManager::get_driver(p_audio_driver)->init() != OK) {
-
- ERR_PRINT("Initializing audio failed.");
- }
+ AudioDriverManager::initialize(p_audio_driver);
sample_manager = memnew(SampleManagerMallocSW);
audio_server = memnew(AudioServerSW(sample_manager));
@@ -232,7 +227,6 @@ void OS_Server::run() {
OS_Server::OS_Server() {
- AudioDriverManager::add_driver(&driver_dummy);
//adriver here
grab = false;
};
diff --git a/platform/server/os_server.h b/platform/server/os_server.h
index 8c0ca1a58d..ba12f649be 100644
--- a/platform/server/os_server.h
+++ b/platform/server/os_server.h
@@ -34,7 +34,6 @@
#include "drivers/rtaudio/audio_driver_rtaudio.h"
#include "drivers/unix/os_unix.h"
#include "main/input_default.h"
-#include "servers/audio/audio_driver_dummy.h"
#include "servers/audio_server.h"
#include "servers/physics_2d/physics_2d_server_sw.h"
#include "servers/physics_server.h"
@@ -55,7 +54,6 @@ class OS_Server : public OS_Unix {
List<String> args;
MainLoop *main_loop;
- AudioDriverDummy driver_dummy;
bool grab;
PhysicsServer *physics_server;
diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp
index 25d44c24b5..d66bcaa91c 100644
--- a/platform/uwp/export/export.cpp
+++ b/platform/uwp/export/export.cpp
@@ -471,7 +471,7 @@ void AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t
meta.uncompressed_size = p_len;
meta.compressed_size = p_len;
meta.compressed = p_compress;
- meta.zip_offset = package->get_pos();
+ meta.zip_offset = package->get_position();
Vector<uint8_t> file_buffer;
@@ -619,11 +619,11 @@ void AppxPackager::finish() {
// Write central directory
EditorNode::progress_task_step("export", "Finishing package...", 6);
- central_dir_offset = package->get_pos();
+ central_dir_offset = package->get_position();
package->store_buffer(central_dir_data.ptr(), central_dir_data.size());
// End record
- end_of_central_dir_offset = package->get_pos();
+ end_of_central_dir_offset = package->get_position();
Vector<uint8_t> end_record = make_end_of_central_record();
package->store_buffer(end_record.ptr(), end_record.size());
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index fd8904fa0a..b909ccccd6 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -268,12 +268,7 @@ void OSUWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_aud
joypad = ref new JoypadUWP(input);
joypad->register_events();
- AudioDriverManager::get_driver(p_audio_driver)->set_singleton();
-
- if (AudioDriverManager::get_driver(p_audio_driver)->init() != OK) {
-
- ERR_PRINT("Initializing audio failed.");
- }
+ AudioDriverManager::initialize(p_audio_driver);
power_manager = memnew(PowerUWP);
diff --git a/platform/windows/SCsub b/platform/windows/SCsub
index b56a5c6a80..fd041e096e 100644
--- a/platform/windows/SCsub
+++ b/platform/windows/SCsub
@@ -1,7 +1,12 @@
#!/usr/bin/env python
+import os
Import('env')
+def make_debug_mingw(target, source, env):
+ os.system('objcopy --only-keep-debug %s %s.debug' % (target[0], target[0]))
+ os.system('strip --strip-debug --strip-unneeded %s' % (target[0]))
+ os.system('objcopy --add-gnu-debuglink=%s.debug %s' % (target[0], target[0]))
common_win = [
"context_gl_win.cpp",
@@ -22,10 +27,14 @@ obj = env.RES(restarget, 'godot_res.rc')
common_win.append(obj)
-env.Program('#bin/godot', ['godot_win.cpp'] + common_win, PROGSUFFIX=env["PROGSUFFIX"])
+binary = env.Program('#bin/godot', ['godot_win.cpp'] + common_win, PROGSUFFIX=env["PROGSUFFIX"])
# Microsoft Visual Studio Project Generation
if (env['vsproj']) == "yes":
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)]
+
+if not os.getenv("VCINSTALLDIR"):
+ if env["debug_symbols"] == "full" or env["debug_symbols"] == "yes":
+ env.AddPostAction(binary, make_debug_mingw)
diff --git a/platform/windows/crash_handler_win.cpp b/platform/windows/crash_handler_win.cpp
index c9385f36d6..2f5ee7956e 100644
--- a/platform/windows/crash_handler_win.cpp
+++ b/platform/windows/crash_handler_win.cpp
@@ -116,7 +116,7 @@ DWORD CrashHandlerException(EXCEPTION_POINTERS *ep) {
DWORD cbNeeded;
std::vector<HMODULE> module_handles(1);
- if (OS::get_singleton() == NULL || OS::get_singleton()->is_disable_crash_handler()) {
+ if (OS::get_singleton() == NULL || OS::get_singleton()->is_disable_crash_handler() || IsDebuggerPresent()) {
return EXCEPTION_CONTINUE_SEARCH;
}
@@ -159,7 +159,7 @@ DWORD CrashHandlerException(EXCEPTION_POINTERS *ep) {
IMAGE_NT_HEADERS *h = ImageNtHeader(base);
DWORD image_type = h->FileHeader.Machine;
int n = 0;
- String msg = GLOBAL_GET("debug/settings/backtrace/message");
+ String msg = GLOBAL_GET("debug/settings/crash_handler/message");
fprintf(stderr, "Dumping the backtrace. %ls\n", msg.c_str());
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 5bd9a78f49..65eb51a2f3 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -64,6 +64,7 @@ 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')
]
@@ -213,11 +214,20 @@ def configure(env):
env.Append(LINKFLAGS=['-Wl,--subsystem,windows'])
+ if (env["debug_symbols"] == "yes"):
+ env.Prepend(CCFLAGS=['-g1'])
+ if (env["debug_symbols"] == "full"):
+ env.Prepend(CCFLAGS=['-g2'])
+
elif (env["target"] == "release_debug"):
env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
+ if (env["debug_symbols"] == "yes"):
+ env.Prepend(CCFLAGS=['-g1'])
+ if (env["debug_symbols"] == "full"):
+ env.Prepend(CCFLAGS=['-g2'])
elif (env["target"] == "debug"):
- env.Append(CCFLAGS=['-g', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
+ env.Append(CCFLAGS=['-g3', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
## Compiler configuration
diff --git a/platform/windows/godot_win.cpp b/platform/windows/godot_win.cpp
index 4450cb3670..cff2cbad42 100644
--- a/platform/windows/godot_win.cpp
+++ b/platform/windows/godot_win.cpp
@@ -156,32 +156,36 @@ int widechar_main(int argc, wchar_t **argv) {
return os.get_exit_code();
};
-int main(int _argc, char **_argv) {
-// _argc and _argv are ignored
-// we are going to use the WideChar version of them instead
+int _main() {
+ LPWSTR *wc_argv;
+ int argc;
+ int result;
-#ifdef CRASH_HANDLER_EXCEPTION
- __try {
-#endif
- LPWSTR *wc_argv;
- int argc;
- int result;
+ wc_argv = CommandLineToArgvW(GetCommandLineW(), &argc);
+
+ if (NULL == wc_argv) {
+ wprintf(L"CommandLineToArgvW failed\n");
+ return 0;
+ }
- wc_argv = CommandLineToArgvW(GetCommandLineW(), &argc);
+ result = widechar_main(argc, wc_argv);
- if (NULL == wc_argv) {
- wprintf(L"CommandLineToArgvW failed\n");
- return 0;
- }
+ LocalFree(wc_argv);
+ return result;
+}
- result = widechar_main(argc, wc_argv);
+int main(int _argc, char **_argv) {
+// _argc and _argv are ignored
+// we are going to use the WideChar version of them instead
- LocalFree(wc_argv);
- return result;
#ifdef CRASH_HANDLER_EXCEPTION
+ __try {
+ return _main();
} __except (CrashHandlerException(GetExceptionInformation())) {
return 1;
}
+#else
+ return _main();
#endif
}
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 62954e1a56..db7cd0b938 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -1081,12 +1081,7 @@ void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
power_manager = memnew(PowerWindows);
- AudioDriverManager::get_driver(p_audio_driver)->set_singleton();
-
- if (AudioDriverManager::get_driver(p_audio_driver)->init() != OK) {
-
- ERR_PRINT("Initializing audio failed.");
- }
+ AudioDriverManager::initialize(p_audio_driver);
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(TRACKMOUSEEVENT);
@@ -1309,7 +1304,7 @@ OS_Windows::MouseMode OS_Windows::get_mouse_mode() const {
return mouse_mode;
}
-void OS_Windows::warp_mouse_pos(const Point2 &p_to) {
+void OS_Windows::warp_mouse_position(const Point2 &p_to) {
if (mouse_mode == MOUSE_MODE_CAPTURED) {
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 1a01ac950d..8a955aa224 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -189,7 +189,7 @@ public:
void set_mouse_mode(MouseMode p_mode);
MouseMode get_mouse_mode() const;
- virtual void warp_mouse_pos(const Point2 &p_to);
+ virtual void warp_mouse_position(const Point2 &p_to);
virtual Point2 get_mouse_position() const;
virtual int get_mouse_button_state() const;
virtual void set_window_title(const String &p_title);
diff --git a/platform/x11/SCsub b/platform/x11/SCsub
index 62717f3221..aabc49149f 100644
--- a/platform/x11/SCsub
+++ b/platform/x11/SCsub
@@ -1,7 +1,12 @@
#!/usr/bin/env python
+import os
Import('env')
+def make_debug(target, source, env):
+ os.system('objcopy --only-keep-debug %s %s.debug' % (target[0], target[0]))
+ os.system('strip --strip-debug --strip-unneeded %s' % (target[0]))
+ os.system('objcopy --add-gnu-debuglink=%s.debug %s' % (target[0], target[0]))
common_x11 = [
"context_gl_x11.cpp",
@@ -12,4 +17,6 @@ common_x11 = [
"power_x11.cpp",
]
-env.Program('#bin/godot', ['godot_x11.cpp'] + common_x11)
+binary = env.Program('#bin/godot', ['godot_x11.cpp'] + common_x11)
+if env["debug_symbols"] == "full" or env["debug_symbols"] == "yes":
+ env.AddPostAction(binary, make_debug)
diff --git a/platform/x11/crash_handler_x11.cpp b/platform/x11/crash_handler_x11.cpp
index c926b7799d..3c54d5cbc2 100644
--- a/platform/x11/crash_handler_x11.cpp
+++ b/platform/x11/crash_handler_x11.cpp
@@ -39,6 +39,7 @@
#include <dlfcn.h>
#include <execinfo.h>
#include <signal.h>
+#include <stdlib.h>
static void handle_crash(int sig) {
if (OS::get_singleton() == NULL)
@@ -47,7 +48,7 @@ static void handle_crash(int sig) {
void *bt_buffer[256];
size_t size = backtrace(bt_buffer, 256);
String _execpath = OS::get_singleton()->get_executable_path();
- String msg = GLOBAL_GET("debug/settings/backtrace/message");
+ String msg = GLOBAL_GET("debug/settings/crash_handler/message");
// Dump the backtrace to stderr with a message to the user
fprintf(stderr, "%s: Program crashed with signal %d\n", __FUNCTION__, sig);
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index d61175da60..efd388e44f 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -44,7 +44,6 @@ def can_build():
return True
-
def get_opts():
return [
@@ -55,7 +54,7 @@ def get_opts():
('use_lto', 'Use link time optimization', 'no'),
('pulseaudio', 'Detect & use pulseaudio', 'yes'),
('udev', 'Use udev for gamepad connection callbacks', 'no'),
- ('debug_release', 'Add debug symbols to release version', 'no'),
+ ('debug_symbols', 'Add debug symbols to release version (yes/no/full)', 'yes')
]
@@ -77,16 +76,20 @@ def configure(env):
# -O3 -ffast-math is identical to -Ofast. We need to split it out so we can selectively disable
# -ffast-math in code for which it generates wrong results.
env.Prepend(CCFLAGS=['-O3', '-ffast-math'])
- if (env["debug_release"] == "yes"):
+ if (env["debug_symbols"] == "yes"):
+ env.Prepend(CCFLAGS=['-g1'])
+ if (env["debug_symbols"] == "full"):
env.Prepend(CCFLAGS=['-g2'])
elif (env["target"] == "release_debug"):
env.Prepend(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
- if (env["debug_release"] == "yes"):
+ if (env["debug_symbols"] == "yes"):
+ env.Prepend(CCFLAGS=['-g1'])
+ if (env["debug_symbols"] == "full"):
env.Prepend(CCFLAGS=['-g2'])
elif (env["target"] == "debug"):
- env.Prepend(CCFLAGS=['-g2', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
+ env.Prepend(CCFLAGS=['-g3', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
env.Append(LINKFLAGS=['-rdynamic'])
## Architecture
diff --git a/platform/x11/export/export.cpp b/platform/x11/export/export.cpp
index 59b1a44247..fdb43c9ae0 100644
--- a/platform/x11/export/export.cpp
+++ b/platform/x11/export/export.cpp
@@ -50,6 +50,7 @@ void register_x11_exporter() {
platform->set_release_64("linux_x11_64_release");
platform->set_debug_64("linux_x11_64_debug");
platform->set_os_name("X11");
+ platform->set_chmod_flags(0755);
EditorExport::get_singleton()->add_export_platform(platform);
}
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 4e78e0318c..599c0d2278 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -313,29 +313,7 @@ void OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
XFree(xsh);
}
- AudioDriverManager::get_driver(p_audio_driver)->set_singleton();
-
- audio_driver_index = p_audio_driver;
- if (AudioDriverManager::get_driver(p_audio_driver)->init() != OK) {
-
- bool success = false;
- audio_driver_index = -1;
- for (int i = 0; i < AudioDriverManager::get_driver_count(); i++) {
- if (i == p_audio_driver)
- continue;
- AudioDriverManager::get_driver(i)->set_singleton();
- if (AudioDriverManager::get_driver(i)->init() == OK) {
- success = true;
- print_line("Audio Driver Failed: " + String(AudioDriverManager::get_driver(p_audio_driver)->get_name()));
- print_line("Using alternate audio driver: " + String(AudioDriverManager::get_driver(i)->get_name()));
- audio_driver_index = i;
- break;
- }
- }
- if (!success) {
- ERR_PRINT("Initializing audio failed.");
- }
- }
+ AudioDriverManager::initialize(p_audio_driver);
ERR_FAIL_COND(!visual_server);
ERR_FAIL_COND(x11_window == 0);
@@ -635,7 +613,7 @@ void OS_X11::set_mouse_mode(MouseMode p_mode) {
XFlush(x11_display);
}
-void OS_X11::warp_mouse_pos(const Point2 &p_to) {
+void OS_X11::warp_mouse_position(const Point2 &p_to) {
if (mouse_mode == MOUSE_MODE_CAPTURED) {
@@ -730,6 +708,16 @@ void OS_X11::set_wm_fullscreen(bool p_enabled) {
XSetWMNormalHints(x11_display, x11_window, xsh);
XFree(xsh);
}
+
+ if (!p_enabled && !get_borderless_window()) {
+ // put decorations back if the window wasn't suppoesed to be borderless
+ Hints hints;
+ Atom property;
+ hints.flags = 2;
+ hints.decorations = 1;
+ property = XInternAtom(x11_display, "_MOTIF_WM_HINTS", True);
+ XChangeProperty(x11_display, x11_window, property, property, 32, PropModeReplace, (unsigned char *)&hints, 5);
+ }
}
int OS_X11::get_screen_count() const {
@@ -2189,10 +2177,6 @@ bool OS_X11::is_disable_crash_handler() const {
OS_X11::OS_X11() {
-#ifdef RTAUDIO_ENABLED
- AudioDriverManager::add_driver(&driver_rtaudio);
-#endif
-
#ifdef PULSEAUDIO_ENABLED
AudioDriverManager::add_driver(&driver_pulseaudio);
#endif
@@ -2201,11 +2185,6 @@ OS_X11::OS_X11() {
AudioDriverManager::add_driver(&driver_alsa);
#endif
- if (AudioDriverManager::get_driver_count() == 0) {
- WARN_PRINT("No sound driver found... Defaulting to dummy driver");
- AudioDriverManager::add_driver(&driver_dummy);
- }
-
minimized = false;
xim_style = 0L;
mouse_mode = MOUSE_MODE_VISIBLE;
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index 2ba7f07cef..a0338dacf1 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -38,11 +38,9 @@
//#include "servers/visual/visual_server_wrap_mt.h"
#include "drivers/alsa/audio_driver_alsa.h"
#include "drivers/pulseaudio/audio_driver_pulseaudio.h"
-#include "drivers/rtaudio/audio_driver_rtaudio.h"
#include "joypad_linux.h"
#include "main/input_default.h"
#include "power_x11.h"
-#include "servers/audio/audio_driver_dummy.h"
#include "servers/audio_server.h"
#include "servers/physics_2d/physics_2d_server_sw.h"
#include "servers/physics_2d/physics_2d_server_wrap_mt.h"
@@ -154,10 +152,6 @@ class OS_X11 : public OS_Unix {
JoypadLinux *joypad;
#endif
-#ifdef RTAUDIO_ENABLED
- AudioDriverRtAudio driver_rtaudio;
-#endif
-
#ifdef ALSA_ENABLED
AudioDriverALSA driver_alsa;
#endif
@@ -165,7 +159,6 @@ class OS_X11 : public OS_Unix {
#ifdef PULSEAUDIO_ENABLED
AudioDriverPulseAudio driver_pulseaudio;
#endif
- AudioDriverDummy driver_dummy;
Atom net_wm_icon;
@@ -208,7 +201,7 @@ public:
void set_mouse_mode(MouseMode p_mode);
MouseMode get_mouse_mode() const;
- virtual void warp_mouse_pos(const Point2 &p_to);
+ virtual void warp_mouse_position(const Point2 &p_to);
virtual Point2 get_mouse_position() const;
virtual int get_mouse_button_state() const;
virtual void set_window_title(const String &p_title);
diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp
index 26241df660..c2edb173d7 100644
--- a/scene/2d/animated_sprite.cpp
+++ b/scene/2d/animated_sprite.cpp
@@ -223,7 +223,7 @@ void SpriteFrames::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_animation_loop", "anim", "loop"), &SpriteFrames::set_animation_loop);
ClassDB::bind_method(D_METHOD("get_animation_loop", "anim"), &SpriteFrames::get_animation_loop);
- ClassDB::bind_method(D_METHOD("add_frame", "anim", "frame", "atpos"), &SpriteFrames::add_frame, DEFVAL(-1));
+ ClassDB::bind_method(D_METHOD("add_frame", "anim", "frame", "at_position"), &SpriteFrames::add_frame, DEFVAL(-1));
ClassDB::bind_method(D_METHOD("get_frame_count", "anim"), &SpriteFrames::get_frame_count);
ClassDB::bind_method(D_METHOD("get_frame", "anim", "idx"), &SpriteFrames::get_frame);
ClassDB::bind_method(D_METHOD("set_frame", "anim", "idx", "txt"), &SpriteFrames::set_frame);
diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp
index b6abe90035..4b108996f0 100644
--- a/scene/2d/audio_stream_player_2d.cpp
+++ b/scene/2d/audio_stream_player_2d.cpp
@@ -284,10 +284,10 @@ bool AudioStreamPlayer2D::is_playing() const {
return false;
}
-float AudioStreamPlayer2D::get_pos() {
+float AudioStreamPlayer2D::get_position() {
if (stream_playback.is_valid()) {
- return stream_playback->get_pos();
+ return stream_playback->get_position();
}
return 0;
@@ -390,12 +390,12 @@ void AudioStreamPlayer2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_volume_db", "volume_db"), &AudioStreamPlayer2D::set_volume_db);
ClassDB::bind_method(D_METHOD("get_volume_db"), &AudioStreamPlayer2D::get_volume_db);
- ClassDB::bind_method(D_METHOD("play", "from_pos"), &AudioStreamPlayer2D::play, DEFVAL(0.0));
- ClassDB::bind_method(D_METHOD("seek", "to_pos"), &AudioStreamPlayer2D::seek);
+ ClassDB::bind_method(D_METHOD("play", "from_position"), &AudioStreamPlayer2D::play, DEFVAL(0.0));
+ ClassDB::bind_method(D_METHOD("seek", "to_position"), &AudioStreamPlayer2D::seek);
ClassDB::bind_method(D_METHOD("stop"), &AudioStreamPlayer2D::stop);
ClassDB::bind_method(D_METHOD("is_playing"), &AudioStreamPlayer2D::is_playing);
- ClassDB::bind_method(D_METHOD("get_pos"), &AudioStreamPlayer2D::get_pos);
+ ClassDB::bind_method(D_METHOD("get_position"), &AudioStreamPlayer2D::get_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 25eff61b76..112d05856b 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_pos();
+ float get_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 e39e6fc6da..0d04967f1c 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -452,7 +452,7 @@ float Camera2D::get_drag_margin(Margin p_margin) const {
return drag_margin[p_margin];
}
-Vector2 Camera2D::get_camera_pos() const {
+Vector2 Camera2D::get_camera_position() const {
return camera_pos;
}
@@ -673,7 +673,7 @@ void Camera2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_drag_margin", "margin", "drag_margin"), &Camera2D::set_drag_margin);
ClassDB::bind_method(D_METHOD("get_drag_margin", "margin"), &Camera2D::get_drag_margin);
- ClassDB::bind_method(D_METHOD("get_camera_pos"), &Camera2D::get_camera_pos);
+ ClassDB::bind_method(D_METHOD("get_camera_position"), &Camera2D::get_camera_position);
ClassDB::bind_method(D_METHOD("get_camera_screen_center"), &Camera2D::get_camera_screen_center);
ClassDB::bind_method(D_METHOD("set_zoom", "zoom"), &Camera2D::set_zoom);
diff --git a/scene/2d/camera_2d.h b/scene/2d/camera_2d.h
index dfcadf65a6..13b6be3978 100644
--- a/scene/2d/camera_2d.h
+++ b/scene/2d/camera_2d.h
@@ -137,7 +137,7 @@ public:
void set_custom_viewport(Node *p_viewport);
Node *get_custom_viewport() const;
- Vector2 get_camera_pos() const;
+ Vector2 get_camera_position() const;
void force_update_scroll();
void reset_smoothing();
void align();
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index ec1ea7df38..d9bb6576d9 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -902,7 +902,7 @@ Ref<Material> CanvasItem::get_material() const {
return material;
}
-Vector2 CanvasItem::make_canvas_pos_local(const Vector2 &screen_point) const {
+Vector2 CanvasItem::make_canvas_position_local(const Vector2 &screen_point) const {
ERR_FAIL_COND_V(!is_inside_tree(), screen_point);
@@ -923,7 +923,8 @@ Vector2 CanvasItem::get_global_mouse_position() const {
ERR_FAIL_COND_V(!get_viewport(), Vector2());
return get_canvas_transform().affine_inverse().xform(get_viewport()->get_mouse_position());
}
-Vector2 CanvasItem::get_local_mouse_pos() const {
+
+Vector2 CanvasItem::get_local_mouse_position() const {
ERR_FAIL_COND_V(!get_viewport(), Vector2());
@@ -976,18 +977,18 @@ void CanvasItem::_bind_methods() {
ClassDB::bind_method(D_METHOD("draw_polyline", "points", "color", "width", "antialiased"), &CanvasItem::draw_polyline, DEFVAL(1.0), DEFVAL(false));
ClassDB::bind_method(D_METHOD("draw_polyline_colors", "points", "colors", "width", "antialiased"), &CanvasItem::draw_polyline_colors, DEFVAL(1.0), DEFVAL(false));
ClassDB::bind_method(D_METHOD("draw_rect", "rect", "color", "filled"), &CanvasItem::draw_rect, DEFVAL(true));
- ClassDB::bind_method(D_METHOD("draw_circle", "pos", "radius", "color"), &CanvasItem::draw_circle);
- ClassDB::bind_method(D_METHOD("draw_texture", "texture", "pos", "modulate", "normal_map"), &CanvasItem::draw_texture, DEFVAL(Color(1, 1, 1, 1)), DEFVAL(Variant()));
+ ClassDB::bind_method(D_METHOD("draw_circle", "position", "radius", "color"), &CanvasItem::draw_circle);
+ ClassDB::bind_method(D_METHOD("draw_texture", "texture", "position", "modulate", "normal_map"), &CanvasItem::draw_texture, DEFVAL(Color(1, 1, 1, 1)), DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("draw_texture_rect", "texture", "rect", "tile", "modulate", "transpose", "normal_map"), &CanvasItem::draw_texture_rect, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("draw_texture_rect_region", "texture", "rect", "src_rect", "modulate", "transpose", "normal_map", "clip_uv"), &CanvasItem::draw_texture_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(true));
ClassDB::bind_method(D_METHOD("draw_style_box", "style_box", "rect"), &CanvasItem::draw_style_box);
ClassDB::bind_method(D_METHOD("draw_primitive", "points", "colors", "uvs", "texture", "width", "normal_map"), &CanvasItem::draw_primitive, DEFVAL(Variant()), DEFVAL(1.0), DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("draw_polygon", "points", "colors", "uvs", "texture", "normal_map", "antialiased"), &CanvasItem::draw_polygon, DEFVAL(PoolVector2Array()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(false));
ClassDB::bind_method(D_METHOD("draw_colored_polygon", "points", "color", "uvs", "texture", "normal_map", "antialiased"), &CanvasItem::draw_colored_polygon, DEFVAL(PoolVector2Array()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(false));
- ClassDB::bind_method(D_METHOD("draw_string", "font", "pos", "text", "modulate", "clip_w"), &CanvasItem::draw_string, DEFVAL(Color(1, 1, 1)), DEFVAL(-1));
- ClassDB::bind_method(D_METHOD("draw_char", "font", "pos", "char", "next", "modulate"), &CanvasItem::draw_char, DEFVAL(Color(1, 1, 1)));
+ ClassDB::bind_method(D_METHOD("draw_string", "font", "position", "text", "modulate", "clip_w"), &CanvasItem::draw_string, DEFVAL(Color(1, 1, 1)), DEFVAL(-1));
+ ClassDB::bind_method(D_METHOD("draw_char", "font", "position", "char", "next", "modulate"), &CanvasItem::draw_char, DEFVAL(Color(1, 1, 1)));
- ClassDB::bind_method(D_METHOD("draw_set_transform", "pos", "rot", "scale"), &CanvasItem::draw_set_transform);
+ ClassDB::bind_method(D_METHOD("draw_set_transform", "position", "rotation", "scale"), &CanvasItem::draw_set_transform);
ClassDB::bind_method(D_METHOD("draw_set_transform_matrix", "xform"), &CanvasItem::draw_set_transform_matrix);
ClassDB::bind_method(D_METHOD("get_transform"), &CanvasItem::get_transform);
ClassDB::bind_method(D_METHOD("get_global_transform"), &CanvasItem::get_global_transform);
@@ -995,7 +996,7 @@ void CanvasItem::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_viewport_transform"), &CanvasItem::get_viewport_transform);
ClassDB::bind_method(D_METHOD("get_viewport_rect"), &CanvasItem::get_viewport_rect);
ClassDB::bind_method(D_METHOD("get_canvas_transform"), &CanvasItem::get_canvas_transform);
- ClassDB::bind_method(D_METHOD("get_local_mouse_pos"), &CanvasItem::get_local_mouse_pos);
+ ClassDB::bind_method(D_METHOD("get_local_mouse_position"), &CanvasItem::get_local_mouse_position);
ClassDB::bind_method(D_METHOD("get_global_mouse_position"), &CanvasItem::get_global_mouse_position);
ClassDB::bind_method(D_METHOD("get_canvas"), &CanvasItem::get_canvas);
ClassDB::bind_method(D_METHOD("get_world_2d"), &CanvasItem::get_world_2d);
@@ -1013,8 +1014,7 @@ void CanvasItem::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_notify_transform", "enable"), &CanvasItem::set_notify_transform);
ClassDB::bind_method(D_METHOD("is_transform_notification_enabled"), &CanvasItem::is_transform_notification_enabled);
- ClassDB::bind_method(D_METHOD("make_canvas_pos_local", "screen_point"),
- &CanvasItem::make_canvas_pos_local);
+ ClassDB::bind_method(D_METHOD("make_canvas_position_local", "screen_point"), &CanvasItem::make_canvas_position_local);
ClassDB::bind_method(D_METHOD("make_input_local", "event"), &CanvasItem::make_input_local);
BIND_VMETHOD(MethodInfo("_draw"));
diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h
index 5a0a9c6e6a..1afbd150a2 100644
--- a/scene/2d/canvas_item.h
+++ b/scene/2d/canvas_item.h
@@ -298,10 +298,10 @@ public:
bool get_use_parent_material() const;
Ref<InputEvent> make_input_local(const Ref<InputEvent> &p_event) const;
- Vector2 make_canvas_pos_local(const Vector2 &screen_point) const;
+ Vector2 make_canvas_position_local(const Vector2 &screen_point) const;
Vector2 get_global_mouse_position() const;
- Vector2 get_local_mouse_pos() const;
+ Vector2 get_local_mouse_position() const;
void set_notify_local_transform(bool p_enable);
bool is_local_transform_notification_enabled() const;
diff --git a/scene/2d/line_2d.cpp b/scene/2d/line_2d.cpp
index d8cef5b937..9131223ff3 100644
--- a/scene/2d/line_2d.cpp
+++ b/scene/2d/line_2d.cpp
@@ -68,12 +68,12 @@ PoolVector<Vector2> Line2D::get_points() const {
return _points;
}
-void Line2D::set_point_pos(int i, Vector2 pos) {
+void Line2D::set_point_position(int i, Vector2 pos) {
_points.set(i, pos);
update();
}
-Vector2 Line2D::get_point_pos(int i) const {
+Vector2 Line2D::get_point_position(int i) const {
return _points.get(i);
}
@@ -270,12 +270,12 @@ void Line2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_points", "points"), &Line2D::set_points);
ClassDB::bind_method(D_METHOD("get_points"), &Line2D::get_points);
- ClassDB::bind_method(D_METHOD("set_point_pos", "i", "pos"), &Line2D::set_point_pos);
- ClassDB::bind_method(D_METHOD("get_point_pos", "i"), &Line2D::get_point_pos);
+ ClassDB::bind_method(D_METHOD("set_point_position", "i", "position"), &Line2D::set_point_position);
+ ClassDB::bind_method(D_METHOD("get_point_position", "i"), &Line2D::get_point_position);
ClassDB::bind_method(D_METHOD("get_point_count"), &Line2D::get_point_count);
- ClassDB::bind_method(D_METHOD("add_point", "pos"), &Line2D::add_point);
+ ClassDB::bind_method(D_METHOD("add_point", "position"), &Line2D::add_point);
ClassDB::bind_method(D_METHOD("remove_point", "i"), &Line2D::remove_point);
ClassDB::bind_method(D_METHOD("set_width", "width"), &Line2D::set_width);
diff --git a/scene/2d/line_2d.h b/scene/2d/line_2d.h
index 36aadfd265..6426484f02 100644
--- a/scene/2d/line_2d.h
+++ b/scene/2d/line_2d.h
@@ -60,8 +60,8 @@ public:
void set_points(const PoolVector<Vector2> &p_points);
PoolVector<Vector2> get_points() const;
- void set_point_pos(int i, Vector2 pos);
- Vector2 get_point_pos(int i) const;
+ void set_point_position(int i, Vector2 pos);
+ Vector2 get_point_position(int i) const;
int get_point_count() const;
diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp
index 0c7685a858..e62b59dd4d 100644
--- a/scene/2d/node_2d.cpp
+++ b/scene/2d/node_2d.cpp
@@ -414,7 +414,7 @@ void Node2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("_get_rotd"), &Node2D::_get_rotd);
ClassDB::bind_method(D_METHOD("_set_rotd", "degrees"), &Node2D::_set_rotd);
- ClassDB::bind_method(D_METHOD("set_position", "pos"), &Node2D::set_position);
+ ClassDB::bind_method(D_METHOD("set_position", "position"), &Node2D::set_position);
ClassDB::bind_method(D_METHOD("set_rotation", "radians"), &Node2D::set_rotation);
ClassDB::bind_method(D_METHOD("set_rotation_in_degrees", "degrees"), &Node2D::set_rotation_in_degrees);
ClassDB::bind_method(D_METHOD("set_scale", "scale"), &Node2D::set_scale);
@@ -431,7 +431,7 @@ void Node2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("global_translate", "offset"), &Node2D::global_translate);
ClassDB::bind_method(D_METHOD("apply_scale", "ratio"), &Node2D::apply_scale);
- ClassDB::bind_method(D_METHOD("set_global_position", "pos"), &Node2D::set_global_position);
+ ClassDB::bind_method(D_METHOD("set_global_position", "position"), &Node2D::set_global_position);
ClassDB::bind_method(D_METHOD("get_global_position"), &Node2D::get_global_position);
ClassDB::bind_method(D_METHOD("set_global_rotation", "radians"), &Node2D::set_global_rotation);
ClassDB::bind_method(D_METHOD("get_global_rotation"), &Node2D::get_global_rotation);
diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp
index 9bd5576d91..8413be1ca9 100644
--- a/scene/2d/path_2d.cpp
+++ b/scene/2d/path_2d.cpp
@@ -43,7 +43,7 @@ void Path2D::_notification(int p_what) {
for (int i = 0; i < curve->get_point_count(); i++) {
- Vector2 prev_p = curve->get_point_pos(i);
+ Vector2 prev_p = curve->get_point_position(i);
for (int j = 1; j <= 8; j++) {
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index b1cc8c226a..4286d88ab1 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -1294,9 +1294,9 @@ void TileMap::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_occluder_light_mask"), &TileMap::get_occluder_light_mask);
ClassDB::bind_method(D_METHOD("set_cell", "x", "y", "tile", "flip_x", "flip_y", "transpose"), &TileMap::set_cell, DEFVAL(false), DEFVAL(false), DEFVAL(false));
- ClassDB::bind_method(D_METHOD("set_cellv", "pos", "tile", "flip_x", "flip_y", "transpose"), &TileMap::set_cellv, DEFVAL(false), DEFVAL(false), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("set_cellv", "position", "tile", "flip_x", "flip_y", "transpose"), &TileMap::set_cellv, DEFVAL(false), DEFVAL(false), DEFVAL(false));
ClassDB::bind_method(D_METHOD("get_cell", "x", "y"), &TileMap::get_cell);
- ClassDB::bind_method(D_METHOD("get_cellv", "pos"), &TileMap::get_cellv);
+ ClassDB::bind_method(D_METHOD("get_cellv", "position"), &TileMap::get_cellv);
ClassDB::bind_method(D_METHOD("is_cell_x_flipped", "x", "y"), &TileMap::is_cell_x_flipped);
ClassDB::bind_method(D_METHOD("is_cell_y_flipped", "x", "y"), &TileMap::is_cell_y_flipped);
ClassDB::bind_method(D_METHOD("is_cell_transposed", "x", "y"), &TileMap::is_cell_transposed);
@@ -1307,8 +1307,8 @@ void TileMap::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_used_cells_by_id", "id"), &TileMap::get_used_cells_by_id);
ClassDB::bind_method(D_METHOD("get_used_rect"), &TileMap::get_used_rect);
- ClassDB::bind_method(D_METHOD("map_to_world", "mappos", "ignore_half_ofs"), &TileMap::map_to_world, DEFVAL(false));
- ClassDB::bind_method(D_METHOD("world_to_map", "worldpos"), &TileMap::world_to_map);
+ ClassDB::bind_method(D_METHOD("map_to_world", "map_position", "ignore_half_ofs"), &TileMap::map_to_world, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("world_to_map", "world_position"), &TileMap::world_to_map);
ClassDB::bind_method(D_METHOD("_clear_quadrants"), &TileMap::_clear_quadrants);
ClassDB::bind_method(D_METHOD("_recreate_quadrants"), &TileMap::_recreate_quadrants);
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index b8c6a86f55..c8c478ae18 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -611,10 +611,10 @@ bool AudioStreamPlayer3D::is_playing() const {
return false;
}
-float AudioStreamPlayer3D::get_pos() {
+float AudioStreamPlayer3D::get_position() {
if (stream_playback.is_valid()) {
- return stream_playback->get_pos();
+ return stream_playback->get_position();
}
return 0;
@@ -802,12 +802,12 @@ void AudioStreamPlayer3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_max_db", "max_db"), &AudioStreamPlayer3D::set_max_db);
ClassDB::bind_method(D_METHOD("get_max_db"), &AudioStreamPlayer3D::get_max_db);
- ClassDB::bind_method(D_METHOD("play", "from_pos"), &AudioStreamPlayer3D::play, DEFVAL(0.0));
- ClassDB::bind_method(D_METHOD("seek", "to_pos"), &AudioStreamPlayer3D::seek);
+ ClassDB::bind_method(D_METHOD("play", "from_position"), &AudioStreamPlayer3D::play, DEFVAL(0.0));
+ ClassDB::bind_method(D_METHOD("seek", "to_position"), &AudioStreamPlayer3D::seek);
ClassDB::bind_method(D_METHOD("stop"), &AudioStreamPlayer3D::stop);
ClassDB::bind_method(D_METHOD("is_playing"), &AudioStreamPlayer3D::is_playing);
- ClassDB::bind_method(D_METHOD("get_pos"), &AudioStreamPlayer3D::get_pos);
+ ClassDB::bind_method(D_METHOD("get_position"), &AudioStreamPlayer3D::get_position);
ClassDB::bind_method(D_METHOD("set_bus", "bus"), &AudioStreamPlayer3D::set_bus);
ClassDB::bind_method(D_METHOD("get_bus"), &AudioStreamPlayer3D::get_bus);
diff --git a/scene/3d/audio_stream_player_3d.h b/scene/3d/audio_stream_player_3d.h
index b729b55f7e..a6ce123790 100644
--- a/scene/3d/audio_stream_player_3d.h
+++ b/scene/3d/audio_stream_player_3d.h
@@ -127,7 +127,7 @@ public:
void seek(float p_seconds);
void stop();
bool is_playing() const;
- float get_pos();
+ float get_position();
void set_bus(const StringName &p_bus);
StringName get_bus() const;
diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp
index c121ef4566..1c0633fba7 100644
--- a/scene/3d/collision_object.cpp
+++ b/scene/3d/collision_object.cpp
@@ -145,9 +145,9 @@ void CollisionObject::_bind_methods() {
ClassDB::bind_method(D_METHOD("shape_owner_clear_shapes", "owner_id"), &CollisionObject::shape_owner_clear_shapes);
ClassDB::bind_method(D_METHOD("shape_find_owner", "shape_index"), &CollisionObject::shape_find_owner);
- BIND_VMETHOD(MethodInfo("_input_event", PropertyInfo(Variant::OBJECT, "camera"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), PropertyInfo(Variant::VECTOR3, "click_pos"), PropertyInfo(Variant::VECTOR3, "click_normal"), PropertyInfo(Variant::INT, "shape_idx")));
+ BIND_VMETHOD(MethodInfo("_input_event", PropertyInfo(Variant::OBJECT, "camera"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), PropertyInfo(Variant::VECTOR3, "click_position"), PropertyInfo(Variant::VECTOR3, "click_normal"), PropertyInfo(Variant::INT, "shape_idx")));
- ADD_SIGNAL(MethodInfo("input_event", PropertyInfo(Variant::OBJECT, "camera"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), PropertyInfo(Variant::VECTOR3, "click_pos"), PropertyInfo(Variant::VECTOR3, "click_normal"), PropertyInfo(Variant::INT, "shape_idx")));
+ ADD_SIGNAL(MethodInfo("input_event", PropertyInfo(Variant::OBJECT, "camera"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), PropertyInfo(Variant::VECTOR3, "click_position"), PropertyInfo(Variant::VECTOR3, "click_normal"), PropertyInfo(Variant::INT, "shape_idx")));
ADD_SIGNAL(MethodInfo("mouse_entered"));
ADD_SIGNAL(MethodInfo("mouse_exited"));
diff --git a/scene/3d/immediate_geometry.cpp b/scene/3d/immediate_geometry.cpp
index 64d3f4fcab..11f7efe066 100644
--- a/scene/3d/immediate_geometry.cpp
+++ b/scene/3d/immediate_geometry.cpp
@@ -149,7 +149,7 @@ void ImmediateGeometry::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_color", "color"), &ImmediateGeometry::set_color);
ClassDB::bind_method(D_METHOD("set_uv", "uv"), &ImmediateGeometry::set_uv);
ClassDB::bind_method(D_METHOD("set_uv2", "uv"), &ImmediateGeometry::set_uv2);
- ClassDB::bind_method(D_METHOD("add_vertex", "pos"), &ImmediateGeometry::add_vertex);
+ ClassDB::bind_method(D_METHOD("add_vertex", "position"), &ImmediateGeometry::add_vertex);
ClassDB::bind_method(D_METHOD("add_sphere", "lats", "lons", "radius", "add_uv"), &ImmediateGeometry::add_sphere, DEFVAL(true));
ClassDB::bind_method(D_METHOD("end"), &ImmediateGeometry::end);
ClassDB::bind_method(D_METHOD("clear"), &ImmediateGeometry::clear);
diff --git a/scene/3d/light.h b/scene/3d/light.h
index 6aa0220265..2f3ac8a5e7 100644
--- a/scene/3d/light.h
+++ b/scene/3d/light.h
@@ -150,7 +150,7 @@ public:
void set_shadow_mode(ShadowMode p_mode);
ShadowMode get_shadow_mode() const;
- void set_shadow_depth_range(ShadowDepthRange p_mode);
+ void set_shadow_depth_range(ShadowDepthRange p_range);
ShadowDepthRange get_shadow_depth_range() const;
void set_blend_splits(bool p_enable);
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp
index 6551deabf2..005ea1f8d1 100644
--- a/scene/3d/physics_body.cpp
+++ b/scene/3d/physics_body.cpp
@@ -825,7 +825,7 @@ void RigidBody::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_using_continuous_collision_detection"), &RigidBody::is_using_continuous_collision_detection);
ClassDB::bind_method(D_METHOD("set_axis_velocity", "axis_velocity"), &RigidBody::set_axis_velocity);
- ClassDB::bind_method(D_METHOD("apply_impulse", "pos", "impulse"), &RigidBody::apply_impulse);
+ ClassDB::bind_method(D_METHOD("apply_impulse", "position", "impulse"), &RigidBody::apply_impulse);
ClassDB::bind_method(D_METHOD("set_sleeping", "sleeping"), &RigidBody::set_sleeping);
ClassDB::bind_method(D_METHOD("is_sleeping"), &RigidBody::is_sleeping);
diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp
index 91fe426b99..0dfd80ca90 100644
--- a/scene/3d/spatial.cpp
+++ b/scene/3d/spatial.cpp
@@ -651,7 +651,7 @@ void Spatial::look_at(const Vector3 &p_target, const Vector3 &p_up_normal) {
set_global_transform(lookat);
}
-void Spatial::look_at_from_pos(const Vector3 &p_pos, const Vector3 &p_target, const Vector3 &p_up_normal) {
+void Spatial::look_at_from_position(const Vector3 &p_pos, const Vector3 &p_target, const Vector3 &p_up_normal) {
Transform lookat;
lookat.origin = p_pos;
@@ -749,7 +749,7 @@ void Spatial::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_identity"), &Spatial::set_identity);
ClassDB::bind_method(D_METHOD("look_at", "target", "up"), &Spatial::look_at);
- ClassDB::bind_method(D_METHOD("look_at_from_pos", "pos", "target", "up"), &Spatial::look_at_from_pos);
+ ClassDB::bind_method(D_METHOD("look_at_from_position", "position", "target", "up"), &Spatial::look_at_from_position);
ClassDB::bind_method(D_METHOD("to_local", "global_point"), &Spatial::to_local);
ClassDB::bind_method(D_METHOD("to_global", "local_point"), &Spatial::to_global);
diff --git a/scene/3d/spatial.h b/scene/3d/spatial.h
index 3f205ea86b..b912d1f906 100644
--- a/scene/3d/spatial.h
+++ b/scene/3d/spatial.h
@@ -172,7 +172,7 @@ public:
void global_translate(const Vector3 &p_offset);
void look_at(const Vector3 &p_target, const Vector3 &p_up_normal);
- void look_at_from_pos(const Vector3 &p_pos, const Vector3 &p_target, const Vector3 &p_up_normal);
+ void look_at_from_position(const Vector3 &p_pos, const Vector3 &p_target, const Vector3 &p_up_normal);
Vector3 to_local(Vector3 p_global) const;
Vector3 to_global(Vector3 p_local) const;
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index be0b652276..cadbd086bc 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -1045,7 +1045,7 @@ bool AnimationPlayer::is_valid() const {
return (playback.current.from);
}
-float AnimationPlayer::get_current_animation_pos() const {
+float AnimationPlayer::get_current_animation_position() const {
ERR_FAIL_COND_V(!playback.current.from, 0);
return playback.current.pos;
@@ -1238,8 +1238,8 @@ void AnimationPlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_root", "path"), &AnimationPlayer::set_root);
ClassDB::bind_method(D_METHOD("get_root"), &AnimationPlayer::get_root);
- ClassDB::bind_method(D_METHOD("seek", "pos_sec", "update"), &AnimationPlayer::seek, DEFVAL(false));
- ClassDB::bind_method(D_METHOD("get_pos"), &AnimationPlayer::get_current_animation_pos);
+ ClassDB::bind_method(D_METHOD("seek", "seconds", "update"), &AnimationPlayer::seek, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("get_position"), &AnimationPlayer::get_current_animation_position);
ClassDB::bind_method(D_METHOD("find_animation", "animation"), &AnimationPlayer::find_animation);
@@ -1248,7 +1248,7 @@ void AnimationPlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_animation_process_mode", "mode"), &AnimationPlayer::set_animation_process_mode);
ClassDB::bind_method(D_METHOD("get_animation_process_mode"), &AnimationPlayer::get_animation_process_mode);
- ClassDB::bind_method(D_METHOD("get_current_animation_pos"), &AnimationPlayer::get_current_animation_pos);
+ ClassDB::bind_method(D_METHOD("get_current_animation_position"), &AnimationPlayer::get_current_animation_position);
ClassDB::bind_method(D_METHOD("get_current_animation_length"), &AnimationPlayer::get_current_animation_length);
ClassDB::bind_method(D_METHOD("advance", "delta"), &AnimationPlayer::advance);
diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h
index c6e52145a8..bface7aabb 100644
--- a/scene/animation/animation_player.h
+++ b/scene/animation/animation_player.h
@@ -279,7 +279,7 @@ public:
void seek(float p_time, bool p_update = false);
void seek_delta(float p_time, float p_delta);
- float get_current_animation_pos() const;
+ float get_current_animation_position() const;
float get_current_animation_length() const;
void advance(float p_time);
diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp
index 38d0527288..a2a8adb653 100644
--- a/scene/animation/animation_tree_player.cpp
+++ b/scene/animation/animation_tree_player.cpp
@@ -92,7 +92,7 @@ bool AnimationTreePlayer::_set(const StringName &p_name, const Variant &p_value)
Dictionary node = nodes[i];
StringName id = node.get_valid("id");
- Point2 pos = node.get_valid("pos");
+ Point2 pos = node.get_valid("position");
NodeType nt = NODE_MAX;
String type = node.get_valid("type");
@@ -122,7 +122,7 @@ bool AnimationTreePlayer::_set(const StringName &p_name, const Variant &p_value)
if (nt != NODE_OUTPUT)
add_node(nt, id);
- node_set_pos(id, pos);
+ node_set_position(id, pos);
switch (nt) {
case NODE_OUTPUT: {
@@ -245,7 +245,7 @@ bool AnimationTreePlayer::_get(const StringName &p_name, Variant &r_ret) const {
Dictionary node;
node["id"] = E->key();
- node["pos"] = n->pos;
+ node["position"] = n->pos;
switch (n->type) {
case NODE_OUTPUT: node["type"] = "output"; break;
@@ -1176,7 +1176,7 @@ void AnimationTreePlayer::transition_node_set_current(const StringName &p_node,
n->set_current(p_current);
}
-void AnimationTreePlayer::node_set_pos(const StringName &p_node, const Vector2 &p_pos) {
+void AnimationTreePlayer::node_set_position(const StringName &p_node, const Vector2 &p_pos) {
ERR_FAIL_COND(!node_map.has(p_node));
node_map[p_node]->pos = p_pos;
@@ -1187,7 +1187,7 @@ AnimationTreePlayer::NodeType AnimationTreePlayer::node_get_type(const StringNam
ERR_FAIL_COND_V(!node_map.has(p_node), NODE_OUTPUT);
return node_map[p_node]->type;
}
-Point2 AnimationTreePlayer::node_get_pos(const StringName &p_node) const {
+Point2 AnimationTreePlayer::node_get_position(const StringName &p_node) const {
ERR_FAIL_COND_V(!node_map.has(p_node), Point2());
return node_map[p_node]->pos;
@@ -1752,7 +1752,7 @@ void AnimationTreePlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("timescale_node_set_scale", "id", "scale"), &AnimationTreePlayer::timescale_node_set_scale);
ClassDB::bind_method(D_METHOD("timescale_node_get_scale", "id"), &AnimationTreePlayer::timescale_node_get_scale);
- ClassDB::bind_method(D_METHOD("timeseek_node_seek", "id", "pos_sec"), &AnimationTreePlayer::timeseek_node_seek);
+ ClassDB::bind_method(D_METHOD("timeseek_node_seek", "id", "seconds"), &AnimationTreePlayer::timeseek_node_seek);
ClassDB::bind_method(D_METHOD("transition_node_set_input_count", "id", "count"), &AnimationTreePlayer::transition_node_set_input_count);
ClassDB::bind_method(D_METHOD("transition_node_get_input_count", "id"), &AnimationTreePlayer::transition_node_get_input_count);
@@ -1767,8 +1767,8 @@ void AnimationTreePlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("transition_node_set_current", "id", "input_idx"), &AnimationTreePlayer::transition_node_set_current);
ClassDB::bind_method(D_METHOD("transition_node_get_current", "id"), &AnimationTreePlayer::transition_node_get_current);
- ClassDB::bind_method(D_METHOD("node_set_pos", "id", "screen_pos"), &AnimationTreePlayer::node_set_pos);
- ClassDB::bind_method(D_METHOD("node_get_pos", "id"), &AnimationTreePlayer::node_get_pos);
+ ClassDB::bind_method(D_METHOD("node_set_position", "id", "screen_position"), &AnimationTreePlayer::node_set_position);
+ ClassDB::bind_method(D_METHOD("node_get_position", "id"), &AnimationTreePlayer::node_get_position);
ClassDB::bind_method(D_METHOD("remove_node", "id"), &AnimationTreePlayer::remove_node);
ClassDB::bind_method(D_METHOD("connect_nodes", "id", "dst_id", "dst_input_idx"), &AnimationTreePlayer::connect_nodes);
diff --git a/scene/animation/animation_tree_player.h b/scene/animation/animation_tree_player.h
index 609430340b..806a4f6604 100644
--- a/scene/animation/animation_tree_player.h
+++ b/scene/animation/animation_tree_player.h
@@ -417,10 +417,10 @@ public:
void transition_node_set_current(const StringName &p_node, int p_current);
int transition_node_get_current(const StringName &p_node) const;
- void node_set_pos(const StringName &p_node, const Vector2 &p_pos); //for display
+ void node_set_position(const StringName &p_node, const Vector2 &p_pos); //for display
/* GETS */
- Point2 node_get_pos(const StringName &p_node) const; //for display
+ Point2 node_get_position(const StringName &p_node) const; //for display
NodeType node_get_type(const StringName &p_node) const;
diff --git a/scene/audio/audio_player.cpp b/scene/audio/audio_player.cpp
index 661d085dfd..11e6c1b2e1 100644
--- a/scene/audio/audio_player.cpp
+++ b/scene/audio/audio_player.cpp
@@ -193,10 +193,10 @@ bool AudioStreamPlayer::is_playing() const {
return false;
}
-float AudioStreamPlayer::get_pos() {
+float AudioStreamPlayer::get_position() {
if (stream_playback.is_valid()) {
- return stream_playback->get_pos();
+ return stream_playback->get_position();
}
return 0;
@@ -279,12 +279,12 @@ void AudioStreamPlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_volume_db", "volume_db"), &AudioStreamPlayer::set_volume_db);
ClassDB::bind_method(D_METHOD("get_volume_db"), &AudioStreamPlayer::get_volume_db);
- ClassDB::bind_method(D_METHOD("play", "from_pos"), &AudioStreamPlayer::play, DEFVAL(0.0));
- ClassDB::bind_method(D_METHOD("seek", "to_pos"), &AudioStreamPlayer::seek);
+ ClassDB::bind_method(D_METHOD("play", "from_position"), &AudioStreamPlayer::play, DEFVAL(0.0));
+ ClassDB::bind_method(D_METHOD("seek", "to_position"), &AudioStreamPlayer::seek);
ClassDB::bind_method(D_METHOD("stop"), &AudioStreamPlayer::stop);
ClassDB::bind_method(D_METHOD("is_playing"), &AudioStreamPlayer::is_playing);
- ClassDB::bind_method(D_METHOD("get_pos"), &AudioStreamPlayer::get_pos);
+ ClassDB::bind_method(D_METHOD("get_position"), &AudioStreamPlayer::get_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 4bfa84f766..19b61ea5d8 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_pos();
+ float get_position();
void set_bus(const StringName &p_bus);
StringName get_bus() const;
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 87dfd95724..2c01a0e2d1 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -49,7 +49,7 @@ Variant Control::edit_get_state() const {
Dictionary s;
s["rect"] = get_rect();
- s["rot"] = get_rotation();
+ s["rotation"] = get_rotation();
s["scale"] = get_scale();
Array anchors;
anchors.push_back(get_anchor(MARGIN_LEFT));
@@ -66,7 +66,7 @@ void Control::edit_set_state(const Variant &p_state) {
Rect2 state = s["rect"];
set_position(state.position);
set_size(state.size);
- set_rotation(s["rot"]);
+ set_rotation(s["rotation"]);
set_scale(s["scale"]);
Array anchors = s["anchors"];
set_anchor(MARGIN_LEFT, anchors[0]);
@@ -809,9 +809,9 @@ Ref<StyleBox> Control::get_stylebox(const StringName &p_name, const StringName &
// try with custom themes
Control *theme_owner = data.theme_owner;
- while (theme_owner) {
+ StringName class_name = type;
- StringName class_name = type;
+ while (theme_owner) {
while (class_name != StringName()) {
if (theme_owner->data.theme->has_stylebox(p_name, class_name)) {
@@ -829,6 +829,14 @@ Ref<StyleBox> Control::get_stylebox(const StringName &p_name, const StringName &
theme_owner = NULL;
}
+ class_name = type;
+
+ while (class_name != StringName()) {
+ if (Theme::get_default()->has_stylebox(p_name, class_name))
+ return Theme::get_default()->get_stylebox(p_name, class_name);
+
+ class_name = ClassDB::get_parent_class_nocheck(class_name);
+ }
return Theme::get_default()->get_stylebox(p_name, type);
}
Ref<Font> Control::get_font(const StringName &p_name, const StringName &p_type) const {
@@ -2469,12 +2477,12 @@ void Control::_bind_methods() {
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));
- ClassDB::bind_method(D_METHOD("set_begin", "pos"), &Control::set_begin);
- ClassDB::bind_method(D_METHOD("set_end", "pos"), &Control::set_end);
- ClassDB::bind_method(D_METHOD("set_position", "pos"), &Control::set_position);
+ ClassDB::bind_method(D_METHOD("set_begin", "position"), &Control::set_begin);
+ ClassDB::bind_method(D_METHOD("set_end", "position"), &Control::set_end);
+ ClassDB::bind_method(D_METHOD("set_position", "position"), &Control::set_position);
ClassDB::bind_method(D_METHOD("set_size", "size"), &Control::set_size);
ClassDB::bind_method(D_METHOD("set_custom_minimum_size", "size"), &Control::set_custom_minimum_size);
- ClassDB::bind_method(D_METHOD("set_global_position", "pos"), &Control::set_global_position);
+ ClassDB::bind_method(D_METHOD("set_global_position", "position"), &Control::set_global_position);
ClassDB::bind_method(D_METHOD("set_rotation", "radians"), &Control::set_rotation);
ClassDB::bind_method(D_METHOD("set_rotation_deg", "degrees"), &Control::set_rotation_deg);
// TODO: Obsolete this method (old name) properly (GH-4397)
@@ -2552,12 +2560,12 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_v_grow_direction"), &Control::get_v_grow_direction);
ClassDB::bind_method(D_METHOD("set_tooltip", "tooltip"), &Control::set_tooltip);
- ClassDB::bind_method(D_METHOD("get_tooltip", "atpos"), &Control::get_tooltip, DEFVAL(Point2()));
+ ClassDB::bind_method(D_METHOD("get_tooltip", "at_position"), &Control::get_tooltip, DEFVAL(Point2()));
ClassDB::bind_method(D_METHOD("_get_tooltip"), &Control::_get_tooltip);
ClassDB::bind_method(D_METHOD("set_default_cursor_shape", "shape"), &Control::set_default_cursor_shape);
ClassDB::bind_method(D_METHOD("get_default_cursor_shape"), &Control::get_default_cursor_shape);
- ClassDB::bind_method(D_METHOD("get_cursor_shape", "pos"), &Control::get_cursor_shape, DEFVAL(Point2()));
+ ClassDB::bind_method(D_METHOD("get_cursor_shape", "position"), &Control::get_cursor_shape, DEFVAL(Point2()));
ClassDB::bind_method(D_METHOD("set_focus_neighbour", "margin", "neighbour"), &Control::set_focus_neighbour);
ClassDB::bind_method(D_METHOD("get_focus_neighbour", "margin"), &Control::get_focus_neighbour);
@@ -2575,7 +2583,7 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_drag_forwarding", "target"), &Control::set_drag_forwarding);
ClassDB::bind_method(D_METHOD("set_drag_preview", "control"), &Control::set_drag_preview);
- ClassDB::bind_method(D_METHOD("warp_mouse", "to_pos"), &Control::warp_mouse);
+ ClassDB::bind_method(D_METHOD("warp_mouse", "to_position"), &Control::warp_mouse);
ClassDB::bind_method(D_METHOD("minimum_size_changed"), &Control::minimum_size_changed);
@@ -2585,9 +2593,9 @@ void Control::_bind_methods() {
BIND_VMETHOD(MethodInfo("_gui_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
BIND_VMETHOD(MethodInfo(Variant::VECTOR2, "_get_minimum_size"));
- BIND_VMETHOD(MethodInfo(Variant::OBJECT, "get_drag_data", PropertyInfo(Variant::VECTOR2, "pos")));
- BIND_VMETHOD(MethodInfo(Variant::BOOL, "can_drop_data", PropertyInfo(Variant::VECTOR2, "pos"), PropertyInfo(Variant::NIL, "data")));
- BIND_VMETHOD(MethodInfo("drop_data", PropertyInfo(Variant::VECTOR2, "pos"), PropertyInfo(Variant::NIL, "data")));
+ BIND_VMETHOD(MethodInfo(Variant::OBJECT, "get_drag_data", PropertyInfo(Variant::VECTOR2, "position")));
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "can_drop_data", PropertyInfo(Variant::VECTOR2, "position"), PropertyInfo(Variant::NIL, "data")));
+ BIND_VMETHOD(MethodInfo("drop_data", PropertyInfo(Variant::VECTOR2, "position"), PropertyInfo(Variant::NIL, "data")));
ADD_GROUP("Anchor", "anchor_");
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_left", PROPERTY_HINT_RANGE, "0,1,0.01"), "_set_anchor", "get_anchor", MARGIN_LEFT);
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 5b00aab2ef..ff31aa88ab 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -283,7 +283,7 @@ void GraphEdit::_notification(int p_what) {
zoom_minus->set_icon(get_icon("minus"));
zoom_reset->set_icon(get_icon("reset"));
zoom_plus->set_icon(get_icon("more"));
- snap_button->set_icon(get_icon("snap"));
+ snap_button->set_icon(get_icon("SnapGrid"));
//zoom_icon->set_texture( get_icon("Zoom", "EditorIcons"));
}
if (p_what == NOTIFICATION_DRAW) {
@@ -352,14 +352,14 @@ bool GraphEdit::_filter_input(const Point2 &p_point) {
for (int j = 0; j < gn->get_connection_output_count(); j++) {
- Vector2 pos = gn->get_connection_output_pos(j) + gn->get_position();
+ Vector2 pos = gn->get_connection_output_position(j) + gn->get_position();
if (pos.distance_to(p_point) < grab_r)
return true;
}
for (int j = 0; j < gn->get_connection_input_count(); j++) {
- Vector2 pos = gn->get_connection_input_pos(j) + gn->get_position();
+ Vector2 pos = gn->get_connection_input_position(j) + gn->get_position();
if (pos.distance_to(p_point) < grab_r) {
return true;
}
@@ -386,7 +386,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
for (int j = 0; j < gn->get_connection_output_count(); j++) {
- Vector2 pos = gn->get_connection_output_pos(j) + gn->get_position();
+ Vector2 pos = gn->get_connection_output_position(j) + gn->get_position();
if (pos.distance_to(mpos) < grab_r) {
if (valid_left_disconnect_types.has(gn->get_connection_output_type(j))) {
@@ -433,7 +433,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
for (int j = 0; j < gn->get_connection_input_count(); j++) {
- Vector2 pos = gn->get_connection_input_pos(j) + gn->get_position();
+ Vector2 pos = gn->get_connection_input_position(j) + gn->get_position();
if (pos.distance_to(mpos) < grab_r) {
@@ -501,7 +501,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
if (!connecting_out) {
for (int j = 0; j < gn->get_connection_output_count(); j++) {
- Vector2 pos = gn->get_connection_output_pos(j) + gn->get_position();
+ Vector2 pos = gn->get_connection_output_position(j) + gn->get_position();
int type = gn->get_connection_output_type(j);
if ((type == connecting_type || valid_connection_types.has(ConnType(type, connecting_type))) && pos.distance_to(mpos) < grab_r) {
@@ -516,7 +516,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
for (int j = 0; j < gn->get_connection_input_count(); j++) {
- Vector2 pos = gn->get_connection_input_pos(j) + gn->get_position();
+ Vector2 pos = gn->get_connection_input_position(j) + gn->get_position();
int type = gn->get_connection_input_type(j);
if ((type == connecting_type || valid_connection_types.has(ConnType(type, connecting_type))) && pos.distance_to(mpos) < grab_r) {
connecting_target = true;
@@ -657,9 +657,9 @@ void GraphEdit::_connections_layer_draw() {
continue;
}
- Vector2 frompos = gfrom->get_connection_output_pos(E->get().from_port) + gfrom->get_offset() * zoom;
+ Vector2 frompos = gfrom->get_connection_output_position(E->get().from_port) + gfrom->get_offset() * zoom;
Color color = gfrom->get_connection_output_color(E->get().from_port);
- Vector2 topos = gto->get_connection_input_pos(E->get().to_port) + gto->get_offset() * zoom;
+ Vector2 topos = gto->get_connection_input_position(E->get().to_port) + gto->get_offset() * zoom;
Color tocolor = gto->get_connection_input_color(E->get().to_port);
_draw_cos_line(connections_layer, frompos, topos, color, tocolor);
}
@@ -682,9 +682,9 @@ void GraphEdit::_top_layer_draw() {
ERR_FAIL_COND(!from);
Vector2 pos;
if (connecting_out)
- pos = from->get_connection_output_pos(connecting_index);
+ pos = from->get_connection_output_position(connecting_index);
else
- pos = from->get_connection_input_pos(connecting_index);
+ pos = from->get_connection_input_position(connecting_index);
pos += from->get_position();
Vector2 topos;
@@ -733,7 +733,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
just_selected = true;
// TODO: Remove local mouse pos hack if/when InputEventMouseMotion is fixed to support floats
//drag_accum+=Vector2(mm->get_relative().x,mm->get_relative().y);
- drag_accum = get_local_mouse_pos() - drag_origin;
+ drag_accum = get_local_mouse_position() - drag_origin;
for (int i = get_child_count() - 1; i >= 0; i--) {
GraphNode *gn = Object::cast_to<GraphNode>(get_child(i));
if (gn && gn->is_selected()) {
@@ -750,7 +750,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
}
if (mm.is_valid() && box_selecting) {
- box_selecting_to = get_local_mouse_pos();
+ box_selecting_to = get_local_mouse_position();
box_selecting_rect = Rect2(MIN(box_selecting_from.x, box_selecting_to.x),
MIN(box_selecting_from.y, box_selecting_to.y),
@@ -810,7 +810,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
if (gn) {
Rect2 r = gn->get_rect();
r.size *= zoom;
- if (r.has_point(get_local_mouse_pos()))
+ if (r.has_point(get_local_mouse_position()))
gn->set_selected(false);
}
}
@@ -848,7 +848,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
if (gn_selected->is_resizing())
continue;
- if (gn_selected->has_point(gn_selected->get_local_mouse_pos())) {
+ if (gn_selected->has_point(gn_selected->get_local_mouse_position())) {
gn = gn_selected;
break;
}
@@ -862,7 +862,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
dragging = true;
drag_accum = Vector2();
- drag_origin = get_local_mouse_pos();
+ drag_origin = get_local_mouse_position();
just_selected = !gn->is_selected();
if (!gn->is_selected() && !Input::get_singleton()->is_key_pressed(KEY_CONTROL)) {
for (int i = 0; i < get_child_count(); i++) {
@@ -888,7 +888,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
return;
box_selecting = true;
- box_selecting_from = get_local_mouse_pos();
+ box_selecting_from = get_local_mouse_position();
if (b->get_control()) {
box_selection_mode_aditive = true;
previus_selected.clear();
@@ -1167,7 +1167,7 @@ void GraphEdit::_bind_methods() {
ADD_SIGNAL(MethodInfo("popup_request", PropertyInfo(Variant::VECTOR2, "p_position")));
ADD_SIGNAL(MethodInfo("duplicate_nodes_request"));
ADD_SIGNAL(MethodInfo("node_selected", PropertyInfo(Variant::OBJECT, "node")));
- ADD_SIGNAL(MethodInfo("connection_to_empty", PropertyInfo(Variant::STRING, "from"), PropertyInfo(Variant::INT, "from_slot"), PropertyInfo(Variant::VECTOR2, "release_pos")));
+ ADD_SIGNAL(MethodInfo("connection_to_empty", PropertyInfo(Variant::STRING, "from"), PropertyInfo(Variant::INT, "from_slot"), PropertyInfo(Variant::VECTOR2, "release_position")));
ADD_SIGNAL(MethodInfo("delete_nodes_request"));
ADD_SIGNAL(MethodInfo("_begin_node_move"));
ADD_SIGNAL(MethodInfo("_end_node_move"));
diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp
index bef0808fd0..7655363631 100644
--- a/scene/gui/graph_node.cpp
+++ b/scene/gui/graph_node.cpp
@@ -208,8 +208,11 @@ void GraphNode::_notification(int p_what) {
Ref<Texture> close = get_icon("close");
Ref<Texture> resizer = get_icon("resizer");
int close_offset = get_constant("close_offset");
+ int close_h_offset = get_constant("close_h_offset");
+ Color close_color = get_color("close_color");
Ref<Font> title_font = get_font("title_font");
int title_offset = get_constant("title_offset");
+ int title_h_offset = get_constant("title_h_offset");
Color title_color = get_color("title_color");
Point2i icofs = -port->get_size() * 0.5;
int edgeofs = get_constant("port_offset");
@@ -236,10 +239,10 @@ void GraphNode::_notification(int p_what) {
if (show_close)
w -= close->get_width();
- draw_string(title_font, Point2(sb->get_margin(MARGIN_LEFT), -title_font->get_height() + title_font->get_ascent() + title_offset), title, title_color, w);
+ draw_string(title_font, Point2(sb->get_margin(MARGIN_LEFT) + title_h_offset, -title_font->get_height() + title_font->get_ascent() + title_offset), title, title_color, w);
if (show_close) {
- Vector2 cpos = Point2(w + sb->get_margin(MARGIN_LEFT), -close->get_height() + close_offset);
- draw_texture(close, cpos);
+ Vector2 cpos = Point2(w + sb->get_margin(MARGIN_LEFT) + close_h_offset, -close->get_height() + close_offset);
+ draw_texture(close, cpos, close_color);
close_rect.position = cpos;
close_rect.size = close->get_size();
} else {
@@ -515,7 +518,7 @@ int GraphNode::get_connection_output_count() {
return conn_output_cache.size();
}
-Vector2 GraphNode::get_connection_input_pos(int p_idx) {
+Vector2 GraphNode::get_connection_input_position(int p_idx) {
if (connpos_dirty)
_connpos_update();
@@ -545,7 +548,7 @@ Color GraphNode::get_connection_input_color(int p_idx) {
return conn_input_cache[p_idx].color;
}
-Vector2 GraphNode::get_connection_output_pos(int p_idx) {
+Vector2 GraphNode::get_connection_output_position(int p_idx) {
if (connpos_dirty)
_connpos_update();
@@ -687,10 +690,10 @@ void GraphNode::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_connection_output_count"), &GraphNode::get_connection_output_count);
ClassDB::bind_method(D_METHOD("get_connection_input_count"), &GraphNode::get_connection_input_count);
- ClassDB::bind_method(D_METHOD("get_connection_output_pos", "idx"), &GraphNode::get_connection_output_pos);
+ ClassDB::bind_method(D_METHOD("get_connection_output_position", "idx"), &GraphNode::get_connection_output_position);
ClassDB::bind_method(D_METHOD("get_connection_output_type", "idx"), &GraphNode::get_connection_output_type);
ClassDB::bind_method(D_METHOD("get_connection_output_color", "idx"), &GraphNode::get_connection_output_color);
- ClassDB::bind_method(D_METHOD("get_connection_input_pos", "idx"), &GraphNode::get_connection_input_pos);
+ ClassDB::bind_method(D_METHOD("get_connection_input_position", "idx"), &GraphNode::get_connection_input_position);
ClassDB::bind_method(D_METHOD("get_connection_input_type", "idx"), &GraphNode::get_connection_input_type);
ClassDB::bind_method(D_METHOD("get_connection_input_color", "idx"), &GraphNode::get_connection_input_color);
diff --git a/scene/gui/graph_node.h b/scene/gui/graph_node.h
index a606e47acd..a0840544dd 100644
--- a/scene/gui/graph_node.h
+++ b/scene/gui/graph_node.h
@@ -138,10 +138,10 @@ public:
int get_connection_input_count();
int get_connection_output_count();
- Vector2 get_connection_input_pos(int p_idx);
+ Vector2 get_connection_input_position(int p_idx);
int get_connection_input_type(int p_idx);
Color get_connection_input_color(int p_idx);
- Vector2 get_connection_output_pos(int p_idx);
+ Vector2 get_connection_output_position(int p_idx);
int get_connection_output_type(int p_idx);
Color get_connection_output_color(int p_idx);
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 9a605c98f3..74cc09d0a6 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -1117,7 +1117,7 @@ void ItemList::_scroll_changed(double) {
update();
}
-int ItemList::get_item_at_pos(const Point2 &p_pos, bool p_exact) const {
+int ItemList::get_item_at_position(const Point2 &p_pos, bool p_exact) const {
Vector2 pos = p_pos;
Ref<StyleBox> bg = get_stylebox("bg");
@@ -1165,7 +1165,7 @@ bool ItemList::is_pos_at_end_of_items(const Point2 &p_pos) const {
String ItemList::get_tooltip(const Point2 &p_pos) const {
- int closest = get_item_at_pos(p_pos);
+ int closest = get_item_at_position(p_pos);
if (closest != -1) {
if (!items[closest].tooltip_enabled) {
@@ -1362,7 +1362,7 @@ void ItemList::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_auto_height", "enable"), &ItemList::set_auto_height);
ClassDB::bind_method(D_METHOD("has_auto_height"), &ItemList::has_auto_height);
- ClassDB::bind_method(D_METHOD("get_item_at_pos", "pos", "exact"), &ItemList::get_item_at_pos, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("get_item_at_position", "position", "exact"), &ItemList::get_item_at_position, DEFVAL(false));
ClassDB::bind_method(D_METHOD("ensure_current_is_visible"), &ItemList::ensure_current_is_visible);
@@ -1395,7 +1395,7 @@ void ItemList::_bind_methods() {
BIND_ENUM_CONSTANT(SELECT_MULTI);
ADD_SIGNAL(MethodInfo("item_selected", PropertyInfo(Variant::INT, "index")));
- ADD_SIGNAL(MethodInfo("item_rmb_selected", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::VECTOR2, "atpos")));
+ ADD_SIGNAL(MethodInfo("item_rmb_selected", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::VECTOR2, "at_position")));
ADD_SIGNAL(MethodInfo("multi_selected", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::BOOL, "selected")));
ADD_SIGNAL(MethodInfo("item_activated", PropertyInfo(Variant::INT, "index")));
diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h
index 673b7d8956..ccdd705325 100644
--- a/scene/gui/item_list.h
+++ b/scene/gui/item_list.h
@@ -199,7 +199,7 @@ public:
int find_metadata(const Variant &p_metadata) const;
virtual String get_tooltip(const Point2 &p_pos) const;
- int get_item_at_pos(const Point2 &p_pos, bool p_exact = false) const;
+ int get_item_at_position(const Point2 &p_pos, bool p_exact = false) const;
bool is_pos_at_end_of_items(const Point2 &p_pos) const;
void set_icon_scale(real_t p_scale);
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 6a5f56c78c..7493ea95a8 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -49,7 +49,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
if (b.is_valid()) {
if (b->is_pressed() && b->get_button_index() == BUTTON_RIGHT) {
- menu->set_position(get_global_transform().xform(get_local_mouse_pos()));
+ menu->set_position(get_global_transform().xform(get_local_mouse_position()));
menu->set_size(Vector2(1, 1));
menu->popup();
grab_focus();
@@ -186,7 +186,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
cached_width += font->get_char_size(text[i]).width;
}
- set_cursor_pos(0);
+ set_cursor_position(0);
_text_changed();
}
@@ -273,7 +273,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
delete_text(cc, cursor_pos);
- set_cursor_pos(cc);
+ set_cursor_position(cc);
} else {
undo_text = text;
@@ -297,7 +297,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
#ifdef APPLE_STYLE_KEYS
if (k->get_command()) {
- set_cursor_pos(0);
+ set_cursor_position(0);
} else if (k->get_alt()) {
#else
@@ -319,10 +319,10 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
cc--;
}
- set_cursor_pos(cc);
+ set_cursor_position(cc);
} else {
- set_cursor_pos(get_cursor_pos() - 1);
+ set_cursor_position(get_cursor_position() - 1);
}
shift_selection_check_post(k->get_shift());
@@ -341,7 +341,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
#ifdef APPLE_STYLE_KEYS
if (k->get_command()) {
- set_cursor_pos(text.length());
+ set_cursor_position(text.length());
} else if (k->get_alt()) {
#else
if (k->get_alt()) {
@@ -362,10 +362,10 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
cc++;
}
- set_cursor_pos(cc);
+ set_cursor_position(cc);
} else {
- set_cursor_pos(get_cursor_pos() + 1);
+ set_cursor_position(get_cursor_position() + 1);
}
shift_selection_check_post(k->get_shift());
@@ -418,7 +418,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
} else {
undo_text = text;
- set_cursor_pos(cursor_pos + 1);
+ set_cursor_position(cursor_pos + 1);
delete_char();
}
@@ -433,7 +433,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
case KEY_HOME: {
shift_selection_check_pre(k->get_shift());
- set_cursor_pos(0);
+ set_cursor_position(0);
shift_selection_check_post(k->get_shift());
} break;
case KEY_KP_1: {
@@ -446,7 +446,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
case KEY_END: {
shift_selection_check_pre(k->get_shift());
- set_cursor_pos(text.length());
+ set_cursor_position(text.length());
shift_selection_check_post(k->get_shift());
} break;
@@ -546,7 +546,7 @@ void LineEdit::_notification(int p_what) {
#endif
case NOTIFICATION_RESIZED: {
- set_cursor_pos(get_cursor_pos());
+ set_cursor_position(get_cursor_position());
} break;
case MainLoop::NOTIFICATION_WM_FOCUS_IN: {
@@ -742,7 +742,7 @@ void LineEdit::_notification(int p_what) {
draw_caret = true;
}
- Point2 cursor_pos = Point2(get_cursor_pos(), 1) * get_minimum_size().height;
+ Point2 cursor_pos = Point2(get_cursor_position(), 1) * get_minimum_size().height;
OS::get_singleton()->set_ime_position(get_global_position() + cursor_pos);
OS::get_singleton()->set_ime_intermediate_text_callback(_ime_text_callback, this);
@@ -806,9 +806,9 @@ void LineEdit::undo() {
cached_width += font->get_char_size(text[i]).width;
if (old_cursor_pos > text.length()) {
- set_cursor_pos(text.length());
+ set_cursor_position(text.length());
} else {
- set_cursor_pos(old_cursor_pos);
+ set_cursor_position(old_cursor_pos);
}
_text_changed();
@@ -869,14 +869,14 @@ void LineEdit::set_cursor_at_pixel_pos(int p_x) {
ofs++;
}
- set_cursor_pos(ofs);
+ set_cursor_position(ofs);
/*
int new_cursor_pos=p_x;
int charwidth=draw_area->get_font_char_width(' ',0);
new_cursor_pos=( ( (new_cursor_pos-2)+ (charwidth/2) ) /charwidth );
if (new_cursor_pos>(int)text.length()) new_cursor_pos=text.length();
- set_cursor_pos(window_pos+new_cursor_pos); */
+ set_cursor_position(window_pos+new_cursor_pos); */
}
bool LineEdit::cursor_get_blink_enabled() const {
@@ -929,7 +929,7 @@ void LineEdit::delete_char() {
text.erase(cursor_pos - 1, 1);
- set_cursor_pos(get_cursor_pos() - 1);
+ set_cursor_position(get_cursor_position() - 1);
if (cursor_pos == window_pos) {
@@ -1011,7 +1011,7 @@ float LineEdit::get_placeholder_alpha() const {
return placeholder_alpha;
}
-void LineEdit::set_cursor_pos(int p_pos) {
+void LineEdit::set_cursor_position(int p_pos) {
if (p_pos > (int)text.length())
p_pos = text.length();
@@ -1065,7 +1065,7 @@ void LineEdit::set_cursor_pos(int p_pos) {
update();
}
-int LineEdit::get_cursor_pos() const {
+int LineEdit::get_cursor_position() const {
return cursor_pos;
}
@@ -1093,7 +1093,7 @@ void LineEdit::append_at_cursor(String p_text) {
String pre = text.substr(0, cursor_pos);
String post = text.substr(cursor_pos, text.length() - cursor_pos);
text = pre + p_text + post;
- set_cursor_pos(cursor_pos + p_text.length());
+ set_cursor_position(cursor_pos + p_text.length());
}
}
@@ -1330,8 +1330,8 @@ void LineEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_placeholder"), &LineEdit::get_placeholder);
ClassDB::bind_method(D_METHOD("set_placeholder_alpha", "alpha"), &LineEdit::set_placeholder_alpha);
ClassDB::bind_method(D_METHOD("get_placeholder_alpha"), &LineEdit::get_placeholder_alpha);
- ClassDB::bind_method(D_METHOD("set_cursor_pos", "pos"), &LineEdit::set_cursor_pos);
- ClassDB::bind_method(D_METHOD("get_cursor_pos"), &LineEdit::get_cursor_pos);
+ ClassDB::bind_method(D_METHOD("set_cursor_position", "position"), &LineEdit::set_cursor_position);
+ ClassDB::bind_method(D_METHOD("get_cursor_position"), &LineEdit::get_cursor_position);
ClassDB::bind_method(D_METHOD("set_expand_to_text_length", "enabled"), &LineEdit::set_expand_to_text_length);
ClassDB::bind_method(D_METHOD("get_expand_to_text_length"), &LineEdit::get_expand_to_text_length);
ClassDB::bind_method(D_METHOD("cursor_set_blink_enabled", "enabled"), &LineEdit::cursor_set_blink_enabled);
diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h
index 52a4a29a33..661f9b60b9 100644
--- a/scene/gui/line_edit.h
+++ b/scene/gui/line_edit.h
@@ -149,8 +149,8 @@ public:
String get_placeholder() const;
void set_placeholder_alpha(float p_alpha);
float get_placeholder_alpha() const;
- void set_cursor_pos(int p_pos);
- int get_cursor_pos() const;
+ void set_cursor_position(int p_pos);
+ int get_cursor_position() const;
void set_max_length(int p_max_length);
int get_max_length() const;
void append_at_cursor(String p_text);
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index ab2c2f445f..71b9c4ec72 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -540,14 +540,6 @@ void RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int
it = _get_next_item(it);
- if (p_mode == PROCESS_POINTER && r_click_item && itp && !it && p_click_pos.y > p_ofs.y + y + lh) {
- //at the end of all, return this
- if (r_outside) *r_outside = true;
- *r_click_item = itp;
- *r_click_char = rchar;
- return;
- }
-
if (it && (p_line + 1 < p_frame->lines.size()) && p_frame->lines[p_line + 1].from == it) {
if (p_mode == PROCESS_POINTER && r_click_item && p_click_pos.y >= p_ofs.y + y && p_click_pos.y <= p_ofs.y + y + lh) {
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index 16d1b320b7..41f4beb1c9 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -106,9 +106,9 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
if (ofs < grabber_ofs) {
if (scrolling) {
- target_scroll = target_scroll - get_page();
+ target_scroll = CLAMP(target_scroll - get_page(), get_min(), get_max() - get_page());
} else {
- target_scroll = get_value() - get_page();
+ target_scroll = CLAMP(get_value() - get_page(), get_min(), get_max() - get_page());
}
if (smooth_scroll_enabled) {
@@ -130,9 +130,9 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
update();
} else {
if (scrolling) {
- target_scroll = target_scroll + get_page();
+ target_scroll = CLAMP(target_scroll + get_page(), get_min(), get_max() - get_page());
} else {
- target_scroll = get_value() + get_page();
+ target_scroll = CLAMP(get_value() + get_page(), get_min(), get_max() - get_page());
}
if (smooth_scroll_enabled) {
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index e182e491d3..c71093b947 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -182,7 +182,7 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
}
}
-void ScrollContainer::_update_scrollbar_pos() {
+void ScrollContainer::_update_scrollbar_position() {
Size2 hmin = h_scroll->get_combined_minimum_size();
Size2 vmin = v_scroll->get_combined_minimum_size();
@@ -205,7 +205,7 @@ void ScrollContainer::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
- call_deferred("_update_scrollbar_pos");
+ call_deferred("_update_scrollbar_position");
};
if (p_what == NOTIFICATION_SORT_CHILDREN) {
@@ -448,7 +448,7 @@ void ScrollContainer::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_h_scroll_enabled"), &ScrollContainer::is_h_scroll_enabled);
ClassDB::bind_method(D_METHOD("set_enable_v_scroll", "enable"), &ScrollContainer::set_enable_v_scroll);
ClassDB::bind_method(D_METHOD("is_v_scroll_enabled"), &ScrollContainer::is_v_scroll_enabled);
- ClassDB::bind_method(D_METHOD("_update_scrollbar_pos"), &ScrollContainer::_update_scrollbar_pos);
+ ClassDB::bind_method(D_METHOD("_update_scrollbar_position"), &ScrollContainer::_update_scrollbar_position);
ClassDB::bind_method(D_METHOD("set_h_scroll", "val"), &ScrollContainer::set_h_scroll);
ClassDB::bind_method(D_METHOD("get_h_scroll"), &ScrollContainer::get_h_scroll);
ClassDB::bind_method(D_METHOD("set_v_scroll", "val"), &ScrollContainer::set_v_scroll);
diff --git a/scene/gui/scroll_container.h b/scene/gui/scroll_container.h
index 9076be0d72..2c5d60de6c 100644
--- a/scene/gui/scroll_container.h
+++ b/scene/gui/scroll_container.h
@@ -70,7 +70,7 @@ protected:
void _scroll_moved(float);
static void _bind_methods();
- void _update_scrollbar_pos();
+ void _update_scrollbar_position();
public:
int get_v_scroll() const;
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index f462989f53..60b6746ae8 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -72,7 +72,7 @@ void SpinBox::_range_click_timeout() {
if (!drag.enabled && Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT)) {
- bool up = get_local_mouse_pos().y < (get_size().height / 2);
+ bool up = get_local_mouse_position().y < (get_size().height / 2);
set_value(get_value() + (up ? get_step() : -get_step()));
if (range_click_timer->is_one_shot()) {
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index 657e8590d4..98a8db336e 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -208,6 +208,9 @@ void TabContainer::_notification(int p_what) {
break;
}
+ // Draw the tab area.
+ panel->draw(canvas, Rect2(0, header_height, size.width, size.height - header_height));
+
// Draw all visible tabs.
int x = 0;
for (int i = 0; i < tab_widths.size(); i++) {
@@ -280,9 +283,6 @@ void TabContainer::_notification(int p_what) {
Point2(x, y_center - (decrement->get_height() / 2)),
Color(1, 1, 1, first_tab_cache > 0 ? 1.0 : 0.5));
}
-
- // Draw the tab area.
- panel->draw(canvas, Rect2(0, header_height, size.width, size.height - header_height));
} break;
case NOTIFICATION_THEME_CHANGED: {
if (get_tab_count() > 0) {
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 1738e303aa..d79ce25344 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -36,6 +36,10 @@
#include "project_settings.h"
#include "scene/main/viewport.h"
+#ifdef TOOLS_ENABLED
+#include "editor/editor_scale.h"
+#endif
+
#define TAB_PIXELS
static bool _is_text_char(CharType c) {
@@ -729,15 +733,18 @@ void TextEdit::_notification(int p_what) {
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg, ofs_y, xmargin_end - xmargin_beg, get_row_height()), cache.mark_color);
}
- if (text.is_breakpoint(line)) {
-
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg, ofs_y, xmargin_end - xmargin_beg, get_row_height()), cache.breakpoint_color);
- }
-
if (line == cursor.line) {
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(0, ofs_y, xmargin_end, get_row_height()), cache.current_line_color);
}
+ if (text.is_breakpoint(line) && !draw_breakpoint_gutter) {
+#ifdef TOOLS_ENABLED
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg, ofs_y + get_row_height() - EDSCALE, xmargin_end - xmargin_beg, EDSCALE), cache.breakpoint_color);
+#else
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg, ofs_y, xmargin_end - xmargin_beg, get_row_height()), cache.breakpoint_color);
+#endif
+ }
+
// draw breakpoint marker
if (text.is_breakpoint(line)) {
if (draw_breakpoint_gutter) {
@@ -1766,7 +1773,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (mb->get_button_index() == BUTTON_RIGHT && context_menu_enabled) {
- menu->set_position(get_global_transform().xform(get_local_mouse_pos()));
+ menu->set_position(get_global_transform().xform(get_local_mouse_position()));
menu->set_size(Vector2(1, 1));
menu->popup();
grab_focus();
@@ -1837,7 +1844,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (k->is_pressed()) {
- highlighted_word = get_word_at_pos(get_local_mouse_pos());
+ highlighted_word = get_word_at_pos(get_local_mouse_position());
update();
} else {
@@ -2793,12 +2800,16 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
int ini = selection.from_line;
int end = selection.to_line;
for (int i = ini; i <= end; i++) {
- if (text[i][0] == '#')
+ if (get_line(i).begins_with("#"))
_remove_text(i, 0, i, 1);
}
} else {
- if (text[cursor.line][0] == '#')
+ if (get_line(cursor.line).begins_with("#")) {
_remove_text(cursor.line, 0, cursor.line, 1);
+ if (cursor.column >= get_line(cursor.line).length()) {
+ cursor.column = MAX(0, get_line(cursor.line).length() - 1);
+ }
+ }
}
update();
}
@@ -3488,7 +3499,7 @@ String TextEdit::get_text() {
String TextEdit::get_text_for_lookup_completion() {
int row, col;
- _get_mouse_pos(get_local_mouse_pos(), row, col);
+ _get_mouse_pos(get_local_mouse_position(), row, col);
String longthing;
int len = text.size();
@@ -4255,6 +4266,10 @@ bool TextEdit::is_insert_mode() const {
return insert_mode;
}
+bool TextEdit::is_insert_text_operation() {
+ return (current_op.type == TextOperation::TYPE_INSERT);
+}
+
uint32_t TextEdit::get_version() const {
return current_op.version;
}
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 68ef559f46..7e61c4e8b1 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -386,6 +386,8 @@ public:
void begin_complex_operation();
void end_complex_operation();
+ bool is_insert_text_operation();
+
void set_text(String p_text);
void insert_text_at_cursor(const String &p_text);
void insert_at(const String &p_text, int at);
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 7fa29d312e..8d6eb0f8e2 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -1528,7 +1528,7 @@ void Tree::_range_click_timeout() {
if (range_item_last && !range_drag_enabled && Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT)) {
- Point2 pos = get_local_mouse_pos() - cache.bg->get_offset();
+ Point2 pos = get_local_mouse_position() - cache.bg->get_offset();
if (show_column_titles) {
pos.y -= _get_title_button_height();
@@ -1676,7 +1676,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
p_item->select(col);
emit_signal("multi_selected", p_item, col, true);
if (p_button == BUTTON_RIGHT) {
- emit_signal("item_rmb_selected", get_local_mouse_pos());
+ emit_signal("item_rmb_selected", get_local_mouse_position());
}
//p_item->selected_signal.call(col);
@@ -1697,7 +1697,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
select_single_item(p_item, root, col, selected_item, &inrange);
if (p_button == BUTTON_RIGHT) {
- emit_signal("item_rmb_selected", get_local_mouse_pos());
+ emit_signal("item_rmb_selected", get_local_mouse_position());
}
} else {
@@ -1713,7 +1713,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
}
if (p_button == BUTTON_RIGHT) {
- emit_signal("item_rmb_selected", get_local_mouse_pos());
+ emit_signal("item_rmb_selected", get_local_mouse_position());
}
}
}
@@ -1914,7 +1914,7 @@ void Tree::_text_editor_modal_close() {
return;
}
- if (value_editor->has_point(value_editor->get_local_mouse_pos()))
+ if (value_editor->has_point(value_editor->get_local_mouse_position()))
return;
text_editor_enter(text_editor->get_text());
@@ -2010,7 +2010,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
if (!k->is_pressed())
return;
- if (k->get_alt() || k->get_command() || (k->get_shift() && k->get_unicode() == 0) || k->get_metakey())
+ if (k->get_command() || (k->get_shift() && k->get_unicode() == 0) || k->get_metakey())
return;
if (!root)
return;
@@ -2025,48 +2025,47 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
break; \
}
case KEY_RIGHT: {
+ bool dobreak = true;
//TreeItem *next = NULL;
if (!selected_item)
break;
- if (select_mode == SELECT_ROW)
+ if (select_mode == SELECT_ROW) {
EXIT_BREAK;
- if (selected_col >= (columns.size() - 1))
+ }
+ if (selected_col > (columns.size() - 1)) {
EXIT_BREAK;
- if (select_mode == SELECT_MULTI) {
- selected_col++;
- emit_signal("cell_selected");
+ }
+ if (k->get_alt()) {
+ selected_item->set_collapsed(false);
+ TreeItem *next = selected_item->get_children();
+ while (next && next != selected_item->next) {
+ next->set_collapsed(false);
+ next = next->get_next_visible();
+ }
+ } else if (selected_col == (columns.size() - 1)) {
+ if (selected_item->get_children() != NULL && selected_item->is_collapsed()) {
+ selected_item->set_collapsed(false);
+ } else {
+ selected_col = 0;
+ dobreak = false; // fall through to key_down
+ }
} else {
+ if (select_mode == SELECT_MULTI) {
+ selected_col++;
+ emit_signal("cell_selected");
+ } else {
- selected_item->select(selected_col + 1);
+ selected_item->select(selected_col + 1);
+ }
}
-
update();
ensure_cursor_is_visible();
accept_event();
-
- } break;
- case KEY_LEFT: {
-
- //TreeItem *next = NULL;
- if (!selected_item)
+ if (dobreak) {
break;
- if (select_mode == SELECT_ROW)
- EXIT_BREAK;
- if (selected_col <= 0)
- EXIT_BREAK;
- if (select_mode == SELECT_MULTI) {
- selected_col--;
- emit_signal("cell_selected");
- } else {
-
- selected_item->select(selected_col - 1);
}
-
- update();
- accept_event();
-
- } break;
+ }
case KEY_DOWN: {
TreeItem *next = NULL;
@@ -2113,6 +2112,48 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
accept_event();
} break;
+ case KEY_LEFT: {
+ bool dobreak = true;
+
+ //TreeItem *next = NULL;
+ if (!selected_item)
+ break;
+ if (select_mode == SELECT_ROW) {
+ EXIT_BREAK;
+ }
+ if (selected_col < 0) {
+ EXIT_BREAK;
+ }
+ if (k->get_alt()) {
+ selected_item->set_collapsed(true);
+ TreeItem *next = selected_item->get_children();
+ while (next && next != selected_item->next) {
+ next->set_collapsed(true);
+ next = next->get_next_visible();
+ }
+ } else if (selected_col == 0) {
+ 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
+ }
+ } else {
+ if (select_mode == SELECT_MULTI) {
+ selected_col--;
+ emit_signal("cell_selected");
+ } else {
+
+ selected_item->select(selected_col - 1);
+ }
+ }
+ update();
+ accept_event();
+
+ if (dobreak) {
+ break;
+ }
+ }
case KEY_UP: {
TreeItem *prev = NULL;
@@ -2429,7 +2470,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
if (cache.click_type == Cache::CLICK_BUTTON) {
// make sure in case of wrong reference after reconstructing whole TreeItems
- cache.click_item = get_item_at_pos(cache.click_pos);
+ cache.click_item = get_item_at_position(cache.click_pos);
emit_signal("button_pressed", cache.click_item, cache.click_column, cache.click_id);
}
cache.click_type = Cache::CLICK_NONE;
@@ -2489,7 +2530,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
}
if (!root || (!root->get_children() && hide_root)) {
if (b->get_button_index() == BUTTON_RIGHT && allow_rmb_select) {
- emit_signal("empty_tree_rmb_selected", get_local_mouse_pos());
+ emit_signal("empty_tree_rmb_selected", get_local_mouse_position());
}
break;
}
@@ -3387,7 +3428,7 @@ TreeItem *Tree::_find_item_at_pos(TreeItem *p_item, const Point2 &p_pos, int &r_
return NULL;
}
-int Tree::get_column_at_pos(const Point2 &p_pos) const {
+int Tree::get_column_at_position(const Point2 &p_pos) const {
if (root) {
@@ -3413,7 +3454,7 @@ int Tree::get_column_at_pos(const Point2 &p_pos) const {
return -1;
}
-int Tree::get_drop_section_at_pos(const Point2 &p_pos) const {
+int Tree::get_drop_section_at_position(const Point2 &p_pos) const {
if (root) {
@@ -3438,7 +3479,7 @@ int Tree::get_drop_section_at_pos(const Point2 &p_pos) const {
return -100;
}
-TreeItem *Tree::get_item_at_pos(const Point2 &p_pos) const {
+TreeItem *Tree::get_item_at_position(const Point2 &p_pos) const {
if (root) {
@@ -3611,9 +3652,9 @@ void Tree::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_edited_column"), &Tree::get_edited_column);
ClassDB::bind_method(D_METHOD("get_custom_popup_rect"), &Tree::get_custom_popup_rect);
ClassDB::bind_method(D_METHOD("get_item_area_rect", "item", "column"), &Tree::_get_item_rect, DEFVAL(-1));
- ClassDB::bind_method(D_METHOD("get_item_at_pos", "pos"), &Tree::get_item_at_pos);
- ClassDB::bind_method(D_METHOD("get_column_at_pos", "pos"), &Tree::get_column_at_pos);
- ClassDB::bind_method(D_METHOD("get_drop_section_at_pos", "pos"), &Tree::get_drop_section_at_pos);
+ ClassDB::bind_method(D_METHOD("get_item_at_position", "position"), &Tree::get_item_at_position);
+ ClassDB::bind_method(D_METHOD("get_column_at_position", "position"), &Tree::get_column_at_position);
+ ClassDB::bind_method(D_METHOD("get_drop_section_at_position", "position"), &Tree::get_drop_section_at_position);
ClassDB::bind_method(D_METHOD("ensure_cursor_is_visible"), &Tree::ensure_cursor_is_visible);
@@ -3639,8 +3680,8 @@ void Tree::_bind_methods() {
ADD_SIGNAL(MethodInfo("item_selected"));
ADD_SIGNAL(MethodInfo("cell_selected"));
ADD_SIGNAL(MethodInfo("multi_selected", PropertyInfo(Variant::OBJECT, "item"), PropertyInfo(Variant::INT, "column"), PropertyInfo(Variant::BOOL, "selected")));
- ADD_SIGNAL(MethodInfo("item_rmb_selected", PropertyInfo(Variant::VECTOR2, "pos")));
- ADD_SIGNAL(MethodInfo("empty_tree_rmb_selected", PropertyInfo(Variant::VECTOR2, "pos")));
+ ADD_SIGNAL(MethodInfo("item_rmb_selected", PropertyInfo(Variant::VECTOR2, "position")));
+ ADD_SIGNAL(MethodInfo("empty_tree_rmb_selected", PropertyInfo(Variant::VECTOR2, "position")));
ADD_SIGNAL(MethodInfo("item_edited"));
ADD_SIGNAL(MethodInfo("item_rmb_edited"));
ADD_SIGNAL(MethodInfo("item_custom_button_pressed"));
diff --git a/scene/gui/tree.h b/scene/gui/tree.h
index 5f19558597..e723fa227b 100644
--- a/scene/gui/tree.h
+++ b/scene/gui/tree.h
@@ -525,9 +525,9 @@ protected:
public:
virtual String get_tooltip(const Point2 &p_pos) const;
- TreeItem *get_item_at_pos(const Point2 &p_pos) const;
- int get_column_at_pos(const Point2 &p_pos) const;
- int get_drop_section_at_pos(const Point2 &p_pos) const;
+ TreeItem *get_item_at_position(const Point2 &p_pos) const;
+ int get_column_at_position(const Point2 &p_pos) const;
+ int get_drop_section_at_position(const Point2 &p_pos) const;
void clear();
diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp
index a92155cc4f..e08d050ca7 100644
--- a/scene/gui/video_player.cpp
+++ b/scene/gui/video_player.cpp
@@ -278,11 +278,11 @@ String VideoPlayer::get_stream_name() const {
return stream->get_name();
};
-float VideoPlayer::get_stream_pos() const {
+float VideoPlayer::get_stream_position() const {
if (playback.is_null())
return 0;
- return playback->get_pos();
+ return playback->get_position();
};
Ref<Texture> VideoPlayer::get_video_texture() {
@@ -327,7 +327,7 @@ void VideoPlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_stream_name"), &VideoPlayer::get_stream_name);
- ClassDB::bind_method(D_METHOD("get_stream_pos"), &VideoPlayer::get_stream_pos);
+ ClassDB::bind_method(D_METHOD("get_stream_position"), &VideoPlayer::get_stream_position);
ClassDB::bind_method(D_METHOD("set_autoplay", "enabled"), &VideoPlayer::set_autoplay);
ClassDB::bind_method(D_METHOD("has_autoplay"), &VideoPlayer::has_autoplay);
diff --git a/scene/gui/video_player.h b/scene/gui/video_player.h
index b78f3aabe7..bea10907bb 100644
--- a/scene/gui/video_player.h
+++ b/scene/gui/video_player.h
@@ -92,7 +92,7 @@ public:
float get_volume_db() const;
String get_stream_name() const;
- float get_stream_pos() const;
+ float get_stream_position() const;
void set_autoplay(bool p_enable);
bool has_autoplay() const;
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index a30fc03aa9..319f123da9 100755
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -2693,7 +2693,7 @@ void Node::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_to_group", "group", "persistent"), &Node::add_to_group, DEFVAL(false));
ClassDB::bind_method(D_METHOD("remove_from_group", "group"), &Node::remove_from_group);
ClassDB::bind_method(D_METHOD("is_in_group", "group"), &Node::is_in_group);
- ClassDB::bind_method(D_METHOD("move_child", "child_node", "to_pos"), &Node::move_child);
+ ClassDB::bind_method(D_METHOD("move_child", "child_node", "to_position"), &Node::move_child);
ClassDB::bind_method(D_METHOD("get_groups"), &Node::_get_groups);
ClassDB::bind_method(D_METHOD("raise"), &Node::raise);
ClassDB::bind_method(D_METHOD("set_owner", "owner"), &Node::set_owner);
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index d27a1a5641..e19f2031dd 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -1339,7 +1339,7 @@ Vector2 Viewport::get_mouse_position() const {
void Viewport::warp_mouse(const Vector2 &p_pos) {
Vector2 gpos = (get_final_transform().affine_inverse() * _get_input_pre_xform()).affine_inverse().xform(p_pos);
- Input::get_singleton()->warp_mouse_pos(gpos);
+ Input::get_singleton()->warp_mouse_position(gpos);
}
void Viewport::_gui_sort_subwindows() {
@@ -2673,7 +2673,7 @@ void Viewport::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_attach_to_screen_rect", "rect"), &Viewport::set_attach_to_screen_rect);
ClassDB::bind_method(D_METHOD("get_mouse_position"), &Viewport::get_mouse_position);
- ClassDB::bind_method(D_METHOD("warp_mouse", "to_pos"), &Viewport::warp_mouse);
+ ClassDB::bind_method(D_METHOD("warp_mouse", "to_position"), &Viewport::warp_mouse);
ClassDB::bind_method(D_METHOD("gui_has_modal_stack"), &Viewport::gui_has_modal_stack);
ClassDB::bind_method(D_METHOD("gui_get_drag_data"), &Viewport::gui_get_drag_data);
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index eae95d9247..8dcc8d4e14 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -613,7 +613,7 @@ int Animation::transform_track_insert_key(int p_track, float p_time, const Vecto
return ret;
}
-void Animation::track_remove_key_at_pos(int p_track, float p_pos) {
+void Animation::track_remove_key_at_position(int p_track, float p_pos) {
int idx = track_find_key(p_track, p_pos, true);
ERR_FAIL_COND(idx < 0);
@@ -707,12 +707,12 @@ void Animation::track_insert_key(int p_track, float p_time, const Variant &p_key
Dictionary d = p_key;
Vector3 loc;
- if (d.has("loc"))
- loc = d["loc"];
+ if (d.has("location"))
+ loc = d["location"];
Quat rot;
- if (d.has("rot"))
- rot = d["rot"];
+ if (d.has("rotation"))
+ rot = d["rotation"];
Vector3 scale;
if (d.has("scale"))
@@ -799,8 +799,8 @@ Variant Animation::track_get_key_value(int p_track, int p_key_idx) const {
ERR_FAIL_INDEX_V(p_key_idx, tt->transforms.size(), Variant());
Dictionary d;
- d["loc"] = tt->transforms[p_key_idx].value.loc;
- d["rot"] = tt->transforms[p_key_idx].value.rot;
+ d["location"] = tt->transforms[p_key_idx].value.loc;
+ d["rotation"] = tt->transforms[p_key_idx].value.rot;
d["scale"] = tt->transforms[p_key_idx].value.scale;
return d;
@@ -903,10 +903,10 @@ void Animation::track_set_key_value(int p_track, int p_key_idx, const Variant &p
TransformTrack *tt = static_cast<TransformTrack *>(t);
ERR_FAIL_INDEX(p_key_idx, tt->transforms.size());
Dictionary d = p_value;
- if (d.has("loc"))
- tt->transforms[p_key_idx].value.loc = d["loc"];
- if (d.has("rot"))
- tt->transforms[p_key_idx].value.rot = d["rot"];
+ if (d.has("location"))
+ tt->transforms[p_key_idx].value.loc = d["location"];
+ if (d.has("rotation"))
+ tt->transforms[p_key_idx].value.rot = d["rotation"];
if (d.has("scale"))
tt->transforms[p_key_idx].value.scale = d["scale"];
@@ -1590,7 +1590,7 @@ float Animation::get_step() const {
void Animation::_bind_methods() {
- ClassDB::bind_method(D_METHOD("add_track", "type", "at_pos"), &Animation::add_track, DEFVAL(-1));
+ ClassDB::bind_method(D_METHOD("add_track", "type", "at_position"), &Animation::add_track, DEFVAL(-1));
ClassDB::bind_method(D_METHOD("remove_track", "idx"), &Animation::remove_track);
ClassDB::bind_method(D_METHOD("get_track_count"), &Animation::get_track_count);
ClassDB::bind_method(D_METHOD("track_get_type", "idx"), &Animation::track_get_type);
@@ -1604,10 +1604,10 @@ void Animation::_bind_methods() {
ClassDB::bind_method(D_METHOD("track_set_imported", "idx", "imported"), &Animation::track_set_imported);
ClassDB::bind_method(D_METHOD("track_is_imported", "idx"), &Animation::track_is_imported);
- ClassDB::bind_method(D_METHOD("transform_track_insert_key", "idx", "time", "loc", "rot", "scale"), &Animation::transform_track_insert_key);
+ ClassDB::bind_method(D_METHOD("transform_track_insert_key", "idx", "time", "location", "rotation", "scale"), &Animation::transform_track_insert_key);
ClassDB::bind_method(D_METHOD("track_insert_key", "idx", "time", "key", "transition"), &Animation::track_insert_key, DEFVAL(1));
ClassDB::bind_method(D_METHOD("track_remove_key", "idx", "key_idx"), &Animation::track_remove_key);
- ClassDB::bind_method(D_METHOD("track_remove_key_at_pos", "idx", "pos"), &Animation::track_remove_key_at_pos);
+ ClassDB::bind_method(D_METHOD("track_remove_key_at_position", "idx", "position"), &Animation::track_remove_key_at_position);
ClassDB::bind_method(D_METHOD("track_set_key_value", "idx", "key", "value"), &Animation::track_set_key_value);
ClassDB::bind_method(D_METHOD("track_set_key_transition", "idx", "key_idx", "transition"), &Animation::track_set_key_transition);
ClassDB::bind_method(D_METHOD("track_get_key_transition", "idx", "key_idx"), &Animation::track_get_key_transition);
diff --git a/scene/resources/animation.h b/scene/resources/animation.h
index e653f6b124..6235e161a3 100644
--- a/scene/resources/animation.h
+++ b/scene/resources/animation.h
@@ -245,7 +245,7 @@ public:
void track_set_key_value(int p_track, int p_key_idx, const Variant &p_value);
int track_find_key(int p_track, float p_time, bool p_exact = false) const;
void track_remove_key(int p_track, int p_idx);
- void track_remove_key_at_pos(int p_track, float p_pos);
+ void track_remove_key_at_position(int p_track, float p_pos);
int track_get_key_count(int p_track) const;
Variant track_get_key_value(int p_track, int p_key_idx) const;
float track_get_key_time(int p_track, int p_key_idx) const;
diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp
index dff0fb8588..e47cb971ae 100644
--- a/scene/resources/audio_stream_sample.cpp
+++ b/scene/resources/audio_stream_sample.cpp
@@ -61,7 +61,7 @@ int AudioStreamPlaybackSample::get_loop_count() const {
return 0;
}
-float AudioStreamPlaybackSample::get_pos() const {
+float AudioStreamPlaybackSample::get_position() const {
return float(offset >> MIX_FRAC_BITS) / base->mix_rate;
}
diff --git a/scene/resources/audio_stream_sample.h b/scene/resources/audio_stream_sample.h
index 6cb255fedf..46fa78ddcf 100644
--- a/scene/resources/audio_stream_sample.h
+++ b/scene/resources/audio_stream_sample.h
@@ -71,7 +71,7 @@ public:
virtual int get_loop_count() const; //times it looped
- virtual float get_pos() const;
+ virtual float get_position() const;
virtual void seek_pos(float p_time);
virtual void mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames);
diff --git a/scene/resources/bit_mask.cpp b/scene/resources/bit_mask.cpp
index be994e3b33..029a9ef0e8 100644
--- a/scene/resources/bit_mask.cpp
+++ b/scene/resources/bit_mask.cpp
@@ -172,8 +172,8 @@ void BitMap::_bind_methods() {
ClassDB::bind_method(D_METHOD("create", "size"), &BitMap::create);
ClassDB::bind_method(D_METHOD("create_from_image_alpha", "image"), &BitMap::create_from_image_alpha);
- ClassDB::bind_method(D_METHOD("set_bit", "pos", "bit"), &BitMap::set_bit);
- ClassDB::bind_method(D_METHOD("get_bit", "pos"), &BitMap::get_bit);
+ ClassDB::bind_method(D_METHOD("set_bit", "position", "bit"), &BitMap::set_bit);
+ ClassDB::bind_method(D_METHOD("get_bit", "position"), &BitMap::get_bit);
ClassDB::bind_method(D_METHOD("set_bit_rect", "p_rect", "bit"), &BitMap::set_bit_rect);
ClassDB::bind_method(D_METHOD("get_true_bit_count"), &BitMap::get_true_bit_count);
diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp
index 1066848dd1..daa8fc1874 100644
--- a/scene/resources/curve.cpp
+++ b/scene/resources/curve.cpp
@@ -241,7 +241,7 @@ int Curve::set_point_offset(int p_index, float offset) {
return i;
}
-Vector2 Curve::get_point_pos(int p_index) const {
+Vector2 Curve::get_point_position(int p_index) const {
ERR_FAIL_INDEX_V(p_index, _points.size(), Vector2(0, 0));
return _points[p_index].pos;
}
@@ -480,11 +480,10 @@ real_t Curve::interpolate_baked(real_t offset) {
void Curve::_bind_methods() {
- ClassDB::bind_method(D_METHOD("add_point", "pos", "left_tangent", "right_tangent", "left_mode", "right_mode"),
- &Curve::add_point, DEFVAL(0), DEFVAL(0), DEFVAL(TANGENT_FREE), DEFVAL(TANGENT_FREE));
+ ClassDB::bind_method(D_METHOD("add_point", "position", "left_tangent", "right_tangent", "left_mode", "right_mode"), &Curve::add_point, DEFVAL(0), DEFVAL(0), DEFVAL(TANGENT_FREE), DEFVAL(TANGENT_FREE));
ClassDB::bind_method(D_METHOD("remove_point", "index"), &Curve::remove_point);
ClassDB::bind_method(D_METHOD("clear_points"), &Curve::clear_points);
- ClassDB::bind_method(D_METHOD("get_point_pos", "index"), &Curve::get_point_pos);
+ 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("interpolate", "offset"), &Curve::interpolate);
@@ -539,7 +538,7 @@ void Curve2D::add_point(const Vector2 &p_pos, const Vector2 &p_in, const Vector2
emit_signal(CoreStringNames::get_singleton()->changed);
}
-void Curve2D::set_point_pos(int p_index, const Vector2 &p_pos) {
+void Curve2D::set_point_position(int p_index, const Vector2 &p_pos) {
ERR_FAIL_INDEX(p_index, points.size());
@@ -547,7 +546,7 @@ void Curve2D::set_point_pos(int p_index, const Vector2 &p_pos) {
baked_cache_dirty = true;
emit_signal(CoreStringNames::get_singleton()->changed);
}
-Vector2 Curve2D::get_point_pos(int p_index) const {
+Vector2 Curve2D::get_point_position(int p_index) const {
ERR_FAIL_INDEX_V(p_index, points.size(), Vector2());
return points[p_index].pos;
@@ -891,12 +890,12 @@ PoolVector2Array Curve2D::tessellate(int p_max_stages, float p_tolerance) const
void Curve2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_point_count"), &Curve2D::get_point_count);
- ClassDB::bind_method(D_METHOD("add_point", "pos", "in", "out", "atpos"), &Curve2D::add_point, DEFVAL(Vector2()), DEFVAL(Vector2()), DEFVAL(-1));
- ClassDB::bind_method(D_METHOD("set_point_pos", "idx", "pos"), &Curve2D::set_point_pos);
- ClassDB::bind_method(D_METHOD("get_point_pos", "idx"), &Curve2D::get_point_pos);
- ClassDB::bind_method(D_METHOD("set_point_in", "idx", "pos"), &Curve2D::set_point_in);
+ ClassDB::bind_method(D_METHOD("add_point", "position", "in", "out", "at_position"), &Curve2D::add_point, DEFVAL(Vector2()), DEFVAL(Vector2()), DEFVAL(-1));
+ ClassDB::bind_method(D_METHOD("set_point_position", "idx", "position"), &Curve2D::set_point_position);
+ ClassDB::bind_method(D_METHOD("get_point_position", "idx"), &Curve2D::get_point_position);
+ ClassDB::bind_method(D_METHOD("set_point_in", "idx", "position"), &Curve2D::set_point_in);
ClassDB::bind_method(D_METHOD("get_point_in", "idx"), &Curve2D::get_point_in);
- ClassDB::bind_method(D_METHOD("set_point_out", "idx", "pos"), &Curve2D::set_point_out);
+ ClassDB::bind_method(D_METHOD("set_point_out", "idx", "position"), &Curve2D::set_point_out);
ClassDB::bind_method(D_METHOD("get_point_out", "idx"), &Curve2D::get_point_out);
ClassDB::bind_method(D_METHOD("remove_point", "idx"), &Curve2D::remove_point);
ClassDB::bind_method(D_METHOD("clear_points"), &Curve2D::clear_points);
@@ -916,9 +915,6 @@ void Curve2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "bake_interval", PROPERTY_HINT_RANGE, "0.01,512,0.01"), "set_bake_interval", "get_bake_interval");
ADD_PROPERTY(PropertyInfo(Variant::INT, "_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_data", "_get_data");
- /*ADD_PROPERTY( PropertyInfo( Variant::VECTOR3_ARRAY, "points_out"), "set_points_out","get_points_out");
- ADD_PROPERTY( PropertyInfo( Variant::VECTOR3_ARRAY, "points_pos"), "set_points_pos","get_points_pos");
-*/
}
Curve2D::Curve2D() {
@@ -955,7 +951,7 @@ void Curve3D::add_point(const Vector3 &p_pos, const Vector3 &p_in, const Vector3
baked_cache_dirty = true;
emit_signal(CoreStringNames::get_singleton()->changed);
}
-void Curve3D::set_point_pos(int p_index, const Vector3 &p_pos) {
+void Curve3D::set_point_position(int p_index, const Vector3 &p_pos) {
ERR_FAIL_INDEX(p_index, points.size());
@@ -963,7 +959,7 @@ void Curve3D::set_point_pos(int p_index, const Vector3 &p_pos) {
baked_cache_dirty = true;
emit_signal(CoreStringNames::get_singleton()->changed);
}
-Vector3 Curve3D::get_point_pos(int p_index) const {
+Vector3 Curve3D::get_point_position(int p_index) const {
ERR_FAIL_INDEX_V(p_index, points.size(), Vector3());
return points[p_index].pos;
@@ -1386,14 +1382,14 @@ PoolVector3Array Curve3D::tessellate(int p_max_stages, float p_tolerance) const
void Curve3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_point_count"), &Curve3D::get_point_count);
- ClassDB::bind_method(D_METHOD("add_point", "pos", "in", "out", "atpos"), &Curve3D::add_point, DEFVAL(Vector3()), DEFVAL(Vector3()), DEFVAL(-1));
- ClassDB::bind_method(D_METHOD("set_point_pos", "idx", "pos"), &Curve3D::set_point_pos);
- ClassDB::bind_method(D_METHOD("get_point_pos", "idx"), &Curve3D::get_point_pos);
+ ClassDB::bind_method(D_METHOD("add_point", "position", "in", "out", "at_position"), &Curve3D::add_point, DEFVAL(Vector3()), DEFVAL(Vector3()), DEFVAL(-1));
+ ClassDB::bind_method(D_METHOD("set_point_position", "idx", "position"), &Curve3D::set_point_position);
+ ClassDB::bind_method(D_METHOD("get_point_position", "idx"), &Curve3D::get_point_position);
ClassDB::bind_method(D_METHOD("set_point_tilt", "idx", "tilt"), &Curve3D::set_point_tilt);
ClassDB::bind_method(D_METHOD("get_point_tilt", "idx"), &Curve3D::get_point_tilt);
- ClassDB::bind_method(D_METHOD("set_point_in", "idx", "pos"), &Curve3D::set_point_in);
+ ClassDB::bind_method(D_METHOD("set_point_in", "idx", "position"), &Curve3D::set_point_in);
ClassDB::bind_method(D_METHOD("get_point_in", "idx"), &Curve3D::get_point_in);
- ClassDB::bind_method(D_METHOD("set_point_out", "idx", "pos"), &Curve3D::set_point_out);
+ ClassDB::bind_method(D_METHOD("set_point_out", "idx", "position"), &Curve3D::set_point_out);
ClassDB::bind_method(D_METHOD("get_point_out", "idx"), &Curve3D::get_point_out);
ClassDB::bind_method(D_METHOD("remove_point", "idx"), &Curve3D::remove_point);
ClassDB::bind_method(D_METHOD("clear_points"), &Curve3D::clear_points);
@@ -1414,9 +1410,6 @@ void Curve3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "bake_interval", PROPERTY_HINT_RANGE, "0.01,512,0.01"), "set_bake_interval", "get_bake_interval");
ADD_PROPERTY(PropertyInfo(Variant::INT, "_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_data", "_get_data");
- /*ADD_PROPERTY( PropertyInfo( Variant::VECTOR3_ARRAY, "points_out"), "set_points_out","get_points_out");
- ADD_PROPERTY( PropertyInfo( Variant::VECTOR3_ARRAY, "points_pos"), "set_points_pos","get_points_pos");
-*/
}
Curve3D::Curve3D() {
diff --git a/scene/resources/curve.h b/scene/resources/curve.h
index 3071aee5de..e7d47f4056 100644
--- a/scene/resources/curve.h
+++ b/scene/resources/curve.h
@@ -92,7 +92,7 @@ public:
void set_point_value(int p_index, real_t pos);
int set_point_offset(int p_index, float offset);
- Vector2 get_point_pos(int p_index) const;
+ Vector2 get_point_position(int p_index) const;
Point get_point(int p_index) const;
@@ -180,8 +180,8 @@ protected:
public:
int get_point_count() const;
void add_point(const Vector2 &p_pos, const Vector2 &p_in = Vector2(), const Vector2 &p_out = Vector2(), int p_atpos = -1);
- void set_point_pos(int p_index, const Vector2 &p_pos);
- Vector2 get_point_pos(int p_index) const;
+ void set_point_position(int p_index, const Vector2 &p_pos);
+ Vector2 get_point_position(int p_index) const;
void set_point_in(int p_index, const Vector2 &p_in);
Vector2 get_point_in(int p_index) const;
void set_point_out(int p_index, const Vector2 &p_out);
@@ -245,8 +245,8 @@ protected:
public:
int get_point_count() const;
void add_point(const Vector3 &p_pos, const Vector3 &p_in = Vector3(), const Vector3 &p_out = Vector3(), int p_atpos = -1);
- void set_point_pos(int p_index, const Vector3 &p_pos);
- Vector3 get_point_pos(int p_index) const;
+ void set_point_position(int p_index, const Vector3 &p_pos);
+ Vector3 get_point_position(int p_index) const;
void set_point_tilt(int p_index, float p_tilt);
float get_point_tilt(int p_index) const;
void set_point_in(int p_index, const Vector3 &p_in);
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index 1272e5a946..2fbd5ebdd3 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -879,7 +879,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_icon("minus", "GraphEdit", make_icon(icon_zoom_less_png));
theme->set_icon("reset", "GraphEdit", make_icon(icon_zoom_reset_png));
theme->set_icon("more", "GraphEdit", make_icon(icon_zoom_more_png));
- theme->set_icon("snap", "GraphEdit", make_icon(icon_snap_png));
+ theme->set_icon("SnapGrid", "GraphEdit", make_icon(icon_snap_grid_png));
theme->set_stylebox("bg", "GraphEdit", make_stylebox(tree_bg_png, 4, 4, 4, 5));
theme->set_color("grid_minor", "GraphEdit", Color(1, 1, 1, 0.05));
theme->set_color("grid_major", "GraphEdit", Color(1, 1, 1, 0.2));
diff --git a/scene/resources/default_theme/icon_snap.png b/scene/resources/default_theme/icon_snap_grid.png
index 93194d34e7..44db9bdfdc 100644
--- a/scene/resources/default_theme/icon_snap.png
+++ b/scene/resources/default_theme/icon_snap_grid.png
Binary files differ
diff --git a/scene/resources/default_theme/theme_data.h b/scene/resources/default_theme/theme_data.h
index bed4bdb760..6643b4ccc1 100644
--- a/scene/resources/default_theme/theme_data.h
+++ b/scene/resources/default_theme/theme_data.h
@@ -182,8 +182,8 @@ static const unsigned char icon_reload_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, 0x6, 0x62, 0x4b, 0x47, 0x44, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0xa0, 0xbd, 0xa7, 0x93, 0x0, 0x0, 0x1, 0x59, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xcd, 0x92, 0x31, 0x4b, 0x3, 0x31, 0x18, 0x86, 0x9f, 0x5c, 0xe, 0xec, 0x20, 0x76, 0x70, 0x39, 0xd0, 0xe3, 0xba, 0x74, 0x51, 0x41, 0xdd, 0xfc, 0x7, 0xba, 0xb8, 0x8, 0x52, 0xec, 0x2e, 0x4e, 0x3a, 0x88, 0x3f, 0xa3, 0xa3, 0x53, 0x7, 0x47, 0x67, 0x41, 0x17, 0xdd, 0x9c, 0x5c, 0x3b, 0xd8, 0x82, 0x64, 0x68, 0xca, 0xd5, 0x55, 0x11, 0x3c, 0x1a, 0x87, 0x24, 0x2e, 0xd7, 0x72, 0x9e, 0x9e, 0xab, 0xbe, 0xd3, 0xc7, 0x1b, 0x9e, 0x37, 0xf9, 0xbe, 0x7c, 0xf0, 0xd7, 0x12, 0x3f, 0x99, 0x4a, 0xa9, 0xb9, 0x30, 0xc, 0x8f, 0x84, 0x10, 0x7, 0xc0, 0x5a, 0x6e, 0x3f, 0x3a, 0xe7, 0x2e, 0xad, 0xb5, 0xdd, 0x66, 0xb3, 0xf9, 0x51, 0x19, 0x90, 0xa6, 0xe9, 0x92, 0xb5, 0xf6, 0x6, 0x58, 0xaf, 0xb8, 0xb4, 0x27, 0xa5, 0xdc, 0x8d, 0xe3, 0xf8, 0x19, 0x20, 0x28, 0xdf, 0x5c, 0x80, 0x53, 0x60, 0xdf, 0x18, 0x53, 0x37, 0xc6, 0xd4, 0xbd, 0xf7, 0x7b, 0xc0, 0x13, 0xb0, 0x61, 0xad, 0xbd, 0x56, 0x4a, 0xcd, 0x1, 0x84, 0xc5, 0x80, 0x30, 0xc, 0x8f, 0xa6, 0xb0, 0x94, 0x72, 0x33, 0x8e, 0xe3, 0x97, 0xc2, 0xf1, 0xd5, 0x68, 0x34, 0xba, 0xf7, 0xde, 0xf7, 0x80, 0xd, 0x29, 0xe5, 0x21, 0x70, 0xfe, 0xe5, 0x5, 0x42, 0x88, 0x76, 0x5e, 0x9e, 0x96, 0x60, 0x0, 0x92, 0x24, 0x79, 0x75, 0xce, 0x9d, 0x1, 0x4, 0x41, 0xd0, 0xfe, 0xd6, 0x2, 0xb0, 0x2, 0x60, 0x8c, 0xb9, 0xab, 0xe8, 0x1f, 0x6b, 0xed, 0x6d, 0x5e, 0xae, 0xce, 0x2, 0xb4, 0xd6, 0x17, 0x5a, 0x6b, 0x7, 0xcc, 0x3, 0xd4, 0x6a, 0xb5, 0x37, 0xad, 0xf5, 0xc5, 0x4f, 0x1, 0x41, 0x10, 0x7c, 0x19, 0x7c, 0x90, 0x3, 0xc7, 0xc0, 0xa0, 0xe0, 0xf, 0x72, 0xef, 0x9b, 0x84, 0x10, 0xdb, 0x79, 0xd9, 0x9f, 0x5, 0x44, 0x51, 0x94, 0x9, 0x21, 0x5a, 0x40, 0x6, 0x64, 0x42, 0x88, 0x56, 0x14, 0x45, 0x59, 0x19, 0x1e, 0x8f, 0xc7, 0x8b, 0x52, 0xca, 0xe, 0x80, 0x73, 0xee, 0x12, 0xa, 0xbf, 0x90, 0x24, 0x49, 0x7f, 0x38, 0x1c, 0x1e, 0x3, 0x34, 0x1a, 0x8d, 0x7e, 0x11, 0x54, 0x4a, 0x2d, 0x48, 0x29, 0x77, 0xac, 0xb5, 0x1d, 0xef, 0xfd, 0x32, 0xd0, 0x9b, 0x4c, 0x26, 0x5d, 0xa8, 0xd8, 0xc4, 0xb2, 0xf2, 0xf9, 0x4c, 0x55, 0xbd, 0x48, 0xbf, 0xe8, 0x1d, 0x78, 0x70, 0xce, 0x9d, 0x64, 0x59, 0xb6, 0x35, 0x85, 0xff, 0x87, 0x3e, 0x1, 0x53, 0x7, 0x87, 0x11, 0xd3, 0x3a, 0x9b, 0x9e, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
-static const unsigned char icon_snap_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, 0x6, 0x62, 0x4b, 0x47, 0x44, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0xa0, 0xbd, 0xa7, 0x93, 0x0, 0x0, 0x0, 0xc2, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xad, 0x90, 0xbd, 0xa, 0xc2, 0x30, 0x14, 0x85, 0xbf, 0x5b, 0x5c, 0x23, 0xe8, 0x6c, 0x9f, 0xc1, 0xb7, 0xd0, 0x47, 0xd1, 0x47, 0x70, 0x48, 0xa1, 0x43, 0x57, 0xe9, 0xd3, 0x88, 0x93, 0xef, 0xe0, 0xea, 0x5c, 0x9d, 0x1d, 0xb2, 0x96, 0xc6, 0xa1, 0x9, 0xd4, 0xd8, 0xd8, 0x4a, 0xfd, 0x20, 0x10, 0xee, 0xcf, 0xe1, 0xdc, 0x3, 0x1d, 0x8c, 0x31, 0xd6, 0x18, 0x63, 0x9, 0x88, 0xd5, 0x1, 0x92, 0xbe, 0xe2, 0x2f, 0x4c, 0x16, 0x90, 0x98, 0xb5, 0x21, 0x94, 0x52, 0xf2, 0x17, 0x7, 0x6f, 0x7c, 0xb, 0x2b, 0xc6, 0x64, 0x7, 0xb3, 0xa1, 0x1, 0x5b, 0x14, 0x29, 0x50, 0x2, 0x1b, 0x0, 0x44, 0x2e, 0x34, 0xcd, 0x41, 0xb2, 0xec, 0x6, 0x20, 0xdd, 0x61, 0x6f, 0xdf, 0x7, 0xe4, 0x96, 0xaf, 0xc0, 0x32, 0xd0, 0x7d, 0x2, 0x6b, 0xd1, 0xba, 0x4a, 0xfc, 0xdd, 0x91, 0xdb, 0x4b, 0xb7, 0x7c, 0x2, 0x56, 0xd4, 0x75, 0xa, 0x9c, 0x81, 0x5, 0x70, 0x84, 0xe1, 0xc, 0x5a, 0xdb, 0x75, 0xbd, 0x17, 0xad, 0x1f, 0x92, 0xe7, 0x77, 0x60, 0xe7, 0x7a, 0x5b, 0x80, 0x44, 0x29, 0x25, 0xfe, 0xf5, 0x8, 0x28, 0x0, 0xb7, 0xd8, 0x46, 0xa0, 0x75, 0xe5, 0xbe, 0xf3, 0x31, 0xe, 0x7e, 0x23, 0xcc, 0xc2, 0x3a, 0xc2, 0xb9, 0x58, 0xfd, 0x83, 0xc9, 0x2, 0x63, 0x78, 0x1, 0x4a, 0x50, 0x70, 0x86, 0xcc, 0x86, 0x2, 0x4, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
+static const unsigned char icon_snap_grid_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, 0x4, 0x73, 0x42, 0x49, 0x54, 0x8, 0x8, 0x8, 0x8, 0x7c, 0x8, 0x64, 0x88, 0x0, 0x0, 0x0, 0x9, 0x70, 0x48, 0x59, 0x73, 0x0, 0x0, 0xe, 0xc4, 0x0, 0x0, 0xe, 0xc4, 0x1, 0x95, 0x2b, 0xe, 0x1b, 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, 0xc2, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xad, 0x90, 0xbd, 0xa, 0xc2, 0x30, 0x14, 0x85, 0xbf, 0x5b, 0x5c, 0x23, 0xe8, 0x6c, 0x9f, 0xc1, 0xb7, 0xd0, 0x47, 0xd1, 0x47, 0x70, 0x48, 0xa1, 0x43, 0x57, 0xe9, 0xd3, 0x88, 0x93, 0xef, 0xe0, 0xea, 0x5c, 0x9d, 0x1d, 0xb2, 0x96, 0xc6, 0xa1, 0x9, 0xd4, 0xd8, 0xd8, 0x4a, 0xfd, 0x20, 0x10, 0xee, 0xcf, 0xe1, 0xdc, 0x3, 0x1d, 0x8c, 0x31, 0xd6, 0x18, 0x63, 0x9, 0x88, 0xd5, 0x1, 0x92, 0xbe, 0xe2, 0x2f, 0x4c, 0x16, 0x90, 0x98, 0xb5, 0x21, 0x94, 0x52, 0xf2, 0x17, 0x7, 0x6f, 0x7c, 0xb, 0x2b, 0xc6, 0x64, 0x7, 0xb3, 0xa1, 0x1, 0x5b, 0x14, 0x29, 0x50, 0x2, 0x1b, 0x0, 0x44, 0x2e, 0x34, 0xcd, 0x41, 0xb2, 0xec, 0x6, 0x20, 0xdd, 0x61, 0x6f, 0xdf, 0x7, 0xe4, 0x96, 0xaf, 0xc0, 0x32, 0xd0, 0x7d, 0x2, 0x6b, 0xd1, 0xba, 0x4a, 0xfc, 0xdd, 0x91, 0xdb, 0x4b, 0xb7, 0x7c, 0x2, 0x56, 0xd4, 0x75, 0xa, 0x9c, 0x81, 0x5, 0x70, 0x84, 0xe1, 0xc, 0x5a, 0xdb, 0x75, 0xbd, 0x17, 0xad, 0x1f, 0x92, 0xe7, 0x77, 0x60, 0xe7, 0x7a, 0x5b, 0x80, 0x44, 0x29, 0x25, 0xfe, 0xf5, 0x8, 0x28, 0x0, 0xb7, 0xd8, 0x46, 0xa0, 0x75, 0xe5, 0xbe, 0xf3, 0x31, 0xe, 0x7e, 0x23, 0xcc, 0xc2, 0x3a, 0xc2, 0xb9, 0x58, 0xfd, 0x83, 0xc9, 0x2, 0x63, 0x78, 0x1, 0x4a, 0x50, 0x70, 0x86, 0xcc, 0x86, 0x2, 0x4, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
static const unsigned char icon_stop_png[] = {
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp
index 82739b58a0..b2d87c8f35 100644
--- a/scene/resources/dynamic_font.cpp
+++ b/scene/resources/dynamic_font.cpp
@@ -397,7 +397,7 @@ unsigned long DynamicFontAtSize::_ft_stream_io(FT_Stream stream, unsigned long o
FileAccess *f = (FileAccess *)stream->descriptor.pointer;
- if (f->get_pos() != offset) {
+ if (f->get_position() != offset) {
f->seek(offset);
}
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index ea75748b3d..2b44ea4554 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -80,13 +80,13 @@ void Font::update_changes() {
void Font::_bind_methods() {
- ClassDB::bind_method(D_METHOD("draw", "canvas_item", "pos", "string", "modulate", "clip_w"), &Font::draw, DEFVAL(Color(1, 1, 1)), DEFVAL(-1));
+ ClassDB::bind_method(D_METHOD("draw", "canvas_item", "position", "string", "modulate", "clip_w"), &Font::draw, DEFVAL(Color(1, 1, 1)), DEFVAL(-1));
ClassDB::bind_method(D_METHOD("get_ascent"), &Font::get_ascent);
ClassDB::bind_method(D_METHOD("get_descent"), &Font::get_descent);
ClassDB::bind_method(D_METHOD("get_height"), &Font::get_height);
ClassDB::bind_method(D_METHOD("is_distance_field_hint"), &Font::is_distance_field_hint);
ClassDB::bind_method(D_METHOD("get_string_size", "string"), &Font::get_string_size);
- ClassDB::bind_method(D_METHOD("draw_char", "canvas_item", "pos", "char", "next", "modulate"), &Font::draw_char, DEFVAL(-1), DEFVAL(Color(1, 1, 1)));
+ ClassDB::bind_method(D_METHOD("draw_char", "canvas_item", "position", "char", "next", "modulate"), &Font::draw_char, DEFVAL(-1), DEFVAL(Color(1, 1, 1)));
ClassDB::bind_method(D_METHOD("update_changes"), &Font::update_changes);
}
diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp
index 14e2ef83f8..f0304bfaa5 100644
--- a/scene/resources/scene_format_text.cpp
+++ b/scene/resources/scene_format_text.cpp
@@ -679,7 +679,7 @@ Error ResourceInteractiveLoaderText::rename_dependencies(FileAccess *p_f, const
String base_path = local_path.get_base_dir();
- uint64_t tag_end = f->get_pos();
+ uint64_t tag_end = f->get_position();
while (true) {
@@ -741,7 +741,7 @@ Error ResourceInteractiveLoaderText::rename_dependencies(FileAccess *p_f, const
fw->store_line("[ext_resource path=\"" + path + "\" type=\"" + type + "\" id=" + itos(index) + "]");
- tag_end = f->get_pos();
+ tag_end = f->get_position();
}
}
diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp
index 2ca9a14562..3813854922 100644
--- a/scene/resources/shader_graph.cpp
+++ b/scene/resources/shader_graph.cpp
@@ -172,8 +172,8 @@ void ShaderGraph::_bind_methods() {
ClassDB::bind_method(D_METHOD("node_add","shader_type","node_type","id"),&ShaderGraph::node_add);
ClassDB::bind_method(D_METHOD("node_remove","shader_type","id"),&ShaderGraph::node_remove);
- ClassDB::bind_method(D_METHOD("node_set_pos","shader_type","id","pos"),&ShaderGraph::node_set_pos);
- ClassDB::bind_method(D_METHOD("node_get_pos","shader_type","id"),&ShaderGraph::node_get_pos);
+ ClassDB::bind_method(D_METHOD("node_set_position","shader_type","id","position"),&ShaderGraph::node_set_position);
+ ClassDB::bind_method(D_METHOD("node_get_position","shader_type","id"),&ShaderGraph::node_get_position);
ClassDB::bind_method(D_METHOD("node_get_type","shader_type","id"),&ShaderGraph::node_get_type);
@@ -501,7 +501,7 @@ void ShaderGraph::node_add(ShaderType p_type, NodeType p_node_type,int p_id) {
_request_update();
}
-void ShaderGraph::node_set_pos(ShaderType p_type,int p_id, const Vector2& p_pos) {
+void ShaderGraph::node_set_position(ShaderType p_type,int p_id, const Vector2& p_pos) {
ERR_FAIL_INDEX(p_type,3);
ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
@@ -509,7 +509,7 @@ void ShaderGraph::node_set_pos(ShaderType p_type,int p_id, const Vector2& p_pos)
_request_update();
}
-Vector2 ShaderGraph::node_get_pos(ShaderType p_type,int p_id) const {
+Vector2 ShaderGraph::node_get_position(ShaderType p_type,int p_id) const {
ERR_FAIL_INDEX_V(p_type,3,Vector2());
ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),Vector2());
@@ -1245,7 +1245,7 @@ Variant ShaderGraph::node_get_state(ShaderType p_type,int p_id) const {
ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),Variant());
const Node& n = shader[p_type].node_map[p_id];
Dictionary s;
- s["pos"]=n.pos;
+ s["position"]=n.pos;
s["param1"]=n.param1;
s["param2"]=n.param2;
Array keys;
@@ -1263,12 +1263,12 @@ void ShaderGraph::node_set_state(ShaderType p_type,int p_id,const Variant& p_sta
ERR_FAIL_COND(!shader[p_type].node_map.has(p_id));
Node& n = shader[p_type].node_map[p_id];
Dictionary d = p_state;
- ERR_FAIL_COND(!d.has("pos"));
+ ERR_FAIL_COND(!d.has("position"));
ERR_FAIL_COND(!d.has("param1"));
ERR_FAIL_COND(!d.has("param2"));
ERR_FAIL_COND(!d.has("default_keys"));
- n.pos=d["pos"];
+ n.pos=d["position"];
n.param1=d["param1"];
n.param2=d["param2"];
Array keys = d["default_keys"];
diff --git a/scene/resources/shader_graph.h b/scene/resources/shader_graph.h
index 9a74b6c53a..5d9dd7054f 100644
--- a/scene/resources/shader_graph.h
+++ b/scene/resources/shader_graph.h
@@ -195,8 +195,8 @@ public:
void node_add(ShaderType p_type, NodeType p_node_type, int p_id);
void node_remove(ShaderType p_which,int p_id);
- void node_set_pos(ShaderType p_which,int p_id,const Point2& p_pos);
- Point2 node_get_pos(ShaderType p_which,int p_id) const;
+ void node_set_position(ShaderType p_which,int p_id,const Point2& p_pos);
+ Point2 node_get_position(ShaderType p_which,int p_id) const;
void get_node_list(ShaderType p_which,List<int> *p_node_list) const;
NodeType node_get_type(ShaderType p_which,int p_id) const;
diff --git a/scene/resources/sky_box.cpp b/scene/resources/sky_box.cpp
index 9af8c42110..2ef20f67f5 100644
--- a/scene/resources/sky_box.cpp
+++ b/scene/resources/sky_box.cpp
@@ -419,10 +419,10 @@ void ProceduralSky::_queue_update() {
call_deferred("_update_sky");
}
-void ProceduralSky::_thread_done(const Ref<Image> &image) {
+void ProceduralSky::_thread_done(const Ref<Image> &p_image) {
- VS::get_singleton()->texture_allocate(texture, image->get_width(), image->get_height(), Image::FORMAT_RGBE9995, VS::TEXTURE_FLAG_FILTER | VS::TEXTURE_FLAG_REPEAT);
- VS::get_singleton()->texture_set_data(texture, image);
+ VS::get_singleton()->texture_allocate(texture, p_image->get_width(), p_image->get_height(), Image::FORMAT_RGBE9995, VS::TEXTURE_FLAG_FILTER | VS::TEXTURE_FLAG_REPEAT);
+ VS::get_singleton()->texture_set_data(texture, p_image);
_radiance_changed();
Thread::wait_to_finish(sky_thread);
memdelete(sky_thread);
diff --git a/scene/resources/style_box.h b/scene/resources/style_box.h
index 3d085f7166..4627c900ff 100644
--- a/scene/resources/style_box.h
+++ b/scene/resources/style_box.h
@@ -178,7 +178,7 @@ public:
void set_border_width_all(int p_size);
int get_border_width_min() const;
- void set_border_width(Margin p_margin, int p_size);
+ void set_border_width(Margin p_margin, int p_width);
int get_border_width(Margin p_margin) const;
//blend
@@ -214,7 +214,7 @@ public:
int get_shadow_size() const;
//ANTI_ALIASING
- void set_anti_aliased(const bool &p_anit_aliasing);
+ void set_anti_aliased(const bool &p_anti_aliased);
bool is_anti_aliased() const;
//tempAA
void set_aa_size(const int &p_aa_size);
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 6a9ded9ea3..c202fad1a4 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -70,7 +70,7 @@ void Texture::_bind_methods() {
ClassDB::bind_method(D_METHOD("has_alpha"), &Texture::has_alpha);
ClassDB::bind_method(D_METHOD("set_flags", "flags"), &Texture::set_flags);
ClassDB::bind_method(D_METHOD("get_flags"), &Texture::get_flags);
- ClassDB::bind_method(D_METHOD("draw", "canvas_item", "pos", "modulate", "transpose", "normal_map"), &Texture::draw, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()));
+ ClassDB::bind_method(D_METHOD("draw", "canvas_item", "position", "modulate", "transpose", "normal_map"), &Texture::draw, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("draw_rect", "canvas_item", "rect", "tile", "modulate", "transpose", "normal_map"), &Texture::draw_rect, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("draw_rect_region", "canvas_item", "rect", "src_rect", "modulate", "transpose", "normal_map", "clip_uv"), &Texture::draw_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(true));
ClassDB::bind_method(D_METHOD("get_data"), &Texture::get_data);
@@ -488,7 +488,7 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &fla
while (mipmaps > 1 && p_size_limit > 0 && (sw > p_size_limit || sh > p_size_limit)) {
- f->seek(f->get_pos() + size);
+ f->seek(f->get_position() + size);
mipmaps = f->get_32();
size = f->get_32();
@@ -610,7 +610,7 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &fla
ERR_FAIL_V(ERR_FILE_CORRUPT);
}
- f->seek(f->get_pos() + ofs);
+ f->seek(f->get_position() + ofs);
PoolVector<uint8_t> img_data;
img_data.resize(total_size - ofs);
diff --git a/scene/resources/video_stream.h b/scene/resources/video_stream.h
index e08be02a07..30264691ee 100644
--- a/scene/resources/video_stream.h
+++ b/scene/resources/video_stream.h
@@ -55,7 +55,7 @@ public:
virtual float get_length() const = 0;
- virtual float get_pos() const = 0;
+ virtual float get_position() const = 0;
virtual void seek_pos(float p_time) = 0;
virtual void set_audio_track(int p_idx) = 0;
diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp
index dd4240f028..b6be2fb9d6 100644
--- a/servers/audio/audio_stream.cpp
+++ b/servers/audio/audio_stream.cpp
@@ -178,9 +178,9 @@ int AudioStreamPlaybackRandomPitch::get_loop_count() const {
return 0;
}
-float AudioStreamPlaybackRandomPitch::get_pos() const {
+float AudioStreamPlaybackRandomPitch::get_position() const {
if (playing.is_valid()) {
- return playing->get_pos();
+ return playing->get_position();
}
return 0;
diff --git a/servers/audio/audio_stream.h b/servers/audio/audio_stream.h
index c7cb63ef2c..97178ebd7c 100644
--- a/servers/audio/audio_stream.h
+++ b/servers/audio/audio_stream.h
@@ -45,7 +45,7 @@ public:
virtual int get_loop_count() const = 0; //times it looped
- virtual float get_pos() const = 0;
+ virtual float get_position() const = 0;
virtual void seek_pos(float p_time) = 0;
virtual void mix(AudioFrame *p_bufer, float p_rate_scale, int p_frames) = 0;
@@ -133,7 +133,7 @@ public:
virtual int get_loop_count() const; //times it looped
- virtual float get_pos() const;
+ virtual float get_position() const;
virtual void seek_pos(float p_time);
virtual void mix(AudioFrame *p_bufer, float p_rate_scale, int p_frames);
diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp
index 4b728f821a..18b7014595 100644
--- a/servers/audio_server.cpp
+++ b/servers/audio_server.cpp
@@ -32,6 +32,7 @@
#include "os/file_access.h"
#include "os/os.h"
#include "project_settings.h"
+#include "servers/audio/audio_driver_dummy.h"
#include "servers/audio/effects/audio_effect_compressor.h"
#ifdef TOOLS_ENABLED
@@ -107,6 +108,7 @@ AudioDriver::AudioDriver() {
AudioDriver *AudioDriverManager::drivers[MAX_DRIVERS];
int AudioDriverManager::driver_count = 0;
+AudioDriverDummy AudioDriverManager::dummy_driver;
void AudioDriverManager::add_driver(AudioDriver *p_driver) {
@@ -118,6 +120,43 @@ int AudioDriverManager::get_driver_count() {
return driver_count;
}
+
+void AudioDriverManager::initialize(int p_driver) {
+ AudioDriver *driver;
+ int failed_driver = -1;
+
+ // Check if there is a selected driver
+ if (p_driver >= 0 && p_driver < driver_count) {
+ if (drivers[p_driver]->init() == OK) {
+ drivers[p_driver]->set_singleton();
+ return;
+ } else {
+ failed_driver = p_driver;
+ }
+ }
+
+ // No selected driver, try them all in order
+ for (int i = 0; i < driver_count; i++) {
+ // Don't re-init the driver if it failed above
+ if (i == failed_driver) {
+ continue;
+ }
+
+ if (drivers[i]->init() == OK) {
+ drivers[i]->set_singleton();
+ return;
+ }
+ }
+
+ // Fallback to our dummy driver
+ if (dummy_driver.init() == OK) {
+ ERR_PRINT("AudioDriverManager: all drivers failed, falling back to dummy driver");
+ dummy_driver.set_singleton();
+ } else {
+ ERR_PRINT("AudioDriverManager: dummy driver faild to init()");
+ }
+}
+
AudioDriver *AudioDriverManager::get_driver(int p_driver) {
ERR_FAIL_INDEX_V(p_driver, driver_count, NULL);
@@ -1049,7 +1088,7 @@ void AudioServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_bus_count"), &AudioServer::get_bus_count);
ClassDB::bind_method(D_METHOD("remove_bus", "index"), &AudioServer::remove_bus);
- ClassDB::bind_method(D_METHOD("add_bus", "at_pos"), &AudioServer::add_bus, DEFVAL(-1));
+ ClassDB::bind_method(D_METHOD("add_bus", "at_position"), &AudioServer::add_bus, DEFVAL(-1));
ClassDB::bind_method(D_METHOD("move_bus", "index", "to_index"), &AudioServer::move_bus);
ClassDB::bind_method(D_METHOD("set_bus_name", "bus_idx", "name"), &AudioServer::set_bus_name);
@@ -1071,7 +1110,7 @@ void AudioServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_bus_bypass_effects", "bus_idx", "enable"), &AudioServer::set_bus_bypass_effects);
ClassDB::bind_method(D_METHOD("is_bus_bypassing_effects", "bus_idx"), &AudioServer::is_bus_bypassing_effects);
- ClassDB::bind_method(D_METHOD("add_bus_effect", "bus_idx", "effect", "at_pos"), &AudioServer::add_bus_effect, DEFVAL(-1));
+ ClassDB::bind_method(D_METHOD("add_bus_effect", "bus_idx", "effect", "at_position"), &AudioServer::add_bus_effect, DEFVAL(-1));
ClassDB::bind_method(D_METHOD("remove_bus_effect", "bus_idx", "effect_idx"), &AudioServer::remove_bus_effect);
ClassDB::bind_method(D_METHOD("get_bus_effect_count", "bus_idx"), &AudioServer::get_bus_effect_count);
diff --git a/servers/audio_server.h b/servers/audio_server.h
index c479d09a3c..55e9367308 100644
--- a/servers/audio_server.h
+++ b/servers/audio_server.h
@@ -35,6 +35,8 @@
#include "servers/audio/audio_effect.h"
#include "variant.h"
+class AudioDriverDummy;
+
class AudioDriver {
static AudioDriver *singleton;
@@ -90,8 +92,11 @@ class AudioDriverManager {
static AudioDriver *drivers[MAX_DRIVERS];
static int driver_count;
+ static AudioDriverDummy dummy_driver;
+
public:
static void add_driver(AudioDriver *p_driver);
+ static void initialize(int p_driver);
static int get_driver_count();
static AudioDriver *get_driver(int p_driver);
};
diff --git a/servers/physics/body_sw.h b/servers/physics/body_sw.h
index 7e8d31f8eb..782bf14a4b 100644
--- a/servers/physics/body_sw.h
+++ b/servers/physics/body_sw.h
@@ -399,7 +399,7 @@ public:
virtual int get_contact_count() const { return body->contact_count; }
- virtual Vector3 get_contact_local_pos(int p_contact_idx) const {
+ virtual Vector3 get_contact_local_position(int p_contact_idx) const {
ERR_FAIL_INDEX_V(p_contact_idx, body->contact_count, Vector3());
return body->contacts[p_contact_idx].local_pos;
}
@@ -416,7 +416,7 @@ public:
ERR_FAIL_INDEX_V(p_contact_idx, body->contact_count, RID());
return body->contacts[p_contact_idx].collider;
}
- virtual Vector3 get_contact_collider_pos(int p_contact_idx) const {
+ virtual Vector3 get_contact_collider_position(int p_contact_idx) const {
ERR_FAIL_INDEX_V(p_contact_idx, body->contact_count, Vector3());
return body->contacts[p_contact_idx].collider_pos;
}
@@ -428,7 +428,7 @@ public:
ERR_FAIL_INDEX_V(p_contact_idx, body->contact_count, 0);
return body->contacts[p_contact_idx].collider_shape;
}
- virtual Vector3 get_contact_collider_velocity_at_pos(int p_contact_idx) const {
+ virtual Vector3 get_contact_collider_velocity_at_position(int p_contact_idx) const {
ERR_FAIL_INDEX_V(p_contact_idx, body->contact_count, Vector3());
return body->contacts[p_contact_idx].collider_velocity_at_pos;
}
diff --git a/servers/physics/broad_phase_basic.h b/servers/physics/broad_phase_basic.h
index 51a24f4678..5c124c1792 100644
--- a/servers/physics/broad_phase_basic.h
+++ b/servers/physics/broad_phase_basic.h
@@ -82,7 +82,7 @@ class BroadPhaseBasic : public BroadPhaseSW {
public:
// 0 is an invalid ID
- virtual ID create(CollisionObjectSW *p_object_, int p_subindex = 0);
+ virtual ID create(CollisionObjectSW *p_object, int p_subindex = 0);
virtual void move(ID p_id, const Rect3 &p_aabb);
virtual void set_static(ID p_id, bool p_static);
virtual void remove(ID p_id);
diff --git a/servers/physics/joints/pin_joint_sw.h b/servers/physics/joints/pin_joint_sw.h
index 670c1ab61f..ee9272ce06 100644
--- a/servers/physics/joints/pin_joint_sw.h
+++ b/servers/physics/joints/pin_joint_sw.h
@@ -86,8 +86,8 @@ public:
void set_pos_a(const Vector3 &p_pos) { m_pivotInA = p_pos; }
void set_pos_b(const Vector3 &p_pos) { m_pivotInB = p_pos; }
- Vector3 get_pos_a() { return m_pivotInB; }
- Vector3 get_pos_b() { return m_pivotInA; }
+ Vector3 get_position_a() { return m_pivotInB; }
+ Vector3 get_position_b() { return m_pivotInA; }
PinJointSW(BodySW *p_body_a, const Vector3 &p_pos_a, BodySW *p_body_b, const Vector3 &p_pos_b);
~PinJointSW();
diff --git a/servers/physics/physics_server_sw.cpp b/servers/physics/physics_server_sw.cpp
index 2d46770924..a0c9f9cd42 100644
--- a/servers/physics/physics_server_sw.cpp
+++ b/servers/physics/physics_server_sw.cpp
@@ -968,7 +968,7 @@ Vector3 PhysicsServerSW::pin_joint_get_local_a(RID p_joint) const {
ERR_FAIL_COND_V(!joint, Vector3());
ERR_FAIL_COND_V(joint->get_type() != JOINT_PIN, Vector3());
PinJointSW *pin_joint = static_cast<PinJointSW *>(joint);
- return pin_joint->get_pos_a();
+ return pin_joint->get_position_a();
}
void PhysicsServerSW::pin_joint_set_local_b(RID p_joint, const Vector3 &p_B) {
@@ -985,7 +985,7 @@ Vector3 PhysicsServerSW::pin_joint_get_local_b(RID p_joint) const {
ERR_FAIL_COND_V(!joint, Vector3());
ERR_FAIL_COND_V(joint->get_type() != JOINT_PIN, Vector3());
PinJointSW *pin_joint = static_cast<PinJointSW *>(joint);
- return pin_joint->get_pos_b();
+ return pin_joint->get_position_b();
}
RID PhysicsServerSW::joint_create_hinge(RID p_body_A, const Transform &p_frame_A, RID p_body_B, const Transform &p_frame_B) {
diff --git a/servers/physics_2d/body_2d_sw.h b/servers/physics_2d/body_2d_sw.h
index 0ffad62f45..f7c717a5c6 100644
--- a/servers/physics_2d/body_2d_sw.h
+++ b/servers/physics_2d/body_2d_sw.h
@@ -353,7 +353,7 @@ public:
virtual int get_contact_count() const { return body->contact_count; }
- virtual Vector2 get_contact_local_pos(int p_contact_idx) const {
+ virtual Vector2 get_contact_local_position(int p_contact_idx) const {
ERR_FAIL_INDEX_V(p_contact_idx, body->contact_count, Vector2());
return body->contacts[p_contact_idx].local_pos;
}
@@ -370,7 +370,7 @@ public:
ERR_FAIL_INDEX_V(p_contact_idx, body->contact_count, RID());
return body->contacts[p_contact_idx].collider;
}
- virtual Vector2 get_contact_collider_pos(int p_contact_idx) const {
+ virtual Vector2 get_contact_collider_position(int p_contact_idx) const {
ERR_FAIL_INDEX_V(p_contact_idx, body->contact_count, Vector2());
return body->contacts[p_contact_idx].collider_pos;
}
@@ -384,7 +384,7 @@ public:
}
virtual Variant get_contact_collider_shape_metadata(int p_contact_idx) const;
- virtual Vector2 get_contact_collider_velocity_at_pos(int p_contact_idx) const {
+ virtual Vector2 get_contact_collider_velocity_at_position(int p_contact_idx) const {
ERR_FAIL_INDEX_V(p_contact_idx, body->contact_count, Vector2());
return body->contacts[p_contact_idx].collider_velocity_at_pos;
}
diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp
index 779f0d54ac..8f22d1cd44 100644
--- a/servers/physics_2d/space_2d_sw.cpp
+++ b/servers/physics_2d/space_2d_sw.cpp
@@ -518,7 +518,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
body_aabb = body_aabb.grow(p_margin);
static const int max_excluded_shape_pairs = 32;
- Pair<Shape2DSW *, Shape2DSW *> excluded_shape_pairs[max_excluded_shape_pairs];
+ ExcludedShapeSW excluded_shape_pairs[max_excluded_shape_pairs];
int excluded_shape_pair_count = 0;
Transform2D body_transform = p_from;
@@ -577,7 +577,11 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
if (!collided && cbk.invalid_by_dir > 0) {
//this shape must be excluded
if (excluded_shape_pair_count < max_excluded_shape_pairs) {
- excluded_shape_pairs[excluded_shape_pair_count++] = Pair<Shape2DSW *, Shape2DSW *>(body_shape, against_shape);
+ ExcludedShapeSW esp;
+ esp.local_shape = body_shape;
+ esp.against_object = col_obj;
+ esp.against_shape_index = shape_idx;
+ excluded_shape_pairs[excluded_shape_pair_count++] = esp;
}
}
}
@@ -645,7 +649,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
for (int k = 0; k < excluded_shape_pair_count; k++) {
- if (excluded_shape_pairs[k].first == body_shape && excluded_shape_pairs[k].second == against_shape) {
+ if (excluded_shape_pairs[k].local_shape == body_shape && excluded_shape_pairs[k].against_object == col_obj && excluded_shape_pairs[k].against_shape_index == shape_idx) {
excluded = true;
break;
}
@@ -776,7 +780,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
bool excluded = false;
for (int k = 0; k < excluded_shape_pair_count; k++) {
- if (excluded_shape_pairs[k].first == body_shape && excluded_shape_pairs[k].second == against_shape) {
+ if (excluded_shape_pairs[k].local_shape == body_shape && excluded_shape_pairs[k].against_object == col_obj && excluded_shape_pairs[k].against_shape_index == shape_idx) {
excluded = true;
break;
}
diff --git a/servers/physics_2d/space_2d_sw.h b/servers/physics_2d/space_2d_sw.h
index ed6136e372..c7e7497397 100644
--- a/servers/physics_2d/space_2d_sw.h
+++ b/servers/physics_2d/space_2d_sw.h
@@ -71,6 +71,12 @@ public:
};
private:
+ struct ExcludedShapeSW {
+ Shape2DSW *local_shape;
+ const CollisionObject2DSW *against_object;
+ int against_shape_index;
+ };
+
uint64_t elapsed_time[ELAPSED_TIME_MAX];
Physics2DDirectSpaceStateSW *direct_access;
diff --git a/servers/physics_2d_server.cpp b/servers/physics_2d_server.cpp
index 06966e2452..b42b85b1be 100644
--- a/servers/physics_2d_server.cpp
+++ b/servers/physics_2d_server.cpp
@@ -92,16 +92,16 @@ void Physics2DDirectBodyState::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_contact_count"), &Physics2DDirectBodyState::get_contact_count);
- ClassDB::bind_method(D_METHOD("get_contact_local_pos", "contact_idx"), &Physics2DDirectBodyState::get_contact_local_pos);
+ ClassDB::bind_method(D_METHOD("get_contact_local_position", "contact_idx"), &Physics2DDirectBodyState::get_contact_local_position);
ClassDB::bind_method(D_METHOD("get_contact_local_normal", "contact_idx"), &Physics2DDirectBodyState::get_contact_local_normal);
ClassDB::bind_method(D_METHOD("get_contact_local_shape", "contact_idx"), &Physics2DDirectBodyState::get_contact_local_shape);
ClassDB::bind_method(D_METHOD("get_contact_collider", "contact_idx"), &Physics2DDirectBodyState::get_contact_collider);
- ClassDB::bind_method(D_METHOD("get_contact_collider_pos", "contact_idx"), &Physics2DDirectBodyState::get_contact_collider_pos);
+ ClassDB::bind_method(D_METHOD("get_contact_collider_position", "contact_idx"), &Physics2DDirectBodyState::get_contact_collider_position);
ClassDB::bind_method(D_METHOD("get_contact_collider_id", "contact_idx"), &Physics2DDirectBodyState::get_contact_collider_id);
ClassDB::bind_method(D_METHOD("get_contact_collider_object", "contact_idx"), &Physics2DDirectBodyState::get_contact_collider_object);
ClassDB::bind_method(D_METHOD("get_contact_collider_shape", "contact_idx"), &Physics2DDirectBodyState::get_contact_collider_shape);
ClassDB::bind_method(D_METHOD("get_contact_collider_shape_metadata", "contact_idx"), &Physics2DDirectBodyState::get_contact_collider_shape_metadata);
- ClassDB::bind_method(D_METHOD("get_contact_collider_velocity_at_pos", "contact_idx"), &Physics2DDirectBodyState::get_contact_collider_velocity_at_pos);
+ ClassDB::bind_method(D_METHOD("get_contact_collider_velocity_at_position", "contact_idx"), &Physics2DDirectBodyState::get_contact_collider_velocity_at_position);
ClassDB::bind_method(D_METHOD("get_step"), &Physics2DDirectBodyState::get_step);
ClassDB::bind_method(D_METHOD("integrate_forces"), &Physics2DDirectBodyState::integrate_forces);
ClassDB::bind_method(D_METHOD("get_space_state"), &Physics2DDirectBodyState::get_space_state);
@@ -561,7 +561,7 @@ void Physics2DServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("body_set_state", "body", "state", "value"), &Physics2DServer::body_set_state);
ClassDB::bind_method(D_METHOD("body_get_state", "body", "state"), &Physics2DServer::body_get_state);
- ClassDB::bind_method(D_METHOD("body_apply_impulse", "body", "pos", "impulse"), &Physics2DServer::body_apply_impulse);
+ ClassDB::bind_method(D_METHOD("body_apply_impulse", "body", "position", "impulse"), &Physics2DServer::body_apply_impulse);
ClassDB::bind_method(D_METHOD("body_add_force", "body", "offset", "force"), &Physics2DServer::body_add_force);
ClassDB::bind_method(D_METHOD("body_set_axis_velocity", "body", "axis_velocity"), &Physics2DServer::body_set_axis_velocity);
diff --git a/servers/physics_2d_server.h b/servers/physics_2d_server.h
index cd6a20e6b8..ddf89663c0 100644
--- a/servers/physics_2d_server.h
+++ b/servers/physics_2d_server.h
@@ -65,17 +65,17 @@ public:
virtual int get_contact_count() const = 0;
- virtual Vector2 get_contact_local_pos(int p_contact_idx) const = 0;
+ virtual Vector2 get_contact_local_position(int p_contact_idx) const = 0;
virtual Vector2 get_contact_local_normal(int p_contact_idx) const = 0;
virtual int get_contact_local_shape(int p_contact_idx) const = 0;
virtual RID get_contact_collider(int p_contact_idx) const = 0;
- virtual Vector2 get_contact_collider_pos(int p_contact_idx) const = 0;
+ virtual Vector2 get_contact_collider_position(int p_contact_idx) const = 0;
virtual ObjectID get_contact_collider_id(int p_contact_idx) const = 0;
virtual Object *get_contact_collider_object(int p_contact_idx) const;
virtual int get_contact_collider_shape(int p_contact_idx) const = 0;
virtual Variant get_contact_collider_shape_metadata(int p_contact_idx) const = 0;
- virtual Vector2 get_contact_collider_velocity_at_pos(int p_contact_idx) const = 0;
+ virtual Vector2 get_contact_collider_velocity_at_position(int p_contact_idx) const = 0;
virtual real_t get_step() const = 0;
virtual void integrate_forces();
diff --git a/servers/physics_server.cpp b/servers/physics_server.cpp
index 28ab31b8f6..0e54867ee1 100644
--- a/servers/physics_server.cpp
+++ b/servers/physics_server.cpp
@@ -89,8 +89,8 @@ void PhysicsDirectBodyState::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_transform", "transform"), &PhysicsDirectBodyState::set_transform);
ClassDB::bind_method(D_METHOD("get_transform"), &PhysicsDirectBodyState::get_transform);
- ClassDB::bind_method(D_METHOD("add_force", "force", "pos"), &PhysicsDirectBodyState::add_force);
- ClassDB::bind_method(D_METHOD("apply_impulse", "pos", "j"), &PhysicsDirectBodyState::apply_impulse);
+ ClassDB::bind_method(D_METHOD("add_force", "force", "position"), &PhysicsDirectBodyState::add_force);
+ ClassDB::bind_method(D_METHOD("apply_impulse", "position", "j"), &PhysicsDirectBodyState::apply_impulse);
ClassDB::bind_method(D_METHOD("apply_torqe_impulse", "j"), &PhysicsDirectBodyState::apply_torque_impulse);
ClassDB::bind_method(D_METHOD("set_sleep_state", "enabled"), &PhysicsDirectBodyState::set_sleep_state);
@@ -98,15 +98,15 @@ void PhysicsDirectBodyState::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_contact_count"), &PhysicsDirectBodyState::get_contact_count);
- ClassDB::bind_method(D_METHOD("get_contact_local_pos", "contact_idx"), &PhysicsDirectBodyState::get_contact_local_pos);
+ ClassDB::bind_method(D_METHOD("get_contact_local_position", "contact_idx"), &PhysicsDirectBodyState::get_contact_local_position);
ClassDB::bind_method(D_METHOD("get_contact_local_normal", "contact_idx"), &PhysicsDirectBodyState::get_contact_local_normal);
ClassDB::bind_method(D_METHOD("get_contact_local_shape", "contact_idx"), &PhysicsDirectBodyState::get_contact_local_shape);
ClassDB::bind_method(D_METHOD("get_contact_collider", "contact_idx"), &PhysicsDirectBodyState::get_contact_collider);
- ClassDB::bind_method(D_METHOD("get_contact_collider_pos", "contact_idx"), &PhysicsDirectBodyState::get_contact_collider_pos);
+ ClassDB::bind_method(D_METHOD("get_contact_collider_position", "contact_idx"), &PhysicsDirectBodyState::get_contact_collider_position);
ClassDB::bind_method(D_METHOD("get_contact_collider_id", "contact_idx"), &PhysicsDirectBodyState::get_contact_collider_id);
ClassDB::bind_method(D_METHOD("get_contact_collider_object", "contact_idx"), &PhysicsDirectBodyState::get_contact_collider_object);
ClassDB::bind_method(D_METHOD("get_contact_collider_shape", "contact_idx"), &PhysicsDirectBodyState::get_contact_collider_shape);
- ClassDB::bind_method(D_METHOD("get_contact_collider_velocity_at_pos", "contact_idx"), &PhysicsDirectBodyState::get_contact_collider_velocity_at_pos);
+ ClassDB::bind_method(D_METHOD("get_contact_collider_velocity_at_position", "contact_idx"), &PhysicsDirectBodyState::get_contact_collider_velocity_at_position);
ClassDB::bind_method(D_METHOD("get_step"), &PhysicsDirectBodyState::get_step);
ClassDB::bind_method(D_METHOD("integrate_forces"), &PhysicsDirectBodyState::integrate_forces);
ClassDB::bind_method(D_METHOD("get_space_state"), &PhysicsDirectBodyState::get_space_state);
@@ -482,7 +482,7 @@ void PhysicsServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("body_set_state", "body", "state", "value"), &PhysicsServer::body_set_state);
ClassDB::bind_method(D_METHOD("body_get_state", "body", "state"), &PhysicsServer::body_get_state);
- ClassDB::bind_method(D_METHOD("body_apply_impulse", "body", "pos", "impulse"), &PhysicsServer::body_apply_impulse);
+ ClassDB::bind_method(D_METHOD("body_apply_impulse", "body", "position", "impulse"), &PhysicsServer::body_apply_impulse);
ClassDB::bind_method(D_METHOD("body_apply_torque_impulse", "body", "impulse"), &PhysicsServer::body_apply_torque_impulse);
ClassDB::bind_method(D_METHOD("body_set_axis_velocity", "body", "axis_velocity"), &PhysicsServer::body_set_axis_velocity);
diff --git a/servers/physics_server.h b/servers/physics_server.h
index c6d312e0fe..32aaafa28c 100644
--- a/servers/physics_server.h
+++ b/servers/physics_server.h
@@ -71,16 +71,16 @@ public:
virtual int get_contact_count() const = 0;
- virtual Vector3 get_contact_local_pos(int p_contact_idx) const = 0;
+ virtual Vector3 get_contact_local_position(int p_contact_idx) const = 0;
virtual Vector3 get_contact_local_normal(int p_contact_idx) const = 0;
virtual int get_contact_local_shape(int p_contact_idx) const = 0;
virtual RID get_contact_collider(int p_contact_idx) const = 0;
- virtual Vector3 get_contact_collider_pos(int p_contact_idx) const = 0;
+ virtual Vector3 get_contact_collider_position(int p_contact_idx) const = 0;
virtual ObjectID get_contact_collider_id(int p_contact_idx) const = 0;
virtual Object *get_contact_collider_object(int p_contact_idx) const;
virtual int get_contact_collider_shape(int p_contact_idx) const = 0;
- virtual Vector3 get_contact_collider_velocity_at_pos(int p_contact_idx) const = 0;
+ virtual Vector3 get_contact_collider_velocity_at_position(int p_contact_idx) const = 0;
virtual real_t get_step() const = 0;
virtual void integrate_forces();
diff --git a/thirdparty/README.md b/thirdparty/README.md
index 80fab9442b..c081ad29b6 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -59,11 +59,11 @@ Files extracted from upstream source:
Use UI font if exists, because it has tight vertial metrix and good for UI.
-### Mononoki Regular
+### Hack Regular
-- Upstream: https://github.com/madmalik/mononoki
-- Version: 1.2
-- License: OFL-1.1
+- Upstream: https://github.com/source-foundry/Hack
+- Version: 2.020
+- License: Hack Open Font License v2.0
### DroidSans*.ttf
diff --git a/thirdparty/fonts/Hack_Regular.ttf b/thirdparty/fonts/Hack_Regular.ttf
new file mode 100644
index 0000000000..a35ea2e4f4
--- /dev/null
+++ b/thirdparty/fonts/Hack_Regular.ttf
Binary files differ
diff --git a/thirdparty/fonts/LICENSE_Hack.md b/thirdparty/fonts/LICENSE_Hack.md
new file mode 100644
index 0000000000..e9fc8a1f87
--- /dev/null
+++ b/thirdparty/fonts/LICENSE_Hack.md
@@ -0,0 +1,64 @@
+## License
+
+Hack Copyright 2015, Christopher Simpkins with Reserved Font Name "Hack".
+
+Bitstream Vera Sans Mono Copyright 2003 Bitstream Inc. and licensed under the Bitstream Vera License with Reserved Font Names "Bitstream" and "Vera"
+
+DejaVu modifications of the original Bitstream Vera Sans Mono typeface have been committed to the public domain.
+
+
+
+This Font Software is licensed under the Hack Open Font License v2.0 and the Bitstream Vera License.
+
+These licenses are copied below.
+
+
+### Hack Open Font License v2.0
+
+(Version 1.0 - 06 September 2015)
+
+(Version 2.0 - 27 September 2015)
+
+Copyright 2015 by Christopher Simpkins. All Rights Reserved.
+
+DEFINITIONS
+
+"Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software.
+
+PERMISSION AND CONDITIONS
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated source code, documentation, and binary files (the "Font Software"), to reproduce and distribute the modifications to the Bitstream Vera Font Software, including without limitation the rights to use, study, copy, merge, embed, modify, redistribute, and/or sell modified or unmodified copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions:
+
+(1) The above copyright notice and this permission notice shall be included in all modified and unmodified copies of the Font Software typefaces. These notices can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user.
+
+(2) The Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the Fonts, only if the fonts are renamed to names not containing the word "Hack".
+
+(3) Neither the Font Software nor any of its individual components, in original or modified versions, may be sold by itself.
+
+TERMINATION
+
+This license becomes null and void if any of the above conditions are not met.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
+
+Except as contained in this notice, the names of Christopher Simpkins and the Author(s) of the Font Software shall not be used to promote, endorse or advertise any modified version, except to acknowledge the contribution(s) of Christopher Simpkins and the Author(s) or with their explicit written permission. For further information, contact: chris at sourcefoundry dot org.
+
+
+
+### BITSTREAM VERA LICENSE
+
+Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is a trademark of Bitstream, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions:
+
+The above copyright and trademark notices and this permission notice shall be included in all copies of one or more of the Font Software typefaces.
+
+The Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the Fonts, only if the fonts are renamed to names not containing either the words "Bitstream" or the word "Vera".
+
+This License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the "Bitstream Vera" names.
+
+The Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
+
+Except as contained in this notice, the names of Gnome, the Gnome Foundation, and Bitstream Inc., shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Font Software without prior written authorization from the Gnome Foundation or Bitstream Inc., respectively. For further information, contact: fonts at gnome dot org.
diff --git a/thirdparty/fonts/LICENSE_Mononoki b/thirdparty/fonts/LICENSE_Mononoki
deleted file mode 100644
index 6ef130c5ef..0000000000
--- a/thirdparty/fonts/LICENSE_Mononoki
+++ /dev/null
@@ -1,94 +0,0 @@
-Copyright (c) 2013, Matthias Tellen matthias.tellen@googlemail.com,
-with Reserved Font Name monoOne.
-
-This Font Software is licensed under the SIL Open Font License, Version 1.1.
-This license is copied below, and is also available with a FAQ at:
-http://scripts.sil.org/OFL
-
-
------------------------------------------------------------
-SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
------------------------------------------------------------
-
-PREAMBLE
-The goals of the Open Font License (OFL) are to stimulate worldwide
-development of collaborative font projects, to support the font creation
-efforts of academic and linguistic communities, and to provide a free and
-open framework in which fonts may be shared and improved in partnership
-with others.
-
-The OFL allows the licensed fonts to be used, studied, modified and
-redistributed freely as long as they are not sold by themselves. The
-fonts, including any derivative works, can be bundled, embedded,
-redistributed and/or sold with any software provided that any reserved
-names are not used by derivative works. The fonts and derivatives,
-however, cannot be released under any other type of license. The
-requirement for fonts to remain under this license does not apply
-to any document created using the fonts or their derivatives.
-
-DEFINITIONS
-"Font Software" refers to the set of files released by the Copyright
-Holder(s) under this license and clearly marked as such. This may
-include source files, build scripts and documentation.
-
-"Reserved Font Name" refers to any names specified as such after the
-copyright statement(s).
-
-"Original Version" refers to the collection of Font Software components as
-distributed by the Copyright Holder(s).
-
-"Modified Version" refers to any derivative made by adding to, deleting,
-or substituting -- in part or in whole -- any of the components of the
-Original Version, by changing formats or by porting the Font Software to a
-new environment.
-
-"Author" refers to any designer, engineer, programmer, technical
-writer or other person who contributed to the Font Software.
-
-PERMISSION & CONDITIONS
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of the Font Software, to use, study, copy, merge, embed, modify,
-redistribute, and sell modified and unmodified copies of the Font
-Software, subject to the following conditions:
-
-1) Neither the Font Software nor any of its individual components,
-in Original or Modified Versions, may be sold by itself.
-
-2) Original or Modified Versions of the Font Software may be bundled,
-redistributed and/or sold with any software, provided that each copy
-contains the above copyright notice and this license. These can be
-included either as stand-alone text files, human-readable headers or
-in the appropriate machine-readable metadata fields within text or
-binary files as long as those fields can be easily viewed by the user.
-
-3) No Modified Version of the Font Software may use the Reserved Font
-Name(s) unless explicit written permission is granted by the corresponding
-Copyright Holder. This restriction only applies to the primary font name as
-presented to the users.
-
-4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
-Software shall not be used to promote, endorse or advertise any
-Modified Version, except to acknowledge the contribution(s) of the
-Copyright Holder(s) and the Author(s) or with their explicit written
-permission.
-
-5) The Font Software, modified or unmodified, in part or in whole,
-must be distributed entirely under this license, and must not be
-distributed under any other license. The requirement for fonts to
-remain under this license does not apply to any document created
-using the Font Software.
-
-TERMINATION
-This license becomes null and void if any of the above conditions are
-not met.
-
-DISCLAIMER
-THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
-OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
-COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
-DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
-OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/thirdparty/fonts/mononoki_Regular.ttf b/thirdparty/fonts/mononoki_Regular.ttf
deleted file mode 100644
index 9510ac85d1..0000000000
--- a/thirdparty/fonts/mononoki_Regular.ttf
+++ /dev/null
Binary files differ