dairin0d / export-selected

Adds an option to Blender to export only selected objects
36 stars 11 forks source link

[Q]I would like to use the export blend part for a rigify add #8

Closed schroef closed 6 years ago

schroef commented 6 years ago

Hi Darinod,

i would like to use the part for exporting a selection to Blend file. Im trying to add a section to the rigify addon so users can make presets of their base rigs. Than load these using a simple drop-down menu.

Is this okay with you, ill fully give credit to you in the code for that part.

dairin0d commented 6 years ago

Sure, go ahead :-)

schroef commented 6 years ago

Cool thanks, i already looked at it, yet i have some issue because of dont add all data types in the operator. So i called it using a separate operator, but than it adds that as a line as well? I need to figure out how i can get around this. I also tried the standard preset save option, though this works. It some how needs hardcoded values or atleast i dont understand how i can pass a set into it. Need to some more studying of python i guess.

I eventually went with a super simple version of your code, still need to figure out how to export selection only for a blend file. I believe you delete everything and than do undo steps. But how do you get around all the texture files, world files etc etc or is that done with the filtering options?

dairin0d commented 6 years ago

Um... I don't quite understand what exactly you're talking about in "dont add all data types in the operator. So i called it using a separate operator, but than it adds that as a line as well?"

Yes, I basically just delete everything and perform an undo after the export. What do you mean by "get around all the texture files, world files etc"? If you're talking about the removal of unused datablocks (textures, materials, etc.), I don't do that manually (it was causing Blender to crash for some users). On the other hand, Blender has bpy.data.libraries.write(), which saves only the objects/datablocks you provide to this function (as well as the datablocks they depend upon). The only drawback is that .blend files saved with this method don't have thumbnail pictures.

schroef commented 6 years ago

Sorry i was confusing a different addon for that part about the operator :)

But how do are excluding data which is not used by the object in the blend file than? Or doesnt the addon delete these?

EDIT i see know, i did a quick test. It also saves other data like world and linked textures and such

dairin0d commented 6 years ago

Yep :-) Are all your questions answered, then?

schroef commented 6 years ago

I ended up using python file export, used part of the build method from bender and also use part of the rigify options as well. You can have a look at https://github.com/schroef/rigify if you like, if you use rigify

dairin0d commented 6 years ago

Cool :-)