CopyShape

Description

Copies the shape key to the specified clusters. The clusters must be of the same size and ordered similarily as the shape key.

Scripting Syntax

CopyShape( [Source], [Target] );

Parameters

Parameter Type Description
Source String Cluster key or shape action to copy
Target String List of targets where the cluster will be copied (3DObjects, primitives, cluster containers)

Examples

VBScript Example

'

' This example first creates a sphere deformed by a shape on a point cluster.

' Then, it creates a second sphere, and copies the shape from the first sphere

' to  a corresponding point cluster.

'

' Create 2 spheres: source (orig) and target (dupe)

NewScene , false

set orig = CreatePrim( "Sphere", "MeshSurface" )

set dupe = CreatePrim( "Sphere", "MeshSurface" )

Translate orig, 9, 0, 0, siRelative, siView, siObj, siXYZ

' Create a shape key on a point cluster

set cls1 = CreateCluster( orig & ".pnt[38-42,45-49]" )(0)

Translate cls1, 1, 3, -3, siRelative, siView, siObj, siXYZ

set shapeclp = SaveShapeKey( cls1,,, 1,,,, 1, siShapeLocalReferenceMode )

set shapesrc = shapeclp.MappedItems(0).Source2

' Create the corresponding target point cluster

set cls2 = CreateCluster( dupe & ".pnt[38-42,45-49]" )(0)

' Copy the shape to the target object, and apply the shape

CopyShape shapesrc, cls2

set copiedsrc = dupe.Model.Sources( dupe.Model.Sources.Count-1 )

ApplyShapeKey copiedsrc, , , 1

' Results: Both spheres display the same point extrusion