浏览代码

Merge pull request #111622 from YeldhamDev/you_arent_that_special_to_show_twice

Don't show exported script variables twice in the remote inspector
Rémi Verschelde 2 周之前
父节点
当前提交
32249f87a4
共有 1 个文件被更改,包括 15 次插入1 次删除
  1. 15 1
      scene/debugger/scene_debugger.cpp

+ 15 - 1
scene/debugger/scene_debugger.cpp

@@ -751,7 +751,7 @@ SceneDebuggerObject::SceneDebuggerObject(Object *p_obj) {
 	class_name = p_obj->get_class();
 	class_name = p_obj->get_class();
 
 
 	if (ScriptInstance *si = p_obj->get_script_instance()) {
 	if (ScriptInstance *si = p_obj->get_script_instance()) {
-		// Read script instance constants and variables
+		// Read script instance constants and variables.
 		if (!si->get_script().is_null()) {
 		if (!si->get_script().is_null()) {
 			Script *s = si->get_script().ptr();
 			Script *s = si->get_script().ptr();
 			_parse_script_properties(s, si);
 			_parse_script_properties(s, si);
@@ -815,9 +815,23 @@ void SceneDebuggerObject::_parse_script_properties(Script *p_script, ScriptInsta
 		base = base->get_base_script();
 		base = base->get_base_script();
 	}
 	}
 
 
+	HashSet<String> exported_members;
+
+	List<PropertyInfo> pinfo;
+	p_instance->get_property_list(&pinfo);
+	for (const PropertyInfo &E : pinfo) {
+		if (E.usage & (PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CATEGORY)) {
+			exported_members.insert(E.name);
+		}
+	}
+
 	// Members
 	// Members
 	for (KeyValue<const Script *, HashSet<StringName>> sm : members) {
 	for (KeyValue<const Script *, HashSet<StringName>> sm : members) {
 		for (const StringName &E : sm.value) {
 		for (const StringName &E : sm.value) {
+			if (exported_members.has(E)) {
+				continue; // Exported variables already show up in the inspector.
+			}
+
 			Variant m;
 			Variant m;
 			if (p_instance->get(E, m)) {
 			if (p_instance->get(E, m)) {
 				String script_path = sm.key == p_script ? "" : sm.key->get_path().get_file() + "/";
 				String script_path = sm.key == p_script ? "" : sm.key->get_path().get_file() + "/";