Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_operators/object.py
| Show First 20 Lines • Show All 937 Lines • ▼ Show 20 Lines | class LoadReferenceImage(LoadImageAsEmpty, Operator): | ||||
| """Add a reference image into the scene between objects""" | """Add a reference image into the scene between objects""" | ||||
| bl_idname = "object.load_reference_image" | bl_idname = "object.load_reference_image" | ||||
| bl_label = "Load Reference Image" | bl_label = "Load Reference Image" | ||||
| def set_settings(self, context, obj): | def set_settings(self, context, obj): | ||||
| pass | pass | ||||
| class OBJECT_OT_assign_property_defaults(Operator): | |||||
| """Assign the current values of custom properties as their defaults, for use as part of the rest pose state in NLA track mixing""" | |||||
brecht: Can you extend this description to explain why this is useful for animation / NLA blending? | |||||
| bl_idname = "object.assign_property_defaults" | |||||
| bl_label = "Assign Custom Property Values as Default" | |||||
| bl_options = {'UNDO', 'REGISTER'} | |||||
| process_data: BoolProperty(name="Process data properties", default=True) | |||||
| process_bones: BoolProperty(name="Process bone properties", default=True) | |||||
| @classmethod | |||||
| def poll(cls, context): | |||||
| obj = context.active_object | |||||
| return obj is not None and obj.library is None and obj.mode in {'POSE', 'OBJECT'} | |||||
| @staticmethod | |||||
| def assign_defaults(obj): | |||||
| from rna_prop_ui import rna_idprop_ui_prop_default_set | |||||
| rna_properties = {'_RNA_UI'} | {prop.identifier for prop in obj.bl_rna.properties if prop.is_runtime} | |||||
| for prop, value in obj.items(): | |||||
| if prop not in rna_properties: | |||||
| rna_idprop_ui_prop_default_set(obj, prop, value) | |||||
| def execute(self, context): | |||||
| obj = context.active_object | |||||
| self.assign_defaults(obj) | |||||
| if self.process_bones and obj.pose: | |||||
| for pbone in obj.pose.bones: | |||||
| self.assign_defaults(pbone) | |||||
| if self.process_data and obj.data and obj.data.library is None: | |||||
| self.assign_defaults(obj.data) | |||||
| if self.process_bones and isinstance(obj.data, bpy.types.Armature): | |||||
| for bone in obj.data.bones: | |||||
| self.assign_defaults(bone) | |||||
| return {'FINISHED'} | |||||
| classes = ( | classes = ( | ||||
| ClearAllRestrictRender, | ClearAllRestrictRender, | ||||
| DupliOffsetFromCursor, | DupliOffsetFromCursor, | ||||
| IsolateTypeRender, | IsolateTypeRender, | ||||
| JoinUVs, | JoinUVs, | ||||
| LoadBackgroundImage, | LoadBackgroundImage, | ||||
| LoadReferenceImage, | LoadReferenceImage, | ||||
| MakeDupliFace, | MakeDupliFace, | ||||
| SelectCamera, | SelectCamera, | ||||
| SelectHierarchy, | SelectHierarchy, | ||||
| SelectPattern, | SelectPattern, | ||||
| ShapeTransfer, | ShapeTransfer, | ||||
| SubdivisionSet, | SubdivisionSet, | ||||
| TransformsToDeltas, | TransformsToDeltas, | ||||
| TransformsToDeltasAnim, | TransformsToDeltasAnim, | ||||
| OBJECT_OT_assign_property_defaults, | |||||
| ) | ) | ||||
Can you extend this description to explain why this is useful for animation / NLA blending?