Changeset View
Changeset View
Standalone View
Standalone View
add_mesh_extra_objects/add_empty_as_parent.py
| Context not available. | |||||
| x = sum([obj.location[0] for obj in sel])/len(sel) | x = sum([obj.location[0] for obj in sel])/len(sel) | ||||
| y = sum([obj.location[1] for obj in sel])/len(sel) | y = sum([obj.location[1] for obj in sel])/len(sel) | ||||
| z = sum([obj.location[2] for obj in sel])/len(sel) | z = sum([obj.location[2] for obj in sel])/len(sel) | ||||
| return (x,y,z) | return x, y, z | ||||
| class P2E(bpy.types.Operator): | class P2E(bpy.types.Operator): | ||||
| Context not available. | |||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| objs = context.selected_objects | objs = context.selected_objects | ||||
| return (len(objs) > 0) | return len(objs) > 0 | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| Context not available. | |||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| act = bpy.context.object | act = bpy.context.object | ||||
| return (act and act.type == 'EMPTY') | return act and act.type == 'EMPTY' | ||||
| def execute(self, context): | def execute(self, context): | ||||
| act = bpy.context.object | act = bpy.context.object | ||||
| Context not available. | |||||