|
@@ -167,7 +167,7 @@ var INSPECTOR;
|
|
* If a format function exists, returns the result of this function.
|
|
* If a format function exists, returns the result of this function.
|
|
* If this function doesn't exists, return the object type instead */
|
|
* If this function doesn't exists, return the object type instead */
|
|
format: function (obj) {
|
|
format: function (obj) {
|
|
- var type = INSPECTOR.Helpers.GET_TYPE(obj) || 'default';
|
|
|
|
|
|
+ var type = INSPECTOR.Helpers.GET_TYPE(obj) || 'type_not_defined';
|
|
if (INSPECTOR.PROPERTIES[type] && INSPECTOR.PROPERTIES[type].format) {
|
|
if (INSPECTOR.PROPERTIES[type] && INSPECTOR.PROPERTIES[type].format) {
|
|
return INSPECTOR.PROPERTIES[type].format(obj);
|
|
return INSPECTOR.PROPERTIES[type].format(obj);
|
|
}
|
|
}
|
|
@@ -175,26 +175,36 @@ var INSPECTOR;
|
|
return INSPECTOR.Helpers.GET_TYPE(obj);
|
|
return INSPECTOR.Helpers.GET_TYPE(obj);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ 'type_not_defined': {
|
|
|
|
+ properties: [],
|
|
|
|
+ format: function () { return ''; }
|
|
|
|
+ },
|
|
'Vector2': {
|
|
'Vector2': {
|
|
|
|
+ type: BABYLON.Vector2,
|
|
properties: ['x', 'y'],
|
|
properties: ['x', 'y'],
|
|
format: function (vec) { return "x:" + INSPECTOR.Helpers.Trunc(vec.x) + ", y:" + INSPECTOR.Helpers.Trunc(vec.y); }
|
|
format: function (vec) { return "x:" + INSPECTOR.Helpers.Trunc(vec.x) + ", y:" + INSPECTOR.Helpers.Trunc(vec.y); }
|
|
},
|
|
},
|
|
'Vector3': {
|
|
'Vector3': {
|
|
|
|
+ type: BABYLON.Vector3,
|
|
properties: ['x', 'y', 'z'],
|
|
properties: ['x', 'y', 'z'],
|
|
format: function (vec) { return "x:" + INSPECTOR.Helpers.Trunc(vec.x) + ", y:" + INSPECTOR.Helpers.Trunc(vec.y) + ", z:" + INSPECTOR.Helpers.Trunc(vec.z); }
|
|
format: function (vec) { return "x:" + INSPECTOR.Helpers.Trunc(vec.x) + ", y:" + INSPECTOR.Helpers.Trunc(vec.y) + ", z:" + INSPECTOR.Helpers.Trunc(vec.z); }
|
|
},
|
|
},
|
|
'Color3': {
|
|
'Color3': {
|
|
|
|
+ type: BABYLON.Color3,
|
|
properties: ['r', 'g', 'b'],
|
|
properties: ['r', 'g', 'b'],
|
|
format: function (color) { return "R:" + color.r + ", G:" + color.g + ", B:" + color.b; }
|
|
format: function (color) { return "R:" + color.r + ", G:" + color.g + ", B:" + color.b; }
|
|
},
|
|
},
|
|
'Quaternion': {
|
|
'Quaternion': {
|
|
|
|
+ type: BABYLON.Quaternion,
|
|
properties: ['x', 'y', 'z', 'w']
|
|
properties: ['x', 'y', 'z', 'w']
|
|
},
|
|
},
|
|
'Size': {
|
|
'Size': {
|
|
|
|
+ type: BABYLON.Size,
|
|
properties: ['width', 'height'],
|
|
properties: ['width', 'height'],
|
|
format: function (size) { return "Size - w:" + INSPECTOR.Helpers.Trunc(size.width) + ", h:" + INSPECTOR.Helpers.Trunc(size.height); }
|
|
format: function (size) { return "Size - w:" + INSPECTOR.Helpers.Trunc(size.width) + ", h:" + INSPECTOR.Helpers.Trunc(size.height); }
|
|
},
|
|
},
|
|
'Texture': {
|
|
'Texture': {
|
|
|
|
+ type: BABYLON.Texture,
|
|
properties: [
|
|
properties: [
|
|
'hasAlpha',
|
|
'hasAlpha',
|
|
'level',
|
|
'level',
|
|
@@ -211,12 +221,15 @@ var INSPECTOR;
|
|
],
|
|
],
|
|
},
|
|
},
|
|
'ArcRotateCamera': {
|
|
'ArcRotateCamera': {
|
|
|
|
+ // type: BABYLON.ArcRotateCamera,
|
|
properties: ['alpha', 'beta', 'radius']
|
|
properties: ['alpha', 'beta', 'radius']
|
|
},
|
|
},
|
|
'Scene': {
|
|
'Scene': {
|
|
|
|
+ type: BABYLON.Scene,
|
|
properties: ['actionManager', 'activeCamera', 'ambientColor', 'clearColor']
|
|
properties: ['actionManager', 'activeCamera', 'ambientColor', 'clearColor']
|
|
},
|
|
},
|
|
'Mesh': {
|
|
'Mesh': {
|
|
|
|
+ type: BABYLON.Mesh,
|
|
properties: [
|
|
properties: [
|
|
'name',
|
|
'name',
|
|
'position',
|
|
'position',
|
|
@@ -228,6 +241,7 @@ var INSPECTOR;
|
|
format: function (m) { return m.name; }
|
|
format: function (m) { return m.name; }
|
|
},
|
|
},
|
|
'StandardMaterial': {
|
|
'StandardMaterial': {
|
|
|
|
+ type: BABYLON.StandardMaterial,
|
|
properties: [
|
|
properties: [
|
|
'name',
|
|
'name',
|
|
'alpha',
|
|
'alpha',
|
|
@@ -261,21 +275,27 @@ var INSPECTOR;
|
|
format: function (mat) { return mat.name; }
|
|
format: function (mat) { return mat.name; }
|
|
},
|
|
},
|
|
'PrimitiveAlignment': {
|
|
'PrimitiveAlignment': {
|
|
|
|
+ type: BABYLON.PrimitiveAlignment,
|
|
properties: ['horizontal', 'vertical']
|
|
properties: ['horizontal', 'vertical']
|
|
},
|
|
},
|
|
'PrimitiveThickness': {
|
|
'PrimitiveThickness': {
|
|
|
|
+ type: BABYLON.PrimitiveThickness,
|
|
properties: ['topPixels', 'leftPixels', 'rightPixels', 'bottomPixels']
|
|
properties: ['topPixels', 'leftPixels', 'rightPixels', 'bottomPixels']
|
|
},
|
|
},
|
|
'BoundingInfo2D': {
|
|
'BoundingInfo2D': {
|
|
|
|
+ type: BABYLON.BoundingInfo2D,
|
|
properties: ['radius', 'center', 'extent']
|
|
properties: ['radius', 'center', 'extent']
|
|
},
|
|
},
|
|
'SolidColorBrush2D': {
|
|
'SolidColorBrush2D': {
|
|
|
|
+ type: BABYLON.SolidColorBrush2D,
|
|
properties: ['color']
|
|
properties: ['color']
|
|
},
|
|
},
|
|
'GradientColorBrush2D': {
|
|
'GradientColorBrush2D': {
|
|
|
|
+ type: BABYLON.GradientColorBrush2D,
|
|
properties: ['color1', 'color2', 'translation', 'rotation', 'scale']
|
|
properties: ['color1', 'color2', 'translation', 'rotation', 'scale']
|
|
},
|
|
},
|
|
'PBRMaterial': {
|
|
'PBRMaterial': {
|
|
|
|
+ type: BABYLON.PBRMaterial,
|
|
properties: [
|
|
properties: [
|
|
'name',
|
|
'name',
|
|
'albedoColor',
|
|
'albedoColor',
|
|
@@ -1195,7 +1215,7 @@ var INSPECTOR;
|
|
* Returns true if the value is null
|
|
* Returns true if the value is null
|
|
*/
|
|
*/
|
|
PropertyLine.prototype._isSimple = function () {
|
|
PropertyLine.prototype._isSimple = function () {
|
|
- if (this.value != null) {
|
|
|
|
|
|
+ if (this.value != null && this.type !== 'type_not_defined') {
|
|
if (PropertyLine._SIMPLE_TYPE.indexOf(this.type) == -1) {
|
|
if (PropertyLine._SIMPLE_TYPE.indexOf(this.type) == -1) {
|
|
// complex type : return the type name
|
|
// complex type : return the type name
|
|
return false;
|
|
return false;
|
|
@@ -1581,11 +1601,41 @@ var INSPECTOR;
|
|
classname = this._GetFnName(obj.constructor);
|
|
classname = this._GetFnName(obj.constructor);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ // If the class name has no matching properties, check every type
|
|
|
|
+ if (!this._CheckIfTypeExists(classname)) {
|
|
|
|
+ return this._GetTypeFor(obj);
|
|
|
|
+ }
|
|
return classname;
|
|
return classname;
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- return '';
|
|
|
|
|
|
+ return 'type_not_defined';
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
|
|
+ * Check if some properties are defined for the given type.
|
|
|
|
+ */
|
|
|
|
+ Helpers._CheckIfTypeExists = function (type) {
|
|
|
|
+ var properties = INSPECTOR.PROPERTIES[type];
|
|
|
|
+ if (properties) {
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
|
|
+ return false;
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
|
|
+ * Returns the name of the type of the given object, where the name
|
|
|
|
+ * is in PROPERTIES constant.
|
|
|
|
+ * Returns 'Undefined' if no type exists for this object
|
|
|
|
+ */
|
|
|
|
+ Helpers._GetTypeFor = function (obj) {
|
|
|
|
+ for (var type in INSPECTOR.PROPERTIES) {
|
|
|
|
+ var typeBlock = INSPECTOR.PROPERTIES[type];
|
|
|
|
+ if (typeBlock.type) {
|
|
|
|
+ if (obj instanceof typeBlock.type) {
|
|
|
|
+ return type;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return 'type_not_defined';
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
* Returns the name of a function (workaround to get object type for IE11)
|
|
* Returns the name of a function (workaround to get object type for IE11)
|
|
@@ -3139,7 +3189,9 @@ var INSPECTOR;
|
|
// Type
|
|
// Type
|
|
var type = INSPECTOR.Inspector.DOCUMENT.createElement('span');
|
|
var type = INSPECTOR.Inspector.DOCUMENT.createElement('span');
|
|
type.className = 'property-type';
|
|
type.className = 'property-type';
|
|
- type.textContent = ' - ' + this._adapter.type();
|
|
|
|
|
|
+ if (this._adapter.type() !== 'type_not_defined') {
|
|
|
|
+ type.textContent = ' - ' + this._adapter.type();
|
|
|
|
+ }
|
|
this._div.appendChild(type);
|
|
this._div.appendChild(type);
|
|
this._lineContent = INSPECTOR.Helpers.CreateDiv('line-content', this._div);
|
|
this._lineContent = INSPECTOR.Helpers.CreateDiv('line-content', this._div);
|
|
this._addEvent();
|
|
this._addEvent();
|