DFB - Marina Hair PoppingFix (MEL Script)

mail@pastecode.io avatar
unknown
plain_text
a year ago
3.0 kB
11
Indexable
Never
string $MainHair = "";
string $Sideburns = "";
string $BigBang = "";
string $SmallBangs = "";

// Check if Marina_01_COG_LOC exists
if (`objExists "Marina_01_COG_LOC"`) {
    $MainHair = "Marina_01:ox_groom:GroundStrands21";
    $Sideburns = "Marina_01:ox_groom:GroundStrands22";
    $BigBang = "Marina_01:ox_groom:GroundStrands17";
    $SmallBangs = "Marina_01:ox_groom:GroundStrands18";
}
else {
    print("COG_LOC node not found. No Marina in the scene. She got blown away by the wind! :( \n");
}

select -r $MainHair;
OxAddStrandOperator "" AnimationCacheNode;
rename AnimationCache1 :MainHaircache;
setAttr -type "string" MainHaircache.strandGroupPattern "MainHair";
OxEnableOperator MainHaircache 1;

select -r $Sideburns;
OxAddStrandOperator "" AnimationCacheNode;
rename AnimationCache1 :Sideburnscache;
setAttr -type "string" Sideburnscache.strandGroupPattern "SideburnsStrand";
OxEnableOperator Sideburnscache 1;

select -r $BigBang;
OxAddStrandOperator "" AnimationCacheNode;
rename AnimationCache1 :BigBangcache;
setAttr -type "string" BigBangcache.strandGroupPattern "BigBangStrand";
OxEnableOperator BigBangcache 1;

select -r $SmallBangs ;
OxAddStrandOperator "" AnimationCacheNode;
rename AnimationCache1 :SmallBangscache;
setAttr -type "string" SmallBangscache.strandGroupPattern "SmallBangs";
OxEnableOperator SmallBangscache 1;

string $currentProject = `workspace -q -fn`;

string $cachePath = $currentProject + "/MainHair.abc";
setAttr "MainHaircache.filePath" -type "string" $cachePath;

string $cachePath = $currentProject + "/Sideburns.abc";
setAttr "Sideburnscache.filePath" -type "string" $cachePath;

string $cachePath = $currentProject + "/BigBang.abc";
setAttr "BigBangcache.filePath" -type "string" $cachePath;

string $cachePath = $currentProject + "/SmallBangs.abc";
setAttr "SmallBangscache.filePath" -type "string" $cachePath;

string $allObjects[] = `ls -dag -type transform`;

for ($obj in $allObjects) {
    hide $obj;
}

// Create a progress bar UI
window -title "Progress" -widthHeight 300 100 progressWin;
columnLayout -adjustableColumn true;
text -label "Progress:";
progressBar -width 280 -minValue 0 -maxValue 100 -progress 0 progress;
showWindow;

// Simulate cache operations and update progress
string $caches[] = {
    "MainHaircache",
    "Sideburnscache",
    "BigBangcache",
    "SmallBangscache"
};

int $completion[] = {20, 40, 60, 80, 100};

for ($i = 0; $i < size($caches); $i++) {
    OxRecordAnimation $caches[$i];
    progressBar -edit -progress $completion[$i] progress;
    refresh;
    pause -sec 1;
}

// Close the progress bar UI
deleteUI progressWin;

string $allObjects[] = `ls -dag -type transform`;

for ($obj in $allObjects) {
    showHidden $obj;
}


string $message = "Marina just finished going to the Salon. Now, back to reporting the weather!";
string $title = "Cache Complete";
confirmDialog -title $title -message $message -button "OK";