Example #1
0
 def update(self, ctx, clickcount, dimantion):
     if clickcount == 1:
         self.params.radius1 = dimantion.radius
         self.compass.update(ctx)
     if clickcount == 2:
         if self.subclass.owner == None:
             self.subclass.create(self.context, "SUN")
             self.subclass.target = self.compass.owner
             self.subclass.owner.location = self.compass.owner.location
             set_create_target(self.subclass.owner, self.subclass.target)
         self.distance = dimantion.height
         self.subclass.owner.location.z = self.distance
     if clickcount == 3:
         if self.distance > 0:
             # TODO create a better way to caculate angle
             # store angle in prim data
             dx = dimantion.width
             dy = dimantion.length
             delta = dx if abs(dx) > abs(dy) else dy
             delta = delta if delta < self.distance else self.distance
             delta = delta if delta > -self.distance else -self.distance
             teta = (-pi / 2) * (delta / self.distance)
             x = sin(teta) * self.distance
             z = cos(teta) * self.distance
             self.subclass.owner.location.x = self.subclass.target.location.x + x
             self.subclass.owner.location.z = self.subclass.target.location.z + z
Example #2
0
 def update(self, ctx, clickcount, dimantion):
     if clickcount == 1:
         if self.drag and self.subclass.target == None:
             self.subclass.target = set_create_target(
                 self.subclass.owner, None)
         if self.subclass.target != None:
             self.subclass.target.location = dimantion.view
Example #3
0
 def execute(self, ctx):
     cam = ctx.active_object
     size = cam.data.display_size
     target = set_create_target(cam, None, distance=(0, 0, -size * 3))
     target.empty_display_size = size / 10
     set_as_active_object(ctx, cam)
     self.report({'OPERATOR'}, "bpy.ops.camera.create_target()")
     return {'FINISHED'}
Example #4
0
	def update(self, ctx, clickcount, dimantion):
		if clickcount == 1:
			if self.drag and self.subclass.target == None:
				self.subclass.target = set_create_target(self.subclass.owner, None)
			self.subclass.target.location = dimantion.view

			size = get_distance(self.subclass.owner.location,self.subclass.target.location)/3
			self.subclass.owner.data.display_size = size
			self.subclass.target.empty_display_size = size / 10
Example #5
0
 def update(self, ctx, clickcount, dimantion):
     if clickcount == 1:
         width = dimantion.width
         length = dimantion.length
         self.subclass.owner.data.size = max(width, length)
         if max(width, length) > 0:
             aspect = min(width, length) / max(width, length)
             if width > length:
                 self.subclass.owner.scale = (1, aspect, 1)
             else:
                 self.subclass.owner.scale = (aspect, 1, 1)
         self.subclass.owner.location = dimantion.center
     if clickcount == 2 and not self.free:
         if self.subclass.target == None:
             self.subclass.target = set_create_target(
                 self.subclass.owner, None)
         self.subclass.target.location = dimantion.view
Example #6
0
 def execute(self, ctx):
     light = ctx.active_object
     set_create_target(light, None)
     set_as_active_object(ctx, light)
     self.report({'INFO'}, 'bpy.ops.light.create_target()')
     return {'FINISHED'}
Example #7
0
 def execute(self, ctx):
     cam = ctx.active_object
     set_create_target(cam, None)
     set_as_active_object(ctx, cam)
     self.report({'INFO'}, "bpy.ops.camera.create_target()")
     return {'FINISHED'}
Example #8
0
def create_holder(ctx, location, radius, target):
    bpy.ops.object.empty_add(type='CUBE', location=location)
    holder = ctx.active_object
    holder.empty_display_size = radius
    set_create_target(holder, target)
    return holder