Hubs-Foundation / hubs

Duck-themed multi-user virtual spaces in WebVR. Built with A-Frame.
https://hubsfoundation.org
Mozilla Public License 2.0
2.14k stars 1.41k forks source link

BG - Cannot `Set Material` on an entity with multiple material slots #6440

Open j-conrad opened 10 months ago

j-conrad commented 10 months ago

Description If an entity has more than 1 material slot (materials assigned to different faces), trying to perform a Set Material operation fails with the following error:

set material: called on a non mesh

To Reproduce Steps to reproduce the behavior:

  1. Open attached .blend
  2. Note the graph and setup of materials on the two plane objects
  3. Run in Hubs / click on the hexagon on the floor.
  4. Note the lefthand object changes while the righthand one throws an error.

Expected behavior There needs to be a way to specify which material slot you want to affect (and perhaps an option for 'all') when using Set Material or Get Material.

Screenshots This screenshot shows a graph that works on the lefthand object (because it has 1 material slot), whereas the righthand object throws an error due to having 2 material slots.

image

Looking at the ECS Debug reveals the problem. The object is split into two entities because of the material assignments. image It appears that the meshes are children of the parent entity which is apparently 'not a mesh'.

Hardware