diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-09-23 17:04:01 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-09-23 17:04:01 +0400 |
commit | 9494340dae7dd5e3ee070d8e550596a440648870 (patch) | |
tree | e73e1b3ede7373db7b8e26db687941b4669b9244 | |
parent | 74e21161e327a0f91ecef0f8dd1bce65c9e2ef4b (diff) | |
parent | a7891da84bfad1f0cd0f3fc825e7f4dedf469a00 (diff) |
svn merge ^/trunk/blender -r40432:40491
89 files changed, 1781 insertions, 1543 deletions
diff --git a/build_files/buildbot/config/user-config-i686.py b/build_files/buildbot/config/user-config-i686.py index 5fe3d6891fd..facbf493a23 100644 --- a/build_files/buildbot/config/user-config-i686.py +++ b/build_files/buildbot/config/user-config-i686.py @@ -5,7 +5,7 @@ BF_NUMJOBS = 2 # Python configuration BF_PYTHON_VERSION = '3.2' BF_PYTHON_ABI_FLAGS = 'mu' -BF_PYTHON = '/opt/python3.2' +BF_PYTHON = '/opt/python3' WITH_BF_STATICPYTHON = True diff --git a/build_files/buildbot/config/user-config-player-i686.py b/build_files/buildbot/config/user-config-player-i686.py index 54e66e847df..d02779e63e5 100644 --- a/build_files/buildbot/config/user-config-player-i686.py +++ b/build_files/buildbot/config/user-config-player-i686.py @@ -5,7 +5,7 @@ BF_NUMJOBS = 2 # Python configuration BF_PYTHON_VERSION = '3.2' BF_PYTHON_ABI_FLAGS = 'mu' -BF_PYTHON = '/opt/python3.2' +BF_PYTHON = '/opt/python3' WITH_BF_STATICPYTHON = True diff --git a/build_files/buildbot/config/user-config-player-x86_64.py b/build_files/buildbot/config/user-config-player-x86_64.py index 5d594229d3e..810dcb895de 100644 --- a/build_files/buildbot/config/user-config-player-x86_64.py +++ b/build_files/buildbot/config/user-config-player-x86_64.py @@ -5,7 +5,7 @@ BF_NUMJOBS = 2 # Python configuration BF_PYTHON_VERSION = '3.2' BF_PYTHON_ABI_FLAGS = 'mu' -BF_PYTHON = '/opt/python3.2' +BF_PYTHON = '/opt/python3' WITH_BF_STATICPYTHON = True diff --git a/build_files/buildbot/config/user-config-x86_64.py b/build_files/buildbot/config/user-config-x86_64.py index b8b2d7f7a5f..536f8f9e6c1 100644 --- a/build_files/buildbot/config/user-config-x86_64.py +++ b/build_files/buildbot/config/user-config-x86_64.py @@ -5,7 +5,7 @@ BF_NUMJOBS = 2 # Python configuration BF_PYTHON_VERSION = '3.2' BF_PYTHON_ABI_FLAGS = 'mu' -BF_PYTHON = '/opt/python3.2' +BF_PYTHON = '/opt/python3' WITH_BF_STATICPYTHON = True diff --git a/build_files/cmake/cmake_static_check_cppcheck.py b/build_files/cmake/cmake_static_check_cppcheck.py index 6eb9d4da8b6..fdd380c5b4d 100644 --- a/build_files/cmake/cmake_static_check_cppcheck.py +++ b/build_files/cmake/cmake_static_check_cppcheck.py @@ -37,7 +37,7 @@ CHECKER_BIN = "cppcheck" CHECKER_ARGS = [ # not sure why this is needed, but it is. - "-I" + os.path.join(project_source_info.SOURCE_DIR, "extern/glew/include"), + "-I" + os.path.join(project_source_info.SOURCE_DIR, "extern", "glew", "include"), # "--check-config", # when includes are missing # "--enable=all", # if you want sixty hundred pedantic suggestions @@ -58,19 +58,21 @@ def main(): check_commands.append((c, cmd)) - for i, (c, cmd) in enumerate(check_commands): + + process_functions = [] + def my_process(i, c, cmd): percent = 100.0 * (i / (len(check_commands) - 1)) percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:" - # if percent < 27.9: - # continue - - # let cppcheck finish the line off... + sys.stdout.flush() sys.stdout.write("%s " % percent_str) - sys.stdout.flush() - process = subprocess.Popen(cmd) - process.wait() + return subprocess.Popen(cmd) + + for i, (c, cmd) in enumerate(check_commands): + process_functions.append((my_process, (i, c, cmd))) + + project_source_info.queue_processes(process_functions) if __name__ == "__main__": diff --git a/build_files/cmake/cmake_static_check_sparse.py b/build_files/cmake/cmake_static_check_sparse.py index 9af53ed8008..aa2d56e5509 100644 --- a/build_files/cmake/cmake_static_check_sparse.py +++ b/build_files/cmake/cmake_static_check_sparse.py @@ -52,15 +52,21 @@ def main(): check_commands.append((c, cmd)) - for i, (c, cmd) in enumerate(check_commands): + def my_process(i, c, cmd): percent = 100.0 * (i / (len(check_commands) - 1)) percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:" - sys.stdout.write("%s %s\n" % (percent_str, c)) sys.stdout.flush() + sys.stdout.write("%s %s\n" % (percent_str, c)) + + return subprocess.Popen(cmd) + + process_functions = [] + for i, (c, cmd) in enumerate(check_commands): + process_functions.append((my_process, (i, c, cmd))) + + project_source_info.queue_processes(process_functions) - process = subprocess.Popen(cmd) - process.wait() if __name__ == "__main__": main() diff --git a/build_files/cmake/cmake_static_check_splint.py b/build_files/cmake/cmake_static_check_splint.py index aa13ef82e3c..08d83337426 100644 --- a/build_files/cmake/cmake_static_check_splint.py +++ b/build_files/cmake/cmake_static_check_splint.py @@ -84,15 +84,21 @@ def main(): check_commands.append((c, cmd)) - for i, (c, cmd) in enumerate(check_commands): + def my_process(i, c, cmd): percent = 100.0 * (i / (len(check_commands) - 1)) percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:" sys.stdout.write("%s %s\n" % (percent_str, c)) sys.stdout.flush() - process = subprocess.Popen(cmd) - process.wait() + return subprocess.Popen(cmd) + + process_functions = [] + for i, (c, cmd) in enumerate(check_commands): + process_functions.append((my_process, (i, c, cmd))) + + project_source_info.queue_processes(process_functions) + if __name__ == "__main__": main() diff --git a/build_files/cmake/project_source_info.py b/build_files/cmake/project_source_info.py index 670befbf2aa..83e4e05dc0f 100644 --- a/build_files/cmake/project_source_info.py +++ b/build_files/cmake/project_source_info.py @@ -148,6 +148,48 @@ def build_info(use_c=True, use_cxx=True, ignore_prefix_list=None): return source +# could be moved elsewhere!, this just happens to be used by scripts that also +# use this module. +def queue_processes(process_funcs, job_total=-1): + """ Takes a list of function arg pairs, each function must return a process + """ + import sys + + if job_total == -1: + import multiprocessing + job_total = multiprocessing.cpu_count() + del multiprocessing + + if job_total == 1: + import os + import sys + for func, args in process_funcs: + sys.stdout.flush() + sys.stderr.flush() + + process = func(*args) + process.wait() + else: + import time + import subprocess + + processes = [] + for func, args in process_funcs: + # wait until a thread is free + while 1: + processes[:] = [p for p in processes if p.poll() is None] + + if len(processes) <= job_total: + break + else: + time.sleep(0.1) + + sys.stdout.flush() + sys.stderr.flush() + + processes.append(func(*args)) + + def main(): if not os.path.exists(join(CMAKE_DIR, "CMakeCache.txt")): print("This script must run from the cmake build dir") diff --git a/doc/manpage/blender.1 b/doc/manpage/blender.1 index ddf3a79b104..20cd40e32ee 100644 --- a/doc/manpage/blender.1 +++ b/doc/manpage/blender.1 @@ -1,4 +1,4 @@ -.TH "BLENDER" "1" "June 03, 2011" "Blender Blender 2\&.57 (sub 1)" +.TH "BLENDER" "1" "September 22, 2011" "Blender Blender 2\&.59 (sub 3)" .SH NAME blender \- a 3D modelling and rendering package @@ -15,7 +15,7 @@ Use Blender to create TV commercials, to make technical visualizations, business http://www.blender.org .SH OPTIONS -Blender 2.57 (sub 1) +Blender 2.59 (sub 3) Usage: blender [args ...] [file] [args ...] .br .SS "Render Options:" diff --git a/intern/elbeem/intern/loop_tools.h b/intern/elbeem/intern/loop_tools.h index 10514251f1e..f06fa7c2861 100644 --- a/intern/elbeem/intern/loop_tools.h +++ b/intern/elbeem/intern/loop_tools.h @@ -119,8 +119,8 @@ } \ \ const int Nj = mLevel[mMaxRefine].lSizey; \ - int jstart = 0+( id * (Nj / Nthrds) ); \ - int jend = 0+( (id+1) * (Nj / Nthrds) ); \ + int jstart = 0+( (id * Nj ) / Nthrds ); \ + int jend = 0+(((id+1) * Nj ) / Nthrds ); \ if( ((Nj/Nthrds) *Nthrds) != Nj) { \ errMsg("LbmFsgrSolver","Invalid domain size Nj="<<Nj<<" Nthrds="<<Nthrds); \ } \ diff --git a/release/scripts/modules/bpy_extras/__init__.py b/release/scripts/modules/bpy_extras/__init__.py index d853d5fda10..fd653a4129c 100644 --- a/release/scripts/modules/bpy_extras/__init__.py +++ b/release/scripts/modules/bpy_extras/__init__.py @@ -23,6 +23,7 @@ Utility modules assosiated with the bpy module. """ __all__ = ( + "anim_utils", "object_utils", "io_utils", "image_utils", diff --git a/release/scripts/modules/bpy_extras/anim_utils.py b/release/scripts/modules/bpy_extras/anim_utils.py new file mode 100644 index 00000000000..9482dc3e1c9 --- /dev/null +++ b/release/scripts/modules/bpy_extras/anim_utils.py @@ -0,0 +1,247 @@ +# ##### 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-80 compliant> + +__all__ = ( + "bake_action", + ) + +import bpy + + +def bake_action(frame_start, + frame_end, + frame_step=1, + only_selected=False, + do_pose=True, + do_object=True, + do_constraint_clear=False, + do_clean=False, + action=None, + ): + + """ + Return an image from the file path with options to search multiple paths + and return a placeholder if its not found. + + :arg frame_start: First frame to bake. + :type frame_start: int + :arg frame_end: Last frame to bake. + :type frame_end: int + :arg frame_step: Frame step. + :type frame_step: int + :arg only_selected: Only bake selected data. + :type only_selected: bool + :arg do_pose: Bake pose channels. + :type do_pose: bool + :arg do_object: Bake objects. + :type do_object: bool + :arg do_constraint_clear: Remove constraints. + :type do_constraint_clear: bool + :arg do_clean: Remove redundant keyframes after baking. + :type do_clean: bool + :arg action: An action to bake the data into, or None for a new action + to be created. + :type action: :class:`bpy.types.Action` or None + + :return: an action or None + :rtype: :class:`bpy.types.Action` + """ + + # ------------------------------------------------------------------------- + # Helper Functions + + def pose_frame_info(obj): + from mathutils import Matrix + + info = {} + + pose = obj.pose + + pose_items = pose.bones.items() + + for name, pbone in pose_items: + binfo = {} + bone = pbone.bone + + binfo["parent"] = getattr(bone.parent, "name", None) + binfo["bone"] = bone + binfo["pbone"] = pbone + binfo["matrix_local"] = bone.matrix_local.copy() + try: + binfo["matrix_local_inv"] = binfo["matrix_local"].inverted() + except: + binfo["matrix_local_inv"] = Matrix() + + binfo["matrix"] = bone.matrix.copy() + binfo["matrix_pose"] = pbone.matrix.copy() + try: + binfo["matrix_pose_inv"] = binfo["matrix_pose"].inverted() + except: + binfo["matrix_pose_inv"] = Matrix() + + info[name] = binfo + + for name, pbone in pose_items: + binfo = info[name] + binfo_parent = binfo.get("parent", None) + if binfo_parent: + binfo_parent = info[binfo_parent] + + matrix = binfo["matrix_pose"] + rest_matrix = binfo["matrix_local"] + + if binfo_parent: + matrix = binfo_parent["matrix_pose_inv"] * matrix + rest_matrix = binfo_parent["matrix_local_inv"] * rest_matrix + + binfo["matrix_key"] = rest_matrix.inverted() * matrix + + return info + + + def obj_frame_info(obj): + info = {} + # parent = obj.parent + info["matrix_key"] = obj.matrix_local.copy() + return info + + # ------------------------------------------------------------------------- + # Setup the Context + + # TODO, pass data rather then grabbing from the context! + scene = bpy.context.scene + obj = bpy.context.object + pose = obj.pose + frame_back = scene.frame_current + + if pose is None: + do_pose = False + + if do_pose is None and do_object is None: + return None + + pose_info = [] + obj_info = [] + + frame_range = range(frame_start, frame_end + 1, frame_step) + + # ------------------------------------------------------------------------- + # Collect transformations + + # could speed this up by applying steps here too... + for f in frame_range: + scene.frame_set(f) + + if do_pose: + pose_info.append(pose_frame_info(obj)) + if do_object: + obj_info.append(obj_frame_info(obj)) + + f += 1 + + # ------------------------------------------------------------------------- + # Create action + + # incase animation data hassnt been created + atd = obj.animation_data_create() + if action is None: + action = bpy.data.actions.new("Action") + atd.action = action + + if do_pose: + pose_items = pose.bones.items() + else: + pose_items = [] # skip + + # ------------------------------------------------------------------------- + # Apply transformations to action + + # pose + for name, pbone in (pose_items if do_pose else ()): + if only_selected and not pbone.bone.select: + continue + + if do_constraint_clear: + while pbone.constraints: + pbone.constraints.remove(pbone.constraints[0]) + + for f in frame_range: + matrix = pose_info[(f - frame_start) // frame_step][name]["matrix_key"] + + # pbone.location = matrix.to_translation() + # pbone.rotation_quaternion = matrix.to_quaternion() + pbone.matrix_basis = matrix + + pbone.keyframe_insert("location", -1, f, name) + + rotation_mode = pbone.rotation_mode + + if rotation_mode == 'QUATERNION': + pbone.keyframe_insert("rotation_quaternion", -1, f, name) + elif rotation_mode == 'AXIS_ANGLE': + pbone.keyframe_insert("rotation_axis_angle", -1, f, name) + else: # euler, XYZ, ZXY etc + pbone.keyframe_insert("rotation_euler", -1, f, name) + + pbone.keyframe_insert("scale", -1, f, name) + + # object. TODO. multiple objects + if do_object: + if do_constraint_clear: + while obj.constraints: + obj.constraints.remove(obj.constraints[0]) + + for f in frame_range: + matrix = obj_info[(f - frame_start) // frame_step]["matrix_key"] + obj.matrix_local = matrix + + obj.keyframe_insert("location", -1, f) + + rotation_mode = obj.rotation_mode + + if rotation_mode == 'QUATERNION': + obj.keyframe_insert("rotation_quaternion", -1, f) + elif rotation_mode == 'AXIS_ANGLE': + obj.keyframe_insert("rotation_axis_angle", -1, f) + else: # euler, XYZ, ZXY etc + obj.keyframe_insert("rotation_euler", -1, f) + + obj.keyframe_insert("scale", -1, f) + + scene.frame_set(frame_back) + + # ------------------------------------------------------------------------- + # Clean + + if do_clean: + for fcu in action.fcurves: + keyframe_points = fcu.keyframe_points + i = 1 + while i < len(fcu.keyframe_points) - 1: + val_prev = keyframe_points[i - 1].co[1] + val_next = keyframe_points[i + 1].co[1] + val = keyframe_points[i].co[1] + + if abs(val - val_prev) + abs(val - val_next) < 0.0001: + keyframe_points.remove(keyframe_points[i]) + else: + i += 1 + + return action diff --git a/release/scripts/startup/bl_operators/__init__.py b/release/scripts/startup/bl_operators/__init__.py index d5f7a63366a..f5f8b992356 100644 --- a/release/scripts/startup/bl_operators/__init__.py +++ b/release/scripts/startup/bl_operators/__init__.py @@ -24,10 +24,11 @@ if "bpy" in locals(): _reload(val) _modules = ( "add_mesh_torus", + "anim", "animsys_update", + "console", "image", "mesh", - "nla", "object_align", "object", "object_randomize_transform", @@ -39,6 +40,7 @@ _modules = ( "uvcalc_lightmap", "uvcalc_smart_project", "vertexpaint_dirt", + "view3d", "wm", ) __import__(name=__name__, fromlist=_modules) diff --git a/release/scripts/startup/bl_operators/anim.py b/release/scripts/startup/bl_operators/anim.py new file mode 100644 index 00000000000..660194abf8c --- /dev/null +++ b/release/scripts/startup/bl_operators/anim.py @@ -0,0 +1,235 @@ +# ##### 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-80 compliant> + +if "bpy" in locals(): + import imp + if "anim_utils" in locals(): + imp.reload(anim_utils) + +import bpy +from bpy.types import Operator +from bpy.props import IntProperty, BoolProperty, EnumProperty + + +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..." + + filepath = bpy.props.StringProperty(name="File Path", description="Filepath to write file to") + filter_folder = bpy.props.BoolProperty(name="Filter folders", description="", default=True, options={'HIDDEN'}) + filter_text = bpy.props.BoolProperty(name="Filter text", description="", default=True, options={'HIDDEN'}) + filter_python = bpy.props.BoolProperty(name="Filter python", description="", default=True, options={'HIDDEN'}) + + def execute(self, context): + if not self.filepath: + raise Exception("Filepath not set") + + f = open(self.filepath, "w") + if not f: + raise Exception("Could not open file") + + scene = context.scene + ks = scene.keying_sets.active + + f.write("# Keying Set: %s\n" % ks.name) + + f.write("import bpy\n\n") + f.write("scene= bpy.data.scenes[0]\n\n") # XXX, why not use the current scene? + + # Add KeyingSet and set general settings + f.write("# Keying Set Level declarations\n") + f.write("ks= scene.keying_sets.new(name=\"%s\")\n" % ks.name) + + if not ks.is_path_absolute: + f.write("ks.is_path_absolute = False\n") + f.write("\n") + + f.write("ks.bl_options = %r\n" % ks.bl_options) + f.write("\n") + + # generate and write set of lookups for id's used in paths + id_to_paths_cache = {} # cache for syncing ID-blocks to bpy paths + shorthands + + for ksp in ks.paths: + if ksp.id is None: + continue + if ksp.id in id_to_paths_cache: + continue + + # - idtype_list is used to get the list of id-datablocks from bpy.data.* + # since this info isn't available elsewhere + # - id.bl_rna.name gives a name suitable for UI, + # with a capitalised first letter, but we need + # the plural form that's all lower case + idtype_list = ksp.id.bl_rna.name.lower() + "s" + id_bpy_path = "bpy.data.%s[\"%s\"]" % (idtype_list, ksp.id.name) + + # shorthand ID for the ID-block (as used in the script) + short_id = "id_%d" % len(id_to_paths_cache) + + # store this in the cache now + id_to_paths_cache[ksp.id] = [short_id, id_bpy_path] + + f.write("# ID's that are commonly used\n") + for id_pair in id_to_paths_cache.values(): + f.write("%s = %s\n" % (id_pair[0], id_pair[1])) + f.write("\n") + + # write paths + f.write("# Path Definitions\n") + for ksp in ks.paths: + f.write("ksp = ks.paths.add(") + + # id-block + data_path + if ksp.id: + # find the relevant shorthand from the cache + id_bpy_path = id_to_paths_cache[ksp.id][0] + else: + id_bpy_path = "None" # XXX... + f.write("%s, '%s'" % (id_bpy_path, ksp.data_path)) + + # array index settings (if applicable) + if ksp.use_entire_array: + f.write(", index=-1") + else: + f.write(", index=%d" % ksp.array_index) + + # grouping settings (if applicable) + # NOTE: the current default is KEYINGSET, but if this changes, change this code too + if ksp.group_method == 'NAMED': + f.write(", group_method='%s', group_name=\"%s\"" % (ksp.group_method, ksp.group)) + elif ksp.group_method != 'KEYINGSET': + f.write(", group_method='%s'" % ksp.group_method) + + # finish off + f.write(")\n") + + f.write("\n") + f.close() + + return {'FINISHED'} + + def invoke(self, context, event): + wm = context.window_manager + wm.fileselect_add(self) + return {'RUNNING_MODAL'} + + +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", + description="Start frame for baking", + min=0, max=300000, + default=1, + ) + frame_end = IntProperty( + name="End Frame", + description="End frame for baking", + min=1, max=300000, + default=250, + ) + step = IntProperty( + name="Frame Step", + description="Frame Step", + 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'}, + items=(('POSE', "Pose", ""), + ('OBJECT', "Object", ""), + ), + default={'POSE'}, + ) + + def execute(self, context): + + from bpy_extras import anim_utils + + action = anim_utils.bake_action(self.frame_start, + self.frame_end, + self.step, + self.only_selected, + 'POSE' in self.bake_types, + 'OBJECT' in self.bake_types, + self.clear_consraints, + True, + ) + + if action is None: + self.report({'INFO'}, "Nothing to bake") + return {'CANCELLED'} + + return {'FINISHED'} + + 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/console.py b/release/scripts/startup/bl_operators/console.py new file mode 100644 index 00000000000..de953630f00 --- /dev/null +++ b/release/scripts/startup/bl_operators/console.py @@ -0,0 +1,106 @@ +# ##### 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-80 compliant> + +import bpy +from bpy.types import Operator +from bpy.props import StringProperty + + +class ConsoleExec(Operator): + '''Execute the current console line as a python expression''' + bl_idname = "console.execute" + bl_label = "Console Execute" + + def execute(self, context): + sc = context.space_data + + module = __import__("console_" + sc.language) + execute = getattr(module, "execute", None) + + if execute: + return execute(context) + else: + print("Error: bpy.ops.console.execute_" + sc.language + " - not found") + return {'FINISHED'} + + +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" + + def execute(self, context): + sc = context.space_data + module = __import__("console_" + sc.language) + autocomplete = getattr(module, "autocomplete", None) + + if autocomplete: + return autocomplete(context) + else: + print("Error: bpy.ops.console.autocomplete_" + sc.language + " - not found") + return {'FINISHED'} + + +class ConsoleBanner(Operator): + '''Print a message whem the terminal initializes''' + bl_idname = "console.banner" + bl_label = "Console Banner" + + def execute(self, context): + sc = context.space_data + + # default to python + if not sc.language: + sc.language = 'python' + + module = __import__("console_" + sc.language) + banner = getattr(module, "banner", None) + + if banner: + return banner(context) + else: + print("Error: bpy.ops.console.banner_" + sc.language + " - not found") + return {'FINISHED'} + + +class ConsoleLanguage(Operator): + '''Set the current language for this console''' + bl_idname = "console.language" + bl_label = "Console Language" + + language = StringProperty( + name="Language", + maxlen=32, + ) + + def execute(self, context): + sc = context.space_data + + # defailt to python + sc.language = self.language + + bpy.ops.console.banner() + + # insert a new blank line + bpy.ops.console.history_append(text="", current_character=0, + remove_duplicates=True) + + return {'FINISHED'} + diff --git a/release/scripts/startup/bl_operators/mesh.py b/release/scripts/startup/bl_operators/mesh.py index 5f6583754e9..bf9fa562ee1 100644 --- a/release/scripts/startup/bl_operators/mesh.py +++ b/release/scripts/startup/bl_operators/mesh.py @@ -25,7 +25,7 @@ from bpy.props import EnumProperty class MeshSelectInteriorFaces(Operator): - '''Select faces where all edges have more then 2 face users.''' + '''Select faces where all edges have more then 2 face users''' bl_idname = "mesh.faces_select_interior" bl_label = "Select Interior Faces" diff --git a/release/scripts/startup/bl_operators/nla.py b/release/scripts/startup/bl_operators/nla.py deleted file mode 100644 index feb0016b1c7..00000000000 --- a/release/scripts/startup/bl_operators/nla.py +++ /dev/null @@ -1,306 +0,0 @@ -# ##### 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-80 compliant> - -import bpy -from bpy.types import Operator - - -def pose_frame_info(obj): - from mathutils import Matrix - - info = {} - - pose = obj.pose - - pose_items = pose.bones.items() - - for name, pbone in pose_items: - binfo = {} - bone = pbone.bone - - binfo["parent"] = getattr(bone.parent, "name", None) - binfo["bone"] = bone - binfo["pbone"] = pbone - binfo["matrix_local"] = bone.matrix_local.copy() - try: - binfo["matrix_local_inv"] = binfo["matrix_local"].inverted() - except: - binfo["matrix_local_inv"] = Matrix() - - binfo["matrix"] = bone.matrix.copy() - binfo["matrix_pose"] = pbone.matrix.copy() - try: - binfo["matrix_pose_inv"] = binfo["matrix_pose"].inverted() - except: - binfo["matrix_pose_inv"] = Matrix() - - info[name] = binfo - - for name, pbone in pose_items: - binfo = info[name] - binfo_parent = binfo.get("parent", None) - if binfo_parent: - binfo_parent = info[binfo_parent] - - matrix = binfo["matrix_pose"] - rest_matrix = binfo["matrix_local"] - - if binfo_parent: - matrix = binfo_parent["matrix_pose_inv"] * matrix - rest_matrix = binfo_parent["matrix_local_inv"] * rest_matrix - - binfo["matrix_key"] = rest_matrix.inverted() * matrix - - return info - - -def obj_frame_info(obj): - info = {} - # parent = obj.parent - info["matrix_key"] = obj.matrix_local.copy() - return info - - -def bake(frame_start, - frame_end, step=1, - only_selected=False, - do_pose=True, - do_object=True, - do_constraint_clear=False, - action=None): - - scene = bpy.context.scene - obj = bpy.context.object - pose = obj.pose - frame_back = scene.frame_current - - if pose is None: - do_pose = False - - if do_pose is None and do_object is None: - return None - - pose_info = [] - obj_info = [] - - frame_range = range(frame_start, frame_end + 1, step) - - # ------------------------------------------------------------------------- - # Collect transformations - - # could speed this up by applying steps here too... - for f in frame_range: - scene.frame_set(f) - - if do_pose: - pose_info.append(pose_frame_info(obj)) - if do_object: - obj_info.append(obj_frame_info(obj)) - - f += 1 - - # ------------------------------------------------------------------------- - # Create action - - # incase animation data hassnt been created - atd = obj.animation_data_create() - if action is None: - action = bpy.data.actions.new("Action") - atd.action = action - - if do_pose: - pose_items = pose.bones.items() - else: - pose_items = [] # skip - - # ------------------------------------------------------------------------- - # Apply transformations to action - - # pose - for name, pbone in (pose_items if do_pose else ()): - if only_selected and not pbone.bone.select: - continue - - if do_constraint_clear: - while pbone.constraints: - pbone.constraints.remove(pbone.constraints[0]) - - for f in frame_range: - matrix = pose_info[(f - frame_start) // step][name]["matrix_key"] - - # pbone.location = matrix.to_translation() - # pbone.rotation_quaternion = matrix.to_quaternion() - pbone.matrix_basis = matrix - - pbone.keyframe_insert("location", -1, f, name) - - rotation_mode = pbone.rotation_mode - - if rotation_mode == 'QUATERNION': - pbone.keyframe_insert("rotation_quaternion", -1, f, name) - elif rotation_mode == 'AXIS_ANGLE': - pbone.keyframe_insert("rotation_axis_angle", -1, f, name) - else: # euler, XYZ, ZXY etc - pbone.keyframe_insert("rotation_euler", -1, f, name) - - pbone.keyframe_insert("scale", -1, f, name) - - # object. TODO. multiple objects - if do_object: - if do_constraint_clear: - while obj.constraints: - obj.constraints.remove(obj.constraints[0]) - - for f in frame_range: - matrix = obj_info[(f - frame_start) // step]["matrix_key"] - obj.matrix_local = matrix - - obj.keyframe_insert("location", -1, f) - - rotation_mode = obj.rotation_mode - - if rotation_mode == 'QUATERNION': - obj.keyframe_insert("rotation_quaternion", -1, f) - elif rotation_mode == 'AXIS_ANGLE': - obj.keyframe_insert("rotation_axis_angle", -1, f) - else: # euler, XYZ, ZXY etc - obj.keyframe_insert("rotation_euler", -1, f) - - obj.keyframe_insert("scale", -1, f) - - scene.frame_set(frame_back) - - return action - - -from bpy.props import IntProperty, BoolProperty, EnumProperty - - -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", - description="Start frame for baking", - min=0, max=300000, - default=1, - ) - frame_end = IntProperty( - name="End Frame", - description="End frame for baking", - min=1, max=300000, - default=250, - ) - step = IntProperty( - name="Frame Step", - description="Frame Step", - 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'}, - items=(('POSE', "Pose", ""), - ('OBJECT', "Object", ""), - ), - default={'POSE'}, - ) - - def execute(self, context): - - action = bake(self.frame_start, - self.frame_end, - self.step, - self.only_selected, - 'POSE' in self.bake_types, - 'OBJECT' in self.bake_types, - self.clear_consraints, - ) - - if action is None: - self.report({'INFO'}, "Nothing to bake") - return {'CANCELLED'} - - # basic cleanup, could move elsewhere - for fcu in action.fcurves: - keyframe_points = fcu.keyframe_points - i = 1 - while i < len(fcu.keyframe_points) - 1: - val_prev = keyframe_points[i - 1].co[1] - val_next = keyframe_points[i + 1].co[1] - val = keyframe_points[i].co[1] - - if abs(val - val_prev) + abs(val - val_next) < 0.0001: - keyframe_points.remove(keyframe_points[i]) - else: - i += 1 - - return {'FINISHED'} - - 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/screen_play_rendered_anim.py b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py index c2a09d6a4ae..015a2cd0c36 100644 --- a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py +++ b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py @@ -66,7 +66,7 @@ def guess_player_path(preset): class PlayRenderedAnim(Operator): - '''Plays back rendered frames/movies using an external player.''' + '''Plays back rendered frames/movies using an external player''' bl_idname = "render.play_rendered_anim" bl_label = "Play Rendered Animation" bl_options = {'REGISTER'} diff --git a/release/scripts/startup/bl_operators/sequencer.py b/release/scripts/startup/bl_operators/sequencer.py index 53654ffbc6f..67b9be59f2a 100644 --- a/release/scripts/startup/bl_operators/sequencer.py +++ b/release/scripts/startup/bl_operators/sequencer.py @@ -25,7 +25,7 @@ from bpy.props import IntProperty class SequencerCrossfadeSounds(Operator): - '''Do crossfading volume animation of two selected sound strips.''' + '''Do crossfading volume animation of two selected sound strips''' bl_idname = "sequencer.crossfade_sounds" bl_label = "Crossfade sounds" @@ -76,7 +76,7 @@ class SequencerCrossfadeSounds(Operator): class SequencerCutMulticam(Operator): - '''Cut multicam strip and select camera.''' + '''Cut multicam strip and select camera''' bl_idname = "sequencer.cut_multicam" bl_label = "Cut multicam" @@ -118,7 +118,7 @@ class SequencerCutMulticam(Operator): class SequencerDeinterlaceSelectedMovies(Operator): - '''Deinterlace all selected movie sources.''' + '''Deinterlace all selected movie sources''' bl_idname = "sequencer.deinterlace_selected_movies" bl_label = "Deinterlace Movies" diff --git a/release/scripts/startup/bl_operators/uvcalc_smart_project.py b/release/scripts/startup/bl_operators/uvcalc_smart_project.py index c4466e6453f..5985a37a0c9 100644 --- a/release/scripts/startup/bl_operators/uvcalc_smart_project.py +++ b/release/scripts/startup/bl_operators/uvcalc_smart_project.py @@ -1105,7 +1105,8 @@ from bpy.props import FloatProperty 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.''' + '''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'} diff --git a/release/scripts/startup/bl_operators/view3d.py b/release/scripts/startup/bl_operators/view3d.py new file mode 100644 index 00000000000..805f2b5105b --- /dev/null +++ b/release/scripts/startup/bl_operators/view3d.py @@ -0,0 +1,77 @@ +# ##### 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-80 compliant> + +import bpy +from bpy.types import 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" + + def execute(self, context): + mesh = context.object.data + select_mode = context.tool_settings.mesh_select_mode + + totface = mesh.total_face_sel + totedge = mesh.total_edge_sel + # totvert = mesh.total_vert_sel + + if select_mode[2] and totface == 1: + bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)}) + elif select_mode[2] and totface > 1: + bpy.ops.mesh.extrude_faces_move('INVOKE_REGION_WIN') + elif select_mode[1] and totedge >= 1: + bpy.ops.mesh.extrude_edges_move('INVOKE_REGION_WIN') + else: + bpy.ops.mesh.extrude_vertices_move('INVOKE_REGION_WIN') + + # ignore return from operators above because they are 'RUNNING_MODAL', and cause this one not to be freed. [#24671] + return {'FINISHED'} + + def invoke(self, context, event): + return self.execute(context) + + +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" + + def execute(self, context): + mesh = context.object.data + + totface = mesh.total_face_sel + totedge = mesh.total_edge_sel + # totvert = mesh.total_vert_sel + + if totface >= 1: + bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)}) + elif totedge == 1: + bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (True, True, False)}) + else: + bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN') + + # ignore return from operators above because they are 'RUNNING_MODAL', and cause this one not to be freed. [#24671] + return {'FINISHED'} + + def invoke(self, context, event): + return self.execute(context) diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 861255f167f..9b037f7dc09 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -26,6 +26,9 @@ from bpy.props import (StringProperty, FloatProperty, EnumProperty, ) + +import addon_utils +import os from rna_prop_ui import rna_idprop_ui_prop_get, rna_idprop_ui_prop_clear @@ -172,7 +175,7 @@ class BRUSH_OT_active_index_set(Operator): class WM_OT_context_set_boolean(Operator): - '''Set a context value.''' + '''Set a context value''' bl_idname = "wm.context_set_boolean" bl_label = "Context Set Boolean" bl_options = {'UNDO', 'INTERNAL'} @@ -188,7 +191,7 @@ class WM_OT_context_set_boolean(Operator): class WM_OT_context_set_int(Operator): # same as enum - '''Set a context value.''' + '''Set a context value''' bl_idname = "wm.context_set_int" bl_label = "Context Set" bl_options = {'UNDO', 'INTERNAL'} @@ -205,7 +208,7 @@ class WM_OT_context_set_int(Operator): # same as enum class WM_OT_context_scale_int(Operator): - '''Scale an int context value.''' + '''Scale an int context value''' bl_idname = "wm.context_scale_int" bl_label = "Context Set" bl_options = {'UNDO', 'INTERNAL'} @@ -248,7 +251,7 @@ class WM_OT_context_scale_int(Operator): class WM_OT_context_set_float(Operator): # same as enum - '''Set a context value.''' + '''Set a context value''' bl_idname = "wm.context_set_float" bl_label = "Context Set Float" bl_options = {'UNDO', 'INTERNAL'} @@ -265,7 +268,7 @@ class WM_OT_context_set_float(Operator): # same as enum class WM_OT_context_set_string(Operator): # same as enum - '''Set a context value.''' + '''Set a context value''' bl_idname = "wm.context_set_string" bl_label = "Context Set String" bl_options = {'UNDO', 'INTERNAL'} @@ -281,7 +284,7 @@ class WM_OT_context_set_string(Operator): # same as enum class WM_OT_context_set_enum(Operator): - '''Set a context value.''' + '''Set a context value''' bl_idname = "wm.context_set_enum" bl_label = "Context Set Enum" bl_options = {'UNDO', 'INTERNAL'} @@ -297,7 +300,7 @@ class WM_OT_context_set_enum(Operator): class WM_OT_context_set_value(Operator): - '''Set a context value.''' + '''Set a context value''' bl_idname = "wm.context_set_value" bl_label = "Context Set Value" bl_options = {'UNDO', 'INTERNAL'} @@ -318,7 +321,7 @@ class WM_OT_context_set_value(Operator): class WM_OT_context_toggle(Operator): - '''Toggle a context value.''' + '''Toggle a context value''' bl_idname = "wm.context_toggle" bl_label = "Context Toggle" bl_options = {'UNDO', 'INTERNAL'} @@ -337,7 +340,7 @@ class WM_OT_context_toggle(Operator): class WM_OT_context_toggle_enum(Operator): - '''Toggle a context value.''' + '''Toggle a context value''' bl_idname = "wm.context_toggle_enum" bl_label = "Context Toggle Values" bl_options = {'UNDO', 'INTERNAL'} @@ -371,7 +374,7 @@ class WM_OT_context_toggle_enum(Operator): class WM_OT_context_cycle_int(Operator): '''Set a context value. Useful for cycling active material, ''' - '''vertex keys, groups' etc.''' + '''vertex keys, groups' etc''' bl_idname = "wm.context_cycle_int" bl_label = "Context Int Cycle" bl_options = {'UNDO', 'INTERNAL'} @@ -405,7 +408,7 @@ class WM_OT_context_cycle_int(Operator): class WM_OT_context_cycle_enum(Operator): - '''Toggle a context value.''' + '''Toggle a context value''' bl_idname = "wm.context_cycle_enum" bl_label = "Context Enum Cycle" bl_options = {'UNDO', 'INTERNAL'} @@ -458,7 +461,7 @@ class WM_OT_context_cycle_enum(Operator): class WM_OT_context_cycle_array(Operator): '''Set a context array value. - Useful for cycling the active mesh edit mode.''' + Useful for cycling the active mesh edit mode''' bl_idname = "wm.context_cycle_array" bl_label = "Context Array Cycle" bl_options = {'UNDO', 'INTERNAL'} @@ -518,7 +521,7 @@ class WM_OT_context_menu_enum(Operator): class WM_OT_context_set_id(Operator): - '''Toggle a context value.''' + '''Toggle a context value''' bl_idname = "wm.context_set_id" bl_label = "Set Library ID" bl_options = {'UNDO', 'INTERNAL'} @@ -755,7 +758,6 @@ class WM_OT_path_open(Operator): def execute(self, context): import sys - import os import subprocess filepath = bpy.path.abspath(self.filepath) @@ -1100,7 +1102,6 @@ class WM_OT_appconfig_default(Operator): bl_label = "Default Application Configuration" def execute(self, context): - import os context.window_manager.keyconfigs.active = context.window_manager.keyconfigs.default @@ -1122,7 +1123,6 @@ class WM_OT_appconfig_activate(Operator): ) def execute(self, context): - import os bpy.utils.keyconfig_set(self.filepath) filepath = self.filepath.replace("keyconfig", "interaction") @@ -1150,7 +1150,6 @@ class WM_OT_copy_prev_settings(Operator): bl_label = "Copy Previous Settings" def execute(self, context): - import os import shutil ver = bpy.app.version ver_old = ((ver[0] * 100) + ver[1]) - 1 @@ -1179,3 +1178,707 @@ class WM_OT_copy_prev_settings(Operator): return {'FINISHED'} return {'CANCELLED'} + + +class WM_OT_keyconfig_test(Operator): + "Test keyconfig for conflicts" + bl_idname = "wm.keyconfig_test" + bl_label = "Test Key Configuration for Conflicts" + + def testEntry(self, kc, entry, src=None, parent=None): + result = False + + def kmistr(kmi): + if km.is_modal: + s = ["kmi = km.keymap_items.new_modal(\'%s\', \'%s\', \'%s\'" % (kmi.propvalue, kmi.type, kmi.value)] + else: + s = ["kmi = km.keymap_items.new(\'%s\', \'%s\', \'%s\'" % (kmi.idname, kmi.type, kmi.value)] + + if kmi.any: + s.append(", any=True") + else: + if kmi.shift: + s.append(", shift=True") + if kmi.ctrl: + s.append(", ctrl=True") + if kmi.alt: + s.append(", alt=True") + if kmi.oskey: + s.append(", oskey=True") + if kmi.key_modifier and kmi.key_modifier != 'NONE': + s.append(", key_modifier=\'%s\'" % kmi.key_modifier) + + s.append(")\n") + + props = kmi.properties + + if props is not None: + export_properties("kmi.properties", props, s) + + return "".join(s).strip() + + idname, spaceid, regionid, children = entry + + km = kc.keymaps.find(idname, space_type=spaceid, region_type=regionid) + + if km: + km = km.active() + + if src: + for item in km.keymap_items: + if src.compare(item): + print("===========") + print(parent.name) + print(kmistr(src)) + print(km.name) + print(kmistr(item)) + result = True + + for child in children: + if self.testEntry(kc, child, src, parent): + result = True + else: + for i in range(len(km.keymap_items)): + src = km.keymap_items[i] + + for child in children: + if self.testEntry(kc, child, src, km): + result = True + + for j in range(len(km.keymap_items) - i - 1): + item = km.keymap_items[j + i + 1] + if src.compare(item): + print("===========") + print(km.name) + print(kmistr(src)) + print(kmistr(item)) + result = True + + for child in children: + if self.testEntry(kc, child): + result = True + + return result + + def testConfig(self, kc): + result = False + for entry in KM_HIERARCHY: + if self.testEntry(kc, entry): + result = True + return result + + def execute(self, context): + wm = context.window_manager + kc = wm.keyconfigs.default + + if self.testConfig(kc): + print("CONFLICT") + + return {'FINISHED'} + + +def _string_value(value): + if isinstance(value, str) or isinstance(value, bool) or isinstance(value, float) or isinstance(value, int): + result = repr(value) + elif getattr(value, '__len__', False): + return repr(list(value)) + else: + print("Export key configuration: can't write ", value) + + return result + + +class WM_OT_keyconfig_import(Operator): + "Import key configuration from a python script" + bl_idname = "wm.keyconfig_import" + bl_label = "Import Key Configuration..." + + 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 + import shutil + + if not self.filepath: + self.report({'ERROR'}, "Filepath not set") + return {'CANCELLED'} + + config_name = basename(self.filepath) + + path = bpy.utils.user_resource('SCRIPTS', os.path.join("presets", "keyconfig"), create=True) + path = os.path.join(path, config_name) + + try: + if self.keep_original: + shutil.copy(self.filepath, path) + else: + shutil.move(self.filepath, path) + except Exception as e: + self.report({'ERROR'}, "Installing keymap failed: %s" % e) + return {'CANCELLED'} + + # sneaky way to check we're actually running the code. + bpy.utils.keyconfig_set(path) + + return {'FINISHED'} + + def invoke(self, context, event): + wm = context.window_manager + wm.fileselect_add(self) + return {'RUNNING_MODAL'} + +# This operator is also used by interaction presets saving - AddPresetBase + + +class WM_OT_keyconfig_export(Operator): + "Export key configuration to a python script" + bl_idname = "wm.keyconfig_export" + bl_label = "Export Key Configuration..." + + 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: + raise Exception("Filepath not set") + + if not self.filepath.endswith('.py'): + self.filepath += '.py' + + f = open(self.filepath, "w") + if not f: + raise Exception("Could not open file") + + wm = context.window_manager + kc = wm.keyconfigs.active + + f.write("import bpy\n") + f.write("import os\n\n") + f.write("wm = bpy.context.window_manager\n") + f.write("kc = wm.keyconfigs.new(os.path.splitext(os.path.basename(__file__))[0])\n\n") # keymap must be created by caller + + # Generate a list of keymaps to export: + # + # First add all user_modified keymaps (found in keyconfigs.user.keymaps list), + # then add all remaining keymaps from the currently active custom keyconfig. + # + # This will create a final list of keymaps that can be used as a 'diff' against + # the default blender keyconfig, recreating the current setup from a fresh blender + # without needing to export keymaps which haven't been edited. + + class FakeKeyConfig(): + keymaps = [] + edited_kc = FakeKeyConfig() + for km in wm.keyconfigs.user.keymaps: + if km.is_user_modified: + edited_kc.keymaps.append(km) + # merge edited keymaps with non-default keyconfig, if it exists + if kc != wm.keyconfigs.default: + export_keymaps = _merge_keymaps(edited_kc, kc) + else: + export_keymaps = _merge_keymaps(edited_kc, edited_kc) + + for km, kc_x in export_keymaps: + + km = km.active() + + f.write("# Map %s\n" % km.name) + f.write("km = kc.keymaps.new('%s', space_type='%s', region_type='%s', modal=%s)\n\n" % (km.name, km.space_type, km.region_type, km.is_modal)) + for kmi in km.keymap_items: + if km.is_modal: + f.write("kmi = km.keymap_items.new_modal('%s', '%s', '%s'" % (kmi.propvalue, kmi.type, kmi.value)) + else: + f.write("kmi = km.keymap_items.new('%s', '%s', '%s'" % (kmi.idname, kmi.type, kmi.value)) + if kmi.any: + f.write(", any=True") + else: + if kmi.shift: + f.write(", shift=True") + if kmi.ctrl: + f.write(", ctrl=True") + if kmi.alt: + f.write(", alt=True") + if kmi.oskey: + f.write(", oskey=True") + if kmi.key_modifier and kmi.key_modifier != 'NONE': + f.write(", key_modifier='%s'" % kmi.key_modifier) + f.write(")\n") + + props = kmi.properties + + if props is not None: + f.write("".join(export_properties("kmi.properties", props))) + + f.write("\n") + + f.close() + + return {'FINISHED'} + + def invoke(self, context, event): + wm = context.window_manager + wm.fileselect_add(self) + return {'RUNNING_MODAL'} + + +class WM_OT_keymap_restore(Operator): + "Restore key map(s)" + bl_idname = "wm.keymap_restore" + bl_label = "Restore Key Map(s)" + + all = BoolProperty( + name="All Keymaps", + description="Restore all keymaps to default", + ) + + def execute(self, context): + wm = context.window_manager + + if self.all: + for km in wm.keyconfigs.user.keymaps: + km.restore_to_default() + else: + km = context.keymap + km.restore_to_default() + + return {'FINISHED'} + + +class WM_OT_keyitem_restore(Operator): + "Restore key map item" + bl_idname = "wm.keyitem_restore" + bl_label = "Restore Key Map Item" + + item_id = IntProperty( + name="Item Identifier", + description="Identifier of the item to remove", + ) + + @classmethod + def poll(cls, context): + keymap = getattr(context, "keymap", None) + return keymap + + def execute(self, context): + km = context.keymap + kmi = km.keymap_items.from_id(self.item_id) + + if (not kmi.is_user_defined) and kmi.is_user_modified: + km.restore_item_to_default(kmi) + + return {'FINISHED'} + + +class WM_OT_keyitem_add(Operator): + "Add key map item" + bl_idname = "wm.keyitem_add" + bl_label = "Add Key Map Item" + + def execute(self, context): + km = context.keymap + + if km.is_modal: + km.keymap_items.new_modal("", 'A', 'PRESS') # kmi + else: + km.keymap_items.new("none", 'A', 'PRESS') # kmi + + # clear filter and expand keymap so we can see the newly added item + if context.space_data.filter_text != "": + context.space_data.filter_text = "" + km.show_expanded_items = True + km.show_expanded_children = True + + return {'FINISHED'} + + +class WM_OT_keyitem_remove(Operator): + "Remove key map item" + bl_idname = "wm.keyitem_remove" + bl_label = "Remove Key Map Item" + + item_id = IntProperty( + name="Item Identifier", + description="Identifier of the item to remove", + ) + + @classmethod + def poll(cls, context): + return hasattr(context, "keymap") + + def execute(self, context): + km = context.keymap + kmi = km.keymap_items.from_id(self.item_id) + km.keymap_items.remove(kmi) + return {'FINISHED'} + + +class WM_OT_keyconfig_remove(Operator): + "Remove key config" + bl_idname = "wm.keyconfig_remove" + bl_label = "Remove Key Config" + + @classmethod + def poll(cls, context): + wm = context.window_manager + keyconf = wm.keyconfigs.active + return keyconf and keyconf.is_user_defined + + def execute(self, context): + wm = context.window_manager + keyconfig = wm.keyconfigs.active + wm.keyconfigs.remove(keyconfig) + return {'FINISHED'} + + +class WM_OT_operator_cheat_sheet(Operator): + bl_idname = "wm.operator_cheat_sheet" + bl_label = "Operator Cheat Sheet" + + def execute(self, context): + op_strings = [] + tot = 0 + for op_module_name in dir(bpy.ops): + op_module = getattr(bpy.ops, op_module_name) + for op_submodule_name in dir(op_module): + op = getattr(op_module, op_submodule_name) + text = repr(op) + if text.split("\n")[-1].startswith('bpy.ops.'): + op_strings.append(text) + tot += 1 + + op_strings.append('') + + textblock = bpy.data.texts.new("OperatorList.txt") + textblock.write('# %d Operators\n\n' % tot) + textblock.write('\n'.join(op_strings)) + self.report({'INFO'}, "See OperatorList.txt textblock") + return {'FINISHED'} + + +class WM_OT_addon_enable(Operator): + "Enable an addon" + bl_idname = "wm.addon_enable" + bl_label = "Enable Add-On" + + module = StringProperty( + name="Module", + description="Module name of the addon to enable", + ) + + def execute(self, context): + mod = addon_utils.enable(self.module) + + if mod: + info = addon_utils.module_bl_info(mod) + + info_ver = info.get("blender", (0, 0, 0)) + + if info_ver > bpy.app.version: + self.report({'WARNING'}, ("This script was written Blender " + "version %d.%d.%d and might not " + "function (correctly), " + "though it is enabled") % + info_ver) + return {'FINISHED'} + else: + return {'CANCELLED'} + + +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", + ) + + def execute(self, context): + addon_utils.disable(self.module) + return {'FINISHED'} + + +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, + ) + target = EnumProperty( + name="Target Path", + items=(('DEFAULT', "Default", ""), + ('PREFS', "User Prefs", "")), + ) + + 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): + module = os.path.splitext(module)[0] + for f in os.listdir(path_addons): + f_base = os.path.splitext(f)[0] + if f_base == module: + f_full = os.path.join(path_addons, f) + + if os.path.isdir(f_full): + os.rmdir(f_full) + else: + os.remove(f_full) + + def execute(self, context): + import traceback + import zipfile + import shutil + + pyfile = self.filepath + + if self.target == 'DEFAULT': + # dont use bpy.utils.script_paths("addons") because we may not be able to write to it. + path_addons = bpy.utils.user_resource('SCRIPTS', "addons", create=True) + else: + path_addons = bpy.context.user_preferences.filepaths.script_directory + if path_addons: + path_addons = os.path.join(path_addons, "addons") + + if not path_addons: + self.report({'ERROR'}, "Failed to get addons path") + return {'CANCELLED'} + + # create dir is if missing. + if not os.path.exists(path_addons): + os.makedirs(path_addons) + + # Check if we are installing from a target path, + # doing so causes 2+ addons of same name or when the same from/to + # location is used, removal of the file! + addon_path = "" + pyfile_dir = os.path.dirname(pyfile) + for addon_path in addon_utils.paths(): + if os.path.samefile(pyfile_dir, addon_path): + self.report({'ERROR'}, "Source file is in the addon search path: %r" % addon_path) + return {'CANCELLED'} + del addon_path + del pyfile_dir + # done checking for exceptional case + + addons_old = {mod.__name__ for mod in addon_utils.modules(USERPREF_PT_addons._addons_fake_modules)} + + #check to see if the file is in compressed format (.zip) + if zipfile.is_zipfile(pyfile): + try: + file_to_extract = zipfile.ZipFile(pyfile, 'r') + except: + traceback.print_exc() + return {'CANCELLED'} + + if self.overwrite: + for f in file_to_extract.namelist(): + WM_OT_addon_install._module_remove(path_addons, f) + else: + for f in file_to_extract.namelist(): + path_dest = os.path.join(path_addons, os.path.basename(f)) + if os.path.exists(path_dest): + self.report({'WARNING'}, "File already installed to %r\n" % path_dest) + return {'CANCELLED'} + + try: # extract the file to "addons" + file_to_extract.extractall(path_addons) + + # zip files can create this dir with metadata, don't need it + macosx_dir = os.path.join(path_addons, '__MACOSX') + if os.path.isdir(macosx_dir): + shutil.rmtree(macosx_dir) + + except: + traceback.print_exc() + return {'CANCELLED'} + + else: + path_dest = os.path.join(path_addons, os.path.basename(pyfile)) + + if self.overwrite: + WM_OT_addon_install._module_remove(path_addons, os.path.basename(pyfile)) + elif os.path.exists(path_dest): + self.report({'WARNING'}, "File already installed to %r\n" % path_dest) + return {'CANCELLED'} + + #if not compressed file just copy into the addon path + try: + shutil.copyfile(pyfile, path_dest) + + except: + traceback.print_exc() + return {'CANCELLED'} + + addons_new = {mod.__name__ for mod in addon_utils.modules(USERPREF_PT_addons._addons_fake_modules)} - addons_old + addons_new.discard("modules") + + # disable any addons we may have enabled previously and removed. + # this is unlikely but do just incase. bug [#23978] + for new_addon in addons_new: + addon_utils.disable(new_addon) + + # possible the zip contains multiple addons, we could disallow this + # but for now just use the first + for mod in addon_utils.modules(USERPREF_PT_addons._addons_fake_modules): + if mod.__name__ in addons_new: + info = addon_utils.module_bl_info(mod) + + # show the newly installed addon. + context.window_manager.addon_filter = 'All' + context.window_manager.addon_search = info["name"] + break + + # incase a new module path was created to install this addon. + bpy.utils.refresh_script_paths() + + # TODO, should not be a warning. + # self.report({'WARNING'}, "File installed to '%s'\n" % path_dest) + return {'FINISHED'} + + def invoke(self, context, event): + wm = context.window_manager + wm.fileselect_add(self) + return {'RUNNING_MODAL'} + + +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", + ) + + @staticmethod + def path_from_addon(module): + for mod in addon_utils.modules(USERPREF_PT_addons._addons_fake_modules): + if mod.__name__ == module: + filepath = mod.__file__ + if os.path.exists(filepath): + if os.path.splitext(os.path.basename(filepath))[0] == "__init__": + return os.path.dirname(filepath), True + else: + return filepath, False + return None, False + + def execute(self, context): + path, isdir = WM_OT_addon_remove.path_from_addon(self.module) + if path is None: + self.report('WARNING', "Addon path %r could not be found" % path) + return {'CANCELLED'} + + # incase its enabled + addon_utils.disable(self.module) + + import shutil + if isdir: + shutil.rmtree(path) + else: + os.remove(path) + + context.area.tag_redraw() + return {'FINISHED'} + + # lame confirmation check + def draw(self, context): + self.layout.label(text="Remove Addon: %r?" % self.module) + path, isdir = WM_OT_addon_remove.path_from_addon(self.module) + self.layout.label(text="Path: %r" % path) + + def invoke(self, context, event): + wm = context.window_manager + return wm.invoke_props_dialog(self, width=600) + + +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", + ) + + def execute(self, context): + module_name = self.module + + # unlikely to fail, module should have already been imported + try: + # mod = __import__(module_name) + mod = USERPREF_PT_addons.module_get(module_name) + except: + import traceback + traceback.print_exc() + return {'CANCELLED'} + + info = addon_utils.module_bl_info(mod) + info["show_expanded"] = not info["show_expanded"] + return {'FINISHED'} diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py index d2f6329bf40..815f0a77570 100644 --- a/release/scripts/startup/bl_ui/properties_render.py +++ b/release/scripts/startup/bl_ui/properties_render.py @@ -225,7 +225,7 @@ class RENDER_PT_dimensions(RenderButtonsPanel, Panel): custom_framerate = (fps_rate not in {23.98, 24, 25, 29.97, 30, 50, 59.94, 60}) if custom_framerate == True: - fps_label_text = _("Custom (") + str(fps_rate) + " fps)" + fps_label_text = "Custom (" + str(fps_rate) + " fps)" else: fps_label_text = str(fps_rate) + " fps" diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py index 5a25e608a39..167cead9a3b 100644 --- a/release/scripts/startup/bl_ui/properties_scene.py +++ b/release/scripts/startup/bl_ui/properties_scene.py @@ -18,7 +18,7 @@ # <pep8 compliant> import bpy -from bpy.types import Operator, Panel +from bpy.types import Panel from rna_prop_ui import PropertyPanel @@ -224,112 +224,5 @@ class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, Panel): _context_path = "scene" _property_type = bpy.types.Scene -# XXX, move operator to op/ dir - - -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..." - - filepath = bpy.props.StringProperty(name="File Path", description="Filepath to write file to") - filter_folder = bpy.props.BoolProperty(name="Filter folders", description="", default=True, options={'HIDDEN'}) - filter_text = bpy.props.BoolProperty(name="Filter text", description="", default=True, options={'HIDDEN'}) - filter_python = bpy.props.BoolProperty(name="Filter python", description="", default=True, options={'HIDDEN'}) - - def execute(self, context): - if not self.filepath: - raise Exception("Filepath not set") - - f = open(self.filepath, "w") - if not f: - raise Exception("Could not open file") - - scene = context.scene - ks = scene.keying_sets.active - - f.write("# Keying Set: %s\n" % ks.name) - - f.write("import bpy\n\n") - f.write("scene= bpy.data.scenes[0]\n\n") # XXX, why not use the current scene? - - # Add KeyingSet and set general settings - f.write("# Keying Set Level declarations\n") - f.write("ks= scene.keying_sets.new(name=\"%s\")\n" % ks.name) - - if not ks.is_path_absolute: - f.write("ks.is_path_absolute = False\n") - f.write("\n") - - f.write("ks.bl_options = %r\n" % ks.bl_options) - f.write("\n") - - # generate and write set of lookups for id's used in paths - id_to_paths_cache = {} # cache for syncing ID-blocks to bpy paths + shorthands - - for ksp in ks.paths: - if ksp.id is None: - continue - if ksp.id in id_to_paths_cache: - continue - - # - idtype_list is used to get the list of id-datablocks from bpy.data.* - # since this info isn't available elsewhere - # - id.bl_rna.name gives a name suitable for UI, - # with a capitalised first letter, but we need - # the plural form that's all lower case - idtype_list = ksp.id.bl_rna.name.lower() + "s" - id_bpy_path = "bpy.data.%s[\"%s\"]" % (idtype_list, ksp.id.name) - - # shorthand ID for the ID-block (as used in the script) - short_id = "id_%d" % len(id_to_paths_cache) - - # store this in the cache now - id_to_paths_cache[ksp.id] = [short_id, id_bpy_path] - - f.write("# ID's that are commonly used\n") - for id_pair in id_to_paths_cache.values(): - f.write("%s = %s\n" % (id_pair[0], id_pair[1])) - f.write("\n") - - # write paths - f.write("# Path Definitions\n") - for ksp in ks.paths: - f.write("ksp = ks.paths.add(") - - # id-block + data_path - if ksp.id: - # find the relevant shorthand from the cache - id_bpy_path = id_to_paths_cache[ksp.id][0] - else: - id_bpy_path = "None" # XXX... - f.write("%s, '%s'" % (id_bpy_path, ksp.data_path)) - - # array index settings (if applicable) - if ksp.use_entire_array: - f.write(", index=-1") - else: - f.write(", index=%d" % ksp.array_index) - - # grouping settings (if applicable) - # NOTE: the current default is KEYINGSET, but if this changes, change this code too - if ksp.group_method == 'NAMED': - f.write(", group_method='%s', group_name=\"%s\"" % (ksp.group_method, ksp.group)) - elif ksp.group_method != 'KEYINGSET': - f.write(", group_method='%s'" % ksp.group_method) - - # finish off - f.write(")\n") - - f.write("\n") - f.close() - - return {'FINISHED'} - - def invoke(self, context, event): - wm = context.window_manager - wm.fileselect_add(self) - return {'RUNNING_MODAL'} - if __name__ == "__main__": # only for live edit. bpy.utils.register_module(__name__) diff --git a/release/scripts/startup/bl_ui/space_console.py b/release/scripts/startup/bl_ui/space_console.py index cbbefa01a3c..a1818c395a2 100644 --- a/release/scripts/startup/bl_ui/space_console.py +++ b/release/scripts/startup/bl_ui/space_console.py @@ -18,8 +18,7 @@ # <pep8 compliant> import bpy -from bpy.types import Header, Menu, Operator -from bpy.props import StringProperty +from bpy.types import Header, Menu class CONSOLE_HT_header(Header): @@ -79,87 +78,5 @@ def add_scrollback(text, text_type): bpy.ops.console.scrollback_append(text=l.replace('\t', ' '), type=text_type) - -class ConsoleExec(Operator): - '''Execute the current console line as a python expression''' - bl_idname = "console.execute" - bl_label = "Console Execute" - - def execute(self, context): - sc = context.space_data - - module = __import__("console_" + sc.language) - execute = getattr(module, "execute", None) - - if execute: - return execute(context) - else: - print("Error: bpy.ops.console.execute_" + sc.language + " - not found") - return {'FINISHED'} - - -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" - - def execute(self, context): - sc = context.space_data - module = __import__("console_" + sc.language) - autocomplete = getattr(module, "autocomplete", None) - - if autocomplete: - return autocomplete(context) - else: - print("Error: bpy.ops.console.autocomplete_" + sc.language + " - not found") - return {'FINISHED'} - - -class ConsoleBanner(Operator): - '''Print a message whem the terminal initializes''' - bl_idname = "console.banner" - bl_label = "Console Banner" - - def execute(self, context): - sc = context.space_data - - # default to python - if not sc.language: - sc.language = 'python' - - module = __import__("console_" + sc.language) - banner = getattr(module, "banner", None) - - if banner: - return banner(context) - else: - print("Error: bpy.ops.console.banner_" + sc.language + " - not found") - return {'FINISHED'} - - -class ConsoleLanguage(Operator): - '''Set the current language for this console''' - bl_idname = "console.language" - bl_label = "Console Language" - - language = StringProperty( - name="Language", - maxlen=32, - ) - - def execute(self, context): - sc = context.space_data - - # defailt to python - sc.language = self.language - - bpy.ops.console.banner() - - # insert a new blank line - bpy.ops.console.history_append(text="", current_character=0, - remove_duplicates=True) - - return {'FINISHED'} - if __name__ == "__main__": # only for live edit. bpy.utils.register_module(__name__) diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py index 1ea8c1306e7..946104e5264 100644 --- a/release/scripts/startup/bl_ui/space_info.py +++ b/release/scripts/startup/bl_ui/space_info.py @@ -18,7 +18,7 @@ # <pep8 compliant> import bpy -from bpy.types import Header, Menu, Operator +from bpy.types import Header, Menu class INFO_HT_header(Header): @@ -375,7 +375,7 @@ class INFO_MT_help(Menu): layout.separator() layout.operator("wm.url_open", text="Python API Reference", icon='URL').url = bpy.types.WM_OT_doc_view._prefix - layout.operator("help.operator_cheat_sheet", icon='TEXT') + layout.operator("wm.operator_cheat_sheet", icon='TEXT') layout.operator("wm.sysinfo", icon='TEXT') layout.separator() if sys.platform[:3] == "win": @@ -386,33 +386,5 @@ class INFO_MT_help(Menu): layout.separator() layout.operator("wm.splash", icon='BLENDER') - -# Help operators - - -class HELP_OT_operator_cheat_sheet(Operator): - bl_idname = "help.operator_cheat_sheet" - bl_label = "Operator Cheat Sheet" - - def execute(self, context): - op_strings = [] - tot = 0 - for op_module_name in dir(bpy.ops): - op_module = getattr(bpy.ops, op_module_name) - for op_submodule_name in dir(op_module): - op = getattr(op_module, op_submodule_name) - text = repr(op) - if text.split("\n")[-1].startswith('bpy.ops.'): - op_strings.append(text) - tot += 1 - - op_strings.append('') - - textblock = bpy.data.texts.new("OperatorList.txt") - textblock.write('# %d Operators\n\n' % tot) - textblock.write('\n'.join(op_strings)) - self.report({'INFO'}, "See OperatorList.txt textblock") - return {'FINISHED'} - if __name__ == "__main__": # only for live edit. bpy.utils.register_module(__name__) diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 9573f6b0f5c..9e55c8ad815 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -18,7 +18,7 @@ # <pep8 compliant> import bpy -from bpy.types import Header, Menu, Operator, Panel +from bpy.types import Header, Menu, Panel import os import addon_utils @@ -1074,292 +1074,5 @@ class USERPREF_PT_addons(Panel): if is_enabled: row.operator("wm.addon_disable", icon='CHECKBOX_HLT', text="", emboss=False).module = module_name - -class WM_OT_addon_enable(Operator): - "Enable an addon" - bl_idname = "wm.addon_enable" - bl_label = "Enable Add-On" - - module = StringProperty( - name="Module", - description="Module name of the addon to enable", - ) - - def execute(self, context): - mod = addon_utils.enable(self.module) - - if mod: - info = addon_utils.module_bl_info(mod) - - info_ver = info.get("blender", (0, 0, 0)) - - if info_ver > bpy.app.version: - self.report({'WARNING'}, ("This script was written Blender " - "version %d.%d.%d and might not " - "function (correctly), " - "though it is enabled") % - info_ver) - return {'FINISHED'} - else: - return {'CANCELLED'} - - -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", - ) - - def execute(self, context): - addon_utils.disable(self.module) - return {'FINISHED'} - - -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, - ) - target = EnumProperty( - name="Target Path", - items=(('DEFAULT', "Default", ""), - ('PREFS', "User Prefs", "")), - ) - - 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): - module = os.path.splitext(module)[0] - for f in os.listdir(path_addons): - f_base = os.path.splitext(f)[0] - if f_base == module: - f_full = os.path.join(path_addons, f) - - if os.path.isdir(f_full): - os.rmdir(f_full) - else: - os.remove(f_full) - - def execute(self, context): - import traceback - import zipfile - import shutil - - pyfile = self.filepath - - if self.target == 'DEFAULT': - # dont use bpy.utils.script_paths("addons") because we may not be able to write to it. - path_addons = bpy.utils.user_resource('SCRIPTS', "addons", create=True) - else: - path_addons = bpy.context.user_preferences.filepaths.script_directory - if path_addons: - path_addons = os.path.join(path_addons, "addons") - - if not path_addons: - self.report({'ERROR'}, "Failed to get addons path") - return {'CANCELLED'} - - # create dir is if missing. - if not os.path.exists(path_addons): - os.makedirs(path_addons) - - # Check if we are installing from a target path, - # doing so causes 2+ addons of same name or when the same from/to - # location is used, removal of the file! - addon_path = "" - pyfile_dir = os.path.dirname(pyfile) - for addon_path in addon_utils.paths(): - if os.path.samefile(pyfile_dir, addon_path): - self.report({'ERROR'}, "Source file is in the addon search path: %r" % addon_path) - return {'CANCELLED'} - del addon_path - del pyfile_dir - # done checking for exceptional case - - addons_old = {mod.__name__ for mod in addon_utils.modules(USERPREF_PT_addons._addons_fake_modules)} - - #check to see if the file is in compressed format (.zip) - if zipfile.is_zipfile(pyfile): - try: - file_to_extract = zipfile.ZipFile(pyfile, 'r') - except: - traceback.print_exc() - return {'CANCELLED'} - - if self.overwrite: - for f in file_to_extract.namelist(): - WM_OT_addon_install._module_remove(path_addons, f) - else: - for f in file_to_extract.namelist(): - path_dest = os.path.join(path_addons, os.path.basename(f)) - if os.path.exists(path_dest): - self.report({'WARNING'}, "File already installed to %r\n" % path_dest) - return {'CANCELLED'} - - try: # extract the file to "addons" - file_to_extract.extractall(path_addons) - - # zip files can create this dir with metadata, don't need it - macosx_dir = os.path.join(path_addons, '__MACOSX') - if os.path.isdir(macosx_dir): - shutil.rmtree(macosx_dir) - - except: - traceback.print_exc() - return {'CANCELLED'} - - else: - path_dest = os.path.join(path_addons, os.path.basename(pyfile)) - - if self.overwrite: - WM_OT_addon_install._module_remove(path_addons, os.path.basename(pyfile)) - elif os.path.exists(path_dest): - self.report({'WARNING'}, "File already installed to %r\n" % path_dest) - return {'CANCELLED'} - - #if not compressed file just copy into the addon path - try: - shutil.copyfile(pyfile, path_dest) - - except: - traceback.print_exc() - return {'CANCELLED'} - - addons_new = {mod.__name__ for mod in addon_utils.modules(USERPREF_PT_addons._addons_fake_modules)} - addons_old - addons_new.discard("modules") - - # disable any addons we may have enabled previously and removed. - # this is unlikely but do just incase. bug [#23978] - for new_addon in addons_new: - addon_utils.disable(new_addon) - - # possible the zip contains multiple addons, we could disallow this - # but for now just use the first - for mod in addon_utils.modules(USERPREF_PT_addons._addons_fake_modules): - if mod.__name__ in addons_new: - info = addon_utils.module_bl_info(mod) - - # show the newly installed addon. - context.window_manager.addon_filter = 'All' - context.window_manager.addon_search = info["name"] - break - - # incase a new module path was created to install this addon. - bpy.utils.refresh_script_paths() - - # TODO, should not be a warning. - # self.report({'WARNING'}, "File installed to '%s'\n" % path_dest) - return {'FINISHED'} - - def invoke(self, context, event): - wm = context.window_manager - wm.fileselect_add(self) - return {'RUNNING_MODAL'} - - -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", - ) - - @staticmethod - def path_from_addon(module): - for mod in addon_utils.modules(USERPREF_PT_addons._addons_fake_modules): - if mod.__name__ == module: - filepath = mod.__file__ - if os.path.exists(filepath): - if os.path.splitext(os.path.basename(filepath))[0] == "__init__": - return os.path.dirname(filepath), True - else: - return filepath, False - return None, False - - def execute(self, context): - path, isdir = WM_OT_addon_remove.path_from_addon(self.module) - if path is None: - self.report('WARNING', "Addon path %r could not be found" % path) - return {'CANCELLED'} - - # incase its enabled - addon_utils.disable(self.module) - - import shutil - if isdir: - shutil.rmtree(path) - else: - os.remove(path) - - context.area.tag_redraw() - return {'FINISHED'} - - # lame confirmation check - def draw(self, context): - self.layout.label(text="Remove Addon: %r?" % self.module) - path, isdir = WM_OT_addon_remove.path_from_addon(self.module) - self.layout.label(text="Path: %r" % path) - - def invoke(self, context, event): - wm = context.window_manager - return wm.invoke_props_dialog(self, width=600) - - -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", - ) - - def execute(self, context): - module_name = self.module - - # unlikely to fail, module should have already been imported - try: - # mod = __import__(module_name) - mod = USERPREF_PT_addons.module_get(module_name) - except: - import traceback - traceback.print_exc() - return {'CANCELLED'} - - info = addon_utils.module_bl_info(mod) - info["show_expanded"] = not info["show_expanded"] - return {'FINISHED'} - if __name__ == "__main__": # only for live edit. bpy.utils.register_module(__name__) diff --git a/release/scripts/startup/bl_ui/space_userpref_keymap.py b/release/scripts/startup/bl_ui/space_userpref_keymap.py index e6b1866baf5..dcf9a7d2d7f 100644 --- a/release/scripts/startup/bl_ui/space_userpref_keymap.py +++ b/release/scripts/startup/bl_ui/space_userpref_keymap.py @@ -18,7 +18,7 @@ # <pep8 compliant> import bpy -from bpy.types import Menu, Operator, OperatorProperties +from bpy.types import Menu, OperatorProperties import os @@ -401,9 +401,6 @@ class InputKeyMapPanel: self.draw_hierarchy(display_keymaps, col) -from bpy.props import StringProperty, BoolProperty, IntProperty - - def export_properties(prefix, properties, lines=None): if lines is None: lines = [] @@ -419,397 +416,5 @@ def export_properties(prefix, properties, lines=None): lines.append("%s.%s = %s\n" % (prefix, pname, value)) return lines - -class WM_OT_keyconfig_test(Operator): - "Test keyconfig for conflicts" - bl_idname = "wm.keyconfig_test" - bl_label = "Test Key Configuration for Conflicts" - - def testEntry(self, kc, entry, src=None, parent=None): - result = False - - def kmistr(kmi): - if km.is_modal: - s = ["kmi = km.keymap_items.new_modal(\'%s\', \'%s\', \'%s\'" % (kmi.propvalue, kmi.type, kmi.value)] - else: - s = ["kmi = km.keymap_items.new(\'%s\', \'%s\', \'%s\'" % (kmi.idname, kmi.type, kmi.value)] - - if kmi.any: - s.append(", any=True") - else: - if kmi.shift: - s.append(", shift=True") - if kmi.ctrl: - s.append(", ctrl=True") - if kmi.alt: - s.append(", alt=True") - if kmi.oskey: - s.append(", oskey=True") - if kmi.key_modifier and kmi.key_modifier != 'NONE': - s.append(", key_modifier=\'%s\'" % kmi.key_modifier) - - s.append(")\n") - - props = kmi.properties - - if props is not None: - export_properties("kmi.properties", props, s) - - return "".join(s).strip() - - idname, spaceid, regionid, children = entry - - km = kc.keymaps.find(idname, space_type=spaceid, region_type=regionid) - - if km: - km = km.active() - - if src: - for item in km.keymap_items: - if src.compare(item): - print("===========") - print(parent.name) - print(kmistr(src)) - print(km.name) - print(kmistr(item)) - result = True - - for child in children: - if self.testEntry(kc, child, src, parent): - result = True - else: - for i in range(len(km.keymap_items)): - src = km.keymap_items[i] - - for child in children: - if self.testEntry(kc, child, src, km): - result = True - - for j in range(len(km.keymap_items) - i - 1): - item = km.keymap_items[j + i + 1] - if src.compare(item): - print("===========") - print(km.name) - print(kmistr(src)) - print(kmistr(item)) - result = True - - for child in children: - if self.testEntry(kc, child): - result = True - - return result - - def testConfig(self, kc): - result = False - for entry in KM_HIERARCHY: - if self.testEntry(kc, entry): - result = True - return result - - def execute(self, context): - wm = context.window_manager - kc = wm.keyconfigs.default - - if self.testConfig(kc): - print("CONFLICT") - - return {'FINISHED'} - - -def _string_value(value): - if isinstance(value, str) or isinstance(value, bool) or isinstance(value, float) or isinstance(value, int): - result = repr(value) - elif getattr(value, '__len__', False): - return repr(list(value)) - else: - print("Export key configuration: can't write ", value) - - return result - - -class WM_OT_keyconfig_import(Operator): - "Import key configuration from a python script" - bl_idname = "wm.keyconfig_import" - bl_label = "Import Key Configuration..." - - 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 - import shutil - - if not self.filepath: - self.report({'ERROR'}, "Filepath not set") - return {'CANCELLED'} - - config_name = basename(self.filepath) - - path = bpy.utils.user_resource('SCRIPTS', os.path.join("presets", "keyconfig"), create=True) - path = os.path.join(path, config_name) - - try: - if self.keep_original: - shutil.copy(self.filepath, path) - else: - shutil.move(self.filepath, path) - except Exception as e: - self.report({'ERROR'}, "Installing keymap failed: %s" % e) - return {'CANCELLED'} - - # sneaky way to check we're actually running the code. - bpy.utils.keyconfig_set(path) - - return {'FINISHED'} - - def invoke(self, context, event): - wm = context.window_manager - wm.fileselect_add(self) - return {'RUNNING_MODAL'} - -# This operator is also used by interaction presets saving - AddPresetBase - - -class WM_OT_keyconfig_export(Operator): - "Export key configuration to a python script" - bl_idname = "wm.keyconfig_export" - bl_label = "Export Key Configuration..." - - 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: - raise Exception("Filepath not set") - - if not self.filepath.endswith('.py'): - self.filepath += '.py' - - f = open(self.filepath, "w") - if not f: - raise Exception("Could not open file") - - wm = context.window_manager - kc = wm.keyconfigs.active - - f.write("import bpy\n") - f.write("import os\n\n") - f.write("wm = bpy.context.window_manager\n") - f.write("kc = wm.keyconfigs.new(os.path.splitext(os.path.basename(__file__))[0])\n\n") # keymap must be created by caller - - # Generate a list of keymaps to export: - # - # First add all user_modified keymaps (found in keyconfigs.user.keymaps list), - # then add all remaining keymaps from the currently active custom keyconfig. - # - # This will create a final list of keymaps that can be used as a 'diff' against - # the default blender keyconfig, recreating the current setup from a fresh blender - # without needing to export keymaps which haven't been edited. - - class FakeKeyConfig(): - keymaps = [] - edited_kc = FakeKeyConfig() - for km in wm.keyconfigs.user.keymaps: - if km.is_user_modified: - edited_kc.keymaps.append(km) - # merge edited keymaps with non-default keyconfig, if it exists - if kc != wm.keyconfigs.default: - export_keymaps = _merge_keymaps(edited_kc, kc) - else: - export_keymaps = _merge_keymaps(edited_kc, edited_kc) - - for km, kc_x in export_keymaps: - - km = km.active() - - f.write("# Map %s\n" % km.name) - f.write("km = kc.keymaps.new('%s', space_type='%s', region_type='%s', modal=%s)\n\n" % (km.name, km.space_type, km.region_type, km.is_modal)) - for kmi in km.keymap_items: - if km.is_modal: - f.write("kmi = km.keymap_items.new_modal('%s', '%s', '%s'" % (kmi.propvalue, kmi.type, kmi.value)) - else: - f.write("kmi = km.keymap_items.new('%s', '%s', '%s'" % (kmi.idname, kmi.type, kmi.value)) - if kmi.any: - f.write(", any=True") - else: - if kmi.shift: - f.write(", shift=True") - if kmi.ctrl: - f.write(", ctrl=True") - if kmi.alt: - f.write(", alt=True") - if kmi.oskey: - f.write(", oskey=True") - if kmi.key_modifier and kmi.key_modifier != 'NONE': - f.write(", key_modifier='%s'" % kmi.key_modifier) - f.write(")\n") - - props = kmi.properties - - if props is not None: - f.write("".join(export_properties("kmi.properties", props))) - - f.write("\n") - - f.close() - - return {'FINISHED'} - - def invoke(self, context, event): - wm = context.window_manager - wm.fileselect_add(self) - return {'RUNNING_MODAL'} - - -class WM_OT_keymap_restore(Operator): - "Restore key map(s)" - bl_idname = "wm.keymap_restore" - bl_label = "Restore Key Map(s)" - - all = BoolProperty( - name="All Keymaps", - description="Restore all keymaps to default", - ) - - def execute(self, context): - wm = context.window_manager - - if self.all: - for km in wm.keyconfigs.user.keymaps: - km.restore_to_default() - else: - km = context.keymap - km.restore_to_default() - - return {'FINISHED'} - - -class WM_OT_keyitem_restore(Operator): - "Restore key map item" - bl_idname = "wm.keyitem_restore" - bl_label = "Restore Key Map Item" - - item_id = IntProperty( - name="Item Identifier", - description="Identifier of the item to remove", - ) - - @classmethod - def poll(cls, context): - keymap = getattr(context, "keymap", None) - return keymap - - def execute(self, context): - km = context.keymap - kmi = km.keymap_items.from_id(self.item_id) - - if (not kmi.is_user_defined) and kmi.is_user_modified: - km.restore_item_to_default(kmi) - - return {'FINISHED'} - - -class WM_OT_keyitem_add(Operator): - "Add key map item" - bl_idname = "wm.keyitem_add" - bl_label = "Add Key Map Item" - - def execute(self, context): - km = context.keymap - - if km.is_modal: - km.keymap_items.new_modal("", 'A', 'PRESS') # kmi - else: - km.keymap_items.new("none", 'A', 'PRESS') # kmi - - # clear filter and expand keymap so we can see the newly added item - if context.space_data.filter_text != "": - context.space_data.filter_text = "" - km.show_expanded_items = True - km.show_expanded_children = True - - return {'FINISHED'} - - -class WM_OT_keyitem_remove(Operator): - "Remove key map item" - bl_idname = "wm.keyitem_remove" - bl_label = "Remove Key Map Item" - - item_id = IntProperty( - name="Item Identifier", - description="Identifier of the item to remove", - ) - - @classmethod - def poll(cls, context): - return hasattr(context, "keymap") - - def execute(self, context): - km = context.keymap - kmi = km.keymap_items.from_id(self.item_id) - km.keymap_items.remove(kmi) - return {'FINISHED'} - - -class WM_OT_keyconfig_remove(Operator): - "Remove key config" - bl_idname = "wm.keyconfig_remove" - bl_label = "Remove Key Config" - - @classmethod - def poll(cls, context): - wm = context.window_manager - keyconf = wm.keyconfigs.active - return keyconf and keyconf.is_user_defined - - def execute(self, context): - wm = context.window_manager - keyconfig = wm.keyconfigs.active - wm.keyconfigs.remove(keyconfig) - return {'FINISHED'} - if __name__ == "__main__": # only for live edit. bpy.utils.register_module(__name__) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 9eab09b8514..3656aaa9313 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -18,7 +18,7 @@ # <pep8 compliant> import bpy -from bpy.types import Header, Menu, Operator, Panel +from bpy.types import Header, Menu, Panel class VIEW3D_HT_header(Header): @@ -1552,61 +1552,6 @@ class VIEW3D_MT_edit_mesh_extrude(Menu): self._extrude_funcs[menu_id](layout) -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" - - def execute(self, context): - mesh = context.object.data - select_mode = context.tool_settings.mesh_select_mode - - totface = mesh.total_face_sel - totedge = mesh.total_edge_sel - # totvert = mesh.total_vert_sel - - if select_mode[2] and totface == 1: - bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)}) - elif select_mode[2] and totface > 1: - bpy.ops.mesh.extrude_faces_move('INVOKE_REGION_WIN') - elif select_mode[1] and totedge >= 1: - bpy.ops.mesh.extrude_edges_move('INVOKE_REGION_WIN') - else: - bpy.ops.mesh.extrude_vertices_move('INVOKE_REGION_WIN') - - # ignore return from operators above because they are 'RUNNING_MODAL', and cause this one not to be freed. [#24671] - return {'FINISHED'} - - def invoke(self, context, event): - return self.execute(context) - - -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" - - def execute(self, context): - mesh = context.object.data - - totface = mesh.total_face_sel - totedge = mesh.total_edge_sel - # totvert = mesh.total_vert_sel - - if totface >= 1: - bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)}) - elif totedge == 1: - bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (True, True, False)}) - else: - bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN') - - # ignore return from operators above because they are 'RUNNING_MODAL', and cause this one not to be freed. [#24671] - return {'FINISHED'} - - def invoke(self, context, event): - return self.execute(context) - - class VIEW3D_MT_edit_mesh_vertices(Menu): bl_label = "Vertices" diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index 26af3a3fd4f..851c6542de0 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -529,6 +529,9 @@ FontBLF *blf_font_new(const char *name, const char *filename) mfile= blf_dir_metrics_search(filename); if (mfile) { err= FT_Attach_File(font->face, mfile); + if(err) { + fprintf(stderr, "FT_Attach_File failed to load '%s' with error %d\n", filename, (int)err); + } MEM_freeN(mfile); } diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 286e40faf71..22278fe29ba 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -318,6 +318,8 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath set_scene_bg(G.main, CTX_data_scene(C)); MEM_freeN(bfd); + + (void)curscene; /* quiet warning */ } static int handle_subversion_warning(Main *main, ReportList *reports) diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 12841d15938..0f29c24145d 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -1014,9 +1014,13 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us if(!flush && compareDrawOptions) { int next_orig= (index==NULL) ? next_actualFace : index[next_actualFace]; - /* also compare draw options and flush buffer if they're different - need for face selection highlight in edit mode */ - flush|= compareDrawOptions(userData, orig, next_orig) == 0; + if(orig==ORIGINDEX_NONE || next_orig==ORIGINDEX_NONE) { + flush= 1; + } else { + /* also compare draw options and flush buffer if they're different + need for face selection highlight in edit mode */ + flush|= compareDrawOptions(userData, orig, next_orig) == 0; + } } if(flush) { diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index dd3a279a5ee..7d0525dc903 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -853,7 +853,7 @@ static void do_key(const int start, int end, const int tot, char *poin, Key *key int a, ofs[32], *ofsp; int flagdo= 15, flagflo=0, elemsize, poinsize=0; char *k1, *k2, *k3, *k4, *freek1, *freek2, *freek3, *freek4; - char *cp, elemstr[8];; + char *cp, elemstr[8]; /* currently always 0, in future key_pointer_size may assign */ ofs[1]= 0; diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index b67969f9b38..5df07246b73 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -1574,7 +1574,7 @@ static void multires_load_old_dm(DerivedMesh *dm, Mesh *me, int totlvl) } /* Interior face verts */ - lvl = lvl1->next->next; + /* lvl = lvl1->next->next; */ /* UNUSED */ dst = 0; for(j = 0; j < lvl1->totface; ++j) { int sides = lvl1->faces[j].v[3] ? 4 : 3; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index fe91a7626ad..fcb05bf2eef 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3021,6 +3021,9 @@ static void direct_link_texture(FileData *fd, Tex *tex) if(tex->vd) { tex->vd->dataset = NULL; tex->vd->ok = 0; + } else { + if(tex->type == TEX_VOXELDATA) + tex->vd= MEM_callocN(sizeof(VoxelData), "direct_link_texture VoxelData"); } tex->nodetree= newdataadr(fd, tex->nodetree); diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 2b0e4ddf024..992bf05679b 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1789,7 +1789,7 @@ static void write_textures(WriteData *wd, ListBase *idbase) if(tex->pd->coba) writestruct(wd, DATA, "ColorBand", 1, tex->pd->coba); if(tex->pd->falloff_curve) write_curvemapping(wd, tex->pd->falloff_curve); } - if(tex->type == TEX_VOXELDATA && tex->vd) writestruct(wd, DATA, "VoxelData", 1, tex->vd); + if(tex->type == TEX_VOXELDATA) writestruct(wd, DATA, "VoxelData", 1, tex->vd); /* nodetree is integral part of texture, no libdata */ if(tex->nodetree) { diff --git a/source/blender/bmesh/operators/extrudeops.c b/source/blender/bmesh/operators/extrudeops.c index 31467c893eb..805935a3100 100644 --- a/source/blender/bmesh/operators/extrudeops.c +++ b/source/blender/bmesh/operators/extrudeops.c @@ -452,7 +452,7 @@ static void solidify_add_thickness(BMesh *bm, float dist) BLI_array_growone(angles); } - angle_poly_v3(angles, verts, f->len); + angle_poly_v3(angles, (const float **)verts, f->len); i = 0; BM_ITER(l, &loopIter, bm, BM_LOOPS_OF_FACE, f) { diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 2387c9a1465..e98f551a097 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -816,7 +816,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera ) double aspect = camera->getAspectRatio().getValue(); double xfov = aspect*yfov; // xfov is in degrees, cam->lens is in millimiters - cam->lens = angle_to_lens(DEG2RADF(xfov));; + cam->lens = angle_to_lens(DEG2RADF(xfov)); } break; } diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c index 81ece9ddc9a..d559aef6fe2 100644 --- a/source/blender/editors/armature/armature_ops.c +++ b/source/blender/editors/armature/armature_ops.c @@ -173,6 +173,7 @@ void ED_operatormacros_armature(void) ot= WM_operatortype_append_macro("ARMATURE_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER); if(ot) { + ot->description= "Make copies of the selected bones within the same armature and move them"; WM_operatortype_macro_define(ot, "ARMATURE_OT_duplicate"); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_enum_set(otmacro->ptr, "proportional", 0); @@ -180,6 +181,7 @@ void ED_operatormacros_armature(void) ot= WM_operatortype_append_macro("ARMATURE_OT_extrude_move", "Extrude", OPTYPE_UNDO|OPTYPE_REGISTER); if(ot) { + ot->description= "Create new bones from the selected joints and move them"; otmacro=WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude"); RNA_boolean_set(otmacro->ptr, "forked", 0); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); @@ -190,6 +192,7 @@ void ED_operatormacros_armature(void) // that would require fixing a properties bug 19733 ot= WM_operatortype_append_macro("ARMATURE_OT_extrude_forked", "Extrude Forked", OPTYPE_UNDO|OPTYPE_REGISTER); if(ot) { + ot->description= "Create new bones from the selected joints and move them"; otmacro=WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude"); RNA_boolean_set(otmacro->ptr, "forked", 1); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index d8dfec82e15..d687b0689ff 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -4298,7 +4298,7 @@ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, shor * note, special exception for armature mode so we can do multi-select * we could check for multi-select explicitly but think its fine to * always give pradictable behavior in weight paint mode - campbell */ - if (!(extend) || ((ob_act && ob_act->mode & OB_MODE_WEIGHT_PAINT) == 0)) { + if (!extend || ((ob_act && (ob_act != ob) && (ob_act->mode & OB_MODE_WEIGHT_PAINT)==0))) { ED_pose_deselectall(ob, 0); nearBone->flag |= (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL); arm->act_bone= nearBone; diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index e873238b658..8c0424bd583 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -2376,7 +2376,7 @@ static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short BezTriple *bezt; BPoint *bp; int a; - short lastsel= 0, sel=0; + short lastsel= 0; if(next==0) return; @@ -2388,13 +2388,12 @@ static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short if(next < 0) bezt= (nu->bezt + (a-1)); while(a--) { if(a-abs(next) < 0) break; - sel= 0; if((lastsel==0) && (bezt->hide==0) && ((bezt->f2 & SELECT) || (selstatus==0))) { bezt+=next; if(!(bezt->f2 & SELECT) || (selstatus==0)) { - sel= select_beztriple(bezt, selstatus, 1, VISIBLE); + short sel= select_beztriple(bezt, selstatus, 1, VISIBLE); if((sel==1) && (cont==0)) lastsel= 1; - } + } } else { bezt+=next; @@ -2410,11 +2409,10 @@ static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short if(next < 0) bp= (nu->bp + (a-1)); while(a--) { if(a-abs(next) < 0) break; - sel=0; if((lastsel==0) && (bp->hide==0) && ((bp->f1 & SELECT) || (selstatus==0))) { bp+=next; if(!(bp->f1 & SELECT) || (selstatus==0)) { - sel= select_bpoint(bp, selstatus, 1, VISIBLE); + short sel= select_bpoint(bp, selstatus, 1, VISIBLE); if((sel==1) && (cont==0)) lastsel= 1; } } @@ -2443,7 +2441,6 @@ void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatu BezTriple *bezt; Curve *cu; int a; - short sel; if(obedit==NULL) return; @@ -2451,7 +2448,6 @@ void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatu cu->lastsel= NULL; for(nu= editnurb->first; nu; nu= nu->next) { - sel= 0; if(nu->type == CU_BEZIER) { a= nu->pntsu; @@ -2464,6 +2460,7 @@ void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatu } while(a--) { + short sel; if(doswap) sel= swap_selection_beztriple(bezt); else sel= select_beztriple(bezt, selstatus, 1, VISIBLE); @@ -2483,6 +2480,7 @@ void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatu while(a--) { if (bp->hide == 0) { + short sel; if(doswap) sel= swap_selection_bpoint(bp); else sel= select_bpoint(bp, selstatus, 1, VISIBLE); @@ -5779,6 +5777,7 @@ static int delete_exec(bContext *C, wmOperator *op) clamp_nurb_order_u(nu); }*/ } + clamp_nurb_order_u(nu); nurbs_knot_calc_u(nu); } nu= next; @@ -5927,7 +5926,14 @@ static int delete_exec(bContext *C, wmOperator *op) MEM_freeN(nu1->bp); nu1->bp= bp; nu1->pntsu= a; + nu1->knotsu= NULL; nu->pntsu= cut+1; + + clamp_nurb_order_u(nu); + nurbs_knot_calc_u(nu); + + clamp_nurb_order_u(nu1); + nurbs_knot_calc_u(nu1); } } } diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 6192fc4c188..4ec90d210ad 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1477,7 +1477,7 @@ static void gpencil_draw_apply (wmOperator *op, tGPsdata *p) /* start a new stroke, starting from previous point */ gp_stroke_addpoint(p, p->mvalo, p->opressure); - ok= gp_stroke_addpoint(p, p->mval, p->pressure); + gp_stroke_addpoint(p, p->mval, p->pressure); } else if (ok == GP_STROKEADD_INVALID) { /* the painting operation cannot continue... */ diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 7dac8c6351a..32fe0fb86f9 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1935,6 +1935,9 @@ void uiFreeBlock(const bContext *C, uiBlock *block) ui_free_but(C, but); } + if(block->unit) + MEM_freeN(block->unit); + if(block->func_argN) MEM_freeN(block->func_argN); @@ -2010,10 +2013,15 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor block->active= 1; block->dt= dt; block->evil_C= (void*)C; // XXX + if (scn) { block->color_profile= (scn->r.color_mgt_flag & R_COLOR_MANAGEMENT); - block->unit= &scn->unit; + + /* copy to avoid crash when scene gets deleted with ui still open */ + block->unit= MEM_mallocN(sizeof(scn->unit), "UI UnitSettings"); + memcpy(block->unit, &scn->unit, sizeof(scn->unit)); } + BLI_strncpy(block->name, name, sizeof(block->name)); if(region) diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index be44277c9d1..54a33804b06 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -801,7 +801,7 @@ static void UNUSED_FUNCTION(special_editmenu)(Scene *scene, View3D *v3d) Object *par= modifiers_isDeformedByArmature(ob); if(par && (par->mode & OB_MODE_POSE)) { - nr= pupmenu("Specials%t|Apply Bone Envelopes to Vertex Groups %x1|Apply Bone Heat Weights to Vertex Groups %x2"); +// XXX nr= pupmenu("Specials%t|Apply Bone Envelopes to Vertex Groups %x1|Apply Bone Heat Weights to Vertex Groups %x2"); // XXX if(nr==1 || nr==2) // XXX pose_adds_vgroups(ob, (nr == 2)); diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 3f5434352a7..f115642cf8e 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -231,6 +231,7 @@ void ED_operatormacros_object(void) ot= WM_operatortype_append_macro("OBJECT_OT_duplicate_move", "Duplicate Objects", OPTYPE_UNDO|OPTYPE_REGISTER); if(ot) { + ot->description = "Duplicate selected objects and move them"; WM_operatortype_macro_define(ot, "OBJECT_OT_duplicate"); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_enum_set(otmacro->ptr, "proportional", PROP_EDIT_OFF); @@ -239,6 +240,7 @@ void ED_operatormacros_object(void) /* grr, should be able to pass options on... */ ot= WM_operatortype_append_macro("OBJECT_OT_duplicate_move_linked", "Duplicate Linked", OPTYPE_UNDO|OPTYPE_REGISTER); if(ot) { + ot->description = "Duplicate selected objects and move them"; otmacro= WM_operatortype_macro_define(ot, "OBJECT_OT_duplicate"); RNA_boolean_set(otmacro->ptr, "linked", 1); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); @@ -248,6 +250,7 @@ void ED_operatormacros_object(void) /* XXX */ ot= WM_operatortype_append_macro("OBJECT_OT_add_named_cursor", "Add named object at cursor", OPTYPE_UNDO|OPTYPE_REGISTER); if(ot) { + ot->description = "Add named object at cursor"; RNA_def_string(ot->srna, "name", "Cube", 24, "Name", "Object name to add"); WM_operatortype_macro_define(ot, "VIEW3D_OT_cursor3d"); diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 8c7ffb33984..5aff7edd6d0 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -957,10 +957,8 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in wasChange = FALSE; dm = dm_deform_recalc(scene, ob); dm->getVert(dm, index, &m); - oldPos[0] = m.co[0]; - oldPos[1] = m.co[1]; - oldPos[2] = m.co[2]; - distToStart = norm[0]*oldPos[0] + norm[1]*oldPos[1] + norm[2]*oldPos[2] + d; + copy_v3_v3(oldPos, m.co); + distToStart = dot_v3v3(norm, oldPos) + d; if(distToBe == originalDistToBe) { distToBe += distToStart - distToStart*strength; @@ -1125,18 +1123,14 @@ static void vgroup_fix(Scene *scene, Object *ob, float distToBe, float strength, if(count >= 3) { float d /*, dist */ /* UNUSED */, mag; - float coord[3] = {0}; - float norm[3] = {0}; + float coord[3]; + float norm[3]; getSingleCoordinate(p, count, coord); dm->getVert(dm, i, &m); - norm[0] = m.co[0]-coord[0]; - norm[1] = m.co[1]-coord[1]; - norm[2] = m.co[2]-coord[2]; - mag = sqrt(norm[0]*norm[0] + norm[1]*norm[1] + norm[2]*norm[2]); - if(mag) {// zeros fix - mul_v3_fl(norm, 1.0f/mag); - - d = -norm[0]*coord[0] -norm[1]*coord[1] -norm[2]*coord[2]; + sub_v3_v3v3(norm, m.co, coord); + mag= normalize_v3(norm); + if(mag) { /* zeros fix */ + d = -dot_v3v3(norm, coord); /* dist = (norm[0]*m.co[0] + norm[1]*m.co[1] + norm[2]*m.co[2] + d); */ /* UNUSED */ moveCloserToDistanceFromPlane(scene, ob, me, i, norm, coord, d, distToBe, strength, cp); } @@ -2367,7 +2361,7 @@ void OBJECT_OT_vertex_group_fix(wmOperatorType *ot) /* identifiers */ ot->name= "Fix Vertex Group Deform"; ot->idname= "OBJECT_OT_vertex_group_fix"; - ot->description= "Modify the position of selected vertices by changing only their respective groups' weights (this tool may be slow for many vertices)."; + ot->description= "Modify the position of selected vertices by changing only their respective groups' weights (this tool may be slow for many vertices)"; /* api callbacks */ ot->poll= vertex_group_poll; @@ -2375,9 +2369,9 @@ void OBJECT_OT_vertex_group_fix(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - RNA_def_float(ot->srna, "dist", 0.0f, -FLT_MAX, FLT_MAX, "Distance", "The distance to move to.", -10.0f, 10.0f); - RNA_def_float(ot->srna, "strength", 1.f, -2.0f, FLT_MAX, "Strength", "The distance moved can be changed by this multiplier.", -2.0f, 2.0f); - RNA_def_float(ot->srna, "accuracy", 1.0f, 0.05f, FLT_MAX, "Change Sensitivity", "Changes the amount weights are altered with each iteration: lower values are slower.", 0.05f, 1.f); + RNA_def_float(ot->srna, "dist", 0.0f, -FLT_MAX, FLT_MAX, "Distance", "The distance to move to", -10.0f, 10.0f); + RNA_def_float(ot->srna, "strength", 1.f, -2.0f, FLT_MAX, "Strength", "The distance moved can be changed by this multiplier", -2.0f, 2.0f); + RNA_def_float(ot->srna, "accuracy", 1.0f, 0.05f, FLT_MAX, "Change Sensitivity", "Changes the amount weights are altered with each iteration: lower values are slower", 0.05f, 1.f); } diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 7595a6a7683..512fa781fc2 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -503,13 +503,11 @@ static float integrate_overlap(Brush* br) int i; int m= 10; float g = 1.0f/m; - float overlap; float max; - overlap= 0; max= 0; for(i= 0; i < m; i++) { - overlap = overlapped_curve(br, i*g); + float overlap= overlapped_curve(br, i*g); if (overlap > max) max = overlap; diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index f541423e69d..619e76e9e50 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -189,7 +189,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) /* if in NLA there's a strip active, map the view */ if (ac->datatype == ANIMCONT_ACTION) { - adt= ANIM_nla_mapping_get(ac, NULL); + /* adt= ANIM_nla_mapping_get(ac, NULL); */ /* UNUSED */ /* start and end of action itself */ calc_action_range(ac->data, &act_start, &act_end, 0); diff --git a/source/blender/editors/space_action/action_ops.c b/source/blender/editors/space_action/action_ops.c index 491d436741e..c3af3521918 100644 --- a/source/blender/editors/space_action/action_ops.c +++ b/source/blender/editors/space_action/action_ops.c @@ -94,6 +94,7 @@ void ED_operatormacros_action(void) ot= WM_operatortype_append_macro("ACTION_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER); if (ot) { + ot->description= "Make a copy of all selected keyframes and move them"; WM_operatortype_macro_define(ot, "ACTION_OT_duplicate"); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform"); RNA_enum_set(otmacro->ptr, "mode", TFM_TIME_DUPLICATE); diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index e61d7693d19..fd52c3c4199 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -749,7 +749,9 @@ int file_exec(bContext *C, wmOperator *exec_op) file_sfile_to_operator(op, sfile, filepath); - fsmenu_insert_entry(fsmenu_get(), FS_CATEGORY_RECENT, sfile->params->dir,0, 1); + if (BLI_exist(sfile->params->dir)) + fsmenu_insert_entry(fsmenu_get(), FS_CATEGORY_RECENT, sfile->params->dir, 0, 1); + BLI_make_file_string(G.main->name, filepath, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE); fsmenu_write_file(fsmenu_get(), filepath); WM_event_fileselect_event(C, op, EVT_FILESELECT_EXEC); diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index 46918407447..fb148a73ed2 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -277,6 +277,7 @@ void ED_operatormacros_graph(void) ot= WM_operatortype_append_macro("GRAPH_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER); if (ot) { + ot->description= "Make a copy of all selected keyframes and move them"; WM_operatortype_macro_define(ot, "GRAPH_OT_duplicate"); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform"); RNA_enum_set(otmacro->ptr, "mode", TFM_TIME_DUPLICATE); diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 7cb8351cd12..916e59eae9c 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -1805,7 +1805,7 @@ void NODE_OT_link_viewer(wmOperatorType *ot) { /* identifiers */ ot->name= "Link to Viewer Node"; - ot->description = "Link to Viewer Node"; + ot->description = "Link to viewer node"; ot->idname= "NODE_OT_link_viewer"; /* api callbacks */ @@ -2275,7 +2275,7 @@ void NODE_OT_duplicate(wmOperatorType *ot) { /* identifiers */ ot->name= "Duplicate Nodes"; - ot->description = "Duplicate the nodes"; + ot->description = "Duplicate selected nodes"; ot->idname= "NODE_OT_duplicate"; /* api callbacks */ @@ -2903,12 +2903,13 @@ static int node_read_fullsamplelayers_exec(bContext *C, wmOperator *UNUSED(op)) Render *re= RE_NewRender(curscene->id.name); WM_cursor_wait(1); - RE_MergeFullSample(re, bmain, curscene, snode->nodetree); - snode_notify(C, snode); - snode_dag_update(C, snode); - WM_cursor_wait(0); + + /* note we are careful to send the right notifier, as otherwise the + compositor would reexecute and overwrite the full sample result */ + WM_event_add_notifier(C, NC_SCENE|ND_COMPO_RESULT, NULL); + return OPERATOR_FINISHED; } diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c index 996e05afdef..205dd6bb639 100644 --- a/source/blender/editors/space_node/node_header.c +++ b/source/blender/editors/space_node/node_header.c @@ -93,7 +93,7 @@ static void do_node_add(bContext *C, bNodeTemplate *ntemp) else node->flag &= ~NODE_TEST; } - node= node_add_node(snode, bmain, scene, ntemp, snode->mx, snode->my); + /* node= */ node_add_node(snode, bmain, scene, ntemp, snode->mx, snode->my); /* select previous selection before autoconnect */ for(node= snode->edittree->nodes.first; node; node= node->next) { diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c index 153d703ddf6..87f98f2bb8d 100644 --- a/source/blender/editors/space_node/node_ops.c +++ b/source/blender/editors/space_node/node_ops.c @@ -106,19 +106,22 @@ void ED_operatormacros_node(void) wmOperatorTypeMacro *mot; ot= WM_operatortype_append_macro("NODE_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER); + ot->description = "Duplicate selected nodes and move them"; WM_operatortype_macro_define(ot, "NODE_OT_duplicate"); WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); /* modified operator call for duplicating with input links */ ot= WM_operatortype_append_macro("NODE_OT_duplicate_move_keep_inputs", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER); + ot->description = "Duplicate selected nodes keeping input links and move them"; mot = WM_operatortype_macro_define(ot, "NODE_OT_duplicate"); RNA_boolean_set(mot->ptr, "keep_inputs", 1); WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); ot= WM_operatortype_append_macro("NODE_OT_select_link_viewer", "Link Viewer", OPTYPE_UNDO); + ot->description = "Select node and link it to a viewer node"; WM_operatortype_macro_define(ot, "NODE_OT_select"); WM_operatortype_macro_define(ot, "NODE_OT_link_viewer"); - } +} void node_keymap(struct wmKeyConfig *keyconf) { diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 0990afa4fe6..9c4581a43da 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -178,6 +178,9 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn) case ND_FRAME: ED_area_tag_refresh(sa); break; + case ND_COMPO_RESULT: + ED_area_tag_redraw(sa); + break; case ND_TRANSFORM_DONE: if(type==NTREE_COMPOSIT) { if(snode->flag & SNODE_AUTO_RENDER) { diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 9fe0ed0543f..dda103b971b 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -1544,8 +1544,9 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops) while(seq) { op= need_add_seq_dup(seq); - if(op==1) - ten= outliner_add_element(soops, &soops->tree, (void*)seq, NULL, TSE_SEQUENCE, 0); + if(op==1) { + /* ten= */ outliner_add_element(soops, &soops->tree, (void*)seq, NULL, TSE_SEQUENCE, 0); + } else if(op==0) { ten= outliner_add_element(soops, &soops->tree, (void*)seq, NULL, TSE_SEQUENCE_DUP, 0); outliner_add_seq_dup(soops, seq, ten, 0); @@ -1582,7 +1583,7 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops) wmKeyMap *km; for(km= wm->defaultconf->keymaps.first; km; km= km->next) { - ten= outliner_add_element(soops, &soops->tree, (void*)km, NULL, TSE_KEYMAP, 0); + /* ten= */ outliner_add_element(soops, &soops->tree, (void*)km, NULL, TSE_KEYMAP, 0); } } else { diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 685b15aed50..4c617115a3d 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -508,7 +508,7 @@ void wrap_offset(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int * { Text *text; TextLine *linep; - int i, j, start, end, chars, max, chop; + int i, j, start, end, max, chop; char ch; *offl= *offc= 0; @@ -546,9 +546,9 @@ void wrap_offset(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int * start= 0; end= max; chop= 1; - chars= 0; *offc= 0; for(i=0, j=0; linep->line[j]!='\0'; j++) { + int chars; /* Mimic replacement of tabs */ ch= linep->line[j]; @@ -557,8 +557,9 @@ void wrap_offset(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int * if(linep==linein && i<cursin) cursin += chars-1; ch= ' '; } - else + else { chars= 1; + } while(chars--) { if(i-start>=max) { diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 40bd604692a..b224f99819b 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -5197,6 +5197,7 @@ static void drawspiral(const float cent[3], float rad, float tmat[][4], int star const float tot_inv= (1.0f / (float)CIRCLE_RESOL); int a; char inverse= FALSE; + float x, y, fac; if (start < 0) { inverse = TRUE; @@ -5206,38 +5207,56 @@ static void drawspiral(const float cent[3], float rad, float tmat[][4], int star mul_v3_v3fl(vx, tmat[0], rad); mul_v3_v3fl(vy, tmat[1], rad); - copy_v3_v3(vec, cent); + glBegin(GL_LINE_STRIP); if (inverse==0) { + copy_v3_v3(vec, cent); + glVertex3fv(vec); + for(a=0; a<CIRCLE_RESOL; a++) { - if (a+start>31) + if (a+start>=CIRCLE_RESOL) start=-a + 1; - glBegin(GL_LINES); - glVertex3fv(vec); - vec[0]= cent[0] + sinval[a+start] * (vx[0] * (float)a * tot_inv) + cosval[a+start] * (vy[0] * (float)a * tot_inv); - vec[1]= cent[1] + sinval[a+start] * (vx[1] * (float)a * tot_inv) + cosval[a+start] * (vy[1] * (float)a * tot_inv); - vec[2]= cent[2] + sinval[a+start] * (vx[2] * (float)a * tot_inv) + cosval[a+start] * (vy[2] * (float)a * tot_inv); + + fac= (float)a * tot_inv; + x= sinval[a+start] * fac; + y= cosval[a+start] * fac; + + vec[0]= cent[0] + (x * vx[0] + y * vy[0]); + vec[1]= cent[1] + (x * vx[1] + y * vy[1]); + vec[2]= cent[2] + (x * vx[2] + y * vy[2]); + glVertex3fv(vec); - glEnd(); } } else { - a=0; - vec[0]= cent[0] + sinval[a+start] * (vx[0] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[0] * (float)(-a+31) * tot_inv); - vec[1]= cent[1] + sinval[a+start] * (vx[1] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[1] * (float)(-a+31) * tot_inv); - vec[2]= cent[2] + sinval[a+start] * (vx[2] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[2] * (float)(-a+31) * tot_inv); + a= 0; + + fac= (float)(CIRCLE_RESOL-1) * tot_inv; + x= sinval[start] * fac; + y= cosval[start] * fac; + + vec[0]= cent[0] + (x * vx[0] + y * vy[0]); + vec[1]= cent[1] + (x * vx[1] + y * vy[1]); + vec[2]= cent[2] + (x * vx[2] + y * vy[2]); + + glVertex3fv(vec); + for(a=0; a<CIRCLE_RESOL; a++) { - if (a+start>31) + if (a+start>=CIRCLE_RESOL) start=-a + 1; - glBegin(GL_LINES); - glVertex3fv(vec); - vec[0]= cent[0] + sinval[a+start] * (vx[0] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[0] * (float)(-a+31) * tot_inv); - vec[1]= cent[1] + sinval[a+start] * (vx[1] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[1] * (float)(-a+31) * tot_inv); - vec[2]= cent[2] + sinval[a+start] * (vx[2] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[2] * (float)(-a+31) * tot_inv); + + fac= (float)(-a+(CIRCLE_RESOL-1)) * tot_inv; + x= sinval[a+start] * fac; + y= cosval[a+start] * fac; + + vec[0]= cent[0] + (x * vx[0] + y * vy[0]); + vec[1]= cent[1] + (x * vx[1] + y * vy[1]); + vec[2]= cent[2] + (x * vx[2] + y * vy[2]); glVertex3fv(vec); - glEnd(); } } + + glEnd(); } /* draws a circle on x-z plane given the scaling of the circle, assuming that diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index eccaecaad2a..b0a77843421 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -286,13 +286,13 @@ static char *view3d_modeselect_pup(Scene *scene) { Object *ob= OBACT; static char string[256]; - const char *title= N_("Mode: %%t"); + const char *title= N_("Mode: %t"); char *str = string; if(U.transopts&USER_TR_IFACE) title= BLF_gettext(title); - sprintf(str, title); + BLI_strncpy(str, title, sizeof(string)); str += modeselect_addmode(str, N_("Object Mode"), OB_MODE_OBJECT, ICON_OBJECT_DATA); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index e0d3cd59ede..cda0dbe922d 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -3300,6 +3300,11 @@ int Trackball(TransInfo *t, const int UNUSED(mval[2])) void initTranslation(TransInfo *t) { + if (t->spacetype == SPACE_ACTION) { + /* this space uses time translate */ + t->state = TRANS_CANCEL; + } + t->mode = TFM_TRANSLATION; t->transform = Translation; diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index ed98a179d05..10502609358 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -1816,7 +1816,7 @@ void flushTransParticles(TransInfo *t) /* ********************* mesh ****************** */ /* proportional distance based on connectivity */ -#define THRESHOLD 0.0001f +#define THRESHOLDFACTOR (1.0f-0.0001f) /*I did this wrong, it should be a breadth-first search but instead it's a depth-first search, fudged diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 1579a05eac3..f7746816c38 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -1311,7 +1311,7 @@ static void weld_align_uv(bContext *C, int tool) int itmpl, jtmpl; EditVert *eve; int pass; /* first 2 passes find endpoints, 3rd pass moves middle points, 4th pass is fail-on-face-selected */ - EditFace *startefa, *endefa; + EditFace *startefa, *endefa= NULL; /* endefa shouldnt need to be initialized but just incase */ /* pass 3 variables */ float startx, starty, firstm, firstb, midx, midy; diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 40186c5a187..c3cbcb61622 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -1091,6 +1091,9 @@ static void do_material_tex(GPUShadeInput *shi) float ima_x, ima_y; float hScale = 0.1f; // compatibility adjustment factor for all bumpspace types float hScaleTex = 13.0f; // factor for scaling texspace bumps + + float imag_tspace_dimension_x = 1024.0f; // only used for texture space variant + float aspect = 1.0f; GPUNodeLink *surf_pos = GPU_builtin(GPU_VIEW_POSITION); GPUNodeLink *vR1, *vR2; @@ -1154,6 +1157,7 @@ static void do_material_tex(GPUShadeInput *shi) if(ibuf) { ima_x= ibuf->x; ima_y= ibuf->y; + aspect = ((float) ima_y) / ima_x; } } @@ -1174,10 +1178,11 @@ static void do_material_tex(GPUShadeInput *shi) if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) { - + float imag_tspace_dimension_y = aspect*imag_tspace_dimension_x; GPU_link( mat, "mtex_bump_apply_texspace", fDet, dBs, dBt, vR1, vR2, - GPU_image(tex->ima, &tex->iuser), texco, GPU_uniform(&ima_x), GPU_uniform(&ima_y), vNacc, + GPU_image(tex->ima, &tex->iuser), texco, + GPU_uniform(&imag_tspace_dimension_x), GPU_uniform(&imag_tspace_dimension_y), vNacc, &vNacc, &shi->vn ); } else GPU_link( mat, "mtex_bump_apply", diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c index 0759d97e69f..b87b46ca464 100644 --- a/source/blender/imbuf/intern/jpeg.c +++ b/source/blender/imbuf/intern/jpeg.c @@ -255,12 +255,12 @@ static void memory_source(j_decompress_ptr cinfo, unsigned char *buffer, size_t static boolean handle_app1 (j_decompress_ptr cinfo) { - INT32 length, i; + INT32 length; /* initialized by the macro */ + INT32 i; char neogeo[128]; INPUT_VARS(cinfo); - - length = 0; + INPUT_2BYTES(cinfo, length, return FALSE); length -= 2; diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 434e613359d..718f70cea1e 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -613,7 +613,7 @@ static void rna_def_action(BlenderRNA *brna) prop= RNA_def_property(srna, "id_root", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "idroot"); RNA_def_property_enum_items(prop, id_type_items); - RNA_def_property_ui_text(prop, "ID Root Type", "Type of ID-block that action can be used on. DO NOT CHANGE UNLESS YOU KNOW WHAT YOU'RE DOING"); + RNA_def_property_ui_text(prop, "ID Root Type", "Type of ID-block that action can be used on - DO NOT CHANGE UNLESS YOU KNOW WHAT YOU'RE DOING"); /* API calls */ RNA_api_action(srna); diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index 43cf1fae931..d828139a6d5 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -861,7 +861,7 @@ static void rna_def_camera_actuator(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "CameraActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Camera Actuator", "Actuator to..."); + RNA_def_struct_ui_text(srna, "Camera Actuator", ""); RNA_def_struct_sdna_from(srna, "bCameraActuator", "data"); prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); @@ -1387,7 +1387,7 @@ static void rna_def_scene_actuator(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "SceneActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Scene Actuator", "Actuator to..."); + RNA_def_struct_ui_text(srna, "Scene Actuator", ""); RNA_def_struct_sdna_from(srna, "bSceneActuator", "data"); prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); @@ -1445,7 +1445,7 @@ static void rna_def_random_actuator(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "RandomActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Random Actuator", "Actuator to..."); + RNA_def_struct_ui_text(srna, "Random Actuator", ""); RNA_def_struct_sdna_from(srna, "bRandomActuator", "data"); prop= RNA_def_property(srna, "seed", PROP_INT, PROP_NONE); @@ -1562,7 +1562,7 @@ static void rna_def_message_actuator(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "MessageActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Message Actuator", "Actuator to..."); + RNA_def_struct_ui_text(srna, "Message Actuator", ""); RNA_def_struct_sdna_from(srna, "bMessageActuator", "data"); prop= RNA_def_property(srna, "to_property", PROP_STRING, PROP_NONE); @@ -1877,7 +1877,7 @@ static void rna_def_armature_actuator(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "ArmatureActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Armature Actuator", "Actuator to..."); + RNA_def_struct_ui_text(srna, "Armature Actuator", ""); RNA_def_struct_sdna_from(srna, "bArmatureActuator", "data"); prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 8af65b97ffc..63b3aed4a3b 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -58,6 +58,21 @@ BlenderDefRNA DefRNA = {NULL, {NULL, NULL}, {NULL, NULL}, NULL, 0, 0, 0, 1}; #define MAX2(x,y) ((x)>(y)? (x): (y)) #endif +/* pedantic check for '.', do this since its a hassle for translators */ +#ifndef NDEBUG +# define DESCR_CHECK(description, id1, id2) \ + if(description && (description)[0]) { \ + int i = strlen(description); \ + if((description)[i - 1] == '.') { \ + fprintf(stderr, "%s: '%s' '%s' description ends with a '.' !\n", \ + __func__, id1 ? id1 : "", id2 ? id2 : ""); \ + } \ + } \ + +#else +# define DESCR_CHECK(description, id1, id2) +#endif + void rna_addtail(ListBase *listbase, void *vlink) { Link *link= vlink; @@ -847,6 +862,8 @@ void RNA_def_struct_identifier(StructRNA *srna, const char *identifier) void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description) { + DESCR_CHECK(description, srna->identifier, NULL); + srna->name= name; srna->description= description; } @@ -1109,6 +1126,8 @@ void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int le void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description) { + DESCR_CHECK(description, prop->identifier, NULL); + prop->name= name; prop->description= description; } diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 673e768e71e..6ed2147ce1b 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -377,10 +377,10 @@ static void rna_def_material_mtex(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem prop_mapping_items[] = { - {MTEX_FLAT, "FLAT", 0, "Flat", "Maps X and Y coordinates directly"}, - {MTEX_CUBE, "CUBE", 0, "Cube", "Maps using the normal vector"}, - {MTEX_TUBE, "TUBE", 0, "Tube", "Maps with Z as central axis"}, - {MTEX_SPHERE, "SPHERE", 0, "Sphere", "Maps with Z as central axis"}, + {MTEX_FLAT, "FLAT", 0, "Flat", "Map X and Y coordinates directly"}, + {MTEX_CUBE, "CUBE", 0, "Cube", "Map using the normal vector"}, + {MTEX_TUBE, "TUBE", 0, "Tube", "Map with Z as central axis"}, + {MTEX_SPHERE, "SPHERE", 0, "Sphere", "Map with Z as central axis"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem prop_x_mapping_items[] = { @@ -456,7 +456,7 @@ static void rna_def_material_mtex(BlenderRNA *brna) prop= RNA_def_property(srna, "use_from_original", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_OB_DUPLI_ORIG); RNA_def_property_ui_text(prop, "From Original", - "Dupli's derive their object coordinates from the original objects transformation"); + "Dupli's derive their object coordinates from the original object's transformation"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_map_color_diffuse", PROP_BOOLEAN, PROP_NONE); @@ -555,7 +555,7 @@ static void rna_def_material_mtex(BlenderRNA *brna) prop= RNA_def_property(srna, "normal_map_space", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "normapspace"); RNA_def_property_enum_items(prop, prop_normal_map_space_items); - RNA_def_property_ui_text(prop, "Normal Map Space", "Sets space of normal map image"); + RNA_def_property_ui_text(prop, "Normal Map Space", "Set space of normal map image"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_NONE); @@ -871,7 +871,7 @@ static void rna_def_material_colors(StructRNA *srna) prop= RNA_def_property(srna, "specular_ramp_blend", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "rampblend_spec"); RNA_def_property_enum_items(prop, ramp_blend_items); - RNA_def_property_ui_text(prop, "Diffuse Ramp Blend", "Blending method of the ramp and the specular color"); + RNA_def_property_ui_text(prop, "Specular Ramp Blend", "Blending method of the ramp and the specular color"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "diffuse_ramp_input", PROP_ENUM, PROP_NONE); @@ -981,7 +981,7 @@ static void rna_def_material_raymirror(BlenderRNA *brna) prop= RNA_def_property(srna, "reflect_factor", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "ray_mirror"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Reflectivity", "Sets the amount mirror reflection for raytrace"); + RNA_def_property_ui_text(prop, "Reflectivity", "Amount of mirror reflection for raytrace"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "fresnel", PROP_FLOAT, PROP_NONE); @@ -1060,7 +1060,7 @@ static void rna_def_material_raytra(BlenderRNA *brna) prop= RNA_def_property(srna, "ior", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "ang"); RNA_def_property_range(prop, 0.25f, 4.0f); - RNA_def_property_ui_text(prop, "IOR", "Sets angular index of refraction for raytraced refraction"); + RNA_def_property_ui_text(prop, "IOR", "Angular index of refraction for raytraced refraction"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "fresnel", PROP_FLOAT, PROP_NONE); @@ -1233,7 +1233,7 @@ static void rna_def_material_volume(BlenderRNA *brna) RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1 ,3); RNA_def_property_ui_text(prop, "Scattering", "Amount of light that gets scattered out by the volume - " - "the more out-scattering, the shallower the light will penetrate "); + "the more out-scattering, the shallower the light will penetrate"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "transmission_color", PROP_FLOAT, PROP_COLOR); @@ -1292,118 +1292,118 @@ static void rna_def_material_halo(BlenderRNA *brna) prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "hasize"); RNA_def_property_range(prop, 0.0f, 100.0f); - RNA_def_property_ui_text(prop, "Size", "Sets the dimension of the halo"); + RNA_def_property_ui_text(prop, "Size", "Dimension of the halo"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "hardness", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "har"); RNA_def_property_range(prop, 0, 127); - RNA_def_property_ui_text(prop, "Hardness", "Sets the hardness of the halo"); + RNA_def_property_ui_text(prop, "Hardness", "Hardness of the halo"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "add", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "add"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Add", "Sets the strength of the add effect"); + RNA_def_property_ui_text(prop, "Add", "Strength of the add effect"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "ring_count", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ringc"); RNA_def_property_range(prop, 0, 24); - RNA_def_property_ui_text(prop, "Rings", "Sets the number of rings rendered over the halo"); + RNA_def_property_ui_text(prop, "Rings", "Number of rings rendered over the halo"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "line_count", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "linec"); RNA_def_property_range(prop, 0, 250); - RNA_def_property_ui_text(prop, "Line Number", "Sets the number of star shaped lines rendered over the halo"); + RNA_def_property_ui_text(prop, "Line Number", "Number of star shaped lines rendered over the halo"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "star_tip_count", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "starc"); RNA_def_property_range(prop, 3, 50); - RNA_def_property_ui_text(prop, "Star Tips", "Sets the number of points on the star shaped halo"); + RNA_def_property_ui_text(prop, "Star Tips", "Number of points on the star shaped halo"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "seed", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "seed1"); RNA_def_property_range(prop, 0, 255); - RNA_def_property_ui_text(prop, "Seed", "Randomizes ring dimension and line location"); + RNA_def_property_ui_text(prop, "Seed", "Randomize ring dimension and line location"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_flare_mode", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_FLARE); /* use bitflags */ - RNA_def_property_ui_text(prop, "Flare", "Renders halo as a lens flare"); + RNA_def_property_ui_text(prop, "Flare", "Render halo as a lens flare"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "flare_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "flaresize"); RNA_def_property_range(prop, 0.1f, 25.0f); - RNA_def_property_ui_text(prop, "Flare Size", "Sets the factor by which the flare is larger than the halo"); + RNA_def_property_ui_text(prop, "Flare Size", "Factor by which the flare is larger than the halo"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "flare_subflare_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "subsize"); RNA_def_property_range(prop, 0.1f, 25.0f); - RNA_def_property_ui_text(prop, "Flare Subsize", "Sets the dimension of the sub-flares, dots and circles"); + RNA_def_property_ui_text(prop, "Flare Subsize", "Dimension of the sub-flares, dots and circles"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "flare_boost", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "flareboost"); RNA_def_property_range(prop, 0.1f, 10.0f); - RNA_def_property_ui_text(prop, "Flare Boost", "Gives the flare extra strength"); + RNA_def_property_ui_text(prop, "Flare Boost", "Give the flare extra strength"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "flare_seed", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "seed2"); RNA_def_property_range(prop, 0, 255); - RNA_def_property_ui_text(prop, "Flare Seed", "Specifies an offset in the flare seed table"); + RNA_def_property_ui_text(prop, "Flare Seed", "Offset in the flare seed table"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "flare_subflare_count", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "flarec"); RNA_def_property_range(prop, 1, 32); - RNA_def_property_ui_text(prop, "Flares Sub", "Sets the number of sub-flares"); + RNA_def_property_ui_text(prop, "Flares Sub", "Number of sub-flares"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_ring", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_RINGS); - RNA_def_property_ui_text(prop, "Rings", "Renders rings over halo"); + RNA_def_property_ui_text(prop, "Rings", "Render rings over halo"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_lines", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_LINES); - RNA_def_property_ui_text(prop, "Lines", "Renders star shaped lines over halo"); + RNA_def_property_ui_text(prop, "Lines", "Render star shaped lines over halo"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_star", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_STAR); - RNA_def_property_ui_text(prop, "Star", "Renders halo as a star"); + RNA_def_property_ui_text(prop, "Star", "Render halo as a star"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_texture", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALOTEX); - RNA_def_property_ui_text(prop, "Texture", "Gives halo a texture"); + RNA_def_property_ui_text(prop, "Texture", "Give halo a texture"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_vertex_normal", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALOPUNO); - RNA_def_property_ui_text(prop, "Vertex Normal", "Uses the vertex normal to specify the dimension of the halo"); + RNA_def_property_ui_text(prop, "Vertex Normal", "Use the vertex normal to specify the dimension of the halo"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_extreme_alpha", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_XALPHA); - RNA_def_property_ui_text(prop, "Extreme Alpha", "Uses extreme alpha"); + RNA_def_property_ui_text(prop, "Extreme Alpha", "Use extreme alpha"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_shaded", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_SHADE); - RNA_def_property_ui_text(prop, "Shaded", "Lets halo receive light and shadows from external objects"); + RNA_def_property_ui_text(prop, "Shaded", "Let halo receive light and shadows from external objects"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_soft", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_SOFT); - RNA_def_property_ui_text(prop, "Soft", "Softens the edges of halos at intersections with other geometry"); + RNA_def_property_ui_text(prop, "Soft", "Soften the edges of halos at intersections with other geometry"); RNA_def_property_update(prop, 0, "rna_Material_update"); } @@ -1457,7 +1457,7 @@ static void rna_def_material_sss(BlenderRNA *brna) prop= RNA_def_property(srna, "texture_factor", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "sss_texfac"); RNA_def_property_ui_range(prop, 0, 1, 10, 3); - RNA_def_property_ui_text(prop, "Texture Factor", "Texture scatting blend factor"); + RNA_def_property_ui_text(prop, "Texture Factor", "Texture scattering blend factor"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "front", PROP_FLOAT, PROP_NONE); @@ -1594,7 +1594,7 @@ static void rna_def_material_strand(BlenderRNA *brna) prop= RNA_def_property(srna, "shape", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "strand_ease"); RNA_def_property_range(prop, -0.9, 0.9); - RNA_def_property_ui_text(prop, "Shape", "Positive values make strands rounder, negative makes strands spiky"); + RNA_def_property_ui_text(prop, "Shape", "Positive values make strands rounder, negative ones make strands spiky"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "width_fade", PROP_FLOAT, PROP_NONE); @@ -1659,7 +1659,7 @@ void RNA_def_material(BlenderRNA *brna) static EnumPropertyItem prop_type_items[] = { {MA_TYPE_SURFACE, "SURFACE", 0, "Surface", "Render object as a surface"}, - {MA_TYPE_WIRE, "WIRE", 0, "Wire", "Render the edges of faces as wires (not supported in ray tracing)"}, + {MA_TYPE_WIRE, "WIRE", 0, "Wire", "Render the edges of faces as wires (not supported in raytracing)"}, {MA_TYPE_VOLUME, "VOLUME", 0, "Volume", "Render object as a volume"}, {MA_TYPE_HALO, "HALO", 0, "Halo", "Render object as halo particles"}, {0, NULL, 0, NULL, NULL}}; @@ -1688,7 +1688,7 @@ void RNA_def_material(BlenderRNA *brna) srna= RNA_def_struct(brna, "Material", "ID"); RNA_def_struct_ui_text(srna, "Material", - "Material datablock to defined the appearance of geometric objects for rendering"); + "Material datablock to define the appearance of geometric objects for rendering"); RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA); prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); @@ -1785,17 +1785,17 @@ void RNA_def_material(BlenderRNA *brna) prop= RNA_def_property(srna, "use_raytrace", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_TRACEBLE); RNA_def_property_ui_text(prop, "Traceable", - "Include this material and geometry that uses it in ray tracing calculations"); + "Include this material and geometry that uses it in raytracing calculations"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_shadows", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_SHADOW); - RNA_def_property_ui_text(prop, "Shadows", "Allows this material to receive shadows"); + RNA_def_property_ui_text(prop, "Shadows", "Allow this material to receive shadows"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_shadeless", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_SHLESS); - RNA_def_property_ui_text(prop, "Shadeless", "Makes this material insensitive to light or shadow"); + RNA_def_property_ui_text(prop, "Shadeless", "Make this material insensitive to light or shadow"); RNA_def_property_update(prop, 0, "rna_Material_draw_update"); prop= RNA_def_property(srna, "use_vertex_color_light", PROP_BOOLEAN, PROP_NONE); @@ -1806,30 +1806,30 @@ void RNA_def_material(BlenderRNA *brna) prop= RNA_def_property(srna, "use_vertex_color_paint", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_VERTEXCOLP); RNA_def_property_ui_text(prop, "Vertex Color Paint", - "Replaces object base color with vertex colors (multiplies with " + "Replace object base color with vertex colors (multiply with " "'texture face' face assigned textures)"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ZINV); - RNA_def_property_ui_text(prop, "Invert Z Depth", "Renders material's faces with an inverted Z buffer (scanline only)"); + RNA_def_property_ui_text(prop, "Invert Z Depth", "Render material's faces with an inverted Z buffer (scanline only)"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "offset_z", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "zoffs"); - RNA_def_property_ui_text(prop, "Z Offset", "Gives faces an artificial offset in the Z buffer for Z transparency"); + RNA_def_property_ui_text(prop, "Z Offset", "Give faces an artificial offset in the Z buffer for Z transparency"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_sky", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ENV); RNA_def_property_ui_text(prop, "Sky", - "Renders this material with zero alpha, with sky background in place (scanline only)"); + "Render this material with zero alpha, with sky background in place (scanline only)"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_only_shadow", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ONLYSHADOW); RNA_def_property_ui_text(prop, "Only Shadow", - "Renders shadows as the material's alpha value, making materials " + "Render shadows as the material's alpha value, making the material " "transparent except for shadowed areas"); RNA_def_property_update(prop, 0, "rna_Material_update"); @@ -1842,19 +1842,19 @@ void RNA_def_material(BlenderRNA *brna) prop= RNA_def_property(srna, "use_face_texture", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_FACETEXTURE); RNA_def_property_ui_text(prop, "Face Textures", - "Replaces the object's base color with color from face assigned image textures"); + "Replace the object's base color with color from face assigned image textures"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_face_texture_alpha", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_FACETEXTURE_ALPHA); RNA_def_property_ui_text(prop, "Face Textures Alpha", - "Replaces the object's base alpha value with alpha from face assigned image textures"); + "Replace the object's base alpha value with alpha from face assigned image textures"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_cast_shadows_only", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ONLYCAST); RNA_def_property_ui_text(prop, "Cast Shadows Only", - "Makes objects with this material appear invisible, only casting shadows (not rendered)"); + "Make objects with this material appear invisible (not rendered), only casting shadows"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_mist", PROP_BOOLEAN, PROP_NONE); @@ -1871,7 +1871,7 @@ void RNA_def_material(BlenderRNA *brna) prop= RNA_def_property(srna, "use_ray_shadow_bias", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_RAYBIAS); RNA_def_property_ui_text(prop, "Ray Shadow Bias", - "Prevents raytraced shadow errors on surfaces with smooth shaded normals (terminator problem)"); + "Prevent raytraced shadow errors on surfaces with smooth shaded normals (terminator problem)"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_full_oversampling", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 816a7ba9cd4..85ad6b231aa 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -84,7 +84,7 @@ static void api_ui_item_common(FunctionRNA *func) { PropertyRNA *prop; - prop= RNA_def_string_translate(func, "text", "", 0, "", "Override automatic text of the item"); + RNA_def_string_translate(func, "text", "", 0, "", "Override automatic text of the item"); prop= RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, icon_items); diff --git a/source/blender/modifiers/intern/MOD_navmesh.c b/source/blender/modifiers/intern/MOD_navmesh.c index cf4e01ad516..946a0948fee 100644 --- a/source/blender/modifiers/intern/MOD_navmesh.c +++ b/source/blender/modifiers/intern/MOD_navmesh.c @@ -25,6 +25,12 @@ * ***** END GPL LICENSE BLOCK ***** * */ + +/** \file blender/modifiers/intern/MOD_navmesh.c + * \ingroup modifiers + */ + + #include <math.h> #include "DNA_mesh_types.h" diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index a56fe7aa960..07394298666 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -193,6 +193,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) return dataMask; } + static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm, int UNUSED(useRenderParams), @@ -531,6 +532,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, } if(smd->flag & MOD_SOLIDIFY_RIM) { + int *origindex; + /* bugger, need to re-calculate the normals for the new edge faces. * This could be done in many ways, but probably the quickest way is to calculate the average normals for side faces only. * Then blend them with the normals of the edge verts. @@ -550,12 +553,15 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, const unsigned char crease_inner= smd->crease_inner * 255.0f; /* add faces & edges */ + origindex= result->getEdgeDataArray(result, CD_ORIGINDEX); ed= medge + (numEdges * 2); for(i=0; i<newEdges; i++, ed++) { ed->v1= new_vert_arr[i]; ed->v2= new_vert_arr[i] + numVerts; ed->flag |= ME_EDGEDRAW; + origindex[numEdges * 2 + i]= ORIGINDEX_NONE; + if(crease_rim) ed->crease= crease_rim; } @@ -564,6 +570,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, edge_origIndex = CustomData_get_layer(&result->edgeData, CD_ORIGINDEX); mp= mpoly + (numFaces * 2); + origindex= result->getTessFaceDataArray(result, CD_ORIGINDEX); ml = mloop + (numLoops * 2); j = 0; for(i=0; i<newFaces; i++, mp++) { @@ -652,13 +659,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, edge_origIndex[ml[j-3].e] = ORIGINDEX_NONE; edge_origIndex[ml[j-1].e] = ORIGINDEX_NONE; } - if(crease_outer) { /* crease += crease_outer; without wrapping */ unsigned char *cr= (unsigned char *)&(medge[eidx].crease); int tcr= *cr + crease_outer; *cr= tcr > 255 ? 255 : tcr; } + if(crease_inner) { /* crease += crease_inner; without wrapping */ unsigned char *cr= (unsigned char *)&(medge[numEdges + eidx].crease); @@ -672,6 +679,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, add_v3_v3(edge_vert_nos[ed->v1], nor); add_v3_v3(edge_vert_nos[ed->v2], nor); #endif + origindex[numFaces * 2 + i]= ORIGINDEX_NONE; } #ifdef SOLIDIFY_SIDE_NORMALS diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index 8eb1bace229..270198737a2 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -23,6 +23,10 @@ * */ +/** \file blender/modifiers/intern/MOD_warp.c + * \ingroup modifiers + */ + #include <string.h> #include "MEM_guardedalloc.h" diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c index 128e888ca90..2c94c4d1505 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.c +++ b/source/blender/modifiers/intern/MOD_weightvg_util.c @@ -26,11 +26,8 @@ * */ -/* - * XXX I'd like to make modified weights visible in WeightPaint mode, - * but couldn't figure a way to do this... - * Maybe this will need changes in mesh_calc_modifiers (DerivedMesh.c)? - * Or the WeightPaint mode code itself? +/** \file blender/modifiers/intern/MOD_weightvg_util.c + * \ingroup modifiers */ #include "BLI_math.h" diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.h b/source/blender/modifiers/intern/MOD_weightvg_util.h index a327bdf969b..ed558e412c5 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.h +++ b/source/blender/modifiers/intern/MOD_weightvg_util.h @@ -26,7 +26,7 @@ * */ -/** \file blender/modifiers/intern/MOD_util.h +/** \file blender/modifiers/intern/MOD_weightvg_util.h * \ingroup modifiers */ diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c index 8e609ad5929..a860747972c 100644 --- a/source/blender/modifiers/intern/MOD_weightvgedit.c +++ b/source/blender/modifiers/intern/MOD_weightvgedit.c @@ -26,11 +26,8 @@ * */ -/* - * XXX I'd like to make modified weights visible in WeightPaint mode, - * but couldn't figure a way to do this... - * Maybe this will need changes in mesh_calc_modifiers (DerivedMesh.c)? - * Or the WeightPaint mode code itself? +/** \file blender/modifiers/intern/MOD_weightvgedit.c + * \ingroup modifiers */ #include "BLI_utildefines.h" diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c index f30a2deb576..d7365d13d7c 100644 --- a/source/blender/modifiers/intern/MOD_weightvgmix.c +++ b/source/blender/modifiers/intern/MOD_weightvgmix.c @@ -26,11 +26,8 @@ * */ -/* - * XXX I'd like to make modified weights visible in WeightPaint mode, - * but couldn't figure a way to do this... - * Maybe this will need changes in mesh_calc_modifiers (DerivedMesh.c)? - * Or the WeightPaint mode code itself? +/** \file blender/modifiers/intern/MOD_weightvgmix.c + * \ingroup modifiers */ #include "BLI_utildefines.h" diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index 6242c6d0f5e..385ecb48f10 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -26,11 +26,8 @@ * */ -/* - * XXX I'd like to make modified weights visible in WeightPaint mode, - * but couldn't figure a way to do this... - * Maybe this will need changes in mesh_calc_modifiers (DerivedMesh.c)? - * Or the WeightPaint mode code itself? +/** \file blender/modifiers/intern/MOD_weightvgproximity.c + * \ingroup modifiers */ #include "BLI_editVert.h" diff --git a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c index cac2a386801..f7028fbeafd 100644 --- a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c @@ -52,8 +52,6 @@ static void do_luma_matte(bNode *node, float *out, float *in) NodeChroma *c=(NodeChroma *)node->storage; float alpha; - alpha=0.0; - /* test range*/ if(in[0]>c->t1) { alpha=1.0; diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript index 5cc3f3bedc4..f00d49fe8dd 100644 --- a/source/blender/python/SConscript +++ b/source/blender/python/SConscript @@ -17,9 +17,6 @@ defs = [] if is_debug: defs.append('_DEBUG') -if env['WITH_BF_INTERNATIONAL']: - defs.append('INTERNATIONAL') - sources = env.Glob('generic/*.c') env.BlenderLib( libname = 'bf_python_ext', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core','player'], priority = [363,165]) # ketsji is 360 @@ -43,5 +40,8 @@ if env['WITH_BF_PYTHON_SAFETY']: if env['BF_BUILDINFO']: defs.append('BUILD_DATE') +if env['WITH_BF_INTERNATIONAL']: + defs.append('INTERNATIONAL') + sources = env.Glob('intern/*.c') env.BlenderLib( libname = 'bf_python', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core'], priority = [361]) diff --git a/source/blender/python/generic/CMakeLists.txt b/source/blender/python/generic/CMakeLists.txt index 0a49036c15d..847a0d19a7f 100644 --- a/source/blender/python/generic/CMakeLists.txt +++ b/source/blender/python/generic/CMakeLists.txt @@ -48,8 +48,4 @@ set(SRC py_capi_utils.h ) -if(WITH_INTERNATIONAL) - add_definitions(-DINTERNATIONAL) -endif() - blender_add_lib(bf_python_ext "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c index 87e4a301eff..b16efdf5a3d 100644 --- a/source/blender/python/generic/blf_py_api.c +++ b/source/blender/python/generic/blf_py_api.c @@ -31,15 +31,9 @@ #include "blf_py_api.h" #include "../../blenfont/BLF_api.h" -#include "../../blenfont/BLF_translation.h" #include "BLI_utildefines.h" -#ifdef INTERNATIONAL -#include "DNA_userdef_types.h" /* is it bad level? */ -#endif - - PyDoc_STRVAR(py_blf_position_doc, ".. function:: position(fontid, x, y, z)\n" "\n" @@ -371,33 +365,24 @@ static PyObject *py_blf_load(PyObject *UNUSED(self), PyObject *args) return PyLong_FromLong(BLF_load(filename)); } -PyDoc_STRVAR(py_blf_gettext_doc, -".. function:: gettext(msgid)\n" +PyDoc_STRVAR(py_blf_unload_doc, +".. function:: unload(filename)\n" "\n" -" Get a msg in local language.\n" +" Unload an existing font.\n" "\n" -" :arg msgid: the source string.\n" -" :type msgid: string\n" -" :return: the localized string.\n" -" :rtype: string\n" +" :arg filename: the filename of the font.\n" +" :type filename: string\n" ); -static PyObject *py_blf_gettext(PyObject *UNUSED(self), PyObject *value) +static PyObject *py_blf_unload(PyObject *UNUSED(self), PyObject *args) { -#ifdef INTERNATIONAL - if ((U.transopts & USER_DOTRANSLATE) && (U.transopts & USER_TR_IFACE)) { - const char *msgid= _PyUnicode_AsString(value); - if(msgid == NULL) { - PyErr_SetString(PyExc_TypeError, "blf.gettext expects a single string argument"); - return NULL; - } - - return PyUnicode_FromString(BLF_gettext(msgid)); - } - else -#endif /* INTERNATIONAL */ - { - return Py_INCREF(value), value; - } + char* filename; + + if (!PyArg_ParseTuple(args, "s:blf.unload", &filename)) + return NULL; + + BLF_unload(filename); + + Py_RETURN_NONE; } /*----------------------------MODULE INIT-------------------------*/ @@ -415,7 +400,7 @@ static PyMethodDef BLF_methods[] = { {"shadow_offset", (PyCFunction) py_blf_shadow_offset, METH_VARARGS, py_blf_shadow_offset_doc}, {"size", (PyCFunction) py_blf_size, METH_VARARGS, py_blf_size_doc}, {"load", (PyCFunction) py_blf_load, METH_VARARGS, py_blf_load_doc}, - {"gettext", (PyCFunction) py_blf_gettext, METH_O, py_blf_gettext_doc}, + {"unload", (PyCFunction) py_blf_unload, METH_VARARGS, py_blf_unload_doc}, {NULL, NULL, 0, NULL} }; diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c index 5c5162d268b..93038984115 100644 --- a/source/blender/render/intern/source/pixelshading.c +++ b/source/blender/render/intern/source/pixelshading.c @@ -226,8 +226,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3]) } /* shadow */ - if(i> -0.41f) { /* heuristic valua! */ - shadfac= 1.0; + if(i> -0.41f) { /* heuristic valua! */ if(lar->shb) { shadfac = testshadowbuf(&R, lar->shb, rco, dco, dco, inp, 0.0f); if(shadfac==0.0f) continue; diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 641fec90cf3..8d953ccc73d 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -747,7 +747,7 @@ static int plugintex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex { PluginTex *pit; int rgbnor=0; - float result[ 8 ]; + float result[8]= {0.0f}; texres->tin= 0.0; @@ -1906,6 +1906,8 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T const int fromrgb = ((tex->type == TEX_IMAGE) || ((tex->flag & TEX_COLORBAND)!=0)); float Hscale = Tnor*mtex->norfac; int dimx=512, dimy=512; + const int imag_tspace_dimension_x = 1024; // only used for texture space variant + float aspect = 1.0f; // 2 channels for 2D texture and 3 for 3D textures. const int nr_channels = (mtex->texco == TEXCO_UV)? 2 : 3; @@ -1938,6 +1940,7 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T if (ibuf) { dimx = ibuf->x; dimy = ibuf->y; + aspect = ((float) dimy) / dimx; } } @@ -2111,12 +2114,13 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T if(tex->ima) { // crazy hack solution that gives results similar to normal mapping - part 2 float vec[2]; + const float imag_tspace_dimension_y = aspect*imag_tspace_dimension_x; - vec[0] = dimx*dxt[0]; - vec[1] = dimy*dxt[1]; + vec[0] = imag_tspace_dimension_x*dxt[0]; + vec[1] = imag_tspace_dimension_y*dxt[1]; dHdx *= 1.0f/len_v2(vec); - vec[0] = dimx*dyt[0]; - vec[1] = dimy*dyt[1]; + vec[0] = imag_tspace_dimension_x*dyt[0]; + vec[1] = imag_tspace_dimension_y*dyt[1]; dHdy *= 1.0f/len_v2(vec); } } diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c index d8231c7e7d4..956a3d4de7c 100644 --- a/source/blender/render/intern/source/shadeinput.c +++ b/source/blender/render/intern/source/shadeinput.c @@ -1368,7 +1368,7 @@ void shade_samples_do_AO(ShadeSample *ssamp) if(((shi->passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) || (shi->passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) - for(sample=0, shi= ssamp->shi; sample<ssamp->tot; shi++, sample++) + for(sample=0; sample<ssamp->tot; shi++, sample++) if(!(shi->mode & MA_SHLESS)) ambient_occlusion(shi); /* stores in shi->ao[] */ } diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 41d12c6065e..c808d930e7c 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -726,7 +726,7 @@ static float Toon_Diff( float *n, float *l, float *UNUSED(v), float size, float /* in latter case, only last multiplication uses 'nl' */ static float OrenNayar_Diff(float nl, float *n, float *l, float *v, float rough ) { - float i/*, nh*/, nv, vh, realnl, h[3]; + float i/*, nh*/, nv /*, vh */, realnl, h[3]; float a, b, t, A, B; float Lit_A, View_A, Lit_B[3], View_B[3]; @@ -745,8 +745,8 @@ static float OrenNayar_Diff(float nl, float *n, float *l, float *v, float rough if(realnl<=0.0f) return 0.0f; if(nl<0.0f) return 0.0f; /* value from area light */ - vh= v[0]*h[0]+v[1]*h[1]+v[2]*h[2]; /* Dot product between view vector and halfway vector */ - if(vh<=0.0f) vh= 0.0f; + /* vh= v[0]*h[0]+v[1]*h[1]+v[2]*h[2]; */ /* Dot product between view vector and halfway vector */ + /* if(vh<=0.0f) vh= 0.0f; */ Lit_A = saacos(realnl); View_A = saacos( nv ); diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c index b63ece80119..464cbf72326 100644 --- a/source/blender/render/intern/source/voxeldata.c +++ b/source/blender/render/intern/source/voxeldata.c @@ -389,7 +389,7 @@ int voxeldatatex(struct Tex *tex, const float texvec[3], struct TexResult *texre VoxelData *vd = tex->vd; float co[3], offset[3] = {0.5, 0.5, 0.5}; - if ((!vd) || (vd->dataset==NULL)) { + if (vd->dataset==NULL) { texres->tin = 0.0f; return 0; } diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 75fec6ed705..dad43b4fe69 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1917,7 +1917,7 @@ void wm_event_do_handlers(bContext *C) /* store last event for this window */ /* mousemove and timer events don't overwrite last type */ - if (event->type != MOUSEMOVE && !ISTIMER(event->type)) { + if (!ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE) && !ISTIMER(event->type)) { if (wm_action_not_handled(action)) { if (win->eventstate->prevtype == event->type) { /* set click time on first click (press -> release) */ diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 320dc2ecdda..68cd95c1b99 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1962,7 +1962,7 @@ static void WM_OT_save_as_mainfile(wmOperatorType *ot) WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH); RNA_def_boolean(ot->srna, "compress", 0, "Compress", "Write compressed .blend file"); RNA_def_boolean(ot->srna, "relative_remap", 1, "Remap Relative", "Remap relative paths when saving in a different directory"); - RNA_def_boolean(ot->srna, "copy", 0, "Save Copy", "Save a copy of the actual working state but does not make saved file active."); + RNA_def_boolean(ot->srna, "copy", 0, "Save Copy", "Save a copy of the actual working state but does not make saved file active"); } /* *************** save file directly ******** */ @@ -3279,12 +3279,12 @@ static void WM_OT_radial_control(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; /* all paths relative to the context */ - RNA_def_string(ot->srna, "data_path", "", 0, "Data Path", "Path of property to be set by the radial control."); - RNA_def_string(ot->srna, "rotation_path", "", 0, "Rotation Path", "Path of property used to rotate the texture display."); - RNA_def_string(ot->srna, "color_path", "", 0, "Color Path", "Path of property used to set the color of the control."); - RNA_def_string(ot->srna, "fill_color_path", "", 0, "Fill Color Path", "Path of property used to set the fill color of the control."); - RNA_def_string(ot->srna, "zoom_path", "", 0, "Zoom Path", "Path of property used to set the zoom level for the control."); - RNA_def_string(ot->srna, "image_id", "", 0, "Image ID", "Path of ID that is used to generate an image for the control."); + RNA_def_string(ot->srna, "data_path", "", 0, "Data Path", "Path of property to be set by the radial control"); + RNA_def_string(ot->srna, "rotation_path", "", 0, "Rotation Path", "Path of property used to rotate the texture display"); + RNA_def_string(ot->srna, "color_path", "", 0, "Color Path", "Path of property used to set the color of the control"); + RNA_def_string(ot->srna, "fill_color_path", "", 0, "Fill Color Path", "Path of property used to set the fill color of the control"); + RNA_def_string(ot->srna, "zoom_path", "", 0, "Zoom Path", "Path of property used to set the zoom level for the control"); + RNA_def_string(ot->srna, "image_id", "", 0, "Image ID", "Path of ID that is used to generate an image for the control"); } /* ************************** timer for testing ***************** */ diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index d9ca275c819..405960d0795 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -111,14 +111,12 @@ static void wm_window_check_position(rcti *rect) #endif if(rect->xmin < 0) { - d= rect->xmin; - rect->xmax -= d; - rect->xmin -= d; + rect->xmax -= rect->xmin; + rect->xmin = 0; } if(rect->ymin < 0) { - d= rect->ymin; - rect->ymax -= d; - rect->ymin -= d; + rect->ymax -= rect->ymin; + rect->ymin = 0; } if(rect->xmax > width) { d= rect->xmax - width; |