Skip to content

Commit 0b51bde

Browse files
lawnjellyanvilfolk
andcommitted
Fix inability to assign script after clearing
Co-authored-by: ocean (they/them) <anvilfolk@gmail.com> (cherry picked from commit 287cf32)
1 parent 728f0d1 commit 0b51bde

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

editor/editor_properties.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
#include "editor_properties.h"
3232

33+
#include "core/core_string_names.h"
3334
#include "editor/editor_resource_preview.h"
3435
#include "editor/filesystem_dock.h"
3536
#include "editor/project_settings_editor.h"
@@ -2617,8 +2618,11 @@ void EditorPropertyResource::_resource_selected(const RES &p_resource, bool p_ed
26172618
void EditorPropertyResource::_resource_changed(const RES &p_resource) {
26182619
// Make visual script the correct type.
26192620
Ref<Script> s = p_resource;
2621+
2622+
// The bool is_script applies only to an object's main script.
2623+
// Changing the value of Script-type exported variables of the main script should not trigger saving/reloading properties.
26202624
bool is_script = false;
2621-
if (get_edited_object() && s.is_valid()) {
2625+
if (get_edited_object() && s.is_valid() && get_edited_property() == CoreStringNames::get_singleton()->_script) {
26222626
is_script = true;
26232627
EditorNode::get_singleton()->get_inspector_dock()->store_script_properties(get_edited_object());
26242628
s->call("set_instance_base_type", get_edited_object()->get_class());

0 commit comments

Comments
 (0)