pep8 cleanup + correction for external player operator return value.
This commit is contained in:
parent
a8d364ce4a
commit
97bdfe6f1b
@ -50,7 +50,7 @@ for i in vertexgroup_vertex_indices:
|
||||
|
||||
Now for some reason the name does not 'stick' and we have to set it this way:
|
||||
vertexgroup.name = 'NAME_OF_VERTEXGROUP'
|
||||
|
||||
|
||||
Conversion to 2.50 also meant we could simply do away with our crude user interface.
|
||||
Just definining the appropriate properties in the AddGear() operator will display the
|
||||
properties in the Blender GUI with the added benefit of making it interactive: changing
|
||||
@ -65,7 +65,7 @@ we could no longer use deepcopy(zip(...)) but had to convert the zip object to a
|
||||
first.
|
||||
|
||||
The code to actually implement the AddGear() function is mostly copied from add_mesh_torus()
|
||||
(distributed with Blender).
|
||||
(distributed with Blender).
|
||||
|
||||
Unresolved issues:
|
||||
|
||||
@ -108,148 +108,148 @@ tv = [13,14,15,29,30,31] #vertices on a tooth
|
||||
spokefaces=((0,1,2,5),(2,3,4,7),(5,2,7,6),(5,6,9,8),(6,7,10,9),(11,8,13,12),(8,9,10,13),(13,10,15,14))
|
||||
|
||||
def add_tooth(a,t,d,r,Ad,De,b,p,rack=0,crown=0.0):
|
||||
"""
|
||||
private function: calculate the vertex coords for a single side
|
||||
section of a gear tooth. returns them as a list of lists.
|
||||
"""
|
||||
|
||||
A=[a,a+t/4,a+t/2,a+3*t/4,a+t]
|
||||
C=[cos(i) for i in A]
|
||||
S=[sin(i) for i in A]
|
||||
|
||||
Ra=r+Ad
|
||||
Rd=r-De
|
||||
Rb=Rd-b
|
||||
|
||||
#Pressure angle calc
|
||||
O =Ad*tan(p)
|
||||
p =atan(O/Ra)
|
||||
if r<0 : p = -p
|
||||
|
||||
if rack :
|
||||
S =[sin(t/4)*I for I in range(-2,3)]
|
||||
Sp=[0,sin(-t/4+p),0,sin(t/4-p)]
|
||||
"""
|
||||
private function: calculate the vertex coords for a single side
|
||||
section of a gear tooth. returns them as a list of lists.
|
||||
"""
|
||||
|
||||
v=[(Rb,r*S[I],d) for I in range(5)]
|
||||
v.extend([(Rd,r*S[I],d) for I in range(5)])
|
||||
v.extend([(r,r*S[I],d) for I in range(1,4)])
|
||||
v.extend([(Ra,r*Sp[I],d) for I in range(1,4)])
|
||||
|
||||
else :
|
||||
Cp=[0,cos(a+t/4+p),cos(a+t/2),cos(a+3*t/4-p)]
|
||||
Sp=[0,sin(a+t/4+p),sin(a+t/2),sin(a+3*t/4-p)]
|
||||
A=[a,a+t/4,a+t/2,a+3*t/4,a+t]
|
||||
C=[cos(i) for i in A]
|
||||
S=[sin(i) for i in A]
|
||||
|
||||
v=[(Rb*C[I],Rb*S[I],d) for I in range(5)]
|
||||
v.extend([(Rd*C[I],Rd*S[I],d) for I in range(5)])
|
||||
v.extend([(r*C[I],r*S[I],d+crown/3) for I in range(1,4)])
|
||||
v.extend([(Ra*Cp[I],Ra*Sp[I],d+crown) for I in range(1,4)])
|
||||
|
||||
return v
|
||||
Ra=r+Ad
|
||||
Rd=r-De
|
||||
Rb=Rd-b
|
||||
|
||||
#Pressure angle calc
|
||||
O =Ad*tan(p)
|
||||
p =atan(O/Ra)
|
||||
if r<0 : p = -p
|
||||
|
||||
if rack :
|
||||
S =[sin(t/4)*I for I in range(-2,3)]
|
||||
Sp=[0,sin(-t/4+p),0,sin(t/4-p)]
|
||||
|
||||
v=[(Rb,r*S[I],d) for I in range(5)]
|
||||
v.extend([(Rd,r*S[I],d) for I in range(5)])
|
||||
v.extend([(r,r*S[I],d) for I in range(1,4)])
|
||||
v.extend([(Ra,r*Sp[I],d) for I in range(1,4)])
|
||||
|
||||
else :
|
||||
Cp=[0,cos(a+t/4+p),cos(a+t/2),cos(a+3*t/4-p)]
|
||||
Sp=[0,sin(a+t/4+p),sin(a+t/2),sin(a+3*t/4-p)]
|
||||
|
||||
v=[(Rb*C[I],Rb*S[I],d) for I in range(5)]
|
||||
v.extend([(Rd*C[I],Rd*S[I],d) for I in range(5)])
|
||||
v.extend([(r*C[I],r*S[I],d+crown/3) for I in range(1,4)])
|
||||
v.extend([(Ra*Cp[I],Ra*Sp[I],d+crown) for I in range(1,4)])
|
||||
|
||||
return v
|
||||
|
||||
def add_spoke2(a,t,d,r,De,b,s,w,l,gap=0,width=19):
|
||||
"""
|
||||
EXPERIMENTAL private function: calculate the vertex coords for a single side
|
||||
section of a gearspoke. returns them as a list of lists.
|
||||
"""
|
||||
|
||||
Rd=r-De
|
||||
Rb=Rd-b
|
||||
Rl=Rb
|
||||
|
||||
v =[]
|
||||
ef =[]
|
||||
ef2=[]
|
||||
sf =[]
|
||||
if not gap :
|
||||
for N in range(width,1,-2) :
|
||||
ef.append(len(v))
|
||||
ts = t/4
|
||||
tm = a + 2*ts
|
||||
te = asin(w/Rb)
|
||||
td = te - ts
|
||||
t4 = ts+td*(width-N)/(width-3.0)
|
||||
A=[tm+(i-int(N/2))*t4 for i in range(N)]
|
||||
C=[cos(i) for i in A]
|
||||
S=[sin(i) for i in A]
|
||||
v.extend([ (Rb*I,Rb*J,d) for (I,J) in zip(C,S)])
|
||||
ef2.append(len(v)-1)
|
||||
Rb= Rb-s
|
||||
n=0
|
||||
for N in range(width,3,-2) :
|
||||
sf.extend([(i+n,i+1+n,i+2+n,i+N+n) for i in range(0,N-1,2)])
|
||||
sf.extend([(i+2+n,i+N+n,i+N+1+n,i+N+2+n) for i in range(0,N-3,2)])
|
||||
n = n + N
|
||||
|
||||
return v,ef,ef2,sf
|
||||
"""
|
||||
EXPERIMENTAL private function: calculate the vertex coords for a single side
|
||||
section of a gearspoke. returns them as a list of lists.
|
||||
"""
|
||||
|
||||
Rd=r-De
|
||||
Rb=Rd-b
|
||||
Rl=Rb
|
||||
|
||||
v =[]
|
||||
ef =[]
|
||||
ef2=[]
|
||||
sf =[]
|
||||
if not gap :
|
||||
for N in range(width,1,-2) :
|
||||
ef.append(len(v))
|
||||
ts = t/4
|
||||
tm = a + 2*ts
|
||||
te = asin(w/Rb)
|
||||
td = te - ts
|
||||
t4 = ts+td*(width-N)/(width-3.0)
|
||||
A=[tm+(i-int(N/2))*t4 for i in range(N)]
|
||||
C=[cos(i) for i in A]
|
||||
S=[sin(i) for i in A]
|
||||
v.extend([ (Rb*I,Rb*J,d) for (I,J) in zip(C,S)])
|
||||
ef2.append(len(v)-1)
|
||||
Rb= Rb-s
|
||||
n=0
|
||||
for N in range(width,3,-2) :
|
||||
sf.extend([(i+n,i+1+n,i+2+n,i+N+n) for i in range(0,N-1,2)])
|
||||
sf.extend([(i+2+n,i+N+n,i+N+1+n,i+N+2+n) for i in range(0,N-3,2)])
|
||||
n = n + N
|
||||
|
||||
return v,ef,ef2,sf
|
||||
|
||||
def add_gear(N,r,Ad,De,b,p,D=1,skew=0,conangle=0,rack=0,crown=0.0, spoke=0,spbevel=0.1,spwidth=0.2,splength=1.0,spresol=9):
|
||||
"""
|
||||
"""
|
||||
worm =0
|
||||
if N<5 : (worm,N)=(N,24)
|
||||
t =2*pi/N
|
||||
if rack: N=1
|
||||
p =rad(p)
|
||||
conangle=rad(conangle)
|
||||
skew =rad(skew)
|
||||
scale = (r - 2*D*tan(conangle) )/r
|
||||
|
||||
f =[]
|
||||
v =[]
|
||||
tg=[] #vertexgroup of top vertices.
|
||||
vg=[] #vertexgroup of valley vertices
|
||||
|
||||
|
||||
M=[0]
|
||||
if worm : (M,skew,D)=(range(32),rad(11.25),D/2)
|
||||
|
||||
for W in M:
|
||||
fl=W*N*L*2
|
||||
l=0 #number of vertices
|
||||
for I in range(int(N)):
|
||||
a=I*t
|
||||
for(s,d,c,first) in ((W*skew,W*2*D-D,1,1),((W+1)*skew,W*2*D+D,scale,0)):
|
||||
if worm and I%(int(N)/worm)!=0:
|
||||
v.extend(add_tooth(a+s,t,d,r-De,0.0,0.0,b,p))
|
||||
else:
|
||||
v.extend(add_tooth(a+s,t,d,r*c,Ad*c,De*c,b*c,p,rack,crown))
|
||||
if not worm or (W==0 and first) or (W==(len(M)-1) and not first) :
|
||||
f.extend([ [j+l+fl for j in i]for i in dc(faces)])
|
||||
l += L
|
||||
"""
|
||||
"""
|
||||
worm =0
|
||||
if N<5 : (worm,N)=(N,24)
|
||||
t =2*pi/N
|
||||
if rack: N=1
|
||||
p =rad(p)
|
||||
conangle=rad(conangle)
|
||||
skew =rad(skew)
|
||||
scale = (r - 2*D*tan(conangle) )/r
|
||||
|
||||
#print (len(f))
|
||||
#print (dc(efc))
|
||||
f.extend([ [j+I*L*2+fl for j in i] for i in dc(efc)])
|
||||
#print (len(f))
|
||||
tg.extend([i+I*L*2 for i in tv])
|
||||
vg.extend([i+I*L*2 for i in vv])
|
||||
# EXPERIMENTAL: add spokes
|
||||
if not worm and spoke>0 :
|
||||
fl=len(v)
|
||||
for I in range(int(N)):
|
||||
a=I*t
|
||||
s=0 # for test
|
||||
if I%spoke==0 :
|
||||
for d in (-D,D) :
|
||||
(sv,ef,ef2,sf) = add_spoke2(a+s,t,d,r*c,De*c,b*c,spbevel,spwidth,splength,0,spresol)
|
||||
v.extend(sv)
|
||||
f.extend([ [j+fl for j in i]for i in sf])
|
||||
fl += len(sv)
|
||||
d1 = fl-len(sv)
|
||||
d2 = fl-2*len(sv)
|
||||
f.extend([(i+d2,j+d2,j+d1,i+d1) for (i,j) in zip(ef[:-1],ef[1:])])
|
||||
f.extend([(i+d2,j+d2,j+d1,i+d1) for (i,j) in zip(ef2[:-1],ef2[1:])])
|
||||
else :
|
||||
for d in (-D,D) :
|
||||
(sv,ef,ef2,sf) = add_spoke2(a+s,t,d,r*c,De*c,b*c,spbevel,spwidth,splength,1,spresol)
|
||||
v.extend(sv)
|
||||
fl += len(sv)
|
||||
d1 = fl-len(sv)
|
||||
d2 = fl-2*len(sv)
|
||||
#f.extend([(i+d2,i+1+d2,i+1+d1,i+d1) for (i) in (0,1,2,3)])
|
||||
#f.extend([(i+d2,i+1+d2,i+1+d1,i+d1) for (i) in (5,6,7,8)])
|
||||
|
||||
return flatten(v), flatten(f), tg, vg
|
||||
f =[]
|
||||
v =[]
|
||||
tg=[] #vertexgroup of top vertices.
|
||||
vg=[] #vertexgroup of valley vertices
|
||||
|
||||
|
||||
M=[0]
|
||||
if worm : (M,skew,D)=(range(32),rad(11.25),D/2)
|
||||
|
||||
for W in M:
|
||||
fl=W*N*L*2
|
||||
l=0 #number of vertices
|
||||
for I in range(int(N)):
|
||||
a=I*t
|
||||
for(s,d,c,first) in ((W*skew,W*2*D-D,1,1),((W+1)*skew,W*2*D+D,scale,0)):
|
||||
if worm and I%(int(N)/worm)!=0:
|
||||
v.extend(add_tooth(a+s,t,d,r-De,0.0,0.0,b,p))
|
||||
else:
|
||||
v.extend(add_tooth(a+s,t,d,r*c,Ad*c,De*c,b*c,p,rack,crown))
|
||||
if not worm or (W==0 and first) or (W==(len(M)-1) and not first) :
|
||||
f.extend([ [j+l+fl for j in i]for i in dc(faces)])
|
||||
l += L
|
||||
|
||||
#print (len(f))
|
||||
#print (dc(efc))
|
||||
f.extend([ [j+I*L*2+fl for j in i] for i in dc(efc)])
|
||||
#print (len(f))
|
||||
tg.extend([i+I*L*2 for i in tv])
|
||||
vg.extend([i+I*L*2 for i in vv])
|
||||
# EXPERIMENTAL: add spokes
|
||||
if not worm and spoke>0 :
|
||||
fl=len(v)
|
||||
for I in range(int(N)):
|
||||
a=I*t
|
||||
s=0 # for test
|
||||
if I%spoke==0 :
|
||||
for d in (-D,D) :
|
||||
(sv,ef,ef2,sf) = add_spoke2(a+s,t,d,r*c,De*c,b*c,spbevel,spwidth,splength,0,spresol)
|
||||
v.extend(sv)
|
||||
f.extend([ [j+fl for j in i]for i in sf])
|
||||
fl += len(sv)
|
||||
d1 = fl-len(sv)
|
||||
d2 = fl-2*len(sv)
|
||||
f.extend([(i+d2,j+d2,j+d1,i+d1) for (i,j) in zip(ef[:-1],ef[1:])])
|
||||
f.extend([(i+d2,j+d2,j+d1,i+d1) for (i,j) in zip(ef2[:-1],ef2[1:])])
|
||||
else :
|
||||
for d in (-D,D) :
|
||||
(sv,ef,ef2,sf) = add_spoke2(a+s,t,d,r*c,De*c,b*c,spbevel,spwidth,splength,1,spresol)
|
||||
v.extend(sv)
|
||||
fl += len(sv)
|
||||
d1 = fl-len(sv)
|
||||
d2 = fl-2*len(sv)
|
||||
#f.extend([(i+d2,i+1+d2,i+1+d1,i+d1) for (i) in (0,1,2,3)])
|
||||
#f.extend([(i+d2,i+1+d2,i+1+d1,i+d1) for (i) in (5,6,7,8)])
|
||||
|
||||
return flatten(v), flatten(f), tg, vg
|
||||
|
||||
|
||||
from bpy.props import *
|
||||
@ -307,7 +307,7 @@ class AddGear(bpy.types.Operator):
|
||||
crown=self.properties.crown)
|
||||
|
||||
#print(len(verts_loc)/3,faces)
|
||||
|
||||
|
||||
mesh = bpy.data.meshes.new("Gear")
|
||||
|
||||
mesh.add_geometry(int(len(verts_loc) / 3), 0, int(len(faces) / 4))
|
||||
@ -321,7 +321,7 @@ class AddGear(bpy.types.Operator):
|
||||
ob.selected = False
|
||||
|
||||
mesh.update()
|
||||
|
||||
|
||||
ob_new = bpy.data.objects.new('Gear', mesh)
|
||||
|
||||
tipgroup = ob_new.add_vertex_group('Tips')
|
||||
@ -329,13 +329,13 @@ class AddGear(bpy.types.Operator):
|
||||
tipgroup.name = 'Tips'
|
||||
for i in tip_vertices:
|
||||
ob_new.add_vertex_to_group(i, tipgroup, 1.0, 'ADD')
|
||||
|
||||
|
||||
valleygroup = ob_new.add_vertex_group('Valleys')
|
||||
# for some reason the name does not 'stick' and we have to set it this way:
|
||||
valleygroup.name = 'Valleys'
|
||||
for i in valley_vertices:
|
||||
ob_new.add_vertex_to_group(i, valleygroup, 1.0, 'ADD')
|
||||
|
||||
|
||||
scene.objects.link(ob_new)
|
||||
scene.objects.active = ob_new
|
||||
ob_new.selected = True
|
||||
@ -348,7 +348,7 @@ class AddGear(bpy.types.Operator):
|
||||
# unfortunately the next line wont get us back to object mode but bombs
|
||||
#bpy.ops.object.mode_set('OBJECT')
|
||||
#print(4,bpy.context.mode)
|
||||
|
||||
|
||||
ob_new.location = tuple(context.scene.cursor_location)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
@ -48,4 +48,4 @@ def unregister():
|
||||
bpy.types.INFO_MT_file_export.remove(menu_export)
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
register()
|
||||
|
@ -28,7 +28,7 @@ of 12 values (this was the default before blender 2.5). Now default
|
||||
settings will triangulate the mesh.
|
||||
|
||||
Usage:<br>
|
||||
Execute this script from the "File->Export" menu. You can select
|
||||
Execute this script from the "File->Export" menu. You can select
|
||||
whether modifiers should be applied and if the mesh is triangulated.
|
||||
|
||||
"""
|
||||
@ -45,7 +45,7 @@ def faceToTriangles(face):
|
||||
triangles.append(face)
|
||||
|
||||
return triangles
|
||||
|
||||
|
||||
|
||||
def faceValues(face, mesh, matrix):
|
||||
fv = []
|
||||
|
@ -23,9 +23,9 @@ This script imports Raw Triangle File format files to Blender.
|
||||
|
||||
The raw triangle format is very simple; it has no verts or faces lists.
|
||||
It's just a simple ascii text file with the vertices of each triangle
|
||||
listed on each line. In addition, a line with 12 values will be
|
||||
imported as a quad. This may be in conflict with some other
|
||||
applications, which use a raw format, but this is how it was
|
||||
listed on each line. In addition, a line with 12 values will be
|
||||
imported as a quad. This may be in conflict with some other
|
||||
applications, which use a raw format, but this is how it was
|
||||
implemented back in blender 2.42.
|
||||
|
||||
Usage:<br>
|
||||
@ -65,8 +65,8 @@ def readMesh(filename, objName):
|
||||
return [(f1, f2, f3), (f4, f5, f6), (f7, f8, f9), (A, B, C)]
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
|
||||
|
||||
faces = []
|
||||
for line in file.readlines():
|
||||
face = line_to_face(line)
|
||||
@ -100,7 +100,7 @@ def readMesh(filename, objName):
|
||||
|
||||
def addMeshObj(mesh, objName):
|
||||
scn = bpy.context.scene
|
||||
|
||||
|
||||
for o in scn.objects:
|
||||
o.selected = False
|
||||
|
||||
|
@ -3463,6 +3463,7 @@ class ExportFBX(bpy.types.Operator):
|
||||
# SMALL or COSMETICAL
|
||||
# - find a way to get blender version, and put it in bpy.util?, old was Blender.Get('version')
|
||||
|
||||
|
||||
def menu_func(self, context):
|
||||
default_path = bpy.data.filename.replace(".blend", ".fbx")
|
||||
self.layout.operator(ExportFBX.bl_idname, text="Autodesk FBX (.fbx)").path = default_path
|
||||
@ -3471,11 +3472,11 @@ def menu_func(self, context):
|
||||
def register():
|
||||
bpy.types.register(ExportFBX)
|
||||
bpy.types.INFO_MT_file_export.append(menu_func)
|
||||
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.types.unregister(ExportFBX)
|
||||
bpy.types.INFO_MT_file_export.remove(menu_func)
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -190,7 +190,7 @@ def menu_func(self, context):
|
||||
def register():
|
||||
bpy.types.register(ExportMDD)
|
||||
bpy.types.INFO_MT_file_export.append(menu_func)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.types.unregister(ExportMDD)
|
||||
bpy.types.INFO_MT_file_export.remove(menu_func)
|
||||
|
@ -966,7 +966,7 @@ def menu_func(self, context):
|
||||
def register():
|
||||
bpy.types.register(ExportOBJ)
|
||||
bpy.types.INFO_MT_file_export.append(menu_func)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.types.unregister(ExportOBJ)
|
||||
bpy.types.INFO_MT_file_export.remove(menu_func)
|
||||
|
@ -321,11 +321,11 @@ def menu_func(self, context):
|
||||
def register():
|
||||
bpy.types.register(ExportPLY)
|
||||
bpy.types.INFO_MT_file_export.append(menu_func)
|
||||
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.types.unregister(ExportPLY)
|
||||
bpy.types.INFO_MT_file_export.remove(menu_func)
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -1251,7 +1251,7 @@ def menu_func(self, context):
|
||||
def register():
|
||||
bpy.types.register(ExportX3D)
|
||||
bpy.types.INFO_MT_file_export.append(menu_func)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.types.unregister(ExportX3D)
|
||||
bpy.types.INFO_MT_file_export.remove(menu_func)
|
||||
|
@ -293,12 +293,12 @@ def skip_to_end(file, skip_chunk):
|
||||
|
||||
def add_texture_to_material(image, texture, material, mapto):
|
||||
#print('assigning %s to %s' % (texture, material))
|
||||
|
||||
|
||||
if mapto not in ("COLOR", "SPECULARITY", "ALPHA", "NORMAL"):
|
||||
print('/tError: Cannot map to "%s"\n\tassuming diffuse color. modify material "%s" later.' % (mapto, material.name))
|
||||
mapto = "COLOR"
|
||||
|
||||
if image:
|
||||
if image:
|
||||
texture.image = image
|
||||
# if image: texture.setImage(image) # double check its an image.
|
||||
|
||||
@ -413,9 +413,9 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
|
||||
# targetFace.uv = [contextMeshUV[vindex] for vindex in myContextMesh_facels[i]]
|
||||
if img:
|
||||
uf.image = img
|
||||
|
||||
|
||||
# to get this image to show up in 'Textured' shading mode
|
||||
uf.tex = True
|
||||
uf.tex = True
|
||||
|
||||
# bmesh.transform(contextMatrix)
|
||||
ob = bpy.data.objects.new(tempName, bmesh)
|
||||
@ -1015,7 +1015,7 @@ class IMPORT_OT_autodesk_3ds(bpy.types.Operator):
|
||||
path = StringProperty(name="File Path", description="File path used for importing the 3DS file", maxlen= 1024, default= "")
|
||||
filename = StringProperty(name="File Name", description="Name of the file.")
|
||||
directory = StringProperty(name="Directory", description="Directory of the file.")
|
||||
|
||||
|
||||
# size_constraint = FloatProperty(name="Size Constraint", description="Scale the model by 10 until it reacehs the size constraint. Zero Disables.", min=0.0, max=1000.0, soft_min=0.0, soft_max=1000.0, default=10.0),
|
||||
# search_images = BoolProperty(name="Image Search", description="Search subdirectories for any assosiated images (Warning, may be slow)", default=True),
|
||||
# apply_matrix = BoolProperty(name="Transform Fix", description="Workaround for object transformations importing incorrectly", default=False),
|
||||
@ -1036,7 +1036,7 @@ menu_func = lambda self, context: self.layout.operator(IMPORT_OT_autodesk_3ds.bl
|
||||
def register():
|
||||
bpy.types.register(IMPORT_OT_autodesk_3ds)
|
||||
bpy.types.INFO_MT_file_import.append(menu_func)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.types.unregister(IMPORT_OT_autodesk_3ds)
|
||||
bpy.types.INFO_MT_file_import.remove(menu_func)
|
||||
|
@ -1627,7 +1627,7 @@ menu_func = lambda self, context: self.layout.operator(IMPORT_OT_obj.bl_idname,
|
||||
def register():
|
||||
bpy.types.register(IMPORT_OT_obj)
|
||||
bpy.types.INFO_MT_file_import.append(menu_func)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.types.unregister(IMPORT_OT_obj)
|
||||
bpy.types.INFO_MT_file_import.remove(menu_func)
|
||||
|
@ -44,4 +44,4 @@ def unregister():
|
||||
bpy.types.unregister(ui.NetRenderJob)
|
||||
bpy.types.unregister(ui.NetRenderSettings)
|
||||
bpy.types.unregister(ui.NetRenderSlave)
|
||||
|
||||
|
||||
|
@ -27,6 +27,7 @@ op_call = ops_module.call
|
||||
op_as_string = ops_module.as_string
|
||||
op_get_rna = ops_module.get_rna
|
||||
|
||||
|
||||
class bpy_ops(object):
|
||||
'''
|
||||
Fake module like class.
|
||||
|
@ -48,10 +48,11 @@ def _test_import(module_name, loaded_modules):
|
||||
|
||||
if _bpy.app.debug:
|
||||
print("time %s %.4f" % (module_name, time.time() - t))
|
||||
|
||||
|
||||
loaded_modules.add(mod.__name__) # should match mod.__name__ too
|
||||
return mod
|
||||
|
||||
|
||||
def modules_from_path(path, loaded_modules):
|
||||
"""
|
||||
Load all modules in a path and return them as a list.
|
||||
@ -65,9 +66,9 @@ def modules_from_path(path, loaded_modules):
|
||||
"""
|
||||
import traceback
|
||||
import time
|
||||
|
||||
|
||||
modules = []
|
||||
|
||||
|
||||
for f in sorted(_os.listdir(path)):
|
||||
if f.endswith(".py"):
|
||||
# python module
|
||||
@ -77,10 +78,10 @@ def modules_from_path(path, loaded_modules):
|
||||
mod = _test_import(f, loaded_modules)
|
||||
else:
|
||||
mod = None
|
||||
|
||||
|
||||
if mod:
|
||||
modules.append(mod)
|
||||
|
||||
|
||||
return modules
|
||||
|
||||
_loaded = [] # store loaded modules for reloading.
|
||||
@ -90,7 +91,7 @@ _bpy_types = __import__("bpy_types") # keep for comparisons, never ever reload t
|
||||
def load_scripts(reload_scripts=False, refresh_scripts=False):
|
||||
"""
|
||||
Load scripts and run each modules register function.
|
||||
|
||||
|
||||
:arg reload_scripts: Causes all scripts to have their unregister method called before loading.
|
||||
:type reload_scripts: bool
|
||||
:arg refresh_scripts: only load scripts which are not already loaded as modules.
|
||||
@ -102,7 +103,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
|
||||
t_main = time.time()
|
||||
|
||||
loaded_modules = set()
|
||||
|
||||
|
||||
if refresh_scripts:
|
||||
original_modules = _sys.modules.values()
|
||||
|
||||
@ -121,7 +122,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
|
||||
return reload(mod)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
def test_register(mod):
|
||||
|
||||
if refresh_scripts and mod in original_modules:
|
||||
@ -141,7 +142,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
|
||||
else:
|
||||
print("\nWarning! '%s' has no register function, this is now a requirement for registerable scripts." % mod.__file__)
|
||||
_loaded.append(mod)
|
||||
|
||||
|
||||
if reload_scripts:
|
||||
# reload modules that may not be directly included
|
||||
for type_class_name in dir(_bpy.types):
|
||||
@ -155,7 +156,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
|
||||
for module_name in sorted(loaded_modules):
|
||||
print("Reloading:", module_name)
|
||||
test_reload(_sys.modules[module_name])
|
||||
|
||||
|
||||
# loop over and unload all scripts
|
||||
_loaded.reverse()
|
||||
for mod in _loaded:
|
||||
@ -167,7 +168,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
|
||||
traceback.print_exc()
|
||||
_loaded[:] = []
|
||||
|
||||
for base_path in script_paths(user = False):
|
||||
for base_path in script_paths(user=False):
|
||||
for path_subdir in ("ui", "op", "io", "cfg"):
|
||||
path = _os.path.join(base_path, path_subdir)
|
||||
if _os.path.isdir(path):
|
||||
@ -182,20 +183,20 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
|
||||
path = _os.path.join(user_path, path_subdir)
|
||||
if _os.path.isdir(path):
|
||||
sys_path_ensure(path)
|
||||
|
||||
|
||||
for mod in modules_from_path(path, loaded_modules):
|
||||
test_register(mod)
|
||||
|
||||
# load extensions
|
||||
used_ext = {ext.module for ext in _bpy.context.user_preferences.extensions}
|
||||
used_ext = {ext.module for ext in _bpy.context.user_preferences.extensions}
|
||||
paths = script_paths("extensions")
|
||||
for path in paths:
|
||||
sys_path_ensure(path)
|
||||
|
||||
|
||||
for module_name in sorted(used_ext):
|
||||
mod = _test_import(module_name, loaded_modules)
|
||||
test_register(mod)
|
||||
|
||||
|
||||
if reload_scripts:
|
||||
import gc
|
||||
print("gc.collect() -> %d" % gc.collect())
|
||||
@ -262,16 +263,18 @@ def display_name(name):
|
||||
_scripts = _os.path.join(_os.path.dirname(__file__), _os.path.pardir, _os.path.pardir)
|
||||
_scripts = (_os.path.normpath(_scripts), )
|
||||
|
||||
|
||||
def user_script_path():
|
||||
path = _bpy.context.user_preferences.filepaths.python_scripts_directory
|
||||
|
||||
|
||||
if path:
|
||||
path = _os.path.normpath(path)
|
||||
return path
|
||||
else:
|
||||
return None
|
||||
|
||||
def script_paths(subdir = None, user = True):
|
||||
|
||||
def script_paths(subdir=None, user=True):
|
||||
"""
|
||||
Returns a list of valid script paths from the home directory and user preferences.
|
||||
|
||||
@ -284,7 +287,7 @@ def script_paths(subdir = None, user = True):
|
||||
user_script_path = _bpy.context.user_preferences.filepaths.python_scripts_directory
|
||||
else:
|
||||
user_script_path = None
|
||||
|
||||
|
||||
for path in home_paths("scripts") + (user_script_path, ):
|
||||
if path:
|
||||
path = _os.path.normpath(path)
|
||||
|
@ -129,7 +129,7 @@ def ik(obj, bone_definition, base_names, options):
|
||||
|
||||
# keep the foot_ik as the parent
|
||||
ik_chain.toe_e.connected = False
|
||||
|
||||
|
||||
# Foot uses pose space, not local space, for translation
|
||||
ik_chain.foot_e.local_location = False
|
||||
|
||||
|
@ -197,23 +197,23 @@ def deform(obj, definitions, base_names, options):
|
||||
con = pb[lip4].constraints.new('COPY_TRANSFORMS')
|
||||
con.target = obj
|
||||
con.subtarget = definitions[5]
|
||||
|
||||
|
||||
con = pb[lip5].constraints.new('COPY_TRANSFORMS')
|
||||
con.target = obj
|
||||
con.subtarget = definitions[6]
|
||||
|
||||
|
||||
con = pb[lip6].constraints.new('COPY_TRANSFORMS')
|
||||
con.target = obj
|
||||
con.subtarget = definitions[7]
|
||||
|
||||
|
||||
con = pb[lip7].constraints.new('COPY_TRANSFORMS')
|
||||
con.target = obj
|
||||
con.subtarget = definitions[8]
|
||||
|
||||
|
||||
con = pb[lip8].constraints.new('COPY_TRANSFORMS')
|
||||
con.target = obj
|
||||
con.subtarget = definitions[9]
|
||||
|
||||
|
||||
# Constraint mouth corner spread bones
|
||||
con = pb[spread_l_1].constraints.new('DAMPED_TRACK')
|
||||
con.target = obj
|
||||
@ -234,12 +234,12 @@ def deform(obj, definitions, base_names, options):
|
||||
con = pb[spread_r_2].constraints.new('COPY_TRANSFORMS')
|
||||
con.target = obj
|
||||
con.subtarget = spread_r_1
|
||||
|
||||
|
||||
con = pb[spread_r_2].constraints.new('DAMPED_TRACK')
|
||||
con.target = obj
|
||||
con.subtarget = lip8
|
||||
|
||||
|
||||
|
||||
# Corrective shape keys for the corners of the mouth.
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
|
||||
|
@ -92,7 +92,7 @@ def main(obj, definitions, base_names, options):
|
||||
properties of a single bone.
|
||||
A different shape can be driven by the negative value of a transform as
|
||||
well by giving a comma-separated list of two shapes.
|
||||
|
||||
|
||||
Required options:
|
||||
mesh: name of mesh object(s) to add/get shapekeys to/from
|
||||
(if multiple objects, make a comma-separated list)
|
||||
@ -105,15 +105,15 @@ def main(obj, definitions, base_names, options):
|
||||
scale_<x/y/z>_fac: default multiplier of the bone influence on the shape key
|
||||
shape_key_sliders: comma-separated list of custom properties to create sliders out of for driving shape keys
|
||||
<custom_prop>: for each property listed in shape_key_sliders, specify a shape key for it to drive
|
||||
|
||||
|
||||
"""
|
||||
|
||||
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
eb = obj.data.edit_bones
|
||||
pb = obj.pose.bones
|
||||
|
||||
org_bone = definitions[0]
|
||||
|
||||
|
||||
# Options
|
||||
req_options = ["mesh"]
|
||||
for option in req_options:
|
||||
@ -121,11 +121,11 @@ def main(obj, definitions, base_names, options):
|
||||
raise RigifyError("'%s' rig type requires a '%s' option (bone: %s)" % (RIG_TYPE, option, base_names[definitions[0]]))
|
||||
|
||||
meshes = options["mesh"].replace(" ", "").split(",")
|
||||
|
||||
|
||||
bone = copy_bone_simple(obj.data, org_bone, base_names[org_bone], parent=True).name
|
||||
|
||||
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
|
||||
|
||||
# Set rotation mode and axis locks
|
||||
pb[bone].rotation_mode = pb[org_bone].rotation_mode
|
||||
pb[bone].lock_location = tuple(pb[org_bone].lock_location)
|
||||
@ -133,7 +133,7 @@ def main(obj, definitions, base_names, options):
|
||||
pb[bone].lock_rotation_w = pb[org_bone].lock_rotation_w
|
||||
pb[bone].lock_rotations_4d = pb[org_bone].lock_rotations_4d
|
||||
pb[bone].lock_scale = tuple(pb[org_bone].lock_scale)
|
||||
|
||||
|
||||
# List of rig options for specifying shape keys
|
||||
# Append '_fac' to the end for the name of the corresponding 'factor
|
||||
# default' option for that shape
|
||||
@ -146,7 +146,7 @@ def main(obj, definitions, base_names, options):
|
||||
"scale_x",
|
||||
"scale_y",
|
||||
"scale_z"]
|
||||
|
||||
|
||||
driver_paths = {"loc_x":".location[0]",
|
||||
"loc_y":".location[1]",
|
||||
"loc_z":".location[2]",
|
||||
@ -159,13 +159,13 @@ def main(obj, definitions, base_names, options):
|
||||
"scale_x":".scale[0]",
|
||||
"scale_y":".scale[1]",
|
||||
"scale_z":".scale[2]"}
|
||||
|
||||
|
||||
# Create the shape keys and drivers for transforms
|
||||
shape_info = []
|
||||
for option in shape_key_options:
|
||||
if option in options:
|
||||
shape_names = options[option].replace(" ", "").split(",")
|
||||
|
||||
|
||||
var_name = bone.replace(".","").replace("-","_") + "_" + option
|
||||
# Different RNA paths for euler vs quat
|
||||
if option in (shape_key_options[3:6]+shape_key_options[12:15]) \
|
||||
@ -173,12 +173,12 @@ def main(obj, definitions, base_names, options):
|
||||
var_path = driver_paths['q' + option]
|
||||
else:
|
||||
var_path = driver_paths[option]
|
||||
|
||||
|
||||
if (option+"_fac") in options:
|
||||
fac = options[option+"_fac"]
|
||||
else:
|
||||
fac = 1.0
|
||||
|
||||
|
||||
# Positive
|
||||
if shape_names[0] != "":
|
||||
# Different expressions for loc/rot/scale and positive/negative
|
||||
@ -197,7 +197,7 @@ def main(obj, definitions, base_names, options):
|
||||
expression = "(1.0 - " + var_name + ") * " + str(fac) + " * -2"
|
||||
shape_name = shape_names[0]
|
||||
create_shape_and_driver(obj, bone, meshes, shape_name, var_name, var_path, expression)
|
||||
|
||||
|
||||
# Negative
|
||||
if shape_names[0] != "" and len(shape_names) > 1:
|
||||
# Different expressions for loc/rot/scale and positive/negative
|
||||
@ -216,7 +216,7 @@ def main(obj, definitions, base_names, options):
|
||||
expression = "(1.0 - " + var_name + ") * " + str(fac) + " * 2"
|
||||
shape_name = shape_names[1]
|
||||
create_shape_and_driver(obj, bone, meshes, shape_name, var_name, var_path, expression)
|
||||
|
||||
|
||||
# Create the shape keys and drivers for custom-property sliders
|
||||
if "shape_key_sliders" in options:
|
||||
# Get the slider names
|
||||
@ -227,7 +227,7 @@ def main(obj, definitions, base_names, options):
|
||||
for slider_name in slider_names:
|
||||
if slider_name in options:
|
||||
shape_names = options[slider_name].replace(" ", "").split(",")
|
||||
|
||||
|
||||
# Set up the custom property on the bone
|
||||
prop = rna_idprop_ui_prop_get(pb[bone], slider_name, create=True)
|
||||
pb[bone][slider_name] = 0.0
|
||||
@ -238,7 +238,7 @@ def main(obj, definitions, base_names, options):
|
||||
if len(shape_names) > 1:
|
||||
prop["min"] = -1.0
|
||||
prop["soft_min"] = -1.0
|
||||
|
||||
|
||||
# Add the shape drivers
|
||||
# Positive
|
||||
if shape_names[0] != "":
|
||||
@ -266,19 +266,19 @@ def main(obj, definitions, base_names, options):
|
||||
expression = var_name + " * " + str(fac) + " * -1"
|
||||
# Create the shape key driver
|
||||
create_shape_and_driver(obj, bone, meshes, shape_name, var_name, var_path, expression)
|
||||
|
||||
|
||||
|
||||
|
||||
# Org bone copy transforms of control bone
|
||||
con = pb[org_bone].constraints.new('COPY_TRANSFORMS')
|
||||
con.target = obj
|
||||
con.subtarget = bone
|
||||
|
||||
|
||||
return (None,)
|
||||
|
||||
|
||||
def create_shape_and_driver(obj, bone, meshes, shape_name, var_name, var_path, expression):
|
||||
""" Creates/gets a shape key and sets up a driver for it.
|
||||
|
||||
|
||||
obj = armature object
|
||||
bone = driving bone name
|
||||
meshes = list of meshes to create the shapekey/driver on
|
||||
@ -289,16 +289,16 @@ def create_shape_and_driver(obj, bone, meshes, shape_name, var_name, var_path, e
|
||||
"""
|
||||
pb = obj.pose.bones
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
|
||||
|
||||
for mesh_name in meshes:
|
||||
mesh_obj = bpy.data.objects[mesh_name]
|
||||
|
||||
|
||||
# Add/get the shape key
|
||||
shape = addget_shape_key(mesh_obj, name=shape_name)
|
||||
|
||||
|
||||
# Add/get the shape key driver
|
||||
fcurve, a = addget_shape_key_driver(mesh_obj, name=shape_name)
|
||||
|
||||
|
||||
# Set up the driver
|
||||
driver = fcurve.driver
|
||||
driver.type = 'SCRIPTED'
|
||||
@ -316,5 +316,5 @@ def create_shape_and_driver(obj, bone, meshes, shape_name, var_name, var_path, e
|
||||
var.targets[0].id_type = 'OBJECT'
|
||||
var.targets[0].id = obj
|
||||
var.targets[0].data_path = 'pose.bones["' + bone + '"]' + var_path
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@ def metarig_template():
|
||||
#bone.tail[:] = 0.0000, -0.0306, -0.0159
|
||||
#bone.roll = 0.0000
|
||||
#bone.connected = False
|
||||
|
||||
|
||||
#bpy.ops.object.mode_set(mode='OBJECT')
|
||||
#pbone = obj.pose.bones['tail.01']
|
||||
#pbone['type'] = 'tail_spline_ik'
|
||||
@ -72,13 +72,13 @@ def main(obj, bone_definitions, base_names, options):
|
||||
bb = obj.data.bones
|
||||
eb = obj.data.edit_bones
|
||||
pb = obj.pose.bones
|
||||
|
||||
|
||||
# Create bones for hinge/free
|
||||
# hinge 1 sticks with the parent
|
||||
# hinge 2 is the parent of the tail controls
|
||||
hinge1 = copy_bone_simple(arm, bone_definitions[0], "MCH-%s.hinge1" % base_names[bone_definitions[0]], parent=True).name
|
||||
hinge2 = copy_bone_simple(arm, bone_definitions[0], "MCH-%s.hinge2" % base_names[bone_definitions[0]], parent=False).name
|
||||
|
||||
|
||||
# Create tail control bones
|
||||
bones = []
|
||||
i = 0
|
||||
@ -90,10 +90,10 @@ def main(obj, bone_definitions, base_names, options):
|
||||
eb[bone].local_location = False
|
||||
i = 1
|
||||
bones += [bone]
|
||||
|
||||
|
||||
|
||||
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
|
||||
|
||||
# Rotation mode and axis locks
|
||||
for bone, org_bone in zip(bones, bone_definitions):
|
||||
pb[bone].rotation_mode = pb[org_bone].rotation_mode
|
||||
@ -102,7 +102,7 @@ def main(obj, bone_definitions, base_names, options):
|
||||
pb[bone].lock_rotation = tuple(pb[org_bone].lock_rotation)
|
||||
pb[bone].lock_rotation_w = pb[org_bone].lock_rotation_w
|
||||
pb[bone].lock_scale = tuple(pb[org_bone].lock_scale)
|
||||
|
||||
|
||||
# Add custom properties
|
||||
pb[bones[0]]["hinge"] = 0.0
|
||||
prop = rna_idprop_ui_prop_get(pb[bones[0]], "hinge", create=True)
|
||||
@ -110,31 +110,31 @@ def main(obj, bone_definitions, base_names, options):
|
||||
prop["max"] = 1.0
|
||||
prop["soft_min"] = 0.0
|
||||
prop["soft_max"] = 1.0
|
||||
|
||||
|
||||
pb[bones[0]]["free"] = 0.0
|
||||
prop = rna_idprop_ui_prop_get(pb[bones[0]], "free", create=True)
|
||||
prop["min"] = 0.0
|
||||
prop["max"] = 1.0
|
||||
prop["soft_min"] = 0.0
|
||||
prop["soft_max"] = 1.0
|
||||
|
||||
|
||||
# Add constraints
|
||||
for bone, org_bone in zip(bones, bone_definitions):
|
||||
con = pb[org_bone].constraints.new('COPY_TRANSFORMS')
|
||||
con.target = obj
|
||||
con.subtarget = bone
|
||||
|
||||
|
||||
con_f = pb[hinge2].constraints.new('COPY_LOCATION')
|
||||
con_f.target = obj
|
||||
con_f.subtarget = hinge1
|
||||
|
||||
|
||||
con_h = pb[hinge2].constraints.new('COPY_TRANSFORMS')
|
||||
con_h.target = obj
|
||||
con_h.subtarget = hinge1
|
||||
|
||||
|
||||
# Add drivers
|
||||
bone_path = pb[bones[0]].path_to_id()
|
||||
|
||||
|
||||
driver_fcurve = con_f.driver_add("influence", 0)
|
||||
driver = driver_fcurve.driver
|
||||
driver.type = 'AVERAGE'
|
||||
@ -147,7 +147,7 @@ def main(obj, bone_definitions, base_names, options):
|
||||
mod.poly_order = 1
|
||||
mod.coefficients[0] = 1.0
|
||||
mod.coefficients[1] = -1.0
|
||||
|
||||
|
||||
driver_fcurve = con_h.driver_add("influence", 0)
|
||||
driver = driver_fcurve.driver
|
||||
driver.type = 'AVERAGE'
|
||||
@ -160,7 +160,7 @@ def main(obj, bone_definitions, base_names, options):
|
||||
mod.poly_order = 1
|
||||
mod.coefficients[0] = 1.0
|
||||
mod.coefficients[1] = -1.0
|
||||
|
||||
|
||||
|
||||
|
||||
return None
|
||||
|
||||
|
||||
|
@ -165,10 +165,10 @@ def register():
|
||||
bpy.types.register(AddTorus)
|
||||
bpy.types.INFO_MT_mesh_add.append(menu_func)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.types.unregister(AddTorus)
|
||||
bpy.types.INFO_MT_mesh_add.remove(menu_func)
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -166,7 +166,7 @@ def autocomplete(context):
|
||||
|
||||
# Separate automplete output by command prompts
|
||||
if scrollback != '':
|
||||
bpy.ops.console.scrollback_append(text=sc.prompt + current_line.line, type='INPUT')
|
||||
bpy.ops.console.scrollback_append(text=sc.prompt + current_line.line, type='INPUT')
|
||||
|
||||
# Now we need to copy back the line from blender back into the
|
||||
# text editor. This will change when we dont use the text editor
|
||||
@ -201,12 +201,14 @@ def banner(context):
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
def register():
|
||||
pass
|
||||
|
||||
|
||||
def unregister():
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -81,9 +81,9 @@ def banner(context):
|
||||
def register():
|
||||
pass
|
||||
|
||||
|
||||
def unregister():
|
||||
pass
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -5,19 +5,19 @@ from Mathutils import *
|
||||
def main(context):
|
||||
def cleanupEulCurve(fcv):
|
||||
keys = []
|
||||
|
||||
|
||||
for k in fcv.keyframe_points:
|
||||
keys.append([k.handle1.copy(), k.co.copy(), k.handle2.copy()])
|
||||
keys.append([k.handle1.copy(), k.co.copy(), k.handle2.copy()])
|
||||
print(keys)
|
||||
|
||||
|
||||
for i in range(len(keys)):
|
||||
cur = keys[i]
|
||||
prev = keys[i-1] if i > 0 else None
|
||||
next = keys[i+1] if i < len(keys)-1 else None
|
||||
|
||||
|
||||
if prev == None:
|
||||
continue
|
||||
|
||||
|
||||
th = pi
|
||||
if abs(prev[1][1] - cur[1][1]) >= th: # more than 180 degree jump
|
||||
fac = pi*2
|
||||
@ -31,13 +31,13 @@ def main(context):
|
||||
cur[0][1] -= fac
|
||||
cur[1][1] -= fac
|
||||
cur[2][1] -= fac
|
||||
|
||||
|
||||
for i in range(len(keys)):
|
||||
for x in range(2):
|
||||
fcv.keyframe_points[i].handle1[x] = keys[i][0][x]
|
||||
fcv.keyframe_points[i].co[x] = keys[i][1][x]
|
||||
fcv.keyframe_points[i].handle2[x] = keys[i][2][x]
|
||||
|
||||
|
||||
flist = bpy.context.active_object.animation_data.action.fcurves
|
||||
for f in flist:
|
||||
if f.selected and f.data_path.endswith("rotation_euler"):
|
||||
|
@ -45,9 +45,9 @@ class SaveDirty(bpy.types.Operator):
|
||||
def register():
|
||||
bpy.types.register(SaveDirty)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.types.unregister(SaveDirty)
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -185,6 +185,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -192,4 +193,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -336,7 +336,7 @@ class ShapeTransfer(bpy.types.Operator):
|
||||
self.report({'ERROR'}, "Expected one other selected mesh object to copy from")
|
||||
return {'CANCELLED'}
|
||||
ob_act, objects = objects[0], [ob_act]
|
||||
|
||||
|
||||
if ob_act.type != 'MESH':
|
||||
self.report({'ERROR'}, "Other object is not a mesh.")
|
||||
return {'CANCELLED'}
|
||||
@ -344,7 +344,7 @@ class ShapeTransfer(bpy.types.Operator):
|
||||
if ob_act.active_shape_key is None:
|
||||
self.report({'ERROR'}, "Other object has no shape key")
|
||||
return {'CANCELLED'}
|
||||
return self._main(ob_act, objects, self.properties.mode, self.properties.use_clamp)
|
||||
return self._main(ob_act, objects, self.properties.mode, self.properties.use_clamp)
|
||||
|
||||
class JoinUVs(bpy.types.Operator):
|
||||
'''Copy UV Layout to objects with matching geometry'''
|
||||
@ -424,7 +424,7 @@ class MakeDupliFace(bpy.types.Operator):
|
||||
# scale = matrix.median_scale
|
||||
trans = matrix.translation_part()
|
||||
rot = matrix.rotation_part() # also contains scale
|
||||
|
||||
|
||||
return [(rot * b) + trans for b in base_tri]
|
||||
scene = bpy.context.scene
|
||||
linked = {}
|
||||
@ -444,20 +444,20 @@ class MakeDupliFace(bpy.types.Operator):
|
||||
mesh.faces.foreach_set("verts_raw", faces)
|
||||
mesh.update() # generates edge data
|
||||
|
||||
# pick an object to use
|
||||
# pick an object to use
|
||||
obj = objects[0]
|
||||
|
||||
ob_new = bpy.data.objects.new(mesh.name, mesh)
|
||||
base = scene.objects.link(ob_new)
|
||||
base.layers[:] = obj.layers
|
||||
|
||||
|
||||
ob_inst = bpy.data.objects.new(data.name, data)
|
||||
base = scene.objects.link(ob_inst)
|
||||
base.layers[:] = obj.layers
|
||||
|
||||
|
||||
for obj in objects:
|
||||
scene.objects.unlink(obj)
|
||||
|
||||
|
||||
ob_new.dupli_type = 'FACES'
|
||||
ob_inst.parent = ob_new
|
||||
ob_new.use_dupli_faces_scale = True
|
||||
|
@ -28,42 +28,42 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to):
|
||||
|
||||
Left_Up_Front_SEL = [[],[],[]]
|
||||
Right_Down_Back_SEL = [[],[],[]]
|
||||
|
||||
|
||||
flag_first = True
|
||||
|
||||
|
||||
for obj in bpy.context.selected_objects:
|
||||
if obj.type == 'MESH':
|
||||
|
||||
|
||||
bb_world = [obj.matrix * Vector(v[:]) for v in obj.bound_box]
|
||||
|
||||
|
||||
Left_Up_Front = bb_world[1]
|
||||
Right_Down_Back = bb_world[7]
|
||||
|
||||
|
||||
# Active Center
|
||||
|
||||
|
||||
if obj == bpy.context.active_object:
|
||||
|
||||
|
||||
center_active_x = ( Left_Up_Front[0] + Right_Down_Back[0] ) / 2
|
||||
center_active_y = ( Left_Up_Front[1] + Right_Down_Back[1] ) / 2
|
||||
center_active_z = ( Left_Up_Front[2] + Right_Down_Back[2] ) / 2
|
||||
|
||||
|
||||
size_active_x = ( Right_Down_Back[0] - Left_Up_Front[0] ) / 2
|
||||
size_active_y = ( Right_Down_Back[1] - Left_Up_Front[1] ) / 2
|
||||
size_active_z = ( Left_Up_Front[2] - Right_Down_Back[2] ) / 2
|
||||
|
||||
|
||||
# Selection Center
|
||||
|
||||
|
||||
if flag_first:
|
||||
flag_first = False
|
||||
|
||||
|
||||
Left_Up_Front_SEL[0] = Left_Up_Front[0]
|
||||
Left_Up_Front_SEL[1] = Left_Up_Front[1]
|
||||
Left_Up_Front_SEL[2] = Left_Up_Front[2]
|
||||
|
||||
|
||||
Right_Down_Back_SEL[0] = Right_Down_Back[0]
|
||||
Right_Down_Back_SEL[1] = Right_Down_Back[1]
|
||||
Right_Down_Back_SEL[2] = Right_Down_Back[2]
|
||||
|
||||
|
||||
else:
|
||||
# X axis
|
||||
if Left_Up_Front[0] < Left_Up_Front_SEL[0]:
|
||||
@ -74,7 +74,7 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to):
|
||||
# Z axis
|
||||
if Left_Up_Front[2] > Left_Up_Front_SEL[2]:
|
||||
Left_Up_Front_SEL[2] = Left_Up_Front[2]
|
||||
|
||||
|
||||
# X axis
|
||||
if Right_Down_Back[0] > Right_Down_Back_SEL[0]:
|
||||
Right_Down_Back_SEL[0] = Right_Down_Back[0]
|
||||
@ -84,7 +84,7 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to):
|
||||
# Z axis
|
||||
if Right_Down_Back[2] < Right_Down_Back_SEL[2]:
|
||||
Right_Down_Back_SEL[2] = Right_Down_Back[2]
|
||||
|
||||
|
||||
center_sel_x = ( Left_Up_Front_SEL[0] + Right_Down_Back_SEL[0] ) / 2
|
||||
center_sel_y = ( Left_Up_Front_SEL[1] + Right_Down_Back_SEL[1] ) / 2
|
||||
center_sel_z = ( Left_Up_Front_SEL[2] + Right_Down_Back_SEL[2] ) / 2
|
||||
@ -93,143 +93,144 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to):
|
||||
|
||||
for obj in bpy.context.selected_objects:
|
||||
if obj.type == 'MESH':
|
||||
|
||||
|
||||
loc_world = obj.location
|
||||
bb_world = [obj.matrix * Vector(v[:]) for v in obj.bound_box]
|
||||
|
||||
|
||||
Left_Up_Front = bb_world[1]
|
||||
Right_Down_Back = bb_world[7]
|
||||
|
||||
|
||||
center_x = ( Left_Up_Front[0] + Right_Down_Back[0] ) / 2
|
||||
center_y = ( Left_Up_Front[1] + Right_Down_Back[1] ) / 2
|
||||
center_z = ( Left_Up_Front[2] + Right_Down_Back[2] ) / 2
|
||||
|
||||
|
||||
positive_x = Right_Down_Back[0]
|
||||
positive_y = Right_Down_Back[1]
|
||||
positive_z = Left_Up_Front[2]
|
||||
|
||||
|
||||
negative_x = Left_Up_Front[0]
|
||||
negative_y = Left_Up_Front[1]
|
||||
negative_z = Right_Down_Back[2]
|
||||
|
||||
|
||||
obj_loc = obj.location
|
||||
|
||||
|
||||
if align_x:
|
||||
|
||||
|
||||
# Align Mode
|
||||
|
||||
|
||||
if relative_to == 'OPT_4': # Active relative
|
||||
if align_mode == 'OPT_1':
|
||||
obj_x = obj_loc[0] - negative_x - size_active_x
|
||||
|
||||
|
||||
elif align_mode == 'OPT_3':
|
||||
obj_x = obj_loc[0] - positive_x + size_active_x
|
||||
|
||||
|
||||
else: # Everything else relative
|
||||
if align_mode == 'OPT_1':
|
||||
obj_x = obj_loc[0] - negative_x
|
||||
|
||||
|
||||
elif align_mode == 'OPT_3':
|
||||
obj_x = obj_loc[0] - positive_x
|
||||
|
||||
|
||||
if align_mode == 'OPT_2': # All relative
|
||||
obj_x = obj_loc[0] - center_x
|
||||
|
||||
|
||||
# Relative To
|
||||
|
||||
|
||||
if relative_to == 'OPT_1':
|
||||
loc_x = obj_x
|
||||
|
||||
|
||||
elif relative_to == 'OPT_2':
|
||||
loc_x = obj_x + cursor[0]
|
||||
|
||||
|
||||
elif relative_to == 'OPT_3':
|
||||
loc_x = obj_x + center_sel_x
|
||||
|
||||
|
||||
elif relative_to == 'OPT_4':
|
||||
loc_x = obj_x + center_active_x
|
||||
|
||||
|
||||
obj.location[0] = loc_x
|
||||
|
||||
|
||||
|
||||
|
||||
if align_y:
|
||||
|
||||
|
||||
# Align Mode
|
||||
|
||||
|
||||
if relative_to == 'OPT_4': # Active relative
|
||||
if align_mode == 'OPT_1':
|
||||
obj_y = obj_loc[1] - negative_y - size_active_y
|
||||
|
||||
|
||||
elif align_mode == 'OPT_3':
|
||||
obj_y = obj_loc[1] - positive_y + size_active_y
|
||||
|
||||
|
||||
else: # Everything else relative
|
||||
if align_mode == 'OPT_1':
|
||||
obj_y = obj_loc[1] - negative_y
|
||||
|
||||
|
||||
elif align_mode == 'OPT_3':
|
||||
obj_y = obj_loc[1] - positive_y
|
||||
|
||||
|
||||
if align_mode == 'OPT_2': # All relative
|
||||
obj_y = obj_loc[1] - center_y
|
||||
|
||||
|
||||
# Relative To
|
||||
|
||||
|
||||
if relative_to == 'OPT_1':
|
||||
loc_y = obj_y
|
||||
|
||||
|
||||
elif relative_to == 'OPT_2':
|
||||
loc_y = obj_y + cursor[1]
|
||||
|
||||
|
||||
elif relative_to == 'OPT_3':
|
||||
loc_y = obj_y + center_sel_y
|
||||
|
||||
|
||||
elif relative_to == 'OPT_4':
|
||||
loc_y = obj_y + center_active_y
|
||||
|
||||
|
||||
obj.location[1] = loc_y
|
||||
|
||||
|
||||
|
||||
|
||||
if align_z:
|
||||
|
||||
|
||||
# Align Mode
|
||||
|
||||
|
||||
if relative_to == 'OPT_4': # Active relative
|
||||
if align_mode == 'OPT_1':
|
||||
obj_z = obj_loc[2] - negative_z - size_active_z
|
||||
|
||||
|
||||
elif align_mode == 'OPT_3':
|
||||
obj_z = obj_loc[2] - positive_z + size_active_z
|
||||
|
||||
|
||||
else: # Everything else relative
|
||||
if align_mode == 'OPT_1':
|
||||
obj_z = obj_loc[2] - negative_z
|
||||
|
||||
|
||||
elif align_mode == 'OPT_3':
|
||||
obj_z = obj_loc[2] - positive_z
|
||||
|
||||
|
||||
if align_mode == 'OPT_2': # All relative
|
||||
obj_z = obj_loc[2] - center_z
|
||||
|
||||
|
||||
# Relative To
|
||||
|
||||
|
||||
if relative_to == 'OPT_1':
|
||||
loc_z = obj_z
|
||||
|
||||
|
||||
elif relative_to == 'OPT_2':
|
||||
loc_z = obj_z + cursor[2]
|
||||
|
||||
|
||||
elif relative_to == 'OPT_3':
|
||||
loc_z = obj_z + center_sel_z
|
||||
|
||||
|
||||
elif relative_to == 'OPT_4':
|
||||
loc_z = obj_z + center_active_z
|
||||
|
||||
|
||||
obj.location[2] = loc_z
|
||||
|
||||
|
||||
from bpy.props import *
|
||||
|
||||
|
||||
class AlignObjects(bpy.types.Operator):
|
||||
'''Align Objects'''
|
||||
bl_idname = "object.align"
|
||||
@ -269,7 +270,7 @@ class AlignObjects(bpy.types.Operator):
|
||||
return context.mode == 'OBJECT'
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
|
||||
align_mode = self.properties.align_mode
|
||||
relative_to = self.properties.relative_to
|
||||
align_x = self.properties.align_x
|
||||
@ -291,6 +292,7 @@ def register():
|
||||
bpy.types.register(AlignObjects)
|
||||
bpy.types.VIEW3D_MT_transform.append(menu_func)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.types.unregister(AlignObjects)
|
||||
bpy.types.VIEW3D_MT_transform.remove(menu_func)
|
||||
|
@ -144,10 +144,10 @@ def register():
|
||||
bpy.types.register(RandomizeLocRotSize)
|
||||
bpy.types.VIEW3D_MT_transform.append(menu_func)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.types.unregister(RandomizeLocRotSize)
|
||||
bpy.types.VIEW3D_MT_transform.remove(menu_func)
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -170,6 +170,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -177,4 +178,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -112,12 +112,13 @@ class PlayRenderedAnim(bpy.types.Operator):
|
||||
pass
|
||||
#raise OSError("Couldn't find an external animation player.")
|
||||
|
||||
return('FINISHED',)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
def register():
|
||||
bpy.types.register(PlayRenderedAnim)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.types.unregister(PlayRenderedAnim)
|
||||
|
||||
|
@ -39,7 +39,7 @@ class ExportUVLayout(bpy.types.Operator):
|
||||
name="Format",
|
||||
description="File format to export the UV layout to",
|
||||
default='SVG')
|
||||
|
||||
|
||||
def poll(self, context):
|
||||
obj = context.active_object
|
||||
return (obj and obj.type == 'MESH')
|
||||
@ -71,18 +71,18 @@ class ExportUVLayout(bpy.types.Operator):
|
||||
mesh = obj.data
|
||||
uv_layer = mesh.active_uv_texture.data
|
||||
uv_layer_len = len(uv_layer)
|
||||
|
||||
|
||||
if not self.properties.export_all:
|
||||
|
||||
|
||||
local_image = Ellipsis
|
||||
|
||||
if context.tool_settings.uv_local_view:
|
||||
space_data = self._space_image(context)
|
||||
if space_data:
|
||||
local_image = space_data.image
|
||||
|
||||
|
||||
faces = mesh.faces
|
||||
|
||||
|
||||
for i in range(uv_layer_len):
|
||||
uv_elem = uv_layer[i]
|
||||
# context checks
|
||||
@ -90,16 +90,13 @@ class ExportUVLayout(bpy.types.Operator):
|
||||
#~ uv = uv_elem.uv
|
||||
#~ if False not in uv_elem.uv_selected[:len(uv)]:
|
||||
#~ yield (i, uv)
|
||||
|
||||
|
||||
# just write what we see.
|
||||
yield (i, uv_layer[i].uv)
|
||||
else:
|
||||
# all, simple
|
||||
for i in range(uv_layer_len):
|
||||
yield (i, uv_layer[i].uv)
|
||||
|
||||
|
||||
|
||||
|
||||
def execute(self, context):
|
||||
# for making an XML compatible string
|
||||
@ -116,7 +113,7 @@ class ExportUVLayout(bpy.types.Operator):
|
||||
faces = mesh.faces
|
||||
|
||||
mode = self.properties.mode
|
||||
|
||||
|
||||
file = open(self.properties.path, "w")
|
||||
fw = file.write
|
||||
|
||||
@ -129,13 +126,13 @@ class ExportUVLayout(bpy.types.Operator):
|
||||
fw(' xmlns="http://www.w3.org/2000/svg" version="1.1">\n')
|
||||
desc = "%s, %s, %s (Blender %s)" % (basename(bpy.data.filename), obj.name, mesh.name, bpy.app.version_string)
|
||||
fw('<desc>%s</desc>\n' % escape(desc))
|
||||
|
||||
|
||||
# svg colors
|
||||
fill_settings = []
|
||||
fill_default = 'fill="grey"'
|
||||
for mat in mesh.materials if mesh.materials else [None]:
|
||||
if mat:
|
||||
fill_settings.append('fill="rgb(%d, %d, %d)"' % tuple(int(c*255) for c in mat.diffuse_color))
|
||||
fill_settings.append('fill="rgb(%d, %d, %d)"' % tuple(int(c * 255) for c in mat.diffuse_color))
|
||||
else:
|
||||
fill_settings.append(fill_default)
|
||||
|
||||
@ -144,10 +141,10 @@ class ExportUVLayout(bpy.types.Operator):
|
||||
fill = fill_settings[faces[i].material_index]
|
||||
except IndexError:
|
||||
fill = fill_default
|
||||
|
||||
|
||||
fw('<polygon %s fill-opacity="0.5" stroke="black" stroke-width="1px" \n' % fill)
|
||||
fw(' points="')
|
||||
|
||||
|
||||
for j, uv in enumerate(uvs):
|
||||
x, y = uv[0], 1.0 - uv[1]
|
||||
fw('%.3f,%.3f ' % (x * image_width, y * image_height))
|
||||
@ -172,15 +169,15 @@ class ExportUVLayout(bpy.types.Operator):
|
||||
fw('1 setlinejoin\n')
|
||||
fw('1 setlinecap\n')
|
||||
fw('newpath\n')
|
||||
|
||||
|
||||
for i, uvs in self._face_uv_iter(context):
|
||||
for j, uv in enumerate(uvs):
|
||||
x, y = uv[0], uv[1]
|
||||
if j==0:
|
||||
if j == 0:
|
||||
fw('%.5f %.5f moveto\n' % (x * image_width, y * image_height))
|
||||
else:
|
||||
fw('%.5f %.5f lineto\n' % (x * image_width, y * image_height))
|
||||
|
||||
|
||||
fw('closepath\n')
|
||||
fw('stroke\n')
|
||||
fw('showpage\n')
|
||||
@ -206,10 +203,10 @@ def register():
|
||||
bpy.types.register(ExportUVLayout)
|
||||
bpy.types.IMAGE_MT_uvs.append(menu_func)
|
||||
|
||||
|
||||
def unreguster():
|
||||
bpy.types.unregister(ExportUVLayout)
|
||||
bpy.types.IMAGE_MT_uvs.remove(menu_func)
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -1143,11 +1143,11 @@ menu_func = (lambda self, context: self.layout.operator(SmartProject.bl_idname,
|
||||
def register():
|
||||
bpy.types.register(SmartProject)
|
||||
bpy.types.VIEW3D_MT_uv_map.append(menu_func)
|
||||
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.types.unregister(SmartProject)
|
||||
bpy.types.VIEW3D_MT_uv_map.remove(menu_func)
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -178,9 +178,9 @@ class VertexPaintDirt(bpy.types.Operator):
|
||||
def register():
|
||||
bpy.types.register(VertexPaintDirt)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.types.unregister(VertexPaintDirt)
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -297,12 +297,11 @@ doc_new = StringProperty(name="Edit Description",
|
||||
description="", maxlen=1024, default="")
|
||||
|
||||
|
||||
|
||||
class WM_OT_context_modal_mouse(bpy.types.Operator):
|
||||
'''Adjust arbitrary values with mouse input'''
|
||||
bl_idname = "wm.context_modal_mouse"
|
||||
bl_label = "Context Modal Mouse"
|
||||
|
||||
|
||||
path_iter = StringProperty(description="The path relative to the context, must point to an iterable.")
|
||||
path_item = StringProperty(description="The path from each iterable to the value (int or float)")
|
||||
input_scale = FloatProperty(default=0.01, description="Scale the mouse movement by this value before applying the delta")
|
||||
@ -323,7 +322,7 @@ class WM_OT_context_modal_mouse(bpy.types.Operator):
|
||||
value_orig = eval("item." + path_item)
|
||||
except:
|
||||
continue
|
||||
|
||||
|
||||
# check this can be set, maybe this is library data.
|
||||
try:
|
||||
exec("item.%s = %s" % (path_item, value_orig))
|
||||
@ -332,11 +331,10 @@ class WM_OT_context_modal_mouse(bpy.types.Operator):
|
||||
|
||||
values[item] = value_orig
|
||||
|
||||
|
||||
def _values_delta(self, delta):
|
||||
delta *= self.properties.input_scale
|
||||
if self.properties.invert:
|
||||
delta = -delta
|
||||
delta = - delta
|
||||
|
||||
path_item = self.properties.path_item
|
||||
for item, value_orig in self._values.items():
|
||||
@ -348,7 +346,7 @@ class WM_OT_context_modal_mouse(bpy.types.Operator):
|
||||
exec("item.%s = %s" % (path_item, value_orig))
|
||||
|
||||
self._values.clear()
|
||||
|
||||
|
||||
def _values_clear(self):
|
||||
self._values.clear()
|
||||
|
||||
@ -366,7 +364,7 @@ class WM_OT_context_modal_mouse(bpy.types.Operator):
|
||||
elif event_type in ('RIGHTMOUSE', 'ESCAPE'):
|
||||
self._values_restore()
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
@ -530,11 +528,13 @@ classes = [
|
||||
rna_prop_ui.WM_OT_properties_add,
|
||||
rna_prop_ui.WM_OT_properties_remove]
|
||||
|
||||
|
||||
def register():
|
||||
register = bpy.types.register
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -542,4 +542,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -4,7 +4,7 @@ class ModalOperator(bpy.types.Operator):
|
||||
'''Move an object with the mouse, example.'''
|
||||
bl_idname = "object.modal_operator"
|
||||
bl_label = "Simple Modal Operator"
|
||||
|
||||
|
||||
first_mouse_x = IntProperty()
|
||||
first_value = FloatProperty()
|
||||
|
||||
@ -19,7 +19,7 @@ class ModalOperator(bpy.types.Operator):
|
||||
elif event.type in ('RIGHTMOUSE', 'ESCAPE'):
|
||||
context.object.location.x = self.properties.first_value
|
||||
return {'CANCELLED'}
|
||||
|
||||
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
@ -36,4 +36,4 @@ class ModalOperator(bpy.types.Operator):
|
||||
bpy.types.register(ModalOperator)
|
||||
|
||||
if __name__ == "__main__":
|
||||
bpy.ops.object.modal_operator()
|
||||
bpy.ops.object.modal_operator()
|
||||
|
@ -164,11 +164,13 @@ classes = [
|
||||
# OBJECT_PT_onion_skinning
|
||||
# DATA_PT_onion_skinning
|
||||
|
||||
|
||||
def register():
|
||||
register = bpy.types.register
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -176,4 +178,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -263,11 +263,13 @@ classes = [
|
||||
|
||||
DATA_PT_custom_props_arm]
|
||||
|
||||
|
||||
def register():
|
||||
register = bpy.types.register
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -275,4 +277,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -351,6 +351,7 @@ classes = [
|
||||
menu_func = (lambda self, context: self.layout.menu("INFO_MT_armature_metarig_add", icon='OUTLINER_OB_ARMATURE'))
|
||||
import space_info # ensure the menu is loaded first
|
||||
|
||||
|
||||
def register():
|
||||
register = bpy.types.register
|
||||
for cls in classes:
|
||||
@ -358,13 +359,13 @@ def register():
|
||||
|
||||
space_info.INFO_MT_armature_add.append(menu_func)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
unregister(cls)
|
||||
|
||||
|
||||
bpy.types.INFO_MT_armature_add.remove(menu_func)
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -398,11 +398,13 @@ classes = [
|
||||
|
||||
BONE_PT_custom_props]
|
||||
|
||||
|
||||
def register():
|
||||
register = bpy.types.register
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -410,4 +412,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -163,6 +163,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -170,4 +171,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -401,6 +401,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -408,4 +409,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -51,11 +51,13 @@ class DATA_PT_empty(DataButtonsPanel):
|
||||
classes = [
|
||||
DATA_PT_empty]
|
||||
|
||||
|
||||
def register():
|
||||
register = bpy.types.register
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -63,4 +65,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -411,6 +411,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -418,4 +419,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -108,6 +108,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -115,4 +116,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -28,7 +28,7 @@ class MESH_MT_vertex_group_specials(bpy.types.Menu):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
|
||||
layout.operator("object.vertex_group_sort", icon='SORTALPHA')
|
||||
layout.operator("object.vertex_group_copy", icon='COPY_ID')
|
||||
layout.operator("object.vertex_group_copy_to_linked", icon='LINK_AREA')
|
||||
@ -227,7 +227,7 @@ class DATA_PT_shape_keys(DataButtonsPanel):
|
||||
subsub.prop(ob, "shape_key_lock", text="")
|
||||
subsub.prop(kb, "mute", text="")
|
||||
sub.prop(ob, "shape_key_edit_mode", text="")
|
||||
|
||||
|
||||
sub = row.row()
|
||||
sub.operator("object.shape_key_clear", icon='X', text="")
|
||||
|
||||
@ -325,6 +325,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -332,4 +333,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -149,6 +149,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -156,4 +157,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -739,6 +739,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -746,4 +747,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -533,6 +533,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -540,4 +541,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -336,6 +336,7 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel):
|
||||
sub.prop(mat, "shadow_ray_bias", text="Ray Bias")
|
||||
col.prop(mat, "cast_approximate")
|
||||
|
||||
|
||||
class MATERIAL_PT_diffuse(MaterialButtonsPanel):
|
||||
bl_label = "Diffuse"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
@ -947,6 +948,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -954,4 +956,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -323,6 +323,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -330,4 +331,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -466,7 +466,6 @@ class ConstraintButtonsPanel(bpy.types.Panel):
|
||||
|
||||
self.space_template(layout, con, wide_ui)
|
||||
|
||||
|
||||
#def SCRIPT(self, context, layout, con):
|
||||
|
||||
def ACTION(self, context, layout, con, wide_ui):
|
||||
@ -765,6 +764,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -772,4 +772,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -1023,6 +1023,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -1030,4 +1031,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -244,6 +244,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -251,4 +252,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -215,9 +215,9 @@ def basic_force_field_falloff_ui(self, context, field):
|
||||
def register():
|
||||
pass
|
||||
|
||||
|
||||
def unregister():
|
||||
pass
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -253,6 +253,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -260,4 +261,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -304,6 +304,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -311,4 +312,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -253,6 +253,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -260,4 +261,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -296,6 +296,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -303,4 +304,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -222,7 +222,7 @@ class RENDER_PT_performance(RenderButtonsPanel):
|
||||
col = split.column()
|
||||
col.label(text="Memory:")
|
||||
sub = col.column()
|
||||
sub.enabled = not (rd.use_border or rd.full_sample)
|
||||
sub.enabled = not (rd.use_border or rd.full_sample)
|
||||
sub.prop(rd, "save_buffers")
|
||||
sub = col.column()
|
||||
sub.active = rd.use_compositing
|
||||
@ -419,7 +419,7 @@ class RENDER_PT_encoding(RenderButtonsPanel):
|
||||
sub = layout.column()
|
||||
|
||||
if rd.ffmpeg_format not in ('MP3'):
|
||||
sub.prop(rd, "ffmpeg_audio_codec", text="Audio Codec")
|
||||
sub.prop(rd, "ffmpeg_audio_codec", text="Audio Codec")
|
||||
|
||||
sub.separator()
|
||||
|
||||
@ -454,7 +454,7 @@ class RENDER_PT_antialiasing(RenderButtonsPanel):
|
||||
|
||||
col = split.column()
|
||||
col.row().prop(rd, "antialiasing_samples", expand=True)
|
||||
sub = col.row()
|
||||
sub = col.row()
|
||||
sub.enabled = not rd.use_border
|
||||
sub.prop(rd, "full_sample")
|
||||
|
||||
@ -462,7 +462,7 @@ class RENDER_PT_antialiasing(RenderButtonsPanel):
|
||||
col = split.column()
|
||||
col.prop(rd, "pixel_filter", text="")
|
||||
col.prop(rd, "filter_size", text="Size")
|
||||
|
||||
|
||||
|
||||
class RENDER_PT_motion_blur(RenderButtonsPanel):
|
||||
bl_label = "Full Sample Motion Blur"
|
||||
@ -483,6 +483,7 @@ class RENDER_PT_motion_blur(RenderButtonsPanel):
|
||||
row = layout.row()
|
||||
row.prop(rd, "motion_blur_samples")
|
||||
|
||||
|
||||
class RENDER_PT_dimensions(RenderButtonsPanel):
|
||||
bl_label = "Dimensions"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
@ -645,6 +646,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -652,4 +654,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -102,7 +102,7 @@ class SCENE_PT_keying_sets(SceneButtonsPanel):
|
||||
col = row.column()
|
||||
col.prop(ks, "name")
|
||||
col.prop(ks, "absolute")
|
||||
|
||||
|
||||
subcol = col.column()
|
||||
subcol.operator_context = 'INVOKE_DEFAULT'
|
||||
op = subcol.operator("anim.keying_set_export", text="Export to File")
|
||||
@ -208,7 +208,7 @@ class SCENE_PT_simplify(SceneButtonsPanel):
|
||||
col = split.column()
|
||||
col.prop(rd, "simplify_subdivision", text="Subdivision")
|
||||
col.prop(rd, "simplify_child_particles", text="Child Particles")
|
||||
|
||||
|
||||
col.prop(rd, "simplify_triangulate")
|
||||
|
||||
if wide_ui:
|
||||
@ -242,83 +242,83 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
|
||||
|
||||
scene = context.scene
|
||||
ks = scene.active_keying_set
|
||||
|
||||
|
||||
|
||||
|
||||
f.write("# Keying Set: %s\n" % ks.name)
|
||||
|
||||
|
||||
f.write("import bpy\n\n")
|
||||
f.write("scene= bpy.data.scenes[0]\n\n")
|
||||
|
||||
# Add KeyingSet and set general settings
|
||||
# Add KeyingSet and set general settings
|
||||
f.write("# Keying Set Level declarations\n")
|
||||
f.write("ks= scene.add_keying_set(name=\"%s\")\n" % ks.name)
|
||||
|
||||
|
||||
if ks.absolute is False:
|
||||
f.write("ks.absolute = False\n")
|
||||
f.write("\n")
|
||||
|
||||
|
||||
f.write("ks.insertkey_needed = %s\n" % ks.insertkey_needed)
|
||||
f.write("ks.insertkey_visual = %s\n" % ks.insertkey_visual)
|
||||
f.write("ks.insertkey_xyz_to_rgb = %s\n" % ks.insertkey_xyz_to_rgb)
|
||||
f.write("\n")
|
||||
|
||||
|
||||
|
||||
|
||||
# generate and write set of lookups for id's used in paths
|
||||
id_to_paths_cache = {} # cache for syncing ID-blocks to bpy paths + shorthands
|
||||
|
||||
|
||||
for ksp in ks.paths:
|
||||
if ksp.id is None:
|
||||
continue;
|
||||
continue
|
||||
if ksp.id in id_to_paths_cache:
|
||||
continue;
|
||||
|
||||
continue
|
||||
|
||||
# - idtype_list is used to get the list of id-datablocks from bpy.data.*
|
||||
# since this info isn't available elsewhere
|
||||
# - id.bl_rna.name gives a name suitable for UI,
|
||||
# - id.bl_rna.name gives a name suitable for UI,
|
||||
# with a capitalised first letter, but we need
|
||||
# the plural form that's all lower case
|
||||
idtype_list = ksp.id.bl_rna.name.lower() + "s"
|
||||
id_bpy_path = "bpy.data.%s[\"%s\"]" % (idtype_list, ksp.id.name)
|
||||
|
||||
|
||||
# shorthand ID for the ID-block (as used in the script)
|
||||
short_id = "id_%d" % len(id_to_paths_cache)
|
||||
|
||||
|
||||
# store this in the cache now
|
||||
id_to_paths_cache[ksp.id] = [short_id, id_bpy_path]
|
||||
|
||||
|
||||
f.write("# ID's that are commonly used\n")
|
||||
for id_pair in id_to_paths_cache.values():
|
||||
f.write("%s = %s\n" % (id_pair[0], id_pair[1]))
|
||||
f.write("\n")
|
||||
|
||||
|
||||
|
||||
|
||||
# write paths
|
||||
f.write("# Path Definitions\n")
|
||||
f.write("# Path Definitions\n")
|
||||
for ksp in ks.paths:
|
||||
f.write("ksp = ks.add_destination(")
|
||||
|
||||
|
||||
# id-block + RNA-path
|
||||
if ksp.id:
|
||||
# find the relevant shorthand from the cache
|
||||
id_bpy_path = id_to_paths_cache[ksp.id][0]
|
||||
else:
|
||||
id_bpy_path = "None" # XXX...
|
||||
id_bpy_path = "None" # XXX...
|
||||
f.write("%s, '%s'" % (id_bpy_path, ksp.data_path))
|
||||
|
||||
|
||||
# array index settings (if applicable)
|
||||
if ksp.entire_array is False:
|
||||
f.write(", entire_array=False, array_index=%d" % ksp.array_index)
|
||||
|
||||
|
||||
# grouping settings (if applicable)
|
||||
# NOTE: the current default is KEYINGSET, but if this changes, change this code too
|
||||
if ksp.grouping == 'NAMED':
|
||||
f.write(", grouping_method='%s', group_name=\"%s\"" % (ksp.grouping, ksp.group))
|
||||
elif ksp.grouping != 'KEYINGSET':
|
||||
f.write(", grouping_method='%s'" % ksp.grouping)
|
||||
|
||||
|
||||
# finish off
|
||||
f.write(")\n")
|
||||
|
||||
|
||||
f.write("\n")
|
||||
f.close()
|
||||
|
||||
@ -337,7 +337,7 @@ classes = [
|
||||
SCENE_PT_keying_set_paths,
|
||||
SCENE_PT_physics,
|
||||
SCENE_PT_simplify,
|
||||
|
||||
|
||||
SCENE_PT_custom_props,
|
||||
|
||||
ANIM_OT_keying_set_export]
|
||||
@ -348,6 +348,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -355,4 +356,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -991,6 +991,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -998,4 +999,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -287,6 +287,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -294,4 +295,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -62,6 +62,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -69,4 +70,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -218,6 +218,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -225,4 +226,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -205,6 +205,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -212,4 +213,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -74,6 +74,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -81,4 +82,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -185,6 +185,7 @@ class GRAPH_MT_key(bpy.types.Menu):
|
||||
layout.operator("graph.copy")
|
||||
layout.operator("graph.paste")
|
||||
|
||||
|
||||
class GRAPH_MT_key_transform(bpy.types.Menu):
|
||||
bl_label = "Transform"
|
||||
|
||||
@ -212,6 +213,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -219,4 +221,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -520,6 +520,7 @@ class IMAGE_PT_paint(bpy.types.Panel):
|
||||
col.prop(brush, "clone_image", text="Image")
|
||||
col.prop(brush, "clone_alpha", text="Alpha")
|
||||
|
||||
|
||||
class IMAGE_PT_paint_stroke(bpy.types.Panel):
|
||||
bl_space_type = 'IMAGE_EDITOR'
|
||||
bl_region_type = 'UI'
|
||||
@ -550,6 +551,7 @@ class IMAGE_PT_paint_stroke(bpy.types.Panel):
|
||||
|
||||
layout.prop(brush, "use_wrap")
|
||||
|
||||
|
||||
class IMAGE_PT_paint_curve(bpy.types.Panel):
|
||||
bl_space_type = 'IMAGE_EDITOR'
|
||||
bl_region_type = 'UI'
|
||||
@ -596,6 +598,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -603,4 +606,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -423,6 +423,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -430,4 +431,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -56,6 +56,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -63,4 +64,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -173,6 +173,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -180,4 +181,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -152,6 +152,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -159,4 +160,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -111,6 +111,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -118,4 +119,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -692,6 +692,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -699,4 +700,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -293,6 +293,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -300,4 +301,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -181,6 +181,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -188,4 +189,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -1403,6 +1403,7 @@ class USERPREF_PT_extensions(bpy.types.Panel):
|
||||
|
||||
from bpy.props import *
|
||||
|
||||
|
||||
class WM_OT_extension_enable(bpy.types.Operator):
|
||||
"Enable an extension"
|
||||
bl_idname = "wm.extension_enable"
|
||||
@ -1415,7 +1416,7 @@ class WM_OT_extension_enable(bpy.types.Operator):
|
||||
ext = context.user_preferences.extensions.new()
|
||||
module_name = self.properties.module
|
||||
ext.module = module_name
|
||||
|
||||
|
||||
try:
|
||||
mod = __import__(module_name)
|
||||
mod.register()
|
||||
@ -1441,7 +1442,7 @@ class WM_OT_extension_disable(bpy.types.Operator):
|
||||
mod.unregister()
|
||||
except:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
extensions = context.user_preferences.extensions
|
||||
ok = True
|
||||
while ok: # incase its in more then once.
|
||||
@ -1461,7 +1462,7 @@ class WM_OT_extension_install(bpy.types.Operator):
|
||||
bl_label = "Install Extension"
|
||||
|
||||
module = StringProperty(name="Module", description="Module name of the extension to disable")
|
||||
|
||||
|
||||
path = StringProperty(name="File Path", description="File path to write file to")
|
||||
filename = StringProperty(name="File Name", description="Name of the file")
|
||||
directory = StringProperty(name="Directory", description="Directory of the file")
|
||||
@ -1478,7 +1479,7 @@ class WM_OT_extension_install(bpy.types.Operator):
|
||||
if os.path.exists(path_dest):
|
||||
self.report({'WARNING'}, "File already installed to '%s'\n" % path_dest)
|
||||
return {'CANCELLED'}
|
||||
|
||||
|
||||
if os.path.exists(path_dest):
|
||||
self.report({'WARNING'}, "File already installed to '%s'\n" % path_dest)
|
||||
return {'CANCELLED'}
|
||||
@ -1498,7 +1499,7 @@ class WM_OT_extension_install(bpy.types.Operator):
|
||||
if not paths:
|
||||
self.report({'ERROR'}, "No 'extensions' path could be found in " + str(bpy.utils.script_paths()))
|
||||
return {'CANCELLED'}
|
||||
|
||||
|
||||
wm = context.manager
|
||||
wm.add_fileselect(self)
|
||||
return {'RUNNING_MODAL'}
|
||||
@ -1910,7 +1911,7 @@ classes = [
|
||||
USERPREF_PT_file,
|
||||
USERPREF_PT_input,
|
||||
USERPREF_PT_extensions,
|
||||
|
||||
|
||||
WM_OT_extension_enable,
|
||||
WM_OT_extension_disable,
|
||||
WM_OT_extension_install,
|
||||
@ -1931,6 +1932,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -1938,4 +1940,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -80,7 +80,7 @@ class VIEW3D_HT_header(bpy.types.Header):
|
||||
row.prop(toolsettings, "proportional_editing", text="", icon_only=True)
|
||||
if toolsettings.proportional_editing != 'DISABLED':
|
||||
row.prop(toolsettings, "proportional_editing_falloff", text="", icon_only=True)
|
||||
|
||||
|
||||
# paint save
|
||||
if mode_string == 'PAINT_TEXTURE':
|
||||
row.operator("image.save_dirty", text="Save Edited")
|
||||
@ -719,17 +719,17 @@ class VIEW3D_MT_object_specials(bpy.types.Menu):
|
||||
props.path_iter = "selected_editable_objects"
|
||||
props.path_item = "data.spot_size"
|
||||
props.input_scale = 0.01
|
||||
|
||||
|
||||
props = layout.operator("wm.context_modal_mouse", text="Distance")
|
||||
props.path_iter = "selected_editable_objects"
|
||||
props.path_item = "data.distance"
|
||||
props.input_scale = 0.1
|
||||
|
||||
|
||||
props = layout.operator("wm.context_modal_mouse", text="Clip Start")
|
||||
props.path_iter = "selected_editable_objects"
|
||||
props.path_item = "data.shadow_buffer_clip_start"
|
||||
props.input_scale = 0.05
|
||||
|
||||
|
||||
props = layout.operator("wm.context_modal_mouse", text="Clip End")
|
||||
props.path_iter = "selected_editable_objects"
|
||||
props.path_item = "data.shadow_buffer_clip_end"
|
||||
@ -1262,7 +1262,7 @@ class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu):
|
||||
totface = mesh.total_face_sel
|
||||
totedge = mesh.total_edge_sel
|
||||
totvert = mesh.total_vert_sel
|
||||
|
||||
|
||||
# the following is dependent on selection modes
|
||||
# we don't really want that
|
||||
# if selection_mode[0]: # vert
|
||||
@ -1300,38 +1300,38 @@ class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu):
|
||||
if totvert == 0:
|
||||
return ()
|
||||
elif totedge == 0:
|
||||
return (0,3)
|
||||
return (0, 3)
|
||||
elif totface == 0:
|
||||
return (0,2,3)
|
||||
return (0, 2, 3)
|
||||
else:
|
||||
return (0,1,2,3)
|
||||
|
||||
|
||||
return (0, 1, 2, 3)
|
||||
|
||||
# should never get here
|
||||
return ()
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
|
||||
def region_menu():
|
||||
|
||||
def region_menu():
|
||||
layout.operator("view3d.edit_mesh_extrude_move_normal", text="Region")
|
||||
|
||||
|
||||
def face_menu():
|
||||
layout.operator("mesh.extrude_faces_move", text="Individual Faces")
|
||||
|
||||
|
||||
def edge_menu():
|
||||
layout.operator("mesh.extrude_edges_move", text="Edges Only")
|
||||
|
||||
|
||||
def vert_menu():
|
||||
layout.operator("mesh.extrude_vertices_move", text="Vertices Only")
|
||||
|
||||
|
||||
menu_funcs = region_menu, face_menu, edge_menu, vert_menu
|
||||
|
||||
|
||||
for i in self.extrude_options(context):
|
||||
func = menu_funcs[i]
|
||||
func()
|
||||
|
||||
|
||||
class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator):
|
||||
"Extrude individual elements and move"
|
||||
bl_label = "Extrude Individual and Move"
|
||||
@ -1344,19 +1344,20 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator):
|
||||
totface = mesh.total_face_sel
|
||||
totedge = mesh.total_edge_sel
|
||||
totvert = mesh.total_vert_sel
|
||||
|
||||
|
||||
if selection_mode[2] and totface == 1:
|
||||
return bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate = {"constraint_orientation":"NORMAL", "constraint_axis":[False, False, True]})
|
||||
return bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": "NORMAL", "constraint_axis": [False, False, True]})
|
||||
elif selection_mode[2] and totface > 1:
|
||||
return bpy.ops.mesh.extrude_faces_move('INVOKE_REGION_WIN')
|
||||
elif selection_mode[1] and totedge >= 1:
|
||||
elif selection_mode[1] and totedge >= 1:
|
||||
return bpy.ops.mesh.extrude_edges_move('INVOKE_REGION_WIN')
|
||||
else:
|
||||
else:
|
||||
return bpy.ops.mesh.extrude_vertices_move('INVOKE_REGION_WIN')
|
||||
|
||||
|
||||
def invoke(self, context, event):
|
||||
return self.execute(context)
|
||||
|
||||
|
||||
class VIEW3D_OT_edit_mesh_extrude_move(bpy.types.Operator):
|
||||
"Extrude and move along normals"
|
||||
bl_label = "Extrude and Move on Normals"
|
||||
@ -1368,17 +1369,18 @@ class VIEW3D_OT_edit_mesh_extrude_move(bpy.types.Operator):
|
||||
totface = mesh.total_face_sel
|
||||
totedge = mesh.total_edge_sel
|
||||
totvert = mesh.total_vert_sel
|
||||
|
||||
|
||||
if totface >= 1 or totvert == 1:
|
||||
return bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate = {"constraint_orientation":"NORMAL", "constraint_axis":[False, False, True]})
|
||||
elif totedge == 1:
|
||||
return bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate = {"constraint_orientation":"NORMAL", "constraint_axis":[True, True, False]})
|
||||
return bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": "NORMAL", "constraint_axis": [False, False, True]})
|
||||
elif totedge == 1:
|
||||
return bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": "NORMAL", "constraint_axis": [True, True, False]})
|
||||
else:
|
||||
return bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN')
|
||||
|
||||
|
||||
def invoke(self, context, event):
|
||||
return self.execute(context)
|
||||
|
||||
|
||||
class VIEW3D_MT_edit_mesh_vertices(bpy.types.Menu):
|
||||
bl_label = "Vertices"
|
||||
|
||||
@ -2258,6 +2260,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -2265,4 +2268,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
@ -1029,6 +1029,7 @@ def register():
|
||||
for cls in classes:
|
||||
register(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
unregister = bpy.types.unregister
|
||||
for cls in classes:
|
||||
@ -1036,4 +1037,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user