[x3d-public] Blender import/export status.

John Carlson yottzumm at gmail.com
Mon Oct 25 06:40:25 PDT 2021


I'm not quite sure if this is progress or not...attempt to print out 
iterables.

############################

import bpy


def recurse(obj, prefix):
         #print(type(obj))
         #print(obj.__class__.__name__)
         for d in dir(obj):
                 newprefix = prefix+"."+d
                 if not d.startswith("__"):
                         print(newprefix, end=" ")
                         print(" = ", getattr(obj, d))
                 if not d.startswith("__") and not d in ["_bpy", "_os", 
"depsgraph", "owner", "denominator", "imag", "numerator", "real", 
"bl_rna", "rna_type", "original"] and not d.startswith("xx") and not 
d.startswith("yy") and not d.startswith("zz") and not d.startswith("xy") 
and not d.startswith("xz") and not d.startswith("yx") and not 
d.startswith("yz") and not d.startswith("zx") and not d.startswith("zy") 
and not d.startswith("node"):
                         try:
                                 ty = eval(newprefix)
                                 recurse(ty, newprefix)
                                 if str(ty.__class__.__name__) == 
'bpy_prop_collection':
                                         for i in range(len(ty)):
                                                 el = 
newprefix+'['+str(i)+']'
                                                 elobj = eval(el)
                                                 recurse(elobj, el)
                         except AttributeError:
                                 pass
                         #except TypeError:
                         #       pass
                         #except IndexError:
                         #       pass

recurse(bpy.data, "bpy.data")

######################################################

$ blender ~/Downloads/tuna.blend --background --python export.py 
../Downloads/tuna.blend





More information about the x3d-public mailing list