Dupes 0.4 - ZackWilde27/Z3dPy GitHub Wiki
z3dpy.Dupe( iIndex, vPosition, vRotation )
myThingList = [myThing, myOtherThing]
# iIndex of 0, so a dupe of myThing
myDupe = z3dpy.Dupe(0, [1.0, 2.0, 3.0], [4.0, 5.0, 6.0])
myThingList.append(myDupe)
Dupes are duplicates of a Thing, it has a unique position and rotation, but for everything else it will borrow from the original.
[-1] is the user variable
[0] is the index of the thing to copy (in the same list given to RenderThings, or the same layer in Render())
[1] is the position
[2] is the rotation
[3] is -1 to indicate it's a dupe (a leftover from when Things were lists, ignore that.)
Using the internal list
# AddThing(thing, *iLayer)
z3dpy.AddThing(myThing)
# AddDupe(thing, vPos, vRot, *iLayer)
z3dpy.AddDupe(myThing, [1.0, 2.0, 3.0], [4.0, 5.0, 6.0])
# Now they'll appear when drawing
for tri in z3dpy.Render():
iLayer must be the same as the original thing. I used default in both cases
Using your own list:
myList = [myChar, thatTree]
# Dupe(iIndex, vPos, vRot)
# iIndex is the index of the original in your list, so it's a dupe of thatTree
myDupe = z3dpy.Dupe(1, [1.0, 2.0, 3.0], [4.0, 5.0, 6.0])
# Add the dupe like a Thing.
myThingList.append(myDupe)
for tri in z3dpy.RenderThings(myThingList):