Merged changes in the trunk up to revision 31880.

This commit is contained in:
Tamito Kajiyama 2010-09-11 11:16:55 +00:00
commit fdb4b0c3ed
167 changed files with 8569 additions and 7064 deletions

View File

@ -309,8 +309,8 @@ IF(UNIX AND NOT APPLE)
IF(WITH_OPENMP)
LIST(APPEND LLIBS -lgomp)
LIST(APPEND CMAKE_C_FLAGS -fopenmp)
LIST(APPEND CMAKE_CXX_FLAGS -fopenmp)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
ENDIF(WITH_OPENMP)
@ -401,8 +401,7 @@ IF(WIN32)
ENDIF(WITH_QUICKTIME)
IF(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
ADD_DEFINITIONS(-D__SSE__)
ADD_DEFINITIONS(-D__MMX__)
ADD_DEFINITIONS(-D__SSE__ -D__MMX__)
ENDIF(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
IF(MSVC)
@ -865,8 +864,7 @@ IF(WITH_RAYOPTIMIZATION)
IF(CMAKE_COMPILER_IS_GNUCC)
IF(SUPPORT_SSE_BUILD)
SET(PLATFORM_CFLAGS " -msse ${PLATFORM_CFLAGS}")
ADD_DEFINITIONS(-D__SSE__)
ADD_DEFINITIONS(-D__MMX__)
ADD_DEFINITIONS(-D__SSE__ -D__MMX__)
ENDIF(SUPPORT_SSE_BUILD)
IF(SUPPORT_SSE2_BUILD)
SET(PLATFORM_CFLAGS " -msse2 ${PLATFORM_CFLAGS}")

View File

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

View File

@ -15,7 +15,7 @@ import sys
Variables = SCons.Variables
BoolVariable = SCons.Variables.BoolVariable
VERSION = '2.53' # This is used in creating the local config directories
VERSION = '2.54' # This is used in creating the local config directories
def print_arguments(args, bc):
if len(args):

View File

@ -91,25 +91,25 @@ while lines:
l = lines.pop(0)
if l.startswith("Environment Variables:"):
fw('.SH "ENVIRONMENT VARIABLES"\n')
elif l.endswith(":"): # one line
elif l.endswith(":"): # one line
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('.B %s\n' % man_format(l))
while lines:
# 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
if not l: # second blank line
if not l: # second blank line
fw('.IP\n')
else:
fw('.br\n')
l = lines.pop(0)
l = l[1:] # remove first whitespace (tab)
l = l[1:] # remove first whitespace (tab)
fw('%s\n' % man_format(l))

View File

@ -27,7 +27,7 @@
SET(INC include src)
IF(UNIX)
SET(INC ${INC} ${X11_X11_INCLUDE_PATH})
LIST(APPEND INC ${X11_X11_INCLUDE_PATH})
ENDIF(UNIX)
SET(SRC
@ -37,4 +37,3 @@ SET(SRC
ADD_DEFINITIONS(-DGLEW_STATIC)
BLENDERLIB(extern_glew "${SRC}" "${INC}")

View File

@ -36,49 +36,43 @@ FILE(GLOB SRC
)
IF(WITH_FFMPEG)
LIST(APPEND INC ffmpeg)
LIST(APPEND INC ${FFMPEG_INC})
LIST(APPEND INC ffmpeg ${FFMPEG_INC})
FILE(GLOB FFMPEGSRC ffmpeg/*.cpp)
ADD_DEFINITIONS(-DWITH_FFMPEG)
ENDIF(WITH_FFMPEG)
IF(WITH_SDL)
LIST(APPEND INC SDL)
LIST(APPEND INC ${SDL_INCLUDE_DIR})
LIST(APPEND INC SDL ${SDL_INCLUDE_DIR})
FILE(GLOB SDLSRC SDL/*.cpp)
ADD_DEFINITIONS(-DWITH_SDL)
ENDIF(WITH_SDL)
IF(WITH_OPENAL)
LIST(APPEND INC OpenAL)
LIST(APPEND INC ${OPENAL_INCLUDE_DIR})
LIST(APPEND INC OpenAL ${OPENAL_INCLUDE_DIR})
FILE(GLOB OPENALSRC OpenAL/*.cpp)
ADD_DEFINITIONS(-DWITH_OPENAL)
ENDIF(WITH_OPENAL)
IF(WITH_JACK)
LIST(APPEND INC jack)
LIST(APPEND INC ${JACK_INC})
LIST(APPEND INC jack ${JACK_INC})
FILE(GLOB JACKSRC jack/*.cpp)
ADD_DEFINITIONS(-DWITH_JACK)
ENDIF(WITH_JACK)
IF(WITH_SNDFILE)
LIST(APPEND INC sndfile)
LIST(APPEND INC ${SNDFILE_INC})
LIST(APPEND INC sndfile ${SNDFILE_INC})
FILE(GLOB SNDFILESRC sndfile/*.cpp)
ADD_DEFINITIONS(-DWITH_SNDFILE)
ENDIF(WITH_SNDFILE)
#IF(WITH_FFTW3)
# SET(INC ${INC} fftw ${FFTW3_INC})
# LIST(APPEND INC fftw ${FFTW3_INC})
# FILE(GLOB FFTW3SRC fftw/*.cpp)
# ADD_DEFINITIONS(-DWITH_FFTW3)
#ENDIF(WITH_FFTW3)
IF(WITH_PYTHON)
LIST(APPEND INC Python)
LIST(APPEND INC ${PYTHON_INC})
LIST(APPEND INC Python ${PYTHON_INC})
FILE(GLOB PYTHONSRC Python/*.cpp)
ELSE(WITH_PYTHON)
ADD_DEFINITIONS(-DDISABLE_PYTHON)

View File

@ -52,13 +52,13 @@ SET(SRC
IF(APPLE)
IF(WITH_COCOA)
SET(SRC ${SRC}
LIST(APPEND SRC
${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerCocoa.mm
${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemCocoa.mm
${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowCocoa.mm
)
ELSE(WITH_COCOA)
SET(SRC ${SRC}
LIST(APPEND SRC
${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerCarbon.cpp
${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemCarbon.cpp
${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowCarbon.cpp
@ -69,18 +69,18 @@ IF(APPLE)
ADD_DEFINITIONS(-DWITH_QUICKTIME)
ENDIF(WITH_QUICKTIME)
ELSEIF(WIN32)
SET(INC ${INC} ${WINTAB_INC})
LIST(APPEND INC ${WINTAB_INC})
SET(SRC ${SRC}
LIST(APPEND SRC
${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerWin32.cpp
${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemWin32.cpp
${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowWin32.cpp
${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DropTargetWin32.cpp
)
ELSEIF(UNIX)
SET(INC ${INC} ${X11_X11_INCLUDE_PATH})
LIST(APPEND INC ${X11_X11_INCLUDE_PATH})
SET(SRC ${SRC}
LIST(APPEND SRC
${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerX11.cpp
${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemX11.cpp
${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowX11.cpp

View File

@ -207,17 +207,17 @@ GHOST_IWindow* GHOST_SystemWin32::createWindow(
}
else {
// An invalid window could be one that was used to test for AA
GHOST_Window *other_window = ((GHOST_WindowWin32*)window)->getNextWindow();
delete window;
window = 0;
window = ((GHOST_WindowWin32*)window)->getNextWindow();
// If another window is found, let the wm know about that one, but not the old one
if (other_window)
{
m_windowManager->addWindow(other_window);
window = other_window;
if (window->getValid()) {
m_windowManager->addWindow(window);
}
else {
delete window;
window = 0;
}
}
}
return window;

View File

@ -24,7 +24,14 @@
#
# ***** END GPL LICENSE BLOCK *****
SET(INC ${PNG_INC} ${ZLIB_INC} intern ../../extern/bullet2/src ../memutil ../guardealloc)
SET(INC
intern
../memutil
../guardealloc
../../extern/bullet2/src
${PNG_INC}
${ZLIB_INC}
)
FILE(GLOB SRC intern/*.cpp)
@ -34,9 +41,8 @@ ENDIF(WITH_OPENMP)
IF(WITH_FFTW3)
ADD_DEFINITIONS(-DFFTW3=1)
SET(INC ${INC} ${FFTW3_INC})
LIST(APPEND INC ${FFTW3_INC})
ENDIF(WITH_FFTW3)
BLENDERLIB(bf_intern_smoke "${SRC}" "${INC}")
#, libtype='blender', priority = 0 )

View File

@ -1 +1 @@
2.5-beta
2.54-beta

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 KiB

After

Width:  |  Height:  |  Size: 213 KiB

View File

@ -19,7 +19,7 @@
# This directory is a Python package.
# To support reload properly, try to access a package var, if it's there, reload everything
if "bpy" in locals():
if "init_data" in locals():
reload(model)
reload(operators)
reload(client)
@ -48,6 +48,8 @@ blacklist = []
init_file = ""
init_address = True
init_data = True
def register():
ui.addProperties()
@ -55,5 +57,4 @@ def register():
def unregister():
import bpy
bpy.types.Scene.RemoveProperty("network_render")
del bpy.types.Scene.network_render

View File

@ -210,7 +210,7 @@ class NetworkRenderEngine(bpy.types.RenderEngine):
address = "" if netsettings.server_address == "[default]" else netsettings.server_address
master.runMaster((address, netsettings.server_port), netsettings.master_broadcast, netsettings.use_master_clear, netsettings.path, self.update_stats, self.test_break)
master.runMaster((address, netsettings.server_port), netsettings.use_master_broadcast, netsettings.use_master_clear, netsettings.path, self.update_stats, self.test_break)
def render_slave(self, scene):

View File

@ -339,42 +339,43 @@ class NetRenderJob(bpy.types.IDPropertyGroup):
pass
def addProperties():
bpy.types.Scene.PointerProperty(attr="network_render", type=NetRenderSettings, name="Network Render", description="Network Render Settings")
from bpy.props import PointerProperty, StringProperty, BoolProperty, EnumProperty, IntProperty, CollectionProperty
bpy.types.Scene.network_render = PointerProperty(type=NetRenderSettings, name="Network Render", description="Network Render Settings")
NetRenderSettings.StringProperty( attr="server_address",
NetRenderSettings.server_address = StringProperty(
name="Server address",
description="IP or name of the master render server",
maxlen = 128,
default = "[default]")
NetRenderSettings.IntProperty( attr="server_port",
NetRenderSettings.server_port = IntProperty(
name="Server port",
description="port of the master render server",
default = 8000,
min=1,
max=65535)
NetRenderSettings.BoolProperty( attr="use_master_broadcast",
NetRenderSettings.use_master_broadcast = BoolProperty(
name="Broadcast",
description="broadcast master server address on local network",
default = True)
NetRenderSettings.BoolProperty( attr="use_slave_clear",
NetRenderSettings.use_slave_clear = BoolProperty(
name="Clear on exit",
description="delete downloaded files on exit",
default = True)
NetRenderSettings.BoolProperty( attr="use_slave_thumb",
NetRenderSettings.use_slave_thumb = BoolProperty(
name="Generate thumbnails",
description="Generate thumbnails on slaves instead of master",
default = False)
NetRenderSettings.BoolProperty( attr="use_slave_output_log",
NetRenderSettings.use_slave_output_log = BoolProperty(
name="Output render log on console",
description="Output render text log to console as well as sending it to the master",
default = True)
NetRenderSettings.BoolProperty( attr="use_master_clear",
NetRenderSettings.use_master_clear = BoolProperty(
name="Clear on exit",
description="delete saved files on exit",
default = False)
@ -389,67 +390,67 @@ def addProperties():
elif not default_path.endswith(os.sep):
default_path += os.sep
NetRenderSettings.StringProperty( attr="path",
NetRenderSettings.path = StringProperty(
name="Path",
description="Path for temporary files",
maxlen = 128,
default = default_path,
subtype='FILE_PATH')
NetRenderSettings.StringProperty( attr="job_name",
NetRenderSettings.job_name = StringProperty(
name="Job name",
description="Name of the job",
maxlen = 128,
default = "[default]")
NetRenderSettings.StringProperty( attr="job_category",
NetRenderSettings.job_category = StringProperty(
name="Job category",
description="Category of the job",
maxlen = 128,
default = "")
NetRenderSettings.IntProperty( attr="chunks",
NetRenderSettings.chunks = IntProperty(
name="Chunks",
description="Number of frame to dispatch to each slave in one chunk",
default = 5,
min=1,
max=65535)
NetRenderSettings.IntProperty( attr="priority",
NetRenderSettings.priority = IntProperty(
name="Priority",
description="Priority of the job",
default = 1,
min=1,
max=10)
NetRenderSettings.StringProperty( attr="job_id",
NetRenderSettings.job_id = StringProperty(
name="Network job id",
description="id of the last sent render job",
maxlen = 64,
default = "")
NetRenderSettings.IntProperty( attr="active_slave_index",
NetRenderSettings.active_slave_index = IntProperty(
name="Index of the active slave",
description="",
default = -1,
min= -1,
max=65535)
NetRenderSettings.IntProperty( attr="active_blacklisted_slave_index",
NetRenderSettings.active_blacklisted_slave_index = IntProperty(
name="Index of the active slave",
description="",
default = -1,
min= -1,
max=65535)
NetRenderSettings.IntProperty( attr="active_job_index",
NetRenderSettings.active_job_index = IntProperty(
name="Index of the active job",
description="",
default = -1,
min= -1,
max=65535)
NetRenderSettings.EnumProperty(attr="mode",
NetRenderSettings.mode = EnumProperty(
items=(
("RENDER_CLIENT", "Client", "Act as render client"),
("RENDER_MASTER", "Master", "Act as render master"),
@ -459,17 +460,17 @@ def addProperties():
description="Mode of operation of this instance",
default="RENDER_CLIENT")
NetRenderSettings.CollectionProperty(attr="slaves", type=NetRenderSlave, name="Slaves", description="")
NetRenderSettings.CollectionProperty(attr="slaves_blacklist", type=NetRenderSlave, name="Slaves Blacklist", description="")
NetRenderSettings.CollectionProperty(attr="jobs", type=NetRenderJob, name="Job List", description="")
NetRenderSettings.slaves = CollectionProperty(type=NetRenderSlave, name="Slaves", description="")
NetRenderSettings.slaves_blacklist = CollectionProperty(type=NetRenderSlave, name="Slaves Blacklist", description="")
NetRenderSettings.jobs = CollectionProperty(type=NetRenderJob, name="Job List", description="")
NetRenderSlave.StringProperty( attr="name",
NetRenderSlave.name = StringProperty(
name="Name of the slave",
description="",
maxlen = 64,
default = "")
NetRenderJob.StringProperty( attr="name",
NetRenderJob.name = StringProperty(
name="Name of the job",
description="",
maxlen = 128,

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':
base.layers_from_view(context.space_data)
obj_new.matrix_world = add_object_align_init(context, operator)
obj_act = scene.objects.active
@ -69,10 +68,10 @@ def add_object_data(context, obdata, operator=None):
bpy.ops.object.mode_set(mode='OBJECT')
obj_act.select = True
scene.update() # apply location
scene.update() # apply location
#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')
else:

View File

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

View File

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

View File

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

View File

@ -26,6 +26,7 @@ functions for dealing with paths in Blender.
import bpy as _bpy
import os as _os
def abspath(path):
"""
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):
"""
Resolve a case insensitive path on a case sensitive system,
returning a string with the path if found else return the original path.
"""
"""
Resolve a case insensitive path on a case sensitive system,
returning a string with the path if found else return the original path.
"""
import os
import os
def _ncase_path_found(path):
if path=='' or os.path.exists(path):
return path, True
def _ncase_path_found(path):
if path == "" or os.path.exists(path):
return path, True
filename = os.path.basename(path) # filename may be a directory or a file
dirpath = os.path.dirname(path)
filename = os.path.basename(path) # filename may be a directory or a file
dirpath = os.path.dirname(path)
suffix = ""
if not filename: # dir ends with a slash?
if len(dirpath) < len(path):
suffix = path[:len(path)-len(dirpath)]
suffix = ""
if not filename: # dir ends with a slash?
if len(dirpath) < len(path):
suffix = path[:len(path) - len(dirpath)]
filename = os.path.basename(dirpath)
dirpath = os.path.dirname(dirpath)
filename = os.path.basename(dirpath)
dirpath = os.path.dirname(dirpath)
if not os.path.exists(dirpath):
dirpath, found = _ncase_path_found(dirpath)
if not os.path.exists(dirpath):
dirpath, found = _ncase_path_found(dirpath)
if not found:
return path, False
if not found:
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
if os.path.isdir(dirpath):
files = os.listdir(dirpath)
else:
return path, False
# we are expecting 'dirpath' to be a directory, but it could be a file
if os.path.isdir(dirpath):
files = os.listdir(dirpath)
else:
return path, False
filename_low = filename.lower()
f_iter_nocase = None
filename_low = filename.lower()
f_iter_nocase = None
for f_iter in files:
if f_iter.lower() == filename_low:
f_iter_nocase = f_iter
break
for f_iter in files:
if f_iter.lower() == filename_low:
f_iter_nocase = f_iter
break
if f_iter_nocase:
return os.path.join(dirpath, f_iter_nocase) + suffix, True
else:
# cant find the right one, just return the path as is.
return path, False
if f_iter_nocase:
return os.path.join(dirpath, f_iter_nocase) + suffix, True
else:
# cant find the right one, just return the path as is.
return path, False
ncase_path, found = _ncase_path_found(path)
return ncase_path if found else path
ncase_path, found = _ncase_path_found(path)
return ncase_path if found else path
def ensure_ext(filepath, ext, case_sensitive=False):
@ -172,3 +173,35 @@ def ensure_ext(filepath, ext, case_sensitive=False):
else:
return filepath + ext
def module_names(path, recursive=False):
"""
Return a list of modules which can be imported from *path*.
:arg path: a directory to scan.
:type path: string
:arg recursive: Also return submodule names for packages.
:type recursive: bool
:return: a list of string pairs (module_name, module_file).
:rtype: list
"""
from os.path import join, isfile
modules = []
for filename in sorted(_os.listdir(path)):
if filename.endswith(".py") and filename != "__init__.py":
fullpath = join(path, filename)
modules.append((filename[0:-3], fullpath))
elif ("." not in filename):
directory = join(path, filename)
fullpath = join(directory, "__init__.py")
if isfile(fullpath):
modules.append((filename, fullpath))
if recursive:
for mod_name, mod_path in module_names(directory, True):
modules.append(("%s.%s" % (filename, mod_name), mod_path))
return modules

View File

@ -30,6 +30,7 @@ import sys as _sys
from _bpy import blend_paths
from _bpy import script_paths as _bpy_script_paths
def _test_import(module_name, loaded_modules):
import traceback
import time
@ -49,7 +50,7 @@ def _test_import(module_name, loaded_modules):
if _bpy.app.debug:
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
@ -69,23 +70,16 @@ def modules_from_path(path, loaded_modules):
modules = []
for f in sorted(_os.listdir(path)):
if f.endswith(".py"):
# python module
mod = _test_import(f[0:-3], loaded_modules)
elif ("." not in f) and (_os.path.isfile(_os.path.join(path, f, "__init__.py"))):
# python package
mod = _test_import(f, loaded_modules)
else:
mod = None
for mod_name, mod_path in _bpy.path.module_names(path):
mod = _test_import(mod_name, loaded_modules)
if mod:
modules.append(mod)
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):
@ -109,7 +103,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
if refresh_scripts:
original_modules = _sys.modules.values()
if reload_scripts:
_bpy_types.TypeMap.clear()
_bpy_types.PropertiesMap.clear()
@ -135,7 +129,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
traceback.print_exc()
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)
def test_reload(mod):
@ -191,7 +185,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
continue
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):
test_register(mod)
@ -212,12 +206,10 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
if _bpy.app.debug:
print("Python Script Load Time %.4f" % (time.time() - t_main))
_bpy_types._register_immediate = True
# base scripts
_scripts = _os.path.join(_os.path.dirname(__file__), _os.path.pardir, _os.path.pardir)
_scripts = (_os.path.normpath(_scripts), )
@ -265,7 +257,7 @@ def script_paths(subdir=None, user=True):
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):
@ -280,7 +272,7 @@ def smpte_from_seconds(time, fps=None):
'''
Returns an SMPTE formatted string from the time in seconds: "HH:MM:SS:FF".
If the fps is not given the current scene is used.
If the *fps* is not given the current scene is used.
'''
import math
@ -295,10 +287,10 @@ def smpte_from_seconds(time, fps=None):
else:
neg = ""
if time >= 3600.0: # hours
if time >= 3600.0: # hours
hours = int(time / 3600.0)
time = time % 3600.0
if time >= 60.0: # mins
if time >= 60.0: # mins
minutes = int(time / 60.0)
time = time % 60.0
@ -312,7 +304,7 @@ def smpte_from_frame(frame, fps=None, fps_base=None):
'''
Returns an SMPTE formatted string from the frame: "HH:MM:SS:FF".
If the fps and fps_base are not given the current scene is used.
If *fps* and *fps_base* are not given the current scene is used.
'''
if fps is None:

View File

@ -23,6 +23,7 @@ import _bpy
from mathutils import Vector
StructRNA = bpy_types.Struct.__bases__[0]
StructMetaIDProp = _bpy.StructMetaIDProp
# StructRNA = bpy_types.Struct
@ -251,7 +252,7 @@ class _GenericBone:
bones = id_data.pose.bones
elif id_data_type == bpy_types.Armature:
bones = id_data.edit_bones
if not bones: # not in editmode
if not bones: # not in editmode
bones = id_data.bones
return bones
@ -368,7 +369,7 @@ class Mesh(bpy_types.ID):
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:
faces = self.faces
@ -389,7 +390,7 @@ class Mesh(bpy_types.ID):
edge_loops = []
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
context_loop = [edkey, ed_adj[0]]
edge_loops.append(context_loop)
@ -407,11 +408,11 @@ class Mesh(bpy_types.ID):
ed_adj = edges[context_loop[-1]]
if len(ed_adj) != 2:
if other_dir and flipped == False: # the original edge had 2 other edges
flipped = True # only flip the list once
if other_dir and flipped == False: # the original edge had 2 other edges
flipped = True # only flip the list once
context_loop.reverse()
ed_adj[:] = []
context_loop.append(other_dir) # save 1 lookiup
context_loop.append(other_dir) # save 1 lookiup
ed_adj = edges[context_loop[-1]]
if len(ed_adj) != 2:
@ -427,7 +428,6 @@ class Mesh(bpy_types.ID):
# Dont look at this again
ed_adj[:] = []
return edge_loops
def edge_loops_from_edges(self, edges=None):
@ -556,6 +556,7 @@ PropertiesMap = {}
# registers moduals instantly.
_register_immediate = True
def _unregister_module(module, free=True):
for t in TypeMap.get(module, ()):
try:
@ -568,7 +569,6 @@ def _unregister_module(module, free=True):
if free == True and module in TypeMap:
del TypeMap[module]
for t in PropertiesMap.get(module, ()):
try:
bpy_types.unregister(t)
@ -587,7 +587,8 @@ def _register_module(module):
bpy_types.register(t)
except:
import traceback
print("bpy.utils._register_module(): Module '%s' failed to register class '%s.%s'" % (module, t.__module__, t.__name__))
import sys
print("bpy.utils._register_module(): '%s' failed to register class '%s.%s'" % (sys.modules[module].__file__, t.__module__, t.__name__))
traceback.print_exc()
@ -595,7 +596,7 @@ class RNAMeta(type):
@classmethod
def _register_immediate(cls):
return _register_immediate
def __new__(cls, name, bases, classdict, **args):
result = type.__new__(cls, name, bases, classdict)
if bases and bases[0] != StructRNA:
@ -606,21 +607,23 @@ class RNAMeta(type):
# Register right away if needed
if cls._register_immediate():
bpy_types.register(result)
ClassMap = PropertiesMap
ClassMap = PropertiesMap
# first part of packages only
if "." in module:
module = module[:module.index(".")]
ClassMap.setdefault(module, []).append(result)
return result
class RNAMetaRegister(RNAMeta):
class RNAMetaRegister(RNAMeta, StructMetaIDProp):
@classmethod
def _register_immediate(cls):
return True
class OrderedMeta(RNAMeta):
def __init__(cls, name, bases, attributes):
@ -630,10 +633,19 @@ class OrderedMeta(RNAMeta):
def __prepare__(name, bases, **kwargs):
return collections.OrderedDict()
# Only defined so operators members can be used by accessing self.order
class Operator(StructRNA, metaclass=OrderedMeta):
__slots__ = ()
@classmethod
def easy_getsets(cls):
def bypass_attr(attr):
setattr(cls, attr, property(lambda self: getattr(self.properties, attr), lambda self, value: setattr(self.properties, attr, value)))
for attr, value in list(cls.__dict__.items()):
if type(value) == tuple and len(value) == 2 and type(value[1]) == dict:
bypass_attr(attr)
class Macro(StructRNA, metaclass=OrderedMeta):
# bpy_types is imported before ops is defined
@ -644,13 +656,16 @@ class Macro(StructRNA, metaclass=OrderedMeta):
def define(self, opname):
from _bpy import ops
return ops.macro_define(self, opname)
class IDPropertyGroup(StructRNA, metaclass=RNAMetaRegister):
__slots__ = ()
class RenderEngine(StructRNA, metaclass=RNAMeta):
__slots__ = ()
class _GenericUI:
__slots__ = ()

View File

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

View File

@ -32,7 +32,7 @@ _uilayout_tags = ["ui"] + \
# these need to be imported directly
# >>> 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):
@ -72,12 +72,12 @@ def _call_recursive(context, base, py_node):
value = eval(value, {"context": _bpy.context})
setattr(base, py_node[TAG], value)
else:
value = py_node[ARGS]['value'] # have to have this
value = py_node[ARGS]['value'] # have to have this
setattr(base, name, value)
else:
args = _parse_rna_args(base, py_node)
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:
for py_node_child in py_node[CHILDREN]:
_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 = '\n '.join(text_ls)
#text = text.replace('.', '.\n')
#text = text.replace(']', ']\n')
text = text.replace("\n", "\\n")
@ -88,7 +87,6 @@ def graph_armature(obj, filepath, FAKE_PARENT=True, CONSTRAINTS=True, DRIVERS=Tr
else:
opts.append("fillcolor=white")
fw('"%s" [%s];\n' % (bone.name, ','.join(opts)))
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)
rna_path_target = target.data_path
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_target = rna_path_target.replace("pose.bones", "")
if XTRA_INFO:

View File

@ -21,21 +21,22 @@
import bpy
from bpy.props import *
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'})
def invoke(self, context, event):
import os
if not self.properties.is_property_set("filepath"):
self.properties.filepath = os.path.splitext(context.blend_data.filepath)[0] + self.filename_ext
if not self.filepath:
self.filepath = os.path.splitext(context.blend_data.filepath)[0] + self.filename_ext
context.window_manager.add_fileselect(self)
return {'RUNNING_MODAL'}
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):
context.window_manager.add_fileselect(self)
@ -78,14 +79,15 @@ def free_derived_objects(ob):
def unpack_list(list_of_tuples):
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:
flat_list_extend(t)
return flat_list
# same as above except that it adds 0 for triangle faces
def unpack_face_list(list_of_tuples):
# allocate the entire list
#allocate the entire list
flat_ls = [0] * (len(list_of_tuples) * 4)
i = 0
@ -93,7 +95,7 @@ def unpack_face_list(list_of_tuples):
if len(t) == 3:
if t[2] == 0:
t = t[1], t[2], t[0]
else: # assuem quad
else: # assuem quad
if t[3] == 0 or t[2] == 0:
t = t[2], t[3], t[0], t[1]

View File

@ -77,7 +77,7 @@ def range_str(val):
def float_as_string(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'
return val_str
@ -194,20 +194,18 @@ class InfoPropertyRNA:
self.type = rna_prop.type.lower()
fixed_type = getattr(rna_prop, "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:
self.fixed_type = None
if self.type == "enum":
self.enum_items[:] = rna_prop.items.keys()
if self.array_length:
self.default = tuple(getattr(rna_prop, "default_array", ()))
else:
self.default = getattr(rna_prop, "default", None)
self.default_str = "" # fallback
self.default_str = "" # fallback
if self.type == "pointer":
# pointer has no default, just set as None
@ -231,7 +229,7 @@ class InfoPropertyRNA:
else:
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):
default = self.default_str
@ -275,7 +273,7 @@ class InfoPropertyRNA:
elif as_arg:
if not self.is_required:
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:
type_info.append("readonly")
@ -414,10 +412,10 @@ def BuildRNAInfo():
# Use for faster lookups
# use rna_struct.identifier as the key for each dict
rna_struct_dict = {} # store identifier:rna lookups
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_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_full_path_dict = {} # store the result of full_rna_struct_path(rna_struct)
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_functions_dict = {} # store all functions directly in this type (not inherited)
def full_rna_struct_path(rna_struct):
'''
@ -434,7 +432,7 @@ def BuildRNAInfo():
try:
return rna_struct.base.identifier
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()]
'''
@ -466,17 +464,13 @@ def BuildRNAInfo():
# NOT USED YET
## rna_functions_dict[identifier] = get_direct_functions(rna_struct)
# fill in these later
rna_children_dict[identifier] = []
rna_references_dict[identifier] = []
else:
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
deps_ok = False
@ -494,7 +488,7 @@ def BuildRNAInfo():
ok = False
while i < len(structs):
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
break
i += 1
@ -506,7 +500,6 @@ def BuildRNAInfo():
# Done ordering structs
# precalc vars to avoid a lot of looping
for (rna_base, identifier, rna_struct) in structs:
@ -536,18 +529,15 @@ def BuildRNAInfo():
if rna_prop_ptr:
rna_references_dict[rna_prop_ptr.identifier].append("%s.%s" % (rna_struct_path, rna_func.identifier))
# Store nested children
nested = rna_struct.nested
if nested:
rna_children_dict[nested.identifier].append(rna_struct)
# Sort the refs, just reads nicer
for rna_refs in rna_references_dict.values():
rna_refs.sort()
info_structs = []
for (rna_base, identifier, rna_struct) in structs:
#if rna_struct.nested:
@ -590,7 +580,6 @@ def BuildRNAInfo():
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))
# now for operators
op_mods = dir(bpy.ops)
@ -616,10 +605,8 @@ def BuildRNAInfo():
for rna_prop in rna_info.args:
rna_prop.build()
#for rna_info in InfoStructRNA.global_lookup.values():
# print(rna_info)
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]
data = []
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():
struct_id_str = base.identifier + "|" + struct_id_str
props = [(prop.identifier, prop) for prop in v.properties]
for prop_id, prop in sorted(props):
# if prop.type == 'boolean':

View File

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

View File

@ -592,7 +592,7 @@ class AddHuman(bpy.types.Operator):
bpy.ops.object.armature_add()
obj = context.active_object
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.remove(bones[0])
metarig_template()

View File

@ -107,17 +107,16 @@ class AddTorus(bpy.types.Operator):
rotation = FloatVectorProperty(name="Rotation")
def execute(self, context):
props = self.properties
if props.use_abso == True:
extra_helper = (props.abso_major_rad - props.abso_minor_rad) * 0.5
props.major_radius = props.abso_minor_rad + extra_helper
props.minor_radius = extra_helper
if self.use_abso == True:
extra_helper = (self.abso_major_rad - self.abso_minor_rad) * 0.5
self.major_radius = self.abso_minor_rad + extra_helper
self.minor_radius = extra_helper
verts_loc, faces = add_torus(props.major_radius,
props.minor_radius,
props.major_segments,
props.minor_segments)
verts_loc, faces = add_torus(self.major_radius,
self.minor_radius,
self.major_segments,
self.minor_segments)
mesh = bpy.data.meshes.new("Torus")

View File

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

View File

@ -39,7 +39,7 @@ class EditExternally(bpy.types.Operator):
# use image editor in the preferences when available.
if not image_editor:
if system == 'Windows':
image_editor = ["start"] # not tested!
image_editor = ["start"] # not tested!
elif system == 'Darwin':
image_editor = ["open"]
else:
@ -58,7 +58,7 @@ class EditExternally(bpy.types.Operator):
def execute(self, context):
import os
import subprocess
filepath = bpy.path.abspath(self.properties.filepath)
filepath = bpy.path.abspath(self.filepath)
if not os.path.exists(filepath):
self.report('ERROR', "Image path '%s' not found." % filepath)
@ -77,7 +77,7 @@ class EditExternally(bpy.types.Operator):
self.report({'ERROR'}, "Image not found on disk")
return {'CANCELLED'}
self.properties.filepath = filepath
self.filepath = filepath
self.execute(context)
return {'FINISHED'}
@ -116,7 +116,7 @@ class ProjectEdit(bpy.types.Operator):
import os
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:
image.tag = True
@ -159,7 +159,7 @@ class ProjectEdit(bpy.types.Operator):
image_new.name = os.path.basename(filepath_final)
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.save()
@ -175,7 +175,7 @@ class ProjectApply(bpy.types.Operator):
bl_options = {'REGISTER'}
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:
image = bpy.data.images[image_name]
@ -192,6 +192,7 @@ class ProjectApply(bpy.types.Operator):
def register():
pass
def unregister():
pass

View File

@ -44,21 +44,20 @@ class ExportPLY(bpy.types.Operator, ExportHelper):
return context.active_object != None
def execute(self, context):
filepath = self.properties.filepath
filepath = self.filepath
filepath = bpy.path.ensure_ext(filepath, self.filename_ext)
import io_mesh_ply.export_ply
return io_mesh_ply.export_ply.save(self, context, **self.properties)
def draw(self, context):
layout = self.layout
props = self.properties
row = layout.row()
row.prop(props, "use_modifiers")
row.prop(props, "use_normals")
row.prop(self.properties, "use_modifiers")
row.prop(self.properties, "use_normals")
row = layout.row()
row.prop(props, "use_uv_coords")
row.prop(props, "use_colors")
row.prop(self.properties, "use_uv_coords")
row.prop(self.properties, "use_colors")
def menu_func(self, context):

View File

@ -74,9 +74,6 @@ def unregister():
bpy.types.INFO_MT_file_import.remove(menu_func_import)
bpy.types.INFO_MT_file_export.remove(menu_func_export)
if __name__ == "__main__":
register()
# NOTES:
# why add 1 extra vertex? and remove it when done? - "Answer - eekadoodle - would need to re-order UV's without this since face order isnt always what we give blender, BMesh will solve :D"
# disabled scaling to size, this requires exposing bb (easy) and understanding how it works (needs some time)

View File

@ -34,7 +34,7 @@ class ExportFBX(bpy.types.Operator, ExportHelper):
'''Selection to an ASCII Autodesk FBX'''
bl_idname = "export_scene.fbx"
bl_label = "Export FBX"
filename_ext = ".fbx"
# 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_FILE_PREFIX = StringProperty(name="Prefix", description="Prefix each file with this name", maxlen=1024, default="")
def execute(self, context):
import math
from mathutils import Matrix
if not self.properties.filepath:
if not self.filepath:
raise Exception("filepath not set")
mtx4_x90n = Matrix.Rotation(-math.pi/2.0, 4, 'X')
mtx4_y90n = Matrix.Rotation(-math.pi/2.0, 4, 'Y')
mtx4_z90n = Matrix.Rotation(-math.pi/2.0, 4, 'Z')
mtx4_x90n = Matrix.Rotation(-math.pi / 2.0, 4, 'X')
mtx4_y90n = Matrix.Rotation(-math.pi / 2.0, 4, 'Y')
mtx4_z90n = Matrix.Rotation(-math.pi / 2.0, 4, 'Z')
GLOBAL_MATRIX = Matrix()
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_YROT90: GLOBAL_MATRIX = mtx4_y90n * GLOBAL_MATRIX
if self.properties.TX_ZROT90: GLOBAL_MATRIX = mtx4_z90n * GLOBAL_MATRIX
GLOBAL_MATRIX[0][0] = GLOBAL_MATRIX[1][1] = GLOBAL_MATRIX[2][2] = self.TX_SCALE
if self.TX_XROT90:
GLOBAL_MATRIX = mtx4_x90n * GLOBAL_MATRIX
if self.TX_YROT90:
GLOBAL_MATRIX = mtx4_y90n * GLOBAL_MATRIX
if self.TX_ZROT90:
GLOBAL_MATRIX = mtx4_z90n * GLOBAL_MATRIX
import io_scene_fbx.export_fbx
return io_scene_fbx.export_fbx.save(self, context, GLOBAL_MATRIX=GLOBAL_MATRIX, **self.properties)

View File

@ -57,17 +57,17 @@ class ImportOBJ(bpy.types.Operator, ImportHelper):
import io_scene_obj.import_obj
return io_scene_obj.import_obj.load(self, context, **self.properties)
'''
load_obj(self.properties.filepath,
load_obj(self.filepath,
context,
self.properties.CLAMP_SIZE,
self.properties.CREATE_FGONS,
self.properties.CREATE_SMOOTH_GROUPS,
self.properties.CREATE_EDGES,
self.properties.SPLIT_OBJECTS,
self.properties.SPLIT_GROUPS,
self.properties.ROTATE_X90,
self.properties.IMAGE_SEARCH,
self.properties.POLYGROUPS)
self.CLAMP_SIZE,
self.CREATE_FGONS,
self.CREATE_SMOOTH_GROUPS,
self.CREATE_EDGES,
self.SPLIT_OBJECTS,
self.SPLIT_GROUPS,
self.ROTATE_X90,
self.IMAGE_SEARCH,
self.POLYGROUPS)
'''
return {'FINISHED'}
@ -113,7 +113,7 @@ class ExportOBJ(bpy.types.Operator, ExportHelper):
def execute(self, context):
import io_scene_obj.export_obj
print(self.properties.keys())
print(self.keys())
return io_scene_obj.export_obj.save(self, context, **self.properties)

View File

@ -700,8 +700,10 @@ def create_mesh(new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_loc, v
del me_faces
# del ALPHA
if CREATE_EDGES:
if CREATE_EDGES and not edges:
CREATE_EDGES = False
if CREATE_EDGES:
me.edges.add(len(edges))
# edges should be a list of (a, b) tuples
@ -744,7 +746,7 @@ def create_mesh(new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_loc, v
# me_edges[ed].flag |= SHARP
# del SHARP
me.update()
me.update(calc_edges=CREATE_EDGES)
# me.calcNormals()
ob= bpy.data.objects.new("Mesh", me)

View File

@ -49,8 +49,8 @@ class ImportMDD(bpy.types.Operator, ImportHelper):
# initialize from scene if unset
scene = context.scene
if not self.properties.is_property_set("frame_start"):
self.properties.frame_start = scene.frame_current
if not self.frame_start:
self.frame_start = scene.frame_current
import io_shape_mdd.import_mdd
return io_shape_mdd.import_mdd.load(self, context, **self.properties)
@ -83,12 +83,12 @@ class ExportMDD(bpy.types.Operator, ExportHelper):
def execute(self, context):
# initialize from scene if unset
scene = context.scene
if not self.properties.is_property_set("frame_start"):
self.properties.frame_start = scene.frame_start
if not self.properties.is_property_set("frame_end"):
self.properties.frame_end = scene.frame_end
if not self.properties.is_property_set("fps"):
self.properties.fps = scene.render.fps
if not self.frame_start:
self.frame_start = scene.frame_start
if not self.frame_end:
self.frame_end = scene.frame_end
if not self.fps:
self.fps = scene.render.fps
import io_shape_mdd.export_mdd
return io_shape_mdd.export_mdd.save(self, context, **self.properties)

View File

@ -76,7 +76,7 @@ class MeshMirrorUV(bpy.types.Operator):
return (ob and ob.type == 'MESH')
def execute(self, context):
DIR = 1 # TODO, make an option
DIR = 1 # TODO, make an option
from mathutils import Vector
@ -111,7 +111,6 @@ class MeshMirrorUV(bpy.types.Operator):
if j is not None:
vmap[i] = j
active_uv_layer = None
for lay in mesh.uv_textures:
if lay.active:
@ -162,7 +161,6 @@ class MeshMirrorUV(bpy.types.Operator):
v1 = faces[j].vertices[:]
v2 = [vmap[k] for k in faces[i].vertices[:]]
for k in range(len(uv1)):
k_map = v1.index(v2[k])
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)
elif rotation_mode == 'AXIS_ANGLE':
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("scale", -1, f, name)
@ -148,9 +148,8 @@ class BakeAction(bpy.types.Operator):
default=True)
def execute(self, context):
props = self.properties
action = bake(props.frame_start, props.frame_end, props.step, props.show_only_selected)
action = bake(self.frame_start, self.frame_end, self.step, self.show_only_selected)
# basic cleanup, could move elsewhere
for fcu in action.fcurves:

View File

@ -36,7 +36,7 @@ class SelectPattern(bpy.types.Operator):
import fnmatch
if self.properties.case_sensitive:
if self.case_sensitive:
pattern_match = fnmatch.fnmatchcase
else:
pattern_match = lambda a, b: fnmatch.fnmatchcase(a.upper(), b.upper())
@ -51,9 +51,9 @@ class SelectPattern(bpy.types.Operator):
# Can be pose bones or objects
for item in items:
if pattern_match(item.name, self.properties.pattern):
if pattern_match(item.name, self.pattern):
item.select = True
elif not self.properties.extend:
elif not self.extend:
item.select = False
return {'FINISHED'}
@ -66,12 +66,11 @@ class SelectPattern(bpy.types.Operator):
def draw(self, context):
layout = self.layout
props = self.properties
layout.prop(props, "pattern")
layout.prop(self.properties, "pattern")
row = layout.row()
row.prop(props, "case_sensitive")
row.prop(props, "extend")
row.prop(self.properties, "case_sensitive")
row.prop(self.properties, "extend")
class SelectCamera(bpy.types.Operator):
@ -117,15 +116,14 @@ class SelectHierarchy(bpy.types.Operator):
def execute(self, context):
select_new = []
act_new = None
selected_objects = context.selected_objects
obj_act = context.object
if context.object not in selected_objects:
selected_objects.append(context.object)
if self.properties.direction == 'PARENT':
if self.direction == 'PARENT':
for obj in selected_objects:
parent = obj.parent
@ -145,7 +143,7 @@ class SelectHierarchy(bpy.types.Operator):
# dont edit any object settings above this
if select_new:
if not self.properties.extend:
if not self.extend:
bpy.ops.object.select_all(action='DESELECT')
for obj in select_new:
@ -153,7 +151,7 @@ class SelectHierarchy(bpy.types.Operator):
context.scene.objects.active = act_new
return {'FINISHED'}
return {'CANCELLED'}
@ -175,11 +173,11 @@ class SubdivisionSet(bpy.types.Operator):
return (obs is not None)
def execute(self, context):
level = self.properties.level
relative = self.properties.relative
level = self.level
relative = self.relative
if relative and level == 0:
return {'CANCELLED'} # nothing to do
return {'CANCELLED'} # nothing to do
def set_object_subd(obj):
for mod in obj.modifiers:
@ -253,7 +251,7 @@ class ShapeTransfer(bpy.types.Operator):
key = ob.add_shape_key(from_mix=False)
if len(me.shape_keys.keys) == 1:
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
ob.active_shape_key_index = len(me.shape_keys.keys) - 1
ob.show_shape_key = True
@ -345,7 +343,6 @@ class ShapeTransfer(bpy.types.Operator):
n1loc = v1 + orig_normals[i1] * edge_length
n2loc = v2 + orig_normals[i2] * edge_length
# now get the target nloc's
v1_to, v2_to = target_coords[i1], target_coords[i2]
edlen_to = (v1_to - v2_to).length
@ -392,7 +389,7 @@ class ShapeTransfer(bpy.types.Operator):
ob_act = C.active_object
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:
self.report({'ERROR'}, "Expected one other selected mesh object to copy from")
return {'CANCELLED'}
@ -405,7 +402,7 @@ class ShapeTransfer(bpy.types.Operator):
if ob_act.active_shape_key is None:
self.report({'ERROR'}, "Other object has no shape key")
return {'CANCELLED'}
return self._main(ob_act, objects, self.properties.mode, self.properties.use_clamp)
return self._main(ob_act, objects, self.mode, self.use_clamp)
class JoinUVs(bpy.types.Operator):
@ -432,7 +429,7 @@ class JoinUVs(bpy.types.Operator):
else:
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)
objects = context.selected_editable_objects[:]
@ -453,7 +450,7 @@ class JoinUVs(bpy.types.Operator):
else:
uv_other = mesh_other.uv_textures.active
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
uv_other.data.foreach_set("uv_raw", uv_array)
@ -487,7 +484,7 @@ class MakeDupliFace(bpy.types.Operator):
def matrix_to_quat(matrix):
# scale = matrix.median_scale
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]
scene = bpy.context.scene
@ -508,7 +505,7 @@ class MakeDupliFace(bpy.types.Operator):
mesh.vertices.foreach_set("co", face_verts)
mesh.faces.foreach_set("vertices_raw", faces)
mesh.update() # generates edge data
mesh.update() # generates edge data
# pick an object to use
obj = objects[0]
@ -552,7 +549,9 @@ class IsolateTypeRender(bpy.types.Operator):
obj.hide_render = True
return {'FINISHED'}
class ClearAllRestrictRender(bpy.types.Operator):
'''Reveal all render objects by setting the hide render flag'''
bl_idname = "object.hide_render_clear_all"
@ -561,7 +560,7 @@ class ClearAllRestrictRender(bpy.types.Operator):
def execute(self, context):
for obj in context.scene.objects:
obj.hide_render = False
obj.hide_render = False
return {'FINISHED'}

View File

@ -268,14 +268,7 @@ class AlignObjects(bpy.types.Operator):
return context.mode == 'OBJECT'
def execute(self, context):
align_mode = self.properties.align_mode
relative_to = self.properties.relative_to
align_x = self.properties.align_x
align_y = self.properties.align_y
align_z = self.properties.align_z
align_objects(align_x, align_y, align_z, align_mode, relative_to)
align_objects(self.align_x, self.align_y, self.align_z, self.align_mode, self.relative_to)
return {'FINISHED'}

View File

@ -36,10 +36,10 @@ def randomize_selected(seed, loc, rot, scale, scale_even, scale_min):
if 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)
if rot: # TODO, non euler's
if rot: # TODO, non euler's
vec = rand_vec(rot)
obj.rotation_euler[0] += vec[0]
obj.rotation_euler[1] += vec[1]
@ -119,14 +119,14 @@ class RandomizeLocRotSize(bpy.types.Operator):
def execute(self, context):
from math import radians
seed = self.properties.random_seed
seed = self.random_seed
loc = None if not self.properties.use_loc else self.properties.loc
rot = None if not self.properties.use_rot else self.properties.rot * radians(1.0)
scale = None if not self.properties.use_scale else self.properties.scale
loc = None if not self.use_loc else self.loc
rot = None if not self.use_rot else self.rot * radians(1.0)
scale = None if not self.use_scale else self.scale
scale_even = self.properties.scale_even
scale_min = self.properties.scale_min
scale_even = self.scale_even
scale_min = self.scale_min
randomize_selected(seed, loc, rot, scale, scale_even, scale_min)

View File

@ -32,23 +32,23 @@ class AddPresetBase():
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 " !@#$%^&*(){}:\";'[]<>,./?":
name = name.replace('.', '_')
return name.lower()
def execute(self, context):
if not self.properties.name:
if not self.name:
return {'FINISHED'}
filename = self._as_filename(self.properties.name) + ".py"
filename = self._as_filename(self.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)
if getattr(self, "save_keyconfig", False):
bpy.ops.wm.keyconfig_export(filepath=filepath, kc_name=self.properties.name)
bpy.ops.wm.keyconfig_export(filepath=filepath, kc_name=self.name)
file_preset = open(filepath, 'a')
file_preset.write("wm.keyconfigs.active = kc\n\n")
else:
@ -83,11 +83,11 @@ class ExecutePreset(bpy.types.Operator):
def execute(self, context):
# change the menu title to the most recently chosen option
preset_class = getattr(bpy.types, self.properties.menu_idname)
preset_class.bl_label = self.properties.preset_name
preset_class = getattr(bpy.types, self.menu_idname)
preset_class.bl_label = self.preset_name
# execute the preset using script.python_file_run
bpy.ops.script.python_file_run(filepath=self.properties.filepath)
bpy.ops.script.python_file_run(filepath=self.filepath)
return {'FINISHED'}
@ -203,6 +203,7 @@ class AddPresetInteraction(AddPresetBase, bpy.types.Operator):
preset_subdir = "interaction"
def register():
pass

View File

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

View File

@ -92,7 +92,7 @@ class SequencerCutMulticam(bpy.types.Operator):
return False
def execute(self, context):
camera = self.properties.camera
camera = self.camera
s = context.scene.sequence_editor.active_strip

View File

@ -21,6 +21,218 @@
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')
fw('<svg width="%dpx" height="%dpx" viewBox="0px 0px %dpx %dpx"\n' % (image_width, image_height, image_width, image_height))
fw(' xmlns="http://www.w3.org/2000/svg" version="1.1">\n')
desc = "%r, %s, (Blender %s)" % (basename(bpy.data.filepath), mesh.name, bpy.app.version_string)
fw('<desc>%s</desc>\n' % escape(desc))
# svg colors
fill_settings = []
fill_default = 'fill="grey"'
for mat in mesh.materials if mesh.materials else [None]:
if mat:
fill_settings.append('fill="rgb(%d, %d, %d)"' % tuple(int(c * 255) for c in mat.diffuse_color))
else:
fill_settings.append(fill_default)
faces = mesh.faces
for i, uvs in face_iter:
try: # rare cases material index is invalid.
fill = fill_settings[faces[i].material_index]
except IndexError:
fill = fill_default
fw('<polygon %s fill-opacity="0.5" stroke="black" stroke-width="1px" \n' % fill)
fw(' points="')
for j, uv in enumerate(uvs):
x, y = uv[0], 1.0 - uv[1]
fw('%.3f,%.3f ' % (x * image_width, y * image_height))
fw('" />\n')
fw('\n')
fw('</svg>\n')
def write_eps(fw, mesh, image_width, image_height, face_iter):
fw('%!PS-Adobe-3.0 EPSF-3.0\n')
fw("%%%%Creator: Blender %s\n" % bpy.app.version_string)
fw('%%Pages: 1\n')
fw('%%Orientation: Portrait\n')
fw("%%%%BoundingBox: 0 0 %d %d\n" % (image_width, image_height))
fw("%%%%HiResBoundingBox: 0.0 0.0 %.4f %.4f\n" % (image_width, image_height))
fw('%%EndComments\n')
fw('%%Page: 1 1\n')
fw('0 0 translate\n')
fw('1.0 1.0 scale\n')
fw('0 0 0 setrgbcolor\n')
fw('[] 0 setdash\n')
fw('1 setlinewidth\n')
fw('1 setlinejoin\n')
fw('1 setlinecap\n')
fw('/DRAW {')
# can remove from here to next comment to disable filling, aparently alpha is not supported
fw('gsave\n')
fw('0.7 setgray\n')
fw('fill\n')
fw('grestore\n')
fw('0 setgray\n')
# remove to here
fw('stroke\n')
fw('} def\n')
fw('newpath\n')
firstline = True
for i, uvs in face_iter:
for j, uv in enumerate(uvs):
x, y = uv[0], uv[1]
if j == 0:
if not firstline:
fw('closepath\n')
fw('DRAW\n')
fw('newpath\n')
firstline = False
fw('%.5f %.5f moveto\n' % (x * image_width, y * image_height))
else:
fw('%.5f %.5f lineto\n' % (x * image_width, y * image_height))
fw('closepath\n')
fw('DRAW\n')
fw('showpage\n')
fw('%%EOF\n')
def write_png(fw, mesh_source, image_width, image_height, face_iter):
filepath = fw.__self__.name
fw.__self__.close()
material_solids = [bpy.data.materials.new("uv_temp_solid") for i in range(len(mesh_source.materials))]
material_wire = bpy.data.materials.new("uv_temp_wire")
scene = bpy.data.scenes.new("uv_temp")
mesh = bpy.data.meshes.new("uv_temp")
for mat_solid in material_solids:
mesh.materials.append(mat_solid)
tot_verts = 0
face_lens = []
for f in mesh_source.faces:
tot_verts += len(f.vertices)
# now set the faces coords and locations
# build mesh data
mesh_new_vertices = []
mesh_new_materials = []
mesh_new_face_vertices = []
current_vert = 0
faces_source = mesh_source.faces
for i, uv in face_iter:
if len(uv) == 3:
mesh_new_vertices.extend([uv[0][0], uv[0][1], 0.0, uv[1][0], uv[1][1], 0.0, uv[2][0], uv[2][1], 0.0])
mesh_new_face_vertices.extend([current_vert, current_vert + 1, current_vert + 2, 0])
current_vert += 3
else:
mesh_new_vertices.extend([uv[0][0], uv[0][1], 0.0, uv[1][0], uv[1][1], 0.0, uv[2][0], uv[2][1], 0.0, uv[3][0], uv[3][1], 0.0])
mesh_new_face_vertices.extend([current_vert, current_vert + 1, current_vert + 2, current_vert + 3])
current_vert += 4
mesh_new_materials.append(faces_source[i].material_index)
mesh.vertices.add(len(mesh_new_vertices) // 3)
mesh.faces.add(len(mesh_new_face_vertices) // 4)
mesh.vertices.foreach_set("co", mesh_new_vertices)
mesh.faces.foreach_set("vertices_raw", mesh_new_face_vertices)
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)
base_wire = scene.objects.link(obj_wire)
base_solid.layers[0] = True
base_wire.layers[0] = True
# 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'
cam.ortho_scale = 1.0
obj_cam = bpy.data.objects.new("uv_temp_cam", cam)
obj_cam.location = 0.5, 0.5, 1.0
scene.objects.link(obj_cam)
scene.camera = obj_cam
# setup materials
for i, mat_solid in enumerate(material_solids):
mat_solid.diffuse_color = mesh_source.materials[i].diffuse_color
mat_solid.use_shadeless = True
mat_solid.use_transparency = True
mat_solid.alpha = 0.25
material_wire.type = 'WIRE'
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'
scene.render.color_mode = 'RGBA'
scene.render.resolution_x = image_width
scene.render.resolution_y = image_height
scene.render.resolution_percentage = 100
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.frame_start = 1
scene.frame_end = 1
scene.render.file_format = 'PNG'
scene.render.filepath = filepath
data_context = {"blend_data": bpy.context.blend_data, "scene": scene}
bpy.ops.render.render(data_context, animation=True)
# stupid
import os
animpath = scene.render.frame_path(1)
os.rename(animpath, os.path.abspath(filepath))
# cleanup
bpy.data.scenes.remove(scene)
bpy.data.objects.remove(obj_cam)
bpy.data.objects.remove(obj_solid)
bpy.data.objects.remove(obj_wire)
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 the Mesh as SVG'''
@ -29,15 +241,17 @@ class ExportUVLayout(bpy.types.Operator):
bl_label = "Export UV Layout"
bl_options = {'REGISTER', 'UNDO'}
filepath = StringProperty(name="File Path", description="File path used for exporting the SVG file", maxlen=1024, default="")
filepath = StringProperty(name="File Path", description="File path used for exporting the SVG 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'})
export_all = BoolProperty(name="All UV's", description="Export all UVs in this mesh (not just the visible ones)", default=False)
mode = EnumProperty(items=(
('SVG', "Scalable Vector Graphic (.svg)", "Export the UV layout to a vector SVG file"),
('EPS', "Encapsulate PostScript (.eps)", "Export the UV layout to a vector EPS file")),
('EPS', "Encapsulate PostScript (.eps)", "Export the UV layout to a vector EPS file"),
('PNG', "PNG Image (.png)", "Export the UV layout a bitmap image")),
name="Format",
description="File format to export the UV layout to",
default='SVG')
default='PNG')
size = IntVectorProperty(size=2, default=(1024, 1024), min=8, max=32768)
@classmethod
def poll(cls, context):
@ -72,7 +286,7 @@ class ExportUVLayout(bpy.types.Operator):
uv_layer = mesh.uv_textures.active.data
uv_layer_len = len(uv_layer)
if not self.properties.export_all:
if not self.export_all:
local_image = Ellipsis
@ -99,107 +313,30 @@ class ExportUVLayout(bpy.types.Operator):
yield (i, uv_layer[i].uv)
def execute(self, context):
# for making an XML compatible string
from xml.sax.saxutils import escape
from os.path import basename
obj = context.active_object
is_editmode = (obj.mode == 'EDIT')
if is_editmode:
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
image_width, image_height = self._image_size(context)
mesh = obj.data
faces = mesh.faces
mode = self.properties.mode
mode = self.mode
filepath = self.properties.filepath
filepath = self.filepath
filepath = bpy.path.ensure_ext(filepath, "." + mode.lower())
file = open(filepath, "w")
fw = file.write
if mode == 'SVG':
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')
fw('<svg width="%dpx" height="%dpx" viewBox="0px 0px %dpx %dpx"\n' % (image_width, image_height, image_width, image_height))
fw(' xmlns="http://www.w3.org/2000/svg" version="1.1">\n')
desc = "%s, %s, %s (Blender %s)" % (basename(bpy.data.filepath), obj.name, mesh.name, bpy.app.version_string)
fw('<desc>%s</desc>\n' % escape(desc))
# svg colors
fill_settings = []
fill_default = 'fill="grey"'
for mat in mesh.materials if mesh.materials else [None]:
if mat:
fill_settings.append('fill="rgb(%d, %d, %d)"' % tuple(int(c * 255) for c in mat.diffuse_color))
else:
fill_settings.append(fill_default)
for i, uvs in self._face_uv_iter(context):
try: # rare cases material index is invalid.
fill = fill_settings[faces[i].material_index]
except IndexError:
fill = fill_default
fw('<polygon %s fill-opacity="0.5" stroke="black" stroke-width="1px" \n' % fill)
fw(' points="')
for j, uv in enumerate(uvs):
x, y = uv[0], 1.0 - uv[1]
fw('%.3f,%.3f ' % (x * image_width, y * image_height))
fw('" />\n')
fw('\n')
fw('</svg>\n')
func = write_svg
elif mode == 'EPS':
fw('%!PS-Adobe-3.0 EPSF-3.0\n')
fw("%%%%Creator: Blender %s\n" % bpy.app.version_string)
fw('%%Pages: 1\n')
fw('%%Orientation: Portrait\n')
fw("%%%%BoundingBox: 0 0 %d %d\n" % (image_width, image_height))
fw("%%%%HiResBoundingBox: 0.0 0.0 %.4f %.4f\n" % (image_width, image_height))
fw('%%EndComments\n')
fw('%%Page: 1 1\n')
fw('0 0 translate\n')
fw('1.0 1.0 scale\n')
fw('0 0 0 setrgbcolor\n')
fw('[] 0 setdash\n')
fw('1 setlinewidth\n')
fw('1 setlinejoin\n')
fw('1 setlinecap\n')
fw('/DRAW {')
# can remove from here to next comment to disable filling, aparently alpha is not supported
fw('gsave\n')
fw('0.7 setgray\n')
fw('fill\n')
fw('grestore\n')
fw('0 setgray\n')
# remove to here
fw('stroke\n')
fw('} def\n')
fw('newpath\n')
func = write_eps
elif mode == 'PNG':
func = write_png
firstline = True
for i, uvs in self._face_uv_iter(context):
for j, uv in enumerate(uvs):
x, y = uv[0], uv[1]
if j == 0:
if not firstline:
fw('closepath\n')
fw('DRAW\n')
fw('newpath\n')
firstline = False
fw('%.5f %.5f moveto\n' % (x * image_width, y * image_height))
else:
fw('%.5f %.5f lineto\n' % (x * image_width, y * image_height))
fw('closepath\n')
fw('DRAW\n')
fw('showpage\n')
fw('%%EOF\n')
func(fw, mesh, self.size[0], self.size[1], self._face_uv_iter(context))
if is_editmode:
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
@ -207,15 +344,14 @@ class ExportUVLayout(bpy.types.Operator):
return {'FINISHED'}
def invoke(self, context, event):
self.size = self._image_size(context)
wm = context.window_manager
wm.add_fileselect(self)
return {'RUNNING_MODAL'}
def menu_func(self, context):
import os
default_path = os.path.splitext(bpy.data.filepath)[0] + ".svg"
self.layout.operator(ExportUVLayout.bl_idname).filepath = default_path
self.layout.operator(ExportUVLayout.bl_idname)
def register():

View File

@ -1129,7 +1129,7 @@ class SmartProject(bpy.types.Operator):
return context.active_object != None
def execute(self, context):
main(context, self.properties.island_margin, self.properties.angle_limit)
main(context, self.island_margin, self.angle_limit)
return {'FINISHED'}

View File

@ -172,7 +172,7 @@ class VertexPaintDirt(bpy.types.Operator):
t = time.time()
applyVertexDirt(mesh, self.properties.blur_iterations, self.properties.blur_strength, math.radians(self.properties.dirt_angle), math.radians(self.properties.clean_angle), self.properties.dirt_only)
applyVertexDirt(mesh, self.blur_iterations, self.blur_strength, math.radians(self.dirt_angle), math.radians(self.clean_angle), self.dirt_only)
print('Dirt calculated in %.6f' % (time.time() - t))

View File

@ -23,6 +23,7 @@ import bpy
from bpy.props import *
from rna_prop_ui import rna_idprop_ui_prop_get, rna_idprop_ui_prop_clear
class MESH_OT_delete_edgeloop(bpy.types.Operator):
'''Delete an edge loop by merging the faces on each side to a single face loop'''
bl_idname = "mesh.delete_edgeloop"
@ -62,13 +63,13 @@ def context_path_validate(context, data_path):
def execute_context_assign(self, context):
if context_path_validate(context, self.properties.data_path) is Ellipsis:
if context_path_validate(context, self.data_path) is Ellipsis:
return {'PASS_THROUGH'}
if getattr(self.properties, "relative", False):
exec("context.%s+=self.properties.value" % self.properties.data_path)
if getattr(self, "relative", False):
exec("context.%s+=self.value" % self.data_path)
else:
exec("context.%s=self.properties.value" % self.properties.data_path)
exec("context.%s=self.value" % self.data_path)
return {'FINISHED'}
@ -86,7 +87,7 @@ class WM_OT_context_set_boolean(bpy.types.Operator):
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.'''
bl_idname = "wm.context_set_int"
bl_label = "Context Set"
@ -99,7 +100,7 @@ class WM_OT_context_set_int(bpy.types.Operator): # same as enum
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.'''
bl_idname = "wm.context_scale_int"
bl_label = "Context Set"
@ -112,16 +113,16 @@ class WM_OT_context_scale_int(bpy.types.Operator): # same as enum
default=True)
def execute(self, context):
if context_path_validate(context, self.properties.data_path) is Ellipsis:
if context_path_validate(context, self.data_path) is Ellipsis:
return {'PASS_THROUGH'}
value = self.properties.value
data_path = self.properties.data_path
value = self.value
data_path = self.data_path
if value == 1.0: # nothing to do
if value == 1.0: # nothing to do
return {'CANCELLED'}
if getattr(self.properties, "always_step", False):
if getattr(self, "always_step", False):
if value > 1.0:
add = "1"
func = "max"
@ -130,12 +131,12 @@ class WM_OT_context_scale_int(bpy.types.Operator): # same as enum
func = "min"
exec("context.%s = %s(round(context.%s * value), context.%s + %s)" % (data_path, func, data_path, data_path, add))
else:
exec("context.%s *= value" % self.properties.data_path)
exec("context.%s *= value" % self.data_path)
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.'''
bl_idname = "wm.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
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.'''
bl_idname = "wm.context_set_string"
bl_label = "Context Set String"
@ -188,9 +189,9 @@ class WM_OT_context_set_value(bpy.types.Operator):
maxlen=1024, default="")
def execute(self, context):
if context_path_validate(context, self.properties.data_path) is Ellipsis:
if context_path_validate(context, self.data_path) is Ellipsis:
return {'PASS_THROUGH'}
exec("context.%s=%s" % (self.properties.data_path, self.properties.value))
exec("context.%s=%s" % (self.data_path, self.value))
return {'FINISHED'}
@ -204,11 +205,11 @@ class WM_OT_context_toggle(bpy.types.Operator):
def execute(self, context):
if context_path_validate(context, self.properties.data_path) is Ellipsis:
if context_path_validate(context, self.data_path) is Ellipsis:
return {'PASS_THROUGH'}
exec("context.%s=not (context.%s)" %
(self.properties.data_path, self.properties.data_path))
(self.data_path, self.data_path))
return {'FINISHED'}
@ -228,13 +229,13 @@ class WM_OT_context_toggle_enum(bpy.types.Operator):
def execute(self, context):
if context_path_validate(context, self.properties.data_path) is Ellipsis:
if context_path_validate(context, self.data_path) is Ellipsis:
return {'PASS_THROUGH'}
exec("context.%s = ['%s', '%s'][context.%s!='%s']" % \
(self.properties.data_path, self.properties.value_1,\
self.properties.value_2, self.properties.data_path,
self.properties.value_2))
(self.data_path, self.value_1,\
self.value_2, self.data_path,
self.value_2))
return {'FINISHED'}
@ -250,12 +251,12 @@ class WM_OT_context_cycle_int(bpy.types.Operator):
reverse = rna_reverse_prop
def execute(self, context):
data_path = self.properties.data_path
data_path = self.data_path
value = context_path_validate(context, data_path)
if value is Ellipsis:
return {'PASS_THROUGH'}
if self.properties.reverse:
if self.reverse:
value -= 1
else:
value += 1
@ -264,7 +265,7 @@ class WM_OT_context_cycle_int(bpy.types.Operator):
if value != eval("context.%s" % data_path):
# relies on rna clamping int's out of the range
if self.properties.reverse:
if self.reverse:
value = (1 << 32)
else:
value = - (1 << 32)
@ -285,14 +286,14 @@ class WM_OT_context_cycle_enum(bpy.types.Operator):
def execute(self, context):
value = context_path_validate(context, self.properties.data_path)
value = context_path_validate(context, self.data_path)
if value is Ellipsis:
return {'PASS_THROUGH'}
orig_value = value
# Have to get rna enum values
rna_struct_str, rna_prop_str = self.properties.data_path.rsplit('.', 1)
rna_struct_str, rna_prop_str = self.data_path.rsplit('.', 1)
i = rna_prop_str.find('[')
# just incse we get "context.foo.bar[0]"
@ -310,11 +311,11 @@ class WM_OT_context_cycle_enum(bpy.types.Operator):
orig_index = enums.index(orig_value)
# Have the info we need, advance to the next item
if self.properties.reverse:
if self.reverse:
if orig_index == 0:
advance_enum = enums[-1]
else:
advance_enum = enums[orig_index-1]
advance_enum = enums[orig_index - 1]
else:
if orig_index == len(enums) - 1:
advance_enum = enums[0]
@ -322,7 +323,35 @@ class WM_OT_context_cycle_enum(bpy.types.Operator):
advance_enum = enums[orig_index + 1]
# set the new value
exec("context.%s=advance_enum" % self.properties.data_path)
exec("context.%s=advance_enum" % self.data_path)
return {'FINISHED'}
class WM_OT_context_cycle_array(bpy.types.Operator):
'''Set a context array value.
Useful for cycling the active mesh edit mode.'''
bl_idname = "wm.context_cycle_array"
bl_label = "Context Array Cycle"
bl_options = {'UNDO'}
data_path = rna_path_prop
reverse = rna_reverse_prop
def execute(self, context):
data_path = self.data_path
value = context_path_validate(context, data_path)
if value is Ellipsis:
return {'PASS_THROUGH'}
def cycle(array):
if self.reverse:
array.insert(0, array.pop())
else:
array.append(array.pop(0))
return array
exec("context.%s=cycle(context.%s[:])" % (data_path, data_path))
return {'FINISHED'}
@ -337,8 +366,8 @@ class WM_OT_context_set_id(bpy.types.Operator):
description="Assign value", maxlen=1024, default="")
def execute(self, context):
value = self.properties.value
data_path = self.properties.data_path
value = self.value
data_path = self.data_path
# match the pointer type from the target property to bpy.data.*
# so we lookup the correct list.
@ -380,8 +409,8 @@ class WM_OT_context_modal_mouse(bpy.types.Operator):
initial_x = IntProperty(options={'HIDDEN'})
def _values_store(self, context):
data_path_iter = self.properties.data_path_iter
data_path_item = self.properties.data_path_item
data_path_iter = self.data_path_iter
data_path_item = self.data_path_item
self._values = values = {}
@ -400,11 +429,11 @@ class WM_OT_context_modal_mouse(bpy.types.Operator):
values[item] = value_orig
def _values_delta(self, delta):
delta *= self.properties.input_scale
if self.properties.invert:
delta *= self.input_scale
if self.invert:
delta = - delta
data_path_item = self.properties.data_path_item
data_path_item = self.data_path_item
for item, value_orig in self._values.items():
if type(value_orig) == int:
exec("item.%s = int(%d)" % (data_path_item, round(value_orig + delta)))
@ -412,7 +441,7 @@ class WM_OT_context_modal_mouse(bpy.types.Operator):
exec("item.%s = %f" % (data_path_item, value_orig + delta))
def _values_restore(self):
data_path_item = self.properties.data_path_item
data_path_item = self.data_path_item
for item, value_orig in self._values.items():
exec("item.%s = %s" % (data_path_item, value_orig))
@ -425,7 +454,7 @@ class WM_OT_context_modal_mouse(bpy.types.Operator):
event_type = event.type
if event_type == 'MOUSEMOVE':
delta = event.mouse_x - self.properties.initial_x
delta = event.mouse_x - self.initial_x
self._values_delta(delta)
elif 'LEFTMOUSE' == event_type:
@ -443,11 +472,11 @@ class WM_OT_context_modal_mouse(bpy.types.Operator):
if not self._values:
self.report({'WARNING'}, "Nothing to operate on: %s[ ].%s" %
(self.properties.data_path_iter, self.properties.data_path_item))
(self.data_path_iter, self.data_path_item))
return {'CANCELLED'}
else:
self.properties.initial_x = event.mouse_x
self.initial_x = event.mouse_x
context.window_manager.add_modal_handler(self)
return {'RUNNING_MODAL'}
@ -462,7 +491,7 @@ class WM_OT_url_open(bpy.types.Operator):
def execute(self, context):
import webbrowser
webbrowser.open(self.properties.url)
webbrowser.open(self.url)
return {'FINISHED'}
@ -478,7 +507,7 @@ class WM_OT_path_open(bpy.types.Operator):
import os
import subprocess
filepath = bpy.path.abspath(self.properties.filepath)
filepath = bpy.path.abspath(self.filepath)
filepath = os.path.normpath(filepath)
if not os.path.exists(filepath):
@ -516,10 +545,10 @@ class WM_OT_doc_view(bpy.types.Operator):
return '.'.join([class_obj.identifier for class_obj in ls])
def execute(self, context):
id_split = self.properties.doc_id.split('.')
if len(id_split) == 1: # rna, class
id_split = self.doc_id.split('.')
if len(id_split) == 1: # rna, class
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
if hasattr(bpy.types, class_name.upper() + '_OT_' + class_prop):
@ -562,8 +591,8 @@ class WM_OT_doc_edit(bpy.types.Operator):
def execute(self, context):
doc_id = self.properties.doc_id
doc_new = self.properties.doc_new
doc_id = self.doc_id
doc_new = self.doc_new
class_name, class_prop = doc_id.split('.')
@ -603,7 +632,7 @@ class WM_OT_doc_edit(bpy.types.Operator):
def draw(self, context):
layout = self.layout
props = self.properties
props = self
layout.label(text="Descriptor ID: '%s'" % props.doc_id)
layout.prop(props, "doc_new", text="")
@ -641,9 +670,9 @@ class WM_OT_properties_edit(bpy.types.Operator):
description = StringProperty(name="Tip", default="")
def execute(self, context):
data_path = self.properties.data_path
value = self.properties.value
prop = self.properties.property
data_path = self.data_path
value = self.value
prop = self.property
prop_old = self._last_prop[0]
try:
@ -659,7 +688,6 @@ class WM_OT_properties_edit(bpy.types.Operator):
# print(exec_str)
exec(exec_str)
# Reassign
exec_str = "item['%s'] = %s" % (prop, repr(value_eval))
# print(exec_str)
@ -672,25 +700,25 @@ class WM_OT_properties_edit(bpy.types.Operator):
if prop_type in (float, int):
prop_ui['soft_min'] = prop_ui['min'] = prop_type(self.properties.min)
prop_ui['soft_max'] = prop_ui['max'] = prop_type(self.properties.max)
prop_ui['soft_min'] = prop_ui['min'] = prop_type(self.min)
prop_ui['soft_max'] = prop_ui['max'] = prop_type(self.max)
prop_ui['description'] = self.properties.description
prop_ui['description'] = self.description
return {'FINISHED'}
def invoke(self, context, event):
self._last_prop = [self.properties.property]
self._last_prop = [self.property]
item = eval("context.%s" % self.properties.data_path)
item = eval("context.%s" % self.data_path)
# 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.property, False) # dont create
if prop_ui:
self.properties.min = prop_ui.get("min", -1000000000)
self.properties.max = prop_ui.get("max", 1000000000)
self.properties.description = prop_ui.get("description", "")
self.min = prop_ui.get("min", -1000000000)
self.max = prop_ui.get("max", 1000000000)
self.description = prop_ui.get("description", "")
wm = context.window_manager
# This crashes, TODO - fix
@ -708,7 +736,7 @@ class WM_OT_properties_add(bpy.types.Operator):
data_path = rna_path
def execute(self, context):
item = eval("context.%s" % self.properties.data_path)
item = eval("context.%s" % self.data_path)
def unique_name(names):
prop = 'prop'
@ -735,10 +763,11 @@ class WM_OT_properties_remove(bpy.types.Operator):
property = rna_property
def execute(self, context):
item = eval("context.%s" % self.properties.data_path)
del item[self.properties.property]
item = eval("context.%s" % self.data_path)
del item[self.property]
return {'FINISHED'}
def register():
pass

View File

@ -33,7 +33,7 @@ class ExportSomeData(bpy.types.Operator):
#if not self.is_property_set("filepath"):
# raise Exception("filename not set")
write_some_data(self.properties.filepath, context, self.properties.use_setting)
write_some_data(self.filepath, context, self.use_setting)
return {'FINISHED'}

View File

@ -11,14 +11,14 @@ class ModalOperator(bpy.types.Operator):
def modal(self, context, event):
if event.type == 'MOUSEMOVE':
delta = self.properties.first_mouse_x - event.mouse_x
context.object.location.x = self.properties.first_value + delta * 0.01
delta = self.first_mouse_x - event.mouse_x
context.object.location.x = self.first_value + delta * 0.01
elif event.type == 'LEFTMOUSE':
return {'FINISHED'}
elif event.type in ('RIGHTMOUSE', 'ESC'):
context.object.location.x = self.properties.first_value
context.object.location.x = self.first_value
return {'CANCELLED'}
return {'RUNNING_MODAL'}
@ -26,8 +26,8 @@ class ModalOperator(bpy.types.Operator):
def invoke(self, context, event):
if context.object:
context.window_manager.add_modal_handler(self)
self.properties.first_mouse_x = event.mouse_x
self.properties.first_value = context.object.location.x
self.first_mouse_x = event.mouse_x
self.first_value = context.object.location.x
return {'RUNNING_MODAL'}
else:
self.report({'WARNING'}, "No active object, could not finish")

View File

@ -14,14 +14,14 @@ class ViewOperator(bpy.types.Operator):
v3d = context.space_data
rv3d = v3d.region_3d
rv3d.view_location = self._initial_location + Vector(self.properties.offset)
rv3d.view_location = self._initial_location + Vector(self.offset)
def modal(self, context, event):
v3d = context.space_data
rv3d = v3d.region_3d
if event.type == 'MOUSEMOVE':
self.properties.offset = (self._initial_mouse - Vector((event.mouse_x, event.mouse_y, 0.0))) * 0.02
self.offset = (self._initial_mouse - Vector((event.mouse_x, event.mouse_y, 0.0))) * 0.02
self.execute(context)
elif event.type == 'LEFTMOUSE':

View File

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

View File

@ -149,7 +149,7 @@ class DATA_PT_bone_groups(ArmatureButtonsPanel, bpy.types.Panel):
sub = row.row(align=True)
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.operator("pose.group_select", text="Select")
@ -219,7 +219,6 @@ class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(itasc, "iterations")
if simulation:
layout.prop(itasc, "use_auto_step")
row = layout.row()
@ -240,6 +239,7 @@ class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, bpy.types.Panel):
from properties_animviz import MotionPathButtonsPanel, OnionSkinButtonsPanel
class DATA_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
#bl_label = "Bones Motion Paths"
bl_context = "data"
@ -267,7 +267,7 @@ class DATA_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
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_context = "data"
@ -288,6 +288,7 @@ class DATA_PT_custom_props_arm(ArmatureButtonsPanel, PropertyPanel, bpy.types.Pa
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
def register():
pass

View File

@ -18,14 +18,17 @@
# <pep8 compliant>
import bpy
class PoseTemplateSettings(bpy.types.IDPropertyGroup):
pass
from bpy.props import *
class PoseTemplate(bpy.types.IDPropertyGroup):
pass
name = StringProperty(name="Name of the slave", description="", maxlen=64, default="")
class PoseTemplateSettings(bpy.types.IDPropertyGroup):
templates = CollectionProperty(type=PoseTemplate, name="Templates", description="")
active_template_index = IntProperty(name="Index of the active slave", description="", default=-1, min=-1, max=65535)
use_generate_deform_rig = BoolProperty(name="Create Deform Rig", description="Create a copy of the metarig, constrainted by the generated rig", default=False)
def metarig_templates():
@ -98,16 +101,12 @@ class DATA_PT_template(bpy.types.Panel):
if self.templates:
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="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.operator("pose.metarig_reload", icon="FILE_REFRESH", text="")
# operators
from bpy.props import StringProperty
class Reload(bpy.types.Operator):
'''Re-Scan the metarig package directory for scripts'''
@ -136,7 +135,7 @@ def rigify_report_exception(operator, exception):
message.append("Incorrect armature for type '%s'" % fn)
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))
@ -188,8 +187,8 @@ class Sample(bpy.types.Operator):
def execute(self, context):
import rigify
reload(rigify)
final = (self.properties.metarig_type == "")
objects = rigify.generate_test(context, metarig_type=self.properties.metarig_type, GENERATE_FINAL=final)
final = (self.metarig_type == "")
objects = rigify.generate_test(context, metarig_type=self.metarig_type, GENERATE_FINAL=final)
if len(objects) > 1:
for i, (obj_meta, obj_gen) in enumerate(objects):
@ -239,7 +238,7 @@ class AsScript(bpy.types.Operator):
reload(rigify_utils)
obj = context.object
code = rigify_utils.write_meta_rig(obj)
path = self.properties.filepath
path = self.filepath
file = open(path, "w")
file.write(code)
file.close()
@ -249,7 +248,7 @@ class AsScript(bpy.types.Operator):
def invoke(self, context, event):
import os
obj = context.object
self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.path.clean_name(obj.name) + ".py"
self.filepath = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.path.clean_name(obj.name) + ".py"
wm = context.window_manager
wm.add_fileselect(self)
return {'RUNNING_MODAL'}
@ -310,37 +309,16 @@ 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
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():
PoseTemplate.StringProperty(attr="name",
name="Name of the slave",
description="",
maxlen=64,
default="")
PoseTemplateSettings.CollectionProperty(attr="templates", type=PoseTemplate, name="Templates", description="")
PoseTemplateSettings.IntProperty(attr="active_template_index",
name="Index of the active slave",
description="",
default=-1,
min=-1,
max=65535)
PoseTemplateSettings.BoolProperty(attr="use_generate_deform_rig",
name="Create Deform Rig",
description="Create a copy of the metarig, constrainted by the generated rig",
default=False)
bpy.types.Scene.PointerProperty(attr="pose_templates", type=PoseTemplateSettings, name="Pose Templates", description="Pose Template Settings")
bpy.types.Scene.pose_templates = PointerProperty(type=PoseTemplateSettings, name="Pose Templates", description="Pose Template Settings")
space_info.INFO_MT_armature_add.append(menu_func)
def unregister():
bpy.types.Scene.RemoveProperty("pose_templates")
del bpy.types.Scene.pose_templates
space_info.INFO_MT_armature_add.remove(menu_func)
if __name__ == "__main__":

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_max_z", text="")
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.label(text="Stretch:")
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_italic")
col.prop(char, "use_underline")
split = layout.split()
col = split.column()
col.prop(text, "small_caps_scale", text="Small Caps")
col = split.column()
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")
def register():
pass

View File

@ -64,6 +64,7 @@ class DATA_PT_context_lamp(DataButtonsPanel, bpy.types.Panel):
if texture_count != 0:
split.label(text=str(texture_count), icon='TEXTURE')
class DATA_PT_preview(DataButtonsPanel, bpy.types.Panel):
bl_label = "Preview"
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':
split = layout.split()
col= split.column()
col = split.column()
col.label(text="Form factor sampling:")
sub=col.row(align=True)
sub = col.row(align=True)
if lamp.shape == 'SQUARE':
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':
split = layout.split()
col = split.column()
col.label(text="Sampling:")
if lamp.type in ('POINT', 'SUN', 'SPOT'):
sub = col.row()
sub.prop(lamp, "shadow_ray_samples", text="Samples")
sub.prop(lamp, "shadow_soft_size", text="Soft Size")
elif lamp.type == 'AREA':
sub = col.row(align=True)
if lamp.shape == 'SQUARE':
sub.prop(lamp, "shadow_ray_samples_x", text="Samples")
elif lamp.shape == 'RECTANGLE':
@ -251,11 +252,11 @@ class DATA_PT_shadow(DataButtonsPanel, bpy.types.Panel):
split = layout.split()
col = split.column()
if lamp.shadow_ray_sample_method == 'ADAPTIVE_QMC':
col.prop(lamp, "shadow_adaptive_threshold", text="Threshold")
col = split.column()
if lamp.type == 'AREA' and lamp.shadow_ray_sample_method == 'CONSTANT_JITTERED':
col = split.column()
col = split.column()
@ -322,7 +323,7 @@ class DATA_PT_area(DataButtonsPanel, bpy.types.Panel):
split = layout.split()
col = split.column()
col.row().prop(lamp, "shape", expand=True)
sub = col.row(align=True)

View File

@ -80,7 +80,7 @@ class DATA_PT_lattice(DataButtonsPanel, bpy.types.Panel):
row = layout.row()
row.prop(lat, "use_outside")
row.prop_search(lat, "vertex_group", context.object, "vertex_groups", text="")
class DATA_PT_custom_props_lattice(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
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):
layout = self.layout
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.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.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.prop(game, "use_actor")
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.prop(game, "use_material_physics")
@ -286,7 +286,7 @@ class RENDER_PT_game_stereo(RenderButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(gs, "dome_tesselation", text="Tesselation")
else: # cube map
else: # cube map
col = split.column()
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:
layout.prop(mat, "type", expand=True)
class MATERIAL_PT_preview(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Preview"
@ -357,9 +357,9 @@ class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
sub = col.column()
sub.active = rayt.gloss_factor < 1.0
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):
bl_label = "Mirror"
bl_options = {'DEFAULT_CLOSED'}
@ -482,7 +482,7 @@ class MATERIAL_PT_halo(MaterialButtonsPanel, bpy.types.Panel):
def draw(self, context):
layout = self.layout
mat = context.material # dont use node material
mat = context.material # dont use node material
halo = mat.halo
split = layout.split()
@ -536,7 +536,7 @@ class MATERIAL_PT_flare(MaterialButtonsPanel, bpy.types.Panel):
def draw(self, context):
layout = self.layout
mat = context.material # dont use node material
mat = context.material # dont use node material
halo = mat.halo
layout.active = halo.use_flare_mode
@ -564,7 +564,7 @@ class MATERIAL_PT_physics(MaterialButtonsPanel, bpy.types.Panel):
def draw(self, context):
layout = self.layout
phys = context.material.physics # dont use node material
phys = context.material.physics # dont use node material
split = layout.split()
@ -593,7 +593,7 @@ class MATERIAL_PT_strand(MaterialButtonsPanel, bpy.types.Panel):
def draw(self, context):
layout = self.layout
mat = context.material # dont use node material
mat = context.material # dont use node material
tan = mat.strand
split = layout.split()
@ -760,7 +760,7 @@ class MATERIAL_PT_volume_density(VolumeButtonsPanel, bpy.types.Panel):
def draw(self, context):
layout = self.layout
vol = context.material.volume # dont use node material
vol = context.material.volume # dont use node material
split = layout.split()
col = split.column()
@ -777,7 +777,7 @@ class MATERIAL_PT_volume_shading(VolumeButtonsPanel, bpy.types.Panel):
def draw(self, context):
layout = self.layout
vol = context.material.volume # dont use node material
vol = context.material.volume # dont use node material
split = layout.split()
@ -802,7 +802,7 @@ class MATERIAL_PT_volume_lighting(VolumeButtonsPanel, bpy.types.Panel):
def draw(self, context):
layout = self.layout
vol = context.material.volume # dont use node material
vol = context.material.volume # dont use node material
split = layout.split()
@ -837,7 +837,7 @@ class MATERIAL_PT_volume_transp(VolumeButtonsPanel, bpy.types.Panel):
def draw(self, context):
layout = self.layout
mat = context.material # dont use node material
mat = context.material # dont use node material
layout.prop(mat, "transparency_method", expand=True)
@ -849,7 +849,7 @@ class MATERIAL_PT_volume_integration(VolumeButtonsPanel, bpy.types.Panel):
def draw(self, context):
layout = self.layout
vol = context.material.volume # dont use node material
vol = context.material.volume # dont use node material
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")
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_context = "object"

View File

@ -55,7 +55,7 @@ class ConstraintButtonsPanel():
row.prop(con, "owner_space", text="")
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.type == 'ARMATURE':

View File

@ -470,7 +470,6 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, bpy.types.Panel):
elif part.physics_type == 'BOIDS':
boids = part.boids
row = layout.row()
row.prop(boids, "use_flight")
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="Negate")
row = layout.row()
row.prop_search(psys, "vertex_group_density", ob, "vertex_groups", text="Density")
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.label(text="File Path:")
row.prop(cache, "use_library_path", "Use Lib Path")
layout.prop(cache, "filepath", text="")
layout.label(text=cache.info)
@ -97,7 +97,6 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
sub.enabled = enabled
sub.operator("ptcache.bake_from_cache", text="Current Cache to Bake")
col = split.column()
col.operator("ptcache.bake_all", text="Bake All Dynamics").bake = True
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):
layout = self.layout
layout.prop(weights, "group")
split = layout.split()
@ -142,7 +140,6 @@ def effector_weights_ui(self, context, weights):
def basic_force_field_settings_ui(self, context, field):
layout = self.layout
split = layout.split()
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):
layout = self.layout
# XXX: This doesn't update for some reason.
#split = layout.split()
split = layout.split(percentage=0.35)

View File

@ -57,7 +57,7 @@ class PHYSICS_PT_field(PhysicButtonsPanel, bpy.types.Panel):
split = layout.split()
if field.type == 'NONE':
return # nothing to draw
return # nothing to draw
elif field.type == 'GUIDE':
col = split.column()
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.label()
if md:
row = layout.row()
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")
elif md.smoke_type == 'FLOW':
flow = md.flow_settings
split = layout.split()
@ -107,7 +107,6 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, bpy.types.Panel):
sub.active = flow.initial_velocity
sub.prop(flow, "velocity_factor", text="Multiplier")
sub = split.column()
sub.active = not md.flow_settings.use_outflow
sub.label(text="Behavior:")

View File

@ -188,7 +188,6 @@ class PHYSICS_PT_softbody_edge(PhysicButtonsPanel, bpy.types.Panel):
#sub = col.column()
#sub.enabled = softbody.aero > 0
col.label(text="Collision:")
col.prop(softbody, "use_edge_collision", text="Edge")
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.prop(rl, "layers_zmask", text="")
layout.separator()
layout.label(text="Include:")
@ -512,7 +511,6 @@ class RENDER_PT_post_processing(RenderButtonsPanel, bpy.types.Panel):
sub.row().prop(rd, "field_order", expand=True)
sub.prop(rd, "use_fields_still", text="Still")
col = split.column()
col.prop(rd, "use_edge_enhance")
sub = col.column()
@ -552,7 +550,7 @@ class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel):
if file_format in ('AVI_JPEG', 'JPEG'):
split = layout.split()
split.prop(rd, "file_quality", slider=True)
if file_format == 'PNG':
split = layout.split()
split.prop(rd, "file_quality", slider=True, text="Compression")
@ -636,7 +634,7 @@ class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel):
if rd.quicktime_audiocodec_type == 'AAC':
col.prop(rd, "quicktime_audio_codec_isvbr")
col = subsplit.column()
col.prop(rd, "quicktime_audio_resampling_hq")
@ -757,6 +755,7 @@ class RENDER_PT_motion_blur(RenderButtonsPanel, bpy.types.Panel):
row.prop(rd, "motion_blur_samples")
row.prop(rd, "motion_blur_shutter")
class RENDER_PT_dimensions(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Dimensions"
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_path_builder(ksp, "data_path", ksp.id)
row = layout.row()
col = row.column()
@ -208,6 +207,8 @@ class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, bpy.types.Panel):
from bpy.props import *
# XXX, move operator to op/ dir
class ANIM_OT_keying_set_export(bpy.types.Operator):
"Export Keying Set to a python script."
@ -220,17 +221,16 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
filter_python = bpy.props.BoolProperty(name="Filter python", description="", default=True, options={'HIDDEN'})
def execute(self, context):
if not self.properties.filepath:
if not self.filepath:
raise Exception("Filepath not set.")
f = open(self.properties.filepath, "w")
f = open(self.filepath, "w")
if not f:
raise Exception("Could not open file.")
scene = context.scene
ks = scene.keying_sets.active
f.write("# Keying Set: %s\n" % ks.name)
f.write("import bpy\n\n")
@ -249,9 +249,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("\n")
# generate and write set of lookups for id's used in paths
id_to_paths_cache = {} # cache for syncing ID-blocks to bpy paths + shorthands
id_to_paths_cache = {} # cache for syncing ID-blocks to bpy paths + shorthands
for ksp in ks.paths:
if ksp.id is None:
@ -278,7 +277,6 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
f.write("%s = %s\n" % (id_pair[0], id_pair[1]))
f.write("\n")
# write paths
f.write("# Path Definitions\n")
for ksp in ks.paths:
@ -289,7 +287,7 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
# find the relevant shorthand from the cache
id_bpy_path = id_to_paths_cache[ksp.id][0]
else:
id_bpy_path = "None" # XXX...
id_bpy_path = "None" # XXX...
f.write("%s, '%s'" % (id_bpy_path, ksp.data_path))
# array index settings (if applicable)

View File

@ -691,7 +691,6 @@ class TEXTURE_PT_envmap(TextureTypePanel, bpy.types.Panel):
tex = context.texture
env = tex.environment_map
row = layout.row()
row.prop(env, "source", expand=True)
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
world = context.world
space = context.space_data
texture_count = world and len(world.texture_slots.keys())
split = layout.split(percentage=0.65)
@ -62,6 +62,7 @@ class WORLD_PT_context_world(WorldButtonsPanel, bpy.types.Panel):
if texture_count:
split.label(text=str(texture_count), icon='TEXTURE')
class WORLD_PT_preview(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Preview"
COMPAT_ENGINES = {'BLENDER_RENDER'}

View File

@ -186,7 +186,7 @@ class ConsoleLanguage(bpy.types.Operator):
sc = context.space_data
# defailt to python
sc.language = self.properties.language
sc.language = self.language
bpy.ops.console.banner()

View File

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

View File

@ -44,11 +44,11 @@ class FILEBROWSER_HT_header(bpy.types.Header):
row = layout.row(align=True)
row.operator("file.directory_new", text="", icon='NEWFOLDER')
params = st.params
# 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, "sort_method", expand=True, text="")

View File

@ -50,7 +50,7 @@ class IMAGE_MT_view(bpy.types.Menu):
layout.prop(sima, "use_realtime_update")
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.separator()
@ -203,8 +203,8 @@ class IMAGE_MT_uvs_weldalign(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.operator("uv.weld") # W, 1
layout.operator_enums("uv.align", "axis") # W, 2/3/4
layout.operator("uv.weld") # W, 1
layout.operator_enums("uv.align", "axis") # W, 2/3/4
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="NOCURVE", text="").shape = 'MAX'
def register():
pass

View File

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

View File

@ -44,7 +44,7 @@ class LOGIC_PT_properties(bpy.types.Panel):
row = box.row()
row.prop(prop, "name", 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.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.controller_add", "type", text="Controller")
layout.operator_menu_enum("logic.actuator_add", "type", text="Actuator")
class LOGIC_HT_header(bpy.types.Header):
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_select")
#sub.menu("LOGIC_MT_add")
class LOGIC_MT_view(bpy.types.Menu):
bl_label = "View"
@ -85,7 +85,7 @@ class LOGIC_MT_view(bpy.types.Menu):
layout = self.layout
layout.column()
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:
layout.separator()
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 out").factor = 0.833
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 out").factor = 0.833
layout.separator()
layout.operator("screen.area_dupli")

View File

@ -98,9 +98,9 @@ class SEQUENCER_MT_view(bpy.types.Menu):
st = context.space_data
layout.column()
layout.operator("sequencer.properties", icon='MENU_PANEL')
layout.separator()
"""
@ -458,7 +458,6 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
for i in range(1, strip.channel):
row.operator("sequencer.cut_multicam", text=str(i)).camera = i
col = layout.column(align=True)
if strip.type == 'SPEED':
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")
if not strip.use_default_fade:
col.prop(strip, "effect_fader", text="Effect fader")
layout.prop(strip, "use_translation", text="Image Offset:")
if strip.use_translation:
col = layout.column(align=True)
@ -554,7 +553,7 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel):
col = split.column()
col.label(text="File:")
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':
split = layout.split(percentage=0.2)
@ -566,7 +565,6 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel):
# TODO, sound???
# end drawing filename
layout.prop(strip, "use_translation", text="Image Offset:")
if strip.use_translation:
col = layout.column(align=True)
@ -698,7 +696,7 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel, bpy.types.Panel):
col.prop(strip, "use_float")
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.active = strip.use_color_balance
col = row.column()
@ -742,7 +740,7 @@ class SEQUENCER_PT_proxy(SequencerButtonsPanel, bpy.types.Panel):
flow = layout.column_flow()
flow.prop(strip, "use_proxy_custom_directory")
flow.prop(strip, "use_proxy_custom_file")
if strip.proxy: # TODO - need to add this somehow
if strip.proxy: # TODO - need to add this somehow
if strip.use_proxy_custom_directory and not strip.use_proxy_custom_file:
flow.prop(strip.proxy, "directory")
if strip.use_proxy_custom_file:
@ -783,12 +781,13 @@ class SEQUENCER_PT_view(SequencerButtonsPanel_Output, bpy.types.Panel):
col = layout.column()
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")
if st.display_mode == 'WAVEFORM':
col.prop(st, "show_separate_color")
col.prop(st, "proxy_render_size")
def register():
pass

View File

@ -131,12 +131,12 @@ class TEXT_PT_find(bpy.types.Panel):
class TEXT_MT_view(bpy.types.Menu):
bl_label = "View"
def draw(self, context):
layout = self.layout
layout.operator("text.properties", icon='MENU_PANEL')
layout.separator()
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="Bottom of File").type = 'FILE_BOTTOM'
class TEXT_MT_text(bpy.types.Menu):
bl_label = "Text"
@ -293,6 +293,7 @@ class TEXT_MT_toolbox(bpy.types.Menu):
layout.operator("text.run_script")
def register():
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", 'REPLACE_KEYS')
def register():
pass

View File

@ -366,7 +366,6 @@ class USERPREF_PT_system(bpy.types.Panel):
split = layout.split()
# 1. Column
column = split.column()
colsplit = column.split(percentage=0.85)
@ -419,7 +418,6 @@ class USERPREF_PT_system(bpy.types.Panel):
#col.prop(system, "use_textured_fonts")
# 2. Column
column = split.column()
colsplit = column.split(percentage=0.85)
@ -446,7 +444,6 @@ class USERPREF_PT_system(bpy.types.Panel):
col.prop(system, "prefetch_frames")
col.prop(system, "memory_cache_limit")
# 3. Column
column = split.column()
@ -534,7 +531,6 @@ class USERPREF_PT_theme(bpy.types.Panel):
split = layout.split(percentage=0.4)
layout.separator()
layout.separator()
@ -631,7 +627,6 @@ class USERPREF_PT_theme(bpy.types.Panel):
colsub.row().prop(ui, "inner_key_sel")
colsub.row().prop(ui, "blend")
ui = theme.user_interface
col.separator()
col.separator()
@ -816,7 +811,7 @@ class USERPREF_PT_addons(bpy.types.Panel):
bl_label = "Addons"
bl_region_type = 'WINDOW'
bl_options = {'HIDE_HEADER'}
_addons_fake_modules = {}
@classmethod
@ -887,33 +882,20 @@ class USERPREF_PT_addons(bpy.types.Panel):
modules_stale = set(USERPREF_PT_addons._addons_fake_modules.keys())
for path in paths:
for f in sorted(os.listdir(path)):
if f.endswith(".py"):
mod_name = f[0:-3]
mod_path = os.path.join(path, f)
elif ("." not in f) and (os.path.isfile(os.path.join(path, f, "__init__.py"))):
mod_name = f
mod_path = os.path.join(path, f, "__init__.py")
else:
mod_name = ""
mod_path = ""
for mod_name, mod_path in bpy.path.module_names(path):
modules_stale -= {mod_name}
mod = USERPREF_PT_addons._addons_fake_modules.get(mod_name)
if mod:
if mod.__time__ != os.path.getmtime(mod_path):
print("reloading addon:", mod_name, mod.__time__, os.path.getmtime(mod_path), mod_path)
del USERPREF_PT_addons._addons_fake_modules[mod_name]
mod = None
if mod_name:
if mod_name in modules_stale:
modules_stale.remove(mod_name)
mod = USERPREF_PT_addons._addons_fake_modules.get(mod_name)
if mod is None:
mod = fake_module(mod_name, mod_path)
if mod:
if mod.__time__ != os.path.getmtime(mod_path):
print("Reloading", mod_name)
del USERPREF_PT_addons._addons_fake_modules[mod_name]
mod = None
USERPREF_PT_addons._addons_fake_modules[mod_name] = mod
if mod is None:
mod = fake_module(mod_name, mod_path)
if mod:
USERPREF_PT_addons._addons_fake_modules[mod_name] = mod
# just incase we get stale modules, not likely
for mod_stale in modules_stale:
del USERPREF_PT_addons._addons_fake_modules[mod_stale]
@ -937,20 +919,20 @@ class USERPREF_PT_addons(bpy.types.Panel):
cats = ["All", "Enabled", "Disabled"] + sorted(cats)
bpy.types.Scene.EnumProperty(items=[(cat, cat, cat + " addons") for cat in cats],
name="Category", attr="addon_filter", description="Filter add-ons by category")
bpy.types.Scene.StringProperty(name="Search", attr="addon_search",
description="Search within the selected filter")
# use window manager ID since it wont be saved with the file
# defining every draw is stupid *FIXME*
bpy.types.WindowManager.addon_filter = bpy.props.EnumProperty(items=[(cat, cat, cat + " addons") for cat in cats], name="Category", description="Filter add-ons by category")
bpy.types.WindowManager.addon_search = bpy.props.StringProperty(name="Search", description="Search within the selected filter")
split = layout.split(percentage=0.2)
col = split.column()
col.prop(context.scene, "addon_filter", text="Filter", expand=True)
col.prop(context.scene, "addon_search", text="", icon='VIEWZOOM')
col.prop(context.window_manager, "addon_filter", text="Filter", expand=True)
col.prop(context.window_manager, "addon_search", text="", icon='VIEWZOOM')
col = split.column()
filter = context.scene.addon_filter
search = context.scene.addon_search.lower()
filter = context.window_manager.addon_filter
search = context.window_manager.addon_search.lower()
for mod, info in addons:
module_name = mod.__name__
@ -963,7 +945,6 @@ class USERPREF_PT_addons(bpy.types.Panel):
(filter == "Enabled" and is_enabled) or \
(filter == "Disabled" and not is_enabled):
if search and search not in info["name"].lower():
if info["author"]:
if search not in info["author"].lower():
@ -981,7 +962,8 @@ class USERPREF_PT_addons(bpy.types.Panel):
rowsub = row.row()
rowsub.active = is_enabled
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:
row.operator("wm.addon_disable", icon='CHECKBOX_HLT', text="", emboss=False).module = module_name
@ -1074,32 +1056,78 @@ class WM_OT_addon_enable(bpy.types.Operator):
module = StringProperty(name="Module", description="Module name of the addon to enable")
def execute(self, context):
module_name = self.properties.module
module_name = self.module
# note, this still gets added to _bpy_types.TypeMap
import sys
import bpy_types as _bpy_types
_bpy_types._register_immediate = False
try:
mod = __import__(module_name)
_bpy_types._register_module(module_name)
mod.register()
except:
def handle_error():
import traceback
traceback.print_exc()
_bpy_types._register_immediate = True
# reload if the mtime changes
mod = sys.modules.get(module_name)
if mod:
mtime_orig = getattr(mod, "__time__", 0)
mtime_new = os.path.getmtime(mod.__file__)
if mtime_orig != mtime_new:
print("module changed on disk:", mod.__file__, "reloading...")
try:
reload(mod)
except:
handle_error()
del sys.modules[module_name]
return {'CANCELLED'}
# Split registering up into 3 steps so we can undo if it fails par way through
# 1) try import
try:
mod = __import__(module_name)
mod.__time__ = os.path.getmtime(mod.__file__)
except:
handle_error()
return {'CANCELLED'}
ext = context.user_preferences.addons.new()
ext.module = module_name
# 2) try register collected modules
try:
_bpy_types._register_module(module_name)
except:
handle_error()
del sys.modules[module_name]
return {'CANCELLED'}
# 3) try run the modules register function
try:
mod.register()
except:
handle_error()
_bpy_types._unregister_module(module_name)
del sys.modules[module_name]
return {'CANCELLED'}
# * OK loaded successfully! *
# just incase its enabled alredy
ext = context.user_preferences.addons.get(module_name)
if not ext:
ext = context.user_preferences.addons.new()
ext.module = module_name
# check if add-on is written for current blender version, or raise a warning
info = addon_info_get(mod)
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.")
_bpy_types._register_immediate = True
return {'FINISHED'}
@ -1112,25 +1140,23 @@ class WM_OT_addon_disable(bpy.types.Operator):
def execute(self, context):
import bpy_types as _bpy_types
module_name = self.properties.module
module_name = self.module
try:
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()
except:
import traceback
traceback.print_exc()
# could be in more then once, unlikely but better do this just incase.
addons = context.user_preferences.addons
ok = True
while ok: # incase its in more then once.
ok = False
for ext in addons:
if ext.module == module_name:
addons.remove(ext)
ok = True
break
while module_name in addons:
addon = addons.get(module_name)
if addon:
addons.remove(addon)
return {'FINISHED'}
@ -1149,7 +1175,7 @@ class WM_OT_addon_install(bpy.types.Operator):
def execute(self, context):
import traceback
import zipfile
pyfile = self.properties.filepath
pyfile = self.filepath
path_addons = bpy.utils.script_paths("addons")[-1]
@ -1203,7 +1229,7 @@ class WM_OT_addon_expand(bpy.types.Operator):
module = StringProperty(name="Module", description="Module name of the addon to expand")
def execute(self, context):
module_name = self.properties.module
module_name = self.module
# unlikely to fail, module should have already been imported
try:
@ -1222,6 +1248,7 @@ class WM_OT_addon_expand(bpy.types.Operator):
def register():
pass
def unregister():
pass

View File

@ -22,17 +22,17 @@ import os
KM_HIERARCHY = [
('Window', 'EMPTY', 'WINDOW', []), # file save, window change, exit
('Screen', 'EMPTY', 'WINDOW', [ # full screen, undo, screenshot
('Window', 'EMPTY', 'WINDOW', []), # file save, window change, exit
('Screen', 'EMPTY', 'WINDOW', [ # full screen, undo, screenshot
('Screen Editing', 'EMPTY', 'WINDOW', []), # resizing, action corners
]),
('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)
('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', []),
('Mesh', 'EMPTY', 'WINDOW', []),
('Curve', 'EMPTY', 'WINDOW', []),
@ -46,13 +46,13 @@ KM_HIERARCHY = [
('Vertex Paint', 'EMPTY', 'WINDOW', []),
('Weight Paint', 'EMPTY', 'WINDOW', []),
('Face Mask', 'EMPTY', 'WINDOW', []),
('Image Paint', 'EMPTY', 'WINDOW', []), # image and view3d
('Image Paint', 'EMPTY', 'WINDOW', []), # image and view3d
('Sculpt', 'EMPTY', 'WINDOW', []),
('Armature Sketch', '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
]),
@ -71,8 +71,8 @@ KM_HIERARCHY = [
]),
('Image', 'IMAGE_EDITOR', 'WINDOW', [
('UV Editor', 'EMPTY', 'WINDOW', []), # image (reverse order, UVEdit before Image
('Image Paint', 'EMPTY', 'WINDOW', []), # image and view3d
('UV Editor', 'EMPTY', 'WINDOW', []), # image (reverse order, UVEdit before Image
('Image Paint', 'EMPTY', 'WINDOW', []), # image and view3d
('Image Generic', 'IMAGE_EDITOR', 'WINDOW', [])
]),
@ -90,7 +90,7 @@ KM_HIERARCHY = [
('File Browser Buttons', 'FILE_BROWSER', 'WINDOW', [])
]),
('Property Editor', 'PROPERTIES', 'WINDOW', []), # align context menu
('Property Editor', 'PROPERTIES', 'WINDOW', []), # align context menu
('Script', 'SCRIPTS_WINDOW', 'WINDOW', []),
('Text', 'TEXT_EDITOR', 'WINDOW', []),
@ -285,6 +285,8 @@ class InputKeyMapPanel(bpy.types.Panel):
if km.is_modal:
sub.prop(kmi, "propvalue", text="")
else:
# One day...
# sub.prop_search(kmi, "idname", bpy.context.window_manager, "operators_all", text="")
sub.prop(kmi, "idname", text="")
sub = split.column()
@ -520,10 +522,10 @@ class WM_OT_keyconfig_import(bpy.types.Operator):
def execute(self, context):
import shutil
if not self.properties.is_property_set("filepath"):
if not self.filepath:
raise Exception("Filepath not set")
f = open(self.properties.filepath, "r")
f = open(self.filepath, "r")
if not f:
raise Exception("Could not open file")
@ -536,7 +538,7 @@ class WM_OT_keyconfig_import(bpy.types.Operator):
if config_name is None:
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)
print(path)
@ -546,10 +548,10 @@ class WM_OT_keyconfig_import(bpy.types.Operator):
path = os.path.join(path, config_name + ".py")
if self.properties.keep_original:
shutil.copy(self.properties.filepath, path)
if self.keep_original:
shutil.copy(self.filepath, path)
else:
shutil.move(self.properties.filepath, path)
shutil.move(self.filepath, path)
# sneaky way to check we're actually running the code.
wm = context.window_manager
@ -587,20 +589,20 @@ class WM_OT_keyconfig_export(bpy.types.Operator):
kc_name = StringProperty(name="KeyConfig Name", description="Name to save the key config as")
def execute(self, context):
if not self.properties.is_property_set("filepath"):
if not self.filepath:
raise Exception("Filepath not set")
f = open(self.properties.filepath, "w")
f = open(self.filepath, "w")
if not f:
raise Exception("Could not open file")
wm = context.window_manager
kc = wm.keyconfigs.active
if self.properties.kc_name != '':
name = self.properties.kc_name
if self.kc_name != '':
name = self.kc_name
elif kc.name == 'Blender':
name = os.path.splitext(os.path.basename(self.properties.filepath))[0]
name = os.path.splitext(os.path.basename(self.filepath))[0]
else:
name = kc.name
@ -689,12 +691,12 @@ class WM_OT_keymap_restore(bpy.types.Operator):
bl_idname = "wm.keymap_restore"
bl_label = "Restore Key Map(s)"
all = BoolProperty(attr="all", name="All Keymaps", description="Restore all keymaps to default")
all = BoolProperty(name="All Keymaps", description="Restore all keymaps to default")
def execute(self, context):
wm = context.window_manager
if self.properties.all:
if self.all:
for km in wm.keyconfigs.default.keymaps:
km.restore_to_default()
else:
@ -709,12 +711,12 @@ class WM_OT_keyitem_restore(bpy.types.Operator):
bl_idname = "wm.keyitem_restore"
bl_label = "Restore Key Map Item"
item_id = IntProperty(attr="item_id", name="Item Identifier", description="Identifier of the item to remove")
item_id = IntProperty(name="Item Identifier", description="Identifier of the item to remove")
def execute(self, context):
wm = context.window_manager
km = context.keymap
kmi = km.items.from_id(self.properties.item_id)
kmi = km.items.from_id(self.item_id)
km.restore_item_to_default(kmi)
@ -732,9 +734,9 @@ class WM_OT_keyitem_add(bpy.types.Operator):
kc = wm.keyconfigs.default
if km.is_modal:
km.items.new_modal("", 'A', 'PRESS') # kmi
km.items.new_modal("", 'A', 'PRESS') # kmi
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
if context.space_data.filter_text != "":
@ -750,12 +752,12 @@ class WM_OT_keyitem_remove(bpy.types.Operator):
bl_idname = "wm.keyitem_remove"
bl_label = "Remove Key Map Item"
item_id = IntProperty(attr="item_id", name="Item Identifier", description="Identifier of the item to remove")
item_id = IntProperty(name="Item Identifier", description="Identifier of the item to remove")
def execute(self, context):
wm = context.window_manager
km = context.keymap
kmi = km.items.from_id(self.properties.item_id)
kmi = km.items.from_id(self.item_id)
km.items.remove(kmi)
return {'FINISHED'}
@ -783,7 +785,7 @@ class WM_OT_keyconfig_remove(bpy.types.Operator):
if os.path.exists(path):
os.remove(path)
path = module.__file__ + "c" # for .pyc
path = module.__file__ + "c" # for .pyc
if os.path.exists(path):
os.remove(path)
@ -791,9 +793,11 @@ class WM_OT_keyconfig_remove(bpy.types.Operator):
wm.keyconfigs.remove(keyconfig)
return {'FINISHED'}
def register():
pass
def unregister():
pass

View File

@ -155,7 +155,7 @@ class VIEW3D_MT_transform(bpy.types.Menu):
layout.operator("armature.align")
else:
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()
@ -608,7 +608,6 @@ class VIEW3D_MT_select_edit_armature(bpy.types.Menu):
layout.operator("view3d.select_border")
layout.separator()
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...")
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"
def draw(self, context):
@ -738,7 +737,7 @@ class VIEW3D_MT_object_specials(bpy.types.Menu):
props.data_path_item = "data.dof_distance"
props.input_scale = 0.02
if obj.type in ('CURVE','TEXT'):
if obj.type in ('CURVE', 'TEXT'):
layout.operator_context = 'INVOKE_REGION_WIN'
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.hide_render_clear_all")
class VIEW3D_MT_object_apply(bpy.types.Menu):
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("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):
@ -1571,6 +1571,11 @@ class VIEW3D_MT_edit_mesh_faces(bpy.types.Menu):
layout.separator()
layout.operator("mesh.fgon_make")
layout.operator("mesh.fgon_clear")
layout.separator()
layout.operator("mesh.quads_convert_to_tris")
layout.operator("mesh.tris_convert_to_quads")
layout.operator("mesh.edge_flip")
@ -1724,7 +1729,7 @@ class VIEW3D_MT_edit_text(bpy.types.Menu):
layout.menu("VIEW3D_MT_edit_text_chars")
layout.separator()
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 Underline").style = 'UNDERLINE'
@ -2157,8 +2162,11 @@ class VIEW3D_PT_background_image(bpy.types.Panel):
box = layout.box()
row = box.row(align=True)
row.prop(bg, "show_expanded", text="", emboss=False)
row.label(text=getattr(bg.image, "name", "Not Set"))
row.operator("view3d.remove_background_image", text="", icon='X').index = i
if bg.image:
row.prop(bg.image, "name", text="", emboss=False)
else:
row.label(text="Not Set")
row.operator("view3d.remove_background_image", text="", emboss=False, icon='X').index = i
box.prop(bg, "view_axis", text="Axis")

View File

@ -92,14 +92,12 @@ class VIEW3D_PT_tools_meshedit(View3DPanel, bpy.types.Panel):
col.operator("transform.resize", text="Scale")
col.operator("transform.shrink_fatten", text="Along Normal")
col = layout.column(align=True)
col.label(text="Deform:")
col.operator("transform.edge_slide")
col.operator("mesh.rip_move")
col.operator("mesh.vertices_smooth")
col = layout.column(align=True)
col.label(text="Add:")
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", text="Clear Seam").clear = True
col = layout.column(align=True)
col.label(text="Shading:")
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.separator()
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="")
if brush.sculpt_tool not in ('SNAKE_HOOK', 'GRAB', 'ROTATE'):
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, "use_pressure_strength", text="")
if brush.sculpt_tool not in ('SMOOTH'):
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, "use_inverse_smooth_pressure", toggle=True, text="")
if brush.sculpt_tool in ('GRAB', 'SNAKE_HOOK'):
col.separator()
row = col.row(align=True)
row.prop(brush, "normal_weight", slider=True)
if brush.sculpt_tool in ('CREASE', 'BLOB'):
col.separator()
@ -614,15 +603,15 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
col.separator()
row= col.row()
row = col.row()
row.prop(brush, "use_plane_trim", text="Trim")
row= col.row()
row.active=brush.use_plane_trim
row = col.row()
row.active = brush.use_plane_trim
row.prop(brush, "plane_trim", slider=True, text="Distance")
col.separator()
row= col.row()
row = col.row()
row.prop(brush, "use_frontface", text="Front Faces Only")
col.separator()
@ -633,8 +622,6 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
col.prop(brush, "use_accumulate")
if brush.sculpt_tool == 'LAYER':
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.prop(brush, "use_alpha")
# Weight Paint Mode #
elif context.weight_paint_object and brush:
layout.prop(context.tool_settings, "vertex_group_weight", text="Weight", slider=True)
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="")
# Vertex Paint Mode #
elif context.vertex_paint_object and brush:
col = layout.column()
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:
#XXX duplicated from properties_texture.py
col.separator()
col.label(text="Brush Mapping:")
row = col.row(align=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.active = tex_slot.map_mode in ('FIXED', )
col.label(text="Angle:")
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'):
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):
layout = self.layout
tool_settings = context.tool_settings
sculpt = tool_settings.sculpt
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_z", text="Z", toggle=True)
class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel):
bl_label = "Symmetry"
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")
class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel):
bl_label = "Appearance"
bl_options = {'DEFAULT_CLOSED'}
@ -1066,7 +1046,7 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel):
settings = __class__.paint_settings(context)
brush = settings.brush
col = layout.column();
col = layout.column()
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'):
@ -1259,7 +1239,8 @@ class VIEW3D_PT_imagepaint_options(PaintPanel):
col.label(text="Unified Settings:")
col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
class VIEW3D_MT_tools_projectpaint_clone(bpy.types.Menu):
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:
layout.template_list(ptcache, "point_caches", ptcache.point_caches, "active_index", type='ICONS')
if not pe.is_editable:
layout.label(text="Point cache must be baked")
layout.label(text="to enable editing!")

View File

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

View File

@ -1,4 +1,4 @@
[DEFAULT]
BASEURL=http://www.blender3d.org/Support/
BASEURL=http://www.blender.org/education-help/
[InternetShortcut]
URL=http://www.blender3d.org/Support/
URL=http://www.blender.org/education-help/

View File

@ -100,7 +100,7 @@ Function DataLocation
${EndIf}
${NSD_CreateLabel} 0 0 100% 12u "Please specify where you wish to install Blender's user data files."
${NSD_CreateRadioButton} 0 20 100% 12u "Use the Application Data directory (Requires Windows 2000 or better)"
${NSD_CreateRadioButton} 0 20 100% 12u "Use the Application Data directory"
Pop $HWND_APPDATA
${NSD_CreateRadioButton} 0 50 100% 12u "Use the installation directory (ie. location chosen to install blender.exe)."
Pop $HWND_INSTDIR

View File

@ -155,7 +155,7 @@ void blf_font_buffer(FontBLF *font, char *str)
FT_Vector delta;
FT_UInt glyph_index;
float a, *fbuf;
int pen_x, pen_y, y, x, yb, diff;
int pen_x, y, x, yb;
int i, has_kerning, st, chx, chy;
if (!font->glyph_cache || (!font->b_fbuf && !font->b_cbuf))
@ -163,7 +163,6 @@ void blf_font_buffer(FontBLF *font, char *str)
i= 0;
pen_x= (int)font->pos[0];
pen_y= (int)font->pos[1];
has_kerning= FT_HAS_KERNING(font->face);
g_prev= NULL;
@ -172,6 +171,7 @@ void blf_font_buffer(FontBLF *font, char *str)
b_col_char[2]= font->b_col[2] * 255;
while (str[i]) {
int pen_y;
c= blf_utf8_next((unsigned char *)str, &i);
if (c == 0)
break;
@ -200,24 +200,9 @@ void blf_font_buffer(FontBLF *font, char *str)
}
chx= pen_x + ((int)g->pos_x);
diff= g->height - ((int)g->pos_y);
if (diff > 0) {
if (g->pitch < 0)
pen_y += diff;
else
pen_y -= diff;
}
else if (diff < 0) {
if (g->pitch < 0)
pen_y -= diff;
else
pen_y += diff;
}
if (g->pitch < 0)
chy= pen_y - ((int)g->pos_y);
else
chy= pen_y + ((int)g->pos_y);
pen_y= (int)font->pos[1] - (g->height - ((int)g->pos_y));
chy= pen_y - ((int)g->pos_y);
if ((chx + g->width) >= 0 && chx < font->bw && (pen_y + g->height) >= 0 && pen_y < font->bh) {
/* dont draw beyond the buffer bounds */
@ -285,19 +270,6 @@ void blf_font_buffer(FontBLF *font, char *str)
}
}
if (diff > 0) {
if (g->pitch < 0)
pen_x -= diff;
else
pen_y += diff;
}
else if (diff < 0) {
if (g->pitch < 0)
pen_x += diff;
else
pen_y -= diff;
}
pen_x += g->advance;
g_prev= g;
}

View File

@ -44,8 +44,8 @@ struct ReportList;
struct Scene;
struct Main;
#define BLENDER_VERSION 253
#define BLENDER_SUBVERSION 1
#define BLENDER_VERSION 254
#define BLENDER_SUBVERSION 0
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0

View File

@ -321,6 +321,9 @@ struct LinkNode *modifiers_calcDataMasks(struct Scene *scene,
int required_mode);
struct ModifierData *modifiers_getVirtualModifierList(struct Object *ob);
/* ensure modifier correctness when changing ob->data */
void test_object_modifiers(struct Object *ob);
/* here for do_versions */
void modifier_mdef_compact_influences(struct ModifierData *md);

View File

@ -44,6 +44,8 @@ void multires_force_update(struct Object *ob);
void multires_force_render_update(struct Object *ob);
void multires_force_external_reload(struct Object *ob);
void multiresModifier_set_levels_from_disps(struct MultiresModifierData *mmd, struct Object *ob);
struct DerivedMesh *multires_dm_create_from_derived(struct MultiresModifierData*,
int local_mmd, struct DerivedMesh*, struct Object *, int, int);

View File

@ -88,8 +88,7 @@ IF(WITH_IMAGE_HDR)
ENDIF(WITH_IMAGE_HDR)
IF(WITH_QUICKTIME)
LIST(APPEND INC ../quicktime)
LIST(APPEND INC ${QUICKTIME_INC})
LIST(APPEND INC ../quicktime ${QUICKTIME_INC})
ADD_DEFINITIONS(-DWITH_QUICKTIME)
ENDIF(WITH_QUICKTIME)
@ -104,8 +103,7 @@ IF(WITH_LCMS)
ENDIF(WITH_LCMS)
IF(WITH_PYTHON)
LIST(APPEND INC ../python)
LIST(APPEND INC ${PYTHON_INC})
LIST(APPEND INC ../python ${PYTHON_INC})
ELSE(WITH_PYTHON)
ADD_DEFINITIONS(-DDISABLE_PYTHON)
ENDIF(WITH_PYTHON)

View File

@ -147,6 +147,8 @@ Brush *copy_brush(Brush *brush)
if (brush->icon_imbuf)
brushn->icon_imbuf= IMB_dupImBuf(brush->icon_imbuf);
brushn->preview = NULL;
brushn->curve= curvemapping_copy(brush->curve);
/* enable fake user by default */

View File

@ -446,7 +446,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob,
return dm;
}
if(clmd->sim_parms->reset || (framenr == (startframe - clmd->sim_parms->preroll)))
if(clmd->sim_parms->reset || (framenr == (startframe - clmd->sim_parms->preroll) && clmd->sim_parms->preroll != 0))
{
clmd->sim_parms->reset = 0;
cache->flag |= PTCACHE_OUTDATED;
@ -512,7 +512,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob,
}
/* try to read from cache */
cache_result = BKE_ptcache_read_cache(&pid, (float)framenr, scene->r.frs_sec);
cache_result = BKE_ptcache_read_cache(&pid, (float)framenr+scene->r.subframe, scene->r.frs_sec);
if(cache_result == PTCACHE_READ_EXACT || cache_result == PTCACHE_READ_INTERPOLATED) {
implicit_set_positions(clmd);

View File

@ -667,10 +667,10 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
/* for vortex the shape chooses between old / new force */
if(eff->pd && eff->pd->shape == PFIELD_SHAPE_PLANE) {
/* efd->loc is closes point on effector xy-plane */
float temp[3];
float temp[3], translate[3];
sub_v3_v3v3(temp, point->loc, ob->obmat[3]);
project_v3_v3v3(efd->loc, temp, efd->nor);
sub_v3_v3v3(efd->loc, point->loc, efd->loc);
project_v3_v3v3(translate, temp, efd->nor);
add_v3_v3v3(efd->loc, ob->obmat[3], translate);
}
else {
VECCOPY(efd->loc, ob->obmat[3]);

Some files were not shown because too many files have changed in this diff Show More