DataPair 値

DataPair クラスは、2 つの値を単純にラップするラッパーです。

値の型は問われません。

このクラスは、3ds Max 2008 以降で使用可能です。

従来、Avguard 機能拡張として提供されていた機能です。

3ds Max 2017.1 Update 以降で使用可能: 永続グローバル変数で DataPair 値を指定できます。シーン ファイルをロードするときに DataPair を完全に復元するには、DataPair 内の両方の値を永続グローバル変数として指定できる必要があります。

コンストラクタ

DataPair ()
DataPair <value1> <value2>
DataPair <value1_name>:<value1> <value2_name>:<value2>

プロパティ

<dataPair>.v1 : Value

DataPair の 1 番目の値を取得/設定します。

<dataPair>.v2 : Value

DataPair の 2 番目の値を取得/設定します。

<dataPair>.<value1_name> : Value

DataPair の 1 番目の値を名前で取得/設定します。

<dataPair>.<value2_name> : Value

DataPair の 2 番目の値を名前で取得/設定します。

メソッド

getPropNames <dataPair>

このコンストラクタの形式が使用されている場合に、最初の 2 つの値が #v1 と #v 2、残りの つの値が、<value1_name><value2_name> である名前値の配列を返します。

deepCopy <dataPair> [copyAllValuesAsUnique:<boolean>]

dataPair のディープ コピーを作成します。3ds Max 2019 以降で使用可能です。dataPair は再帰的にトラバースされ、dataPair 内のすべての項目の新しいコピーが生成されます。dataPair の中に、単一の値に対する複数の参照が含まれている場合は、ディープ コピーの中に、単一の新しい値に対する複数の参照が含まれていることに注意してください。

3ds Max 2024.1 Update の新機能: すべてのメンバーが一意であることが分かっている場合は、copyAllValuesAsUnique キーワード パラメータを true として指定できます。これにより、コピー操作のパフォーマンスが大幅に向上します。

例:

--Define a new value consisting of a Point3 value and an Integer
theVal = DataPair [10,20,30] 40
--> (DataPair [10,20,30] 40)
theVal.v1 --get the first value in the pair
--> [10,20,30]
theVal.v2 --get the second value in the pair
--> 40

--Define a new DataPair value with names values
theVal2 = DataPair question:"Life,Universe,And Everything" answer:42
-->(DataPair question:"Life,Universe,And Everything" answer:42)
theVal2.question
--> "Life,Universe,And Everything"
theVal2.answer
--> 42
--You can use the properties too:
theVal2.v1
--> "Life,Universe,And Everything"
theVal2.v2
--> 42
deepEqual <dataPair> <dataPair> [strictCompare:<bool>]

3ds Max 2024.1 Update の新機能: 2 つの DataPair 値の間の等価性を比較します。名前(指定されている場合)と値の比較結果が true になった場合は、true を返します。

オプションのキーワード パラメータ strictCompare は、タイプ強制を使用せずに比較するかどうかを指定します。既定値は false です。

例:

theVal = DataPair #(10,20,30) 40
theVal2 = DataPair #(10,20,30) 40
theVal3 = DataPair #(10.5,20,30) 40.9

theVal==theVal2
--> false, == not implemented for DataPair
deepEqual theVal theVal2
--> true
deepEqual theVal theVal3
--> also true because of type conversion of double to integer
deepEqual theVal theVal3 strictCompare:true
--> false