Skip to content

Commit

Permalink
fix: removed key split on buffer geometry attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarosabu committed Mar 30, 2023
1 parent 1aab6a3 commit a29cb2b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/core/nodeOps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ export const nodeOps: RendererOptions<TresObject, TresObject> = {
},
patchProp(node, prop, _prevValue, nextValue) {
if (node) {

let root = node
let key = prop
const camelKey = kebabToCamel(key)
Expand All @@ -129,13 +128,12 @@ export const nodeOps: RendererOptions<TresObject, 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(
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)
Expand Down

0 comments on commit a29cb2b

Please sign in to comment.