IC Python API:RLPy RFileIO

From Reallusion Wiki!
Jump to: navigation, search
Main article: Modules.
Last modified: 04/14/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
1 #load AlembicFile
2 file_path = "C:/test.abc"
3 selection_list = RLPy.RScene.GetSelectedObjects()
4 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
1 # load project file
2 file_path = "c:/myProject.iProject"
3 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
1 # load object
2 object = RLPy.RFileIO.LoadObject("C:/CC_Standard_Neutral.iavatar")
3 print(type(object)) #RLPy.RIAvatar
4 
5 object = RLPy.RFileIO.LoadObject("C:/Arc_001.iProp")
6 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
 1 # export fbx for Unreal
 2 export_option = RLPy.EExportFbxOptions__None
 3 export_option2 = RLPy.EExportFbxOptions2__None
 4 export_option3 = RLPy.EExportFbxOptions3__None
 5 export_option = export_option | RLPy.EExportFbxOptions_AutoSkinRigidMesh
 6 export_option = export_option | RLPy.EExportFbxOptions_ExportRootMotion
 7 export_option = export_option | RLPy.EExportFbxOptions_ZeroMotionRoot
 8 export_option = export_option | RLPy.EExportFbxOptions_ExportPbrTextureAsImageInFormatDirectory
 9 export_option = export_option | RLPy.EExportFbxOptions_InverseNormalY
10 export_option2 = export_option2 | RLPy.EExportFbxOptions2_UnrealEngine4BoneAxis
11 export_option2 = export_option2 | RLPy.EExportFbxOptions2_RenameDuplicateBoneName
12 export_option2 = export_option2 | RLPy.EExportFbxOptions2_RenameDuplicateMaterialName
13 export_option2 = export_option2 | RLPy.EExportFbxOptions2_RenameTransparencyWithPostFix
14 export_option2 = export_option2 | RLPy.EExportFbxOptions2_RenameBoneRootToGameType
15 export_option2 = export_option2 | RLPy.EExportFbxOptions2_RenameBoneToLowerCase
16 export_option2 = export_option2 | RLPy.EExportFbxOptions2_ResetBoneScale
17 export_option2 = export_option2 | RLPy.EExportFbxOptions2_ResetSelfillumination
18 export_option2 = export_option2 | RLPy.EExportFbxOptions2_ExtraWordForUnityAndUnreal
19 export_option2 = export_option2 | RLPy.EExportFbxOptions2_BakeMouthOpenMotionToMesh
20 export_option2 = export_option2 | RLPy.EExportFbxOptions2_UnrealIkBone
21 export_option2 = export_option2 | RLPy.EExportFbxOptions2_UnrealPreset
22 
23 original_size = RLPy.EExportTextureSize_Original
24 default_format = RLPy.EExportTextureFormat_Default 
25 include_motion_path = "C://Tpose.rlmotion"
26 result = RLPy.RFileIO.ExportFbxFile( avatar, "C://FBX//avatar.fbx", export_option, export_option2, export_option3, original_size, default_format, include_motion_path )