đChannel Link
Use simple expressions to connect channel data
Last updated
Use simple expressions to connect channel data
Last updated
Linking channels provides a way to combine the animation data of one channel with another. Channels are linked together similar to using patch cables, routing data from one channel to another to form chains of connected behaviors.
Linking channels is also a great way to replicate behavior across multiple objects. Instead of having a bunch of duplicate behaviors and animations to manage, one can use a single master object and then link others to it. This can be used to directly copy animation or to modify it through additional calculations.
To the right of each channel name is a circular well. Clicking and dragging on this draws out a link cable which can be connected with any other channel well. Available link wells are highlighted by white circles as shown below.
Any link wells not highlighted in white may not be linked to. This may be to prevent circular references, or due to an incompatible data type.
Each channel may be connected to 1 other channel, using it as data input. This can be set to overwrite the existing channel data, or use a math expression to calculate a new value. Channel links can be daisy chained to create complex behaviors, or to replicate a channel animation across multiple objects.
The line appears red anytime dragging over an invalid selection. Releasing the drag while the line is red cancels the operation and no change is made.
A handy shortcut to simultaneously create and link a new channel is to drag the object onto the link well of the source object.
In the example shown, the Cylinder object is dragged onto the Sphere Local Position channel link. This then creates a matching Local Position channel on the Cylinder and links it to the Sphere's position.
This operation also works with multiple objects, creating and linking a new channel on each object.
In the event that the receiving object does not have a matching property, a data-only channel is created instead. This can occur if the source channel is mapped to a component property that doesn't exist on the receiving object (i.e. doesn't have the same components).
Each channel has the ability to be linked to another channel (receiving the other's data) or linked from another channel (providing its data to that channel). This is depicted by the well icon as shown below.
During playback, a small notch may be seen traveling along the line in the direction of data flow, as an aid to better visualize the link relationship.
Each channel may only have 1 link input (linked to), but unlimited outputs (linked from).
When a channel link is receiving data, its link is filled with the color of the source channel. By default the source data overwrites the receiving channel data, but may be configured to process the data further as described below in Additional Settings.
When a channel is being referenced by other channels (i.e. providing its data), its link well is outlined with its own channel color, to represent outward flow of data.
In the example above, an extra data-only channel (Data Process) has been added to perform additional calculation, which is then linked to by Capsule Local Position. Using intermediate channels in this way is useful to perform multiple calculations.
Read-Only
Links have no effect on the providing channel's behavior or output.
To avoid screen clutter, channel link lines are only displayed for selected channels. If nothing is selected, only the link fills and outlines are shown (without lines).
Hold the Alt key to temporarily show all channel link lines, as shown above.
Channel links can be removed using the context menu options as explained in the section below. You can also hold the Control key and click on the link well to remove a link. This can only be used on destination links (Linked To).
While holding the Control key, any link wells that can be removed are displayed with a red minus icon ( - ). This also temporarily shows all channel links lines while the Control key is held.
Channel links can be disabled without removing them by holding the Alt key and clicking on any receiving link wells (with filled color). Disabled links are displayed in gray and no longer processed.
The linked from channel only shows a gray outline if all referencing channels (linked to it) are disabled. If any channel link is still enabled, it displays the outline in color. The helps indicate when channel links are active or not.
When a channel link is disabled it is treated as though it doesn't exist and the channel resumes normal behavior. It may be helpful at times to temporarily disable a link while preserving all of its settings.
Animating Channel Links?
It may be tempting to animate Link Blend or other parameters of channel links, however this is prohibited and it is not possible to animate channel link parameters. Instead, additional data-only channels may be added to perform additional processing. If the result you are trying to achieve is more complicated than that, it may be better to write a custom script or channel link as described further below.
When a channel is selected, its link settings are displayed in the Info panel below.
This slider controls how much of the source data is combined with the current channel. If blend is set to 0, then the current channel remains unchanged from its present value, whereas a blend of 1 is full application of the source data. How the blend is calculated depends on the math expression selected, described below in Link Mode.
The Graph View can be helpful for visualizing the result of channel link calculations.
More settings can be exposed by clicking the pencil icon (to the right of the Link Blend slider). This also reveals a minus icon ( - ) which removes the channel link if clicked.
This displays the object and source channel being linked to. This field can be modified directly by dragging and dropping another TimeflowObject. The available channels to link to are displayed in the drop-down menu next to the object field.
This drop-down menu selects which attributes are used for input. This is only available for complex value types. Primarily this is useful to link a single axis from a complex value (vector, color, rect) to a single float value.
Note that the Out Attribute is disabled since it must match the channel it belongs to.
A time offset (in seconds) can be applied to delay or anticipate the source animation. This could be used for example to have one object, or a series of objects, follow a lead object spaced out over time.
Data Cache Optimization When data is requested (which may be at times other than the current time), the source channel calculates the value internally but does not apply it to the object. A smart context aware form of data caching is used to optimize repeated requests, so that the channel doesn't reprocess the same data.
Applies temporal smoothing (in seconds) to the input value. Set to 0 to disable.
Smoothing averages input values over time. Use this to reduce noise and blend values more gradually over time.
Smoothing is only available for numeric and color data types.
Channel data may be processed with one of the following mathematical operations or using a custom function.
Disables the link. No processing is performed and the link is ignored when this mode is selected.
This replaces the current channel data with the source channel data. This is a good mode to use for 1:1 copying of data from one channel to another. If blend is at full strength (1), then the current channel data is fully overwritten.
This adds, subtracts, or multiplies the source data with the current channel data. These modes are useful to augment an animation by offsetting, reducing, or amplifying it.
Since both the source and destination channels can have their own animations, channel links can be used to create complex curves using simple techniques.
These modes are based on the math operations min() and max(). Min compares 2 values and returns the smaller of the two, while Max returns the greater of the two. This can be used to limit values or to perform boolean type operations between animation curves.
Use invert to mirror animation, subtracting the source value from the destination value.
Use remap to scale values from an input range to an output range. This can be helpful when mapping one property to another with a different value range.
A custom channel link operation can be defined by writing a script. This is implemented using a ScriptableObject. Your custom script must derive from the base class CustomChannelLink and use override functions to implement custom behavior.
This documentation assumes you are familiar with Unity scripting. Please see CustomChannelLinkDifference.cs for example code and refer to the comments for further details about the implementation.
To assign a custom channel link, an instance of the ScriptableObject must be created as an asset first. This is a one-time setup after which the object can be assigned in the channel link settings.
Right-click in the Project view and select Create > Timeflow > Create Channel Link
Once created, the custom link can be dragged from the project window to the custom link field in the mini inspector, as shown below.
For more commands and menu options related to channel links, see Channel Link Menu.
The receiving channel must have at least 1 keyframe for blending or when using any mode other than Overwrite. If the channel does not have any keyframes, then a warning similar to below is displayed.