From 9f012ead0c83435bb279dbcc71da4eebaf361fc1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 11 May 2009 08:40:50 +0000 Subject: [PATCH] made the material button use the active objects material --- release/ui/buttons_material.py | 28 ++++++++++++++++++---------- source/blender/python/epy_doc_gen.py | 12 ++++++------ 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/release/ui/buttons_material.py b/release/ui/buttons_material.py index 55887cb3c4a..f3c82c4f511 100644 --- a/release/ui/buttons_material.py +++ b/release/ui/buttons_material.py @@ -11,11 +11,13 @@ class MATERIAL_PT_material(MaterialButtonsPanel): __label__ = "Material" def draw(self, context): - mat = context.main.materials[0] - layout = self.layout + try: mat = context.active_object.active_material + except: mat = None if not mat: - return + return + + layout = self.layout layout.row() layout.itemR(mat, "diffuse_color") @@ -31,12 +33,14 @@ class MATERIAL_PT_sss(MaterialButtonsPanel): __label__ = "Subsurface Scattering" def draw(self, context): - sss = context.main.materials[0].subsurface_scattering - layout = self.layout + try: sss = context.active_object.active_material.subsurface_scattering + except: sss = None if not sss: return + layout = self.layout + layout.row() layout.itemR(sss, "enabled", text="Enable") @@ -60,12 +64,14 @@ class MATERIAL_PT_raymir(MaterialButtonsPanel): __label__ = "Ray Mirror" def draw(self, context): - raym = context.main.materials[0].raytrace_mirror - layout = self.layout + try: raym = context.active_object.active_material.raytrace_mirror + except: raym = None if not raym: return - + + layout = self.layout + layout.row() layout.itemR(raym, "enabled", text="Enable") @@ -94,11 +100,13 @@ class MATERIAL_PT_raytransp(MaterialButtonsPanel): __label__= "Ray Transparency" def draw(self, context): - rayt = context.main.materials[0].raytrace_transparency - layout = self.layout + try: rayt = context.active_object.active_material.raytrace_transparency + except: rayt = None if not rayt: return + + layout = self.layout layout.row() layout.itemR(rayt, "enabled", text="Enable") diff --git a/source/blender/python/epy_doc_gen.py b/source/blender/python/epy_doc_gen.py index f65a3c417a0..9f3efc916bf 100644 --- a/source/blender/python/epy_doc_gen.py +++ b/source/blender/python/epy_doc_gen.py @@ -26,11 +26,11 @@ run this script from blenders root path once you have compiled blender This will generate rna.py and bpyoperator.py in "./source/blender/python/doc/" Generate html docs by running... - epydoc source/blender/python/doc/*.py -v \ - -o source/blender/python/doc/html \ - --inheritance=included \ - --no-sourcecode \ - --graph=classtree \ + epydoc source/blender/python/doc/*.py -v \\ + -o source/blender/python/doc/html \\ + --inheritance=included \\ + --no-sourcecode \\ + --graph=classtree \\ --graph-font-size=8 ''' @@ -523,7 +523,7 @@ def op2epy(target_path): if __name__ == '__main__': if 'bpy' not in dir(): - print("\nError, this script must run from inside blender.") + print("\nError, this script must run from inside blender2.5") print(script_help_msg) else: