Bläddra i källkod

Merge pull request #1771 from MackeyK24/master

Master
David Catuhe 8 år sedan
förälder
incheckning
9fb1597bb9

+ 8 - 0
Exporters/Maya/Tools/babylonNameTool.mel

@@ -0,0 +1,8 @@
+global proc babylonNameTool() {
+    string $nameText;
+    string $resultPrompt = `promptDialog -title "Namespace Tool" -message "Remove Namespace:" -button "OK" -button "Cancel" -defaultButton "OK" -cancelButton "Cancel" -dismissString "Cancel"`;
+    if ($resultPrompt == "OK") {
+        $nameText = `promptDialog -query -text`;
+        namespace -mv $nameText ":" -force;
+    }
+}

+ 49 - 0
Exporters/Maya/Tools/babylonReskinTool.mel

@@ -0,0 +1,49 @@
+global proc reskinSelectedMeshes() {
+    $influencers = `intSliderGrp -q -value myReskinInfluencers`;
+    $selection = `ls -sl`;
+    $selected = size($selection);
+    if ($selected > 0) {
+        $skinName = `textFieldGrp -q -text myReskinName`;
+        if ($skinName != "") {
+            $textField_exists = `objExists $skinName`;
+            if ($textField_exists == 0) {
+                waitCursor -state 1;
+                $skinedCluster = $selection[0];
+                $skinnedJoints = `skinCluster -q -inf $skinedCluster`;
+                if ($selected > 1) {
+                    $duplicateObj = `duplicate $selection`;
+                    $createGrp = `group -n tempGroup`;
+                    $combine = `polyUnite -n $skinName $createGrp`;
+                    $deleteHistory = `delete -ch $combine`;
+                    delete $createGrp;
+                } else {
+                    $duplicateObj = `duplicate -n $skinName $selection`;
+                }
+                $jnt = `select -add $skinnedJoints $skinName`;
+                $selectionforBind = `ls -sl`;
+                $newskin = `skinCluster -mi $influencers $selectionforBind`;
+                $newSelect = `select -add $skinnedJoints $selection $skinName`;
+                $transfer = `copySkinWeights -nm -sa "closestPoint" -ia "closestJoint"`;
+                $cleared = `textFieldGrp -edit -text "" myReskinName`;
+                $deleted = `delete $selection`;
+                $deselect = `select -cl`;
+                waitCursor -state 0;
+            } else {
+                error ("Skin name is already in use: " + $skinName);
+            }
+        } else {
+            error "No name specified for re-skining.";
+        }
+    } else {
+        error "No meshes selected for re-skining.";
+    }
+}
+
+global proc babylonReskinTool() {
+    string $window = `window -title "Reskin Geometry Tool"`;
+    columnLayout -adjustableColumn true;
+    textFieldGrp -label "New Skin Name" -text "" myReskinName;
+    intSliderGrp -label "Max Influencers" -field true -minValue 1 -maxValue 20 -fieldMinValue 1 -fieldMaxValue 20 -value 5 myReskinInfluencers;
+    button -label "Reskin Selected Meshes" -command "reskinSelectedMeshes()" myReskinButton; 
+    showWindow $window;
+}

+ 36 - 0
Exporters/Maya/Tools/readme.md

@@ -0,0 +1,36 @@
+=========================================
+BabylonJS: Maya Art Tools
+=========================================
+1. Install Maya art tool scripts (.mel) in your scripts folder.
+   
+   Window Folder:
+   C:\Users\USERNAME\Documents\maya\*VERSION*\scripts
+   
+   Macintosh Folder:
+   ~/Library/Preferences/Autodesk/maya/*VERSION*/scripts
+
+
+===========================
+Add Namespace Tool To Shelf
+===========================
+*** Usage: Remove Unwanted Namespace From All Objects
+1. In Maya open the Script Editor and go to the Mel tab, copy and paste command below:
+########################
+
+babylonNameTool();
+
+########################
+2. Highlight it and click on "Save Script to Shelf...", specify a name ('Names') and click "OK".
+
+
+========================
+Add Reskin Tool To Shelf
+========================
+*** Usage: Reskin and combine selected meshes with new max influencers.
+1. In Maya open the Script Editor and go to the Mel tab, copy and paste command below:
+########################
+
+babylonReskinTool();
+
+########################
+2. Highlight it and click on "Save Script to Shelf...", specify a name ('Reskin') and click "OK".