diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-06-03 04:17:35 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-06-03 04:17:35 +0400 |
commit | dc7d0ef474d235b59c4889b8fdb2eb1551f3df83 (patch) | |
tree | 343e9f02b6080c1f00a6708995ea0238df95ecd5 /release/ui | |
parent | abfc3daaf4dc6234ac4a48e72747a0b3fa559d2c (diff) |
UI:
* Add Lamp Fallof Curve and Texture Color Ramp panels.
* Use button space context data.
* A few other minor python layout script updates.
Diffstat (limited to 'release/ui')
-rw-r--r-- | release/ui/buttons_data_armature.py | 13 | ||||
-rw-r--r-- | release/ui/buttons_data_bone.py | 5 | ||||
-rw-r--r-- | release/ui/buttons_data_camera.py | 9 | ||||
-rw-r--r-- | release/ui/buttons_data_curve.py | 16 | ||||
-rw-r--r-- | release/ui/buttons_data_empty.py | 6 | ||||
-rw-r--r-- | release/ui/buttons_data_lamp.py | 46 | ||||
-rw-r--r-- | release/ui/buttons_data_lattice.py | 7 | ||||
-rw-r--r-- | release/ui/buttons_data_mesh.py | 7 | ||||
-rw-r--r-- | release/ui/buttons_data_modifier.py | 35 | ||||
-rw-r--r-- | release/ui/buttons_data_text.py | 12 | ||||
-rw-r--r-- | release/ui/buttons_material.py | 40 | ||||
-rw-r--r-- | release/ui/buttons_object_constraint.py | 18 | ||||
-rw-r--r-- | release/ui/buttons_objects.py | 13 | ||||
-rw-r--r-- | release/ui/buttons_particle.py | 5 | ||||
-rw-r--r-- | release/ui/buttons_physic_cloth.py | 21 | ||||
-rw-r--r-- | release/ui/buttons_scene.py | 2 | ||||
-rw-r--r-- | release/ui/buttons_texture.py | 104 | ||||
-rw-r--r-- | release/ui/buttons_world.py | 26 |
18 files changed, 211 insertions, 174 deletions
diff --git a/release/ui/buttons_data_armature.py b/release/ui/buttons_data_armature.py index 1d0043a5179..46a077ebfdb 100644 --- a/release/ui/buttons_data_armature.py +++ b/release/ui/buttons_data_armature.py @@ -7,15 +7,14 @@ class DataButtonsPanel(bpy.types.Panel): __context__ = "data" def poll(self, context): - ob = context.active_object - return (ob and ob.type == 'ARMATURE') + return (context.armature != None) class DATA_PT_skeleton(DataButtonsPanel): __idname__ = "DATA_PT_skeleton" __label__ = "Skeleton" def draw(self, context): - arm = context.active_object.data + arm = context.armature layout = self.layout layout.itemR(arm, "rest_position") @@ -42,7 +41,7 @@ class DATA_PT_display(DataButtonsPanel): __label__ = "Display" def draw(self, context): - arm = context.active_object.data + arm = context.armature layout = self.layout split = layout.split() @@ -62,7 +61,7 @@ class DATA_PT_paths(DataButtonsPanel): __label__ = "Paths" def draw(self, context): - arm = context.active_object.data + arm = context.armature layout = self.layout split = layout.split() @@ -90,7 +89,7 @@ class DATA_PT_ghost(DataButtonsPanel): __label__ = "Ghost" def draw(self, context): - arm = context.active_object.data + arm = context.armature layout = self.layout split = layout.split() @@ -111,4 +110,4 @@ class DATA_PT_ghost(DataButtonsPanel): bpy.types.register(DATA_PT_skeleton) bpy.types.register(DATA_PT_display) bpy.types.register(DATA_PT_paths) -bpy.types.register(DATA_PT_ghost)
\ No newline at end of file +bpy.types.register(DATA_PT_ghost) diff --git a/release/ui/buttons_data_bone.py b/release/ui/buttons_data_bone.py index a4e0fe4e2fb..75c201f015e 100644 --- a/release/ui/buttons_data_bone.py +++ b/release/ui/buttons_data_bone.py @@ -7,15 +7,14 @@ class BoneButtonsPanel(bpy.types.Panel): __context__ = "bone" def poll(self, context): - ob = context.active_object - return (ob and ob.type == 'ARMATURE') + return (context.bone != None) class BONE_PT_bone(BoneButtonsPanel): __idname__ = "BONE_PT_bone" __label__ = "Bone" def draw(self, context): - bone = context.active_object.data.bones[0] + bone = context.bone layout = self.layout split = layout.split() diff --git a/release/ui/buttons_data_camera.py b/release/ui/buttons_data_camera.py index d4dabea9480..7f3682b1c94 100644 --- a/release/ui/buttons_data_camera.py +++ b/release/ui/buttons_data_camera.py @@ -7,15 +7,14 @@ class DataButtonsPanel(bpy.types.Panel): __context__ = "data" def poll(self, context): - ob = context.active_object - return (ob and ob.type == 'CAMERA') + return (context.camera != None) class DATA_PT_cameralens(DataButtonsPanel): __idname__ = "DATA_PT_camera" __label__ = "Lens" def draw(self, context): - cam = context.active_object.data + cam = context.camera layout = self.layout layout.itemR(cam, "type", expand=True) @@ -52,7 +51,7 @@ class DATA_PT_cameradisplay(DataButtonsPanel): __label__ = "Display" def draw(self, context): - cam = context.active_object.data + cam = context.camera layout = self.layout split = layout.split() @@ -71,4 +70,4 @@ class DATA_PT_cameradisplay(DataButtonsPanel): col.itemR(cam, "draw_size", text="Size") bpy.types.register(DATA_PT_cameralens) -bpy.types.register(DATA_PT_cameradisplay)
\ No newline at end of file +bpy.types.register(DATA_PT_cameradisplay) diff --git a/release/ui/buttons_data_curve.py b/release/ui/buttons_data_curve.py index 754c26aa3e6..9baee5516be 100644 --- a/release/ui/buttons_data_curve.py +++ b/release/ui/buttons_data_curve.py @@ -7,15 +7,15 @@ class DataButtonsPanel(bpy.types.Panel): __context__ = "data" def poll(self, context): - ob = context.active_object - return (ob and ob.type == 'CURVE') + ob = context.object + return (ob and ob.type == 'CURVE' and context.curve) class DATA_PT_shape_curve(DataButtonsPanel): __idname__ = "DATA_PT_shape_curve" __label__ = "Shape" def draw(self, context): - curve = context.active_object.data + curve = context.curve layout = self.layout layout.itemR(curve, "curve_2d") @@ -50,7 +50,7 @@ class DATA_PT_geometry(DataButtonsPanel): __label__ = "Geometry" def draw(self, context): - curve = context.active_object.data + curve = context.curve layout = self.layout split = layout.split() @@ -72,13 +72,13 @@ class DATA_PT_pathanim(DataButtonsPanel): __label__ = "Path Animation" def draw_header(self, context): - curve = context.active_object.data + curve = context.curve layout = self.layout layout.itemR(curve, "path", text="") def draw(self, context): - curve = context.active_object.data + curve = context.curve layout = self.layout layout.active = curve.path @@ -97,7 +97,7 @@ class DATA_PT_current_curve(DataButtonsPanel): __label__ = "Current Curve" def draw(self, context): - currentcurve = context.active_object.data.curves[0] + currentcurve = context.curve.curves[0] # XXX layout = self.layout split = layout.split() @@ -128,4 +128,4 @@ class DATA_PT_current_curve(DataButtonsPanel): bpy.types.register(DATA_PT_shape_curve) bpy.types.register(DATA_PT_geometry) bpy.types.register(DATA_PT_pathanim) -bpy.types.register(DATA_PT_current_curve)
\ No newline at end of file +bpy.types.register(DATA_PT_current_curve) diff --git a/release/ui/buttons_data_empty.py b/release/ui/buttons_data_empty.py index 94caa4ed700..7f994c94a07 100644 --- a/release/ui/buttons_data_empty.py +++ b/release/ui/buttons_data_empty.py @@ -7,7 +7,7 @@ class DataButtonsPanel(bpy.types.Panel): __context__ = "data" def poll(self, context): - ob = context.active_object + ob = context.object return (ob and ob.type == 'EMPTY') class DATA_PT_empty(DataButtonsPanel): @@ -15,10 +15,10 @@ class DATA_PT_empty(DataButtonsPanel): __label__ = "Empty" def draw(self, context): - ob = context.active_object + ob = context.object layout = self.layout layout.itemR(ob, "empty_draw_type") layout.itemR(ob, "empty_draw_size") -bpy.types.register(DATA_PT_empty)
\ No newline at end of file +bpy.types.register(DATA_PT_empty) diff --git a/release/ui/buttons_data_lamp.py b/release/ui/buttons_data_lamp.py index a2a6ad0426c..86be9cd1a68 100644 --- a/release/ui/buttons_data_lamp.py +++ b/release/ui/buttons_data_lamp.py @@ -7,15 +7,14 @@ class DataButtonsPanel(bpy.types.Panel): __context__ = "data" def poll(self, context): - ob = context.active_object - return (ob and ob.type == 'LAMP') + return (context.lamp != None) class DATA_PT_lamp(DataButtonsPanel): __idname__ = "DATA_PT_lamp" __label__ = "Lamp" def draw(self, context): - lamp = context.active_object.data + lamp = context.lamp layout = self.layout layout.itemR(lamp, "type", expand=True) @@ -56,11 +55,11 @@ class DATA_PT_sunsky(DataButtonsPanel): __label__ = "Sun/Sky" def poll(self, context): - ob = context.active_object - return (ob.type == 'LAMP' and ob.data.type == 'SUN') + lamp = context.lamp + return (lamp and lamp.type == 'SUN') def draw(self, context): - lamp = context.active_object.data.sky + lamp = context.lamp.sky layout = self.layout row = layout.row() @@ -99,11 +98,11 @@ class DATA_PT_shadow(DataButtonsPanel): __label__ = "Shadow" def poll(self, context): - ob = context.active_object - return (ob.type == 'LAMP' and ob.data.type in ('POINT','SUN', 'SPOT', 'AREA')) + lamp = context.lamp + return (lamp and lamp.type in ('POINT','SUN', 'SPOT', 'AREA')) def draw(self, context): - lamp = context.active_object.data + lamp = context.lamp layout = self.layout layout.itemR(lamp, "shadow_method", expand=True) @@ -178,11 +177,11 @@ class DATA_PT_spot(DataButtonsPanel): __label__ = "Spot" def poll(self, context): - ob = context.active_object - return (ob.type == 'LAMP' and ob.data.type == 'SPOT') + lamp = context.lamp + return (lamp and lamp.type == 'SPOT') def draw(self, context): - lamp = context.active_object.data + lamp = context.lamp layout = self.layout split = layout.split() @@ -200,7 +199,28 @@ class DATA_PT_spot(DataButtonsPanel): if lamp.shadow_method == 'BUFFER_SHADOW': colsub.itemR(lamp, "halo_step", text="Step") +class DATA_PT_falloff_curve(DataButtonsPanel): + __idname__ = "DATA_PT_falloff_curve" + __label__ = "Falloff Curve" + + def poll(self, context): + lamp = context.lamp + + if lamp and lamp.type in ('POINT', 'SPOT'): + if lamp.falloff_type == 'CUSTOM_CURVE': + return True + + return False + + def draw(self, context): + lamp = context.lamp + layout = self.layout + + layout.template_curve_mapping(lamp.falloff_curve) + bpy.types.register(DATA_PT_lamp) bpy.types.register(DATA_PT_shadow) bpy.types.register(DATA_PT_sunsky) -bpy.types.register(DATA_PT_spot)
\ No newline at end of file +bpy.types.register(DATA_PT_spot) +bpy.types.register(DATA_PT_falloff_curve) + diff --git a/release/ui/buttons_data_lattice.py b/release/ui/buttons_data_lattice.py index 4bcff9f5389..6172c255d15 100644 --- a/release/ui/buttons_data_lattice.py +++ b/release/ui/buttons_data_lattice.py @@ -7,15 +7,14 @@ class DataButtonsPanel(bpy.types.Panel): __context__ = "data" def poll(self, context): - ob = context.active_object - return (ob and ob.type == 'LATTICE') + return (context.lattice != None) class DATA_PT_lattice(DataButtonsPanel): __idname__ = "DATA_PT_lattice" __label__ = "Lattice" def draw(self, context): - lat = context.active_object.data + lat = context.lattice layout = self.layout row = layout.row() @@ -34,4 +33,4 @@ class DATA_PT_lattice(DataButtonsPanel): row.itemR(lat, "outside") row.itemR(lat, "shape_keys") -bpy.types.register(DATA_PT_lattice)
\ No newline at end of file +bpy.types.register(DATA_PT_lattice) diff --git a/release/ui/buttons_data_mesh.py b/release/ui/buttons_data_mesh.py index 6e9a30cefbc..fceb235343a 100644 --- a/release/ui/buttons_data_mesh.py +++ b/release/ui/buttons_data_mesh.py @@ -7,15 +7,14 @@ class DataButtonsPanel(bpy.types.Panel): __context__ = "data" def poll(self, context): - ob = context.active_object - return (ob and ob.type == 'MESH') + return (context.mesh != None) class DATA_PT_surface(DataButtonsPanel): __idname__ = "DATA_PT_surface" __label__ = "Mesh" def draw(self, context): - mesh = context.active_object.data + mesh = context.mesh layout = self.layout split = layout.split() @@ -31,4 +30,4 @@ class DATA_PT_surface(DataButtonsPanel): layout.itemR(mesh, "texco_mesh") -bpy.types.register(DATA_PT_surface)
\ No newline at end of file +bpy.types.register(DATA_PT_surface) diff --git a/release/ui/buttons_data_modifier.py b/release/ui/buttons_data_modifier.py index c087e5f5e36..0f5d446f889 100644 --- a/release/ui/buttons_data_modifier.py +++ b/release/ui/buttons_data_modifier.py @@ -7,7 +7,7 @@ class DataButtonsPanel(bpy.types.Panel): __context__ = "modifier" def poll(self, context): - ob = context.active_object + ob = context.object return (ob and ob.type in ('MESH', 'CURVE', 'SURFACE', 'TEXT', 'LATTICE')) class DATA_PT_modifiers(DataButtonsPanel): @@ -15,7 +15,7 @@ class DATA_PT_modifiers(DataButtonsPanel): __label__ = "Modifiers" def draw(self, context): - ob = context.active_object + ob = context.object layout = self.layout row = layout.row() @@ -61,7 +61,7 @@ class DATA_PT_modifiers(DataButtonsPanel): if md.type == 'MASK': self.mask(box, md) if md.type == 'MESH_DEFORM': - self.meshdeform(box, md) + self.mesh_deform(box, md) if md.type == 'MIRROR': self.mirror(box, md) if md.type == 'MULTIRES': @@ -104,6 +104,8 @@ class DATA_PT_modifiers(DataButtonsPanel): layout.itemR(md, "length") if md.fit_type == 'FIT_CURVE': layout.itemR(md, "curve") + + layout.itemS() split = layout.split() @@ -112,7 +114,10 @@ class DATA_PT_modifiers(DataButtonsPanel): col.itemR(md, "constant_offset") colsub = col.column() colsub.active = md.constant_offset - colsub.itemR(md, "constant_offset_displacement", text="Displacement") + colsub.itemR(md, "constant_offset_displacement", text="") + + col.itemS() + sub = col.row().itemR(md, "merge_adjacent_vertices", text="Merge") colsub = col.column() colsub.active = md.merge_adjacent_vertices @@ -124,12 +129,17 @@ class DATA_PT_modifiers(DataButtonsPanel): col.itemR(md, "relative_offset") colsub = col.column() colsub.active = md.relative_offset - colsub.itemR(md, "relative_offset_displacement", text="Displacement") + colsub.itemR(md, "relative_offset_displacement", text="") + + col.itemS() + col = col.column() col.itemR(md, "add_offset_object") colsub = col.column() colsub.active = md.add_offset_object - colsub.itemR(md, "offset_object") + colsub.itemR(md, "offset_object", text="") + + layout.itemS() col = layout.column() col.itemR(md, "start_cap") @@ -249,13 +259,16 @@ class DATA_PT_modifiers(DataButtonsPanel): layout.itemR(md, "vertex_group") layout.itemR(md, "inverse") - def meshdeform(self, layout, md): + def mesh_deform(self, layout, md): layout.itemR(md, "object") layout.itemR(md, "vertex_group") layout.itemR(md, "invert") - layout.itemR(md, "precision") - layout.itemR(md, "dynamic") - # Missing: "Bind" + + layout.itemS() + layout.itemO("OBJECT_OT_modifier_mdef_bind", text="Bind") + row = layout.row() + row.itemR(md, "precision") + row.itemR(md, "dynamic") def mirror(self, layout, md): layout.itemR(md, "merge_limit") @@ -402,4 +415,4 @@ class DATA_PT_modifiers(DataButtonsPanel): col.itemR(md, "width", slider=True) col.itemR(md, "narrowness", slider=True) -bpy.types.register(DATA_PT_modifiers)
\ No newline at end of file +bpy.types.register(DATA_PT_modifiers) diff --git a/release/ui/buttons_data_text.py b/release/ui/buttons_data_text.py index 96147270209..9683dbee22b 100644 --- a/release/ui/buttons_data_text.py +++ b/release/ui/buttons_data_text.py @@ -7,7 +7,7 @@ class DataButtonsPanel(bpy.types.Panel): __context__ = "data" def poll(self, context): - ob = context.active_object + ob = context.object return (ob and ob.type == 'TEXT') class DATA_PT_shape_text(DataButtonsPanel): @@ -15,7 +15,7 @@ class DATA_PT_shape_text(DataButtonsPanel): __label__ = "Shape" def draw(self, context): - curve = context.active_object.data + curve = context.curve layout = self.layout layout.itemR(curve, "curve_2d") @@ -46,7 +46,7 @@ class DATA_PT_font(DataButtonsPanel): __label__ = "Font" def draw(self, context): - text = context.active_object.data + text = context.curve layout = self.layout layout.row() @@ -77,7 +77,7 @@ class DATA_PT_paragraph(DataButtonsPanel): __label__ = "Paragraph" def draw(self, context): - text = context.active_object.data + text = context.curve layout = self.layout layout.itemL(text="Align:") @@ -102,10 +102,10 @@ class DATA_PT_textboxes(DataButtonsPanel): __label__ = "Text Boxes" def draw(self, context): - text = context.active_object.data + text = context.curve layout = self.layout bpy.types.register(DATA_PT_shape_text) bpy.types.register(DATA_PT_font) bpy.types.register(DATA_PT_paragraph) -#bpy.types.register(DATA_PT_textboxes)
\ No newline at end of file +#bpy.types.register(DATA_PT_textboxes) diff --git a/release/ui/buttons_material.py b/release/ui/buttons_material.py index c9a5fa6db06..7cffb5b18cf 100644 --- a/release/ui/buttons_material.py +++ b/release/ui/buttons_material.py @@ -7,8 +7,7 @@ class MaterialButtonsPanel(bpy.types.Panel): __context__ = "material" def poll(self, context): - ob = context.active_object - return (ob and ob.active_material) + return (context.material != None) class MATERIAL_PT_preview(MaterialButtonsPanel): __idname__= "MATERIAL_PT_preview" @@ -17,7 +16,7 @@ class MATERIAL_PT_preview(MaterialButtonsPanel): def draw(self, context): layout = self.layout - mat = context.active_object.active_material + mat = context.material layout.template_preview(mat) class MATERIAL_PT_material(MaterialButtonsPanel): @@ -26,7 +25,7 @@ class MATERIAL_PT_material(MaterialButtonsPanel): def draw(self, context): layout = self.layout - mat = context.active_object.active_material + mat = context.material layout.itemR(mat, "type", expand=True) @@ -42,18 +41,18 @@ class MATERIAL_PT_sss(MaterialButtonsPanel): __label__ = "Subsurface Scattering" def poll(self, context): - ob = context.active_object - return (ob and ob.active_material and ob.active_material.type == "SURFACE") + mat = context.material + return (mat and mat.type == "SURFACE") def draw_header(self, context): - sss = context.active_object.active_material.subsurface_scattering + sss = context.material.subsurface_scattering layout = self.layout layout.itemR(sss, "enabled", text="") def draw(self, context): layout = self.layout - sss = context.active_object.active_material.subsurface_scattering + sss = context.material.subsurface_scattering layout.active = sss.enabled flow = layout.column_flow() @@ -76,18 +75,18 @@ class MATERIAL_PT_raymir(MaterialButtonsPanel): __label__ = "Ray Mirror" def poll(self, context): - ob = context.active_object - return (ob and ob.active_material and ob.active_material.type == "SURFACE") + mat = context.material + return (mat and mat.type == "SURFACE") def draw_header(self, context): - raym = context.active_object.active_material.raytrace_mirror + raym = context.material.raytrace_mirror layout = self.layout layout.itemR(raym, "enabled", text="") def draw(self, context): layout = self.layout - raym = context.active_object.active_material.raytrace_mirror + raym = context.material.raytrace_mirror layout.active = raym.enabled split = layout.split() @@ -113,18 +112,18 @@ class MATERIAL_PT_raytransp(MaterialButtonsPanel): __label__= "Ray Transparency" def poll(self, context): - ob = context.active_object - return (ob and ob.active_material and ob.active_material.type == "SURFACE") + mat = context.material + return (mat and mat.type == "SURFACE") def draw_header(self, context): - rayt = context.active_object.active_material.raytrace_transparency + rayt = context.material.raytrace_transparency layout = self.layout layout.itemR(rayt, "enabled", text="") def draw(self, context): layout = self.layout - rayt = context.active_object.active_material.raytrace_transparency + rayt = context.material.raytrace_transparency layout.active = rayt.enabled split = layout.split() @@ -151,12 +150,12 @@ class MATERIAL_PT_halo(MaterialButtonsPanel): __label__= "Halo" def poll(self, context): - ob = context.active_object - return (ob and ob.active_material and ob.active_material.type == "HALO") + mat = context.material + return (mat and mat.type == "HALO") def draw(self, context): layout = self.layout - mat = context.active_object.active_material + mat = context.material halo = mat.halo split = layout.split() @@ -202,4 +201,5 @@ bpy.types.register(MATERIAL_PT_material) bpy.types.register(MATERIAL_PT_raymir) bpy.types.register(MATERIAL_PT_raytransp) bpy.types.register(MATERIAL_PT_sss) -bpy.types.register(MATERIAL_PT_halo)
\ No newline at end of file +bpy.types.register(MATERIAL_PT_halo) + diff --git a/release/ui/buttons_object_constraint.py b/release/ui/buttons_object_constraint.py index 593010128a2..5b32124ff33 100644 --- a/release/ui/buttons_object_constraint.py +++ b/release/ui/buttons_object_constraint.py @@ -43,8 +43,8 @@ class ConstraintButtonsPanel(bpy.types.Panel): self.stretch_to(box, con) elif con.type == "FLOOR": self.floor(box, con) - #elif con.type == "RIGID_BODY_JOINT": - # self.rigid_body(box, con) + elif con.type == "RIGID_BODY_JOINT": + self.rigid_body(box, con) elif con.type == "CLAMP_TO": self.clamp_to(box, con) elif con.type == "TRANSFORM": @@ -512,11 +512,10 @@ class OBJECT_PT_constraints(ConstraintButtonsPanel): __context__ = "object" def poll(self, context): - ob = context.active_object - return (ob != None) + return (context.object != None) def draw(self, context): - ob = context.active_object + ob = context.object layout = self.layout row = layout.row() @@ -532,12 +531,12 @@ class BONE_PT_constraints(ConstraintButtonsPanel): __context__ = "bone" def poll(self, context): - ob = context.active_object + ob = context.object return (ob and ob.type == "ARMATURE") def draw(self, context): - ob = context.active_object - pchan = ob.pose.pose_channels[0] + ob = context.object + pchan = ob.pose.pose_channels[0] # XXX layout = self.layout #row = layout.row() @@ -548,4 +547,5 @@ class BONE_PT_constraints(ConstraintButtonsPanel): self.draw_constraint(con) bpy.types.register(OBJECT_PT_constraints) -bpy.types.register(BONE_PT_constraints)
\ No newline at end of file +bpy.types.register(BONE_PT_constraints) + diff --git a/release/ui/buttons_objects.py b/release/ui/buttons_objects.py index a5074614515..6d75146fe5f 100644 --- a/release/ui/buttons_objects.py +++ b/release/ui/buttons_objects.py @@ -7,14 +7,14 @@ class ObjectButtonsPanel(bpy.types.Panel): __context__ = "object" def poll(self, context): - return (context.active_object != None) + return (context.object != None) class OBJECT_PT_transform(ObjectButtonsPanel): __idname__ = "OBJECT_PT_transform" __label__ = "Transform" def draw(self, context): - ob = context.active_object + ob = context.object layout = self.layout row = layout.row() @@ -27,7 +27,7 @@ class OBJECT_PT_groups(ObjectButtonsPanel): __label__ = "Groups" def draw(self, context): - ob = context.active_object + ob = context.object layout = self.layout row = layout.row() @@ -54,7 +54,7 @@ class OBJECT_PT_display(ObjectButtonsPanel): __label__ = "Display" def draw(self, context): - ob = context.active_object + ob = context.object layout = self.layout row = layout.row() @@ -74,7 +74,7 @@ class OBJECT_PT_duplication(ObjectButtonsPanel): __label__ = "Duplication" def draw(self, context): - ob = context.active_object + ob = context.object layout = self.layout layout.itemR(ob, "dupli_type", expand=True) @@ -108,7 +108,7 @@ class OBJECT_PT_animation(ObjectButtonsPanel): __label__ = "Animation" def draw(self, context): - ob = context.active_object + ob = context.object layout = self.layout split = layout.split() @@ -132,3 +132,4 @@ bpy.types.register(OBJECT_PT_groups) bpy.types.register(OBJECT_PT_display) bpy.types.register(OBJECT_PT_duplication) bpy.types.register(OBJECT_PT_animation) + diff --git a/release/ui/buttons_particle.py b/release/ui/buttons_particle.py index 52e20b03538..737aa1a4393 100644 --- a/release/ui/buttons_particle.py +++ b/release/ui/buttons_particle.py @@ -7,8 +7,7 @@ class ParticleButtonsPanel(bpy.types.Panel): __context__ = "particle" def poll(self, context): - ob = context.active_object - return (ob and ob.active_particle_system) + return (context.particle_system != None) class PARTICLE_PT_particles(ParticleButtonsPanel): __idname__= "PARTICLE_PT_particles" @@ -17,7 +16,7 @@ class PARTICLE_PT_particles(ParticleButtonsPanel): def draw(self, context): layout = self.layout - psys = context.active_object.active_particle_system + psys = context.particle_system part = psys.settings layout.itemR(part, "amount") diff --git a/release/ui/buttons_physic_cloth.py b/release/ui/buttons_physic_cloth.py index 6dab2bcf57c..1b114871453 100644 --- a/release/ui/buttons_physic_cloth.py +++ b/release/ui/buttons_physic_cloth.py @@ -6,17 +6,8 @@ class PhysicButtonsPanel(bpy.types.Panel): __region_type__ = "WINDOW" __context__ = "physics" - def cloth_modifier(self, context): - ob = context.active_object - for md in ob.modifiers: - if md.type == 'CLOTH': - return md - - return None - def poll(self, context): - md = self.cloth_modifier(context) - return (md != None) + return (context.cloth != None) class Physic_PT_cloth(PhysicButtonsPanel): __idname__ = "Physic_PT_cloth" @@ -24,7 +15,7 @@ class Physic_PT_cloth(PhysicButtonsPanel): def draw(self, context): layout = self.layout - md = self.cloth_modifier(context) + md = context.cloth cloth = md.settings split = layout.split() @@ -60,7 +51,7 @@ class Physic_PT_cloth_collision(PhysicButtonsPanel): def draw_header(self, context): layout = self.layout - md = self.cloth_modifier(context) + md = context.cloth cloth = md.collision_settings layout.itemR(cloth, "enable_collision", text="") @@ -91,7 +82,7 @@ class Physic_PT_cloth_stiffness(PhysicButtonsPanel): def draw_header(self, context): layout = self.layout - md = self.cloth_modifier(context) + md = context.cloth cloth = md.settings layout.itemR(cloth, "stiffness_scaling", text="") @@ -99,7 +90,7 @@ class Physic_PT_cloth_stiffness(PhysicButtonsPanel): def draw(self, context): layout = self.layout - md = self.cloth_modifier(context) + md = context.cloth cloth = md.settings layout.active = cloth.stiffness_scaling @@ -117,4 +108,4 @@ class Physic_PT_cloth_stiffness(PhysicButtonsPanel): bpy.types.register(Physic_PT_cloth) bpy.types.register(Physic_PT_cloth_collision) -bpy.types.register(Physic_PT_cloth_stiffness)
\ No newline at end of file +bpy.types.register(Physic_PT_cloth_stiffness) diff --git a/release/ui/buttons_scene.py b/release/ui/buttons_scene.py index 561e5b94e3e..d7f215f2297 100644 --- a/release/ui/buttons_scene.py +++ b/release/ui/buttons_scene.py @@ -218,4 +218,4 @@ bpy.types.register(RENDER_PT_dimensions) bpy.types.register(RENDER_PT_antialiasing) bpy.types.register(RENDER_PT_shading) bpy.types.register(RENDER_PT_output) -bpy.types.register(RENDER_PT_stamp)
\ No newline at end of file +bpy.types.register(RENDER_PT_stamp) diff --git a/release/ui/buttons_texture.py b/release/ui/buttons_texture.py index ccdbda5d54d..7d0ef9371d7 100644 --- a/release/ui/buttons_texture.py +++ b/release/ui/buttons_texture.py @@ -7,8 +7,7 @@ class TextureButtonsPanel(bpy.types.Panel): __context__ = "texture" def poll(self, context): - try: return (context.active_object.active_material.active_texture.texture != None) - except:return False + return (context.texture != None) class TEXTURE_PT_preview(TextureButtonsPanel): __idname__= "TEXTURE_PT_preview" @@ -17,7 +16,7 @@ class TEXTURE_PT_preview(TextureButtonsPanel): def draw(self, context): layout = self.layout - tex = context.active_object.active_material.active_texture.texture + tex = context.texture layout.template_preview(tex) class TEXTURE_PT_texture(TextureButtonsPanel): @@ -26,21 +25,38 @@ class TEXTURE_PT_texture(TextureButtonsPanel): def draw(self, context): layout = self.layout - tex = context.active_object.active_material.active_texture.texture + tex = context.texture layout.itemR(tex, "type") +class TEXTURE_PT_colors(TextureButtonsPanel): + __idname__= "TEXTURE_PT_colors" + __label__ = "Colors" + + def draw(self, context): + layout = self.layout + tex = context.texture + + if tex.color_ramp: + layout.template_color_ramp(tex.color_ramp, expand=True) + else: + layout.itemR(tex, "rgb_factor") + + row = layout.row() + row.itemR(tex, "brightness") + row.itemR(tex, "contrast") + class TEXTURE_PT_clouds(TextureButtonsPanel): __idname__= "TEXTURE_PT_clouds" __label__ = "Clouds" def poll(self, context): - try: return (context.active_object.active_material.active_texture.texture.type == 'CLOUDS') - except:return False + tex = context.texture + return (tex and tex.type == 'CLOUDS') def draw(self, context): layout = self.layout - tex = context.active_object.active_material.active_texture.texture + tex = context.texture layout.itemR(tex, "stype", expand=True) layout.itemL(text="Noise:") @@ -57,12 +73,12 @@ class TEXTURE_PT_wood(TextureButtonsPanel): __label__ = "Wood" def poll(self, context): - try: return (context.active_object.active_material.active_texture.texture.type == 'WOOD') - except:return False + tex = context.texture + return (tex and tex.type == 'WOOD') def draw(self, context): layout = self.layout - tex = context.active_object.active_material.active_texture.texture + tex = context.texture layout.itemR(tex, "stype", expand=True) layout.itemR(tex, "noisebasis2", expand=True) @@ -80,12 +96,12 @@ class TEXTURE_PT_marble(TextureButtonsPanel): __label__ = "Marble" def poll(self, context): - try: return (context.active_object.active_material.active_texture.texture.type == 'MARBLE') - except:return False + tex = context.texture + return (tex and tex.type == 'MARBLE') def draw(self, context): layout = self.layout - tex = context.active_object.active_material.active_texture.texture + tex = context.texture layout.itemR(tex, "stype", expand=True) layout.itemR(tex, "noisebasis2", expand=True) @@ -104,12 +120,12 @@ class TEXTURE_PT_magic(TextureButtonsPanel): __label__ = "Magic" def poll(self, context): - try: return (context.active_object.active_material.active_texture.texture.type == 'MAGIC') - except:return False + tex = context.texture + return (tex and tex.type == 'MAGIC') def draw(self, context): layout = self.layout - tex = context.active_object.active_material.active_texture.texture + tex = context.texture row = layout.row() row.itemR(tex, "noise_depth", text="Depth") @@ -120,12 +136,12 @@ class TEXTURE_PT_blend(TextureButtonsPanel): __label__ = "Blend" def poll(self, context): - try: return (context.active_object.active_material.active_texture.texture.type == 'BLEND') - except:return False + tex = context.texture + return (tex and tex.type == 'BLEND') def draw(self, context): layout = self.layout - tex = context.active_object.active_material.active_texture.texture + tex = context.texture layout.itemR(tex, "progression") layout.itemR(tex, "flip_axis") @@ -135,12 +151,12 @@ class TEXTURE_PT_stucci(TextureButtonsPanel): __label__ = "Stucci" def poll(self, context): - try: return (context.active_object.active_material.active_texture.texture.type == 'STUCCI') - except:return False + tex = context.texture + return (tex and tex.type == 'STUCCI') def draw(self, context): layout = self.layout - tex = context.active_object.active_material.active_texture.texture + tex = context.texture layout.itemR(tex, "stype", expand=True) layout.itemL(text="Noise:") @@ -156,12 +172,12 @@ class TEXTURE_PT_image(TextureButtonsPanel): __label__ = "Image/Movie" def poll(self, context): - try: return (context.active_object.active_material.active_texture.texture.type == 'IMAGE') - except:return False + tex = context.texture + return (tex and tex.type == 'IMAGE') def draw(self, context): layout = self.layout - tex = context.active_object.active_material.active_texture.texture + tex = context.texture split = layout.split() @@ -183,12 +199,12 @@ class TEXTURE_PT_mapping(TextureButtonsPanel): __label__ = "Mapping" def poll(self, context): - try: return (context.active_object.active_material.active_texture.texture.type == 'IMAGE') - except:return False + tex = context.texture + return (tex and tex.type == 'IMAGE') def draw(self, context): layout = self.layout - tex = context.active_object.active_material.active_texture.texture + tex = context.texture split = layout.split() @@ -226,12 +242,12 @@ class TEXTURE_PT_plugin(TextureButtonsPanel): __label__ = "Plugin" def poll(self, context): - try: return (context.active_object.active_material.active_texture.texture.type == 'PLUGIN') - except:return False + tex = context.texture + return (tex and tex.type == 'PLUGIN') def draw(self, context): layout = self.layout - tex = context.active_object.active_material.active_texture.texture + tex = context.texture layout.itemL(text="Nothing yet") @@ -240,12 +256,12 @@ class TEXTURE_PT_envmap(TextureButtonsPanel): __label__ = "Environment Map" def poll(self, context): - try: return (context.active_object.active_material.active_texture.texture.type == 'ENVIRONMENT_MAP') - except:return False + tex = context.texture + return (tex and tex.type == 'ENVIRONMENT_MAP') def draw(self, context): layout = self.layout - tex = context.active_object.active_material.active_texture.texture + tex = context.texture layout.itemL(text="Nothing yet") @@ -254,12 +270,12 @@ class TEXTURE_PT_musgrave(TextureButtonsPanel): __label__ = "Musgrave" def poll(self, context): - try: return (context.active_object.active_material.active_texture.texture.type == 'MUSGRAVE') - except:return False + tex = context.texture + return (tex and tex.type == 'MUSGRAVE') def draw(self, context): layout = self.layout - tex = context.active_object.active_material.active_texture.texture + tex = context.texture layout.itemR(tex, "musgrave_type") @@ -289,13 +305,12 @@ class TEXTURE_PT_voronoi(TextureButtonsPanel): __label__ = "Voronoi" def poll(self, context): - try: return (context.active_object.active_material.active_texture.texture.type == 'VORONOI') - except:return False - + tex = context.texture + return (tex and tex.type == 'VORONOI') def draw(self, context): layout = self.layout - tex = context.active_object.active_material.active_texture.texture + tex = context.texture layout.itemR(tex, "distance_metric") layout.itemR(tex, "coloring") @@ -321,12 +336,12 @@ class TEXTURE_PT_distortednoise(TextureButtonsPanel): __label__ = "Distorted Noise" def poll(self, context): - try: return (context.active_object.active_material.active_texture.texture.type == 'DISTORTED_NOISE') - except:return False + tex = context.texture + return (tex and tex.type == 'DISTORTED_NOISE') def draw(self, context): layout = self.layout - tex = context.active_object.active_material.active_texture.texture + tex = context.texture layout.itemR(tex, "noise_distortion") layout.itemR(tex, "noise_basis", text="Basis") @@ -342,6 +357,7 @@ class TEXTURE_PT_distortednoise(TextureButtonsPanel): bpy.types.register(TEXTURE_PT_preview) bpy.types.register(TEXTURE_PT_texture) +bpy.types.register(TEXTURE_PT_colors) bpy.types.register(TEXTURE_PT_clouds) bpy.types.register(TEXTURE_PT_wood) bpy.types.register(TEXTURE_PT_marble) diff --git a/release/ui/buttons_world.py b/release/ui/buttons_world.py index f12a76bfb66..79826e04dfc 100644 --- a/release/ui/buttons_world.py +++ b/release/ui/buttons_world.py @@ -7,7 +7,7 @@ class WorldButtonsPanel(bpy.types.Panel): __context__ = "world" def poll(self, context): - return (context.scene.world != None) + return (context.world != None) class WORLD_PT_preview(WorldButtonsPanel): __label__ = "Preview" @@ -15,14 +15,14 @@ class WORLD_PT_preview(WorldButtonsPanel): def draw(self, context): layout = self.layout - world = context.scene.world + world = context.world layout.template_preview(world) class WORLD_PT_world(WorldButtonsPanel): __label__ = "World" def draw(self, context): - world = context.scene.world + world = context.world layout = self.layout row = layout.row() @@ -32,14 +32,16 @@ class WORLD_PT_world(WorldButtonsPanel): row = layout.row() row.column().itemR(world, "horizon_color") - row.column().itemR(world, "zenith_color") + col = row.column() + col.itemR(world, "zenith_color") + col.active = world.blend_sky row.column().itemR(world, "ambient_color") class WORLD_PT_color_correction(WorldButtonsPanel): __label__ = "Color Correction" def draw(self, context): - world = context.scene.world + world = context.world layout = self.layout row = layout.row() @@ -50,13 +52,13 @@ class WORLD_PT_mist(WorldButtonsPanel): __label__ = "Mist" def draw_header(self, context): - world = context.scene.world + world = context.world layout = self.layout layout.itemR(world.mist, "enabled", text="") def draw(self, context): - world = context.scene.world + world = context.world layout = self.layout layout.active = world.mist.enabled @@ -73,13 +75,13 @@ class WORLD_PT_stars(WorldButtonsPanel): __label__ = "Stars" def draw_header(self, context): - world = context.scene.world + world = context.world layout = self.layout layout.itemR(world.stars, "enabled", text="") def draw(self, context): - world = context.scene.world + world = context.world layout = self.layout layout.active = world.stars.enabled @@ -93,13 +95,13 @@ class WORLD_PT_ambient_occlusion(WorldButtonsPanel): __label__ = "Ambient Occlusion" def draw_header(self, context): - world = context.scene.world + world = context.world layout = self.layout layout.itemR(world.ambient_occlusion, "enabled", text="") def draw(self, context): - world = context.scene.world + world = context.world ao = world.ambient_occlusion layout = self.layout layout.active = ao.enabled @@ -150,4 +152,4 @@ bpy.types.register(WORLD_PT_world) bpy.types.register(WORLD_PT_ambient_occlusion) bpy.types.register(WORLD_PT_mist) bpy.types.register(WORLD_PT_stars) -bpy.types.register(WORLD_PT_color_correction)
\ No newline at end of file +bpy.types.register(WORLD_PT_color_correction) |