From 0c2e882210f8848475f7d9547af50a202f53a110 Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Mon, 9 Oct 2017 23:49:17 +0200 Subject: Adds 'exposed' field to ClassInfo This field represents if the class is exposed to the scripting API. The value is 'true' if the class was registered manually ('ClassDB::register_*class()'), otherwise it's false (registered on '_post_initialize'). - Added missing registration of classes that are meant to be exposed. --- core/class_db.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'core/class_db.cpp') diff --git a/core/class_db.cpp b/core/class_db.cpp index f5ddd9c76..12310f615 100644 --- a/core/class_db.cpp +++ b/core/class_db.cpp @@ -205,6 +205,7 @@ ClassDB::ClassInfo::ClassInfo() { creation_func = NULL; inherits_ptr = NULL; disabled = false; + exposed = false; } ClassDB::ClassInfo::~ClassInfo() { } @@ -1284,6 +1285,15 @@ bool ClassDB::is_class_enabled(StringName p_class) { return !ti->disabled; } +bool ClassDB::is_class_exposed(StringName p_class) { + + OBJTYPE_RLOCK; + + ClassInfo *ti = classes.getptr(p_class); + ERR_FAIL_COND_V(!ti, false); + return ti->exposed; +} + StringName ClassDB::get_category(const StringName &p_node) { ERR_FAIL_COND_V(!classes.has(p_node), StringName()); -- cgit v1.2.3-70-g09d2