Merge pull request #37317 from akien-mga/display-server-rebased
Separate DisplayServer from OS and add multiple windows support
This commit is contained in:
commit
5f1107aa30
351 changed files with 21614 additions and 17971 deletions
50
.travis.yml
50
.travis.yml
|
|
@ -31,7 +31,7 @@ matrix:
|
|||
|
||||
- name: Linux editor (debug, GCC 9, with Mono)
|
||||
stage: build
|
||||
env: PLATFORM=x11 TOOLS=yes TARGET=debug CACHE_NAME=${PLATFORM}-tools-mono-gcc-9 MATRIX_EVAL="CC=gcc-9 && CXX=g++-9" EXTRA_ARGS="module_mono_enabled=yes mono_glue=no warnings=extra werror=yes"
|
||||
env: PLATFORM=linuxbsd TOOLS=yes TARGET=debug CACHE_NAME=${PLATFORM}-tools-mono-gcc-9 MATRIX_EVAL="CC=gcc-9 && CXX=g++-9" EXTRA_ARGS="module_mono_enabled=yes mono_glue=no warnings=extra werror=yes"
|
||||
os: linux
|
||||
compiler: gcc-9
|
||||
addons:
|
||||
|
|
@ -47,7 +47,7 @@ matrix:
|
|||
|
||||
- name: Linux export template (release, Clang 7)
|
||||
stage: build
|
||||
env: PLATFORM=x11 TOOLS=no TARGET=release CACHE_NAME=${PLATFORM}-clang EXTRA_ARGS="warnings=extra werror=yes"
|
||||
env: PLATFORM=linuxbsd TOOLS=no TARGET=release CACHE_NAME=${PLATFORM}-clang EXTRA_ARGS="warnings=extra werror=yes"
|
||||
os: linux
|
||||
compiler: clang
|
||||
addons:
|
||||
|
|
@ -67,17 +67,17 @@ matrix:
|
|||
# packages:
|
||||
# - openjdk-8-jdk
|
||||
|
||||
# - name: macOS editor (debug, Clang)
|
||||
# stage: build
|
||||
# env: PLATFORM=osx TOOLS=yes TARGET=debug CACHE_NAME=${PLATFORM}-tools-clang EXTRA_ARGS="warnings=extra werror=yes"
|
||||
# os: osx
|
||||
# osx_image: xcode11.3
|
||||
# compiler: clang
|
||||
# addons:
|
||||
# homebrew:
|
||||
# packages:
|
||||
# - scons
|
||||
# update: true
|
||||
- name: macOS editor (debug, Clang)
|
||||
stage: build
|
||||
env: PLATFORM=osx TOOLS=yes TARGET=debug CACHE_NAME=${PLATFORM}-tools-clang EXTRA_ARGS="warnings=extra werror=yes"
|
||||
os: osx
|
||||
osx_image: xcode11.3
|
||||
compiler: clang
|
||||
addons:
|
||||
homebrew:
|
||||
packages:
|
||||
- scons
|
||||
update: true
|
||||
|
||||
# TODO: iOS MoltenVK support
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ matrix:
|
|||
|
||||
- name: Linux export template (release_debug, GCC 7, without 3D support)
|
||||
stage: build
|
||||
env: PLATFORM=x11 TOOLS=no TARGET=release_debug CACHE_NAME=${PLATFORM}-gcc-7 EXTRA_ARGS="disable_3d=yes"
|
||||
env: PLATFORM=linuxbsd TOOLS=no TARGET=release_debug CACHE_NAME=${PLATFORM}-gcc-7 EXTRA_ARGS="disable_3d=yes"
|
||||
os: linux
|
||||
compiler: gcc
|
||||
addons:
|
||||
|
|
@ -117,15 +117,15 @@ matrix:
|
|||
packages:
|
||||
- *linux_deps
|
||||
|
||||
- name: Javascript export template (release, emscripten latest)
|
||||
stage: build
|
||||
env: PLATFORM=javascript TOOLS=no TARGET=release CACHE_NAME=${PLATFORM}-emcc-latest EXTRA_ARGS="use_closure_compiler=yes"
|
||||
os: linux
|
||||
compiler: clang
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- *linux_deps
|
||||
# - name: Javascript export template (release, emscripten latest)
|
||||
# stage: build
|
||||
# env: PLATFORM=javascript TOOLS=no TARGET=release CACHE_NAME=${PLATFORM}-emcc-latest EXTRA_ARGS="use_closure_compiler=yes"
|
||||
# os: linux
|
||||
# compiler: clang
|
||||
# addons:
|
||||
# apt:
|
||||
# packages:
|
||||
# - *linux_deps
|
||||
|
||||
before_install:
|
||||
- eval "${MATRIX_EVAL}"
|
||||
|
|
@ -165,7 +165,7 @@ script:
|
|||
scons -j2 CC=$CC CXX=$CXX platform=$PLATFORM tools=$TOOLS target=$TARGET $OPTIONS $EXTRA_ARGS &&
|
||||
if [ "$TEST_PROJECT" = "yes" ]; then
|
||||
git clone --depth 1 "https://github.com/godotengine/godot-tests.git";
|
||||
sed -i "s:custom_template/release=\"\":custom_template/release=\"$(readlink -e bin/godot_server.x11.opt.tools.64)\":" godot-tests/tests/project_export/export_presets.cfg;
|
||||
godot-tests/tests/project_export/test_project.sh "bin/godot_server.x11.opt.tools.64";
|
||||
sed -i "s:custom_template/release=\"\":custom_template/release=\"$(readlink -e bin/godot_server.linuxbsd.opt.tools.64)\":" godot-tests/tests/project_export/export_presets.cfg;
|
||||
godot-tests/tests/project_export/test_project.sh "bin/godot_server.linuxbsd.opt.tools.64";
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ elif env_base['p'] != "":
|
|||
else:
|
||||
# Missing `platform` argument, try to detect platform automatically
|
||||
if sys.platform.startswith('linux'):
|
||||
selected_platform = 'x11'
|
||||
selected_platform = 'linuxbsd'
|
||||
elif sys.platform == 'darwin':
|
||||
selected_platform = 'osx'
|
||||
elif sys.platform == 'win32':
|
||||
|
|
|
|||
|
|
@ -166,6 +166,7 @@ SConscript('math/SCsub')
|
|||
SConscript('crypto/SCsub')
|
||||
SConscript('io/SCsub')
|
||||
SConscript('debugger/SCsub')
|
||||
SConscript('input/SCsub')
|
||||
SConscript('bind/SCsub')
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -194,82 +194,6 @@ _ResourceSaver::_ResourceSaver() {
|
|||
singleton = this;
|
||||
}
|
||||
|
||||
/////////////////OS
|
||||
|
||||
void _OS::global_menu_add_item(const String &p_menu, const String &p_label, const Variant &p_signal, const Variant &p_meta) {
|
||||
|
||||
OS::get_singleton()->global_menu_add_item(p_menu, p_label, p_signal, p_meta);
|
||||
}
|
||||
|
||||
void _OS::global_menu_add_separator(const String &p_menu) {
|
||||
|
||||
OS::get_singleton()->global_menu_add_separator(p_menu);
|
||||
}
|
||||
|
||||
void _OS::global_menu_remove_item(const String &p_menu, int p_idx) {
|
||||
|
||||
OS::get_singleton()->global_menu_remove_item(p_menu, p_idx);
|
||||
}
|
||||
|
||||
void _OS::global_menu_clear(const String &p_menu) {
|
||||
|
||||
OS::get_singleton()->global_menu_clear(p_menu);
|
||||
}
|
||||
|
||||
Point2 _OS::get_mouse_position() const {
|
||||
|
||||
return OS::get_singleton()->get_mouse_position();
|
||||
}
|
||||
|
||||
void _OS::set_window_title(const String &p_title) {
|
||||
|
||||
OS::get_singleton()->set_window_title(p_title);
|
||||
}
|
||||
|
||||
int _OS::get_mouse_button_state() const {
|
||||
|
||||
return OS::get_singleton()->get_mouse_button_state();
|
||||
}
|
||||
|
||||
String _OS::get_unique_id() const {
|
||||
return OS::get_singleton()->get_unique_id();
|
||||
}
|
||||
|
||||
bool _OS::has_touchscreen_ui_hint() const {
|
||||
|
||||
return OS::get_singleton()->has_touchscreen_ui_hint();
|
||||
}
|
||||
|
||||
void _OS::set_clipboard(const String &p_text) {
|
||||
|
||||
OS::get_singleton()->set_clipboard(p_text);
|
||||
}
|
||||
|
||||
String _OS::get_clipboard() const {
|
||||
|
||||
return OS::get_singleton()->get_clipboard();
|
||||
}
|
||||
|
||||
int _OS::get_video_driver_count() const {
|
||||
return OS::get_singleton()->get_video_driver_count();
|
||||
}
|
||||
|
||||
String _OS::get_video_driver_name(VideoDriver p_driver) const {
|
||||
return OS::get_singleton()->get_video_driver_name((int)p_driver);
|
||||
}
|
||||
|
||||
_OS::VideoDriver _OS::get_current_video_driver() const {
|
||||
return (VideoDriver)OS::get_singleton()->get_current_video_driver();
|
||||
}
|
||||
|
||||
int _OS::get_audio_driver_count() const {
|
||||
return OS::get_singleton()->get_audio_driver_count();
|
||||
}
|
||||
|
||||
String _OS::get_audio_driver_name(int p_driver) const {
|
||||
return OS::get_singleton()->get_audio_driver_name(p_driver);
|
||||
}
|
||||
|
||||
PackedStringArray _OS::get_connected_midi_inputs() {
|
||||
return OS::get_singleton()->get_connected_midi_inputs();
|
||||
}
|
||||
|
|
@ -282,198 +206,11 @@ void _OS::close_midi_inputs() {
|
|||
OS::get_singleton()->close_midi_inputs();
|
||||
}
|
||||
|
||||
void _OS::set_video_mode(const Size2 &p_size, bool p_fullscreen, bool p_resizeable, int p_screen) {
|
||||
|
||||
OS::VideoMode vm;
|
||||
vm.width = p_size.width;
|
||||
vm.height = p_size.height;
|
||||
vm.fullscreen = p_fullscreen;
|
||||
vm.resizable = p_resizeable;
|
||||
OS::get_singleton()->set_video_mode(vm, p_screen);
|
||||
}
|
||||
|
||||
Size2 _OS::get_video_mode(int p_screen) const {
|
||||
|
||||
OS::VideoMode vm;
|
||||
vm = OS::get_singleton()->get_video_mode(p_screen);
|
||||
return Size2(vm.width, vm.height);
|
||||
}
|
||||
|
||||
bool _OS::is_video_mode_fullscreen(int p_screen) const {
|
||||
|
||||
OS::VideoMode vm;
|
||||
vm = OS::get_singleton()->get_video_mode(p_screen);
|
||||
return vm.fullscreen;
|
||||
}
|
||||
|
||||
int _OS::get_screen_count() const {
|
||||
return OS::get_singleton()->get_screen_count();
|
||||
}
|
||||
|
||||
int _OS::get_current_screen() const {
|
||||
return OS::get_singleton()->get_current_screen();
|
||||
}
|
||||
|
||||
void _OS::set_current_screen(int p_screen) {
|
||||
OS::get_singleton()->set_current_screen(p_screen);
|
||||
}
|
||||
|
||||
Point2 _OS::get_screen_position(int p_screen) const {
|
||||
return OS::get_singleton()->get_screen_position(p_screen);
|
||||
}
|
||||
|
||||
Size2 _OS::get_screen_size(int p_screen) const {
|
||||
return OS::get_singleton()->get_screen_size(p_screen);
|
||||
}
|
||||
|
||||
int _OS::get_screen_dpi(int p_screen) const {
|
||||
|
||||
return OS::get_singleton()->get_screen_dpi(p_screen);
|
||||
}
|
||||
|
||||
Point2 _OS::get_window_position() const {
|
||||
return OS::get_singleton()->get_window_position();
|
||||
}
|
||||
|
||||
void _OS::set_window_position(const Point2 &p_position) {
|
||||
OS::get_singleton()->set_window_position(p_position);
|
||||
}
|
||||
|
||||
Size2 _OS::get_max_window_size() const {
|
||||
return OS::get_singleton()->get_max_window_size();
|
||||
}
|
||||
|
||||
Size2 _OS::get_min_window_size() const {
|
||||
return OS::get_singleton()->get_min_window_size();
|
||||
}
|
||||
|
||||
Size2 _OS::get_window_size() const {
|
||||
return OS::get_singleton()->get_window_size();
|
||||
}
|
||||
|
||||
Size2 _OS::get_real_window_size() const {
|
||||
return OS::get_singleton()->get_real_window_size();
|
||||
}
|
||||
|
||||
void _OS::set_max_window_size(const Size2 &p_size) {
|
||||
OS::get_singleton()->set_max_window_size(p_size);
|
||||
}
|
||||
|
||||
void _OS::set_min_window_size(const Size2 &p_size) {
|
||||
OS::get_singleton()->set_min_window_size(p_size);
|
||||
}
|
||||
|
||||
void _OS::set_window_size(const Size2 &p_size) {
|
||||
OS::get_singleton()->set_window_size(p_size);
|
||||
}
|
||||
|
||||
Rect2 _OS::get_window_safe_area() const {
|
||||
return OS::get_singleton()->get_window_safe_area();
|
||||
}
|
||||
|
||||
void _OS::set_window_fullscreen(bool p_enabled) {
|
||||
OS::get_singleton()->set_window_fullscreen(p_enabled);
|
||||
}
|
||||
|
||||
bool _OS::is_window_fullscreen() const {
|
||||
return OS::get_singleton()->is_window_fullscreen();
|
||||
}
|
||||
|
||||
void _OS::set_window_resizable(bool p_enabled) {
|
||||
OS::get_singleton()->set_window_resizable(p_enabled);
|
||||
}
|
||||
|
||||
bool _OS::is_window_resizable() const {
|
||||
return OS::get_singleton()->is_window_resizable();
|
||||
}
|
||||
|
||||
void _OS::set_window_minimized(bool p_enabled) {
|
||||
OS::get_singleton()->set_window_minimized(p_enabled);
|
||||
}
|
||||
|
||||
bool _OS::is_window_minimized() const {
|
||||
return OS::get_singleton()->is_window_minimized();
|
||||
}
|
||||
|
||||
void _OS::set_window_maximized(bool p_enabled) {
|
||||
OS::get_singleton()->set_window_maximized(p_enabled);
|
||||
}
|
||||
|
||||
bool _OS::is_window_maximized() const {
|
||||
return OS::get_singleton()->is_window_maximized();
|
||||
}
|
||||
|
||||
void _OS::set_window_always_on_top(bool p_enabled) {
|
||||
OS::get_singleton()->set_window_always_on_top(p_enabled);
|
||||
}
|
||||
|
||||
bool _OS::is_window_always_on_top() const {
|
||||
return OS::get_singleton()->is_window_always_on_top();
|
||||
}
|
||||
|
||||
bool _OS::is_window_focused() const {
|
||||
return OS::get_singleton()->is_window_focused();
|
||||
}
|
||||
|
||||
void _OS::set_borderless_window(bool p_borderless) {
|
||||
OS::get_singleton()->set_borderless_window(p_borderless);
|
||||
}
|
||||
|
||||
bool _OS::get_window_per_pixel_transparency_enabled() const {
|
||||
return OS::get_singleton()->get_window_per_pixel_transparency_enabled();
|
||||
}
|
||||
|
||||
void _OS::set_window_per_pixel_transparency_enabled(bool p_enabled) {
|
||||
OS::get_singleton()->set_window_per_pixel_transparency_enabled(p_enabled);
|
||||
}
|
||||
|
||||
bool _OS::get_borderless_window() const {
|
||||
return OS::get_singleton()->get_borderless_window();
|
||||
}
|
||||
|
||||
void _OS::set_ime_active(const bool p_active) {
|
||||
|
||||
OS::get_singleton()->set_ime_active(p_active);
|
||||
}
|
||||
|
||||
void _OS::set_ime_position(const Point2 &p_pos) {
|
||||
|
||||
OS::get_singleton()->set_ime_position(p_pos);
|
||||
}
|
||||
|
||||
Point2 _OS::get_ime_selection() const {
|
||||
return OS::get_singleton()->get_ime_selection();
|
||||
}
|
||||
|
||||
String _OS::get_ime_text() const {
|
||||
return OS::get_singleton()->get_ime_text();
|
||||
}
|
||||
|
||||
void _OS::set_use_file_access_save_and_swap(bool p_enable) {
|
||||
|
||||
FileAccess::set_backup_save(p_enable);
|
||||
}
|
||||
|
||||
bool _OS::is_video_mode_resizable(int p_screen) const {
|
||||
|
||||
OS::VideoMode vm;
|
||||
vm = OS::get_singleton()->get_video_mode(p_screen);
|
||||
return vm.resizable;
|
||||
}
|
||||
|
||||
Array _OS::get_fullscreen_mode_list(int p_screen) const {
|
||||
|
||||
List<OS::VideoMode> vmlist;
|
||||
OS::get_singleton()->get_fullscreen_mode_list(&vmlist, p_screen);
|
||||
Array vmarr;
|
||||
for (List<OS::VideoMode>::Element *E = vmlist.front(); E; E = E->next()) {
|
||||
|
||||
vmarr.push_back(Size2(E->get().width, E->get().height));
|
||||
}
|
||||
|
||||
return vmarr;
|
||||
}
|
||||
|
||||
void _OS::set_low_processor_usage_mode(bool p_enabled) {
|
||||
|
||||
OS::get_singleton()->set_low_processor_usage_mode(p_enabled);
|
||||
|
|
@ -562,52 +299,16 @@ String _OS::get_locale() const {
|
|||
return OS::get_singleton()->get_locale();
|
||||
}
|
||||
|
||||
String _OS::get_latin_keyboard_variant() const {
|
||||
switch (OS::get_singleton()->get_latin_keyboard_variant()) {
|
||||
case OS::LATIN_KEYBOARD_QWERTY: return "QWERTY";
|
||||
case OS::LATIN_KEYBOARD_QWERTZ: return "QWERTZ";
|
||||
case OS::LATIN_KEYBOARD_AZERTY: return "AZERTY";
|
||||
case OS::LATIN_KEYBOARD_QZERTY: return "QZERTY";
|
||||
case OS::LATIN_KEYBOARD_DVORAK: return "DVORAK";
|
||||
case OS::LATIN_KEYBOARD_NEO: return "NEO";
|
||||
case OS::LATIN_KEYBOARD_COLEMAK: return "COLEMAK";
|
||||
default: return "ERROR";
|
||||
}
|
||||
}
|
||||
|
||||
String _OS::get_model_name() const {
|
||||
|
||||
return OS::get_singleton()->get_model_name();
|
||||
}
|
||||
|
||||
bool _OS::is_ok_left_and_cancel_right() const {
|
||||
|
||||
return OS::get_singleton()->get_swap_ok_cancel();
|
||||
}
|
||||
|
||||
Error _OS::set_thread_name(const String &p_name) {
|
||||
|
||||
return Thread::set_name(p_name);
|
||||
};
|
||||
|
||||
void _OS::set_use_vsync(bool p_enable) {
|
||||
OS::get_singleton()->set_use_vsync(p_enable);
|
||||
}
|
||||
|
||||
bool _OS::is_vsync_enabled() const {
|
||||
|
||||
return OS::get_singleton()->is_vsync_enabled();
|
||||
}
|
||||
|
||||
void _OS::set_vsync_via_compositor(bool p_enable) {
|
||||
OS::get_singleton()->set_vsync_via_compositor(p_enable);
|
||||
}
|
||||
|
||||
bool _OS::is_vsync_via_compositor_enabled() const {
|
||||
|
||||
return OS::get_singleton()->is_vsync_via_compositor_enabled();
|
||||
}
|
||||
|
||||
bool _OS::has_feature(const String &p_feature) const {
|
||||
|
||||
return OS::get_singleton()->has_feature(p_feature);
|
||||
|
|
@ -667,16 +368,6 @@ uint64_t _OS::get_static_memory_peak_usage() const {
|
|||
return OS::get_singleton()->get_static_memory_peak_usage();
|
||||
}
|
||||
|
||||
void _OS::set_native_icon(const String &p_filename) {
|
||||
|
||||
OS::get_singleton()->set_native_icon(p_filename);
|
||||
}
|
||||
|
||||
void _OS::set_icon(const Ref<Image> &p_icon) {
|
||||
|
||||
OS::get_singleton()->set_icon(p_icon);
|
||||
}
|
||||
|
||||
int _OS::get_exit_code() const {
|
||||
|
||||
return OS::get_singleton()->get_exit_code();
|
||||
|
|
@ -924,11 +615,6 @@ bool _OS::can_use_threads() const {
|
|||
return OS::get_singleton()->can_use_threads();
|
||||
}
|
||||
|
||||
bool _OS::can_draw() const {
|
||||
|
||||
return OS::get_singleton()->can_draw();
|
||||
}
|
||||
|
||||
bool _OS::is_userfs_persistent() const {
|
||||
|
||||
return OS::get_singleton()->is_userfs_persistent();
|
||||
|
|
@ -1025,22 +711,6 @@ void _OS::print_resources_by_type(const Vector<String> &p_types) {
|
|||
}
|
||||
};
|
||||
|
||||
bool _OS::has_virtual_keyboard() const {
|
||||
return OS::get_singleton()->has_virtual_keyboard();
|
||||
}
|
||||
|
||||
void _OS::show_virtual_keyboard(const String &p_existing_text) {
|
||||
OS::get_singleton()->show_virtual_keyboard(p_existing_text, Rect2());
|
||||
}
|
||||
|
||||
void _OS::hide_virtual_keyboard() {
|
||||
OS::get_singleton()->hide_virtual_keyboard();
|
||||
}
|
||||
|
||||
int _OS::get_virtual_keyboard_height() {
|
||||
return OS::get_singleton()->get_virtual_keyboard_height();
|
||||
}
|
||||
|
||||
void _OS::print_all_resources(const String &p_to_file) {
|
||||
|
||||
OS::get_singleton()->print_all_resources(p_to_file);
|
||||
|
|
@ -1061,45 +731,6 @@ String _OS::get_user_data_dir() const {
|
|||
return OS::get_singleton()->get_user_data_dir();
|
||||
};
|
||||
|
||||
Error _OS::native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track) {
|
||||
|
||||
return OS::get_singleton()->native_video_play(p_path, p_volume, p_audio_track, p_subtitle_track);
|
||||
};
|
||||
|
||||
bool _OS::native_video_is_playing() {
|
||||
|
||||
return OS::get_singleton()->native_video_is_playing();
|
||||
};
|
||||
|
||||
void _OS::native_video_pause() {
|
||||
|
||||
OS::get_singleton()->native_video_pause();
|
||||
};
|
||||
|
||||
void _OS::native_video_unpause() {
|
||||
OS::get_singleton()->native_video_unpause();
|
||||
};
|
||||
|
||||
void _OS::native_video_stop() {
|
||||
|
||||
OS::get_singleton()->native_video_stop();
|
||||
};
|
||||
|
||||
void _OS::request_attention() {
|
||||
|
||||
OS::get_singleton()->request_attention();
|
||||
}
|
||||
|
||||
void _OS::center_window() {
|
||||
|
||||
OS::get_singleton()->center_window();
|
||||
}
|
||||
|
||||
void _OS::move_window_to_foreground() {
|
||||
|
||||
OS::get_singleton()->move_window_to_foreground();
|
||||
}
|
||||
|
||||
bool _OS::is_debug_build() const {
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
|
|
@ -1109,26 +740,6 @@ bool _OS::is_debug_build() const {
|
|||
#endif
|
||||
}
|
||||
|
||||
void _OS::set_screen_orientation(ScreenOrientation p_orientation) {
|
||||
|
||||
OS::get_singleton()->set_screen_orientation(OS::ScreenOrientation(p_orientation));
|
||||
}
|
||||
|
||||
_OS::ScreenOrientation _OS::get_screen_orientation() const {
|
||||
|
||||
return ScreenOrientation(OS::get_singleton()->get_screen_orientation());
|
||||
}
|
||||
|
||||
void _OS::set_keep_screen_on(bool p_enabled) {
|
||||
|
||||
OS::get_singleton()->set_keep_screen_on(p_enabled);
|
||||
}
|
||||
|
||||
bool _OS::is_keep_screen_on() const {
|
||||
|
||||
return OS::get_singleton()->is_keep_screen_on();
|
||||
}
|
||||
|
||||
String _OS::get_system_dir(SystemDir p_dir) const {
|
||||
|
||||
return OS::get_singleton()->get_system_dir(OS::SystemDir(p_dir));
|
||||
|
|
@ -1149,11 +760,6 @@ int _OS::find_keycode_from_string(const String &p_code) const {
|
|||
return find_keycode(p_code);
|
||||
}
|
||||
|
||||
void _OS::alert(const String &p_alert, const String &p_title) {
|
||||
|
||||
OS::get_singleton()->alert(p_alert, p_title);
|
||||
}
|
||||
|
||||
bool _OS::request_permission(const String &p_name) {
|
||||
|
||||
return OS::get_singleton()->request_permission(p_name);
|
||||
|
|
@ -1169,90 +775,17 @@ Vector<String> _OS::get_granted_permissions() const {
|
|||
return OS::get_singleton()->get_granted_permissions();
|
||||
}
|
||||
|
||||
String _OS::get_unique_id() const {
|
||||
return OS::get_singleton()->get_unique_id();
|
||||
}
|
||||
_OS *_OS::singleton = NULL;
|
||||
|
||||
void _OS::_bind_methods() {
|
||||
|
||||
//ClassDB::bind_method(D_METHOD("get_mouse_position"),&_OS::get_mouse_position);
|
||||
//ClassDB::bind_method(D_METHOD("is_mouse_grab_enabled"),&_OS::is_mouse_grab_enabled);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_clipboard", "clipboard"), &_OS::set_clipboard);
|
||||
ClassDB::bind_method(D_METHOD("get_clipboard"), &_OS::get_clipboard);
|
||||
|
||||
//will not delete for now, just unexpose
|
||||
//ClassDB::bind_method(D_METHOD("set_video_mode","size","fullscreen","resizable","screen"),&_OS::set_video_mode,DEFVAL(0));
|
||||
//ClassDB::bind_method(D_METHOD("get_video_mode_size","screen"),&_OS::get_video_mode,DEFVAL(0));
|
||||
//ClassDB::bind_method(D_METHOD("is_video_mode_fullscreen","screen"),&_OS::is_video_mode_fullscreen,DEFVAL(0));
|
||||
//ClassDB::bind_method(D_METHOD("is_video_mode_resizable","screen"),&_OS::is_video_mode_resizable,DEFVAL(0));
|
||||
//ClassDB::bind_method(D_METHOD("get_fullscreen_mode_list","screen"),&_OS::get_fullscreen_mode_list,DEFVAL(0));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("global_menu_add_item", "menu", "label", "id", "meta"), &_OS::global_menu_add_item);
|
||||
ClassDB::bind_method(D_METHOD("global_menu_add_separator", "menu"), &_OS::global_menu_add_separator);
|
||||
ClassDB::bind_method(D_METHOD("global_menu_remove_item", "menu", "idx"), &_OS::global_menu_remove_item);
|
||||
ClassDB::bind_method(D_METHOD("global_menu_clear", "menu"), &_OS::global_menu_clear);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_video_driver_count"), &_OS::get_video_driver_count);
|
||||
ClassDB::bind_method(D_METHOD("get_video_driver_name", "driver"), &_OS::get_video_driver_name);
|
||||
ClassDB::bind_method(D_METHOD("get_current_video_driver"), &_OS::get_current_video_driver);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_audio_driver_count"), &_OS::get_audio_driver_count);
|
||||
ClassDB::bind_method(D_METHOD("get_audio_driver_name", "driver"), &_OS::get_audio_driver_name);
|
||||
ClassDB::bind_method(D_METHOD("get_connected_midi_inputs"), &_OS::get_connected_midi_inputs);
|
||||
ClassDB::bind_method(D_METHOD("open_midi_inputs"), &_OS::open_midi_inputs);
|
||||
ClassDB::bind_method(D_METHOD("close_midi_inputs"), &_OS::close_midi_inputs);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_screen_count"), &_OS::get_screen_count);
|
||||
ClassDB::bind_method(D_METHOD("get_current_screen"), &_OS::get_current_screen);
|
||||
ClassDB::bind_method(D_METHOD("set_current_screen", "screen"), &_OS::set_current_screen);
|
||||
ClassDB::bind_method(D_METHOD("get_screen_position", "screen"), &_OS::get_screen_position, DEFVAL(-1));
|
||||
ClassDB::bind_method(D_METHOD("get_screen_size", "screen"), &_OS::get_screen_size, DEFVAL(-1));
|
||||
ClassDB::bind_method(D_METHOD("get_screen_dpi", "screen"), &_OS::get_screen_dpi, DEFVAL(-1));
|
||||
ClassDB::bind_method(D_METHOD("get_window_position"), &_OS::get_window_position);
|
||||
ClassDB::bind_method(D_METHOD("set_window_position", "position"), &_OS::set_window_position);
|
||||
ClassDB::bind_method(D_METHOD("get_window_size"), &_OS::get_window_size);
|
||||
ClassDB::bind_method(D_METHOD("get_max_window_size"), &_OS::get_max_window_size);
|
||||
ClassDB::bind_method(D_METHOD("get_min_window_size"), &_OS::get_min_window_size);
|
||||
ClassDB::bind_method(D_METHOD("set_max_window_size", "size"), &_OS::set_max_window_size);
|
||||
ClassDB::bind_method(D_METHOD("set_min_window_size", "size"), &_OS::set_min_window_size);
|
||||
ClassDB::bind_method(D_METHOD("set_window_size", "size"), &_OS::set_window_size);
|
||||
ClassDB::bind_method(D_METHOD("get_window_safe_area"), &_OS::get_window_safe_area);
|
||||
ClassDB::bind_method(D_METHOD("set_window_fullscreen", "enabled"), &_OS::set_window_fullscreen);
|
||||
ClassDB::bind_method(D_METHOD("is_window_fullscreen"), &_OS::is_window_fullscreen);
|
||||
ClassDB::bind_method(D_METHOD("set_window_resizable", "enabled"), &_OS::set_window_resizable);
|
||||
ClassDB::bind_method(D_METHOD("is_window_resizable"), &_OS::is_window_resizable);
|
||||
ClassDB::bind_method(D_METHOD("set_window_minimized", "enabled"), &_OS::set_window_minimized);
|
||||
ClassDB::bind_method(D_METHOD("is_window_minimized"), &_OS::is_window_minimized);
|
||||
ClassDB::bind_method(D_METHOD("set_window_maximized", "enabled"), &_OS::set_window_maximized);
|
||||
ClassDB::bind_method(D_METHOD("is_window_maximized"), &_OS::is_window_maximized);
|
||||
ClassDB::bind_method(D_METHOD("set_window_always_on_top", "enabled"), &_OS::set_window_always_on_top);
|
||||
ClassDB::bind_method(D_METHOD("is_window_always_on_top"), &_OS::is_window_always_on_top);
|
||||
ClassDB::bind_method(D_METHOD("is_window_focused"), &_OS::is_window_focused);
|
||||
ClassDB::bind_method(D_METHOD("request_attention"), &_OS::request_attention);
|
||||
ClassDB::bind_method(D_METHOD("get_real_window_size"), &_OS::get_real_window_size);
|
||||
ClassDB::bind_method(D_METHOD("center_window"), &_OS::center_window);
|
||||
ClassDB::bind_method(D_METHOD("move_window_to_foreground"), &_OS::move_window_to_foreground);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_borderless_window", "borderless"), &_OS::set_borderless_window);
|
||||
ClassDB::bind_method(D_METHOD("get_borderless_window"), &_OS::get_borderless_window);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_window_per_pixel_transparency_enabled"), &_OS::get_window_per_pixel_transparency_enabled);
|
||||
ClassDB::bind_method(D_METHOD("set_window_per_pixel_transparency_enabled", "enabled"), &_OS::set_window_per_pixel_transparency_enabled);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_ime_active", "active"), &_OS::set_ime_active);
|
||||
ClassDB::bind_method(D_METHOD("set_ime_position", "position"), &_OS::set_ime_position);
|
||||
ClassDB::bind_method(D_METHOD("get_ime_selection"), &_OS::get_ime_selection);
|
||||
ClassDB::bind_method(D_METHOD("get_ime_text"), &_OS::get_ime_text);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_screen_orientation", "orientation"), &_OS::set_screen_orientation);
|
||||
ClassDB::bind_method(D_METHOD("get_screen_orientation"), &_OS::get_screen_orientation);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_keep_screen_on", "enabled"), &_OS::set_keep_screen_on);
|
||||
ClassDB::bind_method(D_METHOD("is_keep_screen_on"), &_OS::is_keep_screen_on);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("has_touchscreen_ui_hint"), &_OS::has_touchscreen_ui_hint);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_window_title", "title"), &_OS::set_window_title);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_low_processor_usage_mode", "enable"), &_OS::set_low_processor_usage_mode);
|
||||
ClassDB::bind_method(D_METHOD("is_in_low_processor_usage_mode"), &_OS::is_in_low_processor_usage_mode);
|
||||
|
||||
|
|
@ -1283,9 +816,6 @@ void _OS::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_system_time_secs"), &_OS::get_system_time_secs);
|
||||
ClassDB::bind_method(D_METHOD("get_system_time_msecs"), &_OS::get_system_time_msecs);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_native_icon", "filename"), &_OS::set_native_icon);
|
||||
ClassDB::bind_method(D_METHOD("set_icon", "icon"), &_OS::set_icon);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_exit_code"), &_OS::get_exit_code);
|
||||
ClassDB::bind_method(D_METHOD("set_exit_code", "code"), &_OS::set_exit_code);
|
||||
|
||||
|
|
@ -1295,10 +825,8 @@ void _OS::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_ticks_usec"), &_OS::get_ticks_usec);
|
||||
ClassDB::bind_method(D_METHOD("get_splash_tick_msec"), &_OS::get_splash_tick_msec);
|
||||
ClassDB::bind_method(D_METHOD("get_locale"), &_OS::get_locale);
|
||||
ClassDB::bind_method(D_METHOD("get_latin_keyboard_variant"), &_OS::get_latin_keyboard_variant);
|
||||
ClassDB::bind_method(D_METHOD("get_model_name"), &_OS::get_model_name);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("can_draw"), &_OS::can_draw);
|
||||
ClassDB::bind_method(D_METHOD("is_userfs_persistent"), &_OS::is_userfs_persistent);
|
||||
ClassDB::bind_method(D_METHOD("is_stdout_verbose"), &_OS::is_stdout_verbose);
|
||||
|
||||
|
|
@ -1310,10 +838,6 @@ void _OS::_bind_methods() {
|
|||
|
||||
ClassDB::bind_method(D_METHOD("dump_memory_to_file", "file"), &_OS::dump_memory_to_file);
|
||||
ClassDB::bind_method(D_METHOD("dump_resources_to_file", "file"), &_OS::dump_resources_to_file);
|
||||
ClassDB::bind_method(D_METHOD("has_virtual_keyboard"), &_OS::has_virtual_keyboard);
|
||||
ClassDB::bind_method(D_METHOD("show_virtual_keyboard", "existing_text"), &_OS::show_virtual_keyboard, DEFVAL(""));
|
||||
ClassDB::bind_method(D_METHOD("hide_virtual_keyboard"), &_OS::hide_virtual_keyboard);
|
||||
ClassDB::bind_method(D_METHOD("get_virtual_keyboard_height"), &_OS::get_virtual_keyboard_height);
|
||||
ClassDB::bind_method(D_METHOD("print_resources_in_use", "short"), &_OS::print_resources_in_use, DEFVAL(false));
|
||||
ClassDB::bind_method(D_METHOD("print_all_resources", "tofile"), &_OS::print_all_resources, DEFVAL(""));
|
||||
|
||||
|
|
@ -1324,81 +848,32 @@ void _OS::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_system_dir", "dir"), &_OS::get_system_dir);
|
||||
ClassDB::bind_method(D_METHOD("get_unique_id"), &_OS::get_unique_id);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("is_ok_left_and_cancel_right"), &_OS::is_ok_left_and_cancel_right);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("print_all_textures_by_size"), &_OS::print_all_textures_by_size);
|
||||
ClassDB::bind_method(D_METHOD("print_resources_by_type", "types"), &_OS::print_resources_by_type);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("native_video_play", "path", "volume", "audio_track", "subtitle_track"), &_OS::native_video_play);
|
||||
ClassDB::bind_method(D_METHOD("native_video_is_playing"), &_OS::native_video_is_playing);
|
||||
ClassDB::bind_method(D_METHOD("native_video_stop"), &_OS::native_video_stop);
|
||||
ClassDB::bind_method(D_METHOD("native_video_pause"), &_OS::native_video_pause);
|
||||
ClassDB::bind_method(D_METHOD("native_video_unpause"), &_OS::native_video_unpause);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_keycode_string", "code"), &_OS::get_keycode_string);
|
||||
ClassDB::bind_method(D_METHOD("is_keycode_unicode", "code"), &_OS::is_keycode_unicode);
|
||||
ClassDB::bind_method(D_METHOD("find_keycode_from_string", "string"), &_OS::find_keycode_from_string);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_use_file_access_save_and_swap", "enabled"), &_OS::set_use_file_access_save_and_swap);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("alert", "text", "title"), &_OS::alert, DEFVAL("Alert!"));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_thread_name", "name"), &_OS::set_thread_name);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_use_vsync", "enable"), &_OS::set_use_vsync);
|
||||
ClassDB::bind_method(D_METHOD("is_vsync_enabled"), &_OS::is_vsync_enabled);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_vsync_via_compositor", "enable"), &_OS::set_vsync_via_compositor);
|
||||
ClassDB::bind_method(D_METHOD("is_vsync_via_compositor_enabled"), &_OS::is_vsync_via_compositor_enabled);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("has_feature", "tag_name"), &_OS::has_feature);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("request_permission", "name"), &_OS::request_permission);
|
||||
ClassDB::bind_method(D_METHOD("request_permissions"), &_OS::request_permissions);
|
||||
ClassDB::bind_method(D_METHOD("get_granted_permissions"), &_OS::get_granted_permissions);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "clipboard"), "set_clipboard", "get_clipboard");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "current_screen"), "set_current_screen", "get_current_screen");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "exit_code"), "set_exit_code", "get_exit_code");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "vsync_enabled"), "set_use_vsync", "is_vsync_enabled");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "vsync_via_compositor"), "set_vsync_via_compositor", "is_vsync_via_compositor_enabled");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "low_processor_usage_mode"), "set_low_processor_usage_mode", "is_in_low_processor_usage_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "low_processor_usage_mode_sleep_usec"), "set_low_processor_usage_mode_sleep_usec", "get_low_processor_usage_mode_sleep_usec");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "keep_screen_on"), "set_keep_screen_on", "is_keep_screen_on");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "min_window_size"), "set_min_window_size", "get_min_window_size");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "max_window_size"), "set_max_window_size", "get_max_window_size");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "screen_orientation", PROPERTY_HINT_ENUM, "Landscape,Portrait,Reverse Landscape,Reverse Portrait,Sensor Landscape,Sensor Portrait,Sensor"), "set_screen_orientation", "get_screen_orientation");
|
||||
ADD_GROUP("Window", "window_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_borderless"), "set_borderless_window", "get_borderless_window");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_per_pixel_transparency_enabled"), "set_window_per_pixel_transparency_enabled", "get_window_per_pixel_transparency_enabled");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_fullscreen"), "set_window_fullscreen", "is_window_fullscreen");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_maximized"), "set_window_maximized", "is_window_maximized");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_minimized"), "set_window_minimized", "is_window_minimized");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_resizable"), "set_window_resizable", "is_window_resizable");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "window_position"), "set_window_position", "get_window_position");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "window_size"), "set_window_size", "get_window_size");
|
||||
|
||||
// Those default values need to be specified for the docs generator,
|
||||
// to avoid using values from the documentation writer's own OS instance.
|
||||
ADD_PROPERTY_DEFAULT("clipboard", "");
|
||||
ADD_PROPERTY_DEFAULT("current_screen", 0);
|
||||
ADD_PROPERTY_DEFAULT("exit_code", 0);
|
||||
ADD_PROPERTY_DEFAULT("vsync_enabled", true);
|
||||
ADD_PROPERTY_DEFAULT("vsync_via_compositor", false);
|
||||
ADD_PROPERTY_DEFAULT("low_processor_usage_mode", false);
|
||||
ADD_PROPERTY_DEFAULT("low_processor_usage_mode_sleep_usec", 6900);
|
||||
ADD_PROPERTY_DEFAULT("keep_screen_on", true);
|
||||
ADD_PROPERTY_DEFAULT("min_window_size", Vector2());
|
||||
ADD_PROPERTY_DEFAULT("max_window_size", Vector2());
|
||||
ADD_PROPERTY_DEFAULT("screen_orientation", 0);
|
||||
ADD_PROPERTY_DEFAULT("window_borderless", false);
|
||||
ADD_PROPERTY_DEFAULT("window_per_pixel_transparency_enabled", false);
|
||||
ADD_PROPERTY_DEFAULT("window_fullscreen", false);
|
||||
ADD_PROPERTY_DEFAULT("window_maximized", false);
|
||||
ADD_PROPERTY_DEFAULT("window_minimized", false);
|
||||
ADD_PROPERTY_DEFAULT("window_resizable", true);
|
||||
ADD_PROPERTY_DEFAULT("window_position", Vector2());
|
||||
ADD_PROPERTY_DEFAULT("window_size", Vector2());
|
||||
|
||||
BIND_ENUM_CONSTANT(VIDEO_DRIVER_GLES2);
|
||||
BIND_ENUM_CONSTANT(VIDEO_DRIVER_VULKAN);
|
||||
|
|
@ -1424,14 +899,6 @@ void _OS::_bind_methods() {
|
|||
BIND_ENUM_CONSTANT(MONTH_NOVEMBER);
|
||||
BIND_ENUM_CONSTANT(MONTH_DECEMBER);
|
||||
|
||||
BIND_ENUM_CONSTANT(SCREEN_ORIENTATION_LANDSCAPE);
|
||||
BIND_ENUM_CONSTANT(SCREEN_ORIENTATION_PORTRAIT);
|
||||
BIND_ENUM_CONSTANT(SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
|
||||
BIND_ENUM_CONSTANT(SCREEN_ORIENTATION_REVERSE_PORTRAIT);
|
||||
BIND_ENUM_CONSTANT(SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
|
||||
BIND_ENUM_CONSTANT(SCREEN_ORIENTATION_SENSOR_PORTRAIT);
|
||||
BIND_ENUM_CONSTANT(SCREEN_ORIENTATION_SENSOR);
|
||||
|
||||
BIND_ENUM_CONSTANT(SYSTEM_DIR_DESKTOP);
|
||||
BIND_ENUM_CONSTANT(SYSTEM_DIR_DCIM);
|
||||
BIND_ENUM_CONSTANT(SYSTEM_DIR_DOCUMENTS);
|
||||
|
|
|
|||
|
|
@ -145,83 +145,10 @@ public:
|
|||
MONTH_DECEMBER
|
||||
};
|
||||
|
||||
void global_menu_add_item(const String &p_menu, const String &p_label, const Variant &p_signal, const Variant &p_meta);
|
||||
void global_menu_add_separator(const String &p_menu);
|
||||
void global_menu_remove_item(const String &p_menu, int p_idx);
|
||||
void global_menu_clear(const String &p_menu);
|
||||
|
||||
Point2 get_mouse_position() const;
|
||||
void set_window_title(const String &p_title);
|
||||
int get_mouse_button_state() const;
|
||||
|
||||
void set_clipboard(const String &p_text);
|
||||
String get_clipboard() const;
|
||||
|
||||
void set_video_mode(const Size2 &p_size, bool p_fullscreen, bool p_resizeable, int p_screen = 0);
|
||||
Size2 get_video_mode(int p_screen = 0) const;
|
||||
bool is_video_mode_fullscreen(int p_screen = 0) const;
|
||||
bool is_video_mode_resizable(int p_screen = 0) const;
|
||||
Array get_fullscreen_mode_list(int p_screen = 0) const;
|
||||
|
||||
virtual int get_video_driver_count() const;
|
||||
virtual String get_video_driver_name(VideoDriver p_driver) const;
|
||||
virtual VideoDriver get_current_video_driver() const;
|
||||
|
||||
virtual int get_audio_driver_count() const;
|
||||
virtual String get_audio_driver_name(int p_driver) const;
|
||||
|
||||
virtual PackedStringArray get_connected_midi_inputs();
|
||||
virtual void open_midi_inputs();
|
||||
virtual void close_midi_inputs();
|
||||
|
||||
virtual int get_screen_count() const;
|
||||
virtual int get_current_screen() const;
|
||||
virtual void set_current_screen(int p_screen);
|
||||
virtual Point2 get_screen_position(int p_screen = -1) const;
|
||||
virtual Size2 get_screen_size(int p_screen = -1) const;
|
||||
virtual int get_screen_dpi(int p_screen = -1) const;
|
||||
virtual Point2 get_window_position() const;
|
||||
virtual void set_window_position(const Point2 &p_position);
|
||||
virtual Size2 get_max_window_size() const;
|
||||
virtual Size2 get_min_window_size() const;
|
||||
virtual Size2 get_window_size() const;
|
||||
virtual Size2 get_real_window_size() const;
|
||||
virtual Rect2 get_window_safe_area() const;
|
||||
virtual void set_max_window_size(const Size2 &p_size);
|
||||
virtual void set_min_window_size(const Size2 &p_size);
|
||||
virtual void set_window_size(const Size2 &p_size);
|
||||
virtual void set_window_fullscreen(bool p_enabled);
|
||||
virtual bool is_window_fullscreen() const;
|
||||
virtual void set_window_resizable(bool p_enabled);
|
||||
virtual bool is_window_resizable() const;
|
||||
virtual void set_window_minimized(bool p_enabled);
|
||||
virtual bool is_window_minimized() const;
|
||||
virtual void set_window_maximized(bool p_enabled);
|
||||
virtual bool is_window_maximized() const;
|
||||
virtual void set_window_always_on_top(bool p_enabled);
|
||||
virtual bool is_window_always_on_top() const;
|
||||
virtual bool is_window_focused() const;
|
||||
virtual void request_attention();
|
||||
virtual void center_window();
|
||||
virtual void move_window_to_foreground();
|
||||
|
||||
virtual void set_borderless_window(bool p_borderless);
|
||||
virtual bool get_borderless_window() const;
|
||||
|
||||
virtual bool get_window_per_pixel_transparency_enabled() const;
|
||||
virtual void set_window_per_pixel_transparency_enabled(bool p_enabled);
|
||||
|
||||
virtual void set_ime_active(const bool p_active);
|
||||
virtual void set_ime_position(const Point2 &p_pos);
|
||||
virtual Point2 get_ime_selection() const;
|
||||
virtual String get_ime_text() const;
|
||||
|
||||
Error native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track);
|
||||
bool native_video_is_playing();
|
||||
void native_video_pause();
|
||||
void native_video_unpause();
|
||||
void native_video_stop();
|
||||
|
||||
void set_low_processor_usage_mode(bool p_enabled);
|
||||
bool is_in_low_processor_usage_mode() const;
|
||||
|
||||
|
|
@ -243,25 +170,17 @@ public:
|
|||
Vector<String> get_cmdline_args();
|
||||
|
||||
String get_locale() const;
|
||||
String get_latin_keyboard_variant() const;
|
||||
|
||||
String get_model_name() const;
|
||||
|
||||
void dump_memory_to_file(const String &p_file);
|
||||
void dump_resources_to_file(const String &p_file);
|
||||
|
||||
bool has_virtual_keyboard() const;
|
||||
void show_virtual_keyboard(const String &p_existing_text = "");
|
||||
void hide_virtual_keyboard();
|
||||
int get_virtual_keyboard_height();
|
||||
|
||||
void print_resources_in_use(bool p_short = false);
|
||||
void print_all_resources(const String &p_to_file);
|
||||
void print_all_textures_by_size();
|
||||
void print_resources_by_type(const Vector<String> &p_types);
|
||||
|
||||
bool has_touchscreen_ui_hint() const;
|
||||
|
||||
bool is_debug_build() const;
|
||||
|
||||
String get_unique_id() const;
|
||||
|
|
@ -272,9 +191,6 @@ public:
|
|||
|
||||
void set_use_file_access_save_and_swap(bool p_enable);
|
||||
|
||||
void set_native_icon(const String &p_filename);
|
||||
void set_icon(const Ref<Image> &p_icon);
|
||||
|
||||
int get_exit_code() const;
|
||||
void set_exit_code(int p_code);
|
||||
Dictionary get_date(bool utc) const;
|
||||
|
|
@ -298,8 +214,6 @@ public:
|
|||
|
||||
bool can_use_threads() const;
|
||||
|
||||
bool can_draw() const;
|
||||
|
||||
bool is_userfs_persistent() const;
|
||||
|
||||
bool is_stdout_verbose() const;
|
||||
|
|
@ -317,39 +231,12 @@ public:
|
|||
SYSTEM_DIR_RINGTONES,
|
||||
};
|
||||
|
||||
enum ScreenOrientation {
|
||||
|
||||
SCREEN_ORIENTATION_LANDSCAPE,
|
||||
SCREEN_ORIENTATION_PORTRAIT,
|
||||
SCREEN_ORIENTATION_REVERSE_LANDSCAPE,
|
||||
SCREEN_ORIENTATION_REVERSE_PORTRAIT,
|
||||
SCREEN_ORIENTATION_SENSOR_LANDSCAPE,
|
||||
SCREEN_ORIENTATION_SENSOR_PORTRAIT,
|
||||
SCREEN_ORIENTATION_SENSOR,
|
||||
};
|
||||
|
||||
String get_system_dir(SystemDir p_dir) const;
|
||||
|
||||
String get_user_data_dir() const;
|
||||
|
||||
void alert(const String &p_alert, const String &p_title = "ALERT!");
|
||||
|
||||
void set_screen_orientation(ScreenOrientation p_orientation);
|
||||
ScreenOrientation get_screen_orientation() const;
|
||||
|
||||
void set_keep_screen_on(bool p_enabled);
|
||||
bool is_keep_screen_on() const;
|
||||
|
||||
bool is_ok_left_and_cancel_right() const;
|
||||
|
||||
Error set_thread_name(const String &p_name);
|
||||
|
||||
void set_use_vsync(bool p_enable);
|
||||
bool is_vsync_enabled() const;
|
||||
|
||||
void set_vsync_via_compositor(bool p_enable);
|
||||
bool is_vsync_via_compositor_enabled() const;
|
||||
|
||||
bool has_feature(const String &p_feature) const;
|
||||
|
||||
bool request_permission(const String &p_name);
|
||||
|
|
@ -365,7 +252,6 @@ VARIANT_ENUM_CAST(_OS::VideoDriver);
|
|||
VARIANT_ENUM_CAST(_OS::Weekday);
|
||||
VARIANT_ENUM_CAST(_OS::Month);
|
||||
VARIANT_ENUM_CAST(_OS::SystemDir);
|
||||
VARIANT_ENUM_CAST(_OS::ScreenOrientation);
|
||||
|
||||
class _Geometry : public Object {
|
||||
|
||||
|
|
|
|||
|
|
@ -33,11 +33,12 @@
|
|||
#include "core/debugger/debugger_marshalls.h"
|
||||
#include "core/debugger/engine_debugger.h"
|
||||
#include "core/debugger/script_debugger.h"
|
||||
#include "core/os/input.h"
|
||||
#include "core/input/input_filter.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/project_settings.h"
|
||||
#include "core/script_language.h"
|
||||
#include "scene/main/node.h"
|
||||
#include "servers/display_server.h"
|
||||
|
||||
template <typename T>
|
||||
void RemoteDebugger::_bind_profiler(const String &p_name, T *p_prof) {
|
||||
|
|
@ -658,9 +659,9 @@ void RemoteDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) {
|
|||
|
||||
servers_profiler->skip_profile_frame = true; // Avoid frame time spike in debug.
|
||||
|
||||
Input::MouseMode mouse_mode = Input::get_singleton()->get_mouse_mode();
|
||||
if (mouse_mode != Input::MOUSE_MODE_VISIBLE)
|
||||
Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE);
|
||||
InputFilter::MouseMode mouse_mode = InputFilter::get_singleton()->get_mouse_mode();
|
||||
if (mouse_mode != InputFilter::MOUSE_MODE_VISIBLE)
|
||||
InputFilter::get_singleton()->set_mouse_mode(InputFilter::MOUSE_MODE_VISIBLE);
|
||||
|
||||
uint64_t loop_begin_usec = 0;
|
||||
uint64_t loop_time_sec = 0;
|
||||
|
|
@ -694,7 +695,7 @@ void RemoteDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) {
|
|||
} else if (command == "continue") {
|
||||
script_debugger->set_depth(-1);
|
||||
script_debugger->set_lines_left(-1);
|
||||
OS::get_singleton()->move_window_to_foreground();
|
||||
DisplayServer::get_singleton()->window_move_to_foreground();
|
||||
break;
|
||||
|
||||
} else if (command == "break") {
|
||||
|
|
@ -778,8 +779,8 @@ void RemoteDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) {
|
|||
|
||||
send_message("debug_exit", Array());
|
||||
|
||||
if (mouse_mode != Input::MOUSE_MODE_VISIBLE)
|
||||
Input::get_singleton()->set_mouse_mode(mouse_mode);
|
||||
if (mouse_mode != InputFilter::MOUSE_MODE_VISIBLE)
|
||||
InputFilter::get_singleton()->set_mouse_mode(mouse_mode);
|
||||
}
|
||||
|
||||
void RemoteDebugger::poll_events(bool p_is_idle) {
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@
|
|||
|
||||
#include "global_constants.h"
|
||||
|
||||
#include "core/input/input_event.h"
|
||||
#include "core/object.h"
|
||||
#include "core/os/input_event.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "core/variant.h"
|
||||
|
||||
|
|
|
|||
20
core/input/SCsub
Normal file
20
core/input/SCsub
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
Import('env')
|
||||
|
||||
from platform_methods import run_in_subprocess
|
||||
import input_builders
|
||||
|
||||
|
||||
# Order matters here. Higher index controller database files write on top of lower index database files.
|
||||
controller_databases = ["#core/input/gamecontrollerdb_204.txt", "#core/input/gamecontrollerdb_205.txt", "#core/input/gamecontrollerdb.txt", "#core/input/godotcontrollerdb.txt"]
|
||||
|
||||
env.Depends("#core/input/default_controller_mappings.gen.cpp", controller_databases)
|
||||
env.CommandNoCache("#core/input/default_controller_mappings.gen.cpp", controller_databases, run_in_subprocess(input_builders.make_default_controller_mappings))
|
||||
|
||||
env.add_source_files(env.core_sources, "*.cpp")
|
||||
|
||||
# Don't warn about duplicate entry here, we need it registered manually for first build,
|
||||
# even if later builds will pick it up twice due to above *.cpp globbing.
|
||||
env.add_source_files(env.core_sources, "#core/input/default_controller_mappings.gen.cpp", warn_duplicates=False)
|
||||
|
||||
73
core/input/input_builders.py
Normal file
73
core/input/input_builders.py
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
"""Functions used to generate source files during build time
|
||||
|
||||
All such functions are invoked in a subprocess on Windows to prevent build flakiness.
|
||||
"""
|
||||
|
||||
from platform_methods import subprocess_main
|
||||
from collections import OrderedDict
|
||||
|
||||
|
||||
def make_default_controller_mappings(target, source, env):
|
||||
dst = target[0]
|
||||
g = open(dst, "w")
|
||||
|
||||
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
|
||||
g.write("#include \"core/typedefs.h\"\n")
|
||||
g.write("#include \"core/input/default_controller_mappings.h\"\n")
|
||||
|
||||
# ensure mappings have a consistent order
|
||||
platform_mappings = OrderedDict()
|
||||
for src_path in source:
|
||||
with open(src_path, "r") as f:
|
||||
# read mapping file and skip header
|
||||
mapping_file_lines = f.readlines()[2:]
|
||||
|
||||
current_platform = None
|
||||
for line in mapping_file_lines:
|
||||
if not line:
|
||||
continue
|
||||
line = line.strip()
|
||||
if len(line) == 0:
|
||||
continue
|
||||
if line[0] == "#":
|
||||
current_platform = line[1:].strip()
|
||||
if current_platform not in platform_mappings:
|
||||
platform_mappings[current_platform] = {}
|
||||
elif current_platform:
|
||||
line_parts = line.split(",")
|
||||
guid = line_parts[0]
|
||||
if guid in platform_mappings[current_platform]:
|
||||
g.write("// WARNING - DATABASE {} OVERWROTE PRIOR MAPPING: {} {}\n".format(src_path, current_platform, platform_mappings[current_platform][guid]))
|
||||
valid_mapping = True
|
||||
for input_map in line_parts[2:]:
|
||||
if "+" in input_map or "-" in input_map or "~" in input_map:
|
||||
g.write("// WARNING - DISCARDED UNSUPPORTED MAPPING TYPE FROM DATABASE {}: {} {}\n".format(src_path, current_platform, line))
|
||||
valid_mapping = False
|
||||
break
|
||||
if valid_mapping:
|
||||
platform_mappings[current_platform][guid] = line
|
||||
|
||||
platform_variables = {
|
||||
"Linux": "#if X11_ENABLED",
|
||||
"Windows": "#ifdef WINDOWS_ENABLED",
|
||||
"Mac OS X": "#ifdef OSX_ENABLED",
|
||||
"Android": "#if defined(__ANDROID__)",
|
||||
"iOS": "#ifdef IPHONE_ENABLED",
|
||||
"Javascript": "#ifdef JAVASCRIPT_ENABLED",
|
||||
"UWP": "#ifdef UWP_ENABLED",
|
||||
}
|
||||
|
||||
g.write("const char* DefaultControllerMappings::mappings[] = {\n")
|
||||
for platform, mappings in platform_mappings.items():
|
||||
variable = platform_variables[platform]
|
||||
g.write("{}\n".format(variable))
|
||||
for mapping in mappings.values():
|
||||
g.write("\t\"{}\",\n".format(mapping))
|
||||
g.write("#endif\n")
|
||||
|
||||
g.write("\tNULL\n};\n")
|
||||
g.close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
subprocess_main(globals())
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include "input_event.h"
|
||||
|
||||
#include "core/input_map.h"
|
||||
#include "core/input/input_map.h"
|
||||
#include "core/os/keyboard.h"
|
||||
|
||||
const int InputEvent::DEVICE_ID_TOUCH_MOUSE = -1;
|
||||
|
|
@ -136,6 +136,25 @@ InputEvent::InputEvent() {
|
|||
|
||||
device = 0;
|
||||
}
|
||||
////////////////
|
||||
|
||||
void InputEventFromWindow::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_window_id", "id"), &InputEventFromWindow::set_window_id);
|
||||
ClassDB::bind_method(D_METHOD("get_window_id"), &InputEventFromWindow::get_window_id);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "window_id"), "set_window_id", "get_window_id");
|
||||
}
|
||||
|
||||
void InputEventFromWindow::set_window_id(int64_t p_id) {
|
||||
window_id = p_id;
|
||||
}
|
||||
int64_t InputEventFromWindow::get_window_id() const {
|
||||
return window_id;
|
||||
}
|
||||
|
||||
InputEventFromWindow::InputEventFromWindow() {
|
||||
window_id = 0;
|
||||
}
|
||||
|
||||
//////////////////
|
||||
|
||||
|
|
@ -499,7 +518,7 @@ Ref<InputEvent> InputEventMouseButton::xformed_by(const Transform2D &p_xform, co
|
|||
mb.instance();
|
||||
|
||||
mb->set_device(get_device());
|
||||
|
||||
mb->set_window_id(get_window_id());
|
||||
mb->set_modifiers_from_event(this);
|
||||
|
||||
mb->set_position(l);
|
||||
|
|
@ -650,6 +669,7 @@ Ref<InputEvent> InputEventMouseMotion::xformed_by(const Transform2D &p_xform, co
|
|||
mm.instance();
|
||||
|
||||
mm->set_device(get_device());
|
||||
mm->set_window_id(get_window_id());
|
||||
|
||||
mm->set_modifiers_from_event(this);
|
||||
|
||||
|
|
@ -697,6 +717,10 @@ bool InputEventMouseMotion::accumulate(const Ref<InputEvent> &p_event) {
|
|||
if (motion.is_null())
|
||||
return false;
|
||||
|
||||
if (get_window_id() != motion->get_window_id()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_pressed() != motion->is_pressed()) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -948,6 +972,7 @@ Ref<InputEvent> InputEventScreenTouch::xformed_by(const Transform2D &p_xform, co
|
|||
Ref<InputEventScreenTouch> st;
|
||||
st.instance();
|
||||
st->set_device(get_device());
|
||||
st->set_window_id(get_window_id());
|
||||
st->set_index(index);
|
||||
st->set_position(p_xform.xform(pos + p_local_ofs));
|
||||
st->set_pressed(pressed);
|
||||
|
|
@ -1028,6 +1053,7 @@ Ref<InputEvent> InputEventScreenDrag::xformed_by(const Transform2D &p_xform, con
|
|||
sd.instance();
|
||||
|
||||
sd->set_device(get_device());
|
||||
sd->set_window_id(get_window_id());
|
||||
|
||||
sd->set_index(index);
|
||||
sd->set_position(p_xform.xform(pos + p_local_ofs));
|
||||
|
|
@ -1186,6 +1212,8 @@ Ref<InputEvent> InputEventMagnifyGesture::xformed_by(const Transform2D &p_xform,
|
|||
ev.instance();
|
||||
|
||||
ev->set_device(get_device());
|
||||
ev->set_window_id(get_window_id());
|
||||
|
||||
ev->set_modifiers_from_event(this);
|
||||
|
||||
ev->set_position(p_xform.xform(get_position() + p_local_ofs));
|
||||
|
|
@ -1228,6 +1256,8 @@ Ref<InputEvent> InputEventPanGesture::xformed_by(const Transform2D &p_xform, con
|
|||
ev.instance();
|
||||
|
||||
ev->set_device(get_device());
|
||||
ev->set_window_id(get_window_id());
|
||||
|
||||
ev->set_modifiers_from_event(this);
|
||||
|
||||
ev->set_position(p_xform.xform(get_position() + p_local_ofs));
|
||||
|
|
@ -205,8 +205,24 @@ public:
|
|||
InputEvent();
|
||||
};
|
||||
|
||||
class InputEventWithModifiers : public InputEvent {
|
||||
GDCLASS(InputEventWithModifiers, InputEvent);
|
||||
class InputEventFromWindow : public InputEvent {
|
||||
|
||||
GDCLASS(InputEventFromWindow, InputEvent);
|
||||
|
||||
int64_t window_id;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
void set_window_id(int64_t p_id);
|
||||
int64_t get_window_id() const;
|
||||
|
||||
InputEventFromWindow();
|
||||
};
|
||||
|
||||
class InputEventWithModifiers : public InputEventFromWindow {
|
||||
GDCLASS(InputEventWithModifiers, InputEventFromWindow);
|
||||
|
||||
bool shift;
|
||||
bool alt;
|
||||
|
|
@ -440,8 +456,8 @@ public:
|
|||
InputEventJoypadButton();
|
||||
};
|
||||
|
||||
class InputEventScreenTouch : public InputEvent {
|
||||
GDCLASS(InputEventScreenTouch, InputEvent);
|
||||
class InputEventScreenTouch : public InputEventFromWindow {
|
||||
GDCLASS(InputEventScreenTouch, InputEventFromWindow);
|
||||
int index;
|
||||
Vector2 pos;
|
||||
bool pressed;
|
||||
|
|
@ -465,9 +481,9 @@ public:
|
|||
InputEventScreenTouch();
|
||||
};
|
||||
|
||||
class InputEventScreenDrag : public InputEvent {
|
||||
class InputEventScreenDrag : public InputEventFromWindow {
|
||||
|
||||
GDCLASS(InputEventScreenDrag, InputEvent);
|
||||
GDCLASS(InputEventScreenDrag, InputEventFromWindow);
|
||||
int index;
|
||||
Vector2 pos;
|
||||
Vector2 relative;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* input_default.cpp */
|
||||
/* input_filter.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
|
@ -28,15 +28,134 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "input_default.h"
|
||||
#include "input_filter.h"
|
||||
|
||||
#include "core/input_map.h"
|
||||
#include "core/input/default_controller_mappings.h"
|
||||
#include "core/input/input_map.h"
|
||||
#include "core/os/os.h"
|
||||
#include "main/default_controller_mappings.h"
|
||||
#include "scene/resources/texture.h"
|
||||
#include "servers/visual_server.h"
|
||||
#include "core/project_settings.h"
|
||||
|
||||
void InputDefault::SpeedTrack::update(const Vector2 &p_delta_p) {
|
||||
#ifdef TOOLS_ENABLED
|
||||
#include "editor/editor_settings.h"
|
||||
#endif
|
||||
|
||||
InputFilter *InputFilter::singleton = NULL;
|
||||
|
||||
void (*InputFilter::set_mouse_mode_func)(InputFilter::MouseMode) = nullptr;
|
||||
InputFilter::MouseMode (*InputFilter::get_mouse_mode_func)() = nullptr;
|
||||
void (*InputFilter::warp_mouse_func)(const Vector2 &p_to_pos) = nullptr;
|
||||
InputFilter::CursorShape (*InputFilter::get_current_cursor_shape_func)() = nullptr;
|
||||
void (*InputFilter::set_custom_mouse_cursor_func)(const RES &, InputFilter::CursorShape, const Vector2 &) = nullptr;
|
||||
|
||||
InputFilter *InputFilter::get_singleton() {
|
||||
|
||||
return singleton;
|
||||
}
|
||||
|
||||
void InputFilter::set_mouse_mode(MouseMode p_mode) {
|
||||
ERR_FAIL_INDEX((int)p_mode, 4);
|
||||
set_mouse_mode_func(p_mode);
|
||||
}
|
||||
|
||||
InputFilter::MouseMode InputFilter::get_mouse_mode() const {
|
||||
|
||||
return get_mouse_mode_func();
|
||||
}
|
||||
|
||||
void InputFilter::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("is_key_pressed", "keycode"), &InputFilter::is_key_pressed);
|
||||
ClassDB::bind_method(D_METHOD("is_mouse_button_pressed", "button"), &InputFilter::is_mouse_button_pressed);
|
||||
ClassDB::bind_method(D_METHOD("is_joy_button_pressed", "device", "button"), &InputFilter::is_joy_button_pressed);
|
||||
ClassDB::bind_method(D_METHOD("is_action_pressed", "action"), &InputFilter::is_action_pressed);
|
||||
ClassDB::bind_method(D_METHOD("is_action_just_pressed", "action"), &InputFilter::is_action_just_pressed);
|
||||
ClassDB::bind_method(D_METHOD("is_action_just_released", "action"), &InputFilter::is_action_just_released);
|
||||
ClassDB::bind_method(D_METHOD("get_action_strength", "action"), &InputFilter::get_action_strength);
|
||||
ClassDB::bind_method(D_METHOD("add_joy_mapping", "mapping", "update_existing"), &InputFilter::add_joy_mapping, DEFVAL(false));
|
||||
ClassDB::bind_method(D_METHOD("remove_joy_mapping", "guid"), &InputFilter::remove_joy_mapping);
|
||||
ClassDB::bind_method(D_METHOD("joy_connection_changed", "device", "connected", "name", "guid"), &InputFilter::joy_connection_changed);
|
||||
ClassDB::bind_method(D_METHOD("is_joy_known", "device"), &InputFilter::is_joy_known);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_axis", "device", "axis"), &InputFilter::get_joy_axis);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_name", "device"), &InputFilter::get_joy_name);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_guid", "device"), &InputFilter::get_joy_guid);
|
||||
ClassDB::bind_method(D_METHOD("get_connected_joypads"), &InputFilter::get_connected_joypads);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_vibration_strength", "device"), &InputFilter::get_joy_vibration_strength);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_vibration_duration", "device"), &InputFilter::get_joy_vibration_duration);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_button_string", "button_index"), &InputFilter::get_joy_button_string);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_button_index_from_string", "button"), &InputFilter::get_joy_button_index_from_string);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_axis_string", "axis_index"), &InputFilter::get_joy_axis_string);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_axis_index_from_string", "axis"), &InputFilter::get_joy_axis_index_from_string);
|
||||
ClassDB::bind_method(D_METHOD("start_joy_vibration", "device", "weak_magnitude", "strong_magnitude", "duration"), &InputFilter::start_joy_vibration, DEFVAL(0));
|
||||
ClassDB::bind_method(D_METHOD("stop_joy_vibration", "device"), &InputFilter::stop_joy_vibration);
|
||||
ClassDB::bind_method(D_METHOD("vibrate_handheld", "duration_ms"), &InputFilter::vibrate_handheld, DEFVAL(500));
|
||||
ClassDB::bind_method(D_METHOD("get_gravity"), &InputFilter::get_gravity);
|
||||
ClassDB::bind_method(D_METHOD("get_accelerometer"), &InputFilter::get_accelerometer);
|
||||
ClassDB::bind_method(D_METHOD("get_magnetometer"), &InputFilter::get_magnetometer);
|
||||
ClassDB::bind_method(D_METHOD("get_gyroscope"), &InputFilter::get_gyroscope);
|
||||
ClassDB::bind_method(D_METHOD("get_last_mouse_speed"), &InputFilter::get_last_mouse_speed);
|
||||
ClassDB::bind_method(D_METHOD("get_mouse_button_mask"), &InputFilter::get_mouse_button_mask);
|
||||
ClassDB::bind_method(D_METHOD("set_mouse_mode", "mode"), &InputFilter::set_mouse_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_mouse_mode"), &InputFilter::get_mouse_mode);
|
||||
ClassDB::bind_method(D_METHOD("warp_mouse_position", "to"), &InputFilter::warp_mouse_position);
|
||||
ClassDB::bind_method(D_METHOD("action_press", "action", "strength"), &InputFilter::action_press, DEFVAL(1.f));
|
||||
ClassDB::bind_method(D_METHOD("action_release", "action"), &InputFilter::action_release);
|
||||
ClassDB::bind_method(D_METHOD("set_default_cursor_shape", "shape"), &InputFilter::set_default_cursor_shape, DEFVAL(CURSOR_ARROW));
|
||||
ClassDB::bind_method(D_METHOD("get_current_cursor_shape"), &InputFilter::get_current_cursor_shape);
|
||||
ClassDB::bind_method(D_METHOD("set_custom_mouse_cursor", "image", "shape", "hotspot"), &InputFilter::set_custom_mouse_cursor, DEFVAL(CURSOR_ARROW), DEFVAL(Vector2()));
|
||||
ClassDB::bind_method(D_METHOD("parse_input_event", "event"), &InputFilter::parse_input_event);
|
||||
ClassDB::bind_method(D_METHOD("set_use_accumulated_input", "enable"), &InputFilter::set_use_accumulated_input);
|
||||
|
||||
BIND_ENUM_CONSTANT(MOUSE_MODE_VISIBLE);
|
||||
BIND_ENUM_CONSTANT(MOUSE_MODE_HIDDEN);
|
||||
BIND_ENUM_CONSTANT(MOUSE_MODE_CAPTURED);
|
||||
BIND_ENUM_CONSTANT(MOUSE_MODE_CONFINED);
|
||||
|
||||
BIND_ENUM_CONSTANT(CURSOR_ARROW);
|
||||
BIND_ENUM_CONSTANT(CURSOR_IBEAM);
|
||||
BIND_ENUM_CONSTANT(CURSOR_POINTING_HAND);
|
||||
BIND_ENUM_CONSTANT(CURSOR_CROSS);
|
||||
BIND_ENUM_CONSTANT(CURSOR_WAIT);
|
||||
BIND_ENUM_CONSTANT(CURSOR_BUSY);
|
||||
BIND_ENUM_CONSTANT(CURSOR_DRAG);
|
||||
BIND_ENUM_CONSTANT(CURSOR_CAN_DROP);
|
||||
BIND_ENUM_CONSTANT(CURSOR_FORBIDDEN);
|
||||
BIND_ENUM_CONSTANT(CURSOR_VSIZE);
|
||||
BIND_ENUM_CONSTANT(CURSOR_HSIZE);
|
||||
BIND_ENUM_CONSTANT(CURSOR_BDIAGSIZE);
|
||||
BIND_ENUM_CONSTANT(CURSOR_FDIAGSIZE);
|
||||
BIND_ENUM_CONSTANT(CURSOR_MOVE);
|
||||
BIND_ENUM_CONSTANT(CURSOR_VSPLIT);
|
||||
BIND_ENUM_CONSTANT(CURSOR_HSPLIT);
|
||||
BIND_ENUM_CONSTANT(CURSOR_HELP);
|
||||
|
||||
ADD_SIGNAL(MethodInfo("joy_connection_changed", PropertyInfo(Variant::INT, "device"), PropertyInfo(Variant::BOOL, "connected")));
|
||||
}
|
||||
|
||||
void InputFilter::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
||||
const String quote_style = EDITOR_DEF("text_editor/completion/use_single_quotes", 0) ? "'" : "\"";
|
||||
|
||||
String pf = p_function;
|
||||
if (p_idx == 0 && (pf == "is_action_pressed" || pf == "action_press" || pf == "action_release" || pf == "is_action_just_pressed" || pf == "is_action_just_released" || pf == "get_action_strength")) {
|
||||
|
||||
List<PropertyInfo> pinfo;
|
||||
ProjectSettings::get_singleton()->get_property_list(&pinfo);
|
||||
|
||||
for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
|
||||
const PropertyInfo &pi = E->get();
|
||||
|
||||
if (!pi.name.begins_with("input/"))
|
||||
continue;
|
||||
|
||||
String name = pi.name.substr(pi.name.find("/") + 1, pi.name.length());
|
||||
r_options->push_back(quote_style + name + quote_style);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void InputFilter::SpeedTrack::update(const Vector2 &p_delta_p) {
|
||||
|
||||
uint64_t tick = OS::get_singleton()->get_ticks_usec();
|
||||
uint32_t tdiff = tick - last_tick;
|
||||
|
|
@ -60,26 +179,26 @@ void InputDefault::SpeedTrack::update(const Vector2 &p_delta_p) {
|
|||
}
|
||||
}
|
||||
|
||||
void InputDefault::SpeedTrack::reset() {
|
||||
void InputFilter::SpeedTrack::reset() {
|
||||
last_tick = OS::get_singleton()->get_ticks_usec();
|
||||
speed = Vector2();
|
||||
accum_t = 0;
|
||||
}
|
||||
|
||||
InputDefault::SpeedTrack::SpeedTrack() {
|
||||
InputFilter::SpeedTrack::SpeedTrack() {
|
||||
|
||||
min_ref_frame = 0.1;
|
||||
max_ref_frame = 0.3;
|
||||
reset();
|
||||
}
|
||||
|
||||
bool InputDefault::is_key_pressed(int p_keycode) const {
|
||||
bool InputFilter::is_key_pressed(int p_keycode) const {
|
||||
|
||||
_THREAD_SAFE_METHOD_
|
||||
return keys_pressed.has(p_keycode);
|
||||
}
|
||||
|
||||
bool InputDefault::is_mouse_button_pressed(int p_button) const {
|
||||
bool InputFilter::is_mouse_button_pressed(int p_button) const {
|
||||
|
||||
_THREAD_SAFE_METHOD_
|
||||
return (mouse_button_mask & (1 << (p_button - 1))) != 0;
|
||||
|
|
@ -90,18 +209,18 @@ static int _combine_device(int p_value, int p_device) {
|
|||
return p_value | (p_device << 20);
|
||||
}
|
||||
|
||||
bool InputDefault::is_joy_button_pressed(int p_device, int p_button) const {
|
||||
bool InputFilter::is_joy_button_pressed(int p_device, int p_button) const {
|
||||
|
||||
_THREAD_SAFE_METHOD_
|
||||
return joy_buttons_pressed.has(_combine_device(p_button, p_device));
|
||||
}
|
||||
|
||||
bool InputDefault::is_action_pressed(const StringName &p_action) const {
|
||||
bool InputFilter::is_action_pressed(const StringName &p_action) const {
|
||||
|
||||
return action_state.has(p_action) && action_state[p_action].pressed;
|
||||
}
|
||||
|
||||
bool InputDefault::is_action_just_pressed(const StringName &p_action) const {
|
||||
bool InputFilter::is_action_just_pressed(const StringName &p_action) const {
|
||||
|
||||
const Map<StringName, Action>::Element *E = action_state.find(p_action);
|
||||
if (!E)
|
||||
|
|
@ -114,7 +233,7 @@ bool InputDefault::is_action_just_pressed(const StringName &p_action) const {
|
|||
}
|
||||
}
|
||||
|
||||
bool InputDefault::is_action_just_released(const StringName &p_action) const {
|
||||
bool InputFilter::is_action_just_released(const StringName &p_action) const {
|
||||
|
||||
const Map<StringName, Action>::Element *E = action_state.find(p_action);
|
||||
if (!E)
|
||||
|
|
@ -127,7 +246,7 @@ bool InputDefault::is_action_just_released(const StringName &p_action) const {
|
|||
}
|
||||
}
|
||||
|
||||
float InputDefault::get_action_strength(const StringName &p_action) const {
|
||||
float InputFilter::get_action_strength(const StringName &p_action) const {
|
||||
const Map<StringName, Action>::Element *E = action_state.find(p_action);
|
||||
if (!E)
|
||||
return 0.0f;
|
||||
|
|
@ -135,7 +254,7 @@ float InputDefault::get_action_strength(const StringName &p_action) const {
|
|||
return E->get().strength;
|
||||
}
|
||||
|
||||
float InputDefault::get_joy_axis(int p_device, int p_axis) const {
|
||||
float InputFilter::get_joy_axis(int p_device, int p_axis) const {
|
||||
|
||||
_THREAD_SAFE_METHOD_
|
||||
int c = _combine_device(p_axis, p_device);
|
||||
|
|
@ -146,13 +265,13 @@ float InputDefault::get_joy_axis(int p_device, int p_axis) const {
|
|||
}
|
||||
}
|
||||
|
||||
String InputDefault::get_joy_name(int p_idx) {
|
||||
String InputFilter::get_joy_name(int p_idx) {
|
||||
|
||||
_THREAD_SAFE_METHOD_
|
||||
return joy_names[p_idx].name;
|
||||
};
|
||||
|
||||
Vector2 InputDefault::get_joy_vibration_strength(int p_device) {
|
||||
Vector2 InputFilter::get_joy_vibration_strength(int p_device) {
|
||||
if (joy_vibration.has(p_device)) {
|
||||
return Vector2(joy_vibration[p_device].weak_magnitude, joy_vibration[p_device].strong_magnitude);
|
||||
} else {
|
||||
|
|
@ -160,7 +279,7 @@ Vector2 InputDefault::get_joy_vibration_strength(int p_device) {
|
|||
}
|
||||
}
|
||||
|
||||
uint64_t InputDefault::get_joy_vibration_timestamp(int p_device) {
|
||||
uint64_t InputFilter::get_joy_vibration_timestamp(int p_device) {
|
||||
if (joy_vibration.has(p_device)) {
|
||||
return joy_vibration[p_device].timestamp;
|
||||
} else {
|
||||
|
|
@ -168,7 +287,7 @@ uint64_t InputDefault::get_joy_vibration_timestamp(int p_device) {
|
|||
}
|
||||
}
|
||||
|
||||
float InputDefault::get_joy_vibration_duration(int p_device) {
|
||||
float InputFilter::get_joy_vibration_duration(int p_device) {
|
||||
if (joy_vibration.has(p_device)) {
|
||||
return joy_vibration[p_device].duration;
|
||||
} else {
|
||||
|
|
@ -188,7 +307,7 @@ static String _hex_str(uint8_t p_byte) {
|
|||
return ret;
|
||||
};
|
||||
|
||||
void InputDefault::joy_connection_changed(int p_idx, bool p_connected, String p_name, String p_guid) {
|
||||
void InputFilter::joy_connection_changed(int p_idx, bool p_connected, String p_name, String p_guid) {
|
||||
|
||||
_THREAD_SAFE_METHOD_
|
||||
Joypad js;
|
||||
|
|
@ -230,36 +349,36 @@ void InputDefault::joy_connection_changed(int p_idx, bool p_connected, String p_
|
|||
emit_signal("joy_connection_changed", p_idx, p_connected);
|
||||
};
|
||||
|
||||
Vector3 InputDefault::get_gravity() const {
|
||||
Vector3 InputFilter::get_gravity() const {
|
||||
|
||||
_THREAD_SAFE_METHOD_
|
||||
return gravity;
|
||||
}
|
||||
|
||||
Vector3 InputDefault::get_accelerometer() const {
|
||||
Vector3 InputFilter::get_accelerometer() const {
|
||||
|
||||
_THREAD_SAFE_METHOD_
|
||||
return accelerometer;
|
||||
}
|
||||
|
||||
Vector3 InputDefault::get_magnetometer() const {
|
||||
Vector3 InputFilter::get_magnetometer() const {
|
||||
|
||||
_THREAD_SAFE_METHOD_
|
||||
return magnetometer;
|
||||
}
|
||||
|
||||
Vector3 InputDefault::get_gyroscope() const {
|
||||
Vector3 InputFilter::get_gyroscope() const {
|
||||
|
||||
_THREAD_SAFE_METHOD_
|
||||
return gyroscope;
|
||||
}
|
||||
|
||||
void InputDefault::parse_input_event(const Ref<InputEvent> &p_event) {
|
||||
void InputFilter::parse_input_event(const Ref<InputEvent> &p_event) {
|
||||
|
||||
_parse_input_event_impl(p_event, false);
|
||||
}
|
||||
|
||||
void InputDefault::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_emulated) {
|
||||
void InputFilter::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_emulated) {
|
||||
|
||||
// Notes on mouse-touch emulation:
|
||||
// - Emulated mouse events are parsed, that is, re-routed to this method, so they make the same effects
|
||||
|
|
@ -293,12 +412,12 @@ void InputDefault::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool
|
|||
set_mouse_position(pos);
|
||||
}
|
||||
|
||||
if (main_loop && emulate_touch_from_mouse && !p_is_emulated && mb->get_button_index() == 1) {
|
||||
if (event_dispatch_function && emulate_touch_from_mouse && !p_is_emulated && mb->get_button_index() == 1) {
|
||||
Ref<InputEventScreenTouch> touch_event;
|
||||
touch_event.instance();
|
||||
touch_event->set_pressed(mb->is_pressed());
|
||||
touch_event->set_position(mb->get_position());
|
||||
main_loop->input_event(touch_event);
|
||||
event_dispatch_function(touch_event);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -311,7 +430,7 @@ void InputDefault::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool
|
|||
set_mouse_position(pos);
|
||||
}
|
||||
|
||||
if (main_loop && emulate_touch_from_mouse && !p_is_emulated && mm->get_button_mask() & 1) {
|
||||
if (event_dispatch_function && emulate_touch_from_mouse && !p_is_emulated && mm->get_button_mask() & 1) {
|
||||
Ref<InputEventScreenDrag> drag_event;
|
||||
drag_event.instance();
|
||||
|
||||
|
|
@ -319,7 +438,7 @@ void InputDefault::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool
|
|||
drag_event->set_relative(mm->get_relative());
|
||||
drag_event->set_speed(mm->get_speed());
|
||||
|
||||
main_loop->input_event(drag_event);
|
||||
event_dispatch_function(drag_event);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -417,8 +536,8 @@ void InputDefault::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool
|
|||
|
||||
if (ge.is_valid()) {
|
||||
|
||||
if (main_loop) {
|
||||
main_loop->input_event(ge);
|
||||
if (event_dispatch_function) {
|
||||
event_dispatch_function(ge);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -438,18 +557,18 @@ void InputDefault::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool
|
|||
}
|
||||
}
|
||||
|
||||
if (main_loop)
|
||||
main_loop->input_event(p_event);
|
||||
if (event_dispatch_function)
|
||||
event_dispatch_function(p_event);
|
||||
}
|
||||
|
||||
void InputDefault::set_joy_axis(int p_device, int p_axis, float p_value) {
|
||||
void InputFilter::set_joy_axis(int p_device, int p_axis, float p_value) {
|
||||
|
||||
_THREAD_SAFE_METHOD_
|
||||
int c = _combine_device(p_axis, p_device);
|
||||
_joy_axis[c] = p_value;
|
||||
}
|
||||
|
||||
void InputDefault::start_joy_vibration(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration) {
|
||||
void InputFilter::start_joy_vibration(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
if (p_weak_magnitude < 0.f || p_weak_magnitude > 1.f || p_strong_magnitude < 0.f || p_strong_magnitude > 1.f) {
|
||||
return;
|
||||
|
|
@ -462,7 +581,7 @@ void InputDefault::start_joy_vibration(int p_device, float p_weak_magnitude, flo
|
|||
joy_vibration[p_device] = vibration;
|
||||
}
|
||||
|
||||
void InputDefault::stop_joy_vibration(int p_device) {
|
||||
void InputFilter::stop_joy_vibration(int p_device) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
VibrationInfo vibration;
|
||||
vibration.weak_magnitude = 0;
|
||||
|
|
@ -472,68 +591,63 @@ void InputDefault::stop_joy_vibration(int p_device) {
|
|||
joy_vibration[p_device] = vibration;
|
||||
}
|
||||
|
||||
void InputDefault::vibrate_handheld(int p_duration_ms) {
|
||||
void InputFilter::vibrate_handheld(int p_duration_ms) {
|
||||
OS::get_singleton()->vibrate_handheld(p_duration_ms);
|
||||
}
|
||||
|
||||
void InputDefault::set_gravity(const Vector3 &p_gravity) {
|
||||
void InputFilter::set_gravity(const Vector3 &p_gravity) {
|
||||
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
gravity = p_gravity;
|
||||
}
|
||||
|
||||
void InputDefault::set_accelerometer(const Vector3 &p_accel) {
|
||||
void InputFilter::set_accelerometer(const Vector3 &p_accel) {
|
||||
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
accelerometer = p_accel;
|
||||
}
|
||||
|
||||
void InputDefault::set_magnetometer(const Vector3 &p_magnetometer) {
|
||||
void InputFilter::set_magnetometer(const Vector3 &p_magnetometer) {
|
||||
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
magnetometer = p_magnetometer;
|
||||
}
|
||||
|
||||
void InputDefault::set_gyroscope(const Vector3 &p_gyroscope) {
|
||||
void InputFilter::set_gyroscope(const Vector3 &p_gyroscope) {
|
||||
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
gyroscope = p_gyroscope;
|
||||
}
|
||||
|
||||
void InputDefault::set_main_loop(MainLoop *p_main_loop) {
|
||||
main_loop = p_main_loop;
|
||||
}
|
||||
|
||||
void InputDefault::set_mouse_position(const Point2 &p_posf) {
|
||||
void InputFilter::set_mouse_position(const Point2 &p_posf) {
|
||||
|
||||
mouse_speed_track.update(p_posf - mouse_pos);
|
||||
mouse_pos = p_posf;
|
||||
}
|
||||
|
||||
Point2 InputDefault::get_mouse_position() const {
|
||||
Point2 InputFilter::get_mouse_position() const {
|
||||
|
||||
return mouse_pos;
|
||||
}
|
||||
Point2 InputDefault::get_last_mouse_speed() const {
|
||||
Point2 InputFilter::get_last_mouse_speed() const {
|
||||
|
||||
return mouse_speed_track.speed;
|
||||
}
|
||||
|
||||
int InputDefault::get_mouse_button_mask() const {
|
||||
int InputFilter::get_mouse_button_mask() const {
|
||||
|
||||
return mouse_button_mask; // do not trust OS implementation, should remove it - OS::get_singleton()->get_mouse_button_state();
|
||||
}
|
||||
|
||||
void InputDefault::warp_mouse_position(const Vector2 &p_to) {
|
||||
|
||||
OS::get_singleton()->warp_mouse_position(p_to);
|
||||
void InputFilter::warp_mouse_position(const Vector2 &p_to) {
|
||||
warp_mouse_func(p_to);
|
||||
}
|
||||
|
||||
Point2i InputDefault::warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, const Rect2 &p_rect) {
|
||||
Point2i InputFilter::warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, const Rect2 &p_rect) {
|
||||
|
||||
// The relative distance reported for the next event after a warp is in the boundaries of the
|
||||
// size of the rect on that axis, but it may be greater, in which case there's not problem as fmod()
|
||||
|
|
@ -553,16 +667,16 @@ 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_position(pos_warped + p_rect.position);
|
||||
warp_mouse_position(pos_warped + p_rect.position);
|
||||
}
|
||||
|
||||
return rel_warped;
|
||||
}
|
||||
|
||||
void InputDefault::iteration(float p_step) {
|
||||
void InputFilter::iteration(float p_step) {
|
||||
}
|
||||
|
||||
void InputDefault::action_press(const StringName &p_action, float p_strength) {
|
||||
void InputFilter::action_press(const StringName &p_action, float p_strength) {
|
||||
|
||||
Action action;
|
||||
|
||||
|
|
@ -574,7 +688,7 @@ void InputDefault::action_press(const StringName &p_action, float p_strength) {
|
|||
action_state[p_action] = action;
|
||||
}
|
||||
|
||||
void InputDefault::action_release(const StringName &p_action) {
|
||||
void InputFilter::action_release(const StringName &p_action) {
|
||||
|
||||
Action action;
|
||||
|
||||
|
|
@ -586,19 +700,19 @@ void InputDefault::action_release(const StringName &p_action) {
|
|||
action_state[p_action] = action;
|
||||
}
|
||||
|
||||
void InputDefault::set_emulate_touch_from_mouse(bool p_emulate) {
|
||||
void InputFilter::set_emulate_touch_from_mouse(bool p_emulate) {
|
||||
|
||||
emulate_touch_from_mouse = p_emulate;
|
||||
}
|
||||
|
||||
bool InputDefault::is_emulating_touch_from_mouse() const {
|
||||
bool InputFilter::is_emulating_touch_from_mouse() const {
|
||||
|
||||
return emulate_touch_from_mouse;
|
||||
}
|
||||
|
||||
// Calling this whenever the game window is focused helps unstucking the "touch mouse"
|
||||
// if the OS or its abstraction class hasn't properly reported that touch pointers raised
|
||||
void InputDefault::ensure_touch_mouse_raised() {
|
||||
void InputFilter::ensure_touch_mouse_raised() {
|
||||
|
||||
if (mouse_from_touch_index != -1) {
|
||||
mouse_from_touch_index = -1;
|
||||
|
|
@ -617,22 +731,22 @@ void InputDefault::ensure_touch_mouse_raised() {
|
|||
}
|
||||
}
|
||||
|
||||
void InputDefault::set_emulate_mouse_from_touch(bool p_emulate) {
|
||||
void InputFilter::set_emulate_mouse_from_touch(bool p_emulate) {
|
||||
|
||||
emulate_mouse_from_touch = p_emulate;
|
||||
}
|
||||
|
||||
bool InputDefault::is_emulating_mouse_from_touch() const {
|
||||
bool InputFilter::is_emulating_mouse_from_touch() const {
|
||||
|
||||
return emulate_mouse_from_touch;
|
||||
}
|
||||
|
||||
Input::CursorShape InputDefault::get_default_cursor_shape() const {
|
||||
InputFilter::CursorShape InputFilter::get_default_cursor_shape() const {
|
||||
|
||||
return default_shape;
|
||||
}
|
||||
|
||||
void InputDefault::set_default_cursor_shape(CursorShape p_shape) {
|
||||
void InputFilter::set_default_cursor_shape(CursorShape p_shape) {
|
||||
|
||||
if (default_shape == p_shape)
|
||||
return;
|
||||
|
|
@ -647,19 +761,19 @@ void InputDefault::set_default_cursor_shape(CursorShape p_shape) {
|
|||
parse_input_event(mm);
|
||||
}
|
||||
|
||||
Input::CursorShape InputDefault::get_current_cursor_shape() const {
|
||||
InputFilter::CursorShape InputFilter::get_current_cursor_shape() const {
|
||||
|
||||
return (Input::CursorShape)OS::get_singleton()->get_cursor_shape();
|
||||
return get_current_cursor_shape_func();
|
||||
}
|
||||
|
||||
void InputDefault::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
|
||||
void InputFilter::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
|
||||
if (Engine::get_singleton()->is_editor_hint())
|
||||
return;
|
||||
|
||||
OS::get_singleton()->set_custom_mouse_cursor(p_cursor, (OS::CursorShape)p_shape, p_hotspot);
|
||||
set_custom_mouse_cursor_func(p_cursor, p_shape, p_hotspot);
|
||||
}
|
||||
|
||||
void InputDefault::accumulate_input_event(const Ref<InputEvent> &p_event) {
|
||||
void InputFilter::accumulate_input_event(const Ref<InputEvent> &p_event) {
|
||||
ERR_FAIL_COND(p_event.is_null());
|
||||
|
||||
if (!use_accumulated_input) {
|
||||
|
|
@ -672,7 +786,7 @@ void InputDefault::accumulate_input_event(const Ref<InputEvent> &p_event) {
|
|||
|
||||
accumulated_events.push_back(p_event);
|
||||
}
|
||||
void InputDefault::flush_accumulated_events() {
|
||||
void InputFilter::flush_accumulated_events() {
|
||||
|
||||
while (accumulated_events.front()) {
|
||||
parse_input_event(accumulated_events.front()->get());
|
||||
|
|
@ -680,12 +794,12 @@ void InputDefault::flush_accumulated_events() {
|
|||
}
|
||||
}
|
||||
|
||||
void InputDefault::set_use_accumulated_input(bool p_enable) {
|
||||
void InputFilter::set_use_accumulated_input(bool p_enable) {
|
||||
|
||||
use_accumulated_input = p_enable;
|
||||
}
|
||||
|
||||
void InputDefault::release_pressed_events() {
|
||||
void InputFilter::release_pressed_events() {
|
||||
|
||||
flush_accumulated_events(); // this is needed to release actions strengths
|
||||
|
||||
|
|
@ -693,61 +807,17 @@ void InputDefault::release_pressed_events() {
|
|||
joy_buttons_pressed.clear();
|
||||
_joy_axis.clear();
|
||||
|
||||
for (Map<StringName, InputDefault::Action>::Element *E = action_state.front(); E; E = E->next()) {
|
||||
for (Map<StringName, InputFilter::Action>::Element *E = action_state.front(); E; E = E->next()) {
|
||||
if (E->get().pressed)
|
||||
action_release(E->key());
|
||||
}
|
||||
}
|
||||
|
||||
InputDefault::InputDefault() {
|
||||
|
||||
use_accumulated_input = true;
|
||||
mouse_button_mask = 0;
|
||||
emulate_touch_from_mouse = false;
|
||||
emulate_mouse_from_touch = false;
|
||||
mouse_from_touch_index = -1;
|
||||
main_loop = NULL;
|
||||
default_shape = CURSOR_ARROW;
|
||||
|
||||
hat_map_default[HAT_UP].type = TYPE_BUTTON;
|
||||
hat_map_default[HAT_UP].index = JOY_DPAD_UP;
|
||||
hat_map_default[HAT_UP].value = 0;
|
||||
|
||||
hat_map_default[HAT_RIGHT].type = TYPE_BUTTON;
|
||||
hat_map_default[HAT_RIGHT].index = JOY_DPAD_RIGHT;
|
||||
hat_map_default[HAT_RIGHT].value = 0;
|
||||
|
||||
hat_map_default[HAT_DOWN].type = TYPE_BUTTON;
|
||||
hat_map_default[HAT_DOWN].index = JOY_DPAD_DOWN;
|
||||
hat_map_default[HAT_DOWN].value = 0;
|
||||
|
||||
hat_map_default[HAT_LEFT].type = TYPE_BUTTON;
|
||||
hat_map_default[HAT_LEFT].index = JOY_DPAD_LEFT;
|
||||
hat_map_default[HAT_LEFT].value = 0;
|
||||
|
||||
fallback_mapping = -1;
|
||||
|
||||
// Parse default mappings.
|
||||
{
|
||||
int i = 0;
|
||||
while (DefaultControllerMappings::mappings[i]) {
|
||||
parse_mapping(DefaultControllerMappings::mappings[i++]);
|
||||
}
|
||||
}
|
||||
|
||||
// If defined, parse SDL_GAMECONTROLLERCONFIG for possible new mappings/overrides.
|
||||
String env_mapping = OS::get_singleton()->get_environment("SDL_GAMECONTROLLERCONFIG");
|
||||
if (env_mapping != "") {
|
||||
Vector<String> entries = env_mapping.split("\n");
|
||||
for (int i = 0; i < entries.size(); i++) {
|
||||
if (entries[i] == "")
|
||||
continue;
|
||||
parse_mapping(entries[i]);
|
||||
}
|
||||
}
|
||||
void InputFilter::set_event_dispatch_function(EventDispatchFunc p_function) {
|
||||
event_dispatch_function = p_function;
|
||||
}
|
||||
|
||||
void InputDefault::joy_button(int p_device, int p_button, bool p_pressed) {
|
||||
void InputFilter::joy_button(int p_device, int p_button, bool p_pressed) {
|
||||
|
||||
_THREAD_SAFE_METHOD_;
|
||||
Joypad &joy = joy_names[p_device];
|
||||
|
|
@ -786,7 +856,7 @@ void InputDefault::joy_button(int p_device, int p_button, bool p_pressed) {
|
|||
// no event?
|
||||
}
|
||||
|
||||
void InputDefault::joy_axis(int p_device, int p_axis, const JoyAxis &p_value) {
|
||||
void InputFilter::joy_axis(int p_device, int p_axis, const JoyAxis &p_value) {
|
||||
|
||||
_THREAD_SAFE_METHOD_;
|
||||
|
||||
|
|
@ -901,7 +971,7 @@ void InputDefault::joy_axis(int p_device, int p_axis, const JoyAxis &p_value) {
|
|||
//printf("invalid mapping\n");
|
||||
}
|
||||
|
||||
void InputDefault::joy_hat(int p_device, int p_val) {
|
||||
void InputFilter::joy_hat(int p_device, int p_val) {
|
||||
|
||||
_THREAD_SAFE_METHOD_;
|
||||
const Joypad &joy = joy_names[p_device];
|
||||
|
|
@ -933,7 +1003,7 @@ void InputDefault::joy_hat(int p_device, int p_val) {
|
|||
joy_names[p_device].hat_current = p_val;
|
||||
}
|
||||
|
||||
void InputDefault::_button_event(int p_device, int p_index, bool p_pressed) {
|
||||
void InputFilter::_button_event(int p_device, int p_index, bool p_pressed) {
|
||||
|
||||
Ref<InputEventJoypadButton> ievent;
|
||||
ievent.instance();
|
||||
|
|
@ -944,7 +1014,7 @@ void InputDefault::_button_event(int p_device, int p_index, bool p_pressed) {
|
|||
parse_input_event(ievent);
|
||||
}
|
||||
|
||||
void InputDefault::_axis_event(int p_device, int p_axis, float p_value) {
|
||||
void InputFilter::_axis_event(int p_device, int p_axis, float p_value) {
|
||||
|
||||
Ref<InputEventJoypadMotion> ievent;
|
||||
ievent.instance();
|
||||
|
|
@ -955,7 +1025,7 @@ void InputDefault::_axis_event(int p_device, int p_axis, float p_value) {
|
|||
parse_input_event(ievent);
|
||||
};
|
||||
|
||||
InputDefault::JoyEvent InputDefault::_find_to_event(String p_to) {
|
||||
InputFilter::JoyEvent InputFilter::_find_to_event(String p_to) {
|
||||
|
||||
// string names of the SDL buttons in the same order as input_event.h godot buttons
|
||||
static const char *buttons[] = { "a", "b", "x", "y", "leftshoulder", "rightshoulder", "lefttrigger", "righttrigger", "leftstick", "rightstick", "back", "start", "dpup", "dpdown", "dpleft", "dpright", "guide", NULL };
|
||||
|
|
@ -993,7 +1063,7 @@ InputDefault::JoyEvent InputDefault::_find_to_event(String p_to) {
|
|||
return ret;
|
||||
};
|
||||
|
||||
void InputDefault::parse_mapping(String p_mapping) {
|
||||
void InputFilter::parse_mapping(String p_mapping) {
|
||||
|
||||
_THREAD_SAFE_METHOD_;
|
||||
JoyDeviceMapping mapping;
|
||||
|
|
@ -1058,7 +1128,7 @@ void InputDefault::parse_mapping(String p_mapping) {
|
|||
//printf("added mapping with uuid %ls\n", mapping.uid.c_str());
|
||||
};
|
||||
|
||||
void InputDefault::add_joy_mapping(String p_mapping, bool p_update_existing) {
|
||||
void InputFilter::add_joy_mapping(String p_mapping, bool p_update_existing) {
|
||||
parse_mapping(p_mapping);
|
||||
if (p_update_existing) {
|
||||
Vector<String> entry = p_mapping.split(",");
|
||||
|
|
@ -1071,7 +1141,7 @@ void InputDefault::add_joy_mapping(String p_mapping, bool p_update_existing) {
|
|||
}
|
||||
}
|
||||
|
||||
void InputDefault::remove_joy_mapping(String p_guid) {
|
||||
void InputFilter::remove_joy_mapping(String p_guid) {
|
||||
for (int i = map_db.size() - 1; i >= 0; i--) {
|
||||
if (p_guid == map_db[i].uid) {
|
||||
map_db.remove(i);
|
||||
|
|
@ -1084,7 +1154,7 @@ void InputDefault::remove_joy_mapping(String p_guid) {
|
|||
}
|
||||
}
|
||||
|
||||
void InputDefault::set_fallback_mapping(String p_guid) {
|
||||
void InputFilter::set_fallback_mapping(String p_guid) {
|
||||
|
||||
for (int i = 0; i < map_db.size(); i++) {
|
||||
if (map_db[i].uid == p_guid) {
|
||||
|
|
@ -1094,28 +1164,18 @@ void InputDefault::set_fallback_mapping(String p_guid) {
|
|||
}
|
||||
}
|
||||
|
||||
//Defaults to simple implementation for platforms with a fixed gamepad layout, like consoles.
|
||||
bool InputDefault::is_joy_known(int p_device) {
|
||||
|
||||
return OS::get_singleton()->is_joy_known(p_device);
|
||||
}
|
||||
|
||||
String InputDefault::get_joy_guid(int p_device) const {
|
||||
return OS::get_singleton()->get_joy_guid(p_device);
|
||||
}
|
||||
|
||||
//platforms that use the remapping system can override and call to these ones
|
||||
bool InputDefault::is_joy_mapped(int p_device) {
|
||||
bool InputFilter::is_joy_known(int p_device) {
|
||||
int mapping = joy_names[p_device].mapping;
|
||||
return mapping != -1 ? (mapping != fallback_mapping) : false;
|
||||
}
|
||||
|
||||
String InputDefault::get_joy_guid_remapped(int p_device) const {
|
||||
String InputFilter::get_joy_guid(int p_device) const {
|
||||
ERR_FAIL_COND_V(!joy_names.has(p_device), "");
|
||||
return joy_names[p_device].uid;
|
||||
}
|
||||
|
||||
Array InputDefault::get_connected_joypads() {
|
||||
Array InputFilter::get_connected_joypads() {
|
||||
Array ret;
|
||||
Map<int, Joypad>::Element *elem = joy_names.front();
|
||||
while (elem) {
|
||||
|
|
@ -1159,12 +1219,12 @@ static const char *_axes[JOY_AXIS_MAX] = {
|
|||
""
|
||||
};
|
||||
|
||||
String InputDefault::get_joy_button_string(int p_button) {
|
||||
String InputFilter::get_joy_button_string(int p_button) {
|
||||
ERR_FAIL_INDEX_V(p_button, JOY_BUTTON_MAX, "");
|
||||
return _buttons[p_button];
|
||||
}
|
||||
|
||||
int InputDefault::get_joy_button_index_from_string(String p_button) {
|
||||
int InputFilter::get_joy_button_index_from_string(String p_button) {
|
||||
for (int i = 0; i < JOY_BUTTON_MAX; i++) {
|
||||
if (p_button == _buttons[i]) {
|
||||
return i;
|
||||
|
|
@ -1173,7 +1233,7 @@ int InputDefault::get_joy_button_index_from_string(String p_button) {
|
|||
ERR_FAIL_V(-1);
|
||||
}
|
||||
|
||||
int InputDefault::get_unused_joy_id() {
|
||||
int InputFilter::get_unused_joy_id() {
|
||||
for (int i = 0; i < JOYPADS_MAX; i++) {
|
||||
if (!joy_names.has(i) || !joy_names[i].connected) {
|
||||
return i;
|
||||
|
|
@ -1182,12 +1242,12 @@ int InputDefault::get_unused_joy_id() {
|
|||
return -1;
|
||||
}
|
||||
|
||||
String InputDefault::get_joy_axis_string(int p_axis) {
|
||||
String InputFilter::get_joy_axis_string(int p_axis) {
|
||||
ERR_FAIL_INDEX_V(p_axis, JOY_AXIS_MAX, "");
|
||||
return _axes[p_axis];
|
||||
}
|
||||
|
||||
int InputDefault::get_joy_axis_index_from_string(String p_axis) {
|
||||
int InputFilter::get_joy_axis_index_from_string(String p_axis) {
|
||||
for (int i = 0; i < JOY_AXIS_MAX; i++) {
|
||||
if (p_axis == _axes[i]) {
|
||||
return i;
|
||||
|
|
@ -1195,3 +1255,55 @@ int InputDefault::get_joy_axis_index_from_string(String p_axis) {
|
|||
}
|
||||
ERR_FAIL_V(-1);
|
||||
}
|
||||
|
||||
InputFilter::InputFilter() {
|
||||
|
||||
singleton = this;
|
||||
use_accumulated_input = true;
|
||||
mouse_button_mask = 0;
|
||||
mouse_window = 0;
|
||||
emulate_touch_from_mouse = false;
|
||||
emulate_mouse_from_touch = false;
|
||||
mouse_from_touch_index = -1;
|
||||
event_dispatch_function = nullptr;
|
||||
default_shape = CURSOR_ARROW;
|
||||
|
||||
hat_map_default[HAT_UP].type = TYPE_BUTTON;
|
||||
hat_map_default[HAT_UP].index = JOY_DPAD_UP;
|
||||
hat_map_default[HAT_UP].value = 0;
|
||||
|
||||
hat_map_default[HAT_RIGHT].type = TYPE_BUTTON;
|
||||
hat_map_default[HAT_RIGHT].index = JOY_DPAD_RIGHT;
|
||||
hat_map_default[HAT_RIGHT].value = 0;
|
||||
|
||||
hat_map_default[HAT_DOWN].type = TYPE_BUTTON;
|
||||
hat_map_default[HAT_DOWN].index = JOY_DPAD_DOWN;
|
||||
hat_map_default[HAT_DOWN].value = 0;
|
||||
|
||||
hat_map_default[HAT_LEFT].type = TYPE_BUTTON;
|
||||
hat_map_default[HAT_LEFT].index = JOY_DPAD_LEFT;
|
||||
hat_map_default[HAT_LEFT].value = 0;
|
||||
|
||||
fallback_mapping = -1;
|
||||
|
||||
// Parse default mappings.
|
||||
{
|
||||
int i = 0;
|
||||
while (DefaultControllerMappings::mappings[i]) {
|
||||
parse_mapping(DefaultControllerMappings::mappings[i++]);
|
||||
}
|
||||
}
|
||||
|
||||
// If defined, parse SDL_GAMECONTROLLERCONFIG for possible new mappings/overrides.
|
||||
String env_mapping = OS::get_singleton()->get_environment("SDL_GAMECONTROLLERCONFIG");
|
||||
if (env_mapping != "") {
|
||||
Vector<String> entries = env_mapping.split("\n");
|
||||
for (int i = 0; i < entries.size(); i++) {
|
||||
if (entries[i] == "")
|
||||
continue;
|
||||
parse_mapping(entries[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* input_default.h */
|
||||
/* input_filter.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
|
@ -28,16 +28,78 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef INPUT_DEFAULT_H
|
||||
#define INPUT_DEFAULT_H
|
||||
#ifndef INPUT_H
|
||||
#define INPUT_H
|
||||
|
||||
#include "core/os/input.h"
|
||||
#include "core/input/input_event.h"
|
||||
#include "core/object.h"
|
||||
#include "core/os/thread_safe.h"
|
||||
|
||||
class InputDefault : public Input {
|
||||
class InputFilter : public Object {
|
||||
|
||||
GDCLASS(InputDefault, Input);
|
||||
GDCLASS(InputFilter, Object);
|
||||
_THREAD_SAFE_CLASS_
|
||||
|
||||
static InputFilter *singleton;
|
||||
|
||||
public:
|
||||
enum MouseMode {
|
||||
MOUSE_MODE_VISIBLE,
|
||||
MOUSE_MODE_HIDDEN,
|
||||
MOUSE_MODE_CAPTURED,
|
||||
MOUSE_MODE_CONFINED
|
||||
};
|
||||
|
||||
#undef CursorShape
|
||||
enum CursorShape {
|
||||
CURSOR_ARROW,
|
||||
CURSOR_IBEAM,
|
||||
CURSOR_POINTING_HAND,
|
||||
CURSOR_CROSS,
|
||||
CURSOR_WAIT,
|
||||
CURSOR_BUSY,
|
||||
CURSOR_DRAG,
|
||||
CURSOR_CAN_DROP,
|
||||
CURSOR_FORBIDDEN,
|
||||
CURSOR_VSIZE,
|
||||
CURSOR_HSIZE,
|
||||
CURSOR_BDIAGSIZE,
|
||||
CURSOR_FDIAGSIZE,
|
||||
CURSOR_MOVE,
|
||||
CURSOR_VSPLIT,
|
||||
CURSOR_HSPLIT,
|
||||
CURSOR_HELP,
|
||||
CURSOR_MAX
|
||||
};
|
||||
|
||||
enum HatMask {
|
||||
HAT_MASK_CENTER = 0,
|
||||
HAT_MASK_UP = 1,
|
||||
HAT_MASK_RIGHT = 2,
|
||||
HAT_MASK_DOWN = 4,
|
||||
HAT_MASK_LEFT = 8,
|
||||
};
|
||||
|
||||
enum HatDir {
|
||||
HAT_UP,
|
||||
HAT_RIGHT,
|
||||
HAT_DOWN,
|
||||
HAT_LEFT,
|
||||
HAT_MAX,
|
||||
};
|
||||
|
||||
enum {
|
||||
JOYPADS_MAX = 16,
|
||||
};
|
||||
|
||||
struct JoyAxis {
|
||||
int min;
|
||||
float value;
|
||||
};
|
||||
|
||||
typedef void (*EventDispatchFunc)(const Ref<InputEvent> &p_event);
|
||||
|
||||
private:
|
||||
int mouse_button_mask;
|
||||
|
||||
Set<int> keys_pressed;
|
||||
|
|
@ -49,7 +111,7 @@ class InputDefault : public Input {
|
|||
Vector3 magnetometer;
|
||||
Vector3 gyroscope;
|
||||
Vector2 mouse_pos;
|
||||
MainLoop *main_loop;
|
||||
int64_t mouse_window;
|
||||
|
||||
struct Action {
|
||||
uint64_t physics_frame;
|
||||
|
|
@ -123,33 +185,6 @@ class InputDefault : public Input {
|
|||
|
||||
CursorShape default_shape;
|
||||
|
||||
public:
|
||||
enum HatMask {
|
||||
HAT_MASK_CENTER = 0,
|
||||
HAT_MASK_UP = 1,
|
||||
HAT_MASK_RIGHT = 2,
|
||||
HAT_MASK_DOWN = 4,
|
||||
HAT_MASK_LEFT = 8,
|
||||
};
|
||||
|
||||
enum HatDir {
|
||||
HAT_UP,
|
||||
HAT_RIGHT,
|
||||
HAT_DOWN,
|
||||
HAT_LEFT,
|
||||
HAT_MAX,
|
||||
};
|
||||
|
||||
enum {
|
||||
JOYPADS_MAX = 16,
|
||||
};
|
||||
|
||||
struct JoyAxis {
|
||||
int min;
|
||||
float value;
|
||||
};
|
||||
|
||||
private:
|
||||
enum JoyType {
|
||||
TYPE_BUTTON,
|
||||
TYPE_AXIS,
|
||||
|
|
@ -185,38 +220,57 @@ private:
|
|||
|
||||
List<Ref<InputEvent>> accumulated_events;
|
||||
bool use_accumulated_input;
|
||||
friend class DisplayServer;
|
||||
|
||||
static void (*set_mouse_mode_func)(MouseMode);
|
||||
static MouseMode (*get_mouse_mode_func)();
|
||||
static void (*warp_mouse_func)(const Vector2 &p_to_pos);
|
||||
|
||||
static CursorShape (*get_current_cursor_shape_func)();
|
||||
static void (*set_custom_mouse_cursor_func)(const RES &, CursorShape, const Vector2 &);
|
||||
|
||||
EventDispatchFunc event_dispatch_function;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
virtual bool is_key_pressed(int p_keycode) const;
|
||||
virtual bool is_mouse_button_pressed(int p_button) const;
|
||||
virtual bool is_joy_button_pressed(int p_device, int p_button) const;
|
||||
virtual bool is_action_pressed(const StringName &p_action) const;
|
||||
virtual bool is_action_just_pressed(const StringName &p_action) const;
|
||||
virtual bool is_action_just_released(const StringName &p_action) const;
|
||||
virtual float get_action_strength(const StringName &p_action) const;
|
||||
void set_mouse_mode(MouseMode p_mode);
|
||||
MouseMode get_mouse_mode() const;
|
||||
void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const;
|
||||
|
||||
virtual float get_joy_axis(int p_device, int p_axis) const;
|
||||
static InputFilter *get_singleton();
|
||||
|
||||
bool is_key_pressed(int p_keycode) const;
|
||||
bool is_mouse_button_pressed(int p_button) const;
|
||||
bool is_joy_button_pressed(int p_device, int p_button) const;
|
||||
bool is_action_pressed(const StringName &p_action) const;
|
||||
bool is_action_just_pressed(const StringName &p_action) const;
|
||||
bool is_action_just_released(const StringName &p_action) const;
|
||||
float get_action_strength(const StringName &p_action) const;
|
||||
|
||||
float get_joy_axis(int p_device, int p_axis) const;
|
||||
String get_joy_name(int p_idx);
|
||||
virtual Array get_connected_joypads();
|
||||
virtual Vector2 get_joy_vibration_strength(int p_device);
|
||||
virtual float get_joy_vibration_duration(int p_device);
|
||||
virtual uint64_t get_joy_vibration_timestamp(int p_device);
|
||||
Array get_connected_joypads();
|
||||
Vector2 get_joy_vibration_strength(int p_device);
|
||||
float get_joy_vibration_duration(int p_device);
|
||||
uint64_t get_joy_vibration_timestamp(int p_device);
|
||||
void joy_connection_changed(int p_idx, bool p_connected, String p_name, String p_guid = "");
|
||||
void parse_joypad_mapping(String p_mapping, bool p_update_existing);
|
||||
|
||||
virtual Vector3 get_gravity() const;
|
||||
virtual Vector3 get_accelerometer() const;
|
||||
virtual Vector3 get_magnetometer() const;
|
||||
virtual Vector3 get_gyroscope() const;
|
||||
Vector3 get_gravity() const;
|
||||
Vector3 get_accelerometer() const;
|
||||
Vector3 get_magnetometer() const;
|
||||
Vector3 get_gyroscope() const;
|
||||
|
||||
virtual Point2 get_mouse_position() const;
|
||||
virtual Point2 get_last_mouse_speed() const;
|
||||
virtual int get_mouse_button_mask() const;
|
||||
Point2 get_mouse_position() const;
|
||||
Point2 get_last_mouse_speed() const;
|
||||
int get_mouse_button_mask() const;
|
||||
|
||||
virtual void warp_mouse_position(const Vector2 &p_to);
|
||||
virtual Point2i warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, const Rect2 &p_rect);
|
||||
void warp_mouse_position(const Vector2 &p_to);
|
||||
Point2i warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, const Rect2 &p_rect);
|
||||
|
||||
virtual void parse_input_event(const Ref<InputEvent> &p_event);
|
||||
void parse_input_event(const Ref<InputEvent> &p_event);
|
||||
|
||||
void set_gravity(const Vector3 &p_gravity);
|
||||
void set_accelerometer(const Vector3 &p_accel);
|
||||
|
|
@ -224,11 +278,10 @@ public:
|
|||
void set_gyroscope(const Vector3 &p_gyroscope);
|
||||
void set_joy_axis(int p_device, int p_axis, float p_value);
|
||||
|
||||
virtual void start_joy_vibration(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration = 0);
|
||||
virtual void stop_joy_vibration(int p_device);
|
||||
virtual void vibrate_handheld(int p_duration_ms = 500);
|
||||
void start_joy_vibration(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration = 0);
|
||||
void stop_joy_vibration(int p_device);
|
||||
void vibrate_handheld(int p_duration_ms = 500);
|
||||
|
||||
void set_main_loop(MainLoop *p_main_loop);
|
||||
void set_mouse_position(const Point2 &p_posf);
|
||||
|
||||
void action_press(const StringName &p_action, float p_strength = 1.f);
|
||||
|
|
@ -237,44 +290,48 @@ public:
|
|||
void iteration(float p_step);
|
||||
|
||||
void set_emulate_touch_from_mouse(bool p_emulate);
|
||||
virtual bool is_emulating_touch_from_mouse() const;
|
||||
bool is_emulating_touch_from_mouse() const;
|
||||
void ensure_touch_mouse_raised();
|
||||
|
||||
void set_emulate_mouse_from_touch(bool p_emulate);
|
||||
virtual bool is_emulating_mouse_from_touch() const;
|
||||
bool is_emulating_mouse_from_touch() const;
|
||||
|
||||
virtual CursorShape get_default_cursor_shape() const;
|
||||
virtual void set_default_cursor_shape(CursorShape p_shape);
|
||||
virtual CursorShape get_current_cursor_shape() const;
|
||||
virtual void set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape = Input::CURSOR_ARROW, const Vector2 &p_hotspot = Vector2());
|
||||
CursorShape get_default_cursor_shape() const;
|
||||
void set_default_cursor_shape(CursorShape p_shape);
|
||||
CursorShape get_current_cursor_shape() const;
|
||||
void set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape = InputFilter::CURSOR_ARROW, const Vector2 &p_hotspot = Vector2());
|
||||
|
||||
void parse_mapping(String p_mapping);
|
||||
void joy_button(int p_device, int p_button, bool p_pressed);
|
||||
void joy_axis(int p_device, int p_axis, const JoyAxis &p_value);
|
||||
void joy_hat(int p_device, int p_val);
|
||||
|
||||
virtual void add_joy_mapping(String p_mapping, bool p_update_existing = false);
|
||||
virtual void remove_joy_mapping(String p_guid);
|
||||
virtual bool is_joy_known(int p_device);
|
||||
virtual String get_joy_guid(int p_device) const;
|
||||
void add_joy_mapping(String p_mapping, bool p_update_existing = false);
|
||||
void remove_joy_mapping(String p_guid);
|
||||
|
||||
virtual String get_joy_button_string(int p_button);
|
||||
virtual String get_joy_axis_string(int p_axis);
|
||||
virtual int get_joy_axis_index_from_string(String p_axis);
|
||||
virtual int get_joy_button_index_from_string(String p_button);
|
||||
String get_joy_button_string(int p_button);
|
||||
String get_joy_axis_string(int p_axis);
|
||||
int get_joy_axis_index_from_string(String p_axis);
|
||||
int get_joy_button_index_from_string(String p_button);
|
||||
|
||||
int get_unused_joy_id();
|
||||
|
||||
bool is_joy_mapped(int p_device);
|
||||
String get_joy_guid_remapped(int p_device) const;
|
||||
bool is_joy_known(int p_device);
|
||||
String get_joy_guid(int p_device) const;
|
||||
void set_fallback_mapping(String p_guid);
|
||||
|
||||
virtual void accumulate_input_event(const Ref<InputEvent> &p_event);
|
||||
virtual void flush_accumulated_events();
|
||||
virtual void set_use_accumulated_input(bool p_enable);
|
||||
void accumulate_input_event(const Ref<InputEvent> &p_event);
|
||||
void flush_accumulated_events();
|
||||
void set_use_accumulated_input(bool p_enable);
|
||||
|
||||
virtual void release_pressed_events();
|
||||
InputDefault();
|
||||
void release_pressed_events();
|
||||
|
||||
void set_event_dispatch_function(EventDispatchFunc p_function);
|
||||
|
||||
InputFilter();
|
||||
};
|
||||
|
||||
#endif // INPUT_DEFAULT_H
|
||||
VARIANT_ENUM_CAST(InputFilter::MouseMode);
|
||||
VARIANT_ENUM_CAST(InputFilter::CursorShape);
|
||||
|
||||
#endif // INPUT_H
|
||||
|
|
@ -31,8 +31,8 @@
|
|||
#ifndef INPUT_MAP_H
|
||||
#define INPUT_MAP_H
|
||||
|
||||
#include "core/input/input_event.h"
|
||||
#include "core/object.h"
|
||||
#include "core/os/input_event.h"
|
||||
|
||||
class InputMap : public Object {
|
||||
|
||||
|
|
@ -118,6 +118,9 @@ MAKE_PTRARG(String);
|
|||
MAKE_PTRARG(Vector2);
|
||||
MAKE_PTRARG(Rect2);
|
||||
MAKE_PTRARG_BY_REFERENCE(Vector3);
|
||||
MAKE_PTRARG(Vector2i);
|
||||
MAKE_PTRARG(Rect2i);
|
||||
MAKE_PTRARG_BY_REFERENCE(Vector3i);
|
||||
MAKE_PTRARG(Transform2D);
|
||||
MAKE_PTRARG_BY_REFERENCE(Plane);
|
||||
MAKE_PTRARG(Quat);
|
||||
|
|
|
|||
|
|
@ -1,157 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* input.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2020 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 "input.h"
|
||||
|
||||
#include "core/input_map.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/project_settings.h"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
#include "editor/editor_settings.h"
|
||||
#endif
|
||||
|
||||
Input *Input::singleton = NULL;
|
||||
|
||||
Input *Input::get_singleton() {
|
||||
|
||||
return singleton;
|
||||
}
|
||||
|
||||
void Input::set_mouse_mode(MouseMode p_mode) {
|
||||
ERR_FAIL_INDEX((int)p_mode, 4);
|
||||
OS::get_singleton()->set_mouse_mode((OS::MouseMode)p_mode);
|
||||
}
|
||||
|
||||
Input::MouseMode Input::get_mouse_mode() const {
|
||||
|
||||
return (MouseMode)OS::get_singleton()->get_mouse_mode();
|
||||
}
|
||||
|
||||
void Input::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("is_key_pressed", "keycode"), &Input::is_key_pressed);
|
||||
ClassDB::bind_method(D_METHOD("is_mouse_button_pressed", "button"), &Input::is_mouse_button_pressed);
|
||||
ClassDB::bind_method(D_METHOD("is_joy_button_pressed", "device", "button"), &Input::is_joy_button_pressed);
|
||||
ClassDB::bind_method(D_METHOD("is_action_pressed", "action"), &Input::is_action_pressed);
|
||||
ClassDB::bind_method(D_METHOD("is_action_just_pressed", "action"), &Input::is_action_just_pressed);
|
||||
ClassDB::bind_method(D_METHOD("is_action_just_released", "action"), &Input::is_action_just_released);
|
||||
ClassDB::bind_method(D_METHOD("get_action_strength", "action"), &Input::get_action_strength);
|
||||
ClassDB::bind_method(D_METHOD("add_joy_mapping", "mapping", "update_existing"), &Input::add_joy_mapping, DEFVAL(false));
|
||||
ClassDB::bind_method(D_METHOD("remove_joy_mapping", "guid"), &Input::remove_joy_mapping);
|
||||
ClassDB::bind_method(D_METHOD("joy_connection_changed", "device", "connected", "name", "guid"), &Input::joy_connection_changed);
|
||||
ClassDB::bind_method(D_METHOD("is_joy_known", "device"), &Input::is_joy_known);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_axis", "device", "axis"), &Input::get_joy_axis);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_name", "device"), &Input::get_joy_name);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_guid", "device"), &Input::get_joy_guid);
|
||||
ClassDB::bind_method(D_METHOD("get_connected_joypads"), &Input::get_connected_joypads);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_vibration_strength", "device"), &Input::get_joy_vibration_strength);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_vibration_duration", "device"), &Input::get_joy_vibration_duration);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_button_string", "button_index"), &Input::get_joy_button_string);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_button_index_from_string", "button"), &Input::get_joy_button_index_from_string);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_axis_string", "axis_index"), &Input::get_joy_axis_string);
|
||||
ClassDB::bind_method(D_METHOD("get_joy_axis_index_from_string", "axis"), &Input::get_joy_axis_index_from_string);
|
||||
ClassDB::bind_method(D_METHOD("start_joy_vibration", "device", "weak_magnitude", "strong_magnitude", "duration"), &Input::start_joy_vibration, DEFVAL(0));
|
||||
ClassDB::bind_method(D_METHOD("stop_joy_vibration", "device"), &Input::stop_joy_vibration);
|
||||
ClassDB::bind_method(D_METHOD("vibrate_handheld", "duration_ms"), &Input::vibrate_handheld, DEFVAL(500));
|
||||
ClassDB::bind_method(D_METHOD("get_gravity"), &Input::get_gravity);
|
||||
ClassDB::bind_method(D_METHOD("get_accelerometer"), &Input::get_accelerometer);
|
||||
ClassDB::bind_method(D_METHOD("get_magnetometer"), &Input::get_magnetometer);
|
||||
ClassDB::bind_method(D_METHOD("get_gyroscope"), &Input::get_gyroscope);
|
||||
//ClassDB::bind_method(D_METHOD("get_mouse_position"),&Input::get_mouse_position); - this is not the function you want
|
||||
ClassDB::bind_method(D_METHOD("get_last_mouse_speed"), &Input::get_last_mouse_speed);
|
||||
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_position", "to"), &Input::warp_mouse_position);
|
||||
ClassDB::bind_method(D_METHOD("action_press", "action", "strength"), &Input::action_press, DEFVAL(1.f));
|
||||
ClassDB::bind_method(D_METHOD("action_release", "action"), &Input::action_release);
|
||||
ClassDB::bind_method(D_METHOD("set_default_cursor_shape", "shape"), &Input::set_default_cursor_shape, DEFVAL(CURSOR_ARROW));
|
||||
ClassDB::bind_method(D_METHOD("get_current_cursor_shape"), &Input::get_current_cursor_shape);
|
||||
ClassDB::bind_method(D_METHOD("set_custom_mouse_cursor", "image", "shape", "hotspot"), &Input::set_custom_mouse_cursor, DEFVAL(CURSOR_ARROW), DEFVAL(Vector2()));
|
||||
ClassDB::bind_method(D_METHOD("parse_input_event", "event"), &Input::parse_input_event);
|
||||
ClassDB::bind_method(D_METHOD("set_use_accumulated_input", "enable"), &Input::set_use_accumulated_input);
|
||||
|
||||
BIND_ENUM_CONSTANT(MOUSE_MODE_VISIBLE);
|
||||
BIND_ENUM_CONSTANT(MOUSE_MODE_HIDDEN);
|
||||
BIND_ENUM_CONSTANT(MOUSE_MODE_CAPTURED);
|
||||
BIND_ENUM_CONSTANT(MOUSE_MODE_CONFINED);
|
||||
|
||||
BIND_ENUM_CONSTANT(CURSOR_ARROW);
|
||||
BIND_ENUM_CONSTANT(CURSOR_IBEAM);
|
||||
BIND_ENUM_CONSTANT(CURSOR_POINTING_HAND);
|
||||
BIND_ENUM_CONSTANT(CURSOR_CROSS);
|
||||
BIND_ENUM_CONSTANT(CURSOR_WAIT);
|
||||
BIND_ENUM_CONSTANT(CURSOR_BUSY);
|
||||
BIND_ENUM_CONSTANT(CURSOR_DRAG);
|
||||
BIND_ENUM_CONSTANT(CURSOR_CAN_DROP);
|
||||
BIND_ENUM_CONSTANT(CURSOR_FORBIDDEN);
|
||||
BIND_ENUM_CONSTANT(CURSOR_VSIZE);
|
||||
BIND_ENUM_CONSTANT(CURSOR_HSIZE);
|
||||
BIND_ENUM_CONSTANT(CURSOR_BDIAGSIZE);
|
||||
BIND_ENUM_CONSTANT(CURSOR_FDIAGSIZE);
|
||||
BIND_ENUM_CONSTANT(CURSOR_MOVE);
|
||||
BIND_ENUM_CONSTANT(CURSOR_VSPLIT);
|
||||
BIND_ENUM_CONSTANT(CURSOR_HSPLIT);
|
||||
BIND_ENUM_CONSTANT(CURSOR_HELP);
|
||||
|
||||
ADD_SIGNAL(MethodInfo("joy_connection_changed", PropertyInfo(Variant::INT, "device"), PropertyInfo(Variant::BOOL, "connected")));
|
||||
}
|
||||
|
||||
void Input::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
||||
const String quote_style = EDITOR_DEF("text_editor/completion/use_single_quotes", 0) ? "'" : "\"";
|
||||
|
||||
String pf = p_function;
|
||||
if (p_idx == 0 && (pf == "is_action_pressed" || pf == "action_press" || pf == "action_release" || pf == "is_action_just_pressed" || pf == "is_action_just_released" || pf == "get_action_strength")) {
|
||||
|
||||
List<PropertyInfo> pinfo;
|
||||
ProjectSettings::get_singleton()->get_property_list(&pinfo);
|
||||
|
||||
for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
|
||||
const PropertyInfo &pi = E->get();
|
||||
|
||||
if (!pi.name.begins_with("input/"))
|
||||
continue;
|
||||
|
||||
String name = pi.name.substr(pi.name.find("/") + 1, pi.name.length());
|
||||
r_options->push_back(quote_style + name + quote_style);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Input::Input() {
|
||||
|
||||
singleton = this;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
146
core/os/input.h
146
core/os/input.h
|
|
@ -1,146 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* input.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2020 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 INPUT_H
|
||||
#define INPUT_H
|
||||
|
||||
#include "core/object.h"
|
||||
#include "core/os/main_loop.h"
|
||||
#include "core/os/thread_safe.h"
|
||||
|
||||
class Input : public Object {
|
||||
|
||||
GDCLASS(Input, Object);
|
||||
|
||||
static Input *singleton;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
enum MouseMode {
|
||||
MOUSE_MODE_VISIBLE,
|
||||
MOUSE_MODE_HIDDEN,
|
||||
MOUSE_MODE_CAPTURED,
|
||||
MOUSE_MODE_CONFINED
|
||||
};
|
||||
|
||||
#undef CursorShape
|
||||
enum CursorShape {
|
||||
CURSOR_ARROW,
|
||||
CURSOR_IBEAM,
|
||||
CURSOR_POINTING_HAND,
|
||||
CURSOR_CROSS,
|
||||
CURSOR_WAIT,
|
||||
CURSOR_BUSY,
|
||||
CURSOR_DRAG,
|
||||
CURSOR_CAN_DROP,
|
||||
CURSOR_FORBIDDEN,
|
||||
CURSOR_VSIZE,
|
||||
CURSOR_HSIZE,
|
||||
CURSOR_BDIAGSIZE,
|
||||
CURSOR_FDIAGSIZE,
|
||||
CURSOR_MOVE,
|
||||
CURSOR_VSPLIT,
|
||||
CURSOR_HSPLIT,
|
||||
CURSOR_HELP,
|
||||
CURSOR_MAX
|
||||
};
|
||||
|
||||
void set_mouse_mode(MouseMode p_mode);
|
||||
MouseMode get_mouse_mode() const;
|
||||
|
||||
static Input *get_singleton();
|
||||
|
||||
virtual bool is_key_pressed(int p_keycode) const = 0;
|
||||
virtual bool is_mouse_button_pressed(int p_button) const = 0;
|
||||
virtual bool is_joy_button_pressed(int p_device, int p_button) const = 0;
|
||||
virtual bool is_action_pressed(const StringName &p_action) const = 0;
|
||||
virtual bool is_action_just_pressed(const StringName &p_action) const = 0;
|
||||
virtual bool is_action_just_released(const StringName &p_action) const = 0;
|
||||
virtual float get_action_strength(const StringName &p_action) const = 0;
|
||||
|
||||
virtual float get_joy_axis(int p_device, int p_axis) const = 0;
|
||||
virtual String get_joy_name(int p_idx) = 0;
|
||||
virtual Array get_connected_joypads() = 0;
|
||||
virtual void joy_connection_changed(int p_idx, bool p_connected, String p_name, String p_guid) = 0;
|
||||
virtual void add_joy_mapping(String p_mapping, bool p_update_existing = false) = 0;
|
||||
virtual void remove_joy_mapping(String p_guid) = 0;
|
||||
virtual bool is_joy_known(int p_device) = 0;
|
||||
virtual String get_joy_guid(int p_device) const = 0;
|
||||
virtual Vector2 get_joy_vibration_strength(int p_device) = 0;
|
||||
virtual float get_joy_vibration_duration(int p_device) = 0;
|
||||
virtual uint64_t get_joy_vibration_timestamp(int p_device) = 0;
|
||||
virtual void start_joy_vibration(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration = 0) = 0;
|
||||
virtual void stop_joy_vibration(int p_device) = 0;
|
||||
virtual void vibrate_handheld(int p_duration_ms = 500) = 0;
|
||||
|
||||
virtual Point2 get_mouse_position() const = 0;
|
||||
virtual Point2 get_last_mouse_speed() const = 0;
|
||||
virtual int get_mouse_button_mask() const = 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;
|
||||
virtual Vector3 get_accelerometer() const = 0;
|
||||
virtual Vector3 get_magnetometer() const = 0;
|
||||
virtual Vector3 get_gyroscope() const = 0;
|
||||
|
||||
virtual void action_press(const StringName &p_action, float p_strength = 1.f) = 0;
|
||||
virtual void action_release(const StringName &p_action) = 0;
|
||||
|
||||
void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const;
|
||||
|
||||
virtual bool is_emulating_touch_from_mouse() const = 0;
|
||||
virtual bool is_emulating_mouse_from_touch() const = 0;
|
||||
|
||||
virtual CursorShape get_default_cursor_shape() const = 0;
|
||||
virtual void set_default_cursor_shape(CursorShape p_shape) = 0;
|
||||
virtual CursorShape get_current_cursor_shape() const = 0;
|
||||
virtual void set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape = CURSOR_ARROW, const Vector2 &p_hotspot = Vector2()) = 0;
|
||||
|
||||
virtual String get_joy_button_string(int p_button) = 0;
|
||||
virtual String get_joy_axis_string(int p_axis) = 0;
|
||||
virtual int get_joy_button_index_from_string(String p_button) = 0;
|
||||
virtual int get_joy_axis_index_from_string(String p_axis) = 0;
|
||||
|
||||
virtual void parse_input_event(const Ref<InputEvent> &p_event) = 0;
|
||||
virtual void accumulate_input_event(const Ref<InputEvent> &p_event) = 0;
|
||||
virtual void flush_accumulated_events() = 0;
|
||||
virtual void set_use_accumulated_input(bool p_enable) = 0;
|
||||
|
||||
Input();
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(Input::MouseMode);
|
||||
VARIANT_ENUM_CAST(Input::CursorShape);
|
||||
|
||||
#endif // INPUT_H
|
||||
|
|
@ -34,30 +34,16 @@
|
|||
|
||||
void MainLoop::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("input_event", "event"), &MainLoop::input_event);
|
||||
ClassDB::bind_method(D_METHOD("input_text", "text"), &MainLoop::input_text);
|
||||
ClassDB::bind_method(D_METHOD("init"), &MainLoop::init);
|
||||
ClassDB::bind_method(D_METHOD("iteration", "delta"), &MainLoop::iteration);
|
||||
ClassDB::bind_method(D_METHOD("idle", "delta"), &MainLoop::idle);
|
||||
ClassDB::bind_method(D_METHOD("finish"), &MainLoop::finish);
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_input_event", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
|
||||
BIND_VMETHOD(MethodInfo("_input_text", PropertyInfo(Variant::STRING, "text")));
|
||||
BIND_VMETHOD(MethodInfo("_initialize"));
|
||||
BIND_VMETHOD(MethodInfo(Variant::BOOL, "_iteration", PropertyInfo(Variant::FLOAT, "delta")));
|
||||
BIND_VMETHOD(MethodInfo(Variant::BOOL, "_idle", PropertyInfo(Variant::FLOAT, "delta")));
|
||||
BIND_VMETHOD(MethodInfo("_drop_files", PropertyInfo(Variant::PACKED_STRING_ARRAY, "files"), PropertyInfo(Variant::INT, "from_screen")));
|
||||
BIND_VMETHOD(MethodInfo("_finalize"));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_global_menu_action", PropertyInfo(Variant::NIL, "id"), PropertyInfo(Variant::NIL, "meta")));
|
||||
|
||||
BIND_CONSTANT(NOTIFICATION_WM_MOUSE_ENTER);
|
||||
BIND_CONSTANT(NOTIFICATION_WM_MOUSE_EXIT);
|
||||
BIND_CONSTANT(NOTIFICATION_WM_FOCUS_IN);
|
||||
BIND_CONSTANT(NOTIFICATION_WM_FOCUS_OUT);
|
||||
BIND_CONSTANT(NOTIFICATION_WM_QUIT_REQUEST);
|
||||
BIND_CONSTANT(NOTIFICATION_WM_GO_BACK_REQUEST);
|
||||
BIND_CONSTANT(NOTIFICATION_WM_UNFOCUS_REQUEST);
|
||||
BIND_CONSTANT(NOTIFICATION_OS_MEMORY_WARNING);
|
||||
BIND_CONSTANT(NOTIFICATION_TRANSLATION_CHANGED);
|
||||
BIND_CONSTANT(NOTIFICATION_WM_ABOUT);
|
||||
|
|
@ -80,18 +66,6 @@ MainLoop::MainLoop() {
|
|||
MainLoop::~MainLoop() {
|
||||
}
|
||||
|
||||
void MainLoop::input_text(const String &p_text) {
|
||||
|
||||
if (get_script_instance())
|
||||
get_script_instance()->call("_input_text", p_text);
|
||||
}
|
||||
|
||||
void MainLoop::input_event(const Ref<InputEvent> &p_event) {
|
||||
|
||||
if (get_script_instance())
|
||||
get_script_instance()->call("_input_event", p_event);
|
||||
}
|
||||
|
||||
void MainLoop::init() {
|
||||
|
||||
if (init_script.is_valid())
|
||||
|
|
@ -115,18 +89,6 @@ bool MainLoop::idle(float p_time) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void MainLoop::drop_files(const Vector<String> &p_files, int p_from_screen) {
|
||||
|
||||
if (get_script_instance())
|
||||
get_script_instance()->call("_drop_files", p_files, p_from_screen);
|
||||
}
|
||||
|
||||
void MainLoop::global_menu_action(const Variant &p_id, const Variant &p_meta) {
|
||||
|
||||
if (get_script_instance())
|
||||
get_script_instance()->call("_global_menu_action", p_id, p_meta);
|
||||
}
|
||||
|
||||
void MainLoop::finish() {
|
||||
|
||||
if (get_script_instance()) {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#ifndef MAIN_LOOP_H
|
||||
#define MAIN_LOOP_H
|
||||
|
||||
#include "core/os/input_event.h"
|
||||
#include "core/input/input_event.h"
|
||||
#include "core/reference.h"
|
||||
#include "core/script_language.h"
|
||||
|
||||
|
|
@ -48,33 +48,20 @@ protected:
|
|||
public:
|
||||
enum {
|
||||
//make sure these are replicated in Node
|
||||
NOTIFICATION_WM_MOUSE_ENTER = 1002,
|
||||
NOTIFICATION_WM_MOUSE_EXIT = 1003,
|
||||
NOTIFICATION_WM_FOCUS_IN = 1004,
|
||||
NOTIFICATION_WM_FOCUS_OUT = 1005,
|
||||
NOTIFICATION_WM_QUIT_REQUEST = 1006,
|
||||
NOTIFICATION_WM_GO_BACK_REQUEST = 1007,
|
||||
NOTIFICATION_WM_UNFOCUS_REQUEST = 1008,
|
||||
NOTIFICATION_OS_MEMORY_WARNING = 1009,
|
||||
NOTIFICATION_TRANSLATION_CHANGED = 1010,
|
||||
NOTIFICATION_WM_ABOUT = 1011,
|
||||
NOTIFICATION_CRASH = 1012,
|
||||
NOTIFICATION_OS_IME_UPDATE = 1013,
|
||||
NOTIFICATION_APP_RESUMED = 1014,
|
||||
NOTIFICATION_APP_PAUSED = 1015,
|
||||
NOTIFICATION_OS_MEMORY_WARNING = 2009,
|
||||
NOTIFICATION_TRANSLATION_CHANGED = 2010,
|
||||
NOTIFICATION_WM_ABOUT = 2011,
|
||||
NOTIFICATION_CRASH = 2012,
|
||||
NOTIFICATION_OS_IME_UPDATE = 2013,
|
||||
NOTIFICATION_APP_RESUMED = 2014,
|
||||
NOTIFICATION_APP_PAUSED = 2015,
|
||||
};
|
||||
|
||||
virtual void input_event(const Ref<InputEvent> &p_event);
|
||||
virtual void input_text(const String &p_text);
|
||||
|
||||
virtual void init();
|
||||
virtual bool iteration(float p_time);
|
||||
virtual bool idle(float p_time);
|
||||
virtual void finish();
|
||||
|
||||
virtual void drop_files(const Vector<String> &p_files, int p_from_screen = 0);
|
||||
virtual void global_menu_action(const Variant &p_id, const Variant &p_meta);
|
||||
|
||||
void set_init_script(const Ref<Script> &p_init_script);
|
||||
|
||||
MainLoop();
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@
|
|||
|
||||
#include "midi_driver.h"
|
||||
|
||||
#include "core/input/input_filter.h"
|
||||
#include "core/os/os.h"
|
||||
#include "main/input_default.h"
|
||||
|
||||
uint8_t MIDIDriver::last_received_message = 0x00;
|
||||
MIDIDriver *MIDIDriver::singleton = NULL;
|
||||
|
|
@ -117,7 +117,7 @@ void MIDIDriver::receive_input_packet(uint64_t timestamp, uint8_t *data, uint32_
|
|||
break;
|
||||
}
|
||||
|
||||
InputDefault *id = Object::cast_to<InputDefault>(Input::get_singleton());
|
||||
InputFilter *id = InputFilter::get_singleton();
|
||||
id->parse_input_event(event);
|
||||
}
|
||||
|
||||
|
|
|
|||
229
core/os/os.cpp
229
core/os/os.cpp
|
|
@ -30,9 +30,9 @@
|
|||
|
||||
#include "os.h"
|
||||
|
||||
#include "core/input/input_filter.h"
|
||||
#include "core/os/dir_access.h"
|
||||
#include "core/os/file_access.h"
|
||||
#include "core/os/input.h"
|
||||
#include "core/os/midi_driver.h"
|
||||
#include "core/project_settings.h"
|
||||
#include "core/version_generated.gen.h"
|
||||
|
|
@ -139,14 +139,6 @@ void OS::printerr(const char *p_format, ...) {
|
|||
va_end(argp);
|
||||
};
|
||||
|
||||
void OS::set_keep_screen_on(bool p_enabled) {
|
||||
_keep_screen_on = p_enabled;
|
||||
}
|
||||
|
||||
bool OS::is_keep_screen_on() const {
|
||||
return _keep_screen_on;
|
||||
}
|
||||
|
||||
void OS::set_low_processor_usage_mode(bool p_enabled) {
|
||||
|
||||
low_processor_usage_mode = p_enabled;
|
||||
|
|
@ -167,15 +159,6 @@ int OS::get_low_processor_usage_mode_sleep_usec() const {
|
|||
return low_processor_usage_mode_sleep_usec;
|
||||
}
|
||||
|
||||
void OS::set_clipboard(const String &p_text) {
|
||||
|
||||
_local_clipboard = p_text;
|
||||
}
|
||||
String OS::get_clipboard() const {
|
||||
|
||||
return _local_clipboard;
|
||||
}
|
||||
|
||||
String OS::get_executable_path() const {
|
||||
|
||||
return _execpath;
|
||||
|
|
@ -216,31 +199,6 @@ static void _OS_printres(Object *p_obj) {
|
|||
print_line(str);
|
||||
}
|
||||
|
||||
bool OS::has_virtual_keyboard() const {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void OS::show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect, int p_max_input_length) {
|
||||
}
|
||||
|
||||
void OS::hide_virtual_keyboard() {
|
||||
}
|
||||
|
||||
int OS::get_virtual_keyboard_height() const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void OS::set_cursor_shape(CursorShape p_shape) {
|
||||
}
|
||||
|
||||
OS::CursorShape OS::get_cursor_shape() const {
|
||||
return CURSOR_ARROW;
|
||||
}
|
||||
|
||||
void OS::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
|
||||
}
|
||||
|
||||
void OS::print_all_resources(String p_to_file) {
|
||||
|
||||
ERR_FAIL_COND(p_to_file != "" && _OSPRF);
|
||||
|
|
@ -372,45 +330,6 @@ Error OS::shell_open(String p_uri) {
|
|||
};
|
||||
|
||||
// implement these with the canvas?
|
||||
Error OS::dialog_show(String p_title, String p_description, Vector<String> p_buttons, Object *p_obj, String p_callback) {
|
||||
|
||||
while (true) {
|
||||
|
||||
print("%ls\n--------\n%ls\n", p_title.c_str(), p_description.c_str());
|
||||
for (int i = 0; i < p_buttons.size(); i++) {
|
||||
if (i > 0) print(", ");
|
||||
print("%i=%ls", i + 1, p_buttons[i].c_str());
|
||||
};
|
||||
print("\n");
|
||||
String res = get_stdin_string().strip_edges();
|
||||
if (!res.is_numeric())
|
||||
continue;
|
||||
int n = res.to_int();
|
||||
if (n < 0 || n >= p_buttons.size())
|
||||
continue;
|
||||
if (p_obj && p_callback != "")
|
||||
p_obj->call_deferred(p_callback, n);
|
||||
break;
|
||||
};
|
||||
return OK;
|
||||
};
|
||||
|
||||
Error OS::dialog_input_text(String p_title, String p_description, String p_partial, Object *p_obj, String p_callback) {
|
||||
|
||||
ERR_FAIL_COND_V(!p_obj, FAILED);
|
||||
ERR_FAIL_COND_V(p_callback == "", FAILED);
|
||||
print("%ls\n---------\n%ls\n[%ls]:\n", p_title.c_str(), p_description.c_str(), p_partial.c_str());
|
||||
|
||||
String res = get_stdin_string().strip_edges();
|
||||
bool success = true;
|
||||
if (res == "") {
|
||||
res = p_partial;
|
||||
};
|
||||
|
||||
p_obj->call_deferred(p_callback, success, res);
|
||||
|
||||
return OK;
|
||||
};
|
||||
|
||||
uint64_t OS::get_static_memory_usage() const {
|
||||
|
||||
|
|
@ -427,12 +346,6 @@ Error OS::set_cwd(const String &p_cwd) {
|
|||
return ERR_CANT_OPEN;
|
||||
}
|
||||
|
||||
bool OS::has_touchscreen_ui_hint() const {
|
||||
|
||||
//return false;
|
||||
return Input::get_singleton() && Input::get_singleton()->is_emulating_touch_from_mouse();
|
||||
}
|
||||
|
||||
uint64_t OS::get_free_static_memory() const {
|
||||
|
||||
return Memory::get_mem_available();
|
||||
|
|
@ -441,17 +354,7 @@ uint64_t OS::get_free_static_memory() const {
|
|||
void OS::yield() {
|
||||
}
|
||||
|
||||
void OS::set_screen_orientation(ScreenOrientation p_orientation) {
|
||||
|
||||
_orientation = p_orientation;
|
||||
}
|
||||
|
||||
OS::ScreenOrientation OS::get_screen_orientation() const {
|
||||
|
||||
return (OS::ScreenOrientation)_orientation;
|
||||
}
|
||||
|
||||
void OS::_ensure_user_data_dir() {
|
||||
void OS::ensure_user_data_dir() {
|
||||
|
||||
String dd = get_user_data_dir();
|
||||
DirAccess *da = DirAccess::open(dd);
|
||||
|
|
@ -467,12 +370,6 @@ void OS::_ensure_user_data_dir() {
|
|||
memdelete(da);
|
||||
}
|
||||
|
||||
void OS::set_native_icon(const String &p_filename) {
|
||||
}
|
||||
|
||||
void OS::set_icon(const Ref<Image> &p_icon) {
|
||||
}
|
||||
|
||||
String OS::get_model_name() const {
|
||||
|
||||
return "GenericDevice";
|
||||
|
|
@ -484,15 +381,6 @@ void OS::set_cmdline(const char *p_execpath, const List<String> &p_args) {
|
|||
_cmdline = p_args;
|
||||
};
|
||||
|
||||
void OS::release_rendering_thread() {
|
||||
}
|
||||
|
||||
void OS::make_rendering_thread() {
|
||||
}
|
||||
|
||||
void OS::swap_buffers() {
|
||||
}
|
||||
|
||||
String OS::get_unique_id() const {
|
||||
|
||||
ERR_FAIL_V("");
|
||||
|
|
@ -503,31 +391,6 @@ int OS::get_processor_count() const {
|
|||
return 1;
|
||||
}
|
||||
|
||||
Error OS::native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track) {
|
||||
|
||||
return FAILED;
|
||||
};
|
||||
|
||||
bool OS::native_video_is_playing() const {
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
void OS::native_video_pause(){
|
||||
|
||||
};
|
||||
|
||||
void OS::native_video_unpause(){
|
||||
|
||||
};
|
||||
|
||||
void OS::native_video_stop(){
|
||||
|
||||
};
|
||||
|
||||
void OS::set_mouse_mode(MouseMode p_mode) {
|
||||
}
|
||||
|
||||
bool OS::can_use_threads() const {
|
||||
|
||||
#ifdef NO_THREADS
|
||||
|
|
@ -537,51 +400,6 @@ bool OS::can_use_threads() const {
|
|||
#endif
|
||||
}
|
||||
|
||||
OS::MouseMode OS::get_mouse_mode() const {
|
||||
|
||||
return MOUSE_MODE_VISIBLE;
|
||||
}
|
||||
|
||||
OS::LatinKeyboardVariant OS::get_latin_keyboard_variant() const {
|
||||
|
||||
return LATIN_KEYBOARD_QWERTY;
|
||||
}
|
||||
|
||||
bool OS::is_joy_known(int p_device) {
|
||||
return true;
|
||||
}
|
||||
|
||||
String OS::get_joy_guid(int p_device) const {
|
||||
return "Default Joypad";
|
||||
}
|
||||
|
||||
void OS::set_context(int p_context) {
|
||||
}
|
||||
|
||||
OS::SwitchVSyncCallbackInThread OS::switch_vsync_function = NULL;
|
||||
|
||||
void OS::set_use_vsync(bool p_enable) {
|
||||
_use_vsync = p_enable;
|
||||
if (switch_vsync_function) { //if a function was set, use function
|
||||
switch_vsync_function(p_enable);
|
||||
} else { //otherwise just call here
|
||||
_set_use_vsync(p_enable);
|
||||
}
|
||||
}
|
||||
|
||||
bool OS::is_vsync_enabled() const {
|
||||
|
||||
return _use_vsync;
|
||||
}
|
||||
|
||||
void OS::set_vsync_via_compositor(bool p_enable) {
|
||||
_vsync_via_compositor = p_enable;
|
||||
}
|
||||
|
||||
bool OS::is_vsync_via_compositor_enabled() const {
|
||||
return _vsync_via_compositor;
|
||||
}
|
||||
|
||||
void OS::set_has_server_feature_callback(HasServerFeatureCallback p_callback) {
|
||||
|
||||
has_server_feature_callback = p_callback;
|
||||
|
|
@ -653,48 +471,6 @@ bool OS::has_feature(const String &p_feature) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void OS::center_window() {
|
||||
|
||||
if (is_window_fullscreen()) return;
|
||||
|
||||
Point2 sp = get_screen_position(get_current_screen());
|
||||
Size2 scr = get_screen_size(get_current_screen());
|
||||
Size2 wnd = get_real_window_size();
|
||||
|
||||
int x = sp.width + (scr.width - wnd.width) / 2;
|
||||
int y = sp.height + (scr.height - wnd.height) / 2;
|
||||
|
||||
set_window_position(Vector2(x, y));
|
||||
}
|
||||
|
||||
int OS::get_video_driver_count() const {
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
const char *OS::get_video_driver_name(int p_driver) const {
|
||||
|
||||
switch (p_driver) {
|
||||
case VIDEO_DRIVER_GLES2:
|
||||
return "GLES2";
|
||||
case VIDEO_DRIVER_VULKAN:
|
||||
default:
|
||||
return "Vulkan";
|
||||
}
|
||||
}
|
||||
|
||||
int OS::get_audio_driver_count() const {
|
||||
|
||||
return AudioDriverManager::get_driver_count();
|
||||
}
|
||||
|
||||
const char *OS::get_audio_driver_name(int p_driver) const {
|
||||
|
||||
AudioDriver *driver = AudioDriverManager::get_driver(p_driver);
|
||||
ERR_FAIL_COND_V_MSG(!driver, "", "Cannot get audio driver at index '" + itos(p_driver) + "'.");
|
||||
return AudioDriverManager::get_driver(p_driver)->get_name();
|
||||
}
|
||||
|
||||
void OS::set_restart_on_exit(bool p_restart, const List<String> &p_restart_arguments) {
|
||||
restart_on_exit = p_restart;
|
||||
restart_commandline = p_restart_arguments;
|
||||
|
|
@ -740,7 +516,6 @@ OS::OS() {
|
|||
_verbose_stdout = false;
|
||||
_no_window = false;
|
||||
_exit_code = 0;
|
||||
_orientation = SCREEN_LANDSCAPE;
|
||||
|
||||
_render_thread_mode = RENDER_THREAD_SAFE;
|
||||
|
||||
|
|
|
|||
247
core/os/os.h
247
core/os/os.h
|
|
@ -82,31 +82,6 @@ public:
|
|||
RENDER_THREAD_SAFE,
|
||||
RENDER_SEPARATE_THREAD
|
||||
};
|
||||
struct VideoMode {
|
||||
|
||||
int width, height;
|
||||
bool fullscreen;
|
||||
bool resizable;
|
||||
bool borderless_window;
|
||||
bool maximized;
|
||||
bool always_on_top;
|
||||
bool use_vsync;
|
||||
bool vsync_via_compositor;
|
||||
bool layered;
|
||||
float get_aspect() const { return (float)width / (float)height; }
|
||||
VideoMode(int p_width = 1024, int p_height = 600, bool p_fullscreen = false, bool p_resizable = true, bool p_borderless_window = false, bool p_maximized = false, bool p_always_on_top = false, bool p_use_vsync = false, bool p_vsync_via_compositor = false) {
|
||||
width = p_width;
|
||||
height = p_height;
|
||||
fullscreen = p_fullscreen;
|
||||
resizable = p_resizable;
|
||||
borderless_window = p_borderless_window;
|
||||
maximized = p_maximized;
|
||||
always_on_top = p_always_on_top;
|
||||
use_vsync = p_use_vsync;
|
||||
vsync_via_compositor = p_vsync_via_compositor;
|
||||
layered = false;
|
||||
}
|
||||
};
|
||||
|
||||
protected:
|
||||
friend class Main;
|
||||
|
|
@ -117,8 +92,8 @@ protected:
|
|||
// functions used by main to initialize/deinitialize the OS
|
||||
void add_logger(Logger *p_logger);
|
||||
|
||||
virtual void initialize_core() = 0;
|
||||
virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) = 0;
|
||||
virtual void initialize() = 0;
|
||||
virtual void initialize_joypads() = 0;
|
||||
|
||||
virtual void set_main_loop(MainLoop *p_main_loop) = 0;
|
||||
virtual void delete_main_loop() = 0;
|
||||
|
|
@ -128,7 +103,6 @@ protected:
|
|||
|
||||
virtual void set_cmdline(const char *p_execpath, const List<String> &p_args);
|
||||
|
||||
void _ensure_user_data_dir();
|
||||
virtual bool _check_internal_feature_support(const String &p_feature) = 0;
|
||||
|
||||
public:
|
||||
|
|
@ -136,121 +110,20 @@ public:
|
|||
|
||||
static OS *get_singleton();
|
||||
|
||||
virtual void global_menu_add_item(const String &p_menu, const String &p_label, const Variant &p_signal, const Variant &p_meta){};
|
||||
virtual void global_menu_add_separator(const String &p_menu){};
|
||||
virtual void global_menu_remove_item(const String &p_menu, int p_idx){};
|
||||
virtual void global_menu_clear(const String &p_menu){};
|
||||
|
||||
void print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, Logger::ErrorType p_type = Logger::ERR_ERROR);
|
||||
void print(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_2_3;
|
||||
void printerr(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_2_3;
|
||||
|
||||
virtual void alert(const String &p_alert, const String &p_title = "ALERT!") = 0;
|
||||
virtual String get_stdin_string(bool p_block = true) = 0;
|
||||
|
||||
enum MouseMode {
|
||||
MOUSE_MODE_VISIBLE,
|
||||
MOUSE_MODE_HIDDEN,
|
||||
MOUSE_MODE_CAPTURED,
|
||||
MOUSE_MODE_CONFINED
|
||||
};
|
||||
|
||||
virtual void set_mouse_mode(MouseMode p_mode);
|
||||
virtual MouseMode get_mouse_mode() const;
|
||||
|
||||
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;
|
||||
|
||||
virtual void set_clipboard(const String &p_text);
|
||||
virtual String get_clipboard() const;
|
||||
|
||||
virtual void set_video_mode(const VideoMode &p_video_mode, int p_screen = 0) = 0;
|
||||
virtual VideoMode get_video_mode(int p_screen = 0) const = 0;
|
||||
virtual void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen = 0) const = 0;
|
||||
|
||||
enum VideoDriver {
|
||||
VIDEO_DRIVER_VULKAN,
|
||||
VIDEO_DRIVER_GLES2,
|
||||
VIDEO_DRIVER_MAX,
|
||||
};
|
||||
|
||||
virtual int get_video_driver_count() const;
|
||||
virtual const char *get_video_driver_name(int p_driver) const;
|
||||
virtual int get_current_video_driver() const = 0;
|
||||
|
||||
virtual int get_audio_driver_count() const;
|
||||
virtual const char *get_audio_driver_name(int p_driver) const;
|
||||
|
||||
virtual PackedStringArray get_connected_midi_inputs();
|
||||
virtual void open_midi_inputs();
|
||||
virtual void close_midi_inputs();
|
||||
|
||||
virtual int get_screen_count() const { return 1; }
|
||||
virtual int get_current_screen() const { return 0; }
|
||||
virtual void set_current_screen(int p_screen) {}
|
||||
virtual Point2 get_screen_position(int p_screen = -1) const { return Point2(); }
|
||||
virtual Size2 get_screen_size(int p_screen = -1) const { return get_window_size(); }
|
||||
virtual int get_screen_dpi(int p_screen = -1) const { return 72; }
|
||||
virtual Point2 get_window_position() const { return Vector2(); }
|
||||
virtual void set_window_position(const Point2 &p_position) {}
|
||||
virtual Size2 get_max_window_size() const { return Size2(); };
|
||||
virtual Size2 get_min_window_size() const { return Size2(); };
|
||||
virtual Size2 get_window_size() const = 0;
|
||||
virtual Size2 get_real_window_size() const { return get_window_size(); }
|
||||
virtual void set_min_window_size(const Size2 p_size) {}
|
||||
virtual void set_max_window_size(const Size2 p_size) {}
|
||||
virtual void set_window_size(const Size2 p_size) {}
|
||||
virtual void set_window_fullscreen(bool p_enabled) {}
|
||||
virtual bool is_window_fullscreen() const { return true; }
|
||||
virtual void set_window_resizable(bool p_enabled) {}
|
||||
virtual bool is_window_resizable() const { return false; }
|
||||
virtual void set_window_minimized(bool p_enabled) {}
|
||||
virtual bool is_window_minimized() const { return false; }
|
||||
virtual void set_window_maximized(bool p_enabled) {}
|
||||
virtual bool is_window_maximized() const { return true; }
|
||||
virtual void set_window_always_on_top(bool p_enabled) {}
|
||||
virtual bool is_window_always_on_top() const { return false; }
|
||||
virtual bool is_window_focused() const { return true; }
|
||||
virtual void set_console_visible(bool p_enabled) {}
|
||||
virtual bool is_console_visible() const { return false; }
|
||||
virtual void request_attention() {}
|
||||
virtual void center_window();
|
||||
|
||||
// Returns window area free of hardware controls and other obstacles.
|
||||
// The application should use this to determine where to place UI elements.
|
||||
//
|
||||
// Keep in mind the area returned is in window coordinates rather than
|
||||
// viewport coordinates - you should perform the conversion on your own.
|
||||
//
|
||||
// The maximum size of the area is Rect2(0, 0, window_size.width, window_size.height).
|
||||
virtual Rect2 get_window_safe_area() const {
|
||||
Size2 window_size = get_window_size();
|
||||
return Rect2(0, 0, window_size.width, window_size.height);
|
||||
}
|
||||
|
||||
virtual void set_borderless_window(bool p_borderless) {}
|
||||
virtual bool get_borderless_window() { return 0; }
|
||||
|
||||
virtual bool get_window_per_pixel_transparency_enabled() const { return false; }
|
||||
virtual void set_window_per_pixel_transparency_enabled(bool p_enabled) {}
|
||||
|
||||
virtual uint8_t *get_layered_buffer_data() { return NULL; }
|
||||
virtual Size2 get_layered_buffer_size() { return Size2(0, 0); }
|
||||
virtual void swap_layered_buffer() {}
|
||||
|
||||
virtual void set_ime_active(const bool p_active) {}
|
||||
virtual void set_ime_position(const Point2 &p_pos) {}
|
||||
virtual Point2 get_ime_selection() const { return Point2(); }
|
||||
virtual String get_ime_text() const { return String(); }
|
||||
|
||||
virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false) { return ERR_UNAVAILABLE; }
|
||||
virtual Error close_dynamic_library(void *p_library_handle) { return ERR_UNAVAILABLE; }
|
||||
virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional = false) { return ERR_UNAVAILABLE; }
|
||||
|
||||
virtual void set_keep_screen_on(bool p_enabled);
|
||||
virtual bool is_keep_screen_on() const;
|
||||
virtual void set_low_processor_usage_mode(bool p_enabled);
|
||||
virtual bool is_in_low_processor_usage_mode() const;
|
||||
virtual void set_low_processor_usage_mode_sleep_usec(int p_usec);
|
||||
|
|
@ -273,6 +146,11 @@ public:
|
|||
virtual List<String> get_cmdline_args() const { return _cmdline; }
|
||||
virtual String get_model_name() const;
|
||||
|
||||
bool is_layered_allowed() const { return _allow_layered; }
|
||||
bool is_hidpi_allowed() const { return _allow_hidpi; }
|
||||
|
||||
void ensure_user_data_dir();
|
||||
|
||||
virtual MainLoop *get_main_loop() const = 0;
|
||||
|
||||
virtual void yield();
|
||||
|
|
@ -338,8 +216,6 @@ public:
|
|||
uint32_t get_ticks_msec() const;
|
||||
uint64_t get_splash_tick_msec() const;
|
||||
|
||||
virtual bool can_draw() const = 0;
|
||||
|
||||
virtual bool is_userfs_persistent() const { return true; }
|
||||
|
||||
bool is_stdout_verbose() const;
|
||||
|
|
@ -348,39 +224,6 @@ public:
|
|||
virtual bool is_disable_crash_handler() const { return false; }
|
||||
virtual void initialize_debugging() {}
|
||||
|
||||
enum CursorShape {
|
||||
CURSOR_ARROW,
|
||||
CURSOR_IBEAM,
|
||||
CURSOR_POINTING_HAND,
|
||||
CURSOR_CROSS,
|
||||
CURSOR_WAIT,
|
||||
CURSOR_BUSY,
|
||||
CURSOR_DRAG,
|
||||
CURSOR_CAN_DROP,
|
||||
CURSOR_FORBIDDEN,
|
||||
CURSOR_VSIZE,
|
||||
CURSOR_HSIZE,
|
||||
CURSOR_BDIAGSIZE,
|
||||
CURSOR_FDIAGSIZE,
|
||||
CURSOR_MOVE,
|
||||
CURSOR_VSPLIT,
|
||||
CURSOR_HSPLIT,
|
||||
CURSOR_HELP,
|
||||
CURSOR_MAX
|
||||
};
|
||||
|
||||
virtual bool has_virtual_keyboard() const;
|
||||
virtual void show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect = Rect2(), int p_max_input_length = -1);
|
||||
virtual void hide_virtual_keyboard();
|
||||
|
||||
// returns height of the currently shown virtual keyboard (0 if keyboard is hidden)
|
||||
virtual int get_virtual_keyboard_height() const;
|
||||
|
||||
virtual void set_cursor_shape(CursorShape p_shape);
|
||||
virtual CursorShape get_cursor_shape() const;
|
||||
virtual void set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot);
|
||||
|
||||
virtual bool get_swap_ok_cancel() { return false; }
|
||||
virtual void dump_memory_to_file(const char *p_file);
|
||||
virtual void dump_resources_to_file(const char *p_file);
|
||||
virtual void print_resources_in_use(bool p_short = false);
|
||||
|
|
@ -423,34 +266,8 @@ public:
|
|||
virtual void set_no_window_mode(bool p_enable);
|
||||
virtual bool is_no_window_mode_enabled() const;
|
||||
|
||||
virtual bool has_touchscreen_ui_hint() const;
|
||||
|
||||
enum ScreenOrientation {
|
||||
|
||||
SCREEN_LANDSCAPE,
|
||||
SCREEN_PORTRAIT,
|
||||
SCREEN_REVERSE_LANDSCAPE,
|
||||
SCREEN_REVERSE_PORTRAIT,
|
||||
SCREEN_SENSOR_LANDSCAPE,
|
||||
SCREEN_SENSOR_PORTRAIT,
|
||||
SCREEN_SENSOR,
|
||||
};
|
||||
|
||||
virtual void set_screen_orientation(ScreenOrientation p_orientation);
|
||||
ScreenOrientation get_screen_orientation() const;
|
||||
|
||||
virtual void enable_for_stealing_focus(ProcessID pid) {}
|
||||
virtual void move_window_to_foreground() {}
|
||||
|
||||
virtual void debug_break();
|
||||
|
||||
virtual void release_rendering_thread();
|
||||
virtual void make_rendering_thread();
|
||||
virtual void swap_buffers();
|
||||
|
||||
virtual void set_native_icon(const String &p_filename);
|
||||
virtual void set_icon(const Ref<Image> &p_icon);
|
||||
|
||||
virtual int get_exit_code() const;
|
||||
virtual void set_exit_code(int p_code);
|
||||
|
||||
|
|
@ -458,62 +275,12 @@ public:
|
|||
|
||||
virtual String get_unique_id() const;
|
||||
|
||||
virtual Error native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track);
|
||||
virtual bool native_video_is_playing() const;
|
||||
virtual void native_video_pause();
|
||||
virtual void native_video_unpause();
|
||||
virtual void native_video_stop();
|
||||
|
||||
virtual bool can_use_threads() const;
|
||||
|
||||
virtual Error dialog_show(String p_title, String p_description, Vector<String> p_buttons, Object *p_obj, String p_callback);
|
||||
virtual Error dialog_input_text(String p_title, String p_description, String p_partial, Object *p_obj, String p_callback);
|
||||
|
||||
enum LatinKeyboardVariant {
|
||||
LATIN_KEYBOARD_QWERTY,
|
||||
LATIN_KEYBOARD_QWERTZ,
|
||||
LATIN_KEYBOARD_AZERTY,
|
||||
LATIN_KEYBOARD_QZERTY,
|
||||
LATIN_KEYBOARD_DVORAK,
|
||||
LATIN_KEYBOARD_NEO,
|
||||
LATIN_KEYBOARD_COLEMAK,
|
||||
};
|
||||
|
||||
virtual LatinKeyboardVariant get_latin_keyboard_variant() const;
|
||||
|
||||
virtual bool is_joy_known(int p_device);
|
||||
virtual String get_joy_guid(int p_device) const;
|
||||
|
||||
enum EngineContext {
|
||||
CONTEXT_EDITOR,
|
||||
CONTEXT_PROJECTMAN,
|
||||
CONTEXT_ENGINE,
|
||||
};
|
||||
|
||||
virtual void set_context(int p_context);
|
||||
|
||||
//amazing hack because OpenGL needs this to be set on a separate thread..
|
||||
//also core can't access servers, so a callback must be used
|
||||
typedef void (*SwitchVSyncCallbackInThread)(bool);
|
||||
|
||||
static SwitchVSyncCallbackInThread switch_vsync_function;
|
||||
void set_use_vsync(bool p_enable);
|
||||
bool is_vsync_enabled() const;
|
||||
|
||||
//real, actual overridable function to switch vsync, which needs to be called from graphics thread if needed
|
||||
virtual void _set_use_vsync(bool p_enable) {}
|
||||
|
||||
void set_vsync_via_compositor(bool p_enable);
|
||||
bool is_vsync_via_compositor_enabled() const;
|
||||
|
||||
virtual void force_process_input(){};
|
||||
bool has_feature(const String &p_feature);
|
||||
|
||||
void set_has_server_feature_callback(HasServerFeatureCallback p_callback);
|
||||
|
||||
bool is_layered_allowed() const { return _allow_layered; }
|
||||
bool is_hidpi_allowed() const { return _allow_hidpi; }
|
||||
|
||||
void set_restart_on_exit(bool p_restart, const List<String> &p_restart_arguments);
|
||||
bool is_restart_on_exit_set() const;
|
||||
List<String> get_restart_on_exit_arguments() const;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@
|
|||
#include "core/crypto/hashing_context.h"
|
||||
#include "core/engine.h"
|
||||
#include "core/func_ref.h"
|
||||
#include "core/input_map.h"
|
||||
#include "core/input/input_filter.h"
|
||||
#include "core/input/input_map.h"
|
||||
#include "core/io/config_file.h"
|
||||
#include "core/io/dtls_server.h"
|
||||
#include "core/io/http_client.h"
|
||||
|
|
@ -62,7 +63,6 @@
|
|||
#include "core/math/geometry.h"
|
||||
#include "core/math/random_number_generator.h"
|
||||
#include "core/math/triangle_mesh.h"
|
||||
#include "core/os/input.h"
|
||||
#include "core/os/main_loop.h"
|
||||
#include "core/packed_data_container.h"
|
||||
#include "core/path_remap.h"
|
||||
|
|
@ -248,7 +248,7 @@ void register_core_singletons() {
|
|||
ClassDB::register_class<_ClassDB>();
|
||||
ClassDB::register_class<_Marshalls>();
|
||||
ClassDB::register_class<TranslationServer>();
|
||||
ClassDB::register_virtual_class<Input>();
|
||||
ClassDB::register_virtual_class<InputFilter>();
|
||||
ClassDB::register_class<InputMap>();
|
||||
ClassDB::register_class<_JSON>();
|
||||
ClassDB::register_class<Expression>();
|
||||
|
|
@ -263,7 +263,7 @@ void register_core_singletons() {
|
|||
Engine::get_singleton()->add_singleton(Engine::Singleton("ClassDB", _classdb));
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton("Marshalls", _Marshalls::get_singleton()));
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton("TranslationServer", TranslationServer::get_singleton()));
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton("Input", Input::get_singleton()));
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton("Input", InputFilter::get_singleton()));
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton("InputMap", InputMap::get_singleton()));
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton("JSON", _JSON::get_singleton()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,6 +144,9 @@ MAKE_TYPE_INFO(String, Variant::STRING)
|
|||
MAKE_TYPE_INFO(Vector2, Variant::VECTOR2)
|
||||
MAKE_TYPE_INFO(Rect2, Variant::RECT2)
|
||||
MAKE_TYPE_INFO(Vector3, Variant::VECTOR3)
|
||||
MAKE_TYPE_INFO(Vector2i, Variant::VECTOR2I)
|
||||
MAKE_TYPE_INFO(Rect2i, Variant::RECT2I)
|
||||
MAKE_TYPE_INFO(Vector3i, Variant::VECTOR3I)
|
||||
MAKE_TYPE_INFO(Transform2D, Variant::TRANSFORM2D)
|
||||
MAKE_TYPE_INFO(Plane, Variant::PLANE)
|
||||
MAKE_TYPE_INFO(Quat, Variant::QUAT)
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@
|
|||
|
||||
#include "variant_parser.h"
|
||||
|
||||
#include "core/input/input_event.h"
|
||||
#include "core/io/resource_loader.h"
|
||||
#include "core/os/input_event.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "core/string_buffer.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Import('env')
|
||||
|
||||
if (env["platform"] in ["haiku", "osx", "windows", "x11"]):
|
||||
if (env["platform"] in ["haiku", "osx", "windows", "linuxbsd"]):
|
||||
# Thirdparty source files
|
||||
thirdparty_dir = "#thirdparty/glad/"
|
||||
thirdparty_sources = [
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ void RasterizerCanvasGLES2::canvas_begin() {
|
|||
viewport_width = storage->frame.current_rt->width;
|
||||
viewport_height = storage->frame.current_rt->height;
|
||||
viewport_x = storage->frame.current_rt->x;
|
||||
viewport_y = OS::get_singleton()->get_window_size().height - viewport_height - storage->frame.current_rt->y;
|
||||
viewport_y = DisplayServer::get_singleton()->window_get_size().height - viewport_height - storage->frame.current_rt->y;
|
||||
glScissor(viewport_x, viewport_y, viewport_width, viewport_height);
|
||||
glViewport(viewport_x, viewport_y, viewport_width, viewport_height);
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
|
@ -168,7 +168,7 @@ void RasterizerCanvasGLES2::canvas_begin() {
|
|||
canvas_transform.translate(-(storage->frame.current_rt->width / 2.0f), -(storage->frame.current_rt->height / 2.0f), 0.0f);
|
||||
canvas_transform.scale(Vector3(2.0f / storage->frame.current_rt->width, csy * -2.0f / storage->frame.current_rt->height, 1.0f));
|
||||
} else {
|
||||
Vector2 ssize = OS::get_singleton()->get_window_size();
|
||||
Vector2 ssize = DisplayServer::get_singleton()->window_get_size();
|
||||
canvas_transform.translate(-(ssize.width / 2.0f), -(ssize.height / 2.0f), 0.0f);
|
||||
canvas_transform.scale(Vector3(2.0f / ssize.width, -2.0f / ssize.height, 1.0f));
|
||||
}
|
||||
|
|
@ -194,8 +194,8 @@ void RasterizerCanvasGLES2::canvas_end() {
|
|||
|
||||
if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_DIRECT_TO_SCREEN]) {
|
||||
//reset viewport to full window size
|
||||
int viewport_width = OS::get_singleton()->get_window_size().width;
|
||||
int viewport_height = OS::get_singleton()->get_window_size().height;
|
||||
int viewport_width = DisplayServer::get_singleton()->window_get_size().width;
|
||||
int viewport_height = DisplayServer::get_singleton()->window_get_size().height;
|
||||
glViewport(0, 0, viewport_width, viewport_height);
|
||||
glScissor(0, 0, viewport_width, viewport_height);
|
||||
}
|
||||
|
|
@ -1995,7 +1995,7 @@ void RasterizerCanvasGLES2::draw_lens_distortion_rect(const Rect2 &p_rect, float
|
|||
if (storage->frame.current_rt) {
|
||||
half_size = Vector2(storage->frame.current_rt->width, storage->frame.current_rt->height);
|
||||
} else {
|
||||
half_size = OS::get_singleton()->get_window_size();
|
||||
half_size = DisplayServer::get_singleton()->window_get_size();
|
||||
}
|
||||
half_size *= 0.5;
|
||||
Vector2 offset((p_rect.position.x - half_size.x) / half_size.x, (p_rect.position.y - half_size.y) / half_size.y);
|
||||
|
|
@ -2029,7 +2029,7 @@ void RasterizerCanvasGLES2::draw_lens_distortion_rect(const Rect2 &p_rect, float
|
|||
|
||||
void RasterizerCanvasGLES2::draw_window_margins(int *black_margin, RID *black_image) {
|
||||
|
||||
Vector2 window_size = OS::get_singleton()->get_window_size();
|
||||
Vector2 window_size = DisplayServer::get_singleton()->window_get_size();
|
||||
int window_h = window_size.height;
|
||||
int window_w = window_size.width;
|
||||
|
||||
|
|
|
|||
|
|
@ -318,7 +318,7 @@ void RasterizerGLES2::set_current_render_target(RID p_render_target) {
|
|||
} else {
|
||||
storage->frame.current_rt = NULL;
|
||||
storage->frame.clear_request = false;
|
||||
glViewport(0, 0, OS::get_singleton()->get_window_size().width, OS::get_singleton()->get_window_size().height);
|
||||
glViewport(0, 0, DisplayServer::get_singleton()->window_get_size().width, DisplayServer::get_singleton()->window_get_size().height);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, RasterizerStorageGLES2::system_fbo);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3261,7 +3261,7 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
|
|||
viewport_x = storage->frame.current_rt->x;
|
||||
|
||||
if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_DIRECT_TO_SCREEN]) {
|
||||
viewport_y = OS::get_singleton()->get_window_size().height - viewport_height - storage->frame.current_rt->y;
|
||||
viewport_y = DisplayServer::get_singleton()->window_get_size().height - viewport_height - storage->frame.current_rt->y;
|
||||
} else {
|
||||
viewport_y = storage->frame.current_rt->y;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ if env['builtin_vulkan']:
|
|||
'FALLBACK_DATA_DIRS=\\"%s\\"' % '/usr/local/share:/usr/share',
|
||||
'FALLBACK_CONFIG_DIRS=\\"%s\\"' % '/etc/xdg'
|
||||
])
|
||||
elif env['platform'] == "x11":
|
||||
elif env['platform'] == "linuxbsd":
|
||||
env_thirdparty.AppendUnique(CPPDEFINES=[
|
||||
'VK_USE_PLATFORM_XLIB_KHR',
|
||||
'VULKAN_NON_CMAKE_BUILD',
|
||||
|
|
|
|||
|
|
@ -5150,12 +5150,12 @@ bool RenderingDeviceVulkan::compute_pipeline_is_valid(RID p_pipeline) {
|
|||
/**** SCREEN ****/
|
||||
/****************/
|
||||
|
||||
int RenderingDeviceVulkan::screen_get_width(int p_screen) const {
|
||||
int RenderingDeviceVulkan::screen_get_width(DisplayServer::WindowID p_screen) const {
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
return context->window_get_width(p_screen);
|
||||
}
|
||||
int RenderingDeviceVulkan::screen_get_height(int p_screen) const {
|
||||
int RenderingDeviceVulkan::screen_get_height(DisplayServer::WindowID p_screen) const {
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
return context->window_get_height(p_screen);
|
||||
|
|
@ -5189,7 +5189,7 @@ RenderingDevice::FramebufferFormatID RenderingDeviceVulkan::screen_get_framebuff
|
|||
/**** DRAW LIST ****/
|
||||
/*******************/
|
||||
|
||||
RenderingDevice::DrawListID RenderingDeviceVulkan::draw_list_begin_for_screen(int p_screen, const Color &p_clear_color) {
|
||||
RenderingDevice::DrawListID RenderingDeviceVulkan::draw_list_begin_for_screen(DisplayServer::WindowID p_screen, const Color &p_clear_color) {
|
||||
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
|
|
|
|||
|
|
@ -1052,15 +1052,15 @@ public:
|
|||
/**** SCREEN ****/
|
||||
/****************/
|
||||
|
||||
virtual int screen_get_width(int p_screen = 0) const;
|
||||
virtual int screen_get_height(int p_screen = 0) const;
|
||||
virtual int screen_get_width(DisplayServer::WindowID p_screen = 0) const;
|
||||
virtual int screen_get_height(DisplayServer::WindowID p_screen = 0) const;
|
||||
virtual FramebufferFormatID screen_get_framebuffer_format() const;
|
||||
|
||||
/********************/
|
||||
/**** DRAW LISTS ****/
|
||||
/********************/
|
||||
|
||||
virtual DrawListID draw_list_begin_for_screen(int p_screen = 0, const Color &p_clear_color = Color());
|
||||
virtual DrawListID draw_list_begin_for_screen(DisplayServer::WindowID p_screen = 0, const Color &p_clear_color = Color());
|
||||
|
||||
virtual DrawListID draw_list_begin(RID p_framebuffer, InitialAction p_initial_color_action, FinalAction p_final_color_action, InitialAction p_initial_depth_action, FinalAction p_final_depth_action, const Vector<Color> &p_clear_color_values = Vector<Color>(), float p_clear_depth = 1.0, uint32_t p_clear_stencil = 0, const Rect2 &p_region = Rect2());
|
||||
virtual Error draw_list_begin_split(RID p_framebuffer, uint32_t p_splits, DrawListID *r_split_ids, InitialAction p_initial_color_action, FinalAction p_final_color_action, InitialAction p_initial_depth_action, FinalAction p_final_depth_action, const Vector<Color> &p_clear_color_values = Vector<Color>(), float p_clear_depth = 1.0, uint32_t p_clear_stencil = 0, const Rect2 &p_region = Rect2());
|
||||
|
|
|
|||
|
|
@ -696,7 +696,9 @@ Error VulkanContext::_create_semaphores() {
|
|||
return OK;
|
||||
}
|
||||
|
||||
int VulkanContext::_window_create(VkSurfaceKHR p_surface, int p_width, int p_height) {
|
||||
Error VulkanContext::_window_create(DisplayServer::WindowID p_window_id, VkSurfaceKHR p_surface, int p_width, int p_height) {
|
||||
|
||||
ERR_FAIL_COND_V(windows.has(p_window_id), ERR_INVALID_PARAMETER);
|
||||
|
||||
if (!queues_initialized) {
|
||||
// We use a single GPU, but we need a surface to initialize the
|
||||
|
|
@ -710,39 +712,37 @@ int VulkanContext::_window_create(VkSurfaceKHR p_surface, int p_width, int p_hei
|
|||
window.width = p_width;
|
||||
window.height = p_height;
|
||||
Error err = _update_swap_chain(&window);
|
||||
ERR_FAIL_COND_V(err != OK, -1);
|
||||
ERR_FAIL_COND_V(err != OK, ERR_CANT_CREATE);
|
||||
|
||||
int id = last_window_id;
|
||||
windows[id] = window;
|
||||
last_window_id++;
|
||||
return id;
|
||||
windows[p_window_id] = window;
|
||||
return OK;
|
||||
}
|
||||
|
||||
void VulkanContext::window_resize(int p_window, int p_width, int p_height) {
|
||||
void VulkanContext::window_resize(DisplayServer::WindowID p_window, int p_width, int p_height) {
|
||||
ERR_FAIL_COND(!windows.has(p_window));
|
||||
windows[p_window].width = p_width;
|
||||
windows[p_window].height = p_height;
|
||||
_update_swap_chain(&windows[p_window]);
|
||||
}
|
||||
|
||||
int VulkanContext::window_get_width(int p_window) {
|
||||
int VulkanContext::window_get_width(DisplayServer::WindowID p_window) {
|
||||
ERR_FAIL_COND_V(!windows.has(p_window), -1);
|
||||
return windows[p_window].width;
|
||||
}
|
||||
|
||||
int VulkanContext::window_get_height(int p_window) {
|
||||
int VulkanContext::window_get_height(DisplayServer::WindowID p_window) {
|
||||
ERR_FAIL_COND_V(!windows.has(p_window), -1);
|
||||
return windows[p_window].height;
|
||||
}
|
||||
|
||||
VkRenderPass VulkanContext::window_get_render_pass(int p_window) {
|
||||
VkRenderPass VulkanContext::window_get_render_pass(DisplayServer::WindowID p_window) {
|
||||
ERR_FAIL_COND_V(!windows.has(p_window), VK_NULL_HANDLE);
|
||||
Window *w = &windows[p_window];
|
||||
//vulkan use of currentbuffer
|
||||
return w->render_pass;
|
||||
}
|
||||
|
||||
VkFramebuffer VulkanContext::window_get_framebuffer(int p_window) {
|
||||
VkFramebuffer VulkanContext::window_get_framebuffer(DisplayServer::WindowID p_window) {
|
||||
ERR_FAIL_COND_V(!windows.has(p_window), VK_NULL_HANDLE);
|
||||
ERR_FAIL_COND_V(!buffers_prepared, VK_NULL_HANDLE);
|
||||
Window *w = &windows[p_window];
|
||||
|
|
@ -750,7 +750,7 @@ VkFramebuffer VulkanContext::window_get_framebuffer(int p_window) {
|
|||
return w->swapchain_image_resources[w->current_buffer].framebuffer;
|
||||
}
|
||||
|
||||
void VulkanContext::window_destroy(int p_window_id) {
|
||||
void VulkanContext::window_destroy(DisplayServer::WindowID p_window_id) {
|
||||
ERR_FAIL_COND(!windows.has(p_window_id));
|
||||
_clean_up_swap_chain(&windows[p_window_id]);
|
||||
vkDestroySurfaceKHR(inst, windows[p_window_id].surface, NULL);
|
||||
|
|
@ -1497,7 +1497,6 @@ VulkanContext::VulkanContext() {
|
|||
|
||||
buffers_prepared = false;
|
||||
swapchainImageCount = 0;
|
||||
last_window_id = 0;
|
||||
}
|
||||
|
||||
VulkanContext::~VulkanContext() {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include "core/error_list.h"
|
||||
#include "core/map.h"
|
||||
#include "core/ustring.h"
|
||||
#include "servers/display_server.h"
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
class VulkanContext {
|
||||
|
|
@ -106,8 +107,7 @@ class VulkanContext {
|
|||
}
|
||||
};
|
||||
|
||||
Map<int, Window> windows;
|
||||
int last_window_id;
|
||||
Map<DisplayServer::WindowID, Window> windows;
|
||||
uint32_t swapchainImageCount;
|
||||
|
||||
//commands
|
||||
|
|
@ -173,7 +173,7 @@ protected:
|
|||
virtual const char *_get_platform_surface_extension() const = 0;
|
||||
// virtual VkResult _create_surface(VkSurfaceKHR *surface, VkInstance p_instance) = 0;
|
||||
|
||||
virtual int _window_create(VkSurfaceKHR p_surface, int p_width, int p_height);
|
||||
virtual Error _window_create(DisplayServer::WindowID p_window_id, VkSurfaceKHR p_surface, int p_width, int p_height);
|
||||
|
||||
VkInstance _get_instance() {
|
||||
return inst;
|
||||
|
|
@ -187,12 +187,12 @@ public:
|
|||
int get_swapchain_image_count() const;
|
||||
uint32_t get_graphics_queue() const;
|
||||
|
||||
void window_resize(int p_window_id, int p_width, int p_height);
|
||||
int window_get_width(int p_window = 0);
|
||||
int window_get_height(int p_window = 0);
|
||||
void window_destroy(int p_window_id);
|
||||
VkFramebuffer window_get_framebuffer(int p_window = 0);
|
||||
VkRenderPass window_get_render_pass(int p_window = 0);
|
||||
void window_resize(DisplayServer::WindowID p_window_id, int p_width, int p_height);
|
||||
int window_get_width(DisplayServer::WindowID p_window = 0);
|
||||
int window_get_height(DisplayServer::WindowID p_window = 0);
|
||||
void window_destroy(DisplayServer::WindowID p_window_id);
|
||||
VkFramebuffer window_get_framebuffer(DisplayServer::WindowID p_window = 0);
|
||||
VkRenderPass window_get_render_pass(DisplayServer::WindowID p_window = 0);
|
||||
|
||||
VkFormat get_screen_format() const;
|
||||
VkPhysicalDeviceLimits get_device_limits() const;
|
||||
|
|
|
|||
|
|
@ -215,20 +215,20 @@ void AnimationBezierTrackEdit::_draw_line_clipped(const Vector2 &p_from, const V
|
|||
void AnimationBezierTrackEdit::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) {
|
||||
bezier_icon = get_icon("KeyBezierPoint", "EditorIcons");
|
||||
bezier_handle_icon = get_icon("KeyBezierHandle", "EditorIcons");
|
||||
selected_icon = get_icon("KeyBezierSelected", "EditorIcons");
|
||||
bezier_icon = get_theme_icon("KeyBezierPoint", "EditorIcons");
|
||||
bezier_handle_icon = get_theme_icon("KeyBezierHandle", "EditorIcons");
|
||||
selected_icon = get_theme_icon("KeyBezierSelected", "EditorIcons");
|
||||
if (handle_mode_option->get_item_count() == 0) {
|
||||
handle_mode_option->add_icon_item(get_icon("BezierHandlesFree", "EditorIcons"), TTR("Free"), HANDLE_MODE_FREE);
|
||||
handle_mode_option->add_icon_item(get_icon("BezierHandlesBalanced", "EditorIcons"), TTR("Balanced"), HANDLE_MODE_BALANCED);
|
||||
handle_mode_option->add_icon_item(get_icon("BezierHandlesMirror", "EditorIcons"), TTR("Mirror"), HANDLE_MODE_MIRROR);
|
||||
handle_mode_option->add_icon_item(get_theme_icon("BezierHandlesFree", "EditorIcons"), TTR("Free"), HANDLE_MODE_FREE);
|
||||
handle_mode_option->add_icon_item(get_theme_icon("BezierHandlesBalanced", "EditorIcons"), TTR("Balanced"), HANDLE_MODE_BALANCED);
|
||||
handle_mode_option->add_icon_item(get_theme_icon("BezierHandlesMirror", "EditorIcons"), TTR("Mirror"), HANDLE_MODE_MIRROR);
|
||||
}
|
||||
}
|
||||
if (p_what == NOTIFICATION_RESIZED) {
|
||||
|
||||
int right_limit = get_size().width - timeline->get_buttons_width();
|
||||
int hsep = get_constant("hseparation", "ItemList");
|
||||
int vsep = get_constant("vseparation", "ItemList");
|
||||
int hsep = get_theme_constant("hseparation", "ItemList");
|
||||
int vsep = get_theme_constant("vseparation", "ItemList");
|
||||
|
||||
handle_mode_option->set_position(Vector2(right_limit + hsep, get_size().height - handle_mode_option->get_combined_minimum_size().height - vsep));
|
||||
handle_mode_option->set_size(Vector2(timeline->get_buttons_width() - hsep * 2, handle_mode_option->get_combined_minimum_size().height));
|
||||
|
|
@ -240,15 +240,15 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
|
|||
int limit = timeline->get_name_limit();
|
||||
|
||||
if (has_focus()) {
|
||||
Color accent = get_color("accent_color", "Editor");
|
||||
Color accent = get_theme_color("accent_color", "Editor");
|
||||
accent.a *= 0.7;
|
||||
draw_rect(Rect2(Point2(), get_size()), accent, false);
|
||||
}
|
||||
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Color color = get_color("font_color", "Label");
|
||||
int hsep = get_constant("hseparation", "ItemList");
|
||||
int vsep = get_constant("vseparation", "ItemList");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
Color color = get_theme_color("font_color", "Label");
|
||||
int hsep = get_theme_constant("hseparation", "ItemList");
|
||||
int vsep = get_theme_constant("vseparation", "ItemList");
|
||||
Color linecolor = color;
|
||||
linecolor.a = 0.2;
|
||||
|
||||
|
|
@ -258,7 +258,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
|
|||
|
||||
draw_line(Point2(right_limit, 0), Point2(right_limit, get_size().height), linecolor);
|
||||
|
||||
Ref<Texture2D> close_icon = get_icon("Close", "EditorIcons");
|
||||
Ref<Texture2D> close_icon = get_theme_icon("Close", "EditorIcons");
|
||||
|
||||
close_icon_rect.position = Vector2(get_size().width - close_icon->get_width() - hsep, hsep);
|
||||
close_icon_rect.size = close_icon->get_size();
|
||||
|
|
@ -340,7 +340,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
|
|||
|
||||
subtracks[i] = rect;
|
||||
} else {
|
||||
Color ac = get_color("accent_color", "Editor");
|
||||
Color ac = get_theme_color("accent_color", "Editor");
|
||||
ac.a = 0.5;
|
||||
draw_rect(rect, ac);
|
||||
}
|
||||
|
|
@ -349,7 +349,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
|
|||
vofs += font->get_height() + vsep;
|
||||
}
|
||||
|
||||
Color accent = get_color("accent_color", "Editor");
|
||||
Color accent = get_theme_color("accent_color", "Editor");
|
||||
|
||||
{ //guides
|
||||
float min_left_scale = font->get_height() + vsep;
|
||||
|
|
@ -391,7 +391,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
|
|||
{ //draw OTHER curves
|
||||
|
||||
float scale = timeline->get_zoom_scale();
|
||||
Ref<Texture2D> point = get_icon("KeyValue", "EditorIcons");
|
||||
Ref<Texture2D> point = get_theme_icon("KeyValue", "EditorIcons");
|
||||
for (Map<int, Color>::Element *E = subtrack_colors.front(); E; E = E->next()) {
|
||||
|
||||
_draw_track(E->key(), E->get());
|
||||
|
|
@ -410,7 +410,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
|
|||
}
|
||||
|
||||
//draw edited curve
|
||||
const Color highlight = get_color("highlight_color", "Editor");
|
||||
const Color highlight = get_theme_color("highlight_color", "Editor");
|
||||
_draw_track(track, highlight);
|
||||
}
|
||||
|
||||
|
|
@ -540,7 +540,7 @@ void AnimationBezierTrackEdit::_play_position_draw() {
|
|||
int px = (-timeline->get_value() + play_position_pos) * scale + timeline->get_name_limit();
|
||||
|
||||
if (px >= timeline->get_name_limit() && px < (get_size().width - timeline->get_buttons_width())) {
|
||||
Color color = get_color("accent_color", "Editor");
|
||||
Color color = get_theme_color("accent_color", "Editor");
|
||||
play_position->draw_line(Point2(px, 0), Point2(px, h), color);
|
||||
}
|
||||
}
|
||||
|
|
@ -657,9 +657,9 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
|||
menu->add_icon_item(bezier_icon, TTR("Insert Key Here"), MENU_KEY_INSERT);
|
||||
if (selection.size()) {
|
||||
menu->add_separator();
|
||||
menu->add_icon_item(get_icon("Duplicate", "EditorIcons"), TTR("Duplicate Selected Key(s)"), MENU_KEY_DUPLICATE);
|
||||
menu->add_icon_item(get_theme_icon("Duplicate", "EditorIcons"), TTR("Duplicate Selected Key(s)"), MENU_KEY_DUPLICATE);
|
||||
menu->add_separator();
|
||||
menu->add_icon_item(get_icon("Remove", "EditorIcons"), TTR("Delete Selected Key(s)"), MENU_KEY_DELETE);
|
||||
menu->add_icon_item(get_theme_icon("Remove", "EditorIcons"), TTR("Delete Selected Key(s)"), MENU_KEY_DELETE);
|
||||
}
|
||||
|
||||
menu->set_as_minsize();
|
||||
|
|
|
|||
|
|
@ -31,13 +31,13 @@
|
|||
#include "animation_track_editor.h"
|
||||
|
||||
#include "animation_track_editor_plugins.h"
|
||||
#include "core/os/input.h"
|
||||
#include "core/input/input_filter.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "editor/animation_bezier_editor.h"
|
||||
#include "editor/plugins/animation_player_editor_plugin.h"
|
||||
#include "editor_node.h"
|
||||
#include "editor_scale.h"
|
||||
#include "scene/main/viewport.h"
|
||||
#include "scene/main/window.h"
|
||||
#include "servers/audio/audio_stream.h"
|
||||
|
||||
class AnimationTrackKeyEdit : public Object {
|
||||
|
|
@ -1442,11 +1442,11 @@ void AnimationTimelineEdit::_anim_loop_pressed() {
|
|||
|
||||
int AnimationTimelineEdit::get_buttons_width() const {
|
||||
|
||||
Ref<Texture2D> interp_mode = get_icon("TrackContinuous", "EditorIcons");
|
||||
Ref<Texture2D> interp_type = get_icon("InterpRaw", "EditorIcons");
|
||||
Ref<Texture2D> loop_type = get_icon("InterpWrapClamp", "EditorIcons");
|
||||
Ref<Texture2D> remove_icon = get_icon("Remove", "EditorIcons");
|
||||
Ref<Texture2D> down_icon = get_icon("select_arrow", "Tree");
|
||||
Ref<Texture2D> interp_mode = get_theme_icon("TrackContinuous", "EditorIcons");
|
||||
Ref<Texture2D> interp_type = get_theme_icon("InterpRaw", "EditorIcons");
|
||||
Ref<Texture2D> loop_type = get_theme_icon("InterpWrapClamp", "EditorIcons");
|
||||
Ref<Texture2D> remove_icon = get_theme_icon("Remove", "EditorIcons");
|
||||
Ref<Texture2D> down_icon = get_theme_icon("select_arrow", "Tree");
|
||||
|
||||
int total_w = interp_mode->get_width() + interp_type->get_width() + loop_type->get_width() + remove_icon->get_width();
|
||||
total_w += (down_icon->get_width() + 4 * EDSCALE) * 4;
|
||||
|
|
@ -1456,7 +1456,7 @@ int AnimationTimelineEdit::get_buttons_width() const {
|
|||
|
||||
int AnimationTimelineEdit::get_name_limit() const {
|
||||
|
||||
Ref<Texture2D> hsize_icon = get_icon("Hsize", "EditorIcons");
|
||||
Ref<Texture2D> hsize_icon = get_theme_icon("Hsize", "EditorIcons");
|
||||
|
||||
int limit = MAX(name_limit, add_track->get_minimum_size().width + hsize_icon->get_width());
|
||||
|
||||
|
|
@ -1468,17 +1468,17 @@ int AnimationTimelineEdit::get_name_limit() const {
|
|||
void AnimationTimelineEdit::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||
add_track->set_icon(get_icon("Add", "EditorIcons"));
|
||||
loop->set_icon(get_icon("Loop", "EditorIcons"));
|
||||
time_icon->set_texture(get_icon("Time", "EditorIcons"));
|
||||
add_track->set_icon(get_theme_icon("Add", "EditorIcons"));
|
||||
loop->set_icon(get_theme_icon("Loop", "EditorIcons"));
|
||||
time_icon->set_texture(get_theme_icon("Time", "EditorIcons"));
|
||||
|
||||
add_track->get_popup()->clear();
|
||||
add_track->get_popup()->add_icon_item(get_icon("KeyValue", "EditorIcons"), TTR("Property Track"));
|
||||
add_track->get_popup()->add_icon_item(get_icon("KeyXform", "EditorIcons"), TTR("3D Transform Track"));
|
||||
add_track->get_popup()->add_icon_item(get_icon("KeyCall", "EditorIcons"), TTR("Call Method Track"));
|
||||
add_track->get_popup()->add_icon_item(get_icon("KeyBezier", "EditorIcons"), TTR("Bezier Curve Track"));
|
||||
add_track->get_popup()->add_icon_item(get_icon("KeyAudio", "EditorIcons"), TTR("Audio Playback Track"));
|
||||
add_track->get_popup()->add_icon_item(get_icon("KeyAnimation", "EditorIcons"), TTR("Animation Playback Track"));
|
||||
add_track->get_popup()->add_icon_item(get_theme_icon("KeyValue", "EditorIcons"), TTR("Property Track"));
|
||||
add_track->get_popup()->add_icon_item(get_theme_icon("KeyXform", "EditorIcons"), TTR("3D Transform Track"));
|
||||
add_track->get_popup()->add_icon_item(get_theme_icon("KeyCall", "EditorIcons"), TTR("Call Method Track"));
|
||||
add_track->get_popup()->add_icon_item(get_theme_icon("KeyBezier", "EditorIcons"), TTR("Bezier Curve Track"));
|
||||
add_track->get_popup()->add_icon_item(get_theme_icon("KeyAudio", "EditorIcons"), TTR("Audio Playback Track"));
|
||||
add_track->get_popup()->add_icon_item(get_theme_icon("KeyAnimation", "EditorIcons"), TTR("Animation Playback Track"));
|
||||
}
|
||||
|
||||
if (p_what == NOTIFICATION_RESIZED) {
|
||||
|
|
@ -1493,8 +1493,8 @@ void AnimationTimelineEdit::_notification(int p_what) {
|
|||
if (!animation.is_valid())
|
||||
return;
|
||||
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Color color = get_color("font_color", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
Color color = get_theme_color("font_color", "Label");
|
||||
|
||||
int zoomw = key_range;
|
||||
float scale = get_zoom_scale();
|
||||
|
|
@ -1504,7 +1504,7 @@ void AnimationTimelineEdit::_notification(int p_what) {
|
|||
if (l <= 0)
|
||||
l = 0.001; //avoid crashor
|
||||
|
||||
Ref<Texture2D> hsize_icon = get_icon("Hsize", "EditorIcons");
|
||||
Ref<Texture2D> hsize_icon = get_theme_icon("Hsize", "EditorIcons");
|
||||
hsize_rect = Rect2(get_name_limit() - hsize_icon->get_width() - 2 * EDSCALE, (get_size().height - hsize_icon->get_height()) / 2, hsize_icon->get_width(), hsize_icon->get_height());
|
||||
draw_texture(hsize_icon, hsize_rect.position);
|
||||
|
||||
|
|
@ -1554,7 +1554,7 @@ void AnimationTimelineEdit::_notification(int p_what) {
|
|||
|
||||
int end_px = (l - get_value()) * scale;
|
||||
int begin_px = -get_value() * scale;
|
||||
Color notimecol = get_color("dark_color_2", "Editor");
|
||||
Color notimecol = get_theme_color("dark_color_2", "Editor");
|
||||
Color timecolor = color;
|
||||
timecolor.a = 0.2;
|
||||
Color linecolor = color;
|
||||
|
|
@ -1685,9 +1685,9 @@ void AnimationTimelineEdit::set_animation(const Ref<Animation> &p_animation) {
|
|||
Size2 AnimationTimelineEdit::get_minimum_size() const {
|
||||
|
||||
Size2 ms = add_track->get_minimum_size();
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
ms.height = MAX(ms.height, font->get_height());
|
||||
ms.width = get_buttons_width() + add_track->get_minimum_size().width + get_icon("Hsize", "EditorIcons")->get_width() + 2;
|
||||
ms.width = get_buttons_width() + add_track->get_minimum_size().width + get_theme_icon("Hsize", "EditorIcons")->get_width() + 2;
|
||||
return ms;
|
||||
}
|
||||
|
||||
|
|
@ -1746,11 +1746,11 @@ void AnimationTimelineEdit::_play_position_draw() {
|
|||
int px = (-get_value() + play_position_pos) * scale + get_name_limit();
|
||||
|
||||
if (px >= get_name_limit() && px < (play_position->get_size().width - get_buttons_width())) {
|
||||
Color color = get_color("accent_color", "Editor");
|
||||
Color color = get_theme_color("accent_color", "Editor");
|
||||
play_position->draw_line(Point2(px, 0), Point2(px, h), color, Math::round(2 * EDSCALE));
|
||||
play_position->draw_texture(
|
||||
get_icon("TimelineIndicator", "EditorIcons"),
|
||||
Point2(px - get_icon("TimelineIndicator", "EditorIcons")->get_width() * 0.5, 0),
|
||||
get_theme_icon("TimelineIndicator", "EditorIcons"),
|
||||
Point2(px - get_theme_icon("TimelineIndicator", "EditorIcons")->get_width() * 0.5, 0),
|
||||
color);
|
||||
}
|
||||
}
|
||||
|
|
@ -1921,23 +1921,23 @@ void AnimationTrackEdit::_notification(int p_what) {
|
|||
int limit = timeline->get_name_limit();
|
||||
|
||||
if (has_focus()) {
|
||||
Color accent = get_color("accent_color", "Editor");
|
||||
Color accent = get_theme_color("accent_color", "Editor");
|
||||
accent.a *= 0.7;
|
||||
// Offside so the horizontal sides aren't cutoff.
|
||||
draw_rect(Rect2(Point2(1 * EDSCALE, 0), get_size() - Size2(1 * EDSCALE, 0)), accent, false);
|
||||
}
|
||||
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Color color = get_color("font_color", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
Color color = get_theme_color("font_color", "Label");
|
||||
Ref<Texture2D> type_icons[6] = {
|
||||
get_icon("KeyValue", "EditorIcons"),
|
||||
get_icon("KeyXform", "EditorIcons"),
|
||||
get_icon("KeyCall", "EditorIcons"),
|
||||
get_icon("KeyBezier", "EditorIcons"),
|
||||
get_icon("KeyAudio", "EditorIcons"),
|
||||
get_icon("KeyAnimation", "EditorIcons")
|
||||
get_theme_icon("KeyValue", "EditorIcons"),
|
||||
get_theme_icon("KeyXform", "EditorIcons"),
|
||||
get_theme_icon("KeyCall", "EditorIcons"),
|
||||
get_theme_icon("KeyBezier", "EditorIcons"),
|
||||
get_theme_icon("KeyAudio", "EditorIcons"),
|
||||
get_theme_icon("KeyAnimation", "EditorIcons")
|
||||
};
|
||||
int hsep = get_constant("hseparation", "ItemList");
|
||||
int hsep = get_theme_constant("hseparation", "ItemList");
|
||||
Color linecolor = color;
|
||||
linecolor.a = 0.2;
|
||||
|
||||
|
|
@ -1945,7 +1945,7 @@ void AnimationTrackEdit::_notification(int p_what) {
|
|||
|
||||
{
|
||||
|
||||
Ref<Texture2D> check = animation->track_is_enabled(track) ? get_icon("checked", "CheckBox") : get_icon("unchecked", "CheckBox");
|
||||
Ref<Texture2D> check = animation->track_is_enabled(track) ? get_theme_icon("checked", "CheckBox") : get_theme_icon("unchecked", "CheckBox");
|
||||
|
||||
int ofs = in_group ? check->get_width() : 0; //not the best reference for margin but..
|
||||
|
||||
|
|
@ -1966,7 +1966,7 @@ void AnimationTrackEdit::_notification(int p_what) {
|
|||
String text;
|
||||
Color text_color = color;
|
||||
if (node && EditorNode::get_singleton()->get_editor_selection()->is_selected(node)) {
|
||||
text_color = get_color("accent_color", "Editor");
|
||||
text_color = get_theme_color("accent_color", "Editor");
|
||||
}
|
||||
|
||||
if (in_group) {
|
||||
|
|
@ -2045,25 +2045,25 @@ void AnimationTrackEdit::_notification(int p_what) {
|
|||
{
|
||||
|
||||
Ref<Texture2D> wrap_icon[2] = {
|
||||
get_icon("InterpWrapClamp", "EditorIcons"),
|
||||
get_icon("InterpWrapLoop", "EditorIcons"),
|
||||
get_theme_icon("InterpWrapClamp", "EditorIcons"),
|
||||
get_theme_icon("InterpWrapLoop", "EditorIcons"),
|
||||
};
|
||||
|
||||
Ref<Texture2D> interp_icon[3] = {
|
||||
get_icon("InterpRaw", "EditorIcons"),
|
||||
get_icon("InterpLinear", "EditorIcons"),
|
||||
get_icon("InterpCubic", "EditorIcons")
|
||||
get_theme_icon("InterpRaw", "EditorIcons"),
|
||||
get_theme_icon("InterpLinear", "EditorIcons"),
|
||||
get_theme_icon("InterpCubic", "EditorIcons")
|
||||
};
|
||||
Ref<Texture2D> cont_icon[4] = {
|
||||
get_icon("TrackContinuous", "EditorIcons"),
|
||||
get_icon("TrackDiscrete", "EditorIcons"),
|
||||
get_icon("TrackTrigger", "EditorIcons"),
|
||||
get_icon("TrackCapture", "EditorIcons")
|
||||
get_theme_icon("TrackContinuous", "EditorIcons"),
|
||||
get_theme_icon("TrackDiscrete", "EditorIcons"),
|
||||
get_theme_icon("TrackTrigger", "EditorIcons"),
|
||||
get_theme_icon("TrackCapture", "EditorIcons")
|
||||
};
|
||||
|
||||
int ofs = get_size().width - timeline->get_buttons_width();
|
||||
|
||||
Ref<Texture2D> down_icon = get_icon("select_arrow", "Tree");
|
||||
Ref<Texture2D> down_icon = get_theme_icon("select_arrow", "Tree");
|
||||
|
||||
draw_line(Point2(ofs, 0), Point2(ofs, get_size().height), linecolor, Math::round(EDSCALE));
|
||||
|
||||
|
|
@ -2100,7 +2100,7 @@ void AnimationTrackEdit::_notification(int p_what) {
|
|||
update_mode_rect.size.x += down_icon->get_width();
|
||||
bezier_edit_rect = Rect2();
|
||||
} else if (animation->track_get_type(track) == Animation::TYPE_BEZIER) {
|
||||
Ref<Texture2D> bezier_icon = get_icon("EditBezier", "EditorIcons");
|
||||
Ref<Texture2D> bezier_icon = get_theme_icon("EditBezier", "EditorIcons");
|
||||
update_mode_rect.size.x += down_icon->get_width();
|
||||
bezier_edit_rect.position = update_mode_rect.position + (update_mode_rect.size - bezier_icon->get_size()) / 2;
|
||||
bezier_edit_rect.size = bezier_icon->get_size();
|
||||
|
|
@ -2185,7 +2185,7 @@ void AnimationTrackEdit::_notification(int p_what) {
|
|||
{
|
||||
//erase
|
||||
|
||||
Ref<Texture2D> icon = get_icon("Remove", "EditorIcons");
|
||||
Ref<Texture2D> icon = get_theme_icon("Remove", "EditorIcons");
|
||||
|
||||
remove_rect.position.x = ofs + ((get_size().width - ofs) - icon->get_width()) / 2;
|
||||
remove_rect.position.y = int(get_size().height - icon->get_height()) / 2;
|
||||
|
|
@ -2202,7 +2202,7 @@ void AnimationTrackEdit::_notification(int p_what) {
|
|||
}
|
||||
|
||||
if (dropping_at != 0) {
|
||||
Color drop_color = get_color("accent_color", "Editor");
|
||||
Color drop_color = get_theme_color("accent_color", "Editor");
|
||||
if (dropping_at < 0) {
|
||||
draw_line(Vector2(0, 0), Vector2(get_size().width, 0), drop_color, Math::round(EDSCALE));
|
||||
} else {
|
||||
|
|
@ -2249,7 +2249,7 @@ void AnimationTrackEdit::draw_key_link(int p_index, float p_pixels_sec, int p_x,
|
|||
if (current != next)
|
||||
return;
|
||||
|
||||
Color color = get_color("font_color", "Label");
|
||||
Color color = get_theme_color("font_color", "Label");
|
||||
color.a = 0.5;
|
||||
|
||||
int from_x = MAX(p_x, p_clip_left);
|
||||
|
|
@ -2273,15 +2273,15 @@ void AnimationTrackEdit::draw_key(int p_index, float p_pixels_sec, int p_x, bool
|
|||
const Variant &v = animation->track_get_key_value(track, p_index);
|
||||
Variant::Type valid_type = Variant::NIL;
|
||||
if (!_is_value_key_valid(v, valid_type)) {
|
||||
icon_to_draw = get_icon("KeyInvalid", "EditorIcons");
|
||||
icon_to_draw = get_theme_icon("KeyInvalid", "EditorIcons");
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 ofs(p_x - icon_to_draw->get_width() / 2, int(get_size().height - icon_to_draw->get_height()) / 2);
|
||||
|
||||
if (animation->track_get_type(track) == Animation::TYPE_METHOD) {
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Color color = get_color("font_color", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
Color color = get_theme_color("font_color", "Label");
|
||||
color.a = 0.5;
|
||||
|
||||
Dictionary d = animation->track_get_key_value(track, p_index);
|
||||
|
|
@ -2387,19 +2387,19 @@ void AnimationTrackEdit::set_animation_and_track(const Ref<Animation> &p_animati
|
|||
update();
|
||||
|
||||
Ref<Texture2D> type_icons[6] = {
|
||||
get_icon("KeyValue", "EditorIcons"),
|
||||
get_icon("KeyXform", "EditorIcons"),
|
||||
get_icon("KeyCall", "EditorIcons"),
|
||||
get_icon("KeyBezier", "EditorIcons"),
|
||||
get_icon("KeyAudio", "EditorIcons"),
|
||||
get_icon("KeyAnimation", "EditorIcons")
|
||||
get_theme_icon("KeyValue", "EditorIcons"),
|
||||
get_theme_icon("KeyXform", "EditorIcons"),
|
||||
get_theme_icon("KeyCall", "EditorIcons"),
|
||||
get_theme_icon("KeyBezier", "EditorIcons"),
|
||||
get_theme_icon("KeyAudio", "EditorIcons"),
|
||||
get_theme_icon("KeyAnimation", "EditorIcons")
|
||||
};
|
||||
|
||||
ERR_FAIL_INDEX(track, animation->get_track_count());
|
||||
|
||||
node_path = animation->track_get_path(p_track);
|
||||
type_icon = type_icons[animation->track_get_type(track)];
|
||||
selected_icon = get_icon("KeySelected", "EditorIcons");
|
||||
selected_icon = get_theme_icon("KeySelected", "EditorIcons");
|
||||
}
|
||||
|
||||
NodePath AnimationTrackEdit::get_path() const {
|
||||
|
|
@ -2408,9 +2408,9 @@ NodePath AnimationTrackEdit::get_path() const {
|
|||
|
||||
Size2 AnimationTrackEdit::get_minimum_size() const {
|
||||
|
||||
Ref<Texture2D> texture = get_icon("Object", "EditorIcons");
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
int separation = get_constant("vseparation", "ItemList");
|
||||
Ref<Texture2D> texture = get_theme_icon("Object", "EditorIcons");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
int separation = get_theme_constant("vseparation", "ItemList");
|
||||
|
||||
int max_h = MAX(texture->get_height(), font->get_height());
|
||||
max_h = MAX(max_h, get_key_height());
|
||||
|
|
@ -2442,7 +2442,7 @@ void AnimationTrackEdit::_play_position_draw() {
|
|||
int px = (-timeline->get_value() + play_position_pos) * scale + timeline->get_name_limit();
|
||||
|
||||
if (px >= timeline->get_name_limit() && px < (get_size().width - timeline->get_buttons_width())) {
|
||||
Color color = get_color("accent_color", "Editor");
|
||||
Color color = get_theme_color("accent_color", "Editor");
|
||||
play_position->draw_line(Point2(px, 0), Point2(px, h), color, Math::round(2 * EDSCALE));
|
||||
}
|
||||
}
|
||||
|
|
@ -2471,6 +2471,7 @@ void AnimationTrackEdit::_path_entered(const String &p_text) {
|
|||
undo_redo->add_do_method(animation.ptr(), "track_set_path", track, p_text);
|
||||
undo_redo->add_undo_method(animation.ptr(), "track_set_path", track, animation->track_get_path(track));
|
||||
undo_redo->commit_action();
|
||||
path_popup->hide();
|
||||
}
|
||||
|
||||
bool AnimationTrackEdit::_is_value_key_valid(const Variant &p_key_value, Variant::Type &r_valid_type) const {
|
||||
|
|
@ -2689,14 +2690,14 @@ void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
|||
menu->connect("id_pressed", callable_mp(this, &AnimationTrackEdit::_menu_selected));
|
||||
}
|
||||
menu->clear();
|
||||
menu->add_icon_item(get_icon("TrackContinuous", "EditorIcons"), TTR("Continuous"), MENU_CALL_MODE_CONTINUOUS);
|
||||
menu->add_icon_item(get_icon("TrackDiscrete", "EditorIcons"), TTR("Discrete"), MENU_CALL_MODE_DISCRETE);
|
||||
menu->add_icon_item(get_icon("TrackTrigger", "EditorIcons"), TTR("Trigger"), MENU_CALL_MODE_TRIGGER);
|
||||
menu->add_icon_item(get_icon("TrackCapture", "EditorIcons"), TTR("Capture"), MENU_CALL_MODE_CAPTURE);
|
||||
menu->add_icon_item(get_theme_icon("TrackContinuous", "EditorIcons"), TTR("Continuous"), MENU_CALL_MODE_CONTINUOUS);
|
||||
menu->add_icon_item(get_theme_icon("TrackDiscrete", "EditorIcons"), TTR("Discrete"), MENU_CALL_MODE_DISCRETE);
|
||||
menu->add_icon_item(get_theme_icon("TrackTrigger", "EditorIcons"), TTR("Trigger"), MENU_CALL_MODE_TRIGGER);
|
||||
menu->add_icon_item(get_theme_icon("TrackCapture", "EditorIcons"), TTR("Capture"), MENU_CALL_MODE_CAPTURE);
|
||||
menu->set_as_minsize();
|
||||
|
||||
Vector2 popup_pos = get_global_position() + update_mode_rect.position + Vector2(0, update_mode_rect.size.height);
|
||||
menu->set_global_position(popup_pos);
|
||||
Vector2 popup_pos = get_screen_position() + update_mode_rect.position + Vector2(0, update_mode_rect.size.height);
|
||||
menu->set_position(popup_pos);
|
||||
menu->popup();
|
||||
accept_event();
|
||||
}
|
||||
|
|
@ -2708,13 +2709,13 @@ void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
|||
menu->connect("id_pressed", callable_mp(this, &AnimationTrackEdit::_menu_selected));
|
||||
}
|
||||
menu->clear();
|
||||
menu->add_icon_item(get_icon("InterpRaw", "EditorIcons"), TTR("Nearest"), MENU_INTERPOLATION_NEAREST);
|
||||
menu->add_icon_item(get_icon("InterpLinear", "EditorIcons"), TTR("Linear"), MENU_INTERPOLATION_LINEAR);
|
||||
menu->add_icon_item(get_icon("InterpCubic", "EditorIcons"), TTR("Cubic"), MENU_INTERPOLATION_CUBIC);
|
||||
menu->add_icon_item(get_theme_icon("InterpRaw", "EditorIcons"), TTR("Nearest"), MENU_INTERPOLATION_NEAREST);
|
||||
menu->add_icon_item(get_theme_icon("InterpLinear", "EditorIcons"), TTR("Linear"), MENU_INTERPOLATION_LINEAR);
|
||||
menu->add_icon_item(get_theme_icon("InterpCubic", "EditorIcons"), TTR("Cubic"), MENU_INTERPOLATION_CUBIC);
|
||||
menu->set_as_minsize();
|
||||
|
||||
Vector2 popup_pos = get_global_position() + interp_mode_rect.position + Vector2(0, interp_mode_rect.size.height);
|
||||
menu->set_global_position(popup_pos);
|
||||
Vector2 popup_pos = get_screen_position() + interp_mode_rect.position + Vector2(0, interp_mode_rect.size.height);
|
||||
menu->set_position(popup_pos);
|
||||
menu->popup();
|
||||
accept_event();
|
||||
}
|
||||
|
|
@ -2726,12 +2727,12 @@ void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
|||
menu->connect("id_pressed", callable_mp(this, &AnimationTrackEdit::_menu_selected));
|
||||
}
|
||||
menu->clear();
|
||||
menu->add_icon_item(get_icon("InterpWrapClamp", "EditorIcons"), TTR("Clamp Loop Interp"), MENU_LOOP_CLAMP);
|
||||
menu->add_icon_item(get_icon("InterpWrapLoop", "EditorIcons"), TTR("Wrap Loop Interp"), MENU_LOOP_WRAP);
|
||||
menu->add_icon_item(get_theme_icon("InterpWrapClamp", "EditorIcons"), TTR("Clamp Loop Interp"), MENU_LOOP_CLAMP);
|
||||
menu->add_icon_item(get_theme_icon("InterpWrapLoop", "EditorIcons"), TTR("Wrap Loop Interp"), MENU_LOOP_WRAP);
|
||||
menu->set_as_minsize();
|
||||
|
||||
Vector2 popup_pos = get_global_position() + loop_mode_rect.position + Vector2(0, loop_mode_rect.size.height);
|
||||
menu->set_global_position(popup_pos);
|
||||
Vector2 popup_pos = get_screen_position() + loop_mode_rect.position + Vector2(0, loop_mode_rect.size.height);
|
||||
menu->set_position(popup_pos);
|
||||
menu->popup();
|
||||
accept_event();
|
||||
}
|
||||
|
|
@ -2822,17 +2823,17 @@ void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
|||
}
|
||||
|
||||
menu->clear();
|
||||
menu->add_icon_item(get_icon("Key", "EditorIcons"), TTR("Insert Key"), MENU_KEY_INSERT);
|
||||
menu->add_icon_item(get_theme_icon("Key", "EditorIcons"), TTR("Insert Key"), MENU_KEY_INSERT);
|
||||
if (editor->is_selection_active()) {
|
||||
menu->add_separator();
|
||||
menu->add_icon_item(get_icon("Duplicate", "EditorIcons"), TTR("Duplicate Key(s)"), MENU_KEY_DUPLICATE);
|
||||
menu->add_icon_item(get_theme_icon("Duplicate", "EditorIcons"), TTR("Duplicate Key(s)"), MENU_KEY_DUPLICATE);
|
||||
menu->add_separator();
|
||||
menu->add_icon_item(get_icon("Remove", "EditorIcons"), TTR("Delete Key(s)"), MENU_KEY_DELETE);
|
||||
menu->add_icon_item(get_theme_icon("Remove", "EditorIcons"), TTR("Delete Key(s)"), MENU_KEY_DELETE);
|
||||
}
|
||||
menu->set_as_minsize();
|
||||
|
||||
Vector2 popup_pos = get_global_transform().xform(get_local_mouse_position());
|
||||
menu->set_global_position(popup_pos);
|
||||
Vector2 popup_pos = get_screen_transform().xform(get_local_mouse_position());
|
||||
menu->set_position(popup_pos);
|
||||
menu->popup();
|
||||
|
||||
insert_at_pos = offset + timeline->get_value();
|
||||
|
|
@ -2843,17 +2844,20 @@ void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
|||
if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && clicking_on_name) {
|
||||
|
||||
if (!path) {
|
||||
path_popup = memnew(Popup);
|
||||
path_popup->set_wrap_controls(true);
|
||||
add_child(path_popup);
|
||||
path = memnew(LineEdit);
|
||||
add_child(path);
|
||||
path->set_as_toplevel(true);
|
||||
path_popup->add_child(path);
|
||||
path->set_anchors_and_margins_preset(PRESET_WIDE);
|
||||
path->connect("text_entered", callable_mp(this, &AnimationTrackEdit::_path_entered));
|
||||
}
|
||||
|
||||
path->set_text(animation->track_get_path(track));
|
||||
Vector2 theme_ofs = path->get_stylebox("normal", "LineEdit")->get_offset();
|
||||
path->set_position(get_global_position() + path_rect.position - theme_ofs);
|
||||
path->set_size(path_rect.size);
|
||||
path->show_modal();
|
||||
Vector2 theme_ofs = path->get_theme_stylebox("normal", "LineEdit")->get_offset();
|
||||
path_popup->set_position(get_screen_position() + path_rect.position - theme_ofs);
|
||||
path_popup->set_size(path_rect.size);
|
||||
path_popup->popup();
|
||||
path->grab_focus();
|
||||
path->set_cursor_position(path->get_text().length());
|
||||
clicking_on_name = false;
|
||||
|
|
@ -3090,6 +3094,7 @@ AnimationTrackEdit::AnimationTrackEdit() {
|
|||
timeline = NULL;
|
||||
root = NULL;
|
||||
path = NULL;
|
||||
path_popup = NULL;
|
||||
menu = NULL;
|
||||
clicking_on_name = false;
|
||||
dropping_at = 0;
|
||||
|
|
@ -3158,18 +3163,18 @@ AnimationTrackEdit *AnimationTrackEditPlugin::create_animation_track_edit(Object
|
|||
void AnimationTrackEditGroup::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_DRAW) {
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
int separation = get_constant("hseparation", "ItemList");
|
||||
Color color = get_color("font_color", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
int separation = get_theme_constant("hseparation", "ItemList");
|
||||
Color color = get_theme_color("font_color", "Label");
|
||||
|
||||
if (root && root->has_node(node)) {
|
||||
Node *n = root->get_node(node);
|
||||
if (n && EditorNode::get_singleton()->get_editor_selection()->is_selected(n)) {
|
||||
color = get_color("accent_color", "Editor");
|
||||
color = get_theme_color("accent_color", "Editor");
|
||||
}
|
||||
}
|
||||
|
||||
Color bgcol = get_color("dark_color_2", "Editor");
|
||||
Color bgcol = get_theme_color("dark_color_2", "Editor");
|
||||
bgcol.a *= 0.6;
|
||||
draw_rect(Rect2(Point2(), get_size()), bgcol);
|
||||
Color linecolor = color;
|
||||
|
|
@ -3187,7 +3192,7 @@ void AnimationTrackEditGroup::_notification(int p_what) {
|
|||
int px = (-timeline->get_value() + timeline->get_play_position()) * timeline->get_zoom_scale() + timeline->get_name_limit();
|
||||
|
||||
if (px >= timeline->get_name_limit() && px < (get_size().width - timeline->get_buttons_width())) {
|
||||
Color accent = get_color("accent_color", "Editor");
|
||||
Color accent = get_theme_color("accent_color", "Editor");
|
||||
draw_line(Point2(px, 0), Point2(px, get_size().height), accent, Math::round(2 * EDSCALE));
|
||||
}
|
||||
}
|
||||
|
|
@ -3203,8 +3208,8 @@ void AnimationTrackEditGroup::set_type_and_name(const Ref<Texture2D> &p_type, co
|
|||
|
||||
Size2 AnimationTrackEditGroup::get_minimum_size() const {
|
||||
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
int separation = get_constant("vseparation", "ItemList");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
int separation = get_theme_constant("vseparation", "ItemList");
|
||||
|
||||
return Vector2(0, MAX(font->get_height(), icon->get_height()) + separation);
|
||||
}
|
||||
|
|
@ -3443,7 +3448,7 @@ void AnimationTrackEditor::_query_insert(const InsertData &p_id) {
|
|||
|
||||
if (insert_frame != Engine::get_singleton()->get_frames_drawn()) {
|
||||
//clear insert list for the frame if frame changed
|
||||
if (insert_confirm->is_visible_in_tree())
|
||||
if (insert_confirm->is_visible())
|
||||
return; //do nothing
|
||||
insert_data.clear();
|
||||
insert_query = false;
|
||||
|
|
@ -3496,7 +3501,7 @@ void AnimationTrackEditor::_query_insert(const InsertData &p_id) {
|
|||
|
||||
insert_confirm_bezier->set_visible(all_bezier);
|
||||
insert_confirm->get_ok()->set_text(TTR("Create"));
|
||||
insert_confirm->popup_centered_minsize();
|
||||
insert_confirm->popup_centered();
|
||||
insert_query = true;
|
||||
} else {
|
||||
call_deferred("_insert_delay");
|
||||
|
|
@ -4095,7 +4100,7 @@ bool AnimationTrackEditor::is_selection_active() const {
|
|||
}
|
||||
|
||||
bool AnimationTrackEditor::is_snap_enabled() const {
|
||||
return snap->is_pressed() ^ Input::get_singleton()->is_key_pressed(KEY_CONTROL);
|
||||
return snap->is_pressed() ^ InputFilter::get_singleton()->is_key_pressed(KEY_CONTROL);
|
||||
}
|
||||
|
||||
void AnimationTrackEditor::_update_tracks() {
|
||||
|
|
@ -4207,7 +4212,7 @@ void AnimationTrackEditor::_update_tracks() {
|
|||
|
||||
if (!group_sort.has(base_path)) {
|
||||
AnimationTrackEditGroup *g = memnew(AnimationTrackEditGroup);
|
||||
Ref<Texture2D> icon = get_icon("Node", "EditorIcons");
|
||||
Ref<Texture2D> icon = get_theme_icon("Node", "EditorIcons");
|
||||
String name = base_path;
|
||||
String tooltip;
|
||||
if (root && root->has_node(base_path)) {
|
||||
|
|
@ -4225,7 +4230,7 @@ void AnimationTrackEditor::_update_tracks() {
|
|||
g->set_timeline(timeline);
|
||||
groups.push_back(g);
|
||||
VBoxContainer *vb = memnew(VBoxContainer);
|
||||
vb->add_constant_override("separation", 0);
|
||||
vb->add_theme_constant_override("separation", 0);
|
||||
vb->add_child(g);
|
||||
track_vbox->add_child(vb);
|
||||
group_sort[base_path] = vb;
|
||||
|
|
@ -4368,12 +4373,12 @@ MenuButton *AnimationTrackEditor::get_edit_menu() {
|
|||
|
||||
void AnimationTrackEditor::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) {
|
||||
zoom_icon->set_texture(get_icon("Zoom", "EditorIcons"));
|
||||
snap->set_icon(get_icon("Snap", "EditorIcons"));
|
||||
view_group->set_icon(get_icon(view_group->is_pressed() ? "AnimationTrackList" : "AnimationTrackGroup", "EditorIcons"));
|
||||
selected_filter->set_icon(get_icon("AnimationFilter", "EditorIcons"));
|
||||
imported_anim_warning->set_icon(get_icon("NodeWarning", "EditorIcons"));
|
||||
main_panel->add_style_override("panel", get_stylebox("bg", "Tree"));
|
||||
zoom_icon->set_texture(get_theme_icon("Zoom", "EditorIcons"));
|
||||
snap->set_icon(get_theme_icon("Snap", "EditorIcons"));
|
||||
view_group->set_icon(get_theme_icon(view_group->is_pressed() ? "AnimationTrackList" : "AnimationTrackGroup", "EditorIcons"));
|
||||
selected_filter->set_icon(get_theme_icon("AnimationFilter", "EditorIcons"));
|
||||
imported_anim_warning->set_icon(get_theme_icon("NodeWarning", "EditorIcons"));
|
||||
main_panel->add_theme_style_override("panel", get_theme_stylebox("bg", "Tree"));
|
||||
}
|
||||
|
||||
if (p_what == NOTIFICATION_READY) {
|
||||
|
|
@ -5050,8 +5055,8 @@ float AnimationTrackEditor::get_moving_selection_offset() const {
|
|||
void AnimationTrackEditor::_box_selection_draw() {
|
||||
|
||||
const Rect2 selection_rect = Rect2(Point2(), box_selection->get_size());
|
||||
box_selection->draw_rect(selection_rect, get_color("box_selection_fill_color", "Editor"));
|
||||
box_selection->draw_rect(selection_rect, get_color("box_selection_stroke_color", "Editor"), false, Math::round(EDSCALE));
|
||||
box_selection->draw_rect(selection_rect, get_theme_color("box_selection_fill_color", "Editor"));
|
||||
box_selection->draw_rect(selection_rect, get_theme_color("box_selection_stroke_color", "Editor"), false, Math::round(EDSCALE));
|
||||
}
|
||||
|
||||
void AnimationTrackEditor::_scroll_input(const Ref<InputEvent> &p_event) {
|
||||
|
|
@ -5266,10 +5271,10 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
|
|||
}
|
||||
|
||||
String text;
|
||||
Ref<Texture2D> icon = get_icon("Node", "EditorIcons");
|
||||
Ref<Texture2D> icon = get_theme_icon("Node", "EditorIcons");
|
||||
if (node) {
|
||||
if (has_icon(node->get_class(), "EditorIcons")) {
|
||||
icon = get_icon(node->get_class(), "EditorIcons");
|
||||
if (has_theme_icon(node->get_class(), "EditorIcons")) {
|
||||
icon = get_theme_icon(node->get_class(), "EditorIcons");
|
||||
}
|
||||
|
||||
text = node->get_name();
|
||||
|
|
@ -5309,7 +5314,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
|
|||
it->set_metadata(0, md);
|
||||
}
|
||||
|
||||
track_copy_dialog->popup_centered_minsize(Size2(350, 500) * EDSCALE);
|
||||
track_copy_dialog->popup_centered(Size2(350, 500) * EDSCALE);
|
||||
} break;
|
||||
case EDIT_COPY_TRACKS_CONFIRM: {
|
||||
|
||||
|
|
@ -5578,7 +5583,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
|
|||
|
||||
} break;
|
||||
case EDIT_CLEAN_UP_ANIMATION: {
|
||||
cleanup_dialog->popup_centered_minsize(Size2(300, 0) * EDSCALE);
|
||||
cleanup_dialog->popup_centered(Size2(300, 0) * EDSCALE);
|
||||
|
||||
} break;
|
||||
case EDIT_CLEAN_UP_ANIMATION_CONFIRM: {
|
||||
|
|
@ -5652,7 +5657,7 @@ void AnimationTrackEditor::_cleanup_animation(Ref<Animation> p_animation) {
|
|||
void AnimationTrackEditor::_view_group_toggle() {
|
||||
|
||||
_update_tracks();
|
||||
view_group->set_icon(get_icon(view_group->is_pressed() ? "AnimationTrackList" : "AnimationTrackGroup", "EditorIcons"));
|
||||
view_group->set_icon(get_theme_icon(view_group->is_pressed() ? "AnimationTrackList" : "AnimationTrackGroup", "EditorIcons"));
|
||||
}
|
||||
|
||||
bool AnimationTrackEditor::is_grouping_tracks() {
|
||||
|
|
@ -5763,7 +5768,7 @@ AnimationTrackEditor::AnimationTrackEditor() {
|
|||
timeline_scroll->add_child(timeline_vbox);
|
||||
timeline_vbox->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
timeline_vbox->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
timeline_vbox->add_constant_override("separation", 0);
|
||||
timeline_vbox->add_theme_constant_override("separation", 0);
|
||||
|
||||
info_message = memnew(Label);
|
||||
info_message->set_text(TTR("Select an AnimationPlayer node to create and edit animations."));
|
||||
|
|
@ -5814,7 +5819,7 @@ AnimationTrackEditor::AnimationTrackEditor() {
|
|||
track_vbox->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
scroll->set_enable_h_scroll(false);
|
||||
scroll->set_enable_v_scroll(true);
|
||||
track_vbox->add_constant_override("separation", 0);
|
||||
track_vbox->add_theme_constant_override("separation", 0);
|
||||
|
||||
HBoxContainer *bottom_hb = memnew(HBoxContainer);
|
||||
add_child(bottom_hb);
|
||||
|
|
|
|||
|
|
@ -140,6 +140,7 @@ class AnimationTrackEdit : public Control {
|
|||
};
|
||||
AnimationTimelineEdit *timeline;
|
||||
UndoRedo *undo_redo;
|
||||
Popup *path_popup;
|
||||
LineEdit *path;
|
||||
Node *root;
|
||||
Control *play_position; //separate control used to draw so updates for only position changed are much faster
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@
|
|||
/// BOOL ///
|
||||
int AnimationTrackEditBool::get_key_height() const {
|
||||
|
||||
Ref<Texture2D> checked = get_icon("checked", "CheckBox");
|
||||
Ref<Texture2D> checked = get_theme_icon("checked", "CheckBox");
|
||||
return checked->get_height();
|
||||
}
|
||||
Rect2 AnimationTrackEditBool::get_key_rect(int p_index, float p_pixels_sec) {
|
||||
|
||||
Ref<Texture2D> checked = get_icon("checked", "CheckBox");
|
||||
Ref<Texture2D> checked = get_theme_icon("checked", "CheckBox");
|
||||
return Rect2(-checked->get_width() / 2, 0, checked->get_width(), get_size().height);
|
||||
}
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ bool AnimationTrackEditBool::is_key_selectable_by_distance() const {
|
|||
void AnimationTrackEditBool::draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right) {
|
||||
|
||||
bool checked = get_animation()->track_get_key_value(get_track(), p_index);
|
||||
Ref<Texture2D> icon = get_icon(checked ? "checked" : "unchecked", "CheckBox");
|
||||
Ref<Texture2D> icon = get_theme_icon(checked ? "checked" : "unchecked", "CheckBox");
|
||||
|
||||
Vector2 ofs(p_x - icon->get_width() / 2, int(get_size().height - icon->get_height()) / 2);
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ void AnimationTrackEditBool::draw_key(int p_index, float p_pixels_sec, int p_x,
|
|||
draw_texture(icon, ofs);
|
||||
|
||||
if (p_selected) {
|
||||
Color color = get_color("accent_color", "Editor");
|
||||
Color color = get_theme_color("accent_color", "Editor");
|
||||
draw_rect_clipped(Rect2(ofs, icon->get_size()), color, false);
|
||||
}
|
||||
}
|
||||
|
|
@ -80,12 +80,12 @@ void AnimationTrackEditBool::draw_key(int p_index, float p_pixels_sec, int p_x,
|
|||
|
||||
int AnimationTrackEditColor::get_key_height() const {
|
||||
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
return font->get_height() * 0.8;
|
||||
}
|
||||
Rect2 AnimationTrackEditColor::get_key_rect(int p_index, float p_pixels_sec) {
|
||||
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
int fh = font->get_height() * 0.8;
|
||||
return Rect2(-fh / 2, 0, fh, get_size().height);
|
||||
}
|
||||
|
|
@ -97,7 +97,7 @@ bool AnimationTrackEditColor::is_key_selectable_by_distance() const {
|
|||
|
||||
void AnimationTrackEditColor::draw_key_link(int p_index, float p_pixels_sec, int p_x, int p_next_x, int p_clip_left, int p_clip_right) {
|
||||
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
int fh = (font->get_height() * 0.8);
|
||||
|
||||
int x_from = p_x + fh / 2 - 1;
|
||||
|
|
@ -146,7 +146,7 @@ void AnimationTrackEditColor::draw_key(int p_index, float p_pixels_sec, int p_x,
|
|||
|
||||
Color color = get_animation()->track_get_key_value(get_track(), p_index);
|
||||
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
int fh = font->get_height() * 0.8;
|
||||
|
||||
Rect2 rect(Vector2(p_x - fh / 2, int(get_size().height - fh) / 2), Size2(fh, fh));
|
||||
|
|
@ -158,7 +158,7 @@ void AnimationTrackEditColor::draw_key(int p_index, float p_pixels_sec, int p_x,
|
|||
draw_rect_clipped(rect, color);
|
||||
|
||||
if (p_selected) {
|
||||
Color accent = get_color("accent_color", "Editor");
|
||||
Color accent = get_theme_color("accent_color", "Editor");
|
||||
draw_rect_clipped(rect, accent, false);
|
||||
}
|
||||
}
|
||||
|
|
@ -185,7 +185,7 @@ int AnimationTrackEditAudio::get_key_height() const {
|
|||
return AnimationTrackEdit::get_key_height();
|
||||
}
|
||||
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
return int(font->get_height() * 1.5);
|
||||
}
|
||||
Rect2 AnimationTrackEditAudio::get_key_rect(int p_index, float p_pixels_sec) {
|
||||
|
|
@ -218,7 +218,7 @@ Rect2 AnimationTrackEditAudio::get_key_rect(int p_index, float p_pixels_sec) {
|
|||
|
||||
return Rect2(0, 0, len * p_pixels_sec, get_size().height);
|
||||
} else {
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
int fh = font->get_height() * 0.8;
|
||||
return Rect2(0, 0, fh, get_size().height);
|
||||
}
|
||||
|
|
@ -279,7 +279,7 @@ void AnimationTrackEditAudio::draw_key(int p_index, float p_pixels_sec, int p_x,
|
|||
if (to_x <= from_x)
|
||||
return;
|
||||
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
float fh = int(font->get_height() * 1.5);
|
||||
Rect2 rect = Rect2(from_x, (get_size().height - fh) / 2, to_x - from_x, fh);
|
||||
draw_rect(rect, Color(0.25, 0.25, 0.25));
|
||||
|
|
@ -306,19 +306,19 @@ void AnimationTrackEditAudio::draw_key(int p_index, float p_pixels_sec, int p_x,
|
|||
VS::get_singleton()->canvas_item_add_multiline(get_canvas_item(), lines, color);
|
||||
|
||||
if (p_selected) {
|
||||
Color accent = get_color("accent_color", "Editor");
|
||||
Color accent = get_theme_color("accent_color", "Editor");
|
||||
draw_rect(rect, accent, false);
|
||||
}
|
||||
} else {
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
int fh = font->get_height() * 0.8;
|
||||
Rect2 rect(Vector2(p_x, int(get_size().height - fh) / 2), Size2(fh, fh));
|
||||
|
||||
Color color = get_color("font_color", "Label");
|
||||
Color color = get_theme_color("font_color", "Label");
|
||||
draw_rect(rect, color);
|
||||
|
||||
if (p_selected) {
|
||||
Color accent = get_color("accent_color", "Editor");
|
||||
Color accent = get_theme_color("accent_color", "Editor");
|
||||
draw_rect(rect, accent, false);
|
||||
}
|
||||
}
|
||||
|
|
@ -344,7 +344,7 @@ int AnimationTrackEditSpriteFrame::get_key_height() const {
|
|||
return AnimationTrackEdit::get_key_height();
|
||||
}
|
||||
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
return int(font->get_height() * 2);
|
||||
}
|
||||
Rect2 AnimationTrackEditSpriteFrame::get_key_rect(int p_index, float p_pixels_sec) {
|
||||
|
|
@ -413,7 +413,7 @@ Rect2 AnimationTrackEditSpriteFrame::get_key_rect(int p_index, float p_pixels_se
|
|||
|
||||
size = size.floor();
|
||||
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
int height = int(font->get_height() * 2);
|
||||
int width = height * size.width / size.height;
|
||||
|
||||
|
|
@ -507,7 +507,7 @@ void AnimationTrackEditSpriteFrame::draw_key(int p_index, float p_pixels_sec, in
|
|||
region.size = texture->get_size();
|
||||
}
|
||||
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
int height = int(font->get_height() * 2);
|
||||
|
||||
int width = height * region.size.width / region.size.height;
|
||||
|
|
@ -520,7 +520,7 @@ void AnimationTrackEditSpriteFrame::draw_key(int p_index, float p_pixels_sec, in
|
|||
if (rect.position.x > p_clip_right)
|
||||
return;
|
||||
|
||||
Color accent = get_color("accent_color", "Editor");
|
||||
Color accent = get_theme_color("accent_color", "Editor");
|
||||
Color bg = accent;
|
||||
bg.a = 0.15;
|
||||
|
||||
|
|
@ -551,7 +551,7 @@ int AnimationTrackEditSubAnim::get_key_height() const {
|
|||
return AnimationTrackEdit::get_key_height();
|
||||
}
|
||||
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
return int(font->get_height() * 1.5);
|
||||
}
|
||||
Rect2 AnimationTrackEditSubAnim::get_key_rect(int p_index, float p_pixels_sec) {
|
||||
|
|
@ -580,7 +580,7 @@ Rect2 AnimationTrackEditSubAnim::get_key_rect(int p_index, float p_pixels_sec) {
|
|||
|
||||
return Rect2(0, 0, len * p_pixels_sec, get_size().height);
|
||||
} else {
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
int fh = font->get_height() * 0.8;
|
||||
return Rect2(0, 0, fh, get_size().height);
|
||||
}
|
||||
|
|
@ -633,12 +633,12 @@ void AnimationTrackEditSubAnim::draw_key(int p_index, float p_pixels_sec, int p_
|
|||
if (to_x <= from_x)
|
||||
return;
|
||||
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
int fh = font->get_height() * 1.5;
|
||||
|
||||
Rect2 rect(from_x, int(get_size().height - fh) / 2, to_x - from_x, fh);
|
||||
|
||||
Color color = get_color("font_color", "Label");
|
||||
Color color = get_theme_color("font_color", "Label");
|
||||
Color bg = color;
|
||||
bg.r = 1 - color.r;
|
||||
bg.g = 1 - color.g;
|
||||
|
|
@ -682,19 +682,19 @@ void AnimationTrackEditSubAnim::draw_key(int p_index, float p_pixels_sec, int p_
|
|||
}
|
||||
|
||||
if (p_selected) {
|
||||
Color accent = get_color("accent_color", "Editor");
|
||||
Color accent = get_theme_color("accent_color", "Editor");
|
||||
draw_rect(rect, accent, false);
|
||||
}
|
||||
} else {
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
int fh = font->get_height() * 0.8;
|
||||
Rect2 rect(Vector2(p_x, int(get_size().height - fh) / 2), Size2(fh, fh));
|
||||
|
||||
Color color = get_color("font_color", "Label");
|
||||
Color color = get_theme_color("font_color", "Label");
|
||||
draw_rect(rect, color);
|
||||
|
||||
if (p_selected) {
|
||||
Color accent = get_color("accent_color", "Editor");
|
||||
Color accent = get_theme_color("accent_color", "Editor");
|
||||
draw_rect(rect, accent, false);
|
||||
}
|
||||
}
|
||||
|
|
@ -709,13 +709,13 @@ void AnimationTrackEditSubAnim::set_node(Object *p_object) {
|
|||
|
||||
int AnimationTrackEditVolumeDB::get_key_height() const {
|
||||
|
||||
Ref<Texture2D> volume_texture = get_icon("ColorTrackVu", "EditorIcons");
|
||||
Ref<Texture2D> volume_texture = get_theme_icon("ColorTrackVu", "EditorIcons");
|
||||
return volume_texture->get_height() * 1.2;
|
||||
}
|
||||
|
||||
void AnimationTrackEditVolumeDB::draw_bg(int p_clip_left, int p_clip_right) {
|
||||
|
||||
Ref<Texture2D> volume_texture = get_icon("ColorTrackVu", "EditorIcons");
|
||||
Ref<Texture2D> volume_texture = get_theme_icon("ColorTrackVu", "EditorIcons");
|
||||
int tex_h = volume_texture->get_height();
|
||||
|
||||
int y_from = (get_size().height - tex_h) / 2;
|
||||
|
|
@ -727,7 +727,7 @@ void AnimationTrackEditVolumeDB::draw_bg(int p_clip_left, int p_clip_right) {
|
|||
|
||||
void AnimationTrackEditVolumeDB::draw_fg(int p_clip_left, int p_clip_right) {
|
||||
|
||||
Ref<Texture2D> volume_texture = get_icon("ColorTrackVu", "EditorIcons");
|
||||
Ref<Texture2D> volume_texture = get_theme_icon("ColorTrackVu", "EditorIcons");
|
||||
int tex_h = volume_texture->get_height();
|
||||
int y_from = (get_size().height - tex_h) / 2;
|
||||
int db0 = y_from + (24 / 80.0) * tex_h;
|
||||
|
|
@ -762,12 +762,12 @@ void AnimationTrackEditVolumeDB::draw_key_link(int p_index, float p_pixels_sec,
|
|||
to_x = p_clip_right;
|
||||
}
|
||||
|
||||
Ref<Texture2D> volume_texture = get_icon("ColorTrackVu", "EditorIcons");
|
||||
Ref<Texture2D> volume_texture = get_theme_icon("ColorTrackVu", "EditorIcons");
|
||||
int tex_h = volume_texture->get_height();
|
||||
|
||||
int y_from = (get_size().height - tex_h) / 2;
|
||||
|
||||
Color color = get_color("font_color", "Label");
|
||||
Color color = get_theme_color("font_color", "Label");
|
||||
color.a *= 0.7;
|
||||
|
||||
draw_line(Point2(from_x, y_from + h * tex_h), Point2(to_x, y_from + h_n * tex_h), color, 2);
|
||||
|
|
@ -790,7 +790,7 @@ void AnimationTrackEditTypeAudio::_preview_changed(ObjectID p_which) {
|
|||
|
||||
int AnimationTrackEditTypeAudio::get_key_height() const {
|
||||
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
return int(font->get_height() * 1.5);
|
||||
}
|
||||
Rect2 AnimationTrackEditTypeAudio::get_key_rect(int p_index, float p_pixels_sec) {
|
||||
|
|
@ -854,7 +854,7 @@ void AnimationTrackEditTypeAudio::draw_key(int p_index, float p_pixels_sec, int
|
|||
}
|
||||
}
|
||||
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
float fh = int(font->get_height() * 1.5);
|
||||
|
||||
float len = stream->get_length();
|
||||
|
|
@ -928,7 +928,7 @@ void AnimationTrackEditTypeAudio::draw_key(int p_index, float p_pixels_sec, int
|
|||
|
||||
VS::get_singleton()->canvas_item_add_multiline(get_canvas_item(), lines, color);
|
||||
|
||||
Color cut_color = get_color("accent_color", "Editor");
|
||||
Color cut_color = get_theme_color("accent_color", "Editor");
|
||||
cut_color.a = 0.7;
|
||||
if (start_ofs > 0 && pixel_begin > p_clip_left) {
|
||||
draw_rect(Rect2(pixel_begin, rect.position.y, 1, rect.size.y), cut_color);
|
||||
|
|
@ -938,7 +938,7 @@ void AnimationTrackEditTypeAudio::draw_key(int p_index, float p_pixels_sec, int
|
|||
}
|
||||
|
||||
if (p_selected) {
|
||||
Color accent = get_color("accent_color", "Editor");
|
||||
Color accent = get_theme_color("accent_color", "Editor");
|
||||
draw_rect(rect, accent, false);
|
||||
}
|
||||
}
|
||||
|
|
@ -1133,7 +1133,7 @@ int AnimationTrackEditTypeAnimation::get_key_height() const {
|
|||
return AnimationTrackEdit::get_key_height();
|
||||
}
|
||||
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
return int(font->get_height() * 1.5);
|
||||
}
|
||||
Rect2 AnimationTrackEditTypeAnimation::get_key_rect(int p_index, float p_pixels_sec) {
|
||||
|
|
@ -1162,7 +1162,7 @@ Rect2 AnimationTrackEditTypeAnimation::get_key_rect(int p_index, float p_pixels_
|
|||
|
||||
return Rect2(0, 0, len * p_pixels_sec, get_size().height);
|
||||
} else {
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
int fh = font->get_height() * 0.8;
|
||||
return Rect2(0, 0, fh, get_size().height);
|
||||
}
|
||||
|
|
@ -1215,12 +1215,12 @@ void AnimationTrackEditTypeAnimation::draw_key(int p_index, float p_pixels_sec,
|
|||
if (to_x <= from_x)
|
||||
return;
|
||||
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
int fh = font->get_height() * 1.5;
|
||||
|
||||
Rect2 rect(from_x, int(get_size().height - fh) / 2, to_x - from_x, fh);
|
||||
|
||||
Color color = get_color("font_color", "Label");
|
||||
Color color = get_theme_color("font_color", "Label");
|
||||
Color bg = color;
|
||||
bg.r = 1 - color.r;
|
||||
bg.g = 1 - color.g;
|
||||
|
|
@ -1264,19 +1264,19 @@ void AnimationTrackEditTypeAnimation::draw_key(int p_index, float p_pixels_sec,
|
|||
}
|
||||
|
||||
if (p_selected) {
|
||||
Color accent = get_color("accent_color", "Editor");
|
||||
Color accent = get_theme_color("accent_color", "Editor");
|
||||
draw_rect(rect, accent, false);
|
||||
}
|
||||
} else {
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
int fh = font->get_height() * 0.8;
|
||||
Rect2 rect(Vector2(p_x, int(get_size().height - fh) / 2), Size2(fh, fh));
|
||||
|
||||
Color color = get_color("font_color", "Label");
|
||||
Color color = get_theme_color("font_color", "Label");
|
||||
draw_rect(rect, color);
|
||||
|
||||
if (p_selected) {
|
||||
Color accent = get_color("accent_color", "Editor");
|
||||
Color accent = get_theme_color("accent_color", "Editor");
|
||||
draw_rect(rect, accent, false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include "code_editor.h"
|
||||
|
||||
#include "core/os/input.h"
|
||||
#include "core/input/input_filter.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "core/string_builder.h"
|
||||
#include "editor/editor_scale.h"
|
||||
|
|
@ -69,10 +69,10 @@ GotoLineDialog::GotoLineDialog() {
|
|||
set_title(TTR("Go to Line"));
|
||||
|
||||
VBoxContainer *vbc = memnew(VBoxContainer);
|
||||
vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_BEGIN, 8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, -8 * EDSCALE);
|
||||
add_child(vbc);
|
||||
|
||||
Label *l = memnew(Label);
|
||||
|
|
@ -91,25 +91,25 @@ void FindReplaceBar::_notification(int p_what) {
|
|||
|
||||
if (p_what == NOTIFICATION_READY) {
|
||||
|
||||
find_prev->set_icon(get_icon("MoveUp", "EditorIcons"));
|
||||
find_next->set_icon(get_icon("MoveDown", "EditorIcons"));
|
||||
hide_button->set_normal_texture(get_icon("Close", "EditorIcons"));
|
||||
hide_button->set_hover_texture(get_icon("Close", "EditorIcons"));
|
||||
hide_button->set_pressed_texture(get_icon("Close", "EditorIcons"));
|
||||
find_prev->set_icon(get_theme_icon("MoveUp", "EditorIcons"));
|
||||
find_next->set_icon(get_theme_icon("MoveDown", "EditorIcons"));
|
||||
hide_button->set_normal_texture(get_theme_icon("Close", "EditorIcons"));
|
||||
hide_button->set_hover_texture(get_theme_icon("Close", "EditorIcons"));
|
||||
hide_button->set_pressed_texture(get_theme_icon("Close", "EditorIcons"));
|
||||
hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size());
|
||||
} else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
||||
|
||||
set_process_unhandled_input(is_visible_in_tree());
|
||||
} else if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
|
||||
|
||||
find_prev->set_icon(get_icon("MoveUp", "EditorIcons"));
|
||||
find_next->set_icon(get_icon("MoveDown", "EditorIcons"));
|
||||
hide_button->set_normal_texture(get_icon("Close", "EditorIcons"));
|
||||
hide_button->set_hover_texture(get_icon("Close", "EditorIcons"));
|
||||
hide_button->set_pressed_texture(get_icon("Close", "EditorIcons"));
|
||||
find_prev->set_icon(get_theme_icon("MoveUp", "EditorIcons"));
|
||||
find_next->set_icon(get_theme_icon("MoveDown", "EditorIcons"));
|
||||
hide_button->set_normal_texture(get_theme_icon("Close", "EditorIcons"));
|
||||
hide_button->set_hover_texture(get_theme_icon("Close", "EditorIcons"));
|
||||
hide_button->set_pressed_texture(get_theme_icon("Close", "EditorIcons"));
|
||||
hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size());
|
||||
} else if (p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
matches_label->add_color_override("font_color", results_count > 0 ? get_color("font_color", "Label") : get_color("error_color", "Editor"));
|
||||
matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color("font_color", "Label") : get_theme_color("error_color", "Editor"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -277,7 +277,7 @@ void FindReplaceBar::_replace_all() {
|
|||
}
|
||||
|
||||
text_edit->set_v_scroll(vsval);
|
||||
matches_label->add_color_override("font_color", rc > 0 ? get_color("font_color", "Label") : get_color("error_color", "Editor"));
|
||||
matches_label->add_theme_color_override("font_color", rc > 0 ? get_theme_color("font_color", "Label") : get_theme_color("error_color", "Editor"));
|
||||
matches_label->set_text(vformat(TTR("%d replaced."), rc));
|
||||
|
||||
text_edit->call_deferred("connect", "text_changed", Callable(this, "_editor_text_changed"));
|
||||
|
|
@ -331,7 +331,7 @@ void FindReplaceBar::_update_matches_label() {
|
|||
} else {
|
||||
matches_label->show();
|
||||
|
||||
matches_label->add_color_override("font_color", results_count > 0 ? get_color("font_color", "Label") : get_color("error_color", "Editor"));
|
||||
matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color("font_color", "Label") : get_theme_color("error_color", "Editor"));
|
||||
matches_label->set_text(vformat(results_count == 1 ? TTR("%d match.") : TTR("%d matches."), results_count));
|
||||
}
|
||||
}
|
||||
|
|
@ -505,7 +505,7 @@ void FindReplaceBar::_search_text_changed(const String &p_text) {
|
|||
|
||||
void FindReplaceBar::_search_text_entered(const String &p_text) {
|
||||
|
||||
if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
|
||||
if (InputFilter::get_singleton()->is_key_pressed(KEY_SHIFT)) {
|
||||
search_prev();
|
||||
} else {
|
||||
search_next();
|
||||
|
|
@ -517,7 +517,7 @@ void FindReplaceBar::_replace_text_entered(const String &p_text) {
|
|||
if (selection_only->is_pressed() && text_edit->is_selection_active()) {
|
||||
_replace_all();
|
||||
_hide_bar();
|
||||
} else if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
|
||||
} else if (InputFilter::get_singleton()->is_key_pressed(KEY_SHIFT)) {
|
||||
_replace();
|
||||
search_prev();
|
||||
} else {
|
||||
|
|
@ -712,7 +712,7 @@ void CodeTextEditor::_text_editor_gui_input(const Ref<InputEvent> &p_event) {
|
|||
Ref<InputEventMagnifyGesture> magnify_gesture = p_event;
|
||||
if (magnify_gesture.is_valid()) {
|
||||
|
||||
Ref<DynamicFont> font = text_editor->get_font("font");
|
||||
Ref<DynamicFont> font = text_editor->get_theme_font("font");
|
||||
|
||||
if (font.is_valid()) {
|
||||
if (font->get_size() != (int)font_size) {
|
||||
|
|
@ -760,7 +760,7 @@ void CodeTextEditor::_zoom_changed() {
|
|||
}
|
||||
|
||||
void CodeTextEditor::_reset_zoom() {
|
||||
Ref<DynamicFont> font = text_editor->get_font("font"); // Reset source font size to default.
|
||||
Ref<DynamicFont> font = text_editor->get_theme_font("font"); // Reset source font size to default.
|
||||
|
||||
if (font.is_valid()) {
|
||||
EditorSettings::get_singleton()->set("interface/editor/code_font_size", 14);
|
||||
|
|
@ -828,41 +828,41 @@ Ref<Texture2D> CodeTextEditor::_get_completion_icon(const ScriptCodeCompletionOp
|
|||
Ref<Texture2D> tex;
|
||||
switch (p_option.kind) {
|
||||
case ScriptCodeCompletionOption::KIND_CLASS: {
|
||||
if (has_icon(p_option.display, "EditorIcons")) {
|
||||
tex = get_icon(p_option.display, "EditorIcons");
|
||||
if (has_theme_icon(p_option.display, "EditorIcons")) {
|
||||
tex = get_theme_icon(p_option.display, "EditorIcons");
|
||||
} else {
|
||||
tex = get_icon("Object", "EditorIcons");
|
||||
tex = get_theme_icon("Object", "EditorIcons");
|
||||
}
|
||||
} break;
|
||||
case ScriptCodeCompletionOption::KIND_ENUM:
|
||||
tex = get_icon("Enum", "EditorIcons");
|
||||
tex = get_theme_icon("Enum", "EditorIcons");
|
||||
break;
|
||||
case ScriptCodeCompletionOption::KIND_FILE_PATH:
|
||||
tex = get_icon("File", "EditorIcons");
|
||||
tex = get_theme_icon("File", "EditorIcons");
|
||||
break;
|
||||
case ScriptCodeCompletionOption::KIND_NODE_PATH:
|
||||
tex = get_icon("NodePath", "EditorIcons");
|
||||
tex = get_theme_icon("NodePath", "EditorIcons");
|
||||
break;
|
||||
case ScriptCodeCompletionOption::KIND_VARIABLE:
|
||||
tex = get_icon("Variant", "EditorIcons");
|
||||
tex = get_theme_icon("Variant", "EditorIcons");
|
||||
break;
|
||||
case ScriptCodeCompletionOption::KIND_CONSTANT:
|
||||
tex = get_icon("MemberConstant", "EditorIcons");
|
||||
tex = get_theme_icon("MemberConstant", "EditorIcons");
|
||||
break;
|
||||
case ScriptCodeCompletionOption::KIND_MEMBER:
|
||||
tex = get_icon("MemberProperty", "EditorIcons");
|
||||
tex = get_theme_icon("MemberProperty", "EditorIcons");
|
||||
break;
|
||||
case ScriptCodeCompletionOption::KIND_SIGNAL:
|
||||
tex = get_icon("MemberSignal", "EditorIcons");
|
||||
tex = get_theme_icon("MemberSignal", "EditorIcons");
|
||||
break;
|
||||
case ScriptCodeCompletionOption::KIND_FUNCTION:
|
||||
tex = get_icon("MemberMethod", "EditorIcons");
|
||||
tex = get_theme_icon("MemberMethod", "EditorIcons");
|
||||
break;
|
||||
case ScriptCodeCompletionOption::KIND_PLAIN_TEXT:
|
||||
tex = get_icon("CubeMesh", "EditorIcons");
|
||||
tex = get_theme_icon("CubeMesh", "EditorIcons");
|
||||
break;
|
||||
default:
|
||||
tex = get_icon("String", "EditorIcons");
|
||||
tex = get_theme_icon("String", "EditorIcons");
|
||||
break;
|
||||
}
|
||||
return tex;
|
||||
|
|
@ -877,7 +877,7 @@ void CodeTextEditor::_font_resize_timeout() {
|
|||
|
||||
bool CodeTextEditor::_add_font_size(int p_delta) {
|
||||
|
||||
Ref<DynamicFont> font = text_editor->get_font("font");
|
||||
Ref<DynamicFont> font = text_editor->get_theme_font("font");
|
||||
|
||||
if (font.is_valid()) {
|
||||
int new_size = CLAMP(font->get_size() + p_delta, 8 * EDSCALE, 96 * EDSCALE);
|
||||
|
|
@ -1454,18 +1454,18 @@ void CodeTextEditor::goto_error() {
|
|||
|
||||
void CodeTextEditor::_update_font() {
|
||||
|
||||
text_editor->add_font_override("font", get_font("source", "EditorFonts"));
|
||||
text_editor->add_theme_font_override("font", get_theme_font("source", "EditorFonts"));
|
||||
|
||||
error->add_font_override("font", get_font("status_source", "EditorFonts"));
|
||||
error->add_color_override("font_color", get_color("error_color", "Editor"));
|
||||
error->add_theme_font_override("font", get_theme_font("status_source", "EditorFonts"));
|
||||
error->add_theme_color_override("font_color", get_theme_color("error_color", "Editor"));
|
||||
|
||||
Ref<Font> status_bar_font = get_font("status_source", "EditorFonts");
|
||||
error->add_font_override("font", status_bar_font);
|
||||
Ref<Font> status_bar_font = get_theme_font("status_source", "EditorFonts");
|
||||
error->add_theme_font_override("font", status_bar_font);
|
||||
int count = status_bar->get_child_count();
|
||||
for (int i = 0; i < count; i++) {
|
||||
Control *n = Object::cast_to<Control>(status_bar->get_child(i));
|
||||
if (n)
|
||||
n->add_font_override("font", status_bar_font);
|
||||
n->add_theme_font_override("font", status_bar_font);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1516,7 +1516,7 @@ void CodeTextEditor::_set_show_warnings_panel(bool p_show) {
|
|||
}
|
||||
|
||||
void CodeTextEditor::_toggle_scripts_pressed() {
|
||||
toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->toggle_scripts_panel() ? get_icon("Back", "EditorIcons") : get_icon("Forward", "EditorIcons"));
|
||||
toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->toggle_scripts_panel() ? get_theme_icon("Back", "EditorIcons") : get_theme_icon("Forward", "EditorIcons"));
|
||||
}
|
||||
|
||||
void CodeTextEditor::_error_pressed(const Ref<InputEvent> &p_event) {
|
||||
|
|
@ -1540,8 +1540,8 @@ void CodeTextEditor::_notification(int p_what) {
|
|||
_update_font();
|
||||
} break;
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
warning_button->set_icon(get_icon("NodeWarning", "EditorIcons"));
|
||||
add_constant_override("separation", 4 * EDSCALE);
|
||||
warning_button->set_icon(get_theme_icon("NodeWarning", "EditorIcons"));
|
||||
add_theme_constant_override("separation", 4 * EDSCALE);
|
||||
} break;
|
||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||
if (toggle_scripts_button->is_visible()) {
|
||||
|
|
@ -1650,7 +1650,7 @@ void CodeTextEditor::show_toggle_scripts_button() {
|
|||
}
|
||||
|
||||
void CodeTextEditor::update_toggle_scripts_button() {
|
||||
toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? get_icon("Back", "EditorIcons") : get_icon("Forward", "EditorIcons"));
|
||||
toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? get_theme_icon("Back", "EditorIcons") : get_theme_icon("Forward", "EditorIcons"));
|
||||
toggle_scripts_button->set_tooltip(TTR("Toggle Scripts Panel") + " (" + ED_GET_SHORTCUT("script_editor/toggle_scripts_panel")->get_as_text() + ")");
|
||||
}
|
||||
|
||||
|
|
@ -1729,8 +1729,8 @@ CodeTextEditor::CodeTextEditor() {
|
|||
warning_count_label->set_default_cursor_shape(CURSOR_POINTING_HAND);
|
||||
warning_count_label->set_mouse_filter(MOUSE_FILTER_STOP);
|
||||
warning_count_label->set_tooltip(TTR("Warnings"));
|
||||
warning_count_label->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("warning_color", "Editor"));
|
||||
warning_count_label->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts"));
|
||||
warning_count_label->add_theme_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_theme_color("warning_color", "Editor"));
|
||||
warning_count_label->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font("status_source", "EditorFonts"));
|
||||
warning_count_label->connect("gui_input", callable_mp(this, &CodeTextEditor::_warning_label_gui_input));
|
||||
|
||||
is_warnings_panel_opened = false;
|
||||
|
|
@ -1740,7 +1740,7 @@ CodeTextEditor::CodeTextEditor() {
|
|||
line_and_col_txt = memnew(Label);
|
||||
status_bar->add_child(line_and_col_txt);
|
||||
line_and_col_txt->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER);
|
||||
line_and_col_txt->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts"));
|
||||
line_and_col_txt->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font("status_source", "EditorFonts"));
|
||||
line_and_col_txt->set_tooltip(TTR("Line and column numbers."));
|
||||
line_and_col_txt->set_mouse_filter(MOUSE_FILTER_STOP);
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ void ConnectDialog::ok_pressed() {
|
|||
|
||||
if (dst_method->get_text() == "") {
|
||||
error->set_text(TTR("Method in target node must be specified."));
|
||||
error->popup_centered_minsize();
|
||||
error->popup_centered();
|
||||
return;
|
||||
}
|
||||
Node *target = tree->get_selected();
|
||||
|
|
@ -125,7 +125,7 @@ void ConnectDialog::ok_pressed() {
|
|||
if (target->get_script().is_null()) {
|
||||
if (!target->has_method(dst_method->get_text())) {
|
||||
error->set_text(TTR("Target method not found. Specify a valid method or attach a script to the target node."));
|
||||
error->popup_centered_minsize();
|
||||
error->popup_centered();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -341,7 +341,7 @@ void ConnectDialog::init(ConnectionData c, bool bEdit) {
|
|||
void ConnectDialog::popup_dialog(const String &p_for_signal) {
|
||||
|
||||
from_signal->set_text(p_for_signal);
|
||||
error_label->add_color_override("font_color", get_color("error_color", "Editor"));
|
||||
error_label->add_theme_color_override("font_color", error_label->get_theme_color("error_color", "Editor"));
|
||||
if (!advanced->is_pressed())
|
||||
error_label->set_visible(!_find_first_script(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root()));
|
||||
|
||||
|
|
@ -351,14 +351,14 @@ void ConnectDialog::popup_dialog(const String &p_for_signal) {
|
|||
void ConnectDialog::_advanced_pressed() {
|
||||
|
||||
if (advanced->is_pressed()) {
|
||||
set_custom_minimum_size(Size2(900, 500) * EDSCALE);
|
||||
set_min_size(Size2(900, 500) * EDSCALE);
|
||||
connect_to_label->set_text(TTR("Connect to Node:"));
|
||||
tree->set_connect_to_script_mode(false);
|
||||
|
||||
vbc_right->show();
|
||||
error_label->hide();
|
||||
} else {
|
||||
set_custom_minimum_size(Size2(600, 500) * EDSCALE);
|
||||
set_min_size(Size2(600, 500) * EDSCALE);
|
||||
set_size(Size2());
|
||||
connect_to_label->set_text(TTR("Connect to Script:"));
|
||||
tree->set_connect_to_script_mode(true);
|
||||
|
|
@ -369,23 +369,23 @@ void ConnectDialog::_advanced_pressed() {
|
|||
|
||||
_update_ok_enabled();
|
||||
|
||||
set_position((get_viewport_rect().size - get_custom_minimum_size()) / 2);
|
||||
popup_centered();
|
||||
}
|
||||
|
||||
ConnectDialog::ConnectDialog() {
|
||||
|
||||
set_custom_minimum_size(Size2(600, 500) * EDSCALE);
|
||||
set_min_size(Size2(600, 500) * EDSCALE);
|
||||
|
||||
VBoxContainer *vbc = memnew(VBoxContainer);
|
||||
add_child(vbc);
|
||||
|
||||
HBoxContainer *main_hb = memnew(HBoxContainer);
|
||||
vbc->add_child(main_hb);
|
||||
main_hb->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
main_hb->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
VBoxContainer *vbc_left = memnew(VBoxContainer);
|
||||
main_hb->add_child(vbc_left);
|
||||
vbc_left->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
vbc_left->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
from_signal = memnew(LineEdit);
|
||||
from_signal->set_editable(false);
|
||||
|
|
@ -407,13 +407,13 @@ ConnectDialog::ConnectDialog() {
|
|||
|
||||
vbc_right = memnew(VBoxContainer);
|
||||
main_hb->add_child(vbc_right);
|
||||
vbc_right->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
vbc_right->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
vbc_right->hide();
|
||||
|
||||
HBoxContainer *add_bind_hb = memnew(HBoxContainer);
|
||||
|
||||
type_list = memnew(OptionButton);
|
||||
type_list->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
type_list->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
add_bind_hb->add_child(type_list);
|
||||
type_list->add_item("bool", Variant::BOOL);
|
||||
type_list->add_item("int", Variant::INT);
|
||||
|
|
@ -451,7 +451,7 @@ ConnectDialog::ConnectDialog() {
|
|||
vbc_left->add_margin_child(TTR("Receiver Method:"), dstm_hb);
|
||||
|
||||
dst_method = memnew(LineEdit);
|
||||
dst_method->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
dst_method->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
dst_method->connect("text_entered", callable_mp(this, &ConnectDialog::_text_entered));
|
||||
dstm_hb->add_child(dst_method);
|
||||
|
||||
|
|
@ -477,8 +477,6 @@ ConnectDialog::ConnectDialog() {
|
|||
oneshot->set_tooltip(TTR("Disconnects the signal after its first emission."));
|
||||
vbc_right->add_child(oneshot);
|
||||
|
||||
set_as_toplevel(true);
|
||||
|
||||
cdbinds = memnew(ConnectDialogBinds);
|
||||
|
||||
error = memnew(AcceptDialog);
|
||||
|
|
@ -499,7 +497,7 @@ ConnectDialog::~ConnectDialog() {
|
|||
Control *ConnectionsDockTree::make_custom_tooltip(const String &p_text) const {
|
||||
|
||||
EditorHelpBit *help_bit = memnew(EditorHelpBit);
|
||||
help_bit->add_style_override("panel", get_stylebox("panel", "TooltipPanel"));
|
||||
help_bit->add_theme_style_override("panel", get_theme_stylebox("panel", "TooltipPanel"));
|
||||
help_bit->get_rich_text()->set_fixed_size_to_width(360 * EDSCALE);
|
||||
|
||||
String text = TTR("Signal:") + " [u][b]" + p_text.get_slice("::", 0) + "[/b][/u]";
|
||||
|
|
@ -909,21 +907,21 @@ void ConnectionsDock::update_tree() {
|
|||
else
|
||||
name = scr->get_class();
|
||||
|
||||
if (has_icon(scr->get_class(), "EditorIcons")) {
|
||||
icon = get_icon(scr->get_class(), "EditorIcons");
|
||||
if (has_theme_icon(scr->get_class(), "EditorIcons")) {
|
||||
icon = get_theme_icon(scr->get_class(), "EditorIcons");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
ClassDB::get_signal_list(base, &node_signals2, true);
|
||||
if (has_icon(base, "EditorIcons")) {
|
||||
icon = get_icon(base, "EditorIcons");
|
||||
if (has_theme_icon(base, "EditorIcons")) {
|
||||
icon = get_theme_icon(base, "EditorIcons");
|
||||
}
|
||||
name = base;
|
||||
}
|
||||
|
||||
if (!icon.is_valid()) {
|
||||
icon = get_icon("Object", "EditorIcons");
|
||||
icon = get_theme_icon("Object", "EditorIcons");
|
||||
}
|
||||
|
||||
TreeItem *pitem = NULL;
|
||||
|
|
@ -934,7 +932,7 @@ void ConnectionsDock::update_tree() {
|
|||
pitem->set_icon(0, icon);
|
||||
pitem->set_selectable(0, false);
|
||||
pitem->set_editable(0, false);
|
||||
pitem->set_custom_bg_color(0, get_color("prop_subsection", "Editor"));
|
||||
pitem->set_custom_bg_color(0, get_theme_color("prop_subsection", "Editor"));
|
||||
node_signals2.sort();
|
||||
}
|
||||
|
||||
|
|
@ -970,7 +968,7 @@ void ConnectionsDock::update_tree() {
|
|||
sinfo["name"] = signal_name;
|
||||
sinfo["args"] = argnames;
|
||||
item->set_metadata(0, sinfo);
|
||||
item->set_icon(0, get_icon("Signal", "EditorIcons"));
|
||||
item->set_icon(0, get_theme_icon("Signal", "EditorIcons"));
|
||||
|
||||
// Set tooltip with the signal's documentation.
|
||||
{
|
||||
|
|
@ -1045,7 +1043,7 @@ void ConnectionsDock::update_tree() {
|
|||
item2->set_text(0, path);
|
||||
Connection cd = c;
|
||||
item2->set_metadata(0, cd);
|
||||
item2->set_icon(0, get_icon("Slot", "EditorIcons"));
|
||||
item2->set_icon(0, get_theme_icon("Slot", "EditorIcons"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1072,7 +1070,7 @@ ConnectionsDock::ConnectionsDock(EditorNode *p_editor) {
|
|||
tree->set_select_mode(Tree::SELECT_ROW);
|
||||
tree->set_hide_root(true);
|
||||
vbc->add_child(tree);
|
||||
tree->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
tree->set_allow_rmb_select(true);
|
||||
|
||||
connect_button = memnew(Button);
|
||||
|
|
@ -1083,11 +1081,9 @@ ConnectionsDock::ConnectionsDock(EditorNode *p_editor) {
|
|||
connect_button->connect("pressed", callable_mp(this, &ConnectionsDock::_connect_pressed));
|
||||
|
||||
connect_dialog = memnew(ConnectDialog);
|
||||
connect_dialog->set_as_toplevel(true);
|
||||
add_child(connect_dialog);
|
||||
|
||||
disconnect_all_dialog = memnew(ConfirmationDialog);
|
||||
disconnect_all_dialog->set_as_toplevel(true);
|
||||
add_child(disconnect_all_dialog);
|
||||
disconnect_all_dialog->connect("confirmed", callable_mp(this, &ConnectionsDock::_disconnect_all));
|
||||
disconnect_all_dialog->set_text(TTR("Are you sure you want to remove all connections from this signal?"));
|
||||
|
|
@ -1110,7 +1106,7 @@ ConnectionsDock::ConnectionsDock(EditorNode *p_editor) {
|
|||
tree->connect("item_activated", callable_mp(this, &ConnectionsDock::_tree_item_activated));
|
||||
tree->connect("item_rmb_selected", callable_mp(this, &ConnectionsDock::_rmb_pressed));
|
||||
|
||||
add_constant_override("separation", 3 * EDSCALE);
|
||||
add_theme_constant_override("separation", 3 * EDSCALE);
|
||||
}
|
||||
|
||||
ConnectionsDock::~ConnectionsDock() {
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ void CreateDialog::add_type(const String &p_type, HashMap<String, TreeItem *> &p
|
|||
item->set_text(0, p_type + " (" + ScriptServer::get_global_class_path(p_type).get_file() + ")");
|
||||
}
|
||||
if (!can_instance) {
|
||||
item->set_custom_color(0, get_color("disabled_font_color", "Editor"));
|
||||
item->set_custom_color(0, search_options->get_theme_color("disabled_font_color", "Editor"));
|
||||
item->set_selectable(0, false);
|
||||
} else if (!(*to_select && (*to_select)->get_text(0) == search_box->get_text())) {
|
||||
String search_term = search_box->get_text().to_lower();
|
||||
|
|
@ -310,8 +310,8 @@ void CreateDialog::_update_search() {
|
|||
EditorData &ed = EditorNode::get_editor_data();
|
||||
|
||||
root->set_text(0, base_type);
|
||||
if (has_icon(base_type, "EditorIcons")) {
|
||||
root->set_icon(0, get_icon(base_type, "EditorIcons"));
|
||||
if (search_options->has_theme_icon(base_type, "EditorIcons")) {
|
||||
root->set_icon(0, search_options->get_theme_icon(base_type, "EditorIcons"));
|
||||
}
|
||||
|
||||
TreeItem *to_select = search_box->get_text() == base_type ? root : NULL;
|
||||
|
|
@ -460,23 +460,22 @@ void CreateDialog::_notification(int p_what) {
|
|||
switch (p_what) {
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
connect("confirmed", callable_mp(this, &CreateDialog::_confirmed));
|
||||
search_box->set_right_icon(get_icon("Search", "EditorIcons"));
|
||||
search_box->set_right_icon(search_options->get_theme_icon("Search", "EditorIcons"));
|
||||
search_box->set_clear_button_enabled(true);
|
||||
favorite->set_icon(get_icon("Favorites", "EditorIcons"));
|
||||
favorite->set_icon(search_options->get_theme_icon("Favorites", "EditorIcons"));
|
||||
} break;
|
||||
case NOTIFICATION_EXIT_TREE: {
|
||||
disconnect("confirmed", callable_mp(this, &CreateDialog::_confirmed));
|
||||
} break;
|
||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||
if (is_visible_in_tree()) {
|
||||
if (is_visible()) {
|
||||
search_box->call_deferred("grab_focus"); // still not visible
|
||||
search_box->select_all();
|
||||
} else {
|
||||
EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "create_new_node", Rect2(get_position(), get_size()));
|
||||
search_loaded_scripts.clear();
|
||||
}
|
||||
} break;
|
||||
case NOTIFICATION_POPUP_HIDE: {
|
||||
EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "create_new_node", get_rect());
|
||||
search_loaded_scripts.clear();
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -562,7 +561,7 @@ void CreateDialog::_item_selected() {
|
|||
}
|
||||
|
||||
void CreateDialog::_hide_requested() {
|
||||
_closed(); // From WindowDialog.
|
||||
_cancel_pressed(); // From AcceptDialog.
|
||||
}
|
||||
|
||||
void CreateDialog::_favorite_toggled() {
|
||||
|
|
@ -662,7 +661,7 @@ Variant CreateDialog::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
|
|||
ToolButton *tb = memnew(ToolButton);
|
||||
tb->set_icon(ti->get_icon(0));
|
||||
tb->set_text(ti->get_text(0));
|
||||
set_drag_preview(tb);
|
||||
favorites->set_drag_preview(tb);
|
||||
|
||||
return d;
|
||||
}
|
||||
|
|
@ -743,8 +742,6 @@ CreateDialog::CreateDialog() {
|
|||
|
||||
is_replace_mode = false;
|
||||
|
||||
set_resizable(true);
|
||||
|
||||
HSplitContainer *hsc = memnew(HSplitContainer);
|
||||
add_child(hsc);
|
||||
|
||||
|
|
@ -754,7 +751,7 @@ CreateDialog::CreateDialog() {
|
|||
VBoxContainer *fav_vb = memnew(VBoxContainer);
|
||||
vsc->add_child(fav_vb);
|
||||
fav_vb->set_custom_minimum_size(Size2(150, 100) * EDSCALE);
|
||||
fav_vb->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
fav_vb->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
favorites = memnew(Tree);
|
||||
fav_vb->add_margin_child(TTR("Favorites:"), favorites, true);
|
||||
|
|
@ -763,13 +760,16 @@ CreateDialog::CreateDialog() {
|
|||
favorites->set_allow_reselect(true);
|
||||
favorites->connect("cell_selected", callable_mp(this, &CreateDialog::_favorite_selected));
|
||||
favorites->connect("item_activated", callable_mp(this, &CreateDialog::_favorite_activated));
|
||||
favorites->set_drag_forwarding(this);
|
||||
favorites->add_constant_override("draw_guides", 1);
|
||||
#ifndef _MSC_VER
|
||||
#warning cant forward drag data to a non control, must be fixed
|
||||
#endif
|
||||
//favorites->set_drag_forwarding(this);
|
||||
favorites->add_theme_constant_override("draw_guides", 1);
|
||||
|
||||
VBoxContainer *rec_vb = memnew(VBoxContainer);
|
||||
vsc->add_child(rec_vb);
|
||||
rec_vb->set_custom_minimum_size(Size2(150, 100) * EDSCALE);
|
||||
rec_vb->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
rec_vb->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
recent = memnew(Tree);
|
||||
rec_vb->add_margin_child(TTR("Recent:"), recent, true);
|
||||
|
|
@ -778,15 +778,15 @@ CreateDialog::CreateDialog() {
|
|||
recent->set_allow_reselect(true);
|
||||
recent->connect("cell_selected", callable_mp(this, &CreateDialog::_history_selected));
|
||||
recent->connect("item_activated", callable_mp(this, &CreateDialog::_history_activated));
|
||||
recent->add_constant_override("draw_guides", 1);
|
||||
recent->add_theme_constant_override("draw_guides", 1);
|
||||
|
||||
VBoxContainer *vbc = memnew(VBoxContainer);
|
||||
hsc->add_child(vbc);
|
||||
vbc->set_custom_minimum_size(Size2(300, 0) * EDSCALE);
|
||||
vbc->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
vbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
HBoxContainer *search_hb = memnew(HBoxContainer);
|
||||
search_box = memnew(LineEdit);
|
||||
search_box->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
search_hb->add_child(search_box);
|
||||
favorite = memnew(Button);
|
||||
favorite->set_flat(true);
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ EditorDebuggerNode::EditorDebuggerNode() {
|
|||
if (!singleton)
|
||||
singleton = this;
|
||||
|
||||
add_constant_override("margin_left", -EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT));
|
||||
add_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT));
|
||||
add_theme_constant_override("margin_left", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT));
|
||||
add_theme_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT));
|
||||
|
||||
tabs = memnew(TabContainer);
|
||||
tabs->set_tab_align(TabContainer::ALIGN_LEFT);
|
||||
|
|
@ -64,7 +64,7 @@ EditorDebuggerNode::EditorDebuggerNode() {
|
|||
|
||||
Ref<StyleBoxEmpty> empty;
|
||||
empty.instance();
|
||||
tabs->add_style_override("panel", empty);
|
||||
tabs->add_theme_style_override("panel", empty);
|
||||
|
||||
auto_switch_remote_scene_tree = EDITOR_DEF("debugger/auto_switch_to_remote_scene_tree", false);
|
||||
_add_debugger();
|
||||
|
|
@ -110,7 +110,7 @@ ScriptEditorDebugger *EditorDebuggerNode::_add_debugger() {
|
|||
if (tabs->get_tab_count() > 1) {
|
||||
node->clear_style();
|
||||
tabs->set_tabs_visible(true);
|
||||
tabs->add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles"));
|
||||
tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("DebuggerPanel", "EditorStyles"));
|
||||
}
|
||||
|
||||
return node;
|
||||
|
|
@ -223,10 +223,10 @@ void EditorDebuggerNode::_notification(int p_what) {
|
|||
} break;
|
||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||
if (tabs->get_tab_count() > 1) {
|
||||
add_constant_override("margin_left", -EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT));
|
||||
add_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT));
|
||||
add_theme_constant_override("margin_left", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT));
|
||||
add_theme_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT));
|
||||
|
||||
tabs->add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles"));
|
||||
tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("DebuggerPanel", "EditorStyles"));
|
||||
}
|
||||
} break;
|
||||
default:
|
||||
|
|
@ -262,9 +262,9 @@ void EditorDebuggerNode::_notification(int p_what) {
|
|||
} else {
|
||||
debugger_button->set_text(TTR("Debugger") + " (" + itos(error_count + warning_count) + ")");
|
||||
if (error_count == 0) {
|
||||
debugger_button->set_icon(get_icon("Warning", "EditorIcons"));
|
||||
debugger_button->set_icon(get_theme_icon("Warning", "EditorIcons"));
|
||||
} else {
|
||||
debugger_button->set_icon(get_icon("Error", "EditorIcons"));
|
||||
debugger_button->set_icon(get_theme_icon("Error", "EditorIcons"));
|
||||
}
|
||||
}
|
||||
last_error_count = error_count;
|
||||
|
|
@ -371,7 +371,6 @@ void EditorDebuggerNode::set_script_debug_button(MenuButton *p_button) {
|
|||
script_menu->set_text(TTR("Debug"));
|
||||
script_menu->set_switch_on_hover(true);
|
||||
PopupMenu *p = script_menu->get_popup();
|
||||
p->set_hide_on_window_lose_focus(true);
|
||||
p->add_shortcut(ED_GET_SHORTCUT("debugger/step_into"), DEBUG_STEP);
|
||||
p->add_shortcut(ED_GET_SHORTCUT("debugger/step_over"), DEBUG_NEXT);
|
||||
p->add_separator();
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include "editor/editor_node.h"
|
||||
#include "scene/debugger/scene_debugger.h"
|
||||
#include "scene/resources/packed_scene.h"
|
||||
#include "servers/display_server.h"
|
||||
|
||||
EditorDebuggerTree::EditorDebuggerTree() {
|
||||
set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
|
|
@ -106,9 +107,9 @@ void EditorDebuggerTree::_scene_tree_rmb_selected(const Vector2 &p_position) {
|
|||
item->select(0);
|
||||
|
||||
item_menu->clear();
|
||||
item_menu->add_icon_item(get_icon("CreateNewSceneFrom", "EditorIcons"), TTR("Save Branch as Scene"), ITEM_MENU_SAVE_REMOTE_NODE);
|
||||
item_menu->add_icon_item(get_icon("CopyNodePath", "EditorIcons"), TTR("Copy Node Path"), ITEM_MENU_COPY_NODE_PATH);
|
||||
item_menu->set_global_position(get_global_mouse_position());
|
||||
item_menu->add_icon_item(get_theme_icon("CreateNewSceneFrom", "EditorIcons"), TTR("Save Branch as Scene"), ITEM_MENU_SAVE_REMOTE_NODE);
|
||||
item_menu->add_icon_item(get_theme_icon("CopyNodePath", "EditorIcons"), TTR("Copy Node Path"), ITEM_MENU_COPY_NODE_PATH);
|
||||
item_menu->set_position(get_screen_transform().xform(get_local_mouse_position()));
|
||||
item_menu->popup();
|
||||
}
|
||||
|
||||
|
|
@ -229,7 +230,7 @@ void EditorDebuggerTree::_item_menu_id_pressed(int p_option) {
|
|||
case ITEM_MENU_SAVE_REMOTE_NODE: {
|
||||
|
||||
file_dialog->set_access(EditorFileDialog::ACCESS_RESOURCES);
|
||||
file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE);
|
||||
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
|
||||
|
||||
List<String> extensions;
|
||||
Ref<PackedScene> sd = memnew(PackedScene);
|
||||
|
|
@ -257,7 +258,7 @@ void EditorDebuggerTree::_item_menu_id_pressed(int p_option) {
|
|||
text = text.substr(slash + 1);
|
||||
}
|
||||
}
|
||||
OS::get_singleton()->set_clipboard(text);
|
||||
DisplayServer::get_singleton()->clipboard_set(text);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,14 +41,14 @@ void EditorNetworkProfiler::_bind_methods() {
|
|||
void EditorNetworkProfiler::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
activate->set_icon(get_icon("Play", "EditorIcons"));
|
||||
clear_button->set_icon(get_icon("Clear", "EditorIcons"));
|
||||
incoming_bandwidth_text->set_right_icon(get_icon("ArrowDown", "EditorIcons"));
|
||||
outgoing_bandwidth_text->set_right_icon(get_icon("ArrowUp", "EditorIcons"));
|
||||
activate->set_icon(get_theme_icon("Play", "EditorIcons"));
|
||||
clear_button->set_icon(get_theme_icon("Clear", "EditorIcons"));
|
||||
incoming_bandwidth_text->set_right_icon(get_theme_icon("ArrowDown", "EditorIcons"));
|
||||
outgoing_bandwidth_text->set_right_icon(get_theme_icon("ArrowUp", "EditorIcons"));
|
||||
|
||||
// This needs to be done here to set the faded color when the profiler is first opened
|
||||
incoming_bandwidth_text->add_color_override("font_color_uneditable", get_color("font_color", "Editor") * Color(1, 1, 1, 0.5));
|
||||
outgoing_bandwidth_text->add_color_override("font_color_uneditable", get_color("font_color", "Editor") * Color(1, 1, 1, 0.5));
|
||||
incoming_bandwidth_text->add_theme_color_override("font_color_uneditable", get_theme_color("font_color", "Editor") * Color(1, 1, 1, 0.5));
|
||||
outgoing_bandwidth_text->add_theme_color_override("font_color_uneditable", get_theme_color("font_color", "Editor") * Color(1, 1, 1, 0.5));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -77,10 +77,10 @@ void EditorNetworkProfiler::_update_frame() {
|
|||
void EditorNetworkProfiler::_activate_pressed() {
|
||||
|
||||
if (activate->is_pressed()) {
|
||||
activate->set_icon(get_icon("Stop", "EditorIcons"));
|
||||
activate->set_icon(get_theme_icon("Stop", "EditorIcons"));
|
||||
activate->set_text(TTR("Stop"));
|
||||
} else {
|
||||
activate->set_icon(get_icon("Play", "EditorIcons"));
|
||||
activate->set_icon(get_theme_icon("Play", "EditorIcons"));
|
||||
activate->set_text(TTR("Start"));
|
||||
}
|
||||
emit_signal("enable_profiling", activate->is_pressed());
|
||||
|
|
@ -118,12 +118,12 @@ void EditorNetworkProfiler::set_bandwidth(int p_incoming, int p_outgoing) {
|
|||
outgoing_bandwidth_text->set_text(vformat(TTR("%s/s"), String::humanize_size(p_outgoing)));
|
||||
|
||||
// Make labels more prominent when the bandwidth is greater than 0 to attract user attention
|
||||
incoming_bandwidth_text->add_color_override(
|
||||
incoming_bandwidth_text->add_theme_color_override(
|
||||
"font_color_uneditable",
|
||||
get_color("font_color", "Editor") * Color(1, 1, 1, p_incoming > 0 ? 1 : 0.5));
|
||||
outgoing_bandwidth_text->add_color_override(
|
||||
get_theme_color("font_color", "Editor") * Color(1, 1, 1, p_incoming > 0 ? 1 : 0.5));
|
||||
outgoing_bandwidth_text->add_theme_color_override(
|
||||
"font_color_uneditable",
|
||||
get_color("font_color", "Editor") * Color(1, 1, 1, p_outgoing > 0 ? 1 : 0.5));
|
||||
get_theme_color("font_color", "Editor") * Color(1, 1, 1, p_outgoing > 0 ? 1 : 0.5));
|
||||
}
|
||||
|
||||
bool EditorNetworkProfiler::is_profiling() {
|
||||
|
|
@ -133,7 +133,7 @@ bool EditorNetworkProfiler::is_profiling() {
|
|||
EditorNetworkProfiler::EditorNetworkProfiler() {
|
||||
|
||||
HBoxContainer *hb = memnew(HBoxContainer);
|
||||
hb->add_constant_override("separation", 8 * EDSCALE);
|
||||
hb->add_theme_constant_override("separation", 8 * EDSCALE);
|
||||
add_child(hb);
|
||||
|
||||
activate = memnew(Button);
|
||||
|
|
|
|||
|
|
@ -132,11 +132,11 @@ String EditorProfiler::_get_time_as_text(const Metric &m, float p_time, int p_ca
|
|||
|
||||
Color EditorProfiler::_get_color_from_signature(const StringName &p_signature) const {
|
||||
|
||||
Color bc = get_color("error_color", "Editor");
|
||||
Color bc = get_theme_color("error_color", "Editor");
|
||||
double rot = ABS(double(p_signature.hash()) / double(0x7FFFFFFF));
|
||||
Color c;
|
||||
c.set_hsv(rot, bc.get_s(), bc.get_v());
|
||||
return c.linear_interpolate(get_color("base_color", "Editor"), 0.07);
|
||||
return c.linear_interpolate(get_theme_color("base_color", "Editor"), 0.07);
|
||||
}
|
||||
|
||||
void EditorProfiler::_item_edited() {
|
||||
|
|
@ -176,7 +176,7 @@ void EditorProfiler::_update_plot() {
|
|||
}
|
||||
|
||||
uint8_t *wr = graph_image.ptrw();
|
||||
const Color background_color = get_color("dark_color_2", "Editor");
|
||||
const Color background_color = get_theme_color("dark_color_2", "Editor");
|
||||
|
||||
// Clear the previous frame and set the background color.
|
||||
for (int i = 0; i < desired_len; i += 4) {
|
||||
|
|
@ -420,10 +420,10 @@ void EditorProfiler::_update_frame() {
|
|||
void EditorProfiler::_activate_pressed() {
|
||||
|
||||
if (activate->is_pressed()) {
|
||||
activate->set_icon(get_icon("Stop", "EditorIcons"));
|
||||
activate->set_icon(get_theme_icon("Stop", "EditorIcons"));
|
||||
activate->set_text(TTR("Stop"));
|
||||
} else {
|
||||
activate->set_icon(get_icon("Play", "EditorIcons"));
|
||||
activate->set_icon(get_theme_icon("Play", "EditorIcons"));
|
||||
activate->set_text(TTR("Start"));
|
||||
}
|
||||
emit_signal("enable_profiling", activate->is_pressed());
|
||||
|
|
@ -438,8 +438,8 @@ void EditorProfiler::_clear_pressed() {
|
|||
void EditorProfiler::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||
activate->set_icon(get_icon("Play", "EditorIcons"));
|
||||
clear_button->set_icon(get_icon("Clear", "EditorIcons"));
|
||||
activate->set_icon(get_theme_icon("Play", "EditorIcons"));
|
||||
clear_button->set_icon(get_theme_icon("Clear", "EditorIcons"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -712,7 +712,7 @@ EditorProfiler::EditorProfiler() {
|
|||
hb->add_child(cursor_metric_edit);
|
||||
cursor_metric_edit->connect("value_changed", callable_mp(this, &EditorProfiler::_cursor_metric_changed));
|
||||
|
||||
hb->add_constant_override("separation", 8 * EDSCALE);
|
||||
hb->add_theme_constant_override("separation", 8 * EDSCALE);
|
||||
|
||||
h_split = memnew(HSplitContainer);
|
||||
add_child(h_split);
|
||||
|
|
|
|||
|
|
@ -128,11 +128,11 @@ String EditorVisualProfiler::_get_time_as_text(float p_time) {
|
|||
|
||||
Color EditorVisualProfiler::_get_color_from_signature(const StringName &p_signature) const {
|
||||
|
||||
Color bc = get_color("error_color", "Editor");
|
||||
Color bc = get_theme_color("error_color", "Editor");
|
||||
double rot = ABS(double(p_signature.hash()) / double(0x7FFFFFFF));
|
||||
Color c;
|
||||
c.set_hsv(rot, bc.get_s(), bc.get_v());
|
||||
return c.linear_interpolate(get_color("base_color", "Editor"), 0.07);
|
||||
return c.linear_interpolate(get_theme_color("base_color", "Editor"), 0.07);
|
||||
}
|
||||
|
||||
void EditorVisualProfiler::_item_selected() {
|
||||
|
|
@ -327,7 +327,7 @@ void EditorVisualProfiler::_update_frame(bool p_focus_selected) {
|
|||
|
||||
int cursor_metric = _get_cursor_index();
|
||||
|
||||
Ref<Texture> track_icon = get_icon("TrackColor", "EditorIcons");
|
||||
Ref<Texture> track_icon = get_theme_icon("TrackColor", "EditorIcons");
|
||||
|
||||
ERR_FAIL_INDEX(cursor_metric, frame_metrics.size());
|
||||
|
||||
|
|
@ -418,11 +418,11 @@ void EditorVisualProfiler::_update_frame(bool p_focus_selected) {
|
|||
void EditorVisualProfiler::_activate_pressed() {
|
||||
|
||||
if (activate->is_pressed()) {
|
||||
activate->set_icon(get_icon("Stop", "EditorIcons"));
|
||||
activate->set_icon(get_theme_icon("Stop", "EditorIcons"));
|
||||
activate->set_text(TTR("Stop"));
|
||||
_clear_pressed(); //always clear on start
|
||||
} else {
|
||||
activate->set_icon(get_icon("Play", "EditorIcons"));
|
||||
activate->set_icon(get_theme_icon("Play", "EditorIcons"));
|
||||
activate->set_text(TTR("Start"));
|
||||
}
|
||||
emit_signal("enable_profiling", activate->is_pressed());
|
||||
|
|
@ -437,8 +437,8 @@ void EditorVisualProfiler::_clear_pressed() {
|
|||
void EditorVisualProfiler::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||
activate->set_icon(get_icon("Play", "EditorIcons"));
|
||||
clear_button->set_icon(get_icon("Clear", "EditorIcons"));
|
||||
activate->set_icon(get_theme_icon("Play", "EditorIcons"));
|
||||
clear_button->set_icon(get_theme_icon("Clear", "EditorIcons"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -446,7 +446,7 @@ void EditorVisualProfiler::_graph_tex_draw() {
|
|||
|
||||
if (last_metric < 0)
|
||||
return;
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
if (seeking) {
|
||||
|
||||
int max_frames = frame_metrics.size();
|
||||
|
|
@ -777,7 +777,7 @@ EditorVisualProfiler::EditorVisualProfiler() {
|
|||
hb->add_child(cursor_metric_edit);
|
||||
cursor_metric_edit->connect("value_changed", callable_mp(this, &EditorVisualProfiler::_cursor_metric_changed));
|
||||
|
||||
hb->add_constant_override("separation", 8 * EDSCALE);
|
||||
hb->add_theme_constant_override("separation", 8 * EDSCALE);
|
||||
|
||||
h_split = memnew(HSplitContainer);
|
||||
add_child(h_split);
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@
|
|||
#include "scene/gui/texture_button.h"
|
||||
#include "scene/gui/tree.h"
|
||||
#include "scene/resources/packed_scene.h"
|
||||
#include "servers/display_server.h"
|
||||
|
||||
using CameraOverride = EditorDebuggerNode::CameraOverride;
|
||||
|
||||
|
|
@ -73,15 +74,15 @@ void ScriptEditorDebugger::_put_msg(String p_message, Array p_data) {
|
|||
void ScriptEditorDebugger::debug_copy() {
|
||||
String msg = reason->get_text();
|
||||
if (msg == "") return;
|
||||
OS::get_singleton()->set_clipboard(msg);
|
||||
DisplayServer::get_singleton()->clipboard_set(msg);
|
||||
}
|
||||
|
||||
void ScriptEditorDebugger::debug_skip_breakpoints() {
|
||||
skip_breakpoints_value = !skip_breakpoints_value;
|
||||
if (skip_breakpoints_value)
|
||||
skip_breakpoints->set_icon(get_icon("DebugSkipBreakpointsOn", "EditorIcons"));
|
||||
skip_breakpoints->set_icon(get_theme_icon("DebugSkipBreakpointsOn", "EditorIcons"));
|
||||
else
|
||||
skip_breakpoints->set_icon(get_icon("DebugSkipBreakpointsOff", "EditorIcons"));
|
||||
skip_breakpoints->set_icon(get_theme_icon("DebugSkipBreakpointsOff", "EditorIcons"));
|
||||
|
||||
Array msg;
|
||||
msg.push_back(skip_breakpoints_value);
|
||||
|
|
@ -116,7 +117,7 @@ void ScriptEditorDebugger::debug_continue() {
|
|||
|
||||
// Allow focus stealing only if we actually run this client for security.
|
||||
if (remote_pid && EditorNode::get_singleton()->has_child_process(remote_pid))
|
||||
OS::get_singleton()->enable_for_stealing_focus(remote_pid);
|
||||
DisplayServer::get_singleton()->enable_for_stealing_focus(remote_pid);
|
||||
|
||||
_clear_execution();
|
||||
_put_msg("continue", Array());
|
||||
|
|
@ -129,15 +130,15 @@ void ScriptEditorDebugger::update_tabs() {
|
|||
} else {
|
||||
errors_tab->set_name(TTR("Errors") + " (" + itos(error_count + warning_count) + ")");
|
||||
if (error_count == 0) {
|
||||
tabs->set_tab_icon(errors_tab->get_index(), get_icon("Warning", "EditorIcons"));
|
||||
tabs->set_tab_icon(errors_tab->get_index(), get_theme_icon("Warning", "EditorIcons"));
|
||||
} else {
|
||||
tabs->set_tab_icon(errors_tab->get_index(), get_icon("Error", "EditorIcons"));
|
||||
tabs->set_tab_icon(errors_tab->get_index(), get_theme_icon("Error", "EditorIcons"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptEditorDebugger::clear_style() {
|
||||
tabs->add_style_override("panel", NULL);
|
||||
tabs->add_theme_style_override("panel", NULL);
|
||||
}
|
||||
|
||||
void ScriptEditorDebugger::save_node(ObjectID p_id, const String &p_file) {
|
||||
|
|
@ -253,7 +254,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
|
|||
_update_buttons_state();
|
||||
_set_reason_text(error, MESSAGE_ERROR);
|
||||
emit_signal("breaked", true, can_continue);
|
||||
OS::get_singleton()->move_window_to_foreground();
|
||||
DisplayServer::get_singleton()->window_move_to_foreground();
|
||||
if (error != "") {
|
||||
tabs->set_current_tab(0);
|
||||
}
|
||||
|
|
@ -310,8 +311,8 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
|
|||
it->set_text(3, String::humanize_size(bytes));
|
||||
total += bytes;
|
||||
|
||||
if (has_icon(type, "EditorIcons"))
|
||||
it->set_icon(0, get_icon(type, "EditorIcons"));
|
||||
if (has_theme_icon(type, "EditorIcons"))
|
||||
it->set_icon(0, get_theme_icon(type, "EditorIcons"));
|
||||
}
|
||||
|
||||
vmem_total->set_tooltip(TTR("Bytes:") + " " + itos(total));
|
||||
|
|
@ -442,7 +443,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
|
|||
TreeItem *error = error_tree->create_item(r);
|
||||
error->set_collapsed(true);
|
||||
|
||||
error->set_icon(0, get_icon(oe.warning ? "Warning" : "Error", "EditorIcons"));
|
||||
error->set_icon(0, get_theme_icon(oe.warning ? "Warning" : "Error", "EditorIcons"));
|
||||
error->set_text(0, time);
|
||||
error->set_text_align(0, TreeItem::ALIGN_LEFT);
|
||||
|
||||
|
|
@ -660,13 +661,13 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
|
|||
void ScriptEditorDebugger::_set_reason_text(const String &p_reason, MessageType p_type) {
|
||||
switch (p_type) {
|
||||
case MESSAGE_ERROR:
|
||||
reason->add_color_override("font_color", get_color("error_color", "Editor"));
|
||||
reason->add_theme_color_override("font_color", get_theme_color("error_color", "Editor"));
|
||||
break;
|
||||
case MESSAGE_WARNING:
|
||||
reason->add_color_override("font_color", get_color("warning_color", "Editor"));
|
||||
reason->add_theme_color_override("font_color", get_theme_color("warning_color", "Editor"));
|
||||
break;
|
||||
default:
|
||||
reason->add_color_override("font_color", get_color("success_color", "Editor"));
|
||||
reason->add_theme_color_override("font_color", get_theme_color("success_color", "Editor"));
|
||||
}
|
||||
reason->set_text(p_reason);
|
||||
reason->set_tooltip(p_reason.word_wrap(80));
|
||||
|
|
@ -693,8 +694,8 @@ void ScriptEditorDebugger::_performance_draw() {
|
|||
|
||||
info_message->hide();
|
||||
|
||||
Ref<StyleBox> graph_sb = get_stylebox("normal", "TextEdit");
|
||||
Ref<Font> graph_font = get_font("font", "TextEdit");
|
||||
Ref<StyleBox> graph_sb = get_theme_stylebox("normal", "TextEdit");
|
||||
Ref<Font> graph_font = get_theme_font("font", "TextEdit");
|
||||
|
||||
int cols = Math::ceil(Math::sqrt((float)which.size()));
|
||||
int rows = Math::ceil((float)which.size() / cols);
|
||||
|
|
@ -714,7 +715,7 @@ void ScriptEditorDebugger::_performance_draw() {
|
|||
r.position += graph_sb->get_offset();
|
||||
r.size -= graph_sb->get_minimum_size();
|
||||
int pi = which[i];
|
||||
Color c = get_color("accent_color", "Editor");
|
||||
Color c = get_theme_color("accent_color", "Editor");
|
||||
float h = (float)which[i] / (float)(perf_items.size());
|
||||
// Use a darker color on light backgrounds for better visibility
|
||||
float value_multiplier = EditorSettings::get_singleton()->is_dark_theme() ? 1.4 : 0.55;
|
||||
|
|
@ -753,20 +754,20 @@ void ScriptEditorDebugger::_notification(int p_what) {
|
|||
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
|
||||
skip_breakpoints->set_icon(get_icon("DebugSkipBreakpointsOff", "EditorIcons"));
|
||||
copy->set_icon(get_icon("ActionCopy", "EditorIcons"));
|
||||
skip_breakpoints->set_icon(get_theme_icon("DebugSkipBreakpointsOff", "EditorIcons"));
|
||||
copy->set_icon(get_theme_icon("ActionCopy", "EditorIcons"));
|
||||
|
||||
step->set_icon(get_icon("DebugStep", "EditorIcons"));
|
||||
next->set_icon(get_icon("DebugNext", "EditorIcons"));
|
||||
dobreak->set_icon(get_icon("Pause", "EditorIcons"));
|
||||
docontinue->set_icon(get_icon("DebugContinue", "EditorIcons"));
|
||||
step->set_icon(get_theme_icon("DebugStep", "EditorIcons"));
|
||||
next->set_icon(get_theme_icon("DebugNext", "EditorIcons"));
|
||||
dobreak->set_icon(get_theme_icon("Pause", "EditorIcons"));
|
||||
docontinue->set_icon(get_theme_icon("DebugContinue", "EditorIcons"));
|
||||
le_set->connect("pressed", callable_mp(this, &ScriptEditorDebugger::_live_edit_set));
|
||||
le_clear->connect("pressed", callable_mp(this, &ScriptEditorDebugger::_live_edit_clear));
|
||||
error_tree->connect("item_selected", callable_mp(this, &ScriptEditorDebugger::_error_selected));
|
||||
error_tree->connect("item_activated", callable_mp(this, &ScriptEditorDebugger::_error_activated));
|
||||
vmem_refresh->set_icon(get_icon("Reload", "EditorIcons"));
|
||||
vmem_refresh->set_icon(get_theme_icon("Reload", "EditorIcons"));
|
||||
|
||||
reason->add_color_override("font_color", get_color("error_color", "Editor"));
|
||||
reason->add_theme_color_override("font_color", get_theme_color("error_color", "Editor"));
|
||||
|
||||
} break;
|
||||
case NOTIFICATION_PROCESS: {
|
||||
|
|
@ -829,16 +830,16 @@ void ScriptEditorDebugger::_notification(int p_what) {
|
|||
} break;
|
||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||
|
||||
if (tabs->has_stylebox_override("panel")) {
|
||||
tabs->add_style_override("panel", editor->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles"));
|
||||
if (tabs->has_theme_stylebox_override("panel")) {
|
||||
tabs->add_theme_style_override("panel", editor->get_gui_base()->get_theme_stylebox("DebuggerPanel", "EditorStyles"));
|
||||
}
|
||||
|
||||
copy->set_icon(get_icon("ActionCopy", "EditorIcons"));
|
||||
step->set_icon(get_icon("DebugStep", "EditorIcons"));
|
||||
next->set_icon(get_icon("DebugNext", "EditorIcons"));
|
||||
dobreak->set_icon(get_icon("Pause", "EditorIcons"));
|
||||
docontinue->set_icon(get_icon("DebugContinue", "EditorIcons"));
|
||||
vmem_refresh->set_icon(get_icon("Reload", "EditorIcons"));
|
||||
copy->set_icon(get_theme_icon("ActionCopy", "EditorIcons"));
|
||||
step->set_icon(get_theme_icon("DebugStep", "EditorIcons"));
|
||||
next->set_icon(get_theme_icon("DebugNext", "EditorIcons"));
|
||||
dobreak->set_icon(get_theme_icon("Pause", "EditorIcons"));
|
||||
docontinue->set_icon(get_theme_icon("DebugContinue", "EditorIcons"));
|
||||
vmem_refresh->set_icon(get_theme_icon("Reload", "EditorIcons"));
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
|
@ -978,7 +979,7 @@ void ScriptEditorDebugger::_stack_dump_frame_selected() {
|
|||
|
||||
void ScriptEditorDebugger::_export_csv() {
|
||||
|
||||
file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE);
|
||||
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
|
||||
file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
|
||||
file_dialog->popup_centered_ratio();
|
||||
}
|
||||
|
|
@ -1388,7 +1389,7 @@ void ScriptEditorDebugger::_error_tree_item_rmb_selected(const Vector2 &p_pos) {
|
|||
item_menu->set_size(Size2(1, 1));
|
||||
|
||||
if (error_tree->is_anything_selected()) {
|
||||
item_menu->add_icon_item(get_icon("ActionCopy", "EditorIcons"), TTR("Copy Error"), 0);
|
||||
item_menu->add_icon_item(get_theme_icon("ActionCopy", "EditorIcons"), TTR("Copy Error"), 0);
|
||||
}
|
||||
|
||||
if (item_menu->get_item_count() > 0) {
|
||||
|
|
@ -1404,9 +1405,9 @@ void ScriptEditorDebugger::_item_menu_id_pressed(int p_option) {
|
|||
|
||||
String type;
|
||||
|
||||
if (ti->get_icon(0) == get_icon("Warning", "EditorIcons")) {
|
||||
if (ti->get_icon(0) == get_theme_icon("Warning", "EditorIcons")) {
|
||||
type = "W ";
|
||||
} else if (ti->get_icon(0) == get_icon("Error", "EditorIcons")) {
|
||||
} else if (ti->get_icon(0) == get_theme_icon("Error", "EditorIcons")) {
|
||||
type = "E ";
|
||||
}
|
||||
|
||||
|
|
@ -1420,7 +1421,7 @@ void ScriptEditorDebugger::_item_menu_id_pressed(int p_option) {
|
|||
ci = ci->get_next();
|
||||
}
|
||||
|
||||
OS::get_singleton()->set_clipboard(text);
|
||||
DisplayServer::get_singleton()->clipboard_set(text);
|
||||
}
|
||||
|
||||
void ScriptEditorDebugger::_tab_changed(int p_tab) {
|
||||
|
|
@ -1461,7 +1462,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
|
|||
|
||||
tabs = memnew(TabContainer);
|
||||
tabs->set_tab_align(TabContainer::ALIGN_LEFT);
|
||||
tabs->add_style_override("panel", editor->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles"));
|
||||
tabs->add_theme_style_override("panel", editor->get_gui_base()->get_theme_stylebox("DebuggerPanel", "EditorStyles"));
|
||||
tabs->connect("tab_changed", callable_mp(this, &ScriptEditorDebugger::_tab_changed));
|
||||
|
||||
add_child(tabs);
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ void DependencyEditor::_update_list() {
|
|||
|
||||
TreeItem *root = tree->create_item();
|
||||
|
||||
Ref<Texture2D> folder = get_icon("folder", "FileDialog");
|
||||
Ref<Texture2D> folder = tree->get_theme_icon("folder", "FileDialog");
|
||||
|
||||
bool broken = false;
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ DependencyEditor::DependencyEditor() {
|
|||
vb->add_child(hbc);
|
||||
|
||||
MarginContainer *mc = memnew(MarginContainer);
|
||||
mc->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
mc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
mc->add_child(tree);
|
||||
vb->add_child(mc);
|
||||
|
|
@ -264,7 +264,7 @@ DependencyEditor::DependencyEditor() {
|
|||
set_title(TTR("Dependency Editor"));
|
||||
search = memnew(EditorFileDialog);
|
||||
search->connect("file_selected", callable_mp(this, &DependencyEditor::_searched));
|
||||
search->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
search->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
search->set_title(TTR("Search Replacement Resource:"));
|
||||
add_child(search);
|
||||
}
|
||||
|
|
@ -422,17 +422,17 @@ void DependencyRemoveDialog::_build_removed_dependency_tree(const Vector<Removed
|
|||
if (!tree_items.has(rd.dependency_folder)) {
|
||||
TreeItem *folder_item = owners->create_item(owners->get_root());
|
||||
folder_item->set_text(0, rd.dependency_folder);
|
||||
folder_item->set_icon(0, get_icon("Folder", "EditorIcons"));
|
||||
folder_item->set_icon(0, owners->get_theme_icon("Folder", "EditorIcons"));
|
||||
tree_items[rd.dependency_folder] = folder_item;
|
||||
}
|
||||
TreeItem *dependency_item = owners->create_item(tree_items[rd.dependency_folder]);
|
||||
dependency_item->set_text(0, rd.dependency);
|
||||
dependency_item->set_icon(0, get_icon("Warning", "EditorIcons"));
|
||||
dependency_item->set_icon(0, owners->get_theme_icon("Warning", "EditorIcons"));
|
||||
tree_items[rd.dependency] = dependency_item;
|
||||
} else {
|
||||
TreeItem *dependency_item = owners->create_item(owners->get_root());
|
||||
dependency_item->set_text(0, rd.dependency);
|
||||
dependency_item->set_icon(0, get_icon("Warning", "EditorIcons"));
|
||||
dependency_item->set_icon(0, owners->get_theme_icon("Warning", "EditorIcons"));
|
||||
tree_items[rd.dependency] = dependency_item;
|
||||
}
|
||||
}
|
||||
|
|
@ -580,7 +580,7 @@ DependencyRemoveDialog::DependencyRemoveDialog() {
|
|||
owners = memnew(Tree);
|
||||
owners->set_hide_root(true);
|
||||
vb->add_child(owners);
|
||||
owners->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
owners->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
}
|
||||
|
||||
//////////////
|
||||
|
|
@ -636,9 +636,9 @@ DependencyErrorDialog::DependencyErrorDialog() {
|
|||
files = memnew(Tree);
|
||||
files->set_hide_root(true);
|
||||
vb->add_margin_child(TTR("Load failed due to missing dependencies:"), files, true);
|
||||
files->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
files->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
set_custom_minimum_size(Size2(500, 220) * EDSCALE);
|
||||
set_min_size(Size2(500, 220) * EDSCALE);
|
||||
get_ok()->set_text(TTR("Open Anyway"));
|
||||
get_cancel()->set_text(TTR("Close"));
|
||||
|
||||
|
|
@ -662,7 +662,7 @@ void OrphanResourcesDialog::ok_pressed() {
|
|||
return;
|
||||
|
||||
delete_confirm->set_text(vformat(TTR("Permanently delete %d item(s)? (No undo!)"), paths.size()));
|
||||
delete_confirm->popup_centered_clamped(delete_confirm->get_minimum_size());
|
||||
delete_confirm->popup_centered();
|
||||
}
|
||||
|
||||
bool OrphanResourcesDialog::_fill_owners(EditorFileSystemDirectory *efsd, HashMap<String, int> &refs, TreeItem *p_parent) {
|
||||
|
|
@ -678,7 +678,7 @@ bool OrphanResourcesDialog::_fill_owners(EditorFileSystemDirectory *efsd, HashMa
|
|||
if (p_parent) {
|
||||
dir_item = files->create_item(p_parent);
|
||||
dir_item->set_text(0, efsd->get_subdir(i)->get_name());
|
||||
dir_item->set_icon(0, get_icon("folder", "FileDialog"));
|
||||
dir_item->set_icon(0, files->get_theme_icon("folder", "FileDialog"));
|
||||
}
|
||||
bool children = _fill_owners(efsd->get_subdir(i), refs, dir_item);
|
||||
|
||||
|
|
@ -717,7 +717,7 @@ bool OrphanResourcesDialog::_fill_owners(EditorFileSystemDirectory *efsd, HashMa
|
|||
int ds = efsd->get_file_deps(i).size();
|
||||
ti->set_text(1, itos(ds));
|
||||
if (ds) {
|
||||
ti->add_button(1, get_icon("GuiVisibilityVisible", "EditorIcons"), -1, false, TTR("Show Dependencies"));
|
||||
ti->add_button(1, files->get_theme_icon("GuiVisibilityVisible", "EditorIcons"), -1, false, TTR("Show Dependencies"));
|
||||
}
|
||||
ti->set_metadata(0, path);
|
||||
has_children = true;
|
||||
|
|
|
|||
|
|
@ -37,20 +37,23 @@
|
|||
#include "core/version.h"
|
||||
#include "core/version_hash.gen.h"
|
||||
|
||||
void EditorAbout::_theme_changed() {
|
||||
|
||||
Control *base = EditorNode::get_singleton()->get_gui_base();
|
||||
Ref<Font> font = base->get_theme_font("source", "EditorFonts");
|
||||
_tpl_text->add_theme_font_override("normal_font", font);
|
||||
_tpl_text->add_theme_constant_override("line_separation", 6 * EDSCALE);
|
||||
_license_text->add_theme_font_override("normal_font", font);
|
||||
_license_text->add_theme_constant_override("line_separation", 6 * EDSCALE);
|
||||
_logo->set_texture(base->get_theme_icon("Logo", "EditorIcons"));
|
||||
}
|
||||
|
||||
void EditorAbout::_notification(int p_what) {
|
||||
|
||||
switch (p_what) {
|
||||
|
||||
case NOTIFICATION_ENTER_TREE:
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
|
||||
Control *base = EditorNode::get_singleton()->get_gui_base();
|
||||
Ref<Font> font = base->get_font("source", "EditorFonts");
|
||||
_tpl_text->add_font_override("normal_font", font);
|
||||
_tpl_text->add_constant_override("line_separation", 6 * EDSCALE);
|
||||
_license_text->add_font_override("normal_font", font);
|
||||
_license_text->add_constant_override("line_separation", 6 * EDSCALE);
|
||||
_logo->set_texture(base->get_icon("Logo", "EditorIcons"));
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
_theme_changed();
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
|
@ -95,7 +98,7 @@ ScrollContainer *EditorAbout::_populate_list(const String &p_name, const List<St
|
|||
il->set_same_column_width(true);
|
||||
il->set_auto_height(true);
|
||||
il->set_mouse_filter(Control::MOUSE_FILTER_IGNORE);
|
||||
il->add_constant_override("hseparation", 16 * EDSCALE);
|
||||
il->add_theme_constant_override("hseparation", 16 * EDSCALE);
|
||||
while (*names_ptr) {
|
||||
il->add_item(String::utf8(*names_ptr++), NULL, false);
|
||||
}
|
||||
|
|
@ -115,13 +118,13 @@ EditorAbout::EditorAbout() {
|
|||
|
||||
set_title(TTR("Thanks from the Godot community!"));
|
||||
set_hide_on_ok(true);
|
||||
set_resizable(true);
|
||||
|
||||
VBoxContainer *vbc = memnew(VBoxContainer);
|
||||
vbc->connect("theme_changed", callable_mp(this, &EditorAbout::_theme_changed));
|
||||
HBoxContainer *hbc = memnew(HBoxContainer);
|
||||
hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
hbc->set_alignment(BoxContainer::ALIGN_CENTER);
|
||||
hbc->add_constant_override("separation", 30 * EDSCALE);
|
||||
hbc->add_theme_constant_override("separation", 30 * EDSCALE);
|
||||
add_child(vbc);
|
||||
vbc->add_child(hbc);
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,8 @@ private:
|
|||
RichTextLabel *_tpl_text;
|
||||
TextureRect *_logo;
|
||||
|
||||
void _theme_changed();
|
||||
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
|
|
|
|||
|
|
@ -112,17 +112,17 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) {
|
|||
|
||||
Map<String, Ref<Texture2D>> extension_guess;
|
||||
{
|
||||
extension_guess["png"] = get_icon("ImageTexture", "EditorIcons");
|
||||
extension_guess["jpg"] = get_icon("ImageTexture", "EditorIcons");
|
||||
extension_guess["atlastex"] = get_icon("AtlasTexture", "EditorIcons");
|
||||
extension_guess["scn"] = get_icon("PackedScene", "EditorIcons");
|
||||
extension_guess["tscn"] = get_icon("PackedScene", "EditorIcons");
|
||||
extension_guess["shader"] = get_icon("Shader", "EditorIcons");
|
||||
extension_guess["gd"] = get_icon("GDScript", "EditorIcons");
|
||||
extension_guess["vs"] = get_icon("VisualScript", "EditorIcons");
|
||||
extension_guess["png"] = tree->get_theme_icon("ImageTexture", "EditorIcons");
|
||||
extension_guess["jpg"] = tree->get_theme_icon("ImageTexture", "EditorIcons");
|
||||
extension_guess["atlastex"] = tree->get_theme_icon("AtlasTexture", "EditorIcons");
|
||||
extension_guess["scn"] = tree->get_theme_icon("PackedScene", "EditorIcons");
|
||||
extension_guess["tscn"] = tree->get_theme_icon("PackedScene", "EditorIcons");
|
||||
extension_guess["shader"] = tree->get_theme_icon("Shader", "EditorIcons");
|
||||
extension_guess["gd"] = tree->get_theme_icon("GDScript", "EditorIcons");
|
||||
extension_guess["vs"] = tree->get_theme_icon("VisualScript", "EditorIcons");
|
||||
}
|
||||
|
||||
Ref<Texture2D> generic_extension = get_icon("Object", "EditorIcons");
|
||||
Ref<Texture2D> generic_extension = tree->get_theme_icon("Object", "EditorIcons");
|
||||
|
||||
unzClose(pkg);
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) {
|
|||
TreeItem *root = tree->create_item();
|
||||
root->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
|
||||
root->set_checked(0, true);
|
||||
root->set_icon(0, get_icon("folder", "FileDialog"));
|
||||
root->set_icon(0, tree->get_theme_icon("folder", "FileDialog"));
|
||||
root->set_text(0, "res://");
|
||||
root->set_editable(0, true);
|
||||
Map<String, TreeItem *> dir_map;
|
||||
|
|
@ -180,7 +180,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) {
|
|||
if (isdir) {
|
||||
dir_map[path] = ti;
|
||||
ti->set_text(0, path.get_file() + "/");
|
||||
ti->set_icon(0, get_icon("folder", "FileDialog"));
|
||||
ti->set_icon(0, tree->get_theme_icon("folder", "FileDialog"));
|
||||
ti->set_metadata(0, String());
|
||||
} else {
|
||||
String file = path.get_file();
|
||||
|
|
@ -194,7 +194,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) {
|
|||
|
||||
String res_path = "res://" + path;
|
||||
if (FileAccess::exists(res_path)) {
|
||||
ti->set_custom_color(0, get_color("error_color", "Editor"));
|
||||
ti->set_custom_color(0, tree->get_theme_color("error_color", "Editor"));
|
||||
ti->set_tooltip(0, vformat(TTR("%s (Already Exists)"), res_path));
|
||||
ti->set_checked(0, false);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@
|
|||
|
||||
#include "editor_audio_buses.h"
|
||||
|
||||
#include "core/input/input_filter.h"
|
||||
#include "core/io/resource_saver.h"
|
||||
#include "core/os/input.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "editor_node.h"
|
||||
#include "editor_scale.h"
|
||||
|
|
@ -69,27 +69,27 @@ void EditorAudioBus::_notification(int p_what) {
|
|||
case NOTIFICATION_READY: {
|
||||
|
||||
for (int i = 0; i < CHANNELS_MAX; i++) {
|
||||
channel[i].vu_l->set_under_texture(get_icon("BusVuEmpty", "EditorIcons"));
|
||||
channel[i].vu_l->set_progress_texture(get_icon("BusVuFull", "EditorIcons"));
|
||||
channel[i].vu_r->set_under_texture(get_icon("BusVuEmpty", "EditorIcons"));
|
||||
channel[i].vu_r->set_progress_texture(get_icon("BusVuFull", "EditorIcons"));
|
||||
channel[i].vu_l->set_under_texture(get_theme_icon("BusVuEmpty", "EditorIcons"));
|
||||
channel[i].vu_l->set_progress_texture(get_theme_icon("BusVuFull", "EditorIcons"));
|
||||
channel[i].vu_r->set_under_texture(get_theme_icon("BusVuEmpty", "EditorIcons"));
|
||||
channel[i].vu_r->set_progress_texture(get_theme_icon("BusVuFull", "EditorIcons"));
|
||||
channel[i].prev_active = true;
|
||||
}
|
||||
|
||||
disabled_vu = get_icon("BusVuFrozen", "EditorIcons");
|
||||
disabled_vu = get_theme_icon("BusVuFrozen", "EditorIcons");
|
||||
|
||||
Color solo_color = EditorSettings::get_singleton()->is_dark_theme() ? Color(1.0, 0.89, 0.22) : Color(1.0, 0.92, 0.44);
|
||||
Color mute_color = EditorSettings::get_singleton()->is_dark_theme() ? Color(1.0, 0.16, 0.16) : Color(1.0, 0.44, 0.44);
|
||||
Color bypass_color = EditorSettings::get_singleton()->is_dark_theme() ? Color(0.13, 0.8, 1.0) : Color(0.44, 0.87, 1.0);
|
||||
|
||||
solo->set_icon(get_icon("AudioBusSolo", "EditorIcons"));
|
||||
solo->add_color_override("icon_color_pressed", solo_color);
|
||||
mute->set_icon(get_icon("AudioBusMute", "EditorIcons"));
|
||||
mute->add_color_override("icon_color_pressed", mute_color);
|
||||
bypass->set_icon(get_icon("AudioBusBypass", "EditorIcons"));
|
||||
bypass->add_color_override("icon_color_pressed", bypass_color);
|
||||
solo->set_icon(get_theme_icon("AudioBusSolo", "EditorIcons"));
|
||||
solo->add_theme_color_override("icon_color_pressed", solo_color);
|
||||
mute->set_icon(get_theme_icon("AudioBusMute", "EditorIcons"));
|
||||
mute->add_theme_color_override("icon_color_pressed", mute_color);
|
||||
bypass->set_icon(get_theme_icon("AudioBusBypass", "EditorIcons"));
|
||||
bypass->add_theme_color_override("icon_color_pressed", bypass_color);
|
||||
|
||||
bus_options->set_icon(get_icon("GuiTabMenu", "EditorIcons"));
|
||||
bus_options->set_icon(get_theme_icon("GuiTabMenu", "EditorIcons"));
|
||||
|
||||
update_bus();
|
||||
set_process(true);
|
||||
|
|
@ -97,15 +97,15 @@ void EditorAudioBus::_notification(int p_what) {
|
|||
case NOTIFICATION_DRAW: {
|
||||
|
||||
if (is_master) {
|
||||
draw_style_box(get_stylebox("disabled", "Button"), Rect2(Vector2(), get_size()));
|
||||
draw_style_box(get_theme_stylebox("disabled", "Button"), Rect2(Vector2(), get_size()));
|
||||
} else if (has_focus()) {
|
||||
draw_style_box(get_stylebox("focus", "Button"), Rect2(Vector2(), get_size()));
|
||||
draw_style_box(get_theme_stylebox("focus", "Button"), Rect2(Vector2(), get_size()));
|
||||
} else {
|
||||
draw_style_box(get_stylebox("panel", "TabContainer"), Rect2(Vector2(), get_size()));
|
||||
draw_style_box(get_theme_stylebox("panel", "TabContainer"), Rect2(Vector2(), get_size()));
|
||||
}
|
||||
|
||||
if (get_index() != 0 && hovering_drop) {
|
||||
Color accent = get_color("accent_color", "Editor");
|
||||
Color accent = get_theme_color("accent_color", "Editor");
|
||||
accent.a *= 0.7;
|
||||
draw_rect(Rect2(Point2(), get_size()), accent, false);
|
||||
}
|
||||
|
|
@ -168,20 +168,20 @@ void EditorAudioBus::_notification(int p_what) {
|
|||
case NOTIFICATION_THEME_CHANGED: {
|
||||
|
||||
for (int i = 0; i < CHANNELS_MAX; i++) {
|
||||
channel[i].vu_l->set_under_texture(get_icon("BusVuEmpty", "EditorIcons"));
|
||||
channel[i].vu_l->set_progress_texture(get_icon("BusVuFull", "EditorIcons"));
|
||||
channel[i].vu_r->set_under_texture(get_icon("BusVuEmpty", "EditorIcons"));
|
||||
channel[i].vu_r->set_progress_texture(get_icon("BusVuFull", "EditorIcons"));
|
||||
channel[i].vu_l->set_under_texture(get_theme_icon("BusVuEmpty", "EditorIcons"));
|
||||
channel[i].vu_l->set_progress_texture(get_theme_icon("BusVuFull", "EditorIcons"));
|
||||
channel[i].vu_r->set_under_texture(get_theme_icon("BusVuEmpty", "EditorIcons"));
|
||||
channel[i].vu_r->set_progress_texture(get_theme_icon("BusVuFull", "EditorIcons"));
|
||||
channel[i].prev_active = true;
|
||||
}
|
||||
|
||||
disabled_vu = get_icon("BusVuFrozen", "EditorIcons");
|
||||
disabled_vu = get_theme_icon("BusVuFrozen", "EditorIcons");
|
||||
|
||||
solo->set_icon(get_icon("AudioBusSolo", "EditorIcons"));
|
||||
mute->set_icon(get_icon("AudioBusMute", "EditorIcons"));
|
||||
bypass->set_icon(get_icon("AudioBusBypass", "EditorIcons"));
|
||||
solo->set_icon(get_theme_icon("AudioBusSolo", "EditorIcons"));
|
||||
mute->set_icon(get_theme_icon("AudioBusMute", "EditorIcons"));
|
||||
bypass->set_icon(get_theme_icon("AudioBusBypass", "EditorIcons"));
|
||||
|
||||
bus_options->set_icon(get_icon("GuiTabMenu", "EditorIcons"));
|
||||
bus_options->set_icon(get_theme_icon("GuiTabMenu", "EditorIcons"));
|
||||
} break;
|
||||
case NOTIFICATION_MOUSE_EXIT:
|
||||
case NOTIFICATION_DRAG_END: {
|
||||
|
|
@ -325,7 +325,7 @@ void EditorAudioBus::_volume_changed(float p_normalized) {
|
|||
|
||||
const float p_db = this->_normalized_volume_to_scaled_db(p_normalized);
|
||||
|
||||
if (Input::get_singleton()->is_key_pressed(KEY_CONTROL)) {
|
||||
if (InputFilter::get_singleton()->is_key_pressed(KEY_CONTROL)) {
|
||||
// Snap the value when holding Ctrl for easier editing.
|
||||
// To do so, it needs to be converted back to normalized volume (as the slider uses that unit).
|
||||
slider->set_value(_scaled_db_to_normalized_volume(Math::round(p_db)));
|
||||
|
|
@ -386,7 +386,7 @@ float EditorAudioBus::_scaled_db_to_normalized_volume(float db) {
|
|||
void EditorAudioBus::_show_value(float slider_value) {
|
||||
|
||||
float db;
|
||||
if (Input::get_singleton()->is_key_pressed(KEY_CONTROL)) {
|
||||
if (InputFilter::get_singleton()->is_key_pressed(KEY_CONTROL)) {
|
||||
// Display the correct (snapped) value when holding Ctrl
|
||||
db = Math::round(_normalized_volume_to_scaled_db(slider_value));
|
||||
} else {
|
||||
|
|
@ -586,7 +586,7 @@ Variant EditorAudioBus::get_drag_data(const Point2 &p_point) {
|
|||
Panel *p = memnew(Panel);
|
||||
c->add_child(p);
|
||||
p->set_modulate(Color(1, 1, 1, 0.7));
|
||||
p->add_style_override("panel", get_stylebox("focus", "Button"));
|
||||
p->add_theme_style_override("panel", get_theme_stylebox("focus", "Button"));
|
||||
p->set_size(get_size());
|
||||
p->set_position(-p_point);
|
||||
set_drag_preview(c);
|
||||
|
|
@ -819,10 +819,10 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
|
|||
Ref<StyleBoxEmpty> sbempty = memnew(StyleBoxEmpty);
|
||||
for (int i = 0; i < hbc->get_child_count(); i++) {
|
||||
Control *child = Object::cast_to<Control>(hbc->get_child(i));
|
||||
child->add_style_override("normal", sbempty);
|
||||
child->add_style_override("hover", sbempty);
|
||||
child->add_style_override("focus", sbempty);
|
||||
child->add_style_override("pressed", sbempty);
|
||||
child->add_theme_style_override("normal", sbempty);
|
||||
child->add_theme_style_override("hover", sbempty);
|
||||
child->add_theme_style_override("focus", sbempty);
|
||||
child->add_theme_style_override("pressed", sbempty);
|
||||
}
|
||||
|
||||
HSeparator *separator = memnew(HSeparator);
|
||||
|
|
@ -854,7 +854,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
|
|||
audio_value_preview_box->set_as_toplevel(true);
|
||||
Ref<StyleBoxFlat> panel_style = memnew(StyleBoxFlat);
|
||||
panel_style->set_bg_color(Color(0.0f, 0.0f, 0.0f, 0.8f));
|
||||
audio_value_preview_box->add_style_override("panel", panel_style);
|
||||
audio_value_preview_box->add_theme_style_override("panel", panel_style);
|
||||
audio_value_preview_box->set_mouse_filter(MOUSE_FILTER_PASS);
|
||||
audio_value_preview_box->hide();
|
||||
|
||||
|
|
@ -953,10 +953,10 @@ void EditorAudioBusDrop::_notification(int p_what) {
|
|||
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_DRAW: {
|
||||
draw_style_box(get_stylebox("normal", "Button"), Rect2(Vector2(), get_size()));
|
||||
draw_style_box(get_theme_stylebox("normal", "Button"), Rect2(Vector2(), get_size()));
|
||||
|
||||
if (hovering_drop) {
|
||||
Color accent = get_color("accent_color", "Editor");
|
||||
Color accent = get_theme_color("accent_color", "Editor");
|
||||
accent.a *= 0.7;
|
||||
draw_rect(Rect2(Point2(), get_size()), accent, false);
|
||||
}
|
||||
|
|
@ -1035,7 +1035,7 @@ void EditorAudioBuses::_notification(int p_what) {
|
|||
case NOTIFICATION_ENTER_TREE:
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
|
||||
bus_scroll->add_style_override("bg", get_stylebox("bg", "Tree"));
|
||||
bus_scroll->add_theme_style_override("bg", get_theme_stylebox("bg", "Tree"));
|
||||
} break;
|
||||
case NOTIFICATION_READY: {
|
||||
|
||||
|
|
@ -1204,7 +1204,7 @@ void EditorAudioBuses::_select_layout() {
|
|||
|
||||
void EditorAudioBuses::_save_as_layout() {
|
||||
|
||||
file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE);
|
||||
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
|
||||
file_dialog->set_title(TTR("Save Audio Bus Layout As..."));
|
||||
file_dialog->set_current_path(edited_path);
|
||||
file_dialog->popup_centered_ratio();
|
||||
|
|
@ -1213,7 +1213,7 @@ void EditorAudioBuses::_save_as_layout() {
|
|||
|
||||
void EditorAudioBuses::_new_layout() {
|
||||
|
||||
file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE);
|
||||
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
|
||||
file_dialog->set_title(TTR("Location for New Layout..."));
|
||||
file_dialog->set_current_path(edited_path);
|
||||
file_dialog->popup_centered_ratio();
|
||||
|
|
@ -1222,7 +1222,7 @@ void EditorAudioBuses::_new_layout() {
|
|||
|
||||
void EditorAudioBuses::_load_layout() {
|
||||
|
||||
file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
file_dialog->set_title(TTR("Open Audio Bus Layout"));
|
||||
file_dialog->set_current_path(edited_path);
|
||||
file_dialog->popup_centered_ratio();
|
||||
|
|
@ -1249,7 +1249,7 @@ void EditorAudioBuses::_load_default_layout() {
|
|||
|
||||
void EditorAudioBuses::_file_dialog_callback(const String &p_string) {
|
||||
|
||||
if (file_dialog->get_mode() == EditorFileDialog::MODE_OPEN_FILE) {
|
||||
if (file_dialog->get_file_mode() == EditorFileDialog::FILE_MODE_OPEN_FILE) {
|
||||
Ref<AudioBusLayout> state = ResourceLoader::load(p_string, "", true);
|
||||
if (state.is_null()) {
|
||||
EditorNode::get_singleton()->show_warning(TTR("Invalid file, not an audio bus layout."));
|
||||
|
|
@ -1263,7 +1263,7 @@ void EditorAudioBuses::_file_dialog_callback(const String &p_string) {
|
|||
EditorNode::get_singleton()->get_undo_redo()->clear_history();
|
||||
call_deferred("_select_layout");
|
||||
|
||||
} else if (file_dialog->get_mode() == EditorFileDialog::MODE_SAVE_FILE) {
|
||||
} else if (file_dialog->get_file_mode() == EditorFileDialog::FILE_MODE_SAVE_FILE) {
|
||||
|
||||
if (new_layout) {
|
||||
Ref<AudioBusLayout> empty_state;
|
||||
|
|
@ -1423,7 +1423,7 @@ void EditorAudioMeterNotches::add_notch(float p_normalized_offset, float p_db_va
|
|||
|
||||
Size2 EditorAudioMeterNotches::get_minimum_size() const {
|
||||
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
float font_height = font->get_height();
|
||||
|
||||
float width = 0;
|
||||
|
|
@ -1460,7 +1460,7 @@ void EditorAudioMeterNotches::_notification(int p_what) {
|
|||
|
||||
void EditorAudioMeterNotches::_draw_audio_notches() {
|
||||
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
float font_height = font->get_height();
|
||||
|
||||
for (int i = 0; i < notches.size(); i++) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
#include "editor_node.h"
|
||||
#include "editor_scale.h"
|
||||
#include "project_settings_editor.h"
|
||||
#include "scene/main/viewport.h"
|
||||
#include "scene/main/window.h"
|
||||
#include "scene/resources/packed_scene.h"
|
||||
|
||||
#define PREVIEW_LIST_MAX_SIZE 10
|
||||
|
|
@ -452,10 +452,10 @@ void EditorAutoloadSettings::update_autoload() {
|
|||
item->set_editable(2, true);
|
||||
item->set_text(2, TTR("Enable"));
|
||||
item->set_checked(2, info.is_singleton);
|
||||
item->add_button(3, get_icon("Load", "EditorIcons"), BUTTON_OPEN);
|
||||
item->add_button(3, get_icon("MoveUp", "EditorIcons"), BUTTON_MOVE_UP);
|
||||
item->add_button(3, get_icon("MoveDown", "EditorIcons"), BUTTON_MOVE_DOWN);
|
||||
item->add_button(3, get_icon("Remove", "EditorIcons"), BUTTON_DELETE);
|
||||
item->add_button(3, get_theme_icon("Load", "EditorIcons"), BUTTON_OPEN);
|
||||
item->add_button(3, get_theme_icon("MoveUp", "EditorIcons"), BUTTON_MOVE_UP);
|
||||
item->add_button(3, get_theme_icon("MoveDown", "EditorIcons"), BUTTON_MOVE_DOWN);
|
||||
item->add_button(3, get_theme_icon("Remove", "EditorIcons"), BUTTON_DELETE);
|
||||
item->set_selectable(3, false);
|
||||
}
|
||||
|
||||
|
|
@ -825,7 +825,7 @@ EditorAutoloadSettings::EditorAutoloadSettings() {
|
|||
|
||||
autoload_add_path = memnew(EditorLineEditFileChooser);
|
||||
autoload_add_path->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
autoload_add_path->get_file_dialog()->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
autoload_add_path->get_file_dialog()->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
autoload_add_path->get_file_dialog()->connect("file_selected", callable_mp(this, &EditorAutoloadSettings::_autoload_file_callback));
|
||||
autoload_add_path->get_line_edit()->connect("text_changed", callable_mp(this, &EditorAutoloadSettings::_autoload_path_text_changed));
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include "editor/editor_file_system.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#include "editor_scale.h"
|
||||
#include "servers/display_server.h"
|
||||
|
||||
void EditorDirDialog::_update_dir(TreeItem *p_item, EditorFileSystemDirectory *p_dir, const String &p_select_path) {
|
||||
|
||||
|
|
@ -43,7 +44,7 @@ void EditorDirDialog::_update_dir(TreeItem *p_item, EditorFileSystemDirectory *p
|
|||
String path = p_dir->get_path();
|
||||
|
||||
p_item->set_metadata(0, p_dir->get_path());
|
||||
p_item->set_icon(0, get_icon("Folder", "EditorIcons"));
|
||||
p_item->set_icon(0, tree->get_theme_icon("Folder", "EditorIcons"));
|
||||
|
||||
if (!p_item->get_parent()) {
|
||||
p_item->set_text(0, "res://");
|
||||
|
|
@ -68,7 +69,7 @@ void EditorDirDialog::_update_dir(TreeItem *p_item, EditorFileSystemDirectory *p
|
|||
|
||||
void EditorDirDialog::reload(const String &p_path) {
|
||||
|
||||
if (!is_visible_in_tree()) {
|
||||
if (!is_visible()) {
|
||||
must_reload = true;
|
||||
return;
|
||||
}
|
||||
|
|
@ -102,7 +103,7 @@ void EditorDirDialog::_notification(int p_what) {
|
|||
}
|
||||
|
||||
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
||||
if (must_reload && is_visible_in_tree()) {
|
||||
if (must_reload && is_visible()) {
|
||||
reload();
|
||||
}
|
||||
}
|
||||
|
|
@ -141,11 +142,11 @@ void EditorDirDialog::_make_dir() {
|
|||
TreeItem *ti = tree->get_selected();
|
||||
if (!ti) {
|
||||
mkdirerr->set_text(TTR("Please select a base directory first."));
|
||||
mkdirerr->popup_centered_minsize();
|
||||
mkdirerr->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
makedialog->popup_centered_minsize(Size2(250, 80));
|
||||
makedialog->popup_centered(Size2(250, 80));
|
||||
makedirname->grab_focus();
|
||||
}
|
||||
|
||||
|
|
@ -162,7 +163,7 @@ void EditorDirDialog::_make_dir_confirm() {
|
|||
Error err = d->make_dir(makedirname->get_text());
|
||||
|
||||
if (err != OK) {
|
||||
mkdirerr->popup_centered_minsize(Size2(250, 80) * EDSCALE);
|
||||
mkdirerr->popup_centered(Size2(250, 80) * EDSCALE);
|
||||
} else {
|
||||
opened_paths.insert(dir);
|
||||
//reload(dir.plus_file(makedirname->get_text()));
|
||||
|
|
@ -188,7 +189,7 @@ EditorDirDialog::EditorDirDialog() {
|
|||
|
||||
tree->connect("item_activated", callable_mp(this, &EditorDirDialog::_item_activated));
|
||||
|
||||
makedir = add_button(TTR("Create Folder"), OS::get_singleton()->get_swap_ok_cancel(), "makedir");
|
||||
makedir = add_button(TTR("Create Folder"), DisplayServer::get_singleton()->get_swap_ok_cancel(), "makedir");
|
||||
makedir->connect("pressed", callable_mp(this, &EditorDirDialog::_make_dir));
|
||||
|
||||
makedialog = memnew(ConfirmationDialog);
|
||||
|
|
|
|||
|
|
@ -420,7 +420,7 @@ void EditorFeatureProfileManager::_profile_action(int p_action) {
|
|||
} break;
|
||||
case PROFILE_NEW: {
|
||||
|
||||
new_profile_dialog->popup_centered_minsize();
|
||||
new_profile_dialog->popup_centered();
|
||||
new_profile_name->clear();
|
||||
new_profile_name->grab_focus();
|
||||
} break;
|
||||
|
|
@ -430,7 +430,7 @@ void EditorFeatureProfileManager::_profile_action(int p_action) {
|
|||
ERR_FAIL_COND(selected == String());
|
||||
|
||||
erase_profile_dialog->set_text(vformat(TTR("Erase profile '%s'? (no undo)"), selected));
|
||||
erase_profile_dialog->popup_centered_minsize();
|
||||
erase_profile_dialog->popup_centered();
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
|
@ -485,7 +485,7 @@ void EditorFeatureProfileManager::_fill_classes_from(TreeItem *p_parent, const S
|
|||
bool disabled_editor = edited->is_class_editor_disabled(p_class);
|
||||
bool disabled_properties = edited->has_class_properties_disabled(p_class);
|
||||
if (disabled) {
|
||||
class_item->set_custom_color(0, get_color("disabled_font_color", "Editor"));
|
||||
class_item->set_custom_color(0, class_list->get_theme_color("disabled_font_color", "Editor"));
|
||||
} else if (disabled_editor && disabled_properties) {
|
||||
text += " " + TTR("(Editor Disabled, Properties Disabled)");
|
||||
} else if (disabled_properties) {
|
||||
|
|
@ -805,7 +805,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() {
|
|||
current_profile_name = memnew(LineEdit);
|
||||
name_hbc->add_child(current_profile_name);
|
||||
current_profile_name->set_editable(false);
|
||||
current_profile_name->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
current_profile_name->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
profile_actions[PROFILE_CLEAR] = memnew(Button(TTR("Unset")));
|
||||
name_hbc->add_child(profile_actions[PROFILE_CLEAR]);
|
||||
profile_actions[PROFILE_CLEAR]->set_disabled(true);
|
||||
|
|
@ -815,7 +815,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() {
|
|||
|
||||
HBoxContainer *profiles_hbc = memnew(HBoxContainer);
|
||||
profile_list = memnew(OptionButton);
|
||||
profile_list->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
profile_list->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
profiles_hbc->add_child(profile_list);
|
||||
profile_list->connect("item_selected", callable_mp(this, &EditorFeatureProfileManager::_profile_selected));
|
||||
|
||||
|
|
@ -849,12 +849,12 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() {
|
|||
main_vbc->add_margin_child(TTR("Available Profiles:"), profiles_hbc);
|
||||
|
||||
h_split = memnew(HSplitContainer);
|
||||
h_split->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
h_split->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
main_vbc->add_child(h_split);
|
||||
|
||||
VBoxContainer *class_list_vbc = memnew(VBoxContainer);
|
||||
h_split->add_child(class_list_vbc);
|
||||
class_list_vbc->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
class_list_vbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
class_list = memnew(Tree);
|
||||
class_list_vbc->add_margin_child(TTR("Enabled Classes:"), class_list, true);
|
||||
|
|
@ -865,7 +865,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() {
|
|||
|
||||
VBoxContainer *property_list_vbc = memnew(VBoxContainer);
|
||||
h_split->add_child(property_list_vbc);
|
||||
property_list_vbc->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
property_list_vbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
property_list = memnew(Tree);
|
||||
property_list_vbc->add_margin_child(TTR("Class Options"), property_list, true);
|
||||
|
|
@ -891,7 +891,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() {
|
|||
|
||||
import_profiles = memnew(EditorFileDialog);
|
||||
add_child(import_profiles);
|
||||
import_profiles->set_mode(EditorFileDialog::MODE_OPEN_FILES);
|
||||
import_profiles->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILES);
|
||||
import_profiles->add_filter("*.profile; " + TTR("Godot Feature Profile"));
|
||||
import_profiles->connect("files_selected", callable_mp(this, &EditorFeatureProfileManager::_import_profiles));
|
||||
import_profiles->set_title(TTR("Import Profile(s)"));
|
||||
|
|
@ -899,7 +899,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() {
|
|||
|
||||
export_profile = memnew(EditorFileDialog);
|
||||
add_child(export_profile);
|
||||
export_profile->set_mode(EditorFileDialog::MODE_SAVE_FILE);
|
||||
export_profile->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
|
||||
export_profile->add_filter("*.profile; " + TTR("Godot Feature Profile"));
|
||||
export_profile->connect("file_selected", callable_mp(this, &EditorFeatureProfileManager::_export_profile));
|
||||
export_profile->set_title(TTR("Export Profile"));
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
#include "scene/gui/center_container.h"
|
||||
#include "scene/gui/label.h"
|
||||
#include "scene/gui/margin_container.h"
|
||||
#include "servers/display_server.h"
|
||||
|
||||
EditorFileDialog::GetIconFunc EditorFileDialog::get_icon_func = NULL;
|
||||
EditorFileDialog::GetIconFunc EditorFileDialog::get_large_icon_func = NULL;
|
||||
|
|
@ -58,17 +59,17 @@ void EditorFileDialog::_notification(int p_what) {
|
|||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||
|
||||
// update icons
|
||||
mode_thumbnails->set_icon(get_icon("FileThumbnail", "EditorIcons"));
|
||||
mode_list->set_icon(get_icon("FileList", "EditorIcons"));
|
||||
dir_prev->set_icon(get_icon("Back", "EditorIcons"));
|
||||
dir_next->set_icon(get_icon("Forward", "EditorIcons"));
|
||||
dir_up->set_icon(get_icon("ArrowUp", "EditorIcons"));
|
||||
refresh->set_icon(get_icon("Reload", "EditorIcons"));
|
||||
favorite->set_icon(get_icon("Favorites", "EditorIcons"));
|
||||
show_hidden->set_icon(get_icon("GuiVisibilityVisible", "EditorIcons"));
|
||||
mode_thumbnails->set_icon(item_list->get_theme_icon("FileThumbnail", "EditorIcons"));
|
||||
mode_list->set_icon(item_list->get_theme_icon("FileList", "EditorIcons"));
|
||||
dir_prev->set_icon(item_list->get_theme_icon("Back", "EditorIcons"));
|
||||
dir_next->set_icon(item_list->get_theme_icon("Forward", "EditorIcons"));
|
||||
dir_up->set_icon(item_list->get_theme_icon("ArrowUp", "EditorIcons"));
|
||||
refresh->set_icon(item_list->get_theme_icon("Reload", "EditorIcons"));
|
||||
favorite->set_icon(item_list->get_theme_icon("Favorites", "EditorIcons"));
|
||||
show_hidden->set_icon(item_list->get_theme_icon("GuiVisibilityVisible", "EditorIcons"));
|
||||
|
||||
fav_up->set_icon(get_icon("MoveUp", "EditorIcons"));
|
||||
fav_down->set_icon(get_icon("MoveDown", "EditorIcons"));
|
||||
fav_up->set_icon(item_list->get_theme_icon("MoveUp", "EditorIcons"));
|
||||
fav_down->set_icon(item_list->get_theme_icon("MoveDown", "EditorIcons"));
|
||||
|
||||
} else if (p_what == NOTIFICATION_PROCESS) {
|
||||
|
||||
|
|
@ -78,14 +79,11 @@ void EditorFileDialog::_notification(int p_what) {
|
|||
preview_wheel_index++;
|
||||
if (preview_wheel_index >= 8)
|
||||
preview_wheel_index = 0;
|
||||
Ref<Texture2D> frame = get_icon("Progress" + itos(preview_wheel_index + 1), "EditorIcons");
|
||||
Ref<Texture2D> frame = item_list->get_theme_icon("Progress" + itos(preview_wheel_index + 1), "EditorIcons");
|
||||
preview->set_texture(frame);
|
||||
preview_wheel_timeout = 0.1;
|
||||
}
|
||||
}
|
||||
} else if (p_what == NOTIFICATION_POPUP_HIDE) {
|
||||
|
||||
set_process_unhandled_input(false);
|
||||
|
||||
} else if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
|
||||
|
||||
|
|
@ -95,18 +93,23 @@ void EditorFileDialog::_notification(int p_what) {
|
|||
set_display_mode((DisplayMode)EditorSettings::get_singleton()->get("filesystem/file_dialog/display_mode").operator int());
|
||||
|
||||
// update icons
|
||||
mode_thumbnails->set_icon(get_icon("FileThumbnail", "EditorIcons"));
|
||||
mode_list->set_icon(get_icon("FileList", "EditorIcons"));
|
||||
dir_prev->set_icon(get_icon("Back", "EditorIcons"));
|
||||
dir_next->set_icon(get_icon("Forward", "EditorIcons"));
|
||||
dir_up->set_icon(get_icon("ArrowUp", "EditorIcons"));
|
||||
refresh->set_icon(get_icon("Reload", "EditorIcons"));
|
||||
favorite->set_icon(get_icon("Favorites", "EditorIcons"));
|
||||
mode_thumbnails->set_icon(item_list->get_theme_icon("FileThumbnail", "EditorIcons"));
|
||||
mode_list->set_icon(item_list->get_theme_icon("FileList", "EditorIcons"));
|
||||
dir_prev->set_icon(item_list->get_theme_icon("Back", "EditorIcons"));
|
||||
dir_next->set_icon(item_list->get_theme_icon("Forward", "EditorIcons"));
|
||||
dir_up->set_icon(item_list->get_theme_icon("ArrowUp", "EditorIcons"));
|
||||
refresh->set_icon(item_list->get_theme_icon("Reload", "EditorIcons"));
|
||||
favorite->set_icon(item_list->get_theme_icon("Favorites", "EditorIcons"));
|
||||
|
||||
fav_up->set_icon(get_icon("MoveUp", "EditorIcons"));
|
||||
fav_down->set_icon(get_icon("MoveDown", "EditorIcons"));
|
||||
fav_up->set_icon(item_list->get_theme_icon("MoveUp", "EditorIcons"));
|
||||
fav_down->set_icon(item_list->get_theme_icon("MoveDown", "EditorIcons"));
|
||||
// DO NOT CALL UPDATE FILE LIST HERE, ALL HUNDREDS OF HIDDEN DIALOGS WILL RESPOND, CALL INVALIDATE INSTEAD
|
||||
invalidate();
|
||||
} else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
||||
|
||||
if (!is_visible()) {
|
||||
set_process_unhandled_input(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -114,7 +117,7 @@ void EditorFileDialog::_unhandled_input(const Ref<InputEvent> &p_event) {
|
|||
|
||||
Ref<InputEventKey> k = p_event;
|
||||
|
||||
if (k.is_valid() && is_window_modal_on_top()) {
|
||||
if (k.is_valid()) {
|
||||
|
||||
if (k->is_pressed()) {
|
||||
|
||||
|
|
@ -176,7 +179,7 @@ void EditorFileDialog::_unhandled_input(const Ref<InputEvent> &p_event) {
|
|||
}
|
||||
|
||||
if (handled) {
|
||||
accept_event();
|
||||
set_input_as_handled();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -208,15 +211,15 @@ void EditorFileDialog::update_dir() {
|
|||
get_ok()->set_disabled(_is_open_should_be_disabled());
|
||||
switch (mode) {
|
||||
|
||||
case MODE_OPEN_FILE:
|
||||
case MODE_OPEN_FILES:
|
||||
case FILE_MODE_OPEN_FILE:
|
||||
case FILE_MODE_OPEN_FILES:
|
||||
get_ok()->set_text(TTR("Open"));
|
||||
break;
|
||||
case MODE_OPEN_DIR:
|
||||
case FILE_MODE_OPEN_DIR:
|
||||
get_ok()->set_text(TTR("Select Current Folder"));
|
||||
break;
|
||||
case MODE_OPEN_ANY:
|
||||
case MODE_SAVE_FILE:
|
||||
case FILE_MODE_OPEN_ANY:
|
||||
case FILE_MODE_SAVE_FILE:
|
||||
// FIXME: Implement, or refactor to avoid duplication with set_mode
|
||||
break;
|
||||
}
|
||||
|
|
@ -251,23 +254,23 @@ void EditorFileDialog::_post_popup() {
|
|||
update_file_list();
|
||||
invalidated = false;
|
||||
}
|
||||
if (mode == MODE_SAVE_FILE)
|
||||
if (mode == FILE_MODE_SAVE_FILE)
|
||||
file->grab_focus();
|
||||
else
|
||||
item_list->grab_focus();
|
||||
|
||||
if (mode == MODE_OPEN_DIR) {
|
||||
if (mode == FILE_MODE_OPEN_DIR) {
|
||||
file_box->set_visible(false);
|
||||
} else {
|
||||
file_box->set_visible(true);
|
||||
}
|
||||
|
||||
if (is_visible_in_tree() && get_current_file() != "")
|
||||
if (is_visible() && get_current_file() != "")
|
||||
_request_single_thumbnail(get_current_dir().plus_file(get_current_file()));
|
||||
|
||||
if (is_visible_in_tree()) {
|
||||
Ref<Texture2D> folder = get_icon("folder", "FileDialog");
|
||||
const Color folder_color = get_color("folder_icon_modulate", "FileDialog");
|
||||
if (is_visible()) {
|
||||
Ref<Texture2D> folder = item_list->get_theme_icon("folder", "FileDialog");
|
||||
const Color folder_color = item_list->get_theme_color("folder_icon_modulate", "FileDialog");
|
||||
recent->clear();
|
||||
|
||||
bool res = access == ACCESS_RESOURCES;
|
||||
|
|
@ -346,7 +349,7 @@ void EditorFileDialog::_request_single_thumbnail(const String &p_path) {
|
|||
|
||||
void EditorFileDialog::_action_pressed() {
|
||||
|
||||
if (mode == MODE_OPEN_FILES) {
|
||||
if (mode == FILE_MODE_OPEN_FILES) {
|
||||
|
||||
String fbase = dir_access->get_current_dir();
|
||||
|
||||
|
|
@ -367,11 +370,11 @@ void EditorFileDialog::_action_pressed() {
|
|||
|
||||
String f = dir_access->get_current_dir().plus_file(file->get_text());
|
||||
|
||||
if ((mode == MODE_OPEN_ANY || mode == MODE_OPEN_FILE) && dir_access->file_exists(f)) {
|
||||
if ((mode == FILE_MODE_OPEN_ANY || mode == FILE_MODE_OPEN_FILE) && dir_access->file_exists(f)) {
|
||||
_save_to_recent();
|
||||
hide();
|
||||
emit_signal("file_selected", f);
|
||||
} else if (mode == MODE_OPEN_ANY || mode == MODE_OPEN_DIR) {
|
||||
} else if (mode == FILE_MODE_OPEN_ANY || mode == FILE_MODE_OPEN_DIR) {
|
||||
|
||||
String path = dir_access->get_current_dir();
|
||||
|
||||
|
|
@ -393,7 +396,7 @@ void EditorFileDialog::_action_pressed() {
|
|||
emit_signal("dir_selected", path);
|
||||
}
|
||||
|
||||
if (mode == MODE_SAVE_FILE) {
|
||||
if (mode == FILE_MODE_SAVE_FILE) {
|
||||
|
||||
bool valid = false;
|
||||
|
||||
|
|
@ -446,7 +449,7 @@ void EditorFileDialog::_action_pressed() {
|
|||
|
||||
if (!valid) {
|
||||
|
||||
exterr->popup_centered_minsize(Size2(250, 80) * EDSCALE);
|
||||
exterr->popup_centered(Size2(250, 80) * EDSCALE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -481,7 +484,7 @@ void EditorFileDialog::_item_selected(int p_item) {
|
|||
|
||||
file->set_text(d["name"]);
|
||||
_request_single_thumbnail(get_current_dir().plus_file(get_current_file()));
|
||||
} else if (mode == MODE_OPEN_DIR) {
|
||||
} else if (mode == FILE_MODE_OPEN_DIR) {
|
||||
get_ok()->set_text(TTR("Select This Folder"));
|
||||
}
|
||||
|
||||
|
|
@ -512,19 +515,19 @@ void EditorFileDialog::_items_clear_selection() {
|
|||
// If nothing is selected, then block Open button.
|
||||
switch (mode) {
|
||||
|
||||
case MODE_OPEN_FILE:
|
||||
case MODE_OPEN_FILES:
|
||||
case FILE_MODE_OPEN_FILE:
|
||||
case FILE_MODE_OPEN_FILES:
|
||||
get_ok()->set_text(TTR("Open"));
|
||||
get_ok()->set_disabled(!item_list->is_anything_selected());
|
||||
break;
|
||||
|
||||
case MODE_OPEN_DIR:
|
||||
case FILE_MODE_OPEN_DIR:
|
||||
get_ok()->set_disabled(false);
|
||||
get_ok()->set_text(TTR("Select Current Folder"));
|
||||
break;
|
||||
|
||||
case MODE_OPEN_ANY:
|
||||
case MODE_SAVE_FILE:
|
||||
case FILE_MODE_OPEN_ANY:
|
||||
case FILE_MODE_SAVE_FILE:
|
||||
// FIXME: Implement, or refactor to avoid duplication with set_mode
|
||||
break;
|
||||
}
|
||||
|
|
@ -586,16 +589,16 @@ void EditorFileDialog::_item_list_item_rmb_selected(int p_item, const Vector2 &p
|
|||
}
|
||||
|
||||
if (single_item_selected) {
|
||||
item_menu->add_icon_item(get_icon("ActionCopy", "EditorIcons"), TTR("Copy Path"), ITEM_MENU_COPY_PATH);
|
||||
item_menu->add_icon_item(item_list->get_theme_icon("ActionCopy", "EditorIcons"), TTR("Copy Path"), ITEM_MENU_COPY_PATH);
|
||||
}
|
||||
if (allow_delete) {
|
||||
item_menu->add_icon_item(get_icon("Remove", "EditorIcons"), TTR("Delete"), ITEM_MENU_DELETE, KEY_DELETE);
|
||||
item_menu->add_icon_item(item_list->get_theme_icon("Remove", "EditorIcons"), TTR("Delete"), ITEM_MENU_DELETE, KEY_DELETE);
|
||||
}
|
||||
if (single_item_selected) {
|
||||
item_menu->add_separator();
|
||||
Dictionary item_meta = item_list->get_item_metadata(p_item);
|
||||
String item_text = item_meta["dir"] ? TTR("Open in File Manager") : TTR("Show in File Manager");
|
||||
item_menu->add_icon_item(get_icon("Filesystem", "EditorIcons"), item_text, ITEM_MENU_SHOW_IN_EXPLORER);
|
||||
item_menu->add_icon_item(item_list->get_theme_icon("Filesystem", "EditorIcons"), item_text, ITEM_MENU_SHOW_IN_EXPLORER);
|
||||
}
|
||||
|
||||
if (item_menu->get_item_count() > 0) {
|
||||
|
|
@ -615,11 +618,11 @@ void EditorFileDialog::_item_list_rmb_clicked(const Vector2 &p_pos) {
|
|||
item_menu->set_size(Size2(1, 1));
|
||||
|
||||
if (can_create_dir) {
|
||||
item_menu->add_icon_item(get_icon("folder", "FileDialog"), TTR("New Folder..."), ITEM_MENU_NEW_FOLDER, KEY_MASK_CMD | KEY_N);
|
||||
item_menu->add_icon_item(item_list->get_theme_icon("folder", "FileDialog"), TTR("New Folder..."), ITEM_MENU_NEW_FOLDER, KEY_MASK_CMD | KEY_N);
|
||||
}
|
||||
item_menu->add_icon_item(get_icon("Reload", "EditorIcons"), TTR("Refresh"), ITEM_MENU_REFRESH, KEY_F5);
|
||||
item_menu->add_icon_item(item_list->get_theme_icon("Reload", "EditorIcons"), TTR("Refresh"), ITEM_MENU_REFRESH, KEY_F5);
|
||||
item_menu->add_separator();
|
||||
item_menu->add_icon_item(get_icon("Filesystem", "EditorIcons"), TTR("Open in File Manager"), ITEM_MENU_SHOW_IN_EXPLORER);
|
||||
item_menu->add_icon_item(item_list->get_theme_icon("Filesystem", "EditorIcons"), TTR("Open in File Manager"), ITEM_MENU_SHOW_IN_EXPLORER);
|
||||
|
||||
item_menu->set_position(item_list->get_global_position() + p_pos);
|
||||
item_menu->popup();
|
||||
|
|
@ -631,7 +634,7 @@ void EditorFileDialog::_item_menu_id_pressed(int p_option) {
|
|||
|
||||
case ITEM_MENU_COPY_PATH: {
|
||||
Dictionary item_meta = item_list->get_item_metadata(item_list->get_current());
|
||||
OS::get_singleton()->set_clipboard(item_meta["path"]);
|
||||
DisplayServer::get_singleton()->clipboard_set(item_meta["path"]);
|
||||
} break;
|
||||
|
||||
case ITEM_MENU_DELETE: {
|
||||
|
|
@ -667,18 +670,18 @@ void EditorFileDialog::_item_menu_id_pressed(int p_option) {
|
|||
|
||||
bool EditorFileDialog::_is_open_should_be_disabled() {
|
||||
|
||||
if (mode == MODE_OPEN_ANY || mode == MODE_SAVE_FILE)
|
||||
if (mode == FILE_MODE_OPEN_ANY || mode == FILE_MODE_SAVE_FILE)
|
||||
return false;
|
||||
|
||||
Vector<int> items = item_list->get_selected_items();
|
||||
if (items.size() == 0)
|
||||
return mode != MODE_OPEN_DIR; // In "Open folder" mode, having nothing selected picks the current folder.
|
||||
return mode != FILE_MODE_OPEN_DIR; // In "Open folder" mode, having nothing selected picks the current folder.
|
||||
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
|
||||
Dictionary d = item_list->get_item_metadata(items.get(i));
|
||||
|
||||
if (((mode == MODE_OPEN_FILE || mode == MODE_OPEN_FILES) && d["dir"]) || (mode == MODE_OPEN_DIR && !d["dir"]))
|
||||
if (((mode == FILE_MODE_OPEN_FILE || mode == FILE_MODE_OPEN_FILES) && d["dir"]) || (mode == FILE_MODE_OPEN_DIR && !d["dir"]))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -724,11 +727,11 @@ void EditorFileDialog::update_file_list() {
|
|||
item_list->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size));
|
||||
|
||||
if (thumbnail_size < 64) {
|
||||
folder_thumbnail = get_icon("FolderMediumThumb", "EditorIcons");
|
||||
file_thumbnail = get_icon("FileMediumThumb", "EditorIcons");
|
||||
folder_thumbnail = item_list->get_theme_icon("FolderMediumThumb", "EditorIcons");
|
||||
file_thumbnail = item_list->get_theme_icon("FileMediumThumb", "EditorIcons");
|
||||
} else {
|
||||
folder_thumbnail = get_icon("FolderBigThumb", "EditorIcons");
|
||||
file_thumbnail = get_icon("FileBigThumb", "EditorIcons");
|
||||
folder_thumbnail = item_list->get_theme_icon("FolderBigThumb", "EditorIcons");
|
||||
file_thumbnail = item_list->get_theme_icon("FileBigThumb", "EditorIcons");
|
||||
}
|
||||
|
||||
preview_vb->hide();
|
||||
|
|
@ -748,8 +751,8 @@ void EditorFileDialog::update_file_list() {
|
|||
|
||||
dir_access->list_dir_begin();
|
||||
|
||||
Ref<Texture2D> folder = get_icon("folder", "FileDialog");
|
||||
const Color folder_color = get_color("folder_icon_modulate", "FileDialog");
|
||||
Ref<Texture2D> folder = item_list->get_theme_icon("folder", "FileDialog");
|
||||
const Color folder_color = item_list->get_theme_color("folder_icon_modulate", "FileDialog");
|
||||
List<String> files;
|
||||
List<String> dirs;
|
||||
|
||||
|
|
@ -978,7 +981,7 @@ void EditorFileDialog::set_current_file(const String &p_file) {
|
|||
file->grab_focus();
|
||||
}
|
||||
|
||||
if (is_visible_in_tree())
|
||||
if (is_visible())
|
||||
_request_single_thumbnail(get_current_dir().plus_file(get_current_file()));
|
||||
}
|
||||
void EditorFileDialog::set_current_path(const String &p_path) {
|
||||
|
|
@ -998,39 +1001,39 @@ void EditorFileDialog::set_current_path(const String &p_path) {
|
|||
}
|
||||
}
|
||||
|
||||
void EditorFileDialog::set_mode(Mode p_mode) {
|
||||
void EditorFileDialog::set_file_mode(FileMode p_mode) {
|
||||
|
||||
mode = p_mode;
|
||||
switch (mode) {
|
||||
|
||||
case MODE_OPEN_FILE:
|
||||
case FILE_MODE_OPEN_FILE:
|
||||
get_ok()->set_text(TTR("Open"));
|
||||
set_title(TTR("Open a File"));
|
||||
can_create_dir = false;
|
||||
break;
|
||||
case MODE_OPEN_FILES:
|
||||
case FILE_MODE_OPEN_FILES:
|
||||
get_ok()->set_text(TTR("Open"));
|
||||
set_title(TTR("Open File(s)"));
|
||||
can_create_dir = false;
|
||||
break;
|
||||
case MODE_OPEN_DIR:
|
||||
case FILE_MODE_OPEN_DIR:
|
||||
get_ok()->set_text(TTR("Open"));
|
||||
set_title(TTR("Open a Directory"));
|
||||
can_create_dir = true;
|
||||
break;
|
||||
case MODE_OPEN_ANY:
|
||||
case FILE_MODE_OPEN_ANY:
|
||||
get_ok()->set_text(TTR("Open"));
|
||||
set_title(TTR("Open a File or Directory"));
|
||||
can_create_dir = true;
|
||||
break;
|
||||
case MODE_SAVE_FILE:
|
||||
case FILE_MODE_SAVE_FILE:
|
||||
get_ok()->set_text(TTR("Save"));
|
||||
set_title(TTR("Save a File"));
|
||||
can_create_dir = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (mode == MODE_OPEN_FILES) {
|
||||
if (mode == FILE_MODE_OPEN_FILES) {
|
||||
item_list->set_select_mode(ItemList::SELECT_MULTI);
|
||||
} else {
|
||||
item_list->set_select_mode(ItemList::SELECT_SINGLE);
|
||||
|
|
@ -1043,7 +1046,7 @@ void EditorFileDialog::set_mode(Mode p_mode) {
|
|||
}
|
||||
}
|
||||
|
||||
EditorFileDialog::Mode EditorFileDialog::get_mode() const {
|
||||
EditorFileDialog::FileMode EditorFileDialog::get_file_mode() const {
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
|
@ -1077,7 +1080,7 @@ void EditorFileDialog::set_access(Access p_access) {
|
|||
|
||||
void EditorFileDialog::invalidate() {
|
||||
|
||||
if (is_visible_in_tree()) {
|
||||
if (is_visible()) {
|
||||
update_file_list();
|
||||
_update_favorites();
|
||||
invalidated = false;
|
||||
|
|
@ -1102,14 +1105,14 @@ void EditorFileDialog::_make_dir_confirm() {
|
|||
_push_history();
|
||||
EditorFileSystem::get_singleton()->scan_changes(); //we created a dir, so rescan changes
|
||||
} else {
|
||||
mkdirerr->popup_centered_minsize(Size2(250, 50) * EDSCALE);
|
||||
mkdirerr->popup_centered(Size2(250, 50) * EDSCALE);
|
||||
}
|
||||
makedirname->set_text(""); // reset label
|
||||
}
|
||||
|
||||
void EditorFileDialog::_make_dir() {
|
||||
|
||||
makedialog->popup_centered_minsize(Size2(250, 80) * EDSCALE);
|
||||
makedialog->popup_centered(Size2(250, 80) * EDSCALE);
|
||||
makedirname->grab_focus();
|
||||
}
|
||||
|
||||
|
|
@ -1224,8 +1227,8 @@ void EditorFileDialog::_update_favorites() {
|
|||
bool res = access == ACCESS_RESOURCES;
|
||||
|
||||
String current = get_current_dir();
|
||||
Ref<Texture2D> folder_icon = get_icon("Folder", "EditorIcons");
|
||||
const Color folder_color = get_color("folder_icon_modulate", "FileDialog");
|
||||
Ref<Texture2D> folder_icon = item_list->get_theme_icon("Folder", "EditorIcons");
|
||||
const Color folder_color = item_list->get_theme_color("folder_icon_modulate", "FileDialog");
|
||||
favorites->clear();
|
||||
|
||||
favorite->set_pressed(false);
|
||||
|
|
@ -1383,8 +1386,8 @@ void EditorFileDialog::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_current_dir", "dir"), &EditorFileDialog::set_current_dir);
|
||||
ClassDB::bind_method(D_METHOD("set_current_file", "file"), &EditorFileDialog::set_current_file);
|
||||
ClassDB::bind_method(D_METHOD("set_current_path", "path"), &EditorFileDialog::set_current_path);
|
||||
ClassDB::bind_method(D_METHOD("set_mode", "mode"), &EditorFileDialog::set_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_mode"), &EditorFileDialog::get_mode);
|
||||
ClassDB::bind_method(D_METHOD("set_file_mode", "mode"), &EditorFileDialog::set_file_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_file_mode"), &EditorFileDialog::get_file_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_vbox"), &EditorFileDialog::get_vbox);
|
||||
ClassDB::bind_method(D_METHOD("set_access", "access"), &EditorFileDialog::set_access);
|
||||
ClassDB::bind_method(D_METHOD("get_access"), &EditorFileDialog::get_access);
|
||||
|
|
@ -1408,18 +1411,18 @@ void EditorFileDialog::_bind_methods() {
|
|||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "access", PROPERTY_HINT_ENUM, "Resources,User data,File system"), "set_access", "get_access");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "display_mode", PROPERTY_HINT_ENUM, "Thumbnails,List"), "set_display_mode", "get_display_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Open one,Open many,Open folder,Open any,Save"), "set_mode", "get_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "file_mode", PROPERTY_HINT_ENUM, "Open one,Open many,Open folder,Open any,Save"), "set_file_mode", "get_file_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_dir", PROPERTY_HINT_DIR), "set_current_dir", "get_current_dir");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_file", PROPERTY_HINT_FILE, "*"), "set_current_file", "get_current_file");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_path"), "set_current_path", "get_current_path");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_hidden_files"), "set_show_hidden_files", "is_showing_hidden_files");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disable_overwrite_warning"), "set_disable_overwrite_warning", "is_overwrite_warning_disabled");
|
||||
|
||||
BIND_ENUM_CONSTANT(MODE_OPEN_FILE);
|
||||
BIND_ENUM_CONSTANT(MODE_OPEN_FILES);
|
||||
BIND_ENUM_CONSTANT(MODE_OPEN_DIR);
|
||||
BIND_ENUM_CONSTANT(MODE_OPEN_ANY);
|
||||
BIND_ENUM_CONSTANT(MODE_SAVE_FILE);
|
||||
BIND_ENUM_CONSTANT(FILE_MODE_OPEN_FILE);
|
||||
BIND_ENUM_CONSTANT(FILE_MODE_OPEN_FILES);
|
||||
BIND_ENUM_CONSTANT(FILE_MODE_OPEN_DIR);
|
||||
BIND_ENUM_CONSTANT(FILE_MODE_OPEN_ANY);
|
||||
BIND_ENUM_CONSTANT(FILE_MODE_SAVE_FILE);
|
||||
|
||||
BIND_ENUM_CONSTANT(ACCESS_RESOURCES);
|
||||
BIND_ENUM_CONSTANT(ACCESS_USERDATA);
|
||||
|
|
@ -1483,8 +1486,6 @@ bool EditorFileDialog::is_overwrite_warning_disabled() const {
|
|||
|
||||
EditorFileDialog::EditorFileDialog() {
|
||||
|
||||
set_resizable(true);
|
||||
|
||||
show_hidden_files = default_show_hidden_files;
|
||||
display_mode = default_display_mode;
|
||||
local_history_pos = 0;
|
||||
|
|
@ -1492,7 +1493,7 @@ EditorFileDialog::EditorFileDialog() {
|
|||
VBoxContainer *vbc = memnew(VBoxContainer);
|
||||
add_child(vbc);
|
||||
|
||||
mode = MODE_SAVE_FILE;
|
||||
mode = FILE_MODE_SAVE_FILE;
|
||||
set_title(TTR("Save a File"));
|
||||
|
||||
ED_SHORTCUT("file_dialog/go_back", TTR("Go Back"), KEY_MASK_ALT | KEY_LEFT);
|
||||
|
|
@ -1532,7 +1533,7 @@ EditorFileDialog::EditorFileDialog() {
|
|||
|
||||
dir = memnew(LineEdit);
|
||||
pathhb->add_child(dir);
|
||||
dir->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
dir->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
refresh = memnew(ToolButton);
|
||||
refresh->set_tooltip(TTR("Refresh files."));
|
||||
|
|
@ -1588,7 +1589,7 @@ EditorFileDialog::EditorFileDialog() {
|
|||
|
||||
vbc->add_child(pathhb);
|
||||
vbc->add_child(list_hb);
|
||||
list_hb->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
list_hb->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
VSplitContainer *vsc = memnew(VSplitContainer);
|
||||
list_hb->add_child(vsc);
|
||||
|
|
@ -1596,7 +1597,7 @@ EditorFileDialog::EditorFileDialog() {
|
|||
VBoxContainer *fav_vb = memnew(VBoxContainer);
|
||||
vsc->add_child(fav_vb);
|
||||
fav_vb->set_custom_minimum_size(Size2(150, 100) * EDSCALE);
|
||||
fav_vb->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
fav_vb->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
HBoxContainer *fav_hb = memnew(HBoxContainer);
|
||||
fav_vb->add_child(fav_hb);
|
||||
fav_hb->add_child(memnew(Label(TTR("Favorites:"))));
|
||||
|
|
@ -1610,13 +1611,13 @@ EditorFileDialog::EditorFileDialog() {
|
|||
|
||||
favorites = memnew(ItemList);
|
||||
fav_vb->add_child(favorites);
|
||||
favorites->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
favorites->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
favorites->connect("item_selected", callable_mp(this, &EditorFileDialog::_favorite_selected));
|
||||
|
||||
VBoxContainer *rec_vb = memnew(VBoxContainer);
|
||||
vsc->add_child(rec_vb);
|
||||
rec_vb->set_custom_minimum_size(Size2(150, 100) * EDSCALE);
|
||||
rec_vb->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
rec_vb->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
recent = memnew(ItemList);
|
||||
recent->set_allow_reselect(true);
|
||||
rec_vb->add_margin_child(TTR("Recent:"), recent, true);
|
||||
|
|
@ -1627,18 +1628,18 @@ EditorFileDialog::EditorFileDialog() {
|
|||
item_vb->set_custom_minimum_size(Size2(320, 0) * EDSCALE);
|
||||
|
||||
HBoxContainer *preview_hb = memnew(HBoxContainer);
|
||||
preview_hb->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
preview_hb->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
item_vb->add_child(preview_hb);
|
||||
|
||||
VBoxContainer *list_vb = memnew(VBoxContainer);
|
||||
list_vb->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
list_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
list_vb->add_child(memnew(Label(TTR("Directories & Files:"))));
|
||||
preview_hb->add_child(list_vb);
|
||||
|
||||
// Item (files and folders) list with context menu.
|
||||
|
||||
item_list = memnew(ItemList);
|
||||
item_list->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
item_list->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
item_list->connect("item_rmb_selected", callable_mp(this, &EditorFileDialog::_item_list_item_rmb_selected));
|
||||
item_list->connect("rmb_clicked", callable_mp(this, &EditorFileDialog::_item_list_rmb_clicked));
|
||||
item_list->set_allow_rmb_select(true);
|
||||
|
|
@ -1662,14 +1663,14 @@ EditorFileDialog::EditorFileDialog() {
|
|||
file_box->add_child(memnew(Label(TTR("File:"))));
|
||||
file = memnew(LineEdit);
|
||||
file->set_stretch_ratio(4);
|
||||
file->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
file->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
file_box->add_child(file);
|
||||
filter = memnew(OptionButton);
|
||||
filter->set_stretch_ratio(3);
|
||||
filter->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
filter->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
filter->set_clip_text(true); // Too many extensions overflow it.
|
||||
file_box->add_child(filter);
|
||||
file_box->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
file_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
item_vb->add_child(file_box);
|
||||
|
||||
dir_access = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
||||
|
|
@ -1686,7 +1687,7 @@ EditorFileDialog::EditorFileDialog() {
|
|||
filter->connect("item_selected", callable_mp(this, &EditorFileDialog::_filter_selected));
|
||||
|
||||
confirm_save = memnew(ConfirmationDialog);
|
||||
confirm_save->set_as_toplevel(true);
|
||||
//confirm_save->set_as_toplevel(true);
|
||||
add_child(confirm_save);
|
||||
confirm_save->connect("confirmed", callable_mp(this, &EditorFileDialog::_save_confirm_pressed));
|
||||
|
||||
|
|
@ -1736,7 +1737,7 @@ EditorFileDialog::~EditorFileDialog() {
|
|||
void EditorLineEditFileChooser::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED)
|
||||
button->set_icon(get_icon("Folder", "EditorIcons"));
|
||||
button->set_icon(get_theme_icon("Folder", "EditorIcons"));
|
||||
}
|
||||
|
||||
void EditorLineEditFileChooser::_bind_methods() {
|
||||
|
|
@ -1761,7 +1762,7 @@ EditorLineEditFileChooser::EditorLineEditFileChooser() {
|
|||
|
||||
line_edit = memnew(LineEdit);
|
||||
add_child(line_edit);
|
||||
line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
line_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
button = memnew(Button);
|
||||
add_child(button);
|
||||
button->connect("pressed", callable_mp(this, &EditorLineEditFileChooser::_browse));
|
||||
|
|
|
|||
|
|
@ -60,12 +60,12 @@ public:
|
|||
ACCESS_FILESYSTEM
|
||||
};
|
||||
|
||||
enum Mode {
|
||||
MODE_OPEN_FILE,
|
||||
MODE_OPEN_FILES,
|
||||
MODE_OPEN_DIR,
|
||||
MODE_OPEN_ANY,
|
||||
MODE_SAVE_FILE
|
||||
enum FileMode {
|
||||
FILE_MODE_OPEN_FILE,
|
||||
FILE_MODE_OPEN_FILES,
|
||||
FILE_MODE_OPEN_DIR,
|
||||
FILE_MODE_OPEN_ANY,
|
||||
FILE_MODE_SAVE_FILE
|
||||
};
|
||||
|
||||
typedef Ref<Texture2D> (*GetIconFunc)(const String &);
|
||||
|
|
@ -92,7 +92,7 @@ private:
|
|||
Access access;
|
||||
//Button *action;
|
||||
VBoxContainer *vbox;
|
||||
Mode mode;
|
||||
FileMode mode;
|
||||
bool can_create_dir;
|
||||
LineEdit *dir;
|
||||
|
||||
|
|
@ -221,8 +221,8 @@ public:
|
|||
void set_display_mode(DisplayMode p_mode);
|
||||
DisplayMode get_display_mode() const;
|
||||
|
||||
void set_mode(Mode p_mode);
|
||||
Mode get_mode() const;
|
||||
void set_file_mode(FileMode p_mode);
|
||||
FileMode get_file_mode() const;
|
||||
|
||||
VBoxContainer *get_vbox();
|
||||
LineEdit *get_line_edit() { return file; }
|
||||
|
|
@ -267,7 +267,7 @@ public:
|
|||
EditorLineEditFileChooser();
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(EditorFileDialog::Mode);
|
||||
VARIANT_ENUM_CAST(EditorFileDialog::FileMode);
|
||||
VARIANT_ENUM_CAST(EditorFileDialog::Access);
|
||||
VARIANT_ENUM_CAST(EditorFileDialog::DisplayMode);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include "editor_help.h"
|
||||
|
||||
#include "core/os/input.h"
|
||||
#include "core/input/input_filter.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "doc_data_compressed.gen.h"
|
||||
#include "editor/plugins/script_editor_plugin.h"
|
||||
|
|
@ -46,17 +46,17 @@ DocData *EditorHelp::doc = NULL;
|
|||
|
||||
void EditorHelp::_init_colors() {
|
||||
|
||||
title_color = get_color("accent_color", "Editor");
|
||||
text_color = get_color("default_color", "RichTextLabel");
|
||||
headline_color = get_color("headline_color", "EditorHelp");
|
||||
title_color = get_theme_color("accent_color", "Editor");
|
||||
text_color = get_theme_color("default_color", "RichTextLabel");
|
||||
headline_color = get_theme_color("headline_color", "EditorHelp");
|
||||
base_type_color = title_color.linear_interpolate(text_color, 0.5);
|
||||
comment_color = text_color * Color(1, 1, 1, 0.6);
|
||||
symbol_color = comment_color;
|
||||
value_color = text_color * Color(1, 1, 1, 0.6);
|
||||
qualifier_color = text_color * Color(1, 1, 1, 0.8);
|
||||
type_color = get_color("accent_color", "Editor").linear_interpolate(text_color, 0.5);
|
||||
class_desc->add_color_override("selection_color", get_color("accent_color", "Editor") * Color(1, 1, 1, 0.4));
|
||||
class_desc->add_constant_override("line_separation", Math::round(5 * EDSCALE));
|
||||
type_color = get_theme_color("accent_color", "Editor").linear_interpolate(text_color, 0.5);
|
||||
class_desc->add_theme_color_override("selection_color", get_theme_color("accent_color", "Editor") * Color(1, 1, 1, 0.4));
|
||||
class_desc->add_theme_constant_override("line_separation", Math::round(5 * EDSCALE));
|
||||
}
|
||||
|
||||
void EditorHelp::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
|
||||
|
|
@ -173,14 +173,14 @@ void EditorHelp::_class_desc_input(const Ref<InputEvent> &p_input) {
|
|||
void EditorHelp::_class_desc_resized() {
|
||||
// Add extra horizontal margins for better readability.
|
||||
// The margins increase as the width of the editor help container increases.
|
||||
Ref<Font> doc_code_font = get_font("doc_source", "EditorFonts");
|
||||
Ref<Font> doc_code_font = get_theme_font("doc_source", "EditorFonts");
|
||||
real_t char_width = doc_code_font->get_char_size('x').width;
|
||||
const int display_margin = MAX(30 * EDSCALE, get_parent_anchorable_rect().size.width - char_width * 120 * EDSCALE) * 0.5;
|
||||
|
||||
Ref<StyleBox> class_desc_stylebox = EditorNode::get_singleton()->get_theme_base()->get_stylebox("normal", "RichTextLabel")->duplicate();
|
||||
Ref<StyleBox> class_desc_stylebox = EditorNode::get_singleton()->get_theme_base()->get_theme_stylebox("normal", "RichTextLabel")->duplicate();
|
||||
class_desc_stylebox->set_default_margin(MARGIN_LEFT, display_margin);
|
||||
class_desc_stylebox->set_default_margin(MARGIN_RIGHT, display_margin);
|
||||
class_desc->add_style_override("normal", class_desc_stylebox);
|
||||
class_desc->add_theme_style_override("normal", class_desc_stylebox);
|
||||
}
|
||||
|
||||
void EditorHelp::_add_type(const String &p_type, const String &p_enum) {
|
||||
|
|
@ -197,8 +197,8 @@ void EditorHelp::_add_type(const String &p_type, const String &p_enum) {
|
|||
t = p_enum.get_slice(".", 0);
|
||||
}
|
||||
}
|
||||
const Color text_color = get_color("default_color", "RichTextLabel");
|
||||
const Color type_color = get_color("accent_color", "Editor").linear_interpolate(text_color, 0.5);
|
||||
const Color text_color = get_theme_color("default_color", "RichTextLabel");
|
||||
const Color type_color = get_theme_color("accent_color", "Editor").linear_interpolate(text_color, 0.5);
|
||||
class_desc->push_color(type_color);
|
||||
if (can_ref) {
|
||||
if (p_enum.empty()) {
|
||||
|
|
@ -346,10 +346,10 @@ void EditorHelp::_update_doc() {
|
|||
|
||||
DocData::ClassDoc cd = doc->class_list[edited_class]; //make a copy, so we can sort without worrying
|
||||
|
||||
Ref<Font> doc_font = get_font("doc", "EditorFonts");
|
||||
Ref<Font> doc_bold_font = get_font("doc_bold", "EditorFonts");
|
||||
Ref<Font> doc_title_font = get_font("doc_title", "EditorFonts");
|
||||
Ref<Font> doc_code_font = get_font("doc_source", "EditorFonts");
|
||||
Ref<Font> doc_font = get_theme_font("doc", "EditorFonts");
|
||||
Ref<Font> doc_bold_font = get_theme_font("doc_bold", "EditorFonts");
|
||||
Ref<Font> doc_title_font = get_theme_font("doc_title", "EditorFonts");
|
||||
Ref<Font> doc_code_font = get_theme_font("doc_source", "EditorFonts");
|
||||
String link_color_text = title_color.to_html(false);
|
||||
|
||||
// Class name
|
||||
|
|
@ -1072,7 +1072,7 @@ void EditorHelp::_update_doc() {
|
|||
if (cd.properties[i].description.strip_edges() != String()) {
|
||||
_add_text(DTR(cd.properties[i].description));
|
||||
} else {
|
||||
class_desc->add_image(get_icon("Error", "EditorIcons"));
|
||||
class_desc->add_image(get_theme_icon("Error", "EditorIcons"));
|
||||
class_desc->add_text(" ");
|
||||
class_desc->push_color(comment_color);
|
||||
class_desc->append_bbcode(TTR("There is currently no description for this property. Please help us by [color=$color][url=$url]contributing one[/url][/color]!").replace("$url", CONTRIBUTE_URL).replace("$color", link_color_text));
|
||||
|
|
@ -1125,7 +1125,7 @@ void EditorHelp::_update_doc() {
|
|||
if (methods_filtered[i].description.strip_edges() != String()) {
|
||||
_add_text(DTR(methods_filtered[i].description));
|
||||
} else {
|
||||
class_desc->add_image(get_icon("Error", "EditorIcons"));
|
||||
class_desc->add_image(get_theme_icon("Error", "EditorIcons"));
|
||||
class_desc->add_text(" ");
|
||||
class_desc->push_color(comment_color);
|
||||
class_desc->append_bbcode(TTR("There is currently no description for this method. Please help us by [color=$color][url=$url]contributing one[/url][/color]!").replace("$url", CONTRIBUTE_URL).replace("$color", link_color_text));
|
||||
|
|
@ -1209,12 +1209,12 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
|
|||
DocData *doc = EditorHelp::get_doc_data();
|
||||
String base_path;
|
||||
|
||||
Ref<Font> doc_font = p_rt->get_font("doc", "EditorFonts");
|
||||
Ref<Font> doc_bold_font = p_rt->get_font("doc_bold", "EditorFonts");
|
||||
Ref<Font> doc_code_font = p_rt->get_font("doc_source", "EditorFonts");
|
||||
Ref<Font> doc_font = p_rt->get_theme_font("doc", "EditorFonts");
|
||||
Ref<Font> doc_bold_font = p_rt->get_theme_font("doc_bold", "EditorFonts");
|
||||
Ref<Font> doc_code_font = p_rt->get_theme_font("doc_source", "EditorFonts");
|
||||
|
||||
Color font_color_hl = p_rt->get_color("headline_color", "EditorHelp");
|
||||
Color accent_color = p_rt->get_color("accent_color", "Editor");
|
||||
Color font_color_hl = p_rt->get_theme_color("headline_color", "EditorHelp");
|
||||
Color accent_color = p_rt->get_theme_color("accent_color", "Editor");
|
||||
Color link_color = accent_color.linear_interpolate(font_color_hl, 0.8);
|
||||
Color code_color = accent_color.linear_interpolate(font_color_hl, 0.6);
|
||||
|
||||
|
|
@ -1545,7 +1545,7 @@ EditorHelp::EditorHelp() {
|
|||
class_desc = memnew(RichTextLabel);
|
||||
add_child(class_desc);
|
||||
class_desc->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
class_desc->add_color_override("selection_color", get_color("accent_color", "Editor") * Color(1, 1, 1, 0.4));
|
||||
class_desc->add_theme_color_override("selection_color", get_theme_color("accent_color", "Editor") * Color(1, 1, 1, 0.4));
|
||||
|
||||
class_desc->connect("meta_clicked", callable_mp(this, &EditorHelp::_class_desc_select));
|
||||
class_desc->connect("gui_input", callable_mp(this, &EditorHelp::_class_desc_input));
|
||||
|
|
@ -1610,9 +1610,14 @@ void EditorHelpBit::_bind_methods() {
|
|||
void EditorHelpBit::_notification(int p_what) {
|
||||
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_READY: {
|
||||
rich_text->clear();
|
||||
_add_text_to_rt(text, rich_text);
|
||||
|
||||
} break;
|
||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||
|
||||
rich_text->add_color_override("selection_color", get_color("accent_color", "Editor") * Color(1, 1, 1, 0.4));
|
||||
rich_text->add_theme_color_override("selection_color", get_theme_color("accent_color", "Editor") * Color(1, 1, 1, 0.4));
|
||||
} break;
|
||||
default: break;
|
||||
}
|
||||
|
|
@ -1620,8 +1625,9 @@ void EditorHelpBit::_notification(int p_what) {
|
|||
|
||||
void EditorHelpBit::set_text(const String &p_text) {
|
||||
|
||||
text = p_text;
|
||||
rich_text->clear();
|
||||
_add_text_to_rt(p_text, rich_text);
|
||||
_add_text_to_rt(text, rich_text);
|
||||
}
|
||||
|
||||
EditorHelpBit::EditorHelpBit() {
|
||||
|
|
@ -1629,7 +1635,7 @@ EditorHelpBit::EditorHelpBit() {
|
|||
rich_text = memnew(RichTextLabel);
|
||||
add_child(rich_text);
|
||||
rich_text->connect("meta_clicked", callable_mp(this, &EditorHelpBit::_meta_clicked));
|
||||
rich_text->add_color_override("selection_color", get_color("accent_color", "Editor") * Color(1, 1, 1, 0.4));
|
||||
rich_text->add_theme_color_override("selection_color", get_theme_color("accent_color", "Editor") * Color(1, 1, 1, 0.4));
|
||||
rich_text->set_override_selected_font_color(false);
|
||||
set_custom_minimum_size(Size2(0, 70 * EDSCALE));
|
||||
}
|
||||
|
|
@ -1693,13 +1699,13 @@ void FindBar::_notification(int p_what) {
|
|||
case NOTIFICATION_ENTER_TREE:
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
|
||||
find_prev->set_icon(get_icon("MoveUp", "EditorIcons"));
|
||||
find_next->set_icon(get_icon("MoveDown", "EditorIcons"));
|
||||
hide_button->set_normal_texture(get_icon("Close", "EditorIcons"));
|
||||
hide_button->set_hover_texture(get_icon("Close", "EditorIcons"));
|
||||
hide_button->set_pressed_texture(get_icon("Close", "EditorIcons"));
|
||||
find_prev->set_icon(get_theme_icon("MoveUp", "EditorIcons"));
|
||||
find_next->set_icon(get_theme_icon("MoveDown", "EditorIcons"));
|
||||
hide_button->set_normal_texture(get_theme_icon("Close", "EditorIcons"));
|
||||
hide_button->set_hover_texture(get_theme_icon("Close", "EditorIcons"));
|
||||
hide_button->set_pressed_texture(get_theme_icon("Close", "EditorIcons"));
|
||||
hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size());
|
||||
matches_label->add_color_override("font_color", results_count > 0 ? get_color("font_color", "Label") : get_color("error_color", "Editor"));
|
||||
matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color("font_color", "Label") : get_theme_color("error_color", "Editor"));
|
||||
} break;
|
||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||
|
||||
|
|
@ -1780,7 +1786,7 @@ void FindBar::_update_matches_label() {
|
|||
} else {
|
||||
matches_label->show();
|
||||
|
||||
matches_label->add_color_override("font_color", results_count > 0 ? get_color("font_color", "Label") : get_color("error_color", "Editor"));
|
||||
matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color("font_color", "Label") : get_theme_color("error_color", "Editor"));
|
||||
matches_label->set_text(vformat(results_count == 1 ? TTR("%d match.") : TTR("%d matches."), results_count));
|
||||
}
|
||||
}
|
||||
|
|
@ -1828,7 +1834,7 @@ void FindBar::_search_text_changed(const String &p_text) {
|
|||
|
||||
void FindBar::_search_text_entered(const String &p_text) {
|
||||
|
||||
if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
|
||||
if (InputFilter::get_singleton()->is_key_pressed(KEY_SHIFT)) {
|
||||
search_prev();
|
||||
} else {
|
||||
search_next();
|
||||
|
|
|
|||
|
|
@ -200,6 +200,8 @@ class EditorHelpBit : public PanelContainer {
|
|||
void _go_to_help(String p_what);
|
||||
void _meta_clicked(String p_select);
|
||||
|
||||
String text;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
void _notification(int p_what);
|
||||
|
|
|
|||
|
|
@ -37,13 +37,13 @@
|
|||
|
||||
void EditorHelpSearch::_update_icons() {
|
||||
|
||||
search_box->set_right_icon(get_icon("Search", "EditorIcons"));
|
||||
search_box->set_right_icon(results_tree->get_theme_icon("Search", "EditorIcons"));
|
||||
search_box->set_clear_button_enabled(true);
|
||||
search_box->add_icon_override("right_icon", get_icon("Search", "EditorIcons"));
|
||||
case_sensitive_button->set_icon(get_icon("MatchCase", "EditorIcons"));
|
||||
hierarchy_button->set_icon(get_icon("ClassList", "EditorIcons"));
|
||||
search_box->add_theme_icon_override("right_icon", results_tree->get_theme_icon("Search", "EditorIcons"));
|
||||
case_sensitive_button->set_icon(results_tree->get_theme_icon("MatchCase", "EditorIcons"));
|
||||
hierarchy_button->set_icon(results_tree->get_theme_icon("ClassList", "EditorIcons"));
|
||||
|
||||
if (is_visible_in_tree())
|
||||
if (is_visible())
|
||||
_update_results();
|
||||
}
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ void EditorHelpSearch::_update_results() {
|
|||
if (hierarchy_button->is_pressed())
|
||||
search_flags |= SEARCH_SHOW_HIERARCHY;
|
||||
|
||||
search = Ref<Runner>(memnew(Runner(this, results_tree, term, search_flags)));
|
||||
search = Ref<Runner>(memnew(Runner(results_tree, results_tree, term, search_flags)));
|
||||
set_process(true);
|
||||
}
|
||||
|
||||
|
|
@ -105,6 +105,13 @@ void EditorHelpSearch::_confirmed() {
|
|||
void EditorHelpSearch::_notification(int p_what) {
|
||||
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||
if (!is_visible()) {
|
||||
results_tree->call_deferred("clear"); // Wait for the Tree's mouse event propagation.
|
||||
get_ok()->set_disabled(true);
|
||||
EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "search_help", Rect2(get_position(), get_size()));
|
||||
}
|
||||
} break;
|
||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||
|
||||
_update_icons();
|
||||
|
|
@ -114,12 +121,7 @@ void EditorHelpSearch::_notification(int p_what) {
|
|||
connect("confirmed", callable_mp(this, &EditorHelpSearch::_confirmed));
|
||||
_update_icons();
|
||||
} break;
|
||||
case NOTIFICATION_POPUP_HIDE: {
|
||||
|
||||
results_tree->call_deferred("clear"); // Wait for the Tree's mouse event propagation.
|
||||
get_ok()->set_disabled(true);
|
||||
EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "search_help", get_rect());
|
||||
} break;
|
||||
case NOTIFICATION_PROCESS: {
|
||||
|
||||
// Update background search.
|
||||
|
|
@ -184,7 +186,7 @@ EditorHelpSearch::EditorHelpSearch() {
|
|||
old_search = false;
|
||||
|
||||
set_hide_on_ok(false);
|
||||
set_resizable(true);
|
||||
|
||||
set_title(TTR("Search Help"));
|
||||
|
||||
get_ok()->set_disabled(true);
|
||||
|
|
@ -200,7 +202,7 @@ EditorHelpSearch::EditorHelpSearch() {
|
|||
|
||||
search_box = memnew(LineEdit);
|
||||
search_box->set_custom_minimum_size(Size2(200, 0) * EDSCALE);
|
||||
search_box->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
search_box->connect("gui_input", callable_mp(this, &EditorHelpSearch::_search_box_gui_input));
|
||||
search_box->connect("text_changed", callable_mp(this, &EditorHelpSearch::_search_box_text_changed));
|
||||
register_text_enter(search_box);
|
||||
|
|
@ -210,7 +212,7 @@ EditorHelpSearch::EditorHelpSearch() {
|
|||
case_sensitive_button->set_tooltip(TTR("Case Sensitive"));
|
||||
case_sensitive_button->connect("pressed", callable_mp(this, &EditorHelpSearch::_update_results));
|
||||
case_sensitive_button->set_toggle_mode(true);
|
||||
case_sensitive_button->set_focus_mode(FOCUS_NONE);
|
||||
case_sensitive_button->set_focus_mode(Control::FOCUS_NONE);
|
||||
hbox->add_child(case_sensitive_button);
|
||||
|
||||
hierarchy_button = memnew(ToolButton);
|
||||
|
|
@ -218,7 +220,7 @@ EditorHelpSearch::EditorHelpSearch() {
|
|||
hierarchy_button->connect("pressed", callable_mp(this, &EditorHelpSearch::_update_results));
|
||||
hierarchy_button->set_toggle_mode(true);
|
||||
hierarchy_button->set_pressed(true);
|
||||
hierarchy_button->set_focus_mode(FOCUS_NONE);
|
||||
hierarchy_button->set_focus_mode(Control::FOCUS_NONE);
|
||||
hbox->add_child(hierarchy_button);
|
||||
|
||||
filter_combo = memnew(OptionButton);
|
||||
|
|
@ -237,7 +239,7 @@ EditorHelpSearch::EditorHelpSearch() {
|
|||
|
||||
// Create the results tree.
|
||||
results_tree = memnew(Tree);
|
||||
results_tree->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
results_tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
results_tree->set_columns(2);
|
||||
results_tree->set_column_title(0, TTR("Name"));
|
||||
results_tree->set_column_title(1, TTR("Member Type"));
|
||||
|
|
@ -479,10 +481,10 @@ TreeItem *EditorHelpSearch::Runner::_create_class_hierarchy(const ClassMatch &p_
|
|||
TreeItem *EditorHelpSearch::Runner::_create_class_item(TreeItem *p_parent, const DocData::ClassDoc *p_doc, bool p_gray) {
|
||||
|
||||
Ref<Texture2D> icon = empty_icon;
|
||||
if (ui_service->has_icon(p_doc->name, "EditorIcons"))
|
||||
icon = ui_service->get_icon(p_doc->name, "EditorIcons");
|
||||
if (ui_service->has_theme_icon(p_doc->name, "EditorIcons"))
|
||||
icon = ui_service->get_theme_icon(p_doc->name, "EditorIcons");
|
||||
else if (ClassDB::class_exists(p_doc->name) && ClassDB::is_parent_class(p_doc->name, "Object"))
|
||||
icon = ui_service->get_icon("Object", "EditorIcons");
|
||||
icon = ui_service->get_theme_icon("Object", "EditorIcons");
|
||||
String tooltip = p_doc->brief_description.strip_edges();
|
||||
|
||||
TreeItem *item = results_tree->create_item(p_parent);
|
||||
|
|
@ -557,10 +559,10 @@ TreeItem *EditorHelpSearch::Runner::_create_member_item(TreeItem *p_parent, cons
|
|||
Ref<Texture2D> icon;
|
||||
String text;
|
||||
if (search_flags & SEARCH_SHOW_HIERARCHY) {
|
||||
icon = ui_service->get_icon(p_icon, "EditorIcons");
|
||||
icon = ui_service->get_theme_icon(p_icon, "EditorIcons");
|
||||
text = p_name;
|
||||
} else {
|
||||
icon = ui_service->get_icon(p_icon, "EditorIcons");
|
||||
icon = ui_service->get_theme_icon(p_icon, "EditorIcons");
|
||||
/*// In flat mode, show the class icon.
|
||||
if (ui_service->has_icon(p_class_name, "EditorIcons"))
|
||||
icon = ui_service->get_icon(p_class_name, "EditorIcons");
|
||||
|
|
@ -598,6 +600,6 @@ EditorHelpSearch::Runner::Runner(Control *p_icon_service, Tree *p_results_tree,
|
|||
results_tree(p_results_tree),
|
||||
term((p_search_flags & SEARCH_CASE_SENSITIVE) == 0 ? p_term.strip_edges().to_lower() : p_term.strip_edges()),
|
||||
search_flags(p_search_flags),
|
||||
empty_icon(ui_service->get_icon("ArrowRight", "EditorIcons")),
|
||||
disabled_color(ui_service->get_color("disabled_font_color", "Editor")) {
|
||||
empty_icon(ui_service->get_theme_icon("ArrowRight", "EditorIcons")),
|
||||
disabled_color(ui_service->get_theme_color("disabled_font_color", "Editor")) {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
Size2 EditorProperty::get_minimum_size() const {
|
||||
|
||||
Size2 ms;
|
||||
Ref<Font> font = get_font("font", "Tree");
|
||||
Ref<Font> font = get_theme_font("font", "Tree");
|
||||
ms.height = font->get_height();
|
||||
|
||||
for (int i = 0; i < get_child_count(); i++) {
|
||||
|
|
@ -62,17 +62,17 @@ Size2 EditorProperty::get_minimum_size() const {
|
|||
}
|
||||
|
||||
if (keying) {
|
||||
Ref<Texture2D> key = get_icon("Key", "EditorIcons");
|
||||
ms.width += key->get_width() + get_constant("hseparator", "Tree");
|
||||
Ref<Texture2D> key = get_theme_icon("Key", "EditorIcons");
|
||||
ms.width += key->get_width() + get_theme_constant("hseparator", "Tree");
|
||||
}
|
||||
|
||||
if (checkable) {
|
||||
Ref<Texture2D> check = get_icon("checked", "CheckBox");
|
||||
ms.width += check->get_width() + get_constant("hseparation", "CheckBox") + get_constant("hseparator", "Tree");
|
||||
Ref<Texture2D> check = get_theme_icon("checked", "CheckBox");
|
||||
ms.width += check->get_width() + get_theme_constant("hseparation", "CheckBox") + get_theme_constant("hseparator", "Tree");
|
||||
}
|
||||
|
||||
if (bottom_editor != NULL && bottom_editor->is_visible()) {
|
||||
ms.height += get_constant("vseparation", "Tree");
|
||||
ms.height += get_theme_constant("vseparation", "Tree");
|
||||
Size2 bems = bottom_editor->get_combined_minimum_size();
|
||||
//bems.width += get_constant("item_margin", "Tree");
|
||||
ms.height += bems.height;
|
||||
|
|
@ -103,7 +103,7 @@ void EditorProperty::_notification(int p_what) {
|
|||
|
||||
{
|
||||
int child_room = size.width * (1.0 - split_ratio);
|
||||
Ref<Font> font = get_font("font", "Tree");
|
||||
Ref<Font> font = get_theme_font("font", "Tree");
|
||||
int height = font->get_height();
|
||||
bool no_children = true;
|
||||
|
||||
|
|
@ -136,19 +136,19 @@ void EditorProperty::_notification(int p_what) {
|
|||
|
||||
int m = 0; //get_constant("item_margin", "Tree");
|
||||
|
||||
bottom_rect = Rect2(m, rect.size.height + get_constant("vseparation", "Tree"), size.width - m, bottom_editor->get_combined_minimum_size().height);
|
||||
bottom_rect = Rect2(m, rect.size.height + get_theme_constant("vseparation", "Tree"), size.width - m, bottom_editor->get_combined_minimum_size().height);
|
||||
}
|
||||
|
||||
if (keying) {
|
||||
Ref<Texture2D> key;
|
||||
|
||||
if (use_keying_next()) {
|
||||
key = get_icon("KeyNext", "EditorIcons");
|
||||
key = get_theme_icon("KeyNext", "EditorIcons");
|
||||
} else {
|
||||
key = get_icon("Key", "EditorIcons");
|
||||
key = get_theme_icon("Key", "EditorIcons");
|
||||
}
|
||||
|
||||
rect.size.x -= key->get_width() + get_constant("hseparator", "Tree");
|
||||
rect.size.x -= key->get_width() + get_theme_constant("hseparator", "Tree");
|
||||
|
||||
if (no_children) {
|
||||
text_size -= key->get_width() + 4 * EDSCALE;
|
||||
|
|
@ -180,8 +180,8 @@ void EditorProperty::_notification(int p_what) {
|
|||
}
|
||||
|
||||
if (p_what == NOTIFICATION_DRAW) {
|
||||
Ref<Font> font = get_font("font", "Tree");
|
||||
Color dark_color = get_color("dark_color_2", "Editor");
|
||||
Ref<Font> font = get_theme_font("font", "Tree");
|
||||
Color dark_color = get_theme_color("dark_color_2", "Editor");
|
||||
|
||||
Size2 size = get_size();
|
||||
if (bottom_editor) {
|
||||
|
|
@ -191,7 +191,7 @@ void EditorProperty::_notification(int p_what) {
|
|||
}
|
||||
|
||||
if (selected) {
|
||||
Ref<StyleBox> sb = get_stylebox("selected", "Tree");
|
||||
Ref<StyleBox> sb = get_theme_stylebox("selected", "Tree");
|
||||
draw_style_box(sb, Rect2(Vector2(), size));
|
||||
}
|
||||
|
||||
|
|
@ -204,9 +204,9 @@ void EditorProperty::_notification(int p_what) {
|
|||
|
||||
Color color;
|
||||
if (draw_red) {
|
||||
color = get_color("error_color", "Editor");
|
||||
color = get_theme_color("error_color", "Editor");
|
||||
} else {
|
||||
color = get_color("property_color", "Editor");
|
||||
color = get_theme_color("property_color", "Editor");
|
||||
}
|
||||
if (label.find(".") != -1) {
|
||||
color.a = 0.5; //this should be un-hacked honestly, as it's used for editor overrides
|
||||
|
|
@ -218,9 +218,9 @@ void EditorProperty::_notification(int p_what) {
|
|||
if (checkable) {
|
||||
Ref<Texture2D> checkbox;
|
||||
if (checked)
|
||||
checkbox = get_icon("GuiChecked", "EditorIcons");
|
||||
checkbox = get_theme_icon("GuiChecked", "EditorIcons");
|
||||
else
|
||||
checkbox = get_icon("GuiUnchecked", "EditorIcons");
|
||||
checkbox = get_theme_icon("GuiUnchecked", "EditorIcons");
|
||||
|
||||
Color color2(1, 1, 1);
|
||||
if (check_hover) {
|
||||
|
|
@ -230,16 +230,16 @@ void EditorProperty::_notification(int p_what) {
|
|||
}
|
||||
check_rect = Rect2(ofs, ((size.height - checkbox->get_height()) / 2), checkbox->get_width(), checkbox->get_height());
|
||||
draw_texture(checkbox, check_rect.position, color2);
|
||||
ofs += get_constant("hseparator", "Tree") + checkbox->get_width() + get_constant("hseparation", "CheckBox");
|
||||
ofs += get_theme_constant("hseparator", "Tree") + checkbox->get_width() + get_theme_constant("hseparation", "CheckBox");
|
||||
text_limit -= ofs;
|
||||
} else {
|
||||
check_rect = Rect2();
|
||||
}
|
||||
|
||||
if (can_revert) {
|
||||
Ref<Texture2D> reload_icon = get_icon("ReloadSmall", "EditorIcons");
|
||||
text_limit -= reload_icon->get_width() + get_constant("hseparator", "Tree") * 2;
|
||||
revert_rect = Rect2(text_limit + get_constant("hseparator", "Tree"), (size.height - reload_icon->get_height()) / 2, reload_icon->get_width(), reload_icon->get_height());
|
||||
Ref<Texture2D> reload_icon = get_theme_icon("ReloadSmall", "EditorIcons");
|
||||
text_limit -= reload_icon->get_width() + get_theme_constant("hseparator", "Tree") * 2;
|
||||
revert_rect = Rect2(text_limit + get_theme_constant("hseparator", "Tree"), (size.height - reload_icon->get_height()) / 2, reload_icon->get_width(), reload_icon->get_height());
|
||||
|
||||
Color color2(1, 1, 1);
|
||||
if (revert_hover) {
|
||||
|
|
@ -260,12 +260,12 @@ void EditorProperty::_notification(int p_what) {
|
|||
Ref<Texture2D> key;
|
||||
|
||||
if (use_keying_next()) {
|
||||
key = get_icon("KeyNext", "EditorIcons");
|
||||
key = get_theme_icon("KeyNext", "EditorIcons");
|
||||
} else {
|
||||
key = get_icon("Key", "EditorIcons");
|
||||
key = get_theme_icon("Key", "EditorIcons");
|
||||
}
|
||||
|
||||
ofs = size.width - key->get_width() - get_constant("hseparator", "Tree");
|
||||
ofs = size.width - key->get_width() - get_theme_constant("hseparator", "Tree");
|
||||
|
||||
Color color2(1, 1, 1);
|
||||
if (keying_hover) {
|
||||
|
|
@ -776,13 +776,14 @@ Control *EditorProperty::make_custom_tooltip(const String &p_text) const {
|
|||
|
||||
tooltip_text = p_text;
|
||||
EditorHelpBit *help_bit = memnew(EditorHelpBit);
|
||||
help_bit->add_style_override("panel", get_stylebox("panel", "TooltipPanel"));
|
||||
//help_bit->add_theme_style_override("panel", get_theme_stylebox("panel", "TooltipPanel"));
|
||||
help_bit->get_rich_text()->set_fixed_size_to_width(360 * EDSCALE);
|
||||
|
||||
String text;
|
||||
PackedStringArray slices = p_text.split("::", false);
|
||||
if (!slices.empty()) {
|
||||
String property_name = slices[0].strip_edges();
|
||||
String text = TTR("Property:") + " [u][b]" + property_name + "[/b][/u]";
|
||||
text = TTR("Property:") + " [u][b]" + property_name + "[/b][/u]";
|
||||
|
||||
if (slices.size() > 1) {
|
||||
String property_doc = slices[1].strip_edges();
|
||||
|
|
@ -790,7 +791,7 @@ Control *EditorProperty::make_custom_tooltip(const String &p_text) const {
|
|||
text += "\n" + property_doc;
|
||||
}
|
||||
}
|
||||
help_bit->call_deferred("set_text", text); //hack so it uses proper theme once inside scene
|
||||
help_bit->set_text(text);
|
||||
}
|
||||
|
||||
return help_bit;
|
||||
|
|
@ -987,9 +988,9 @@ void EditorInspectorCategory::_notification(int p_what) {
|
|||
if (p_what == NOTIFICATION_DRAW) {
|
||||
|
||||
draw_rect(Rect2(Vector2(), get_size()), bg_color);
|
||||
Ref<Font> font = get_font("font", "Tree");
|
||||
Ref<Font> font = get_theme_font("font", "Tree");
|
||||
|
||||
int hs = get_constant("hseparation", "Tree");
|
||||
int hs = get_theme_constant("hseparation", "Tree");
|
||||
|
||||
int w = font->get_string_size(label).width;
|
||||
if (icon.is_valid()) {
|
||||
|
|
@ -1003,7 +1004,7 @@ void EditorInspectorCategory::_notification(int p_what) {
|
|||
ofs += hs + icon->get_width();
|
||||
}
|
||||
|
||||
Color color = get_color("font_color", "Tree");
|
||||
Color color = get_theme_color("font_color", "Tree");
|
||||
draw_string(font, Point2(ofs, font->get_ascent() + (get_size().height - font->get_height()) / 2).floor(), label, color, get_size().width);
|
||||
}
|
||||
}
|
||||
|
|
@ -1012,7 +1013,7 @@ Control *EditorInspectorCategory::make_custom_tooltip(const String &p_text) cons
|
|||
|
||||
tooltip_text = p_text;
|
||||
EditorHelpBit *help_bit = memnew(EditorHelpBit);
|
||||
help_bit->add_style_override("panel", get_stylebox("panel", "TooltipPanel"));
|
||||
help_bit->add_theme_style_override("panel", get_theme_stylebox("panel", "TooltipPanel"));
|
||||
help_bit->get_rich_text()->set_fixed_size_to_width(360 * EDSCALE);
|
||||
|
||||
PackedStringArray slices = p_text.split("::", false);
|
||||
|
|
@ -1026,7 +1027,7 @@ Control *EditorInspectorCategory::make_custom_tooltip(const String &p_text) cons
|
|||
text += "\n" + property_doc;
|
||||
}
|
||||
}
|
||||
help_bit->call_deferred("set_text", text); //hack so it uses proper theme once inside scene
|
||||
help_bit->set_text(text); //hack so it uses proper theme once inside scene
|
||||
}
|
||||
|
||||
return help_bit;
|
||||
|
|
@ -1034,7 +1035,7 @@ Control *EditorInspectorCategory::make_custom_tooltip(const String &p_text) cons
|
|||
|
||||
Size2 EditorInspectorCategory::get_minimum_size() const {
|
||||
|
||||
Ref<Font> font = get_font("font", "Tree");
|
||||
Ref<Font> font = get_theme_font("font", "Tree");
|
||||
|
||||
Size2 ms;
|
||||
ms.width = 1;
|
||||
|
|
@ -1042,7 +1043,7 @@ Size2 EditorInspectorCategory::get_minimum_size() const {
|
|||
if (icon.is_valid()) {
|
||||
ms.height = MAX(icon->get_height(), ms.height);
|
||||
}
|
||||
ms.height += get_constant("vseparation", "Tree");
|
||||
ms.height += get_theme_constant("vseparation", "Tree");
|
||||
|
||||
return ms;
|
||||
}
|
||||
|
|
@ -1074,14 +1075,14 @@ void EditorInspectorSection::_notification(int p_what) {
|
|||
|
||||
if (p_what == NOTIFICATION_SORT_CHILDREN) {
|
||||
|
||||
Ref<Font> font = get_font("font", "Tree");
|
||||
Ref<Font> font = get_theme_font("font", "Tree");
|
||||
Ref<Texture2D> arrow;
|
||||
|
||||
if (foldable) {
|
||||
if (object->editor_is_section_unfolded(section)) {
|
||||
arrow = get_icon("arrow", "Tree");
|
||||
arrow = get_theme_icon("arrow", "Tree");
|
||||
} else {
|
||||
arrow = get_icon("arrow_collapsed", "Tree");
|
||||
arrow = get_theme_icon("arrow_collapsed", "Tree");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1092,8 +1093,8 @@ void EditorInspectorSection::_notification(int p_what) {
|
|||
offset.y = MAX(offset.y, arrow->get_height());
|
||||
}
|
||||
|
||||
offset.y += get_constant("vseparation", "Tree");
|
||||
offset.x += get_constant("inspector_margin", "Editor");
|
||||
offset.y += get_theme_constant("vseparation", "Tree");
|
||||
offset.x += get_theme_constant("inspector_margin", "Editor");
|
||||
|
||||
Rect2 rect(offset, size - offset);
|
||||
|
||||
|
|
@ -1120,24 +1121,24 @@ void EditorInspectorSection::_notification(int p_what) {
|
|||
|
||||
if (foldable) {
|
||||
if (object->editor_is_section_unfolded(section)) {
|
||||
arrow = get_icon("arrow", "Tree");
|
||||
arrow = get_theme_icon("arrow", "Tree");
|
||||
} else {
|
||||
arrow = get_icon("arrow_collapsed", "Tree");
|
||||
arrow = get_theme_icon("arrow_collapsed", "Tree");
|
||||
}
|
||||
}
|
||||
|
||||
Ref<Font> font = get_font("font", "Tree");
|
||||
Ref<Font> font = get_theme_font("font", "Tree");
|
||||
|
||||
int h = font->get_height();
|
||||
if (arrow.is_valid()) {
|
||||
h = MAX(h, arrow->get_height());
|
||||
}
|
||||
h += get_constant("vseparation", "Tree");
|
||||
h += get_theme_constant("vseparation", "Tree");
|
||||
|
||||
draw_rect(Rect2(Vector2(), Vector2(get_size().width, h)), bg_color);
|
||||
|
||||
const int arrow_margin = 3;
|
||||
Color color = get_color("font_color", "Tree");
|
||||
Color color = get_theme_color("font_color", "Tree");
|
||||
draw_string(font, Point2(Math::round((16 + arrow_margin) * EDSCALE), font->get_ascent() + (h - font->get_height()) / 2).floor(), label, color, get_size().width);
|
||||
|
||||
if (arrow.is_valid()) {
|
||||
|
|
@ -1163,9 +1164,9 @@ Size2 EditorInspectorSection::get_minimum_size() const {
|
|||
ms.height = MAX(ms.height, minsize.height);
|
||||
}
|
||||
|
||||
Ref<Font> font = get_font("font", "Tree");
|
||||
ms.height += font->get_height() + get_constant("vseparation", "Tree");
|
||||
ms.width += get_constant("inspector_margin", "Editor");
|
||||
Ref<Font> font = get_theme_font("font", "Tree");
|
||||
ms.height += font->get_height() + get_theme_constant("vseparation", "Tree");
|
||||
ms.width += get_theme_constant("inspector_margin", "Editor");
|
||||
|
||||
return ms;
|
||||
}
|
||||
|
|
@ -1201,7 +1202,7 @@ void EditorInspectorSection::_gui_input(const Ref<InputEvent> &p_event) {
|
|||
Ref<InputEventMouseButton> mb = p_event;
|
||||
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
||||
|
||||
Ref<Font> font = get_font("font", "Tree");
|
||||
Ref<Font> font = get_theme_font("font", "Tree");
|
||||
if (mb->get_position().y > font->get_height()) { //clicked outside
|
||||
return;
|
||||
}
|
||||
|
|
@ -1488,7 +1489,7 @@ void EditorInspector::update_tree() {
|
|||
|
||||
item_path[""] = main_vbox;
|
||||
|
||||
Color sscolor = get_color("prop_subsection", "Editor");
|
||||
Color sscolor = get_theme_color("prop_subsection", "Editor");
|
||||
|
||||
for (List<Ref<EditorInspectorPlugin>>::Element *E = valid_plugins.front(); E; E = E->next()) {
|
||||
Ref<EditorInspectorPlugin> ped = E->get();
|
||||
|
|
@ -1540,7 +1541,7 @@ void EditorInspector::update_tree() {
|
|||
category->icon = EditorNode::get_singleton()->get_class_icon(type, "Object");
|
||||
category->label = type;
|
||||
|
||||
category->bg_color = get_color("prop_category", "Editor");
|
||||
category->bg_color = get_theme_color("prop_category", "Editor");
|
||||
if (use_doc_hints) {
|
||||
StringName type2 = p.name;
|
||||
if (!class_descr_cache.has(type2)) {
|
||||
|
|
@ -1978,9 +1979,9 @@ void EditorInspector::set_sub_inspector(bool p_enable) {
|
|||
return;
|
||||
|
||||
if (sub_inspector) {
|
||||
add_style_override("bg", get_stylebox("sub_inspector_bg", "Editor"));
|
||||
add_theme_style_override("bg", get_theme_stylebox("sub_inspector_bg", "Editor"));
|
||||
} else {
|
||||
add_style_override("bg", get_stylebox("bg", "Tree"));
|
||||
add_theme_style_override("bg", get_theme_stylebox("bg", "Tree"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2203,9 +2204,9 @@ void EditorInspector::_notification(int p_what) {
|
|||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||
|
||||
if (sub_inspector) {
|
||||
add_style_override("bg", get_stylebox("sub_inspector_bg", "Editor"));
|
||||
add_theme_style_override("bg", get_theme_stylebox("sub_inspector_bg", "Editor"));
|
||||
} else {
|
||||
add_style_override("bg", get_stylebox("bg", "Tree"));
|
||||
add_theme_style_override("bg", get_theme_stylebox("bg", "Tree"));
|
||||
get_tree()->connect("node_removed", callable_mp(this, &EditorInspector::_node_removed));
|
||||
}
|
||||
}
|
||||
|
|
@ -2266,9 +2267,9 @@ void EditorInspector::_notification(int p_what) {
|
|||
if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
|
||||
|
||||
if (sub_inspector) {
|
||||
add_style_override("bg", get_stylebox("sub_inspector_bg", "Editor"));
|
||||
add_theme_style_override("bg", get_theme_stylebox("sub_inspector_bg", "Editor"));
|
||||
} else if (is_inside_tree()) {
|
||||
add_style_override("bg", get_stylebox("bg", "Tree"));
|
||||
add_theme_style_override("bg", get_theme_stylebox("bg", "Tree"));
|
||||
}
|
||||
|
||||
update_tree();
|
||||
|
|
@ -2331,7 +2332,7 @@ EditorInspector::EditorInspector() {
|
|||
undo_redo = NULL;
|
||||
main_vbox = memnew(VBoxContainer);
|
||||
main_vbox->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
main_vbox->add_constant_override("separation", 0);
|
||||
main_vbox->add_theme_constant_override("separation", 0);
|
||||
add_child(main_vbox);
|
||||
set_enable_h_scroll(false);
|
||||
set_enable_v_scroll(true);
|
||||
|
|
|
|||
|
|
@ -52,12 +52,12 @@ void EditorLayoutsDialog::_line_gui_input(const Ref<InputEvent> &p_event) {
|
|||
if (get_hide_on_ok())
|
||||
hide();
|
||||
ok_pressed();
|
||||
accept_event();
|
||||
set_input_as_handled();
|
||||
} break;
|
||||
case KEY_ESCAPE: {
|
||||
|
||||
hide();
|
||||
accept_event();
|
||||
set_input_as_handled();
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
|
@ -110,15 +110,15 @@ EditorLayoutsDialog::EditorLayoutsDialog() {
|
|||
|
||||
makevb = memnew(VBoxContainer);
|
||||
add_child(makevb);
|
||||
makevb->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5);
|
||||
makevb->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5);
|
||||
makevb->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 5);
|
||||
makevb->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -5);
|
||||
|
||||
layout_names = memnew(ItemList);
|
||||
makevb->add_child(layout_names);
|
||||
layout_names->set_visible(true);
|
||||
layout_names->set_margin(MARGIN_TOP, 5);
|
||||
layout_names->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5);
|
||||
layout_names->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5);
|
||||
layout_names->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 5);
|
||||
layout_names->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -5);
|
||||
layout_names->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
layout_names->set_select_mode(ItemList::SELECT_MULTI);
|
||||
layout_names->set_allow_rmb_select(true);
|
||||
|
|
@ -126,8 +126,8 @@ EditorLayoutsDialog::EditorLayoutsDialog() {
|
|||
name = memnew(LineEdit);
|
||||
makevb->add_child(name);
|
||||
name->set_margin(MARGIN_TOP, 5);
|
||||
name->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5);
|
||||
name->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5);
|
||||
name->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 5);
|
||||
name->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -5);
|
||||
name->connect("gui_input", callable_mp(this, &EditorLayoutsDialog::_line_gui_input));
|
||||
name->connect("focus_entered", callable_mp(layout_names, &ItemList::unselect_all));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,12 +62,12 @@ void EditorLog::_notification(int p_what) {
|
|||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||
|
||||
//button->set_icon(get_icon("Console","EditorIcons"));
|
||||
log->add_font_override("normal_font", get_font("output_source", "EditorFonts"));
|
||||
log->add_theme_font_override("normal_font", get_theme_font("output_source", "EditorFonts"));
|
||||
} else if (p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
Ref<DynamicFont> df_output_code = get_font("output_source", "EditorFonts");
|
||||
Ref<DynamicFont> df_output_code = get_theme_font("output_source", "EditorFonts");
|
||||
if (df_output_code.is_valid()) {
|
||||
if (log != NULL) {
|
||||
log->add_font_override("normal_font", get_font("output_source", "EditorFonts"));
|
||||
log->add_theme_font_override("normal_font", get_theme_font("output_source", "EditorFonts"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -101,22 +101,22 @@ void EditorLog::add_message(const String &p_msg, MessageType p_type) {
|
|||
case MSG_TYPE_STD: {
|
||||
} break;
|
||||
case MSG_TYPE_ERROR: {
|
||||
log->push_color(get_color("error_color", "Editor"));
|
||||
Ref<Texture2D> icon = get_icon("Error", "EditorIcons");
|
||||
log->push_color(get_theme_color("error_color", "Editor"));
|
||||
Ref<Texture2D> icon = get_theme_icon("Error", "EditorIcons");
|
||||
log->add_image(icon);
|
||||
log->add_text(" ");
|
||||
tool_button->set_icon(icon);
|
||||
} break;
|
||||
case MSG_TYPE_WARNING: {
|
||||
log->push_color(get_color("warning_color", "Editor"));
|
||||
Ref<Texture2D> icon = get_icon("Warning", "EditorIcons");
|
||||
log->push_color(get_theme_color("warning_color", "Editor"));
|
||||
Ref<Texture2D> icon = get_theme_icon("Warning", "EditorIcons");
|
||||
log->add_image(icon);
|
||||
log->add_text(" ");
|
||||
tool_button->set_icon(icon);
|
||||
} break;
|
||||
case MSG_TYPE_EDITOR: {
|
||||
// Distinguish editor messages from messages printed by the project
|
||||
log->push_color(get_color("font_color", "Editor") * Color(1, 1, 1, 0.6));
|
||||
log->push_color(get_theme_color("font_color", "Editor") * Color(1, 1, 1, 0.6));
|
||||
} break;
|
||||
}
|
||||
|
||||
|
|
@ -181,7 +181,7 @@ EditorLog::EditorLog() {
|
|||
|
||||
current = Thread::get_caller_id();
|
||||
|
||||
add_constant_override("separation", get_constant("separation", "VBoxContainer"));
|
||||
add_theme_constant_override("separation", get_theme_constant("separation", "VBoxContainer"));
|
||||
|
||||
EditorNode::get_undo_redo()->set_commit_notify_callback(_undo_redo_cbk, this);
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -84,6 +84,8 @@ class Tabs;
|
|||
class TextureProgress;
|
||||
class ToolButton;
|
||||
class VSplitContainer;
|
||||
class Window;
|
||||
class SubViewport;
|
||||
|
||||
class EditorNode : public Node {
|
||||
|
||||
|
|
@ -206,7 +208,7 @@ private:
|
|||
TOOL_MENU_BASE = 1000
|
||||
};
|
||||
|
||||
Viewport *scene_root; //root of the scene being edited
|
||||
SubViewport *scene_root; //root of the scene being edited
|
||||
|
||||
PanelContainer *scene_root_parent;
|
||||
Control *theme_base;
|
||||
|
|
@ -348,11 +350,14 @@ private:
|
|||
Button *new_inherited_button;
|
||||
String open_import_request;
|
||||
|
||||
Vector<Control *> floating_docks;
|
||||
|
||||
TabContainer *dock_slot[DOCK_SLOT_MAX];
|
||||
Rect2 dock_select_rect[DOCK_SLOT_MAX];
|
||||
int dock_select_rect_over;
|
||||
PopupPanel *dock_select_popup;
|
||||
Control *dock_select;
|
||||
Button *dock_float;
|
||||
ToolButton *dock_tab_move_left;
|
||||
ToolButton *dock_tab_move_right;
|
||||
int dock_popup_selected;
|
||||
|
|
@ -493,7 +498,8 @@ private:
|
|||
void _add_to_recent_scenes(const String &p_scene);
|
||||
void _update_recent_scenes();
|
||||
void _open_recent_scene(int p_idx);
|
||||
void _global_menu_action(const Variant &p_id, const Variant &p_meta);
|
||||
void _global_menu_scene(const Variant &p_tag);
|
||||
void _global_menu_new_window(const Variant &p_tag);
|
||||
void _dropped_files(const Vector<String> &p_files, int p_screen);
|
||||
void _add_dropped_files_recursive(const Vector<String> &p_files, String to_path);
|
||||
String _recent_scene;
|
||||
|
|
@ -560,6 +566,8 @@ private:
|
|||
|
||||
bool _find_scene_in_use(Node *p_node, const String &p_path) const;
|
||||
|
||||
void _update_dock_containers();
|
||||
|
||||
void _dock_select_input(const Ref<InputEvent> &p_input);
|
||||
void _dock_move_left();
|
||||
void _dock_move_right();
|
||||
|
|
@ -567,6 +575,8 @@ private:
|
|||
void _dock_pre_popup(int p_which);
|
||||
void _dock_split_dragged(int ofs);
|
||||
void _dock_popup_exit();
|
||||
void _dock_floating_close_request(Control *p_control);
|
||||
void _dock_make_float();
|
||||
void _scene_tab_changed(int p_tab);
|
||||
void _scene_tab_closed(int p_tab, int option = SCENE_TAB_CLOSE);
|
||||
void _scene_tab_hover(int p_tab);
|
||||
|
|
@ -724,7 +734,7 @@ public:
|
|||
|
||||
Node *get_edited_scene() { return editor_data.get_edited_scene_root(); }
|
||||
|
||||
Viewport *get_scene_root() { return scene_root; } //root of the scene being edited
|
||||
SubViewport *get_scene_root() { return scene_root; } //root of the scene being edited
|
||||
|
||||
void fix_dependencies(const String &p_for_file);
|
||||
void clear_scene() { _cleanup_scene(); }
|
||||
|
|
|
|||
|
|
@ -149,6 +149,6 @@ EditorPath::EditorPath(EditorHistory *p_history) {
|
|||
history = p_history;
|
||||
set_clip_text(true);
|
||||
set_text_align(ALIGN_LEFT);
|
||||
get_popup()->connect("about_to_show", callable_mp(this, &EditorPath::_about_to_show));
|
||||
get_popup()->connect("about_to_popup", callable_mp(this, &EditorPath::_about_to_show));
|
||||
get_popup()->connect("id_pressed", callable_mp(this, &EditorPath::_id_pressed));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
void EditorPluginSettings::_notification(int p_what) {
|
||||
|
||||
if (p_what == MainLoop::NOTIFICATION_WM_FOCUS_IN) {
|
||||
if (p_what == NOTIFICATION_WM_FOCUS_IN) {
|
||||
update_plugins();
|
||||
} else if (p_what == Node::NOTIFICATION_READY) {
|
||||
plugin_config_dialog->connect_compat("plugin_ready", EditorNode::get_singleton(), "_on_plugin_ready");
|
||||
|
|
@ -142,7 +142,7 @@ void EditorPluginSettings::update_plugins() {
|
|||
bool is_active = EditorNode::get_singleton()->is_addon_plugin_enabled(d2);
|
||||
item->set_checked(3, is_active);
|
||||
item->set_editable(3, true);
|
||||
item->add_button(4, get_icon("Edit", "EditorIcons"), BUTTON_PLUGIN_EDIT, false, TTR("Edit Plugin"));
|
||||
item->add_button(4, get_theme_icon("Edit", "EditorIcons"), BUTTON_PLUGIN_EDIT, false, TTR("Edit Plugin"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
#include "editor_node.h"
|
||||
#include "editor_properties_array_dict.h"
|
||||
#include "editor_scale.h"
|
||||
#include "scene/main/viewport.h"
|
||||
#include "scene/main/window.h"
|
||||
|
||||
///////////////////// NULL /////////////////////////
|
||||
|
||||
|
|
@ -140,9 +140,9 @@ void EditorPropertyMultilineText::_notification(int p_what) {
|
|||
switch (p_what) {
|
||||
case NOTIFICATION_THEME_CHANGED:
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
Ref<Texture2D> df = get_icon("DistractionFree", "EditorIcons");
|
||||
Ref<Texture2D> df = get_theme_icon("DistractionFree", "EditorIcons");
|
||||
open_big_text->set_icon(df);
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
text->set_custom_minimum_size(Vector2(0, font->get_height() * 6));
|
||||
|
||||
} break;
|
||||
|
|
@ -240,10 +240,10 @@ void EditorPropertyPath::_path_pressed() {
|
|||
}
|
||||
|
||||
if (folder) {
|
||||
dialog->set_mode(EditorFileDialog::MODE_OPEN_DIR);
|
||||
dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_DIR);
|
||||
dialog->set_current_dir(full_path);
|
||||
} else {
|
||||
dialog->set_mode(save_mode ? EditorFileDialog::MODE_SAVE_FILE : EditorFileDialog::MODE_OPEN_FILE);
|
||||
dialog->set_file_mode(save_mode ? EditorFileDialog::FILE_MODE_SAVE_FILE : EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
for (int i = 0; i < extensions.size(); i++) {
|
||||
String e = extensions[i].strip_edges();
|
||||
if (e != String()) {
|
||||
|
|
@ -278,7 +278,7 @@ void EditorPropertyPath::set_save_mode() {
|
|||
void EditorPropertyPath::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
path_edit->set_icon(get_icon("Folder", "EditorIcons"));
|
||||
path_edit->set_icon(get_theme_icon("Folder", "EditorIcons"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -604,7 +604,7 @@ public:
|
|||
Vector<String> tooltips;
|
||||
|
||||
virtual Size2 get_minimum_size() const {
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
return Vector2(0, font->get_height() * 2);
|
||||
}
|
||||
|
||||
|
|
@ -646,7 +646,7 @@ public:
|
|||
int h = bsize * 2 + 1;
|
||||
int vofs = (rect.size.height - h) / 2;
|
||||
|
||||
Color color = get_color("highlight_color", "Editor");
|
||||
Color color = get_theme_color("highlight_color", "Editor");
|
||||
for (int i = 0; i < 2; i++) {
|
||||
|
||||
Point2 ofs(4, vofs);
|
||||
|
|
@ -749,10 +749,10 @@ void EditorPropertyLayers::_button_pressed() {
|
|||
layers->set_item_checked(idx, grid->value & (1 << i));
|
||||
}
|
||||
|
||||
Rect2 gp = button->get_global_rect();
|
||||
Rect2 gp = button->get_screen_rect();
|
||||
layers->set_as_minsize();
|
||||
Vector2 popup_pos = gp.position - Vector2(layers->get_combined_minimum_size().x, 0);
|
||||
layers->set_global_position(popup_pos);
|
||||
Vector2 popup_pos = gp.position - Vector2(layers->get_contents_minimum_size().x, 0);
|
||||
layers->set_position(popup_pos);
|
||||
layers->popup();
|
||||
}
|
||||
|
||||
|
|
@ -920,7 +920,7 @@ void EditorPropertyEasing::_drag_easing(const Ref<InputEvent> &p_ev) {
|
|||
}
|
||||
|
||||
if (mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) {
|
||||
preset->set_global_position(easing_draw->get_global_transform().xform(mb->get_position()));
|
||||
preset->set_position(easing_draw->get_screen_transform().xform(mb->get_position()));
|
||||
preset->popup();
|
||||
|
||||
// Ensure the easing doesn't appear as being dragged
|
||||
|
|
@ -976,13 +976,13 @@ void EditorPropertyEasing::_draw_easing() {
|
|||
float prev = 1.0;
|
||||
const float exp = get_edited_object()->get(get_edited_property());
|
||||
|
||||
const Ref<Font> f = get_font("font", "Label");
|
||||
const Color font_color = get_color("font_color", "Label");
|
||||
const Ref<Font> f = get_theme_font("font", "Label");
|
||||
const Color font_color = get_theme_color("font_color", "Label");
|
||||
Color line_color;
|
||||
if (dragging) {
|
||||
line_color = get_color("accent_color", "Editor");
|
||||
line_color = get_theme_color("accent_color", "Editor");
|
||||
} else {
|
||||
line_color = get_color("font_color", "Label") * Color(1, 1, 1, 0.9);
|
||||
line_color = get_theme_color("font_color", "Label") * Color(1, 1, 1, 0.9);
|
||||
}
|
||||
|
||||
Vector<Point2> lines;
|
||||
|
|
@ -1058,15 +1058,15 @@ void EditorPropertyEasing::_notification(int p_what) {
|
|||
case NOTIFICATION_THEME_CHANGED:
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
preset->clear();
|
||||
preset->add_icon_item(get_icon("CurveConstant", "EditorIcons"), "Zero", EASING_ZERO);
|
||||
preset->add_icon_item(get_icon("CurveLinear", "EditorIcons"), "Linear", EASING_LINEAR);
|
||||
preset->add_icon_item(get_icon("CurveIn", "EditorIcons"), "In", EASING_IN);
|
||||
preset->add_icon_item(get_icon("CurveOut", "EditorIcons"), "Out", EASING_OUT);
|
||||
preset->add_icon_item(get_theme_icon("CurveConstant", "EditorIcons"), "Zero", EASING_ZERO);
|
||||
preset->add_icon_item(get_theme_icon("CurveLinear", "EditorIcons"), "Linear", EASING_LINEAR);
|
||||
preset->add_icon_item(get_theme_icon("CurveIn", "EditorIcons"), "In", EASING_IN);
|
||||
preset->add_icon_item(get_theme_icon("CurveOut", "EditorIcons"), "Out", EASING_OUT);
|
||||
if (full) {
|
||||
preset->add_icon_item(get_icon("CurveInOut", "EditorIcons"), "In-Out", EASING_IN_OUT);
|
||||
preset->add_icon_item(get_icon("CurveOutIn", "EditorIcons"), "Out-In", EASING_OUT_IN);
|
||||
preset->add_icon_item(get_theme_icon("CurveInOut", "EditorIcons"), "In-Out", EASING_IN_OUT);
|
||||
preset->add_icon_item(get_theme_icon("CurveOutIn", "EditorIcons"), "Out-In", EASING_OUT_IN);
|
||||
}
|
||||
easing_draw->set_custom_minimum_size(Size2(0, get_font("font", "Label")->get_height() * 2));
|
||||
easing_draw->set_custom_minimum_size(Size2(0, get_theme_font("font", "Label")->get_height() * 2));
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1126,7 +1126,7 @@ void EditorPropertyVector2::update_property() {
|
|||
|
||||
void EditorPropertyVector2::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
Color base = get_color("accent_color", "Editor");
|
||||
Color base = get_theme_color("accent_color", "Editor");
|
||||
for (int i = 0; i < 2; i++) {
|
||||
|
||||
Color c = base;
|
||||
|
|
@ -1208,7 +1208,7 @@ void EditorPropertyRect2::update_property() {
|
|||
}
|
||||
void EditorPropertyRect2::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
Color base = get_color("accent_color", "Editor");
|
||||
Color base = get_theme_color("accent_color", "Editor");
|
||||
for (int i = 0; i < 4; i++) {
|
||||
|
||||
Color c = base;
|
||||
|
|
@ -1288,7 +1288,7 @@ void EditorPropertyVector3::update_property() {
|
|||
}
|
||||
void EditorPropertyVector3::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
Color base = get_color("accent_color", "Editor");
|
||||
Color base = get_theme_color("accent_color", "Editor");
|
||||
for (int i = 0; i < 3; i++) {
|
||||
|
||||
Color c = base;
|
||||
|
|
@ -1368,7 +1368,7 @@ void EditorPropertyPlane::update_property() {
|
|||
}
|
||||
void EditorPropertyPlane::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
Color base = get_color("accent_color", "Editor");
|
||||
Color base = get_theme_color("accent_color", "Editor");
|
||||
for (int i = 0; i < 3; i++) {
|
||||
|
||||
Color c = base;
|
||||
|
|
@ -1450,7 +1450,7 @@ void EditorPropertyQuat::update_property() {
|
|||
}
|
||||
void EditorPropertyQuat::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
Color base = get_color("accent_color", "Editor");
|
||||
Color base = get_theme_color("accent_color", "Editor");
|
||||
for (int i = 0; i < 3; i++) {
|
||||
|
||||
Color c = base;
|
||||
|
|
@ -1537,7 +1537,7 @@ void EditorPropertyAABB::update_property() {
|
|||
}
|
||||
void EditorPropertyAABB::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
Color base = get_color("accent_color", "Editor");
|
||||
Color base = get_theme_color("accent_color", "Editor");
|
||||
for (int i = 0; i < 6; i++) {
|
||||
|
||||
Color c = base;
|
||||
|
|
@ -1611,7 +1611,7 @@ void EditorPropertyTransform2D::update_property() {
|
|||
}
|
||||
void EditorPropertyTransform2D::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
Color base = get_color("accent_color", "Editor");
|
||||
Color base = get_theme_color("accent_color", "Editor");
|
||||
for (int i = 0; i < 6; i++) {
|
||||
|
||||
Color c = base;
|
||||
|
|
@ -1690,7 +1690,7 @@ void EditorPropertyBasis::update_property() {
|
|||
}
|
||||
void EditorPropertyBasis::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
Color base = get_color("accent_color", "Editor");
|
||||
Color base = get_theme_color("accent_color", "Editor");
|
||||
for (int i = 0; i < 9; i++) {
|
||||
|
||||
Color c = base;
|
||||
|
|
@ -1775,7 +1775,7 @@ void EditorPropertyTransform::update_property() {
|
|||
}
|
||||
void EditorPropertyTransform::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
Color base = get_color("accent_color", "Editor");
|
||||
Color base = get_theme_color("accent_color", "Editor");
|
||||
for (int i = 0; i < 12; i++) {
|
||||
|
||||
Color c = base;
|
||||
|
|
@ -1983,7 +1983,7 @@ void EditorPropertyNodePath::setup(const NodePath &p_base_hint, Vector<StringNam
|
|||
void EditorPropertyNodePath::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
Ref<Texture2D> t = get_icon("Clear", "EditorIcons");
|
||||
Ref<Texture2D> t = get_theme_icon("Clear", "EditorIcons");
|
||||
clear->set_icon(t);
|
||||
}
|
||||
}
|
||||
|
|
@ -2074,7 +2074,7 @@ void EditorPropertyResource::_menu_option(int p_which) {
|
|||
file->connect("file_selected", callable_mp(this, &EditorPropertyResource::_file_selected));
|
||||
add_child(file);
|
||||
}
|
||||
file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
String type = base_type;
|
||||
|
||||
List<String> extensions;
|
||||
|
|
@ -2294,7 +2294,7 @@ void EditorPropertyResource::_resource_preview(const String &p_path, const Ref<T
|
|||
}
|
||||
|
||||
if (p_preview.is_valid()) {
|
||||
preview->set_margin(MARGIN_LEFT, assign->get_icon()->get_width() + assign->get_stylebox("normal")->get_default_margin(MARGIN_LEFT) + get_constant("hseparation", "Button"));
|
||||
preview->set_margin(MARGIN_LEFT, assign->get_icon()->get_width() + assign->get_theme_stylebox("normal")->get_default_margin(MARGIN_LEFT) + get_theme_constant("hseparation", "Button"));
|
||||
if (type == "GradientTexture") {
|
||||
preview->set_stretch_mode(TextureRect::STRETCH_SCALE);
|
||||
assign->set_custom_minimum_size(Size2(1, 1));
|
||||
|
|
@ -2318,8 +2318,8 @@ void EditorPropertyResource::_update_menu_items() {
|
|||
menu->clear();
|
||||
|
||||
if (get_edited_property() == "script" && base_type == "Script" && Object::cast_to<Node>(get_edited_object())) {
|
||||
menu->add_icon_item(get_icon("ScriptCreate", "EditorIcons"), TTR("New Script"), OBJ_MENU_NEW_SCRIPT);
|
||||
menu->add_icon_item(get_icon("ScriptExtend", "EditorIcons"), TTR("Extend Script"), OBJ_MENU_EXTEND_SCRIPT);
|
||||
menu->add_icon_item(get_theme_icon("ScriptCreate", "EditorIcons"), TTR("New Script"), OBJ_MENU_NEW_SCRIPT);
|
||||
menu->add_icon_item(get_theme_icon("ScriptExtend", "EditorIcons"), TTR("Extend Script"), OBJ_MENU_EXTEND_SCRIPT);
|
||||
menu->add_separator();
|
||||
} else if (base_type != "") {
|
||||
int idx = 0;
|
||||
|
|
@ -2381,7 +2381,7 @@ void EditorPropertyResource::_update_menu_items() {
|
|||
inheritors_array.push_back(t);
|
||||
|
||||
if (!icon.is_valid())
|
||||
icon = get_icon(has_icon(t, "EditorIcons") ? t : "Object", "EditorIcons");
|
||||
icon = get_theme_icon(has_theme_icon(t, "EditorIcons") ? t : "Object", "EditorIcons");
|
||||
|
||||
int id = TYPE_BASE_ID + idx;
|
||||
menu->add_icon_item(icon, vformat(TTR("New %s"), t), id);
|
||||
|
|
@ -2394,14 +2394,14 @@ void EditorPropertyResource::_update_menu_items() {
|
|||
menu->add_separator();
|
||||
}
|
||||
|
||||
menu->add_icon_item(get_icon("Load", "EditorIcons"), TTR("Load"), OBJ_MENU_LOAD);
|
||||
menu->add_icon_item(get_theme_icon("Load", "EditorIcons"), TTR("Load"), OBJ_MENU_LOAD);
|
||||
|
||||
if (!res.is_null()) {
|
||||
|
||||
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);
|
||||
menu->add_icon_item(get_icon("Save", "EditorIcons"), TTR("Save"), OBJ_MENU_SAVE);
|
||||
menu->add_icon_item(get_theme_icon("Edit", "EditorIcons"), TTR("Edit"), OBJ_MENU_EDIT);
|
||||
menu->add_icon_item(get_theme_icon("Clear", "EditorIcons"), TTR("Clear"), OBJ_MENU_CLEAR);
|
||||
menu->add_icon_item(get_theme_icon("Duplicate", "EditorIcons"), TTR("Make Unique"), OBJ_MENU_MAKE_UNIQUE);
|
||||
menu->add_icon_item(get_theme_icon("Save", "EditorIcons"), TTR("Save"), OBJ_MENU_SAVE);
|
||||
RES r = res;
|
||||
if (r.is_valid() && r->get_path().is_resource_file()) {
|
||||
menu->add_separator();
|
||||
|
|
@ -2445,12 +2445,12 @@ void EditorPropertyResource::_update_menu_items() {
|
|||
for (int i = 0; i < conversions.size(); i++) {
|
||||
String what = conversions[i]->converts_to();
|
||||
Ref<Texture2D> icon;
|
||||
if (has_icon(what, "EditorIcons")) {
|
||||
if (has_theme_icon(what, "EditorIcons")) {
|
||||
|
||||
icon = get_icon(what, "EditorIcons");
|
||||
icon = get_theme_icon(what, "EditorIcons");
|
||||
} else {
|
||||
|
||||
icon = get_icon(what, "Resource");
|
||||
icon = get_theme_icon(what, "Resource");
|
||||
}
|
||||
|
||||
menu->add_icon_item(icon, vformat(TTR("Convert To %s"), what), CONVERT_BASE_ID + i);
|
||||
|
|
@ -2462,11 +2462,11 @@ void EditorPropertyResource::_update_menu() {
|
|||
|
||||
_update_menu_items();
|
||||
|
||||
Rect2 gt = edit->get_global_rect();
|
||||
Rect2 gt = edit->get_screen_rect();
|
||||
menu->set_as_minsize();
|
||||
int ms = menu->get_combined_minimum_size().width;
|
||||
int ms = menu->get_contents_minimum_size().width;
|
||||
Vector2 popup_pos = gt.position + gt.size - Vector2(ms, 0);
|
||||
menu->set_global_position(popup_pos);
|
||||
menu->set_position(popup_pos);
|
||||
menu->popup();
|
||||
}
|
||||
|
||||
|
|
@ -2490,10 +2490,10 @@ void EditorPropertyResource::_button_input(const Ref<InputEvent> &p_event) {
|
|||
if (mb.is_valid()) {
|
||||
if (mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) {
|
||||
_update_menu_items();
|
||||
Vector2 pos = mb->get_global_position();
|
||||
Vector2 pos = get_screen_position() + mb->get_position();
|
||||
//pos = assign->get_global_transform().xform(pos);
|
||||
menu->set_as_minsize();
|
||||
menu->set_global_position(pos);
|
||||
menu->set_position(pos);
|
||||
menu->popup();
|
||||
}
|
||||
}
|
||||
|
|
@ -2663,7 +2663,7 @@ void EditorPropertyResource::setup(const String &p_base_type) {
|
|||
void EditorPropertyResource::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
Ref<Texture2D> t = get_icon("select_arrow", "Tree");
|
||||
Ref<Texture2D> t = get_theme_icon("select_arrow", "Tree");
|
||||
edit->set_icon(t);
|
||||
}
|
||||
|
||||
|
|
@ -2718,7 +2718,7 @@ void EditorPropertyResource::expand_all_folding() {
|
|||
void EditorPropertyResource::_button_draw() {
|
||||
|
||||
if (dropping) {
|
||||
Color color = get_color("accent_color", "Editor");
|
||||
Color color = get_theme_color("accent_color", "Editor");
|
||||
assign->draw_rect(Rect2(Point2(), assign->get_size()), color, false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,9 +184,9 @@ void EditorPropertyArray::_change_type(Object *p_button, int p_index) {
|
|||
|
||||
Button *button = Object::cast_to<Button>(p_button);
|
||||
changing_type_idx = p_index;
|
||||
Rect2 rect = button->get_global_rect();
|
||||
Rect2 rect = button->get_screen_rect();
|
||||
change_type->set_as_minsize();
|
||||
change_type->set_global_position(rect.position + rect.size - Vector2(change_type->get_combined_minimum_size().x, 0));
|
||||
change_type->set_position(rect.position + rect.size - Vector2(change_type->get_contents_minimum_size().x, 0));
|
||||
change_type->popup();
|
||||
}
|
||||
|
||||
|
|
@ -373,13 +373,13 @@ void EditorPropertyArray::update_property() {
|
|||
if (is_untyped_array) {
|
||||
|
||||
Button *edit = memnew(Button);
|
||||
edit->set_icon(get_icon("Edit", "EditorIcons"));
|
||||
edit->set_icon(get_theme_icon("Edit", "EditorIcons"));
|
||||
hb->add_child(edit);
|
||||
edit->connect("pressed", callable_mp(this, &EditorPropertyArray::_change_type), varray(edit, i + offset));
|
||||
} else {
|
||||
|
||||
Button *remove = memnew(Button);
|
||||
remove->set_icon(get_icon("Remove", "EditorIcons"));
|
||||
remove->set_icon(get_theme_icon("Remove", "EditorIcons"));
|
||||
remove->connect("pressed", callable_mp(this, &EditorPropertyArray::_remove_pressed), varray(i + offset));
|
||||
hb->add_child(remove);
|
||||
}
|
||||
|
|
@ -553,9 +553,9 @@ void EditorPropertyDictionary::_change_type(Object *p_button, int p_index) {
|
|||
|
||||
Button *button = Object::cast_to<Button>(p_button);
|
||||
|
||||
Rect2 rect = button->get_global_rect();
|
||||
Rect2 rect = button->get_screen_rect();
|
||||
change_type->set_as_minsize();
|
||||
change_type->set_global_position(rect.position + rect.size - Vector2(change_type->get_combined_minimum_size().x, 0));
|
||||
change_type->set_position(rect.position + rect.size - Vector2(change_type->get_contents_minimum_size().x, 0));
|
||||
change_type->popup();
|
||||
changing_type_idx = p_index;
|
||||
}
|
||||
|
|
@ -909,9 +909,9 @@ void EditorPropertyDictionary::update_property() {
|
|||
for (int j = 0; j < 4; j++) {
|
||||
flat->set_default_margin(Margin(j), 2 * EDSCALE);
|
||||
}
|
||||
flat->set_bg_color(get_color("prop_subsection", "Editor"));
|
||||
flat->set_bg_color(get_theme_color("prop_subsection", "Editor"));
|
||||
|
||||
pc->add_style_override("panel", flat);
|
||||
pc->add_theme_style_override("panel", flat);
|
||||
add_vbox = memnew(VBoxContainer);
|
||||
pc->add_child(add_vbox);
|
||||
}
|
||||
|
|
@ -944,7 +944,7 @@ void EditorPropertyDictionary::update_property() {
|
|||
hb->add_child(prop);
|
||||
prop->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
Button *edit = memnew(Button);
|
||||
edit->set_icon(get_icon("Edit", "EditorIcons"));
|
||||
edit->set_icon(get_theme_icon("Edit", "EditorIcons"));
|
||||
hb->add_child(edit);
|
||||
edit->connect("pressed", callable_mp(this, &EditorPropertyDictionary::_change_type), varray(edit, change_index));
|
||||
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ void EditorResourcePreview::_generate_preview(Ref<ImageTexture> &r_texture, Ref<
|
|||
}
|
||||
r_texture = generated;
|
||||
|
||||
int small_thumbnail_size = EditorNode::get_singleton()->get_theme_base()->get_icon("Object", "EditorIcons")->get_width(); // Kind of a workaround to retrieve the default icon size
|
||||
int small_thumbnail_size = EditorNode::get_singleton()->get_theme_base()->get_theme_icon("Object", "EditorIcons")->get_width(); // Kind of a workaround to retrieve the default icon size
|
||||
small_thumbnail_size *= EDSCALE;
|
||||
|
||||
if (preview_generators[i]->can_generate_small_preview()) {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include "core/project_settings.h"
|
||||
#include "editor_settings.h"
|
||||
#include "servers/display_server.h"
|
||||
|
||||
EditorRun::Status EditorRun::get_status() const {
|
||||
|
||||
|
|
@ -70,19 +71,19 @@ Error EditorRun::run(const String &p_scene, const String &p_custom_args, const L
|
|||
int screen = EditorSettings::get_singleton()->get("run/window_placement/screen");
|
||||
if (screen == 0) {
|
||||
// Same as editor
|
||||
screen = OS::get_singleton()->get_current_screen();
|
||||
screen = DisplayServer::get_singleton()->window_get_current_screen();
|
||||
} else if (screen == 1) {
|
||||
// Previous monitor (wrap to the other end if needed)
|
||||
screen = Math::wrapi(
|
||||
OS::get_singleton()->get_current_screen() - 1,
|
||||
DisplayServer::get_singleton()->window_get_current_screen() - 1,
|
||||
0,
|
||||
OS::get_singleton()->get_screen_count());
|
||||
DisplayServer::get_singleton()->get_screen_count());
|
||||
} else if (screen == 2) {
|
||||
// Next monitor (wrap to the other end if needed)
|
||||
screen = Math::wrapi(
|
||||
OS::get_singleton()->get_current_screen() + 1,
|
||||
DisplayServer::get_singleton()->window_get_current_screen() + 1,
|
||||
0,
|
||||
OS::get_singleton()->get_screen_count());
|
||||
DisplayServer::get_singleton()->get_screen_count());
|
||||
} else {
|
||||
// Fixed monitor ID
|
||||
// There are 3 special options, so decrement the option ID by 3 to get the monitor ID
|
||||
|
|
@ -94,8 +95,8 @@ Error EditorRun::run(const String &p_scene, const String &p_custom_args, const L
|
|||
}
|
||||
|
||||
Rect2 screen_rect;
|
||||
screen_rect.position = OS::get_singleton()->get_screen_position(screen);
|
||||
screen_rect.size = OS::get_singleton()->get_screen_size(screen);
|
||||
screen_rect.position = DisplayServer::get_singleton()->screen_get_position(screen);
|
||||
screen_rect.size = DisplayServer::get_singleton()->screen_get_size(screen);
|
||||
|
||||
Size2 desired_size;
|
||||
desired_size.x = ProjectSettings::get_singleton()->get("display/window/size/width");
|
||||
|
|
@ -120,7 +121,9 @@ Error EditorRun::run(const String &p_scene, const String &p_custom_args, const L
|
|||
case 1: { // centered
|
||||
int display_scale = 1;
|
||||
#ifdef OSX_ENABLED
|
||||
if (OS::get_singleton()->get_screen_dpi(screen) >= 192 && OS::get_singleton()->get_screen_size(screen).x > 2000) {
|
||||
display_scale = DisplayServer::get_singleton()->screen_get_scale(screen);
|
||||
#else
|
||||
if (DisplayServer::get_singleton()->screen_get_dpi(screen) >= 192 && DisplayServer::get_singleton()->screen_get_size(screen).x > 2000) {
|
||||
display_scale = 2;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ void SectionedInspector::update_category_list() {
|
|||
for (int i = 0; i < sc; i++) {
|
||||
|
||||
TreeItem *parent = section_map[metasection];
|
||||
parent->set_custom_bg_color(0, get_color("prop_subsection", "Editor"));
|
||||
parent->set_custom_bg_color(0, get_theme_color("prop_subsection", "Editor"));
|
||||
|
||||
if (i > 0) {
|
||||
metasection += "/" + sectionarr[i];
|
||||
|
|
@ -309,7 +309,7 @@ SectionedInspector::SectionedInspector() :
|
|||
filter(memnew(SectionedInspectorFilter)),
|
||||
inspector(memnew(EditorInspector)),
|
||||
search_box(NULL) {
|
||||
add_constant_override("autohide", 1); // Fixes the dragger always showing up
|
||||
add_theme_constant_override("autohide", 1); // Fixes the dragger always showing up
|
||||
|
||||
VBoxContainer *left_vb = memnew(VBoxContainer);
|
||||
left_vb->set_custom_minimum_size(Size2(190, 0) * EDSCALE);
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
#include "editor/editor_translations.gen.h"
|
||||
#include "scene/main/node.h"
|
||||
#include "scene/main/scene_tree.h"
|
||||
#include "scene/main/viewport.h"
|
||||
#include "scene/main/window.h"
|
||||
|
||||
// PRIVATE METHODS
|
||||
|
||||
|
|
@ -599,7 +599,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
|||
_initial_set("run/window_placement/rect", 1);
|
||||
hints["run/window_placement/rect"] = PropertyInfo(Variant::INT, "run/window_placement/rect", PROPERTY_HINT_ENUM, "Top Left,Centered,Custom Position,Force Maximized,Force Fullscreen");
|
||||
String screen_hints = "Same as Editor,Previous Monitor,Next Monitor";
|
||||
for (int i = 0; i < OS::get_singleton()->get_screen_count(); i++) {
|
||||
for (int i = 0; i < DisplayServer::get_singleton()->get_screen_count(); i++) {
|
||||
screen_hints += ",Monitor " + itos(i + 1);
|
||||
}
|
||||
_initial_set("run/window_placement/rect_custom_position", Vector2());
|
||||
|
|
|
|||
|
|
@ -29,8 +29,9 @@
|
|||
/*************************************************************************/
|
||||
|
||||
#include "editor_spin_slider.h"
|
||||
|
||||
#include "core/input/input_filter.h"
|
||||
#include "core/math/expression.h"
|
||||
#include "core/os/input.h"
|
||||
#include "editor_node.h"
|
||||
#include "editor_scale.h"
|
||||
|
||||
|
|
@ -67,7 +68,7 @@ void EditorSpinSlider::_gui_input(const Ref<InputEvent> &p_event) {
|
|||
grabbing_spinner_dist_cache = 0;
|
||||
pre_grab_value = get_value();
|
||||
grabbing_spinner = false;
|
||||
grabbing_spinner_mouse_pos = Input::get_singleton()->get_mouse_position();
|
||||
grabbing_spinner_mouse_pos = InputFilter::get_singleton()->get_mouse_position();
|
||||
}
|
||||
} else {
|
||||
|
||||
|
|
@ -75,8 +76,8 @@ void EditorSpinSlider::_gui_input(const Ref<InputEvent> &p_event) {
|
|||
|
||||
if (grabbing_spinner) {
|
||||
|
||||
Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE);
|
||||
Input::get_singleton()->warp_mouse_position(grabbing_spinner_mouse_pos);
|
||||
InputFilter::get_singleton()->set_mouse_mode(InputFilter::MOUSE_MODE_VISIBLE);
|
||||
InputFilter::get_singleton()->warp_mouse_position(grabbing_spinner_mouse_pos);
|
||||
update();
|
||||
} else {
|
||||
_focus_entered();
|
||||
|
|
@ -105,7 +106,7 @@ void EditorSpinSlider::_gui_input(const Ref<InputEvent> &p_event) {
|
|||
grabbing_spinner_dist_cache += diff_x;
|
||||
|
||||
if (!grabbing_spinner && ABS(grabbing_spinner_dist_cache) > 4 * EDSCALE) {
|
||||
Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_CAPTURED);
|
||||
InputFilter::get_singleton()->set_mouse_mode(InputFilter::MOUSE_MODE_CAPTURED);
|
||||
grabbing_spinner = true;
|
||||
}
|
||||
|
||||
|
|
@ -176,11 +177,11 @@ void EditorSpinSlider::_grabber_gui_input(const Ref<InputEvent> &p_event) {
|
|||
|
||||
void EditorSpinSlider::_notification(int p_what) {
|
||||
|
||||
if (p_what == MainLoop::NOTIFICATION_WM_FOCUS_OUT ||
|
||||
p_what == MainLoop::NOTIFICATION_WM_FOCUS_IN ||
|
||||
if (p_what == NOTIFICATION_WM_FOCUS_OUT ||
|
||||
p_what == NOTIFICATION_WM_FOCUS_IN ||
|
||||
p_what == NOTIFICATION_EXIT_TREE) {
|
||||
if (grabbing_spinner) {
|
||||
Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE);
|
||||
InputFilter::get_singleton()->set_mouse_mode(InputFilter::MOUSE_MODE_VISIBLE);
|
||||
grabbing_spinner = false;
|
||||
grabbing_spinner_attempt = false;
|
||||
}
|
||||
|
|
@ -191,30 +192,30 @@ void EditorSpinSlider::_notification(int p_what) {
|
|||
// when it's edited. The LineEdit "focus" stylebox uses the "normal" stylebox's
|
||||
// default margins.
|
||||
Ref<StyleBoxFlat> stylebox =
|
||||
EditorNode::get_singleton()->get_theme_base()->get_stylebox("normal", "LineEdit")->duplicate();
|
||||
EditorNode::get_singleton()->get_theme_base()->get_theme_stylebox("normal", "LineEdit")->duplicate();
|
||||
// EditorSpinSliders with a label have more space on the left, so add an
|
||||
// higher margin to match the location where the text begins.
|
||||
// The margin values below were determined by empirical testing.
|
||||
stylebox->set_default_margin(MARGIN_LEFT, (get_label() != String() ? 23 : 16) * EDSCALE);
|
||||
value_input->add_style_override("normal", stylebox);
|
||||
value_input->add_theme_style_override("normal", stylebox);
|
||||
}
|
||||
|
||||
if (p_what == NOTIFICATION_DRAW) {
|
||||
|
||||
updown_offset = -1;
|
||||
|
||||
Ref<StyleBox> sb = get_stylebox("normal", "LineEdit");
|
||||
Ref<StyleBox> sb = get_theme_stylebox("normal", "LineEdit");
|
||||
if (!flat) {
|
||||
draw_style_box(sb, Rect2(Vector2(), get_size()));
|
||||
}
|
||||
Ref<Font> font = get_font("font", "LineEdit");
|
||||
Ref<Font> font = get_theme_font("font", "LineEdit");
|
||||
int sep_base = 4 * EDSCALE;
|
||||
int sep = sep_base + sb->get_offset().x; //make it have the same margin on both sides, looks better
|
||||
|
||||
int string_width = font->get_string_size(label).width;
|
||||
int number_width = get_size().width - sb->get_minimum_size().width - string_width - sep;
|
||||
|
||||
Ref<Texture2D> updown = get_icon("updown", "SpinBox");
|
||||
Ref<Texture2D> updown = get_theme_icon("updown", "SpinBox");
|
||||
|
||||
if (get_step() == 1) {
|
||||
number_width -= updown->get_width();
|
||||
|
|
@ -224,7 +225,7 @@ void EditorSpinSlider::_notification(int p_what) {
|
|||
|
||||
int vofs = (get_size().height - font->get_height()) / 2 + font->get_ascent();
|
||||
|
||||
Color fc = get_color("font_color", "LineEdit");
|
||||
Color fc = get_theme_color("font_color", "LineEdit");
|
||||
Color lc;
|
||||
if (use_custom_label_color) {
|
||||
lc = custom_label_color;
|
||||
|
|
@ -233,12 +234,12 @@ void EditorSpinSlider::_notification(int p_what) {
|
|||
}
|
||||
|
||||
if (flat && label != String()) {
|
||||
Color label_bg_color = get_color("dark_color_3", "Editor");
|
||||
Color label_bg_color = get_theme_color("dark_color_3", "Editor");
|
||||
draw_rect(Rect2(Vector2(), Vector2(sb->get_offset().x * 2 + string_width, get_size().height)), label_bg_color);
|
||||
}
|
||||
|
||||
if (has_focus()) {
|
||||
Ref<StyleBox> focus = get_stylebox("focus", "LineEdit");
|
||||
Ref<StyleBox> focus = get_theme_stylebox("focus", "LineEdit");
|
||||
draw_style_box(focus, Rect2(Vector2(), get_size()));
|
||||
}
|
||||
|
||||
|
|
@ -247,7 +248,7 @@ void EditorSpinSlider::_notification(int p_what) {
|
|||
draw_string(font, Vector2(Math::round(sb->get_offset().x + string_width + sep), vofs), numstr, fc, number_width);
|
||||
|
||||
if (get_step() == 1) {
|
||||
Ref<Texture2D> updown2 = get_icon("updown", "SpinBox");
|
||||
Ref<Texture2D> updown2 = get_theme_icon("updown", "SpinBox");
|
||||
int updown_vofs = (get_size().height - updown2->get_height()) / 2;
|
||||
updown_offset = get_size().width - sb->get_margin(MARGIN_RIGHT) - updown2->get_width();
|
||||
Color c(1, 1, 1);
|
||||
|
|
@ -272,7 +273,7 @@ void EditorSpinSlider::_notification(int p_what) {
|
|||
Rect2 grabber_rect = Rect2(ofs + gofs, svofs + 1, grabber_w, 2 * EDSCALE);
|
||||
draw_rect(grabber_rect, c);
|
||||
|
||||
bool display_grabber = (mouse_over_spin || mouse_over_grabber) && !grabbing_spinner && !value_input->is_visible();
|
||||
bool display_grabber = (mouse_over_spin || mouse_over_grabber) && !grabbing_spinner && !value_input_popup->is_visible();
|
||||
if (grabber->is_visible() != display_grabber) {
|
||||
if (display_grabber) {
|
||||
grabber->show();
|
||||
|
|
@ -284,9 +285,9 @@ void EditorSpinSlider::_notification(int p_what) {
|
|||
if (display_grabber) {
|
||||
Ref<Texture2D> grabber_tex;
|
||||
if (mouse_over_grabber) {
|
||||
grabber_tex = get_icon("grabber_highlight", "HSlider");
|
||||
grabber_tex = get_theme_icon("grabber_highlight", "HSlider");
|
||||
} else {
|
||||
grabber_tex = get_icon("grabber", "HSlider");
|
||||
grabber_tex = get_theme_icon("grabber", "HSlider");
|
||||
}
|
||||
|
||||
if (grabber->get_texture() != grabber_tex) {
|
||||
|
|
@ -297,7 +298,7 @@ void EditorSpinSlider::_notification(int p_what) {
|
|||
grabber->set_position(get_global_position() + grabber_rect.position + grabber_rect.size * 0.5 - grabber->get_size() * 0.5);
|
||||
|
||||
if (mousewheel_over_grabber) {
|
||||
Input::get_singleton()->warp_mouse_position(grabber->get_position() + grabber_rect.size);
|
||||
InputFilter::get_singleton()->warp_mouse_position(grabber->get_position() + grabber_rect.size);
|
||||
}
|
||||
|
||||
grabber_range = width;
|
||||
|
|
@ -316,12 +317,7 @@ void EditorSpinSlider::_notification(int p_what) {
|
|||
update();
|
||||
}
|
||||
if (p_what == NOTIFICATION_FOCUS_ENTER) {
|
||||
/* Sorry, I don't like this, it makes navigating the different fields with arrows more difficult.
|
||||
* Just press enter to edit.
|
||||
* if (Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT) && !value_input_just_closed) {
|
||||
_focus_entered();
|
||||
}*/
|
||||
if ((Input::get_singleton()->is_action_pressed("ui_focus_next") || Input::get_singleton()->is_action_pressed("ui_focus_prev")) && !value_input_just_closed) {
|
||||
if ((InputFilter::get_singleton()->is_action_pressed("ui_focus_next") || InputFilter::get_singleton()->is_action_pressed("ui_focus_prev")) && !value_input_just_closed) {
|
||||
_focus_entered();
|
||||
}
|
||||
value_input_just_closed = false;
|
||||
|
|
@ -330,8 +326,8 @@ void EditorSpinSlider::_notification(int p_what) {
|
|||
|
||||
Size2 EditorSpinSlider::get_minimum_size() const {
|
||||
|
||||
Ref<StyleBox> sb = get_stylebox("normal", "LineEdit");
|
||||
Ref<Font> font = get_font("font", "LineEdit");
|
||||
Ref<StyleBox> sb = get_theme_stylebox("normal", "LineEdit");
|
||||
Ref<Font> font = get_theme_font("font", "LineEdit");
|
||||
|
||||
Size2 ms = sb->get_minimum_size();
|
||||
ms.height += font->get_height();
|
||||
|
|
@ -375,7 +371,7 @@ void EditorSpinSlider::_evaluate_input_text() {
|
|||
//text_entered signal
|
||||
void EditorSpinSlider::_value_input_entered(const String &p_text) {
|
||||
value_input_just_closed = true;
|
||||
value_input->hide();
|
||||
value_input_popup->hide();
|
||||
}
|
||||
|
||||
//modal_closed signal
|
||||
|
|
@ -398,7 +394,7 @@ void EditorSpinSlider::_value_focus_exited() {
|
|||
// -> modal_close was not called
|
||||
// -> need to close/hide manually
|
||||
if (!value_input_just_closed) { //value_input_just_closed should do the same
|
||||
value_input->hide();
|
||||
value_input_popup->hide();
|
||||
//tab was pressed
|
||||
} else {
|
||||
//enter, click, esc
|
||||
|
|
@ -441,11 +437,11 @@ void EditorSpinSlider::set_custom_label_color(bool p_use_custom_label_color, Col
|
|||
}
|
||||
|
||||
void EditorSpinSlider::_focus_entered() {
|
||||
Rect2 gr = get_global_rect();
|
||||
Rect2 gr = get_screen_rect();
|
||||
value_input->set_text(get_text_value());
|
||||
value_input->set_position(gr.position);
|
||||
value_input->set_size(gr.size);
|
||||
value_input->call_deferred("show_modal");
|
||||
value_input_popup->set_position(gr.position);
|
||||
value_input_popup->set_size(gr.size);
|
||||
value_input_popup->call_deferred("popup");
|
||||
value_input->call_deferred("grab_focus");
|
||||
value_input->call_deferred("select_all");
|
||||
value_input->set_focus_next(find_next_valid_focus()->get_path());
|
||||
|
|
@ -492,11 +488,13 @@ EditorSpinSlider::EditorSpinSlider() {
|
|||
mousewheel_over_grabber = false;
|
||||
grabbing_grabber = false;
|
||||
grabber_range = 1;
|
||||
value_input_popup = memnew(Popup);
|
||||
add_child(value_input_popup);
|
||||
value_input = memnew(LineEdit);
|
||||
add_child(value_input);
|
||||
value_input->set_as_toplevel(true);
|
||||
value_input->hide();
|
||||
value_input->connect("modal_closed", callable_mp(this, &EditorSpinSlider::_value_input_closed));
|
||||
value_input_popup->add_child(value_input);
|
||||
value_input_popup->set_wrap_controls(true);
|
||||
value_input->set_anchors_and_margins_preset(PRESET_WIDE);
|
||||
value_input_popup->connect("popup_hide", callable_mp(this, &EditorSpinSlider::_value_input_closed));
|
||||
value_input->connect("text_entered", callable_mp(this, &EditorSpinSlider::_value_input_entered));
|
||||
value_input->connect("focus_exited", callable_mp(this, &EditorSpinSlider::_value_focus_exited));
|
||||
value_input_just_closed = false;
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ class EditorSpinSlider : public Range {
|
|||
Vector2 grabbing_spinner_mouse_pos;
|
||||
double pre_grab_value;
|
||||
|
||||
Popup *value_input_popup;
|
||||
LineEdit *value_input;
|
||||
bool value_input_just_closed;
|
||||
|
||||
|
|
|
|||
|
|
@ -70,11 +70,11 @@ void EditorSubScene::_path_browse() {
|
|||
}
|
||||
|
||||
void EditorSubScene::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
||||
|
||||
if (is_visible() && scene == NULL)
|
||||
if (is_visible() && scene == NULL) {
|
||||
_path_browse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -240,7 +240,7 @@ EditorSubScene::EditorSubScene() {
|
|||
path = memnew(LineEdit);
|
||||
path->connect("text_entered", callable_mp(this, &EditorSubScene::_path_changed));
|
||||
hb->add_child(path);
|
||||
path->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
path->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
Button *b = memnew(Button);
|
||||
b->set_text(TTR("Browse"));
|
||||
hb->add_child(b);
|
||||
|
|
@ -248,7 +248,7 @@ EditorSubScene::EditorSubScene() {
|
|||
vb->add_margin_child(TTR("Scene Path:"), hb);
|
||||
|
||||
tree = memnew(Tree);
|
||||
tree->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
vb->add_margin_child(TTR("Import From Node:"), tree, true);
|
||||
tree->set_select_mode(Tree::SELECT_MULTI);
|
||||
tree->connect("multi_selected", callable_mp(this, &EditorSubScene::_item_multi_selected));
|
||||
|
|
@ -266,7 +266,7 @@ EditorSubScene::EditorSubScene() {
|
|||
file_dialog->add_filter("*." + E->get());
|
||||
}
|
||||
|
||||
file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
add_child(file_dialog);
|
||||
file_dialog->connect("file_selected", callable_mp(this, &EditorSubScene::_path_selected));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -910,14 +910,17 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
|
|||
style_window->set_border_color(tab_color);
|
||||
style_window->set_border_width(MARGIN_TOP, 24 * EDSCALE);
|
||||
style_window->set_expand_margin_size(MARGIN_TOP, 24 * EDSCALE);
|
||||
theme->set_stylebox("panel", "WindowDialog", style_window);
|
||||
theme->set_color("title_color", "WindowDialog", font_color);
|
||||
theme->set_icon("close", "WindowDialog", theme->get_icon("GuiClose", "EditorIcons"));
|
||||
theme->set_icon("close_highlight", "WindowDialog", theme->get_icon("GuiClose", "EditorIcons"));
|
||||
theme->set_constant("close_h_ofs", "WindowDialog", 22 * EDSCALE);
|
||||
theme->set_constant("close_v_ofs", "WindowDialog", 20 * EDSCALE);
|
||||
theme->set_constant("title_height", "WindowDialog", 24 * EDSCALE);
|
||||
theme->set_font("title_font", "WindowDialog", theme->get_font("title", "EditorFonts"));
|
||||
|
||||
theme->set_stylebox("panel", "Window", style_default);
|
||||
theme->set_stylebox("panel_window", "Window", style_window);
|
||||
theme->set_color("title_color", "Window", font_color);
|
||||
theme->set_icon("close", "Window", theme->get_icon("GuiClose", "EditorIcons"));
|
||||
theme->set_icon("close_highlight", "Window", theme->get_icon("GuiClose", "EditorIcons"));
|
||||
theme->set_constant("close_h_ofs", "Window", 22 * EDSCALE);
|
||||
theme->set_constant("close_v_ofs", "Window", 20 * EDSCALE);
|
||||
theme->set_constant("title_height", "Window", 24 * EDSCALE);
|
||||
theme->set_constant("resize_margin", "Window", 4 * EDSCALE);
|
||||
theme->set_font("title_font", "Window", theme->get_font("title", "EditorFonts"));
|
||||
|
||||
// complex window, for now only Editor settings and Project settings
|
||||
Ref<StyleBoxFlat> style_complex_window = style_window->duplicate();
|
||||
|
|
@ -974,10 +977,13 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
|
|||
theme->set_stylebox("focus", "RichTextLabel", make_empty_stylebox());
|
||||
theme->set_stylebox("normal", "RichTextLabel", style_tree_bg);
|
||||
|
||||
theme->set_stylebox("panel", "EditorHelpBit", make_flat_stylebox(dark_color_1, 6, 4, 6, 4));
|
||||
|
||||
theme->set_color("headline_color", "EditorHelp", mono_color);
|
||||
|
||||
// Panel
|
||||
theme->set_stylebox("panel", "Panel", make_flat_stylebox(dark_color_1, 6, 4, 6, 4));
|
||||
theme->set_stylebox("panel_fg", "Panel", style_default);
|
||||
|
||||
// Label
|
||||
theme->set_stylebox("normal", "Label", style_empty);
|
||||
|
|
|
|||
|
|
@ -30,10 +30,10 @@
|
|||
|
||||
#include "export_template_manager.h"
|
||||
|
||||
#include "core/input/input_filter.h"
|
||||
#include "core/io/json.h"
|
||||
#include "core/io/zip_io.h"
|
||||
#include "core/os/dir_access.h"
|
||||
#include "core/os/input.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "core/version.h"
|
||||
#include "editor_node.h"
|
||||
|
|
@ -82,11 +82,11 @@ void ExportTemplateManager::_update_template_list() {
|
|||
String(VERSION_STATUS) != String("rc");
|
||||
|
||||
Label *current = memnew(Label);
|
||||
current->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
current->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
current_hb->add_child(current);
|
||||
|
||||
if (templates.has(current_version)) {
|
||||
current->add_color_override("font_color", get_color("success_color", "Editor"));
|
||||
current->add_theme_color_override("font_color", current->get_theme_color("success_color", "Editor"));
|
||||
|
||||
// Only display a redownload button if it can be downloaded in the first place
|
||||
if (downloads_available) {
|
||||
|
|
@ -103,7 +103,7 @@ void ExportTemplateManager::_update_template_list() {
|
|||
uninstall->connect("pressed", callable_mp(this, &ExportTemplateManager::_uninstall_template), varray(current_version));
|
||||
|
||||
} else {
|
||||
current->add_color_override("font_color", get_color("error_color", "Editor"));
|
||||
current->add_theme_color_override("font_color", current->get_theme_color("error_color", "Editor"));
|
||||
Button *redownload = memnew(Button);
|
||||
redownload->set_text(TTR("Download"));
|
||||
|
||||
|
|
@ -121,13 +121,13 @@ void ExportTemplateManager::_update_template_list() {
|
|||
|
||||
HBoxContainer *hbc = memnew(HBoxContainer);
|
||||
Label *version = memnew(Label);
|
||||
version->set_modulate(get_color("disabled_font_color", "Editor"));
|
||||
version->set_modulate(current->get_theme_color("disabled_font_color", "Editor"));
|
||||
String text = E->get();
|
||||
if (text == current_version) {
|
||||
text += " " + TTR("(Current)");
|
||||
}
|
||||
version->set_text(text);
|
||||
version->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
version->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
hbc->add_child(version);
|
||||
|
||||
Button *uninstall = memnew(Button);
|
||||
|
|
@ -145,7 +145,7 @@ void ExportTemplateManager::_download_template(const String &p_version) {
|
|||
while (template_list->get_child_count()) {
|
||||
memdelete(template_list->get_child(0));
|
||||
}
|
||||
template_downloader->popup_centered_minsize();
|
||||
template_downloader->popup_centered();
|
||||
template_list_state->set_text(TTR("Retrieving mirrors, please wait..."));
|
||||
template_download_progress->set_max(100);
|
||||
template_download_progress->set_value(0);
|
||||
|
|
@ -157,7 +157,7 @@ void ExportTemplateManager::_download_template(const String &p_version) {
|
|||
void ExportTemplateManager::_uninstall_template(const String &p_version) {
|
||||
|
||||
remove_confirm->set_text(vformat(TTR("Remove template version '%s'?"), p_version));
|
||||
remove_confirm->popup_centered_minsize();
|
||||
remove_confirm->popup_centered();
|
||||
to_remove = p_version;
|
||||
}
|
||||
|
||||
|
|
@ -342,7 +342,7 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
|
|||
void ExportTemplateManager::popup_manager() {
|
||||
|
||||
_update_template_list();
|
||||
popup_centered_minsize(Size2(400, 400) * EDSCALE);
|
||||
popup_centered(Size2(400, 400) * EDSCALE);
|
||||
}
|
||||
|
||||
void ExportTemplateManager::ok_pressed() {
|
||||
|
|
@ -446,7 +446,7 @@ void ExportTemplateManager::_http_download_templates_completed(int p_status, int
|
|||
|
||||
void ExportTemplateManager::_begin_template_download(const String &p_url) {
|
||||
|
||||
if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
|
||||
if (InputFilter::get_singleton()->is_key_pressed(KEY_SHIFT)) {
|
||||
OS::get_singleton()->shell_open(p_url);
|
||||
return;
|
||||
}
|
||||
|
|
@ -483,6 +483,11 @@ void ExportTemplateManager::_window_template_downloader_closed() {
|
|||
|
||||
void ExportTemplateManager::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
||||
if (!is_visible()) {
|
||||
set_process(false);
|
||||
}
|
||||
}
|
||||
if (p_what == NOTIFICATION_PROCESS) {
|
||||
|
||||
update_countdown -= get_process_delta_time();
|
||||
|
|
@ -536,12 +541,6 @@ void ExportTemplateManager::_notification(int p_what) {
|
|||
set_process(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
||||
if (!is_visible_in_tree()) {
|
||||
set_process(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ExportTemplateManager::can_install_android_template() {
|
||||
|
|
@ -674,7 +673,7 @@ ExportTemplateManager::ExportTemplateManager() {
|
|||
installed_scroll->add_child(installed_vb);
|
||||
installed_scroll->set_enable_v_scroll(true);
|
||||
installed_scroll->set_enable_h_scroll(false);
|
||||
installed_vb->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
installed_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
get_cancel()->set_text(TTR("Close"));
|
||||
get_ok()->set_text(TTR("Install From File"));
|
||||
|
|
@ -688,7 +687,7 @@ ExportTemplateManager::ExportTemplateManager() {
|
|||
template_open->set_title(TTR("Select Template File"));
|
||||
template_open->add_filter("*.tpz ; " + TTR("Godot Export Templates"));
|
||||
template_open->set_access(FileDialog::ACCESS_FILESYSTEM);
|
||||
template_open->set_mode(FileDialog::MODE_OPEN_FILE);
|
||||
template_open->set_file_mode(FileDialog::FILE_MODE_OPEN_FILE);
|
||||
template_open->connect("file_selected", callable_mp(this, &ExportTemplateManager::_install_from_file), varray(true));
|
||||
add_child(template_open);
|
||||
|
||||
|
|
@ -708,7 +707,7 @@ ExportTemplateManager::ExportTemplateManager() {
|
|||
template_downloader->get_ok()->set_text(TTR("Close"));
|
||||
template_downloader->set_exclusive(true);
|
||||
add_child(template_downloader);
|
||||
template_downloader->connect("popup_hide", callable_mp(this, &ExportTemplateManager::_window_template_downloader_closed));
|
||||
template_downloader->connect("cancelled", callable_mp(this, &ExportTemplateManager::_window_template_downloader_closed));
|
||||
|
||||
VBoxContainer *vbc = memnew(VBoxContainer);
|
||||
template_downloader->add_child(vbc);
|
||||
|
|
|
|||
|
|
@ -42,16 +42,17 @@
|
|||
#include "editor_scale.h"
|
||||
#include "editor_settings.h"
|
||||
#include "import_dock.h"
|
||||
#include "scene/main/viewport.h"
|
||||
#include "scene/main/window.h"
|
||||
#include "scene/resources/packed_scene.h"
|
||||
#include "servers/display_server.h"
|
||||
|
||||
Ref<Texture2D> FileSystemDock::_get_tree_item_icon(EditorFileSystemDirectory *p_dir, int p_idx) {
|
||||
Ref<Texture2D> file_icon;
|
||||
if (!p_dir->get_file_import_is_valid(p_idx)) {
|
||||
file_icon = get_icon("ImportFail", "EditorIcons");
|
||||
file_icon = get_theme_icon("ImportFail", "EditorIcons");
|
||||
} else {
|
||||
String file_type = p_dir->get_file_type(p_idx);
|
||||
file_icon = (has_icon(file_type, "EditorIcons")) ? get_icon(file_type, "EditorIcons") : get_icon("File", "EditorIcons");
|
||||
file_icon = (has_theme_icon(file_type, "EditorIcons")) ? get_theme_icon(file_type, "EditorIcons") : get_theme_icon("File", "EditorIcons");
|
||||
}
|
||||
return file_icon;
|
||||
}
|
||||
|
|
@ -66,8 +67,8 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
|
|||
dname = "res://";
|
||||
|
||||
subdirectory_item->set_text(0, dname);
|
||||
subdirectory_item->set_icon(0, get_icon("Folder", "EditorIcons"));
|
||||
subdirectory_item->set_icon_modulate(0, get_color("folder_icon_modulate", "FileDialog"));
|
||||
subdirectory_item->set_icon(0, get_theme_icon("Folder", "EditorIcons"));
|
||||
subdirectory_item->set_icon_modulate(0, get_theme_color("folder_icon_modulate", "FileDialog"));
|
||||
subdirectory_item->set_selectable(0, true);
|
||||
String lpath = p_dir->get_path();
|
||||
subdirectory_item->set_metadata(0, lpath);
|
||||
|
|
@ -121,7 +122,7 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
|
|||
file_item->set_as_cursor(0);
|
||||
}
|
||||
if (main_scene == file_metadata) {
|
||||
file_item->set_custom_color(0, get_color("accent_color", "Editor"));
|
||||
file_item->set_custom_color(0, get_theme_color("accent_color", "Editor"));
|
||||
}
|
||||
Array udata;
|
||||
udata.push_back(tree_update_id);
|
||||
|
|
@ -187,7 +188,7 @@ void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, boo
|
|||
|
||||
// Handles the favorites.
|
||||
TreeItem *favorites = tree->create_item(root);
|
||||
favorites->set_icon(0, get_icon("Favorites", "EditorIcons"));
|
||||
favorites->set_icon(0, get_theme_icon("Favorites", "EditorIcons"));
|
||||
favorites->set_text(0, TTR("Favorites:"));
|
||||
favorites->set_metadata(0, "Favorites");
|
||||
favorites->set_collapsed(p_uncollapsed_paths.find("Favorites") < 0);
|
||||
|
|
@ -198,8 +199,8 @@ void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, boo
|
|||
if (!fave.begins_with("res://"))
|
||||
continue;
|
||||
|
||||
Ref<Texture2D> folder_icon = get_icon("Folder", "EditorIcons");
|
||||
const Color folder_color = get_color("folder_icon_modulate", "FileDialog");
|
||||
Ref<Texture2D> folder_icon = get_theme_icon("Folder", "EditorIcons");
|
||||
const Color folder_color = get_theme_color("folder_icon_modulate", "FileDialog");
|
||||
|
||||
String text;
|
||||
Ref<Texture2D> icon;
|
||||
|
|
@ -219,7 +220,7 @@ void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, boo
|
|||
if (dir) {
|
||||
icon = _get_tree_item_icon(dir, index);
|
||||
} else {
|
||||
icon = get_icon("File", "EditorIcons");
|
||||
icon = get_theme_icon("File", "EditorIcons");
|
||||
}
|
||||
color = Color(1, 1, 1);
|
||||
}
|
||||
|
|
@ -306,20 +307,21 @@ void FileSystemDock::_notification(int p_what) {
|
|||
EditorResourcePreview::get_singleton()->connect("preview_invalidated", callable_mp(this, &FileSystemDock::_preview_invalidated));
|
||||
|
||||
String ei = "EditorIcons";
|
||||
button_reload->set_icon(get_icon("Reload", ei));
|
||||
button_toggle_display_mode->set_icon(get_icon("Panels2", ei));
|
||||
|
||||
button_reload->set_icon(get_theme_icon("Reload", ei));
|
||||
button_toggle_display_mode->set_icon(get_theme_icon("Panels2", ei));
|
||||
button_file_list_display_mode->connect("pressed", callable_mp(this, &FileSystemDock::_toggle_file_display));
|
||||
|
||||
files->connect("item_activated", callable_mp(this, &FileSystemDock::_file_list_activate_file));
|
||||
button_hist_next->connect("pressed", callable_mp(this, &FileSystemDock::_fw_history));
|
||||
button_hist_prev->connect("pressed", callable_mp(this, &FileSystemDock::_bw_history));
|
||||
tree_search_box->set_right_icon(get_icon("Search", ei));
|
||||
tree_search_box->set_right_icon(get_theme_icon("Search", ei));
|
||||
tree_search_box->set_clear_button_enabled(true);
|
||||
file_list_search_box->set_right_icon(get_icon("Search", ei));
|
||||
file_list_search_box->set_right_icon(get_theme_icon("Search", ei));
|
||||
file_list_search_box->set_clear_button_enabled(true);
|
||||
|
||||
button_hist_next->set_icon(get_icon("Forward", ei));
|
||||
button_hist_prev->set_icon(get_icon("Back", ei));
|
||||
button_hist_next->set_icon(get_theme_icon("Forward", ei));
|
||||
button_hist_prev->set_icon(get_theme_icon("Back", ei));
|
||||
file_list_popup->connect("id_pressed", callable_mp(this, &FileSystemDock::_file_list_rmb_option));
|
||||
tree_popup->connect("id_pressed", callable_mp(this, &FileSystemDock::_tree_rmb_option));
|
||||
|
||||
|
|
@ -369,19 +371,19 @@ void FileSystemDock::_notification(int p_what) {
|
|||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||
// Update icons.
|
||||
String ei = "EditorIcons";
|
||||
button_reload->set_icon(get_icon("Reload", ei));
|
||||
button_toggle_display_mode->set_icon(get_icon("Panels2", ei));
|
||||
button_hist_next->set_icon(get_icon("Forward", ei));
|
||||
button_hist_prev->set_icon(get_icon("Back", ei));
|
||||
button_reload->set_icon(get_theme_icon("Reload", ei));
|
||||
button_toggle_display_mode->set_icon(get_theme_icon("Panels2", ei));
|
||||
button_hist_next->set_icon(get_theme_icon("Forward", ei));
|
||||
button_hist_prev->set_icon(get_theme_icon("Back", ei));
|
||||
if (file_list_display_mode == FILE_LIST_DISPLAY_LIST) {
|
||||
button_file_list_display_mode->set_icon(get_icon("FileThumbnail", "EditorIcons"));
|
||||
button_file_list_display_mode->set_icon(get_theme_icon("FileThumbnail", "EditorIcons"));
|
||||
} else {
|
||||
button_file_list_display_mode->set_icon(get_icon("FileList", "EditorIcons"));
|
||||
button_file_list_display_mode->set_icon(get_theme_icon("FileList", "EditorIcons"));
|
||||
}
|
||||
|
||||
tree_search_box->set_right_icon(get_icon("Search", ei));
|
||||
tree_search_box->set_right_icon(get_theme_icon("Search", ei));
|
||||
tree_search_box->set_clear_button_enabled(true);
|
||||
file_list_search_box->set_right_icon(get_icon("Search", ei));
|
||||
file_list_search_box->set_right_icon(get_theme_icon("Search", ei));
|
||||
file_list_search_box->set_clear_button_enabled(true);
|
||||
|
||||
// Update always show folders.
|
||||
|
|
@ -532,11 +534,11 @@ void FileSystemDock::_toggle_file_display() {
|
|||
void FileSystemDock::_set_file_display(bool p_active) {
|
||||
if (p_active) {
|
||||
file_list_display_mode = FILE_LIST_DISPLAY_LIST;
|
||||
button_file_list_display_mode->set_icon(get_icon("FileThumbnail", "EditorIcons"));
|
||||
button_file_list_display_mode->set_icon(get_theme_icon("FileThumbnail", "EditorIcons"));
|
||||
button_file_list_display_mode->set_tooltip(TTR("View items as a grid of thumbnails."));
|
||||
} else {
|
||||
file_list_display_mode = FILE_LIST_DISPLAY_THUMBNAILS;
|
||||
button_file_list_display_mode->set_icon(get_icon("FileList", "EditorIcons"));
|
||||
button_file_list_display_mode->set_icon(get_theme_icon("FileList", "EditorIcons"));
|
||||
button_file_list_display_mode->set_tooltip(TTR("View items as a list."));
|
||||
}
|
||||
|
||||
|
|
@ -628,13 +630,13 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
|
|||
files->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size));
|
||||
|
||||
if (thumbnail_size < 64) {
|
||||
folder_thumbnail = get_icon("FolderMediumThumb", ei);
|
||||
file_thumbnail = get_icon("FileMediumThumb", ei);
|
||||
file_thumbnail_broken = get_icon("FileDeadMediumThumb", ei);
|
||||
folder_thumbnail = get_theme_icon("FolderMediumThumb", ei);
|
||||
file_thumbnail = get_theme_icon("FileMediumThumb", ei);
|
||||
file_thumbnail_broken = get_theme_icon("FileDeadMediumThumb", ei);
|
||||
} else {
|
||||
folder_thumbnail = get_icon("FolderBigThumb", ei);
|
||||
file_thumbnail = get_icon("FileBigThumb", ei);
|
||||
file_thumbnail_broken = get_icon("FileDeadBigThumb", ei);
|
||||
folder_thumbnail = get_theme_icon("FolderBigThumb", ei);
|
||||
file_thumbnail = get_theme_icon("FileBigThumb", ei);
|
||||
file_thumbnail_broken = get_theme_icon("FileDeadBigThumb", ei);
|
||||
}
|
||||
} else {
|
||||
// No thumbnails.
|
||||
|
|
@ -645,8 +647,8 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
|
|||
files->set_fixed_icon_size(Size2());
|
||||
}
|
||||
|
||||
Ref<Texture2D> folder_icon = (use_thumbnails) ? folder_thumbnail : get_icon("folder", "FileDialog");
|
||||
const Color folder_color = get_color("folder_icon_modulate", "FileDialog");
|
||||
Ref<Texture2D> folder_icon = (use_thumbnails) ? folder_thumbnail : get_theme_icon("folder", "FileDialog");
|
||||
const Color folder_color = get_theme_color("folder_icon_modulate", "FileDialog");
|
||||
|
||||
// Build the FileInfo list.
|
||||
List<FileInfo> filelist;
|
||||
|
|
@ -766,10 +768,10 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
|
|||
|
||||
// Select the icons.
|
||||
if (!finfo->import_broken) {
|
||||
type_icon = (has_icon(ftype, ei)) ? get_icon(ftype, ei) : get_icon(oi, ei);
|
||||
type_icon = (has_theme_icon(ftype, ei)) ? get_theme_icon(ftype, ei) : get_theme_icon(oi, ei);
|
||||
big_icon = file_thumbnail;
|
||||
} else {
|
||||
type_icon = get_icon("ImportFail", ei);
|
||||
type_icon = get_theme_icon("ImportFail", ei);
|
||||
big_icon = file_thumbnail_broken;
|
||||
tooltip += "\n" + TTR("Status: Import of file failed. Please fix file and reimport manually.");
|
||||
}
|
||||
|
|
@ -789,7 +791,7 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
|
|||
}
|
||||
|
||||
if (fpath == main_scene) {
|
||||
files->set_item_custom_fg_color(item_index, get_color("accent_color", "Editor"));
|
||||
files->set_item_custom_fg_color(item_index, get_theme_color("accent_color", "Editor"));
|
||||
}
|
||||
|
||||
// Generate the preview.
|
||||
|
|
@ -1412,7 +1414,7 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool p_ove
|
|||
bool can_move = _check_existing();
|
||||
if (!can_move) {
|
||||
// Ask to do something.
|
||||
overwrite_dialog->popup_centered_minsize();
|
||||
overwrite_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -1676,7 +1678,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
|
|||
rename_dialog_text->set_text(name);
|
||||
rename_dialog_text->select(0, name.length());
|
||||
}
|
||||
rename_dialog->popup_centered_minsize(Size2(250, 80) * EDSCALE);
|
||||
rename_dialog->popup_centered(Size2(250, 80) * EDSCALE);
|
||||
rename_dialog_text->grab_focus();
|
||||
}
|
||||
}
|
||||
|
|
@ -1720,7 +1722,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
|
|||
duplicate_dialog_text->set_text(name);
|
||||
duplicate_dialog_text->select(0, name.length());
|
||||
}
|
||||
duplicate_dialog->popup_centered_minsize(Size2(250, 80) * EDSCALE);
|
||||
duplicate_dialog->popup_centered(Size2(250, 80) * EDSCALE);
|
||||
duplicate_dialog_text->grab_focus();
|
||||
}
|
||||
} break;
|
||||
|
|
@ -1742,14 +1744,14 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
|
|||
case FILE_NEW_FOLDER: {
|
||||
make_dir_dialog_text->set_text("new folder");
|
||||
make_dir_dialog_text->select_all();
|
||||
make_dir_dialog->popup_centered_minsize(Size2(250, 80) * EDSCALE);
|
||||
make_dir_dialog->popup_centered(Size2(250, 80) * EDSCALE);
|
||||
make_dir_dialog_text->grab_focus();
|
||||
} break;
|
||||
|
||||
case FILE_NEW_SCENE: {
|
||||
make_scene_dialog_text->set_text("new scene");
|
||||
make_scene_dialog_text->select_all();
|
||||
make_scene_dialog->popup_centered_minsize(Size2(250, 80) * EDSCALE);
|
||||
make_scene_dialog->popup_centered(Size2(250, 80) * EDSCALE);
|
||||
make_scene_dialog_text->grab_focus();
|
||||
} break;
|
||||
|
||||
|
|
@ -1765,7 +1767,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
|
|||
case FILE_COPY_PATH: {
|
||||
if (!p_selected.empty()) {
|
||||
String fpath = p_selected[0];
|
||||
OS::get_singleton()->set_clipboard(fpath);
|
||||
DisplayServer::get_singleton()->clipboard_set(fpath);
|
||||
}
|
||||
} break;
|
||||
|
||||
|
|
@ -2178,28 +2180,28 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<Str
|
|||
if (all_files) {
|
||||
if (all_files_scenes) {
|
||||
if (filenames.size() == 1) {
|
||||
p_popup->add_icon_item(get_icon("Load", "EditorIcons"), TTR("Open Scene"), FILE_OPEN);
|
||||
p_popup->add_icon_item(get_icon("CreateNewSceneFrom", "EditorIcons"), TTR("New Inherited Scene"), FILE_INHERIT);
|
||||
p_popup->add_icon_item(get_theme_icon("Load", "EditorIcons"), TTR("Open Scene"), FILE_OPEN);
|
||||
p_popup->add_icon_item(get_theme_icon("CreateNewSceneFrom", "EditorIcons"), TTR("New Inherited Scene"), FILE_INHERIT);
|
||||
if (ProjectSettings::get_singleton()->get("application/run/main_scene") != filenames[0]) {
|
||||
p_popup->add_icon_item(get_icon("PlayScene", "EditorIcons"), TTR("Set As Main Scene"), FILE_MAIN_SCENE);
|
||||
p_popup->add_icon_item(get_theme_icon("PlayScene", "EditorIcons"), TTR("Set As Main Scene"), FILE_MAIN_SCENE);
|
||||
}
|
||||
} else {
|
||||
p_popup->add_icon_item(get_icon("Load", "EditorIcons"), TTR("Open Scenes"), FILE_OPEN);
|
||||
p_popup->add_icon_item(get_theme_icon("Load", "EditorIcons"), TTR("Open Scenes"), FILE_OPEN);
|
||||
}
|
||||
p_popup->add_icon_item(get_icon("Instance", "EditorIcons"), TTR("Instance"), FILE_INSTANCE);
|
||||
p_popup->add_icon_item(get_theme_icon("Instance", "EditorIcons"), TTR("Instance"), FILE_INSTANCE);
|
||||
p_popup->add_separator();
|
||||
} else if (filenames.size() == 1) {
|
||||
p_popup->add_icon_item(get_icon("Load", "EditorIcons"), TTR("Open"), FILE_OPEN);
|
||||
p_popup->add_icon_item(get_theme_icon("Load", "EditorIcons"), TTR("Open"), FILE_OPEN);
|
||||
p_popup->add_separator();
|
||||
}
|
||||
}
|
||||
|
||||
if (p_paths.size() >= 1) {
|
||||
if (!all_favorites) {
|
||||
p_popup->add_icon_item(get_icon("Favorites", "EditorIcons"), TTR("Add to Favorites"), FILE_ADD_FAVORITE);
|
||||
p_popup->add_icon_item(get_theme_icon("Favorites", "EditorIcons"), TTR("Add to Favorites"), FILE_ADD_FAVORITE);
|
||||
}
|
||||
if (!all_not_favorites) {
|
||||
p_popup->add_icon_item(get_icon("NonFavorite", "EditorIcons"), TTR("Remove from Favorites"), FILE_REMOVE_FAVORITE);
|
||||
p_popup->add_icon_item(get_theme_icon("NonFavorite", "EditorIcons"), TTR("Remove from Favorites"), FILE_REMOVE_FAVORITE);
|
||||
}
|
||||
p_popup->add_separator();
|
||||
}
|
||||
|
|
@ -2212,36 +2214,36 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<Str
|
|||
}
|
||||
|
||||
} else if (all_folders && foldernames.size() > 0) {
|
||||
p_popup->add_icon_item(get_icon("Load", "EditorIcons"), TTR("Open"), FILE_OPEN);
|
||||
p_popup->add_icon_item(get_theme_icon("Load", "EditorIcons"), TTR("Open"), FILE_OPEN);
|
||||
p_popup->add_separator();
|
||||
}
|
||||
|
||||
if (p_paths.size() == 1) {
|
||||
p_popup->add_icon_item(get_icon("ActionCopy", "EditorIcons"), TTR("Copy Path"), FILE_COPY_PATH);
|
||||
p_popup->add_icon_item(get_theme_icon("ActionCopy", "EditorIcons"), TTR("Copy Path"), FILE_COPY_PATH);
|
||||
if (p_paths[0] != "res://") {
|
||||
p_popup->add_icon_item(get_icon("Rename", "EditorIcons"), TTR("Rename..."), FILE_RENAME);
|
||||
p_popup->add_icon_item(get_icon("Duplicate", "EditorIcons"), TTR("Duplicate..."), FILE_DUPLICATE);
|
||||
p_popup->add_icon_item(get_theme_icon("Rename", "EditorIcons"), TTR("Rename..."), FILE_RENAME);
|
||||
p_popup->add_icon_item(get_theme_icon("Duplicate", "EditorIcons"), TTR("Duplicate..."), FILE_DUPLICATE);
|
||||
}
|
||||
}
|
||||
|
||||
if (p_paths.size() > 1 || p_paths[0] != "res://") {
|
||||
p_popup->add_icon_item(get_icon("MoveUp", "EditorIcons"), TTR("Move To..."), FILE_MOVE);
|
||||
p_popup->add_icon_item(get_icon("Remove", "EditorIcons"), TTR("Delete"), FILE_REMOVE);
|
||||
p_popup->add_icon_item(get_theme_icon("MoveUp", "EditorIcons"), TTR("Move To..."), FILE_MOVE);
|
||||
p_popup->add_icon_item(get_theme_icon("Remove", "EditorIcons"), TTR("Delete"), FILE_REMOVE);
|
||||
}
|
||||
|
||||
if (p_paths.size() == 1) {
|
||||
p_popup->add_separator();
|
||||
if (p_display_path_dependent_options) {
|
||||
p_popup->add_icon_item(get_icon("Folder", "EditorIcons"), TTR("New Folder..."), FILE_NEW_FOLDER);
|
||||
p_popup->add_icon_item(get_icon("PackedScene", "EditorIcons"), TTR("New Scene..."), FILE_NEW_SCENE);
|
||||
p_popup->add_icon_item(get_icon("Script", "EditorIcons"), TTR("New Script..."), FILE_NEW_SCRIPT);
|
||||
p_popup->add_icon_item(get_icon("Object", "EditorIcons"), TTR("New Resource..."), FILE_NEW_RESOURCE);
|
||||
p_popup->add_icon_item(get_theme_icon("Folder", "EditorIcons"), TTR("New Folder..."), FILE_NEW_FOLDER);
|
||||
p_popup->add_icon_item(get_theme_icon("PackedScene", "EditorIcons"), TTR("New Scene..."), FILE_NEW_SCENE);
|
||||
p_popup->add_icon_item(get_theme_icon("Script", "EditorIcons"), TTR("New Script..."), FILE_NEW_SCRIPT);
|
||||
p_popup->add_icon_item(get_theme_icon("Object", "EditorIcons"), TTR("New Resource..."), FILE_NEW_RESOURCE);
|
||||
p_popup->add_separator();
|
||||
}
|
||||
|
||||
String fpath = p_paths[0];
|
||||
String item_text = fpath.ends_with("/") ? TTR("Open in File Manager") : TTR("Show in File Manager");
|
||||
p_popup->add_icon_item(get_icon("Filesystem", "EditorIcons"), item_text, FILE_SHOW_IN_EXPLORER);
|
||||
p_popup->add_icon_item(get_theme_icon("Filesystem", "EditorIcons"), item_text, FILE_SHOW_IN_EXPLORER);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2251,8 +2253,8 @@ void FileSystemDock::_tree_rmb_select(const Vector2 &p_pos) {
|
|||
|
||||
if (paths.size() == 1) {
|
||||
if (paths[0].ends_with("/")) {
|
||||
tree_popup->add_icon_item(get_icon("GuiTreeArrowDown", "EditorIcons"), TTR("Expand All"), FOLDER_EXPAND_ALL);
|
||||
tree_popup->add_icon_item(get_icon("GuiTreeArrowRight", "EditorIcons"), TTR("Collapse All"), FOLDER_COLLAPSE_ALL);
|
||||
tree_popup->add_icon_item(get_theme_icon("GuiTreeArrowDown", "EditorIcons"), TTR("Expand All"), FOLDER_EXPAND_ALL);
|
||||
tree_popup->add_icon_item(get_theme_icon("GuiTreeArrowRight", "EditorIcons"), TTR("Collapse All"), FOLDER_COLLAPSE_ALL);
|
||||
tree_popup->add_separator();
|
||||
}
|
||||
}
|
||||
|
|
@ -2272,10 +2274,10 @@ void FileSystemDock::_tree_rmb_empty(const Vector2 &p_pos) {
|
|||
path = "res://";
|
||||
tree_popup->clear();
|
||||
tree_popup->set_size(Size2(1, 1));
|
||||
tree_popup->add_icon_item(get_icon("Folder", "EditorIcons"), TTR("New Folder..."), FILE_NEW_FOLDER);
|
||||
tree_popup->add_icon_item(get_icon("PackedScene", "EditorIcons"), TTR("New Scene..."), FILE_NEW_SCENE);
|
||||
tree_popup->add_icon_item(get_icon("Script", "EditorIcons"), TTR("New Script..."), FILE_NEW_SCRIPT);
|
||||
tree_popup->add_icon_item(get_icon("Object", "EditorIcons"), TTR("New Resource..."), FILE_NEW_RESOURCE);
|
||||
tree_popup->add_icon_item(get_theme_icon("Folder", "EditorIcons"), TTR("New Folder..."), FILE_NEW_FOLDER);
|
||||
tree_popup->add_icon_item(get_theme_icon("PackedScene", "EditorIcons"), TTR("New Scene..."), FILE_NEW_SCENE);
|
||||
tree_popup->add_icon_item(get_theme_icon("Script", "EditorIcons"), TTR("New Script..."), FILE_NEW_SCRIPT);
|
||||
tree_popup->add_icon_item(get_theme_icon("Object", "EditorIcons"), TTR("New Resource..."), FILE_NEW_RESOURCE);
|
||||
tree_popup->set_position(tree->get_global_position() + p_pos);
|
||||
tree_popup->popup();
|
||||
}
|
||||
|
|
@ -2315,12 +2317,12 @@ void FileSystemDock::_file_list_rmb_pressed(const Vector2 &p_pos) {
|
|||
file_list_popup->clear();
|
||||
file_list_popup->set_size(Size2(1, 1));
|
||||
|
||||
file_list_popup->add_icon_item(get_icon("Folder", "EditorIcons"), TTR("New Folder..."), FILE_NEW_FOLDER);
|
||||
file_list_popup->add_icon_item(get_icon("PackedScene", "EditorIcons"), TTR("New Scene..."), FILE_NEW_SCENE);
|
||||
file_list_popup->add_icon_item(get_icon("Script", "EditorIcons"), TTR("New Script..."), FILE_NEW_SCRIPT);
|
||||
file_list_popup->add_icon_item(get_icon("Object", "EditorIcons"), TTR("New Resource..."), FILE_NEW_RESOURCE);
|
||||
file_list_popup->add_icon_item(get_theme_icon("Folder", "EditorIcons"), TTR("New Folder..."), FILE_NEW_FOLDER);
|
||||
file_list_popup->add_icon_item(get_theme_icon("PackedScene", "EditorIcons"), TTR("New Scene..."), FILE_NEW_SCENE);
|
||||
file_list_popup->add_icon_item(get_theme_icon("Script", "EditorIcons"), TTR("New Script..."), FILE_NEW_SCRIPT);
|
||||
file_list_popup->add_icon_item(get_theme_icon("Object", "EditorIcons"), TTR("New Resource..."), FILE_NEW_RESOURCE);
|
||||
file_list_popup->add_separator();
|
||||
file_list_popup->add_icon_item(get_icon("Filesystem", "EditorIcons"), TTR("Open in File Manager"), FILE_SHOW_IN_EXPLORER);
|
||||
file_list_popup->add_icon_item(get_theme_icon("Filesystem", "EditorIcons"), TTR("Open in File Manager"), FILE_SHOW_IN_EXPLORER);
|
||||
file_list_popup->set_position(files->get_global_position() + p_pos);
|
||||
file_list_popup->popup();
|
||||
}
|
||||
|
|
@ -2348,8 +2350,6 @@ void FileSystemDock::_file_multi_selected(int p_index, bool p_selected) {
|
|||
}
|
||||
|
||||
void FileSystemDock::_tree_gui_input(Ref<InputEvent> p_event) {
|
||||
if (get_viewport()->get_modal_stack_top())
|
||||
return; // Ignore because of modal window.
|
||||
|
||||
Ref<InputEventKey> key = p_event;
|
||||
if (key.is_valid() && key->is_pressed() && !key->is_echo()) {
|
||||
|
|
@ -2366,8 +2366,6 @@ void FileSystemDock::_tree_gui_input(Ref<InputEvent> p_event) {
|
|||
}
|
||||
|
||||
void FileSystemDock::_file_list_gui_input(Ref<InputEvent> p_event) {
|
||||
if (get_viewport()->get_modal_stack_top())
|
||||
return; // Ignore because of modal window.
|
||||
|
||||
Ref<InputEventKey> key = p_event;
|
||||
if (key.is_valid() && key->is_pressed() && !key->is_echo()) {
|
||||
|
|
@ -2492,7 +2490,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
|
|||
add_child(top_vbc);
|
||||
|
||||
HBoxContainer *toolbar_hbc = memnew(HBoxContainer);
|
||||
toolbar_hbc->add_constant_override("separation", 0);
|
||||
toolbar_hbc->add_theme_constant_override("separation", 0);
|
||||
top_vbc->add_child(toolbar_hbc);
|
||||
|
||||
button_hist_prev = memnew(ToolButton);
|
||||
|
|
@ -2529,7 +2527,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
|
|||
toolbar_hbc->add_child(button_toggle_display_mode);
|
||||
|
||||
HBoxContainer *toolbar2_hbc = memnew(HBoxContainer);
|
||||
toolbar2_hbc->add_constant_override("separation", 0);
|
||||
toolbar2_hbc->add_theme_constant_override("separation", 0);
|
||||
top_vbc->add_child(toolbar2_hbc);
|
||||
|
||||
tree_search_box = memnew(LineEdit);
|
||||
|
|
@ -2539,11 +2537,11 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
|
|||
toolbar2_hbc->add_child(tree_search_box);
|
||||
|
||||
file_list_popup = memnew(PopupMenu);
|
||||
file_list_popup->set_hide_on_window_lose_focus(true);
|
||||
|
||||
add_child(file_list_popup);
|
||||
|
||||
tree_popup = memnew(PopupMenu);
|
||||
tree_popup->set_hide_on_window_lose_focus(true);
|
||||
|
||||
add_child(tree_popup);
|
||||
|
||||
split_box = memnew(VSplitContainer);
|
||||
|
|
|
|||
|
|
@ -299,14 +299,14 @@ const char *FindInFilesDialog::SIGNAL_REPLACE_REQUESTED = "replace_requested";
|
|||
|
||||
FindInFilesDialog::FindInFilesDialog() {
|
||||
|
||||
set_custom_minimum_size(Size2(500 * EDSCALE, 0));
|
||||
set_min_size(Size2(500 * EDSCALE, 0));
|
||||
set_title(TTR("Find in Files"));
|
||||
|
||||
VBoxContainer *vbc = memnew(VBoxContainer);
|
||||
vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_BEGIN, 8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -8 * EDSCALE);
|
||||
vbc->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, -8 * EDSCALE);
|
||||
add_child(vbc);
|
||||
|
||||
GridContainer *gc = memnew(GridContainer);
|
||||
|
|
@ -318,7 +318,7 @@ FindInFilesDialog::FindInFilesDialog() {
|
|||
gc->add_child(find_label);
|
||||
|
||||
_search_text_line_edit = memnew(LineEdit);
|
||||
_search_text_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
_search_text_line_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
_search_text_line_edit->connect("text_changed", callable_mp(this, &FindInFilesDialog::_on_search_text_modified));
|
||||
_search_text_line_edit->connect("text_entered", callable_mp(this, &FindInFilesDialog::_on_search_text_entered));
|
||||
gc->add_child(_search_text_line_edit);
|
||||
|
|
@ -329,7 +329,7 @@ FindInFilesDialog::FindInFilesDialog() {
|
|||
gc->add_child(_replace_label);
|
||||
|
||||
_replace_text_line_edit = memnew(LineEdit);
|
||||
_replace_text_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
_replace_text_line_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
_replace_text_line_edit->connect("text_entered", callable_mp(this, &FindInFilesDialog::_on_replace_text_entered));
|
||||
_replace_text_line_edit->hide();
|
||||
gc->add_child(_replace_text_line_edit);
|
||||
|
|
@ -362,7 +362,7 @@ FindInFilesDialog::FindInFilesDialog() {
|
|||
hbc->add_child(prefix_label);
|
||||
|
||||
_folder_line_edit = memnew(LineEdit);
|
||||
_folder_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
_folder_line_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
hbc->add_child(_folder_line_edit);
|
||||
|
||||
Button *folder_button = memnew(Button);
|
||||
|
|
@ -371,7 +371,7 @@ FindInFilesDialog::FindInFilesDialog() {
|
|||
hbc->add_child(folder_button);
|
||||
|
||||
_folder_dialog = memnew(FileDialog);
|
||||
_folder_dialog->set_mode(FileDialog::MODE_OPEN_DIR);
|
||||
_folder_dialog->set_file_mode(FileDialog::FILE_MODE_OPEN_DIR);
|
||||
_folder_dialog->connect("dir_selected", callable_mp(this, &FindInFilesDialog::_on_folder_selected));
|
||||
add_child(_folder_dialog);
|
||||
|
||||
|
|
@ -464,6 +464,7 @@ Set<String> FindInFilesDialog::get_filter() const {
|
|||
|
||||
void FindInFilesDialog::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
||||
|
||||
if (is_visible()) {
|
||||
// Doesn't work more than once if not deferred...
|
||||
_search_text_line_edit->call_deferred("grab_focus");
|
||||
|
|
@ -576,7 +577,7 @@ FindInFilesPanel::FindInFilesPanel() {
|
|||
hbc->add_child(find_label);
|
||||
|
||||
_search_text_label = memnew(Label);
|
||||
_search_text_label->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("source", "EditorFonts"));
|
||||
_search_text_label->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font("source", "EditorFonts"));
|
||||
hbc->add_child(_search_text_label);
|
||||
|
||||
_progress_bar = memnew(ProgressBar);
|
||||
|
|
@ -604,7 +605,7 @@ FindInFilesPanel::FindInFilesPanel() {
|
|||
}
|
||||
|
||||
_results_display = memnew(Tree);
|
||||
_results_display->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("source", "EditorFonts"));
|
||||
_results_display->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font("source", "EditorFonts"));
|
||||
_results_display->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
_results_display->connect("item_selected", callable_mp(this, &FindInFilesPanel::_on_result_selected));
|
||||
_results_display->connect("item_edited", callable_mp(this, &FindInFilesPanel::_on_item_edited));
|
||||
|
|
@ -734,7 +735,7 @@ void FindInFilesPanel::_on_result_found(String fpath, int line_number, int begin
|
|||
item->set_text(text_index, item_text);
|
||||
item->set_custom_draw(text_index, this, "_draw_result_text");
|
||||
|
||||
Ref<Font> font = _results_display->get_font("font");
|
||||
Ref<Font> font = _results_display->get_theme_font("font");
|
||||
|
||||
float raw_text_width = font->get_string_size(text).x;
|
||||
float item_text_width = font->get_string_size(item_text).x;
|
||||
|
|
@ -780,11 +781,11 @@ void FindInFilesPanel::_on_item_edited() {
|
|||
TreeItem *item = _results_display->get_selected();
|
||||
|
||||
if (item->is_checked(0)) {
|
||||
item->set_custom_color(1, _results_display->get_color("font_color"));
|
||||
item->set_custom_color(1, _results_display->get_theme_color("font_color"));
|
||||
|
||||
} else {
|
||||
// Grey out
|
||||
Color color = _results_display->get_color("font_color");
|
||||
Color color = _results_display->get_theme_color("font_color");
|
||||
color.a /= 2.0;
|
||||
item->set_custom_color(1, color);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,10 +120,11 @@ public:
|
|||
Set<String> get_filter() const;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
void _notification(int p_what);
|
||||
|
||||
void _visibility_changed();
|
||||
void custom_action(const String &p_action);
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
void _on_folder_button_pressed();
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ void GroupDialog::_load_nodes(Node *p_current) {
|
|||
|
||||
if (!_can_edit(p_current, selected_group)) {
|
||||
node->set_selectable(0, false);
|
||||
node->set_custom_color(0, get_color("disabled_font_color", "Editor"));
|
||||
node->set_custom_color(0, groups->get_theme_color("disabled_font_color", "Editor"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -204,7 +204,7 @@ void GroupDialog::_add_group(String p_name) {
|
|||
|
||||
TreeItem *new_group = groups->create_item(groups_root);
|
||||
new_group->set_text(0, name);
|
||||
new_group->add_button(0, get_icon("Remove", "EditorIcons"), 0);
|
||||
new_group->add_button(0, groups->get_theme_icon("Remove", "EditorIcons"), 0);
|
||||
new_group->set_editable(0, true);
|
||||
new_group->select(0);
|
||||
groups->ensure_cursor_is_visible();
|
||||
|
|
@ -361,12 +361,12 @@ void GroupDialog::_delete_group_item(const String &p_name) {
|
|||
void GroupDialog::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
add_button->set_icon(get_icon("Forward", "EditorIcons"));
|
||||
remove_button->set_icon(get_icon("Back", "EditorIcons"));
|
||||
add_button->set_icon(groups->get_theme_icon("Forward", "EditorIcons"));
|
||||
remove_button->set_icon(groups->get_theme_icon("Back", "EditorIcons"));
|
||||
|
||||
add_filter->set_right_icon(get_icon("Search", "EditorIcons"));
|
||||
add_filter->set_right_icon(groups->get_theme_icon("Search", "EditorIcons"));
|
||||
add_filter->set_clear_button_enabled(true);
|
||||
remove_filter->set_right_icon(get_icon("Search", "EditorIcons"));
|
||||
remove_filter->set_right_icon(groups->get_theme_icon("Search", "EditorIcons"));
|
||||
remove_filter->set_clear_button_enabled(true);
|
||||
} break;
|
||||
}
|
||||
|
|
@ -399,21 +399,21 @@ void GroupDialog::_bind_methods() {
|
|||
}
|
||||
|
||||
GroupDialog::GroupDialog() {
|
||||
set_custom_minimum_size(Size2(600, 400) * EDSCALE);
|
||||
set_min_size(Size2(600, 400) * EDSCALE);
|
||||
|
||||
scene_tree = SceneTree::get_singleton();
|
||||
|
||||
VBoxContainer *vbc = memnew(VBoxContainer);
|
||||
add_child(vbc);
|
||||
vbc->set_anchors_and_margins_preset(PRESET_WIDE, PRESET_MODE_KEEP_SIZE, 8 * EDSCALE);
|
||||
vbc->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_KEEP_SIZE, 8 * EDSCALE);
|
||||
|
||||
HBoxContainer *hbc = memnew(HBoxContainer);
|
||||
vbc->add_child(hbc);
|
||||
hbc->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
hbc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
VBoxContainer *vbc_left = memnew(VBoxContainer);
|
||||
hbc->add_child(vbc_left);
|
||||
vbc_left->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
vbc_left->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
Label *group_title = memnew(Label);
|
||||
group_title->set_text(TTR("Groups"));
|
||||
|
|
@ -425,19 +425,19 @@ GroupDialog::GroupDialog() {
|
|||
groups->set_select_mode(Tree::SELECT_SINGLE);
|
||||
groups->set_allow_reselect(true);
|
||||
groups->set_allow_rmb_select(true);
|
||||
groups->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
groups->add_constant_override("draw_guides", 1);
|
||||
groups->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
groups->add_theme_constant_override("draw_guides", 1);
|
||||
groups->connect("item_selected", callable_mp(this, &GroupDialog::_group_selected));
|
||||
groups->connect("button_pressed", callable_mp(this, &GroupDialog::_delete_group_pressed));
|
||||
groups->connect("item_edited", callable_mp(this, &GroupDialog::_group_renamed));
|
||||
|
||||
HBoxContainer *chbc = memnew(HBoxContainer);
|
||||
vbc_left->add_child(chbc);
|
||||
chbc->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
chbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
add_group_text = memnew(LineEdit);
|
||||
chbc->add_child(add_group_text);
|
||||
add_group_text->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
add_group_text->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
add_group_text->connect("text_entered", callable_mp(this, &GroupDialog::_add_group_pressed));
|
||||
|
||||
Button *add_group_button = memnew(Button);
|
||||
|
|
@ -447,7 +447,7 @@ GroupDialog::GroupDialog() {
|
|||
|
||||
VBoxContainer *vbc_add = memnew(VBoxContainer);
|
||||
hbc->add_child(vbc_add);
|
||||
vbc_add->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
vbc_add->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
Label *out_of_group_title = memnew(Label);
|
||||
out_of_group_title->set_text(TTR("Nodes Not in Group"));
|
||||
|
|
@ -458,23 +458,23 @@ GroupDialog::GroupDialog() {
|
|||
nodes_to_add->set_hide_root(true);
|
||||
nodes_to_add->set_hide_folding(true);
|
||||
nodes_to_add->set_select_mode(Tree::SELECT_MULTI);
|
||||
nodes_to_add->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
nodes_to_add->add_constant_override("draw_guides", 1);
|
||||
nodes_to_add->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
nodes_to_add->add_theme_constant_override("draw_guides", 1);
|
||||
|
||||
HBoxContainer *add_filter_hbc = memnew(HBoxContainer);
|
||||
add_filter_hbc->add_constant_override("separate", 0);
|
||||
add_filter_hbc->add_theme_constant_override("separate", 0);
|
||||
vbc_add->add_child(add_filter_hbc);
|
||||
|
||||
add_filter = memnew(LineEdit);
|
||||
add_filter->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
add_filter->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
add_filter->set_placeholder(TTR("Filter nodes"));
|
||||
add_filter_hbc->add_child(add_filter);
|
||||
add_filter->connect("text_changed", callable_mp(this, &GroupDialog::_add_filter_changed));
|
||||
|
||||
VBoxContainer *vbc_buttons = memnew(VBoxContainer);
|
||||
hbc->add_child(vbc_buttons);
|
||||
vbc_buttons->set_h_size_flags(SIZE_SHRINK_CENTER);
|
||||
vbc_buttons->set_v_size_flags(SIZE_SHRINK_CENTER);
|
||||
vbc_buttons->set_h_size_flags(Control::SIZE_SHRINK_CENTER);
|
||||
vbc_buttons->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
|
||||
|
||||
add_button = memnew(ToolButton);
|
||||
add_button->set_text(TTR("Add"));
|
||||
|
|
@ -493,7 +493,7 @@ GroupDialog::GroupDialog() {
|
|||
|
||||
VBoxContainer *vbc_remove = memnew(VBoxContainer);
|
||||
hbc->add_child(vbc_remove);
|
||||
vbc_remove->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
vbc_remove->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
||||
Label *in_group_title = memnew(Label);
|
||||
in_group_title->set_text(TTR("Nodes in Group"));
|
||||
|
|
@ -501,18 +501,18 @@ GroupDialog::GroupDialog() {
|
|||
|
||||
nodes_to_remove = memnew(Tree);
|
||||
vbc_remove->add_child(nodes_to_remove);
|
||||
nodes_to_remove->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
nodes_to_remove->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
nodes_to_remove->set_hide_root(true);
|
||||
nodes_to_remove->set_hide_folding(true);
|
||||
nodes_to_remove->set_select_mode(Tree::SELECT_MULTI);
|
||||
nodes_to_remove->add_constant_override("draw_guides", 1);
|
||||
nodes_to_remove->add_theme_constant_override("draw_guides", 1);
|
||||
|
||||
HBoxContainer *remove_filter_hbc = memnew(HBoxContainer);
|
||||
remove_filter_hbc->add_constant_override("separate", 0);
|
||||
remove_filter_hbc->add_theme_constant_override("separate", 0);
|
||||
vbc_remove->add_child(remove_filter_hbc);
|
||||
|
||||
remove_filter = memnew(LineEdit);
|
||||
remove_filter->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
remove_filter->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
remove_filter->set_placeholder(TTR("Filter nodes"));
|
||||
remove_filter_hbc->add_child(remove_filter);
|
||||
remove_filter->connect("text_changed", callable_mp(this, &GroupDialog::_remove_filter_changed));
|
||||
|
|
@ -524,11 +524,9 @@ GroupDialog::GroupDialog() {
|
|||
group_empty->set_autowrap(true);
|
||||
group_empty->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
|
||||
nodes_to_remove->add_child(group_empty);
|
||||
group_empty->set_anchors_and_margins_preset(PRESET_WIDE, PRESET_MODE_KEEP_SIZE, 8 * EDSCALE);
|
||||
group_empty->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_KEEP_SIZE, 8 * EDSCALE);
|
||||
|
||||
set_title(TTR("Group Editor"));
|
||||
set_as_toplevel(true);
|
||||
set_resizable(true);
|
||||
|
||||
error = memnew(ConfirmationDialog);
|
||||
add_child(error);
|
||||
|
|
@ -639,7 +637,7 @@ void GroupsEditor::update_tree() {
|
|||
TreeItem *item = tree->create_item(root);
|
||||
item->set_text(0, gi.name);
|
||||
if (can_be_deleted) {
|
||||
item->add_button(0, get_icon("Remove", "EditorIcons"), 0);
|
||||
item->add_button(0, get_theme_icon("Remove", "EditorIcons"), 0);
|
||||
} else {
|
||||
item->set_selectable(0, false);
|
||||
}
|
||||
|
|
@ -669,7 +667,7 @@ GroupsEditor::GroupsEditor() {
|
|||
VBoxContainer *vbc = this;
|
||||
|
||||
group_dialog = memnew(GroupDialog);
|
||||
group_dialog->set_as_toplevel(true);
|
||||
|
||||
add_child(group_dialog);
|
||||
group_dialog->connect("group_edited", callable_mp(this, &GroupsEditor::update_tree));
|
||||
|
||||
|
|
@ -682,7 +680,7 @@ GroupsEditor::GroupsEditor() {
|
|||
vbc->add_child(hbc);
|
||||
|
||||
group_name = memnew(LineEdit);
|
||||
group_name->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
group_name->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
hbc->add_child(group_name);
|
||||
group_name->connect("text_entered", callable_mp(this, &GroupsEditor::_add_group));
|
||||
|
||||
|
|
@ -693,11 +691,11 @@ GroupsEditor::GroupsEditor() {
|
|||
|
||||
tree = memnew(Tree);
|
||||
tree->set_hide_root(true);
|
||||
tree->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
vbc->add_child(tree);
|
||||
tree->connect("button_pressed", callable_mp(this, &GroupsEditor::_remove_group));
|
||||
tree->add_constant_override("draw_guides", 1);
|
||||
add_constant_override("separation", 3 * EDSCALE);
|
||||
tree->add_theme_constant_override("draw_guides", 1);
|
||||
add_theme_constant_override("separation", 3 * EDSCALE);
|
||||
}
|
||||
|
||||
GroupsEditor::~GroupsEditor() {
|
||||
|
|
|
|||
|
|
@ -41,9 +41,9 @@
|
|||
#include "scene/gui/tool_button.h"
|
||||
#include "scene/gui/tree.h"
|
||||
|
||||
class GroupDialog : public WindowDialog {
|
||||
class GroupDialog : public AcceptDialog {
|
||||
|
||||
GDCLASS(GroupDialog, WindowDialog);
|
||||
GDCLASS(GroupDialog, AcceptDialog);
|
||||
|
||||
ConfirmationDialog *error;
|
||||
|
||||
|
|
|
|||
|
|
@ -424,7 +424,7 @@ void ImportDock::_reimport_attempt() {
|
|||
|
||||
if (need_restart) {
|
||||
label_warning->set_visible(used_in_resources);
|
||||
reimport_confirm->popup_centered_minsize();
|
||||
reimport_confirm->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -492,13 +492,13 @@ void ImportDock::_notification(int p_what) {
|
|||
|
||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||
|
||||
imported->add_style_override("normal", get_stylebox("normal", "LineEdit"));
|
||||
imported->add_theme_style_override("normal", get_theme_stylebox("normal", "LineEdit"));
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
|
||||
import_opts->edit(params);
|
||||
label_warning->add_color_override("font_color", get_color("warning_color", "Editor"));
|
||||
label_warning->add_theme_color_override("font_color", get_theme_color("warning_color", "Editor"));
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
|
@ -526,7 +526,7 @@ ImportDock::ImportDock() {
|
|||
|
||||
set_name("Import");
|
||||
imported = memnew(Label);
|
||||
imported->add_style_override("normal", EditorNode::get_singleton()->get_gui_base()->get_stylebox("normal", "LineEdit"));
|
||||
imported->add_theme_style_override("normal", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("normal", "LineEdit"));
|
||||
imported->set_clip_text(true);
|
||||
add_child(imported);
|
||||
HBoxContainer *hb = memnew(HBoxContainer);
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ void InspectorDock::_new_resource() {
|
|||
}
|
||||
|
||||
void InspectorDock::_load_resource(const String &p_type) {
|
||||
load_resource_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
load_resource_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
|
||||
List<String> extensions;
|
||||
ResourceLoader::get_recognized_extensions_for_type(p_type, &extensions);
|
||||
|
|
@ -214,7 +214,7 @@ void InspectorDock::_prepare_history() {
|
|||
|
||||
history_menu->get_popup()->clear();
|
||||
|
||||
Ref<Texture2D> base_icon = get_icon("Object", "EditorIcons");
|
||||
Ref<Texture2D> base_icon = get_theme_icon("Object", "EditorIcons");
|
||||
Set<ObjectID> already;
|
||||
for (int i = editor_history->get_history_len() - 1; i >= history_to; i--) {
|
||||
|
||||
|
|
@ -317,7 +317,7 @@ void InspectorDock::_transform_keyed(Object *sp, const String &p_sub, const Tran
|
|||
}
|
||||
|
||||
void InspectorDock::_warning_pressed() {
|
||||
warning_dialog->popup_centered_minsize();
|
||||
warning_dialog->popup_centered();
|
||||
}
|
||||
|
||||
Container *InspectorDock::get_addon_area() {
|
||||
|
|
@ -328,15 +328,15 @@ void InspectorDock::_notification(int p_what) {
|
|||
switch (p_what) {
|
||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||
set_theme(editor->get_gui_base()->get_theme());
|
||||
resource_new_button->set_icon(get_icon("New", "EditorIcons"));
|
||||
resource_load_button->set_icon(get_icon("Load", "EditorIcons"));
|
||||
resource_save_button->set_icon(get_icon("Save", "EditorIcons"));
|
||||
backward_button->set_icon(get_icon("Back", "EditorIcons"));
|
||||
forward_button->set_icon(get_icon("Forward", "EditorIcons"));
|
||||
history_menu->set_icon(get_icon("History", "EditorIcons"));
|
||||
object_menu->set_icon(get_icon("Tools", "EditorIcons"));
|
||||
warning->set_icon(get_icon("NodeWarning", "EditorIcons"));
|
||||
warning->add_color_override("font_color", get_color("warning_color", "Editor"));
|
||||
resource_new_button->set_icon(get_theme_icon("New", "EditorIcons"));
|
||||
resource_load_button->set_icon(get_theme_icon("Load", "EditorIcons"));
|
||||
resource_save_button->set_icon(get_theme_icon("Save", "EditorIcons"));
|
||||
backward_button->set_icon(get_theme_icon("Back", "EditorIcons"));
|
||||
forward_button->set_icon(get_theme_icon("Forward", "EditorIcons"));
|
||||
history_menu->set_icon(get_theme_icon("History", "EditorIcons"));
|
||||
object_menu->set_icon(get_theme_icon("Tools", "EditorIcons"));
|
||||
warning->set_icon(get_theme_icon("NodeWarning", "EditorIcons"));
|
||||
warning->add_theme_color_override("font_color", get_theme_color("warning_color", "Editor"));
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
|
@ -435,7 +435,7 @@ void InspectorDock::update(Object *p_object) {
|
|||
p->add_separator();
|
||||
p->add_shortcut(ED_SHORTCUT("property_editor/make_subresources_unique", TTR("Make Sub-Resources Unique")), OBJECT_UNIQUE_RESOURCES);
|
||||
p->add_separator();
|
||||
p->add_icon_shortcut(get_icon("HelpSearch", "EditorIcons"), ED_SHORTCUT("property_editor/open_help", TTR("Open in Help")), OBJECT_REQUEST_HELP);
|
||||
p->add_icon_shortcut(get_theme_icon("HelpSearch", "EditorIcons"), ED_SHORTCUT("property_editor/open_help", TTR("Open in Help")), OBJECT_REQUEST_HELP);
|
||||
}
|
||||
|
||||
List<MethodInfo> methods;
|
||||
|
|
@ -496,21 +496,21 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) {
|
|||
|
||||
resource_new_button = memnew(ToolButton);
|
||||
resource_new_button->set_tooltip(TTR("Create a new resource in memory and edit it."));
|
||||
resource_new_button->set_icon(get_icon("New", "EditorIcons"));
|
||||
resource_new_button->set_icon(get_theme_icon("New", "EditorIcons"));
|
||||
general_options_hb->add_child(resource_new_button);
|
||||
resource_new_button->connect("pressed", callable_mp(this, &InspectorDock::_new_resource));
|
||||
resource_new_button->set_focus_mode(Control::FOCUS_NONE);
|
||||
|
||||
resource_load_button = memnew(ToolButton);
|
||||
resource_load_button->set_tooltip(TTR("Load an existing resource from disk and edit it."));
|
||||
resource_load_button->set_icon(get_icon("Load", "EditorIcons"));
|
||||
resource_load_button->set_icon(get_theme_icon("Load", "EditorIcons"));
|
||||
general_options_hb->add_child(resource_load_button);
|
||||
resource_load_button->connect("pressed", callable_mp(this, &InspectorDock::_open_resource_selector));
|
||||
resource_load_button->set_focus_mode(Control::FOCUS_NONE);
|
||||
|
||||
resource_save_button = memnew(MenuButton);
|
||||
resource_save_button->set_tooltip(TTR("Save the currently edited resource."));
|
||||
resource_save_button->set_icon(get_icon("Save", "EditorIcons"));
|
||||
resource_save_button->set_icon(get_theme_icon("Save", "EditorIcons"));
|
||||
general_options_hb->add_child(resource_save_button);
|
||||
resource_save_button->get_popup()->add_item(TTR("Save"), RESOURCE_SAVE);
|
||||
resource_save_button->get_popup()->add_item(TTR("Save As..."), RESOURCE_SAVE_AS);
|
||||
|
|
@ -522,7 +522,7 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) {
|
|||
|
||||
backward_button = memnew(ToolButton);
|
||||
general_options_hb->add_child(backward_button);
|
||||
backward_button->set_icon(get_icon("Back", "EditorIcons"));
|
||||
backward_button->set_icon(get_theme_icon("Back", "EditorIcons"));
|
||||
backward_button->set_flat(true);
|
||||
backward_button->set_tooltip(TTR("Go to the previous edited object in history."));
|
||||
backward_button->set_disabled(true);
|
||||
|
|
@ -530,7 +530,7 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) {
|
|||
|
||||
forward_button = memnew(ToolButton);
|
||||
general_options_hb->add_child(forward_button);
|
||||
forward_button->set_icon(get_icon("Forward", "EditorIcons"));
|
||||
forward_button->set_icon(get_theme_icon("Forward", "EditorIcons"));
|
||||
forward_button->set_flat(true);
|
||||
forward_button->set_tooltip(TTR("Go to the next edited object in history."));
|
||||
forward_button->set_disabled(true);
|
||||
|
|
@ -538,9 +538,9 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) {
|
|||
|
||||
history_menu = memnew(MenuButton);
|
||||
history_menu->set_tooltip(TTR("History of recently edited objects."));
|
||||
history_menu->set_icon(get_icon("History", "EditorIcons"));
|
||||
history_menu->set_icon(get_theme_icon("History", "EditorIcons"));
|
||||
general_options_hb->add_child(history_menu);
|
||||
history_menu->connect("about_to_show", callable_mp(this, &InspectorDock::_prepare_history));
|
||||
history_menu->connect("about_to_popup", callable_mp(this, &InspectorDock::_prepare_history));
|
||||
history_menu->get_popup()->connect("id_pressed", callable_mp(this, &InspectorDock::_select_history));
|
||||
|
||||
HBoxContainer *node_info_hb = memnew(HBoxContainer);
|
||||
|
|
@ -551,7 +551,7 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) {
|
|||
node_info_hb->add_child(editor_path);
|
||||
|
||||
object_menu = memnew(MenuButton);
|
||||
object_menu->set_icon(get_icon("Tools", "EditorIcons"));
|
||||
object_menu->set_icon(get_theme_icon("Tools", "EditorIcons"));
|
||||
node_info_hb->add_child(object_menu);
|
||||
object_menu->set_tooltip(TTR("Object properties."));
|
||||
object_menu->get_popup()->connect("id_pressed", callable_mp(this, &InspectorDock::_menu_option));
|
||||
|
|
@ -564,15 +564,15 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) {
|
|||
search = memnew(LineEdit);
|
||||
search->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
search->set_placeholder(TTR("Filter properties"));
|
||||
search->set_right_icon(get_icon("Search", "EditorIcons"));
|
||||
search->set_right_icon(get_theme_icon("Search", "EditorIcons"));
|
||||
search->set_clear_button_enabled(true);
|
||||
add_child(search);
|
||||
|
||||
warning = memnew(Button);
|
||||
add_child(warning);
|
||||
warning->set_text(TTR("Changes may be lost!"));
|
||||
warning->set_icon(get_icon("NodeWarning", "EditorIcons"));
|
||||
warning->add_color_override("font_color", get_color("warning_color", "Editor"));
|
||||
warning->set_icon(get_theme_icon("NodeWarning", "EditorIcons"));
|
||||
warning->add_theme_color_override("font_color", get_theme_color("warning_color", "Editor"));
|
||||
warning->set_clip_text(true);
|
||||
warning->hide();
|
||||
warning->connect("pressed", callable_mp(this, &InspectorDock::_warning_pressed));
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ void NodeDock::_bind_methods() {
|
|||
void NodeDock::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
connections_button->set_icon(get_icon("Signals", "EditorIcons"));
|
||||
groups_button->set_icon(get_icon("Groups", "EditorIcons"));
|
||||
connections_button->set_icon(get_theme_icon("Signals", "EditorIcons"));
|
||||
groups_button->set_icon(get_theme_icon("Groups", "EditorIcons"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ void PaneDrag::_notification(int p_what) {
|
|||
|
||||
case NOTIFICATION_DRAW: {
|
||||
|
||||
Ref<Texture2D> icon = mouse_over ? get_icon("PaneDragHover", "EditorIcons") : get_icon("PaneDrag", "EditorIcons");
|
||||
Ref<Texture2D> icon = mouse_over ? get_theme_icon("PaneDragHover", "EditorIcons") : get_theme_icon("PaneDrag", "EditorIcons");
|
||||
if (!icon.is_null())
|
||||
icon->draw(get_canvas_item(), Point2(0, 0));
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ void PaneDrag::_notification(int p_what) {
|
|||
}
|
||||
Size2 PaneDrag::get_minimum_size() const {
|
||||
|
||||
Ref<Texture2D> icon = get_icon("PaneDrag", "EditorIcons");
|
||||
Ref<Texture2D> icon = get_theme_icon("PaneDrag", "EditorIcons");
|
||||
if (!icon.is_null())
|
||||
return icon->get_size();
|
||||
return Size2();
|
||||
|
|
|
|||
|
|
@ -131,14 +131,15 @@ void PluginConfigDialog::_on_required_text_changed(const String &) {
|
|||
|
||||
void PluginConfigDialog::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||
if (is_visible()) {
|
||||
name_edit->grab_focus();
|
||||
}
|
||||
} break;
|
||||
case NOTIFICATION_READY: {
|
||||
connect("confirmed", callable_mp(this, &PluginConfigDialog::_on_confirmed));
|
||||
get_cancel()->connect("pressed", callable_mp(this, &PluginConfigDialog::_on_cancelled));
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_POST_POPUP: {
|
||||
name_edit->grab_focus();
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -204,9 +204,9 @@ void AbstractPolygon2DEditor::_notification(int p_what) {
|
|||
|
||||
disable_polygon_editing(false, String());
|
||||
|
||||
button_create->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveCreate", "EditorIcons"));
|
||||
button_edit->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveEdit", "EditorIcons"));
|
||||
button_delete->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveDelete", "EditorIcons"));
|
||||
button_create->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveCreate", "EditorIcons"));
|
||||
button_edit->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveEdit", "EditorIcons"));
|
||||
button_delete->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveDelete", "EditorIcons"));
|
||||
button_edit->set_pressed(true);
|
||||
|
||||
get_tree()->connect("node_removed", callable_mp(this, &AbstractPolygon2DEditor::_node_removed));
|
||||
|
|
@ -310,7 +310,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
|
|||
|
||||
if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_pressed()) {
|
||||
create_resource->set_text(String("No polygon resource on this node.\nCreate and assign one?"));
|
||||
create_resource->popup_centered_minsize();
|
||||
create_resource->popup_centered();
|
||||
}
|
||||
return (mb.is_valid() && mb->get_button_index() == 1);
|
||||
}
|
||||
|
|
@ -573,7 +573,7 @@ void AbstractPolygon2DEditor::forward_canvas_draw_over_viewport(Control *p_overl
|
|||
|
||||
Transform2D xform = canvas_item_editor->get_canvas_transform() * _get_node()->get_global_transform();
|
||||
// All polygon points are sharp, so use the sharp handle icon
|
||||
const Ref<Texture2D> handle = get_icon("EditorPathSharpHandle", "EditorIcons");
|
||||
const Ref<Texture2D> handle = get_theme_icon("EditorPathSharpHandle", "EditorIcons");
|
||||
|
||||
const Vertex active_point = get_active_point();
|
||||
const int n_polygons = _get_polygon_count();
|
||||
|
|
@ -651,7 +651,7 @@ void AbstractPolygon2DEditor::forward_canvas_draw_over_viewport(Control *p_overl
|
|||
p_overlay->draw_texture(handle, point - handle->get_size() * 0.5, modulate);
|
||||
|
||||
if (vertex == hover_point) {
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
String num = String::num(vertex.vertex);
|
||||
Size2 num_size = font->get_string_size(num);
|
||||
p_overlay->draw_string(font, point - num_size * 0.5, num, Color(1.0, 1.0, 1.0, 0.5));
|
||||
|
|
@ -661,7 +661,7 @@ void AbstractPolygon2DEditor::forward_canvas_draw_over_viewport(Control *p_overl
|
|||
|
||||
if (edge_point.valid()) {
|
||||
|
||||
Ref<Texture2D> add_handle = get_icon("EditorHandleAdd", "EditorIcons");
|
||||
Ref<Texture2D> add_handle = get_theme_icon("EditorHandleAdd", "EditorIcons");
|
||||
p_overlay->draw_texture(add_handle, edge_point.pos - add_handle->get_size() * 0.5);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven
|
|||
ap->get_animation_list(&names);
|
||||
|
||||
for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
|
||||
animations_menu->add_icon_item(get_icon("Animation", "EditorIcons"), E->get());
|
||||
animations_menu->add_icon_item(get_theme_icon("Animation", "EditorIcons"), E->get());
|
||||
animations_to_add.push_back(E->get());
|
||||
}
|
||||
}
|
||||
|
|
@ -97,7 +97,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven
|
|||
menu->add_separator();
|
||||
menu->add_item(TTR("Load..."), MENU_LOAD_FILE);
|
||||
|
||||
menu->set_global_position(blend_space_draw->get_global_transform().xform(mb->get_position()));
|
||||
menu->set_position(blend_space_draw->get_screen_transform().xform(mb->get_position()));
|
||||
menu->popup();
|
||||
|
||||
add_point_pos = (mb->get_position() / blend_space_draw->get_size()).x;
|
||||
|
|
@ -197,18 +197,18 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven
|
|||
|
||||
void AnimationNodeBlendSpace1DEditor::_blend_space_draw() {
|
||||
|
||||
Color linecolor = get_color("font_color", "Label");
|
||||
Color linecolor = get_theme_color("font_color", "Label");
|
||||
Color linecolor_soft = linecolor;
|
||||
linecolor_soft.a *= 0.5;
|
||||
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Texture2D> icon = get_icon("KeyValue", "EditorIcons");
|
||||
Ref<Texture2D> icon_selected = get_icon("KeySelected", "EditorIcons");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
Ref<Texture2D> icon = get_theme_icon("KeyValue", "EditorIcons");
|
||||
Ref<Texture2D> icon_selected = get_theme_icon("KeySelected", "EditorIcons");
|
||||
|
||||
Size2 s = blend_space_draw->get_size();
|
||||
|
||||
if (blend_space_draw->has_focus()) {
|
||||
Color color = get_color("accent_color", "Editor");
|
||||
Color color = get_theme_color("accent_color", "Editor");
|
||||
blend_space_draw->draw_rect(Rect2(Point2(), s), color, false);
|
||||
}
|
||||
|
||||
|
|
@ -280,7 +280,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_draw() {
|
|||
{
|
||||
Color color;
|
||||
if (tool_blend->is_pressed()) {
|
||||
color = get_color("accent_color", "Editor");
|
||||
color = get_theme_color("accent_color", "Editor");
|
||||
} else {
|
||||
color = linecolor;
|
||||
color.a *= 0.5;
|
||||
|
|
@ -532,15 +532,15 @@ void AnimationNodeBlendSpace1DEditor::_open_editor() {
|
|||
|
||||
void AnimationNodeBlendSpace1DEditor::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
error_panel->add_style_override("panel", get_stylebox("bg", "Tree"));
|
||||
error_label->add_color_override("font_color", get_color("error_color", "Editor"));
|
||||
panel->add_style_override("panel", get_stylebox("bg", "Tree"));
|
||||
tool_blend->set_icon(get_icon("EditPivot", "EditorIcons"));
|
||||
tool_select->set_icon(get_icon("ToolSelect", "EditorIcons"));
|
||||
tool_create->set_icon(get_icon("EditKey", "EditorIcons"));
|
||||
tool_erase->set_icon(get_icon("Remove", "EditorIcons"));
|
||||
snap->set_icon(get_icon("SnapGrid", "EditorIcons"));
|
||||
open_editor->set_icon(get_icon("Edit", "EditorIcons"));
|
||||
error_panel->add_theme_style_override("panel", get_theme_stylebox("bg", "Tree"));
|
||||
error_label->add_theme_color_override("font_color", get_theme_color("error_color", "Editor"));
|
||||
panel->add_theme_style_override("panel", get_theme_stylebox("bg", "Tree"));
|
||||
tool_blend->set_icon(get_theme_icon("EditPivot", "EditorIcons"));
|
||||
tool_select->set_icon(get_theme_icon("ToolSelect", "EditorIcons"));
|
||||
tool_create->set_icon(get_theme_icon("EditKey", "EditorIcons"));
|
||||
tool_erase->set_icon(get_theme_icon("Remove", "EditorIcons"));
|
||||
snap->set_icon(get_theme_icon("SnapGrid", "EditorIcons"));
|
||||
open_editor->set_icon(get_theme_icon("Edit", "EditorIcons"));
|
||||
}
|
||||
|
||||
if (p_what == NOTIFICATION_PROCESS) {
|
||||
|
|
@ -735,7 +735,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() {
|
|||
open_file = memnew(EditorFileDialog);
|
||||
add_child(open_file);
|
||||
open_file->set_title(TTR("Open Animation Node"));
|
||||
open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
open_file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
open_file->connect("file_selected", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_file_opened));
|
||||
undo_redo = EditorNode::get_undo_redo();
|
||||
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@
|
|||
|
||||
#include "animation_blend_space_2d_editor.h"
|
||||
|
||||
#include "core/input/input_filter.h"
|
||||
#include "core/io/resource_loader.h"
|
||||
#include "core/math/delaunay.h"
|
||||
#include "core/os/input.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "core/project_settings.h"
|
||||
#include "editor/editor_scale.h"
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
#include "scene/animation/animation_player.h"
|
||||
#include "scene/gui/menu_button.h"
|
||||
#include "scene/gui/panel.h"
|
||||
#include "scene/main/viewport.h"
|
||||
#include "scene/main/window.h"
|
||||
|
||||
bool AnimationNodeBlendSpace2DEditor::can_edit(const Ref<AnimationNode> &p_node) {
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven
|
|||
List<StringName> names;
|
||||
ap->get_animation_list(&names);
|
||||
for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
|
||||
animations_menu->add_icon_item(get_icon("Animation", "EditorIcons"), E->get());
|
||||
animations_menu->add_icon_item(get_theme_icon("Animation", "EditorIcons"), E->get());
|
||||
animations_to_add.push_back(E->get());
|
||||
}
|
||||
}
|
||||
|
|
@ -124,7 +124,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven
|
|||
menu->add_separator();
|
||||
menu->add_item(TTR("Load..."), MENU_LOAD_FILE);
|
||||
|
||||
menu->set_global_position(blend_space_draw->get_global_transform().xform(mb->get_position()));
|
||||
menu->set_position(blend_space_draw->get_screen_transform().xform(mb->get_position()));
|
||||
menu->popup();
|
||||
add_point_pos = (mb->get_position() / blend_space_draw->get_size());
|
||||
add_point_pos.y = 1.0 - add_point_pos.y;
|
||||
|
|
@ -406,17 +406,17 @@ void AnimationNodeBlendSpace2DEditor::_tool_switch(int p_tool) {
|
|||
|
||||
void AnimationNodeBlendSpace2DEditor::_blend_space_draw() {
|
||||
|
||||
Color linecolor = get_color("font_color", "Label");
|
||||
Color linecolor = get_theme_color("font_color", "Label");
|
||||
Color linecolor_soft = linecolor;
|
||||
linecolor_soft.a *= 0.5;
|
||||
Ref<Font> font = get_font("font", "Label");
|
||||
Ref<Texture2D> icon = get_icon("KeyValue", "EditorIcons");
|
||||
Ref<Texture2D> icon_selected = get_icon("KeySelected", "EditorIcons");
|
||||
Ref<Font> font = get_theme_font("font", "Label");
|
||||
Ref<Texture2D> icon = get_theme_icon("KeyValue", "EditorIcons");
|
||||
Ref<Texture2D> icon_selected = get_theme_icon("KeySelected", "EditorIcons");
|
||||
|
||||
Size2 s = blend_space_draw->get_size();
|
||||
|
||||
if (blend_space_draw->has_focus()) {
|
||||
Color color = get_color("accent_color", "Editor");
|
||||
Color color = get_theme_color("accent_color", "Editor");
|
||||
blend_space_draw->draw_rect(Rect2(Point2(), s), color, false);
|
||||
}
|
||||
blend_space_draw->draw_line(Point2(1, 0), Point2(1, s.height - 1), linecolor);
|
||||
|
|
@ -502,7 +502,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_draw() {
|
|||
|
||||
Color color;
|
||||
if (i == selected_triangle) {
|
||||
color = get_color("accent_color", "Editor");
|
||||
color = get_theme_color("accent_color", "Editor");
|
||||
color.a *= 0.5;
|
||||
} else {
|
||||
color = linecolor;
|
||||
|
|
@ -563,7 +563,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_draw() {
|
|||
{
|
||||
Color color;
|
||||
if (tool_blend->is_pressed()) {
|
||||
color = get_color("accent_color", "Editor");
|
||||
color = get_theme_color("accent_color", "Editor");
|
||||
} else {
|
||||
color = linecolor;
|
||||
color.a *= 0.5;
|
||||
|
|
@ -754,21 +754,21 @@ void AnimationNodeBlendSpace2DEditor::_edit_point_pos(double) {
|
|||
void AnimationNodeBlendSpace2DEditor::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
error_panel->add_style_override("panel", get_stylebox("bg", "Tree"));
|
||||
error_label->add_color_override("font_color", get_color("error_color", "Editor"));
|
||||
panel->add_style_override("panel", get_stylebox("bg", "Tree"));
|
||||
tool_blend->set_icon(get_icon("EditPivot", "EditorIcons"));
|
||||
tool_select->set_icon(get_icon("ToolSelect", "EditorIcons"));
|
||||
tool_create->set_icon(get_icon("EditKey", "EditorIcons"));
|
||||
tool_triangle->set_icon(get_icon("ToolTriangle", "EditorIcons"));
|
||||
tool_erase->set_icon(get_icon("Remove", "EditorIcons"));
|
||||
snap->set_icon(get_icon("SnapGrid", "EditorIcons"));
|
||||
open_editor->set_icon(get_icon("Edit", "EditorIcons"));
|
||||
auto_triangles->set_icon(get_icon("AutoTriangle", "EditorIcons"));
|
||||
error_panel->add_theme_style_override("panel", get_theme_stylebox("bg", "Tree"));
|
||||
error_label->add_theme_color_override("font_color", get_theme_color("error_color", "Editor"));
|
||||
panel->add_theme_style_override("panel", get_theme_stylebox("bg", "Tree"));
|
||||
tool_blend->set_icon(get_theme_icon("EditPivot", "EditorIcons"));
|
||||
tool_select->set_icon(get_theme_icon("ToolSelect", "EditorIcons"));
|
||||
tool_create->set_icon(get_theme_icon("EditKey", "EditorIcons"));
|
||||
tool_triangle->set_icon(get_theme_icon("ToolTriangle", "EditorIcons"));
|
||||
tool_erase->set_icon(get_theme_icon("Remove", "EditorIcons"));
|
||||
snap->set_icon(get_theme_icon("SnapGrid", "EditorIcons"));
|
||||
open_editor->set_icon(get_theme_icon("Edit", "EditorIcons"));
|
||||
auto_triangles->set_icon(get_theme_icon("AutoTriangle", "EditorIcons"));
|
||||
interpolation->clear();
|
||||
interpolation->add_icon_item(get_icon("TrackContinuous", "EditorIcons"), "", 0);
|
||||
interpolation->add_icon_item(get_icon("TrackDiscrete", "EditorIcons"), "", 1);
|
||||
interpolation->add_icon_item(get_icon("TrackCapture", "EditorIcons"), "", 2);
|
||||
interpolation->add_icon_item(get_theme_icon("TrackContinuous", "EditorIcons"), "", 0);
|
||||
interpolation->add_icon_item(get_theme_icon("TrackDiscrete", "EditorIcons"), "", 1);
|
||||
interpolation->add_icon_item(get_theme_icon("TrackCapture", "EditorIcons"), "", 2);
|
||||
}
|
||||
|
||||
if (p_what == NOTIFICATION_PROCESS) {
|
||||
|
|
@ -1042,7 +1042,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() {
|
|||
open_file = memnew(EditorFileDialog);
|
||||
add_child(open_file);
|
||||
open_file->set_title(TTR("Open Animation Node"));
|
||||
open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
open_file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
open_file->connect("file_selected", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_file_opened));
|
||||
undo_redo = EditorNode::get_undo_redo();
|
||||
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@
|
|||
|
||||
#include "animation_blend_tree_editor_plugin.h"
|
||||
|
||||
#include "core/input/input_filter.h"
|
||||
#include "core/io/resource_loader.h"
|
||||
#include "core/os/input.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "core/project_settings.h"
|
||||
#include "editor/editor_inspector.h"
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
#include "scene/gui/menu_button.h"
|
||||
#include "scene/gui/panel.h"
|
||||
#include "scene/gui/progress_bar.h"
|
||||
#include "scene/main/viewport.h"
|
||||
#include "scene/main/window.h"
|
||||
|
||||
void AnimationNodeBlendTreeEditor::add_custom_type(const String &p_name, const Ref<Script> &p_script) {
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
|
|||
name->set_text(E->get());
|
||||
name->set_expand_to_text_length(true);
|
||||
node->add_child(name);
|
||||
node->set_slot(0, false, 0, Color(), true, 0, get_color("font_color", "Label"));
|
||||
node->set_slot(0, false, 0, Color(), true, 0, get_theme_color("font_color", "Label"));
|
||||
name->connect("text_entered", callable_mp(this, &AnimationNodeBlendTreeEditor::_node_renamed), varray(agnode));
|
||||
name->connect("focus_exited", callable_mp(this, &AnimationNodeBlendTreeEditor::_node_renamed_focus_out), varray(name, agnode), CONNECT_DEFERRED);
|
||||
base = 1;
|
||||
|
|
@ -157,7 +157,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
|
|||
Label *in_name = memnew(Label);
|
||||
node->add_child(in_name);
|
||||
in_name->set_text(agnode->get_input_name(i));
|
||||
node->set_slot(base + i, true, 0, get_color("font_color", "Label"), false, 0, Color());
|
||||
node->set_slot(base + i, true, 0, get_theme_color("font_color", "Label"), false, 0, Color());
|
||||
}
|
||||
|
||||
List<PropertyInfo> pinfo;
|
||||
|
|
@ -185,7 +185,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
|
|||
node->add_child(memnew(HSeparator));
|
||||
Button *open_in_editor = memnew(Button);
|
||||
open_in_editor->set_text(TTR("Open Editor"));
|
||||
open_in_editor->set_icon(get_icon("Edit", "EditorIcons"));
|
||||
open_in_editor->set_icon(get_theme_icon("Edit", "EditorIcons"));
|
||||
node->add_child(open_in_editor);
|
||||
open_in_editor->connect("pressed", callable_mp(this, &AnimationNodeBlendTreeEditor::_open_in_editor), varray(E->get()), CONNECT_DEFERRED);
|
||||
open_in_editor->set_h_size_flags(SIZE_SHRINK_CENTER);
|
||||
|
|
@ -196,7 +196,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
|
|||
node->add_child(memnew(HSeparator));
|
||||
Button *edit_filters = memnew(Button);
|
||||
edit_filters->set_text(TTR("Edit Filters"));
|
||||
edit_filters->set_icon(get_icon("AnimationFilter", "EditorIcons"));
|
||||
edit_filters->set_icon(get_theme_icon("AnimationFilter", "EditorIcons"));
|
||||
node->add_child(edit_filters);
|
||||
edit_filters->connect("pressed", callable_mp(this, &AnimationNodeBlendTreeEditor::_edit_filters), varray(E->get()), CONNECT_DEFERRED);
|
||||
edit_filters->set_h_size_flags(SIZE_SHRINK_CENTER);
|
||||
|
|
@ -207,7 +207,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
|
|||
|
||||
MenuButton *mb = memnew(MenuButton);
|
||||
mb->set_text(anim->get_animation());
|
||||
mb->set_icon(get_icon("Animation", "EditorIcons"));
|
||||
mb->set_icon(get_theme_icon("Animation", "EditorIcons"));
|
||||
Array options;
|
||||
|
||||
node->add_child(memnew(HSeparator));
|
||||
|
|
@ -242,16 +242,16 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
|
|||
}
|
||||
|
||||
if (EditorSettings::get_singleton()->get("interface/theme/use_graph_node_headers")) {
|
||||
Ref<StyleBoxFlat> sb = node->get_stylebox("frame", "GraphNode");
|
||||
Ref<StyleBoxFlat> sb = node->get_theme_stylebox("frame", "GraphNode");
|
||||
Color c = sb->get_border_color();
|
||||
Color mono_color = ((c.r + c.g + c.b) / 3) < 0.7 ? Color(1.0, 1.0, 1.0) : Color(0.0, 0.0, 0.0);
|
||||
mono_color.a = 0.85;
|
||||
c = mono_color;
|
||||
|
||||
node->add_color_override("title_color", c);
|
||||
node->add_theme_color_override("title_color", c);
|
||||
c.a = 0.7;
|
||||
node->add_color_override("close_color", c);
|
||||
node->add_color_override("resizer_color", c);
|
||||
node->add_theme_color_override("close_color", c);
|
||||
node->add_theme_color_override("resizer_color", c);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -643,7 +643,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
|
|||
ti->set_text(0, F->get());
|
||||
ti->set_selectable(0, false);
|
||||
ti->set_editable(0, false);
|
||||
ti->set_icon(0, get_icon("BoneAttachment", "EditorIcons"));
|
||||
ti->set_icon(0, get_theme_icon("BoneAttachment", "EditorIcons"));
|
||||
} else {
|
||||
ti = parenthood[accum];
|
||||
}
|
||||
|
|
@ -654,7 +654,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
|
|||
ti->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
|
||||
ti->set_text(0, concat);
|
||||
ti->set_checked(0, anode->is_path_filtered(path));
|
||||
ti->set_icon(0, get_icon("BoneAttachment", "EditorIcons"));
|
||||
ti->set_icon(0, get_theme_icon("BoneAttachment", "EditorIcons"));
|
||||
ti->set_metadata(0, path);
|
||||
|
||||
} else {
|
||||
|
|
@ -705,7 +705,7 @@ void AnimationNodeBlendTreeEditor::_edit_filters(const String &p_which) {
|
|||
if (!_update_filters(anode))
|
||||
return;
|
||||
|
||||
filter_dialog->popup_centered_minsize(Size2(500, 500) * EDSCALE);
|
||||
filter_dialog->popup_centered(Size2(500, 500) * EDSCALE);
|
||||
}
|
||||
|
||||
void AnimationNodeBlendTreeEditor::_removed_from_graph() {
|
||||
|
|
@ -718,8 +718,8 @@ void AnimationNodeBlendTreeEditor::_notification(int p_what) {
|
|||
|
||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
|
||||
error_panel->add_style_override("panel", get_stylebox("bg", "Tree"));
|
||||
error_label->add_color_override("font_color", get_color("error_color", "Editor"));
|
||||
error_panel->add_theme_style_override("panel", get_theme_stylebox("bg", "Tree"));
|
||||
error_label->add_theme_color_override("font_color", get_theme_color("error_color", "Editor"));
|
||||
|
||||
if (p_what == NOTIFICATION_THEME_CHANGED && is_visible_in_tree())
|
||||
_update_graph();
|
||||
|
|
@ -931,7 +931,7 @@ AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() {
|
|||
add_node->set_text(TTR("Add Node..."));
|
||||
graph->get_zoom_hbox()->move_child(add_node, 0);
|
||||
add_node->get_popup()->connect("id_pressed", callable_mp(this, &AnimationNodeBlendTreeEditor::_add_node));
|
||||
add_node->connect("about_to_show", callable_mp(this, &AnimationNodeBlendTreeEditor::_update_options_menu));
|
||||
add_node->connect("about_to_popup", callable_mp(this, &AnimationNodeBlendTreeEditor::_update_options_menu));
|
||||
|
||||
add_options.push_back(AddOption("Animation", "AnimationNodeAnimation"));
|
||||
add_options.push_back(AddOption("OneShot", "AnimationNodeOneShot"));
|
||||
|
|
@ -975,7 +975,7 @@ AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() {
|
|||
open_file = memnew(EditorFileDialog);
|
||||
add_child(open_file);
|
||||
open_file->set_title(TTR("Open Animation Node"));
|
||||
open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
open_file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
open_file->connect("file_selected", callable_mp(this, &AnimationNodeBlendTreeEditor::_file_opened));
|
||||
undo_redo = EditorNode::get_undo_redo();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@
|
|||
|
||||
#include "animation_player_editor_plugin.h"
|
||||
|
||||
#include "core/input/input_filter.h"
|
||||
#include "core/io/resource_loader.h"
|
||||
#include "core/io/resource_saver.h"
|
||||
#include "core/os/input.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "core/project_settings.h"
|
||||
#include "editor/animation_track_editor.h"
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
#include "editor/editor_settings.h"
|
||||
#include "editor/plugins/canvas_item_editor_plugin.h" // For onion skinning.
|
||||
#include "editor/plugins/spatial_editor_plugin.h" // For onion skinning.
|
||||
#include "scene/main/viewport.h"
|
||||
#include "scene/main/window.h"
|
||||
#include "servers/visual_server.h"
|
||||
|
||||
void AnimationPlayerEditor::_node_removed(Node *p_node) {
|
||||
|
|
@ -105,33 +105,33 @@ void AnimationPlayerEditor::_notification(int p_what) {
|
|||
|
||||
get_tree()->connect("node_removed", callable_mp(this, &AnimationPlayerEditor::_node_removed));
|
||||
|
||||
add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel"));
|
||||
add_theme_style_override("panel", editor->get_gui_base()->get_theme_stylebox("panel", "Panel"));
|
||||
} break;
|
||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||
|
||||
add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel"));
|
||||
add_theme_style_override("panel", editor->get_gui_base()->get_theme_stylebox("panel", "Panel"));
|
||||
} break;
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
|
||||
autoplay->set_icon(get_icon("AutoPlay", "EditorIcons"));
|
||||
autoplay->set_icon(get_theme_icon("AutoPlay", "EditorIcons"));
|
||||
|
||||
play->set_icon(get_icon("PlayStart", "EditorIcons"));
|
||||
play_from->set_icon(get_icon("Play", "EditorIcons"));
|
||||
play_bw->set_icon(get_icon("PlayStartBackwards", "EditorIcons"));
|
||||
play_bw_from->set_icon(get_icon("PlayBackwards", "EditorIcons"));
|
||||
play->set_icon(get_theme_icon("PlayStart", "EditorIcons"));
|
||||
play_from->set_icon(get_theme_icon("Play", "EditorIcons"));
|
||||
play_bw->set_icon(get_theme_icon("PlayStartBackwards", "EditorIcons"));
|
||||
play_bw_from->set_icon(get_theme_icon("PlayBackwards", "EditorIcons"));
|
||||
|
||||
autoplay_icon = get_icon("AutoPlay", "EditorIcons");
|
||||
stop->set_icon(get_icon("Stop", "EditorIcons"));
|
||||
autoplay_icon = get_theme_icon("AutoPlay", "EditorIcons");
|
||||
stop->set_icon(get_theme_icon("Stop", "EditorIcons"));
|
||||
|
||||
onion_toggle->set_icon(get_icon("Onion", "EditorIcons"));
|
||||
onion_skinning->set_icon(get_icon("GuiTabMenu", "EditorIcons"));
|
||||
onion_toggle->set_icon(get_theme_icon("Onion", "EditorIcons"));
|
||||
onion_skinning->set_icon(get_theme_icon("GuiTabMenu", "EditorIcons"));
|
||||
|
||||
pin->set_icon(get_icon("Pin", "EditorIcons"));
|
||||
pin->set_icon(get_theme_icon("Pin", "EditorIcons"));
|
||||
|
||||
tool_anim->add_style_override("normal", get_stylebox("normal", "Button"));
|
||||
track_editor->get_edit_menu()->add_style_override("normal", get_stylebox("normal", "Button"));
|
||||
tool_anim->add_theme_style_override("normal", get_theme_stylebox("normal", "Button"));
|
||||
track_editor->get_edit_menu()->add_theme_style_override("normal", get_theme_stylebox("normal", "Button"));
|
||||
|
||||
#define ITEM_ICON(m_item, m_icon) tool_anim->get_popup()->set_item_icon(tool_anim->get_popup()->get_item_index(m_item), get_icon(m_icon, "EditorIcons"))
|
||||
#define ITEM_ICON(m_item, m_icon) tool_anim->get_popup()->set_item_icon(tool_anim->get_popup()->get_item_index(m_item), get_theme_icon(m_icon, "EditorIcons"))
|
||||
|
||||
ITEM_ICON(TOOL_NEW_ANIM, "New");
|
||||
ITEM_ICON(TOOL_LOAD_ANIM, "Load");
|
||||
|
|
@ -349,7 +349,7 @@ void AnimationPlayerEditor::_animation_rename() {
|
|||
}
|
||||
void AnimationPlayerEditor::_animation_load() {
|
||||
ERR_FAIL_COND(!player);
|
||||
file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
file->clear_filters();
|
||||
List<String> extensions;
|
||||
|
||||
|
|
@ -392,7 +392,7 @@ void AnimationPlayerEditor::_animation_save(const Ref<Resource> &p_resource) {
|
|||
|
||||
void AnimationPlayerEditor::_animation_save_as(const Ref<Resource> &p_resource) {
|
||||
|
||||
file->set_mode(EditorFileDialog::MODE_SAVE_FILE);
|
||||
file->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
|
||||
|
||||
List<String> extensions;
|
||||
ResourceSaver::get_recognized_extensions(p_resource, &extensions);
|
||||
|
|
@ -434,7 +434,7 @@ void AnimationPlayerEditor::_animation_remove() {
|
|||
return;
|
||||
|
||||
delete_dialog->set_text(TTR("Delete Animation?"));
|
||||
delete_dialog->popup_centered_minsize();
|
||||
delete_dialog->popup_centered();
|
||||
}
|
||||
|
||||
void AnimationPlayerEditor::_animation_remove_confirmed() {
|
||||
|
|
@ -488,7 +488,7 @@ double AnimationPlayerEditor::_get_editor_step() const {
|
|||
ERR_FAIL_COND_V(!anim.is_valid(), 0.0);
|
||||
|
||||
// Use more precise snapping when holding Shift
|
||||
return Input::get_singleton()->is_key_pressed(KEY_SHIFT) ? anim->get_step() * 0.25 : anim->get_step();
|
||||
return InputFilter::get_singleton()->is_key_pressed(KEY_SHIFT) ? anim->get_step() * 0.25 : anim->get_step();
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
|
|
@ -501,7 +501,7 @@ void AnimationPlayerEditor::_animation_name_edited() {
|
|||
String new_name = name->get_text();
|
||||
if (new_name == "" || new_name.find(":") != -1 || new_name.find("/") != -1) {
|
||||
error_dialog->set_text(TTR("Invalid animation name!"));
|
||||
error_dialog->popup_centered_minsize();
|
||||
error_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -512,7 +512,7 @@ void AnimationPlayerEditor::_animation_name_edited() {
|
|||
|
||||
if (player->has_animation(new_name)) {
|
||||
error_dialog->set_text(TTR("Animation name already exists!"));
|
||||
error_dialog->popup_centered_minsize();
|
||||
error_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1058,7 +1058,7 @@ void AnimationPlayerEditor::_animation_player_changed(Object *p_pl) {
|
|||
if (player == p_pl && is_visible_in_tree()) {
|
||||
|
||||
_update_player();
|
||||
if (blend_editor.dialog->is_visible_in_tree())
|
||||
if (blend_editor.dialog->is_visible())
|
||||
_animation_blend(); // Update.
|
||||
}
|
||||
}
|
||||
|
|
@ -1152,7 +1152,7 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
|
|||
|
||||
if (!animation->get_item_count()) {
|
||||
error_dialog->set_text(TTR("No animation to copy!"));
|
||||
error_dialog->popup_centered_minsize();
|
||||
error_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1165,7 +1165,7 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
|
|||
Ref<Animation> anim2 = EditorSettings::get_singleton()->get_resource_clipboard();
|
||||
if (!anim2.is_valid()) {
|
||||
error_dialog->set_text(TTR("No animation resource on clipboard!"));
|
||||
error_dialog->popup_centered_minsize();
|
||||
error_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1195,7 +1195,7 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
|
|||
|
||||
if (!animation->get_item_count()) {
|
||||
error_dialog->set_text(TTR("No animation to edit!"));
|
||||
error_dialog->popup_centered_minsize();
|
||||
error_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1420,7 +1420,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() {
|
|||
|
||||
// Tweak the root viewport to ensure it's rendered before our target.
|
||||
RID root_vp = get_tree()->get_root()->get_viewport_rid();
|
||||
Rect2 root_vp_screen_rect = get_tree()->get_root()->get_attach_to_screen_rect();
|
||||
Rect2 root_vp_screen_rect = Rect2(Vector2(), get_tree()->get_root()->get_size());
|
||||
VS::get_singleton()->viewport_attach_to_screen(root_vp, Rect2());
|
||||
VS::get_singleton()->viewport_set_update_mode(root_vp, VS::VIEWPORT_UPDATE_ALWAYS);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@
|
|||
|
||||
#include "animation_state_machine_editor.h"
|
||||
|
||||
#include "core/input/input_filter.h"
|
||||
#include "core/io/resource_loader.h"
|
||||
#include "core/math/delaunay.h"
|
||||
#include "core/os/input.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "core/project_settings.h"
|
||||
#include "editor/editor_scale.h"
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
#include "scene/animation/animation_player.h"
|
||||
#include "scene/gui/menu_button.h"
|
||||
#include "scene/gui/panel.h"
|
||||
#include "scene/main/viewport.h"
|
||||
#include "scene/main/window.h"
|
||||
|
||||
bool AnimationNodeStateMachineEditor::can_edit(const Ref<AnimationNode> &p_node) {
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
|
|||
List<StringName> names;
|
||||
ap->get_animation_list(&names);
|
||||
for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
|
||||
animations_menu->add_icon_item(get_icon("Animation", "EditorIcons"), E->get());
|
||||
animations_menu->add_icon_item(get_theme_icon("Animation", "EditorIcons"), E->get());
|
||||
animations_to_add.push_back(E->get());
|
||||
}
|
||||
}
|
||||
|
|
@ -121,7 +121,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
|
|||
menu->add_separator();
|
||||
menu->add_item(TTR("Load..."), MENU_LOAD_FILE);
|
||||
|
||||
menu->set_global_position(state_machine_draw->get_global_transform().xform(mb->get_position()));
|
||||
menu->set_position(state_machine_draw->get_screen_transform().xform(mb->get_position()));
|
||||
menu->popup();
|
||||
add_node_pos = mb->get_position() / EDSCALE + state_machine->get_graph_offset();
|
||||
}
|
||||
|
|
@ -149,16 +149,16 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
|
|||
|
||||
if (node_rects[i].name.has_point(mb->get_position())) { //edit name
|
||||
|
||||
Ref<StyleBox> line_sb = get_stylebox("normal", "LineEdit");
|
||||
Ref<StyleBox> line_sb = get_theme_stylebox("normal", "LineEdit");
|
||||
|
||||
Rect2 edit_rect = node_rects[i].name;
|
||||
edit_rect.position -= line_sb->get_offset();
|
||||
edit_rect.size += line_sb->get_minimum_size();
|
||||
|
||||
name_edit->set_global_position(state_machine_draw->get_global_transform().xform(edit_rect.position));
|
||||
name_edit->set_size(edit_rect.size);
|
||||
name_edit_popup->set_position(state_machine_draw->get_screen_transform().xform(edit_rect.position));
|
||||
name_edit_popup->set_size(edit_rect.size);
|
||||
name_edit->set_text(node_rects[i].node_name);
|
||||
name_edit->show_modal();
|
||||
name_edit_popup->popup();
|
||||
name_edit->grab_focus();
|
||||
name_edit->select_all();
|
||||
|
||||
|
|
@ -504,9 +504,9 @@ void AnimationNodeStateMachineEditor::_add_animation_type(int p_index) {
|
|||
|
||||
void AnimationNodeStateMachineEditor::_connection_draw(const Vector2 &p_from, const Vector2 &p_to, AnimationNodeStateMachineTransition::SwitchMode p_mode, bool p_enabled, bool p_selected, bool p_travel, bool p_auto_advance) {
|
||||
|
||||
Color linecolor = get_color("font_color", "Label");
|
||||
Color linecolor = get_theme_color("font_color", "Label");
|
||||
Color icon_color(1, 1, 1);
|
||||
Color accent = get_color("accent_color", "Editor");
|
||||
Color accent = get_theme_color("accent_color", "Editor");
|
||||
|
||||
if (!p_enabled) {
|
||||
linecolor.a *= 0.2;
|
||||
|
|
@ -515,12 +515,12 @@ void AnimationNodeStateMachineEditor::_connection_draw(const Vector2 &p_from, co
|
|||
}
|
||||
|
||||
Ref<Texture2D> icons[6] = {
|
||||
get_icon("TransitionImmediateBig", "EditorIcons"),
|
||||
get_icon("TransitionSyncBig", "EditorIcons"),
|
||||
get_icon("TransitionEndBig", "EditorIcons"),
|
||||
get_icon("TransitionImmediateAutoBig", "EditorIcons"),
|
||||
get_icon("TransitionSyncAutoBig", "EditorIcons"),
|
||||
get_icon("TransitionEndAutoBig", "EditorIcons")
|
||||
get_theme_icon("TransitionImmediateBig", "EditorIcons"),
|
||||
get_theme_icon("TransitionSyncBig", "EditorIcons"),
|
||||
get_theme_icon("TransitionEndBig", "EditorIcons"),
|
||||
get_theme_icon("TransitionImmediateAutoBig", "EditorIcons"),
|
||||
get_theme_icon("TransitionSyncAutoBig", "EditorIcons"),
|
||||
get_theme_icon("TransitionEndAutoBig", "EditorIcons")
|
||||
};
|
||||
|
||||
if (p_selected) {
|
||||
|
|
@ -573,18 +573,18 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() {
|
|||
|
||||
Ref<AnimationNodeStateMachinePlayback> playback = AnimationTreeEditor::get_singleton()->get_tree()->get(AnimationTreeEditor::get_singleton()->get_base_path() + "playback");
|
||||
|
||||
Ref<StyleBox> style = get_stylebox("state_machine_frame", "GraphNode");
|
||||
Ref<StyleBox> style_selected = get_stylebox("state_machine_selectedframe", "GraphNode");
|
||||
Ref<StyleBox> style = get_theme_stylebox("state_machine_frame", "GraphNode");
|
||||
Ref<StyleBox> style_selected = get_theme_stylebox("state_machine_selectedframe", "GraphNode");
|
||||
|
||||
Ref<Font> font = get_font("title_font", "GraphNode");
|
||||
Color font_color = get_color("title_color", "GraphNode");
|
||||
Ref<Texture2D> play = get_icon("Play", "EditorIcons");
|
||||
Ref<Texture2D> auto_play = get_icon("AutoPlay", "EditorIcons");
|
||||
Ref<Texture2D> edit = get_icon("Edit", "EditorIcons");
|
||||
Color accent = get_color("accent_color", "Editor");
|
||||
Color linecolor = get_color("font_color", "Label");
|
||||
Ref<Font> font = get_theme_font("title_font", "GraphNode");
|
||||
Color font_color = get_theme_color("title_color", "GraphNode");
|
||||
Ref<Texture2D> play = get_theme_icon("Play", "EditorIcons");
|
||||
Ref<Texture2D> auto_play = get_theme_icon("AutoPlay", "EditorIcons");
|
||||
Ref<Texture2D> edit = get_theme_icon("Edit", "EditorIcons");
|
||||
Color accent = get_theme_color("accent_color", "Editor");
|
||||
Color linecolor = get_theme_color("font_color", "Label");
|
||||
linecolor.a *= 0.3;
|
||||
Ref<StyleBox> playing_overlay = get_stylebox("position", "GraphNode");
|
||||
Ref<StyleBox> playing_overlay = get_theme_stylebox("position", "GraphNode");
|
||||
|
||||
bool playing = false;
|
||||
StringName current;
|
||||
|
|
@ -686,7 +686,7 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() {
|
|||
_connection_draw(from, to, AnimationNodeStateMachineTransition::SwitchMode(transition_mode->get_selected()), true, false, false, false);
|
||||
}
|
||||
|
||||
Ref<Texture2D> tr_reference_icon = get_icon("TransitionImmediateBig", "EditorIcons");
|
||||
Ref<Texture2D> tr_reference_icon = get_theme_icon("TransitionImmediateBig", "EditorIcons");
|
||||
float tr_bidi_offset = int(tr_reference_icon->get_height() * 0.8);
|
||||
|
||||
//draw transition lines
|
||||
|
|
@ -879,7 +879,7 @@ void AnimationNodeStateMachineEditor::_state_machine_pos_draw() {
|
|||
|
||||
float pos = CLAMP(play_pos, 0, len);
|
||||
float c = pos / len;
|
||||
Color fg = get_color("font_color", "Label");
|
||||
Color fg = get_theme_color("font_color", "Label");
|
||||
Color bg = fg;
|
||||
bg.a *= 0.3;
|
||||
|
||||
|
|
@ -905,26 +905,26 @@ void AnimationNodeStateMachineEditor::_update_graph() {
|
|||
void AnimationNodeStateMachineEditor::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
error_panel->add_style_override("panel", get_stylebox("bg", "Tree"));
|
||||
error_label->add_color_override("font_color", get_color("error_color", "Editor"));
|
||||
panel->add_style_override("panel", get_stylebox("bg", "Tree"));
|
||||
error_panel->add_theme_style_override("panel", get_theme_stylebox("bg", "Tree"));
|
||||
error_label->add_theme_color_override("font_color", get_theme_color("error_color", "Editor"));
|
||||
panel->add_theme_style_override("panel", get_theme_stylebox("bg", "Tree"));
|
||||
|
||||
tool_select->set_icon(get_icon("ToolSelect", "EditorIcons"));
|
||||
tool_create->set_icon(get_icon("ToolAddNode", "EditorIcons"));
|
||||
tool_connect->set_icon(get_icon("ToolConnect", "EditorIcons"));
|
||||
tool_select->set_icon(get_theme_icon("ToolSelect", "EditorIcons"));
|
||||
tool_create->set_icon(get_theme_icon("ToolAddNode", "EditorIcons"));
|
||||
tool_connect->set_icon(get_theme_icon("ToolConnect", "EditorIcons"));
|
||||
|
||||
transition_mode->clear();
|
||||
transition_mode->add_icon_item(get_icon("TransitionImmediate", "EditorIcons"), TTR("Immediate"));
|
||||
transition_mode->add_icon_item(get_icon("TransitionSync", "EditorIcons"), TTR("Sync"));
|
||||
transition_mode->add_icon_item(get_icon("TransitionEnd", "EditorIcons"), TTR("At End"));
|
||||
transition_mode->add_icon_item(get_theme_icon("TransitionImmediate", "EditorIcons"), TTR("Immediate"));
|
||||
transition_mode->add_icon_item(get_theme_icon("TransitionSync", "EditorIcons"), TTR("Sync"));
|
||||
transition_mode->add_icon_item(get_theme_icon("TransitionEnd", "EditorIcons"), TTR("At End"));
|
||||
|
||||
tool_erase->set_icon(get_icon("Remove", "EditorIcons"));
|
||||
tool_autoplay->set_icon(get_icon("AutoPlay", "EditorIcons"));
|
||||
tool_end->set_icon(get_icon("AutoEnd", "EditorIcons"));
|
||||
tool_erase->set_icon(get_theme_icon("Remove", "EditorIcons"));
|
||||
tool_autoplay->set_icon(get_theme_icon("AutoPlay", "EditorIcons"));
|
||||
tool_end->set_icon(get_theme_icon("AutoEnd", "EditorIcons"));
|
||||
|
||||
play_mode->clear();
|
||||
play_mode->add_icon_item(get_icon("PlayTravel", "EditorIcons"), TTR("Travel"));
|
||||
play_mode->add_icon_item(get_icon("Play", "EditorIcons"), TTR("Immediate"));
|
||||
play_mode->add_icon_item(get_theme_icon("PlayTravel", "EditorIcons"), TTR("Travel"));
|
||||
play_mode->add_icon_item(get_theme_icon("Play", "EditorIcons"), TTR("Immediate"));
|
||||
}
|
||||
|
||||
if (p_what == NOTIFICATION_PROCESS) {
|
||||
|
|
@ -1110,7 +1110,7 @@ void AnimationNodeStateMachineEditor::_name_edited(const String &p_text) {
|
|||
undo_redo->add_do_method(this, "_update_graph");
|
||||
undo_redo->add_undo_method(this, "_update_graph");
|
||||
undo_redo->commit_action();
|
||||
name_edit->hide();
|
||||
name_edit_popup->hide();
|
||||
updating = false;
|
||||
|
||||
state_machine_draw->update();
|
||||
|
|
@ -1357,17 +1357,19 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
|
|||
animations_menu->set_name("animations");
|
||||
animations_menu->connect("index_pressed", callable_mp(this, &AnimationNodeStateMachineEditor::_add_animation_type));
|
||||
|
||||
name_edit_popup = memnew(Popup);
|
||||
add_child(name_edit_popup);
|
||||
name_edit = memnew(LineEdit);
|
||||
state_machine_draw->add_child(name_edit);
|
||||
name_edit->hide();
|
||||
name_edit_popup->add_child(name_edit);
|
||||
name_edit->set_anchors_and_margins_preset(PRESET_WIDE);
|
||||
name_edit_popup->add_child(name_edit);
|
||||
name_edit->connect("text_entered", callable_mp(this, &AnimationNodeStateMachineEditor::_name_edited));
|
||||
name_edit->connect("focus_exited", callable_mp(this, &AnimationNodeStateMachineEditor::_name_edited_focus_out));
|
||||
name_edit->set_as_toplevel(true);
|
||||
|
||||
open_file = memnew(EditorFileDialog);
|
||||
add_child(open_file);
|
||||
open_file->set_title(TTR("Open Animation Node"));
|
||||
open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
open_file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
open_file->connect("file_selected", callable_mp(this, &AnimationNodeStateMachineEditor::_file_opened));
|
||||
undo_redo = EditorNode::get_undo_redo();
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue