-
-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SkinnedMeshRenderer
support immediate initialization of rootBone
and bones
#1672
Conversation
* dev/1.1: (43 commits) fix: skin mesh error (galacean#1675) fix: test error (galacean#1674) test: fix github test (galacean#1669) test: fix ci not work (galacean#1670) glTF support basisu (galacean#1662) fix: `EventDispatcher` static pool bug fix: eventdispatcher bug (galacean#1671) fix: animation event bug (galacean#1666) Fix parse glTF texture wrap & filterMode bug (galacean#1659) Fix text wrap bug (galacean#1644) chore: use strict error msg and type (galacean#1647) Fix text error for set text to "" and set enableWrapping to true (galacean#1634) "v1.0.0-beta.17" Process GLTFBufferParser and GLTFTextureParser pipelines in parallel (galacean#1638) Fix animation clip loader, clip change promise to assetPromise, controller json parse (galacean#1506) fix: the layer is not cloned when the node is cloned (galacean#1636) Fix glTF texture mipmap bug (galacean#1637) "v1.0.0-beta.16" Adjust main light to directional lights first (galacean#1635) Fix `AmbientLight` can't destroy bug (galacean#1633) ...
@@ -173,10 +182,10 @@ export class SkinnedMeshRenderer extends MeshRenderer { | |||
const blendShapeManager = mesh._blendShapeManager; | |||
blendShapeManager._updateShaderData(shaderData, this); | |||
|
|||
const skin = this._skin; | |||
if (skin) { | |||
const bones = this.bones; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this._bones
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* @internal | ||
*/ | ||
private _getEntityByHierarchyPath(rootEntity: Entity, inversePath: number[]): Entity { | ||
let sprite = rootEntity; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sprite ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
private _skin: Skin; | ||
|
||
/** | ||
* @deprecated | ||
* Skin Object. | ||
*/ | ||
get skin(): Skin { | ||
return this._skin; | ||
} | ||
|
||
set skin(value: Skin) { | ||
this._skin = value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should set renderer's bones
and rootBond
if you want adapter deprecated method
private _getEntityHierarchyPath(rootEntity: Entity, searchEntity: Entity, inversePath: number[]): boolean { | ||
inversePath.length = 0; | ||
let entity = searchEntity; | ||
while (entity !== rootEntity) { | ||
const parent = entity.parent; | ||
if (parent) { | ||
inversePath.push(entity.siblingIndex); | ||
} else { | ||
return false; | ||
} | ||
entity = parent; | ||
} | ||
return true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private _getEntityHierarchyPath(rootEntity: Entity, searchEntity: Entity, inversePath: number[]): boolean {
inversePath.length = 0;
while (searchEntity !== rootEntity) {
if (!searchEntity.parent) {
return false;
}
inversePath.push(searchEntity.siblingIndex);
searchEntity = searchEntity.parent;
}
return true;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -244,8 +253,25 @@ export class SkinnedMeshRenderer extends MeshRenderer { | |||
/** | |||
* @internal | |||
*/ | |||
override _cloneTo(target: SkinnedMeshRenderer): void { | |||
super._cloneTo(target); | |||
override _cloneTo(target: SkinnedMeshRenderer, srcRoot: Entity, targetRoot: Entity): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merge error, if(this._jointEntities)
-> if(this._bones)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
public joints: string[]; | ||
public skeleton: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
joints
and skeleton
are not used now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep readonly
skin.skeleton = entities[skeleton].name; | ||
const rootBone = entities[skeleton]; | ||
skin.rootBone = rootBone; | ||
skin.skeleton = rootBone.name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete
} else { | ||
const rootBone = this._findSkeletonRootBone(joints, entities); | ||
if (rootBone) { | ||
skin.rootBone = rootBone; | ||
skin.skeleton = rootBone.name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete
tests/src/loader/GLTFLoader.test.ts
Outdated
@@ -420,5 +420,12 @@ describe("glTF Loader test", function () { | |||
const renderer = entities[1].getComponent(SkinnedMeshRenderer); | |||
expect(renderer).to.exist; | |||
expect(renderer.blendShapeWeights).to.deep.include([1, 1]); | |||
// expect(renderer.rootBone).to.equal(); | |||
// expect(renderer.bones).to.equal(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
tests/src/loader/GLTFLoader.test.ts
Outdated
glTFResource.destroy(); | ||
expect(glTFResource.materials).to.be.null; | ||
expect(glTFResource.textures).to.be.null; | ||
expect(glTFResource.entities).to.be.null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merge error, delete it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
…ine into PR/fix-skin-lazy
…ine into PR/fix-skin-lazy
SkinnedMeshRenderer
support immediate initializationSkinnedMeshRenderer
support immediate initialization(rootBone, bones)
SkinnedMeshRenderer
support immediate initialization(rootBone, bones)SkinnedMeshRenderer
support immediate initialization of rootBone
and bones
* dev/1.1: `SkinnedMeshRenderer` support immediate initialization of `rootBone` and `bones` (galacean#1672) Support camera depth texture (galacean#1658)
* dev/1.1: (66 commits) build: fix pnpm lock file build: fix pnpm-lock file build: fix pnpm-lock file build: fix build error `ResourceManager` support `findResourcesByType` (galacean#1700) fix: memory leak of Transform (galacean#1701) fix: file name error "v1.1.0-alpha.1" test(RenderTarget): fix `getColorTexture` error Fix ktx2 loader can't throw error (galacean#1699) Enhance type for `LoadItem` & `Entity.getComponent` (galacean#1696) types: opt getComponent return type types: fix lint Fix ci test (galacean#1677) Shader Lab support `RenderState` (galacean#1664) feat: enhance type for `LoadItem` & `Entity.getComponent` fix: variable error (galacean#1693) `SkinnedMeshRenderer` support immediate initialization of `rootBone` and `bones` (galacean#1672) Support camera depth texture (galacean#1658) "v1.0.0-beta.18" ... # Conflicts: # packages/loader/src/gltf/parser/GLTFSceneParser.ts # packages/loader/src/gltf/parser/GLTFSkinParser.ts # tests/src/loader/GLTFLoader.test.ts
Please check if the PR fulfills these requirements
Feat:
rootBone
at anytimeSkinnedMeshRenderer
support custombones