Skip to content

[TSL] Adding .label to a uniform prevent it from being updated through .value =  #28547

@AlaricBaraou

Description

@AlaricBaraou

Description

Updating .value of a uniform that received a label will update the .value of the contextNode instead.

.value doesn't seem to be handled by the Proxy inside examples\jsm\nodes\shadernode\ShaderNode.js

Reproduction steps

  1. create a uniform using uniform() with some value
  2. change said value further down the code using .value =
  3. the new value doesn't reach the uniform node and is set on the context node instead

Code

const u_baseColor = uniform( color( '#707070' ) ).label( 'BaseColor' );
console.log( 'u_baseColor.node.value', u_baseColor.node.value ); // initial value
console.log( 'u_baseColor.value', u_baseColor.value ); // contextNode.value is undefined
u_baseColor.value = new THREE.Color( 0x00ff00 );
console.log( 'u_baseColor.node.value', u_baseColor.node.value ); // this value didn't change
console.log( 'u_baseColor.value', u_baseColor.value ); // the new value is set here instead

Live example

Screenshots

No response

Version

0.165.0

Device

No response

Browser

No response

OS

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    TSLThree.js Shading Language

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions