diff options
author | Daniel Genrich <daniel.genrich@gmx.net> | 2012-08-06 13:59:24 +0400 |
---|---|---|
committer | Daniel Genrich <daniel.genrich@gmx.net> | 2012-08-06 13:59:24 +0400 |
commit | b8905ba0a6731d2aba6f3487be58b338f35df5f7 (patch) | |
tree | e3dc4fc0ac799aec6d7f28dcfb16d87c53ec5506 /release/scripts | |
parent | 79f638791d5a0ab6c07cd21c82decdc24329d825 (diff) | |
parent | 3b743582ec282cfffc84c5e235f58fe2745327c9 (diff) |
Merge from trunk r49109-r49601
Diffstat (limited to 'release/scripts')
48 files changed, 712 insertions, 440 deletions
diff --git a/release/scripts/modules/bl_i18n_utils/bl_process_msg.py b/release/scripts/modules/bl_i18n_utils/bl_process_msg.py index f189e3a0d80..b884423606d 100644 --- a/release/scripts/modules/bl_i18n_utils/bl_process_msg.py +++ b/release/scripts/modules/bl_i18n_utils/bl_process_msg.py @@ -270,7 +270,6 @@ def dump_messages_rna(messages, check_ctxt): walk_keymap_hierarchy(KM_HIERARCHY, "KM_HIERARCHY") - def dump_messages_pytext(messages, check_ctxt): """ dumps text inlined in the python user interface: eg. @@ -291,7 +290,7 @@ def dump_messages_pytext(messages, check_ctxt): # Break recursive nodes look up on some kind of nodes. # E.g. we don’t want to get strings inside subscripts (blah["foo"])! - stopper_nodes = {ast.Subscript,} + stopper_nodes = {ast.Subscript, } for func_id, func in bpy.types.UILayout.bl_rna.functions.items(): # check it has a 'text' argument diff --git a/release/scripts/modules/bl_i18n_utils/check_po.py b/release/scripts/modules/bl_i18n_utils/check_po.py index b669a9ddff2..03a933887c6 100755 --- a/release/scripts/modules/bl_i18n_utils/check_po.py +++ b/release/scripts/modules/bl_i18n_utils/check_po.py @@ -94,7 +94,6 @@ def main(): help="Restrict processed languages to those.") args = parser.parse_args() - if args.pot: global FILE_NAME_POT FILE_NAME_POT = args.pot @@ -145,24 +144,24 @@ def main(): ret = t if args.stats and glob_stats["nbr"] != 0.0: - nbr_contexts = len(glob_stats["contexts"]-{""}) + nbr_contexts = len(glob_stats["contexts"] - {""}) if nbr_contexts != 1: if nbr_contexts == 0: nbr_contexts = "No" _ctx_txt = "s are" else: _ctx_txt = " is" - print("\nAverage stats for all {:.0f} processed files:\n" \ - " {:>6.1%} done!\n" \ - " {:>6.1%} of messages are tooltips.\n" \ - " {:>6.1%} of tooltips are translated.\n" \ - " {:>6.1%} of translated messages are tooltips.\n" \ - " {:>6.1%} of messages are commented.\n" \ - " The org msgids are currently made of {} signs.\n" \ - " All processed translations are currently made of {} signs.\n" \ - " {} specific context{} present:\n {}\n" \ - "".format(glob_stats["nbr"], glob_stats["lvl"]/glob_stats["nbr"], - glob_stats["lvl_ttips"]/glob_stats["nbr"], + print("\nAverage stats for all {:.0f} processed files:\n" + " {:>6.1%} done!\n" + " {:>6.1%} of messages are tooltips.\n" + " {:>6.1%} of tooltips are translated.\n" + " {:>6.1%} of translated messages are tooltips.\n" + " {:>6.1%} of messages are commented.\n" + " The org msgids are currently made of {} signs.\n" + " All processed translations are currently made of {} signs.\n" + " {} specific context{} present:\n {}\n" + "".format(glob_stats["nbr"], glob_stats["lvl"] / glob_stats["nbr"], + glob_stats["lvl_ttips"] / glob_stats["nbr"], glob_stats["lvl_trans_ttips"]/glob_stats["nbr"], glob_stats["lvl_ttips_in_trans"]/glob_stats["nbr"], glob_stats["lvl_comm"]/glob_stats["nbr"], glob_stats["nbr_signs"], diff --git a/release/scripts/modules/bl_i18n_utils/clean_po.py b/release/scripts/modules/bl_i18n_utils/clean_po.py index f0b8dd6b1d2..2924ad9fb74 100755 --- a/release/scripts/modules/bl_i18n_utils/clean_po.py +++ b/release/scripts/modules/bl_i18n_utils/clean_po.py @@ -65,7 +65,6 @@ def main(): help="Restrict processed languages to those.") args = parser.parse_args() - ret = 0 if args.langs: diff --git a/release/scripts/modules/bl_i18n_utils/import_po_from_branches.py b/release/scripts/modules/bl_i18n_utils/import_po_from_branches.py index cbbef17b37d..a15bea9ef0d 100755 --- a/release/scripts/modules/bl_i18n_utils/import_po_from_branches.py +++ b/release/scripts/modules/bl_i18n_utils/import_po_from_branches.py @@ -56,12 +56,11 @@ def main(): help="Restrict processed languages to those.") args = parser.parse_args() - ret = 0 - threshold = float(settings.IMPORT_MIN_LEVEL)/100.0 + threshold = float(settings.IMPORT_MIN_LEVEL) / 100.0 if args.threshold is not None: - threshold = float(args.threshold)/100.0 + threshold = float(args.threshold) / 100.0 for lang in os.listdir(BRANCHES_DIR): if args.langs and lang not in args.langs: @@ -74,7 +73,7 @@ def main(): trans_msgs = stats["trans_msg"] lvl = 0.0 if tot_msgs: - lvl = float(trans_msgs)/float(tot_msgs) + lvl = float(trans_msgs) / float(tot_msgs) if lvl > threshold: if state["is_broken"] and args.strict: print("{:<10}: {:>6.1%} done, but BROKEN, skipped." \ diff --git a/release/scripts/modules/bl_i18n_utils/merge_po.py b/release/scripts/modules/bl_i18n_utils/merge_po.py index 51e587ca4c8..baf67de2e81 100755 --- a/release/scripts/modules/bl_i18n_utils/merge_po.py +++ b/release/scripts/modules/bl_i18n_utils/merge_po.py @@ -21,7 +21,7 @@ # <pep8 compliant> # Merge one or more .po files into the first dest one. -# If a msgkey is present in more than one merged po, the one in the first file wins, unless +# If a msgkey is present in more than one merged po, the one in the first file wins, unless # it’s marked as fuzzy and one later is not. # The fuzzy flag is removed if necessary. # All other comments are never modified. @@ -59,7 +59,6 @@ def main(): help="The po's to merge into the dst.po one.") args = parser.parse_args() - ret = 0 done_msgkeys = set() done_fuzzy_msgkeys = set() @@ -78,7 +77,7 @@ def main(): # If we don’t want to replace existing valid translations, pre-populate # done_msgkeys and done_fuzzy_msgkeys. if not args.replace: - done_msgkeys = dst_states["trans_msg"].copy() + done_msgkeys = dst_states["trans_msg"].copy() done_fuzzy_msgkeys = dst_states["fuzzy_msg"].copy() for po in args.src: messages, states, stats = utils.parse_messages(po) diff --git a/release/scripts/modules/bl_i18n_utils/rtl_preprocess.py b/release/scripts/modules/bl_i18n_utils/rtl_preprocess.py index 9b2ee983952..5ee5c71be8b 100755 --- a/release/scripts/modules/bl_i18n_utils/rtl_preprocess.py +++ b/release/scripts/modules/bl_i18n_utils/rtl_preprocess.py @@ -86,6 +86,7 @@ FRIBIDI_FLAGS_DEFAULT = FRIBIDI_FLAG_SHAPE_MIRRORING | \ FRIBIDI_FLAGS_ARABIC = FRIBIDI_FLAG_SHAPE_ARAB_PRES | \ FRIBIDI_FLAG_SHAPE_ARAB_LIGA + ##### Kernel processing funcs. ##### def protect_format_seq(msg): """ @@ -185,6 +186,7 @@ def log2vis(msgs): yield fbc_str.value + ##### Command line stuff. ##### def main(): import argparse @@ -208,7 +210,6 @@ def main(): help="The po's to pre-process messages.") args = parser.parse_args() - msgs, state, u1 = utils.parse_messages(args.src) if state["is_broken"]: print("Source po is BROKEN, aborting.") diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py index 094d8e481e9..d323dd37979 100644 --- a/release/scripts/modules/bl_i18n_utils/settings.py +++ b/release/scripts/modules/bl_i18n_utils/settings.py @@ -55,7 +55,7 @@ DOMAIN = "blender" # Our own "gettext" stuff. # File type (ext) to parse. -PYGETTEXT_ALLOWED_EXTS = {".c", ".cpp", ".cxx", ".hpp", ".hxx", ".h"} +PYGETTEXT_ALLOWED_EXTS = {".c", ".cpp", ".cxx", ".hpp", ".hxx", ".h"} # Where to search contexts definitions, relative to SOURCE_DIR (defined below). PYGETTEXT_CONTEXTS_DEFSRC = os.path.join("source", "blender", "blenfont", @@ -97,7 +97,7 @@ _msg_re = r"(?P<msg_raw>" + _str_whole_re.format(_="_msg") + r")" PYGETTEXT_KEYWORDS = (() + tuple((r"{}\(\s*" + _msg_re + r"\s*\)").format(it) for it in ("IFACE_", "TIP_", "N_")) + - tuple((r"{}\(\s*" + _ctxt_re + r"\s*,\s*"+ _msg_re + r"\s*\)").format(it) + tuple((r"{}\(\s*" + _ctxt_re + r"\s*,\s*" + _msg_re + r"\s*\)").format(it) for it in ("CTX_IFACE_", "CTX_TIP_", "CTX_N_")) ) diff --git a/release/scripts/modules/bl_i18n_utils/spell_check_utils.py b/release/scripts/modules/bl_i18n_utils/spell_check_utils.py index 6dfb4be56aa..d668f2badfc 100644 --- a/release/scripts/modules/bl_i18n_utils/spell_check_utils.py +++ b/release/scripts/modules/bl_i18n_utils/spell_check_utils.py @@ -376,7 +376,7 @@ dict_uimsgs = { "chebychev", "kutta", "lennard", - "minkowsky", + "minkowski", "minnaert", "musgrave", "nayar", @@ -414,7 +414,7 @@ dict_uimsgs = { "gpu", "gpus", "hc", "hdr", - "hh", "mm", "ss", "ff", # hh:mm:ss:ff timecode + "hh", "mm", "ss", "ff", # hh:mm:ss:ff timecode "hsv", "hsva", "id", "itu", diff --git a/release/scripts/modules/bl_i18n_utils/update_branches.py b/release/scripts/modules/bl_i18n_utils/update_branches.py index 6626fa937a6..199b09aa13a 100755 --- a/release/scripts/modules/bl_i18n_utils/update_branches.py +++ b/release/scripts/modules/bl_i18n_utils/update_branches.py @@ -38,6 +38,7 @@ except: PY3 = settings.PYTHON3_EXEC + def main(): import argparse parser = argparse.ArgumentParser(description="" \ @@ -59,7 +60,6 @@ def main(): help="Restrict processed languages to those.") args = parser.parse_args() - ret = 0 # Generate a temp messages file. diff --git a/release/scripts/modules/bl_i18n_utils/update_mo.py b/release/scripts/modules/bl_i18n_utils/update_mo.py index 2ca24a76cfe..4a68f19fab0 100755 --- a/release/scripts/modules/bl_i18n_utils/update_mo.py +++ b/release/scripts/modules/bl_i18n_utils/update_mo.py @@ -47,7 +47,7 @@ def process_po(po, lang, mo=None): mo_dir = os.path.join(TRUNK_MO_DIR, lang, "LC_MESSAGES") # Create dirs if not existing! if not os.path.isdir(mo_dir): - os.makedirs(mo_dir, exist_ok = True) + os.makedirs(mo_dir, exist_ok=True) # show stats cmd = (GETTEXT_MSGFMT_EXECUTABLE, diff --git a/release/scripts/modules/bl_i18n_utils/update_po.py b/release/scripts/modules/bl_i18n_utils/update_po.py index d098b50e907..4c6495c5cfe 100755 --- a/release/scripts/modules/bl_i18n_utils/update_po.py +++ b/release/scripts/modules/bl_i18n_utils/update_po.py @@ -36,8 +36,8 @@ except: GETTEXT_MSGMERGE_EXECUTABLE = settings.GETTEXT_MSGMERGE_EXECUTABLE -BRANCHES_DIR = settings.BRANCHES_DIR -TRUNK_PO_DIR = settings.TRUNK_PO_DIR +BRANCHES_DIR = settings.BRANCHES_DIR +TRUNK_PO_DIR = settings.TRUNK_PO_DIR FILE_NAME_POT = settings.FILE_NAME_POT diff --git a/release/scripts/modules/bl_i18n_utils/update_pot.py b/release/scripts/modules/bl_i18n_utils/update_pot.py index ca5d156be9b..f98fc5d7705 100755 --- a/release/scripts/modules/bl_i18n_utils/update_pot.py +++ b/release/scripts/modules/bl_i18n_utils/update_pot.py @@ -74,12 +74,13 @@ pygettexts = tuple(re.compile(r).search _clean_str = re.compile(settings.str_clean_re).finditer clean_str = lambda s: "".join(m.group("clean") for m in _clean_str(s)) + def check_file(path, rel_path, messages): with open(path, encoding="utf-8") as f: f = f.read() for srch in pygettexts: m = srch(f) - line = pos =0 + line = pos = 0 while m: d = m.groupdict() # Context. @@ -149,6 +150,8 @@ from spell_check_utils import (dict_uimsgs, ) _spell_checked = set() + + def spell_check(txt, cache): ret = [] @@ -194,6 +197,8 @@ def gen_empty_pot(): escape_re = tuple(re.compile(r[0]) for r in settings.ESCAPE_RE) escape = lambda s, n: escape_re[n].sub(settings.ESCAPE_RE[n][1], s) + + def merge_messages(msgs, states, messages, do_checks, spell_cache): num_added = num_present = 0 for (context, msgid), srcs in messages.items(): diff --git a/release/scripts/modules/bl_i18n_utils/update_trunk.py b/release/scripts/modules/bl_i18n_utils/update_trunk.py index 5e0ceab387c..b7f8f375744 100755 --- a/release/scripts/modules/bl_i18n_utils/update_trunk.py +++ b/release/scripts/modules/bl_i18n_utils/update_trunk.py @@ -65,7 +65,6 @@ def main(): help="Restrict processed languages to those.") args = parser.parse_args() - ret = 0 failed = set() diff --git a/release/scripts/modules/bl_i18n_utils/utils.py b/release/scripts/modules/bl_i18n_utils/utils.py index ebf0f994a7a..3e5394d85a4 100644 --- a/release/scripts/modules/bl_i18n_utils/utils.py +++ b/release/scripts/modules/bl_i18n_utils/utils.py @@ -40,6 +40,7 @@ def stripeol(s): def is_tooltip(msgid): return len(msgid) > 30 + def parse_messages(fname): """ Returns a tupple (messages, states, stats). @@ -82,7 +83,6 @@ def parse_messages(fname): fuzzy_messages = set() commented_messages = set() - def clean_vars(): nonlocal reading_msgid, reading_msgstr, reading_msgctxt, \ reading_comment, is_fuzzy, is_translated, is_commented, \ @@ -143,7 +143,6 @@ def parse_messages(fname): clean_vars() - with open(fname, 'r', encoding="utf-8") as f: for line_nr, line in enumerate(f): line = stripeol(line) @@ -156,7 +155,7 @@ def parse_messages(fname): reading_ctxt = True if line.startswith(COMMENT_PREFIX): is_commented = True - line = line[9+len(COMMENT_PREFIX):-1] + line = line[9 + len(COMMENT_PREFIX):-1] else: line = line[9:-1] msgctxt_lines.append(line) @@ -167,7 +166,7 @@ def parse_messages(fname): reading_msgid = True if line.startswith(COMMENT_PREFIX): is_commented = True - line = line[7+len(COMMENT_PREFIX):-1] + line = line[7 + len(COMMENT_PREFIX):-1] else: line = line[7:-1] msgid_lines.append(line) @@ -180,7 +179,7 @@ def parse_messages(fname): reading_msgid = False reading_msgstr = True if line.startswith(COMMENT_PREFIX): - line = line[8+len(COMMENT_PREFIX):-1] + line = line[8 + len(COMMENT_PREFIX):-1] if not is_commented: is_broken = True else: @@ -194,13 +193,13 @@ def parse_messages(fname): elif line.startswith("#"): if reading_msgid: if is_commented: - msgid_lines.append(line[1+len(COMMENT_PREFIX):-1]) + msgid_lines.append(line[1 + len(COMMENT_PREFIX):-1]) else: msgid_lines.append(line) is_broken = True elif reading_msgstr: if is_commented: - msgstr_lines.append(line[1+len(COMMENT_PREFIX):-1]) + msgstr_lines.append(line[1 + len(COMMENT_PREFIX):-1]) else: msgstr_lines.append(line) is_broken = True @@ -338,13 +337,13 @@ def print_stats(stats, glob_stats=None, prefix=""): lvl = lvl_ttips = lvl_trans_ttips = lvl_ttips_in_trans = lvl_comm = 0.0 if tot_msgs > 0: - lvl = float(trans_msgs)/float(tot_msgs) - lvl_ttips = float(tot_ttips)/float(tot_msgs) - lvl_comm = float(comm_msgs)/float(tot_msgs+comm_msgs) + lvl = float(trans_msgs) / float(tot_msgs) + lvl_ttips = float(tot_ttips) / float(tot_msgs) + lvl_comm = float(comm_msgs) / float(tot_msgs+comm_msgs) if tot_ttips > 0: - lvl_trans_ttips = float(trans_ttips)/float(tot_ttips) + lvl_trans_ttips = float(trans_ttips) / float(tot_ttips) if trans_msgs > 0: - lvl_ttips_in_trans = float(trans_ttips)/float(trans_msgs) + lvl_ttips_in_trans = float(trans_ttips) / float(trans_msgs) if glob_stats: glob_stats["nbr"] += 1.0 @@ -368,9 +367,8 @@ def print_stats(stats, glob_stats=None, prefix=""): "{:>6.1%} of translated messages are tooltips ({} over {}).\n" "".format(lvl_ttips_in_trans, trans_ttips, trans_msgs), "{:>6.1%} of messages are commented ({} over {}).\n" - "".format(lvl_comm, comm_msgs, comm_msgs+tot_msgs), + "".format(lvl_comm, comm_msgs, comm_msgs + tot_msgs), "This translation is currently made of {} signs.\n" "".format(nbr_trans_signs)) print(prefix.join(lines)) return 0 - diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py index ad657284492..09deb33c174 100644 --- a/release/scripts/modules/bpy/utils.py +++ b/release/scripts/modules/bpy/utils.py @@ -34,13 +34,14 @@ __all__ = ( "register_class", "register_module", "resource_path", + "script_path_user", + "script_path_pref", "script_paths", "smpte_from_frame", "smpte_from_seconds", "unregister_class", "unregister_module", "user_resource", - "user_script_path", ) from _bpy import register_class, unregister_class, blend_paths, resource_path @@ -252,15 +253,16 @@ _scripts = _os.path.join(_os.path.dirname(__file__), _scripts = (_os.path.normpath(_scripts), ) -def user_script_path(): - # returns the env var and falls back to userprefs +def script_path_user(): + """returns the env var and falls back to home dir or None""" path = _user_resource('SCRIPTS') + return _os.path.normpath(path) if path else None - if path: - path = _os.path.normpath(path) - return path - else: - return None + +def script_path_pref(): + """returns the user preference or None""" + path = _bpy.context.user_preferences.filepaths.script_directory + return _os.path.normpath(path) if path else None def script_paths(subdir=None, user_pref=True, check_all=False): @@ -278,10 +280,6 @@ def script_paths(subdir=None, user_pref=True, check_all=False): :rtype: list """ scripts = list(_scripts) - prefs = _bpy.context.user_preferences - - # add user scripts dir - user_script = user_script_path() if check_all: # all possible paths @@ -291,7 +289,7 @@ def script_paths(subdir=None, user_pref=True, check_all=False): # only paths blender uses base_paths = _bpy_script_paths() - for path in base_paths + (user_script, ): + for path in base_paths + (script_path_user(), script_path_pref()): if path: path = _os.path.normpath(path) if path not in scripts and _os.path.isdir(path): diff --git a/release/scripts/modules/console_python.py b/release/scripts/modules/console_python.py index 2aaadb17b71..d32606eb0b0 100644 --- a/release/scripts/modules/console_python.py +++ b/release/scripts/modules/console_python.py @@ -308,7 +308,8 @@ def banner(context): 'OUTPUT') add_scrollback("Convenience Imports: from mathutils import *; " "from math import *", 'OUTPUT') - add_scrollback("Convenience Variables: C = bpy.context, D = bpy.data", 'OUTPUT') + add_scrollback("Convenience Variables: C = bpy.context, D = bpy.data", + 'OUTPUT') add_scrollback("", 'OUTPUT') sc.prompt = PROMPT diff --git a/release/scripts/modules/sys_info.py b/release/scripts/modules/sys_info.py index 6fc50bcfe0d..ea75bfde809 100644 --- a/release/scripts/modules/sys_info.py +++ b/release/scripts/modules/sys_info.py @@ -87,7 +87,8 @@ def write_sysinfo(op): output.write("\nDirectories:\n") output.write(lilies) output.write("scripts: %r\n" % (bpy.utils.script_paths())) - output.write("user scripts: %r\n" % (bpy.utils.user_script_path())) + output.write("user scripts: %r\n" % (bpy.utils.script_path_user())) + output.write("pref scripts: %r\n" % (bpy.utils.script_path_pref())) output.write("datafiles: %r\n" % (bpy.utils.user_resource('DATAFILES'))) output.write("config: %r\n" % (bpy.utils.user_resource('CONFIG'))) output.write("scripts : %r\n" % (bpy.utils.user_resource('SCRIPTS'))) diff --git a/release/scripts/presets/tracking_settings/blurry_footage.py b/release/scripts/presets/tracking_settings/blurry_footage.py index f2df4a15320..0423f7662a2 100644 --- a/release/scripts/presets/tracking_settings/blurry_footage.py +++ b/release/scripts/presets/tracking_settings/blurry_footage.py @@ -1,12 +1,17 @@ import bpy settings = bpy.context.edit_movieclip.tracking.settings -settings.default_correlation_min = 0.75 -settings.default_pattern_size = 21 -settings.default_search_size = 100 + +settings.default_pattern_size = 31 +settings.default_search_size = 91 +settings.default_motion_model = 'Loc' +settings.use_default_brute = True +settings.use_default_normalization = False +settings.use_default_mask = False settings.default_frames_limit = 0 settings.default_pattern_match = 'PREV_FRAME' settings.default_margin = 0 settings.use_default_red_channel = True settings.use_default_green_channel = True settings.use_default_blue_channel = True +settings.default_correlation_min = 0.6
\ No newline at end of file diff --git a/release/scripts/presets/tracking_settings/blurry_movie.py b/release/scripts/presets/tracking_settings/blurry_movie.py deleted file mode 100644 index fe68f1352c1..00000000000 --- a/release/scripts/presets/tracking_settings/blurry_movie.py +++ /dev/null @@ -1,9 +0,0 @@ -import bpy -settings = bpy.context.edit_movieclip.tracking.settings - -settings.default_correlation_min = 0.75 -settings.default_pattern_size = 11 -settings.default_search_size = 202 -settings.default_frames_limit = 25 -settings.default_pattern_match = 'KEYFRAME' -settings.default_margin = 0 diff --git a/release/scripts/presets/tracking_settings/default.py b/release/scripts/presets/tracking_settings/default.py index 0cc3a21c845..0aef22195e7 100644 --- a/release/scripts/presets/tracking_settings/default.py +++ b/release/scripts/presets/tracking_settings/default.py @@ -1,12 +1,17 @@ import bpy settings = bpy.context.edit_movieclip.tracking.settings -settings.default_correlation_min = 0.75 -settings.default_pattern_size = 11 -settings.default_search_size = 61 + +settings.default_pattern_size = 15 +settings.default_search_size = 51 +settings.default_motion_model = 'Loc' +settings.use_default_brute = True +settings.use_default_normalization = False +settings.use_default_mask = False settings.default_frames_limit = 0 settings.default_pattern_match = 'KEYFRAME' settings.default_margin = 0 settings.use_default_red_channel = True settings.use_default_green_channel = True settings.use_default_blue_channel = True +settings.default_correlation_min = 0.75
\ No newline at end of file diff --git a/release/scripts/presets/tracking_settings/fast_motion.py b/release/scripts/presets/tracking_settings/fast_motion.py index 5e6e44e6a42..f7f6b37db74 100644 --- a/release/scripts/presets/tracking_settings/fast_motion.py +++ b/release/scripts/presets/tracking_settings/fast_motion.py @@ -1,12 +1,17 @@ import bpy settings = bpy.context.edit_movieclip.tracking.settings -settings.default_correlation_min = 0.7 + settings.default_pattern_size = 31 -settings.default_search_size = 300 +settings.default_search_size = 151 +settings.default_motion_model = 'LocRot' +settings.use_default_brute = True +settings.use_default_normalization = True +settings.use_default_mask = False settings.default_frames_limit = 0 settings.default_pattern_match = 'PREV_FRAME' -settings.default_margin = 5 +settings.default_margin = 0 settings.use_default_red_channel = True settings.use_default_green_channel = True settings.use_default_blue_channel = True +settings.default_correlation_min = 0.6
\ No newline at end of file diff --git a/release/scripts/presets/tracking_settings/planar.py b/release/scripts/presets/tracking_settings/planar.py new file mode 100644 index 00000000000..b25df1fc466 --- /dev/null +++ b/release/scripts/presets/tracking_settings/planar.py @@ -0,0 +1,17 @@ +import bpy +settings = bpy.context.edit_movieclip.tracking.settings + + +settings.default_pattern_size = 41 +settings.default_search_size = 91 +settings.default_motion_model = 'Perspective' +settings.use_default_brute = False +settings.use_default_normalization = False +settings.use_default_mask = False +settings.default_frames_limit = 0 +settings.default_pattern_match = 'KEYFRAME' +settings.default_margin = 0 +settings.use_default_red_channel = True +settings.use_default_green_channel = True +settings.use_default_blue_channel = True +settings.default_correlation_min = 0.75
\ No newline at end of file diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py index a30502b454e..c45d2f2e702 100644 --- a/release/scripts/startup/bl_operators/clip.py +++ b/release/scripts/startup/bl_operators/clip.py @@ -90,14 +90,17 @@ def CLIP_track_view_selected(sc, track): return False -def CLIP_default_settings_from_track(clip, track): +def CLIP_default_settings_from_track(clip, track, framenr): settings = clip.tracking.settings width = clip.size[0] height = clip.size[1] - pattern = track.pattern_max - track.pattern_min - search = track.search_max - track.search_min + marker = track.markers.find_frame(framenr, False) + pattern_bb = marker.pattern_bound_box + + pattern = Vector(pattern_bb[1]) - Vector(pattern_bb[0]) + search = marker.search_max - marker.search_min pattern[0] = pattern[0] * width pattern[1] = pattern[1] * height @@ -111,6 +114,10 @@ def CLIP_default_settings_from_track(clip, track): settings.default_frames_limit = track.frames_limit settings.default_pattern_match = track.pattern_match settings.default_margin = track.margin + settings.default_motion_model = track.motion_model + settings.use_default_brute = track.use_brute + settings.use_default_normalization = track.use_normalization + settings.use_default_mask = track.use_mask settings.use_default_red_channel = track.use_red_channel settings.use_default_green_channel = track.use_green_channel settings.use_default_blue_channel = track.use_blue_channel @@ -862,6 +869,9 @@ class CLIP_OT_track_settings_as_default(Operator): sc = context.space_data clip = sc.clip - CLIP_default_settings_from_track(clip, clip.tracking.tracks.active) + track = clip.tracking.tracks.active + framenr = context.scene.frame_current - clip.frame_start + 1 + + CLIP_default_settings_from_track(clip, track, framenr) return {'FINISHED'} diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py index 05f76208a5f..db492450e28 100644 --- a/release/scripts/startup/bl_operators/presets.py +++ b/release/scripts/startup/bl_operators/presets.py @@ -436,15 +436,19 @@ class AddPresetTrackingSettings(AddPresetBase, Operator): ] preset_values = [ - "settings.default_correlation_min", - "settings.default_pattern_size", - "settings.default_search_size", - "settings.default_frames_limit", - "settings.default_pattern_match", - "settings.default_margin", - "settings.use_default_red_channel", - "settings.use_default_green_channel", - "settings.use_default_blue_channel" + "default_correlation_min", + "default_pattern_size", + "default_search_size", + "default_frames_limit", + "default_pattern_match", + "default_margin", + "default_motion_model", + "use_default_brute", + "use_default_normalization", + "use_default_mask", + "use_default_red_channel", + "use_default_green_channel", + "use_default_blue_channel" ] preset_subdir = "tracking_settings" diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 18450ebe316..a81733fe59c 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -101,7 +101,6 @@ def operator_value_is_undo(value): return (isinstance(id_data, bpy.types.ID) and (not isinstance(id_data, (bpy.types.WindowManager, bpy.types.Screen, - bpy.types.Scene, bpy.types.Brush, )))) diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py index 84049e9f1fe..847807029fa 100644 --- a/release/scripts/startup/bl_ui/__init__.py +++ b/release/scripts/startup/bl_ui/__init__.py @@ -38,6 +38,7 @@ _modules = ( "properties_data_modifier", "properties_data_speaker", "properties_game", + "properties_mask_common", "properties_material", "properties_object_constraint", "properties_object", diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py index 03aa41bb9aa..e194d7a1370 100644 --- a/release/scripts/startup/bl_ui/properties_data_armature.py +++ b/release/scripts/startup/bl_ui/properties_data_armature.py @@ -323,6 +323,7 @@ class DATA_PT_onion_skinning(OnionSkinButtonsPanel): # , Panel): # inherit from def draw(self, context): ob = context.object + self.draw_settings(context, ob.pose.animation_visualization, bones=True) diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py index 4f3be914e66..5f21f78a375 100644 --- a/release/scripts/startup/bl_ui/properties_data_mesh.py +++ b/release/scripts/startup/bl_ui/properties_data_mesh.py @@ -148,7 +148,7 @@ class DATA_PT_vertex_groups(MeshButtonsPanel, Panel): col = row.column(align=True) col.operator("object.vertex_group_add", icon='ZOOMIN', text="") - col.operator("object.vertex_group_remove", icon='ZOOMOUT', text="") + col.operator("object.vertex_group_remove", icon='ZOOMOUT', text="").all = False col.menu("MESH_MT_vertex_group_specials", icon='DOWNARROW_HLT', text="") if group: col.separator() diff --git a/release/scripts/startup/bl_ui/properties_data_speaker.py b/release/scripts/startup/bl_ui/properties_data_speaker.py index 853c11c96c6..ca922dfb544 100644 --- a/release/scripts/startup/bl_ui/properties_data_speaker.py +++ b/release/scripts/startup/bl_ui/properties_data_speaker.py @@ -105,14 +105,13 @@ class DATA_PT_cone(DataButtonsPanel, Panel): speaker = context.speaker split = layout.split() - col = split.column() + col = split.column() col.label("Angle:") col.prop(speaker, "cone_angle_outer", text="Outer") col.prop(speaker, "cone_angle_inner", text="Inner") col = split.column() - col.label("Volume:") col.prop(speaker, "cone_volume_outer", text="Outer") diff --git a/release/scripts/startup/bl_ui/properties_game.py b/release/scripts/startup/bl_ui/properties_game.py index c25c0c7d40d..5ff49a7d369 100644 --- a/release/scripts/startup/bl_ui/properties_game.py +++ b/release/scripts/startup/bl_ui/properties_game.py @@ -337,7 +337,6 @@ class RENDER_PT_game_stereo(RenderButtonsPanel, Panel): if dome_type in {'FISHEYE', 'TRUNCATED_REAR', 'TRUNCATED_FRONT'}: col = split.column() - col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True) col.prop(gs, "dome_angle", slider=True) @@ -347,14 +346,13 @@ class RENDER_PT_game_stereo(RenderButtonsPanel, Panel): elif dome_type == 'PANORAM_SPH': col = split.column() - col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True) + col = split.column() col.prop(gs, "dome_tessellation", text="Tessellation") else: # cube map col = split.column() - col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True) col = split.column() @@ -396,6 +394,7 @@ class RENDER_PT_game_system(RenderButtonsPanel, Panel): layout = self.layout gs = context.scene.game_settings + row = layout.row() row.prop(gs, "use_frame_rate") row.prop(gs, "restrict_animation_updates") @@ -415,10 +414,10 @@ class RENDER_PT_game_display(RenderButtonsPanel, Panel): def draw(self, context): layout = self.layout - row = layout.row() - row.prop(context.scene.render, "fps", text="Animation Frame Rate", slider=False) - gs = context.scene.game_settings + + layout.prop(context.scene.render, "fps", text="Animation Frame Rate", slider=False) + flow = layout.column_flow() flow.prop(gs, "show_debug_properties", text="Debug Properties") flow.prop(gs, "show_framerate_profile", text="Framerate and Profile") @@ -582,14 +581,14 @@ class WORLD_PT_game_mist(WorldButtonsPanel, Panel): world = context.world layout.active = world.mist_settings.use_mist - row = layout.row() - row.prop(world.mist_settings, "falloff") + + layout.prop(world.mist_settings, "falloff") row = layout.row(align=True) row.prop(world.mist_settings, "start") row.prop(world.mist_settings, "depth") - row = layout.row() - row.prop(world.mist_settings, "intensity", text="Minimum Intensity") + + layout.prop(world.mist_settings, "intensity", text="Minimum Intensity") class WORLD_PT_game_physics(WorldButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/properties_mask_common.py b/release/scripts/startup/bl_ui/properties_mask_common.py new file mode 100644 index 00000000000..e40b46fda70 --- /dev/null +++ b/release/scripts/startup/bl_ui/properties_mask_common.py @@ -0,0 +1,317 @@ +# ##### 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> + +# panels get subclassed (not registered directly) +# menus are referenced `as is` + +import bpy +from bpy.types import Menu + + +class MASK_PT_mask: + # subclasses must define... + #~ bl_space_type = 'CLIP_EDITOR' + #~ bl_region_type = 'UI' + bl_label = "Mask Settings" + bl_options = {'DEFAULT_CLOSED'} + + @classmethod + def poll(cls, context): + space_data = context.space_data + return space_data.mask and space_data.mode == 'MASK' + + def draw(self, context): + layout = self.layout + + sc = context.space_data + mask = sc.mask + + col = layout.column(align=True) + col.prop(mask, "frame_start") + col.prop(mask, "frame_end") + + +class MASK_PT_layers: + # subclasses must define... + #~ bl_space_type = 'CLIP_EDITOR' + #~ bl_region_type = 'UI' + bl_label = "Mask Layers" + + @classmethod + def poll(cls, context): + space_data = context.space_data + return space_data.mask and space_data.mode == 'MASK' + + def draw(self, context): + layout = self.layout + + sc = context.space_data + mask = sc.mask + active_layer = mask.layers.active + + rows = 5 if active_layer else 2 + + row = layout.row() + row.template_list(mask, "layers", + mask, "active_layer_index", rows=rows) + + sub = row.column(align=True) + + sub.operator("mask.layer_new", icon='ZOOMIN', text="") + sub.operator("mask.layer_remove", icon='ZOOMOUT', text="") + + if active_layer: + sub.separator() + + props = sub.operator("mask.layer_move", icon='TRIA_UP', text="") + props.direction = 'UP' + + props = sub.operator("mask.layer_move", icon='TRIA_DOWN', text="") + props.direction = 'DOWN' + + layout.prop(active_layer, "name") + + # blending + row = layout.row(align=True) + row.prop(active_layer, "alpha") + row.prop(active_layer, "invert", text="", icon='IMAGE_ALPHA') + + layout.prop(active_layer, "blend") + layout.prop(active_layer, "falloff") + + +class MASK_PT_spline(): + # subclasses must define... + #~ bl_space_type = 'CLIP_EDITOR' + #~ bl_region_type = 'UI' + bl_label = "Active Spline" + + @classmethod + def poll(cls, context): + sc = context.space_data + mask = sc.mask + + if mask and sc.mode == 'MASK': + return mask.layers.active and mask.layers.active.splines.active + + return False + + def draw(self, context): + layout = self.layout + + sc = context.space_data + mask = sc.mask + spline = mask.layers.active.splines.active + + col = layout.column() + col.prop(spline, "weight_interpolation") + + row = col.row() + row.prop(spline, "use_cyclic") + row.prop(spline, "use_fill") + + +class MASK_PT_point(): + # subclasses must define... + #~ bl_space_type = 'CLIP_EDITOR' + #~ bl_region_type = 'UI' + bl_label = "Active Point" + + @classmethod + def poll(cls, context): + sc = context.space_data + mask = sc.mask + + if mask and sc.mode == 'MASK': + mask_layer_active = mask.layers.active + return (mask_layer_active and + mask_layer_active.splines.active_point) + + return False + + def draw(self, context): + layout = self.layout + + sc = context.space_data + mask = sc.mask + point = mask.layers.active.splines.active_point + parent = point.parent + + col = layout.column() + col.prop(point, "handle_type") + + col = layout.column() + # Currently only parenting yo movie clip is allowed, so do not + # ver-oplicate things for now and use single template_ID + #col.template_any_ID(parent, "id", "id_type", text="") + + col.label("Parent:") + col.prop(parent, "id", text="") + + if parent.id_type == 'MOVIECLIP' and parent.id: + clip = parent.id + tracking = clip.tracking + + col.prop_search(parent, "parent", tracking, + "objects", icon='OBJECT_DATA', text="Object:") + + if parent.parent in tracking.objects: + object = tracking.objects[parent.parent] + col.prop_search(parent, "sub_parent", object, + "tracks", icon='ANIM_DATA', text="Track:") + else: + col.prop_search(parent, "sub_parent", tracking, + "tracks", icon='ANIM_DATA', text="Track:") + + +class MASK_PT_display(): + # subclasses must define... + #~ bl_space_type = 'CLIP_EDITOR' + #~ bl_region_type = 'UI' + bl_label = "Mask Display" + bl_options = {'DEFAULT_CLOSED'} + + @classmethod + def poll(cls, context): + space_data = context.space_data + return space_data.mask and space_data.mode == 'MASK' + + def draw(self, context): + layout = self.layout + + space_data = context.space_data + + layout.prop(space_data, "mask_draw_type", text="") + layout.prop(space_data, "show_mask_smooth") + + +class MASK_PT_tools(): + # subclasses must define... + #~ bl_space_type = 'CLIP_EDITOR' + #~ bl_region_type = 'TOOLS' + bl_label = "Mask Tools" + + @classmethod + def poll(cls, context): + space_data = context.space_data + return space_data.mask and space_data.mode == 'MASK' + + def draw(self, context): + layout = self.layout + + col = layout.column(align=True) + col.label(text="Transform:") + col.operator("transform.translate") + col.operator("transform.rotate") + col.operator("transform.resize", text="Scale") + props = col.operator("transform.transform", text="Shrink/Fatten") + props.mode = 'MASK_SHRINKFATTEN' + + col = layout.column(align=True) + col.label(text="Spline:") + col.operator("mask.delete") + col.operator("mask.cyclic_toggle") + col.operator("mask.switch_direction") + + col = layout.column(align=True) + col.label(text="Parenting:") + col.operator("mask.parent_set") + col.operator("mask.parent_clear") + + +class MASK_MT_mask(Menu): + bl_label = "Mask" + + def draw(self, context): + layout = self.layout + + layout.operator("mask.delete") + + layout.separator() + layout.operator("mask.cyclic_toggle") + layout.operator("mask.switch_direction") + layout.operator("mask.normals_make_consistent") + layout.operator("mask.feather_weight_clear") # TODO, better place? + + layout.separator() + layout.operator("mask.parent_clear") + layout.operator("mask.parent_set") + + layout.separator() + layout.menu("MASK_MT_visibility") + layout.menu("MASK_MT_transform") + layout.menu("MASK_MT_animation") + + +class MASK_MT_visibility(Menu): + bl_label = "Show/Hide" + + def draw(self, context): + layout = self.layout + + layout.operator("mask.hide_view_clear", text="Show Hidden") + layout.operator("mask.hide_view_set", text="Hide Selected") + + props = layout.operator("mask.hide_view_set", text="Hide Unselected") + props.unselected = True + + +class MASK_MT_transform(Menu): + bl_label = "Transform" + + def draw(self, context): + layout = self.layout + + layout.operator("transform.translate") + layout.operator("transform.rotate") + layout.operator("transform.resize") + props = layout.operator("transform.transform", text="Shrink/Fatten") + props.mode = 'MASK_SHRINKFATTEN' + + +class MASK_MT_animation(Menu): + bl_label = "Animation" + + def draw(self, context): + layout = self.layout + + layout.operator("mask.shape_key_clear") + layout.operator("mask.shape_key_insert") + layout.operator("mask.shape_key_feather_reset") + layout.operator("mask.shape_key_rekey") + + +class MASK_MT_select(Menu): + bl_label = "Select" + + def draw(self, context): + layout = self.layout + sc = context.space_data + + layout.operator("mask.select_border") + layout.operator("mask.select_circle") + + layout.separator() + + layout.operator("mask.select_all").action = 'TOGGLE' + layout.operator("mask.select_all", text="Inverse").action = 'INVERT' + +if __name__ == "__main__": # only for live edit. + bpy.utils.register_module(__name__) diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py index 6e66bd0d98b..dfc75168d2b 100644 --- a/release/scripts/startup/bl_ui/properties_material.py +++ b/release/scripts/startup/bl_ui/properties_material.py @@ -350,7 +350,6 @@ class MATERIAL_PT_shading(MaterialButtonsPanel, Panel): class MATERIAL_PT_transp(MaterialButtonsPanel, Panel): bl_label = "Transparency" - # bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} @classmethod diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py index 68b261cc1d5..275cb8fab65 100644 --- a/release/scripts/startup/bl_ui/properties_object.py +++ b/release/scripts/startup/bl_ui/properties_object.py @@ -259,7 +259,6 @@ class OBJECT_PT_duplication(ObjectButtonsPanel, Panel): layout.prop(ob, "use_dupli_vertices_rotation", text="Rotation") elif ob.dupli_type == 'FACES': - row = layout.row() row.prop(ob, "use_dupli_faces_scale", text="Scale") row.prop(ob, "dupli_faces_scale", text="Inherit Scale") diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py index 4db056e77a2..7f824d94431 100644 --- a/release/scripts/startup/bl_ui/properties_physics_common.py +++ b/release/scripts/startup/bl_ui/properties_physics_common.py @@ -186,11 +186,8 @@ def effector_weights_ui(self, context, weights): split = layout.split() - col = split.column() - col.prop(weights, "gravity", slider=True) - - col = split.column() - col.prop(weights, "all", slider=True) + split.prop(weights, "gravity", slider=True) + split.prop(weights, "all", slider=True) layout.separator() diff --git a/release/scripts/startup/bl_ui/properties_physics_field.py b/release/scripts/startup/bl_ui/properties_physics_field.py index 65603c65041..70499b18f41 100644 --- a/release/scripts/startup/bl_ui/properties_physics_field.py +++ b/release/scripts/startup/bl_ui/properties_physics_field.py @@ -168,7 +168,6 @@ class PHYSICS_PT_field(PhysicButtonsPanel, Panel): class PHYSICS_PT_collision(PhysicButtonsPanel, Panel): bl_label = "Collision" - #bl_options = {'DEFAULT_CLOSED'} @classmethod def poll(cls, context): diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py index c9c9c36217b..8449d26f6e6 100644 --- a/release/scripts/startup/bl_ui/properties_scene.py +++ b/release/scripts/startup/bl_ui/properties_scene.py @@ -39,6 +39,7 @@ class SCENE_PT_scene(SceneButtonsPanel, Panel): def draw(self, context): layout = self.layout + scene = context.scene layout.prop(scene, "camera") @@ -52,6 +53,7 @@ class SCENE_PT_audio(SceneButtonsPanel, Panel): def draw(self, context): layout = self.layout + scene = context.scene rd = context.scene.render ffmpeg = rd.ffmpeg @@ -81,6 +83,7 @@ class SCENE_PT_unit(SceneButtonsPanel, Panel): def draw(self, context): layout = self.layout + unit = context.scene.unit_settings col = layout.column() diff --git a/release/scripts/startup/bl_ui/properties_texture.py b/release/scripts/startup/bl_ui/properties_texture.py index 5bde9538e54..46a17675c91 100644 --- a/release/scripts/startup/bl_ui/properties_texture.py +++ b/release/scripts/startup/bl_ui/properties_texture.py @@ -116,6 +116,7 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel, Panel): def draw(self, context): layout = self.layout + slot = getattr(context, "texture_slot", None) node = getattr(context, "texture_node", None) space = context.space_data diff --git a/release/scripts/startup/bl_ui/properties_world.py b/release/scripts/startup/bl_ui/properties_world.py index 76d70aafc2e..0b8d8a45a08 100644 --- a/release/scripts/startup/bl_ui/properties_world.py +++ b/release/scripts/startup/bl_ui/properties_world.py @@ -82,6 +82,7 @@ class WORLD_PT_world(WorldButtonsPanel, Panel): def draw(self, context): layout = self.layout + world = context.world row = layout.row() @@ -111,6 +112,7 @@ class WORLD_PT_ambient_occlusion(WorldButtonsPanel, Panel): def draw(self, context): layout = self.layout + light = context.world.light_settings layout.active = light.use_ambient_occlusion @@ -130,6 +132,7 @@ class WORLD_PT_environment_lighting(WorldButtonsPanel, Panel): def draw(self, context): layout = self.layout + light = context.world.light_settings layout.active = light.use_environment_light @@ -149,6 +152,7 @@ class WORLD_PT_indirect_lighting(WorldButtonsPanel, Panel): def draw(self, context): layout = self.layout + light = context.world.light_settings layout.active = light.use_indirect_light and light.gather_method == 'APPROXIMATE' @@ -167,6 +171,7 @@ class WORLD_PT_gather(WorldButtonsPanel, Panel): def draw(self, context): layout = self.layout + light = context.world.light_settings layout.active = light.use_ambient_occlusion or light.use_environment_light or light.use_indirect_light @@ -221,6 +226,7 @@ class WORLD_PT_mist(WorldButtonsPanel, Panel): def draw(self, context): layout = self.layout + world = context.world layout.active = world.mist_settings.use_mist @@ -250,6 +256,7 @@ class WORLD_PT_stars(WorldButtonsPanel, Panel): def draw(self, context): layout = self.layout + world = context.world layout.active = world.star_settings.use_stars diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index ac724518e85..efac7a66086 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -115,11 +115,11 @@ class CLIP_HT_header(Header): sub.menu("CLIP_MT_view") if clip: - sub.menu("CLIP_MT_select") - sub.menu("CLIP_MT_clip") - sub.menu("CLIP_MT_mask") + sub.menu("MASK_MT_select") + sub.menu("CLIP_MT_clip") # XXX - remove? + sub.menu("MASK_MT_mask") else: - sub.menu("CLIP_MT_clip") + sub.menu("CLIP_MT_clip") # XXX - remove? row = layout.row() row.template_ID(sc, "clip", open="clip.open") @@ -161,16 +161,6 @@ class CLIP_PT_clip_view_panel: return clip and sc.view == 'CLIP' -class CLIP_PT_mask_view_panel: - - @classmethod - def poll(cls, context): - sc = context.space_data - clip = sc.clip - - return clip and sc.view == 'CLIP' and sc.mode == 'MASKEDIT' - - class CLIP_PT_tracking_panel: @classmethod @@ -197,10 +187,11 @@ class CLIP_PT_tools_marker(CLIP_PT_tracking_panel, Panel): bl_label = "Marker" def draw(self, context): + layout = self.layout + sc = context.space_data clip = sc.clip settings = clip.tracking.settings - layout = self.layout col = layout.column(align=True) col.operator("clip.add_marker_move") @@ -241,9 +232,9 @@ class CLIP_PT_tools_marker(CLIP_PT_tracking_panel, Panel): col.label(text="Tracker:") col.prop(settings, "default_motion_model") - col.prop(settings, "default_use_brute") - col.prop(settings, "default_use_normalization") - col.prop(settings, "default_use_mask") + col.prop(settings, "use_default_brute") + col.prop(settings, "use_default_normalization") + col.prop(settings, "use_default_mask") col.prop(settings, "default_correlation_min") col.separator() @@ -302,6 +293,7 @@ class CLIP_PT_tools_solve(CLIP_PT_tracking_panel, Panel): def draw(self, context): layout = self.layout + clip = context.space_data.clip tracking = clip.tracking settings = tracking.settings @@ -422,34 +414,6 @@ class CLIP_PT_tools_object(CLIP_PT_reconstruction_panel, Panel): col.prop(settings, "object_distance") -class CLIP_PT_tools_mask(CLIP_PT_mask_view_panel, Panel): - bl_space_type = 'CLIP_EDITOR' - bl_region_type = 'TOOLS' - bl_label = "Mask Tools" - - def draw(self, context): - layout = self.layout - - col = layout.column(align=True) - col.label(text="Transform:") - col.operator("transform.translate") - col.operator("transform.rotate") - col.operator("transform.resize", text="Scale") - props = col.operator("transform.transform", text="Shrink/Fatten") - props.mode = 'MASK_SHRINKFATTEN' - - col = layout.column(align=True) - col.label(text="Spline:") - col.operator("mask.delete") - col.operator("mask.cyclic_toggle") - col.operator("mask.switch_direction") - - col = layout.column(align=True) - col.label(text="Parenting:") - col.operator("mask.parent_set") - col.operator("mask.parent_clear") - - class CLIP_PT_tools_grease_pencil(Panel): bl_space_type = 'CLIP_EDITOR' bl_region_type = 'TOOLS' @@ -465,7 +429,7 @@ class CLIP_PT_tools_grease_pencil(Panel): if sc.mode == 'DISTORTION': return sc.view == 'CLIP' - elif sc.mode == 'MASKEDIT': + elif sc.mode == 'MASK': return True return False @@ -520,6 +484,7 @@ class CLIP_PT_track(CLIP_PT_tracking_panel, Panel): def draw(self, context): layout = self.layout + sc = context.space_data clip = context.space_data.clip act_track = clip.tracking.tracks.active @@ -586,6 +551,7 @@ class CLIP_PT_track_settings(CLIP_PT_tracking_panel, Panel): def draw(self, context): layout = self.layout + clip = context.space_data.clip settings = clip.tracking.settings @@ -661,136 +627,6 @@ class CLIP_PT_tracking_camera(Panel): col.prop(clip.tracking.camera, "k3") -class CLIP_PT_mask_layers(Panel): - bl_space_type = 'CLIP_EDITOR' - bl_region_type = 'UI' - bl_label = "Mask Layers" - - @classmethod - def poll(cls, context): - sc = context.space_data - - return sc.mask and sc.mode == 'MASKEDIT' - - def draw(self, context): - layout = self.layout - - sc = context.space_data - mask = sc.mask - active_layer = mask.layers.active - - rows = 5 if active_layer else 2 - - row = layout.row() - row.template_list(mask, "layers", - mask, "active_layer_index", rows=rows) - - sub = row.column(align=True) - - sub.operator("mask.layer_new", icon='ZOOMIN', text="") - sub.operator("mask.layer_remove", icon='ZOOMOUT', text="") - - if active_layer: - sub.separator() - - props = sub.operator("mask.layer_move", icon='TRIA_UP', text="") - props.direction = 'UP' - - props = sub.operator("mask.layer_move", icon='TRIA_DOWN', text="") - props.direction = 'DOWN' - - layout.prop(active_layer, "name") - - # blending - row = layout.row(align=True) - row.prop(active_layer, "alpha") - row.prop(active_layer, "invert", text="", icon='IMAGE_ALPHA') - - layout.prop(active_layer, "blend") - layout.prop(active_layer, "falloff") - - -class CLIP_PT_active_mask_spline(Panel): - bl_space_type = 'CLIP_EDITOR' - bl_region_type = 'UI' - bl_label = "Active Spline" - - @classmethod - def poll(cls, context): - sc = context.space_data - mask = sc.mask - - if mask and sc.mode == 'MASKEDIT': - return mask.layers.active and mask.layers.active.splines.active - - return False - - def draw(self, context): - layout = self.layout - - sc = context.space_data - mask = sc.mask - spline = mask.layers.active.splines.active - - col = layout.column() - col.prop(spline, "weight_interpolation") - rowsub = col.row() - rowsub.prop(spline, "use_cyclic") - rowsub.prop(spline, "use_fill") - - -class CLIP_PT_active_mask_point(Panel): - bl_space_type = 'CLIP_EDITOR' - bl_region_type = 'UI' - bl_label = "Active Point" - - @classmethod - def poll(cls, context): - sc = context.space_data - mask = sc.mask - - if mask and sc.mode == 'MASKEDIT': - mask_layer_active = mask.layers.active - return (mask_layer_active and - mask_layer_active.splines.active_point) - - return False - - def draw(self, context): - layout = self.layout - - sc = context.space_data - mask = sc.mask - point = mask.layers.active.splines.active_point - parent = point.parent - - col = layout.column() - col.prop(point, "handle_type") - - col = layout.column() - # Currently only parenting yo movie clip is allowed, so do not - # ver-oplicate things for now and use single template_ID - #col.template_any_ID(parent, "id", "id_type", text="") - - col.label("Parent:") - col.prop(parent, "id", text="") - - if parent.id_type == 'MOVIECLIP' and parent.id: - clip = parent.id - tracking = clip.tracking - - col.prop_search(parent, "parent", tracking, - "objects", icon='OBJECT_DATA', text="Object:") - - if parent.parent in tracking.objects: - object = tracking.objects[parent.parent] - col.prop_search(parent, "sub_parent", object, - "tracks", icon='ANIM_DATA', text="Track:") - else: - col.prop_search(parent, "sub_parent", tracking, - "tracks", icon='ANIM_DATA', text="Track:") - - class CLIP_PT_display(CLIP_PT_clip_view_panel, Panel): bl_space_type = 'CLIP_EDITOR' bl_region_type = 'UI' @@ -835,29 +671,6 @@ class CLIP_PT_display(CLIP_PT_clip_view_panel, Panel): row = col.row() row.prop(clip, "display_aspect", text="") - if sc.mode == 'MASKEDIT': - col = layout.column() - col.prop(sc, "mask_draw_type", text="") - col.prop(sc, "show_mask_smooth") - - -# TODO, move into its own file -class CLIP_PT_mask(CLIP_PT_mask_view_panel, Panel): - bl_space_type = 'CLIP_EDITOR' - bl_region_type = 'UI' - bl_label = "Mask Settings" - bl_options = {'DEFAULT_CLOSED'} - - def draw(self, context): - layout = self.layout - - sc = context.space_data - mask = sc.mask - - col = layout.column(align=True) - col.prop(mask, "frame_start") - col.prop(mask, "frame_end") - class CLIP_PT_marker_display(CLIP_PT_clip_view_panel, Panel): bl_space_type = 'CLIP_EDITOR' @@ -868,7 +681,7 @@ class CLIP_PT_marker_display(CLIP_PT_clip_view_panel, Panel): def poll(cls, context): sc = context.space_data - return sc.mode != 'MASKEDIT' + return sc.mode != 'MASK' def draw(self, context): layout = self.layout @@ -973,6 +786,7 @@ class CLIP_PT_proxy(CLIP_PT_clip_view_panel, Panel): def draw(self, context): layout = self.layout + sc = context.space_data clip = sc.clip @@ -1029,7 +843,7 @@ class CLIP_PT_footage(CLIP_PT_clip_view_panel, Panel): col = layout.column() col.template_movieclip(sc, "clip", compact=True) - col.prop(clip, "start_frame") + col.prop(clip, "frame_start") col.prop(clip, "frame_offset") @@ -1050,6 +864,7 @@ class CLIP_MT_view(Menu): def draw(self, context): layout = self.layout + sc = context.space_data if sc.view == 'CLIP': @@ -1213,30 +1028,18 @@ class CLIP_MT_select(Menu): def draw(self, context): layout = self.layout - sc = context.space_data - - if sc.mode == 'MASKEDIT': - layout.operator("mask.select_border") - layout.operator("mask.select_circle") - - layout.separator() - layout.operator("mask.select_all" - ).action = 'TOGGLE' - layout.operator("mask.select_all", - text="Inverse").action = 'INVERT' - else: - layout.operator("clip.select_border") - layout.operator("clip.select_circle") + layout.operator("clip.select_border") + layout.operator("clip.select_circle") - layout.separator() + layout.separator() - layout.operator("clip.select_all" - ).action = 'TOGGLE' - layout.operator("clip.select_all", - text="Inverse").action = 'INVERT' + layout.operator("clip.select_all" + ).action = 'TOGGLE' + layout.operator("clip.select_all", + text="Inverse").action = 'INVERT' - layout.menu("CLIP_MT_select_grouped") + layout.menu("CLIP_MT_select_grouped") class CLIP_MT_select_grouped(Menu): @@ -1280,30 +1083,6 @@ class CLIP_MT_tracking_specials(Menu): props.action = 'UNLOCK' -class CLIP_MT_mask(Menu): - bl_label = "Mask" - - def draw(self, context): - layout = self.layout - - layout.operator("mask.delete") - - layout.separator() - layout.operator("mask.cyclic_toggle") - layout.operator("mask.switch_direction") - layout.operator("mask.normals_make_consistent") - layout.operator("mask.feather_weight_clear") # TODO, better place? - - layout.separator() - layout.operator("mask.parent_clear") - layout.operator("mask.parent_set") - - layout.separator() - layout.menu("CLIP_MT_mask_visibility") - layout.menu("CLIP_MT_mask_transform") - layout.menu("CLIP_MT_mask_animation") - - class CLIP_MT_select_mode(Menu): bl_label = "Select Mode" @@ -1315,44 +1094,6 @@ class CLIP_MT_select_mode(Menu): layout.operator_enum("clip.mode_set", "mode") -class CLIP_MT_mask_visibility(Menu): - bl_label = "Show/Hide" - - def draw(self, context): - layout = self.layout - - layout.operator("mask.hide_view_clear", text="Show Hidden") - layout.operator("mask.hide_view_set", text="Hide Selected") - - props = layout.operator("mask.hide_view_set", text="Hide Unselected") - props.unselected = True - - -class CLIP_MT_mask_transform(Menu): - bl_label = "Transform" - - def draw(self, context): - layout = self.layout - - layout.operator("transform.translate") - layout.operator("transform.rotate") - layout.operator("transform.resize") - props = layout.operator("transform.transform", text="Shrink/Fatten") - props.mode = 'MASK_SHRINKFATTEN' - - -class CLIP_MT_mask_animation(Menu): - bl_label = "Animation" - - def draw(self, context): - layout = self.layout - - layout.operator("mask.shape_key_clear") - layout.operator("mask.shape_key_insert") - layout.operator("mask.shape_key_feather_reset") - layout.operator("mask.shape_key_rekey") - - class CLIP_MT_camera_presets(Menu): """Predefined tracking camera intrinsics""" bl_label = "Camera Presets" @@ -1394,5 +1135,49 @@ class CLIP_MT_stabilize_2d_specials(Menu): layout.operator("clip.stabilize_2d_select") + +# ----------------------------------------------------------------------------- +# Mask (similar code in space_image.py, keep in sync) + + +from bl_ui.properties_mask_common import (MASK_PT_mask, + MASK_PT_layers, + MASK_PT_spline, + MASK_PT_point, + MASK_PT_display, + MASK_PT_tools) + + +class CLIP_PT_mask(MASK_PT_mask, Panel): + bl_space_type = 'CLIP_EDITOR' + bl_region_type = 'UI' + + +class CLIP_PT_mask_layers(MASK_PT_layers, Panel): + bl_space_type = 'CLIP_EDITOR' + bl_region_type = 'UI' + + +class CLIP_PT_mask_display(MASK_PT_display, Panel): + bl_space_type = 'CLIP_EDITOR' + bl_region_type = 'UI' + + +class CLIP_PT_active_mask_spline(MASK_PT_spline, Panel): + bl_space_type = 'CLIP_EDITOR' + bl_region_type = 'UI' + + +class CLIP_PT_active_mask_point(MASK_PT_point, Panel): + bl_space_type = 'CLIP_EDITOR' + bl_region_type = 'UI' + + +class CLIP_PT_tools_mask(MASK_PT_tools, Panel): + bl_space_type = 'CLIP_EDITOR' + bl_region_type = 'TOOLS' + +# --- end mask --- + if __name__ == "__main__": # only for live edit. bpy.utils.register_module(__name__) diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index cfe5d66740c..af39ce3437a 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -27,7 +27,7 @@ class ImagePaintPanel(UnifiedPaintPanel): bl_region_type = 'UI' -class BrushButtonsPanel(): +class BrushButtonsPanel: bl_space_type = 'IMAGE_EDITOR' bl_region_type = 'UI' @@ -153,10 +153,6 @@ class IMAGE_MT_image(Menu): if ima.source in {'FILE', 'GENERATED'} and ima.type != 'OPEN_EXR_MULTILAYER': layout.operator("image.pack", text="Pack As PNG").as_png = True - if not context.tool_settings.use_uv_sculpt: - layout.separator() - layout.prop(sima, "use_image_paint") - layout.separator() @@ -217,6 +213,7 @@ class IMAGE_MT_uvs_snap(Menu): def draw(self, context): layout = self.layout + layout.operator_context = 'EXEC_REGION_WIN' layout.operator("uv.snap_selected", text="Selected to Pixels").target = 'PIXELS' @@ -234,6 +231,7 @@ class IMAGE_MT_uvs_mirror(Menu): def draw(self, context): layout = self.layout + layout.operator_context = 'EXEC_REGION_WIN' layout.operator("transform.mirror", text="X Axis").constraint_axis[0] = True @@ -353,10 +351,12 @@ class IMAGE_HT_header(Header): ima = sima.image iuser = sima.image_user toolsettings = context.tool_settings + mode = sima.mode show_render = sima.show_render # show_paint = sima.show_paint show_uvedit = sima.show_uvedit + show_maskedit = sima.show_maskedit row = layout.row(align=True) row.template_header() @@ -381,6 +381,8 @@ class IMAGE_HT_header(Header): if not show_render: layout.prop(sima, "use_image_pin", text="") + layout.prop(sima, "mode", text="") + # uv editing if show_uvedit: uvedit = sima.uv_editor @@ -406,13 +408,18 @@ class IMAGE_HT_header(Header): mesh = context.edit_object.data layout.prop_search(mesh.uv_textures, "active", mesh, "uv_textures", text="") + if show_maskedit: + row = layout.row() + row.template_ID(sima, "mask", new="mask.new") + + # reused for mask + uvedit = sima.uv_editor + layout.prop(uvedit, "pivot_point", text="", icon_only=True) + if ima: # layers layout.template_image_layers(ima, iuser) - # painting - layout.prop(sima, "use_image_paint", text="") - # draw options row = layout.row(align=True) row.prop(sima, "draw_channels", text="", expand=True) @@ -423,7 +430,7 @@ class IMAGE_HT_header(Header): if ima.type == 'COMPOSITE' and ima.source in {'MOVIE', 'SEQUENCE'}: row.operator("image.play_composite", icon='PLAY') - if show_uvedit or sima.use_image_paint: + if show_uvedit or show_maskedit or mode == 'PAINT': layout.prop(sima, "use_realtime_update", text="", icon_only=True, icon='LOCKED') @@ -834,20 +841,57 @@ class IMAGE_UV_sculpt(Panel, ImagePaintPanel): self.prop_unified_strength(row, context, brush, "strength", slider=True, text="Strength") self.prop_unified_strength(row, context, brush, "use_pressure_strength") - split = layout.split() - col = split.column() - + col = layout.column() col.prop(toolsettings, "uv_sculpt_lock_borders") col.prop(toolsettings, "uv_sculpt_all_islands") - - split = layout.split() - col = split.column() - col.prop(toolsettings, "uv_sculpt_tool") if toolsettings.uv_sculpt_tool == 'RELAX': col.prop(toolsettings, "uv_relax_method") +# ----------------------------------------------------------------------------- +# Mask (similar code in space_clip.py, keep in sync) +# note! - panel placement does _not_ fit well with image panels... need to fix + +from bl_ui.properties_mask_common import (MASK_PT_mask, + MASK_PT_layers, + MASK_PT_spline, + MASK_PT_point, + MASK_PT_display, + MASK_PT_tools) + + +class IMAGE_PT_mask(MASK_PT_mask, Panel): + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'PREVIEW' + + +class IMAGE_PT_mask_layers(MASK_PT_layers, Panel): + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'PREVIEW' + + +class IMAGE_PT_mask_display(MASK_PT_display, Panel): + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'PREVIEW' + + +class IMAGE_PT_active_mask_spline(MASK_PT_spline, Panel): + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'PREVIEW' + + +class IMAGE_PT_active_mask_point(MASK_PT_point, Panel): + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'PREVIEW' + + +class IMAGE_PT_tools_mask(MASK_PT_tools, Panel): + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'UI' # is 'TOOLS' in the clip editor + +# --- end mask --- + if __name__ == "__main__": # only for live edit. bpy.utils.register_module(__name__) diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py index 40c7b632247..adcf5a9e9df 100644 --- a/release/scripts/startup/bl_ui/space_node.py +++ b/release/scripts/startup/bl_ui/space_node.py @@ -94,6 +94,10 @@ class NODE_HT_header(Header): if toolsettings.snap_node_element != 'INCREMENT': row.prop(toolsettings, "snap_target", text="") + row = layout.row(align=True) + row.operator("node.clipboard_copy", text="", icon='COPYDOWN') + row.operator("node.clipboard_paste", text="", icon='PASTEDOWN') + layout.template_running_jobs() @@ -135,7 +139,8 @@ class NODE_MT_select(Menu): layout.operator("node.select_border") layout.separator() - layout.operator("node.select_all") + layout.operator("node.select_all").action = 'TOGGLE' + layout.operator("node.select_all", text="Inverse").action = 'INVERT' layout.operator("node.select_linked_from") layout.operator("node.select_linked_to") layout.operator("node.select_same_type") @@ -226,16 +231,21 @@ class NODE_PT_quality(bpy.types.Panel): def draw(self, context): layout = self.layout + snode = context.space_data tree = snode.node_tree - layout.prop(tree, "render_quality", text="Render") - layout.prop(tree, "edit_quality", text="Edit") - layout.prop(tree, "chunk_size") - layout.prop(tree, "use_opencl") - layout.prop(tree, "two_pass") - layout.prop(snode, "show_highlight") - + col = layout.column() + col.prop(tree, "render_quality", text="Render") + col.prop(tree, "edit_quality", text="Edit") + col.prop(tree, "chunk_size") + + col = layout.column() + col.prop(tree, "use_opencl") + col.prop(tree, "two_pass") + col.prop(snode, "show_highlight") + col.prop(snode, "use_hidden_preview") + class NODE_MT_node_color_presets(Menu): """Predefined node color""" diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index a71a2870bee..d099db1645b 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -184,6 +184,7 @@ class SEQUENCER_MT_add(Menu): def draw(self, context): layout = self.layout + layout.operator_context = 'INVOKE_REGION_WIN' if len(bpy.data.scenes) > 10: @@ -216,6 +217,7 @@ class SEQUENCER_MT_add_effect(Menu): def draw(self, context): layout = self.layout + layout.operator_context = 'INVOKE_REGION_WIN' layout.operator("sequencer.effect_strip_add", text="Add").type = 'ADD' @@ -834,6 +836,7 @@ class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, Panel): def draw(self, context): layout = self.layout + render = context.scene.render col = layout.column() diff --git a/release/scripts/startup/bl_ui/space_text.py b/release/scripts/startup/bl_ui/space_text.py index 9c24e48300a..eca9bc22db9 100644 --- a/release/scripts/startup/bl_ui/space_text.py +++ b/release/scripts/startup/bl_ui/space_text.py @@ -302,6 +302,7 @@ class TEXT_MT_toolbox(Menu): def draw(self, context): layout = self.layout + layout.operator_context = 'INVOKE_DEFAULT' layout.operator("text.cut") diff --git a/release/scripts/startup/bl_ui/space_time.py b/release/scripts/startup/bl_ui/space_time.py index 0f573c46d69..ed1d2a0ae24 100644 --- a/release/scripts/startup/bl_ui/space_time.py +++ b/release/scripts/startup/bl_ui/space_time.py @@ -160,8 +160,7 @@ class TIME_MT_frame(Menu): layout.separator() - sub = layout.row() - sub.menu("TIME_MT_autokey") + layout.menu("TIME_MT_autokey") class TIME_MT_playback(Menu): diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 66382e72a4d..e443c7804a6 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -79,6 +79,7 @@ class USERPREF_HT_header(Header): def draw(self, context): layout = self.layout + layout.template_header(menus=False) userpref = context.user_preferences @@ -137,6 +138,7 @@ class USERPREF_MT_splash(Menu): def draw(self, context): layout = self.layout + split = layout.split() row = split.row() row.label("") @@ -850,6 +852,7 @@ class USERPREF_MT_ndof_settings(Menu): def draw(self, context): layout = self.layout + input_prefs = context.user_preferences.inputs layout.separator() @@ -979,6 +982,7 @@ class USERPREF_MT_addons_dev_guides(Menu): # menu to open web-pages with addons development guides def draw(self, context): layout = self.layout + layout.operator("wm.url_open", text="API Concepts", icon='URL').url = "http://wiki.blender.org/index.php/Dev:2.5/Py/API/Intro" layout.operator("wm.url_open", text="Addon Guidelines", icon='URL').url = "http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Guidelines/Addons" layout.operator("wm.url_open", text="How to share your addon", icon='URL').url = "http://wiki.blender.org/index.php/Dev:Py/Sharing" @@ -1004,10 +1008,10 @@ class USERPREF_PT_addons(Panel): @staticmethod def is_user_addon(mod, user_addon_paths): if not user_addon_paths: - user_script_path = bpy.utils.user_script_path() - if user_script_path is not None: - user_addon_paths.append(os.path.join(user_script_path, "addons")) - user_addon_paths.append(os.path.join(bpy.utils.resource_path('USER'), "scripts", "addons")) + for path in (bpy.utils.script_path_user(), + bpy.utils.script_path_pref()): + if path is not None: + user_addon_paths.append(os.path.join(path, "addons")) for path in user_addon_paths: if bpy.path.is_subdir(mod.__file__, path): diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index a876c607cd3..2d9c9467a01 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -64,28 +64,29 @@ class VIEW3D_HT_header(Header): layout.template_header_3D() if obj: + mode = obj.mode # Particle edit - if obj.mode == 'PARTICLE_EDIT': + if mode == 'PARTICLE_EDIT': row.prop(toolsettings.particle_edit, "select_mode", text="", expand=True) # Occlude geometry - if view.viewport_shade not in {'BOUNDBOX', 'WIREFRAME'} and (obj.mode == 'PARTICLE_EDIT' or (obj.mode == 'EDIT' and obj.type == 'MESH')): + if view.viewport_shade not in {'BOUNDBOX', 'WIREFRAME'} and (mode == 'PARTICLE_EDIT' or (mode == 'EDIT' and obj.type == 'MESH')): row.prop(view, "use_occlude_geometry", text="") # Proportional editing - if obj.mode in {'EDIT', 'PARTICLE_EDIT'}: + if mode in {'EDIT', 'PARTICLE_EDIT'}: row = layout.row(align=True) row.prop(toolsettings, "proportional_edit", text="", icon_only=True) if toolsettings.proportional_edit != 'DISABLED': row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True) - elif obj.mode == 'OBJECT': + elif mode == 'OBJECT': row = layout.row(align=True) row.prop(toolsettings, "use_proportional_edit_objects", text="", icon_only=True) if toolsettings.use_proportional_edit_objects: row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True) # Snap - if not obj or obj.mode not in {'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT'}: + if not obj or mode not in {'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT'}: snap_element = toolsettings.snap_element row = layout.row(align=True) row.prop(toolsettings, "use_snap", text="") @@ -93,9 +94,9 @@ class VIEW3D_HT_header(Header): if snap_element != 'INCREMENT': row.prop(toolsettings, "snap_target", text="") if obj: - if obj.mode in {'OBJECT', 'POSE'} and snap_element != 'VOLUME': + if mode in {'OBJECT', 'POSE'} and snap_element != 'VOLUME': row.prop(toolsettings, "use_snap_align_rotation", text="") - elif obj.mode == 'EDIT': + elif mode == 'EDIT': row.prop(toolsettings, "use_snap_self", text="") if snap_element == 'VOLUME': @@ -110,7 +111,7 @@ class VIEW3D_HT_header(Header): props.animation = True # Pose - if obj and obj.mode == 'POSE': + if obj and mode == 'POSE': row = layout.row(align=True) row.operator("pose.copy", text="", icon='COPYDOWN') row.operator("pose.paste", text="", icon='PASTEDOWN') @@ -176,11 +177,12 @@ class VIEW3D_MT_transform(VIEW3D_MT_transform_base): # Object-specific extensions to Transform menu class VIEW3D_MT_transform_object(VIEW3D_MT_transform_base): def draw(self, context): + layout = self.layout + # base menu VIEW3D_MT_transform_base.draw(self, context) # object-specific option follow... - layout = self.layout layout.separator() layout.operator("transform.translate", text="Move Texture Space").texture_space = True @@ -212,11 +214,12 @@ class VIEW3D_MT_transform_object(VIEW3D_MT_transform_base): # Armature EditMode extensions to Transform menu class VIEW3D_MT_transform_armature(VIEW3D_MT_transform_base): def draw(self, context): + layout = self.layout + # base menu VIEW3D_MT_transform_base.draw(self, context) # armature specific extensions follow... - layout = self.layout layout.separator() obj = context.object @@ -429,18 +432,23 @@ class VIEW3D_MT_view_align_selected(Menu): props = layout.operator("view3d.viewnumpad", text="Top") props.align_active = True props.type = 'TOP' + props = layout.operator("view3d.viewnumpad", text="Bottom") props.align_active = True props.type = 'BOTTOM' + props = layout.operator("view3d.viewnumpad", text="Front") props.align_active = True props.type = 'FRONT' + props = layout.operator("view3d.viewnumpad", text="Back") props.align_active = True props.type = 'BACK' + props = layout.operator("view3d.viewnumpad", text="Right") props.align_active = True props.type = 'RIGHT' + props = layout.operator("view3d.viewnumpad", text="Left") props.align_active = True props.type = 'LEFT' @@ -1191,6 +1199,7 @@ class VIEW3D_MT_vertex_group(Menu): def draw(self, context): layout = self.layout + layout.operator_context = 'EXEC_AREA' layout.operator("object.vertex_group_assign", text="Assign to New Group").new = True @@ -1349,6 +1358,7 @@ class VIEW3D_MT_particle_specials(Menu): def draw(self, context): layout = self.layout + particle_edit = context.tool_settings.particle_edit layout.operator("particle.rekey") @@ -1792,6 +1802,7 @@ class VIEW3D_MT_edit_mesh_edges(Menu): def draw(self, context): layout = self.layout + layout.operator_context = 'INVOKE_REGION_WIN' layout.operator("mesh.edge_face_add") @@ -1839,6 +1850,7 @@ class VIEW3D_MT_edit_mesh_faces(Menu): def draw(self, context): layout = self.layout + layout.operator_context = 'INVOKE_REGION_WIN' layout.operator("mesh.flip_normals") @@ -2632,6 +2644,7 @@ class VIEW3D_PT_etch_a_ton(Panel): def draw(self, context): layout = self.layout + toolsettings = context.scene.tool_settings col = layout.column() diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index f3365da6ad6..ac962ab5097 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -1124,6 +1124,7 @@ class VIEW3D_MT_tools_projectpaint_clone(Menu): def draw(self, context): layout = self.layout + for i, tex in enumerate(context.active_object.data.uv_textures): props = layout.operator("wm.context_set_int", text=tex.name) props.data_path = "active_object.data.uv_texture_clone_index" diff --git a/release/scripts/templates/ui_panel.py b/release/scripts/templates/ui_panel.py new file mode 100644 index 00000000000..095fa105efa --- /dev/null +++ b/release/scripts/templates/ui_panel.py @@ -0,0 +1,56 @@ +import bpy + + +class LayoutDemoPanel(bpy.types.Panel): + """Creates a Panel in the scene context of the properties editor""" + bl_label = "Layout Demo" + bl_idname = "SCENE_PT_layout" + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "scene" + + def draw(self, context): + layout = self.layout + + sc = context.scene + + #Create a simple row. + layout.label(text=" Simple Row:") + + row = layout.row() + row.prop(sc, "frame_start") + row.prop(sc, "frame_end") + + #Create an row where the buttons are aligned to each other. + layout.label(text=" Aligned Row") + + row = layout.row(align=True) + row.prop(sc, "frame_start") + row.prop(sc, "frame_end") + + #Create two columns, by using a split layout. + split = layout.split() + + # First column + col = split.column() + col.label(text="Column One:") + col.prop(sc, "frame_end") + col.prop(sc, "frame_start") + + # Second column, aligned + col = split.column(align=True) + col.label(text="Column Two") + col.prop(sc, "frame_start") + col.prop(sc, "frame_end") + + +def register(): + bpy.utils.register_class(LayoutDemoPanel) + + +def unregister(): + bpy.utils.unregister_class(LayoutDemoPanel) + + +if __name__ == "__main__": + register() |