maxscriptの"getUserProp"というオブジェクトプロパティの「ユーザー定義」から値を取得する関数にバグがあり、(しかも3dsmax9でも発見)長らく直される気配がないので、自分で以下の関数を作成して対応しました。需要はほぼないと思いますが、ご参考になればと思います。
I found small bug in maxscript function"getUserProp",the bug hasn't fixed long time.(I found this bug even 3dsmax9.)
So I create original function like the following to cope the bug, I hope help you.
--function to check the text include only Number fn isNumeral txt = ( s= txt as string for i = 1 to s.count do( if(findString "0123456789" s[i]) == undefined then( return false ) ) return true ) --function improved getUserProp fn getUserProp2 obj =( local ss = (getUserPropBuffer obj) as stringStream if ss != undefined then( while (eof ss) != true do( local txt = readline ss local arr = filterstring txt " = " if arr[2] != undefined then( if (arr[2] == "true") or (arr[2] == "false") or ((isNumeral arr[2]) == true ) then( txt = arr[1] + "=" + arr[2] execute txt readline ss )else( arr[2] = "@\"" + arr[2] append arr[2] "\"" txt = arr[1] + "=" + arr[2] execute txt readline ss ) )else( txt = arr[1] + "=" + "\"\"" execute txt readline ss ) ) )else( return(); )
0 コメント: