Collada plugin for
After Effects

More info here
Plugins and Scripts > trueSpace > Development

Animation

Animation utility functions

The plugin package is required. Download the plugin package here.

Sample Code:


        util.GetEditableTrackName(Space.CurrentScene() + "/Cone")
    


    util = System.CreateDO("Clintons3D Package/Utility functions")
    asp = util.GetAnimViewVisible("Project/Windows Manager Space/Frame Window, 2/AnimView Node");
    System.Trace(asp)
    var obj = eval("(" + asp + ")");

    for(var j in obj) {
        System.Trace(j + " = " + obj[j])
        for(k in obj[j]) {
            System.Trace(k + " = " + obj[j][k]);
        }
    }
    
Pass in the "AnimView Node" gives values for the 4 numbers that control the vertical view in the animation curve editor and the visible time start and end. Active tab does not matter.


    util = System.CreateDO("Clintons3D Package/Utility functions")
    util.SetAnimViewVertical("Project/Windows Manager Space/Frame Window, 2/AnimView Node",-40, 40, -50, 50);
Pass in the "AnimView Node" and minimum visible value, maximum visible value, min value and max value to control the zoom of the vertical values in the animation editor FCurve view.


    util = System.CreateDO("Clintons3D Package/Utility functions")
    util.SetAnimVisibleInterval("Project/Windows Manager Space/Frame Window, 2/AnimView Node", 40, 150);
Pass in the "AnimView Node" and minimum visible time and maximum visible time to control the zoom view in the time axis.


    util = System.CreateDO("Clintons3D Package/Utility functions")
    sregion = util.GetSelectionRegion();
    System.Trace(sregion)

    obj = eval("(" + sregion + ")");

    for(j in obj) {
        System.Trace(j + " = " + obj[j])
        for(k in obj[j]) {
            System.Trace(k + " = " + obj[j][k]);
        }
    }
    
Curve editor will give the start and end time of the selected keys and the min and max values. When Dope sheet is active only the start and end times are valid. When Story view is active none of the values are valid.

Note: There is no easy way to get the selected keyframes or to select keyframes.

Feb 1 2022

Keyframe data for trueSpace 7.61

Provides a keyframe data read from a clip nodes AnimData connector. Data is returned in JSON format and gives the value, the attribute, interpolation type and handle information.

The plugin package is required to use this script. Download the plugin package here.

Rotation values returned are the negative of the true values.

GetKeyframeData will return values for the next keyframe at or after the provided time

GetKeyframeData(AnimClipNode, AnimatedAttribute, time);

AnimClipNode - full path to the AnimClip node
AnimatedAttribute - "All_Attributes" will collect all the attributes together and return each with their time. A single attribute will return the data for next time of the attribute. All_Attributes will return the data at the next time of each attribute.
time a float value at or just before the keyframe time to read. a large negative number can be used to get the first keyframe of the animation clip

returns empty string object if not a valid anim clip node, "{}" json => {}

List.length of zero means no key was found after the given time

MinTime and MaxTime are the first and last key times of the clip

Code sample:
outdated, use the JSON function set to read the data instead of eval

