Difference between revisions of "IC Python API:RLPy RFileIO"
Chuck (RL) (Talk | contribs) m |
Chuck (RL) (Talk | contribs) m |
||
(One intermediate revision by the same user not shown) | |||
Line 11: | Line 11: | ||
=== Supported Files Types === | === Supported Files Types === | ||
− | iClone can load the following file formats using | + | iClone can load the following file formats using [[#LoadFile ( self, strFilePath )|LoadFile]] (highlights in yellow also support [[#LoadObject ( self, strFilePath )|LoadObject]]): |
{|class="wikitable" | {|class="wikitable" | ||
Line 61: | Line 61: | ||
|abc||obj||fbx || || || || || | |abc||obj||fbx || || || || || | ||
|} | |} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Member Functions == | == Member Functions == | ||
Line 87: | Line 69: | ||
==== Parameters ==== | ==== Parameters ==== | ||
− | :spObject [IN] target object - | + | :'''spObject''' [IN] target object - [[IC_Python_API:RLPy_RIObject|RIObject]] |
− | :strFilePath [IN] file path - string | + | :'''strFilePath''' [IN] file path - string |
− | :eUpAxis [IN] up axis - RLPy.ECoordinateAxis | + | :'''eUpAxis''' [IN] up axis - RLPy.ECoordinateAxis |
:*RLPy.ECoordinateAxis_X | :*RLPy.ECoordinateAxis_X | ||
:*RLPy.ECoordinateAxis_NegativeX | :*RLPy.ECoordinateAxis_NegativeX | ||
Line 99: | Line 81: | ||
==== Returns ==== | ==== Returns ==== | ||
:Success - RLPy.RStatus.Success | :Success - RLPy.RStatus.Success | ||
− | : | + | :Failure - RLPy.RStatus.Failure |
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python" line='line'> |
#load AlembicFile | #load AlembicFile | ||
file_path = "C:/test.abc" | file_path = "C:/test.abc" | ||
Line 115: | Line 97: | ||
==== Parameters ==== | ==== Parameters ==== | ||
− | :strFilePath [IN] file path - string | + | :'''strFilePath''' [IN] file path - string |
==== Returns ==== | ==== Returns ==== | ||
:Success - RLPy.RStatus.Success | :Success - RLPy.RStatus.Success | ||
− | : | + | :Failure - RLPy.RStatus.Failure |
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python" line='line'> |
# load project file | # load project file | ||
file_path = "c:/myProject.iProject" | file_path = "c:/myProject.iProject" | ||
Line 132: | Line 114: | ||
==== Parameters ==== | ==== Parameters ==== | ||
− | :strFilePath [IN] file path - string | + | :'''strFilePath''' [IN] file path - string |
==== Returns ==== | ==== Returns ==== | ||
− | :The loaded object - | + | :The loaded object - [[IC_Python_API:RLPy_RIObject|RIObject]] |
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python" line='line'> |
# load object | # load object | ||
object = RLPy.RFileIO.LoadObject("C:/CC_Standard_Neutral.iavatar") | object = RLPy.RFileIO.LoadObject("C:/CC_Standard_Neutral.iavatar") | ||
Line 151: | Line 133: | ||
==== Parameters ==== | ==== Parameters ==== | ||
− | :spObject [IN] target object - | + | :'''spObject''' [IN] target object - [[IC_Python_API:RLPy_RIObject|RIObject]] |
− | :strFilePath [IN] file path - string | + | :'''strFilePath''' [IN] file path - string |
− | :eOptions [IN] Export options (Enum Flags) - RLPy.EExportFbxOptions | + | :'''eOptions''' [IN] Export options (Enum Flags) - RLPy.EExportFbxOptions |
:*RLPy.EExportFbxOptions__None | :*RLPy.EExportFbxOptions__None | ||
:*RLPy.EExportFbxOptions_FbxKey | :*RLPy.EExportFbxOptions_FbxKey | ||
Line 185: | Line 167: | ||
:*RLPy.EExportFbxOptions_MayaAdjustMaterial | :*RLPy.EExportFbxOptions_MayaAdjustMaterial | ||
:*RLPy.EExportFbxOptions_ConvertTifToPNG | :*RLPy.EExportFbxOptions_ConvertTifToPNG | ||
− | :eOptions2 [IN] Export options (Enum Flags) - RLPy.EExportFbxOptions2 | + | :'''eOptions2''' [IN] Export options (Enum Flags) - RLPy.EExportFbxOptions2 |
:*RLPy.EExportFbxOptions2__None | :*RLPy.EExportFbxOptions2__None | ||
:*RLPy.EExportFbxOptions2_XUp | :*RLPy.EExportFbxOptions2_XUp | ||
Line 215: | Line 197: | ||
:*RLPy.EExportFbxOptions2_UnrealPreset | :*RLPy.EExportFbxOptions2_UnrealPreset | ||
:*RLPy.EExportFbxOptions2_InstaLodPreset | :*RLPy.EExportFbxOptions2_InstaLodPreset | ||
− | :eOptions3 [IN] Export options (Enum Flags) - RLPy.EExportFbxOptions3 | + | :'''eOptions3''' [IN] Export options (Enum Flags) - RLPy.EExportFbxOptions3 |
:*RLPy.EExportFbxOptions3__None | :*RLPy.EExportFbxOptions3__None | ||
:*RLPy.EExportFbxOptions3_ExportJson | :*RLPy.EExportFbxOptions3_ExportJson | ||
− | :eTextureSize [IN] The exported texture resolution size; Default is '''Original''' - RLPy.EExportTextureSize | + | :'''eTextureSize''' [IN] The exported texture resolution size; Default is '''Original''' - RLPy.EExportTextureSize |
:*RLPy.EExportTextureSize_Original | :*RLPy.EExportTextureSize_Original | ||
:*RLPy.EExportTextureSize_Size_256 | :*RLPy.EExportTextureSize_Size_256 | ||
Line 225: | Line 207: | ||
:*RLPy.EExportTextureSize_Size_2048 | :*RLPy.EExportTextureSize_Size_2048 | ||
:*RLPy.EExportTextureSize_Size_4096 | :*RLPy.EExportTextureSize_Size_4096 | ||
− | :eFormat [IN] The exported texture file type; Its '''Default''' setting is the original texture file format - RLPy.EExportTextureFormat | + | :'''eFormat''' [IN] The exported texture file type; Its '''Default''' setting is the original texture file format - RLPy.EExportTextureFormat |
:*RLPy.EExportTextureFormat_Default | :*RLPy.EExportTextureFormat_Default | ||
:*RLPy.EExportTextureFormat_Bmp | :*RLPy.EExportTextureFormat_Bmp | ||
Line 232: | Line 214: | ||
:*RLPy.EExportTextureFormat_Png | :*RLPy.EExportTextureFormat_Png | ||
:*RLPy.EExportTextureFormat_Tif | :*RLPy.EExportTextureFormat_Tif | ||
− | :strIncludeMotionPath [IN] animation file path - string | + | :'''strIncludeMotionPath''' [IN] animation file path - string |
==== Returns ==== | ==== Returns ==== | ||
:Success - RLPy.RStatus.Success | :Success - RLPy.RStatus.Success | ||
− | : | + | :Failure - RLPy.RStatus.Failure |
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python" line='line'> |
# export fbx for Unreal | # export fbx for Unreal | ||
export_option = RLPy.EExportFbxOptions__None | export_option = RLPy.EExportFbxOptions__None |
Latest revision as of 23:23, 13 April 2020
- Main article: Modules.
- Last modified: 04/13/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 )