IC 8 Python API:Smart Content Manager

From Reallusion Wiki!
Jump to: navigation, search
Main article: iC8 Python API.

In order to share folders and integrate shared content between iClone and Character Creator and avoid repeated downloads that waste storage space, the Content Manager of iClone 8 uses a database to manage the user's Content. Keep in mind that RLPy.RApplication.GetTemplateDataPath() cannot obtain the absolute path of the template directory, instead, the database needs to be queried to get the correct path. This means you'll have to feed the proper content type key into RLPy.RApplication.GetDefaultContentFolder() to obtain the relative path of the template directory, or use RLPy.RApplication.GetCustomContentFolder() to obtain the relative path of the custom directory

See the section below on Content Type Keys for an enumeration of the possible values. 

Finally, you'll need to use RLPy.RApplication.GetContentFoldersInFolder() to obtain the relative path of the subdirectory under it, and use RLPy.RApplication.GetContentFilesInFolder() to obtain the actual path of the file. The procedure is as follows:

 1 # get content folder recursively
 2 def get_all_content_folders(_folder, all_content_folders):
 3     content_folders = RLPy.RApplication.GetContentFoldersInFolder(_folder)
 4     for sub_folder in content_folders:
 5         all_content_folders.append(sub_folder)
 6         print("sub_folder :"+sub_folder)
 7         get_all_content_folders(sub_folder, all_content_folders)
 8 
 9 # Get the default content folder
10 content_key = RLPy.ETemplateRootFolder_Character
11 def_folder = RLPy.RApplication.GetDefaultContentFolder(content_key)
12 print(def_folder)
13 # $/Actor/Character
14 
15 # Get particle content folder
16 all_content_folders = []
17 get_all_content_folders(default_content_folder, all_content_folders)
18 # $/Actor/Character/ActorCore Crowd/, $/Actor/Character/ActorCore/...
19 
20 # Get all files for the folder in all_content_folders:
21     real_files = RLPy.RApplication.GetContentFilesInFolder(folder)
22     for files in real_files:
23         print("files :"+files )
24 # C:/Users/Public/Documents/Reallusion/Reallusion Templates/Actor/Character/ActorCore/Kevin actorBuild.iAvatar

Content Type Keys

The possible content type values are enumerated below:

# Project
ETemplateRootFolder_Project

# Character
ETemplateRootFolder_Character    
ETemplateRootFolder_AvatarControl
ETemplateRootFolder_FacialProfile    
ETemplateRootFolder_Teeth
ETemplateRootFolder_Eye        
ETemplateRootFolder_Face
ETemplateRootFolder_RLHead    
ETemplateRootFolder_Oral
ETemplateRootFolder_Upper        
ETemplateRootFolder_Lower

# Avatar Preset
ETemplateRootFolder_FullBodyMorphSkin    
ETemplateRootFolder_HeadMorphSkin
ETemplateRootFolder_FullBodyMorph    
ETemplateRootFolder_BodyMorph
ETemplateRootFolder_HeadMorph    
ETemplateRootFolder_AvatarPresetEyelash
ETemplateRootFolder_Nail

# Skin
ETemplateRootFolder_Overall    
ETemplateRootFolder_FullSkin
ETemplateRootFolder_SkinBase    
ETemplateRootFolder_NormalEffects
ETemplateRootFolder_SkinDetails    
ETemplateRootFolder_Blemish
ETemplateRootFolder_Acquired    
ETemplateRootFolder_BodyHair
ETemplateRootFolder_Nails        
ETemplateRootFolder_SkinGenTools

# Makeup
ETemplateRootFolder_FullMakeup    
ETemplateRootFolder_FoundationMakeup
ETemplateRootFolder_EyeMakeup    
ETemplateRootFolder_MakeupEyelash
ETemplateRootFolder_LipMakeup    
ETemplateRootFolder_Eyebrow
ETemplateRootFolder_Miscellaneous
ETemplateRootFolder_MakeupSkinGenTools

# Hair
ETemplateRootFolder_Style        
ETemplateRootFolder_Group
ETemplateRootFolder_Element

# Cloth
ETemplateRootFolder_Underwear    
ETemplateRootFolder_Shirts
ETemplateRootFolder_Pants        
ETemplateRootFolder_Skirts
ETemplateRootFolder_Coats        
ETemplateRootFolder_FullBody
ETemplateRootFolder_ClothOthers    
ETemplateRootFolder_Gloves
ETemplateRootFolder_Shoes

# Accessory
ETemplateRootFolder_Head        
ETemplateRootFolder_Torso
ETemplateRootFolder_Arm        
ETemplateRootFolder_Leg
ETemplateRootFolder_AccessoryOthers

# Animation
ETemplateRootFolder_MotionPlus    
ETemplateRootFolder_Motion
ETemplateRootFolder_Expression    
ETemplateRootFolder_Gesture
ETemplateRootFolder_Pose        
ETemplateRootFolder_MotionDirector
ETemplateRootFolder_Persona    
ETemplateRootFolder_iAnimation

# Stage
ETemplateRootFolder_LightRoom    
ETemplateRootFolder_Atmosphere
ETemplateRootFolder_Camera    
ETemplateRootFolder_Light
ETemplateRootFolder_PostEffect    
ETemplateRootFolder_ImageLayer
ETemplateRootFolder_Scene3D    
ETemplateRootFolder_Material
ETemplateRootFolder_MaterialPlus    
ETemplateRootFolder_Background2D
ETemplateRootFolder_Texture

# Stage/Texture
ETemplateRootFolder_Diffuse    
ETemplateRootFolder_Opacity
ETemplateRootFolder_Bump        
ETemplateRootFolder_Glow
ETemplateRootFolder_Reflection    
ETemplateRootFolder_Specular
ETemplateRootFolder_Blend        
ETemplateRootFolder_Displacement
ETemplateRootFolder_IBL        
ETemplateRootFolder_WeightMap
ETemplateRootFolder_Metallic    
ETemplateRootFolder_Roughness
ETemplateRootFolder_AO        
ETemplateRootFolder_LensFlare
ETemplateRootFolder_IES        
ETemplateRootFolder_IMDL

# Set
ETemplateRootFolder_Tree        
ETemplateRootFolder_Grass
ETemplateRootFolder_Particle    
ETemplateRootFolder_Terrain
ETemplateRootFolder_Water        
ETemplateRootFolder_Sky
ETemplateRootFolder_MotionPath

# Props
ETemplateRootFolder_Props

# Media
ETemplateRootFolder_Sound    
ETemplateRootFolder_Video

# Other
ETemplateRootFolder_Digital_Human_Shader_Resource
ETemplateRootFolder_SSS_Shader_Resource
ETemplateRootFolder_Spring
ETemplateRootFolder_LuaScript

# Profile
ETemplateRootFolder_MotionPuppet    
ETemplateRootFolder_FacePuppet
ETemplateRootFolder_SubstancePreset    
ETemplateRootFolder_ContentPatch
ETemplateRootFolder_SpringProfile