API Migration
Major Changes
ObjectMeshSkinned Class: New Workflow for Animations#
UNIGINE 2.7.3 | UNIGINE 2.8 |
---|---|
getAnimationName() | Deprecated. Use getAnimationPath() instead. |
addAnimation() | Set of arguments changed. |
Although this mode is not recommended because of name collisions vulnerability, in this mode the ObjectMeshSkinned class will provide functionality of the previous version.
Identifying animation clips assigned to a skinned mesh by names is considered unsafe in terms of name collisions — animation clips aren't always named appropriately, they may conflict and replace each other because of name intersections.
New skinned animation system stores paths to animation asset files to identify internal representation of animation clips explicitly. You can access assets either by path or by GUID (virtual path), the given path to the asset will be used as a unique identifier of the animation clip for controlling skinned animation via the addAnimation(), setAnimation() and findAnimation() functions.
The number of animation clips that can be loaded from an .anim and .mesh asset is now limited to 1.
For example: object->addAnimation("models/soldier/soldier.fbx/run.anim");
However, the recommended workflow is to use GUIDs of the animation assets:
UGUID guid = FileSystem::get()->getGUID(anim_asset.getRaw());
int animation_1 = skinned_mesh->addAnimation(mesh,guid.getFileSystemString(), "run");
Below you'll find a complete example of using the Custom 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:
SkinnedMeshController.h
#pragma once #include "ComponentSystem\ComponentSystem.h" #include <UnigineObjects.h> #include <UnigineStreams.h> #include <UnigineLog.h> #include <UnigineFileSystem.h> #include <UnigineEditor.h> #include <UnigineGame.h> using namespace Unigine; class SkinnedMeshController : public 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 ObjectMeshSkinnedPtr skinned_mesh; };
SkinnedMeshController.cpp
#include "SkinnedMeshController.h" // register the component REGISTER_COMPONENT(SkinnedMeshController); int SkinnedMeshController::init() { // get the guid of the mesh asset const char *mesh_path = FileSystem::get()->getGUID(mesh_asset.getRaw()).getFileSystemString(); // create the new ObjectMeshSkinned mesh based on an existing mesh skinned_mesh = ObjectMeshSkinned::create(mesh_path); skinned_mesh->setMaterial("mesh_base", "*"); Editor::get()->addNode(skinned_mesh->getNode()); skinned_mesh->release(); // set the number of animation layers skinned_mesh->setNumLayers(2); // get the guids of the animation assets const char *path_1 = FileSystem::get()->getGUID(anim_asset_1.getRaw()).getFileSystemString(); const char *path_2 = FileSystem::get()->getGUID(anim_asset_2.getRaw()).getFileSystemString(); // load animations from the files int animation_1 = skinned_mesh->addAnimation(path_1); int animation_2 = skinned_mesh->addAnimation(path_2); // enable each layer and set an animation weight skinned_mesh->setLayer(0, 1, 0.7); skinned_mesh->setLayer(1, 1, 0.3); // set animations to layers skinned_mesh->setAnimation(0, animation_1); skinned_mesh->setAnimation(1, animation_2); return 1; } int SkinnedMeshController::update() { // play each animation skinned_mesh->setFrame(0, Game::get()->getTime() * 25.0f); skinned_mesh->setFrame(1, Game::get()->getTime() * 25.0f); return 1; } int SkinnedMeshController::shutdown() { return 1; }
When loading animation from a Mesh instance by using the addAnimation(const Ptr<Mesh> & mesh, const char * path, const char * name) function, you should provide a virtual path to the clip. As the mesh isn't associated with an asset and, therefore, doesn't have path data, the path must be represented by an arbitrary unique string. You can generate a new GUID and use it as the virtual path for the animation.
UGUID guid;
guid.generate();
int animation_1 = skinned_mesh->addAnimation(mesh,guid.getFileSystemString(), "run");
Camera Class#
UNIGINE 2.7.3 | UNIGINE 2.8 |
---|---|
setReflectionMask() | Renamed to setReflectionViewportMask(). |
getReflectionMask() | Renamed to getReflectionViewportMask(). |
Editor Class#
UNIGINE 2.7.3 | UNIGINE 2.8 |
---|---|
isLegacyMode() | Removed. |
load() | Set of arguments changed. |
EditorLogic Class#
Light Class#
UNIGINE 2.7.3 | UNIGINE 2.8 |
---|---|
setDepthTexture() | Removed. Use setDynamicDepthTexture() instead. |
getDepthTexture() | Removed. Use getDynamicDepthTexture() instead. |
setLightMask() | Renamed to setShadowMask(). |
getLightMask() | Renamed to getShadowMask(). |
MODE_BAKED | Removed. |
MODE_REALTIME | Renamed to MODE_DYNAMIC. |
MODE_MIXED | Renamed to MODE_STATIC. |
New Functions
- SHADOW_MODE_MIXED
- SHADOW_MODE_STATIC
- setMode()
- getMode()
- setShadowMode()
- getShadowMode()
- getBakedDepthTexture()
- setBakedDepthTexturePath()
- getBakedDepthTexturePath()
- setDynamicDepthTexture()
- getDynamicDepthTexture()
- setShadowScreenSpaceNoiseTranslucent()
- getShadowScreenSpaceNoiseTranslucent()
- setShadowScreenSpaceViewBias()
- getShadowScreenSpaceViewBias()
LightEnvironmentProbe Class#
UNIGINE 2.7.3 | UNIGINE 2.8 |
---|---|
setReflectionMask() | Renamed to setReflectionViewportMask(). |
getReflectionMask() | Renamed to getReflectionViewportMask(). |
New Functions
LightOmni Class#
UNIGINE 2.7.3 | UNIGINE 2.8 |
---|---|
setShadowMask() | Renamed to setShadowSideEnabled(). |
getShadowMask() | Renamed to isShadowSideEnabled(). |
New Functions
LightProj Class#
LightWorld Class#
Material Class#
UNIGINE 2.7.3 | UNIGINE 2.8 |
---|---|
setLightMask() | Renamed to setShadowMask(). |
getLightMask() | Renamed to getShadowMask(). |
Object Class#
UNIGINE 2.7.3 | UNIGINE 2.8 |
---|---|
setLightMask() | Renamed to setShadowMask(). |
getLightMask() | Renamed to getShadowMask(). |
New Functions
Player Class#
UNIGINE 2.7.3 | UNIGINE 2.8 |
---|---|
setReflectionMask() | Renamed to setReflectionViewportMask(). |
getReflectionMask() | Renamed to getReflectionViewportMask(). |
Profiler Class#
UNIGINE 2.7.3 | UNIGINE 2.8 |
---|---|
beginMicro() | Set of arguments changed. |
Property Class#
UNIGINE 2.7.3 | UNIGINE 2.8 |
---|---|
getNumParameters() | Removed. Use getParameterPtr instead. |
getParameterName() | Removed. Use getParameterPtr instead. |
getParameterType() | Removed. Use getParameterPtr instead. |
isParameterHidden() | Removed. Use getParameterPtr instead. |
isParameterInherited() | Removed. Use getParameterPtr instead. |
isParameterOverridden() | Removed. Use getParameterPtr instead. |
findParameter() | Removed. Use getParameterPtr instead. |
fetchParameter() | Removed. Use getParameterPtr instead. |
resetParameter() | Removed. Use getParameterPtr instead. |
getParameterTitle() | Removed. Use getParameterPtr instead. |
getParameterTooltip() | Removed. Use getParameterPtr instead. |
getParameterGroup() | Removed. Use getParameterPtr instead. |
getParameterFilter() | Removed. Use getParameterPtr instead. |
setParameter() | Removed. Use getParameterPtr instead. |
getParameter() | Removed. Use getParameterPtr instead. |
setParameterInt() | Removed. Use getParameterPtr instead. |
getParameterInt() | Removed. Use getParameterPtr instead. |
getParameterIntMinValue() | Removed. Use getParameterPtr instead. |
getParameterIntMaxValue() | Removed. Use getParameterPtr instead. |
setParameterFloat() | Removed. Use getParameterPtr instead. |
getParameterFloat() | Removed. Use getParameterPtr instead. |
getParameterFloatMinValue() | Removed. Use getParameterPtr instead. |
getParameterFloatMaxValue() | Removed. Use getParameterPtr instead. |
setParameterDouble() | Removed. Use getParameterPtr instead. |
getParameterDouble() | Removed. Use getParameterPtr instead. |
getParameterDoubleMinValue() | Removed. Use getParameterPtr instead. |
getParameterDoubleMaxValue() | Removed. Use getParameterPtr instead. |
hasParameterSliderMinValue() | Removed. Use getParameterPtr instead. |
hasParameterSliderMaxValue() | Removed. Use getParameterPtr instead. |
getParameterSliderLog10() | Removed. Use getParameterPtr instead. |
getParameterSliderMinExpand() | Removed. Use getParameterPtr instead. |
getParameterSliderMaxExpand() | Removed. Use getParameterPtr instead. |
setParameterToggle() | Removed. Use getParameterPtr instead. |
getParameterToggle() | Removed. Use getParameterPtr instead. |
setParameterSwitch() | Removed. Use getParameterPtr instead. |
getParameterSwitch() | Removed. Use getParameterPtr instead. |
getParameterSwitchNumItems() | Removed. Use getParameterPtr instead. |
getParameterSwitchItem() | Removed. Use getParameterPtr instead. |
setParameterString() | Removed. Use getParameterPtr instead. |
getParameterString() | Removed. Use getParameterPtr instead. |
setParameterColor() | Removed. Use getParameterPtr instead. |
getParameterColor() | Removed. Use getParameterPtr instead. |
setParameterVec3() | Removed. Use getParameterPtr instead. |
getParameterVec3() | Removed. Use getParameterPtr instead. |
setParameterVec4() | Removed. Use getParameterPtr instead. |
getParameterVec4() | Removed. Use getParameterPtr instead. |
setParameterMask() | Removed. Use getParameterPtr instead. |
getParameterMask() | Removed. Use getParameterPtr instead. |
setParameterFile() | Removed. Use getParameterPtr instead. |
getParameterFile() | Removed. Use getParameterPtr instead. |
getParameterFileIsAsset() | Removed. Use getParameterPtr instead. |
getParameterFileIsRuntime() | Removed. Use getParameterPtr instead. |
getParameterFileIsAbsPath() | Removed. Use getParameterPtr instead. |
isParameterFileExist() | Removed. Use getParameterPtr instead. |
setParameterProperty() | Removed. Use getParameterPtr instead. |
getParameterProperty() | Removed. Use getParameterPtr instead. |
setParameterMaterial() | Removed. Use getParameterPtr instead. |
getParameterMaterial() | Removed. Use getParameterPtr instead. |
setParameterGUID() | Removed. Use getParameterPtr instead. |
getParameterGUID() | Removed. Use getParameterPtr instead. |
setParameterNode() | Removed. Use getParameterPtr instead. |
getParameterNode() | Removed. Use getParameterPtr instead. |
setParameterNodeID() | Removed. Use getParameterPtr instead. |
getParameterNodeID() | Removed. Use getParameterPtr instead. |
New Functions
- PARAMETER_MASK_GENERAL
- PARAMETER_MASK_INTERSECTION
- PARAMETER_MASK_COLLISION
- PARAMETER_MASK_EXCLUSION
- PARAMETER_MASK_VIEWPORT
- PARAMETER_MASK_LIGHT
- PARAMETER_MASK_SHADOWS
- PARAMETER_MASK_REFLECTION
- PARAMETER_MASK_MATERIAL
- PARAMETER_MASK_SOUND_SOURCE
- PARAMETER_MASK_SOUND_REVERB
- PARAMETER_MASK_SOUND_OCCLUSION
- PARAMETER_MASK_NAVIGATION
- PARAMETER_MASK_OBSTACLE
- PARAMETER_MASK_PHYSICAL
- PARAMETER_MASK_FIELD
PropertyParameter Class#
Render Class#
UNIGINE 2.7.3 | UNIGINE 2.8 |
---|---|
setLightsUpscaling() | Removed. |
getLightsUpscaling() | Removed. |
setShadowsOmniJitter() | Removed. |
isShadowsOmniJitter() | Removed. |
setShadowsPrecision() | Removed. |
isShadowsPrecision() | Removed. |
New Functions
- setLatency()
- getLatency()
- loadCacheTextures()
- createCacheTextures()
- unloadCacheTextures()
- destroyCacheTextures()
- createCacheTexture()
- destroyCacheTexture()
- setTAADiagonalNeighbors()
- isTAADiagonalNeighbors()
- setFPSStabilization()
- isFPSStabilization()
- setFPSStabilizationOffset()
- getFPSStabilizationOffset()
- setFPSStabilizationRounding()
- getFPSStabilizationRounding()
- setFPSStabilizationMin()
- getFPSStabilizationMin()
- setFPSStabilizationSpeedDown()
- getFPSStabilizationSpeedDown()
- getFPSStabilizationSpeedDown()
- setFPSStabilizationSpeedUP()
- getFPSStabilizationSpeedUP()
- setLightsInterleaved()
- isLightsInterleaved()
- setLightsInterleavedCatmullResampling()
- isLightsInterleavedCatmullResampling()
- setLightsInterleavedColorClamping()
- getLightsInterleavedColorClamping()
- setLightsInterleavedFixGhosting()
- isLightsInterleavedFixGhosting()
- setShadersPreload()
- isShadersPreload()
- setStereoHiddenAreaExposureTransform()
- getStereoHiddenAreaExposureTransform()
- setShadowDistanceScale()
- getShadowDistanceScale()
- setShadowsSoftNoise()
- getShadowsSoftNoise()
- setShadowsTranslucentDepth()
- getShadowsTranslucentDepth()
- setStreamingMode()
- getStreamingMode()
- setStreamingUseMemoryLimit()
- isStreamingUseMemoryLimit()
- setStreamingMeshesMemoryLimit()
- getStreamingMeshesMemoryLimit()
- setStreamingTexturesMemoryLimit()
- getStreamingTexturesMemoryLimit()
- setStreamingTexturesCachePreload()
- isStreamingTexturesCachePreload()
- setStreamingTexturesCacheResolution()
- getStreamingTexturesCacheResolution()
- setStreamingCheckDuration()
- getStreamingCheckDuration()
- setStreamingDestroyDuration()
- getStreamingDestroyDuration()
- setStreamingMaxThreads()
- getStreamingMaxThreads()
- setTranslucentColor()
- getTranslucentColor()
- STREAMING_ASYNC
- STREAMING_FORCE
Renderer Class#
UNIGINE 2.7.3 | UNIGINE 2.8 |
---|---|
getReflectionMask() | Renamed to getReflectionViewportMask(). |
UGUID Class#
WidgetSpriteNode Class#
UNIGINE 2.7.3 | UNIGINE 2.8 |
---|---|
setReflectionMask() | Renamed to setReflectionViewportMask(). |
getReflectionMask() | Renamed to getReflectionViewportMask(). |
WidgetSpriteViewport Class#
UNIGINE 2.7.3 | UNIGINE 2.8 |
---|---|
setReflectionMask() | Renamed to setReflectionViewportMask(). |
getReflectionMask() | Renamed to getReflectionViewportMask(). |
Xml Class#
UNIGINE 2.7.3 | UNIGINE 2.8 |
---|---|
getFormattedSubTree() | Set of arguments changed. |
save() | Set of arguments changed. |