v4.0
オブジェクトおよびそのすべての子をロックするか、パラメータをロックします。
注: 既にロックされているオブジェクトをロックしようとすると、[ヒストリ]ペインに次のエラー メッセージが表示されます。'ERROR : "2087 - The object:
Lock( [InputObjs], [Level] ); |
| パラメータ | タイプ | 説明 |
|---|---|---|
| InputObjs | 文字列 |
ロックするオブジェクトのリスト。 オブジェクトまたはパラメータを指定します。 デフォルト値: 現在選択されている値 |
| Level | siLockLevel |
ロック レベルは、ロックする領域を表すビット フィールドの値です。 最大レベルは siLockLevelAll で、すべてのレベルが含まれます。 1 つのオブジェクトに対して 1 つあるいは多数のレベルを設定することができます。 レベルが 0 (siLockLevelNone)の場合には、ロックは削除されます。 デフォルト値: siLockLevelAll |
// JScript example that show basic lock and unlock usage
NewScene(null, null);
CreatePrim("Cone", "MeshSurface", null, null);
CreatePrim("Cylinder", "MeshSurface", null, null);
CopyPaste("cylinder", null, "cone", 1);
// This will lock in branch the cone. (the cylinder will also be locked.
Lock("B:Cone", siLockLevelAll);
// The object is locked so it cannot be modified, the following commented line
// for example would fail as follow: ERROR : "2009-EDIT-SetValue - Access denied"
// SetValue("cone.polymsh.geom.subdivu", 13, null);
// Now unlock the object in branch.
SelectObj("cone", "BRANCH", null);
Unlock(null, siLockLevelAll, null, null);
// now the setvalue is working.
SetValue("cone.polymsh.geom.subdivu", 13, null); |
// JScript example that show how to work with levels of locking.
NewScene(null, null);
CreatePrim("Disc", "MeshSurface", null, null);
CreatePrim("Cone", "MeshSurface", null, null);
Lock("cone", siLockLevelConstruction);
// The object is locked in construction, so we can change the parameters values but not the hierarchy.
// So this is working...
SetValue("cone.polymsh.geom.subdivu", 13, null);
// But not this...
//ERROR : "2087 - The object: cone is locked."
//ERROR : "2009-EDIT-CopyPaste - Access denied"
try {
CopyPaste("Disc", null, "cone", 1);
}
catch (e) {
logmessage ("this is normal,since it is locked");
}
// Now add to the lock the manipulatio level that will prevent changing the parameter values.
Lock("cone", siLockLevelManipulation);
// Now this is not working...
//ERROR : "2087 - The object: cone.polymsh.geom.subdivu is locked."
//ERROR : "2009-EDIT-SetValue - Access denied"
try {
SetValue("cone.polymsh.geom.subdivu", 5, null);
}
catch (e) {
logmessage ("this is normal,since it is locked");
}
// Display the lock level, ( in this case it is 5 which is siLockLevelConstruction & siLockLevelManipul
var oObj = GetValue("cone")
logmessage ("The level of lock for the cone is : " + oObj.LockLevel);
// Unlock just the construction level of the lock
Unlock("cone", siLockLevelConstruction, null, null);
// Display the lock level, ( in this case it is 0 since by removing the construction level all other levels have been removed
var oObj = GetValue("cone")
logmessage ("The level of lock for the cone is : " + oObj.LockLevel); |
// JScript example that show how to lock a parameter
NewScene(null, null);
CreatePrim("Cone", "MeshSurface", null, null);
// This will lock only the subdivu parameter.
Lock("cone.polymsh.geom.subdivu", siLockLevelManipulation);
// The object is locked so it cannot be modified, for example this will fail.
//ERROR : "2009-EDIT-SetValue - Access denied"
try {
SetValue("cone.polymsh.geom.subdivu", 13, null);
}
catch (e) {
logmessage ("this is normal,since it is locked");
}
// But the subdivv is working!
SetValue("cone.polymsh.geom.subdivv", 4, null);
// Now unlock the parameter.
Unlock("cone.polymsh.geom.subdivu", siLockLevelAll, null, null); |