IC Python API:RLPy RFileIO

From Reallusion Wiki!
Revision as of 22:53, 8 April 2020 by Chuck (RL) (Talk | contribs)

Jump to: navigation, search
Main article: Modules.
Last modified: 04/8/2020

Description

This class has file load and save capabilities. Currently, you can load iClone related files, objects, Alembic files, and output FBX files.

Alembic is an interchangeable computer graphics file format developed by Sony Pictures Imageworks and Industrial Light & Magic. Its primary focus is the interchange of geometry (models) between different groups working on the same shots or same assets. In layman's terms, Alembic is an open-source 3D model exchange format that can save animations baked into the geometry. 

Supported Files Types

iClone can load the following file formats using LoadFile (highlights in yellow also support LoadObject):

Avatar iavatar iacc ihair iupper ilower ishoe iglove iskin
icloth iteeth aml
Head iface ieye ioral rlhead
Props iprop itree iparticle ipkfx iTerrain iwater isky
Animation imotion imotionplus rlmotion ihand italk rltalk ipath
Scene iimglayer iscene iatm ifog icam ilight ieffect imtl
imtlplus isubstance sbsar itol iscript lua cclightroom
Image jpg jpeg bmp gif png hdr exr tga
Audio mp3 wma m4a aac wav
Video avi mv mpeg mpg mpe mp4 mkv rm
rmvb asf asx wm mov flv
iSprite popvideo iwidget
Physics Constraint iconstraint
Advertise Thumbnail rladv
Model abc obj fbx

Member Functions

LoadAlembic( self, spObject, strFilePath, eUpAxis )

Load related Alembic file to the selected object in the current scene. If loaded successfully return RStatus.Success, else RStatus.Failure.

Parameters

spObject [IN] target object - RIObject
strFilePath [IN] file path - string
eUpAxis [IN] up axis - RLPy.ECoordinateAxis
  • RLPy.ECoordinateAxis_X
  • RLPy.ECoordinateAxis_NegativeX
  • RLPy.ECoordinateAxis_Y
  • RLPy.ECoordinateAxis_NegativeY
  • RLPy.ECoordinateAxis_Z
  • RLPy.ECoordinateAxis_NegativeZ

Returns

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
#load AlembicFile
file_path = "C:/test.abc"
selection_list = RLPy.RScene.GetSelectedObjects()
result = RLPy.RFileIO.LoadAlembicFile(selection_list[0], file_path, RLPy.ECoordinateAxis_Y)

LoadFile ( self, strFilePath )

Load a file from a specified path into the current scene. If the file loaded successfully then return RStatus.Success, else RStatus.Failure. Supports every iClone file format.

See Also: Supported Files Types

Parameters

strFilePath [IN] file path - string

Returns

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
# load project file
file_path = "c:/myProject.iProject"
result = RLPy.RFileIO.LoadFile(file_path)

LoadObject ( self, strFilePath )

Load an object from a specified path into the current scene. If the file loaded successfully then return RStatus.Success, else RStatus.Failure. This function only supports objects that inherit from RIObject: RIAvatar, RICamera, RILight, RIParticle, RIProp.

Parameters

strFilePath [IN] file path - string

Returns

The loaded object - RIObject
# load object
object = RLPy.RFileIO.LoadObject("C:/CC_Standard_Neutral.iavatar")
print(type(object)) #RLPy.RIAvatar

object = RLPy.RFileIO.LoadObject("C:/Arc_001.iProp")
print(type(object)) #RLPy.RIProp

ExportFbxFile ( self, spObject, strFilePath, eOptions, eOptions2, eOptions3, eTextureSize, eFormat, strIncludeMotionPath )

Export an object in the scene to a FBX file; Allows for different export settings. If you would like to include animation data with the FBX file, then you can set a path to the animation file.

Parameters

