ran through pep8 checker

This commit is contained in:
2010-09-07 15:17:42 +00:00
parent e53bbc7ab7
commit 115b256738
64 changed files with 320 additions and 370 deletions

View File

@@ -20,6 +20,7 @@
# <pep8 compliant> # <pep8 compliant>
def print_help(targets): def print_help(targets):
print("CMake quicky wrapper, no valid targets given.") print("CMake quicky wrapper, no valid targets given.")
print(" * targets can contain a subset of the full target name.") print(" * targets can contain a subset of the full target name.")
@@ -36,11 +37,11 @@ def print_help(targets):
for t in targets: for t in targets:
print(" %s" % t) print(" %s" % t)
print("...exiting") print("...exiting")
def main(): def main():
targets = set() targets = set()
# collect targets # collect targets
file = open("Makefile", "r") file = open("Makefile", "r")
for line in file: for line in file:
@@ -54,13 +55,12 @@ def main():
line = line.split(":", 1)[0] line = line.split(":", 1)[0]
if "/" in line: # cmake terget options, dont need these if "/" in line: # cmake terget options, dont need these
continue continue
targets.add(line) targets.add(line)
file.close() file.close()
# remove cmake targets # remove cmake targets
bad = set([ bad = set([
"help", "help",
@@ -75,9 +75,8 @@ def main():
"depend", "depend",
"cmake_check_build_system", "cmake_check_build_system",
]) ])
targets -= set(bad)
targets -= set(bad)
# parse args # parse args
targets = list(targets) targets = list(targets)
@@ -106,7 +105,7 @@ def main():
print(" %s" % t) print(" %s" % t)
print("...aborting.") print("...aborting.")
return return
# execute # execute
cmd = "make %s %s blender/fast" % (" ".join(args), " ".join(targets_new)) cmd = "make %s %s blender/fast" % (" ".join(args), " ".join(targets_new))
print("cmake building with targets: %s" % " ".join(targets_new)) print("cmake building with targets: %s" % " ".join(targets_new))

View File

@@ -91,25 +91,25 @@ while lines:
l = lines.pop(0) l = lines.pop(0)
if l.startswith("Environment Variables:"): if l.startswith("Environment Variables:"):
fw('.SH "ENVIRONMENT VARIABLES"\n') fw('.SH "ENVIRONMENT VARIABLES"\n')
elif l.endswith(":"): # one line elif l.endswith(":"): # one line
fw('.SS "%s"\n\n' % l) fw('.SS "%s"\n\n' % l)
elif l.startswith("-") or l.startswith("/"): # can be multi line elif l.startswith("-") or l.startswith("/"): # can be multi line
fw('.TP\n') fw('.TP\n')
fw('.B %s\n' % man_format(l)) fw('.B %s\n' % man_format(l))
while lines: while lines:
# line with no # line with no
if lines[0].strip() and len(lines[0].lstrip()) == len(lines[0]): # no white space if lines[0].strip() and len(lines[0].lstrip()) == len(lines[0]): # no white space
break break
if not l: # second blank line if not l: # second blank line
fw('.IP\n') fw('.IP\n')
else: else:
fw('.br\n') fw('.br\n')
l = lines.pop(0) l = lines.pop(0)
l = l[1:] # remove first whitespace (tab) l = l[1:] # remove first whitespace (tab)
fw('%s\n' % man_format(l)) fw('%s\n' % man_format(l))

View File

@@ -60,7 +60,6 @@ def add_object_data(context, obdata, operator=None):
if context.space_data and context.space_data.type == 'VIEW_3D': if context.space_data and context.space_data.type == 'VIEW_3D':
base.layers_from_view(context.space_data) base.layers_from_view(context.space_data)
obj_new.matrix_world = add_object_align_init(context, operator) obj_new.matrix_world = add_object_align_init(context, operator)
obj_act = scene.objects.active obj_act = scene.objects.active
@@ -69,10 +68,10 @@ def add_object_data(context, obdata, operator=None):
bpy.ops.object.mode_set(mode='OBJECT') bpy.ops.object.mode_set(mode='OBJECT')
obj_act.select = True obj_act.select = True
scene.update() # apply location scene.update() # apply location
#scene.objects.active = obj_new #scene.objects.active = obj_new
bpy.ops.object.join() # join into the active. bpy.ops.object.join() # join into the active.
bpy.ops.object.mode_set(mode='EDIT') bpy.ops.object.mode_set(mode='EDIT')
else: else:

View File

@@ -40,7 +40,7 @@ def read_blend_rend_chunk(path):
head = blendfile.read(7) head = blendfile.read(7)
if head[0:2] == b'\x1f\x8b': # gzip magic if head[0:2] == b'\x1f\x8b': # gzip magic
import gzip import gzip
blendfile.close() blendfile.close()
blendfile = gzip.open(path, 'rb') blendfile = gzip.open(path, 'rb')
@@ -57,7 +57,7 @@ def read_blend_rend_chunk(path):
is_big_endian = (blendfile.read(1) == b'V') is_big_endian = (blendfile.read(1) == b'V')
# Now read the bhead chunk!!! # Now read the bhead chunk!!!
blendfile.read(3) # skip the version blendfile.read(3) # skip the version
scenes = [] scenes = []

View File

@@ -50,7 +50,6 @@ def _main():
pydoc.Helper.getline = lambda self, prompt: None pydoc.Helper.getline = lambda self, prompt: None
pydoc.TextDoc.use_bold = lambda self, text: text pydoc.TextDoc.use_bold = lambda self, text: text
# if "-d" in sys.argv: # Enable this to measure startup speed # if "-d" in sys.argv: # Enable this to measure startup speed
if 0: if 0:
import cProfile import cProfile

View File

@@ -164,7 +164,7 @@ class bpy_ops_submodule_op(object):
if 'FINISHED' in ret: if 'FINISHED' in ret:
import bpy import bpy
scene = bpy.context.scene scene = bpy.context.scene
if scene: # None in backgroud mode if scene: # None in backgroud mode
scene.update() scene.update()
else: else:
for scene in bpy.data.scenes: for scene in bpy.data.scenes:
@@ -178,14 +178,14 @@ class bpy_ops_submodule_op(object):
''' '''
return op_get_rna(self.idname()) return op_get_rna(self.idname())
def __repr__(self): # useful display, repr(op) def __repr__(self): # useful display, repr(op)
import bpy import bpy
idname = self.idname() idname = self.idname()
as_string = op_as_string(idname) as_string = op_as_string(idname)
descr = getattr(bpy.types, idname).bl_rna.description descr = getattr(bpy.types, idname).bl_rna.description
return as_string + "\n" + descr return as_string + "\n" + descr
def __str__(self): # used for print(...) def __str__(self): # used for print(...)
return "<function bpy.ops.%s.%s at 0x%x'>" % \ return "<function bpy.ops.%s.%s at 0x%x'>" % \
(self.module, self.func, id(self)) (self.module, self.func, id(self))

View File

@@ -26,6 +26,7 @@ functions for dealing with paths in Blender.
import bpy as _bpy import bpy as _bpy
import os as _os import os as _os
def abspath(path): def abspath(path):
""" """
Returns the absolute path relative to the current blend file using the "//" prefix. Returns the absolute path relative to the current blend file using the "//" prefix.
@@ -99,58 +100,58 @@ def display_name(name):
def resolve_ncase(path): def resolve_ncase(path):
""" """
Resolve a case insensitive path on a case sensitive system, Resolve a case insensitive path on a case sensitive system,
returning a string with the path if found else return the original path. returning a string with the path if found else return the original path.
""" """
import os import os
def _ncase_path_found(path): def _ncase_path_found(path):
if path=='' or os.path.exists(path): if path == "" or os.path.exists(path):
return path, True return path, True
filename = os.path.basename(path) # filename may be a directory or a file filename = os.path.basename(path) # filename may be a directory or a file
dirpath = os.path.dirname(path) dirpath = os.path.dirname(path)
suffix = "" suffix = ""
if not filename: # dir ends with a slash? if not filename: # dir ends with a slash?
if len(dirpath) < len(path): if len(dirpath) < len(path):
suffix = path[:len(path)-len(dirpath)] suffix = path[:len(path) - len(dirpath)]
filename = os.path.basename(dirpath) filename = os.path.basename(dirpath)
dirpath = os.path.dirname(dirpath) dirpath = os.path.dirname(dirpath)
if not os.path.exists(dirpath): if not os.path.exists(dirpath):
dirpath, found = _ncase_path_found(dirpath) dirpath, found = _ncase_path_found(dirpath)
if not found: if not found:
return path, False return path, False
# at this point, the directory exists but not the file # at this point, the directory exists but not the file
# we are expecting 'dirpath' to be a directory, but it could be a file # we are expecting 'dirpath' to be a directory, but it could be a file
if os.path.isdir(dirpath): if os.path.isdir(dirpath):
files = os.listdir(dirpath) files = os.listdir(dirpath)
else: else:
return path, False return path, False
filename_low = filename.lower() filename_low = filename.lower()
f_iter_nocase = None f_iter_nocase = None
for f_iter in files: for f_iter in files:
if f_iter.lower() == filename_low: if f_iter.lower() == filename_low:
f_iter_nocase = f_iter f_iter_nocase = f_iter
break break
if f_iter_nocase: if f_iter_nocase:
return os.path.join(dirpath, f_iter_nocase) + suffix, True return os.path.join(dirpath, f_iter_nocase) + suffix, True
else: else:
# cant find the right one, just return the path as is. # cant find the right one, just return the path as is.
return path, False return path, False
ncase_path, found = _ncase_path_found(path) ncase_path, found = _ncase_path_found(path)
return ncase_path if found else path return ncase_path if found else path
def ensure_ext(filepath, ext, case_sensitive=False): def ensure_ext(filepath, ext, case_sensitive=False):

View File

@@ -30,6 +30,7 @@ import sys as _sys
from _bpy import blend_paths from _bpy import blend_paths
from _bpy import script_paths as _bpy_script_paths from _bpy import script_paths as _bpy_script_paths
def _test_import(module_name, loaded_modules): def _test_import(module_name, loaded_modules):
import traceback import traceback
import time import time
@@ -49,7 +50,7 @@ def _test_import(module_name, loaded_modules):
if _bpy.app.debug: if _bpy.app.debug:
print("time %s %.4f" % (module_name, time.time() - t)) print("time %s %.4f" % (module_name, time.time() - t))
loaded_modules.add(mod.__name__) # should match mod.__name__ too loaded_modules.add(mod.__name__) # should match mod.__name__ too
return mod return mod
@@ -83,9 +84,10 @@ def modules_from_path(path, loaded_modules):
modules.append(mod) modules.append(mod)
return modules return modules
_global_loaded_modules = [] # store loaded module names for reloading.
import bpy_types as _bpy_types # keep for comparisons, never ever reload this. _global_loaded_modules = [] # store loaded module names for reloading.
import bpy_types as _bpy_types # keep for comparisons, never ever reload this.
def load_scripts(reload_scripts=False, refresh_scripts=False): def load_scripts(reload_scripts=False, refresh_scripts=False):
@@ -109,7 +111,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
if refresh_scripts: if refresh_scripts:
original_modules = _sys.modules.values() original_modules = _sys.modules.values()
if reload_scripts: if reload_scripts:
_bpy_types.TypeMap.clear() _bpy_types.TypeMap.clear()
_bpy_types.PropertiesMap.clear() _bpy_types.PropertiesMap.clear()
@@ -135,7 +137,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
traceback.print_exc() traceback.print_exc()
def sys_path_ensure(path): def sys_path_ensure(path):
if path not in _sys.path: # reloading would add twice if path not in _sys.path: # reloading would add twice
_sys.path.insert(0, path) _sys.path.insert(0, path)
def test_reload(mod): def test_reload(mod):
@@ -191,7 +193,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
continue continue
if user_path != base_path and path_subdir == "": if user_path != base_path and path_subdir == "":
continue # avoid loading 2.4x scripts continue # avoid loading 2.4x scripts
for mod in modules_from_path(path, loaded_modules): for mod in modules_from_path(path, loaded_modules):
test_register(mod) test_register(mod)
@@ -212,12 +214,10 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
if _bpy.app.debug: if _bpy.app.debug:
print("Python Script Load Time %.4f" % (time.time() - t_main)) print("Python Script Load Time %.4f" % (time.time() - t_main))
_bpy_types._register_immediate = True _bpy_types._register_immediate = True
# base scripts # base scripts
_scripts = _os.path.join(_os.path.dirname(__file__), _os.path.pardir, _os.path.pardir) _scripts = _os.path.join(_os.path.dirname(__file__), _os.path.pardir, _os.path.pardir)
_scripts = (_os.path.normpath(_scripts), ) _scripts = (_os.path.normpath(_scripts), )
@@ -265,7 +265,7 @@ def script_paths(subdir=None, user=True):
return script_paths return script_paths
_presets = _os.path.join(_scripts[0], "presets") # FIXME - multiple paths _presets = _os.path.join(_scripts[0], "presets") # FIXME - multiple paths
def preset_paths(subdir): def preset_paths(subdir):
@@ -295,10 +295,10 @@ def smpte_from_seconds(time, fps=None):
else: else:
neg = "" neg = ""
if time >= 3600.0: # hours if time >= 3600.0: # hours
hours = int(time / 3600.0) hours = int(time / 3600.0)
time = time % 3600.0 time = time % 3600.0
if time >= 60.0: # mins if time >= 60.0: # mins
minutes = int(time / 60.0) minutes = int(time / 60.0)
time = time % 60.0 time = time % 60.0

View File

@@ -251,7 +251,7 @@ class _GenericBone:
bones = id_data.pose.bones bones = id_data.pose.bones
elif id_data_type == bpy_types.Armature: elif id_data_type == bpy_types.Armature:
bones = id_data.edit_bones bones = id_data.edit_bones
if not bones: # not in editmode if not bones: # not in editmode
bones = id_data.bones bones = id_data.bones
return bones return bones
@@ -368,7 +368,7 @@ class Mesh(bpy_types.ID):
return a list of edge vertex index lists return a list of edge vertex index lists
""" """
OTHER_INDEX = 2, 3, 0, 1 # opposite face index OTHER_INDEX = 2, 3, 0, 1 # opposite face index
if faces is None: if faces is None:
faces = self.faces faces = self.faces
@@ -389,7 +389,7 @@ class Mesh(bpy_types.ID):
edge_loops = [] edge_loops = []
for edkey, ed_adj in edges.items(): for edkey, ed_adj in edges.items():
if 0 < len(ed_adj) < 3: # 1 or 2 if 0 < len(ed_adj) < 3: # 1 or 2
# Seek the first edge # Seek the first edge
context_loop = [edkey, ed_adj[0]] context_loop = [edkey, ed_adj[0]]
edge_loops.append(context_loop) edge_loops.append(context_loop)
@@ -407,11 +407,11 @@ class Mesh(bpy_types.ID):
ed_adj = edges[context_loop[-1]] ed_adj = edges[context_loop[-1]]
if len(ed_adj) != 2: if len(ed_adj) != 2:
if other_dir and flipped == False: # the original edge had 2 other edges if other_dir and flipped == False: # the original edge had 2 other edges
flipped = True # only flip the list once flipped = True # only flip the list once
context_loop.reverse() context_loop.reverse()
ed_adj[:] = [] ed_adj[:] = []
context_loop.append(other_dir) # save 1 lookiup context_loop.append(other_dir) # save 1 lookiup
ed_adj = edges[context_loop[-1]] ed_adj = edges[context_loop[-1]]
if len(ed_adj) != 2: if len(ed_adj) != 2:
@@ -427,7 +427,6 @@ class Mesh(bpy_types.ID):
# Dont look at this again # Dont look at this again
ed_adj[:] = [] ed_adj[:] = []
return edge_loops return edge_loops
def edge_loops_from_edges(self, edges=None): def edge_loops_from_edges(self, edges=None):
@@ -556,6 +555,7 @@ PropertiesMap = {}
# registers moduals instantly. # registers moduals instantly.
_register_immediate = True _register_immediate = True
def _unregister_module(module, free=True): def _unregister_module(module, free=True):
for t in TypeMap.get(module, ()): for t in TypeMap.get(module, ()):
try: try:
@@ -568,7 +568,6 @@ def _unregister_module(module, free=True):
if free == True and module in TypeMap: if free == True and module in TypeMap:
del TypeMap[module] del TypeMap[module]
for t in PropertiesMap.get(module, ()): for t in PropertiesMap.get(module, ()):
try: try:
bpy_types.unregister(t) bpy_types.unregister(t)
@@ -595,7 +594,7 @@ class RNAMeta(type):
@classmethod @classmethod
def _register_immediate(cls): def _register_immediate(cls):
return _register_immediate return _register_immediate
def __new__(cls, name, bases, classdict, **args): def __new__(cls, name, bases, classdict, **args):
result = type.__new__(cls, name, bases, classdict) result = type.__new__(cls, name, bases, classdict)
if bases and bases[0] != StructRNA: if bases and bases[0] != StructRNA:
@@ -606,21 +605,23 @@ class RNAMeta(type):
# Register right away if needed # Register right away if needed
if cls._register_immediate(): if cls._register_immediate():
bpy_types.register(result) bpy_types.register(result)
ClassMap = PropertiesMap ClassMap = PropertiesMap
# first part of packages only # first part of packages only
if "." in module: if "." in module:
module = module[:module.index(".")] module = module[:module.index(".")]
ClassMap.setdefault(module, []).append(result) ClassMap.setdefault(module, []).append(result)
return result return result
class RNAMetaRegister(RNAMeta): class RNAMetaRegister(RNAMeta):
@classmethod @classmethod
def _register_immediate(cls): def _register_immediate(cls):
return True return True
class OrderedMeta(RNAMeta): class OrderedMeta(RNAMeta):
def __init__(cls, name, bases, attributes): def __init__(cls, name, bases, attributes):
@@ -630,6 +631,7 @@ class OrderedMeta(RNAMeta):
def __prepare__(name, bases, **kwargs): def __prepare__(name, bases, **kwargs):
return collections.OrderedDict() return collections.OrderedDict()
# Only defined so operators members can be used by accessing self.order # Only defined so operators members can be used by accessing self.order
class Operator(StructRNA, metaclass=OrderedMeta): class Operator(StructRNA, metaclass=OrderedMeta):
__slots__ = () __slots__ = ()
@@ -644,13 +646,16 @@ class Macro(StructRNA, metaclass=OrderedMeta):
def define(self, opname): def define(self, opname):
from _bpy import ops from _bpy import ops
return ops.macro_define(self, opname) return ops.macro_define(self, opname)
class IDPropertyGroup(StructRNA, metaclass=RNAMetaRegister): class IDPropertyGroup(StructRNA, metaclass=RNAMetaRegister):
__slots__ = () __slots__ = ()
class RenderEngine(StructRNA, metaclass=RNAMeta): class RenderEngine(StructRNA, metaclass=RNAMeta):
__slots__ = () __slots__ = ()
class _GenericUI: class _GenericUI:
__slots__ = () __slots__ = ()

