slider morph settings in python

I’d like to modify morphs using a Python script directly inside Character Creator 5, but I haven’t been able to find any documentation on how to control morph settings through Python. Can anyone help or point me in the right direction?

Hi Vashkaniuwo,

Here is a sample code for getting and setting Morph Sliders in CC5.
Please take a look, and feel free to reach out if you have any questions!

import RLPy

rl_plugin_info = {"ap": "iClone", "ap_version": "8.0"}

def run_script():
    avatar_list = RLPy.RScene.GetAvatars()
    if len(avatar_list) == 0:
        print ("please load a character first.")
        return 
    avatar = avatar_list[0]
    print(avatar.GetName())

    avatar_shaping_component = avatar.GetAvatarShapingComponent()

    # Get all categories
    category_names = avatar_shaping_component.GetShapingMorphCatergoryNames()
    print(category_names)

    # Get all morphs in a specific category
    category = "Actor/Body/Full Body/Character"
    slider_ids = avatar_shaping_component.GetShapingMorphIDs( category )
    slider_names = avatar_shaping_component.GetShapingMorphDisplayNames( category)
    print(slider_ids)    
    print(slider_names)
    for name in slider_names:
        print(name)

    # Set morph weight   
    slider_dict = dict(zip(slider_names, slider_ids))
    slider = slider_dict['Slacker']
    avatar_shaping_component.SetShapingMorphWeight(slider, 1.0)

    RLPy.RGlobal.ObjectModified(avatar, RLPy.EObjectModifiedType_Attribute|RLPy.EObjectModifiedType_Transform)

B.R
Johnny

Hi Johnny,
Thank you very much for your help — your suggestion worked perfectly. I have another question and would appreciate your guidance if you’re familiar with this.
I’m trying to remove the character’s stomach region and replace it with my own custom stomach, but I’d like to perform this operation using Python scripting. Do you know how I can programmatically detect and remove the stomach area so that I can position my custom mesh there?
Or maybe the other solution can be converting my abdomen .obj format mesh to .ccCloth and then apply on the character. But my code did not work for this.
Looking forward to your insights. Thanks again for your help!