Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_operators/object.py
| Show First 20 Lines • Show All 849 Lines • ▼ Show 20 Lines | def execute(self, context): | ||||
| scene = context.scene | scene = context.scene | ||||
| collection = context.collection | collection = context.collection | ||||
| collection.instance_offset = scene.cursor.location | collection.instance_offset = scene.cursor.location | ||||
| return {'FINISHED'} | return {'FINISHED'} | ||||
| class DupliOffsetToCursor(Operator): | |||||
| """Set cursor position to the offset used for collection instances""" | |||||
| bl_idname = "object.instance_offset_to_cursor" | |||||
| bl_label = "Set Cursor to Offset" | |||||
| bl_options = {'INTERNAL', 'UNDO'} | |||||
| def execute(self, context): | |||||
| scene = context.scene | |||||
| collection = context.collection | |||||
| scene.cursor.location = collection.instance_offset | |||||
| return {'FINISHED'} | |||||
| class DupliOffsetFromObject(Operator): | |||||
| """Set offset used for collection instances based on the active object position""" | |||||
| bl_idname = "object.instance_offset_from_object" | |||||
| bl_label = "Set Offset from Object" | |||||
| bl_options = {'INTERNAL', 'UNDO'} | |||||
| @classmethod | |||||
| def poll(cls, context): | |||||
| return (context.active_object is not None) | |||||
| def execute(self, context): | |||||
| ob_eval = context.active_object.evaluated_get(context.view_layer.depsgraph) | |||||
| world_loc = ob_eval.matrix_world.to_translation() | |||||
| collection = context.collection | |||||
| collection.instance_offset = world_loc | |||||
| return {'FINISHED'} | |||||
| class LoadImageAsEmpty: | class LoadImageAsEmpty: | ||||
| bl_options = {'REGISTER', 'UNDO'} | bl_options = {'REGISTER', 'UNDO'} | ||||
| filepath: StringProperty( | filepath: StringProperty( | ||||
| subtype='FILE_PATH' | subtype='FILE_PATH' | ||||
| ) | ) | ||||
| filter_image: BoolProperty(default=True, options={'HIDDEN', 'SKIP_SAVE'}) | filter_image: BoolProperty(default=True, options={'HIDDEN', 'SKIP_SAVE'}) | ||||
| ▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | def execute(self, context): | ||||
| self.assign_defaults(bone) | self.assign_defaults(bone) | ||||
| return {'FINISHED'} | return {'FINISHED'} | ||||
| classes = ( | classes = ( | ||||
| ClearAllRestrictRender, | ClearAllRestrictRender, | ||||
| DupliOffsetFromCursor, | DupliOffsetFromCursor, | ||||
| DupliOffsetToCursor, | |||||
| DupliOffsetFromObject, | |||||
| 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, | OBJECT_OT_assign_property_defaults, | ||||
| ) | ) | ||||