spObject [IN] target object - RIObject
strFilePath [IN] file path - string
eOptions [IN] Export options (Enum Flags) - RLPy.EExportFbxOptions
  • RLPy.EExportFbxOptions__None
  • RLPy.EExportFbxOptions_FbxKey
  • RLPy.EExportFbxOptions_LightWaveYUp
  • RLPy.EExportFbxOptions_LightWaveReferenceBone
  • RLPy.EExportFbxOptions_AutoSkinRigidMesh
  • RLPy.EExportFbxOptions_AutoSkinRigidMeshWithDifferentBoneName
  • RLPy.EExportFbxOptions_SaveHideMeshStateInOneSelectionSet
  • RLPy.EExportFbxOptions_ForceTrangleExport
  • RLPy.EExportFbxOptions_ExportMotion30SecOnly
  • RLPy.EExportFbxOptions_TPoseOnMotionFirstFrame
  • RLPy.EExportFbxOptions_FirstMotionNotOffset
  • RLPy.EExportFbxOptions_ExportRootMotion
  • RLPy.EExportFbxOptions_ZeroMotionRoot
  • RLPy.EExportFbxOptions_RemoveAllUnused
  • RLPy.EExportFbxOptions_RemoveBoneRoot
  • RLPy.EExportFbxOptions_RemoveHiddenMesh
  • RLPy.EExportFbxOptions_RemoveUnusedMorph
  • RLPy.EExportFbxOptions_RemoveEyelash
  • RLPy.EExportFbxOptions_RemoveAllMesh
  • RLPy.EExportFbxOptions_RemoveAllMeshKeepMorph
  • RLPy.EExportFbxOptions_EmbedTexture
  • RLPy.EExportFbxOptions_ExportPbrTextureAsImageInDiffuseLayer
  • RLPy.EExportFbxOptions_ExportPbrTextureAsImageInOneDirectory
  • RLPy.EExportFbxOptions_ExportPbrTextureAsImageInFormatDirectory
  • RLPy.EExportFbxOptions_ExportPbrTextureAsSbsar
  • RLPy.EExportFbxOptions_ExportMetallicAlpha
  • RLPy.EExportFbxOptions_InverseNormalY
  • RLPy.EExportFbxOptions_InverseOpacity
  • RLPy.EExportFbxOptions_MergeDiffuseOpacityMap
  • RLPy.EExportFbxOptions_MayaAdjustMaterial
  • RLPy.EExportFbxOptions_ConvertTifToPNG
eOptions2 [IN] Export options (Enum Flags) - RLPy.EExportFbxOptions2
  • RLPy.EExportFbxOptions2__None
  • RLPy.EExportFbxOptions2_XUp
  • RLPy.EExportFbxOptions2_YUp
  • RLPy.EExportFbxOptions2_UnrealEngine4BoneAxis
  • RLPy.EExportFbxOptions2_SourceUpAxisSameAsTarget
  • RLPy.EExportFbxOptions2_RenameDuplicateBoneName
  • RLPy.EExportFbxOptions2_RenameDuplicateMaterialName
  • RLPy.EExportFbxOptions2_RenameDuplicateMorphName
  • RLPy.EExportFbxOptions2_RenameTransparencyWithPostFix
  • RLPy.EExportFbxOptions2_RenameBoneRootToGameType
  • RLPy.EExportFbxOptions2_RenameBoneToLowerCase
  • RLPy.EExportFbxOptions2_RenameBoneOnStd
  • RLPy.EExportFbxOptions2_IsNotRenamePivot
  • RLPy.EExportFbxOptions2_RenameGameBodyMesh
  • RLPy.EExportFbxOptions2_RenameMorphInvalidCharacter
  • RLPy.EExportFbxOptions2_ResetBoneScale
  • RLPy.EExportFbxOptions2_ResetSkinPose
  • RLPy.EExportFbxOptions2_ResetSelfillumination
  • RLPy.EExportFbxOptions2_AsciiFormat
  • RLPy.EExportFbxOptions2_PrefixAndPostfix
  • RLPy.EExportFbxOptions2_IsNotCloneObject
  • RLPy.EExportFbxOptions2_BoneNubAttribute
  • RLPy.EExportFbxOptions2_ExtraWordForUnityAndUnreal
  • RLPy.EExportFbxOptions2_BakeMouthOpenMotionToMesh
  • RLPy.EExportFbxOptions2_AvoidTextureIntoIndexedMode
  • RLPy.EExportFbxOptions2_UnrealIkBone
  • RLPy.EExportFbxOptions2_UnityPreset
  • RLPy.EExportFbxOptions2_UnrealPreset
  • RLPy.EExportFbxOptions2_InstaLodPreset
