diff options
-rw-r--r-- | js/controllers/objects-controller.js | 37 | ||||
-rw-r--r-- | js/panels/binding/binding-item.reel/binding-item.js | 10 |
2 files changed, 41 insertions, 6 deletions
diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index 2c9f2d66..32f24d5c 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js | |||
@@ -113,12 +113,38 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { | |||
113 | 113 | ||
114 | /* ---- Bindable Properties ---- */ | 114 | /* ---- Bindable Properties ---- */ |
115 | 115 | ||
116 | getEnumerableProperties : { | 116 | getPropertyList : { |
117 | value: function(object, excludeUnderscoreProperties) { | 117 | value: function(object, excludeUnderscoreProperties) { |
118 | var object_i = object, | ||
119 | prototypes = [object_i]; | ||
120 | |||
121 | ///// Collect prototypes | ||
122 | while(Object.getPrototypeOf(object_i)) { | ||
123 | object_i = Object.getPrototypeOf(object_i); | ||
124 | prototypes.push(object_i); | ||
125 | } | ||
126 | |||
127 | return prototypes.map(function(proto) { | ||
128 | var metadata = proto._montage_metadata, | ||
129 | objectName = (metadata) ? metadata.objectName : "Object"; | ||
130 | |||
131 | return { | ||
132 | category : objectName, | ||
133 | properties : this.getPropertiesFromObject(proto) | ||
134 | }; | ||
135 | }, this); | ||
136 | |||
137 | } | ||
138 | }, | ||
139 | |||
140 | getPropertiesFromObject : { | ||
141 | value: function (object, excludeUnderscoreProperties) { | ||
118 | var properties = []; | 142 | var properties = []; |
119 | 143 | ||
120 | for(var key in object) { | 144 | for(var key in object) { |
121 | properties.push(key); | 145 | if(object.hasOwnProperty(key)) { |
146 | properties.push(key); | ||
147 | } | ||
122 | } | 148 | } |
123 | 149 | ||
124 | if(excludeUnderscoreProperties) { | 150 | if(excludeUnderscoreProperties) { |
@@ -146,7 +172,12 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { | |||
146 | set: function(value) { | 172 | set: function(value) { |
147 | if(value === this._currentObject) { return; } | 173 | if(value === this._currentObject) { return; } |
148 | 174 | ||
149 | this.currentObjectBindings = this.getObjectBindings(value); | 175 | if(value) { |
176 | this.currentObjectBindings = this.getObjectBindings(value); | ||
177 | console.log("Property list", this.getPropertyList(value, true)); | ||
178 | } else { | ||
179 | this.currentObjectBindings = []; | ||
180 | } | ||
150 | 181 | ||
151 | this._currentObject = value; | 182 | this._currentObject = value; |
152 | } | 183 | } |
diff --git a/js/panels/binding/binding-item.reel/binding-item.js b/js/panels/binding/binding-item.reel/binding-item.js index 294e8d35..55230fc3 100644 --- a/js/panels/binding/binding-item.reel/binding-item.js +++ b/js/panels/binding/binding-item.reel/binding-item.js | |||
@@ -20,8 +20,10 @@ exports.BindingItem = Montage.create(Component, { | |||
20 | set: function(value) { | 20 | set: function(value) { |
21 | if(value === this._sourceObject) { return; } | 21 | if(value === this._sourceObject) { return; } |
22 | 22 | ||
23 | this.sourceObjectLabel = value.identifier; | 23 | if(value && value.identifier) { |
24 | 24 | this.sourceObjectLabel = value.identifier; | |
25 | } | ||
26 | |||
25 | this._sourceObject = value; | 27 | this._sourceObject = value; |
26 | } | 28 | } |
27 | }, | 29 | }, |
@@ -33,7 +35,9 @@ exports.BindingItem = Montage.create(Component, { | |||
33 | set: function(value) { | 35 | set: function(value) { |
34 | if(value === this._boundObject) { return; } | 36 | if(value === this._boundObject) { return; } |
35 | 37 | ||
36 | this.boundObjectLabel = value.identifier; | 38 | if(value && value.identifier) { |
39 | this.boundObjectLabel = value.identifier; | ||
40 | } | ||
37 | 41 | ||
38 | this._boundObject = value; | 42 | this._boundObject = value; |
39 | } | 43 | } |