The trajectory option displays the path that an object takes over time. Trajectory mode is selected by the user from the Motion panel UI element. The user can convert from splines into trajectories, from trajectories into splines, and to collapse any transform controller into editable keys.
In order for your object plug-in to support trajectories it must override the following methods from the Interface10
class.
Interface10::GetTrajectoryMode()
- Returns true if we are in trajectory mode, false otherwise.Interface10::SetTrajectoryMode()
- Set whether or not we are in the trajectory mode in the motion panel. If flag is true then we enter the trajectory mode in the motion panel, otherwise if false and the object is in the trajectory mode, it should leave trajectory mode.Interface10::GetTrajectoryKeySubMode()
- Gets whether or not the trajectory is in the key sub-object mode so that keys may be edited. Returns true if the trajectory is in key sub-object mode is on, else false.Interface10::SetTrajectoryKeySubMode()
- Sets whether or not the trajectory is in the key sub-object mode or not. If flag is true then we enter the key subobject mode with trajectories enabled, if not already in that mode. If false and we are in the key sub-object mode, then we exit this sub-object mode.Interface10::GetTrajectoryAddKeyMode()
- Gets whether or not the trajectory is in the add mode of the key sub-object mode so that keys may be added by interactively pressing left-click on the trajectory. Returns true if the trajectory is in a mode for adding keys, otherwise returns false.Interface10::SetTrajectoryAddKeyMode()
- Sets whether or not the trajectory is in the add mode of the key sub-object mode or not so that keys may be added by interactively pressing left-click on the trajectory. If flag is true then we enter the add mode of the key sub-object mode with trajectories enabled, if not already in that mode. If false and we are in the key sub-object mode, then we exit the add mode, if currently in this mode, otherwise nothing occurs.Interface10::DeleteSelectedTrajectoryKey()
- Delete the selected trajectory keys. This function will only do something if trajectories are enabled and we are in the key sub-object mode with selected keys.The following example demonstrates how to use the APIs for trajectory by delegating the functionality to the CORE interface.
// virtual bool Interface10::GetTrajectoryMode()const =0;
bool MyInterface::GetTrajectoryMode() const
{
Interface10 *ip = GetCOREInterface10();
if(ip == NULL){
return false;
}
return ip->GetTrajectoryMode();
}
// virtual void Interface10::SetTrajectoryMode(bool flag) =0;
bool MyInterface::SetTrajectoryMode(bool a_bFlag)
{
Interface10 *ip = GetCOREInterface10();
if(ip == NULL){
return false;
}
ip->SetTrajectoryMode(a_bFlag);
return true;
}
// virtual bool Interface10::GetTrajectoryKeySubMode()const =0;
bool MyInterface::GetTrajectoryKeySubMode() const
{
Interface10 *ip = GetCOREInterface10();
if(ip == NULL){
return false;
}
return ip->GetTrajectoryKeySubMode();
}
// virtual void Interface10::SetTrajectoryKeySubMode(bool flag) =0;
bool MyInterface::SetTrajectoryKeySubMode(bool a_bFlag)
{
Interface10 *ip = GetCOREInterface10();
if(ip == NULL){
return false;
}
ip->SetTrajectoryKeySubMode(a_bFlag);
return true;
}
// virtual bool Interface10::GetTrajectoryAddKeyMode() const =0;
bool MyInterface::GetTrajectoryAddKeyMode() const
{
Interface10 *ip = GetCOREInterface10();
if(ip == NULL){
return false;
}
return ip->GetTrajectoryAddKeyMode();
}
// virtual void Interface10::DeleteSelectedTrajectoryKey() =0;
bool MyInterface::DeleteSelectedTrajectoryKey(void)
{
Interface10 *ip = GetCOREInterface10();
if(ip == NULL){
return false;
}
ip->DeleteSelectedTrajectoryKey();
return true;
}