Mono/C#: Fix values not updated in remote inspector
(cherry picked from commit 51e1614d28
)
This commit is contained in:
parent
11d6c0f20d
commit
0da84b50c0
|
@ -2394,15 +2394,22 @@ bool CSharpScript::_update_exports() {
|
||||||
StringName member_name = field->get_name();
|
StringName member_name = field->get_name();
|
||||||
|
|
||||||
member_info[member_name] = prop_info;
|
member_info[member_name] = prop_info;
|
||||||
#ifdef TOOLS_ENABLED
|
|
||||||
if (is_editor && exported) {
|
|
||||||
exported_members_cache.push_front(prop_info);
|
|
||||||
|
|
||||||
if (tmp_object) {
|
if (exported) {
|
||||||
exported_members_defval_cache[member_name] = GDMonoMarshal::mono_object_to_variant(field->get_value(tmp_object));
|
#ifdef TOOLS_ENABLED
|
||||||
|
if (is_editor) {
|
||||||
|
exported_members_cache.push_front(prop_info);
|
||||||
|
|
||||||
|
if (tmp_object) {
|
||||||
|
exported_members_defval_cache[member_name] = GDMonoMarshal::mono_object_to_variant(field->get_value(tmp_object));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(TOOLS_ENABLED) || defined(DEBUG_ENABLED)
|
||||||
|
exported_members_names.insert(member_name);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2415,22 +2422,28 @@ bool CSharpScript::_update_exports() {
|
||||||
StringName member_name = property->get_name();
|
StringName member_name = property->get_name();
|
||||||
|
|
||||||
member_info[member_name] = prop_info;
|
member_info[member_name] = prop_info;
|
||||||
#ifdef TOOLS_ENABLED
|
|
||||||
if (is_editor && exported) {
|
|
||||||
exported_members_cache.push_front(prop_info);
|
|
||||||
|
|
||||||
if (tmp_object) {
|
if (exported) {
|
||||||
MonoException *exc = NULL;
|
#ifdef TOOLS_ENABLED
|
||||||
MonoObject *ret = property->get_value(tmp_object, &exc);
|
if (is_editor) {
|
||||||
if (exc) {
|
exported_members_cache.push_front(prop_info);
|
||||||
exported_members_defval_cache[member_name] = Variant();
|
if (tmp_object) {
|
||||||
GDMonoUtils::debug_print_unhandled_exception(exc);
|
MonoException *exc = nullptr;
|
||||||
} else {
|
MonoObject *ret = property->get_value(tmp_object, &exc);
|
||||||
exported_members_defval_cache[member_name] = GDMonoMarshal::mono_object_to_variant(ret);
|
if (exc) {
|
||||||
|
exported_members_defval_cache[member_name] = Variant();
|
||||||
|
GDMonoUtils::debug_print_unhandled_exception(exc);
|
||||||
|
} else {
|
||||||
|
exported_members_defval_cache[member_name] = GDMonoMarshal::mono_object_to_variant(ret);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(TOOLS_ENABLED) || defined(DEBUG_ENABLED)
|
||||||
|
exported_members_names.insert(member_name);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3388,6 +3401,16 @@ CSharpScript::~CSharpScript() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSharpScript::get_members(Set<StringName> *p_members) {
|
||||||
|
#if defined(TOOLS_ENABLED) || defined(DEBUG_ENABLED)
|
||||||
|
if (p_members) {
|
||||||
|
for (Set<StringName>::Element *E = exported_members_names.front(); E; E = E->next()) {
|
||||||
|
p_members->insert(E->get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/*************** RESOURCE ***************/
|
/*************** RESOURCE ***************/
|
||||||
|
|
||||||
RES ResourceFormatLoaderCSharpScript::load(const String &p_path, const String &p_original_path, Error *r_error) {
|
RES ResourceFormatLoaderCSharpScript::load(const String &p_path, const String &p_original_path, Error *r_error) {
|
||||||
|
|
|
@ -125,6 +125,10 @@ class CSharpScript : public Script {
|
||||||
virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder);
|
virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(TOOLS_ENABLED) || defined(DEBUG_ENABLED)
|
||||||
|
Set<StringName> exported_members_names;
|
||||||
|
#endif
|
||||||
|
|
||||||
Map<StringName, PropertyInfo> member_info;
|
Map<StringName, PropertyInfo> member_info;
|
||||||
|
|
||||||
void _clear();
|
void _clear();
|
||||||
|
@ -175,6 +179,8 @@ public:
|
||||||
virtual void get_script_property_list(List<PropertyInfo> *p_list) const;
|
virtual void get_script_property_list(List<PropertyInfo> *p_list) const;
|
||||||
virtual void update_exports();
|
virtual void update_exports();
|
||||||
|
|
||||||
|
void get_members(Set<StringName> *p_members) override;
|
||||||
|
|
||||||
virtual bool is_tool() const { return tool; }
|
virtual bool is_tool() const { return tool; }
|
||||||
virtual bool is_valid() const { return valid; }
|
virtual bool is_valid() const { return valid; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue