Creating new morph channels with script

Hi,

I've been playing around on an idea of creating new morph channels on the fly, much like Poser's PMD files do. Sadly the PMD plugin AFAIK died off as of DS 4. I think I'll give it a shot using a script.

As a test, I setup/modify Victoria 4 cr2 file to add a channel to accept one of NGM morph, and compare it to a plain Victoria 4 with the same channel created by script.

As far as my test go, it seems that when loaded to DS4.9, only the root object (DzSkeleton) has a DzObject. All other bodyparts doesn't have DzObject. All the morphs/magnets loaded (like Morph++) has a corresponding DzModifier contained in the root's DzObject. All of them has the name/label with "MorphChannelName_BodyPartName" format, i.e. "FBMVoluptuous_chest". In closer inspection, the DzModifiers will have 1 DzFloatProperty with the same name of the DzMorph, and path with "/Morphs/Imported/[BodyPartName]" format, i.e. "/Morphs/Imported/chest". Setting several of the default morphs property hidden flag to false will cause those morphs listed in V4's BODY part in the "Morphs/Imported" group. With the editor's parameters tab in edit mode, such morphs will have an "M" icon in front of it.

image

All those familiar morphs in the "Morphs | Shapes" group have a corresponding DzFloatProperty in their respected DzNode. However, with the parameters tab in edit mode those morphs will have a "P" icon in front of it.

image

Curiously, if I select a bodypart other than root, the icon in front of the morphs is "A" instead of "P".

image

Upon opening the parameter settings, I found that the "P" and "A" will refer to the "M" in the root. With that info, I wrote this script

// DAZ Studio version 4.9.1.30 filetype DAZ Scriptvar oRootNode  = Scene.getSelectedNode( 0 ).getSkeleton();var oObject    = oRootNode.getObject();// Create new morphvar oMorph = new DzMorph;oMorph.setName( "NGM_0_chest" );oMorph.setLabel( "NGM_0_chest" );// Create new property to replace the one already existvar oMorphProp = new DzFloatProperty( "NGM_0_chest", true, false);oMorphProp.setLabel( "NGM_0_chest" );oMorphProp.setPath( "/Morphs/Imported/chest" );oMorph.insertProperty( 0, oMorphProp);// Add modifier to rootoObject.addModifier( oMorph );// Create new property for the root nodevar oNewProp = new DzFloatProperty( "NGM_0", true, false);oNewProp.setPath( "/Morphs | Shapes/NGM_V4" );oObject.addProperty( oNewProp );

Running the script to a plain V4 will a new "M" parameter in "/Morphs/Imported/chest" as well as a "P" parameter in "Morphs | Shapes/NGM_V4". However, after injecting the morph data from the PZ2 file, the sliders of those 2 new parameters / morphs don't have effect. In contrast, if I use the cr2 where the corresponding channel already edited in, sliding "M" parameter do have effect / the morph works.

How can I fix this problem?

THX

001.png
135K
002.png
157K
003.png
117K
004.png
300 x 437 - 94K

Comments

  • M = Morph

    P = Parameter

    A = Alias

    You need to remember that while in the Poser fiel the morph really does belong to a body part once the item is imported and converted for DS the morph belongs to the shape, and a slider is automatically added to the figure node linked to the modifier on the shape - the Alias is created so there's still a parameter on the body part as there was in the Poser version. I'm not sure that you even need to create the float slider on the figure node, but if you do it's probably necessary to create an ERC link to the actual modifier.

    The standard way to add morphs to a Victoria 4 style figure is via ExP, like the daz morph sets, and DS does havea  tool - the ExP Exporter - to facillitate that.

Sign In or Register to comment.