# Smart content Manager Template in Wiki IC_8_Python_API:Smart_Content_Manager
# Version with Error correction
# (folder = def_folder = default_content_folder)
import os
from os import listdir
from os.path import isfile, join
import RLPy, math, winreg
from random import *
import PySide2
from PySide2 import *
global ap_version, ic_template_path
# for iClone or Character Creator
rl_plugin_info = { "ap": "Any", "ap_version": "Any" }
from shiboken2 import wrapInstance
QtCore.QStringListModel
# get content folder recursively
def get_all_content_folders(_folder, all_content_folders):
content_folders = RLPy.RApplication.GetContentFoldersInFolder(_folder)
for sub_folder in content_folders:
all_content_folders.append(sub_folder)
print("sub_folder :"+sub_folder)
get_all_content_folders(sub_folder, all_content_folders)
# Get the default content folder
content_key = RLPy.ETemplateRootFolder_Character
def_folder = RLPy.RApplication.GetDefaultContentFolder(content_key)
print(def_folder)
default_content_folder=def_folder
# $/Actor/Character
# Get particle content folder
all_content_folders = []
get_all_content_folders(default_content_folder, all_content_folders)
# $/Actor/Character/ActorCore Crowd/, $/Actor/Character/ActorCore/...
# Get all files for the folder in all_content_folders:
real_files = RLPy.RApplication.GetContentFilesInFolder(def_folder)
for files in real_files:
print("files :"+files )
# C:/Users/Public/Documents/Reallusion/Reallusion Templates/Actor/Character/ActorCore/Kevin actorBuild.iAvatar