a 3d object is made up of faces.
each face has an associated material.
the default material in the style window is material number 0 (note that the style window needs to be headed by
Default 3D Material)
In the example you uploaded, all 6 faces have the same material "Mat" (material number 1).
Two approaches to change the whole cube:
1: change the material associated with each face to be default - then the cube instantly picks up whatever is in the style window
2: change the attributes of each face's material to be the same as the default (i.e. copy the fields of material 0 into those of the material for each face)
doing it on a face-by-face basis will be tricky, because there's no native UI to pick 3d object faces...
here's the core of the code needed for those two options.
Code: Select all
-- option 1
for i = 0, mesh:CountFaces()-1 do
local face = mesh:Face(i)
face.matID = 0
end
-- option 2
local function resetMat(mat, def)
mat.color.r, mat.color.g, mat.color.b = def.color.r, def.color.g, def.color.b
mat.edgeColor.r, mat.edgeColor.g, mat.edgeColor.b = def.edgeColor.r, def.edgeColor.g, def.edgeColor.b
mat.drawEdges, mat.edgeWidth = def.drawEdges, def.edgeWidth
end
for i = 0, mesh:CountFaces()-1 do
local face = mesh:Face(i)
resetMat(mesh:Material(face.matID), mesh:Material(0))
end
hope that helps
===
However, if all you want to do is modify the colours of the cube within moho - get "Mat" as the active material in the style window and change the fill and stroke.