soupday / CC3-Blender-Tools-Plugin

Python plugin for CC3 3.44 to re-import character exports from CC3_Blender_Tools auto-setup add-on.
GNU General Public License v3.0
31 stars 11 forks source link

API for character creator 3 #4

Open alter-sachin opened 2 years ago

alter-sachin commented 2 years ago

Hello, Is there a python API for cc3 to script the program?

jonomafi commented 2 years ago

Hi @alter-sachin ive managed to just barely scratch the surface by inspecting modules in the pyd that comes shipped with CC3 and also noticed there's a bunch of similarities between CC3 and IClone (which is documented a little here). Hope that helps, ive been able to do a little, like navigate the objects in my cc3 scene, but not a whole lot beyond that. Wanting to see how to access the morph sliders.

import RLPy

avatar = RLPy.RScene.FindObject( RLPy.EObjectType_Avatar, "MyAvatarName" )

# dir helps find functions on the class
print(dir(avatar))

morph_component  = avatar.GetMorphComponent()

print(avatar.GetMeshNames()) (Used this to get mesh names)

morph_names = morph_component.GetMorphNames("CC_Base_Body")
print(f'morph_names: {morph_names}')  # This wont work, just returns empty array. But just showing an example of what you can do

Interestingly there were no morph targets on any piece of mesh!! So i think im looking in the wrong direction. Anyway hope this helps your research if @soupday has any pointers that would be really useful :)

mertakbal commented 1 year ago

I want to ask the same question. I am trying to batch process over 20 .fbx models with a python script. Unfortunately I can not access bpy.ops.cc3.importer or bpy.ops.cc3.exporter in my script. I don't know which arguments they will take. Can anyone help me further?