dotNetMXSValue 値クラスは、別の値を保持します。dotNetMXSValue は、.net オブジェクトに割り当てることができます。DotNet の「プロキシ」値は、実際には DotNet オブジェクトに保管され、このプロキシが逆に dotNetMXSValue をポイントします。
DotNet オブジェクトがプロキシ値を保持している限りは、dotNetMXSValue とこれが保持する値はガベージ コレクションから保護されます。
dotNetMXSValue オブジェクトで保持される値は、読み取り専用の .value
プロパティから読み取ることができます。
3ds Max 9 以降で使用可能です。
例:
a = color 10 20 30 --MAXScript color value b = dotNetMXSValue a --DotNet value holding the MAXScript value tv = dotnetobject "treeview" --DotNet TreeView control tv.tag = b --The tag is set to the color tv.tag a=b=undefined --Both a and b are set to undefined gc() --and manual garbage collection is requested --BUT the color value and dotNetMXSValue protected are from --collection because the treeview instance holds --the dotNetMXSValue proxy! tv = undefined --assign undefined to the treeview variable gc() --and request garbage collection again --This time both the color value and the dotNetMXSValue are not --protected from collection
このガベージ コレクションでは、DotNet ガベージ コレクタは TreeView を削除せず、まだその値を解放していないので、カラー値と dotNetMXSValue はいずれも削除されません。DotNet の手動ガベージ コレクションを強制することも可能です。
例
dgc = dotnetclass "system.gc" dgc.collect() gc() -- color value and dotNetMXSValue collected