diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-01-02 23:03:46 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-01-02 23:03:46 -0300 |
commit | 118eed485e8f928a5a0dab530ae93211afa10525 (patch) | |
tree | 83efb5cbcebb7046e5b64dfe1712475a7d3b7f14 /core/bind | |
parent | ce26eb74bca48f16e9a34b4eb1c34e50dfc5daae (diff) |
ObjectTypeDB was renamed to ClassDB. Types are meant to be more generic to Variant.
All usages of "type" to refer to classes were renamed to "class"
ClassDB has been exposed to GDScript.
OBJ_TYPE() macro is now GDCLASS()
Diffstat (limited to 'core/bind')
-rw-r--r-- | core/bind/core_bind.cpp | 671 | ||||
-rw-r--r-- | core/bind/core_bind.h | 58 |
2 files changed, 484 insertions, 245 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 3d93ec9fa5..02f3c4c5f3 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -114,13 +114,13 @@ Ref<ResourceImportMetadata> _ResourceLoader::load_import_metadata(const String& void _ResourceLoader::_bind_methods() { - ObjectTypeDB::bind_method(_MD("load_interactive:ResourceInteractiveLoader","path","type_hint"),&_ResourceLoader::load_interactive,DEFVAL("")); - ObjectTypeDB::bind_method(_MD("load:Resource","path","type_hint", "p_no_cache"),&_ResourceLoader::load,DEFVAL(""), DEFVAL(false)); - ObjectTypeDB::bind_method(_MD("load_import_metadata:ResourceImportMetadata","path"),&_ResourceLoader::load_import_metadata); - ObjectTypeDB::bind_method(_MD("get_recognized_extensions_for_type","type"),&_ResourceLoader::get_recognized_extensions_for_type); - ObjectTypeDB::bind_method(_MD("set_abort_on_missing_resources","abort"),&_ResourceLoader::set_abort_on_missing_resources); - ObjectTypeDB::bind_method(_MD("get_dependencies","path"),&_ResourceLoader::get_dependencies); - ObjectTypeDB::bind_method(_MD("has","path"),&_ResourceLoader::has); + ClassDB::bind_method(_MD("load_interactive:ResourceInteractiveLoader","path","type_hint"),&_ResourceLoader::load_interactive,DEFVAL("")); + ClassDB::bind_method(_MD("load:Resource","path","type_hint", "p_no_cache"),&_ResourceLoader::load,DEFVAL(""), DEFVAL(false)); + ClassDB::bind_method(_MD("load_import_metadata:ResourceImportMetadata","path"),&_ResourceLoader::load_import_metadata); + ClassDB::bind_method(_MD("get_recognized_extensions_for_type","type"),&_ResourceLoader::get_recognized_extensions_for_type); + ClassDB::bind_method(_MD("set_abort_on_missing_resources","abort"),&_ResourceLoader::set_abort_on_missing_resources); + ClassDB::bind_method(_MD("get_dependencies","path"),&_ResourceLoader::get_dependencies); + ClassDB::bind_method(_MD("has","path"),&_ResourceLoader::has); } _ResourceLoader::_ResourceLoader() { @@ -153,8 +153,8 @@ _ResourceSaver *_ResourceSaver::singleton=NULL; void _ResourceSaver::_bind_methods() { - ObjectTypeDB::bind_method(_MD("save","path","resource:Resource","flags"),&_ResourceSaver::save,DEFVAL(0)); - ObjectTypeDB::bind_method(_MD("get_recognized_extensions","type"),&_ResourceSaver::get_recognized_extensions); + ClassDB::bind_method(_MD("save","path","resource:Resource","flags"),&_ResourceSaver::save,DEFVAL(0)); + ClassDB::bind_method(_MD("get_recognized_extensions","type"),&_ResourceSaver::get_recognized_extensions); BIND_CONSTANT(FLAG_RELATIVE_PATHS); BIND_CONSTANT(FLAG_BUNDLE_RESOURCES); @@ -836,7 +836,7 @@ void _OS::print_all_textures_by_size() { for (List<Ref<Resource> >::Element *E=rsrc.front();E;E=E->next()) { - if (!E->get()->is_type("ImageTexture")) + if (!E->get()->is_class("ImageTexture")) continue; Size2 size = E->get()->call("get_size"); @@ -878,18 +878,18 @@ void _OS::print_resources_by_type(const Vector<String>& p_types) { bool found = false; for (int i=0; i<p_types.size(); i++) { - if (r->is_type(p_types[i])) + if (r->is_class(p_types[i])) found = true; } if (!found) continue; - if (!type_count.has(r->get_type())) { - type_count[r->get_type()]=0; + if (!type_count.has(r->get_class())) { + type_count[r->get_class()]=0; } - type_count[r->get_type()]++; + type_count[r->get_class()]++; } }; @@ -1027,154 +1027,154 @@ _OS *_OS::singleton=NULL; void _OS::_bind_methods() { - //ObjectTypeDB::bind_method(_MD("get_mouse_pos"),&_OS::get_mouse_pos); - //ObjectTypeDB::bind_method(_MD("is_mouse_grab_enabled"),&_OS::is_mouse_grab_enabled); - - ObjectTypeDB::bind_method(_MD("set_clipboard","clipboard"),&_OS::set_clipboard); - ObjectTypeDB::bind_method(_MD("get_clipboard"),&_OS::get_clipboard); - - ObjectTypeDB::bind_method(_MD("set_video_mode","size","fullscreen","resizable","screen"),&_OS::set_video_mode,DEFVAL(0)); - ObjectTypeDB::bind_method(_MD("get_video_mode_size","screen"),&_OS::get_video_mode,DEFVAL(0)); - ObjectTypeDB::bind_method(_MD("is_video_mode_fullscreen","screen"),&_OS::is_video_mode_fullscreen,DEFVAL(0)); - ObjectTypeDB::bind_method(_MD("is_video_mode_resizable","screen"),&_OS::is_video_mode_resizable,DEFVAL(0)); - ObjectTypeDB::bind_method(_MD("get_fullscreen_mode_list","screen"),&_OS::get_fullscreen_mode_list,DEFVAL(0)); - - - ObjectTypeDB::bind_method(_MD("get_screen_count"),&_OS::get_screen_count); - ObjectTypeDB::bind_method(_MD("get_current_screen"),&_OS::get_current_screen); - ObjectTypeDB::bind_method(_MD("set_current_screen","screen"),&_OS::set_current_screen); - ObjectTypeDB::bind_method(_MD("get_screen_position","screen"),&_OS::get_screen_position,DEFVAL(0)); - ObjectTypeDB::bind_method(_MD("get_screen_size","screen"),&_OS::get_screen_size,DEFVAL(0)); - ObjectTypeDB::bind_method(_MD("get_screen_dpi","screen"),&_OS::get_screen_dpi,DEFVAL(0)); - ObjectTypeDB::bind_method(_MD("get_window_position"),&_OS::get_window_position); - ObjectTypeDB::bind_method(_MD("set_window_position","position"),&_OS::set_window_position); - ObjectTypeDB::bind_method(_MD("get_window_size"),&_OS::get_window_size); - ObjectTypeDB::bind_method(_MD("set_window_size","size"),&_OS::set_window_size); - ObjectTypeDB::bind_method(_MD("set_window_fullscreen","enabled"),&_OS::set_window_fullscreen); - ObjectTypeDB::bind_method(_MD("is_window_fullscreen"),&_OS::is_window_fullscreen); - ObjectTypeDB::bind_method(_MD("set_window_resizable","enabled"),&_OS::set_window_resizable); - ObjectTypeDB::bind_method(_MD("is_window_resizable"),&_OS::is_window_resizable); - ObjectTypeDB::bind_method(_MD("set_window_minimized", "enabled"),&_OS::set_window_minimized); - ObjectTypeDB::bind_method(_MD("is_window_minimized"),&_OS::is_window_minimized); - ObjectTypeDB::bind_method(_MD("set_window_maximized", "enabled"),&_OS::set_window_maximized); - ObjectTypeDB::bind_method(_MD("is_window_maximized"),&_OS::is_window_maximized); - ObjectTypeDB::bind_method(_MD("request_attention"), &_OS::request_attention); - - ObjectTypeDB::bind_method(_MD("set_borderless_window", "borderless"), &_OS::set_borderless_window); - ObjectTypeDB::bind_method(_MD("get_borderless_window"), &_OS::get_borderless_window); - - ObjectTypeDB::bind_method(_MD("set_screen_orientation","orientation"),&_OS::set_screen_orientation); - ObjectTypeDB::bind_method(_MD("get_screen_orientation"),&_OS::get_screen_orientation); - - ObjectTypeDB::bind_method(_MD("set_keep_screen_on","enabled"),&_OS::set_keep_screen_on); - ObjectTypeDB::bind_method(_MD("is_keep_screen_on"),&_OS::is_keep_screen_on); - - ObjectTypeDB::bind_method(_MD("set_iterations_per_second","iterations_per_second"),&_OS::set_iterations_per_second); - ObjectTypeDB::bind_method(_MD("get_iterations_per_second"),&_OS::get_iterations_per_second); - ObjectTypeDB::bind_method(_MD("set_target_fps","target_fps"),&_OS::set_target_fps); - ObjectTypeDB::bind_method(_MD("get_target_fps"),&_OS::get_target_fps); - - ObjectTypeDB::bind_method(_MD("set_time_scale","time_scale"),&_OS::set_time_scale); - ObjectTypeDB::bind_method(_MD("get_time_scale"),&_OS::get_time_scale); - - ObjectTypeDB::bind_method(_MD("has_touchscreen_ui_hint"),&_OS::has_touchscreen_ui_hint); - - ObjectTypeDB::bind_method(_MD("set_window_title","title"),&_OS::set_window_title); - - ObjectTypeDB::bind_method(_MD("set_low_processor_usage_mode","enable"),&_OS::set_low_processor_usage_mode); - ObjectTypeDB::bind_method(_MD("is_in_low_processor_usage_mode"),&_OS::is_in_low_processor_usage_mode); - - ObjectTypeDB::bind_method(_MD("get_processor_count"),&_OS::get_processor_count); - - ObjectTypeDB::bind_method(_MD("get_executable_path"),&_OS::get_executable_path); - ObjectTypeDB::bind_method(_MD("execute","path","arguments","blocking","output"),&_OS::execute,DEFVAL(Array())); - ObjectTypeDB::bind_method(_MD("kill","pid"),&_OS::kill); - ObjectTypeDB::bind_method(_MD("shell_open","uri"),&_OS::shell_open); - ObjectTypeDB::bind_method(_MD("get_process_ID"),&_OS::get_process_ID); - - ObjectTypeDB::bind_method(_MD("get_environment","environment"),&_OS::get_environment); - ObjectTypeDB::bind_method(_MD("has_environment","environment"),&_OS::has_environment); - - ObjectTypeDB::bind_method(_MD("get_name"),&_OS::get_name); - ObjectTypeDB::bind_method(_MD("get_cmdline_args"),&_OS::get_cmdline_args); - ObjectTypeDB::bind_method(_MD("get_main_loop"),&_OS::get_main_loop); - - ObjectTypeDB::bind_method(_MD("get_datetime","utc"),&_OS::get_datetime,DEFVAL(false)); - ObjectTypeDB::bind_method(_MD("get_date","utc"),&_OS::get_date,DEFVAL(false)); - ObjectTypeDB::bind_method(_MD("get_time","utc"),&_OS::get_time,DEFVAL(false)); - ObjectTypeDB::bind_method(_MD("get_time_zone_info"),&_OS::get_time_zone_info); - ObjectTypeDB::bind_method(_MD("get_unix_time"),&_OS::get_unix_time); - ObjectTypeDB::bind_method(_MD("get_datetime_from_unix_time", "unix_time_val"), + //ClassDB::bind_method(_MD("get_mouse_pos"),&_OS::get_mouse_pos); + //ClassDB::bind_method(_MD("is_mouse_grab_enabled"),&_OS::is_mouse_grab_enabled); + + ClassDB::bind_method(_MD("set_clipboard","clipboard"),&_OS::set_clipboard); + ClassDB::bind_method(_MD("get_clipboard"),&_OS::get_clipboard); + + ClassDB::bind_method(_MD("set_video_mode","size","fullscreen","resizable","screen"),&_OS::set_video_mode,DEFVAL(0)); + ClassDB::bind_method(_MD("get_video_mode_size","screen"),&_OS::get_video_mode,DEFVAL(0)); + ClassDB::bind_method(_MD("is_video_mode_fullscreen","screen"),&_OS::is_video_mode_fullscreen,DEFVAL(0)); + ClassDB::bind_method(_MD("is_video_mode_resizable","screen"),&_OS::is_video_mode_resizable,DEFVAL(0)); + ClassDB::bind_method(_MD("get_fullscreen_mode_list","screen"),&_OS::get_fullscreen_mode_list,DEFVAL(0)); + + + ClassDB::bind_method(_MD("get_screen_count"),&_OS::get_screen_count); + ClassDB::bind_method(_MD("get_current_screen"),&_OS::get_current_screen); + ClassDB::bind_method(_MD("set_current_screen","screen"),&_OS::set_current_screen); + ClassDB::bind_method(_MD("get_screen_position","screen"),&_OS::get_screen_position,DEFVAL(0)); + ClassDB::bind_method(_MD("get_screen_size","screen"),&_OS::get_screen_size,DEFVAL(0)); + ClassDB::bind_method(_MD("get_screen_dpi","screen"),&_OS::get_screen_dpi,DEFVAL(0)); + ClassDB::bind_method(_MD("get_window_position"),&_OS::get_window_position); + ClassDB::bind_method(_MD("set_window_position","position"),&_OS::set_window_position); + ClassDB::bind_method(_MD("get_window_size"),&_OS::get_window_size); + ClassDB::bind_method(_MD("set_window_size","size"),&_OS::set_window_size); + ClassDB::bind_method(_MD("set_window_fullscreen","enabled"),&_OS::set_window_fullscreen); + ClassDB::bind_method(_MD("is_window_fullscreen"),&_OS::is_window_fullscreen); + ClassDB::bind_method(_MD("set_window_resizable","enabled"),&_OS::set_window_resizable); + ClassDB::bind_method(_MD("is_window_resizable"),&_OS::is_window_resizable); + ClassDB::bind_method(_MD("set_window_minimized", "enabled"),&_OS::set_window_minimized); + ClassDB::bind_method(_MD("is_window_minimized"),&_OS::is_window_minimized); + ClassDB::bind_method(_MD("set_window_maximized", "enabled"),&_OS::set_window_maximized); + ClassDB::bind_method(_MD("is_window_maximized"),&_OS::is_window_maximized); + ClassDB::bind_method(_MD("request_attention"), &_OS::request_attention); + + ClassDB::bind_method(_MD("set_borderless_window", "borderless"), &_OS::set_borderless_window); + ClassDB::bind_method(_MD("get_borderless_window"), &_OS::get_borderless_window); + + ClassDB::bind_method(_MD("set_screen_orientation","orientation"),&_OS::set_screen_orientation); + ClassDB::bind_method(_MD("get_screen_orientation"),&_OS::get_screen_orientation); + + ClassDB::bind_method(_MD("set_keep_screen_on","enabled"),&_OS::set_keep_screen_on); + ClassDB::bind_method(_MD("is_keep_screen_on"),&_OS::is_keep_screen_on); + + ClassDB::bind_method(_MD("set_iterations_per_second","iterations_per_second"),&_OS::set_iterations_per_second); + ClassDB::bind_method(_MD("get_iterations_per_second"),&_OS::get_iterations_per_second); + ClassDB::bind_method(_MD("set_target_fps","target_fps"),&_OS::set_target_fps); + ClassDB::bind_method(_MD("get_target_fps"),&_OS::get_target_fps); + + ClassDB::bind_method(_MD("set_time_scale","time_scale"),&_OS::set_time_scale); + ClassDB::bind_method(_MD("get_time_scale"),&_OS::get_time_scale); + + ClassDB::bind_method(_MD("has_touchscreen_ui_hint"),&_OS::has_touchscreen_ui_hint); + + ClassDB::bind_method(_MD("set_window_title","title"),&_OS::set_window_title); + + ClassDB::bind_method(_MD("set_low_processor_usage_mode","enable"),&_OS::set_low_processor_usage_mode); + ClassDB::bind_method(_MD("is_in_low_processor_usage_mode"),&_OS::is_in_low_processor_usage_mode); + + ClassDB::bind_method(_MD("get_processor_count"),&_OS::get_processor_count); + + ClassDB::bind_method(_MD("get_executable_path"),&_OS::get_executable_path); + ClassDB::bind_method(_MD("execute","path","arguments","blocking","output"),&_OS::execute,DEFVAL(Array())); + ClassDB::bind_method(_MD("kill","pid"),&_OS::kill); + ClassDB::bind_method(_MD("shell_open","uri"),&_OS::shell_open); + ClassDB::bind_method(_MD("get_process_ID"),&_OS::get_process_ID); + + ClassDB::bind_method(_MD("get_environment","environment"),&_OS::get_environment); + ClassDB::bind_method(_MD("has_environment","environment"),&_OS::has_environment); + + ClassDB::bind_method(_MD("get_name"),&_OS::get_name); + ClassDB::bind_method(_MD("get_cmdline_args"),&_OS::get_cmdline_args); + ClassDB::bind_method(_MD("get_main_loop"),&_OS::get_main_loop); + + ClassDB::bind_method(_MD("get_datetime","utc"),&_OS::get_datetime,DEFVAL(false)); + ClassDB::bind_method(_MD("get_date","utc"),&_OS::get_date,DEFVAL(false)); + ClassDB::bind_method(_MD("get_time","utc"),&_OS::get_time,DEFVAL(false)); + ClassDB::bind_method(_MD("get_time_zone_info"),&_OS::get_time_zone_info); + ClassDB::bind_method(_MD("get_unix_time"),&_OS::get_unix_time); + ClassDB::bind_method(_MD("get_datetime_from_unix_time", "unix_time_val"), &_OS::get_datetime_from_unix_time); - ObjectTypeDB::bind_method(_MD("get_unix_time_from_datetime", "datetime"), + ClassDB::bind_method(_MD("get_unix_time_from_datetime", "datetime"), &_OS::get_unix_time_from_datetime); - ObjectTypeDB::bind_method(_MD("get_system_time_secs"), &_OS::get_system_time_secs); + ClassDB::bind_method(_MD("get_system_time_secs"), &_OS::get_system_time_secs); - ObjectTypeDB::bind_method(_MD("set_icon","icon"),&_OS::set_icon); + ClassDB::bind_method(_MD("set_icon","icon"),&_OS::set_icon); - ObjectTypeDB::bind_method(_MD("delay_usec","usec"),&_OS::delay_usec); - ObjectTypeDB::bind_method(_MD("delay_msec","msec"),&_OS::delay_msec); - ObjectTypeDB::bind_method(_MD("get_ticks_msec"),&_OS::get_ticks_msec); - ObjectTypeDB::bind_method(_MD("get_splash_tick_msec"),&_OS::get_splash_tick_msec); - ObjectTypeDB::bind_method(_MD("get_locale"),&_OS::get_locale); - ObjectTypeDB::bind_method(_MD("get_latin_keyboard_variant"),&_OS::get_latin_keyboard_variant); - ObjectTypeDB::bind_method(_MD("get_model_name"),&_OS::get_model_name); + ClassDB::bind_method(_MD("delay_usec","usec"),&_OS::delay_usec); + ClassDB::bind_method(_MD("delay_msec","msec"),&_OS::delay_msec); + ClassDB::bind_method(_MD("get_ticks_msec"),&_OS::get_ticks_msec); + ClassDB::bind_method(_MD("get_splash_tick_msec"),&_OS::get_splash_tick_msec); + ClassDB::bind_method(_MD("get_locale"),&_OS::get_locale); + ClassDB::bind_method(_MD("get_latin_keyboard_variant"),&_OS::get_latin_keyboard_variant); + ClassDB::bind_method(_MD("get_model_name"),&_OS::get_model_name); - ObjectTypeDB::bind_method(_MD("get_custom_level"),&_OS::get_custom_level); + ClassDB::bind_method(_MD("get_custom_level"),&_OS::get_custom_level); - ObjectTypeDB::bind_method(_MD("can_draw"),&_OS::can_draw); - ObjectTypeDB::bind_method(_MD("get_frames_drawn"),&_OS::get_frames_drawn); - ObjectTypeDB::bind_method(_MD("is_stdout_verbose"),&_OS::is_stdout_verbose); + ClassDB::bind_method(_MD("can_draw"),&_OS::can_draw); + ClassDB::bind_method(_MD("get_frames_drawn"),&_OS::get_frames_drawn); + ClassDB::bind_method(_MD("is_stdout_verbose"),&_OS::is_stdout_verbose); - ObjectTypeDB::bind_method(_MD("can_use_threads"),&_OS::can_use_threads); + ClassDB::bind_method(_MD("can_use_threads"),&_OS::can_use_threads); - ObjectTypeDB::bind_method(_MD("is_debug_build"),&_OS::is_debug_build); + ClassDB::bind_method(_MD("is_debug_build"),&_OS::is_debug_build); - //ObjectTypeDB::bind_method(_MD("get_mouse_button_state"),&_OS::get_mouse_button_state); + //ClassDB::bind_method(_MD("get_mouse_button_state"),&_OS::get_mouse_button_state); - ObjectTypeDB::bind_method(_MD("dump_memory_to_file","file"),&_OS::dump_memory_to_file); - ObjectTypeDB::bind_method(_MD("dump_resources_to_file","file"),&_OS::dump_resources_to_file); - ObjectTypeDB::bind_method(_MD("has_virtual_keyboard"),&_OS::has_virtual_keyboard); - ObjectTypeDB::bind_method(_MD("show_virtual_keyboard", "existing_text"),&_OS::show_virtual_keyboard,DEFVAL("")); - ObjectTypeDB::bind_method(_MD("hide_virtual_keyboard"),&_OS::hide_virtual_keyboard); - ObjectTypeDB::bind_method(_MD("print_resources_in_use","short"),&_OS::print_resources_in_use,DEFVAL(false)); - ObjectTypeDB::bind_method(_MD("print_all_resources","tofile"),&_OS::print_all_resources,DEFVAL("")); + ClassDB::bind_method(_MD("dump_memory_to_file","file"),&_OS::dump_memory_to_file); + ClassDB::bind_method(_MD("dump_resources_to_file","file"),&_OS::dump_resources_to_file); + ClassDB::bind_method(_MD("has_virtual_keyboard"),&_OS::has_virtual_keyboard); + ClassDB::bind_method(_MD("show_virtual_keyboard", "existing_text"),&_OS::show_virtual_keyboard,DEFVAL("")); + ClassDB::bind_method(_MD("hide_virtual_keyboard"),&_OS::hide_virtual_keyboard); + ClassDB::bind_method(_MD("print_resources_in_use","short"),&_OS::print_resources_in_use,DEFVAL(false)); + ClassDB::bind_method(_MD("print_all_resources","tofile"),&_OS::print_all_resources,DEFVAL("")); - ObjectTypeDB::bind_method(_MD("get_static_memory_usage"),&_OS::get_static_memory_usage); - ObjectTypeDB::bind_method(_MD("get_static_memory_peak_usage"),&_OS::get_static_memory_peak_usage); - ObjectTypeDB::bind_method(_MD("get_dynamic_memory_usage"),&_OS::get_dynamic_memory_usage); + ClassDB::bind_method(_MD("get_static_memory_usage"),&_OS::get_static_memory_usage); + ClassDB::bind_method(_MD("get_static_memory_peak_usage"),&_OS::get_static_memory_peak_usage); + ClassDB::bind_method(_MD("get_dynamic_memory_usage"),&_OS::get_dynamic_memory_usage); - ObjectTypeDB::bind_method(_MD("get_data_dir"),&_OS::get_data_dir); - ObjectTypeDB::bind_method(_MD("get_system_dir","dir"),&_OS::get_system_dir); - ObjectTypeDB::bind_method(_MD("get_unique_ID"),&_OS::get_unique_ID); + ClassDB::bind_method(_MD("get_data_dir"),&_OS::get_data_dir); + ClassDB::bind_method(_MD("get_system_dir","dir"),&_OS::get_system_dir); + ClassDB::bind_method(_MD("get_unique_ID"),&_OS::get_unique_ID); - ObjectTypeDB::bind_method(_MD("is_ok_left_and_cancel_right"),&_OS::is_ok_left_and_cancel_right); + ClassDB::bind_method(_MD("is_ok_left_and_cancel_right"),&_OS::is_ok_left_and_cancel_right); - ObjectTypeDB::bind_method(_MD("get_frames_per_second"),&_OS::get_frames_per_second); + ClassDB::bind_method(_MD("get_frames_per_second"),&_OS::get_frames_per_second); - ObjectTypeDB::bind_method(_MD("print_all_textures_by_size"),&_OS::print_all_textures_by_size); - ObjectTypeDB::bind_method(_MD("print_resources_by_type","types"),&_OS::print_resources_by_type); + ClassDB::bind_method(_MD("print_all_textures_by_size"),&_OS::print_all_textures_by_size); + ClassDB::bind_method(_MD("print_resources_by_type","types"),&_OS::print_resources_by_type); - ObjectTypeDB::bind_method(_MD("native_video_play","path","volume","audio_track","subtitle_track"),&_OS::native_video_play); - ObjectTypeDB::bind_method(_MD("native_video_is_playing"),&_OS::native_video_is_playing); - ObjectTypeDB::bind_method(_MD("native_video_stop"),&_OS::native_video_stop); - ObjectTypeDB::bind_method(_MD("native_video_pause"),&_OS::native_video_pause); - ObjectTypeDB::bind_method(_MD("native_video_unpause"),&_OS::native_video_unpause); + ClassDB::bind_method(_MD("native_video_play","path","volume","audio_track","subtitle_track"),&_OS::native_video_play); + ClassDB::bind_method(_MD("native_video_is_playing"),&_OS::native_video_is_playing); + ClassDB::bind_method(_MD("native_video_stop"),&_OS::native_video_stop); + ClassDB::bind_method(_MD("native_video_pause"),&_OS::native_video_pause); + ClassDB::bind_method(_MD("native_video_unpause"),&_OS::native_video_unpause); - ObjectTypeDB::bind_method(_MD("get_scancode_string","code"),&_OS::get_scancode_string); - ObjectTypeDB::bind_method(_MD("is_scancode_unicode","code"),&_OS::is_scancode_unicode); - ObjectTypeDB::bind_method(_MD("find_scancode_from_string","string"),&_OS::find_scancode_from_string); + ClassDB::bind_method(_MD("get_scancode_string","code"),&_OS::get_scancode_string); + ClassDB::bind_method(_MD("is_scancode_unicode","code"),&_OS::is_scancode_unicode); + ClassDB::bind_method(_MD("find_scancode_from_string","string"),&_OS::find_scancode_from_string); - ObjectTypeDB::bind_method(_MD("set_use_file_access_save_and_swap","enabled"),&_OS::set_use_file_access_save_and_swap); + ClassDB::bind_method(_MD("set_use_file_access_save_and_swap","enabled"),&_OS::set_use_file_access_save_and_swap); - ObjectTypeDB::bind_method(_MD("alert","text","title"),&_OS::alert,DEFVAL("Alert!")); + ClassDB::bind_method(_MD("alert","text","title"),&_OS::alert,DEFVAL("Alert!")); - ObjectTypeDB::bind_method(_MD("set_thread_name","name"),&_OS::set_thread_name); + ClassDB::bind_method(_MD("set_thread_name","name"),&_OS::set_thread_name); - ObjectTypeDB::bind_method(_MD("set_use_vsync","enable"),&_OS::set_use_vsync); - ObjectTypeDB::bind_method(_MD("is_vsync_enabled"),&_OS::is_vsync_enabled); + ClassDB::bind_method(_MD("set_use_vsync","enable"),&_OS::set_use_vsync); + ClassDB::bind_method(_MD("is_vsync_enabled"),&_OS::is_vsync_enabled); - ObjectTypeDB::bind_method(_MD("get_engine_version"),&_OS::get_engine_version); + ClassDB::bind_method(_MD("get_engine_version"),&_OS::get_engine_version); BIND_CONSTANT( DAY_SUNDAY ); BIND_CONSTANT( DAY_MONDAY ); @@ -1396,29 +1396,29 @@ int _Geometry::get_uv84_normal_bit(const Vector3& p_vector) { void _Geometry::_bind_methods() { - ObjectTypeDB::bind_method(_MD("build_box_planes","extents"),&_Geometry::build_box_planes); - ObjectTypeDB::bind_method(_MD("build_cylinder_planes","radius","height","sides","axis"),&_Geometry::build_cylinder_planes,DEFVAL(Vector3::AXIS_Z)); - ObjectTypeDB::bind_method(_MD("build_capsule_planes","radius","height","sides","lats","axis"),&_Geometry::build_capsule_planes,DEFVAL(Vector3::AXIS_Z)); - ObjectTypeDB::bind_method(_MD("segment_intersects_circle","segment_from","segment_to","circle_pos","circle_radius"),&_Geometry::segment_intersects_circle); - ObjectTypeDB::bind_method(_MD("segment_intersects_segment_2d","from_a","to_a","from_b","to_b"),&_Geometry::segment_intersects_segment_2d); + ClassDB::bind_method(_MD("build_box_planes","extents"),&_Geometry::build_box_planes); + ClassDB::bind_method(_MD("build_cylinder_planes","radius","height","sides","axis"),&_Geometry::build_cylinder_planes,DEFVAL(Vector3::AXIS_Z)); + ClassDB::bind_method(_MD("build_capsule_planes","radius","height","sides","lats","axis"),&_Geometry::build_capsule_planes,DEFVAL(Vector3::AXIS_Z)); + ClassDB::bind_method(_MD("segment_intersects_circle","segment_from","segment_to","circle_pos","circle_radius"),&_Geometry::segment_intersects_circle); + ClassDB::bind_method(_MD("segment_intersects_segment_2d","from_a","to_a","from_b","to_b"),&_Geometry::segment_intersects_segment_2d); - ObjectTypeDB::bind_method(_MD("get_closest_points_between_segments_2d","p1","q1","p2","q2"),&_Geometry::get_closest_points_between_segments_2d); - ObjectTypeDB::bind_method(_MD("get_closest_points_between_segments","p1","p2","q1","q2"),&_Geometry::get_closest_points_between_segments); + ClassDB::bind_method(_MD("get_closest_points_between_segments_2d","p1","q1","p2","q2"),&_Geometry::get_closest_points_between_segments_2d); + ClassDB::bind_method(_MD("get_closest_points_between_segments","p1","p2","q1","q2"),&_Geometry::get_closest_points_between_segments); - ObjectTypeDB::bind_method(_MD("get_closest_point_to_segment","point","s1","s2"),&_Geometry::get_closest_point_to_segment); + ClassDB::bind_method(_MD("get_closest_point_to_segment","point","s1","s2"),&_Geometry::get_closest_point_to_segment); - ObjectTypeDB::bind_method(_MD("get_uv84_normal_bit","normal"),&_Geometry::get_uv84_normal_bit); + ClassDB::bind_method(_MD("get_uv84_normal_bit","normal"),&_Geometry::get_uv84_normal_bit); - ObjectTypeDB::bind_method(_MD("ray_intersects_triangle","from","dir","a","b","c"),&_Geometry::ray_intersects_triangle); - ObjectTypeDB::bind_method(_MD("segment_intersects_triangle","from","to","a","b","c"),&_Geometry::segment_intersects_triangle); - ObjectTypeDB::bind_method(_MD("segment_intersects_sphere","from","to","spos","sradius"),&_Geometry::segment_intersects_sphere); - ObjectTypeDB::bind_method(_MD("segment_intersects_cylinder","from","to","height","radius"),&_Geometry::segment_intersects_cylinder); - ObjectTypeDB::bind_method(_MD("segment_intersects_convex","from","to","planes"),&_Geometry::segment_intersects_convex); - ObjectTypeDB::bind_method(_MD("point_is_inside_triangle","point","a","b","c"),&_Geometry::point_is_inside_triangle); + ClassDB::bind_method(_MD("ray_intersects_triangle","from","dir","a","b","c"),&_Geometry::ray_intersects_triangle); + ClassDB::bind_method(_MD("segment_intersects_triangle","from","to","a","b","c"),&_Geometry::segment_intersects_triangle); + ClassDB::bind_method(_MD("segment_intersects_sphere","from","to","spos","sradius"),&_Geometry::segment_intersects_sphere); + ClassDB::bind_method(_MD("segment_intersects_cylinder","from","to","height","radius"),&_Geometry::segment_intersects_cylinder); + ClassDB::bind_method(_MD("segment_intersects_convex","from","to","planes"),&_Geometry::segment_intersects_convex); + ClassDB::bind_method(_MD("point_is_inside_triangle","point","a","b","c"),&_Geometry::point_is_inside_triangle); - ObjectTypeDB::bind_method(_MD("triangulate_polygon","polygon"),&_Geometry::triangulate_polygon); + ClassDB::bind_method(_MD("triangulate_polygon","polygon"),&_Geometry::triangulate_polygon); - ObjectTypeDB::bind_method(_MD("make_atlas","sizes"),&_Geometry::make_atlas); + ClassDB::bind_method(_MD("make_atlas","sizes"),&_Geometry::make_atlas); } @@ -1793,51 +1793,51 @@ Variant _File::get_var() const { void _File::_bind_methods() { - ObjectTypeDB::bind_method(_MD("open_encrypted","path","mode_flags","key"),&_File::open_encrypted); - ObjectTypeDB::bind_method(_MD("open_encrypted_with_pass","path","mode_flags","pass"),&_File::open_encrypted_pass); - - ObjectTypeDB::bind_method(_MD("open","path","flags"),&_File::open); - ObjectTypeDB::bind_method(_MD("close"),&_File::close); - ObjectTypeDB::bind_method(_MD("is_open"),&_File::is_open); - ObjectTypeDB::bind_method(_MD("seek","pos"),&_File::seek); - ObjectTypeDB::bind_method(_MD("seek_end","pos"),&_File::seek_end,DEFVAL(0)); - ObjectTypeDB::bind_method(_MD("get_pos"),&_File::get_pos); - ObjectTypeDB::bind_method(_MD("get_len"),&_File::get_len); - ObjectTypeDB::bind_method(_MD("eof_reached"),&_File::eof_reached); - ObjectTypeDB::bind_method(_MD("get_8"),&_File::get_8); - ObjectTypeDB::bind_method(_MD("get_16"),&_File::get_16); - ObjectTypeDB::bind_method(_MD("get_32"),&_File::get_32); - ObjectTypeDB::bind_method(_MD("get_64"),&_File::get_64); - ObjectTypeDB::bind_method(_MD("get_float"),&_File::get_float); - ObjectTypeDB::bind_method(_MD("get_double"),&_File::get_double); - ObjectTypeDB::bind_method(_MD("get_real"),&_File::get_real); - ObjectTypeDB::bind_method(_MD("get_buffer","len"),&_File::get_buffer); - ObjectTypeDB::bind_method(_MD("get_line"),&_File::get_line); - ObjectTypeDB::bind_method(_MD("get_as_text"),&_File::get_as_text); - ObjectTypeDB::bind_method(_MD("get_md5","path"),&_File::get_md5); - ObjectTypeDB::bind_method(_MD("get_sha256","path"),&_File::get_sha256); - ObjectTypeDB::bind_method(_MD("get_endian_swap"),&_File::get_endian_swap); - ObjectTypeDB::bind_method(_MD("set_endian_swap","enable"),&_File::set_endian_swap); - ObjectTypeDB::bind_method(_MD("get_error:Error"),&_File::get_error); - ObjectTypeDB::bind_method(_MD("get_var"),&_File::get_var); - ObjectTypeDB::bind_method(_MD("get_csv_line","delim"),&_File::get_csv_line,DEFVAL(",")); - - ObjectTypeDB::bind_method(_MD("store_8","value"),&_File::store_8); - ObjectTypeDB::bind_method(_MD("store_16","value"),&_File::store_16); - ObjectTypeDB::bind_method(_MD("store_32","value"),&_File::store_32); - ObjectTypeDB::bind_method(_MD("store_64","value"),&_File::store_64); - ObjectTypeDB::bind_method(_MD("store_float","value"),&_File::store_float); - ObjectTypeDB::bind_method(_MD("store_double","value"),&_File::store_double); - ObjectTypeDB::bind_method(_MD("store_real","value"),&_File::store_real); - ObjectTypeDB::bind_method(_MD("store_buffer","buffer"),&_File::store_buffer); - ObjectTypeDB::bind_method(_MD("store_line","line"),&_File::store_line); - ObjectTypeDB::bind_method(_MD("store_string","string"),&_File::store_string); - ObjectTypeDB::bind_method(_MD("store_var","value"),&_File::store_var); - - ObjectTypeDB::bind_method(_MD("store_pascal_string","string"),&_File::store_pascal_string); - ObjectTypeDB::bind_method(_MD("get_pascal_string"),&_File::get_pascal_string); - - ObjectTypeDB::bind_method(_MD("file_exists","path"),&_File::file_exists); + ClassDB::bind_method(_MD("open_encrypted","path","mode_flags","key"),&_File::open_encrypted); + ClassDB::bind_method(_MD("open_encrypted_with_pass","path","mode_flags","pass"),&_File::open_encrypted_pass); + + ClassDB::bind_method(_MD("open","path","flags"),&_File::open); + ClassDB::bind_method(_MD("close"),&_File::close); + ClassDB::bind_method(_MD("is_open"),&_File::is_open); + ClassDB::bind_method(_MD("seek","pos"),&_File::seek); + ClassDB::bind_method(_MD("seek_end","pos"),&_File::seek_end,DEFVAL(0)); + ClassDB::bind_method(_MD("get_pos"),&_File::get_pos); + ClassDB::bind_method(_MD("get_len"),&_File::get_len); + ClassDB::bind_method(_MD("eof_reached"),&_File::eof_reached); + ClassDB::bind_method(_MD("get_8"),&_File::get_8); + ClassDB::bind_method(_MD("get_16"),&_File::get_16); + ClassDB::bind_method(_MD("get_32"),&_File::get_32); + ClassDB::bind_method(_MD("get_64"),&_File::get_64); + ClassDB::bind_method(_MD("get_float"),&_File::get_float); + ClassDB::bind_method(_MD("get_double"),&_File::get_double); + ClassDB::bind_method(_MD("get_real"),&_File::get_real); + ClassDB::bind_method(_MD("get_buffer","len"),&_File::get_buffer); + ClassDB::bind_method(_MD("get_line"),&_File::get_line); + ClassDB::bind_method(_MD("get_as_text"),&_File::get_as_text); + ClassDB::bind_method(_MD("get_md5","path"),&_File::get_md5); + ClassDB::bind_method(_MD("get_sha256","path"),&_File::get_sha256); + ClassDB::bind_method(_MD("get_endian_swap"),&_File::get_endian_swap); + ClassDB::bind_method(_MD("set_endian_swap","enable"),&_File::set_endian_swap); + ClassDB::bind_method(_MD("get_error:Error"),&_File::get_error); + ClassDB::bind_method(_MD("get_var"),&_File::get_var); + ClassDB::bind_method(_MD("get_csv_line","delim"),&_File::get_csv_line,DEFVAL(",")); + + ClassDB::bind_method(_MD("store_8","value"),&_File::store_8); + ClassDB::bind_method(_MD("store_16","value"),&_File::store_16); + ClassDB::bind_method(_MD("store_32","value"),&_File::store_32); + ClassDB::bind_method(_MD("store_64","value"),&_File::store_64); + ClassDB::bind_method(_MD("store_float","value"),&_File::store_float); + ClassDB::bind_method(_MD("store_double","value"),&_File::store_double); + ClassDB::bind_method(_MD("store_real","value"),&_File::store_real); + ClassDB::bind_method(_MD("store_buffer","buffer"),&_File::store_buffer); + ClassDB::bind_method(_MD("store_line","line"),&_File::store_line); + ClassDB::bind_method(_MD("store_string","string"),&_File::store_string); + ClassDB::bind_method(_MD("store_var","value"),&_File::store_var); + + ClassDB::bind_method(_MD("store_pascal_string","string"),&_File::store_pascal_string); + ClassDB::bind_method(_MD("get_pascal_string"),&_File::get_pascal_string); + + ClassDB::bind_method(_MD("file_exists","path"),&_File::file_exists); BIND_CONSTANT( READ ); BIND_CONSTANT( WRITE ); @@ -2011,24 +2011,24 @@ Error _Directory::remove(String p_name){ void _Directory::_bind_methods() { - ObjectTypeDB::bind_method(_MD("open:Error","path"),&_Directory::open); - ObjectTypeDB::bind_method(_MD("list_dir_begin"),&_Directory::list_dir_begin); - ObjectTypeDB::bind_method(_MD("get_next"),&_Directory::get_next); - ObjectTypeDB::bind_method(_MD("current_is_dir"),&_Directory::current_is_dir); - ObjectTypeDB::bind_method(_MD("list_dir_end"),&_Directory::list_dir_end); - ObjectTypeDB::bind_method(_MD("get_drive_count"),&_Directory::get_drive_count); - ObjectTypeDB::bind_method(_MD("get_drive","idx"),&_Directory::get_drive); - ObjectTypeDB::bind_method(_MD("change_dir:Error","todir"),&_Directory::change_dir); - ObjectTypeDB::bind_method(_MD("get_current_dir"),&_Directory::get_current_dir); - ObjectTypeDB::bind_method(_MD("make_dir:Error","path"),&_Directory::make_dir); - ObjectTypeDB::bind_method(_MD("make_dir_recursive:Error","path"),&_Directory::make_dir_recursive); - ObjectTypeDB::bind_method(_MD("file_exists","path"),&_Directory::file_exists); - ObjectTypeDB::bind_method(_MD("dir_exists","path"),&_Directory::dir_exists); -// ObjectTypeDB::bind_method(_MD("get_modified_time","file"),&_Directory::get_modified_time); - ObjectTypeDB::bind_method(_MD("get_space_left"),&_Directory::get_space_left); - ObjectTypeDB::bind_method(_MD("copy:Error","from","to"),&_Directory::copy); - ObjectTypeDB::bind_method(_MD("rename:Error","from","to"),&_Directory::rename); - ObjectTypeDB::bind_method(_MD("remove:Error","path"),&_Directory::remove); + ClassDB::bind_method(_MD("open:Error","path"),&_Directory::open); + ClassDB::bind_method(_MD("list_dir_begin"),&_Directory::list_dir_begin); + ClassDB::bind_method(_MD("get_next"),&_Directory::get_next); + ClassDB::bind_method(_MD("current_is_dir"),&_Directory::current_is_dir); + ClassDB::bind_method(_MD("list_dir_end"),&_Directory::list_dir_end); + ClassDB::bind_method(_MD("get_drive_count"),&_Directory::get_drive_count); + ClassDB::bind_method(_MD("get_drive","idx"),&_Directory::get_drive); + ClassDB::bind_method(_MD("change_dir:Error","todir"),&_Directory::change_dir); + ClassDB::bind_method(_MD("get_current_dir"),&_Directory::get_current_dir); + ClassDB::bind_method(_MD("make_dir:Error","path"),&_Directory::make_dir); + ClassDB::bind_method(_MD("make_dir_recursive:Error","path"),&_Directory::make_dir_recursive); + ClassDB::bind_method(_MD("file_exists","path"),&_Directory::file_exists); + ClassDB::bind_method(_MD("dir_exists","path"),&_Directory::dir_exists); +// ClassDB::bind_method(_MD("get_modified_time","file"),&_Directory::get_modified_time); + ClassDB::bind_method(_MD("get_space_left"),&_Directory::get_space_left); + ClassDB::bind_method(_MD("copy:Error","from","to"),&_Directory::copy); + ClassDB::bind_method(_MD("rename:Error","from","to"),&_Directory::rename); + ClassDB::bind_method(_MD("remove:Error","path"),&_Directory::remove); } @@ -2168,14 +2168,14 @@ String _Marshalls::base64_to_utf8(const String& p_str) { void _Marshalls::_bind_methods() { - ObjectTypeDB::bind_method(_MD("variant_to_base64:String","variant"),&_Marshalls::variant_to_base64); - ObjectTypeDB::bind_method(_MD("base64_to_variant:Variant","base64_str"),&_Marshalls::base64_to_variant); + ClassDB::bind_method(_MD("variant_to_base64:String","variant"),&_Marshalls::variant_to_base64); + ClassDB::bind_method(_MD("base64_to_variant:Variant","base64_str"),&_Marshalls::base64_to_variant); - ObjectTypeDB::bind_method(_MD("raw_to_base64:String","array"),&_Marshalls::raw_to_base64); - ObjectTypeDB::bind_method(_MD("base64_to_raw:RawArray","base64_str"),&_Marshalls::base64_to_raw); + ClassDB::bind_method(_MD("raw_to_base64:String","array"),&_Marshalls::raw_to_base64); + ClassDB::bind_method(_MD("base64_to_raw:RawArray","base64_str"),&_Marshalls::base64_to_raw); - ObjectTypeDB::bind_method(_MD("utf8_to_base64:String","utf8_str"),&_Marshalls::utf8_to_base64); - ObjectTypeDB::bind_method(_MD("base64_to_utf8:String","base64_str"),&_Marshalls::base64_to_utf8); + ClassDB::bind_method(_MD("utf8_to_base64:String","utf8_str"),&_Marshalls::utf8_to_base64); + ClassDB::bind_method(_MD("base64_to_utf8:String","base64_str"),&_Marshalls::base64_to_utf8); }; @@ -2199,8 +2199,8 @@ Error _Semaphore::post() { void _Semaphore::_bind_methods() { - ObjectTypeDB::bind_method(_MD("wait:Error"),&_Semaphore::wait); - ObjectTypeDB::bind_method(_MD("post:Error"),&_Semaphore::post); + ClassDB::bind_method(_MD("wait:Error"),&_Semaphore::wait); + ClassDB::bind_method(_MD("post:Error"),&_Semaphore::post); } @@ -2236,9 +2236,9 @@ void _Mutex::unlock(){ void _Mutex::_bind_methods() { - ObjectTypeDB::bind_method(_MD("lock"),&_Mutex::lock); - ObjectTypeDB::bind_method(_MD("try_lock:Error"),&_Mutex::try_lock); - ObjectTypeDB::bind_method(_MD("unlock"),&_Mutex::unlock); + ClassDB::bind_method(_MD("lock"),&_Mutex::lock); + ClassDB::bind_method(_MD("try_lock:Error"),&_Mutex::try_lock); + ClassDB::bind_method(_MD("unlock"),&_Mutex::unlock); } @@ -2358,10 +2358,10 @@ Variant _Thread::wait_to_finish() { void _Thread::_bind_methods() { - ObjectTypeDB::bind_method(_MD("start:Error","instance","method","userdata","priority"),&_Thread::start,DEFVAL(Variant()),DEFVAL(PRIORITY_NORMAL)); - ObjectTypeDB::bind_method(_MD("get_id"),&_Thread::get_id); - ObjectTypeDB::bind_method(_MD("is_active"),&_Thread::is_active); - ObjectTypeDB::bind_method(_MD("wait_to_finish:Variant"),&_Thread::wait_to_finish); + ClassDB::bind_method(_MD("start:Error","instance","method","userdata","priority"),&_Thread::start,DEFVAL(Variant()),DEFVAL(PRIORITY_NORMAL)); + ClassDB::bind_method(_MD("get_id"),&_Thread::get_id); + ClassDB::bind_method(_MD("is_active"),&_Thread::is_active); + ClassDB::bind_method(_MD("wait_to_finish:Variant"),&_Thread::wait_to_finish); BIND_CONSTANT( PRIORITY_LOW ); BIND_CONSTANT( PRIORITY_NORMAL ); @@ -2382,3 +2382,204 @@ _Thread::~_Thread() { } ERR_FAIL_COND(active==true); } +///////////////////////////////////// + + +StringArray _ClassDB::get_class_list() const { + + List<StringName> classes; + ClassDB::get_class_list(&classes); + + StringArray ret; + ret.resize(classes.size()); + int idx=0; + for (List<StringName>::Element *E=classes.front();E;E=E->next()) { + ret.set(idx++,E->get()); + } + + return ret; + +} +StringArray _ClassDB::get_inheriters_from_class( const StringName& p_class) const { + + List<StringName> classes; + ClassDB::get_inheriters_from_class(p_class,&classes); + + StringArray ret; + ret.resize(classes.size()); + int idx=0; + for (List<StringName>::Element *E=classes.front();E;E=E->next()) { + ret.set(idx++,E->get()); + } + + return ret; +} +StringName _ClassDB::get_parent_class(const StringName& p_class) const { + + return ClassDB::get_parent_class(p_class); +} +bool _ClassDB::class_exists(const StringName &p_class) const { + + return ClassDB::class_exists(p_class); +} +bool _ClassDB::is_parent_class(const StringName &p_class,const StringName& p_inherits) const { + + return ClassDB::is_parent_class(p_class,p_inherits); +} +bool _ClassDB::can_instance(const StringName &p_class) const { + + return ClassDB::can_instance(p_class); +} +Variant _ClassDB::instance(const StringName &p_class) const { + + Object *obj = ClassDB::instance(p_class); + if (!obj) + return Variant(); + + Reference *r = obj->cast_to<Reference>(); + if (r) { + return REF(r); + } else { + return obj; + } +} + +bool _ClassDB::has_signal(StringName p_class,StringName p_signal) const { + + return ClassDB::has_signal(p_class,p_signal); +} +Dictionary _ClassDB::get_signal(StringName p_class,StringName p_signal) const { + + MethodInfo signal; + if (ClassDB::get_signal(p_class,p_signal,&signal)) { + return signal.operator Dictionary(); + } else { + return Dictionary(); + } + +} +Array _ClassDB::get_signal_list(StringName p_class,bool p_no_inheritance) const { + + List<MethodInfo> signals; + ClassDB::get_signal_list(p_class,&signals,p_no_inheritance); + Array ret; + + for (List<MethodInfo>::Element *E=signals.front();E;E=E->next()) { + ret.push_back(E->get().operator Dictionary()); + } + + return ret; +} + +Array _ClassDB::get_property_list(StringName p_class, bool p_no_inheritance) const { + + List<PropertyInfo> plist; + ClassDB::get_property_list(p_class,&plist,p_no_inheritance); + Array ret; + for (List<PropertyInfo>::Element *E=plist.front();E;E=E->next()) { + ret.push_back(E->get().operator Dictionary()); + } + + return ret; + + +} + +bool _ClassDB::has_method(StringName p_class,StringName p_method,bool p_no_inheritance) const { + + return ClassDB::has_method(p_class,p_method,p_no_inheritance); +} + + +Array _ClassDB::get_method_list(StringName p_class,bool p_no_inheritance) const { + + List<MethodInfo> methods; + ClassDB::get_method_list(p_class,&methods,p_no_inheritance); + Array ret; + + for (List<MethodInfo>::Element *E=methods.front();E;E=E->next()) { + ret.push_back(E->get().operator Dictionary()); + } + + return ret; +} + +StringArray _ClassDB::get_integer_constant_list(const StringName& p_class, bool p_no_inheritance) const { + + List<String> constants; + ClassDB::get_integer_constant_list(p_class,&constants,p_no_inheritance); + + StringArray ret; + ret.resize(constants.size()); + int idx=0; + for (List<String>::Element *E=constants.front();E;E=E->next()) { + ret.set(idx++,E->get()); + } + + return ret; +} + +bool _ClassDB::has_integer_constant(const StringName& p_class, const StringName &p_name) const { + + bool success; + ClassDB::get_integer_constant(p_class,p_name,&success); + return success; +} + +int _ClassDB::get_integer_constant(const StringName& p_class, const StringName &p_name) const { + + bool found; + int c = ClassDB::get_integer_constant(p_class,p_name,&found); + ERR_FAIL_COND_V(!found,0); + return c; + +} +StringName _ClassDB::get_category(const StringName& p_node) const { + + return ClassDB::get_category(p_node); +} + +bool _ClassDB::is_class_enabled(StringName p_class) const { + + return ClassDB::is_class_enabled(p_class); +} + +void _ClassDB::_bind_methods() { + + ClassDB::bind_method(_MD("get_class_list"),&_ClassDB::get_class_list); + ClassDB::bind_method(_MD("get_inheriters_from_class","class"),&_ClassDB::get_inheriters_from_class); + ClassDB::bind_method(_MD("get_parent_class","class"),&_ClassDB::get_parent_class); + ClassDB::bind_method(_MD("class_exists","class"),&_ClassDB::class_exists); + ClassDB::bind_method(_MD("is_parent_class","class","inherits"),&_ClassDB::is_parent_class); + ClassDB::bind_method(_MD("can_instance","class"),&_ClassDB::can_instance); + ClassDB::bind_method(_MD("instance","class"),&_ClassDB::instance); + + ClassDB::bind_method(_MD("has_signal","class","signal"),&_ClassDB::has_signal); + ClassDB::bind_method(_MD("get_signal","class","signal"),&_ClassDB::get_signal); + ClassDB::bind_method(_MD("get_signal_list","class","no_inheritance"),&_ClassDB::get_signal_list,DEFVAL(false)); + + ClassDB::bind_method(_MD("get_property_list","class","no_inheritance"),&_ClassDB::get_property_list,DEFVAL(false)); + + ClassDB::bind_method(_MD("has_method","class","method","no_inheritance"),&_ClassDB::has_method,DEFVAL(false)); + + ClassDB::bind_method(_MD("get_method_list","class","no_inheritance"),&_ClassDB::get_method_list,DEFVAL(false)); + + ClassDB::bind_method(_MD("get_integer_constant_list","class","no_inheritance"),&_ClassDB::get_integer_constant_list,DEFVAL(false)); + + ClassDB::bind_method(_MD("has_integer_constant","class","name"),&_ClassDB::has_integer_constant); + ClassDB::bind_method(_MD("get_integer_constant","class","name"),&_ClassDB::get_integer_constant); + + ClassDB::bind_method(_MD("get_category","class"),&_ClassDB::get_category); + ClassDB::bind_method(_MD("is_class_enabled","class"),&_ClassDB::is_class_enabled); + + +} + +_ClassDB::_ClassDB(){ + + +} +_ClassDB::~_ClassDB(){ + + +} diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 968e7f92c7..9a4f26a12d 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -38,7 +38,7 @@ class _ResourceLoader : public Object { - OBJ_TYPE(_ResourceLoader,Object); + GDCLASS(_ResourceLoader,Object); protected: @@ -60,7 +60,7 @@ public: }; class _ResourceSaver : public Object { - OBJ_TYPE(_ResourceSaver,Object); + GDCLASS(_ResourceSaver,Object); protected: @@ -90,7 +90,7 @@ public: class MainLoop; class _OS : public Object { - OBJ_TYPE(_OS,Object); + GDCLASS(_OS,Object); protected: @@ -333,7 +333,7 @@ VARIANT_ENUM_CAST(_OS::ScreenOrientation); class _Geometry : public Object { - OBJ_TYPE(_Geometry, Object); + GDCLASS(_Geometry, Object); static _Geometry *singleton; protected: @@ -371,7 +371,7 @@ public: class _File : public Reference { - OBJ_TYPE(_File,Reference); + GDCLASS(_File,Reference); FileAccess *f; bool eswap; protected: @@ -460,7 +460,7 @@ public: class _Directory : public Reference { - OBJ_TYPE(_Directory,Reference); + GDCLASS(_Directory,Reference); DirAccess *d; protected: @@ -501,7 +501,7 @@ public: class _Marshalls : public Reference { - OBJ_TYPE(_Marshalls,Reference); + GDCLASS(_Marshalls,Reference); static _Marshalls* singleton; @@ -530,7 +530,7 @@ public: class _Mutex : public Reference { - OBJ_TYPE(_Mutex,Reference); + GDCLASS(_Mutex,Reference); Mutex *mutex; static void _bind_methods(); @@ -546,7 +546,7 @@ public: class _Semaphore : public Reference { - OBJ_TYPE(_Semaphore,Reference); + GDCLASS(_Semaphore,Reference); Semaphore *semaphore; static void _bind_methods(); @@ -561,7 +561,7 @@ public: class _Thread : public Reference { - OBJ_TYPE(_Thread,Reference); + GDCLASS(_Thread,Reference); protected: @@ -591,4 +591,42 @@ public: ~_Thread(); }; +class _ClassDB : public Object { + + GDCLASS(_ClassDB,Object) + +protected: + static void _bind_methods(); +public: + + StringArray get_class_list() const; + StringArray get_inheriters_from_class( const StringName& p_class) const; + StringName get_parent_class(const StringName& p_class) const; + bool class_exists(const StringName &p_class) const; + bool is_parent_class(const StringName &p_class,const StringName& p_inherits) const; + bool can_instance(const StringName &p_class) const; + Variant instance(const StringName &p_class) const; + + bool has_signal(StringName p_class,StringName p_signal) const; + Dictionary get_signal(StringName p_class,StringName p_signal) const; + Array get_signal_list(StringName p_class,bool p_no_inheritance=false) const; + + Array get_property_list(StringName p_class, bool p_no_inheritance=false) const; + + bool has_method(StringName p_class,StringName p_method,bool p_no_inheritance=false) const; + + + Array get_method_list(StringName p_class,bool p_no_inheritance=false) const; + + StringArray get_integer_constant_list(const StringName& p_class, bool p_no_inheritance=false) const; + bool has_integer_constant(const StringName& p_class, const StringName &p_name) const; + int get_integer_constant(const StringName& p_class, const StringName &p_name) const; + StringName get_category(const StringName& p_node) const; + + bool is_class_enabled(StringName p_class) const; + + _ClassDB(); + ~_ClassDB(); +}; + #endif // CORE_BIND_H |