i'd like to experiment with code generation with the blender API, but i first need to understand how i could loop over the API within my code
for example bpy.context.object
have tons of properties, we can naturally see those properties within the console autocomplete or within the Otuliner Data Api
let's take a modifier for example. (here above) we can clearly see from the outlined or console that this 'Array' modifier have many properties (or functions)
i'd like to know how i can print each property module followed by the value assigned. something like so:
import bpy
obj = bpy.data.objects['my_object']
mod = obj.modifiers['Array']
print('Properties of Array modifier:')
for modules,value in mod:
print(f"property {module} : {value}"
i already saw this kind of solution used before, but it seemed to only work with bpy and bpy.utils
import pkgutil
import bpy
import email
package = bpy.utils
prefix = package.__name__ + "."
for importer, modname, ispkg in pkgutil.iter_modules(package.__path__, prefix):
print("Found submodule %s (is a package: %s)" % (modname, ispkg))