diff options
author | Xiao Xiangquan <xiaoxiangquan@gmail.com> | 2011-09-01 19:08:32 +0400 |
---|---|---|
committer | Xiao Xiangquan <xiaoxiangquan@gmail.com> | 2011-09-01 19:08:32 +0400 |
commit | 981f7fcd0d315abb425bf34dd37f7cd4d9e8d55e (patch) | |
tree | 70800c93ec1a12579c32874e2a72eaf3290eba8e /release | |
parent | 5b91a783cf0ec132398a2767d3419d675e5126b5 (diff) | |
parent | 2365c64014b3e067bb212b2061f1d14c1f944090 (diff) |
merge with trunk r39834
Diffstat (limited to 'release')
83 files changed, 1925 insertions, 1261 deletions
diff --git a/release/datafiles/blenderbuttons b/release/datafiles/blenderbuttons Binary files differindex 9872e53585e..4c064182a8c 100644 --- a/release/datafiles/blenderbuttons +++ b/release/datafiles/blenderbuttons diff --git a/release/datafiles/splash.png b/release/datafiles/splash.png Binary files differindex d6ccdb5b733..79339095b07 100644 --- a/release/datafiles/splash.png +++ b/release/datafiles/splash.png diff --git a/release/scripts/modules/bpy/__init__.py b/release/scripts/modules/bpy/__init__.py index a43b42e49a1..5c371fd750a 100644 --- a/release/scripts/modules/bpy/__init__.py +++ b/release/scripts/modules/bpy/__init__.py @@ -44,14 +44,18 @@ from . import utils, path, ops ops = ops.ops_fake_module -def _main(): - import sys as _sys +def main(): + import sys # Possibly temp. addons path from os.path import join, dirname, normpath - _sys.path.append(normpath(join(dirname(__file__), + sys.path.append(normpath(join(dirname(__file__), "..", "..", "addons", "modules"))) + # fake module to allow: + # from bpy.types import Panel + sys.modules["bpy.types"] = types + # if "-d" in sys.argv: # Enable this to measure startup speed if 0: import cProfile @@ -65,6 +69,6 @@ def _main(): utils.load_scripts() -_main() +main() -del _main +del main diff --git a/release/scripts/modules/bpy_extras/image_utils.py b/release/scripts/modules/bpy_extras/image_utils.py index eab75c3bd16..02959fae534 100644 --- a/release/scripts/modules/bpy_extras/image_utils.py +++ b/release/scripts/modules/bpy_extras/image_utils.py @@ -58,7 +58,7 @@ def load_image(imagepath, For formats blender can read, simply return the path that is given. :type convert_callback: function :return: an image or None - :rtype: :class:`Image` + :rtype: :class:`bpy.types.Image` """ import os import bpy diff --git a/release/scripts/modules/bpy_extras/io_utils.py b/release/scripts/modules/bpy_extras/io_utils.py index bb4e95c051f..3f6a3682e7c 100644 --- a/release/scripts/modules/bpy_extras/io_utils.py +++ b/release/scripts/modules/bpy_extras/io_utils.py @@ -252,10 +252,10 @@ def axis_conversion(from_forward='Y', from_up='Z', to_forward='Y', to_up='Z'): def axis_conversion_ensure(operator, forward_attr, up_attr): """ Function to ensure an operator has valid axis conversion settings, intended - to be used from :class:`Operator.check`. + to be used from :class:`bpy.types.Operator.check`. :arg operator: the operator to access axis attributes from. - :type operator: :class:`Operator` + :type operator: :class:`bpy.types.Operator` :arg forward_attr: attribute storing the forward axis :type forward_attr: string :arg up_attr: attribute storing the up axis @@ -439,7 +439,7 @@ def path_reference_copy(copy_set, report=print): shutil.copy(file_src, file_dst) -def unique_name(key, name, name_dict, name_max=-1, clean_func=None): +def unique_name(key, name, name_dict, name_max=-1, clean_func=None, sep="."): """ Helper function for storing unique names which may have special characters stripped and restricted to a maximum length. @@ -456,6 +456,9 @@ def unique_name(key, name, name_dict, name_max=-1, clean_func=None): :type name_dict: dict :arg clean_func: Function to call on *name* before creating a unique value. :type clean_func: function + :arg sep: Separator to use when between the name and a number when a + duplicate name is found. + :type sep: string """ name_new = name_dict.get(key) if name_new is None: @@ -466,14 +469,15 @@ def unique_name(key, name, name_dict, name_max=-1, clean_func=None): if name_max == -1: while name_new in name_dict_values: - name_new = "%s.%03d" % (name_new_orig, count) + name_new = "%s%s%03d" % (name_new_orig, sep, count) count += 1 else: name_new = name_new[:name_max] while name_new in name_dict_values: count_str = "%03d" % count - name_new = "%.*s.%s" % (name_max - (len(count_str) + 1), + name_new = "%.*s%s%s" % (name_max - (len(count_str) + 1), name_new_orig, + sep, count_str, ) count += 1 diff --git a/release/scripts/modules/bpy_extras/mesh_utils.py b/release/scripts/modules/bpy_extras/mesh_utils.py index c965169ff04..7bc6dae3cc6 100644 --- a/release/scripts/modules/bpy_extras/mesh_utils.py +++ b/release/scripts/modules/bpy_extras/mesh_utils.py @@ -35,7 +35,7 @@ def mesh_linked_faces(mesh): other mesh elements within 1 mesh datablock. :arg mesh: the mesh used to group with. - :type mesh: :class:`Mesh` + :type mesh: :class:`bpy.types.Mesh` :return: lists of lists containing faces. :rtype: list """ @@ -125,9 +125,9 @@ def edge_loops_from_faces(mesh, faces=None, seams=()): [[(0, 1), (4, 8), (3, 8)], ...] :arg mesh: the mesh used to get edge loops from. - :type mesh: :class:`Mesh` + :type mesh: :class:`bpy.types.Mesh` :arg faces: optional face list to only use some of the meshes faces. - :type faces: :class:`MeshFaces`, sequence or or NoneType + :type faces: :class:`bpy.types.MeshFaces`, sequence or or NoneType :return: return a list of edge vertex index lists. :rtype: list """ @@ -426,7 +426,7 @@ def ngon_tesselate(from_data, indices, fix_loops=True): # See if its flipped the wrong way. flip = None for fi in fill: - if flip != None: + if flip is not None: break for i, vi in enumerate(fi): if vi == 0 and fi[i - 1] == 1: @@ -450,7 +450,7 @@ def face_random_points(num_points, faces): :arg num_points: the number of random points to generate on each face. :type int: :arg faces: list of the faces to generate points on. - :type faces: :class:`MeshFaces`, sequence + :type faces: :class:`bpy.types.MeshFaces`, sequence :return: list of random points over all faces. :rtype: list """ diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py index 790f5ba48cb..3081e6f172e 100644 --- a/release/scripts/modules/bpy_extras/object_utils.py +++ b/release/scripts/modules/bpy_extras/object_utils.py @@ -33,11 +33,11 @@ def add_object_align_init(context, operator): Return a matrix using the operator settings and view context. :arg context: The context to use. - :type context: :class:`Context` + :type context: :class:`bpy.types.Context` :arg operator: The operator, checked for location and rotation properties. - :type operator: :class:`Operator` + :type operator: :class:`bpy.types.Operator` :return: the matrix from the context and settings. - :rtype: :class:`Matrix` + :rtype: :class:`mathutils.Matrix` """ from mathutils import Matrix, Vector, Euler @@ -92,13 +92,13 @@ def object_data_add(context, obdata, operator=None): location, rotation and layer. :arg context: The context to use. - :type context: :class:`Context` + :type context: :class:`bpy.types.Context` :arg obdata: the data used for the new object. :type obdata: valid object data type or None. :arg operator: The operator, checked for location and rotation properties. - :type operator: :class:`Operator` + :type operator: :class:`bpy.types.Operator` :return: the newly created object in the scene. - :rtype: :class:`ObjectBase` + :rtype: :class:`bpy.types.ObjectBase` """ scene = context.scene diff --git a/release/scripts/modules/bpy_extras/view3d_utils.py b/release/scripts/modules/bpy_extras/view3d_utils.py index 26325633a05..c18a74bbb09 100644 --- a/release/scripts/modules/bpy_extras/view3d_utils.py +++ b/release/scripts/modules/bpy_extras/view3d_utils.py @@ -31,14 +31,14 @@ def region_2d_to_vector_3d(region, rv3d, coord): coordinate. :arg region: region of the 3D viewport, typically bpy.context.region. - :type region: :class:`Region` + :type region: :class:`bpy.types.Region` :arg rv3d: 3D region data, typically bpy.context.space_data.region_3d. - :type rv3d: :class:`RegionView3D` + :type rv3d: :class:`bpy.types.RegionView3D` :arg coord: 2d coordinates relative to the region: (event.mouse_region_x, event.mouse_region_y) for example. :type coord: 2d vector :return: normalized 3d vector. - :rtype: :class:`Vector` + :rtype: :class:`mathutils.Vector` """ from mathutils import Vector @@ -65,9 +65,9 @@ def region_2d_to_location_3d(region, rv3d, coord, depth_location): *depth_location*. :arg region: region of the 3D viewport, typically bpy.context.region. - :type region: :class:`Region` + :type region: :class:`bpy.types.Region` :arg rv3d: 3D region data, typically bpy.context.space_data.region_3d. - :type rv3d: :class:`RegionView3D` + :type rv3d: :class:`bpy.types.RegionView3D` :arg coord: 2d coordinates relative to the region; (event.mouse_region_x, event.mouse_region_y) for example. :type coord: 2d vector @@ -75,7 +75,7 @@ def region_2d_to_location_3d(region, rv3d, coord, depth_location): there is no defined depth with a 2d region input. :type depth_location: 3d vector :return: normalized 3d vector. - :rtype: :class:`Vector` + :rtype: :class:`mathutils.Vector` """ from mathutils import Vector from mathutils.geometry import intersect_point_line @@ -114,13 +114,13 @@ def location_3d_to_region_2d(region, rv3d, coord): Return the *region* relative 2d location of a 3d position. :arg region: region of the 3D viewport, typically bpy.context.region. - :type region: :class:`Region` + :type region: :class:`bpy.types.Region` :arg rv3d: 3D region data, typically bpy.context.space_data.region_3d. - :type rv3d: :class:`RegionView3D` + :type rv3d: :class:`bpy.types.RegionView3D` :arg coord: 3d worldspace location. :type coord: 3d vector :return: 2d location - :rtype: :class:`Vector` + :rtype: :class:`mathutils.Vector` """ from mathutils import Vector diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index 8766c873dd8..101416f4943 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -57,7 +57,7 @@ class Library(bpy_types.ID): "curves", "grease_pencil", "groups", "images", \ "lamps", "lattices", "materials", "metaballs", \ "meshes", "node_groups", "objects", "scenes", \ - "sounds", "textures", "texts", "fonts", "worlds" + "sounds", "speakers", "textures", "texts", "fonts", "worlds" return tuple(id_block for attr in attr_links for id_block in getattr(bpy.data, attr) if id_block.library == self) @@ -287,7 +287,7 @@ class EditBone(StructRNA, _GenericBone, metaclass=StructMetaPropGroup): Transform the the bones head, tail, roll and envalope (when the matrix has a scale component). :arg matrix: 3x3 or 4x4 transformation matrix. - :type matrix: :class:`Matrix` + :type matrix: :class:`mathutils.Matrix` :arg scale: Scale the bone envalope by the matrix. :type scale: bool :arg roll: Correct the roll to point in the same relative direction to the head and tail. @@ -411,6 +411,16 @@ class Text(bpy_types.ID): TypeMap = {} +class Sound(bpy_types.ID): + __slots__ = () + + @property + def factory(self): + """The aud.Factory object of the sound.""" + import aud + return aud._sound_from_pointer(self.as_pointer()) + + class RNAMeta(type): def __new__(cls, name, bases, classdict, **args): result = type.__new__(cls, name, bases, classdict) diff --git a/release/scripts/modules/console_python.py b/release/scripts/modules/console_python.py index 455eabe377b..425ea210104 100644 --- a/release/scripts/modules/console_python.py +++ b/release/scripts/modules/console_python.py @@ -179,7 +179,7 @@ def execute(context): # special exception. its possible the command loaded a new user interface if hash(sc) != hash(context.space_data): - return + return {'FINISHED'} bpy.ops.console.scrollback_append(text=sc.prompt + line, type='INPUT') diff --git a/release/scripts/presets/ffmpeg/DV.py b/release/scripts/presets/ffmpeg/DV.py index 46d2a0a4a2f..926fb241747 100644 --- a/release/scripts/presets/ffmpeg/DV.py +++ b/release/scripts/presets/ffmpeg/DV.py @@ -11,3 +11,4 @@ else: bpy.context.scene.render.ffmpeg_audio_mixrate = 48000 bpy.context.scene.render.ffmpeg_audio_codec = "PCM" +bpy.context.scene.render.ffmpeg_audio_channels = 2 diff --git a/release/scripts/presets/ffmpeg/DVD.py b/release/scripts/presets/ffmpeg/DVD.py index e18ec9f817b..196b5d68406 100644 --- a/release/scripts/presets/ffmpeg/DVD.py +++ b/release/scripts/presets/ffmpeg/DVD.py @@ -21,3 +21,4 @@ bpy.context.scene.render.ffmpeg_muxrate = 10080000 bpy.context.scene.render.ffmpeg_audio_codec = "AC3" bpy.context.scene.render.ffmpeg_audio_bitrate = 448 bpy.context.scene.render.ffmpeg_audio_mixrate = 48000 +bpy.context.scene.render.ffmpeg_audio_channels = 6 diff --git a/release/scripts/presets/ffmpeg/SVCD.py b/release/scripts/presets/ffmpeg/SVCD.py index c71a3851af0..e4459ab5c5c 100644 --- a/release/scripts/presets/ffmpeg/SVCD.py +++ b/release/scripts/presets/ffmpeg/SVCD.py @@ -21,3 +21,4 @@ bpy.context.scene.render.ffmpeg_muxrate = 0 bpy.context.scene.render.ffmpeg_audio_bitrate = 224 bpy.context.scene.render.ffmpeg_audio_mixrate = 44100 bpy.context.scene.render.ffmpeg_audio_codec = "MP2" +bpy.context.scene.render.ffmpeg_audio_channels = 2 diff --git a/release/scripts/presets/ffmpeg/VCD.py b/release/scripts/presets/ffmpeg/VCD.py index faf27efe9e6..c2b73e682a2 100644 --- a/release/scripts/presets/ffmpeg/VCD.py +++ b/release/scripts/presets/ffmpeg/VCD.py @@ -21,3 +21,4 @@ bpy.context.scene.render.ffmpeg_muxrate = 2352 * 75 * 8 bpy.context.scene.render.ffmpeg_audio_bitrate = 224 bpy.context.scene.render.ffmpeg_audio_mixrate = 44100 bpy.context.scene.render.ffmpeg_audio_codec = "MP2" +bpy.context.scene.render.ffmpeg_audio_channels = 2 diff --git a/release/scripts/startup/bl_operators/add_mesh_torus.py b/release/scripts/startup/bl_operators/add_mesh_torus.py index 27a6d21d519..056b3478c2b 100644 --- a/release/scripts/startup/bl_operators/add_mesh_torus.py +++ b/release/scripts/startup/bl_operators/add_mesh_torus.py @@ -18,6 +18,7 @@ # <pep8-80 compliant> import bpy +from bpy.types import Operator import mathutils @@ -81,42 +82,68 @@ from bpy.props import (FloatProperty, ) -class AddTorus(bpy.types.Operator): +class AddTorus(Operator): '''Add a torus mesh''' bl_idname = "mesh.primitive_torus_add" bl_label = "Add Torus" bl_options = {'REGISTER', 'UNDO'} - major_radius = FloatProperty(name="Major Radius", + major_radius = FloatProperty( + name="Major Radius", description=("Radius from the origin to the " "center of the cross sections"), - default=1.0, min=0.01, max=100.0) - minor_radius = FloatProperty(name="Minor Radius", + min=0.01, max=100.0, + default=1.0, + ) + minor_radius = FloatProperty( + name="Minor Radius", description="Radius of the torus' cross section", - default=0.25, min=0.01, max=100.0) - major_segments = IntProperty(name="Major Segments", + min=0.01, max=100.0, + default=0.25, + ) + major_segments = IntProperty( + name="Major Segments", description="Number of segments for the main ring of the torus", - default=48, min=3, max=256) - minor_segments = IntProperty(name="Minor Segments", + min=3, max=256, + default=48, + ) + minor_segments = IntProperty( + name="Minor Segments", description="Number of segments for the minor ring of the torus", - default=12, min=3, max=256) - use_abso = BoolProperty(name="Use Int+Ext Controls", + min=3, max=256, + default=12, + ) + use_abso = BoolProperty( + name="Use Int+Ext Controls", description="Use the Int / Ext controls for torus dimensions", - default=False) - abso_major_rad = FloatProperty(name="Exterior Radius", + default=False, + ) + abso_major_rad = FloatProperty( + name="Exterior Radius", description="Total Exterior Radius of the torus", - default=1.0, min=0.01, max=100.0) - abso_minor_rad = FloatProperty(name="Inside Radius", + min=0.01, max=100.0, + default=1.0, + ) + abso_minor_rad = FloatProperty( + name="Inside Radius", description="Total Interior Radius of the torus", - default=0.5, min=0.01, max=100.0) + min=0.01, max=100.0, + default=0.5, + ) # generic transform props - view_align = BoolProperty(name="Align to View", - default=False) - location = FloatVectorProperty(name="Location", - subtype='TRANSLATION') - rotation = FloatVectorProperty(name="Rotation", - subtype='EULER') + view_align = BoolProperty( + name="Align to View", + default=False, + ) + location = FloatVectorProperty( + name="Location", + subtype='TRANSLATION', + ) + rotation = FloatVectorProperty( + name="Rotation", + subtype='EULER', + ) def execute(self, context): diff --git a/release/scripts/startup/bl_operators/animsys_update.py b/release/scripts/startup/bl_operators/animsys_update.py index eedc006ebd1..f1d0c3579ff 100644 --- a/release/scripts/startup/bl_operators/animsys_update.py +++ b/release/scripts/startup/bl_operators/animsys_update.py @@ -687,9 +687,10 @@ data_path_update = [ import bpy +from bpy.types import Operator -class UpdateAnimData(bpy.types.Operator): +class UpdateAnimData(Operator): """Update data paths from 2.56 and previous versions, modifying data paths of drivers and fcurves""" bl_idname = "anim.update_data_paths" bl_label = "Update Animation Data" diff --git a/release/scripts/startup/bl_operators/image.py b/release/scripts/startup/bl_operators/image.py index aca9b581b97..9226cbed51b 100644 --- a/release/scripts/startup/bl_operators/image.py +++ b/release/scripts/startup/bl_operators/image.py @@ -19,10 +19,11 @@ # <pep8-80 compliant> import bpy +from bpy.types import Operator from bpy.props import StringProperty -class EditExternally(bpy.types.Operator): +class EditExternally(Operator): '''Edit image in an external application''' bl_idname = "image.external_edit" bl_label = "Image Edit Externally" @@ -106,7 +107,7 @@ class EditExternally(bpy.types.Operator): return {'FINISHED'} -class SaveDirty(bpy.types.Operator): +class SaveDirty(Operator): """Save all modified textures""" bl_idname = "image.save_dirty" bl_label = "Save Dirty" @@ -129,7 +130,7 @@ class SaveDirty(bpy.types.Operator): return {'FINISHED'} -class ProjectEdit(bpy.types.Operator): +class ProjectEdit(Operator): """Edit a snapshot of the viewport in an external image editor""" bl_idname = "image.project_edit" bl_label = "Project Edit" @@ -196,7 +197,7 @@ class ProjectEdit(bpy.types.Operator): return {'FINISHED'} -class ProjectApply(bpy.types.Operator): +class ProjectApply(Operator): """Project edited image back onto the object""" bl_idname = "image.project_apply" bl_label = "Project Apply" diff --git a/release/scripts/startup/bl_operators/mesh.py b/release/scripts/startup/bl_operators/mesh.py index 344b238709f..5f6583754e9 100644 --- a/release/scripts/startup/bl_operators/mesh.py +++ b/release/scripts/startup/bl_operators/mesh.py @@ -19,11 +19,12 @@ # <pep8-80 compliant> import bpy +from bpy.types import Operator from bpy.props import EnumProperty -class MeshSelectInteriorFaces(bpy.types.Operator): +class MeshSelectInteriorFaces(Operator): '''Select faces where all edges have more then 2 face users.''' bl_idname = "mesh.faces_select_interior" @@ -67,17 +68,17 @@ class MeshSelectInteriorFaces(bpy.types.Operator): return {'FINISHED'} -class MeshMirrorUV(bpy.types.Operator): +class MeshMirrorUV(Operator): '''Copy mirror UV coordinates on the X axis based on a mirrored mesh''' bl_idname = "mesh.faces_mirror_uv" bl_label = "Copy Mirrored UV coords" bl_options = {'REGISTER', 'UNDO'} - direction = EnumProperty(items=( - ('POSITIVE', "Positive", ""), - ('NEGATIVE', "Negative", "")), - name="Axis Direction", - description="") + direction = EnumProperty( + name="Axis Direction", + items=(('POSITIVE', "Positive", ""), + ('NEGATIVE', "Negative", "")), + ) @classmethod def poll(cls, context): diff --git a/release/scripts/startup/bl_operators/nla.py b/release/scripts/startup/bl_operators/nla.py index 469e9015e62..c764f7d62f1 100644 --- a/release/scripts/startup/bl_operators/nla.py +++ b/release/scripts/startup/bl_operators/nla.py @@ -19,6 +19,7 @@ # <pep8-80 compliant> import bpy +from bpy.types import Operator def pose_frame_info(obj): @@ -83,7 +84,7 @@ def bake(frame_start, do_pose=True, do_object=True, do_constraint_clear=False, - ): + action=None): scene = bpy.context.scene obj = bpy.context.object @@ -120,7 +121,8 @@ def bake(frame_start, # incase animation data hassnt been created atd = obj.animation_data_create() - action = bpy.data.actions.new("Action") + if action is None: + action = bpy.data.actions.new("Action") atd.action = action if do_pose: @@ -191,25 +193,38 @@ def bake(frame_start, from bpy.props import IntProperty, BoolProperty, EnumProperty -class BakeAction(bpy.types.Operator): +class BakeAction(Operator): '''Bake animation to an Action''' bl_idname = "nla.bake" bl_label = "Bake Action" bl_options = {'REGISTER', 'UNDO'} - frame_start = IntProperty(name="Start Frame", + frame_start = IntProperty( + name="Start Frame", description="Start frame for baking", - default=1, min=1, max=300000) - frame_end = IntProperty(name="End Frame", + min=0, max=300000, + default=1, + ) + frame_end = IntProperty( + name="End Frame", description="End frame for baking", - default=250, min=1, max=300000) - step = IntProperty(name="Frame Step", + min=1, max=300000, + default=250, + ) + step = IntProperty( + name="Frame Step", description="Frame Step", - default=1, min=1, max=120) - only_selected = BoolProperty(name="Only Selected", - default=True) - clear_consraints = BoolProperty(name="Clear Constraints", - default=False) + min=1, max=120, + default=1, + ) + only_selected = BoolProperty( + name="Only Selected", + default=True, + ) + clear_consraints = BoolProperty( + name="Clear Constraints", + default=False, + ) bake_types = EnumProperty( name="Bake Data", options={'ENUM_FLAG'}, @@ -253,3 +268,36 @@ class BakeAction(bpy.types.Operator): def invoke(self, context, event): wm = context.window_manager return wm.invoke_props_dialog(self) + + +class ClearUselessActions(Operator): + '''Mark actions with no F-Curves for deletion after save+reload of file preserving "action libraries"''' + bl_idname = "anim.clear_useless_actions" + bl_label = "Clear Useless Actions" + bl_options = {'REGISTER', 'UNDO'} + + only_unused = BoolProperty(name="Only Unused", + description="Only unused (Fake User only) actions get considered", + default=True) + + @classmethod + def poll(cls, context): + return len(bpy.data.actions) != 0 + + def execute(self, context): + removed = 0 + + for action in bpy.data.actions: + # if only user is "fake" user... + if ((self.only_unused is False) or + (action.use_fake_user and action.users == 1)): + + # if it has F-Curves, then it's a "action library" (i.e. walk, wave, jump, etc.) + # and should be left alone as that's what fake users are for! + if not action.fcurves: + # mark action for deletion + action.user_clear() + removed += 1 + + self.report({'INFO'}, "Removed %d empty and/or fake-user only Actions" % (removed)) + return {'FINISHED'} diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py index c0bd20b8910..bd879fa8679 100644 --- a/release/scripts/startup/bl_operators/object.py +++ b/release/scripts/startup/bl_operators/object.py @@ -19,11 +19,12 @@ # <pep8-80 compliant> import bpy +from bpy.types import Operator from bpy.props import StringProperty, BoolProperty, EnumProperty, IntProperty from blf import gettext as _ -class SelectPattern(bpy.types.Operator): +class SelectPattern(Operator): '''Select object matching a naming pattern''' bl_idname = "object.select_pattern" bl_label = _("Select Pattern") @@ -100,7 +101,7 @@ class SelectPattern(bpy.types.Operator): row.prop(self, "extend") -class SelectCamera(bpy.types.Operator): +class SelectCamera(Operator): '''Select object matching a naming pattern''' bl_idname = "object.select_camera" bl_label = _("Select Camera") @@ -121,7 +122,7 @@ class SelectCamera(bpy.types.Operator): return {'FINISHED'} -class SelectHierarchy(bpy.types.Operator): +class SelectHierarchy(Operator): '''Select object relative to the active objects position''' \ '''in the hierarchy''' bl_idname = "object.select_hierarchy" @@ -188,15 +189,19 @@ class SelectHierarchy(bpy.types.Operator): return {'CANCELLED'} -class SubdivisionSet(bpy.types.Operator): +class SubdivisionSet(Operator): '''Sets a Subdivision Surface Level (1-5)''' bl_idname = "object.subdivision_set" bl_label = _("Subdivision Set") bl_options = {'REGISTER', 'UNDO'} - level = IntProperty(name=_("Level"), - default=1, min=-100, max=100, soft_min=-6, soft_max=6) + level = IntProperty( + name=_("Level"), + min=-100, max=100, + soft_min=-6, soft_max=6, + default=1, + ) relative = BoolProperty( name=_("Relative"), @@ -263,7 +268,7 @@ class SubdivisionSet(bpy.types.Operator): return {'FINISHED'} -class ShapeTransfer(bpy.types.Operator): +class ShapeTransfer(Operator): '''Copy another selected objects active shape to this one by ''' \ '''applying the relative offsets''' @@ -506,7 +511,7 @@ class ShapeTransfer(bpy.types.Operator): return self._main(ob_act, objects, self.mode, self.use_clamp) -class JoinUVs(bpy.types.Operator): +class JoinUVs(Operator): '''Copy UV Layout to objects with matching geometry''' bl_idname = "object.join_uvs" bl_label = _("Join as UVs") @@ -574,7 +579,7 @@ class JoinUVs(bpy.types.Operator): return {'FINISHED'} -class MakeDupliFace(bpy.types.Operator): +class MakeDupliFace(Operator): '''Make linked objects into dupli-faces''' bl_idname = "object.make_dupli_face" bl_label = _("Make Dupli-Face") @@ -648,7 +653,7 @@ class MakeDupliFace(bpy.types.Operator): return {'FINISHED'} -class IsolateTypeRender(bpy.types.Operator): +class IsolateTypeRender(Operator): '''Hide unselected render objects of same type as active ''' \ '''by setting the hide render flag''' bl_idname = "object.isolate_type_render" @@ -669,7 +674,7 @@ class IsolateTypeRender(bpy.types.Operator): return {'FINISHED'} -class ClearAllRestrictRender(bpy.types.Operator): +class ClearAllRestrictRender(Operator): '''Reveal all render objects by setting the hide render flag''' bl_idname = "object.hide_render_clear_all" bl_label = _("Clear All Restrict Render") @@ -679,3 +684,49 @@ class ClearAllRestrictRender(bpy.types.Operator): for obj in context.scene.objects: obj.hide_render = False return {'FINISHED'} + + +class TransformsToDeltasAnim(Operator): + '''Convert object animation for normal transforms to delta transforms''' + bl_idname = "object.anim_transforms_to_deltas" + bl_label = "Animated Transforms to Deltas" + bl_options = {'REGISTER', 'UNDO'} + + @classmethod + def poll(cls, context): + obs = context.selected_editable_objects + return (obs is not None) + + def execute(self, context): + for obj in context.selected_editable_objects: + # get animation data + adt = obj.animation_data + if (adt is None) or (adt.action is None): + self.report({'WARNING'}, + "No animation data to convert on object: %r" % + obj.name) + continue + + # if F-Curve uses standard transform path + # just append "delta_" to this path + for fcu in adt.action.fcurves: + if fcu.data_path == "location": + fcu.data_path = "delta_location" + obj.location.zero() + elif fcu.data_path == "rotation_euler": + fcu.data_path = "delta_rotation_euler" + obj.rotation_euler.zero() + elif fcu.data_path == "rotation_quaternion": + fcu.data_path = "delta_rotation_quaternion" + obj.rotation_quaternion.identity() + # XXX: currently not implemented + # elif fcu.data_path == "rotation_axis_angle": + # fcu.data_path = "delta_rotation_axis_angle" + elif fcu.data_path == "scale": + fcu.data_path = "delta_scale" + obj.scale = 1.0, 1.0, 1.0 + + # hack: force animsys flush by changing frame, so that deltas get run + context.scene.frame_set(context.scene.frame_current) + + return {'FINISHED'} diff --git a/release/scripts/startup/bl_operators/object_align.py b/release/scripts/startup/bl_operators/object_align.py index 99507aadc12..c70b33598b4 100644 --- a/release/scripts/startup/bl_operators/object_align.py +++ b/release/scripts/startup/bl_operators/object_align.py @@ -19,6 +19,7 @@ # <pep8-80 compliant> import bpy +from bpy.types import Operator from mathutils import Vector from blf import gettext as _ @@ -340,7 +341,7 @@ def align_objects(align_x, from bpy.props import EnumProperty, BoolProperty -class AlignObjects(bpy.types.Operator): +class AlignObjects(Operator): '''Align Objects''' bl_idname = "object.align" bl_label = _("Align Objects") @@ -349,33 +350,34 @@ class AlignObjects(bpy.types.Operator): bb_quality = BoolProperty( name=_("High Quality"), description=_("Enables high quality calculation of the bounding box for perfect results on complex shape meshes with rotation/scale (Slow)"), - default=True) - - align_mode = EnumProperty(items=( - ('OPT_1', "Negative Sides", ""), - ('OPT_2', "Centers", ""), - ('OPT_3', "Positive Sides", "")), - name="Align Mode:", - description="", - default='OPT_2') - - relative_to = EnumProperty(items=( - ('OPT_1', "Scene Origin", ""), - ('OPT_2', "3D Cursor", ""), - ('OPT_3', "Selection", ""), - ('OPT_4', "Active", "")), - name="Relative To:", - description="", - default='OPT_4') - - align_axis = EnumProperty(items=( - ('X', "X", ""), - ('Y', "Y", ""), - ('Z', "Z", ""), - ), - name="Align", - description="Align to axis", - options={'ENUM_FLAG'}) + default=True, + ) + align_mode = EnumProperty( + name=_("Align Mode:"), + items=(('OPT_1', "Negative Sides", ""), + ('OPT_2', "Centers", ""), + ('OPT_3', "Positive Sides", ""), + ), + default='OPT_2', + ) + relative_to = EnumProperty( + name=_("Relative To:"), + items=(('OPT_1', "Scene Origin", ""), + ('OPT_2', "3D Cursor", ""), + ('OPT_3', "Selection", ""), + ('OPT_4', "Active", ""), + ), + default='OPT_4', + ) + align_axis = EnumProperty( + name=_("Align"), + description=_("Align to axis"), + items=(('X', "X", ""), + ('Y', "Y", ""), + ('Z', "Z", ""), + ), + options={'ENUM_FLAG'}, + ) @classmethod def poll(cls, context): diff --git a/release/scripts/startup/bl_operators/object_quick_effects.py b/release/scripts/startup/bl_operators/object_quick_effects.py index ba739648000..7b616ea5dca 100644 --- a/release/scripts/startup/bl_operators/object_quick_effects.py +++ b/release/scripts/startup/bl_operators/object_quick_effects.py @@ -20,6 +20,7 @@ from mathutils import Vector import bpy +from bpy.types import Operator from bpy.props import (BoolProperty, EnumProperty, IntProperty, @@ -45,24 +46,30 @@ def object_ensure_material(obj, mat_name): return mat -class QuickFur(bpy.types.Operator): +class QuickFur(Operator): bl_idname = "object.quick_fur" bl_label = "Quick Fur" bl_options = {'REGISTER', 'UNDO'} - density = EnumProperty(items=( - ('LIGHT', "Light", ""), - ('MEDIUM', "Medium", ""), - ('HEAVY', "Heavy", "")), - name="Fur Density", - description="", - default='MEDIUM') - - view_percentage = IntProperty(name="View %", - default=10, min=1, max=100, soft_min=1, soft_max=100) - - length = FloatProperty(name="Length", - default=0.1, min=0.001, max=100, soft_min=0.01, soft_max=10) + density = EnumProperty( + name="Fur Density", + items=(('LIGHT', "Light", ""), + ('MEDIUM', "Medium", ""), + ('HEAVY', "Heavy", "")), + default='MEDIUM', + ) + view_percentage = IntProperty( + name="View %", + min=1, max=100, + soft_min=1, soft_max=100, + default=10, + ) + length = FloatProperty( + name="Length", + min=0.001, max=100, + soft_min=0.01, soft_max=10, + default=0.1, + ) def execute(self, context): fake_context = bpy.context.copy() @@ -104,36 +111,55 @@ class QuickFur(bpy.types.Operator): return {'FINISHED'} -class QuickExplode(bpy.types.Operator): +class QuickExplode(Operator): bl_idname = "object.quick_explode" bl_label = "Quick Explode" bl_options = {'REGISTER', 'UNDO'} - style = EnumProperty(items=( - ('EXPLODE', "Explode", ""), - ('BLEND', "Blend", "")), - name="Explode Style", - description="", - default='EXPLODE') - - amount = IntProperty(name="Amount of pieces", - default=100, min=2, max=10000, soft_min=2, soft_max=10000) - - frame_duration = IntProperty(name="Duration", - default=50, min=1, max=300000, soft_min=1, soft_max=10000) - - frame_start = IntProperty(name="Start Frame", - default=1, min=1, max=300000, soft_min=1, soft_max=10000) + style = EnumProperty( + name="Explode Style", + items=(('EXPLODE', "Explode", ""), + ('BLEND', "Blend", "")), + default='EXPLODE', + ) + amount = IntProperty( + name="Amount of pieces", + min=2, max=10000, + soft_min=2, soft_max=10000, + default=100, + ) + frame_duration = IntProperty( + name="Duration", + min=1, max=300000, + soft_min=1, soft_max=10000, + default=50, + ) - frame_end = IntProperty(name="End Frame", - default=10, min=1, max=300000, soft_min=1, soft_max=10000) + frame_start = IntProperty( + name="Start Frame", + min=1, max=300000, + soft_min=1, soft_max=10000, + default=1, + ) + frame_end = IntProperty( + name="End Frame", + min=1, max=300000, + soft_min=1, soft_max=10000, + default=10, + ) - velocity = FloatProperty(name="Outwards Velocity", - default=1, min=0, max=300000, soft_min=0, soft_max=10) + velocity = FloatProperty( + name="Outwards Velocity", + min=0, max=300000, + soft_min=0, soft_max=10, + default=1, + ) - fade = BoolProperty(name="Fade", - description="Fade the pieces over time.", - default=True) + fade = BoolProperty( + name="Fade", + description="Fade the pieces over time.", + default=True, + ) def execute(self, context): fake_context = bpy.context.copy() @@ -265,18 +291,17 @@ def obj_bb_minmax(obj, min_co, max_co): max_co[2] = max(bb_vec[2], max_co[2]) -class QuickSmoke(bpy.types.Operator): +class QuickSmoke(Operator): bl_idname = "object.quick_smoke" bl_label = "Quick Smoke" bl_options = {'REGISTER', 'UNDO'} style = EnumProperty( + name="Smoke Style", items=(('STREAM', "Stream", ""), ('PUFF', "Puff", ""), ('FIRE', "Fire", ""), ), - name="Smoke Style", - description="", default='STREAM', ) @@ -383,25 +408,22 @@ class QuickSmoke(bpy.types.Operator): return {'FINISHED'} -class QuickFluid(bpy.types.Operator): +class QuickFluid(Operator): bl_idname = "object.quick_fluid" bl_label = "Quick Fluid" bl_options = {'REGISTER', 'UNDO'} style = EnumProperty( + name="Fluid Style", items=(('INFLOW', "Inflow", ""), - ('BASIC', "Basic", ""), - ), - name="Fluid Style", - description="", - default='BASIC', - ) + ('BASIC', "Basic", "")), + default='BASIC', + ) initial_velocity = FloatVectorProperty( name=_("Initial Velocity"), description=_("Initial velocity of the fluid"), + min=-100.0, max=100.0, default=(0.0, 0.0, 0.0), - min=-100.0, - max=100.0, subtype='VELOCITY', ) show_flows = BoolProperty( diff --git a/release/scripts/startup/bl_operators/object_randomize_transform.py b/release/scripts/startup/bl_operators/object_randomize_transform.py index acb988e147a..2f40741bb18 100644 --- a/release/scripts/startup/bl_operators/object_randomize_transform.py +++ b/release/scripts/startup/bl_operators/object_randomize_transform.py @@ -19,6 +19,8 @@ # <pep8-80 compliant> import bpy + +from bpy.types import Operator from blf import gettext as _ @@ -88,7 +90,7 @@ def randomize_selected(seed, delta, loc, rot, scale, scale_even): from bpy.props import IntProperty, BoolProperty, FloatVectorProperty -class RandomizeLocRotSize(bpy.types.Operator): +class RandomizeLocRotSize(Operator): '''Randomize objects loc/rot/scale''' bl_idname = "object.randomize_transform" bl_label = _("Randomize Transform") @@ -143,9 +145,12 @@ class RandomizeLocRotSize(bpy.types.Operator): default=False, ) - '''scale_min = FloatProperty(name="Minimun Scale Factor", - description="Lowest scale percentage possible", - default=0.15, min=-1.0, max=1.0, precision=3)''' + '''scale_min = FloatProperty( + name="Minimun Scale Factor", + description="Lowest scale percentage possible", + min=-1.0, max=1.0, precision=3, + default=0.15, + )''' scale = FloatVectorProperty( name=_("Scale"), diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py index 9abb6cdf0c6..ec0a650dd40 100644 --- a/release/scripts/startup/bl_operators/presets.py +++ b/release/scripts/startup/bl_operators/presets.py @@ -19,6 +19,7 @@ # <pep8-80 compliant> import bpy +from bpy.types import Menu, Operator from blf import gettext as _ @@ -141,7 +142,7 @@ class AddPresetBase(): return self.execute(context) -class ExecutePreset(bpy.types.Operator): +class ExecutePreset(Operator): ''' Executes a preset ''' bl_idname = "script.execute_preset" bl_label = _("Execute a Python Preset") @@ -170,7 +171,7 @@ class ExecutePreset(bpy.types.Operator): return {'FINISHED'} -class AddPresetRender(AddPresetBase, bpy.types.Operator): +class AddPresetRender(AddPresetBase, Operator): '''Add a Render Preset''' bl_idname = "render.preset_add" bl_label = _("Add Render Preset") @@ -196,7 +197,7 @@ class AddPresetRender(AddPresetBase, bpy.types.Operator): preset_subdir = "render" -class AddPresetSSS(AddPresetBase, bpy.types.Operator): +class AddPresetSSS(AddPresetBase, Operator): '''Add a Subsurface Scattering Preset''' bl_idname = "material.sss_preset_add" bl_label = _("Add SSS Preset") @@ -225,7 +226,7 @@ class AddPresetSSS(AddPresetBase, bpy.types.Operator): preset_subdir = "sss" -class AddPresetCloth(AddPresetBase, bpy.types.Operator): +class AddPresetCloth(AddPresetBase, Operator): '''Add a Cloth Preset''' bl_idname = "cloth.preset_add" bl_label = _("Add Cloth Preset") @@ -247,7 +248,7 @@ class AddPresetCloth(AddPresetBase, bpy.types.Operator): preset_subdir = "cloth" -class AddPresetSunSky(AddPresetBase, bpy.types.Operator): +class AddPresetSunSky(AddPresetBase, Operator): '''Add a Sky & Atmosphere Preset''' bl_idname = "lamp.sunsky_preset_add" bl_label = _("Add Sunsky Preset") @@ -276,7 +277,7 @@ class AddPresetSunSky(AddPresetBase, bpy.types.Operator): preset_subdir = "sunsky" -class AddPresetInteraction(AddPresetBase, bpy.types.Operator): +class AddPresetInteraction(AddPresetBase, Operator): '''Add an Application Interaction Preset''' bl_idname = "wm.interaction_preset_add" bl_label = _("Add Interaction Preset") @@ -303,7 +304,7 @@ class AddPresetInteraction(AddPresetBase, bpy.types.Operator): preset_subdir = "interaction" -class AddPresetKeyconfig(AddPresetBase, bpy.types.Operator): +class AddPresetKeyconfig(AddPresetBase, Operator): '''Add a Keyconfig Preset''' bl_idname = "wm.keyconfig_preset_add" bl_label = _("Add Keyconfig Preset") @@ -327,7 +328,7 @@ class AddPresetKeyconfig(AddPresetBase, bpy.types.Operator): keyconfigs.remove(keyconfigs.active) -class AddPresetOperator(AddPresetBase, bpy.types.Operator): +class AddPresetOperator(AddPresetBase, Operator): '''Add an Application Interaction Preset''' bl_idname = "wm.operator_preset_add" bl_label = _("Operator Preset") @@ -351,7 +352,7 @@ class AddPresetOperator(AddPresetBase, bpy.types.Operator): @property def preset_values(self): - properties_blacklist = bpy.types.Operator.bl_rna.properties.keys() + properties_blacklist = Operator.bl_rna.properties.keys() prefix, suffix = self.operator.split("_OT_", 1) op = getattr(getattr(bpy.ops, prefix.lower()), suffix) @@ -373,12 +374,12 @@ class AddPresetOperator(AddPresetBase, bpy.types.Operator): return os.path.join("operator", "%s.%s" % (prefix.lower(), suffix)) -class WM_MT_operator_presets(bpy.types.Menu): +class WM_MT_operator_presets(Menu): bl_label = _("Operator Presets") def draw(self, context): self.operator = context.space_data.operator.bl_idname - bpy.types.Menu.draw_preset(self, context) + Menu.draw_preset(self, context) @property def preset_subdir(self): diff --git a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py index ba0b1da45d1..32226ec0b1e 100644 --- a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py +++ b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py @@ -21,6 +21,7 @@ # Originally written by Matt Ebb import bpy +from bpy.types import Operator import os from blf import gettext as _ @@ -65,7 +66,7 @@ def guess_player_path(preset): return player_path -class PlayRenderedAnim(bpy.types.Operator): +class PlayRenderedAnim(Operator): '''Plays back rendered frames/movies using an external player.''' bl_idname = "render.play_rendered_anim" bl_label = _("Play Rendered Animation") diff --git a/release/scripts/startup/bl_operators/sequencer.py b/release/scripts/startup/bl_operators/sequencer.py index 1feec100295..44fb0b2efb4 100644 --- a/release/scripts/startup/bl_operators/sequencer.py +++ b/release/scripts/startup/bl_operators/sequencer.py @@ -19,12 +19,13 @@ # <pep8 compliant> import bpy +from bpy.types import Operator from bpy.props import IntProperty from blf import gettext as _ -class SequencerCrossfadeSounds(bpy.types.Operator): +class SequencerCrossfadeSounds(Operator): '''Do crossfading volume animation of two selected sound strips.''' bl_idname = "sequencer.crossfade_sounds" @@ -75,15 +76,19 @@ class SequencerCrossfadeSounds(bpy.types.Operator): return {'CANCELLED'} -class SequencerCutMulticam(bpy.types.Operator): +class SequencerCutMulticam(Operator): '''Cut multicam strip and select camera.''' bl_idname = "sequencer.cut_multicam" bl_label = _("Cut multicam") bl_options = {'REGISTER', 'UNDO'} - camera = IntProperty(name=_("Camera"), - default=1, min=1, max=32, soft_min=1, soft_max=32) + camera = IntProperty( + name=_("Camera"), + min=1, max=32, + soft_min=1, soft_max=32, + default=1, + ) @classmethod def poll(cls, context): @@ -113,7 +118,7 @@ class SequencerCutMulticam(bpy.types.Operator): return {'FINISHED'} -class SequencerDeinterlaceSelectedMovies(bpy.types.Operator): +class SequencerDeinterlaceSelectedMovies(Operator): '''Deinterlace all selected movie sources.''' bl_idname = "sequencer.deinterlace_selected_movies" diff --git a/release/scripts/startup/bl_operators/uvcalc_follow_active.py b/release/scripts/startup/bl_operators/uvcalc_follow_active.py index 43ca9af59ba..6c258d094e8 100644 --- a/release/scripts/startup/bl_operators/uvcalc_follow_active.py +++ b/release/scripts/startup/bl_operators/uvcalc_follow_active.py @@ -22,6 +22,7 @@ # http://mediawiki.blender.org/index.php/Scripts/Manual/UV_Calculate/Follow_active_quads import bpy +from bpy.types import Operator def extend(obj, operator, EXTEND_MODE): @@ -226,7 +227,7 @@ def main(context, operator): extend(obj, operator, operator.properties.mode) -class FollowActiveQuads(bpy.types.Operator): +class FollowActiveQuads(Operator): '''Follow UVs from active quads along continuous face loops''' bl_idname = "uv.follow_active_quads" bl_label = "Follow Active Quads" diff --git a/release/scripts/startup/bl_operators/uvcalc_lightmap.py b/release/scripts/startup/bl_operators/uvcalc_lightmap.py index 2f1acf0a5dc..060fe400045 100644 --- a/release/scripts/startup/bl_operators/uvcalc_lightmap.py +++ b/release/scripts/startup/bl_operators/uvcalc_lightmap.py @@ -19,11 +19,20 @@ # <pep8 compliant> import bpy +from bpy.types import Operator import mathutils class prettyface(object): - __slots__ = "uv", "width", "height", "children", "xoff", "yoff", "has_parent", "rot" + __slots__ = ("uv", + "width", + "height", + "children", + "xoff", + "yoff", + "has_parent", + "rot", + ) def __init__(self, data): self.has_parent = False @@ -263,10 +272,9 @@ def lightmap_uvpack(meshes, del trylens def trilensdiff(t1, t2): - return\ - abs(t1[1][t1[2][0]] - t2[1][t2[2][0]]) + \ - abs(t1[1][t1[2][1]] - t2[1][t2[2][1]]) + \ - abs(t1[1][t1[2][2]] - t2[1][t2[2][2]]) + return (abs(t1[1][t1[2][0]] - t2[1][t2[2][0]]) + + abs(t1[1][t1[2][1]] - t2[1][t2[2][1]]) + + abs(t1[1][t1[2][2]] - t2[1][t2[2][2]])) while tri_lengths: tri1 = tri_lengths.pop() @@ -536,29 +544,57 @@ def unwrap(operator, context, **kwargs): from bpy.props import BoolProperty, FloatProperty, IntProperty -class LightMapPack(bpy.types.Operator): +class LightMapPack(Operator): '''Follow UVs from active quads along continuous face loops''' bl_idname = "uv.lightmap_pack" bl_label = "Lightmap Pack" bl_options = {'REGISTER', 'UNDO'} PREF_CONTEXT = bpy.props.EnumProperty( + name="Selection", items=(("SEL_FACES", "Selected Faces", "Space all UVs evently"), ("ALL_FACES", "All Faces", "Average space UVs edge length of each loop"), ("ALL_OBJECTS", "Selected Mesh Object", "Average space UVs edge length of each loop") ), - name="Selection", - description="") + ) # Image & UVs... - PREF_PACK_IN_ONE = BoolProperty(name="Share Tex Space", default=True, description="Objects Share texture space, map all objects into 1 uvmap") - PREF_NEW_UVLAYER = BoolProperty(name="New UV Layer", default=False, description="Create a new UV layer for every mesh packed") - PREF_APPLY_IMAGE = BoolProperty(name="New Image", default=False, description="Assign new images for every mesh (only one if shared tex space enabled)") - PREF_IMG_PX_SIZE = IntProperty(name="Image Size", min=64, max=5000, default=512, description="Width and Height for the new image") - + PREF_PACK_IN_ONE = BoolProperty( + name="Share Tex Space", + description=("Objects Share texture space, map all objects " + "into 1 uvmap"), + default=True, + ) + PREF_NEW_UVLAYER = BoolProperty( + name="New UV Layer", + description="Create a new UV layer for every mesh packed", + default=False, + ) + PREF_APPLY_IMAGE = BoolProperty( + name="New Image", + description=("Assign new images for every mesh (only one if " + "shared tex space enabled)"), + default=False, + ) + PREF_IMG_PX_SIZE = IntProperty( + name="Image Size", + description="Width and Height for the new image", + min=64, max=5000, + default=512, + ) # UV Packing... - PREF_BOX_DIV = IntProperty(name="Pack Quality", min=1, max=48, default=12, description="Pre Packing before the complex boxpack") - PREF_MARGIN_DIV = FloatProperty(name="Margin", min=0.001, max=1.0, default=0.1, description="Size of the margin as a division of the UV") + PREF_BOX_DIV = IntProperty( + name="Pack Quality", + description="Pre Packing before the complex boxpack", + min=1, max=48, + default=12, + ) + PREF_MARGIN_DIV = FloatProperty( + name="Margin", + description="Size of the margin as a division of the UV", + min=0.001, max=1.0, + default=0.1, + ) def execute(self, context): kwargs = self.as_keywords() diff --git a/release/scripts/startup/bl_operators/uvcalc_smart_project.py b/release/scripts/startup/bl_operators/uvcalc_smart_project.py index 851f33bde11..23838588f43 100644 --- a/release/scripts/startup/bl_operators/uvcalc_smart_project.py +++ b/release/scripts/startup/bl_operators/uvcalc_smart_project.py @@ -20,6 +20,7 @@ from mathutils import Matrix, Vector, geometry import bpy +from bpy.types import Operator DEG_TO_RAD = 0.017453292519943295 # pi/180.0 SMALL_NUM = 0.000000001 @@ -177,7 +178,7 @@ def pointInEdges(pt, edges): intersectCount = 0 for ed in edges: xi, yi = lineIntersection2D(x1,y1, x2,y2, ed[0][0], ed[0][1], ed[1][0], ed[1][1]) - if xi != None: # Is there an intersection. + if xi is not None: # Is there an intersection. intersectCount+=1 return intersectCount % 2 @@ -812,39 +813,26 @@ def main(context, global RotMatStepRotation main_consts() - # TODO, all selected meshes - ''' - # objects = context.selected_editable_objects - objects = [] - - # we can will tag them later. - obList = [ob for ob in objects if ob.type == 'MESH'] - - # Face select object may not be selected. - ob = context.active_object - - if ob and (not ob.select) and ob.type == 'MESH': - # Add to the list - obList =[ob] - del objects - ''' + # Create the variables. + USER_PROJECTION_LIMIT = projection_limit + USER_ONLY_SELECTED_FACES = True + USER_SHARE_SPACE = 1 # Only for hole filling. + USER_STRETCH_ASPECT = 1 # Only for hole filling. + USER_ISLAND_MARGIN = island_margin # Only for hole filling. + USER_FILL_HOLES = 0 + USER_FILL_HOLES_QUALITY = 50 # Only for hole filling. + USER_VIEW_INIT = 0 # Only for hole filling. - # quick workaround - obList = [ob for ob in [context.active_object] if ob and ob.type == 'MESH'] + is_editmode = (context.active_object.mode == 'EDIT') + if is_editmode: + obList = [ob for ob in [context.active_object] if ob and ob.type == 'MESH'] + else: + obList = [ob for ob in context.selected_editable_objects if ob and ob.type == 'MESH'] + USER_ONLY_SELECTED_FACES = False if not obList: raise('error, no selected mesh objects') - # Create the variables. - USER_PROJECTION_LIMIT = projection_limit - USER_ONLY_SELECTED_FACES = (1) - USER_SHARE_SPACE = (1) # Only for hole filling. - USER_STRETCH_ASPECT = (1) # Only for hole filling. - USER_ISLAND_MARGIN = island_margin # Only for hole filling. - USER_FILL_HOLES = (0) - USER_FILL_HOLES_QUALITY = (50) # Only for hole filling. - USER_VIEW_INIT = (0) # Only for hole filling. - # Reuse variable if len(obList) == 1: ob = "Unwrap %i Selected Mesh" @@ -905,8 +893,8 @@ def main(context, if USER_ONLY_SELECTED_FACES: meshFaces = [thickface(f, uv_layer[i], me_verts) for i, f in enumerate(me.faces) if f.select] - #else: - # meshFaces = map(thickface, me.faces) + else: + meshFaces = [thickface(f, uv_layer[i], me_verts) for i, f in enumerate(me.faces)] if not meshFaces: continue @@ -921,7 +909,7 @@ def main(context, # meshFaces = [] # meshFaces.sort( lambda a, b: cmp(b.area , a.area) ) # Biggest first. - meshFaces.sort( key = lambda a: -a.area ) + meshFaces.sort(key=lambda a: -a.area) # remove all zero area faces while meshFaces and meshFaces[-1].area <= SMALL_NUM: @@ -1116,27 +1104,34 @@ def main(context, from bpy.props import FloatProperty -class SmartProject(bpy.types.Operator): +class SmartProject(Operator): '''This script projection unwraps the selected faces of a mesh. it operates on all selected mesh objects, and can be used unwrap selected faces, or all faces.''' bl_idname = "uv.smart_project" bl_label = "Smart UV Project" bl_options = {'REGISTER', 'UNDO'} - angle_limit = FloatProperty(name="Angle Limit", + angle_limit = FloatProperty( + name="Angle Limit", description="lower for more projection groups, higher for less distortion", - default=66.0, min=1.0, max=89.0) - - island_margin = FloatProperty(name="Island Margin", + min=1.0, max=89.0, + default=66.0, + ) + island_margin = FloatProperty( + name="Island Margin", description="Margin to reduce bleed from adjacent islands", - default=0.0, min=0.0, max=1.0) - - user_area_weight = FloatProperty(name="Area Weight", + min=0.0, max=1.0, + default=0.0, + ) + user_area_weight = FloatProperty( + name="Area Weight", description="Weight projections vector by faces with larger areas", - default=0.0, min=0.0, max=1.0) + min=0.0, max=1.0, + default=0.0, + ) @classmethod def poll(cls, context): - return context.active_object != None + return context.active_object is not None def execute(self, context): main(context, diff --git a/release/scripts/startup/bl_operators/vertexpaint_dirt.py b/release/scripts/startup/bl_operators/vertexpaint_dirt.py index 672db71e361..4c78adb7161 100644 --- a/release/scripts/startup/bl_operators/vertexpaint_dirt.py +++ b/release/scripts/startup/bl_operators/vertexpaint_dirt.py @@ -142,19 +142,44 @@ def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean, import bpy +from bpy.types import Operator from bpy.props import FloatProperty, IntProperty, BoolProperty -class VertexPaintDirt(bpy.types.Operator): +class VertexPaintDirt(Operator): bl_idname = "paint.vertex_color_dirt" bl_label = "Dirty Vertex Colors" bl_options = {'REGISTER', 'UNDO'} - blur_strength = FloatProperty(name="Blur Strength", description="Blur strength per iteration", default=1.0, min=0.01, max=1.0) - blur_iterations = IntProperty(name="Blur Iterations", description="Number times to blur the colors. (higher blurs more)", default=1, min=0, max=40) - clean_angle = FloatProperty(name="Highlight Angle", description="Less then 90 limits the angle used in the tonal range", default=180.0, min=0.0, max=180.0) - dirt_angle = FloatProperty(name="Dirt Angle", description="Less then 90 limits the angle used in the tonal range", default=0.0, min=0.0, max=180.0) - dirt_only = BoolProperty(name="Dirt Only", description="Dont calculate cleans for convex areas", default=False) + blur_strength = FloatProperty( + name="Blur Strength", + description="Blur strength per iteration", + min=0.01, max=1.0, + default=1.0, + ) + blur_iterations = IntProperty( + name="Blur Iterations", + description="Number times to blur the colors. (higher blurs more)", + min=0, max=40, + default=1, + ) + clean_angle = FloatProperty( + name="Highlight Angle", + description="Less then 90 limits the angle used in the tonal range", + min=0.0, max=180.0, + default=180.0, + ) + dirt_angle = FloatProperty( + name="Dirt Angle", + description="Less then 90 limits the angle used in the tonal range", + min=0.0, max=180.0, + default=0.0, + ) + dirt_only = BoolProperty( + name="Dirt Only", + description="Dont calculate cleans for convex areas", + default=False, + ) def execute(self, context): import time diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index f63fc50b254..4f37d0287e3 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -19,14 +19,19 @@ # <pep8 compliant> import bpy -from bpy.props import StringProperty, BoolProperty, IntProperty, \ - FloatProperty, EnumProperty +from bpy.types import Menu, Operator +from bpy.props import (StringProperty, + BoolProperty, + IntProperty, + FloatProperty, + EnumProperty, + ) from rna_prop_ui import rna_idprop_ui_prop_get, rna_idprop_ui_prop_clear from blf import gettext as _ -class MESH_OT_delete_edgeloop(bpy.types.Operator): +class MESH_OT_delete_edgeloop(Operator): '''Delete an edge loop by merging the faces on each side to a single face loop''' bl_idname = "mesh.delete_edgeloop" bl_label = _("Delete Edge Loop") @@ -39,23 +44,30 @@ class MESH_OT_delete_edgeloop(bpy.types.Operator): return {'CANCELLED'} -rna_path_prop = StringProperty(name=_("Context Attributes"), - description=_("rna context string"), maxlen=1024, default="") +rna_path_prop = StringProperty( + name=_("Context Attributes"), + description=_("rna context string"), + maxlen=1024, + ) -rna_reverse_prop = BoolProperty(name=_("Reverse"), - description=_("Cycle backwards"), default=False) +rna_reverse_prop = BoolProperty( + name=_("Reverse"), + description=_("Cycle backwards"), + default=False, + ) -rna_relative_prop = BoolProperty(name=_("Relative"), +rna_relative_prop = BoolProperty( + name=_("Relative"), description=_("Apply relative to the current value (delta)"), - default=False) + default=False, + ) def context_path_validate(context, data_path): - import sys try: value = eval("context.%s" % data_path) if data_path else Ellipsis - except AttributeError: - if "'NoneType'" in str(sys.exc_info()[1]): + except AttributeError as e: + if str(e).startswith("'NoneType'"): # One of the items in the rna path is None, just ignore this value = Ellipsis else: @@ -65,32 +77,87 @@ def context_path_validate(context, data_path): return value +def operator_value_is_undo(value): + if value in {None, Ellipsis}: + return False + + # typical properties or objects + id_data = getattr(value, "id_data", Ellipsis) + + if id_data is None: + return False + elif id_data is Ellipsis: + # handle mathutils types + id_data = getattr(getattr(value, "owner", None), "id_data", None) + + if id_data is None: + return False + + # return True if its a non window ID type + return (isinstance(id_data, bpy.types.ID) and + (not isinstance(id_data, (bpy.types.WindowManager, + bpy.types.Screen, + bpy.types.Scene, + bpy.types.Brush, + )))) + + +def operator_path_is_undo(context, data_path): + # note that if we have data paths that use strings this could fail + # luckily we dont do this! + # + # When we cant find the data owner assume no undo is needed. + data_path_head, data_path_sep, data_path_tail = data_path.rpartition(".") + + if not data_path_head: + return False + + value = context_path_validate(context, data_path_head) + + return operator_value_is_undo(value) + + +def operator_path_undo_return(context, data_path): + return {'FINISHED'} if operator_path_is_undo(context, data_path) else {'CANCELLED'} + + +def operator_value_undo_return(value): + return {'FINISHED'} if operator_value_is_undo(value) else {'CANCELLED'} + + def execute_context_assign(self, context): - if context_path_validate(context, self.data_path) is Ellipsis: + data_path = self.data_path + if context_path_validate(context, data_path) is Ellipsis: return {'PASS_THROUGH'} if getattr(self, "relative", False): - exec("context.%s+=self.value" % self.data_path) + exec("context.%s += self.value" % data_path) else: - exec("context.%s=self.value" % self.data_path) + exec("context.%s = self.value" % data_path) - return {'FINISHED'} + return operator_path_undo_return(context, data_path) -class BRUSH_OT_active_index_set(bpy.types.Operator): +class BRUSH_OT_active_index_set(Operator): '''Set active sculpt/paint brush from it's number''' bl_idname = "brush.active_index_set" bl_label = _("Set Brush Number") - mode = StringProperty(name=_("mode"), - description=_("Paint mode to set brush for"), maxlen=1024) - index = IntProperty(name=_("number"), - description=_("Brush number")) + mode = StringProperty( + name=_("mode"), + description=_("Paint mode to set brush for"), + maxlen=1024, + ) + index = IntProperty( + name=_("number"), + description=_("Brush number"), + ) _attr_dict = {"sculpt": "use_paint_sculpt", "vertex_paint": "use_paint_vertex", "weight_paint": "use_paint_weight", - "image_paint": "use_paint_image"} + "image_paint": "use_paint_image", + } def execute(self, context): attr = self._attr_dict.get(self.mode) @@ -105,50 +172,63 @@ class BRUSH_OT_active_index_set(bpy.types.Operator): return {'CANCELLED'} -class WM_OT_context_set_boolean(bpy.types.Operator): +class WM_OT_context_set_boolean(Operator): '''Set a context value.''' bl_idname = "wm.context_set_boolean" bl_label = _("Context Set Boolean") bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop - value = BoolProperty(name=_("Value"), - description=_("Assignment value"), default=True) + value = BoolProperty( + name=_("Value"), + description=_("Assignment value"), + default=True, + ) execute = execute_context_assign -class WM_OT_context_set_int(bpy.types.Operator): # same as enum +class WM_OT_context_set_int(Operator): # same as enum '''Set a context value.''' bl_idname = "wm.context_set_int" bl_label = _("Context Set") bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop - value = IntProperty(name=_("Value"), description=_("Assign value"), default=0) + value = IntProperty( + name=_("Value"), + description=_("Assign value"), + default=0, + ) relative = rna_relative_prop execute = execute_context_assign -class WM_OT_context_scale_int(bpy.types.Operator): +class WM_OT_context_scale_int(Operator): '''Scale an int context value.''' bl_idname = "wm.context_scale_int" bl_label = _("Context Set") bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop - value = FloatProperty(name=_("Value"), description=_("Assign value"), default=1.0) - always_step = BoolProperty(name=_("Always Step"), - description=_("Always adjust the value by a minimum of 1 when 'value' is not 1.0."), - default=True) + value = FloatProperty( + name=_("Value"), + description=_("Assign value"), + default=1.0, + ) + always_step = BoolProperty( + name=_("Always Step"), + description=_("Always adjust the value by a minimum of 1 when 'value' is not 1.0."), + default=True, + ) def execute(self, context): - if context_path_validate(context, self.data_path) is Ellipsis: + data_path = self.data_path + if context_path_validate(context, data_path) is Ellipsis: return {'PASS_THROUGH'} value = self.value - data_path = self.data_path if value == 1.0: # nothing to do return {'CANCELLED'} @@ -160,73 +240,85 @@ class WM_OT_context_scale_int(bpy.types.Operator): else: add = "-1" func = "min" - exec("context.%s = %s(round(context.%s * value), context.%s + %s)" % (data_path, func, data_path, data_path, add)) + exec("context.%s = %s(round(context.%s * value), context.%s + %s)" % + (data_path, func, data_path, data_path, add)) else: - exec("context.%s *= value" % self.data_path) + exec("context.%s *= value" % data_path) - return {'FINISHED'} + return operator_path_undo_return(context, data_path) -class WM_OT_context_set_float(bpy.types.Operator): # same as enum +class WM_OT_context_set_float(Operator): # same as enum '''Set a context value.''' bl_idname = "wm.context_set_float" bl_label = _("Context Set Float") bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop - value = FloatProperty(name=_("Value"), - description=_("Assignment value"), default=0.0) + value = FloatProperty( + name=_("Value"), + description=_("Assignment value"), + default=0.0, + ) relative = rna_relative_prop execute = execute_context_assign -class WM_OT_context_set_string(bpy.types.Operator): # same as enum +class WM_OT_context_set_string(Operator): # same as enum '''Set a context value.''' bl_idname = "wm.context_set_string" bl_label = _("Context Set String") bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop - value = StringProperty(name=_("Value"), - description=_("Assign value"), maxlen=1024, default="") + value = StringProperty( + name=_("Value"), + description=_("Assign value"), + maxlen=1024, + ) execute = execute_context_assign -class WM_OT_context_set_enum(bpy.types.Operator): +class WM_OT_context_set_enum(Operator): '''Set a context value.''' bl_idname = "wm.context_set_enum" bl_label = _("Context Set Enum") bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop - value = StringProperty(name=_("Value"), + value = StringProperty( + name=_("Value"), description=_("Assignment value (as a string)"), - maxlen=1024, default="") + maxlen=1024, + ) execute = execute_context_assign -class WM_OT_context_set_value(bpy.types.Operator): +class WM_OT_context_set_value(Operator): '''Set a context value.''' bl_idname = "wm.context_set_value" bl_label = _("Context Set Value") bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop - value = StringProperty(name=_("Value"), + value = StringProperty( + name=_("Value"), description=_("Assignment value (as a string)"), - maxlen=1024, default="") + maxlen=1024, + ) def execute(self, context): - if context_path_validate(context, self.data_path) is Ellipsis: + data_path = self.data_path + if context_path_validate(context, data_path) is Ellipsis: return {'PASS_THROUGH'} - exec("context.%s=%s" % (self.data_path, self.value)) - return {'FINISHED'} + exec("context.%s = %s" % (data_path, self.value)) + return operator_path_undo_return(context, data_path) -class WM_OT_context_toggle(bpy.types.Operator): +class WM_OT_context_toggle(Operator): '''Toggle a context value.''' bl_idname = "wm.context_toggle" bl_label = _("Context Toggle") @@ -235,43 +327,50 @@ class WM_OT_context_toggle(bpy.types.Operator): data_path = rna_path_prop def execute(self, context): + data_path = self.data_path - if context_path_validate(context, self.data_path) is Ellipsis: + if context_path_validate(context, data_path) is Ellipsis: return {'PASS_THROUGH'} - exec("context.%s=not (context.%s)" % - (self.data_path, self.data_path)) + exec("context.%s = not (context.%s)" % (data_path, data_path)) - return {'FINISHED'} + return operator_path_undo_return(context, data_path) -class WM_OT_context_toggle_enum(bpy.types.Operator): +class WM_OT_context_toggle_enum(Operator): '''Toggle a context value.''' bl_idname = "wm.context_toggle_enum" bl_label = _("Context Toggle Values") bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop - value_1 = StringProperty(name=_("Value"), \ - description=_("Toggle enum"), maxlen=1024, default="") - - value_2 = StringProperty(name=_("Value"), \ - description=_("Toggle enum"), maxlen=1024, default="") + value_1 = StringProperty( + name=_("Value"), + description=_("Toggle enum"), + maxlen=1024, + ) + value_2 = StringProperty( + name=_("Value"), + description=_("Toggle enum"), + maxlen=1024, + ) def execute(self, context): + data_path = self.data_path - if context_path_validate(context, self.data_path) is Ellipsis: + if context_path_validate(context, data_path) is Ellipsis: return {'PASS_THROUGH'} - exec("context.%s = ['%s', '%s'][context.%s!='%s']" % \ - (self.data_path, self.value_1,\ - self.value_2, self.data_path, - self.value_2)) + exec("context.%s = ('%s', '%s')[context.%s != '%s']" % + (data_path, self.value_1, + self.value_2, data_path, + self.value_2, + )) - return {'FINISHED'} + return operator_path_undo_return(context, data_path) -class WM_OT_context_cycle_int(bpy.types.Operator): +class WM_OT_context_cycle_int(Operator): '''Set a context value. Useful for cycling active material, ''' '''vertex keys, groups' etc.''' bl_idname = "wm.context_cycle_int" @@ -292,7 +391,7 @@ class WM_OT_context_cycle_int(bpy.types.Operator): else: value += 1 - exec("context.%s=value" % data_path) + exec("context.%s = value" % data_path) if value != eval("context.%s" % data_path): # relies on rna clamping int's out of the range @@ -301,12 +400,12 @@ class WM_OT_context_cycle_int(bpy.types.Operator): else: value = -1 << 31 - exec("context.%s=value" % data_path) + exec("context.%s = value" % data_path) - return {'FINISHED'} + return operator_path_undo_return(context, data_path) -class WM_OT_context_cycle_enum(bpy.types.Operator): +class WM_OT_context_cycle_enum(Operator): '''Toggle a context value.''' bl_idname = "wm.context_cycle_enum" bl_label = _("Context Enum Cycle") @@ -316,15 +415,15 @@ class WM_OT_context_cycle_enum(bpy.types.Operator): reverse = rna_reverse_prop def execute(self, context): - - value = context_path_validate(context, self.data_path) + data_path = self.data_path + value = context_path_validate(context, data_path) if value is Ellipsis: return {'PASS_THROUGH'} orig_value = value # Have to get rna enum values - rna_struct_str, rna_prop_str = self.data_path.rsplit('.', 1) + rna_struct_str, rna_prop_str = data_path.rsplit('.', 1) i = rna_prop_str.find('[') # just incse we get "context.foo.bar[0]" @@ -354,11 +453,11 @@ class WM_OT_context_cycle_enum(bpy.types.Operator): advance_enum = enums[orig_index + 1] # set the new value - exec("context.%s=advance_enum" % self.data_path) - return {'FINISHED'} + exec("context.%s = advance_enum" % data_path) + return operator_path_undo_return(context, data_path) -class WM_OT_context_cycle_array(bpy.types.Operator): +class WM_OT_context_cycle_array(Operator): '''Set a context array value. Useful for cycling the active mesh edit mode.''' bl_idname = "wm.context_cycle_array" @@ -381,12 +480,12 @@ class WM_OT_context_cycle_array(bpy.types.Operator): array.append(array.pop(0)) return array - exec("context.%s=cycle(context.%s[:])" % (data_path, data_path)) + exec("context.%s = cycle(context.%s[:])" % (data_path, data_path)) - return {'FINISHED'} + return operator_path_undo_return(context, data_path) -class WM_MT_context_menu_enum(bpy.types.Menu): +class WM_MT_context_menu_enum(Menu): bl_label = "" data_path = "" # BAD DESIGN, set from operator below. @@ -406,7 +505,7 @@ class WM_MT_context_menu_enum(bpy.types.Menu): prop.value = identifier -class WM_OT_context_menu_enum(bpy.types.Operator): +class WM_OT_context_menu_enum(Operator): bl_idname = "wm.context_menu_enum" bl_label = _("Context Enum Menu") bl_options = {'UNDO', 'INTERNAL'} @@ -419,15 +518,18 @@ class WM_OT_context_menu_enum(bpy.types.Operator): return {'PASS_THROUGH'} -class WM_OT_context_set_id(bpy.types.Operator): +class WM_OT_context_set_id(Operator): '''Toggle a context value.''' bl_idname = "wm.context_set_id" bl_label = _("Set Library ID") bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop - value = StringProperty(name=_("Value"), - description=_("Assign value"), maxlen=1024, default="") + value = StringProperty( + name=_("Value"), + description=_("Assign value"), + maxlen=1024, + ) def execute(self, context): value = self.value @@ -449,16 +551,21 @@ class WM_OT_context_set_id(bpy.types.Operator): if id_iter: value_id = getattr(bpy.data, id_iter).get(value) - exec("context.%s=value_id" % data_path) + exec("context.%s = value_id" % data_path) - return {'FINISHED'} + return operator_path_undo_return(context, data_path) -doc_id = StringProperty(name=_("Doc ID"), - description="", maxlen=1024, default="", options={'HIDDEN'}) +doc_id = StringProperty( + name=_("Doc ID"), + maxlen=1024, + options={'HIDDEN'}, + ) -doc_new = StringProperty(name=_("Edit Description"), - description="", maxlen=1024, default="") +doc_new = StringProperty( + name=_("Edit Description"), + maxlen=1024, + ) data_path_iter = StringProperty( description="The data path relative to the context, must point to an iterable.") @@ -467,7 +574,7 @@ data_path_item = StringProperty( description="The data path from each iterable to the value (int or float)") -class WM_OT_context_collection_boolean_set(bpy.types.Operator): +class WM_OT_context_collection_boolean_set(Operator): '''Set boolean values for a collection of items''' bl_idname = "wm.context_collection_boolean_set" bl_label = "Context Collection Boolean Set" @@ -476,12 +583,13 @@ class WM_OT_context_collection_boolean_set(bpy.types.Operator): data_path_iter = data_path_iter data_path_item = data_path_item - type = EnumProperty(items=( - ('TOGGLE', "Toggle", ""), - ('ENABLE', "Enable", ""), - ('DISABLE', "Disable", ""), - ), - name="Type") + type = EnumProperty( + name="Type", + items=(('TOGGLE', "Toggle", ""), + ('ENABLE', "Enable", ""), + ('DISABLE', "Disable", ""), + ), + ) def execute(self, context): data_path_iter = self.data_path_iter @@ -507,6 +615,10 @@ class WM_OT_context_collection_boolean_set(bpy.types.Operator): items_ok.append(item) + # avoid undo push when nothing to do + if not items_ok: + return {'CANCELLED'} + if self.type == 'ENABLE': is_set = True elif self.type == 'DISABLE': @@ -518,20 +630,26 @@ class WM_OT_context_collection_boolean_set(bpy.types.Operator): for item in items_ok: exec(exec_str) - return {'FINISHED'} + return operator_value_undo_return(item) -class WM_OT_context_modal_mouse(bpy.types.Operator): +class WM_OT_context_modal_mouse(Operator): '''Adjust arbitrary values with mouse input''' bl_idname = "wm.context_modal_mouse" bl_label = _("Context Modal Mouse") - bl_options = {'GRAB_POINTER', 'BLOCKING', 'INTERNAL'} + bl_options = {'GRAB_POINTER', 'BLOCKING', 'UNDO', 'INTERNAL'} data_path_iter = data_path_iter data_path_item = data_path_item - input_scale = FloatProperty(default=0.01, description=_("Scale the mouse movement by this value before applying the delta")) - invert = BoolProperty(default=False, description=_("Invert the mouse input")) + input_scale = FloatProperty( + description=_("Scale the mouse movement by this value before applying the delta"), + default=0.01, + ) + invert = BoolProperty( + description=_("Invert the mouse input"), + default=False, + ) initial_x = IntProperty(options={'HIDDEN'}) def _values_store(self, context): @@ -584,12 +702,13 @@ class WM_OT_context_modal_mouse(bpy.types.Operator): self._values_delta(delta) elif 'LEFTMOUSE' == event_type: + item = next(iter(self._values.keys())) self._values_clear() - return {'FINISHED'} + return operator_value_undo_return(item) elif event_type in {'RIGHTMOUSE', 'ESC'}: self._values_restore() - return {'FINISHED'} + return {'CANCELLED'} return {'RUNNING_MODAL'} @@ -608,27 +727,33 @@ class WM_OT_context_modal_mouse(bpy.types.Operator): return {'RUNNING_MODAL'} -class WM_OT_url_open(bpy.types.Operator): +class WM_OT_url_open(Operator): "Open a website in the Webbrowser" __doc__ = _("Open a website in the Webbrowser") bl_idname = "wm.url_open" bl_label = "" - url = StringProperty(name="URL", description=_("URL to open")) + url = StringProperty( + name="URL", + description="URL to open", + ) def execute(self, context): import webbrowser - _webbrowser_bug_fix() webbrowser.open(self.url) return {'FINISHED'} -class WM_OT_path_open(bpy.types.Operator): +class WM_OT_path_open(Operator): "Open a path in a file browser" bl_idname = "wm.path_open" bl_label = "" - filepath = StringProperty(name=_("File Path"), maxlen=1024, subtype='FILE_PATH') + filepath = StringProperty( + name=_("File Path"), + maxlen=1024, + subtype='FILE_PATH', + ) def execute(self, context): import sys @@ -656,16 +781,18 @@ class WM_OT_path_open(bpy.types.Operator): return {'FINISHED'} -class WM_OT_doc_view(bpy.types.Operator): +class WM_OT_doc_view(Operator): '''Load online reference docs''' bl_idname = "wm.doc_view" bl_label = _("View Documentation") doc_id = doc_id if bpy.app.version_cycle == "release": - _prefix = "http://www.blender.org/documentation/blender_python_api_%s%s_release" % ("_".join(str(v) for v in bpy.app.version[:2]), bpy.app.version_char) + _prefix = ("http://www.blender.org/documentation/blender_python_api_%s%s_release" % + ("_".join(str(v) for v in bpy.app.version[:2]), bpy.app.version_char)) else: - _prefix = "http://www.blender.org/documentation/blender_python_api_%s" % "_".join(str(v) for v in bpy.app.version) + _prefix = ("http://www.blender.org/documentation/blender_python_api_%s" % + "_".join(str(v) for v in bpy.app.version)) def _nested_class_string(self, class_string): ls = [] @@ -683,8 +810,8 @@ class WM_OT_doc_view(bpy.types.Operator): class_name, class_prop = id_split if hasattr(bpy.types, class_name.upper() + '_OT_' + class_prop): - url = '%s/bpy.ops.%s.html#bpy.ops.%s.%s' % \ - (self._prefix, class_name, class_name, class_prop) + url = ("%s/bpy.ops.%s.html#bpy.ops.%s.%s" % + (self._prefix, class_name, class_name, class_prop)) else: # detect if this is a inherited member and use that name instead @@ -697,20 +824,19 @@ class WM_OT_doc_view(bpy.types.Operator): # It so happens that epydoc nests these, not sphinx # class_name_full = self._nested_class_string(class_name) - url = '%s/bpy.types.%s.html#bpy.types.%s.%s' % \ - (self._prefix, class_name, class_name, class_prop) + url = ("%s/bpy.types.%s.html#bpy.types.%s.%s" % + (self._prefix, class_name, class_name, class_prop)) else: return {'PASS_THROUGH'} import webbrowser - _webbrowser_bug_fix() webbrowser.open(url) return {'FINISHED'} -class WM_OT_doc_edit(bpy.types.Operator): +class WM_OT_doc_edit(Operator): '''Load online reference docs''' bl_idname = "wm.doc_edit" bl_label = _("Edit Documentation") @@ -781,20 +907,39 @@ class WM_OT_doc_edit(bpy.types.Operator): return wm.invoke_props_dialog(self, width=600) -rna_path = StringProperty(name=_("Property Edit"), - description=_("Property data_path edit"), maxlen=1024, default="", options={'HIDDEN'}) +rna_path = StringProperty( + name=_("Property Edit"), + description=_("Property data_path edit"), + maxlen=1024, + options={'HIDDEN'}, + ) + +rna_value = StringProperty( + name=_("Property Value"), + description=_("Property value edit"), + maxlen=1024, + ) -rna_value = StringProperty(name=_("Property Value"), - description=_("Property value edit"), maxlen=1024, default="") +rna_property = StringProperty( + name=_("Property Name"), + description=_("Property name edit"), + maxlen=1024, + ) -rna_property = StringProperty(name=_("Property Name"), - description=_("Property name edit"), maxlen=1024, default="") +rna_min = FloatProperty( + name=_("Min"), + default=0.0, + precision=3, + ) -rna_min = FloatProperty(name=_("Min"), default=0.0, precision=3) -rna_max = FloatProperty(name=_("Max"), default=1.0, precision=3) +rna_max = FloatProperty( + name="Max", + default=1.0, + precision=3, + ) -class WM_OT_properties_edit(bpy.types.Operator): +class WM_OT_properties_edit(Operator): '''Internal use (edit a property data_path)''' bl_idname = "wm.properties_edit" bl_label = _("Edit Property") @@ -806,7 +951,9 @@ class WM_OT_properties_edit(bpy.types.Operator): value = rna_value min = rna_min max = rna_max - description = StringProperty(name=_("Tip"), default="") + description = StringProperty( + name=_("Tip"), + ) def execute(self, context): data_path = self.data_path @@ -859,14 +1006,15 @@ class WM_OT_properties_edit(bpy.types.Operator): return {'FINISHED'} def invoke(self, context, event): + data_path = self.data_path - if not self.data_path: + if not data_path: self.report({'ERROR'}, "Data path not set") return {'CANCELLED'} self._last_prop = [self.property] - item = eval("context.%s" % self.data_path) + item = eval("context.%s" % data_path) # setup defaults prop_ui = rna_idprop_ui_prop_get(item, self.property, False) # dont create @@ -879,7 +1027,7 @@ class WM_OT_properties_edit(bpy.types.Operator): return wm.invoke_props_dialog(self) -class WM_OT_properties_add(bpy.types.Operator): +class WM_OT_properties_add(Operator): '''Internal use (edit a property data_path)''' bl_idname = "wm.properties_add" bl_label = _("Add Property") @@ -888,7 +1036,8 @@ class WM_OT_properties_add(bpy.types.Operator): data_path = rna_path def execute(self, context): - item = eval("context.%s" % self.data_path) + data_path = self.data_path + item = eval("context.%s" % data_path) def unique_name(names): prop = 'prop' @@ -906,19 +1055,22 @@ class WM_OT_properties_add(bpy.types.Operator): return {'FINISHED'} -class WM_OT_properties_context_change(bpy.types.Operator): +class WM_OT_properties_context_change(Operator): "Change the context tab in a Properties Window" bl_idname = "wm.properties_context_change" bl_label = "" - context = StringProperty(name=_("Context"), maxlen=32) + context = StringProperty( + name=_("Context"), + maxlen=32, + ) def execute(self, context): - context.space_data.context = (self.context) + context.space_data.context = self.context return {'FINISHED'} -class WM_OT_properties_remove(bpy.types.Operator): +class WM_OT_properties_remove(Operator): '''Internal use (edit a property data_path)''' bl_idname = "wm.properties_remove" bl_label = _("Remove Property") @@ -928,23 +1080,27 @@ class WM_OT_properties_remove(bpy.types.Operator): property = rna_property def execute(self, context): - item = eval("context.%s" % self.data_path) + data_path = self.data_path + item = eval("context.%s" % data_path) del item[self.property] return {'FINISHED'} -class WM_OT_keyconfig_activate(bpy.types.Operator): +class WM_OT_keyconfig_activate(Operator): bl_idname = "wm.keyconfig_activate" bl_label = _("Activate Keyconfig") - filepath = StringProperty(name=_("File Path"), maxlen=1024) + filepath = StringProperty( + name=_("File Path"), + maxlen=1024, + ) def execute(self, context): bpy.utils.keyconfig_set(self.filepath) return {'FINISHED'} -class WM_OT_appconfig_default(bpy.types.Operator): +class WM_OT_appconfig_default(Operator): bl_idname = "wm.appconfig_default" bl_label = _("Default Application Configuration") @@ -961,11 +1117,14 @@ class WM_OT_appconfig_default(bpy.types.Operator): return {'FINISHED'} -class WM_OT_appconfig_activate(bpy.types.Operator): +class WM_OT_appconfig_activate(Operator): bl_idname = "wm.appconfig_activate" bl_label = _("Activate Application Configuration") - filepath = StringProperty(name="File Path", maxlen=1024) + filepath = StringProperty( + name="File Path", + maxlen=1024, + ) def execute(self, context): import os @@ -979,7 +1138,7 @@ class WM_OT_appconfig_activate(bpy.types.Operator): return {'FINISHED'} -class WM_OT_sysinfo(bpy.types.Operator): +class WM_OT_sysinfo(Operator): '''Generate System Info''' bl_idname = "wm.sysinfo" bl_label = _("System Info") @@ -991,7 +1150,7 @@ class WM_OT_sysinfo(bpy.types.Operator): return {'FINISHED'} -class WM_OT_copy_prev_settings(bpy.types.Operator): +class WM_OT_copy_prev_settings(Operator): '''Copy settings from previous version''' bl_idname = "wm.copy_prev_settings" bl_label = _("Copy Previous Settings") @@ -1026,65 +1185,3 @@ class WM_OT_copy_prev_settings(bpy.types.Operator): return {'FINISHED'} return {'CANCELLED'} - - -def _webbrowser_bug_fix(): - # test for X11 - import os - - if os.environ.get("DISPLAY"): - - # BSD licenced code copied from python, temp fix for bug - # http://bugs.python.org/issue11432, XXX == added code - def _invoke(self, args, remote, autoraise): - # XXX, added imports - import io - import subprocess - import time - - raise_opt = [] - if remote and self.raise_opts: - # use autoraise argument only for remote invocation - autoraise = int(autoraise) - opt = self.raise_opts[autoraise] - if opt: - raise_opt = [opt] - - cmdline = [self.name] + raise_opt + args - - if remote or self.background: - inout = io.open(os.devnull, "r+") - else: - # for TTY browsers, we need stdin/out - inout = None - # if possible, put browser in separate process group, so - # keyboard interrupts don't affect browser as well as Python - setsid = getattr(os, 'setsid', None) - if not setsid: - setsid = getattr(os, 'setpgrp', None) - - p = subprocess.Popen(cmdline, close_fds=True, # XXX, stdin=inout, - stdout=(self.redirect_stdout and inout or None), - stderr=inout, preexec_fn=setsid) - if remote: - # wait five secons. If the subprocess is not finished, the - # remote invocation has (hopefully) started a new instance. - time.sleep(1) - rc = p.poll() - if rc is None: - time.sleep(4) - rc = p.poll() - if rc is None: - return True - # if remote call failed, open() will try direct invocation - return not rc - elif self.background: - if p.poll() is None: - return True - else: - return False - else: - return not p.wait() - - import webbrowser - webbrowser.UnixBrowser._invoke = _invoke diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py index bf63c6071b9..778571632b2 100644 --- a/release/scripts/startup/bl_ui/__init__.py +++ b/release/scripts/startup/bl_ui/__init__.py @@ -36,6 +36,7 @@ _modules = ( "properties_data_mesh", "properties_data_metaball", "properties_data_modifier", + "properties_data_speaker", "properties_game", "properties_material", "properties_object_constraint", @@ -102,7 +103,10 @@ def register(): items.extend([(cat, cat, "") for cat in sorted(items_unique)]) return items - WindowManager.addon_search = StringProperty(name="Search", description="Search within the selected filter") + WindowManager.addon_search = StringProperty( + name="Search", + description="Search within the selected filter", + ) WindowManager.addon_filter = EnumProperty( items=addon_filter_items, name="Category", diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py index 8e5c3971b23..96e10919806 100644 --- a/release/scripts/startup/bl_ui/properties_data_armature.py +++ b/release/scripts/startup/bl_ui/properties_data_armature.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Panel, Menu from rna_prop_ui import PropertyPanel from blf import gettext as _ @@ -31,7 +32,7 @@ class ArmatureButtonsPanel(): return context.armature -class DATA_PT_context_arm(ArmatureButtonsPanel, bpy.types.Panel): +class DATA_PT_context_arm(ArmatureButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} @@ -48,7 +49,7 @@ class DATA_PT_context_arm(ArmatureButtonsPanel, bpy.types.Panel): layout.template_ID(space, "pin_id") -class DATA_PT_skeleton(ArmatureButtonsPanel, bpy.types.Panel): +class DATA_PT_skeleton(ArmatureButtonsPanel, Panel): bl_label = _("Skeleton") def draw(self, context): @@ -70,8 +71,10 @@ class DATA_PT_skeleton(ArmatureButtonsPanel, bpy.types.Panel): flow.prop(arm, "use_deform_envelopes", text=_("Envelopes")) flow.prop(arm, "use_deform_preserve_volume", text=_("Quaternion")) + if context.scene.render.engine == "BLENDER_GAME": + layout.row().prop(arm, "vert_deformer", expand=True) -class DATA_PT_display(ArmatureButtonsPanel, bpy.types.Panel): +class DATA_PT_display(ArmatureButtonsPanel, Panel): bl_label = _("Display") def draw(self, context): @@ -96,7 +99,16 @@ class DATA_PT_display(ArmatureButtonsPanel, bpy.types.Panel): col.prop(arm, "use_deform_delay", text=_("Delay Refresh")) -class DATA_PT_bone_groups(ArmatureButtonsPanel, bpy.types.Panel): +class DATA_PT_bone_group_specials(Menu): + bl_label = _("Bone Group Specials") + + def draw(self, context): + layout = self.layout + + layout.operator("pose.group_sort", icon='SORTALPHA') + + +class DATA_PT_bone_groups(ArmatureButtonsPanel, Panel): bl_label = _("Bone Groups") @classmethod @@ -108,16 +120,25 @@ class DATA_PT_bone_groups(ArmatureButtonsPanel, bpy.types.Panel): ob = context.object pose = ob.pose + group = pose.bone_groups.active row = layout.row() - row.template_list(pose, "bone_groups", pose.bone_groups, "active_index", rows=2) + + rows = 2 + if group: + rows = 5 + row.template_list(pose, "bone_groups", pose.bone_groups, "active_index", rows=rows) col = row.column(align=True) col.active = (ob.proxy is None) col.operator("pose.group_add", icon='ZOOMIN', text="") col.operator("pose.group_remove", icon='ZOOMOUT', text="") + col.menu("DATA_PT_bone_group_specials", icon='DOWNARROW_HLT', text="") + if group: + col.separator() + col.operator("pose.group_move", icon='TRIA_UP', text="").direction = 'UP' + col.operator("pose.group_move", icon='TRIA_DOWN', text="").direction = 'DOWN' - group = pose.bone_groups.active if group: col = layout.column() col.active = (ob.proxy is None) @@ -147,7 +168,7 @@ class DATA_PT_bone_groups(ArmatureButtonsPanel, bpy.types.Panel): sub.operator("pose.group_deselect", text=_("Deselect")) -class DATA_PT_pose_library(ArmatureButtonsPanel, bpy.types.Panel): +class DATA_PT_pose_library(ArmatureButtonsPanel, Panel): bl_label = _("Pose Library") bl_options = {'DEFAULT_CLOSED'} @@ -186,7 +207,7 @@ class DATA_PT_pose_library(ArmatureButtonsPanel, bpy.types.Panel): # TODO: this panel will soon be depreceated too -class DATA_PT_ghost(ArmatureButtonsPanel, bpy.types.Panel): +class DATA_PT_ghost(ArmatureButtonsPanel, Panel): bl_label = _("Ghost") def draw(self, context): @@ -213,7 +234,7 @@ class DATA_PT_ghost(ArmatureButtonsPanel, bpy.types.Panel): col.prop(arm, "show_only_ghost_selected", text=_("Selected Only")) -class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, bpy.types.Panel): +class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, Panel): bl_label = _("iTaSC parameters") bl_options = {'DEFAULT_CLOSED'} @@ -266,7 +287,7 @@ from bl_ui.properties_animviz import ( ) -class DATA_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel): +class DATA_PT_motion_paths(MotionPathButtonsPanel, Panel): #bl_label = "Bones Motion Paths" bl_context = "data" @@ -289,7 +310,7 @@ class DATA_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel): split.operator("pose.paths_clear", text=_("Clear Paths")) -class DATA_PT_onion_skinning(OnionSkinButtonsPanel): # , bpy.types.Panel): # inherit from panel when ready +class DATA_PT_onion_skinning(OnionSkinButtonsPanel): # , Panel): # inherit from panel when ready #bl_label = "Bones Onion Skinning" bl_context = "data" @@ -303,7 +324,7 @@ class DATA_PT_onion_skinning(OnionSkinButtonsPanel): # , bpy.types.Panel): # in self.draw_settings(context, ob.pose.animation_visualisation, bones=True) -class DATA_PT_custom_props_arm(ArmatureButtonsPanel, PropertyPanel, bpy.types.Panel): +class DATA_PT_custom_props_arm(ArmatureButtonsPanel, PropertyPanel, Panel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} _context_path = "object.data" _property_type = bpy.types.Armature diff --git a/release/scripts/startup/bl_ui/properties_data_bone.py b/release/scripts/startup/bl_ui/properties_data_bone.py index eccd820ed35..36c07bd1ef8 100644 --- a/release/scripts/startup/bl_ui/properties_data_bone.py +++ b/release/scripts/startup/bl_ui/properties_data_bone.py @@ -19,6 +19,7 @@ # <pep8 compliant> import bpy +from bpy.types import Panel from rna_prop_ui import PropertyPanel from blf import gettext as _ @@ -32,7 +33,7 @@ class BoneButtonsPanel(): return (context.bone or context.edit_bone) -class BONE_PT_context_bone(BoneButtonsPanel, bpy.types.Panel): +class BONE_PT_context_bone(BoneButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} @@ -48,7 +49,7 @@ class BONE_PT_context_bone(BoneButtonsPanel, bpy.types.Panel): row.prop(bone, "name", text="") -class BONE_PT_transform(BoneButtonsPanel, bpy.types.Panel): +class BONE_PT_transform(BoneButtonsPanel, Panel): bl_label = _("Transform") @classmethod @@ -102,7 +103,7 @@ class BONE_PT_transform(BoneButtonsPanel, bpy.types.Panel): sub.prop(bone, "lock") -class BONE_PT_transform_locks(BoneButtonsPanel, bpy.types.Panel): +class BONE_PT_transform_locks(BoneButtonsPanel, Panel): bl_label = _("Transform Locks") bl_options = {'DEFAULT_CLOSED'} @@ -135,7 +136,7 @@ class BONE_PT_transform_locks(BoneButtonsPanel, bpy.types.Panel): row.column().prop(pchan, "lock_scale") -class BONE_PT_relations(BoneButtonsPanel, bpy.types.Panel): +class BONE_PT_relations(BoneButtonsPanel, Panel): bl_label = _("Relations") def draw(self, context): @@ -180,7 +181,7 @@ class BONE_PT_relations(BoneButtonsPanel, bpy.types.Panel): sub.prop(bone, "use_local_location", text=_("Local Location")) -class BONE_PT_display(BoneButtonsPanel, bpy.types.Panel): +class BONE_PT_display(BoneButtonsPanel, Panel): bl_label = _("Display") @classmethod @@ -217,7 +218,7 @@ class BONE_PT_display(BoneButtonsPanel, bpy.types.Panel): col.prop_search(pchan, "custom_shape_transform", ob.pose, "bones", text=_("At")) -class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel): +class BONE_PT_inverse_kinematics(BoneButtonsPanel, Panel): bl_label = _("Inverse Kinematics") bl_options = {'DEFAULT_CLOSED'} @@ -308,7 +309,7 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel): #row.prop(pchan, "ik_linear_weight", text=_("Weight"), slider=True) -class BONE_PT_deform(BoneButtonsPanel, bpy.types.Panel): +class BONE_PT_deform(BoneButtonsPanel, Panel): bl_label = _("Deform") bl_options = {'DEFAULT_CLOSED'} @@ -357,7 +358,7 @@ class BONE_PT_deform(BoneButtonsPanel, bpy.types.Panel): col.prop(bone, "use_cyclic_offset") -class BONE_PT_custom_props(BoneButtonsPanel, PropertyPanel, bpy.types.Panel): +class BONE_PT_custom_props(BoneButtonsPanel, PropertyPanel, Panel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} _property_type = bpy.types.Bone, bpy.types.EditBone, bpy.types.PoseBone diff --git a/release/scripts/startup/bl_ui/properties_data_camera.py b/release/scripts/startup/bl_ui/properties_data_camera.py index b3f1f861b81..c07acea47d5 100644 --- a/release/scripts/startup/bl_ui/properties_data_camera.py +++ b/release/scripts/startup/bl_ui/properties_data_camera.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Panel from rna_prop_ui import PropertyPanel from blf import gettext as _ @@ -32,7 +33,7 @@ class CameraButtonsPanel(): return context.camera and (engine in cls.COMPAT_ENGINES) -class DATA_PT_context_camera(CameraButtonsPanel, bpy.types.Panel): +class DATA_PT_context_camera(CameraButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -53,7 +54,7 @@ class DATA_PT_context_camera(CameraButtonsPanel, bpy.types.Panel): split.separator() -class DATA_PT_camera(CameraButtonsPanel, bpy.types.Panel): +class DATA_PT_camera(CameraButtonsPanel, Panel): bl_label = _("Lens") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -106,12 +107,12 @@ class DATA_PT_camera(CameraButtonsPanel, bpy.types.Panel): col = split.column() - if cam.dof_object != None: + if cam.dof_object is not None: col.enabled = False col.prop(cam, "dof_distance", text=_("Distance")) -class DATA_PT_camera_display(CameraButtonsPanel, bpy.types.Panel): +class DATA_PT_camera_display(CameraButtonsPanel, Panel): bl_label = _("Display") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -138,7 +139,7 @@ class DATA_PT_camera_display(CameraButtonsPanel, bpy.types.Panel): sub.prop(cam, "passepartout_alpha", text=_("Alpha"), slider=True) -class DATA_PT_custom_props_camera(CameraButtonsPanel, PropertyPanel, bpy.types.Panel): +class DATA_PT_custom_props_camera(CameraButtonsPanel, PropertyPanel, Panel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} _context_path = "object.data" _property_type = bpy.types.Camera diff --git a/release/scripts/startup/bl_ui/properties_data_curve.py b/release/scripts/startup/bl_ui/properties_data_curve.py index cd15f978e26..36f61c1bd54 100644 --- a/release/scripts/startup/bl_ui/properties_data_curve.py +++ b/release/scripts/startup/bl_ui/properties_data_curve.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Panel from rna_prop_ui import PropertyPanel from blf import gettext as _ @@ -48,7 +49,7 @@ class CurveButtonsPanelActive(CurveButtonsPanel): return (curve and type(curve) is not bpy.types.TextCurve and curve.splines.active) -class DATA_PT_context_curve(CurveButtonsPanel, bpy.types.Panel): +class DATA_PT_context_curve(CurveButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} @@ -65,7 +66,7 @@ class DATA_PT_context_curve(CurveButtonsPanel, bpy.types.Panel): layout.template_ID(space, "pin_id") # XXX: broken -class DATA_PT_shape_curve(CurveButtonsPanel, bpy.types.Panel): +class DATA_PT_shape_curve(CurveButtonsPanel, Panel): bl_label = _("Shape") def draw(self, context): @@ -108,13 +109,13 @@ class DATA_PT_shape_curve(CurveButtonsPanel, bpy.types.Panel): if (is_curve or is_text): col.label(text=_("Fill:")) sub = col.column() - sub.active = (curve.bevel_object is None) + sub.active = (curve.dimensions == '2D' or (curve.bevel_object is None and curve.dimensions == '3D')) sub.prop(curve, "use_fill_front") sub.prop(curve, "use_fill_back") col.prop(curve, "use_fill_deform", text=_("Fill Deformed")) -class DATA_PT_curve_texture_space(CurveButtonsPanel, bpy.types.Panel): +class DATA_PT_curve_texture_space(CurveButtonsPanel, Panel): bl_label = _("Texture Space") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -133,7 +134,7 @@ class DATA_PT_curve_texture_space(CurveButtonsPanel, bpy.types.Panel): row.column().prop(curve, "texspace_size", text=_("Size")) -class DATA_PT_geometry_curve(CurveButtonsPanel, bpy.types.Panel): +class DATA_PT_geometry_curve(CurveButtonsPanel, Panel): bl_label = _("Geometry") @classmethod @@ -166,7 +167,7 @@ class DATA_PT_geometry_curve(CurveButtonsPanel, bpy.types.Panel): col.prop(curve, "bevel_object", text="") -class DATA_PT_pathanim(CurveButtonsPanelCurve, bpy.types.Panel): +class DATA_PT_pathanim(CurveButtonsPanelCurve, Panel): bl_label = _("Path Animation") def draw_header(self, context): @@ -197,7 +198,7 @@ class DATA_PT_pathanim(CurveButtonsPanelCurve, bpy.types.Panel): col.prop(curve, "use_time_offset", text=_("Offset Children")) -class DATA_PT_active_spline(CurveButtonsPanelActive, bpy.types.Panel): +class DATA_PT_active_spline(CurveButtonsPanelActive, Panel): bl_label = _("Active Spline") def draw(self, context): @@ -268,7 +269,7 @@ class DATA_PT_active_spline(CurveButtonsPanelActive, bpy.types.Panel): layout.prop(act_spline, "use_smooth") -class DATA_PT_font(CurveButtonsPanel, bpy.types.Panel): +class DATA_PT_font(CurveButtonsPanel, Panel): bl_label = _("Font") @classmethod @@ -332,7 +333,7 @@ class DATA_PT_font(CurveButtonsPanel, bpy.types.Panel): row.prop(char, "use_small_caps") -class DATA_PT_paragraph(CurveButtonsPanel, bpy.types.Panel): +class DATA_PT_paragraph(CurveButtonsPanel, Panel): bl_label = _("Paragraph") @classmethod @@ -361,7 +362,7 @@ class DATA_PT_paragraph(CurveButtonsPanel, bpy.types.Panel): col.prop(text, "offset_y", text="Y") -class DATA_PT_text_boxes(CurveButtonsPanel, bpy.types.Panel): +class DATA_PT_text_boxes(CurveButtonsPanel, Panel): bl_label = _("Text Boxes") @classmethod @@ -401,7 +402,7 @@ class DATA_PT_text_boxes(CurveButtonsPanel, bpy.types.Panel): row.operator("font.textbox_remove", text='', icon='X', emboss=False).index = i -class DATA_PT_custom_props_curve(CurveButtonsPanel, PropertyPanel, bpy.types.Panel): +class DATA_PT_custom_props_curve(CurveButtonsPanel, PropertyPanel, Panel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} _context_path = "object.data" _property_type = bpy.types.Curve diff --git a/release/scripts/startup/bl_ui/properties_data_empty.py b/release/scripts/startup/bl_ui/properties_data_empty.py index 4ed1d23f814..1a6aad684c4 100644 --- a/release/scripts/startup/bl_ui/properties_data_empty.py +++ b/release/scripts/startup/bl_ui/properties_data_empty.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Panel from blf import gettext as _ class DataButtonsPanel(): @@ -30,7 +31,7 @@ class DataButtonsPanel(): return (context.object and context.object.type == 'EMPTY') -class DATA_PT_empty(DataButtonsPanel, bpy.types.Panel): +class DATA_PT_empty(DataButtonsPanel, Panel): bl_label = _("Empty") def draw(self, context): diff --git a/release/scripts/startup/bl_ui/properties_data_lamp.py b/release/scripts/startup/bl_ui/properties_data_lamp.py index bf05acfbb37..4ae6ad2a7c1 100644 --- a/release/scripts/startup/bl_ui/properties_data_lamp.py +++ b/release/scripts/startup/bl_ui/properties_data_lamp.py @@ -18,15 +18,16 @@ # <pep8 compliant> import bpy +from bpy.types import Menu, Panel from rna_prop_ui import PropertyPanel from blf import gettext as _ -class LAMP_MT_sunsky_presets(bpy.types.Menu): +class LAMP_MT_sunsky_presets(Menu): bl_label = _("Sun & Sky Presets") preset_subdir = "sunsky" preset_operator = "script.execute_preset" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} - draw = bpy.types.Menu.draw_preset + draw = Menu.draw_preset class DataButtonsPanel(): @@ -40,7 +41,7 @@ class DataButtonsPanel(): return context.lamp and (engine in cls.COMPAT_ENGINES) -class DATA_PT_context_lamp(DataButtonsPanel, bpy.types.Panel): +class DATA_PT_context_lamp(DataButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -65,7 +66,7 @@ class DATA_PT_context_lamp(DataButtonsPanel, bpy.types.Panel): split.label(text=str(texture_count), icon='TEXTURE') -class DATA_PT_preview(DataButtonsPanel, bpy.types.Panel): +class DATA_PT_preview(DataButtonsPanel, Panel): bl_label = _("Preview") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -73,7 +74,7 @@ class DATA_PT_preview(DataButtonsPanel, bpy.types.Panel): self.layout.template_preview(context.lamp) -class DATA_PT_lamp(DataButtonsPanel, bpy.types.Panel): +class DATA_PT_lamp(DataButtonsPanel, Panel): bl_label = _("Lamp") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -115,7 +116,7 @@ class DATA_PT_lamp(DataButtonsPanel, bpy.types.Panel): col.prop(lamp, "use_diffuse") -class DATA_PT_sunsky(DataButtonsPanel, bpy.types.Panel): +class DATA_PT_sunsky(DataButtonsPanel, Panel): bl_label = _("Sky & Atmosphere") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -187,7 +188,7 @@ class DATA_PT_sunsky(DataButtonsPanel, bpy.types.Panel): sub.prop(lamp, "atmosphere_extinction", slider=True, text=_("Extinction")) -class DATA_PT_shadow(DataButtonsPanel, bpy.types.Panel): +class DATA_PT_shadow(DataButtonsPanel, Panel): bl_label = _("Shadow") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -302,7 +303,7 @@ class DATA_PT_shadow(DataButtonsPanel, bpy.types.Panel): sub.prop(lamp, "shadow_buffer_clip_end", text=_(" Clip End")) -class DATA_PT_area(DataButtonsPanel, bpy.types.Panel): +class DATA_PT_area(DataButtonsPanel, Panel): bl_label = _("Area Shape") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -328,7 +329,7 @@ class DATA_PT_area(DataButtonsPanel, bpy.types.Panel): sub.prop(lamp, "size_y", text=_("Size Y")) -class DATA_PT_spot(DataButtonsPanel, bpy.types.Panel): +class DATA_PT_spot(DataButtonsPanel, Panel): bl_label = _("Spot Shape") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -362,7 +363,7 @@ class DATA_PT_spot(DataButtonsPanel, bpy.types.Panel): sub.prop(lamp, "halo_step", text=_("Step")) -class DATA_PT_falloff_curve(DataButtonsPanel, bpy.types.Panel): +class DATA_PT_falloff_curve(DataButtonsPanel, Panel): bl_label = _("Falloff Curve") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -380,7 +381,7 @@ class DATA_PT_falloff_curve(DataButtonsPanel, bpy.types.Panel): self.layout.template_curve_mapping(lamp, "falloff_curve") -class DATA_PT_custom_props_lamp(DataButtonsPanel, PropertyPanel, bpy.types.Panel): +class DATA_PT_custom_props_lamp(DataButtonsPanel, PropertyPanel, Panel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} _context_path = "object.data" _property_type = bpy.types.Lamp diff --git a/release/scripts/startup/bl_ui/properties_data_lattice.py b/release/scripts/startup/bl_ui/properties_data_lattice.py index 98e0d1558ec..d77de212247 100644 --- a/release/scripts/startup/bl_ui/properties_data_lattice.py +++ b/release/scripts/startup/bl_ui/properties_data_lattice.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Panel from rna_prop_ui import PropertyPanel from blf import gettext as _ @@ -31,7 +32,7 @@ class DataButtonsPanel(): return context.lattice -class DATA_PT_context_lattice(DataButtonsPanel, bpy.types.Panel): +class DATA_PT_context_lattice(DataButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} @@ -51,7 +52,7 @@ class DATA_PT_context_lattice(DataButtonsPanel, bpy.types.Panel): split.separator() -class DATA_PT_lattice(DataButtonsPanel, bpy.types.Panel): +class DATA_PT_lattice(DataButtonsPanel, Panel): bl_label = _("Lattice") def draw(self, context): @@ -76,7 +77,7 @@ class DATA_PT_lattice(DataButtonsPanel, bpy.types.Panel): row.prop_search(lat, "vertex_group", context.object, "vertex_groups", text="") -class DATA_PT_custom_props_lattice(DataButtonsPanel, PropertyPanel, bpy.types.Panel): +class DATA_PT_custom_props_lattice(DataButtonsPanel, PropertyPanel, Panel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} _context_path = "object.data" _property_type = bpy.types.Lattice diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py index e646fd1c2f8..d18cc4ea678 100644 --- a/release/scripts/startup/bl_ui/properties_data_mesh.py +++ b/release/scripts/startup/bl_ui/properties_data_mesh.py @@ -18,10 +18,11 @@ # <pep8 compliant> import bpy +from bpy.types import Menu, Panel from rna_prop_ui import PropertyPanel from blf import gettext as _ -class MESH_MT_vertex_group_specials(bpy.types.Menu): +class MESH_MT_vertex_group_specials(Menu): bl_label = _("Vertex Group Specials") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -36,7 +37,7 @@ class MESH_MT_vertex_group_specials(bpy.types.Menu): layout.operator("object.vertex_group_remove", icon='X', text=_("Delete All")).all = True -class MESH_MT_shape_key_specials(bpy.types.Menu): +class MESH_MT_shape_key_specials(Menu): bl_label = _("Shape Key Specials") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -61,7 +62,7 @@ class MeshButtonsPanel(): return context.mesh and (engine in cls.COMPAT_ENGINES) -class DATA_PT_context_mesh(MeshButtonsPanel, bpy.types.Panel): +class DATA_PT_context_mesh(MeshButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -79,7 +80,7 @@ class DATA_PT_context_mesh(MeshButtonsPanel, bpy.types.Panel): layout.template_ID(space, "pin_id") -class DATA_PT_normals(MeshButtonsPanel, bpy.types.Panel): +class DATA_PT_normals(MeshButtonsPanel, Panel): bl_label = _("Normals") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -99,7 +100,7 @@ class DATA_PT_normals(MeshButtonsPanel, bpy.types.Panel): split.prop(mesh, "show_double_sided") -class DATA_PT_texture_space(MeshButtonsPanel, bpy.types.Panel): +class DATA_PT_texture_space(MeshButtonsPanel, Panel): bl_label = _("Texture Space") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -119,7 +120,7 @@ class DATA_PT_texture_space(MeshButtonsPanel, bpy.types.Panel): row.column().prop(mesh, "texspace_size", text=_("Size")) -class DATA_PT_vertex_groups(MeshButtonsPanel, bpy.types.Panel): +class DATA_PT_vertex_groups(MeshButtonsPanel, Panel): bl_label = _("Vertex Groups") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -168,7 +169,7 @@ class DATA_PT_vertex_groups(MeshButtonsPanel, bpy.types.Panel): layout.prop(context.tool_settings, "vertex_group_weight", text=_("Weight")) -class DATA_PT_shape_keys(MeshButtonsPanel, bpy.types.Panel): +class DATA_PT_shape_keys(MeshButtonsPanel, Panel): bl_label = _("Shape Keys") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -261,7 +262,7 @@ class DATA_PT_shape_keys(MeshButtonsPanel, bpy.types.Panel): row.prop(key, "slurph") -class DATA_PT_uv_texture(MeshButtonsPanel, bpy.types.Panel): +class DATA_PT_uv_texture(MeshButtonsPanel, Panel): bl_label = _("UV Texture") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -284,7 +285,7 @@ class DATA_PT_uv_texture(MeshButtonsPanel, bpy.types.Panel): layout.prop(lay, "name") -class DATA_PT_texface(MeshButtonsPanel, bpy.types.Panel): +class DATA_PT_texface(MeshButtonsPanel, Panel): bl_label = _("Texture Face") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -331,7 +332,7 @@ class DATA_PT_texface(MeshButtonsPanel, bpy.types.Panel): col.label(text=_("No UV Texture")) -class DATA_PT_vertex_colors(MeshButtonsPanel, bpy.types.Panel): +class DATA_PT_vertex_colors(MeshButtonsPanel, Panel): bl_label = _("Vertex Colors") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -354,7 +355,7 @@ class DATA_PT_vertex_colors(MeshButtonsPanel, bpy.types.Panel): layout.prop(lay, "name") -class DATA_PT_custom_props_mesh(MeshButtonsPanel, PropertyPanel, bpy.types.Panel): +class DATA_PT_custom_props_mesh(MeshButtonsPanel, PropertyPanel, Panel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} _context_path = "object.data" _property_type = bpy.types.Mesh diff --git a/release/scripts/startup/bl_ui/properties_data_metaball.py b/release/scripts/startup/bl_ui/properties_data_metaball.py index 96b94d369b5..55a7314bc7b 100644 --- a/release/scripts/startup/bl_ui/properties_data_metaball.py +++ b/release/scripts/startup/bl_ui/properties_data_metaball.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Panel from rna_prop_ui import PropertyPanel from blf import gettext as _ @@ -31,7 +32,7 @@ class DataButtonsPanel(): return context.meta_ball -class DATA_PT_context_metaball(DataButtonsPanel, bpy.types.Panel): +class DATA_PT_context_metaball(DataButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} @@ -48,7 +49,7 @@ class DATA_PT_context_metaball(DataButtonsPanel, bpy.types.Panel): layout.template_ID(space, "pin_id") -class DATA_PT_metaball(DataButtonsPanel, bpy.types.Panel): +class DATA_PT_metaball(DataButtonsPanel, Panel): bl_label = _("Metaball") def draw(self, context): @@ -72,7 +73,7 @@ class DATA_PT_metaball(DataButtonsPanel, bpy.types.Panel): layout.prop(mball, "update_method", expand=True) -class DATA_PT_mball_texture_space(DataButtonsPanel, bpy.types.Panel): +class DATA_PT_mball_texture_space(DataButtonsPanel, Panel): bl_label = _("Texture Space") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -89,7 +90,7 @@ class DATA_PT_mball_texture_space(DataButtonsPanel, bpy.types.Panel): row.column().prop(mball, "texspace_size", text=_("Size")) -class DATA_PT_metaball_element(DataButtonsPanel, bpy.types.Panel): +class DATA_PT_metaball_element(DataButtonsPanel, Panel): bl_label = _("Active Element") @classmethod @@ -129,7 +130,7 @@ class DATA_PT_metaball_element(DataButtonsPanel, bpy.types.Panel): col.prop(metaelem, "size_y", text="Y") -class DATA_PT_custom_props_metaball(DataButtonsPanel, PropertyPanel, bpy.types.Panel): +class DATA_PT_custom_props_metaball(DataButtonsPanel, PropertyPanel, Panel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} _context_path = "object.data" _property_type = bpy.types.MetaBall diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index 18bf2868724..40e455ef88e 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Panel from blf import gettext as _ class ModifierButtonsPanel(): @@ -26,7 +27,7 @@ class ModifierButtonsPanel(): bl_context = "modifier" -class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel): +class DATA_PT_modifiers(ModifierButtonsPanel, Panel): bl_label = _("Modifiers") def draw(self, context): @@ -576,13 +577,13 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel): sub = col.column() sub.active = bool(md.vertex_group) sub.prop(md, "invert_vertex_group", text=_("Invert")) + sub.prop(md, "thickness_vertex_group", text=_("Factor")) col.prop(md, "use_even_offset") col.prop(md, "use_quality_normals") col.prop(md, "use_rim") sub = col.column() - sub.label() row = sub.split(align=True, percentage=0.4) row.prop(md, "material_offset", text="") row = row.row() diff --git a/release/scripts/startup/bl_ui/properties_data_speaker.py b/release/scripts/startup/bl_ui/properties_data_speaker.py new file mode 100644 index 00000000000..657c0fe652a --- /dev/null +++ b/release/scripts/startup/bl_ui/properties_data_speaker.py @@ -0,0 +1,125 @@ +# ##### 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> +import bpy +from rna_prop_ui import PropertyPanel + + +class DataButtonsPanel(): + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "data" + + @classmethod + def poll(cls, context): + engine = context.scene.render.engine + return context.speaker and (engine in cls.COMPAT_ENGINES) + + +class DATA_PT_context_speaker(DataButtonsPanel, bpy.types.Panel): + bl_label = "" + bl_options = {'HIDE_HEADER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + + def draw(self, context): + layout = self.layout + + ob = context.object + speaker = context.speaker + space = context.space_data + + split = layout.split(percentage=0.65) + + if ob: + split.template_ID(ob, "data") + elif speaker: + split.template_ID(space, "pin_id") + + +class DATA_PT_speaker(DataButtonsPanel, bpy.types.Panel): + bl_label = "Sound" + COMPAT_ENGINES = {'BLENDER_RENDER'} + + def draw(self, context): + layout = self.layout + + speaker = context.speaker + + split = layout.split(percentage=0.75) + + split.template_ID(speaker, "sound", open="sound.open_mono") + split.prop(speaker, "muted") + + row = layout.row() + row.prop(speaker, "volume") + row.prop(speaker, "pitch") + + +class DATA_PT_distance(DataButtonsPanel, bpy.types.Panel): + bl_label = "Distance" + COMPAT_ENGINES = {'BLENDER_RENDER'} + + def draw(self, context): + layout = self.layout + + speaker = context.speaker + + split = layout.split() + + col = split.column() + col.label("Volume:") + col.prop(speaker, "volume_min", text="Minimum") + col.prop(speaker, "volume_max", text="Maximum") + col.prop(speaker, "attenuation") + + col = split.column() + col.label("Distance:") + col.prop(speaker, "distance_max", text="Maximum") + col.prop(speaker, "distance_reference", text="Reference") + + +class DATA_PT_cone(DataButtonsPanel, bpy.types.Panel): + bl_label = "Cone" + COMPAT_ENGINES = {'BLENDER_RENDER'} + + def draw(self, context): + layout = self.layout + + speaker = context.speaker + + split = layout.split() + col = split.column() + + col.label("Angle:") + col.prop(speaker, "cone_angle_outer", text="Outer") + col.prop(speaker, "cone_angle_inner", text="Inner") + + col = split.column() + + col.label("Volume:") + col.prop(speaker, "cone_volume_outer", text="Outer") + + +class DATA_PT_custom_props_speaker(DataButtonsPanel, PropertyPanel, bpy.types.Panel): + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + _context_path = "object.data" + _property_type = bpy.types.Speaker + +if __name__ == "__main__": # only for live edit. + bpy.utils.register_module(__name__) diff --git a/release/scripts/startup/bl_ui/properties_game.py b/release/scripts/startup/bl_ui/properties_game.py index b9b979d8d92..123abdfe54a 100644 --- a/release/scripts/startup/bl_ui/properties_game.py +++ b/release/scripts/startup/bl_ui/properties_game.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Panel from blf import gettext as _ class PhysicsButtonsPanel(): @@ -26,7 +27,7 @@ class PhysicsButtonsPanel(): bl_context = "physics" -class PHYSICS_PT_game_physics(PhysicsButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_game_physics(PhysicsButtonsPanel, Panel): bl_label = _("Physics") COMPAT_ENGINES = {'BLENDER_GAME'} @@ -167,7 +168,7 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel, bpy.types.Panel): layout.prop(ob, "hide_render", text=_("Invisible")) -class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel, Panel): bl_label = _("Collision Bounds") COMPAT_ENGINES = {'BLENDER_GAME'} @@ -206,7 +207,7 @@ class RenderButtonsPanel(): return (rd.engine in cls.COMPAT_ENGINES) -class RENDER_PT_game(RenderButtonsPanel, bpy.types.Panel): +class RENDER_PT_game(RenderButtonsPanel, Panel): bl_label = _("Game") COMPAT_ENGINES = {'BLENDER_GAME'} @@ -218,7 +219,7 @@ class RENDER_PT_game(RenderButtonsPanel, bpy.types.Panel): row.label() -class RENDER_PT_game_player(RenderButtonsPanel, bpy.types.Panel): +class RENDER_PT_game_player(RenderButtonsPanel, Panel): bl_label = _("Standalone Player") COMPAT_ENGINES = {'BLENDER_GAME'} @@ -251,7 +252,7 @@ class RENDER_PT_game_player(RenderButtonsPanel, bpy.types.Panel): col.prop(gs, "frame_color", text="") -class RENDER_PT_game_stereo(RenderButtonsPanel, bpy.types.Panel): +class RENDER_PT_game_stereo(RenderButtonsPanel, Panel): bl_label = _("Stereo") COMPAT_ENGINES = {'BLENDER_GAME'} @@ -305,7 +306,7 @@ class RENDER_PT_game_stereo(RenderButtonsPanel, bpy.types.Panel): layout.prop(gs, "dome_text") -class RENDER_PT_game_shading(RenderButtonsPanel, bpy.types.Panel): +class RENDER_PT_game_shading(RenderButtonsPanel, Panel): bl_label = _("Shading") COMPAT_ENGINES = {'BLENDER_GAME'} @@ -331,7 +332,7 @@ class RENDER_PT_game_shading(RenderButtonsPanel, bpy.types.Panel): col.prop(gs, "use_glsl_extra_textures", text=_("Extra Textures")) -class RENDER_PT_game_performance(RenderButtonsPanel, bpy.types.Panel): +class RENDER_PT_game_performance(RenderButtonsPanel, Panel): bl_label = _("Performance") COMPAT_ENGINES = {'BLENDER_GAME'} @@ -339,12 +340,15 @@ class RENDER_PT_game_performance(RenderButtonsPanel, bpy.types.Panel): layout = self.layout gs = context.scene.game_settings - row = layout.row() + col = layout.column() + row = col.row() row.prop(gs, "use_frame_rate") row.prop(gs, "use_display_lists") + + col.prop(gs, "restrict_animation_updates") -class RENDER_PT_game_display(RenderButtonsPanel, bpy.types.Panel): +class RENDER_PT_game_display(RenderButtonsPanel, Panel): bl_label = _("Display") COMPAT_ENGINES = {'BLENDER_GAME'} @@ -360,20 +364,6 @@ class RENDER_PT_game_display(RenderButtonsPanel, bpy.types.Panel): flow.prop(gs, "show_mouse", text=_("Mouse Cursor")) -class RENDER_PT_game_sound(RenderButtonsPanel, bpy.types.Panel): - bl_label = _("Sound") - COMPAT_ENGINES = {'BLENDER_GAME'} - - def draw(self, context): - layout = self.layout - - scene = context.scene - - layout.prop(scene, "audio_distance_model") - - layout.prop(scene, "audio_doppler_speed", text=_("Speed")) - layout.prop(scene, "audio_doppler_factor") - class WorldButtonsPanel(): bl_space_type = 'PROPERTIES' @@ -381,7 +371,7 @@ class WorldButtonsPanel(): bl_context = "world" -class WORLD_PT_game_context_world(WorldButtonsPanel, bpy.types.Panel): +class WORLD_PT_game_context_world(WorldButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} COMPAT_ENGINES = {'BLENDER_GAME'} @@ -405,7 +395,7 @@ class WORLD_PT_game_context_world(WorldButtonsPanel, bpy.types.Panel): split.template_ID(space, "pin_id") -class WORLD_PT_game_world(WorldButtonsPanel, bpy.types.Panel): +class WORLD_PT_game_world(WorldButtonsPanel, Panel): bl_label = _("World") COMPAT_ENGINES = {'BLENDER_GAME'} @@ -424,7 +414,7 @@ class WORLD_PT_game_world(WorldButtonsPanel, bpy.types.Panel): row.column().prop(world, "ambient_color") -class WORLD_PT_game_mist(WorldButtonsPanel, bpy.types.Panel): +class WORLD_PT_game_mist(WorldButtonsPanel, Panel): bl_label = _("Mist") COMPAT_ENGINES = {'BLENDER_GAME'} @@ -450,7 +440,7 @@ class WORLD_PT_game_mist(WorldButtonsPanel, bpy.types.Panel): row.prop(world.mist_settings, "depth") -class WORLD_PT_game_physics(WorldButtonsPanel, bpy.types.Panel): +class WORLD_PT_game_physics(WorldButtonsPanel, Panel): bl_label = _("Physics") COMPAT_ENGINES = {'BLENDER_GAME'} diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py index 1148d6f1660..18eae572e94 100644 --- a/release/scripts/startup/bl_ui/properties_material.py +++ b/release/scripts/startup/bl_ui/properties_material.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Menu, Panel from rna_prop_ui import PropertyPanel from blf import gettext as _ @@ -50,14 +51,14 @@ def simple_material(mat): return False -class MATERIAL_MT_sss_presets(bpy.types.Menu): +class MATERIAL_MT_sss_presets(Menu): bl_label = _("SSS Presets") preset_subdir = "sss" preset_operator = "script.execute_preset" - draw = bpy.types.Menu.draw_preset + draw = Menu.draw_preset -class MATERIAL_MT_specials(bpy.types.Menu): +class MATERIAL_MT_specials(Menu): bl_label = _("Material Specials") def draw(self, context): @@ -79,7 +80,7 @@ class MaterialButtonsPanel(): return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES) -class MATERIAL_PT_context_material(MaterialButtonsPanel, bpy.types.Panel): +class MATERIAL_PT_context_material(MaterialButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -144,7 +145,7 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel, bpy.types.Panel): row.label(text=_("No material node selected")) -class MATERIAL_PT_preview(MaterialButtonsPanel, bpy.types.Panel): +class MATERIAL_PT_preview(MaterialButtonsPanel, Panel): bl_label = _("Preview") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -152,7 +153,7 @@ class MATERIAL_PT_preview(MaterialButtonsPanel, bpy.types.Panel): self.layout.template_preview(context.material) -class MATERIAL_PT_pipeline(MaterialButtonsPanel, bpy.types.Panel): +class MATERIAL_PT_pipeline(MaterialButtonsPanel, Panel): bl_label = _("Render Pipeline Options") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -203,7 +204,7 @@ class MATERIAL_PT_pipeline(MaterialButtonsPanel, bpy.types.Panel): col.prop(mat, "pass_index") -class MATERIAL_PT_diffuse(MaterialButtonsPanel, bpy.types.Panel): +class MATERIAL_PT_diffuse(MaterialButtonsPanel, Panel): bl_label = _("Diffuse") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -260,7 +261,7 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel, bpy.types.Panel): col.prop(mat, "diffuse_ramp_factor", text=_("Factor")) -class MATERIAL_PT_specular(MaterialButtonsPanel, bpy.types.Panel): +class MATERIAL_PT_specular(MaterialButtonsPanel, Panel): bl_label = _("Specular") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -313,7 +314,7 @@ class MATERIAL_PT_specular(MaterialButtonsPanel, bpy.types.Panel): layout.prop(mat, "specular_ramp_factor", text=_("Factor")) -class MATERIAL_PT_shading(MaterialButtonsPanel, bpy.types.Panel): +class MATERIAL_PT_shading(MaterialButtonsPanel, Panel): bl_label = _("Shading") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -347,7 +348,7 @@ class MATERIAL_PT_shading(MaterialButtonsPanel, bpy.types.Panel): sub.prop(mat, "use_cubic") -class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel): +class MATERIAL_PT_transp(MaterialButtonsPanel, Panel): bl_label = _("Transparency") # bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -413,7 +414,7 @@ class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel): sub.prop(rayt, "gloss_samples", text=_("Samples")) -class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel): +class MATERIAL_PT_mirror(MaterialButtonsPanel, Panel): bl_label = _("Mirror") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -471,7 +472,7 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel): sub.prop(raym, "gloss_anisotropic", text=_("Anisotropic")) -class MATERIAL_PT_sss(MaterialButtonsPanel, bpy.types.Panel): +class MATERIAL_PT_sss(MaterialButtonsPanel, Panel): bl_label = _("Subsurface Scattering") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -523,7 +524,7 @@ class MATERIAL_PT_sss(MaterialButtonsPanel, bpy.types.Panel): col.prop(sss, "error_threshold", text=_("Error")) -class MATERIAL_PT_halo(MaterialButtonsPanel, bpy.types.Panel): +class MATERIAL_PT_halo(MaterialButtonsPanel, Panel): bl_label = _("Halo") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -576,7 +577,7 @@ class MATERIAL_PT_halo(MaterialButtonsPanel, bpy.types.Panel): number_but(col, "use_star", "star_tip_count", "Star tips", "") -class MATERIAL_PT_flare(MaterialButtonsPanel, bpy.types.Panel): +class MATERIAL_PT_flare(MaterialButtonsPanel, Panel): bl_label = _("Flare") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -611,7 +612,7 @@ class MATERIAL_PT_flare(MaterialButtonsPanel, bpy.types.Panel): col.prop(halo, "flare_subflare_size", text=_("Subsize")) -class MATERIAL_PT_physics(MaterialButtonsPanel, bpy.types.Panel): +class MATERIAL_PT_physics(MaterialButtonsPanel, Panel): bl_label = _("Physics") COMPAT_ENGINES = {'BLENDER_GAME'} @@ -641,7 +642,7 @@ class MATERIAL_PT_physics(MaterialButtonsPanel, bpy.types.Panel): row.prop(phys, "use_fh_normal") -class MATERIAL_PT_strand(MaterialButtonsPanel, bpy.types.Panel): +class MATERIAL_PT_strand(MaterialButtonsPanel, Panel): bl_label = _("Strand") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -688,7 +689,7 @@ class MATERIAL_PT_strand(MaterialButtonsPanel, bpy.types.Panel): sub.prop(tan, "blend_distance", text=_("Distance")) -class MATERIAL_PT_options(MaterialButtonsPanel, bpy.types.Panel): +class MATERIAL_PT_options(MaterialButtonsPanel, Panel): bl_label = _("Options") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -737,7 +738,7 @@ class MATERIAL_PT_options(MaterialButtonsPanel, bpy.types.Panel): col.prop(mat, "pass_index") -class MATERIAL_PT_shadow(MaterialButtonsPanel, bpy.types.Panel): +class MATERIAL_PT_shadow(MaterialButtonsPanel, Panel): bl_label = _("Shadow") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -781,7 +782,7 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel, bpy.types.Panel): col.prop(mat, "use_cast_approximate") -class MATERIAL_PT_transp_game(MaterialButtonsPanel, bpy.types.Panel): +class MATERIAL_PT_transp_game(MaterialButtonsPanel, Panel): bl_label = _("Transparency") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_GAME'} @@ -824,7 +825,7 @@ class VolumeButtonsPanel(): return mat and (mat.type == 'VOLUME') and (engine in cls.COMPAT_ENGINES) -class MATERIAL_PT_volume_density(VolumeButtonsPanel, bpy.types.Panel): +class MATERIAL_PT_volume_density(VolumeButtonsPanel, Panel): bl_label = _("Density") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -838,7 +839,7 @@ class MATERIAL_PT_volume_density(VolumeButtonsPanel, bpy.types.Panel): row.prop(vol, "density_scale") -class MATERIAL_PT_volume_shading(VolumeButtonsPanel, bpy.types.Panel): +class MATERIAL_PT_volume_shading(VolumeButtonsPanel, Panel): bl_label = _("Shading") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -863,7 +864,7 @@ class MATERIAL_PT_volume_shading(VolumeButtonsPanel, bpy.types.Panel): sub.prop(vol, "reflection_color", text="") -class MATERIAL_PT_volume_lighting(VolumeButtonsPanel, bpy.types.Panel): +class MATERIAL_PT_volume_lighting(VolumeButtonsPanel, Panel): bl_label = _("Lighting") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -898,7 +899,7 @@ class MATERIAL_PT_volume_lighting(VolumeButtonsPanel, bpy.types.Panel): sub.prop(vol, "ms_intensity") -class MATERIAL_PT_volume_transp(VolumeButtonsPanel, bpy.types.Panel): +class MATERIAL_PT_volume_transp(VolumeButtonsPanel, Panel): bl_label = _("Transparency") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -916,7 +917,7 @@ class MATERIAL_PT_volume_transp(VolumeButtonsPanel, bpy.types.Panel): layout.prop(mat, "transparency_method", expand=True) -class MATERIAL_PT_volume_integration(VolumeButtonsPanel, bpy.types.Panel): +class MATERIAL_PT_volume_integration(VolumeButtonsPanel, Panel): bl_label = _("Integration") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -938,7 +939,7 @@ class MATERIAL_PT_volume_integration(VolumeButtonsPanel, bpy.types.Panel): col.prop(vol, "depth_threshold") -class MATERIAL_PT_volume_options(VolumeButtonsPanel, bpy.types.Panel): +class MATERIAL_PT_volume_options(VolumeButtonsPanel, Panel): bl_label = _("Options") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} bl_options = {'DEFAULT_CLOSED'} @@ -970,7 +971,7 @@ class MATERIAL_PT_volume_options(VolumeButtonsPanel, bpy.types.Panel): row.prop(mat, "use_light_group_exclusive", text=_("Exclusive")) -class MATERIAL_PT_custom_props(MaterialButtonsPanel, PropertyPanel, bpy.types.Panel): +class MATERIAL_PT_custom_props(MaterialButtonsPanel, PropertyPanel, Panel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} _context_path = "material" _property_type = bpy.types.Material diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py index 338b262b434..73a218704f7 100644 --- a/release/scripts/startup/bl_ui/properties_object.py +++ b/release/scripts/startup/bl_ui/properties_object.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Panel from rna_prop_ui import PropertyPanel from blf import gettext as _ @@ -27,7 +28,7 @@ class ObjectButtonsPanel(): bl_context = "object" -class OBJECT_PT_context_object(ObjectButtonsPanel, bpy.types.Panel): +class OBJECT_PT_context_object(ObjectButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} @@ -42,7 +43,7 @@ class OBJECT_PT_context_object(ObjectButtonsPanel, bpy.types.Panel): row.template_ID(context.scene.objects, "active") -class OBJECT_PT_transform(ObjectButtonsPanel, bpy.types.Panel): +class OBJECT_PT_transform(ObjectButtonsPanel, Panel): bl_label = _("Transform") def draw(self, context): @@ -68,7 +69,7 @@ class OBJECT_PT_transform(ObjectButtonsPanel, bpy.types.Panel): layout.prop(ob, "rotation_mode") -class OBJECT_PT_delta_transform(ObjectButtonsPanel, bpy.types.Panel): +class OBJECT_PT_delta_transform(ObjectButtonsPanel, Panel): bl_label = _("Delta Transform") bl_options = {'DEFAULT_CLOSED'} @@ -94,7 +95,7 @@ class OBJECT_PT_delta_transform(ObjectButtonsPanel, bpy.types.Panel): row.column().prop(ob, "delta_scale") -class OBJECT_PT_transform_locks(ObjectButtonsPanel, bpy.types.Panel): +class OBJECT_PT_transform_locks(ObjectButtonsPanel, Panel): bl_label = _("Transform Locks") bl_options = {'DEFAULT_CLOSED'} @@ -120,7 +121,7 @@ class OBJECT_PT_transform_locks(ObjectButtonsPanel, bpy.types.Panel): row.column().prop(ob, "lock_scale", text=_("Scale")) -class OBJECT_PT_relations(ObjectButtonsPanel, bpy.types.Panel): +class OBJECT_PT_relations(ObjectButtonsPanel, Panel): bl_label = _("Relations") def draw(self, context): @@ -147,7 +148,7 @@ class OBJECT_PT_relations(ObjectButtonsPanel, bpy.types.Panel): sub.active = (parent is not None) -class OBJECT_PT_groups(ObjectButtonsPanel, bpy.types.Panel): +class OBJECT_PT_groups(ObjectButtonsPanel, Panel): bl_label = _("Groups") def draw(self, context): @@ -186,7 +187,7 @@ class OBJECT_PT_groups(ObjectButtonsPanel, bpy.types.Panel): index += 1 -class OBJECT_PT_display(ObjectButtonsPanel, bpy.types.Panel): +class OBJECT_PT_display(ObjectButtonsPanel, Panel): bl_label = _("Display") def draw(self, context): @@ -220,7 +221,7 @@ class OBJECT_PT_display(ObjectButtonsPanel, bpy.types.Panel): col.prop(ob, "show_transparent", text=_("Transparency")) -class OBJECT_PT_duplication(ObjectButtonsPanel, bpy.types.Panel): +class OBJECT_PT_duplication(ObjectButtonsPanel, Panel): bl_label = _("Duplication") def draw(self, context): @@ -258,7 +259,7 @@ class OBJECT_PT_duplication(ObjectButtonsPanel, bpy.types.Panel): # XXX: the following options are all quite buggy, ancient hacks that should be dropped -class OBJECT_PT_animation(ObjectButtonsPanel, bpy.types.Panel): +class OBJECT_PT_animation(ObjectButtonsPanel, Panel): bl_label = _("Animation Hacks") bl_options = {'DEFAULT_CLOSED'} @@ -293,7 +294,7 @@ from bl_ui.properties_animviz import ( ) -class OBJECT_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel): +class OBJECT_PT_motion_paths(MotionPathButtonsPanel, Panel): #bl_label = "Object Motion Paths" bl_context = "object" @@ -315,7 +316,7 @@ class OBJECT_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel): row.operator("object.paths_clear", text=_("Clear Paths")) -class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel): # , bpy.types.Panel): # inherit from panel when ready +class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel): # , Panel): # inherit from panel when ready #bl_label = "Object Onion Skinning" bl_context = "object" @@ -329,7 +330,7 @@ class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel): # , bpy.types.Panel): # self.draw_settings(context, ob.animation_visualisation) -class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel, bpy.types.Panel): +class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel, Panel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} _context_path = "object" _property_type = bpy.types.Object diff --git a/release/scripts/startup/bl_ui/properties_object_constraint.py b/release/scripts/startup/bl_ui/properties_object_constraint.py index 319281f0a22..51544e63325 100644 --- a/release/scripts/startup/bl_ui/properties_object_constraint.py +++ b/release/scripts/startup/bl_ui/properties_object_constraint.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Panel from blf import gettext as _ class ConstraintButtonsPanel(): @@ -234,7 +235,6 @@ class ConstraintButtonsPanel(): row.label() def LIMIT_ROTATION(self, context, layout, con): - split = layout.split() col = split.column(align=True) @@ -258,9 +258,7 @@ class ConstraintButtonsPanel(): sub.prop(con, "min_z", text=_("Min")) sub.prop(con, "max_z", text=_("Max")) - row = layout.row() - row.prop(con, "use_transform_limit") - row.label() + layout.prop(con, "use_transform_limit") row = layout.row() row.label(text=_("Convert:")) @@ -476,6 +474,10 @@ class ConstraintButtonsPanel(): row.label(text=_("Clamp Region:")) row.prop(con, "limit_mode", text="") + row = layout.row() + row.prop(con, "use_transform_limit") + row.label() + def STRETCH_TO(self, context, layout, con): self.target_template(layout, con) @@ -755,7 +757,7 @@ class ConstraintButtonsPanel(): layout.label( _("Blender 2.5 has no py-constraints") ) -class OBJECT_PT_constraints(ConstraintButtonsPanel, bpy.types.Panel): +class OBJECT_PT_constraints(ConstraintButtonsPanel, Panel): bl_label = _("Object Constraints") bl_context = "constraint" @@ -779,7 +781,7 @@ class OBJECT_PT_constraints(ConstraintButtonsPanel, bpy.types.Panel): self.draw_constraint(context, con) -class BONE_PT_constraints(ConstraintButtonsPanel, bpy.types.Panel): +class BONE_PT_constraints(ConstraintButtonsPanel, Panel): bl_label = _("Bone Constraints") bl_context = "bone_constraint" diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py index d19fa6c2ad6..307f362a195 100644 --- a/release/scripts/startup/bl_ui/properties_particle.py +++ b/release/scripts/startup/bl_ui/properties_particle.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Panel from rna_prop_ui import PropertyPanel from blf import gettext as _ @@ -73,7 +74,7 @@ class ParticleButtonsPanel(): return particle_panel_poll(cls, context) -class PARTICLE_PT_context_particles(ParticleButtonsPanel, bpy.types.Panel): +class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -156,7 +157,7 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, bpy.types.Panel): if part: split = layout.split(percentage=0.65) if part.type == 'HAIR': - if psys != None and psys.is_edited: + if psys is not None and psys.is_edited: split.operator("particle.edited_clear", text=_("Free Edit")) else: row = split.row() @@ -166,18 +167,18 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, bpy.types.Panel): row = split.row() row.enabled = particle_panel_enabled(context, psys) row.prop(part, "hair_step") - if psys != None and psys.is_edited: + if psys is not None and psys.is_edited: if psys.is_global_hair: layout.operator("particle.connect_hair") else: layout.operator("particle.disconnect_hair") - elif psys != None and part.type == 'REACTOR': + elif psys is not None and part.type == 'REACTOR': split.enabled = particle_panel_enabled(context, psys) split.prop(psys, "reactor_target_object") split.prop(psys, "reactor_target_particle_system", text=_("Particle System")) -class PARTICLE_PT_emission(ParticleButtonsPanel, bpy.types.Panel): +class PARTICLE_PT_emission(ParticleButtonsPanel, Panel): bl_label = _("Emission") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -246,7 +247,7 @@ class PARTICLE_PT_emission(ParticleButtonsPanel, bpy.types.Panel): row.prop(part, "grid_random", text=_("Random"), slider=True) -class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, bpy.types.Panel): +class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, Panel): bl_label = _("Hair dynamics") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -302,7 +303,7 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, bpy.types.Panel): col.prop(cloth, "quality", text=_("Steps"), slider=True) -class PARTICLE_PT_cache(ParticleButtonsPanel, bpy.types.Panel): +class PARTICLE_PT_cache(ParticleButtonsPanel, Panel): bl_label = _("Cache") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -328,7 +329,7 @@ class PARTICLE_PT_cache(ParticleButtonsPanel, bpy.types.Panel): point_cache_ui(self, context, psys.point_cache, True, 'HAIR' if (psys.settings.type == 'HAIR') else 'PSYS') -class PARTICLE_PT_velocity(ParticleButtonsPanel, bpy.types.Panel): +class PARTICLE_PT_velocity(ParticleButtonsPanel, Panel): bl_label = _("Velocity") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -378,7 +379,7 @@ class PARTICLE_PT_velocity(ParticleButtonsPanel, bpy.types.Panel): # sub.prop(part, "reaction_shape", slider=True) -class PARTICLE_PT_rotation(ParticleButtonsPanel, bpy.types.Panel): +class PARTICLE_PT_rotation(ParticleButtonsPanel, Panel): bl_label = _("Rotation") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -427,7 +428,7 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel, bpy.types.Panel): col.prop(part, "angular_velocity_factor", text="") -class PARTICLE_PT_physics(ParticleButtonsPanel, bpy.types.Panel): +class PARTICLE_PT_physics(ParticleButtonsPanel, Panel): bl_label = _("Physics") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -642,7 +643,7 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, bpy.types.Panel): sub.prop(key, "system", text=_("System")) -class PARTICLE_PT_boidbrain(ParticleButtonsPanel, bpy.types.Panel): +class PARTICLE_PT_boidbrain(ParticleButtonsPanel, Panel): bl_label = _("Boid Brain") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -654,7 +655,7 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel, bpy.types.Panel): if settings is None: return False - if psys != None and psys.point_cache.use_external: + if psys is not None and psys.point_cache.use_external: return False return settings.physics_type == 'BOIDS' and engine in cls.COMPAT_ENGINES @@ -743,7 +744,7 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel, bpy.types.Panel): row.prop(rule, "flee_distance") -class PARTICLE_PT_render(ParticleButtonsPanel, bpy.types.Panel): +class PARTICLE_PT_render(ParticleButtonsPanel, Panel): bl_label = _("Render") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -928,7 +929,7 @@ class PARTICLE_PT_render(ParticleButtonsPanel, bpy.types.Panel): row.prop(part, "size_random", slider=True) -class PARTICLE_PT_draw(ParticleButtonsPanel, bpy.types.Panel): +class PARTICLE_PT_draw(ParticleButtonsPanel, Panel): bl_label = _("Display") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -990,7 +991,7 @@ class PARTICLE_PT_draw(ParticleButtonsPanel, bpy.types.Panel): col.prop(part, "draw_step") -class PARTICLE_PT_children(ParticleButtonsPanel, bpy.types.Panel): +class PARTICLE_PT_children(ParticleButtonsPanel, Panel): bl_label = _("Children") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -1090,7 +1091,7 @@ class PARTICLE_PT_children(ParticleButtonsPanel, bpy.types.Panel): sub.prop(part, "kink_shape", slider=True) -class PARTICLE_PT_field_weights(ParticleButtonsPanel, bpy.types.Panel): +class PARTICLE_PT_field_weights(ParticleButtonsPanel, Panel): bl_label = _("Field Weights") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -1111,7 +1112,7 @@ class PARTICLE_PT_field_weights(ParticleButtonsPanel, bpy.types.Panel): row.prop(part, "effect_hair", slider=True) -class PARTICLE_PT_force_fields(ParticleButtonsPanel, bpy.types.Panel): +class PARTICLE_PT_force_fields(ParticleButtonsPanel, Panel): bl_label = _("Force Field Settings") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -1145,7 +1146,7 @@ class PARTICLE_PT_force_fields(ParticleButtonsPanel, bpy.types.Panel): basic_force_field_falloff_ui(self, context, part.force_field_2) -class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, bpy.types.Panel): +class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, Panel): bl_label = _("Vertexgroups") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -1216,7 +1217,7 @@ class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, bpy.types.Panel): # row.prop(psys, "invert_vertex_group_field", text="") -class PARTICLE_PT_custom_props(ParticleButtonsPanel, PropertyPanel, bpy.types.Panel): +class PARTICLE_PT_custom_props(ParticleButtonsPanel, PropertyPanel, Panel): COMPAT_ENGINES = {'BLENDER_RENDER'} _context_path = "particle_system.settings" _property_type = bpy.types.ParticleSettings diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py b/release/scripts/startup/bl_ui/properties_physics_cloth.py index cb0106bee5a..5e42a465c2a 100644 --- a/release/scripts/startup/bl_ui/properties_physics_cloth.py +++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Menu, Panel from blf import gettext as _ from bl_ui.properties_physics_common import ( @@ -30,14 +31,14 @@ def cloth_panel_enabled(md): return md.point_cache.is_baked is False -class CLOTH_MT_presets(bpy.types.Menu): +class CLOTH_MT_presets(Menu): ''' Creates the menu items by scanning scripts/templates ''' bl_label = _("Cloth Presets") preset_subdir = "cloth" preset_operator = "script.execute_preset" - draw = bpy.types.Menu.draw_preset + draw = Menu.draw_preset class PhysicButtonsPanel(): @@ -52,7 +53,7 @@ class PhysicButtonsPanel(): return (ob and ob.type == 'MESH') and (not rd.use_game_engine) and (context.cloth) -class PHYSICS_PT_cloth(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_cloth(PhysicButtonsPanel, Panel): bl_label = _("Cloth") def draw(self, context): @@ -117,7 +118,7 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, bpy.types.Panel): col.prop_search(cloth, "rest_shape_key", key, "key_blocks", text="") -class PHYSICS_PT_cloth_cache(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_cloth_cache(PhysicButtonsPanel, Panel): bl_label = _("Cloth Cache") bl_options = {'DEFAULT_CLOSED'} @@ -130,7 +131,7 @@ class PHYSICS_PT_cloth_cache(PhysicButtonsPanel, bpy.types.Panel): point_cache_ui(self, context, md.point_cache, cloth_panel_enabled(md), 'CLOTH') -class PHYSICS_PT_cloth_collision(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_cloth_collision(PhysicButtonsPanel, Panel): bl_label = _("Cloth Collision") bl_options = {'DEFAULT_CLOSED'} @@ -171,7 +172,7 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel, bpy.types.Panel): layout.prop(cloth, "group") -class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel, Panel): bl_label = _("Cloth Stiffness Scaling") bl_options = {'DEFAULT_CLOSED'} @@ -207,7 +208,7 @@ class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel, bpy.types.Panel): col.prop(cloth, "bending_stiffness_max", text=_("Max")) -class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel, Panel): bl_label = _("Cloth Field Weights") bl_options = {'DEFAULT_CLOSED'} diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py index b5ad1615194..20b76ec0a84 100644 --- a/release/scripts/startup/bl_ui/properties_physics_common.py +++ b/release/scripts/startup/bl_ui/properties_physics_common.py @@ -19,6 +19,7 @@ # <pep8 compliant> import bpy +from bpy.types import Panel from blf import gettext as _ class PhysicButtonsPanel(): @@ -44,7 +45,7 @@ def physics_add(self, layout, md, name, type, typeicon, toggles): sub.operator("object.modifier_add", text=name, icon=typeicon).type = type -class PHYSICS_PT_add(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_add(PhysicButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} diff --git a/release/scripts/startup/bl_ui/properties_physics_field.py b/release/scripts/startup/bl_ui/properties_physics_field.py index 0cd20a63d7e..25c92c52311 100644 --- a/release/scripts/startup/bl_ui/properties_physics_field.py +++ b/release/scripts/startup/bl_ui/properties_physics_field.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Panel from blf import gettext as _ from bl_ui.properties_physics_common import ( @@ -37,7 +38,7 @@ class PhysicButtonsPanel(): return (context.object) and (not rd.use_game_engine) -class PHYSICS_PT_field(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_field(PhysicButtonsPanel, Panel): bl_label = _("Force Fields") @classmethod @@ -164,7 +165,7 @@ class PHYSICS_PT_field(PhysicButtonsPanel, bpy.types.Panel): sub.prop(field, "radial_max", text=_("Distance")) -class PHYSICS_PT_collision(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_collision(PhysicButtonsPanel, Panel): bl_label = _("Collision") #bl_options = {'DEFAULT_CLOSED'} diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py index da5e0396974..cd808c2cf45 100644 --- a/release/scripts/startup/bl_ui/properties_physics_fluid.py +++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Panel from blf import gettext as _ class PhysicButtonsPanel(): @@ -32,7 +33,7 @@ class PhysicButtonsPanel(): return (ob and ob.type == 'MESH') and (not rd.use_game_engine) and (context.fluid) -class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_fluid(PhysicButtonsPanel, Panel): bl_label = _("Fluid") def draw(self, context): @@ -186,7 +187,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel): sub.prop(fluid, "velocity_radius", text=_("Radius")) -class PHYSICS_PT_domain_gravity(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_domain_gravity(PhysicButtonsPanel, Panel): bl_label = _("Domain World") bl_options = {'DEFAULT_CLOSED'} @@ -236,7 +237,7 @@ class PHYSICS_PT_domain_gravity(PhysicButtonsPanel, bpy.types.Panel): col.prop(fluid, "compressibility", slider=True) -class PHYSICS_PT_domain_boundary(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_domain_boundary(PhysicButtonsPanel, Panel): bl_label = _("Domain Boundary") bl_options = {'DEFAULT_CLOSED'} @@ -265,7 +266,7 @@ class PHYSICS_PT_domain_boundary(PhysicButtonsPanel, bpy.types.Panel): col.prop(fluid, "surface_subdivisions", text=_("Subdivisions")) -class PHYSICS_PT_domain_particles(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_domain_particles(PhysicButtonsPanel, Panel): bl_label = _("Domain Particles") bl_options = {'DEFAULT_CLOSED'} diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py index 9ce7bc0ab36..5dfe543c8a8 100644 --- a/release/scripts/startup/bl_ui/properties_physics_smoke.py +++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Panel from blf import gettext as _ from bl_ui.properties_physics_common import ( @@ -38,7 +39,7 @@ class PhysicButtonsPanel(): return (ob and ob.type == 'MESH') and (not rd.use_game_engine) and (context.smoke) -class PHYSICS_PT_smoke(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_smoke(PhysicButtonsPanel, Panel): bl_label = _("Smoke") def draw(self, context): @@ -103,7 +104,7 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, bpy.types.Panel): sub.prop(flow, "temperature") -class PHYSICS_PT_smoke_groups(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_smoke_groups(PhysicButtonsPanel, Panel): bl_label = _("Smoke Groups") bl_options = {'DEFAULT_CLOSED'} @@ -131,7 +132,7 @@ class PHYSICS_PT_smoke_groups(PhysicButtonsPanel, bpy.types.Panel): col.prop(group, "collision_group", text="") -class PHYSICS_PT_smoke_highres(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_smoke_highres(PhysicButtonsPanel, Panel): bl_label = _("Smoke High Resolution") bl_options = {'DEFAULT_CLOSED'} @@ -168,7 +169,7 @@ class PHYSICS_PT_smoke_highres(PhysicButtonsPanel, bpy.types.Panel): layout.prop(md, "show_high_resolution") -class PHYSICS_PT_smoke_cache(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_smoke_cache(PhysicButtonsPanel, Panel): bl_label = _("Smoke Cache") bl_options = {'DEFAULT_CLOSED'} @@ -189,7 +190,7 @@ class PHYSICS_PT_smoke_cache(PhysicButtonsPanel, bpy.types.Panel): point_cache_ui(self, context, cache, (cache.is_baked is False), 'SMOKE') -class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel, Panel): bl_label = _("Smoke Field Weights") bl_options = {'DEFAULT_CLOSED'} diff --git a/release/scripts/startup/bl_ui/properties_physics_softbody.py b/release/scripts/startup/bl_ui/properties_physics_softbody.py index 1e9cc58e71c..44778ffee5f 100644 --- a/release/scripts/startup/bl_ui/properties_physics_softbody.py +++ b/release/scripts/startup/bl_ui/properties_physics_softbody.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Panel from blf import gettext as _ from bl_ui.properties_physics_common import ( @@ -44,7 +45,7 @@ class PhysicButtonsPanel(): return (ob and (ob.type == 'MESH' or ob.type == 'LATTICE'or ob.type == 'CURVE')) and (not rd.use_game_engine) and (context.soft_body) -class PHYSICS_PT_softbody(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_softbody(PhysicButtonsPanel, Panel): bl_label = _("Soft Body") def draw(self, context): @@ -71,7 +72,7 @@ class PHYSICS_PT_softbody(PhysicButtonsPanel, bpy.types.Panel): col.prop(softbody, "speed") -class PHYSICS_PT_softbody_cache(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_softbody_cache(PhysicButtonsPanel, Panel): bl_label = _("Soft Body Cache") bl_options = {'DEFAULT_CLOSED'} @@ -84,7 +85,7 @@ class PHYSICS_PT_softbody_cache(PhysicButtonsPanel, bpy.types.Panel): point_cache_ui(self, context, md.point_cache, softbody_panel_enabled(md), 'SOFTBODY') -class PHYSICS_PT_softbody_goal(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_softbody_goal(PhysicButtonsPanel, Panel): bl_label = _("Soft Body Goal") bl_options = {'DEFAULT_CLOSED'} @@ -127,7 +128,7 @@ class PHYSICS_PT_softbody_goal(PhysicButtonsPanel, bpy.types.Panel): layout.prop_search(softbody, "vertex_group_goal", ob, "vertex_groups", text=_("Vertex Group")) -class PHYSICS_PT_softbody_edge(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_softbody_edge(PhysicButtonsPanel, Panel): bl_label = _("Soft Body Edges") bl_options = {'DEFAULT_CLOSED'} @@ -180,7 +181,7 @@ class PHYSICS_PT_softbody_edge(PhysicButtonsPanel, bpy.types.Panel): col.prop(softbody, "use_face_collision", text=_("Face")) -class PHYSICS_PT_softbody_collision(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_softbody_collision(PhysicButtonsPanel, Panel): bl_label = _("Soft Body Self Collision") bl_options = {'DEFAULT_CLOSED'} @@ -212,7 +213,7 @@ class PHYSICS_PT_softbody_collision(PhysicButtonsPanel, bpy.types.Panel): col.prop(softbody, "ball_damp", text=_("Dampening")) -class PHYSICS_PT_softbody_solver(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_softbody_solver(PhysicButtonsPanel, Panel): bl_label = _("Soft Body Solver") bl_options = {'DEFAULT_CLOSED'} @@ -248,7 +249,7 @@ class PHYSICS_PT_softbody_solver(PhysicButtonsPanel, bpy.types.Panel): layout.prop(softbody, "use_estimate_matrix") -class PHYSICS_PT_softbody_field_weights(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_softbody_field_weights(PhysicButtonsPanel, Panel): bl_label = _("Soft Body Field Weights") bl_options = {'DEFAULT_CLOSED'} diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py index 91b604efdc0..981d539a4b5 100644 --- a/release/scripts/startup/bl_ui/properties_render.py +++ b/release/scripts/startup/bl_ui/properties_render.py @@ -18,28 +18,29 @@ # <pep8 compliant> import bpy +from bpy.types import Menu, Panel from blf import gettext as _ -class RENDER_MT_presets(bpy.types.Menu): +class RENDER_MT_presets(Menu): bl_label = _("Render Presets") preset_subdir = "render" preset_operator = "script.execute_preset" - draw = bpy.types.Menu.draw_preset + draw = Menu.draw_preset -class RENDER_MT_ffmpeg_presets(bpy.types.Menu): +class RENDER_MT_ffmpeg_presets(Menu): bl_label = _("FFMPEG Presets") preset_subdir = "ffmpeg" preset_operator = "script.python_file_run" - draw = bpy.types.Menu.draw_preset + draw = Menu.draw_preset -class RENDER_MT_framerate_presets(bpy.types.Menu): +class RENDER_MT_framerate_presets(Menu): bl_label = _("Frame Rate Presets") preset_subdir = "framerate" preset_operator = "script.execute_preset" - draw = bpy.types.Menu.draw_preset + draw = Menu.draw_preset class RenderButtonsPanel(): @@ -54,7 +55,7 @@ class RenderButtonsPanel(): return (context.scene and rd.use_game_engine is False) and (rd.engine in cls.COMPAT_ENGINES) -class RENDER_PT_render(RenderButtonsPanel, bpy.types.Panel): +class RENDER_PT_render(RenderButtonsPanel, Panel): bl_label = _("Render") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -70,7 +71,7 @@ class RENDER_PT_render(RenderButtonsPanel, bpy.types.Panel): layout.prop(rd, "display_mode", text=_("Display")) -class RENDER_PT_layers(RenderButtonsPanel, bpy.types.Panel): +class RENDER_PT_layers(RenderButtonsPanel, Panel): bl_label = _("Layers") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -174,7 +175,7 @@ class RENDER_PT_layers(RenderButtonsPanel, bpy.types.Panel): row.prop(rl, "exclude_refraction", text="") -class RENDER_PT_dimensions(RenderButtonsPanel, bpy.types.Panel): +class RENDER_PT_dimensions(RenderButtonsPanel, Panel): bl_label = _("Dimensions") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -241,7 +242,7 @@ class RENDER_PT_dimensions(RenderButtonsPanel, bpy.types.Panel): subrow.prop(rd, "frame_map_new", text=_("New")) -class RENDER_PT_antialiasing(RenderButtonsPanel, bpy.types.Panel): +class RENDER_PT_antialiasing(RenderButtonsPanel, Panel): bl_label = _("Anti-Aliasing") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -269,7 +270,7 @@ class RENDER_PT_antialiasing(RenderButtonsPanel, bpy.types.Panel): col.prop(rd, "filter_size", text=_("Size")) -class RENDER_PT_motion_blur(RenderButtonsPanel, bpy.types.Panel): +class RENDER_PT_motion_blur(RenderButtonsPanel, Panel): bl_label = _("Sampled Motion Blur") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -295,7 +296,7 @@ class RENDER_PT_motion_blur(RenderButtonsPanel, bpy.types.Panel): row.prop(rd, "motion_blur_shutter") -class RENDER_PT_shading(RenderButtonsPanel, bpy.types.Panel): +class RENDER_PT_shading(RenderButtonsPanel, Panel): bl_label = _("Shading") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -319,7 +320,7 @@ class RENDER_PT_shading(RenderButtonsPanel, bpy.types.Panel): col.prop(rd, "alpha_mode", text=_("Alpha")) -class RENDER_PT_performance(RenderButtonsPanel, bpy.types.Panel): +class RENDER_PT_performance(RenderButtonsPanel, Panel): bl_label = _("Performance") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -362,7 +363,7 @@ class RENDER_PT_performance(RenderButtonsPanel, bpy.types.Panel): sub.prop(rd, "use_local_coords", text=_("Local Coordinates")) -class RENDER_PT_post_processing(RenderButtonsPanel, bpy.types.Panel): +class RENDER_PT_post_processing(RenderButtonsPanel, Panel): bl_label = _("Post Processing") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -399,7 +400,7 @@ class RENDER_PT_post_processing(RenderButtonsPanel, bpy.types.Panel): sub.prop(rd, "edge_color", text="") -class RENDER_PT_stamp(RenderButtonsPanel, bpy.types.Panel): +class RENDER_PT_stamp(RenderButtonsPanel, Panel): bl_label = _("Stamp") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -444,7 +445,7 @@ class RENDER_PT_stamp(RenderButtonsPanel, bpy.types.Panel): sub.prop(rd, "stamp_note_text", text="") -class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel): +class RENDER_PT_output(RenderButtonsPanel, Panel): bl_label = _("Output") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -544,7 +545,7 @@ class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel): col.prop(rd, "quicktime_audio_resampling_hq") -class RENDER_PT_encoding(RenderButtonsPanel, bpy.types.Panel): +class RENDER_PT_encoding(RenderButtonsPanel, Panel): bl_label = _("Encoding") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -592,16 +593,12 @@ class RENDER_PT_encoding(RenderButtonsPanel, bpy.types.Panel): if rd.ffmpeg_format not in {'MP3'}: layout.prop(rd, "ffmpeg_audio_codec", text=_("Audio Codec")) - split = layout.split() - - col = split.column() - col.prop(rd, "ffmpeg_audio_bitrate") - col.prop(rd, "ffmpeg_audio_mixrate") - - split.prop(rd, "ffmpeg_audio_volume", slider=True) + row = layout.row() + row.prop(rd, "ffmpeg_audio_bitrate") + row.prop(rd, "ffmpeg_audio_volume", slider=True) -class RENDER_PT_bake(RenderButtonsPanel, bpy.types.Panel): +class RENDER_PT_bake(RenderButtonsPanel, Panel): bl_label = _("Bake") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py index fbdf02dd51e..11e20a8cd2a 100644 --- a/release/scripts/startup/bl_ui/properties_scene.py +++ b/release/scripts/startup/bl_ui/properties_scene.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Operator, Panel from rna_prop_ui import PropertyPanel from blf import gettext as _ @@ -31,7 +32,7 @@ class SceneButtonsPanel(): return context.scene -class SCENE_PT_scene(SceneButtonsPanel, bpy.types.Panel): +class SCENE_PT_scene(SceneButtonsPanel, Panel): bl_label = _("Scene") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -43,7 +44,35 @@ class SCENE_PT_scene(SceneButtonsPanel, bpy.types.Panel): layout.prop(scene, "background_set", text=_("Background")) -class SCENE_PT_unit(SceneButtonsPanel, bpy.types.Panel): +class SCENE_PT_audio(SceneButtonsPanel, Panel): + bl_label = _("Audio") + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + + def draw(self, context): + layout = self.layout + scene = context.scene + rd = context.scene.render + + layout.prop(scene, "audio_volume") + layout.operator("sound.bake_animation") + + split = layout.split() + + col = split.column() + col.label(_("Listener:")) + col.prop(scene, "audio_distance_model", text="") + col.prop(scene, "audio_doppler_speed", text=_("Speed")) + col.prop(scene, "audio_doppler_factor", text=_("Doppler")) + + col = split.column() + col.label(_("Format:")) + col.prop(rd, "ffmpeg_audio_channels", text="") + col.prop(rd, "ffmpeg_audio_mixrate", text=_("Rate")) + + layout.operator("sound.mixdown") + + +class SCENE_PT_unit(SceneButtonsPanel, Panel): bl_label = _("Units") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -61,7 +90,7 @@ class SCENE_PT_unit(SceneButtonsPanel, bpy.types.Panel): row.prop(unit, "use_separate") -class SCENE_PT_keying_sets(SceneButtonsPanel, bpy.types.Panel): +class SCENE_PT_keying_sets(SceneButtonsPanel, Panel): bl_label = _("Keying Sets") def draw(self, context): @@ -94,7 +123,7 @@ class SCENE_PT_keying_sets(SceneButtonsPanel, bpy.types.Panel): col.prop(ks, "bl_options") -class SCENE_PT_keying_set_paths(SceneButtonsPanel, bpy.types.Panel): +class SCENE_PT_keying_set_paths(SceneButtonsPanel, Panel): bl_label = _("Active Keying Set") @classmethod @@ -144,7 +173,7 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel, bpy.types.Panel): col.prop(ksp, "bl_options") -class SCENE_PT_physics(SceneButtonsPanel, bpy.types.Panel): +class SCENE_PT_physics(SceneButtonsPanel, Panel): bl_label = _("Gravity") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -161,7 +190,7 @@ class SCENE_PT_physics(SceneButtonsPanel, bpy.types.Panel): layout.prop(scene, "gravity", text="") -class SCENE_PT_simplify(SceneButtonsPanel, bpy.types.Panel): +class SCENE_PT_simplify(SceneButtonsPanel, Panel): bl_label = _("Simplify") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -190,7 +219,7 @@ class SCENE_PT_simplify(SceneButtonsPanel, bpy.types.Panel): col.prop(rd, "simplify_ao_sss", text=_("AO and SSS")) -class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, bpy.types.Panel): +class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, Panel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} _context_path = "scene" _property_type = bpy.types.Scene @@ -198,7 +227,7 @@ class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, bpy.types.Panel): # XXX, move operator to op/ dir -class ANIM_OT_keying_set_export(bpy.types.Operator): +class ANIM_OT_keying_set_export(Operator): "Export Keying Set to a python script." bl_idname = "anim.keying_set_export" bl_label = _("Export Keying Set...") diff --git a/release/scripts/startup/bl_ui/properties_texture.py b/release/scripts/startup/bl_ui/properties_texture.py index 899b7ff457a..c80f3fa76d3 100644 --- a/release/scripts/startup/bl_ui/properties_texture.py +++ b/release/scripts/startup/bl_ui/properties_texture.py @@ -18,11 +18,12 @@ # <pep8 compliant> import bpy +from bpy.types import Menu, Panel from rna_prop_ui import PropertyPanel from blf import gettext as _ -class TEXTURE_MT_specials(bpy.types.Menu): +class TEXTURE_MT_specials(Menu): bl_label = _("Texture Specials") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -33,7 +34,7 @@ class TEXTURE_MT_specials(bpy.types.Menu): layout.operator("texture.slot_paste", icon='PASTEDOWN') -class TEXTURE_MT_envmap_specials(bpy.types.Menu): +class TEXTURE_MT_envmap_specials(Menu): bl_label = _("Environment Map Specials") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -81,7 +82,7 @@ class TextureButtonsPanel(): return tex and (tex.type != 'NONE' or tex.use_nodes) and (context.scene.render.engine in cls.COMPAT_ENGINES) -class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel): +class TEXTURE_PT_context_texture(TextureButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -151,7 +152,7 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel): split.prop(tex, "type", text="") -class TEXTURE_PT_preview(TextureButtonsPanel, bpy.types.Panel): +class TEXTURE_PT_preview(TextureButtonsPanel, Panel): bl_label = _("Preview") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -168,7 +169,7 @@ class TEXTURE_PT_preview(TextureButtonsPanel, bpy.types.Panel): layout.template_preview(tex, slot=slot) -class TEXTURE_PT_colors(TextureButtonsPanel, bpy.types.Panel): +class TEXTURE_PT_colors(TextureButtonsPanel, Panel): bl_label = _("Colors") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -224,7 +225,7 @@ class TextureTypePanel(TextureButtonsPanel): return tex and ((tex.type == cls.tex_type and not tex.use_nodes) and (engine in cls.COMPAT_ENGINES)) -class TEXTURE_PT_clouds(TextureTypePanel, bpy.types.Panel): +class TEXTURE_PT_clouds(TextureTypePanel, Panel): bl_label = _("Clouds") tex_type = 'CLOUDS' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -248,7 +249,7 @@ class TEXTURE_PT_clouds(TextureTypePanel, bpy.types.Panel): split.prop(tex, "nabla", text=_("Nabla")) -class TEXTURE_PT_wood(TextureTypePanel, bpy.types.Panel): +class TEXTURE_PT_wood(TextureTypePanel, Panel): bl_label = _("Wood") tex_type = 'WOOD' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -277,7 +278,7 @@ class TEXTURE_PT_wood(TextureTypePanel, bpy.types.Panel): split.prop(tex, "nabla") -class TEXTURE_PT_marble(TextureTypePanel, bpy.types.Panel): +class TEXTURE_PT_marble(TextureTypePanel, Panel): bl_label = _("Marble") tex_type = 'MARBLE' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -304,7 +305,7 @@ class TEXTURE_PT_marble(TextureTypePanel, bpy.types.Panel): col.prop(tex, "nabla") -class TEXTURE_PT_magic(TextureTypePanel, bpy.types.Panel): +class TEXTURE_PT_magic(TextureTypePanel, Panel): bl_label = _("Magic") tex_type = 'MAGIC' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -319,7 +320,7 @@ class TEXTURE_PT_magic(TextureTypePanel, bpy.types.Panel): row.prop(tex, "turbulence") -class TEXTURE_PT_blend(TextureTypePanel, bpy.types.Panel): +class TEXTURE_PT_blend(TextureTypePanel, Panel): bl_label = _("Blend") tex_type = 'BLEND' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -337,7 +338,7 @@ class TEXTURE_PT_blend(TextureTypePanel, bpy.types.Panel): sub.prop(tex, "use_flip_axis", expand=True) -class TEXTURE_PT_stucci(TextureTypePanel, bpy.types.Panel): +class TEXTURE_PT_stucci(TextureTypePanel, Panel): bl_label = _("Stucci") tex_type = 'STUCCI' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -357,7 +358,7 @@ class TEXTURE_PT_stucci(TextureTypePanel, bpy.types.Panel): row.prop(tex, "turbulence") -class TEXTURE_PT_image(TextureTypePanel, bpy.types.Panel): +class TEXTURE_PT_image(TextureTypePanel, Panel): bl_label = _("Image") tex_type = 'IMAGE' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -383,7 +384,7 @@ def texture_filter_common(tex, layout): layout.prop(tex, "use_filter_size_min") -class TEXTURE_PT_image_sampling(TextureTypePanel, bpy.types.Panel): +class TEXTURE_PT_image_sampling(TextureTypePanel, Panel): bl_label = _("Image Sampling") bl_options = {'DEFAULT_CLOSED'} tex_type = 'IMAGE' @@ -415,6 +416,10 @@ class TEXTURE_PT_image_sampling(TextureTypePanel, bpy.types.Panel): row.active = tex.use_normal_map row.prop(slot, "normal_map_space", text="") + row = col.row() + row.active = not tex.use_normal_map + row.prop(tex, "use_derivative_map") + col.prop(tex, "use_mipmap") row = col.row() row.active = tex.use_mipmap @@ -424,7 +429,7 @@ class TEXTURE_PT_image_sampling(TextureTypePanel, bpy.types.Panel): texture_filter_common(tex, col) -class TEXTURE_PT_image_mapping(TextureTypePanel, bpy.types.Panel): +class TEXTURE_PT_image_mapping(TextureTypePanel, Panel): bl_label = _("Image Mapping") bl_options = {'DEFAULT_CLOSED'} tex_type = 'IMAGE' @@ -480,7 +485,7 @@ class TEXTURE_PT_image_mapping(TextureTypePanel, bpy.types.Panel): col.prop(tex, "crop_max_y", text="Y") -class TEXTURE_PT_envmap(TextureTypePanel, bpy.types.Panel): +class TEXTURE_PT_envmap(TextureTypePanel, Panel): bl_label = _("Environment Map") tex_type = 'ENVIRONMENT_MAP' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -518,7 +523,7 @@ class TEXTURE_PT_envmap(TextureTypePanel, bpy.types.Panel): col.prop(env, "clip_end", text=_("End")) -class TEXTURE_PT_envmap_sampling(TextureTypePanel, bpy.types.Panel): +class TEXTURE_PT_envmap_sampling(TextureTypePanel, Panel): bl_label = _("Environment Map Sampling") bl_options = {'DEFAULT_CLOSED'} tex_type = 'ENVIRONMENT_MAP' @@ -532,7 +537,7 @@ class TEXTURE_PT_envmap_sampling(TextureTypePanel, bpy.types.Panel): texture_filter_common(tex, layout) -class TEXTURE_PT_musgrave(TextureTypePanel, bpy.types.Panel): +class TEXTURE_PT_musgrave(TextureTypePanel, Panel): bl_label = _("Musgrave") tex_type = 'MUSGRAVE' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -569,7 +574,7 @@ class TEXTURE_PT_musgrave(TextureTypePanel, bpy.types.Panel): row.prop(tex, "nabla") -class TEXTURE_PT_voronoi(TextureTypePanel, bpy.types.Panel): +class TEXTURE_PT_voronoi(TextureTypePanel, Panel): bl_label = _("Voronoi") tex_type = 'VORONOI' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -605,7 +610,7 @@ class TEXTURE_PT_voronoi(TextureTypePanel, bpy.types.Panel): row.prop(tex, "nabla") -class TEXTURE_PT_distortednoise(TextureTypePanel, bpy.types.Panel): +class TEXTURE_PT_distortednoise(TextureTypePanel, Panel): bl_label = _("Distorted Noise") tex_type = 'DISTORTED_NOISE' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -627,7 +632,7 @@ class TEXTURE_PT_distortednoise(TextureTypePanel, bpy.types.Panel): split.prop(tex, "nabla") -class TEXTURE_PT_voxeldata(TextureButtonsPanel, bpy.types.Panel): +class TEXTURE_PT_voxeldata(TextureButtonsPanel, Panel): bl_label = _("Voxel Data") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -667,7 +672,7 @@ class TEXTURE_PT_voxeldata(TextureButtonsPanel, bpy.types.Panel): layout.prop(vd, "intensity") -class TEXTURE_PT_pointdensity(TextureButtonsPanel, bpy.types.Panel): +class TEXTURE_PT_pointdensity(TextureButtonsPanel, Panel): bl_label = _("Point Density") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -733,7 +738,7 @@ class TEXTURE_PT_pointdensity(TextureButtonsPanel, bpy.types.Panel): col.template_curve_mapping(pd, "falloff_curve", brush=False) -class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel, bpy.types.Panel): +class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel, Panel): bl_label = _("Turbulence") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -770,7 +775,7 @@ class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel, bpy.types.Panel): col.prop(pd, "turbulence_strength") -class TEXTURE_PT_mapping(TextureSlotPanel, bpy.types.Panel): +class TEXTURE_PT_mapping(TextureSlotPanel, Panel): bl_label = _("Mapping") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -858,7 +863,7 @@ class TEXTURE_PT_mapping(TextureSlotPanel, bpy.types.Panel): row.column().prop(tex, "scale") -class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel): +class TEXTURE_PT_influence(TextureSlotPanel, Panel): bl_label = _("Influence") COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -1025,16 +1030,18 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel): # only show bump settings if activated but not for normalmap images row = layout.row() - row.active = (tex.use_map_normal or tex.use_map_warp) and not (tex.texture.type == 'IMAGE' and tex.texture.use_normal_map) - row.prop(tex, "bump_method", text=_("Method")) + sub = row.row() + sub.active = (tex.use_map_normal or tex.use_map_warp) and not (tex.texture.type == 'IMAGE' and (tex.texture.use_normal_map or tex.texture.use_derivative_map)) + sub.prop(tex, "bump_method", text=_("Method")) + # the space setting is supported for: derivmaps + bumpmaps (DEFAULT,BEST_QUALITY), not for normalmaps sub = row.row() - sub.active = tex.bump_method in {'BUMP_DEFAULT', 'BUMP_BEST_QUALITY'} + sub.active = (tex.use_map_normal or tex.use_map_warp) and not (tex.texture.type == 'IMAGE' and tex.texture.use_normal_map) and ((tex.bump_method in {'BUMP_DEFAULT', 'BUMP_BEST_QUALITY'}) or (tex.texture.type == 'IMAGE' and tex.texture.use_derivative_map)) sub.prop(tex, "bump_objectspace", text=_("Space")) -class TEXTURE_PT_custom_props(TextureButtonsPanel, PropertyPanel, bpy.types.Panel): +class TEXTURE_PT_custom_props(TextureButtonsPanel, PropertyPanel, Panel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} _context_path = "texture" _property_type = bpy.types.Texture diff --git a/release/scripts/startup/bl_ui/properties_world.py b/release/scripts/startup/bl_ui/properties_world.py index cfaf6ae6a18..07df2ff53ec 100644 --- a/release/scripts/startup/bl_ui/properties_world.py +++ b/release/scripts/startup/bl_ui/properties_world.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Panel from rna_prop_ui import PropertyPanel from blf import gettext as _ @@ -33,7 +34,7 @@ class WorldButtonsPanel(): return (context.world and context.scene.render.engine in cls.COMPAT_ENGINES) -class WORLD_PT_context_world(WorldButtonsPanel, bpy.types.Panel): +class WORLD_PT_context_world(WorldButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -62,7 +63,7 @@ class WORLD_PT_context_world(WorldButtonsPanel, bpy.types.Panel): split.label(text=str(texture_count), icon='TEXTURE') -class WORLD_PT_preview(WorldButtonsPanel, bpy.types.Panel): +class WORLD_PT_preview(WorldButtonsPanel, Panel): bl_label = _("Preview") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -75,7 +76,7 @@ class WORLD_PT_preview(WorldButtonsPanel, bpy.types.Panel): self.layout.template_preview(context.world) -class WORLD_PT_world(WorldButtonsPanel, bpy.types.Panel): +class WORLD_PT_world(WorldButtonsPanel, Panel): bl_label = _("World") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -100,7 +101,7 @@ class WORLD_PT_world(WorldButtonsPanel, bpy.types.Panel): row.prop(world, "color_range") -class WORLD_PT_ambient_occlusion(WorldButtonsPanel, bpy.types.Panel): +class WORLD_PT_ambient_occlusion(WorldButtonsPanel, Panel): bl_label = _("Ambient Occlusion") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -119,7 +120,7 @@ class WORLD_PT_ambient_occlusion(WorldButtonsPanel, bpy.types.Panel): split.prop(light, "ao_blend_type", text="") -class WORLD_PT_environment_lighting(WorldButtonsPanel, bpy.types.Panel): +class WORLD_PT_environment_lighting(WorldButtonsPanel, Panel): bl_label = _("Environment Lighting") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -138,7 +139,7 @@ class WORLD_PT_environment_lighting(WorldButtonsPanel, bpy.types.Panel): split.prop(light, "environment_color", text="") -class WORLD_PT_indirect_lighting(WorldButtonsPanel, bpy.types.Panel): +class WORLD_PT_indirect_lighting(WorldButtonsPanel, Panel): bl_label = _("Indirect Lighting") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -160,7 +161,7 @@ class WORLD_PT_indirect_lighting(WorldButtonsPanel, bpy.types.Panel): layout.label(text=_("Only works with Approximate gather method")) -class WORLD_PT_gather(WorldButtonsPanel, bpy.types.Panel): +class WORLD_PT_gather(WorldButtonsPanel, Panel): bl_label = _("Gather") COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -208,7 +209,7 @@ class WORLD_PT_gather(WorldButtonsPanel, bpy.types.Panel): col.prop(light, "correction") -class WORLD_PT_mist(WorldButtonsPanel, bpy.types.Panel): +class WORLD_PT_mist(WorldButtonsPanel, Panel): bl_label = _("Mist") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -237,7 +238,7 @@ class WORLD_PT_mist(WorldButtonsPanel, bpy.types.Panel): layout.prop(world.mist_settings, "falloff") -class WORLD_PT_stars(WorldButtonsPanel, bpy.types.Panel): +class WORLD_PT_stars(WorldButtonsPanel, Panel): bl_label = _("Stars") bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -264,7 +265,7 @@ class WORLD_PT_stars(WorldButtonsPanel, bpy.types.Panel): col.prop(world.star_settings, "average_separation", text=_("Separation")) -class WORLD_PT_custom_props(WorldButtonsPanel, PropertyPanel, bpy.types.Panel): +class WORLD_PT_custom_props(WorldButtonsPanel, PropertyPanel, Panel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} _context_path = "world" _property_type = bpy.types.World diff --git a/release/scripts/startup/bl_ui/space_console.py b/release/scripts/startup/bl_ui/space_console.py index 7e4c84d5afc..fae5f1d313d 100644 --- a/release/scripts/startup/bl_ui/space_console.py +++ b/release/scripts/startup/bl_ui/space_console.py @@ -18,33 +18,31 @@ # <pep8 compliant> import bpy +from bpy.types import Header, Menu, Operator from bpy.props import StringProperty from blf import gettext as _ -class CONSOLE_HT_header(bpy.types.Header): +class CONSOLE_HT_header(Header): bl_space_type = 'CONSOLE' def draw(self, context): - layout = self.layout + layout = self.layout.row(align=True) - row = layout.row(align=True) - row.template_header() + layout.template_header() if context.area.show_menus: - sub = row.row(align=True) - sub.menu("CONSOLE_MT_console") + layout.menu("CONSOLE_MT_console") - row = layout.row(align=True) - row.operator("console.autocomplete", text=_("Autocomplete")) + layout.operator("console.autocomplete", text=_("Autocomplete")) -class CONSOLE_MT_console(bpy.types.Menu): +class CONSOLE_MT_console(Menu): bl_label = _("Console") def draw(self, context): layout = self.layout - layout.column() + layout.operator("console.clear") layout.operator("console.copy") layout.operator("console.paste") @@ -56,7 +54,7 @@ class CONSOLE_MT_console(bpy.types.Menu): layout.operator("screen.screen_full_area") -class CONSOLE_MT_language(bpy.types.Menu): +class CONSOLE_MT_language(Menu): bl_label = _("Languages...") def draw(self, context): @@ -83,7 +81,7 @@ def add_scrollback(text, text_type): type=text_type) -class ConsoleExec(bpy.types.Operator): +class ConsoleExec(Operator): '''Execute the current console line as a python expression''' bl_idname = "console.execute" bl_label = _("Console Execute") @@ -101,7 +99,7 @@ class ConsoleExec(bpy.types.Operator): return {'FINISHED'} -class ConsoleAutocomplete(bpy.types.Operator): +class ConsoleAutocomplete(Operator): '''Evaluate the namespace up until the cursor and give a list of options or complete the name if there is only one''' bl_idname = "console.autocomplete" bl_label = _("Console Autocomplete") @@ -118,7 +116,7 @@ class ConsoleAutocomplete(bpy.types.Operator): return {'FINISHED'} -class ConsoleBanner(bpy.types.Operator): +class ConsoleBanner(Operator): '''Print a message whem the terminal initializes''' bl_idname = "console.banner" bl_label = _("Console Banner") @@ -140,11 +138,15 @@ class ConsoleBanner(bpy.types.Operator): return {'FINISHED'} -class ConsoleLanguage(bpy.types.Operator): +class ConsoleLanguage(Operator): '''Set the current language for this console''' bl_idname = "console.language" bl_label = _("Console Language") - language = StringProperty(name="Language", maxlen=32, default="") + + language = StringProperty( + name=_("Language"), + maxlen=32, + ) def execute(self, context): sc = context.space_data diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py index 659a39ebd2d..06905d1505a 100644 --- a/release/scripts/startup/bl_ui/space_dopesheet.py +++ b/release/scripts/startup/bl_ui/space_dopesheet.py @@ -19,6 +19,7 @@ # <pep8 compliant> import bpy +from bpy.types import Header, Menu from blf import gettext as _ @@ -34,41 +35,10 @@ def dopesheet_filter(layout, context, genericFiltersOnly=False): row.prop(dopesheet, "show_only_selected", text="") row.prop(dopesheet, "show_hidden", text="") - if not genericFiltersOnly: - row = layout.row(align=True) - row.prop(dopesheet, "show_transforms", text="") - - if is_nla: - row.prop(dopesheet, "show_missing_nla", text="") - - row = layout.row(align=True) - row.prop(dopesheet, "show_scenes", text="") - row.prop(dopesheet, "show_worlds", text="") - row.prop(dopesheet, "show_nodes", text="") - - if bpy.data.meshes: - row.prop(dopesheet, "show_meshes", text="") - if bpy.data.shape_keys: - row.prop(dopesheet, "show_shapekeys", text="") - if bpy.data.materials: - row.prop(dopesheet, "show_materials", text="") - if bpy.data.lamps: - row.prop(dopesheet, "show_lamps", text="") - if bpy.data.textures: - row.prop(dopesheet, "show_textures", text="") - if bpy.data.cameras: - row.prop(dopesheet, "show_cameras", text="") - if bpy.data.curves: - row.prop(dopesheet, "show_curves", text="") - if bpy.data.metaballs: - row.prop(dopesheet, "show_metaballs", text="") - if bpy.data.lattices: - row.prop(dopesheet, "show_lattices", text="") - if bpy.data.armatures: - row.prop(dopesheet, "show_armatures", text="") - if bpy.data.particles: - row.prop(dopesheet, "show_particles", text="") + if is_nla: + row.prop(dopesheet, "show_missing_nla", text="") + if not genericFiltersOnly: if bpy.data.groups: row = layout.row(align=True) row.prop(dopesheet, "show_only_group_objects", text="") @@ -81,11 +51,47 @@ def dopesheet_filter(layout, context, genericFiltersOnly=False): if dopesheet.show_only_matching_fcurves: row.prop(dopesheet, "filter_fcurve_name", text="") + if not genericFiltersOnly: + row = layout.row(align=True) + row.prop(dopesheet, "show_datablock_filters", text="Filters") + + if dopesheet.show_datablock_filters: + row.prop(dopesheet, "show_scenes", text="") + row.prop(dopesheet, "show_worlds", text="") + row.prop(dopesheet, "show_nodes", text="") + + row.prop(dopesheet, "show_transforms", text="") + + if bpy.data.meshes: + row.prop(dopesheet, "show_meshes", text="") + if bpy.data.shape_keys: + row.prop(dopesheet, "show_shapekeys", text="") + if bpy.data.materials: + row.prop(dopesheet, "show_materials", text="") + if bpy.data.lamps: + row.prop(dopesheet, "show_lamps", text="") + if bpy.data.textures: + row.prop(dopesheet, "show_textures", text="") + if bpy.data.cameras: + row.prop(dopesheet, "show_cameras", text="") + if bpy.data.curves: + row.prop(dopesheet, "show_curves", text="") + if bpy.data.metaballs: + row.prop(dopesheet, "show_metaballs", text="") + if bpy.data.lattices: + row.prop(dopesheet, "show_lattices", text="") + if bpy.data.armatures: + row.prop(dopesheet, "show_armatures", text="") + if bpy.data.particles: + row.prop(dopesheet, "show_particles", text="") + if bpy.data.speakers: + row.prop(dopesheet, "show_speakers", text="") + ####################################### # DopeSheet Editor - General/Standard UI -class DOPESHEET_HT_header(bpy.types.Header): +class DOPESHEET_HT_header(Header): bl_space_type = 'DOPESHEET_EDITOR' def draw(self, context): @@ -97,21 +103,19 @@ class DOPESHEET_HT_header(bpy.types.Header): row.template_header() if context.area.show_menus: - sub = row.row(align=True) + row.menu("DOPESHEET_MT_view") + row.menu("DOPESHEET_MT_select") + row.menu("DOPESHEET_MT_marker") - sub.menu("DOPESHEET_MT_view") - sub.menu("DOPESHEET_MT_select") - sub.menu("DOPESHEET_MT_marker") - - if st.mode == 'DOPESHEET' or (st.mode == 'ACTION' and st.action != None): - sub.menu("DOPESHEET_MT_channel") + if st.mode == 'DOPESHEET' or (st.mode == 'ACTION' and st.action is not None): + row.menu("DOPESHEET_MT_channel") elif st.mode == 'GPENCIL': - sub.menu("DOPESHEET_MT_gpencil_channel") + row.menu("DOPESHEET_MT_gpencil_channel") if st.mode != 'GPENCIL': - sub.menu("DOPESHEET_MT_key") + row.menu("DOPESHEET_MT_key") else: - sub.menu("DOPESHEET_MT_gpencil_frame") + row.menu("DOPESHEET_MT_gpencil_frame") layout.prop(st, "mode", text="") layout.prop(st.dopesheet, "show_summary", text=_("Summary")) @@ -135,7 +139,7 @@ class DOPESHEET_HT_header(bpy.types.Header): row.operator("action.paste", text="", icon='PASTEDOWN') -class DOPESHEET_MT_view(bpy.types.Menu): +class DOPESHEET_MT_view(Menu): bl_label = _("View") def draw(self, context): @@ -143,8 +147,6 @@ class DOPESHEET_MT_view(bpy.types.Menu): st = context.space_data - layout.column() - layout.prop(st, "use_realtime_update") layout.prop(st, "show_frame_indicator") layout.prop(st, "show_sliders") @@ -171,13 +173,12 @@ class DOPESHEET_MT_view(bpy.types.Menu): layout.operator("screen.screen_full_area") -class DOPESHEET_MT_select(bpy.types.Menu): +class DOPESHEET_MT_select(Menu): bl_label = _("Select") def draw(self, context): layout = self.layout - layout.column() # This is a bit misleading as the operator's default text is "Select All" while it actually *toggles* All/None layout.operator("action.select_all_toggle") layout.operator("action.select_all_toggle", text=_("Invert Selection")).invert = True @@ -207,7 +208,7 @@ class DOPESHEET_MT_select(bpy.types.Menu): layout.operator("action.select_linked") -class DOPESHEET_MT_marker(bpy.types.Menu): +class DOPESHEET_MT_marker(Menu): bl_label = _("Marker") def draw(self, context): @@ -217,7 +218,6 @@ class DOPESHEET_MT_marker(bpy.types.Menu): #layout.operator_context = 'EXEC_REGION_WIN' - layout.column() layout.operator("marker.add", _("Add Marker")) layout.operator("marker.duplicate", text=_("Duplicate Marker")) layout.operator("marker.delete", text=_("Delete Marker")) @@ -238,7 +238,7 @@ class DOPESHEET_MT_marker(bpy.types.Menu): ####################################### # Keyframe Editing -class DOPESHEET_MT_channel(bpy.types.Menu): +class DOPESHEET_MT_channel(Menu): bl_label = _("Channel") def draw(self, context): @@ -246,7 +246,6 @@ class DOPESHEET_MT_channel(bpy.types.Menu): layout.operator_context = 'INVOKE_REGION_CHANNELS' - layout.column() layout.operator("anim.channels_delete") layout.separator() @@ -269,13 +268,12 @@ class DOPESHEET_MT_channel(bpy.types.Menu): layout.operator("anim.channels_fcurves_enable") -class DOPESHEET_MT_key(bpy.types.Menu): +class DOPESHEET_MT_key(Menu): bl_label = _("Key") def draw(self, context): layout = self.layout - layout.column() layout.menu("DOPESHEET_MT_key_transform", text=_("Transform")) layout.operator_menu_enum("action.snap", "type", text=_("Snap")) @@ -285,7 +283,7 @@ class DOPESHEET_MT_key(bpy.types.Menu): layout.operator("action.keyframe_insert") layout.separator() - layout.operator("action.duplicate") + layout.operator("action.duplicate_move") layout.operator("action.delete") layout.separator() @@ -302,13 +300,12 @@ class DOPESHEET_MT_key(bpy.types.Menu): layout.operator("action.paste") -class DOPESHEET_MT_key_transform(bpy.types.Menu): +class DOPESHEET_MT_key_transform(Menu): bl_label = _("Transform") def draw(self, context): layout = self.layout - layout.column() layout.operator("transform.transform", text=_("Grab/Move")).mode = 'TIME_TRANSLATE' layout.operator("transform.transform", text=_("Extend")).mode = 'TIME_EXTEND' layout.operator("transform.transform", text=_("Slide")).mode = 'TIME_SLIDE' @@ -318,7 +315,7 @@ class DOPESHEET_MT_key_transform(bpy.types.Menu): ####################################### # Grease Pencil Editing -class DOPESHEET_MT_gpencil_channel(bpy.types.Menu): +class DOPESHEET_MT_gpencil_channel(Menu): bl_label = _("Channel") def draw(self, context): @@ -326,7 +323,6 @@ class DOPESHEET_MT_gpencil_channel(bpy.types.Menu): layout.operator_context = 'INVOKE_REGION_CHANNELS' - layout.column() layout.operator("anim.channels_delete") layout.separator() @@ -346,13 +342,12 @@ class DOPESHEET_MT_gpencil_channel(bpy.types.Menu): #layout.operator_menu_enum("anim.channels_move", "direction", text="Move...") -class DOPESHEET_MT_gpencil_frame(bpy.types.Menu): +class DOPESHEET_MT_gpencil_frame(Menu): bl_label = _("Frame") def draw(self, context): layout = self.layout - layout.column() layout.menu("DOPESHEET_MT_key_transform", text=_("Transform")) #layout.operator_menu_enum("action.snap", "type", text="Snap") diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py index 73fe1a97252..cf0d10c5844 100644 --- a/release/scripts/startup/bl_ui/space_filebrowser.py +++ b/release/scripts/startup/bl_ui/space_filebrowser.py @@ -18,9 +18,10 @@ # <pep8 compliant> import bpy +from bpy.types import Header -class FILEBROWSER_HT_header(bpy.types.Header): +class FILEBROWSER_HT_header(Header): bl_space_type = 'FILE_BROWSER' def draw(self, context): diff --git a/release/scripts/startup/bl_ui/space_graph.py b/release/scripts/startup/bl_ui/space_graph.py index c74ffee9bc1..7048d5febf8 100644 --- a/release/scripts/startup/bl_ui/space_graph.py +++ b/release/scripts/startup/bl_ui/space_graph.py @@ -19,10 +19,11 @@ # <pep8 compliant> import bpy +from bpy.types import Header, Menu from blf import gettext as _ -class GRAPH_HT_header(bpy.types.Header): +class GRAPH_HT_header(Header): bl_space_type = 'GRAPH_EDITOR' def draw(self, context): @@ -36,13 +37,11 @@ class GRAPH_HT_header(bpy.types.Header): row.template_header() if context.area.show_menus: - sub = row.row(align=True) - - sub.menu("GRAPH_MT_view") - sub.menu("GRAPH_MT_select") - sub.menu("GRAPH_MT_marker") - sub.menu("GRAPH_MT_channel") - sub.menu("GRAPH_MT_key") + row.menu("GRAPH_MT_view") + row.menu("GRAPH_MT_select") + row.menu("GRAPH_MT_marker") + row.menu("GRAPH_MT_channel") + row.menu("GRAPH_MT_key") layout.prop(st, "mode", text="") @@ -62,7 +61,7 @@ class GRAPH_HT_header(bpy.types.Header): row.operator("graph.ghost_curves_create", text="", icon='GHOST_ENABLED') -class GRAPH_MT_view(bpy.types.Menu): +class GRAPH_MT_view(Menu): bl_label = _("View") def draw(self, context): @@ -70,8 +69,6 @@ class GRAPH_MT_view(bpy.types.Menu): st = context.space_data - layout.column() - layout.operator("graph.properties", icon='MENU_PANEL') layout.separator() @@ -82,7 +79,7 @@ class GRAPH_MT_view(bpy.types.Menu): layout.prop(st, "use_auto_merge_keyframes") layout.separator() - layout.prop(st, "use_fancy_drawing") + layout.prop(st, "use_beauty_drawing") layout.separator() if st.show_handles: @@ -108,13 +105,12 @@ class GRAPH_MT_view(bpy.types.Menu): layout.operator("screen.screen_full_area") -class GRAPH_MT_select(bpy.types.Menu): +class GRAPH_MT_select(Menu): bl_label = _("Select") def draw(self, context): layout = self.layout - layout.column() # This is a bit misleading as the operator's default text is "Select All" while it actually *toggles* All/None layout.operator("graph.select_all_toggle") layout.operator("graph.select_all_toggle", text=_("Invert Selection")).invert = True @@ -143,7 +139,7 @@ class GRAPH_MT_select(bpy.types.Menu): layout.operator("graph.select_linked") -class GRAPH_MT_marker(bpy.types.Menu): +class GRAPH_MT_marker(Menu): bl_label = _("Marker") def draw(self, context): @@ -151,7 +147,6 @@ class GRAPH_MT_marker(bpy.types.Menu): #layout.operator_context = 'EXEC_REGION_WIN' - layout.column() layout.operator("marker.add", _("Add Marker")) layout.operator("marker.duplicate", text=_("Duplicate Marker")) layout.operator("marker.delete", text=_("Delete Marker")) @@ -164,7 +159,7 @@ class GRAPH_MT_marker(bpy.types.Menu): # TODO: pose markers for action edit mode only? -class GRAPH_MT_channel(bpy.types.Menu): +class GRAPH_MT_channel(Menu): bl_label = _("Channel") def draw(self, context): @@ -172,7 +167,6 @@ class GRAPH_MT_channel(bpy.types.Menu): layout.operator_context = 'INVOKE_REGION_CHANNELS' - layout.column() layout.operator("anim.channels_delete") layout.separator() @@ -196,13 +190,12 @@ class GRAPH_MT_channel(bpy.types.Menu): layout.operator("anim.channels_fcurves_enable") -class GRAPH_MT_key(bpy.types.Menu): +class GRAPH_MT_key(Menu): bl_label = _("Key") def draw(self, context): layout = self.layout - layout.column() layout.menu("GRAPH_MT_key_transform", text=_("Transform")) layout.operator_menu_enum("graph.snap", "type", text=_("Snap")) @@ -214,7 +207,7 @@ class GRAPH_MT_key(bpy.types.Menu): layout.operator("graph.sound_bake") layout.separator() - layout.operator("graph.duplicate") + layout.operator("graph.duplicate_move") layout.operator("graph.delete") layout.separator() @@ -235,13 +228,12 @@ class GRAPH_MT_key(bpy.types.Menu): layout.operator("graph.euler_filter", text=_("Discontinuity (Euler) Filter")) -class GRAPH_MT_key_transform(bpy.types.Menu): +class GRAPH_MT_key_transform(Menu): bl_label = _("Transform") def draw(self, context): layout = self.layout - layout.column() layout.operator("transform.translate", text=_("Grab/Move")) layout.operator("transform.transform", text=_("Extend")).mode = 'TIME_EXTEND' layout.operator("transform.rotate", text=_("Rotate")) diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index 15ba638dffb..0f23802a401 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Header, Menu, Panel from blf import gettext as _ @@ -32,7 +33,7 @@ class BrushButtonsPanel(): return sima.show_paint and toolsettings.brush -class IMAGE_MT_view(bpy.types.Menu): +class IMAGE_MT_view(Menu): bl_label = _("View") def draw(self, context): @@ -80,7 +81,7 @@ class IMAGE_MT_view(bpy.types.Menu): layout.operator("screen.screen_full_area") -class IMAGE_MT_select(bpy.types.Menu): +class IMAGE_MT_select(Menu): bl_label = _("Select") def draw(self, context): @@ -101,7 +102,7 @@ class IMAGE_MT_select(bpy.types.Menu): layout.operator("uv.select_linked") -class IMAGE_MT_image(bpy.types.Menu): +class IMAGE_MT_image(Menu): bl_label = _("Image") def draw(self, context): @@ -152,7 +153,7 @@ class IMAGE_MT_image(bpy.types.Menu): layout.prop(sima, "use_image_paint") -class IMAGE_MT_image_invert(bpy.types.Menu): +class IMAGE_MT_image_invert(Menu): bl_label = _("Invert") def draw(self, context): @@ -178,7 +179,7 @@ class IMAGE_MT_image_invert(bpy.types.Menu): op.invert_a = True -class IMAGE_MT_uvs_showhide(bpy.types.Menu): +class IMAGE_MT_uvs_showhide(Menu): bl_label = _("Show/Hide Faces") def draw(self, context): @@ -189,7 +190,7 @@ class IMAGE_MT_uvs_showhide(bpy.types.Menu): layout.operator("uv.hide", text=_("Hide Unselected")).unselected = True -class IMAGE_MT_uvs_transform(bpy.types.Menu): +class IMAGE_MT_uvs_transform(Menu): bl_label = _("Transform") def draw(self, context): @@ -204,7 +205,7 @@ class IMAGE_MT_uvs_transform(bpy.types.Menu): layout.operator("transform.shear") -class IMAGE_MT_uvs_snap(bpy.types.Menu): +class IMAGE_MT_uvs_snap(Menu): bl_label = _("Snap") def draw(self, context): @@ -221,7 +222,7 @@ class IMAGE_MT_uvs_snap(bpy.types.Menu): layout.operator("uv.snap_cursor", text=_("Cursor to Selected")).target = 'SELECTED' -class IMAGE_MT_uvs_mirror(bpy.types.Menu): +class IMAGE_MT_uvs_mirror(Menu): bl_label = _("Mirror") def draw(self, context): @@ -232,7 +233,7 @@ class IMAGE_MT_uvs_mirror(bpy.types.Menu): layout.operator("transform.mirror", text=_("Y Axis")).constraint_axis[1] = True -class IMAGE_MT_uvs_weldalign(bpy.types.Menu): +class IMAGE_MT_uvs_weldalign(Menu): bl_label = _("Weld/Align") def draw(self, context): @@ -242,7 +243,7 @@ class IMAGE_MT_uvs_weldalign(bpy.types.Menu): layout.operator_enum("uv.align", "axis") # W, 2/3/4 -class IMAGE_MT_uvs(bpy.types.Menu): +class IMAGE_MT_uvs(Menu): bl_label = "UVs" def draw(self, context): @@ -287,7 +288,7 @@ class IMAGE_MT_uvs(bpy.types.Menu): layout.menu("IMAGE_MT_uvs_showhide") -class IMAGE_MT_uvs_select_mode(bpy.types.Menu): +class IMAGE_MT_uvs_select_mode(Menu): bl_label = _("UV Select Mode") def draw(self, context): @@ -329,7 +330,7 @@ class IMAGE_MT_uvs_select_mode(bpy.types.Menu): prop.data_path = "tool_settings.uv_select_mode" -class IMAGE_HT_header(bpy.types.Header): +class IMAGE_HT_header(Header): bl_space_type = 'IMAGE_EDITOR' def draw(self, context): @@ -387,7 +388,7 @@ class IMAGE_HT_header(bpy.types.Header): row = layout.row(align=True) row.prop(toolsettings, "use_snap", text="") - row.prop(toolsettings, "snap_element", text="", icon_only=True) + row.prop(toolsettings, "snap_target", text="") mesh = context.edit_object.data layout.prop_search(mesh.uv_textures, "active", mesh, "uv_textures", text="") @@ -413,7 +414,7 @@ class IMAGE_HT_header(bpy.types.Header): layout.prop(sima, "use_realtime_update", text="", icon_only=True, icon='LOCKED') -class IMAGE_PT_image_properties(bpy.types.Panel): +class IMAGE_PT_image_properties(Panel): bl_space_type = 'IMAGE_EDITOR' bl_region_type = 'UI' bl_label = _("Image") @@ -432,7 +433,7 @@ class IMAGE_PT_image_properties(bpy.types.Panel): layout.template_image(sima, "image", iuser) -class IMAGE_PT_game_properties(bpy.types.Panel): +class IMAGE_PT_game_properties(Panel): bl_space_type = 'IMAGE_EDITOR' bl_region_type = 'UI' bl_label = _("Game Properties") @@ -453,14 +454,12 @@ class IMAGE_PT_game_properties(bpy.types.Panel): col = split.column() + col.prop(ima, "use_animation") sub = col.column(align=True) - sub.prop(ima, "use_animation") - - subsub = sub.column() - subsub.active = ima.use_animation - subsub.prop(ima, "frame_start", text=_("Start")) - subsub.prop(ima, "frame_end", text=_("End")) - subsub.prop(ima, "fps", text=_("Speed")) + sub.active = ima.use_animation + sub.prop(ima, "frame_start", text="Start") + sub.prop(ima, "frame_end", text="End") + sub.prop(ima, "fps", text="Speed") col.prop(ima, "use_tiles") sub = col.column(align=True) @@ -476,7 +475,7 @@ class IMAGE_PT_game_properties(bpy.types.Panel): col.prop(ima, "mapping", expand=True) -class IMAGE_PT_view_histogram(bpy.types.Panel): +class IMAGE_PT_view_histogram(Panel): bl_space_type = 'IMAGE_EDITOR' bl_region_type = 'PREVIEW' bl_label = _("Histogram") @@ -495,7 +494,7 @@ class IMAGE_PT_view_histogram(bpy.types.Panel): layout.prop(sima.scopes.histogram, "mode", icon_only=True) -class IMAGE_PT_view_waveform(bpy.types.Panel): +class IMAGE_PT_view_waveform(Panel): bl_space_type = 'IMAGE_EDITOR' bl_region_type = 'PREVIEW' bl_label = _("Waveform") @@ -509,13 +508,14 @@ class IMAGE_PT_view_waveform(bpy.types.Panel): layout = self.layout sima = context.space_data + layout.template_waveform(sima, "scopes") - sub = layout.row().split(percentage=0.75) - sub.prop(sima.scopes, "waveform_alpha") - sub.prop(sima.scopes, "waveform_mode", text="", icon_only=True) + row = layout.split(percentage=0.75) + row.prop(sima.scopes, "waveform_alpha") + row.prop(sima.scopes, "waveform_mode", text="", icon_only=True) -class IMAGE_PT_view_vectorscope(bpy.types.Panel): +class IMAGE_PT_view_vectorscope(Panel): bl_space_type = 'IMAGE_EDITOR' bl_region_type = 'PREVIEW' bl_label = _("Vectorscope") @@ -533,7 +533,7 @@ class IMAGE_PT_view_vectorscope(bpy.types.Panel): layout.prop(sima.scopes, "vectorscope_alpha") -class IMAGE_PT_sample_line(bpy.types.Panel): +class IMAGE_PT_sample_line(Panel): bl_space_type = 'IMAGE_EDITOR' bl_region_type = 'PREVIEW' bl_label = _("Sample Line") @@ -545,13 +545,15 @@ class IMAGE_PT_sample_line(bpy.types.Panel): def draw(self, context): layout = self.layout - layout.operator("image.sample_line") + sima = context.space_data + + layout.operator("image.sample_line") layout.template_histogram(sima, "sample_histogram") layout.prop(sima.sample_histogram, "mode") -class IMAGE_PT_scope_sample(bpy.types.Panel): +class IMAGE_PT_scope_sample(Panel): bl_space_type = 'IMAGE_EDITOR' bl_region_type = 'PREVIEW' bl_label = _("Scope Samples") @@ -563,16 +565,17 @@ class IMAGE_PT_scope_sample(bpy.types.Panel): def draw(self, context): layout = self.layout + sima = context.space_data - split = layout.split() - row = split.row() + + row = layout.row() row.prop(sima.scopes, "use_full_resolution") - row = split.row() - row.active = not sima.scopes.use_full_resolution - row.prop(sima.scopes, "accuracy") + sub = row.row() + sub.active = not sima.scopes.use_full_resolution + sub.prop(sima.scopes, "accuracy") -class IMAGE_PT_view_properties(bpy.types.Panel): +class IMAGE_PT_view_properties(Panel): bl_space_type = 'IMAGE_EDITOR' bl_region_type = 'UI' bl_label = _("Display") @@ -609,16 +612,16 @@ class IMAGE_PT_view_properties(bpy.types.Panel): if show_uvedit: col = layout.column() - col.label(_("Cursor Location")) - row = col.row() - row.prop(uvedit, "cursor_location", text="") + col.label(_("Cursor Location:")) + col.row().prop(uvedit, "cursor_location", text="") + + col.separator() - col = layout.column() col.label(text="UVs:") - row = col.row() - row.prop(uvedit, "edge_draw_type", expand=True) + col.row().prop(uvedit, "edge_draw_type", expand=True) split = layout.split() + col = split.column() col.prop(uvedit, "show_faces") col.prop(uvedit, "show_smooth_edges", text=_("Smooth")) @@ -631,7 +634,7 @@ class IMAGE_PT_view_properties(bpy.types.Panel): sub.row().prop(uvedit, "draw_stretch_type", expand=True) -class IMAGE_PT_paint(bpy.types.Panel): +class IMAGE_PT_paint(Panel): bl_space_type = 'IMAGE_EDITOR' bl_region_type = 'UI' bl_label = _("Paint") @@ -647,9 +650,8 @@ class IMAGE_PT_paint(bpy.types.Panel): toolsettings = context.tool_settings.image_paint brush = toolsettings.brush - col = layout.split().column() - row = col.row() - col.template_ID_preview(toolsettings, "brush", new="brush.add", rows=3, cols=8) + col = layout.column() + col.template_ID_preview(toolsettings, "brush", new="brush.add", rows=2, cols=6) if brush: col = layout.column() @@ -676,7 +678,7 @@ class IMAGE_PT_paint(bpy.types.Panel): col.prop(brush, "clone_alpha", text=_("Alpha")) -class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, bpy.types.Panel): +class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, Panel): bl_label = _("Texture") bl_options = {'DEFAULT_CLOSED'} @@ -691,7 +693,7 @@ class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, bpy.types.Panel): col.prop(brush, "use_fixed_texture") -class IMAGE_PT_tools_brush_tool(BrushButtonsPanel, bpy.types.Panel): +class IMAGE_PT_tools_brush_tool(BrushButtonsPanel, Panel): bl_label = _("Tool") bl_options = {'DEFAULT_CLOSED'} @@ -700,9 +702,7 @@ class IMAGE_PT_tools_brush_tool(BrushButtonsPanel, bpy.types.Panel): settings = context.tool_settings.image_paint brush = settings.brush - col = layout.column(align=True) - - col.prop(brush, "image_tool", expand=False, text="") + layout.prop(brush, "image_tool", text="") row = layout.row(align=True) row.prop(brush, "use_paint_sculpt", text="", icon='SCULPTMODE_HLT') @@ -711,7 +711,7 @@ class IMAGE_PT_tools_brush_tool(BrushButtonsPanel, bpy.types.Panel): row.prop(brush, "use_paint_image", text="", icon='TPAINT_HLT') -class IMAGE_PT_paint_stroke(BrushButtonsPanel, bpy.types.Panel): +class IMAGE_PT_paint_stroke(BrushButtonsPanel, Panel): bl_label = _("Paint Stroke") bl_options = {'DEFAULT_CLOSED'} @@ -722,9 +722,9 @@ class IMAGE_PT_paint_stroke(BrushButtonsPanel, bpy.types.Panel): brush = toolsettings.brush layout.prop(brush, "use_airbrush") - col = layout.column() - col.active = brush.use_airbrush - col.prop(brush, "rate", slider=True) + row = layout.row() + row.active = brush.use_airbrush + row.prop(brush, "rate", slider=True) layout.prop(brush, "use_space") row = layout.row(align=True) @@ -735,7 +735,7 @@ class IMAGE_PT_paint_stroke(BrushButtonsPanel, bpy.types.Panel): layout.prop(brush, "use_wrap") -class IMAGE_PT_paint_curve(BrushButtonsPanel, bpy.types.Panel): +class IMAGE_PT_paint_curve(BrushButtonsPanel, Panel): bl_label = _("Paint Curve") bl_options = {'DEFAULT_CLOSED'} diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py index 723bab605e3..416defb3bf5 100644 --- a/release/scripts/startup/bl_ui/space_info.py +++ b/release/scripts/startup/bl_ui/space_info.py @@ -18,10 +18,11 @@ # <pep8 compliant> import bpy +from bpy.types import Header, Menu, Operator from blf import gettext as _ -class INFO_HT_header(bpy.types.Header): +class INFO_HT_header(Header): bl_space_type = 'INFO' def draw(self, context): @@ -87,19 +88,19 @@ class INFO_HT_header(bpy.types.Header): """ -class INFO_MT_report(bpy.types.Menu): +class INFO_MT_report(Menu): bl_label = _("Report") def draw(self, context): layout = self.layout - layout.column() + layout.operator("console.select_all_toggle") layout.operator("console.select_border") layout.operator("console.report_delete") layout.operator("console.report_copy") -class INFO_MT_file(bpy.types.Menu): +class INFO_MT_file(Menu): bl_label = _("File"); def draw(self, context): @@ -153,7 +154,7 @@ class INFO_MT_file(bpy.types.Menu): layout.operator("wm.quit_blender", text=_("Quit"), icon='QUIT') -class INFO_MT_file_import(bpy.types.Menu): +class INFO_MT_file_import(Menu): bl_idname = "INFO_MT_file_import" bl_label = _("Import") @@ -162,7 +163,7 @@ class INFO_MT_file_import(bpy.types.Menu): self.layout.operator("wm.collada_import", text="COLLADA (.dae)") -class INFO_MT_file_export(bpy.types.Menu): +class INFO_MT_file_export(Menu): bl_idname = "INFO_MT_file_export" bl_label = _("Export") @@ -171,7 +172,7 @@ class INFO_MT_file_export(bpy.types.Menu): self.layout.operator("wm.collada_export", text="COLLADA (.dae)") -class INFO_MT_file_external_data(bpy.types.Menu): +class INFO_MT_file_external_data(Menu): bl_label = _("External Data") def draw(self, context): @@ -188,12 +189,13 @@ class INFO_MT_file_external_data(bpy.types.Menu): layout.operator("file.find_missing_files") -class INFO_MT_mesh_add(bpy.types.Menu): +class INFO_MT_mesh_add(Menu): bl_idname = "INFO_MT_mesh_add" bl_label = _("Mesh") def draw(self, context): layout = self.layout + layout.operator_context = 'INVOKE_REGION_WIN' layout.operator("mesh.primitive_plane_add", icon='MESH_PLANE', text=_("Plane")) layout.operator("mesh.primitive_cube_add", icon='MESH_CUBE', text=_("Cube")) @@ -208,12 +210,13 @@ class INFO_MT_mesh_add(bpy.types.Menu): layout.operator("mesh.primitive_torus_add", text=_("Torus"), icon='MESH_TORUS') -class INFO_MT_curve_add(bpy.types.Menu): +class INFO_MT_curve_add(Menu): bl_idname = "INFO_MT_curve_add" bl_label = _("Curve") def draw(self, context): layout = self.layout + layout.operator_context = 'INVOKE_REGION_WIN' layout.operator("curve.primitive_bezier_curve_add", icon='CURVE_BEZCURVE', text=_("Bezier")) layout.operator("curve.primitive_bezier_circle_add", icon='CURVE_BEZCIRCLE', text=_("Circle")) @@ -222,7 +225,7 @@ class INFO_MT_curve_add(bpy.types.Menu): layout.operator("curve.primitive_nurbs_path_add", icon='CURVE_PATH', text=_("Path")) -class INFO_MT_edit_curve_add(bpy.types.Menu): +class INFO_MT_edit_curve_add(Menu): bl_idname = "INFO_MT_edit_curve_add" bl_label = _("Add") @@ -238,12 +241,13 @@ class INFO_MT_edit_curve_add(bpy.types.Menu): INFO_MT_curve_add.draw(self, context) -class INFO_MT_surface_add(bpy.types.Menu): +class INFO_MT_surface_add(Menu): bl_idname = "INFO_MT_surface_add" bl_label = _("Surface") def draw(self, context): layout = self.layout + layout.operator_context = 'INVOKE_REGION_WIN' layout.operator("surface.primitive_nurbs_surface_curve_add", icon='SURFACE_NCURVE', text=_("NURBS Curve")) layout.operator("surface.primitive_nurbs_surface_circle_add", icon='SURFACE_NCIRCLE', text=_("NURBS Circle")) @@ -253,17 +257,18 @@ class INFO_MT_surface_add(bpy.types.Menu): layout.operator("surface.primitive_nurbs_surface_torus_add", icon='SURFACE_NTORUS', text=_("NURBS Torus")) -class INFO_MT_armature_add(bpy.types.Menu): +class INFO_MT_armature_add(Menu): bl_idname = "INFO_MT_armature_add" bl_label = _("Armature") def draw(self, context): layout = self.layout + layout.operator_context = 'INVOKE_REGION_WIN' layout.operator("object.armature_add", text=_("Single Bone"), icon='BONE_DATA') -class INFO_MT_add(bpy.types.Menu): +class INFO_MT_add(Menu): bl_label = _("Add") def draw(self, context): @@ -288,6 +293,9 @@ class INFO_MT_add(bpy.types.Menu): layout.operator("object.add", text=_("Empty"), icon='OUTLINER_OB_EMPTY').type = 'EMPTY' layout.separator() + layout.operator("object.speaker_add", text=_("Speaker"), icon='OUTLINER_OB_SPEAKER') + layout.separator() + layout.operator("object.camera_add", text=_("Camera"), icon='OUTLINER_OB_CAMERA') layout.operator_context = 'EXEC_SCREEN' layout.operator_menu_enum("object.lamp_add", "type", text=_("Lamp"), icon='OUTLINER_OB_LAMP') @@ -303,7 +311,7 @@ class INFO_MT_add(bpy.types.Menu): layout.operator_menu_enum("object.group_instance_add", "group", text=_("Group Instance"), icon='OUTLINER_OB_EMPTY') -class INFO_MT_game(bpy.types.Menu): +class INFO_MT_game(Menu): bl_label = _("Game") def draw(self, context): @@ -324,7 +332,7 @@ class INFO_MT_game(bpy.types.Menu): layout.prop(gs, "use_auto_start") -class INFO_MT_render(bpy.types.Menu): +class INFO_MT_render(Menu): bl_label = _("Render") def draw(self, context): @@ -344,7 +352,7 @@ class INFO_MT_render(bpy.types.Menu): layout.operator("render.play_rendered_anim") -class INFO_MT_help(bpy.types.Menu): +class INFO_MT_help(Menu): bl_label = _("Help") def draw(self, context): @@ -380,7 +388,7 @@ class INFO_MT_help(bpy.types.Menu): # Help operators -class HELP_OT_operator_cheat_sheet(bpy.types.Operator): +class HELP_OT_operator_cheat_sheet(Operator): bl_idname = "help.operator_cheat_sheet" bl_label = _("Operator Cheat Sheet") diff --git a/release/scripts/startup/bl_ui/space_logic.py b/release/scripts/startup/bl_ui/space_logic.py index da4161cd88c..38b63823ff3 100644 --- a/release/scripts/startup/bl_ui/space_logic.py +++ b/release/scripts/startup/bl_ui/space_logic.py @@ -18,10 +18,11 @@ # <pep8 compliant> import bpy +from bpy.types import Header, Menu, Panel from blf import gettext as _ -class LOGIC_PT_properties(bpy.types.Panel): +class LOGIC_PT_properties(Panel): bl_space_type = 'LOGIC_EDITOR' bl_region_type = 'UI' bl_label = _("Properties") @@ -50,7 +51,7 @@ class LOGIC_PT_properties(bpy.types.Panel): row.operator("object.game_property_remove", text="", icon='X', emboss=False).index = i -class LOGIC_MT_logicbricks_add(bpy.types.Menu): +class LOGIC_MT_logicbricks_add(Menu): bl_label = _("Add") def draw(self, context): @@ -61,30 +62,24 @@ class LOGIC_MT_logicbricks_add(bpy.types.Menu): layout.operator_menu_enum("logic.actuator_add", "type", text=_("Actuator")) -class LOGIC_HT_header(bpy.types.Header): +class LOGIC_HT_header(Header): bl_space_type = 'LOGIC_EDITOR' def draw(self, context): - layout = self.layout + layout = self.layout.row(align=True) - row = layout.row(align=True) - row.template_header() + layout.template_header() if context.area.show_menus: - sub = row.row(align=True) - sub.menu("LOGIC_MT_view") - #sub.menu("LOGIC_MT_select") - #sub.menu("LOGIC_MT_add") + layout.menu("LOGIC_MT_view") -class LOGIC_MT_view(bpy.types.Menu): +class LOGIC_MT_view(Menu): bl_label = _("View") def draw(self, context): layout = self.layout - layout.column() - layout.operator("logic.properties", icon='MENU_PANEL') if __name__ == "__main__": # only for live edit. diff --git a/release/scripts/startup/bl_ui/space_nla.py b/release/scripts/startup/bl_ui/space_nla.py index f6fa84c3c6a..aa8dc337c39 100644 --- a/release/scripts/startup/bl_ui/space_nla.py +++ b/release/scripts/startup/bl_ui/space_nla.py @@ -19,10 +19,11 @@ # <pep8 compliant> import bpy +from bpy.types import Header, Menu from blf import gettext as _ -class NLA_HT_header(bpy.types.Header): +class NLA_HT_header(Header): bl_space_type = 'NLA_EDITOR' def draw(self, context): @@ -36,20 +37,18 @@ class NLA_HT_header(bpy.types.Header): row.template_header() if context.area.show_menus: - sub = row.row(align=True) - - sub.menu("NLA_MT_view") - sub.menu("NLA_MT_select") - sub.menu("NLA_MT_marker") - sub.menu("NLA_MT_edit") - sub.menu("NLA_MT_add") + row.menu("NLA_MT_view") + row.menu("NLA_MT_select") + row.menu("NLA_MT_marker") + row.menu("NLA_MT_edit") + row.menu("NLA_MT_add") dopesheet_filter(layout, context) layout.prop(st, "auto_snap", text="") -class NLA_MT_view(bpy.types.Menu): +class NLA_MT_view(Menu): bl_label = _("View") def draw(self, context): @@ -57,8 +56,6 @@ class NLA_MT_view(bpy.types.Menu): st = context.space_data - layout.column() - layout.operator("nla.properties", icon='MENU_PANEL') layout.separator() @@ -75,17 +72,20 @@ class NLA_MT_view(bpy.types.Menu): layout.operator("anim.previewrange_clear") layout.separator() + layout.operator("nla.view_all") + layout.operator("nla.view_selected") + + layout.separator() layout.operator("screen.area_dupli") layout.operator("screen.screen_full_area") -class NLA_MT_select(bpy.types.Menu): +class NLA_MT_select(Menu): bl_label = _("Select") def draw(self, context): layout = self.layout - layout.column() # This is a bit misleading as the operator's default text is "Select All" while it actually *toggles* All/None layout.operator("nla.select_all_toggle") layout.operator("nla.select_all_toggle", text=_("Invert Selection")).invert = True @@ -99,7 +99,7 @@ class NLA_MT_select(bpy.types.Menu): layout.operator("nla.select_leftright", text=_("After Current Frame")).mode = 'RIGHT' -class NLA_MT_marker(bpy.types.Menu): +class NLA_MT_marker(Menu): bl_label = _("Marker") def draw(self, context): @@ -107,7 +107,6 @@ class NLA_MT_marker(bpy.types.Menu): #layout.operator_context = 'EXEC_REGION_WIN' - layout.column() layout.operator("marker.add", _("Add Marker")) layout.operator("marker.duplicate", text=_("Duplicate Marker")) layout.operator("marker.delete", text=_("Delete Marker")) @@ -118,7 +117,7 @@ class NLA_MT_marker(bpy.types.Menu): layout.operator("marker.move", text=_("Grab/Move Marker")) -class NLA_MT_edit(bpy.types.Menu): +class NLA_MT_edit(Menu): bl_label = _("Edit") def draw(self, context): @@ -126,7 +125,6 @@ class NLA_MT_edit(bpy.types.Menu): scene = context.scene - layout.column() layout.menu("NLA_MT_edit_transform", text=_("Transform")) layout.operator_menu_enum("nla.snap", "type", text=_("Snap")) @@ -161,15 +159,15 @@ class NLA_MT_edit(bpy.types.Menu): layout.operator("nla.tweakmode_enter", text=_("Start Tweaking Strip Actions")) -class NLA_MT_add(bpy.types.Menu): +class NLA_MT_add(Menu): bl_label = _("Add") def draw(self, context): layout = self.layout - layout.column() layout.operator("nla.actionclip_add") layout.operator("nla.transition_add") + layout.operator("nla.soundclip_add") layout.separator() layout.operator("nla.meta_add") @@ -180,13 +178,12 @@ class NLA_MT_add(bpy.types.Menu): layout.operator("nla.tracks_add", text=_("Add Tracks Above Selected")).above_selected = True -class NLA_MT_edit_transform(bpy.types.Menu): +class NLA_MT_edit_transform(Menu): bl_label = _("Transform") def draw(self, context): layout = self.layout - layout.column() layout.operator("transform.translate", text=_("Grab/Move")) layout.operator("transform.transform", text=_("Extend")).mode = 'TIME_EXTEND' layout.operator("transform.transform", text=_("Scale")).mode = 'TIME_SCALE' diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py index 99b6ba2463f..6a58fc143fa 100644 --- a/release/scripts/startup/bl_ui/space_node.py +++ b/release/scripts/startup/bl_ui/space_node.py @@ -18,43 +18,40 @@ # <pep8 compliant> import bpy +from bpy.types import Header, Menu, Panel from blf import gettext as _ -class NODE_HT_header(bpy.types.Header): +class NODE_HT_header(Header): bl_space_type = 'NODE_EDITOR' def draw(self, context): layout = self.layout snode = context.space_data + snode_id = snode.id + id_from = snode.id_from row = layout.row(align=True) row.template_header() if context.area.show_menus: - sub = row.row(align=True) - sub.menu("NODE_MT_view") - sub.menu("NODE_MT_select") - sub.menu("NODE_MT_add") - sub.menu("NODE_MT_node") + row.menu("NODE_MT_view") + row.menu("NODE_MT_select") + row.menu("NODE_MT_add") + row.menu("NODE_MT_node") - row = layout.row() - row.prop(snode, "tree_type", text="", expand=True) + layout.prop(snode, "tree_type", text="", expand=True) if snode.tree_type == 'MATERIAL': - ob = snode.id_from - snode_id = snode.id - if ob: - layout.template_ID(ob, "active_material", new="material.new") + if id_from: + layout.template_ID(id_from, "active_material", new="material.new") if snode_id: layout.prop(snode_id, "use_nodes") elif snode.tree_type == 'TEXTURE': - row.prop(snode, "texture_type", text="", expand=True) + layout.prop(snode, "texture_type", text="", expand=True) - snode_id = snode.id - id_from = snode.id_from if id_from: if snode.texture_type == 'BRUSH': layout.template_ID(id_from, "texture", new="texture.new") @@ -64,10 +61,8 @@ class NODE_HT_header(bpy.types.Header): layout.prop(snode_id, "use_nodes") elif snode.tree_type == 'COMPOSITING': - scene = snode.id - - layout.prop(scene, "use_nodes") - layout.prop(scene.render, "use_free_unused_nodes", text=_("Free Unused")) + layout.prop(snode_id, "use_nodes") + layout.prop(snode_id.render, "use_free_unused_nodes", text=_("Free Unused")) layout.prop(snode, "show_backdrop") if snode.show_backdrop: row = layout.row(align=True) @@ -79,7 +74,7 @@ class NODE_HT_header(bpy.types.Header): layout.template_running_jobs() -class NODE_MT_view(bpy.types.Menu): +class NODE_MT_view(Menu): bl_label = _("View") def draw(self, context): @@ -108,7 +103,7 @@ class NODE_MT_view(bpy.types.Menu): layout.operator("screen.screen_full_area") -class NODE_MT_select(bpy.types.Menu): +class NODE_MT_select(Menu): bl_label = _("Select") def draw(self, context): @@ -125,7 +120,7 @@ class NODE_MT_select(bpy.types.Menu): layout.operator("node.select_same_type_prev") -class NODE_MT_node(bpy.types.Menu): +class NODE_MT_node(Menu): bl_label = _("Node") def draw(self, context): @@ -166,7 +161,7 @@ class NODE_MT_node(bpy.types.Menu): # Node Backdrop options -class NODE_PT_properties(bpy.types.Panel): +class NODE_PT_properties(Panel): bl_space_type = 'NODE_EDITOR' bl_region_type = 'UI' bl_label = _("Backdrop") diff --git a/release/scripts/startup/bl_ui/space_outliner.py b/release/scripts/startup/bl_ui/space_outliner.py index 2ce2d05c58f..b3be568cf68 100644 --- a/release/scripts/startup/bl_ui/space_outliner.py +++ b/release/scripts/startup/bl_ui/space_outliner.py @@ -18,10 +18,11 @@ # <pep8 compliant> import bpy +from bpy.types import Header, Menu from blf import gettext as _ -class OUTLINER_HT_header(bpy.types.Header): +class OUTLINER_HT_header(Header): bl_space_type = 'OUTLINER' def draw(self, context): @@ -64,7 +65,7 @@ class OUTLINER_HT_header(bpy.types.Header): row.label(text="No Keying Set active") -class OUTLINER_MT_view(bpy.types.Menu): +class OUTLINER_MT_view(Menu): bl_label = _("View") def draw(self, context): @@ -72,14 +73,13 @@ class OUTLINER_MT_view(bpy.types.Menu): space = context.space_data - col = layout.column() if space.display_mode not in {'DATABLOCKS', 'USER_PREFERENCES', 'KEYMAPS'}: - col.prop(space, "show_restrict_columns") - col.separator() - col.operator("outliner.show_active") + layout.prop(space, "show_restrict_columns") + layout.separator() + layout.operator("outliner.show_active") - col.operator("outliner.show_one_level") - col.operator("outliner.show_hierarchy") + layout.operator("outliner.show_one_level") + layout.operator("outliner.show_hierarchy") layout.separator() @@ -87,7 +87,7 @@ class OUTLINER_MT_view(bpy.types.Menu): layout.operator("screen.screen_full_area") -class OUTLINER_MT_search(bpy.types.Menu): +class OUTLINER_MT_search(Menu): bl_label = _("Search") def draw(self, context): @@ -95,27 +95,23 @@ class OUTLINER_MT_search(bpy.types.Menu): space = context.space_data - col = layout.column() + layout.prop(space, "use_filter_case_sensitive") + layout.prop(space, "use_filter_complete") - col.prop(space, "use_filter_case_sensitive") - col.prop(space, "use_filter_complete") - -class OUTLINER_MT_edit_datablocks(bpy.types.Menu): +class OUTLINER_MT_edit_datablocks(Menu): bl_label = _("Edit") def draw(self, context): layout = self.layout - col = layout.column() - - col.operator("outliner.keyingset_add_selected") - col.operator("outliner.keyingset_remove_selected") + layout.operator("outliner.keyingset_add_selected") + layout.operator("outliner.keyingset_remove_selected") - col.separator() + layout.separator() - col.operator("outliner.drivers_add_selected") - col.operator("outliner.drivers_delete_selected") + layout.operator("outliner.drivers_add_selected") + layout.operator("outliner.drivers_delete_selected") if __name__ == "__main__": # only for live edit. bpy.utils.register_module(__name__) diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index 1f9d45e9bc4..ddbbc08eb46 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Header, Menu, Panel from blf import gettext as _ @@ -28,7 +29,7 @@ def act_strip(context): return None -class SEQUENCER_HT_header(bpy.types.Header): +class SEQUENCER_HT_header(Header): bl_space_type = 'SEQUENCE_EDITOR' def draw(self, context): @@ -40,14 +41,13 @@ class SEQUENCER_HT_header(bpy.types.Header): row.template_header() if context.area.show_menus: - sub = row.row(align=True) - sub.menu("SEQUENCER_MT_view") + row.menu("SEQUENCER_MT_view") if st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'}: - sub.menu("SEQUENCER_MT_select") - sub.menu("SEQUENCER_MT_marker") - sub.menu("SEQUENCER_MT_add") - sub.menu("SEQUENCER_MT_strip") + row.menu("SEQUENCER_MT_select") + row.menu("SEQUENCER_MT_marker") + row.menu("SEQUENCER_MT_add") + row.menu("SEQUENCER_MT_strip") layout.prop(st, "view_type", expand=True, text="") @@ -61,6 +61,7 @@ class SEQUENCER_HT_header(bpy.types.Header): layout.separator() layout.operator("sequencer.refresh_all") + layout.template_running_jobs() elif st.view_type == 'SEQUENCER_PREVIEW': layout.separator() layout.operator("sequencer.refresh_all") @@ -77,7 +78,7 @@ class SEQUENCER_HT_header(bpy.types.Header): row.prop(ed, "overlay_lock", text="", icon='LOCKED') -class SEQUENCER_MT_view_toggle(bpy.types.Menu): +class SEQUENCER_MT_view_toggle(Menu): bl_label = _("View Type") def draw(self, context): @@ -88,7 +89,7 @@ class SEQUENCER_MT_view_toggle(bpy.types.Menu): layout.operator("sequencer.view_toggle").type = 'SEQUENCER_PREVIEW' -class SEQUENCER_MT_view(bpy.types.Menu): +class SEQUENCER_MT_view(Menu): bl_label = _("View") def draw(self, context): @@ -96,8 +97,6 @@ class SEQUENCER_MT_view(bpy.types.Menu): st = context.space_data - layout.column() - layout.operator("sequencer.properties", icon='MENU_PANEL') layout.separator() @@ -115,7 +114,11 @@ class SEQUENCER_MT_view(bpy.types.Menu): layout.operator("sequencer.view_selected") - layout.prop(st, "show_frames") + if st.show_frames: + layout.operator("anim.time_toggle", text=_("Show Seconds")) + else: + layout.operator("anim.time_toggle", text=_("Show Frames")) + layout.prop(st, "show_frame_indicator") if st.display_mode == 'IMAGE': layout.prop(st, "show_safe_margin") @@ -130,13 +133,12 @@ class SEQUENCER_MT_view(bpy.types.Menu): layout.operator("screen.screen_full_area") -class SEQUENCER_MT_select(bpy.types.Menu): +class SEQUENCER_MT_select(Menu): bl_label = _("Select") def draw(self, context): layout = self.layout - layout.column() layout.operator("sequencer.select_active_side", text=_("Strips to the Left")).side = 'LEFT' layout.operator("sequencer.select_active_side", text=_("Strips to the Right")).side = 'RIGHT' layout.separator() @@ -149,7 +151,7 @@ class SEQUENCER_MT_select(bpy.types.Menu): layout.operator("sequencer.select_inverse") -class SEQUENCER_MT_marker(bpy.types.Menu): +class SEQUENCER_MT_marker(Menu): bl_label = _("Marker") def draw(self, context): @@ -157,7 +159,6 @@ class SEQUENCER_MT_marker(bpy.types.Menu): #layout.operator_context = 'EXEC_REGION_WIN' - layout.column() layout.operator("marker.add", _("Add Marker")) layout.operator("marker.duplicate", text=_("Duplicate Marker")) layout.operator("marker.delete", text=_("Delete Marker")) @@ -170,14 +171,26 @@ class SEQUENCER_MT_marker(bpy.types.Menu): #layout.operator("sequencer.sound_strip_add", text="Transform Markers") # toggle, will be rna - (sseq->flag & SEQ_MARKER_TRANS) -class SEQUENCER_MT_add(bpy.types.Menu): +class SEQUENCER_MT_change(Menu): + bl_label = _("Change") + + def draw(self, context): + layout = self.layout + + layout.operator_context = 'INVOKE_REGION_WIN' + + layout.operator_menu_enum("sequencer.change_effect_input", "swap") + layout.operator_menu_enum("sequencer.change_effect_type", "type") + layout.operator("sequencer.change_path", text=_("Path/Files")) + + +class SEQUENCER_MT_add(Menu): bl_label = _("Add") def draw(self, context): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' - layout.column() if len(bpy.data.scenes) > 10: layout.operator_context = 'INVOKE_DEFAULT' layout.operator("sequencer.scene_strip_add", text=_("Scene...")) @@ -191,14 +204,13 @@ class SEQUENCER_MT_add(bpy.types.Menu): layout.menu("SEQUENCER_MT_add_effect") -class SEQUENCER_MT_add_effect(bpy.types.Menu): +class SEQUENCER_MT_add_effect(Menu): bl_label = _("Effect Strip...") def draw(self, context): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' - layout.column() layout.operator("sequencer.effect_strip_add", text=_("Add")).type = 'ADD' layout.operator("sequencer.effect_strip_add", text=_("Subtract")).type = 'SUBTRACT' layout.operator("sequencer.effect_strip_add", text=_("Alpha Over")).type = 'ALPHA_OVER' @@ -217,7 +229,7 @@ class SEQUENCER_MT_add_effect(bpy.types.Menu): layout.operator("sequencer.effect_strip_add", text=_("Adjustment Layer")).type = 'ADJUSTMENT' -class SEQUENCER_MT_strip(bpy.types.Menu): +class SEQUENCER_MT_strip(Menu): bl_label = _("Strip") def draw(self, context): @@ -225,7 +237,6 @@ class SEQUENCER_MT_strip(bpy.types.Menu): layout.operator_context = 'INVOKE_REGION_WIN' - layout.column() layout.operator("transform.transform", text=_("Grab/Move")).mode = 'TRANSLATION' layout.operator("transform.transform", text=_("Grab/Extend from frame")).mode = 'TIME_EXTEND' # uiItemO(layout, NULL, 0, "sequencer.strip_snap"); // TODO - add this operator @@ -234,7 +245,9 @@ class SEQUENCER_MT_strip(bpy.types.Menu): layout.operator("sequencer.cut", text=_("Cut (hard) at frame")).type = 'HARD' layout.operator("sequencer.cut", text=_("Cut (soft) at frame")).type = 'SOFT' layout.operator("sequencer.images_separate") + layout.operator("sequencer.offset_clear") layout.operator("sequencer.deinterlace_selected_movies") + layout.operator("sequencer.rebuild_proxy") layout.separator() layout.operator("sequencer.duplicate") @@ -293,6 +306,7 @@ class SEQUENCER_MT_strip(bpy.types.Menu): layout.separator() layout.operator("sequencer.swap_data") + layout.menu("SEQUENCER_MT_change") class SequencerButtonsPanel(): @@ -321,7 +335,7 @@ class SequencerButtonsPanel_Output(): return cls.has_preview(context) -class SEQUENCER_PT_edit(SequencerButtonsPanel, bpy.types.Panel): +class SEQUENCER_PT_edit(SequencerButtonsPanel, Panel): bl_label = _("Edit Strip") def draw(self, context): @@ -375,9 +389,11 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, bpy.types.Panel): if elem and elem.orig_width > 0 and elem.orig_height > 0: col.label(text=_("Orig Dim")+": %dx%d" % (elem.orig_width, elem.orig_height)) + else: + col.label(text=_("Orig Dim: None")) -class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel): +class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel): bl_label = _("Effect Strip") @classmethod @@ -515,7 +531,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel): col.prop(strip, "rotation_start", text=_("Rotation")) -class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel): +class SEQUENCER_PT_input(SequencerButtonsPanel, Panel): bl_label = _("Strip Input") @classmethod @@ -559,6 +575,9 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel): col = split.column() col.prop(elem, "filename", text="") # strip.elements[0] could be a fallback + # also accessible from the menu + layout.operator("sequencer.change_path") + elif seq_type == 'MOVIE': split = layout.split(percentage=0.2) col = split.column() @@ -566,6 +585,7 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel): col = split.column() col.prop(strip, "filepath", text="") col.prop(strip, "mpeg_preseek", text=_("MPEG Preseek")) + col.prop(strip, "streamindex", text=_("Stream Index")) # TODO, sound??? # end drawing filename @@ -596,7 +616,7 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel): col.prop(strip, "frame_offset_end", text=_("End")) -class SEQUENCER_PT_sound(SequencerButtonsPanel, bpy.types.Panel): +class SEQUENCER_PT_sound(SequencerButtonsPanel, Panel): bl_label = _("Sound") @classmethod @@ -628,8 +648,10 @@ class SEQUENCER_PT_sound(SequencerButtonsPanel, bpy.types.Panel): row.prop(strip.sound, "use_memory_cache") + layout.prop(strip, "waveform") layout.prop(strip, "volume") - layout.prop(strip, "attenuation") + layout.prop(strip, "pitch") + layout.prop(strip, "pan") col = layout.column(align=True) col.label(text="Trim Duration:") @@ -637,7 +659,7 @@ class SEQUENCER_PT_sound(SequencerButtonsPanel, bpy.types.Panel): col.prop(strip, "animation_offset_end", text=_("End")) -class SEQUENCER_PT_scene(SequencerButtonsPanel, bpy.types.Panel): +class SEQUENCER_PT_scene(SequencerButtonsPanel, Panel): bl_label = _("Scene") @classmethod @@ -671,7 +693,7 @@ class SEQUENCER_PT_scene(SequencerButtonsPanel, bpy.types.Panel): layout.label(text=_("Original frame range")+": %d-%d (%d)" % (sta, end, end - sta + 1)) -class SEQUENCER_PT_filter(SequencerButtonsPanel, bpy.types.Panel): +class SEQUENCER_PT_filter(SequencerButtonsPanel, Panel): bl_label = _("Filter") @classmethod @@ -733,8 +755,8 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel, bpy.types.Panel): col.prop(strip.color_balance, "invert_gain", text=_("Inverse")) -class SEQUENCER_PT_proxy(SequencerButtonsPanel, bpy.types.Panel): - bl_label = _("Proxy") +class SEQUENCER_PT_proxy(SequencerButtonsPanel, Panel): + bl_label = _("Proxy / Timecode") @classmethod def poll(cls, context): @@ -760,14 +782,30 @@ class SEQUENCER_PT_proxy(SequencerButtonsPanel, bpy.types.Panel): flow = layout.column_flow() flow.prop(strip, "use_proxy_custom_directory") flow.prop(strip, "use_proxy_custom_file") - if strip.proxy: # TODO - need to add this somehow + if strip.proxy: if strip.use_proxy_custom_directory and not strip.use_proxy_custom_file: flow.prop(strip.proxy, "directory") if strip.use_proxy_custom_file: flow.prop(strip.proxy, "filepath") + row = layout.row() + row.prop(strip.proxy, "build_25") + row.prop(strip.proxy, "build_50") + row.prop(strip.proxy, "build_75") + row.prop(strip.proxy, "build_100") + + col = layout.column() + col.label(text=_("Build JPEG quality")) + col.prop(strip.proxy, "quality") + + if strip.type == "MOVIE": + col = layout.column() + col.label(text=_("Use timecode index:")) + + col.prop(strip.proxy, "timecode") + -class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, bpy.types.Panel): +class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, Panel): bl_label = _("Scene Preview/Render") bl_space_type = 'SEQUENCE_EDITOR' bl_region_type = 'UI' @@ -792,7 +830,7 @@ class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, bpy.types.Panel): ''' -class SEQUENCER_PT_view(SequencerButtonsPanel_Output, bpy.types.Panel): +class SEQUENCER_PT_view(SequencerButtonsPanel_Output, Panel): bl_label = _("View Settings") def draw(self, context): diff --git a/release/scripts/startup/bl_ui/space_text.py b/release/scripts/startup/bl_ui/space_text.py index 93e513acf0a..03baf8f34ca 100644 --- a/release/scripts/startup/bl_ui/space_text.py +++ b/release/scripts/startup/bl_ui/space_text.py @@ -18,10 +18,11 @@ # <pep8-80 compliant> import bpy +from bpy.types import Header, Menu, Panel from blf import gettext as _ -class TEXT_HT_header(bpy.types.Header): +class TEXT_HT_header(Header): bl_space_type = 'TEXT_EDITOR' def draw(self, context): @@ -75,7 +76,7 @@ class TEXT_HT_header(bpy.types.Header): else _("Text: Internal")) -class TEXT_PT_properties(bpy.types.Panel): +class TEXT_PT_properties(Panel): bl_space_type = 'TEXT_EDITOR' bl_region_type = 'UI' bl_label = _("Properties") @@ -106,7 +107,7 @@ class TEXT_PT_properties(bpy.types.Panel): col.prop(st, "margin_column") -class TEXT_PT_find(bpy.types.Panel): +class TEXT_PT_find(Panel): bl_space_type = 'TEXT_EDITOR' bl_region_type = 'UI' bl_label = _("Find") @@ -140,7 +141,7 @@ class TEXT_PT_find(bpy.types.Panel): row.prop(st, "use_find_all", text=_("All")) -class TEXT_MT_view(bpy.types.Menu): +class TEXT_MT_view(Menu): bl_label = _("View") def draw(self, context): @@ -163,7 +164,7 @@ class TEXT_MT_view(bpy.types.Menu): ).type = 'FILE_BOTTOM' -class TEXT_MT_text(bpy.types.Menu): +class TEXT_MT_text(Menu): bl_label = _("Text") def draw(self, context): @@ -172,8 +173,9 @@ class TEXT_MT_text(bpy.types.Menu): st = context.space_data text = st.text - layout.column() + layout.operator_context = 'EXEC_AREA' layout.operator("text.new") + layout.operator_context = 'INVOKE_AREA' layout.operator("text.open") if text: @@ -189,13 +191,8 @@ class TEXT_MT_text(bpy.types.Menu): layout.column() layout.operator("text.run_script") - #ifdef WITH_PYTHON - # XXX if(BPY_is_pyconstraint(text)) - # XXX uiMenuItemO(head, 0, "text.refresh_pyconstraints"); - #endif - -class TEXT_MT_templates(bpy.types.Menu): +class TEXT_MT_templates(Menu): bl_label = _("Templates") def draw(self, context): @@ -205,7 +202,7 @@ class TEXT_MT_templates(bpy.types.Menu): ) -class TEXT_MT_edit_select(bpy.types.Menu): +class TEXT_MT_edit_select(Menu): bl_label = _("Select") def draw(self, context): @@ -215,7 +212,7 @@ class TEXT_MT_edit_select(bpy.types.Menu): layout.operator("text.select_line") -class TEXT_MT_edit_markers(bpy.types.Menu): +class TEXT_MT_edit_markers(Menu): bl_label = _("Markers") def draw(self, context): @@ -226,7 +223,7 @@ class TEXT_MT_edit_markers(bpy.types.Menu): layout.operator("text.previous_marker") -class TEXT_MT_format(bpy.types.Menu): +class TEXT_MT_format(Menu): bl_label = _("Format") def draw(self, context): @@ -245,7 +242,7 @@ class TEXT_MT_format(bpy.types.Menu): layout.operator_menu_enum("text.convert_whitespace", "type") -class TEXT_MT_edit_to3d(bpy.types.Menu): +class TEXT_MT_edit_to3d(Menu): bl_label = _("Text To 3D Object") def draw(self, context): @@ -259,7 +256,7 @@ class TEXT_MT_edit_to3d(bpy.types.Menu): ).split_lines = True -class TEXT_MT_edit(bpy.types.Menu): +class TEXT_MT_edit(Menu): bl_label = _("Edit") @classmethod @@ -293,7 +290,7 @@ class TEXT_MT_edit(bpy.types.Menu): layout.menu("TEXT_MT_edit_to3d") -class TEXT_MT_toolbox(bpy.types.Menu): +class TEXT_MT_toolbox(Menu): bl_label = "" def draw(self, context): diff --git a/release/scripts/startup/bl_ui/space_time.py b/release/scripts/startup/bl_ui/space_time.py index d6d34eb8888..157fe9939e8 100644 --- a/release/scripts/startup/bl_ui/space_time.py +++ b/release/scripts/startup/bl_ui/space_time.py @@ -18,10 +18,11 @@ # <pep8 compliant> import bpy +from bpy.types import Header, Menu from blf import gettext as _ -class TIME_HT_header(bpy.types.Header): +class TIME_HT_header(Header): bl_space_type = 'TIMELINE' def draw(self, context): @@ -35,10 +36,9 @@ class TIME_HT_header(bpy.types.Header): row.template_header() if context.area.show_menus: - sub = row.row(align=True) - sub.menu("TIME_MT_view") - sub.menu("TIME_MT_frame") - sub.menu("TIME_MT_playback") + row.menu("TIME_MT_view") + row.menu("TIME_MT_frame") + row.menu("TIME_MT_playback") layout.prop(scene, "use_preview_range", text="", toggle=True) @@ -92,7 +92,7 @@ class TIME_HT_header(bpy.types.Header): row.operator("anim.keyframe_delete", text="", icon='KEY_DEHLT') -class TIME_MT_view(bpy.types.Menu): +class TIME_MT_view(Menu): bl_label = _("View") def draw(self, context): @@ -117,7 +117,7 @@ class TIME_MT_view(bpy.types.Menu): layout.operator("marker.camera_bind") -class TIME_MT_cache(bpy.types.Menu): +class TIME_MT_cache(Menu): bl_label = _("Cache") def draw(self, context): @@ -137,7 +137,7 @@ class TIME_MT_cache(bpy.types.Menu): col.prop(st, "cache_smoke") -class TIME_MT_frame(bpy.types.Menu): +class TIME_MT_frame(Menu): bl_label = _("Frame") def draw(self, context): @@ -163,7 +163,7 @@ class TIME_MT_frame(bpy.types.Menu): sub.menu("TIME_MT_autokey") -class TIME_MT_playback(bpy.types.Menu): +class TIME_MT_playback(Menu): bl_label = _("Playback") def draw(self, context): @@ -188,7 +188,7 @@ class TIME_MT_playback(bpy.types.Menu): layout.prop(scene, "use_audio_scrub") -class TIME_MT_autokey(bpy.types.Menu): +class TIME_MT_autokey(Menu): bl_label = _("Auto-Keyframing Mode") def draw(self, context): diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 0783790c12c..12f992903c7 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Header, Menu, Operator, Panel import os import addon_utils @@ -76,7 +77,7 @@ def opengl_lamp_buttons(column, lamp): col.prop(lamp, "direction", text="") -class USERPREF_HT_header(bpy.types.Header): +class USERPREF_HT_header(Header): bl_space_type = 'USER_PREFERENCES' def draw(self, context): @@ -100,7 +101,7 @@ class USERPREF_HT_header(bpy.types.Header): layout.operator("ui.reset_default_theme") -class USERPREF_PT_tabs(bpy.types.Panel): +class USERPREF_PT_tabs(Panel): bl_label = "" bl_space_type = 'USER_PREFERENCES' bl_region_type = 'WINDOW' @@ -114,14 +115,14 @@ class USERPREF_PT_tabs(bpy.types.Panel): layout.prop(userpref, "active_section", expand=True) -class USERPREF_MT_interaction_presets(bpy.types.Menu): +class USERPREF_MT_interaction_presets(Menu): bl_label = _("Presets") preset_subdir = "interaction" preset_operator = "script.execute_preset" - draw = bpy.types.Menu.draw_preset + draw = Menu.draw_preset -class USERPREF_MT_appconfigs(bpy.types.Menu): +class USERPREF_MT_appconfigs(Menu): bl_label = "AppPresets" preset_subdir = "keyconfig" preset_operator = "wm.appconfig_activate" @@ -130,10 +131,10 @@ class USERPREF_MT_appconfigs(bpy.types.Menu): self.layout.operator("wm.appconfig_default", text=_("Blender (default)")) # now draw the presets - bpy.types.Menu.draw_preset(self, context) + Menu.draw_preset(self, context) -class USERPREF_MT_splash(bpy.types.Menu): +class USERPREF_MT_splash(Menu): bl_label = "Splash" def draw(self, context): @@ -150,7 +151,7 @@ class USERPREF_MT_splash(bpy.types.Menu): row.menu("USERPREF_MT_appconfigs", text=_("Preset")) -class USERPREF_PT_interface(bpy.types.Panel): +class USERPREF_PT_interface(Panel): bl_space_type = 'USER_PREFERENCES' bl_label = _("Interface") bl_region_type = 'WINDOW' @@ -247,7 +248,7 @@ class USERPREF_PT_interface(bpy.types.Panel): col.prop(view, "show_splash") -class USERPREF_PT_edit(bpy.types.Panel): +class USERPREF_PT_edit(Panel): bl_space_type = 'USER_PREFERENCES' bl_label = _("Edit") bl_region_type = 'WINDOW' @@ -360,7 +361,7 @@ class USERPREF_PT_edit(bpy.types.Panel): col.prop(edit, "use_duplicate_particle", text=_("Particle")) -class USERPREF_PT_system(bpy.types.Panel): +class USERPREF_PT_system(Panel): bl_space_type = 'USER_PREFERENCES' bl_label = _("System") bl_region_type = 'WINDOW' @@ -496,7 +497,7 @@ class USERPREF_PT_system(bpy.types.Panel): sub.template_color_ramp(system, "weight_color_range", expand=True) -class USERPREF_PT_theme(bpy.types.Panel): +class USERPREF_PT_theme(Panel): bl_space_type = 'USER_PREFERENCES' bl_label = _("Themes") bl_region_type = 'WINDOW' @@ -679,7 +680,7 @@ class USERPREF_PT_theme(bpy.types.Panel): self._theme_generic(split, getattr(theme, theme.theme_area.lower())) -class USERPREF_PT_file(bpy.types.Panel): +class USERPREF_PT_file(Panel): bl_space_type = 'USER_PREFERENCES' bl_label = _("Files") bl_region_type = 'WINDOW' @@ -755,7 +756,7 @@ class USERPREF_PT_file(bpy.types.Panel): from bl_ui.space_userpref_keymap import InputKeyMapPanel -class USERPREF_MT_ndof_settings(bpy.types.Menu): +class USERPREF_MT_ndof_settings(Menu): # accessed from the window keybindings in C (only) bl_label = _("3D Mouse Settings") @@ -780,7 +781,7 @@ class USERPREF_MT_ndof_settings(bpy.types.Menu): layout.prop(input_prefs, "ndof_lock_horizon", icon='NDOF_DOM') -class USERPREF_PT_input(bpy.types.Panel, InputKeyMapPanel): +class USERPREF_PT_input(Panel, InputKeyMapPanel): bl_space_type = 'USER_PREFERENCES' bl_label = _("Input") @@ -870,7 +871,7 @@ class USERPREF_PT_input(bpy.types.Panel, InputKeyMapPanel): #print("runtime", time.time() - start) -class USERPREF_MT_addons_dev_guides(bpy.types.Menu): +class USERPREF_MT_addons_dev_guides(Menu): bl_label = _("Development Guides") # menu to open webpages with addons development guides @@ -881,7 +882,7 @@ class USERPREF_MT_addons_dev_guides(bpy.types.Menu): layout.operator('wm.url_open', text=_('How to share your addon'), icon='URL').url = 'http://wiki.blender.org/index.php/Dev:Py/Sharing' -class USERPREF_PT_addons(bpy.types.Panel): +class USERPREF_PT_addons(Panel): bl_space_type = 'USER_PREFERENCES' bl_label = _("Addons") bl_region_type = 'WINDOW' @@ -1071,7 +1072,7 @@ class USERPREF_PT_addons(bpy.types.Panel): row.operator("wm.addon_disable", icon='CHECKBOX_HLT', text="", emboss=False).module = module_name -class WM_OT_addon_enable(bpy.types.Operator): +class WM_OT_addon_enable(Operator): "Enable an addon" bl_idname = "wm.addon_enable" bl_label = _("Enable Add-On") @@ -1100,33 +1101,55 @@ class WM_OT_addon_enable(bpy.types.Operator): return {'CANCELLED'} -class WM_OT_addon_disable(bpy.types.Operator): +class WM_OT_addon_disable(Operator): "Disable an addon" bl_idname = "wm.addon_disable" bl_label = _("Disable Add-On") - module = StringProperty(name=_("Module"), description=_("Module name of the addon to disable")) + module = StringProperty( + name=_("Module"), + description=_("Module name of the addon to disable"), + ) def execute(self, context): addon_utils.disable(self.module) return {'FINISHED'} -class WM_OT_addon_install(bpy.types.Operator): +class WM_OT_addon_install(Operator): "Install an addon" bl_idname = "wm.addon_install" bl_label = _("Install Add-On...") - overwrite = BoolProperty(name=_("Overwrite"), description=_("Remove existing addons with the same ID"), default=True) + overwrite = BoolProperty( + name=_("Overwrite"), + description=_("Remove existing addons with the same ID"), + default=True, + ) target = EnumProperty( name="Target Path", items=(('DEFAULT', "Default", ""), - ('PREFS', "User Prefs", ""))) + ('PREFS', "User Prefs", "")), + ) - filepath = StringProperty(name=_("File Path"), description=_("File path to write file to")) - filter_folder = BoolProperty(name=_("Filter folders"), description="", default=True, options={'HIDDEN'}) - filter_python = BoolProperty(name=_("Filter python"), description="", default=True, options={'HIDDEN'}) - filter_glob = StringProperty(default="*.py;*.zip", options={'HIDDEN'}) + filepath = StringProperty( + name=_("File Path"), + description=_("File path to write file to"), + ) + filter_folder = BoolProperty( + name=_("Filter folders"), + default=True, + options={'HIDDEN'}, + ) + filter_python = BoolProperty( + name=_("Filter python"), + default=True, + options={'HIDDEN'}, + ) + filter_glob = StringProperty( + default="*.py;*.zip", + options={'HIDDEN'}, + ) @staticmethod def _module_remove(path_addons, module): @@ -1258,12 +1281,15 @@ class WM_OT_addon_install(bpy.types.Operator): return {'RUNNING_MODAL'} -class WM_OT_addon_remove(bpy.types.Operator): +class WM_OT_addon_remove(Operator): "Disable an addon" bl_idname = "wm.addon_remove" bl_label = _("Remove Add-On") - module = StringProperty(name="Module", description="Module name of the addon to remove") + module = StringProperty( + name=_("Module"), + description=_("Module name of the addon to remove"), + ) @staticmethod def path_from_addon(module): @@ -1306,12 +1332,15 @@ class WM_OT_addon_remove(bpy.types.Operator): return wm.invoke_props_dialog(self, width=600) -class WM_OT_addon_expand(bpy.types.Operator): +class WM_OT_addon_expand(Operator): "Display more information on this add-on" bl_idname = "wm.addon_expand" bl_label = "" - module = StringProperty(name=_("Module"), description=_("Module name of the addon to expand")) + module = StringProperty( + name=_("Module"), + description=_("Module name of the addon to expand"), + ) def execute(self, context): module_name = self.module diff --git a/release/scripts/startup/bl_ui/space_userpref_keymap.py b/release/scripts/startup/bl_ui/space_userpref_keymap.py index 0281f49f1a5..336e4edf006 100644 --- a/release/scripts/startup/bl_ui/space_userpref_keymap.py +++ b/release/scripts/startup/bl_ui/space_userpref_keymap.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Menu, Operator, OperatorProperties import os from blf import gettext as _ from blf import fake_gettext as N_ @@ -126,7 +127,7 @@ def _merge_keymaps(kc1, kc2): return merged_keymaps -class USERPREF_MT_keyconfigs(bpy.types.Menu): +class USERPREF_MT_keyconfigs(Menu): bl_label = _("KeyPresets") preset_subdir = "keyconfig" preset_operator = "wm.keyconfig_activate" @@ -137,7 +138,7 @@ class USERPREF_MT_keyconfigs(bpy.types.Menu): props.value = "context.window_manager.keyconfigs.default" # now draw the presets - bpy.types.Menu.draw_preset(self, context) + Menu.draw_preset(self, context) class InputKeyMapPanel: @@ -234,7 +235,7 @@ class InputKeyMapPanel: flow = box.column_flow(columns=2) for pname, value in properties.bl_rna.properties.items(): if pname != "rna_type" and not properties.is_property_hidden(pname): - if isinstance(value, bpy.types.OperatorProperties): + if isinstance(value, OperatorProperties): InputKeyMapPanel.draw_kmi_properties(box, value, title=pname) else: flow.prop(properties, pname) @@ -412,7 +413,7 @@ def export_properties(prefix, properties, lines=None): for pname in properties.bl_rna.properties.keys(): if pname != "rna_type" and not properties.is_property_hidden(pname): value = getattr(properties, pname) - if isinstance(value, bpy.types.OperatorProperties): + if isinstance(value, OperatorProperties): export_properties(prefix + "." + pname, value, lines) elif properties.is_property_set(pname): value = _string_value(value) @@ -421,7 +422,7 @@ def export_properties(prefix, properties, lines=None): return lines -class WM_OT_keyconfig_test(bpy.types.Operator): +class WM_OT_keyconfig_test(Operator): "Test keyconfig for conflicts" bl_idname = "wm.keyconfig_test" bl_label = _("Test Key Configuration for Conflicts") @@ -530,18 +531,37 @@ def _string_value(value): return result -class WM_OT_keyconfig_import(bpy.types.Operator): +class WM_OT_keyconfig_import(Operator): "Import key configuration from a python script" bl_idname = "wm.keyconfig_import" bl_label = _("Import Key Configuration...") __doc__ = _("Import key configuration from a python script") - filepath = StringProperty(name=_("File Path"), description=_("Filepath to write file to"), default="keymap.py") - filter_folder = BoolProperty(name=_("Filter folders"), description="", default=True, options={'HIDDEN'}) - filter_text = BoolProperty(name=_("Filter text"), description="", default=True, options={'HIDDEN'}) - filter_python = BoolProperty(name=_("Filter python"), description="", default=True, options={'HIDDEN'}) - - keep_original = BoolProperty(name=_("Keep original"), description=_("Keep original file after copying to configuration folder"), default=True) + filepath = StringProperty( + name=_("File Path"), + description=_("Filepath to write file to"), + default="keymap.py", + ) + filter_folder = BoolProperty( + name=_("Filter folders"), + default=True, + options={'HIDDEN'}, + ) + filter_text = BoolProperty( + name=_("Filter text"), + default=True, + options={'HIDDEN'}, + ) + filter_python = BoolProperty( + name=_("Filter python"), + default=True, + options={'HIDDEN'}, + ) + keep_original = BoolProperty( + name=_("Keep original"), + description=_("Keep original file after copying to configuration folder"), + default=True, + ) def execute(self, context): from os.path import basename @@ -578,16 +598,32 @@ class WM_OT_keyconfig_import(bpy.types.Operator): # This operator is also used by interaction presets saving - AddPresetBase -class WM_OT_keyconfig_export(bpy.types.Operator): +class WM_OT_keyconfig_export(Operator): "Export key configuration to a python script" bl_idname = "wm.keyconfig_export" bl_label = _("Export Key Configuration...") __doc__ = _("Export key configuration to a python script") - filepath = StringProperty(name=_("File Path"), description=_("Filepath to write file to"), default="keymap.py") - filter_folder = BoolProperty(name=_("Filter folders"), description="", default=True, options={'HIDDEN'}) - filter_text = BoolProperty(name=_("Filter text"), description="", default=True, options={'HIDDEN'}) - filter_python = BoolProperty(name=_("Filter python"), description="", default=True, options={'HIDDEN'}) + filepath = StringProperty( + name=_("File Path"), + description=_("Filepath to write file to"), + default="keymap.py", + ) + filter_folder = BoolProperty( + name=_("Filter folders"), + default=True, + options={'HIDDEN'}, + ) + filter_text = BoolProperty( + name=_("Filter text"), + default=True, + options={'HIDDEN'}, + ) + filter_python = BoolProperty( + name=_("Filter python"), + default=True, + options={'HIDDEN'}, + ) def execute(self, context): if not self.filepath: @@ -672,13 +708,16 @@ class WM_OT_keyconfig_export(bpy.types.Operator): return {'RUNNING_MODAL'} -class WM_OT_keymap_restore(bpy.types.Operator): +class WM_OT_keymap_restore(Operator): "Restore key map(s)" bl_idname = "wm.keymap_restore" bl_label = _("Restore Key Map(s)") __doc__ = _("Restore key map(s)") - all = BoolProperty(name="All Keymaps", description="Restore all keymaps to default") + all = BoolProperty( + name=_("All Keymaps"), + description=_("Restore all keymaps to default"), + ) def execute(self, context): wm = context.window_manager @@ -693,13 +732,16 @@ class WM_OT_keymap_restore(bpy.types.Operator): return {'FINISHED'} -class WM_OT_keyitem_restore(bpy.types.Operator): +class WM_OT_keyitem_restore(Operator): "Restore key map item" bl_idname = "wm.keyitem_restore" bl_label = _("Restore Key Map Item") __doc__ = _("Restore key map item") - item_id = IntProperty(name="Item Identifier", description="Identifier of the item to remove") + item_id = IntProperty( + name=_("Item Identifier"), + description=_("Identifier of the item to remove"), + ) @classmethod def poll(cls, context): @@ -716,7 +758,7 @@ class WM_OT_keyitem_restore(bpy.types.Operator): return {'FINISHED'} -class WM_OT_keyitem_add(bpy.types.Operator): +class WM_OT_keyitem_add(Operator): "Add key map item" bl_idname = "wm.keyitem_add" bl_label = _("Add Key Map Item") @@ -739,13 +781,16 @@ class WM_OT_keyitem_add(bpy.types.Operator): return {'FINISHED'} -class WM_OT_keyitem_remove(bpy.types.Operator): +class WM_OT_keyitem_remove(Operator): "Remove key map item" bl_idname = "wm.keyitem_remove" bl_label = _("Remove Key Map Item") __doc__ = _("Remove key map item") - item_id = IntProperty(name=_("Item Identifier"), description=_("Identifier of the item to remove")) + item_id = IntProperty( + name=_("Item Identifier"), + description=_("Identifier of the item to remove"), + ) @classmethod def poll(cls, context): @@ -758,7 +803,7 @@ class WM_OT_keyitem_remove(bpy.types.Operator): return {'FINISHED'} -class WM_OT_keyconfig_remove(bpy.types.Operator): +class WM_OT_keyconfig_remove(Operator): "Remove key config" bl_idname = "wm.keyconfig_remove" bl_label = _("Remove Key Config") diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 48ad82c9bb4..c78ad774165 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -18,10 +18,11 @@ # <pep8 compliant> import bpy +from bpy.types import Header, Menu, Operator, Panel from blf import gettext as _ -class VIEW3D_HT_header(bpy.types.Header): +class VIEW3D_HT_header(Header): bl_space_type = 'VIEW_3D' def draw(self, context): @@ -129,7 +130,7 @@ class ShowHideMenu(): layout.operator("%s.hide" % self._operator_name, text=_("Hide Unselected")).unselected = True -class VIEW3D_MT_transform(bpy.types.Menu): +class VIEW3D_MT_transform(Menu): bl_label = _("Transform") # TODO: get rid of the custom text strings? @@ -180,8 +181,12 @@ class VIEW3D_MT_transform(bpy.types.Menu): layout.operator("object.randomize_transform") layout.operator("object.align") + layout.separator() + + layout.operator("object.anim_transforms_to_deltas") -class VIEW3D_MT_mirror(bpy.types.Menu): + +class VIEW3D_MT_mirror(Menu): bl_label = _("Mirror") def draw(self, context): @@ -219,7 +224,7 @@ class VIEW3D_MT_mirror(bpy.types.Menu): layout.operator("object.vertex_group_mirror") -class VIEW3D_MT_snap(bpy.types.Menu): +class VIEW3D_MT_snap(Menu): bl_label = _("Snap") def draw(self, context): @@ -236,7 +241,7 @@ class VIEW3D_MT_snap(bpy.types.Menu): layout.operator("view3d.snap_cursor_to_active", text=_("Cursor to Active")) -class VIEW3D_MT_uv_map(bpy.types.Menu): +class VIEW3D_MT_uv_map(Menu): bl_label = _("UV Mapping") def draw(self, context): @@ -269,7 +274,7 @@ class VIEW3D_MT_uv_map(bpy.types.Menu): # ********** View menus ********** -class VIEW3D_MT_view(bpy.types.Menu): +class VIEW3D_MT_view(Menu): bl_label = _("View") def draw(self, context): @@ -327,7 +332,7 @@ class VIEW3D_MT_view(bpy.types.Menu): layout.operator("screen.screen_full_area") -class VIEW3D_MT_view_navigation(bpy.types.Menu): +class VIEW3D_MT_view_navigation(Menu): bl_label = _("Navigation") def draw(self, context): @@ -350,7 +355,7 @@ class VIEW3D_MT_view_navigation(bpy.types.Menu): layout.operator("view3d.fly") -class VIEW3D_MT_view_align(bpy.types.Menu): +class VIEW3D_MT_view_align(Menu): bl_label = _("Align View") def draw(self, context): @@ -366,7 +371,7 @@ class VIEW3D_MT_view_align(bpy.types.Menu): layout.operator("view3d.view_center_cursor") -class VIEW3D_MT_view_align_selected(bpy.types.Menu): +class VIEW3D_MT_view_align_selected(Menu): bl_label = _("Align View to Selected") def draw(self, context): @@ -392,7 +397,7 @@ class VIEW3D_MT_view_align_selected(bpy.types.Menu): props.type = 'LEFT' -class VIEW3D_MT_view_cameras(bpy.types.Menu): +class VIEW3D_MT_view_cameras(Menu): bl_label = _("Cameras") def draw(self, context): @@ -404,7 +409,7 @@ class VIEW3D_MT_view_cameras(bpy.types.Menu): # ********** Select menus, suffix from context.mode ********** -class VIEW3D_MT_select_object(bpy.types.Menu): +class VIEW3D_MT_select_object(Menu): bl_label = _("Select") def draw(self, context): @@ -430,7 +435,7 @@ class VIEW3D_MT_select_object(bpy.types.Menu): layout.operator("object.select_pattern", text=_("Select Pattern...")) -class VIEW3D_MT_select_pose(bpy.types.Menu): +class VIEW3D_MT_select_pose(Menu): bl_label = _("Select") def draw(self, context): @@ -467,7 +472,7 @@ class VIEW3D_MT_select_pose(bpy.types.Menu): layout.operator("object.select_pattern", text=_("Select Pattern...")) -class VIEW3D_MT_select_particle(bpy.types.Menu): +class VIEW3D_MT_select_particle(Menu): bl_label = _("Select") def draw(self, context): @@ -492,7 +497,7 @@ class VIEW3D_MT_select_particle(bpy.types.Menu): layout.operator("particle.select_tips", text=_("Tips")) -class VIEW3D_MT_select_edit_mesh(bpy.types.Menu): +class VIEW3D_MT_select_edit_mesh(Menu): bl_label = _("Select") def draw(self, context): @@ -544,7 +549,7 @@ class VIEW3D_MT_select_edit_mesh(bpy.types.Menu): layout.operator("mesh.region_to_loop") -class VIEW3D_MT_select_edit_curve(bpy.types.Menu): +class VIEW3D_MT_select_edit_curve(Menu): bl_label = _("Select") def draw(self, context): @@ -573,7 +578,7 @@ class VIEW3D_MT_select_edit_curve(bpy.types.Menu): layout.operator("curve.select_less") -class VIEW3D_MT_select_edit_surface(bpy.types.Menu): +class VIEW3D_MT_select_edit_surface(Menu): bl_label = _("Select") def draw(self, context): @@ -599,7 +604,7 @@ class VIEW3D_MT_select_edit_surface(bpy.types.Menu): layout.operator("curve.select_less") -class VIEW3D_MT_select_edit_metaball(bpy.types.Menu): +class VIEW3D_MT_select_edit_metaball(Menu): bl_label = _("Select") def draw(self, context): @@ -617,7 +622,7 @@ class VIEW3D_MT_select_edit_metaball(bpy.types.Menu): layout.operator("mball.select_random_metaelems") -class VIEW3D_MT_select_edit_lattice(bpy.types.Menu): +class VIEW3D_MT_select_edit_lattice(Menu): bl_label = _("Select") def draw(self, context): @@ -630,7 +635,7 @@ class VIEW3D_MT_select_edit_lattice(bpy.types.Menu): layout.operator("lattice.select_all", text=_("Select/Deselect All")) -class VIEW3D_MT_select_edit_armature(bpy.types.Menu): +class VIEW3D_MT_select_edit_armature(Menu): bl_label = _("Select") def draw(self, context): @@ -661,7 +666,7 @@ class VIEW3D_MT_select_edit_armature(bpy.types.Menu): layout.operator("object.select_pattern", text=_("Select Pattern...")) -class VIEW3D_MT_select_face(bpy.types.Menu): # XXX no matching enum +class VIEW3D_MT_select_face(Menu): # XXX no matching enum bl_label = _("Select") def draw(self, context): @@ -674,7 +679,7 @@ class VIEW3D_MT_select_face(bpy.types.Menu): # XXX no matching enum # ********** Object menu ********** -class VIEW3D_MT_object(bpy.types.Menu): +class VIEW3D_MT_object(Menu): bl_context = "objectmode" bl_label = _("Object") @@ -732,7 +737,7 @@ class VIEW3D_MT_object(bpy.types.Menu): layout.operator_menu_enum("object.convert", "target") -class VIEW3D_MT_object_animation(bpy.types.Menu): +class VIEW3D_MT_object_animation(Menu): bl_label = _("Animation") def draw(self, context): @@ -743,7 +748,7 @@ class VIEW3D_MT_object_animation(bpy.types.Menu): layout.operator("anim.keying_set_active_set", text=_("Change Keying Set...")) -class VIEW3D_MT_object_clear(bpy.types.Menu): +class VIEW3D_MT_object_clear(Menu): bl_label = _("Clear") def draw(self, context): @@ -755,7 +760,7 @@ class VIEW3D_MT_object_clear(bpy.types.Menu): layout.operator("object.origin_clear", text=_("Origin")) -class VIEW3D_MT_object_specials(bpy.types.Menu): +class VIEW3D_MT_object_specials(Menu): bl_label = _("Specials") @classmethod @@ -850,7 +855,7 @@ class VIEW3D_MT_object_specials(bpy.types.Menu): props = layout.operator("object.hide_render_clear_all") -class VIEW3D_MT_object_apply(bpy.types.Menu): +class VIEW3D_MT_object_apply(Menu): bl_label = _("Apply") def draw(self, context): @@ -869,7 +874,7 @@ class VIEW3D_MT_object_apply(bpy.types.Menu): layout.operator("object.duplicates_make_real") -class VIEW3D_MT_object_parent(bpy.types.Menu): +class VIEW3D_MT_object_parent(Menu): bl_label = _("Parent") def draw(self, context): @@ -879,7 +884,7 @@ class VIEW3D_MT_object_parent(bpy.types.Menu): layout.operator("object.parent_clear", text=_("Clear")) -class VIEW3D_MT_object_track(bpy.types.Menu): +class VIEW3D_MT_object_track(Menu): bl_label = _("Track") def draw(self, context): @@ -889,7 +894,7 @@ class VIEW3D_MT_object_track(bpy.types.Menu): layout.operator("object.track_clear", text=_("Clear")) -class VIEW3D_MT_object_group(bpy.types.Menu): +class VIEW3D_MT_object_group(Menu): bl_label = _("Group") def draw(self, context): @@ -904,7 +909,7 @@ class VIEW3D_MT_object_group(bpy.types.Menu): layout.operator("group.objects_remove_active") -class VIEW3D_MT_object_constraints(bpy.types.Menu): +class VIEW3D_MT_object_constraints(Menu): bl_label = _("Constraints") def draw(self, context): @@ -915,7 +920,7 @@ class VIEW3D_MT_object_constraints(bpy.types.Menu): layout.operator("object.constraints_clear") -class VIEW3D_MT_object_showhide(bpy.types.Menu): +class VIEW3D_MT_object_showhide(Menu): bl_label = _("Show/Hide") def draw(self, context): @@ -926,7 +931,7 @@ class VIEW3D_MT_object_showhide(bpy.types.Menu): layout.operator("object.hide_view_set", text=_("Hide Unselected")).unselected = True -class VIEW3D_MT_make_single_user(bpy.types.Menu): +class VIEW3D_MT_make_single_user(Menu): bl_label = _("Make Single User") def draw(self, context): @@ -948,7 +953,7 @@ class VIEW3D_MT_make_single_user(bpy.types.Menu): props.animation = True -class VIEW3D_MT_make_links(bpy.types.Menu): +class VIEW3D_MT_make_links(Menu): bl_label = _("Make Links") def draw(self, context): @@ -965,7 +970,7 @@ class VIEW3D_MT_make_links(bpy.types.Menu): layout.operator_enum("object.make_links_data", "type") # inline -class VIEW3D_MT_object_game(bpy.types.Menu): +class VIEW3D_MT_object_game(Menu): bl_label = _("Game") def draw(self, context): @@ -987,7 +992,7 @@ class VIEW3D_MT_object_game(bpy.types.Menu): # ********** Vertex paint menu ********** -class VIEW3D_MT_paint_vertex(bpy.types.Menu): +class VIEW3D_MT_paint_vertex(Menu): bl_label = _("Paint") def draw(self, context): @@ -1002,7 +1007,7 @@ class VIEW3D_MT_paint_vertex(bpy.types.Menu): layout.operator("paint.vertex_color_dirt") -class VIEW3D_MT_hook(bpy.types.Menu): +class VIEW3D_MT_hook(Menu): bl_label = _("Hooks") def draw(self, context): @@ -1021,7 +1026,7 @@ class VIEW3D_MT_hook(bpy.types.Menu): layout.operator_menu_enum("object.hook_recenter", "modifier") -class VIEW3D_MT_vertex_group(bpy.types.Menu): +class VIEW3D_MT_vertex_group(Menu): bl_label = _("Vertex Groups") def draw(self, context): @@ -1046,7 +1051,7 @@ class VIEW3D_MT_vertex_group(bpy.types.Menu): # ********** Weight paint menu ********** -class VIEW3D_MT_paint_weight(bpy.types.Menu): +class VIEW3D_MT_paint_weight(Menu): bl_label = _("Weights") def draw(self, context): @@ -1076,7 +1081,7 @@ class VIEW3D_MT_paint_weight(bpy.types.Menu): # ********** Sculpt menu ********** -class VIEW3D_MT_sculpt(bpy.types.Menu): +class VIEW3D_MT_sculpt(Menu): bl_label = _("Sculpt") def draw(self, context): @@ -1126,7 +1131,7 @@ class VIEW3D_MT_sculpt(bpy.types.Menu): # ********** Particle menu ********** -class VIEW3D_MT_particle(bpy.types.Menu): +class VIEW3D_MT_particle(Menu): bl_label = _("Particle") def draw(self, context): @@ -1158,7 +1163,7 @@ class VIEW3D_MT_particle(bpy.types.Menu): layout.menu("VIEW3D_MT_particle_showhide") -class VIEW3D_MT_particle_specials(bpy.types.Menu): +class VIEW3D_MT_particle_specials(Menu): bl_label = _("Specials") def draw(self, context): @@ -1176,13 +1181,13 @@ class VIEW3D_MT_particle_specials(bpy.types.Menu): layout.operator("particle.remove_doubles") -class VIEW3D_MT_particle_showhide(ShowHideMenu, bpy.types.Menu): +class VIEW3D_MT_particle_showhide(ShowHideMenu, Menu): _operator_name = "particle" # ********** Pose Menu ********** -class VIEW3D_MT_pose(bpy.types.Menu): +class VIEW3D_MT_pose(Menu): bl_label = _("Pose") def draw(self, context): @@ -1251,7 +1256,7 @@ class VIEW3D_MT_pose(bpy.types.Menu): layout.menu("VIEW3D_MT_bone_options_toggle", text=_("Bone Settings")) -class VIEW3D_MT_pose_transform(bpy.types.Menu): +class VIEW3D_MT_pose_transform(Menu): bl_label = _("Clear Transform") def draw(self, context): @@ -1259,14 +1264,18 @@ class VIEW3D_MT_pose_transform(bpy.types.Menu): layout.operator("pose.transforms_clear", text=_("All")) + layout.separator() + layout.operator("pose.loc_clear", text=_("Location")) layout.operator("pose.rot_clear", text=_("Rotation")) layout.operator("pose.scale_clear", text=_("Scale")) - layout.label(text=_("Origin")) + layout.separator() + + layout.operator("pose.user_transforms_clear", text=_("Reset unkeyed")) -class VIEW3D_MT_pose_slide(bpy.types.Menu): +class VIEW3D_MT_pose_slide(Menu): bl_label = _("In-Betweens") def draw(self, context): @@ -1277,7 +1286,7 @@ class VIEW3D_MT_pose_slide(bpy.types.Menu): layout.operator("pose.breakdown") -class VIEW3D_MT_pose_propagate(bpy.types.Menu): +class VIEW3D_MT_pose_propagate(Menu): bl_label = _("Propagate") def draw(self, context): @@ -1295,7 +1304,7 @@ class VIEW3D_MT_pose_propagate(bpy.types.Menu): layout.operator("pose.propagate", text=_("On Selected Markers")).mode = 'SELECTED_MARKERS' -class VIEW3D_MT_pose_library(bpy.types.Menu): +class VIEW3D_MT_pose_library(Menu): bl_label = _("Pose Library") def draw(self, context): @@ -1310,7 +1319,7 @@ class VIEW3D_MT_pose_library(bpy.types.Menu): layout.operator("poselib.pose_remove", text=_("Remove Pose...")) -class VIEW3D_MT_pose_motion(bpy.types.Menu): +class VIEW3D_MT_pose_motion(Menu): bl_label = _("Motion Paths") def draw(self, context): @@ -1320,7 +1329,7 @@ class VIEW3D_MT_pose_motion(bpy.types.Menu): layout.operator("pose.paths_clear", text=_("Clear")) -class VIEW3D_MT_pose_group(bpy.types.Menu): +class VIEW3D_MT_pose_group(Menu): bl_label = _("Bone Groups") def draw(self, context): @@ -1334,7 +1343,7 @@ class VIEW3D_MT_pose_group(bpy.types.Menu): layout.operator("pose.group_unassign") -class VIEW3D_MT_pose_ik(bpy.types.Menu): +class VIEW3D_MT_pose_ik(Menu): bl_label = _("Inverse Kinematics") def draw(self, context): @@ -1344,7 +1353,7 @@ class VIEW3D_MT_pose_ik(bpy.types.Menu): layout.operator("pose.ik_clear") -class VIEW3D_MT_pose_constraints(bpy.types.Menu): +class VIEW3D_MT_pose_constraints(Menu): bl_label = _("Constraints") def draw(self, context): @@ -1355,11 +1364,11 @@ class VIEW3D_MT_pose_constraints(bpy.types.Menu): layout.operator("pose.constraints_clear") -class VIEW3D_MT_pose_showhide(ShowHideMenu, bpy.types.Menu): +class VIEW3D_MT_pose_showhide(ShowHideMenu, Menu): _operator_name = "pose" -class VIEW3D_MT_pose_apply(bpy.types.Menu): +class VIEW3D_MT_pose_apply(Menu): bl_label = _("Apply") def draw(self, context): @@ -1398,24 +1407,24 @@ class BoneOptions: props.type = self.type -class VIEW3D_MT_bone_options_toggle(bpy.types.Menu, BoneOptions): +class VIEW3D_MT_bone_options_toggle(Menu, BoneOptions): bl_label = "Toggle Bone Options" type = 'TOGGLE' -class VIEW3D_MT_bone_options_enable(bpy.types.Menu, BoneOptions): +class VIEW3D_MT_bone_options_enable(Menu, BoneOptions): bl_label = "Enable Bone Options" type = 'ENABLE' -class VIEW3D_MT_bone_options_disable(bpy.types.Menu, BoneOptions): +class VIEW3D_MT_bone_options_disable(Menu, BoneOptions): bl_label = "Disable Bone Options" type = 'DISABLE' # ********** Edit Menus, suffix from ob.type ********** -class VIEW3D_MT_edit_mesh(bpy.types.Menu): +class VIEW3D_MT_edit_mesh(Menu): bl_label = _("Mesh") def draw(self, context): @@ -1462,7 +1471,7 @@ class VIEW3D_MT_edit_mesh(bpy.types.Menu): layout.menu("VIEW3D_MT_edit_mesh_showhide") -class VIEW3D_MT_edit_mesh_specials(bpy.types.Menu): +class VIEW3D_MT_edit_mesh_specials(Menu): bl_label = _("Specials") def draw(self, context): @@ -1487,7 +1496,7 @@ class VIEW3D_MT_edit_mesh_specials(bpy.types.Menu): layout.operator("mesh.select_vertex_path") -class VIEW3D_MT_edit_mesh_select_mode(bpy.types.Menu): +class VIEW3D_MT_edit_mesh_select_mode(Menu): bl_label = _("Mesh Select Mode") def draw(self, context): @@ -1508,7 +1517,7 @@ class VIEW3D_MT_edit_mesh_select_mode(bpy.types.Menu): prop.data_path = "tool_settings.mesh_select_mode" -class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu): +class VIEW3D_MT_edit_mesh_extrude(Menu): bl_label = _("Extrude") _extrude_funcs = { \ @@ -1542,7 +1551,7 @@ class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu): self._extrude_funcs[menu_id](layout) -class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator): +class VIEW3D_OT_edit_mesh_extrude_individual_move(Operator): "Extrude individual elements and move" bl_label = _("Extrude Individual and Move") bl_idname = "view3d.edit_mesh_extrude_individual_move" @@ -1571,7 +1580,7 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator): return self.execute(context) -class VIEW3D_OT_edit_mesh_extrude_move(bpy.types.Operator): +class VIEW3D_OT_edit_mesh_extrude_move(Operator): "Extrude and move along normals" bl_label = _("Extrude and Move on Normals") bl_idname = "view3d.edit_mesh_extrude_move_normal" @@ -1597,7 +1606,7 @@ class VIEW3D_OT_edit_mesh_extrude_move(bpy.types.Operator): return self.execute(context) -class VIEW3D_MT_edit_mesh_vertices(bpy.types.Menu): +class VIEW3D_MT_edit_mesh_vertices(Menu): bl_label = _("Vertices") def draw(self, context): @@ -1629,7 +1638,7 @@ class VIEW3D_MT_edit_mesh_vertices(bpy.types.Menu): layout.menu("VIEW3D_MT_hook") -class VIEW3D_MT_edit_mesh_edges(bpy.types.Menu): +class VIEW3D_MT_edit_mesh_edges(Menu): bl_label = _("Edges") def draw(self, context): @@ -1669,7 +1678,7 @@ class VIEW3D_MT_edit_mesh_edges(bpy.types.Menu): layout.operator("mesh.region_to_loop") -class VIEW3D_MT_edit_mesh_faces(bpy.types.Menu): +class VIEW3D_MT_edit_mesh_faces(Menu): bl_label = _("Faces") bl_idname = "VIEW3D_MT_edit_mesh_faces" @@ -1717,7 +1726,7 @@ class VIEW3D_MT_edit_mesh_faces(bpy.types.Menu): layout.operator_menu_enum("mesh.colors_mirror", "axis") -class VIEW3D_MT_edit_mesh_normals(bpy.types.Menu): +class VIEW3D_MT_edit_mesh_normals(Menu): bl_label = _("Normals") def draw(self, context): @@ -1731,7 +1740,7 @@ class VIEW3D_MT_edit_mesh_normals(bpy.types.Menu): layout.operator("mesh.flip_normals") -class VIEW3D_MT_edit_mesh_showhide(ShowHideMenu, bpy.types.Menu): +class VIEW3D_MT_edit_mesh_showhide(ShowHideMenu, Menu): _operator_name = "mesh" # Edit Curve @@ -1771,13 +1780,13 @@ def draw_curve(self, context): layout.menu("VIEW3D_MT_edit_curve_showhide") -class VIEW3D_MT_edit_curve(bpy.types.Menu): +class VIEW3D_MT_edit_curve(Menu): bl_label = _("Curve") draw = draw_curve -class VIEW3D_MT_edit_curve_ctrlpoints(bpy.types.Menu): +class VIEW3D_MT_edit_curve_ctrlpoints(Menu): bl_label = _("Control Points") def draw(self, context): @@ -1799,7 +1808,7 @@ class VIEW3D_MT_edit_curve_ctrlpoints(bpy.types.Menu): layout.menu("VIEW3D_MT_hook") -class VIEW3D_MT_edit_curve_segments(bpy.types.Menu): +class VIEW3D_MT_edit_curve_segments(Menu): bl_label = _("Segments") def draw(self, context): @@ -1809,7 +1818,7 @@ class VIEW3D_MT_edit_curve_segments(bpy.types.Menu): layout.operator("curve.switch_direction") -class VIEW3D_MT_edit_curve_specials(bpy.types.Menu): +class VIEW3D_MT_edit_curve_specials(Menu): bl_label = _("Specials") def draw(self, context): @@ -1823,17 +1832,17 @@ class VIEW3D_MT_edit_curve_specials(bpy.types.Menu): layout.operator("curve.smooth_radius") -class VIEW3D_MT_edit_curve_showhide(ShowHideMenu, bpy.types.Menu): +class VIEW3D_MT_edit_curve_showhide(ShowHideMenu, Menu): _operator_name = "curve" -class VIEW3D_MT_edit_surface(bpy.types.Menu): +class VIEW3D_MT_edit_surface(Menu): bl_label = _("Surface") draw = draw_curve -class VIEW3D_MT_edit_font(bpy.types.Menu): +class VIEW3D_MT_edit_font(Menu): bl_label = _("Text") def draw(self, context): @@ -1853,7 +1862,7 @@ class VIEW3D_MT_edit_font(bpy.types.Menu): layout.operator("font.style_toggle", text=_("Toggle Small Caps")).style = 'SMALL_CAPS' -class VIEW3D_MT_edit_text_chars(bpy.types.Menu): +class VIEW3D_MT_edit_text_chars(Menu): bl_label = _("Special Characters") def draw(self, context): @@ -1887,7 +1896,7 @@ class VIEW3D_MT_edit_text_chars(bpy.types.Menu): layout.operator("font.text_insert", text="Spanish Exclamation Mark|Alt !").text = b'\xC2\xA1'.decode() -class VIEW3D_MT_edit_meta(bpy.types.Menu): +class VIEW3D_MT_edit_meta(Menu): bl_label = _("Metaball") def draw(self, context): @@ -1920,7 +1929,7 @@ class VIEW3D_MT_edit_meta(bpy.types.Menu): layout.menu("VIEW3D_MT_edit_meta_showhide") -class VIEW3D_MT_edit_meta_showhide(bpy.types.Menu): +class VIEW3D_MT_edit_meta_showhide(Menu): bl_label = _("Show/Hide") def draw(self, context): @@ -1931,7 +1940,7 @@ class VIEW3D_MT_edit_meta_showhide(bpy.types.Menu): layout.operator("mball.hide_metaelems", text=_("Hide Unselected")).unselected = True -class VIEW3D_MT_edit_lattice(bpy.types.Menu): +class VIEW3D_MT_edit_lattice(Menu): bl_label = _("Lattice") def draw(self, context): @@ -1953,7 +1962,7 @@ class VIEW3D_MT_edit_lattice(bpy.types.Menu): layout.prop_menu_enum(settings, "proportional_edit_falloff") -class VIEW3D_MT_edit_armature(bpy.types.Menu): +class VIEW3D_MT_edit_armature(Menu): bl_label = _("Armature") def draw(self, context): @@ -2008,7 +2017,7 @@ class VIEW3D_MT_edit_armature(bpy.types.Menu): layout.menu("VIEW3D_MT_bone_options_toggle", text=_("Bone Settings")) -class VIEW3D_MT_armature_specials(bpy.types.Menu): +class VIEW3D_MT_armature_specials(Menu): bl_label = _("Specials") def draw(self, context): @@ -2028,7 +2037,7 @@ class VIEW3D_MT_armature_specials(bpy.types.Menu): layout.operator("armature.flip_names", text=_("Flip Names")) -class VIEW3D_MT_edit_armature_parent(bpy.types.Menu): +class VIEW3D_MT_edit_armature_parent(Menu): bl_label = _("Parent") def draw(self, context): @@ -2038,7 +2047,7 @@ class VIEW3D_MT_edit_armature_parent(bpy.types.Menu): layout.operator("armature.parent_clear", text=_("Clear")) -class VIEW3D_MT_edit_armature_roll(bpy.types.Menu): +class VIEW3D_MT_edit_armature_roll(Menu): bl_label = _("Bone Roll") def draw(self, context): @@ -2053,7 +2062,7 @@ class VIEW3D_MT_edit_armature_roll(bpy.types.Menu): # ********** Panel ********** -class VIEW3D_PT_view3d_properties(bpy.types.Panel): +class VIEW3D_PT_view3d_properties(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'UI' bl_label = _("View") @@ -2073,9 +2082,11 @@ class VIEW3D_PT_view3d_properties(bpy.types.Panel): col.prop(view, "lens") col.label(text=_("Lock to Object:")) col.prop(view, "lock_object", text="") - if view.lock_object and view.lock_object.type == 'ARMATURE': - col.prop_search(view, "lock_bone", view.lock_object.data, "bones", text="") - elif not view.lock_object: + lock_object = view.lock_object + if lock_object: + if lock_object.type == 'ARMATURE': + col.prop_search(view, "lock_bone", lock_object.data, "edit_bones" if lock_object.mode == 'EDIT' else "bones", text="") + else: col.prop(view, "lock_cursor", text=_("Lock to Cursor")) col = layout.column() @@ -2094,7 +2105,7 @@ class VIEW3D_PT_view3d_properties(bpy.types.Panel): layout.column().prop(view, "cursor_location") -class VIEW3D_PT_view3d_name(bpy.types.Panel): +class VIEW3D_PT_view3d_name(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'UI' bl_label = _("Item") @@ -2119,7 +2130,7 @@ class VIEW3D_PT_view3d_name(bpy.types.Panel): row.prop(bone, "name", text="") -class VIEW3D_PT_view3d_display(bpy.types.Panel): +class VIEW3D_PT_view3d_display(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'UI' bl_label = _("Display") @@ -2191,7 +2202,7 @@ class VIEW3D_PT_view3d_display(bpy.types.Panel): row.prop(region, "use_box_clip") -class VIEW3D_PT_view3d_meshdisplay(bpy.types.Panel): +class VIEW3D_PT_view3d_meshdisplay(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'UI' bl_label = _("Mesh Display") @@ -2228,7 +2239,7 @@ class VIEW3D_PT_view3d_meshdisplay(bpy.types.Panel): col.prop(mesh, "show_extra_face_area") -class VIEW3D_PT_view3d_curvedisplay(bpy.types.Panel): +class VIEW3D_PT_view3d_curvedisplay(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'UI' bl_label = _("Curve Display") @@ -2250,7 +2261,7 @@ class VIEW3D_PT_view3d_curvedisplay(bpy.types.Panel): col.prop(context.scene.tool_settings, "normal_size", text=_("Normal Size")) -class VIEW3D_PT_background_image(bpy.types.Panel): +class VIEW3D_PT_background_image(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'UI' bl_label = _("Background Images") @@ -2303,7 +2314,7 @@ class VIEW3D_PT_background_image(bpy.types.Panel): row.prop(bg, "offset_y", text="Y") -class VIEW3D_PT_transform_orientations(bpy.types.Panel): +class VIEW3D_PT_transform_orientations(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'UI' bl_label = _("Transform Orientations") @@ -2331,7 +2342,7 @@ class VIEW3D_PT_transform_orientations(bpy.types.Panel): col.operator("transform.delete_orientation", text=_("Delete")) -class VIEW3D_PT_etch_a_ton(bpy.types.Panel): +class VIEW3D_PT_etch_a_ton(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'UI' bl_label = _("Skeleton Sketching") @@ -2376,7 +2387,7 @@ class VIEW3D_PT_etch_a_ton(bpy.types.Panel): col.operator("sketch.convert", text=_("Convert")) -class VIEW3D_PT_context_properties(bpy.types.Panel): +class VIEW3D_PT_context_properties(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'UI' bl_label = _("Properties") diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 16b5b3e6cc6..62836a20381 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Menu, Panel from blf import gettext as _ @@ -62,7 +63,7 @@ def draw_gpencil_tools(context, layout): # ********** default tools for objectmode **************** -class VIEW3D_PT_tools_objectmode(View3DPanel, bpy.types.Panel): +class VIEW3D_PT_tools_objectmode(View3DPanel, Panel): bl_context = "objectmode" bl_label = _("Object Tools") @@ -107,7 +108,7 @@ class VIEW3D_PT_tools_objectmode(View3DPanel, bpy.types.Panel): # ********** default tools for editmode_mesh **************** -class VIEW3D_PT_tools_meshedit(View3DPanel, bpy.types.Panel): +class VIEW3D_PT_tools_meshedit(View3DPanel, Panel): bl_context = "mesh_edit" bl_label = "Mesh Tools" @@ -166,7 +167,7 @@ class VIEW3D_PT_tools_meshedit(View3DPanel, bpy.types.Panel): draw_gpencil_tools(context, layout) -class VIEW3D_PT_tools_meshedit_options(View3DPanel, bpy.types.Panel): +class VIEW3D_PT_tools_meshedit_options(View3DPanel, Panel): bl_context = "mesh_edit" bl_label = "Mesh Options" @@ -192,7 +193,7 @@ class VIEW3D_PT_tools_meshedit_options(View3DPanel, bpy.types.Panel): # ********** default tools for editmode_curve **************** -class VIEW3D_PT_tools_curveedit(View3DPanel, bpy.types.Panel): +class VIEW3D_PT_tools_curveedit(View3DPanel, Panel): bl_context = "curve_edit" bl_label = "Curve Tools" @@ -238,7 +239,7 @@ class VIEW3D_PT_tools_curveedit(View3DPanel, bpy.types.Panel): # ********** default tools for editmode_surface **************** -class VIEW3D_PT_tools_surfaceedit(View3DPanel, bpy.types.Panel): +class VIEW3D_PT_tools_surfaceedit(View3DPanel, Panel): bl_context = "surface_edit" bl_label = "Surface Tools" @@ -270,7 +271,7 @@ class VIEW3D_PT_tools_surfaceedit(View3DPanel, bpy.types.Panel): # ********** default tools for editmode_text **************** -class VIEW3D_PT_tools_textedit(View3DPanel, bpy.types.Panel): +class VIEW3D_PT_tools_textedit(View3DPanel, Panel): bl_context = "text_edit" bl_label = "Text Tools" @@ -300,7 +301,7 @@ class VIEW3D_PT_tools_textedit(View3DPanel, bpy.types.Panel): # ********** default tools for editmode_armature **************** -class VIEW3D_PT_tools_armatureedit(View3DPanel, bpy.types.Panel): +class VIEW3D_PT_tools_armatureedit(View3DPanel, Panel): bl_context = "armature_edit" bl_label = "Armature Tools" @@ -329,7 +330,7 @@ class VIEW3D_PT_tools_armatureedit(View3DPanel, bpy.types.Panel): draw_gpencil_tools(context, layout) -class VIEW3D_PT_tools_armatureedit_options(View3DPanel, bpy.types.Panel): +class VIEW3D_PT_tools_armatureedit_options(View3DPanel, Panel): bl_context = "armature_edit" bl_label = "Armature Options" @@ -341,7 +342,7 @@ class VIEW3D_PT_tools_armatureedit_options(View3DPanel, bpy.types.Panel): # ********** default tools for editmode_mball **************** -class VIEW3D_PT_tools_mballedit(View3DPanel, bpy.types.Panel): +class VIEW3D_PT_tools_mballedit(View3DPanel, Panel): bl_context = "mball_edit" bl_label = "Meta Tools" @@ -361,7 +362,7 @@ class VIEW3D_PT_tools_mballedit(View3DPanel, bpy.types.Panel): # ********** default tools for editmode_lattice **************** -class VIEW3D_PT_tools_latticeedit(View3DPanel, bpy.types.Panel): +class VIEW3D_PT_tools_latticeedit(View3DPanel, Panel): bl_context = "lattice_edit" bl_label = "Lattice Tools" @@ -385,7 +386,7 @@ class VIEW3D_PT_tools_latticeedit(View3DPanel, bpy.types.Panel): # ********** default tools for posemode **************** -class VIEW3D_PT_tools_posemode(View3DPanel, bpy.types.Panel): +class VIEW3D_PT_tools_posemode(View3DPanel, Panel): bl_context = "posemode" bl_label = "Pose Tools" @@ -426,7 +427,7 @@ class VIEW3D_PT_tools_posemode(View3DPanel, bpy.types.Panel): draw_gpencil_tools(context, layout) -class VIEW3D_PT_tools_posemode_options(View3DPanel, bpy.types.Panel): +class VIEW3D_PT_tools_posemode_options(View3DPanel, Panel): bl_context = "posemode" bl_label = "Pose Options" @@ -460,7 +461,7 @@ class PaintPanel(): return None -class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel): +class VIEW3D_PT_tools_brush(PaintPanel, Panel): bl_label = "Brush" @classmethod @@ -678,7 +679,7 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel): #row.prop(brush, "use_pressure_jitter", toggle=True, text="") -class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel): +class VIEW3D_PT_tools_brush_texture(PaintPanel, Panel): bl_label = "Texture" bl_options = {'DEFAULT_CLOSED'} @@ -776,7 +777,7 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel): col.active = tex_slot.map_mode in {'FIXED', 'TILED'} and brush.use_texture_overlay -class VIEW3D_PT_tools_brush_tool(PaintPanel, bpy.types.Panel): +class VIEW3D_PT_tools_brush_tool(PaintPanel, Panel): bl_label = "Tool" bl_options = {'DEFAULT_CLOSED'} @@ -810,7 +811,7 @@ class VIEW3D_PT_tools_brush_tool(PaintPanel, bpy.types.Panel): row.prop(brush, "use_paint_image", text="", icon='TPAINT_HLT') -class VIEW3D_PT_tools_brush_stroke(PaintPanel, bpy.types.Panel): +class VIEW3D_PT_tools_brush_stroke(PaintPanel, Panel): bl_label = "Stroke" bl_options = {'DEFAULT_CLOSED'} @@ -908,7 +909,7 @@ class VIEW3D_PT_tools_brush_stroke(PaintPanel, bpy.types.Panel): # row.prop(brush, "use_pressure_spacing", toggle=True, text="") -class VIEW3D_PT_tools_brush_curve(PaintPanel, bpy.types.Panel): +class VIEW3D_PT_tools_brush_curve(PaintPanel, Panel): bl_label = "Curve" bl_options = {'DEFAULT_CLOSED'} @@ -935,7 +936,7 @@ class VIEW3D_PT_tools_brush_curve(PaintPanel, bpy.types.Panel): row.operator("brush.curve_preset", icon="NOCURVE", text="").shape = 'MAX' -class VIEW3D_PT_sculpt_options(PaintPanel, bpy.types.Panel): +class VIEW3D_PT_sculpt_options(PaintPanel, Panel): bl_label = "Options" bl_options = {'DEFAULT_CLOSED'} @@ -965,7 +966,7 @@ class VIEW3D_PT_sculpt_options(PaintPanel, bpy.types.Panel): layout.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength") -class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel): +class VIEW3D_PT_sculpt_symmetry(PaintPanel, Panel): bl_label = "Symmetry" bl_options = {'DEFAULT_CLOSED'} @@ -993,7 +994,7 @@ class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel): layout.prop(sculpt, "use_symmetry_feather", text="Feather") -class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel): +class VIEW3D_PT_tools_brush_appearance(PaintPanel, Panel): bl_label = "Appearance" bl_options = {'DEFAULT_CLOSED'} @@ -1039,7 +1040,7 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel): # ********** default tools for weightpaint **************** -class VIEW3D_PT_tools_weightpaint(View3DPanel, bpy.types.Panel): +class VIEW3D_PT_tools_weightpaint(View3DPanel, Panel): bl_context = "weightpaint" bl_label = "Weight Tools" @@ -1049,7 +1050,7 @@ class VIEW3D_PT_tools_weightpaint(View3DPanel, bpy.types.Panel): ob = context.active_object col = layout.column() - col.active = ob.vertex_groups.active != None + col.active = ob.vertex_groups.active is not None col.operator("object.vertex_group_normalize_all", text="Normalize All") col.operator("object.vertex_group_normalize", text="Normalize") col.operator("object.vertex_group_invert", text="Invert") @@ -1057,7 +1058,7 @@ class VIEW3D_PT_tools_weightpaint(View3DPanel, bpy.types.Panel): col.operator("object.vertex_group_levels", text="Levels") -class VIEW3D_PT_tools_weightpaint_options(View3DPanel, bpy.types.Panel): +class VIEW3D_PT_tools_weightpaint_options(View3DPanel, Panel): bl_context = "weightpaint" bl_label = "Options" @@ -1094,7 +1095,7 @@ class VIEW3D_PT_tools_weightpaint_options(View3DPanel, bpy.types.Panel): # ********** default tools for vertexpaint **************** -class VIEW3D_PT_tools_vertexpaint(View3DPanel, bpy.types.Panel): +class VIEW3D_PT_tools_vertexpaint(View3DPanel, Panel): bl_context = "vertexpaint" bl_label = "Options" @@ -1123,7 +1124,7 @@ class VIEW3D_PT_tools_vertexpaint(View3DPanel, bpy.types.Panel): # ********** default tools for texturepaint **************** -class VIEW3D_PT_tools_projectpaint(View3DPanel, bpy.types.Panel): +class VIEW3D_PT_tools_projectpaint(View3DPanel, Panel): bl_context = "imagepaint" bl_label = "Project Paint" @@ -1215,7 +1216,7 @@ class VIEW3D_PT_imagepaint_options(PaintPanel): col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength") -class VIEW3D_MT_tools_projectpaint_clone(bpy.types.Menu): +class VIEW3D_MT_tools_projectpaint_clone(Menu): bl_label = "Clone Layer" def draw(self, context): @@ -1226,7 +1227,7 @@ class VIEW3D_MT_tools_projectpaint_clone(bpy.types.Menu): prop.value = i -class VIEW3D_MT_tools_projectpaint_stencil(bpy.types.Menu): +class VIEW3D_MT_tools_projectpaint_stencil(Menu): bl_label = "Mask Layer" def draw(self, context): @@ -1237,7 +1238,7 @@ class VIEW3D_MT_tools_projectpaint_stencil(bpy.types.Menu): prop.value = i -class VIEW3D_PT_tools_particlemode(View3DPanel, bpy.types.Panel): +class VIEW3D_PT_tools_particlemode(View3DPanel, Panel): '''default tools for particle mode''' bl_context = "particlemode" bl_label = "Options" diff --git a/release/scripts/startup/keyingsets_builtins.py b/release/scripts/startup/keyingsets_builtins.py index dcc1afed74b..6b12c95e072 100644 --- a/release/scripts/startup/keyingsets_builtins.py +++ b/release/scripts/startup/keyingsets_builtins.py @@ -32,13 +32,14 @@ in lost (i.e. unkeyed) animation. import bpy import keyingsets_utils +from bpy.types import KeyingSetInfo ############################### # Built-In KeyingSets # Location -class BUILTIN_KSI_Location(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_Location(KeyingSetInfo): bl_label = "Location" # poll - use predefined callback for selected bones/objects @@ -52,7 +53,7 @@ class BUILTIN_KSI_Location(bpy.types.KeyingSetInfo): # Rotation -class BUILTIN_KSI_Rotation(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_Rotation(KeyingSetInfo): bl_label = "Rotation" # poll - use predefined callback for selected bones/objects @@ -66,7 +67,7 @@ class BUILTIN_KSI_Rotation(bpy.types.KeyingSetInfo): # Scale -class BUILTIN_KSI_Scaling(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_Scaling(KeyingSetInfo): bl_label = "Scaling" # poll - use predefined callback for selected bones/objects @@ -82,7 +83,7 @@ class BUILTIN_KSI_Scaling(bpy.types.KeyingSetInfo): # LocRot -class BUILTIN_KSI_LocRot(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_LocRot(KeyingSetInfo): bl_label = "LocRot" # poll - use predefined callback for selected bones/objects @@ -100,7 +101,7 @@ class BUILTIN_KSI_LocRot(bpy.types.KeyingSetInfo): # LocScale -class BUILTIN_KSI_LocScale(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_LocScale(KeyingSetInfo): bl_label = "LocScale" # poll - use predefined callback for selected bones/objects @@ -118,7 +119,7 @@ class BUILTIN_KSI_LocScale(bpy.types.KeyingSetInfo): # LocRotScale -class BUILTIN_KSI_LocRotScale(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_LocRotScale(KeyingSetInfo): bl_label = "LocRotScale" # poll - use predefined callback for selected bones/objects @@ -138,7 +139,7 @@ class BUILTIN_KSI_LocRotScale(bpy.types.KeyingSetInfo): # RotScale -class BUILTIN_KSI_RotScale(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_RotScale(KeyingSetInfo): bl_label = "RotScale" # poll - use predefined callback for selected bones/objects @@ -158,7 +159,7 @@ class BUILTIN_KSI_RotScale(bpy.types.KeyingSetInfo): # Location -class BUILTIN_KSI_VisualLoc(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_VisualLoc(KeyingSetInfo): bl_label = "Visual Location" bl_options = {'INSERTKEY_VISUAL'} @@ -174,7 +175,7 @@ class BUILTIN_KSI_VisualLoc(bpy.types.KeyingSetInfo): # Rotation -class BUILTIN_KSI_VisualRot(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_VisualRot(KeyingSetInfo): bl_label = "Visual Rotation" bl_options = {'INSERTKEY_VISUAL'} @@ -190,7 +191,7 @@ class BUILTIN_KSI_VisualRot(bpy.types.KeyingSetInfo): # VisualLocRot -class BUILTIN_KSI_VisualLocRot(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_VisualLocRot(KeyingSetInfo): bl_label = "Visual LocRot" bl_options = {'INSERTKEY_VISUAL'} @@ -212,7 +213,7 @@ class BUILTIN_KSI_VisualLocRot(bpy.types.KeyingSetInfo): # Available -class BUILTIN_KSI_Available(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_Available(KeyingSetInfo): bl_label = "Available" # poll - selected objects or selected object with animation data @@ -234,7 +235,7 @@ class BUILTIN_KSI_Available(bpy.types.KeyingSetInfo): # All properties that are likely to get animated in a character rig -class BUILTIN_KSI_WholeCharacter(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_WholeCharacter(KeyingSetInfo): bl_label = "Whole Character" # these prefixes should be avoided, as they are not really bones @@ -265,7 +266,7 @@ class BUILTIN_KSI_WholeCharacter(bpy.types.KeyingSetInfo): # loc, rot, scale - only include unlocked ones ksi.doLoc(ks, bone) - if bone.rotation_mode in ('QUATERNION', 'AXIS_ANGLE'): + if bone.rotation_mode in {'QUATERNION', 'AXIS_ANGLE'}: ksi.doRot4d(ks, bone) else: ksi.doRot3d(ks, bone) @@ -365,7 +366,7 @@ class BUILTIN_KSI_WholeCharacter(bpy.types.KeyingSetInfo): # Delta Location -class BUILTIN_KSI_DeltaLocation(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_DeltaLocation(KeyingSetInfo): bl_label = "Delta Location" # poll - selected objects only (and only if active object in object mode) @@ -390,7 +391,7 @@ class BUILTIN_KSI_DeltaLocation(bpy.types.KeyingSetInfo): # Delta Rotation -class BUILTIN_KSI_DeltaRotation(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_DeltaRotation(KeyingSetInfo): bl_label = "Delta Rotation" # poll - selected objects only (and only if active object in object mode) @@ -423,7 +424,7 @@ class BUILTIN_KSI_DeltaRotation(bpy.types.KeyingSetInfo): # Delta Scale -class BUILTIN_KSI_DeltaScale(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_DeltaScale(KeyingSetInfo): bl_label = "Delta Scale" # poll - selected objects only (and only if active object in object mode) diff --git a/release/scripts/templates/addon_add_object.py b/release/scripts/templates/addon_add_object.py index 98517fd97a0..833ac600995 100644 --- a/release/scripts/templates/addon_add_object.py +++ b/release/scripts/templates/addon_add_object.py @@ -45,10 +45,12 @@ class OBJECT_OT_add_object(bpy.types.Operator, AddObjectHelper): bl_description = "Create a new Mesh Object" bl_options = {'REGISTER', 'UNDO'} - scale = FloatVectorProperty(name='scale', - default=(1.0, 1.0, 1.0), - subtype='TRANSLATION', - description='scaling') + scale = FloatVectorProperty( + name='scale', + default=(1.0, 1.0, 1.0), + subtype='TRANSLATION', + description='scaling', + ) def execute(self, context): diff --git a/release/scripts/templates/operator_export.py b/release/scripts/templates/operator_export.py index 4cf943a53b7..b1d53e6ee0c 100644 --- a/release/scripts/templates/operator_export.py +++ b/release/scripts/templates/operator_export.py @@ -24,22 +24,30 @@ class ExportSomeData(bpy.types.Operator, ExportHelper): # ExportHelper mixin class uses this filename_ext = ".txt" - filter_glob = StringProperty(default="*.txt", options={'HIDDEN'}) + filter_glob = StringProperty( + default="*.txt", + options={'HIDDEN'}, + ) # List of operator properties, the attributes will be assigned # to the class instance from the operator settings before calling. - use_setting = BoolProperty(name="Example Boolean", description="Example Tooltip", default=True) - - type = EnumProperty(items=(('OPT_A', "First Option", "Description one"), - ('OPT_B', "Second Option", "Description two."), - ), - name="Example Enum", - description="Choose between two items", - default='OPT_A') + use_setting = BoolProperty( + name="Example Boolean", + description="Example Tooltip", + default=True, + ) + + type = EnumProperty( + name="Example Enum", + description="Choose between two items", + items=(('OPT_A', "First Option", "Description one"), + ('OPT_B', "Second Option", "Description two.")), + default='OPT_A', + ) @classmethod def poll(cls, context): - return context.active_object != None + return context.active_object is not None def execute(self, context): return write_some_data(context, self.filepath, self.use_setting) diff --git a/release/scripts/templates/operator_mesh_add.py b/release/scripts/templates/operator_mesh_add.py index 10d23a6712d..d89b7e82f77 100644 --- a/release/scripts/templates/operator_mesh_add.py +++ b/release/scripts/templates/operator_mesh_add.py @@ -43,25 +43,38 @@ class AddBox(bpy.types.Operator): bl_label = "Add Box" bl_options = {'REGISTER', 'UNDO'} - width = FloatProperty(name="Width", + width = FloatProperty( + name="Width", description="Box Width", - default=1.0, min=0.01, max=100.0) - - height = FloatProperty(name="Height", + min=0.01, max=100.0, + default=1.0, + ) + height = FloatProperty( + name="Height", description="Box Height", - default=1.0, min=0.01, max=100.0) - - depth = FloatProperty(name="Depth", + min=0.01, max=100.0, + default=1.0, + ) + depth = FloatProperty( + name="Depth", description="Box Depth", - default=1.0, min=0.01, max=100.0) + min=0.01, max=100.0, + default=1.0, + ) # generic transform props - view_align = BoolProperty(name="Align to View", - default=False) - location = FloatVectorProperty(name="Location", - subtype='TRANSLATION') - rotation = FloatVectorProperty(name="Rotation", - subtype='EULER') + view_align = BoolProperty( + name="Align to View", + default=False, + ) + location = FloatVectorProperty( + name="Location", + subtype='TRANSLATION', + ) + rotation = FloatVectorProperty( + name="Rotation", + subtype='EULER', + ) def execute(self, context): diff --git a/release/scripts/templates/operator_modal.py b/release/scripts/templates/operator_modal.py index ed98c2cf50e..a428b097f82 100644 --- a/release/scripts/templates/operator_modal.py +++ b/release/scripts/templates/operator_modal.py @@ -47,4 +47,4 @@ if __name__ == "__main__": register() # test call - bpy.ops.object.modal_operator() + bpy.ops.object.modal_operator('INVOKE_DEFAULT') diff --git a/release/scripts/templates/operator_modal_timer.py b/release/scripts/templates/operator_modal_timer.py index d2267191cf5..ec47390da81 100644 --- a/release/scripts/templates/operator_modal_timer.py +++ b/release/scripts/templates/operator_modal_timer.py @@ -10,7 +10,7 @@ class ModalTimerOperator(bpy.types.Operator): def modal(self, context, event): if event.type == 'ESC': - return self.cancel() + return self.cancel(context) if event.type == 'TIMER': # change theme color, silly! diff --git a/release/scripts/templates/operator_modal_view3d.py b/release/scripts/templates/operator_modal_view3d.py index 925449835ca..263bf72f129 100644 --- a/release/scripts/templates/operator_modal_view3d.py +++ b/release/scripts/templates/operator_modal_view3d.py @@ -8,7 +8,10 @@ class ViewOperator(bpy.types.Operator): bl_idname = "view3d.modal_operator" bl_label = "Simple View Operator" - offset = FloatVectorProperty(name="Offset", size=3) + offset = FloatVectorProperty( + name="Offset", + size=3, + ) def execute(self, context): v3d = context.space_data diff --git a/release/scripts/templates/operator_simple.py b/release/scripts/templates/operator_simple.py index 8348c7a95b1..05d9afc0ad1 100644 --- a/release/scripts/templates/operator_simple.py +++ b/release/scripts/templates/operator_simple.py @@ -13,7 +13,7 @@ class SimpleOperator(bpy.types.Operator): @classmethod def poll(cls, context): - return context.active_object != None + return context.active_object is not None def execute(self, context): main(context) |