Last active
December 27, 2015 21:30
-
-
Save zeffii/cd16bfc664cd2be16c42 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
from bpy.types import (Menu, PropertyGroup) | |
from bpy.props import (BoolProperty, FloatProperty) | |
def common_update(self, context, origin): | |
obj = bpy.data.objects.get("Macbook_Gold") | |
if not obj: | |
return | |
if origin == 'isight_camera_indicator': | |
obj["00_iSight Camera Indicator"] = getattr(self, origin) | |
elif origin == 'dirt_and_dust': | |
obj["00_Dirt and Dust"] = getattr(self, origin) | |
elif origin == 'menubar_and_dock': | |
obj["00_Menubar and Dock"] = getattr(self, origin) | |
elif origin == 'screen_rotation': | |
obj["00_Screen Rotation"] = getattr(self, origin) | |
class IgnitProperties(bpy.types.PropertyGroup): | |
isight_camera_indicator = BoolProperty( | |
name = "iSight Camera Indicator", | |
description = "Toggles the iSight Camera Indicator ON and OFF", | |
default = False, | |
update = lambda self, context: common_update(self, context, 'isight_camera_indicator') | |
) | |
dirt_and_dust = BoolProperty( | |
name = "Dirt and Dust", | |
description = "Toggles the Dirt and Dust ON and OFF", | |
default = False, | |
update = lambda self, context: common_update(self, context, 'dirt_and_dust') | |
) | |
menubar_and_dock = BoolProperty( | |
name = "Menubar and Dock", | |
description = "Toggles the Menubar and Dock ON and OFF", | |
default = False, | |
update = lambda self, context: common_update(self, context, 'menubar_and_dock') | |
) | |
screen_rotation = FloatProperty( | |
name = "Screen Rotation", | |
description = "Rotates the screen", | |
default = 0.0, | |
min = 0.0, | |
max = 91.0, | |
update = lambda self, context: common_update(self, context, 'screen_rotation') | |
) | |
class IGLayoutDemoPanel(bpy.types.Panel): | |
"""Creates a Panel in the scene context of the properties editor""" | |
bl_label = "MacBook Controller" | |
bl_idname = "object_mode.macbook_controller" | |
bl_space_type = 'PROPERTIES' | |
bl_region_type = 'WINDOW' | |
bl_context = "object" | |
def draw(self, context): | |
layout = self.layout | |
layout.label(text = "Main Features:") | |
scene = context.scene | |
split = layout.split() | |
scene = context.scene | |
camera = scene.camera.data | |
# First column | |
col = split.column() | |
col.prop(scene.ignit_panel, "isight_camera_indicator") | |
col.prop(camerscene.ignit_panela, "dirt_and_dust") | |
# Second Column | |
col = split.column() | |
col.prop(scene.ignit_panel, "menubar_and_dock") | |
col.prop(scene.ignit_panel, "screen_rotation") | |
# MacBook Colors | |
layout.label(text = "MacBook Color:") | |
# row = layout.row(align=True) | |
# row.scale_y = 2.0 | |
# row.operator(scene.ignit_panel, text="Silver") | |
# row.operator(scene.ignit_panel, text="Gold") | |
# row.operator(scene.ignit_panel, text="Space Grey") | |
def register(): | |
bpy.utils.register_module(__name__) | |
bpy.types.Scene.ignit_panel = bpy.props.PointerProperty(type=IgnitProperties) | |
def unregister(): | |
bpy.utils.unregister__module(__name__) | |
del bpy.types.Scene.ignit_panel | |
if __name__ == "__main__": | |
register() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment