Browse Source

Handle editing of JSComponent when multiselecting

Josh Engebretson 10 years ago
parent
commit
ce12aa7499

+ 3 - 6
Script/AtomicEditor/ui/frames/inspector/AttributeInfoEdit.ts

@@ -392,11 +392,8 @@ class FloatAttributeEdit extends AttributeInfoEdit {
             var object = this.editType.getFirstObject();
             var object = this.editType.getFirstObject();
             if (object) {
             if (object) {
 
 
-                var value = object.getAttribute(this.attrInfo.name);
-
                 var widget = this.editWidget;
                 var widget = this.editWidget;
                 var attrInfo = this.attrInfo;
                 var attrInfo = this.attrInfo;
-
                 var value = object.getAttribute(attrInfo.name);
                 var value = object.getAttribute(attrInfo.name);
                 widget.text = parseFloat(value.toFixed(5)).toString();
                 widget.text = parseFloat(value.toFixed(5)).toString();
 
 
@@ -541,11 +538,11 @@ class NumberArrayAttributeEdit extends AttributeInfoEdit {
 
 
             if (captured) {
             if (captured) {
 
 
-              var index = Number(ev.target.id) - 1;
-              this.editType.onAttributeInfoEdited(this.attrInfo, ev.target.value, index, false);
+                var index = Number(ev.target.id) - 1;
+                this.editType.onAttributeInfoEdited(this.attrInfo, ev.target.value, index, false);
 
 
             }
             }
-            
+
             return true;
             return true;
         }
         }
 
 

+ 3 - 6
Script/AtomicEditor/ui/frames/inspector/SelectionEditTypes.ts

@@ -5,17 +5,14 @@ import SelectionInspector = require("./SelectionInspector");
 
 
 class JSComponentEditType extends SerializableEditType {
 class JSComponentEditType extends SerializableEditType {
 
 
-    compareTypes(otherType: SerializableEditType): boolean {
+    compareTypes(otherType: SerializableEditType, multiSelect: boolean = false): boolean {
 
 
         if (this.typeName != otherType.typeName) {
         if (this.typeName != otherType.typeName) {
             return false;
             return false;
         }
         }
 
 
-        if (!otherType.objects.length || !this.objects.length) {
-
-          return false;
-
-        }
+        if (!multiSelect)
+            return false;
 
 
         var jsc1 = <Atomic.JSComponent>(otherType.objects[0]);
         var jsc1 = <Atomic.JSComponent>(otherType.objects[0]);
         var jsc2 = <Atomic.JSComponent>(this.objects[0]);
         var jsc2 = <Atomic.JSComponent>(this.objects[0]);

+ 1 - 1
Script/AtomicEditor/ui/frames/inspector/SelectionInspector.ts

@@ -283,7 +283,7 @@ class SelectionInspector extends ScriptWidget {
 
 
             var e = section.editType;
             var e = section.editType;
 
 
-            if (e.compareTypes(editType)) {
+            if (e.compareTypes(editType, this.nodes.length > 1)) {
                 e.addSerializable(serial);
                 e.addSerializable(serial);
                 return e;
                 return e;
             }
             }

+ 1 - 1
Script/AtomicEditor/ui/frames/inspector/SerializableEditType.ts

@@ -109,7 +109,7 @@ class SerializableEditType {
 
 
     }
     }
 
 
-    compareTypes(otherType: SerializableEditType): boolean {
+    compareTypes(otherType: SerializableEditType, multiSelect:boolean = false): boolean {
 
 
         return this.typeName == otherType.typeName;
         return this.typeName == otherType.typeName;