Changeset View
Changeset View
Standalone View
Standalone View
space_view3d_display_tools/display.py
| Show First 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | def execute(self, context): | ||||
| try: | try: | ||||
| view = context.space_data | view = context.space_data | ||||
| view.viewport_shade = 'TEXTURED' | view.viewport_shade = 'TEXTURED' | ||||
| context.scene.game_settings.material_mode = 'GLSL' | context.scene.game_settings.material_mode = 'GLSL' | ||||
| selection = context.selected_objects | selection = context.selected_objects | ||||
| if not selection: | if not selection: | ||||
| for obj in bpy.data.objects: | for obj in bpy.data.objects: | ||||
| obj.draw_type = self.drawing | obj.display_type = self.drawing | ||||
| else: | else: | ||||
| for obj in selection: | for obj in selection: | ||||
| obj.draw_type = self.drawing | obj.display_type = self.drawing | ||||
| except: | except: | ||||
| self.report({'ERROR'}, "Setting Draw Type could not be applied") | self.report({'ERROR'}, "Setting Draw Type could not be applied") | ||||
| return {'CANCELLED'} | return {'CANCELLED'} | ||||
| return {'FINISHED'} | return {'FINISHED'} | ||||
| # Bounds switch | # Bounds switch | ||||
| class DisplayBoundsSwitch(Operator, BasePollCheck): | class DisplayBoundsSwitch(Operator, BasePollCheck): | ||||
| bl_idname = "view3d.display_bounds_switch" | bl_idname = "view3d.display_bounds_switch" | ||||
| bl_label = "On/Off" | bl_label = "On/Off" | ||||
| bl_description = "Display/Hide Bounding box overlay" | bl_description = "Display/Hide Bounding box overlay" | ||||
| bounds = BoolProperty(default=False) | bounds = BoolProperty(default=False) | ||||
| def execute(self, context): | def execute(self, context): | ||||
| try: | try: | ||||
| scene = context.scene.display_tools | scene = context.scene.display_tools | ||||
| selection = context.selected_objects | selection = context.selected_objects | ||||
| if not selection: | if not selection: | ||||
| for obj in bpy.data.objects: | for obj in bpy.data.objects: | ||||
| obj.show_bounds = self.bounds | obj.show_bounds = self.bounds | ||||
| if self.bounds: | if self.bounds: | ||||
| obj.draw_bounds_type = scene.BoundingMode | obj.display_bounds_type = scene.BoundingMode | ||||
| else: | else: | ||||
| for obj in selection: | for obj in selection: | ||||
| obj.show_bounds = self.bounds | obj.show_bounds = self.bounds | ||||
| if self.bounds: | if self.bounds: | ||||
| obj.draw_bounds_type = scene.BoundingMode | obj.display_bounds_type = scene.BoundingMode | ||||
| except: | except: | ||||
| self.report({'ERROR'}, "Display/Hide Bounding box overlay failed") | self.report({'ERROR'}, "Display/Hide Bounding box overlay failed") | ||||
| return {'CANCELLED'} | return {'CANCELLED'} | ||||
| return {'FINISHED'} | return {'FINISHED'} | ||||
| # Double Sided switch | # Double Sided switch | ||||
| Show All 32 Lines | class DisplayXRayOn(Operator, BasePollCheck): | ||||
| xrays = BoolProperty(default=False) | xrays = BoolProperty(default=False) | ||||
| def execute(self, context): | def execute(self, context): | ||||
| try: | try: | ||||
| selection = context.selected_objects | selection = context.selected_objects | ||||
| if not selection: | if not selection: | ||||
| for obj in bpy.data.objects: | for obj in bpy.data.objects: | ||||
| obj.show_x_ray = self.xrays | obj.show_in_front = self.xrays | ||||
| else: | else: | ||||
| for obj in selection: | for obj in selection: | ||||
| obj.show_x_ray = self.xrays | obj.show_in_front = self.xrays | ||||
| except: | except: | ||||
| self.report({'ERROR'}, "Turn on/off X-ray mode failed") | self.report({'ERROR'}, "Turn on/off X-ray mode failed") | ||||
| return {'CANCELLED'} | return {'CANCELLED'} | ||||
| return {'FINISHED'} | return {'FINISHED'} | ||||
| # wire tools by Lapineige | # wire tools by Lapineige | ||||
| ▲ Show 20 Lines • Show All 73 Lines • Show Last 20 Lines | |||||