forked from bartvdbraak/blender
pep8 cleanup
This commit is contained in:
parent
2840e7b764
commit
7f3fe8a2df
@ -57,7 +57,7 @@ for line in infile.readlines():
|
||||
infile.close()
|
||||
|
||||
# Major was changed to float, but minor is still a string
|
||||
# Note: removed returning minor, this messes up with install path code in BLI module
|
||||
# Note: removed returning minor, messes up install path code in BLI module
|
||||
if major:
|
||||
print "%.2f" % major
|
||||
else:
|
||||
|
@ -22,11 +22,12 @@
|
||||
This module has utility functions for renaming
|
||||
rna values in fcurves and drivers.
|
||||
|
||||
The main function to use is: update_data_paths(...)
|
||||
The main function to use is: update_data_paths(...)
|
||||
"""
|
||||
|
||||
IS_TESTING = False
|
||||
|
||||
|
||||
class DataPathBuilder(object):
|
||||
__slots__ = ("data_path", )
|
||||
""" Dummy class used to parse fcurve and driver data paths.
|
||||
@ -37,7 +38,7 @@ class DataPathBuilder(object):
|
||||
def __getattr__(self, attr):
|
||||
str_value = ".%s" % attr
|
||||
return DataPathBuilder(self.data_path + (str_value, ))
|
||||
|
||||
|
||||
def __getitem__(self, key):
|
||||
str_value = '["%s"]' % key
|
||||
return DataPathBuilder(self.data_path + (str_value, ))
|
||||
@ -51,7 +52,7 @@ class DataPathBuilder(object):
|
||||
if base is not Ellipsis:
|
||||
try:
|
||||
# this only works when running with an old blender
|
||||
# where the old path will resolve
|
||||
# where the old path will resolve
|
||||
base = eval("base" + item)
|
||||
except:
|
||||
base_new = Ellipsis
|
||||
@ -61,7 +62,7 @@ class DataPathBuilder(object):
|
||||
try:
|
||||
print("base." + item_new)
|
||||
base_new = eval("base." + item_new)
|
||||
break # found, dont keep looking
|
||||
break # found, dont keep looking
|
||||
except:
|
||||
pass
|
||||
|
||||
@ -77,7 +78,7 @@ import bpy
|
||||
|
||||
def id_iter():
|
||||
type_iter = type(bpy.data.objects)
|
||||
|
||||
|
||||
for attr in dir(bpy.data):
|
||||
data_iter = getattr(bpy.data, attr, None)
|
||||
if type(data_iter) == type_iter:
|
||||
@ -115,13 +116,13 @@ def find_path_new(id_data, data_path, rna_update_dict, rna_update_from_map):
|
||||
# ignore ID props for now
|
||||
if data_path.startswith("["):
|
||||
return data_path
|
||||
|
||||
|
||||
# recursive path fixing, likely will be one in most cases.
|
||||
data_path_builder = eval("DataPathBuilder(tuple())." + data_path)
|
||||
data_resolve = data_path_builder.resolve(id_data, rna_update_from_map)
|
||||
|
||||
path_new = [pair[0] for pair in data_resolve]
|
||||
|
||||
|
||||
# print(data_resolve)
|
||||
data_base = id_data
|
||||
|
||||
@ -138,20 +139,20 @@ def find_path_new(id_data, data_path, rna_update_dict, rna_update_from_map):
|
||||
|
||||
# set this as the base for further properties
|
||||
data_base = data
|
||||
|
||||
data_path_new = "".join(path_new)[1:] # skip the first "."
|
||||
|
||||
data_path_new = "".join(path_new)[1:] # skip the first "."
|
||||
return data_path_new
|
||||
|
||||
|
||||
def update_data_paths(rna_update):
|
||||
''' rna_update triple [(class_name, from, to), ...]
|
||||
'''
|
||||
|
||||
|
||||
# make a faster lookup dict
|
||||
rna_update_dict = {}
|
||||
for ren_class, ren_from, ren_to in rna_update:
|
||||
rna_update_dict.setdefault(ren_class, {})[ren_from] = ren_to
|
||||
|
||||
|
||||
rna_update_from_map = {}
|
||||
for ren_class, ren_from, ren_to in rna_update:
|
||||
rna_update_from_map.setdefault(ren_from, []).append(ren_to)
|
||||
@ -174,7 +175,7 @@ def update_data_paths(rna_update):
|
||||
for tar in var.targets:
|
||||
id_data_other = tar.id
|
||||
data_path = tar.data_path
|
||||
|
||||
|
||||
if id_data_other and data_path:
|
||||
data_path_new = find_path_new(id_data_other, data_path, rna_update_dict, rna_update_from_map)
|
||||
# print(data_path_new)
|
||||
@ -182,9 +183,7 @@ def update_data_paths(rna_update):
|
||||
if not IS_TESTING:
|
||||
tar.data_path = data_path_new
|
||||
print("driver (%s): %s -> %s" % (id_data_other.name, data_path, data_path_new))
|
||||
|
||||
|
||||
|
||||
|
||||
for action in anim_data_actions(anim_data):
|
||||
for fcu in action.fcurves:
|
||||
data_path = fcu.data_path
|
||||
|
@ -48,7 +48,7 @@ def _main():
|
||||
pydoc.getpager = lambda: pydoc.plainpager
|
||||
pydoc.Helper.getline = lambda self, prompt: None
|
||||
pydoc.TextDoc.use_bold = lambda self, text: text
|
||||
|
||||
|
||||
# Possibly temp. addons path
|
||||
from os.path import join, dirname, normpath
|
||||
_sys.path.append(normpath(join(dirname(__file__), "..", "..", "addons", "modules")))
|
||||
|
@ -137,13 +137,12 @@ class bpy_ops_submodule_op(object):
|
||||
@staticmethod
|
||||
def _scene_update(context):
|
||||
scene = context.scene
|
||||
if scene: # None in backgroud mode
|
||||
if scene: # None in backgroud mode
|
||||
scene.update()
|
||||
else:
|
||||
import bpy
|
||||
for scene in bpy.data.scenes:
|
||||
scene.update()
|
||||
|
||||
|
||||
__doc__ = property(_get_doc)
|
||||
|
||||
@ -196,7 +195,8 @@ class bpy_ops_submodule_op(object):
|
||||
as_string = op_as_string(idname)
|
||||
op_class = getattr(bpy.types, idname)
|
||||
descr = op_class.bl_rna.description
|
||||
# XXX, workaround for not registering every __doc__ to save time on load.
|
||||
# XXX, workaround for not registering
|
||||
# every __doc__ to save time on load.
|
||||
if not descr:
|
||||
descr = op_class.__doc__
|
||||
if not descr:
|
||||
|
@ -204,7 +204,7 @@ def module_names(path, recursive=False):
|
||||
|
||||
for filename in sorted(_os.listdir(path)):
|
||||
if filename == "modules":
|
||||
pass # XXX, hard coded exception.
|
||||
pass # XXX, hard coded exception.
|
||||
elif filename.endswith(".py") and filename != "__init__.py":
|
||||
fullpath = join(path, filename)
|
||||
modules.append((filename[0:-3], fullpath))
|
||||
|
@ -31,6 +31,7 @@ import bpy as _bpy
|
||||
import os as _os
|
||||
import sys as _sys
|
||||
|
||||
|
||||
def _test_import(module_name, loaded_modules):
|
||||
import traceback
|
||||
import time
|
||||
@ -203,13 +204,11 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
|
||||
# deal with addons seperately
|
||||
addon_reset_all(reload_scripts)
|
||||
|
||||
|
||||
# run the active integration preset
|
||||
filepath = preset_find(_bpy.context.user_preferences.inputs.active_keyconfig, "keyconfig")
|
||||
if filepath:
|
||||
keyconfig_set(filepath)
|
||||
|
||||
|
||||
if reload_scripts:
|
||||
import gc
|
||||
print("gc.collect() -> %d" % gc.collect())
|
||||
@ -368,7 +367,6 @@ def addon_enable(module_name, default_set=True):
|
||||
import bpy_types as _bpy_types
|
||||
import imp
|
||||
|
||||
|
||||
_bpy_types._register_immediate = False
|
||||
|
||||
def handle_error():
|
||||
@ -376,7 +374,6 @@ def addon_enable(module_name, default_set=True):
|
||||
traceback.print_exc()
|
||||
_bpy_types._register_immediate = True
|
||||
|
||||
|
||||
# reload if the mtime changes
|
||||
mod = sys.modules.get(module_name)
|
||||
if mod:
|
||||
@ -428,7 +425,7 @@ def addon_enable(module_name, default_set=True):
|
||||
if not ext:
|
||||
ext = _bpy.context.user_preferences.addons.new()
|
||||
ext.module = module_name
|
||||
|
||||
|
||||
_bpy_types._register_immediate = True
|
||||
|
||||
mod.__addon_enabled__ = True
|
||||
@ -471,7 +468,7 @@ def addon_disable(module_name, default_set=True):
|
||||
addon = addons.get(module_name)
|
||||
if addon:
|
||||
addons.remove(addon)
|
||||
|
||||
|
||||
print("\tbpy.utils.addon_disable", module_name)
|
||||
|
||||
|
||||
@ -483,10 +480,10 @@ def addon_reset_all(reload_scripts=False):
|
||||
|
||||
# RELEASE SCRIPTS: official scripts distributed in Blender releases
|
||||
paths = script_paths("addons")
|
||||
|
||||
|
||||
# CONTRIB SCRIPTS: good for testing but not official scripts yet
|
||||
paths += script_paths("addons_contrib")
|
||||
|
||||
|
||||
# EXTERN SCRIPTS: external projects scripts
|
||||
paths += script_paths("addons_extern")
|
||||
|
||||
@ -513,9 +510,9 @@ def addon_reset_all(reload_scripts=False):
|
||||
def preset_find(name, preset_path, display_name=False):
|
||||
if not name:
|
||||
return None
|
||||
|
||||
|
||||
for directory in preset_paths(preset_path):
|
||||
|
||||
|
||||
if display_name:
|
||||
filename = ""
|
||||
for fn in _os.listdir(directory):
|
||||
@ -558,7 +555,7 @@ def keyconfig_set(filepath):
|
||||
keyconfigs.remove(kc_dupe)
|
||||
else:
|
||||
break
|
||||
|
||||
|
||||
kc_new.name = name
|
||||
keyconfigs.active = kc_new
|
||||
|
||||
@ -595,4 +592,3 @@ def user_resource(type, path="", create=False):
|
||||
target_path = ""
|
||||
|
||||
return target_path
|
||||
|
||||
|
@ -638,7 +638,7 @@ class OrderedMeta(RNAMeta):
|
||||
# with doc generation 'self.properties.bl_rna.properties' can fail
|
||||
class Operator(StructRNA, metaclass=OrderedMeta):
|
||||
__slots__ = ()
|
||||
|
||||
|
||||
def __getattribute__(self, attr):
|
||||
properties = StructRNA.path_resolve(self, "properties")
|
||||
bl_rna = getattr(properties, "bl_rna", None)
|
||||
@ -745,7 +745,7 @@ class Menu(StructRNA, _GenericUI, metaclass=RNAMeta):
|
||||
import bpy.utils
|
||||
|
||||
layout = self.layout
|
||||
|
||||
|
||||
if not searchpaths:
|
||||
layout.label("* Missing Paths *")
|
||||
|
||||
|
@ -60,7 +60,7 @@ def rna_idprop_ui_prop_clear(item, prop):
|
||||
|
||||
def rna_idprop_context_value(context, context_member, property_type):
|
||||
space = context.space_data
|
||||
|
||||
|
||||
if space is None or isinstance(space, bpy.types.SpaceProperties):
|
||||
pin_id = space.pin_id
|
||||
else:
|
||||
|
@ -25,83 +25,87 @@ import bgl
|
||||
|
||||
import sys
|
||||
|
||||
def cutPoint(text, length):
|
||||
"Returns position of the last space found before 'length' chars"
|
||||
l = length
|
||||
c = text[l]
|
||||
while c != ' ':
|
||||
l -= 1
|
||||
if l == 0: return length # no space found
|
||||
c = text[l]
|
||||
return l
|
||||
|
||||
def textWrap(text, length = 70):
|
||||
lines = []
|
||||
while len(text) > 70:
|
||||
cpt = cutPoint(text, length)
|
||||
line, text = text[:cpt], text[cpt + 1:]
|
||||
lines.append(line)
|
||||
lines.append(text)
|
||||
return lines
|
||||
def cutPoint(text, length):
|
||||
"Returns position of the last space found before 'length' chars"
|
||||
l = length
|
||||
c = text[l]
|
||||
while c != ' ':
|
||||
l -= 1
|
||||
if l == 0:
|
||||
return length # no space found
|
||||
c = text[l]
|
||||
return l
|
||||
|
||||
|
||||
def textWrap(text, length=70):
|
||||
lines = []
|
||||
while len(text) > 70:
|
||||
cpt = cutPoint(text, length)
|
||||
line, text = text[:cpt], text[cpt + 1:]
|
||||
lines.append(line)
|
||||
lines.append(text)
|
||||
return lines
|
||||
|
||||
|
||||
def write_sysinfo(op):
|
||||
output_filename = "system-info.txt"
|
||||
warnings = 0
|
||||
notices = 0
|
||||
output_filename = "system-info.txt"
|
||||
warnings = 0
|
||||
notices = 0
|
||||
|
||||
if output_filename in bpy.data.texts.keys():
|
||||
output = bpy.data.texts[output_filename]
|
||||
output.clear()
|
||||
else:
|
||||
output = bpy.data.texts.new(name=output_filename)
|
||||
if output_filename in bpy.data.texts.keys():
|
||||
output = bpy.data.texts[output_filename]
|
||||
output.clear()
|
||||
else:
|
||||
output = bpy.data.texts.new(name=output_filename)
|
||||
|
||||
header = '= Blender {} System Information =\n'.format(bpy.app.version_string)
|
||||
lilies = '{}\n\n'.format(len(header)*'=')
|
||||
firstlilies = '{}\n'.format(len(header)*'=')
|
||||
output.write(firstlilies)
|
||||
output.write(header)
|
||||
output.write(lilies)
|
||||
header = '= Blender {} System Information =\n'.format(bpy.app.version_string)
|
||||
lilies = '{}\n\n'.format(len(header) * '=')
|
||||
firstlilies = '{}\n'.format(len(header) * '=')
|
||||
output.write(firstlilies)
|
||||
output.write(header)
|
||||
output.write(lilies)
|
||||
|
||||
# build info
|
||||
output.write('\nBlender:\n')
|
||||
output.write(lilies)
|
||||
output.write('version {}, revision {}. {}\n'.format(bpy.app.version_string, bpy.app.build_revision, bpy.app.build_type))
|
||||
output.write('build date: {}, {}\n'.format(bpy.app.build_date, bpy.app.build_time))
|
||||
output.write('platform: {}\n'.format(bpy.app.build_platform))
|
||||
output.write('binary path: {}\n'.format(bpy.app.binary_path))
|
||||
output.write('build cflags: {}\n'.format(bpy.app.build_cflags))
|
||||
output.write('build cxxflags: {}\n'.format(bpy.app.build_cxxflags))
|
||||
output.write('build linkflags: {}\n'.format(bpy.app.build_linkflags))
|
||||
output.write('build system: {}\n'.format(bpy.app.build_system))
|
||||
# build info
|
||||
output.write('\nBlender:\n')
|
||||
output.write(lilies)
|
||||
output.write('version {}, revision {}. {}\n'.format(bpy.app.version_string, bpy.app.build_revision, bpy.app.build_type))
|
||||
output.write('build date: {}, {}\n'.format(bpy.app.build_date, bpy.app.build_time))
|
||||
output.write('platform: {}\n'.format(bpy.app.build_platform))
|
||||
output.write('binary path: {}\n'.format(bpy.app.binary_path))
|
||||
output.write('build cflags: {}\n'.format(bpy.app.build_cflags))
|
||||
output.write('build cxxflags: {}\n'.format(bpy.app.build_cxxflags))
|
||||
output.write('build linkflags: {}\n'.format(bpy.app.build_linkflags))
|
||||
output.write('build system: {}\n'.format(bpy.app.build_system))
|
||||
|
||||
# python info
|
||||
output.write('\nPython:\n')
|
||||
output.write(lilies)
|
||||
output.write('version: {}\n'.format(sys.version))
|
||||
output.write('paths:\n')
|
||||
for p in sys.path:
|
||||
output.write('\t{}\n'.format(p))
|
||||
# python info
|
||||
output.write('\nPython:\n')
|
||||
output.write(lilies)
|
||||
output.write('version: {}\n'.format(sys.version))
|
||||
output.write('paths:\n')
|
||||
for p in sys.path:
|
||||
output.write('\t{}\n'.format(p))
|
||||
|
||||
output.write('\nDirectories:\n')
|
||||
output.write(lilies)
|
||||
output.write('scripts: {}\n'.format(bpy.utils.script_paths()))
|
||||
output.write('user scripts: {}\n'.format(bpy.utils.user_script_path()))
|
||||
output.write('datafiles: {}\n'.format(bpy.utils.user_resource('DATAFILES')))
|
||||
output.write('config: {}\n'.format(bpy.utils.user_resource('CONFIG')))
|
||||
output.write('scripts : {}\n'.format(bpy.utils.user_resource('SCRIPTS')))
|
||||
output.write('autosave: {}\n'.format(bpy.utils.user_resource('AUTOSAVE')))
|
||||
output.write('tempdir: {}\n'.format(bpy.app.tempdir))
|
||||
output.write('\nDirectories:\n')
|
||||
output.write(lilies)
|
||||
output.write('scripts: {}\n'.format(bpy.utils.script_paths()))
|
||||
output.write('user scripts: {}\n'.format(bpy.utils.user_script_path()))
|
||||
output.write('datafiles: {}\n'.format(bpy.utils.user_resource('DATAFILES')))
|
||||
output.write('config: {}\n'.format(bpy.utils.user_resource('CONFIG')))
|
||||
output.write('scripts : {}\n'.format(bpy.utils.user_resource('SCRIPTS')))
|
||||
output.write('autosave: {}\n'.format(bpy.utils.user_resource('AUTOSAVE')))
|
||||
output.write('tempdir: {}\n'.format(bpy.app.tempdir))
|
||||
|
||||
output.write('\nOpenGL\n')
|
||||
output.write(lilies)
|
||||
output.write('renderer:\t{}\n'.format(bgl.glGetString(bgl.GL_RENDERER)))
|
||||
output.write('vendor:\t\t{}\n'.format(bgl.glGetString(bgl.GL_VENDOR)))
|
||||
output.write('version:\t{}\n'.format(bgl.glGetString(bgl.GL_VERSION)))
|
||||
output.write('extensions:\n')
|
||||
output.write('\nOpenGL\n')
|
||||
output.write(lilies)
|
||||
output.write('renderer:\t{}\n'.format(bgl.glGetString(bgl.GL_RENDERER)))
|
||||
output.write('vendor:\t\t{}\n'.format(bgl.glGetString(bgl.GL_VENDOR)))
|
||||
output.write('version:\t{}\n'.format(bgl.glGetString(bgl.GL_VERSION)))
|
||||
output.write('extensions:\n')
|
||||
|
||||
glext = bgl.glGetString(bgl.GL_EXTENSIONS)
|
||||
glext = textWrap(glext, 70)
|
||||
for l in glext:
|
||||
output.write('\t\t{}\n'.format(l))
|
||||
|
||||
op.report({'INFO'}, "System information generated in 'system-info.txt'")
|
||||
glext = bgl.glGetString(bgl.GL_EXTENSIONS)
|
||||
glext = textWrap(glext, 70)
|
||||
for l in glext:
|
||||
output.write('\t\t{}\n'.format(l))
|
||||
|
||||
op.report({'INFO'}, "System information generated in 'system-info.txt'")
|
||||
|
@ -699,5 +699,6 @@ class UpdateAnimData(bpy.types.Operator):
|
||||
if __name__ == "__main__":
|
||||
bpy.ops.anim.update_data_paths()
|
||||
|
||||
|
||||
def register():
|
||||
pass
|
||||
|
@ -82,9 +82,9 @@ def get_console(console_id):
|
||||
namespace["__builtins__"] = sys.modules["builtins"]
|
||||
namespace["bpy"] = bpy
|
||||
namespace["C"] = bpy.context
|
||||
|
||||
namespace.update(__import__("mathutils").__dict__) # from mathutils import *
|
||||
namespace.update(__import__("math").__dict__) # from math import *
|
||||
|
||||
namespace.update(__import__("mathutils").__dict__) # from mathutils import *
|
||||
namespace.update(__import__("math").__dict__) # from math import *
|
||||
|
||||
console = InteractiveConsole(locals=namespace, filename="<blender_console>")
|
||||
|
||||
@ -186,7 +186,7 @@ def execute(context):
|
||||
|
||||
# restore the stdin
|
||||
sys.stdin = stdin_backup
|
||||
|
||||
|
||||
# execute any hooks
|
||||
for func, args in execute.hooks:
|
||||
func(*args)
|
||||
|
@ -34,7 +34,7 @@ class BvhImporter(bpy.types.Operator, ImportHelper):
|
||||
'''Load a OBJ Motion Capture File'''
|
||||
bl_idname = "import_anim.bvh"
|
||||
bl_label = "Import BVH"
|
||||
|
||||
|
||||
filename_ext = ".bvh"
|
||||
filter_glob = StringProperty(default="*.bvh", options={'HIDDEN'})
|
||||
|
||||
|
@ -30,19 +30,19 @@ from mathutils import Vector, Euler, Matrix
|
||||
|
||||
class bvh_node_class(object):
|
||||
__slots__ = (
|
||||
'name',# bvh joint name
|
||||
'parent',# bvh_node_class type or None for no parent
|
||||
'children',# a list of children of this type.
|
||||
'rest_head_world',# worldspace rest location for the head of this node
|
||||
'rest_head_local',# localspace rest location for the head of this node
|
||||
'rest_tail_world',# # worldspace rest location for the tail of this node
|
||||
'rest_tail_local',# # worldspace rest location for the tail of this node
|
||||
'channels',# list of 6 ints, -1 for an unused channel, otherwise an index for the BVH motion data lines, lock triple then rot triple
|
||||
'rot_order',# a triple of indicies as to the order rotation is applied. [0,1,2] is x/y/z - [None, None, None] if no rotation.
|
||||
'anim_data',# a list one tuple's one for each frame. (locx, locy, locz, rotx, roty, rotz)
|
||||
'has_loc',# Conveinience function, bool, same as (channels[0]!=-1 or channels[1]!=-1 channels[2]!=-1)
|
||||
'has_rot',# Conveinience function, bool, same as (channels[3]!=-1 or channels[4]!=-1 channels[5]!=-1)
|
||||
'temp')# use this for whatever you want
|
||||
'name', # bvh joint name
|
||||
'parent', # bvh_node_class type or None for no parent
|
||||
'children', # a list of children of this type.
|
||||
'rest_head_world', # worldspace rest location for the head of this node
|
||||
'rest_head_local', # localspace rest location for the head of this node
|
||||
'rest_tail_world', # worldspace rest location for the tail of this node
|
||||
'rest_tail_local', # worldspace rest location for the tail of this node
|
||||
'channels', # list of 6 ints, -1 for an unused channel, otherwise an index for the BVH motion data lines, lock triple then rot triple
|
||||
'rot_order', # a triple of indicies as to the order rotation is applied. [0,1,2] is x/y/z - [None, None, None] if no rotation.
|
||||
'anim_data', # a list one tuple's one for each frame. (locx, locy, locz, rotx, roty, rotz)
|
||||
'has_loc', # Conveinience function, bool, same as (channels[0]!=-1 or channels[1]!=-1 channels[2]!=-1)
|
||||
'has_rot', # Conveinience function, bool, same as (channels[3]!=-1 or channels[4]!=-1 channels[5]!=-1)
|
||||
'temp') # use this for whatever you want
|
||||
|
||||
def __init__(self, name, rest_head_world, rest_head_local, parent, channels, rot_order):
|
||||
self.name = name
|
||||
@ -58,7 +58,6 @@ class bvh_node_class(object):
|
||||
self.has_loc = channels[0] != -1 or channels[1] != -1 or channels[2] != -1
|
||||
self.has_rot = channels[3] != -1 or channels[4] != -1 or channels[5] != -1
|
||||
|
||||
|
||||
self.children = []
|
||||
|
||||
# list of 6 length tuples: (lx,ly,lz, rx,ry,rz)
|
||||
@ -105,9 +104,7 @@ def read_bvh(context, file_path, ROT_MODE='XYZ', GLOBAL_SCALE=1.0):
|
||||
# Split by whitespace.
|
||||
file_lines = [ll for ll in [l.split() for l in file_lines] if ll]
|
||||
|
||||
|
||||
# Create Hirachy as empties
|
||||
|
||||
if file_lines[0][0].lower() == 'hierarchy':
|
||||
#print 'Importing the BVH Hierarchy for:', file_path
|
||||
pass
|
||||
@ -119,9 +116,8 @@ def read_bvh(context, file_path, ROT_MODE='XYZ', GLOBAL_SCALE=1.0):
|
||||
|
||||
channelIndex = -1
|
||||
|
||||
|
||||
lineIdx = 0 # An index for the file.
|
||||
while lineIdx < len(file_lines) -1:
|
||||
lineIdx = 0 # An index for the file.
|
||||
while lineIdx < len(file_lines) - 1:
|
||||
#...
|
||||
if file_lines[lineIdx][0].lower() == 'root' or file_lines[lineIdx][0].lower() == 'joint':
|
||||
|
||||
@ -137,9 +133,9 @@ def read_bvh(context, file_path, ROT_MODE='XYZ', GLOBAL_SCALE=1.0):
|
||||
|
||||
#print '%snode: %s, parent: %s' % (len(bvh_nodes_serial) * ' ', name, bvh_nodes_serial[-1])
|
||||
|
||||
lineIdx += 2 # Incriment to the next line (Offset)
|
||||
lineIdx += 2 # Incriment to the next line (Offset)
|
||||
rest_head_local = Vector((float(file_lines[lineIdx][1]), float(file_lines[lineIdx][2]), float(file_lines[lineIdx][3]))) * GLOBAL_SCALE
|
||||
lineIdx += 1 # Incriment to the next line (Channels)
|
||||
lineIdx += 1 # Incriment to the next line (Channels)
|
||||
|
||||
# newChannel[Xposition, Yposition, Zposition, Xrotation, Yrotation, Zrotation]
|
||||
# newChannel references indecies to the motiondata,
|
||||
@ -150,7 +146,7 @@ def read_bvh(context, file_path, ROT_MODE='XYZ', GLOBAL_SCALE=1.0):
|
||||
rot_count = 0
|
||||
for channel in file_lines[lineIdx][2:]:
|
||||
channel = channel.lower()
|
||||
channelIndex += 1 # So the index points to the right channel
|
||||
channelIndex += 1 # So the index points to the right channel
|
||||
if channel == 'xposition':
|
||||
my_channel[0] = channelIndex
|
||||
elif channel == 'yposition':
|
||||
@ -173,8 +169,7 @@ def read_bvh(context, file_path, ROT_MODE='XYZ', GLOBAL_SCALE=1.0):
|
||||
|
||||
channels = file_lines[lineIdx][2:]
|
||||
|
||||
my_parent = bvh_nodes_serial[-1] # account for none
|
||||
|
||||
my_parent = bvh_nodes_serial[-1] # account for none
|
||||
|
||||
# Apply the parents offset accumletivly
|
||||
if my_parent is None:
|
||||
@ -188,24 +183,23 @@ def read_bvh(context, file_path, ROT_MODE='XYZ', GLOBAL_SCALE=1.0):
|
||||
bvh_nodes_serial.append(bvh_node)
|
||||
|
||||
# Account for an end node
|
||||
if file_lines[lineIdx][0].lower() == 'end' and file_lines[lineIdx][1].lower() == 'site': # There is somtimes a name after 'End Site' but we will ignore it.
|
||||
lineIdx += 2 # Incriment to the next line (Offset)
|
||||
if file_lines[lineIdx][0].lower() == 'end' and file_lines[lineIdx][1].lower() == 'site': # There is somtimes a name after 'End Site' but we will ignore it.
|
||||
lineIdx += 2 # Incriment to the next line (Offset)
|
||||
rest_tail = Vector((float(file_lines[lineIdx][1]), float(file_lines[lineIdx][2]), float(file_lines[lineIdx][3]))) * GLOBAL_SCALE
|
||||
|
||||
bvh_nodes_serial[-1].rest_tail_world = bvh_nodes_serial[-1].rest_head_world + rest_tail
|
||||
bvh_nodes_serial[-1].rest_tail_local = bvh_nodes_serial[-1].rest_head_local + rest_tail
|
||||
|
||||
|
||||
# Just so we can remove the Parents in a uniform way- End end never has kids
|
||||
# so this is a placeholder
|
||||
bvh_nodes_serial.append(None)
|
||||
|
||||
if len(file_lines[lineIdx]) == 1 and file_lines[lineIdx][0] == '}': # == ['}']
|
||||
bvh_nodes_serial.pop() # Remove the last item
|
||||
if len(file_lines[lineIdx]) == 1 and file_lines[lineIdx][0] == '}': # == ['}']
|
||||
bvh_nodes_serial.pop() # Remove the last item
|
||||
|
||||
if len(file_lines[lineIdx]) == 1 and file_lines[lineIdx][0].lower() == 'motion':
|
||||
#print '\nImporting motion data'
|
||||
lineIdx += 3 # Set the cursor to the first frame
|
||||
lineIdx += 3 # Set the cursor to the first frame
|
||||
break
|
||||
|
||||
lineIdx += 1
|
||||
@ -307,7 +301,7 @@ def bvh_node_dict2objects(context, bvh_nodes, IMPORT_START_FRAME=1, IMPORT_LOOP=
|
||||
|
||||
# Parent the objects
|
||||
for bvh_node in bvh_nodes.values():
|
||||
bvh_node.temp.makeParent([bvh_node_child.temp for bvh_node_child in bvh_node.children], 1, 0) # ojbs, noninverse, 1 = not fast.
|
||||
bvh_node.temp.makeParent([bvh_node_child.temp for bvh_node_child in bvh_node.children], 1, 0) # ojbs, noninverse, 1 = not fast.
|
||||
|
||||
# Offset
|
||||
for bvh_node in bvh_nodes.values():
|
||||
@ -318,7 +312,7 @@ def bvh_node_dict2objects(context, bvh_nodes, IMPORT_START_FRAME=1, IMPORT_LOOP=
|
||||
for name, bvh_node in bvh_nodes.items():
|
||||
if not bvh_node.children:
|
||||
ob_end = add_ob(name + '_end')
|
||||
bvh_node.temp.makeParent([ob_end], 1, 0) # ojbs, noninverse, 1 = not fast.
|
||||
bvh_node.temp.makeParent([ob_end], 1, 0) # ojbs, noninverse, 1 = not fast.
|
||||
ob_end.loc = bvh_node.rest_tail_local
|
||||
|
||||
|
||||
@ -334,7 +328,7 @@ def bvh_node_dict2objects(context, bvh_nodes, IMPORT_START_FRAME=1, IMPORT_LOOP=
|
||||
|
||||
bvh_node.temp.rot = rx, ry, rz
|
||||
|
||||
bvh_node.temp.insertIpoKey(Blender.Object.IpoKeyTypes.LOCROT) # XXX invalid
|
||||
bvh_node.temp.insertIpoKey(Blender.Object.IpoKeyTypes.LOCROT) # XXX invalid
|
||||
|
||||
scn.update(1)
|
||||
return objects
|
||||
@ -396,7 +390,7 @@ def bvh_node_dict2armature(context, bvh_nodes, ROT_MODE='XYZ', IMPORT_START_FRAM
|
||||
if (bone.head - bone.tail).length < 0.001:
|
||||
if bvh_node.parent:
|
||||
ofs = bvh_node.parent.rest_head_local - bvh_node.parent.rest_tail_local
|
||||
if ofs.length: # is our parent zero length also?? unlikely
|
||||
if ofs.length: # is our parent zero length also?? unlikely
|
||||
bone.tail = bone.tail + ofs
|
||||
else:
|
||||
bone.tail.y = bone.tail.y + average_bone_length
|
||||
@ -446,7 +440,7 @@ def bvh_node_dict2armature(context, bvh_nodes, ROT_MODE='XYZ', IMPORT_START_FRAM
|
||||
(2, 1, 0): 'ZYX'}
|
||||
|
||||
for bvh_node in bvh_nodes.values():
|
||||
bone_name = bvh_node.temp # may not be the same name as the bvh_node, could have been shortened.
|
||||
bone_name = bvh_node.temp # may not be the same name as the bvh_node, could have been shortened.
|
||||
pose_bone = pose_bones[bone_name]
|
||||
pose_bone.rotation_mode = eul_order_lookup[tuple(bvh_node.rot_order)]
|
||||
|
||||
@ -459,8 +453,8 @@ def bvh_node_dict2armature(context, bvh_nodes, ROT_MODE='XYZ', IMPORT_START_FRAM
|
||||
|
||||
context.scene.update()
|
||||
|
||||
bpy.ops.pose.select_all() # set
|
||||
bpy.ops.anim.keyframe_insert_menu(type=-4) # XXX - -4 ???
|
||||
bpy.ops.pose.select_all() # set
|
||||
bpy.ops.anim.keyframe_insert_menu(type=-4) # XXX - -4 ???
|
||||
|
||||
|
||||
#XXX action = Blender.Armature.NLA.NewAction("Action")
|
||||
@ -475,7 +469,7 @@ def bvh_node_dict2armature(context, bvh_nodes, ROT_MODE='XYZ', IMPORT_START_FRAM
|
||||
# Replace the bvh_node.temp (currently an editbone)
|
||||
# With a tuple (pose_bone, armature_bone, bone_rest_matrix, bone_rest_matrix_inv)
|
||||
for bvh_node in bvh_nodes.values():
|
||||
bone_name = bvh_node.temp # may not be the same name as the bvh_node, could have been shortened.
|
||||
bone_name = bvh_node.temp # may not be the same name as the bvh_node, could have been shortened.
|
||||
pose_bone = pose_bones[bone_name]
|
||||
rest_bone = arm_data.bones[bone_name]
|
||||
bone_rest_matrix = rest_bone.matrix_local.rotation_part()
|
||||
@ -498,7 +492,7 @@ def bvh_node_dict2armature(context, bvh_nodes, ROT_MODE='XYZ', IMPORT_START_FRAM
|
||||
prev_euler = [Euler() for i in range(len(bvh_nodes))]
|
||||
|
||||
# Animate the data, the last used bvh_node will do since they all have the same number of frames
|
||||
for frame_current in range(len(bvh_node.anim_data)-1): # skip the first frame (rest frame)
|
||||
for frame_current in range(len(bvh_node.anim_data) - 1): # skip the first frame (rest frame)
|
||||
# print frame_current
|
||||
|
||||
# if frame_current==40: # debugging
|
||||
@ -537,7 +531,7 @@ def bvh_node_dict2armature(context, bvh_nodes, ROT_MODE='XYZ', IMPORT_START_FRAM
|
||||
|
||||
for cu in action.fcurves:
|
||||
if IMPORT_LOOP:
|
||||
pass # 2.5 doenst have cyclic now?
|
||||
pass # 2.5 doenst have cyclic now?
|
||||
|
||||
for bez in cu.keyframe_points:
|
||||
bez.interpolation = 'LINEAR'
|
||||
@ -564,5 +558,5 @@ def load(operator, context, filepath="", rotate_mode='NATIVE', scale=1.0, use_cy
|
||||
IMPORT_LOOP=use_cyclic)
|
||||
|
||||
print('Done in %.4f\n' % (time.time() - t1))
|
||||
|
||||
|
||||
return {'FINISHED'}
|
||||
|
@ -32,14 +32,13 @@ import os
|
||||
|
||||
|
||||
def save(operator, context, filepath="", use_modifiers=True, use_normals=True, use_uv_coords=True, use_colors=True):
|
||||
|
||||
|
||||
def rvec3d(v):
|
||||
return round(v[0], 6), round(v[1], 6), round(v[2], 6)
|
||||
|
||||
|
||||
def rvec2d(v):
|
||||
return round(v[0], 6), round(v[1], 6)
|
||||
|
||||
|
||||
scene = context.scene
|
||||
obj = context.object
|
||||
|
||||
@ -94,15 +93,14 @@ def save(operator, context, filepath="", use_modifiers=True, use_normals=True, u
|
||||
# incase
|
||||
color = uvcoord = uvcoord_key = normal = normal_key = None
|
||||
|
||||
mesh_verts = mesh.vertices # save a lookup
|
||||
ply_verts = [] # list of dictionaries
|
||||
mesh_verts = mesh.vertices # save a lookup
|
||||
ply_verts = [] # list of dictionaries
|
||||
# vdict = {} # (index, normal, uv) -> new index
|
||||
vdict = [{} for i in range(len(mesh_verts))]
|
||||
ply_faces = [[] for f in range(len(mesh.faces))]
|
||||
vert_count = 0
|
||||
for i, f in enumerate(mesh.faces):
|
||||
|
||||
|
||||
smooth = f.use_smooth
|
||||
if not smooth:
|
||||
normal = tuple(f.normal)
|
||||
@ -110,7 +108,7 @@ def save(operator, context, filepath="", use_modifiers=True, use_normals=True, u
|
||||
|
||||
if faceUV:
|
||||
uv = active_uv_layer[i]
|
||||
uv = uv.uv1, uv.uv2, uv.uv3, uv.uv4 # XXX - crufty :/
|
||||
uv = uv.uv1, uv.uv2, uv.uv3, uv.uv4 # XXX - crufty :/
|
||||
if vertexColors:
|
||||
col = active_col_layer[i]
|
||||
col = col.color1[:], col.color2[:], col.color3[:], col.color4[:]
|
||||
@ -136,13 +134,12 @@ def save(operator, context, filepath="", use_modifiers=True, use_normals=True, u
|
||||
color = col[j]
|
||||
color = int(color[0] * 255.0), int(color[1] * 255.0), int(color[2] * 255.0)
|
||||
|
||||
|
||||
key = normal_key, uvcoord_key, color
|
||||
|
||||
vdict_local = vdict[vidx]
|
||||
pf_vidx = vdict_local.get(key) # Will be None initially
|
||||
pf_vidx = vdict_local.get(key) # Will be None initially
|
||||
|
||||
if pf_vidx is None: # same as vdict_local.has_key(key)
|
||||
if pf_vidx is None: # same as vdict_local.has_key(key)
|
||||
pf_vidx = vdict_local[key] = vert_count
|
||||
ply_verts.append((vidx, normal, uvcoord, color))
|
||||
vert_count += 1
|
||||
@ -176,13 +173,13 @@ def save(operator, context, filepath="", use_modifiers=True, use_normals=True, u
|
||||
file.write('end_header\n')
|
||||
|
||||
for i, v in enumerate(ply_verts):
|
||||
file.write('%.6f %.6f %.6f ' % mesh_verts[v[0]].co[:]) # co
|
||||
file.write('%.6f %.6f %.6f ' % mesh_verts[v[0]].co[:]) # co
|
||||
if use_normals:
|
||||
file.write('%.6f %.6f %.6f ' % v[1]) # no
|
||||
file.write('%.6f %.6f %.6f ' % v[1]) # no
|
||||
if use_uv_coords:
|
||||
file.write('%.6f %.6f ' % v[2]) # uv
|
||||
file.write('%.6f %.6f ' % v[2]) # uv
|
||||
if use_colors:
|
||||
file.write('%u %u %u' % v[3]) # col
|
||||
file.write('%u %u %u' % v[3]) # col
|
||||
file.write('\n')
|
||||
|
||||
for pf in ply_faces:
|
||||
@ -202,5 +199,5 @@ def save(operator, context, filepath="", use_modifiers=True, use_normals=True, u
|
||||
if is_editmode:
|
||||
Blender.Window.EditMode(1, '', 0)
|
||||
"""
|
||||
|
||||
|
||||
return {'FINISHED'}
|
||||
|
@ -66,9 +66,11 @@ class Export3DS(bpy.types.Operator, ExportHelper):
|
||||
def menu_func_export(self, context):
|
||||
self.layout.operator(Export3DS.bl_idname, text="3D Studio (.3ds)")
|
||||
|
||||
|
||||
def menu_func_import(self, context):
|
||||
self.layout.operator(Import3DS.bl_idname, text="3D Studio (.3ds)")
|
||||
|
||||
|
||||
def register():
|
||||
bpy.types.INFO_MT_file_import.append(menu_func_import)
|
||||
bpy.types.INFO_MT_file_export.append(menu_func_export)
|
||||
@ -84,4 +86,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -40,19 +40,18 @@ class ImportOBJ(bpy.types.Operator, ImportHelper):
|
||||
filename_ext = ".obj"
|
||||
filter_glob = StringProperty(default="*.obj;*.mtl", options={'HIDDEN'})
|
||||
|
||||
CREATE_SMOOTH_GROUPS = BoolProperty(name="Smooth Groups", description="Surround smooth groups by sharp edges", default= True)
|
||||
CREATE_FGONS = BoolProperty(name="NGons as FGons", description="Import faces with more then 4 verts as fgons", default= True)
|
||||
CREATE_EDGES = BoolProperty(name="Lines as Edges", description="Import lines and faces with 2 verts as edge", default= True)
|
||||
SPLIT_OBJECTS = BoolProperty(name="Object", description="Import OBJ Objects into Blender Objects", default= True)
|
||||
SPLIT_GROUPS = BoolProperty(name="Group", description="Import OBJ Groups into Blender Objects", default= True)
|
||||
CREATE_SMOOTH_GROUPS = BoolProperty(name="Smooth Groups", description="Surround smooth groups by sharp edges", default=True)
|
||||
CREATE_FGONS = BoolProperty(name="NGons as FGons", description="Import faces with more then 4 verts as fgons", default=True)
|
||||
CREATE_EDGES = BoolProperty(name="Lines as Edges", description="Import lines and faces with 2 verts as edge", default=True)
|
||||
SPLIT_OBJECTS = BoolProperty(name="Object", description="Import OBJ Objects into Blender Objects", default=True)
|
||||
SPLIT_GROUPS = BoolProperty(name="Group", description="Import OBJ Groups into Blender Objects", default=True)
|
||||
# old comment: only used for user feedback
|
||||
# disabled this option because in old code a handler for it disabled SPLIT* params, it's not passed to load_obj
|
||||
# KEEP_VERT_ORDER = BoolProperty(name="Keep Vert Order", description="Keep vert and face order, disables split options, enable for morph targets", default= True)
|
||||
ROTATE_X90 = BoolProperty(name="-X90", description="Rotate X 90.", default= True)
|
||||
ROTATE_X90 = BoolProperty(name="-X90", description="Rotate X 90.", default=True)
|
||||
CLAMP_SIZE = FloatProperty(name="Clamp Scale", description="Clamp the size to this maximum (Zero to Disable)", min=0.0, max=1000.0, soft_min=0.0, soft_max=1000.0, default=0.0)
|
||||
POLYGROUPS = BoolProperty(name="Poly Groups", description="Import OBJ groups as vertex groups.", default= True)
|
||||
IMAGE_SEARCH = BoolProperty(name="Image Search", description="Search subdirs for any assosiated images (Warning, may be slow)", default= True)
|
||||
|
||||
POLYGROUPS = BoolProperty(name="Poly Groups", description="Import OBJ groups as vertex groups.", default=True)
|
||||
IMAGE_SEARCH = BoolProperty(name="Image Search", description="Search subdirs for any assosiated images (Warning, may be slow)", default=True)
|
||||
|
||||
def execute(self, context):
|
||||
# print("Selected: " + context.active_object.name)
|
||||
@ -74,19 +73,19 @@ class ExportOBJ(bpy.types.Operator, ExportHelper):
|
||||
# to the class instance from the operator settings before calling.
|
||||
|
||||
# context group
|
||||
use_selection = BoolProperty(name="Selection Only", description="Export selected objects only", default= False)
|
||||
use_all_scenes = BoolProperty(name="All Scenes", description="", default= False)
|
||||
use_animation = BoolProperty(name="Animation", description="", default= False)
|
||||
use_selection = BoolProperty(name="Selection Only", description="Export selected objects only", default=False)
|
||||
use_all_scenes = BoolProperty(name="All Scenes", description="", default=False)
|
||||
use_animation = BoolProperty(name="Animation", description="", default=False)
|
||||
|
||||
# object group
|
||||
use_modifiers = BoolProperty(name="Apply Modifiers", description="Apply modifiers (preview resolution)", default= True)
|
||||
use_rotate_x90 = BoolProperty(name="Rotate X90", description="", default= True)
|
||||
use_modifiers = BoolProperty(name="Apply Modifiers", description="Apply modifiers (preview resolution)", default=True)
|
||||
use_rotate_x90 = BoolProperty(name="Rotate X90", description="", default=True)
|
||||
|
||||
# extra data group
|
||||
use_edges = BoolProperty(name="Edges", description="", default=True)
|
||||
use_normals = BoolProperty(name="Normals", description="", default=False)
|
||||
use_hq_normals = BoolProperty(name="High Quality Normals", description="", default=True)
|
||||
use_uvs = BoolProperty(name="UVs", description="", default= True)
|
||||
use_uvs = BoolProperty(name="UVs", description="", default=True)
|
||||
use_materials = BoolProperty(name="Materials", description="", default=True)
|
||||
copy_images = BoolProperty(name="Copy Images", description="", default=False)
|
||||
use_triangles = BoolProperty(name="Triangulate", description="", default=False)
|
||||
@ -94,11 +93,10 @@ class ExportOBJ(bpy.types.Operator, ExportHelper):
|
||||
use_nurbs = BoolProperty(name="Nurbs", description="", default=False)
|
||||
|
||||
# grouping group
|
||||
use_blen_objects = BoolProperty(name="Objects as OBJ Objects", description="", default= True)
|
||||
group_by_object = BoolProperty(name="Objects as OBJ Groups ", description="", default= False)
|
||||
group_by_material = BoolProperty(name="Material Groups", description="", default= False)
|
||||
keep_vertex_order = BoolProperty(name="Keep Vertex Order", description="", default= False)
|
||||
|
||||
use_blen_objects = BoolProperty(name="Objects as OBJ Objects", description="", default=True)
|
||||
group_by_object = BoolProperty(name="Objects as OBJ Groups ", description="", default=False)
|
||||
group_by_material = BoolProperty(name="Material Groups", description="", default=False)
|
||||
keep_vertex_order = BoolProperty(name="Keep Vertex Order", description="", default=False)
|
||||
|
||||
def execute(self, context):
|
||||
from . import export_obj
|
||||
@ -117,6 +115,7 @@ def register():
|
||||
bpy.types.INFO_MT_file_import.append(menu_func_import)
|
||||
bpy.types.INFO_MT_file_export.append(menu_func_export)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.types.INFO_MT_file_import.remove(menu_func_import)
|
||||
bpy.types.INFO_MT_file_export.remove(menu_func_export)
|
||||
|
@ -768,7 +768,7 @@ def _write(context, filepath,
|
||||
else:
|
||||
objects = scene.objects
|
||||
|
||||
full_path= ''.join(context_name)
|
||||
full_path = ''.join(context_name)
|
||||
|
||||
# erm... bit of a problem here, this can overwrite files when exporting frames. not too bad.
|
||||
# EXPORT THE FILE.
|
||||
@ -789,7 +789,6 @@ def _write(context, filepath,
|
||||
EXPORT_POLYGROUPS,
|
||||
EXPORT_CURVE_AS_NURBS)
|
||||
|
||||
|
||||
scene.frame_set(orig_frame, 0.0)
|
||||
|
||||
# Restore old active scene.
|
||||
@ -825,7 +824,7 @@ def save(operator, context, filepath="",
|
||||
use_animation=False,
|
||||
):
|
||||
|
||||
_write(context, filepath,
|
||||
_write(context, filepath,
|
||||
EXPORT_TRI=use_triangles,
|
||||
EXPORT_EDGES=use_edges,
|
||||
EXPORT_NORMALS=use_normals,
|
||||
|
@ -58,11 +58,12 @@ class ImportMDD(bpy.types.Operator, ImportHelper):
|
||||
from . import import_mdd
|
||||
return import_mdd.load(self, context, **self.as_keywords(ignore=("filter_glob",)))
|
||||
|
||||
|
||||
class ExportMDD(bpy.types.Operator, ExportHelper):
|
||||
'''Animated mesh to MDD vertex keyframe file'''
|
||||
bl_idname = "export_shape.mdd"
|
||||
bl_label = "Export MDD"
|
||||
|
||||
|
||||
filename_ext = ".mdd"
|
||||
filter_glob = StringProperty(default="*.mdd", options={'HIDDEN'})
|
||||
|
||||
|
@ -39,7 +39,7 @@ def zero_file(filepath):
|
||||
If a file fails, this replaces it with 1 char, better not remove it?
|
||||
'''
|
||||
file = open(filepath, 'w')
|
||||
file.write('\n') # apparently macosx needs some data in a blank file?
|
||||
file.write('\n') # apparently macosx needs some data in a blank file?
|
||||
file.close()
|
||||
|
||||
|
||||
@ -84,13 +84,13 @@ def save(operator, context, filepath="", frame_start=1, frame_end=300, fps=25):
|
||||
|
||||
numframes = frame_end - frame_start + 1
|
||||
fps = float(fps)
|
||||
f = open(filepath, 'wb') #no Errors yet:Safe to create file
|
||||
f = open(filepath, 'wb') # no Errors yet:Safe to create file
|
||||
|
||||
# Write the header
|
||||
f.write(pack(">2i", numframes, numverts))
|
||||
|
||||
# Write the frame times (should we use the time IPO??)
|
||||
f.write(pack(">%df" % (numframes), *[frame / fps for frame in range(numframes)])) # seconds
|
||||
f.write(pack(">%df" % (numframes), *[frame / fps for frame in range(numframes)])) # seconds
|
||||
|
||||
#rest frame needed to keep frames in sync
|
||||
"""
|
||||
@ -102,7 +102,7 @@ def save(operator, context, filepath="", frame_start=1, frame_end=300, fps=25):
|
||||
me.transform(mat_flip * obj.matrix_world)
|
||||
f.write(pack(">%df" % (numverts * 3), *[axis for v in me.vertices for axis in v.co]))
|
||||
|
||||
for frame in range(frame_start, frame_end + 1):#in order to start at desired frame
|
||||
for frame in range(frame_start, frame_end + 1): # in order to start at desired frame
|
||||
"""
|
||||
Blender.Set('curframe', frame)
|
||||
me_tmp.getFromObject(obj.name)
|
||||
@ -127,5 +127,5 @@ def save(operator, context, filepath="", frame_start=1, frame_end=300, fps=25):
|
||||
Blender.Set('curframe', orig_frame)
|
||||
"""
|
||||
scene.frame_set(orig_frame)
|
||||
|
||||
|
||||
return {'FINISHED'}
|
||||
|
@ -36,10 +36,10 @@ from struct import unpack
|
||||
|
||||
|
||||
def load(operator, context, filepath, frame_start=0, frame_step=1):
|
||||
|
||||
|
||||
scene = context.scene
|
||||
obj = context.object
|
||||
|
||||
|
||||
print('\n\nimporting mdd %r' % filepath)
|
||||
|
||||
if bpy.ops.object.mode_set.poll():
|
||||
@ -68,37 +68,34 @@ def load(operator, context, filepath, frame_start=0, frame_step=1):
|
||||
new_shapekey.name = ("frame_%.4d" % fr)
|
||||
new_shapekey_name = new_shapekey.name
|
||||
|
||||
obj.active_shape_key_index = len(obj.data.shape_keys.keys)-1
|
||||
index = len(obj.data.shape_keys.keys)-1
|
||||
obj.active_shape_key_index = len(obj.data.shape_keys.keys) - 1
|
||||
index = len(obj.data.shape_keys.keys) - 1
|
||||
obj.show_only_shape_key = True
|
||||
|
||||
verts = obj.data.shape_keys.keys[len(obj.data.shape_keys.keys)-1].data
|
||||
verts = obj.data.shape_keys.keys[len(obj.data.shape_keys.keys) - 1].data
|
||||
|
||||
|
||||
for v in verts: # 12 is the size of 3 floats
|
||||
for v in verts: # 12 is the size of 3 floats
|
||||
v.co[:] = unpack('>3f', file.read(12))
|
||||
#me.update()
|
||||
obj.show_only_shape_key = False
|
||||
|
||||
|
||||
# insert keyframes
|
||||
shape_keys = obj.data.shape_keys
|
||||
|
||||
scene.frame_current -= 1
|
||||
obj.data.shape_keys.keys[index].value = 0.0
|
||||
shape_keys.keys[len(obj.data.shape_keys.keys)-1].keyframe_insert("value")
|
||||
shape_keys.keys[len(obj.data.shape_keys.keys) - 1].keyframe_insert("value")
|
||||
|
||||
scene.frame_current += 1
|
||||
obj.data.shape_keys.keys[index].value = 1.0
|
||||
shape_keys.keys[len(obj.data.shape_keys.keys)-1].keyframe_insert("value")
|
||||
shape_keys.keys[len(obj.data.shape_keys.keys) - 1].keyframe_insert("value")
|
||||
|
||||
scene.frame_current += 1
|
||||
obj.data.shape_keys.keys[index].value = 0.0
|
||||
shape_keys.keys[len(obj.data.shape_keys.keys)-1].keyframe_insert("value")
|
||||
shape_keys.keys[len(obj.data.shape_keys.keys) - 1].keyframe_insert("value")
|
||||
|
||||
obj.data.update()
|
||||
|
||||
|
||||
for i in range(frames):
|
||||
UpdateMesh(obj, i)
|
||||
|
||||
|
@ -552,7 +552,6 @@ class IsolateTypeRender(bpy.types.Operator):
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
|
||||
class ClearAllRestrictRender(bpy.types.Operator):
|
||||
'''Reveal all render objects by setting the hide render flag'''
|
||||
bl_idname = "object.hide_render_clear_all"
|
||||
|
@ -123,21 +123,21 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to):
|
||||
|
||||
# Align Mode
|
||||
|
||||
if relative_to == 'OPT_4': # Active relative
|
||||
if relative_to == 'OPT_4': # Active relative
|
||||
if align_mode == 'OPT_1':
|
||||
obj_x = obj_loc[0] - negative_x - size_active_x
|
||||
|
||||
elif align_mode == 'OPT_3':
|
||||
obj_x = obj_loc[0] - positive_x + size_active_x
|
||||
|
||||
else: # Everything else relative
|
||||
else: # Everything else relative
|
||||
if align_mode == 'OPT_1':
|
||||
obj_x = obj_loc[0] - negative_x
|
||||
|
||||
elif align_mode == 'OPT_3':
|
||||
obj_x = obj_loc[0] - positive_x
|
||||
|
||||
if align_mode == 'OPT_2': # All relative
|
||||
if align_mode == 'OPT_2': # All relative
|
||||
obj_x = obj_loc[0] - center_x
|
||||
|
||||
# Relative To
|
||||
@ -156,26 +156,24 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to):
|
||||
|
||||
obj.location[0] = loc_x
|
||||
|
||||
|
||||
if align_y:
|
||||
|
||||
# Align Mode
|
||||
|
||||
if relative_to == 'OPT_4': # Active relative
|
||||
if relative_to == 'OPT_4': # Active relative
|
||||
if align_mode == 'OPT_1':
|
||||
obj_y = obj_loc[1] - negative_y - size_active_y
|
||||
|
||||
elif align_mode == 'OPT_3':
|
||||
obj_y = obj_loc[1] - positive_y + size_active_y
|
||||
|
||||
else: # Everything else relative
|
||||
else: # Everything else relative
|
||||
if align_mode == 'OPT_1':
|
||||
obj_y = obj_loc[1] - negative_y
|
||||
|
||||
elif align_mode == 'OPT_3':
|
||||
obj_y = obj_loc[1] - positive_y
|
||||
|
||||
if align_mode == 'OPT_2': # All relative
|
||||
if align_mode == 'OPT_2': # All relative
|
||||
obj_y = obj_loc[1] - center_y
|
||||
|
||||
# Relative To
|
||||
@ -194,26 +192,23 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to):
|
||||
|
||||
obj.location[1] = loc_y
|
||||
|
||||
|
||||
if align_z:
|
||||
|
||||
# Align Mode
|
||||
|
||||
if relative_to == 'OPT_4': # Active relative
|
||||
if relative_to == 'OPT_4': # Active relative
|
||||
if align_mode == 'OPT_1':
|
||||
obj_z = obj_loc[2] - negative_z - size_active_z
|
||||
|
||||
elif align_mode == 'OPT_3':
|
||||
obj_z = obj_loc[2] - positive_z + size_active_z
|
||||
|
||||
else: # Everything else relative
|
||||
else: # Everything else relative
|
||||
if align_mode == 'OPT_1':
|
||||
obj_z = obj_loc[2] - negative_z
|
||||
|
||||
elif align_mode == 'OPT_3':
|
||||
obj_z = obj_loc[2] - positive_z
|
||||
|
||||
if align_mode == 'OPT_2': # All relative
|
||||
if align_mode == 'OPT_2': # All relative
|
||||
obj_z = obj_loc[2] - center_z
|
||||
|
||||
# Relative To
|
||||
|
@ -86,6 +86,7 @@ def randomize_selected(seed, delta, loc, rot, scale, scale_even):
|
||||
|
||||
from bpy.props import *
|
||||
|
||||
|
||||
class RandomizeLocRotSize(bpy.types.Operator):
|
||||
'''Randomize objects loc/rot/scale'''
|
||||
bl_idname = "object.randomize_transform"
|
||||
|
@ -29,7 +29,7 @@ class AddPresetBase():
|
||||
- preset_subdir '''
|
||||
# bl_idname = "script.preset_base_add"
|
||||
# bl_label = "Add a Python Preset"
|
||||
bl_options = {'REGISTER'} # only because invoke_props_popup requires.
|
||||
bl_options = {'REGISTER'} # only because invoke_props_popup requires.
|
||||
|
||||
name = bpy.props.StringProperty(name="Name", description="Name of the preset, used to make the path name", maxlen=64, default="")
|
||||
remove_active = bpy.props.BoolProperty(default=False, options={'HIDDEN'})
|
||||
@ -42,13 +42,13 @@ class AddPresetBase():
|
||||
|
||||
def execute(self, context):
|
||||
import os
|
||||
|
||||
|
||||
if hasattr(self, "pre_cb"):
|
||||
self.pre_cb(context)
|
||||
|
||||
|
||||
preset_menu_class = getattr(bpy.types, self.preset_menu)
|
||||
|
||||
if not self.remove_active:
|
||||
if not self.remove_active:
|
||||
|
||||
if not self.name:
|
||||
return {'FINISHED'}
|
||||
@ -62,7 +62,7 @@ class AddPresetBase():
|
||||
return {'CANCELLED'}
|
||||
|
||||
filepath = os.path.join(target_path, filename) + ".py"
|
||||
|
||||
|
||||
if hasattr(self, "add"):
|
||||
self.add(context, filepath)
|
||||
else:
|
||||
@ -352,6 +352,7 @@ class WM_MT_operator_presets(bpy.types.Menu):
|
||||
|
||||
preset_operator = "script.execute_preset"
|
||||
|
||||
|
||||
def register():
|
||||
pass
|
||||
|
||||
|
@ -21,11 +21,12 @@
|
||||
import bpy
|
||||
from bpy.props import *
|
||||
|
||||
|
||||
def write_svg(fw, mesh, image_width, image_height, face_iter):
|
||||
# for making an XML compatible string
|
||||
from xml.sax.saxutils import escape
|
||||
from os.path import basename
|
||||
|
||||
|
||||
fw('<?xml version="1.0" standalone="no"?>\n')
|
||||
fw('<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" \n')
|
||||
fw(' "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n')
|
||||
@ -126,7 +127,6 @@ def write_png(fw, mesh_source, image_width, image_height, face_iter):
|
||||
for f in mesh_source.faces:
|
||||
tot_verts += len(f.vertices)
|
||||
|
||||
|
||||
faces_source = mesh_source.faces
|
||||
|
||||
# get unique UV's incase there are many overlapping which slow down filling.
|
||||
@ -145,7 +145,6 @@ def write_png(fw, mesh_source, image_width, image_height, face_iter):
|
||||
mesh_new_materials = []
|
||||
mesh_new_face_vertices = []
|
||||
|
||||
|
||||
current_vert = 0
|
||||
|
||||
for face_data in face_hash_3:
|
||||
@ -167,7 +166,7 @@ def write_png(fw, mesh_source, image_width, image_height, face_iter):
|
||||
mesh.faces.foreach_set("material_index", mesh_new_materials)
|
||||
|
||||
mesh.update(calc_edges=True)
|
||||
|
||||
|
||||
obj_solid = bpy.data.objects.new("uv_temp_solid", mesh)
|
||||
obj_wire = bpy.data.objects.new("uv_temp_wire", mesh)
|
||||
base_solid = scene.objects.link(obj_solid)
|
||||
@ -177,11 +176,10 @@ def write_png(fw, mesh_source, image_width, image_height, face_iter):
|
||||
|
||||
# place behind the wire
|
||||
obj_solid.location = 0, 0, -1
|
||||
|
||||
|
||||
obj_wire.material_slots[0].link = 'OBJECT'
|
||||
obj_wire.material_slots[0].material = material_wire
|
||||
|
||||
|
||||
|
||||
# setup the camera
|
||||
cam = bpy.data.cameras.new("uv_temp")
|
||||
cam.type = 'ORTHO'
|
||||
@ -204,7 +202,6 @@ def write_png(fw, mesh_source, image_width, image_height, face_iter):
|
||||
material_wire.use_shadeless = True
|
||||
material_wire.diffuse_color = 0, 0, 0
|
||||
|
||||
|
||||
# scene render settings
|
||||
scene.render.use_raytrace = False
|
||||
scene.render.alpha_mode = 'STRAIGHT'
|
||||
@ -217,11 +214,11 @@ def write_png(fw, mesh_source, image_width, image_height, face_iter):
|
||||
if image_width > image_height:
|
||||
scene.render.pixel_aspect_y = image_width / image_height
|
||||
elif image_width < image_height:
|
||||
scene.render.pixel_aspect_x = image_height /image_width
|
||||
|
||||
scene.render.pixel_aspect_x = image_height / image_width
|
||||
|
||||
scene.frame_start = 1
|
||||
scene.frame_end = 1
|
||||
|
||||
|
||||
scene.render.file_format = 'PNG'
|
||||
scene.render.filepath = filepath
|
||||
|
||||
@ -236,13 +233,12 @@ def write_png(fw, mesh_source, image_width, image_height, face_iter):
|
||||
|
||||
bpy.data.cameras.remove(cam)
|
||||
bpy.data.meshes.remove(mesh)
|
||||
|
||||
|
||||
bpy.data.materials.remove(material_wire)
|
||||
for mat_solid in material_solids:
|
||||
bpy.data.materials.remove(mat_solid)
|
||||
|
||||
|
||||
|
||||
class ExportUVLayout(bpy.types.Operator):
|
||||
"""Export UV layout to file"""
|
||||
|
||||
@ -328,7 +324,6 @@ class ExportUVLayout(bpy.types.Operator):
|
||||
if is_editmode:
|
||||
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
|
||||
|
||||
|
||||
mesh = obj.data
|
||||
|
||||
mode = self.mode
|
||||
|
@ -85,10 +85,10 @@ class BRUSH_OT_set_active_number(bpy.types.Operator):
|
||||
number = IntProperty(name="number",
|
||||
description="Brush number")
|
||||
|
||||
_attr_dict = {"sculpt" : "use_paint_sculpt",
|
||||
_attr_dict = {"sculpt": "use_paint_sculpt",
|
||||
"vertex_paint": "use_paint_vertex",
|
||||
"weight_paint": "use_paint_weight",
|
||||
"image_paint" : "use_paint_texture"}
|
||||
"image_paint": "use_paint_texture"}
|
||||
|
||||
def execute(self, context):
|
||||
attr = self._attr_dict.get(self.mode)
|
||||
@ -102,6 +102,7 @@ class BRUSH_OT_set_active_number(bpy.types.Operator):
|
||||
|
||||
return {'CANCELLED'}
|
||||
|
||||
|
||||
class WM_OT_context_set_boolean(bpy.types.Operator):
|
||||
'''Set a context value.'''
|
||||
bl_idname = "wm.context_set_boolean"
|
||||
@ -668,7 +669,6 @@ class WM_OT_doc_edit(bpy.types.Operator):
|
||||
return wm.invoke_props_dialog(self, width=600)
|
||||
|
||||
|
||||
|
||||
from bpy.props import *
|
||||
|
||||
|
||||
@ -689,7 +689,7 @@ class WM_OT_properties_edit(bpy.types.Operator):
|
||||
'''Internal use (edit a property data_path)'''
|
||||
bl_idname = "wm.properties_edit"
|
||||
bl_label = "Edit Property"
|
||||
bl_options = {'REGISTER'} # only because invoke_props_popup requires.
|
||||
bl_options = {'REGISTER'} # only because invoke_props_popup requires.
|
||||
|
||||
data_path = rna_path
|
||||
property = rna_property
|
||||
@ -803,6 +803,7 @@ class WM_OT_keyconfig_activate(bpy.types.Operator):
|
||||
bpy.utils.keyconfig_set(self.filepath)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class WM_OT_sysinfo(bpy.types.Operator):
|
||||
'''Generate System Info'''
|
||||
bl_idname = "wm.sysinfo"
|
||||
@ -813,6 +814,7 @@ class WM_OT_sysinfo(bpy.types.Operator):
|
||||
sys_info.write_sysinfo(self)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
def register():
|
||||
pass
|
||||
|
||||
|
@ -54,7 +54,7 @@ class BONE_PT_transform(BoneButtonsPanel, bpy.types.Panel):
|
||||
def poll(cls, context):
|
||||
if context.edit_bone:
|
||||
return True
|
||||
|
||||
|
||||
ob = context.object
|
||||
return ob and ob.mode == 'POSE' and context.bone
|
||||
|
||||
|
@ -62,7 +62,7 @@ class DATA_PT_context_curve(CurveButtonsPanel, bpy.types.Panel):
|
||||
if ob:
|
||||
layout.template_ID(ob, "data")
|
||||
elif curve:
|
||||
layout.template_ID(space, "pin_id") # XXX: broken
|
||||
layout.template_ID(space, "pin_id") # XXX: broken
|
||||
|
||||
|
||||
class DATA_PT_shape_curve(CurveButtonsPanel, bpy.types.Panel):
|
||||
|
@ -60,13 +60,13 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
|
||||
col.prop(md, "use_bone_envelopes", text="Bone Envelopes")
|
||||
|
||||
split = layout.split()
|
||||
|
||||
|
||||
col = split.split()
|
||||
col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
|
||||
sub = col.column()
|
||||
sub.active = bool(md.vertex_group)
|
||||
sub.prop(md, "invert_vertex_group")
|
||||
|
||||
|
||||
col = layout.column()
|
||||
col.prop(md, "use_multi_modifier")
|
||||
|
||||
|
@ -68,7 +68,8 @@ class OBJECT_PT_transform(ObjectButtonsPanel, bpy.types.Panel):
|
||||
row.column().prop(ob, "scale")
|
||||
|
||||
layout.prop(ob, "rotation_mode")
|
||||
|
||||
|
||||
|
||||
class OBJECT_PT_delta_transform(ObjectButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Delta Transform"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
@ -550,17 +550,16 @@ class ConstraintButtonsPanel():
|
||||
col.prop(con, "axis_x", text="X")
|
||||
col.prop(con, "axis_y", text="Y")
|
||||
col.prop(con, "axis_z", text="Z")
|
||||
|
||||
|
||||
if con.pivot_type == 'CONE_TWIST':
|
||||
layout.label(text="Limits:")
|
||||
split = layout.split()
|
||||
|
||||
|
||||
col = split.column(align=True)
|
||||
col.prop(con, "use_angular_limit_x", text="Angular X")
|
||||
col.prop(con, "use_angular_limit_y", text="Angular Y")
|
||||
col.prop(con, "use_angular_limit_z", text="Angular Z")
|
||||
|
||||
|
||||
col = split.column()
|
||||
col.prop(con, "limit_cone_min", text="")
|
||||
col = split.column()
|
||||
@ -569,7 +568,7 @@ class ConstraintButtonsPanel():
|
||||
elif con.pivot_type == 'GENERIC_6_DOF':
|
||||
layout.label(text="Limits:")
|
||||
split = layout.split()
|
||||
|
||||
|
||||
col = split.column(align=True)
|
||||
col.prop(con, "use_limit_x", text="X")
|
||||
col.prop(con, "use_limit_y", text="Y")
|
||||
@ -577,12 +576,12 @@ class ConstraintButtonsPanel():
|
||||
col.prop(con, "use_angular_limit_x", text="Angular X")
|
||||
col.prop(con, "use_angular_limit_y", text="Angular Y")
|
||||
col.prop(con, "use_angular_limit_z", text="Angular Z")
|
||||
|
||||
|
||||
col = split.column()
|
||||
col.prop(con, "limit_generic_min", text="")
|
||||
col = split.column()
|
||||
col.prop(con, "limit_generic_max", text="")
|
||||
|
||||
|
||||
def CLAMP_TO(self, context, layout, con):
|
||||
self.target_template(layout, con)
|
||||
|
||||
|
@ -337,7 +337,7 @@ class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel):
|
||||
col.prop(rd, "jpeg2k_ycc")
|
||||
|
||||
elif file_format in ('CINEON', 'DPX'):
|
||||
|
||||
|
||||
split = layout.split()
|
||||
split.label("FIXME: hard coded Non-Linear, Gamma:1.0")
|
||||
'''
|
||||
@ -491,7 +491,7 @@ class RENDER_PT_motion_blur(RenderButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Sampled Motion Blur"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
rd = context.scene.render
|
||||
@ -527,7 +527,7 @@ class RENDER_PT_dimensions(RenderButtonsPanel, bpy.types.Panel):
|
||||
row.menu("RENDER_MT_presets", text=bpy.types.RENDER_MT_presets.bl_label)
|
||||
row.operator("render.preset_add", text="", icon="ZOOMIN")
|
||||
row.operator("render.preset_add", text="", icon="ZOOMOUT").remove_active = True
|
||||
|
||||
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
|
@ -229,7 +229,7 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
|
||||
f.write("# Keying Set: %s\n" % ks.name)
|
||||
|
||||
f.write("import bpy\n\n")
|
||||
f.write("scene= bpy.data.scenes[0]\n\n") # XXX, why not use the current scene?
|
||||
f.write("scene= bpy.data.scenes[0]\n\n") # XXX, why not use the current scene?
|
||||
|
||||
# Add KeyingSet and set general settings
|
||||
f.write("# Keying Set Level declarations\n")
|
||||
@ -238,7 +238,7 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
|
||||
if not ks.is_path_absolute:
|
||||
f.write("ks.is_path_absolute = False\n")
|
||||
f.write("\n")
|
||||
|
||||
|
||||
f.write("ks.bl_options = %r\n" % ks.bl_options)
|
||||
f.write("\n")
|
||||
|
||||
|
@ -103,7 +103,7 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel):
|
||||
|
||||
if tex_collection:
|
||||
row = layout.row()
|
||||
|
||||
|
||||
row.template_list(idblock, "texture_slots", idblock, "active_texture_index", rows=2)
|
||||
|
||||
col = row.column(align=True)
|
||||
@ -143,7 +143,6 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel):
|
||||
split.prop(tex, "type", text="")
|
||||
|
||||
|
||||
|
||||
class TEXTURE_PT_preview(TextureButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Preview"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
@ -394,7 +393,7 @@ class TEXTURE_PT_image_sampling(TextureTypePanel, bpy.types.Panel):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
|
||||
idblock = context_tex_datablock(context)
|
||||
tex = context.texture
|
||||
slot = context.texture_slot
|
||||
@ -410,7 +409,7 @@ class TEXTURE_PT_image_sampling(TextureTypePanel, bpy.types.Panel):
|
||||
col.prop(tex, "use_flip_axis", text="Flip X/Y Axis")
|
||||
|
||||
col = split.column()
|
||||
|
||||
|
||||
#Only for Material based textures, not for Lamp/World...
|
||||
if isinstance(idblock, bpy.types.Material):
|
||||
col.prop(tex, "use_normal_map")
|
||||
@ -900,7 +899,7 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
|
||||
sub = row.row()
|
||||
sub.active = getattr(tex, toggle)
|
||||
sub.prop(tex, factor, text=name, slider=True)
|
||||
return sub # XXX, temp. use_map_normal needs to override.
|
||||
return sub # XXX, temp. use_map_normal needs to override.
|
||||
|
||||
if isinstance(idblock, bpy.types.Material):
|
||||
if idblock.type in ('SURFACE', 'WIRE'):
|
||||
@ -939,13 +938,13 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
|
||||
#sub.prop(tex, "default_value", text="Amount", slider=True)
|
||||
elif idblock.type == 'HALO':
|
||||
layout.label(text="Halo:")
|
||||
|
||||
|
||||
split = layout.split()
|
||||
|
||||
|
||||
col = split.column()
|
||||
factor_but(col, "use_map_color_diffuse", "diffuse_color_factor", "Color")
|
||||
factor_but(col, "use_map_alpha", "alpha_factor", "Alpha")
|
||||
|
||||
|
||||
col = split.column()
|
||||
factor_but(col, "use_map_raymir", "raymir_factor", "Size")
|
||||
factor_but(col, "use_map_hardness", "hardness_factor", "Hardness")
|
||||
|
@ -152,7 +152,7 @@ class WORLD_PT_indirect_lighting(WorldButtonsPanel, bpy.types.Panel):
|
||||
split = layout.split()
|
||||
split.prop(light, "indirect_factor", text="Factor")
|
||||
split.prop(light, "indirect_bounces", text="Bounces")
|
||||
|
||||
|
||||
if light.gather_method == 'RAYTRACE':
|
||||
layout.label(text="Only works with Approximate gather method")
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
# used for DopeSheet, NLA, and Graph Editors
|
||||
def dopesheet_filter(layout, context):
|
||||
dopesheet = context.space_data.dopesheet
|
||||
@ -100,7 +101,7 @@ class DOPESHEET_HT_header(bpy.types.Header):
|
||||
if st.mode == 'DOPESHEET':
|
||||
dopesheet_filter(layout, context)
|
||||
|
||||
elif st.mode in ('ACTION','SHAPEKEY'):
|
||||
elif st.mode in ('ACTION', 'SHAPEKEY'):
|
||||
layout.template_ID(st, "action", new="action.new")
|
||||
|
||||
if st.mode != 'GPENCIL':
|
||||
|
@ -57,9 +57,9 @@ class FILEBROWSER_HT_header(bpy.types.Header):
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.active = params.use_filter
|
||||
|
||||
|
||||
row.prop(params, "use_filter_folder", text="")
|
||||
|
||||
|
||||
if params.filter_glob:
|
||||
#if st.operator and hasattr(st.operator, "filter_glob"):
|
||||
# row.prop(params, "filter_glob", text="")
|
||||
|
@ -188,7 +188,7 @@ class GRAPH_MT_key(bpy.types.Menu):
|
||||
layout.separator()
|
||||
layout.operator_menu_enum("graph.handle_type", "type", text="Handle Type")
|
||||
layout.operator_menu_enum("graph.interpolation_type", "type", text="Interpolation Mode")
|
||||
|
||||
|
||||
layout.separator()
|
||||
layout.operator("graph.clean")
|
||||
layout.operator("graph.sample")
|
||||
|
@ -250,7 +250,8 @@ class IMAGE_MT_uvs(bpy.types.Menu):
|
||||
layout.separator()
|
||||
|
||||
layout.menu("IMAGE_MT_uvs_showhide")
|
||||
|
||||
|
||||
|
||||
class IMAGE_MT_uvs_select_mode(bpy.types.Menu):
|
||||
bl_label = "UV Select Mode"
|
||||
|
||||
@ -259,9 +260,9 @@ class IMAGE_MT_uvs_select_mode(bpy.types.Menu):
|
||||
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
toolsettings = context.tool_settings
|
||||
|
||||
|
||||
# do smart things depending on whether uv_select_sync is on
|
||||
|
||||
|
||||
if toolsettings.use_uv_select_sync:
|
||||
prop = layout.operator("wm.context_set_value", text="Vertex", icon='VERTEXSEL')
|
||||
prop.value = "(True, False, False)"
|
||||
@ -287,7 +288,7 @@ class IMAGE_MT_uvs_select_mode(bpy.types.Menu):
|
||||
prop = layout.operator("wm.context_set_string", text="Face", icon='UV_FACESEL')
|
||||
prop.value = "FACE"
|
||||
prop.data_path = "tool_settings.uv_select_mode"
|
||||
|
||||
|
||||
prop = layout.operator("wm.context_set_string", text="Island", icon='UV_ISLANDSEL')
|
||||
prop.value = "ISLAND"
|
||||
prop.data_path = "tool_settings.uv_select_mode"
|
||||
|
@ -69,7 +69,6 @@ class INFO_HT_header(bpy.types.Header):
|
||||
# XXX: this should be right-aligned to the RHS of the region
|
||||
layout.operator("wm.window_fullscreen_toggle", icon='FULLSCREEN_ENTER', text="")
|
||||
|
||||
|
||||
# XXX: BEFORE RELEASE, MOVE FILE MENU OUT OF INFO!!!
|
||||
"""
|
||||
row = layout.row(align=True)
|
||||
@ -82,7 +81,7 @@ class INFO_HT_header(bpy.types.Header):
|
||||
row = layout.row()
|
||||
row.enabled = sinfo.show_report_operator
|
||||
row.operator("info.report_replay")
|
||||
|
||||
|
||||
row.menu("INFO_MT_report")
|
||||
"""
|
||||
|
||||
@ -220,6 +219,7 @@ class INFO_MT_curve_add(bpy.types.Menu):
|
||||
layout.operator("curve.primitive_nurbs_circle_add", icon='CURVE_NCIRCLE', text="Nurbs Circle")
|
||||
layout.operator("curve.primitive_nurbs_path_add", icon='CURVE_PATH', text="Path")
|
||||
|
||||
|
||||
class INFO_MT_edit_curve_add(bpy.types.Menu):
|
||||
bl_idname = "INFO_MT_edit_curve_add"
|
||||
bl_label = "Add"
|
||||
@ -231,9 +231,9 @@ class INFO_MT_edit_curve_add(bpy.types.Menu):
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
|
||||
if is_surf:
|
||||
INFO_MT_surface_add.draw(self, context)
|
||||
INFO_MT_surface_add.draw(self, context)
|
||||
else:
|
||||
INFO_MT_curve_add.draw(self, context)
|
||||
INFO_MT_curve_add.draw(self, context)
|
||||
|
||||
|
||||
class INFO_MT_surface_add(bpy.types.Menu):
|
||||
|
@ -390,7 +390,7 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, bpy.types.Panel):
|
||||
col.label(text="Frame Still %d:%d" % (strip.frame_still_start, strip.frame_still_end))
|
||||
|
||||
elem = False
|
||||
|
||||
|
||||
if strip.type == 'IMAGE':
|
||||
elem = strip.getStripElem(frame_current)
|
||||
elif strip.type == 'MOVIE':
|
||||
@ -684,7 +684,7 @@ class SEQUENCER_PT_scene(SequencerButtonsPanel, bpy.types.Panel):
|
||||
layout.template_ID(strip, "scene_camera")
|
||||
|
||||
sce = strip.scene
|
||||
layout.label(text="Original frame range: "+ str(sce.frame_start) +" - "+ str(sce.frame_end) + " (" + str(sce.frame_end-sce.frame_start+1) + ")")
|
||||
layout.label(text="Original frame range: %d-%d (%d)" % (sce.frame_start, sce.frame_end, sce.frame_end - sce.frame_start + 1))
|
||||
|
||||
|
||||
class SEQUENCER_PT_filter(SequencerButtonsPanel, bpy.types.Panel):
|
||||
@ -793,7 +793,7 @@ class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, bpy.types.Panel):
|
||||
render = context.scene.render
|
||||
|
||||
col = layout.column()
|
||||
col.active = False #Currently only opengl preview works!
|
||||
col.active = False # Currently only opengl preview works!
|
||||
col.prop(render, "use_sequencer_gl_preview", text="Open GL Preview")
|
||||
col = layout.column()
|
||||
#col.active = render.use_sequencer_gl_preview
|
||||
|
@ -73,11 +73,11 @@ class TIME_HT_header(bpy.types.Header):
|
||||
sub.operator("screen.animation_play", text="", icon='PAUSE')
|
||||
row.operator("screen.keyframe_jump", text="", icon='NEXT_KEYFRAME').next = True
|
||||
row.operator("screen.frame_jump", text="", icon='FF').end = True
|
||||
|
||||
|
||||
layout.prop(scene, "sync_mode", text="")
|
||||
|
||||
layout.separator()
|
||||
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(tools, "use_keyframe_insert_auto", text="", toggle=True)
|
||||
if screen.is_animation_playing and tools.use_keyframe_insert_auto:
|
||||
|
@ -808,6 +808,7 @@ class USERPREF_PT_input(InputKeyMapPanel):
|
||||
|
||||
#print("runtime", time.time() - start)
|
||||
|
||||
|
||||
class USERPREF_MT_addons_dev_guides(bpy.types.Menu):
|
||||
bl_label = "Addons develoment guides"
|
||||
|
||||
@ -848,21 +849,21 @@ class USERPREF_PT_addons(bpy.types.Panel):
|
||||
|
||||
modules = []
|
||||
loaded_modules = set()
|
||||
|
||||
|
||||
# RELEASE SCRIPTS: official scripts distributed in Blender releases
|
||||
paths = bpy.utils.script_paths("addons")
|
||||
|
||||
|
||||
# CONTRIB SCRIPTS: good for testing but not official scripts yet
|
||||
# if folder addons_contrib/ exists, scripts in there will be loaded too
|
||||
paths += bpy.utils.script_paths("addons_contrib")
|
||||
|
||||
|
||||
# EXTERN SCRIPTS: external projects scripts
|
||||
# if folder addons_extern/ exists, scripts in there will be loaded too
|
||||
paths += bpy.utils.script_paths("addons_extern")
|
||||
|
||||
if bpy.app.debug:
|
||||
t_main = time.time()
|
||||
|
||||
|
||||
# fake module importing
|
||||
def fake_module(mod_name, mod_path, speedy=True):
|
||||
if bpy.app.debug:
|
||||
@ -953,11 +954,11 @@ class USERPREF_PT_addons(bpy.types.Panel):
|
||||
col = split.column()
|
||||
col.prop(context.window_manager, "addon_search", text="", icon='VIEWZOOM')
|
||||
col.prop(context.window_manager, "addon_filter", text="Filter", expand=True)
|
||||
|
||||
|
||||
# menu to open webpages with addons development guides
|
||||
col.separator()
|
||||
col.label(text = ' Online Documentation', icon = 'INFO')
|
||||
col.menu('USERPREF_MT_addons_dev_guides', text='Addons Developer Guides')
|
||||
col.label(text=" Online Documentation", icon='INFO')
|
||||
col.menu("USERPREF_MT_addons_dev_guides", text="Addons Developer Guides")
|
||||
|
||||
col = split.column()
|
||||
|
||||
|
@ -128,6 +128,7 @@ class USERPREF_MT_keyconfigs(bpy.types.Menu):
|
||||
bl_label = "KeyPresets"
|
||||
preset_subdir = "keyconfig"
|
||||
preset_operator = "wm.keyconfig_activate"
|
||||
|
||||
def draw(self, context):
|
||||
props = self.layout.operator("wm.context_set_value", text="Blender (default)")
|
||||
props.data_path = "window_manager.keyconfigs.active"
|
||||
@ -379,7 +380,7 @@ class InputKeyMapPanel(bpy.types.Panel):
|
||||
subcol = subsplit.column()
|
||||
|
||||
row = subcol.row(align=True)
|
||||
|
||||
|
||||
#row.prop_search(wm.keyconfigs, "active", wm, "keyconfigs", text="Key Config:")
|
||||
text = bpy.path.display_name(context.window_manager.keyconfigs.active.name)
|
||||
if not text:
|
||||
@ -387,7 +388,7 @@ class InputKeyMapPanel(bpy.types.Panel):
|
||||
row.menu("USERPREF_MT_keyconfigs", text=text)
|
||||
row.operator("wm.keyconfig_preset_add", text="", icon="ZOOMIN")
|
||||
row.operator("wm.keyconfig_preset_add", text="", icon="ZOOMOUT").remove_active = True
|
||||
|
||||
|
||||
# layout.context_pointer_set("keyconfig", wm.keyconfigs.active)
|
||||
# row.operator("wm.keyconfig_remove", text="", icon='X')
|
||||
|
||||
@ -605,7 +606,7 @@ class WM_OT_keyconfig_export(bpy.types.Operator):
|
||||
f.write("import bpy\n")
|
||||
f.write("import os\n\n")
|
||||
f.write("wm = bpy.context.window_manager\n")
|
||||
f.write("kc = wm.keyconfigs.new(os.path.splitext(os.path.basename(__file__))[0])\n\n") # keymap must be created by caller
|
||||
f.write("kc = wm.keyconfigs.new(os.path.splitext(os.path.basename(__file__))[0])\n\n") # keymap must be created by caller
|
||||
|
||||
# Generate a list of keymaps to export:
|
||||
#
|
||||
|
@ -647,6 +647,7 @@ class VIEW3D_MT_select_face(bpy.types.Menu): # XXX no matching enum
|
||||
|
||||
# ********** Object menu **********
|
||||
|
||||
|
||||
class VIEW3D_MT_object(bpy.types.Menu):
|
||||
bl_context = "objectmode"
|
||||
bl_label = "Object"
|
||||
@ -1418,7 +1419,7 @@ class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu):
|
||||
if mesh.total_edge_sel and (select_mode[0] or select_mode[1]):
|
||||
menu += ["EDGE"]
|
||||
if mesh.total_vert_sel and select_mode[0]:
|
||||
menu += ["VERT"]
|
||||
menu += ["VERT"]
|
||||
|
||||
# should never get here
|
||||
return menu
|
||||
|
@ -1077,9 +1077,9 @@ class VIEW3D_PT_tools_weightpaint(View3DPanel, bpy.types.Panel):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
|
||||
ob = context.active_object
|
||||
|
||||
|
||||
col = layout.column()
|
||||
col.active = ob.vertex_groups.active != None
|
||||
col.operator("object.vertex_group_normalize_all", text="Normalize All")
|
||||
|
@ -48,7 +48,7 @@ def file_list_py(path):
|
||||
|
||||
def is_pep8(path):
|
||||
print(path)
|
||||
f = open(path, 'r')
|
||||
f = open(path, 'r', encoding="utf8")
|
||||
for i in range(PEP8_SEEK_COMMENT):
|
||||
line = f.readline()
|
||||
if line.startswith("# <pep8"):
|
||||
|
Loading…
Reference in New Issue
Block a user