diff options
author | Daniel Stokes <kupomail@gmail.com> | 2013-12-18 02:42:47 +0400 |
---|---|---|
committer | kupoman <kupomail@gmail.com> | 2013-12-18 05:03:27 +0400 |
commit | e9e08a1d12594eab0e341049fc252ff8578e9333 (patch) | |
tree | ac7c15959b03398babb68058f3824c2a4dbff5b7 /release/scripts/startup/bl_ui/properties_object.py | |
parent | 173f7a3d30db8cba95656bf03dc842b9300c2436 (diff) |
Game Engine: Level of detail support and tools
Levels of detail can be added and modified in the object panel. The object
panel also contains new tools for generating levels of detail, setting up
levels of detail based on object names (useful for importing), and
clearing an object's level of detail settings. This is meant as a game
engine feature, though the level of details settings can be previewed in
the viewport.
Reviewed By: moguri, nexyon, brecht
Differential Revision: http://developer.blender.org/D109
Diffstat (limited to 'release/scripts/startup/bl_ui/properties_object.py')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_object.py | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py index cbebdafbf2e..dcd32b17cbd 100644 --- a/release/scripts/startup/bl_ui/properties_object.py +++ b/release/scripts/startup/bl_ui/properties_object.py @@ -18,7 +18,7 @@ # <pep8 compliant> import bpy -from bpy.types import Panel +from bpy.types import Menu, Panel from rna_prop_ui import PropertyPanel @@ -125,6 +125,49 @@ class OBJECT_PT_transform_locks(ObjectButtonsPanel, Panel): sub.prop(ob, "lock_rotation_w", text="W") +class OBJECT_MT_lod_tools(Menu): + bl_label = "Level Of Detail Tools" + + def draw(self, context): + layout = self.layout + + layout.operator("object.lod_by_name", text="Set By Name") + layout.operator("object.lod_generate", text="Generate") + layout.operator("object.lod_clear_all", text="Clear All", icon='PANEL_CLOSE') + + +class OBJECT_PT_levels_of_detail(ObjectButtonsPanel, Panel): + bl_label = "Levels of Detail" + COMPAT_ENGINES = {'BLENDER_GAME'} + + @classmethod + def poll(cls, context): + return context.scene.render.engine in cls.COMPAT_ENGINES + + def draw(self, context): + layout = self.layout + ob = context.object + + col = layout.column() + + for i, level in enumerate(ob.lod_levels): + if i == 0: continue + box = col.box() + row = box.row() + row.prop(level, "object", text="") + row.operator("object.lod_remove", text="", icon='PANEL_CLOSE').index = i + + row = box.row() + row.prop(level, "distance") + row = row.row(align=True) + row.prop(level, "use_mesh", text="") + row.prop(level, "use_material", text="") + + row = col.row(align=True) + row.operator("object.lod_add", text="Add", icon='ZOOMIN') + row.menu("OBJECT_MT_lod_tools", text="", icon='TRIA_DOWN') + + class OBJECT_PT_relations(ObjectButtonsPanel, Panel): bl_label = "Relations" |