View File

@@ -37,6 +37,8 @@ or simple python blender/ui function calls.
""" """
TAG, ARGS, CHILDREN = range(3) TAG, ARGS, CHILDREN = range(3)
class ReturnStore(tuple): class ReturnStore(tuple):
def __getitem__(self, key): def __getitem__(self, key):
@@ -94,7 +96,6 @@ def toxml(py_data, indent=" "):
def _to_xml_iter(xml_parent, data_ls): def _to_xml_iter(xml_parent, data_ls):
for py_item in data_ls: for py_item in data_ls:
xml_node = newdoc.createElement(py_item[TAG]) xml_node = newdoc.createElement(py_item[TAG])
# ok if its empty # ok if its empty
_to_xml_iter(xml_node, py_item[CHILDREN]) _to_xml_iter(xml_node, py_item[CHILDREN])
@@ -114,8 +115,7 @@ def fromxml(data):
for key, value in xml_node.attributes.items(): for key, value in xml_node.attributes.items():
kwargs[key] = value kwargs[key] = value
return kwargs return kwargs
def _fromxml(xml_node): def _fromxml(xml_node):
py_item = (xml_node.tagName, _fromxml_kwargs(xml_node), []) py_item = (xml_node.tagName, _fromxml_kwargs(xml_node), [])
#_fromxml_iter(py_item, xml_node.childNodes) #_fromxml_iter(py_item, xml_node.childNodes)
@@ -130,15 +130,15 @@ def fromxml(data):
def topretty_py(py_data, indent=" "): def topretty_py(py_data, indent=" "):
if len(py_data) != 1: if len(py_data) != 1:
raise Exception("Expected a list with one member") raise Exception("Expected a list with one member")
lines = [] lines = []
def _to_kwargs(kwargs): def _to_kwargs(kwargs):
return ", ".join([("%s=%s" % (key, repr(value))) for key, value in sorted(kwargs.items())]) return ", ".join([("%s=%s" % (key, repr(value))) for key, value in sorted(kwargs.items())])
def _topretty(py_item, indent_ctx, last): def _topretty(py_item, indent_ctx, last):
if py_item[CHILDREN]: if py_item[CHILDREN]:
lines.append("%s%s(%s) [" % (indent_ctx, py_item[TAG], _to_kwargs(py_item[ARGS]))) lines.append("%s%s(%s) [" % (indent_ctx, py_item[TAG], _to_kwargs(py_item[ARGS])))
@@ -148,14 +148,14 @@ def topretty_py(py_data, indent=" "):
lines.append("%s]%s" % (indent_ctx, ("" if last else ","))) lines.append("%s]%s" % (indent_ctx, ("" if last else ",")))
else: else:
lines.append("%s%s(%s)%s" % (indent_ctx, py_item[TAG], _to_kwargs(py_item[ARGS]), ("" if last else ","))) lines.append("%s%s(%s)%s" % (indent_ctx, py_item[TAG], _to_kwargs(py_item[ARGS]), ("" if last else ",")))
_topretty(py_data[0], "", True) _topretty(py_data[0], "", True)
return "\n".join(lines) return "\n".join(lines)
if __name__ == "__main__": if __name__ == "__main__":
# testing code. # testing code.
tag_module("bpyml_test", ("ui", "prop", "row", "column", "active", "separator", "split")) tag_module("bpyml_test", ("ui", "prop", "row", "column", "active", "separator", "split"))
from bpyml_test import * from bpyml_test import *
@@ -192,13 +192,13 @@ if __name__ == "__main__":
] ]
xml_data = toxml(draw) xml_data = toxml(draw)
print(xml_data) # xml version print(xml_data) # xml version
py_data = fromxml(xml_data) py_data = fromxml(xml_data)
print(py_data) # converted back to py print(py_data) # converted back to py
xml_data = toxml(py_data) xml_data = toxml(py_data)
print(xml_data) # again back to xml print(xml_data) # again back to xml
py_data = fromxml(xml_data) # pretty python version py_data = fromxml(xml_data) # pretty python version
print(topretty_py(py_data)) print(topretty_py(py_data))

View File

@@ -32,7 +32,7 @@ _uilayout_tags = ["ui"] + \
# these need to be imported directly # these need to be imported directly
# >>> from bpyml_ui.locals import * # >>> from bpyml_ui.locals import *
locals = bpyml.tag_module("%s.locals" % __name__ , _uilayout_tags) locals = bpyml.tag_module("%s.locals" % __name__, _uilayout_tags)
def _parse_rna(prop, value): def _parse_rna(prop, value):
@@ -72,12 +72,12 @@ def _call_recursive(context, base, py_node):
value = eval(value, {"context": _bpy.context}) value = eval(value, {"context": _bpy.context})
setattr(base, py_node[TAG], value) setattr(base, py_node[TAG], value)
else: else:
value = py_node[ARGS]['value'] # have to have this value = py_node[ARGS]['value'] # have to have this
setattr(base, name, value) setattr(base, name, value)
else: else:
args = _parse_rna_args(base, py_node) args = _parse_rna_args(base, py_node)
func_new = getattr(base, py_node[TAG]) func_new = getattr(base, py_node[TAG])
base_new = func_new(**args) # call blender func base_new = func_new(**args) # call blender func
if base_new is not None: if base_new is not None:
for py_node_child in py_node[CHILDREN]: for py_node_child in py_node[CHILDREN]:
_call_recursive(context, base_new, py_node_child) _call_recursive(context, base_new, py_node_child)

View File

@@ -43,7 +43,6 @@ def compat_str(text, line_length=0):
text_ls.append(text) text_ls.append(text)
text = '\n '.join(text_ls) text = '\n '.join(text_ls)
#text = text.replace('.', '.\n') #text = text.replace('.', '.\n')
#text = text.replace(']', ']\n') #text = text.replace(']', ']\n')
text = text.replace("\n", "\\n") text = text.replace("\n", "\\n")
@@ -88,7 +87,6 @@ def graph_armature(obj, filepath, FAKE_PARENT=True, CONSTRAINTS=True, DRIVERS=Tr
else: else:
opts.append("fillcolor=white") opts.append("fillcolor=white")
fw('"%s" [%s];\n' % (bone.name, ','.join(opts))) fw('"%s" [%s];\n' % (bone.name, ','.join(opts)))
fw('\n\n# Hierarchy:\n') fw('\n\n# Hierarchy:\n')
@@ -162,7 +160,7 @@ def graph_armature(obj, filepath, FAKE_PARENT=True, CONSTRAINTS=True, DRIVERS=Tr
pbone_target = rna_path_as_pbone(target.data_path) pbone_target = rna_path_as_pbone(target.data_path)
rna_path_target = target.data_path rna_path_target = target.data_path
if pbone_target: if pbone_target:
opts = ['dir=forward', "weight=1", "arrowhead=normal", "arrowtail=none", "constraint=false", 'color="blue"', "labelfontsize=4"] # , opts = ['dir=forward', "weight=1", "arrowhead=normal", "arrowtail=none", "constraint=false", 'color="blue"', "labelfontsize=4"]
display_source = rna_path.replace("pose.bones", "") display_source = rna_path.replace("pose.bones", "")
display_target = rna_path_target.replace("pose.bones", "") display_target = rna_path_target.replace("pose.bones", "")
if XTRA_INFO: if XTRA_INFO:

View File

@@ -21,8 +21,9 @@
import bpy import bpy
from bpy.props import * from bpy.props import *
class ExportHelper: class ExportHelper:
filepath = StringProperty(name="File Path", description="Filepath used for exporting the file", maxlen= 1024, default= "", subtype='FILE_PATH') filepath = StringProperty(name="File Path", description="Filepath used for exporting the file", maxlen=1024, default="", subtype='FILE_PATH')
check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'}) check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'})
def invoke(self, context, event): def invoke(self, context, event):
@@ -35,7 +36,7 @@ class ExportHelper:
class ImportHelper: class ImportHelper:
filepath = StringProperty(name="File Path", description="Filepath used for importing the file", maxlen= 1024, default= "", subtype='FILE_PATH') filepath = StringProperty(name="File Path", description="Filepath used for importing the file", maxlen=1024, default="", subtype='FILE_PATH')
def invoke(self, context, event): def invoke(self, context, event):
context.window_manager.add_fileselect(self) context.window_manager.add_fileselect(self)
@@ -78,14 +79,15 @@ def free_derived_objects(ob):
def unpack_list(list_of_tuples): def unpack_list(list_of_tuples):
flat_list = [] flat_list = []
flat_list_extend = flat_list.extend # a tich faster flat_list_extend = flat_list.extend # a tich faster
for t in list_of_tuples: for t in list_of_tuples:
flat_list_extend(t) flat_list_extend(t)
return flat_list return flat_list
# same as above except that it adds 0 for triangle faces # same as above except that it adds 0 for triangle faces
def unpack_face_list(list_of_tuples): def unpack_face_list(list_of_tuples):
# allocate the entire list #allocate the entire list
flat_ls = [0] * (len(list_of_tuples) * 4) flat_ls = [0] * (len(list_of_tuples) * 4)
i = 0 i = 0
@@ -93,7 +95,7 @@ def unpack_face_list(list_of_tuples):
if len(t) == 3: if len(t) == 3:
if t[2] == 0: if t[2] == 0:
t = t[1], t[2], t[0] t = t[1], t[2], t[0]
else: # assuem quad else: # assuem quad
if t[3] == 0 or t[2] == 0: if t[3] == 0 or t[2] == 0:
t = t[2], t[3], t[0], t[1] t = t[2], t[3], t[0], t[1]

View File

@@ -77,7 +77,7 @@ def range_str(val):
def float_as_string(f): def float_as_string(f):
val_str = "%g" % f val_str = "%g" % f
if '.' not in val_str and '-' not in val_str: # value could be 1e-05 if '.' not in val_str and '-' not in val_str: # value could be 1e-05
val_str += '.0' val_str += '.0'
return val_str return val_str
@@ -194,20 +194,18 @@ class InfoPropertyRNA:
self.type = rna_prop.type.lower() self.type = rna_prop.type.lower()
fixed_type = getattr(rna_prop, "fixed_type", "") fixed_type = getattr(rna_prop, "fixed_type", "")
if fixed_type: if fixed_type:
self.fixed_type = GetInfoStructRNA(fixed_type) # valid for pointer/collections self.fixed_type = GetInfoStructRNA(fixed_type) # valid for pointer/collections
else: else:
self.fixed_type = None self.fixed_type = None
if self.type == "enum": if self.type == "enum":
self.enum_items[:] = rna_prop.items.keys() self.enum_items[:] = rna_prop.items.keys()
if self.array_length: if self.array_length:
self.default = tuple(getattr(rna_prop, "default_array", ())) self.default = tuple(getattr(rna_prop, "default_array", ()))
else: else:
self.default = getattr(rna_prop, "default", None) self.default = getattr(rna_prop, "default", None)
self.default_str = "" # fallback self.default_str = "" # fallback
if self.type == "pointer": if self.type == "pointer":
# pointer has no default, just set as None # pointer has no default, just set as None
@@ -231,7 +229,7 @@ class InfoPropertyRNA:
else: else:
self.default_str = str(self.default) self.default_str = str(self.default)
self.srna = GetInfoStructRNA(rna_prop.srna) # valid for pointer/collections self.srna = GetInfoStructRNA(rna_prop.srna) # valid for pointer/collections
def get_arg_default(self, force=True): def get_arg_default(self, force=True):
default = self.default_str default = self.default_str
@@ -275,7 +273,7 @@ class InfoPropertyRNA:
elif as_arg: elif as_arg:
if not self.is_required: if not self.is_required:
type_info.append("optional") type_info.append("optional")
else: # readonly is only useful for selfs, not args else: # readonly is only useful for selfs, not args
if self.is_readonly: if self.is_readonly:
type_info.append("readonly") type_info.append("readonly")
@@ -414,10 +412,10 @@ def BuildRNAInfo():
# Use for faster lookups # Use for faster lookups
# use rna_struct.identifier as the key for each dict # use rna_struct.identifier as the key for each dict
rna_struct_dict = {} # store identifier:rna lookups rna_struct_dict = {} # store identifier:rna lookups
rna_full_path_dict = {} # store the result of full_rna_struct_path(rna_struct) rna_full_path_dict = {} # store the result of full_rna_struct_path(rna_struct)
rna_children_dict = {} # store all rna_structs nested from here rna_children_dict = {} # store all rna_structs nested from here
rna_references_dict = {} # store a list of rna path strings that reference this type rna_references_dict = {} # store a list of rna path strings that reference this type
# rna_functions_dict = {} # store all functions directly in this type (not inherited) # rna_functions_dict = {} # store all functions directly in this type (not inherited)
def full_rna_struct_path(rna_struct): def full_rna_struct_path(rna_struct):
''' '''
@@ -434,7 +432,7 @@ def BuildRNAInfo():
try: try:
return rna_struct.base.identifier return rna_struct.base.identifier
except: except:
return "" # invalid id return "" # invalid id
#structs = [(base_id(rna_struct), rna_struct.identifier, rna_struct) for rna_struct in bpy.doc.structs.values()] #structs = [(base_id(rna_struct), rna_struct.identifier, rna_struct) for rna_struct in bpy.doc.structs.values()]
''' '''
@@ -466,17 +464,13 @@ def BuildRNAInfo():
# NOT USED YET # NOT USED YET
## rna_functions_dict[identifier] = get_direct_functions(rna_struct) ## rna_functions_dict[identifier] = get_direct_functions(rna_struct)
# fill in these later # fill in these later
rna_children_dict[identifier] = [] rna_children_dict[identifier] = []
rna_references_dict[identifier] = [] rna_references_dict[identifier] = []
else: else:
print("Ignoring", rna_type_name) print("Ignoring", rna_type_name)
structs.sort() # not needed but speeds up sort below, setting items without an inheritance first
structs.sort() # not needed but speeds up sort below, setting items without an inheritance first
# Arrange so classes are always defined in the correct order # Arrange so classes are always defined in the correct order
deps_ok = False deps_ok = False
@@ -494,7 +488,7 @@ def BuildRNAInfo():
ok = False ok = False
while i < len(structs): while i < len(structs):
if structs[i][1] == rna_base: if structs[i][1] == rna_base:
structs.insert(i + 1, data) # insert after the item we depend on. structs.insert(i + 1, data) # insert after the item we depend on.
ok = True ok = True
break break
i += 1 i += 1
@@ -506,7 +500,6 @@ def BuildRNAInfo():
# Done ordering structs # Done ordering structs
# precalc vars to avoid a lot of looping # precalc vars to avoid a lot of looping
for (rna_base, identifier, rna_struct) in structs: for (rna_base, identifier, rna_struct) in structs:
@@ -536,18 +529,15 @@ def BuildRNAInfo():
if rna_prop_ptr: if rna_prop_ptr:
rna_references_dict[rna_prop_ptr.identifier].append("%s.%s" % (rna_struct_path, rna_func.identifier)) rna_references_dict[rna_prop_ptr.identifier].append("%s.%s" % (rna_struct_path, rna_func.identifier))
# Store nested children # Store nested children
nested = rna_struct.nested nested = rna_struct.nested
if nested: if nested:
rna_children_dict[nested.identifier].append(rna_struct) rna_children_dict[nested.identifier].append(rna_struct)
# Sort the refs, just reads nicer # Sort the refs, just reads nicer
for rna_refs in rna_references_dict.values(): for rna_refs in rna_references_dict.values():
rna_refs.sort() rna_refs.sort()
info_structs = [] info_structs = []
for (rna_base, identifier, rna_struct) in structs: for (rna_base, identifier, rna_struct) in structs:
#if rna_struct.nested: #if rna_struct.nested:
@@ -590,7 +580,6 @@ def BuildRNAInfo():
if default < prop.min or default > prop.max: if default < prop.min or default > prop.max:
print("\t %s.%s, %s not in [%s - %s]" % (rna_info.identifier, prop.identifier, default, prop.min, prop.max)) print("\t %s.%s, %s not in [%s - %s]" % (rna_info.identifier, prop.identifier, default, prop.min, prop.max))
# now for operators # now for operators
op_mods = dir(bpy.ops) op_mods = dir(bpy.ops)
@@ -616,10 +605,8 @@ def BuildRNAInfo():
for rna_prop in rna_info.args: for rna_prop in rna_info.args:
rna_prop.build() rna_prop.build()
#for rna_info in InfoStructRNA.global_lookup.values(): #for rna_info in InfoStructRNA.global_lookup.values():
# print(rna_info) # print(rna_info)
return InfoStructRNA.global_lookup, InfoFunctionRNA.global_lookup, InfoOperatorRNA.global_lookup, InfoPropertyRNA.global_lookup return InfoStructRNA.global_lookup, InfoFunctionRNA.global_lookup, InfoOperatorRNA.global_lookup, InfoPropertyRNA.global_lookup
@@ -628,11 +615,11 @@ if __name__ == "__main__":
struct = rna_info.BuildRNAInfo()[0] struct = rna_info.BuildRNAInfo()[0]
data = [] data = []
for struct_id, v in sorted(struct.items()): for struct_id, v in sorted(struct.items()):
struct_id_str = v.identifier # "".join(sid for sid in struct_id if struct_id) struct_id_str = v.identifier # "".join(sid for sid in struct_id if struct_id)
for base in v.get_bases(): for base in v.get_bases():
struct_id_str = base.identifier + "|" + struct_id_str struct_id_str = base.identifier + "|" + struct_id_str
props = [(prop.identifier, prop) for prop in v.properties] props = [(prop.identifier, prop) for prop in v.properties]
for prop_id, prop in sorted(props): for prop_id, prop in sorted(props):
# if prop.type == 'boolean': # if prop.type == 'boolean':

View File

@@ -143,4 +143,3 @@ class PropertyPanel():
def draw(self, context): def draw(self, context):
draw(self.layout, context, self._context_path) draw(self.layout, context, self._context_path)

View File

@@ -592,7 +592,7 @@ class AddHuman(bpy.types.Operator):
bpy.ops.object.armature_add() bpy.ops.object.armature_add()
obj = context.active_object obj = context.active_object
mode_orig = obj.mode mode_orig = obj.mode
bpy.ops.object.mode_set(mode='EDIT') # grr, remove bone bpy.ops.object.mode_set(mode='EDIT') # grr, remove bone
bones = context.active_object.data.edit_bones bones = context.active_object.data.edit_bones
bones.remove(bones[0]) bones.remove(bones[0])
metarig_template() metarig_template()

View File

@@ -26,6 +26,7 @@ language_id = 'python'
# but python expects this in some places # but python expects this in some places
_BPY_MAIN_OWN = True _BPY_MAIN_OWN = True
def add_scrollback(text, text_type): def add_scrollback(text, text_type):
for l in text.split('\n'): for l in text.split('\n'):
bpy.ops.console.scrollback_append(text=l.replace('\t', ' '), bpy.ops.console.scrollback_append(text=l.replace('\t', ' '),
@@ -77,13 +78,13 @@ def get_console(console_id):
namespace = bpy_main_mod.__dict__ namespace = bpy_main_mod.__dict__
else: else:
namespace = {} namespace = {}
namespace["__builtins__"] = sys.modules["builtins"] namespace["__builtins__"] = sys.modules["builtins"]
namespace["bpy"] = bpy namespace["bpy"] = bpy
namespace["C"] = bpy.context namespace["C"] = bpy.context
console = InteractiveConsole(locals=namespace, filename="<blender_console>") console = InteractiveConsole(locals=namespace, filename="<blender_console>")
if _BPY_MAIN_OWN: if _BPY_MAIN_OWN:
console._bpy_main_mod = bpy_main_mod console._bpy_main_mod = bpy_main_mod
@@ -127,7 +128,7 @@ def execute(context):
sys.modules["__main__"] = console._bpy_main_mod sys.modules["__main__"] = console._bpy_main_mod
# incase exception happens # incase exception happens
line = "" # incase of encodingf error line = "" # incase of encodingf error
is_multiline = False is_multiline = False
try: try:

View File

@@ -39,7 +39,7 @@ class EditExternally(bpy.types.Operator):
# use image editor in the preferences when available. # use image editor in the preferences when available.
if not image_editor: if not image_editor:
if system == 'Windows': if system == 'Windows':
image_editor = ["start"] # not tested! image_editor = ["start"] # not tested!
elif system == 'Darwin': elif system == 'Darwin':
image_editor = ["open"] image_editor = ["open"]
else: else:
@@ -116,7 +116,7 @@ class ProjectEdit(bpy.types.Operator):
import os import os
import subprocess import subprocess
EXT = "png" # could be made an option but for now ok EXT = "png" # could be made an option but for now ok
for image in bpy.data.images: for image in bpy.data.images:
image.tag = True image.tag = True
@@ -159,7 +159,7 @@ class ProjectEdit(bpy.types.Operator):
image_new.name = os.path.basename(filepath_final) image_new.name = os.path.basename(filepath_final)
ProjectEdit._proj_hack[0] = image_new.name ProjectEdit._proj_hack[0] = image_new.name
image_new.filepath_raw = filepath_final # TODO, filepath raw is crummy image_new.filepath_raw = filepath_final # TODO, filepath raw is crummy
image_new.file_format = 'PNG' image_new.file_format = 'PNG'
image_new.save() image_new.save()
@@ -175,7 +175,7 @@ class ProjectApply(bpy.types.Operator):
bl_options = {'REGISTER'} bl_options = {'REGISTER'}
def execute(self, context): def execute(self, context):
image_name = ProjectEdit._proj_hack[0] # TODO, deal with this nicer image_name = ProjectEdit._proj_hack[0] # TODO, deal with this nicer
try: try:
image = bpy.data.images[image_name] image = bpy.data.images[image_name]
@@ -192,6 +192,7 @@ class ProjectApply(bpy.types.Operator):
def register(): def register():
pass pass
def unregister(): def unregister():
pass pass

View File

@@ -34,7 +34,7 @@ class ExportFBX(bpy.types.Operator, ExportHelper):
'''Selection to an ASCII Autodesk FBX''' '''Selection to an ASCII Autodesk FBX'''
bl_idname = "export_scene.fbx" bl_idname = "export_scene.fbx"
bl_label = "Export FBX" bl_label = "Export FBX"
filename_ext = ".fbx" filename_ext = ".fbx"
# List of operator properties, the attributes will be assigned # List of operator properties, the attributes will be assigned
@@ -66,22 +66,24 @@ class ExportFBX(bpy.types.Operator, ExportHelper):
BATCH_OWN_DIR = BoolProperty(name="Own Dir", description="Create a dir for each exported file", default=True) BATCH_OWN_DIR = BoolProperty(name="Own Dir", description="Create a dir for each exported file", default=True)
BATCH_FILE_PREFIX = StringProperty(name="Prefix", description="Prefix each file with this name", maxlen=1024, default="") BATCH_FILE_PREFIX = StringProperty(name="Prefix", description="Prefix each file with this name", maxlen=1024, default="")
def execute(self, context): def execute(self, context):
import math import math
from mathutils import Matrix from mathutils import Matrix
if not self.properties.filepath: if not self.properties.filepath:
raise Exception("filepath not set") raise Exception("filepath not set")
mtx4_x90n = Matrix.Rotation(-math.pi/2.0, 4, 'X') mtx4_x90n = Matrix.Rotation(-math.pi / 2.0, 4, 'X')
mtx4_y90n = Matrix.Rotation(-math.pi/2.0, 4, 'Y') mtx4_y90n = Matrix.Rotation(-math.pi / 2.0, 4, 'Y')
mtx4_z90n = Matrix.Rotation(-math.pi/2.0, 4, 'Z') mtx4_z90n = Matrix.Rotation(-math.pi / 2.0, 4, 'Z')
GLOBAL_MATRIX = Matrix() GLOBAL_MATRIX = Matrix()
GLOBAL_MATRIX[0][0] = GLOBAL_MATRIX[1][1] = GLOBAL_MATRIX[2][2] = self.properties.TX_SCALE GLOBAL_MATRIX[0][0] = GLOBAL_MATRIX[1][1] = GLOBAL_MATRIX[2][2] = self.properties.TX_SCALE
if self.properties.TX_XROT90: GLOBAL_MATRIX = mtx4_x90n * GLOBAL_MATRIX if self.properties.TX_XROT90:
if self.properties.TX_YROT90: GLOBAL_MATRIX = mtx4_y90n * GLOBAL_MATRIX GLOBAL_MATRIX = mtx4_x90n * GLOBAL_MATRIX
if self.properties.TX_ZROT90: GLOBAL_MATRIX = mtx4_z90n * GLOBAL_MATRIX if self.properties.TX_YROT90:
GLOBAL_MATRIX = mtx4_y90n * GLOBAL_MATRIX
if self.properties.TX_ZROT90:
GLOBAL_MATRIX = mtx4_z90n * GLOBAL_MATRIX
import io_scene_fbx.export_fbx import io_scene_fbx.export_fbx
return io_scene_fbx.export_fbx.save(self, context, GLOBAL_MATRIX=GLOBAL_MATRIX, **self.properties) return io_scene_fbx.export_fbx.save(self, context, GLOBAL_MATRIX=GLOBAL_MATRIX, **self.properties)

View File

@@ -76,7 +76,7 @@ class MeshMirrorUV(bpy.types.Operator):
return (ob and ob.type == 'MESH') return (ob and ob.type == 'MESH')
def execute(self, context): def execute(self, context):
DIR = 1 # TODO, make an option DIR = 1 # TODO, make an option
from mathutils import Vector from mathutils import Vector
@@ -111,7 +111,6 @@ class MeshMirrorUV(bpy.types.Operator):
if j is not None: if j is not None:
vmap[i] = j vmap[i] = j
active_uv_layer = None active_uv_layer = None
for lay in mesh.uv_textures: for lay in mesh.uv_textures:
if lay.active: if lay.active:
@@ -162,7 +161,6 @@ class MeshMirrorUV(bpy.types.Operator):
v1 = faces[j].vertices[:] v1 = faces[j].vertices[:]
v2 = [vmap[k] for k in faces[i].vertices[:]] v2 = [vmap[k] for k in faces[i].vertices[:]]
for k in range(len(uv1)): for k in range(len(uv1)):
k_map = v1.index(v2[k]) k_map = v1.index(v2[k])
uv1[k].x = - (uv2[k_map].x - 0.5) + 0.5 uv1[k].x = - (uv2[k_map].x - 0.5) + 0.5

View File

@@ -118,7 +118,7 @@ def bake(frame_start, frame_end, step=1, only_selected=False):
pbone.keyframe_insert("rotation_quaternion", -1, f, name) pbone.keyframe_insert("rotation_quaternion", -1, f, name)
elif rotation_mode == 'AXIS_ANGLE': elif rotation_mode == 'AXIS_ANGLE':
pbone.keyframe_insert("rotation_axis_angle", -1, f, name) pbone.keyframe_insert("rotation_axis_angle", -1, f, name)
else: # euler, XYZ, ZXY etc else: # euler, XYZ, ZXY etc
pbone.keyframe_insert("rotation_euler", -1, f, name) pbone.keyframe_insert("rotation_euler", -1, f, name)
pbone.keyframe_insert("scale", -1, f, name) pbone.keyframe_insert("scale", -1, f, name)

View File

@@ -117,8 +117,7 @@ class SelectHierarchy(bpy.types.Operator):
def execute(self, context): def execute(self, context):
select_new = [] select_new = []
act_new = None act_new = None
selected_objects = context.selected_objects selected_objects = context.selected_objects
obj_act = context.object obj_act = context.object
@@ -153,7 +152,7 @@ class SelectHierarchy(bpy.types.Operator):
context.scene.objects.active = act_new context.scene.objects.active = act_new
return {'FINISHED'} return {'FINISHED'}
return {'CANCELLED'} return {'CANCELLED'}
@@ -179,7 +178,7 @@ class SubdivisionSet(bpy.types.Operator):
relative = self.properties.relative relative = self.properties.relative
if relative and level == 0: if relative and level == 0:
return {'CANCELLED'} # nothing to do return {'CANCELLED'} # nothing to do
def set_object_subd(obj): def set_object_subd(obj):
for mod in obj.modifiers: for mod in obj.modifiers:
@@ -253,7 +252,7 @@ class ShapeTransfer(bpy.types.Operator):
key = ob.add_shape_key(from_mix=False) key = ob.add_shape_key(from_mix=False)
if len(me.shape_keys.keys) == 1: if len(me.shape_keys.keys) == 1:
key.name = "Basis" key.name = "Basis"
key = ob.add_shape_key(from_mix=False) # we need a rest key = ob.add_shape_key(from_mix=False) # we need a rest
key.name = name key.name = name
ob.active_shape_key_index = len(me.shape_keys.keys) - 1 ob.active_shape_key_index = len(me.shape_keys.keys) - 1
ob.show_shape_key = True ob.show_shape_key = True
@@ -345,7 +344,6 @@ class ShapeTransfer(bpy.types.Operator):
n1loc = v1 + orig_normals[i1] * edge_length n1loc = v1 + orig_normals[i1] * edge_length
n2loc = v2 + orig_normals[i2] * edge_length n2loc = v2 + orig_normals[i2] * edge_length
# now get the target nloc's # now get the target nloc's
v1_to, v2_to = target_coords[i1], target_coords[i2] v1_to, v2_to = target_coords[i1], target_coords[i2]
edlen_to = (v1_to - v2_to).length edlen_to = (v1_to - v2_to).length
@@ -392,7 +390,7 @@ class ShapeTransfer(bpy.types.Operator):
ob_act = C.active_object ob_act = C.active_object
objects = [ob for ob in C.selected_editable_objects if ob != ob_act] objects = [ob for ob in C.selected_editable_objects if ob != ob_act]
if 1: # swap from/to, means we cant copy to many at once. if 1: # swap from/to, means we cant copy to many at once.
if len(objects) != 1: if len(objects) != 1:
self.report({'ERROR'}, "Expected one other selected mesh object to copy from") self.report({'ERROR'}, "Expected one other selected mesh object to copy from")
return {'CANCELLED'} return {'CANCELLED'}
@@ -432,7 +430,7 @@ class JoinUVs(bpy.types.Operator):
else: else:
len_faces = len(mesh.faces) len_faces = len(mesh.faces)
uv_array = array.array('f', [0.0] * 8) * len_faces # seems to be the fastest way to create an array uv_array = array.array('f', [0.0] * 8) * len_faces # seems to be the fastest way to create an array
mesh.uv_textures.active.data.foreach_get("uv_raw", uv_array) mesh.uv_textures.active.data.foreach_get("uv_raw", uv_array)
objects = context.selected_editable_objects[:] objects = context.selected_editable_objects[:]
@@ -453,7 +451,7 @@ class JoinUVs(bpy.types.Operator):
else: else:
uv_other = mesh_other.uv_textures.active uv_other = mesh_other.uv_textures.active
if not uv_other: if not uv_other:
uv_other = mesh_other.uv_textures.new() # should return the texture it adds uv_other = mesh_other.uv_textures.new() # should return the texture it adds
# finally do the copy # finally do the copy
uv_other.data.foreach_set("uv_raw", uv_array) uv_other.data.foreach_set("uv_raw", uv_array)
@@ -487,7 +485,7 @@ class MakeDupliFace(bpy.types.Operator):
def matrix_to_quat(matrix): def matrix_to_quat(matrix):
# scale = matrix.median_scale # scale = matrix.median_scale
trans = matrix.translation_part() trans = matrix.translation_part()
rot = matrix.rotation_part() # also contains scale rot = matrix.rotation_part() # also contains scale
return [(rot * b) + trans for b in base_tri] return [(rot * b) + trans for b in base_tri]
scene = bpy.context.scene scene = bpy.context.scene
@@ -508,7 +506,7 @@ class MakeDupliFace(bpy.types.Operator):
mesh.vertices.foreach_set("co", face_verts) mesh.vertices.foreach_set("co", face_verts)
mesh.faces.foreach_set("vertices_raw", faces) mesh.faces.foreach_set("vertices_raw", faces)
mesh.update() # generates edge data mesh.update() # generates edge data
# pick an object to use # pick an object to use
obj = objects[0] obj = objects[0]
@@ -552,7 +550,9 @@ class IsolateTypeRender(bpy.types.Operator):
obj.hide_render = True obj.hide_render = True
return {'FINISHED'} return {'FINISHED'}
class ClearAllRestrictRender(bpy.types.Operator): class ClearAllRestrictRender(bpy.types.Operator):
'''Reveal all render objects by setting the hide render flag''' '''Reveal all render objects by setting the hide render flag'''
bl_idname = "object.hide_render_clear_all" bl_idname = "object.hide_render_clear_all"
@@ -561,7 +561,7 @@ class ClearAllRestrictRender(bpy.types.Operator):
def execute(self, context): def execute(self, context):
for obj in context.scene.objects: for obj in context.scene.objects:
obj.hide_render = False obj.hide_render = False
return {'FINISHED'} return {'FINISHED'}

View File

@@ -36,10 +36,10 @@ def randomize_selected(seed, loc, rot, scale, scale_even, scale_min):
if loc: if loc:
obj.location += rand_vec(loc) obj.location += rand_vec(loc)
else: # otherwise the values change under us else: # otherwise the values change under us
uniform(0.0, 0.0), uniform(0.0, 0.0), uniform(0.0, 0.0) uniform(0.0, 0.0), uniform(0.0, 0.0), uniform(0.0, 0.0)
if rot: # TODO, non euler's if rot: # TODO, non euler's
vec = rand_vec(rot) vec = rand_vec(rot)
obj.rotation_euler[0] += vec[0] obj.rotation_euler[0] += vec[0]
obj.rotation_euler[1] += vec[1] obj.rotation_euler[1] += vec[1]

View File

@@ -32,7 +32,7 @@ class AddPresetBase():
name = bpy.props.StringProperty(name="Name", description="Name of the preset, used to make the path name", maxlen=64, default="") name = bpy.props.StringProperty(name="Name", description="Name of the preset, used to make the path name", maxlen=64, default="")
def _as_filename(self, name): # could reuse for other presets def _as_filename(self, name): # could reuse for other presets
for char in " !@#$%^&*(){}:\";'[]<>,./?": for char in " !@#$%^&*(){}:\";'[]<>,./?":
name = name.replace('.', '_') name = name.replace('.', '_')
return name.lower() return name.lower()
@@ -44,7 +44,7 @@ class AddPresetBase():
filename = self._as_filename(self.properties.name) + ".py" filename = self._as_filename(self.properties.name) + ".py"
target_path = bpy.utils.preset_paths(self.preset_subdir)[0] # we need some way to tell the user and system preset path target_path = bpy.utils.preset_paths(self.preset_subdir)[0] # we need some way to tell the user and system preset path
filepath = os.path.join(target_path, filename) filepath = os.path.join(target_path, filename)
if getattr(self, "save_keyconfig", False): if getattr(self, "save_keyconfig", False):
@@ -203,6 +203,7 @@ class AddPresetInteraction(AddPresetBase, bpy.types.Operator):
preset_subdir = "interaction" preset_subdir = "interaction"
def register(): def register():
pass pass

View File

@@ -60,7 +60,6 @@ def guess_player_path(preset):
elif preset == 'MPLAYER': elif preset == 'MPLAYER':
player_path = "mplayer" player_path = "mplayer"
return player_path return player_path
@@ -105,7 +104,7 @@ class PlayRenderedAnim(bpy.types.Operator):
# works for movies and images # works for movies and images
file = rd.frame_path(frame=scene.frame_start) file = rd.frame_path(frame=scene.frame_start)
file = bpy.path.abspath(file) # expand '//' file = bpy.path.abspath(file) # expand '//'
cmd = [player_path] cmd = [player_path]
# extra options, fps controls etc. # extra options, fps controls etc.
@@ -130,7 +129,7 @@ class PlayRenderedAnim(bpy.types.Operator):
opts += ["-mf", "fps=%.4f" % (rd.fps / rd.fps_base)] opts += ["-mf", "fps=%.4f" % (rd.fps / rd.fps_base)]
opts += ["-loop", "0", "-really-quiet", "-fs"] opts += ["-loop", "0", "-really-quiet", "-fs"]
cmd.extend(opts) cmd.extend(opts)
else: # 'CUSTOM' else: # 'CUSTOM'
cmd.append(file) cmd.append(file)
# launch it # launch it

View File

@@ -139,7 +139,7 @@ class ExportUVLayout(bpy.types.Operator):
fill_settings.append(fill_default) fill_settings.append(fill_default)
for i, uvs in self._face_uv_iter(context): for i, uvs in self._face_uv_iter(context):
try: # rare cases material index is invalid. try: # rare cases material index is invalid.
fill = fill_settings[faces[i].material_index] fill = fill_settings[faces[i].material_index]
except IndexError: except IndexError:
fill = fill_default fill = fill_default

View File

@@ -23,6 +23,7 @@ import bpy
from bpy.props import * from bpy.props import *
from rna_prop_ui import rna_idprop_ui_prop_get, rna_idprop_ui_prop_clear from rna_prop_ui import rna_idprop_ui_prop_get, rna_idprop_ui_prop_clear
class MESH_OT_delete_edgeloop(bpy.types.Operator): class MESH_OT_delete_edgeloop(bpy.types.Operator):
'''Delete an edge loop by merging the faces on each side to a single face loop''' '''Delete an edge loop by merging the faces on each side to a single face loop'''
bl_idname = "mesh.delete_edgeloop" bl_idname = "mesh.delete_edgeloop"
@@ -86,7 +87,7 @@ class WM_OT_context_set_boolean(bpy.types.Operator):
execute = execute_context_assign execute = execute_context_assign
class WM_OT_context_set_int(bpy.types.Operator): # same as enum class WM_OT_context_set_int(bpy.types.Operator): # same as enum
'''Set a context value.''' '''Set a context value.'''
bl_idname = "wm.context_set_int" bl_idname = "wm.context_set_int"
bl_label = "Context Set" bl_label = "Context Set"
@@ -99,7 +100,7 @@ class WM_OT_context_set_int(bpy.types.Operator): # same as enum
execute = execute_context_assign execute = execute_context_assign
class WM_OT_context_scale_int(bpy.types.Operator): # same as enum class WM_OT_context_scale_int(bpy.types.Operator):
'''Scale an int context value.''' '''Scale an int context value.'''
bl_idname = "wm.context_scale_int" bl_idname = "wm.context_scale_int"
bl_label = "Context Set" bl_label = "Context Set"
@@ -118,7 +119,7 @@ class WM_OT_context_scale_int(bpy.types.Operator): # same as enum
value = self.properties.value value = self.properties.value
data_path = self.properties.data_path data_path = self.properties.data_path
if value == 1.0: # nothing to do if value == 1.0: # nothing to do
return {'CANCELLED'} return {'CANCELLED'}
if getattr(self.properties, "always_step", False): if getattr(self.properties, "always_step", False):
@@ -135,7 +136,7 @@ class WM_OT_context_scale_int(bpy.types.Operator): # same as enum
return {'FINISHED'} return {'FINISHED'}
class WM_OT_context_set_float(bpy.types.Operator): # same as enum class WM_OT_context_set_float(bpy.types.Operator): # same as enum
'''Set a context value.''' '''Set a context value.'''
bl_idname = "wm.context_set_float" bl_idname = "wm.context_set_float"
bl_label = "Context Set Float" bl_label = "Context Set Float"
@@ -149,7 +150,7 @@ class WM_OT_context_set_float(bpy.types.Operator): # same as enum
execute = execute_context_assign execute = execute_context_assign
class WM_OT_context_set_string(bpy.types.Operator): # same as enum class WM_OT_context_set_string(bpy.types.Operator): # same as enum
'''Set a context value.''' '''Set a context value.'''
bl_idname = "wm.context_set_string" bl_idname = "wm.context_set_string"
bl_label = "Context Set String" bl_label = "Context Set String"
@@ -314,7 +315,7 @@ class WM_OT_context_cycle_enum(bpy.types.Operator):
if orig_index == 0: if orig_index == 0:
advance_enum = enums[-1] advance_enum = enums[-1]
else: else:
advance_enum = enums[orig_index-1] advance_enum = enums[orig_index - 1]
else: else:
if orig_index == len(enums) - 1: if orig_index == len(enums) - 1:
advance_enum = enums[0] advance_enum = enums[0]
@@ -545,9 +546,9 @@ class WM_OT_doc_view(bpy.types.Operator):
def execute(self, context): def execute(self, context):
id_split = self.properties.doc_id.split('.') id_split = self.properties.doc_id.split('.')
if len(id_split) == 1: # rna, class if len(id_split) == 1: # rna, class
url = '%s/bpy.types.%s.html' % (self._prefix, id_split[0]) url = '%s/bpy.types.%s.html' % (self._prefix, id_split[0])
elif len(id_split) == 2: # rna, class.prop elif len(id_split) == 2: # rna, class.prop
class_name, class_prop = id_split class_name, class_prop = id_split
if hasattr(bpy.types, class_name.upper() + '_OT_' + class_prop): if hasattr(bpy.types, class_name.upper() + '_OT_' + class_prop):
@@ -687,7 +688,6 @@ class WM_OT_properties_edit(bpy.types.Operator):
# print(exec_str) # print(exec_str)
exec(exec_str) exec(exec_str)
# Reassign # Reassign
exec_str = "item['%s'] = %s" % (prop, repr(value_eval)) exec_str = "item['%s'] = %s" % (prop, repr(value_eval))
# print(exec_str) # print(exec_str)
@@ -714,7 +714,7 @@ class WM_OT_properties_edit(bpy.types.Operator):
item = eval("context.%s" % self.properties.data_path) item = eval("context.%s" % self.properties.data_path)
# setup defaults # setup defaults
prop_ui = rna_idprop_ui_prop_get(item, self.properties.property, False) # dont create prop_ui = rna_idprop_ui_prop_get(item, self.properties.property, False) # dont create
if prop_ui: if prop_ui:
self.properties.min = prop_ui.get("min", -1000000000) self.properties.min = prop_ui.get("min", -1000000000)
self.properties.max = prop_ui.get("max", 1000000000) self.properties.max = prop_ui.get("max", 1000000000)
@@ -767,6 +767,7 @@ class WM_OT_properties_remove(bpy.types.Operator):
del item[self.properties.property] del item[self.properties.property]
return {'FINISHED'} return {'FINISHED'}
def register(): def register():
pass pass

View File

@@ -92,12 +92,8 @@ class OnionSkinButtonsPanel():
col.prop(arm, "show_only_ghost_selected", text="Selected Only") col.prop(arm, "show_only_ghost_selected", text="Selected Only")
# NOTE: # NOTE:
# The specialised panel types are derived in their respective UI modules # The specialised panel types are derived in their respective UI modules
def register(): def register():
pass pass

View File

@@ -149,7 +149,7 @@ class DATA_PT_bone_groups(ArmatureButtonsPanel, bpy.types.Panel):
sub = row.row(align=True) sub = row.row(align=True)
sub.operator("pose.group_assign", text="Assign") sub.operator("pose.group_assign", text="Assign")
sub.operator("pose.group_unassign", text="Remove") #row.operator("pose.bone_group_remove_from", text="Remove") sub.operator("pose.group_unassign", text="Remove") # row.operator("pose.bone_group_remove_from", text="Remove")
sub = row.row(align=True) sub = row.row(align=True)
sub.operator("pose.group_select", text="Select") sub.operator("pose.group_select", text="Select")
@@ -219,7 +219,6 @@ class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, bpy.types.Panel):
col = split.column() col = split.column()
col.prop(itasc, "iterations") col.prop(itasc, "iterations")
if simulation: if simulation:
layout.prop(itasc, "use_auto_step") layout.prop(itasc, "use_auto_step")
row = layout.row() row = layout.row()
@@ -240,6 +239,7 @@ class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, bpy.types.Panel):
from properties_animviz import MotionPathButtonsPanel, OnionSkinButtonsPanel from properties_animviz import MotionPathButtonsPanel, OnionSkinButtonsPanel
class DATA_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel): class DATA_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
#bl_label = "Bones Motion Paths" #bl_label = "Bones Motion Paths"
bl_context = "data" bl_context = "data"
@@ -267,7 +267,7 @@ class DATA_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
col.operator("pose.paths_clear", text="Clear Paths") col.operator("pose.paths_clear", text="Clear Paths")
class DATA_PT_onion_skinning(OnionSkinButtonsPanel): #, bpy.types.Panel): # inherit from panel when ready class DATA_PT_onion_skinning(OnionSkinButtonsPanel): # , bpy.types.Panel): # inherit from panel when ready
#bl_label = "Bones Onion Skinning" #bl_label = "Bones Onion Skinning"
bl_context = "data" bl_context = "data"
@@ -288,6 +288,7 @@ class DATA_PT_custom_props_arm(ArmatureButtonsPanel, PropertyPanel, bpy.types.Pa
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data" _context_path = "object.data"
def register(): def register():
pass pass

View File

@@ -98,7 +98,7 @@ class DATA_PT_template(bpy.types.Panel):
if self.templates: if self.templates:
subsubrow = subrow.split(percentage=0.8) subsubrow = subrow.split(percentage=0.8)
subsubrow.operator("pose.metarig_sample_add", text="Sample").metarig_type = self.templates[pose_templates.active_template_index] subsubrow.operator("pose.metarig_sample_add", text="Sample").metarig_type = self.templates[pose_templates.active_template_index]
subsubrow.operator("pose.metarig_sample_add", text="All").metarig_type = "" # self.templates[pose_templates.active_template_index] subsubrow.operator("pose.metarig_sample_add", text="All").metarig_type = "" # self.templates[pose_templates.active_template_index]
sub = row.column(align=True) sub = row.column(align=True)
sub.operator("pose.metarig_reload", icon="FILE_REFRESH", text="") sub.operator("pose.metarig_reload", icon="FILE_REFRESH", text="")
@@ -136,7 +136,7 @@ def rigify_report_exception(operator, exception):
message.append("Incorrect armature for type '%s'" % fn) message.append("Incorrect armature for type '%s'" % fn)
message.append(exception.message) message.append(exception.message)
message.reverse() # XXX - stupid! menu's are upside down! message.reverse() # XXX - stupid! menu's are upside down!
operator.report(set(['INFO']), '\n'.join(message)) operator.report(set(['INFO']), '\n'.join(message))
@@ -310,7 +310,7 @@ class INFO_MT_armature_metarig_add(bpy.types.Menu):
layout.operator("pose.metarig_sample_add", text=text, icon='OUTLINER_OB_ARMATURE').metarig_type = submodule_type layout.operator("pose.metarig_sample_add", text=text, icon='OUTLINER_OB_ARMATURE').metarig_type = submodule_type
menu_func = (lambda self, context: self.layout.menu("INFO_MT_armature_metarig_add", icon='OUTLINER_OB_ARMATURE')) menu_func = (lambda self, context: self.layout.menu("INFO_MT_armature_metarig_add", icon='OUTLINER_OB_ARMATURE'))
import space_info # ensure the menu is loaded first import space_info # ensure the menu is loaded first
def register(): def register():
@@ -320,7 +320,6 @@ def register():
maxlen=64, maxlen=64,
default="") default="")
PoseTemplateSettings.CollectionProperty(attr="templates", type=PoseTemplate, name="Templates", description="") PoseTemplateSettings.CollectionProperty(attr="templates", type=PoseTemplate, name="Templates", description="")
PoseTemplateSettings.IntProperty(attr="active_template_index", PoseTemplateSettings.IntProperty(attr="active_template_index",
name="Index of the active slave", name="Index of the active slave",

View File

@@ -274,7 +274,7 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
sub.prop(pchan, "ik_min_z", text="") sub.prop(pchan, "ik_min_z", text="")
sub.prop(pchan, "ik_max_z", text="") sub.prop(pchan, "ik_max_z", text="")
sub.active = pchan.lock_ik_z == False and pchan.use_ik_limit_z and pchan.is_in_ik_chain sub.active = pchan.lock_ik_z == False and pchan.use_ik_limit_z and pchan.is_in_ik_chain
split = layout.split(percentage=0.25) split = layout.split(percentage=0.25)
split.label(text="Stretch:") split.label(text="Stretch:")
sub = split.row() sub = split.row()

View File

@@ -302,11 +302,11 @@ class DATA_PT_font(CurveButtonsPanel, bpy.types.Panel):
col.prop(char, "use_bold") col.prop(char, "use_bold")
col.prop(char, "use_italic") col.prop(char, "use_italic")
col.prop(char, "use_underline") col.prop(char, "use_underline")
split = layout.split() split = layout.split()
col = split.column() col = split.column()
col.prop(text, "small_caps_scale", text="Small Caps") col.prop(text, "small_caps_scale", text="Small Caps")
col = split.column() col = split.column()
col.prop(char, "use_small_caps") col.prop(char, "use_small_caps")

View File

@@ -43,7 +43,6 @@ class DATA_PT_empty(DataButtonsPanel, bpy.types.Panel):
layout.prop(ob, "empty_draw_size", text="Size") layout.prop(ob, "empty_draw_size", text="Size")
def register(): def register():
pass pass

View File

@@ -64,6 +64,7 @@ class DATA_PT_context_lamp(DataButtonsPanel, bpy.types.Panel):
if texture_count != 0: if texture_count != 0:
split.label(text=str(texture_count), icon='TEXTURE') split.label(text=str(texture_count), icon='TEXTURE')
class DATA_PT_preview(DataButtonsPanel, bpy.types.Panel): class DATA_PT_preview(DataButtonsPanel, bpy.types.Panel):
bl_label = "Preview" bl_label = "Preview"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -205,10 +206,10 @@ class DATA_PT_shadow(DataButtonsPanel, bpy.types.Panel):
if lamp.shadow_method == 'NOSHADOW' and lamp.type == 'AREA': if lamp.shadow_method == 'NOSHADOW' and lamp.type == 'AREA':
split = layout.split() split = layout.split()
col= split.column() col = split.column()
col.label(text="Form factor sampling:") col.label(text="Form factor sampling:")
sub=col.row(align=True) sub = col.row(align=True)
if lamp.shape == 'SQUARE': if lamp.shape == 'SQUARE':
sub.prop(lamp, "shadow_ray_samples_x", text="Samples") sub.prop(lamp, "shadow_ray_samples_x", text="Samples")
@@ -228,19 +229,19 @@ class DATA_PT_shadow(DataButtonsPanel, bpy.types.Panel):
if lamp.shadow_method == 'RAY_SHADOW': if lamp.shadow_method == 'RAY_SHADOW':
split = layout.split() split = layout.split()
col = split.column() col = split.column()
col.label(text="Sampling:") col.label(text="Sampling:")
if lamp.type in ('POINT', 'SUN', 'SPOT'): if lamp.type in ('POINT', 'SUN', 'SPOT'):
sub = col.row() sub = col.row()
sub.prop(lamp, "shadow_ray_samples", text="Samples") sub.prop(lamp, "shadow_ray_samples", text="Samples")
sub.prop(lamp, "shadow_soft_size", text="Soft Size") sub.prop(lamp, "shadow_soft_size", text="Soft Size")
elif lamp.type == 'AREA': elif lamp.type == 'AREA':
sub = col.row(align=True) sub = col.row(align=True)
if lamp.shape == 'SQUARE': if lamp.shape == 'SQUARE':
sub.prop(lamp, "shadow_ray_samples_x", text="Samples") sub.prop(lamp, "shadow_ray_samples_x", text="Samples")
elif lamp.shape == 'RECTANGLE': elif lamp.shape == 'RECTANGLE':
@@ -251,11 +252,11 @@ class DATA_PT_shadow(DataButtonsPanel, bpy.types.Panel):
split = layout.split() split = layout.split()
col = split.column() col = split.column()
if lamp.shadow_ray_sample_method == 'ADAPTIVE_QMC': if lamp.shadow_ray_sample_method == 'ADAPTIVE_QMC':
col.prop(lamp, "shadow_adaptive_threshold", text="Threshold") col.prop(lamp, "shadow_adaptive_threshold", text="Threshold")
col = split.column() col = split.column()
if lamp.type == 'AREA' and lamp.shadow_ray_sample_method == 'CONSTANT_JITTERED': if lamp.type == 'AREA' and lamp.shadow_ray_sample_method == 'CONSTANT_JITTERED':
col = split.column() col = split.column()
col = split.column() col = split.column()
@@ -322,7 +323,7 @@ class DATA_PT_area(DataButtonsPanel, bpy.types.Panel):
split = layout.split() split = layout.split()
col = split.column() col = split.column()
col.row().prop(lamp, "shape", expand=True) col.row().prop(lamp, "shape", expand=True)
sub = col.row(align=True) sub = col.row(align=True)

View File

@@ -80,7 +80,7 @@ class DATA_PT_lattice(DataButtonsPanel, bpy.types.Panel):
row = layout.row() row = layout.row()
row.prop(lat, "use_outside") row.prop(lat, "use_outside")
row.prop_search(lat, "vertex_group", context.object, "vertex_groups", text="") row.prop_search(lat, "vertex_group", context.object, "vertex_groups", text="")
class DATA_PT_custom_props_lattice(DataButtonsPanel, PropertyPanel, bpy.types.Panel): class DATA_PT_custom_props_lattice(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}

View File

@@ -42,8 +42,8 @@ class MESH_MT_shape_key_specials(bpy.types.Menu):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
layout.operator("object.shape_key_transfer", icon='COPY_ID') # icon is not ideal layout.operator("object.shape_key_transfer", icon='COPY_ID') # icon is not ideal
layout.operator("object.join_shapes", icon='COPY_ID') # icon is not ideal layout.operator("object.join_shapes", icon='COPY_ID') # icon is not ideal
layout.operator("object.shape_key_mirror", icon='ARROW_LEFTRIGHT') layout.operator("object.shape_key_mirror", icon='ARROW_LEFTRIGHT')

View File

@@ -53,7 +53,7 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel, bpy.types.Panel):
col = split.column() col = split.column()
col.prop(game, "use_actor") col.prop(game, "use_actor")
col.prop(game, "use_ghost") col.prop(game, "use_ghost")
col.prop(ob, "hide_render", text="Invisible") # out of place but useful col.prop(ob, "hide_render", text="Invisible") # out of place but useful
col = split.column() col = split.column()
col.prop(game, "use_material_physics") col.prop(game, "use_material_physics")
@@ -286,7 +286,7 @@ class RENDER_PT_game_stereo(RenderButtonsPanel, bpy.types.Panel):
col = split.column() col = split.column()
col.prop(gs, "dome_tesselation", text="Tesselation") col.prop(gs, "dome_tesselation", text="Tesselation")
else: # cube map else: # cube map
col = split.column() col = split.column()
col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True) col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)

View File

@@ -119,7 +119,7 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel, bpy.types.Panel):
if mat: if mat:
layout.prop(mat, "type", expand=True) layout.prop(mat, "type", expand=True)
class MATERIAL_PT_preview(MaterialButtonsPanel, bpy.types.Panel): class MATERIAL_PT_preview(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Preview" bl_label = "Preview"
@@ -357,9 +357,9 @@ class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
sub = col.column() sub = col.column()
sub.active = rayt.gloss_factor < 1.0 sub.active = rayt.gloss_factor < 1.0
sub.prop(rayt, "gloss_threshold", text="Threshold") sub.prop(rayt, "gloss_threshold", text="Threshold")
sub.prop(rayt, "gloss_samples", text="Samples") sub.prop(rayt, "gloss_samples", text="Samples")
class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel): class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Mirror" bl_label = "Mirror"
bl_options = {'DEFAULT_CLOSED'} bl_options = {'DEFAULT_CLOSED'}
@@ -482,7 +482,7 @@ class MATERIAL_PT_halo(MaterialButtonsPanel, bpy.types.Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
mat = context.material # dont use node material mat = context.material # dont use node material
halo = mat.halo halo = mat.halo
split = layout.split() split = layout.split()
@@ -536,7 +536,7 @@ class MATERIAL_PT_flare(MaterialButtonsPanel, bpy.types.Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
mat = context.material # dont use node material mat = context.material # dont use node material
halo = mat.halo halo = mat.halo
layout.active = halo.use_flare_mode layout.active = halo.use_flare_mode
@@ -564,7 +564,7 @@ class MATERIAL_PT_physics(MaterialButtonsPanel, bpy.types.Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
phys = context.material.physics # dont use node material phys = context.material.physics # dont use node material
split = layout.split() split = layout.split()
@@ -593,7 +593,7 @@ class MATERIAL_PT_strand(MaterialButtonsPanel, bpy.types.Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
mat = context.material # dont use node material mat = context.material # dont use node material
tan = mat.strand tan = mat.strand
split = layout.split() split = layout.split()
@@ -760,7 +760,7 @@ class MATERIAL_PT_volume_density(VolumeButtonsPanel, bpy.types.Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
vol = context.material.volume # dont use node material vol = context.material.volume # dont use node material
split = layout.split() split = layout.split()
col = split.column() col = split.column()
@@ -777,7 +777,7 @@ class MATERIAL_PT_volume_shading(VolumeButtonsPanel, bpy.types.Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
vol = context.material.volume # dont use node material vol = context.material.volume # dont use node material
split = layout.split() split = layout.split()
@@ -802,7 +802,7 @@ class MATERIAL_PT_volume_lighting(VolumeButtonsPanel, bpy.types.Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
vol = context.material.volume # dont use node material vol = context.material.volume # dont use node material
split = layout.split() split = layout.split()
@@ -837,7 +837,7 @@ class MATERIAL_PT_volume_transp(VolumeButtonsPanel, bpy.types.Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
mat = context.material # dont use node material mat = context.material # dont use node material
layout.prop(mat, "transparency_method", expand=True) layout.prop(mat, "transparency_method", expand=True)
@@ -849,7 +849,7 @@ class MATERIAL_PT_volume_integration(VolumeButtonsPanel, bpy.types.Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
vol = context.material.volume # dont use node material vol = context.material.volume # dont use node material
split = layout.split() split = layout.split()

View File

@@ -296,7 +296,7 @@ class OBJECT_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
col.operator("object.paths_clear", text="Clear Paths") col.operator("object.paths_clear", text="Clear Paths")
class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel): #, bpy.types.Panel): # inherit from panel when ready class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel): # , bpy.types.Panel): # inherit from panel when ready
#bl_label = "Object Onion Skinning" #bl_label = "Object Onion Skinning"
bl_context = "object" bl_context = "object"

View File

@@ -55,7 +55,7 @@ class ConstraintButtonsPanel():
row.prop(con, "owner_space", text="") row.prop(con, "owner_space", text="")
def target_template(self, layout, con, subtargets=True): def target_template(self, layout, con, subtargets=True):
layout.prop(con, "target") # XXX limiting settings for only 'curves' or some type of object layout.prop(con, "target") # XXX limiting settings for only 'curves' or some type of object
if con.target and subtargets: if con.target and subtargets:
if con.target.type == 'ARMATURE': if con.target.type == 'ARMATURE':

View File

@@ -470,7 +470,6 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, bpy.types.Panel):
elif part.physics_type == 'BOIDS': elif part.physics_type == 'BOIDS':
boids = part.boids boids = part.boids
row = layout.row() row = layout.row()
row.prop(boids, "use_flight") row.prop(boids, "use_flight")
row.prop(boids, "use_land") row.prop(boids, "use_land")
@@ -1032,7 +1031,6 @@ class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, bpy.types.Panel):
row.label(text="Vertex Group") row.label(text="Vertex Group")
row.label(text="Negate") row.label(text="Negate")
row = layout.row() row = layout.row()
row.prop_search(psys, "vertex_group_density", ob, "vertex_groups", text="Density") row.prop_search(psys, "vertex_group_density", ob, "vertex_groups", text="Density")
row.prop(psys, "invert_vertex_group_density", text="") row.prop(psys, "invert_vertex_group_density", text="")

View File

@@ -46,7 +46,7 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
row = layout.row() row = layout.row()
row.label(text="File Path:") row.label(text="File Path:")
row.prop(cache, "use_library_path", "Use Lib Path") row.prop(cache, "use_library_path", "Use Lib Path")
layout.prop(cache, "filepath", text="") layout.prop(cache, "filepath", text="")
layout.label(text=cache.info) layout.label(text=cache.info)
@@ -97,7 +97,6 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
sub.enabled = enabled sub.enabled = enabled
sub.operator("ptcache.bake_from_cache", text="Current Cache to Bake") sub.operator("ptcache.bake_from_cache", text="Current Cache to Bake")
col = split.column() col = split.column()
col.operator("ptcache.bake_all", text="Bake All Dynamics").bake = True col.operator("ptcache.bake_all", text="Bake All Dynamics").bake = True
col.operator("ptcache.free_bake_all", text="Free All Bakes") col.operator("ptcache.free_bake_all", text="Free All Bakes")
@@ -107,7 +106,6 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
def effector_weights_ui(self, context, weights): def effector_weights_ui(self, context, weights):
layout = self.layout layout = self.layout
layout.prop(weights, "group") layout.prop(weights, "group")
split = layout.split() split = layout.split()
@@ -142,7 +140,6 @@ def effector_weights_ui(self, context, weights):
def basic_force_field_settings_ui(self, context, field): def basic_force_field_settings_ui(self, context, field):
layout = self.layout layout = self.layout
split = layout.split() split = layout.split()
if not field or field.type == 'NONE': if not field or field.type == 'NONE':
@@ -191,7 +188,6 @@ def basic_force_field_settings_ui(self, context, field):
def basic_force_field_falloff_ui(self, context, field): def basic_force_field_falloff_ui(self, context, field):
layout = self.layout layout = self.layout
# XXX: This doesn't update for some reason. # XXX: This doesn't update for some reason.
#split = layout.split() #split = layout.split()
split = layout.split(percentage=0.35) split = layout.split(percentage=0.35)

View File

@@ -57,7 +57,7 @@ class PHYSICS_PT_field(PhysicButtonsPanel, bpy.types.Panel):
split = layout.split() split = layout.split()
if field.type == 'NONE': if field.type == 'NONE':
return # nothing to draw return # nothing to draw
elif field.type == 'GUIDE': elif field.type == 'GUIDE':
col = split.column() col = split.column()
col.prop(field, "guide_minimum") col.prop(field, "guide_minimum")

View File

@@ -58,7 +58,6 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel):
split.operator("object.modifier_add", text="Add").type = 'FLUID_SIMULATION' split.operator("object.modifier_add", text="Add").type = 'FLUID_SIMULATION'
split.label() split.label()
if md: if md:
row = layout.row() row = layout.row()
row.prop(fluid, "type") row.prop(fluid, "type")

View File

@@ -89,7 +89,7 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, bpy.types.Panel):
sub.prop(domain, "use_dissolve_smoke_log", text="Slow") sub.prop(domain, "use_dissolve_smoke_log", text="Slow")
elif md.smoke_type == 'FLOW': elif md.smoke_type == 'FLOW':
flow = md.flow_settings flow = md.flow_settings
split = layout.split() split = layout.split()
@@ -107,7 +107,6 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, bpy.types.Panel):
sub.active = flow.initial_velocity sub.active = flow.initial_velocity
sub.prop(flow, "velocity_factor", text="Multiplier") sub.prop(flow, "velocity_factor", text="Multiplier")
sub = split.column() sub = split.column()
sub.active = not md.flow_settings.use_outflow sub.active = not md.flow_settings.use_outflow
sub.label(text="Behavior:") sub.label(text="Behavior:")

View File

@@ -188,7 +188,6 @@ class PHYSICS_PT_softbody_edge(PhysicButtonsPanel, bpy.types.Panel):
#sub = col.column() #sub = col.column()
#sub.enabled = softbody.aero > 0 #sub.enabled = softbody.aero > 0
col.label(text="Collision:") col.label(text="Collision:")
col.prop(softbody, "use_edge_collision", text="Edge") col.prop(softbody, "use_edge_collision", text="Edge")
col.prop(softbody, "use_face_collision", text="Face") col.prop(softbody, "use_face_collision", text="Face")

View File

@@ -102,7 +102,6 @@ class RENDER_PT_layers(RenderButtonsPanel, bpy.types.Panel):
col.label(text="Mask Layers:") col.label(text="Mask Layers:")
col.prop(rl, "layers_zmask", text="") col.prop(rl, "layers_zmask", text="")
layout.separator() layout.separator()
layout.label(text="Include:") layout.label(text="Include:")
@@ -264,7 +263,6 @@ class RENDER_PT_post_processing(RenderButtonsPanel, bpy.types.Panel):
sub.row().prop(rd, "field_order", expand=True) sub.row().prop(rd, "field_order", expand=True)
sub.prop(rd, "use_fields_still", text="Still") sub.prop(rd, "use_fields_still", text="Still")
col = split.column() col = split.column()
col.prop(rd, "use_edge_enhance") col.prop(rd, "use_edge_enhance")
sub = col.column() sub = col.column()
@@ -298,7 +296,7 @@ class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel):
if file_format in ('AVI_JPEG', 'JPEG'): if file_format in ('AVI_JPEG', 'JPEG'):
split = layout.split() split = layout.split()
split.prop(rd, "file_quality", slider=True) split.prop(rd, "file_quality", slider=True)
if file_format == 'PNG': if file_format == 'PNG':
split = layout.split() split = layout.split()
split.prop(rd, "file_quality", slider=True, text="Compression") split.prop(rd, "file_quality", slider=True, text="Compression")
@@ -382,7 +380,7 @@ class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel):
if rd.quicktime_audiocodec_type == 'AAC': if rd.quicktime_audiocodec_type == 'AAC':
col.prop(rd, "quicktime_audio_codec_isvbr") col.prop(rd, "quicktime_audio_codec_isvbr")
col = subsplit.column() col = subsplit.column()
col.prop(rd, "quicktime_audio_resampling_hq") col.prop(rd, "quicktime_audio_resampling_hq")
@@ -503,6 +501,7 @@ class RENDER_PT_motion_blur(RenderButtonsPanel, bpy.types.Panel):
row.prop(rd, "motion_blur_samples") row.prop(rd, "motion_blur_samples")
row.prop(rd, "motion_blur_shutter") row.prop(rd, "motion_blur_shutter")
class RENDER_PT_dimensions(RenderButtonsPanel, bpy.types.Panel): class RENDER_PT_dimensions(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Dimensions" bl_label = "Dimensions"
COMPAT_ENGINES = {'BLENDER_RENDER'} COMPAT_ENGINES = {'BLENDER_RENDER'}

View File

@@ -134,7 +134,6 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel, bpy.types.Panel):
col.template_any_ID(ksp, "id", "id_type") col.template_any_ID(ksp, "id", "id_type")
col.template_path_builder(ksp, "data_path", ksp.id) col.template_path_builder(ksp, "data_path", ksp.id)
row = layout.row() row = layout.row()
col = row.column() col = row.column()
@@ -230,7 +229,6 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
scene = context.scene scene = context.scene
ks = scene.keying_sets.active ks = scene.keying_sets.active
f.write("# Keying Set: %s\n" % ks.name) f.write("# Keying Set: %s\n" % ks.name)
f.write("import bpy\n\n") f.write("import bpy\n\n")
@@ -249,9 +247,8 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
f.write("ks.use_insertkey_xyz_to_rgb = %s\n" % ks.use_insertkey_xyz_to_rgb) f.write("ks.use_insertkey_xyz_to_rgb = %s\n" % ks.use_insertkey_xyz_to_rgb)
f.write("\n") f.write("\n")
# generate and write set of lookups for id's used in paths # 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 id_to_paths_cache = {} # cache for syncing ID-blocks to bpy paths + shorthands
for ksp in ks.paths: for ksp in ks.paths:
if ksp.id is None: if ksp.id is None:
@@ -278,7 +275,6 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
f.write("%s = %s\n" % (id_pair[0], id_pair[1])) f.write("%s = %s\n" % (id_pair[0], id_pair[1]))
f.write("\n") f.write("\n")
# write paths # write paths
f.write("# Path Definitions\n") f.write("# Path Definitions\n")
for ksp in ks.paths: for ksp in ks.paths:
@@ -289,7 +285,7 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
# find the relevant shorthand from the cache # find the relevant shorthand from the cache
id_bpy_path = id_to_paths_cache[ksp.id][0] id_bpy_path = id_to_paths_cache[ksp.id][0]
else: else:
id_bpy_path = "None" # XXX... id_bpy_path = "None" # XXX...
f.write("%s, '%s'" % (id_bpy_path, ksp.data_path)) f.write("%s, '%s'" % (id_bpy_path, ksp.data_path))
# array index settings (if applicable) # array index settings (if applicable)

View File

@@ -691,7 +691,6 @@ class TEXTURE_PT_envmap(TextureTypePanel, bpy.types.Panel):
tex = context.texture tex = context.texture
env = tex.environment_map env = tex.environment_map
row = layout.row() row = layout.row()
row.prop(env, "source", expand=True) row.prop(env, "source", expand=True)
row.menu("TEXTURE_MT_envmap_specials", icon='DOWNARROW_HLT', text="") row.menu("TEXTURE_MT_envmap_specials", icon='DOWNARROW_HLT', text="")

View File

@@ -50,7 +50,7 @@ class WORLD_PT_context_world(WorldButtonsPanel, bpy.types.Panel):
scene = context.scene scene = context.scene
world = context.world world = context.world
space = context.space_data space = context.space_data
texture_count = world and len(world.texture_slots.keys()) texture_count = world and len(world.texture_slots.keys())
split = layout.split(percentage=0.65) split = layout.split(percentage=0.65)
@@ -62,6 +62,7 @@ class WORLD_PT_context_world(WorldButtonsPanel, bpy.types.Panel):
if texture_count: if texture_count:
split.label(text=str(texture_count), icon='TEXTURE') split.label(text=str(texture_count), icon='TEXTURE')
class WORLD_PT_preview(WorldButtonsPanel, bpy.types.Panel): class WORLD_PT_preview(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Preview" bl_label = "Preview"
COMPAT_ENGINES = {'BLENDER_RENDER'} COMPAT_ENGINES = {'BLENDER_RENDER'}

View File

@@ -28,13 +28,13 @@ def dopesheet_filter(layout, context):
row = layout.row(align=True) row = layout.row(align=True)
row.prop(dopesheet, "show_only_selected", text="") row.prop(dopesheet, "show_only_selected", text="")
row.prop(dopesheet, "show_hidden", text="") row.prop(dopesheet, "show_hidden", text="")
row = layout.row(align=True) row = layout.row(align=True)
row.prop(dopesheet, "show_transforms", text="") row.prop(dopesheet, "show_transforms", text="")
if is_nla: if is_nla:
row.prop(dopesheet, "show_missing_nla", text="") row.prop(dopesheet, "show_missing_nla", text="")
row = layout.row(align=True) row = layout.row(align=True)
row.prop(dopesheet, "show_scenes", text="") row.prop(dopesheet, "show_scenes", text="")
row.prop(dopesheet, "show_worlds", text="") row.prop(dopesheet, "show_worlds", text="")

View File

@@ -44,11 +44,11 @@ class FILEBROWSER_HT_header(bpy.types.Header):
row = layout.row(align=True) row = layout.row(align=True)
row.operator("file.directory_new", text="", icon='NEWFOLDER') row.operator("file.directory_new", text="", icon='NEWFOLDER')
params = st.params params = st.params
# can be None when save/reload with a file selector open # can be None when save/reload with a file selector open
if params: if params:
layout.prop(params, "display_type", expand=True, text="") layout.prop(params, "display_type", expand=True, text="")
layout.prop(params, "sort_method", expand=True, text="") layout.prop(params, "sort_method", expand=True, text="")

View File

@@ -50,7 +50,7 @@ class IMAGE_MT_view(bpy.types.Menu):
layout.prop(sima, "use_realtime_update") layout.prop(sima, "use_realtime_update")
if show_uvedit: if show_uvedit:
layout.prop(toolsettings, "show_uv_local_view") # Numpad / layout.prop(toolsettings, "show_uv_local_view")
layout.prop(uv, "show_other_objects") layout.prop(uv, "show_other_objects")
layout.separator() layout.separator()
@@ -203,8 +203,8 @@ class IMAGE_MT_uvs_weldalign(bpy.types.Menu):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
layout.operator("uv.weld") # W, 1 layout.operator("uv.weld") # W, 1
layout.operator_enums("uv.align", "axis") # W, 2/3/4 layout.operator_enums("uv.align", "axis") # W, 2/3/4
class IMAGE_MT_uvs(bpy.types.Menu): class IMAGE_MT_uvs(bpy.types.Menu):
@@ -663,6 +663,7 @@ class IMAGE_PT_paint_curve(BrushButtonsPanel, bpy.types.Panel):
row.operator("brush.curve_preset", icon="LINCURVE", text="").shape = 'LINE' row.operator("brush.curve_preset", icon="LINCURVE", text="").shape = 'LINE'
row.operator("brush.curve_preset", icon="NOCURVE", text="").shape = 'MAX' row.operator("brush.curve_preset", icon="NOCURVE", text="").shape = 'MAX'
def register(): def register():
pass pass

View File

@@ -352,7 +352,6 @@ class HELP_OT_operator_cheat_sheet(bpy.types.Operator):
return {'FINISHED'} return {'FINISHED'}
def register(): def register():
pass pass

View File

@@ -44,7 +44,7 @@ class LOGIC_PT_properties(bpy.types.Panel):
row = box.row() row = box.row()
row.prop(prop, "name", text="") row.prop(prop, "name", text="")
row.prop(prop, "type", text="") row.prop(prop, "type", text="")
row.prop(prop, "value", text="", toggle=True) # we dont care about the type. rna will display correctly row.prop(prop, "value", text="", toggle=True) # we dont care about the type. rna will display correctly
row.prop(prop, "show_debug", text="", toggle=True, icon='INFO') row.prop(prop, "show_debug", text="", toggle=True, icon='INFO')
row.operator("object.game_property_remove", text="", icon='X', emboss=False).index = i row.operator("object.game_property_remove", text="", icon='X', emboss=False).index = i
@@ -58,7 +58,7 @@ class LOGIC_MT_logicbricks_add(bpy.types.Menu):
layout.operator_menu_enum("logic.sensor_add", "type", text="Sensor") layout.operator_menu_enum("logic.sensor_add", "type", text="Sensor")
layout.operator_menu_enum("logic.controller_add", "type", text="Controller") layout.operator_menu_enum("logic.controller_add", "type", text="Controller")
layout.operator_menu_enum("logic.actuator_add", "type", text="Actuator") layout.operator_menu_enum("logic.actuator_add", "type", text="Actuator")
class LOGIC_HT_header(bpy.types.Header): class LOGIC_HT_header(bpy.types.Header):
bl_space_type = 'LOGIC_EDITOR' bl_space_type = 'LOGIC_EDITOR'
@@ -76,7 +76,7 @@ class LOGIC_HT_header(bpy.types.Header):
sub.menu("LOGIC_MT_view") sub.menu("LOGIC_MT_view")
#sub.menu("LOGIC_MT_select") #sub.menu("LOGIC_MT_select")
#sub.menu("LOGIC_MT_add") #sub.menu("LOGIC_MT_add")
class LOGIC_MT_view(bpy.types.Menu): class LOGIC_MT_view(bpy.types.Menu):
bl_label = "View" bl_label = "View"
@@ -85,7 +85,7 @@ class LOGIC_MT_view(bpy.types.Menu):
layout = self.layout layout = self.layout
layout.column() layout.column()
layout.operator("logic.properties", icon='MENU_PANEL') layout.operator("logic.properties", icon='MENU_PANEL')

View File

@@ -92,11 +92,11 @@ class NODE_MT_view(bpy.types.Menu):
if context.space_data.show_backdrop: if context.space_data.show_backdrop:
layout.separator() layout.separator()
layout.operator("node.backimage_move",text = "Backdrop move") layout.operator("node.backimage_move", text="Backdrop move")
layout.operator("node.backimage_zoom",text = "Backdrop zoom in").factor = 1.2 layout.operator("node.backimage_zoom", text="Backdrop zoom in").factor = 1.2
layout.operator("node.backimage_zoom",text = "Backdrop zoom out").factor = 0.833 layout.operator("node.backimage_zoom", text="Backdrop zoom out").factor = 0.833
layout.separator() layout.separator()
layout.operator("screen.area_dupli") layout.operator("screen.area_dupli")

View File

@@ -98,9 +98,9 @@ class SEQUENCER_MT_view(bpy.types.Menu):
st = context.space_data st = context.space_data
layout.column() layout.column()
layout.operator("sequencer.properties", icon='MENU_PANEL') layout.operator("sequencer.properties", icon='MENU_PANEL')
layout.separator() layout.separator()
""" """
@@ -458,7 +458,6 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
for i in range(1, strip.channel): for i in range(1, strip.channel):
row.operator("sequencer.cut_multicam", text=str(i)).camera = i row.operator("sequencer.cut_multicam", text=str(i)).camera = i
col = layout.column(align=True) col = layout.column(align=True)
if strip.type == 'SPEED': if strip.type == 'SPEED':
col.prop(strip, "speed_fader", text="Speed fader") col.prop(strip, "speed_fader", text="Speed fader")
@@ -466,7 +465,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
col.prop(strip, "use_default_fade", "Default fade") col.prop(strip, "use_default_fade", "Default fade")
if not strip.use_default_fade: if not strip.use_default_fade:
col.prop(strip, "effect_fader", text="Effect fader") col.prop(strip, "effect_fader", text="Effect fader")
layout.prop(strip, "use_translation", text="Image Offset:") layout.prop(strip, "use_translation", text="Image Offset:")
if strip.use_translation: if strip.use_translation:
col = layout.column(align=True) col = layout.column(align=True)
@@ -554,7 +553,7 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel):
col = split.column() col = split.column()
col.label(text="File:") col.label(text="File:")
col = split.column() col = split.column()
col.prop(elem, "filename", text="") # strip.elements[0] could be a fallback col.prop(elem, "filename", text="") # strip.elements[0] could be a fallback
elif seq_type == 'MOVIE': elif seq_type == 'MOVIE':
split = layout.split(percentage=0.2) split = layout.split(percentage=0.2)
@@ -566,7 +565,6 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel):
# TODO, sound??? # TODO, sound???
# end drawing filename # end drawing filename
layout.prop(strip, "use_translation", text="Image Offset:") layout.prop(strip, "use_translation", text="Image Offset:")
if strip.use_translation: if strip.use_translation:
col = layout.column(align=True) col = layout.column(align=True)
@@ -698,7 +696,7 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel, bpy.types.Panel):
col.prop(strip, "use_float") col.prop(strip, "use_float")
layout.prop(strip, "use_color_balance") layout.prop(strip, "use_color_balance")
if strip.use_color_balance and strip.color_balance: # TODO - need to add this somehow if strip.use_color_balance and strip.color_balance: # TODO - need to add this somehow
row = layout.row() row = layout.row()
row.active = strip.use_color_balance row.active = strip.use_color_balance
col = row.column() col = row.column()
@@ -742,7 +740,7 @@ class SEQUENCER_PT_proxy(SequencerButtonsPanel, bpy.types.Panel):
flow = layout.column_flow() flow = layout.column_flow()
flow.prop(strip, "use_proxy_custom_directory") flow.prop(strip, "use_proxy_custom_directory")
flow.prop(strip, "use_proxy_custom_file") flow.prop(strip, "use_proxy_custom_file")
if strip.proxy: # TODO - need to add this somehow if strip.proxy: # TODO - need to add this somehow
if strip.use_proxy_custom_directory and not strip.use_proxy_custom_file: if strip.use_proxy_custom_directory and not strip.use_proxy_custom_file:
flow.prop(strip.proxy, "directory") flow.prop(strip.proxy, "directory")
if strip.use_proxy_custom_file: if strip.use_proxy_custom_file:
@@ -783,12 +781,13 @@ class SEQUENCER_PT_view(SequencerButtonsPanel_Output, bpy.types.Panel):
col = layout.column() col = layout.column()
if st.display_mode == 'IMAGE': if st.display_mode == 'IMAGE':
col.prop(st, "draw_overexposed") # text="Zebra" col.prop(st, "draw_overexposed") # text="Zebra"
col.prop(st, "show_safe_margin") col.prop(st, "show_safe_margin")
if st.display_mode == 'WAVEFORM': if st.display_mode == 'WAVEFORM':
col.prop(st, "show_separate_color") col.prop(st, "show_separate_color")
col.prop(st, "proxy_render_size") col.prop(st, "proxy_render_size")
def register(): def register():
pass pass

View File

@@ -131,12 +131,12 @@ class TEXT_PT_find(bpy.types.Panel):
class TEXT_MT_view(bpy.types.Menu): class TEXT_MT_view(bpy.types.Menu):
bl_label = "View" bl_label = "View"
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
layout.operator("text.properties", icon='MENU_PANEL') layout.operator("text.properties", icon='MENU_PANEL')
layout.separator() layout.separator()
layout.operator("screen.area_dupli") layout.operator("screen.area_dupli")
@@ -146,8 +146,8 @@ class TEXT_MT_view(bpy.types.Menu):
layout.operator("text.move", text="Top of File").type = 'FILE_TOP' layout.operator("text.move", text="Top of File").type = 'FILE_TOP'
layout.operator("text.move", text="Bottom of File").type = 'FILE_BOTTOM' layout.operator("text.move", text="Bottom of File").type = 'FILE_BOTTOM'
class TEXT_MT_text(bpy.types.Menu): class TEXT_MT_text(bpy.types.Menu):
bl_label = "Text" bl_label = "Text"
@@ -293,6 +293,7 @@ class TEXT_MT_toolbox(bpy.types.Menu):
layout.operator("text.run_script") layout.operator("text.run_script")
def register(): def register():
pass pass

View File

@@ -192,6 +192,7 @@ class TIME_MT_autokey(bpy.types.Menu):
layout.prop_enum(tools, "auto_keying_mode", 'ADD_REPLACE_KEYS') layout.prop_enum(tools, "auto_keying_mode", 'ADD_REPLACE_KEYS')
layout.prop_enum(tools, "auto_keying_mode", 'REPLACE_KEYS') layout.prop_enum(tools, "auto_keying_mode", 'REPLACE_KEYS')
def register(): def register():
pass pass

View File

@@ -359,7 +359,6 @@ class USERPREF_PT_system(bpy.types.Panel):
split = layout.split() split = layout.split()
# 1. Column # 1. Column
column = split.column() column = split.column()
colsplit = column.split(percentage=0.85) colsplit = column.split(percentage=0.85)
@@ -412,7 +411,6 @@ class USERPREF_PT_system(bpy.types.Panel):
#col.prop(system, "use_textured_fonts") #col.prop(system, "use_textured_fonts")
# 2. Column # 2. Column
column = split.column() column = split.column()
colsplit = column.split(percentage=0.85) colsplit = column.split(percentage=0.85)
@@ -439,7 +437,6 @@ class USERPREF_PT_system(bpy.types.Panel):
col.prop(system, "prefetch_frames") col.prop(system, "prefetch_frames")
col.prop(system, "memory_cache_limit") col.prop(system, "memory_cache_limit")
# 3. Column # 3. Column
column = split.column() column = split.column()
@@ -527,7 +524,6 @@ class USERPREF_PT_theme(bpy.types.Panel):
split = layout.split(percentage=0.4) split = layout.split(percentage=0.4)
layout.separator() layout.separator()
layout.separator() layout.separator()
@@ -624,7 +620,6 @@ class USERPREF_PT_theme(bpy.types.Panel):
colsub.row().prop(ui, "inner_key_sel") colsub.row().prop(ui, "inner_key_sel")
colsub.row().prop(ui, "blend") colsub.row().prop(ui, "blend")
ui = theme.user_interface ui = theme.user_interface
col.separator() col.separator()
col.separator() col.separator()
@@ -809,7 +804,7 @@ class USERPREF_PT_addons(bpy.types.Panel):
bl_label = "Addons" bl_label = "Addons"
bl_region_type = 'WINDOW' bl_region_type = 'WINDOW'
bl_options = {'HIDE_HEADER'} bl_options = {'HIDE_HEADER'}
_addons_fake_modules = {} _addons_fake_modules = {}
@classmethod @classmethod
@@ -905,8 +900,7 @@ class USERPREF_PT_addons(bpy.types.Panel):
mod = fake_module(mod_name, mod_path) mod = fake_module(mod_name, mod_path)
if mod: if mod:
USERPREF_PT_addons._addons_fake_modules[mod_name] = mod USERPREF_PT_addons._addons_fake_modules[mod_name] = mod
# just incase we get stale modules, not likely # just incase we get stale modules, not likely
for mod_stale in modules_stale: for mod_stale in modules_stale:
del USERPREF_PT_addons._addons_fake_modules[mod_stale] del USERPREF_PT_addons._addons_fake_modules[mod_stale]
@@ -956,7 +950,6 @@ class USERPREF_PT_addons(bpy.types.Panel):
(filter == "Enabled" and is_enabled) or \ (filter == "Enabled" and is_enabled) or \
(filter == "Disabled" and not is_enabled): (filter == "Disabled" and not is_enabled):
if search and search not in info["name"].lower(): if search and search not in info["name"].lower():
if info["author"]: if info["author"]:
if search not in info["author"].lower(): if search not in info["author"].lower():
@@ -974,7 +967,8 @@ class USERPREF_PT_addons(bpy.types.Panel):
rowsub = row.row() rowsub = row.row()
rowsub.active = is_enabled rowsub.active = is_enabled
rowsub.label(text='%s: %s' % (info['category'], info["name"])) rowsub.label(text='%s: %s' % (info['category'], info["name"]))
if info["warning"]: rowsub.label(icon='ERROR') if info["warning"]:
rowsub.label(icon='ERROR')
if is_enabled: if is_enabled:
row.operator("wm.addon_disable", icon='CHECKBOX_HLT', text="", emboss=False).module = module_name row.operator("wm.addon_disable", icon='CHECKBOX_HLT', text="", emboss=False).module = module_name
@@ -1090,9 +1084,9 @@ class WM_OT_addon_enable(bpy.types.Operator):
if info.get("blender", (0, 0, 0)) > bpy.app.version: if info.get("blender", (0, 0, 0)) > bpy.app.version:
self.report("WARNING','This script was written for a newer version of Blender and might not function (correctly).\nThe script is enabled though.") self.report("WARNING','This script was written for a newer version of Blender and might not function (correctly).\nThe script is enabled though.")
_bpy_types._register_immediate = True _bpy_types._register_immediate = True
return {'FINISHED'} return {'FINISHED'}
@@ -1109,7 +1103,7 @@ class WM_OT_addon_disable(bpy.types.Operator):
try: try:
mod = __import__(module_name) mod = __import__(module_name)
_bpy_types._unregister_module(module_name, free=False) # dont free because we may want to enable again. _bpy_types._unregister_module(module_name, free=False) # dont free because we may want to enable again.
mod.unregister() mod.unregister()
except: except:
import traceback import traceback
@@ -1117,7 +1111,7 @@ class WM_OT_addon_disable(bpy.types.Operator):
addons = context.user_preferences.addons addons = context.user_preferences.addons
ok = True ok = True
while ok: # incase its in more then once. while ok: # incase its in more then once.
ok = False ok = False
for ext in addons: for ext in addons:
if ext.module == module_name: if ext.module == module_name:
@@ -1215,6 +1209,7 @@ class WM_OT_addon_expand(bpy.types.Operator):
def register(): def register():
pass pass
def unregister(): def unregister():
pass pass