eOptions3 [IN] Export options (Enum Flags) - RLPy.EExportFbxOptions3
  • RLPy.EExportFbxOptions3__None
  • RLPy.EExportFbxOptions3_ExportJson
eTextureSize [IN] The exported texture resolution size; Default is Original - RLPy.EExportTextureSize
  • RLPy.EExportTextureSize_Original
  • RLPy.EExportTextureSize_Size_256
  • RLPy.EExportTextureSize_Size_512
  • RLPy.EExportTextureSize_Size_1024
  • RLPy.EExportTextureSize_Size_2048
  • RLPy.EExportTextureSize_Size_4096
eFormat [IN] The exported texture file type; Its Default setting is the original texture file format - RLPy.EExportTextureFormat
  • RLPy.EExportTextureFormat_Default
  • RLPy.EExportTextureFormat_Bmp
  • RLPy.EExportTextureFormat_Jpeg
  • RLPy.EExportTextureFormat_Tga
  • RLPy.EExportTextureFormat_Png
  • RLPy.EExportTextureFormat_Tif
strIncludeMotionPath [IN] animation file path - string

Returns

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
# export fbx for Unreal
export_option = RLPy.EExportFbxOptions__None
export_option2 = RLPy.EExportFbxOptions2__None
export_option3 = RLPy.EExportFbxOptions3__None
export_option = export_option | RLPy.EExportFbxOptions_AutoSkinRigidMesh
export_option = export_option | RLPy.EExportFbxOptions_ExportRootMotion
export_option = export_option | RLPy.EExportFbxOptions_ZeroMotionRoot
export_option = export_option | RLPy.EExportFbxOptions_ExportPbrTextureAsImageInFormatDirectory
export_option = export_option | RLPy.EExportFbxOptions_InverseNormalY
export_option2 = export_option2 | RLPy.EExportFbxOptions2_UnrealEngine4BoneAxis
export_option2 = export_option2 | RLPy.EExportFbxOptions2_RenameDuplicateBoneName
export_option2 = export_option2 | RLPy.EExportFbxOptions2_RenameDuplicateMaterialName
export_option2 = export_option2 | RLPy.EExportFbxOptions2_RenameTransparencyWithPostFix
export_option2 = export_option2 | RLPy.EExportFbxOptions2_RenameBoneRootToGameType
export_option2 = export_option2 | RLPy.EExportFbxOptions2_RenameBoneToLowerCase
export_option2 = export_option2 | RLPy.EExportFbxOptions2_ResetBoneScale
export_option2 = export_option2 | RLPy.EExportFbxOptions2_ResetSelfillumination
export_option2 = export_option2 | RLPy.EExportFbxOptions2_ExtraWordForUnityAndUnreal
export_option2 = export_option2 | RLPy.EExportFbxOptions2_BakeMouthOpenMotionToMesh
export_option2 = export_option2 | RLPy.EExportFbxOptions2_UnrealIkBone
export_option2 = export_option2 | RLPy.EExportFbxOptions2_UnrealPreset

original_size = RLPy.EExportTextureSize_Original
default_format = RLPy.EExportTextureFormat_Default 
include_motion_path = "C://Tpose.rlmotion"
result = RLPy.RFileIO.ExportFbxFile( avatar, "C://FBX//avatar.fbx", export_option, export_option2, export_option3, original_size, default_format, include_motion_path )