svn merge -r 31060:31144 https://svn.blender.org/svnroot/bf-blender/trunk/blender
authorJoerg Mueller <nexyon@gmail.com>
Sat, 7 Aug 2010 15:45:07 +0000 (15:45 +0000)
committerJoerg Mueller <nexyon@gmail.com>
Sat, 7 Aug 2010 15:45:07 +0000 (15:45 +0000)
102 files changed:
build_files/make/nan_definitions.mk
release/scripts/io/export_3ds.py
release/scripts/io/export_fbx.py
release/scripts/io/export_mdd.py
release/scripts/io/export_obj.py
release/scripts/io/export_ply.py
release/scripts/io/export_x3d.py
release/scripts/io/import_shape_mdd.py
release/scripts/io/netrender/client.py
release/scripts/io/netrender/operators.py
release/scripts/io/netrender/repath.py
release/scripts/io/netrender/ui.py
release/scripts/modules/bpy/__init__.py
release/scripts/modules/bpy/path.py [new file with mode: 0644]
release/scripts/modules/bpy/utils.py
release/scripts/modules/bpy_types.py
release/scripts/modules/rigify/__init__.py
release/scripts/op/fcurve_euler_filter.py
release/scripts/op/image.py
release/scripts/op/mesh.py
release/scripts/op/object.py
release/scripts/op/object_align.py
release/scripts/op/screen_play_rendered_anim.py
release/scripts/op/sequencer.py
release/scripts/op/uv.py
release/scripts/op/uvcalc_follow_active.py
release/scripts/op/uvcalc_smart_project.py
release/scripts/op/wm.py
release/scripts/templates/operator.py
release/scripts/templates/operator_simple.py
release/scripts/templates/operator_uv.py
release/scripts/ui/properties_animviz.py
release/scripts/ui/properties_data_armature.py
release/scripts/ui/properties_data_armature_rigify.py
release/scripts/ui/properties_data_bone.py
release/scripts/ui/properties_data_camera.py
release/scripts/ui/properties_data_curve.py
release/scripts/ui/properties_data_empty.py
release/scripts/ui/properties_data_lamp.py
release/scripts/ui/properties_data_lattice.py
release/scripts/ui/properties_data_mesh.py
release/scripts/ui/properties_data_metaball.py
release/scripts/ui/properties_data_modifier.py
release/scripts/ui/properties_game.py
release/scripts/ui/properties_material.py
release/scripts/ui/properties_object.py
release/scripts/ui/properties_object_constraint.py
release/scripts/ui/properties_particle.py
release/scripts/ui/properties_physics_cloth.py
release/scripts/ui/properties_physics_common.py
release/scripts/ui/properties_physics_field.py
release/scripts/ui/properties_physics_fluid.py
release/scripts/ui/properties_physics_smoke.py
release/scripts/ui/properties_physics_softbody.py
release/scripts/ui/properties_render.py
release/scripts/ui/properties_scene.py
release/scripts/ui/properties_texture.py
release/scripts/ui/properties_world.py
release/scripts/ui/space_console.py
release/scripts/ui/space_image.py
release/scripts/ui/space_logic.py
release/scripts/ui/space_sequencer.py
release/scripts/ui/space_text.py
release/scripts/ui/space_userpref.py
release/scripts/ui/space_userpref_keymap.py
release/scripts/ui/space_view3d.py
release/scripts/ui/space_view3d_toolbar.py
source/blender/blenkernel/BKE_curve.h
source/blender/blenkernel/BKE_node.h
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/lattice.c
source/blender/blenkernel/intern/node.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/scene.c
source/blender/editors/include/ED_view3d.h
source/blender/editors/interface/resources.c
source/blender/editors/physics/physics_fluid.c
source/blender/editors/screen/area.c
source/blender/editors/space_image/space_image.c
source/blender/editors/space_text/text_draw.c
source/blender/editors/space_text/text_ops.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_view.c
source/blender/makesdna/DNA_curve_types.h
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesrna/intern/rna_action.c
source/blender/makesrna/intern/rna_context.c
source/blender/makesrna/intern/rna_curve.c
source/blender/makesrna/intern/rna_modifier.c
source/blender/makesrna/intern/rna_ui.c
source/blender/makesrna/intern/rna_userdef.c
source/blender/makesrna/intern/rna_wm_api.c
source/blender/modifiers/intern/MOD_screw.c
source/blender/python/doc/sphinx_doc_gen.py
source/blender/python/intern/bpy_rna.c
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/texture.c
source/blender/windowmanager/intern/wm_draw.c
source/gameengine/Ketsji/KX_PythonInit.cpp

index d3948511ce3f711440cefb28603f6fbea35afcab..d8da2189e6d07510fcbdac7d67cddcae760bbbde 100644 (file)
@@ -161,7 +161,11 @@ ifndef CONFIG_GUESS
   export WITH_TIFF ?= true
 
   #enable raytracing optimization (currently only for i386 and x86_64)
-  export WITH_BF_RAYOPTIMIZATION ?= true
+  ifeq ($(CPU),powerpc)
+    export WITH_BF_RAYOPTIMIZATION ?= false
+  else
+    export WITH_BF_RAYOPTIMIZATION ?= true
+  endif
 
   export WITH_LCMS ?= false
   export WITH_CINEON ?= true
