Created
June 16, 2012 03:55
-
-
Save pcote/2939836 to your computer and use it in GitHub Desktop.
A simple experimental operator for messing with matrix basics.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
matrix_op.py | |
A simple experimental operator for messing with matrix basics. | |
""" | |
import bpy | |
from bpy.props import FloatProperty | |
from math import pi | |
class MatrixOp(bpy.types.Operator): | |
'''Tooltip''' | |
bl_idname = "object.matrix_op" | |
bl_label = "Matrix Object Operator" | |
bl_options = {'REGISTER', 'UNDO'} | |
influence = FloatProperty(name="Influence", default=0, min=0, max= pi) | |
@classmethod | |
def poll(cls, context): | |
return context.active_object is not None | |
def execute(self, context): | |
obs = context.selected_objects | |
lead_ob = context.active_object | |
obs = [ob for ob in context.selected_objects if ob != lead_ob] | |
for ob in obs: | |
lead_ob.matrix_world += (self.influence * ob.matrix_world) | |
return {'FINISHED'} | |
def register(): | |
bpy.utils.register_class(MatrixOp) | |
def unregister(): | |
bpy.utils.unregister_class(MatrixOp) | |
if __name__ == "__main__": | |
register() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment