Difference between revisions of "IC8 Python API"

From Reallusion Wiki!
Jump to: navigation, search
m (User Interface)
m (Uploading and Managing Marketplace Plugins)
 
(12 intermediate revisions by the same user not shown)
Line 11: Line 11:
 
Python is a general-purpose language, which means it can be used to build just about any program — a process made easy with the right tools and code libraries. Professionally, Python is great for backend web development, data analysis, artificial intelligence, and scientific computing. Many developers have also used Python to build productivity tools, games, and desktop apps, so there are plenty of resources to help you learn how to create those as well.
 
Python is a general-purpose language, which means it can be used to build just about any program — a process made easy with the right tools and code libraries. Professionally, Python is great for backend web development, data analysis, artificial intelligence, and scientific computing. Many developers have also used Python to build productivity tools, games, and desktop apps, so there are plenty of resources to help you learn how to create those as well.
  
Python is easy to pick up for experienced programmers coming from other languages and easy to learn for beginners and novices.  Which can also explain its wide-spread support with 3D software with the likes of Autodesk 3dsMax, Autodesk Maya, Maxon Cinema4d, Blender, etc.
+
Python is easy to pick up for experienced programmers coming from other languages and easy to learn for beginners and novices.  Which can also explain its widespread support with 3D software with the likes of Autodesk 3dsMax, Autodesk Maya, Maxon Cinema4d, Blender, etc.
  
 
  Reallusion cannot be held responsible for any damages to your code or project schedule as a result of your study and use of this documentation or correspondence with our SDK support team. Reallusion is not obliged to make any changes to the SDK at your request. When using this reference or inquiring for support, you do so at your own risk.
 
  Reallusion cannot be held responsible for any damages to your code or project schedule as a result of your study and use of this documentation or correspondence with our SDK support team. Reallusion is not obliged to make any changes to the SDK at your request. When using this reference or inquiring for support, you do so at your own risk.
Line 17: Line 17:
 
== Module & Class Documentation ==
 
== Module & Class Documentation ==
  
:[[iC_8_Python_API:Modules | iC8 Python Modules]]
+
:[[iC8_Python_API:Modules | iC8 Python Modules]]
:[[IC_8_Python_API:Modules_Ordered_List | iC8 Python Modules - Ordered List]]
+
 
:[[iC_8_Python_API:Class_Members | iC8 Python Class Members]]
+
== iClone 8 Code Examples ==
:[[IC_8_Python_API:Enums | iC8 Python Enumerations]]
+
 
 +
:[[iC_8_Python_API:Enforcing_Plugin_Compatibility|Enforcing Plugin Compatibility]]
 +
:[[iC_8_Python_API:Dealing_With_Custom_FPS|Dealing with Custom FPS]]
 +
:[[iC_8_Python_API:End_Effector_Animation|End Effector Animation]]
 +
:[[iC_8_Python_API:Facial_Animation|Facial Animation]]
 +
:[[iC_8_Python_API:Smart_Content_Manager|Smart Content Manager]]
  
 
== Getting Started ==
 
== Getting Started ==
Line 30: Line 35:
 
:Scale Units: 1 equals to 100% scale.
 
:Scale Units: 1 equals to 100% scale.
 
:Time Units: 1 equals to 1 millisecond and 1,000 equals to 1 second.
 
:Time Units: 1 equals to 1 millisecond and 1,000 equals to 1 second.
 +
 +
=== User Interface ===
  
 
iClone 8 adopts Python 3.8 and Qt 5.15.2. You'll need to initialize PySide2 with the following code, otherwise, the script will not load correctly and a syntax error will appear in the console log.
 
iClone 8 adopts Python 3.8 and Qt 5.15.2. You'll need to initialize PySide2 with the following code, otherwise, the script will not load correctly and a syntax error will appear in the console log.
Line 38: Line 45:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
=== See Also ===
+
For more information, see the [https://doc.qt.io/qtforpython-5/contents.html Qt for Python Documentation].
  
:[[iC_8_Python_API:Checking_Program_Compatibility|Checking Program Compatibility]]
+
=== Deprecation of Motion Bones ===
:[[iC_8_Python_API:Dealing_With_Custom_FPS|Dealing with Custom FPS]]
+
 
:[[iC_8_Python_API:Removing_Bone_Animation|Removing Bone Animation]]
+
In iClone 7, all character movements are driven by motion bones which is a set of standard bone structures with a fixed structure and names. Animations are first applied to motion bones, and then retargeted to the character's skin bones in real-time (as shown below).
:[[iC_8_Python_API:End_Effector_Animation|End Effector Animation]]
+
 
:[[iC_8_Python_API:Facial_Animation|Facial Animation]]
+
[[File:ic8_python_api_01.png]]
:[[iC_8_Python_API:Smart_Content_Manager|Smart Content Manager]]
+
 
 +
However, motion bone offsets became incrementally severe as animations were repeatedly exported and imported to and from third-party 3D software. For iClone 8, the entire motion bone skeleton has been removed with two major implications. One is that multiple transfers of animation between similar skeleton structures are guaranteed to have consistently identical results. The other implication is that retargeting is only performed for skeletons of different structures.
 +
 
 +
==== Deprecated Functions ====
 +
 
 +
Due to the removal of motion bones, the corresponding functions in the Python API have also been removed. Functions related to motion bones in iClone 7, such as '''GetMotionBones()''' and '''GetRootPositionRetargetingRatio()''' in the '''RISkeletonComponent''' class, is no longer available in iClone 8.
  
 
=== External Resources ===
 
=== External Resources ===
Line 52: Line 64:
 
:[https://wiki.qt.io/Qt_for_Python Qt for Python (PySide2)]
 
:[https://wiki.qt.io/Qt_for_Python Qt for Python (PySide2)]
 
:[https://github.com/reallusion/iclone Reallusion GitHub]
 
:[https://github.com/reallusion/iclone Reallusion GitHub]
 +
 +
== Uploading and Managing Marketplace Plugins ==
 +
 +
Developers wishing to offer their plugins in the Reallusion Marketplace will find the following guide useful.
 +
 +
:[[iC_Python_API:Uploading_and_Managing_Marketplace_Plugins | Uploading and Managing Marketplace Plugins]]
  
 
== Release Cycles ==
 
== Release Cycles ==

Latest revision as of 22:04, 10 April 2023

Main article: Main Page.

Scripting in iClone

Scripting can be a powerful part of your arsenal for dealing with 3D art production. Whether you are looking for a way to automate some parts of your workflow or develop more advanced toolkits and plugins, scripting can offer something for everyone. iClone Python API gives access to the robust low-level implementations hidden within iClone while abstracting its complexity to a manageable level.

Why Python?

Python is a general-purpose language, which means it can be used to build just about any program — a process made easy with the right tools and code libraries. Professionally, Python is great for backend web development, data analysis, artificial intelligence, and scientific computing. Many developers have also used Python to build productivity tools, games, and desktop apps, so there are plenty of resources to help you learn how to create those as well.

Python is easy to pick up for experienced programmers coming from other languages and easy to learn for beginners and novices. Which can also explain its widespread support with 3D software with the likes of Autodesk 3dsMax, Autodesk Maya, Maxon Cinema4d, Blender, etc.

Reallusion cannot be held responsible for any damages to your code or project schedule as a result of your study and use of this documentation or correspondence with our SDK support team. Reallusion is not obliged to make any changes to the SDK at your request. When using this reference or inquiring for support, you do so at your own risk.

Module & Class Documentation

iC8 Python Modules

iClone 8 Code Examples

Enforcing Plugin Compatibility
Dealing with Custom FPS
End Effector Animation
Facial Animation
Smart Content Manager

Getting Started

iClone Conventions

World Axis: Z up, -Y forward, Right-handed Coordinate system
Rotational System: Quaternion, Matrix3 or Euler Angle ( Radians )
Scale Units: 1 equals to 100% scale.
Time Units: 1 equals to 1 millisecond and 1,000 equals to 1 second.

User Interface

iClone 8 adopts Python 3.8 and Qt 5.15.2. You'll need to initialize PySide2 with the following code, otherwise, the script will not load correctly and a syntax error will appear in the console log.

1 from shiboken2 import wrapInstance
2 QtCore.QStringListModel

For more information, see the Qt for Python Documentation.

Deprecation of Motion Bones

In iClone 7, all character movements are driven by motion bones which is a set of standard bone structures with a fixed structure and names. Animations are first applied to motion bones, and then retargeted to the character's skin bones in real-time (as shown below).

Ic8 python api 01.png

However, motion bone offsets became incrementally severe as animations were repeatedly exported and imported to and from third-party 3D software. For iClone 8, the entire motion bone skeleton has been removed with two major implications. One is that multiple transfers of animation between similar skeleton structures are guaranteed to have consistently identical results. The other implication is that retargeting is only performed for skeletons of different structures.

Deprecated Functions

Due to the removal of motion bones, the corresponding functions in the Python API have also been removed. Functions related to motion bones in iClone 7, such as GetMotionBones() and GetRootPositionRetargetingRatio() in the RISkeletonComponent class, is no longer available in iClone 8.

External Resources

Python.org
Qt for Python (PySide2)
Reallusion GitHub

Uploading and Managing Marketplace Plugins

Developers wishing to offer their plugins in the Reallusion Marketplace will find the following guide useful.

Uploading and Managing Marketplace Plugins

Release Cycles

The Python APIs are continuously being expanded which lends to shorter release cycles that expose features in the early to intermediate stages of development. This strategy provides instantaneous feedback for developing features while providing insights into user requirements. Feature releases come in two forms:

  • Early Access Features - We may deprecate this functionality at our discretion. However, we support backward compatibility for assets, and this feature's API should be stable.
  • Experimental Features - We do not support backward compatibility for assets, the API for this feature is subject to change, and we may remove functionality at our discretion.