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