View File

@@ -22,17 +22,17 @@ import os
KM_HIERARCHY = [ KM_HIERARCHY = [
('Window', 'EMPTY', 'WINDOW', []), # file save, window change, exit ('Window', 'EMPTY', 'WINDOW', []), # file save, window change, exit
('Screen', 'EMPTY', 'WINDOW', [ # full screen, undo, screenshot ('Screen', 'EMPTY', 'WINDOW', [ # full screen, undo, screenshot
('Screen Editing', 'EMPTY', 'WINDOW', []), # resizing, action corners ('Screen Editing', 'EMPTY', 'WINDOW', []), # resizing, action corners
]), ]),
('View2D', 'EMPTY', 'WINDOW', []), # view 2d navigation (per region) ('View2D', 'EMPTY', 'WINDOW', []), # view 2d navigation (per region)
('View2D Buttons List', 'EMPTY', 'WINDOW', []), # view 2d with buttons navigation ('View2D Buttons List', 'EMPTY', 'WINDOW', []), # view 2d with buttons navigation
('Header', 'EMPTY', 'WINDOW', []), # header stuff (per region) ('Header', 'EMPTY', 'WINDOW', []), # header stuff (per region)
('Grease Pencil', 'EMPTY', 'WINDOW', []), # grease pencil stuff (per region) ('Grease Pencil', 'EMPTY', 'WINDOW', []), # grease pencil stuff (per region)
('3D View', 'VIEW_3D', 'WINDOW', [ # view 3d navigation and generic stuff (select, transform) ('3D View', 'VIEW_3D', 'WINDOW', [ # view 3d navigation and generic stuff (select, transform)
('Object Mode', 'EMPTY', 'WINDOW', []), ('Object Mode', 'EMPTY', 'WINDOW', []),
('Mesh', 'EMPTY', 'WINDOW', []), ('Mesh', 'EMPTY', 'WINDOW', []),
('Curve', 'EMPTY', 'WINDOW', []), ('Curve', 'EMPTY', 'WINDOW', []),
@@ -46,13 +46,13 @@ KM_HIERARCHY = [
('Vertex Paint', 'EMPTY', 'WINDOW', []), ('Vertex Paint', 'EMPTY', 'WINDOW', []),
('Weight Paint', 'EMPTY', 'WINDOW', []), ('Weight Paint', 'EMPTY', 'WINDOW', []),
('Face Mask', 'EMPTY', 'WINDOW', []), ('Face Mask', 'EMPTY', 'WINDOW', []),
('Image Paint', 'EMPTY', 'WINDOW', []), # image and view3d ('Image Paint', 'EMPTY', 'WINDOW', []), # image and view3d
('Sculpt', 'EMPTY', 'WINDOW', []), ('Sculpt', 'EMPTY', 'WINDOW', []),
('Armature Sketch', 'EMPTY', 'WINDOW', []), ('Armature Sketch', 'EMPTY', 'WINDOW', []),
('Particle', 'EMPTY', 'WINDOW', []), ('Particle', 'EMPTY', 'WINDOW', []),
('Object Non-modal', 'EMPTY', 'WINDOW', []), # mode change ('Object Non-modal', 'EMPTY', 'WINDOW', []), # mode change
('3D View Generic', 'VIEW_3D', 'WINDOW', []) # toolbar and properties ('3D View Generic', 'VIEW_3D', 'WINDOW', []) # toolbar and properties
]), ]),
@@ -71,8 +71,8 @@ KM_HIERARCHY = [
]), ]),
('Image', 'IMAGE_EDITOR', 'WINDOW', [ ('Image', 'IMAGE_EDITOR', 'WINDOW', [
('UV Editor', 'EMPTY', 'WINDOW', []), # image (reverse order, UVEdit before Image ('UV Editor', 'EMPTY', 'WINDOW', []), # image (reverse order, UVEdit before Image
('Image Paint', 'EMPTY', 'WINDOW', []), # image and view3d ('Image Paint', 'EMPTY', 'WINDOW', []), # image and view3d
('Image Generic', 'IMAGE_EDITOR', 'WINDOW', []) ('Image Generic', 'IMAGE_EDITOR', 'WINDOW', [])
]), ]),
@@ -90,7 +90,7 @@ KM_HIERARCHY = [
('File Browser Buttons', 'FILE_BROWSER', 'WINDOW', []) ('File Browser Buttons', 'FILE_BROWSER', 'WINDOW', [])
]), ]),
('Property Editor', 'PROPERTIES', 'WINDOW', []), # align context menu ('Property Editor', 'PROPERTIES', 'WINDOW', []), # align context menu
('Script', 'SCRIPTS_WINDOW', 'WINDOW', []), ('Script', 'SCRIPTS_WINDOW', 'WINDOW', []),
('Text', 'TEXT_EDITOR', 'WINDOW', []), ('Text', 'TEXT_EDITOR', 'WINDOW', []),
@@ -538,7 +538,7 @@ class WM_OT_keyconfig_import(bpy.types.Operator):
if config_name is None: if config_name is None:
raise Exception("config name not found") raise Exception("config name not found")
path = os.path.join(__file__, "..", "..", "cfg") # remove ui/space_userpref.py path = os.path.join(__file__, "..", "..", "cfg") # remove ui/space_userpref.py
path = os.path.normpath(path) path = os.path.normpath(path)
print(path) print(path)
@@ -734,9 +734,9 @@ class WM_OT_keyitem_add(bpy.types.Operator):
kc = wm.keyconfigs.default kc = wm.keyconfigs.default
if km.is_modal: if km.is_modal:
km.items.new_modal("", 'A', 'PRESS') # kmi km.items.new_modal("", 'A', 'PRESS') # kmi
else: else:
km.items.new("none", 'A', 'PRESS') # kmi km.items.new("none", 'A', 'PRESS') # kmi
# clear filter and expand keymap so we can see the newly added item # clear filter and expand keymap so we can see the newly added item
if context.space_data.filter_text != "": if context.space_data.filter_text != "":
@@ -785,7 +785,7 @@ class WM_OT_keyconfig_remove(bpy.types.Operator):
if os.path.exists(path): if os.path.exists(path):
os.remove(path) os.remove(path)
path = module.__file__ + "c" # for .pyc path = module.__file__ + "c" # for .pyc
if os.path.exists(path): if os.path.exists(path):
os.remove(path) os.remove(path)
@@ -793,9 +793,11 @@ class WM_OT_keyconfig_remove(bpy.types.Operator):
wm.keyconfigs.remove(keyconfig) wm.keyconfigs.remove(keyconfig)
return {'FINISHED'} return {'FINISHED'}
def register(): def register():
pass pass
def unregister(): def unregister():
pass pass

View File

