Skip to content

PropertyBinding on .material.color doesn't set needsUpdate #30035

@tommie

Description

@tommie

Description

It seems PropertyBinding isn't selecting the right setValue, because Material.needsUpdate only has a setter defined, not a getter, and the check is against undefined.

The solution is probably to use "material" in targetObject, since a getter isn't easily defined without knowing the compiled version:

if ( targetObject.needsUpdate !== undefined ) { // material
versioning = this.Versioning.NeedsUpdate;
} else if ( targetObject.matrixWorldNeedsUpdate !== undefined ) { // node transform
versioning = this.Versioning.MatrixWorldNeedsUpdate;
}

Reproduction steps

See console of live example.

Code

import * as THREE from 'three';

const material = new THREE.MeshBasicMaterial();
const mesh = new THREE.Mesh(undefined, material);
const binding = THREE.PropertyBinding.create(mesh, ".material.color");

binding.bind();
binding.setValue([0.5, 0.5, 0.5], 0);

console.log(material.version);

Live example

https://jsfiddle.net/pq1vLgjc/

Screenshots

No response

Version

r169

Device

No response

Browser

No response

OS

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions