How do i copy a datastructure?

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
rook2pawn
Posts: 5
Joined: January 15th, 2008, 10:29 pm

Is there a general method? Btw the adobe scripting guide pdf displays all the objects, but has nothing about methods or commonly needed tecniques beyond a few sparse examples in the property object section etc.

what do i do to copy say

myComp.layer('Audio Amplitude')("Effects")("Both Channels")("Slider")

i mean what kind of data structure is this ? i.e. var new ____ ?

for instance if i say var test = myComp.layer('Audio Amplitude')("Effects")("Both Channels")("Slider")

then i do a change on that datastructure on the right hand side
myComp.layer('Audio Amplitude')("Effects")("Both Channels")("Slider").setValueAtKey(5,41);


then test.keyValue(5) ends up being 41. THat means the = is not overloaded, i.e. there has to be an explicity copy function...
Darkmoon_UK
Posts: 62
Joined: September 5th, 2006, 3:45 am
Location: Chiswick, London, UK
Contact:

Recreating what you describe in After Effects, the slider object seems to manifest itself as a generic 'Property' object.

Probing it further with reflection we can see that the 'Property' object for the slider, has the following methods and properties.

To see more about reflection see my post here: http://www.aenhancers.com/viewtopic.php ... reflection

Methods are:

0. == ()
1. addKey ()
2. duplicate ()
3. isInterpolationTypeValid ()
4. keyInInterpolationType ()
5. keyInSpatialTangent ()
6. keyInTemporalEase ()
7. keyOutInterpolationType ()
8. keyOutSpatialTangent ()
9. keyOutTemporalEase ()
10. keyRoving ()
11. keySelected ()
12. keySpatialAutoBezier ()
13. keySpatialContinuous ()
14. keyTemporalAutoBezier ()
15. keyTemporalContinuous ()
16. keyTime ()
17. keyValue ()
18. moveTo ()
19. nearestKeyIndex ()
20. propertyGroup ()
21. remove ()
22. removeKey ()
23. setInterpolationTypeAtKey ()
24. setRovingAtKey ()
25. setSelectedAtKey ()
26. setSpatialAutoBezierAtKey ()
27. setSpatialContinuousAtKey ()
28. setSpatialTangentsAtKey ()
29. setTemporalAutoBezierAtKey ()
30. setTemporalContinuousAtKey ()
31. setTemporalEaseAtKey ()
32. setValue ()
33. setValueAtKey ()
34. setValueAtTime ()
35. setValuesAtTimes ()
36. valueAtTime ()

Properties are:

0. active
1. canSetEnabled
2. canSetExpression
3. canVaryOverTime
4. elided
5. enabled
6. expression
7. expressionEnabled
8. expressionError
9. hasMax
10. hasMin
11. isEffect
12. isMask
13. isModified
14. isSpatial
15. isTimeVarying
16. matchName
17. maxValue
18. minValue
19. name
20. numKeys
21. parentProperty
22. propertyDepth
23. propertyIndex
24. propertyType
25. propertyValueType
26. selected
27. selectedKeys
28. unitsText
29. value

I know this doesn't tell you how to directly copy the data structure, but hope it helps. You could use reflection to iterate through all properties of an object and read and set them to another object of the same type, which would have the same effect?
rook2pawn
Posts: 5
Joined: January 15th, 2008, 10:29 pm

thanks darkmoon! ill check it out :D
Post Reply