今天发现有时候Max的UVW坐标会出现浮点数越限的情况,就变成了非法的浮点数,显示为 1.#QNAN 。从下面这段脚本的判断也可以明白是什么状况,即坐标既不大于等零也不小于等于零.....。出现此状况后在点级别就完全无法操作,可以用下面这段脚本解决,也可以将模型导成某种格式再导回来,同样可以达到效果。
![ContractedBlock.gif](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![ExpandedBlockStart.gif](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
Fn RepairUVW targetMesh
=
(
sourceClass = ClassOf targetMesh.Baseobject
ConvertToMesh targetMesh
for fi = 1 to GetNumFaces targetMesh.mesh do
(
ft = GetTVFace targetMesh.mesh fi
for ni = 1 to 3 do
(
tempUvw = getTVert targetMesh.mesh ft[ni]
for ui = 1 to 3 do
(
if (not tempUvw[ui] >= 0 ) and (not tempUvw[ui] <= 0 ) do tempUvw[ui] = 1
)
SetTVert targetMesh.mesh ft[ni] tempUvw
)
)
Update targetMesh
if sourceClass == Editable_Poly do ConvertTo targetMesh Editable_Poly
AddModifier targetMesh (Unwrap_UVW())
)
for tempObj in Selection as array do RepairUVW tempObj
(
sourceClass = ClassOf targetMesh.Baseobject
ConvertToMesh targetMesh
for fi = 1 to GetNumFaces targetMesh.mesh do
(
ft = GetTVFace targetMesh.mesh fi
for ni = 1 to 3 do
(
tempUvw = getTVert targetMesh.mesh ft[ni]
for ui = 1 to 3 do
(
if (not tempUvw[ui] >= 0 ) and (not tempUvw[ui] <= 0 ) do tempUvw[ui] = 1
)
SetTVert targetMesh.mesh ft[ni] tempUvw
)
)
Update targetMesh
if sourceClass == Editable_Poly do ConvertTo targetMesh Editable_Poly
AddModifier targetMesh (Unwrap_UVW())
)
for tempObj in Selection as array do RepairUVW tempObj