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

Method get

modules/gdscript/gdscript.cpp:1763–1848  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1761}
1762
1763bool GDScriptInstance::get(const StringName &p_name, Variant &r_ret) const {
1764 {
1765 HashMap<StringName, GDScript::MemberInfo>::ConstIterator E = script->member_indices.find(p_name);
1766 if (E) {
1767 if (likely(script->valid) && E->value.getter) {
1768 Callable::CallError err;
1769 const Variant ret = const_cast<GDScriptInstance *>(this)->callp(E->value.getter, nullptr, 0, err);
1770 r_ret = (err.error == Callable::CallError::CALL_OK) ? ret : Variant();
1771 return true;
1772 }
1773 r_ret = members[E->value.index];
1774 return true;
1775 }
1776 }
1777
1778 const GDScript *sptr = script.ptr();
1779 while (sptr) {
1780 {
1781 HashMap<StringName, Variant>::ConstIterator E = sptr->constants.find(p_name);
1782 if (E) {
1783 r_ret = E->value;
1784 return true;
1785 }
1786 }
1787
1788 {
1789 HashMap<StringName, GDScript::MemberInfo>::ConstIterator E = sptr->static_variables_indices.find(p_name);
1790 if (E) {
1791 if (likely(sptr->valid) && E->value.getter) {
1792 Callable::CallError ce;
1793 const Variant ret = const_cast<GDScript *>(sptr)->callp(E->value.getter, nullptr, 0, ce);
1794 r_ret = (ce.error == Callable::CallError::CALL_OK) ? ret : Variant();
1795 return true;
1796 }
1797 r_ret = sptr->static_variables[E->value.index];
1798 return true;
1799 }
1800 }
1801
1802 {
1803 HashMap<StringName, MethodInfo>::ConstIterator E = sptr->_signals.find(p_name);
1804 if (E) {
1805 r_ret = Signal(owner, E->key);
1806 return true;
1807 }
1808 }
1809
1810 if (likely(sptr->valid)) {
1811 HashMap<StringName, GDScriptFunction *>::ConstIterator E = sptr->member_functions.find(p_name);
1812 if (E) {
1813 if (sptr->rpc_config.has(p_name)) {
1814 r_ret = Callable(memnew(GDScriptRPCCallable(owner, E->key)));
1815 } else {
1816 r_ret = Callable(owner, E->key);
1817 }
1818 return true;
1819 }
1820 }

Callers 15

get_packet_modeMethod · 0.45
pollMethod · 0.45
add_peerMethod · 0.45
put_packetMethod · 0.45
get_filesMethod · 0.45
_serialize_meshesMethod · 0.45
_create_skeletonsMethod · 0.45
_create_skinsMethod · 0.45
import_postMethod · 0.45

Calls 10

GDScriptRPCCallableClass · 0.85
VariantClass · 0.50
SignalClass · 0.50
CallableClass · 0.50
findMethod · 0.45
callpMethod · 0.45
ptrMethod · 0.45
hasMethod · 0.45
callMethod · 0.45
get_typeMethod · 0.45

Tested by 5

testFunction · 0.36
match_optionFunction · 0.36
test_directoryFunction · 0.36
handle_cmdlineMethod · 0.36
execute_test_codeMethod · 0.36