@@ -783,6 +783,13 @@ proc string createTextFieldWithLabel(string $label, string $parent)
783
783
}
784
784
785
785
proc createExportSetDialog(int $exportType){
786
+ $origSelection = `ls -sl`;
787
+ if(size($origSelection) <= 0){
788
+ // nothing selected
789
+ print ("Nothing selected");
790
+ return;
791
+ }
792
+
786
793
$exportAnim = false;
787
794
$exportAnimOnly = false;
788
795
switch($exportType){
@@ -803,9 +810,27 @@ proc createExportSetDialog(int $exportType){
803
810
string $container = `formLayout -numberOfDivisions 100`;
804
811
805
812
string $mainOptions = `columnLayout -adjustableColumn true -p $container`;
813
+
814
+ // go through selection to find common namespace to set as default
815
+ string $commonNamespace = ":";
816
+ int $maxNamespaceCount = 0;
817
+ for($i = 0; $i < size($origSelection); $i++){
818
+ string $currNamespace = getObjectNamespace($origSelection[$i]);
819
+ while ($currNamespace != ":"){
820
+ // get contents of namespace
821
+ string $namespaceContents[] = `namespaceInfo -ls $currNamespace`;
822
+ string $intersection[] = getIntersection($origSelection, $namespaceContents);
823
+ if(size($intersection) > $maxNamespaceCount){
824
+ $commonNamespace = $currNamespace;
825
+ $maxNamespaceCount = size($intersection);
826
+ }
827
+ $currNamespace = `namespaceInfo -p $currNamespace`;
828
+ }
829
+ }
806
830
807
831
// get namespace
808
832
string $namespaceField = createTextFieldWithLabel("Unity FBX namespace", $mainOptions);
833
+ textField -e -text $commonNamespace $namespaceField;
809
834
810
835
string $modelFilePath = " 0 0";
811
836
if(!$exportAnimOnly){
@@ -942,13 +967,6 @@ global proc unityExportModelAnim(){
942
967
}
943
968
944
969
global proc unityCreateExportSet(){
945
- $origSelection = `ls -sl`;
946
- if(size($origSelection) <= 0){
947
- // nothing selected
948
- print ("Nothing selected");
949
- return;
950
- }
951
-
952
970
global int $UnityExportModelAnim;
953
971
createExportSetDialog($UnityExportModelAnim);
954
972
}
0 commit comments