index 22b842b29051299a7655e2e486e3abecb523bc63..702edc6ae70bad8c8c0b45beb7fb4808fbc4d81b 100644 (file)
@@ -922,7 +922,7 @@ def make_kf_obj_node(obj, name_to_id):
 """
 
 # import BPyMessages
-def save_3ds(filename, context):
+def write(filename, context):
     '''Save the Blender scene to a 3ds file.'''
     # Time the export
 
@@ -1107,12 +1107,7 @@ def save_3ds(filename, context):
     #primary.dump()
 
 
-# if __name__=='__main__':
-#     if struct:
-#         Blender.Window.FileSelector(save_3ds, "Export 3DS", Blender.sys.makename(ext='.3ds'))
-#     else:
-#         Blender.Draw.PupMenu("Error%t|This script requires a full python installation")
-# # save_3ds('/test_b.3ds')
+# # write('/test_b.3ds')
 from bpy.props import *
 class Export3DS(bpy.types.Operator):
     '''Export to 3DS file format (.3ds)'''
@@ -1127,7 +1122,10 @@ class Export3DS(bpy.types.Operator):
     check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'})
 
     def execute(self, context):
-        save_3ds(self.properties.filepath, context)
+        filepath = self.properties.filepath
+        filepath = bpy.path.ensure_ext(filepath, ".3ds")
+
+        write(filepath, context)
         return {'FINISHED'}
 
     def invoke(self, context, event):
@@ -1135,7 +1133,8 @@ class Export3DS(bpy.types.Operator):
         wm.add_fileselect(self)
         return {'RUNNING_MODAL'}
 
-    def poll(self, context): # Poll isnt working yet
+    @staticmethod
+    def poll(context): # Poll isnt working yet
         return context.active_object != None
 
 # Add to a menu
index 8d28500dba524ee2721333c784f359440e10bc26..14116058f4485e6b7f99d51c41dfa47128a535be 100644 (file)
@@ -75,7 +75,7 @@ def copy_images(dest_dir, textures):
 
     image_paths = set()
     for tex in textures:
-        image_paths.add(bpy.utils.expandpath(tex.filepath))
+        image_paths.add(bpy.path.abspath(tex.filepath))
 
     # Now copy images
     copyCount = 0
@@ -176,7 +176,7 @@ def sane_name(data, dct):
         name = 'unnamed' # blank string, ASKING FOR TROUBLE!
     else:
 
-        name = bpy.utils.clean_name(name) # use our own
+        name = bpy.path.clean_name(name) # use our own
 
     while name in iter(dct.values()):  name = increment_string(name)
 
@@ -200,14 +200,14 @@ def sane_groupname(data): return sane_name(data, sane_name_mapping_group)
 #      FORCE_CWD - dont use the basepath, just add a ./ to the filename.
 #              use when we know the file will be in the basepath.
 #      '''
-#      fname = bpy.utils.expandpath(fname_orig)
+#      fname = bpy.path.abspath(fname_orig)
 # #    fname = Blender.sys.expandpath(fname_orig)
 #      fname_strip = os.path.basename(fname)
 # #    fname_strip = strip_path(fname)
 #      if FORCE_CWD:
 #              fname_rel = '.' + os.sep + fname_strip
 #      else:
-#              fname_rel = bpy.utils.relpath(fname, basepath)
+#              fname_rel = bpy.path.relpath(fname, basepath)
 # #            fname_rel = Blender.sys.relpath(fname, basepath)
 #      if fname_rel.startswith('//'): fname_rel = '.' + os.sep + fname_rel[2:]
 #      return fname, fname_strip, fname_rel
@@ -354,8 +354,8 @@ def write(filename, batch_objects = None, \
 
         new_fbxpath = fbxpath # own dir option modifies, we need to keep an original
         for data in data_seq: # scene or group
-            newname = BATCH_FILE_PREFIX + bpy.utils.clean_name(data.name)
-#                      newname = BATCH_FILE_PREFIX + BPySys.bpy.utils.clean_name(data.name)
+            newname = BATCH_FILE_PREFIX + bpy.path.clean_name(data.name)
+#                      newname = BATCH_FILE_PREFIX + BPySys.bpy.path.clean_name(data.name)
 
 
             if BATCH_OWN_DIR:
@@ -1250,7 +1250,7 @@ def write(filename, batch_objects = None, \
         file.write('\n\t}')
 
     def copy_image(image):
-        fn = bpy.utils.expandpath(image.filepath)
+        fn = bpy.path.abspath(image.filepath)
         fn_strip = os.path.basename(fn)
 
         if EXP_IMAGE_COPY:
@@ -3361,20 +3361,24 @@ class ExportFBX(bpy.types.Operator):
     BATCH_FILE_PREFIX = StringProperty(name="Prefix", description="Prefix each file with this name", maxlen=1024, default="")
 
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return context.active_object
 
     def execute(self, context):
         if not self.properties.filepath:
             raise Exception("filepath not set")
 
+        filepath = self.properties.filepath
+        filepath = bpy.path.ensure_ext(filepath, ".fbx")
+
         GLOBAL_MATRIX = mtx4_identity
         GLOBAL_MATRIX[0][0] = GLOBAL_MATRIX[1][1] = GLOBAL_MATRIX[2][2] = self.properties.TX_SCALE
         if self.properties.TX_XROT90: GLOBAL_MATRIX = mtx4_x90n * GLOBAL_MATRIX
         if self.properties.TX_YROT90: GLOBAL_MATRIX = mtx4_y90n * GLOBAL_MATRIX
         if self.properties.TX_ZROT90: GLOBAL_MATRIX = mtx4_z90n * GLOBAL_MATRIX
 
-        write(self.properties.filepath,
+        write(filepath,
               None, # XXX
               context,
               self.properties.EXP_OBS_SELECTED,
@@ -3394,7 +3398,8 @@ class ExportFBX(bpy.types.Operator):
               self.properties.BATCH_ENABLE,
               self.properties.BATCH_GROUP,
               self.properties.BATCH_FILE_PREFIX,
-              self.properties.BATCH_OWN_DIR)
+              self.properties.BATCH_OWN_DIR,
+              )
 
         return {'FINISHED'}
 
@@ -3412,7 +3417,7 @@ class ExportFBX(bpy.types.Operator):
 
 # NOTES (all line numbers correspond to original export_fbx.py (under release/scripts)
 # - Draw.PupMenu alternative in 2.5?, temporarily replaced PupMenu with print
-# - get rid of bpy.utils.clean_name somehow
+# - get rid of bpy.path.clean_name somehow
 # + fixed: isinstance(inst, bpy.types.*) doesn't work on RNA objects: line 565
 # + get rid of BPyObject_getObjectArmature, move it in RNA?
 # - BATCH_ENABLE and BATCH_GROUP options: line 327
@@ -3427,7 +3432,7 @@ class ExportFBX(bpy.types.Operator):
 # - bpy.data.remove_scene: line 366
 # - bpy.sys.time move to bpy.sys.util?
 # - new scene creation, activation: lines 327-342, 368
-# - uses bpy.utils.expandpath, *.relpath - replace at least relpath
+# - uses bpy.path.abspath, *.relpath - replace at least relpath
 
 # SMALL or COSMETICAL
 # - find a way to get blender version, and put it in bpy.util?, old was Blender.Get('version')
index 5cbda8a76b796268e0c2cb721c4edc7cc8cbfdc9..46b38c3c9e6c2a567541decf43725ed50d7b115c 100644 (file)
@@ -165,15 +165,23 @@ class ExportMDD(bpy.types.Operator):
     frame_start = IntProperty(name="Start Frame", description="Start frame for baking", min=minframe, max=maxframe, default=1)
     frame_end = IntProperty(name="End Frame", description="End frame for baking", min=minframe, max=maxframe, default=250)
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         ob = context.active_object
         return (ob and ob.type == 'MESH')
 
     def execute(self, context):
-        if not self.properties.filepath:
-            raise Exception("filename not set")
-        write(self.properties.filepath, context.scene, context.active_object,
-            self.properties.frame_start, self.properties.frame_end, self.properties.fps)
+        filepath = self.properties.filepath
+        filepath = bpy.path.ensure_ext(filepath, ".mdd")
+        
+        write(filepath,
+              context.scene,
+              context.active_object,
+              self.properties.frame_start,
+              self.properties.frame_end,
+              self.properties.fps,
+              )
+
         return {'FINISHED'}
 
     def invoke(self, context, event):
index 439d094b74b9d2e6dd18efe4a3265ca73ad40eef..fa378d26878e3c0d88f68bd4c97901bae203cce8 100644 (file)
@@ -66,7 +66,7 @@ def write_mtl(scene, filepath, copy_images, mtl_dict):
     dest_dir = os.path.dirname(filepath)
 
     def copy_image(image):
-        fn = bpy.utils.expandpath(image.filepath)
+        fn = bpy.path.abspath(image.filepath)
         fn_strip = os.path.basename(fn)
         if copy_images:
             rel = fn_strip
@@ -182,7 +182,7 @@ def copy_images(dest_dir):
     copyCount = 0
 
 #      for bImage in uniqueImages.values():
-#              image_path = bpy.utils.expandpath(bImage.filepath)
+#              image_path = bpy.path.abspath(bImage.filepath)
 #              if bpy.sys.exists(image_path):
 #                      # Make a name for the target path.
 #                      dest_image_path = dest_dir + image_path.split('\\')[-1].split('/')[-1]
@@ -790,7 +790,7 @@ def write(filepath, objects, scene,
     print("OBJ Export time: %.2f" % (time.clock() - time1))
 #      print "OBJ Export time: %.2f" % (sys.time() - time1)
 
-def do_export(filepath, context,
+def write(filepath, context,
               EXPORT_APPLY_MODIFIERS = True, # not used
               EXPORT_ROTX90 = True, # wrong
               EXPORT_TRI = False, # ok
@@ -837,7 +837,7 @@ def do_export(filepath, context,
         orig_frame = scn.frame_current
 
         if EXPORT_ALL_SCENES: # Add scene name into the context_name
-            context_name[1] = '_%s' % bpy.utils.clean_name(scn.name) # WARNING, its possible that this could cause a collision. we could fix if were feeling parranoied.
+            context_name[1] = '_%s' % bpy.path.clean_name(scn.name) # WARNING, its possible that this could cause a collision. we could fix if were feeling parranoied.
 
         # Export an animation?
         if EXPORT_ANIMATION:
@@ -927,27 +927,27 @@ class ExportOBJ(bpy.types.Operator):
     def execute(self, context):
 
         filepath = self.properties.filepath
-        if not filepath.lower().endswith(".obj"):
-            filepath += ".obj"
-
-        do_export(filepath, context,
-                  EXPORT_TRI=self.properties.use_triangles,
-                  EXPORT_EDGES=self.properties.use_edges,
-                  EXPORT_NORMALS=self.properties.use_normals,
-                  EXPORT_NORMALS_HQ=self.properties.use_hq_normals,
-                  EXPORT_UV=self.properties.use_uvs,
-                  EXPORT_MTL=self.properties.use_materials,
-                  EXPORT_COPY_IMAGES=self.properties.copy_images,
-                  EXPORT_APPLY_MODIFIERS=self.properties.use_modifiers,
-                  EXPORT_ROTX90=self.properties.use_rotate90,
-                  EXPORT_BLEN_OBS=self.properties.use_blen_objects,
-                  EXPORT_GROUP_BY_OB=self.properties.group_by_object,
-                  EXPORT_GROUP_BY_MAT=self.properties.group_by_material,
-                  EXPORT_KEEP_VERT_ORDER=self.properties.keep_vertex_order,
-                  EXPORT_POLYGROUPS=self.properties.use_vertex_groups,
-                  EXPORT_CURVE_AS_NURBS=self.properties.use_nurbs,
-                  EXPORT_SEL_ONLY=self.properties.use_selection,
-                  EXPORT_ALL_SCENES=self.properties.use_all_scenes)
+        filepath = bpy.path.ensure_ext(filepath, ".obj")
+
+        write(filepath, context,
+              EXPORT_TRI=self.properties.use_triangles,
+              EXPORT_EDGES=self.properties.use_edges,
+              EXPORT_NORMALS=self.properties.use_normals,
+              EXPORT_NORMALS_HQ=self.properties.use_hq_normals,
+              EXPORT_UV=self.properties.use_uvs,
+              EXPORT_MTL=self.properties.use_materials,
+              EXPORT_COPY_IMAGES=self.properties.copy_images,
+              EXPORT_APPLY_MODIFIERS=self.properties.use_modifiers,
+              EXPORT_ROTX90=self.properties.use_rotate90,
+              EXPORT_BLEN_OBS=self.properties.use_blen_objects,
+              EXPORT_GROUP_BY_OB=self.properties.group_by_object,
+              EXPORT_GROUP_BY_MAT=self.properties.group_by_material,
+              EXPORT_KEEP_VERT_ORDER=self.properties.keep_vertex_order,
+              EXPORT_POLYGROUPS=self.properties.use_vertex_groups,
+              EXPORT_CURVE_AS_NURBS=self.properties.use_nurbs,
+              EXPORT_SEL_ONLY=self.properties.use_selection,
+              EXPORT_ALL_SCENES=self.properties.use_all_scenes,
+              )
 
         return {'FINISHED'}
 
index 03529c4023c212d70d36017ebeb2032a39ec3ec2..aacfa6d07b2e96fc306423fa9cc265104c549c09 100644 (file)
@@ -275,16 +275,15 @@ class ExportPLY(bpy.types.Operator):
     use_uvs = BoolProperty(name="UVs", description="Exort the active UV layer", default=True)
     use_colors = BoolProperty(name="Vertex Colors", description="Exort the active vertex color layer", default=True)
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return context.active_object != None
 
     def execute(self, context):
-        # print("Selected: " + context.active_object.name)
+        filepath = self.properties.filepath
+        filepath = bpy.path.ensure_ext(filepath, ".ply")
 
-        if not self.properties.filepath:
-            raise Exception("filename not set")
-
-        write(self.properties.filepath, context.scene, context.active_object,\
+        write(filepath, context.scene, context.active_object,\
             EXPORT_APPLY_MODIFIERS=self.properties.use_modifiers,
             EXPORT_NORMALS=self.properties.use_normals,
             EXPORT_UV=self.properties.use_uvs,
index b2f2647fc3aa9ef9111a172e68a94a7aac63b60d..5fe48a2550a45373ddadeb8908cefc43d3f5677b 100644 (file)
@@ -794,7 +794,7 @@ class x3d_class:
             pic = tex.image
 
             # using .expandpath just in case, os.path may not expect //
-            basename = os.path.basename(bpy.utils.expandpath(pic.filepath))
+            basename = os.path.basename(bpy.path.abspath(pic.filepath))
 
             pic = alltextures[i].image
             # pic = alltextures[i].getImage()
@@ -1140,7 +1140,7 @@ class x3d_class:
 # Callbacks, needed before Main
 ##########################################################
 
-def x3d_export(filename,
+def write(filename,
                context,
                EXPORT_APPLY_MODIFIERS=False,
                EXPORT_TRI=False,
@@ -1175,47 +1175,6 @@ def x3d_export(filename,
         )
 
 
-def x3d_export_ui(filename):
-    if not filename.endswith(extension):
-        filename += extension
-    #if _safeOverwrite and sys.exists(filename):
-    #  result = Draw.PupMenu("File Already Exists, Overwrite?%t|Yes%x1|No%x0")
-    #if(result != 1):
-    #  return
-
-    # Get user options
-    EXPORT_APPLY_MODIFIERS = Draw.Create(1)
-    EXPORT_TRI = Draw.Create(0)
-    EXPORT_GZIP = Draw.Create( filename.lower().endswith('.x3dz') )
-
-    # Get USER Options
-    pup_block = [\
-    ('Apply Modifiers', EXPORT_APPLY_MODIFIERS, 'Use transformed mesh data from each object.'),\
-    ('Triangulate', EXPORT_TRI, 'Triangulate quads.'),\
-    ('Compress', EXPORT_GZIP, 'GZip the resulting file, requires a full python install'),\
-    ]
-
-    if not Draw.PupBlock('Export...', pup_block):
-        return
-
-    Blender.Window.EditMode(0)
-    Blender.Window.WaitCursor(1)
-
-    x3d_export(filename,\
-        EXPORT_APPLY_MODIFIERS = EXPORT_APPLY_MODIFIERS.val,\
-        EXPORT_TRI = EXPORT_TRI.val,\
-        EXPORT_GZIP = EXPORT_GZIP.val\
-    )
-
-    Blender.Window.WaitCursor(0)
-
-
-
-#########################################################
-# main routine
-#########################################################
-
-
 from bpy.props import *
 
 class ExportX3D(bpy.types.Operator):
@@ -1233,7 +1192,16 @@ class ExportX3D(bpy.types.Operator):
     compress = BoolProperty(name="Compress", description="GZip the resulting file, requires a full python install", default=False)
 
     def execute(self, context):
-        x3d_export(self.properties.filepath, context, self.properties.apply_modifiers, self.properties.triangulate, self.properties.compress)
+        filepath = self.properties.filepath
+        filepath = bpy.path.ensure_ext(filepath, ".x3d")
+
+        write(filepath,
+                   context,
+                   self.properties.apply_modifiers,
+                   self.properties.triangulate,
+                   self.properties.compress,
+                   )
+
         return {'FINISHED'}
 
     def invoke(self, context, event):
index 16fed1798c459aa7fd982418fa4977c577dd7298..3245decc806f045763ce8b022925814c7ba7cb88 100644 (file)
@@ -120,7 +120,8 @@ class importMDD(bpy.types.Operator):
     #fps = IntProperty(name="Frames Per Second", description="Number of frames/second", min=minfps, max=maxfps, default=25)
     frame_start = IntProperty(name="Start Frame", description="Start frame for inserting animation", min=minframe, max=maxframe, default=0)
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         ob = context.active_object
         return (ob and ob.type == 'MESH')
 
index e9479f92ea8b2e7b999872eba477597a21c21f25..4a116bb982a478a658deed5f1f36075d1c8effe7 100644 (file)
@@ -49,7 +49,7 @@ def addPointCache(job, ob, point_cache, default_path):
     if name == "":
         name = "".join(["%02X" % ord(c) for c in ob.name])
 
-    cache_path = bpy.utils.expandpath(point_cache.filepath) if point_cache.external else default_path
+    cache_path = bpy.path.abspath(point_cache.filepath) if point_cache.external else default_path
 
     index = "%02i" % point_cache.index
 
@@ -113,7 +113,7 @@ def clientSendJob(conn, scene, anim = False):
     # LIBRARIES
     ###########################
     for lib in bpy.data.libraries:
-        file_path = bpy.utils.expandpath(lib.filepath)
+        file_path = bpy.path.abspath(lib.filepath)
         if os.path.exists(file_path):
             job.addFile(file_path)
 
@@ -122,7 +122,7 @@ def clientSendJob(conn, scene, anim = False):
     ###########################
     for image in bpy.data.images:
         if image.source == "FILE" and not image.packed_file:
-            file_path = bpy.utils.expandpath(image.filepath)
+            file_path = bpy.path.abspath(image.filepath)
             if os.path.exists(file_path):
                 job.addFile(file_path)
                 
@@ -139,7 +139,7 @@ def clientSendJob(conn, scene, anim = False):
     for object in bpy.data.objects:
         for modifier in object.modifiers:
             if modifier.type == 'FLUID_SIMULATION' and modifier.settings.type == "DOMAIN":
-                addFluidFiles(job, bpy.utils.expandpath(modifier.settings.path))
+                addFluidFiles(job, bpy.path.abspath(modifier.settings.path))
             elif modifier.type == "CLOTH":
                 addPointCache(job, object, modifier.point_cache, default_path)
             elif modifier.type == "SOFT_BODY":
@@ -149,7 +149,7 @@ def clientSendJob(conn, scene, anim = False):
                 if modifier.domain_settings.highres:
                     addPointCache(job, object, modifier.domain_settings.point_cache_high, default_path)
             elif modifier.type == "MULTIRES" and modifier.external:
-                file_path = bpy.utils.expandpath(modifier.filepath)
+                file_path = bpy.path.abspath(modifier.filepath)
                 job.addFile(file_path)
 
         # particles modifier are stupid and don't contain data
index 4530491dae1603db6a8fc4ad4f373833404c4b40..35f356e0a6519096c0bc782d6c30893484e6cd54 100644 (file)
@@ -31,7 +31,8 @@ class RENDER_OT_netslave_bake(bpy.types.Operator):
     bl_idname = "render.netslavebake"
     bl_label = "Bake all in file"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return True
 
     def execute(self, context):
@@ -88,7 +89,8 @@ class RENDER_OT_netclientanim(bpy.types.Operator):
     bl_idname = "render.netclientanim"
     bl_label = "Animation on network"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return True
 
     def execute(self, context):
@@ -114,7 +116,8 @@ class RENDER_OT_netclientrun(bpy.types.Operator):
     bl_idname = "render.netclientstart"
     bl_label = "Start Service"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return True
 
     def execute(self, context):
@@ -130,7 +133,8 @@ class RENDER_OT_netclientsend(bpy.types.Operator):
     bl_idname = "render.netclientsend"
     bl_label = "Send job"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return True
 
     def execute(self, context):
@@ -159,7 +163,8 @@ class RENDER_OT_netclientsendframe(bpy.types.Operator):
     bl_idname = "render.netclientsendframe"
     bl_label = "Send current frame job"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return True
 
     def execute(self, context):
@@ -188,7 +193,8 @@ class RENDER_OT_netclientstatus(bpy.types.Operator):
     bl_idname = "render.netclientstatus"
     bl_label = "Client Status"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return True
 
     def execute(self, context):
@@ -227,7 +233,8 @@ class RENDER_OT_netclientblacklistslave(bpy.types.Operator):
     bl_idname = "render.netclientblacklistslave"
     bl_label = "Client Blacklist Slave"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return True
 
     def execute(self, context):
@@ -256,7 +263,8 @@ class RENDER_OT_netclientwhitelistslave(bpy.types.Operator):
     bl_idname = "render.netclientwhitelistslave"
     bl_label = "Client Whitelist Slave"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return True
 
     def execute(self, context):
@@ -286,7 +294,8 @@ class RENDER_OT_netclientslaves(bpy.types.Operator):
     bl_idname = "render.netclientslaves"
     bl_label = "Client Slaves"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return True
 
     def execute(self, context):
@@ -330,7 +339,8 @@ class RENDER_OT_netclientcancel(bpy.types.Operator):
     bl_idname = "render.netclientcancel"
     bl_label = "Client Cancel"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         netsettings = context.scene.network_render
         return netsettings.active_job_index >= 0 and len(netsettings.jobs) > 0
 
@@ -358,7 +368,8 @@ class RENDER_OT_netclientcancelall(bpy.types.Operator):
     bl_idname = "render.netclientcancelall"
     bl_label = "Client Cancel All"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return True
 
     def execute(self, context):
@@ -384,7 +395,8 @@ class netclientdownload(bpy.types.Operator):
     bl_idname = "render.netclientdownload"
     bl_label = "Client Download"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         netsettings = context.scene.network_render
         return netsettings.active_job_index >= 0 and len(netsettings.jobs) > 0
 
@@ -428,7 +440,8 @@ class netclientscan(bpy.types.Operator):
     bl_idname = "render.netclientscan"
     bl_label = "Client Scan"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return True
 
     def execute(self, context):
@@ -450,7 +463,8 @@ class netclientweb(bpy.types.Operator):
     bl_idname = "render.netclientweb"
     bl_label = "Open Master Monitor"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         netsettings = context.scene.network_render
         return netsettings.server_address != "[default]"
 
index d9a13ade987797707595e1f9dbaa72c8c1761327..9243505bd3b4cb31abfc70f9e724a45375ed20b7 100644 (file)
@@ -92,7 +92,7 @@ def process(paths):
     # LIBRARIES
     ###########################
     for lib in bpy.data.libraries:
-        file_path = bpy.utils.expandpath(lib.filepath)
+        file_path = bpy.path.abspath(lib.filepath)
         new_path = path_map.get(os.path.split(file_path)[1], None)
         if new_path:
             lib.filepath = new_path
@@ -102,7 +102,7 @@ def process(paths):
     ###########################
     for image in bpy.data.images:
         if image.source == "FILE" and not image.packed_file:
-            file_path = bpy.utils.expandpath(image.filepath)
+            file_path = bpy.path.abspath(image.filepath)
             new_path = path_map.get(os.path.split(file_path)[1], None)
             if new_path:
                 image.filepath = new_path
@@ -124,7 +124,7 @@ def process(paths):
                 if modifier.domain_settings.highres:
                     processPointCache(modifier.domain_settings.point_cache_high)
             elif modifier.type == "MULTIRES" and modifier.external:
-                file_path = bpy.utils.expandpath(modifier.filepath)
+                file_path = bpy.path.abspath(modifier.filepath)
                 new_path = path_map.get(file_path, None)
                 if new_path:
                     modifier.filepath = new_path
index 594ebcd12dbd1d329d1013e982a51de9b3a0706a..d5269803ffda1753f5f85fd000169bc2dc518a83 100644 (file)
@@ -36,6 +36,11 @@ DISPATCHED = 1
 DONE = 2
 ERROR = 3
 
+def base_poll(cls, context):
+    rd = context.scene.render
+    return (rd.use_game_engine==False) and (rd.engine in cls.COMPAT_ENGINES)
+    
+
 def init_file():
     if netrender.init_file != bpy.data.filepath:
         netrender.init_file = bpy.data.filepath
@@ -82,15 +87,16 @@ class RenderButtonsPanel():
     bl_context = "render"
     # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
 
-    def poll(self, context):
-        rd = context.scene.render
-        return (rd.use_game_engine==False) and (rd.engine in self.COMPAT_ENGINES)
 
 # Setting panel, use in the scene for now.
 class RENDER_PT_network_settings(bpy.types.Panel, RenderButtonsPanel):
     bl_label = "Network Settings"
     COMPAT_ENGINES = {'NET_RENDER'}
 
+    @staticmethod
+    def poll(context):
+        return base_poll(__class__, context)
+
     def draw(self, context):
         layout = self.layout
 
@@ -125,10 +131,10 @@ class RENDER_PT_network_slave_settings(bpy.types.Panel, RenderButtonsPanel):
     bl_label = "Slave Settings"
     COMPAT_ENGINES = {'NET_RENDER'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         scene = context.scene
-        return (super().poll(context)
-                and scene.network_render.mode == "RENDER_SLAVE")
+        return base_poll(__class__, context) and scene.network_render.mode == "RENDER_SLAVE"
 
     def draw(self, context):
         layout = self.layout
@@ -150,10 +156,10 @@ class RENDER_PT_network_master_settings(bpy.types.Panel, RenderButtonsPanel):
     bl_label = "Master Settings"
     COMPAT_ENGINES = {'NET_RENDER'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         scene = context.scene
-        return (super().poll(context)
-                and scene.network_render.mode == "RENDER_MASTER")
+        return base_poll(__class__, context) and scene.network_render.mode == "RENDER_MASTER"
 
     def draw(self, context):
         layout = self.layout
@@ -168,10 +174,10 @@ class RENDER_PT_network_job(bpy.types.Panel, RenderButtonsPanel):
     bl_label = "Job Settings"
     COMPAT_ENGINES = {'NET_RENDER'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         scene = context.scene
-        return (super().poll(context)
-                and scene.network_render.mode == "RENDER_CLIENT")
+        return base_poll(__class__, context) and scene.network_render.mode == "RENDER_CLIENT"
 
     def draw(self, context):
         layout = self.layout
@@ -208,14 +214,14 @@ class RENDER_PT_network_slaves(bpy.types.Panel, RenderButtonsPanel):
     bl_label = "Slaves Status"
     COMPAT_ENGINES = {'NET_RENDER'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         scene = context.scene
         netsettings = scene.network_render
         if netsettings.mode != "RENDER_CLIENT":
             return False
         verify_address(netsettings)
-        return (super().poll(context)
-                and netsettings.server_address != "[default]")
+        return base_poll(__class__, context) and netsettings.server_address != "[default]"
 
     def draw(self, context):
         layout = self.layout
@@ -246,14 +252,14 @@ class RENDER_PT_network_slaves_blacklist(bpy.types.Panel, RenderButtonsPanel):
     bl_label = "Slaves Blacklist"
     COMPAT_ENGINES = {'NET_RENDER'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         scene = context.scene
         netsettings = scene.network_render
         if netsettings.mode != "RENDER_CLIENT":
             return False
         verify_address(netsettings)
-        return (super().poll(context)
-                and netsettings.server_address != "[default]")
+        return base_poll(__class__, context) and netsettings.server_address != "[default]"
 
     def draw(self, context):
         layout = self.layout
@@ -283,14 +289,14 @@ class RENDER_PT_network_jobs(bpy.types.Panel, RenderButtonsPanel):
     bl_label = "Jobs"
     COMPAT_ENGINES = {'NET_RENDER'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         scene = context.scene
         netsettings = scene.network_render
         if netsettings.mode != "RENDER_CLIENT":
             return False
         verify_address(netsettings)
-        return (super().poll(context)
-                and netsettings.server_address != "[default]")
+        return base_poll(__class__, context) and netsettings.server_address != "[default]"
 
     def draw(self, context):
         layout = self.layout
index 1e6db441599a461d58e5dcee84457767a8ac586b..3431054413eb07b9160e7169381c6555ae751d7a 100644 (file)
@@ -26,7 +26,7 @@ data = _bpy.data
 context = _bpy.context
 
 # python modules
-from bpy import utils
+from bpy import utils, path
 
 from bpy import ops as _ops_module
 
diff --git a/release/scripts/modules/bpy/path.py b/release/scripts/modules/bpy/path.py
new file mode 100644 (file)
index 0000000..2974615
--- /dev/null
@@ -0,0 +1,174 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+"""
+This module has a similar scope to os.path, containing utility
+functions for dealing with paths in Blender.
+"""
+
+import bpy as _bpy
+import os as _os
+
+def expand(path):
+    """
+    Returns the absolute path relative to the current blend file using the "//" prefix.
+    """
+    if path.startswith("//"):
+        return _os.path.join(_os.path.dirname(_bpy.data.filepath), path[2:])
+
+    return path
+
+
+def relpath(path, start=None):
+    """
+    Returns the path relative to the current blend file using the "//" prefix.
+
+    :arg start: Relative to this path, when not set the current filename is used.
+    :type start: string
+    """
+    if not path.startswith("//"):
+        if start is None:
+            start = _os.path.dirname(_bpy.data.filepath)
+        return "//" + _os.path.relpath(path, start)
+
+    return path
+
+
+def clean_name(name, replace="_"):
+    """
+    Returns a name with characters replaced that may cause problems under various circumstances, such as writing to a file.
+    All characters besides A-Z/a-z, 0-9 are replaced with "_"
+    or the replace argument if defined.
+    """
+
+    unclean_chars = \
+                 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\
+                  \x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\
+                  \x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\
+                  \x2e\x2f\x3a\x3b\x3c\x3d\x3e\x3f\x40\x5b\x5c\x5d\x5e\x60\x7b\
+                  \x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\
+                  \x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\
+                  \x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\
+                  \xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\
+                  \xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\
+                  \xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\
+                  \xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\
+                  \xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\
+                  \xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe"
+
+    for ch in unclean_chars:
+        name = name.replace(ch, replace)
+    return name
+
+
+def display_name(name):
+    """
+    Creates a display string from name to be used menus and the user interface.
+    Capitalize the first letter in all lowercase names, mixed case names are kept as is.
+    Intended for use with filenames and module names.
+    """
+
+    name_base = _os.path.splitext(name)[0]
+
+    # string replacements
+    name_base = name_base.replace("_colon_", ":")
+
+    name_base = name_base.replace("_", " ")
+
+    if name_base.islower():
+        return name_base.capitalize()
+    else:
+        return name_base
+
+
+def resolve_ncase(path):
+       """
+       Resolve a case insensitive path on a case sensitive system,
+       returning a string with the path if found else return the original path.
+       """
+
+       import os
+
+       def _ncase_path_found(path):
+               if path=='' or os.path.exists(path):
+                       return path, True
+
+               filename = os.path.basename(path) # filename may be a directory or a file
+               dirpath = os.path.dirname(path)
+
+               suffix = ""
+               if not filename: # dir ends with a slash?
+                       if len(dirpath) < len(path):
+                               suffix = path[:len(path)-len(dirpath)]
+
+                       filename = os.path.basename(dirpath)
+                       dirpath = os.path.dirname(dirpath)
+
+               if not os.path.exists(dirpath):
+                       dirpath, found = _ncase_path_found(dirpath)
+
+                       if not found:
+                               return path, False
+
+               # at this point, the directory exists but not the file
+
+               # we are expecting 'dirpath' to be a directory, but it could be a file
+               if os.path.isdir(dirpath):
+                       files = os.listdir(dirpath)
+               else:
+                       return path, False
+
+               filename_low = filename.lower()
+               f_iter_nocase = None
+
+               for f_iter in files:
+                       if f_iter.lower() == filename_low:
+                               f_iter_nocase = f_iter
+                               break
+
+               if f_iter_nocase:
+                       return os.path.join(dirpath, f_iter_nocase) + suffix, True
+               else:
+                       # cant find the right one, just return the path as is.
+                       return path, False
+
+       ncase_path, found = _ncase_path_found(path)
+       return ncase_path if found else path
+
+
+def ensure_ext(filepath, ext, case_sensitive=False):
+    """
+    Return the path with the extension added its its not alredy set.
+
+    :arg ext: The extension to check for.
+    :type ext: string
+    :arg case_sensitive: Check for matching case when comparing extensions.
+    :type case_sensitive: bool
+    """
+    import os
+    fn_base, fn_ext = os.path.splitext(filepath)
+    if fn_base and fn_ext:
+        if (case_sensitive and ext == fn_ext) or (ext.lower() == fn_ext.lower()):
+            return filepath
+        else:
+            return fn_base + ext
+
+    else:
+        return filepath + ext
index 3f3eab2ac2a8cfcaf61b283a650f7220012c6290..6c1c669d1f2d845fb30496d18bcbd427c0754230 100644 (file)
@@ -216,75 +216,6 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
     _bpy_types._register_immediate = True
 
 
-def expandpath(path):
-    """
-    Returns the absolute path relative to the current blend file using the "//" prefix.
-    """
-    if path.startswith("//"):
-        return _os.path.join(_os.path.dirname(_bpy.data.filepath), path[2:])
-
-    return path
-
-
-def relpath(path, start=None):
-    """
-    Returns the path relative to the current blend file using the "//" prefix.
-
-    :arg start: Relative to this path, when not set the current filename is used.
-    :type start: string
-    """
-    if not path.startswith("//"):
-        if start is None:
-            start = _os.path.dirname(_bpy.data.filepath)
-        return "//" + _os.path.relpath(path, start)
-
-    return path
-
-
-def clean_name(name, replace="_"):
-    """
-    Returns a name with characters replaced that may cause problems under various circumstances, such as writing to a file.
-    All characters besides A-Z/a-z, 0-9 are replaced with "_"
-    or the replace argument if defined.
-    """
-
-    unclean_chars = \
-                 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\
-                  \x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\
-                  \x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\
-                  \x2e\x2f\x3a\x3b\x3c\x3d\x3e\x3f\x40\x5b\x5c\x5d\x5e\x60\x7b\
-                  \x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\
-                  \x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\
-                  \x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\
-                  \xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\
-                  \xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\
-                  \xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\
-                  \xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\
-                  \xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\
-                  \xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe"
-
-    for ch in unclean_chars:
-        name = name.replace(ch, replace)
-    return name
-
-
-def display_name(name):
-    """
-    Creates a display string from name to be used menus and the user interface.
-    Capitalize the first letter in all lowercase names, mixed case names are kept as is.
-    Intended for use with filenames and module names.
-    """
-    name_base = _os.path.splitext(name)[0]
-
-    # string replacements
-    name_base = name_base.replace("_colon_", ":")
-
-    name_base = name_base.replace("_", " ")
-
-    if name_base.islower():
-        return name_base.capitalize()
-    else:
-        return name_base
 
 
 # base scripts
index c5f7ee150c937aea10d646e11fb6dc7d7cc1d404..0cd0aaaa3f049c43ffdaa1dd787c2c8456fc85f0 100644 (file)
@@ -718,7 +718,7 @@ class Menu(StructRNA, _GenericUI, metaclass=RNAMeta):
             if f.startswith("."):
                 continue
 
-            preset_name = bpy.utils.display_name(f)
+            preset_name = bpy.path.display_name(f)
             props = layout.operator(operator, text=preset_name)
 
             for attr, value in props_default.items():
index 095229016e91898b1d5c09220e2c359ac6947297..f495406e8d84569d3f7c1288f4034ea2dff70d27 100644 (file)
@@ -537,7 +537,7 @@ def generate_test_all(context, GRAPH=False):
         base_name = os.path.splitext(bpy.data.filepath)[0]
         for obj, obj_new in new_objects:
             for obj in (obj, obj_new):
-                fn = base_name + "-" + bpy.utils.clean_name(obj.name)
+                fn = base_name + "-" + bpy.path.clean_name(obj.name)
 
                 path_dot = fn + ".dot"
                 path_png = fn + ".png"
index 11431c52eb66e981f26cb87f5f7150d27850bb4b..cc973d94e2a7331c71de5c3b8082b5849e5bb518 100644 (file)
@@ -48,7 +48,8 @@ class DiscontFilterOp(bpy.types.Operator):
     bl_idname = "graph.euler_filter"
     bl_label = "Filter out discontinuities in the active fcurves"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return context.active_object != None
 
     def execute(self, context):
index 27d9ea64c0c4b44e90b57b6445c0c285d2331dab..c393041d22c1fb32311851de770823f8891416f9 100644 (file)
@@ -58,7 +58,7 @@ class EditExternally(bpy.types.Operator):
     def execute(self, context):
         import os
         import subprocess
-        filepath = bpy.utils.expandpath(self.properties.filepath)
+        filepath = bpy.path.abspath(self.properties.filepath)
 
         if not os.path.exists(filepath):
             self.report('ERROR', "Image path '%s' not found." % filepath)
@@ -93,7 +93,7 @@ class SaveDirty(bpy.types.Operator):
         unique_paths = set()
         for image in bpy.data.images:
             if image.dirty:
-                filepath = bpy.utils.expandpath(image.filepath)
+                filepath = bpy.path.abspath(image.filepath)
                 if "\\" not in filepath and "/" not in filepath:
                     self.report({'WARNING'}, "Invalid path: " + filepath)
                 elif filepath in unique_paths:
@@ -135,7 +135,7 @@ class ProjectEdit(bpy.types.Operator):
 
         filepath = os.path.basename(bpy.data.filepath)
         filepath = os.path.splitext(filepath)[0]
-        # filepath = bpy.utils.clean_name(filepath) # fixes <memory> rubbish, needs checking
+        # filepath = bpy.path.clean_name(filepath) # fixes <memory> rubbish, needs checking
 
         if filepath.startswith(".") or filepath == "":
             # TODO, have a way to check if the file is saved, assume .B25.blend
@@ -147,12 +147,12 @@ class ProjectEdit(bpy.types.Operator):
         obj = context.object
 
         if obj:
-            filepath += "_" + bpy.utils.clean_name(obj.name)
+            filepath += "_" + bpy.path.clean_name(obj.name)
 
         filepath_final = filepath + "." + EXT
         i = 0
 
-        while os.path.exists(bpy.utils.expandpath(filepath_final)):
+        while os.path.exists(bpy.path.abspath(filepath_final)):
             filepath_final = filepath + ("%.3d.%s" % (i, EXT))
             i += 1
 
index ee3e93c58c46f3fd2205d5d4d03d53e545695774..1074ee7b482b15eabb93dbc6e3a3ec7b2cf03f6d 100644 (file)
@@ -28,7 +28,8 @@ class MeshSelectInteriorFaces(bpy.types.Operator):
     bl_label = "Select Interior Faces"
     bl_options = {'REGISTER', 'UNDO'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         ob = context.active_object
         return (ob and ob.type == 'MESH')
 
@@ -69,7 +70,8 @@ class MeshMirrorUV(bpy.types.Operator):
     bl_label = "Copy Mirrored UV coords"
     bl_options = {'REGISTER', 'UNDO'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         ob = context.active_object
         return (ob and ob.type == 'MESH')
 
index 8d9280e43afe0430c1f349910ac931c757267aef..e3ee4e000625238f9514b6dd4d66e59610eeb489 100644 (file)
@@ -80,7 +80,8 @@ class SelectCamera(bpy.types.Operator):
     bl_label = "Select Camera"
     bl_options = {'REGISTER', 'UNDO'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return context.scene.camera is not None
 
     def execute(self, context):
@@ -109,7 +110,8 @@ class SelectHierarchy(bpy.types.Operator):
 
     extend = BoolProperty(name="Extend", description="Extend the existing selection", default=False)
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return context.object
 
     def execute(self, context):
@@ -167,7 +169,8 @@ class SubdivisionSet(bpy.types.Operator):
 
     relative = BoolProperty(name="Relative", description="Apply the subsurf level as an offset relative to the current level", default=False)
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         obs = context.selected_editable_objects
         return (obs is not None)
 
@@ -379,7 +382,8 @@ class ShapeTransfer(bpy.types.Operator):
 
         return {'FINISHED'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         obj = context.active_object
         return (obj and obj.mode != 'EDIT')
 
@@ -409,7 +413,8 @@ class JoinUVs(bpy.types.Operator):
     bl_idname = "object.join_uvs"
     bl_label = "Join as UVs"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         obj = context.active_object
         return (obj and obj.type == 'MESH')
 
@@ -467,7 +472,8 @@ class MakeDupliFace(bpy.types.Operator):
     bl_idname = "object.make_dupli_face"
     bl_label = "Make DupliFace"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         obj = context.active_object
         return (obj and obj.type == 'MESH')
 
index 39b642c1b9f41b664ec96ceb341c77ac192fcf37..d156ccf37c0f202de2c777ffa43d85770c37baf9 100644 (file)
@@ -263,7 +263,8 @@ class AlignObjects(bpy.types.Operator):
     align_z = BoolProperty(name="Align Z",
         description="Align in the Z axis", default=False)
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return context.mode == 'OBJECT'
 
     def execute(self, context):
index 7893ce0ff3eaedab8350069430a51c2ff7eb7c9c..8775a144b2d7295e924f1370baa263218ce52652 100644 (file)
@@ -79,7 +79,7 @@ class PlayRenderedAnim(bpy.types.Operator):
 
         preset = prefs.filepaths.animation_player_preset
         player_path = prefs.filepaths.animation_player
-        file_path = bpy.utils.expandpath(rd.output_path)
+        file_path = bpy.path.abspath(rd.output_path)
         is_movie = rd.is_movie_format
 
         # try and guess a command line if it doesn't exist
@@ -105,7 +105,7 @@ class PlayRenderedAnim(bpy.types.Operator):
             # works for movies and images
             file = rd.frame_path(frame=scene.frame_start)
 
-        file = bpy.utils.expandpath(file) # expand '//'
+        file = bpy.path.abspath(file) # expand '//'
 
         cmd = [player_path]
         # extra options, fps controls etc.
index e01f2dcb23a23779380542aa4316c2922762ef14..63480cae180016185fd6bf974c5f25d3cd1d6086 100644 (file)
@@ -30,7 +30,8 @@ class SequencerCrossfadeSounds(bpy.types.Operator):
     bl_label = "Crossfade sounds"
     bl_options = {'REGISTER', 'UNDO'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         if context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip:
             return context.scene.sequence_editor.active_strip.type == 'SOUND'
         else:
@@ -83,7 +84,8 @@ class SequencerCutMulticam(bpy.types.Operator):
     camera = IntProperty(name="Camera",
             default=1, min=1, max=32, soft_min=1, soft_max=32)
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         if context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip:
             return context.scene.sequence_editor.active_strip.type == 'MULTICAM'
         else:
@@ -117,7 +119,8 @@ class SequencerDeinterlaceSelectedMovies(bpy.types.Operator):
     bl_label = "Deinterlace Movies"
     bl_options = {'REGISTER', 'UNDO'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         if context.scene and context.scene.sequence_editor:
             return True
         else:
index 23e06c968cda3d619f87effdb420c0f9dd22e47b..0d6e1904ff2fb7369d35906374d0c60556a0086f 100644 (file)
@@ -39,7 +39,8 @@ class ExportUVLayout(bpy.types.Operator):
                 description="File format to export the UV layout to",
                 default='SVG')
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         obj = context.active_object
         return (obj and obj.type == 'MESH')
 
@@ -113,7 +114,9 @@ class ExportUVLayout(bpy.types.Operator):
 
         mode = self.properties.mode
 
-        file = open(self.properties.filepath, "w")
+        filepath = self.properties.filepath
+        filepath = bpy.path.ensure_ext(filepath, "." + mode.lower())
+        file = open(filepath, "w")
         fw = file.write
 
         if mode == 'SVG':
index 6f337bd623d48680f8cdaecabfb4559adc68dba6..5aeae37aaf633e8b48209710e9e1ab041ad7eea6 100644 (file)
@@ -249,7 +249,8 @@ class FollowActiveQuads(bpy.types.Operator):
                         description="Method to space UV edge loops",
                         default="LENGTH")
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         obj = context.active_object
         return (obj is not None and obj.type == 'MESH')
 
index 637dccda4ba4217d8e57565f2ae17c0f90da1e07..b52a2c41c2680262963569bd91af881108981342 100644 (file)
@@ -1124,7 +1124,8 @@ class SmartProject(bpy.types.Operator):
             description="Margin to reduce bleed from adjacent islands.",
             default=0.0, min=0.0, max=1.0)
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return context.active_object != None
 
     def execute(self, context):
index a3ae834dbe706f75446366b2ab2cb5bd480c95f4..cc35a0ab3ddb2dcbfa50d5f3687c604272761d81 100644 (file)
@@ -478,7 +478,7 @@ class WM_OT_path_open(bpy.types.Operator):
         import os
         import subprocess
 
-        filepath = bpy.utils.expandpath(self.properties.filepath)
+        filepath = bpy.path.abspath(self.properties.filepath)
         filepath = os.path.normpath(filepath)
 
         if not os.path.exists(filepath):
index 9cb544886da3ad44eb3c2458c6a085b589b3e274..9a875c6899ead0eb8412b6ae6cae9b86f1655f6a 100644 (file)
@@ -23,7 +23,8 @@ class ExportSomeData(bpy.types.Operator):
                         description="Choose between two items",
                         default='OPT_A')
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return context.active_object != None
 
     def execute(self, context):
index e241afd23b797e5162bdd23a7f313bb745da9a51..55afe586a1e832a2293c860f929dbf7c74c3503d 100644 (file)
@@ -9,7 +9,8 @@ class SimpleOperator(bpy.types.Operator):
     bl_idname = "object.simple_operator"
     bl_label = "Simple Object Operator"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return context.active_object != None
 
     def execute(self, context):
index f8c8e369ec8eeb7c66c091e379bbd535c5fd9b54..f27f5300857010004a1070611ced999d3981c0a9 100644 (file)
@@ -30,7 +30,8 @@ class UvOperator(bpy.types.Operator):
     bl_idname = "uv.simple_operator"
     bl_label = "Simple UV Operator"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         obj = context.active_object
         return (obj and obj.type == 'MESH')
 
index e15b7354cee3d0a05e77485f9ebdf0ca5a4aa904..b337485ae101323427e3e7d0bde62b64e7c084d0 100644 (file)
@@ -19,9 +19,7 @@
 # <pep8 compliant>
 import bpy
 
-narrowui = bpy.context.user_preferences.view.properties_width_check
 
-################################################
 # Generic Panels (Independent of DataType)
 
 
@@ -31,15 +29,12 @@ class MotionPathButtonsPanel():
     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():
         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")
@@ -77,12 +71,8 @@ class OnionSkinButtonsPanel():
         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,8 +87,7 @@ class OnionSkinButtonsPanel():
             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")
 
index f32cbe9716525b7be83c7b3a4eea77aff88adf32..2f5ffd0803f10d98d8ec3c0c190d41dae43e70b7 100644 (file)
 import bpy
 from rna_prop_ui import PropertyPanel
 
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
 
 class DataButtonsPanel():
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
     bl_context = "data"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return context.armature
 
 
@@ -42,18 +41,14 @@ class DATA_PT_context_arm(DataButtonsPanel, bpy.types.Panel):
         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, bpy.types.Panel):
@@ -67,12 +62,8 @@ class DATA_PT_skeleton(DataButtonsPanel, bpy.types.Panel):
         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,8 +81,7 @@ class DATA_PT_skeleton(DataButtonsPanel, bpy.types.Panel):
         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")
 
 
@@ -103,12 +93,8 @@ class DATA_PT_display(DataButtonsPanel, bpy.types.Panel):
 
         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,8 +103,7 @@ class DATA_PT_display(DataButtonsPanel, bpy.types.Panel):
         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")
@@ -127,7 +112,8 @@ class DATA_PT_display(DataButtonsPanel, bpy.types.Panel):
 class DATA_PT_bone_groups(DataButtonsPanel, bpy.types.Panel):
     bl_label = "Bone Groups"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return (context.object and context.object.type == 'ARMATURE' and context.object.pose)
 
     def draw(self, context):
@@ -135,7 +121,6 @@ class DATA_PT_bone_groups(DataButtonsPanel, bpy.types.Panel):
 
         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 +142,7 @@ class DATA_PT_bone_groups(DataButtonsPanel, bpy.types.Panel):
             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()
@@ -181,12 +165,8 @@ class DATA_PT_ghost(DataButtonsPanel, 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()
 
@@ -201,8 +181,7 @@ class DATA_PT_ghost(DataButtonsPanel, 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")
 
@@ -211,7 +190,8 @@ class DATA_PT_iksolver_itasc(DataButtonsPanel, bpy.types.Panel):
     bl_label = "iTaSC parameters"
     bl_default_closed = True
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         ob = context.object
         return (ob and ob.pose)
 
@@ -221,7 +201,6 @@ class DATA_PT_iksolver_itasc(DataButtonsPanel, bpy.types.Panel):
         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 +217,7 @@ class DATA_PT_iksolver_itasc(DataButtonsPanel, bpy.types.Panel):
             col = split.column()
             col.prop(itasc, "precision")
 
-            if wide_ui:
-                col = split.column()
+            col = split.column()
             col.prop(itasc, "num_iter")
 
 
@@ -267,7 +245,8 @@ class DATA_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
     #bl_label = "Bones Motion Paths"
     bl_context = "data"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         # XXX: include posemode check?
         return (context.object) and (context.armature)
 
@@ -275,9 +254,8 @@ class DATA_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
         layout = self.layout
 
         ob = context.object
-        wide_ui = context.region.width > narrowui
 
-        self.draw_settings(context, ob.pose.animation_visualisation, wide_ui, bones=True)
+        self.draw_settings(context, ob.pose.animation_visualisation, bones=True)
 
         layout.separator()
 
@@ -286,8 +264,7 @@ class DATA_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
         col = split.column()
         col.operator("pose.paths_calculate", text="Calculate Paths")
 
-        if wide_ui:
-            col = split.column()
+        col = split.column()
         col.operator("pose.paths_clear", text="Clear Paths")
 
 
@@ -295,7 +272,8 @@ class DATA_PT_onion_skinning(OnionSkinButtonsPanel): #, bpy.types.Panel): # inhe
     #bl_label = "Bones Onion Skinning"
     bl_context = "data"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         # XXX: include posemode check?
         return (context.object) and (context.armature)
 
@@ -303,9 +281,8 @@ class DATA_PT_onion_skinning(OnionSkinButtonsPanel): #, bpy.types.Panel): # inhe
         layout = self.layout
 
         ob = context.object
-        wide_ui = context.region.width > narrowui
 
-        self.draw_settings(context, ob.pose.animation_visualisation, wide_ui, bones=True)
+        self.draw_settings(context, ob.pose.animation_visualisation, bones=True)
 
 def register():
     pass
index 8331f2d517b837f17c6502b334536376a965b503..d0a6821c16b94d7498788eb7953f98b1921b9aec 100644 (file)
@@ -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):
+    @staticmethod
+    def poll(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):
+    @staticmethod
+    def poll(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):
+    @staticmethod
+    def poll(context):
         bone = context.active_pose_bone
         return bool(bone and bone.id_data.mode == 'POSE')
 
@@ -304,7 +305,7 @@ 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
 
 menu_func = (lambda self, context: self.layout.menu("INFO_MT_armature_metarig_add", icon='OUTLINER_OB_ARMATURE'))
index d68253aac4d1e6cde7c0dfe1e2a4a3f5935a1995..108845ae8fcdc2590eff0e10338d879aa0e303f1 100644 (file)
 import bpy
 from rna_prop_ui import PropertyPanel
 
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
 
 class BoneButtonsPanel():
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
     bl_context = "bone"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return (context.bone or context.edit_bone)
 
 
@@ -67,72 +66,50 @@ class BONE_PT_transform(BoneButtonsPanel, bpy.types.Panel):
 
         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")
+                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):
+    @staticmethod
+    def poll(context):
         return context.bone
 
     def draw(self, context):
@@ -168,7 +145,6 @@ class BONE_PT_relations(BoneButtonsPanel, bpy.types.Panel):
         ob = context.object
         bone = context.bone
         arm = context.armature
-        wide_ui = context.region.width > narrowui
 
         if not bone:
             bone = context.edit_bone
@@ -188,8 +164,7 @@ class BONE_PT_relations(BoneButtonsPanel, bpy.types.Panel):
             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="")
@@ -209,7 +184,8 @@ class BONE_PT_relations(BoneButtonsPanel, bpy.types.Panel):
 class BONE_PT_display(BoneButtonsPanel, bpy.types.Panel):
     bl_label = "Display"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return context.bone
 
     def draw(self, context):
@@ -217,7 +193,6 @@ class BONE_PT_display(BoneButtonsPanel, bpy.types.Panel):
 
         ob = context.object
         bone = context.bone
-        wide_ui = context.region.width > narrowui
 
         if not bone:
             bone = context.edit_bone
@@ -233,8 +208,7 @@ class BONE_PT_display(BoneButtonsPanel, bpy.types.Panel):
             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="")
@@ -246,7 +220,8 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
     bl_label = "Inverse Kinematics"
     bl_default_closed = True
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return context.active_pose_bone
 
     def draw(self, context):
@@ -255,7 +230,6 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
         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 +241,12 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
         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 +258,13 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
         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 +276,18 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
         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 +295,7 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
             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
@@ -356,7 +320,6 @@ class BONE_PT_deform(BoneButtonsPanel, bpy.types.Panel):
         layout = self.layout
 
         bone = context.bone
-        wide_ui = context.region.width > narrowui
 
         if not bone:
             bone = context.edit_bone
@@ -378,8 +341,7 @@ class BONE_PT_deform(BoneButtonsPanel, bpy.types.Panel):
         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)
index 5152e004f2842ee1c113a1832bf60aa74719fc8b..75bf2eb86d2f54134359a4f76ca00d8ac43f2872 100644 (file)
 import bpy
 from rna_prop_ui import PropertyPanel
 
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
 
 class DataButtonsPanel():
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
     bl_context = "data"
 
-    def poll(self, context):
-        engine = context.scene.render.engine
-        return context.camera and (engine in self.COMPAT_ENGINES)
-
 
 class DATA_PT_context_camera(DataButtonsPanel, bpy.types.Panel):
     bl_label = ""
     bl_show_header = False
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
+    @staticmethod
+    def poll(context):
+        engine = context.scene.render.engine
+        return context.camera and (engine in __class__.COMPAT_ENGINES)
+
     def draw(self, context):
         layout = self.layout
 
         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")
+
+        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(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
     _context_path = "object.data"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
+    @staticmethod
+    def poll(context):
+        engine = context.scene.render.engine
+        return context.camera and (engine in __class__.COMPAT_ENGINES)
+
 
 class DATA_PT_camera(DataButtonsPanel, bpy.types.Panel):
     bl_label = "Lens"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
+    @staticmethod
+    def poll(context):
+        engine = context.scene.render.engine
+        return context.camera and (engine in __class__.COMPAT_ENGINES)
+
     def draw(self, context):
         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 +87,7 @@ class DATA_PT_camera(DataButtonsPanel, bpy.types.Panel):
                 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 +102,7 @@ class DATA_PT_camera(DataButtonsPanel, bpy.types.Panel):
         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,10 +114,8 @@ class DATA_PT_camera(DataButtonsPanel, bpy.types.Panel):
         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")
@@ -131,11 +125,15 @@ class DATA_PT_camera_display(DataButtonsPanel, bpy.types.Panel):
     bl_label = "Display"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
+    @staticmethod
+    def poll(context):
+        engine = context.scene.render.engine
+        return context.camera and (engine in __class__.COMPAT_ENGINES)
+
     def draw(self, context):
         layout = self.layout
 
         cam = context.camera
-        wide_ui = context.region.width > narrowui
 
         split = layout.split()
 
@@ -145,8 +143,7 @@ class DATA_PT_camera_display(DataButtonsPanel, bpy.types.Panel):
         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")
index 279301ae330be0818fa97569a2038dcbb2f61efe..43f2f3497bbf2e1c08a9b0a360bca7975ebeb412 100644 (file)
 import bpy
 from rna_prop_ui import PropertyPanel
 
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
 
 class DataButtonsPanel():
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
     bl_context = "data"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return (context.object and context.object.type in ('CURVE', 'SURFACE', 'TEXT') and context.curve)
 
 
 class DataButtonsPanelCurve(DataButtonsPanel):
     '''Same as above but for curves only'''
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return (context.object and context.object.type == 'CURVE' and context.curve)
 
 
 class DataButtonsPanelActive(DataButtonsPanel):
     '''Same as above but for curves only'''
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         curve = context.curve
         return (curve and type(curve) is not bpy.types.TextCurve and curve.splines.active)
 
@@ -57,20 +58,15 @@ class DATA_PT_context_curve(DataButtonsPanel, bpy.types.Panel):
         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, bpy.types.Panel):
@@ -85,7 +81,6 @@ class DATA_PT_shape_curve(DataButtonsPanel, bpy.types.Panel):
 
         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 +104,7 @@ class DATA_PT_shape_curve(DataButtonsPanel, bpy.types.Panel):
             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)
@@ -133,7 +127,8 @@ class DATA_PT_shape_curve(DataButtonsPanel, bpy.types.Panel):
 class DATA_PT_geometry_curve(DataButtonsPanel, bpy.types.Panel):
     bl_label = "Geometry"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         obj = context.object
         if obj and obj.type == 'SURFACE':
             return False
@@ -144,7 +139,6 @@ class DATA_PT_geometry_curve(DataButtonsPanel, bpy.types.Panel):
         layout = self.layout
 
         curve = context.curve
-        wide_ui = context.region.width > narrowui
 
         split = layout.split()
 
@@ -155,8 +149,7 @@ class DATA_PT_geometry_curve(DataButtonsPanel, bpy.types.Panel):
         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")
@@ -176,7 +169,6 @@ class DATA_PT_pathanim(DataButtonsPanelCurve, bpy.types.Panel):
         layout = self.layout
 
         curve = context.curve
-        wide_ui = context.region.width > narrowui
 
         layout.active = curve.use_path
 
@@ -189,9 +181,9 @@ class DATA_PT_pathanim(DataButtonsPanelCurve, bpy.types.Panel):
         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")
 
@@ -270,7 +262,8 @@ class DATA_PT_active_spline(DataButtonsPanelActive, bpy.types.Panel):
 class DATA_PT_font(DataButtonsPanel, bpy.types.Panel):
     bl_label = "Font"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return (context.object and context.object.type == 'TEXT' and context.curve)
 
     def draw(self, context):
@@ -278,21 +271,16 @@ class DATA_PT_font(DataButtonsPanel, bpy.types.Panel):
 
         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 +289,7 @@ class DATA_PT_font(DataButtonsPanel, bpy.types.Panel):
         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 +301,7 @@ class DATA_PT_font(DataButtonsPanel, bpy.types.Panel):
         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")
@@ -332,20 +318,17 @@ class DATA_PT_font(DataButtonsPanel, bpy.types.Panel):
 class DATA_PT_paragraph(DataButtonsPanel, bpy.types.Panel):
     bl_label = "Paragraph"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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,8 +338,7 @@ class DATA_PT_paragraph(DataButtonsPanel, bpy.types.Panel):
         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")
@@ -365,20 +347,19 @@ class DATA_PT_paragraph(DataButtonsPanel, bpy.types.Panel):
 class DATA_PT_textboxes(DataButtonsPanel, bpy.types.Panel):
     bl_label = "Text Boxes"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 +375,7 @@ class DATA_PT_textboxes(DataButtonsPanel, bpy.types.Panel):
             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")
index 0a246f237a8d0e8e76e646ab9bfc603f7c8d3412..b4725647a0adb367f2ff4f9b3d6ec5bd23dffce0 100644 (file)
 # <pep8 compliant>
 import bpy
 
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
 
 class DataButtonsPanel():
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
     bl_context = "data"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return (context.object and context.object.type == 'EMPTY')
 
 
@@ -38,12 +37,8 @@ class DATA_PT_empty(DataButtonsPanel, bpy.types.Panel):
         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")
 
index e72739f5ec7cc5364c383a08f8e28907a20d3cd5..b2ab9cf9cfb20cc9f7c4a401701ace164b9465b3 100644 (file)
@@ -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"
@@ -36,14 +34,16 @@ class DataButtonsPanel():
     bl_region_type = 'WINDOW'
     bl_context = "data"
 
-    def poll(self, context):
-        engine = context.scene.render.engine
-        return context.lamp and (engine in self.COMPAT_ENGINES)
 
 class DATA_PT_preview(DataButtonsPanel, bpy.types.Panel):
     bl_label = "Preview"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
+    @staticmethod
+    def poll(context):
+        engine = context.scene.render.engine
+        return context.lamp and (engine in __class__.COMPAT_ENGINES)
+
     def draw(self, context):
         self.layout.template_preview(context.lamp)
 
@@ -52,48 +52,53 @@ class DATA_PT_context_lamp(DataButtonsPanel, bpy.types.Panel):
     bl_show_header = False
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
+    @staticmethod
+    def poll(context):
+        engine = context.scene.render.engine
+        return context.lamp and (engine in __class__.COMPAT_ENGINES)
+
     def draw(self, context):
         layout = self.layout
 
         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")
+
+        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):
     _context_path = "object.data"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
+    @staticmethod
+    def poll(context):
+        engine = context.scene.render.engine
+        return context.lamp and (engine in __class__.COMPAT_ENGINES)
+
 
 class DATA_PT_lamp(DataButtonsPanel, bpy.types.Panel):
     bl_label = "Lamp"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
+    @staticmethod
+    def poll(context):
+        engine = context.scene.render.engine
+        return context.lamp and (engine in __class__.COMPAT_ENGINES)
+
     def draw(self, context):
         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()
 
@@ -119,8 +124,7 @@ class DATA_PT_lamp(DataButtonsPanel, bpy.types.Panel):
             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")
@@ -131,16 +135,16 @@ class DATA_PT_sunsky(DataButtonsPanel, bpy.types.Panel):
     bl_label = "Sky & Atmosphere"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.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")
@@ -165,8 +169,7 @@ class DATA_PT_sunsky(DataButtonsPanel, bpy.types.Panel):
         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()
@@ -191,8 +194,7 @@ class DATA_PT_sunsky(DataButtonsPanel, bpy.types.Panel):
         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)
@@ -204,21 +206,32 @@ class DATA_PT_shadow(DataButtonsPanel, bpy.types.Panel):
     bl_label = "Shadow"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.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()
@@ -226,65 +239,51 @@ class DATA_PT_shadow(DataButtonsPanel, bpy.types.Panel):
             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")
+                    sub.prop(lamp, "shadow_ray_samples_x", text="Samples X")
+                    sub.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()
-
-                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()
@@ -296,8 +295,7 @@ class DATA_PT_shadow(DataButtonsPanel, bpy.types.Panel):
                 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)
@@ -317,8 +315,7 @@ class DATA_PT_shadow(DataButtonsPanel, bpy.types.Panel):
             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
@@ -329,22 +326,23 @@ class DATA_PT_area(DataButtonsPanel, bpy.types.Panel):
     bl_label = "Area Shape"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.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'):
@@ -356,16 +354,16 @@ class DATA_PT_spot(DataButtonsPanel, bpy.types.Panel):
     bl_label = "Spot Shape"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.COMPAT_ENGINES)
 
     def draw(self, context):
         layout = self.layout
 
         lamp = context.lamp
-        wide_ui = context.region.width > narrowui
 
         split = layout.split()
 
@@ -376,10 +374,8 @@ class DATA_PT_spot(DataButtonsPanel, bpy.types.Panel):
         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
@@ -393,11 +389,12 @@ class DATA_PT_falloff_curve(DataButtonsPanel, bpy.types.Panel):
     bl_default_closed = True
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.COMPAT_ENGINES)
 
     def draw(self, context):
         lamp = context.lamp
index 4bc6d9865e0c1617b9528f0db11ee759ed43b1ee..a2dfeb191b869e980caa5a8c4038d51de34c37f1 100644 (file)
 import bpy
 from rna_prop_ui import PropertyPanel
 
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
 
 class DataButtonsPanel():
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
     bl_context = "data"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return context.lattice
 
 
@@ -42,21 +41,14 @@ class DATA_PT_context_lattice(DataButtonsPanel, bpy.types.Panel):
         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")
+
+        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):
@@ -70,27 +62,23 @@ class DATA_PT_lattice(DataButtonsPanel, bpy.types.Panel):
         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()
index b3d5215db5809c83ac0c39e8050006792c5051d9..dd75850f1d3387dc09065ec9c02ef9b84f6eacf1 100644 (file)
@@ -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"
@@ -54,53 +52,56 @@ class DataButtonsPanel():
     bl_region_type = 'WINDOW'
     bl_context = "data"
 
-    def poll(self, context):
-        engine = context.scene.render.engine
-        return context.mesh and (engine in self.COMPAT_ENGINES)
-
 
 class DATA_PT_context_mesh(DataButtonsPanel, bpy.types.Panel):
     bl_label = ""
     bl_show_header = False
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
+    @staticmethod
+    def poll(context):
+        engine = context.scene.render.engine
+        return context.mesh and (engine in __class__.COMPAT_ENGINES)
+
     def draw(self, context):
         layout = self.layout
 
         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, bpy.types.Panel):
     _context_path = "object.data"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
+    @staticmethod
+    def poll(context):
+        engine = context.scene.render.engine
+        return context.mesh and (engine in __class__.COMPAT_ENGINES)
+
 
 class DATA_PT_normals(DataButtonsPanel, bpy.types.Panel):
     bl_label = "Normals"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
+    @staticmethod
+    def poll(context):
+        engine = context.scene.render.engine
+        return context.mesh and (engine in __class__.COMPAT_ENGINES)
+
     def draw(self, context):
         layout = self.layout
 
         mesh = context.mesh
-        wide_ui = context.region.width > narrowui
 
         split = layout.split()
 
@@ -110,10 +111,8 @@ class DATA_PT_normals(DataButtonsPanel, bpy.types.Panel):
         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")
 
 
@@ -121,6 +120,11 @@ class DATA_PT_settings(DataButtonsPanel, bpy.types.Panel):
     bl_label = "Settings"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
+    @staticmethod
+    def poll(context):
+        engine = context.scene.render.engine
+        return context.mesh and (engine in __class__.COMPAT_ENGINES)
+
     def draw(self, context):
         layout = self.layout
 
@@ -133,9 +137,11 @@ class DATA_PT_vertex_groups(DataButtonsPanel, bpy.types.Panel):
     bl_label = "Vertex Groups"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.COMPAT_ENGINES))
 
     def draw(self, context):
         layout = self.layout
@@ -180,9 +186,11 @@ class DATA_PT_shape_keys(DataButtonsPanel, bpy.types.Panel):
     bl_label = "Shape Keys"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.COMPAT_ENGINES))
 
     def draw(self, context):
         layout = self.layout
@@ -190,7 +198,6 @@ class DATA_PT_shape_keys(DataButtonsPanel, bpy.types.Panel):
         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 +230,11 @@ class DATA_PT_shape_keys(DataButtonsPanel, bpy.types.Panel):
             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 +262,7 @@ class DATA_PT_shape_keys(DataButtonsPanel, bpy.types.Panel):
                     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="")
@@ -278,6 +278,11 @@ class DATA_PT_uv_texture(DataButtonsPanel, bpy.types.Panel):
     bl_label = "UV Texture"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
+    @staticmethod
+    def poll(context):
+        engine = context.scene.render.engine
+        return context.mesh and (engine in __class__.COMPAT_ENGINES)
+
     def draw(self, context):
         layout = self.layout
 
@@ -297,11 +302,12 @@ class DATA_PT_uv_texture(DataButtonsPanel, bpy.types.Panel):
             layout.prop(lay, "name")
 
 
-class DATA_PT_texface(DataButtonsPanel):
+class DATA_PT_texface(DataButtonsPanel, bpy.types.Panel):
     bl_label = "Texture Face"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         ob = context.active_object
         rd = context.scene.render
 
@@ -311,7 +317,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 +334,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")
@@ -348,6 +352,11 @@ class DATA_PT_vertex_colors(DataButtonsPanel, bpy.types.Panel):
     bl_label = "Vertex Colors"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
+    @staticmethod
+    def poll(context):
+        engine = context.scene.render.engine
+        return context.mesh and (engine in __class__.COMPAT_ENGINES)
+
     def draw(self, context):
         layout = self.layout
 
index 1cce0cea66fc0a057b8efaa59522f90909aa0381..dbc0f642c7cf4b91513a3b0550cbef6de2c66dae 100644 (file)
 import bpy
 from rna_prop_ui import PropertyPanel
 
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
 
 class DataButtonsPanel():
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
     bl_context = "data"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return context.meta_ball
 
 
@@ -42,21 +41,14 @@ class DATA_PT_context_metaball(DataButtonsPanel, bpy.types.Panel):
         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")
+
+        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):
@@ -70,7 +62,6 @@ class DATA_PT_metaball(DataButtonsPanel, bpy.types.Panel):
         layout = self.layout
 
         mball = context.meta_ball
-        wide_ui = context.region.width > narrowui
 
         split = layout.split()
 
@@ -80,34 +71,27 @@ class DATA_PT_metaball(DataButtonsPanel, bpy.types.Panel):
         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, bpy.types.Panel):
     bl_label = "Active Element"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 +101,7 @@ class DATA_PT_metaball_element(DataButtonsPanel, bpy.types.Panel):
         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:")
index ea0fb606aa49121a955ae80fc4ceb717e2f16591..ad16dce50304b939ad16da8686ebf302e8e3143a 100644 (file)
@@ -19,9 +19,6 @@
 # <pep8 compliant>
 import bpy
 
-narrowui = bpy.context.user_preferences.view.properties_width_check
-narrowmod = 260
-
 
 class DataButtonsPanel():
     bl_space_type = 'PROPERTIES'
@@ -36,30 +33,27 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
         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, bpy.types.Panel):
         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, bpy.types.Panel):
         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, bpy.types.Panel):
         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, bpy.types.Panel):
         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, bpy.types.Panel):
         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, bpy.types.Panel):
         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, bpy.types.Panel):
         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, bpy.types.Panel):
         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, bpy.types.Panel):
         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, bpy.types.Panel):
 
         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, bpy.types.Panel):
         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, bpy.types.Panel):
         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, bpy.types.Panel):
             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, bpy.types.Panel):
         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, bpy.types.Panel):
             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, bpy.types.Panel):
         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, bpy.types.Panel):
         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, bpy.types.Panel):
         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, bpy.types.Panel):
             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, bpy.types.Panel):
         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, bpy.types.Panel):
         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, bpy.types.Panel):
         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, bpy.types.Panel):
         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, bpy.types.Panel):
         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, bpy.types.Panel):
             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, bpy.types.Panel):
         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, bpy.types.Panel):
         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, bpy.types.Panel):
             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, bpy.types.Panel):
         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, bpy.types.Panel):
         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, bpy.types.Panel):
         # 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, bpy.types.Panel):
         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, bpy.types.Panel):
             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, bpy.types.Panel):
             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, bpy.types.Panel):
             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, bpy.types.Panel):
         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, bpy.types.Panel):
         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,8 +697,7 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
         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)
 
index b12f368f5f47de51018fd777a047701324335ba3..6d3225553bac82f9073a03e01ba297bc7759bb56 100644 (file)
 # <pep8 compliant>
 import bpy
 
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
 
 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, bpy.types.Panel):
     bl_label = "Physics"
     COMPAT_ENGINES = {'BLENDER_GAME'}
 
+    @staticmethod
+    def poll(context):
+        ob = context.active_object
+        rd = context.scene.render
+        return ob and ob.game and (rd.engine in __class__.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, bpy.types.Panel):
             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, bpy.types.Panel):
             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, bpy.types.Panel):
             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, bpy.types.Panel):
             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
@@ -166,10 +157,11 @@ class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel, bpy.types.Panel):
     bl_label = "Collision Bounds"
     COMPAT_ENGINES = {'BLENDER_GAME'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.COMPAT_ENGINES)
 
     def draw_header(self, context):
         game = context.active_object.game
@@ -180,21 +172,16 @@ class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel, bpy.types.Panel):
         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")
 
 
@@ -203,15 +190,16 @@ class RenderButtonsPanel():
     bl_region_type = 'WINDOW'
     bl_context = "render"
 
-    def poll(self, context):
-        rd = context.scene.render
-        return (rd.engine in self.COMPAT_ENGINES)
-
 
 class RENDER_PT_game(RenderButtonsPanel, bpy.types.Panel):
     bl_label = "Game"
     COMPAT_ENGINES = {'BLENDER_GAME'}
 
+    @staticmethod
+    def poll(context):
+        rd = context.scene.render
+        return (rd.engine in __class__.COMPAT_ENGINES)
+
     def draw(self, context):
         layout = self.layout
 
@@ -224,11 +212,15 @@ class RENDER_PT_game_player(RenderButtonsPanel, bpy.types.Panel):
     bl_label = "Standalone Player"
     COMPAT_ENGINES = {'BLENDER_GAME'}
 
+    @staticmethod
+    def poll(context):
+        rd = context.scene.render
+        return (rd.engine in __class__.COMPAT_ENGINES)
+
     def draw(self, context):
         layout = self.layout
 
         gs = context.scene.game_data
-        wide_ui = context.region.width > narrowui
 
         layout.prop(gs, "fullscreen")
 
@@ -240,8 +232,7 @@ class RENDER_PT_game_player(RenderButtonsPanel, bpy.types.Panel):
         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,10 +241,7 @@ class RENDER_PT_game_player(RenderButtonsPanel, bpy.types.Panel):
         # 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="")
 
@@ -262,12 +250,16 @@ class RENDER_PT_game_stereo(RenderButtonsPanel, bpy.types.Panel):
     bl_label = "Stereo"
     COMPAT_ENGINES = {'BLENDER_GAME'}
 
+    @staticmethod
+    def poll(context):
+        rd = context.scene.render
+        return (rd.engine in __class__.COMPAT_ENGINES)
+
     def draw(self, context):
         layout = self.layout
 
         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 +271,7 @@ class RENDER_PT_game_stereo(RenderButtonsPanel, bpy.types.Panel):
 
         # 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 +285,7 @@ class RENDER_PT_game_stereo(RenderButtonsPanel, bpy.types.Panel):
                 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,15 +293,14 @@ class RENDER_PT_game_stereo(RenderButtonsPanel, bpy.types.Panel):
                 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")
 
@@ -322,16 +309,17 @@ class RENDER_PT_game_shading(RenderButtonsPanel, bpy.types.Panel):
     bl_label = "Shading"
     COMPAT_ENGINES = {'BLENDER_GAME'}
 
+    @staticmethod
+    def poll(context):
+        rd = context.scene.render
+        return (rd.engine in __class__.COMPAT_ENGINES)
+
     def draw(self, context):
         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()
@@ -351,11 +339,15 @@ class RENDER_PT_game_performance(RenderButtonsPanel, bpy.types.Panel):
     bl_label = "Performance"
     COMPAT_ENGINES = {'BLENDER_GAME'}
 
+    @staticmethod
+    def poll(context):
+        rd = context.scene.render
+        return (rd.engine in __class__.COMPAT_ENGINES)
+
     def draw(self, context):
         layout = self.layout
 
         gs = context.scene.game_data
-        wide_ui = context.region.width > narrowui
 
         split = layout.split()
 
@@ -366,8 +358,8 @@ class RENDER_PT_game_performance(RenderButtonsPanel, bpy.types.Panel):
         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")
@@ -377,16 +369,18 @@ class RENDER_PT_game_sound(RenderButtonsPanel, bpy.types.Panel):
     bl_label = "Sound"
     COMPAT_ENGINES = {'BLENDER_GAME'}
 
+    @staticmethod
+    def poll(context):
+        rd = context.scene.render
+        return (rd.engine in __class__.COMPAT_ENGINES)
+
     def draw(self, context):
         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")
 
@@ -396,17 +390,14 @@ class WorldButtonsPanel():
     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, bpy.types.Panel):
     bl_label = ""
     bl_show_header = False
     COMPAT_ENGINES = {'BLENDER_GAME'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         rd = context.scene.render
         return (context.scene) and (rd.use_game_engine)
 
@@ -416,38 +407,34 @@ class WORLD_PT_game_context_world(WorldButtonsPanel, bpy.types.Panel):
         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, bpy.types.Panel):
     bl_label = "World"
     COMPAT_ENGINES = {'BLENDER_GAME'}
 
+    @staticmethod
+    def poll(context):
+        scene = context.scene
+        return (scene.world and scene.render.engine in __class__.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")
 
 
@@ -455,6 +442,11 @@ class WORLD_PT_game_mist(WorldButtonsPanel, bpy.types.Panel):
     bl_label = "Mist"
     COMPAT_ENGINES = {'BLENDER_GAME'}
 
+    @staticmethod
+    def poll(context):
+        scene = context.scene
+        return (scene.world and scene.render.engine in __class__.COMPAT_ENGINES)
+
     def draw_header(self, context):
         world = context.world
 
@@ -464,7 +456,6 @@ class WORLD_PT_game_mist(WorldButtonsPanel, bpy.types.Panel):
         layout = self.layout
 
         world = context.world
-        wide_ui = context.region.width > narrowui
 
         layout.active = world.mist.use_mist
         split = layout.split()
@@ -472,8 +463,7 @@ class WORLD_PT_game_mist(WorldButtonsPanel, bpy.types.Panel):
         col = split.column()
         col.prop(world.mist, "start")
 
-        if wide_ui:
-            col = split.column()
+        col = split.column()
         col.prop(world.mist, "depth")
 
 
@@ -481,11 +471,15 @@ class WORLD_PT_game_physics(WorldButtonsPanel, bpy.types.Panel):
     bl_label = "Physics"
     COMPAT_ENGINES = {'BLENDER_GAME'}
 
+    @staticmethod
+    def poll(context):
+        scene = context.scene
+        return (scene.world and scene.render.engine in __class__.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 +494,7 @@ class WORLD_PT_game_physics(WorldButtonsPanel, bpy.types.Panel):
             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")
 
index a464249b3b02e8b1bab518489507ce44a3ed819b..6dfc3fc95a144652b9533d01d1a92e7b1f3c82eb 100644 (file)
@@ -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
@@ -60,11 +58,6 @@ class MaterialButtonsPanel():
     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)
-
 
 class MATERIAL_PT_preview(MaterialButtonsPanel, bpy.types.Panel):
     bl_label = "Preview"
@@ -79,12 +72,13 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel, bpy.types.Panel):
     bl_show_header = False
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.COMPAT_ENGINES)
 
     def draw(self, context):
         layout = self.layout
@@ -93,7 +87,6 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel, bpy.types.Panel):
         ob = context.object
         slot = context.material_slot
         space = context.space_data
-        wide_ui = context.region.width > narrowui
 
         if ob:
             row = layout.row()
@@ -112,54 +105,49 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel, bpy.types.Panel):
                 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, bpy.types.Panel):
     COMPAT_ENGINES = {'BLENDER_RENDER'}
     _context_path = "material"
 
+    @staticmethod
+    def poll(context):
+        return context.material and (context.scene.render.engine in __class__.COMPAT_ENGINES)
+
 
 class MATERIAL_PT_shading(MaterialButtonsPanel, bpy.types.Panel):
     bl_label = "Shading"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.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, bpy.types.Panel):
             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
@@ -189,17 +176,17 @@ class MATERIAL_PT_strand(MaterialButtonsPanel, bpy.types.Panel):
     bl_default_closed = True
     COMPAT_ENGINES = {'BLENDER_RENDER'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.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, bpy.types.Panel):
         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
@@ -237,11 +223,14 @@ class MATERIAL_PT_physics(MaterialButtonsPanel, bpy.types.Panel):
     bl_label = "Physics"
     COMPAT_ENGINES = {'BLENDER_GAME'}
 
+    @staticmethod
+    def poll(context):
+        return context.material and (context.scene.render.engine in __class__.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,8 +239,7 @@ class MATERIAL_PT_physics(MaterialButtonsPanel, bpy.types.Panel):
         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)
@@ -261,16 +249,16 @@ class MATERIAL_PT_options(MaterialButtonsPanel, bpy.types.Panel):
     bl_label = "Options"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.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, bpy.types.Panel):
         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
@@ -307,16 +294,16 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel, bpy.types.Panel):
     bl_default_closed = True
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.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, bpy.types.Panel):
         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
@@ -343,16 +329,16 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel, bpy.types.Panel):
     bl_label = "Diffuse"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.COMPAT_ENGINES)
 
     def draw(self, context):
         layout = self.layout
 
         mat = active_node_mat(context.material)
-        wide_ui = context.region.width > narrowui
 
         split = layout.split()
 
@@ -362,8 +348,7 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel, bpy.types.Panel):
         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")
@@ -380,8 +365,7 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel, bpy.types.Panel):
             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()
@@ -389,8 +373,7 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel, bpy.types.Panel):
             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:
@@ -403,8 +386,7 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel, bpy.types.Panel):
             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")
@@ -414,16 +396,16 @@ class MATERIAL_PT_specular(MaterialButtonsPanel, bpy.types.Panel):
     bl_label = "Specular"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.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)
 
@@ -433,8 +415,7 @@ class MATERIAL_PT_specular(MaterialButtonsPanel, bpy.types.Panel):
         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")
 
@@ -447,8 +428,7 @@ class MATERIAL_PT_specular(MaterialButtonsPanel, bpy.types.Panel):
             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")
@@ -458,8 +438,7 @@ class MATERIAL_PT_specular(MaterialButtonsPanel, bpy.types.Panel):
             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:
@@ -471,8 +450,7 @@ class MATERIAL_PT_specular(MaterialButtonsPanel, bpy.types.Panel):
             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()
@@ -484,10 +462,11 @@ class MATERIAL_PT_sss(MaterialButtonsPanel, bpy.types.Panel):
     bl_default_closed = True
     COMPAT_ENGINES = {'BLENDER_RENDER'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.COMPAT_ENGINES)
 
     def draw_header(self, context):
         mat = active_node_mat(context.material)
@@ -501,7 +480,6 @@ class MATERIAL_PT_sss(MaterialButtonsPanel, bpy.types.Panel):
 
         mat = active_node_mat(context.material)
         sss = mat.subsurface_scattering
-        wide_ui = context.region.width > narrowui
 
         layout.active = (sss.enabled) and (not mat.shadeless)
 
@@ -518,8 +496,7 @@ class MATERIAL_PT_sss(MaterialButtonsPanel, bpy.types.Panel):
         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")
@@ -536,10 +513,11 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel):
     bl_default_closed = True
     COMPAT_ENGINES = {'BLENDER_RENDER'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.COMPAT_ENGINES)
 
     def draw_header(self, context):
         raym = active_node_mat(context.material).raytrace_mirror
@@ -551,7 +529,6 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel):
 
         mat = active_node_mat(context.material)
         raym = mat.raytrace_mirror
-        wide_ui = context.region.width > narrowui
 
         layout.active = raym.enabled
 
@@ -561,8 +538,7 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel):
         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
@@ -580,8 +556,7 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel):
         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()
@@ -596,10 +571,11 @@ class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
     bl_default_closed = True
     COMPAT_ENGINES = {'BLENDER_RENDER'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.COMPAT_ENGINES)
 
     def draw_header(self, context):
         mat = active_node_mat(context.material)
@@ -611,14 +587,10 @@ class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
 
         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()
 
@@ -628,8 +600,7 @@ class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
         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()
@@ -648,8 +619,7 @@ class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
             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()
@@ -663,10 +633,11 @@ class MATERIAL_PT_transp_game(MaterialButtonsPanel, bpy.types.Panel):
     bl_default_closed = True
     COMPAT_ENGINES = {'BLENDER_GAME'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.COMPAT_ENGINES)
 
     def draw_header(self, context):
         mat = active_node_mat(context.material)
@@ -678,14 +649,10 @@ class MATERIAL_PT_transp_game(MaterialButtonsPanel, bpy.types.Panel):
 
         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()
 
@@ -697,17 +664,17 @@ class MATERIAL_PT_halo(MaterialButtonsPanel, bpy.types.Panel):
     bl_label = "Halo"
     COMPAT_ENGINES = {'BLENDER_RENDER'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.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()
 
@@ -723,8 +690,7 @@ class MATERIAL_PT_halo(MaterialButtonsPanel, bpy.types.Panel):
         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
@@ -747,10 +713,11 @@ class MATERIAL_PT_flare(MaterialButtonsPanel, bpy.types.Panel):
     bl_label = "Flare"
     COMPAT_ENGINES = {'BLENDER_RENDER'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.COMPAT_ENGINES)
 
     def draw_header(self, context):
         halo = context.material.halo
@@ -762,7 +729,6 @@ class MATERIAL_PT_flare(MaterialButtonsPanel, bpy.types.Panel):
 
         mat = context.material # dont use node material
         halo = mat.halo
-        wide_ui = context.region.width > narrowui
 
         layout.active = halo.flare_mode
 
@@ -772,8 +738,8 @@ class MATERIAL_PT_flare(MaterialButtonsPanel, bpy.types.Panel):
         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")
 
@@ -782,11 +748,13 @@ class VolumeButtonsPanel():
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
     bl_context = "material"
+    COMPAT_ENGINES = {'BLENDER_RENDER'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.COMPAT_ENGINES)
 
 
 class MATERIAL_PT_volume_density(VolumeButtonsPanel, bpy.types.Panel):
@@ -798,14 +766,12 @@ class MATERIAL_PT_volume_density(VolumeButtonsPanel, bpy.types.Panel):
         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")
 
 
@@ -818,7 +784,6 @@ class MATERIAL_PT_volume_shading(VolumeButtonsPanel, bpy.types.Panel):
         layout = self.layout
 
         vol = context.material.volume # dont use node material
-        wide_ui = context.region.width > narrowui
 
         split = layout.split()
 
@@ -827,8 +792,7 @@ class MATERIAL_PT_volume_shading(VolumeButtonsPanel, bpy.types.Panel):
         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="")
@@ -846,15 +810,13 @@ class MATERIAL_PT_volume_lighting(VolumeButtonsPanel, bpy.types.Panel):
         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")
@@ -883,12 +845,8 @@ class MATERIAL_PT_volume_transp(VolumeButtonsPanel, bpy.types.Panel):
         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, bpy.types.Panel):
@@ -900,7 +858,6 @@ class MATERIAL_PT_volume_integration(VolumeButtonsPanel, bpy.types.Panel):
         layout = self.layout
 
         vol = context.material.volume # dont use node material
-        wide_ui = context.region.width > narrowui
 
         split = layout.split()
 
@@ -910,8 +867,7 @@ class MATERIAL_PT_volume_integration(VolumeButtonsPanel, bpy.types.Panel):
         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")
 
@@ -925,7 +881,6 @@ class MATERIAL_PT_volume_options(VolumeButtonsPanel, bpy.types.Panel):
         layout = self.layout
 
         mat = active_node_mat(context.material)
-        wide_ui = context.region.width > narrowui
 
         split = layout.split()
 
index f09de20c8f3bfbe42d7eb226991f86b173353982..f5d61a22b8f7634bb073f806008acff73fa25655 100644 (file)
@@ -20,8 +20,6 @@
 import bpy
 from rna_prop_ui import PropertyPanel
 
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
 
 class ObjectButtonsPanel():
     bl_space_type = 'PROPERTIES'
@@ -53,37 +51,23 @@ class OBJECT_PT_transform(ObjectButtonsPanel, bpy.types.Panel):
         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")
+        layout.prop(ob, "rotation_mode")
 
 
 class OBJECT_PT_transform_locks(ObjectButtonsPanel, bpy.types.Panel):
@@ -94,7 +78,6 @@ class OBJECT_PT_transform_locks(ObjectButtonsPanel, bpy.types.Panel):
         layout = self.layout
 
         ob = context.object
-        # wide_ui = context.region.width > narrowui
 
         row = layout.row()
 
@@ -120,7 +103,6 @@ class OBJECT_PT_relations(ObjectButtonsPanel, bpy.types.Panel):
         layout = self.layout
 
         ob = context.object
-        wide_ui = context.region.width > narrowui
 
         split = layout.split()
 
@@ -129,8 +111,7 @@ class OBJECT_PT_relations(ObjectButtonsPanel, bpy.types.Panel):
         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="")
 
@@ -149,7 +130,6 @@ class OBJECT_PT_groups(ObjectButtonsPanel, bpy.types.Panel):
         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")
@@ -173,8 +153,7 @@ class OBJECT_PT_groups(ObjectButtonsPanel, bpy.types.Panel):
                 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")
@@ -190,14 +169,12 @@ class OBJECT_PT_display(ObjectButtonsPanel, bpy.types.Panel):
         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()
@@ -212,8 +189,7 @@ class OBJECT_PT_display(ObjectButtonsPanel, bpy.types.Panel):
         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")
@@ -226,12 +202,8 @@ class OBJECT_PT_duplication(ObjectButtonsPanel, bpy.types.Panel):
         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()
@@ -240,8 +212,7 @@ class OBJECT_PT_duplication(ObjectButtonsPanel, bpy.types.Panel):
             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")
 
@@ -256,15 +227,12 @@ class OBJECT_PT_duplication(ObjectButtonsPanel, bpy.types.Panel):
             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
 
@@ -276,7 +244,6 @@ class OBJECT_PT_animation(ObjectButtonsPanel, bpy.types.Panel):
         layout = self.layout
 
         ob = context.object
-        wide_ui = context.region.width > narrowui
 
         split = layout.split()
 
@@ -295,8 +262,7 @@ class OBJECT_PT_animation(ObjectButtonsPanel, bpy.types.Panel):
         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")
@@ -308,16 +274,16 @@ class OBJECT_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
     #bl_label = "Object Motion Paths"
     bl_context = "object"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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)
+        self.draw_settings(context, ob.animation_visualisation)
 
         layout.separator()
 
@@ -326,8 +292,7 @@ class OBJECT_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
         col = split.column()
         col.operator("object.paths_calculate", text="Calculate Paths")
 
-        if wide_ui:
-            col = split.column()
+        col = split.column()
         col.operator("object.paths_clear", text="Clear Paths")
 
 
@@ -335,16 +300,16 @@ class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel): #, bpy.types.Panel): # in
     #bl_label = "Object Onion Skinning"
     bl_context = "object"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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)
+        self.draw_settings(context, ob.animation_visualisation)
 
 class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel, bpy.types.Panel):
     _context_path = "object"
index bc8fd6ad9dadddbd65f40316e3aca2d655f29e1c..87ca702fa69a268b20f7fd2ba60272f0b9d1c84b 100644 (file)
@@ -19,9 +19,6 @@
 # <pep8 compliant>
 import bpy
 
-narrowui = bpy.context.user_preferences.view.properties_width_check
-narrowcon = 260
-
 
 class ConstraintButtonsPanel():
     bl_space_type = 'PROPERTIES'
@@ -31,52 +28,38 @@ class ConstraintButtonsPanel():
     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():
             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():
         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():
         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():
         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():
             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():
         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():
         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():
             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():
         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():
 
         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():
         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():
         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():
 
         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():
         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():
         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():
 
         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():
 
         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():
 
         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():
 
         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():
         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():
         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():
         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():
 
         #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():
         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():
         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():
         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():
         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():
             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():
         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()
@@ -753,7 +678,8 @@ class OBJECT_PT_constraints(ConstraintButtonsPanel, bpy.types.Panel):
     bl_label = "Object Constraints"
     bl_context = "constraint"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return (context.object)
 
     def draw(self, context):
@@ -771,7 +697,8 @@ class BONE_PT_constraints(ConstraintButtonsPanel, bpy.types.Panel):
     bl_label = "Bone Constraints"
     bl_context = "bone_constraint"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return (context.pose_bone)
 
     def draw(self, context):
index ed516b49dea5f51c3c5aa0de618d84802bf77c20..0d830c121ee4ded7e58a937dc6d7fb398085ad1f 100644 (file)
@@ -25,21 +25,19 @@ 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():
@@ -47,18 +45,16 @@ class ParticleButtonsPanel():
     bl_region_type = 'WINDOW'
     bl_context = "particle"
 
-    def poll(self, context):
-        return particle_panel_poll(self, context)
-
 
 class PARTICLE_PT_context_particles(ParticleButtonsPanel, bpy.types.Panel):
     bl_label = ""
     bl_show_header = False
     COMPAT_ENGINES = {'BLENDER_RENDER'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.COMPAT_ENGINES)
 
     def draw(self, context):
         layout = self.layout
@@ -140,13 +136,18 @@ class PARTICLE_PT_custom_props(ParticleButtonsPanel, PropertyPanel, bpy.types.Pa
     COMPAT_ENGINES = {'BLENDER_RENDER'}
     _context_path = "particle_system.settings"
 
+    @staticmethod
+    def poll(context):
+        return particle_panel_poll(__class__, context)
+
 
 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):
+    @staticmethod
+    def poll(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, bpy.types.Panel):
 
         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, bpy.types.Panel):
         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, bpy.types.Panel):
 
         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()
 
@@ -208,14 +204,15 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, bpy.types.Panel):
     bl_default_closed = True
     COMPAT_ENGINES = {'BLENDER_RENDER'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.COMPAT_ENGINES)
 
     def draw_header(self, context):
         #cloth = context.cloth.collision_settings
@@ -265,7 +262,8 @@ class PARTICLE_PT_cache(ParticleButtonsPanel, bpy.types.Panel):
     bl_default_closed = True
     COMPAT_ENGINES = {'BLENDER_RENDER'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         psys = context.particle_system
         engine = context.scene.render.engine
         if psys is None:
@@ -275,7 +273,7 @@ class PARTICLE_PT_cache(ParticleButtonsPanel, bpy.types.Panel):
         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 __class__.COMPAT_ENGINES
 
     def draw(self, context):
         psys = context.particle_system
@@ -287,8 +285,9 @@ 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):
+    @staticmethod
+    def poll(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:
@@ -334,8 +333,9 @@ 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):
+    @staticmethod
+    def poll(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, bpy.types.Panel):
 
         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, bpy.types.Panel):
         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()
@@ -380,8 +376,9 @@ 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):
+    @staticmethod
+    def poll(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, bpy.types.Panel):
 
         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)
@@ -577,7 +570,8 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel, bpy.types.Panel):
     bl_label = "Boid Brain"
     COMPAT_ENGINES = {'BLENDER_RENDER'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         psys = context.particle_system
         engine = context.scene.render.engine
         if psys is None:
@@ -586,7 +580,7 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel, bpy.types.Panel):
             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 __class__.COMPAT_ENGINES
 
     def draw(self, context):
         layout = self.layout
@@ -677,21 +671,21 @@ class PARTICLE_PT_render(ParticleButtonsPanel, bpy.types.Panel):
     bl_label = "Render"
     COMPAT_ENGINES = {'BLENDER_RENDER'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.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, bpy.types.Panel):
         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, bpy.types.Panel):
             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")
@@ -848,27 +836,24 @@ class PARTICLE_PT_draw(ParticleButtonsPanel, bpy.types.Panel):
     bl_default_closed = True
     COMPAT_ENGINES = {'BLENDER_RENDER'}
 
-    def poll(self, context):
+    @staticmethod
+    def poll(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 __class__.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
@@ -907,17 +892,17 @@ class PARTICLE_PT_children(ParticleButtonsPanel, bpy.types.Panel):
     bl_default_closed = True
     COMPAT_ENGINES = {'BLENDER_RENDER'}
 
+    @staticmethod
+    def poll(context):
+        return particle_panel_poll(__class__, 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, bpy.types.Panel):
         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()
 
@@ -992,6 +974,10 @@ class PARTICLE_PT_field_weights(ParticleButtonsPanel, bpy.types.Panel):
     bl_default_closed = True
     COMPAT_ENGINES = {'BLENDER_RENDER'}
 
+    @staticmethod
+    def poll(context):
+        return particle_panel_poll(__class__, context)
+
     def draw(self, context):
         part = context.particle_system.settings
         effector_weights_ui(self, context, part.effector_weights)
@@ -1005,6 +991,10 @@ class PARTICLE_PT_force_fields(ParticleButtonsPanel, bpy.types.Panel):
     bl_default_closed = True
     COMPAT_ENGINES = {'BLENDER_RENDER'}
 
+    @staticmethod
+    def poll(context):
+        return particle_panel_poll(__class__, context)
+
     def draw(self, context):
         layout = self.layout
 
@@ -1033,6 +1023,10 @@ class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, bpy.types.Panel):
     bl_default_closed = True
     COMPAT_ENGINES = {'BLENDER_RENDER'}
 
+    @staticmethod
+    def poll(context):
+        return particle_panel_poll(__class__, context)
+
     def draw(self, context):
         layout = self.layout
 
index af393c0d239231087bba3f7ba9b5edbd1e3f9655..d711dc9d9cf3b4808f8c7c71e2996dc2ceb31801 100644 (file)
@@ -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
@@ -45,7 +43,8 @@ class PhysicButtonsPanel():
     bl_region_type = 'WINDOW'
     bl_context = "physics"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         ob = context.object
         rd = context.scene.render
         return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
@@ -59,7 +58,6 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, bpy.types.Panel):
 
         md = context.cloth
         ob = context.object
-        wide_ui = context.region.width > narrowui
 
         split = layout.split()
 
@@ -74,8 +72,7 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, bpy.types.Panel):
         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, bpy.types.Panel):
             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")
@@ -137,7 +133,8 @@ class PHYSICS_PT_cloth_cache(PhysicButtonsPanel, bpy.types.Panel):
     bl_label = "Cloth Cache"
     bl_default_closed = True
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return context.cloth
 
     def draw(self, context):
@@ -149,7 +146,8 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel, bpy.types.Panel):
     bl_label = "Cloth Collision"
     bl_default_closed = True
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return context.cloth
 
     def draw_header(self, context):
@@ -163,7 +161,6 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel, bpy.types.Panel):
 
         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, bpy.types.Panel):
         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
@@ -189,7 +185,8 @@ class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel, bpy.types.Panel):
     bl_label = "Cloth Stiffness Scaling"
     bl_default_closed = True
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return context.cloth
 
     def draw_header(self, context):
@@ -204,7 +201,6 @@ class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel, bpy.types.Panel):
         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,8 +211,7 @@ class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel, bpy.types.Panel):
         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")
@@ -226,7 +221,8 @@ class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel, bpy.types.Panel):
     bl_label = "Cloth Field Weights"
     bl_default_closed = True
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         return (context.cloth)
 
     def draw(self, context):
index be8972e4fe689708fc198d14cb157436bb35310c..340cd88251c2ee2f61af6420f5b42b32e8094ce4 100644 (file)
 
 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()
index 963fbe082265bbaa8c254e6625b696b7329d78b0..bf9fb1ab9961d26cd0be25406ea440f8f528422f 100644 (file)
@@ -19,8 +19,6 @@
 # <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
@@ -31,7 +29,8 @@ class PhysicButtonsPanel():
     bl_region_type = 'WINDOW'
     bl_context = "physics"
 
-    def poll(self, context):
+    @staticmethod
+    def poll(context):
         rd = context.scene.render
         return (context.object) and (not rd.use_game_engine)
 
@@ -44,22 +43,15 @@ class PHYSICS_PT_field(PhysicButtonsPanel, bpy.types.Panel):
 
         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, bpy.types.Panel):
             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, bpy.types.Panel):
                 col.prop(field, "guide_kink_frequency")
                 col