IC8 Python API:RLPy RSaveFileSetting

From Reallusion Wiki!
Revision as of 19:18, 1 December 2024 by Chuck (RL) (Talk | contribs)

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

Description

Creates a file data for RLPy.RFileIO.SaveFile(), making it possible to save different file types.

Examples

iAvatar

1 # save iAvatar
2 avatar = RLPy.RScene.GetAvatars()[0]
3 save_avatar_path = "C:\\Temp\\avatar.iAvatar"
4 setting = RLPy.RSaveFileSetting()
5 setting.SetSaveType(RLPy.ESaveFileType_Character)
6 result = RLPy.RFileIO.SaveFile(avatar, setting, save_avatar_path)

iProp

1 # save iProp
2 prop= RLPy.RScene.GetProps()[0]
3 save_prop_path = "C:\\Temp\\prop.iProp"
4 setting = RLPy.RSaveFileSetting()
5 setting.SetSaveType(RLPy.ESaveFileType_Prop)
6 result = RLPy.RFileIO.SaveFile(prop, setting, save_prop_path)

rlMotion

1 # save rlMotion
2 avatar = RLPy.RScene.GetAvatars()[0]
3 save_motion_path = "C:\\Temp\\motion.rlMotion"
4 setting = RLPy.RSaveFileSetting()
5 setting.SetSaveType(RLPy.ESaveFileType_Motion)
6 setting.SetSaveRange(RLPy.RTick.FromMilliSecond(0), RLPy.RTick.FromMilliSecond(1000))
7 result = RLPy.RFileIO.SaveFile(avatar, setting, save_motion_path)

rlMotionPlus

 1 # save iMotionPlus
 2 avatar = RLPy.RScene.GetAvatars()[0]
 3 save_motion_path = "C:\\Temp\\motion.iMotionPlus"
 4 setting = RLPy.RSaveFileSetting()
 5 setting.SetSaveType(RLPy.ESaveFileType_MotionPlus)
 6 setting.SetSaveRange( RLPy.RTick.FromMilliSecond(0), RLPy.RTick.FromMilliSecond(1000) )
 7 motion_plus_option = RLPy.RSaveMotionPlusOption()        
 8 motion_plus_option.SetMotionPlusOption(RLPy.ESaveMotionPlusOption_Avatar_Talk | RLPy.ESaveMotionPlusOption_Avatar_Motion)
 9 setting.SetSaveFileOption( motion_plus_option )
10 result = RLPy.RFileIO.SaveFile(avatar, setting, save_motion_path)

iTalk (Expression Only)

 1 # save iTalk (Expression only)
 2 avatar = RLPy.RScene.GetAvatars()[0]
 3 save_expression_path= "C:\\Temp\\talk.iTalk"
 4 
 5 iTalkOption = RLPy.RSaveFacialAnimationOption()
 6 iTalkOption.SetFlag(RLPy.ESaveFacialAnimationOption_Expression)
 7 
 8 setting = RLPy.RSaveFileSetting()
 9 setting.SetSaveRange(RLPy.RTick.FromMilliSecond(0), RLPy.RTick.FromMilliSecond(1000) )
10 setting.SetSaveType( RLPy.ESaveFileType_Talk )
11 setting.SetSaveFileOption( iTalkOption )
12 result = RLPy.RFileIO.SaveFile(avatar, setting, save_expression_path)

iTalk (Expression and Viseme)

 1 # save iTalk (Expression and Viseme)
 2 avatar = RLPy.RScene.GetAvatars()[0]
 3 save_expression_path= "C:\\Temp\\talk.iTalk"
 4 
 5 iTalkOption = RLPy.RSaveFacialAnimationOption()
 6 iTalkOption.SetFlag(RLPy.ESaveFacialAnimationOption_All)
 7 
 8 setting = RLPy.RSaveFileSetting()
 9 setting.SetSaveRange(RLPy.RTick.FromMilliSecond(0), RLPy.RTick.FromMilliSecond(1000) )
10 setting.SetSaveType( RLPy.ESaveFileType_Talk )
11 setting.SetSaveFileOption( iTalkOption )
12 result = RLPy.RFileIO.SaveFile(avatar, setting, save_expression_path)

Member Functions

SetSaveType (self, eType)

Sets the file type for saving.

Parameters

eType - The file type to save.
iAvatar RLPy.ESaveFileType_Character
rlMotion RLPy.ESaveFileType_Motion
iProp RLPy.ESaveFileType_Prop
iTalk RLPy.ESaveFileType_Talk
iMotionPlus RLPy.ESaveFileType_MotionPlus

GetSaveType(self)

Retrieves the configured save file type, as set by SetSaveType().

Returns

File Type: RLPy.ESaveFileType

SetSaveRange(self, kStart, kEnd)

Sets the save range, applicable only to animation files (rlMotion, iMotionPlus, iTalk).

Parameters

kStart: Start time (RTime)
kEnd: End time (RTime)

GetSaveRangeStart(self)

Retrieves the start time of the configured save range, as set by SetSaveRange().

Returns

Start Time: RTime

GetSaveRangeEnd(self)

Retrieves the end time of the configured save range, as set by SetSaveRange().

Returns

End Time: RTime

SetSaveFileOption(self, pSaveFileOption)

Configures file-specific options depending on the file type.

Parameters

pSaveFileOption: Configuration object tailored for specific file types.

File-Specific Configurations

iTalk (RSaveFacialAnimationOption):
  • RLPy.RSaveFacialAnimationOption().SetFlag() accepts:
    • RLPy.ESaveFacialAnimationOption_Expression: Saves Expression animation
    • RLPy.ESaveFacialAnimationOption_Viseme: Saves Viseme animation
    • RLPy.ESaveFacialAnimationOption_All: Saves both Expression and Viseme animations
iMotionPlus (RSaveMotionPlusOption):
  • RLPy.RSaveMotionPlusOption().SetMotionPlusOption() accepts:
    • RLPy.ESaveMotionPlusOption_Avatar_Motion: Saves Motion animation
    • RLPy.ESaveMotionPlusOption_Avatar_Spring: Saves Spring animation
    • RLPy.ESaveMotionPlusOption_Avatar_Visible: Saves Visible animation
    • RLPy.ESaveMotionPlusOption_Avatar_Sound: Saves Sound animation
    • RLPy.ESaveMotionPlusOption_Avatar_Talk: Saves Expression and Viseme animations
    • RLPy.ESaveMotionPlusOption_Avatar_Morph: Saves Morph animation
    • RLPy.ESaveMotionPlusOption_Avatar_Material: Saves Material animation
    • RLPy.ESaveMotionPlusOption_AllAvatar: Saves all animations
  • RLPy.RSaveMotionPlusOption().SetMotionClipOption() accepts:
    • RLPy.ESaveMotionClipOption_WithLayerKey: Saves LayerKey animation
    • RLPy.ESaveMotionClipOption_FkMotionOnly: Saves only FK animation
    • RLPy.ESaveMotionClipOption_AllBone: Saves all Bone animations
    • RLPy.ESaveMotionClipOption_ExcludeTransformData: Excludes Transform animation

GetSaveFileOption(self)

Retrieves file-specific options, as configured by SetSaveFileOption().

Returns

See SetSaveFileOption() for details.