Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'release/scripts/ui')
-rw-r--r--release/scripts/ui/properties_animviz.py133
-rw-r--r--release/scripts/ui/properties_data_armature.py141
-rw-r--r--release/scripts/ui/properties_data_armature_rigify.py43
-rw-r--r--release/scripts/ui/properties_data_bone.py188
-rw-r--r--release/scripts/ui/properties_data_camera.py84
-rw-r--r--release/scripts/ui/properties_data_curve.py132
-rw-r--r--release/scripts/ui/properties_data_empty.py26
-rw-r--r--release/scripts/ui/properties_data_lamp.py235
-rw-r--r--release/scripts/ui/properties_data_lattice.py66
-rw-r--r--release/scripts/ui/properties_data_mesh.py114
-rw-r--r--release/scripts/ui/properties_data_metaball.py80
-rw-r--r--release/scripts/ui/properties_data_modifier.py242
-rw-r--r--release/scripts/ui/properties_game.py201
-rw-r--r--release/scripts/ui/properties_material.py322
-rw-r--r--release/scripts/ui/properties_object.py173
-rw-r--r--release/scripts/ui/properties_object_constraint.py335
-rw-r--r--release/scripts/ui/properties_particle.py177
-rw-r--r--release/scripts/ui/properties_physics_cloth.py62
-rw-r--r--release/scripts/ui/properties_physics_common.py31
-rw-r--r--release/scripts/ui/properties_physics_field.py67
-rw-r--r--release/scripts/ui/properties_physics_fluid.py99
-rw-r--r--release/scripts/ui/properties_physics_smoke.py75
-rw-r--r--release/scripts/ui/properties_physics_softbody.py82
-rw-r--r--release/scripts/ui/properties_render.py182
-rw-r--r--release/scripts/ui/properties_render_test.xml79
-rw-r--r--release/scripts/ui/properties_scene.py77
-rw-r--r--release/scripts/ui/properties_texture.py324
-rw-r--r--release/scripts/ui/properties_world.py104
-rw-r--r--release/scripts/ui/space_console.py26
-rw-r--r--release/scripts/ui/space_dopesheet.py17
-rw-r--r--release/scripts/ui/space_filebrowser.py12
-rw-r--r--release/scripts/ui/space_graph.py17
-rw-r--r--release/scripts/ui/space_image.py114
-rw-r--r--release/scripts/ui/space_info.py25
-rw-r--r--release/scripts/ui/space_logic.py19
-rw-r--r--release/scripts/ui/space_nla.py17
-rw-r--r--release/scripts/ui/space_node.py15
-rw-r--r--release/scripts/ui/space_outliner.py15
-rw-r--r--release/scripts/ui/space_sequencer.py216
-rw-r--r--release/scripts/ui/space_text.py44
-rw-r--r--release/scripts/ui/space_time.py17
-rw-r--r--release/scripts/ui/space_userpref.py166
-rw-r--r--release/scripts/ui/space_userpref_keymap.py25
-rw-r--r--release/scripts/ui/space_view3d.py171
-rw-r--r--release/scripts/ui/space_view3d_toolbar.py202
45 files changed, 1801 insertions, 3191 deletions
diff --git a/release/scripts/ui/properties_animviz.py b/release/scripts/ui/properties_animviz.py
index 9eb046cc2c8..b337485ae10 100644
--- a/release/scripts/ui/properties_animviz.py
+++ b/release/scripts/ui/properties_animviz.py
@@ -19,27 +19,22 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-################################################
# Generic Panels (Independent of DataType)
-class MotionPathButtonsPanel(bpy.types.Panel):
+class MotionPathButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_label = "Motion Paths"
bl_default_closed = True
- def draw_settings(self, context, avs, wide_ui, bones=False):
+ def draw_settings(self, context, avs, bones=False):
layout = self.layout
mps = avs.motion_paths
- if wide_ui:
- layout.prop(mps, "type", expand=True)
- else:
- layout.prop(mps, "type", text="")
+ layout.prop(mps, "type", expand=True)
split = layout.split()
@@ -56,8 +51,7 @@ class MotionPathButtonsPanel(bpy.types.Panel):
if bones:
col.row().prop(mps, "bake_location", expand=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Display:")
col.prop(mps, "show_frame_numbers", text="Frame Numbers")
col.prop(mps, "highlight_keyframes", text="Keyframes")
@@ -67,7 +61,7 @@ class MotionPathButtonsPanel(bpy.types.Panel):
# FIXME: this panel still needs to be ported so that it will work correctly with animviz
-class OnionSkinButtonsPanel(bpy.types.Panel):
+class OnionSkinButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_label = "Onion Skinning"
@@ -77,12 +71,8 @@ class OnionSkinButtonsPanel(bpy.types.Panel):
layout = self.layout
arm = context.armature
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(arm, "ghost_type", expand=True)
- else:
- layout.prop(arm, "ghost_type", text="")
+ layout.prop(arm, "ghost_type", expand=True)
split = layout.split()
@@ -97,124 +87,23 @@ class OnionSkinButtonsPanel(bpy.types.Panel):
sub.prop(arm, "ghost_step", text="Range")
sub.prop(arm, "ghost_size", text="Step")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Display:")
col.prop(arm, "ghost_only_selected", text="Selected Only")
-################################################
-# Specific Panels for DataTypes
-
-
-class OBJECT_PT_motion_paths(MotionPathButtonsPanel):
- #bl_label = "Object Motion Paths"
- bl_context = "object"
-
- def poll(self, context):
- return (context.object)
-
- def draw(self, context):
- layout = self.layout
-
- ob = context.object
- wide_ui = context.region.width > narrowui
-
- self.draw_settings(context, ob.animation_visualisation, wide_ui)
-
- layout.separator()
-
- split = layout.split()
-
- col = split.column()
- col.operator("object.paths_calculate", text="Calculate Paths")
-
- if wide_ui:
- col = split.column()
- col.operator("object.paths_clear", text="Clear Paths")
-
-
-class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel):
- #bl_label = "Object Onion Skinning"
- bl_context = "object"
-
- def poll(self, context):
- return (context.object)
-
- def draw(self, context):
- layout = self.layout
-
- ob = context.object
- wide_ui = context.region.width > narrowui
-
- self.draw_settings(context, ob.animation_visualisation, wide_ui)
-class DATA_PT_motion_paths(MotionPathButtonsPanel):
- #bl_label = "Bones Motion Paths"
- bl_context = "data"
-
- def poll(self, context):
- # XXX: include posemode check?
- return (context.object) and (context.armature)
-
- def draw(self, context):
- layout = self.layout
-
- ob = context.object
- wide_ui = context.region.width > narrowui
-
- self.draw_settings(context, ob.pose.animation_visualisation, wide_ui, bones=True)
-
- layout.separator()
-
- split = layout.split()
-
- col = split.column()
- col.operator("pose.paths_calculate", text="Calculate Paths")
-
- if wide_ui:
- col = split.column()
- col.operator("pose.paths_clear", text="Clear Paths")
-
-
-class DATA_PT_onion_skinning(OnionSkinButtonsPanel):
- #bl_label = "Bones Onion Skinning"
- bl_context = "data"
-
- def poll(self, context):
- # XXX: include posemode check?
- return (context.object) and (context.armature)
-
- def draw(self, context):
- layout = self.layout
-
- ob = context.object
- wide_ui = context.region.width > narrowui
-
- self.draw_settings(context, ob.pose.animation_visualisation, wide_ui, bones=True)
-
# NOTE:
-# The specialised panel types defined here (i.e. OBJECT_PT_*, etc.)
-# aren't registered here, but are rather imported to (and registered)
-# in the files defining the contexts where they reside. Otherwise,
-# these panels appear at the top of the lists by default.
-#
-# However, we keep these empty register funcs here just in case
-# something will need them again one day, and also to make
-# it easier to maintain these scripts.
-classes = []
+# The specialised panel types are derived in their respective UI modules
+
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_data_armature.py b/release/scripts/ui/properties_data_armature.py
index 31ede4adfb5..3d8f2cdc092 100644
--- a/release/scripts/ui/properties_data_armature.py
+++ b/release/scripts/ui/properties_data_armature.py
@@ -20,19 +20,18 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
-class DataButtonsPanel(bpy.types.Panel):
+class ArmatureButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.armature
-class DATA_PT_context_arm(DataButtonsPanel):
+class DATA_PT_context_arm(ArmatureButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
@@ -42,37 +41,30 @@ class DATA_PT_context_arm(DataButtonsPanel):
ob = context.object
arm = context.armature
space = context.space_data
- wide_ui = context.region.width > narrowui
- if wide_ui:
- split = layout.split(percentage=0.65)
- if ob:
- split.template_ID(ob, "data")
- split.separator()
- elif arm:
- split.template_ID(space, "pin_id")
- split.separator()
- else:
- layout.template_ID(ob, "data")
+ split = layout.split(percentage=0.65)
+ if ob:
+ split.template_ID(ob, "data")
+ split.separator()
+ elif arm:
+ split.template_ID(space, "pin_id")
+ split.separator()
-class DATA_PT_custom_props_arm(DataButtonsPanel, PropertyPanel):
+class DATA_PT_custom_props_arm(ArmatureButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
-class DATA_PT_skeleton(DataButtonsPanel):
+class DATA_PT_skeleton(ArmatureButtonsPanel, bpy.types.Panel):
bl_label = "Skeleton"
def draw(self, context):
layout = self.layout
arm = context.armature
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(arm, "pose_position", expand=True)
- else:
- layout.prop(arm, "pose_position", text="")
+ layout.prop(arm, "pose_position", expand=True)
split = layout.split()
@@ -90,12 +82,11 @@ class DATA_PT_skeleton(DataButtonsPanel):
col.prop(arm, "deform_vertexgroups", text="Vertex Groups")
col.prop(arm, "deform_envelope", text="Envelopes")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(arm, "deform_quaternion", text="Quaternion")
-class DATA_PT_display(DataButtonsPanel):
+class DATA_PT_display(ArmatureButtonsPanel, bpy.types.Panel):
bl_label = "Display"
def draw(self, context):
@@ -103,12 +94,8 @@ class DATA_PT_display(DataButtonsPanel):
ob = context.object
arm = context.armature
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.row().prop(arm, "drawtype", expand=True)
- else:
- layout.row().prop(arm, "drawtype", text="")
+ layout.row().prop(arm, "drawtype", expand=True)
split = layout.split()
@@ -117,17 +104,17 @@ class DATA_PT_display(DataButtonsPanel):
col.prop(arm, "draw_axes", text="Axes")
col.prop(arm, "draw_custom_bone_shapes", text="Shapes")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(arm, "draw_group_colors", text="Colors")
col.prop(ob, "x_ray", text="X-Ray")
col.prop(arm, "delay_deform", text="Delay Refresh")
-class DATA_PT_bone_groups(DataButtonsPanel):
+class DATA_PT_bone_groups(ArmatureButtonsPanel, bpy.types.Panel):
bl_label = "Bone Groups"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.object and context.object.type == 'ARMATURE' and context.object.pose)
def draw(self, context):
@@ -135,7 +122,6 @@ class DATA_PT_bone_groups(DataButtonsPanel):
ob = context.object
pose = ob.pose
- wide_ui = context.region.width > narrowui
row = layout.row()
row.template_list(pose, "bone_groups", pose, "active_bone_group_index", rows=2)
@@ -157,8 +143,7 @@ class DATA_PT_bone_groups(DataButtonsPanel):
col = split.column()
col.prop(group, "color_set")
if group.color_set:
- if wide_ui:
- col = split.column()
+ col = split.column()
col.template_triColorSet(group, "colors")
row = layout.row()
@@ -174,19 +159,15 @@ class DATA_PT_bone_groups(DataButtonsPanel):
# TODO: this panel will soon be depreceated too
-class DATA_PT_ghost(DataButtonsPanel):
+class DATA_PT_ghost(ArmatureButtonsPanel, bpy.types.Panel):
bl_label = "Ghost"
def draw(self, context):
layout = self.layout
arm = context.armature
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(arm, "ghost_type", expand=True)
- else:
- layout.prop(arm, "ghost_type", text="")
+ layout.prop(arm, "ghost_type", expand=True)
split = layout.split()
@@ -201,17 +182,17 @@ class DATA_PT_ghost(DataButtonsPanel):
sub.prop(arm, "ghost_step", text="Range")
sub.prop(arm, "ghost_size", text="Step")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Display:")
col.prop(arm, "ghost_only_selected", text="Selected Only")
-class DATA_PT_iksolver_itasc(DataButtonsPanel):
+class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, bpy.types.Panel):
bl_label = "iTaSC parameters"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
ob = context.object
return (ob and ob.pose)
@@ -221,7 +202,6 @@ class DATA_PT_iksolver_itasc(DataButtonsPanel):
ob = context.object
itasc = ob.pose.ik_param
- wide_ui = (context.region.width > narrowui)
row = layout.row()
row.prop(ob.pose, "ik_solver")
@@ -238,8 +218,7 @@ class DATA_PT_iksolver_itasc(DataButtonsPanel):
col = split.column()
col.prop(itasc, "precision")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(itasc, "num_iter")
@@ -261,33 +240,57 @@ class DATA_PT_iksolver_itasc(DataButtonsPanel):
row.prop(itasc, "dampmax", text="Damp", slider=True)
row.prop(itasc, "dampeps", text="Eps", slider=True)
-# import generic panels from other files
-from properties_animviz import DATA_PT_motion_paths, DATA_PT_onion_skinning
+from properties_animviz import MotionPathButtonsPanel, OnionSkinButtonsPanel
+
+class DATA_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
+ #bl_label = "Bones Motion Paths"
+ bl_context = "data"
+
+ @classmethod
+ def poll(cls, context):
+ # XXX: include posemode check?
+ return (context.object) and (context.armature)
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+
+ self.draw_settings(context, ob.pose.animation_visualisation, bones=True)
+
+ layout.separator()
+
+ split = layout.split()
+
+ col = split.column()
+ col.operator("pose.paths_calculate", text="Calculate Paths")
+
+ col = split.column()
+ col.operator("pose.paths_clear", text="Clear Paths")
+
+
+class DATA_PT_onion_skinning(OnionSkinButtonsPanel): #, bpy.types.Panel): # inherit from panel when ready
+ #bl_label = "Bones Onion Skinning"
+ bl_context = "data"
-classes = [
- DATA_PT_context_arm,
- DATA_PT_skeleton,
- DATA_PT_display,
- DATA_PT_bone_groups,
- DATA_PT_ghost,
- DATA_PT_iksolver_itasc,
+ @classmethod
+ def poll(cls, context):
+ # XXX: include posemode check?
+ return (context.object) and (context.armature)
- DATA_PT_motion_paths,
- #DATA_PT_onion_skinning,
+ def draw(self, context):
+ layout = self.layout
- DATA_PT_custom_props_arm]
+ ob = context.object
+ self.draw_settings(context, ob.pose.animation_visualisation, bones=True)
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_data_armature_rigify.py b/release/scripts/ui/properties_data_armature_rigify.py
index 5af676d5aa8..070f1fb7678 100644
--- a/release/scripts/ui/properties_data_armature_rigify.py
+++ b/release/scripts/ui/properties_data_armature_rigify.py
@@ -19,8 +19,6 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
class PoseTemplateSettings(bpy.types.IDPropertyGroup):
pass
@@ -44,7 +42,8 @@ class DATA_PT_template(bpy.types.Panel):
templates = []
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
if not context.armature:
return False
obj = context.object
@@ -212,7 +211,7 @@ class Graph(bpy.types.Operator):
import bpy
reload(graphviz_export)
obj = bpy.context.object
- path = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.utils.clean_name(obj.name)
+ path = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.path.clean_name(obj.name)
path_dot = path + ".dot"
path_png = path + ".png"
saved = graphviz_export.graph_armature(bpy.context.object, path_dot, CONSTRAINTS=False, DRIVERS=False)
@@ -249,7 +248,7 @@ class AsScript(bpy.types.Operator):
def invoke(self, context, event):
import os
obj = context.object
- self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.utils.clean_name(obj.name) + ".py"
+ self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.path.clean_name(obj.name) + ".py"
wm = context.manager
wm.add_fileselect(self)
return {'RUNNING_MODAL'}
@@ -262,7 +261,8 @@ class ActiveAssign(bpy.types.Operator):
bl_idname = "pose.metarig_assign"
bl_label = "Assign to the active posebone"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
bone = context.active_pose_bone
return bool(bone and bone.id_data.mode == 'POSE')
@@ -280,7 +280,8 @@ class ActiveClear(bpy.types.Operator):
bl_idname = "pose.metarig_clear"
bl_label = "Metarig Clear Type"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
bone = context.active_pose_bone
return bool(bone and bone.id_data.mode == 'POSE')
@@ -304,36 +305,14 @@ class INFO_MT_armature_metarig_add(bpy.types.Menu):
layout.operator_context = 'INVOKE_REGION_WIN'
for submodule_type in rigify.get_submodule_types():
- text = bpy.utils.display_name(submodule_type)
+ text = bpy.path.display_name(submodule_type)
layout.operator("pose.metarig_sample_add", text=text, icon='OUTLINER_OB_ARMATURE').metarig_type = submodule_type
-classes = [
- DATA_PT_template,
-
- PoseTemplateSettings,
- PoseTemplate,
-
- Reload,
- Generate,
- Validate,
- Sample,
- Graph,
- AsScript,
-
- ActiveAssign,
- ActiveClear,
-
- INFO_MT_armature_metarig_add]
-
menu_func = (lambda self, context: self.layout.menu("INFO_MT_armature_metarig_add", icon='OUTLINER_OB_ARMATURE'))
import space_info # ensure the menu is loaded first
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
-
PoseTemplate.StringProperty(attr="name",
name="Name of the slave",
description="",
@@ -361,10 +340,6 @@ def register():
def unregister():
bpy.types.Scene.RemoveProperty("pose_templates")
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
-
space_info.INFO_MT_armature_add.remove(menu_func)
if __name__ == "__main__":
diff --git a/release/scripts/ui/properties_data_bone.py b/release/scripts/ui/properties_data_bone.py
index a4be7b31042..1296ccd7e70 100644
--- a/release/scripts/ui/properties_data_bone.py
+++ b/release/scripts/ui/properties_data_bone.py
@@ -20,19 +20,18 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
-class BoneButtonsPanel(bpy.types.Panel):
+class BoneButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "bone"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.bone or context.edit_bone)
-class BONE_PT_context_bone(BoneButtonsPanel):
+class BONE_PT_context_bone(BoneButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
@@ -48,7 +47,8 @@ class BONE_PT_context_bone(BoneButtonsPanel):
row.prop(bone, "name", text="")
-class BONE_PT_custom_props(BoneButtonsPanel, PropertyPanel):
+class BONE_PT_custom_props(BoneButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@property
def _context_path(self):
@@ -59,7 +59,7 @@ class BONE_PT_custom_props(BoneButtonsPanel, PropertyPanel):
return "active_bone"
-class BONE_PT_transform(BoneButtonsPanel):
+class BONE_PT_transform(BoneButtonsPanel, bpy.types.Panel):
bl_label = "Transform"
def draw(self, context):
@@ -67,72 +67,50 @@ class BONE_PT_transform(BoneButtonsPanel):
ob = context.object
bone = context.bone
- wide_ui = context.region.width > narrowui
if not bone:
bone = context.edit_bone
- if wide_ui:
- row = layout.row()
- row.column().prop(bone, "head")
- row.column().prop(bone, "tail")
-
- col = row.column()
- sub = col.column(align=True)
- sub.label(text="Roll:")
- sub.prop(bone, "roll", text="")
- sub.label()
- sub.prop(bone, "lock")
- else:
- col = layout.column()
- col.prop(bone, "head")
- col.prop(bone, "tail")
- col.prop(bone, "roll")
- col.prop(bone, "lock")
+ row = layout.row()
+ row.column().prop(bone, "head")
+ row.column().prop(bone, "tail")
+
+ col = row.column()
+ sub = col.column(align=True)
+ sub.label(text="Roll:")
+ sub.prop(bone, "roll", text="")
+ sub.label()
+ sub.prop(bone, "lock")
else:
pchan = ob.pose.bones[context.bone.name]
- if wide_ui:
- row = layout.row()
- col = row.column()
- col.prop(pchan, "location")
- col.active = not (bone.parent and bone.connected)
-
- col = row.column()
- if pchan.rotation_mode == 'QUATERNION':
- col.prop(pchan, "rotation_quaternion", text="Rotation")
- elif pchan.rotation_mode == 'AXIS_ANGLE':
- #col.label(text="Rotation")
- #col.prop(pchan, "rotation_angle", text="Angle")
- #col.prop(pchan, "rotation_axis", text="Axis")
- col.prop(pchan, "rotation_axis_angle", text="Rotation")
- else:
- col.prop(pchan, "rotation_euler", text="Rotation")
-
- row.column().prop(pchan, "scale")
-
- layout.prop(pchan, "rotation_mode")
+ row = layout.row()
+ col = row.column()
+ col.prop(pchan, "location")
+ col.active = not (bone.parent and bone.connected)
+
+ col = row.column()
+ if pchan.rotation_mode == 'QUATERNION':
+ col.prop(pchan, "rotation_quaternion", text="Rotation")
+ elif pchan.rotation_mode == 'AXIS_ANGLE':
+ #col.label(text="Rotation")
+ #col.prop(pchan, "rotation_angle", text="Angle")
+ #col.prop(pchan, "rotation_axis", text="Axis")
+ col.prop(pchan, "rotation_axis_angle", text="Rotation")
else:
- col = layout.column()
- sub = col.column()
- sub.active = not (bone.parent and bone.connected)
- sub.prop(pchan, "location")
- col.label(text="Rotation:")
- col.prop(pchan, "rotation_mode", text="")
- if pchan.rotation_mode == 'QUATERNION':
- col.prop(pchan, "rotation_quaternion", text="")
- elif pchan.rotation_mode == 'AXIS_ANGLE':
- col.prop(pchan, "rotation_axis_angle", text="")
- else:
- col.prop(pchan, "rotation_euler", text="")
- col.prop(pchan, "scale")
-
-
-class BONE_PT_transform_locks(BoneButtonsPanel):
+ col.prop(pchan, "rotation_euler", text="Rotation")
+
+ row.column().prop(pchan, "scale")
+
+ layout.prop(pchan, "rotation_mode")
+
+
+class BONE_PT_transform_locks(BoneButtonsPanel, bpy.types.Panel):
bl_label = "Transform Locks"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.bone
def draw(self, context):
@@ -159,7 +137,7 @@ class BONE_PT_transform_locks(BoneButtonsPanel):
row.column().prop(pchan, "lock_scale")
-class BONE_PT_relations(BoneButtonsPanel):
+class BONE_PT_relations(BoneButtonsPanel, bpy.types.Panel):
bl_label = "Relations"
def draw(self, context):
@@ -168,7 +146,6 @@ class BONE_PT_relations(BoneButtonsPanel):
ob = context.object
bone = context.bone
arm = context.armature
- wide_ui = context.region.width > narrowui
if not bone:
bone = context.edit_bone
@@ -188,8 +165,7 @@ class BONE_PT_relations(BoneButtonsPanel):
col.label(text="Bone Group:")
col.prop_object(pchan, "bone_group", ob.pose, "bone_groups", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Parent:")
if context.bone:
col.prop(bone, "parent", text="")
@@ -206,10 +182,11 @@ class BONE_PT_relations(BoneButtonsPanel):
sub.prop(bone, "local_location", text="Local Location")
-class BONE_PT_display(BoneButtonsPanel):
+class BONE_PT_display(BoneButtonsPanel, bpy.types.Panel):
bl_label = "Display"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.bone
def draw(self, context):
@@ -217,7 +194,6 @@ class BONE_PT_display(BoneButtonsPanel):
ob = context.object
bone = context.bone
- wide_ui = context.region.width > narrowui
if not bone:
bone = context.edit_bone
@@ -233,8 +209,7 @@ class BONE_PT_display(BoneButtonsPanel):
col.prop(bone, "draw_wire", text="Wireframe")
col.prop(bone, "hide", text="Hide")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Custom Shape:")
col.prop(pchan, "custom_shape", text="")
@@ -242,11 +217,12 @@ class BONE_PT_display(BoneButtonsPanel):
col.prop_object(pchan, "custom_shape_transform", ob.pose, "bones", text="At")
-class BONE_PT_inverse_kinematics(BoneButtonsPanel):
+class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
bl_label = "Inverse Kinematics"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.active_pose_bone
def draw(self, context):
@@ -255,7 +231,6 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel):
ob = context.object
bone = context.bone
pchan = ob.pose.bones[bone.name]
- wide_ui = context.region.width > narrowui
row = layout.row()
row.prop(ob.pose, "ik_solver")
@@ -267,15 +242,12 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel):
row.prop(pchan, "ik_stiffness_x", text="Stiffness", slider=True)
row.active = pchan.ik_dof_x and pchan.has_ik
- if wide_ui:
- split = layout.split(percentage=0.25)
- sub = split.row()
- else:
- sub = layout.column(align=True)
+ split = layout.split(percentage=0.25)
+ sub = split.row()
+
sub.prop(pchan, "ik_limit_x", text="Limit")
sub.active = pchan.ik_dof_x and pchan.has_ik
- if wide_ui:
- sub = split.row(align=True)
+ sub = split.row(align=True)
sub.prop(pchan, "ik_min_x", text="")
sub.prop(pchan, "ik_max_x", text="")
sub.active = pchan.ik_dof_x and pchan.ik_limit_x and pchan.has_ik
@@ -287,15 +259,13 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel):
row.prop(pchan, "ik_stiffness_y", text="Stiffness", slider=True)
row.active = pchan.ik_dof_y and pchan.has_ik
- if wide_ui:
- split = layout.split(percentage=0.25)
- sub = split.row()
- else:
- sub = layout.column(align=True)
+ split = layout.split(percentage=0.25)
+ sub = split.row()
+
sub.prop(pchan, "ik_limit_y", text="Limit")
sub.active = pchan.ik_dof_y and pchan.has_ik
- if wide_ui:
- sub = split.row(align=True)
+
+ sub = split.row(align=True)
sub.prop(pchan, "ik_min_y", text="")
sub.prop(pchan, "ik_max_y", text="")
sub.active = pchan.ik_dof_y and pchan.ik_limit_y and pchan.has_ik
@@ -307,22 +277,18 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel):
sub.prop(pchan, "ik_stiffness_z", text="Stiffness", slider=True)
sub.active = pchan.ik_dof_z and pchan.has_ik
- if wide_ui:
- split = layout.split(percentage=0.25)
- sub = split.row()
- else:
- sub = layout.column(align=True)
+ split = layout.split(percentage=0.25)
+ sub = split.row()
+
sub.prop(pchan, "ik_limit_z", text="Limit")
sub.active = pchan.ik_dof_z and pchan.has_ik
- if wide_ui:
- sub = split.row(align=True)
+ sub = split.row(align=True)
sub.prop(pchan, "ik_min_z", text="")
sub.prop(pchan, "ik_max_z", text="")
sub.active = pchan.ik_dof_z and pchan.ik_limit_z and pchan.has_ik
split = layout.split()
split.prop(pchan, "ik_stretch", text="Stretch", slider=True)
- if wide_ui:
- split.label()
+ split.label()
split.active = pchan.has_ik
if ob.pose.ik_solver == 'ITASC':
@@ -330,8 +296,7 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel):
col = split.column()
col.prop(pchan, "ik_rot_control", text="Control Rotation")
col.active = pchan.has_ik
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(pchan, "ik_rot_weight", text="Weight", slider=True)
col.active = pchan.has_ik
# not supported yet
@@ -340,7 +305,7 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel):
#row.prop(pchan, "ik_lin_weight", text="Weight", slider=True)
-class BONE_PT_deform(BoneButtonsPanel):
+class BONE_PT_deform(BoneButtonsPanel, bpy.types.Panel):
bl_label = "Deform"
bl_default_closed = True
@@ -356,7 +321,6 @@ class BONE_PT_deform(BoneButtonsPanel):
layout = self.layout
bone = context.bone
- wide_ui = context.region.width > narrowui
if not bone:
bone = context.edit_bone
@@ -378,8 +342,7 @@ class BONE_PT_deform(BoneButtonsPanel):
sub.prop(bone, "head_radius", text="Head")
sub.prop(bone, "tail_radius", text="Tail")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Curved Bones:")
sub = col.column(align=True)
@@ -390,28 +353,13 @@ class BONE_PT_deform(BoneButtonsPanel):
col.label(text="Offset:")
col.prop(bone, "cyclic_offset")
-classes = [
- BONE_PT_context_bone,
- BONE_PT_transform,
- BONE_PT_transform_locks,
- BONE_PT_relations,
- BONE_PT_display,
- BONE_PT_inverse_kinematics,
- BONE_PT_deform,
-
- BONE_PT_custom_props]
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_data_camera.py b/release/scripts/ui/properties_data_camera.py
index 3abd460c427..cda2b79c909 100644
--- a/release/scripts/ui/properties_data_camera.py
+++ b/release/scripts/ui/properties_data_camera.py
@@ -20,20 +20,19 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
-class DataButtonsPanel(bpy.types.Panel):
+class CameraButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
engine = context.scene.render.engine
- return context.camera and (engine in self.COMPAT_ENGINES)
+ return context.camera and (engine in cls.COMPAT_ENGINES)
-class DATA_PT_context_camera(DataButtonsPanel):
+class DATA_PT_context_camera(CameraButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -44,29 +43,22 @@ class DATA_PT_context_camera(DataButtonsPanel):
ob = context.object
cam = context.camera
space = context.space_data
- wide_ui = context.region.width > narrowui
-
- if wide_ui:
- split = layout.split(percentage=0.65)
- if ob:
- split.template_ID(ob, "data")
- split.separator()
- elif cam:
- split.template_ID(space, "pin_id")
- split.separator()
- else:
- if ob:
- layout.template_ID(ob, "data")
- elif cam:
- layout.template_ID(space, "pin_id")
-
-
-class DATA_PT_custom_props_camera(DataButtonsPanel, PropertyPanel):
- _context_path = "object.data"
+
+ split = layout.split(percentage=0.65)
+ if ob:
+ split.template_ID(ob, "data")
+ split.separator()
+ elif cam:
+ split.template_ID(space, "pin_id")
+ split.separator()
+
+
+class DATA_PT_custom_props_camera(CameraButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "object.data"
-class DATA_PT_camera(DataButtonsPanel):
+class DATA_PT_camera(CameraButtonsPanel, bpy.types.Panel):
bl_label = "Lens"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -74,12 +66,8 @@ class DATA_PT_camera(DataButtonsPanel):
layout = self.layout
cam = context.camera
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(cam, "type", expand=True)
- else:
- layout.prop(cam, "type", text="")
+ layout.prop(cam, "type", expand=True)
split = layout.split()
@@ -89,8 +77,7 @@ class DATA_PT_camera(DataButtonsPanel):
col.prop(cam, "lens", text="Angle")
elif cam.lens_unit == 'DEGREES':
col.prop(cam, "angle")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(cam, "lens_unit", text="")
elif cam.type == 'ORTHO':
@@ -105,8 +92,7 @@ class DATA_PT_camera(DataButtonsPanel):
col.prop(cam, "shift_x", text="X")
col.prop(cam, "shift_y", text="Y")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.label(text="Clipping:")
col.prop(cam, "clip_start", text="Start")
col.prop(cam, "clip_end", text="End")
@@ -118,16 +104,14 @@ class DATA_PT_camera(DataButtonsPanel):
col = split.column()
col.prop(cam, "dof_object", text="")
- if wide_ui:
- col = split.column()
- else:
- col = col.column()
+ col = split.column()
+
if cam.dof_object != None:
col.enabled = False
col.prop(cam, "dof_distance", text="Distance")
-class DATA_PT_camera_display(DataButtonsPanel):
+class DATA_PT_camera_display(CameraButtonsPanel, bpy.types.Panel):
bl_label = "Display"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -135,7 +119,6 @@ class DATA_PT_camera_display(DataButtonsPanel):
layout = self.layout
cam = context.camera
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -145,8 +128,7 @@ class DATA_PT_camera_display(DataButtonsPanel):
col.prop(cam, "show_title_safe", text="Title Safe")
col.prop(cam, "show_name", text="Name")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(cam, "draw_size", text="Size")
col.separator()
col.prop(cam, "show_passepartout", text="Passepartout")
@@ -155,24 +137,12 @@ class DATA_PT_camera_display(DataButtonsPanel):
sub.prop(cam, "passepartout_alpha", text="Alpha", slider=True)
-classes = [
- DATA_PT_context_camera,
- DATA_PT_camera,
- DATA_PT_camera_display,
-
- DATA_PT_custom_props_camera]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_data_curve.py b/release/scripts/ui/properties_data_curve.py
index fd836f5e5d4..1262f6739b7 100644
--- a/release/scripts/ui/properties_data_curve.py
+++ b/release/scripts/ui/properties_data_curve.py
@@ -20,34 +20,35 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
-class DataButtonsPanel(bpy.types.Panel):
+class CurveButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.object and context.object.type in ('CURVE', 'SURFACE', 'TEXT') and context.curve)
-class DataButtonsPanelCurve(DataButtonsPanel):
+class CurveButtonsPanelCurve(CurveButtonsPanel):
'''Same as above but for curves only'''
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.object and context.object.type == 'CURVE' and context.curve)
-class DataButtonsPanelActive(DataButtonsPanel):
+class CurveButtonsPanelActive(CurveButtonsPanel):
'''Same as above but for curves only'''
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
curve = context.curve
return (curve and type(curve) is not bpy.types.TextCurve and curve.splines.active)
-class DATA_PT_context_curve(DataButtonsPanel):
+class DATA_PT_context_curve(CurveButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
@@ -57,27 +58,23 @@ class DATA_PT_context_curve(DataButtonsPanel):
ob = context.object
curve = context.curve
space = context.space_data
- wide_ui = context.region.width > narrowui
-
- if wide_ui:
- split = layout.split(percentage=0.65)
+ split = layout.split(percentage=0.65)
- if ob:
- split.template_ID(ob, "data")
- split.separator()
- elif curve:
- split.template_ID(space, "pin_id")
- split.separator()
- else:
- layout.template_ID(ob, "data")
+ if ob:
+ split.template_ID(ob, "data")
+ split.separator()
+ elif curve:
+ split.template_ID(space, "pin_id")
+ split.separator()
-class DATA_PT_custom_props_curve(DataButtonsPanel, PropertyPanel):
+class DATA_PT_custom_props_curve(CurveButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
-class DATA_PT_shape_curve(DataButtonsPanel):
+class DATA_PT_shape_curve(CurveButtonsPanel, bpy.types.Panel):
bl_label = "Shape"
def draw(self, context):
@@ -85,7 +82,6 @@ class DATA_PT_shape_curve(DataButtonsPanel):
ob = context.object
curve = context.curve
- wide_ui = context.region.width > narrowui
is_surf = (ob.type == 'SURFACE')
is_curve = (ob.type == 'CURVE')
is_text = (ob.type == 'TEXT')
@@ -109,8 +105,7 @@ class DATA_PT_shape_curve(DataButtonsPanel):
col.label(text="Display:")
col.prop(curve, "fast", text="Fast Editing")
- if wide_ui:
- col = split.column()
+ col = split.column()
if is_surf:
sub = col.column(align=True)
@@ -130,10 +125,11 @@ class DATA_PT_shape_curve(DataButtonsPanel):
col.prop(curve, "auto_texspace")
-class DATA_PT_geometry_curve(DataButtonsPanel):
+class DATA_PT_geometry_curve(CurveButtonsPanel, bpy.types.Panel):
bl_label = "Geometry"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
obj = context.object
if obj and obj.type == 'SURFACE':
return False
@@ -144,7 +140,6 @@ class DATA_PT_geometry_curve(DataButtonsPanel):
layout = self.layout
curve = context.curve
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -155,8 +150,7 @@ class DATA_PT_geometry_curve(DataButtonsPanel):
col.label(text="Taper Object:")
col.prop(curve, "taper_object", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Bevel:")
col.prop(curve, "bevel_depth", text="Depth")
col.prop(curve, "bevel_resolution", text="Resolution")
@@ -164,7 +158,7 @@ class DATA_PT_geometry_curve(DataButtonsPanel):
col.prop(curve, "bevel_object", text="")
-class DATA_PT_pathanim(DataButtonsPanelCurve):
+class DATA_PT_pathanim(CurveButtonsPanelCurve, bpy.types.Panel):
bl_label = "Path Animation"
def draw_header(self, context):
@@ -176,7 +170,6 @@ class DATA_PT_pathanim(DataButtonsPanelCurve):
layout = self.layout
curve = context.curve
- wide_ui = context.region.width > narrowui
layout.active = curve.use_path
@@ -189,14 +182,14 @@ class DATA_PT_pathanim(DataButtonsPanelCurve):
col = split.column()
col.prop(curve, "use_path_follow")
col.prop(curve, "use_stretch")
+ col.prop(curve, "use_deform_bounds")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(curve, "use_radius")
col.prop(curve, "use_time_offset", text="Offset Children")
-class DATA_PT_active_spline(DataButtonsPanelActive):
+class DATA_PT_active_spline(CurveButtonsPanelActive, bpy.types.Panel):
bl_label = "Active Spline"
def draw(self, context):
@@ -267,10 +260,11 @@ class DATA_PT_active_spline(DataButtonsPanelActive):
layout.prop(act_spline, "smooth")
-class DATA_PT_font(DataButtonsPanel):
+class DATA_PT_font(CurveButtonsPanel, bpy.types.Panel):
bl_label = "Font"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.object and context.object.type == 'TEXT' and context.curve)
def draw(self, context):
@@ -278,21 +272,16 @@ class DATA_PT_font(DataButtonsPanel):
text = context.curve
char = context.curve.edit_format
- wide_ui = context.region.width > narrowui
layout.template_ID(text, "font", open="font.open", unlink="font.unlink")
- #if wide_ui:
- # layout.prop(text, "font")
- #else:
- # layout.prop(text, "font", text="")
+ #layout.prop(text, "font")
split = layout.split()
col = split.column()
col.prop(text, "text_size", text="Size")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(text, "shear")
split = layout.split()
@@ -301,8 +290,7 @@ class DATA_PT_font(DataButtonsPanel):
col.label(text="Object Font:")
col.prop(text, "family", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Text on Curve:")
col.prop(text, "text_on_curve", text="")
@@ -314,8 +302,7 @@ class DATA_PT_font(DataButtonsPanel):
colsub.prop(text, "ul_position", text="Position")
colsub.prop(text, "ul_height", text="Thickness")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Character:")
col.prop(char, "bold")
col.prop(char, "italic")
@@ -329,23 +316,20 @@ class DATA_PT_font(DataButtonsPanel):
col.prop(char, "use_small_caps")
-class DATA_PT_paragraph(DataButtonsPanel):
+class DATA_PT_paragraph(CurveButtonsPanel, bpy.types.Panel):
bl_label = "Paragraph"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.object and context.object.type == 'TEXT' and context.curve)
def draw(self, context):
layout = self.layout
text = context.curve
- wide_ui = context.region.width > narrowui
layout.label(text="Align:")
- if wide_ui:
- layout.prop(text, "spacemode", expand=True)
- else:
- layout.prop(text, "spacemode", text="")
+ layout.prop(text, "spacemode", expand=True)
split = layout.split()
@@ -355,30 +339,28 @@ class DATA_PT_paragraph(DataButtonsPanel):
col.prop(text, "word_spacing", text="Word")
col.prop(text, "line_dist", text="Line")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.label(text="Offset:")
col.prop(text, "offset_x", text="X")
col.prop(text, "offset_y", text="Y")
-class DATA_PT_textboxes(DataButtonsPanel):
+class DATA_PT_textboxes(CurveButtonsPanel, bpy.types.Panel):
bl_label = "Text Boxes"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.object and context.object.type == 'TEXT' and context.curve)
def draw(self, context):
layout = self.layout
text = context.curve
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.operator("font.textbox_add", icon='ZOOMIN')
- if wide_ui:
- col = split.column()
+ col = split.column()
for i, box in enumerate(text.textboxes):
@@ -394,8 +376,7 @@ class DATA_PT_textboxes(DataButtonsPanel):
col.prop(box, "width", text="Width")
col.prop(box, "height", text="Height")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.label(text="Offset:")
col.prop(box, "x", text="X")
@@ -404,29 +385,12 @@ class DATA_PT_textboxes(DataButtonsPanel):
row.operator("font.textbox_remove", text='', icon='X', emboss=False).index = i
-classes = [
- DATA_PT_context_curve,
- DATA_PT_shape_curve,
- DATA_PT_geometry_curve,
- DATA_PT_pathanim,
- DATA_PT_active_spline,
- DATA_PT_font,
- DATA_PT_paragraph,
- DATA_PT_textboxes,
-
- DATA_PT_custom_props_curve]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_data_empty.py b/release/scripts/ui/properties_data_empty.py
index 577e32ed840..bf2f3b3d0ba 100644
--- a/release/scripts/ui/properties_data_empty.py
+++ b/release/scripts/ui/properties_data_empty.py
@@ -19,49 +19,37 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
-class DataButtonsPanel(bpy.types.Panel):
+class DataButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.object and context.object.type == 'EMPTY')
-class DATA_PT_empty(DataButtonsPanel):
+class DATA_PT_empty(DataButtonsPanel, bpy.types.Panel):
bl_label = "Empty"
def draw(self, context):
layout = self.layout
ob = context.object
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(ob, "empty_draw_type", text="Display")
- else:
- layout.prop(ob, "empty_draw_type", text="")
+ layout.prop(ob, "empty_draw_type", text="Display")
layout.prop(ob, "empty_draw_size", text="Size")
-classes = [
- DATA_PT_empty]
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_data_lamp.py b/release/scripts/ui/properties_data_lamp.py
index 14493301b1e..9a58622974e 100644
--- a/release/scripts/ui/properties_data_lamp.py
+++ b/release/scripts/ui/properties_data_lamp.py
@@ -20,8 +20,6 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
class LAMP_MT_sunsky_presets(bpy.types.Menu):
bl_label = "Sun & Sky Presets"
@@ -31,25 +29,25 @@ class LAMP_MT_sunsky_presets(bpy.types.Menu):
draw = bpy.types.Menu.draw_preset
-class DataButtonsPanel(bpy.types.Panel):
+class DataButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
engine = context.scene.render.engine
- return context.lamp and (engine in self.COMPAT_ENGINES)
+ return context.lamp and (engine in cls.COMPAT_ENGINES)
-class DATA_PT_preview(DataButtonsPanel):
+class DATA_PT_preview(DataButtonsPanel, bpy.types.Panel):
bl_label = "Preview"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
def draw(self, context):
self.layout.template_preview(context.lamp)
-
-class DATA_PT_context_lamp(DataButtonsPanel):
+class DATA_PT_context_lamp(DataButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -60,29 +58,23 @@ class DATA_PT_context_lamp(DataButtonsPanel):
ob = context.object
lamp = context.lamp
space = context.space_data
- wide_ui = context.region.width > narrowui
-
- if wide_ui:
- split = layout.split(percentage=0.65)
- if ob:
- split.template_ID(ob, "data")
- split.separator()
- elif lamp:
- split.template_ID(space, "pin_id")
- split.separator()
- else:
- if ob:
- layout.template_ID(ob, "data")
- elif lamp:
- layout.template_ID(space, "pin_id")
-
-
-class DATA_PT_custom_props_lamp(DataButtonsPanel, PropertyPanel):
- _context_path = "object.data"
+
+ split = layout.split(percentage=0.65)
+
+ if ob:
+ split.template_ID(ob, "data")
+ split.separator()
+ elif lamp:
+ split.template_ID(space, "pin_id")
+ split.separator()
+
+
+class DATA_PT_custom_props_lamp(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "object.data"
-class DATA_PT_lamp(DataButtonsPanel):
+class DATA_PT_lamp(DataButtonsPanel, bpy.types.Panel):
bl_label = "Lamp"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -90,12 +82,8 @@ class DATA_PT_lamp(DataButtonsPanel):
layout = self.layout
lamp = context.lamp
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(lamp, "type", expand=True)
- else:
- layout.prop(lamp, "type", text="")
+ layout.prop(lamp, "type", expand=True)
split = layout.split()
@@ -121,28 +109,27 @@ class DATA_PT_lamp(DataButtonsPanel):
col.prop(lamp, "distance")
col.prop(lamp, "gamma")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(lamp, "negative")
col.prop(lamp, "layer", text="This Layer Only")
col.prop(lamp, "specular")
col.prop(lamp, "diffuse")
-class DATA_PT_sunsky(DataButtonsPanel):
+class DATA_PT_sunsky(DataButtonsPanel, bpy.types.Panel):
bl_label = "Sky & Atmosphere"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
lamp = context.lamp
engine = context.scene.render.engine
- return (lamp and lamp.type == 'SUN') and (engine in self.COMPAT_ENGINES)
+ return (lamp and lamp.type == 'SUN') and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
lamp = context.lamp.sky
- wide_ui = context.region.width > narrowui
row = layout.row(align=True)
row.prop(lamp, "use_sky")
@@ -167,8 +154,7 @@ class DATA_PT_sunsky(DataButtonsPanel):
sub.row().prop(lamp, "sky_color_space", expand=True)
sub.prop(lamp, "sky_exposure", text="Exposure")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.active = lamp.use_sky
col.label(text="Horizon:")
sub = col.column()
@@ -193,8 +179,7 @@ class DATA_PT_sunsky(DataButtonsPanel):
col.prop(lamp, "sun_intensity", text="Sun")
col.prop(lamp, "atmosphere_distance_factor", text="Distance")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.active = lamp.use_atmosphere
col.label(text="Scattering:")
sub = col.column(align=True)
@@ -202,25 +187,36 @@ class DATA_PT_sunsky(DataButtonsPanel):
sub.prop(lamp, "atmosphere_extinction", slider=True, text="Extinction")
-class DATA_PT_shadow(DataButtonsPanel):
+class DATA_PT_shadow(DataButtonsPanel, bpy.types.Panel):
bl_label = "Shadow"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
lamp = context.lamp
engine = context.scene.render.engine
- return (lamp and lamp.type in ('POINT', 'SUN', 'SPOT', 'AREA')) and (engine in self.COMPAT_ENGINES)
+ return (lamp and lamp.type in ('POINT', 'SUN', 'SPOT', 'AREA')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
lamp = context.lamp
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(lamp, "shadow_method", expand=True)
- else:
- layout.prop(lamp, "shadow_method", text="")
+ layout.prop(lamp, "shadow_method", expand=True)
+
+ if lamp.shadow_method == 'NOSHADOW' and lamp.type == 'AREA':
+ split = layout.split()
+
+ col= split.column()
+ col.label(text="Form factor sampling:")
+
+ sub=col.row(align=True)
+
+ if lamp.shape == 'SQUARE':
+ sub.prop(lamp, "shadow_ray_samples_x", text="Samples")
+ elif lamp.shape == 'RECTANGLE':
+ sub.prop(lamp, "shadow_ray_samples_x", text="Samples X")
+ sub.prop(lamp, "shadow_ray_samples_y", text="Samples Y")
if lamp.shadow_method != 'NOSHADOW':
split = layout.split()
@@ -228,65 +224,51 @@ class DATA_PT_shadow(DataButtonsPanel):
col = split.column()
col.prop(lamp, "shadow_color", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(lamp, "shadow_layer", text="This Layer Only")
col.prop(lamp, "only_shadow")
if lamp.shadow_method == 'RAY_SHADOW':
- col = layout.column()
+ split = layout.split()
+
+ col = split.column()
col.label(text="Sampling:")
- if wide_ui:
- col.row().prop(lamp, "shadow_ray_sampling_method", expand=True)
- else:
- col.prop(lamp, "shadow_ray_sampling_method", text="")
-
+
if lamp.type in ('POINT', 'SUN', 'SPOT'):
- split = layout.split()
-
- col = split.column()
- col.prop(lamp, "shadow_soft_size", text="Soft Size")
-
- col.prop(lamp, "shadow_ray_samples", text="Samples")
- if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
- col.prop(lamp, "shadow_adaptive_threshold", text="Threshold")
- if wide_ui:
- col = split.column()
-
+ sub = col.row()
+
+ sub.prop(lamp, "shadow_ray_samples", text="Samples")
+ sub.prop(lamp, "shadow_soft_size", text="Soft Size")
+
elif lamp.type == 'AREA':
- split = layout.split()
-
- col = split.column()
-
+ sub = col.row(align=True)
+
if lamp.shape == 'SQUARE':
- col.prop(lamp, "shadow_ray_samples_x", text="Samples")
+ sub.prop(lamp, "shadow_ray_samples_x", text="Samples")
elif lamp.shape == 'RECTANGLE':
- col.prop(lamp, "shadow_ray_samples_x", text="Samples X")
- col.prop(lamp, "shadow_ray_samples_y", text="Samples Y")
-
- if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
- col.prop(lamp, "shadow_adaptive_threshold", text="Threshold")
- if wide_ui:
- col = split.column()
+ sub.prop(lamp, "shadow_ray_samples_x", text="Samples X")
+ sub.prop(lamp, "shadow_ray_samples_y", text="Samples Y")
- elif lamp.shadow_ray_sampling_method == 'CONSTANT_JITTERED':
- if wide_ui:
- col = split.column()
- col.prop(lamp, "umbra")
- col.prop(lamp, "dither")
- col.prop(lamp, "jitter")
- else:
- if wide_ui:
- col = split.column()
+ col.row().prop(lamp, "shadow_ray_sampling_method", expand=True)
+ split = layout.split()
+ col = split.column()
+
+ if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
+ col.prop(lamp, "shadow_adaptive_threshold", text="Threshold")
+ col = split.column()
+
+ if lamp.type == 'AREA' and lamp.shadow_ray_sampling_method == 'CONSTANT_JITTERED':
+ col = split.column()
+ col = split.column()
+ col.prop(lamp, "umbra")
+ col.prop(lamp, "dither")
+ col.prop(lamp, "jitter")
elif lamp.shadow_method == 'BUFFER_SHADOW':
col = layout.column()
col.label(text="Buffer Type:")
- if wide_ui:
- col.row().prop(lamp, "shadow_buffer_type", expand=True)
- else:
- col.row().prop(lamp, "shadow_buffer_type", text="")
+ col.row().prop(lamp, "shadow_buffer_type", expand=True)
if lamp.shadow_buffer_type in ('REGULAR', 'HALFWAY', 'DEEP'):
split = layout.split()
@@ -298,8 +280,7 @@ class DATA_PT_shadow(DataButtonsPanel):
sub.prop(lamp, "shadow_buffer_soft", text="Soft")
sub.prop(lamp, "shadow_buffer_bias", text="Bias")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Sample Buffers:")
col.prop(lamp, "shadow_sample_buffers", text="")
sub = col.column(align=True)
@@ -319,34 +300,34 @@ class DATA_PT_shadow(DataButtonsPanel):
sub.active = not lamp.auto_clip_start
sub.prop(lamp, "shadow_buffer_clip_start", text="Clip Start")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(lamp, "auto_clip_end", text="Autoclip End")
sub = col.column()
sub.active = not lamp.auto_clip_end
sub.prop(lamp, "shadow_buffer_clip_end", text=" Clip End")
-class DATA_PT_area(DataButtonsPanel):
+class DATA_PT_area(DataButtonsPanel, bpy.types.Panel):
bl_label = "Area Shape"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
lamp = context.lamp
engine = context.scene.render.engine
- return (lamp and lamp.type == 'AREA') and (engine in self.COMPAT_ENGINES)
+ return (lamp and lamp.type == 'AREA') and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
- layout = self.layout
-
lamp = context.lamp
+ layout = self.layout
split = layout.split()
col = split.column()
+
col.row().prop(lamp, "shape", expand=True)
+ sub = col.row(align=True)
- sub = col.column(align=True)
if (lamp.shape == 'SQUARE'):
sub.prop(lamp, "size")
elif (lamp.shape == 'RECTANGLE'):
@@ -354,20 +335,20 @@ class DATA_PT_area(DataButtonsPanel):
sub.prop(lamp, "size_y", text="Size Y")
-class DATA_PT_spot(DataButtonsPanel):
+class DATA_PT_spot(DataButtonsPanel, bpy.types.Panel):
bl_label = "Spot Shape"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
lamp = context.lamp
engine = context.scene.render.engine
- return (lamp and lamp.type == 'SPOT') and (engine in self.COMPAT_ENGINES)
+ return (lamp and lamp.type == 'SPOT') and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
lamp = context.lamp
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -378,10 +359,8 @@ class DATA_PT_spot(DataButtonsPanel):
col.prop(lamp, "square")
col.prop(lamp, "show_cone")
- if wide_ui:
- col = split.column()
- else:
- col.separator()
+ col = split.column()
+
col.prop(lamp, "halo")
sub = col.column(align=True)
sub.active = lamp.halo
@@ -390,16 +369,17 @@ class DATA_PT_spot(DataButtonsPanel):
sub.prop(lamp, "halo_step", text="Step")
-class DATA_PT_falloff_curve(DataButtonsPanel):
+class DATA_PT_falloff_curve(DataButtonsPanel, bpy.types.Panel):
bl_label = "Falloff Curve"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
lamp = context.lamp
engine = context.scene.render.engine
- return (lamp and lamp.type in ('POINT', 'SPOT') and lamp.falloff_type == 'CUSTOM_CURVE') and (engine in self.COMPAT_ENGINES)
+ return (lamp and lamp.type in ('POINT', 'SPOT') and lamp.falloff_type == 'CUSTOM_CURVE') and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
lamp = context.lamp
@@ -407,31 +387,12 @@ class DATA_PT_falloff_curve(DataButtonsPanel):
self.layout.template_curve_mapping(lamp, "falloff_curve")
-classes = [
- LAMP_MT_sunsky_presets,
-
- DATA_PT_context_lamp,
- DATA_PT_preview,
- DATA_PT_lamp,
- DATA_PT_falloff_curve,
- DATA_PT_area,
- DATA_PT_spot,
- DATA_PT_shadow,
- DATA_PT_sunsky,
-
- DATA_PT_custom_props_lamp]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_data_lattice.py b/release/scripts/ui/properties_data_lattice.py
index 2aa719437a7..5e313b79d85 100644
--- a/release/scripts/ui/properties_data_lattice.py
+++ b/release/scripts/ui/properties_data_lattice.py
@@ -20,19 +20,18 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
-class DataButtonsPanel(bpy.types.Panel):
+class DataButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.lattice
-class DATA_PT_context_lattice(DataButtonsPanel):
+class DATA_PT_context_lattice(DataButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
@@ -42,55 +41,45 @@ class DATA_PT_context_lattice(DataButtonsPanel):
ob = context.object
lat = context.lattice
space = context.space_data
- wide_ui = context.region.width > narrowui
-
- if wide_ui:
- split = layout.split(percentage=0.65)
- if ob:
- split.template_ID(ob, "data")
- split.separator()
- elif lat:
- split.template_ID(space, "pin_id")
- split.separator()
- else:
- if ob:
- layout.template_ID(ob, "data")
- elif lat:
- layout.template_ID(space, "pin_id")
-
-
-class DATA_PT_custom_props_lattice(DataButtonsPanel, PropertyPanel):
+
+ split = layout.split(percentage=0.65)
+ if ob:
+ split.template_ID(ob, "data")
+ split.separator()
+ elif lat:
+ split.template_ID(space, "pin_id")
+ split.separator()
+
+
+class DATA_PT_custom_props_lattice(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
-class DATA_PT_lattice(DataButtonsPanel):
+class DATA_PT_lattice(DataButtonsPanel, bpy.types.Panel):
bl_label = "Lattice"
def draw(self, context):
layout = self.layout
lat = context.lattice
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.prop(lat, "points_u")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(lat, "interpolation_type_u", text="")
split = layout.split()
col = split.column()
col.prop(lat, "points_v")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(lat, "interpolation_type_v", text="")
split = layout.split()
col = split.column()
col.prop(lat, "points_w")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(lat, "interpolation_type_w", text="")
row = layout.row()
@@ -98,23 +87,12 @@ class DATA_PT_lattice(DataButtonsPanel):
row.prop_object(lat, "vertex_group", context.object, "vertex_groups", text="")
-classes = [
- DATA_PT_context_lattice,
- DATA_PT_lattice,
-
- DATA_PT_custom_props_lattice]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_data_mesh.py b/release/scripts/ui/properties_data_mesh.py
index c3170be8860..1be2ce824fa 100644
--- a/release/scripts/ui/properties_data_mesh.py
+++ b/release/scripts/ui/properties_data_mesh.py
@@ -20,8 +20,6 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
class MESH_MT_vertex_group_specials(bpy.types.Menu):
bl_label = "Vertex Group Specials"
@@ -49,17 +47,18 @@ class MESH_MT_shape_key_specials(bpy.types.Menu):
layout.operator("object.shape_key_mirror", icon='ARROW_LEFTRIGHT')
-class DataButtonsPanel(bpy.types.Panel):
+class MeshButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
engine = context.scene.render.engine
- return context.mesh and (engine in self.COMPAT_ENGINES)
+ return context.mesh and (engine in cls.COMPAT_ENGINES)
-class DATA_PT_context_mesh(DataButtonsPanel):
+class DATA_PT_context_mesh(MeshButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -70,29 +69,22 @@ class DATA_PT_context_mesh(DataButtonsPanel):
ob = context.object
mesh = context.mesh
space = context.space_data
- wide_ui = context.region.width > narrowui
-
- if wide_ui:
- split = layout.split(percentage=0.65)
- if ob:
- split.template_ID(ob, "data")
- split.separator()
- elif mesh:
- split.template_ID(space, "pin_id")
- split.separator()
- else:
- if ob:
- layout.template_ID(ob, "data")
- elif mesh:
- layout.template_ID(space, "pin_id")
+ split = layout.split(percentage=0.65)
+ if ob:
+ split.template_ID(ob, "data")
+ split.separator()
+ elif mesh:
+ split.template_ID(space, "pin_id")
+ split.separator()
-class DATA_PT_custom_props_mesh(DataButtonsPanel, PropertyPanel):
- _context_path = "object.data"
+
+class DATA_PT_custom_props_mesh(MeshButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "object.data"
-class DATA_PT_normals(DataButtonsPanel):
+class DATA_PT_normals(MeshButtonsPanel, bpy.types.Panel):
bl_label = "Normals"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -100,7 +92,6 @@ class DATA_PT_normals(DataButtonsPanel):
layout = self.layout
mesh = context.mesh
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -110,14 +101,12 @@ class DATA_PT_normals(DataButtonsPanel):
sub.active = mesh.autosmooth
sub.prop(mesh, "autosmooth_angle", text="Angle")
- if wide_ui:
- col = split.column()
- else:
- col.separator()
+ col = split.column()
+
col.prop(mesh, "double_sided")
-class DATA_PT_settings(DataButtonsPanel):
+class DATA_PT_settings(MeshButtonsPanel, bpy.types.Panel):
bl_label = "Settings"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -129,13 +118,15 @@ class DATA_PT_settings(DataButtonsPanel):
layout.prop(mesh, "texture_mesh")
-class DATA_PT_vertex_groups(DataButtonsPanel):
+class DATA_PT_vertex_groups(MeshButtonsPanel, bpy.types.Panel):
bl_label = "Vertex Groups"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
engine = context.scene.render.engine
- return (context.object and context.object.type in ('MESH', 'LATTICE') and (engine in self.COMPAT_ENGINES))
+ obj = context.object
+ return (obj and obj.type in ('MESH', 'LATTICE') and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@@ -176,13 +167,15 @@ class DATA_PT_vertex_groups(DataButtonsPanel):
layout.prop(context.tool_settings, "vertex_group_weight", text="Weight")
-class DATA_PT_shape_keys(DataButtonsPanel):
+class DATA_PT_shape_keys(MeshButtonsPanel, bpy.types.Panel):
bl_label = "Shape Keys"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
engine = context.scene.render.engine
- return (context.object and context.object.type in ('MESH', 'LATTICE', 'CURVE', 'SURFACE') and (engine in self.COMPAT_ENGINES))
+ obj = context.object
+ return (obj and obj.type in ('MESH', 'LATTICE', 'CURVE', 'SURFACE') and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@@ -190,7 +183,6 @@ class DATA_PT_shape_keys(DataButtonsPanel):
ob = context.object
key = ob.data.shape_keys
kb = ob.active_shape_key
- wide_ui = context.region.width > narrowui
enable_edit = ob.mode != 'EDIT'
enable_edit_value = False
@@ -223,17 +215,11 @@ class DATA_PT_shape_keys(DataButtonsPanel):
split = layout.split(percentage=0.4)
row = split.row()
row.enabled = enable_edit
- if wide_ui:
- row.prop(key, "relative")
+ row.prop(key, "relative")
row = split.row()
row.alignment = 'RIGHT'
- if not wide_ui:
- layout.prop(key, "relative")
- row = layout.row()
-
-
sub = row.row(align=True)
subsub = sub.row(align=True)
subsub.active = enable_edit_value
@@ -261,8 +247,7 @@ class DATA_PT_shape_keys(DataButtonsPanel):
col.prop(kb, "slider_min", text="Min")
col.prop(kb, "slider_max", text="Max")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.active = enable_edit_value
col.label(text="Blend:")
col.prop_object(kb, "vertex_group", ob, "vertex_groups", text="")
@@ -274,7 +259,7 @@ class DATA_PT_shape_keys(DataButtonsPanel):
row.prop(key, "slurph")
-class DATA_PT_uv_texture(DataButtonsPanel):
+class DATA_PT_uv_texture(MeshButtonsPanel, bpy.types.Panel):
bl_label = "UV Texture"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -297,11 +282,12 @@ class DATA_PT_uv_texture(DataButtonsPanel):
layout.prop(lay, "name")
-class DATA_PT_texface(DataButtonsPanel):
+class DATA_PT_texface(MeshButtonsPanel, bpy.types.Panel):
bl_label = "Texture Face"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
ob = context.active_object
rd = context.scene.render
@@ -311,7 +297,6 @@ class DATA_PT_texface(DataButtonsPanel):
layout = self.layout
col = layout.column()
- wide_ui = context.region.width > narrowui
me = context.mesh
tf = me.faces.active_tface
@@ -329,8 +314,7 @@ class DATA_PT_texface(DataButtonsPanel):
col.prop(tf, "twoside")
col.prop(tf, "object_color")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(tf, "halo")
col.prop(tf, "billboard")
@@ -344,7 +328,7 @@ class DATA_PT_texface(DataButtonsPanel):
col.label(text="No UV Texture")
-class DATA_PT_vertex_colors(DataButtonsPanel):
+class DATA_PT_vertex_colors(MeshButtonsPanel, bpy.types.Panel):
bl_label = "Vertex Colors"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -367,32 +351,12 @@ class DATA_PT_vertex_colors(DataButtonsPanel):
layout.prop(lay, "name")
-classes = [
- MESH_MT_vertex_group_specials,
- MESH_MT_shape_key_specials,
-
- DATA_PT_context_mesh,
- DATA_PT_normals,
- DATA_PT_settings,
- DATA_PT_vertex_groups,
- DATA_PT_shape_keys,
- DATA_PT_uv_texture,
- DATA_PT_texface,
- DATA_PT_vertex_colors,
-
- DATA_PT_custom_props_mesh]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_data_metaball.py b/release/scripts/ui/properties_data_metaball.py
index e0155059b98..a6b1bb75cbe 100644
--- a/release/scripts/ui/properties_data_metaball.py
+++ b/release/scripts/ui/properties_data_metaball.py
@@ -20,19 +20,18 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
-class DataButtonsPanel(bpy.types.Panel):
+class DataButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.meta_ball
-class DATA_PT_context_metaball(DataButtonsPanel):
+class DATA_PT_context_metaball(DataButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
@@ -42,35 +41,28 @@ class DATA_PT_context_metaball(DataButtonsPanel):
ob = context.object
mball = context.meta_ball
space = context.space_data
- wide_ui = context.region.width > narrowui
-
- if wide_ui:
- split = layout.split(percentage=0.65)
- if ob:
- split.template_ID(ob, "data")
- split.separator()
- elif mball:
- split.template_ID(space, "pin_id")
- split.separator()
- else:
- if ob:
- layout.template_ID(ob, "data")
- elif mball:
- layout.template_ID(space, "pin_id")
-
-
-class DATA_PT_custom_props_metaball(DataButtonsPanel, PropertyPanel):
+
+ split = layout.split(percentage=0.65)
+ if ob:
+ split.template_ID(ob, "data")
+ split.separator()
+ elif mball:
+ split.template_ID(space, "pin_id")
+ split.separator()
+
+
+class DATA_PT_custom_props_metaball(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
-class DATA_PT_metaball(DataButtonsPanel):
+class DATA_PT_metaball(DataButtonsPanel, bpy.types.Panel):
bl_label = "Metaball"
def draw(self, context):
layout = self.layout
mball = context.meta_ball
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -80,34 +72,27 @@ class DATA_PT_metaball(DataButtonsPanel):
sub.prop(mball, "wire_size", text="View")
sub.prop(mball, "render_size", text="Render")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Settings:")
col.prop(mball, "threshold", text="Threshold")
layout.label(text="Update:")
- if wide_ui:
- layout.prop(mball, "flag", expand=True)
- else:
- layout.prop(mball, "flag", text="")
+ layout.prop(mball, "flag", expand=True)
-class DATA_PT_metaball_element(DataButtonsPanel):
+class DATA_PT_metaball_element(DataButtonsPanel, bpy.types.Panel):
bl_label = "Active Element"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.meta_ball and context.meta_ball.active_element)
def draw(self, context):
layout = self.layout
metaelem = context.meta_ball.active_element
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(metaelem, "type")
- else:
- layout.prop(metaelem, "type", text="")
+ layout.prop(metaelem, "type")
split = layout.split()
@@ -117,8 +102,7 @@ class DATA_PT_metaball_element(DataButtonsPanel):
col.prop(metaelem, "negative", text="Negative")
col.prop(metaelem, "hide", text="Hide")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
if metaelem.type in ('CUBE', 'ELLIPSOID'):
col.label(text="Size:")
@@ -136,24 +120,12 @@ class DATA_PT_metaball_element(DataButtonsPanel):
col.prop(metaelem, "size_y", text="Y")
-classes = [
- DATA_PT_context_metaball,
- DATA_PT_metaball,
- DATA_PT_metaball_element,
-
- DATA_PT_custom_props_metaball]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_data_modifier.py b/release/scripts/ui/properties_data_modifier.py
index 37764e20854..2847810f417 100644
--- a/release/scripts/ui/properties_data_modifier.py
+++ b/release/scripts/ui/properties_data_modifier.py
@@ -19,47 +19,41 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-narrowmod = 260
-
-class DataButtonsPanel(bpy.types.Panel):
+class ModifierButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "modifier"
-class DATA_PT_modifiers(DataButtonsPanel):
+class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
bl_label = "Modifiers"
def draw(self, context):
layout = self.layout
ob = context.object
- wide_ui = context.region.width > narrowui
- compact_mod = context.region.width < narrowmod
layout.operator_menu_enum("object.modifier_add", "type")
for md in ob.modifiers:
- box = layout.template_modifier(md, compact=compact_mod)
+ box = layout.template_modifier(md)
if box:
# match enum type to our functions, avoids a lookup table.
- getattr(self, md.type)(box, ob, md, wide_ui)
+ getattr(self, md.type)(box, ob, md)
# the mt.type enum is (ab)used for a lookup on function names
# ...to avoid lengthy if statements
# so each type must have a function here.
- def ARMATURE(self, layout, ob, md, wide_ui):
+ def ARMATURE(self, layout, ob, md):
split = layout.split()
col = split.column()
col.label(text="Object:")
col.prop(md, "object", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Vertex Group::")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
sub = col.column()
@@ -73,18 +67,13 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.prop(md, "use_vertex_groups", text="Vertex Groups")
col.prop(md, "use_bone_envelopes", text="Bone Envelopes")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Deformation:")
col.prop(md, "quaternion")
col.prop(md, "multi_modifier")
- def ARRAY(self, layout, ob, md, wide_ui):
- if wide_ui:
- layout.prop(md, "fit_type")
- else:
- layout.prop(md, "fit_type", text="")
-
+ def ARRAY(self, layout, ob, md):
+ layout.prop(md, "fit_type")
if md.fit_type == 'FIXED_COUNT':
layout.prop(md, "count")
@@ -111,8 +100,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
sub.prop(md, "merge_end_vertices", text="First Last")
sub.prop(md, "merge_distance", text="Distance")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(md, "relative_offset")
sub = col.column()
sub.active = md.relative_offset
@@ -131,14 +119,13 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.prop(md, "start_cap")
col.prop(md, "end_cap")
- def BEVEL(self, layout, ob, md, wide_ui):
+ def BEVEL(self, layout, ob, md):
split = layout.split()
col = split.column()
col.prop(md, "width")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(md, "only_vertices")
layout.label(text="Limit Method:")
@@ -148,40 +135,35 @@ class DATA_PT_modifiers(DataButtonsPanel):
elif md.limit_method == 'WEIGHT':
layout.row().prop(md, "edge_weight_method", expand=True)
- def BOOLEAN(self, layout, ob, md, wide_ui):
+ def BOOLEAN(self, layout, ob, md):
split = layout.split()
col = split.column()
col.label(text="Operation:")
col.prop(md, "operation", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Object:")
col.prop(md, "object", text="")
- def BUILD(self, layout, ob, md, wide_ui):
+ def BUILD(self, layout, ob, md):
split = layout.split()
col = split.column()
col.prop(md, "frame_start")
col.prop(md, "length")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(md, "randomize")
sub = col.column()
sub.active = md.randomize
sub.prop(md, "seed")
- def CAST(self, layout, ob, md, wide_ui):
+ def CAST(self, layout, ob, md):
split = layout.split(percentage=0.25)
- if wide_ui:
- split.label(text="Cast Type:")
- split.prop(md, "cast_type", text="")
- else:
- layout.prop(md, "cast_type", text="")
+ split.label(text="Cast Type:")
+ split.prop(md, "cast_type", text="")
split = layout.split(percentage=0.25)
@@ -201,37 +183,35 @@ class DATA_PT_modifiers(DataButtonsPanel):
col = split.column()
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Control Object:")
col.prop(md, "object", text="")
if md.object:
col.prop(md, "use_transform")
- def CLOTH(self, layout, ob, md, wide_ui):
+ def CLOTH(self, layout, ob, md):
layout.label(text="See Cloth panel.")
- def COLLISION(self, layout, ob, md, wide_ui):
+ def COLLISION(self, layout, ob, md):
layout.label(text="See Collision panel.")
- def CURVE(self, layout, ob, md, wide_ui):
+ def CURVE(self, layout, ob, md):
split = layout.split()
col = split.column()
col.label(text="Object:")
col.prop(md, "object", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
layout.label(text="Deformation Axis:")
layout.row().prop(md, "deform_axis", expand=True)
- def DECIMATE(self, layout, ob, md, wide_ui):
+ def DECIMATE(self, layout, ob, md):
layout.prop(md, "ratio")
layout.label(text="Face Count: %s" % str(md.face_count))
- def DISPLACE(self, layout, ob, md, wide_ui):
+ def DISPLACE(self, layout, ob, md):
split = layout.split()
col = split.column()
@@ -240,8 +220,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Direction:")
col.prop(md, "direction", text="")
col.label(text="Texture Coordinates:")
@@ -258,11 +237,10 @@ class DATA_PT_modifiers(DataButtonsPanel):
col = split.column()
col.prop(md, "midlevel")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(md, "strength")
- def EDGE_SPLIT(self, layout, ob, md, wide_ui):
+ def EDGE_SPLIT(self, layout, ob, md):
split = layout.split()
col = split.column()
@@ -271,11 +249,10 @@ class DATA_PT_modifiers(DataButtonsPanel):
sub.active = md.use_edge_angle
sub.prop(md, "split_angle")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(md, "use_sharp", text="Sharp Edges")
- def EXPLODE(self, layout, ob, md, wide_ui):
+ def EXPLODE(self, layout, ob, md):
split = layout.split()
col = split.column()
@@ -285,8 +262,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
sub.active = bool(md.vertex_group)
sub.prop(md, "protect")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(md, "split_edges")
col.prop(md, "unborn")
col.prop(md, "alive")
@@ -295,10 +271,10 @@ class DATA_PT_modifiers(DataButtonsPanel):
layout.operator("object.explode_refresh", text="Refresh")
- def FLUID_SIMULATION(self, layout, ob, md, wide_ui):
+ def FLUID_SIMULATION(self, layout, ob, md):
layout.label(text="See Fluid panel.")
- def HOOK(self, layout, ob, md, wide_ui):
+ def HOOK(self, layout, ob, md):
split = layout.split()
col = split.column()
@@ -307,8 +283,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
if md.object and md.object.type == 'ARMATURE':
col.label(text="Bone:")
col.prop_object(md, "subtarget", md.object.data, "bones", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
@@ -319,10 +294,8 @@ class DATA_PT_modifiers(DataButtonsPanel):
col = split.column()
col.prop(md, "falloff")
col.prop(md, "force", slider=True)
- if wide_ui:
- col = split.column()
- else:
- col.separator()
+
+ col = split.column()
col.operator("object.hook_reset", text="Reset")
col.operator("object.hook_recenter", text="Recenter")
@@ -332,26 +305,24 @@ class DATA_PT_modifiers(DataButtonsPanel):
row.operator("object.hook_select", text="Select")
row.operator("object.hook_assign", text="Assign")
- def LATTICE(self, layout, ob, md, wide_ui):
+ def LATTICE(self, layout, ob, md):
split = layout.split()
col = split.column()
col.label(text="Object:")
col.prop(md, "object", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
- def MASK(self, layout, ob, md, wide_ui):
+ def MASK(self, layout, ob, md):
split = layout.split()
col = split.column()
col.label(text="Mode:")
col.prop(md, "mode", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
if md.mode == 'ARMATURE':
col.label(text="Armature:")
col.prop(md, "armature", text="")
@@ -363,15 +334,14 @@ class DATA_PT_modifiers(DataButtonsPanel):
sub.active = bool(md.vertex_group)
sub.prop(md, "invert")
- def MESH_DEFORM(self, layout, ob, md, wide_ui):
+ def MESH_DEFORM(self, layout, ob, md):
split = layout.split()
col = split.column()
sub = col.column()
sub.label(text="Object:")
sub.prop(md, "object", text="")
sub.active = not md.is_bound
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
@@ -391,16 +361,12 @@ class DATA_PT_modifiers(DataButtonsPanel):
col = split.column()
col.prop(md, "precision")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(md, "dynamic")
- def MIRROR(self, layout, ob, md, wide_ui):
+ def MIRROR(self, layout, ob, md):
layout.prop(md, "merge_limit")
- if wide_ui:
- split = layout.split(percentage=0.25)
- else:
- split = layout.split(percentage=0.4)
+ split = layout.split(percentage=0.25)
col = split.column()
col.label(text="Axis:")
@@ -408,11 +374,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.prop(md, "y")
col.prop(md, "z")
- if wide_ui:
- col = split.column()
- else:
- subsplit = layout.split()
- col = subsplit.column()
+ col = split.column()
col.label(text="Options:")
col.prop(md, "clip", text="Clipping")
col.prop(md, "mirror_vertex_groups", text="Vertex Groups")
@@ -426,11 +388,8 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.label(text="Mirror Object:")
col.prop(md, "mirror_object", text="")
- def MULTIRES(self, layout, ob, md, wide_ui):
- if wide_ui:
- layout.row().prop(md, "subdivision_type", expand=True)
- else:
- layout.row().prop(md, "subdivision_type", text="")
+ def MULTIRES(self, layout, ob, md):
+ layout.row().prop(md, "subdivision_type", expand=True)
split = layout.split()
col = split.column()
@@ -438,8 +397,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.prop(md, "sculpt_levels", text="Sculpt")
col.prop(md, "render_levels", text="Render")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.enabled = ob.mode != 'EDIT'
col.operator("object.multires_subdivide", text="Subdivide")
@@ -460,7 +418,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
row.operator("object.multires_external_save", text="Save External...")
row.label()
- def PARTICLE_INSTANCE(self, layout, ob, md, wide_ui):
+ def PARTICLE_INSTANCE(self, layout, ob, md):
layout.prop(md, "object")
layout.prop(md, "particle_system_number", text="Particle System")
@@ -471,8 +429,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.prop(md, "children")
col.prop(md, "size")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Show Particles When:")
col.prop(md, "alive")
col.prop(md, "unborn")
@@ -488,15 +445,14 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.row().prop(md, "axis", expand=True)
col.prop(md, "keep_shape")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(md, "position", slider=True)
col.prop(md, "random_position", text="Random", slider=True)
- def PARTICLE_SYSTEM(self, layout, ob, md, wide_ui):
+ def PARTICLE_SYSTEM(self, layout, ob, md):
layout.label(text="See Particle panel.")
- def SCREW(self, layout, ob, md, wide_ui):
+ def SCREW(self, layout, ob, md):
split = layout.split()
col = split.column()
@@ -506,8 +462,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.prop(md, "steps")
col.prop(md, "render_steps")
- if wide_ui:
- col = split.column()
+ col = split.column()
row = col.row()
row.active = (md.object is None or md.use_object_screw_offset == False)
row.prop(md, "screw_offset")
@@ -518,13 +473,12 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.prop(md, "use_normal_flip")
col.prop(md, "iterations")
- def SHRINKWRAP(self, layout, ob, md, wide_ui):
+ def SHRINKWRAP(self, layout, ob, md):
split = layout.split()
col = split.column()
col.label(text="Target:")
col.prop(md, "target", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
@@ -534,15 +488,12 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.prop(md, "offset")
col.prop(md, "subsurf_levels")
- if wide_ui:
- col = split.column()
- col.label(text="Mode:")
+ col = split.column()
+ col.label(text="Mode:")
col.prop(md, "mode", text="")
- if wide_ui:
- split = layout.split(percentage=0.25)
- else:
- split = layout.split(percentage=0.35)
+ split = layout.split(percentage=0.25)
+
col = split.column()
if md.mode == 'PROJECT':
@@ -556,11 +507,8 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.prop(md, "negative")
col.prop(md, "positive")
- if wide_ui:
- col = split.column()
- else:
- subsplit = layout.split()
- col = subsplit.column()
+ col = split.column()
+
col.label(text="Cull Faces:")
col.prop(md, "cull_front_faces", text="Front")
col.prop(md, "cull_back_faces", text="Back")
@@ -571,15 +519,14 @@ class DATA_PT_modifiers(DataButtonsPanel):
elif md.mode == 'NEAREST_SURFACEPOINT':
layout.prop(md, "keep_above_surface")
- def SIMPLE_DEFORM(self, layout, ob, md, wide_ui):
+ def SIMPLE_DEFORM(self, layout, ob, md):
split = layout.split()
col = split.column()
col.label(text="Mode:")
col.prop(md, "mode", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
@@ -592,8 +539,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
sub.active = (md.origin != "")
sub.prop(md, "relative")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Deform:")
col.prop(md, "factor")
col.prop(md, "limits", slider=True)
@@ -601,10 +547,10 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.prop(md, "lock_x_axis")
col.prop(md, "lock_y_axis")
- def SMOKE(self, layout, ob, md, wide_ui):
+ def SMOKE(self, layout, ob, md):
layout.label(text="See Smoke panel.")
- def SMOOTH(self, layout, ob, md, wide_ui):
+ def SMOOTH(self, layout, ob, md):
split = layout.split(percentage=0.25)
col = split.column()
@@ -619,10 +565,10 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
- def SOFT_BODY(self, layout, ob, md, wide_ui):
+ def SOFT_BODY(self, layout, ob, md):
layout.label(text="See Soft Body panel.")
- def SOLIDIFY(self, layout, ob, md, wide_ui):
+ def SOLIDIFY(self, layout, ob, md):
split = layout.split()
@@ -635,8 +581,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.prop(md, "edge_crease_outer", text="Outer")
col.prop(md, "edge_crease_rim", text="Rim")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(md, "offset")
colsub = col.column()
@@ -655,11 +600,8 @@ class DATA_PT_modifiers(DataButtonsPanel):
# col.label(text="Vertex Group:")
# col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
- def SUBSURF(self, layout, ob, md, wide_ui):
- if wide_ui:
- layout.row().prop(md, "subdivision_type", expand=True)
- else:
- layout.row().prop(md, "subdivision_type", text="")
+ def SUBSURF(self, layout, ob, md):
+ layout.row().prop(md, "subdivision_type", expand=True)
split = layout.split()
col = split.column()
@@ -667,16 +609,15 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.prop(md, "levels", text="View")
col.prop(md, "render_levels", text="Render")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Options:")
col.prop(md, "subsurf_uv")
col.prop(md, "optimal_display")
- def SURFACE(self, layout, ob, md, wide_ui):
+ def SURFACE(self, layout, ob, md):
layout.label(text="See Fields panel.")
- def UV_PROJECT(self, layout, ob, md, wide_ui):
+ def UV_PROJECT(self, layout, ob, md):
if ob.type == 'MESH':
split = layout.split()
@@ -684,8 +625,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.label(text="Image:")
col.prop(md, "image", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="UV Layer:")
col.prop_object(md, "uv_layer", ob.data, "uv_textures", text="")
@@ -696,8 +636,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
for proj in md.projectors:
col.prop(proj, "object", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
sub = col.column(align=True)
sub.prop(md, "aspect_x", text="Aspect X")
sub.prop(md, "aspect_y", text="Aspect Y")
@@ -706,7 +645,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
sub.prop(md, "scale_x", text="Scale X")
sub.prop(md, "scale_y", text="Scale Y")
- def WAVE(self, layout, ob, md, wide_ui):
+ def WAVE(self, layout, ob, md):
split = layout.split()
col = split.column()
@@ -715,8 +654,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.prop(md, "y")
col.prop(md, "cyclic")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(md, "normals")
sub = col.column()
sub.active = md.normals
@@ -733,8 +671,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
sub.prop(md, "lifetime", text="Life")
col.prop(md, "damping_time", text="Damping")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Position:")
sub = col.column(align=True)
sub.prop(md, "start_position_x", text="X")
@@ -760,26 +697,17 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.prop(md, "speed", slider=True)
col.prop(md, "height", slider=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(md, "width", slider=True)
col.prop(md, "narrowness", slider=True)
-classes = [
- DATA_PT_modifiers]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_game.py b/release/scripts/ui/properties_game.py
index 88803993c92..608976f373c 100644
--- a/release/scripts/ui/properties_game.py
+++ b/release/scripts/ui/properties_game.py
@@ -19,36 +19,31 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
-class PhysicsButtonsPanel(bpy.types.Panel):
+class PhysicsButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "physics"
- def poll(self, context):
- ob = context.active_object
- rd = context.scene.render
- return ob and ob.game and (rd.engine in self.COMPAT_ENGINES)
-
-class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
+class PHYSICS_PT_game_physics(PhysicsButtonsPanel, bpy.types.Panel):
bl_label = "Physics"
COMPAT_ENGINES = {'BLENDER_GAME'}
+ @classmethod
+ def poll(cls, context):
+ ob = context.active_object
+ rd = context.scene.render
+ return ob and ob.game and (rd.engine in cls.COMPAT_ENGINES)
+
def draw(self, context):
layout = self.layout
ob = context.active_object
game = ob.game
soft = ob.game.soft_body
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(game, "physics_type")
- else:
- layout.prop(game, "physics_type", text="")
+ layout.prop(game, "physics_type")
layout.separator()
#if game.physics_type == 'DYNAMIC':
@@ -60,8 +55,7 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
col.prop(game, "ghost")
col.prop(ob, "hide_render", text="Invisible") # out of place but useful
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(game, "material_physics")
col.prop(game, "rotate_from_normal")
col.prop(game, "no_sleeping")
@@ -76,8 +70,7 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
col.prop(game, "radius")
col.prop(game, "form_factor")
- if wide_ui:
- col = split.column()
+ col = split.column()
sub = col.column()
sub.active = (game.physics_type == 'RIGID_BODY')
sub.prop(game, "anisotropic_friction")
@@ -93,8 +86,7 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
sub.prop(game, "minimum_velocity", text="Minimum")
sub.prop(game, "maximum_velocity", text="Maximum")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Damping:")
sub = col.column(align=True)
sub.prop(game, "damping", text="Translation", slider=True)
@@ -136,8 +128,7 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
col.prop(soft, "margin", slider=True)
col.prop(soft, "bending_const", text="Bending Constraints")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(soft, "shape_match")
sub = col.column()
sub.active = soft.shape_match
@@ -162,14 +153,15 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
layout.prop(ob, "hide_render", text="Invisible")
-class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel):
+class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel, bpy.types.Panel):
bl_label = "Collision Bounds"
COMPAT_ENGINES = {'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
game = context.object.game
rd = context.scene.render
- return (game.physics_type in ('DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC')) and (rd.engine in self.COMPAT_ENGINES)
+ return (game.physics_type in ('DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC')) and (rd.engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
game = context.active_object.game
@@ -180,35 +172,31 @@ class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel):
layout = self.layout
game = context.active_object.game
- wide_ui = context.region.width > narrowui
layout.active = game.use_collision_bounds
- if wide_ui:
- layout.prop(game, "collision_bounds", text="Bounds")
- else:
- layout.prop(game, "collision_bounds", text="")
+ layout.prop(game, "collision_bounds", text="Bounds")
split = layout.split()
col = split.column()
col.prop(game, "collision_margin", text="Margin", slider=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(game, "collision_compound", text="Compound")
-class RenderButtonsPanel(bpy.types.Panel):
+class RenderButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "render"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
rd = context.scene.render
- return (rd.engine in self.COMPAT_ENGINES)
+ return (rd.engine in cls.COMPAT_ENGINES)
-class RENDER_PT_game(RenderButtonsPanel):
+class RENDER_PT_game(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Game"
COMPAT_ENGINES = {'BLENDER_GAME'}
@@ -220,7 +208,7 @@ class RENDER_PT_game(RenderButtonsPanel):
row.label()
-class RENDER_PT_game_player(RenderButtonsPanel):
+class RENDER_PT_game_player(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Standalone Player"
COMPAT_ENGINES = {'BLENDER_GAME'}
@@ -228,7 +216,6 @@ class RENDER_PT_game_player(RenderButtonsPanel):
layout = self.layout
gs = context.scene.game_data
- wide_ui = context.region.width > narrowui
layout.prop(gs, "fullscreen")
@@ -240,8 +227,7 @@ class RENDER_PT_game_player(RenderButtonsPanel):
sub.prop(gs, "resolution_x", slider=False, text="X")
sub.prop(gs, "resolution_y", slider=False, text="Y")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Quality:")
sub = col.column(align=True)
sub.prop(gs, "depth", text="Bit Depth", slider=False)
@@ -250,15 +236,12 @@ class RENDER_PT_game_player(RenderButtonsPanel):
# framing:
col = layout.column()
col.label(text="Framing:")
- if wide_ui:
- col.row().prop(gs, "framing_type", expand=True)
- else:
- col.prop(gs, "framing_type", text="")
+ col.row().prop(gs, "framing_type", expand=True)
if gs.framing_type == 'LETTERBOX':
col.prop(gs, "framing_color", text="")
-class RENDER_PT_game_stereo(RenderButtonsPanel):
+class RENDER_PT_game_stereo(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Stereo"
COMPAT_ENGINES = {'BLENDER_GAME'}
@@ -267,7 +250,6 @@ class RENDER_PT_game_stereo(RenderButtonsPanel):
gs = context.scene.game_data
stereo_mode = gs.stereo
- wide_ui = context.region.width > narrowui
# stereo options:
layout.prop(gs, "stereo", expand=True)
@@ -279,10 +261,7 @@ class RENDER_PT_game_stereo(RenderButtonsPanel):
# dome:
elif stereo_mode == 'DOME':
- if wide_ui:
- layout.prop(gs, "dome_mode", text="Dome Type")
- else:
- layout.prop(gs, "dome_mode", text="")
+ layout.prop(gs, "dome_mode", text="Dome Type")
dome_type = gs.dome_mode
@@ -296,8 +275,7 @@ class RENDER_PT_game_stereo(RenderButtonsPanel):
col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
col.prop(gs, "dome_angle", slider=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(gs, "dome_tesselation", text="Tesselation")
col.prop(gs, "dome_tilt")
@@ -305,20 +283,19 @@ class RENDER_PT_game_stereo(RenderButtonsPanel):
col = split.column()
col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(gs, "dome_tesselation", text="Tesselation")
else: # cube map
col = split.column()
col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
- if wide_ui:
- col = split.column()
+
+ col = split.column()
layout.prop(gs, "dome_text")
-class RENDER_PT_game_shading(RenderButtonsPanel):
+class RENDER_PT_game_shading(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Shading"
COMPAT_ENGINES = {'BLENDER_GAME'}
@@ -326,12 +303,8 @@ class RENDER_PT_game_shading(RenderButtonsPanel):
layout = self.layout
gs = context.scene.game_data
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(gs, "material_mode", expand=True)
- else:
- layout.prop(gs, "material_mode", text="")
+ layout.prop(gs, "material_mode", expand=True)
if gs.material_mode == 'GLSL':
split = layout.split()
@@ -347,7 +320,7 @@ class RENDER_PT_game_shading(RenderButtonsPanel):
col.prop(gs, "glsl_extra_textures", text="Extra Textures")
-class RENDER_PT_game_performance(RenderButtonsPanel):
+class RENDER_PT_game_performance(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Performance"
COMPAT_ENGINES = {'BLENDER_GAME'}
@@ -355,7 +328,6 @@ class RENDER_PT_game_performance(RenderButtonsPanel):
layout = self.layout
gs = context.scene.game_data
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -366,14 +338,14 @@ class RENDER_PT_game_performance(RenderButtonsPanel):
col.prop(gs, "show_physics_visualization", text="Physics Visualization")
col.prop(gs, "use_deprecation_warnings")
- if wide_ui:
- col = split.column()
+ col = split.column()
+
col.label(text="Render:")
col.prop(gs, "use_frame_rate")
col.prop(gs, "use_display_lists")
-class RENDER_PT_game_sound(RenderButtonsPanel):
+class RENDER_PT_game_sound(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Sound"
COMPAT_ENGINES = {'BLENDER_GAME'}
@@ -381,32 +353,26 @@ class RENDER_PT_game_sound(RenderButtonsPanel):
layout = self.layout
scene = context.scene
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(scene, "distance_model")
- else:
- layout.prop(scene, "distance_model", text="")
+ layout.prop(scene, "distance_model")
+
layout.prop(scene, "speed_of_sound", text="Speed")
layout.prop(scene, "doppler_factor")
-class WorldButtonsPanel(bpy.types.Panel):
+class WorldButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "world"
- def poll(self, context):
- scene = context.scene
- return (scene.render.engine in self.COMPAT_ENGINES) and (scene.world is not None)
-
-class WORLD_PT_game_context_world(WorldButtonsPanel):
+class WORLD_PT_game_context_world(WorldButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
COMPAT_ENGINES = {'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
rd = context.scene.render
return (context.scene) and (rd.use_game_engine)
@@ -416,45 +382,46 @@ class WORLD_PT_game_context_world(WorldButtonsPanel):
scene = context.scene
world = context.world
space = context.space_data
- wide_ui = context.region.width > narrowui
-
- if wide_ui:
- split = layout.split(percentage=0.65)
- if scene:
- split.template_ID(scene, "world", new="world.new")
- elif world:
- split.template_ID(space, "pin_id")
- else:
- if scene:
- layout.template_ID(scene, "world", new="world.new")
- elif world:
- layout.template_ID(space, "pin_id")
+
+ split = layout.split(percentage=0.65)
+ if scene:
+ split.template_ID(scene, "world", new="world.new")
+ elif world:
+ split.template_ID(space, "pin_id")
-class WORLD_PT_game_world(WorldButtonsPanel):
+class WORLD_PT_game_world(WorldButtonsPanel, bpy.types.Panel):
bl_label = "World"
COMPAT_ENGINES = {'BLENDER_GAME'}
+ @classmethod
+ def poll(cls, context):
+ scene = context.scene
+ return (scene.world and scene.render.engine in cls.COMPAT_ENGINES)
+
def draw(self, context):
layout = self.layout
world = context.world
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.prop(world, "horizon_color")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(world, "ambient_color")
-class WORLD_PT_game_mist(WorldButtonsPanel):
+class WORLD_PT_game_mist(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Mist"
COMPAT_ENGINES = {'BLENDER_GAME'}
+ @classmethod
+ def poll(cls, context):
+ scene = context.scene
+ return (scene.world and scene.render.engine in cls.COMPAT_ENGINES)
+
def draw_header(self, context):
world = context.world
@@ -464,7 +431,6 @@ class WORLD_PT_game_mist(WorldButtonsPanel):
layout = self.layout
world = context.world
- wide_ui = context.region.width > narrowui
layout.active = world.mist.use_mist
split = layout.split()
@@ -472,20 +438,23 @@ class WORLD_PT_game_mist(WorldButtonsPanel):
col = split.column()
col.prop(world.mist, "start")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(world.mist, "depth")
-class WORLD_PT_game_physics(WorldButtonsPanel):
+class WORLD_PT_game_physics(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Physics"
COMPAT_ENGINES = {'BLENDER_GAME'}
+ @classmethod
+ def poll(cls, context):
+ scene = context.scene
+ return (scene.world and scene.render.engine in cls.COMPAT_ENGINES)
+
def draw(self, context):
layout = self.layout
gs = context.scene.game_data
- wide_ui = context.region.width > narrowui
layout.prop(gs, "physics_engine")
if gs.physics_engine != 'NONE':
@@ -500,8 +469,7 @@ class WORLD_PT_game_physics(WorldButtonsPanel):
sub.prop(gs, "physics_step_sub", text="Substeps")
col.prop(gs, "fps", text="FPS")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Logic Steps:")
col.prop(gs, "logic_step_max", text="Max")
@@ -523,33 +491,12 @@ class WORLD_PT_game_physics(WorldButtonsPanel):
col.prop(gs, "logic_step_max", text="Max")
-classes = [
- PHYSICS_PT_game_physics,
- PHYSICS_PT_game_collision_bounds,
-
- RENDER_PT_game,
- RENDER_PT_game_player,
- RENDER_PT_game_stereo,
- RENDER_PT_game_shading,
- RENDER_PT_game_performance,
- RENDER_PT_game_sound,
-
- WORLD_PT_game_context_world,
- WORLD_PT_game_world,
- WORLD_PT_game_mist,
- WORLD_PT_game_physics]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_material.py b/release/scripts/ui/properties_material.py
index 8d379491983..d14c8c05c63 100644
--- a/release/scripts/ui/properties_material.py
+++ b/release/scripts/ui/properties_material.py
@@ -20,8 +20,6 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
def active_node_mat(mat):
# TODO, 2.4x has a pipeline section, for 2.5 we need to communicate
@@ -54,19 +52,18 @@ class MATERIAL_MT_specials(bpy.types.Menu):
layout.operator("material.paste", icon='PASTEDOWN')
-class MaterialButtonsPanel(bpy.types.Panel):
+class MaterialButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "material"
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
- def poll(self, context):
- mat = context.material
- engine = context.scene.render.engine
- return mat and (engine in self.COMPAT_ENGINES)
+ @classmethod
+ def poll(cls, context):
+ return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES)
-class MATERIAL_PT_preview(MaterialButtonsPanel):
+class MATERIAL_PT_preview(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Preview"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -74,17 +71,18 @@ class MATERIAL_PT_preview(MaterialButtonsPanel):
self.layout.template_preview(context.material)
-class MATERIAL_PT_context_material(MaterialButtonsPanel):
+class MATERIAL_PT_context_material(MaterialButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
# An exception, dont call the parent poll func because
# this manages materials for all engine types
engine = context.scene.render.engine
- return (context.material or context.object) and (engine in self.COMPAT_ENGINES)
+ return (context.material or context.object) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@@ -93,7 +91,6 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel):
ob = context.object
slot = context.material_slot
space = context.space_data
- wide_ui = context.region.width > narrowui
if ob:
row = layout.row()
@@ -112,54 +109,45 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel):
row.operator("object.material_slot_select", text="Select")
row.operator("object.material_slot_deselect", text="Deselect")
- if wide_ui:
- split = layout.split(percentage=0.65)
-
- if ob:
- split.template_ID(ob, "active_material", new="material.new")
- row = split.row()
- if mat:
- row.prop(mat, "use_nodes", icon="NODETREE", text="")
-
- if slot:
- row.prop(slot, "link", text="")
- else:
- row.label()
- elif mat:
- split.template_ID(space, "pin_id")
- split.separator()
- else:
- if ob:
- layout.template_ID(ob, "active_material", new="material.new")
- elif mat:
- layout.template_ID(space, "pin_id")
+ split = layout.split(percentage=0.65)
- if mat:
- if wide_ui:
- layout.prop(mat, "type", expand=True)
+ if ob:
+ split.template_ID(ob, "active_material", new="material.new")
+ row = split.row()
+ if mat:
+ row.prop(mat, "use_nodes", icon="NODETREE", text="")
+
+ if slot:
+ row.prop(slot, "link", text="")
else:
- layout.prop(mat, "type", text="")
+ row.label()
+ elif mat:
+ split.template_ID(space, "pin_id")
+ split.separator()
+ if mat:
+ layout.prop(mat, "type", expand=True)
-class MATERIAL_PT_custom_props(MaterialButtonsPanel, PropertyPanel):
- COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+class MATERIAL_PT_custom_props(MaterialButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "material"
-class MATERIAL_PT_shading(MaterialButtonsPanel):
+class MATERIAL_PT_shading(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Shading"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES)
+ return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = active_node_mat(context.material)
- wide_ui = context.region.width > narrowui
if mat.type in ('SURFACE', 'WIRE'):
split = layout.split()
@@ -172,8 +160,7 @@ class MATERIAL_PT_shading(MaterialButtonsPanel):
sub = col.column()
sub.prop(mat, "translucency")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(mat, "shadeless")
sub = col.column()
sub.active = not mat.shadeless
@@ -184,22 +171,22 @@ class MATERIAL_PT_shading(MaterialButtonsPanel):
layout.prop(mat, "alpha")
-class MATERIAL_PT_strand(MaterialButtonsPanel):
+class MATERIAL_PT_strand(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Strand"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
mat = context.material
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES)
+ return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = context.material # dont use node material
tan = mat.strand
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -215,8 +202,7 @@ class MATERIAL_PT_strand(MaterialButtonsPanel):
sub.prop(tan, "tangent_shading")
col.prop(tan, "shape")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Shading:")
col.prop(tan, "width_fade")
ob = context.object
@@ -233,15 +219,18 @@ class MATERIAL_PT_strand(MaterialButtonsPanel):
sub.prop(tan, "blend_distance", text="Distance")
-class MATERIAL_PT_physics(MaterialButtonsPanel):
+class MATERIAL_PT_physics(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Physics"
COMPAT_ENGINES = {'BLENDER_GAME'}
+ @classmethod
+ def poll(cls, context):
+ return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES)
+
def draw(self, context):
layout = self.layout
phys = context.material.physics # dont use node material
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -250,27 +239,26 @@ class MATERIAL_PT_physics(MaterialButtonsPanel):
col.prop(phys, "friction")
col.prop(phys, "align_to_normal")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(phys, "force", slider=True)
col.prop(phys, "elasticity", slider=True)
col.prop(phys, "damp", slider=True)
-class MATERIAL_PT_options(MaterialButtonsPanel):
+class MATERIAL_PT_options(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Options"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES)
+ return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = active_node_mat(context.material)
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -290,8 +278,7 @@ class MATERIAL_PT_options(MaterialButtonsPanel):
row.active = bool(mat.light_group)
row.prop(mat, "light_group_exclusive", text="Exclusive")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(mat, "face_texture")
sub = col.column()
sub.active = mat.face_texture
@@ -302,21 +289,21 @@ class MATERIAL_PT_options(MaterialButtonsPanel):
col.prop(mat, "object_color")
-class MATERIAL_PT_shadow(MaterialButtonsPanel):
+class MATERIAL_PT_shadow(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Shadow"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
+ return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = active_node_mat(context.material)
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -327,8 +314,7 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel):
col.prop(mat, "cast_shadows_only", text="Cast Only")
col.prop(mat, "shadow_casting_alpha", text="Casting Alpha")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(mat, "cast_buffer_shadows")
sub = col.column()
sub.active = mat.cast_buffer_shadows
@@ -339,21 +325,20 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel):
sub.prop(mat, "shadow_ray_bias", text="Ray Bias")
col.prop(mat, "cast_approximate")
-
-class MATERIAL_PT_diffuse(MaterialButtonsPanel):
+class MATERIAL_PT_diffuse(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Diffuse"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
+ return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = active_node_mat(context.material)
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -363,8 +348,7 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel):
sub.active = (not mat.shadeless)
sub.prop(mat, "diffuse_intensity", text="Intensity")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.active = (not mat.shadeless)
col.prop(mat, "diffuse_shader", text="")
col.prop(mat, "use_diffuse_ramp", text="Ramp")
@@ -381,8 +365,7 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel):
col = split.column()
col.prop(mat, "diffuse_toon_size", text="Size")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(mat, "diffuse_toon_smooth", text="Smooth")
elif mat.diffuse_shader == 'FRESNEL':
split = col.split()
@@ -390,8 +373,7 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel):
col = split.column()
col.prop(mat, "diffuse_fresnel", text="Fresnel")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(mat, "diffuse_fresnel_factor", text="Factor")
if mat.use_diffuse_ramp:
@@ -404,27 +386,26 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel):
col = split.column()
col.prop(mat, "diffuse_ramp_input", text="Input")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(mat, "diffuse_ramp_blend", text="Blend")
row = layout.row()
row.prop(mat, "diffuse_ramp_factor", text="Factor")
-class MATERIAL_PT_specular(MaterialButtonsPanel):
+class MATERIAL_PT_specular(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Specular"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
+ return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = active_node_mat(context.material)
- wide_ui = context.region.width > narrowui
layout.active = (not mat.shadeless)
@@ -434,8 +415,7 @@ class MATERIAL_PT_specular(MaterialButtonsPanel):
col.prop(mat, "specular_color", text="")
col.prop(mat, "specular_intensity", text="Intensity")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(mat, "specular_shader", text="")
col.prop(mat, "use_specular_ramp", text="Ramp")
@@ -448,8 +428,7 @@ class MATERIAL_PT_specular(MaterialButtonsPanel):
col = split.column()
col.prop(mat, "specular_hardness", text="Hardness")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(mat, "specular_ior", text="IOR")
elif mat.specular_shader == 'WARDISO':
col.prop(mat, "specular_slope", text="Slope")
@@ -459,8 +438,7 @@ class MATERIAL_PT_specular(MaterialButtonsPanel):
col = split.column()
col.prop(mat, "specular_toon_size", text="Size")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(mat, "specular_toon_smooth", text="Smooth")
if mat.use_specular_ramp:
@@ -472,23 +450,23 @@ class MATERIAL_PT_specular(MaterialButtonsPanel):
col = split.column()
col.prop(mat, "specular_ramp_input", text="Input")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(mat, "specular_ramp_blend", text="Blend")
row = layout.row()
row.prop(mat, "specular_ramp_factor", text="Factor")
-class MATERIAL_PT_sss(MaterialButtonsPanel):
+class MATERIAL_PT_sss(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Subsurface Scattering"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
+ return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
mat = active_node_mat(context.material)
@@ -502,7 +480,6 @@ class MATERIAL_PT_sss(MaterialButtonsPanel):
mat = active_node_mat(context.material)
sss = mat.subsurface_scattering
- wide_ui = context.region.width > narrowui
layout.active = (sss.enabled) and (not mat.shadeless)
@@ -519,8 +496,7 @@ class MATERIAL_PT_sss(MaterialButtonsPanel):
col.prop(sss, "color", text="")
col.prop(sss, "radius", text="RGB Radius", expand=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
sub = col.column(align=True)
sub.label(text="Blend:")
sub.prop(sss, "color_factor", text="Color")
@@ -532,15 +508,16 @@ class MATERIAL_PT_sss(MaterialButtonsPanel):
col.prop(sss, "error_tolerance", text="Error")
-class MATERIAL_PT_mirror(MaterialButtonsPanel):
+class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Mirror"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
+ return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
raym = active_node_mat(context.material).raytrace_mirror
@@ -552,7 +529,6 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel):
mat = active_node_mat(context.material)
raym = mat.raytrace_mirror
- wide_ui = context.region.width > narrowui
layout.active = raym.enabled
@@ -562,8 +538,7 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel):
col.prop(raym, "reflect_factor")
col.prop(mat, "mirror_color", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(raym, "fresnel")
sub = col.column()
sub.active = raym.fresnel > 0
@@ -581,8 +556,7 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel):
sub.label(text="Fade To:")
sub.prop(raym, "fade_to", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Gloss:")
col.prop(raym, "gloss_factor", text="Amount")
sub = col.column()
@@ -592,15 +566,16 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel):
sub.prop(raym, "gloss_anisotropic", text="Anisotropic")
-class MATERIAL_PT_transp(MaterialButtonsPanel):
+class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Transparency"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
+ return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
mat = active_node_mat(context.material)
@@ -612,14 +587,10 @@ class MATERIAL_PT_transp(MaterialButtonsPanel):
mat = active_node_mat(context.material)
rayt = mat.raytrace_transparency
- wide_ui = context.region.width > narrowui
row = layout.row()
row.active = mat.transparency and (not mat.shadeless)
- if wide_ui:
- row.prop(mat, "transparency_method", expand=True)
- else:
- row.prop(mat, "transparency_method", text="")
+ row.prop(mat, "transparency_method", expand=True)
split = layout.split()
@@ -629,8 +600,7 @@ class MATERIAL_PT_transp(MaterialButtonsPanel):
row.active = mat.transparency and (not mat.shadeless)
row.prop(mat, "specular_alpha", text="Specular")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.active = (not mat.shadeless)
col.prop(rayt, "fresnel")
sub = col.column()
@@ -649,8 +619,7 @@ class MATERIAL_PT_transp(MaterialButtonsPanel):
col.prop(rayt, "limit")
col.prop(rayt, "depth")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Gloss:")
col.prop(rayt, "gloss_factor", text="Amount")
sub = col.column()
@@ -659,15 +628,16 @@ class MATERIAL_PT_transp(MaterialButtonsPanel):
sub.prop(rayt, "gloss_samples", text="Samples")
-class MATERIAL_PT_transp_game(MaterialButtonsPanel):
+class MATERIAL_PT_transp_game(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Transparency"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
- return mat and (engine in self.COMPAT_ENGINES)
+ return mat and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
mat = active_node_mat(context.material)
@@ -679,14 +649,10 @@ class MATERIAL_PT_transp_game(MaterialButtonsPanel):
mat = active_node_mat(context.material)
rayt = mat.raytrace_transparency
- wide_ui = context.region.width > narrowui
row = layout.row()
row.active = mat.transparency and (not mat.shadeless)
- if wide_ui:
- row.prop(mat, "transparency_method", expand=True)
- else:
- row.prop(mat, "transparency_method", text="")
+ row.prop(mat, "transparency_method", expand=True)
split = layout.split()
@@ -694,21 +660,21 @@ class MATERIAL_PT_transp_game(MaterialButtonsPanel):
col.prop(mat, "alpha")
-class MATERIAL_PT_halo(MaterialButtonsPanel):
+class MATERIAL_PT_halo(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Halo"
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
mat = context.material
engine = context.scene.render.engine
- return mat and (mat.type == 'HALO') and (engine in self.COMPAT_ENGINES)
+ return mat and (mat.type == 'HALO') and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = context.material # dont use node material
halo = mat.halo
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -724,8 +690,7 @@ class MATERIAL_PT_halo(MaterialButtonsPanel):
col.prop(halo, "shaded")
col.prop(halo, "soft")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(halo, "ring")
sub = col.column()
sub.active = halo.ring
@@ -744,14 +709,15 @@ class MATERIAL_PT_halo(MaterialButtonsPanel):
sub.prop(halo, "star_tips")
-class MATERIAL_PT_flare(MaterialButtonsPanel):
+class MATERIAL_PT_flare(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Flare"
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
mat = context.material
engine = context.scene.render.engine
- return mat and (mat.type == 'HALO') and (engine in self.COMPAT_ENGINES)
+ return mat and (mat.type == 'HALO') and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
halo = context.material.halo
@@ -763,7 +729,6 @@ class MATERIAL_PT_flare(MaterialButtonsPanel):
mat = context.material # dont use node material
halo = mat.halo
- wide_ui = context.region.width > narrowui
layout.active = halo.flare_mode
@@ -773,24 +738,26 @@ class MATERIAL_PT_flare(MaterialButtonsPanel):
col.prop(halo, "flare_size", text="Size")
col.prop(halo, "flare_boost", text="Boost")
col.prop(halo, "flare_seed", text="Seed")
- if wide_ui:
- col = split.column()
+
+ col = split.column()
col.prop(halo, "flares_sub", text="Subflares")
col.prop(halo, "flare_subsize", text="Subsize")
-class VolumeButtonsPanel(bpy.types.Panel):
+class VolumeButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "material"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
mat = context.material
engine = context.scene.render.engine
- return mat and (mat.type == 'VOLUME') and (engine in self.COMPAT_ENGINES)
+ return mat and (mat.type == 'VOLUME') and (engine in cls.COMPAT_ENGINES)
-class MATERIAL_PT_volume_density(VolumeButtonsPanel):
+class MATERIAL_PT_volume_density(VolumeButtonsPanel, bpy.types.Panel):
bl_label = "Density"
bl_default_closed = False
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -799,18 +766,16 @@ class MATERIAL_PT_volume_density(VolumeButtonsPanel):
layout = self.layout
vol = context.material.volume # dont use node material
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.prop(vol, "density")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(vol, "density_scale")
-class MATERIAL_PT_volume_shading(VolumeButtonsPanel):
+class MATERIAL_PT_volume_shading(VolumeButtonsPanel, bpy.types.Panel):
bl_label = "Shading"
bl_default_closed = False
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -819,7 +784,6 @@ class MATERIAL_PT_volume_shading(VolumeButtonsPanel):
layout = self.layout
vol = context.material.volume # dont use node material
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -828,8 +792,7 @@ class MATERIAL_PT_volume_shading(VolumeButtonsPanel):
col.prop(vol, "asymmetry")
col.prop(vol, "transmission_color")
- if wide_ui:
- col = split.column()
+ col = split.column()
sub = col.column(align=True)
sub.prop(vol, "emission")
sub.prop(vol, "emission_color", text="")
@@ -838,7 +801,7 @@ class MATERIAL_PT_volume_shading(VolumeButtonsPanel):
sub.prop(vol, "reflection_color", text="")
-class MATERIAL_PT_volume_lighting(VolumeButtonsPanel):
+class MATERIAL_PT_volume_lighting(VolumeButtonsPanel, bpy.types.Panel):
bl_label = "Lighting"
bl_default_closed = False
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -847,15 +810,13 @@ class MATERIAL_PT_volume_lighting(VolumeButtonsPanel):
layout = self.layout
vol = context.material.volume # dont use node material
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.prop(vol, "lighting_mode", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
if vol.lighting_mode == 'SHADED':
col.prop(vol, "external_shadows")
@@ -876,7 +837,7 @@ class MATERIAL_PT_volume_lighting(VolumeButtonsPanel):
sub.prop(vol, "ms_intensity")
-class MATERIAL_PT_volume_transp(VolumeButtonsPanel):
+class MATERIAL_PT_volume_transp(VolumeButtonsPanel, bpy.types.Panel):
bl_label = "Transparency"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -884,15 +845,11 @@ class MATERIAL_PT_volume_transp(VolumeButtonsPanel):
layout = self.layout
mat = context.material # dont use node material
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(mat, "transparency_method", expand=True)
- else:
- layout.prop(mat, "transparency_method", text="")
+ layout.prop(mat, "transparency_method", expand=True)
-class MATERIAL_PT_volume_integration(VolumeButtonsPanel):
+class MATERIAL_PT_volume_integration(VolumeButtonsPanel, bpy.types.Panel):
bl_label = "Integration"
bl_default_closed = False
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -901,7 +858,6 @@ class MATERIAL_PT_volume_integration(VolumeButtonsPanel):
layout = self.layout
vol = context.material.volume # dont use node material
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -911,13 +867,12 @@ class MATERIAL_PT_volume_integration(VolumeButtonsPanel):
col = col.column(align=True)
col.prop(vol, "step_size")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label()
col.prop(vol, "depth_cutoff")
-class MATERIAL_PT_volume_options(VolumeButtonsPanel):
+class MATERIAL_PT_volume_options(VolumeButtonsPanel, bpy.types.Panel):
bl_label = "Options"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
bl_default_closed = True
@@ -926,7 +881,6 @@ class MATERIAL_PT_volume_options(VolumeButtonsPanel):
layout = self.layout
mat = active_node_mat(context.material)
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -943,46 +897,12 @@ class MATERIAL_PT_volume_options(VolumeButtonsPanel):
row.prop(mat, "light_group_exclusive", text="Exclusive")
-classes = [
- MATERIAL_PT_context_material,
- MATERIAL_PT_preview,
- MATERIAL_PT_diffuse,
- MATERIAL_PT_specular,
- MATERIAL_PT_shading,
- MATERIAL_PT_transp,
- MATERIAL_PT_mirror,
- MATERIAL_PT_sss,
- MATERIAL_PT_halo,
- MATERIAL_PT_flare,
- MATERIAL_PT_physics,
- MATERIAL_PT_strand,
- MATERIAL_PT_options,
- MATERIAL_PT_shadow,
- MATERIAL_PT_transp_game,
-
- MATERIAL_MT_sss_presets,
- MATERIAL_MT_specials,
-
- MATERIAL_PT_volume_density,
- MATERIAL_PT_volume_shading,
- MATERIAL_PT_volume_lighting,
- MATERIAL_PT_volume_transp,
- MATERIAL_PT_volume_integration,
- MATERIAL_PT_volume_options,
-
- MATERIAL_PT_custom_props]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_object.py b/release/scripts/ui/properties_object.py
index 4e60879d665..6923e60a3df 100644
--- a/release/scripts/ui/properties_object.py
+++ b/release/scripts/ui/properties_object.py
@@ -20,16 +20,14 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
-class ObjectButtonsPanel(bpy.types.Panel):
+class ObjectButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "object"
-class OBJECT_PT_context_object(ObjectButtonsPanel):
+class OBJECT_PT_context_object(ObjectButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
@@ -46,51 +44,33 @@ class OBJECT_PT_context_object(ObjectButtonsPanel):
row.prop(ob, "name", text="")
-class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel):
- _context_path = "object"
-
-
-class OBJECT_PT_transform(ObjectButtonsPanel):
+class OBJECT_PT_transform(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "Transform"
def draw(self, context):
layout = self.layout
ob = context.object
- wide_ui = context.region.width > narrowui
- if wide_ui:
- row = layout.row()
+ row = layout.row()
- row.column().prop(ob, "location")
- if ob.rotation_mode == 'QUATERNION':
- row.column().prop(ob, "rotation_quaternion", text="Rotation")
- elif ob.rotation_mode == 'AXIS_ANGLE':
- #row.column().label(text="Rotation")
- #row.column().prop(pchan, "rotation_angle", text="Angle")
- #row.column().prop(pchan, "rotation_axis", text="Axis")
- row.column().prop(ob, "rotation_axis_angle", text="Rotation")
- else:
- row.column().prop(ob, "rotation_euler", text="Rotation")
+ row.column().prop(ob, "location")
+ if ob.rotation_mode == 'QUATERNION':
+ row.column().prop(ob, "rotation_quaternion", text="Rotation")
+ elif ob.rotation_mode == 'AXIS_ANGLE':
+ #row.column().label(text="Rotation")
+ #row.column().prop(pchan, "rotation_angle", text="Angle")
+ #row.column().prop(pchan, "rotation_axis", text="Axis")
+ row.column().prop(ob, "rotation_axis_angle", text="Rotation")
+ else:
+ row.column().prop(ob, "rotation_euler", text="Rotation")
- row.column().prop(ob, "scale")
+ row.column().prop(ob, "scale")
- layout.prop(ob, "rotation_mode")
- else:
- col = layout.column()
- col.prop(ob, "location")
- col.label(text="Rotation:")
- col.prop(ob, "rotation_mode", text="")
- if ob.rotation_mode == 'QUATERNION':
- col.prop(ob, "rotation_quaternion", text="")
- elif ob.rotation_mode == 'AXIS_ANGLE':
- col.prop(ob, "rotation_axis_angle", text="")
- else:
- col.prop(ob, "rotation_euler", text="")
- col.prop(ob, "scale")
-
-
-class OBJECT_PT_transform_locks(ObjectButtonsPanel):
+ layout.prop(ob, "rotation_mode")
+
+
+class OBJECT_PT_transform_locks(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "Transform Locks"
bl_default_closed = True
@@ -98,7 +78,6 @@ class OBJECT_PT_transform_locks(ObjectButtonsPanel):
layout = self.layout
ob = context.object
- # wide_ui = context.region.width > narrowui
row = layout.row()
@@ -117,14 +96,13 @@ class OBJECT_PT_transform_locks(ObjectButtonsPanel):
row.column().prop(ob, "lock_scale", text="Scale")
-class OBJECT_PT_relations(ObjectButtonsPanel):
+class OBJECT_PT_relations(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "Relations"
def draw(self, context):
layout = self.layout
ob = context.object
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -133,8 +111,7 @@ class OBJECT_PT_relations(ObjectButtonsPanel):
col.separator()
col.prop(ob, "pass_index")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Parent:")
col.prop(ob, "parent", text="")
@@ -146,14 +123,13 @@ class OBJECT_PT_relations(ObjectButtonsPanel):
sub.active = (parent is not None)
-class OBJECT_PT_groups(ObjectButtonsPanel):
+class OBJECT_PT_groups(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "Groups"
def draw(self, context):
layout = self.layout
ob = context.object
- wide_ui = context.region.width > narrowui
row = layout.row(align=True)
row.operator("object.group_link", text="Add to Group")
@@ -177,8 +153,7 @@ class OBJECT_PT_groups(ObjectButtonsPanel):
col = split.column()
col.prop(group, "layer", text="Dupli")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(group, "dupli_offset", text="")
prop = col.operator("wm.context_set_value", text="From Cursor")
@@ -187,21 +162,19 @@ class OBJECT_PT_groups(ObjectButtonsPanel):
index += 1
-class OBJECT_PT_display(ObjectButtonsPanel):
+class OBJECT_PT_display(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "Display"
def draw(self, context):
layout = self.layout
ob = context.object
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.prop(ob, "max_draw_type", text="Type")
- if wide_ui:
- col = split.column()
+ col = split.column()
row = col.row()
row.prop(ob, "draw_bounds", text="Bounds")
sub = row.row()
@@ -216,26 +189,21 @@ class OBJECT_PT_display(ObjectButtonsPanel):
col.prop(ob, "draw_wire", text="Wire")
col.prop(ob, "color", text="Object Color")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(ob, "draw_texture_space", text="Texture Space")
col.prop(ob, "x_ray", text="X-Ray")
col.prop(ob, "draw_transparent", text="Transparency")
-class OBJECT_PT_duplication(ObjectButtonsPanel):
+class OBJECT_PT_duplication(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "Duplication"
def draw(self, context):
layout = self.layout
ob = context.object
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(ob, "dupli_type", expand=True)
- else:
- layout.prop(ob, "dupli_type", text="")
+ layout.prop(ob, "dupli_type", expand=True)
if ob.dupli_type == 'FRAMES':
split = layout.split()
@@ -244,8 +212,7 @@ class OBJECT_PT_duplication(ObjectButtonsPanel):
col.prop(ob, "dupli_frames_start", text="Start")
col.prop(ob, "dupli_frames_end", text="End")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.prop(ob, "dupli_frames_on", text="On")
col.prop(ob, "dupli_frames_off", text="Off")
@@ -260,20 +227,16 @@ class OBJECT_PT_duplication(ObjectButtonsPanel):
col = split.column()
col.prop(ob, "use_dupli_faces_scale", text="Scale")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(ob, "dupli_faces_scale", text="Inherit Scale")
elif ob.dupli_type == 'GROUP':
- if wide_ui:
- layout.prop(ob, "dupli_group", text="Group")
- else:
- layout.prop(ob, "dupli_group", text="")
+ layout.prop(ob, "dupli_group", text="Group")
-# XXX: the following options are all quite buggy, ancient hacks that should be dropped
+# XXX: the following options are all quite buggy, ancient hacks that should be dropped
-class OBJECT_PT_animation(ObjectButtonsPanel):
+class OBJECT_PT_animation(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "Animation Hacks"
bl_default_closed = True
@@ -281,7 +244,6 @@ class OBJECT_PT_animation(ObjectButtonsPanel):
layout = self.layout
ob = context.object
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -300,42 +262,67 @@ class OBJECT_PT_animation(ObjectButtonsPanel):
col.prop(ob, "time_offset", text="Offset")
# XXX: these are still used for a few curve-related tracking features
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Tracking Axes:")
col.prop(ob, "track_axis", text="Axis")
col.prop(ob, "up_axis", text="Up Axis")
+from properties_animviz import MotionPathButtonsPanel, OnionSkinButtonsPanel
+
-# import generic panels from other files
-from properties_animviz import OBJECT_PT_motion_paths, OBJECT_PT_onion_skinning
+class OBJECT_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
+ #bl_label = "Object Motion Paths"
+ bl_context = "object"
+
+ @classmethod
+ def poll(cls, context):
+ return (context.object)
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
-classes = [
- OBJECT_PT_context_object,
- OBJECT_PT_transform,
- OBJECT_PT_transform_locks,
- OBJECT_PT_relations,
- OBJECT_PT_groups,
- OBJECT_PT_display,
- OBJECT_PT_duplication,
- OBJECT_PT_animation, # XXX: panel of old hacks pending to be removed...
+ self.draw_settings(context, ob.animation_visualisation)
- OBJECT_PT_motion_paths,
- #OBJECT_PT_onion_skinning,
+ layout.separator()
+
+ split = layout.split()
+
+ col = split.column()
+ col.operator("object.paths_calculate", text="Calculate Paths")
+
+ col = split.column()
+ col.operator("object.paths_clear", text="Clear Paths")
- OBJECT_PT_custom_props]
+
+class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel): #, bpy.types.Panel): # inherit from panel when ready
+ #bl_label = "Object Onion Skinning"
+ bl_context = "object"
+
+ @classmethod
+ def poll(cls, context):
+ return (context.object)
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+
+ self.draw_settings(context, ob.animation_visualisation)
+
+
+class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "object"
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_object_constraint.py b/release/scripts/ui/properties_object_constraint.py
index edeadb9326b..b3a96841d71 100644
--- a/release/scripts/ui/properties_object_constraint.py
+++ b/release/scripts/ui/properties_object_constraint.py
@@ -19,11 +19,8 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-narrowcon = 260
-
-class ConstraintButtonsPanel(bpy.types.Panel):
+class ConstraintButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "constraint"
@@ -31,52 +28,38 @@ class ConstraintButtonsPanel(bpy.types.Panel):
def draw_constraint(self, context, con):
layout = self.layout
- wide_ui = context.region.width > narrowui
- compact_con = context.region.width < narrowcon
- box = layout.template_constraint(con, compact=compact_con)
+ box = layout.template_constraint(con)
if box:
# match enum type to our functions, avoids a lookup table.
- getattr(self, con.type)(context, box, con, wide_ui)
+ getattr(self, con.type)(context, box, con)
if con.type not in ('RIGID_BODY_JOINT', 'NULL'):
box.prop(con, "influence")
- def space_template(self, layout, con, wide_ui, target=True, owner=True):
+ def space_template(self, layout, con, target=True, owner=True):
if target or owner:
split = layout.split(percentage=0.2)
- if wide_ui:
- split.label(text="Space:")
- row = split.row()
- else:
- row = layout.row()
-
+ split.label(text="Space:")
+ row = split.row()
if target:
row.prop(con, "target_space", text="")
- if wide_ui:
- if target and owner:
- row.label(icon='ARROW_LEFTRIGHT')
- else:
- row = layout.row()
+ if target and owner:
+ row.label(icon='ARROW_LEFTRIGHT')
+
if owner:
row.prop(con, "owner_space", text="")
- def target_template(self, layout, con, wide_ui, subtargets=True):
- if wide_ui:
- layout.prop(con, "target") # XXX limiting settings for only 'curves' or some type of object
- else:
- layout.prop(con, "target", text="")
+ def target_template(self, layout, con, subtargets=True):
+ layout.prop(con, "target") # XXX limiting settings for only 'curves' or some type of object
if con.target and subtargets:
if con.target.type == 'ARMATURE':
- if wide_ui:
- layout.prop_object(con, "subtarget", con.target.data, "bones", text="Bone")
- else:
- layout.prop_object(con, "subtarget", con.target.data, "bones", text="")
+ layout.prop_object(con, "subtarget", con.target.data, "bones", text="Bone")
if con.type in ('COPY_LOCATION', 'STRETCH_TO', 'TRACK_TO', 'PIVOT'):
row = layout.row()
@@ -85,7 +68,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
elif con.target.type in ('MESH', 'LATTICE'):
layout.prop_object(con, "subtarget", con.target, "vertex_groups", text="Vertex Group")
- def ik_template(self, layout, con, wide_ui):
+ def ik_template(self, layout, con):
# only used for iTaSC
layout.prop(con, "pole_target")
@@ -106,8 +89,8 @@ class ConstraintButtonsPanel(bpy.types.Panel):
col.prop(con, "chain_length")
col.prop(con, "use_target")
- def CHILD_OF(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def CHILD_OF(self, context, layout, con):
+ self.target_template(layout, con)
split = layout.split()
@@ -134,16 +117,14 @@ class ConstraintButtonsPanel(bpy.types.Panel):
col = split.column()
col.operator("constraint.childof_set_inverse")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.operator("constraint.childof_clear_inverse")
- def TRACK_TO(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def TRACK_TO(self, context, layout, con):
+ self.target_template(layout, con)
row = layout.row()
- if wide_ui:
- row.label(text="To:")
+ row.label(text="To:")
row.prop(con, "track", expand=True)
split = layout.split()
@@ -151,34 +132,27 @@ class ConstraintButtonsPanel(bpy.types.Panel):
col = split.column()
col.prop(con, "up", text="Up")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(con, "target_z")
- self.space_template(layout, con, wide_ui)
+ self.space_template(layout, con)
- def IK(self, context, layout, con, wide_ui):
+ def IK(self, context, layout, con):
if context.object.pose.ik_solver == "ITASC":
layout.prop(con, "ik_type")
- getattr(self, 'IK_' + con.ik_type)(context, layout, con, wide_ui)
+ getattr(self, 'IK_' + con.ik_type)(context, layout, con)
else:
# Legacy IK constraint
- self.target_template(layout, con, wide_ui)
- if wide_ui:
- layout.prop(con, "pole_target")
- else:
- layout.prop(con, "pole_target", text="")
+ self.target_template(layout, con)
+ layout.prop(con, "pole_target")
+
if con.pole_target and con.pole_target.type == 'ARMATURE':
- if wide_ui:
- layout.prop_object(con, "pole_subtarget", con.pole_target.data, "bones", text="Bone")
- else:
- layout.prop_object(con, "pole_subtarget", con.pole_target.data, "bones", text="")
+ layout.prop_object(con, "pole_subtarget", con.pole_target.data, "bones", text="Bone")
if con.pole_target:
row = layout.row()
row.prop(con, "pole_angle")
- if wide_ui:
- row.label()
+ row.label()
split = layout.split()
col = split.column()
@@ -191,17 +165,16 @@ class ConstraintButtonsPanel(bpy.types.Panel):
sub.active = con.use_rotation
sub.prop(con, "orient_weight", text="Rotation", slider=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(con, "use_tail")
col.prop(con, "use_stretch")
col.separator()
col.prop(con, "use_target")
col.prop(con, "use_rotation")
- def IK_COPY_POSE(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
- self.ik_template(layout, con, wide_ui)
+ def IK_COPY_POSE(self, context, layout, con):
+ self.target_template(layout, con)
+ self.ik_template(layout, con)
row = layout.row()
row.label(text="Axis Ref:")
@@ -234,17 +207,17 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.prop(con, "rot_lock_z", text="Z")
split.active = con.use_rotation
- def IK_DISTANCE(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
- self.ik_template(layout, con, wide_ui)
+ def IK_DISTANCE(self, context, layout, con):
+ self.target_template(layout, con)
+ self.ik_template(layout, con)
layout.prop(con, "limit_mode")
row = layout.row()
row.prop(con, "weight", text="Weight", slider=True)
row.prop(con, "distance", text="Distance", slider=True)
- def FOLLOW_PATH(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def FOLLOW_PATH(self, context, layout, con):
+ self.target_template(layout, con)
split = layout.split()
@@ -252,8 +225,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
col.prop(con, "use_curve_follow")
col.prop(con, "use_curve_radius")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(con, "use_fixed_position")
if con.use_fixed_position:
col.prop(con, "offset_factor", text="Offset")
@@ -261,16 +233,14 @@ class ConstraintButtonsPanel(bpy.types.Panel):
col.prop(con, "offset")
row = layout.row()
- if wide_ui:
- row.label(text="Forward:")
+ row.label(text="Forward:")
row.prop(con, "forward", expand=True)
row = layout.row()
row.prop(con, "up", text="Up")
- if wide_ui:
- row.label()
+ row.label()
- def LIMIT_ROTATION(self, context, layout, con, wide_ui):
+ def LIMIT_ROTATION(self, context, layout, con):
split = layout.split()
@@ -281,16 +251,14 @@ class ConstraintButtonsPanel(bpy.types.Panel):
sub.prop(con, "minimum_x", text="Min")
sub.prop(con, "maximum_x", text="Max")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.prop(con, "use_limit_y")
sub = col.column()
sub.active = con.use_limit_y
sub.prop(con, "minimum_y", text="Min")
sub.prop(con, "maximum_y", text="Max")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.prop(con, "use_limit_z")
sub = col.column()
sub.active = con.use_limit_z
@@ -299,15 +267,13 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row = layout.row()
row.prop(con, "limit_transform")
- if wide_ui:
- row.label()
+ row.label()
row = layout.row()
- if wide_ui:
- row.label(text="Convert:")
+ row.label(text="Convert:")
row.prop(con, "owner_space", text="")
- def LIMIT_LOCATION(self, context, layout, con, wide_ui):
+ def LIMIT_LOCATION(self, context, layout, con):
split = layout.split()
col = split.column()
@@ -320,8 +286,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
sub.active = con.use_maximum_x
sub.prop(con, "maximum_x", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(con, "use_minimum_y")
sub = col.column()
sub.active = con.use_minimum_y
@@ -331,8 +296,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
sub.active = con.use_maximum_y
sub.prop(con, "maximum_y", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(con, "use_minimum_z")
sub = col.column()
sub.active = con.use_minimum_z
@@ -344,15 +308,13 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row = layout.row()
row.prop(con, "limit_transform")
- if wide_ui:
- row.label()
+ row.label()
row = layout.row()
- if wide_ui:
- row.label(text="Convert:")
+ row.label(text="Convert:")
row.prop(con, "owner_space", text="")
- def LIMIT_SCALE(self, context, layout, con, wide_ui):
+ def LIMIT_SCALE(self, context, layout, con):
split = layout.split()
col = split.column()
@@ -365,8 +327,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
sub.active = con.use_maximum_x
sub.prop(con, "maximum_x", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(con, "use_minimum_y")
sub = col.column()
sub.active = con.use_minimum_y
@@ -376,8 +337,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
sub.active = con.use_maximum_y
sub.prop(con, "maximum_y", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(con, "use_minimum_z")
sub = col.column()
sub.active = con.use_minimum_z
@@ -389,16 +349,14 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row = layout.row()
row.prop(con, "limit_transform")
- if wide_ui:
- row.label()
+ row.label()
row = layout.row()
- if wide_ui:
- row.label(text="Convert:")
+ row.label(text="Convert:")
row.prop(con, "owner_space", text="")
- def COPY_ROTATION(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def COPY_ROTATION(self, context, layout, con):
+ self.target_template(layout, con)
split = layout.split()
@@ -422,10 +380,10 @@ class ConstraintButtonsPanel(bpy.types.Panel):
layout.prop(con, "use_offset")
- self.space_template(layout, con, wide_ui)
+ self.space_template(layout, con)
- def COPY_LOCATION(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def COPY_LOCATION(self, context, layout, con):
+ self.target_template(layout, con)
split = layout.split()
@@ -449,10 +407,10 @@ class ConstraintButtonsPanel(bpy.types.Panel):
layout.prop(con, "use_offset")
- self.space_template(layout, con, wide_ui)
+ self.space_template(layout, con)
- def COPY_SCALE(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def COPY_SCALE(self, context, layout, con):
+ self.target_template(layout, con)
row = layout.row(align=True)
row.prop(con, "use_x", text="X")
@@ -461,38 +419,31 @@ class ConstraintButtonsPanel(bpy.types.Panel):
layout.prop(con, "use_offset")
- self.space_template(layout, con, wide_ui)
+ self.space_template(layout, con)
- def MAINTAIN_VOLUME(self, context, layout, con, wide_ui):
+ def MAINTAIN_VOLUME(self, context, layout, con):
row = layout.row()
- if wide_ui:
- row.label(text="Free:")
+ row.label(text="Free:")
row.prop(con, "axis", expand=True)
layout.prop(con, "volume")
- self.space_template(layout, con, wide_ui)
+ self.space_template(layout, con)
- def COPY_TRANSFORMS(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def COPY_TRANSFORMS(self, context, layout, con):
+ self.target_template(layout, con)
- self.space_template(layout, con, wide_ui)
+ self.space_template(layout, con)
#def SCRIPT(self, context, layout, con):
- def ACTION(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def ACTION(self, context, layout, con):
+ self.target_template(layout, con)
- if wide_ui:
- layout.prop(con, "action")
- else:
- layout.prop(con, "action", text="")
+ layout.prop(con, "action")
- if wide_ui:
- layout.prop(con, "transform_channel")
- else:
- layout.prop(con, "transform_channel", text="")
+ layout.prop(con, "transform_channel")
split = layout.split()
@@ -501,32 +452,28 @@ class ConstraintButtonsPanel(bpy.types.Panel):
col.prop(con, "frame_start", text="Start")
col.prop(con, "frame_end", text="End")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.label(text="Target Range:")
col.prop(con, "minimum", text="Min")
col.prop(con, "maximum", text="Max")
row = layout.row()
- if wide_ui:
- row.label(text="Convert:")
+ row.label(text="Convert:")
row.prop(con, "target_space", text="")
- def LOCKED_TRACK(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def LOCKED_TRACK(self, context, layout, con):
+ self.target_template(layout, con)
row = layout.row()
- if wide_ui:
- row.label(text="To:")
+ row.label(text="To:")
row.prop(con, "track", expand=True)
row = layout.row()
- if wide_ui:
- row.label(text="Lock:")
+ row.label(text="Lock:")
row.prop(con, "lock", expand=True)
- def LIMIT_DISTANCE(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def LIMIT_DISTANCE(self, context, layout, con):
+ self.target_template(layout, con)
col = layout.column(align=True)
col.prop(con, "distance")
@@ -536,70 +483,58 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.label(text="Clamp Region:")
row.prop(con, "limit_mode", text="")
- def STRETCH_TO(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def STRETCH_TO(self, context, layout, con):
+ self.target_template(layout, con)
split = layout.split()
col = split.column()
col.prop(con, "original_length", text="Rest Length")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.operator("constraint.stretchto_reset", text="Reset")
col = layout.column()
col.prop(con, "bulge", text="Volume Variation")
row = layout.row()
- if wide_ui:
- row.label(text="Volume:")
+ row.label(text="Volume:")
row.prop(con, "volume", expand=True)
- if not wide_ui:
- row = layout.row()
+
row.label(text="Plane:")
row.prop(con, "keep_axis", expand=True)
- def FLOOR(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def FLOOR(self, context, layout, con):
+ self.target_template(layout, con)
split = layout.split()
col = split.column()
col.prop(con, "sticky")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(con, "use_rotation")
layout.prop(con, "offset")
row = layout.row()
- if wide_ui:
- row.label(text="Min/Max:")
+ row.label(text="Min/Max:")
row.prop(con, "floor_location", expand=True)
- self.space_template(layout, con, wide_ui)
+ self.space_template(layout, con)
- def RIGID_BODY_JOINT(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def RIGID_BODY_JOINT(self, context, layout, con):
+ self.target_template(layout, con)
- if wide_ui:
- layout.prop(con, "pivot_type")
- else:
- layout.prop(con, "pivot_type", text="")
- if wide_ui:
- layout.prop(con, "child")
- else:
- layout.prop(con, "child", text="")
+ layout.prop(con, "pivot_type")
+ layout.prop(con, "child")
split = layout.split()
col = split.column()
col.prop(con, "disable_linked_collision", text="No Collision")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(con, "draw_pivot", text="Display Pivot")
split = layout.split()
@@ -610,8 +545,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
col.prop(con, "pivot_y", text="Y")
col.prop(con, "pivot_z", text="Z")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.label(text="Axis:")
col.prop(con, "axis_x", text="X")
col.prop(con, "axis_y", text="Y")
@@ -619,19 +553,18 @@ class ConstraintButtonsPanel(bpy.types.Panel):
#Missing: Limit arrays (not wrapped in RNA yet)
- def CLAMP_TO(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def CLAMP_TO(self, context, layout, con):
+ self.target_template(layout, con)
row = layout.row()
- if wide_ui:
- row.label(text="Main Axis:")
+ row.label(text="Main Axis:")
row.prop(con, "main_axis", expand=True)
row = layout.row()
row.prop(con, "cyclic")
- def TRANSFORM(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def TRANSFORM(self, context, layout, con):
+ self.target_template(layout, con)
layout.prop(con, "extrapolate_motion", text="Extrapolate")
@@ -646,14 +579,12 @@ class ConstraintButtonsPanel(bpy.types.Panel):
sub.prop(con, "from_min_x", text="Min")
sub.prop(con, "from_max_x", text="Max")
- if wide_ui:
- sub = split.column(align=True)
+ sub = split.column(align=True)
sub.label(text="Y:")
sub.prop(con, "from_min_y", text="Min")
sub.prop(con, "from_max_y", text="Max")
- if wide_ui:
- sub = split.column(align=True)
+ sub = split.column(align=True)
sub.label(text="Z:")
sub.prop(con, "from_min_z", text="Min")
sub.prop(con, "from_max_z", text="Max")
@@ -674,8 +605,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
sub.prop(con, "to_min_x", text="Min")
sub.prop(con, "to_max_x", text="Max")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Y:")
col.row().prop(con, "map_to_y_from", expand=True)
@@ -683,8 +613,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
sub.prop(con, "to_min_y", text="Min")
sub.prop(con, "to_max_y", text="Max")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Z:")
col.row().prop(con, "map_to_z_from", expand=True)
@@ -692,10 +621,10 @@ class ConstraintButtonsPanel(bpy.types.Panel):
sub.prop(con, "to_min_z", text="Min")
sub.prop(con, "to_max_z", text="Max")
- self.space_template(layout, con, wide_ui)
+ self.space_template(layout, con)
- def SHRINKWRAP(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def SHRINKWRAP(self, context, layout, con):
+ self.target_template(layout, con)
layout.prop(con, "distance")
layout.prop(con, "shrinkwrap_type")
@@ -706,16 +635,15 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.prop(con, "use_y")
row.prop(con, "use_z")
- def DAMPED_TRACK(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def DAMPED_TRACK(self, context, layout, con):
+ self.target_template(layout, con)
row = layout.row()
- if wide_ui:
- row.label(text="To:")
+ row.label(text="To:")
row.prop(con, "track", expand=True)
- def SPLINE_IK(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def SPLINE_IK(self, context, layout, con):
+ self.target_template(layout, con)
col = layout.column()
col.label(text="Spline Fitting:")
@@ -726,14 +654,11 @@ class ConstraintButtonsPanel(bpy.types.Panel):
col = layout.column()
col.label(text="Chain Scaling:")
col.prop(con, "y_stretch")
- if wide_ui:
- col.prop(con, "xz_scaling_mode")
- else:
- col.prop(con, "xz_scaling_mode", text="")
+ col.prop(con, "xz_scaling_mode")
col.prop(con, "use_curve_radius")
- def PIVOT(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def PIVOT(self, context, layout, con):
+ self.target_template(layout, con)
if con.target:
col = layout.column()
@@ -749,12 +674,12 @@ class ConstraintButtonsPanel(bpy.types.Panel):
col = layout.column()
col.prop(con, "enabled_rotation_range", text="Pivot When")
-
-class OBJECT_PT_constraints(ConstraintButtonsPanel):
+class OBJECT_PT_constraints(ConstraintButtonsPanel, bpy.types.Panel):
bl_label = "Object Constraints"
bl_context = "constraint"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.object)
def draw(self, context):
@@ -768,11 +693,12 @@ class OBJECT_PT_constraints(ConstraintButtonsPanel):
self.draw_constraint(context, con)
-class BONE_PT_constraints(ConstraintButtonsPanel):
+class BONE_PT_constraints(ConstraintButtonsPanel, bpy.types.Panel):
bl_label = "Bone Constraints"
bl_context = "bone_constraint"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.pose_bone)
def draw(self, context):
@@ -784,21 +710,12 @@ class BONE_PT_constraints(ConstraintButtonsPanel):
self.draw_constraint(context, con)
-classes = [
- OBJECT_PT_constraints,
- BONE_PT_constraints]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_particle.py b/release/scripts/ui/properties_particle.py
index f858c9b8511..72e804a1cef 100644
--- a/release/scripts/ui/properties_particle.py
+++ b/release/scripts/ui/properties_particle.py
@@ -25,40 +25,40 @@ from properties_physics_common import effector_weights_ui
from properties_physics_common import basic_force_field_settings_ui
from properties_physics_common import basic_force_field_falloff_ui
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
def particle_panel_enabled(context, psys):
return (psys.point_cache.baked is False) and (not psys.edited) and (not context.particle_system_editable)
-def particle_panel_poll(panel, context):
+def particle_panel_poll(cls, context):
psys = context.particle_system
engine = context.scene.render.engine
if psys is None:
return False
if psys.settings is None:
return False
- return psys.settings.type in ('EMITTER', 'REACTOR', 'HAIR') and (engine in panel.COMPAT_ENGINES)
+ return psys.settings.type in ('EMITTER', 'REACTOR', 'HAIR') and (engine in cls.COMPAT_ENGINES)
-class ParticleButtonsPanel(bpy.types.Panel):
+class ParticleButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "particle"
- def poll(self, context):
- return particle_panel_poll(self, context)
+ @classmethod
+ def poll(cls, context):
+ return particle_panel_poll(cls, context)
-class PARTICLE_PT_context_particles(ParticleButtonsPanel):
+class PARTICLE_PT_context_particles(ParticleButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
engine = context.scene.render.engine
- return (context.particle_system or context.object) and (engine in self.COMPAT_ENGINES)
+ return (context.particle_system or context.object) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@@ -136,17 +136,18 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel):
split.prop(psys, "reactor_target_particle_system", text="Particle System")
-class PARTICLE_PT_custom_props(ParticleButtonsPanel, PropertyPanel):
+class PARTICLE_PT_custom_props(ParticleButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER'}
_context_path = "particle_system.settings"
-class PARTICLE_PT_emission(ParticleButtonsPanel):
+class PARTICLE_PT_emission(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Emission"
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
- if particle_panel_poll(self, context):
+ @classmethod
+ def poll(cls, context):
+ if particle_panel_poll(PARTICLE_PT_emission, context):
return not context.particle_system.point_cache.external
else:
return False
@@ -156,7 +157,6 @@ class PARTICLE_PT_emission(ParticleButtonsPanel):
psys = context.particle_system
part = psys.settings
- wide_ui = context.region.width > narrowui
layout.enabled = particle_panel_enabled(context, psys) and not psys.multiple_caches
@@ -178,10 +178,8 @@ class PARTICLE_PT_emission(ParticleButtonsPanel):
layout.row().label(text="Emit From:")
row = layout.row()
- if wide_ui:
- row.prop(part, "emit_from", expand=True)
- else:
- row.prop(part, "emit_from", text="")
+ row.prop(part, "emit_from", expand=True)
+
row = layout.row()
row.prop(part, "trand")
if part.distribution != 'GRID':
@@ -189,10 +187,8 @@ class PARTICLE_PT_emission(ParticleButtonsPanel):
if part.emit_from == 'FACE' or part.emit_from == 'VOLUME':
row = layout.row()
- if wide_ui:
- row.prop(part, "distribution", expand=True)
- else:
- row.prop(part, "distribution", text="")
+
+ row.prop(part, "distribution", expand=True)
row = layout.row()
@@ -203,19 +199,20 @@ class PARTICLE_PT_emission(ParticleButtonsPanel):
row.prop(part, "grid_resolution")
-class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel):
+class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Hair dynamics"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
psys = context.particle_system
engine = context.scene.render.engine
if psys is None:
return False
if psys.settings is None:
return False
- return psys.settings.type == 'HAIR' and (engine in self.COMPAT_ENGINES)
+ return psys.settings.type == 'HAIR' and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
#cloth = context.cloth.collision_settings
@@ -260,12 +257,13 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel):
col.prop(cloth, "quality", text="Steps", slider=True)
-class PARTICLE_PT_cache(ParticleButtonsPanel):
+class PARTICLE_PT_cache(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Cache"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
psys = context.particle_system
engine = context.scene.render.engine
if psys is None:
@@ -275,7 +273,7 @@ class PARTICLE_PT_cache(ParticleButtonsPanel):
phystype = psys.settings.physics_type
if phystype == 'NO' or phystype == 'KEYED':
return False
- return (psys.settings.type in ('EMITTER', 'REACTOR') or (psys.settings.type == 'HAIR' and psys.hair_dynamics)) and engine in self.COMPAT_ENGINES
+ return (psys.settings.type in ('EMITTER', 'REACTOR') or (psys.settings.type == 'HAIR' and psys.hair_dynamics)) and engine in cls.COMPAT_ENGINES
def draw(self, context):
psys = context.particle_system
@@ -283,12 +281,13 @@ class PARTICLE_PT_cache(ParticleButtonsPanel):
point_cache_ui(self, context, psys.point_cache, True, 'HAIR' if psys.hair_dynamics else 'PSYS')
-class PARTICLE_PT_velocity(ParticleButtonsPanel):
+class PARTICLE_PT_velocity(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Velocity"
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
- if particle_panel_poll(self, context):
+ @classmethod
+ def poll(cls, context):
+ if particle_panel_poll(PARTICLE_PT_velocity, context):
psys = context.particle_system
return psys.settings.physics_type != 'BOIDS' and not psys.point_cache.external
else:
@@ -330,12 +329,13 @@ class PARTICLE_PT_velocity(ParticleButtonsPanel):
# sub.prop(part, "reaction_shape", slider=True)
-class PARTICLE_PT_rotation(ParticleButtonsPanel):
+class PARTICLE_PT_rotation(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Rotation"
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
- if particle_panel_poll(self, context):
+ @classmethod
+ def poll(cls, context):
+ if particle_panel_poll(PARTICLE_PT_rotation, context):
psys = context.particle_system
return psys.settings.physics_type != 'BOIDS' and not psys.point_cache.external
else:
@@ -346,7 +346,6 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel):
psys = context.particle_system
part = psys.settings
- wide_ui = context.region.width > narrowui
layout.enabled = particle_panel_enabled(context, psys)
@@ -364,10 +363,7 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel):
sub.prop(part, "random_phase_factor", text="Random", slider=True)
layout.row().label(text="Angular Velocity:")
- if wide_ui:
- layout.row().prop(part, "angular_velocity_mode", expand=True)
- else:
- layout.row().prop(part, "angular_velocity_mode", text="")
+ layout.row().prop(part, "angular_velocity_mode", expand=True)
split = layout.split()
sub = split.column()
@@ -376,12 +372,13 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel):
sub.prop(part, "angular_velocity_factor", text="")
-class PARTICLE_PT_physics(ParticleButtonsPanel):
+class PARTICLE_PT_physics(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Physics"
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
- if particle_panel_poll(self, context):
+ @classmethod
+ def poll(cls, context):
+ if particle_panel_poll(PARTICLE_PT_physics, context):
return not context.particle_system.point_cache.external
else:
return False
@@ -391,15 +388,11 @@ class PARTICLE_PT_physics(ParticleButtonsPanel):
psys = context.particle_system
part = psys.settings
- wide_ui = context.region.width > narrowui
layout.enabled = particle_panel_enabled(context, psys)
row = layout.row()
- if wide_ui:
- row.prop(part, "physics_type", expand=True)
- else:
- row.prop(part, "physics_type", text="")
+ row.prop(part, "physics_type", expand=True)
row = layout.row()
col = row.column(align=True)
@@ -573,11 +566,12 @@ class PARTICLE_PT_physics(ParticleButtonsPanel):
sub.prop(key, "system", text="System")
-class PARTICLE_PT_boidbrain(ParticleButtonsPanel):
+class PARTICLE_PT_boidbrain(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Boid Brain"
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
psys = context.particle_system
engine = context.scene.render.engine
if psys is None:
@@ -586,7 +580,7 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel):
return False
if psys.point_cache.external:
return False
- return psys.settings.physics_type == 'BOIDS' and engine in self.COMPAT_ENGINES
+ return psys.settings.physics_type == 'BOIDS' and engine in cls.COMPAT_ENGINES
def draw(self, context):
layout = self.layout
@@ -673,25 +667,25 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel):
row.prop(rule, "flee_distance")
-class PARTICLE_PT_render(ParticleButtonsPanel):
+class PARTICLE_PT_render(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Render"
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
psys = context.particle_system
engine = context.scene.render.engine
if psys is None:
return False
if psys.settings is None:
return False
- return engine in self.COMPAT_ENGINES
+ return engine in cls.COMPAT_ENGINES
def draw(self, context):
layout = self.layout
psys = context.particle_system
part = psys.settings
- wide_ui = context.region.width > narrowui
row = layout.row()
row.prop(part, "material")
@@ -707,10 +701,7 @@ class PARTICLE_PT_render(ParticleButtonsPanel):
sub.prop(part, "died")
row = layout.row()
- if wide_ui:
- row.prop(part, "ren_as", expand=True)
- else:
- row.prop(part, "ren_as", text="")
+ row.prop(part, "ren_as", expand=True)
split = layout.split()
@@ -797,10 +788,7 @@ class PARTICLE_PT_render(ParticleButtonsPanel):
sub.label(text="Align:")
row = layout.row()
- if wide_ui:
- row.prop(part, "billboard_align", expand=True)
- else:
- row.prop(part, "billboard_align", text="")
+ row.prop(part, "billboard_align", expand=True)
row.prop(part, "billboard_lock", text="Lock")
row = layout.row()
row.prop(part, "billboard_object")
@@ -843,32 +831,29 @@ class PARTICLE_PT_render(ParticleButtonsPanel):
col.label(text="")
-class PARTICLE_PT_draw(ParticleButtonsPanel):
+class PARTICLE_PT_draw(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Display"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
psys = context.particle_system
engine = context.scene.render.engine
if psys is None:
return False
if psys.settings is None:
return False
- return engine in self.COMPAT_ENGINES
+ return engine in cls.COMPAT_ENGINES
def draw(self, context):
layout = self.layout
psys = context.particle_system
part = psys.settings
- wide_ui = context.region.width > narrowui
row = layout.row()
- if wide_ui:
- row.prop(part, "draw_as", expand=True)
- else:
- row.prop(part, "draw_as", text="")
+ row.prop(part, "draw_as", expand=True)
if part.draw_as == 'NONE' or (part.ren_as == 'NONE' and part.draw_as == 'RENDER'):
return
@@ -902,22 +887,22 @@ class PARTICLE_PT_draw(ParticleButtonsPanel):
#sub.label(text="Override material color")
-class PARTICLE_PT_children(ParticleButtonsPanel):
+class PARTICLE_PT_children(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Children"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
+ @classmethod
+ def poll(cls, context):
+ return particle_panel_poll(cls, context)
+
def draw(self, context):
layout = self.layout
psys = context.particle_system
part = psys.settings
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.row().prop(part, "child_type", expand=True)
- else:
- layout.row().prop(part, "child_type", text="")
+ layout.row().prop(part, "child_type", expand=True)
if part.child_type == 'NONE':
return
@@ -973,10 +958,7 @@ class PARTICLE_PT_children(ParticleButtonsPanel):
col.label(text="hair parting controls")
layout.row().label(text="Kink:")
- if wide_ui:
- layout.row().prop(part, "kink", expand=True)
- else:
- layout.row().prop(part, "kink", text="")
+ layout.row().prop(part, "kink", expand=True)
split = layout.split()
@@ -987,7 +969,7 @@ class PARTICLE_PT_children(ParticleButtonsPanel):
col.prop(part, "kink_shape", slider=True)
-class PARTICLE_PT_field_weights(ParticleButtonsPanel):
+class PARTICLE_PT_field_weights(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Field Weights"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -1000,7 +982,7 @@ class PARTICLE_PT_field_weights(ParticleButtonsPanel):
self.layout.prop(part.effector_weights, "do_growing_hair")
-class PARTICLE_PT_force_fields(ParticleButtonsPanel):
+class PARTICLE_PT_force_fields(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Force Field Settings"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -1028,7 +1010,7 @@ class PARTICLE_PT_force_fields(ParticleButtonsPanel):
basic_force_field_falloff_ui(self, context, part.force_field_2)
-class PARTICLE_PT_vertexgroups(ParticleButtonsPanel):
+class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Vertexgroups"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -1096,35 +1078,12 @@ class PARTICLE_PT_vertexgroups(ParticleButtonsPanel):
row.prop(psys, "vertex_group_field_negate", text="")
-classes = [
- PARTICLE_PT_context_particles,
- PARTICLE_PT_hair_dynamics,
- PARTICLE_PT_cache,
- PARTICLE_PT_emission,
- PARTICLE_PT_velocity,
- PARTICLE_PT_rotation,
- PARTICLE_PT_physics,
- PARTICLE_PT_boidbrain,
- PARTICLE_PT_render,
- PARTICLE_PT_draw,
- PARTICLE_PT_children,
- PARTICLE_PT_field_weights,
- PARTICLE_PT_force_fields,
- PARTICLE_PT_vertexgroups,
-
- PARTICLE_PT_custom_props]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_physics_cloth.py b/release/scripts/ui/properties_physics_cloth.py
index 61e1fe81812..0755b9be603 100644
--- a/release/scripts/ui/properties_physics_cloth.py
+++ b/release/scripts/ui/properties_physics_cloth.py
@@ -19,8 +19,6 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
from properties_physics_common import point_cache_ui
from properties_physics_common import effector_weights_ui
@@ -40,18 +38,19 @@ class CLOTH_MT_presets(bpy.types.Menu):
draw = bpy.types.Menu.draw_preset
-class PhysicButtonsPanel(bpy.types.Panel):
+class PhysicButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "physics"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
ob = context.object
rd = context.scene.render
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
-class PHYSICS_PT_cloth(PhysicButtonsPanel):
+class PHYSICS_PT_cloth(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Cloth"
def draw(self, context):
@@ -59,7 +58,6 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel):
md = context.cloth
ob = context.object
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -74,8 +72,7 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel):
else:
# add modifier
split.operator("object.modifier_add", text="Add").type = 'CLOTH'
- if wide_ui:
- split.label()
+ split.label()
if md:
cloth = md.settings
@@ -99,8 +96,7 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel):
col.prop(cloth, "structural_stiffness", text="Structural")
col.prop(cloth, "bending_stiffness", text="Bending")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Damping:")
col.prop(cloth, "spring_damping", text="Spring")
@@ -133,11 +129,12 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel):
col.prop_object(cloth, "rest_shape_key", key, "keys", text="")
-class PHYSICS_PT_cloth_cache(PhysicButtonsPanel):
+class PHYSICS_PT_cloth_cache(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Cloth Cache"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.cloth
def draw(self, context):
@@ -145,11 +142,12 @@ class PHYSICS_PT_cloth_cache(PhysicButtonsPanel):
point_cache_ui(self, context, md.point_cache, cloth_panel_enabled(md), 'CLOTH')
-class PHYSICS_PT_cloth_collision(PhysicButtonsPanel):
+class PHYSICS_PT_cloth_collision(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Cloth Collision"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.cloth
def draw_header(self, context):
@@ -163,7 +161,6 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel):
cloth = context.cloth.collision_settings
md = context.cloth
- wide_ui = context.region.width > narrowui
layout.active = cloth.enable_collision and cloth_panel_enabled(md)
@@ -174,8 +171,7 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel):
col.prop(cloth, "min_distance", slider=True, text="Distance")
col.prop(cloth, "friction")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(cloth, "enable_self_collision", text="Self Collision")
sub = col.column()
sub.active = cloth.enable_self_collision
@@ -185,11 +181,12 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel):
layout.prop(cloth, "group")
-class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel):
+class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Cloth Stiffness Scaling"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.cloth
def draw_header(self, context):
@@ -204,7 +201,6 @@ class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel):
md = context.cloth
ob = context.object
cloth = context.cloth.settings
- wide_ui = context.region.width > narrowui
layout.active = cloth.stiffness_scaling and cloth_panel_enabled(md)
@@ -215,18 +211,18 @@ class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel):
col.prop_object(cloth, "structural_stiffness_vertex_group", ob, "vertex_groups", text="")
col.prop(cloth, "structural_stiffness_max", text="Max")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Bending Stiffness:")
col.prop_object(cloth, "bending_vertex_group", ob, "vertex_groups", text="")
col.prop(cloth, "bending_stiffness_max", text="Max")
-class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel):
+class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Cloth Field Weights"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.cloth)
def draw(self, context):
@@ -234,26 +230,12 @@ class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel):
effector_weights_ui(self, context, cloth.effector_weights)
-classes = [
- CLOTH_MT_presets,
-
- PHYSICS_PT_cloth,
- PHYSICS_PT_cloth_cache,
- PHYSICS_PT_cloth_collision,
- PHYSICS_PT_cloth_stiffness,
- PHYSICS_PT_cloth_field_weights]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_physics_common.py b/release/scripts/ui/properties_physics_common.py
index be8972e4fe6..340cd88251c 100644
--- a/release/scripts/ui/properties_physics_common.py
+++ b/release/scripts/ui/properties_physics_common.py
@@ -20,15 +20,12 @@
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
#cachetype can be 'PSYS' 'HAIR' 'SMOKE' etc
def point_cache_ui(self, context, cache, enabled, cachetype):
layout = self.layout
- wide_ui = context.region.width > narrowui
layout.set_context_pointer("point_cache", cache)
row = layout.row()
@@ -66,8 +63,7 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
if cachetype != 'SMOKE':
col.prop(cache, "step")
- if wide_ui:
- col = split.column()
+ col = split.column()
if cachetype != 'SMOKE':
sub = col.column()
@@ -102,8 +98,7 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
sub.operator("ptcache.bake_from_cache", text="Current Cache to Bake")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.operator("ptcache.bake_all", text="Bake All Dynamics").bake = True
col.operator("ptcache.free_bake_all", text="Free All Bakes")
col.operator("ptcache.bake_all", text="Update All To Frame").bake = False
@@ -112,7 +107,6 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
def effector_weights_ui(self, context, weights):
layout = self.layout
- wide_ui = context.region.width > narrowui
layout.prop(weights, "group")
@@ -121,8 +115,7 @@ def effector_weights_ui(self, context, weights):
col = split.column()
col.prop(weights, "gravity", slider=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(weights, "all", slider=True)
layout.separator()
@@ -137,8 +130,7 @@ def effector_weights_ui(self, context, weights):
col.prop(weights, "curveguide", slider=True)
col.prop(weights, "texture", slider=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(weights, "harmonic", slider=True)
col.prop(weights, "charge", slider=True)
col.prop(weights, "lennardjones", slider=True)
@@ -150,7 +142,6 @@ def effector_weights_ui(self, context, weights):
def basic_force_field_settings_ui(self, context, field):
layout = self.layout
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -177,8 +168,7 @@ def basic_force_field_settings_ui(self, context, field):
else:
col.prop(field, "flow")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(field, "noise")
col.prop(field, "seed")
if field.type == 'TURBULENCE':
@@ -193,8 +183,7 @@ def basic_force_field_settings_ui(self, context, field):
col.prop(field, "do_location")
col.prop(field, "do_rotation")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Collision:")
col.prop(field, "do_absorption")
@@ -202,12 +191,9 @@ def basic_force_field_settings_ui(self, context, field):
def basic_force_field_falloff_ui(self, context, field):
layout = self.layout
- wide_ui = context.region.width > narrowui
# XXX: This doesn't update for some reason.
- #if wide_ui:
- # split = layout.split()
- #else:
+ #split = layout.split()
split = layout.split(percentage=0.35)
if not field or field.type == 'NONE':
@@ -218,8 +204,7 @@ def basic_force_field_falloff_ui(self, context, field):
col.prop(field, "use_min_distance", text="Use Minimum")
col.prop(field, "use_max_distance", text="Use Maximum")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(field, "falloff_power", text="Power")
sub = col.column()
diff --git a/release/scripts/ui/properties_physics_field.py b/release/scripts/ui/properties_physics_field.py
index 57fa40e4c5d..b67232f888d 100644
--- a/release/scripts/ui/properties_physics_field.py
+++ b/release/scripts/ui/properties_physics_field.py
@@ -19,24 +19,23 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
from properties_physics_common import basic_force_field_settings_ui
from properties_physics_common import basic_force_field_falloff_ui
-class PhysicButtonsPanel(bpy.types.Panel):
+class PhysicButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "physics"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
rd = context.scene.render
return (context.object) and (not rd.use_game_engine)
-class PHYSICS_PT_field(PhysicButtonsPanel):
+class PHYSICS_PT_field(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Force Fields"
def draw(self, context):
@@ -44,22 +43,15 @@ class PHYSICS_PT_field(PhysicButtonsPanel):
ob = context.object
field = ob.field
- wide_ui = context.region.width > narrowui
- if wide_ui:
- split = layout.split(percentage=0.2)
- split.label(text="Type:")
- else:
- split = layout.split()
+ split = layout.split(percentage=0.2)
+ split.label(text="Type:")
split.prop(field, "type", text="")
if field.type not in ('NONE', 'GUIDE', 'TEXTURE'):
- if wide_ui:
- split = layout.split(percentage=0.2)
- split.label(text="Shape:")
- else:
- split = layout.split()
+ split = layout.split(percentage=0.2)
+ split.label(text="Shape:")
split.prop(field, "shape", text="")
split = layout.split()
@@ -74,8 +66,7 @@ class PHYSICS_PT_field(PhysicButtonsPanel):
col.prop(field, "guide_path_add")
col.prop(field, "use_guide_path_weight")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Clumping:")
col.prop(field, "guide_clump_amount")
col.prop(field, "guide_clump_shape")
@@ -98,8 +89,7 @@ class PHYSICS_PT_field(PhysicButtonsPanel):
col.prop(field, "guide_kink_frequency")
col.prop(field, "guide_kink_shape")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(field, "guide_kink_amplitude")
elif field.type == 'TEXTURE':
@@ -109,8 +99,7 @@ class PHYSICS_PT_field(PhysicButtonsPanel):
col.prop(field, "texture_mode", text="")
col.prop(field, "texture_nabla")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(field, "use_coordinates")
col.prop(field, "root_coordinates")
col.prop(field, "force_2d")
@@ -134,8 +123,7 @@ class PHYSICS_PT_field(PhysicButtonsPanel):
col.prop(field, "use_radial_min", text="Use Minimum")
col.prop(field, "use_radial_max", text="Use Maximum")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(field, "radial_falloff", text="Power")
sub = col.column()
@@ -156,8 +144,7 @@ class PHYSICS_PT_field(PhysicButtonsPanel):
col.prop(field, "use_radial_min", text="Use Minimum")
col.prop(field, "use_radial_max", text="Use Maximum")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(field, "radial_falloff", text="Power")
sub = col.column()
@@ -169,11 +156,12 @@ class PHYSICS_PT_field(PhysicButtonsPanel):
sub.prop(field, "radial_maximum", text="Distance")
-class PHYSICS_PT_collision(PhysicButtonsPanel):
+class PHYSICS_PT_collision(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Collision"
#bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
ob = context.object
rd = context.scene.render
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
@@ -182,7 +170,6 @@ class PHYSICS_PT_collision(PhysicButtonsPanel):
layout = self.layout
md = context.collision
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -190,8 +177,7 @@ class PHYSICS_PT_collision(PhysicButtonsPanel):
# remove modifier + settings
split.set_context_pointer("modifier", md)
split.operator("object.modifier_remove", text="Remove")
- if wide_ui:
- col = split.column()
+ col = split.column()
#row = split.row(align=True)
#row.prop(md, "render", text="")
@@ -202,8 +188,7 @@ class PHYSICS_PT_collision(PhysicButtonsPanel):
else:
# add modifier
split.operator("object.modifier_add", text="Add").type = 'COLLISION'
- if wide_ui:
- split.label()
+ split.label()
coll = None
@@ -229,8 +214,7 @@ class PHYSICS_PT_collision(PhysicButtonsPanel):
sub.prop(settings, "friction_factor", text="Factor", slider=True)
sub.prop(settings, "random_friction", text="Random", slider=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Soft Body and Cloth:")
sub = col.column(align=True)
sub.prop(settings, "outer_thickness", text="Outer", slider=True)
@@ -243,21 +227,12 @@ class PHYSICS_PT_collision(PhysicButtonsPanel):
col.prop(settings, "absorption", text="Absorption")
-classes = [
- PHYSICS_PT_field,
- PHYSICS_PT_collision]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_physics_fluid.py b/release/scripts/ui/properties_physics_fluid.py
index 32acd88654d..2c25270eb39 100644
--- a/release/scripts/ui/properties_physics_fluid.py
+++ b/release/scripts/ui/properties_physics_fluid.py
@@ -19,28 +19,26 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
-class PhysicButtonsPanel(bpy.types.Panel):
+class PhysicButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "physics"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
ob = context.object
rd = context.scene.render
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
-class PHYSICS_PT_fluid(PhysicButtonsPanel):
+class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Fluid"
def draw(self, context):
layout = self.layout
md = context.fluid
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -58,22 +56,16 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
else:
# add modifier
split.operator("object.modifier_add", text="Add").type = 'FLUID_SIMULATION'
- if wide_ui:
- split.label()
+ split.label()
fluid = None
if fluid:
- if wide_ui:
- row = layout.row()
- row.prop(fluid, "type")
- if fluid.type not in ('NONE', 'DOMAIN', 'PARTICLE'):
- row.prop(fluid, "active", text="")
- else:
- layout.prop(fluid, "type", text="")
- if fluid.type not in ('NONE', 'DOMAIN', 'PARTICLE'):
- layout.prop(fluid, "active", text="")
+ row = layout.row()
+ row.prop(fluid, "type")
+ if fluid.type not in ('NONE', 'DOMAIN', 'PARTICLE'):
+ row.prop(fluid, "active", text="")
layout = layout.column()
if fluid.type not in ('NONE', 'DOMAIN', 'PARTICLE'):
@@ -89,8 +81,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
col.label(text="Render Display:")
col.prop(fluid, "render_display_mode", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Required Memory: " + fluid.memory_estimate)
col.prop(fluid, "preview_resolution", text="Preview")
col.label(text="Viewport Display:")
@@ -104,9 +95,8 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
sub.prop(fluid, "start_time", text="Start")
sub.prop(fluid, "end_time", text="End")
- if wide_ui:
- col = split.column()
- col.label()
+ col = split.column()
+ col.label()
col.prop(fluid, "generate_speed_vectors")
col.prop(fluid, "reverse_frames")
@@ -120,8 +110,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
col.prop(fluid, "volume_initialization", text="")
col.prop(fluid, "export_animated_mesh")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Initial Velocity:")
col.prop(fluid, "initial_velocity", text="")
@@ -133,8 +122,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
col.prop(fluid, "volume_initialization", text="")
col.prop(fluid, "export_animated_mesh")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Slip Type:")
col.prop(fluid, "slip_type", text="")
if fluid.slip_type == 'PARTIALSLIP':
@@ -152,8 +140,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
col.prop(fluid, "export_animated_mesh")
col.prop(fluid, "local_coordinates")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Inflow Velocity:")
col.prop(fluid, "inflow_velocity", text="")
@@ -165,8 +152,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
col.prop(fluid, "volume_initialization", text="")
col.prop(fluid, "export_animated_mesh")
- if wide_ui:
- split.column()
+ split.column()
elif fluid.type == 'PARTICLE':
split = layout.split()
@@ -176,8 +162,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
col.prop(fluid, "particle_influence", text="Size")
col.prop(fluid, "alpha_influence", text="Alpha")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Type:")
col.prop(fluid, "drops")
col.prop(fluid, "floats")
@@ -193,8 +178,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
col.prop(fluid, "quality", slider=True)
col.prop(fluid, "reverse_frames")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Time:")
sub = col.column(align=True)
sub.prop(fluid, "start_time", text="Start")
@@ -208,28 +192,27 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
sub.prop(fluid, "attraction_strength", text="Strength")
sub.prop(fluid, "attraction_radius", text="Radius")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Velocity Force:")
sub = col.column(align=True)
sub.prop(fluid, "velocity_strength", text="Strength")
sub.prop(fluid, "velocity_radius", text="Radius")
-class PHYSICS_PT_domain_gravity(PhysicButtonsPanel):
+class PHYSICS_PT_domain_gravity(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Domain World"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
md = context.fluid
- return md and (md.settings.type == 'DOMAIN')
+ return md and md.settings and (md.settings.type == 'DOMAIN')
def draw(self, context):
layout = self.layout
fluid = context.fluid.settings
scene = context.scene
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -252,8 +235,7 @@ class PHYSICS_PT_domain_gravity(PhysicButtonsPanel):
col.label(text="Real World Size:")
col.prop(fluid, "real_world_size", text="Metres")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Viscosity Presets:")
sub = col.column(align=True)
sub.prop(fluid, "viscosity_preset", text="")
@@ -267,19 +249,19 @@ class PHYSICS_PT_domain_gravity(PhysicButtonsPanel):
col.prop(fluid, "compressibility", slider=True)
-class PHYSICS_PT_domain_boundary(PhysicButtonsPanel):
+class PHYSICS_PT_domain_boundary(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Domain Boundary"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
md = context.fluid
- return md and (md.settings.type == 'DOMAIN')
+ return md and md.settings and (md.settings.type == 'DOMAIN')
def draw(self, context):
layout = self.layout
fluid = context.fluid.settings
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -289,20 +271,20 @@ class PHYSICS_PT_domain_boundary(PhysicButtonsPanel):
if fluid.slip_type == 'PARTIALSLIP':
col.prop(fluid, "partial_slip_factor", slider=True, text="Amount")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Surface:")
col.prop(fluid, "surface_smoothing", text="Smoothing")
col.prop(fluid, "surface_subdivisions", text="Subdivisions")
-class PHYSICS_PT_domain_particles(PhysicButtonsPanel):
+class PHYSICS_PT_domain_particles(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Domain Particles"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
md = context.fluid
- return md and (md.settings.type == 'DOMAIN')
+ return md and md.settings and (md.settings.type == 'DOMAIN')
def draw(self, context):
layout = self.layout
@@ -314,23 +296,12 @@ class PHYSICS_PT_domain_particles(PhysicButtonsPanel):
col.prop(fluid, "generate_particles")
-classes = [
- PHYSICS_PT_fluid,
- PHYSICS_PT_domain_gravity,
- PHYSICS_PT_domain_boundary,
- PHYSICS_PT_domain_particles]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_physics_smoke.py b/release/scripts/ui/properties_physics_smoke.py
index 9bae4c5b63f..3538b88afcf 100644
--- a/release/scripts/ui/properties_physics_smoke.py
+++ b/release/scripts/ui/properties_physics_smoke.py
@@ -19,25 +19,24 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
from properties_physics_common import point_cache_ui
from properties_physics_common import effector_weights_ui
-class PhysicButtonsPanel(bpy.types.Panel):
+class PhysicButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "physics"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
ob = context.object
rd = context.scene.render
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
-class PHYSICS_PT_smoke(PhysicButtonsPanel):
+class PHYSICS_PT_smoke(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Smoke"
def draw(self, context):
@@ -45,7 +44,6 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel):
md = context.smoke
ob = context.object
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -61,14 +59,10 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel):
else:
# add modifier
split.operator("object.modifier_add", text="Add").type = 'SMOKE'
- if wide_ui:
- split.label()
+ split.label()
if md:
- if wide_ui:
- layout.prop(md, "smoke_type", expand=True)
- else:
- layout.prop(md, "smoke_type", text="")
+ layout.prop(md, "smoke_type", expand=True)
if md.smoke_type == 'DOMAIN':
domain = md.domain_settings
@@ -83,8 +77,7 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel):
col.label(text="Border Collisions:")
col.prop(domain, "smoke_domain_colli", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Behavior:")
col.prop(domain, "alpha")
col.prop(domain, "beta")
@@ -114,8 +107,8 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel):
sub.active = flow.initial_velocity
sub.prop(flow, "velocity_multiplier", text="Multiplier")
- if wide_ui:
- sub = split.column()
+
+ sub = split.column()
sub.active = not md.flow_settings.outflow
sub.label(text="Behavior:")
sub.prop(flow, "temperature")
@@ -126,11 +119,12 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel):
# layout.separator()
-class PHYSICS_PT_smoke_groups(PhysicButtonsPanel):
+class PHYSICS_PT_smoke_groups(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Smoke Groups"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
md = context.smoke
return md and (md.smoke_type == 'DOMAIN')
@@ -138,7 +132,6 @@ class PHYSICS_PT_smoke_groups(PhysicButtonsPanel):
layout = self.layout
group = context.smoke.domain_settings
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -149,17 +142,17 @@ class PHYSICS_PT_smoke_groups(PhysicButtonsPanel):
#col.label(text="Effector Group:")
#col.prop(group, "eff_group", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Collision Group:")
col.prop(group, "coll_group", text="")
-class PHYSICS_PT_smoke_cache(PhysicButtonsPanel):
+class PHYSICS_PT_smoke_cache(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Smoke Cache"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
md = context.smoke
return md and (md.smoke_type == 'DOMAIN')
@@ -175,11 +168,12 @@ class PHYSICS_PT_smoke_cache(PhysicButtonsPanel):
point_cache_ui(self, context, cache, (cache.baked is False), 'SMOKE')
-class PHYSICS_PT_smoke_highres(PhysicButtonsPanel):
+class PHYSICS_PT_smoke_highres(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Smoke High Resolution"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
md = context.smoke
return md and (md.smoke_type == 'DOMAIN')
@@ -192,7 +186,6 @@ class PHYSICS_PT_smoke_highres(PhysicButtonsPanel):
layout = self.layout
md = context.smoke.domain_settings
- wide_ui = context.region.width > narrowui
layout.active = md.highres
@@ -204,18 +197,18 @@ class PHYSICS_PT_smoke_highres(PhysicButtonsPanel):
col.prop(md, "smoothemitter")
col.prop(md, "viewhighres")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Noise Method:")
col.row().prop(md, "noise_type", text="")
col.prop(md, "strength")
-class PHYSICS_PT_smoke_cache_highres(PhysicButtonsPanel):
+class PHYSICS_PT_smoke_cache_highres(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Smoke High Resolution Cache"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
md = context.smoke
return md and (md.smoke_type == 'DOMAIN') and md.domain_settings.highres
@@ -231,11 +224,12 @@ class PHYSICS_PT_smoke_cache_highres(PhysicButtonsPanel):
point_cache_ui(self, context, cache, (cache.baked is False), 'SMOKE')
-class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel):
+class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Smoke Field Weights"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
smoke = context.smoke
return (smoke and smoke.smoke_type == 'DOMAIN')
@@ -244,25 +238,12 @@ class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel):
effector_weights_ui(self, context, domain.effector_weights)
-classes = [
- PHYSICS_PT_smoke,
- PHYSICS_PT_smoke_field_weights,
- PHYSICS_PT_smoke_cache,
- PHYSICS_PT_smoke_highres,
- PHYSICS_PT_smoke_groups,
- PHYSICS_PT_smoke_cache_highres]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_physics_softbody.py b/release/scripts/ui/properties_physics_softbody.py
index 60149cf533b..5240e6477d8 100644
--- a/release/scripts/ui/properties_physics_softbody.py
+++ b/release/scripts/ui/properties_physics_softbody.py
@@ -19,8 +19,6 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
from properties_physics_common import point_cache_ui
from properties_physics_common import effector_weights_ui
@@ -30,12 +28,13 @@ def softbody_panel_enabled(md):
return (md.point_cache.baked is False)
-class PhysicButtonsPanel(bpy.types.Panel):
+class PhysicButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "physics"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
ob = context.object
rd = context.scene.render
# return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
@@ -43,7 +42,7 @@ class PhysicButtonsPanel(bpy.types.Panel):
return (ob and (ob.type == 'MESH' or ob.type == 'LATTICE'or ob.type == 'CURVE')) and (not rd.use_game_engine)
-class PHYSICS_PT_softbody(PhysicButtonsPanel):
+class PHYSICS_PT_softbody(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body"
def draw(self, context):
@@ -51,7 +50,6 @@ class PHYSICS_PT_softbody(PhysicButtonsPanel):
md = context.soft_body
ob = context.object
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -66,8 +64,7 @@ class PHYSICS_PT_softbody(PhysicButtonsPanel):
else:
# add modifier
split.operator("object.modifier_add", text="Add").type = 'SOFT_BODY'
- if wide_ui:
- split.column()
+ split.column()
if md:
softbody = md.settings
@@ -82,17 +79,17 @@ class PHYSICS_PT_softbody(PhysicButtonsPanel):
col.prop(softbody, "mass")
col.prop_object(softbody, "mass_vertex_group", ob, "vertex_groups", text="Mass:")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Simulation:")
col.prop(softbody, "speed")
-class PHYSICS_PT_softbody_cache(PhysicButtonsPanel):
+class PHYSICS_PT_softbody_cache(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body Cache"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.soft_body
def draw(self, context):
@@ -100,11 +97,12 @@ class PHYSICS_PT_softbody_cache(PhysicButtonsPanel):
point_cache_ui(self, context, md.point_cache, softbody_panel_enabled(md), 'SOFTBODY')
-class PHYSICS_PT_softbody_goal(PhysicButtonsPanel):
+class PHYSICS_PT_softbody_goal(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body Goal"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.soft_body
def draw_header(self, context):
@@ -119,7 +117,6 @@ class PHYSICS_PT_softbody_goal(PhysicButtonsPanel):
md = context.soft_body
softbody = md.settings
ob = context.object
- wide_ui = context.region.width > narrowui
layout.active = softbody.use_goal and softbody_panel_enabled(md)
@@ -135,8 +132,7 @@ class PHYSICS_PT_softbody_goal(PhysicButtonsPanel):
sub.prop(softbody, "goal_min", text="Minimum")
sub.prop(softbody, "goal_max", text="Maximum")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Goal Settings:")
col.prop(softbody, "goal_spring", text="Stiffness")
col.prop(softbody, "goal_friction", text="Damping")
@@ -144,11 +140,12 @@ class PHYSICS_PT_softbody_goal(PhysicButtonsPanel):
layout.prop_object(softbody, "goal_vertex_group", ob, "vertex_groups", text="Vertex Group")
-class PHYSICS_PT_softbody_edge(PhysicButtonsPanel):
+class PHYSICS_PT_softbody_edge(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body Edges"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.soft_body
def draw_header(self, context):
@@ -163,7 +160,6 @@ class PHYSICS_PT_softbody_edge(PhysicButtonsPanel):
md = context.soft_body
softbody = md.settings
ob = context.object
- wide_ui = context.region.width > narrowui
layout.active = softbody.use_edges and softbody_panel_enabled(md)
@@ -179,8 +175,7 @@ class PHYSICS_PT_softbody_edge(PhysicButtonsPanel):
col.prop(softbody, "spring_length", text="Length")
col.prop_object(softbody, "spring_vertex_group", ob, "vertex_groups", text="Springs:")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(softbody, "stiff_quads")
sub = col.column()
sub.active = softbody.stiff_quads
@@ -199,11 +194,12 @@ class PHYSICS_PT_softbody_edge(PhysicButtonsPanel):
col.prop(softbody, "face_collision", text="Face")
-class PHYSICS_PT_softbody_collision(PhysicButtonsPanel):
+class PHYSICS_PT_softbody_collision(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body Self Collision"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.soft_body
def draw_header(self, context):
@@ -217,15 +213,11 @@ class PHYSICS_PT_softbody_collision(PhysicButtonsPanel):
md = context.soft_body
softbody = md.settings
- wide_ui = context.region.width > narrowui
layout.active = softbody.self_collision and softbody_panel_enabled(md)
layout.label(text="Collision Ball Size Calculation:")
- if wide_ui:
- layout.prop(softbody, "collision_type", expand=True)
- else:
- layout.prop(softbody, "collision_type", text="")
+ layout.prop(softbody, "collision_type", expand=True)
col = layout.column(align=True)
col.label(text="Ball:")
@@ -234,11 +226,12 @@ class PHYSICS_PT_softbody_collision(PhysicButtonsPanel):
col.prop(softbody, "ball_damp", text="Dampening")
-class PHYSICS_PT_softbody_solver(PhysicButtonsPanel):
+class PHYSICS_PT_softbody_solver(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body Solver"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.soft_body
def draw(self, context):
@@ -246,7 +239,6 @@ class PHYSICS_PT_softbody_solver(PhysicButtonsPanel):
md = context.soft_body
softbody = md.settings
- wide_ui = context.region.width > narrowui
layout.active = softbody_panel_enabled(md)
@@ -259,8 +251,7 @@ class PHYSICS_PT_softbody_solver(PhysicButtonsPanel):
col.prop(softbody, "maxstep")
col.prop(softbody, "auto_step", text="Auto-Step")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(softbody, "error_limit")
col.label(text="Helpers:")
col.prop(softbody, "choke")
@@ -271,11 +262,12 @@ class PHYSICS_PT_softbody_solver(PhysicButtonsPanel):
layout.prop(softbody, "estimate_matrix")
-class PHYSICS_PT_softbody_field_weights(PhysicButtonsPanel):
+class PHYSICS_PT_softbody_field_weights(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body Field Weights"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.soft_body)
def draw(self, context):
@@ -285,26 +277,12 @@ class PHYSICS_PT_softbody_field_weights(PhysicButtonsPanel):
effector_weights_ui(self, context, softbody.effector_weights)
-classes = [
- PHYSICS_PT_softbody,
- PHYSICS_PT_softbody_cache,
- PHYSICS_PT_softbody_goal,
- PHYSICS_PT_softbody_edge,
- PHYSICS_PT_softbody_collision,
- PHYSICS_PT_softbody_solver,
- PHYSICS_PT_softbody_field_weights]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_render.py b/release/scripts/ui/properties_render.py
index e446767fa01..6856e73dc2f 100644
--- a/release/scripts/ui/properties_render.py
+++ b/release/scripts/ui/properties_render.py
@@ -19,8 +19,6 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
class RENDER_MT_presets(bpy.types.Menu):
bl_label = "Render Presets"
@@ -36,18 +34,19 @@ class RENDER_MT_ffmpeg_presets(bpy.types.Menu):
draw = bpy.types.Menu.draw_preset
-class RenderButtonsPanel(bpy.types.Panel):
+class RenderButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "render"
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
rd = context.scene.render
- return (context.scene and rd.use_game_engine is False) and (rd.engine in self.COMPAT_ENGINES)
+ return (context.scene and rd.use_game_engine is False) and (rd.engine in cls.COMPAT_ENGINES)
-class RENDER_PT_render(RenderButtonsPanel):
+class RENDER_PT_render(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Render"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -55,21 +54,19 @@ class RENDER_PT_render(RenderButtonsPanel):
layout = self.layout
rd = context.scene.render
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.operator("render.render", text="Image", icon='RENDER_STILL')
- if wide_ui:
- col = split.column()
+ col = split.column()
col.operator("render.render", text="Animation", icon='RENDER_ANIMATION').animation = True
layout.prop(rd, "display_mode", text="Display")
-class RENDER_PT_layers(RenderButtonsPanel):
+class RENDER_PT_layers(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Layers"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -79,7 +76,6 @@ class RENDER_PT_layers(RenderButtonsPanel):
scene = context.scene
rd = scene.render
- wide_ui = context.region.width > narrowui
row = layout.row()
row.template_list(rd, "layers", rd, "active_layer_index", rows=2)
@@ -100,8 +96,8 @@ class RENDER_PT_layers(RenderButtonsPanel):
col.label(text="")
col.prop(rl, "light_override", text="Light")
col.prop(rl, "material_override", text="Material")
- if wide_ui:
- col = split.column()
+
+ col = split.column()
col.prop(rl, "visible_layers", text="Layer")
col.label(text="Mask Layers:")
col.prop(rl, "zmask_layers", text="")
@@ -145,8 +141,7 @@ class RENDER_PT_layers(RenderButtonsPanel):
col.prop(rl, "pass_object_index")
col.prop(rl, "pass_color")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label()
col.prop(rl, "pass_diffuse")
row = col.row()
@@ -175,11 +170,12 @@ class RENDER_PT_layers(RenderButtonsPanel):
row.prop(rl, "pass_refraction_exclude", text="")
-class RENDER_PT_freestyle(RenderButtonsPanel):
+class RENDER_PT_freestyle(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Freestyle"
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
rd = context.scene.render
rl = rd.layers[rd.active_layer_index]
return rl and rl.freestyle
@@ -279,11 +275,12 @@ class RENDER_PT_freestyle(RenderButtonsPanel):
row.operator("scene.freestyle_module_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
-class RENDER_PT_freestyle_linestyle(RenderButtonsPanel):
+class RENDER_PT_freestyle_linestyle(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Freestyle: Line Style"
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
rd = context.scene.render
rl = rd.layers[rd.active_layer_index]
if rl and rl.freestyle:
@@ -421,7 +418,7 @@ class RENDER_PT_freestyle_linestyle(RenderButtonsPanel):
pass
-class RENDER_PT_shading(RenderButtonsPanel):
+class RENDER_PT_shading(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Shading"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -429,7 +426,6 @@ class RENDER_PT_shading(RenderButtonsPanel):
layout = self.layout
rd = context.scene.render
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -439,14 +435,13 @@ class RENDER_PT_shading(RenderButtonsPanel):
col.prop(rd, "use_sss", text="Subsurface Scattering")
col.prop(rd, "use_envmaps", text="Environment Map")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(rd, "use_raytracing", text="Ray Tracing")
col.prop(rd, "color_management")
col.prop(rd, "alpha_mode", text="Alpha")
-class RENDER_PT_performance(RenderButtonsPanel):
+class RENDER_PT_performance(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Performance"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -455,7 +450,6 @@ class RENDER_PT_performance(RenderButtonsPanel):
layout = self.layout
rd = context.scene.render
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -470,8 +464,7 @@ class RENDER_PT_performance(RenderButtonsPanel):
sub.prop(rd, "parts_x", text="X")
sub.prop(rd, "parts_y", text="Y")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Memory:")
sub = col.column()
sub.enabled = not (rd.use_border or rd.full_sample)
@@ -490,7 +483,7 @@ class RENDER_PT_performance(RenderButtonsPanel):
sub.prop(rd, "use_local_coords", text="Local Coordinates")
-class RENDER_PT_post_processing(RenderButtonsPanel):
+class RENDER_PT_post_processing(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Post Processing"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -499,7 +492,6 @@ class RENDER_PT_post_processing(RenderButtonsPanel):
layout = self.layout
rd = context.scene.render
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -507,8 +499,7 @@ class RENDER_PT_post_processing(RenderButtonsPanel):
col.prop(rd, "use_compositing")
col.prop(rd, "use_sequencer")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(rd, "dither_intensity", text="Dither", slider=True)
layout.separator()
@@ -523,10 +514,7 @@ class RENDER_PT_post_processing(RenderButtonsPanel):
sub.prop(rd, "fields_still", text="Still")
- if wide_ui:
- col = split.column()
- else:
- col.separator()
+ col = split.column()
col.prop(rd, "edge")
sub = col.column()
sub.active = rd.edge
@@ -540,7 +528,7 @@ class RENDER_PT_post_processing(RenderButtonsPanel):
col.prop(rd, "freestyle", text="Freestyle")
-class RENDER_PT_output(RenderButtonsPanel):
+class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Output"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -549,7 +537,6 @@ class RENDER_PT_output(RenderButtonsPanel):
rd = context.scene.render
file_format = rd.file_format
- wide_ui = context.region.width > narrowui
layout.prop(rd, "output_path", text="")
@@ -558,8 +545,7 @@ class RENDER_PT_output(RenderButtonsPanel):
col.prop(rd, "file_format", text="")
col.row().prop(rd, "color_mode", text="Color", expand=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(rd, "use_file_extension")
col.prop(rd, "use_overwrite")
col.prop(rd, "use_placeholder")
@@ -578,8 +564,7 @@ class RENDER_PT_output(RenderButtonsPanel):
col = split.column()
col.label(text="Codec:")
col.prop(rd, "exr_codec", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
elif file_format == 'OPEN_EXR':
split = layout.split()
@@ -588,14 +573,12 @@ class RENDER_PT_output(RenderButtonsPanel):
col.label(text="Codec:")
col.prop(rd, "exr_codec", text="")
- if wide_ui:
- subsplit = split.split()
- col = subsplit.column()
+ subsplit = split.split()
+ col = subsplit.column()
col.prop(rd, "exr_half")
col.prop(rd, "exr_zbuf")
- if wide_ui:
- col = subsplit.column()
+ col = subsplit.column()
col.prop(rd, "exr_preview")
elif file_format == 'JPEG2000':
@@ -604,8 +587,7 @@ class RENDER_PT_output(RenderButtonsPanel):
col.label(text="Depth:")
col.row().prop(rd, "jpeg2k_depth", expand=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(rd, "jpeg2k_preset", text="")
col.prop(rd, "jpeg2k_ycc")
@@ -614,8 +596,7 @@ class RENDER_PT_output(RenderButtonsPanel):
col = split.column()
col.prop(rd, "cineon_log", text="Convert to Log")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.active = rd.cineon_log
col.prop(rd, "cineon_black", text="Black")
col.prop(rd, "cineon_white", text="White")
@@ -642,30 +623,32 @@ class RENDER_PT_output(RenderButtonsPanel):
col = split.column()
if rd.quicktime_audiocodec_type == 'LPCM':
col.prop(rd, "quicktime_audio_bitdepth", text="")
- if wide_ui:
- col = split.column()
+
+ col = split.column()
col.prop(rd, "quicktime_audio_samplerate", text="")
split = layout.split()
col = split.column()
if rd.quicktime_audiocodec_type == 'AAC':
col.prop(rd, "quicktime_audio_bitrate")
- if wide_ui:
- subsplit = split.split()
- col = subsplit.column()
+
+ subsplit = split.split()
+ col = subsplit.column()
+
if rd.quicktime_audiocodec_type == 'AAC':
col.prop(rd, "quicktime_audio_codec_isvbr")
- if wide_ui:
- col = subsplit.column()
+
+ col = subsplit.column()
col.prop(rd, "quicktime_audio_resampling_hq")
-class RENDER_PT_encoding(RenderButtonsPanel):
+class RENDER_PT_encoding(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Encoding"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
rd = context.scene.render
return rd.file_format in ('FFMPEG', 'XVID', 'H264', 'THEORA')
@@ -673,7 +656,6 @@ class RENDER_PT_encoding(RenderButtonsPanel):
layout = self.layout
rd = context.scene.render
- wide_ui = context.region.width > narrowui
layout.menu("RENDER_MT_ffmpeg_presets", text="Presets")
@@ -682,19 +664,17 @@ class RENDER_PT_encoding(RenderButtonsPanel):
col = split.column()
col.prop(rd, "ffmpeg_format")
if rd.ffmpeg_format in ('AVI', 'QUICKTIME', 'MKV', 'OGG'):
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(rd, "ffmpeg_codec")
else:
- if wide_ui:
- split.label()
+ split.label()
split = layout.split()
col = split.column()
col.prop(rd, "ffmpeg_video_bitrate")
- if wide_ui:
- col = split.column()
+
+ col = split.column()
col.prop(rd, "ffmpeg_gopsize")
split = layout.split()
@@ -705,8 +685,7 @@ class RENDER_PT_encoding(RenderButtonsPanel):
col.prop(rd, "ffmpeg_maxrate", text="Maximum")
col.prop(rd, "ffmpeg_buffersize", text="Buffer")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(rd, "ffmpeg_autosplit")
col.label(text="Mux:")
@@ -727,12 +706,11 @@ class RENDER_PT_encoding(RenderButtonsPanel):
col.prop(rd, "ffmpeg_audio_bitrate")
col.prop(rd, "ffmpeg_audio_mixrate")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(rd, "ffmpeg_audio_volume", slider=True)
-class RENDER_PT_antialiasing(RenderButtonsPanel):
+class RENDER_PT_antialiasing(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Anti-Aliasing"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -745,7 +723,6 @@ class RENDER_PT_antialiasing(RenderButtonsPanel):
layout = self.layout
rd = context.scene.render
- wide_ui = context.region.width > narrowui
layout.active = rd.render_antialiasing
split = layout.split()
@@ -756,13 +733,12 @@ class RENDER_PT_antialiasing(RenderButtonsPanel):
sub.enabled = not rd.use_border
sub.prop(rd, "full_sample")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(rd, "pixel_filter", text="")
col.prop(rd, "filter_size", text="Size")
-class RENDER_PT_motion_blur(RenderButtonsPanel):
+class RENDER_PT_motion_blur(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Full Sample Motion Blur"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -782,8 +758,7 @@ class RENDER_PT_motion_blur(RenderButtonsPanel):
row.prop(rd, "motion_blur_samples")
row.prop(rd, "motion_blur_shutter")
-
-class RENDER_PT_dimensions(RenderButtonsPanel):
+class RENDER_PT_dimensions(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Dimensions"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -792,7 +767,6 @@ class RENDER_PT_dimensions(RenderButtonsPanel):
scene = context.scene
rd = scene.render
- wide_ui = context.region.width > narrowui
row = layout.row(align=True)
row.menu("RENDER_MT_presets", text=bpy.types.RENDER_MT_presets.bl_label)
@@ -817,8 +791,7 @@ class RENDER_PT_dimensions(RenderButtonsPanel):
sub.active = rd.use_border
sub.prop(rd, "crop_to_border", text="Crop")
- if wide_ui:
- col = split.column()
+ col = split.column()
sub = col.column(align=True)
sub.label(text="Frame Range:")
sub.prop(scene, "frame_start", text="Start")
@@ -830,7 +803,7 @@ class RENDER_PT_dimensions(RenderButtonsPanel):
sub.prop(rd, "fps_base", text="/")
-class RENDER_PT_stamp(RenderButtonsPanel):
+class RENDER_PT_stamp(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Stamp"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -844,7 +817,6 @@ class RENDER_PT_stamp(RenderButtonsPanel):
layout = self.layout
rd = context.scene.render
- wide_ui = context.region.width > narrowui
layout.active = rd.render_stamp
@@ -861,8 +833,7 @@ class RENDER_PT_stamp(RenderButtonsPanel):
col.prop(rd, "stamp_marker", text="Marker")
col.prop(rd, "stamp_sequencer_strip", text="Seq. Strip")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.active = rd.render_stamp
col.prop(rd, "stamp_foreground", slider=True)
col.prop(rd, "stamp_background", slider=True)
@@ -876,7 +847,7 @@ class RENDER_PT_stamp(RenderButtonsPanel):
sub.prop(rd, "stamp_note_text", text="")
-class RENDER_PT_bake(RenderButtonsPanel):
+class RENDER_PT_bake(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Bake"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -885,20 +856,13 @@ class RENDER_PT_bake(RenderButtonsPanel):
layout = self.layout
rd = context.scene.render
- wide_ui = context.region.width > narrowui
layout.operator("object.bake_image", icon='RENDER_STILL')
- if wide_ui:
- layout.prop(rd, "bake_type")
- else:
- layout.prop(rd, "bake_type", text="")
+ layout.prop(rd, "bake_type")
if rd.bake_type == 'NORMALS':
- if wide_ui:
- layout.prop(rd, "bake_normal_space")
- else:
- layout.prop(rd, "bake_normal_space", text="")
+ layout.prop(rd, "bake_normal_space")
elif rd.bake_type in ('DISPLACEMENT', 'AO'):
layout.prop(rd, "bake_normalized")
@@ -914,8 +878,7 @@ class RENDER_PT_bake(RenderButtonsPanel):
col.prop(rd, "bake_margin")
col.prop(rd, "bake_quad_split", text="Split")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(rd, "bake_active")
sub = col.column()
sub.active = rd.bake_active
@@ -923,35 +886,12 @@ class RENDER_PT_bake(RenderButtonsPanel):
sub.prop(rd, "bake_bias")
-classes = [
- RENDER_MT_presets,
- RENDER_MT_ffmpeg_presets,
- RENDER_PT_render,
- RENDER_PT_layers,
- RENDER_PT_freestyle,
- RENDER_PT_freestyle_linestyle,
- RENDER_PT_dimensions,
- RENDER_PT_antialiasing,
- RENDER_PT_motion_blur,
- RENDER_PT_shading,
- RENDER_PT_output,
- RENDER_PT_encoding,
- RENDER_PT_performance,
- RENDER_PT_post_processing,
- RENDER_PT_stamp,
- RENDER_PT_bake]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_render_test.xml b/release/scripts/ui/properties_render_test.xml
new file mode 100644
index 00000000000..f8a77e37e21
--- /dev/null
+++ b/release/scripts/ui/properties_render_test.xml
@@ -0,0 +1,79 @@
+<ui>
+ <panel identifier="RENDER_PT_stamp_test" label="Stamp (XML)" space_type="PROPERTIES" region_type="WINDOW" context="render" default_closed="true">
+ <draw_header>
+ <prop data="context.scene.render" property="render_stamp" text=""/>
+ </draw_header>
+
+ <draw>
+ <split>
+ <column>
+ <prop data="context.scene.render" property="stamp_time" text="Time"/>
+ <prop data="context.scene.render" property="stamp_date" text="Date"/>
+ <prop data="context.scene.render" property="stamp_render_time" text="RenderTime"/>
+ <prop data="context.scene.render" property="stamp_frame" text="Frame"/>
+ <prop data="context.scene.render" property="stamp_scene" text="Scene"/>
+ <prop data="context.scene.render" property="stamp_camera" text="Camera"/>
+ <prop data="context.scene.render" property="stamp_filename" text="Filename"/>
+ <prop data="context.scene.render" property="stamp_marker" text="Marker"/>
+ <prop data="context.scene.render" property="stamp_sequencer_strip" text="Seq. Strip"/>
+ </column>
+ <column>
+ <active expr="context.scene.render.render_stamp"/>
+ <prop data="context.scene.render" property="stamp_foreground" slider="true"/>
+ <prop data="context.scene.render" property="stamp_background" slider="true"/>
+ <separator/>
+ <prop data="context.scene.render" property="stamp_font_size" text="Font Size"/>
+ </column>
+ </split>
+ <split percentage="0.2">
+ <prop data="context.scene.render" property="stamp_note" text="Note"/>
+ <row>
+ <active expr="context.scene.render.stamp_note"/>
+ <prop data="context.scene.render" property="stamp_note_text" text=""/>
+ </row>
+ </split>
+ </draw>
+ </panel>
+
+ <panel identifier="RENDER_PT_dimensions_test" label="Dimensions (XML)" space_type="PROPERTIES" region_type="WINDOW" context="render">
+ <draw>
+ <row align="true">
+ <menu menu="RENDER_MT_presets"/>
+ <operator operator="render.preset_add" text="" icon="ZOOMIN"/>
+ </row>
+ <split>
+ <column>
+ <column align="true">
+ <label text="Resolution:"/>
+ <prop data="context.scene.render" property="resolution_x" text="X"/>
+ <prop data="context.scene.render" property="resolution_y" text="Y"/>
+ <prop data="context.scene.render" property="resolution_percentage" text=""/>
+
+ <label text="Aspect Ratio:"/>
+ <prop data="context.scene.render" property="pixel_aspect_x" text="X"/>
+ <prop data="context.scene.render" property="pixel_aspect_y" text="Y"/>
+ </column>
+ <row>
+ <prop data="context.scene.render" property="use_border" text="Border"/>
+ <row>
+ <active expr="context.scene.render.use_border"/>
+ <prop data="context.scene.render" property="crop_to_border" text="Crop"/>
+ </row>
+ </row>
+ </column>
+ <column>
+ <column align="true">
+ <label text="Frame Range:"/>
+ <prop data="context.scene" property="frame_start" text="Start"/>
+ <prop data="context.scene" property="frame_end" text="End"/>
+ <prop data="context.scene" property="frame_step" text="Step"/>
+
+ <label text="Frame Rate:"/>
+ <prop data="context.scene.render" property="fps"/>
+ <prop data="context.scene.render" property="fps_base" text="/"/>
+ </column>
+ </column>
+ </split>
+ </draw>
+ </panel>
+</ui>
diff --git a/release/scripts/ui/properties_scene.py b/release/scripts/ui/properties_scene.py
index 06ad1eda835..3ed8dfb72b8 100644
--- a/release/scripts/ui/properties_scene.py
+++ b/release/scripts/ui/properties_scene.py
@@ -20,46 +20,40 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
-class SceneButtonsPanel(bpy.types.Panel):
+class SceneButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "scene"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.scene
-class SCENE_PT_scene(SceneButtonsPanel):
+class SCENE_PT_scene(SceneButtonsPanel, bpy.types.Panel):
bl_label = "Scene"
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw(self, context):
layout = self.layout
- wide_ui = context.region.width > narrowui
scene = context.scene
- if wide_ui:
- layout.prop(scene, "camera")
- layout.prop(scene, "set", text="Background")
- else:
- layout.prop(scene, "camera", text="")
- layout.prop(scene, "set", text="")
+ layout.prop(scene, "camera")
+ layout.prop(scene, "set", text="Background")
-class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel):
+class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "scene"
-class SCENE_PT_unit(SceneButtonsPanel):
+class SCENE_PT_unit(SceneButtonsPanel, bpy.types.Panel):
bl_label = "Units"
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw(self, context):
layout = self.layout
- wide_ui = context.region.width > narrowui
unit = context.scene.unit_settings
col = layout.column()
@@ -71,21 +65,19 @@ class SCENE_PT_unit(SceneButtonsPanel):
col = split.column()
col.prop(unit, "scale_length", text="Scale")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(unit, "use_separate")
layout.column().prop(unit, "rotation_units")
-class SCENE_PT_keying_sets(SceneButtonsPanel):
+class SCENE_PT_keying_sets(SceneButtonsPanel, bpy.types.Panel):
bl_label = "Keying Sets"
def draw(self, context):
layout = self.layout
scene = context.scene
- wide_ui = context.region.width > narrowui
row = layout.row()
col = row.column()
@@ -107,18 +99,18 @@ class SCENE_PT_keying_sets(SceneButtonsPanel):
op = subcol.operator("anim.keying_set_export", text="Export to File")
op.filepath = "keyingset.py"
- if wide_ui:
- col = row.column()
+ col = row.column()
col.label(text="Keyframing Settings:")
col.prop(ks, "insertkey_needed", text="Needed")
col.prop(ks, "insertkey_visual", text="Visual")
col.prop(ks, "insertkey_xyz_to_rgb", text="XYZ to RGB")
-class SCENE_PT_keying_set_paths(SceneButtonsPanel):
+class SCENE_PT_keying_set_paths(SceneButtonsPanel, bpy.types.Panel):
bl_label = "Active Keying Set"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.scene.active_keying_set and context.scene.active_keying_set.absolute)
def draw(self, context):
@@ -126,7 +118,6 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel):
scene = context.scene
ks = scene.active_keying_set
- wide_ui = context.region.width > narrowui
row = layout.row()
row.label(text="Paths:")
@@ -156,8 +147,7 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel):
if ksp.entire_array is False:
col.prop(ksp, "array_index")
- if wide_ui:
- col = row.column()
+ col = row.column()
col.label(text="F-Curve Grouping:")
col.prop(ksp, "grouping")
if ksp.grouping == 'NAMED':
@@ -169,7 +159,7 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel):
col.prop(ksp, "insertkey_xyz_to_rgb", text="XYZ to RGB")
-class SCENE_PT_physics(SceneButtonsPanel):
+class SCENE_PT_physics(SceneButtonsPanel, bpy.types.Panel):
bl_label = "Gravity"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -180,17 +170,13 @@ class SCENE_PT_physics(SceneButtonsPanel):
layout = self.layout
scene = context.scene
- wide_ui = context.region.width > narrowui
layout.active = scene.use_gravity
- if wide_ui:
- layout.prop(scene, "gravity", text="")
- else:
- layout.column().prop(scene, "gravity", text="")
+ layout.prop(scene, "gravity", text="")
-class SCENE_PT_simplify(SceneButtonsPanel):
+class SCENE_PT_simplify(SceneButtonsPanel, bpy.types.Panel):
bl_label = "Simplify"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -203,7 +189,6 @@ class SCENE_PT_simplify(SceneButtonsPanel):
layout = self.layout
scene = context.scene
rd = scene.render
- wide_ui = context.region.width > narrowui
layout.active = rd.use_simplify
@@ -215,8 +200,7 @@ class SCENE_PT_simplify(SceneButtonsPanel):
col.prop(rd, "simplify_triangulate")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(rd, "simplify_shadow_samples", text="Shadow Samples")
col.prop(rd, "simplify_ao_sss", text="AO and SSS")
@@ -334,29 +318,12 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
return {'RUNNING_MODAL'}
-classes = [
- SCENE_PT_scene,
- SCENE_PT_unit,
- SCENE_PT_keying_sets,
- SCENE_PT_keying_set_paths,
- SCENE_PT_physics,
- SCENE_PT_simplify,
-
- SCENE_PT_custom_props,
-
- ANIM_OT_keying_set_export]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_texture.py b/release/scripts/ui/properties_texture.py
index 2bfbe188c9e..b675576ec3f 100644
--- a/release/scripts/ui/properties_texture.py
+++ b/release/scripts/ui/properties_texture.py
@@ -20,8 +20,6 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
class TEXTURE_MT_specials(bpy.types.Menu):
bl_label = "Texture Specials"
@@ -65,20 +63,18 @@ def context_tex_datablock(context):
return idblock
-class TextureButtonsPanel(bpy.types.Panel):
+class TextureButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "texture"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
tex = context.texture
- if not tex:
- return False
- engine = context.scene.render.engine
- return (tex.type != 'NONE' or tex.use_nodes) and (engine in self.COMPAT_ENGINES)
+ return tex and (tex.type != 'NONE' or tex.use_nodes) and (context.scene.render.engine in cls.COMPAT_ENGINES)
-class TEXTURE_PT_preview(TextureButtonsPanel):
+class TEXTURE_PT_preview(TextureButtonsPanel, bpy.types.Panel):
bl_label = "Preview"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -95,17 +91,18 @@ class TEXTURE_PT_preview(TextureButtonsPanel):
layout.template_preview(tex, slot=slot)
-class TEXTURE_PT_context_texture(TextureButtonsPanel):
+class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
engine = context.scene.render.engine
if not hasattr(context, "texture_slot"):
return False
return ((context.material or context.world or context.lamp or context.brush or context.texture)
- and (engine in self.COMPAT_ENGINES))
+ and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@@ -113,7 +110,6 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel):
node = context.texture_node
space = context.space_data
tex = context.texture
- wide_ui = context.region.width > narrowui
idblock = context_tex_datablock(context)
tex_collection = space.pin_id == None and type(idblock) != bpy.types.Brush and not node
@@ -127,11 +123,8 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel):
col.operator("texture.slot_move", text="", icon='TRIA_DOWN').type = 'DOWN'
col.menu("TEXTURE_MT_specials", icon='DOWNARROW_HLT', text="")
- if wide_ui:
- split = layout.split(percentage=0.65)
- col = split.column()
- else:
- col = layout.column()
+ split = layout.split(percentage=0.65)
+ col = split.column()
if tex_collection:
col.template_ID(idblock, "active_texture", new="texture.new")
@@ -143,8 +136,7 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel):
if space.pin_id:
col.template_ID(space, "pin_id")
- if wide_ui:
- col = split.column()
+ col = split.column()
if not space.pin_id:
col.prop(space, "brush_texture", text="Brush", toggle=True)
@@ -159,23 +151,16 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel):
split.prop(slot, "output_node", text="")
else:
- if wide_ui:
- split.label(text="Type:")
- split.prop(tex, "type", text="")
- else:
- layout.prop(tex, "type", text="")
+ split.label(text="Type:")
+ split.prop(tex, "type", text="")
-class TEXTURE_PT_custom_props(TextureButtonsPanel, PropertyPanel):
- _context_path = "texture"
+class TEXTURE_PT_custom_props(TextureButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
-
- def poll(self, context): # use alternate poll since NONE texture type is ok
- engine = context.scene.render.engine
- return context.texture and (engine in self.COMPAT_ENGINES)
+ _context_path = "texture"
-class TEXTURE_PT_colors(TextureButtonsPanel):
+class TEXTURE_PT_colors(TextureButtonsPanel, bpy.types.Panel):
bl_label = "Colors"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -184,7 +169,6 @@ class TEXTURE_PT_colors(TextureButtonsPanel):
layout = self.layout
tex = context.texture
- wide_ui = context.region.width > narrowui
layout.prop(tex, "use_color_ramp", text="Ramp")
if tex.use_color_ramp:
@@ -199,8 +183,7 @@ class TEXTURE_PT_colors(TextureButtonsPanel):
sub.prop(tex, "factor_green", text="G")
sub.prop(tex, "factor_blue", text="B")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Adjust:")
col.prop(tex, "brightness")
col.prop(tex, "contrast")
@@ -212,19 +195,21 @@ class TEXTURE_PT_colors(TextureButtonsPanel):
class TextureSlotPanel(TextureButtonsPanel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
if not hasattr(context, "texture_slot"):
return False
engine = context.scene.render.engine
- return TextureButtonsPanel.poll(self, context) and (engine in self.COMPAT_ENGINES)
+ return TextureButtonsPanel.poll(self, context) and (engine in cls.COMPAT_ENGINES)
-class TEXTURE_PT_mapping(TextureSlotPanel):
+class TEXTURE_PT_mapping(TextureSlotPanel, bpy.types.Panel):
bl_label = "Mapping"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
idblock = context_tex_datablock(context)
if type(idblock) == bpy.types.Brush and not context.sculpt_object:
return False
@@ -233,7 +218,7 @@ class TEXTURE_PT_mapping(TextureSlotPanel):
return False
engine = context.scene.render.engine
- return (engine in self.COMPAT_ENGINES)
+ return (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@@ -242,7 +227,6 @@ class TEXTURE_PT_mapping(TextureSlotPanel):
tex = context.texture_slot
# textype = context.texture
- wide_ui = context.region.width > narrowui
if type(idblock) != bpy.types.Brush:
split = layout.split(percentage=0.3)
@@ -294,11 +278,10 @@ class TEXTURE_PT_mapping(TextureSlotPanel):
col.prop(tex, "from_dupli")
elif tex.texture_coordinates == 'OBJECT':
col.prop(tex, "from_original")
- elif wide_ui:
+ else:
col.label()
- if wide_ui:
- col = split.column()
+ col = split.column()
row = col.row()
row.prop(tex, "x_mapping", text="")
row.prop(tex, "y_mapping", text="")
@@ -309,19 +292,17 @@ class TEXTURE_PT_mapping(TextureSlotPanel):
col = split.column()
col.prop(tex, "offset")
- if wide_ui:
- col = split.column()
- else:
- col.separator()
+ col = split.column()
col.prop(tex, "size")
-class TEXTURE_PT_influence(TextureSlotPanel):
+class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
bl_label = "Influence"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
idblock = context_tex_datablock(context)
if type(idblock) == bpy.types.Brush:
return False
@@ -330,7 +311,7 @@ class TEXTURE_PT_influence(TextureSlotPanel):
return False
engine = context.scene.render.engine
- return (engine in self.COMPAT_ENGINES)
+ return (engine in cls.COMPAT_ENGINES)
def draw(self, context):
@@ -340,7 +321,6 @@ class TEXTURE_PT_influence(TextureSlotPanel):
# textype = context.texture
tex = context.texture_slot
- wide_ui = context.region.width > narrowui
def factor_but(layout, active, toggle, factor, name):
row = layout.row(align=True)
@@ -365,8 +345,7 @@ class TEXTURE_PT_influence(TextureSlotPanel):
factor_but(col, tex.map_colorspec, "map_colorspec", "colorspec_factor", "Color")
factor_but(col, tex.map_hardness, "map_hardness", "hardness_factor", "Hardness")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Shading:")
factor_but(col, tex.map_ambient, "map_ambient", "ambient_factor", "Ambient")
factor_but(col, tex.map_emit, "map_emit", "emit_factor", "Emit")
@@ -391,9 +370,8 @@ class TEXTURE_PT_influence(TextureSlotPanel):
factor_but(col, tex.map_scattering, "map_scattering", "scattering_factor", "Scattering")
factor_but(col, tex.map_reflection, "map_reflection", "reflection_factor", "Reflection")
- if wide_ui:
- col = split.column()
- col.label(text=" ")
+ col = split.column()
+ col.label(text=" ")
factor_but(col, tex.map_coloremission, "map_coloremission", "coloremission_factor", "Emission Color")
factor_but(col, tex.map_colortransmission, "map_colortransmission", "colortransmission_factor", "Transmission Color")
factor_but(col, tex.map_colorreflection, "map_colorreflection", "colorreflection_factor", "Reflection Color")
@@ -404,8 +382,7 @@ class TEXTURE_PT_influence(TextureSlotPanel):
col = split.column()
factor_but(col, tex.map_color, "map_color", "color_factor", "Color")
- if wide_ui:
- col = split.column()
+ col = split.column()
factor_but(col, tex.map_shadow, "map_shadow", "shadow_factor", "Shadow")
elif type(idblock) == bpy.types.World:
@@ -415,8 +392,7 @@ class TEXTURE_PT_influence(TextureSlotPanel):
factor_but(col, tex.map_blend, "map_blend", "blend_factor", "Blend")
factor_but(col, tex.map_horizon, "map_horizon", "horizon_factor", "Horizon")
- if wide_ui:
- col = split.column()
+ col = split.column()
factor_but(col, tex.map_zenith_up, "map_zenith_up", "zenith_up_factor", "Zenith Up")
factor_but(col, tex.map_zenith_down, "map_zenith_down", "zenith_down_factor", "Zenith Down")
@@ -431,8 +407,7 @@ class TEXTURE_PT_influence(TextureSlotPanel):
sub.active = tex.rgb_to_intensity
sub.prop(tex, "color", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(tex, "negate", text="Negative")
col.prop(tex, "stencil")
@@ -443,15 +418,15 @@ class TEXTURE_PT_influence(TextureSlotPanel):
class TextureTypePanel(TextureButtonsPanel):
- COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
tex = context.texture
engine = context.scene.render.engine
- return ((tex and tex.type == self.tex_type and not tex.use_nodes) and (engine in self.COMPAT_ENGINES))
+ return tex and ((tex.type == cls.tex_type and not tex.use_nodes) and (engine in cls.COMPAT_ENGINES))
-class TEXTURE_PT_clouds(TextureTypePanel):
+class TEXTURE_PT_clouds(TextureTypePanel, bpy.types.Panel):
bl_label = "Clouds"
tex_type = 'CLOUDS'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -460,15 +435,11 @@ class TEXTURE_PT_clouds(TextureTypePanel):
layout = self.layout
tex = context.texture
- wide_ui = context.region.width > narrowui
layout.prop(tex, "stype", expand=True)
layout.label(text="Noise:")
layout.prop(tex, "noise_type", text="Type", expand=True)
- if wide_ui:
- layout.prop(tex, "noise_basis", text="Basis")
- else:
- layout.prop(tex, "noise_basis", text="")
+ layout.prop(tex, "noise_basis", text="Basis")
split = layout.split()
@@ -476,12 +447,11 @@ class TEXTURE_PT_clouds(TextureTypePanel):
col.prop(tex, "noise_size", text="Size")
col.prop(tex, "noise_depth", text="Depth")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(tex, "nabla", text="Nabla")
-class TEXTURE_PT_wood(TextureTypePanel):
+class TEXTURE_PT_wood(TextureTypePanel, bpy.types.Panel):
bl_label = "Wood"
tex_type = 'WOOD'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -490,22 +460,15 @@ class TEXTURE_PT_wood(TextureTypePanel):
layout = self.layout
tex = context.texture
- wide_ui = context.region.width > narrowui
layout.prop(tex, "noisebasis2", expand=True)
- if wide_ui:
- layout.prop(tex, "stype", expand=True)
- else:
- layout.prop(tex, "stype", text="")
+ layout.prop(tex, "stype", expand=True)
col = layout.column()
col.active = tex.stype in ('RINGNOISE', 'BANDNOISE')
col.label(text="Noise:")
col.row().prop(tex, "noise_type", text="Type", expand=True)
- if wide_ui:
- layout.prop(tex, "noise_basis", text="Basis")
- else:
- layout.prop(tex, "noise_basis", text="")
+ layout.prop(tex, "noise_basis", text="Basis")
split = layout.split()
split.active = tex.stype in ('RINGNOISE', 'BANDNOISE')
@@ -518,7 +481,7 @@ class TEXTURE_PT_wood(TextureTypePanel):
col.prop(tex, "nabla")
-class TEXTURE_PT_marble(TextureTypePanel):
+class TEXTURE_PT_marble(TextureTypePanel, bpy.types.Panel):
bl_label = "Marble"
tex_type = 'MARBLE'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -527,16 +490,12 @@ class TEXTURE_PT_marble(TextureTypePanel):
layout = self.layout
tex = context.texture
- wide_ui = context.region.width > narrowui
layout.prop(tex, "stype", expand=True)
layout.prop(tex, "noisebasis2", expand=True)
layout.label(text="Noise:")
layout.prop(tex, "noise_type", text="Type", expand=True)
- if wide_ui:
- layout.prop(tex, "noise_basis", text="Basis")
- else:
- layout.prop(tex, "noise_basis", text="")
+ layout.prop(tex, "noise_basis", text="Basis")
split = layout.split()
@@ -544,13 +503,12 @@ class TEXTURE_PT_marble(TextureTypePanel):
col.prop(tex, "noise_size", text="Size")
col.prop(tex, "noise_depth", text="Depth")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(tex, "turbulence")
col.prop(tex, "nabla")
-class TEXTURE_PT_magic(TextureTypePanel):
+class TEXTURE_PT_magic(TextureTypePanel, bpy.types.Panel):
bl_label = "Magic"
tex_type = 'MAGIC'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -559,19 +517,17 @@ class TEXTURE_PT_magic(TextureTypePanel):
layout = self.layout
tex = context.texture
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.prop(tex, "noise_depth", text="Depth")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(tex, "turbulence")
-class TEXTURE_PT_blend(TextureTypePanel):
+class TEXTURE_PT_blend(TextureTypePanel, bpy.types.Panel):
bl_label = "Blend"
tex_type = 'BLEND'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -580,12 +536,8 @@ class TEXTURE_PT_blend(TextureTypePanel):
layout = self.layout
tex = context.texture
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(tex, "progression")
- else:
- layout.prop(tex, "progression", text="")
+ layout.prop(tex, "progression")
sub = layout.row()
@@ -593,7 +545,7 @@ class TEXTURE_PT_blend(TextureTypePanel):
sub.prop(tex, "flip_axis", expand=True)
-class TEXTURE_PT_stucci(TextureTypePanel):
+class TEXTURE_PT_stucci(TextureTypePanel, bpy.types.Panel):
bl_label = "Stucci"
tex_type = 'STUCCI'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -602,27 +554,22 @@ class TEXTURE_PT_stucci(TextureTypePanel):
layout = self.layout
tex = context.texture
- wide_ui = context.region.width > narrowui
layout.prop(tex, "stype", expand=True)
layout.label(text="Noise:")
layout.prop(tex, "noise_type", text="Type", expand=True)
- if wide_ui:
- layout.prop(tex, "noise_basis", text="Basis")
- else:
- layout.prop(tex, "noise_basis", text="")
+ layout.prop(tex, "noise_basis", text="Basis")
split = layout.split()
col = split.column()
col.prop(tex, "noise_size", text="Size")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(tex, "turbulence")
-class TEXTURE_PT_image(TextureTypePanel):
+class TEXTURE_PT_image(TextureTypePanel, bpy.types.Panel):
bl_label = "Image"
tex_type = 'IMAGE'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -648,7 +595,7 @@ def texture_filter_common(tex, layout):
layout.prop(tex, "filter_size_minimum")
-class TEXTURE_PT_image_sampling(TextureTypePanel):
+class TEXTURE_PT_image_sampling(TextureTypePanel, bpy.types.Panel):
bl_label = "Image Sampling"
bl_default_closed = True
tex_type = 'IMAGE'
@@ -659,7 +606,6 @@ class TEXTURE_PT_image_sampling(TextureTypePanel):
tex = context.texture
# slot = context.texture_slot
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -671,10 +617,8 @@ class TEXTURE_PT_image_sampling(TextureTypePanel):
col.separator()
col.prop(tex, "flip_axis", text="Flip X/Y Axis")
- if wide_ui:
- col = split.column()
- else:
- col.separator()
+ col = split.column()
+
col.prop(tex, "normal_map")
row = col.row()
row.active = tex.normal_map
@@ -689,7 +633,7 @@ class TEXTURE_PT_image_sampling(TextureTypePanel):
texture_filter_common(tex, col)
-class TEXTURE_PT_image_mapping(TextureTypePanel):
+class TEXTURE_PT_image_mapping(TextureTypePanel, bpy.types.Panel):
bl_label = "Image Mapping"
bl_default_closed = True
tex_type = 'IMAGE'
@@ -699,12 +643,8 @@ class TEXTURE_PT_image_mapping(TextureTypePanel):
layout = self.layout
tex = context.texture
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(tex, "extension")
- else:
- layout.prop(tex, "extension", text="")
+ layout.prop(tex, "extension")
split = layout.split()
@@ -714,8 +654,7 @@ class TEXTURE_PT_image_mapping(TextureTypePanel):
col.prop(tex, "repeat_x", text="X")
col.prop(tex, "repeat_y", text="Y")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.label(text="Mirror:")
col.prop(tex, "mirror_x", text="X")
col.prop(tex, "mirror_y", text="Y")
@@ -727,8 +666,7 @@ class TEXTURE_PT_image_mapping(TextureTypePanel):
row.prop(tex, "checker_even", text="Even")
row.prop(tex, "checker_odd", text="Odd")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(tex, "checker_distance", text="Distance")
layout.separator()
@@ -741,14 +679,13 @@ class TEXTURE_PT_image_mapping(TextureTypePanel):
col.prop(tex, "crop_min_x", text="X")
col.prop(tex, "crop_min_y", text="Y")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.label(text="Crop Maximum:")
col.prop(tex, "crop_max_x", text="X")
col.prop(tex, "crop_max_y", text="Y")
-class TEXTURE_PT_plugin(TextureTypePanel):
+class TEXTURE_PT_plugin(TextureTypePanel, bpy.types.Panel):
bl_label = "Plugin"
tex_type = 'PLUGIN'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -761,7 +698,7 @@ class TEXTURE_PT_plugin(TextureTypePanel):
layout.label(text="Nothing yet")
-class TEXTURE_PT_envmap(TextureTypePanel):
+class TEXTURE_PT_envmap(TextureTypePanel, bpy.types.Panel):
bl_label = "Environment Map"
tex_type = 'ENVIRONMENT_MAP'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -772,7 +709,6 @@ class TEXTURE_PT_envmap(TextureTypePanel):
tex = context.texture
env = tex.environment_map
- wide_ui = context.region.width > narrowui
row = layout.row()
row.prop(env, "source", expand=True)
@@ -794,15 +730,14 @@ class TEXTURE_PT_envmap(TextureTypePanel):
col.prop(env, "resolution")
col.prop(env, "depth")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.label(text="Clipping:")
col.prop(env, "clip_start", text="Start")
col.prop(env, "clip_end", text="End")
-class TEXTURE_PT_envmap_sampling(TextureTypePanel):
+class TEXTURE_PT_envmap_sampling(TextureTypePanel, bpy.types.Panel):
bl_label = "Environment Map Sampling"
bl_default_closed = True
tex_type = 'ENVIRONMENT_MAP'
@@ -816,7 +751,7 @@ class TEXTURE_PT_envmap_sampling(TextureTypePanel):
texture_filter_common(tex, layout)
-class TEXTURE_PT_musgrave(TextureTypePanel):
+class TEXTURE_PT_musgrave(TextureTypePanel, bpy.types.Panel):
bl_label = "Musgrave"
tex_type = 'MUSGRAVE'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -825,12 +760,8 @@ class TEXTURE_PT_musgrave(TextureTypePanel):
layout = self.layout
tex = context.texture
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(tex, "musgrave_type")
- else:
- layout.prop(tex, "musgrave_type", text="")
+ layout.prop(tex, "musgrave_type")
split = layout.split()
@@ -839,8 +770,7 @@ class TEXTURE_PT_musgrave(TextureTypePanel):
col.prop(tex, "lacunarity")
col.prop(tex, "octaves")
- if wide_ui:
- col = split.column()
+ col = split.column()
if (tex.musgrave_type in ('HETERO_TERRAIN', 'RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL')):
col.prop(tex, "offset")
if (tex.musgrave_type in ('RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL')):
@@ -849,22 +779,18 @@ class TEXTURE_PT_musgrave(TextureTypePanel):
layout.label(text="Noise:")
- if wide_ui:
- layout.prop(tex, "noise_basis", text="Basis")
- else:
- layout.prop(tex, "noise_basis", text="")
+ layout.prop(tex, "noise_basis", text="Basis")
split = layout.split()
col = split.column()
col.prop(tex, "noise_size", text="Size")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(tex, "nabla")
-class TEXTURE_PT_voronoi(TextureTypePanel):
+class TEXTURE_PT_voronoi(TextureTypePanel, bpy.types.Panel):
bl_label = "Voronoi"
tex_type = 'VORONOI'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -873,7 +799,6 @@ class TEXTURE_PT_voronoi(TextureTypePanel):
layout = self.layout
tex = context.texture
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -887,8 +812,7 @@ class TEXTURE_PT_voronoi(TextureTypePanel):
col.prop(tex, "coloring", text="")
col.prop(tex, "noise_intensity", text="Intensity")
- if wide_ui:
- col = split.column()
+ col = split.column()
sub = col.column(align=True)
sub.label(text="Feature Weights:")
sub.prop(tex, "weight_1", text="1", slider=True)
@@ -903,12 +827,11 @@ class TEXTURE_PT_voronoi(TextureTypePanel):
col = split.column()
col.prop(tex, "noise_size", text="Size")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(tex, "nabla")
-class TEXTURE_PT_distortednoise(TextureTypePanel):
+class TEXTURE_PT_distortednoise(TextureTypePanel, bpy.types.Panel):
bl_label = "Distorted Noise"
tex_type = 'DISTORTED_NOISE'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -917,14 +840,9 @@ class TEXTURE_PT_distortednoise(TextureTypePanel):
layout = self.layout
tex = context.texture
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(tex, "noise_distortion")
- layout.prop(tex, "noise_basis", text="Basis")
- else:
- layout.prop(tex, "noise_distortion", text="")
- layout.prop(tex, "noise_basis", text="")
+ layout.prop(tex, "noise_distortion")
+ layout.prop(tex, "noise_basis", text="Basis")
split = layout.split()
@@ -932,19 +850,19 @@ class TEXTURE_PT_distortednoise(TextureTypePanel):
col.prop(tex, "distortion", text="Distortion")
col.prop(tex, "noise_size", text="Size")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(tex, "nabla")
-class TEXTURE_PT_voxeldata(TextureButtonsPanel):
+class TEXTURE_PT_voxeldata(TextureButtonsPanel, bpy.types.Panel):
bl_label = "Voxel Data"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
tex = context.texture
engine = context.scene.render.engine
- return (tex and tex.type == 'VOXEL_DATA' and (engine in self.COMPAT_ENGINES))
+ return tex and (tex.type == 'VOXEL_DATA' and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@@ -975,26 +893,23 @@ class TEXTURE_PT_voxeldata(TextureButtonsPanel):
layout.prop(vd, "intensity")
-class TEXTURE_PT_pointdensity(TextureButtonsPanel):
+class TEXTURE_PT_pointdensity(TextureButtonsPanel, bpy.types.Panel):
bl_label = "Point Density"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
tex = context.texture
engine = context.scene.render.engine
- return (tex and tex.type == 'POINT_DENSITY' and (engine in self.COMPAT_ENGINES))
+ return tex and (tex.type == 'POINT_DENSITY' and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
tex = context.texture
pd = tex.pointdensity
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(pd, "point_source", expand=True)
- else:
- layout.prop(pd, "point_source", text="")
+ layout.prop(pd, "point_source", expand=True)
split = layout.split()
@@ -1025,8 +940,7 @@ class TEXTURE_PT_pointdensity(TextureButtonsPanel):
if pd.color_source in ('PARTICLE_SPEED', 'PARTICLE_AGE'):
layout.template_color_ramp(pd, "color_ramp", expand=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label()
col.prop(pd, "radius")
col.label(text="Falloff:")
@@ -1035,14 +949,15 @@ class TEXTURE_PT_pointdensity(TextureButtonsPanel):
col.prop(pd, "falloff_softness")
-class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel):
+class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel, bpy.types.Panel):
bl_label = "Turbulence"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
tex = context.texture
engine = context.scene.render.engine
- return (tex and tex.type == 'POINT_DENSITY' and (engine in self.COMPAT_ENGINES))
+ return tex and (tex.type == 'POINT_DENSITY' and (engine in cls.COMPAT_ENGINES))
def draw_header(self, context):
layout = self.layout
@@ -1058,7 +973,6 @@ class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel):
tex = context.texture
pd = tex.pointdensity
layout.active = pd.turbulence
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -1068,57 +982,19 @@ class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel):
col.label(text="Noise Basis:")
col.prop(pd, "noise_basis", text="")
- if wide_ui:
- col = split.column()
- col.label()
+ col = split.column()
+ col.label()
col.prop(pd, "turbulence_size")
col.prop(pd, "turbulence_depth")
col.prop(pd, "turbulence_strength")
-classes = [
- TEXTURE_MT_specials,
- TEXTURE_MT_envmap_specials,
-
- TEXTURE_PT_context_texture,
- TEXTURE_PT_preview,
-
- TEXTURE_PT_clouds, # Texture Type Panels
- TEXTURE_PT_wood,
- TEXTURE_PT_marble,
- TEXTURE_PT_magic,
- TEXTURE_PT_blend,
- TEXTURE_PT_stucci,
- TEXTURE_PT_image,
- TEXTURE_PT_image_sampling,
- TEXTURE_PT_image_mapping,
- TEXTURE_PT_plugin,
- TEXTURE_PT_envmap,
- TEXTURE_PT_envmap_sampling,
- TEXTURE_PT_musgrave,
- TEXTURE_PT_voronoi,
- TEXTURE_PT_distortednoise,
- TEXTURE_PT_voxeldata,
- TEXTURE_PT_pointdensity,
- TEXTURE_PT_pointdensity_turbulence,
-
- TEXTURE_PT_colors,
- TEXTURE_PT_mapping,
- TEXTURE_PT_influence,
-
- TEXTURE_PT_custom_props]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_world.py b/release/scripts/ui/properties_world.py
index 22acd49f897..eec1caf58f7 100644
--- a/release/scripts/ui/properties_world.py
+++ b/release/scripts/ui/properties_world.py
@@ -20,36 +20,41 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
-class WorldButtonsPanel(bpy.types.Panel):
+class WorldButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "world"
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
rd = context.scene.render
- return (context.world) and (not rd.use_game_engine) and (rd.engine in self.COMPAT_ENGINES)
+ return (rd.engine in cls.COMPAT_ENGINES)
-class WORLD_PT_preview(WorldButtonsPanel):
+class WORLD_PT_preview(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Preview"
COMPAT_ENGINES = {'BLENDER_RENDER'}
+ @classmethod
+ def poll(cls, context):
+ rd = context.scene.render
+ return (context.world) and (not rd.use_game_engine) and (rd.engine in cls.COMPAT_ENGINES)
+
def draw(self, context):
self.layout.template_preview(context.world)
-class WORLD_PT_context_world(WorldButtonsPanel):
+class WORLD_PT_context_world(WorldButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
rd = context.scene.render
- return (not rd.use_game_engine) and (rd.engine in self.COMPAT_ENGINES)
+ return (not rd.use_game_engine) and (rd.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@@ -57,43 +62,31 @@ class WORLD_PT_context_world(WorldButtonsPanel):
scene = context.scene
world = context.world
space = context.space_data
- wide_ui = context.region.width > narrowui
-
- if wide_ui:
- split = layout.split(percentage=0.65)
- if scene:
- split.template_ID(scene, "world", new="world.new")
- elif world:
- split.template_ID(space, "pin_id")
- else:
- layout.template_ID(scene, "world", new="world.new")
+ split = layout.split(percentage=0.65)
+ if scene:
+ split.template_ID(scene, "world", new="world.new")
+ elif world:
+ split.template_ID(space, "pin_id")
-class WORLD_PT_custom_props(WorldButtonsPanel, PropertyPanel):
- COMPAT_ENGINES = {'BLENDER_RENDER'}
+class WORLD_PT_custom_props(WorldButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "world"
-class WORLD_PT_world(WorldButtonsPanel):
+class WORLD_PT_world(WorldButtonsPanel, bpy.types.Panel):
bl_label = "World"
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw(self, context):
layout = self.layout
- wide_ui = context.region.width > narrowui
world = context.world
- if wide_ui:
- row = layout.row()
- row.prop(world, "paper_sky")
- row.prop(world, "blend_sky")
- row.prop(world, "real_sky")
- else:
- col = layout.column()
- col.prop(world, "paper_sky")
- col.prop(world, "blend_sky")
- col.prop(world, "real_sky")
+ row = layout.row()
+ row.prop(world, "paper_sky")
+ row.prop(world, "blend_sky")
+ row.prop(world, "real_sky")
row = layout.row()
row.column().prop(world, "horizon_color")
@@ -103,7 +96,7 @@ class WORLD_PT_world(WorldButtonsPanel):
row.column().prop(world, "ambient_color")
-class WORLD_PT_mist(WorldButtonsPanel):
+class WORLD_PT_mist(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Mist"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -115,7 +108,6 @@ class WORLD_PT_mist(WorldButtonsPanel):
def draw(self, context):
layout = self.layout
- wide_ui = context.region.width > narrowui
world = context.world
layout.active = world.mist.use_mist
@@ -126,15 +118,14 @@ class WORLD_PT_mist(WorldButtonsPanel):
col.prop(world.mist, "intensity", slider=True)
col.prop(world.mist, "start")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(world.mist, "depth")
col.prop(world.mist, "height")
layout.prop(world.mist, "falloff")
-class WORLD_PT_stars(WorldButtonsPanel):
+class WORLD_PT_stars(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Stars"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -146,7 +137,6 @@ class WORLD_PT_stars(WorldButtonsPanel):
def draw(self, context):
layout = self.layout
- wide_ui = context.region.width > narrowui
world = context.world
layout.active = world.stars.use_stars
@@ -157,13 +147,12 @@ class WORLD_PT_stars(WorldButtonsPanel):
col.prop(world.stars, "size")
col.prop(world.stars, "color_randomization", text="Colors")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(world.stars, "min_distance", text="Min. Dist")
col.prop(world.stars, "average_separation", text="Separation")
-class WORLD_PT_ambient_occlusion(WorldButtonsPanel):
+class WORLD_PT_ambient_occlusion(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Ambient Occlusion"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -182,7 +171,7 @@ class WORLD_PT_ambient_occlusion(WorldButtonsPanel):
split.prop(light, "ao_blend_mode", text="")
-class WORLD_PT_environment_lighting(WorldButtonsPanel):
+class WORLD_PT_environment_lighting(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Environment Lighting"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -201,11 +190,12 @@ class WORLD_PT_environment_lighting(WorldButtonsPanel):
split.prop(light, "environment_color", text="")
-class WORLD_PT_indirect_lighting(WorldButtonsPanel):
+class WORLD_PT_indirect_lighting(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Indirect Lighting"
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
light = context.world.lighting
return light.gather_method == 'APPROXIMATE'
@@ -224,7 +214,7 @@ class WORLD_PT_indirect_lighting(WorldButtonsPanel):
split.prop(light, "indirect_bounces", text="Bounces")
-class WORLD_PT_gather(WorldButtonsPanel):
+class WORLD_PT_gather(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Gather"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -272,30 +262,12 @@ class WORLD_PT_gather(WorldButtonsPanel):
col.prop(light, "correction")
-classes = [
- WORLD_PT_context_world,
- WORLD_PT_preview,
- WORLD_PT_world,
- WORLD_PT_ambient_occlusion,
- WORLD_PT_environment_lighting,
- WORLD_PT_indirect_lighting,
- WORLD_PT_gather,
- WORLD_PT_mist,
- WORLD_PT_stars,
-
- WORLD_PT_custom_props]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_console.py b/release/scripts/ui/space_console.py
index 512af350a47..feda3a54b41 100644
--- a/release/scripts/ui/space_console.py
+++ b/release/scripts/ui/space_console.py
@@ -138,7 +138,8 @@ class ConsoleAutocomplete(bpy.types.Operator):
bl_idname = "console.autocomplete"
bl_label = "Console Autocomplete"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.space_data.console_type != 'REPORT'
def execute(self, context):
@@ -196,31 +197,12 @@ class ConsoleLanguage(bpy.types.Operator):
return {'FINISHED'}
-classes = [
- CONSOLE_HT_header,
- CONSOLE_MT_console,
- CONSOLE_MT_report,
- CONSOLE_MT_language,
-
- # Stubs that call the language operators
- ConsoleExec,
- ConsoleAutocomplete,
- ConsoleBanner,
-
- # Set the language and call the banner
- ConsoleLanguage]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_dopesheet.py b/release/scripts/ui/space_dopesheet.py
index 41917acd997..f7e7ee724d7 100644
--- a/release/scripts/ui/space_dopesheet.py
+++ b/release/scripts/ui/space_dopesheet.py
@@ -196,25 +196,12 @@ class DOPESHEET_MT_key_transform(bpy.types.Menu):
layout.operator("transform.transform", text="Scale").mode = 'TIME_SCALE'
-classes = [
- DOPESHEET_HT_header, # header/menu classes
- DOPESHEET_MT_view,
- DOPESHEET_MT_select,
- DOPESHEET_MT_channel,
- DOPESHEET_MT_key,
- DOPESHEET_MT_key_transform]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_filebrowser.py b/release/scripts/ui/space_filebrowser.py
index 39bae6ca59b..a67bffc37c5 100644
--- a/release/scripts/ui/space_filebrowser.py
+++ b/release/scripts/ui/space_filebrowser.py
@@ -65,20 +65,12 @@ class FILEBROWSER_HT_header(bpy.types.Header):
row.prop(params, "filter_text", text="")
-classes = [
- FILEBROWSER_HT_header]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_graph.py b/release/scripts/ui/space_graph.py
index 1533b891202..7eb728cc668 100644
--- a/release/scripts/ui/space_graph.py
+++ b/release/scripts/ui/space_graph.py
@@ -204,25 +204,12 @@ class GRAPH_MT_key_transform(bpy.types.Menu):
layout.operator("transform.resize", text="Scale")
-classes = [
- GRAPH_HT_header, # header/menu classes
- GRAPH_MT_view,
- GRAPH_MT_select,
- GRAPH_MT_channel,
- GRAPH_MT_key,
- GRAPH_MT_key_transform]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_image.py b/release/scripts/ui/space_image.py
index a28ddb90a40..99d41244431 100644
--- a/release/scripts/ui/space_image.py
+++ b/release/scripts/ui/space_image.py
@@ -19,7 +19,16 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
+
+class BrushButtonsPanel():
+ bl_space_type = 'IMAGE_EDITOR'
+ bl_region_type = 'UI'
+
+ @classmethod
+ def poll(cls, context):
+ sima = context.space_data
+ toolsettings = context.tool_settings.image_paint
+ return sima.show_paint and toolsettings.brush
class IMAGE_MT_view(bpy.types.Menu):
@@ -335,7 +344,8 @@ class IMAGE_PT_image_properties(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Image"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
sima = context.space_data
return (sima.image)
@@ -354,7 +364,8 @@ class IMAGE_PT_game_properties(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Game Properties"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
rd = context.scene.render
sima = context.space_data
return (sima and sima.image) and (rd.engine == 'BLENDER_GAME')
@@ -364,7 +375,6 @@ class IMAGE_PT_game_properties(bpy.types.Panel):
sima = context.space_data
ima = sima.image
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -385,8 +395,7 @@ class IMAGE_PT_game_properties(bpy.types.Panel):
sub.prop(ima, "tiles_x", text="X")
sub.prop(ima, "tiles_y", text="Y")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Clamp:")
col.prop(ima, "clamp_x", text="X")
col.prop(ima, "clamp_y", text="Y")
@@ -399,7 +408,8 @@ class IMAGE_PT_view_histogram(bpy.types.Panel):
bl_region_type = 'PREVIEW'
bl_label = "Histogram"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
sima = context.space_data
return (sima and sima.image)
@@ -417,7 +427,8 @@ class IMAGE_PT_view_waveform(bpy.types.Panel):
bl_region_type = 'PREVIEW'
bl_label = "Waveform"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
sima = context.space_data
return (sima and sima.image)
@@ -436,7 +447,8 @@ class IMAGE_PT_view_vectorscope(bpy.types.Panel):
bl_region_type = 'PREVIEW'
bl_label = "Vectorscope"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
sima = context.space_data
return (sima and sima.image)
@@ -453,7 +465,8 @@ class IMAGE_PT_sample_line(bpy.types.Panel):
bl_region_type = 'PREVIEW'
bl_label = "Sample Line"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
sima = context.space_data
return (sima and sima.image)
@@ -470,7 +483,8 @@ class IMAGE_PT_scope_sample(bpy.types.Panel):
bl_region_type = 'PREVIEW'
bl_label = "Scope Samples"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
sima = context.space_data
return sima
@@ -490,7 +504,8 @@ class IMAGE_PT_view_properties(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Display"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
sima = context.space_data
return (sima and (sima.image or sima.show_uvedit))
@@ -501,7 +516,6 @@ class IMAGE_PT_view_properties(bpy.types.Panel):
ima = sima.image
show_uvedit = sima.show_uvedit
uvedit = sima.uv_editor
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -509,8 +523,7 @@ class IMAGE_PT_view_properties(bpy.types.Panel):
if ima:
col.prop(ima, "display_aspect", text="Aspect Ratio")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Coordinates:")
col.prop(sima, "draw_repeated", text="Repeat")
if show_uvedit:
@@ -528,10 +541,7 @@ class IMAGE_PT_view_properties(bpy.types.Panel):
col = layout.column()
col.label(text="UVs:")
row = col.row()
- if wide_ui:
- row.prop(uvedit, "edge_draw_type", expand=True)
- else:
- row.prop(uvedit, "edge_draw_type", text="")
+ row.prop(uvedit, "edge_draw_type", expand=True)
split = layout.split()
col = split.column()
@@ -540,8 +550,7 @@ class IMAGE_PT_view_properties(bpy.types.Panel):
#col.prop(uvedit, "draw_edges")
#col.prop(uvedit, "draw_faces")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(uvedit, "draw_stretch", text="Stretch")
sub = col.column()
sub.active = uvedit.draw_stretch
@@ -553,7 +562,8 @@ class IMAGE_PT_paint(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Paint"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
sima = context.space_data
return sima.show_paint
@@ -592,17 +602,10 @@ class IMAGE_PT_paint(bpy.types.Panel):
col.prop(brush, "clone_alpha", text="Alpha")
-class IMAGE_PT_tools_brush_texture(bpy.types.Panel):
- bl_space_type = 'IMAGE_EDITOR'
- bl_region_type = 'UI'
+class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, bpy.types.Panel):
bl_label = "Texture"
bl_default_closed = True
- def poll(self, context):
- sima = context.space_data
- toolsettings = context.tool_settings.image_paint
- return sima.show_paint and toolsettings.brush
-
def draw(self, context):
layout = self.layout
@@ -616,17 +619,10 @@ class IMAGE_PT_tools_brush_texture(bpy.types.Panel):
col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)
-class IMAGE_PT_paint_stroke(bpy.types.Panel):
- bl_space_type = 'IMAGE_EDITOR'
- bl_region_type = 'UI'
+class IMAGE_PT_paint_stroke(BrushButtonsPanel, bpy.types.Panel):
bl_label = "Paint Stroke"
bl_default_closed = True
- def poll(self, context):
- sima = context.space_data
- toolsettings = context.tool_settings.image_paint
- return sima.show_paint and toolsettings.brush
-
def draw(self, context):
layout = self.layout
@@ -647,17 +643,10 @@ class IMAGE_PT_paint_stroke(bpy.types.Panel):
layout.prop(brush, "use_wrap")
-class IMAGE_PT_paint_curve(bpy.types.Panel):
- bl_space_type = 'IMAGE_EDITOR'
- bl_region_type = 'UI'
+class IMAGE_PT_paint_curve(BrushButtonsPanel, bpy.types.Panel):
bl_label = "Paint Curve"
bl_default_closed = True
- def poll(self, context):
- sima = context.space_data
- toolsettings = context.tool_settings.image_paint
- return sima.show_paint and toolsettings.brush
-
def draw(self, context):
layout = self.layout
@@ -674,41 +663,12 @@ class IMAGE_PT_paint_curve(bpy.types.Panel):
row.operator("brush.curve_preset", icon="LINCURVE", text="").shape = 'LINE'
row.operator("brush.curve_preset", icon="NOCURVE", text="").shape = 'MAX'
-classes = [
- IMAGE_MT_view,
- IMAGE_MT_select,
- IMAGE_MT_image,
- IMAGE_MT_uvs_showhide,
- IMAGE_MT_uvs_transform,
- IMAGE_MT_uvs_snap,
- IMAGE_MT_uvs_mirror,
- IMAGE_MT_uvs_weldalign,
- IMAGE_MT_uvs,
- IMAGE_HT_header,
- IMAGE_PT_image_properties,
- IMAGE_PT_paint,
- IMAGE_PT_tools_brush_texture,
- IMAGE_PT_paint_stroke,
- IMAGE_PT_paint_curve,
- IMAGE_PT_game_properties,
- IMAGE_PT_view_properties,
- IMAGE_PT_view_histogram,
- IMAGE_PT_view_waveform,
- IMAGE_PT_view_vectorscope,
- IMAGE_PT_sample_line,
- IMAGE_PT_scope_sample]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_info.py b/release/scripts/ui/space_info.py
index 25f4e8b2097..618cd3c51c9 100644
--- a/release/scripts/ui/space_info.py
+++ b/release/scripts/ui/space_info.py
@@ -354,34 +354,13 @@ class HELP_OT_operator_cheat_sheet(bpy.types.Operator):
return {'FINISHED'}
-classes = [
- INFO_HT_header,
- INFO_MT_file,
- INFO_MT_file_import,
- INFO_MT_file_export,
- INFO_MT_file_external_data,
- INFO_MT_add,
- INFO_MT_mesh_add,
- INFO_MT_curve_add,
- INFO_MT_surface_add,
- INFO_MT_armature_add,
- INFO_MT_game,
- INFO_MT_render,
- INFO_MT_help,
-
- HELP_OT_operator_cheat_sheet]
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_logic.py b/release/scripts/ui/space_logic.py
index 6003c4d4bd7..f2d99c6e447 100644
--- a/release/scripts/ui/space_logic.py
+++ b/release/scripts/ui/space_logic.py
@@ -25,7 +25,8 @@ class LOGIC_PT_properties(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Properties"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
ob = context.active_object
return ob and ob.game
@@ -88,24 +89,12 @@ class LOGIC_MT_view(bpy.types.Menu):
layout.operator("logic.properties", icon='MENU_PANEL')
-classes = [
- LOGIC_HT_header,
- LOGIC_MT_view,
-
- LOGIC_PT_properties,
- LOGIC_MT_logicbricks_add]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_nla.py b/release/scripts/ui/space_nla.py
index 0eb342d4b15..1141a640534 100644
--- a/release/scripts/ui/space_nla.py
+++ b/release/scripts/ui/space_nla.py
@@ -159,25 +159,12 @@ class NLA_MT_edit_transform(bpy.types.Menu):
layout.operator("transform.resize", text="Scale")
-classes = [
- NLA_HT_header, # header/menu classes
- NLA_MT_view,
- NLA_MT_select,
- NLA_MT_edit,
- NLA_MT_add,
- NLA_MT_edit_transform]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_node.py b/release/scripts/ui/space_node.py
index 21b2ebc5390..0a3cebf5faa 100644
--- a/release/scripts/ui/space_node.py
+++ b/release/scripts/ui/space_node.py
@@ -160,23 +160,12 @@ class NODE_MT_node(bpy.types.Menu):
layout.operator("node.show_cyclic_dependencies")
-classes = [
- NODE_HT_header,
- NODE_MT_view,
- NODE_MT_select,
- NODE_MT_node]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_outliner.py b/release/scripts/ui/space_outliner.py
index ec3c430feaa..6b2743027ba 100644
--- a/release/scripts/ui/space_outliner.py
+++ b/release/scripts/ui/space_outliner.py
@@ -117,23 +117,12 @@ class OUTLINER_MT_edit_datablocks(bpy.types.Menu):
col.operator("outliner.drivers_delete_selected")
-classes = [
- OUTLINER_HT_header,
- OUTLINER_MT_view,
- OUTLINER_MT_search,
- OUTLINER_MT_edit_datablocks]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_sequencer.py b/release/scripts/ui/space_sequencer.py
index adf80635bc1..3a828bfb6d0 100644
--- a/release/scripts/ui/space_sequencer.py
+++ b/release/scripts/ui/space_sequencer.py
@@ -312,29 +312,33 @@ class SEQUENCER_MT_strip(bpy.types.Menu):
layout.operator("sequencer.swap_data")
-class SequencerButtonsPanel(bpy.types.Panel):
+class SequencerButtonsPanel():
bl_space_type = 'SEQUENCE_EDITOR'
bl_region_type = 'UI'
- def has_sequencer(self, context):
+ @staticmethod
+ def has_sequencer(context):
return (context.space_data.view_type == 'SEQUENCER') or (context.space_data.view_type == 'SEQUENCER_PREVIEW')
- def poll(self, context):
- return self.has_sequencer(context) and (act_strip(context) is not None)
+ @classmethod
+ def poll(cls, context):
+ return cls.has_sequencer(context) and (act_strip(context) is not None)
-class SequencerButtonsPanel_Output(bpy.types.Panel):
+class SequencerButtonsPanel_Output():
bl_space_type = 'SEQUENCE_EDITOR'
bl_region_type = 'UI'
- def has_preview(self, context):
+ @staticmethod
+ def has_preview(context):
return (context.space_data.view_type == 'PREVIEW') or (context.space_data.view_type == 'SEQUENCER_PREVIEW')
- def poll(self, context):
- return self.has_preview(context)
+ @classmethod
+ def poll(cls, context):
+ return cls.has_preview(context)
-class SEQUENCER_PT_edit(SequencerButtonsPanel):
+class SEQUENCER_PT_edit(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Edit Strip"
def draw(self, context):
@@ -381,11 +385,12 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel):
col.label(text="Frame Still %d:%d" % (strip.frame_still_start, strip.frame_still_end))
-class SEQUENCER_PT_effect(SequencerButtonsPanel):
+class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Effect Strip"
- def poll(self, context):
- if not self.has_sequencer(context):
+ @classmethod
+ def poll(cls, context):
+ if not cls.has_sequencer(context):
return False
strip = act_strip(context)
@@ -510,11 +515,12 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel):
col.prop(strip, "rotation_start", text="Rotation")
-class SEQUENCER_PT_input(SequencerButtonsPanel):
+class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Strip Input"
- def poll(self, context):
- if not self.has_sequencer(context):
+ @classmethod
+ def poll(cls, context):
+ if not cls.has_sequencer(context):
return False
strip = act_strip(context)
@@ -528,15 +534,41 @@ class SEQUENCER_PT_input(SequencerButtonsPanel):
'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
'MULTICAM', 'SPEED')
- def draw_filename(self, context):
- pass
-
def draw(self, context):
layout = self.layout
strip = act_strip(context)
- self.draw_filename(context)
+ seq_type = strip.type
+
+ # draw a filename if we have one
+ if seq_type == 'IMAGE':
+ split = layout.split(percentage=0.2)
+ col = split.column()
+ col.label(text="Path:")
+ col = split.column()
+ col.prop(strip, "directory", text="")
+
+ # Current element for the filename
+
+ elem = strip.getStripElem(context.scene.frame_current)
+ if elem:
+ split = layout.split(percentage=0.2)
+ col = split.column()
+ col.label(text="File:")
+ col = split.column()
+ col.prop(elem, "filename", text="") # strip.elements[0] could be a fallback
+
+ elif seq_type == 'MOVIE':
+ split = layout.split(percentage=0.2)
+ col = split.column()
+ col.label(text="Path:")
+ col = split.column()
+ col.prop(strip, "filepath", text="")
+ col.prop(strip, "mpeg_preseek", text="MPEG Preseek")
+ # TODO, sound???
+ # end drawing filename
+
layout.prop(strip, "use_translation", text="Image Offset:")
if strip.use_translation:
@@ -554,93 +586,16 @@ class SEQUENCER_PT_input(SequencerButtonsPanel):
col = layout.column(align=True)
col.label(text="Trim Duration:")
- col.prop(strip, "animation_start_offset", text="Start")
- col.prop(strip, "animation_end_offset", text="End")
-
-
-class SEQUENCER_PT_input_movie(SEQUENCER_PT_input):
- bl_label = "Strip Input"
-
- def poll(self, context):
- if not self.has_sequencer(context):
- return False
-
- strip = act_strip(context)
- if not strip:
- return False
-
- return strip.type == 'MOVIE'
-
- def draw_filename(self, context):
- layout = self.layout
-
- strip = act_strip(context)
-
- split = layout.split(percentage=0.2)
- col = split.column()
- col.label(text="Path:")
- col = split.column()
- col.prop(strip, "filepath", text="")
- col.prop(strip, "mpeg_preseek", text="MPEG Preseek")
-
-
-class SEQUENCER_PT_input_image(SEQUENCER_PT_input):
- bl_label = "Strip Input"
-
- def poll(self, context):
- if not self.has_sequencer(context):
- return False
-
- strip = act_strip(context)
- if not strip:
- return False
-
- return strip.type == 'IMAGE'
+ col.prop(strip, "frame_offset_start", text="Start")
+ col.prop(strip, "frame_offset_end", text="End")
- def draw_filename(self, context):
- layout = self.layout
-
- strip = act_strip(context)
-
- split = layout.split(percentage=0.2)
- col = split.column()
- col.label(text="Path:")
- col = split.column()
- col.prop(strip, "directory", text="")
- # Current element for the filename
-
- elem = strip.getStripElem(context.scene.frame_current)
- if elem:
- split = layout.split(percentage=0.2)
- col = split.column()
- col.label(text="File:")
- col = split.column()
- col.prop(elem, "filename", text="") # strip.elements[0] could be a fallback
-
-
-class SEQUENCER_PT_input_secondary(SEQUENCER_PT_input):
- bl_label = "Strip Input"
-
- def poll(self, context):
- if not self.has_sequencer(context):
- return False
-
- strip = act_strip(context)
- if not strip:
- return False
-
- return strip.type in ('SCENE', 'META')
-
- def draw_filename(self, context):
- pass
-
-
-class SEQUENCER_PT_sound(SequencerButtonsPanel):
+class SEQUENCER_PT_sound(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Sound"
- def poll(self, context):
- if not self.has_sequencer(context):
+ @classmethod
+ def poll(cls, context):
+ if not cls.has_sequencer(context):
return False
strip = act_strip(context)
@@ -676,11 +631,12 @@ class SEQUENCER_PT_sound(SequencerButtonsPanel):
col.prop(strip, "animation_end_offset", text="End")
-class SEQUENCER_PT_scene(SequencerButtonsPanel):
+class SEQUENCER_PT_scene(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Scene"
- def poll(self, context):
- if not self.has_sequencer(context):
+ @classmethod
+ def poll(cls, context):
+ if not cls.has_sequencer(context):
return False
strip = act_strip(context)
@@ -700,11 +656,12 @@ class SEQUENCER_PT_scene(SequencerButtonsPanel):
layout.template_ID(strip, "scene_camera")
-class SEQUENCER_PT_filter(SequencerButtonsPanel):
+class SEQUENCER_PT_filter(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Filter"
- def poll(self, context):
- if not self.has_sequencer(context):
+ @classmethod
+ def poll(cls, context):
+ if not cls.has_sequencer(context):
return False
strip = act_strip(context)
@@ -761,11 +718,12 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel):
col.prop(strip.color_balance, "inverse_gain", text="Inverse")
-class SEQUENCER_PT_proxy(SequencerButtonsPanel):
+class SEQUENCER_PT_proxy(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Proxy"
- def poll(self, context):
- if not self.has_sequencer(context):
+ @classmethod
+ def poll(cls, context):
+ if not cls.has_sequencer(context):
return False
strip = act_strip(context)
@@ -794,7 +752,7 @@ class SEQUENCER_PT_proxy(SequencerButtonsPanel):
flow.prop(strip.proxy, "filepath")
-class SEQUENCER_PT_preview(SequencerButtonsPanel_Output):
+class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, bpy.types.Panel):
bl_label = "Scene Preview/Render"
bl_space_type = 'SEQUENCE_EDITOR'
bl_region_type = 'UI'
@@ -818,7 +776,7 @@ class SEQUENCER_PT_preview(SequencerButtonsPanel_Output):
'''
-class SEQUENCER_PT_view(SequencerButtonsPanel_Output):
+class SEQUENCER_PT_view(SequencerButtonsPanel_Output, bpy.types.Panel):
bl_label = "View Settings"
def draw(self, context):
@@ -834,40 +792,12 @@ class SEQUENCER_PT_view(SequencerButtonsPanel_Output):
col.prop(st, "separate_color_preview")
col.prop(st, "proxy_render_size")
-classes = [
- SEQUENCER_HT_header, # header/menu classes
- SEQUENCER_MT_view,
- SEQUENCER_MT_view_toggle,
- SEQUENCER_MT_select,
- SEQUENCER_MT_marker,
- SEQUENCER_MT_add,
- SEQUENCER_MT_add_effect,
- SEQUENCER_MT_strip,
-
- SEQUENCER_PT_edit, # sequencer panels
- SEQUENCER_PT_effect,
- SEQUENCER_PT_input_movie,
- SEQUENCER_PT_input_image,
- SEQUENCER_PT_input_secondary,
- SEQUENCER_PT_sound,
- SEQUENCER_PT_scene,
- SEQUENCER_PT_filter,
- SEQUENCER_PT_proxy,
-
- SEQUENCER_PT_preview,
- SEQUENCER_PT_view] # view panels
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_text.py b/release/scripts/ui/space_text.py
index 552621d87c6..71ab6540132 100644
--- a/release/scripts/ui/space_text.py
+++ b/release/scripts/ui/space_text.py
@@ -140,6 +140,11 @@ class TEXT_MT_view(bpy.types.Menu):
layout.operator("screen.area_dupli")
layout.operator("screen.screen_full_area")
+
+ layout.separator()
+
+ layout.operator("text.move", text="Top of File").type = 'FILE_TOP'
+ layout.operator("text.move", text="Bottom of File").type = 'FILE_BOTTOM'
class TEXT_MT_text(bpy.types.Menu):
@@ -188,16 +193,6 @@ class TEXT_MT_templates(bpy.types.Menu):
self.path_menu(bpy.utils.script_paths("templates"), "text.open", {"internal": True})
-class TEXT_MT_edit_view(bpy.types.Menu):
- bl_label = "View"
-
- def draw(self, context):
- layout = self.layout
-
- layout.operator("text.move", text="Top of File").type = 'FILE_TOP'
- layout.operator("text.move", text="Bottom of File").type = 'FILE_BOTTOM'
-
-
class TEXT_MT_edit_select(bpy.types.Menu):
bl_label = "Select"
@@ -251,7 +246,8 @@ class TEXT_MT_edit_to3d(bpy.types.Menu):
class TEXT_MT_edit(bpy.types.Menu):
bl_label = "Edit"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.space_data.text)
def draw(self, context):
@@ -268,7 +264,6 @@ class TEXT_MT_edit(bpy.types.Menu):
layout.separator()
- layout.menu("TEXT_MT_edit_view")
layout.menu("TEXT_MT_edit_select")
layout.menu("TEXT_MT_edit_markers")
@@ -297,33 +292,12 @@ class TEXT_MT_toolbox(bpy.types.Menu):
layout.operator("text.run_script")
-
-classes = [
- TEXT_HT_header,
- TEXT_PT_properties,
- TEXT_PT_find,
- TEXT_MT_view,
- TEXT_MT_text,
- TEXT_MT_templates,
- TEXT_MT_format,
- TEXT_MT_edit,
- TEXT_MT_edit_view,
- TEXT_MT_edit_select,
- TEXT_MT_edit_markers,
- TEXT_MT_edit_to3d,
- TEXT_MT_toolbox]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_time.py b/release/scripts/ui/space_time.py
index 8c24dbc2d9c..3825d774f1e 100644
--- a/release/scripts/ui/space_time.py
+++ b/release/scripts/ui/space_time.py
@@ -192,25 +192,12 @@ class TIME_MT_autokey(bpy.types.Menu):
layout.prop_enum(tools, "autokey_mode", 'ADD_REPLACE_KEYS')
layout.prop_enum(tools, "autokey_mode", 'REPLACE_KEYS')
-classes = [
- TIME_HT_header,
- TIME_MT_view,
- TIME_MT_cache,
- TIME_MT_frame,
- TIME_MT_autokey,
- TIME_MT_playback]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py
index c083a62a98e..1bd83e11b71 100644
--- a/release/scripts/ui/space_userpref.py
+++ b/release/scripts/ui/space_userpref.py
@@ -142,7 +142,8 @@ class USERPREF_PT_interface(bpy.types.Panel):
bl_region_type = 'WINDOW'
bl_show_header = False
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'INTERFACE')
@@ -175,12 +176,6 @@ class USERPREF_PT_interface(bpy.types.Panel):
sub.prop(view, "mini_axis_brightness", text="Brightness")
col.separator()
- col.separator()
- col.separator()
-
- col.label(text="Properties Window:")
- col.prop(view, "properties_width_check")
-
row.separator()
row.separator()
@@ -249,7 +244,8 @@ class USERPREF_PT_edit(bpy.types.Panel):
bl_region_type = 'WINDOW'
bl_show_header = False
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'EDITING')
@@ -363,7 +359,8 @@ class USERPREF_PT_system(bpy.types.Panel):
bl_region_type = 'WINDOW'
bl_show_header = False
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'SYSTEM')
@@ -527,7 +524,8 @@ class USERPREF_PT_theme(bpy.types.Panel):
for i, attr in enumerate(props_ls):
colsub_pair[i % 2].row().prop(themedata, attr)
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'THEMES')
@@ -659,7 +657,8 @@ class USERPREF_PT_file(bpy.types.Panel):
bl_region_type = 'WINDOW'
bl_show_header = False
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'FILES')
@@ -730,7 +729,8 @@ class USERPREF_PT_input(InputKeyMapPanel):
bl_space_type = 'USER_PREFERENCES'
bl_label = "Input"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'INPUT')
@@ -821,33 +821,112 @@ class USERPREF_PT_addons(bpy.types.Panel):
bl_label = "Addons"
bl_region_type = 'WINDOW'
bl_show_header = False
+
+ _addons_fake_modules = {}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'ADDONS')
@staticmethod
+ def module_get(mod_name):
+ return USERPREF_PT_addons._addons_fake_modules[mod_name]
+
+ @staticmethod
def _addon_list():
+ import os
import sys
import time
modules = []
loaded_modules = set()
paths = bpy.utils.script_paths("addons")
+ # if folder addons_contrib/ exists, scripts in there will be loaded
+ paths += bpy.utils.script_paths("addons_contrib")
if bpy.app.debug:
t_main = time.time()
- # sys.path.insert(0, None)
- for path in paths:
- # sys.path[0] = path
- modules.extend(bpy.utils.modules_from_path(path, loaded_modules))
+ # fake module importing
+ def fake_module(mod_name, mod_path, speedy=True):
+ if bpy.app.debug:
+ print("fake_module", mod_name, mod_path)
+ import ast
+ ModuleType = type(ast)
+ if speedy:
+ lines = []
+ line_iter = iter(open(mod_path, "r"))
+ l = ""
+ while not l.startswith("bl_addon_info"):
+ l = line_iter.readline()
+ if len(l) == 0:
+ break
+ while l.rstrip():
+ lines.append(l)
+ l = line_iter.readline()
+ del line_iter
+ data = "".join(lines)
+
+ else:
+ data = open(mod_path, "r").read()
+
+ ast_data = ast.parse(data, filename=mod_path)
+ body_info = None
+ for body in ast_data.body:
+ if body.__class__ == ast.Assign:
+ if len(body.targets) == 1:
+ if getattr(body.targets[0], "id", "") == "bl_addon_info":
+ body_info = body
+ break
+
+ if body_info:
+ mod = ModuleType(mod_name)
+ mod.bl_addon_info = ast.literal_eval(body.value)
+ mod.__file__ = mod_path
+ mod.__time__ = os.path.getmtime(mod_path)
+ return mod
+ else:
+ return None
+
+ modules_stale = set(USERPREF_PT_addons._addons_fake_modules.keys())
- if bpy.app.debug:
- print("Addon Script Load Time %.4f" % (time.time() - t_main))
+ for path in paths:
+ for f in sorted(os.listdir(path)):
+ if f.endswith(".py"):
+ mod_name = f[0:-3]
+ mod_path = os.path.join(path, f)
+ elif ("." not in f) and (os.path.isfile(os.path.join(path, f, "__init__.py"))):
+ mod_name = f
+ mod_path = os.path.join(path, f, "__init__.py")
+ else:
+ mod_name = ""
+ mod_path = ""
+
+ if mod_name:
+ if mod_name in modules_stale:
+ modules_stale.remove(mod_name)
+ mod = USERPREF_PT_addons._addons_fake_modules.get(mod_name)
+ if mod:
+ if mod.__time__ != os.path.getmtime(mod_path):
+ print("Reloading", mod_name)
+ del USERPREF_PT_addons._addons_fake_modules[mod_name]
+ mod = None
+
+ if mod is None:
+ mod = fake_module(mod_name, mod_path)
+ if mod:
+ USERPREF_PT_addons._addons_fake_modules[mod_name] = mod
+
+
+ # just incase we get stale modules, not likely
+ for mod_stale in modules_stale:
+ del USERPREF_PT_addons._addons_fake_modules[mod_stale]
+ del modules_stale
- # del sys.path[0]
- return modules
+ mod_list = list(USERPREF_PT_addons._addons_fake_modules.values())
+ mod_list.sort(key=lambda mod: (mod.bl_addon_info['category'], mod.bl_addon_info['name']))
+ return mod_list
def draw(self, context):
layout = self.layout
@@ -1001,8 +1080,13 @@ class WM_OT_addon_enable(bpy.types.Operator):
def execute(self, context):
module_name = self.properties.module
+ # note, this still gets added to _bpy_types.TypeMap
+ import bpy_types as _bpy_types
+ _bpy_types._register_immediate = False
+
try:
mod = __import__(module_name)
+ _bpy_types._register_module(module_name)
mod.register()
except:
import traceback
@@ -1017,7 +1101,9 @@ class WM_OT_addon_enable(bpy.types.Operator):
if info.get("blender", (0, 0, 0)) > bpy.app.version:
self.report("WARNING','This script was written for a newer version of Blender and might not function (correctly).\nThe script is enabled though.")
-
+
+ _bpy_types._register_immediate = True
+
return {'FINISHED'}
@@ -1029,13 +1115,15 @@ class WM_OT_addon_disable(bpy.types.Operator):
module = StringProperty(name="Module", description="Module name of the addon to disable")
def execute(self, context):
- import traceback
+ import bpy_types as _bpy_types
module_name = self.properties.module
try:
mod = __import__(module_name)
+ _bpy_types._unregister_module(module_name, free=False) # dont free because we may want to enable again.
mod.unregister()
except:
+ import traceback
traceback.print_exc()
addons = context.user_preferences.addons
@@ -1123,7 +1211,8 @@ class WM_OT_addon_expand(bpy.types.Operator):
# unlikely to fail, module should have already been imported
try:
- mod = __import__(module_name)
+ # mod = __import__(module_name)
+ mod = USERPREF_PT_addons.module_get(module_name)
except:
import traceback
traceback.print_exc()
@@ -1134,36 +1223,11 @@ class WM_OT_addon_expand(bpy.types.Operator):
return {'FINISHED'}
-classes = [
- USERPREF_HT_header,
- USERPREF_PT_tabs,
- USERPREF_PT_interface,
- USERPREF_PT_theme,
- USERPREF_PT_edit,
- USERPREF_PT_system,
- USERPREF_PT_file,
- USERPREF_PT_input,
- USERPREF_PT_addons,
-
- USERPREF_MT_interaction_presets,
- USERPREF_MT_splash,
-
- WM_OT_addon_enable,
- WM_OT_addon_disable,
- WM_OT_addon_install,
- WM_OT_addon_expand]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
-
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_userpref_keymap.py b/release/scripts/ui/space_userpref_keymap.py
index c93b24d5cb2..9a482b89652 100644
--- a/release/scripts/ui/space_userpref_keymap.py
+++ b/release/scripts/ui/space_userpref_keymap.py
@@ -763,7 +763,8 @@ class WM_OT_keyconfig_remove(bpy.types.Operator):
bl_idname = "wm.keyconfig_remove"
bl_label = "Remove Key Config"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
wm = context.manager
return wm.active_keyconfig.user_defined
@@ -784,29 +785,11 @@ class WM_OT_keyconfig_remove(bpy.types.Operator):
wm.remove_keyconfig(keyconfig)
return {'FINISHED'}
-
-classes = [
- WM_OT_keyconfig_export,
- WM_OT_keyconfig_import,
- WM_OT_keyconfig_test,
- WM_OT_keyconfig_remove,
- WM_OT_keymap_edit,
- WM_OT_keymap_restore,
- WM_OT_keyitem_add,
- WM_OT_keyitem_remove,
- WM_OT_keyitem_restore]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
-
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_view3d.py b/release/scripts/ui/space_view3d.py
index 7b59b00dc56..a3e945f460a 100644
--- a/release/scripts/ui/space_view3d.py
+++ b/release/scripts/ui/space_view3d.py
@@ -75,11 +75,16 @@ class VIEW3D_HT_header(bpy.types.Header):
row.prop(view, "occlude_geometry", text="")
# Proportional editing
- if obj.mode in ('OBJECT', 'EDIT', 'PARTICLE_EDIT'):
+ if obj.mode in ('EDIT', 'PARTICLE_EDIT'):
row = layout.row(align=True)
row.prop(toolsettings, "proportional_editing", text="", icon_only=True)
if toolsettings.proportional_editing != 'DISABLED':
row.prop(toolsettings, "proportional_editing_falloff", text="", icon_only=True)
+ elif obj.mode == 'OBJECT':
+ row = layout.row(align=True)
+ row.prop(toolsettings, "proportional_editing_objects", text="", icon_only=True)
+ if toolsettings.proportional_editing_objects:
+ row.prop(toolsettings, "proportional_editing_falloff", text="", icon_only=True)
# Snap
row = layout.row(align=True)
@@ -114,7 +119,7 @@ class VIEW3D_HT_header(bpy.types.Header):
# ********** Utilities **********
-class VIEW3D_MT_showhide(bpy.types.Menu):
+class ShowHideMenu():
bl_label = "Show/Hide"
_operator_name = ""
@@ -709,7 +714,8 @@ class VIEW3D_MT_object_clear(bpy.types.Menu):
class VIEW3D_MT_object_specials(bpy.types.Menu):
bl_label = "Specials"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
# add more special types
return context.object
@@ -1025,7 +1031,7 @@ class VIEW3D_MT_sculpt(bpy.types.Menu):
layout.prop(brush, "use_anchor")
if sculpt_tool in ('DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'):
- layout.prop(brush, "direction")
+ layout.prop_menu_enum(brush, "direction")
if sculpt_tool == 'LAYER':
layout.prop(brush, "use_persistent")
@@ -1086,7 +1092,7 @@ class VIEW3D_MT_particle_specials(bpy.types.Menu):
layout.operator("particle.remove_doubles")
-class VIEW3D_MT_particle_showhide(VIEW3D_MT_showhide):
+class VIEW3D_MT_particle_showhide(ShowHideMenu, bpy.types.Menu):
_operator_name = "particle"
# ********** Pose Menu **********
@@ -1236,7 +1242,7 @@ class VIEW3D_MT_pose_constraints(bpy.types.Menu):
layout.operator("pose.constraints_clear")
-class VIEW3D_MT_pose_showhide(VIEW3D_MT_showhide):
+class VIEW3D_MT_pose_showhide(ShowHideMenu, bpy.types.Menu):
_operator_name = "pose"
@@ -1602,7 +1608,7 @@ class VIEW3D_MT_edit_mesh_normals(bpy.types.Menu):
layout.operator("mesh.flip_normals")
-class VIEW3D_MT_edit_mesh_showhide(VIEW3D_MT_showhide):
+class VIEW3D_MT_edit_mesh_showhide(ShowHideMenu, bpy.types.Menu):
_operator_name = "mesh"
# Edit Curve
@@ -1694,7 +1700,7 @@ class VIEW3D_MT_edit_curve_specials(bpy.types.Menu):
layout.operator("curve.smooth_radius")
-class VIEW3D_MT_edit_curve_showhide(VIEW3D_MT_showhide):
+class VIEW3D_MT_edit_curve_showhide(ShowHideMenu, bpy.types.Menu):
_operator_name = "curve"
@@ -1934,7 +1940,8 @@ class VIEW3D_PT_view3d_properties(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "View"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
view = context.space_data
return (view)
@@ -1970,7 +1977,8 @@ class VIEW3D_PT_view3d_name(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Item"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.space_data and context.active_object)
def draw(self, context):
@@ -1995,7 +2003,8 @@ class VIEW3D_PT_view3d_display(bpy.types.Panel):
bl_label = "Display"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
view = context.space_data
return (view)
@@ -2062,7 +2071,8 @@ class VIEW3D_PT_view3d_meshdisplay(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Mesh Display"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
# The active object check is needed because of localmode
return (context.active_object and (context.mode == 'EDIT_MESH'))
@@ -2098,7 +2108,8 @@ class VIEW3D_PT_view3d_curvedisplay(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Curve Display"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
editmesh = context.mode == 'EDIT_CURVE'
return (editmesh)
@@ -2120,7 +2131,8 @@ class VIEW3D_PT_background_image(bpy.types.Panel):
bl_label = "Background Images"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
view = context.space_data
# bg = context.space_data.background_image
return (view)
@@ -2169,7 +2181,8 @@ class VIEW3D_PT_transform_orientations(bpy.types.Panel):
bl_label = "Transform Orientations"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
view = context.space_data
return (view)
@@ -2196,7 +2209,8 @@ class VIEW3D_PT_etch_a_ton(bpy.types.Panel):
bl_label = "Skeleton Sketching"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
scene = context.space_data
ob = context.active_object
return scene and ob and ob.type == 'ARMATURE' and ob.mode == 'EDIT'
@@ -2239,7 +2253,7 @@ class VIEW3D_PT_context_properties(bpy.types.Panel):
bl_label = "Properties"
bl_default_closed = True
- def _active_context_member(self, context):
+ def _active_context_member(context):
obj = context.object
if obj:
mode = obj.mode
@@ -2252,8 +2266,9 @@ class VIEW3D_PT_context_properties(bpy.types.Panel):
return ""
- def poll(self, context):
- member = self._active_context_member(context)
+ @classmethod
+ def poll(cls, context):
+ member = cls._active_context_member(context)
if member:
context_member = getattr(context, member)
return context_member and context_member.keys()
@@ -2263,129 +2278,19 @@ class VIEW3D_PT_context_properties(bpy.types.Panel):
def draw(self, context):
import rna_prop_ui
# reload(rna_prop_ui)
- member = self._active_context_member(context)
+ member = __class__._active_context_member(context)
if member:
# Draw with no edit button
rna_prop_ui.draw(self.layout, context, member, False)
-classes = [
- VIEW3D_OT_edit_mesh_extrude_move, # detects constraints setup and extrude region
- VIEW3D_OT_edit_mesh_extrude_individual_move,
-
- VIEW3D_HT_header, # Header
-
- VIEW3D_MT_view, #View Menus
- VIEW3D_MT_view_navigation,
- VIEW3D_MT_view_align,
- VIEW3D_MT_view_align_selected,
- VIEW3D_MT_view_cameras,
-
- VIEW3D_MT_select_object, # Select Menus
- VIEW3D_MT_select_pose,
- VIEW3D_MT_select_particle,
- VIEW3D_MT_select_edit_mesh,
- VIEW3D_MT_select_edit_curve,
- VIEW3D_MT_select_edit_surface,
- VIEW3D_MT_select_edit_metaball,
- VIEW3D_MT_select_edit_lattice,
- VIEW3D_MT_select_edit_armature,
- VIEW3D_MT_select_face, # XXX todo
-
- VIEW3D_MT_transform, # Object/Edit Menus
- VIEW3D_MT_mirror, # Object/Edit Menus
- VIEW3D_MT_snap, # Object/Edit Menus
- VIEW3D_MT_uv_map, # Edit Menus
-
- VIEW3D_MT_object, # Object Menu
- VIEW3D_MT_object_specials,
- VIEW3D_MT_object_apply,
- VIEW3D_MT_object_clear,
- VIEW3D_MT_object_parent,
- VIEW3D_MT_object_track,
- VIEW3D_MT_object_group,
- VIEW3D_MT_object_constraints,
- VIEW3D_MT_object_showhide,
- VIEW3D_MT_make_single_user,
- VIEW3D_MT_make_links,
- VIEW3D_MT_object_game_properties,
- VIEW3D_MT_object_game_logicbricks,
-
- VIEW3D_MT_hook,
- VIEW3D_MT_vertex_group,
-
- VIEW3D_MT_sculpt, # Sculpt Menu
- VIEW3D_MT_paint_vertex,
- VIEW3D_MT_paint_weight,
-
- VIEW3D_MT_particle, # Particle Menu
- VIEW3D_MT_particle_specials,
- VIEW3D_MT_particle_showhide,
-
- VIEW3D_MT_pose, # POSE Menu
- VIEW3D_MT_pose_transform,
- VIEW3D_MT_pose_pose,
- VIEW3D_MT_pose_motion,
- VIEW3D_MT_pose_group,
- VIEW3D_MT_pose_ik,
- VIEW3D_MT_pose_constraints,
- VIEW3D_MT_pose_showhide,
- VIEW3D_MT_pose_apply,
-
- VIEW3D_MT_edit_mesh,
- VIEW3D_MT_edit_mesh_specials, # Only as a menu for keybindings
- VIEW3D_MT_edit_mesh_selection_mode, # Only as a menu for keybindings
- VIEW3D_MT_edit_mesh_vertices,
- VIEW3D_MT_edit_mesh_edges,
- VIEW3D_MT_edit_mesh_faces,
- VIEW3D_MT_edit_mesh_normals,
- VIEW3D_MT_edit_mesh_showhide,
- VIEW3D_MT_edit_mesh_extrude, # use with VIEW3D_OT_edit_mesh_extrude_menu
-
- VIEW3D_MT_edit_curve,
- VIEW3D_MT_edit_curve_ctrlpoints,
- VIEW3D_MT_edit_curve_segments,
- VIEW3D_MT_edit_curve_specials,
- VIEW3D_MT_edit_curve_showhide,
-
- VIEW3D_MT_edit_surface,
-
- VIEW3D_MT_edit_text,
- VIEW3D_MT_edit_text_chars,
-
- VIEW3D_MT_edit_meta,
- VIEW3D_MT_edit_meta_showhide,
-
- VIEW3D_MT_edit_lattice,
-
- VIEW3D_MT_edit_armature,
- VIEW3D_MT_edit_armature_parent,
- VIEW3D_MT_edit_armature_roll,
-
- VIEW3D_MT_armature_specials, # Only as a menu for keybindings
-
- # Panels
- VIEW3D_PT_view3d_properties,
- VIEW3D_PT_view3d_display,
- VIEW3D_PT_view3d_name,
- VIEW3D_PT_view3d_meshdisplay,
- VIEW3D_PT_view3d_curvedisplay,
- VIEW3D_PT_background_image,
- VIEW3D_PT_transform_orientations,
- VIEW3D_PT_etch_a_ton,
- VIEW3D_PT_context_properties]
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
- register() \ No newline at end of file
+ register()
diff --git a/release/scripts/ui/space_view3d_toolbar.py b/release/scripts/ui/space_view3d_toolbar.py
index ebf9f8e5af3..56abbb3cb14 100644
--- a/release/scripts/ui/space_view3d_toolbar.py
+++ b/release/scripts/ui/space_view3d_toolbar.py
@@ -19,9 +19,8 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-class View3DPanel(bpy.types.Panel):
+class View3DPanel():
bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'
@@ -29,7 +28,7 @@ class View3DPanel(bpy.types.Panel):
# ********** default tools for objectmode ****************
-class VIEW3D_PT_tools_objectmode(View3DPanel):
+class VIEW3D_PT_tools_objectmode(View3DPanel, bpy.types.Panel):
bl_context = "objectmode"
bl_label = "Object Tools"
@@ -79,7 +78,7 @@ class VIEW3D_PT_tools_objectmode(View3DPanel):
# ********** default tools for editmode_mesh ****************
-class VIEW3D_PT_tools_meshedit(View3DPanel):
+class VIEW3D_PT_tools_meshedit(View3DPanel, bpy.types.Panel):
bl_context = "mesh_edit"
bl_label = "Mesh Tools"
@@ -147,7 +146,7 @@ class VIEW3D_PT_tools_meshedit(View3DPanel):
row.operator("gpencil.draw", text="Erase").mode = 'ERASER'
-class VIEW3D_PT_tools_meshedit_options(View3DPanel):
+class VIEW3D_PT_tools_meshedit_options(View3DPanel, bpy.types.Panel):
bl_context = "mesh_edit"
bl_label = "Mesh Options"
@@ -166,7 +165,7 @@ class VIEW3D_PT_tools_meshedit_options(View3DPanel):
# ********** default tools for editmode_curve ****************
-class VIEW3D_PT_tools_curveedit(View3DPanel):
+class VIEW3D_PT_tools_curveedit(View3DPanel, bpy.types.Panel):
bl_context = "curve_edit"
bl_label = "Curve Tools"
@@ -220,7 +219,7 @@ class VIEW3D_PT_tools_curveedit(View3DPanel):
# ********** default tools for editmode_surface ****************
-class VIEW3D_PT_tools_surfaceedit(View3DPanel):
+class VIEW3D_PT_tools_surfaceedit(View3DPanel, bpy.types.Panel):
bl_context = "surface_edit"
bl_label = "Surface Tools"
@@ -260,7 +259,7 @@ class VIEW3D_PT_tools_surfaceedit(View3DPanel):
# ********** default tools for editmode_text ****************
-class VIEW3D_PT_tools_textedit(View3DPanel):
+class VIEW3D_PT_tools_textedit(View3DPanel, bpy.types.Panel):
bl_context = "text_edit"
bl_label = "Text Tools"
@@ -293,7 +292,7 @@ class VIEW3D_PT_tools_textedit(View3DPanel):
# ********** default tools for editmode_armature ****************
-class VIEW3D_PT_tools_armatureedit(View3DPanel):
+class VIEW3D_PT_tools_armatureedit(View3DPanel, bpy.types.Panel):
bl_context = "armature_edit"
bl_label = "Armature Tools"
@@ -330,7 +329,7 @@ class VIEW3D_PT_tools_armatureedit(View3DPanel):
row.operator("gpencil.draw", text="Erase").mode = 'ERASER'
-class VIEW3D_PT_tools_armatureedit_options(View3DPanel):
+class VIEW3D_PT_tools_armatureedit_options(View3DPanel, bpy.types.Panel):
bl_context = "armature_edit"
bl_label = "Armature Options"
@@ -345,7 +344,7 @@ class VIEW3D_PT_tools_armatureedit_options(View3DPanel):
# ********** default tools for editmode_mball ****************
-class VIEW3D_PT_tools_mballedit(View3DPanel):
+class VIEW3D_PT_tools_mballedit(View3DPanel, bpy.types.Panel):
bl_context = "mball_edit"
bl_label = "Meta Tools"
@@ -373,7 +372,7 @@ class VIEW3D_PT_tools_mballedit(View3DPanel):
# ********** default tools for editmode_lattice ****************
-class VIEW3D_PT_tools_latticeedit(View3DPanel):
+class VIEW3D_PT_tools_latticeedit(View3DPanel, bpy.types.Panel):
bl_context = "lattice_edit"
bl_label = "Lattice Tools"
@@ -405,7 +404,7 @@ class VIEW3D_PT_tools_latticeedit(View3DPanel):
# ********** default tools for posemode ****************
-class VIEW3D_PT_tools_posemode(View3DPanel):
+class VIEW3D_PT_tools_posemode(View3DPanel, bpy.types.Panel):
bl_context = "posemode"
bl_label = "Pose Tools"
@@ -453,7 +452,7 @@ class VIEW3D_PT_tools_posemode(View3DPanel):
row.operator("gpencil.draw", text="Erase").mode = 'ERASER'
-class VIEW3D_PT_tools_posemode_options(View3DPanel):
+class VIEW3D_PT_tools_posemode_options(View3DPanel, bpy.types.Panel):
bl_context = "posemode"
bl_label = "Pose Options"
@@ -469,11 +468,12 @@ class VIEW3D_PT_tools_posemode_options(View3DPanel):
# ********** default tools for paint modes ****************
-class PaintPanel(bpy.types.Panel):
+class PaintPanel():
bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'
- def paint_settings(self, context):
+ @staticmethod
+ def paint_settings(context):
ts = context.tool_settings
if context.sculpt_object:
@@ -490,40 +490,22 @@ class PaintPanel(bpy.types.Panel):
return False
-class VIEW3D_PT_tools_brush(PaintPanel):
+class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
bl_label = "Brush"
- def poll(self, context):
- return self.paint_settings(context)
+ @classmethod
+ def poll(cls, context):
+ return cls.paint_settings(context)
def draw(self, context):
layout = self.layout
- settings = self.paint_settings(context)
+ settings = __class__.paint_settings(context)
brush = settings.brush
if not context.particle_edit_object:
col = layout.split().column()
-
- if context.sculpt_object and context.tool_settings.sculpt:
- col.template_ID_preview(settings, "brush", new="brush.add", filter="is_sculpt_brush", rows=3, cols=8)
- elif context.texture_paint_object and context.tool_settings.image_paint:
- col.template_ID_preview(settings, "brush", new="brush.add", filter="is_imapaint_brush", rows=3, cols=8)
- elif context.vertex_paint_object and context.tool_settings.vertex_paint:
- col.template_ID_preview(settings, "brush", new="brush.add", filter="is_vpaint_brush", rows=3, cols=8)
- elif context.weight_paint_object and context.tool_settings.weight_paint:
- col.template_ID_preview(settings, "brush", new="brush.add", filter="is_wpaint_brush", rows=3, cols=8)
- else:
- row = col.row()
-
- if context.sculpt_object and brush:
- defaultbrushes = 8
- elif context.texture_paint_object and brush:
- defaultbrushes = 4
- else:
- defaultbrushes = 7
-
- row.template_list(settings, "brushes", settings, "active_brush_index", rows=2, maxrows=defaultbrushes)
+ col.template_ID_preview(settings, "brush", new="brush.add", rows=3, cols=8)
# Particle Mode #
@@ -735,19 +717,20 @@ class VIEW3D_PT_tools_brush(PaintPanel):
#row.prop(brush, "use_jitter_pressure", toggle=True, text="")
-class VIEW3D_PT_tools_brush_texture(PaintPanel):
+class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel):
bl_label = "Texture"
bl_default_closed = True
- def poll(self, context):
- settings = self.paint_settings(context)
+ @classmethod
+ def poll(cls, context):
+ settings = cls.paint_settings(context)
return (settings and settings.brush and (context.sculpt_object or
context.texture_paint_object))
def draw(self, context):
layout = self.layout
- settings = self.paint_settings(context)
+ settings = __class__.paint_settings(context)
brush = settings.brush
tex_slot = brush.texture_slot
@@ -758,7 +741,6 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel):
if context.sculpt_object:
#XXX duplicated from properties_texture.py
- wide_ui = context.region.width > narrowui
col.separator()
@@ -803,10 +785,7 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel):
col = split.column()
col.prop(tex_slot, "offset")
- if wide_ui:
- col = split.column()
- else:
- col.separator()
+ col = split.column()
col.prop(tex_slot, "size")
@@ -837,12 +816,13 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel):
col.active = tex_slot.map_mode in ('FIXED', 'TILED') and brush.use_texture_overlay
-class VIEW3D_PT_tools_brush_tool(PaintPanel):
+class VIEW3D_PT_tools_brush_tool(PaintPanel, bpy.types.Panel):
bl_label = "Tool"
bl_default_closed = True
- def poll(self, context):
- settings = self.paint_settings(context)
+ @classmethod
+ def poll(cls, context):
+ settings = cls.paint_settings(context)
return (settings and settings.brush and
(context.sculpt_object or context.texture_paint_object or
context.vertex_paint_object or context.weight_paint_object))
@@ -850,7 +830,7 @@ class VIEW3D_PT_tools_brush_tool(PaintPanel):
def draw(self, context):
layout = self.layout
- settings = self.paint_settings(context)
+ settings = __class__.paint_settings(context)
brush = settings.brush
texture_paint = context.texture_paint_object
sculpt = context.sculpt_object
@@ -865,13 +845,20 @@ class VIEW3D_PT_tools_brush_tool(PaintPanel):
elif context.vertex_paint_object or context.weight_paint_object:
col.prop(brush, "vertexpaint_tool", expand=False, text="")
+ row = layout.row(align=True)
+ row.prop(brush, "use_paint_sculpt", text="", icon='SCULPTMODE_HLT')
+ row.prop(brush, "use_paint_vertex", text="", icon='VPAINT_HLT')
+ row.prop(brush, "use_paint_weight", text="", icon='WPAINT_HLT')
+ row.prop(brush, "use_paint_texture", text="", icon='TPAINT_HLT')
+
-class VIEW3D_PT_tools_brush_stroke(PaintPanel):
+class VIEW3D_PT_tools_brush_stroke(PaintPanel, bpy.types.Panel):
bl_label = "Stroke"
bl_default_closed = True
- def poll(self, context):
- settings = self.paint_settings(context)
+ @classmethod
+ def poll(cls, context):
+ settings = cls.paint_settings(context)
return (settings and settings.brush and (context.sculpt_object or
context.vertex_paint_object or
context.weight_paint_object or
@@ -880,7 +867,7 @@ class VIEW3D_PT_tools_brush_stroke(PaintPanel):
def draw(self, context):
layout = self.layout
- settings = self.paint_settings(context)
+ settings = __class__.paint_settings(context)
brush = settings.brush
texture_paint = context.texture_paint_object
@@ -963,12 +950,13 @@ class VIEW3D_PT_tools_brush_stroke(PaintPanel):
# row.prop(brush, "use_spacing_pressure", toggle=True, text="")
-class VIEW3D_PT_tools_brush_curve(PaintPanel):
+class VIEW3D_PT_tools_brush_curve(PaintPanel, bpy.types.Panel):
bl_label = "Curve"
bl_default_closed = True
- def poll(self, context):
- settings = self.paint_settings(context)
+ @classmethod
+ def poll(cls, context):
+ settings = cls.paint_settings(context)
return (settings and settings.brush and settings.brush.curve)
def draw(self, context):
@@ -987,21 +975,22 @@ class VIEW3D_PT_tools_brush_curve(PaintPanel):
row.operator("brush.curve_preset", icon="LINCURVE", text="").shape = 'LINE'
row.operator("brush.curve_preset", icon="NOCURVE", text="").shape = 'MAX'
-class VIEW3D_PT_sculpt_options(PaintPanel):
+
+class VIEW3D_PT_sculpt_options(PaintPanel, bpy.types.Panel):
bl_label = "Options"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.sculpt_object and context.tool_settings.sculpt)
def draw(self, context):
layout = self.layout
- wide_ui = context.region.width > narrowui
tool_settings = context.tool_settings
sculpt = tool_settings.sculpt
- settings = self.paint_settings(context)
+ settings = __class__.paint_settings(context)
brush = settings.brush
split = layout.split()
@@ -1016,10 +1005,7 @@ class VIEW3D_PT_sculpt_options(PaintPanel):
col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
- if wide_ui:
- col = split.column()
- else:
- col.separator()
+ col = split.column()
col.label(text="Lock:")
row = col.row(align=True)
@@ -1029,20 +1015,20 @@ class VIEW3D_PT_sculpt_options(PaintPanel):
-class VIEW3D_PT_sculpt_symmetry(PaintPanel):
+class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel):
bl_label = "Symmetry"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.sculpt_object and context.tool_settings.sculpt)
def draw(self, context):
- wide_ui = context.region.width > narrowui
layout = self.layout
sculpt = context.tool_settings.sculpt
- settings = self.paint_settings(context)
+ settings = __class__.paint_settings(context)
brush = settings.brush
split = layout.split()
@@ -1054,10 +1040,7 @@ class VIEW3D_PT_sculpt_symmetry(PaintPanel):
col.prop(sculpt, "symmetry_y", text="Y")
col.prop(sculpt, "symmetry_z", text="Z")
- if wide_ui:
- col = split.column()
- else:
- col.separator()
+ col = split.column()
col.prop(sculpt, "radial_symm", text="Radial")
@@ -1067,18 +1050,19 @@ class VIEW3D_PT_sculpt_symmetry(PaintPanel):
col.prop(sculpt, "use_symmetry_feather", text="Feather")
-class VIEW3D_PT_tools_brush_appearance(PaintPanel):
+class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel):
bl_label = "Appearance"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.sculpt_object and context.tool_settings.sculpt) or (context.vertex_paint_object and context.tool_settings.vertex_paint) or (context.weight_paint_object and context.tool_settings.weight_paint) or (context.texture_paint_object and context.tool_settings.image_paint)
def draw(self, context):
layout = self.layout
sculpt = context.tool_settings.sculpt
- settings = self.paint_settings(context)
+ settings = __class__.paint_settings(context)
brush = settings.brush
col = layout.column();
@@ -1105,7 +1089,7 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel):
# ********** default tools for weightpaint ****************
-class VIEW3D_PT_tools_weightpaint(View3DPanel):
+class VIEW3D_PT_tools_weightpaint(View3DPanel, bpy.types.Panel):
bl_context = "weightpaint"
bl_label = "Weight Tools"
@@ -1120,7 +1104,7 @@ class VIEW3D_PT_tools_weightpaint(View3DPanel):
col.operator("object.vertex_group_levels", text="Levels")
-class VIEW3D_PT_tools_weightpaint_options(View3DPanel):
+class VIEW3D_PT_tools_weightpaint_options(View3DPanel, bpy.types.Panel):
bl_context = "weightpaint"
bl_label = "Options"
@@ -1157,7 +1141,7 @@ class VIEW3D_PT_tools_weightpaint_options(View3DPanel):
# ********** default tools for vertexpaint ****************
-class VIEW3D_PT_tools_vertexpaint(View3DPanel):
+class VIEW3D_PT_tools_vertexpaint(View3DPanel, bpy.types.Panel):
bl_context = "vertexpaint"
bl_label = "Options"
@@ -1186,12 +1170,14 @@ class VIEW3D_PT_tools_vertexpaint(View3DPanel):
# ********** default tools for texturepaint ****************
-class VIEW3D_PT_tools_projectpaint(View3DPanel):
+class VIEW3D_PT_tools_projectpaint(View3DPanel, bpy.types.Panel):
bl_context = "texturepaint"
bl_label = "Project Paint"
- def poll(self, context):
- return context.tool_settings.image_paint.brush.imagepaint_tool != 'SMEAR'
+ @classmethod
+ def poll(cls, context):
+ brush = context.tool_settings.image_paint.brush
+ return (brush and brush.imagepaint_tool != 'SMEAR')
def draw_header(self, context):
ipaint = context.tool_settings.image_paint
@@ -1259,7 +1245,8 @@ class VIEW3D_PT_imagepaint_options(PaintPanel):
bl_label = "Options"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.texture_paint_object and context.tool_settings.image_paint)
def draw(self, context):
@@ -1294,7 +1281,7 @@ class VIEW3D_MT_tools_projectpaint_stencil(bpy.types.Menu):
prop.value = i
-class VIEW3D_PT_tools_particlemode(View3DPanel):
+class VIEW3D_PT_tools_particlemode(View3DPanel, bpy.types.Panel):
'''default tools for particle mode'''
bl_context = "particlemode"
bl_label = "Options"
@@ -1361,49 +1348,12 @@ class VIEW3D_PT_tools_particlemode(View3DPanel):
sub.prop(pe, "fade_frames", slider=True)
-classes = [
- VIEW3D_PT_tools_weightpaint,
- VIEW3D_PT_tools_objectmode,
- VIEW3D_PT_tools_meshedit,
- VIEW3D_PT_tools_meshedit_options,
- VIEW3D_PT_tools_curveedit,
- VIEW3D_PT_tools_surfaceedit,
- VIEW3D_PT_tools_textedit,
- VIEW3D_PT_tools_armatureedit,
- VIEW3D_PT_tools_armatureedit_options,
- VIEW3D_PT_tools_mballedit,
- VIEW3D_PT_tools_latticeedit,
- VIEW3D_PT_tools_posemode,
- VIEW3D_PT_tools_posemode_options,
- VIEW3D_PT_tools_brush,
- VIEW3D_PT_tools_brush_texture,
- VIEW3D_PT_tools_brush_stroke,
- VIEW3D_PT_tools_brush_curve,
- VIEW3D_PT_tools_brush_appearance,
- VIEW3D_PT_tools_brush_tool,
- VIEW3D_PT_sculpt_symmetry,
- VIEW3D_PT_sculpt_options,
- VIEW3D_PT_tools_vertexpaint,
- VIEW3D_PT_tools_weightpaint_options,
- VIEW3D_PT_imagepaint_options,
-
- VIEW3D_PT_tools_projectpaint,
- VIEW3D_MT_tools_projectpaint_clone,
- VIEW3D_MT_tools_projectpaint_stencil,
-
- VIEW3D_PT_tools_particlemode]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()