View Full Version : How to maintain sets using exported selected to ".mb"?
02-25-2009, 06:42 PM
So the situation is:
I have a collection of poly data.
This poly data is structured up into a collection of sets, for different purposes.
I require to seperate this poly data into seperate maya files base on a master set list.
I require the export to bring the other sets from other partitions that the poly data is listed as being part of.
I find that using export selected - to ".mb" actually takes the poly data for the master set given, but it drops any of the other sets.
Do I need to do something specific or is there some magical unwritten maya knowledge that will enable the sets to be transported to a new scenefiles and not get lost?
I've already had to write a back up system that rebuilds set data that I want to keep but this then requires a maya batch process to rebuild the data once its transfered, but it seems pretty stupid to have to do this?
Any ideas anyone?
02-25-2009, 07:15 PM
are you talking about object set nodes themselves? you may need to use the history flag with export selected, or grab on to the associated set objects just before you export selected-
02-25-2009, 07:59 PM
All nodes must be selected including objectSet nodes.
If there is a hierarchy of objectSets, to maintain that hierarchy, you must select the parent set and all descendant sets.
As long as the objectSet is selected, even if no nodes inside the set are selected, the set will exist in the exported file.
No include flags are necessary.
02-25-2009, 10:43 PM
okay I'll give that a try thanks.
I guess I assumed that by proxy if there was a link from the mesh data to the set then it would all be transfered.
Don't supose you know if it does any automatic pruning of data that may be listed as part of that "root Set" but does not exist in the list of selected poly objects for "selective export"?
02-26-2009, 12:35 AM
Okay so I tried your suggestion, it does not work in Maya 7.0 (unfortunately the version we are using).
Create three cubes
create a set "Ass"
add cubes to set
file -exportSelected -force -type "mayaBinary" "ass";
result - file with three cube and no set called "Ass"
am I missing something here?
02-26-2009, 01:00 AM
Doh yeah of course... its looking right at me, I just didn't see it!
select -noExpand $set;
02-26-2009, 01:30 AM
I run my script through and omit the "exportSelected" call
I just maintain the selection that I am making for the export and the selection is correct its the data I want to go out to the maya file.
I include the "exportSelected" call, I get a maya file, with everything from the orginal scene in it?
I am getting the sets that I want to be transported to the new maya file but now I am getting all the objects from the original file not just the "selected objects".
anyone.. is this a known bug?
02-26-2009, 01:56 AM
I would need to see some code to better understand your error.
Here is a export example. Tested on WinXP and Maya 2009.
This will export selected polygons and maintain all objectSet hierarchy's. No selection of sets is required. Your file needs to be saved, the script uses the current file's scene name for where to save it. It creates a file called "yourSceneName_polyExport.mb".
string $polyData = `ls -sl -dag -ni -type "mesh"`;
string $polyDataTrnsfrms = `listRelatives -p $polyData`;
// Find Connected sets
string $sets = `listConnections -type "objectSet" $polyData`;
string $setsTrnsfrms = `listConnections -type "objectSet" $polyDataTrnsfrms`;
$sets = stringArrayCatenate ( $sets, $setsTrnsfrms );
string $conSet = $sets;
string $currentSet = $sets;
$conSet = `listConnections -d 1 -s 0 -type "objectSet" $currentSet`;
$currentSet = $conSet;
$sets = stringArrayCatenate ($conSet, $sets);
select -r -ne $sets;
select -add $polyDataTrnsfrms;
string $filePath = `file -q -sceneName`;
string $fileNameExt = `file -q -shortName -sceneName`;
string $fileName = `basenameEx $filePath`;
$filePath = substituteAllString($filePath, $fileNameExt , "");
-exportSelected ($filePath + $fileName + "_polyExport.mb");
error "Please save your file.";
error "Please select some mesh objects";
02-26-2009, 06:18 PM
I'll wrap that into a chunk of code and see if I get the correct results.
nothing looks maya 2009 specific there.
Worked perfectly thankyou very much for the assistance with that.
Its seems I was not giving the correct information to the "exportselected".
So "PBKAC".. :)
02-26-2009, 11:41 PM
Its interesting that you have to manually collect the lowest comon demoniators and then work backwards up the tree to make sure you have collected everything you actually need. Before doing the export.
I assumed ,wrongly, that the export selected function would actually do most of this work for you.
02-27-2009, 03:19 AM
Glad to hear that worked!
I guess it has to work that way so you can exclude some connected nodes and include others.
02-28-2009, 12:57 AM
yeah it must be down to the way in which the exporter actually walks the dag trees, thus data gets included that shouldn't be if you take the approach I orginally took.
I guess theres an element of unwritten, not so obvious, Maya'ism in that export selected approach.
03-06-2009, 01:04 AM
Okay so following on from this, on a number of exported pieces I have had no issues and everything is as it should be when I open the exported maya scene, however that being said.
I came across a number of them that seem to have lost their shader connections.
I am not filly understanding why that should be, as they have their connections in the source files and there appears to be no flickering. Maya not knowing what shader is assigned to what and which it should be displaying or confusion between shaders assigned at the object level overiding the face level assignments.. we still see that in maya 7.0 (damn i hope that is fixed in 2009 when we get to it :().
Any ideas on why I should been seeing the shaders being dropped?
I have tried breaking the connections and reconecting the data in the source data but the result is still the same in the exported files.
03-12-2009, 02:14 AM
Is the -shader flag on in the export code? It is off in the code I posted previously.
03-12-2009, 02:14 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.