Export Selected Object Only
GeneralDee
Posts: 132
in New Users
I have a scene that is getting complex and I want to export certain items into Blender to make fitted props/attachments for them. I tried exporting an item but everything in the scene ended up in Blender. In most 3D programs we have an option to export only what is selected in the scene. Is this possible with Daz? How can this be achieved?
Comments
By default only visible items are exported, so seelct the stuff you want and invert the selection (I think there is, by default, a Select sub-menu with the Invert Selection command, if not it's in the Scene pane option menu reached by the lined button in the top corner) or directly select the items you don't want, whichever is simpler, then in the Parameters pane go to the Display group and click off the Visible button to hide the unwanted items. Do the export, then undo the hiding.
I think that as of right now, the only way is to hide everything you do not want to export and leave what you want to export unhidden.
Selexted only export would be a very nice feature to have in upcoming DS versions! : )
Already possible via script (http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/file_io/export_obj_silent/start) since 4.5.0.114.
Thanks for the help everyone!
@Chhole Thanks, How do I use that script?
: In the script you will see several lines that start with "oSettings.setBoolValue(". Most of these lines set values for settings that correspond to options in the OBJ export dialog. There are additional settings that can be set, which are not exposed in the dialog. One such setting, the one you are interested in, is the "SelectedOnly" (and perhaps "SelectedRootsOnly") setting. Change the "false" value to "true" to enable the setting. The script has a comment above nearly every line. Read those to help you understand what each line does.
---
Save the script to a file by clicking the linked title of the script.
---
Running the script is the same as any other piece of content in Daz Studio. A custom action can be created to place it in menus and/or toolbars.
Thank You! I will try it.
Uodate: I changed those values to true and saved the dsa file. I ran the script but the whole scene is still exporting. What am I missing? Was there supposed to be a new option in the dialog?
No, the script options will override the options from the dialogue (to set the Poser options) and then, if you make the edit Chohole advised, will limit the export to the selected items. You can make the script run entirely silently, or with only a filename prompt, or you can comment out (put /* in fron and */ after) the sections setting the properties set by the dialogue and just have the script handle the selected item options (as described in the comments).
It works like a dream. Thanks for the advice and discussion! ;)
Hello...
I have used this script, changed in TRUE like the image...
but nothing...
When I export in obj I can read the name of the object selected, but when amount in Max, I have all objects that I have visible in Daz3D :(
this is probably not available in DS1, DS2 and DS3 but under the current DS4 there's a setting called SelectedOnly
<Settings>
<Setting Type="Bool" Key="IgnoreInvisible">yes</Setting>
<Setting Type="Bool" Key="SelectedOnly">no</Setting>
so updating code by Bob Whisenant for the 2000's
this should work
//=============================================== // ExportObj Was written by Rob Whisenant. //=============================================== function ExportObj( objFilename, scale, bWriteMtl, bCollectMaps ) { var mgr = App.getExportMgr(); var exporter = mgr.findExporterByClassName( 'DzObjExporter' ); var settings = new DzFileIOSettings(); exporter.getDefaultOptions( settings ); settings.setStringValue( 'Preset', 'Custom (1 unit = 1cm)' ); settings.setStringValue( 'Scale', scale ); settings.setBoolValue( 'SwapYZ', false ); settings.setBoolValue( 'IgnoreInvisible', true ); settings.setBoolValue( 'WeldSeams', true ); //<========= figures welded settings.setBoolValue( 'WriteO', false ); settings.setBoolValue( 'WriteG', true ); settings.setBoolValue( 'GroupNodes', false ); settings.setBoolValue( 'GroupSurfaces', false ); settings.setBoolValue( 'GroupSingle', true ); //<========= figures welded settings.setBoolValue( 'GroupGeom', false ); settings.setBoolValue( 'WriteVN', true ); settings.setBoolValue( 'WriteVT', true ); settings.setBoolValue( 'WriteUsemtl', true ); settings.setBoolValue( 'WriteMtllib', bWriteMtl ); settings.setBoolValue( 'CollectMaps', bCollectMaps ); settings.setBoolValue( 'ConvertMaps', false ); settings.setBoolValue( 'RemoveUnusedVerts', false ); settings.setIntValue( 'RunSilent', 1 ); settings.setBoolValue( 'SelectedOnly', true ); exporter.writeFile( objFilename, settings ); }
and i'm adding an image because it's all about images !
the script i used to obtain the list of settings
Ah, Chohole, your star shines ever brighter. Thanks for this pointer and the notes on how to tailor it into "export selected". Cheers, Lx
You're welcome but it is Rob that you should thank. He supplies the info, I just pass it on
Still need this in 4.12.
I have a scene with 1000's of objects and I need to quickly export a handful in postion, edit them, and then import back in postion.
I have customized the export and imports setting as the Blender settings are not ideal by default.
I also have everything organized in groups in daz, but visibilty doesnt effect parented children nodes.
Short of a Blender bridge. A selected only export option would save time, hassel, relieve stress of possible crashing, lost work, and corrupt data when making a huge scene disappear and reappear over and over using the "Hidden" Properties option.
2020 Solution.
Select the item you want to export.
Go to file - > export. Choose the extension (obj or fbx) and type the file name. After you hit save, the export options window will appear. Select the following options in that window:
For obj, check the option "filter objects"
For fbx, check the item "selected" and the item "prop" OR "figure". For example, If you want to export a geneses asset, select figure. if you want to export an environment prop, select prop.
If you are still getting unwanted objects in your exported file, try to unparent the object before exporting and make sure that you have selected only the things you want to export.