def execute(self, context): obj = bpy.data.objects[self.object_name] group_bp = utils.get_assembly_bp(obj) wall_bp = utils.get_wall_bp(obj) if group_bp: group = fd_types.Assembly(group_bp) elif wall_bp: group = fd_types.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() utils.apply_hook_modifiers(obj) for vgroup in obj.vertex_groups: if vgroup.name == 'X Dimension': utils.hook_vertex_group_to_object(obj,'X Dimension',group.obj_x) elif vgroup.name == 'Y Dimension': utils.hook_vertex_group_to_object(obj,'Y Dimension',group.obj_y) elif vgroup.name == 'Z Dimension': utils.hook_vertex_group_to_object(obj,'Z Dimension',group.obj_z) else: for hook in hooklist: if hook.mv.name_object == vgroup.name: utils.hook_vertex_group_to_object(obj,vgroup.name,hook) obj.lock_location = (True,True,True) return {'FINISHED'}
def execute(self,context): wall_bp = utils.get_wall_bp(context.active_object) if wall_bp: self.previous_wall = fd_types.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'}
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 = utils.get_wall_bp(obj) children = utils.get_child_objects(wall_bp) for child in children: child.hide = True wall_bp.hide = True return {'FINISHED'}
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 = utils.get_wall_bp(obj) children = utils.get_child_objects(wall_bp) for child in children: if child.type != 'EMPTY': child.hide = False wall_bp.location = wall_bp.location wall_bp.hide = False return {'FINISHED'}
def faucet_drop(self,context,event): selected_point, selected_obj = utils.get_selection_point(context,event) bpy.ops.object.select_all(action='DESELECT') if selected_obj: wall_bp = utils.get_wall_bp(selected_obj) if wall_bp: self.object.rotation_euler.z = wall_bp.rotation_euler.z self.object.location = selected_point if event.type == 'LEFTMOUSE' and event.value == 'PRESS': self.object.draw_type = 'TEXTURED' bpy.context.window.cursor_set('DEFAULT') bpy.ops.object.select_all(action='DESELECT') utils.set_wireframe(self.object,False) context.scene.objects.active = self.object self.object.select = True return {'FINISHED'} return {'RUNNING_MODAL'}
def execute(self, context): obj = context.active_object wall_bp = utils.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 = utils.get_child_objects(wall) for child in children: child.hide = True else: wall_assembly = fd_types.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'}