@@ -155,7 +155,7 @@ class VIEW3D_MT_transform(bpy.types.Menu):
layout.operator("armature.align") layout.operator("armature.align")
else: else:
layout.operator_context = 'EXEC_REGION_WIN' layout.operator_context = 'EXEC_REGION_WIN'
layout.operator("transform.transform", text="Align to Transform Orientation").mode = 'ALIGN' # XXX see alignmenu() in edit.c of b2.4x to get this working layout.operator("transform.transform", text="Align to Transform Orientation").mode = 'ALIGN' # XXX see alignmenu() in edit.c of b2.4x to get this working
layout.separator() layout.separator()
@@ -608,7 +608,6 @@ class VIEW3D_MT_select_edit_armature(bpy.types.Menu):
layout.operator("view3d.select_border") layout.operator("view3d.select_border")
layout.separator() layout.separator()
layout.operator("armature.select_all", text="Select/Deselect All") layout.operator("armature.select_all", text="Select/Deselect All")
@@ -632,7 +631,7 @@ class VIEW3D_MT_select_edit_armature(bpy.types.Menu):
layout.operator("object.select_pattern", text="Select Pattern...") layout.operator("object.select_pattern", text="Select Pattern...")
class VIEW3D_MT_select_face(bpy.types.Menu):# XXX no matching enum class VIEW3D_MT_select_face(bpy.types.Menu): # XXX no matching enum
bl_label = "Select" bl_label = "Select"
def draw(self, context): def draw(self, context):
@@ -738,7 +737,7 @@ class VIEW3D_MT_object_specials(bpy.types.Menu):
props.data_path_item = "data.dof_distance" props.data_path_item = "data.dof_distance"
props.input_scale = 0.02 props.input_scale = 0.02
if obj.type in ('CURVE','TEXT'): if obj.type in ('CURVE', 'TEXT'):
layout.operator_context = 'INVOKE_REGION_WIN' layout.operator_context = 'INVOKE_REGION_WIN'
props = layout.operator("wm.context_modal_mouse", text="Extrude Size") props = layout.operator("wm.context_modal_mouse", text="Extrude Size")
@@ -799,6 +798,7 @@ class VIEW3D_MT_object_specials(bpy.types.Menu):
props = layout.operator("object.isolate_type_render") props = layout.operator("object.isolate_type_render")
props = layout.operator("object.hide_render_clear_all") props = layout.operator("object.hide_render_clear_all")
class VIEW3D_MT_object_apply(bpy.types.Menu): class VIEW3D_MT_object_apply(bpy.types.Menu):
bl_label = "Apply" bl_label = "Apply"
@@ -900,7 +900,7 @@ class VIEW3D_MT_make_links(bpy.types.Menu):
layout.operator_menu_enum("object.make_links_scene", "scene", text="Objects to Scene...") layout.operator_menu_enum("object.make_links_scene", "scene", text="Objects to Scene...")
layout.operator_menu_enum("marker.make_links_scene", "scene", text="Markers to Scene...") layout.operator_menu_enum("marker.make_links_scene", "scene", text="Markers to Scene...")
layout.operator_enums("object.make_links_data", "type") # inline layout.operator_enums("object.make_links_data", "type") # inline
class VIEW3D_MT_object_game_properties(bpy.types.Menu): class VIEW3D_MT_object_game_properties(bpy.types.Menu):
@@ -1729,7 +1729,7 @@ class VIEW3D_MT_edit_text(bpy.types.Menu):
layout.menu("VIEW3D_MT_edit_text_chars") layout.menu("VIEW3D_MT_edit_text_chars")
layout.separator() layout.separator()
layout.operator("font.style_toggle", text="Toggle Bold").style = 'BOLD' layout.operator("font.style_toggle", text="Toggle Bold").style = 'BOLD'
layout.operator("font.style_toggle", text="Toggle Italic").style = 'ITALIC' layout.operator("font.style_toggle", text="Toggle Italic").style = 'ITALIC'
layout.operator("font.style_toggle", text="Toggle Underline").style = 'UNDERLINE' layout.operator("font.style_toggle", text="Toggle Underline").style = 'UNDERLINE'

View File

@@ -92,14 +92,12 @@ class VIEW3D_PT_tools_meshedit(View3DPanel, bpy.types.Panel):
col.operator("transform.resize", text="Scale") col.operator("transform.resize", text="Scale")
col.operator("transform.shrink_fatten", text="Along Normal") col.operator("transform.shrink_fatten", text="Along Normal")
col = layout.column(align=True) col = layout.column(align=True)
col.label(text="Deform:") col.label(text="Deform:")
col.operator("transform.edge_slide") col.operator("transform.edge_slide")
col.operator("mesh.rip_move") col.operator("mesh.rip_move")
col.operator("mesh.vertices_smooth") col.operator("mesh.vertices_smooth")
col = layout.column(align=True) col = layout.column(align=True)
col.label(text="Add:") col.label(text="Add:")
col.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Region") col.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Region")
@@ -127,7 +125,6 @@ class VIEW3D_PT_tools_meshedit(View3DPanel, bpy.types.Panel):
col.operator("mesh.mark_seam") col.operator("mesh.mark_seam")
col.operator("mesh.mark_seam", text="Clear Seam").clear = True col.operator("mesh.mark_seam", text="Clear Seam").clear = True
col = layout.column(align=True) col = layout.column(align=True)
col.label(text="Shading:") col.label(text="Shading:")
col.operator("mesh.faces_shade_smooth", text="Smooth") col.operator("mesh.faces_shade_smooth", text="Smooth")
@@ -540,7 +537,6 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
col = layout.column() col = layout.column()
col.separator() col.separator()
row = col.row(align=True) row = col.row(align=True)
@@ -554,7 +550,6 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
row.prop(brush, "use_pressure_size", toggle=True, text="") row.prop(brush, "use_pressure_size", toggle=True, text="")
if brush.sculpt_tool not in ('SNAKE_HOOK', 'GRAB', 'ROTATE'): if brush.sculpt_tool not in ('SNAKE_HOOK', 'GRAB', 'ROTATE'):
col.separator() col.separator()
@@ -569,8 +564,6 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
row.prop(brush, "strength", text="Strength", slider=True) row.prop(brush, "strength", text="Strength", slider=True)
row.prop(brush, "use_pressure_strength", text="") row.prop(brush, "use_pressure_strength", text="")
if brush.sculpt_tool not in ('SMOOTH'): if brush.sculpt_tool not in ('SMOOTH'):
col.separator() col.separator()
@@ -578,16 +571,12 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
row.prop(brush, "auto_smooth_factor", slider=True) row.prop(brush, "auto_smooth_factor", slider=True)
row.prop(brush, "use_inverse_smooth_pressure", toggle=True, text="") row.prop(brush, "use_inverse_smooth_pressure", toggle=True, text="")
if brush.sculpt_tool in ('GRAB', 'SNAKE_HOOK'): if brush.sculpt_tool in ('GRAB', 'SNAKE_HOOK'):
col.separator() col.separator()
row = col.row(align=True) row = col.row(align=True)
row.prop(brush, "normal_weight", slider=True) row.prop(brush, "normal_weight", slider=True)
if brush.sculpt_tool in ('CREASE', 'BLOB'): if brush.sculpt_tool in ('CREASE', 'BLOB'):
col.separator() col.separator()
@@ -614,15 +603,15 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
col.separator() col.separator()
row= col.row() row = col.row()
row.prop(brush, "use_plane_trim", text="Trim") row.prop(brush, "use_plane_trim", text="Trim")
row= col.row() row = col.row()
row.active=brush.use_plane_trim row.active = brush.use_plane_trim
row.prop(brush, "plane_trim", slider=True, text="Distance") row.prop(brush, "plane_trim", slider=True, text="Distance")
col.separator() col.separator()
row= col.row() row = col.row()
row.prop(brush, "use_frontface", text="Front Faces Only") row.prop(brush, "use_frontface", text="Front Faces Only")
col.separator() col.separator()
@@ -633,8 +622,6 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
col.prop(brush, "use_accumulate") col.prop(brush, "use_accumulate")
if brush.sculpt_tool == 'LAYER': if brush.sculpt_tool == 'LAYER':
col.separator() col.separator()
@@ -675,9 +662,7 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
col.active = (brush.blend not in ('ERASE_ALPHA', 'ADD_ALPHA')) col.active = (brush.blend not in ('ERASE_ALPHA', 'ADD_ALPHA'))
col.prop(brush, "use_alpha") col.prop(brush, "use_alpha")
# Weight Paint Mode # # Weight Paint Mode #
elif context.weight_paint_object and brush: elif context.weight_paint_object and brush:
layout.prop(context.tool_settings, "vertex_group_weight", text="Weight", slider=True) layout.prop(context.tool_settings, "vertex_group_weight", text="Weight", slider=True)
layout.prop(context.tool_settings, "use_auto_normalize", text="Auto Normalize") layout.prop(context.tool_settings, "use_auto_normalize", text="Auto Normalize")
@@ -697,7 +682,6 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
row.prop(brush, "use_pressure_jitter", toggle=True, text="") row.prop(brush, "use_pressure_jitter", toggle=True, text="")
# Vertex Paint Mode # # Vertex Paint Mode #
elif context.vertex_paint_object and brush: elif context.vertex_paint_object and brush:
col = layout.column() col = layout.column()
col.template_color_wheel(brush, "color", value_slider=True) col.template_color_wheel(brush, "color", value_slider=True)
@@ -741,11 +725,8 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel):
if context.sculpt_object: if context.sculpt_object:
#XXX duplicated from properties_texture.py #XXX duplicated from properties_texture.py
col.separator() col.separator()
col.label(text="Brush Mapping:") col.label(text="Brush Mapping:")
row = col.row(align=True) row = col.row(align=True)
row.prop(tex_slot, "map_mode", expand=True) row.prop(tex_slot, "map_mode", expand=True)
@@ -755,7 +736,7 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel):
col = layout.column() col = layout.column()
col.active = tex_slot.map_mode in ('FIXED', ) col.active = tex_slot.map_mode in ('FIXED', )
col.label(text="Angle:") col.label(text="Angle:")
col = layout.column() col = layout.column()
if not brush.use_anchor and brush.sculpt_tool not in ('GRAB', 'SNAKE_HOOK', 'THUMB', 'ROTATE') and tex_slot.map_mode in ('FIXED'): if not brush.use_anchor and brush.sculpt_tool not in ('GRAB', 'SNAKE_HOOK', 'THUMB', 'ROTATE') and tex_slot.map_mode in ('FIXED'):
col.prop(brush, "texture_angle_source_random", text="") col.prop(brush, "texture_angle_source_random", text="")
@@ -988,7 +969,6 @@ class VIEW3D_PT_sculpt_options(PaintPanel, bpy.types.Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
tool_settings = context.tool_settings tool_settings = context.tool_settings
sculpt = tool_settings.sculpt sculpt = tool_settings.sculpt
settings = __class__.paint_settings(context) settings = __class__.paint_settings(context)
@@ -1014,8 +994,7 @@ class VIEW3D_PT_sculpt_options(PaintPanel, bpy.types.Panel):
row.prop(sculpt, "lock_y", text="Y", toggle=True) row.prop(sculpt, "lock_y", text="Y", toggle=True)
row.prop(sculpt, "lock_z", text="Z", toggle=True) row.prop(sculpt, "lock_z", text="Z", toggle=True)
class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel): class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel):
bl_label = "Symmetry" bl_label = "Symmetry"
bl_options = {'DEFAULT_CLOSED'} bl_options = {'DEFAULT_CLOSED'}
@@ -1051,6 +1030,7 @@ class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel):
col.prop(sculpt, "use_symmetry_feather", text="Feather") col.prop(sculpt, "use_symmetry_feather", text="Feather")
class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel): class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel):
bl_label = "Appearance" bl_label = "Appearance"
bl_options = {'DEFAULT_CLOSED'} bl_options = {'DEFAULT_CLOSED'}
@@ -1066,7 +1046,7 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel):
settings = __class__.paint_settings(context) settings = __class__.paint_settings(context)
brush = settings.brush brush = settings.brush
col = layout.column(); col = layout.column()
if context.sculpt_object and context.tool_settings.sculpt: if context.sculpt_object and context.tool_settings.sculpt:
#if brush.sculpt_tool in ('DRAW', 'INFLATE', 'CLAY', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN', 'FILL', 'SCRAPE', 'CLAY_TUBES'): #if brush.sculpt_tool in ('DRAW', 'INFLATE', 'CLAY', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN', 'FILL', 'SCRAPE', 'CLAY_TUBES'):
@@ -1259,7 +1239,8 @@ class VIEW3D_PT_imagepaint_options(PaintPanel):
col.label(text="Unified Settings:") col.label(text="Unified Settings:")
col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size") col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength") col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
class VIEW3D_MT_tools_projectpaint_clone(bpy.types.Menu): class VIEW3D_MT_tools_projectpaint_clone(bpy.types.Menu):
bl_label = "Clone Layer" bl_label = "Clone Layer"
@@ -1311,7 +1292,6 @@ class VIEW3D_PT_tools_particlemode(View3DPanel, bpy.types.Panel):
if ptcache and len(ptcache.point_caches) > 1: if ptcache and len(ptcache.point_caches) > 1:
layout.template_list(ptcache, "point_caches", ptcache.point_caches, "active_index", type='ICONS') layout.template_list(ptcache, "point_caches", ptcache.point_caches, "active_index", type='ICONS')
if not pe.is_editable: if not pe.is_editable:
layout.label(text="Point cache must be baked") layout.label(text="Point cache must be baked")
layout.label(text="to enable editing!") layout.label(text="to enable editing!")

View File

@@ -23,16 +23,17 @@
import bpy import bpy
def api_dump(use_properties=True, use_functions=True): def api_dump(use_properties=True, use_functions=True):
def prop_type(prop): def prop_type(prop):
if prop.type == "pointer": if prop.type == "pointer":
return prop.fixed_type.identifier return prop.fixed_type.identifier
else: else:
return prop.type return prop.type
def func_to_str(struct_id_str, func_id, func): def func_to_str(struct_id_str, func_id, func):
args = [] args = []
for prop in func.args: for prop in func.args:
data_str = "%s %s" % (prop_type(prop), prop.identifier) data_str = "%s %s" % (prop_type(prop), prop.identifier)
@@ -41,8 +42,7 @@ def api_dump(use_properties=True, use_functions=True):
if not prop.is_required: if not prop.is_required:
data_str += "=%s" % prop.default_str data_str += "=%s" % prop.default_str
args.append(data_str) args.append(data_str)
data_str = "%s.%s(%s)" % (struct_id_str, func_id, ", ".join(args)) data_str = "%s.%s(%s)" % (struct_id_str, func_id, ", ".join(args))
if func.return_values: if func.return_values:
return_args = ", ".join([prop_type(arg) for arg in func.return_values]) return_args = ", ".join([prop_type(arg) for arg in func.return_values])
@@ -51,36 +51,34 @@ def api_dump(use_properties=True, use_functions=True):
else: else:
data_str += " --> %s" % return_args data_str += " --> %s" % return_args
return data_str return data_str
def prop_to_str(struct_id_str, prop_id, prop): def prop_to_str(struct_id_str, prop_id, prop):
prop_str = " <-- %s" % prop_type(prop) prop_str = " <-- %s" % prop_type(prop)
if prop.array_length: if prop.array_length:
prop_str += "[%d]" % prop.array_length prop_str += "[%d]" % prop.array_length
data_str = "%s.%s %s" % (struct_id_str, prop_id, prop_str) data_str = "%s.%s %s" % (struct_id_str, prop_id, prop_str)
return data_str return data_str
def struct_full_id(v): def struct_full_id(v):
struct_id_str = v.identifier # "".join(sid for sid in struct_id if struct_id) struct_id_str = v.identifier # "".join(sid for sid in struct_id if struct_id)
for base in v.get_bases(): for base in v.get_bases():
struct_id_str = base.identifier + "|" + struct_id_str struct_id_str = base.identifier + "|" + struct_id_str
return struct_id_str return struct_id_str
def dump_funcs(): def dump_funcs():
data = [] data = []
for struct_id, v in sorted(struct.items()): for struct_id, v in sorted(struct.items()):
struct_id_str = struct_full_id(v) struct_id_str = struct_full_id(v)
funcs = [(func.identifier, func) for func in v.functions] funcs = [(func.identifier, func) for func in v.functions]
for func_id, func in funcs: for func_id, func in funcs:
data.append(func_to_str(struct_id_str, func_id, func)) data.append(func_to_str(struct_id_str, func_id, func))
for prop in v.properties: for prop in v.properties:
if prop.collection_type: if prop.collection_type:
funcs = [(prop.identifier + "." + func.identifier, func) for func in prop.collection_type.functions] funcs = [(prop.identifier + "." + func.identifier, func) for func in prop.collection_type.functions]
@@ -89,7 +87,7 @@ def api_dump(use_properties=True, use_functions=True):
data.sort() data.sort()
data.append("# * functions *") data.append("# * functions *")
return data return data
def dump_props(): def dump_props():
data = [] data = []
for struct_id, v in sorted(struct.items()): for struct_id, v in sorted(struct.items()):
@@ -108,7 +106,7 @@ def api_dump(use_properties=True, use_functions=True):
data.sort() data.sort()
data.insert(0, "# * properties *") data.insert(0, "# * properties *")
return data return data
import rna_info import rna_info
struct = rna_info.BuildRNAInfo()[0] struct = rna_info.BuildRNAInfo()[0]
data = [] data = []
@@ -126,7 +124,7 @@ def api_dump(use_properties=True, use_functions=True):
else: else:
text = bpy.data.texts.new(name="api.py") text = bpy.data.texts.new(name="api.py")
text.from_string(data) text.from_string(data)
print("END") print("END")
if __name__ == "__main__": if __name__ == "__main__":