From 40db285bfd5e3299b8e94931bed453b2a583d964 Mon Sep 17 00:00:00 2001 From: 06wj <06wj@163.com> Date: Thu, 10 Sep 2020 14:25:01 +0800 Subject: [PATCH] feat: add userData property to Node,Geometry,Material and Skeleton --- src/core/Node.js | 7 +++++++ src/core/Skeleton.js | 8 ++++++++ src/geometry/Geometry.js | 7 +++++++ src/material/Material.js | 7 +++++++ 4 files changed, 29 insertions(+) diff --git a/src/core/Node.js b/src/core/Node.js index c6517d0b..dd5691ab 100644 --- a/src/core/Node.js +++ b/src/core/Node.js @@ -143,6 +143,13 @@ const Node = Class.create(/** @lends Node.prototype */ { */ useHandCursor: false, + /** + * 用户数据 + * @default null + * @type {any} + */ + userData: null, + /** * 是否强制使用父元素 worldMatrix,供高级开发者使用 * @private diff --git a/src/core/Skeleton.js b/src/core/Skeleton.js index ad7ee561..528ad0e8 100644 --- a/src/core/Skeleton.js +++ b/src/core/Skeleton.js @@ -18,6 +18,14 @@ const Skeleton = Class.create(/** @lends Skeleton.prototype */ { * @type {String} */ className: 'Skeleton', + + /** + * 用户数据 + * @default null + * @type {any} + */ + userData: null, + /** * @constructs * @param {Object} [params] 创建对象的属性参数。可包含此类的所有属性。 diff --git a/src/geometry/Geometry.js b/src/geometry/Geometry.js index 4fbcbbc1..4d358438 100644 --- a/src/geometry/Geometry.js +++ b/src/geometry/Geometry.js @@ -135,6 +135,13 @@ const Geometry = Class.create(/** @lends Geometry.prototype */ { */ useAABBRaycast: false, + /** + * 用户数据 + * @default null + * @type {any} + */ + userData: null, + /** * @constructs * @param {object} [params] 初始化参数,所有params都会复制到实例上 diff --git a/src/material/Material.js b/src/material/Material.js index fa0ad5c5..0c54fc5c 100644 --- a/src/material/Material.js +++ b/src/material/Material.js @@ -145,6 +145,13 @@ const Material = Class.create(/** @lends Material.prototype */ { */ isDiffuesEnvAndAmbientLightWorkTogether: false, + /** + * 用户数据 + * @default null + * @type {any} + */ + userData: null, + /** * 渲染顺序数字小的先渲染(透明物体和不透明在不同的队列) * @default 0