I’m writing an addon where I want to duplicate all properties of a built in operator, ie. the Alembic exporter.
The reason for this is that it’s a lot easier to maintain the addon when new properties are added to Blender, instead of hard-coding property names.
After a lot of googling I’ve found something that I think works. However, I’ve also found comments from people saying it’s not a good idea to duplicate properties due to registration order, instability etc.
Does anyone have any more information regarding possible problems?
def get_alembic_props():
'''
Get properties from Alembic exporter.
In this example just support BOOLEAN.
'''
props = []
for prop in bpy.ops.wm.alembic_export.get_rna_type().properties:
if prop.type == "BOOLEAN":
new_prop = bpy.props.BoolProperty(
identifier = prop.identifier,
name=prop.name,
description=prop.description,
default=prop.default
)
props.append(prop)
return props
class DuplicatedAlembicProps(bpy.types.PropertyGroup):
__annotations__ = {i.identifier: bpy.props.BoolProperty(name=i.name, default=i.default) for i in get_alembic_props()}
def register():
bpy.types.Scene.abc_props = bpy.props.PointerProperty(type=DuplicatedAlembicProps)