From f36a5289c9ac6a79880dc0cc10bb84daf3608929 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 17 Apr 2018 14:33:11 +1200 Subject: [PATCH] Add Entities materialData JSDoc --- libraries/entities/src/EntityItemProperties.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index f78168b05d..4638b46437 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -695,8 +695,8 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { * @typedef {object} Entities.EntityProperties-Material * @property {string} materialURL="" - URL to a {@link MaterialResource}. If you append ?name to the URL, the * material with that name in the {@link MaterialResource} will be applied to the entity.
- * Alternatively, set the property value to "userData" to use the {@link Entities.EntityProperties|userData} - * entity property to live edit the material resource values. + * Alternatively, set the property value to "materialData" to use the materialData property + * for the {@link MaterialResource} values. * @property {number} priority=0 - The priority for applying the material to its parent. Only the highest priority material is * applied, with materials of the same priority randomly assigned. Materials that come with the model have a priority of * 0. @@ -710,6 +710,9 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { * { x: 0, y: 0 }{ x: 1, y: 1 }. * @property {Vec2} materialMappingScale=1,1 - How much to scale the material within the parent's UV-space. * @property {number} materialMappingRot=0 - How much to rotate the material within the parent's UV-space, in degrees. + * @property {string} materialData="" - Used to store {@link MaterialResource} data as a JSON string. You can use + * JSON.parse() to parse the string into a JavaScript object which you can manipulate the properties of, and + * use JSON.stringify() to convert the object into a string to put in the property. * @example Color a sphere using a Material entity. * var entityID = Entities.addEntity({ * type: "Sphere", @@ -722,13 +725,14 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { * var materialID = Entities.addEntity({ * type: "Material", * parentID: entityID, - * materialURL: "userData", + * materialURL: "materialData", * priority: 1, - * userData: JSON.stringify({ + * materialData: JSON.stringify({ + * materialVersion: 1, * materials: { * // Can only set albedo on a Shape entity. * // Value overrides entity's "color" property. - * albedo: [1.0, 0, 0] + * albedo: [1.0, 1.0, 0] // Yellow * } * }), * });