@@ -2,8 +2,8 @@ import React, { useEffect } from 'react'
22import { Bone , ConeGeometry , Mesh , MeshBasicMaterial , Quaternion , SkeletonHelper , SphereGeometry , Vector3 } from 'three'
33
44import { AVATAR_FILE_ALLOWED_EXTENSIONS } from '@ir-engine/common/src/constants/AvatarConstants'
5- import { createEntity , getChildrenWithComponents , removeEntity } from '@ir-engine/ecs'
6- import { Entity } from '@ir-engine/ecs/src/Entity'
5+ import { createEntity , getChildrenWithComponents , removeEntity , UUIDComponent } from '@ir-engine/ecs'
6+ import { Entity , EntityID , SourceID } from '@ir-engine/ecs/src/Entity'
77import { DndWrapper } from '@ir-engine/editor/src/components/dnd/DndWrapper'
88import { defineState , getMutableState , getState , none , useHookstate } from '@ir-engine/hyperflux'
99
@@ -12,9 +12,8 @@ import { MixamoBoneNames } from '@ir-engine/engine/src/avatar/AvatarBoneMatching
1212import { VRMHumanBoneName } from '@ir-engine/engine/src/avatar/maps/VRMHumanBoneName'
1313import { AssetState } from '@ir-engine/engine/src/gltf/GLTFState'
1414import { ReferenceSpaceState , TransformComponent } from '@ir-engine/spatial'
15- import { NameComponent } from '@ir-engine/spatial/src/common/NameComponent'
1615import { BoneComponent } from '@ir-engine/spatial/src/renderer/components/BoneComponent'
17- import { ObjectComponent , addObjectToGroup } from '@ir-engine/spatial/src/renderer/components/ObjectComponent'
16+ import { addObjectToGroup , ObjectComponent } from '@ir-engine/spatial/src/renderer/components/ObjectComponent'
1817import { VisibleComponent } from '@ir-engine/spatial/src/renderer/components/VisibleComponent'
1918import { Template } from './utils/template'
2019
@@ -254,7 +253,10 @@ const RetargetingDND = () => {
254253 scale : helper . scale
255254 } )
256255 addObjectToGroup ( helperEntity , helper )
257- setComponent ( helperEntity , NameComponent , bone . name + '--helper' )
256+ setComponent ( helperEntity , UUIDComponent , {
257+ entitySourceID : 'helper' as SourceID ,
258+ entityID : ( bone . name + '--helper' ) as EntityID
259+ } )
258260 setComponent ( helperEntity , EntityTreeComponent , { parentEntity : entity } )
259261
260262 if ( bones . includes ( bone . name ) ) getMutableState ( BoneMatchedState ) [ bone . name ] . set ( true )
@@ -285,7 +287,12 @@ const RetargetingDND = () => {
285287 const originalBoneName = useHookstate ( ( ) => bone . name )
286288
287289 const boneHelper = getComponent (
288- NameComponent . getEntitiesByName ( boneName . value + '--helper' ) [ 0 ] ,
290+ UUIDComponent . getEntityByUUID (
291+ UUIDComponent . join ( {
292+ entitySourceID : 'helper' as SourceID ,
293+ entityID : ( boneName . value + '--helper' ) as EntityID
294+ } )
295+ ) ,
289296 ObjectComponent
290297 ) as Mesh < ConeGeometry , MeshBasicMaterial >
291298 const isBone = bone . type === 'Bone'
@@ -301,8 +308,16 @@ const RetargetingDND = () => {
301308 boneHelper . name = name + '--helper'
302309 const currentBoneName = boneName . value as MixamoBoneNames
303310 boneName . set ( name )
304- const helperEntity = NameComponent . getEntitiesByName ( currentBoneName + '--helper' ) [ 0 ]
305- setComponent ( helperEntity , NameComponent , name + '--helper' )
311+ const helperEntity = UUIDComponent . getEntityByUUID (
312+ UUIDComponent . join ( {
313+ entitySourceID : 'helper' as SourceID ,
314+ entityID : ( currentBoneName + '--helper' ) as EntityID
315+ } )
316+ )
317+ setComponent ( helperEntity , UUIDComponent , {
318+ entitySourceID : 'helper' as SourceID ,
319+ entityID : ( name + '--helper' ) as EntityID
320+ } )
306321 }
307322
308323 useEffect ( ( ) => {
0 commit comments