Skip to content

Commit

Permalink
Fixing random JSDoc issues (#6392)
Browse files Browse the repository at this point in the history
* Fixing random JSDoc issues that cause spam or other issues in RTI.js logs

* Update src/scene/skin-instance.js

Co-authored-by: Will Eastcott <willeastcott@gmail.com>

* src/scene/skin-instance.js: add @ignore

* ForwardRenderer fix for: error TS1016: A required parameter cannot follow an optional parameter.

---------

Co-authored-by: Will Eastcott <willeastcott@gmail.com>
  • Loading branch information
kungfooman and willeastcott committed May 17, 2024
1 parent 480023f commit e3217c4
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/framework/asset/asset-reference.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class AssetReference {
* Get or set the asset url which this references. One of either id or url must be called to
* initialize an asset reference.
*
* @type {string}
* @type {string|null}
*/
set url(value) {
if (this.id) throw Error('Can\'t set id and url');
Expand Down
2 changes: 1 addition & 1 deletion src/framework/components/button/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ class ButtonComponent extends Component {
* Padding to be used in hit-test calculations. Can be used to expand the bounding box so that
* the button is easier to tap.
*
* @type {import('../../../core/math/vec4.js')}
* @type {import('../../../core/math/vec4.js').Vec4}
*/
set hitPadding(arg) {
this._setValue('hitPadding', arg);
Expand Down
2 changes: 1 addition & 1 deletion src/framework/components/camera/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ class CameraComponent extends Component {
/**
* Prepare the camera for frame rendering.
*
* @param {import('../../../platform/graphics/render-target.js').RenderTarget|null} rt - Render
* @param {import('../../../platform/graphics/render-target.js').RenderTarget|null} [rt] - Render
* target to which rendering will be performed. Will affect camera's aspect ratio, if
* aspectRatioMode is {@link ASPECT_AUTO}.
* @ignore
Expand Down
6 changes: 3 additions & 3 deletions src/framework/components/light/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ class LightComponent extends Component {
* Asset that has texture that will be assigned to cookie internally
* once asset resource is available.
*
* @type {number}
* @type {number|null}
*/
set cookieAsset(arg) {
this._setValue('cookieAsset', arg, function (newValue, oldValue) {
Expand Down Expand Up @@ -543,7 +543,7 @@ class LightComponent extends Component {
* Projection texture. Must be 2D for spot and cubemap for omni light
* (ignored if incorrect type is used).
*
* @type {import('../../../platform/graphics/texture.js').Texture}
* @type {import('../../../platform/graphics/texture.js').Texture|null}
*/
set cookie(arg) {
this._setValue('cookie', arg, function (newValue, oldValue) {
Expand Down Expand Up @@ -634,7 +634,7 @@ class LightComponent extends Component {
/**
* Spotlight cookie scale.
*
* @type {import('../../../core/math/vec2.js').Vec2}
* @type {import('../../../core/math/vec2.js').Vec2|null}
*/
set cookieScale(arg) {
this._setValue(
Expand Down
2 changes: 1 addition & 1 deletion src/platform/graphics/graphics-device.js
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ class GraphicsDevice extends EventHandler {
* {@link GraphicsDevice#draw}, the specified index buffer will be used to provide index data
* for any indexed primitives.
*
* @param {import('./index-buffer.js').IndexBuffer} indexBuffer - The index buffer to assign to
* @param {import('./index-buffer.js').IndexBuffer|null} indexBuffer - The index buffer to assign to
* the device.
*/
setIndexBuffer(indexBuffer) {
Expand Down
4 changes: 2 additions & 2 deletions src/scene/graph-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ class GraphNode extends EventHandler {
* of a field then the value passed as the second argument will be checked for equality. If
* this is the name of a function then the return value of the function will be checked for
* equality against the valued passed as the second argument to this function.
* @param {object} [value] - If the first argument (attr) is a property name then this value
* @param {*} [value] - If the first argument (attr) is a property name then this value
* will be checked against the value of the property.
* @returns {GraphNode[]} The array of graph nodes that match the search criteria.
* @example
Expand Down Expand Up @@ -602,7 +602,7 @@ class GraphNode extends EventHandler {
* this is the name of a field then the value passed as the second argument will be checked for
* equality. If this is the name of a function then the return value of the function will be
* checked for equality against the valued passed as the second argument to this function.
* @param {object} [value] - If the first argument (attr) is a property name then this value
* @param {*} [value] - If the first argument (attr) is a property name then this value
* will be checked against the value of the property.
* @returns {GraphNode|null} A graph node that match the search criteria. Returns null if no
* node is found.
Expand Down
4 changes: 2 additions & 2 deletions src/scene/mesh-instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -881,8 +881,8 @@ class MeshInstance {
* over parameter of the same name if set on Material this mesh instance uses for rendering.
*
* @param {string} name - The name of the parameter to set.
* @param {number|number[]|import('../platform/graphics/texture.js').Texture} data - The value
* for the specified parameter.
* @param {number|number[]|import('../platform/graphics/texture.js').Texture|Float32Array} data - The
* value for the specified parameter.
* @param {number} [passFlags] - Mask describing which passes the material should be included
* in.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/scene/renderer/forward-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ class ForwardRenderer extends Renderer {
*
* @param {import('../camera.js').Camera} camera - The
* camera.
* @param {import('../../platform/graphics/render-target.js').RenderTarget} renderTarget - The
* @param {import('../../platform/graphics/render-target.js').RenderTarget|undefined} renderTarget - The
* render target.
* @param {import('../layer.js').Layer} layer - The layer.
* @param {boolean} transparent - True if transparent sublayer should be rendered, opaque
Expand Down
15 changes: 13 additions & 2 deletions src/scene/skin-instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,15 @@ class SkinInstance {
}
}

// resolved skin bones to a hierarchy with the rootBone at its root.
// entity parameter specifies the entity used if the bone match is not found in the hierarchy - usually the entity the render component is attached to
/**
* Resolves skin bones to a hierarchy with the rootBone at its root.
*
* @param {import('../framework/entity.js').Entity} rootBone - A reference to the entity to be used as
* the root bone.
* @param {import('../framework/entity.js').Entity} entity - Specifies the entity used if the
* bone match is not found in the hierarchy - usually the entity the render component is attached to.
* @ignore
*/
resolve(rootBone, entity) {

this.rootBone = rootBone;
Expand All @@ -97,6 +104,7 @@ class SkinInstance {
const bones = [];
for (let j = 0; j < skin.boneNames.length; j++) {
const boneName = skin.boneNames[j];
/** @type {import('../framework/entity.js').Entity|import('./graph-node.js').GraphNode|null} */
let bone = rootBone.findByName(boneName);

if (!bone) {
Expand All @@ -109,6 +117,9 @@ class SkinInstance {
this.bones = bones;
}

/**
* @param {import('./skin.js').Skin} skin - The skin.
*/
initSkin(skin) {

this.skin = skin;
Expand Down

0 comments on commit e3217c4

Please sign in to comment.