I want to find all morphs for Genesis 8.1 Female
Below is my code my it not working
// Function to find a modifier by its label
function findModifierByLabel(node, label) {
var modifiers = node.getModifiers(); // Get all modifiers for the node
for (var i = 0; i < modifiers.length; i++) {
var mod = modifiers[i];
if (mod.getLabel() === label) {
return mod; // Return the modifier if the label matches
}
}
return null; // Return null if no modifier with the label is found
}
// Function to adjust the crotch height to a target value
function adjustCrotchHeightToTargetValue(node) {
var mod = findModifierByLabel(node, "Height"); // Adjust the label as needed
if (mod) {
print("Modifier found: " + mod.getLabel());
// You can now perform operations on the found modifier
// Example: mod.getValueChannel().setValue(targetValue);
} else {
print("Modifier with the specified label not found.");
}
}
// Main script
var genesis8Female = Scene.findNodeByLabel("Genesis 8.1 Female");
if (genesis8Female) {
adjustCrotchHeightToTargetValue(genesis8Female);
} else {
print("Genesis 8.1 Female node not found.");
}
The error says
Executing Script...
Script Error: Line 3
TypeError: Result of expression 'node.getModifiers' [undefined] is not a function.
Stack Trace: ()@:3
Error executing script on line: 3
Script executed in 0 secs 2 msecs.
Comments
Is this actually code you have written or AI-generated? Have you looked at thes ample scripts on handling morphs and other modifiers?