Unigine::ObjectMeshSkinned Class
Header: | #include <UnigineObjects.h> |
Inherits from: | Object |
This class is used to create or modify skinned meshes.
Creating and Playing Animation#
To add the animation to the ObjectMeshSkinned and play it, do the following:
- Set the number of animation layers with setNumLayers(). There is only one layer by default.
- Enable the layer and set the animation weight for blending by calling the setLayer() function.
-
Add the animation *.anim file by using the setLayerAnimationFilePath() function.
- Play the added animation by calling the setLayerFrame() function for each animation layer.
Blending is performed between all layers. The contribution of each layer depends on its weight. Also, you can optionally define single bone transformations by hand, if needed, using either setBoneTransform() or setBoneTransformWithChildren().
Usage Example
The following example shows how to blend 2 different animations assigned to a mesh. In this example we use the mesh and animations from UNIGINE samples located in <UnigineSDK>/data/samples/animation/meshes and <UnigineSDK>/data/samples/animation/animations folders, respectively. Animations are added by using the setLayerAnimationFilePath() function.
Below you'll find an example of using the Component System to access animation assets.
- Create a component for controlling loading of animations and generate a property for it.
- Assign its property to the target controller node.
-
Assign desired animation assets to the parameters of the property by using the Editor.
Assigning animation assets to property parameters via the Editor -
Implement logic of creating a skinned mesh with the specified animations. The complete source code:
#pragma once #include <UnigineComponentSystem.h> #include <UnigineObjects.h> class SkinnedMeshController: public Unigine::ComponentBase { public: COMPONENT(SkinnedMeshController, ComponentBase); COMPONENT_INIT(init); COMPONENT_UPDATE(update); COMPONENT_SHUTDOWN(shutdown); PROP_NAME("skinned_controller_property"); // property parameters for mesh and animation assets PROP_PARAM(File, mesh_asset); PROP_PARAM(File, anim_asset_1); PROP_PARAM(File, anim_asset_2); protected: void init(); void update(); void shutdown(); private: // the pointer to the skinned mesh object Unigine::ObjectMeshSkinnedPtr skinned_mesh; };
#include "SkinnedMeshController.h" #include <UnigineGame.h> // register the component REGISTER_COMPONENT(SkinnedMeshController); using namespace Unigine; void SkinnedMeshController::init() { // create the new ObjectMeshSkinned mesh based on an existing mesh skinned_mesh = ObjectMeshSkinned::create(mesh_asset); // set the number of animation layers skinned_mesh->setNumLayers(2); // load animations from the files skinned_mesh->setLayerAnimationFilePath(0, anim_asset_1); skinned_mesh->setLayerAnimationFilePath(1, anim_asset_2); // enable each layer and set an animation weight skinned_mesh->setLayer(0, true, 0.7f); skinned_mesh->setLayer(1, true, 0.3f); } void SkinnedMeshController::update() { // play each animation skinned_mesh->setLayerFrame(0, Game::getTime() * 25.0f); skinned_mesh->setLayerFrame(1, Game::getTime() * 25.0f); } void SkinnedMeshController::shutdown() { }
Updating Bone Transformations#
Some of the methods require to update the animation data before the renderer makes its update and actually draws the skinned mesh. Such update allows to get the correct result of blending between the frames and layers.
The execution sequence of updating bone transformations is the following:
- Call the method, which sets the update flag. This flag shows that the instance should be updated.
- Update the bone transformations by calling proper functions. These functions check the flag and if the flag is set, they calculate the transformations and set the flag to the default value.
- During the rendering, the engine performs animations and transformations which were calculated on the previous step or recalculates them, if the update flag has been set. If calculations have been performed, the flag is set to the default value.
If you try to update bone transformations before you set the flag to update, functions will not calculate new transformations and the engine doesn't perform them.
When you change the transformation of the bone, you should notify all skinned meshes which use these bone about these transformations to update the mesh. When you change transformations of a bone, skinned mesh instances get the flag to update. When you use the setLayerFrame() function, you set necessary transformations for the specified skinned mesh.
Instancing#
Surfaces of identical skinned meshes which have the same materials assigned to them and the same number of bones attached to their vertices are automatically instanced and drawn in one draw call.
The data buffers for instanced objects that store bones transformations are limited in size; therefore, if skinned meshes have many bones, only a few meshes can populate the instance data buffer to be drawn in one draw call.
Reusing Animations#
Animations from one character can be used for another.
Animation Frame Masks#
Masks are the simplest way of reusing animations, a couple of words about how they work. To each layer of an ObjectMeshSkinned you can assign some animation and based on its frames it will change bone transformations on this layer. You can use masks to choose which components of the animation frame (position, rotation, scale, their combinations, or all of them) are to be used for each particular layer. In case any component is missing in the mask, the corresponding value will be taken from the T-pose.
As an example let's take eyes animation for these two skeletons:
They have absolutely the same bone hierarchy as well as bone names, only the proportions differ. If we use animation for eyes from the left skeleton for the right one, we'll get the following result:
The initial animation has completely changed the proportions of the second skeleton. We can fix it by setting ANIM_FRAME_USES_ROTATION mask to eye bones, and ANIM_FRAME_USES_NONE for the rest of the bones via the setLayerBoneFrameUses() / getLayerBoneFrameUses() methods. Thus, all values except for eyes rotation will be taken from the T-pose :
If the skeletons have different bone names you should first apply retargeting and then use masks. In this case it is not that important to have similar skeletons.
Retargeting#
To reuse animation entirely, both source and target skeletons must have similar bone hierarchy and their T-poses must not significantly differ.
This is acceptable and will work fine:
as we have similar bone hierarchies and all bones have similar bases in T-poses, only the proportions differ, but this proportion is almost uniform for all bones.
But we cannot use the following:
Although the hierarchy looks similar, the T-poses differ and bones have different bases.
These limitations can be ignored if you need to retarget only some subset of the bones (e.g.: retarget bones having different names and then use only masks).
Inverse Kinematics (IK)#
ObjectMeshSkinned supports inverse kinematics (IK) for bone chains (IK chains). Inverse kinematics provide a way to handle joint rotation from the location of an end-effector rather than via direct joint rotation. You provide a location of the effector and the IK Solver attempts to find a rotation so that the final joint coincides with that location as best it can. This can be used to position a character's feet properly on uneven ground, and ensure believable interactions with the world. The tolerance value sets a threshold where the target is considered to have reached its destination position, and when the IK Solver stops iterating.
An IK chain can have an arbitrary length (contain an arbitrary number of bones), it has an auxiliary vector enabling you to control bending direction. You can also set rotation for the last joint of the chain.
Each IK chain has a weight value that can be used to control the impact of the target on the last joint of the chain. This enables you to make smooth transitions from the source animation to required target position of the limb.
To visualize IK chains you can use the following methods: addVisualizeIKChain(), removeVisualizeIKChain(), and clearVisualizeIKChain().
See Also#
- Mesh class
- Article on Mesh File Formats
- Animation sample in C# Component Samples suite
- Samples located in the <UnigineSDK>/data/samples/animation folder
ObjectMeshSkinned Class
枚举
BONE_SPACE#
Defines which transformation of the bone is to be overridden by the bind node's transformation.Name | 描述 |
---|---|
BONE_SPACE_WORLD = 0 | World coordinates. |
BONE_SPACE_OBJECT = 1 | Coordinates relative to the skinned mesh object. |
BONE_SPACE_LOCAL = 2 | Coordinates relative to the parent bone. |
NODE_SPACE#
Defines the type of transformation of the bind node to be used to override the transformation of the specified bone.Name | 描述 |
---|---|
NODE_SPACE_WORLD = 0 | World transformation of the node. |
NODE_SPACE_LOCAL = 1 | Local transformation of the node. |
BIND_MODE#
Type of blending of bind node's and bone's transformations.Name | 描述 |
---|---|
BIND_MODE_OVERRIDE = 0 | Replace bone's transformation with the transformation of the bind node. |
BIND_MODE_ADDITIVE = 1 | Bind node's transformation is added to the current transformation of the bone. |
ANIM_FRAME_USES#
Frame components to be used for animation.CHAIN_CONSTRAINT#
INTERPOLATION_ACCURACY#
Members
int getNumBones() const#
Return value
Current Number of bones of the skinned mesh.void setNumLayers ( int layers ) #
Arguments
- int layers - The number of animation layers (must be greater than 0).
int getNumLayers() const#
Return value
Current number of animation layers (must be greater than 0).bool isStopped() const#
Return value
true if animation is stopped; otherwise false.bool isPlaying() const#
Return value
true if animation is playing; otherwise false.void setSpeed ( float speed ) #
Arguments
- float speed - The playback speed multiplier value.
float getSpeed() const#
Return value
Current playback speed multiplier value.void setTime ( float time ) #
Arguments
- float time - The animation time, in animation frames.
float getTime() const#
Return value
Current animation time, in animation frames.void setLoop ( bool loop ) #
Arguments
- bool loop - Set true to enable playing of the animation in a loop; false - to disable it.
bool isLoop() const#
Return value
true if playing of the animation in a loop is enabled; otherwise false.void setControlled ( bool controlled ) #
Arguments
- bool controlled - Set true to enable animation is controlled by a parent ObjectMeshSkinned; false - to disable it.
bool isControlled() const#
Return value
true if animation is controlled by a parent ObjectMeshSkinned; otherwise false.void setQuaternion ( bool quaternion ) #
Arguments
- bool quaternion - Set true to enable dual-quaternion skinning mode; false - to disable it.
bool isQuaternion() const#
Return value
true if dual-quaternion skinning mode is enabled; otherwise false.void setUpdateDistanceLimit ( float limit = 200 ) #
Arguments
- float limit - The distance from the camera within which the object should be updated, in units.
float getUpdateDistanceLimit() const#
Return value
Current distance from the camera within which the object should be updated, in units.void setFPSInvisible ( int fpsinvisible = 0 ) #
Arguments
- int fpsinvisible - The update rate value when the object is not rendered at all.
int getFPSInvisible() const#
Return value
Current update rate value when the object is not rendered at all.void setFPSVisibleShadow ( int shadow = 30 ) #
Arguments
- int shadow - The update rate value when only object shadows are rendered.
int getFPSVisibleShadow() const#
Return value
Current update rate value when only object shadows are rendered.void setFPSVisibleCamera ( int camera = -1 ) #
Arguments
- int camera - The update rate value when the object is rendered to the viewport.
int getFPSVisibleCamera() const#
Return value
Current update rate value when the object is rendered to the viewport.void setVisualizeAllBones ( bool bones ) #
Arguments
- bool bones - Set true to enable visualization of bones and their basis vectors; false - to disable it.
bool isVisualizeAllBones() const#
Return value
true if visualization of bones and their basis vectors is enabled; otherwise false.int getNumIKChains() const#
Return value
Current number of IK chains.Event<const Ptr<ObjectMeshSkinned> &> getEventEndBoneConstraints() const#
Usage Example
// implement the EndBoneConstraints event handler
void endboneconstraints_event_handler(const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling EndBoneConstraints event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections endboneconstraints_event_connections;
// link to this instance when subscribing for an event (subscription for various events can be linked)
objectmeshskinned->getEventEndBoneConstraints().connect(endboneconstraints_event_connections, endboneconstraints_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
objectmeshskinned->getEventEndBoneConstraints().connect(endboneconstraints_event_connections, [](const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling EndBoneConstraints event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
endboneconstraints_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection endboneconstraints_event_connection;
// subscribe for the EndBoneConstraints event with a handler function keeping the connection
objectmeshskinned->getEventEndBoneConstraints().connect(endboneconstraints_event_connection, endboneconstraints_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
endboneconstraints_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
endboneconstraints_event_connection.setEnabled(true);
// ...
// remove subscription for the EndBoneConstraints event via the connection
endboneconstraints_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A EndBoneConstraints event handler implemented as a class member
void event_handler(const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling EndBoneConstraints event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
objectmeshskinned->getEventEndBoneConstraints().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe for the EndBoneConstraints event with a handler function
objectmeshskinned->getEventEndBoneConstraints().connect(endboneconstraints_event_handler);
// remove subscription for the EndBoneConstraints event later by the handler function
objectmeshskinned->getEventEndBoneConstraints().disconnect(endboneconstraints_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId endboneconstraints_handler_id;
// subscribe for the EndBoneConstraints event with a lambda handler function and keeping connection ID
endboneconstraints_handler_id = objectmeshskinned->getEventEndBoneConstraints().connect([](const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling EndBoneConstraints event (lambda).\n");
}
);
// remove the subscription later using the ID
objectmeshskinned->getEventEndBoneConstraints().disconnect(endboneconstraints_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all EndBoneConstraints events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
objectmeshskinned->getEventEndBoneConstraints().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
objectmeshskinned->getEventEndBoneConstraints().setEnabled(true);
Usage Example
// implement the EndBoneConstraints event handler
void endboneconstraints_event_handler(const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling EndBoneConstraints event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections endboneconstraints_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventEndBoneConstraints().connect(endboneconstraints_event_connections, endboneconstraints_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventEndBoneConstraints().connect(endboneconstraints_event_connections, [](const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling EndBoneConstraints event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
endboneconstraints_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection endboneconstraints_event_connection;
// subscribe to the EndBoneConstraints event with a handler function keeping the connection
publisher->getEventEndBoneConstraints().connect(endboneconstraints_event_connection, endboneconstraints_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
endboneconstraints_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
endboneconstraints_event_connection.setEnabled(true);
// ...
// remove subscription to the EndBoneConstraints event via the connection
endboneconstraints_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A EndBoneConstraints event handler implemented as a class member
void event_handler(const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling EndBoneConstraints event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventEndBoneConstraints().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. Subscribe to an event saving a particular connection ID
// and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// instance of the EventConnections class to manage event connections
EventConnections e_connections;
// define a particular connection ID to be used to unsubscribe later
EventConnectionId endboneconstraints_handler_id;
// subscribe to the EndBoneConstraints event with a lambda handler function and keeping connection ID
endboneconstraints_handler_id = publisher->getEventEndBoneConstraints().connect(e_connections, [](const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling EndBoneConstraints event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventEndBoneConstraints().disconnect(endboneconstraints_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 5. Ignoring all EndBoneConstraints events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventEndBoneConstraints().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventEndBoneConstraints().setEnabled(true);
Return value
Event reference.Event<const Ptr<ObjectMeshSkinned> &> getEventBeginBoneConstraints() const#
Usage Example
// implement the BeginBoneConstraints event handler
void beginboneconstraints_event_handler(const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling BeginBoneConstraints event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections beginboneconstraints_event_connections;
// link to this instance when subscribing for an event (subscription for various events can be linked)
objectmeshskinned->getEventBeginBoneConstraints().connect(beginboneconstraints_event_connections, beginboneconstraints_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
objectmeshskinned->getEventBeginBoneConstraints().connect(beginboneconstraints_event_connections, [](const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling BeginBoneConstraints event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
beginboneconstraints_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection beginboneconstraints_event_connection;
// subscribe for the BeginBoneConstraints event with a handler function keeping the connection
objectmeshskinned->getEventBeginBoneConstraints().connect(beginboneconstraints_event_connection, beginboneconstraints_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
beginboneconstraints_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
beginboneconstraints_event_connection.setEnabled(true);
// ...
// remove subscription for the BeginBoneConstraints event via the connection
beginboneconstraints_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A BeginBoneConstraints event handler implemented as a class member
void event_handler(const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling BeginBoneConstraints event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
objectmeshskinned->getEventBeginBoneConstraints().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe for the BeginBoneConstraints event with a handler function
objectmeshskinned->getEventBeginBoneConstraints().connect(beginboneconstraints_event_handler);
// remove subscription for the BeginBoneConstraints event later by the handler function
objectmeshskinned->getEventBeginBoneConstraints().disconnect(beginboneconstraints_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId beginboneconstraints_handler_id;
// subscribe for the BeginBoneConstraints event with a lambda handler function and keeping connection ID
beginboneconstraints_handler_id = objectmeshskinned->getEventBeginBoneConstraints().connect([](const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling BeginBoneConstraints event (lambda).\n");
}
);
// remove the subscription later using the ID
objectmeshskinned->getEventBeginBoneConstraints().disconnect(beginboneconstraints_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all BeginBoneConstraints events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
objectmeshskinned->getEventBeginBoneConstraints().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
objectmeshskinned->getEventBeginBoneConstraints().setEnabled(true);
Usage Example
// implement the BeginBoneConstraints event handler
void beginboneconstraints_event_handler(const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling BeginBoneConstraints event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections beginboneconstraints_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventBeginBoneConstraints().connect(beginboneconstraints_event_connections, beginboneconstraints_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventBeginBoneConstraints().connect(beginboneconstraints_event_connections, [](const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling BeginBoneConstraints event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
beginboneconstraints_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection beginboneconstraints_event_connection;
// subscribe to the BeginBoneConstraints event with a handler function keeping the connection
publisher->getEventBeginBoneConstraints().connect(beginboneconstraints_event_connection, beginboneconstraints_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
beginboneconstraints_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
beginboneconstraints_event_connection.setEnabled(true);
// ...
// remove subscription to the BeginBoneConstraints event via the connection
beginboneconstraints_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A BeginBoneConstraints event handler implemented as a class member
void event_handler(const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling BeginBoneConstraints event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventBeginBoneConstraints().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. Subscribe to an event saving a particular connection ID
// and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// instance of the EventConnections class to manage event connections
EventConnections e_connections;
// define a particular connection ID to be used to unsubscribe later
EventConnectionId beginboneconstraints_handler_id;
// subscribe to the BeginBoneConstraints event with a lambda handler function and keeping connection ID
beginboneconstraints_handler_id = publisher->getEventBeginBoneConstraints().connect(e_connections, [](const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling BeginBoneConstraints event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventBeginBoneConstraints().disconnect(beginboneconstraints_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 5. Ignoring all BeginBoneConstraints events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventBeginBoneConstraints().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventBeginBoneConstraints().setEnabled(true);
Return value
Event reference.Event<const Ptr<ObjectMeshSkinned> &> getEventEndIKSolvers() const#
Usage Example
// implement the EndIKSolvers event handler
void endiksolvers_event_handler(const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling EndIKSolvers event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections endiksolvers_event_connections;
// link to this instance when subscribing for an event (subscription for various events can be linked)
objectmeshskinned->getEventEndIKSolvers().connect(endiksolvers_event_connections, endiksolvers_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
objectmeshskinned->getEventEndIKSolvers().connect(endiksolvers_event_connections, [](const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling EndIKSolvers event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
endiksolvers_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection endiksolvers_event_connection;
// subscribe for the EndIKSolvers event with a handler function keeping the connection
objectmeshskinned->getEventEndIKSolvers().connect(endiksolvers_event_connection, endiksolvers_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
endiksolvers_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
endiksolvers_event_connection.setEnabled(true);
// ...
// remove subscription for the EndIKSolvers event via the connection
endiksolvers_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A EndIKSolvers event handler implemented as a class member
void event_handler(const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling EndIKSolvers event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
objectmeshskinned->getEventEndIKSolvers().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe for the EndIKSolvers event with a handler function
objectmeshskinned->getEventEndIKSolvers().connect(endiksolvers_event_handler);
// remove subscription for the EndIKSolvers event later by the handler function
objectmeshskinned->getEventEndIKSolvers().disconnect(endiksolvers_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId endiksolvers_handler_id;
// subscribe for the EndIKSolvers event with a lambda handler function and keeping connection ID
endiksolvers_handler_id = objectmeshskinned->getEventEndIKSolvers().connect([](const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling EndIKSolvers event (lambda).\n");
}
);
// remove the subscription later using the ID
objectmeshskinned->getEventEndIKSolvers().disconnect(endiksolvers_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all EndIKSolvers events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
objectmeshskinned->getEventEndIKSolvers().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
objectmeshskinned->getEventEndIKSolvers().setEnabled(true);
Usage Example
// implement the EndIKSolvers event handler
void endiksolvers_event_handler(const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling EndIKSolvers event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections endiksolvers_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventEndIKSolvers().connect(endiksolvers_event_connections, endiksolvers_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventEndIKSolvers().connect(endiksolvers_event_connections, [](const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling EndIKSolvers event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
endiksolvers_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection endiksolvers_event_connection;
// subscribe to the EndIKSolvers event with a handler function keeping the connection
publisher->getEventEndIKSolvers().connect(endiksolvers_event_connection, endiksolvers_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
endiksolvers_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
endiksolvers_event_connection.setEnabled(true);
// ...
// remove subscription to the EndIKSolvers event via the connection
endiksolvers_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A EndIKSolvers event handler implemented as a class member
void event_handler(const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling EndIKSolvers event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventEndIKSolvers().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. Subscribe to an event saving a particular connection ID
// and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// instance of the EventConnections class to manage event connections
EventConnections e_connections;
// define a particular connection ID to be used to unsubscribe later
EventConnectionId endiksolvers_handler_id;
// subscribe to the EndIKSolvers event with a lambda handler function and keeping connection ID
endiksolvers_handler_id = publisher->getEventEndIKSolvers().connect(e_connections, [](const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling EndIKSolvers event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventEndIKSolvers().disconnect(endiksolvers_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 5. Ignoring all EndIKSolvers events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventEndIKSolvers().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventEndIKSolvers().setEnabled(true);
Return value
Event reference.Event<const Ptr<ObjectMeshSkinned> &> getEventBeginIKSolvers() const#
Usage Example
// implement the BeginIKSolvers event handler
void beginiksolvers_event_handler(const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling BeginIKSolvers event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections beginiksolvers_event_connections;
// link to this instance when subscribing for an event (subscription for various events can be linked)
objectmeshskinned->getEventBeginIKSolvers().connect(beginiksolvers_event_connections, beginiksolvers_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
objectmeshskinned->getEventBeginIKSolvers().connect(beginiksolvers_event_connections, [](const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling BeginIKSolvers event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
beginiksolvers_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection beginiksolvers_event_connection;
// subscribe for the BeginIKSolvers event with a handler function keeping the connection
objectmeshskinned->getEventBeginIKSolvers().connect(beginiksolvers_event_connection, beginiksolvers_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
beginiksolvers_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
beginiksolvers_event_connection.setEnabled(true);
// ...
// remove subscription for the BeginIKSolvers event via the connection
beginiksolvers_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A BeginIKSolvers event handler implemented as a class member
void event_handler(const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling BeginIKSolvers event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
objectmeshskinned->getEventBeginIKSolvers().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe for the BeginIKSolvers event with a handler function
objectmeshskinned->getEventBeginIKSolvers().connect(beginiksolvers_event_handler);
// remove subscription for the BeginIKSolvers event later by the handler function
objectmeshskinned->getEventBeginIKSolvers().disconnect(beginiksolvers_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId beginiksolvers_handler_id;
// subscribe for the BeginIKSolvers event with a lambda handler function and keeping connection ID
beginiksolvers_handler_id = objectmeshskinned->getEventBeginIKSolvers().connect([](const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling BeginIKSolvers event (lambda).\n");
}
);
// remove the subscription later using the ID
objectmeshskinned->getEventBeginIKSolvers().disconnect(beginiksolvers_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all BeginIKSolvers events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
objectmeshskinned->getEventBeginIKSolvers().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
objectmeshskinned->getEventBeginIKSolvers().setEnabled(true);
Usage Example
// implement the BeginIKSolvers event handler
void beginiksolvers_event_handler(const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling BeginIKSolvers event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections beginiksolvers_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventBeginIKSolvers().connect(beginiksolvers_event_connections, beginiksolvers_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventBeginIKSolvers().connect(beginiksolvers_event_connections, [](const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling BeginIKSolvers event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
beginiksolvers_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection beginiksolvers_event_connection;
// subscribe to the BeginIKSolvers event with a handler function keeping the connection
publisher->getEventBeginIKSolvers().connect(beginiksolvers_event_connection, beginiksolvers_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
beginiksolvers_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
beginiksolvers_event_connection.setEnabled(true);
// ...
// remove subscription to the BeginIKSolvers event via the connection
beginiksolvers_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A BeginIKSolvers event handler implemented as a class member
void event_handler(const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling BeginIKSolvers event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventBeginIKSolvers().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. Subscribe to an event saving a particular connection ID
// and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// instance of the EventConnections class to manage event connections
EventConnections e_connections;
// define a particular connection ID to be used to unsubscribe later
EventConnectionId beginiksolvers_handler_id;
// subscribe to the BeginIKSolvers event with a lambda handler function and keeping connection ID
beginiksolvers_handler_id = publisher->getEventBeginIKSolvers().connect(e_connections, [](const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling BeginIKSolvers event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventBeginIKSolvers().disconnect(beginiksolvers_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 5. Ignoring all BeginIKSolvers events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventBeginIKSolvers().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventBeginIKSolvers().setEnabled(true);
Return value
Event reference.Event<const Ptr<ObjectMeshSkinned> &> getEventEndLookAtSolvers() const#
Usage Example
// implement the EndLookAtSolvers event handler
void endlookatsolvers_event_handler(const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling EndLookAtSolvers event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections endlookatsolvers_event_connections;
// link to this instance when subscribing for an event (subscription for various events can be linked)
objectmeshskinned->getEventEndLookAtSolvers().connect(endlookatsolvers_event_connections, endlookatsolvers_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
objectmeshskinned->getEventEndLookAtSolvers().connect(endlookatsolvers_event_connections, [](const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling EndLookAtSolvers event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
endlookatsolvers_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection endlookatsolvers_event_connection;
// subscribe for the EndLookAtSolvers event with a handler function keeping the connection
objectmeshskinned->getEventEndLookAtSolvers().connect(endlookatsolvers_event_connection, endlookatsolvers_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
endlookatsolvers_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
endlookatsolvers_event_connection.setEnabled(true);
// ...
// remove subscription for the EndLookAtSolvers event via the connection
endlookatsolvers_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A EndLookAtSolvers event handler implemented as a class member
void event_handler(const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling EndLookAtSolvers event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
objectmeshskinned->getEventEndLookAtSolvers().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe for the EndLookAtSolvers event with a handler function
objectmeshskinned->getEventEndLookAtSolvers().connect(endlookatsolvers_event_handler);
// remove subscription for the EndLookAtSolvers event later by the handler function
objectmeshskinned->getEventEndLookAtSolvers().disconnect(endlookatsolvers_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId endlookatsolvers_handler_id;
// subscribe for the EndLookAtSolvers event with a lambda handler function and keeping connection ID
endlookatsolvers_handler_id = objectmeshskinned->getEventEndLookAtSolvers().connect([](const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling EndLookAtSolvers event (lambda).\n");
}
);
// remove the subscription later using the ID
objectmeshskinned->getEventEndLookAtSolvers().disconnect(endlookatsolvers_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all EndLookAtSolvers events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
objectmeshskinned->getEventEndLookAtSolvers().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
objectmeshskinned->getEventEndLookAtSolvers().setEnabled(true);
Usage Example
// implement the EndLookAtSolvers event handler
void endlookatsolvers_event_handler(const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling EndLookAtSolvers event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections endlookatsolvers_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventEndLookAtSolvers().connect(endlookatsolvers_event_connections, endlookatsolvers_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventEndLookAtSolvers().connect(endlookatsolvers_event_connections, [](const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling EndLookAtSolvers event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
endlookatsolvers_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection endlookatsolvers_event_connection;
// subscribe to the EndLookAtSolvers event with a handler function keeping the connection
publisher->getEventEndLookAtSolvers().connect(endlookatsolvers_event_connection, endlookatsolvers_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
endlookatsolvers_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
endlookatsolvers_event_connection.setEnabled(true);
// ...
// remove subscription to the EndLookAtSolvers event via the connection
endlookatsolvers_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A EndLookAtSolvers event handler implemented as a class member
void event_handler(const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling EndLookAtSolvers event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventEndLookAtSolvers().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. Subscribe to an event saving a particular connection ID
// and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// instance of the EventConnections class to manage event connections
EventConnections e_connections;
// define a particular connection ID to be used to unsubscribe later
EventConnectionId endlookatsolvers_handler_id;
// subscribe to the EndLookAtSolvers event with a lambda handler function and keeping connection ID
endlookatsolvers_handler_id = publisher->getEventEndLookAtSolvers().connect(e_connections, [](const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling EndLookAtSolvers event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventEndLookAtSolvers().disconnect(endlookatsolvers_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 5. Ignoring all EndLookAtSolvers events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventEndLookAtSolvers().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventEndLookAtSolvers().setEnabled(true);
Return value
Event reference.Event<const Ptr<ObjectMeshSkinned> &> getEventBeginLookAtSolvers() const#
Usage Example
// implement the BeginLookAtSolvers event handler
void beginlookatsolvers_event_handler(const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling BeginLookAtSolvers event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections beginlookatsolvers_event_connections;
// link to this instance when subscribing for an event (subscription for various events can be linked)
objectmeshskinned->getEventBeginLookAtSolvers().connect(beginlookatsolvers_event_connections, beginlookatsolvers_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
objectmeshskinned->getEventBeginLookAtSolvers().connect(beginlookatsolvers_event_connections, [](const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling BeginLookAtSolvers event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
beginlookatsolvers_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection beginlookatsolvers_event_connection;
// subscribe for the BeginLookAtSolvers event with a handler function keeping the connection
objectmeshskinned->getEventBeginLookAtSolvers().connect(beginlookatsolvers_event_connection, beginlookatsolvers_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
beginlookatsolvers_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
beginlookatsolvers_event_connection.setEnabled(true);
// ...
// remove subscription for the BeginLookAtSolvers event via the connection
beginlookatsolvers_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A BeginLookAtSolvers event handler implemented as a class member
void event_handler(const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling BeginLookAtSolvers event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
objectmeshskinned->getEventBeginLookAtSolvers().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe for the BeginLookAtSolvers event with a handler function
objectmeshskinned->getEventBeginLookAtSolvers().connect(beginlookatsolvers_event_handler);
// remove subscription for the BeginLookAtSolvers event later by the handler function
objectmeshskinned->getEventBeginLookAtSolvers().disconnect(beginlookatsolvers_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId beginlookatsolvers_handler_id;
// subscribe for the BeginLookAtSolvers event with a lambda handler function and keeping connection ID
beginlookatsolvers_handler_id = objectmeshskinned->getEventBeginLookAtSolvers().connect([](const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling BeginLookAtSolvers event (lambda).\n");
}
);
// remove the subscription later using the ID
objectmeshskinned->getEventBeginLookAtSolvers().disconnect(beginlookatsolvers_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all BeginLookAtSolvers events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
objectmeshskinned->getEventBeginLookAtSolvers().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
objectmeshskinned->getEventBeginLookAtSolvers().setEnabled(true);
Usage Example
// implement the BeginLookAtSolvers event handler
void beginlookatsolvers_event_handler(const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling BeginLookAtSolvers event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections beginlookatsolvers_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventBeginLookAtSolvers().connect(beginlookatsolvers_event_connections, beginlookatsolvers_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventBeginLookAtSolvers().connect(beginlookatsolvers_event_connections, [](const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling BeginLookAtSolvers event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
beginlookatsolvers_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection beginlookatsolvers_event_connection;
// subscribe to the BeginLookAtSolvers event with a handler function keeping the connection
publisher->getEventBeginLookAtSolvers().connect(beginlookatsolvers_event_connection, beginlookatsolvers_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
beginlookatsolvers_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
beginlookatsolvers_event_connection.setEnabled(true);
// ...
// remove subscription to the BeginLookAtSolvers event via the connection
beginlookatsolvers_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A BeginLookAtSolvers event handler implemented as a class member
void event_handler(const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling BeginLookAtSolvers event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventBeginLookAtSolvers().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. Subscribe to an event saving a particular connection ID
// and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// instance of the EventConnections class to manage event connections
EventConnections e_connections;
// define a particular connection ID to be used to unsubscribe later
EventConnectionId beginlookatsolvers_handler_id;
// subscribe to the BeginLookAtSolvers event with a lambda handler function and keeping connection ID
beginlookatsolvers_handler_id = publisher->getEventBeginLookAtSolvers().connect(e_connections, [](const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling BeginLookAtSolvers event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventBeginLookAtSolvers().disconnect(beginlookatsolvers_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 5. Ignoring all BeginLookAtSolvers events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventBeginLookAtSolvers().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventBeginLookAtSolvers().setEnabled(true);
Return value
Event reference.Event<float, const Ptr<ObjectMeshSkinned> &> getEventUpdate() const#
Usage Example
// implement the Update event handler
void update_event_handler(float ifps, const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling Update event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections update_event_connections;
// link to this instance when subscribing for an event (subscription for various events can be linked)
objectmeshskinned->getEventUpdate().connect(update_event_connections, update_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
objectmeshskinned->getEventUpdate().connect(update_event_connections, [](float ifps, const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling Update event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
update_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection update_event_connection;
// subscribe for the Update event with a handler function keeping the connection
objectmeshskinned->getEventUpdate().connect(update_event_connection, update_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
update_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
update_event_connection.setEnabled(true);
// ...
// remove subscription for the Update event via the connection
update_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A Update event handler implemented as a class member
void event_handler(float ifps, const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling Update event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
objectmeshskinned->getEventUpdate().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe for the Update event with a handler function
objectmeshskinned->getEventUpdate().connect(update_event_handler);
// remove subscription for the Update event later by the handler function
objectmeshskinned->getEventUpdate().disconnect(update_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId update_handler_id;
// subscribe for the Update event with a lambda handler function and keeping connection ID
update_handler_id = objectmeshskinned->getEventUpdate().connect([](float ifps, const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling Update event (lambda).\n");
}
);
// remove the subscription later using the ID
objectmeshskinned->getEventUpdate().disconnect(update_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all Update events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
objectmeshskinned->getEventUpdate().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
objectmeshskinned->getEventUpdate().setEnabled(true);
Usage Example
// implement the Update event handler
void update_event_handler(float ifps, const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling Update event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections update_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventUpdate().connect(update_event_connections, update_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventUpdate().connect(update_event_connections, [](float ifps, const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling Update event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
update_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection update_event_connection;
// subscribe to the Update event with a handler function keeping the connection
publisher->getEventUpdate().connect(update_event_connection, update_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
update_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
update_event_connection.setEnabled(true);
// ...
// remove subscription to the Update event via the connection
update_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A Update event handler implemented as a class member
void event_handler(float ifps, const Ptr<ObjectMeshSkinned> & skinned)
{
Log::message("\Handling Update event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventUpdate().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. Subscribe to an event saving a particular connection ID
// and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// instance of the EventConnections class to manage event connections
EventConnections e_connections;
// define a particular connection ID to be used to unsubscribe later
EventConnectionId update_handler_id;
// subscribe to the Update event with a lambda handler function and keeping connection ID
update_handler_id = publisher->getEventUpdate().connect(e_connections, [](float ifps, const Ptr<ObjectMeshSkinned> & skinned) {
Log::message("\Handling Update event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventUpdate().disconnect(update_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 5. Ignoring all Update events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventUpdate().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventUpdate().setEnabled(true);
Return value
Event reference.int getNumBoneConstraints() const#
Return value
Current total number of constraints.void setInterpolationAccuracy ( ObjectMeshSkinned::INTERPOLATION_ACCURACY accuracy ) #
Arguments
- ObjectMeshSkinned::INTERPOLATION_ACCURACY accuracy - The interpolation mode for the bone rotations. The default value is set to HIGH.
ObjectMeshSkinned::INTERPOLATION_ACCURACY getInterpolationAccuracy() const#
Return value
Current interpolation mode for the bone rotations. The default value is set to HIGH.void setAnimPath ( const char * path ) #
Arguments
- const char * path - The path to a file containing the specified animation.
const char * getAnimPath() const#
Return value
Current path to a file containing the specified animation.bool isLoaded() const#
Return value
true if the mesh is procedural or has been loaded from a mesh file; otherwise false.void setMeshPath ( const char * path ) #
Arguments
- const char * path - The path to the mesh file.
const char * getMeshPath() const#
Return value
Current path to the mesh file.static ObjectMeshSkinnedPtr create ( const char * path ) #
ObjectMeshSkinned constructor.Arguments
- const char * path - Path to the skinned mesh file.
static ObjectMeshSkinnedPtr create ( ) #
ObjectMeshSkinned constructor.int getBoneChild ( int bone, int child ) const#
Returns the number of a child of the given bone.Arguments
- int bone - Bone number.
- int child - Child number.
Return value
Number of the child in the collection of all bones.void setBoneTransformWithChildren ( int bone, const Math::mat4 & transform ) #
Sets transformation for the bone and all of its children (without considering node transformations).Arguments
- int bone - Bone number.
- const Math::mat4 & transform - Transformation matrix.
const char * getBoneName ( int bone ) const#
Returns the name of the given bone.Arguments
- int bone - Bone number.
Return value
Bone name.int getBoneParent ( int bone ) const#
Returns the number of the parent bone for a given one.Arguments
- int bone - Number of the bone, for which the parent will be returned.
Return value
Parent bone number, if the parent exists; otherwise, -1.void setBoneTransform ( int bone, const Math::mat4 & transform ) #
Sets a transformation matrix for the given bone (without considering node transformations).Arguments
- int bone - Bone number.
- const Math::mat4 & transform - Transformation matrix.
Math::mat4 getBoneTransform ( int bone ) const#
Returns a transformation matrix of the given bone relatively to the parent object (not considering transformations of the Mesh Skinned node itself).Arguments
- int bone - Bone number.
Return value
Transformation matrix.void setBoneTransforms ( const int * bones, const Math::mat4 * transforms, int num_bones ) #
Sets a transformation matrix for given bones.Arguments
- const int * bones - Bone numbers.
- const Math::mat4 * transforms - Transformation matrices.
- int num_bones - Number of bones.
int getCIndex ( int num, int surface ) const#
Returns the coordinate index for the given vertex of the given surface.Arguments
- int num - Vertex number in the range from 0 to the total number of coordinate indices for the given surface.
To get the total number of coordinate indices for the given surface, use the getNumCIndices() method.
- int surface - Mesh surface number.
Return value
Coordinate index.Math::vec4 getColor ( int num, int surface ) const#
Returns the color of the given triangle vertex of the given surface.Arguments
- int num - Triangle vertex number in the range from 0 to the total number of vertex color entries of the given surface.
To get the total number of vertex color entries for the surface, call the getNumColors() method.
- int surface - Mesh surface number.
Return value
Vertex color.void setLayer ( int layer, bool enabled, float weight ) #
Enables or disables the given animation layer and sets the value of the weight parameter.Arguments
- int layer - Animation layer number.
- bool enabled - Enable flag. true to enable the layer, false to disable it.
- float weight - Animation layer weight.
void setLayerEnabled ( int layer, bool enabled ) #
Enables or disables a given animation layer.Arguments
- int layer - Animation layer number.
- bool enabled - true to enable the animation layer, false to disable it.
bool isLayerEnabled ( int layer ) const#
Returns a value indicating if a given animation layer is enabled.Arguments
- int layer - Animation layer number.
Return value
true if the layer is disabled; otherwise, false.void setLayerWeight ( int layer, float weight ) #
Sets a weight for the animation layer.Arguments
- int layer - Animation layer number.
- float weight - Animation layer weight.
float getLayerWeight ( int layer ) const#
Returns the weight of the animation layer.Arguments
- int layer - Animation layer number.
Return value
Weight of the animation layer.bool getMesh ( Ptr<Mesh> & mesh ) const#
Copies the current mesh into the source mesh.// a skinned mesh from which geometry will be obtained
ObjectMeshSkinnedPtr skinnedMesh = ObjectMeshSkinned::create("skinned.mesh");
// create a new mesh
MeshPtr mesh = Mesh::create();
// copy geometry to the created mesh
if (skinnedMesh->getMesh(mesh)) {
// do something with the obtained mesh
}
else {
Log::error("Failed to copy a mesh\n");
}
Arguments
Return value
1 if the mesh is copied successfully; otherwise, 0.bool getMeshSurface ( const Ptr<Mesh> & mesh, int surface, int target = -1 ) const#
Copies the specified mesh surface to the destination mesh.Arguments
- const Ptr<Mesh> & mesh - Destination Mesh to copy the surface to.
- int surface - Number of the mesh surface to be copied.
- int target - Number of the surface morph target to be copied. The default value is -1 (all morph targets).
Return value
Number of the new added mesh surface.Math::vec3 getNormal ( int num, int surface, int target = 0 ) const#
Returns the normal for the given triangle vertex of the given surface target.Arguments
- int num - Triangle vertex number in the range from 0 to the total number of vertex tangent entries of the given surface target.
Vertex normals are calculated using vertex tangents. To get the total number of vertex tangent entries for the surface target, call the getNumTangents() method.
- int surface - Mesh surface number.
- int target - Surface target number. The default value is 0.
Return value
Vertex normal.int getNumBoneChildren ( int bone ) const#
Returns the number of children for the specified bone.Arguments
- int bone - Bone number.
Return value
Number of child bones.int getNumCIndices ( int surface ) const#
Returns the number of coordinate indices for the given mesh surface.Arguments
- int surface - Mesh surface number.
Return value
Number of coordinate indices.int getNumColors ( int surface ) const#
Returns the total number of vertex color entries for the given surface.Arguments
- int surface - Surface number.
Return value
Number of vertex color entries.int getNumSurfaceTargets ( int surface ) const#
Returns the number of surface morph targets for the given mesh surface.Arguments
- int surface - Mesh surface number.
Return value
Number of surface morph targets.int getNumTangents ( int surface ) const#
Returns the number of vertex tangent entries of the given mesh surface.Arguments
- int surface - Mesh surface number.
Return value
Number of surface tangent vectors.int getNumTexCoords0 ( int surface ) const#
Returns the number of the first UV map texture coordinates for the given mesh surface.Arguments
- int surface - Mesh surface number.
Return value
Number of the first UV map texture coordinates.int getNumTexCoords1 ( int surface ) const#
Returns the number of the second UV map texture coordinates for the given mesh surface.Arguments
- int surface - Mesh surface number.
Return value
Number of the second UV map texture coordinates.int getNumTIndices ( int surface ) const#
Returns the number of triangle indices for the given mesh surface.Arguments
- int surface - Mesh surface number.
Return value
Number of triangle indices.int getNumVertex ( int surface ) const#
Returns the number of coordinate vertices for the given mesh surface.Arguments
- int surface - Mesh surface number.
Return value
Number of the surface vertices.Math::vec3 getSkinnedNormal ( int num, int index, int surface ) const#
Returns the skinned normal for the given triangle vertex.Arguments
- int num - Triangle vertex number in the range from 0 to the total number of vertex tangent entries of the given surface target.
Vertex normals are calculated using vertex tangents. To get the total number of vertex tangent entries for the surface target, call the getNumTangents() method.
- int index - Coordinate index of the vertex.
if -1 is passed, the coordinate index will be obtained for the first vertex having its triangle index equal to the specified triangle vertex number.
- int surface - Mesh surface number.
Return value
Skinned normal.Math::quat getSkinnedTangent ( int num, int index, int surface ) const#
Returns the skinned tangent vector for the given triangle vertex.Arguments
- int num - Triangle vertex number in the range from 0 to the total number of vertex tangent entries of the given surface target.
To get the total number of vertex tangent entries for the surface target, call the getNumTangents() method.
- int index - Coordinate index of the vertex.
if -1 is passed, the coordinate index will be obtained for the first vertex having its triangle index equal to the specified triangle vertex number.
- int surface - Mesh surface number.
Return value
Skinned tangent.Math::vec3 getSkinnedVertex ( int num, int surface ) const#
Returns skinned coordinates of the given coordinate vertex.Arguments
- int num - Coordinate vertex number in the range from 0 to the total number of coordinate vertices for the given surface.
To get the total number of coordinate vertices for the given surface, use the getNumVertex() method.
- int surface - Mesh surface number.
Return value
Vertex coordinates.bool isNeedUpdate ( ) const#
Returns a value indicating if the ObjectMeshSkinned needs to be updated (e.g. after adding new animations).Return value
true if the skinned mesh needs to be updated; otherwise, false.const char * getSurfaceTargetName ( int surface, int target ) const#
Returns the name of the morph target for the given mesh surface.Arguments
- int surface - Mesh surface number.
- int target - Morph target number.
Return value
Morph target name.Math::quat getTangent ( int num, int surface, int target = 0 ) const#
Returns the tangent for the given triangle vertex of the given surface target.Arguments
- int num - Triangle vertex number in the range from 0 to the total number of vertex tangent entries of the given surface.
To get the total number of vertex tangent entries for the surface, call the getNumTangents() method.
- int surface - Mesh surface number.
- int target - Surface target number. The default value is 0.
Return value
Vertex tangent.Math::vec2 getTexCoord0 ( int num, int surface ) const#
Returns first UV map texture coordinates for the given triangle vertex of the given surface.Arguments
- int num - Triangle vertex number in the range from 0 to the total number of first UV map texture coordinate entries of the given surface.
To get the total number of first UV map texture coordinate entries for the surface, call the getNumTexCoords0() method.
- int surface - Mesh surface number.
Return value
First UV map texture coordinates.Math::vec2 getTexCoord1 ( int num, int surface ) const#
Returns second UV map texture coordinates for the given triangle vertex of the given surface.Arguments
- int num - Triangle vertex number in the range from 0 to the total number of second UV map texture coordinate entries of the given surface.
To get the total number of second UV map texture coordinate entries for the surface, call the getNumTexCoords1() method.
- int surface - Mesh surface number.
Return value
Second UV map texture coordinates.int getTIndex ( int num, int surface ) const#
Returns the triangle index for the given surface by using the index number.Arguments
- int num - Vertex number in the range from 0 to the total number of triangle indices for the given surface.
To get the total number of triangle indices for the given surface, use the getNumTIndices() method.
- int surface - Mesh surface number.
Return value
Triangle index.Math::vec3 getVertex ( int num, int surface, int target = 0 ) const#
Returns coordinates of the given coordinate vertex of the given surface target.Arguments
- int num - Coordinate vertex number in the range from 0 to the total number of coordinate vertices for the given surface.
To get the total number of coordinate vertices for the given surface, use the getNumCVertex() method.
- int surface - Mesh surface number.
- int target - Surface target number. The default value is 0.
Return value
Vertex coordinates.void setBoneWorldTransformWithChildren ( int bone, const Math::Mat4 & transform ) #
Sets the transformation for the given bone and all of its children in the world coordinate space (considering node transformations).Arguments
- int bone - Bone number.
- const Math::Mat4 & transform - Transformation matrix in the world space.
void setBoneWorldTransform ( int bone, const Math::Mat4 & transform ) #
Sets the transformation for the given bone in the world coordinate space.Arguments
- int bone - Bone number.
- const Math::Mat4 & transform - Transformation matrix in the world space.
Math::Mat4 getBoneWorldTransform ( int bone ) const#
Returns the current transformation matrix applied to the bone in the world coordinate space (considering node transformations).Arguments
- int bone - Bone number.
Return value
Transformation matrix in the world space.int addLayer ( ) #
Appends a new animation layer to the current mesh.Return value
Number of the new added animation layer.void clearLayer ( int layer ) #
Clears the given animation layer.Arguments
- int layer - Animation layer number.
void copyLayer ( int dest, int src ) #
Copies source layer bones transformations to the destination layer. The copying conditions are the following:
- If the destination layer has more bones than the source one, it will keep its former transformations.
- If the source layer has more bones than destination one, those bones will be added to the destination layer.
Arguments
- int dest - Number of the destination layer in the range from 0 to the total number of animation layers.
To get the total number of animation layers, use the getNumLayers() method.
- int src - Number of the source layer in range from 0 to the total number of animation layers.
To get the total number of animation layers, use the getNumLayers() method.
int findBone ( const char * name ) const#
Searches for a bone with a given name.Arguments
- const char * name - Bone name.
Return value
Bone number if found; otherwise, -1.int findSurfaceTarget ( int surface, const char * name ) const#
Searches for a surface morph target with a given name.Arguments
- int surface - Mesh surface number.
- const char * name - Name of the morph target.
Return value
Number of the morph target, if exists; otherwise, -1.void importLayer ( int layer ) #
Copies the current bone state to the given animation layer.Arguments
- int layer - Animation layer number.
void inverseLayer ( int dest, int src ) #
Copies inverse transformations of bones from the source layer to the destination layer.Arguments
- int dest - Number of the destination layer in the range from 0 to the total number of animation layers.
To get the total number of animation layers, use the getNumLayers() method.
- int src - Number of the source layer in the range from 0 to the total number of animation layers.
To get the total number of animation layers, use the getNumLayers() method.
void lerpLayer ( int dest, int layer0, int layer1, float weight ) #
Copies interpolated bone transformations from two source layers to a destination layer.Arguments
- int dest - Number of the destination layer in the range from 0 to the total number of animation layers.
To get the total number of animation layers, use the getNumLayers() method.
- int layer0 - Number of the first source layer in the range from 0 to the total number of animation layers.
To get the total number of animation layers, use the getNumLayers() method.
- int layer1 - Number of the second source layer in range from 0 to the total number of animation layers.
To get the total number of animation layers, use the getNumLayers() method.
- float weight - Interpolation weight.
void mulLayer ( int dest, int layer0, int layer1, float weight = 1.0f ) #
Copies multiplied bone transformations from two source layers to the destination layer.Arguments
- int dest - Number of the destination layer in the range from 0 to the total number of animation layers.
To get the total number of animation layers, use the getNumLayers() method.
- int layer0 - Number of the first source layer in the range from 0 to the total number of animation layers.
To get the total number of animation layers, use the getNumLayers() method.
- int layer1 - Number of the second source layer in the range from 0 to the total number of animation layers.
To get the total number of animation layers, use the getNumLayers() method.
- float weight - Interpolation weight.
void play ( ) #
Continues playback of the animation, if it was paused, or starts playback if it was stopped.void removeLayer ( int layer ) #
Removes an animation layer.Arguments
- int layer - Layer number in the range from 0 to the total number of animation layers.
To get the total number of animation layers, use the getNumLayers() method.
void stop ( ) #
Stops animation playback. This function saves the playback position so that playing of the animation can be resumed from the same point.static int type ( ) #
Returns the type of the node.Return value
Node type identifier.void updateSkinned ( ) #
Forces update of all bone transformations.Math::mat4 getBoneNotAdditionalBindLocalTransform ( int bone ) const#
Returns the bone transformation relative to the parent bone without taking into account the bound node transformation.Arguments
- int bone - Number of the bone, in the range from 0 to the total number of bones.
Return value
Transformation matrix in the local space.Math::mat4 getBoneNotAdditionalBindObjectTransform ( int bone ) const#
Returns the bone transformation relative to the parent object without taking into account the bound node transformation.Arguments
- int bone - Number of the bone, in the range from 0 to the total number of bones.
Return value
Transformation matrix in the object space.Math::Mat4 getBoneNotAdditionalBindWorldTransform ( int bone ) const#
Returns the bone transformation relative to the world origin.Arguments
- int bone - Number of the bone, in the range from 0 to the total number of bones.
Return value
Transformation matrix in the world space without taking into account the bound node transformation.void setBindNode ( int bone, const Ptr<Node> & node ) #
Sets a new node whose transformation is to be used to control the transformation of the bone with the specified number.Arguments
- int bone - Number of the bone to be controlled by the specified node, in the range from 0 to the total number of bones.
- const Ptr<Node> & node - Node whose transformation is used to control the transformation of the bone.
void removeBindNodeByBone ( int bone ) #
Removes the assigned bind node from the bone with the specified number.Arguments
- int bone - Number of the bone, in the range from 0 to the total number of bones.
void removeBindNodeByNode ( const Ptr<Node> & node ) #
Removes the specified bind node.Arguments
void removeAllBindNode ( ) #
Removes all assigned bind nodes.Ptr<Node> getBindNode ( int bone ) const#
Returns the bind node currently assigned to the bone with the specified number.Arguments
- int bone - Number of the bone, in the range from 0 to the total number of bones.
Return value
Node whose transformation is used to control the transformation of the bone if it is assigned; otherwise - nullptr.void setBindNodeSpace ( int bone, ObjectMeshSkinned::NODE_SPACE space ) #
Sets a new value indicating which transformation of the bind node (World or Local) is to be used to override the transformation of the specified bone.Arguments
- int bone - Number of the bone, in the range from 0 to the total number of bones.
- ObjectMeshSkinned::NODE_SPACE space - Type of transformation of the bind node to be used to override the transformation of the specified bone, one of the NODE_SPACE* values.
ObjectMeshSkinned::NODE_SPACE getBindNodeSpace ( int bone ) const#
Returns the current value indicating which transformation of the bind node (World or Local) is to be used to override the transformation of the specified bone.Arguments
- int bone - Number of the bone, in the range from 0 to the total number of bones.
Return value
Type of transformation of the bind node to be used to override the transformation of the specified bone, one of the NODE_SPACE* values.void setBindBoneSpace ( int bone, ObjectMeshSkinned::BONE_SPACE space ) #
Sets a value indicating which transformation of the specified bone is to be overridden by the bind node's transformation.Arguments
- int bone - Number of the bone, in the range from 0 to the total number of bones.
- ObjectMeshSkinned::BONE_SPACE space - Type of transformation of the specified bone to be overridden by the bind node's transformation, one of the BONE_SPACE* values.
ObjectMeshSkinned::BONE_SPACE getBindBoneSpace ( int bone ) const#
Returns the current value indicating which transformation of the specified bone is to be overridden by the bind node's transformation.Arguments
- int bone - Number of the bone, in the range from 0 to the total number of bones.
Return value
Current type of transformation of the specified bone overridden by the bind node's transformation, one of the BONE_SPACE* values.void setBindMode ( int bone, ObjectMeshSkinned::BIND_MODE mode ) #
Sets a new type of blending of bind node's and bone's transformations.Arguments
- int bone - Number of the bone, in the range from 0 to the total number of bones.
- ObjectMeshSkinned::BIND_MODE mode - New type of blending of bind node's and bone's transformations:
- OVERRIDE - replace bone's transformation with the transformation of the node.
- ADDITIVE - node's transformation is added to the current transformation of the bone.
ObjectMeshSkinned::BIND_MODE getBindMode ( int bone ) const#
Returns the current type of blending of bind node's and bone's transformations.Arguments
- int bone - Number of the bone, in the range from 0 to the total number of bones.
Return value
Current type of blending of bind node's and bone's transformations:- OVERRIDE - replace bone's transformation with the transformation of the node.
- ADDITIVE - node's transformation is added to the current transformation of the bone.
void setBindNodeOffset ( int bone, const Math::Mat4 & offset ) #
Sets a new transformation matrix to be applied to the node's transformation before applying it to bone's transformation. This parameter serves for the purpose of additional correction of the node's transform for the bone's basis.Arguments
- int bone - Number of the bone, in the range from 0 to the total number of bones.
- const Math::Mat4 & offset - Transformation matrix applied to the node's transformation before applying it to bone's transformation.
Math::Mat4 getBindNodeOffset ( int bone ) const#
Returns the current transformation matrix which is applied to the node's transformation before applying it to bone's transformation. This parameter serves for the purpose of additional correction of the node's transform for the bone's basis.Arguments
- int bone - Number of the bone, in the range from 0 to the total number of bones.
Return value
Transformation matrix currently applied to the node's transformation before applying it to bone's transformation.void addVisualizeBone ( int bone ) #
Adds a bone with the specified number to the list of the bones for which the basis vectors are to be visualized.Arguments
- int bone - Number of the bone to be added to the visualizer, in the range from 0 to the total number of bones.
void removeVisualizeBone ( int bone ) #
Removes a bone with the specified number from the list of the bones for which the basis vectors are to be visualized.Arguments
- int bone - Number of the bone to be removed from the visualizer, in the range from 0 to the total number of bones.
void clearVisualizeBones ( ) #
Clears the list of the bones for which the basis vectors are to be visualized.void addVisualizeIKChain ( int chain_id ) #
Adds an IK chain with the specified ID to the list of chains for which the basis vectors are to be visualized.Arguments
- int chain_id - IK chain ID.
void removeVisualizeIKChain ( int chain_id ) #
Removes the IK chain with the specified ID from the list of chains for which the basis vectors are to be visualized.Arguments
- int chain_id - IK chain ID.
void clearVisualizeIKChain ( ) #
Clears the list of IK chains for which the basis vectors are to be visualized.int addIKChain ( ) #
Adds a new IK chain to the skinned mesh.Return value
ID of the added IK chain.void removeIKChain ( int chain_id ) #
Removes the IK chain with the specified ID.Arguments
- int chain_id - IK chain ID.
void setIKChainEnabled ( bool enabled, int chain_id ) #
Sets a value indicating if the IK chain with the specified ID is enabled.Arguments
- bool enabled - Set true to enable IK chain with the specified ID, or false - to disable it.
- int chain_id - IK chain ID.
bool isIKChainEnabled ( int chain_id ) const#
Returns a value indicating if the IK chain with the specified ID is enabled.Arguments
- int chain_id - IK chain ID.
Return value
true if the IK chain with the specified ID is enabled; otherwise, false.void setIKChainWeight ( float weight, int chain_id ) #
Sets a new weight for the IK chain with the specified ID. Weight value defines the impact of the target position on the last joint of the chain.Arguments
- float weight - New weight value to be set in the [0.0f, 1.0f] range. Higher values increase the impact.
- int chain_id - IK chain ID.
float getIKChainWeight ( int chain_id ) const#
Returns the current weight for the IK chain with the specified ID. Weight value defines the impact of the target position on the last joint of the chain.Arguments
- int chain_id - IK chain ID.
Return value
Current weight value in the [0.0f, 1.0f] range. Higher values increase the impact.int addIKChainBone ( int bone, int chain_id ) #
Adds a bone with the specified number to the IK chain with the specified ID.Arguments
- int bone - Bone number.
- int chain_id - IK chain ID.
Return value
Index of the last added bone in the chain.int getIKChainNumBones ( int chain_id ) const#
Returns the number of bones in the IK chain with the specified ID.Arguments
- int chain_id - IK chain ID.
Return value
Number of bones in the IK chain with the specified ID.void removeIKChainBone ( int bone_num, int chain_id ) #
Removes the bone with the specified number from the IK chain with the specified ID.Arguments
- int bone_num - Bone number.
- int chain_id - IK chain ID.
int getIKChainBone ( int bone_num, int chain_id ) const#
Returns the index of the bone with the specified number (within the chain) from the IK chain with the specified ID.Arguments
- int bone_num - Bone number.
- int chain_id - IK chain ID.
Return value
Number of the bone, in the range from 0 to the total number of bones.void setIKChainTargetPosition ( const Math::Vec3 & position, int chain_id ) #
Sets new local coordinates of the target position of the IK chain with the specified ID.Arguments
- const Math::Vec3 & position - New local coordinates of the target position to be set for the IK chain with the specified ID.
- int chain_id - IK chain ID.
Math::Vec3 getIKChainTargetPosition ( int chain_id ) const#
Returns the current local coordinates of the target position of the IK chain with the specified ID.Arguments
- int chain_id - IK chain ID.
Return value
Local coordinates of the target position of the IK chain with the specified ID.void setIKChainTargetWorldPosition ( const Math::Vec3 & position, int chain_id ) #
Sets new world coordinates of the target position of the IK chain with the specified ID.Arguments
- const Math::Vec3 & position - New world coordinates of the target position to be set for the IK chain with the specified ID.
- int chain_id - IK chain ID.
Math::Vec3 getIKChainTargetWorldPosition ( int chain_id ) const#
Returns the current world coordinates of the target position of the IK chain with the specified ID.Arguments
- int chain_id - IK chain ID.
Return value
World coordinates of the target position of the IK chain with the specified ID.void setIKChainPolePosition ( const Math::Vec3 & position, int chain_id ) #
Sets a new pole position (in local coordinates) for the IK chain with the specified ID.Arguments
- const Math::Vec3 & position - New pole position (in local coordinates) to be set for the IK chain.
- int chain_id - IK chain ID.
Math::Vec3 getIKChainPolePosition ( int chain_id ) const#
Returns the current pole position (in local coordinates) for the IK chain with the specified ID.Arguments
- int chain_id - IK chain ID.
Return value
Pole position (in local coordinates) for the IK chain.void setIKChainPoleWorldPosition ( const Math::Vec3 & position, int chain_id ) #
Sets a new pole position (in world coordinates) for the IK chain with the specified ID.Arguments
- const Math::Vec3 & position - New pole position (in world coordinates) to be set for the IK chain.
- int chain_id - IK chain ID.
Math::Vec3 getIKChainPoleWorldPosition ( int chain_id ) const#
Returns the current pole position (in world coordinates) for the IK chain with the specified ID.Arguments
- int chain_id - IK chain ID.
Return value
Pole position (in world coordinates) for the IK chain.void setIKChainUseEffectorRotation ( bool use, int chain_id ) #
Sets a value indicating if the effector rotation is to be used for the IK chain with the specified ID.Arguments
- bool use - true to use effector rotation for the IK chain with the specified ID; false - not to use.
- int chain_id - IK chain ID.
bool isIKChainUseEffectorRotation ( int chain_id ) const#
Returns a value indicating if the effector rotation is to be used for the IK chain with the specified ID.Arguments
- int chain_id - IK chain ID.
Return value
true if the effector rotation is to be used for the IK chain with the specified ID; otherwise, false.void setIKChainEffectorRotation ( const Math::quat & rotation, int chain_id ) #
Sets the rotation of the end-effector (in local coordinates) of the IK chain with the specified ID.Arguments
- const Math::quat & rotation - Quaternion that defines rotation (local coordinates) of the end-effector of the chain.
- int chain_id - IK chain ID.
Math::quat getIKChainEffectorRotation ( int chain_id ) const#
Returns the current rotation (in local coordinates) of the end-effector of the IK chain with the specified ID.Arguments
- int chain_id - IK chain ID.
Return value
Quaternion that defines rotation (local coordinates) of the end-effector of the chain.void setIKChainEffectorWorldRotation ( const Math::quat & rotation, int chain_id ) #
Sets the rotation of the end-effector (in world coordinates) of the IK chain with the specified ID.Arguments
- const Math::quat & rotation - Quaternion that defines rotation (world coordinates) of the end-effector of the chain.
- int chain_id - IK chain ID.
Math::quat getIKChainEffectorWorldRotation ( int chain_id ) const#
Returns the current rotation (in world coordinates) of the end-effector of the IK chain with the specified ID.Arguments
- int chain_id - IK chain ID.
Return value
Quaternion that defines rotation (world coordinates) of the end-effector of the chain.void setIKChainNumIterations ( int num, int chain_id ) #
Sets the number of iterations to be used for solving the IK chain with the specified ID (number of times the algorithm runs).Arguments
- int num - Number of iterations to be used for solving the IK chain with the specified ID.
- int chain_id - IK chain ID.
int getIKChainNumIterations ( int chain_id ) const#
Returns the number of iterations used for solving the IK chain with the specified ID (number of times the algorithm runs).Arguments
- int chain_id - IK chain ID.
Return value
Current number of iterations for the IK chain with the specified ID.void setIKChainTolerance ( float tolerance, int chain_id ) #
Sets a new tolerance value to be used for the IK chain with the specified ID. This value sets a threshold where the target is considered to have reached its destination position, and when the IK Solver stops iterating.Arguments
- float tolerance - Tolerance value to be set for the IK chain.
- int chain_id - IK chain ID.
float getIKChainTolerance ( int chain_id ) const#
Returns the current tolerance value to be used for the IK chain with the specified ID. This value sets a threshold where the target is considered to have reached its destination position, and when the IK Solver stops iterating.Arguments
- int chain_id - IK chain ID.
Return value
Current tolerance value for the IK chain.void copyBoneTransforms ( const Ptr<ObjectMeshSkinned> & src ) #
Copies all bone transformations from the specified source skinned mesh.Arguments
- const Ptr<ObjectMeshSkinned> & src - Source skinned mesh from which bone transforms are to be copied.
void setMeshProceduralMode ( bool mode ) #
Sets the procedural mesh usage mode for the object. With the procedural mode enabled, the mesh is created in runtime and passed to ObjectMeshSkinned.Arguments
- bool mode - true to enable the procedural mode for the mesh, false to disable it.
bool applyMeshProcedural ( const Ptr<Mesh> & mesh ) #
Copies all information from the specified mesh into the procedural mesh inside the object.Arguments
Return value
true if the information from the mesh is successfully copied into the procedural mesh, otherwise false.void setSurfaceTargetEnabled ( int surface, int target, bool enabled ) #
Toggles the use of the morph target for the specified surface.Arguments
- int surface - Number of the surface, to which the morph target is to be appended.
- int target - Number of the morph target to be used.
- bool enabled - true to enable the use of the morph target for the surface, false to disable it.
int isSurfaceTargetEnabled ( int surface, int target ) const#
Returns the value indicating if the use of the morph target for the specified surface is enabled.Arguments
- int surface - Number of the surface, to which the morph target is appended.
- int target - Number of the morph target.
Return value
trueif the use of the morph target for the surface is enabled, otherwise false.void setSurfaceTargetWeight ( int surface, int target, float weight ) #
Sets the weight of the morph target, i.e. the intensity of it affecting the surface vertices.Arguments
- int surface - Number of the surface, to which the morph target is appended.
- int target - Number of the morph target.
- float weight - Weight of the morph target.
float getSurfaceTargetWeight ( int surface, int target ) const#
Returns the weight of the morph target, i.e. the intensity of it affecting the surface vertices.Arguments
- int surface - Number of the surface, to which the morph target is appended.
- int target - Number of the morph target.
Return value
Weight of the morph target.void setLayerBoneTransformEnabled ( int layer, int bone, bool enabled ) #
Enables or disables a layer transformation for the given bone.Arguments
- int layer - Animation layer number.
- int bone - Bone number.
- bool enabled - Enabled flag: true to enable layer transformation, false to disable it.
void setLayerBoneTransform ( int layer, int bone, const Math::mat4 & transform ) #
Sets a transformation matrix for the given bone. The difference from the setBoneTransform() function is that this method takes into account only the transformation in the specified animation layer (no blending is performed).Arguments
- int layer - Animation layer number.
- int bone - Bone number.
- const Math::mat4 & transform - Bone transformation matrix.
Math::mat4 getLayerBoneTransform ( int layer, int bone ) const#
Returns a transformation matrix of the given bone relatively to the parent object.Arguments
- int layer - Animation layer number.
- int bone - Bone number.
Return value
Bone transformation matrix.bool isLayerBoneTransform ( int layer, int bone ) const#
Returns a value indicating if the bone transformation is applied only to the animation layer (no blending is performed).Arguments
- int layer - Animation layer number.
- int bone - Bone number.
Return value
true if the bone transformation is applied only to the animation layer; otherwise, false.void setLayerBonePosition ( int layer, int bone, const Math::vec3 & position ) #
Sets the position for the given bone.Arguments
- int layer - Animation layer number.
- int bone - Bone number.
- const Math::vec3 & position - Bone position.
Math::vec3 getLayerBonePosition ( int layer, int bone ) const#
Returns the position for the given bone.Arguments
- int layer - Animation layer number.
- int bone - Bone number.
Return value
Bone position.void setLayerBoneRotation ( int layer, int bone, const Math::quat & rotation ) #
Sets the rotation for the given bone.Arguments
- int layer - Animation layer number.
- int bone - Bone number.
- const Math::quat & rotation - Bone rotation.
Math::quat getLayerBoneRotation ( int layer, int bone ) const#
Returns the rotation for the given bone.Arguments
- int layer - Animation layer number.
- int bone - Bone number.
Return value
Bone rotation.void setLayerBoneScale ( int layer, int bone, const Math::vec3 & scale ) #
Sets the scale for the given bone.Arguments
- int layer - Animation layer number.
- int bone - Bone number.
- const Math::vec3 & scale - Bone scale.
Math::vec3 getLayerBoneScale ( int layer, int bone ) const#
Returns the scale for the given bone.Arguments
- int layer - Animation layer number.
- int bone - Bone number.
Return value
Bone scale.void setLayerFrameUsesEnabled ( int layer, bool enabled ) #
Toggles the use of animation masks for bones in the specified layer.Arguments
- int layer - Animation layer number.
- bool enabled - true to enable the use of animation masks for bones in the specified layer, false to disable it.
bool isLayerFrameUsesEnabled ( int layer ) const#
Returns the value indicating if the use of animation masks for bones in the specified layer is enabled.Arguments
- int layer - Animation layer number.
Return value
true if the use of animation masks for bones in the specified layer is enabled, otherwise false.void setLayerBoneFrameUses ( int layer, int bone, ObjectMeshSkinned::ANIM_FRAME_USES uses ) #
Sets the value indicating which components of the frame are to be used to animate the specified bone of the given animation layer.Arguments
- int layer - Animation layer number.
- int bone - Number of the bone, in the range from 0 to the total number of bones.
- ObjectMeshSkinned::ANIM_FRAME_USES uses - Value indicating frame components to be used.
ObjectMeshSkinned::ANIM_FRAME_USES getLayerBoneFrameUses ( int layer, int bone ) const#
Returns the value indicating which components of the frame are to be used to animate the specified bone of the given animation layer.Arguments
- int layer - Animation layer number.
- int bone - Number of the bone, in the range from 0 to the total number of bones.
Return value
Value indicating frame components to be used.int getLayerNumFrames ( int layer ) const#
Returns the number of animation frames for a given layer.Arguments
- int layer - Animation layer number.
Return value
Number of animation frames.float setLayerFrame ( int layer, float frame, int from = -1, int to = -1 ) #
Sets a frame for the given animation layer.Arguments
- int layer - Animation layer number.
- float frame - Frame number in the "from-to" interval. If the float argument is passed, animation is interpolated between nearby frames. 0 means the from frame. For larger values, a residue of a modulo (from-to) is calculated. If a negative value is provided, interpolation will be done from the current frame to the from frame.
- int from - Start frame. -1 means the first frame of the animation.
- int to - End frame. -1 means the last frame of the animation.
Return value
The number of the frame.float getLayerFrame ( int layer ) const#
Returns the frame number passed as the time argument on the last setLayerFrame() call.Arguments
- int layer - Animation layer number.
Return value
Frame number.int getLayerFrameFrom ( int layer ) const#
Returns the start frame passed as the from argument on the last setLayerFrame() call.Arguments
- int layer - Animation layer number.
Return value
Start frame.int getLayerFrameTo ( int layer ) const#
Returns the end frame passed as the to argument on the last setLayerFrame() call.Arguments
- int layer - Animation layer number.
Return value
End frame.void setRetargeting ( const Ptr<BonesRetargeting> & bones_retargeting, const char * anim_path, const char * mesh_path ) #
Applies the animation of a source mesh to the bones of the target mesh using bones retargeting.Arguments
- const Ptr<BonesRetargeting> & bones_retargeting - Instance of the BonesRetargeting class that describes how animation of source mesh bones is retargeted in order to be applied to the bones of the target mesh.
- const char * anim_path - Path to the animation file. The path can be represented by either a path to the file or its GUID, which is the recommended approach. After loading the animation, its internal representation is identified by the path when using setLayerAnimationFilePath , etc. When you import your model with animations from an FBX container, the following path to your *.anim files should be used: <path_to_your_fbx_file>/<file.fbx>/<your_anim_file.anim>
For example: object->setLayerAnimationFilePath(0,"models/soldier/soldier.fbx/run.anim");
- const char * mesh_path - Path to the target mesh file, to which animation is to be applied.
void removeRetargeting ( const char * anim_path, const char * mesh_path ) #
Disables the application of the retargeted animation to the bones of the target mesh.Arguments
- const char * anim_path - Path to the animation file. The path can be represented by either a path to the file or its GUID, which is the recommended approach. After loading the animation, its internal representation is identified by the path when using setLayerAnimationFilePath , etc. When you import your model with animations from an FBX container, the following path to your *.anim files should be used: <path_to_your_fbx_file>/<file.fbx>/<your_anim_file.anim>
For example: object->setLayerAnimationFilePath(0,"models/soldier/soldier.fbx/run.anim");
- const char * mesh_path - Path to the target mesh file, to which animation is applied.
Ptr<BonesRetargeting> getRetargeting ( const char * anim_path, const char * mesh_path ) #
Returns the bones retargeting of the specified animation applied to the specified mesh.Arguments
- const char * anim_path - Path to the animation file. The path can be represented by either a path to the file or its GUID, which is the recommended approach. After loading the animation, its internal representation is identified by the path when using setLayerAnimationFilePath , etc. When you import your model with animations from an FBX container, the following path to your *.anim files should be used: <path_to_your_fbx_file>/<file.fbx>/<your_anim_file.anim>
For example: object->setLayerAnimationFilePath(0,"models/soldier/soldier.fbx/run.anim");
- const char * mesh_path - Path to the target mesh file, to which animation is applied.
Return value
Instance of the BonesRetargeting class that describes how animation of source mesh bones is retargeted in order to be applied to the bones of the target mesh if it is applied, otherwise nullptr.bool isRetargeting ( const char * anim_path, const char * mesh_path ) #
Returns the value indicating if there is bones retargeting between the specified animation and the target mesh.Arguments
- const char * anim_path - Path to the animation file. The path can be represented by either a path to the file or its GUID, which is the recommended approach. After loading the animation, its internal representation is identified by the path when using setLayerAnimationFilePath , etc. When you import your model with animations from an FBX container, the following path to your *.anim files should be used: <path_to_your_fbx_file>/<file.fbx>/<your_anim_file.anim>
For example: object->setLayerAnimationFilePath(0,"models/soldier/soldier.fbx/run.anim");
- const char * mesh_path - Path to the target mesh file, to which animation is applied.
Return value
true if there is bones retargeting between the specified animation and the target mesh, otherwise false.long long getAnimationResourceID ( const char * path ) const#
Returns the unique animation ID using the path to it. This method also loads the animation if it hasn't been loaded yet.Arguments
- const char * path - Path to the animation file. The path can be represented by either a path to the file or its GUID, which is the recommended approach. After loading the animation, its internal representation is identified by the path when using setLayerAnimationFilePath , etc. When you import your model with animations from an FBX container, the following path to your *.anim files should be used: <path_to_your_fbx_file>/<file.fbx>/<your_anim_file.anim>
For example: object->setLayerAnimationFilePath(0,"models/soldier/soldier.fbx/run.anim");
Return value
The unique animation ID.void setLayerAnimationFilePath ( int layer, const char * path ) #
Sets the path to animation for the given animation layer.Arguments
- int layer - Layer number.
- const char * path - Path to the animation file.
When you import your model with animations from an FBX container, the following path to your *.anim files should be used: <path_to_your_fbx_file>/<file.fbx>/<your_anim_file.anim>
For example: object->setLayerAnimationFilePath(0,"models/soldier/soldier.fbx/run.anim");
String getLayerAnimationFilePath ( int layer ) const#
Returns the path to animation for the given animation layer.Arguments
- int layer - Layer number.
Return value
Path to the animation file.void setLayerAnimationResourceID ( int layer, long long resource_id ) const#
Sets the animation for the layer using the unique animation ID.Arguments
- int layer - Layer number.
- long long resource_id - The unique animation ID.
long long getLayerAnimationResourceID ( int layer ) const#
Returns the unique ID of the animation used for the layer.Arguments
- int layer - Layer number.
Return value
The unique animation ID.Math::mat4 getBoneBindLocalTransform ( int bone ) const#
Returns the bone transformation matrix of the bind pose relatively to the parent bone.Arguments
- int bone - Bone number.
Return value
Bind pose transformation matrix.Math::mat4 getBoneBindLocalITransform ( int bone ) const#
Returns the inverse bone transformation matrix of the bind pose relatively to the parent bone.Arguments
- int bone - Bone number.
Return value
Inverse bind pose transformation matrix.Math::mat4 getBoneBindObjectTransform ( int bone ) const#
Returns the bone transformation matrix of the bind pose in the object space.Arguments
- int bone - Bone number.
Return value
Bind pose transformation matrix.Math::mat4 getBoneBindObjectITransform ( int bone ) const#
Returns the inverse bone transformation matrix of the bind pose in the object space.Arguments
- int bone - Bone number.
Return value
Inverse bind pose transformation matrix.Math::mat4 getBoneSkiningTransform ( int bone ) const#
Returns the bone matrix based on which the bone affects the connected vertices, the result of the following multiplication: getBoneTransform(bone) * getBoneBindObjectITransform(bone).Arguments
- int bone - Bone number.
Return value
Bone transformation matrix.void addVisualizeLookAtChain ( int chain_id ) #
Adds the specified LookAtChain to visualization.Arguments
- int chain_id - LookAtChain ID.
void removeVisualizeLookAtChain ( int chain_id ) #
Removes the specified LookAtChain from visualization.Arguments
- int chain_id - LookAtChain ID.
void clearVisualizeLookAtChain ( ) #
Removes all LookAtChains from visualization.void addVisualizeConstraint ( int constraint_index ) #
Adds the specified bone constraint to visualization.Arguments
- int constraint_index - Bone constraint index.
void removeVisualizeConstraint ( int constraint_index ) #
Removes the specified bone constraint from visualization.Arguments
- int constraint_index - Bone constraint index.
void clearVisualizeConstraint ( ) #
Removes all bone constraints from visualization.int addLookAtChain ( ) #
Adds a new LookAtChain and returns its ID.Return value
LookAtChain ID.void removeLookAtChain ( int chain_id ) #
Deletes the specified LookAtChain by its ID.Arguments
- int chain_id - LookAtChain ID.
int getNumLookAtChains ( ) const#
Returns the total number of LookAtChains.Return value
Total number of LookAtChains.int getLookAtChainID ( int num ) const#
Returns the ID of LookAtChain by its index.Arguments
- int num - Index of LookAtChain.
Return value
LookAtChain ID.void setLookAtChainEnabled ( bool enabled, int chain_id ) #
Toggles the use of LookAtChain.Arguments
- bool enabled - true to enable LookAtChain, false to disable it.
- int chain_id - LookAtChain ID.
bool isLookAtChainEnabled ( int chain_id ) const#
Checks if LookAtChain is enabled.Arguments
- int chain_id - LookAtChain ID.
Return value
true if LookAtChain is enabled, otherwise false.void setLookAtChainConstraint ( ObjectMeshSkinned::CHAIN_CONSTRAINT constraint, int chain_id ) #
Configures the type of bone constraint for the solver of the specified chain.Arguments
- ObjectMeshSkinned::CHAIN_CONSTRAINT constraint - The type of bone constraint for the solver.
- int chain_id - LookAtChain ID.
ObjectMeshSkinned::CHAIN_CONSTRAINT getLookAtChainConstraint ( int chain_id ) const#
Returns the type of bone constraint for the solver of the specified chain.Arguments
- int chain_id - LookAtChain ID.
Return value
The type of bone constraint for the solver.void setLookAtChainWeight ( float weight, int chain_id ) #
Sets the weight of LookAtChain, which affects the extent of the bone rotation to the target.Arguments
- float weight - Weight of the chain.
- int chain_id - LookAtChain ID.
float getLookAtChainWeight ( int chain_id ) const#
Returns the weight of LookAtChain, which affects the extent of the bone rotation to the target.Arguments
- int chain_id - LookAtChain ID.
Return value
Weight of the chain.int addLookAtChainBone ( int bone, int chain_id ) #
Adds the bone to LookAtChain and returns its index.Arguments
- int bone - The bone to be added to the chain.
- int chain_id - LookAtChain ID.
Return value
Bone index.int addLookAtChainBone ( const char * bone_name, int chain_id ) #
Adds the bone to LookAtChain and returns its index.Arguments
- const char * bone_name - The name of the bone to be added to the chain.
- int chain_id - LookAtChain ID.
Return value
Bone index.int getLookAtChainNumBones ( int chain_id ) const#
Returns the total number of bones in LookAtChain.Arguments
- int chain_id - LookAtChain ID.
Return value
The total number of bones in LookAtChain.void removeLookAtChainBone ( int bone_num, int chain_id ) #
Removes the bone from LookAtChain by its index.Arguments
- int bone_num - The index of the bone to be removed from the chain.
- int chain_id - LookAtChain ID.
int getLookAtChainBone ( int bone_num, int chain_id ) const#
Returns the bone from LookAtChain by its index.Arguments
- int bone_num - The index of the bone in the chain.
- int chain_id - LookAtChain ID.
void setLookAtChainBoneWeight ( float weight, int bone_num, int chain_id ) #
Set the additional local weight of the bone.Arguments
- float weight - The weight of the bone in the chain.
- int bone_num - The index of the bone in the chain.
- int chain_id - LookAtChain ID.
float getLookAtChainBoneWeight ( int bone_num, int chain_id ) const#
Returns the additional local weight of the bone.Arguments
- int bone_num - The index of the bone in the chain.
- int chain_id - LookAtChain ID.
Return value
The weight of the bone in the chain.void setLookAtChainBoneUp ( const Math::Vec3 & up, int bone_num, int chain_id ) #
Sets the UP axis for the bone.Arguments
- const Math::Vec3 & up - The UP vector for the bone.
- int bone_num - The index of the bone in the chain.
- int chain_id - LookAtChain ID.
Math::Vec3 getLookAtChainBoneUp ( int bone_num, int chain_id ) const#
Returns the UP axis for the bone.Arguments
- int bone_num - The index of the bone in the chain.
- int chain_id - LookAtChain ID.
Return value
The UP vector for the bone.void setLookAtChainBoneAxis ( const Math::Vec3 & axis, int bone_num, int chain_id ) #
Sets the axis that is directed at the target of LookAtChain.Arguments
- const Math::Vec3 & axis - The axis that is directed at the target.
- int bone_num - The index of the bone in the chain.
- int chain_id - LookAtChain ID.
Math::Vec3 getLookAtChainBoneAxis ( int bone_num, int chain_id ) const#
Returns the axis that is directed at the target of LookAtChain.Arguments
- int bone_num - The index of the bone in the chain.
- int chain_id - LookAtChain ID.
Return value
The axis that is directed at the target.void setLookAtChainTargetPosition ( const Math::Vec3 & position, int chain_id ) #
Sets the position for the rotation in the object space.Arguments
- const Math::Vec3 & position - The position for the rotation in the object space.
- int chain_id - LookAtChain ID.
Math::Vec3 getLookAtChainTargetPosition ( int chain_id ) const#
Returns the position for the rotation in the object space.Arguments
- int chain_id - LookAtChain ID.
Return value
The position for the rotation in the object space.void setLookAtChainTargetWorldPosition ( const Math::Vec3 & position, int chain_id ) #
Sets the position for the rotation in the world space.Arguments
- const Math::Vec3 & position - The position for the rotation in the world space.
- int chain_id - LookAtChain ID.
Math::Vec3 getLookAtChainTargetWorldPosition ( int chain_id ) const#
Returns the position for the rotation in the world space.Arguments
- int chain_id - LookAtChain ID.
Return value
The position for the rotation in the world space.void setLookAtChainPolePosition ( const Math::Vec3 & position, int chain_id ) #
Sets the position of the pole vector in the object space.Arguments
- const Math::Vec3 & position - The position of the pole vector in the object space.
- int chain_id - LookAtChain ID.
Math::Vec3 getLookAtChainPolePosition ( int chain_id ) const#
Returns the position of the pole vector in the object space.Arguments
- int chain_id - LookAtChain ID.
Return value
The position of the pole vector in the object space.void setLookAtChainPoleWorldPosition ( const Math::Vec3 & position, int chain_id ) #
Sets the position of the pole vector in the world space.Arguments
- const Math::Vec3 & position - The position of the pole vector in the world space.
- int chain_id - LookAtChain ID.
Math::Vec3 getLookAtChainPoleWorldPosition ( int chain_id ) const#
Returns the position of the pole vector in the world space.Arguments
- int chain_id - LookAtChain ID.