This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
编程
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
应用程序接口
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
CIGI Client Plugin
Rendering-Related Classes
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

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.
Notice
The workflow for skinned animations has changed, however the legacy mode for skinned meshes is supported (enable it via skinned_legacy_mode 1) to ensure compatibility with projects of older versions.
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.

Notice
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->addAnimation("models/soldier/soldier.fbx/run.anim");

However, the recommended workflow is to use GUIDs of the animation assets:

Source code (C++)
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.

  1. Create a component for controlling loading of animations and generate a property for it.
  2. Assign its property to the target controller node.
  3. Assign desired animation assets to the parameters of the property by using the Editor.

    Assigning animation assets to property parameters via the Editor
  4. Implement logic of creating a skinned mesh with the specified animations. The complete source code:

    SkinnedMeshController.h

    Source code (C++)
    #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

    Source code (C++)
    #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.

Source code (C++)
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#

New Functions

Light Class#

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#

New Functions

LightWorld Class#

Material Class#

UNIGINE 2.7.3 UNIGINE 2.8
setLightMask() Renamed to setShadowMask().
getLightMask() Renamed to getShadowMask().

Object Class#

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

PropertyParameter Class#

New Functions

Render Class#

UNIGINE 2.7.3 UNIGINE 2.8
setLightsUpscaling() Removed.
getLightsUpscaling() Removed.
setShadowsOmniJitter() Removed.
isShadowsOmniJitter() Removed.
setShadowsPrecision() Removed.
isShadowsPrecision() Removed.

New Functions

Renderer Class#

UNIGINE 2.7.3 UNIGINE 2.8
getReflectionMask() Renamed to getReflectionViewportMask().

UGUID Class#

New Functions

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.
Last update: 2020-01-14
Build: ()