MoBu: Character Extensions SDK setup issue

Hi,

I’m trying to setup Character Extensions in MotionBuilder using the SDK. I’ve followed a sample distributed with MotionBuilder, but get a different result than when setting them up by hand.

When setting up by hand, object reference and object labels are added as Custom attributes. Through script they are not.

Setup by hand:

Also when setting up through the SDK, you get double entries for property references, if you follow the Python samples:

char_extensions = FBCharacterExtension()
char_extension.AddObjectDependency(model)
char_extension.AddObjectProperties(model)

Setup with SDK:

Omitting .AddObjectProperties(model) means at least the double references are gone and things seem to still work the same.

char_extensions = FBCharacterExtension()
char_extension.AddObjectDependency(model)

One issues with with extensions setup with the SDK, is that that they do not mirror, at least not with the pose system.

Any guidance would be great!

P.S. I also posed about this on The Area - but man that place is dead… I figured all the cool kids must be hanging out here :slight_smile:

This is a really good observation. Is the only negative affect you’ve seen so far the Mirror Pose not working? Do the extensions otherwise seem to function properly?

Not sure if this is the issue, but try adding the extension to the character before adding the object dependency to the extension.

        extension = FBCharacterExtension(extensionName)
        character.AddCharacterExtension(extension)
        extension.AddObjectDependency(extensionObj)

I seem to remember something about the order here being important…

Ah yes, that’s it. I was attaching to the character by setting the ‘Attached Character’ property manually. But I swapped in using the AddCharacterExtension method and now it looks like it’s working correctly. Thanks!

Yeah, mirroring is the only thing that I’ve noticed not working.

Thanks a lot, unfortunately that did not fix it.

I finally got my Subscription Support re-enabled, so I’m going to run it by them. I’ll let you know what I find.

For mirroring, you probably need to set the ReferenceModel:

extension.ReferenceModel = refNode

Setting the reference results in a popup to update the stance pose.

For the green label in the custom properties, I have code that looks like this to set it:

ctrlLabelPropertyList = extension.PropertyList 
for p in ctrlLabelPropertyList:
    if p.Name == extensionObjName + '.Label':
        p.Data = "SomeLabel"

I don’t know if there’s a good reason I’m not doing a .Find to get this label…

I’m already setting the reference model, extensions label and object labels for mirroring (the pictures in my original post don’t reflect my scripted results), but unfortunately I don’t get the “Green properties” or mirroring working. Here is my code:

def create_character_extension(model):

    object_extensions_labels = {
        'L_Hand_Attacher': 'Hand_Attacher',
        'R_Hand_Attacher': 'Hand_Attacher'}

    mirror_partners = {
        'L_Hand_Attacher': 'R_Hand_Attacher',
        'R_Hand_Attacher': 'L_Hand_Attacher'}

    parent_overrides = {
        'Ground': FBSystem().Scene.Characters[0].GetModel(FBBodyNodeId.kFBHipsNodeId)}

    char_extension = FBCharacterExtension('%s_Ext' % model.Name)

    if model.Name in parent_overrides:
        char_extension.ReferenceModel = parent_overrides[model.Name]

    elif model.Parent:
        ref_Object = model.Parent
        char_extension.ReferenceModel = ref_Object

    # TODO: Figure out if we need these?
    char_extension.AddObjectDependency(model)
    #char_extension.AddObjectProperties(model)

    FBSystem().Scene.Characters[0].AddCharacterExtension(char_extension)

    if model.Name in object_extensions_labels:
        char_extension.PropertyList.Find('%s.Label' % model.Name).Data = object_extensions_labels[model.Name]

    if model.Name in mirror_partners:
        for index in range(len(FBSystem().Scene.CharacterExtensions)):
            if mirror_partners[model.Name] in FBSystem().Scene.CharacterExtensions[index].Name:
                char_extension.MirrorLabel = int(index) + 2

Thanks again for the suggestions :slight_smile:

Ok. Two things that maybe you could try.
Reorder so that the first thing you do after creating the extension is AddCharacterExtension. Like this:

def create_character_extension(model):

    object_extensions_labels = {
        'L_Hand_Attacher': 'Hand_Attacher',
        'R_Hand_Attacher': 'Hand_Attacher'}

    mirror_partners = {
        'L_Hand_Attacher': 'R_Hand_Attacher',
        'R_Hand_Attacher': 'L_Hand_Attacher'}

    parent_overrides = {
        'Ground': FBSystem().Scene.Characters[0].GetModel(FBBodyNodeId.kFBHipsNodeId)}

    char_extension = FBCharacterExtension('%s_Ext' % model.Name)
    FBSystem().Scene.Characters[0].AddCharacterExtension(char_extension)

    if model.Name in parent_overrides:
        char_extension.ReferenceModel = parent_overrides[model.Name]

    elif model.Parent:
        ref_Object = model.Parent
        char_extension.ReferenceModel = ref_Object

    # TODO: Figure out if we need these?
    char_extension.AddObjectDependency(model)
    #char_extension.AddObjectProperties(model)

    if model.Name in object_extensions_labels:
        char_extension.PropertyList.Find('%s.Label' % model.Name).Data = object_extensions_labels[model.Name]

    if model.Name in mirror_partners:
        for index in range(len(FBSystem().Scene.CharacterExtensions)):
            if mirror_partners[model.Name] in FBSystem().Scene.CharacterExtensions[index].Name:
                char_extension.MirrorLabel = int(index) + 2

At the end of my script I have this, which may or may not make a difference:

FBSystem().Scene.Evaluate()
extension.UpdateStancePose()

Whoops, just saw that you already tried the re-order.

Whoa, making those changes, my character blows up when applying animation through story (though the stance looks ok) :slight_smile: I really appreciate it though, getting MotionBuilder sdk help is a truly rare thing.

I think I’m just going to wait it out and see what Subscription comes back with. I’ll make sure to post my working (hopefully) code here.

Soooo… Turns out there is a bug in MotionBuilder and a bug with my testing!

The mirroring issue is not caused by setting up Character Extensions with the SDK vs. by hand, but rather by using the 2014 Character Solver. Move to a previous solver and mirroring works a treat. Sorry about any confusion :p:

The HIK solver is extremely broken in the last few versions of mobu. It looks like they might have fixed some issues in 2014, but I would always use the MB solver.

Sune, that is terrible and also why my file for my current rig update wouldn’t work, bahhh!!! Tarcus, I would 99% of the time say use MB solver but that solver is no longer getting the love, HIK is and with all the fixes to it I have been !!!TRYING!!! to use it more as I have found diffrent issues with the MB solver that are fixed now in the HIK solver. Until they release a service pack/hot fix for Mobu 2014 I guess we are stuck back on the MB solver if you want extensions to work. One step forward, 10 back…

Honestly we have never had extensions setup on our characters before now, so even if extension mirroring is broken when pasting poses, technically we would not be at a loss. That said, it should of course work:-)

I’m pretty interested in hearing about specific issue you might have had with the 2014 solver (or 2013 so we can check if they work in 2014)?

Regarding a Service Pack, I would not hold out for one, seeing as the release of service packs and extensions for all the other packages at the traditional time has come and gone…

Well I stayed away from HIK in 2013, and only started trying to rely on HIK in 2014, but between some handle issues and now maybe extension issues, I need to double check and confirm I am seeing the something and it isn’t a diffrent but. I am not going to let up on service pack :slight_smile: