If not defined via UI.
The answer from https://blender.stackexchange.com/a/24004/123064 used in other answer will work for properties defined by the UI, or with the "_RNA_UI"
key set. used for adding extra details to the property like min, max description, etc_It is used for adding extra details to the property like min, max description, etc
It will not pick up on properties defined using
ob["foo"] = 3
Using ob.items()
gives us a list of key, value pairs. The key being the name of the prop.
Test script,
import bpy
context = bpy.context
ob = context.object
# all props with name starting with "Shake_" on context ob
props = [(k, v) for k, v in ob.items() if k.startswith("Shake_")]
# all selected apart from ob
obs = context.selected_objects # selected
# obs = context.scene.objects[:] # all in scene
# obs = context.collection.objectsobjects[:] # all in context collection...
if ob in obs:
obs.remove(ob)
# set from key value pairs
for o in obs:
for k, v in props:
o[k] = v
Related.
How to edit a custom property in a python script?
How can I save a dict in a scene propertyGroup?
how to change the value of various custom properties at the same time?
Get all custom properties of an object
When should custom-properties be used instead of 'bpy.props'?