MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / debug_get_globals

Method debug_get_globals

modules/gdscript/gdscript_editor.cpp:395–441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

393}
394
395void GDScriptLanguage::debug_get_globals(List<String> *p_globals, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {
396 const HashMap<StringName, int> &name_idx = GDScriptLanguage::get_singleton()->get_global_map();
397 const Variant *gl_array = GDScriptLanguage::get_singleton()->get_global_array();
398
399 List<Pair<String, Variant>> cinfo;
400 get_public_constants(&cinfo);
401
402 for (const KeyValue<StringName, int> &E : name_idx) {
403 if (ClassDB::class_exists(E.key) || Engine::get_singleton()->has_singleton(E.key)) {
404 continue;
405 }
406
407 bool is_script_constant = false;
408 for (List<Pair<String, Variant>>::Element *CE = cinfo.front(); CE; CE = CE->next()) {
409 if (CE->get().first == E.key) {
410 is_script_constant = true;
411 break;
412 }
413 }
414 if (is_script_constant) {
415 continue;
416 }
417
418 const Variant &var = gl_array[E.value];
419 bool freed = false;
420 const Object *obj = var.get_validated_object_with_check(freed);
421 if (obj && !freed) {
422 if (Object::cast_to<GDScriptNativeClass>(obj)) {
423 continue;
424 }
425 }
426
427 bool skip = false;
428 for (int i = 0; i < CoreConstants::get_global_constant_count(); i++) {
429 if (E.key == CoreConstants::get_global_constant_name(i)) {
430 skip = true;
431 break;
432 }
433 }
434 if (skip) {
435 continue;
436 }
437
438 p_globals->push_back(E.key);
439 p_values->push_back(var);
440 }
441}
442
443String GDScriptLanguage::debug_parse_stack_level_expression(int p_level, const String &p_expression, int p_max_subitems, int p_max_depth) {
444 List<String> names;

Callers

nothing calls this directly

Calls 7

get_global_arrayMethod · 0.80
has_singletonMethod · 0.45
frontMethod · 0.45
nextMethod · 0.45
getMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected