diff options
Diffstat (limited to 'core')
71 files changed, 1236 insertions, 993 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 diff --git a/core/compressed_translation.cpp b/core/compressed_translation.cpp index 1725ce9946..9b39eeb2c1 100644 --- a/core/compressed_translation.cpp +++ b/core/compressed_translation.cpp @@ -526,7 +526,7 @@ void PHashTranslation::_get_property_list( List<PropertyInfo> *p_list) const{ } void PHashTranslation::_bind_methods() { - ObjectTypeDB::bind_method(_MD("generate","from:Translation"),&PHashTranslation::generate); + ClassDB::bind_method(_MD("generate","from:Translation"),&PHashTranslation::generate); } PHashTranslation::PHashTranslation() diff --git a/core/compressed_translation.h b/core/compressed_translation.h index a7b539816a..218a59c05d 100644 --- a/core/compressed_translation.h +++ b/core/compressed_translation.h @@ -33,7 +33,7 @@ class PHashTranslation : public Translation { - OBJ_TYPE(PHashTranslation,Translation); + GDCLASS(PHashTranslation,Translation); //this translation uses a sort of modified perfect hash algorithm diff --git a/core/func_ref.cpp b/core/func_ref.cpp index e6a87995e5..1e8c229810 100644 --- a/core/func_ref.cpp +++ b/core/func_ref.cpp @@ -61,12 +61,12 @@ void FuncRef::_bind_methods() { MethodInfo mi; mi.name="call_func"; Vector<Variant> defargs; - ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"call_func:Variant",&FuncRef::call_func,mi,defargs); + ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"call_func:Variant",&FuncRef::call_func,mi,defargs); } - ObjectTypeDB::bind_method(_MD("set_instance","instance"),&FuncRef::set_instance); - ObjectTypeDB::bind_method(_MD("set_function","name"),&FuncRef::set_function); + ClassDB::bind_method(_MD("set_instance","instance"),&FuncRef::set_instance); + ClassDB::bind_method(_MD("set_function","name"),&FuncRef::set_function); } diff --git a/core/func_ref.h b/core/func_ref.h index c3090631b2..0c9bca4680 100644 --- a/core/func_ref.h +++ b/core/func_ref.h @@ -33,7 +33,7 @@ class FuncRef : public Reference{ - OBJ_TYPE(FuncRef,Reference); + GDCLASS(FuncRef,Reference); ObjectID id; StringName function; diff --git a/core/globals.cpp b/core/globals.cpp index 5f47bfef2d..8b335b8a0d 100644 --- a/core/globals.cpp +++ b/core/globals.cpp @@ -1420,21 +1420,21 @@ bool Globals::is_using_datapack() const { void Globals::_bind_methods() { - ObjectTypeDB::bind_method(_MD("has","name"),&Globals::has); - ObjectTypeDB::bind_method(_MD("set_order","name","pos"),&Globals::set_order); - ObjectTypeDB::bind_method(_MD("get_order","name"),&Globals::get_order); - ObjectTypeDB::bind_method(_MD("set_persisting","name","enable"),&Globals::set_persisting); - ObjectTypeDB::bind_method(_MD("is_persisting","name"),&Globals::is_persisting); - ObjectTypeDB::bind_method(_MD("add_property_info", "hint"),&Globals::_add_property_info_bind); - ObjectTypeDB::bind_method(_MD("clear","name"),&Globals::clear); - ObjectTypeDB::bind_method(_MD("localize_path","path"),&Globals::localize_path); - ObjectTypeDB::bind_method(_MD("globalize_path","path"),&Globals::globalize_path); - ObjectTypeDB::bind_method(_MD("save"),&Globals::save); - ObjectTypeDB::bind_method(_MD("has_singleton","name"),&Globals::has_singleton); - ObjectTypeDB::bind_method(_MD("get_singleton","name"),&Globals::get_singleton_object); - ObjectTypeDB::bind_method(_MD("load_resource_pack","pack"),&Globals::_load_resource_pack); - - ObjectTypeDB::bind_method(_MD("save_custom","file"),&Globals::_save_custom_bnd); + ClassDB::bind_method(_MD("has","name"),&Globals::has); + ClassDB::bind_method(_MD("set_order","name","pos"),&Globals::set_order); + ClassDB::bind_method(_MD("get_order","name"),&Globals::get_order); + ClassDB::bind_method(_MD("set_persisting","name","enable"),&Globals::set_persisting); + ClassDB::bind_method(_MD("is_persisting","name"),&Globals::is_persisting); + ClassDB::bind_method(_MD("add_property_info", "hint"),&Globals::_add_property_info_bind); + ClassDB::bind_method(_MD("clear","name"),&Globals::clear); + ClassDB::bind_method(_MD("localize_path","path"),&Globals::localize_path); + ClassDB::bind_method(_MD("globalize_path","path"),&Globals::globalize_path); + ClassDB::bind_method(_MD("save"),&Globals::save); + ClassDB::bind_method(_MD("has_singleton","name"),&Globals::has_singleton); + ClassDB::bind_method(_MD("get_singleton","name"),&Globals::get_singleton_object); + ClassDB::bind_method(_MD("load_resource_pack","pack"),&Globals::_load_resource_pack); + + ClassDB::bind_method(_MD("save_custom","file"),&Globals::_save_custom_bnd); } diff --git a/core/globals.h b/core/globals.h index f9d732ef15..67937c56d8 100644 --- a/core/globals.h +++ b/core/globals.h @@ -39,7 +39,7 @@ class Globals : public Object { - OBJ_TYPE( Globals, Object ); + GDCLASS( Globals, Object ); _THREAD_SAFE_CLASS_ public: diff --git a/core/helper/value_evaluator.h b/core/helper/value_evaluator.h index 5d38bd4cb4..9ea03db4c6 100644 --- a/core/helper/value_evaluator.h +++ b/core/helper/value_evaluator.h @@ -33,7 +33,7 @@ class ValueEvaluator : public Object { - OBJ_TYPE(ValueEvaluator, Object); + GDCLASS(ValueEvaluator, Object); public: virtual double eval(const String& p_text) { return p_text.to_double(); diff --git a/core/input_map.cpp b/core/input_map.cpp index 748e084a45..439bf4b766 100644 --- a/core/input_map.cpp +++ b/core/input_map.cpp @@ -34,19 +34,19 @@ InputMap *InputMap::singleton=NULL; void InputMap::_bind_methods() { - ObjectTypeDB::bind_method(_MD("has_action","action"),&InputMap::has_action); - ObjectTypeDB::bind_method(_MD("get_action_id","action"),&InputMap::get_action_id); - ObjectTypeDB::bind_method(_MD("get_action_from_id","id"),&InputMap::get_action_from_id); - ObjectTypeDB::bind_method(_MD("get_actions"),&InputMap::_get_actions); - ObjectTypeDB::bind_method(_MD("add_action","action"),&InputMap::add_action); - ObjectTypeDB::bind_method(_MD("erase_action","action"),&InputMap::erase_action); - - ObjectTypeDB::bind_method(_MD("action_add_event","action","event"),&InputMap::action_add_event); - ObjectTypeDB::bind_method(_MD("action_has_event","action","event"),&InputMap::action_has_event); - ObjectTypeDB::bind_method(_MD("action_erase_event","action","event"),&InputMap::action_erase_event); - ObjectTypeDB::bind_method(_MD("get_action_list","action"),&InputMap::_get_action_list); - ObjectTypeDB::bind_method(_MD("event_is_action","event","action"),&InputMap::event_is_action); - ObjectTypeDB::bind_method(_MD("load_from_globals"),&InputMap::load_from_globals); + ClassDB::bind_method(_MD("has_action","action"),&InputMap::has_action); + ClassDB::bind_method(_MD("get_action_id","action"),&InputMap::get_action_id); + ClassDB::bind_method(_MD("get_action_from_id","id"),&InputMap::get_action_from_id); + ClassDB::bind_method(_MD("get_actions"),&InputMap::_get_actions); + ClassDB::bind_method(_MD("add_action","action"),&InputMap::add_action); + ClassDB::bind_method(_MD("erase_action","action"),&InputMap::erase_action); + + ClassDB::bind_method(_MD("action_add_event","action","event"),&InputMap::action_add_event); + ClassDB::bind_method(_MD("action_has_event","action","event"),&InputMap::action_has_event); + ClassDB::bind_method(_MD("action_erase_event","action","event"),&InputMap::action_erase_event); + ClassDB::bind_method(_MD("get_action_list","action"),&InputMap::_get_action_list); + ClassDB::bind_method(_MD("event_is_action","event","action"),&InputMap::event_is_action); + ClassDB::bind_method(_MD("load_from_globals"),&InputMap::load_from_globals); } diff --git a/core/input_map.h b/core/input_map.h index efc3a751aa..306845fc89 100644 --- a/core/input_map.h +++ b/core/input_map.h @@ -34,7 +34,7 @@ class InputMap : public Object { - OBJ_TYPE( InputMap, Object ); + GDCLASS( InputMap, Object ); public: struct Action { int id; diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp index 1cf600a0cf..6039a77337 100644 --- a/core/io/config_file.cpp +++ b/core/io/config_file.cpp @@ -206,17 +206,17 @@ Error ConfigFile::load(const String& p_path) { void ConfigFile::_bind_methods(){ - ObjectTypeDB::bind_method(_MD("set_value","section","key","value"),&ConfigFile::set_value); - ObjectTypeDB::bind_method(_MD("get_value:Variant","section","key","default"),&ConfigFile::get_value,DEFVAL(Variant())); + ClassDB::bind_method(_MD("set_value","section","key","value"),&ConfigFile::set_value); + ClassDB::bind_method(_MD("get_value:Variant","section","key","default"),&ConfigFile::get_value,DEFVAL(Variant())); - ObjectTypeDB::bind_method(_MD("has_section","section"),&ConfigFile::has_section); - ObjectTypeDB::bind_method(_MD("has_section_key","section","key"),&ConfigFile::has_section_key); + ClassDB::bind_method(_MD("has_section","section"),&ConfigFile::has_section); + ClassDB::bind_method(_MD("has_section_key","section","key"),&ConfigFile::has_section_key); - ObjectTypeDB::bind_method(_MD("get_sections"),&ConfigFile::_get_sections); - ObjectTypeDB::bind_method(_MD("get_section_keys","section"),&ConfigFile::_get_section_keys); + ClassDB::bind_method(_MD("get_sections"),&ConfigFile::_get_sections); + ClassDB::bind_method(_MD("get_section_keys","section"),&ConfigFile::_get_section_keys); - ObjectTypeDB::bind_method(_MD("load:Error","path"),&ConfigFile::load); - ObjectTypeDB::bind_method(_MD("save:Error","path"),&ConfigFile::save); + ClassDB::bind_method(_MD("load:Error","path"),&ConfigFile::load); + ClassDB::bind_method(_MD("save:Error","path"),&ConfigFile::save); } diff --git a/core/io/config_file.h b/core/io/config_file.h index 6481f05222..bd71fa62c6 100644 --- a/core/io/config_file.h +++ b/core/io/config_file.h @@ -34,7 +34,7 @@ class ConfigFile : public Reference { - OBJ_TYPE(ConfigFile,Reference); + GDCLASS(ConfigFile,Reference); Map< String, Map<String, Variant> > values; diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index 4f14a1fc4d..4051ae302f 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -639,32 +639,32 @@ Error HTTPClient::_get_http_data(uint8_t* p_buffer, int p_bytes,int &r_received) void HTTPClient::_bind_methods() { - ObjectTypeDB::bind_method(_MD("set_ip_type","ip_type"),&HTTPClient::set_ip_type); - ObjectTypeDB::bind_method(_MD("connect:Error","host","port","use_ssl","verify_host"),&HTTPClient::connect,DEFVAL(false),DEFVAL(true)); - ObjectTypeDB::bind_method(_MD("set_connection","connection:StreamPeer"),&HTTPClient::set_connection); - ObjectTypeDB::bind_method(_MD("get_connection:StreamPeer"),&HTTPClient::get_connection); - ObjectTypeDB::bind_method(_MD("request_raw","method","url","headers","body"),&HTTPClient::request_raw); - ObjectTypeDB::bind_method(_MD("request","method","url","headers","body"),&HTTPClient::request,DEFVAL(String())); - ObjectTypeDB::bind_method(_MD("send_body_text","body"),&HTTPClient::send_body_text); - ObjectTypeDB::bind_method(_MD("send_body_data","body"),&HTTPClient::send_body_data); - ObjectTypeDB::bind_method(_MD("close"),&HTTPClient::close); - - ObjectTypeDB::bind_method(_MD("has_response"),&HTTPClient::has_response); - ObjectTypeDB::bind_method(_MD("is_response_chunked"),&HTTPClient::is_response_chunked); - ObjectTypeDB::bind_method(_MD("get_response_code"),&HTTPClient::get_response_code); - ObjectTypeDB::bind_method(_MD("get_response_headers"),&HTTPClient::_get_response_headers); - ObjectTypeDB::bind_method(_MD("get_response_headers_as_dictionary"),&HTTPClient::_get_response_headers_as_dictionary); - ObjectTypeDB::bind_method(_MD("get_response_body_length"),&HTTPClient::get_response_body_length); - ObjectTypeDB::bind_method(_MD("read_response_body_chunk"),&HTTPClient::read_response_body_chunk); - ObjectTypeDB::bind_method(_MD("set_read_chunk_size","bytes"),&HTTPClient::set_read_chunk_size); - - ObjectTypeDB::bind_method(_MD("set_blocking_mode","enabled"),&HTTPClient::set_blocking_mode); - ObjectTypeDB::bind_method(_MD("is_blocking_mode_enabled"),&HTTPClient::is_blocking_mode_enabled); - - ObjectTypeDB::bind_method(_MD("get_status"),&HTTPClient::get_status); - ObjectTypeDB::bind_method(_MD("poll:Error"),&HTTPClient::poll); - - ObjectTypeDB::bind_method(_MD("query_string_from_dict:String","fields"),&HTTPClient::query_string_from_dict); + ClassDB::bind_method(_MD("set_ip_type","ip_type"),&HTTPClient::set_ip_type); + ClassDB::bind_method(_MD("connect:Error","host","port","use_ssl","verify_host"),&HTTPClient::connect,DEFVAL(false),DEFVAL(true)); + ClassDB::bind_method(_MD("set_connection","connection:StreamPeer"),&HTTPClient::set_connection); + ClassDB::bind_method(_MD("get_connection:StreamPeer"),&HTTPClient::get_connection); + ClassDB::bind_method(_MD("request_raw","method","url","headers","body"),&HTTPClient::request_raw); + ClassDB::bind_method(_MD("request","method","url","headers","body"),&HTTPClient::request,DEFVAL(String())); + ClassDB::bind_method(_MD("send_body_text","body"),&HTTPClient::send_body_text); + ClassDB::bind_method(_MD("send_body_data","body"),&HTTPClient::send_body_data); + ClassDB::bind_method(_MD("close"),&HTTPClient::close); + + ClassDB::bind_method(_MD("has_response"),&HTTPClient::has_response); + ClassDB::bind_method(_MD("is_response_chunked"),&HTTPClient::is_response_chunked); + ClassDB::bind_method(_MD("get_response_code"),&HTTPClient::get_response_code); + ClassDB::bind_method(_MD("get_response_headers"),&HTTPClient::_get_response_headers); + ClassDB::bind_method(_MD("get_response_headers_as_dictionary"),&HTTPClient::_get_response_headers_as_dictionary); + ClassDB::bind_method(_MD("get_response_body_length"),&HTTPClient::get_response_body_length); + ClassDB::bind_method(_MD("read_response_body_chunk"),&HTTPClient::read_response_body_chunk); + ClassDB::bind_method(_MD("set_read_chunk_size","bytes"),&HTTPClient::set_read_chunk_size); + + ClassDB::bind_method(_MD("set_blocking_mode","enabled"),&HTTPClient::set_blocking_mode); + ClassDB::bind_method(_MD("is_blocking_mode_enabled"),&HTTPClient::is_blocking_mode_enabled); + + ClassDB::bind_method(_MD("get_status"),&HTTPClient::get_status); + ClassDB::bind_method(_MD("poll:Error"),&HTTPClient::poll); + + ClassDB::bind_method(_MD("query_string_from_dict:String","fields"),&HTTPClient::query_string_from_dict); BIND_CONSTANT( METHOD_GET ); diff --git a/core/io/http_client.h b/core/io/http_client.h index ef0a687cdd..2e78882303 100644 --- a/core/io/http_client.h +++ b/core/io/http_client.h @@ -37,7 +37,7 @@ class HTTPClient : public Reference { - OBJ_TYPE(HTTPClient,Reference); + GDCLASS(HTTPClient,Reference); public: enum ResponseCode { diff --git a/core/io/ip.cpp b/core/io/ip.cpp index b057d72e49..0eb1f221c9 100644 --- a/core/io/ip.cpp +++ b/core/io/ip.cpp @@ -218,13 +218,13 @@ Array IP::_get_local_addresses() const { void IP::_bind_methods() { - ObjectTypeDB::bind_method(_MD("resolve_hostname","host","ip_type"),&IP::resolve_hostname,DEFVAL(IP::TYPE_ANY)); - ObjectTypeDB::bind_method(_MD("resolve_hostname_queue_item","host","ip_type"),&IP::resolve_hostname_queue_item,DEFVAL(IP::TYPE_ANY)); - ObjectTypeDB::bind_method(_MD("get_resolve_item_status","id"),&IP::get_resolve_item_status); - ObjectTypeDB::bind_method(_MD("get_resolve_item_address","id"),&IP::get_resolve_item_address); - ObjectTypeDB::bind_method(_MD("erase_resolve_item","id"),&IP::erase_resolve_item); - ObjectTypeDB::bind_method(_MD("get_local_addresses"),&IP::_get_local_addresses); - ObjectTypeDB::bind_method(_MD("clear_cache"),&IP::clear_cache, DEFVAL("")); + ClassDB::bind_method(_MD("resolve_hostname","host","ip_type"),&IP::resolve_hostname,DEFVAL(IP::TYPE_ANY)); + ClassDB::bind_method(_MD("resolve_hostname_queue_item","host","ip_type"),&IP::resolve_hostname_queue_item,DEFVAL(IP::TYPE_ANY)); + ClassDB::bind_method(_MD("get_resolve_item_status","id"),&IP::get_resolve_item_status); + ClassDB::bind_method(_MD("get_resolve_item_address","id"),&IP::get_resolve_item_address); + ClassDB::bind_method(_MD("erase_resolve_item","id"),&IP::erase_resolve_item); + ClassDB::bind_method(_MD("get_local_addresses"),&IP::_get_local_addresses); + ClassDB::bind_method(_MD("clear_cache"),&IP::clear_cache, DEFVAL("")); BIND_CONSTANT( RESOLVER_STATUS_NONE ); BIND_CONSTANT( RESOLVER_STATUS_WAITING ); diff --git a/core/io/ip.h b/core/io/ip.h index 0a0e75fe7b..3e028f2613 100644 --- a/core/io/ip.h +++ b/core/io/ip.h @@ -36,7 +36,7 @@ struct _IP_ResolverPrivate; class IP : public Object { - OBJ_TYPE( IP, Object ); + GDCLASS( IP, Object ); OBJ_CATEGORY("Networking"); public: diff --git a/core/io/networked_multiplayer_peer.cpp b/core/io/networked_multiplayer_peer.cpp index 47e5f3729c..6133401a8c 100644 --- a/core/io/networked_multiplayer_peer.cpp +++ b/core/io/networked_multiplayer_peer.cpp @@ -3,18 +3,18 @@ void NetworkedMultiplayerPeer::_bind_methods() { - ObjectTypeDB::bind_method(_MD("set_transfer_mode","mode"), &NetworkedMultiplayerPeer::set_transfer_mode ); - ObjectTypeDB::bind_method(_MD("set_target_peer","id"), &NetworkedMultiplayerPeer::set_target_peer ); + ClassDB::bind_method(_MD("set_transfer_mode","mode"), &NetworkedMultiplayerPeer::set_transfer_mode ); + ClassDB::bind_method(_MD("set_target_peer","id"), &NetworkedMultiplayerPeer::set_target_peer ); - ObjectTypeDB::bind_method(_MD("get_packet_peer"), &NetworkedMultiplayerPeer::get_packet_peer ); + ClassDB::bind_method(_MD("get_packet_peer"), &NetworkedMultiplayerPeer::get_packet_peer ); - ObjectTypeDB::bind_method(_MD("poll"), &NetworkedMultiplayerPeer::poll ); + ClassDB::bind_method(_MD("poll"), &NetworkedMultiplayerPeer::poll ); - ObjectTypeDB::bind_method(_MD("get_connection_status"), &NetworkedMultiplayerPeer::get_connection_status ); - ObjectTypeDB::bind_method(_MD("get_unique_id"), &NetworkedMultiplayerPeer::get_unique_id ); + ClassDB::bind_method(_MD("get_connection_status"), &NetworkedMultiplayerPeer::get_connection_status ); + ClassDB::bind_method(_MD("get_unique_id"), &NetworkedMultiplayerPeer::get_unique_id ); - ObjectTypeDB::bind_method(_MD("set_refuse_new_connections","enable"), &NetworkedMultiplayerPeer::set_refuse_new_connections ); - ObjectTypeDB::bind_method(_MD("is_refusing_new_connections"), &NetworkedMultiplayerPeer::is_refusing_new_connections ); + ClassDB::bind_method(_MD("set_refuse_new_connections","enable"), &NetworkedMultiplayerPeer::set_refuse_new_connections ); + ClassDB::bind_method(_MD("is_refusing_new_connections"), &NetworkedMultiplayerPeer::is_refusing_new_connections ); BIND_CONSTANT( TRANSFER_MODE_UNRELIABLE ); BIND_CONSTANT( TRANSFER_MODE_UNRELIABLE_ORDERED ); diff --git a/core/io/networked_multiplayer_peer.h b/core/io/networked_multiplayer_peer.h index 485200a9a9..a59d9367d1 100644 --- a/core/io/networked_multiplayer_peer.h +++ b/core/io/networked_multiplayer_peer.h @@ -5,7 +5,7 @@ class NetworkedMultiplayerPeer : public PacketPeer { - OBJ_TYPE(NetworkedMultiplayerPeer,PacketPeer); + GDCLASS(NetworkedMultiplayerPeer,PacketPeer); protected: static void _bind_methods(); diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp index fc95aa0b1e..1d05e95010 100644 --- a/core/io/packet_peer.cpp +++ b/core/io/packet_peer.cpp @@ -126,12 +126,12 @@ Error PacketPeer::_get_packet_error() const { void PacketPeer::_bind_methods() { - ObjectTypeDB::bind_method(_MD("get_var:Variant"),&PacketPeer::_bnd_get_var); - ObjectTypeDB::bind_method(_MD("put_var", "var:Variant"),&PacketPeer::put_var); - ObjectTypeDB::bind_method(_MD("get_packet"),&PacketPeer::_get_packet); - ObjectTypeDB::bind_method(_MD("put_packet:Error", "buffer"),&PacketPeer::_put_packet); - ObjectTypeDB::bind_method(_MD("get_packet_error:Error"),&PacketPeer::_get_packet_error); - ObjectTypeDB::bind_method(_MD("get_available_packet_count"),&PacketPeer::get_available_packet_count); + ClassDB::bind_method(_MD("get_var:Variant"),&PacketPeer::_bnd_get_var); + ClassDB::bind_method(_MD("put_var", "var:Variant"),&PacketPeer::put_var); + ClassDB::bind_method(_MD("get_packet"),&PacketPeer::_get_packet); + ClassDB::bind_method(_MD("put_packet:Error", "buffer"),&PacketPeer::_put_packet); + ClassDB::bind_method(_MD("get_packet_error:Error"),&PacketPeer::_get_packet_error); + ClassDB::bind_method(_MD("get_available_packet_count"),&PacketPeer::get_available_packet_count); }; /***************/ @@ -145,7 +145,7 @@ void PacketPeerStream::_set_stream_peer(REF p_peer) { void PacketPeerStream::_bind_methods() { - ObjectTypeDB::bind_method(_MD("set_stream_peer","peer:StreamPeer"),&PacketPeerStream::_set_stream_peer); + ClassDB::bind_method(_MD("set_stream_peer","peer:StreamPeer"),&PacketPeerStream::_set_stream_peer); } Error PacketPeerStream::_poll_buffer() const { diff --git a/core/io/packet_peer.h b/core/io/packet_peer.h index ec2f46b82d..7aa8d8d456 100644 --- a/core/io/packet_peer.h +++ b/core/io/packet_peer.h @@ -34,7 +34,7 @@ #include "ring_buffer.h" class PacketPeer : public Reference { - OBJ_TYPE( PacketPeer, Reference ); + GDCLASS( PacketPeer, Reference ); Variant _bnd_get_var() const; void _bnd_put_var(const Variant& p_var); @@ -71,7 +71,7 @@ public: class PacketPeerStream : public PacketPeer { - OBJ_TYPE(PacketPeerStream,PacketPeer); + GDCLASS(PacketPeerStream,PacketPeer); //the way the buffers work sucks, will change later diff --git a/core/io/packet_peer_udp.cpp b/core/io/packet_peer_udp.cpp index 6216176e77..91d1fc5f98 100644 --- a/core/io/packet_peer_udp.cpp +++ b/core/io/packet_peer_udp.cpp @@ -58,15 +58,15 @@ void PacketPeerUDP::set_ip_type(IP::Type p_type) { void PacketPeerUDP::_bind_methods() { - ObjectTypeDB::bind_method(_MD("set_ip_type","ip_type"),&PacketPeerUDP::set_ip_type); - ObjectTypeDB::bind_method(_MD("listen:Error","port", "recv_buf_size"),&PacketPeerUDP::listen,DEFVAL(65536)); - ObjectTypeDB::bind_method(_MD("close"),&PacketPeerUDP::close); - ObjectTypeDB::bind_method(_MD("wait:Error"),&PacketPeerUDP::wait); - ObjectTypeDB::bind_method(_MD("is_listening"),&PacketPeerUDP::is_listening); - ObjectTypeDB::bind_method(_MD("get_packet_ip"),&PacketPeerUDP::_get_packet_ip); - //ObjectTypeDB::bind_method(_MD("get_packet_address"),&PacketPeerUDP::_get_packet_address); - ObjectTypeDB::bind_method(_MD("get_packet_port"),&PacketPeerUDP::get_packet_port); - ObjectTypeDB::bind_method(_MD("set_send_address","host","port"),&PacketPeerUDP::_set_send_address); + ClassDB::bind_method(_MD("set_ip_type","ip_type"),&PacketPeerUDP::set_ip_type); + ClassDB::bind_method(_MD("listen:Error","port", "recv_buf_size"),&PacketPeerUDP::listen,DEFVAL(65536)); + ClassDB::bind_method(_MD("close"),&PacketPeerUDP::close); + ClassDB::bind_method(_MD("wait:Error"),&PacketPeerUDP::wait); + ClassDB::bind_method(_MD("is_listening"),&PacketPeerUDP::is_listening); + ClassDB::bind_method(_MD("get_packet_ip"),&PacketPeerUDP::_get_packet_ip); + //ClassDB::bind_method(_MD("get_packet_address"),&PacketPeerUDP::_get_packet_address); + ClassDB::bind_method(_MD("get_packet_port"),&PacketPeerUDP::get_packet_port); + ClassDB::bind_method(_MD("set_send_address","host","port"),&PacketPeerUDP::_set_send_address); } diff --git a/core/io/packet_peer_udp.h b/core/io/packet_peer_udp.h index 5f80ea08fc..17a2817f34 100644 --- a/core/io/packet_peer_udp.h +++ b/core/io/packet_peer_udp.h @@ -34,7 +34,7 @@ #include "io/packet_peer.h" class PacketPeerUDP : public PacketPeer { - OBJ_TYPE(PacketPeerUDP,PacketPeer); + GDCLASS(PacketPeerUDP,PacketPeer); protected: diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp index 6d35acf182..a9f357a7c8 100644 --- a/core/io/pck_packer.cpp +++ b/core/io/pck_packer.cpp @@ -52,9 +52,9 @@ static void _pad(FileAccess* p_file, int p_bytes) { void PCKPacker::_bind_methods() { - ObjectTypeDB::bind_method(_MD("pck_start","pck_name","alignment"),&PCKPacker::pck_start); - ObjectTypeDB::bind_method(_MD("add_file","pck_path","source_path"),&PCKPacker::add_file); - ObjectTypeDB::bind_method(_MD("flush","verbose"),&PCKPacker::flush); + ClassDB::bind_method(_MD("pck_start","pck_name","alignment"),&PCKPacker::pck_start); + ClassDB::bind_method(_MD("add_file","pck_path","source_path"),&PCKPacker::add_file); + ClassDB::bind_method(_MD("flush","verbose"),&PCKPacker::flush); }; diff --git a/core/io/pck_packer.h b/core/io/pck_packer.h index 2ed5c050c6..a4eba04f2d 100644 --- a/core/io/pck_packer.h +++ b/core/io/pck_packer.h @@ -32,7 +32,7 @@ class FileAccess; class PCKPacker : public Reference { - OBJ_TYPE(PCKPacker, Reference); + GDCLASS(PCKPacker, Reference); FileAccess* file; int alignment; diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 109d2d811e..953192306f 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -700,7 +700,7 @@ Error ResourceInteractiveLoaderBinary::poll(){ String t = get_unicode_string(); - Object *obj = ObjectTypeDB::instance(t); + Object *obj = ClassDB::instance(t); if (!obj) { error=ERR_FILE_CORRUPT; ERR_EXPLAIN(local_path+":Resource of unrecognized type in file: "+t); @@ -711,7 +711,7 @@ Error ResourceInteractiveLoaderBinary::poll(){ if (!r) { error=ERR_FILE_CORRUPT; memdelete(obj); //bye - ERR_EXPLAIN(local_path+":Resoucre type in resource field not a resource, type is: "+obj->get_type()); + ERR_EXPLAIN(local_path+":Resoucre type in resource field not a resource, type is: "+obj->get_class()); ERR_FAIL_COND_V(!r,ERR_FILE_CORRUPT); } @@ -1064,7 +1064,7 @@ void ResourceFormatLoaderBinary::get_recognized_extensions_for_type(const String } List<String> extensions; - ObjectTypeDB::get_extensions_for_type(p_type,&extensions); + ClassDB::get_extensions_for_type(p_type,&extensions); extensions.sort(); @@ -1077,7 +1077,7 @@ void ResourceFormatLoaderBinary::get_recognized_extensions_for_type(const String void ResourceFormatLoaderBinary::get_recognized_extensions(List<String> *p_extensions) const{ List<String> extensions; - ObjectTypeDB::get_resource_base_extensions(&extensions); + ClassDB::get_resource_base_extensions(&extensions); extensions.sort(); for(List<String>::Element *E=extensions.front();E;E=E->next()) { @@ -2002,7 +2002,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path,const RES& p_ } //f->store_32(saved_resources.size()+external_resources.size()); // load steps -not needed - save_unicode_string(p_resource->get_type()); + save_unicode_string(p_resource->get_class()); uint64_t md_at = f->get_pos(); f->store_64(0); //offset to impoty metadata for(int i=0;i<14;i++) @@ -2019,7 +2019,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path,const RES& p_ ResourceData &rd = resources.push_back(ResourceData())->get(); - rd.type=E->get()->get_type(); + rd.type=E->get()->get_class(); List<PropertyInfo> property_list; E->get()->get_property_list( &property_list ); @@ -2064,7 +2064,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path,const RES& p_ for(int i=0;i<save_order.size();i++) { - save_unicode_string(save_order[i]->get_save_type()); + save_unicode_string(save_order[i]->get_save_class()); String path = save_order[i]->get_path(); path=relative_paths?local_path.path_to_file(path):path; save_unicode_string(path); diff --git a/core/io/resource_format_xml.cpp b/core/io/resource_format_xml.cpp index 7174c40fdf..c90adf4f57 100644 --- a/core/io/resource_format_xml.cpp +++ b/core/io/resource_format_xml.cpp @@ -1518,7 +1518,7 @@ Error ResourceInteractiveLoaderXML::poll() { type=resource_type; } - Object *obj = ObjectTypeDB::instance(type); + Object *obj = ClassDB::instance(type); if (!obj) { error=ERR_FILE_CORRUPT; ERR_EXPLAIN(local_path+":"+itos(get_current_line())+": Object of unrecognized type in file: "+type); @@ -1529,7 +1529,7 @@ Error ResourceInteractiveLoaderXML::poll() { if (!r) { error=ERR_FILE_CORRUPT; memdelete(obj); //bye - ERR_EXPLAIN(local_path+":"+itos(get_current_line())+": Object type in resource field not a resource, type is: "+obj->get_type()); + ERR_EXPLAIN(local_path+":"+itos(get_current_line())+": Object type in resource field not a resource, type is: "+obj->get_class()); ERR_FAIL_COND_V(!r,ERR_FILE_CORRUPT); } @@ -1940,7 +1940,7 @@ void ResourceFormatLoaderXML::get_recognized_extensions_for_type(const String& p } List<String> extensions; - ObjectTypeDB::get_extensions_for_type(p_type,&extensions); + ClassDB::get_extensions_for_type(p_type,&extensions); extensions.sort(); @@ -1958,7 +1958,7 @@ void ResourceFormatLoaderXML::get_recognized_extensions_for_type(const String& p void ResourceFormatLoaderXML::get_recognized_extensions(List<String> *p_extensions) const{ List<String> extensions; - ObjectTypeDB::get_resource_base_extensions(&extensions); + ClassDB::get_resource_base_extensions(&extensions); extensions.sort(); for(List<String>::Element *E=extensions.front();E;E=E->next()) { @@ -2225,7 +2225,7 @@ void ResourceFormatSaverXMLInstance::write_property(const String& p_name,const V params="external=\""+itos(external_resources[res])+"\""; } else { - params="resource_type=\""+res->get_save_type()+"\""; + params="resource_type=\""+res->get_save_class()+"\""; if (res->get_path().length() && res->get_path().find("::")==-1) { @@ -2734,7 +2734,7 @@ Error ResourceFormatSaverXMLInstance::save(const String &p_path,const RES& p_res write_string("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>",false); //no escape write_string("\n",false); - enter_tag("resource_file","type=\""+p_resource->get_type()+"\" subresource_count=\""+itos(saved_resources.size()+external_resources.size())+"\" version=\""+itos(VERSION_MAJOR)+"."+itos(VERSION_MINOR)+"\" version_name=\""+VERSION_FULL_NAME+"\""); + enter_tag("resource_file","type=\""+p_resource->get_class()+"\" subresource_count=\""+itos(saved_resources.size()+external_resources.size())+"\" version=\""+itos(VERSION_MAJOR)+"."+itos(VERSION_MINOR)+"\" version_name=\""+VERSION_FULL_NAME+"\""); write_string("\n",false); for(Map<RES,int>::Element *E=external_resources.front();E;E=E->next()) { @@ -2742,7 +2742,7 @@ Error ResourceFormatSaverXMLInstance::save(const String &p_path,const RES& p_res write_tabs(); String p = E->key()->get_path(); - enter_tag("ext_resource","path=\""+p+"\" type=\""+E->key()->get_save_type()+"\" index=\""+itos(E->get())+"\""); //bundled + enter_tag("ext_resource","path=\""+p+"\" type=\""+E->key()->get_save_class()+"\" index=\""+itos(E->get())+"\""); //bundled exit_tag("ext_resource"); //bundled write_string("\n",false); } @@ -2775,7 +2775,7 @@ Error ResourceFormatSaverXMLInstance::save(const String &p_path,const RES& p_res if (main) enter_tag("main_resource",""); //bundled else if (res->get_path().length() && res->get_path().find("::") == -1 ) - enter_tag("resource","type=\""+res->get_type()+"\" path=\""+res->get_path()+"\""); //bundled + enter_tag("resource","type=\""+res->get_class()+"\" path=\""+res->get_path()+"\""); //bundled else { if (res->get_subindex()==0) { @@ -2789,7 +2789,7 @@ Error ResourceFormatSaverXMLInstance::save(const String &p_path,const RES& p_res } int idx = res->get_subindex(); - enter_tag("resource","type=\""+res->get_type()+"\" path=\"local://"+itos(idx)+"\""); + enter_tag("resource","type=\""+res->get_class()+"\" path=\"local://"+itos(idx)+"\""); if (takeover_paths) { res->set_path(p_path+"::"+itos(idx),true); } diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 87e5d72a10..f299a75d85 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -78,16 +78,16 @@ void ResourceLoader::get_recognized_extensions_for_type(const String& p_type,Lis void ResourceInteractiveLoader::_bind_methods() { - ObjectTypeDB::bind_method(_MD("get_resource"),&ResourceInteractiveLoader::get_resource); - ObjectTypeDB::bind_method(_MD("poll"),&ResourceInteractiveLoader::poll); - ObjectTypeDB::bind_method(_MD("wait"),&ResourceInteractiveLoader::wait); - ObjectTypeDB::bind_method(_MD("get_stage"),&ResourceInteractiveLoader::get_stage); - ObjectTypeDB::bind_method(_MD("get_stage_count"),&ResourceInteractiveLoader::get_stage_count); + ClassDB::bind_method(_MD("get_resource"),&ResourceInteractiveLoader::get_resource); + ClassDB::bind_method(_MD("poll"),&ResourceInteractiveLoader::poll); + ClassDB::bind_method(_MD("wait"),&ResourceInteractiveLoader::wait); + ClassDB::bind_method(_MD("get_stage"),&ResourceInteractiveLoader::get_stage); + ClassDB::bind_method(_MD("get_stage_count"),&ResourceInteractiveLoader::get_stage_count); } class ResourceInteractiveLoaderDefault : public ResourceInteractiveLoader { - OBJ_TYPE( ResourceInteractiveLoaderDefault, ResourceInteractiveLoader ); + GDCLASS( ResourceInteractiveLoaderDefault, ResourceInteractiveLoader ); public: Ref<Resource> resource; @@ -285,7 +285,7 @@ String ResourceLoader::find_complete_path(const String& p_path,const String& p_t for(List<String>::Element *E=candidates.front();E;E=E->next()) { String rt = get_resource_type(E->get()); - if (ObjectTypeDB::is_type(rt,p_type)) { + if (ClassDB::is_parent_class(rt,p_type)) { return E->get(); } } diff --git a/core/io/resource_loader.h b/core/io/resource_loader.h index de54dbde66..7979bd02a7 100644 --- a/core/io/resource_loader.h +++ b/core/io/resource_loader.h @@ -37,7 +37,7 @@ class ResourceInteractiveLoader : public Reference { - OBJ_TYPE(ResourceInteractiveLoader,Reference); + GDCLASS(ResourceInteractiveLoader,Reference); protected: static void _bind_methods(); diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp index bc519147d7..218e17278e 100644 --- a/core/io/stream_peer.cpp +++ b/core/io/stream_peer.cpp @@ -389,57 +389,57 @@ Variant StreamPeer::get_var(){ void StreamPeer::_bind_methods() { - ObjectTypeDB::bind_method(_MD("put_data","data"),&StreamPeer::_put_data); - ObjectTypeDB::bind_method(_MD("put_partial_data","data"),&StreamPeer::_put_partial_data); - - ObjectTypeDB::bind_method(_MD("get_data","bytes"),&StreamPeer::_get_data); - ObjectTypeDB::bind_method(_MD("get_partial_data","bytes"),&StreamPeer::_get_partial_data); - - ObjectTypeDB::bind_method(_MD("get_available_bytes"),&StreamPeer::get_available_bytes); - - ObjectTypeDB::bind_method(_MD("set_big_endian","enable"),&StreamPeer::set_big_endian); - ObjectTypeDB::bind_method(_MD("is_big_endian_enabled"),&StreamPeer::is_big_endian_enabled); - - ObjectTypeDB::bind_method(_MD("put_8","val"),&StreamPeer::put_8); - ObjectTypeDB::bind_method(_MD("put_u8","val"),&StreamPeer::put_u8); - ObjectTypeDB::bind_method(_MD("put_16","val"),&StreamPeer::put_16); - ObjectTypeDB::bind_method(_MD("put_u16","val"),&StreamPeer::put_u16); - ObjectTypeDB::bind_method(_MD("put_32","val"),&StreamPeer::put_32); - ObjectTypeDB::bind_method(_MD("put_u32","val"),&StreamPeer::put_u32); - ObjectTypeDB::bind_method(_MD("put_64","val"),&StreamPeer::put_64); - ObjectTypeDB::bind_method(_MD("put_u64","val"),&StreamPeer::put_u64); - ObjectTypeDB::bind_method(_MD("put_float","val"),&StreamPeer::put_float); - ObjectTypeDB::bind_method(_MD("put_double","val"),&StreamPeer::put_double); - ObjectTypeDB::bind_method(_MD("put_utf8_string","val"),&StreamPeer::put_utf8_string); - ObjectTypeDB::bind_method(_MD("put_var","val:Variant"),&StreamPeer::put_var); - - ObjectTypeDB::bind_method(_MD("get_8"),&StreamPeer::get_8); - ObjectTypeDB::bind_method(_MD("get_u8"),&StreamPeer::get_u8); - ObjectTypeDB::bind_method(_MD("get_16"),&StreamPeer::get_16); - ObjectTypeDB::bind_method(_MD("get_u16"),&StreamPeer::get_u16); - ObjectTypeDB::bind_method(_MD("get_32"),&StreamPeer::get_32); - ObjectTypeDB::bind_method(_MD("get_u32"),&StreamPeer::get_u32); - ObjectTypeDB::bind_method(_MD("get_64"),&StreamPeer::get_64); - ObjectTypeDB::bind_method(_MD("get_u64"),&StreamPeer::get_u64); - ObjectTypeDB::bind_method(_MD("get_float"),&StreamPeer::get_float); - ObjectTypeDB::bind_method(_MD("get_double"),&StreamPeer::get_double); - ObjectTypeDB::bind_method(_MD("get_string","bytes"),&StreamPeer::get_string); - ObjectTypeDB::bind_method(_MD("get_utf8_string","bytes"),&StreamPeer::get_utf8_string); - ObjectTypeDB::bind_method(_MD("get_var:Variant"),&StreamPeer::get_var); + ClassDB::bind_method(_MD("put_data","data"),&StreamPeer::_put_data); + ClassDB::bind_method(_MD("put_partial_data","data"),&StreamPeer::_put_partial_data); + + ClassDB::bind_method(_MD("get_data","bytes"),&StreamPeer::_get_data); + ClassDB::bind_method(_MD("get_partial_data","bytes"),&StreamPeer::_get_partial_data); + + ClassDB::bind_method(_MD("get_available_bytes"),&StreamPeer::get_available_bytes); + + ClassDB::bind_method(_MD("set_big_endian","enable"),&StreamPeer::set_big_endian); + ClassDB::bind_method(_MD("is_big_endian_enabled"),&StreamPeer::is_big_endian_enabled); + + ClassDB::bind_method(_MD("put_8","val"),&StreamPeer::put_8); + ClassDB::bind_method(_MD("put_u8","val"),&StreamPeer::put_u8); + ClassDB::bind_method(_MD("put_16","val"),&StreamPeer::put_16); + ClassDB::bind_method(_MD("put_u16","val"),&StreamPeer::put_u16); + ClassDB::bind_method(_MD("put_32","val"),&StreamPeer::put_32); + ClassDB::bind_method(_MD("put_u32","val"),&StreamPeer::put_u32); + ClassDB::bind_method(_MD("put_64","val"),&StreamPeer::put_64); + ClassDB::bind_method(_MD("put_u64","val"),&StreamPeer::put_u64); + ClassDB::bind_method(_MD("put_float","val"),&StreamPeer::put_float); + ClassDB::bind_method(_MD("put_double","val"),&StreamPeer::put_double); + ClassDB::bind_method(_MD("put_utf8_string","val"),&StreamPeer::put_utf8_string); + ClassDB::bind_method(_MD("put_var","val:Variant"),&StreamPeer::put_var); + + ClassDB::bind_method(_MD("get_8"),&StreamPeer::get_8); + ClassDB::bind_method(_MD("get_u8"),&StreamPeer::get_u8); + ClassDB::bind_method(_MD("get_16"),&StreamPeer::get_16); + ClassDB::bind_method(_MD("get_u16"),&StreamPeer::get_u16); + ClassDB::bind_method(_MD("get_32"),&StreamPeer::get_32); + ClassDB::bind_method(_MD("get_u32"),&StreamPeer::get_u32); + ClassDB::bind_method(_MD("get_64"),&StreamPeer::get_64); + ClassDB::bind_method(_MD("get_u64"),&StreamPeer::get_u64); + ClassDB::bind_method(_MD("get_float"),&StreamPeer::get_float); + ClassDB::bind_method(_MD("get_double"),&StreamPeer::get_double); + ClassDB::bind_method(_MD("get_string","bytes"),&StreamPeer::get_string); + ClassDB::bind_method(_MD("get_utf8_string","bytes"),&StreamPeer::get_utf8_string); + ClassDB::bind_method(_MD("get_var:Variant"),&StreamPeer::get_var); } //////////////////////////////// void StreamPeerBuffer::_bind_methods() { - ObjectTypeDB::bind_method(_MD("seek","pos"),&StreamPeerBuffer::seek); - ObjectTypeDB::bind_method(_MD("get_size"),&StreamPeerBuffer::get_size); - ObjectTypeDB::bind_method(_MD("get_pos"),&StreamPeerBuffer::get_pos); - ObjectTypeDB::bind_method(_MD("resize","size"),&StreamPeerBuffer::resize); - ObjectTypeDB::bind_method(_MD("set_data_array","data"),&StreamPeerBuffer::set_data_array); - ObjectTypeDB::bind_method(_MD("get_data_array"),&StreamPeerBuffer::get_data_array); - ObjectTypeDB::bind_method(_MD("clear"),&StreamPeerBuffer::clear); - ObjectTypeDB::bind_method(_MD("duplicate:StreamPeerBuffer"),&StreamPeerBuffer::duplicate); + ClassDB::bind_method(_MD("seek","pos"),&StreamPeerBuffer::seek); + ClassDB::bind_method(_MD("get_size"),&StreamPeerBuffer::get_size); + ClassDB::bind_method(_MD("get_pos"),&StreamPeerBuffer::get_pos); + ClassDB::bind_method(_MD("resize","size"),&StreamPeerBuffer::resize); + ClassDB::bind_method(_MD("set_data_array","data"),&StreamPeerBuffer::set_data_array); + ClassDB::bind_method(_MD("get_data_array"),&StreamPeerBuffer::get_data_array); + ClassDB::bind_method(_MD("clear"),&StreamPeerBuffer::clear); + ClassDB::bind_method(_MD("duplicate:StreamPeerBuffer"),&StreamPeerBuffer::duplicate); } diff --git a/core/io/stream_peer.h b/core/io/stream_peer.h index 1c415ed5a9..232a908dd7 100644 --- a/core/io/stream_peer.h +++ b/core/io/stream_peer.h @@ -32,7 +32,7 @@ #include "reference.h" class StreamPeer : public Reference { - OBJ_TYPE( StreamPeer, Reference ); + GDCLASS( StreamPeer, Reference ); OBJ_CATEGORY("Networking"); protected: static void _bind_methods(); @@ -94,7 +94,7 @@ public: class StreamPeerBuffer : public StreamPeer { - OBJ_TYPE(StreamPeerBuffer,StreamPeer); + GDCLASS(StreamPeerBuffer,StreamPeer); DVector<uint8_t> data; int pointer; diff --git a/core/io/stream_peer_ssl.cpp b/core/io/stream_peer_ssl.cpp index a936791561..639d848110 100644 --- a/core/io/stream_peer_ssl.cpp +++ b/core/io/stream_peer_ssl.cpp @@ -57,10 +57,10 @@ bool StreamPeerSSL::is_available() { void StreamPeerSSL::_bind_methods() { - ObjectTypeDB::bind_method(_MD("accept:Error","stream:StreamPeer"),&StreamPeerSSL::accept); - ObjectTypeDB::bind_method(_MD("connect:Error","stream:StreamPeer","validate_certs","for_hostname"),&StreamPeerSSL::connect,DEFVAL(false),DEFVAL(String())); - ObjectTypeDB::bind_method(_MD("get_status"),&StreamPeerSSL::get_status); - ObjectTypeDB::bind_method(_MD("disconnect"),&StreamPeerSSL::disconnect); + ClassDB::bind_method(_MD("accept:Error","stream:StreamPeer"),&StreamPeerSSL::accept); + ClassDB::bind_method(_MD("connect:Error","stream:StreamPeer","validate_certs","for_hostname"),&StreamPeerSSL::connect,DEFVAL(false),DEFVAL(String())); + ClassDB::bind_method(_MD("get_status"),&StreamPeerSSL::get_status); + ClassDB::bind_method(_MD("disconnect"),&StreamPeerSSL::disconnect); BIND_CONSTANT( STATUS_DISCONNECTED ); BIND_CONSTANT( STATUS_CONNECTED ); BIND_CONSTANT( STATUS_ERROR_NO_CERTIFICATE ); diff --git a/core/io/stream_peer_ssl.h b/core/io/stream_peer_ssl.h index 2e9ba52644..b36534fcfa 100644 --- a/core/io/stream_peer_ssl.h +++ b/core/io/stream_peer_ssl.h @@ -32,7 +32,7 @@ #include "io/stream_peer.h" class StreamPeerSSL : public StreamPeer { - OBJ_TYPE(StreamPeerSSL,StreamPeer); + GDCLASS(StreamPeerSSL,StreamPeer); public: typedef void (*LoadCertsFromMemory)(const ByteArray& p_certs); diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp index 52cc11a4a4..2218057cf7 100644 --- a/core/io/stream_peer_tcp.cpp +++ b/core/io/stream_peer_tcp.cpp @@ -52,13 +52,13 @@ void StreamPeerTCP::set_ip_type(IP::Type p_type) { void StreamPeerTCP::_bind_methods() { - ObjectTypeDB::bind_method(_MD("set_ip_type","ip_type"),&StreamPeerTCP::set_ip_type); - ObjectTypeDB::bind_method(_MD("connect","host","port"),&StreamPeerTCP::_connect); - ObjectTypeDB::bind_method(_MD("is_connected"),&StreamPeerTCP::is_connected); - ObjectTypeDB::bind_method(_MD("get_status"),&StreamPeerTCP::get_status); - ObjectTypeDB::bind_method(_MD("get_connected_host"),&StreamPeerTCP::get_connected_host); - ObjectTypeDB::bind_method(_MD("get_connected_port"),&StreamPeerTCP::get_connected_port); - ObjectTypeDB::bind_method(_MD("disconnect"),&StreamPeerTCP::disconnect); + ClassDB::bind_method(_MD("set_ip_type","ip_type"),&StreamPeerTCP::set_ip_type); + ClassDB::bind_method(_MD("connect","host","port"),&StreamPeerTCP::_connect); + ClassDB::bind_method(_MD("is_connected"),&StreamPeerTCP::is_connected); + ClassDB::bind_method(_MD("get_status"),&StreamPeerTCP::get_status); + ClassDB::bind_method(_MD("get_connected_host"),&StreamPeerTCP::get_connected_host); + ClassDB::bind_method(_MD("get_connected_port"),&StreamPeerTCP::get_connected_port); + ClassDB::bind_method(_MD("disconnect"),&StreamPeerTCP::disconnect); BIND_CONSTANT( STATUS_NONE ); BIND_CONSTANT( STATUS_CONNECTING ); diff --git a/core/io/stream_peer_tcp.h b/core/io/stream_peer_tcp.h index abc5947fff..8f6dfaf3f8 100644 --- a/core/io/stream_peer_tcp.h +++ b/core/io/stream_peer_tcp.h @@ -36,7 +36,7 @@ class StreamPeerTCP : public StreamPeer { - OBJ_TYPE( StreamPeerTCP, StreamPeer ); + GDCLASS( StreamPeerTCP, StreamPeer ); OBJ_CATEGORY("Networking"); public: diff --git a/core/io/tcp_server.cpp b/core/io/tcp_server.cpp index 431b17321b..751dfbadca 100644 --- a/core/io/tcp_server.cpp +++ b/core/io/tcp_server.cpp @@ -61,11 +61,11 @@ void TCP_Server::set_ip_type(IP::Type p_type) { void TCP_Server::_bind_methods() { - ObjectTypeDB::bind_method(_MD("set_ip_type","ip_type"),&TCP_Server::set_ip_type); - ObjectTypeDB::bind_method(_MD("listen","port","accepted_hosts"),&TCP_Server::_listen,DEFVAL(DVector<String>())); - ObjectTypeDB::bind_method(_MD("is_connection_available"),&TCP_Server::is_connection_available); - ObjectTypeDB::bind_method(_MD("take_connection"),&TCP_Server::take_connection); - ObjectTypeDB::bind_method(_MD("stop"),&TCP_Server::stop); + ClassDB::bind_method(_MD("set_ip_type","ip_type"),&TCP_Server::set_ip_type); + ClassDB::bind_method(_MD("listen","port","accepted_hosts"),&TCP_Server::_listen,DEFVAL(DVector<String>())); + ClassDB::bind_method(_MD("is_connection_available"),&TCP_Server::is_connection_available); + ClassDB::bind_method(_MD("take_connection"),&TCP_Server::take_connection); + ClassDB::bind_method(_MD("stop"),&TCP_Server::stop); } diff --git a/core/io/tcp_server.h b/core/io/tcp_server.h index 14153a3324..5fd65575f6 100644 --- a/core/io/tcp_server.h +++ b/core/io/tcp_server.h @@ -35,7 +35,7 @@ class TCP_Server : public Reference { - OBJ_TYPE( TCP_Server, Reference ); + GDCLASS( TCP_Server, Reference ); protected: IP::Type ip_type; diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp index 9e194d1053..0322f23056 100644 --- a/core/io/xml_parser.cpp +++ b/core/io/xml_parser.cpp @@ -379,23 +379,23 @@ Error XMLParser::seek(uint64_t p_pos) { void XMLParser::_bind_methods() { - ObjectTypeDB::bind_method(_MD("read"),&XMLParser::read); - ObjectTypeDB::bind_method(_MD("get_node_type"),&XMLParser::get_node_type); - ObjectTypeDB::bind_method(_MD("get_node_name"),&XMLParser::get_node_name); - ObjectTypeDB::bind_method(_MD("get_node_data"),&XMLParser::get_node_data); - ObjectTypeDB::bind_method(_MD("get_node_offset"),&XMLParser::get_node_offset); - ObjectTypeDB::bind_method(_MD("get_attribute_count"),&XMLParser::get_attribute_count); - ObjectTypeDB::bind_method(_MD("get_attribute_name","idx"),&XMLParser::get_attribute_name); - ObjectTypeDB::bind_method(_MD("get_attribute_value","idx"),(String (XMLParser::*)(int) const) &XMLParser::get_attribute_value); - ObjectTypeDB::bind_method(_MD("has_attribute","name"),&XMLParser::has_attribute); - ObjectTypeDB::bind_method(_MD("get_named_attribute_value","name"), (String (XMLParser::*)(const String&) const) &XMLParser::get_attribute_value); - ObjectTypeDB::bind_method(_MD("get_named_attribute_value_safe","name"), &XMLParser::get_attribute_value_safe); - ObjectTypeDB::bind_method(_MD("is_empty"),&XMLParser::is_empty); - ObjectTypeDB::bind_method(_MD("get_current_line"),&XMLParser::get_current_line); - ObjectTypeDB::bind_method(_MD("skip_section"),&XMLParser::skip_section); - ObjectTypeDB::bind_method(_MD("seek","pos"),&XMLParser::seek); - ObjectTypeDB::bind_method(_MD("open","file"),&XMLParser::open); - ObjectTypeDB::bind_method(_MD("open_buffer","buffer"),&XMLParser::open_buffer); + ClassDB::bind_method(_MD("read"),&XMLParser::read); + ClassDB::bind_method(_MD("get_node_type"),&XMLParser::get_node_type); + ClassDB::bind_method(_MD("get_node_name"),&XMLParser::get_node_name); + ClassDB::bind_method(_MD("get_node_data"),&XMLParser::get_node_data); + ClassDB::bind_method(_MD("get_node_offset"),&XMLParser::get_node_offset); + ClassDB::bind_method(_MD("get_attribute_count"),&XMLParser::get_attribute_count); + ClassDB::bind_method(_MD("get_attribute_name","idx"),&XMLParser::get_attribute_name); + ClassDB::bind_method(_MD("get_attribute_value","idx"),(String (XMLParser::*)(int) const) &XMLParser::get_attribute_value); + ClassDB::bind_method(_MD("has_attribute","name"),&XMLParser::has_attribute); + ClassDB::bind_method(_MD("get_named_attribute_value","name"), (String (XMLParser::*)(const String&) const) &XMLParser::get_attribute_value); + ClassDB::bind_method(_MD("get_named_attribute_value_safe","name"), &XMLParser::get_attribute_value_safe); + ClassDB::bind_method(_MD("is_empty"),&XMLParser::is_empty); + ClassDB::bind_method(_MD("get_current_line"),&XMLParser::get_current_line); + ClassDB::bind_method(_MD("skip_section"),&XMLParser::skip_section); + ClassDB::bind_method(_MD("seek","pos"),&XMLParser::seek); + ClassDB::bind_method(_MD("open","file"),&XMLParser::open); + ClassDB::bind_method(_MD("open_buffer","buffer"),&XMLParser::open_buffer); BIND_CONSTANT( NODE_NONE ); BIND_CONSTANT( NODE_ELEMENT ); diff --git a/core/io/xml_parser.h b/core/io/xml_parser.h index e1f059bf8c..7f80751156 100644 --- a/core/io/xml_parser.h +++ b/core/io/xml_parser.h @@ -40,7 +40,7 @@ class XMLParser : public Reference { - OBJ_TYPE( XMLParser, Reference ); + GDCLASS( XMLParser, Reference ); public: //! Enumeration of all supported source text file formats enum SourceFormat { diff --git a/core/make_binders.py b/core/make_binders.py index ef71c4264b..74b5e9fda3 100644 --- a/core/make_binders.py +++ b/core/make_binders.py @@ -17,8 +17,8 @@ public: return Variant::NIL; } #endif - virtual String get_instance_type() const { - return T::get_type_static(); + virtual String get_instance_class() const { + return T::get_class_static(); } virtual Variant call(Object* p_object,const Variant** p_args,int p_arg_count, Variant::CallError& r_error) { @@ -97,7 +97,7 @@ public: return Variant::NIL; } #endif - virtual String get_instance_type() const { + virtual String get_instance_class() const { return type_name; } @@ -159,7 +159,7 @@ MethodBind* create_method_bind($ifret R$ $ifnoret void$ (T::*p_method)($arg, P@$ } u; u.sm=p_method; a->method=u.dm; - a->type_name=T::get_type_static(); + a->type_name=T::get_class_static(); return a; } #endif diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp index 0b45577b58..29f61834b4 100644 --- a/core/math/a_star.cpp +++ b/core/math/a_star.cpp @@ -407,23 +407,23 @@ DVector<int> AStar::get_id_path(int p_from_id, int p_to_id) { void AStar::_bind_methods() { - ObjectTypeDB::bind_method(_MD("get_available_point_id"),&AStar::get_available_point_id); - ObjectTypeDB::bind_method(_MD("add_point","id","pos","weight_scale"),&AStar::add_point,DEFVAL(1.0)); - ObjectTypeDB::bind_method(_MD("get_point_pos","id"),&AStar::get_point_pos); - ObjectTypeDB::bind_method(_MD("get_point_weight_scale","id"),&AStar::get_point_weight_scale); - ObjectTypeDB::bind_method(_MD("remove_point","id"),&AStar::remove_point); + ClassDB::bind_method(_MD("get_available_point_id"),&AStar::get_available_point_id); + ClassDB::bind_method(_MD("add_point","id","pos","weight_scale"),&AStar::add_point,DEFVAL(1.0)); + ClassDB::bind_method(_MD("get_point_pos","id"),&AStar::get_point_pos); + ClassDB::bind_method(_MD("get_point_weight_scale","id"),&AStar::get_point_weight_scale); + ClassDB::bind_method(_MD("remove_point","id"),&AStar::remove_point); - ObjectTypeDB::bind_method(_MD("connect_points","id","to_id"),&AStar::connect_points); - ObjectTypeDB::bind_method(_MD("disconnect_points","id","to_id"),&AStar::disconnect_points); - ObjectTypeDB::bind_method(_MD("are_points_connected","id","to_id"),&AStar::are_points_connected); + ClassDB::bind_method(_MD("connect_points","id","to_id"),&AStar::connect_points); + ClassDB::bind_method(_MD("disconnect_points","id","to_id"),&AStar::disconnect_points); + ClassDB::bind_method(_MD("are_points_connected","id","to_id"),&AStar::are_points_connected); - ObjectTypeDB::bind_method(_MD("clear"),&AStar::clear); + ClassDB::bind_method(_MD("clear"),&AStar::clear); - ObjectTypeDB::bind_method(_MD("get_closest_point","to_pos"),&AStar::get_closest_point); - ObjectTypeDB::bind_method(_MD("get_closest_pos_in_segment","to_pos"),&AStar::get_closest_pos_in_segment); + ClassDB::bind_method(_MD("get_closest_point","to_pos"),&AStar::get_closest_point); + ClassDB::bind_method(_MD("get_closest_pos_in_segment","to_pos"),&AStar::get_closest_pos_in_segment); - ObjectTypeDB::bind_method(_MD("get_point_path","from_id","to_id"),&AStar::get_point_path); - ObjectTypeDB::bind_method(_MD("get_id_path","from_id","to_id"),&AStar::get_id_path); + ClassDB::bind_method(_MD("get_point_path","from_id","to_id"),&AStar::get_point_path); + ClassDB::bind_method(_MD("get_id_path","from_id","to_id"),&AStar::get_id_path); } diff --git a/core/math/a_star.h b/core/math/a_star.h index f9ffc477fc..66a983a6ce 100644 --- a/core/math/a_star.h +++ b/core/math/a_star.h @@ -37,7 +37,7 @@ class AStar: public Reference { - OBJ_TYPE(AStar,Reference) + GDCLASS(AStar,Reference) uint64_t pass; diff --git a/core/math/triangle_mesh.h b/core/math/triangle_mesh.h index a310f7e32b..d42f9c8dde 100644 --- a/core/math/triangle_mesh.h +++ b/core/math/triangle_mesh.h @@ -33,7 +33,7 @@ #include "face3.h" class TriangleMesh : public Reference { - OBJ_TYPE( TriangleMesh, Reference); + GDCLASS( TriangleMesh, Reference); struct Triangle { diff --git a/core/message_queue.cpp b/core/message_queue.cpp index d17321f026..11fe2337f6 100644 --- a/core/message_queue.cpp +++ b/core/message_queue.cpp @@ -45,7 +45,7 @@ Error MessageQueue::push_call(ObjectID p_id,const StringName& p_method,const Var if ((buffer_end+room_needed) >= buffer_size) { String type; if (ObjectDB::get_instance(p_id)) - type=ObjectDB::get_instance(p_id)->get_type(); + type=ObjectDB::get_instance(p_id)->get_class(); print_line("failed method: "+type+":"+p_method+" target ID: "+itos(p_id)); statistics(); @@ -98,7 +98,7 @@ Error MessageQueue::push_set(ObjectID p_id, const StringName& p_prop, const Vari if ((buffer_end+room_needed) >= buffer_size) { String type; if (ObjectDB::get_instance(p_id)) - type=ObjectDB::get_instance(p_id)->get_type(); + type=ObjectDB::get_instance(p_id)->get_class(); print_line("failed set: "+type+":"+p_prop+" target ID: "+itos(p_id)); statistics(); @@ -133,7 +133,7 @@ Error MessageQueue::push_notification(ObjectID p_id, int p_notification) { if ((buffer_end+room_needed) >= buffer_size) { String type; if (ObjectDB::get_instance(p_id)) - type=ObjectDB::get_instance(p_id)->get_type(); + type=ObjectDB::get_instance(p_id)->get_class(); print_line("failed notification: "+itos(p_notification)+" target ID: "+itos(p_id)); statistics(); diff --git a/core/method_bind.h b/core/method_bind.h index 168b2e72a1..7b59e6a6b0 100644 --- a/core/method_bind.h +++ b/core/method_bind.h @@ -231,7 +231,7 @@ public: #endif void set_hint_flags(uint32_t p_hint) { hint_flags=p_hint; } uint32_t get_hint_flags() const { return hint_flags|(is_const()?METHOD_FLAG_CONST:0)|(is_vararg()?METHOD_FLAG_VARARG:0); } - virtual String get_instance_type() const=0; + virtual String get_instance_class() const=0; _FORCE_INLINE_ int get_argument_count() const { return argument_count; }; @@ -328,7 +328,7 @@ public: void set_method(NativeCall p_method) { call_method=p_method; } virtual bool is_const() const { return false; } - virtual String get_instance_type() const { return T::get_type_static(); } + virtual String get_instance_class() const { return T::get_class_static(); } virtual bool is_vararg() const { return true; } diff --git a/core/object.cpp b/core/object.cpp index a755a3abb1..82377013e1 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -341,15 +341,15 @@ bool Object::_predelete() { _predelete_ok=1; notification(NOTIFICATION_PREDELETE,true); if (_predelete_ok) { - _type_ptr=NULL; //must restore so destructors can access type ptr correctly + _class_ptr=NULL; //must restore so destructors can access class ptr correctly } return _predelete_ok; } void Object::_postinitialize() { - _type_ptr=_get_type_namev(); - _initialize_typev(); + _class_ptr=_get_class_namev(); + _initialize_classv(); notification(NOTIFICATION_POSTINITIALIZE); } @@ -373,7 +373,7 @@ void Object::set(const String& p_name, const Variant& p_value) { // return; bool success; - ObjectTypeDB::set_property(this,p_name,p_value,success); + ClassDB::set_property(this,p_name,p_value,success); if (success) { return; } @@ -409,7 +409,7 @@ void Object::set(const StringName& p_name, const Variant& p_value, bool *r_valid //try built-in setgetter { - if (ObjectTypeDB::set_property(this,p_name,p_value,r_valid)) { + if (ClassDB::set_property(this,p_name,p_value,r_valid)) { //if (r_valid) // *r_valid=true; return; @@ -460,7 +460,7 @@ Variant Object::get(const StringName& p_name, bool *r_valid) const{ //try built-in setgetter { - if (ObjectTypeDB::get_property(const_cast<Object*>(this),p_name,ret)) { + if (ClassDB::get_property(const_cast<Object*>(this),p_name,ret)) { if (r_valid) *r_valid=true; return ret; @@ -504,7 +504,7 @@ Variant Object::get(const String& p_name) const { return ret; bool success; - ObjectTypeDB::get_property(const_cast<Object*>(this),p_name,ret,success); + ClassDB::get_property(const_cast<Object*>(this),p_name,ret,success); if (success) { return ret; } @@ -535,7 +535,7 @@ void Object::get_property_list(List<PropertyInfo> *p_list,bool p_reversed) const if (!_use_builtin_script()) return; - if (!is_type("Script")) // can still be set, but this is for userfriendlyness + if (!is_class("Script")) // can still be set, but this is for userfriendlyness p_list->push_back( PropertyInfo( Variant::OBJECT, "script/script", PROPERTY_HINT_RESOURCE_TYPE, "Script",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_STORE_IF_NONZERO)); if (!metadata.empty()) p_list->push_back( PropertyInfo( Variant::DICTIONARY, "__meta__", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR|PROPERTY_USAGE_STORE_IF_NONZERO)); @@ -552,7 +552,7 @@ void Object::_validate_property(PropertyInfo& property) const { void Object::get_method_list(List<MethodInfo> *p_list) const { - ObjectTypeDB::get_method_list(get_type_name(),p_list); + ClassDB::get_method_list(get_class_name(),p_list); if (script_instance) { script_instance->get_method_list(p_list); } @@ -697,7 +697,7 @@ void Object::call_multilevel(const StringName& p_method,const Variant** p_args,i } - MethodBind *method=ObjectTypeDB::get_method(get_type_name(),p_method); + MethodBind *method=ClassDB::get_method(get_class_name(),p_method); if (method) { @@ -710,7 +710,7 @@ void Object::call_multilevel(const StringName& p_method,const Variant** p_args,i void Object::call_multilevel_reversed(const StringName& p_method,const Variant** p_args,int p_argcount) { - MethodBind *method=ObjectTypeDB::get_method(get_type_name(),p_method); + MethodBind *method=ClassDB::get_method(get_class_name(),p_method); Variant::CallError error; OBJ_DEBUG_LOCK @@ -744,7 +744,7 @@ bool Object::has_method(const StringName& p_method) const { return true; } - MethodBind *method=ObjectTypeDB::get_method(get_type_name(),p_method); + MethodBind *method=ClassDB::get_method(get_class_name(),p_method); if (method) { return true; @@ -821,7 +821,7 @@ Variant Object::call(const StringName& p_name, VARIANT_ARG_DECLARE) { return ret; } - MethodBind *method=ObjectTypeDB::get_method(get_type_name(),p_name); + MethodBind *method=ClassDB::get_method(get_type_name(),p_name); if (method) { @@ -888,7 +888,7 @@ void Object::call_multilevel(const StringName& p_name, VARIANT_ARG_DECLARE) { } - MethodBind *method=ObjectTypeDB::get_method(get_type_name(),p_name); + MethodBind *method=ClassDB::get_method(get_type_name(),p_name); if (method) { @@ -971,7 +971,7 @@ Variant Object::call(const StringName& p_method,const Variant** p_args,int p_arg } } - MethodBind *method=ObjectTypeDB::get_method(get_type_name(),p_method); + MethodBind *method=ClassDB::get_method(get_class_name(),p_method); if (method) { @@ -1138,7 +1138,7 @@ void Object::get_meta_list(List<String> *p_list) const { void Object::add_user_signal(const MethodInfo& p_signal) { ERR_FAIL_COND(p_signal.name==""); - ERR_FAIL_COND( ObjectTypeDB::has_signal(get_type_name(),p_signal.name ) ); + ERR_FAIL_COND( ClassDB::has_signal(get_class_name(),p_signal.name ) ); ERR_FAIL_COND(signal_map.has(p_signal.name)); Signal s; s.user=p_signal; @@ -1216,7 +1216,7 @@ void Object::emit_signal(const StringName& p_name,const Variant** p_args,int p_a Signal *s = signal_map.getptr(p_name); if (!s) { #ifdef DEBUG_ENABLED - bool signal_is_valid = ObjectTypeDB::has_signal(get_type_name(),p_name); + bool signal_is_valid = ClassDB::has_signal(get_class_name(),p_name); //check in script if (!signal_is_valid && !script.is_null() && !Ref<Script>(script)->has_script_signal(p_name)) { ERR_EXPLAIN("Can't emit non-existing signal " + String("\"")+p_name+"\"."); @@ -1281,7 +1281,7 @@ void Object::emit_signal(const StringName& p_name,const Variant** p_args,int p_a target->call( c.method, args, argc,ce ); if (ce.error!=Variant::CallError::CALL_OK) { - if (ce.error==Variant::CallError::CALL_ERROR_INVALID_METHOD && !ObjectTypeDB::type_exists( target->get_type_name() ) ) { + if (ce.error==Variant::CallError::CALL_ERROR_INVALID_METHOD && !ClassDB::class_exists( target->get_class_name() ) ) { //most likely object is not initialized yet, do not throw error. } else { ERR_PRINTS("Error calling method from signal '"+String(p_name)+"': "+Variant::get_call_error_text(target,c.method,args,argc,ce)); @@ -1415,7 +1415,7 @@ void Object::get_signal_list(List<MethodInfo> *p_signals ) const { Ref<Script>(script)->get_script_signal_list(p_signals); } - ObjectTypeDB::get_signal_list(get_type_name(),p_signals); + ClassDB::get_signal_list(get_class_name(),p_signals); //find maybe usersignals? const StringName *S=NULL; @@ -1489,13 +1489,13 @@ Error Object::connect(const StringName& p_signal, Object *p_to_object, const Str Signal *s = signal_map.getptr(p_signal); if (!s) { - bool signal_is_valid = ObjectTypeDB::has_signal(get_type_name(),p_signal); + bool signal_is_valid = ClassDB::has_signal(get_class_name(),p_signal); //check in script if (!signal_is_valid && !script.is_null() && Ref<Script>(script)->has_script_signal(p_signal)) signal_is_valid=true; if (!signal_is_valid) { - ERR_EXPLAIN("In Object of type '"+String(get_type())+"': Attempt to connect nonexistent signal '"+p_signal+"' to method '"+p_to_object->get_type()+"."+p_to_method+"'"); + ERR_EXPLAIN("In Object of type '"+String(get_class())+"': Attempt to connect nonexistent signal '"+p_signal+"' to method '"+p_to_object->get_class()+"."+p_to_method+"'"); ERR_FAIL_COND_V(!signal_is_valid,ERR_INVALID_PARAMETER); } signal_map[p_signal]=Signal(); @@ -1529,7 +1529,7 @@ bool Object::is_connected(const StringName& p_signal, Object *p_to_object, const ERR_FAIL_NULL_V(p_to_object,false); const Signal *s = signal_map.getptr(p_signal); if (!s) { - bool signal_is_valid = ObjectTypeDB::has_signal(get_type_name(),p_signal); + bool signal_is_valid = ClassDB::has_signal(get_class_name(),p_signal); if (signal_is_valid) return false; @@ -1571,7 +1571,7 @@ void Object::disconnect(const StringName& p_signal, Object *p_to_object, const S p_to_object->connections.erase(s->slot_map[target].cE); s->slot_map.erase(target); - if (s->slot_map.empty() && ObjectTypeDB::has_signal(get_type_name(),p_signal )) { + if (s->slot_map.empty() && ClassDB::has_signal(get_class_name(),p_signal )) { //not user signal, delete signal_map.erase(p_signal); } @@ -1588,12 +1588,12 @@ Variant Object::_get_bind(const String& p_name) const { return get(p_name); } -void Object::initialize_type() { +void Object::initialize_class() { static bool initialized=false; if (initialized) return; - ObjectTypeDB::_add_type<Object>(); + ClassDB::_add_class<Object>(); _bind_methods(); initialized=true; } @@ -1672,31 +1672,31 @@ void Object::clear_internal_resource_paths() { void Object::_bind_methods() { - ObjectTypeDB::bind_method(_MD("get_type"),&Object::get_type); - ObjectTypeDB::bind_method(_MD("is_type","type"),&Object::is_type); - ObjectTypeDB::bind_method(_MD("set","property","value"),&Object::_set_bind); - ObjectTypeDB::bind_method(_MD("get","property"),&Object::_get_bind); - ObjectTypeDB::bind_method(_MD("get_property_list"),&Object::_get_property_list_bind); - ObjectTypeDB::bind_method(_MD("get_method_list"),&Object::_get_method_list_bind); - ObjectTypeDB::bind_method(_MD("notification","what","reversed"),&Object::notification,DEFVAL(false)); - ObjectTypeDB::bind_method(_MD("get_instance_ID"),&Object::get_instance_ID); + ClassDB::bind_method(_MD("get_class"),&Object::get_class); + ClassDB::bind_method(_MD("is_class","type"),&Object::is_class); + ClassDB::bind_method(_MD("set","property","value"),&Object::_set_bind); + ClassDB::bind_method(_MD("get","property"),&Object::_get_bind); + ClassDB::bind_method(_MD("get_property_list"),&Object::_get_property_list_bind); + ClassDB::bind_method(_MD("get_method_list"),&Object::_get_method_list_bind); + ClassDB::bind_method(_MD("notification","what","reversed"),&Object::notification,DEFVAL(false)); + ClassDB::bind_method(_MD("get_instance_ID"),&Object::get_instance_ID); - ObjectTypeDB::bind_method(_MD("set_script","script:Script"),&Object::set_script); - ObjectTypeDB::bind_method(_MD("get_script:Script"),&Object::get_script); + ClassDB::bind_method(_MD("set_script","script:Script"),&Object::set_script); + ClassDB::bind_method(_MD("get_script:Script"),&Object::get_script); - ObjectTypeDB::bind_method(_MD("set_meta","name","value"),&Object::set_meta); - ObjectTypeDB::bind_method(_MD("get_meta","name","value"),&Object::get_meta); - ObjectTypeDB::bind_method(_MD("has_meta","name"),&Object::has_meta); - ObjectTypeDB::bind_method(_MD("get_meta_list"),&Object::_get_meta_list_bind); + ClassDB::bind_method(_MD("set_meta","name","value"),&Object::set_meta); + ClassDB::bind_method(_MD("get_meta","name","value"),&Object::get_meta); + ClassDB::bind_method(_MD("has_meta","name"),&Object::has_meta); + ClassDB::bind_method(_MD("get_meta_list"),&Object::_get_meta_list_bind); //todo reimplement this per language so all 5 arguments can be called -// ObjectTypeDB::bind_method(_MD("call","method","arg1","arg2","arg3","arg4"),&Object::_call_bind,DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant())); -// ObjectTypeDB::bind_method(_MD("call_deferred","method","arg1","arg2","arg3","arg4"),&Object::_call_deferred_bind,DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant())); +// ClassDB::bind_method(_MD("call","method","arg1","arg2","arg3","arg4"),&Object::_call_bind,DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant())); +// ClassDB::bind_method(_MD("call_deferred","method","arg1","arg2","arg3","arg4"),&Object::_call_deferred_bind,DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant())); - ObjectTypeDB::bind_method(_MD("add_user_signal","signal","arguments"),&Object::_add_user_signal,DEFVAL(Array())); - ObjectTypeDB::bind_method(_MD("has_user_signal","signal"),&Object::_has_user_signal); -// ObjectTypeDB::bind_method(_MD("emit_signal","signal","arguments"),&Object::_emit_signal,DEFVAL(Array())); + ClassDB::bind_method(_MD("add_user_signal","signal","arguments"),&Object::_add_user_signal,DEFVAL(Array())); + ClassDB::bind_method(_MD("has_user_signal","signal"),&Object::_has_user_signal); +// ClassDB::bind_method(_MD("emit_signal","signal","arguments"),&Object::_emit_signal,DEFVAL(Array())); { @@ -1704,7 +1704,7 @@ void Object::_bind_methods() { mi.name="emit_signal"; mi.arguments.push_back( PropertyInfo( Variant::STRING, "signal")); - ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"emit_signal",&Object::_emit_signal,mi); + ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"emit_signal",&Object::_emit_signal,mi); } { @@ -1714,7 +1714,7 @@ void Object::_bind_methods() { - ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"call:Variant",&Object::_call_bind,mi); + ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"call:Variant",&Object::_call_bind,mi); } { @@ -1722,32 +1722,32 @@ void Object::_bind_methods() { mi.name="call_deferred"; mi.arguments.push_back( PropertyInfo( Variant::STRING, "method")); - ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"call_deferred",&Object::_call_deferred_bind,mi); + ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"call_deferred",&Object::_call_deferred_bind,mi); } - ObjectTypeDB::bind_method(_MD("callv:Variant","method","arg_array"),&Object::callv); + ClassDB::bind_method(_MD("callv:Variant","method","arg_array"),&Object::callv); - ObjectTypeDB::bind_method(_MD("has_method","method"),&Object::has_method); + ClassDB::bind_method(_MD("has_method","method"),&Object::has_method); - ObjectTypeDB::bind_method(_MD("get_signal_list"),&Object::_get_signal_list); - ObjectTypeDB::bind_method(_MD("get_signal_connection_list","signal"),&Object::_get_signal_connection_list); + ClassDB::bind_method(_MD("get_signal_list"),&Object::_get_signal_list); + ClassDB::bind_method(_MD("get_signal_connection_list","signal"),&Object::_get_signal_connection_list); - ObjectTypeDB::bind_method(_MD("connect","signal","target:Object","method","binds","flags"),&Object::connect,DEFVAL(Array()),DEFVAL(0)); - ObjectTypeDB::bind_method(_MD("disconnect","signal","target:Object","method"),&Object::disconnect); - ObjectTypeDB::bind_method(_MD("is_connected","signal","target:Object","method"),&Object::is_connected); + ClassDB::bind_method(_MD("connect","signal","target:Object","method","binds","flags"),&Object::connect,DEFVAL(Array()),DEFVAL(0)); + ClassDB::bind_method(_MD("disconnect","signal","target:Object","method"),&Object::disconnect); + ClassDB::bind_method(_MD("is_connected","signal","target:Object","method"),&Object::is_connected); - ObjectTypeDB::bind_method(_MD("set_block_signals","enable"),&Object::set_block_signals); - ObjectTypeDB::bind_method(_MD("is_blocking_signals"),&Object::is_blocking_signals); - ObjectTypeDB::bind_method(_MD("set_message_translation","enable"),&Object::set_message_translation); - ObjectTypeDB::bind_method(_MD("can_translate_messages"),&Object::can_translate_messages); - ObjectTypeDB::bind_method(_MD("property_list_changed_notify"),&Object::property_list_changed_notify); + ClassDB::bind_method(_MD("set_block_signals","enable"),&Object::set_block_signals); + ClassDB::bind_method(_MD("is_blocking_signals"),&Object::is_blocking_signals); + ClassDB::bind_method(_MD("set_message_translation","enable"),&Object::set_message_translation); + ClassDB::bind_method(_MD("can_translate_messages"),&Object::can_translate_messages); + ClassDB::bind_method(_MD("property_list_changed_notify"),&Object::property_list_changed_notify); - ObjectTypeDB::bind_method(_MD("XL_MESSAGE","message"),&Object::XL_MESSAGE); - ObjectTypeDB::bind_method(_MD("tr","message"),&Object::tr); + ClassDB::bind_method(_MD("XL_MESSAGE","message"),&Object::XL_MESSAGE); + ClassDB::bind_method(_MD("tr","message"),&Object::tr); - ObjectTypeDB::bind_method(_MD("is_queued_for_deletion"),&Object::is_queued_for_deletion); + ClassDB::bind_method(_MD("is_queued_for_deletion"),&Object::is_queued_for_deletion); - ObjectTypeDB::add_virtual_method("Object",MethodInfo("free"),false); + ClassDB::add_virtual_method("Object",MethodInfo("free"),false); ADD_SIGNAL( MethodInfo("script_changed")); @@ -1815,7 +1815,7 @@ void Object::get_translatable_strings(List<String> *p_strings) const { Variant::Type Object::get_static_property_type(const StringName& p_property, bool *r_valid) const { bool valid; - Variant::Type t = ObjectTypeDB::get_property_type(get_type_name(),p_property,&valid); + Variant::Type t = ClassDB::get_property_type(get_class_name(),p_property,&valid); if (valid) { if (r_valid) *r_valid=true; @@ -1857,7 +1857,7 @@ uint32_t Object::get_edited_version() const { Object::Object() { - _type_ptr=NULL; + _class_ptr=NULL; _block_signals=false; _predelete_ok=0; _instance_ID=0; @@ -2004,11 +2004,11 @@ void ObjectDB::cleanup() { while((K=instances.next(K))) { String node_name; - if (instances[*K]->is_type("Node")) + if (instances[*K]->is_class("Node")) node_name=" - Node Name: "+String(instances[*K]->call("get_name")); - if (instances[*K]->is_type("Resoucre")) + if (instances[*K]->is_class("Resoucre")) node_name=" - Resource Name: "+String(instances[*K]->call("get_name"))+" Path: "+String(instances[*K]->call("get_path")); - print_line("Leaked Instance: "+String(instances[*K]->get_type())+":"+itos(*K)+node_name); + print_line("Leaked Instance: "+String(instances[*K]->get_class())+":"+itos(*K)+node_name); } } } diff --git a/core/object.h b/core/object.h index 6e2aa9e494..8ed5bcdf25 100644 --- a/core/object.h +++ b/core/object.h @@ -108,13 +108,13 @@ enum PropertyUsageFlags { -#define ADD_SIGNAL( m_signal ) ObjectTypeDB::add_signal( get_type_static(), m_signal ) -#define ADD_PROPERTY( m_property, m_setter, m_getter ) ObjectTypeDB::add_property( get_type_static(), m_property, m_setter, m_getter ) -#define ADD_PROPERTYI( m_property, m_setter, m_getter, m_index ) ObjectTypeDB::add_property( get_type_static(), m_property, m_setter, m_getter, m_index ) -#define ADD_PROPERTYNZ( m_property, m_setter, m_getter ) ObjectTypeDB::add_property( get_type_static(), (m_property).added_usage(PROPERTY_USAGE_STORE_IF_NONZERO), m_setter, m_getter ) -#define ADD_PROPERTYINZ( m_property, m_setter, m_getter, m_index ) ObjectTypeDB::add_property( get_type_static(), (m_property).added_usage(PROPERTY_USAGE_STORE_IF_NONZERO), m_setter, m_getter, m_index ) -#define ADD_PROPERTYNO( m_property, m_setter, m_getter ) ObjectTypeDB::add_property( get_type_static(), (m_property).added_usage(PROPERTY_USAGE_STORE_IF_NONONE), m_setter, m_getter ) -#define ADD_PROPERTYINO( m_property, m_setter, m_getter, m_index ) ObjectTypeDB::add_property( get_type_static(), (m_property).added_usage(PROPERTY_USAGE_STORE_IF_NONONE), m_setter, m_getter, m_index ) +#define ADD_SIGNAL( m_signal ) ClassDB::add_signal( get_class_static(), m_signal ) +#define ADD_PROPERTY( m_property, m_setter, m_getter ) ClassDB::add_property( get_class_static(), m_property, m_setter, m_getter ) +#define ADD_PROPERTYI( m_property, m_setter, m_getter, m_index ) ClassDB::add_property( get_class_static(), m_property, m_setter, m_getter, m_index ) +#define ADD_PROPERTYNZ( m_property, m_setter, m_getter ) ClassDB::add_property( get_class_static(), (m_property).added_usage(PROPERTY_USAGE_STORE_IF_NONZERO), m_setter, m_getter ) +#define ADD_PROPERTYINZ( m_property, m_setter, m_getter, m_index ) ClassDB::add_property( get_class_static(), (m_property).added_usage(PROPERTY_USAGE_STORE_IF_NONZERO), m_setter, m_getter, m_index ) +#define ADD_PROPERTYNO( m_property, m_setter, m_getter ) ClassDB::add_property( get_class_static(), (m_property).added_usage(PROPERTY_USAGE_STORE_IF_NONONE), m_setter, m_getter ) +#define ADD_PROPERTYINO( m_property, m_setter, m_getter, m_index ) ClassDB::add_property( get_class_static(), (m_property).added_usage(PROPERTY_USAGE_STORE_IF_NONONE), m_setter, m_getter, m_index ) struct PropertyInfo { @@ -175,7 +175,7 @@ struct MethodInfo { }; // old cast_to -//if ( is_type(T::get_type_static()) ) +//if ( is_type(T::get_class_static()) ) //return static_cast<T*>(this); ////else //return NULL; @@ -196,33 +196,33 @@ private: -#define OBJ_TYPE( m_type, m_inherits )\ +#define GDCLASS( m_class, m_inherits )\ private:\ - void operator=(const m_type& p_rval) {}\ - mutable StringName _type_name;\ - friend class ObjectTypeDB;\ + void operator=(const m_class& p_rval) {}\ + mutable StringName _class_name;\ + friend class ClassDB;\ public:\ -virtual String get_type() const { \ - return String(#m_type);\ +virtual String get_class() const { \ + return String(#m_class);\ }\ -virtual const StringName* _get_type_namev() const { \ - if (!_type_name)\ - _type_name=get_type_static();\ - return &_type_name;\ +virtual const StringName* _get_class_namev() const { \ + if (!_class_name)\ + _class_name=get_class_static();\ + return &_class_name;\ }\ -static _FORCE_INLINE_ void* get_type_ptr_static() { \ +static _FORCE_INLINE_ void* get_class_ptr_static() { \ static int ptr;\ return &ptr;\ }\ -static _FORCE_INLINE_ String get_type_static() { \ - return String(#m_type);\ +static _FORCE_INLINE_ String get_class_static() { \ + return String(#m_class);\ }\ -static _FORCE_INLINE_ String get_parent_type_static() { \ - return m_inherits::get_type_static();\ +static _FORCE_INLINE_ String get_parent_class_static() { \ + return m_inherits::get_class_static();\ }\ static void get_inheritance_list_static(List<String>* p_inheritance_list) { \ m_inherits::get_inheritance_list_static(p_inheritance_list);\ - p_inheritance_list->push_back(String(#m_type));\ + p_inheritance_list->push_back(String(#m_class));\ }\ static String get_category_static() { \ String category = m_inherits::get_category_static();\ @@ -236,85 +236,85 @@ static String get_category_static() { \ static String inherits_static() {\ return String(#m_inherits);\ }\ -virtual bool is_type(const String& p_type) const { return (p_type==(#m_type))?true:m_inherits::is_type(p_type); }\ -virtual bool is_type_ptr(void *p_ptr) const { return (p_ptr==get_type_ptr_static())?true:m_inherits::is_type_ptr(p_ptr); }\ +virtual bool is_class(const String& p_class) const { return (p_class==(#m_class))?true:m_inherits::is_class(p_class); }\ +virtual bool is_class_ptr(void *p_ptr) const { return (p_ptr==get_class_ptr_static())?true:m_inherits::is_class_ptr(p_ptr); }\ \ \ static void get_valid_parents_static(List<String> *p_parents) {\ \ - if (m_type::_get_valid_parents_static!=m_inherits::_get_valid_parents_static) { \ - m_type::_get_valid_parents_static(p_parents);\ + if (m_class::_get_valid_parents_static!=m_inherits::_get_valid_parents_static) { \ + m_class::_get_valid_parents_static(p_parents);\ }\ \ m_inherits::get_valid_parents_static(p_parents);\ }\ protected:\ _FORCE_INLINE_ static void (*_get_bind_methods())() {\ - return &m_type::_bind_methods;\ + return &m_class::_bind_methods;\ }\ public:\ -static void initialize_type() {\ +static void initialize_class() {\ static bool initialized=false;\ if (initialized)\ return;\ - m_inherits::initialize_type();\ - ObjectTypeDB::_add_type<m_type>();\ - if (m_type::_get_bind_methods() != m_inherits::_get_bind_methods())\ + m_inherits::initialize_class();\ + ClassDB::_add_class<m_class>();\ + if (m_class::_get_bind_methods() != m_inherits::_get_bind_methods())\ _bind_methods();\ initialized=true;\ }\ protected:\ -virtual void _initialize_typev() {\ - initialize_type();\ +virtual void _initialize_classv() {\ + initialize_class();\ }\ _FORCE_INLINE_ bool (Object::* (_get_get() const))(const StringName& p_name,Variant&) const {\ - return (bool (Object::*)(const StringName&,Variant&)const) &m_type::_get;\ + return (bool (Object::*)(const StringName&,Variant&)const) &m_class::_get;\ }\ virtual bool _getv(const StringName& p_name, Variant& r_ret) const { \ - if (m_type::_get_get() != m_inherits::_get_get()) {\ + if (m_class::_get_get() != m_inherits::_get_get()) {\ if (_get(p_name,r_ret))\ return true;\ }\ return m_inherits::_getv(p_name,r_ret);\ }\ _FORCE_INLINE_ bool (Object::* (_get_set() const))(const StringName& p_name,const Variant &p_property) {\ - return (bool (Object::*)(const StringName&, const Variant&))&m_type::_set;\ + return (bool (Object::*)(const StringName&, const Variant&))&m_class::_set;\ }\ virtual bool _setv(const StringName& p_name,const Variant &p_property) { \ if (m_inherits::_setv(p_name,p_property)) return true;\ - if (m_type::_get_set() != m_inherits::_get_set()) {\ + if (m_class::_get_set() != m_inherits::_get_set()) {\ return _set(p_name,p_property);\ \ }\ return false;\ }\ _FORCE_INLINE_ void (Object::* (_get_get_property_list() const))(List<PropertyInfo> *p_list) const{\ - return (void (Object::*)(List<PropertyInfo>*)const)&m_type::_get_property_list;\ + return (void (Object::*)(List<PropertyInfo>*)const)&m_class::_get_property_list;\ }\ virtual void _get_property_listv(List<PropertyInfo> *p_list,bool p_reversed) const { \ if (!p_reversed) {\ m_inherits::_get_property_listv(p_list,p_reversed);\ }\ - p_list->push_back( PropertyInfo(Variant::NIL,get_type_static(),PROPERTY_HINT_NONE,String(),PROPERTY_USAGE_CATEGORY));\ + p_list->push_back( PropertyInfo(Variant::NIL,get_class_static(),PROPERTY_HINT_NONE,String(),PROPERTY_USAGE_CATEGORY));\ if (!_is_gpl_reversed())\ - ObjectTypeDB::get_property_list(#m_type,p_list,true,this);\ - if (m_type::_get_get_property_list() != m_inherits::_get_get_property_list()) {\ + ClassDB::get_property_list(#m_class,p_list,true,this);\ + if (m_class::_get_get_property_list() != m_inherits::_get_get_property_list()) {\ _get_property_list(p_list);\ }\ if (_is_gpl_reversed())\ - ObjectTypeDB::get_property_list(#m_type,p_list,true,this);\ + ClassDB::get_property_list(#m_class,p_list,true,this);\ if (p_reversed) {\ m_inherits::_get_property_listv(p_list,p_reversed);\ }\ \ }\ _FORCE_INLINE_ void (Object::* (_get_notification() const))(int){\ - return (void (Object::*)(int)) &m_type::_notification;\ + return (void (Object::*)(int)) &m_class::_notification;\ }\ virtual void _notificationv(int p_notification,bool p_reversed) { \ if (!p_reversed) \ m_inherits::_notificationv(p_notification,p_reversed);\ - if (m_type::_get_notification() != m_inherits::_get_notification()) {\ + if (m_class::_get_notification() != m_inherits::_get_notification()) {\ _notification(p_notification);\ }\ if (p_reversed)\ @@ -329,9 +329,9 @@ protected:\ _FORCE_INLINE_ static String _get_category() { return m_category; }\ private: -#define OBJ_SAVE_TYPE(m_type) \ +#define OBJ_SAVE_TYPE(m_class) \ public: \ -virtual String get_save_type() const { return #m_type; }\ +virtual String get_save_class() const { return #m_class; }\ private: class ScriptInstance; @@ -415,8 +415,8 @@ friend void postinitialize_handler(Object*); ScriptInstance *script_instance; RefPtr script; Dictionary metadata; - mutable StringName _type_name; - mutable const StringName* _type_ptr; + mutable StringName _class_name; + mutable const StringName* _class_ptr; void _add_user_signal(const String& p_name, const Array& p_pargs=Array()); bool _has_user_signal(const StringName& p_name) const; @@ -431,7 +431,7 @@ friend void postinitialize_handler(Object*); protected: virtual bool _use_builtin_script() const { return false; } - virtual void _initialize_typev() { initialize_type(); } + virtual void _initialize_classv() { initialize_class(); } virtual bool _setv(const StringName& p_name,const Variant &p_property) { return false; }; virtual bool _getv(const StringName& p_name,Variant &r_property) const { return false; }; virtual void _get_property_listv(List<PropertyInfo> *p_list,bool p_reversed) const {}; @@ -474,10 +474,10 @@ protected: Variant _call_deferred_bind(const Variant** p_args, int p_argcount, Variant::CallError& r_error); - virtual const StringName* _get_type_namev() const { - if (!_type_name) - _type_name=get_type_static(); - return &_type_name; + virtual const StringName* _get_class_namev() const { + if (!_class_name) + _class_name=get_class_static(); + return &_class_name; } DVector<String> _get_meta_list_bind() const; @@ -486,11 +486,11 @@ protected: void _clear_internal_resource_paths(const Variant &p_var); -friend class ObjectTypeDB; +friend class ClassDB; virtual void _validate_property(PropertyInfo& property) const; public: //should be protected, but bug in clang++ - static void initialize_type(); + static void initialize_class(); _FORCE_INLINE_ static void register_custom_data_to_otdb() {}; public: @@ -500,7 +500,7 @@ public: #else _FORCE_INLINE_ void _change_notify(const char *p_what="") { } #endif - static void* get_type_ptr_static() { + static void* get_class_ptr_static() { static int ptr; return &ptr; } @@ -521,7 +521,7 @@ public: #else if (!this) return NULL; - if (is_type_ptr(T::get_type_ptr_static())) + if (is_class_ptr(T::get_class_ptr_static())) return static_cast<T*>(this); else return NULL; @@ -536,7 +536,7 @@ public: #else if (!this) return NULL; - if (is_type_ptr(T::get_type_ptr_static())) + if (is_class_ptr(T::get_class_ptr_static())) return static_cast<const T*>(this); else return NULL; @@ -552,24 +552,24 @@ public: /* TYPE API */ static void get_inheritance_list_static(List<String>* p_inheritance_list) { p_inheritance_list->push_back("Object"); } - static String get_type_static() { return "Object"; } - static String get_parent_type_static() { return String(); } + static String get_class_static() { return "Object"; } + static String get_parent_class_static() { return String(); } static String get_category_static() { return String(); } - virtual String get_type() const { return "Object"; } - virtual String get_save_type() const { return get_type(); } //type stored when saving + virtual String get_class() const { return "Object"; } + virtual String get_save_class() const { return get_class(); } //class stored when saving - virtual bool is_type(const String& p_type) const { return (p_type=="Object"); } - virtual bool is_type_ptr(void *p_ptr) const { return get_type_ptr_static()==p_ptr; } + virtual bool is_class(const String& p_class) const { return (p_class=="Object"); } + virtual bool is_class_ptr(void *p_ptr) const { return get_class_ptr_static()==p_ptr; } - _FORCE_INLINE_ const StringName& get_type_name() const { - if (!_type_ptr) { - return *_get_type_namev(); + _FORCE_INLINE_ const StringName& get_class_name() const { + if (!_class_ptr) { + return *_get_class_namev(); } else { - return *_type_ptr; + return *_class_ptr; } } diff --git a/core/object_type_db.cpp b/core/object_type_db.cpp index 0256e391d1..498d222a66 100644 --- a/core/object_type_db.cpp +++ b/core/object_type_db.cpp @@ -190,92 +190,92 @@ MethodDefinition _MD(const char* p_name,const char *p_arg1,const char *p_arg2,co #endif -ObjectTypeDB::APIType ObjectTypeDB::current_api=API_CORE; +ClassDB::APIType ClassDB::current_api=API_CORE; -void ObjectTypeDB::set_current_api(APIType p_api) { +void ClassDB::set_current_api(APIType p_api) { current_api=p_api; } -HashMap<StringName,ObjectTypeDB::TypeInfo,StringNameHasher> ObjectTypeDB::types; -HashMap<StringName,StringName,StringNameHasher> ObjectTypeDB::resource_base_extensions; -HashMap<StringName,StringName,StringNameHasher> ObjectTypeDB::compat_types; +HashMap<StringName,ClassDB::ClassInfo,StringNameHasher> ClassDB::classes; +HashMap<StringName,StringName,StringNameHasher> ClassDB::resource_base_extensions; +HashMap<StringName,StringName,StringNameHasher> ClassDB::compat_classes; -ObjectTypeDB::TypeInfo::TypeInfo() { +ClassDB::ClassInfo::ClassInfo() { creation_func=NULL; inherits_ptr=NULL; disabled=false; } -ObjectTypeDB::TypeInfo::~TypeInfo() { +ClassDB::ClassInfo::~ClassInfo() { } -bool ObjectTypeDB::is_type(const StringName &p_type,const StringName& p_inherits) { +bool ClassDB::is_parent_class(const StringName &p_class,const StringName& p_inherits) { OBJTYPE_LOCK; - StringName inherits=p_type; + StringName inherits=p_class; while (inherits.operator String().length()) { if (inherits==p_inherits) return true; - inherits=type_inherits_from(inherits); + inherits=get_parent_class(inherits); } return false; } -void ObjectTypeDB::get_type_list( List<StringName> *p_types) { +void ClassDB::get_class_list( List<StringName> *p_classes) { OBJTYPE_LOCK; const StringName *k=NULL; - while((k=types.next(k))) { + while((k=classes.next(k))) { - p_types->push_back(*k); + p_classes->push_back(*k); } - p_types->sort(); + p_classes->sort(); } -void ObjectTypeDB::get_inheriters_from( const StringName& p_type,List<StringName> *p_types) { +void ClassDB::get_inheriters_from_class( const StringName& p_class,List<StringName> *p_classes) { OBJTYPE_LOCK; const StringName *k=NULL; - while((k=types.next(k))) { + while((k=classes.next(k))) { - if (*k!=p_type && is_type(*k,p_type)) - p_types->push_back(*k); + if (*k!=p_class && is_parent_class(*k,p_class)) + p_classes->push_back(*k); } } -StringName ObjectTypeDB::type_inherits_from(const StringName& p_type) { +StringName ClassDB::get_parent_class(const StringName& p_class) { OBJTYPE_LOCK; - TypeInfo *ti = types.getptr(p_type); + ClassInfo *ti = classes.getptr(p_class); ERR_FAIL_COND_V(!ti,""); return ti->inherits; } -ObjectTypeDB::APIType ObjectTypeDB::get_api_type(const StringName &p_type) { +ClassDB::APIType ClassDB::get_api_type(const StringName &p_class) { OBJTYPE_LOCK; - TypeInfo *ti = types.getptr(p_type); + ClassInfo *ti = classes.getptr(p_class); ERR_FAIL_COND_V(!ti,API_NONE); return ti->api; } -uint64_t ObjectTypeDB::get_api_hash(APIType p_api) { +uint64_t ClassDB::get_api_hash(APIType p_api) { #ifdef DEBUG_METHODS_ENABLED @@ -285,7 +285,7 @@ uint64_t ObjectTypeDB::get_api_hash(APIType p_api) { const StringName *k=NULL; - while((k=types.next(k))) { + while((k=classes.next(k))) { names.push_back(*k); } @@ -294,7 +294,7 @@ uint64_t ObjectTypeDB::get_api_hash(APIType p_api) { for (List<StringName>::Element *E=names.front();E;E=E->next()) { - TypeInfo *t = types.getptr(E->get()); + ClassInfo *t = classes.getptr(E->get()); ERR_FAIL_COND_V(!t,0); if (t->api!=p_api) continue; @@ -431,26 +431,26 @@ uint64_t ObjectTypeDB::get_api_hash(APIType p_api) { } -bool ObjectTypeDB::type_exists(const StringName &p_type) { +bool ClassDB::class_exists(const StringName &p_class) { OBJTYPE_LOCK; - return types.has(p_type); + return classes.has(p_class); } -void ObjectTypeDB::add_compatibility_type(const StringName& p_type,const StringName& p_fallback) { +void ClassDB::add_compatibility_class(const StringName& p_class,const StringName& p_fallback) { - compat_types[p_type]=p_fallback; + compat_classes[p_class]=p_fallback; } -Object *ObjectTypeDB::instance(const StringName &p_type) { +Object *ClassDB::instance(const StringName &p_class) { - TypeInfo *ti; + ClassInfo *ti; { OBJTYPE_LOCK; - ti=types.getptr(p_type); + ti=classes.getptr(p_class); if (!ti || ti->disabled || !ti->creation_func) { - if (compat_types.has(p_type)) { - ti=types.getptr(compat_types[p_type]); + if (compat_classes.has(p_class)) { + ti=classes.getptr(compat_classes[p_class]); } } ERR_FAIL_COND_V(!ti,NULL); @@ -460,34 +460,34 @@ Object *ObjectTypeDB::instance(const StringName &p_type) { return ti->creation_func(); } -bool ObjectTypeDB::can_instance(const StringName &p_type) { +bool ClassDB::can_instance(const StringName &p_class) { OBJTYPE_LOCK; - TypeInfo *ti = types.getptr(p_type); + ClassInfo *ti = classes.getptr(p_class); ERR_FAIL_COND_V(!ti,false); return (!ti->disabled && ti->creation_func!=NULL); } -void ObjectTypeDB::_add_type2(const StringName& p_type, const StringName& p_inherits) { +void ClassDB::_add_class2(const StringName& p_class, const StringName& p_inherits) { OBJTYPE_LOCK; - StringName name = p_type; + StringName name = p_class; - ERR_FAIL_COND(types.has(name)); + ERR_FAIL_COND(classes.has(name)); - types[name]=TypeInfo(); - TypeInfo &ti=types[name]; + classes[name]=ClassInfo(); + ClassInfo &ti=classes[name]; ti.name=name; ti.inherits=p_inherits; ti.api=current_api; if (ti.inherits) { - ERR_FAIL_COND( !types.has(ti.inherits) ); //it MUST be registered. - ti.inherits_ptr = &types[ti.inherits]; + ERR_FAIL_COND( !classes.has(ti.inherits) ); //it MUST be registered. + ti.inherits_ptr = &classes[ti.inherits]; } else { ti.inherits_ptr=NULL; @@ -496,12 +496,12 @@ void ObjectTypeDB::_add_type2(const StringName& p_type, const StringName& p_inhe } -void ObjectTypeDB::get_method_list(StringName p_type,List<MethodInfo> *p_methods,bool p_no_inheritance) { +void ClassDB::get_method_list(StringName p_class,List<MethodInfo> *p_methods,bool p_no_inheritance) { OBJTYPE_LOCK; - TypeInfo *type=types.getptr(p_type); + ClassInfo *type=classes.getptr(p_class); while(type) { @@ -570,11 +570,11 @@ void ObjectTypeDB::get_method_list(StringName p_type,List<MethodInfo> *p_methods } -MethodBind *ObjectTypeDB::get_method(StringName p_type, StringName p_name) { +MethodBind *ClassDB::get_method(StringName p_class, StringName p_name) { OBJTYPE_LOCK; - TypeInfo *type=types.getptr(p_type); + ClassInfo *type=classes.getptr(p_class); while(type) { @@ -587,11 +587,11 @@ MethodBind *ObjectTypeDB::get_method(StringName p_type, StringName p_name) { } -void ObjectTypeDB::bind_integer_constant(const StringName& p_type, const StringName &p_name, int p_constant) { +void ClassDB::bind_integer_constant(const StringName& p_class, const StringName &p_name, int p_constant) { OBJTYPE_LOCK; - TypeInfo *type=types.getptr(p_type); + ClassInfo *type=classes.getptr(p_class); if (!type) { ERR_FAIL_COND(!type); @@ -609,11 +609,11 @@ void ObjectTypeDB::bind_integer_constant(const StringName& p_type, const StringN } -void ObjectTypeDB::get_integer_constant_list(const StringName& p_type, List<String> *p_constants, bool p_no_inheritance) { +void ClassDB::get_integer_constant_list(const StringName& p_class, List<String> *p_constants, bool p_no_inheritance) { OBJTYPE_LOCK; - TypeInfo *type=types.getptr(p_type); + ClassInfo *type=classes.getptr(p_class); while(type) { @@ -637,12 +637,12 @@ void ObjectTypeDB::get_integer_constant_list(const StringName& p_type, List<Stri } -int ObjectTypeDB::get_integer_constant(const StringName& p_type, const StringName &p_name, bool *p_success) { +int ClassDB::get_integer_constant(const StringName& p_class, const StringName &p_name, bool *p_success) { OBJTYPE_LOCK; - TypeInfo *type=types.getptr(p_type); + ClassInfo *type=classes.getptr(p_class); while(type) { @@ -664,18 +664,18 @@ int ObjectTypeDB::get_integer_constant(const StringName& p_type, const StringNam return 0; } -void ObjectTypeDB::add_signal(StringName p_type,const MethodInfo& p_signal) { +void ClassDB::add_signal(StringName p_class,const MethodInfo& p_signal) { - TypeInfo *type=types.getptr(p_type); + ClassInfo *type=classes.getptr(p_class); ERR_FAIL_COND(!type); - TypeInfo *check=type; + ClassInfo *check=type; StringName sname = p_signal.name; #ifdef DEBUG_METHODS_ENABLED while(check) { if (check->signal_map.has(sname)) { - ERR_EXPLAIN("Type "+String(p_type)+" already has signal: "+String(sname)); + ERR_EXPLAIN("Type "+String(p_class)+" already has signal: "+String(sname)); ERR_FAIL(); } check=check->inherits_ptr; @@ -686,12 +686,12 @@ void ObjectTypeDB::add_signal(StringName p_type,const MethodInfo& p_signal) { } -void ObjectTypeDB::get_signal_list(StringName p_type,List<MethodInfo> *p_signals,bool p_no_inheritance) { +void ClassDB::get_signal_list(StringName p_class,List<MethodInfo> *p_signals,bool p_no_inheritance) { - TypeInfo *type=types.getptr(p_type); + ClassInfo *type=classes.getptr(p_class); ERR_FAIL_COND(!type); - TypeInfo *check=type; + ClassInfo *check=type; while(check) { @@ -710,10 +710,10 @@ void ObjectTypeDB::get_signal_list(StringName p_type,List<MethodInfo> *p_signals } -bool ObjectTypeDB::has_signal(StringName p_type,StringName p_signal) { +bool ClassDB::has_signal(StringName p_class,StringName p_signal) { - TypeInfo *type=types.getptr(p_type); - TypeInfo *check=type; + ClassInfo *type=classes.getptr(p_class); + ClassInfo *check=type; while(check) { if (check->signal_map.has(p_signal)) return true; @@ -723,10 +723,10 @@ bool ObjectTypeDB::has_signal(StringName p_type,StringName p_signal) { return false; } -bool ObjectTypeDB::get_signal(StringName p_type,StringName p_signal,MethodInfo *r_signal) { +bool ClassDB::get_signal(StringName p_class,StringName p_signal,MethodInfo *r_signal) { - TypeInfo *type=types.getptr(p_type); - TypeInfo *check=type; + ClassInfo *type=classes.getptr(p_class); + ClassInfo *check=type; while(check) { if (check->signal_map.has(p_signal)) { if (r_signal) { @@ -740,23 +740,23 @@ bool ObjectTypeDB::get_signal(StringName p_type,StringName p_signal,MethodInfo * return false; } -void ObjectTypeDB::add_property(StringName p_type,const PropertyInfo& p_pinfo, const StringName& p_setter, const StringName& p_getter, int p_index) { +void ClassDB::add_property(StringName p_class,const PropertyInfo& p_pinfo, const StringName& p_setter, const StringName& p_getter, int p_index) { - TypeInfo *type=types.getptr(p_type); + ClassInfo *type=classes.getptr(p_class); ERR_FAIL_COND(!type); MethodBind *mb_set=NULL; if (p_setter) { - mb_set = get_method(p_type,p_setter); + mb_set = get_method(p_class,p_setter); #ifdef DEBUG_METHODS_ENABLED if (!mb_set) { - ERR_EXPLAIN("Invalid Setter: "+p_type+"::"+p_setter+" for property: "+p_pinfo.name); + ERR_EXPLAIN("Invalid Setter: "+p_class+"::"+p_setter+" for property: "+p_pinfo.name); ERR_FAIL_COND(!mb_set); } else { int exp_args=1+(p_index>=0?1:0); if (mb_set->get_argument_count()!=exp_args) { - ERR_EXPLAIN("Invalid Function for Setter: "+p_type+"::"+p_setter+" for property: "+p_pinfo.name); + ERR_EXPLAIN("Invalid Function for Setter: "+p_class+"::"+p_setter+" for property: "+p_pinfo.name); ERR_FAIL(); } @@ -767,17 +767,17 @@ void ObjectTypeDB::add_property(StringName p_type,const PropertyInfo& p_pinfo, c MethodBind *mb_get=NULL; if (p_getter) { - MethodBind *mb_get = get_method(p_type,p_getter); + MethodBind *mb_get = get_method(p_class,p_getter); #ifdef DEBUG_METHODS_ENABLED if (!mb_get) { - ERR_EXPLAIN("Invalid Getter: "+p_type+"::"+p_getter+" for property: "+p_pinfo.name); + ERR_EXPLAIN("Invalid Getter: "+p_class+"::"+p_getter+" for property: "+p_pinfo.name); ERR_FAIL_COND(!mb_get); } else { int exp_args=0+(p_index>=0?1:0); if (mb_get->get_argument_count()!=exp_args) { - ERR_EXPLAIN("Invalid Function for Getter: "+p_type+"::"+p_getter+" for property: "+p_pinfo.name); + ERR_EXPLAIN("Invalid Function for Getter: "+p_class+"::"+p_getter+" for property: "+p_pinfo.name); ERR_FAIL(); } @@ -791,7 +791,7 @@ void ObjectTypeDB::add_property(StringName p_type,const PropertyInfo& p_pinfo, c #ifdef DEBUG_METHODS_ENABLED if (type->property_setget.has(p_pinfo.name)) { - ERR_EXPLAIN("Object already has property: "+p_type); + ERR_EXPLAIN("Object already has property: "+p_class); ERR_FAIL(); } #endif @@ -810,10 +810,10 @@ void ObjectTypeDB::add_property(StringName p_type,const PropertyInfo& p_pinfo, c } -void ObjectTypeDB::get_property_list(StringName p_type, List<PropertyInfo> *p_list, bool p_no_inheritance,const Object *p_validator) { +void ClassDB::get_property_list(StringName p_class, List<PropertyInfo> *p_list, bool p_no_inheritance,const Object *p_validator) { - TypeInfo *type=types.getptr(p_type); - TypeInfo *check=type; + ClassInfo *type=classes.getptr(p_class); + ClassInfo *check=type; while(check) { for(List<PropertyInfo>::Element *E=check->property_list.front();E;E=E->next()) { @@ -834,11 +834,11 @@ void ObjectTypeDB::get_property_list(StringName p_type, List<PropertyInfo> *p_li } } -bool ObjectTypeDB::set_property(Object* p_object,const StringName& p_property, const Variant& p_value,bool *r_valid) { +bool ClassDB::set_property(Object* p_object,const StringName& p_property, const Variant& p_value,bool *r_valid) { - TypeInfo *type=types.getptr(p_object->get_type_name()); - TypeInfo *check=type; + ClassInfo *type=classes.getptr(p_object->get_class_name()); + ClassInfo *check=type; while(check) { const PropertySetGet *psg = check->property_setget.getptr(p_property); if (psg) { @@ -882,10 +882,10 @@ bool ObjectTypeDB::set_property(Object* p_object,const StringName& p_property, c return false; } -bool ObjectTypeDB::get_property(Object* p_object,const StringName& p_property, Variant& r_value) { +bool ClassDB::get_property(Object* p_object,const StringName& p_property, Variant& r_value) { - TypeInfo *type=types.getptr(p_object->get_type_name()); - TypeInfo *check=type; + ClassInfo *type=classes.getptr(p_object->get_class_name()); + ClassInfo *check=type; while(check) { const PropertySetGet *psg = check->property_setget.getptr(p_property); if (psg) { @@ -925,10 +925,10 @@ bool ObjectTypeDB::get_property(Object* p_object,const StringName& p_property, V return false; } -Variant::Type ObjectTypeDB::get_property_type(const StringName& p_type, const StringName& p_property,bool *r_is_valid) { +Variant::Type ClassDB::get_property_type(const StringName& p_class, const StringName& p_property,bool *r_is_valid) { - TypeInfo *type=types.getptr(p_type); - TypeInfo *check=type; + ClassInfo *type=classes.getptr(p_class); + ClassInfo *check=type; while(check) { const PropertySetGet *psg = check->property_setget.getptr(p_property); if (psg) { @@ -949,10 +949,10 @@ Variant::Type ObjectTypeDB::get_property_type(const StringName& p_type, const St } -void ObjectTypeDB::set_method_flags(StringName p_type,StringName p_method,int p_flags) { +void ClassDB::set_method_flags(StringName p_class,StringName p_method,int p_flags) { - TypeInfo *type=types.getptr(p_type); - TypeInfo *check=type; + ClassInfo *type=classes.getptr(p_class); + ClassInfo *check=type; ERR_FAIL_COND(!check); ERR_FAIL_COND(!check->method_map.has(p_method)); check->method_map[p_method]->set_hint_flags(p_flags); @@ -960,10 +960,10 @@ void ObjectTypeDB::set_method_flags(StringName p_type,StringName p_method,int p_ } -bool ObjectTypeDB::has_method(StringName p_type,StringName p_method,bool p_no_inheritance) { +bool ClassDB::has_method(StringName p_class,StringName p_method,bool p_no_inheritance) { - TypeInfo *type=types.getptr(p_type); - TypeInfo *check=type; + ClassInfo *type=classes.getptr(p_class); + ClassInfo *check=type; while(check) { if (check->method_map.has(p_method)) return true; @@ -976,10 +976,10 @@ bool ObjectTypeDB::has_method(StringName p_type,StringName p_method,bool p_no_in } -bool ObjectTypeDB::get_setter_and_type_for_property(const StringName& p_class, const StringName& p_prop, StringName& r_class, StringName& r_setter) { +bool ClassDB::get_setter_and_type_for_property(const StringName& p_class, const StringName& p_prop, StringName& r_class, StringName& r_setter) { - TypeInfo *type=types.getptr(p_class); - TypeInfo *check=type; + ClassInfo *type=classes.getptr(p_class); + ClassInfo *check=type; while(check) { if (check->property_setget.has(p_prop)) { @@ -996,10 +996,10 @@ bool ObjectTypeDB::get_setter_and_type_for_property(const StringName& p_class, c } #ifdef DEBUG_METHODS_ENABLED -MethodBind* ObjectTypeDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind , const MethodDefinition &method_name, const Variant **p_defs, int p_defcount) { +MethodBind* ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind , const MethodDefinition &method_name, const Variant **p_defs, int p_defcount) { StringName mdname=method_name.name; #else -MethodBind* ObjectTypeDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind , const char *method_name, const Variant **p_defs, int p_defcount) { +MethodBind* ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind , const char *method_name, const Variant **p_defs, int p_defcount) { StringName mdname=StaticCString::create(method_name); #endif @@ -1015,9 +1015,9 @@ MethodBind* ObjectTypeDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind , c ERR_FAIL_COND_V(!p_bind,NULL); p_bind->set_name(mdname); - String instance_type=p_bind->get_instance_type(); + String instance_type=p_bind->get_instance_class(); - TypeInfo *type=types.getptr(instance_type); + ClassInfo *type=classes.getptr(instance_type); if (!type) { ERR_PRINTS("Couldn't bind method '"+mdname+"' for instance: "+instance_type); memdelete(p_bind); @@ -1052,27 +1052,27 @@ MethodBind* ObjectTypeDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind , c } -void ObjectTypeDB::add_virtual_method(const StringName& p_type, const MethodInfo& p_method , bool p_virtual) { - ERR_FAIL_COND(!types.has(p_type)); +void ClassDB::add_virtual_method(const StringName& p_class, const MethodInfo& p_method , bool p_virtual) { + ERR_FAIL_COND(!classes.has(p_class)); #ifdef DEBUG_METHODS_ENABLED MethodInfo mi=p_method; if (p_virtual) mi.flags|=METHOD_FLAG_VIRTUAL; - types[p_type].virtual_methods.push_back(mi); + classes[p_class].virtual_methods.push_back(mi); #endif } -void ObjectTypeDB::get_virtual_methods(const StringName& p_type, List<MethodInfo> * p_methods , bool p_no_inheritance) { +void ClassDB::get_virtual_methods(const StringName& p_class, List<MethodInfo> * p_methods , bool p_no_inheritance) { - ERR_FAIL_COND(!types.has(p_type)); + ERR_FAIL_COND(!classes.has(p_class)); #ifdef DEBUG_METHODS_ENABLED - TypeInfo *type=types.getptr(p_type); - TypeInfo *check=type; + ClassInfo *type=classes.getptr(p_class); + ClassInfo *check=type; while(check) { for(List<MethodInfo>::Element *E=check->virtual_methods.front();E;E=E->next()) { @@ -1088,18 +1088,18 @@ void ObjectTypeDB::get_virtual_methods(const StringName& p_type, List<MethodInfo } -void ObjectTypeDB::set_type_enabled(StringName p_type,bool p_enable) { +void ClassDB::set_class_enabled(StringName p_class,bool p_enable) { - ERR_FAIL_COND(!types.has(p_type)); - types[p_type].disabled=!p_enable; + ERR_FAIL_COND(!classes.has(p_class)); + classes[p_class].disabled=!p_enable; } -bool ObjectTypeDB::is_type_enabled(StringName p_type) { +bool ClassDB::is_class_enabled(StringName p_class) { - TypeInfo *ti=types.getptr(p_type); + ClassInfo *ti=classes.getptr(p_class); if (!ti || !ti->creation_func) { - if (compat_types.has(p_type)) { - ti=types.getptr(compat_types[p_type]); + if (compat_classes.has(p_class)) { + ti=classes.getptr(compat_classes[p_class]); } } @@ -1107,25 +1107,25 @@ bool ObjectTypeDB::is_type_enabled(StringName p_type) { return !ti->disabled; } -StringName ObjectTypeDB::get_category(const StringName& p_node) { +StringName ClassDB::get_category(const StringName& p_node) { - ERR_FAIL_COND_V(!types.has(p_node),StringName()); + ERR_FAIL_COND_V(!classes.has(p_node),StringName()); #ifdef DEBUG_ENABLED - return types[p_node].category; + return classes[p_node].category; #else return StringName(); #endif } -void ObjectTypeDB::add_resource_base_extension(const StringName& p_extension,const StringName& p_type) { +void ClassDB::add_resource_base_extension(const StringName& p_extension,const StringName& p_class) { if (resource_base_extensions.has(p_extension)) return; - resource_base_extensions[p_extension]=p_type; + resource_base_extensions[p_extension]=p_class; } -void ObjectTypeDB::get_resource_base_extensions(List<String> *p_extensions) { +void ClassDB::get_resource_base_extensions(List<String> *p_extensions) { const StringName *K=NULL; @@ -1135,21 +1135,21 @@ void ObjectTypeDB::get_resource_base_extensions(List<String> *p_extensions) { } } -void ObjectTypeDB::get_extensions_for_type(const StringName& p_type,List<String> *p_extensions) { +void ClassDB::get_extensions_for_type(const StringName& p_class,List<String> *p_extensions) { const StringName *K=NULL; while((K=resource_base_extensions.next(K))) { StringName cmp = resource_base_extensions[*K]; - if (is_type(cmp,p_type)) + if (is_parent_class(cmp,p_class)) p_extensions->push_back(*K); } } -Mutex *ObjectTypeDB::lock=NULL; +Mutex *ClassDB::lock=NULL; -void ObjectTypeDB::init() { +void ClassDB::init() { #ifndef NO_THREADS @@ -1157,7 +1157,7 @@ void ObjectTypeDB::init() { #endif } -void ObjectTypeDB::cleanup() { +void ClassDB::cleanup() { #ifndef NO_THREADS @@ -1169,9 +1169,9 @@ void ObjectTypeDB::cleanup() { const StringName *k=NULL; - while((k=types.next(k))) { + while((k=classes.next(k))) { - TypeInfo &ti=types[*k]; + ClassInfo &ti=classes[*k]; const StringName *m=NULL; while((m=ti.method_map.next(m))) { @@ -1179,9 +1179,9 @@ void ObjectTypeDB::cleanup() { memdelete( ti.method_map[*m] ); } } - types.clear(); + classes.clear(); resource_base_extensions.clear(); - compat_types.clear(); + compat_classes.clear(); } // diff --git a/core/object_type_db.h b/core/object_type_db.h index f2c95e328b..ca52f6ca89 100644 --- a/core/object_type_db.h +++ b/core/object_type_db.h @@ -108,7 +108,7 @@ static _FORCE_INLINE_ const char* _MD(const char* m_name, ...) { return m_name; #endif -class ObjectTypeDB { +class ClassDB { public: enum APIType { API_CORE, @@ -126,10 +126,10 @@ public: Variant::Type type; }; - struct TypeInfo { + struct ClassInfo { APIType api; - TypeInfo *inherits_ptr; + ClassInfo *inherits_ptr; HashMap<StringName,MethodBind*,StringNameHasher> method_map; HashMap<StringName,int,StringNameHasher> constant_map; HashMap<StringName,MethodInfo,StringNameHasher> signal_map; @@ -147,8 +147,8 @@ public: StringName name; bool disabled; Object* (*creation_func)(); - TypeInfo(); - ~TypeInfo(); + ClassInfo(); + ~ClassInfo(); }; template<class T> @@ -157,9 +157,9 @@ public: } static Mutex *lock; - static HashMap<StringName,TypeInfo,StringNameHasher> types; + static HashMap<StringName,ClassInfo,StringNameHasher> classes; static HashMap<StringName,StringName,StringNameHasher> resource_base_extensions; - static HashMap<StringName,StringName,StringNameHasher> compat_types; + static HashMap<StringName,StringName,StringNameHasher> compat_classes; #ifdef DEBUG_METHODS_ENABLED static MethodBind* bind_methodfi(uint32_t p_flags, MethodBind *p_bind , const MethodDefinition &method_name, const Variant **p_defs, int p_defcount); @@ -170,25 +170,25 @@ public: static APIType current_api; - static void _add_type2(const StringName& p_type, const StringName& p_inherits); + static void _add_class2(const StringName& p_class, const StringName& p_inherits); public: // DO NOT USE THIS!!!!!! NEEDS TO BE PUBLIC BUT DO NOT USE NO MATTER WHAT!!! template<class T> - static void _add_type() { + static void _add_class() { - _add_type2(T::get_type_static(),T::get_parent_type_static()); + _add_class2(T::get_class_static(),T::get_parent_class_static()); #if 0 GLOBAL_LOCK_FUNCTION; - StringName name = T::get_type_static(); + StringName name = T::get_class_static(); ERR_FAIL_COND(types.has(name)); types[name]=TypeInfo(); TypeInfo &ti=types[name]; ti.name=name; - ti.inherits=T::get_parent_type_static(); + ti.inherits=T::get_parent_class_static(); if (ti.inherits) { @@ -202,21 +202,21 @@ public: } template<class T> - static void register_type() { + static void register_class() { GLOBAL_LOCK_FUNCTION; - T::initialize_type(); - TypeInfo *t=types.getptr(T::get_type_static()); + T::initialize_class(); + ClassInfo *t=classes.getptr(T::get_class_static()); ERR_FAIL_COND(!t); t->creation_func=&creator<T>; T::register_custom_data_to_otdb(); } template<class T> - static void register_virtual_type() { + static void register_virtual_class() { GLOBAL_LOCK_FUNCTION; - T::initialize_type(); + T::initialize_class(); //nothing } @@ -227,24 +227,24 @@ public: } template<class T> - static void register_create_type() { + static void register_custom_instance_class() { GLOBAL_LOCK_FUNCTION; - T::initialize_type(); - TypeInfo *t=types.getptr(T::get_type_static()); + T::initialize_class(); + ClassInfo *t=classes.getptr(T::get_class_static()); ERR_FAIL_COND(!t); t->creation_func=&_create_ptr_func<T>; T::register_custom_data_to_otdb(); } - static void get_type_list( List<StringName> *p_types); - static void get_inheriters_from( const StringName& p_type,List<StringName> *p_types); - static StringName type_inherits_from(const StringName& p_type); - static bool type_exists(const StringName &p_type); - static bool is_type(const StringName &p_type,const StringName& p_inherits); - static bool can_instance(const StringName &p_type); - static Object *instance(const StringName &p_type); - static APIType get_api_type(const StringName &p_type); + static void get_class_list( List<StringName> *p_classes); + static void get_inheriters_from_class( const StringName& p_class,List<StringName> *p_classes); + static StringName get_parent_class(const StringName& p_class); + static bool class_exists(const StringName &p_class); + static bool is_parent_class(const StringName &p_class,const StringName& p_inherits); + static bool can_instance(const StringName &p_class); + static Object *instance(const StringName &p_class); + static APIType get_api_type(const StringName &p_class); static uint64_t get_api_hash(APIType p_api); @@ -444,9 +444,9 @@ public: bind->set_name(p_name); bind->set_default_arguments(p_default_args); - String instance_type=bind->get_instance_type(); + String instance_type=bind->get_instance_class(); - TypeInfo *type=types.getptr(instance_type); + ClassInfo *type=classes.getptr(instance_type); if (!type) { memdelete(bind); ERR_FAIL_COND_V(!type,NULL); @@ -471,44 +471,44 @@ public: } - static void add_signal(StringName p_type,const MethodInfo& p_signal); - static bool has_signal(StringName p_type,StringName p_signal); - static bool get_signal(StringName p_type,StringName p_signal,MethodInfo *r_signal); - static void get_signal_list(StringName p_type,List<MethodInfo> *p_signals,bool p_no_inheritance=false); + static void add_signal(StringName p_class,const MethodInfo& p_signal); + static bool has_signal(StringName p_class,StringName p_signal); + static bool get_signal(StringName p_class,StringName p_signal,MethodInfo *r_signal); + static void get_signal_list(StringName p_class,List<MethodInfo> *p_signals,bool p_no_inheritance=false); - static void add_property(StringName p_type,const PropertyInfo& p_pinfo, const StringName& p_setter, const StringName& p_getter, int p_index=-1); - static void get_property_list(StringName p_type, List<PropertyInfo> *p_list, bool p_no_inheritance=false, const Object *p_validator=NULL); + static void add_property(StringName p_class,const PropertyInfo& p_pinfo, const StringName& p_setter, const StringName& p_getter, int p_index=-1); + static void get_property_list(StringName p_class, List<PropertyInfo> *p_list, bool p_no_inheritance=false, const Object *p_validator=NULL); static bool set_property(Object* p_object, const StringName& p_property, const Variant& p_value, bool *r_valid=NULL); static bool get_property(Object* p_object,const StringName& p_property, Variant& r_value); - static Variant::Type get_property_type(const StringName& p_type, const StringName& p_property,bool *r_is_valid=NULL); + static Variant::Type get_property_type(const StringName& p_class, const StringName& p_property,bool *r_is_valid=NULL); - static bool has_method(StringName p_type,StringName p_method,bool p_no_inheritance=false); - static void set_method_flags(StringName p_type,StringName p_method,int p_flags); + static bool has_method(StringName p_class,StringName p_method,bool p_no_inheritance=false); + static void set_method_flags(StringName p_class,StringName p_method,int p_flags); - static void get_method_list(StringName p_type,List<MethodInfo> *p_methods,bool p_no_inheritance=false); - static MethodBind *get_method(StringName p_type, StringName p_name); + static void get_method_list(StringName p_class,List<MethodInfo> *p_methods,bool p_no_inheritance=false); + static MethodBind *get_method(StringName p_class, StringName p_name); - static void add_virtual_method(const StringName& p_type,const MethodInfo& p_method,bool p_virtual=true ); - static void get_virtual_methods(const StringName& p_type,List<MethodInfo> * p_methods,bool p_no_inheritance=false ); + static void add_virtual_method(const StringName& p_class,const MethodInfo& p_method,bool p_virtual=true ); + static void get_virtual_methods(const StringName& p_class,List<MethodInfo> * p_methods,bool p_no_inheritance=false ); - static void bind_integer_constant(const StringName& p_type, const StringName &p_name, int p_constant); - static void get_integer_constant_list(const StringName& p_type, List<String> *p_constants, bool p_no_inheritance=false); - static int get_integer_constant(const StringName& p_type, const StringName &p_name, bool *p_success=NULL); + static void bind_integer_constant(const StringName& p_class, const StringName &p_name, int p_constant); + static void get_integer_constant_list(const StringName& p_class, List<String> *p_constants, bool p_no_inheritance=false); + static int get_integer_constant(const StringName& p_class, const StringName &p_name, bool *p_success=NULL); static StringName get_category(const StringName& p_node); static bool get_setter_and_type_for_property(const StringName& p_class, const StringName& p_prop, StringName& r_class, StringName& r_setter); - static void set_type_enabled(StringName p_type,bool p_enable); - static bool is_type_enabled(StringName p_type); + static void set_class_enabled(StringName p_class,bool p_enable); + static bool is_class_enabled(StringName p_class); - static void add_resource_base_extension(const StringName& p_extension,const StringName& p_type); + static void add_resource_base_extension(const StringName& p_extension,const StringName& p_class); static void get_resource_base_extensions(List<String> *p_extensions); - static void get_extensions_for_type(const StringName& p_type,List<String> *p_extensions); + static void get_extensions_for_type(const StringName& p_class,List<String> *p_extensions); - static void add_compatibility_type(const StringName& p_type,const StringName& p_fallback); + static void add_compatibility_class(const StringName& p_class,const StringName& p_fallback); static void init(); static void set_current_api(APIType p_api); @@ -517,12 +517,12 @@ public: #define BIND_CONSTANT(m_constant)\ - ObjectTypeDB::bind_integer_constant( get_type_static() , #m_constant, m_constant); + ClassDB::bind_integer_constant( get_class_static() , #m_constant, m_constant); #ifdef TOOLS_ENABLED #define BIND_VMETHOD(m_method)\ - ObjectTypeDB::add_virtual_method( get_type_static() , m_method ); + ClassDB::add_virtual_method( get_class_static() , m_method ); #else diff --git a/core/os/input.cpp b/core/os/input.cpp index 8bcb7959b9..c662fafe79 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -49,39 +49,39 @@ Input::MouseMode Input::get_mouse_mode() const { void Input::_bind_methods() { - ObjectTypeDB::bind_method(_MD("is_key_pressed","scancode"),&Input::is_key_pressed); - ObjectTypeDB::bind_method(_MD("is_mouse_button_pressed","button"),&Input::is_mouse_button_pressed); - ObjectTypeDB::bind_method(_MD("is_joy_button_pressed","device","button"),&Input::is_joy_button_pressed); - ObjectTypeDB::bind_method(_MD("is_action_pressed","action"),&Input::is_action_pressed); - ObjectTypeDB::bind_method(_MD("is_action_just_pressed","action"),&Input::is_action_just_pressed); - ObjectTypeDB::bind_method(_MD("is_action_just_released","action"),&Input::is_action_just_released); - ObjectTypeDB::bind_method(_MD("add_joy_mapping","mapping", "update_existing"),&Input::add_joy_mapping, DEFVAL(false)); - ObjectTypeDB::bind_method(_MD("remove_joy_mapping","guid"),&Input::remove_joy_mapping); - ObjectTypeDB::bind_method(_MD("is_joy_known","device"),&Input::is_joy_known); - ObjectTypeDB::bind_method(_MD("get_joy_axis","device","axis"),&Input::get_joy_axis); - ObjectTypeDB::bind_method(_MD("get_joy_name","device"),&Input::get_joy_name); - ObjectTypeDB::bind_method(_MD("get_joy_guid","device"),&Input::get_joy_guid); - ObjectTypeDB::bind_method(_MD("get_connected_joysticks"),&Input::get_connected_joysticks); - ObjectTypeDB::bind_method(_MD("get_joy_vibration_strength", "device"), &Input::get_joy_vibration_strength); - ObjectTypeDB::bind_method(_MD("get_joy_vibration_duration", "device"), &Input::get_joy_vibration_duration); - ObjectTypeDB::bind_method(_MD("get_joy_button_string", "button_index"), &Input::get_joy_button_string); - ObjectTypeDB::bind_method(_MD("get_joy_button_index_from_string", "button"), &Input::get_joy_button_index_from_string); - ObjectTypeDB::bind_method(_MD("get_joy_axis_string", "axis_index"), &Input::get_joy_axis_string); - ObjectTypeDB::bind_method(_MD("get_joy_axis_index_from_string", "axis"), &Input::get_joy_axis_index_from_string); - ObjectTypeDB::bind_method(_MD("start_joy_vibration", "device", "weak_magnitude", "strong_magnitude", "duration"), &Input::start_joy_vibration, DEFVAL(0)); - ObjectTypeDB::bind_method(_MD("stop_joy_vibration", "device"), &Input::stop_joy_vibration); - ObjectTypeDB::bind_method(_MD("get_accelerometer"),&Input::get_accelerometer); - ObjectTypeDB::bind_method(_MD("get_magnetometer"),&Input::get_magnetometer); - ObjectTypeDB::bind_method(_MD("get_gyroscope"),&Input::get_gyroscope); - //ObjectTypeDB::bind_method(_MD("get_mouse_pos"),&Input::get_mouse_pos); - this is not the function you want - ObjectTypeDB::bind_method(_MD("get_mouse_speed"),&Input::get_mouse_speed); - ObjectTypeDB::bind_method(_MD("get_mouse_button_mask"),&Input::get_mouse_button_mask); - ObjectTypeDB::bind_method(_MD("set_mouse_mode","mode"),&Input::set_mouse_mode); - ObjectTypeDB::bind_method(_MD("get_mouse_mode"),&Input::get_mouse_mode); - ObjectTypeDB::bind_method(_MD("warp_mouse_pos","to"),&Input::warp_mouse_pos); - ObjectTypeDB::bind_method(_MD("action_press","action"),&Input::action_press); - ObjectTypeDB::bind_method(_MD("action_release","action"),&Input::action_release); - ObjectTypeDB::bind_method(_MD("set_custom_mouse_cursor","image:Texture","hotspot"),&Input::set_custom_mouse_cursor,DEFVAL(Vector2())); + ClassDB::bind_method(_MD("is_key_pressed","scancode"),&Input::is_key_pressed); + ClassDB::bind_method(_MD("is_mouse_button_pressed","button"),&Input::is_mouse_button_pressed); + ClassDB::bind_method(_MD("is_joy_button_pressed","device","button"),&Input::is_joy_button_pressed); + ClassDB::bind_method(_MD("is_action_pressed","action"),&Input::is_action_pressed); + ClassDB::bind_method(_MD("is_action_just_pressed","action"),&Input::is_action_just_pressed); + ClassDB::bind_method(_MD("is_action_just_released","action"),&Input::is_action_just_released); + ClassDB::bind_method(_MD("add_joy_mapping","mapping", "update_existing"),&Input::add_joy_mapping, DEFVAL(false)); + ClassDB::bind_method(_MD("remove_joy_mapping","guid"),&Input::remove_joy_mapping); + ClassDB::bind_method(_MD("is_joy_known","device"),&Input::is_joy_known); + ClassDB::bind_method(_MD("get_joy_axis","device","axis"),&Input::get_joy_axis); + ClassDB::bind_method(_MD("get_joy_name","device"),&Input::get_joy_name); + ClassDB::bind_method(_MD("get_joy_guid","device"),&Input::get_joy_guid); + ClassDB::bind_method(_MD("get_connected_joysticks"),&Input::get_connected_joysticks); + ClassDB::bind_method(_MD("get_joy_vibration_strength", "device"), &Input::get_joy_vibration_strength); + ClassDB::bind_method(_MD("get_joy_vibration_duration", "device"), &Input::get_joy_vibration_duration); + ClassDB::bind_method(_MD("get_joy_button_string", "button_index"), &Input::get_joy_button_string); + ClassDB::bind_method(_MD("get_joy_button_index_from_string", "button"), &Input::get_joy_button_index_from_string); + ClassDB::bind_method(_MD("get_joy_axis_string", "axis_index"), &Input::get_joy_axis_string); + ClassDB::bind_method(_MD("get_joy_axis_index_from_string", "axis"), &Input::get_joy_axis_index_from_string); + ClassDB::bind_method(_MD("start_joy_vibration", "device", "weak_magnitude", "strong_magnitude", "duration"), &Input::start_joy_vibration, DEFVAL(0)); + ClassDB::bind_method(_MD("stop_joy_vibration", "device"), &Input::stop_joy_vibration); + ClassDB::bind_method(_MD("get_accelerometer"),&Input::get_accelerometer); + ClassDB::bind_method(_MD("get_magnetometer"),&Input::get_magnetometer); + ClassDB::bind_method(_MD("get_gyroscope"),&Input::get_gyroscope); + //ClassDB::bind_method(_MD("get_mouse_pos"),&Input::get_mouse_pos); - this is not the function you want + ClassDB::bind_method(_MD("get_mouse_speed"),&Input::get_mouse_speed); + ClassDB::bind_method(_MD("get_mouse_button_mask"),&Input::get_mouse_button_mask); + ClassDB::bind_method(_MD("set_mouse_mode","mode"),&Input::set_mouse_mode); + ClassDB::bind_method(_MD("get_mouse_mode"),&Input::get_mouse_mode); + ClassDB::bind_method(_MD("warp_mouse_pos","to"),&Input::warp_mouse_pos); + ClassDB::bind_method(_MD("action_press","action"),&Input::action_press); + ClassDB::bind_method(_MD("action_release","action"),&Input::action_release); + ClassDB::bind_method(_MD("set_custom_mouse_cursor","image:Texture","hotspot"),&Input::set_custom_mouse_cursor,DEFVAL(Vector2())); BIND_CONSTANT( MOUSE_MODE_VISIBLE ); BIND_CONSTANT( MOUSE_MODE_HIDDEN ); diff --git a/core/os/input.h b/core/os/input.h index bbbf2c6fc1..a137820972 100644 --- a/core/os/input.h +++ b/core/os/input.h @@ -35,7 +35,7 @@ class Input : public Object { - OBJ_TYPE( Input, Object ); + GDCLASS( Input, Object ); static Input *singleton; diff --git a/core/os/main_loop.cpp b/core/os/main_loop.cpp index bb25448788..600a61e93d 100644 --- a/core/os/main_loop.cpp +++ b/core/os/main_loop.cpp @@ -31,12 +31,12 @@ void MainLoop::_bind_methods() { - ObjectTypeDB::bind_method(_MD("input_event","ev"),&MainLoop::input_event); - ObjectTypeDB::bind_method(_MD("input_text","text"),&MainLoop::input_text); - ObjectTypeDB::bind_method(_MD("init"),&MainLoop::init); - ObjectTypeDB::bind_method(_MD("iteration","delta"),&MainLoop::iteration); - ObjectTypeDB::bind_method(_MD("idle","delta"),&MainLoop::idle); - ObjectTypeDB::bind_method(_MD("finish"),&MainLoop::finish); + ClassDB::bind_method(_MD("input_event","ev"),&MainLoop::input_event); + ClassDB::bind_method(_MD("input_text","text"),&MainLoop::input_text); + ClassDB::bind_method(_MD("init"),&MainLoop::init); + ClassDB::bind_method(_MD("iteration","delta"),&MainLoop::iteration); + ClassDB::bind_method(_MD("idle","delta"),&MainLoop::idle); + ClassDB::bind_method(_MD("finish"),&MainLoop::finish); BIND_VMETHOD( MethodInfo("_input_event",PropertyInfo(Variant::INPUT_EVENT,"ev")) ); BIND_VMETHOD( MethodInfo("_input_text",PropertyInfo(Variant::STRING,"text")) ); diff --git a/core/os/main_loop.h b/core/os/main_loop.h index c52b1dbf4c..6506a280a3 100644 --- a/core/os/main_loop.h +++ b/core/os/main_loop.h @@ -37,7 +37,7 @@ */ class MainLoop : public Object { - OBJ_TYPE( MainLoop, Object ); + GDCLASS( MainLoop, Object ); OBJ_CATEGORY("Main Loop"); Ref<Script> init_script; diff --git a/core/os/os.cpp b/core/os/os.cpp index 2640b69996..f615e54430 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -198,7 +198,7 @@ static void _OS_printres(Object *p_obj) { if (!res) return; - String str = itos(res->get_instance_ID())+String(res->get_type())+":"+String(res->get_name())+" - "+res->get_path(); + String str = itos(res->get_instance_ID())+String(res->get_class())+":"+String(res->get_name())+" - "+res->get_path(); if (_OSPRF) _OSPRF->store_line(str); else diff --git a/core/packed_data_container.cpp b/core/packed_data_container.cpp index 3e54d94203..8bf77b735a 100644 --- a/core/packed_data_container.cpp +++ b/core/packed_data_container.cpp @@ -382,13 +382,13 @@ Variant PackedDataContainer::_iter_get(const Variant& p_iter){ void PackedDataContainer::_bind_methods() { - ObjectTypeDB::bind_method(_MD("_set_data"),&PackedDataContainer::_set_data); - ObjectTypeDB::bind_method(_MD("_get_data"),&PackedDataContainer::_get_data); - ObjectTypeDB::bind_method(_MD("_iter_init"),&PackedDataContainer::_iter_init); - ObjectTypeDB::bind_method(_MD("_iter_get"),&PackedDataContainer::_iter_get); - ObjectTypeDB::bind_method(_MD("_iter_next"),&PackedDataContainer::_iter_next); - ObjectTypeDB::bind_method(_MD("pack:Error","value"),&PackedDataContainer::pack); - ObjectTypeDB::bind_method(_MD("size"),&PackedDataContainer::size); + ClassDB::bind_method(_MD("_set_data"),&PackedDataContainer::_set_data); + ClassDB::bind_method(_MD("_get_data"),&PackedDataContainer::_get_data); + ClassDB::bind_method(_MD("_iter_init"),&PackedDataContainer::_iter_init); + ClassDB::bind_method(_MD("_iter_get"),&PackedDataContainer::_iter_get); + ClassDB::bind_method(_MD("_iter_next"),&PackedDataContainer::_iter_next); + ClassDB::bind_method(_MD("pack:Error","value"),&PackedDataContainer::pack); + ClassDB::bind_method(_MD("size"),&PackedDataContainer::size); ADD_PROPERTY( PropertyInfo(Variant::RAW_ARRAY,"__data__"),_SCS("_set_data"),_SCS("_get_data")); } @@ -426,11 +426,11 @@ bool PackedDataContainerRef::_is_dictionary() const { void PackedDataContainerRef::_bind_methods() { - ObjectTypeDB::bind_method(_MD("size"),&PackedDataContainerRef::size); - ObjectTypeDB::bind_method(_MD("_iter_init"),&PackedDataContainerRef::_iter_init); - ObjectTypeDB::bind_method(_MD("_iter_get"),&PackedDataContainerRef::_iter_get); - ObjectTypeDB::bind_method(_MD("_iter_next"),&PackedDataContainerRef::_iter_next); - ObjectTypeDB::bind_method(_MD("_is_dictionary"),&PackedDataContainerRef::_is_dictionary); + ClassDB::bind_method(_MD("size"),&PackedDataContainerRef::size); + ClassDB::bind_method(_MD("_iter_init"),&PackedDataContainerRef::_iter_init); + ClassDB::bind_method(_MD("_iter_get"),&PackedDataContainerRef::_iter_get); + ClassDB::bind_method(_MD("_iter_next"),&PackedDataContainerRef::_iter_next); + ClassDB::bind_method(_MD("_is_dictionary"),&PackedDataContainerRef::_is_dictionary); } diff --git a/core/packed_data_container.h b/core/packed_data_container.h index 0d718870dd..5e0180a424 100644 --- a/core/packed_data_container.h +++ b/core/packed_data_container.h @@ -36,7 +36,7 @@ class PackedDataContainer : public Resource { - OBJ_TYPE(PackedDataContainer,Resource); + GDCLASS(PackedDataContainer,Resource); enum { TYPE_DICT=0xFFFFFFFF, @@ -87,7 +87,7 @@ public: }; class PackedDataContainerRef : public Reference { - OBJ_TYPE(PackedDataContainerRef,Reference); + GDCLASS(PackedDataContainerRef,Reference); friend class PackedDataContainer; uint32_t offset; diff --git a/core/path_remap.cpp b/core/path_remap.cpp index 5b0ab514d6..c0bed76ac8 100644 --- a/core/path_remap.cpp +++ b/core/path_remap.cpp @@ -190,11 +190,11 @@ void PathRemap::load_remaps() { void PathRemap::_bind_methods() { - ObjectTypeDB::bind_method(_MD("add_remap","from","to","locale"),&PathRemap::add_remap,DEFVAL(String())); - ObjectTypeDB::bind_method(_MD("has_remap","path"),&PathRemap::has_remap); - ObjectTypeDB::bind_method(_MD("get_remap","path"),&PathRemap::get_remap); - ObjectTypeDB::bind_method(_MD("erase_remap","path"),&PathRemap::erase_remap); - ObjectTypeDB::bind_method(_MD("clear_remaps"),&PathRemap::clear_remaps); + ClassDB::bind_method(_MD("add_remap","from","to","locale"),&PathRemap::add_remap,DEFVAL(String())); + ClassDB::bind_method(_MD("has_remap","path"),&PathRemap::has_remap); + ClassDB::bind_method(_MD("get_remap","path"),&PathRemap::get_remap); + ClassDB::bind_method(_MD("erase_remap","path"),&PathRemap::erase_remap); + ClassDB::bind_method(_MD("clear_remaps"),&PathRemap::clear_remaps); } PathRemap::PathRemap() { diff --git a/core/path_remap.h b/core/path_remap.h index fc687ee03c..a106030f95 100644 --- a/core/path_remap.h +++ b/core/path_remap.h @@ -36,7 +36,7 @@ class PathRemap : public Object { - OBJ_TYPE(PathRemap,Object); + GDCLASS(PathRemap,Object); static PathRemap* singleton; struct RemapData { diff --git a/core/reference.cpp b/core/reference.cpp index 3e3355c219..69e053cc1a 100644 --- a/core/reference.cpp +++ b/core/reference.cpp @@ -54,9 +54,9 @@ bool Reference::init_ref() { void Reference::_bind_methods() { - ObjectTypeDB::bind_method(_MD("init_ref"),&Reference::init_ref); - ObjectTypeDB::bind_method(_MD("reference"),&Reference::reference); - ObjectTypeDB::bind_method(_MD("unreference"),&Reference::unreference); + ClassDB::bind_method(_MD("init_ref"),&Reference::init_ref); + ClassDB::bind_method(_MD("reference"),&Reference::reference); + ClassDB::bind_method(_MD("unreference"),&Reference::unreference); } int Reference::reference_get_count() const { @@ -126,7 +126,7 @@ WeakRef::WeakRef() { void WeakRef::_bind_methods() { - ObjectTypeDB::bind_method(_MD("get_ref:Object"),&WeakRef::get_ref); + ClassDB::bind_method(_MD("get_ref:Object"),&WeakRef::get_ref); } #if 0 diff --git a/core/reference.h b/core/reference.h index b82001da19..ce196801bb 100644 --- a/core/reference.h +++ b/core/reference.h @@ -39,7 +39,7 @@ */ class Reference : public Object{ - OBJ_TYPE( Reference, Object ); + GDCLASS( Reference, Object ); friend class RefBase; SafeRefCount refcount; SafeRefCount refcount_init; @@ -315,7 +315,7 @@ typedef Ref<Reference> REF; class WeakRef : public Reference { - OBJ_TYPE(WeakRef,Reference); + GDCLASS(WeakRef,Reference); ObjectID ref; protected: diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index fa82368f19..0e1dec075b 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -67,6 +67,7 @@ static ResourceFormatLoaderBinary *resource_loader_binary=NULL; static _ResourceLoader *_resource_loader=NULL; static _ResourceSaver *_resource_saver=NULL; static _OS *_os=NULL; +static _ClassDB *_classdb=NULL; static _Marshalls *_marshalls = NULL; static TranslationLoaderPO *resource_format_po=NULL; @@ -112,48 +113,48 @@ void register_core_types() { ResourceLoader::add_resource_format_loader(resource_loader_xml); #endif - ObjectTypeDB::register_type<Object>(); - - - ObjectTypeDB::register_type<Reference>(); - ObjectTypeDB::register_type<WeakRef>(); - ObjectTypeDB::register_type<ResourceImportMetadata>(); - ObjectTypeDB::register_type<Resource>(); - ObjectTypeDB::register_type<FuncRef>(); - ObjectTypeDB::register_virtual_type<StreamPeer>(); - ObjectTypeDB::register_type<StreamPeerBuffer>(); - ObjectTypeDB::register_create_type<StreamPeerTCP>(); - ObjectTypeDB::register_create_type<TCP_Server>(); - ObjectTypeDB::register_create_type<PacketPeerUDP>(); - ObjectTypeDB::register_create_type<StreamPeerSSL>(); - ObjectTypeDB::register_virtual_type<IP>(); - ObjectTypeDB::register_virtual_type<PacketPeer>(); - ObjectTypeDB::register_type<PacketPeerStream>(); - ObjectTypeDB::register_type<MainLoop>(); -// ObjectTypeDB::register_type<OptimizedSaver>(); - ObjectTypeDB::register_type<Translation>(); - ObjectTypeDB::register_type<PHashTranslation>(); - ObjectTypeDB::register_type<UndoRedo>(); - ObjectTypeDB::register_type<HTTPClient>(); - ObjectTypeDB::register_type<TriangleMesh>(); - - ObjectTypeDB::register_virtual_type<ResourceInteractiveLoader>(); - - ObjectTypeDB::register_type<_File>(); - ObjectTypeDB::register_type<_Directory>(); - ObjectTypeDB::register_type<_Thread>(); - ObjectTypeDB::register_type<_Mutex>(); - ObjectTypeDB::register_type<_Semaphore>(); - - ObjectTypeDB::register_type<XMLParser>(); - - ObjectTypeDB::register_type<ConfigFile>(); - - ObjectTypeDB::register_type<PCKPacker>(); - - ObjectTypeDB::register_type<PackedDataContainer>(); - ObjectTypeDB::register_virtual_type<PackedDataContainerRef>(); - ObjectTypeDB::register_type<AStar>(); + ClassDB::register_class<Object>(); + + + ClassDB::register_class<Reference>(); + ClassDB::register_class<WeakRef>(); + ClassDB::register_class<ResourceImportMetadata>(); + ClassDB::register_class<Resource>(); + ClassDB::register_class<FuncRef>(); + ClassDB::register_virtual_class<StreamPeer>(); + ClassDB::register_class<StreamPeerBuffer>(); + ClassDB::register_custom_instance_class<StreamPeerTCP>(); + ClassDB::register_custom_instance_class<TCP_Server>(); + ClassDB::register_custom_instance_class<PacketPeerUDP>(); + ClassDB::register_custom_instance_class<StreamPeerSSL>(); + ClassDB::register_virtual_class<IP>(); + ClassDB::register_virtual_class<PacketPeer>(); + ClassDB::register_class<PacketPeerStream>(); + ClassDB::register_class<MainLoop>(); +// ClassDB::register_type<OptimizedSaver>(); + ClassDB::register_class<Translation>(); + ClassDB::register_class<PHashTranslation>(); + ClassDB::register_class<UndoRedo>(); + ClassDB::register_class<HTTPClient>(); + ClassDB::register_class<TriangleMesh>(); + + ClassDB::register_virtual_class<ResourceInteractiveLoader>(); + + ClassDB::register_class<_File>(); + ClassDB::register_class<_Directory>(); + ClassDB::register_class<_Thread>(); + ClassDB::register_class<_Mutex>(); + ClassDB::register_class<_Semaphore>(); + + ClassDB::register_class<XMLParser>(); + + ClassDB::register_class<ConfigFile>(); + + ClassDB::register_class<PCKPacker>(); + + ClassDB::register_class<PackedDataContainer>(); + ClassDB::register_virtual_class<PackedDataContainerRef>(); + ClassDB::register_class<AStar>(); ip = IP::create(); @@ -164,6 +165,7 @@ void register_core_types() { _resource_loader=memnew(_ResourceLoader); _resource_saver=memnew(_ResourceSaver); _os=memnew(_OS); + _classdb=memnew(_ClassDB); _marshalls = memnew(_Marshalls); @@ -179,6 +181,7 @@ void register_core_singletons() { Globals::get_singleton()->add_singleton( Globals::Singleton("ResourceSaver",_ResourceSaver::get_singleton()) ); Globals::get_singleton()->add_singleton( Globals::Singleton("PathRemap",PathRemap::get_singleton() ) ); Globals::get_singleton()->add_singleton( Globals::Singleton("OS",_OS::get_singleton() ) ); + Globals::get_singleton()->add_singleton( Globals::Singleton("ClassDB",_classdb ) ); Globals::get_singleton()->add_singleton( Globals::Singleton("Marshalls",_Marshalls::get_singleton() ) ); Globals::get_singleton()->add_singleton( Globals::Singleton("TranslationServer",TranslationServer::get_singleton() ) ); Globals::get_singleton()->add_singleton( Globals::Singleton("TS",TranslationServer::get_singleton() ) ); @@ -195,6 +198,7 @@ void unregister_core_types() { memdelete( _resource_loader ); memdelete( _resource_saver ); memdelete( _os); + memdelete( _classdb ); memdelete( _marshalls ); memdelete( _geometry ); @@ -221,7 +225,7 @@ void unregister_core_types() { unregister_variant_methods(); - ObjectTypeDB::cleanup(); + ClassDB::cleanup(); ResourceCache::clear(); CoreStringNames::free(); StringName::cleanup(); diff --git a/core/resource.cpp b/core/resource.cpp index e6c574e502..ba330c758f 100644 --- a/core/resource.cpp +++ b/core/resource.cpp @@ -127,17 +127,17 @@ StringArray ResourceImportMetadata::_get_options() const { void ResourceImportMetadata::_bind_methods() { - ObjectTypeDB::bind_method(_MD("set_editor","name"),&ResourceImportMetadata::set_editor); - ObjectTypeDB::bind_method(_MD("get_editor"),&ResourceImportMetadata::get_editor); - ObjectTypeDB::bind_method(_MD("add_source","path","md5"),&ResourceImportMetadata::add_source, ""); - ObjectTypeDB::bind_method(_MD("get_source_path","idx"),&ResourceImportMetadata::get_source_path); - ObjectTypeDB::bind_method(_MD("get_source_md5","idx"),&ResourceImportMetadata::get_source_md5); - ObjectTypeDB::bind_method(_MD("set_source_md5","idx", "md5"),&ResourceImportMetadata::set_source_md5); - ObjectTypeDB::bind_method(_MD("remove_source","idx"),&ResourceImportMetadata::remove_source); - ObjectTypeDB::bind_method(_MD("get_source_count"),&ResourceImportMetadata::get_source_count); - ObjectTypeDB::bind_method(_MD("set_option","key","value"),&ResourceImportMetadata::set_option); - ObjectTypeDB::bind_method(_MD("get_option","key"),&ResourceImportMetadata::get_option); - ObjectTypeDB::bind_method(_MD("get_options"),&ResourceImportMetadata::_get_options); + ClassDB::bind_method(_MD("set_editor","name"),&ResourceImportMetadata::set_editor); + ClassDB::bind_method(_MD("get_editor"),&ResourceImportMetadata::get_editor); + ClassDB::bind_method(_MD("add_source","path","md5"),&ResourceImportMetadata::add_source, ""); + ClassDB::bind_method(_MD("get_source_path","idx"),&ResourceImportMetadata::get_source_path); + ClassDB::bind_method(_MD("get_source_md5","idx"),&ResourceImportMetadata::get_source_md5); + ClassDB::bind_method(_MD("set_source_md5","idx", "md5"),&ResourceImportMetadata::set_source_md5); + ClassDB::bind_method(_MD("remove_source","idx"),&ResourceImportMetadata::remove_source); + ClassDB::bind_method(_MD("get_source_count"),&ResourceImportMetadata::get_source_count); + ClassDB::bind_method(_MD("set_option","key","value"),&ResourceImportMetadata::set_option); + ClassDB::bind_method(_MD("get_option","key"),&ResourceImportMetadata::get_option); + ClassDB::bind_method(_MD("get_options"),&ResourceImportMetadata::_get_options); } ResourceImportMetadata::ResourceImportMetadata() { @@ -229,7 +229,7 @@ void Resource::reload_from_file() { if (!path.is_resource_file()) return; - Ref<Resource> s = ResourceLoader::load(path,get_type(),true); + Ref<Resource> s = ResourceLoader::load(path,get_class(),true); if (!s.is_valid()) return; @@ -256,7 +256,7 @@ Ref<Resource> Resource::duplicate(bool p_subresources) { get_property_list(&plist); - Resource *r = (Resource*)ObjectTypeDB::instance(get_type()); + Resource *r = (Resource*)ClassDB::instance(get_class()); ERR_FAIL_COND_V(!r,Ref<Resource>()); for(List<PropertyInfo>::Element *E=plist.front();E;E=E->next()) { @@ -291,16 +291,16 @@ void Resource::_take_over_path(const String& p_path) { void Resource::_bind_methods() { - ObjectTypeDB::bind_method(_MD("set_path","path"),&Resource::_set_path); - ObjectTypeDB::bind_method(_MD("take_over_path","path"),&Resource::_take_over_path); - ObjectTypeDB::bind_method(_MD("get_path"),&Resource::get_path); - ObjectTypeDB::bind_method(_MD("set_name","name"),&Resource::set_name); - ObjectTypeDB::bind_method(_MD("get_name"),&Resource::get_name); - ObjectTypeDB::bind_method(_MD("get_rid"),&Resource::get_rid); - ObjectTypeDB::bind_method(_MD("set_import_metadata","metadata"),&Resource::set_import_metadata); - ObjectTypeDB::bind_method(_MD("get_import_metadata"),&Resource::get_import_metadata); + ClassDB::bind_method(_MD("set_path","path"),&Resource::_set_path); + ClassDB::bind_method(_MD("take_over_path","path"),&Resource::_take_over_path); + ClassDB::bind_method(_MD("get_path"),&Resource::get_path); + ClassDB::bind_method(_MD("set_name","name"),&Resource::set_name); + ClassDB::bind_method(_MD("get_name"),&Resource::get_name); + ClassDB::bind_method(_MD("get_rid"),&Resource::get_rid); + ClassDB::bind_method(_MD("set_import_metadata","metadata"),&Resource::set_import_metadata); + ClassDB::bind_method(_MD("get_import_metadata"),&Resource::get_import_metadata); - ObjectTypeDB::bind_method(_MD("duplicate","subresources"),&Resource::duplicate,DEFVAL(false)); + ClassDB::bind_method(_MD("duplicate","subresources"),&Resource::duplicate,DEFVAL(false)); ADD_SIGNAL( MethodInfo("changed") ); ADD_PROPERTY( PropertyInfo(Variant::STRING,"resource/path",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_EDITOR ), _SCS("set_path"),_SCS("get_path")); ADD_PROPERTYNZ( PropertyInfo(Variant::STRING,"resource/name"), _SCS("set_name"),_SCS("get_name")); @@ -476,16 +476,16 @@ void ResourceCache::dump(const char* p_file,bool p_short) { Resource *r = resources[*K]; - 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()]++; if (!p_short) { if (f) - f->store_line(r->get_type()+": "+r->get_path()); + f->store_line(r->get_class()+": "+r->get_path()); } } diff --git a/core/resource.h b/core/resource.h index 3ea54ef277..cb109b3767 100644 --- a/core/resource.h +++ b/core/resource.h @@ -41,14 +41,14 @@ #define RES_BASE_EXTENSION(m_ext)\ public:\ -static void register_custom_data_to_otdb() { ObjectTypeDB::add_resource_base_extension(m_ext,get_type_static()); }\ +static void register_custom_data_to_otdb() { ClassDB::add_resource_base_extension(m_ext,get_class_static()); }\ virtual String get_base_extension() const { return m_ext; }\ private: class ResourceImportMetadata : public Reference { - OBJ_TYPE( ResourceImportMetadata, Reference ); + GDCLASS( ResourceImportMetadata, Reference ); struct Source { String path; @@ -88,7 +88,7 @@ public: class Resource : public Reference { - OBJ_TYPE( Resource, Reference ); + GDCLASS( Resource, Reference ); OBJ_CATEGORY("Resources"); RES_BASE_EXTENSION("res"); diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index 3686169a4e..c1d78f129a 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -575,8 +575,8 @@ void ScriptDebuggerRemote::_send_object_id(ObjectID p_id) { packet_peer_stream->put_var("message:inspect_object"); packet_peer_stream->put_var(props_to_send*5+4); packet_peer_stream->put_var(p_id); - packet_peer_stream->put_var(obj->get_type()); - if (obj->is_type("Resource") || obj->is_type("Node")) + packet_peer_stream->put_var(obj->get_class()); + if (obj->is_class("Resource") || obj->is_class("Node")) packet_peer_stream->put_var(obj->call("get_path")); else packet_peer_stream->put_var(""); diff --git a/core/script_language.cpp b/core/script_language.cpp index 40b59d4e84..52ae181c32 100644 --- a/core/script_language.cpp +++ b/core/script_language.cpp @@ -46,13 +46,13 @@ void Script::_notification( int p_what) { void Script::_bind_methods() { - ObjectTypeDB::bind_method(_MD("can_instance"),&Script::can_instance); - //ObjectTypeDB::bind_method(_MD("instance_create","base_object"),&Script::instance_create); - ObjectTypeDB::bind_method(_MD("instance_has","base_object"),&Script::instance_has); - ObjectTypeDB::bind_method(_MD("has_source_code"),&Script::has_source_code); - ObjectTypeDB::bind_method(_MD("get_source_code"),&Script::get_source_code); - ObjectTypeDB::bind_method(_MD("set_source_code","source"),&Script::set_source_code); - ObjectTypeDB::bind_method(_MD("reload","keep_state"),&Script::reload,DEFVAL(false)); + ClassDB::bind_method(_MD("can_instance"),&Script::can_instance); + //ClassDB::bind_method(_MD("instance_create","base_object"),&Script::instance_create); + ClassDB::bind_method(_MD("instance_has","base_object"),&Script::instance_has); + ClassDB::bind_method(_MD("has_source_code"),&Script::has_source_code); + ClassDB::bind_method(_MD("get_source_code"),&Script::get_source_code); + ClassDB::bind_method(_MD("set_source_code","source"),&Script::set_source_code); + ClassDB::bind_method(_MD("reload","keep_state"),&Script::reload,DEFVAL(false)); } diff --git a/core/script_language.h b/core/script_language.h index 43b1c649b7..8c38af47cb 100644 --- a/core/script_language.h +++ b/core/script_language.h @@ -77,7 +77,7 @@ class PlaceHolderScriptInstance; class Script : public Resource { - OBJ_TYPE( Script, Resource ); + GDCLASS( Script, Resource ); OBJ_SAVE_TYPE( Script ); protected: diff --git a/core/translation.cpp b/core/translation.cpp index f368c9d5fc..9ac1d6a31e 100644 --- a/core/translation.cpp +++ b/core/translation.cpp @@ -898,15 +898,15 @@ int Translation::get_message_count() const { void Translation::_bind_methods() { - ObjectTypeDB::bind_method(_MD("set_locale","locale"),&Translation::set_locale); - ObjectTypeDB::bind_method(_MD("get_locale"),&Translation::get_locale); - ObjectTypeDB::bind_method(_MD("add_message","src_message","xlated_message"),&Translation::add_message); - ObjectTypeDB::bind_method(_MD("get_message","src_message"),&Translation::get_message); - ObjectTypeDB::bind_method(_MD("erase_message","src_message"),&Translation::erase_message); - ObjectTypeDB::bind_method(_MD("get_message_list"),&Translation::_get_message_list); - ObjectTypeDB::bind_method(_MD("get_message_count"),&Translation::get_message_count); - ObjectTypeDB::bind_method(_MD("_set_messages"),&Translation::_set_messages); - ObjectTypeDB::bind_method(_MD("_get_messages"),&Translation::_get_messages); + ClassDB::bind_method(_MD("set_locale","locale"),&Translation::set_locale); + ClassDB::bind_method(_MD("get_locale"),&Translation::get_locale); + ClassDB::bind_method(_MD("add_message","src_message","xlated_message"),&Translation::add_message); + ClassDB::bind_method(_MD("get_message","src_message"),&Translation::get_message); + ClassDB::bind_method(_MD("erase_message","src_message"),&Translation::erase_message); + ClassDB::bind_method(_MD("get_message_list"),&Translation::_get_message_list); + ClassDB::bind_method(_MD("get_message_count"),&Translation::get_message_count); + ClassDB::bind_method(_MD("_set_messages"),&Translation::_set_messages); + ClassDB::bind_method(_MD("_get_messages"),&Translation::_get_messages); ADD_PROPERTY( PropertyInfo(Variant::STRING_ARRAY,"messages",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR), _SCS("_set_messages"), _SCS("_get_messages") ); ADD_PROPERTY( PropertyInfo(Variant::STRING,"locale"), _SCS("set_locale"), _SCS("get_locale") ); @@ -1116,15 +1116,15 @@ StringName TranslationServer::tool_translate(const StringName& p_message) const void TranslationServer::_bind_methods() { - ObjectTypeDB::bind_method(_MD("set_locale","locale"),&TranslationServer::set_locale); - ObjectTypeDB::bind_method(_MD("get_locale"),&TranslationServer::get_locale); + ClassDB::bind_method(_MD("set_locale","locale"),&TranslationServer::set_locale); + ClassDB::bind_method(_MD("get_locale"),&TranslationServer::get_locale); - ObjectTypeDB::bind_method(_MD("translate","message"),&TranslationServer::translate); + ClassDB::bind_method(_MD("translate","message"),&TranslationServer::translate); - ObjectTypeDB::bind_method(_MD("add_translation","translation:Translation"),&TranslationServer::add_translation); - ObjectTypeDB::bind_method(_MD("remove_translation","translation:Translation"),&TranslationServer::remove_translation); + ClassDB::bind_method(_MD("add_translation","translation:Translation"),&TranslationServer::add_translation); + ClassDB::bind_method(_MD("remove_translation","translation:Translation"),&TranslationServer::remove_translation); - ObjectTypeDB::bind_method(_MD("clear"),&TranslationServer::clear); + ClassDB::bind_method(_MD("clear"),&TranslationServer::clear); } diff --git a/core/translation.h b/core/translation.h index 14b7c372f6..01edc82139 100644 --- a/core/translation.h +++ b/core/translation.h @@ -35,7 +35,7 @@ class Translation : public Resource { - OBJ_TYPE( Translation, Resource ); + GDCLASS( Translation, Resource ); OBJ_SAVE_TYPE( Translation ); RES_BASE_EXTENSION("xl"); @@ -68,7 +68,7 @@ public: class TranslationServer : public Object { - OBJ_TYPE(TranslationServer, Object); + GDCLASS(TranslationServer, Object); String locale; String fallback; diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp index bf7bf69c64..5bdc8ef72d 100644 --- a/core/undo_redo.cpp +++ b/core/undo_redo.cpp @@ -479,11 +479,11 @@ Variant UndoRedo::_add_undo_method(const Variant** p_args, int p_argcount, Varia void UndoRedo::_bind_methods() { - ObjectTypeDB::bind_method(_MD("create_action","name","merge_mode"),&UndoRedo::create_action, DEFVAL(MERGE_DISABLE) ); - ObjectTypeDB::bind_method(_MD("commit_action"),&UndoRedo::commit_action); + ClassDB::bind_method(_MD("create_action","name","merge_mode"),&UndoRedo::create_action, DEFVAL(MERGE_DISABLE) ); + ClassDB::bind_method(_MD("commit_action"),&UndoRedo::commit_action); - //ObjectTypeDB::bind_method(_MD("add_do_method","p_object", "p_method", "VARIANT_ARG_LIST"),&UndoRedo::add_do_method); - //ObjectTypeDB::bind_method(_MD("add_undo_method","p_object", "p_method", "VARIANT_ARG_LIST"),&UndoRedo::add_undo_method); + //ClassDB::bind_method(_MD("add_do_method","p_object", "p_method", "VARIANT_ARG_LIST"),&UndoRedo::add_do_method); + //ClassDB::bind_method(_MD("add_undo_method","p_object", "p_method", "VARIANT_ARG_LIST"),&UndoRedo::add_undo_method); { MethodInfo mi; @@ -492,7 +492,7 @@ void UndoRedo::_bind_methods() { mi.arguments.push_back( PropertyInfo( Variant::STRING, "method")); - ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"add_do_method",&UndoRedo::_add_do_method,mi); + ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"add_do_method",&UndoRedo::_add_do_method,mi); } { @@ -502,16 +502,16 @@ void UndoRedo::_bind_methods() { mi.arguments.push_back( PropertyInfo( Variant::STRING, "method")); - ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"add_undo_method",&UndoRedo::_add_undo_method,mi); + ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"add_undo_method",&UndoRedo::_add_undo_method,mi); } - ObjectTypeDB::bind_method(_MD("add_do_property","object", "property", "value:Variant"),&UndoRedo::add_do_property); - ObjectTypeDB::bind_method(_MD("add_undo_property","object", "property", "value:Variant"),&UndoRedo::add_undo_property); - ObjectTypeDB::bind_method(_MD("add_do_reference","object"),&UndoRedo::add_do_reference); - ObjectTypeDB::bind_method(_MD("add_undo_reference","object"),&UndoRedo::add_undo_reference); - ObjectTypeDB::bind_method(_MD("clear_history"),&UndoRedo::clear_history); - ObjectTypeDB::bind_method(_MD("get_current_action_name"),&UndoRedo::get_current_action_name); - ObjectTypeDB::bind_method(_MD("get_version"),&UndoRedo::get_version); + ClassDB::bind_method(_MD("add_do_property","object", "property", "value:Variant"),&UndoRedo::add_do_property); + ClassDB::bind_method(_MD("add_undo_property","object", "property", "value:Variant"),&UndoRedo::add_undo_property); + ClassDB::bind_method(_MD("add_do_reference","object"),&UndoRedo::add_do_reference); + ClassDB::bind_method(_MD("add_undo_reference","object"),&UndoRedo::add_undo_reference); + ClassDB::bind_method(_MD("clear_history"),&UndoRedo::clear_history); + ClassDB::bind_method(_MD("get_current_action_name"),&UndoRedo::get_current_action_name); + ClassDB::bind_method(_MD("get_version"),&UndoRedo::get_version); BIND_CONSTANT(MERGE_DISABLE); BIND_CONSTANT(MERGE_ENDS); diff --git a/core/undo_redo.h b/core/undo_redo.h index cccfc39116..3d14dd9ee2 100644 --- a/core/undo_redo.h +++ b/core/undo_redo.h @@ -37,7 +37,7 @@ class UndoRedo : public Object { - OBJ_TYPE(UndoRedo,Object); + GDCLASS(UndoRedo,Object); OBJ_SAVE_TYPE( UndoRedo ); public: diff --git a/core/variant.cpp b/core/variant.cpp index 437f1fb634..19b0ea7129 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -1665,7 +1665,7 @@ Variant::operator String() const { }; }; #endif - return "["+_get_obj().obj->get_type()+":"+itos(_get_obj().obj->get_instance_ID())+"]"; + return "["+_get_obj().obj->get_class()+":"+itos(_get_obj().obj->get_instance_ID())+"]"; } else return "[Object:null]"; @@ -3066,7 +3066,7 @@ String Variant::get_call_error_text(Object* p_base, const StringName& p_method,c return "Call OK"; } - String class_name = p_base->get_type(); + String class_name = p_base->get_class(); Ref<Script> script = p_base->get_script(); if (script.is_valid() && script->get_path().is_resource_file()) { |