Ejemplo n.º 1
0
 def execute(self, context):
     obj = bpy.data.objects[self.object_name]
     group_bp = fd.get_assembly_bp(obj)
     wall_bp = fd.get_wall_bp(obj)
     if group_bp:
         group = fd.Assembly(group_bp)
     elif wall_bp:
         group = fd.Wall(wall_bp)
     hooklist = []
     for child in group.obj_bp.children:
         if child.type == 'EMPTY'  and child.mv.use_as_mesh_hook:
             hooklist.append(child)
     
     if obj.mode == 'EDIT':
         bpy.ops.object.editmode_toggle()
     
     fd.apply_hook_modifiers(obj)
     for vgroup in obj.vertex_groups:
         if vgroup.name == 'X Dimension':
             fd.hook_vertex_group_to_object(obj,'X Dimension',group.obj_x)
         elif vgroup.name == 'Y Dimension':
             fd.hook_vertex_group_to_object(obj,'Y Dimension',group.obj_y)
         elif vgroup.name == 'Z Dimension':
             fd.hook_vertex_group_to_object(obj,'Z Dimension',group.obj_z)
         else:
             for hook in hooklist:
                 if hook.mv.name_object == vgroup.name:
                     fd.hook_vertex_group_to_object(obj,vgroup.name,hook)
             
     obj.lock_location = (True,True,True)
             
     return {'FINISHED'}
 def draw(self, context):
     layout = self.layout
     obj_bp = fd.get_wall_bp(context.object)
     if obj_bp:
         group = fd.Assembly(obj_bp)
         box = layout.box()
         group.draw_transform(box)
Ejemplo n.º 3
0
    def modal(self, context, event):
        self.header_text = "Place Group: (Left Click = Place Group) (Hold Shift = Place Multiple) (Esc = Cancel)"
        context.area.tag_redraw()
        selected_point, selected_obj = fd.get_selection_point(context,event)
        obj_wall_bp = fd.get_wall_bp(selected_obj)
        for obj_bp in self.obj_bps:
            if obj_wall_bp:
                obj_bp.location.x = selected_point[0]
                obj_bp.location.y = selected_point[1]
                obj_bp.location.z = self.grp_z_loc
                obj_bp.rotation_euler = obj_wall_bp.rotation_euler
            else:
                obj_bp.location = selected_point

        if event.type == 'LEFTMOUSE' and event.value == 'PRESS':
            self.place_group(context,selected_obj)
            if event.shift:
                self.get_group(context)
            else:
                return self.cancel_drop(context,event)

        if event.type in {'MIDDLEMOUSE', 'WHEELUPMOUSE', 'WHEELDOWNMOUSE'}:
            return {'PASS_THROUGH'}
         
        if event.type == 'ESC':
            obj_list = []
            for obj in self.grp.objects:
                obj_list.append(obj)
            fd.delete_obj_list(obj_list)
            return self.cancel_drop(context,event)
         
        return {'RUNNING_MODAL'}
Ejemplo n.º 4
0
 def place_group(self,context,selected_obj):
     obj_wall_bp = fd.get_wall_bp(selected_obj)
     for obj_bp in self.obj_bps:
         self.set_xray(obj_bp, False)
         if obj_wall_bp:
             self.set_wall_as_parent(obj_wall_bp, obj_bp)
     self.assign_boolean(selected_obj)
     fd.delete_obj_list(self.cages)
     group = context.scene.grouplib.scene_groups.add()
     group.name = self.grp.name
     for obj_bp in self.obj_bps:
         obj_bp.select = True
         context.scene.objects.active = obj_bp
Ejemplo n.º 5
0
 def execute(self,context):
     wall_bp = fd.get_wall_bp(context.active_object)
     if wall_bp:
         self.previous_wall = fd.Wall(wall_bp)
         self.starting_point = (self.previous_wall.obj_x.matrix_world[0][3], self.previous_wall.obj_x.matrix_world[1][3], self.previous_wall.obj_x.matrix_world[2][3])
         
     self.create_wall()
     
     bpy.ops.mesh.primitive_plane_add()
     plane = context.active_object
     plane.location = (0,0,0)
     self.drawing_plane = context.active_object
     self.drawing_plane.draw_type = 'WIRE'
     self.drawing_plane.dimensions = (100,100,1)
     context.window_manager.modal_handler_add(self)
     return {'RUNNING_MODAL'}
Ejemplo n.º 6
0
 def execute(self, context):
     if self.wall_bp_name in context.scene.objects:
         obj = context.scene.objects[self.wall_bp_name]
     else:
         obj = context.active_object
         
     wall_bp = fd.get_wall_bp(obj)
     
     children = fd.get_child_objects(wall_bp)
     
     for child in children:
         child.hide = True
     
     wall_bp.hide = True
     
     return {'FINISHED'}
Ejemplo n.º 7
0
 def invoke(self,context,event):
     wm = context.window_manager
     if context.active_object:
         obj_wall_bp = fd.get_wall_bp(context.active_object)
         if obj_wall_bp:
             self.selected_wall = fd.Wall(obj_wall_bp)
             self.rotation = math.degrees(obj_wall_bp.rotation_euler.z)
         else:
             self.direction = 'STRAIGHT'
             self.rotation = 0
     else:
         self.direction = 'STRAIGHT'
         self.rotation = 0
     
     self.create_wall(context)
     self.update_wall(context)
     return wm.invoke_props_dialog(self, width=fd.get_prop_dialog_width(400))
Ejemplo n.º 8
0
 def execute(self, context):
     obj = context.active_object
     wall_bp = fd.get_wall_bp(obj)
     wall_bps = []
     for obj in context.visible_objects:
         if obj.mv.type == 'BPWALL':
             wall_bps.append(obj)
             
     for wall in wall_bps:
         if wall != wall_bp:
             children = []
             children = fd.get_child_objects(wall)
             
             for child in children:
                 child.hide = True
         else:
             wall_assembly = fd.Assembly(wall)
             wall_assembly.obj_x.select = True
             wall_assembly.obj_y.select = True
             wall_assembly.obj_z.select = True
     
     bpy.ops.view3d.view_selected()
     
     return {'FINISHED'}
 def draw_header(self, context):
     layout = self.layout
     obj_bp = fd.get_wall_bp(context.object)
     if obj_bp:
         layout.label(text="Wall: " + obj_bp.name,icon='SNAP_PEEL_OBJECT')
 def poll(cls, context):
     obj_bp = fd.get_wall_bp(context.object)
     if obj_bp:
         return True
     else:
         return False