Notifications
Clear all
[Closed] No Gizmo?
Jan 24, 2007 8:54 pm
Of all the weird errors I’ve ever received, I’m getting this from MaxScript:
Unknown property: “gizmo” in Uvwmap:UVW Mapping
During the execution of the following code. Note, that it doesn’t fail until the commented line. I can’t figure this one out. When executing each step manually through the listener, it works perfectly. I’ve fought this for three days, and I can’t figure it out. Any help would be most welcome. Thanks.
fn GenerateUVW myRow myCol = -- Creates a UVW on both Terrain and Sealevel, uses sealevel to find
-- the correct rotation, and applies it to the Terrain patch
(
if myRow < 10 then strRow = "0" + (myRow as string)
else
strRow = myRow as string
seaname = "SeaLevel-" + TQRegion + "-" + TQSubRegion + "-" + TQQuadName + "_" + strRow + "_" +Alphabet[myCol]
seamesh = getNodeByName seaname
addModifier seamesh (UVWMap())
-- Make a UVMap on Sea Level
theFace = seamesh.numfaces / 2 -- Try to get a face near the middle of the mesh
faceNormal = in coordsys seamesh (getFaceNormal seamesh theFace)
worldUpVector = [0,0,1]
rightVector = normalize (cross worldUpVector faceNormal)
upVector = normalize ( cross rightVector faceNormal )
theMatrix = matrix3 rightVector upVector faceNormal [0,0,0]
seamesh.modifiers[1].Gizmo.transform = theMatrix
in coordsys seamesh.transform
(
M = seamesh.modifiers[1].Gizmo.rotation as matrix3
Pmin = (getVert seamesh 1) * M
Pmax = (getVert seamesh 1) * M
for i = 2 to getNumVerts seamesh do
(
p = (getVert seamesh i) * M
if p.x < Pmin.x then Pmin.x = p.x
if p.y < Pmin.y then Pmin.y = p.y
if p.z < Pmin.z then Pmin.z = p.z
if p.x > Pmax.x then Pmax.x = p.x
if p.y > Pmax.y then Pmax.y = p.y
if p.z > Pmax.z then Pmax.z = p.z
)
sz = (Pmax - Pmin) * 1.00001
seamesh.modifiers[1].Gizmo.position = (Pmin + Pmax) / 2 * inverse M
seamesh.modifiers[1].width = sz.x
seamesh.modifiers[1].length = sz.y
seamesh.modifiers[1].height = sz.z
)
terrainname = "TerraQuad-" + TQRegion + "-" + TQSubRegion + "-" + TQQuadName + "_" + strRow + "_" +Alphabet[myCol]
terrainmesh = getNodeByName terrainname
addModifier terrainmesh (UVWMap())
terrainmesh.modifiers[1].uflip=true
/***********************************************************/
/* FAILS HERE */
terrainmesh.modifiers[1].Gizmo.transform = theMatrix
/***********************************************************/
in coordsys terrainmesh.transform
(
M = terrainmesh.modifiers[1].Gizmo.rotation as matrix3
Pmin = (getVert terrainmesh 1) * M
Pmax = (getVert terrainmesh 1) * M
for i = 2 to getNumVerts terrainmesh do
(
p = (getVert terrainmesh i) * M
if p.x < Pmin.x then Pmin.x = p.x
if p.y < Pmin.y then Pmin.y = p.y
if p.z < Pmin.z then Pmin.z = p.z
if p.x > Pmax.x then Pmax.x = p.x
if p.y > Pmax.y then Pmax.y = p.y
if p.z > Pmax.z then Pmax.z = p.z
)
sz = (Pmax - Pmin) * 1.00001
terrainmesh.modifiers[1].Gizmo.position = (Pmin + Pmax) / 2 * inverse M
terrainmesh.modifiers[1].width = sz.x
terrainmesh.modifiers[1].length = sz.y
terrainmesh.modifiers[1].height = sz.z
)
)