From ec832f1cadc2f32be1d99784c9f0309d937ca1bb Mon Sep 17 00:00:00 2001 From: Michael Herzog Date: Sun, 5 Jul 2026 11:57:38 +0200 Subject: [PATCH] UniformArrayNode: Fix `update()` overwrite. (#33962) --- src/nodes/accessors/UniformArrayNode.js | 35 +++++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/src/nodes/accessors/UniformArrayNode.js b/src/nodes/accessors/UniformArrayNode.js index db7383e4a011fb..bf2dc078eb56ba 100644 --- a/src/nodes/accessors/UniformArrayNode.js +++ b/src/nodes/accessors/UniformArrayNode.js @@ -186,13 +186,38 @@ class UniformArrayNode extends BufferNode { } + update( /*frame*/ ) { + + this.updateBuffer(); + + } + /** - * The update makes sure to correctly transfer the data from the (complex) objects - * in the array to the internal, correctly padded value buffer. + * Composes a user-defined update with the buffer transfer. * - * @param {NodeFrame} frame - A reference to the current node frame. + * @param {Function} callback - The update function. + * @param {string} updateType - The update type. + * @return {UniformArrayNode} A reference to this node. */ - update( /*frame*/ ) { + onUpdate( callback, updateType ) { + + callback = callback.bind( this ); + + return super.onUpdate( ( frame, self ) => { + + callback( frame, self ); + + this.updateBuffer(); + + }, updateType ); + + } + + /** + * The method makes sure to correctly transfer the data from the (complex) objects + * in the array to the internal, correctly padded value buffer. + */ + updateBuffer() { const { array, value } = this; @@ -315,7 +340,7 @@ class UniformArrayNode extends BufferNode { this.bufferCount = length; this.bufferType = paddedType; - this.update(); // initialize the buffer values + this.updateBuffer(); // initialize the buffer values return super.setup( builder );