IC8 Python API:RLPy RFileIO

From Reallusion Wiki!
Revision as of 22:03, 27 December 2022 by Chuck (RL) (Talk | contribs) (Created page with "{{TOC}} {{Parent|IC_8_Python_API:Modules|iC8 Modules}} {{last_modified}} ==Description== This class has file load and save capabilities. Currently, you can load iClone-rela...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Main article: iC8 Modules.
Last modified: 12/27/2022

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

Static Methods

RLPy.RFileIO.CheckExportFbxHasLicense(spObject)

Check if the exported FBX has a sell and export license.

Internal use Experimental API

Parameters

spObject[IN] target object - RLPy.RIObject

Returns

RLPy.RStatus.Success - Success
RLPy.RStatus.Failure - Fail
1 # No example

RLPy.RFileIO.ExportFbxFile(args)

Export the FBX file from a scene object by settings.

Experimental API

Parameters

spObject[IN] target object - RLPy.RIObject
strFilePath[IN] file path - string
kSetting[IN] export fbx settings - RLPy.RExportFbxSetting

Returns

RLPy.RStatus.Success - Success
RLPy.RStatus.Failure - Fail
 1 # export fbx for Unreal
 2 
 3 export_option = RLPy.EExportFbxOptions__None
 4 export_option2 = RLPy.EExportFbxOptions2__None
 5 export_option3 = RLPy.EExportFbxOptions3__None
 6 export_option = export_option | RLPy.EExportFbxOptions_AutoSkinRigidMesh
 7 export_option = export_option | RLPy.EExportFbxOptions_ExportRootMotion
 8 export_option = export_option | RLPy.EExportFbxOptions_ZeroMotionRoot
 9 export_option = export_option | RLPy.EExportFbxOptions_ExportPbrTextureAsImageInFormatDirectory
10 export_option = export_option | RLPy.EExportFbxOptions_InverseNormalY
11 export_option2 = export_option2 | RLPy.EExportFbxOptions2_UnrealEngine4BoneAxis
12 export_option2 = export_option2 | RLPy.EExportFbxOptions2_RenameDuplicateBoneName
13 export_option2 = export_option2 | RLPy.EExportFbxOptions2_RenameDuplicateMaterialName
14 export_option2 = export_option2 | RLPy.EExportFbxOptions2_RenameTransparencyWithPostFix
15 export_option2 = export_option2 | RLPy.EExportFbxOptions2_RenameBoneRootToGameType
16 export_option2 = export_option2 | RLPy.EExportFbxOptions2_RenameBoneToLowerCase
17 export_option2 = export_option2 | RLPy.EExportFbxOptions2_ResetBoneScale
18 export_option2 = export_option2 | RLPy.EExportFbxOptions2_ResetSelfillumination
19 export_option2 = export_option2 | RLPy.EExportFbxOptions2_ExtraWordForUnityAndUnreal
20 export_option2 = export_option2 | RLPy.EExportFbxOptions2_BakeMouthOpenMotionToMesh
21 export_option2 = export_option2 | RLPy.EExportFbxOptions2_UnrealIkBone
22 export_option2 = export_option2 | RLPy.EExportFbxOptions2_UnrealPreset
23 
24 original_size = RLPy.EExportTextureSize_Original
25 default_format = RLPy.EExportTextureFormat_Default 
26 include_motion_path = "C://Tpose.rlmotion"
27 result = RLPy.RFileIO.ExportFbxFile( avatar, "C://FBX//avatar.fbx", export_option, export_option2, export_option3, original_size, default_format, include_motion_path )

RLPy.RFileIO.ExportGlbFile(args)

Export the FBX file from a scene object by settings.

Experimental API

Parameters

spObject[IN] target object - RLPy.RIObject
strFilePath[IN] file path - string
kSetting[IN] export fbx settings - RLPy.RExportGlbSetting
sGlbExportOption[IN] export glb options

Returns

RLPy.RStatus.Success - Success
RLPy.RStatus.Failure - Fail
1 # No example

RLPy.RFileIO.ExportObjFile(spObject, strFilePath, eOption)

Export the OBJ file from a scene object.

Only Character Creator 3 can use this API. Experimental API

Parameters

spObject[IN] target object - RLPy.RIObject
strFilePath[IN] file path - string
eOptions[IN] export options

Returns

RLPy.RStatus.Success - Success
RLPy.RStatus.Failure - Fail
1 # No example

RLPy.RFileIO.ExportUsdFile(strFilePath, strPrimeName, eMaterialType, eIncludeMotionType, ePostEffect, sUsdExportOption)

brief Export the USD file from a scene object by settings.

Experimental API

Parameters

strFilePath[IN] file path - string
strPrimeName[IN] prime name - string
eMaterialType[IN] material type - RLPy.EMaterialType
  • RLPy.EMaterialType_RTX_Real_Time
  • RLPy.EMaterialType_RTX_Path_Traced
eIncludeMotionType[IN] type of include motion - RLPy.EIncludeMotionType
  • RLPy.EIncludeMotionType_Current_Pose
  • RLPy.EIncludeMotionType_Current_Animation
  • RLPy.EIncludeMotionType_Custom
ePostEffect[IN] post effect - RLPy.EPostEffect
  • RLPy.EPostEffect_None
  • RLPy.EPostEffect_Default
  • RLPy.EPostEffect_Faded
  • RLPy.EPostEffect_Cold_Weak
  • RLPy.EPostEffect_Cold_Strong
  • RLPy.EPostEffect_Warm_Weak
  • RLPy.EPostEffect_Warn_Strong
  • RLPy.EPostEffect_Aged
  • RLPy.EPostEffect_Retro
  • RLPy.EPostEffect_Corrupted_purple
  • RLPy.EPostEffect_Black_And_White
sUsdExportOption[IN] export usd options - RLPy.RSUsdExportOption

Returns

RLPy.RStatus.Success - Success
RLPy.RStatus.Failure - Fail
1 # No example

RLPy.RFileIO.LoadAlembicFile(spObject, strFilePath, eUpAxis)

Import the alembic file from the given file into the current scene.

Experimental API

Parameters

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

Returns

RLPy.RStatus.Success - Success
RLPy.RStatus.Failure - Fail
1 file_path = "C:/test.abc"
2 selection_list = RLPy.RScene.GetSelectedObjects()
3 result = RLPy.RFileIO.LoadAlembicFile(selection_list[0], file_path, RLPy.ECoordinateAxis_Y)

RLPy.RFileIO.LoadFbxFile(args)

Import the scene elements from the given fbx file into the current scene.

Currently supported file types: fbx format.

Parameters

strFilePath[IN] file path - string
eFbxOption[IN] type of import fbx - RLPy.EImportFbxOption::None
strFbxKeyFilePath[IN] fbxkey file path - string
strNudeTemplateFilePath[IN] "Nude template for glove and shoe" path - string
bRecordStep[IN] Determines whether the current operation steps are to be recorded. If this operation is recorded, it will be included in the program's Undo / Redo management. The default is True - bool

Returns

RLPy.RStatus.Success - Success
RLPy.RStatus.Failure - Fail
1 # No example

RLPy.RFileIO.LoadFile(strFilePath, bRecordStep = True)

Import the scene elements from the given file into the current scene.

Currently supported file types: All iClone supported file format.

Parameters

strFilePath[IN] file path - string
bRecordStep[IN] Determines whether the current operation steps are to be recorded. If this operation is recorded, it will be included in the program's Undo / Redo management. The default is True - bool

Returns

RLPy.RStatus.Success - Success
RLPy.RStatus.Failure - Fail
1 file_path = "c:/myProject.iProject"
2 result = RLPy.RFileIO.LoadFile(file_path)

RLPy.RFileIO.LoadMotion(strFilePath, kTime, spObject)

Load a motion clip into a character or prop.

If you have used PreLoadMotion to load this motion clip, it will not be loaded repeatedly, and the motion clip will be directly mounted.

Parameters

strFilePath[IN] file path - string
kTime[IN] clip start time - RLPy.RLTime
spObject[IN] target object - RLPy.RIObject

Returns

RLPy.RStatus.Success - Success
RLPy.RStatus.Failure - Fail
1 # No example

RLPy.RFileIO.LoadObject(strFilePath, bRecordStep = True)

Import the scene elements from the given file into the current scene.

Experimental API

Parameters

strFilePath[IN] file path - string
bRecordStep[IN] Determines whether the current operation steps are to be recorded. If this operation is recorded, it will be included in the program's Undo / Redo management. The default is True - bool

Returns

RIObjectPtrThe requested object returned as a Type.

1 object = RLPy.RFileIO.LoadObject("C:/CC_Standard_Neutral.iavatar")
2 print(type(object)) #RLPy.RIAvatar
3 
4 object = RLPy.RFileIO.LoadObject("C:/Arc_001.iProp")
5 print(type(object)) #RLPy.RIProp

RLPy.RFileIO.LoadSubstancePainterTextures(spObject, strFolderPath)

Load textures from Substance Painter.

Only supports character. Experimental API

Parameters

spObject[IN] target object - RLPy.RIObject
strFolderPath[IN] folder path - string

Returns

RLPy.RStatus.Success - Success
RLPy.RStatus.Failure - Fail
1 # No example

RLPy.RFileIO.PreLoadMotion(strFilePath, spObject, kMotionLength)

Pre-load motion clips to characters or props.

When you really need to mount them to characters or props, please call LoadMotion.

Parameters

spObject[IN] target object - RLPy.RIObject
strFilePath[IN] file path - string

Returns

RLPy.RStatus.Success - Success
RLPy.RStatus.Failure - Fail
1 # No example

RLPy.RFileIO.SaveFile(spObject, kSaveSetting, strSavePath)

brief Save file from a scene object by settings.

Experimental API

Parameters

kSaveSetting[IN] save file settings - RLPy.RSaveFileSetting
strFilePath[IN] file path

Returns

RLPy.RStatus.Success - Success
RLPy.RStatus.Failure - Fail
1 # No example

RLPy.RFileIO.SaveProject(strSavePath)

brief Save the current scene as a new project.

Experimental API

Parameters

strFilePath[IN] file path

Returns

RLPy.RStatus.Success - Success
RLPy.RStatus.Failure - Fail
1 # No example

RLPy.RFileIO.SaveThumbnailToFile(strRLFile, strSaveTo)

Save thumbnails of RL files as an image file.

Parameters

strRLFile[IN] RL file path - string
strSaveTo[IN] Saved thumbnail path - string

Returns

RLPy.RStatus.Success - Success
RLPy.RStatus.Failure - Fail
1 # No example