Пример #1
0
textures = set()

blend_filepath = bpy.context.blend_data.filepath
blend_filepath = os.path.dirname(blend_filepath)
print(blend_filepath)
collections = enable_collections()
try:
    for obj in bpy.data.objects:
        if obj.parent or not obj.children:
            continue
        if obj.muproperties.modelType == 'UTILITY':
            continue
        object_queue.append(obj)
    while object_queue:
        obj = object_queue.pop(0)
        name = strip_nnn(obj.name)+".mu"
        filepath = os.path.join(blend_filepath, name)
        print(name, filepath)

        mu = export_object (obj, filepath)
        if mu.internals:
            object_queue.extend(mu.internals)
        for m in mu.messages:
            print(m)
        for tex in mu.textures:
            textures.add(tex.name)
finally:
    restore_collections(collections)

for tex in textures:
    if tex not in bpy.data.images:
Пример #2
0
# suffix (eg, foo.001 -> foo.mu), and any blender images referenced by the
# exported mu files will be exported with ".png" appended to their names
# (note that they must be packed in the blend, and they will be exported as
# png). foo.cfg.in -> foo.cfg is handled as if exported manually.
import bpy
import os
from io_object_mu.export_mu import export_object, strip_nnn

textures = set()

blend_filepath = bpy.context.blend_data.filepath
blend_filepath = os.path.dirname(blend_filepath)
print(blend_filepath)
for obj in bpy.data.objects:
    if not obj.hide_render and not obj.parent and obj.children:
        name = strip_nnn(obj.name)+".mu"
        filepath = os.path.join(blend_filepath, name)
        print(name, filepath)

        mu = export_object (obj, filepath)
        for m in mu.messages:
            print(m)
        for tex in mu.textures:
            textures.add(tex.name)

for tex in textures:
    if tex not in bpy.data.images:
        continue
    image = bpy.data.images[tex]
    if image.packed_files:
        name = tex + ".png"