Parcourir la source

fix: removed key split on buffer geometry attributes

alvarosabu il y a 2 ans
Parent
commit
a29cb2bb90
1 fichiers modifiés avec 4 ajouts et 6 suppressions
  1. 4 6
      src/core/nodeOps.ts

+ 4 - 6
src/core/nodeOps.ts

@@ -119,7 +119,6 @@ export const nodeOps: RendererOptions<TresObject, TresObject> = {
   },
   },
   patchProp(node, prop, _prevValue, nextValue) {
   patchProp(node, prop, _prevValue, nextValue) {
     if (node) {
     if (node) {
-      
       let root = node
       let root = node
       let key = prop
       let key = prop
       const camelKey = kebabToCamel(key)
       const camelKey = kebabToCamel(key)
@@ -129,13 +128,12 @@ export const nodeOps: RendererOptions<TresObject, TresObject> = {
         node.parent = scene as TresObject
         node.parent = scene as TresObject
       }
       }
 
 
-      if(root.type === 'BufferGeometry') {
-        const chain = key.split('-')
-        key = chain.pop() as string
+      if (root.type === 'BufferGeometry') {
         root.setAttribute(
         root.setAttribute(
-          kebabToCamel(key), 
-          new BufferAttribute(...(nextValue as ConstructorParameters<typeof BufferAttribute>))
+          kebabToCamel(key),
+          new BufferAttribute(...(nextValue as ConstructorParameters<typeof BufferAttribute>)),
         )
         )
+        return
       }
       }
 
 
       // Traverse pierced props (e.g. foo-bar=value => foo.bar = value)
       // Traverse pierced props (e.g. foo-bar=value => foo.bar = value)