diff options
Diffstat (limited to 'main/main.cpp')
| -rw-r--r-- | main/main.cpp | 58 |
1 files changed, 41 insertions, 17 deletions
diff --git a/main/main.cpp b/main/main.cpp index 912e8adf4..6703da8b0 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -127,7 +127,7 @@ static String unescape_cmdline(const String& p_str) { void Main::print_help(const char* p_binary) { - OS::get_singleton()->print(VERSION_FULL_NAME" (c) 2008-2016 Juan Linietsky, Ariel Manzur.\n"); + OS::get_singleton()->print(VERSION_FULL_NAME" (c) 2008-2017 Juan Linietsky, Ariel Manzur.\n"); OS::get_singleton()->print("Usage: %s [options] [scene]\n",p_binary); OS::get_singleton()->print("Options:\n"); OS::get_singleton()->print("\t-path [dir] : Path to a game, containing engine.cfg\n"); @@ -159,7 +159,7 @@ void Main::print_help(const char* p_binary) { OS::get_singleton()->print("%s",OS::get_singleton()->get_video_driver_name(i)); } OS::get_singleton()->print(")\n"); - OS::get_singleton()->print("\t-ldpi\t : Force low-dpi mode (OSX Only)"); + OS::get_singleton()->print("\t-ldpi\t : Force low-dpi mode (OSX Only)\n"); OS::get_singleton()->print("\t-ad DRIVER\t : Audio Driver ("); for (int i=0;i<OS::get_singleton()->get_audio_driver_count();i++) { @@ -169,8 +169,7 @@ void Main::print_help(const char* p_binary) { OS::get_singleton()->print("%s",OS::get_singleton()->get_audio_driver_name(i)); } OS::get_singleton()->print(")\n"); - OS::get_singleton()->print("\t-rthread <mode>\t : Render Thread Mode ('unsafe', 'safe', 'separate)."); - OS::get_singleton()->print(")\n"); + OS::get_singleton()->print("\t-rthread <mode>\t : Render Thread Mode ('unsafe', 'safe', 'separate').\n"); OS::get_singleton()->print("\t-s,-script [script] : Run a script.\n"); OS::get_singleton()->print("\t-d,-debug : Debug (local stdout debugger).\n"); OS::get_singleton()->print("\t-rdebug ADDRESS : Remote debug (<ip>:<port> host address).\n"); @@ -196,7 +195,7 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas RID_OwnerBase::init_rid(); OS::get_singleton()->initialize_core(); - ObjectTypeDB::init(); + ClassDB::init(); MAIN_PRINT("Main: Initialize CORE"); @@ -1003,10 +1002,10 @@ Error Main::setup2() { } } #ifdef TOOLS_ENABLED - ObjectTypeDB::set_current_api(ObjectTypeDB::API_EDITOR); + ClassDB::set_current_api(ClassDB::API_EDITOR); EditorNode::register_editor_types(); - ObjectTypeDB::set_current_api(ObjectTypeDB::API_CORE); + ClassDB::set_current_api(ClassDB::API_CORE); #endif @@ -1034,8 +1033,12 @@ Error Main::setup2() { _start_success=true; locale=String(); - ObjectTypeDB::set_current_api(ObjectTypeDB::API_NONE); //no more api is registered at this point + ClassDB::set_current_api(ClassDB::API_NONE); //no more api is registered at this point + if (OS::get_singleton()->is_stdout_verbose()) { + print_line("CORE API HASH: "+itos(ClassDB::get_api_hash(ClassDB::API_CORE))); + print_line("EDITOR API HASH: "+itos(ClassDB::get_api_hash(ClassDB::API_EDITOR))); + } MAIN_PRINT("Main: Done"); return OK; @@ -1191,7 +1194,7 @@ bool Main::start() { StringName instance_type=script_res->get_instance_base_type(); - Object *obj = ObjectTypeDB::instance(instance_type); + Object *obj = ClassDB::instance(instance_type); MainLoop *script_loop = obj?obj->cast_to<MainLoop>():NULL; if (!script_loop) { if (obj) @@ -1216,12 +1219,12 @@ bool Main::start() { main_loop_type="SceneTree"; if (!main_loop) { - if (!ObjectTypeDB::type_exists(main_loop_type)) { + if (!ClassDB::class_exists(main_loop_type)) { OS::get_singleton()->alert("godot: error: MainLoop type doesn't exist: "+main_loop_type); return false; } else { - Object *ml = ObjectTypeDB::instance(main_loop_type); + Object *ml = ClassDB::instance(main_loop_type); if (!ml) { ERR_EXPLAIN("Can't instance MainLoop type"); ERR_FAIL_V(false); @@ -1238,7 +1241,7 @@ bool Main::start() { } } - if (main_loop->is_type("SceneTree")) { + if (main_loop->is_class("SceneTree")) { SceneTree *sml = main_loop->cast_to<SceneTree>(); @@ -1296,6 +1299,17 @@ bool Main::start() { appname = TranslationServer::get_singleton()->translate(appname); OS::get_singleton()->set_window_title(appname); + int shadow_atlas_size = GLOBAL_DEF("rendering/shadow_atlas/size",2048); + int shadow_atlas_q0_subdiv = GLOBAL_DEF("rendering/shadow_atlas/quadrant_0_subdiv",2); + int shadow_atlas_q1_subdiv = GLOBAL_DEF("rendering/shadow_atlas/quadrant_1_subdiv",2); + int shadow_atlas_q2_subdiv = GLOBAL_DEF("rendering/shadow_atlas/quadrant_2_subdiv",3); + int shadow_atlas_q3_subdiv = GLOBAL_DEF("rendering/shadow_atlas/quadrant_3_subdiv",4); + + sml->get_root()->set_shadow_atlas_size(shadow_atlas_size); + sml->get_root()->set_shadow_atlas_quadrant_subdiv(0,Viewport::ShadowAtlasQuadrantSubdiv(shadow_atlas_q0_subdiv)); + sml->get_root()->set_shadow_atlas_quadrant_subdiv(1,Viewport::ShadowAtlasQuadrantSubdiv(shadow_atlas_q1_subdiv)); + sml->get_root()->set_shadow_atlas_quadrant_subdiv(2,Viewport::ShadowAtlasQuadrantSubdiv(shadow_atlas_q2_subdiv)); + sml->get_root()->set_shadow_atlas_quadrant_subdiv(3,Viewport::ShadowAtlasQuadrantSubdiv(shadow_atlas_q3_subdiv)); } else { GLOBAL_DEF("display/stretch_mode","disabled"); @@ -1304,7 +1318,17 @@ bool Main::start() { Globals::get_singleton()->set_custom_property_info("display/stretch_aspect",PropertyInfo(Variant::STRING,"display/stretch_aspect",PROPERTY_HINT_ENUM,"ignore,keep,keep_width,keep_height")); sml->set_auto_accept_quit(GLOBAL_DEF("application/auto_accept_quit",true)); + GLOBAL_DEF("rendering/shadow_atlas/size",2048); + Globals::get_singleton()->set_custom_property_info("rendering/shadow_atlas/size",PropertyInfo(Variant::INT,"rendering/shadow_atlas/size",PROPERTY_HINT_RANGE,"256,16384")); + GLOBAL_DEF("rendering/shadow_atlas/quadrant_0_subdiv",2); + GLOBAL_DEF("rendering/shadow_atlas/quadrant_1_subdiv",2); + GLOBAL_DEF("rendering/shadow_atlas/quadrant_2_subdiv",3); + GLOBAL_DEF("rendering/shadow_atlas/quadrant_3_subdiv",4); + Globals::get_singleton()->set_custom_property_info("rendering/shadow_atlas/quadrant_0_subdiv",PropertyInfo(Variant::INT,"rendering/shadow_atlas/quadrant_0_subdiv",PROPERTY_HINT_ENUM,"Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); + Globals::get_singleton()->set_custom_property_info("rendering/shadow_atlas/quadrant_1_subdiv",PropertyInfo(Variant::INT,"rendering/shadow_atlas/quadrant_1_subdiv",PROPERTY_HINT_ENUM,"Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); + Globals::get_singleton()->set_custom_property_info("rendering/shadow_atlas/quadrant_2_subdiv",PropertyInfo(Variant::INT,"rendering/shadow_atlas/quadrant_2_subdiv",PROPERTY_HINT_ENUM,"Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); + Globals::get_singleton()->set_custom_property_info("rendering/shadow_atlas/quadrant_3_subdiv",PropertyInfo(Variant::INT,"rendering/shadow_atlas/quadrant_3_subdiv",PROPERTY_HINT_ENUM,"Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); } @@ -1428,17 +1452,17 @@ bool Main::start() { ERR_EXPLAIN("Can't autoload: "+path); ERR_CONTINUE(res.is_null()); Node *n=NULL; - if (res->is_type("PackedScene")) { + if (res->is_class("PackedScene")) { Ref<PackedScene> ps = res; n=ps->instance(); - } else if (res->is_type("Script")) { + } else if (res->is_class("Script")) { Ref<Script> s = res; StringName ibt = s->get_instance_base_type(); - bool valid_type = ObjectTypeDB::is_type(ibt,"Node"); + bool valid_type = ClassDB::is_parent_class(ibt,"Node"); ERR_EXPLAIN("Script does not inherit a Node: "+path); ERR_CONTINUE( !valid_type ); - Object *obj = ObjectTypeDB::instance(ibt); + Object *obj = ClassDB::instance(ibt); ERR_EXPLAIN("Cannot instance script for autoload, expected 'Node' inheritance, got: "+String(ibt)); ERR_CONTINUE( obj==NULL ); |
