i've been trying to export all objects from blender 2.80 into a jpk file but no objects get exported. if i export just one object to a joe file then it works fine. not quite sure what i'm doing wrong? i've tried selecting all objects, deselecting them all but still no objects get exported. i'm doing this on debian. any ideas?
looking at blender-scripts/blender28/vdrift.py at joe_pack.from_mesh() at line 367 i see
objlist = bpy.context.scene.collection.objects
but it's empty so no wonder nothing gets exported.
thanks.
Try changing bpy.context.scene.collection.objects to bpy.context.scene.collection.all_objects.
i did and now i get:
Traceback (most recent call last):
File "/usr/share/blender/scripts/addons/vdrift.py", line 997, in execute
joe_pack.write(filepath, self.export_list, self.ExportJpk)
File "/usr/share/blender/scripts/addons/vdrift.py", line 348, in write
jpk = joe_pack().from_mesh()
File "/usr/share/blender/scripts/addons/vdrift.py", line 389, in from_mesh
image = bsdf.inputs['Base Color'].links[0].from_node.image
IndexError: tuple index out of range
location: <unknown location>:-1
location: <unknown location>:-1
that's because bsdf.inputs['Base Color'].links is empty.
The exporter assumes that the texture is linked to the 'Base Color' input. You can check it in the shading workspace, shader editor window.
If you can upload a minimal blend file, a single object should be enough, I can try to figure out where the texture is.
never mind, turns out the textures were in the wrong directory so blender couldn't find them. once i fixed that i managed to export the objects. i wish there were a way i can split all objects by material in one go rather than doing it by hand for each and every one of them. still needed to replace collection.objects with collection.all_objects. thanks.
adding something like
bpy.ops.object.editmode_toggle()
bpy.ops.mesh.separate(type='MATERIAL')
before
objlist = bpy.context.scene.collection.all_objects
joe_pack.from_mesh() seems to split the objects by material. it might act only on selected objects, so selecting all objects might be needed first (i had them all selected in blender). thanks. now i have to remember how surfaces work, etc.
Yeah. That is the Splitting Mesh by Material command (enter Edit mode, press the P key, select split By Material). The exporter does not handle meshes with multiple materials at all.
this is why i added that piece of code. is getting kind of boring to do that manually for more than 1000 objects). it would be nice if a more robust version could be added to the exporter.
But you don't have to do it for each object separately. Select them all, go into edit mode, and separate. I've just tried it, and it works just fine.
yes, but since having one material per object is a requirement for exporting to joe format, why not just make sure that's actually the case rather than silently give the wrong answer? funny how things are, i had almost forgotten how annoying it is to work with you. thanks for reminding me, i won't bother you guys again. good luck.