Sculpt Branch:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r25245:25315
This commit is contained in:
@@ -270,6 +270,14 @@ BF_PCRE_LIBPATH = '${BF_PCRE}/lib'
|
||||
#BF_EXPAT_LIB = 'expat'
|
||||
#BF_EXPAT_LIBPATH = '/usr/lib'
|
||||
|
||||
#Ray trace optimization
|
||||
WITH_BF_RAYOPTIMIZATION = False
|
||||
if MACOSX_ARCHITECTURE == 'i386':
|
||||
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse']
|
||||
elif MACOSX_ARCHITECTURE == 'x86_64':
|
||||
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse','-msse2']
|
||||
|
||||
|
||||
#############################################################################
|
||||
################### various compile settings and flags ##################
|
||||
#############################################################################
|
||||
|
||||
@@ -167,6 +167,10 @@ BF_EXPAT_LIBPATH = '/usr/lib'
|
||||
|
||||
WITH_BF_OPENMP = True
|
||||
|
||||
#Ray trace optimization
|
||||
WITH_BF_RAYOPTIMIZATION = False
|
||||
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse','-pthread']
|
||||
|
||||
##
|
||||
CC = 'gcc'
|
||||
CXX = 'g++'
|
||||
|
||||
@@ -137,6 +137,10 @@ BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
|
||||
BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver xml2 pcre'
|
||||
BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib'
|
||||
|
||||
#Ray trace optimization
|
||||
WITH_BF_RAYOPTIMIZATION = False
|
||||
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse']
|
||||
|
||||
##
|
||||
CC = 'gcc'
|
||||
CXX = 'g++'
|
||||
|
||||
@@ -148,6 +148,10 @@ BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
|
||||
BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver xml2 pcre'
|
||||
BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib'
|
||||
|
||||
#Ray trace optimization
|
||||
WITH_BF_RAYOPTIMIZATION = False
|
||||
BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE']
|
||||
|
||||
WITH_BF_STATICOPENGL = False
|
||||
BF_OPENGL_INC = '${BF_OPENGL}/include'
|
||||
BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'
|
||||
@@ -155,6 +159,7 @@ BF_OPENGL_LIB = 'opengl32 glu32'
|
||||
BF_OPENGL_LIB_STATIC = [ '${BF_OPENGL}/lib/libGL.a', '${BF_OPENGL}/lib/libGLU.a',
|
||||
'${BF_OPENGL}/lib/libXmu.a', '${BF_OPENGL}/lib/libXext.a',
|
||||
'${BF_OPENGL}/lib/libX11.a', '${BF_OPENGL}/lib/libXi.a' ]
|
||||
|
||||
CC = 'cl.exe'
|
||||
CXX = 'cl.exe'
|
||||
|
||||
|
||||
@@ -161,6 +161,10 @@ BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
|
||||
BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver xml2 pcre'
|
||||
BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib'
|
||||
|
||||
#Ray trace optimization
|
||||
WITH_BF_RAYOPTIMIZATION = False
|
||||
BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE','/arch:SSE2']
|
||||
|
||||
WITH_BF_STATICOPENGL = False
|
||||
BF_OPENGL_INC = '${BF_OPENGL}/include'
|
||||
BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'
|
||||
|
||||
@@ -339,6 +339,10 @@
|
||||
RelativePath="..\..\..\source\blender\python\intern\bpy_array.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\source\blender\python\intern\bpy_driver.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\source\blender\python\intern\bpy_interface.c"
|
||||
>
|
||||
|
||||
@@ -1063,6 +1063,10 @@
|
||||
RelativePath="..\..\..\source\blender\blenkernel\BKE_script.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\source\blender\blenkernel\BKE_sequence.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\source\blender\blenkernel\BKE_shrinkwrap.h"
|
||||
>
|
||||
|
||||
@@ -490,123 +490,123 @@
|
||||
RelativePath="..\..\..\source\blender\blenloader\BLO_undofile.h"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\..\source\blender\blenloader\intern\readblenentry.c"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\..\source\blender\blenloader\intern\readblenentry.c"
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\source\blender\blenloader\intern\readfile.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Blender Debug|Win32"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\source\blender\blenloader\intern\readfile.c"
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="3D Plugin Debug|Win32"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Blender Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="3D Plugin Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="3D Plugin Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Blender Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="BlenderPlayer Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="BlenderPlayer Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\source\blender\blenloader\intern\undofile.c"
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="3D Plugin Release|Win32"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\source\blender\blenloader\intern\writefile.c"
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Blender Release|Win32"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Blender Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="3D Plugin Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="3D Plugin Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Blender Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="BlenderPlayer Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="BlenderPlayer Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="BlenderPlayer Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="BlenderPlayer Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\source\blender\blenloader\intern\undofile.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\source\blender\blenloader\intern\writefile.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Blender Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="3D Plugin Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="3D Plugin Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Blender Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="BlenderPlayer Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="BlenderPlayer Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
|
||||
@@ -3363,10 +3363,10 @@ class ExportFBX(bpy.types.Operator):
|
||||
|
||||
EXP_OBS_SELECTED = BoolProperty(name="Selected Objects", description="Export selected objects on visible layers", default=True)
|
||||
# EXP_OBS_SCENE = BoolProperty(name="Scene Objects", description="Export all objects in this scene", default=True)
|
||||
_SCALE = FloatProperty(name="Scale", description="Scale all data, (Note! some imports dont support scaled armatures)", min=0.01, max=1000.0, soft_min=0.01, soft_max=1000.0, default=1.0)
|
||||
_XROT90 = BoolProperty(name="Rot X90", description="Rotate all objects 90 degrese about the X axis", default=True)
|
||||
_YROT90 = BoolProperty(name="Rot Y90", description="Rotate all objects 90 degrese about the Y axis", default=False)
|
||||
_ZROT90 = BoolProperty(name="Rot Z90", description="Rotate all objects 90 degrese about the Z axis", default=False)
|
||||
TX_SCALE = FloatProperty(name="Scale", description="Scale all data, (Note! some imports dont support scaled armatures)", min=0.01, max=1000.0, soft_min=0.01, soft_max=1000.0, default=1.0)
|
||||
TX_XROT90 = BoolProperty(name="Rot X90", description="Rotate all objects 90 degrese about the X axis", default=True)
|
||||
TX_YROT90 = BoolProperty(name="Rot Y90", description="Rotate all objects 90 degrese about the Y axis", default=False)
|
||||
TX_ZROT90 = BoolProperty(name="Rot Z90", description="Rotate all objects 90 degrese about the Z axis", default=False)
|
||||
EXP_EMPTY = BoolProperty(name="Empties", description="Export empty objects", default=True)
|
||||
EXP_CAMERA = BoolProperty(name="Cameras", description="Export camera objects", default=True)
|
||||
EXP_LAMP = BoolProperty(name="Lamps", description="Export lamp objects", default=True)
|
||||
@@ -3397,10 +3397,10 @@ class ExportFBX(bpy.types.Operator):
|
||||
raise Exception("path not set")
|
||||
|
||||
GLOBAL_MATRIX = mtx4_identity
|
||||
GLOBAL_MATRIX[0][0] = GLOBAL_MATRIX[1][1] = GLOBAL_MATRIX[2][2] = self.properties._SCALE
|
||||
if self.properties._XROT90: GLOBAL_MATRIX = GLOBAL_MATRIX * mtx4_x90n
|
||||
if self.properties._YROT90: GLOBAL_MATRIX = GLOBAL_MATRIX * mtx4_y90n
|
||||
if self.properties._ZROT90: GLOBAL_MATRIX = GLOBAL_MATRIX * mtx4_z90n
|
||||
GLOBAL_MATRIX[0][0] = GLOBAL_MATRIX[1][1] = GLOBAL_MATRIX[2][2] = self.properties.TX_SCALE
|
||||
if self.properties.TX_XROT90: GLOBAL_MATRIX = GLOBAL_MATRIX * mtx4_x90n
|
||||
if self.properties.TX_YROT90: GLOBAL_MATRIX = GLOBAL_MATRIX * mtx4_y90n
|
||||
if self.properties.TX_ZROT90: GLOBAL_MATRIX = GLOBAL_MATRIX * mtx4_z90n
|
||||
|
||||
write(self.properties.path,
|
||||
None, # XXX
|
||||
|
||||
@@ -163,7 +163,7 @@ class ExportMDD(bpy.types.Operator):
|
||||
|
||||
# List of operator properties, the attributes will be assigned
|
||||
# to the class instance from the operator settings before calling.
|
||||
path = StringProperty(name="File Path", description="File path used for exporting the MDD file", maxlen= 1024, default= "tmp.mdd")
|
||||
path = StringProperty(name="File Path", description="File path used for exporting the MDD file", maxlen= 1024, default= "")
|
||||
fps = IntProperty(name="Frames Per Second", description="Number of frames/second", min=minfps, max=maxfps, default= 25)
|
||||
start_frame = IntProperty(name="Start Frame", description="Start frame for baking", min=minframe,max=maxframe,default=1)
|
||||
end_frame = IntProperty(name="End Frame", description="End frame for baking", min=minframe, max=maxframe, default= 250)
|
||||
|
||||
@@ -84,6 +84,16 @@ class RatingUsage(RatingRule):
|
||||
# less usage is better
|
||||
return job.usage / job.priority
|
||||
|
||||
class RatingUsageByCategory(RatingRule):
|
||||
def __init__(self, get_jobs):
|
||||
self.getJobs = get_jobs
|
||||
def rate(self, job):
|
||||
total_category_usage = sum([j.usage for j in self.getJobs() if j.category == job.category])
|
||||
maximum_priority = max([j.priority for j in self.getJobs() if j.category == job.category])
|
||||
|
||||
# less usage is better
|
||||
return total_category_usage / maximum_priority
|
||||
|
||||
class NewJobPriority(PriorityRule):
|
||||
def __init__(self, limit = 1):
|
||||
self.limit = limit
|
||||
|
||||
@@ -150,6 +150,7 @@ def clientSendJob(conn, scene, anim = False):
|
||||
# print(job.files)
|
||||
|
||||
job.name = job_name
|
||||
job.category = netsettings.job_category
|
||||
|
||||
for slave in netrender.blacklist:
|
||||
job.blacklist.append(slave.id)
|
||||
|
||||
@@ -60,17 +60,9 @@ class MRenderSlave(netrender.model.RenderSlave):
|
||||
self.job = None
|
||||
|
||||
class MRenderJob(netrender.model.RenderJob):
|
||||
def __init__(self, job_id, job_type, name, files, chunks = 1, priority = 1, blacklist = []):
|
||||
super().__init__()
|
||||
def __init__(self, job_id, job_info):
|
||||
super().__init__(job_info)
|
||||
self.id = job_id
|
||||
self.type = job_type
|
||||
self.name = name
|
||||
self.files = files
|
||||
self.frames = []
|
||||
self.chunks = chunks
|
||||
self.priority = priority
|
||||
self.usage = 0.0
|
||||
self.blacklist = blacklist
|
||||
self.last_dispatched = time.time()
|
||||
|
||||
# force one chunk for process jobs
|
||||
@@ -80,7 +72,7 @@ class MRenderJob(netrender.model.RenderJob):
|
||||
# special server properties
|
||||
self.last_update = 0
|
||||
self.save_path = ""
|
||||
self.files_map = {path: MRenderFile(path, start, end) for path, start, end in files}
|
||||
self.files_map = {path: MRenderFile(path, start, end) for path, start, end in job_info.files}
|
||||
self.status = JOB_WAITING
|
||||
|
||||
def save(self):
|
||||
@@ -393,7 +385,7 @@ class RenderHandler(http.server.BaseHTTPRequestHandler):
|
||||
|
||||
job_id = self.server.nextJobID()
|
||||
|
||||
job = MRenderJob(job_id, job_info.type, job_info.name, job_info.files, chunks = job_info.chunks, priority = job_info.priority, blacklist = job_info.blacklist)
|
||||
job = MRenderJob(job_id, job_info)
|
||||
|
||||
for frame in job_info.frames:
|
||||
frame = job.addFrame(frame.number, frame.command)
|
||||
@@ -635,6 +627,7 @@ class RenderMasterServer(http.server.HTTPServer):
|
||||
self.slave_timeout = 2
|
||||
|
||||
self.balancer = netrender.balancing.Balancer()
|
||||
self.balancer.addRule(netrender.balancing.RatingUsageByCategory(self.getJobs))
|
||||
self.balancer.addRule(netrender.balancing.RatingUsage())
|
||||
self.balancer.addException(netrender.balancing.ExcludeQueuedEmptyJob())
|
||||
self.balancer.addException(netrender.balancing.ExcludeSlavesLimit(self.countJobs, self.countSlaves, limit = 0.9))
|
||||
@@ -707,6 +700,9 @@ class RenderMasterServer(http.server.HTTPServer):
|
||||
def balance(self):
|
||||
self.balancer.balance(self.jobs)
|
||||
|
||||
def getJobs(self):
|
||||
return self.jobs
|
||||
|
||||
def countJobs(self, status = JOB_QUEUED):
|
||||
total = 0
|
||||
for j in self.jobs:
|
||||
|
||||
@@ -71,6 +71,7 @@ def get(handler):
|
||||
startTable()
|
||||
headerTable(
|
||||
"name",
|
||||
"category",
|
||||
"priority",
|
||||
"usage",
|
||||
"wait",
|
||||
@@ -88,6 +89,7 @@ def get(handler):
|
||||
results = job.framesStatus()
|
||||
rowTable(
|
||||
link(job.name, "/html/job" + job.id),
|
||||
job.category,
|
||||
job.priority,
|
||||
"%0.1f%%" % (job.usage * 100),
|
||||
"%is" % int(time.time() - job.last_dispatched),
|
||||
|
||||
@@ -99,18 +99,29 @@ JOB_TYPES = {
|
||||
}
|
||||
|
||||
class RenderJob:
|
||||
def __init__(self):
|
||||
def __init__(self, job_info = None):
|
||||
self.id = ""
|
||||
self.type = JOB_BLENDER
|
||||
self.name = ""
|
||||
self.category = "None"
|
||||
self.files = []
|
||||
self.frames = []
|
||||
self.chunks = 0
|
||||
self.priority = 0
|
||||
self.usage = 0.0
|
||||
self.blacklist = []
|
||||
|
||||
self.usage = 0.0
|
||||
self.last_dispatched = 0.0
|
||||
|
||||
self.frames = []
|
||||
|
||||
if job_info:
|
||||
self.type = job_info.type
|
||||
self.name = job_info.name
|
||||
self.category = job_info.category
|
||||
self.files = job_info.files
|
||||
self.chunks = job_info.chunks
|
||||
self.priority = job_info.priority
|
||||
self.blacklist = job_info.blacklist
|
||||
|
||||
def addFile(self, file_path, start=-1, end=-1):
|
||||
self.files.append((file_path, start, end))
|
||||
|
||||
@@ -167,6 +178,7 @@ class RenderJob:
|
||||
"id": self.id,
|
||||
"type": self.type,
|
||||
"name": self.name,
|
||||
"category": self.category,
|
||||
"files": [f for f in self.files if f[1] == -1 or not frames or (f[1] <= max_frame and f[2] >= min_frame)],
|
||||
"frames": [f.serialize() for f in self.frames if not frames or f in frames],
|
||||
"chunks": self.chunks,
|
||||
@@ -185,6 +197,7 @@ class RenderJob:
|
||||
job.id = data["id"]
|
||||
job.type = data["type"]
|
||||
job.name = data["name"]
|
||||
job.category = data["category"]
|
||||
job.files = data["files"]
|
||||
job.frames = [RenderFrame.materialize(f) for f in data["frames"]]
|
||||
job.chunks = data["chunks"]
|
||||
|
||||
@@ -71,7 +71,7 @@ class RENDER_PT_network_settings(RenderButtonsPanel):
|
||||
if scene.network_render.mode == "RENDER_MASTER":
|
||||
col.prop(scene.network_render, "server_broadcast")
|
||||
else:
|
||||
col.operator("render.netclientscan", icon="ICON_FILE_REFRESH", text="")
|
||||
col.operator("render.netclientscan", icon='FILE_REFRESH', text="")
|
||||
|
||||
@rnaType
|
||||
class RENDER_PT_network_job(RenderButtonsPanel):
|
||||
@@ -93,10 +93,11 @@ class RENDER_PT_network_job(RenderButtonsPanel):
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
col.operator("render.netclientanim", icon='ICON_RENDER_ANIMATION')
|
||||
col.operator("render.netclientsend", icon="ICON_FILE_BLEND")
|
||||
col.operator("render.netclientweb", icon="ICON_QUESTION")
|
||||
col.operator("render.netclientanim", icon='RENDER_ANIMATION')
|
||||
col.operator("render.netclientsend", icon='FILE_BLEND')
|
||||
col.operator("render.netclientweb", icon='QUESTION')
|
||||
col.prop(scene.network_render, "job_name")
|
||||
col.prop(scene.network_render, "job_category")
|
||||
row = col.row()
|
||||
row.prop(scene.network_render, "priority")
|
||||
row.prop(scene.network_render, "chunks")
|
||||
@@ -120,8 +121,8 @@ class RENDER_PT_network_slaves(RenderButtonsPanel):
|
||||
row.template_list(netsettings, "slaves", netsettings, "active_slave_index", rows=2)
|
||||
|
||||
sub = row.column(align=True)
|
||||
sub.operator("render.netclientslaves", icon="ICON_FILE_REFRESH", text="")
|
||||
sub.operator("render.netclientblacklistslave", icon="ICON_ZOOMOUT", text="")
|
||||
sub.operator("render.netclientslaves", icon='FILE_REFRESH', text="")
|
||||
sub.operator("render.netclientblacklistslave", icon='ZOOMOUT', text="")
|
||||
|
||||
if len(netrender.slaves) == 0 and len(netsettings.slaves) > 0:
|
||||
while(len(netsettings.slaves) > 0):
|
||||
@@ -156,7 +157,7 @@ class RENDER_PT_network_slaves_blacklist(RenderButtonsPanel):
|
||||
row.template_list(netsettings, "slaves_blacklist", netsettings, "active_blacklisted_slave_index", rows=2)
|
||||
|
||||
sub = row.column(align=True)
|
||||
sub.operator("render.netclientwhitelistslave", icon="ICON_ZOOMOUT", text="")
|
||||
sub.operator("render.netclientwhitelistslave", icon='ZOOMOUT', text="")
|
||||
|
||||
if len(netrender.blacklist) == 0 and len(netsettings.slaves_blacklist) > 0:
|
||||
while(len(netsettings.slaves_blacklist) > 0):
|
||||
@@ -191,10 +192,10 @@ class RENDER_PT_network_jobs(RenderButtonsPanel):
|
||||
row.template_list(netsettings, "jobs", netsettings, "active_job_index", rows=2)
|
||||
|
||||
sub = row.column(align=True)
|
||||
sub.operator("render.netclientstatus", icon="ICON_FILE_REFRESH", text="")
|
||||
sub.operator("render.netclientcancel", icon="ICON_ZOOMOUT", text="")
|
||||
sub.operator("render.netclientcancelall", icon="ICON_PANEL_CLOSE", text="")
|
||||
sub.operator("render.netclientdownload", icon='ICON_RENDER_ANIMATION', text="")
|
||||
sub.operator("render.netclientstatus", icon='FILE_REFRESH', text="")
|
||||
sub.operator("render.netclientcancel", icon='ZOOMOUT', text="")
|
||||
sub.operator("render.netclientcancelall", icon='PANEL_CLOSE', text="")
|
||||
sub.operator("render.netclientdownload", icon='RENDER_ANIMATION', text="")
|
||||
|
||||
if len(netrender.jobs) == 0 and len(netsettings.jobs) > 0:
|
||||
while(len(netsettings.jobs) > 0):
|
||||
@@ -264,6 +265,12 @@ NetRenderSettings.StringProperty( attr="job_name",
|
||||
maxlen = 128,
|
||||
default = "[default]")
|
||||
|
||||
NetRenderSettings.StringProperty( attr="job_category",
|
||||
name="Job category",
|
||||
description="Category of the job",
|
||||
maxlen = 128,
|
||||
default = "")
|
||||
|
||||
NetRenderSettings.IntProperty( attr="chunks",
|
||||
name="Chunks",
|
||||
description="Number of frame to dispatch to each slave in one chunk",
|
||||
|
||||
@@ -53,6 +53,23 @@ def clean_name(name, replace="_"):
|
||||
name = name.replace(ch, replace)
|
||||
return name
|
||||
|
||||
def display_name(name):
|
||||
'''
|
||||
Only capitalize all lowercase names, mixed case use them as is.
|
||||
should work with filenames and module names.
|
||||
'''
|
||||
name_base = os.path.splitext(name)[0]
|
||||
|
||||
# string replacements
|
||||
name_base = name_base.replace("_colon_", ":")
|
||||
|
||||
name_base = name_base.replace("_", " ")
|
||||
|
||||
if name_base.lower() == name_base:
|
||||
return ' '.join([w[0].upper() + w[1:] for w in name_base.split()])
|
||||
else:
|
||||
return name_base
|
||||
|
||||
|
||||
# base scripts
|
||||
_scripts = os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir)
|
||||
|
||||
@@ -288,21 +288,7 @@ class Menu(StructRNA):
|
||||
# hard coded to set the operators 'path' to the filename.
|
||||
|
||||
import os
|
||||
|
||||
def path_to_name(f):
|
||||
''' Only capitalize all lowercase names, mixed case use them as is.
|
||||
'''
|
||||
f_base = os.path.splitext(f)[0]
|
||||
|
||||
# string replacements
|
||||
f_base = f_base.replace("_colon_", ":")
|
||||
|
||||
f_base = f_base.replace("_", " ")
|
||||
|
||||
if f_base.lower() == f_base:
|
||||
return ' '.join([w[0].upper() + w[1:] for w in f_base.split()])
|
||||
else:
|
||||
return f_base
|
||||
import bpy.utils
|
||||
|
||||
layout = self.layout
|
||||
|
||||
@@ -318,7 +304,7 @@ class Menu(StructRNA):
|
||||
if f.startswith("."):
|
||||
continue
|
||||
|
||||
layout.operator(operator, text=path_to_name(f)).path = path
|
||||
layout.operator(operator, text=bpy.utils.display_name(f)).path = path
|
||||
|
||||
def draw_preset(self, context):
|
||||
'''Define these on the subclass
|
||||
|
||||
@@ -48,7 +48,7 @@ def compat_str(text, line_length=0):
|
||||
#text = text.replace(']', ']\n')
|
||||
text = text.replace("\n", "\\n")
|
||||
text = text.replace('"', '\\"')
|
||||
return "* " + text
|
||||
return text
|
||||
|
||||
|
||||
def graph_armature(obj, path, FAKE_PARENT=True, CONSTRAINTS=True, DRIVERS=True, XTRA_INFO=True):
|
||||
@@ -150,16 +150,16 @@ def graph_armature(obj, path, FAKE_PARENT=True, CONSTRAINTS=True, DRIVERS=True,
|
||||
if animation_data:
|
||||
|
||||
fcurve_drivers = [fcurve_driver for fcurve_driver in animation_data.drivers]
|
||||
fcurve_drivers.sort(key=lambda fcurve_driver: fcurve_driver.rna_path)
|
||||
fcurve_drivers.sort(key=lambda fcurve_driver: fcurve_driver.data_path)
|
||||
|
||||
for fcurve_driver in fcurve_drivers:
|
||||
rna_path = fcurve_driver.rna_path
|
||||
rna_path = fcurve_driver.data_path
|
||||
pbone = rna_path_as_pbone(rna_path)
|
||||
|
||||
if pbone:
|
||||
for target in fcurve_driver.driver.targets:
|
||||
pbone_target = rna_path_as_pbone(target.rna_path)
|
||||
rna_path_target = target.rna_path
|
||||
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"] # ,
|
||||
display_source = rna_path.replace("pose.bones", "")
|
||||
|
||||
@@ -23,376 +23,96 @@ from Mathutils import Vector
|
||||
|
||||
# TODO, have these in a more general module
|
||||
from rna_prop_ui import rna_idprop_ui_prop_get
|
||||
SPECIAL_TYPES = "root",
|
||||
|
||||
empty_layer = [False] * 32
|
||||
class RigifyError(Exception):
|
||||
"""Exception raised for errors in the metarig.
|
||||
"""
|
||||
def __init__(self, message):
|
||||
self.message = message
|
||||
def __str__(self):
|
||||
return repr(self.message)
|
||||
|
||||
def submodule_func_from_type(bone_type):
|
||||
type_pair = bone_type.split(".")
|
||||
|
||||
def auto_class(slots, name="ContainerClass", class_dict=None):
|
||||
# 'leg.ik' will look for an ik function in the leg module
|
||||
# 'leg' will look up leg.main
|
||||
if len(type_pair) == 1:
|
||||
type_pair = type_pair[0], "main"
|
||||
|
||||
if class_dict:
|
||||
class_dict = class_dict.copy()
|
||||
else:
|
||||
class_dict = {}
|
||||
submod_name, func_name = type_pair
|
||||
|
||||
class_dict["__slots__"] = tuple(slots)
|
||||
|
||||
return type(name, (object,), class_dict)
|
||||
|
||||
|
||||
def auto_class_instance(slots, name="ContainerClass", class_dict=None):
|
||||
return auto_class(slots, name, class_dict)()
|
||||
|
||||
|
||||
def _bone_class_instance_update(self):
|
||||
''' Re-Assigns bones from the blender data
|
||||
'''
|
||||
arm = self.obj.data
|
||||
bbones = arm.bones
|
||||
pbones = self.obj.pose.bones
|
||||
ebones = arm.edit_bones
|
||||
|
||||
for member in self.attr_names:
|
||||
name = getattr(self, member, None)
|
||||
if name is not None:
|
||||
setattr(self, member + "_b", bbones.get(name, None))
|
||||
setattr(self, member + "_p", pbones.get(name, None))
|
||||
setattr(self, member + "_e", ebones.get(name, None))
|
||||
|
||||
|
||||
def _bone_class_instance_rename(self, attr, new_name):
|
||||
''' Rename bones, editmode only
|
||||
'''
|
||||
|
||||
if self.obj.mode != 'EDIT':
|
||||
raise Exception("Only rename in editmode supported")
|
||||
|
||||
ebone = getattr(self, attr + "_e")
|
||||
ebone.name = new_name
|
||||
|
||||
# we may not get what is asked for so get the name from the editbone
|
||||
setattr(self, attr, ebone.name)
|
||||
|
||||
|
||||
def _bone_class_instance_copy(self, from_fmt="%s", to_fmt="%s", exclude_attrs=(), base_names=None):
|
||||
from_name_ls = []
|
||||
new_name_ls = []
|
||||
new_slot_ls = []
|
||||
|
||||
for attr in self.attr_names:
|
||||
# from rigify import leg
|
||||
try:
|
||||
submod = __import__(name="%s.%s" % (__package__, submod_name), fromlist=[submod_name])
|
||||
except ImportError:
|
||||
raise RigifyError("python module for type '%s' not found" % submod_name)
|
||||
|
||||
if attr in exclude_attrs:
|
||||
continue
|
||||
reload(submod)
|
||||
return submod, getattr(submod, func_name)
|
||||
|
||||
|
||||
def submodule_types():
|
||||
import os
|
||||
submodules = []
|
||||
files = os.listdir(os.path.dirname(__file__))
|
||||
for f in files:
|
||||
if not f.startswith("_") and f.endswith(".py"):
|
||||
submodules.append(f[:-3])
|
||||
|
||||
return sorted(submodules)
|
||||
|
||||
|
||||
def validate_rig(context, obj):
|
||||
'''
|
||||
Makes no changes
|
||||
only runs the metarig definitions and reports errors
|
||||
'''
|
||||
type_found = False
|
||||
|
||||
for pbone in obj.pose.bones:
|
||||
bone_name = pbone.name
|
||||
bone_type = pbone.get("type", "")
|
||||
|
||||
if bone_type:
|
||||
bone_type_list = [bt for bt in bone_type.replace(",", " ").split()]
|
||||
else:
|
||||
bone_type_list = []
|
||||
|
||||
for bone_type in bone_type_list:
|
||||
if bone_type.split(".")[0] in SPECIAL_TYPES:
|
||||
continue
|
||||
|
||||
submod, type_func = submodule_func_from_type(bone_type)
|
||||
reload(submod)
|
||||
submod.metarig_definition(obj, bone_name)
|
||||
type_found = True
|
||||
|
||||
bone_name_orig = getattr(self, attr)
|
||||
ebone = getattr(self, attr + "_e")
|
||||
# orig_names[attr] = bone_name_orig
|
||||
|
||||
# insert formatting
|
||||
if from_fmt != "%s":
|
||||
bone_name = from_fmt % bone_name_orig
|
||||
ebone.name = bone_name
|
||||
bone_name = ebone.name # cant be sure we get what we ask for
|
||||
else:
|
||||
bone_name = bone_name_orig
|
||||
|
||||
setattr(self, attr, bone_name)
|
||||
|
||||
new_slot_ls.append(attr)
|
||||
from_name_ls.append(bone_name)
|
||||
if base_names:
|
||||
bone_name_orig = base_names[bone_name_orig]
|
||||
new_name_ls.append(to_fmt % bone_name_orig)
|
||||
|
||||
new_bones = copy_bone_simple_list(self.obj.data, from_name_ls, new_name_ls, True)
|
||||
new_bc = bone_class_instance(self.obj, new_slot_ls)
|
||||
|
||||
for i, attr in enumerate(new_slot_ls):
|
||||
ebone = new_bones[i]
|
||||
setattr(new_bc, attr + "_e", ebone)
|
||||
setattr(new_bc, attr, ebone.name)
|
||||
|
||||
return new_bc
|
||||
|
||||
|
||||
def _bone_class_instance_names(self):
|
||||
return [getattr(self, attr) for attr in self.attr_names]
|
||||
|
||||
|
||||
def _bone_class_instance_blend(self, from_bc, to_bc, target_bone=None, target_prop="blend"):
|
||||
'''
|
||||
Use for blending bone chains.
|
||||
|
||||
blend_target = (bone_name, bone_property)
|
||||
default to the last bone, blend prop
|
||||
|
||||
XXX - toggles editmode, need to re-validate all editbones :(
|
||||
'''
|
||||
|
||||
if self.attr_names != from_bc.attr_names or self.attr_names != to_bc.attr_names:
|
||||
raise Exception("can only blend between matching chains")
|
||||
|
||||
apply_bones = [getattr(self, attr) for attr in self.attr_names]
|
||||
from_bones = [getattr(from_bc, attr) for attr in from_bc.attr_names]
|
||||
to_bones = [getattr(to_bc, attr) for attr in to_bc.attr_names]
|
||||
|
||||
blend_bone_list(self.obj, apply_bones, from_bones, to_bones, target_bone, target_prop)
|
||||
|
||||
|
||||
def bone_class_instance(obj, slots, name="BoneContainer"):
|
||||
# missing, - check for duplicate root bone.
|
||||
|
||||
if len(slots) != len(set(slots)):
|
||||
raise Exception("duplicate entries found %s" % attr_names)
|
||||
|
||||
attr_names = tuple(slots) # dont modify the original
|
||||
slots = list(slots) # dont modify the original
|
||||
for i in range(len(slots)):
|
||||
member = slots[i]
|
||||
slots.append(member + "_b") # bone bone
|
||||
slots.append(member + "_p") # pose bone
|
||||
slots.append(member + "_e") # edit bone
|
||||
|
||||
class_dict = { \
|
||||
"obj": obj, \
|
||||
"attr_names": attr_names, \
|
||||
"update": _bone_class_instance_update, \
|
||||
"rename": _bone_class_instance_rename, \
|
||||
"names": _bone_class_instance_names, \
|
||||
"copy": _bone_class_instance_copy, \
|
||||
"blend": _bone_class_instance_blend, \
|
||||
}
|
||||
|
||||
instance = auto_class_instance(slots, name, class_dict)
|
||||
return instance
|
||||
|
||||
|
||||
def get_bone_data(obj, bone_name):
|
||||
arm = obj.data
|
||||
pbone = obj.pose.bones[bone_name]
|
||||
if obj.mode == 'EDIT':
|
||||
bone = arm.edit_bones[bone_name]
|
||||
else:
|
||||
bone = arm.bones[bone_name]
|
||||
|
||||
return arm, pbone, bone
|
||||
|
||||
|
||||
def copy_bone_simple(arm, from_bone, name, parent=False):
|
||||
ebone = arm.edit_bones[from_bone]
|
||||
ebone_new = arm.edit_bones.new(name)
|
||||
|
||||
if parent:
|
||||
ebone_new.connected = ebone.connected
|
||||
ebone_new.parent = ebone.parent
|
||||
|
||||
ebone_new.head = ebone.head
|
||||
ebone_new.tail = ebone.tail
|
||||
ebone_new.roll = ebone.roll
|
||||
return ebone_new
|
||||
|
||||
|
||||
def copy_bone_simple_list(arm, from_bones, to_bones, parent=False):
|
||||
|
||||
if len(from_bones) != len(to_bones):
|
||||
raise Exception("bone list sizes must match")
|
||||
|
||||
copy_bones = [copy_bone_simple(arm, bone_name, to_bones[i], True) for i, bone_name in enumerate(from_bones)]
|
||||
|
||||
# now we need to re-parent
|
||||
for ebone in copy_bones:
|
||||
parent = ebone.parent
|
||||
if parent:
|
||||
try:
|
||||
i = from_bones.index(parent.name)
|
||||
except:
|
||||
i = -1
|
||||
|
||||
if i == -1:
|
||||
ebone.parent = None
|
||||
else:
|
||||
ebone.parent = copy_bones[i]
|
||||
|
||||
return copy_bones
|
||||
|
||||
|
||||
def blend_bone_list(obj, apply_bones, from_bones, to_bones, target_bone=None, target_prop="blend"):
|
||||
|
||||
if obj.mode == 'EDIT':
|
||||
raise Exception("blending cant be called in editmode")
|
||||
|
||||
if len(apply_bones) != len(from_bones):
|
||||
raise Exception("lists differ in length (from -> apply): \n\t%s\n\t%s" % (from_bones, apply_bones))
|
||||
if len(apply_bones) != len(to_bones):
|
||||
raise Exception("lists differ in length (to -> apply): \n\t%s\n\t%s" % (to_bones, apply_bones))
|
||||
|
||||
# setup the blend property
|
||||
if target_bone is None:
|
||||
target_bone = apply_bones[-1] # default to the last bone
|
||||
|
||||
prop_pbone = obj.pose.bones[target_bone]
|
||||
if prop_pbone.get(target_bone, None) is None:
|
||||
prop = rna_idprop_ui_prop_get(prop_pbone, target_prop, create=True)
|
||||
prop_pbone[target_prop] = 0.5
|
||||
prop["soft_min"] = 0.0
|
||||
prop["soft_max"] = 1.0
|
||||
|
||||
driver_path = prop_pbone.path_to_id() + ('["%s"]' % target_prop)
|
||||
|
||||
def blend_target(driver):
|
||||
tar = driver.targets.new()
|
||||
tar.name = target_bone
|
||||
tar.id_type = 'OBJECT'
|
||||
tar.id = obj
|
||||
tar.rna_path = driver_path
|
||||
|
||||
def blend_location(new_pbone, from_bone_name, to_bone_name):
|
||||
con = new_pbone.constraints.new('COPY_LOCATION')
|
||||
con.target = obj
|
||||
con.subtarget = from_bone_name
|
||||
|
||||
con = new_pbone.constraints.new('COPY_LOCATION')
|
||||
con.target = obj
|
||||
con.subtarget = to_bone_name
|
||||
|
||||
fcurve = con.driver_add("influence", 0)
|
||||
driver = fcurve.driver
|
||||
driver.type = 'AVERAGE'
|
||||
fcurve.modifiers.remove(0) # grr dont need a modifier
|
||||
|
||||
blend_target(driver)
|
||||
|
||||
def blend_rotation(new_pbone, from_bone_name, to_bone_name):
|
||||
con = new_pbone.constraints.new('COPY_ROTATION')
|
||||
con.target = obj
|
||||
con.subtarget = from_bone_name
|
||||
|
||||
con = new_pbone.constraints.new('COPY_ROTATION')
|
||||
con.target = obj
|
||||
con.subtarget = to_bone_name
|
||||
|
||||
fcurve = con.driver_add("influence", 0)
|
||||
driver = fcurve.driver
|
||||
driver.type = 'AVERAGE'
|
||||
fcurve.modifiers.remove(0) # grr dont need a modifier
|
||||
|
||||
blend_target(driver)
|
||||
|
||||
for i, new_bone_name in enumerate(apply_bones):
|
||||
from_bone_name = from_bones[i]
|
||||
to_bone_name = to_bones[i]
|
||||
|
||||
# allow skipping some bones by having None in the list
|
||||
if None in (new_bone_name, from_bone_name, to_bone_name):
|
||||
continue
|
||||
|
||||
new_pbone = obj.pose.bones[new_bone_name]
|
||||
|
||||
# if the bone is connected or its location is totally locked then dont add location blending.
|
||||
if not (new_pbone.bone.connected or (False not in new_pbone.lock_location)):
|
||||
blend_location(new_pbone, from_bone_name, to_bone_name)
|
||||
|
||||
if not (False not in new_pbone.lock_rotation): # TODO. 4D chech?
|
||||
blend_rotation(new_pbone, from_bone_name, to_bone_name)
|
||||
|
||||
|
||||
def add_stretch_to(obj, from_name, to_name, name):
|
||||
'''
|
||||
Adds a bone that stretches from one to another
|
||||
'''
|
||||
|
||||
mode_orig = obj.mode
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
|
||||
arm = obj.data
|
||||
stretch_ebone = arm.edit_bones.new(name)
|
||||
stretch_name = stretch_ebone.name
|
||||
del name
|
||||
|
||||
head = stretch_ebone.head = arm.edit_bones[from_name].head.copy()
|
||||
#tail = stretch_ebone.tail = arm.edit_bones[to_name].head.copy()
|
||||
|
||||
# annoying exception for zero length bones, since its using stretch_to the rest pose doesnt really matter
|
||||
#if (head - tail).length < 0.1:
|
||||
if 1:
|
||||
tail = stretch_ebone.tail = arm.edit_bones[from_name].tail.copy()
|
||||
|
||||
|
||||
# Now for the constraint
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
|
||||
stretch_pbone = obj.pose.bones[stretch_name]
|
||||
|
||||
con = stretch_pbone.constraints.new('COPY_LOCATION')
|
||||
con.target = obj
|
||||
con.subtarget = from_name
|
||||
|
||||
con = stretch_pbone.constraints.new('STRETCH_TO')
|
||||
con.target = obj
|
||||
con.subtarget = to_name
|
||||
con.original_length = (head - tail).length
|
||||
con.keep_axis = 'PLANE_X'
|
||||
con.volume = 'NO_VOLUME'
|
||||
|
||||
bpy.ops.object.mode_set(mode=mode_orig)
|
||||
|
||||
return stretch_name
|
||||
|
||||
def add_pole_target_bone(obj, base_name, name, mode='CROSS'):
|
||||
'''
|
||||
Does not actually create a poll target, just the bone to use as a poll target
|
||||
'''
|
||||
mode_orig = obj.mode
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
|
||||
arm = obj.data
|
||||
|
||||
poll_ebone = arm.edit_bones.new(base_name + "_poll")
|
||||
base_ebone = arm.edit_bones[base_name]
|
||||
poll_name = poll_ebone.name
|
||||
parent_ebone = base_ebone.parent
|
||||
|
||||
base_head = base_ebone.head.copy()
|
||||
base_tail = base_ebone.tail.copy()
|
||||
base_dir = base_head - base_tail
|
||||
|
||||
parent_head = parent_ebone.head.copy()
|
||||
parent_tail = parent_ebone.tail.copy()
|
||||
parent_dir = parent_head - parent_tail
|
||||
|
||||
distance = (base_dir.length + parent_dir.length)
|
||||
|
||||
if mode == 'CROSS':
|
||||
# direction from the angle of the joint
|
||||
offset = base_dir.copy().normalize() - parent_dir.copy().normalize()
|
||||
offset.length = distance
|
||||
elif mode == 'ZAVERAGE':
|
||||
# between both bones Z axis
|
||||
z_axis_a = base_ebone.matrix.copy().rotationPart() * Vector(0.0, 0.0, -1.0)
|
||||
z_axis_b = parent_ebone.matrix.copy().rotationPart() * Vector(0.0, 0.0, -1.0)
|
||||
offset = (z_axis_a + z_axis_b).normalize() * distance
|
||||
else:
|
||||
# preset axis
|
||||
offset = Vector(0, 0, 0)
|
||||
if mode[0] == "+":
|
||||
val = distance
|
||||
else:
|
||||
val = - distance
|
||||
|
||||
setattr(offset, mode[1].lower(), val)
|
||||
|
||||
poll_ebone.head = base_head + offset
|
||||
poll_ebone.tail = base_head + (offset * (1.0 - (1.0 / 4.0)))
|
||||
|
||||
bpy.ops.object.mode_set(mode=mode_orig)
|
||||
|
||||
return poll_name
|
||||
if not type_found:
|
||||
raise RigifyError("This rig has no 'type' properties defined on any pose bones, nothing to do")
|
||||
|
||||
|
||||
def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
|
||||
'''
|
||||
Main function for generating
|
||||
'''
|
||||
from collections import OrderedDict
|
||||
import rigify_utils
|
||||
reload(rigify_utils)
|
||||
|
||||
# Not needed but catches any errors before duplicating
|
||||
validate_rig(context, obj_orig)
|
||||
|
||||
global_undo = context.user_preferences.edit.global_undo
|
||||
context.user_preferences.edit.global_undo = False
|
||||
|
||||
mode_orig = context.mode
|
||||
rest_backup = obj_orig.data.pose_position
|
||||
obj_orig.data.pose_position = 'REST'
|
||||
|
||||
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
|
||||
scene = context.scene
|
||||
@@ -404,7 +124,7 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
|
||||
scene.objects.link(obj)
|
||||
scene.objects.active = obj
|
||||
obj.selected = True
|
||||
|
||||
|
||||
if META_DEF:
|
||||
obj_def = obj_orig.copy()
|
||||
obj_def.data = obj_orig.data.copy()
|
||||
@@ -435,6 +155,12 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
|
||||
# value: [functions, ...]
|
||||
# each function is from the module. eg leg.ik, arm.main
|
||||
bone_typeinfos = {}
|
||||
|
||||
# key: bone name
|
||||
# value: [new_bone_name, ...]
|
||||
# where each bone with a 'type' stores a list of bones that it created
|
||||
# ...needed so we can override the root parent
|
||||
bone_genesis = {}
|
||||
|
||||
# inspect all bones and assign their definitions before modifying
|
||||
for pbone in obj.pose.bones:
|
||||
@@ -455,31 +181,17 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
|
||||
bone_type_list[:] = []
|
||||
|
||||
for bone_type in bone_type_list:
|
||||
|
||||
type_pair = bone_type.split(".")
|
||||
|
||||
# 'leg.ik' will look for an ik function in the leg module
|
||||
# 'leg' will look up leg.main
|
||||
if len(type_pair) == 1:
|
||||
type_pair = type_pair[0], "main"
|
||||
|
||||
submod_name, func_name = type_pair
|
||||
|
||||
# from rigify import leg
|
||||
submod = __import__(name="%s.%s" % (__package__, submod_name), fromlist=[submod_name])
|
||||
submod, type_func = submodule_func_from_type(bone_type)
|
||||
reload(submod)
|
||||
|
||||
submod_name = submod.__name__
|
||||
|
||||
bone_def_dict = bone_definitions.setdefault(bone_name, {})
|
||||
|
||||
# Only calculate bone definitions once
|
||||
if submod_name not in bone_def_dict:
|
||||
metarig_definition_func = getattr(submod, "metarig_definition")
|
||||
bone_def_dict[submod_name] = metarig_definition_func(obj, bone_name)
|
||||
|
||||
bone_def_dict[submod_name] = submod.metarig_definition(obj, bone_name)
|
||||
|
||||
bone_typeinfo = bone_typeinfos.setdefault(bone_name, [])
|
||||
|
||||
type_func = getattr(submod, func_name)
|
||||
bone_typeinfo.append((submod_name, type_func))
|
||||
|
||||
|
||||
@@ -501,6 +213,8 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
|
||||
# Only blend results from the same submodule, eg.
|
||||
# leg.ik and arm.fk could not be blended.
|
||||
results = OrderedDict()
|
||||
|
||||
bone_names_pre = set([bone.name for bone in arm.bones])
|
||||
|
||||
for submod_name, type_func in bone_typeinfos[bone_name]:
|
||||
# this bones definition of the current typeinfo
|
||||
@@ -525,15 +239,41 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
|
||||
if len(result_submod) == 2:
|
||||
blend_bone_list(obj, definition, result_submod[0], result_submod[1], target_bone=bone_name)
|
||||
|
||||
|
||||
bone_names_post = set([bone.name for bone in arm.bones])
|
||||
|
||||
# Store which bones were created from this one
|
||||
bone_genesis[bone_name] = list(bone_names_post - bone_names_pre)
|
||||
|
||||
# need a reverse lookup on bone_genesis so as to know immediately
|
||||
# where a bone comes from
|
||||
bone_genesis_reverse = {}
|
||||
for bone_name, bone_children in bone_genesis.items():
|
||||
for bone_child_name in bone_children:
|
||||
bone_genesis_reverse[bone_child_name] = bone_name
|
||||
|
||||
|
||||
if root_bone:
|
||||
# assign all new parentless bones to this
|
||||
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
root_ebone = arm.edit_bones[root_bone]
|
||||
for ebone in arm.edit_bones:
|
||||
if ebone.parent is None and ebone.name not in base_names:
|
||||
bone_name = ebone.name
|
||||
if ebone.parent is None and bone_name not in base_names:
|
||||
# check for override
|
||||
bone_creator = bone_genesis_reverse[bone_name]
|
||||
pbone_creator = obj.pose.bones[bone_creator]
|
||||
root_bone_override = pbone_creator.get("root", "")
|
||||
|
||||
if root_bone_override:
|
||||
root_ebone_tmp = arm.edit_bones[root_bone_override]
|
||||
else:
|
||||
root_ebone_tmp = root_ebone
|
||||
|
||||
ebone.connected = False
|
||||
ebone.parent = root_ebone
|
||||
ebone.parent = root_ebone_tmp
|
||||
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
|
||||
|
||||
@@ -552,75 +292,24 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
|
||||
con.target = obj
|
||||
con.subtarget = bone_name
|
||||
|
||||
# would be 'REST' from when copied
|
||||
obj_def.data.pose_position = 'POSE'
|
||||
|
||||
# Only for demo'ing
|
||||
|
||||
# obj.restrict_view = True
|
||||
obj.data.draw_axes = False
|
||||
|
||||
bpy.ops.object.mode_set(mode=mode_orig)
|
||||
obj_orig.data.pose_position = rest_backup
|
||||
obj.data.pose_position = 'POSE'
|
||||
context.user_preferences.edit.global_undo = global_undo
|
||||
|
||||
|
||||
|
||||
return obj
|
||||
|
||||
|
||||
def write_meta_rig(obj, func_name="metarig_template"):
|
||||
''' Must be in editmode
|
||||
'''
|
||||
code = []
|
||||
|
||||
code.append("def %s():" % func_name)
|
||||
code.append(" # generated by rigify.write_meta_rig")
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
code.append(" bpy.ops.object.mode_set(mode='EDIT')")
|
||||
|
||||
code.append(" obj = bpy.context.object")
|
||||
code.append(" arm = obj.data")
|
||||
|
||||
arm = obj.data
|
||||
# write parents first
|
||||
bones = [(len(bone.parent_recursive), bone.name) for bone in arm.edit_bones]
|
||||
bones.sort(key=lambda item: item[0])
|
||||
bones = [item[1] for item in bones]
|
||||
|
||||
|
||||
for bone_name in bones:
|
||||
bone = arm.edit_bones[bone_name]
|
||||
code.append(" bone = arm.edit_bones.new('%s')" % bone.name)
|
||||
code.append(" bone.head[:] = %.4f, %.4f, %.4f" % bone.head.toTuple(4))
|
||||
code.append(" bone.tail[:] = %.4f, %.4f, %.4f" % bone.tail.toTuple(4))
|
||||
code.append(" bone.roll = %.4f" % bone.roll)
|
||||
code.append(" bone.connected = %s" % str(bone.connected))
|
||||
if bone.parent:
|
||||
code.append(" bone.parent = arm.edit_bones['%s']" % bone.parent.name)
|
||||
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
code.append("")
|
||||
code.append(" bpy.ops.object.mode_set(mode='OBJECT')")
|
||||
|
||||
for bone_name in bones:
|
||||
pbone = obj.pose.bones[bone_name]
|
||||
pbone_written = False
|
||||
|
||||
# Only 1 level of props, simple types supported
|
||||
for key, value in pbone.items():
|
||||
if key.startswith("_"):
|
||||
continue
|
||||
|
||||
if type(value) not in (float, str, int):
|
||||
print("Unsupported ID Prop:", str((key, value)))
|
||||
continue
|
||||
|
||||
if type(value) == str:
|
||||
value = "'" + value + "'"
|
||||
|
||||
if not pbone_written: # only write bones we need
|
||||
code.append(" pbone = obj.pose.bones['%s']" % bone_name)
|
||||
|
||||
code.append(" pbone['%s'] = %s" % (key, value))
|
||||
|
||||
return "\n".join(code)
|
||||
|
||||
|
||||
def generate_test(context):
|
||||
def generate_test(context, metarig_type="", GENERATE_FINAL=True):
|
||||
import os
|
||||
new_objects = []
|
||||
|
||||
@@ -632,53 +321,58 @@ def generate_test(context):
|
||||
obj_new.data = armature
|
||||
scene.objects.link(obj_new)
|
||||
scene.objects.active = obj_new
|
||||
for obj in scene.objects:
|
||||
obj.selected = False
|
||||
obj_new.selected = True
|
||||
|
||||
files = os.listdir(os.path.dirname(__file__))
|
||||
for f in files:
|
||||
if f.startswith("_"):
|
||||
for module_name in submodule_types():
|
||||
if (metarig_type and module_name != metarig_type):
|
||||
continue
|
||||
|
||||
if not f.endswith(".py"):
|
||||
continue
|
||||
|
||||
module_name = f[:-3]
|
||||
submodule = __import__(name="%s.%s" % (__package__, module_name), fromlist=[module_name])
|
||||
|
||||
submodule, func = submodule_func_from_type(module_name)
|
||||
|
||||
metarig_template = getattr(submodule, "metarig_template", None)
|
||||
|
||||
if metarig_template:
|
||||
create_empty_armature("meta_" + module_name) # sets active
|
||||
metarig_template()
|
||||
obj = context.object
|
||||
obj_new = generate_rig(context, obj)
|
||||
|
||||
new_objects.append((obj, obj_new))
|
||||
obj = context.active_object
|
||||
obj.location = scene.cursor_location
|
||||
|
||||
if GENERATE_FINAL:
|
||||
obj_new = generate_rig(context, obj)
|
||||
new_objects.append((obj, obj_new))
|
||||
else:
|
||||
new_objects.append((obj, None))
|
||||
else:
|
||||
print("note: rig type '%s' has no metarig_template(), can't test this", module_name)
|
||||
|
||||
return new_objects
|
||||
|
||||
|
||||
def generate_test_all(context):
|
||||
def generate_test_all(context, GRAPH=False):
|
||||
import rigify
|
||||
import rigify_utils
|
||||
import graphviz_export
|
||||
import os
|
||||
reload(rigify)
|
||||
reload(rigify_utils)
|
||||
reload(graphviz_export)
|
||||
|
||||
new_objects = rigify.generate_test(context)
|
||||
|
||||
if GRAPH:
|
||||
base_name = os.path.splitext(bpy.data.filename)[0]
|
||||
for obj, obj_new in new_objects:
|
||||
for obj in (obj, obj_new):
|
||||
fn = base_name + "-" + bpy.utils.clean_name(obj.name)
|
||||
|
||||
base_name = os.path.splitext(bpy.data.filename)[0]
|
||||
for obj, obj_new in new_objects:
|
||||
for obj in (obj, obj_new):
|
||||
fn = base_name + "-" + bpy.utils.clean_name(obj.name)
|
||||
path_dot = fn + ".dot"
|
||||
path_png = fn + ".png"
|
||||
saved = graphviz_export.graph_armature(obj, path_dot, CONSTRAINTS=True, DRIVERS=True)
|
||||
|
||||
path_dot = fn + ".dot"
|
||||
path_png = fn + ".png"
|
||||
saved = graphviz_export.graph_armature(obj, path_dot, CONSTRAINTS=True, DRIVERS=True)
|
||||
|
||||
#if saved:
|
||||
# os.system("dot -Tpng %s > %s; eog %s" % (path_dot, path_png, path_png))
|
||||
#if saved:
|
||||
# os.system("dot -Tpng %s > %s; eog %s" % (path_dot, path_png, path_png))
|
||||
|
||||
i = 0
|
||||
for obj, obj_new in new_objects:
|
||||
@@ -691,4 +385,4 @@ def generate_test_all(context):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
generate_rig(bpy.context, bpy.context.object)
|
||||
generate_rig(bpy.context, bpy.context.active_object)
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
from rigify import bone_class_instance, copy_bone_simple, add_pole_target_bone, add_stretch_to, blend_bone_list
|
||||
from rigify import RigifyError
|
||||
from rigify_utils import bone_class_instance, copy_bone_simple, add_pole_target_bone, add_stretch_to, blend_bone_list, get_side_name, get_base_name
|
||||
from rna_prop_ui import rna_idprop_ui_prop_get
|
||||
from Mathutils import Vector
|
||||
|
||||
@@ -29,7 +30,7 @@ METARIG_NAMES = "shoulder", "arm", "forearm", "hand"
|
||||
def metarig_template():
|
||||
# generated by rigify.write_meta_rig
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
obj = bpy.context.object
|
||||
obj = bpy.context.active_object
|
||||
arm = obj.data
|
||||
bone = arm.edit_bones.new('shoulder')
|
||||
bone.head[:] = 0.0000, -0.4515, 0.0000
|
||||
@@ -57,7 +58,7 @@ def metarig_template():
|
||||
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
pbone = obj.pose.bones['upper_arm']
|
||||
pbone['type'] = 'arm'
|
||||
pbone['type'] = 'arm_biped_generic'
|
||||
|
||||
|
||||
def metarig_definition(obj, orig_bone_name):
|
||||
@@ -68,10 +69,7 @@ def metarig_definition(obj, orig_bone_name):
|
||||
mt.shoulder_p = mt.arm_p.parent
|
||||
|
||||
if not mt.shoulder_p:
|
||||
raise Exception("could not find '%s' parent, skipping:" % orig_bone_name)
|
||||
|
||||
if mt.arm_p.parent.bone.connected:
|
||||
raise Exception("expected '%s' to be disconnected from its parent" % orig_bone_name)
|
||||
raise RigifyError("could not find '%s' parent, skipping:" % orig_bone_name)
|
||||
|
||||
mt.shoulder = mt.shoulder_p.name
|
||||
|
||||
@@ -79,11 +77,11 @@ def metarig_definition(obj, orig_bone_name):
|
||||
hands = []
|
||||
for pbone in obj.pose.bones:
|
||||
index = pbone.parent_index(mt.arm_p)
|
||||
if index == 2:
|
||||
if index == 2 and pbone.bone.connected and pbone.bone.parent.connected:
|
||||
hands.append(pbone)
|
||||
|
||||
if len(hands) != 1:
|
||||
raise Exception("Expected more then 1 hand found on:", orig_bone_name)
|
||||
raise RigifyError("Found %s possible hands attached to this arm, expected 1 from bone: %s" % ([pbone.name for pbone in hands], orig_bone_name))
|
||||
|
||||
# first add the 2 new bones
|
||||
mt.hand_p = hands[0]
|
||||
@@ -106,12 +104,18 @@ def ik(obj, definitions, base_names):
|
||||
# IK needs no parent_index
|
||||
ik_chain.hand_e.connected = False
|
||||
ik_chain.hand_e.parent = None
|
||||
ik_chain.hand_e.local_location = False
|
||||
ik_chain.rename("hand", get_base_name(base_names[mt.hand]) + "_ik" + get_side_name(mt.hand))
|
||||
|
||||
ik_chain.arm_e.connected = False
|
||||
ik_chain.arm_e.parent = mt.shoulder_e
|
||||
|
||||
# Add the bone used for the arms poll target
|
||||
ik.pole = add_pole_target_bone(obj, mt.forearm, "elbow_poll", mode='ZAVERAGE')
|
||||
#ik.pole = add_pole_target_bone(obj, mt.forearm, get_base_name(base_names[mt.forearm]) + "_target" + get_side_name(mt.forearm), mode='ZAVERAGE')
|
||||
ik.pole = add_pole_target_bone(obj, mt.forearm, "elbow_target" + get_side_name(mt.forearm), mode='ZAVERAGE')
|
||||
|
||||
ik.update()
|
||||
ik.pole_e.local_location = False
|
||||
|
||||
# update bones after this!
|
||||
ik.hand_vis = add_stretch_to(obj, mt.hand, ik_chain.hand, "VIS-%s_ik" % base_names[mt.hand])
|
||||
@@ -178,7 +182,7 @@ def fk(obj, definitions, base_names):
|
||||
ex.socket = ex.socket_e.name
|
||||
ex.socket_e.connected = False
|
||||
ex.socket_e.parent = mt.shoulder_e
|
||||
ex.socket_e.tail = mt.shoulder_e.tail
|
||||
ex.socket_e.length *= 0.5
|
||||
|
||||
# insert the 'DLT-hand', between the forearm and the hand
|
||||
# copies forarm rotation
|
||||
@@ -236,7 +240,7 @@ def fk(obj, definitions, base_names):
|
||||
tar.name = "hinge"
|
||||
tar.id_type = 'OBJECT'
|
||||
tar.id = obj
|
||||
tar.rna_path = controller_path + '["hinge"]'
|
||||
tar.data_path = controller_path + '["hinge"]'
|
||||
|
||||
mod = driver_fcurve.modifiers[0]
|
||||
mod.poly_order = 1
|
||||
66
release/scripts/modules/rigify/copy.py
Normal file
66
release/scripts/modules/rigify/copy.py
Normal file
@@ -0,0 +1,66 @@
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
from rigify_utils import copy_bone_simple, get_side_name, bone_class_instance
|
||||
from rna_prop_ui import rna_idprop_ui_prop_get
|
||||
|
||||
METARIG_NAMES = ("cpy",)
|
||||
|
||||
# note, this example is just a bone with copy property.
|
||||
def metarig_template():
|
||||
# generated by rigify.write_meta_rig
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
obj = bpy.context.active_object
|
||||
arm = obj.data
|
||||
bone = arm.edit_bones.new('Bone')
|
||||
bone.head[:] = 0.0000, 0.0000, 0.0000
|
||||
bone.tail[:] = 0.0000, 0.0000, 1.0000
|
||||
bone.roll = 0.0000
|
||||
bone.connected = False
|
||||
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
pbone = obj.pose.bones['Bone']
|
||||
pbone['type'] = 'copy'
|
||||
|
||||
def metarig_definition(obj, orig_bone_name):
|
||||
return [orig_bone_name]
|
||||
|
||||
|
||||
def main(obj, bone_definition, base_names):
|
||||
arm = obj.data
|
||||
mt = bone_class_instance(obj, METARIG_NAMES)
|
||||
mt.cpy = bone_definition[0]
|
||||
mt.update()
|
||||
cp = mt.copy(to_fmt="%s_cpy")
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
|
||||
cp.update()
|
||||
mt.update()
|
||||
|
||||
con = cp.cpy_p.constraints.new('COPY_ROTATION')
|
||||
con.target = obj
|
||||
con.subtarget = mt.cpy
|
||||
|
||||
con = cp.cpy_p.constraints.new('COPY_LOCATION')
|
||||
con.target = obj
|
||||
con.subtarget = mt.cpy
|
||||
|
||||
return [mt.cpy]
|
||||
@@ -19,12 +19,40 @@
|
||||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
from rigify import get_bone_data
|
||||
from rigify import RigifyError
|
||||
|
||||
# not used, defined for completeness
|
||||
METARIG_NAMES = tuple()
|
||||
|
||||
|
||||
def metarig_template():
|
||||
# generated by rigify.write_meta_rig
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
obj = bpy.context.active_object
|
||||
arm = obj.data
|
||||
bone = arm.edit_bones.new('bonesker')
|
||||
bone.head[:] = 0.0000, 0.0000, 0.0000
|
||||
bone.tail[:] = -0.0000, 0.7382, 0.1895
|
||||
bone.roll = -0.0000
|
||||
bone.connected = False
|
||||
bone = arm.edit_bones.new('delta')
|
||||
bone.head[:] = -0.0497, 0.8414, 0.3530
|
||||
bone.tail[:] = -0.2511, 1.1588, 0.9653
|
||||
bone.roll = 2.6044
|
||||
bone.connected = False
|
||||
bone.parent = arm.edit_bones['bonesker']
|
||||
bone = arm.edit_bones.new('boney')
|
||||
bone.head[:] = 0.7940, 2.5592, 0.4134
|
||||
bone.tail[:] = 0.7940, 3.3975, 0.4890
|
||||
bone.roll = 3.1416
|
||||
bone.connected = False
|
||||
bone.parent = arm.edit_bones['delta']
|
||||
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
pbone = obj.pose.bones['delta']
|
||||
pbone['type'] = 'delta'
|
||||
|
||||
|
||||
def metarig_definition(obj, orig_bone_name):
|
||||
'''
|
||||
The bone given is the head, its parent is the body,
|
||||
@@ -37,7 +65,10 @@ def metarig_definition(obj, orig_bone_name):
|
||||
children = delta.children
|
||||
|
||||
if len(children) != 1:
|
||||
print("only 1 child supported for delta")
|
||||
raise RigifyError("only 1 child supported for delta on bone '%s'" % delta.name)
|
||||
|
||||
if delta.connected:
|
||||
raise RigifyError("bone cannot be connected to its parent '%s'" % delta.name)
|
||||
|
||||
bone_definition = [delta.name, children[0].name]
|
||||
|
||||
@@ -48,7 +79,6 @@ def main(obj, bone_definition, base_names):
|
||||
'''
|
||||
Use this bone to define a delta thats applied to its child in pose mode.
|
||||
'''
|
||||
|
||||
mode_orig = obj.mode
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
|
||||
@@ -56,7 +86,8 @@ def main(obj, bone_definition, base_names):
|
||||
|
||||
delta_pbone = obj.pose.bones[delta_name]
|
||||
|
||||
arm, child_pbone, child_bone = get_bone_data(obj, child_name)
|
||||
arm = obj.data
|
||||
child_pbone = obj.pose.bones[child_name]
|
||||
|
||||
delta_phead = delta_pbone.head.copy()
|
||||
delta_ptail = delta_pbone.tail.copy()
|
||||
@@ -77,7 +108,6 @@ def main(obj, bone_definition, base_names):
|
||||
delta_head = delta_ebone.head.copy()
|
||||
delta_tail = delta_ebone.tail.copy()
|
||||
|
||||
# arm, parent_pbone, parent_bone = get_bone_data(obj, delta_name)
|
||||
child_head = child_ebone.head.copy()
|
||||
child_tail = child_ebone.tail.copy()
|
||||
|
||||
@@ -125,7 +155,6 @@ def main(obj, bone_definition, base_names):
|
||||
mod.coefficients[1] = 0.0
|
||||
|
||||
|
||||
# arm, parent_pbone, parent_bone = get_bone_data(obj, delta_name)
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
|
||||
bpy.ops.object.mode_set(mode=mode_orig)
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
from rigify import get_bone_data, empty_layer, copy_bone_simple
|
||||
from rigify import RigifyError
|
||||
from rigify_utils import copy_bone_simple, get_side_name, get_base_name, EMPTY_LAYER
|
||||
from rna_prop_ui import rna_idprop_ui_prop_get
|
||||
from functools import reduce
|
||||
|
||||
@@ -28,7 +29,7 @@ METARIG_NAMES = "finger_01", "finger_02", "finger_03"
|
||||
|
||||
def metarig_template():
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
obj = bpy.context.object
|
||||
obj = bpy.context.active_object
|
||||
arm = obj.data
|
||||
bone = arm.edit_bones.new('finger.01')
|
||||
bone.head[:] = 0.0000, 0.0000, 0.0000
|
||||
@@ -50,7 +51,7 @@ def metarig_template():
|
||||
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
pbone = obj.pose.bones['finger.01']
|
||||
pbone['type'] = 'finger'
|
||||
pbone['type'] = 'finger_curl'
|
||||
|
||||
|
||||
def metarig_definition(obj, orig_bone_name):
|
||||
@@ -73,13 +74,13 @@ def metarig_definition(obj, orig_bone_name):
|
||||
children = bone.children
|
||||
|
||||
if len(children) != 1:
|
||||
raise Exception("expected the chain to have 2 children without a fork")
|
||||
raise RigifyError("expected the chain to have 2 children from bone '%s' without a fork" % orig_bone_name)
|
||||
bone = children[0]
|
||||
bone_definition.append(bone.name) # finger_02, finger_03
|
||||
chain += 1
|
||||
|
||||
if len(bone_definition) != len(METARIG_NAMES):
|
||||
raise Exception("internal problem, expected %d bones" % len(METARIG_NAMES))
|
||||
raise RigifyError("internal problem, expected %d bones" % len(METARIG_NAMES))
|
||||
|
||||
return bone_definition
|
||||
|
||||
@@ -89,7 +90,9 @@ def main(obj, bone_definition, base_names):
|
||||
# *** EDITMODE
|
||||
|
||||
# get assosiated data
|
||||
arm, orig_pbone, orig_ebone = get_bone_data(obj, bone_definition[0])
|
||||
arm = obj.data
|
||||
orig_pbone = obj.pose.bones[bone_definition[0]]
|
||||
orig_ebone = arm.edit_bones[bone_definition[0]]
|
||||
|
||||
obj.animation_data_create() # needed if its a new armature with no keys
|
||||
|
||||
@@ -98,11 +101,12 @@ def main(obj, bone_definition, base_names):
|
||||
children = orig_pbone.children_recursive
|
||||
tot_len = reduce(lambda f, pbone: f + pbone.bone.length, children, orig_pbone.bone.length)
|
||||
|
||||
base_name = base_names[bone_definition[0]].rsplit(".", 1)[0]
|
||||
# FIXME, the line below is far too arbitrary
|
||||
base_name = base_names[bone_definition[0]].rsplit(".", 2)[0]
|
||||
|
||||
# first make a new bone at the location of the finger
|
||||
#control_ebone = arm.edit_bones.new(base_name)
|
||||
control_ebone = copy_bone_simple(arm, bone_definition[0], base_name)
|
||||
control_ebone = copy_bone_simple(arm, bone_definition[0], base_name + get_side_name(base_names[bone_definition[0]]), parent=True)
|
||||
control_bone_name = control_ebone.name # we dont know if we get the name requested
|
||||
|
||||
control_ebone.connected = orig_ebone.connected
|
||||
@@ -115,7 +119,7 @@ def main(obj, bone_definition, base_names):
|
||||
children = [pbone.name for pbone in children]
|
||||
|
||||
# set an alternate layer for driver bones
|
||||
other_layer = empty_layer[:]
|
||||
other_layer = EMPTY_LAYER[:]
|
||||
other_layer[8] = True
|
||||
|
||||
|
||||
@@ -197,14 +201,14 @@ def main(obj, bone_definition, base_names):
|
||||
tar.name = "scale"
|
||||
tar.id_type = 'OBJECT'
|
||||
tar.id = obj
|
||||
tar.rna_path = controller_path + '.scale[1]'
|
||||
tar.data_path = controller_path + '.scale[1]'
|
||||
|
||||
# bend target
|
||||
tar = driver.targets.new()
|
||||
tar.name = "br"
|
||||
tar.id_type = 'OBJECT'
|
||||
tar.id = obj
|
||||
tar.rna_path = controller_path + '["bend_ratio"]'
|
||||
tar.data_path = controller_path + '["bend_ratio"]'
|
||||
|
||||
# XXX - todo, any number
|
||||
if i == 0:
|
||||
@@ -19,7 +19,8 @@
|
||||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
from rigify import bone_class_instance, copy_bone_simple, blend_bone_list
|
||||
from rigify import RigifyError
|
||||
from rigify_utils import bone_class_instance, copy_bone_simple, blend_bone_list, get_side_name, get_base_name
|
||||
from rna_prop_ui import rna_idprop_ui_prop_get
|
||||
|
||||
METARIG_NAMES = "hips", "thigh", "shin", "foot", "toe", "heel"
|
||||
@@ -28,7 +29,7 @@ METARIG_NAMES = "hips", "thigh", "shin", "foot", "toe", "heel"
|
||||
def metarig_template():
|
||||
# generated by rigify.write_meta_rig
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
obj = bpy.context.object
|
||||
obj = bpy.context.active_object
|
||||
arm = obj.data
|
||||
bone = arm.edit_bones.new('hips')
|
||||
bone.head[:] = 0.0000, 0.0000, 0.0000
|
||||
@@ -68,7 +69,7 @@ def metarig_template():
|
||||
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
pbone = obj.pose.bones['thigh']
|
||||
pbone['type'] = 'leg'
|
||||
pbone['type'] = 'leg_biped_generic'
|
||||
|
||||
|
||||
def metarig_definition(obj, orig_bone_name):
|
||||
@@ -85,7 +86,7 @@ def metarig_definition(obj, orig_bone_name):
|
||||
orig_bone_parent = orig_bone.parent
|
||||
|
||||
if orig_bone_parent is None:
|
||||
raise Exception("expected the thigh bone to have a parent hip bone")
|
||||
raise RigifyError("expected the thigh bone to have a parent hip bone")
|
||||
|
||||
bone_definition.append(orig_bone_parent.name)
|
||||
bone_definition.append(orig_bone.name)
|
||||
@@ -97,7 +98,7 @@ def metarig_definition(obj, orig_bone_name):
|
||||
children = bone.children
|
||||
|
||||
if len(children) != 1:
|
||||
raise Exception("expected the thigh bone to have 3 children without a fork")
|
||||
raise RigifyError("expected the thigh bone to have 3 children without a fork")
|
||||
bone = children[0]
|
||||
bone_definition.append(bone.name) # shin, foot
|
||||
chain += 1
|
||||
@@ -105,10 +106,10 @@ def metarig_definition(obj, orig_bone_name):
|
||||
children = bone.children
|
||||
# Now there must be 2 children, only one connected
|
||||
if len(children) != 2:
|
||||
raise Exception("expected the foot bone:'%s' to have 2 children" % bone.name )
|
||||
raise RigifyError("expected the foot bone:'%s' to have 2 children" % bone.name )
|
||||
|
||||
if children[0].connected == children[1].connected:
|
||||
raise Exception("expected one bone to be connected")
|
||||
raise RigifyError("expected one bone to be connected")
|
||||
|
||||
toe, heel = children
|
||||
if heel.connected:
|
||||
@@ -119,7 +120,7 @@ def metarig_definition(obj, orig_bone_name):
|
||||
bone_definition.append(heel.name)
|
||||
|
||||
if len(bone_definition) != len(METARIG_NAMES):
|
||||
raise Exception("internal problem, expected %d bones" % len(METARIG_NAMES))
|
||||
raise RigifyError("internal problem, expected %d bones" % len(METARIG_NAMES))
|
||||
|
||||
return bone_definition
|
||||
|
||||
@@ -145,22 +146,26 @@ def ik(obj, bone_definition, base_names):
|
||||
# XXX - end dupe
|
||||
|
||||
|
||||
# Make a new chain, ORG are the original bones renamed.
|
||||
ik_chain = mt_chain.copy(to_fmt="MCH-%s")
|
||||
# Make a new chain
|
||||
ik_chain = mt_chain.copy(to_fmt="MCH-%s", base_names=base_names)
|
||||
|
||||
# simple rename
|
||||
ik_chain.rename("thigh", ik_chain.thigh + "_ik")
|
||||
ik_chain.rename("shin", ik_chain.shin + "_ik")
|
||||
|
||||
# ik foot, no parents
|
||||
base_foot_name = base_names[mt_chain.foot] # whatever the foot is called, use that!, XXX - ORG!
|
||||
ik.foot_e = copy_bone_simple(arm, mt_chain.foot, "%s_ik" % base_foot_name)
|
||||
# make sure leg is child of hips
|
||||
ik_chain.thigh_e.parent = mt.hips_e
|
||||
|
||||
# ik foot: no parents
|
||||
base_foot_name = get_base_name(base_names[mt_chain.foot])
|
||||
ik.foot_e = copy_bone_simple(arm, mt_chain.foot, base_foot_name + "_ik" + get_side_name(base_names[mt_chain.foot]))
|
||||
ik.foot = ik.foot_e.name
|
||||
ik.foot_e.tail.z = ik.foot_e.head.z
|
||||
ik.foot_e.roll = 0.0
|
||||
ik.foot_e.local_location = False
|
||||
|
||||
# heel pointing backwards, half length
|
||||
ik.foot_roll_e = copy_bone_simple(arm, mt.heel, "%s_roll" % base_foot_name)
|
||||
# foot roll: heel pointing backwards, half length
|
||||
ik.foot_roll_e = copy_bone_simple(arm, mt.heel, base_foot_name + "_roll" + get_side_name(base_names[mt_chain.foot]))
|
||||
ik.foot_roll = ik.foot_roll_e.name
|
||||
ik.foot_roll_e.tail = ik.foot_roll_e.head + (ik.foot_roll_e.head - ik.foot_roll_e.tail) / 2.0
|
||||
ik.foot_roll_e.parent = ik.foot_e # heel is disconnected
|
||||
@@ -182,7 +187,7 @@ def ik(obj, bone_definition, base_names):
|
||||
|
||||
# rename 'MCH-toe' --> to 'toe_ik' and make the child of ik.foot_roll_01
|
||||
# ------------------ FK or IK?
|
||||
ik_chain.rename("toe", base_names[mt_chain.toe] + "_ik")
|
||||
ik_chain.rename("toe", get_base_name(base_names[mt_chain.toe]) + "_ik" + get_side_name(base_names[mt_chain.toe]))
|
||||
ik_chain.toe_e.connected = False
|
||||
ik_chain.toe_e.parent = ik.foot_roll_01_e
|
||||
|
||||
@@ -201,6 +206,7 @@ def ik(obj, bone_definition, base_names):
|
||||
ik.knee_target_e.translate(offset)
|
||||
ik.knee_target_e.length *= 0.5
|
||||
ik.knee_target_e.parent = ik.foot_e
|
||||
ik.knee_target_e.local_location = False
|
||||
|
||||
# roll the bone to point up... could also point in the same direction as ik.foot_roll
|
||||
# ik.foot_roll_02_e.matrix * Vector(0.0, 0.0, 1.0) # ACK!, no rest matrix in editmode
|
||||
@@ -218,6 +224,12 @@ def ik(obj, bone_definition, base_names):
|
||||
ik_chain.shin_p.ik_dof_y = False
|
||||
ik_chain.shin_p.ik_dof_z = False
|
||||
|
||||
# Set rotation modes and axis locks
|
||||
ik.foot_roll_p.rotation_mode = 'XYZ'
|
||||
ik.foot_roll_p.lock_rotation = False, True, True
|
||||
ik_chain.toe_p.rotation_mode = 'YXZ'
|
||||
ik_chain.toe_p.lock_rotation = False, True, True
|
||||
|
||||
# IK
|
||||
con = ik_chain.shin_p.constraints.new('IK')
|
||||
con.chain_length = 2
|
||||
@@ -284,13 +296,10 @@ def fk(obj, bone_definition, base_names):
|
||||
ex.thigh_socket = ex.thigh_socket_e.name
|
||||
ex.thigh_socket_e.tail = ex.thigh_socket_e.head + Vector(0.0, 0.0, ex.thigh_socket_e.length / 4.0)
|
||||
|
||||
ex.thigh_hinge_e = copy_bone_simple(arm, mt_chain.thigh, "MCH-%s_hinge" % base_names[mt_chain.thigh])
|
||||
ex.thigh_hinge_e = copy_bone_simple(arm, mt.hips, "MCH-%s_hinge" % base_names[mt_chain.thigh], parent=False)
|
||||
ex.thigh_hinge = ex.thigh_hinge_e.name
|
||||
ex.thigh_hinge_e.tail = ex.thigh_hinge_e.head + Vector(0.0, 0.0, mt_chain.thigh_e.head.length)
|
||||
ex.thigh_hinge_e.translate(Vector( - (mt.hips_e.head.x - mt_chain.thigh_e.head.x), 0.0, 0.0))
|
||||
ex.thigh_hinge_e.length = mt.hips_e.length
|
||||
|
||||
fk_chain = mt_chain.copy() # fk has no prefix!
|
||||
fk_chain = mt_chain.copy(base_names=base_names) # fk has no prefix!
|
||||
|
||||
fk_chain.thigh_e.connected = False
|
||||
fk_chain.thigh_e.parent = ex.thigh_hinge_e
|
||||
@@ -301,6 +310,13 @@ def fk(obj, bone_definition, base_names):
|
||||
mt_chain.update()
|
||||
fk_chain.update()
|
||||
|
||||
# Set rotation modes and axis locks
|
||||
fk_chain.shin_p.rotation_mode = 'XYZ'
|
||||
fk_chain.shin_p.lock_rotation = False, True, True
|
||||
fk_chain.foot_p.rotation_mode = 'YXZ'
|
||||
fk_chain.toe_p.rotation_mode = 'YXZ'
|
||||
fk_chain.toe_p.lock_rotation = False, True, True
|
||||
|
||||
con = fk_chain.thigh_p.constraints.new('COPY_LOCATION')
|
||||
con.target = obj
|
||||
con.subtarget = ex.thigh_socket
|
||||
@@ -325,7 +341,7 @@ def fk(obj, bone_definition, base_names):
|
||||
tar.name = "var"
|
||||
tar.id_type = 'OBJECT'
|
||||
tar.id = obj
|
||||
tar.rna_path = hinge_driver_path
|
||||
tar.data_path = hinge_driver_path
|
||||
|
||||
mod = fcurve.modifiers[0]
|
||||
mod.poly_order = 1
|
||||
@@ -19,7 +19,8 @@
|
||||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
from rigify import bone_class_instance, copy_bone_simple
|
||||
from rigify import RigifyError
|
||||
from rigify_utils import bone_class_instance, copy_bone_simple
|
||||
from rna_prop_ui import rna_idprop_ui_prop_get
|
||||
|
||||
# not used, defined for completeness
|
||||
@@ -29,7 +30,7 @@ METARIG_NAMES = ("body", "head")
|
||||
def metarig_template():
|
||||
# generated by rigify.write_meta_rig
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
obj = bpy.context.object
|
||||
obj = bpy.context.active_object
|
||||
arm = obj.data
|
||||
bone = arm.edit_bones.new('body')
|
||||
bone.head[:] = -0.0000, -0.2771, -1.3345
|
||||
@@ -75,7 +76,7 @@ def metarig_template():
|
||||
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
pbone = obj.pose.bones['head']
|
||||
pbone['type'] = 'neck'
|
||||
pbone['type'] = 'neck_flex'
|
||||
|
||||
|
||||
def metarig_definition(obj, orig_bone_name):
|
||||
@@ -91,7 +92,7 @@ def metarig_definition(obj, orig_bone_name):
|
||||
|
||||
children = head.children
|
||||
if len(children) != 1:
|
||||
print("expected the head to have only 1 child.")
|
||||
raise RigifyError("expected the head bone '%s' to have only 1 child." % orig_bone_name)
|
||||
|
||||
child = children[0]
|
||||
bone_definition = [body.name, head.name, child.name]
|
||||
@@ -120,10 +121,14 @@ def main(obj, bone_definition, base_names):
|
||||
neck_chain_basename = base_names[mt_chain.neck_01_e.name].split(".")[0]
|
||||
neck_chain_segment_length = mt_chain.neck_01_e.length
|
||||
|
||||
ex = bone_class_instance(obj, ["body", "head", "head_hinge", "neck_socket"]) # hinge & extras
|
||||
ex = bone_class_instance(obj, ["body", "head", "head_hinge", "neck_socket", "head_ctrl"]) # hinge & extras
|
||||
|
||||
# Add the head hinge at the bodys location, becomes the parent of the original head
|
||||
|
||||
# apply everything to this copy of the chain
|
||||
ex_chain = mt_chain.copy(base_names=base_names)
|
||||
ex_chain.neck_01_e.parent = mt_chain.neck_01_e.parent
|
||||
|
||||
|
||||
# Copy the head bone and offset
|
||||
ex.head_e = copy_bone_simple(arm, mt.head, "MCH_%s" % base_names[mt.head], parent=True)
|
||||
@@ -135,16 +140,12 @@ def main(obj, bone_definition, base_names):
|
||||
ex.head_e.tail.y += head_length / 2.0
|
||||
|
||||
# Yes, use the body bone but call it a head hinge
|
||||
ex.head_hinge_e = copy_bone_simple(arm, mt.body, "MCH_%s_hinge" % base_names[mt.head], parent=True)
|
||||
ex.head_hinge_e = copy_bone_simple(arm, mt.body, "MCH_%s_hinge" % base_names[mt.head], parent=False)
|
||||
ex.head_hinge_e.connected = False
|
||||
ex.head_hinge = ex.head_hinge_e.name
|
||||
ex.head_hinge_e.head.y += head_length / 4.0
|
||||
ex.head_hinge_e.tail.y += head_length / 4.0
|
||||
|
||||
# reparent the head, assume its not connected
|
||||
mt.head_e.connected = False
|
||||
mt.head_e.parent = ex.head_hinge_e
|
||||
|
||||
# Insert the neck socket, the head copys this loation
|
||||
ex.neck_socket_e = arm.edit_bones.new("MCH-%s_socked" % neck_chain_basename)
|
||||
ex.neck_socket = ex.neck_socket_e.name
|
||||
@@ -153,20 +154,21 @@ def main(obj, bone_definition, base_names):
|
||||
ex.neck_socket_e.head = mt.head_e.head
|
||||
ex.neck_socket_e.tail = mt.head_e.head - Vector(0.0, neck_chain_segment_length / 2.0, 0.0)
|
||||
ex.neck_socket_e.roll = 0.0
|
||||
|
||||
|
||||
# copy of the head for controling
|
||||
ex.head_ctrl_e = copy_bone_simple(arm, mt.head, base_names[mt.head])
|
||||
ex.head_ctrl = ex.head_ctrl_e.name
|
||||
ex.head_ctrl_e.parent = ex.head_hinge_e
|
||||
|
||||
# offset the head, not really needed since it has a copyloc constraint
|
||||
mt.head_e.head.y += head_length / 4.0
|
||||
mt.head_e.tail.y += head_length / 4.0
|
||||
|
||||
for i, attr in enumerate(mt_chain.attr_names):
|
||||
neck_e = getattr(mt_chain, attr + "_e")
|
||||
for i, attr in enumerate(ex_chain.attr_names):
|
||||
neck_e = getattr(ex_chain, attr + "_e")
|
||||
|
||||
# dont store parent names, re-reference as each chain bones parent.
|
||||
neck_e_parent = arm.edit_bones.new("MCH-rot_%s" % base_names[neck_e.name])
|
||||
neck_e_parent = arm.edit_bones.new("MCH-rot_%s" % base_names[getattr(mt_chain, attr)])
|
||||
neck_e_parent.head = neck_e.head
|
||||
neck_e_parent.tail = neck_e.head + ((mt.head_e.tail - mt.head_e.head).normalize() * neck_chain_segment_length / 2.0)
|
||||
neck_e_parent.roll = mt.head_e.roll
|
||||
|
||||
|
||||
orig_parent = neck_e.parent
|
||||
neck_e.connected = False
|
||||
@@ -183,20 +185,21 @@ def main(obj, bone_definition, base_names):
|
||||
|
||||
mt.update()
|
||||
mt_chain.update()
|
||||
ex_chain.update()
|
||||
ex.update()
|
||||
|
||||
# Simple one off constraints, no drivers
|
||||
con = mt.head_p.constraints.new('COPY_LOCATION')
|
||||
con = ex.head_ctrl_p.constraints.new('COPY_LOCATION')
|
||||
con.target = obj
|
||||
con.subtarget = ex.neck_socket
|
||||
|
||||
con = ex.head_p.constraints.new('COPY_ROTATION')
|
||||
con.target = obj
|
||||
con.subtarget = mt.head
|
||||
con.subtarget = ex.head_ctrl
|
||||
|
||||
# driven hinge
|
||||
prop = rna_idprop_ui_prop_get(mt.head_p, "hinge", create=True)
|
||||
mt.head_p["hinge"] = 0.0
|
||||
prop = rna_idprop_ui_prop_get(ex.head_ctrl_p, "hinge", create=True)
|
||||
ex.head_ctrl_p["hinge"] = 0.0
|
||||
prop["soft_min"] = 0.0
|
||||
prop["soft_max"] = 1.0
|
||||
|
||||
@@ -206,7 +209,7 @@ def main(obj, bone_definition, base_names):
|
||||
con.subtarget = mt.body
|
||||
|
||||
# add driver
|
||||
hinge_driver_path = mt.head_p.path_to_id() + '["hinge"]'
|
||||
hinge_driver_path = ex.head_ctrl_p.path_to_id() + '["hinge"]'
|
||||
|
||||
fcurve = con.driver_add("influence", 0)
|
||||
driver = fcurve.driver
|
||||
@@ -215,7 +218,7 @@ def main(obj, bone_definition, base_names):
|
||||
tar.name = "var"
|
||||
tar.id_type = 'OBJECT'
|
||||
tar.id = obj
|
||||
tar.rna_path = hinge_driver_path
|
||||
tar.data_path = hinge_driver_path
|
||||
|
||||
#mod = fcurve_driver.modifiers.new('GENERATOR')
|
||||
mod = fcurve.modifiers[0]
|
||||
@@ -223,12 +226,12 @@ def main(obj, bone_definition, base_names):
|
||||
mod.coefficients[0] = 1.0
|
||||
mod.coefficients[1] = -1.0
|
||||
|
||||
head_driver_path = mt.head_p.path_to_id()
|
||||
head_driver_path = ex.head_ctrl_p.path_to_id()
|
||||
|
||||
target_names = [("b%.2d" % (i + 1)) for i in range(len(neck_chain))]
|
||||
|
||||
mt.head_p["bend_tot"] = 0.0
|
||||
fcurve = mt.head_p.driver_add('["bend_tot"]', 0)
|
||||
ex.head_ctrl_p["bend_tot"] = 0.0
|
||||
fcurve = ex.head_ctrl_p.driver_add('["bend_tot"]', 0)
|
||||
driver = fcurve.driver
|
||||
driver.type = 'SUM'
|
||||
fcurve.modifiers.remove(0) # grr dont need a modifier
|
||||
@@ -238,19 +241,19 @@ def main(obj, bone_definition, base_names):
|
||||
tar.name = target_names[i]
|
||||
tar.id_type = 'OBJECT'
|
||||
tar.id = obj
|
||||
tar.rna_path = head_driver_path + ('["bend_%.2d"]' % (i + 1))
|
||||
tar.data_path = head_driver_path + ('["bend_%.2d"]' % (i + 1))
|
||||
|
||||
|
||||
for i, attr in enumerate(mt_chain.attr_names):
|
||||
neck_p = getattr(mt_chain, attr + "_p")
|
||||
for i, attr in enumerate(ex_chain.attr_names):
|
||||
neck_p = getattr(ex_chain, attr + "_p")
|
||||
neck_p.lock_location = True, True, True
|
||||
neck_p.lock_location = True, True, True
|
||||
neck_p.lock_rotations_4d = True
|
||||
|
||||
# Add bend prop
|
||||
prop_name = "bend_%.2d" % (i + 1)
|
||||
prop = rna_idprop_ui_prop_get(mt.head_p, prop_name, create=True)
|
||||
mt.head_p[prop_name] = 1.0
|
||||
prop = rna_idprop_ui_prop_get(ex.head_ctrl_p, prop_name, create=True)
|
||||
ex.head_ctrl_p[prop_name] = 1.0
|
||||
prop["soft_min"] = 0.0
|
||||
prop["soft_max"] = 1.0
|
||||
|
||||
@@ -278,13 +281,20 @@ def main(obj, bone_definition, base_names):
|
||||
tar.name = "bend_tot"
|
||||
tar.id_type = 'OBJECT'
|
||||
tar.id = obj
|
||||
tar.rna_path = head_driver_path + ('["bend_tot"]')
|
||||
tar.data_path = head_driver_path + ('["bend_tot"]')
|
||||
|
||||
tar = driver.targets.new()
|
||||
tar.name = "bend"
|
||||
tar.id_type = 'OBJECT'
|
||||
tar.id = obj
|
||||
tar.rna_path = head_driver_path + ('["%s"]' % prop_name)
|
||||
tar.data_path = head_driver_path + ('["%s"]' % prop_name)
|
||||
|
||||
|
||||
# finally constrain the original bone to this one
|
||||
orig_neck_p = getattr(mt_chain, attr + "_p")
|
||||
con = orig_neck_p.constraints.new('COPY_ROTATION')
|
||||
con.target = obj
|
||||
con.subtarget = neck_p.name
|
||||
|
||||
# no blending the result of this
|
||||
return None
|
||||
@@ -19,7 +19,7 @@
|
||||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
from rigify import get_bone_data, copy_bone_simple
|
||||
from rigify_utils import copy_bone_simple, get_side_name
|
||||
from rna_prop_ui import rna_idprop_ui_prop_get
|
||||
|
||||
# not used, defined for completeness
|
||||
@@ -28,7 +28,7 @@ METARIG_NAMES = tuple()
|
||||
def metarig_template():
|
||||
# generated by rigify.write_meta_rig
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
obj = bpy.context.object
|
||||
obj = bpy.context.active_object
|
||||
arm = obj.data
|
||||
bone = arm.edit_bones.new('hand')
|
||||
bone.head[:] = 0.0082, -1.2492, 0.0000
|
||||
@@ -74,7 +74,7 @@ def metarig_template():
|
||||
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
pbone = obj.pose.bones['palm.01']
|
||||
pbone['type'] = 'palm'
|
||||
pbone['type'] = 'palm_curl'
|
||||
|
||||
|
||||
def metarig_definition(obj, orig_bone_name):
|
||||
@@ -97,7 +97,8 @@ def metarig_definition(obj, orig_bone_name):
|
||||
|
||||
|
||||
def main(obj, bone_definition, base_names):
|
||||
arm, palm_pbone, palm_ebone = get_bone_data(obj, bone_definition[0])
|
||||
arm = obj.data
|
||||
|
||||
children = bone_definition[1:]
|
||||
|
||||
# Make a copy of the pinky
|
||||
@@ -105,7 +106,10 @@ def main(obj, bone_definition, base_names):
|
||||
pinky_ebone = arm.edit_bones[children[0]]
|
||||
ring_ebone = arm.edit_bones[children[1]]
|
||||
|
||||
control_ebone = copy_bone_simple(arm, pinky_ebone.name, "palm_control", parent=True)
|
||||
# FIXME, why split the second one?
|
||||
base_name = base_names[pinky_ebone.name].rsplit('.', 2)[0]
|
||||
|
||||
control_ebone = copy_bone_simple(arm, pinky_ebone.name, base_name + get_side_name(base_names[pinky_ebone.name]), parent=True)
|
||||
control_name = control_ebone.name
|
||||
|
||||
offset = (pinky_ebone.head - ring_ebone.head)
|
||||
@@ -114,9 +118,9 @@ def main(obj, bone_definition, base_names):
|
||||
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
|
||||
|
||||
arm, control_pbone, control_ebone = get_bone_data(obj, control_name)
|
||||
arm, pinky_pbone, pinky_ebone = get_bone_data(obj, children[0])
|
||||
arm = obj.data
|
||||
control_pbone = obj.pose.bones[control_name]
|
||||
pinky_pbone = obj.pose.bones[children[0]]
|
||||
|
||||
control_pbone.rotation_mode = 'YZX'
|
||||
control_pbone.lock_rotation = False, True, True
|
||||
@@ -141,7 +145,7 @@ def main(obj, bone_definition, base_names):
|
||||
tar.name = "x"
|
||||
tar.id_type = 'OBJECT'
|
||||
tar.id = obj
|
||||
tar.rna_path = controller_path + ".rotation_euler[0]"
|
||||
tar.data_path = controller_path + ".rotation_euler[0]"
|
||||
|
||||
|
||||
# *****
|
||||
@@ -152,23 +156,43 @@ def main(obj, bone_definition, base_names):
|
||||
tar.name = "x"
|
||||
tar.id_type = 'OBJECT'
|
||||
tar.id = obj
|
||||
tar.rna_path = controller_path + ".rotation_euler[0]"
|
||||
tar.data_path = controller_path + ".rotation_euler[0]"
|
||||
|
||||
|
||||
# *****
|
||||
driver = driver_fcurves[2].driver
|
||||
driver.expression = "(1.0-cos(x))-s"
|
||||
|
||||
def x_direction():
|
||||
# NOTE: the direction of the Z rotation depends on which side the palm is on.
|
||||
# we could do a simple side-of-x test but better to work out the direction
|
||||
# the hand is facing.
|
||||
from Mathutils import Vector, AngleBetweenVecs
|
||||
from math import degrees
|
||||
child_pbone_01 = obj.pose.bones[children[0]]
|
||||
child_pbone_02 = obj.pose.bones[children[1]]
|
||||
|
||||
rel_vec = child_pbone_01.head - child_pbone_02.head
|
||||
x_vec = child_pbone_01.matrix.rotationPart() * Vector(1.0, 0.0, 0.0)
|
||||
return degrees(AngleBetweenVecs(rel_vec, x_vec)) > 90.0
|
||||
|
||||
if x_direction(): # flip
|
||||
driver.expression = "-(%s)" % driver.expression
|
||||
|
||||
for fcurve in driver_fcurves:
|
||||
fcurve.modifiers.remove(0) # grr dont need a modifier
|
||||
|
||||
tar = driver.targets.new()
|
||||
tar.name = "x"
|
||||
tar.id_type = 'OBJECT'
|
||||
tar.id = obj
|
||||
tar.rna_path = controller_path + ".rotation_euler[0]"
|
||||
tar.data_path = controller_path + ".rotation_euler[0]"
|
||||
|
||||
tar = driver.targets.new()
|
||||
tar.name = "s"
|
||||
tar.id_type = 'OBJECT'
|
||||
tar.id = obj
|
||||
tar.rna_path = controller_path + '["spread"]'
|
||||
tar.data_path = controller_path + '["spread"]'
|
||||
|
||||
|
||||
for i, child_name in enumerate(children):
|
||||
@@ -19,7 +19,7 @@
|
||||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
from rigify import bone_class_instance, copy_bone_simple
|
||||
from rigify_utils import bone_class_instance, copy_bone_simple
|
||||
from rna_prop_ui import rna_idprop_ui_prop_get
|
||||
|
||||
# not used, defined for completeness
|
||||
@@ -29,7 +29,7 @@ METARIG_NAMES = ("pelvis", "ribcage")
|
||||
def metarig_template():
|
||||
# generated by rigify.write_meta_rig
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
obj = bpy.context.object
|
||||
obj = bpy.context.active_object
|
||||
arm = obj.data
|
||||
bone = arm.edit_bones.new('pelvis')
|
||||
bone.head[:] = -0.0000, -0.2559, 0.8673
|
||||
@@ -87,7 +87,7 @@ def metarig_template():
|
||||
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
pbone = obj.pose.bones['rib_cage']
|
||||
pbone['type'] = 'spine.fk'
|
||||
pbone['type'] = 'spine_pivot_flex'
|
||||
|
||||
|
||||
def metarig_definition(obj, orig_bone_name):
|
||||
@@ -104,11 +104,11 @@ def metarig_definition(obj, orig_bone_name):
|
||||
pelvis = ribcage.parent
|
||||
|
||||
if pelvis is None:
|
||||
raise Exception("expected the ribcage bone:'%s' to have a parent (ribcage)." % ribcage.name)
|
||||
raise RigifyError("expected the ribcage bone:'%s' to have a parent (ribcage)." % ribcage.name)
|
||||
|
||||
children = ribcage.children
|
||||
if len(children) != 1:
|
||||
raise Exception("expected the ribcage to have only 1 child.")
|
||||
raise RigifyError("expected the ribcage to have only 1 child.")
|
||||
|
||||
child = children[0]
|
||||
|
||||
@@ -148,6 +148,7 @@ def main(obj, bone_definition, base_names):
|
||||
|
||||
ex.pelvis_copy_e = copy_bone_simple(arm, mt.pelvis, base_names[mt.pelvis]) # no parent
|
||||
ex.pelvis_copy = ex.pelvis_copy_e.name
|
||||
ex.pelvis_copy_e.local_location = False
|
||||
|
||||
# copy the pelvis, offset to make MCH-spine_rotate and MCH-ribcage_hinge
|
||||
ex.ribcage_hinge_e = copy_bone_simple(arm, mt.pelvis, "MCH-%s_hinge" % base_names[mt.ribcage])
|
||||
@@ -321,7 +322,7 @@ def main(obj, bone_definition, base_names):
|
||||
tar.name = "var"
|
||||
tar.id_type = 'OBJECT'
|
||||
tar.id = obj
|
||||
tar.rna_path = ex.ribcage_copy_p.path_to_id() + '["hinge"]'
|
||||
tar.data_path = ex.ribcage_copy_p.path_to_id() + '["hinge"]'
|
||||
|
||||
mod = fcurve.modifiers[0]
|
||||
mod.poly_order = 1
|
||||
@@ -405,7 +406,7 @@ def main(obj, bone_definition, base_names):
|
||||
tar.name = target_names[i]
|
||||
tar.id_type = 'OBJECT'
|
||||
tar.id = obj
|
||||
tar.rna_path = rib_driver_path + ('["bend_%.2d"]' % (i + 1))
|
||||
tar.data_path = rib_driver_path + ('["bend_%.2d"]' % (i + 1))
|
||||
|
||||
for i in range(1, spine_chain_len):
|
||||
|
||||
@@ -440,13 +441,13 @@ def main(obj, bone_definition, base_names):
|
||||
tar.name = "bend_tot"
|
||||
tar.id_type = 'OBJECT'
|
||||
tar.id = obj
|
||||
tar.rna_path = rib_driver_path + ('["bend_tot"]')
|
||||
tar.data_path = rib_driver_path + ('["bend_tot"]')
|
||||
|
||||
tar = driver.targets.new()
|
||||
tar.name = "bend"
|
||||
tar.id_type = 'OBJECT'
|
||||
tar.id = obj
|
||||
tar.rna_path = rib_driver_path + ('["%s"]' % prop_name)
|
||||
tar.data_path = rib_driver_path + ('["%s"]' % prop_name)
|
||||
|
||||
|
||||
|
||||
@@ -489,7 +490,7 @@ def main(obj, bone_definition, base_names):
|
||||
tar.name = "var"
|
||||
tar.id_type = 'OBJECT'
|
||||
tar.id = obj
|
||||
tar.rna_path = rib_driver_path + '["pivot_slide"]'
|
||||
tar.data_path = rib_driver_path + '["pivot_slide"]'
|
||||
|
||||
mod = fcurve.modifiers[0]
|
||||
mod.poly_order = 1
|
||||
472
release/scripts/modules/rigify_utils.py
Normal file
472
release/scripts/modules/rigify_utils.py
Normal file
@@ -0,0 +1,472 @@
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
# rigify its self does not depend on this module, however some of the
|
||||
# rigify templates use these utility functions.
|
||||
#
|
||||
# So even though this can be for general purpose use, this module was created
|
||||
# for rigify so in some cases seemingly generic functions make assumptions
|
||||
# that a generic function would need to check for.
|
||||
|
||||
import bpy
|
||||
from Mathutils import Vector
|
||||
from rna_prop_ui import rna_idprop_ui_prop_get
|
||||
|
||||
DELIMITER = '-._'
|
||||
EMPTY_LAYER = [False] * 32
|
||||
|
||||
def add_stretch_to(obj, from_name, to_name, name):
|
||||
'''
|
||||
Adds a bone that stretches from one to another
|
||||
'''
|
||||
|
||||
mode_orig = obj.mode
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
|
||||
arm = obj.data
|
||||
stretch_ebone = arm.edit_bones.new(name)
|
||||
stretch_name = stretch_ebone.name
|
||||
del name
|
||||
|
||||
head = stretch_ebone.head = arm.edit_bones[from_name].head.copy()
|
||||
#tail = stretch_ebone.tail = arm.edit_bones[to_name].head.copy()
|
||||
|
||||
# annoying exception for zero length bones, since its using stretch_to the rest pose doesnt really matter
|
||||
#if (head - tail).length < 0.1:
|
||||
if 1:
|
||||
tail = stretch_ebone.tail = arm.edit_bones[from_name].tail.copy()
|
||||
|
||||
|
||||
# Now for the constraint
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
|
||||
stretch_pbone = obj.pose.bones[stretch_name]
|
||||
|
||||
con = stretch_pbone.constraints.new('COPY_LOCATION')
|
||||
con.target = obj
|
||||
con.subtarget = from_name
|
||||
|
||||
con = stretch_pbone.constraints.new('STRETCH_TO')
|
||||
con.target = obj
|
||||
con.subtarget = to_name
|
||||
con.original_length = (head - tail).length
|
||||
con.keep_axis = 'PLANE_X'
|
||||
con.volume = 'NO_VOLUME'
|
||||
|
||||
bpy.ops.object.mode_set(mode=mode_orig)
|
||||
|
||||
return stretch_name
|
||||
|
||||
|
||||
def copy_bone_simple(arm, from_bone, name, parent=False):
|
||||
ebone = arm.edit_bones[from_bone]
|
||||
ebone_new = arm.edit_bones.new(name)
|
||||
|
||||
if parent:
|
||||
ebone_new.connected = ebone.connected
|
||||
ebone_new.parent = ebone.parent
|
||||
|
||||
ebone_new.head = ebone.head
|
||||
ebone_new.tail = ebone.tail
|
||||
ebone_new.roll = ebone.roll
|
||||
return ebone_new
|
||||
|
||||
|
||||
def copy_bone_simple_list(arm, from_bones, to_bones, parent=False):
|
||||
|
||||
if len(from_bones) != len(to_bones):
|
||||
raise Exception("bone list sizes must match")
|
||||
|
||||
copy_bones = [copy_bone_simple(arm, bone_name, to_bones[i], True) for i, bone_name in enumerate(from_bones)]
|
||||
|
||||
# now we need to re-parent
|
||||
for ebone in copy_bones:
|
||||
parent = ebone.parent
|
||||
if parent:
|
||||
try:
|
||||
i = from_bones.index(parent.name)
|
||||
except:
|
||||
i = -1
|
||||
|
||||
if i == -1:
|
||||
ebone.parent = None
|
||||
else:
|
||||
ebone.parent = copy_bones[i]
|
||||
|
||||
return copy_bones
|
||||
|
||||
|
||||
def blend_bone_list(obj, apply_bones, from_bones, to_bones, target_bone=None, target_prop="blend"):
|
||||
|
||||
if obj.mode == 'EDIT':
|
||||
raise Exception("blending cant be called in editmode")
|
||||
|
||||
if len(apply_bones) != len(from_bones):
|
||||
raise Exception("lists differ in length (from -> apply): \n\t%s\n\t%s" % (from_bones, apply_bones))
|
||||
if len(apply_bones) != len(to_bones):
|
||||
raise Exception("lists differ in length (to -> apply): \n\t%s\n\t%s" % (to_bones, apply_bones))
|
||||
|
||||
# setup the blend property
|
||||
if target_bone is None:
|
||||
target_bone = apply_bones[-1] # default to the last bone
|
||||
|
||||
prop_pbone = obj.pose.bones[target_bone]
|
||||
if prop_pbone.get(target_bone, None) is None:
|
||||
prop = rna_idprop_ui_prop_get(prop_pbone, target_prop, create=True)
|
||||
prop_pbone[target_prop] = 0.5
|
||||
prop["soft_min"] = 0.0
|
||||
prop["soft_max"] = 1.0
|
||||
|
||||
driver_path = prop_pbone.path_to_id() + ('["%s"]' % target_prop)
|
||||
|
||||
def blend_target(driver):
|
||||
tar = driver.targets.new()
|
||||
tar.name = target_bone
|
||||
tar.id_type = 'OBJECT'
|
||||
tar.id = obj
|
||||
tar.data_path = driver_path
|
||||
|
||||
def blend_location(new_pbone, from_bone_name, to_bone_name):
|
||||
con = new_pbone.constraints.new('COPY_LOCATION')
|
||||
con.target = obj
|
||||
con.subtarget = from_bone_name
|
||||
|
||||
con = new_pbone.constraints.new('COPY_LOCATION')
|
||||
con.target = obj
|
||||
con.subtarget = to_bone_name
|
||||
|
||||
fcurve = con.driver_add("influence", 0)
|
||||
driver = fcurve.driver
|
||||
driver.type = 'AVERAGE'
|
||||
fcurve.modifiers.remove(0) # grr dont need a modifier
|
||||
|
||||
blend_target(driver)
|
||||
|
||||
def blend_rotation(new_pbone, from_bone_name, to_bone_name):
|
||||
con = new_pbone.constraints.new('COPY_ROTATION')
|
||||
con.target = obj
|
||||
con.subtarget = from_bone_name
|
||||
|
||||
con = new_pbone.constraints.new('COPY_ROTATION')
|
||||
con.target = obj
|
||||
con.subtarget = to_bone_name
|
||||
|
||||
fcurve = con.driver_add("influence", 0)
|
||||
driver = fcurve.driver
|
||||
driver.type = 'AVERAGE'
|
||||
fcurve.modifiers.remove(0) # grr dont need a modifier
|
||||
|
||||
blend_target(driver)
|
||||
|
||||
for i, new_bone_name in enumerate(apply_bones):
|
||||
from_bone_name = from_bones[i]
|
||||
to_bone_name = to_bones[i]
|
||||
|
||||
# allow skipping some bones by having None in the list
|
||||
if None in (new_bone_name, from_bone_name, to_bone_name):
|
||||
continue
|
||||
|
||||
new_pbone = obj.pose.bones[new_bone_name]
|
||||
|
||||
# if the bone is connected or its location is totally locked then dont add location blending.
|
||||
if not (new_pbone.bone.connected or (False not in new_pbone.lock_location)):
|
||||
blend_location(new_pbone, from_bone_name, to_bone_name)
|
||||
|
||||
if not (False not in new_pbone.lock_rotation): # TODO. 4D chech?
|
||||
blend_rotation(new_pbone, from_bone_name, to_bone_name)
|
||||
|
||||
|
||||
def add_pole_target_bone(obj, base_bone_name, name, mode='CROSS'):
|
||||
'''
|
||||
Does not actually create a poll target, just the bone to use as a poll target
|
||||
'''
|
||||
mode_orig = obj.mode
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
|
||||
arm = obj.data
|
||||
|
||||
poll_ebone = arm.edit_bones.new(name)
|
||||
base_ebone = arm.edit_bones[base_bone_name]
|
||||
poll_name = poll_ebone.name
|
||||
parent_ebone = base_ebone.parent
|
||||
|
||||
base_head = base_ebone.head.copy()
|
||||
base_tail = base_ebone.tail.copy()
|
||||
base_dir = base_head - base_tail
|
||||
|
||||
parent_head = parent_ebone.head.copy()
|
||||
parent_tail = parent_ebone.tail.copy()
|
||||
parent_dir = parent_head - parent_tail
|
||||
|
||||
distance = (base_dir.length + parent_dir.length)
|
||||
|
||||
if mode == 'CROSS':
|
||||
# direction from the angle of the joint
|
||||
offset = base_dir.copy().normalize() - parent_dir.copy().normalize()
|
||||
offset.length = distance
|
||||
elif mode == 'ZAVERAGE':
|
||||
# between both bones Z axis
|
||||
z_axis_a = base_ebone.matrix.copy().rotationPart() * Vector(0.0, 0.0, -1.0)
|
||||
z_axis_b = parent_ebone.matrix.copy().rotationPart() * Vector(0.0, 0.0, -1.0)
|
||||
offset = (z_axis_a + z_axis_b).normalize() * distance
|
||||
else:
|
||||
# preset axis
|
||||
offset = Vector(0, 0, 0)
|
||||
if mode[0] == "+":
|
||||
val = distance
|
||||
else:
|
||||
val = - distance
|
||||
|
||||
setattr(offset, mode[1].lower(), val)
|
||||
|
||||
poll_ebone.head = base_head + offset
|
||||
poll_ebone.tail = base_head + (offset * (1.0 - (1.0 / 4.0)))
|
||||
|
||||
bpy.ops.object.mode_set(mode=mode_orig)
|
||||
|
||||
return poll_name
|
||||
|
||||
|
||||
|
||||
def get_side_name(name):
|
||||
'''
|
||||
Returns the last part of a string (typically a bone's name) indicating
|
||||
whether it is a a left or right (or center, or whatever) bone.
|
||||
Returns an empty string if nothing is found.
|
||||
'''
|
||||
if name[-2] in DELIMITER:
|
||||
return name[-2:]
|
||||
else:
|
||||
return ""
|
||||
|
||||
def get_base_name(name):
|
||||
'''
|
||||
Returns the part of a string (typically a bone's name) corresponding to it's
|
||||
base name (no sidedness, no ORG prefix).
|
||||
'''
|
||||
if name[-2] in DELIMITER:
|
||||
return name[:-2]
|
||||
else:
|
||||
return name
|
||||
|
||||
|
||||
def write_meta_rig(obj, func_name="metarig_template"):
|
||||
'''
|
||||
Write a metarig as a python script, this rig is to have all info needed for
|
||||
generating the real rig with rigify.
|
||||
'''
|
||||
code = []
|
||||
|
||||
code.append("def %s():" % func_name)
|
||||
code.append(" # generated by rigify.write_meta_rig")
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
code.append(" bpy.ops.object.mode_set(mode='EDIT')")
|
||||
|
||||
code.append(" obj = bpy.context.active_object")
|
||||
code.append(" arm = obj.data")
|
||||
|
||||
arm = obj.data
|
||||
# write parents first
|
||||
bones = [(len(bone.parent_recursive), bone.name) for bone in arm.edit_bones]
|
||||
bones.sort(key=lambda item: item[0])
|
||||
bones = [item[1] for item in bones]
|
||||
|
||||
|
||||
for bone_name in bones:
|
||||
bone = arm.edit_bones[bone_name]
|
||||
code.append(" bone = arm.edit_bones.new('%s')" % bone.name)
|
||||
code.append(" bone.head[:] = %.4f, %.4f, %.4f" % bone.head.toTuple(4))
|
||||
code.append(" bone.tail[:] = %.4f, %.4f, %.4f" % bone.tail.toTuple(4))
|
||||
code.append(" bone.roll = %.4f" % bone.roll)
|
||||
code.append(" bone.connected = %s" % str(bone.connected))
|
||||
if bone.parent:
|
||||
code.append(" bone.parent = arm.edit_bones['%s']" % bone.parent.name)
|
||||
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
code.append("")
|
||||
code.append(" bpy.ops.object.mode_set(mode='OBJECT')")
|
||||
|
||||
for bone_name in bones:
|
||||
pbone = obj.pose.bones[bone_name]
|
||||
pbone_written = False
|
||||
|
||||
# Only 1 level of props, simple types supported
|
||||
for key, value in pbone.items():
|
||||
if key.startswith("_"):
|
||||
continue
|
||||
|
||||
if type(value) not in (float, str, int):
|
||||
print("Unsupported ID Prop:", str((key, value)))
|
||||
continue
|
||||
|
||||
if type(value) == str:
|
||||
value = "'" + value + "'"
|
||||
|
||||
if not pbone_written: # only write bones we need
|
||||
code.append(" pbone = obj.pose.bones['%s']" % bone_name)
|
||||
|
||||
code.append(" pbone['%s'] = %s" % (key, value))
|
||||
|
||||
return "\n".join(code)
|
||||
|
||||
|
||||
|
||||
# *** bone class collection ***
|
||||
def bone_class_instance(obj, slots, name="BoneContainer"):
|
||||
'''
|
||||
bone collection utility class to help manage cases with
|
||||
edit/pose/bone bones where switching modes can invalidate some of the members.
|
||||
|
||||
there are also utility functions for manipulating all members.
|
||||
'''
|
||||
|
||||
if len(slots) != len(set(slots)):
|
||||
raise Exception("duplicate entries found %s" % attr_names)
|
||||
|
||||
attr_names = tuple(slots) # dont modify the original
|
||||
slots = list(slots) # dont modify the original
|
||||
for i in range(len(slots)):
|
||||
member = slots[i]
|
||||
slots.append(member + "_b") # bone bone
|
||||
slots.append(member + "_p") # pose bone
|
||||
slots.append(member + "_e") # edit bone
|
||||
|
||||
class_dict = { \
|
||||
"obj": obj, \
|
||||
"attr_names": attr_names, \
|
||||
"update": _bone_class_instance_update, \
|
||||
"rename": _bone_class_instance_rename, \
|
||||
"names": _bone_class_instance_names, \
|
||||
"copy": _bone_class_instance_copy, \
|
||||
"blend": _bone_class_instance_blend, \
|
||||
}
|
||||
|
||||
instance = auto_class_instance(slots, name, class_dict)
|
||||
return instance
|
||||
|
||||
def auto_class(slots, name="ContainerClass", class_dict=None):
|
||||
|
||||
if class_dict:
|
||||
class_dict = class_dict.copy()
|
||||
else:
|
||||
class_dict = {}
|
||||
|
||||
class_dict["__slots__"] = tuple(slots)
|
||||
|
||||
return type(name, (object,), class_dict)
|
||||
|
||||
|
||||
def auto_class_instance(slots, name="ContainerClass", class_dict=None):
|
||||
return auto_class(slots, name, class_dict)()
|
||||
|
||||
|
||||
def _bone_class_instance_update(self):
|
||||
''' Re-Assigns bones from the blender data
|
||||
'''
|
||||
arm = self.obj.data
|
||||
bbones = arm.bones
|
||||
pbones = self.obj.pose.bones
|
||||
ebones = arm.edit_bones
|
||||
|
||||
for member in self.attr_names:
|
||||
name = getattr(self, member, None)
|
||||
if name is not None:
|
||||
setattr(self, member + "_b", bbones.get(name, None))
|
||||
setattr(self, member + "_p", pbones.get(name, None))
|
||||
setattr(self, member + "_e", ebones.get(name, None))
|
||||
|
||||
|
||||
def _bone_class_instance_rename(self, attr, new_name):
|
||||
''' Rename bones, editmode only
|
||||
'''
|
||||
|
||||
if self.obj.mode != 'EDIT':
|
||||
raise Exception("Only rename in editmode supported")
|
||||
|
||||
ebone = getattr(self, attr + "_e")
|
||||
ebone.name = new_name
|
||||
|
||||
# we may not get what is asked for so get the name from the editbone
|
||||
setattr(self, attr, ebone.name)
|
||||
|
||||
|
||||
def _bone_class_instance_copy(self, from_fmt="%s", to_fmt="%s", exclude_attrs=(), base_names=None):
|
||||
from_name_ls = []
|
||||
new_name_ls = []
|
||||
new_slot_ls = []
|
||||
|
||||
for attr in self.attr_names:
|
||||
|
||||
if attr in exclude_attrs:
|
||||
continue
|
||||
|
||||
bone_name_orig = getattr(self, attr)
|
||||
ebone = getattr(self, attr + "_e")
|
||||
# orig_names[attr] = bone_name_orig
|
||||
|
||||
# insert formatting
|
||||
if from_fmt != "%s":
|
||||
bone_name = from_fmt % bone_name_orig
|
||||
ebone.name = bone_name
|
||||
bone_name = ebone.name # cant be sure we get what we ask for
|
||||
else:
|
||||
bone_name = bone_name_orig
|
||||
|
||||
setattr(self, attr, bone_name)
|
||||
|
||||
new_slot_ls.append(attr)
|
||||
from_name_ls.append(bone_name)
|
||||
if base_names:
|
||||
bone_name_orig = base_names[bone_name_orig]
|
||||
new_name_ls.append(to_fmt % bone_name_orig)
|
||||
|
||||
new_bones = copy_bone_simple_list(self.obj.data, from_name_ls, new_name_ls, True)
|
||||
new_bc = bone_class_instance(self.obj, new_slot_ls)
|
||||
|
||||
for i, attr in enumerate(new_slot_ls):
|
||||
ebone = new_bones[i]
|
||||
setattr(new_bc, attr + "_e", ebone)
|
||||
setattr(new_bc, attr, ebone.name)
|
||||
|
||||
return new_bc
|
||||
|
||||
|
||||
def _bone_class_instance_names(self):
|
||||
return [getattr(self, attr) for attr in self.attr_names]
|
||||
|
||||
|
||||
def _bone_class_instance_blend(self, from_bc, to_bc, target_bone=None, target_prop="blend"):
|
||||
'''
|
||||
Use for blending bone chains.
|
||||
|
||||
blend_target = (bone_name, bone_property)
|
||||
default to the last bone, blend prop
|
||||
|
||||
XXX - toggles editmode, need to re-validate all editbones :(
|
||||
'''
|
||||
|
||||
if self.attr_names != from_bc.attr_names or self.attr_names != to_bc.attr_names:
|
||||
raise Exception("can only blend between matching chains")
|
||||
|
||||
apply_bones = [getattr(self, attr) for attr in self.attr_names]
|
||||
from_bones = [getattr(from_bc, attr) for attr in from_bc.attr_names]
|
||||
to_bones = [getattr(to_bc, attr) for attr in to_bc.attr_names]
|
||||
|
||||
blend_bone_list(self.obj, apply_bones, from_bones, to_bones, target_bone, target_prop)
|
||||
@@ -120,7 +120,7 @@ def draw(layout, context, context_member, use_edit=True):
|
||||
prop = row.operator("wm.properties_edit", text="edit")
|
||||
assign_props(prop, val_draw, key)
|
||||
|
||||
prop = row.operator("wm.properties_remove", text="", icon='ICON_ZOOMOUT')
|
||||
prop = row.operator("wm.properties_remove", text="", icon='ZOOMOUT')
|
||||
assign_props(prop, val_draw, key)
|
||||
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ bpy.ops.add(AddTorus)
|
||||
import dynamic_menu
|
||||
|
||||
menu_func = (lambda self, context: self.layout.operator(AddTorus.bl_idname,
|
||||
text="Torus", icon='ICON_MESH_DONUT'))
|
||||
text="Torus", icon='MESH_DONUT'))
|
||||
|
||||
menu_item = dynamic_menu.add(bpy.types.INFO_MT_mesh_add, menu_func)
|
||||
|
||||
|
||||
99
release/scripts/op/screen_play_rendered_anim.py
Normal file
99
release/scripts/op/screen_play_rendered_anim.py
Normal file
@@ -0,0 +1,99 @@
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# Script copyright (C) Campbell J Barton
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# ***** END GPL LICENCE BLOCK *****
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
# History
|
||||
#
|
||||
# Originally written by Matt Ebb
|
||||
|
||||
import bpy
|
||||
import subprocess, platform
|
||||
|
||||
# from BKE_add_image_extension()
|
||||
img_format_exts = {
|
||||
'IRIS':'.rgb',
|
||||
'RADHDR':'.hdr',
|
||||
'PNG':'png',
|
||||
'TARGA':'tga',
|
||||
'RAWTARGA':'tga',
|
||||
'BMP':'bmp',
|
||||
'TIFF':'tif',
|
||||
'OPENEXR':'exr',
|
||||
'MULTILAYER':'exr',
|
||||
'CINEON':'cin',
|
||||
'DPX':'dpx',
|
||||
'JPEG':'jpg',
|
||||
'JPEG2000':'jp2',
|
||||
'QUICKTIME_QTKIT':'mov',
|
||||
'QUICKTIME_CARBON':'mov',
|
||||
'AVIRAW':'avi',
|
||||
'AVIJPEG':'avi',
|
||||
'AVICODEC':'avi',
|
||||
'XVID':'avi',
|
||||
'THEORA':'ogg',
|
||||
}
|
||||
|
||||
class PlayRenderedAnim(bpy.types.Operator):
|
||||
|
||||
bl_idname = "screen.play_rendered_anim"
|
||||
bl_label = "Play Rendered Animation"
|
||||
bl_register = True
|
||||
bl_undo = False
|
||||
|
||||
def execute(self, context):
|
||||
sce = context.scene
|
||||
rd = sce.render_data
|
||||
prefs = context.user_preferences
|
||||
|
||||
preset = prefs.filepaths.animation_player_preset
|
||||
player_path = prefs.filepaths.animation_player
|
||||
|
||||
# try and guess a command line if it doesn't exist
|
||||
if player_path == '':
|
||||
if preset == 'BLENDER24':
|
||||
player_path = 'blender'
|
||||
elif preset == 'DJV':
|
||||
player_path = 'djv_view'
|
||||
|
||||
# doesn't support ### frame notation yet
|
||||
file = "%s%04d" % (rd.output_path, sce.start_frame)
|
||||
if rd.file_extensions:
|
||||
file += '.' + img_format_exts[rd.file_format]
|
||||
|
||||
cmd = [player_path]
|
||||
# extra options, fps controls etc.
|
||||
if preset == 'BLENDER24':
|
||||
opts = ["-a", "-f", str(rd.fps), str(rd.fps_base), file]
|
||||
cmd.extend(opts)
|
||||
elif preset == 'DJV':
|
||||
opts = [file, "-playback_speed", str(rd.fps)]
|
||||
cmd.extend(opts)
|
||||
else: # 'CUSTOM'
|
||||
cmd.extend(file)
|
||||
|
||||
# launch it
|
||||
try:
|
||||
process = subprocess.Popen(cmd)
|
||||
except:
|
||||
pass
|
||||
|
||||
return('FINISHED',)
|
||||
|
||||
bpy.ops.add(PlayRenderedAnim)
|
||||
@@ -30,7 +30,7 @@ class MESH_OT_delete_edgeloop(bpy.types.Operator):
|
||||
bl_label = "Delete Edge Loop"
|
||||
|
||||
def execute(self, context):
|
||||
bpy.ops.tfm.edge_slide(value=1.0)
|
||||
bpy.ops.transform.edge_slide(value=1.0)
|
||||
bpy.ops.mesh.select_more()
|
||||
bpy.ops.mesh.remove_doubles()
|
||||
|
||||
|
||||
@@ -128,8 +128,8 @@ class DATA_PT_bone_groups(DataButtonsPanel):
|
||||
|
||||
col = row.column(align=True)
|
||||
col.active = (ob.proxy is None)
|
||||
col.operator("pose.group_add", icon='ICON_ZOOMIN', text="")
|
||||
col.operator("pose.group_remove", icon='ICON_ZOOMOUT', text="")
|
||||
col.operator("pose.group_add", icon='ZOOMIN', text="")
|
||||
col.operator("pose.group_remove", icon='ZOOMOUT', text="")
|
||||
|
||||
group = pose.active_bone_group
|
||||
if group:
|
||||
|
||||
@@ -43,7 +43,7 @@ class BONE_PT_context_bone(BoneButtonsPanel):
|
||||
bone = context.edit_bone
|
||||
|
||||
row = layout.row()
|
||||
row.label(text="", icon='ICON_BONE_DATA')
|
||||
row.label(text="", icon='BONE_DATA')
|
||||
row.prop(bone, "name", text="")
|
||||
|
||||
|
||||
|
||||
@@ -114,12 +114,12 @@ class DATA_PT_vertex_groups(DataButtonsPanel):
|
||||
row.template_list(ob, "vertex_groups", ob, "active_vertex_group_index", rows=rows)
|
||||
|
||||
col = row.column(align=True)
|
||||
col.operator("object.vertex_group_add", icon='ICON_ZOOMIN', text="")
|
||||
col.operator("object.vertex_group_remove", icon='ICON_ZOOMOUT', text="")
|
||||
col.operator("object.vertex_group_add", icon='ZOOMIN', text="")
|
||||
col.operator("object.vertex_group_remove", icon='ZOOMOUT', text="")
|
||||
|
||||
col.operator("object.vertex_group_copy", icon='ICON_COPY_ID', text="")
|
||||
col.operator("object.vertex_group_copy", icon='COPY_ID', text="")
|
||||
if ob.data.users > 1:
|
||||
col.operator("object.vertex_group_copy_to_linked", icon='ICON_LINK_AREA', text="")
|
||||
col.operator("object.vertex_group_copy_to_linked", icon='LINK_AREA', text="")
|
||||
|
||||
if group:
|
||||
row = layout.row()
|
||||
@@ -170,15 +170,15 @@ class DATA_PT_shape_keys(DataButtonsPanel):
|
||||
col = row.column()
|
||||
|
||||
sub = col.column(align=True)
|
||||
sub.operator("object.shape_key_add", icon='ICON_ZOOMIN', text="")
|
||||
sub.operator("object.shape_key_remove", icon='ICON_ZOOMOUT', text="")
|
||||
sub.operator("object.shape_key_add", icon='ZOOMIN', text="")
|
||||
sub.operator("object.shape_key_remove", icon='ZOOMOUT', text="")
|
||||
|
||||
if kb:
|
||||
col.separator()
|
||||
|
||||
sub = col.column(align=True)
|
||||
sub.operator("object.shape_key_move", icon='ICON_TRIA_UP', text="").type = 'UP'
|
||||
sub.operator("object.shape_key_move", icon='ICON_TRIA_DOWN', text="").type = 'DOWN'
|
||||
sub.operator("object.shape_key_move", icon='TRIA_UP', text="").type = 'UP'
|
||||
sub.operator("object.shape_key_move", icon='TRIA_DOWN', text="").type = 'DOWN'
|
||||
|
||||
split = layout.split(percentage=0.4)
|
||||
row = split.row()
|
||||
@@ -198,18 +198,18 @@ class DATA_PT_shape_keys(DataButtonsPanel):
|
||||
subsub = sub.row(align=True)
|
||||
subsub.active = enable_edit_value
|
||||
if ob.shape_key_lock:
|
||||
subsub.prop(ob, "shape_key_lock", icon='ICON_PINNED', text="")
|
||||
subsub.prop(ob, "shape_key_lock", icon='PINNED', text="")
|
||||
else:
|
||||
subsub.prop(ob, "shape_key_lock", icon='ICON_UNPINNED', text="")
|
||||
subsub.prop(ob, "shape_key_lock", icon='UNPINNED', text="")
|
||||
if kb.mute:
|
||||
subsub.prop(kb, "mute", icon='ICON_MUTE_IPO_ON', text="")
|
||||
subsub.prop(kb, "mute", icon='MUTE_IPO_ON', text="")
|
||||
else:
|
||||
subsub.prop(kb, "mute", icon='ICON_MUTE_IPO_OFF', text="")
|
||||
subsub.prop(kb, "mute", icon='MUTE_IPO_OFF', text="")
|
||||
sub.prop(ob, "shape_key_edit_mode", text="")
|
||||
|
||||
sub = row.row(align=True)
|
||||
sub.operator("object.shape_key_mirror", icon='ICON_ARROW_LEFTRIGHT', text="")
|
||||
sub.operator("object.shape_key_clear", icon='ICON_X', text="")
|
||||
sub.operator("object.shape_key_mirror", icon='ARROW_LEFTRIGHT', text="")
|
||||
sub.operator("object.shape_key_clear", icon='X', text="")
|
||||
|
||||
|
||||
row = layout.row()
|
||||
@@ -256,8 +256,8 @@ class DATA_PT_uv_texture(DataButtonsPanel):
|
||||
col.template_list(me, "uv_textures", me, "active_uv_texture_index", rows=2)
|
||||
|
||||
col = row.column(align=True)
|
||||
col.operator("mesh.uv_texture_add", icon='ICON_ZOOMIN', text="")
|
||||
col.operator("mesh.uv_texture_remove", icon='ICON_ZOOMOUT', text="")
|
||||
col.operator("mesh.uv_texture_add", icon='ZOOMIN', text="")
|
||||
col.operator("mesh.uv_texture_remove", icon='ZOOMOUT', text="")
|
||||
|
||||
lay = me.active_uv_texture
|
||||
if lay:
|
||||
@@ -278,8 +278,8 @@ class DATA_PT_vertex_colors(DataButtonsPanel):
|
||||
col.template_list(me, "vertex_colors", me, "active_vertex_color_index", rows=2)
|
||||
|
||||
col = row.column(align=True)
|
||||
col.operator("mesh.vertex_color_add", icon='ICON_ZOOMIN', text="")
|
||||
col.operator("mesh.vertex_color_remove", icon='ICON_ZOOMOUT', text="")
|
||||
col.operator("mesh.vertex_color_add", icon='ZOOMIN', text="")
|
||||
col.operator("mesh.vertex_color_remove", icon='ZOOMOUT', text="")
|
||||
|
||||
lay = me.active_vertex_color
|
||||
if lay:
|
||||
|
||||
@@ -89,9 +89,9 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel):
|
||||
row.template_list(ob, "materials", ob, "active_material_index", rows=2)
|
||||
|
||||
col = row.column(align=True)
|
||||
col.operator("object.material_slot_add", icon='ICON_ZOOMIN', text="")
|
||||
col.operator("object.material_slot_remove", icon='ICON_ZOOMOUT', text="")
|
||||
col.operator("object.material_slot_copy", icon='ICON_COPY_ID', text="")
|
||||
col.operator("object.material_slot_add", icon='ZOOMIN', text="")
|
||||
col.operator("object.material_slot_remove", icon='ZOOMOUT', text="")
|
||||
col.operator("object.material_slot_copy", icon='COPY_ID', text="")
|
||||
|
||||
if ob.mode == 'EDIT':
|
||||
row = layout.row(align=True)
|
||||
|
||||
@@ -38,7 +38,7 @@ class OBJECT_PT_context_object(ObjectButtonsPanel):
|
||||
ob = context.object
|
||||
|
||||
row = layout.row()
|
||||
row.label(text="", icon='ICON_OBJECT_DATA')
|
||||
row.label(text="", icon='OBJECT_DATA')
|
||||
row.prop(ob, "name", text="")
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ class OBJECT_PT_groups(ObjectButtonsPanel):
|
||||
|
||||
row = col.box().row()
|
||||
row.prop(group, "name", text="")
|
||||
row.operator("object.group_remove", text="", icon='ICON_X')
|
||||
row.operator("object.group_remove", text="", icon='X')
|
||||
|
||||
split = col.box().split()
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
|
||||
|
||||
if wide_ui:
|
||||
if target and owner:
|
||||
row.label(icon='ICON_ARROW_LEFTRIGHT')
|
||||
row.label(icon='ARROW_LEFTRIGHT')
|
||||
else:
|
||||
row = layout.row()
|
||||
if owner:
|
||||
|
||||
@@ -66,8 +66,8 @@ class PARTICLE_PT_particles(ParticleButtonsPanel):
|
||||
row.template_list(ob, "particle_systems", ob, "active_particle_system_index", rows=2)
|
||||
|
||||
col = row.column(align=True)
|
||||
col.operator("object.particle_system_add", icon='ICON_ZOOMIN', text="")
|
||||
col.operator("object.particle_system_remove", icon='ICON_ZOOMOUT', text="")
|
||||
col.operator("object.particle_system_add", icon='ZOOMIN', text="")
|
||||
col.operator("object.particle_system_remove", icon='ZOOMOUT', text="")
|
||||
|
||||
if psys and not psys.settings:
|
||||
split = layout.split(percentage=0.32)
|
||||
@@ -457,12 +457,12 @@ class PARTICLE_PT_physics(ParticleButtonsPanel):
|
||||
col = row.column()
|
||||
sub = col.row()
|
||||
subsub = sub.column(align=True)
|
||||
subsub.operator("particle.new_target", icon='ICON_ZOOMIN', text="")
|
||||
subsub.operator("particle.target_remove", icon='ICON_ZOOMOUT', text="")
|
||||
subsub.operator("particle.new_target", icon='ZOOMIN', text="")
|
||||
subsub.operator("particle.target_remove", icon='ZOOMOUT', text="")
|
||||
sub = col.row()
|
||||
subsub = sub.column(align=True)
|
||||
subsub.operator("particle.target_move_up", icon='VICON_MOVE_UP', text="")
|
||||
subsub.operator("particle.target_move_down", icon='VICON_MOVE_DOWN', text="")
|
||||
subsub.operator("particle.target_move_up", icon='MOVE_UP_VEC', text="")
|
||||
subsub.operator("particle.target_move_down", icon='MOVE_DOWN_VEC', text="")
|
||||
|
||||
key = psys.active_particle_target
|
||||
if key:
|
||||
@@ -512,11 +512,11 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel):
|
||||
#row.template_list(boids, "states", boids, "active_boid_state_index", compact="True")
|
||||
#col = row.row()
|
||||
#sub = col.row(align=True)
|
||||
#sub.operator("boid.state_add", icon='ICON_ZOOMIN', text="")
|
||||
#sub.operator("boid.state_del", icon='ICON_ZOOMOUT', text="")
|
||||
#sub.operator("boid.state_add", icon='ZOOMIN', text="")
|
||||
#sub.operator("boid.state_del", icon='ZOOMOUT', text="")
|
||||
#sub = row.row(align=True)
|
||||
#sub.operator("boid.state_move_up", icon='VICON_MOVE_UP', text="")
|
||||
#sub.operator("boid.state_move_down", icon='VICON_MOVE_DOWN', text="")
|
||||
#sub.operator("boid.state_move_up", icon='MOVE_UP_VEC', text="")
|
||||
#sub.operator("boid.state_move_down", icon='MOVE_DOWN_VEC', text="")
|
||||
|
||||
state = boids.active_boid_state
|
||||
|
||||
@@ -535,12 +535,12 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel):
|
||||
col = row.column()
|
||||
sub = col.row()
|
||||
subsub = sub.column(align=True)
|
||||
subsub.operator_menu_enum("boid.rule_add", "type", icon='ICON_ZOOMIN', text="")
|
||||
subsub.operator("boid.rule_del", icon='ICON_ZOOMOUT', text="")
|
||||
subsub.operator_menu_enum("boid.rule_add", "type", icon='ZOOMIN', text="")
|
||||
subsub.operator("boid.rule_del", icon='ZOOMOUT', text="")
|
||||
sub = col.row()
|
||||
subsub = sub.column(align=True)
|
||||
subsub.operator("boid.rule_move_up", icon='VICON_MOVE_UP', text="")
|
||||
subsub.operator("boid.rule_move_down", icon='VICON_MOVE_DOWN', text="")
|
||||
subsub.operator("boid.rule_move_up", icon='MOVE_UP_VEC', text="")
|
||||
subsub.operator("boid.rule_move_down", icon='MOVE_DOWN_VEC', text="")
|
||||
|
||||
rule = state.active_boid_rule
|
||||
|
||||
@@ -548,8 +548,8 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel):
|
||||
row = layout.row()
|
||||
row.prop(rule, "name", text="")
|
||||
#somebody make nice icons for boids here please! -jahka
|
||||
row.prop(rule, "in_air", icon='VICON_MOVE_UP', text="")
|
||||
row.prop(rule, "on_land", icon='VICON_MOVE_DOWN', text="")
|
||||
row.prop(rule, "in_air", icon='MOVE_UP_VEC', text="")
|
||||
row.prop(rule, "on_land", icon='MOVE_DOWN_VEC', text="")
|
||||
|
||||
row = layout.row()
|
||||
|
||||
@@ -695,10 +695,10 @@ class PARTICLE_PT_render(ParticleButtonsPanel):
|
||||
col = row.column()
|
||||
sub = col.row()
|
||||
subsub = sub.column(align=True)
|
||||
subsub.operator("particle.dupliob_copy", icon='ICON_ZOOMIN', text="")
|
||||
subsub.operator("particle.dupliob_remove", icon='ICON_ZOOMOUT', text="")
|
||||
subsub.operator("particle.dupliob_move_up", icon='VICON_MOVE_UP', text="")
|
||||
subsub.operator("particle.dupliob_move_down", icon='VICON_MOVE_DOWN', text="")
|
||||
subsub.operator("particle.dupliob_copy", icon='ZOOMIN', text="")
|
||||
subsub.operator("particle.dupliob_remove", icon='ZOOMOUT', text="")
|
||||
subsub.operator("particle.dupliob_move_up", icon='MOVE_UP_VEC', text="")
|
||||
subsub.operator("particle.dupliob_move_down", icon='MOVE_DOWN_VEC', text="")
|
||||
|
||||
weight = part.active_dupliweight
|
||||
if weight:
|
||||
|
||||
@@ -30,8 +30,8 @@ def point_cache_ui(self, context, cache, enabled, particles, smoke):
|
||||
row = layout.row()
|
||||
row.template_list(cache, "point_cache_list", cache, "active_point_cache_index", rows=2)
|
||||
col = row.column(align=True)
|
||||
col.operator("ptcache.add", icon='ICON_ZOOMIN', text="")
|
||||
col.operator("ptcache.remove", icon='ICON_ZOOMOUT', text="")
|
||||
col.operator("ptcache.add", icon='ZOOMIN', text="")
|
||||
col.operator("ptcache.remove", icon='ZOOMOUT', text="")
|
||||
|
||||
row = layout.row()
|
||||
row.label(text="File Name:")
|
||||
|
||||
@@ -72,7 +72,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
|
||||
layout.prop(fluid, "type", text="")
|
||||
|
||||
if fluid.type == 'DOMAIN':
|
||||
layout.operator("fluid.bake", text="Bake Fluid Simulation", icon='ICON_MOD_FLUIDSIM')
|
||||
layout.operator("fluid.bake", text="Bake Fluid Simulation", icon='MOD_FLUIDSIM')
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
|
||||
@@ -53,11 +53,11 @@ class RENDER_PT_render(RenderButtonsPanel):
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
col.operator("screen.render", text="Image", icon='ICON_RENDER_STILL')
|
||||
col.operator("screen.render", text="Image", icon='RENDER_STILL')
|
||||
|
||||
if wide_ui:
|
||||
col = split.column()
|
||||
col.operator("screen.render", text="Animation", icon='ICON_RENDER_ANIMATION').animation = True
|
||||
col.operator("screen.render", text="Animation", icon='RENDER_ANIMATION').animation = True
|
||||
|
||||
layout.prop(rd, "display_mode", text="Display")
|
||||
|
||||
@@ -78,8 +78,8 @@ class RENDER_PT_layers(RenderButtonsPanel):
|
||||
row.template_list(rd, "layers", rd, "active_layer_index", rows=2)
|
||||
|
||||
col = row.column(align=True)
|
||||
col.operator("scene.render_layer_add", icon='ICON_ZOOMIN', text="")
|
||||
col.operator("scene.render_layer_remove", icon='ICON_ZOOMOUT', text="")
|
||||
col.operator("scene.render_layer_add", icon='ZOOMIN', text="")
|
||||
col.operator("scene.render_layer_remove", icon='ZOOMOUT', text="")
|
||||
|
||||
rl = rd.layers[rd.active_layer_index]
|
||||
|
||||
@@ -145,19 +145,19 @@ class RENDER_PT_layers(RenderButtonsPanel):
|
||||
col.prop(rl, "pass_diffuse")
|
||||
row = col.row()
|
||||
row.prop(rl, "pass_specular")
|
||||
row.prop(rl, "pass_specular_exclude", text="", icon='ICON_X')
|
||||
row.prop(rl, "pass_specular_exclude", text="", icon='X')
|
||||
row = col.row()
|
||||
row.prop(rl, "pass_shadow")
|
||||
row.prop(rl, "pass_shadow_exclude", text="", icon='ICON_X')
|
||||
row.prop(rl, "pass_shadow_exclude", text="", icon='X')
|
||||
row = col.row()
|
||||
row.prop(rl, "pass_ao")
|
||||
row.prop(rl, "pass_ao_exclude", text="", icon='ICON_X')
|
||||
row.prop(rl, "pass_ao_exclude", text="", icon='X')
|
||||
row = col.row()
|
||||
row.prop(rl, "pass_reflection")
|
||||
row.prop(rl, "pass_reflection_exclude", text="", icon='ICON_X')
|
||||
row.prop(rl, "pass_reflection_exclude", text="", icon='X')
|
||||
row = col.row()
|
||||
row.prop(rl, "pass_refraction")
|
||||
row.prop(rl, "pass_refraction_exclude", text="", icon='ICON_X')
|
||||
row.prop(rl, "pass_refraction_exclude", text="", icon='X')
|
||||
|
||||
|
||||
class RENDER_PT_shading(RenderButtonsPanel):
|
||||
|
||||
@@ -85,8 +85,8 @@ class SCENE_PT_keying_sets(SceneButtonsPanel):
|
||||
col.template_list(scene, "keying_sets", scene, "active_keying_set_index", rows=2)
|
||||
|
||||
col = row.column(align=True)
|
||||
col.operator("anim.keying_set_add", icon='ICON_ZOOMIN', text="")
|
||||
col.operator("anim.keying_set_remove", icon='ICON_ZOOMOUT', text="")
|
||||
col.operator("anim.keying_set_add", icon='ZOOMIN', text="")
|
||||
col.operator("anim.keying_set_remove", icon='ZOOMOUT', text="")
|
||||
|
||||
ks = scene.active_keying_set
|
||||
if ks:
|
||||
@@ -100,7 +100,8 @@ class SCENE_PT_keying_sets(SceneButtonsPanel):
|
||||
col = row.column()
|
||||
col.label(text="Keyframing Settings:")
|
||||
col.prop(ks, "insertkey_needed", text="Needed")
|
||||
col.prop(ks, "insertkey_visual", text="Visual")
|
||||
col.prop(ks, "insertkey_visual", text="Visual")
|
||||
col.prop(ks, "insertkey_xyz_to_rgb", text="XYZ to RGB")
|
||||
|
||||
|
||||
class SCENE_PT_keying_set_paths(SceneButtonsPanel):
|
||||
@@ -125,15 +126,15 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel):
|
||||
col.template_list(ks, "paths", ks, "active_path_index", rows=2)
|
||||
|
||||
col = row.column(align=True)
|
||||
col.operator("anim.keying_set_path_add", icon='ICON_ZOOMIN', text="")
|
||||
col.operator("anim.keying_set_path_remove", icon='ICON_ZOOMOUT', text="")
|
||||
col.operator("anim.keying_set_path_add", icon='ZOOMIN', text="")
|
||||
col.operator("anim.keying_set_path_remove", icon='ZOOMOUT', text="")
|
||||
|
||||
ksp = ks.active_path
|
||||
if ksp:
|
||||
col = layout.column()
|
||||
col.label(text="Target:")
|
||||
col.template_any_ID(ksp, "id", "id_type")
|
||||
col.template_path_builder(ksp, "rna_path", ksp.id)
|
||||
col.template_path_builder(ksp, "data_path", ksp.id)
|
||||
|
||||
|
||||
row = layout.row()
|
||||
|
||||
@@ -99,8 +99,8 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel):
|
||||
row.template_list(idblock, "textures", idblock, "active_texture_index", rows=2)
|
||||
|
||||
col = row.column(align=True)
|
||||
col.operator("texture.slot_move", text="", icon='ICON_TRIA_UP').type = 'UP'
|
||||
col.operator("texture.slot_move", text="", icon='ICON_TRIA_DOWN').type = 'DOWN'
|
||||
col.operator("texture.slot_move", text="", icon='TRIA_UP').type = 'UP'
|
||||
col.operator("texture.slot_move", text="", icon='TRIA_DOWN').type = 'DOWN'
|
||||
|
||||
|
||||
if wide_ui:
|
||||
|
||||
@@ -57,8 +57,8 @@ class DOPESHEET_HT_header(bpy.types.Header):
|
||||
layout.prop(st, "autosnap", text="")
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.operator("action.copy", text="", icon='ICON_COPYDOWN')
|
||||
row.operator("action.paste", text="", icon='ICON_PASTEDOWN')
|
||||
row.operator("action.copy", text="", icon='COPYDOWN')
|
||||
row.operator("action.paste", text="", icon='PASTEDOWN')
|
||||
|
||||
|
||||
class DOPESHEET_MT_view(bpy.types.Menu):
|
||||
@@ -178,9 +178,9 @@ class DOPESHEET_MT_key_transform(bpy.types.Menu):
|
||||
layout = self.layout
|
||||
|
||||
layout.column()
|
||||
layout.operator("tfm.translate", text="Grab/Move")
|
||||
layout.operator("tfm.transform", text="Extend").mode = 'TIME_EXTEND'
|
||||
layout.operator("tfm.resize", text="Scale")
|
||||
layout.operator("transform.translate", text="Grab/Move")
|
||||
layout.operator("transform.transform", text="Extend").mode = 'TIME_EXTEND'
|
||||
layout.operator("transform.resize", text="Scale")
|
||||
|
||||
|
||||
bpy.types.register(DOPESHEET_HT_header) # header/menu classes
|
||||
|
||||
@@ -35,22 +35,22 @@ class FILEBROWSER_HT_header(bpy.types.Header):
|
||||
row.separator()
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.operator("file.previous", text="", icon='ICON_BACK')
|
||||
row.operator("file.next", text="", icon='ICON_FORWARD')
|
||||
row.operator("file.parent", text="", icon='ICON_FILE_PARENT')
|
||||
row.operator("file.refresh", text="", icon='ICON_FILE_REFRESH')
|
||||
row.operator("file.previous", text="", icon='BACK')
|
||||
row.operator("file.next", text="", icon='FORWARD')
|
||||
row.operator("file.parent", text="", icon='FILE_PARENT')
|
||||
row.operator("file.refresh", text="", icon='FILE_REFRESH')
|
||||
|
||||
row = layout.row()
|
||||
row.separator()
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.operator("file.directory_new", text="", icon='ICON_NEWFOLDER')
|
||||
row.operator("file.directory_new", text="", icon='NEWFOLDER')
|
||||
|
||||
layout.prop(params, "display", expand=True, text="")
|
||||
layout.prop(params, "sort", expand=True, text="")
|
||||
|
||||
layout.prop(params, "hide_dot", text="Hide Invisible")
|
||||
layout.prop(params, "do_filter", text="", icon='ICON_FILTER')
|
||||
layout.prop(params, "do_filter", text="", icon='FILTER')
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.active = params.do_filter
|
||||
|
||||
@@ -46,14 +46,14 @@ class GRAPH_HT_header(bpy.types.Header):
|
||||
layout.prop(st, "pivot_point", text="", icon_only=True)
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.operator("graph.copy", text="", icon='ICON_COPYDOWN')
|
||||
row.operator("graph.paste", text="", icon='ICON_PASTEDOWN')
|
||||
row.operator("graph.copy", text="", icon='COPYDOWN')
|
||||
row.operator("graph.paste", text="", icon='PASTEDOWN')
|
||||
|
||||
row = layout.row(align=True)
|
||||
if st.has_ghost_curves:
|
||||
row.operator("graph.ghost_curves_clear", text="", icon='ICON_GHOST_DISABLED')
|
||||
row.operator("graph.ghost_curves_clear", text="", icon='GHOST_DISABLED')
|
||||
else:
|
||||
row.operator("graph.ghost_curves_create", text="", icon='ICON_GHOST_ENABLED')
|
||||
row.operator("graph.ghost_curves_create", text="", icon='GHOST_ENABLED')
|
||||
|
||||
|
||||
class GRAPH_MT_view(bpy.types.Menu):
|
||||
@@ -67,7 +67,7 @@ class GRAPH_MT_view(bpy.types.Menu):
|
||||
layout.column()
|
||||
|
||||
layout.separator()
|
||||
layout.operator("graph.properties", icon="ICON_MENU_PANEL")
|
||||
layout.operator("graph.properties", icon='MENU_PANEL')
|
||||
|
||||
layout.prop(st, "show_cframe_indicator")
|
||||
layout.prop(st, "show_cursor")
|
||||
@@ -76,9 +76,9 @@ class GRAPH_MT_view(bpy.types.Menu):
|
||||
|
||||
layout.separator()
|
||||
if st.show_handles:
|
||||
layout.operator("graph.handles_view_toggle", icon="ICON_CHECKBOX_HLT", text="Show All Handles")
|
||||
layout.operator("graph.handles_view_toggle", icon='CHECKBOX_HLT', text="Show All Handles")
|
||||
else:
|
||||
layout.operator("graph.handles_view_toggle", icon="ICON_CHECKBOX_DEHLT", text="Show All Handles")
|
||||
layout.operator("graph.handles_view_toggle", icon='CHECKBOX_DEHLT', text="Show All Handles")
|
||||
layout.prop(st, "only_selected_curves_handles")
|
||||
layout.prop(st, "only_selected_keyframe_handles")
|
||||
layout.operator("anim.time_toggle")
|
||||
@@ -181,10 +181,10 @@ class GRAPH_MT_key_transform(bpy.types.Menu):
|
||||
layout = self.layout
|
||||
|
||||
layout.column()
|
||||
layout.operator("tfm.translate", text="Grab/Move")
|
||||
layout.operator("tfm.transform", text="Extend").mode = 'TIME_EXTEND'
|
||||
layout.operator("tfm.rotate", text="Rotate")
|
||||
layout.operator("tfm.resize", text="Scale")
|
||||
layout.operator("transform.translate", text="Grab/Move")
|
||||
layout.operator("transform.transform", text="Extend").mode = 'TIME_EXTEND'
|
||||
layout.operator("transform.rotate", text="Rotate")
|
||||
layout.operator("transform.resize", text="Scale")
|
||||
|
||||
|
||||
bpy.types.register(GRAPH_HT_header) # header/menu classes
|
||||
|
||||
@@ -34,7 +34,7 @@ class IMAGE_MT_view(bpy.types.Menu):
|
||||
|
||||
show_uvedit = sima.show_uvedit
|
||||
|
||||
layout.operator("image.properties", icon='ICON_MENU_PANEL')
|
||||
layout.operator("image.properties", icon='MENU_PANEL')
|
||||
|
||||
layout.separator()
|
||||
|
||||
@@ -150,9 +150,9 @@ class IMAGE_MT_uvs_transform(bpy.types.Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator("tfm.translate")
|
||||
layout.operator("tfm.rotate")
|
||||
layout.operator("tfm.resize")
|
||||
layout.operator("transform.translate")
|
||||
layout.operator("transform.rotate")
|
||||
layout.operator("transform.resize")
|
||||
|
||||
|
||||
class IMAGE_MT_uvs_snap(bpy.types.Menu):
|
||||
@@ -179,8 +179,8 @@ class IMAGE_MT_uvs_mirror(bpy.types.Menu):
|
||||
layout = self.layout
|
||||
layout.operator_context = 'EXEC_REGION_WIN'
|
||||
|
||||
layout.operator("tfm.mirror", text="X Axis").constraint_axis[0] = True
|
||||
layout.operator("tfm.mirror", text="Y Axis").constraint_axis[1] = True
|
||||
layout.operator("transform.mirror", text="X Axis").constraint_axis[0] = True
|
||||
layout.operator("transform.mirror", text="Y Axis").constraint_axis[1] = True
|
||||
|
||||
|
||||
class IMAGE_MT_uvs_weldalign(bpy.types.Menu):
|
||||
@@ -286,10 +286,14 @@ class IMAGE_HT_header(bpy.types.Header):
|
||||
layout.prop(settings, "uv_selection_mode", text="", expand=True)
|
||||
layout.prop(uvedit, "sticky_selection_mode", text="", icon_only=True)
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(settings, "proportional_editing", text="", icon_only=True)
|
||||
if settings.proportional_editing != 'DISABLED':
|
||||
row.prop(settings, "proportional_editing_falloff", text="", icon_only=True)
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(settings, "snap", text="")
|
||||
if settings.snap:
|
||||
row.prop(settings, "snap_mode", text="")
|
||||
row.prop(settings, "snap_element", text="", icon_only=True)
|
||||
|
||||
# mesh = context.edit_object.data
|
||||
# row.prop_object(mesh, "active_uv_layer", mesh, "uv_textures")
|
||||
@@ -307,12 +311,12 @@ class IMAGE_HT_header(bpy.types.Header):
|
||||
|
||||
row = layout.row(align=True)
|
||||
if ima.type == 'COMPOSITE':
|
||||
row.operator("image.record_composite", icon='ICON_REC')
|
||||
row.operator("image.record_composite", icon='REC')
|
||||
if ima.type == 'COMPOSITE' and ima.source in ('MOVIE', 'SEQUENCE'):
|
||||
row.operator("image.play_composite", icon='ICON_PLAY')
|
||||
row.operator("image.play_composite", icon='PLAY')
|
||||
|
||||
if show_uvedit or sima.image_painting:
|
||||
layout.prop(sima, "update_automatically", text="")
|
||||
layout.prop(sima, "update_automatically", text="", icon_only=True, icon='LOCKED')
|
||||
|
||||
|
||||
class IMAGE_PT_image_properties(bpy.types.Panel):
|
||||
|
||||
@@ -47,7 +47,7 @@ class INFO_HT_header(bpy.types.Header):
|
||||
sub.menu("INFO_MT_help")
|
||||
|
||||
if window.screen.fullscreen:
|
||||
layout.operator("screen.back_to_previous", icon="ICON_SCREEN_BACK", text="Back to Previous")
|
||||
layout.operator("screen.back_to_previous", icon='SCREEN_BACK', text="Back to Previous")
|
||||
layout.separator()
|
||||
else:
|
||||
layout.template_ID(context.window, "screen", new="screen.new", unlink="screen.delete")
|
||||
@@ -66,7 +66,7 @@ class INFO_HT_header(bpy.types.Header):
|
||||
|
||||
layout.label(text=scene.statistics())
|
||||
|
||||
layout.operator("wm.window_fullscreen_toggle", icon='ICON_FULLSCREEN_ENTER', text="")
|
||||
layout.operator("wm.window_fullscreen_toggle", icon='FULLSCREEN_ENTER', text="")
|
||||
|
||||
|
||||
class INFO_MT_file(bpy.types.Menu):
|
||||
@@ -76,9 +76,9 @@ class INFO_MT_file(bpy.types.Menu):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator_context = 'EXEC_AREA'
|
||||
layout.operator("wm.read_homefile", text="New", icon='ICON_NEW')
|
||||
layout.operator("wm.read_homefile", text="New", icon='NEW')
|
||||
layout.operator_context = 'INVOKE_AREA'
|
||||
layout.operator("wm.open_mainfile", text="Open...", icon='ICON_FILE_FOLDER')
|
||||
layout.operator("wm.open_mainfile", text="Open...", icon='FILE_FOLDER')
|
||||
layout.operator_menu_enum("wm.open_recentfile", "file", text="Open Recent")
|
||||
layout.operator("wm.recover_last_session")
|
||||
layout.operator("wm.recover_auto_save", text="Recover Auto Save...")
|
||||
@@ -86,13 +86,13 @@ class INFO_MT_file(bpy.types.Menu):
|
||||
layout.separator()
|
||||
|
||||
layout.operator_context = 'INVOKE_AREA'
|
||||
layout.operator("wm.save_mainfile", text="Save", icon='ICON_FILE_TICK')
|
||||
layout.operator("wm.save_mainfile", text="Save", icon='FILE_TICK')
|
||||
layout.operator_context = 'INVOKE_AREA'
|
||||
layout.operator("wm.save_as_mainfile", text="Save As...")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("screen.userpref_show", text="User Preferences...", icon='ICON_PREFERENCES')
|
||||
layout.operator("screen.userpref_show", text="User Preferences...", icon='PREFERENCES')
|
||||
layout.operator("wm.read_homefile", text="Load Factory Settings").factory = True
|
||||
|
||||
layout.separator()
|
||||
@@ -113,7 +113,7 @@ class INFO_MT_file(bpy.types.Menu):
|
||||
layout.separator()
|
||||
|
||||
layout.operator_context = 'EXEC_AREA'
|
||||
layout.operator("wm.exit_blender", text="Quit", icon='ICON_QUIT')
|
||||
layout.operator("wm.exit_blender", text="Quit", icon='QUIT')
|
||||
|
||||
# test for expanding menus
|
||||
'''
|
||||
@@ -171,16 +171,25 @@ class INFO_MT_mesh_add(dynamic_menu.DynMenu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
layout.operator("mesh.primitive_plane_add", icon='ICON_MESH_PLANE', text="Plane")
|
||||
layout.operator("mesh.primitive_cube_add", icon='ICON_MESH_CUBE', text="Cube")
|
||||
layout.operator("mesh.primitive_circle_add", icon='ICON_MESH_CIRCLE', text="Circle")
|
||||
layout.operator("mesh.primitive_uv_sphere_add", icon='ICON_MESH_UVSPHERE', text="UV Sphere")
|
||||
layout.operator("mesh.primitive_ico_sphere_add", icon='ICON_MESH_ICOSPHERE', text="Icosphere")
|
||||
layout.operator("mesh.primitive_tube_add", icon='ICON_MESH_TUBE', text="Tube")
|
||||
layout.operator("mesh.primitive_cone_add", icon='ICON_MESH_CONE', text="Cone")
|
||||
layout.operator("mesh.primitive_plane_add", icon='MESH_PLANE', text="Plane")
|
||||
layout.operator("mesh.primitive_cube_add", icon='MESH_CUBE', text="Cube")
|
||||
layout.operator("mesh.primitive_circle_add", icon='MESH_CIRCLE', text="Circle")
|
||||
layout.operator("mesh.primitive_uv_sphere_add", icon='MESH_UVSPHERE', text="UV Sphere")
|
||||
layout.operator("mesh.primitive_ico_sphere_add", icon='MESH_ICOSPHERE', text="Icosphere")
|
||||
layout.operator("mesh.primitive_tube_add", icon='MESH_TUBE', text="Tube")
|
||||
layout.operator("mesh.primitive_cone_add", icon='MESH_CONE', text="Cone")
|
||||
layout.separator()
|
||||
layout.operator("mesh.primitive_grid_add", icon='ICON_MESH_GRID', text="Grid")
|
||||
layout.operator("mesh.primitive_monkey_add", icon='ICON_MESH_MONKEY', text="Monkey")
|
||||
layout.operator("mesh.primitive_grid_add", icon='MESH_GRID', text="Grid")
|
||||
layout.operator("mesh.primitive_monkey_add", icon='MESH_MONKEY', text="Monkey")
|
||||
|
||||
class INFO_MT_armature_add(dynamic_menu.DynMenu):
|
||||
bl_idname = "INFO_MT_armature_add"
|
||||
bl_label = "Armature"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
layout.operator("object.armature_add", text="Single Bone", icon='BONE_DATA')
|
||||
|
||||
|
||||
class INFO_MT_add(bpy.types.Menu):
|
||||
@@ -191,37 +200,30 @@ class INFO_MT_add(bpy.types.Menu):
|
||||
|
||||
layout.operator_context = 'EXEC_SCREEN'
|
||||
|
||||
#layout.operator_menu_enum("object.mesh_add", "type", text="Mesh", icon='ICON_OUTLINER_OB_MESH')
|
||||
layout.menu("INFO_MT_mesh_add", icon='ICON_OUTLINER_OB_MESH')
|
||||
|
||||
layout.operator_menu_enum("object.curve_add", "type", text="Curve", icon='ICON_OUTLINER_OB_CURVE')
|
||||
layout.operator_menu_enum("object.surface_add", "type", text="Surface", icon='ICON_OUTLINER_OB_SURFACE')
|
||||
layout.operator_menu_enum("object.metaball_add", "type", 'META', text="Metaball", icon='ICON_OUTLINER_OB_META')
|
||||
layout.operator("object.text_add", text="Text", icon='ICON_OUTLINER_OB_FONT')
|
||||
#layout.operator_menu_enum("object.mesh_add", "type", text="Mesh", icon='OUTLINER_OB_MESH')
|
||||
layout.menu("INFO_MT_mesh_add", icon='OUTLINER_OB_MESH')
|
||||
|
||||
layout.operator_menu_enum("object.curve_add", "type", text="Curve", icon='OUTLINER_OB_CURVE')
|
||||
layout.operator_menu_enum("object.surface_add", "type", text="Surface", icon='OUTLINER_OB_SURFACE')
|
||||
layout.operator_menu_enum("object.metaball_add", "type", 'META', text="Metaball", icon='OUTLINER_OB_META')
|
||||
layout.operator("object.text_add", text="Text", icon='OUTLINER_OB_FONT')
|
||||
layout.separator()
|
||||
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
|
||||
layout.operator("object.armature_add", text="Armature", icon='ICON_OUTLINER_OB_ARMATURE')
|
||||
layout.operator("object.add", text="Lattice", icon='ICON_OUTLINER_OB_LATTICE').type = 'LATTICE'
|
||||
layout.operator("object.add", text="Empty", icon='ICON_OUTLINER_OB_EMPTY').type = 'EMPTY'
|
||||
|
||||
layout.menu("INFO_MT_armature_add", icon='OUTLINER_OB_ARMATURE')
|
||||
layout.operator("object.add", text="Lattice", icon='OUTLINER_OB_LATTICE').type = 'LATTICE'
|
||||
layout.operator("object.add", text="Empty", icon='OUTLINER_OB_EMPTY').type = 'EMPTY'
|
||||
layout.separator()
|
||||
|
||||
layout.operator("object.add", text="Camera", icon='ICON_OUTLINER_OB_CAMERA').type = 'CAMERA'
|
||||
|
||||
layout.operator("object.add", text="Camera", icon='OUTLINER_OB_CAMERA').type = 'CAMERA'
|
||||
layout.operator_context = 'EXEC_SCREEN'
|
||||
|
||||
layout.operator_menu_enum("object.lamp_add", "type", 'LAMP', text="Lamp", icon='ICON_OUTLINER_OB_LAMP')
|
||||
|
||||
layout.operator_menu_enum("object.lamp_add", "type", 'LAMP', text="Lamp", icon='OUTLINER_OB_LAMP')
|
||||
layout.separator()
|
||||
|
||||
layout.operator_menu_enum("object.effector_add", "type", 'EMPTY', text="Force Field", icon='ICON_OUTLINER_OB_EMPTY')
|
||||
|
||||
layout.operator_menu_enum("object.effector_add", "type", 'EMPTY', text="Force Field", icon='OUTLINER_OB_EMPTY')
|
||||
layout.separator()
|
||||
|
||||
layout.operator_menu_enum("object.group_instance_add", "type", text="Group Instance", icon='ICON_OUTLINER_OB_EMPTY')
|
||||
layout.operator_menu_enum("object.group_instance_add", "type", text="Group Instance", icon='OUTLINER_OB_EMPTY')
|
||||
|
||||
|
||||
class INFO_MT_game(bpy.types.Menu):
|
||||
@@ -250,8 +252,8 @@ class INFO_MT_render(bpy.types.Menu):
|
||||
|
||||
# rd = context.scene.render_data
|
||||
|
||||
layout.operator("screen.render", text="Render Image", icon='ICON_RENDER_STILL')
|
||||
layout.operator("screen.render", text="Render Animation", icon='ICON_RENDER_ANIMATION').animation = True
|
||||
layout.operator("screen.render", text="Render Image", icon='RENDER_STILL')
|
||||
layout.operator("screen.render", text="Render Animation", icon='RENDER_ANIMATION').animation = True
|
||||
|
||||
layout.separator()
|
||||
|
||||
@@ -261,6 +263,7 @@ class INFO_MT_render(bpy.types.Menu):
|
||||
layout.separator()
|
||||
|
||||
layout.operator("screen.render_view_show")
|
||||
layout.operator("screen.play_rendered_anim")
|
||||
|
||||
|
||||
class INFO_MT_help(bpy.types.Menu):
|
||||
@@ -269,19 +272,19 @@ class INFO_MT_help(bpy.types.Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator("help.manual", icon='ICON_HELP')
|
||||
layout.operator("help.release_logs", icon='ICON_URL')
|
||||
layout.operator("help.manual", icon='HELP')
|
||||
layout.operator("help.release_logs", icon='URL')
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("help.blender_website", icon='ICON_URL')
|
||||
layout.operator("help.blender_eshop", icon='ICON_URL')
|
||||
layout.operator("help.developer_community", icon='ICON_URL')
|
||||
layout.operator("help.user_community", icon='ICON_URL')
|
||||
layout.operator("help.blender_website", icon='URL')
|
||||
layout.operator("help.blender_eshop", icon='URL')
|
||||
layout.operator("help.developer_community", icon='URL')
|
||||
layout.operator("help.user_community", icon='URL')
|
||||
layout.separator()
|
||||
layout.operator("help.report_bug", icon='ICON_URL')
|
||||
layout.operator("help.report_bug", icon='URL')
|
||||
layout.separator()
|
||||
layout.operator("help.python_api", icon='ICON_URL')
|
||||
layout.operator("help.python_api", icon='URL')
|
||||
layout.operator("help.operator_cheat_sheet")
|
||||
|
||||
bpy.types.register(INFO_HT_header)
|
||||
@@ -291,6 +294,7 @@ bpy.types.register(INFO_MT_file_export)
|
||||
bpy.types.register(INFO_MT_file_external_data)
|
||||
bpy.types.register(INFO_MT_add)
|
||||
bpy.types.register(INFO_MT_mesh_add)
|
||||
bpy.types.register(INFO_MT_armature_add)
|
||||
bpy.types.register(INFO_MT_game)
|
||||
bpy.types.register(INFO_MT_render)
|
||||
bpy.types.register(INFO_MT_help)
|
||||
|
||||
@@ -43,7 +43,7 @@ class LOGIC_PT_properties(bpy.types.Panel):
|
||||
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, "debug", text="", toggle=True, icon='ICON_INFO')
|
||||
row.operator("object.game_property_remove", text="", icon='ICON_X').index = i
|
||||
row.prop(prop, "debug", text="", toggle=True, icon='INFO')
|
||||
row.operator("object.game_property_remove", text="", icon='X').index = i
|
||||
|
||||
bpy.types.register(LOGIC_PT_properties)
|
||||
|
||||
@@ -53,7 +53,7 @@ class NLA_MT_view(bpy.types.Menu):
|
||||
|
||||
layout.column()
|
||||
|
||||
layout.operator("nla.properties", icon="ICON_MENU_PANEL")
|
||||
layout.operator("nla.properties", icon='MENU_PANEL')
|
||||
|
||||
layout.separator()
|
||||
layout.prop(st, "show_cframe_indicator")
|
||||
@@ -153,9 +153,9 @@ class NLA_MT_edit_transform(bpy.types.Menu):
|
||||
layout = self.layout
|
||||
|
||||
layout.column()
|
||||
layout.operator("tfm.translate", text="Grab/Move")
|
||||
layout.operator("tfm.transform", text="Extend").mode = 'TIME_EXTEND'
|
||||
layout.operator("tfm.resize", text="Scale")
|
||||
layout.operator("transform.translate", text="Grab/Move")
|
||||
layout.operator("transform.transform", text="Extend").mode = 'TIME_EXTEND'
|
||||
layout.operator("transform.resize", text="Scale")
|
||||
|
||||
|
||||
bpy.types.register(NLA_HT_header) # header/menu classes
|
||||
|
||||
@@ -73,7 +73,7 @@ class NODE_MT_view(bpy.types.Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator("node.properties", icon='ICON_MENU_PANEL')
|
||||
layout.operator("node.properties", icon='MENU_PANEL')
|
||||
layout.separator()
|
||||
|
||||
layout.operator("view2d.zoom_in")
|
||||
@@ -109,9 +109,9 @@ class NODE_MT_node(bpy.types.Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator("tfm.translate")
|
||||
layout.operator("tfm.rotate")
|
||||
layout.operator("tfm.resize")
|
||||
layout.operator("transform.translate")
|
||||
layout.operator("transform.rotate")
|
||||
layout.operator("transform.resize")
|
||||
|
||||
layout.separator()
|
||||
|
||||
|
||||
@@ -45,16 +45,16 @@ class OUTLINER_HT_header(bpy.types.Header):
|
||||
|
||||
if space.display_mode == 'DATABLOCKS':
|
||||
row = layout.row(align=True)
|
||||
row.operator("outliner.keyingset_add_selected", icon='ICON_ZOOMIN', text="")
|
||||
row.operator("outliner.keyingset_remove_selected", icon='ICON_ZOOMOUT', text="")
|
||||
row.operator("outliner.keyingset_add_selected", icon='ZOOMIN', text="")
|
||||
row.operator("outliner.keyingset_remove_selected", icon='ZOOMOUT', text="")
|
||||
|
||||
if ks:
|
||||
row = layout.row(align=False)
|
||||
row.prop_object(scene, "active_keying_set", scene, "keying_sets", text="")
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.operator("anim.keyframe_insert", text="", icon='ICON_KEY_HLT')
|
||||
row.operator("anim.keyframe_delete", text="", icon='ICON_KEY_DEHLT')
|
||||
row.operator("anim.keyframe_insert", text="", icon='KEY_HLT')
|
||||
row.operator("anim.keyframe_delete", text="", icon='KEY_DEHLT')
|
||||
else:
|
||||
row = layout.row(align=False)
|
||||
row.label(text="No Keying Set active")
|
||||
|
||||
@@ -199,8 +199,8 @@ class SEQUENCER_MT_strip(bpy.types.Menu):
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
|
||||
layout.column()
|
||||
layout.operator("tfm.transform", text="Grab/Move").mode = 'TRANSLATION'
|
||||
layout.operator("tfm.transform", text="Grab/Extend from frame").mode = 'TIME_EXTEND'
|
||||
layout.operator("transform.transform", text="Grab/Move").mode = 'TRANSLATION'
|
||||
layout.operator("transform.transform", text="Grab/Extend from frame").mode = 'TIME_EXTEND'
|
||||
# uiItemO(layout, NULL, 0, "sequencer.strip_snap"); // TODO - add this operator
|
||||
layout.separator()
|
||||
|
||||
@@ -297,9 +297,9 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel):
|
||||
|
||||
row = layout.row()
|
||||
if strip.mute == True:
|
||||
row.prop(strip, "mute", toggle=True, icon='ICON_RESTRICT_VIEW_ON', text="")
|
||||
row.prop(strip, "mute", toggle=True, icon='RESTRICT_VIEW_ON', text="")
|
||||
elif strip.mute is False:
|
||||
row.prop(strip, "mute", toggle=True, icon='ICON_RESTRICT_VIEW_OFF', text="")
|
||||
row.prop(strip, "mute", toggle=True, icon='RESTRICT_VIEW_OFF', text="")
|
||||
|
||||
sub = row.row()
|
||||
sub.active = (not strip.mute)
|
||||
@@ -401,14 +401,23 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel):
|
||||
layout.separator()
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Scale X:")
|
||||
col.prop(strip, "scale_start_x", text="Start")
|
||||
col.prop(strip, "scale_end_x", text="End")
|
||||
col.prop(strip, "uniform_scale")
|
||||
|
||||
if (strip.uniform_scale):
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Scale:")
|
||||
col.prop(strip, "scale_start_x", text="Start")
|
||||
col.prop(strip, "scale_end_x", text="End")
|
||||
else:
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Scale X:")
|
||||
col.prop(strip, "scale_start_x", text="Start")
|
||||
col.prop(strip, "scale_end_x", text="End")
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Scale Y:")
|
||||
col.prop(strip, "scale_start_y", text="Start")
|
||||
col.prop(strip, "scale_end_y", text="End")
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Scale Y:")
|
||||
col.prop(strip, "scale_start_y", text="Start")
|
||||
col.prop(strip, "scale_end_y", text="End")
|
||||
|
||||
layout.separator()
|
||||
|
||||
@@ -420,10 +429,11 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel):
|
||||
col = layout.column(align=True)
|
||||
if strip.type == 'SPEED':
|
||||
col.prop(strip, "speed_fader", text="Speed fader")
|
||||
else:
|
||||
col.prop(strip, "use_effect_default_fade", "Default fade")
|
||||
if not strip.use_effect_default_fade:
|
||||
col.prop(strip, "effect_fader", text="Effect fader")
|
||||
elif strip.type in ('CROSS', 'GAMMA_CROSS', 'PLUGIN', 'WIPE',
|
||||
'TRANSFORM'):
|
||||
col.prop(strip, "use_effect_default_fade", "Default fade")
|
||||
if not strip.use_effect_default_fade:
|
||||
col.prop(strip, "effect_fader", text="Effect fader")
|
||||
|
||||
|
||||
class SEQUENCER_PT_input(SequencerButtonsPanel):
|
||||
@@ -507,9 +517,9 @@ class SEQUENCER_PT_sound(SequencerButtonsPanel):
|
||||
|
||||
row = layout.row()
|
||||
if strip.sound.packed_file:
|
||||
row.operator("sound.unpack", icon='ICON_PACKAGE', text="Unpack")
|
||||
row.operator("sound.unpack", icon='PACKAGE', text="Unpack")
|
||||
else:
|
||||
row.operator("sound.pack", icon='ICON_UGLYPACKAGE', text="Pack")
|
||||
row.operator("sound.pack", icon='UGLYPACKAGE', text="Pack")
|
||||
|
||||
row.prop(strip.sound, "caching")
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class TEXT_HT_header(bpy.types.Header):
|
||||
if text and text.modified:
|
||||
row = layout.row()
|
||||
# row.color(redalert)
|
||||
row.operator("text.resolve_conflict", text="", icon='ICON_HELP')
|
||||
row.operator("text.resolve_conflict", text="", icon='HELP')
|
||||
|
||||
layout.template_ID(st, "text", new="text.new", unlink="text.unlink")
|
||||
|
||||
@@ -104,14 +104,14 @@ class TEXT_PT_find(bpy.types.Panel):
|
||||
col = layout.column(align=True)
|
||||
row = col.row()
|
||||
row.prop(st, "find_text", text="")
|
||||
row.operator("text.find_set_selected", text="", icon='ICON_TEXT')
|
||||
row.operator("text.find_set_selected", text="", icon='TEXT')
|
||||
col.operator("text.find")
|
||||
|
||||
# replace
|
||||
col = layout.column(align=True)
|
||||
row = col.row()
|
||||
row.prop(st, "replace_text", text="")
|
||||
row.operator("text.replace_set_selected", text="", icon='ICON_TEXT')
|
||||
row.operator("text.replace_set_selected", text="", icon='TEXT')
|
||||
col.operator("text.replace")
|
||||
|
||||
# mark
|
||||
@@ -156,7 +156,7 @@ class TEXT_MT_text(bpy.types.Menu):
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("text.properties", icon='ICON_MENU_PANEL')
|
||||
layout.operator("text.properties", icon='MENU_PANEL')
|
||||
|
||||
layout.menu("TEXT_MT_templates")
|
||||
|
||||
|
||||
@@ -54,32 +54,32 @@ class TIME_HT_header(bpy.types.Header):
|
||||
layout.separator()
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.operator("screen.frame_jump", text="", icon='ICON_REW').end = False
|
||||
row.operator("screen.keyframe_jump", text="", icon='ICON_PREV_KEYFRAME').next = False
|
||||
row.operator("screen.frame_jump", text="", icon='REW').end = False
|
||||
row.operator("screen.keyframe_jump", text="", icon='PREV_KEYFRAME').next = False
|
||||
if not screen.animation_playing:
|
||||
row.operator("screen.animation_play", text="", icon='ICON_PLAY_REVERSE').reverse = True
|
||||
row.operator("screen.animation_play", text="", icon='ICON_PLAY')
|
||||
row.operator("screen.animation_play", text="", icon='PLAY_REVERSE').reverse = True
|
||||
row.operator("screen.animation_play", text="", icon='PLAY')
|
||||
else:
|
||||
sub = row.row()
|
||||
sub.scale_x = 2.0
|
||||
sub.operator("screen.animation_play", text="", icon='ICON_PAUSE')
|
||||
row.operator("screen.keyframe_jump", text="", icon='ICON_NEXT_KEYFRAME').next = True
|
||||
row.operator("screen.frame_jump", text="", icon='ICON_FF').end = True
|
||||
sub.operator("screen.animation_play", text="", icon='PAUSE')
|
||||
row.operator("screen.keyframe_jump", text="", icon='NEXT_KEYFRAME').next = True
|
||||
row.operator("screen.frame_jump", text="", icon='FF').end = True
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(tools, "enable_auto_key", text="", toggle=True, icon='ICON_REC')
|
||||
row.prop(tools, "enable_auto_key", text="", toggle=True, icon='REC')
|
||||
if screen.animation_playing and tools.enable_auto_key:
|
||||
subsub = row.row()
|
||||
subsub.prop(tools, "record_with_nla", toggle=True)
|
||||
|
||||
layout.prop(scene, "sync_audio", text="Realtime", toggle=True, icon='ICON_SPEAKER')
|
||||
layout.prop(scene, "sync_audio", text="Realtime", toggle=True, icon='SPEAKER')
|
||||
|
||||
layout.separator()
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop_object(scene, "active_keying_set", scene, "keying_sets", text="")
|
||||
row.operator("anim.keyframe_insert", text="", icon='ICON_KEY_HLT')
|
||||
row.operator("anim.keyframe_delete", text="", icon='ICON_KEY_DEHLT')
|
||||
row.operator("anim.keyframe_insert", text="", icon='KEY_HLT')
|
||||
row.operator("anim.keyframe_delete", text="", icon='KEY_DEHLT')
|
||||
|
||||
|
||||
class TIME_MT_view(bpy.types.Menu):
|
||||
@@ -95,6 +95,7 @@ class TIME_MT_view(bpy.types.Menu):
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.prop(st, "show_cframe_indicator")
|
||||
layout.prop(st, "only_selected")
|
||||
|
||||
|
||||
@@ -142,11 +143,7 @@ class TIME_MT_playback(bpy.types.Menu):
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.prop(st, "continue_physics")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.prop(scene, "sync_audio", text="Realtime Playback", icon='ICON_SPEAKER')
|
||||
layout.prop(scene, "sync_audio", text="Realtime Playback", icon='SPEAKER')
|
||||
layout.prop(scene, "mute_audio")
|
||||
layout.prop(scene, "scrub_audio")
|
||||
|
||||
|
||||
@@ -1083,6 +1083,7 @@ class USERPREF_PT_file(bpy.types.Panel):
|
||||
sub.label(text="Scripts:")
|
||||
sub.label(text="Sounds:")
|
||||
sub.label(text="Temp:")
|
||||
sub.label(text="Animation Player:")
|
||||
|
||||
sub = col1.column()
|
||||
sub.prop(paths, "fonts_directory", text="")
|
||||
@@ -1093,6 +1094,9 @@ class USERPREF_PT_file(bpy.types.Panel):
|
||||
sub.prop(paths, "python_scripts_directory", text="")
|
||||
sub.prop(paths, "sounds_directory", text="")
|
||||
sub.prop(paths, "temporary_directory", text="")
|
||||
subsplit = sub.split(percentage=0.3)
|
||||
subsplit.prop(paths, "animation_player_preset", text="")
|
||||
subsplit.prop(paths, "animation_player", text="")
|
||||
|
||||
col = split.column()
|
||||
col.label(text="Save & Load:")
|
||||
@@ -1186,6 +1190,12 @@ class USERPREF_PT_input(bpy.types.Panel):
|
||||
sub.prop(inputs, "ndof_pan_speed", text="Pan Speed")
|
||||
sub.prop(inputs, "ndof_rotate_speed", text="Orbit Speed")
|
||||
|
||||
col.separator()
|
||||
|
||||
sub = col.column()
|
||||
sub.label(text="Double Click:")
|
||||
sub.prop(inputs, "double_click_time", text="Speed")
|
||||
|
||||
row.separator()
|
||||
|
||||
# Keymap Settings
|
||||
@@ -1215,16 +1225,16 @@ class USERPREF_PT_input(bpy.types.Panel):
|
||||
row = subcol.row()
|
||||
|
||||
if kmi.expanded:
|
||||
row.prop(kmi, "expanded", text="", icon='ICON_TRIA_DOWN')
|
||||
row.prop(kmi, "expanded", text="", icon='TRIA_DOWN')
|
||||
else:
|
||||
row.prop(kmi, "expanded", text="", icon='ICON_TRIA_RIGHT')
|
||||
row.prop(kmi, "expanded", text="", icon='TRIA_RIGHT')
|
||||
|
||||
itemrow = row.row()
|
||||
itemrow.enabled = km.user_defined
|
||||
if kmi.active:
|
||||
itemrow.prop(kmi, "active", text="", icon='ICON_CHECKBOX_HLT')
|
||||
itemrow.prop(kmi, "active", text="", icon='CHECKBOX_HLT')
|
||||
else:
|
||||
itemrow.prop(kmi, "active", text="", icon='ICON_CHECKBOX_DEHLT')
|
||||
itemrow.prop(kmi, "active", text="", icon='CHECKBOX_DEHLT')
|
||||
|
||||
itemcol = itemrow.column()
|
||||
itemcol.active = kmi.active
|
||||
@@ -1286,11 +1296,11 @@ class USERPREF_PT_input(bpy.types.Panel):
|
||||
|
||||
itemcol.separator()
|
||||
|
||||
itemrow.operator("wm.keyitem_remove", text="", icon='ICON_ZOOMOUT')
|
||||
itemrow.operator("wm.keyitem_remove", text="", icon='ZOOMOUT')
|
||||
|
||||
itemrow = col.row()
|
||||
itemrow.label()
|
||||
itemrow.operator("wm.keyitem_add", text="", icon='ICON_ZOOMIN')
|
||||
itemrow.operator("wm.keyitem_add", text="", icon='ZOOMIN')
|
||||
itemrow.enabled = km.user_defined
|
||||
|
||||
bpy.types.register(USERPREF_HT_header)
|
||||
|
||||
@@ -87,16 +87,16 @@ class VIEW3D_HT_header(bpy.types.Header):
|
||||
|
||||
# OpenGL render
|
||||
row = layout.row(align=True)
|
||||
row.operator("screen.opengl_render", text="", icon='ICON_RENDER_STILL')
|
||||
props = row.operator("screen.opengl_render", text="", icon='ICON_RENDER_ANIMATION')
|
||||
row.operator("screen.opengl_render", text="", icon='RENDER_STILL')
|
||||
props = row.operator("screen.opengl_render", text="", icon='RENDER_ANIMATION')
|
||||
props.animation = True
|
||||
|
||||
# Pose
|
||||
if obj and obj.mode == 'POSE':
|
||||
row = layout.row(align=True)
|
||||
row.operator("pose.copy", text="", icon='ICON_COPYDOWN')
|
||||
row.operator("pose.paste", text="", icon='ICON_PASTEDOWN')
|
||||
props = row.operator("pose.paste", text="", icon='ICON_PASTEFLIPDOWN')
|
||||
row.operator("pose.copy", text="", icon='COPYDOWN')
|
||||
row.operator("pose.paste", text="", icon='PASTEDOWN')
|
||||
props = row.operator("pose.paste", text="", icon='PASTEFLIPDOWN')
|
||||
props.flipped = 1
|
||||
|
||||
|
||||
@@ -124,24 +124,24 @@ class VIEW3D_MT_transform(bpy.types.Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator("tfm.translate", text="Grab/Move")
|
||||
layout.operator("transform.translate", text="Grab/Move")
|
||||
# TODO: sub-menu for grab per axis
|
||||
layout.operator("tfm.rotate", text="Rotate")
|
||||
layout.operator("transform.rotate", text="Rotate")
|
||||
# TODO: sub-menu for rot per axis
|
||||
layout.operator("tfm.resize", text="Scale")
|
||||
layout.operator("transform.resize", text="Scale")
|
||||
# TODO: sub-menu for scale per axis
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("tfm.tosphere", text="To Sphere")
|
||||
layout.operator("tfm.shear", text="Shear")
|
||||
layout.operator("tfm.warp", text="Warp")
|
||||
layout.operator("tfm.transform", text="Push/Pull").mode = 'PUSHPULL'
|
||||
layout.operator("transform.tosphere", text="To Sphere")
|
||||
layout.operator("transform.shear", text="Shear")
|
||||
layout.operator("transform.warp", text="Warp")
|
||||
layout.operator("transform.transform", text="Push/Pull").mode = 'PUSHPULL'
|
||||
if context.edit_object and context.edit_object.type == 'ARMATURE':
|
||||
layout.operator("armature.align")
|
||||
else:
|
||||
layout.operator_context = 'EXEC_REGION_WIN'
|
||||
layout.operator("tfm.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()
|
||||
|
||||
@@ -158,32 +158,32 @@ class VIEW3D_MT_mirror(bpy.types.Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator("tfm.mirror", text="Interactive Mirror")
|
||||
layout.operator("transform.mirror", text="Interactive Mirror")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
|
||||
props = layout.operator("tfm.mirror", text="X Global")
|
||||
props = layout.operator("transform.mirror", text="X Global")
|
||||
props.constraint_axis = (True, False, False)
|
||||
props.constraint_orientation = 'GLOBAL'
|
||||
props = layout.operator("tfm.mirror", text="Y Global")
|
||||
props = layout.operator("transform.mirror", text="Y Global")
|
||||
props.constraint_axis = (False, True, False)
|
||||
props.constraint_orientation = 'GLOBAL'
|
||||
props = layout.operator("tfm.mirror", text="Z Global")
|
||||
props = layout.operator("transform.mirror", text="Z Global")
|
||||
props.constraint_axis = (False, False, True)
|
||||
props.constraint_orientation = 'GLOBAL'
|
||||
|
||||
if context.edit_object:
|
||||
layout.separator()
|
||||
|
||||
props = layout.operator("tfm.mirror", text="X Local")
|
||||
props = layout.operator("transform.mirror", text="X Local")
|
||||
props.constraint_axis = (True, False, False)
|
||||
props.constraint_orientation = 'LOCAL'
|
||||
props = layout.operator("tfm.mirror", text="Y Local")
|
||||
props = layout.operator("transform.mirror", text="Y Local")
|
||||
props.constraint_axis = (False, True, False)
|
||||
props.constraint_orientation = 'LOCAL'
|
||||
props = layout.operator("tfm.mirror", text="Z Local")
|
||||
props = layout.operator("transform.mirror", text="Z Local")
|
||||
props.constraint_axis = (False, False, True)
|
||||
props.constraint_orientation = 'LOCAL'
|
||||
|
||||
@@ -230,8 +230,8 @@ class VIEW3D_MT_view(bpy.types.Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator("view3d.properties", icon='ICON_MENU_PANEL')
|
||||
layout.operator("view3d.toolbar", icon='ICON_MENU_PANEL')
|
||||
layout.operator("view3d.properties", icon='MENU_PANEL')
|
||||
layout.operator("view3d.toolbar", icon='MENU_PANEL')
|
||||
|
||||
layout.separator()
|
||||
|
||||
@@ -918,7 +918,7 @@ class VIEW3D_MT_pose(bpy.types.Menu):
|
||||
layout.menu("VIEW3D_MT_transform")
|
||||
layout.menu("VIEW3D_MT_snap")
|
||||
if arm.drawtype in ('BBONE', 'ENVELOPE'):
|
||||
layout.operator("tfm.transform", text="Scale Envelope Distance").mode = 'BONESIZE'
|
||||
layout.operator("transform.transform", text="Scale Envelope Distance").mode = 'BONESIZE'
|
||||
|
||||
layout.menu("VIEW3D_MT_pose_transform")
|
||||
|
||||
@@ -1177,7 +1177,7 @@ class VIEW3D_MT_edit_mesh_edges(bpy.types.Menu):
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("TFM_OT_edge_slide", text="Edge Slide")
|
||||
layout.operator("TRANSFORM_OT_edge_slide", text="Edge Slide")
|
||||
layout.operator("mesh.loop_multi_select", text="Edge Loop")
|
||||
|
||||
# uiItemO(layout, "Loopcut", 0, "mesh.loop_cut"); // CutEdgeloop(em, 1);
|
||||
@@ -1298,7 +1298,7 @@ class VIEW3D_MT_edit_curve_ctrlpoints(bpy.types.Menu):
|
||||
edit_object = context.edit_object
|
||||
|
||||
if edit_object.type == 'CURVE':
|
||||
layout.operator("tfm.transform").mode = 'TILT'
|
||||
layout.operator("transform.transform").mode = 'TILT'
|
||||
layout.operator("curve.tilt_clear")
|
||||
layout.operator("curve.separate")
|
||||
|
||||
@@ -1458,9 +1458,9 @@ class VIEW3D_MT_edit_armature(bpy.types.Menu):
|
||||
layout.menu("VIEW3D_MT_edit_armature_roll")
|
||||
|
||||
if arm.drawtype == 'ENVELOPE':
|
||||
layout.operator("tfm.transform", text="Scale Envelope Distance").mode = 'BONESIZE'
|
||||
layout.operator("transform.transform", text="Scale Envelope Distance").mode = 'BONESIZE'
|
||||
else:
|
||||
layout.operator("tfm.transform", text="Scale B-Bone Width").mode = 'BONESIZE'
|
||||
layout.operator("transform.transform", text="Scale B-Bone Width").mode = 'BONESIZE'
|
||||
|
||||
layout.separator()
|
||||
|
||||
@@ -1544,7 +1544,7 @@ class VIEW3D_MT_edit_armature_roll(bpy.types.Menu):
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("tfm.transform", text="Set Roll").mode = 'BONE_ROLL'
|
||||
layout.operator("transform.transform", text="Set Roll").mode = 'BONE_ROLL'
|
||||
|
||||
# ********** Panel **********
|
||||
|
||||
@@ -1598,14 +1598,14 @@ class VIEW3D_PT_3dview_name(bpy.types.Panel):
|
||||
|
||||
ob = context.active_object
|
||||
row = layout.row()
|
||||
row.label(text="", icon='ICON_OBJECT_DATA')
|
||||
row.label(text="", icon='OBJECT_DATA')
|
||||
row.prop(ob, "name", text="")
|
||||
|
||||
if ob.type == 'ARMATURE' and ob.mode in ('EDIT', 'POSE'):
|
||||
bone = context.active_bone
|
||||
if bone:
|
||||
row = layout.row()
|
||||
row.label(text="", icon='ICON_BONE_DATA')
|
||||
row.label(text="", icon='BONE_DATA')
|
||||
row.prop(bone, "name", text="")
|
||||
|
||||
|
||||
@@ -1773,13 +1773,13 @@ class VIEW3D_PT_transform_orientations(bpy.types.Panel):
|
||||
col = layout.column()
|
||||
|
||||
col.prop(view, "transform_orientation")
|
||||
col.operator("tfm.create_orientation", text="Create")
|
||||
col.operator("transform.create_orientation", text="Create")
|
||||
|
||||
orientation = view.current_orientation
|
||||
|
||||
if orientation:
|
||||
col.prop(orientation, "name")
|
||||
col.operator("tfm.delete_orientation", text="Delete")
|
||||
col.operator("transform.delete_orientation", text="Delete")
|
||||
|
||||
|
||||
class VIEW3D_PT_etch_a_ton(bpy.types.Panel):
|
||||
|
||||
@@ -37,9 +37,9 @@ class VIEW3D_PT_tools_objectmode(View3DPanel):
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Transform:")
|
||||
col.operator("tfm.translate")
|
||||
col.operator("tfm.rotate")
|
||||
col.operator("tfm.resize", text="Scale")
|
||||
col.operator("transform.translate")
|
||||
col.operator("transform.rotate")
|
||||
col.operator("transform.resize", text="Scale")
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Object:")
|
||||
@@ -84,15 +84,15 @@ class VIEW3D_PT_tools_meshedit(View3DPanel):
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Transform:")
|
||||
col.operator("tfm.translate")
|
||||
col.operator("tfm.rotate")
|
||||
col.operator("tfm.resize", text="Scale")
|
||||
col.operator("tfm.shrink_fatten", text="Along Normal")
|
||||
col.operator("transform.translate")
|
||||
col.operator("transform.rotate")
|
||||
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("tfm.edge_slide")
|
||||
col.operator("transform.edge_slide")
|
||||
col.operator("mesh.rip_move")
|
||||
col.operator("mesh.vertices_smooth")
|
||||
|
||||
@@ -168,13 +168,13 @@ class VIEW3D_PT_tools_curveedit(View3DPanel):
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Transform:")
|
||||
col.operator("tfm.translate")
|
||||
col.operator("tfm.rotate")
|
||||
col.operator("tfm.resize", text="Scale")
|
||||
col.operator("transform.translate")
|
||||
col.operator("transform.rotate")
|
||||
col.operator("transform.resize", text="Scale")
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.operator("tfm.transform", text="Tilt").mode = 'TILT'
|
||||
col.operator("tfm.transform", text="Shrink/Fatten").mode = 'CURVE_SHRINKFATTEN'
|
||||
col.operator("transform.transform", text="Tilt").mode = 'TILT'
|
||||
col.operator("transform.transform", text="Shrink/Fatten").mode = 'CURVE_SHRINKFATTEN'
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Curve:")
|
||||
@@ -222,9 +222,9 @@ class VIEW3D_PT_tools_surfaceedit(View3DPanel):
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Transform:")
|
||||
col.operator("tfm.translate")
|
||||
col.operator("tfm.rotate")
|
||||
col.operator("tfm.resize", text="Scale")
|
||||
col.operator("transform.translate")
|
||||
col.operator("transform.rotate")
|
||||
col.operator("transform.resize", text="Scale")
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Curve:")
|
||||
@@ -295,9 +295,9 @@ class VIEW3D_PT_tools_armatureedit(View3DPanel):
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Transform:")
|
||||
col.operator("tfm.translate")
|
||||
col.operator("tfm.rotate")
|
||||
col.operator("tfm.resize", text="Scale")
|
||||
col.operator("transform.translate")
|
||||
col.operator("transform.rotate")
|
||||
col.operator("transform.resize", text="Scale")
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Bones:")
|
||||
@@ -347,9 +347,9 @@ class VIEW3D_PT_tools_mballedit(View3DPanel):
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Transform:")
|
||||
col.operator("tfm.translate")
|
||||
col.operator("tfm.rotate")
|
||||
col.operator("tfm.resize", text="Scale")
|
||||
col.operator("transform.translate")
|
||||
col.operator("transform.rotate")
|
||||
col.operator("transform.resize", text="Scale")
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Repeat:")
|
||||
@@ -375,9 +375,9 @@ class VIEW3D_PT_tools_latticeedit(View3DPanel):
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Transform:")
|
||||
col.operator("tfm.translate")
|
||||
col.operator("tfm.rotate")
|
||||
col.operator("tfm.resize", text="Scale")
|
||||
col.operator("transform.translate")
|
||||
col.operator("transform.rotate")
|
||||
col.operator("transform.resize", text="Scale")
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.operator("lattice.make_regular")
|
||||
@@ -407,9 +407,9 @@ class VIEW3D_PT_tools_posemode(View3DPanel):
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Transform:")
|
||||
col.operator("tfm.translate")
|
||||
col.operator("tfm.rotate")
|
||||
col.operator("tfm.resize", text="Scale")
|
||||
col.operator("transform.translate")
|
||||
col.operator("transform.rotate")
|
||||
col.operator("transform.resize", text="Scale")
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="In-Between:")
|
||||
|
||||
@@ -177,6 +177,7 @@ COMLIB += $(OCGDIR)/blender/makesdna/$(DEBUG_DIR)libdna.a
|
||||
COMLIB += $(NAN_GUARDEDALLOC)/lib/libguardedalloc.a
|
||||
COMLIB += $(NAN_MEMUTIL)/lib/libmemutil.a
|
||||
COMLIB += $(NAN_PNG)/lib/libpng.a
|
||||
COMLIB += $(OCGDIR)/blender/python/$(DEBUG_DIR)libpython.a # This was a PULIB up to circa r25248
|
||||
COMLIB += $(OCGDIR)/blender/gen_python/$(DEBUG_DIR)libgen_python.a
|
||||
|
||||
ifeq ($(WITH_QUICKTIME), true)
|
||||
@@ -276,13 +277,12 @@ PULIB += $(OCGDIR)/blender/ed_userpref/$(DEBUG_DIR)libed_userpref.a
|
||||
PULIB += $(OCGDIR)/blender/ed_gpencil/$(DEBUG_DIR)libed_gpencil.a
|
||||
PULIB += $(OCGDIR)/blender/ed_opsound/$(DEBUG_DIR)libed_opsound.a
|
||||
PULIB += $(OCGDIR)/blender/windowmanager/$(DEBUG_DIR)libwindowmanager.a
|
||||
PULIB += $(OCGDIR)/blender/python/$(DEBUG_DIR)libpython.a
|
||||
PULIB += $(OCGDIR)/blender/makesrna/$(DEBUG_DIR)librna.a
|
||||
# note, no idea but it suddenly doesn't compile :(
|
||||
PULIB += $(OCGDIR)/blender/blenlib/$(DEBUG_DIR)libblenlib.a
|
||||
PULIB += $(NAN_OPENNL)/lib/$(DEBUG_DIR)libopennl.a
|
||||
PULIB += $(NAN_ELBEEM)/lib/$(DEBUG_DIR)libelbeem.a
|
||||
PULIB += $(NAN_SMOKE)/lib/$(DEBUG_DIR)/libsmoke.a
|
||||
PULIB += $(NAN_SMOKE)/lib/$(DEBUG_DIR)libsmoke.a
|
||||
|
||||
ifeq ($(NAN_NO_KETSJI),true)
|
||||
PULIB += $(NAN_MOTO)/lib/$(DEBUG_DIR)libmoto.a
|
||||
|
||||
@@ -86,7 +86,6 @@ struct DerivedMesh {
|
||||
int needsFree; /* checked on ->release, is set to 0 for cached results */
|
||||
int deformedOnly; /* set by modifier stack if only deformed from original */
|
||||
BVHCache bvhCache;
|
||||
|
||||
struct GPUDrawObject *drawObject;
|
||||
|
||||
/* Misc. Queries */
|
||||
|
||||
@@ -47,7 +47,6 @@ struct Object;
|
||||
struct MTFace;
|
||||
struct VecNor;
|
||||
struct CustomData;
|
||||
struct Scene;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -74,6 +74,7 @@ void scene_select_base(struct Scene *sce, struct Base *selbase);
|
||||
/* checks for cycle, returns 1 if it's all OK */
|
||||
int scene_check_setscene(struct Scene *sce);
|
||||
|
||||
void scene_update_tagged(struct Scene *sce);
|
||||
void scene_update_for_newframe(struct Scene *sce, unsigned int lay);
|
||||
|
||||
void scene_add_render_layer(struct Scene *sce);
|
||||
|
||||
@@ -181,6 +181,7 @@ int seq_tx_test(struct Sequence * seq);
|
||||
int check_single_seq(struct Sequence *seq);
|
||||
void fix_single_seq(struct Sequence *seq);
|
||||
int seq_test_overlap(struct ListBase * seqbasep, struct Sequence *test);
|
||||
void seq_offset_animdata(struct Scene *scene, struct Sequence *seq, int ofs);
|
||||
int shuffle_seq(struct ListBase * seqbasep, struct Sequence *test);
|
||||
int shuffle_seq_time(ListBase * seqbasep);
|
||||
void free_imbuf_seq(struct Scene *scene, struct ListBase * seqbasep, int check_mem_usage);
|
||||
|
||||
@@ -154,6 +154,7 @@ void cloth_init ( ClothModifierData *clmd )
|
||||
clmd->sim_parms->defgoal = 0.0f;
|
||||
clmd->sim_parms->goalspring = 1.0f;
|
||||
clmd->sim_parms->goalfrict = 0.0f;
|
||||
clmd->sim_parms->velocity_smooth = 0.0f;
|
||||
|
||||
if(!clmd->sim_parms->effector_weights)
|
||||
clmd->sim_parms->effector_weights = BKE_add_effector_weights(NULL);
|
||||
|
||||
@@ -1075,11 +1075,12 @@ static int BKE_ptcache_id_filename(PTCacheID *pid, char *filename, int cfra, sho
|
||||
}
|
||||
if(strcmp(pid->cache->name, "")==0 && (pid->cache->flag & PTCACHE_EXTERNAL)==0) {
|
||||
idname = (pid->ob->id.name+2);
|
||||
|
||||
/* convert chars to hex so they are always a valid filename */
|
||||
BLI_strhex(newname, MAX_PTCACHE_FILE - len, idname);
|
||||
len += strlen(newname);
|
||||
newname = filename + len;
|
||||
while('\0' != *idname) {
|
||||
snprintf(newname, MAX_PTCACHE_FILE, "%02X", (char)(*idname++));
|
||||
newname+=2;
|
||||
len += 2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
int temp = (int)strlen(pid->cache->name);
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -77,6 +78,7 @@
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_paint.h"
|
||||
#include "BKE_pointcache.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_sequence.h"
|
||||
#include "BKE_world.h"
|
||||
@@ -772,7 +774,7 @@ float frame_to_float (Scene *scene, int cfra) /* see also bsystem_time in objec
|
||||
return ctime;
|
||||
}
|
||||
|
||||
static void scene_update(Scene *sce, unsigned int lay)
|
||||
static void scene_update_newframe(Scene *sce, unsigned int lay)
|
||||
{
|
||||
Base *base;
|
||||
Object *ob;
|
||||
@@ -804,6 +806,40 @@ static void scene_update(Scene *sce, unsigned int lay)
|
||||
}
|
||||
}
|
||||
|
||||
/* this is called in main loop, doing tagged updates before redraw */
|
||||
void scene_update_tagged(Scene *scene)
|
||||
{
|
||||
Scene *sce;
|
||||
Base *base;
|
||||
float ctime = frame_to_float(scene, scene->r.cfra);
|
||||
|
||||
/* update all objects: drivers, matrices, displists, etc. flags set
|
||||
by depgraph or manual, no layer check here, gets correct flushed */
|
||||
|
||||
/* sets first, we allow per definition current scene to have
|
||||
dependencies on sets, but not the other way around. */
|
||||
if(scene->set) {
|
||||
for(SETLOOPER(scene->set, base))
|
||||
object_handle_update(scene, base->object);
|
||||
}
|
||||
|
||||
for(base= scene->base.first; base; base= base->next) {
|
||||
object_handle_update(scene, base->object);
|
||||
}
|
||||
|
||||
/* recalc scene animation data here (for sequencer) */
|
||||
{
|
||||
AnimData *adt= BKE_animdata_from_id(&scene->id);
|
||||
|
||||
if(adt && (adt->recalc & ADT_RECALC_ANIM))
|
||||
BKE_animsys_evaluate_animdata(&scene->id, adt, ctime, 0);
|
||||
}
|
||||
|
||||
BKE_ptcache_quick_cache_all(scene);
|
||||
|
||||
/* in the future this should handle updates for all datablocks, not
|
||||
only objects and scenes. - brecht */
|
||||
}
|
||||
|
||||
/* applies changes right away, does all sets too */
|
||||
void scene_update_for_newframe(Scene *sce, unsigned int lay)
|
||||
@@ -815,9 +851,9 @@ void scene_update_for_newframe(Scene *sce, unsigned int lay)
|
||||
|
||||
/* sets first, we allow per definition current scene to have dependencies on sets */
|
||||
for(sce= sce->set; sce; sce= sce->set)
|
||||
scene_update(sce, lay);
|
||||
scene_update_newframe(sce, lay);
|
||||
|
||||
scene_update(scene, lay);
|
||||
scene_update_newframe(scene, lay);
|
||||
}
|
||||
|
||||
/* return default layer, also used to patch old files */
|
||||
@@ -827,7 +863,8 @@ void scene_add_render_layer(Scene *sce)
|
||||
int tot= 1 + BLI_countlist(&sce->r.layers);
|
||||
|
||||
srl= MEM_callocN(sizeof(SceneRenderLayer), "new render layer");
|
||||
sprintf(srl->name, "%d RenderLayer", tot);
|
||||
sprintf(srl->name, "RenderLayer");
|
||||
BLI_uniquename(&sce->r.layers, srl, "RenderLayer", '.', offsetof(SceneRenderLayer, name), 32);
|
||||
BLI_addtail(&sce->r.layers, srl);
|
||||
|
||||
/* note, this is also in render, pipeline.c, to make layer when scenedata doesnt have it */
|
||||
|
||||
@@ -2007,8 +2007,12 @@ static void do_transform(Sequence * seq,float facf0, int x, int y,
|
||||
yo = y;
|
||||
|
||||
//factor scale
|
||||
factxScale = scale->ScalexIni + (scale->ScalexFin - scale->ScalexIni) * facf0;
|
||||
factyScale = scale->ScaleyIni + (scale->ScaleyFin - scale->ScaleyIni) * facf0;
|
||||
if (scale->uniform_scale) {
|
||||
factxScale = factyScale = scale->ScalexIni + (scale->ScalexFin - scale->ScalexIni) * facf0;
|
||||
} else {
|
||||
factxScale = scale->ScalexIni + (scale->ScalexFin - scale->ScalexIni) * facf0;
|
||||
factyScale = scale->ScaleyIni + (scale->ScaleyFin - scale->ScaleyIni) * facf0;
|
||||
}
|
||||
|
||||
//Factor translate
|
||||
if(!scale->percent){
|
||||
@@ -3080,6 +3084,7 @@ static struct SeqEffectHandle get_sequence_effect_impl(int seq_type)
|
||||
rval.free = free_transform_effect;
|
||||
rval.copy = copy_transform_effect;
|
||||
rval.execute = do_transform_effect;
|
||||
rval.get_default_fac = get_default_fac_fade;
|
||||
break;
|
||||
case SEQ_SPEED:
|
||||
rval.init = init_speed_effect;
|
||||
|
||||
@@ -3529,6 +3529,32 @@ void seq_update_muting(Editing *ed)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* XXX - hackish function needed for transforming strips! TODO - have some better solution */
|
||||
void seq_offset_animdata(Scene *scene, Sequence *seq, int ofs)
|
||||
{
|
||||
char str[32];
|
||||
FCurve *fcu;
|
||||
|
||||
if(scene->adt==NULL || ofs==0)
|
||||
return;
|
||||
|
||||
sprintf(str, "[\"%s\"]", seq->name+2);
|
||||
|
||||
for (fcu= scene->adt->action->curves.first; fcu; fcu= fcu->next) {
|
||||
if(strstr(fcu->rna_path, "sequence_editor.sequences_all[") && strstr(fcu->rna_path, str)) {
|
||||
int i;
|
||||
for (i = 0; i < fcu->totvert; i++) {
|
||||
BezTriple *bezt= &fcu->bezt[i];
|
||||
bezt->vec[0][0] += ofs;
|
||||
bezt->vec[1][0] += ofs;
|
||||
bezt->vec[2][0] += ofs;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Sequence *active_seq_get(Scene *scene)
|
||||
{
|
||||
Editing *ed= seq_give_editing(scene, FALSE);
|
||||
|
||||
@@ -123,9 +123,6 @@ int BLI_natstrcmp(const char *s1, const char *s2);
|
||||
|
||||
void BLI_timestr(double _time, char *str); /* time var is global */
|
||||
|
||||
/* Convert to hex string valid for file writing (2x length of original) */
|
||||
void BLI_strhex(char *hex, int maxlen, const char *str);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1129,4 +1129,3 @@ void print_m4(char *str, float m[][4])
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -42,9 +42,6 @@
|
||||
|
||||
#include "BLI_dynstr.h"
|
||||
#include "BLI_string.h"
|
||||
#ifdef WIN32
|
||||
#include "BLI_winstuff.h"
|
||||
#endif
|
||||
|
||||
char *BLI_strdupn(const char *str, int len) {
|
||||
char *n= MEM_mallocN(len+1, "strdup");
|
||||
@@ -332,18 +329,3 @@ void BLI_timestr(double _time, char *str)
|
||||
|
||||
str[11]=0;
|
||||
}
|
||||
|
||||
void BLI_strhex(char *hex, int maxlen, const char *str)
|
||||
{
|
||||
int len = 0;
|
||||
|
||||
while('\0' != *str && len+3 < maxlen) {
|
||||
snprintf(hex, maxlen, "%02X", *str++);
|
||||
hex += 2;
|
||||
len += 2;
|
||||
}
|
||||
|
||||
if(maxlen)
|
||||
hex[0]= '\0';
|
||||
}
|
||||
|
||||
|
||||
@@ -6008,7 +6008,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
|
||||
ar= MEM_callocN(sizeof(ARegion), "toolbar for view3d");
|
||||
|
||||
BLI_addtail(lb, ar);
|
||||
ar->regiontype= RGN_TYPE_UI;
|
||||
ar->regiontype= RGN_TYPE_TOOLS;
|
||||
ar->alignment= RGN_ALIGN_LEFT;
|
||||
ar->flag = RGN_FLAG_HIDDEN;
|
||||
|
||||
@@ -6016,7 +6016,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
|
||||
ar= MEM_callocN(sizeof(ARegion), "tool properties for view3d");
|
||||
|
||||
BLI_addtail(lb, ar);
|
||||
ar->regiontype= RGN_TYPE_UI;
|
||||
ar->regiontype= RGN_TYPE_TOOL_PROPS;
|
||||
ar->alignment= RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV;
|
||||
ar->flag = RGN_FLAG_HIDDEN;
|
||||
|
||||
@@ -10152,6 +10152,19 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
|
||||
/* put 2.50 compatibility code here until next subversion bump */
|
||||
{
|
||||
Object *ob;
|
||||
|
||||
/* properly initialise hair clothsim data on old files */
|
||||
for(ob = main->object.first; ob; ob = ob->id.next) {
|
||||
ModifierData *md;
|
||||
for(md= ob->modifiers.first; md; md= md->next) {
|
||||
if (md->type == eModifierType_Cloth) {
|
||||
ClothModifierData *clmd = (ClothModifierData *)md;
|
||||
if (clmd->sim_parms->velocity_smooth < 0.01f)
|
||||
clmd->sim_parms->velocity_smooth = 0.f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
|
||||
|
||||
@@ -74,25 +74,6 @@ static int change_frame_poll(bContext *C)
|
||||
return ((curarea) && (curarea->spacetype != SPACE_IPO));
|
||||
}
|
||||
|
||||
/* Set any flags that are necessary to indicate modal time-changing operation */
|
||||
static int change_frame_init(bContext *C, wmOperator *op)
|
||||
{
|
||||
ScrArea *curarea= CTX_wm_area(C);
|
||||
|
||||
if (curarea == NULL)
|
||||
return 0;
|
||||
|
||||
if (curarea->spacetype == SPACE_TIME) {
|
||||
SpaceTime *stime= CTX_wm_space_time(C);
|
||||
|
||||
/* timeline displays frame number only when dragging indicator */
|
||||
// XXX make this more in line with other anim editors?
|
||||
stime->flag |= TIME_CFRA_NUM;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Set the new frame number */
|
||||
static void change_frame_apply(bContext *C, wmOperator *op)
|
||||
{
|
||||
@@ -106,33 +87,12 @@ static void change_frame_apply(bContext *C, wmOperator *op)
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
|
||||
}
|
||||
|
||||
/* Clear any temp flags */
|
||||
static void change_frame_exit(bContext *C, wmOperator *op)
|
||||
{
|
||||
ScrArea *curarea= CTX_wm_area(C);
|
||||
|
||||
if (curarea == NULL)
|
||||
return;
|
||||
|
||||
if (curarea->spacetype == SPACE_TIME) {
|
||||
SpaceTime *stime= CTX_wm_space_time(C);
|
||||
|
||||
/* timeline displays frame number only when dragging indicator */
|
||||
// XXX make this more in line with other anim editors?
|
||||
stime->flag &= ~TIME_CFRA_NUM;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---- */
|
||||
|
||||
/* Non-modal callback for running operator without user input */
|
||||
static int change_frame_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
if (!change_frame_init(C, op))
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
change_frame_apply(C, op);
|
||||
change_frame_exit(C, op);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -166,7 +126,6 @@ static int change_frame_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
*/
|
||||
RNA_int_set(op->ptr, "frame", frame_from_event(C, event));
|
||||
|
||||
change_frame_init(C, op);
|
||||
change_frame_apply(C, op);
|
||||
|
||||
/* add temp handler */
|
||||
@@ -175,20 +134,12 @@ static int change_frame_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
|
||||
/* In case modal operator is cancelled */
|
||||
static int change_frame_cancel(bContext *C, wmOperator *op)
|
||||
{
|
||||
change_frame_exit(C, op);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
/* Modal event handling of frame changing */
|
||||
static int change_frame_modal(bContext *C, wmOperator *op, wmEvent *event)
|
||||
{
|
||||
/* execute the events */
|
||||
switch (event->type) {
|
||||
case ESCKEY:
|
||||
change_frame_exit(C, op);
|
||||
return OPERATOR_FINISHED;
|
||||
|
||||
case MOUSEMOVE:
|
||||
@@ -201,10 +152,8 @@ static int change_frame_modal(bContext *C, wmOperator *op, wmEvent *event)
|
||||
/* we check for either mouse-button to end, as checking for ACTIONMOUSE (which is used to init
|
||||
* the modal op) doesn't work for some reason
|
||||
*/
|
||||
if (event->val==KM_RELEASE) {
|
||||
change_frame_exit(C, op);
|
||||
if (event->val==KM_RELEASE)
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -221,7 +170,6 @@ void ANIM_OT_change_frame(wmOperatorType *ot)
|
||||
/* api callbacks */
|
||||
ot->exec= change_frame_exec;
|
||||
ot->invoke= change_frame_invoke;
|
||||
ot->cancel= change_frame_cancel;
|
||||
ot->modal= change_frame_modal;
|
||||
ot->poll= change_frame_poll;
|
||||
|
||||
|
||||
@@ -276,7 +276,7 @@ static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, shor
|
||||
/* split into 2 columns
|
||||
* NOTE: the mode comboboxes shouldn't get labels, otherwise there isn't enough room
|
||||
*/
|
||||
split= uiLayoutSplit(layout, 0.5f);
|
||||
split= uiLayoutSplit(layout, 0.5f, 0);
|
||||
|
||||
/* before range */
|
||||
col= uiLayoutColumn(split, 1);
|
||||
@@ -306,7 +306,7 @@ static void draw_modifier__noise(uiLayout *layout, ID *id, FModifier *fcm, short
|
||||
uiItemR(layout, NULL, 0, &ptr, "modification", 0);
|
||||
|
||||
/* split into 2 columns */
|
||||
split= uiLayoutSplit(layout, 0.5f);
|
||||
split= uiLayoutSplit(layout, 0.5f, 0);
|
||||
|
||||
/* col 1 */
|
||||
col= uiLayoutColumn(split, 0);
|
||||
@@ -560,7 +560,7 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh
|
||||
block= uiLayoutGetBlock(row);
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
but=uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "Fra:", 0, 0, 90, 20, &fed->time, -UI_FLT_MAX, UI_FLT_MAX, 10, 1, "Frame that envelope point occurs");
|
||||
but=uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "Fra:", 0, 0, 90, 20, &fed->time, -MAXFRAMEF, MAXFRAMEF, 10, 1, "Frame that envelope point occurs");
|
||||
uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL);
|
||||
|
||||
uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "Min:", 0, 0, 100, 20, &fed->min, -UI_FLT_MAX, UI_FLT_MAX, 10, 2, "Minimum bound of envelope at this point");
|
||||
@@ -588,7 +588,7 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor
|
||||
row= uiLayoutRow(layout, 0);
|
||||
|
||||
/* split into 2 columns */
|
||||
split= uiLayoutSplit(layout, 0.5f);
|
||||
split= uiLayoutSplit(layout, 0.5f, 0);
|
||||
|
||||
/* x-minimum */
|
||||
col= uiLayoutColumn(split, 1);
|
||||
@@ -606,7 +606,7 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor
|
||||
row= uiLayoutRow(layout, 0);
|
||||
|
||||
/* split into 2 columns */
|
||||
split= uiLayoutSplit(layout, 0.5f);
|
||||
split= uiLayoutSplit(layout, 0.5f, 0);
|
||||
|
||||
/* x-minimum */
|
||||
col= uiLayoutColumn(split, 1);
|
||||
|
||||
@@ -170,6 +170,9 @@ static void add_bezt_to_keycolumns_list(DLRBT_Tree *keys, BezTriple *bezt)
|
||||
|
||||
/* ActBeztColumns (Helpers for Long Keyframes) ------------------------------ */
|
||||
|
||||
/* maximum size of default buffer for BezTriple columns */
|
||||
#define MAX_ABK_BUFSIZE 4
|
||||
|
||||
/* BezTriple Container Node */
|
||||
// NOTE: only used internally while building Long Keyframes for now, but may be useful externally?
|
||||
typedef struct ActBeztColumn {
|
||||
@@ -187,7 +190,7 @@ typedef struct ActBeztColumn {
|
||||
short numBezts; /* number of BezTriples on this frame */
|
||||
float cfra; /* frame that the BezTriples occur on */
|
||||
|
||||
BezTriple *bezts[4]; /* buffer of pointers to BezTriples on the same frame */
|
||||
BezTriple *bezts[MAX_ABK_BUFSIZE]; /* buffer of pointers to BezTriples on the same frame */
|
||||
//BezTriple **bezts_extra; /* secondary buffer of pointers if need be */
|
||||
} ActBeztColumn;
|
||||
|
||||
@@ -227,9 +230,8 @@ static void nupdate_abk_bezt (void *node, void *data)
|
||||
BezTriple *bezt= (BezTriple *)data;
|
||||
|
||||
/* just add the BezTriple to the buffer if there's space, or allocate a new one */
|
||||
if (abk->numBezts >= sizeof(abk->bezts)/sizeof(BezTriple)) {
|
||||
if (abk->numBezts >= MAX_ABK_BUFSIZE) {
|
||||
// TODO: need to allocate new array to cater...
|
||||
// FIXME: urgent... is a problem when working with duplicate keyframes
|
||||
//bezts_extra= MEM_callocN(...);
|
||||
if(G.f & G_DEBUG)
|
||||
printf("FIXME: nupdate_abk_bezt() missing case for too many overlapping BezTriples \n");
|
||||
|
||||
@@ -274,6 +274,7 @@ int insert_vert_fcurve (FCurve *fcu, float x, float y, short flag)
|
||||
beztr.ipo= U.ipo_new; /* use default interpolation mode here... */
|
||||
beztr.f1= beztr.f2= beztr.f3= SELECT;
|
||||
beztr.h1= beztr.h2= HD_AUTO; // XXX what about when we replace an old one?
|
||||
//BEZKEYTYPE(&beztr)= scene->keytype; /* default keyframe type */
|
||||
|
||||
/* add temp beztriple to keyframes */
|
||||
a= insert_bezt_fcurve(fcu, &beztr, flag);
|
||||
@@ -809,7 +810,7 @@ short insert_keyframe (ID *id, bAction *act, const char group[], const char rna_
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* get F-Curve - if no action is provided, keyframe to the default one attached to this ID-block */
|
||||
/* if no action is provided, keyframe to the default one attached to this ID-block */
|
||||
if (act == NULL) {
|
||||
AnimData *adt= BKE_animdata_from_id(id);
|
||||
|
||||
@@ -842,8 +843,19 @@ short insert_keyframe (ID *id, bAction *act, const char group[], const char rna_
|
||||
|
||||
/* will only loop once unless the array index was -1 */
|
||||
for (; array_index < array_index_max; array_index++) {
|
||||
/* make sure the F-Curve exists */
|
||||
fcu= verify_fcurve(act, group, rna_path, array_index, 1);
|
||||
|
||||
/* set color mode if the F-Curve is new (i.e. without any keyframes) */
|
||||
if ((fcu->totvert == 0) && (flag & INSERTKEY_XYZ2RGB)) {
|
||||
/* for Loc/Rot/Scale and also Color F-Curves, the color of the F-Curve in the Graph Editor,
|
||||
* is determined by the array index for the F-Curve
|
||||
*/
|
||||
if (ELEM4(RNA_property_subtype(prop), PROP_TRANSLATION, PROP_XYZ, PROP_EULER, PROP_COLOR)) {
|
||||
fcu->color_mode= FCURVE_COLOR_AUTO_RGB;
|
||||
}
|
||||
}
|
||||
|
||||
/* insert keyframe */
|
||||
ret += insert_keyframe_direct(ptr, prop, fcu, cfra, flag);
|
||||
}
|
||||
|
||||
@@ -164,13 +164,13 @@ void ED_operatormacros_armature(void)
|
||||
|
||||
ot= WM_operatortype_append_macro("ARMATURE_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
|
||||
WM_operatortype_macro_define(ot, "ARMATURE_OT_duplicate");
|
||||
otmacro= WM_operatortype_macro_define(ot, "TFM_OT_translate");
|
||||
otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
|
||||
RNA_enum_set(otmacro->ptr, "proportional", 0);
|
||||
|
||||
ot= WM_operatortype_append_macro("ARMATURE_OT_extrude_move", "Extrude", OPTYPE_UNDO|OPTYPE_REGISTER);
|
||||
otmacro=WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude");
|
||||
RNA_enum_set(otmacro->ptr, "forked", 0);
|
||||
otmacro= WM_operatortype_macro_define(ot, "TFM_OT_translate");
|
||||
otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
|
||||
RNA_enum_set(otmacro->ptr, "proportional", 0);
|
||||
|
||||
// XXX would it be nicer to just be able to have standard extrude_move, but set the forked property separate?
|
||||
@@ -178,7 +178,7 @@ void ED_operatormacros_armature(void)
|
||||
ot= WM_operatortype_append_macro("ARMATURE_OT_extrude_forked", "Extrude Forked", OPTYPE_UNDO|OPTYPE_REGISTER);
|
||||
otmacro=WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude");
|
||||
RNA_enum_set(otmacro->ptr, "forked", 1);
|
||||
otmacro= WM_operatortype_macro_define(ot, "TFM_OT_translate");
|
||||
otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
|
||||
RNA_enum_set(otmacro->ptr, "proportional", 0);
|
||||
}
|
||||
|
||||
@@ -261,10 +261,10 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
|
||||
|
||||
/* special transforms: */
|
||||
/* 1) envelope/b-bone size */
|
||||
kmi= WM_keymap_add_item(keymap, "TFM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0);
|
||||
kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0);
|
||||
RNA_enum_set(kmi->ptr, "mode", TFM_BONESIZE);
|
||||
/* 2) set roll */
|
||||
kmi= WM_keymap_add_item(keymap, "TFM_OT_transform", RKEY, KM_PRESS, KM_CTRL, 0);
|
||||
kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", RKEY, KM_PRESS, KM_CTRL, 0);
|
||||
RNA_enum_set(kmi->ptr, "mode", TFM_BONE_ROLL);
|
||||
|
||||
/* menus */
|
||||
@@ -335,7 +335,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
|
||||
|
||||
/* special transforms: */
|
||||
/* 1) envelope/b-bone size */
|
||||
kmi= WM_keymap_add_item(keymap, "TFM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0);
|
||||
kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0);
|
||||
RNA_enum_set(kmi->ptr, "mode", TFM_BONESIZE);
|
||||
|
||||
// XXX this should probably be in screen instead... here for testing purposes in the meantime... - Aligorith
|
||||
|
||||
@@ -238,8 +238,8 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
|
||||
WM_keymap_add_item(keymap, "CURVE_OT_delete", DELKEY, KM_PRESS, 0, 0);
|
||||
|
||||
WM_keymap_add_item(keymap, "CURVE_OT_tilt_clear", TKEY, KM_PRESS, KM_ALT, 0);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "TFM_OT_transform", TKEY, KM_PRESS, KM_CTRL, 0)->ptr, "mode", TFM_TILT);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "TFM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0)->ptr, "mode", TFM_CURVE_SHRINKFATTEN);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", TKEY, KM_PRESS, KM_CTRL, 0)->ptr, "mode", TFM_TILT);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0)->ptr, "mode", TFM_CURVE_SHRINKFATTEN);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", 1);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", HKEY, KM_PRESS, 0, 0)->ptr, "type", 3);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", VKEY, KM_PRESS, 0, 0)->ptr, "type", 2);
|
||||
|
||||
@@ -3539,7 +3539,7 @@ static int extrude_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
{
|
||||
if(extrude_exec(C, op) == OPERATOR_FINISHED) {
|
||||
RNA_int_set(op->ptr, "mode", TFM_TRANSLATION);
|
||||
WM_operator_name_call(C, "TFM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr);
|
||||
WM_operator_name_call(C, "TRANSFORM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -4294,7 +4294,7 @@ static int duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
duplicate_exec(C, op);
|
||||
|
||||
RNA_int_set(op->ptr, "mode", TFM_TRANSLATION);
|
||||
WM_operator_name_call(C, "TFM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr);
|
||||
WM_operator_name_call(C, "TRANSFORM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -5285,42 +5285,3 @@ void undo_push_curve(bContext *C, char *name)
|
||||
{
|
||||
undo_editmode_push(C, name, get_data, free_undoCurve, undoCurve_to_editCurve, editCurve_to_undoCurve, NULL);
|
||||
}
|
||||
|
||||
/***************** XXX old cruft ********************/
|
||||
|
||||
void default_curve_ipo(Scene *scene, Curve *cu)
|
||||
{
|
||||
#if 0 // XXX old animation system
|
||||
IpoCurve *icu;
|
||||
BezTriple *bezt;
|
||||
|
||||
if(cu->ipo) return;
|
||||
|
||||
cu->ipo= add_ipo(scene, "CurveIpo", ID_CU);
|
||||
|
||||
icu= MEM_callocN(sizeof(IpoCurve), "ipocurve");
|
||||
|
||||
icu->blocktype= ID_CU;
|
||||
icu->adrcode= CU_SPEED;
|
||||
icu->flag= IPO_VISIBLE|IPO_SELECT|IPO_AUTO_HORIZ;
|
||||
set_icu_vars(icu);
|
||||
|
||||
BLI_addtail( &(cu->ipo->curve), icu);
|
||||
|
||||
icu->bezt= bezt= MEM_callocN(2*sizeof(BezTriple), "defaultipo");
|
||||
icu->totvert= 2;
|
||||
|
||||
bezt->hide= IPO_BEZ;
|
||||
bezt->f1=bezt->f2= bezt->f3= SELECT;
|
||||
bezt->h1= bezt->h2= HD_AUTO;
|
||||
bezt++;
|
||||
bezt->vec[1][0]= 100.0;
|
||||
bezt->vec[1][1]= 1.0;
|
||||
bezt->hide= IPO_BEZ;
|
||||
bezt->f1=bezt->f2= bezt->f3= SELECT;
|
||||
bezt->h1= bezt->h2= HD_AUTO;
|
||||
|
||||
calchandles_ipocurve(icu);
|
||||
#endif // XXX old animation system
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -187,7 +187,7 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl)
|
||||
|
||||
/* new backdrop ----------------------------------- */
|
||||
box= uiLayoutBox(layout);
|
||||
split= uiLayoutSplit(box, 0.5f);
|
||||
split= uiLayoutSplit(box, 0.5f, 0);
|
||||
|
||||
|
||||
/* draw settings ---------------------------------- */
|
||||
|
||||
@@ -493,7 +493,6 @@ static void gp_layer_to_curve (bContext *C, bGPdata *gpd, bGPDlayer *gpl, short
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
bGPDframe *gpf= gpencil_layer_getframe(gpl, CFRA, 0);
|
||||
bGPDstroke *gps;
|
||||
Base *base= BASACT;
|
||||
Object *ob;
|
||||
Curve *cu;
|
||||
|
||||
@@ -529,9 +528,6 @@ static void gp_layer_to_curve (bContext *C, bGPdata *gpd, bGPDlayer *gpl, short
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* restore old active object */
|
||||
// BASACT= base; // removing since this is expected new objects are active.
|
||||
}
|
||||
|
||||
/* --- */
|
||||
|
||||
@@ -149,7 +149,7 @@ short ANIM_driver_can_paste(void);
|
||||
/* Main Driver Management API calls:
|
||||
* Add a new driver for the specified property on the given ID block
|
||||
*/
|
||||
short ANIM_add_driver (struct ID *id, const char rna_path[], int array_index, short flag, int type);
|
||||
short ANIM_add_driver(struct ID *id, const char rna_path[], int array_index, short flag, int type);
|
||||
|
||||
/* Main Driver Management API calls:
|
||||
* Remove the driver for the specified property on the given ID block (if available)
|
||||
|
||||
@@ -871,14 +871,14 @@ DEF_ICON(ICON_BLANK346b)
|
||||
|
||||
/* vector icons */
|
||||
|
||||
DEF_ICON(VICON_VIEW3D)
|
||||
DEF_ICON(VICON_EDIT)
|
||||
DEF_ICON(VICON_EDITMODE_DEHLT)
|
||||
DEF_ICON(VICON_EDITMODE_HLT)
|
||||
DEF_ICON(VICON_DISCLOSURE_TRI_RIGHT)
|
||||
DEF_ICON(VICON_DISCLOSURE_TRI_DOWN)
|
||||
DEF_ICON(VICON_MOVE_UP)
|
||||
DEF_ICON(VICON_MOVE_DOWN)
|
||||
DEF_ICON(VICON_X)
|
||||
DEF_ICON(VICON_SMALL_TRI_RIGHT)
|
||||
DEF_ICON(VICO_VIEW3D_VEC)
|
||||
DEF_ICON(VICO_EDIT_VEC)
|
||||
DEF_ICON(VICO_EDITMODE_DEHLT)
|
||||
DEF_ICON(VICO_EDITMODE_HLT)
|
||||
DEF_ICON(VICO_DISCLOSURE_TRI_RIGHT_VEC)
|
||||
DEF_ICON(VICO_DISCLOSURE_TRI_DOWN_VEC)
|
||||
DEF_ICON(VICO_MOVE_UP_VEC)
|
||||
DEF_ICON(VICO_MOVE_DOWN_VEC)
|
||||
DEF_ICON(VICO_X_VEC)
|
||||
DEF_ICON(VICO_SMALL_TRI_RIGHT_VEC)
|
||||
|
||||
|
||||
@@ -629,7 +629,7 @@ uiLayout *uiLayoutBox(uiLayout *layout);
|
||||
uiLayout *uiLayoutListBox(uiLayout *layout, struct PointerRNA *ptr, struct PropertyRNA *prop,
|
||||
struct PointerRNA *actptr, struct PropertyRNA *actprop);
|
||||
uiLayout *uiLayoutAbsolute(uiLayout *layout, int align);
|
||||
uiLayout *uiLayoutSplit(uiLayout *layout, float percentage);
|
||||
uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, int align);
|
||||
uiLayout *uiLayoutOverlap(uiLayout *layout);
|
||||
|
||||
uiBlock *uiLayoutAbsoluteBlock(uiLayout *layout);
|
||||
|
||||
@@ -1079,9 +1079,9 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho
|
||||
|
||||
uiStyleFontSet(&style->widget);
|
||||
|
||||
origstr= MEM_callocN(sizeof(char)*(data->maxlen+1), "ui_textedit origstr");
|
||||
origstr= MEM_callocN(sizeof(char)*data->maxlen, "ui_textedit origstr");
|
||||
|
||||
BLI_strncpy(origstr, but->drawstr, data->maxlen+1);
|
||||
BLI_strncpy(origstr, but->drawstr, data->maxlen);
|
||||
but->pos= strlen(origstr)-but->ofs;
|
||||
|
||||
/* XXX solve generic */
|
||||
@@ -1130,7 +1130,7 @@ static int ui_textedit_type_ascii(uiBut *but, uiHandleButtonData *data, char asc
|
||||
changed= ui_textedit_delete_selection(but, data);
|
||||
|
||||
len= strlen(str);
|
||||
if(len < data->maxlen) {
|
||||
if(len+1 < data->maxlen) {
|
||||
for(x= data->maxlen; x>but->pos; x--)
|
||||
str[x]= str[x-1];
|
||||
str[but->pos]= ascii;
|
||||
@@ -1365,7 +1365,7 @@ static int ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, int paste
|
||||
for (y=0; y<strlen(buf); y++)
|
||||
{
|
||||
/* add contents of buffer */
|
||||
if(len < data->maxlen) {
|
||||
if(len+1 < data->maxlen) {
|
||||
for(x= data->maxlen; x>but->pos; x--)
|
||||
str[x]= str[x-1];
|
||||
str[but->pos]= buf[y];
|
||||
@@ -1411,8 +1411,8 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
|
||||
|
||||
/* retrieve string */
|
||||
data->maxlen= ui_get_but_string_max_length(but);
|
||||
data->str= MEM_callocN(sizeof(char)*(data->maxlen+1), "textedit str");
|
||||
ui_get_but_string(but, data->str, data->maxlen+1);
|
||||
data->str= MEM_callocN(sizeof(char)*data->maxlen + 1, "textedit str");
|
||||
ui_get_but_string(but, data->str, data->maxlen);
|
||||
|
||||
data->origstr= BLI_strdup(data->str);
|
||||
data->selextend= 0;
|
||||
|
||||
@@ -528,16 +528,16 @@ static void init_internal_icons()
|
||||
}
|
||||
}
|
||||
|
||||
def_internal_vicon(VICON_VIEW3D, vicon_view3d_draw);
|
||||
def_internal_vicon(VICON_EDIT, vicon_edit_draw);
|
||||
def_internal_vicon(VICON_EDITMODE_DEHLT, vicon_editmode_dehlt_draw);
|
||||
def_internal_vicon(VICON_EDITMODE_HLT, vicon_editmode_hlt_draw);
|
||||
def_internal_vicon(VICON_DISCLOSURE_TRI_RIGHT, vicon_disclosure_tri_right_draw);
|
||||
def_internal_vicon(VICON_DISCLOSURE_TRI_DOWN, vicon_disclosure_tri_down_draw);
|
||||
def_internal_vicon(VICON_MOVE_UP, vicon_move_up_draw);
|
||||
def_internal_vicon(VICON_MOVE_DOWN, vicon_move_down_draw);
|
||||
def_internal_vicon(VICON_X, vicon_x_draw);
|
||||
def_internal_vicon(VICON_SMALL_TRI_RIGHT, vicon_small_tri_right_draw);
|
||||
def_internal_vicon(VICO_VIEW3D_VEC, vicon_view3d_draw);
|
||||
def_internal_vicon(VICO_EDIT_VEC, vicon_edit_draw);
|
||||
def_internal_vicon(VICO_EDITMODE_DEHLT, vicon_editmode_dehlt_draw);
|
||||
def_internal_vicon(VICO_EDITMODE_HLT, vicon_editmode_hlt_draw);
|
||||
def_internal_vicon(VICO_DISCLOSURE_TRI_RIGHT_VEC, vicon_disclosure_tri_right_draw);
|
||||
def_internal_vicon(VICO_DISCLOSURE_TRI_DOWN_VEC, vicon_disclosure_tri_down_draw);
|
||||
def_internal_vicon(VICO_MOVE_UP_VEC, vicon_move_up_draw);
|
||||
def_internal_vicon(VICO_MOVE_DOWN_VEC, vicon_move_down_draw);
|
||||
def_internal_vicon(VICO_X_VEC, vicon_x_draw);
|
||||
def_internal_vicon(VICO_SMALL_TRI_RIGHT_VEC, vicon_small_tri_right_draw);
|
||||
|
||||
IMB_freeImBuf(bbuf);
|
||||
}
|
||||
|
||||
@@ -714,7 +714,7 @@ void uiItemsEnumO(uiLayout *layout, char *opname, char *propname)
|
||||
if(prop && RNA_property_type(prop) == PROP_ENUM) {
|
||||
EnumPropertyItem *item;
|
||||
int totitem, i, free;
|
||||
uiLayout *split= uiLayoutSplit(layout, 0);
|
||||
uiLayout *split= uiLayoutSplit(layout, 0, 0);
|
||||
uiLayout *column= uiLayoutColumn(split, 0);
|
||||
|
||||
RNA_property_enum_items(block->evil_C, &ptr, prop, &item, &totitem, &free);
|
||||
@@ -1024,7 +1024,7 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, char *propname)
|
||||
if(RNA_property_type(prop) == PROP_ENUM) {
|
||||
EnumPropertyItem *item;
|
||||
int totitem, i, free;
|
||||
uiLayout *split= uiLayoutSplit(layout, 0);
|
||||
uiLayout *split= uiLayoutSplit(layout, 0, 0);
|
||||
uiLayout *column= uiLayoutColumn(split, 0);
|
||||
|
||||
RNA_property_enum_items(block->evil_C, ptr, prop, &item, &totitem, &free);
|
||||
@@ -1057,38 +1057,72 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, char *propname)
|
||||
|
||||
/* Pointer RNA button with search */
|
||||
|
||||
typedef struct CollItemSearch {
|
||||
struct CollItemSearch *next, *prev;
|
||||
char *name;
|
||||
int index;
|
||||
int iconid;
|
||||
} CollItemSearch;
|
||||
|
||||
int sort_search_items_list(void *a, void *b)
|
||||
{
|
||||
CollItemSearch *cis1 = (CollItemSearch *)a;
|
||||
CollItemSearch *cis2 = (CollItemSearch *)b;
|
||||
|
||||
if (BLI_strcasecmp(cis1->name, cis2->name)>0)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rna_search_cb(const struct bContext *C, void *arg_but, char *str, uiSearchItems *items)
|
||||
{
|
||||
uiBut *but= arg_but;
|
||||
char *name;
|
||||
int i, iconid, flag= RNA_property_flag(but->rnaprop);
|
||||
int i=0, iconid=0, flag= RNA_property_flag(but->rnaprop);
|
||||
ListBase *items_list= MEM_callocN(sizeof(ListBase), "items_list");
|
||||
CollItemSearch *cis;
|
||||
|
||||
i = 0;
|
||||
/* build a temporary list of relevant items first */
|
||||
RNA_PROP_BEGIN(&but->rnasearchpoin, itemptr, but->rnasearchprop) {
|
||||
if(flag & PROP_ID_SELF_CHECK)
|
||||
if(itemptr.data == but->rnapoin.id.data)
|
||||
continue;
|
||||
|
||||
iconid= 0;
|
||||
|
||||
if(RNA_struct_is_ID(itemptr.type))
|
||||
iconid= ui_id_icon_get((bContext*)C, itemptr.data);
|
||||
|
||||
|
||||
name= RNA_struct_name_get_alloc(&itemptr, NULL, 0);
|
||||
|
||||
|
||||
if(name) {
|
||||
if(BLI_strcasestr(name, str)) {
|
||||
if(!uiSearchItemAdd(items, name, SET_INT_IN_POINTER(i), iconid)) {
|
||||
MEM_freeN(name);
|
||||
break;
|
||||
}
|
||||
cis = MEM_callocN(sizeof(CollItemSearch), "CollectionItemSearch");
|
||||
cis->name = MEM_dupallocN(name);
|
||||
cis->index = i;
|
||||
cis->iconid = iconid;
|
||||
BLI_addtail(items_list, cis);
|
||||
}
|
||||
|
||||
MEM_freeN(name);
|
||||
}
|
||||
|
||||
MEM_freeN(name);
|
||||
|
||||
i++;
|
||||
}
|
||||
RNA_PROP_END;
|
||||
|
||||
BLI_sortlist(items_list, sort_search_items_list);
|
||||
|
||||
/* add search items from temporary list */
|
||||
for (cis=items_list->first; cis; cis=cis->next) {
|
||||
if (!uiSearchItemAdd(items, cis->name, SET_INT_IN_POINTER(cis->index), cis->iconid)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (cis=items_list->first; cis; cis=cis->next) {
|
||||
MEM_freeN(cis->name);
|
||||
}
|
||||
BLI_freelistN(items_list);
|
||||
MEM_freeN(items_list);
|
||||
}
|
||||
|
||||
static void search_id_collection(StructRNA *ptype, PointerRNA *ptr, PropertyRNA **prop)
|
||||
@@ -2054,13 +2088,14 @@ uiLayout *uiLayoutOverlap(uiLayout *layout)
|
||||
return litem;
|
||||
}
|
||||
|
||||
uiLayout *uiLayoutSplit(uiLayout *layout, float percentage)
|
||||
uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, int align)
|
||||
{
|
||||
uiLayoutItemSplt *split;
|
||||
|
||||
split= MEM_callocN(sizeof(uiLayoutItemSplt), "uiLayoutItemSplt");
|
||||
split->litem.item.type= ITEM_LAYOUT_SPLIT;
|
||||
split->litem.root= layout->root;
|
||||
split->litem.align= align;
|
||||
split->litem.active= 1;
|
||||
split->litem.enabled= 1;
|
||||
split->litem.context= layout->context;
|
||||
|
||||
@@ -1377,7 +1377,7 @@ static void ui_block_func_MENUSTR(bContext *C, uiLayout *layout, void *arg_str)
|
||||
}
|
||||
|
||||
/* create items */
|
||||
split= uiLayoutSplit(layout, 0);
|
||||
split= uiLayoutSplit(layout, 0, 0);
|
||||
|
||||
for(a=0, b=0; a<md->nitems; a++, b++) {
|
||||
if(block->flag & UI_BLOCK_NO_FLIP)
|
||||
@@ -2288,6 +2288,7 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut
|
||||
/* menu is created from a string */
|
||||
pup->menu_func= ui_block_func_MENUSTR;
|
||||
pup->menu_arg= str;
|
||||
// XXX pup->block->flag |= UI_BLOCK_NO_FLIP;
|
||||
}
|
||||
else {
|
||||
/* menu is created from a callback */
|
||||
|
||||
@@ -1490,7 +1490,7 @@ static void colorband_del_cb(bContext *C, void *cb_v, void *coba_v)
|
||||
|
||||
|
||||
/* offset aligns from bottom, standard width 300, height 115 */
|
||||
static void colorband_buttons_large(uiBlock *block, ColorBand *coba, int xoffs, int yoffs, RNAUpdateCb *cb)
|
||||
static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand *coba, int xoffs, int yoffs, RNAUpdateCb *cb)
|
||||
{
|
||||
|
||||
uiBut *bt;
|
||||
@@ -1515,18 +1515,28 @@ static void colorband_buttons_large(uiBlock *block, ColorBand *coba, int xoffs,
|
||||
|
||||
if(coba->tot) {
|
||||
CBData *cbd= coba->data + coba->cur;
|
||||
#if 1
|
||||
/* better to use rna so we can animate them */
|
||||
PointerRNA ptr;
|
||||
RNA_pointer_create(cb->ptr.id.data, &RNA_ColorRampElement, cbd, &ptr);
|
||||
uiItemR(layout, NULL, 0, &ptr, "color", 0);
|
||||
//uiItemR(layout, NULL, 0, &ptr, "position", 0);
|
||||
bt= uiDefButF(block, NUM, 0, "Pos:", 0+xoffs,40+yoffs,100, 20, &cbd->pos, 0.0, 1.0, 10, 0, "The position of the active color stop");
|
||||
uiButSetNFunc(bt, colorband_pos_cb, MEM_dupallocN(cb), coba);
|
||||
|
||||
#else
|
||||
bt= uiDefButF(block, NUM, 0, "Pos:", 0+xoffs,40+yoffs,100, 20, &cbd->pos, 0.0, 1.0, 10, 0, "The position of the active color stop");
|
||||
uiButSetNFunc(bt, colorband_pos_cb, MEM_dupallocN(cb), coba);
|
||||
bt= uiDefButF(block, COL, 0, "", 110+xoffs,40+yoffs,80,20, &(cbd->r), 0, 0, 0, B_BANDCOL, "The color value for the active color stop");
|
||||
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
|
||||
bt= uiDefButF(block, NUMSLI, 0, "A ", 200+xoffs,40+yoffs,100,20, &cbd->a, 0.0, 1.0, 10, 0, "The alpha value of the active color stop");
|
||||
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void colorband_buttons_small(uiBlock *block, ColorBand *coba, rctf *butr, RNAUpdateCb *cb)
|
||||
static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand *coba, rctf *butr, RNAUpdateCb *cb)
|
||||
{
|
||||
uiBut *bt;
|
||||
float unit= (butr->xmax-butr->xmin)/14.0f;
|
||||
@@ -1540,10 +1550,16 @@ static void colorband_buttons_small(uiBlock *block, ColorBand *coba, rctf *butr,
|
||||
|
||||
if(coba->tot) {
|
||||
CBData *cbd= coba->data + coba->cur;
|
||||
#if 1
|
||||
PointerRNA ptr;
|
||||
RNA_pointer_create(cb->ptr.id.data, &RNA_ColorRampElement, cbd, &ptr);
|
||||
uiItemR(layout, "", 0, &ptr, "color", 0);
|
||||
#else
|
||||
bt= uiDefButF(block, COL, 0, "", xs+4.0f*unit,butr->ymin+20.0f,2.0f*unit,20, &(cbd->r), 0, 0, 0, B_BANDCOL, "The color value for the active color stop");
|
||||
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
|
||||
bt= uiDefButF(block, NUMSLI, 0, "A:", xs+6.0f*unit,butr->ymin+20.0f,4.0f*unit,20, &(cbd->a), 0.0f, 1.0f, 10, 2, "The alpha value of the active color stop");
|
||||
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
bt= uiDefButS(block, MENU, 0, "Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4",
|
||||
@@ -1556,12 +1572,12 @@ static void colorband_buttons_small(uiBlock *block, ColorBand *coba, rctf *butr,
|
||||
uiBlockEndAlign(block);
|
||||
}
|
||||
|
||||
static void colorband_buttons_layout(uiBlock *block, ColorBand *coba, rctf *butr, int small, RNAUpdateCb *cb)
|
||||
static void colorband_buttons_layout(uiLayout *layout, uiBlock *block, ColorBand *coba, rctf *butr, int small, RNAUpdateCb *cb)
|
||||
{
|
||||
if(small)
|
||||
colorband_buttons_small(block, coba, butr, cb);
|
||||
colorband_buttons_small(layout, block, coba, butr, cb);
|
||||
else
|
||||
colorband_buttons_large(block, coba, 0, 0, cb);
|
||||
colorband_buttons_large(layout, block, coba, 0, 0, cb);
|
||||
}
|
||||
|
||||
void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, char *propname, int expand)
|
||||
@@ -1587,7 +1603,7 @@ void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, char *propname, int
|
||||
rect.ymin= 0; rect.ymax= 190;
|
||||
|
||||
block= uiLayoutAbsoluteBlock(layout);
|
||||
colorband_buttons_layout(block, cptr.data, &rect, !expand, cb);
|
||||
colorband_buttons_layout(layout, block, cptr.data, &rect, !expand, cb);
|
||||
|
||||
MEM_freeN(cb);
|
||||
}
|
||||
@@ -1864,7 +1880,7 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe
|
||||
|
||||
/* black/white levels */
|
||||
if(levels) {
|
||||
split= uiLayoutSplit(layout, 0);
|
||||
split= uiLayoutSplit(layout, 0, 0);
|
||||
uiItemR(uiLayoutColumn(split, 0), NULL, 0, ptr, "black_level", UI_ITEM_R_EXPAND);
|
||||
uiItemR(uiLayoutColumn(split, 0), NULL, 0, ptr, "white_level", UI_ITEM_R_EXPAND);
|
||||
|
||||
@@ -2098,7 +2114,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
|
||||
else if(itemptr->type == &RNA_ShapeKey) {
|
||||
ob= (Object*)activeptr->data;
|
||||
|
||||
split= uiLayoutSplit(sub, 0.75f);
|
||||
split= uiLayoutSplit(sub, 0.75f, 0);
|
||||
|
||||
uiItemL(split, name, icon);
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ void uiDefAutoButsRNA(const bContext *C, uiLayout *layout, PointerRNA *ptr, int
|
||||
uiItemL(col, name, 0);
|
||||
}
|
||||
else if(columns == 2) {
|
||||
split = uiLayoutSplit(layout, 0.5f);
|
||||
split = uiLayoutSplit(layout, 0.5f, 0);
|
||||
|
||||
uiItemL(uiLayoutColumn(split, 0), name, 0);
|
||||
col= uiLayoutColumn(split, 0);
|
||||
|
||||
@@ -1280,6 +1280,9 @@ void init_userdef_do_versions(void)
|
||||
if (U.frameserverport == 0) {
|
||||
U.frameserverport = 8080;
|
||||
}
|
||||
if (U.dbl_click_time == 0) {
|
||||
U.dbl_click_time = 350;
|
||||
}
|
||||
|
||||
/* funny name, but it is GE stuff, moves userdef stuff to engine */
|
||||
// XXX space_set_commmandline_options();
|
||||
|
||||
@@ -3629,7 +3629,7 @@ static int mesh_select_random_exec(bContext *C, wmOperator *op)
|
||||
if(!RNA_boolean_get(op->ptr, "extend"))
|
||||
EM_deselect_all(em);
|
||||
|
||||
selectrandom_mesh(em, RNA_float_get(op->ptr, "percentage")/100.0f);
|
||||
selectrandom_mesh(em, RNA_float_get(op->ptr, "percent")/100.0f);
|
||||
|
||||
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
|
||||
|
||||
@@ -3652,8 +3652,8 @@ void MESH_OT_select_random(wmOperatorType *ot)
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
/* props */
|
||||
RNA_def_float_percentage(ot->srna, "percentage", 50.f, 0.0f, 100.0f, "Percentage", "Percentage of elements to select randomly.", 0.f, 100.0f);
|
||||
RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", "");
|
||||
RNA_def_float_percentage(ot->srna, "percent", 50.f, 0.0f, 100.0f, "Percent", "Percentage of elements to select randomly.", 0.f, 100.0f);
|
||||
RNA_def_boolean(ot->srna, "extend", FALSE, "Extend Selection", "Extend selection instead of deselecting everything first.");
|
||||
}
|
||||
|
||||
void EM_select_by_material(EditMesh *em, int index)
|
||||
|
||||
@@ -4985,7 +4985,7 @@ static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
|
||||
// RNA_enum_set(op->ptr, "proportional", 0);
|
||||
// RNA_boolean_set(op->ptr, "mirror", 0);
|
||||
// WM_operator_name_call(C, "TFM_OT_translate", WM_OP_INVOKE_REGION_WIN, op->ptr);
|
||||
// WM_operator_name_call(C, "TRANSFORM_OT_translate", WM_OP_INVOKE_REGION_WIN, op->ptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
@@ -173,29 +173,29 @@ void ED_operatormacros_mesh(void)
|
||||
|
||||
ot= WM_operatortype_append_macro("MESH_OT_loopcut_slide", "Loop Cut and Slide", OPTYPE_UNDO|OPTYPE_REGISTER);
|
||||
WM_operatortype_macro_define(ot, "MESH_OT_loopcut");
|
||||
WM_operatortype_macro_define(ot, "TFM_OT_edge_slide");
|
||||
WM_operatortype_macro_define(ot, "TRANSFORM_OT_edge_slide");
|
||||
|
||||
ot= WM_operatortype_append_macro("MESH_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
|
||||
WM_operatortype_macro_define(ot, "MESH_OT_duplicate");
|
||||
otmacro= WM_operatortype_macro_define(ot, "TFM_OT_translate");
|
||||
otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
|
||||
RNA_enum_set(otmacro->ptr, "proportional", 0);
|
||||
|
||||
ot= WM_operatortype_append_macro("MESH_OT_rip_move", "Rip", OPTYPE_UNDO|OPTYPE_REGISTER);
|
||||
WM_operatortype_macro_define(ot, "MESH_OT_rip");
|
||||
otmacro= WM_operatortype_macro_define(ot, "TFM_OT_translate");
|
||||
otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
|
||||
RNA_enum_set(otmacro->ptr, "proportional", 0);
|
||||
|
||||
ot= WM_operatortype_append_macro("MESH_OT_extrude_move_along_normals", "Extrude Along Normals", OPTYPE_UNDO|OPTYPE_REGISTER);
|
||||
ot->poll = ED_operator_editmesh_face_select; /* restrict extrude along normals to face select */
|
||||
WM_operatortype_macro_define(ot, "MESH_OT_extrude");
|
||||
otmacro= WM_operatortype_macro_define(ot, "TFM_OT_translate");
|
||||
otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
|
||||
RNA_enum_set(otmacro->ptr, "proportional", 0);
|
||||
RNA_enum_set(otmacro->ptr, "constraint_orientation", V3D_MANIP_NORMAL);
|
||||
RNA_boolean_set_array(otmacro->ptr, "constraint_axis", constraint_axis);
|
||||
|
||||
ot= WM_operatortype_append_macro("MESH_OT_extrude_move", "Extrude", OPTYPE_UNDO|OPTYPE_REGISTER);
|
||||
WM_operatortype_macro_define(ot, "MESH_OT_extrude");
|
||||
otmacro= WM_operatortype_macro_define(ot, "TFM_OT_translate");
|
||||
otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
|
||||
RNA_enum_set(otmacro->ptr, "proportional", 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -370,7 +370,7 @@ static int duplicate_metaelems_invoke(bContext *C, wmOperator *op, wmEvent *even
|
||||
|
||||
if (retv == OPERATOR_FINISHED) {
|
||||
RNA_int_set(op->ptr, "mode", TFM_TRANSLATION);
|
||||
WM_operator_name_call(C, "TFM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr);
|
||||
WM_operator_name_call(C, "TRANSFORM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr);
|
||||
}
|
||||
|
||||
return retv;
|
||||
|
||||
@@ -205,7 +205,7 @@ void ED_operatormacros_object(void)
|
||||
ot= WM_operatortype_append_macro("OBJECT_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
|
||||
if(ot) {
|
||||
WM_operatortype_macro_define(ot, "OBJECT_OT_duplicate");
|
||||
otmacro= WM_operatortype_macro_define(ot, "TFM_OT_translate");
|
||||
otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
|
||||
RNA_enum_set(otmacro->ptr, "proportional", PROP_EDIT_OFF);
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ void ED_operatormacros_object(void)
|
||||
if(ot) {
|
||||
otmacro= WM_operatortype_macro_define(ot, "OBJECT_OT_duplicate");
|
||||
RNA_boolean_set(otmacro->ptr, "linked", 1);
|
||||
otmacro= WM_operatortype_macro_define(ot, "TFM_OT_translate");
|
||||
otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
|
||||
RNA_enum_set(otmacro->ptr, "proportional", PROP_EDIT_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -996,11 +996,11 @@ static int object_select_random_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
CTX_DATA_END;
|
||||
}
|
||||
percent = RNA_float_get(op->ptr, "percent");
|
||||
percent = RNA_float_get(op->ptr, "percent")/100.0f;
|
||||
|
||||
CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
|
||||
if (BLI_frand() < percent) {
|
||||
ED_base_object_select(base, BA_SELECT);
|
||||
ED_base_object_select(base, BA_SELECT);
|
||||
}
|
||||
}
|
||||
CTX_DATA_END;
|
||||
@@ -1013,7 +1013,7 @@ static int object_select_random_exec(bContext *C, wmOperator *op)
|
||||
void OBJECT_OT_select_random(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Random select";
|
||||
ot->name= "Select Random";
|
||||
ot->description = "Set select on random visible objects.";
|
||||
ot->idname= "OBJECT_OT_select_random";
|
||||
|
||||
@@ -1026,8 +1026,8 @@ void OBJECT_OT_select_random(wmOperatorType *ot)
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first.");
|
||||
RNA_def_float_percentage(ot->srna, "percent", 0.5f, 0.0f, 1.0f, "Percent", "percentage of objects to randomly select", 0.0001f, 1.0f);
|
||||
RNA_def_float_percentage(ot->srna, "percent", 50.f, 0.0f, 100.0f, "Percent", "Percentage of objects to select randomly", 0.f, 100.0f);
|
||||
RNA_def_boolean(ot->srna, "extend", FALSE, "Extend Selection", "Extend selection instead of deselecting everything first.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user