Use D-Former Weight Map via script for morph attenuation?
I have a script that loads an OBJ morph using silent mode, and it works correctly.
What I’d like to do now is limit the morph so that it only affects the head, without influencing the body.
When doing this manually in Morph Loader Pro, I can achieve the effect by setting:
Attenuate By → Weight Maps → D_Former_1 → Influence Weights,
which then appears in the dialog as:
D-Former_1::weightmap::Genesis 9/Influence Weights
I’m already creating and applying the D-Former to my Genesis 9 figure beforehand, using the G9 HeadSplit DFormer tool that comes with Daz Studio (which separates head and body morphs).
However, when trying to reproduce the same behavior via script, I can’t seem to make it work.
I can’t find any way to access the DzWeightMap object through code.
Problem:
-
dform.getWeightMap()→ undefined is not a function -
The “Influence Weights” map doesn’t appear as a separate
obj.getModifier(i) -
It works fine in the UI (Attenuate By → D-Former_1::weightmap::Genesis 9/Influence Weights)
-
But in scripting, I can’t locate the DzWeightMap object
Question:
How can I access the DzWeightMap from a D-Former created with G9 HeadSplit so I can use it with morphLoader.setAttenuateBy()?
Any help would be greatly appreciated. Thanks!
Cheers,
Martha

Comments
The influence weights are not a modifier, they belong to the dForm modifier (which I assume you can get, but maybe that is what you are already using and having fail in the dform.getWeightMap() step).
Hey Richard. Thank you very much for the reply.
Specific issue in DAZ Studio 4.24:
var figure = Scene.getPrimarySelection();
var obj = figure.getObject();
var dformerModifier = obj.getModifier(0); // DzDFormModifier
var dform = dformerModifier.getDForm(); // Returns DzDForm
print(dform); // OK: [object DzDForm]
print(typeof dform.getWeightMap); // ERROR! Result: "undefined"
Exact error:
getWeightMap() does not exist as a method on DzDForm (version 4.24)
dform.getWeightMap() → TypeError: undefined is not a function
Available properties on DzDForm:
When iterating dform.getPropertyList(), I only get transformation properties (XTranslate, YTranslate, etc.) and "Display Weights", but not the influence map.
How do you access Influence Weights from DzDForm in DAZ Studio 4.24 if getWeightMap() is unavailable? Is there an alternative method?
Additional context:
Using G9 HeadSplit DFormer tool previously
UI works perfectly (Morph Loader Pro/Attenuate By/D-Former_1::weightmap::Genesis 9/Influence Weights
Need the object for morphLoader.setAttenuateBy(weightMap)
var wtMap = dformerModifier.getInfluenceWeights(); // DzWeightMap
As per DzDFormModifier::getInfluenceWeights()
Thank you for your help! Your solution to get the weight map works perfectly.
Progress made:
var dformerModifier = obj.getModifier(0); // DzDFormModifier
var weightMap = dformerModifier.getInfluenceWeights(); // Returns valid DzWeightMap
Current issue: The morph is created but affects the entire figure (head + body) instead of being limited to the head.
var weightMapPath = "D-Former_1::weightmap::Genesis9/Influence Weights";
oMorphLoader.setAttenuateMapPath(weightMapPath);
oMorphLoader.createMorph(settings, figure, true);
The morph is created successfully. No attenuation applied (affects whole figure) and no console errors
Is setAttenuateMapPath() the correct method to apply attenuation? Or is there an alternative class like DzFittedMorphLoader for this purpose?
Thanks again for your help.
I'm glad that helped. But I've never used DzMorphLoader in script, so you know a lot more about that than I do :)
There may be a problem with the specification of weightMapPath, but that's a pure guess on my part.
Good luck!
Thanks a lot for your help, Praxis. I really appreciate it.
I believe it’s possible, as I’ve seen some other commercial scripts that do exactly that. I’ll keep trying, and if I find a solution, I’ll update this thread.
Cheers,
Martha
Hi Richard,
Do you know if there is any documentation or any samples that could help me with this?
Thanks a lot in advance.
Possibly, but I couldn't think of it when replying. Sorry.