Several all around fixes to visual scripting (in the process of creating demos)
This commit is contained in:
parent
1b80edafca
commit
748836e0b3
13 changed files with 1275 additions and 138 deletions
|
|
@ -1332,17 +1332,18 @@ Variant _GLOBAL_DEF( const String& p_var, const Variant& p_default) {
|
|||
void Globals::add_singleton(const Singleton &p_singleton) {
|
||||
|
||||
singletons.push_back(p_singleton);
|
||||
singleton_ptrs[p_singleton.name]=p_singleton.ptr;
|
||||
}
|
||||
|
||||
Object* Globals::get_singleton_object(const String& p_name) const {
|
||||
|
||||
for(const List<Singleton>::Element *E=singletons.front();E;E=E->next()) {
|
||||
if (E->get().name == p_name) {
|
||||
return E->get().ptr;
|
||||
};
|
||||
};
|
||||
|
||||
return NULL;
|
||||
const Map<StringName,Object*>::Element *E=singleton_ptrs.find(p_name);
|
||||
if (!E)
|
||||
return NULL;
|
||||
else
|
||||
return E->get();
|
||||
|
||||
};
|
||||
|
||||
bool Globals::has_singleton(const String& p_name) const {
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ protected:
|
|||
Error _save_settings_binary(const String& p_file,const Map<String,List<String> > &props,const CustomMap& p_custom=CustomMap());
|
||||
|
||||
List<Singleton> singletons;
|
||||
Map<StringName,Object*> singleton_ptrs;
|
||||
|
||||
Error _save_custom_bnd(const String& p_file);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue