def execute(self, context):

        plane = new_plane(size=self.plane_size)
        plane.name = "Perp. Bisecting Plane"

        if len(context.selected_objects) == 1:
            bisecting_plane_of_line(plane, context.object)
        else:
            A, B = context.selected_objects[-2:]
            bisecting_plane_of_points(plane, A, B)

        return {'FINISHED'}
Example #2
0
    def execute(self, context):
        _A, _B = context.selected_objects[-2:]

        A = objects.new_plane(hide=self.hide_extra)
        constraints.copy_transforms(A, _A, transforms='LR')

        B = objects.new_plane(hide=self.hide_extra)
        constraints.copy_transforms(B, _B, transforms='LR')
        
        # A point on the normal of Plane A
        A_norm = objects.new_empty(hide=self.hide_extra)
        A_norm.name = "A Norm"
        objects.uniform_scale(A_norm, 0.1)
        objects.set_parent(A_norm, A, keep_inverse=False)
        A_norm.location[2] = 1.0

        # Empty located a A, but in the same orientation as B
        B_rot_at_A = objects.new_empty(hide=self.hide_extra)
        B_rot_at_A.name = "B_rot_at_A"
        constraints.copy_location(B_rot_at_A, A)
        constraints.copy_rotation(B_rot_at_A, B)

        # (B_norm_at_a - A) gives the normal direction of B
        B_norm_at_a = objects.new_empty(hide=self.hide_extra)
        B_norm_at_a.name = "B_norm_at_a"
        objects.set_parent(B_norm_at_a, B_rot_at_A, keep_inverse=False)
        B_norm_at_a.location[2] = 1.0

        intersection_line = objects.new_line(axis='Z', length=self.length)
        objects.move_origin_center(intersection_line)
        objects.add_abs_bevel(intersection_line, self.bevel_depth)

        geometry.align_to_plane_of(intersection_line, A, A_norm, B_norm_at_a)        
        constraints.project_along_axis(intersection_line, 'Y', B, opposite=True)

        return {'FINISHED'}
Example #3
0
    def execute(self, context):
        A, B, C = context.selected_objects[-3:]
        plane = new_plane(size=self.plane_size)
        align_to_plane_of(plane, A, B, C)

        return {'FINISHED'}
Example #4
0
 def execute(self, context):
     new_plane(size=self.plane_size)
     return {'FINISHED'}
    def execute(self, context):
        A = context.active_object
        others = context.selected_objects[-2:]
        others.remove(A)
        B = others[0]

        follow_constraint = B.constraints["Follow Path"]

        follow_constraint.offset_factor = 0
        follow_constraint.keyframe_insert(data_path='offset_factor', frame=1)

        follow_constraint.offset_factor = 1
        follow_constraint.keyframe_insert(data_path='offset_factor',
                                          frame=self.frame_end)

        # Make sure the interpolation is linear
        fcurve = B.animation_data.action.fcurves[0]
        for kf in fcurve.keyframe_points:
            kf.interpolation = 'LINEAR'

        # Create plane for particle system
        plane = new_plane(size=1, location=(0, 0, 0), hide=False)
        plane.show_instancer_for_render = False
        plane.show_instancer_for_viewport = False
        plane.parent = A

        # Create a point to be used as the instance object
        particle = new_point(radius=self.sphere_radius)
        particle.name = "Particle"
        particle.hide_render = True

        # Create and configure the particle system
        particle_system = add_particle_system(
            obj=plane,

            # The custom `add_particle_system` function takes in the settings
            name="Particles for locus",
            type='EMITTER',
            count=self.part_number,
            frame_start=1,
            frame_end=self.frame_end,
            lifetime=self.frame_end,
            lifetime_random=0,
            emit_from='FACE',
            distribution='JIT',
            use_emit_random=False,
            userjit=1,
            normal_factor=0,
            physics_type='NEWTON',
            render_type='OBJECT',
            particle_size=1,
            size_random=0,
            instance_object=particle
        )

        # These nested values can't be passed in as kwargs, so set manually
        particle_system.effector_weights.gravity = 0
        particle_system.effector_weights.all = 0

        bpy.ops.ptcache.bake_all(bake=True)

        context.scene.frame_set(self.frame_end)
        context.scene.frame_end = self.frame_end

        return {'FINISHED'}