Browse Source

Do not react to TextChanged events when editing a script class name to prevent errors due to incomplete name.

Lasse Öörni 12 years ago
parent
commit
3c5d25bc5b
1 changed files with 6 additions and 1 deletions
  1. 6 1
      Bin/Data/Scripts/Editor/AttributeEditor.as

+ 6 - 1
Bin/Data/Scripts/Editor/AttributeEditor.as

@@ -24,6 +24,9 @@ Color nonEditableTextColor(0.7f, 0.7f, 0.7f);
 String sceneResourcePath = AddTrailingSlash(fileSystem.programDir + "Data");
 String sceneResourcePath = AddTrailingSlash(fileSystem.programDir + "Data");
 bool rememberResourcePath = true;
 bool rememberResourcePath = true;
 
 
+// Exceptions for string attributes that should not be continuously edited
+Array<String> noTextChangedAttrs = {"Class Name", "Script Object Type"};
+
 WeakHandle testAnimState;
 WeakHandle testAnimState;
 
 
 UIElement@ SetEditable(UIElement@ element, bool editable)
 UIElement@ SetEditable(UIElement@ element, bool editable)
@@ -131,7 +134,9 @@ UIElement@ CreateStringAttributeEditor(ListView@ list, Array<Serializable@>@ ser
     UIElement@ parent = CreateAttributeEditorParent(list, info.name, index, subIndex);
     UIElement@ parent = CreateAttributeEditorParent(list, info.name, index, subIndex);
     LineEdit@ attrEdit = CreateAttributeLineEdit(parent, serializables, index, subIndex);
     LineEdit@ attrEdit = CreateAttributeLineEdit(parent, serializables, index, subIndex);
     attrEdit.dragDropMode = DD_TARGET;
     attrEdit.dragDropMode = DD_TARGET;
-    SubscribeToEvent(attrEdit, "TextChanged", "EditAttribute");
+    // Do not subscribe to continuous edits of certain attributes (script class names) to prevent unnecessary errors getting printed
+    if (noTextChangedAttrs.Find(info.name) == -1)
+        SubscribeToEvent(attrEdit, "TextChanged", "EditAttribute");
     SubscribeToEvent(attrEdit, "TextFinished", "EditAttribute");
     SubscribeToEvent(attrEdit, "TextFinished", "EditAttribute");
 
 
     return parent;
     return parent;