v1.0
クリップボードを通さずに、コピーしたものを貼り付けます。 これは、ドラッグアンドドロップ操作と同等のスクリプトです。 このコマンドを使用すると、シーン内にすでに存在する項目(たとえば、シーン オブジェクトを表す項目)を移動したり、TransientObjectContainer にある項目(たとえば、Annotation など、組み込みのプロパティ セットのインスタンス)を貼り付けたりできます。
注: CopyPaste コマンドは、TransientObjectContainer から現在のシーンに項目を移動するための唯一の方法です。TransientObjectContainer に UI からアクセスすることはできないためです。
警告: v7.0 より前のバージョンでは、このコマンドを使用してプリセットからシェーダを作成し、RenderTree での接続準備が整うまで TransientObjectContainer にコピーしておくこともできましたが、 このコマンドではこの機能がサポートされなくなりました。代わりに、CreateShaderFromPreset コマンドを使用して、シーンのマテリアル ライブラリ(「Sources.Materials.DefaultLib.Scene_Material」)にシェーダの一時コピーを作成する必要があります。 例については、ReplaceShader のリファレンス ページを参照してください。
CopyPaste( [Source], [FileName], Target, [Mode] ); |
| パラメータ | タイプ | 説明 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Source | 文字列 | コピーするオブジェクト | ||||||||||
| FileName | 文字列 | シーン内に読み込みするファイルまたはプリセット | ||||||||||
| Target | 文字列 | ターゲット オブジェクト | ||||||||||
| Mode | vbCopyPaste 定数または整数 |
コピー アンド ペーストする(VisualBasic)モード デフォルト値: vbDefaultCopyPaste
|
#
# Example of creating a temporary custom property (aka custom pset)
# which can be written to before actually depositing in the scene
#
app = Application
from win32com.client import constants as c
app.NewScene( "", 0 )
# Demonstrate how you can use it to create a built-in custom pset
presetFullPath = XSIUtils.BuildPath(
app.InstallationPath(c.siFactoryPath),
"Data", "DSPresets", "Properties", "Annotation.Preset"
)
oAnnotation = app.CreateObjectFromPreset( presetFullPath, "Notes" )
if ( oAnnotation ) :
# Even though it only exists on the clipboard you can still populate it
app.InspectObj( oAnnotation, "", "Annotation Test", "siModal", 0 )
# Notice how the owner of this annotation doesn't have to
# exist until you are ready to cut-and-paste it
oNull = app.ActiveSceneRoot.AddModel("", "Jerry")
app.CopyPaste(oAnnotation, "", oNull, 1)
# Just to prove that it exists any modifications
for oParam in oNull.Properties("Notes").Parameters :
app.LogMessage( oParam.Name + ": " + str(oParam.Value) )
else :
app.LogMessage( "Couldn't create Annotatation property." )
# Expected results (similar to):
# INFO : Title:
# INFO : Text: need to refine right bicep
# INFO : Keyword: modeling
# INFO : Flag 1: False
# INFO : Flag 2: True |
/*
This example demonstrates how to use the CopyPaste command to
reparent scene objects by physically moving objects under
their new parents (a la drag-and-drop in the UI).
*/
// Create a new scene with 4 nulls
var app = Application;
NewScene(null, false);
GetPrim("Null");
GetPrim("Null");
GetPrim("Null");
GetPrim("Null");
// Reparent null2 and null3 under null1
CopyPaste("null3", null, "null1", 1);
CopyPaste("null2", null, "null1", 1);
// Reparent null under null2
CopyPaste("null", null, "null2", 1);
// Print the visual hierarchy
ShowMeTheHierarchy(app.ActiveSceneRoot, "");
// Expected results:
// INFO : Camera_Root
// INFO : ...Camera
// INFO : ...Camera_Interest
// INFO : light
// INFO : null1
// INFO : ...null3
// INFO : ...null2
// INFO : ......null
// Convenience function to print out a graphical representation
// of the hierarchy in the scene starting at the specified object
function ShowMeTheHierarchy(in_parent, in_depth)
{
var kid = new Enumerator(in_parent.Children);
for (; !kid.atEnd(); kid.moveNext()) {
app.LogMessage(in_depth + kid.item().FullName);
if (kid.item().Children.Count) {
ShowMeTheHierarchy(kid.item(), in_depth + "...");
}
}
} |