2016-06-18 14:46:12 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* register_types.cpp */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
2017-08-27 14:16:55 +02:00
|
|
|
/* https://godotengine.org */
|
2016-06-18 14:46:12 +02:00
|
|
|
/*************************************************************************/
|
2017-01-01 22:01:57 +01:00
|
|
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
2017-04-08 00:11:42 +02:00
|
|
|
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
2016-06-18 14:46:12 +02:00
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
2014-02-24 13:53:33 +01:00
|
|
|
#include "register_types.h"
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-11-16 18:38:18 +01:00
|
|
|
#include "gdscript.h"
|
2017-03-05 16:44:50 +01:00
|
|
|
#include "io/file_access_encrypted.h"
|
2014-02-10 02:10:30 +01:00
|
|
|
#include "io/resource_loader.h"
|
2014-02-25 13:31:47 +01:00
|
|
|
#include "os/file_access.h"
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
GDScriptLanguage *script_language_gd = NULL;
|
|
|
|
ResourceFormatLoaderGDScript *resource_loader_gd = NULL;
|
|
|
|
ResourceFormatSaverGDScript *resource_saver_gd = NULL;
|
2014-02-25 13:31:47 +01:00
|
|
|
|
2014-02-24 13:53:33 +01:00
|
|
|
void register_gdscript_types() {
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-01-03 03:03:46 +01:00
|
|
|
ClassDB::register_class<GDScript>();
|
2017-11-16 18:38:18 +01:00
|
|
|
ClassDB::register_virtual_class<GDScriptFunctionState>();
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
script_language_gd = memnew(GDScriptLanguage);
|
2014-02-10 02:10:30 +01:00
|
|
|
ScriptServer::register_language(script_language_gd);
|
2017-03-05 16:44:50 +01:00
|
|
|
resource_loader_gd = memnew(ResourceFormatLoaderGDScript);
|
2014-02-10 02:10:30 +01:00
|
|
|
ResourceLoader::add_resource_format_loader(resource_loader_gd);
|
2017-03-05 16:44:50 +01:00
|
|
|
resource_saver_gd = memnew(ResourceFormatSaverGDScript);
|
2014-02-10 02:10:30 +01:00
|
|
|
ResourceSaver::add_resource_format_saver(resource_saver_gd);
|
|
|
|
}
|
2017-08-27 21:07:15 +02:00
|
|
|
|
2014-02-24 13:53:33 +01:00
|
|
|
void unregister_gdscript_types() {
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-06-26 15:53:34 +02:00
|
|
|
ScriptServer::unregister_language(script_language_gd);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
if (script_language_gd)
|
2017-03-05 16:44:50 +01:00
|
|
|
memdelete(script_language_gd);
|
2014-02-10 02:10:30 +01:00
|
|
|
if (resource_loader_gd)
|
2017-03-05 16:44:50 +01:00
|
|
|
memdelete(resource_loader_gd);
|
2014-02-10 02:10:30 +01:00
|
|
|
if (resource_saver_gd)
|
2017-03-05 16:44:50 +01:00
|
|
|
memdelete(resource_saver_gd);
|
2014-02-25 13:31:47 +01:00
|
|
|
}
|