function Execute(params)
{
	//function will return values for the next keyframe after the provided time
	//
	//utilitydata.GetKeyframeData("Clip node full path","animated attribute",
	//a time at or before the next keyframe);
	//
	var utilitydata = System.CreateDO("Clintons3D Package/Utility functions");
	var value = utilitydata.GetKeyframeData(Node.FirstSelected()+"/AnimClip","All_Attributes",-90);
	//var value = utilitydata.GetKeyframeData(Node.FirstSelected()+"/AnimClip","Height",-90);
	//var value = utilitydata.GetKeyframeData(Node.FirstSelected()+"/AnimClip","Matrix",-90);
	System.Trace(value);
	System.Info(value);

	var obj = eval("(" + value + ")");
    if(!obj.MinTime) return;//test for invalid result

	System.Trace(obj.MinTime)
	System.Trace(obj.MaxTime)
	System.Trace(obj.AttrCount)

	for(var i=0;i < obj.List.length;i++) {
		System.Trace("AttrName: " + obj.List[i].AttrName)
		System.Trace("time: " + obj.List[i].time)
		for(j=0;j < obj.List[i].channels.length;j++) {
			System.Trace("channel: " + obj.List[i].channels[j].chan)
			System.Trace("value: " + obj.List[i].channels[j].val)
			System.Trace(obj.List[i].channels[j].interp)
			System.Trace(obj.List[i].channels[j].leftAng)
			System.Trace(obj.List[i].channels[j].leftLen)
			System.Trace(obj.List[i].channels[j].rightAng)
			System.Trace(obj.List[i].channels[j].rightLen)
		}
	}

}
sample data:
{
                        {
                            "MinTime": "59",
                            "MaxTime": "251",
                            "AttrCount": "2",
                            "List": [
                                {
                                    "AttrName": "Height",
                                    "time": "132.657",
                                    "channels": [
                                        {
                                            "chan": "data",
                                            "val": "7",
                                            "interp": "INTRPL_BEZIER_AUTO",
                                            "leftAng": "0",
                                            "leftLen": "0.333",
                                            "rightAng": "0",
                                            "rightLen": "0.333"
                                        }
                                    ]
                                },
                                {
                                    "AttrName": "Matrix",
                                    "time": "115",
                                    "channels": [
                                        {
                                            "chan": "tx",
                                            "val": "-4.53261",
                                            "interp": "INTRPL_BEZIER_AUTO",
                                            "leftAng": "0",
                                            "leftLen": "0.333",
                                            "rightAng": "0",
                                            "rightLen": "0.333"
                                        },
                                        {
                                            "chan": "ty",
                                            "val": "3.53165",
                                            "interp": "INTRPL_BEZIER_AUTO",
                                            "leftAng": "0",
                                            "leftLen": "0.333",
                                            "rightAng": "0",
                                            "rightLen": "0.333"
                                        },
                                        {
                                            "chan": "tz",
                                            "val": "5.59386",
                                            "interp": "INTRPL_BEZIER_AUTO",
                                            "leftAng": "0",
                                            "leftLen": "0.333",
                                            "rightAng": "0",
                                            "rightLen": "0.333"
                                        },
                                        {
                                            "chan": "rx",
                                            "val": "0",
                                            "interp": "INTRPL_BEZIER_AUTO",
                                            "leftAng": "0",
                                            "leftLen": "0.333",
                                            "rightAng": "0",
                                            "rightLen": "0.333"
                                        },
                                        {
                                            "chan": "ry",
                                            "val": "-0",
                                            "interp": "INTRPL_BEZIER_AUTO",
                                            "leftAng": "0",
                                            "leftLen": "0.333",
                                            "rightAng": "0",
                                            "rightLen": "0.333"
                                        },
                                        {
                                            "chan": "rz",
                                            "val": "125.499",
                                            "interp": "INTRPL_BEZIER_AUTO",
                                            "leftAng": "0",
                                            "leftLen": "0.333",
                                            "rightAng": "0",
                                            "rightLen": "0.333"
                                        },
                                        {
                                            "chan": "sx",
                                            "val": "0.999983",
                                            "interp": "INTRPL_BEZIER_AUTO",
                                            "leftAng": "0",
                                            "leftLen": "0.333",
                                            "rightAng": "0",
                                            "rightLen": "0.333"
                                        },
                                        {
                                            "chan": "sy",
                                            "val": "0.999983",
                                            "interp": "INTRPL_BEZIER_AUTO",
                                            "leftAng": "0",
                                            "leftLen": "0.333",
                                            "rightAng": "0",
                                            "rightLen": "0.333"
                                        },
                                        {
                                            "chan": "sz",
                                            "val": "0.999988",
                                            "interp": "INTRPL_BEZIER_AUTO",
                                            "leftAng": "0",
                                            "leftLen": "0.333",
                                            "rightAng": "0",
                                            "rightLen": "0.333"
                                        }
                                    ]
                                }
                            ]
                        }
}

February 1, 2022

  • add min and max time for start and end of the clip
  • add attrcount - not really useful
April 8, 2015

Anim View Aspect

Get the anim view aspect, 1 - Dope, 2 - FCurve, 3 - Story

Usage:

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • ava = util.GetAnimViewAspect("Project/Windows Manager Space/Frame Window, 2/AnimView Node")
Jan 31 2022
June 5, 2013