|
@@ -3,7 +3,7 @@ import { BufferAttribute } from 'three'
|
|
import { isFunction } from '@alvarosabu/utils'
|
|
import { isFunction } from '@alvarosabu/utils'
|
|
import { useLogger } from '../composables'
|
|
import { useLogger } from '../composables'
|
|
import { catalogue } from './catalogue'
|
|
import { catalogue } from './catalogue'
|
|
-import { isHTMLTag, kebabToCamel } from '../utils'
|
|
|
|
|
|
+import { deepArrayEqual, isHTMLTag, kebabToCamel } from '../utils'
|
|
|
|
|
|
import type { Object3D, Camera } from 'three'
|
|
import type { Object3D, Camera } from 'three'
|
|
import type { TresObject, TresObject3D, TresScene } from '../types'
|
|
import type { TresObject, TresObject3D, TresScene } from '../types'
|
|
@@ -184,6 +184,15 @@ export const nodeOps: RendererOptions<TresObject, TresObject> = {
|
|
let finalKey = kebabToCamel(key)
|
|
let finalKey = kebabToCamel(key)
|
|
let target = root?.[finalKey]
|
|
let target = root?.[finalKey]
|
|
|
|
|
|
|
|
+ if (key === 'args' && !deepArrayEqual(_prevValue, nextValue)) {
|
|
|
|
+ const prevNode = node as TresObject3D
|
|
|
|
+
|
|
|
|
+ if (node.type && nextValue.length > 0) {
|
|
|
|
+ root = Object.assign(prevNode, new catalogue.value[node.type](...nextValue))
|
|
|
|
+ }
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
if (root.type === 'BufferGeometry') {
|
|
if (root.type === 'BufferGeometry') {
|
|
if (key === 'args') return
|
|
if (key === 'args') return
|
|
root.setAttribute(
|
|
root.setAttribute(
|