Compare commits

...

19 Commits

Author SHA1 Message Date
90b464d372 COLLADA branch: merge from trunk -r 28015:31610. 2010-09-04 18:49:07 +00:00
08d02dd04d COLLADA branch: support <instance_node> import. Fixes bug #21954. 2010-08-27 07:06:37 +00:00
c1aa7d61b7 COLLADA branch: keep bone animation sampling keys in ascending order. 2010-06-07 20:19:09 +00:00
6cad602fdb COLLADA branch: patch by Tod Liverseed.
* fix exported values of material transparency, emission and reflectivity
* add extra double_sided tag in GoogleEarth and MAX3D profiles
2010-06-06 19:15:33 +00:00
4967785f48 COLLADA branch: fix bug #22388.
Do not create multiple armatures when multiple controllers share armature.
2010-06-03 17:23:36 +00:00
35a63398a9 COLLADA branch: change texture coordinate parameter names from X and Y to spec-compliant S and T. 2010-05-30 15:43:12 +00:00
9b581cdad1 COLLADA branch:
* partially fix #22388 by appending mesh object name to skin controller id (according to the patch provided by Tod Liverseed) (exporter). Importer still incorrectly handles the case when multiple meshes are linked to a single armature.
* add GPL blocks mentioning contributors. Hopefully didn't miss anyone.
2010-05-26 18:23:52 +00:00
f13738d1db COLLADA branch: fix bug #21989 - test for empty uv sets.
Plus made animation import messages more informative.
2010-04-12 15:27:16 +00:00
de4989aad8 COLLADA branch: fix importer's parenting problem. 2010-04-08 11:40:29 +00:00
1b7040dd6b COLLADA branch: merge from trunk -r 26848:28015. 2010-04-06 15:39:44 +00:00
0d14357d66 COLLADA branch: import matrix animations.
Discovered that importer sets object parents incorrectly - still got to figure out how to fix.
2010-04-05 15:43:36 +00:00
c2ed841603 COLLADA branch: importer fix - loc/scale animation was being read incorrectly. Discovered this while fixing bug #21768. 2010-03-31 14:52:18 +00:00
ea7ece0c2c COLLADA branch: fix bug #21768 - animation channel target was incomplete for translation and scaling animation. 2010-03-30 17:57:09 +00:00
3b8fb47378 COLLADA branch: export vertex colors. Write only active layer for now, all layer export can be added later easily. 2010-03-02 17:33:05 +00:00
b5f4872370 COLLADA branch:
* fix bug in normals import code - could crash on meshes with ngons
* disabled creation of empties on armature import (used for debugging)
* fix memleak (temporary FCurves were not freed)
2010-02-15 15:32:04 +00:00
deaf32e019 COLLADA branch: remove signed/unsigned comparison warnings. 2010-02-14 19:16:06 +00:00
ef1069cb95 COLLADA branch: merge from trunk -r 26429:26848. 2010-02-12 20:23:52 +00:00
7912686f4a COLLADA branch: import mesh smoothing info. Normal values from DAE are not assigned to vertices but are used to flag faces as smooth or flat. This trick works. 2010-02-12 18:39:54 +00:00
5ddc95783f COLLADA branch: exporter takes face smoothness flag into account.
Previously only smooth normals were written for each mesh. Now proper normals are written for flat faces too. Since smooth faces may share normals, writing of duplicate normals is avoided.
2010-02-05 17:36:41 +00:00
44 changed files with 13413 additions and 28 deletions

View File

@@ -0,0 +1,881 @@
import math
# import Blender
import bpy
# import BPyMessages
import Mathutils
Vector= Mathutils.Vector
Euler= Mathutils.Euler
Matrix= Mathutils.Matrix
RotationMatrix= Mathutils.RotationMatrix
TranslationMatrix= Mathutils.TranslationMatrix
# NASTY GLOBAL
ROT_STYLE = 'QUAT'
DEG2RAD = 0.017453292519943295
class bvh_node_class(object):
__slots__=(\
'name',# bvh joint name
'parent',# bvh_node_class type or None for no parent
'children',# a list of children of this type.
'rest_head_world',# worldspace rest location for the head of this node
'rest_head_local',# localspace rest location for the head of this node
'rest_tail_world',# # worldspace rest location for the tail of this node
'rest_tail_local',# # worldspace rest location for the tail of this node
'channels',# list of 6 ints, -1 for an unused channel, otherwise an index for the BVH motion data lines, lock triple then rot triple
'rot_order',# a triple of indicies as to the order rotation is applied. [0,1,2] is x/y/z - [None, None, None] if no rotation.
'anim_data',# a list one tuple's one for each frame. (locx, locy, locz, rotx, roty, rotz)
'has_loc',# Conveinience function, bool, same as (channels[0]!=-1 or channels[1]!=-1 channels[2]!=-1)
'has_rot',# Conveinience function, bool, same as (channels[3]!=-1 or channels[4]!=-1 channels[5]!=-1)
'temp')# use this for whatever you want
def __init__(self, name, rest_head_world, rest_head_local, parent, channels, rot_order):
self.name= name
self.rest_head_world= rest_head_world
self.rest_head_local= rest_head_local
self.rest_tail_world= None
self.rest_tail_local= None
self.parent= parent
self.channels= channels
self.rot_order= rot_order
# convenience functions
self.has_loc= channels[0] != -1 or channels[1] != -1 or channels[2] != -1
self.has_rot= channels[3] != -1 or channels[4] != -1 or channels[5] != -1
self.children= []
# list of 6 length tuples: (lx,ly,lz, rx,ry,rz)
# even if the channels arnt used they will just be zero
#
self.anim_data= [(0,0,0,0,0,0)]
def __repr__(self):
return 'BVH name:"%s", rest_loc:(%.3f,%.3f,%.3f), rest_tail:(%.3f,%.3f,%.3f)' %\
(self.name,\
self.rest_head_world.x, self.rest_head_world.y, self.rest_head_world.z,\
self.rest_head_world.x, self.rest_head_world.y, self.rest_head_world.z)
# Change the order rotation is applied.
MATRIX_IDENTITY_3x3 = Matrix([1,0,0],[0,1,0],[0,0,1])
MATRIX_IDENTITY_4x4 = Matrix([1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1])
def eulerRotate(x,y,z, rot_order):
# Clamp all values between 0 and 360, values outside this raise an error.
mats=[RotationMatrix(math.radians(x%360),3,'x'), RotationMatrix(math.radians(y%360),3,'y'), RotationMatrix(math.radians(z%360),3,'z')]
# print rot_order
# Standard BVH multiplication order, apply the rotation in the order Z,X,Y
#XXX, order changes???
#eul = (mats[rot_order[2]]*(mats[rot_order[1]]* (mats[rot_order[0]]* MATRIX_IDENTITY_3x3))).toEuler()
eul = (MATRIX_IDENTITY_3x3*mats[rot_order[0]]*(mats[rot_order[1]]* (mats[rot_order[2]]))).toEuler()
eul = math.degrees(eul.x), math.degrees(eul.y), math.degrees(eul.z)
return eul
def read_bvh(context, file_path, GLOBAL_SCALE=1.0):
# File loading stuff
# Open the file for importing
file = open(file_path, 'rU')
# Seperate into a list of lists, each line a list of words.
file_lines = file.readlines()
# Non standard carrage returns?
if len(file_lines) == 1:
file_lines = file_lines[0].split('\r')
# Split by whitespace.
file_lines =[ll for ll in [ l.split() for l in file_lines] if ll]
# Create Hirachy as empties
if file_lines[0][0].lower() == 'hierarchy':
#print 'Importing the BVH Hierarchy for:', file_path
pass
else:
raise 'ERROR: This is not a BVH file'
bvh_nodes= {None:None}
bvh_nodes_serial = [None]
channelIndex = -1
lineIdx = 0 # An index for the file.
while lineIdx < len(file_lines) -1:
#...
if file_lines[lineIdx][0].lower() == 'root' or file_lines[lineIdx][0].lower() == 'joint':
# Join spaces into 1 word with underscores joining it.
if len(file_lines[lineIdx]) > 2:
file_lines[lineIdx][1] = '_'.join(file_lines[lineIdx][1:])
file_lines[lineIdx] = file_lines[lineIdx][:2]
# MAY NEED TO SUPPORT MULTIPLE ROOT's HERE!!!, Still unsure weather multiple roots are possible.??
# Make sure the names are unique- Object names will match joint names exactly and both will be unique.
name = file_lines[lineIdx][1]
#print '%snode: %s, parent: %s' % (len(bvh_nodes_serial) * ' ', name, bvh_nodes_serial[-1])
lineIdx += 2 # Incriment to the next line (Offset)
rest_head_local = Vector( GLOBAL_SCALE*float(file_lines[lineIdx][1]), GLOBAL_SCALE*float(file_lines[lineIdx][2]), GLOBAL_SCALE*float(file_lines[lineIdx][3]) )
lineIdx += 1 # Incriment to the next line (Channels)
# newChannel[Xposition, Yposition, Zposition, Xrotation, Yrotation, Zrotation]
# newChannel references indecies to the motiondata,
# if not assigned then -1 refers to the last value that will be added on loading at a value of zero, this is appended
# We'll add a zero value onto the end of the MotionDATA so this is always refers to a value.
my_channel = [-1, -1, -1, -1, -1, -1]
my_rot_order= [None, None, None]
rot_count= 0
for channel in file_lines[lineIdx][2:]:
channel= channel.lower()
channelIndex += 1 # So the index points to the right channel
if channel == 'xposition': my_channel[0] = channelIndex
elif channel == 'yposition': my_channel[1] = channelIndex
elif channel == 'zposition': my_channel[2] = channelIndex
elif channel == 'xrotation':
my_channel[3] = channelIndex
my_rot_order[rot_count]= 0
rot_count+=1
elif channel == 'yrotation':
my_channel[4] = channelIndex
my_rot_order[rot_count]= 1
rot_count+=1
elif channel == 'zrotation':
my_channel[5] = channelIndex
my_rot_order[rot_count]= 2
rot_count+=1
channels = file_lines[lineIdx][2:]
my_parent= bvh_nodes_serial[-1] # account for none
# Apply the parents offset accumletivly
if my_parent==None:
rest_head_world= Vector(rest_head_local)
else:
rest_head_world= my_parent.rest_head_world + rest_head_local
bvh_node= bvh_nodes[name]= bvh_node_class(name, rest_head_world, rest_head_local, my_parent, my_channel, my_rot_order)
# If we have another child then we can call ourselves a parent, else
bvh_nodes_serial.append(bvh_node)
# Account for an end node
if file_lines[lineIdx][0].lower() == 'end' and file_lines[lineIdx][1].lower() == 'site': # There is somtimes a name after 'End Site' but we will ignore it.
lineIdx += 2 # Incriment to the next line (Offset)
rest_tail = Vector( GLOBAL_SCALE*float(file_lines[lineIdx][1]), GLOBAL_SCALE*float(file_lines[lineIdx][2]), GLOBAL_SCALE*float(file_lines[lineIdx][3]) )
bvh_nodes_serial[-1].rest_tail_world= bvh_nodes_serial[-1].rest_head_world + rest_tail
bvh_nodes_serial[-1].rest_tail_local= rest_tail
# Just so we can remove the Parents in a uniform way- End end never has kids
# so this is a placeholder
bvh_nodes_serial.append(None)
if len(file_lines[lineIdx]) == 1 and file_lines[lineIdx][0] == '}': # == ['}']
bvh_nodes_serial.pop() # Remove the last item
if len(file_lines[lineIdx]) == 1 and file_lines[lineIdx][0].lower() == 'motion':
#print '\nImporting motion data'
lineIdx += 3 # Set the cursor to the first frame
break
lineIdx += 1
# Remove the None value used for easy parent reference
del bvh_nodes[None]
# Dont use anymore
del bvh_nodes_serial
bvh_nodes_list= bvh_nodes.values()
while lineIdx < len(file_lines):
line= file_lines[lineIdx]
for bvh_node in bvh_nodes_list:
#for bvh_node in bvh_nodes_serial:
lx= ly= lz= rx= ry= rz= 0.0
channels= bvh_node.channels
anim_data= bvh_node.anim_data
if channels[0] != -1:
lx= GLOBAL_SCALE * float( line[channels[0]] )
if channels[1] != -1:
ly= GLOBAL_SCALE * float( line[channels[1]] )
if channels[2] != -1:
lz= GLOBAL_SCALE * float( line[channels[2]] )
if channels[3] != -1 or channels[4] != -1 or channels[5] != -1:
rx, ry, rz = float( line[channels[3]] ), float( line[channels[4]] ), float( line[channels[5]] )
if ROT_STYLE != 'NATIVE':
rx, ry, rz = eulerRotate(rx, ry, rz, bvh_node.rot_order)
#x,y,z = x/10.0, y/10.0, z/10.0 # For IPO's 36 is 360d
# Make interpolation not cross between 180d, thjis fixes sub frame interpolation and time scaling.
# Will go from (355d to 365d) rather then to (355d to 5d) - inbetween these 2 there will now be a correct interpolation.
while anim_data[-1][3] - rx > 180: rx+=360
while anim_data[-1][3] - rx < -180: rx-=360
while anim_data[-1][4] - ry > 180: ry+=360
while anim_data[-1][4] - ry < -180: ry-=360
while anim_data[-1][5] - rz > 180: rz+=360
while anim_data[-1][5] - rz < -180: rz-=360
# Done importing motion data #
anim_data.append( (lx, ly, lz, rx, ry, rz) )
lineIdx += 1
# Assign children
for bvh_node in bvh_nodes.values():
bvh_node_parent= bvh_node.parent
if bvh_node_parent:
bvh_node_parent.children.append(bvh_node)
# Now set the tip of each bvh_node
for bvh_node in bvh_nodes.values():
if not bvh_node.rest_tail_world:
if len(bvh_node.children)==0:
# could just fail here, but rare BVH files have childless nodes
bvh_node.rest_tail_world = Vector(bvh_node.rest_head_world)
bvh_node.rest_tail_local = Vector(bvh_node.rest_head_local)
elif len(bvh_node.children)==1:
bvh_node.rest_tail_world= Vector(bvh_node.children[0].rest_head_world)
bvh_node.rest_tail_local= Vector(bvh_node.children[0].rest_head_local)
else:
# allow this, see above
#if not bvh_node.children:
# raise 'error, bvh node has no end and no children. bad file'
# Removed temp for now
rest_tail_world= Vector(0,0,0)
rest_tail_local= Vector(0,0,0)
for bvh_node_child in bvh_node.children:
rest_tail_world += bvh_node_child.rest_head_world
rest_tail_local += bvh_node_child.rest_head_local
bvh_node.rest_tail_world= rest_tail_world * (1.0/len(bvh_node.children))
bvh_node.rest_tail_local= rest_tail_local * (1.0/len(bvh_node.children))
# Make sure tail isnt the same location as the head.
if (bvh_node.rest_tail_local-bvh_node.rest_head_local).length <= 0.001*GLOBAL_SCALE:
bvh_node.rest_tail_local.y= bvh_node.rest_tail_local.y + GLOBAL_SCALE/10
bvh_node.rest_tail_world.y= bvh_node.rest_tail_world.y + GLOBAL_SCALE/10
return bvh_nodes
def bvh_node_dict2objects(context, bvh_nodes, IMPORT_START_FRAME= 1, IMPORT_LOOP= False):
if IMPORT_START_FRAME<1:
IMPORT_START_FRAME= 1
scn= context.scene
scn.objects.selected = []
objects= []
def add_ob(name):
ob = scn.objects.new('Empty')
objects.append(ob)
return ob
# Add objects
for name, bvh_node in bvh_nodes.items():
bvh_node.temp= add_ob(name)
# Parent the objects
for bvh_node in bvh_nodes.values():
bvh_node.temp.makeParent([ bvh_node_child.temp for bvh_node_child in bvh_node.children ], 1, 0) # ojbs, noninverse, 1 = not fast.
# Offset
for bvh_node in bvh_nodes.values():
# Make relative to parents offset
bvh_node.temp.loc= bvh_node.rest_head_local
# Add tail objects
for name, bvh_node in bvh_nodes.items():
if not bvh_node.children:
ob_end= add_ob(name + '_end')
bvh_node.temp.makeParent([ob_end], 1, 0) # ojbs, noninverse, 1 = not fast.
ob_end.loc= bvh_node.rest_tail_local
# Animate the data, the last used bvh_node will do since they all have the same number of frames
for current_frame in range(len(bvh_node.anim_data)):
Blender.Set('curframe', current_frame+IMPORT_START_FRAME)
for bvh_node in bvh_nodes.values():
lx,ly,lz,rx,ry,rz= bvh_node.anim_data[current_frame]
rest_head_local= bvh_node.rest_head_local
bvh_node.temp.loc= rest_head_local.x+lx, rest_head_local.y+ly, rest_head_local.z+lz
bvh_node.temp.rot= rx*DEG2RAD,ry*DEG2RAD,rz*DEG2RAD
bvh_node.temp.insertIpoKey(Blender.Object.IpoKeyTypes.LOCROT)
scn.update(1)
return objects
def bvh_node_dict2armature(context, bvh_nodes, IMPORT_START_FRAME= 1, IMPORT_LOOP= False):
if IMPORT_START_FRAME<1:
IMPORT_START_FRAME= 1
# Add the new armature,
scn = context.scene
#XXX scn.objects.selected = []
for ob in scn.objects:
ob.selected = False
#XXX arm_data= bpy.data.armatures.new()
#XXX arm_ob = scn.objects.new(arm_data)
bpy.ops.object.armature_add()
arm_ob= scn.objects[-1]
arm_data= arm_ob.data
#XXX scn.objects.context = [arm_ob]
#XXX scn.objects.active = arm_ob
arm_ob.selected= True
scn.objects.active= arm_ob
print(scn.objects.active)
# Put us into editmode
#XXX arm_data.makeEditable()
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
# Get the average bone length for zero length bones, we may not use this.
average_bone_length= 0.0
nonzero_count= 0
for bvh_node in bvh_nodes.values():
l= (bvh_node.rest_head_local-bvh_node.rest_tail_local).length
if l:
average_bone_length+= l
nonzero_count+=1
# Very rare cases all bones couldbe zero length???
if not average_bone_length:
average_bone_length = 0.1
else:
# Normal operation
average_bone_length = average_bone_length/nonzero_count
#XXX - sloppy operator code
bpy.ops.armature.delete()
bpy.ops.armature.select_all_toggle()
bpy.ops.armature.delete()
ZERO_AREA_BONES= []
for name, bvh_node in bvh_nodes.items():
# New editbone
bpy.ops.armature.bone_primitive_add(name="Bone")
#XXX bone= bvh_node.temp= Blender.Armature.Editbone()
bone= bvh_node.temp= arm_data.edit_bones[-1]
bone.name= name
# arm_data.bones[name]= bone
bone.head= bvh_node.rest_head_world
bone.tail= bvh_node.rest_tail_world
# ZERO AREA BONES.
if (bone.head-bone.tail).length < 0.001:
if bvh_node.parent:
ofs= bvh_node.parent.rest_head_local- bvh_node.parent.rest_tail_local
if ofs.length: # is our parent zero length also?? unlikely
bone.tail= bone.tail+ofs
else:
bone.tail.y= bone.tail.y+average_bone_length
else:
bone.tail.y= bone.tail.y+average_bone_length
ZERO_AREA_BONES.append(bone.name)
for bvh_node in bvh_nodes.values():
if bvh_node.parent:
# bvh_node.temp is the Editbone
# Set the bone parent
bvh_node.temp.parent= bvh_node.parent.temp
# Set the connection state
if not bvh_node.has_loc and\
bvh_node.parent and\
bvh_node.parent.temp.name not in ZERO_AREA_BONES and\
bvh_node.parent.rest_tail_local == bvh_node.rest_head_local:
bvh_node.temp.connected= True
# Replace the editbone with the editbone name,
# to avoid memory errors accessing the editbone outside editmode
for bvh_node in bvh_nodes.values():
bvh_node.temp= bvh_node.temp.name
#XXX arm_data.update()
# Now Apply the animation to the armature
# Get armature animation data
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
bpy.ops.object.mode_set(mode='POSE', toggle=False)
pose= arm_ob.pose
pose_bones= pose.pose_channels
if ROT_STYLE=='NATIVE':
eul_order_lookup = {\
(0,1,2):'XYZ',
(0,2,1):'XZY',
(1,0,2):'YXZ',
(1,2,0):'YZX',
(2,0,1):'ZXY',
(2,1,0):'ZYZ'
}
for bvh_node in bvh_nodes.values():
bone_name= bvh_node.temp # may not be the same name as the bvh_node, could have been shortened.
pose_bone= pose_bones[bone_name]
pose_bone.rotation_mode = eul_order_lookup[tuple(bvh_node.rot_order)]
elif ROT_STYLE=='XYZ':
for pose_bone in pose_bones:
pose_bone.rotation_mode = 'XYZ'
else:
# Quats default
pass
bpy.ops.pose.select_all_toggle() # set
bpy.ops.anim.insert_keyframe_menu(type=-4) # XXX - -4 ???
#for p in pose_bones:
# print(p)
#XXX action = Blender.Armature.NLA.NewAction("Action")
#XXX action.setActive(arm_ob)
#bpy.ops.act.new()
#action = bpy.data.actions[-1]
# arm_ob.animation_data.action = action
action = arm_ob.animation_data.action
#xformConstants= [ Blender.Object.Pose.LOC, Blender.Object.Pose.ROT ]
# Replace the bvh_node.temp (currently an editbone)
# With a tuple (pose_bone, armature_bone, bone_rest_matrix, bone_rest_matrix_inv)
for bvh_node in bvh_nodes.values():
bone_name= bvh_node.temp # may not be the same name as the bvh_node, could have been shortened.
pose_bone= pose_bones[bone_name]
rest_bone= arm_data.bones[bone_name]
#XXX bone_rest_matrix = rest_bone.matrix['ARMATURESPACE'].rotationPart()
bone_rest_matrix = rest_bone.matrix.rotationPart()
bone_rest_matrix_inv= Matrix(bone_rest_matrix)
bone_rest_matrix_inv.invert()
bone_rest_matrix_inv.resize4x4()
bone_rest_matrix.resize4x4()
bvh_node.temp= (pose_bone, bone, bone_rest_matrix, bone_rest_matrix_inv)
# Make a dict for fast access without rebuilding a list all the time.
'''
xformConstants_dict={
(True,True): [Blender.Object.Pose.LOC, Blender.Object.Pose.ROT],\
(False,True): [Blender.Object.Pose.ROT],\
(True,False): [Blender.Object.Pose.LOC],\
(False,False): [],\
}
'''
# KEYFRAME METHOD, SLOW, USE IPOS DIRECT
# Animate the data, the last used bvh_node will do since they all have the same number of frames
for current_frame in range(len(bvh_node.anim_data)-1): # skip the first frame (rest frame)
# print current_frame
#if current_frame==150: # debugging
# break
# Dont neet to set the current frame
for bvh_node in bvh_nodes.values():
pose_bone, bone, bone_rest_matrix, bone_rest_matrix_inv= bvh_node.temp
lx,ly,lz,rx,ry,rz= bvh_node.anim_data[current_frame+1]
if bvh_node.has_rot:
if ROT_STYLE=='QUAT':
# Set the rotation, not so simple
bone_rotation_matrix= Euler(math.radians(rx), math.radians(ry), math.radians(rz)).toMatrix()
bone_rotation_matrix.resize4x4()
#XXX ORDER CHANGE???
#pose_bone.rotation_quaternion= (bone_rest_matrix * bone_rotation_matrix * bone_rest_matrix_inv).toQuat() # ORIGINAL
# pose_bone.rotation_quaternion= (bone_rest_matrix_inv * bone_rotation_matrix * bone_rest_matrix).toQuat()
# pose_bone.rotation_quaternion= (bone_rotation_matrix * bone_rest_matrix).toQuat() # BAD
# pose_bone.rotation_quaternion= bone_rotation_matrix.toQuat() # NOT GOOD
# pose_bone.rotation_quaternion= bone_rotation_matrix.toQuat() # NOT GOOD
#pose_bone.rotation_quaternion= (bone_rotation_matrix * bone_rest_matrix_inv * bone_rest_matrix).toQuat()
#pose_bone.rotation_quaternion= (bone_rest_matrix_inv * bone_rest_matrix * bone_rotation_matrix).toQuat()
#pose_bone.rotation_quaternion= (bone_rest_matrix * bone_rotation_matrix * bone_rest_matrix_inv).toQuat()
#pose_bone.rotation_quaternion= ( bone_rest_matrix* bone_rest_matrix_inv * bone_rotation_matrix).toQuat()
#pose_bone.rotation_quaternion= (bone_rotation_matrix * bone_rest_matrix * bone_rest_matrix_inv).toQuat()
#pose_bone.rotation_quaternion= (bone_rest_matrix_inv * bone_rotation_matrix * bone_rest_matrix ).toQuat()
pose_bone.rotation_quaternion= (bone_rest_matrix_inv * bone_rotation_matrix * bone_rest_matrix).toQuat()
else:
bone_rotation_matrix= Euler(math.radians(rx), math.radians(ry), math.radians(rz)).toMatrix()
bone_rotation_matrix.resize4x4()
eul= (bone_rest_matrix * bone_rotation_matrix * bone_rest_matrix_inv).toEuler()
#pose_bone.rotation_euler = math.radians(rx), math.radians(ry), math.radians(rz)
pose_bone.rotation_euler = eul
print("ROTATION" + str(Euler(math.radians(rx), math.radians(ry), math.radians(rz))))
if bvh_node.has_loc:
# Set the Location, simple too
#XXX ORDER CHANGE
# pose_bone.location= (TranslationMatrix(Vector(lx, ly, lz) - bvh_node.rest_head_local ) * bone_rest_matrix_inv).translationPart() # WHY * 10? - just how pose works
# pose_bone.location= (bone_rest_matrix_inv * TranslationMatrix(Vector(lx, ly, lz) - bvh_node.rest_head_local )).translationPart()
# pose_bone.location= lx, ly, lz
pose_bone.location= Vector(lx, ly, lz) - bvh_node.rest_head_local
#XXX # TODO- add in 2.5
if 0:
# Get the transform
xformConstants= xformConstants_dict[bvh_node.has_loc, bvh_node.has_rot]
if xformConstants:
# Insert the keyframe from the loc/quat
pose_bone.insertKey(arm_ob, current_frame+IMPORT_START_FRAME, xformConstants, True )
else:
if bvh_node.has_loc:
pose_bone.keyframe_insert("location")
if bvh_node.has_rot:
if ROT_STYLE=='QUAT':
pose_bone.keyframe_insert("rotation_quaternion")
else:
pose_bone.keyframe_insert("rotation_euler")
# bpy.ops.anim.insert_keyframe_menu(type=-4) # XXX - -4 ???
bpy.ops.screen.frame_offset(delta=1)
# First time, set the IPO's to linear
#XXX #TODO
if 0:
if current_frame==0:
for ipo in action.getAllChannelIpos().values():
if ipo:
for cur in ipo:
cur.interpolation = Blender.IpoCurve.InterpTypes.LINEAR
if IMPORT_LOOP:
cur.extend = Blender.IpoCurve.ExtendTypes.CYCLIC
else:
for cu in action.fcurves:
for bez in cu.keyframe_points:
bez.interpolation = 'CONSTANT'
# END KEYFRAME METHOD
"""
# IPO KEYFRAME SETTING
# Add in the IPOs by adding keyframes, AFAIK theres no way to add IPOs to an action so I do this :/
for bvh_node in bvh_nodes.values():
pose_bone, bone, bone_rest_matrix, bone_rest_matrix_inv= bvh_node.temp
# Get the transform
xformConstants= xformConstants_dict[bvh_node.has_loc, bvh_node.has_rot]
if xformConstants:
pose_bone.loc[:]= 0,0,0
pose_bone.quat[:]= 0,0,1,0
# Insert the keyframe from the loc/quat
pose_bone.insertKey(arm_ob, IMPORT_START_FRAME, xformConstants)
action_ipos= action.getAllChannelIpos()
for bvh_node in bvh_nodes.values():
has_loc= bvh_node.has_loc
has_rot= bvh_node.has_rot
if not has_rot and not has_loc:
# No animation data
continue
ipo= action_ipos[bvh_node.temp[0].name] # posebones name as key
if has_loc:
curve_xloc= ipo[Blender.Ipo.PO_LOCX]
curve_yloc= ipo[Blender.Ipo.PO_LOCY]
curve_zloc= ipo[Blender.Ipo.PO_LOCZ]
curve_xloc.interpolation= \
curve_yloc.interpolation= \
curve_zloc.interpolation= \
Blender.IpoCurve.InterpTypes.LINEAR
if has_rot:
curve_wquat= ipo[Blender.Ipo.PO_QUATW]
curve_xquat= ipo[Blender.Ipo.PO_QUATX]
curve_yquat= ipo[Blender.Ipo.PO_QUATY]
curve_zquat= ipo[Blender.Ipo.PO_QUATZ]
curve_wquat.interpolation= \
curve_xquat.interpolation= \
curve_yquat.interpolation= \
curve_zquat.interpolation= \
Blender.IpoCurve.InterpTypes.LINEAR
# Get the bone
pose_bone, bone, bone_rest_matrix, bone_rest_matrix_inv= bvh_node.temp
def pose_rot(anim_data):
bone_rotation_matrix= Euler(anim_data[3], anim_data[4], anim_data[5]).toMatrix()
bone_rotation_matrix.resize4x4()
return tuple((bone_rest_matrix * bone_rotation_matrix * bone_rest_matrix_inv).toQuat()) # qw,qx,qy,qz
def pose_loc(anim_data):
return tuple((TranslationMatrix(Vector(anim_data[0], anim_data[1], anim_data[2])) * bone_rest_matrix_inv).translationPart())
last_frame= len(bvh_node.anim_data)+IMPORT_START_FRAME-1
if has_loc:
pose_locations= [pose_loc(anim_key) for anim_key in bvh_node.anim_data]
# Add the start at the end, we know the start is just 0,0,0 anyway
curve_xloc.append((last_frame, pose_locations[-1][0]))
curve_yloc.append((last_frame, pose_locations[-1][1]))
curve_zloc.append((last_frame, pose_locations[-1][2]))
if len(pose_locations) > 1:
ox,oy,oz= pose_locations[0]
x,y,z= pose_locations[1]
for i in range(1, len(pose_locations)-1): # from second frame to second last frame
nx,ny,nz= pose_locations[i+1]
xset= yset= zset= True # we set all these by default
if abs((ox+nx)/2 - x) < 0.00001: xset= False
if abs((oy+ny)/2 - y) < 0.00001: yset= False
if abs((oz+nz)/2 - z) < 0.00001: zset= False
if xset: curve_xloc.append((i+IMPORT_START_FRAME, x))
if yset: curve_yloc.append((i+IMPORT_START_FRAME, y))
if zset: curve_zloc.append((i+IMPORT_START_FRAME, z))
# Set the old and use the new
ox,oy,oz= x,y,z
x,y,z= nx,ny,nz
if has_rot:
pose_rotations= [pose_rot(anim_key) for anim_key in bvh_node.anim_data]
# Add the start at the end, we know the start is just 0,0,0 anyway
curve_wquat.append((last_frame, pose_rotations[-1][0]))
curve_xquat.append((last_frame, pose_rotations[-1][1]))
curve_yquat.append((last_frame, pose_rotations[-1][2]))
curve_zquat.append((last_frame, pose_rotations[-1][3]))
if len(pose_rotations) > 1:
ow,ox,oy,oz= pose_rotations[0]
w,x,y,z= pose_rotations[1]
for i in range(1, len(pose_rotations)-1): # from second frame to second last frame
nw, nx,ny,nz= pose_rotations[i+1]
wset= xset= yset= zset= True # we set all these by default
if abs((ow+nw)/2 - w) < 0.00001: wset= False
if abs((ox+nx)/2 - x) < 0.00001: xset= False
if abs((oy+ny)/2 - y) < 0.00001: yset= False
if abs((oz+nz)/2 - z) < 0.00001: zset= False
if wset: curve_wquat.append((i+IMPORT_START_FRAME, w))
if xset: curve_xquat.append((i+IMPORT_START_FRAME, x))
if yset: curve_yquat.append((i+IMPORT_START_FRAME, y))
if zset: curve_zquat.append((i+IMPORT_START_FRAME, z))
# Set the old and use the new
ow,ox,oy,oz= w,x,y,z
w,x,y,z= nw,nx,ny,nz
# IPO KEYFRAME SETTING
"""
# XXX NOT NEEDED NOW?
# pose.update()
return arm_ob
#=============#
# TESTING #
#=============#
#('/metavr/mocap/bvh/boxer.bvh')
#('/d/staggered_walk.bvh')
#('/metavr/mocap/bvh/dg-306-g.bvh') # Incompleate EOF
#('/metavr/mocap/bvh/wa8lk.bvh') # duplicate joint names, \r line endings.
#('/metavr/mocap/bvh/walk4.bvh') # 0 channels
'''
import os
DIR = '/metavr/mocap/bvh/'
for f in ('/d/staggered_walk.bvh',):
#for f in os.listdir(DIR)[5:6]:
#for f in os.listdir(DIR):
if f.endswith('.bvh'):
s = Blender.Scene.New(f)
s.makeCurrent()
#file= DIR + f
file= f
print f
bvh_nodes= read_bvh(file, 1.0)
bvh_node_dict2armature(bvh_nodes, 1)
'''
def load_bvh_ui(context, file, PREF_UI= False):
#XXX if BPyMessages.Error_NoFile(file):
#XXX return
#XXX Draw= Blender.Draw
IMPORT_SCALE = 0.1
IMPORT_START_FRAME = 1
IMPORT_AS_ARMATURE = 1
IMPORT_AS_EMPTIES = 0
IMPORT_LOOP = 0
# Get USER Options
if PREF_UI:
pup_block = [\
('As Armature', IMPORT_AS_ARMATURE, 'Imports the BVH as an armature'),\
('As Empties', IMPORT_AS_EMPTIES, 'Imports the BVH as empties'),\
('Scale: ', IMPORT_SCALE, 0.001, 100.0, 'Scale the BVH, Use 0.01 when 1.0 is 1 metre'),\
('Start Frame: ', IMPORT_START_FRAME, 1, 30000, 'Frame to start BVH motion'),\
('Loop Animation', IMPORT_LOOP, 'Enable cyclic IPOs'),\
]
#XXX if not Draw.PupBlock('BVH Import...', pup_block):
#XXX return
# print('Attempting import BVH', file)
if not IMPORT_AS_ARMATURE and not IMPORT_AS_EMPTIES:
raise('No import option selected')
#XXX Blender.Window.WaitCursor(1)
# Get the BVH data and act on it.
import time
t1= time.time()
print('\tparsing bvh...', end= "")
bvh_nodes= read_bvh(context, file, IMPORT_SCALE)
print('%.4f' % (time.time()-t1))
t1= time.time()
print('\timporting to blender...', end="")
if IMPORT_AS_ARMATURE: bvh_node_dict2armature(context, bvh_nodes, IMPORT_START_FRAME, IMPORT_LOOP)
if IMPORT_AS_EMPTIES: bvh_node_dict2objects(context, bvh_nodes, IMPORT_START_FRAME, IMPORT_LOOP)
print('Done in %.4f\n' % (time.time()-t1))
#XXX Blender.Window.WaitCursor(0)
def main():
Blender.Window.FileSelector(load_bvh_ui, 'Import BVH', '*.bvh')
from bpy.props import *
class BvhImporter(bpy.types.Operator):
'''Load a Wavefront OBJ File.'''
bl_idname = "import.bvh"
bl_label = "Import BVH"
path = StringProperty(name="File Path", description="File path used for importing the OBJ file", maxlen= 1024, default= "")
def execute(self, context):
# print("Selected: " + context.active_object.name)
read_bvh(context, self.path)
return ('FINISHED',)
def invoke(self, context, event):
wm = context.manager
wm.add_fileselect(self)
return ('RUNNING_MODAL',)
bpy.ops.add(BvhImporter)
import dynamic_menu
menu_func = lambda self, context: self.layout.itemO("import.bvh", text="Motion Capture (.bvh)...")
menu_item = dynamic_menu.add(bpy.types.INFO_MT_file_import, menu_func)

137
release/ui/bpy_ops.py Normal file
View File

@@ -0,0 +1,137 @@
# for slightly faster access
from bpy.__ops__ import add as op_add
from bpy.__ops__ import remove as op_remove
from bpy.__ops__ import dir as op_dir
from bpy.__ops__ import call as op_call
from bpy.__ops__ import get_rna as op_get_rna
# Keep in sync with WM_types.h
context_dict = {
'INVOKE_DEFAULT':0,
'INVOKE_REGION_WIN':1,
'INVOKE_AREA':2,
'INVOKE_SCREEN':3,
'EXEC_DEFAULT':4,
'EXEC_REGION_WIN':5,
'EXEC_AREA':6,
'EXEC_SCREEN':7,
}
class bpy_ops(object):
'''
Fake module like class.
bpy.ops
'''
def add(self, pyop):
op_add(pyop)
def remove(self, pyop):
op_remove(pyop)
def __getattr__(self, module):
'''
gets a bpy.ops submodule
'''
return bpy_ops_submodule(module)
def __dir__(self):
submodules = set()
# add this classes functions
for id_name in dir(self.__class__):
if not id_name.startswith('__'):
submodules.add(id_name)
for id_name in op_dir():
id_split = id_name.split('_OT_', 1)
if len(id_split) == 2:
submodules.add(id_split[0].lower())
else:
submodules.add(id_split[0])
return list(submodules)
def __repr__(self):
return "<module like class 'bpy.ops'>"
class bpy_ops_submodule(object):
'''
Utility class to fake submodules.
eg. bpy.ops.object
'''
__keys__ = ('module',)
def __init__(self, module):
self.module = module
def __getattr__(self, func):
'''
gets a bpy.ops.submodule function
'''
return bpy_ops_submodule_op(self.module, func)
def __dir__(self):
functions = set()
module_upper = self.module.upper()
for id_name in op_dir():
id_split = id_name.split('_OT_', 1)
if len(id_split) == 2 and module_upper == id_split[0]:
functions.add(id_split[1])
return list(functions)
def __repr__(self):
return "<module like class 'bpy.ops.%s'>" % self.module
class bpy_ops_submodule_op(object):
'''
Utility class to fake submodule operators.
eg. bpy.ops.object.somefunc
'''
__keys__ = ('module', 'func')
def __init__(self, module, func):
self.module = module
self.func = func
def idname(self):
# submod.foo -> SUBMOD_OT_foo
return self.module.upper() + '_OT_' + self.func
def __call__(self, *args, **kw):
# Get the operator from blender
if len(args) > 1:
raise ValueError("only one argument for the execution context is supported ")
if args:
try:
context = context_dict[args[0]]
except:
raise ValueError("Expected a single context argument in: " + str(list(context_dict.keys())))
return op_call(self.idname(), kw, context)
else:
return op_call(self.idname(), kw)
def get_rna(self):
'''
currently only used for '__rna__'
'''
return op_get_rna(self.idname())
def __repr__(self):
return "<function bpy.ops.%s.%s at 0x%x'>" % (self.module, self.func, id(self))
import bpy
bpy.ops = bpy_ops()

View File

@@ -0,0 +1,177 @@
import bpy
class DataButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "data"
def poll(self, context):
return (context.armature)
class DATA_PT_context_arm(DataButtonsPanel):
__show_header__ = False
def draw(self, context):
layout = self.layout
ob = context.object
arm = context.armature
space = context.space_data
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "data")
split.itemS()
elif arm:
split.template_ID(space, "pin_id")
split.itemS()
class DATA_PT_skeleton(DataButtonsPanel):
__label__ = "Skeleton"
def draw(self, context):
layout = self.layout
ob = context.object
arm = context.armature
space = context.space_data
split = layout.split()
col = split.column()
col.itemL(text="Layers:")
col.itemR(arm, "layer", text="")
col.itemL(text="Protected Layers:")
col.itemR(arm, "layer_protection", text="")
col.itemL(text="Edit Options:")
col.itemR(arm, "x_axis_mirror")
col.itemR(arm, "auto_ik")
col = split.column()
col.itemR(arm, "rest_position")
col.itemL(text="Deform:")
col.itemR(arm, "deform_vertexgroups", text="Vertex Groups")
col.itemR(arm, "deform_envelope", text="Envelopes")
col.itemR(arm, "deform_quaternion", text="Quaternion")
col.itemR(arm, "deform_bbone_rest", text="B-Bones Rest")
class DATA_PT_display(DataButtonsPanel):
__label__ = "Display"
def draw(self, context):
layout = self.layout
arm = context.armature
layout.row().itemR(arm, "drawtype", expand=True)
flow = layout.column_flow()
flow.itemR(arm, "draw_names", text="Names")
flow.itemR(arm, "draw_axes", text="Axes")
flow.itemR(arm, "draw_custom_bone_shapes", text="Shapes")
flow.itemR(arm, "draw_group_colors", text="Colors")
flow.itemR(arm, "delay_deform", text="Delay Refresh")
class DATA_PT_bone_groups(DataButtonsPanel):
__label__ = "Bone Groups"
def poll(self, context):
return (context.object and context.object.type=='ARMATURE' and context.object.pose)
def draw(self, context):
layout = self.layout
ob = context.object
pose = ob.pose
row = layout.row()
row.template_list(pose, "bone_groups", pose, "active_bone_group_index")
col = row.column(align=True)
col.active = (ob.proxy == None)
col.itemO("pose.group_add", icon='ICON_ZOOMIN', text="")
col.itemO("pose.group_remove", icon='ICON_ZOOMOUT', text="")
group = pose.active_bone_group
if group:
col = layout.column()
col.active= (ob.proxy == None)
col.itemR(group, "name")
split = layout.split(0.5)
split.active= (ob.proxy == None)
split.itemR(group, "color_set")
if group.color_set:
split.template_triColorSet(group, "colors")
row = layout.row(align=True)
row.active = (ob.proxy == None)
row.itemO("pose.group_assign", text="Assign")
row.itemO("pose.group_remove", text="Remove") #row.itemO("pose.bone_group_remove_from", text="Remove")
#row.itemO("object.bone_group_select", text="Select")
#row.itemO("object.bone_group_deselect", text="Deselect")
class DATA_PT_paths(DataButtonsPanel):
__label__ = "Paths"
def draw(self, context):
layout = self.layout
arm = context.armature
split = layout.split()
col = split.column()
col.itemR(arm, "paths_show_around_current_frame", text="Around Frame")
sub = col.column(align=True)
if (arm.paths_show_around_current_frame):
sub.itemR(arm, "path_before_current", text="Before")
sub.itemR(arm, "path_after_current", text="After")
else:
sub.itemR(arm, "path_start_frame", text="Start")
sub.itemR(arm, "path_end_frame", text="End")
sub.itemR(arm, "path_size", text="Step")
col.itemR(arm, "paths_calculate_head_positions", text="Head")
col = split.column()
col.itemL(text="Show:")
col.itemR(arm, "paths_show_frame_numbers", text="Frame Numbers")
col.itemR(arm, "paths_highlight_keyframes", text="Keyframes")
col.itemR(arm, "paths_show_keyframe_numbers", text="Keyframe Numbers")
class DATA_PT_ghost(DataButtonsPanel):
__label__ = "Ghost"
def draw(self, context):
layout = self.layout
arm = context.armature
split = layout.split()
col = split.column()
col.itemR(arm, "ghost_type", text="")
sub = col.column(align=True)
if arm.ghost_type == 'RANGE':
sub.itemR(arm, "ghost_start_frame", text="Start")
sub.itemR(arm, "ghost_end_frame", text="End")
sub.itemR(arm, "ghost_size", text="Step")
elif arm.ghost_type == 'CURRENT_FRAME':
sub.itemR(arm, "ghost_step", text="Range")
sub.itemR(arm, "ghost_size", text="Step")
col = split.column()
col.itemR(arm, "ghost_only_selected", text="Selected Only")
bpy.types.register(DATA_PT_context_arm)
bpy.types.register(DATA_PT_skeleton)
bpy.types.register(DATA_PT_display)
bpy.types.register(DATA_PT_bone_groups)
bpy.types.register(DATA_PT_paths)
bpy.types.register(DATA_PT_ghost)

View File

@@ -0,0 +1,278 @@
import bpy
class BoneButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "bone"
def poll(self, context):
return (context.bone or context.edit_bone)
class BONE_PT_context_bone(BoneButtonsPanel):
__show_header__ = False
def draw(self, context):
layout = self.layout
bone = context.bone
if not bone:
bone = context.edit_bone
row = layout.row()
row.itemL(text="", icon='ICON_BONE_DATA')
row.itemR(bone, "name", text="")
class BONE_PT_transform(BoneButtonsPanel):
__label__ = "Transform"
def draw(self, context):
layout = self.layout
ob = context.object
bone = context.bone
if not bone:
bone = context.edit_bone
row = layout.row()
row.column().itemR(bone, "head")
row.column().itemR(bone, "tail")
col = row.column()
sub = col.column(align=True)
sub.itemL(text="Roll:")
sub.itemR(bone, "roll", text="")
sub.itemL()
sub.itemR(bone, "locked")
else:
pchan = ob.pose.pose_channels[context.bone.name]
layout.itemR(pchan, "rotation_mode")
row = layout.row()
col = row.column()
col.itemR(pchan, "location")
col.active = not (bone.parent and bone.connected)
col = row.column()
if pchan.rotation_mode == 'QUATERNION':
col.itemR(pchan, "rotation", text="Rotation")
elif pchan.rotation_mode == 'AXIS_ANGLE':
col.itemL(text="Rotation")
col.itemR(pchan, "rotation_angle", text="Angle")
col.itemR(pchan, "rotation_axis", text="Axis")
else:
col.itemR(pchan, "euler_rotation", text="Rotation")
row.column().itemR(pchan, "scale")
if pchan.rotation_mode == 'QUATERNION':
col = layout.column(align=True)
col.itemL(text="Euler:")
col.row().itemR(pchan, "euler_rotation", text="")
class BONE_PT_transform_locks(BoneButtonsPanel):
__label__ = "Transform Locks"
def poll(self, context):
return context.bone
def draw(self, context):
layout = self.layout
ob = context.object
bone = context.bone
pchan = ob.pose.pose_channels[context.bone.name]
row = layout.row()
col = row.column()
col.itemR(pchan, "lock_location")
col.active = not (bone.parent and bone.connected)
col = row.column()
if pchan.rotation_mode in ('QUATERNION', 'AXIS_ANGLE'):
col.itemR(pchan, "lock_rotations_4d", text="Lock Rotation")
if pchan.lock_rotations_4d:
col.itemR(pchan, "lock_rotation_w", text="W")
col.itemR(pchan, "lock_rotation", text="")
else:
col.itemR(pchan, "lock_rotation", text="Rotation")
row.column().itemR(pchan, "lock_scale")
class BONE_PT_bone(BoneButtonsPanel):
__label__ = "Bone"
def draw(self, context):
layout = self.layout
ob = context.object
bone = context.bone
arm = context.armature
if not bone:
bone = context.edit_bone
pchan = None
else:
pchan = ob.pose.pose_channels[context.bone.name]
split = layout.split()
col = split.column()
col.itemL(text="Parent:")
if context.bone:
col.itemR(bone, "parent", text="")
else:
col.item_pointerR(bone, "parent", arm, "edit_bones", text="")
row = col.row()
row.active = bone.parent != None
row.itemR(bone, "connected")
col.itemL(text="Layers:")
col.itemR(bone, "layer", text="")
col = split.column()
col.itemL(text="Inherit:")
col.itemR(bone, "hinge", text="Rotation")
col.itemR(bone, "inherit_scale", text="Scale")
col.itemL(text="Display:")
col.itemR(bone, "draw_wire", text="Wireframe")
col.itemR(bone, "hidden", text="Hide")
if ob and pchan:
split = layout.split()
col = split.column()
col.itemL(text="Bone Group:")
col.item_pointerR(pchan, "bone_group", ob.pose, "bone_groups", text="")
col = split.column()
col.itemL(text="Custom Shape:")
col.itemR(pchan, "custom_shape", text="")
class BONE_PT_inverse_kinematics(BoneButtonsPanel):
__label__ = "Inverse Kinematics"
__default_closed__ = True
def poll(self, context):
ob = context.object
bone = context.bone
if ob and context.bone:
pchan = ob.pose.pose_channels[context.bone.name]
return pchan.has_ik
return False
def draw(self, context):
layout = self.layout
ob = context.object
bone = context.bone
pchan = ob.pose.pose_channels[context.bone.name]
split = layout.split(percentage=0.25)
split.itemR(pchan, "ik_dof_x", text="X")
row = split.row()
row.itemR(pchan, "ik_stiffness_x", text="Stiffness")
row.active = pchan.ik_dof_x
split = layout.split(percentage=0.25)
row = split.row()
row.itemR(pchan, "ik_limit_x", text="Limit")
row.active = pchan.ik_dof_x
row = split.row(align=True)
row.itemR(pchan, "ik_min_x", text="")
row.itemR(pchan, "ik_max_x", text="")
row.active = pchan.ik_dof_x and pchan.ik_limit_x
split = layout.split(percentage=0.25)
split.itemR(pchan, "ik_dof_y", text="Y")
row = split.row()
row.itemR(pchan, "ik_stiffness_y", text="Stiffness")
row.active = pchan.ik_dof_y
split = layout.split(percentage=0.25)
row = split.row()
row.itemR(pchan, "ik_limit_y", text="Limit")
row.active = pchan.ik_dof_y
row = split.row(align=True)
row.itemR(pchan, "ik_min_y", text="")
row.itemR(pchan, "ik_max_y", text="")
row.active = pchan.ik_dof_y and pchan.ik_limit_y
split = layout.split(percentage=0.25)
split.itemR(pchan, "ik_dof_z", text="Z")
row = split.row()
row.itemR(pchan, "ik_stiffness_z", text="Stiffness")
row.active = pchan.ik_dof_z
split = layout.split(percentage=0.25)
row = split.row()
row.itemR(pchan, "ik_limit_z", text="Limit")
row.active = pchan.ik_dof_z
row = split.row(align=True)
row.itemR(pchan, "ik_min_z", text="")
row.itemR(pchan, "ik_max_z", text="")
row.active = pchan.ik_dof_z and pchan.ik_limit_z
split = layout.split()
split.itemR(pchan, "ik_stretch", text="Stretch")
split.itemL()
class BONE_PT_deform(BoneButtonsPanel):
__label__ = "Deform"
__default_closed__ = True
def draw_header(self, context):
bone = context.bone
if not bone:
bone = context.edit_bone
self.layout.itemR(bone, "deform", text="")
def draw(self, context):
layout = self.layout
bone = context.bone
if not bone:
bone = context.edit_bone
layout.active = bone.deform
split = layout.split()
col = split.column()
col.itemL(text="Envelope:")
sub = col.column(align=True)
sub.itemR(bone, "envelope_distance", text="Distance")
sub.itemR(bone, "envelope_weight", text="Weight")
col.itemR(bone, "multiply_vertexgroup_with_envelope", text="Multiply")
sub = col.column(align=True)
sub.itemL(text="Radius:")
sub.itemR(bone, "head_radius", text="Head")
sub.itemR(bone, "tail_radius", text="Tail")
col = split.column()
col.itemL(text="Curved Bones:")
sub = col.column(align=True)
sub.itemR(bone, "bbone_segments", text="Segments")
sub.itemR(bone, "bbone_in", text="Ease In")
sub.itemR(bone, "bbone_out", text="Ease Out")
col.itemL(text="Offset:")
col.itemR(bone, "cyclic_offset")
bpy.types.register(BONE_PT_context_bone)
bpy.types.register(BONE_PT_transform)
bpy.types.register(BONE_PT_transform_locks)
bpy.types.register(BONE_PT_bone)
bpy.types.register(BONE_PT_deform)
bpy.types.register(BONE_PT_inverse_kinematics)

View File

@@ -0,0 +1,97 @@
import bpy
class DataButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "data"
def poll(self, context):
return (context.camera)
class DATA_PT_context_camera(DataButtonsPanel):
__show_header__ = False
def draw(self, context):
layout = self.layout
ob = context.object
cam = context.camera
space = context.space_data
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "data")
split.itemS()
elif cam:
split.template_ID(space, "pin_id")
split.itemS()
class DATA_PT_camera(DataButtonsPanel):
__label__ = "Lens"
def draw(self, context):
layout = self.layout
cam = context.camera
layout.itemR(cam, "type", expand=True)
row = layout.row(align=True)
if cam.type == 'PERSP':
row.itemR(cam, "lens_unit", text="")
if cam.lens_unit == 'MILLIMETERS':
row.itemR(cam, "lens", text="Angle")
elif cam.lens_unit == 'DEGREES':
row.itemR(cam, "angle")
elif cam.type == 'ORTHO':
row.itemR(cam, "ortho_scale")
layout.itemR(cam, "panorama")
split = layout.split()
col = split.column(align=True)
col.itemL(text="Shift:")
col.itemR(cam, "shift_x", text="X")
col.itemR(cam, "shift_y", text="Y")
col = split.column(align=True)
col.itemL(text="Clipping:")
col.itemR(cam, "clip_start", text="Start")
col.itemR(cam, "clip_end", text="End")
layout.itemL(text="Depth of Field:")
row = layout.row()
row.itemR(cam, "dof_object", text="")
row.itemR(cam, "dof_distance", text="Distance")
class DATA_PT_camera_display(DataButtonsPanel):
__label__ = "Display"
def draw(self, context):
layout = self.layout
cam = context.camera
split = layout.split()
col = split.column()
col.itemR(cam, "show_limits", text="Limits")
col.itemR(cam, "show_mist", text="Mist")
col.itemR(cam, "show_title_safe", text="Title Safe")
col.itemR(cam, "show_name", text="Name")
col = split.column()
col.itemR(cam, "show_passepartout", text="Passepartout")
sub = col.column()
sub.active = cam.show_passepartout
sub.itemR(cam, "passepartout_alpha", text="Alpha", slider=True)
col.itemR(cam, "draw_size", text="Size")
bpy.types.register(DATA_PT_context_camera)
bpy.types.register(DATA_PT_camera)
bpy.types.register(DATA_PT_camera_display)

View File

@@ -0,0 +1,225 @@
import bpy
class DataButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "data"
def poll(self, context):
return (context.object and context.object.type in ('CURVE', 'SURFACE') and context.curve)
class DataButtonsPanelCurve(DataButtonsPanel):
'''
Same as above but for curves only
'''
def poll(self, context):
return (context.object and context.object.type == 'CURVE' and context.curve)
class DataButtonsPanelActive(DataButtonsPanel):
'''
Same as above but for curves only
'''
def poll(self, context):
curve = context.curve
return (curve and curve.active_spline)
class DATA_PT_context_curve(DataButtonsPanel):
__show_header__ = False
def draw(self, context):
layout = self.layout
ob = context.object
curve = context.curve
space = context.space_data
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "data")
split.itemS()
elif curve:
split.template_ID(space, "pin_id")
split.itemS()
class DATA_PT_shape_curve(DataButtonsPanel):
__label__ = "Shape"
def draw(self, context):
layout = self.layout
ob = context.object
curve = context.curve
space = context.space_data
is_surf = (ob.type == 'SURFACE')
if not is_surf:
row = layout.row()
row.itemR(curve, "curve_2d")
split = layout.split()
col = split.column()
if not is_surf:
sub = col.column()
sub.active = curve.curve_2d
sub.itemL(text="Caps:")
row = sub.row()
row.itemR(curve, "front")
row.itemR(curve, "back")
col.itemL(text="Textures:")
# col.itemR(curve, "uv_orco")
col.itemR(curve, "auto_texspace")
col = split.column()
col.itemL(text="Resolution:")
sub = col.column(align=True)
sub.itemR(curve, "resolution_u", text="Preview U")
sub.itemR(curve, "render_resolution_u", text="Render U")
if is_surf:
sub = col.column(align=True)
sub.itemR(curve, "resolution_v", text="Preview V")
sub.itemR(curve, "render_resolution_v", text="Render V")
# XXX - put somewhere nicer.
row= layout.row()
row.itemR(curve, "twist_mode")
row.itemR(curve, "twist_smooth") # XXX - may not be kept
# col.itemL(text="Display:")
# col.itemL(text="HANDLES")
# col.itemL(text="NORMALS")
# col.itemR(curve, "vertex_normal_flip")
class DATA_PT_geometry_curve(DataButtonsPanelCurve):
__label__ = "Geometry "
def draw(self, context):
layout = self.layout
curve = context.curve
split = layout.split()
col = split.column()
col.itemL(text="Modification:")
col.itemR(curve, "width")
col.itemR(curve, "extrude")
col.itemR(curve, "taper_object", icon='ICON_OUTLINER_OB_CURVE')
col = split.column()
col.itemL(text="Bevel:")
col.itemR(curve, "bevel_depth", text="Depth")
col.itemR(curve, "bevel_resolution", text="Resolution")
col.itemR(curve, "bevel_object", icon='ICON_OUTLINER_OB_CURVE')
class DATA_PT_pathanim(DataButtonsPanelCurve):
__label__ = "Path Animation"
def draw_header(self, context):
curve = context.curve
self.layout.itemR(curve, "use_path", text="")
def draw(self, context):
layout = self.layout
curve = context.curve
layout.active = curve.use_path
split = layout.split()
col = split.column()
col.itemR(curve, "path_length", text="Frames")
col.itemR(curve, "use_path_follow")
col = split.column()
col.itemR(curve, "use_stretch")
col.itemR(curve, "use_time_offset", text="Offset Children")
class DATA_PT_active_spline(DataButtonsPanelActive):
__label__ = "Active Spline"
def draw(self, context):
layout = self.layout
ob = context.object
curve = context.curve
act_spline = curve.active_spline
is_surf = (ob.type == 'SURFACE')
is_poly = (act_spline.type == 'POLY')
split = layout.split()
if is_poly:
# These settings are below but its easier to have
# poly's set aside since they use so few settings
col = split.column()
col.itemL(text="Cyclic:")
col.itemR(act_spline, "smooth")
col = split.column()
col.itemR(act_spline, "cyclic_u", text="U")
else:
col = split.column()
col.itemL(text="Cyclic:")
if act_spline.type == 'NURBS':
col.itemL(text="Bezier:")
col.itemL(text="Endpoint:")
col.itemL(text="Order:")
col.itemL(text="Resolution:")
col = split.column()
col.itemR(act_spline, "cyclic_u", text="U")
if act_spline.type == 'NURBS':
sub = col.column()
# sub.active = (not act_spline.cyclic_u)
sub.itemR(act_spline, "bezier_u", text="U")
sub.itemR(act_spline, "endpoint_u", text="U")
sub = col.column()
sub.itemR(act_spline, "order_u", text="U")
col.itemR(act_spline, "resolution_u", text="U")
if is_surf:
col = split.column()
col.itemR(act_spline, "cyclic_v", text="V")
# its a surface, assume its a nurb.
sub = col.column()
sub.active = (not act_spline.cyclic_v)
sub.itemR(act_spline, "bezier_v", text="V")
sub.itemR(act_spline, "endpoint_v", text="V")
sub = col.column()
sub.itemR(act_spline, "order_v", text="V")
sub.itemR(act_spline, "resolution_v", text="V")
if not is_surf:
split = layout.split()
col = split.column()
col.active = (not curve.curve_2d)
col.itemL(text="Interpolation:")
col.itemR(act_spline, "tilt_interpolation", text="Tilt")
col.itemR(act_spline, "radius_interpolation", text="Radius")
split = layout.split()
col = split.column()
col.itemR(act_spline, "smooth")
bpy.types.register(DATA_PT_context_curve)
bpy.types.register(DATA_PT_shape_curve)
bpy.types.register(DATA_PT_geometry_curve)
bpy.types.register(DATA_PT_pathanim)
bpy.types.register(DATA_PT_active_spline)

View File

@@ -0,0 +1,23 @@
import bpy
class DataButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "data"
def poll(self, context):
return (context.object and context.object.type == 'EMPTY')
class DATA_PT_empty(DataButtonsPanel):
__label__ = "Empty"
def draw(self, context):
layout = self.layout
ob = context.object
layout.itemR(ob, "empty_draw_type", text="Draw Type")
layout.itemR(ob, "empty_draw_size", text="Draw Size")
bpy.types.register(DATA_PT_empty)

View File

@@ -0,0 +1,313 @@
import bpy
class DataButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "data"
def poll(self, context):
return (context.lamp)
class DATA_PT_preview(DataButtonsPanel):
__label__ = "Preview"
def draw(self, context):
self.layout.template_preview(context.lamp)
class DATA_PT_context_lamp(DataButtonsPanel):
__show_header__ = False
def draw(self, context):
layout = self.layout
ob = context.object
lamp = context.lamp
space = context.space_data
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "data")
split.itemS()
elif lamp:
split.template_ID(space, "pin_id")
split.itemS()
class DATA_PT_lamp(DataButtonsPanel):
__label__ = "Lamp"
def draw(self, context):
layout = self.layout
lamp = context.lamp
layout.itemR(lamp, "type", expand=True)
split = layout.split()
col = split.column()
sub = col.column()
sub.itemR(lamp, "color", text="")
sub.itemR(lamp, "energy")
if lamp.type in ('POINT', 'SPOT'):
sub.itemL(text="Falloff:")
sub.itemR(lamp, "falloff_type", text="")
sub.itemR(lamp, "distance")
if lamp.falloff_type == 'LINEAR_QUADRATIC_WEIGHTED':
col.itemL(text="Attenuation Factors:")
sub = col.column(align=True)
sub.itemR(lamp, "linear_attenuation", slider=True, text="Linear")
sub.itemR(lamp, "quadratic_attenuation", slider=True, text="Quadratic")
col.itemR(lamp, "sphere")
if lamp.type == 'AREA':
col.itemR(lamp, "distance")
col.itemR(lamp, "gamma")
col = split.column()
col.itemR(lamp, "negative")
col.itemR(lamp, "layer", text="This Layer Only")
col.itemR(lamp, "specular")
col.itemR(lamp, "diffuse")
class DATA_PT_sunsky(DataButtonsPanel):
__label__ = "Sun/Sky"
def poll(self, context):
lamp = context.lamp
return (lamp and lamp.type == 'SUN')
def draw(self, context):
layout = self.layout
lamp = context.lamp.sky
row = layout.row()
row.itemR(lamp, "sky")
row.itemR(lamp, "atmosphere")
row = layout.row()
row.active = lamp.sky or lamp.atmosphere
row.itemR(lamp, "atmosphere_turbidity", text="Turbidity")
split = layout.split()
col = split.column()
col.active = lamp.sky
col.itemL(text="Blend Mode:")
sub = col.column(align=True)
sub.itemR(lamp, "sky_blend_type", text="")
sub.itemR(lamp, "sky_blend", text="Factor")
col.itemL(text="Color Space:")
sub = col.column(align=True)
sub.itemR(lamp, "sky_color_space", text="")
sub.itemR(lamp, "sky_exposure", text="Exposure")
col = split.column()
col.active = lamp.sky
col.itemL(text="Horizon:")
sub = col.column(align=True)
sub.itemR(lamp, "horizon_brightness", text="Brightness")
sub.itemR(lamp, "spread", text="Spread")
col.itemL(text="Sun:")
sub = col.column(align=True)
sub.itemR(lamp, "sun_brightness", text="Brightness")
sub.itemR(lamp, "sun_size", text="Size")
sub.itemR(lamp, "backscattered_light", slider=True,text="Back Light")
layout.itemS()
split = layout.split()
col = split.column()
col.active = lamp.atmosphere
col.itemL(text="Sun:")
col.itemR(lamp, "sun_intensity", text="Intensity")
col.itemL(text="Scale Distance:")
col.itemR(lamp, "atmosphere_distance_factor", text="Distance")
col = split.column()
col.active = lamp.atmosphere
col.itemL(text="Scattering:")
sub = col.column(align=True)
sub.itemR(lamp, "atmosphere_inscattering", slider=True, text="Inscattering")
sub.itemR(lamp, "atmosphere_extinction", slider=True ,text="Extinction")
class DATA_PT_shadow(DataButtonsPanel):
__label__ = "Shadow"
def poll(self, context):
lamp = context.lamp
return (lamp and lamp.type in ('POINT','SUN', 'SPOT', 'AREA'))
def draw(self, context):
layout = self.layout
lamp = context.lamp
layout.itemR(lamp, "shadow_method", expand=True)
if lamp.shadow_method != 'NOSHADOW':
split = layout.split()
col = split.column()
col.itemR(lamp, "shadow_color", text="")
col = split.column()
col.itemR(lamp, "shadow_layer", text="This Layer Only")
col.itemR(lamp, "only_shadow")
if lamp.shadow_method == 'RAY_SHADOW':
col = layout.column()
col.itemL(text="Sampling:")
col.row().itemR(lamp, "shadow_ray_sampling_method", expand=True)
if lamp.type in ('POINT', 'SUN', 'SPOT'):
split = layout.split()
col = split.column()
col.itemR(lamp, "shadow_soft_size", text="Soft Size")
col.itemR(lamp, "shadow_ray_samples", text="Samples")
if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
col.itemR(lamp, "shadow_adaptive_threshold", text="Threshold")
col = split.column()
elif lamp.type == 'AREA':
split = layout.split()
col = split.column()
sub = split.column(align=True)
if lamp.shape == 'SQUARE':
col.itemR(lamp, "shadow_ray_samples_x", text="Samples")
elif lamp.shape == 'RECTANGLE':
col.itemR(lamp, "shadow_ray_samples_x", text="Samples X")
col.itemR(lamp, "shadow_ray_samples_y", text="Samples Y")
if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
col.itemR(lamp, "shadow_adaptive_threshold", text="Threshold")
elif lamp.shadow_ray_sampling_method == 'CONSTANT_JITTERED':
sub.itemR(lamp, "umbra")
sub.itemR(lamp, "dither")
sub.itemR(lamp, "jitter")
if lamp.shadow_method == 'BUFFER_SHADOW':
col = layout.column()
col.itemL(text="Buffer Type:")
col.row().itemR(lamp, "shadow_buffer_type", expand=True)
if lamp.shadow_buffer_type in ('REGULAR', 'HALFWAY'):
split = layout.split()
col = split.column()
col.itemL(text="Filter Type:")
col.itemR(lamp, "shadow_filter_type", text="")
sub = col.column(align=True)
sub.itemR(lamp, "shadow_buffer_soft", text="Soft")
sub.itemR(lamp, "shadow_buffer_bias", text="Bias")
col = split.column()
col.itemL(text="Sample Buffers:")
col.itemR(lamp, "shadow_sample_buffers", text="")
sub = col.column(align=True)
sub.itemR(lamp, "shadow_buffer_size", text="Size")
sub.itemR(lamp, "shadow_buffer_samples", text="Samples")
elif lamp.shadow_buffer_type == 'IRREGULAR':
layout.itemR(lamp, "shadow_buffer_bias", text="Bias")
row = layout.row()
row.itemR(lamp, "auto_clip_start", text="Autoclip Start")
sub = row.row()
sub.active = not lamp.auto_clip_start
sub.itemR(lamp, "shadow_buffer_clip_start", text="Clip Start")
row = layout.row()
row.itemR(lamp, "auto_clip_end", text="Autoclip End")
sub = row.row()
sub.active = not lamp.auto_clip_end
sub.itemR(lamp, "shadow_buffer_clip_end", text=" Clip End")
class DATA_PT_area(DataButtonsPanel):
__label__ = "Area Shape"
def poll(self, context):
lamp = context.lamp
return (lamp and lamp.type == 'AREA')
def draw(self, context):
layout = self.layout
lamp = context.lamp
split = layout.split()
col = split.column()
col.itemR(lamp, "shape", text="")
sub = col.column(align=True)
if (lamp.shape == 'SQUARE'):
sub.itemR(lamp, "size")
elif (lamp.shape == 'RECTANGLE'):
sub.itemR(lamp, "size", text="Size X")
sub.itemR(lamp, "size_y", text="Size Y")
col = split.column()
class DATA_PT_spot(DataButtonsPanel):
__label__ = "Spot Shape"
def poll(self, context):
lamp = context.lamp
return (lamp and lamp.type == 'SPOT')
def draw(self, context):
layout = self.layout
lamp = context.lamp
split = layout.split()
col = split.column()
sub = col.column(align=True)
sub.itemR(lamp, "spot_size", text="Size")
sub.itemR(lamp, "spot_blend", text="Blend")
col.itemR(lamp, "square")
col = split.column()
col.itemR(lamp, "halo")
sub = col.column(align=True)
sub.active = lamp.halo
sub.itemR(lamp, "halo_intensity", text="Intensity")
if lamp.shadow_method == 'BUFFER_SHADOW':
sub.itemR(lamp, "halo_step", text="Step")
class DATA_PT_falloff_curve(DataButtonsPanel):
__label__ = "Falloff Curve"
__default_closed__ = True
def poll(self, context):
lamp = context.lamp
return (lamp and lamp.type in ('POINT', 'SPOT') and lamp.falloff_type == 'CUSTOM_CURVE')
def draw(self, context):
lamp = context.lamp
self.layout.template_curve_mapping(lamp.falloff_curve)
bpy.types.register(DATA_PT_context_lamp)
bpy.types.register(DATA_PT_preview)
bpy.types.register(DATA_PT_lamp)
bpy.types.register(DATA_PT_falloff_curve)
bpy.types.register(DATA_PT_area)
bpy.types.register(DATA_PT_spot)
bpy.types.register(DATA_PT_shadow)
bpy.types.register(DATA_PT_sunsky)

View File

@@ -0,0 +1,56 @@
import bpy
class DataButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "data"
def poll(self, context):
return (context.lattice)
class DATA_PT_context_lattice(DataButtonsPanel):
__show_header__ = False
def draw(self, context):
layout = self.layout
ob = context.object
lat = context.lattice
space = context.space_data
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "data")
split.itemS()
elif lat:
split.template_ID(space, "pin_id")
split.itemS()
class DATA_PT_lattice(DataButtonsPanel):
__label__ = "Lattice"
def draw(self, context):
layout = self.layout
lat = context.lattice
row = layout.row()
row.itemR(lat, "points_u")
row.itemR(lat, "interpolation_type_u", expand=True)
row = layout.row()
row.itemR(lat, "points_v")
row.itemR(lat, "interpolation_type_v", expand=True)
row = layout.row()
row.itemR(lat, "points_w")
row.itemR(lat, "interpolation_type_w", expand=True)
row = layout.row()
row.itemO("lattice.make_regular")
row.itemR(lat, "outside")
bpy.types.register(DATA_PT_context_lattice)
bpy.types.register(DATA_PT_lattice)

View File

@@ -0,0 +1,203 @@
import bpy
class DataButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "data"
def poll(self, context):
return (context.mesh)
class DATA_PT_context_mesh(DataButtonsPanel):
__show_header__ = False
def draw(self, context):
layout = self.layout
ob = context.object
mesh = context.mesh
space = context.space_data
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "data")
split.itemS()
elif mesh:
split.template_ID(space, "pin_id")
split.itemS()
class DATA_PT_normals(DataButtonsPanel):
__label__ = "Normals"
def draw(self, context):
layout = self.layout
mesh = context.mesh
split = layout.split()
col = split.column()
col.itemR(mesh, "autosmooth")
sub = col.column()
sub.active = mesh.autosmooth
sub.itemR(mesh, "autosmooth_angle", text="Angle")
col = split.column()
col.itemR(mesh, "vertex_normal_flip")
col.itemR(mesh, "double_sided")
class DATA_PT_vertex_groups(DataButtonsPanel):
__label__ = "Vertex Groups"
def poll(self, context):
return (context.object and context.object.type in ('MESH', 'LATTICE'))
def draw(self, context):
layout = self.layout
ob = context.object
row = layout.row()
row.template_list(ob, "vertex_groups", ob, "active_vertex_group_index")
col = row.column(align=True)
col.itemO("object.vertex_group_add", icon='ICON_ZOOMIN', text="")
col.itemO("object.vertex_group_remove", icon='ICON_ZOOMOUT', text="")
col.itemO("object.vertex_group_copy", icon='ICON_BLANK1', text="")
if ob.data.users > 1:
col.itemO("object.vertex_group_copy_to_linked", icon='ICON_BLANK1', text="")
group = ob.active_vertex_group
if group:
row = layout.row()
row.itemR(group, "name")
if ob.mode == 'EDIT':
row = layout.row()
sub = row.row(align=True)
sub.itemO("object.vertex_group_assign", text="Assign")
sub.itemO("object.vertex_group_remove_from", text="Remove")
sub = row.row(align=True)
sub.itemO("object.vertex_group_select", text="Select")
sub.itemO("object.vertex_group_deselect", text="Deselect")
layout.itemR(context.tool_settings, "vertex_group_weight", text="Weight")
class DATA_PT_shape_keys(DataButtonsPanel):
__label__ = "Shape Keys"
def poll(self, context):
return (context.object and context.object.type in ('MESH', 'LATTICE'))
def draw(self, context):
layout = self.layout
ob = context.object
key = ob.data.shape_keys
kb = ob.active_shape_key
row = layout.row()
row.template_list(key, "keys", ob, "active_shape_key_index", rows=2)
col = row.column()
subcol = col.column(align=True)
subcol.itemO("object.shape_key_add", icon='ICON_ZOOMIN', text="")
subcol.itemO("object.shape_key_remove", icon='ICON_ZOOMOUT', text="")
if kb:
col.itemS()
subcol = col.column(align=True)
subcol.itemR(ob, "shape_key_lock", icon='ICON_UNPINNED', text="")
subcol.itemR(kb, "mute", icon='ICON_MUTE_IPO_ON', text="")
if key.relative:
row = layout.row()
row.itemR(key, "relative")
row.itemL()
row = layout.row()
row.itemR(kb, "name")
if ob.active_shape_key_index != 0:
row = layout.row()
row.enabled = ob.shape_key_lock == False
row.itemR(kb, "value", slider=True)
split = layout.split()
sub = split.column(align=True)
sub.enabled = ob.shape_key_lock == False
sub.itemL(text="Range:")
sub.itemR(kb, "slider_min", text="Min")
sub.itemR(kb, "slider_max", text="Max")
sub = split.column()
sub.itemL(text="Blend:")
sub.item_pointerR(kb, "vertex_group", ob, "vertex_groups", text="")
sub.item_pointerR(kb, "relative_key", key, "keys", text="")
else:
row = layout.row()
row.itemR(key, "relative")
row.itemR(key, "slurph")
layout.itemR(kb, "name")
if ob.mode == 'EDIT':
layout.enabled = False
class DATA_PT_uv_texture(DataButtonsPanel):
__label__ = "UV Texture"
def draw(self, context):
layout = self.layout
me = context.mesh
row = layout.row()
col = row.column()
col.template_list(me, "uv_textures", me, "active_uv_texture_index", rows=2)
col = row.column(align=True)
col.itemO("mesh.uv_texture_add", icon='ICON_ZOOMIN', text="")
col.itemO("mesh.uv_texture_remove", icon='ICON_ZOOMOUT', text="")
lay = me.active_uv_texture
if lay:
layout.itemR(lay, "name")
class DATA_PT_vertex_colors(DataButtonsPanel):
__label__ = "Vertex Colors"
def draw(self, context):
layout = self.layout
me = context.mesh
row = layout.row()
col = row.column()
col.template_list(me, "vertex_colors", me, "active_vertex_color_index", rows=2)
col = row.column(align=True)
col.itemO("mesh.vertex_color_add", icon='ICON_ZOOMIN', text="")
col.itemO("mesh.vertex_color_remove", icon='ICON_ZOOMOUT', text="")
lay = me.active_vertex_color
if lay:
layout.itemR(lay, "name")
bpy.types.register(DATA_PT_context_mesh)
bpy.types.register(DATA_PT_normals)
bpy.types.register(DATA_PT_vertex_groups)
bpy.types.register(DATA_PT_shape_keys)
bpy.types.register(DATA_PT_uv_texture)
bpy.types.register(DATA_PT_vertex_colors)

View File

@@ -0,0 +1,112 @@
import bpy
class DataButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "data"
def poll(self, context):
return (context.meta_ball)
class DATA_PT_context_metaball(DataButtonsPanel):
__show_header__ = False
def draw(self, context):
layout = self.layout
ob = context.object
mball = context.meta_ball
space = context.space_data
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "data")
split.itemS()
elif mball:
split.template_ID(space, "pin_id")
split.itemS()
class DATA_PT_metaball(DataButtonsPanel):
__label__ = "Metaball"
def draw(self, context):
layout = self.layout
mball = context.meta_ball
split = layout.split()
col = split.column()
col.itemL(text="Resolution:")
sub = col.column(align=True)
sub.itemR(mball, "wire_size", text="View")
sub.itemR(mball, "render_size", text="Render")
col = split.column()
col.itemL(text="Settings:")
col.itemR(mball, "threshold", text="Threshold")
layout.itemL(text="Update:")
layout.itemR(mball, "flag", expand=True)
class DATA_PT_metaball_element(DataButtonsPanel):
__label__ = "Active Element"
def poll(self, context):
return (context.meta_ball and context.meta_ball.active_element)
def draw(self, context):
layout = self.layout
metaelem = context.meta_ball.active_element
split = layout.split(percentage=0.3)
split.itemL(text="Type:")
split.itemR(metaelem, "type", text="")
split = layout.split()
col = split.column()
col.itemL(text="Settings:")
col.itemR(metaelem, "stiffness", text="Stiffness")
col.itemR(metaelem, "negative", text="Negative")
col.itemR(metaelem, "hide", text="Hide")
if metaelem.type == 'BALL':
col = split.column(align=True)
elif metaelem.type == 'CUBE':
col = split.column(align=True)
col.itemL(text="Size:")
col.itemR(metaelem, "size_x", text="X")
col.itemR(metaelem, "size_y", text="Y")
col.itemR(metaelem, "size_z", text="Z")
elif metaelem.type == 'TUBE':
col = split.column(align=True)
col.itemL(text="Size:")
col.itemR(metaelem, "size_x", text="X")
elif metaelem.type == 'PLANE':
col = split.column(align=True)
col.itemL(text="Size:")
col.itemR(metaelem, "size_x", text="X")
col.itemR(metaelem, "size_y", text="Y")
elif metaelem.type == 'ELLIPSOID':
col = split.column(align=True)
col.itemL(text="Size:")
col.itemR(metaelem, "size_x", text="X")
col.itemR(metaelem, "size_y", text="Y")
col.itemR(metaelem, "size_z", text="Z")
bpy.types.register(DATA_PT_context_metaball)
bpy.types.register(DATA_PT_metaball)
bpy.types.register(DATA_PT_metaball_element)

View File

@@ -0,0 +1,449 @@
import bpy
class DataButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "modifier"
class DATA_PT_modifiers(DataButtonsPanel):
__label__ = "Modifiers"
def draw(self, context):
layout = self.layout
ob = context.object
row = layout.row()
row.item_menu_enumO("object.modifier_add", "type")
row.itemL()
for md in ob.modifiers:
box = layout.template_modifier(md)
if box:
# match enum type to our functions, avoids a lookup table.
getattr(self, md.type)(box, ob, md)
# the mt.type enum is (ab)used for a lookup on function names
# ...to avoid lengthy if statements
# so each type must have a function here.
def ARMATURE(self, layout, ob, md):
layout.itemR(md, "object")
split = layout.split(percentage=0.5)
split.itemL(text="Vertex Group:")
sub = split.split(percentage=0.7)
sub.item_pointerR(md, "vertex_group", ob, "vertex_groups", text="")
subsub = sub.row()
subsub.active = md.vertex_group
subsub.itemR(md, "invert")
layout.itemS()
split = layout.split()
col = split.column()
col.itemL(text="Bind To:")
col.itemR(md, "use_vertex_groups", text="Vertex Groups")
col.itemR(md, "use_bone_envelopes", text="Bone Envelopes")
col = split.column()
col.itemL(text="Deformation:")
col.itemR(md, "quaternion")
col.itemR(md, "multi_modifier")
def ARRAY(self, layout, ob, md):
layout.itemR(md, "fit_type")
if md.fit_type == 'FIXED_COUNT':
layout.itemR(md, "count")
elif md.fit_type == 'FIT_LENGTH':
layout.itemR(md, "length")
elif md.fit_type == 'FIT_CURVE':
layout.itemR(md, "curve")
layout.itemS()
split = layout.split()
col = split.column()
col.itemR(md, "constant_offset")
sub = col.column()
sub.active = md.constant_offset
sub.itemR(md, "constant_offset_displacement", text="")
col.itemS()
col.itemR(md, "merge_adjacent_vertices", text="Merge")
sub = col.column()
sub.active = md.merge_adjacent_vertices
sub.itemR(md, "merge_end_vertices", text="First Last")
sub.itemR(md, "merge_distance", text="Distance")
col = split.column()
col.itemR(md, "relative_offset")
sub = col.column()
sub.active = md.relative_offset
sub.itemR(md, "relative_offset_displacement", text="")
col.itemS()
col.itemR(md, "add_offset_object")
sub = col.column()
sub.active = md.add_offset_object
sub.itemR(md, "offset_object", text="")
layout.itemS()
col = layout.column()
col.itemR(md, "start_cap")
col.itemR(md, "end_cap")
def BEVEL(self, layout, ob, md):
row = layout.row()
row.itemR(md, "width")
row.itemR(md, "only_vertices")
layout.itemL(text="Limit Method:")
layout.row().itemR(md, "limit_method", expand=True)
if md.limit_method == 'ANGLE':
layout.itemR(md, "angle")
elif md.limit_method == 'WEIGHT':
layout.row().itemR(md, "edge_weight_method", expand=True)
def BOOLEAN(self, layout, ob, md):
layout.itemR(md, "operation")
layout.itemR(md, "object")
def BUILD(self, layout, ob, md):
split = layout.split()
col = split.column()
col.itemR(md, "start")
col.itemR(md, "length")
col = split.column()
col.itemR(md, "randomize")
sub = col.column()
sub.active = md.randomize
sub.itemR(md, "seed")
def CAST(self, layout, ob, md):
layout.itemR(md, "cast_type")
layout.itemR(md, "object")
if md.object:
layout.itemR(md, "use_transform")
flow = layout.column_flow()
flow.itemR(md, "x")
flow.itemR(md, "y")
flow.itemR(md, "z")
flow.itemR(md, "factor")
flow.itemR(md, "radius")
flow.itemR(md, "size")
layout.itemR(md, "from_radius")
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
def CLOTH(self, layout, ob, md):
layout.itemL(text="See Cloth panel.")
def COLLISION(self, layout, ob, md):
layout.itemL(text="See Collision panel.")
def CURVE(self, layout, ob, md):
layout.itemR(md, "object")
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "deform_axis")
def DECIMATE(self, layout, ob, md):
layout.itemR(md, "ratio")
layout.itemR(md, "face_count")
def DISPLACE(self, layout, ob, md):
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "texture")
layout.itemR(md, "midlevel")
layout.itemR(md, "strength")
layout.itemR(md, "direction")
layout.itemR(md, "texture_coordinates")
if md.texture_coordinates == 'OBJECT':
layout.itemR(md, "texture_coordinate_object", text="Object")
elif md.texture_coordinates == 'UV' and ob.type == 'MESH':
layout.item_pointerR(md, "uv_layer", ob.data, "uv_textures")
def EDGE_SPLIT(self, layout, ob, md):
split = layout.split()
col = split.column()
col.itemR(md, "use_edge_angle", text="Edge Angle")
sub = col.column()
sub.active = md.use_edge_angle
sub.itemR(md, "split_angle")
col = split.column()
col.itemR(md, "use_sharp", text="Sharp Edges")
def EXPLODE(self, layout, ob, md):
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "protect")
flow = layout.column_flow(2)
flow.itemR(md, "split_edges")
flow.itemR(md, "unborn")
flow.itemR(md, "alive")
flow.itemR(md, "dead")
layout.itemO("object.explode_refresh", text="Refresh");
def FLUID_SIMULATION(self, layout, ob, md):
layout.itemL(text="See Fluid panel.")
def HOOK(self, layout, ob, md):
col = layout.column()
col.itemR(md, "object")
if md.object and md.object.type == 'ARMATURE':
layout.item_pointerR(md, "subtarget", md.object.data, "bones", text="Bone")
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
split = layout.split()
split.itemR(md, "falloff")
split.itemR(md, "force", slider=True)
layout.itemS()
row = layout.row()
row.itemO("object.hook_reset", text="Reset")
row.itemO("object.hook_recenter", text="Recenter")
if ob.mode == 'EDIT':
row = layout.row()
row.itemO("object.hook_select", text="Select")
row.itemO("object.hook_assign", text="Assign")
def LATTICE(self, layout, ob, md):
layout.itemR(md, "object")
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
def MASK(self, layout, ob, md):
layout.itemR(md, "mode")
if md.mode == 'ARMATURE':
layout.itemR(md, "armature")
elif md.mode == 'VERTEX_GROUP':
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "inverse")
def MESH_DEFORM(self, layout, ob, md):
layout.itemR(md, "object")
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "invert")
layout.itemS()
if md.is_bound:
layout.itemO("object.meshdeform_bind", text="Unbind")
else:
layout.itemO("object.meshdeform_bind", text="Bind")
row = layout.row()
row.itemR(md, "precision")
row.itemR(md, "dynamic")
def MIRROR(self, layout, ob, md):
layout.itemR(md, "merge_limit")
split = layout.split()
col = split.column()
col.itemR(md, "x")
col.itemR(md, "y")
col.itemR(md, "z")
col = split.column()
col.itemL(text="Textures:")
col.itemR(md, "mirror_u")
col.itemR(md, "mirror_v")
col = split.column()
col.itemR(md, "clip", text="Do Clipping")
col.itemR(md, "mirror_vertex_groups", text="Vertex Group")
layout.itemR(md, "mirror_object")
def MULTIRES(self, layout, ob, md):
layout.itemR(md, "subdivision_type")
row = layout.row()
row.itemO("object.multires_subdivide", text="Subdivide")
row.itemO("object.multires_higher_levels_delete", text="Delete Higher")
layout.itemR(md, "level")
def PARTICLE_INSTANCE(self, layout, ob, md):
layout.itemR(md, "object")
layout.itemR(md, "particle_system_number")
flow = layout.column_flow()
flow.itemR(md, "normal")
flow.itemR(md, "children")
flow.itemR(md, "size")
flow.itemR(md, "path")
if md.path:
flow.itemR(md, "keep_shape")
flow.itemR(md, "unborn")
flow.itemR(md, "alive")
flow.itemR(md, "dead")
flow.itemL(md, "")
if md.path:
flow.itemR(md, "axis", text="")
if md.path:
row = layout.row()
row.itemR(md, "position", slider=True)
row.itemR(md, "random_position", text = "Random", slider=True)
def PARTICLE_SYSTEM(self, layout, ob, md):
layout.itemL(text="See Particle panel.")
def SHRINKWRAP(self, layout, ob, md):
layout.itemR(md, "target")
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "offset")
layout.itemR(md, "subsurf_levels")
layout.itemR(md, "mode")
if md.mode == 'PROJECT':
layout.itemR(md, "subsurf_levels")
layout.itemR(md, "auxiliary_target")
row = layout.row()
row.itemR(md, "x")
row.itemR(md, "y")
row.itemR(md, "z")
flow = layout.column_flow()
flow.itemR(md, "negative")
flow.itemR(md, "positive")
flow.itemR(md, "cull_front_faces")
flow.itemR(md, "cull_back_faces")
elif md.mode == 'NEAREST_SURFACEPOINT':
layout.itemR(md, "keep_above_surface")
def SIMPLE_DEFORM(self, layout, ob, md):
layout.itemR(md, "mode")
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "origin")
layout.itemR(md, "relative")
layout.itemR(md, "factor")
layout.itemR(md, "limits")
if md.mode in ('TAPER', 'STRETCH'):
layout.itemR(md, "lock_x_axis")
layout.itemR(md, "lock_y_axis")
def SMOKE(self, layout, ob, md):
layout.itemL(text="See Smoke panel.")
def SMOOTH(self, layout, ob, md):
split = layout.split()
col = split.column()
col.itemR(md, "x")
col.itemR(md, "y")
col.itemR(md, "z")
col = split.column()
col.itemR(md, "factor")
col.itemR(md, "repeat")
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
def SOFT_BODY(self, layout, ob, md):
layout.itemL(text="See Soft Body panel.")
def SUBSURF(self, layout, ob, md):
layout.row().itemR(md, "subdivision_type", expand=True)
flow = layout.column_flow()
flow.itemR(md, "levels", text="Preview")
flow.itemR(md, "render_levels", text="Render")
flow.itemR(md, "optimal_draw", text="Optimal Display")
flow.itemR(md, "subsurf_uv")
def SURFACE(self, layout, ob, md):
layout.itemL(text="See Fields panel.")
def UV_PROJECT(self, layout, ob, md):
if ob.type == 'MESH':
layout.item_pointerR(md, "uv_layer", ob.data, "uv_textures")
layout.itemR(md, "image")
layout.itemR(md, "override_image")
split = layout.split()
col = split.column()
col.itemL(text="Aspect Ratio:")
sub = col.column(align=True)
sub.itemR(md, "horizontal_aspect_ratio", text="Horizontal")
sub.itemR(md, "vertical_aspect_ratio", text="Vertical")
col = split.column()
col.itemL(text="Projectors:")
sub = col.column(align=True)
sub.itemR(md, "num_projectors", text="Number")
for proj in md.projectors:
sub.itemR(proj, "object", text="")
def WAVE(self, layout, ob, md):
split = layout.split()
col = split.column()
col.itemL(text="Motion:")
col.itemR(md, "x")
col.itemR(md, "y")
col.itemR(md, "cyclic")
col = split.column()
col.itemR(md, "normals")
sub = col.column()
sub.active = md.normals
sub.itemR(md, "x_normal", text="X")
sub.itemR(md, "y_normal", text="Y")
sub.itemR(md, "z_normal", text="Z")
split = layout.split()
col = split.column()
col.itemL(text="Time:")
sub = col.column(align=True)
sub.itemR(md, "time_offset", text="Offset")
sub.itemR(md, "lifetime", text="Life")
col.itemR(md, "damping_time", text="Damping")
col = split.column()
col.itemL(text="Position:")
sub = col.column(align=True)
sub.itemR(md, "start_position_x", text="X")
sub.itemR(md, "start_position_y", text="Y")
col.itemR(md, "falloff_radius", text="Falloff")
layout.itemS()
layout.itemR(md, "start_position_object")
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "texture")
layout.itemR(md, "texture_coordinates")
if md.texture_coordinates == 'MAP_UV' and ob.type == 'MESH':
layout.item_pointerR(md, "uv_layer", ob.data, "uv_textures")
elif md.texture_coordinates == 'OBJECT':
layout.itemR(md, "texture_coordinates_object")
layout.itemS()
flow = layout.column_flow()
flow.itemR(md, "speed", slider=True)
flow.itemR(md, "height", slider=True)
flow.itemR(md, "width", slider=True)
flow.itemR(md, "narrowness", slider=True)
bpy.types.register(DATA_PT_modifiers)

View File

@@ -0,0 +1,183 @@
import bpy
class DataButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "data"
def poll(self, context):
return (context.object and context.object.type == 'TEXT' and context.curve)
class DATA_PT_context_text(DataButtonsPanel):
__show_header__ = False
def draw(self, context):
layout = self.layout
ob = context.object
curve = context.curve
space = context.space_data
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "data")
split.itemS()
elif curve:
split.template_ID(space, "pin_id")
split.itemS()
class DATA_PT_shape_text(DataButtonsPanel):
__label__ = "Shape Text"
def draw(self, context):
layout = self.layout
ob = context.object
curve = context.curve
space = context.space_data
layout.itemR(curve, "curve_2d")
split = layout.split()
col = split.column()
col.itemL(text="Caps:")
row = col.row()
row .itemR(curve, "front")
row .itemR(curve, "back")
# col = split.column()
col.itemL(text="Textures:")
col.itemR(curve, "uv_orco")
col.itemR(curve, "auto_texspace")
col = split.column()
col.itemL(text="Resolution:")
sub = col.column(align=True)
sub.itemR(curve, "resolution_u", text="Preview U")
sub.itemR(curve, "render_resolution_u", text="Render U")
# resolution_v is not used for text
sub = col.column(align=True)
col.itemL(text="Display:")
col.itemR(curve, "fast", text="Fast Editing")
class DATA_PT_geometry_text(DataButtonsPanel):
__label__ = "Geometry"
def draw(self, context):
layout = self.layout
curve = context.curve
split = layout.split()
col = split.column()
col.itemL(text="Modification:")
col.itemR(curve, "width")
col.itemR(curve, "extrude")
col.itemL(text="Taper Object:")
col.itemR(curve, "taper_object", text="")
col = split.column()
col.itemL(text="Bevel:")
col.itemR(curve, "bevel_depth", text="Depth")
col.itemR(curve, "bevel_resolution", text="Resolution")
col.itemL(text="Bevel Object:")
col.itemR(curve, "bevel_object", text="")
class DATA_PT_font(DataButtonsPanel):
__label__ = "Font"
def draw(self, context):
layout = self.layout
text = context.curve
char = context.curve.edit_format
layout.itemR(text, "font")
row = layout.row()
row.itemR(text, "text_size", text="Size")
row.itemR(text, "shear")
split = layout.split()
col = split.column()
col.itemL(text="Object Font:")
col.itemR(text, "family", text="")
col = split.column()
col.itemL(text="Text on Curve:")
col.itemR(text, "text_on_curve", text="")
split = layout.split()
col = split.column()
col.itemL(text="Character:")
col.itemR(char, "bold")
col.itemR(char, "italic")
col.itemR(char, "underline")
# col.itemR(char, "style")
# col.itemR(char, "wrap")
col = split.column(align=True)
col.itemL(text="Underline:")
col.itemR(text, "ul_position", text="Position")
col.itemR(text, "ul_height", text="Thickness")
class DATA_PT_paragraph(DataButtonsPanel):
__label__ = "Paragraph"
def draw(self, context):
layout = self.layout
text = context.curve
layout.itemL(text="Align:")
layout.itemR(text, "spacemode", expand=True)
split = layout.split()
col = split.column(align=True)
col.itemL(text="Spacing:")
col.itemR(text, "spacing", text="Character")
col.itemR(text, "word_spacing", text="Word")
col.itemR(text, "line_dist", text="Line")
col = split.column(align=True)
col.itemL(text="Offset:")
col.itemR(text, "offset_x", text="X")
col.itemR(text, "offset_y", text="Y")
class DATA_PT_textboxes(DataButtonsPanel):
__label__ = "Text Boxes"
def draw(self, context):
layout = self.layout
text = context.curve
for box in text.textboxes:
split = layout.box().split()
col = split.column(align=True)
col.itemL(text="Dimensions:")
col.itemR(box, "width", text="Width")
col.itemR(box, "height", text="Height")
col = split.column(align=True)
col.itemL(text="Offset:")
col.itemR(box, "x", text="X")
col.itemR(box, "y", text="Y")
bpy.types.register(DATA_PT_context_text)
bpy.types.register(DATA_PT_shape_text)
bpy.types.register(DATA_PT_geometry_text)
bpy.types.register(DATA_PT_font)
bpy.types.register(DATA_PT_paragraph)
bpy.types.register(DATA_PT_textboxes)

407
release/ui/buttons_game.py Normal file
View File

@@ -0,0 +1,407 @@
import bpy
class PhysicsButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "physics"
def poll(self, context):
ob = context.active_object
rd = context.scene.render_data
return ob and ob.game and (rd.engine == 'BLENDER_GAME')
class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
__label__ = "Physics"
def draw(self, context):
layout = self.layout
ob = context.active_object
game = ob.game
soft = ob.game.soft_body
layout.itemR(game, "physics_type")
layout.itemS()
#if game.physics_type == 'DYNAMIC':
if game.physics_type in ('DYNAMIC', 'RIGID_BODY'):
split = layout.split()
col = split.column()
col.itemR(game, "actor")
col.itemR(game, "ghost")
col.itemR(ob, "restrict_render", text="Invisible") # out of place but useful
col = split.column()
col.itemR(game, "material_physics")
col.itemR(game, "rotate_from_normal")
col.itemR(game, "no_sleeping")
layout.itemS()
split = layout.split()
col = split.column()
col.itemL(text="Attributes:")
col.itemR(game, "mass")
col.itemR(game, "radius")
col.itemR(game, "form_factor")
col = split.column()
sub = col.column()
sub.active = (game.physics_type == 'RIGID_BODY')
sub.itemR(game, "anisotropic_friction")
subsub = sub.column()
subsub.active = game.anisotropic_friction
subsub.itemR(game, "friction_coefficients", text="", slider=True)
split = layout.split()
col = split.column()
col.itemL(text="Velocity:")
sub = col.column(align=True)
sub.itemR(game, "minimum_velocity", text="Minimum")
sub.itemR(game, "maximum_velocity", text="Maximum")
col = split.column()
col.itemL(text="Damping:")
sub = col.column(align=True)
sub.itemR(game, "damping", text="Translation", slider=True)
sub.itemR(game, "rotation_damping", text="Rotation", slider=True)
layout.itemS()
split = layout.split()
col = split.column()
col.itemL(text="Lock Translation:")
col.itemR(game, "lock_x_axis", text="X")
col.itemR(game, "lock_y_axis", text="Y")
col.itemR(game, "lock_z_axis", text="Z")
col = split.column()
col.itemL(text="Lock Rotation:")
col.itemR(game, "lock_x_rot_axis", text="X")
col.itemR(game, "lock_y_rot_axis", text="Y")
col.itemR(game, "lock_z_rot_axis", text="Z")
elif game.physics_type == 'SOFT_BODY':
col = layout.column()
col.itemR(game, "actor")
col.itemR(game, "ghost")
col.itemR(ob, "restrict_render", text="Invisible")
layout.itemS()
split = layout.split()
col = split.column()
col.itemL(text="Attributes:")
col.itemR(game, "mass")
col.itemR(soft, "welding")
col.itemR(soft, "position_iterations")
col.itemR(soft, "linstiff", slider=True)
col.itemR(soft, "dynamic_friction", slider=True)
col.itemR(soft, "margin", slider=True)
col.itemR(soft, "bending_const", text="Bending Constraints")
col = split.column()
col.itemR(soft, "shape_match")
sub = col.column()
sub.active = soft.shape_match
sub.itemR(soft, "threshold", slider=True)
col.itemS()
col.itemL(text="Cluster Collision:")
col.itemR(soft, "cluster_rigid_to_softbody")
col.itemR(soft, "cluster_soft_to_softbody")
sub = col.column()
sub.active = (soft.cluster_rigid_to_softbody or soft.cluster_soft_to_softbody)
sub.itemR(soft, "cluster_iterations", text="Iterations")
elif game.physics_type == 'STATIC':
col = layout.column()
col.itemR(game, "actor")
col.itemR(game, "ghost")
col.itemR(ob, "restrict_render", text="Invisible")
elif game.physics_type in ('SENSOR', 'INVISIBLE', 'NO_COLLISION', 'OCCLUDE'):
layout.itemR(ob, "restrict_render", text="Invisible")
class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel):
__label__ = "Collision Bounds"
def poll(self, context):
game = context.object.game
rd = context.scene.render_data
return (game.physics_type in ('DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC')) and (rd.engine == 'BLENDER_GAME')
def draw_header(self, context):
game = context.active_object.game
self.layout.itemR(game, "use_collision_bounds", text="")
def draw(self, context):
layout = self.layout
game = context.active_object.game
layout.active = game.use_collision_bounds
layout.itemR(game, "collision_bounds", text="Bounds")
row = layout.row()
row.itemR(game, "collision_compound", text="Compound")
row.itemR(game, "collision_margin", text="Margin", slider=True)
bpy.types.register(PHYSICS_PT_game_physics)
bpy.types.register(PHYSICS_PT_game_collision_bounds)
class SceneButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "scene"
def poll(self, context):
rd = context.scene.render_data
return (rd.engine == 'BLENDER_GAME')
class SCENE_PT_game(SceneButtonsPanel):
__label__ = "Game"
def draw(self, context):
layout = self.layout
row = layout.row()
row.itemO("view3d.game_start", text="Start")
row.itemL()
class SCENE_PT_game_player(SceneButtonsPanel):
__label__ = "Standalone Player"
def draw(self, context):
layout = self.layout
gs = context.scene.game_data
layout.itemR(gs, "fullscreen")
split = layout.split()
col = split.column()
col.itemL(text="Resolution:")
sub = col.column(align=True)
sub.itemR(gs, "resolution_x", slider=False, text="X")
sub.itemR(gs, "resolution_y", slider=False, text="Y")
col = split.column()
col.itemL(text="Quality:")
sub = col.column(align=True)
sub.itemR(gs, "depth", text="Bit Depth", slider=False)
sub.itemR(gs, "frequency", text="FPS", slider=False)
# framing:
col = layout.column()
col.itemL(text="Framing:")
col.row().itemR(gs, "framing_type", expand=True)
if gs.framing_type == 'LETTERBOX':
col.itemR(gs, "framing_color", text="")
class SCENE_PT_game_stereo(SceneButtonsPanel):
__label__ = "Stereo"
def draw(self, context):
layout = self.layout
gs = context.scene.game_data
stereo_mode = gs.stereo
# stereo options:
layout.itemR(gs, "stereo", expand=True)
# stereo:
if stereo_mode == 'STEREO':
layout.itemR(gs, "stereo_mode")
layout.itemL(text="To do: Focal Length")
layout.itemL(text="To do: Eye Separation")
# dome:
elif stereo_mode == 'DOME':
layout.itemR(gs, "dome_mode", text="Dome Type")
dome_type = gs.dome_mode
split=layout.split()
if dome_type == 'FISHEYE' or \
dome_type == 'TRUNCATED_REAR' or \
dome_type == 'TRUNCATED_FRONT':
col=split.column()
col.itemR(gs, "dome_angle", slider=True)
col.itemR(gs, "dome_tilt")
col=split.column()
col.itemR(gs, "dome_tesselation", text="Tesselation")
col.itemR(gs, "dome_buffer_resolution", text="Resolution", slider=True)
elif dome_type == 'PANORAM_SPH':
col=split.column()
col.itemR(gs, "dome_tesselation", text="Tesselation")
col.itemR(gs, "dome_buffer_resolution", text="Resolution", slider=True)
else: # cube map
col=split.column()
col.itemR(gs, "dome_buffer_resolution", text="Resolution", slider=True)
layout.itemR(gs, "dome_text")
class SCENE_PT_game_shading(SceneButtonsPanel):
__label__ = "Shading"
def draw(self, context):
layout = self.layout
gs = context.scene.game_data
layout.itemR(gs, "material_mode", expand=True)
if gs.material_mode == 'GLSL':
split = layout.split()
col = split.column()
col.itemR(gs, "glsl_lights", text="Lights")
col.itemR(gs, "glsl_shaders", text="Shaders")
col.itemR(gs, "glsl_shadows", text="Shadows")
col = split.column()
col.itemR(gs, "glsl_ramps", text="Ramps")
col.itemR(gs, "glsl_nodes", text="Nodes")
col.itemR(gs, "glsl_extra_textures", text="Extra Textures")
class SCENE_PT_game_performance(SceneButtonsPanel):
__label__ = "Performance"
def draw(self, context):
layout = self.layout
gs = context.scene.game_data
split = layout.split()
col = split.column()
col.itemL(text="Show:")
col.itemR(gs, "show_debug_properties", text="Debug Properties")
col.itemR(gs, "show_framerate_profile", text="Framerate and Profile")
col.itemR(gs, "show_physics_visualization", text="Physics Visualization")
col.itemR(gs, "deprecation_warnings")
col = split.column()
col.itemL(text="Render:")
col.itemR(gs, "all_frames")
col.itemR(gs, "display_lists")
bpy.types.register(SCENE_PT_game)
bpy.types.register(SCENE_PT_game_player)
bpy.types.register(SCENE_PT_game_stereo)
bpy.types.register(SCENE_PT_game_shading)
bpy.types.register(SCENE_PT_game_performance)
class WorldButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "world"
def poll(self, context):
rd = context.scene.render_data
return (rd.engine == 'BLENDER_GAME')
class WORLD_PT_game_context_world(WorldButtonsPanel):
__show_header__ = False
def poll(self, context):
rd = context.scene.render_data
return (context.scene) and (rd.use_game_engine)
def draw(self, context):
layout = self.layout
scene = context.scene
world = context.world
space = context.space_data
split = layout.split(percentage=0.65)
if scene:
split.template_ID(scene, "world", new="world.new")
elif world:
split.template_ID(space, "pin_id")
class WORLD_PT_game_world(WorldButtonsPanel):
__label__ = "World"
def draw(self, context):
layout = self.layout
world = context.world
row = layout.row()
row.column().itemR(world, "horizon_color")
row.column().itemR(world, "ambient_color")
layout.itemR(world.mist, "enabled", text="Mist")
row = layout.column_flow()
row.active = world.mist.enabled
row.itemR(world.mist, "start")
row.itemR(world.mist, "depth")
class WORLD_PT_game_physics(WorldButtonsPanel):
__label__ = "Physics"
def draw(self, context):
layout = self.layout
gs = context.scene.game_data
layout.itemR(gs, "physics_engine")
if gs.physics_engine != 'NONE':
layout.itemR(gs, "physics_gravity", text="Gravity")
split = layout.split()
col = split.column()
col.itemL(text="Physics Steps:")
sub = col.column(align=True)
sub.itemR(gs, "physics_step_max", text="Max")
sub.itemR(gs, "physics_step_sub", text="Substeps")
col.itemR(gs, "fps", text="FPS")
col = split.column()
col.itemL(text="Logic Steps:")
col.itemR(gs, "logic_step_max", text="Max")
col = layout.column()
col.itemR(gs, "use_occlusion_culling", text="Occlusion Culling")
sub = col.column()
sub.active = gs.use_occlusion_culling
sub.itemR(gs, "occlusion_culling_resolution", text="Resolution")
else:
split = layout.split()
col = split.column()
col.itemL(text="Physics Steps:")
col.itemR(gs, "fps", text="FPS")
col = split.column()
col.itemL(text="Logic Steps:")
col.itemR(gs, "logic_step_max", text="Max")
bpy.types.register(WORLD_PT_game_context_world)
bpy.types.register(WORLD_PT_game_world)
bpy.types.register(WORLD_PT_game_physics)

View File

@@ -0,0 +1,713 @@
import bpy
class MaterialButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "material"
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
def poll(self, context):
mat = context.material
engine = context.scene.render_data.engine
return mat and (engine in self.COMPAT_ENGINES)
class MATERIAL_PT_preview(MaterialButtonsPanel):
__label__ = "Preview"
COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
def draw(self, context):
self.layout.template_preview(context.material)
class MATERIAL_PT_context_material(MaterialButtonsPanel):
__show_header__ = False
COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
def poll(self, context):
# An exception, dont call the parent poll func because
# this manages materials for all engine types
engine = context.scene.render_data.engine
return (context.object) and (engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = context.material
ob = context.object
slot = context.material_slot
space = context.space_data
if ob:
row = layout.row()
row.template_list(ob, "materials", ob, "active_material_index", rows=2)
col = row.column(align=True)
col.itemO("object.material_slot_add", icon='ICON_ZOOMIN', text="")
col.itemO("object.material_slot_remove", icon='ICON_ZOOMOUT', text="")
if ob.mode == 'EDIT':
row = layout.row(align=True)
row.itemO("object.material_slot_assign", text="Assign")
row.itemO("object.material_slot_select", text="Select")
row.itemO("object.material_slot_deselect", text="Deselect")
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "active_material", new="material.new")
row = split.row()
if slot:
row.itemR(slot, "link", text="")
else:
row.itemL()
elif mat:
split.template_ID(space, "pin_id")
split.itemS()
layout.itemR(mat, "type", expand=True)
class MATERIAL_PT_shading(MaterialButtonsPanel):
__label__ = "Shading"
COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
def poll(self, context):
mat = context.material
engine = context.scene.render_data.engine
return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = context.material
if mat.type in ('SURFACE', 'WIRE'):
split = layout.split()
col = split.column()
sub = col.column()
sub.active = not mat.shadeless
sub.itemR(mat, "emit")
sub.itemR(mat, "ambient")
sub = col.column()
sub.itemR(mat, "translucency")
col = split.column()
col.itemR(mat, "shadeless")
sub = col.column()
sub.active = not mat.shadeless
sub.itemR(mat, "tangent_shading")
sub.itemR(mat, "cubic")
elif mat.type == 'HALO':
layout.itemR(mat, "alpha")
class MATERIAL_PT_strand(MaterialButtonsPanel):
__label__ = "Strand"
__default_closed__ = True
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def poll(self, context):
mat = context.material
engine = context.scene.render_data.engine
return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = context.material
tan = mat.strand
split = layout.split()
col = split.column(align=True)
col.itemL(text="Size:")
col.itemR(tan, "root_size", text="Root")
col.itemR(tan, "tip_size", text="Tip")
col.itemR(tan, "min_size", text="Minimum")
col.itemR(tan, "blender_units")
sub = col.column()
sub.active = (not mat.shadeless)
sub.itemR(tan, "tangent_shading")
col.itemR(tan, "shape")
col = split.column()
col.itemL(text="Shading:")
col.itemR(tan, "width_fade")
col.itemR(tan, "uv_layer")
col.itemS()
sub = col.column()
sub.active = (not mat.shadeless)
sub.itemR(tan, "surface_diffuse")
sub = col.column()
sub.active = tan.surface_diffuse
sub.itemR(tan, "blend_distance", text="Distance")
class MATERIAL_PT_physics(MaterialButtonsPanel):
__label__ = "Physics"
COMPAT_ENGINES = set(['BLENDER_GAME'])
def draw(self, context):
layout = self.layout
phys = context.material.physics
split = layout.split()
col = split.column()
col.itemR(phys, "distance")
col.itemR(phys, "friction")
col.itemR(phys, "align_to_normal")
col = split.column()
col.itemR(phys, "force", slider=True)
col.itemR(phys, "elasticity", slider=True)
col.itemR(phys, "damp", slider=True)
class MATERIAL_PT_options(MaterialButtonsPanel):
__label__ = "Options"
COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
def poll(self, context):
mat = context.material
engine = context.scene.render_data.engine
return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = context.material
split = layout.split()
col = split.column()
col.itemR(mat, "traceable")
col.itemR(mat, "full_oversampling")
col.itemR(mat, "sky")
col.itemR(mat, "exclude_mist")
col.itemR(mat, "invert_z")
sub = col.column(align=True)
sub.itemL(text="Light Group:")
sub.itemR(mat, "light_group", text="")
row = sub.row()
row.active = mat.light_group
row.itemR(mat, "light_group_exclusive", text="Exclusive")
col = split.column()
col.itemR(mat, "face_texture")
sub = col.column()
sub.active = mat.face_texture
sub.itemR(mat, "face_texture_alpha")
col.itemS()
col.itemR(mat, "vertex_color_paint")
col.itemR(mat, "vertex_color_light")
col.itemR(mat, "object_color")
class MATERIAL_PT_shadow(MaterialButtonsPanel):
__label__ = "Shadow"
__default_closed__ = True
COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
def poll(self, context):
mat = context.material
engine = context.scene.render_data.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = context.material
split = layout.split()
col = split.column()
col.itemR(mat, "shadows", text="Receive")
col.itemR(mat, "receive_transparent_shadows", text="Receive Transparent")
col.itemR(mat, "only_shadow", text="Shadows Only")
col.itemR(mat, "cast_shadows_only", text="Cast Only")
col.itemR(mat, "shadow_casting_alpha", text="Casting Alpha")
col = split.column()
col.itemR(mat, "cast_buffer_shadows")
sub = col.column()
sub.active = mat.cast_buffer_shadows
sub.itemR(mat, "shadow_buffer_bias", text="Buffer Bias")
col.itemR(mat, "ray_shadow_bias", text="Auto Ray Bias")
sub = col.column()
sub.active = (not mat.ray_shadow_bias)
sub.itemR(mat, "shadow_ray_bias", text="Ray Bias")
class MATERIAL_PT_diffuse(MaterialButtonsPanel):
__label__ = "Diffuse"
COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
def poll(self, context):
mat = context.material
engine = context.scene.render_data.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = context.material
split = layout.split()
col = split.column()
col.itemR(mat, "diffuse_color", text="")
sub = col.column()
sub.active = (not mat.shadeless)
sub.itemR(mat, "diffuse_intensity", text="Intensity")
col = split.column()
col.active = (not mat.shadeless)
col.itemR(mat, "diffuse_shader", text="")
col.itemR(mat, "use_diffuse_ramp", text="Ramp")
col = layout.column()
col.active = (not mat.shadeless)
if mat.diffuse_shader == 'OREN_NAYAR':
col.itemR(mat, "roughness")
elif mat.diffuse_shader == 'MINNAERT':
col.itemR(mat, "darkness")
elif mat.diffuse_shader == 'TOON':
row = col.row()
row.itemR(mat, "diffuse_toon_size", text="Size")
row.itemR(mat, "diffuse_toon_smooth", text="Smooth")
elif mat.diffuse_shader == 'FRESNEL':
row = col.row()
row.itemR(mat, "diffuse_fresnel", text="Fresnel")
row.itemR(mat, "diffuse_fresnel_factor", text="Factor")
if mat.use_diffuse_ramp:
layout.itemS()
layout.template_color_ramp(mat.diffuse_ramp, expand=True)
layout.itemS()
row = layout.row()
split = row.split(percentage=0.3)
split.itemL(text="Input:")
split.itemR(mat, "diffuse_ramp_input", text="")
split = row.split(percentage=0.3)
split.itemL(text="Blend:")
split.itemR(mat, "diffuse_ramp_blend", text="")
class MATERIAL_PT_specular(MaterialButtonsPanel):
__label__ = "Specular"
COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
def poll(self, context):
mat = context.material
engine = context.scene.render_data.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = context.material
layout.active = (not mat.shadeless)
split = layout.split()
col = split.column()
col.itemR(mat, "specular_color", text="")
col.itemR(mat, "specular_intensity", text="Intensity")
col = split.column()
col.itemR(mat, "specular_shader", text="")
col.itemR(mat, "use_specular_ramp", text="Ramp")
col = layout.column()
if mat.specular_shader in ('COOKTORR', 'PHONG'):
col.itemR(mat, "specular_hardness", text="Hardness")
elif mat.specular_shader == 'BLINN':
row = col.row()
row.itemR(mat, "specular_hardness", text="Hardness")
row.itemR(mat, "specular_ior", text="IOR")
elif mat.specular_shader == 'WARDISO':
col.itemR(mat, "specular_slope", text="Slope")
elif mat.specular_shader == 'TOON':
row = col.row()
row.itemR(mat, "specular_toon_size", text="Size")
row.itemR(mat, "specular_toon_smooth", text="Smooth")
if mat.use_specular_ramp:
layout.itemS()
layout.template_color_ramp(mat.specular_ramp, expand=True)
layout.itemS()
row = layout.row()
split = row.split(percentage=0.3)
split.itemL(text="Input:")
split.itemR(mat, "specular_ramp_input", text="")
split = row.split(percentage=0.3)
split.itemL(text="Blend:")
split.itemR(mat, "specular_ramp_blend", text="")
class MATERIAL_PT_sss(MaterialButtonsPanel):
__label__ = "Subsurface Scattering"
__default_closed__ = True
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def poll(self, context):
mat = context.material
engine = context.scene.render_data.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
def draw_header(self, context):
sss = context.material.subsurface_scattering
mat = context.material
self.layout.active = (not mat.shadeless)
self.layout.itemR(sss, "enabled", text="")
def draw(self, context):
layout = self.layout
mat = context.material
sss = context.material.subsurface_scattering
layout.active = sss.enabled
split = layout.split()
split.active = (not mat.shadeless)
col = split.column()
col.itemR(sss, "ior")
col.itemR(sss, "scale")
col.itemR(sss, "color", text="")
col.itemR(sss, "radius", text="RGB Radius")
col = split.column()
sub = col.column(align=True)
sub.itemL(text="Blend:")
sub.itemR(sss, "color_factor", text="Color")
sub.itemR(sss, "texture_factor", text="Texture")
sub.itemL(text="Scattering Weight:")
sub.itemR(sss, "front")
sub.itemR(sss, "back")
col.itemS()
col.itemR(sss, "error_tolerance", text="Error")
class MATERIAL_PT_mirror(MaterialButtonsPanel):
__label__ = "Mirror"
__default_closed__ = True
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def poll(self, context):
mat = context.material
engine = context.scene.render_data.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
def draw_header(self, context):
raym = context.material.raytrace_mirror
self.layout.itemR(raym, "enabled", text="")
def draw(self, context):
layout = self.layout
mat = context.material
raym = context.material.raytrace_mirror
layout.active = raym.enabled
split = layout.split()
col = split.column()
col.itemR(raym, "reflect_factor")
col.itemR(mat, "mirror_color", text="")
col = split.column()
col.itemR(raym, "fresnel")
sub = col.column()
sub.active = raym.fresnel > 0
sub.itemR(raym, "fresnel_factor", text="Blend")
split = layout.split()
col = split.column()
col.itemS()
col.itemR(raym, "distance", text="Max Dist")
col.itemR(raym, "depth")
col.itemS()
sub = col.split(percentage=0.4)
sub.itemL(text="Fade To:")
sub.itemR(raym, "fade_to", text="")
col = split.column()
col.itemL(text="Gloss:")
col.itemR(raym, "gloss_factor", text="Amount")
sub = col.column()
sub.active = raym.gloss_factor < 1.0
sub.itemR(raym, "gloss_threshold", text="Threshold")
sub.itemR(raym, "gloss_samples", text="Samples")
sub.itemR(raym, "gloss_anisotropic", text="Anisotropic")
class MATERIAL_PT_transp(MaterialButtonsPanel):
__label__= "Transparency"
__default_closed__ = True
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def poll(self, context):
mat = context.material
engine = context.scene.render_data.engine
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
def draw_header(self, context):
mat = context.material
self.layout.itemR(mat, "transparency", text="")
def draw(self, context):
layout = self.layout
mat = context.material
rayt = context.material.raytrace_transparency
row = layout.row()
row.active = mat.transparency and (not mat.shadeless)
row.itemR(mat, "transparency_method", expand=True)
split = layout.split()
col = split.column()
col.itemR(mat, "alpha")
row = col.row()
row.active = mat.transparency and (not mat.shadeless)
row.itemR(mat, "specular_alpha", text="Specular")
col = split.column()
col.active = (not mat.shadeless)
col.itemR(rayt, "fresnel")
sub = col.column()
sub.active = rayt.fresnel > 0
sub.itemR(rayt, "fresnel_factor", text="Blend")
if mat.transparency_method == 'RAYTRACE':
layout.itemS()
split = layout.split()
split.active = mat.transparency
col = split.column()
col.itemR(rayt, "ior")
col.itemR(rayt, "filter")
col.itemR(rayt, "falloff")
col.itemR(rayt, "limit")
col.itemR(rayt, "depth")
col = split.column()
col.itemL(text="Gloss:")
col.itemR(rayt, "gloss_factor", text="Amount")
sub = col.column()
sub.active = rayt.gloss_factor < 1.0
sub.itemR(rayt, "gloss_threshold", text="Threshold")
sub.itemR(rayt, "gloss_samples", text="Samples")
class MATERIAL_PT_halo(MaterialButtonsPanel):
__label__= "Halo"
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def poll(self, context):
mat = context.material
engine = context.scene.render_data.engine
return mat and (mat.type == 'HALO') and (engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = context.material
halo = mat.halo
split = layout.split()
col = split.column()
col.itemR(mat, "diffuse_color", text="")
col.itemR(halo, "size")
col.itemR(halo, "hardness")
col.itemR(halo, "add")
col.itemL(text="Options:")
col.itemR(halo, "texture")
col.itemR(halo, "vertex_normal")
col.itemR(halo, "xalpha")
col.itemR(halo, "shaded")
col.itemR(halo, "soft")
col = split.column()
col.itemR(halo, "ring")
sub = col.column()
sub.active = halo.ring
sub.itemR(halo, "rings")
sub.itemR(mat, "mirror_color", text="")
col.itemS()
col.itemR(halo, "lines")
sub = col.column()
sub.active = halo.lines
sub.itemR(halo, "line_number", text="Lines")
sub.itemR(mat, "specular_color", text="")
col.itemS()
col.itemR(halo, "star")
sub = col.column()
sub.active = halo.star
sub.itemR(halo, "star_tips")
class MATERIAL_PT_flare(MaterialButtonsPanel):
__label__= "Flare"
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def poll(self, context):
mat = context.material
engine = context.scene.render_data.engine
return mat and (mat.type == 'HALO') and (engine in self.COMPAT_ENGINES)
def draw_header(self, context):
layout = self.layout
mat = context.material
halo = mat.halo
layout.itemR(halo, "flare_mode", text="")
def draw(self, context):
layout = self.layout
mat = context.material
halo = mat.halo
layout.active = halo.flare_mode
split = layout.split()
col = split.column()
col.itemR(halo, "flare_size", text="Size")
col.itemR(halo, "flare_boost", text="Boost")
col.itemR(halo, "flare_seed", text="Seed")
col = split.column()
col.itemR(halo, "flares_sub", text="Subflares")
col.itemR(halo, "flare_subsize", text="Subsize")
bpy.types.register(MATERIAL_PT_context_material)
bpy.types.register(MATERIAL_PT_preview)
bpy.types.register(MATERIAL_PT_diffuse)
bpy.types.register(MATERIAL_PT_specular)
bpy.types.register(MATERIAL_PT_shading)
bpy.types.register(MATERIAL_PT_transp)
bpy.types.register(MATERIAL_PT_mirror)
bpy.types.register(MATERIAL_PT_sss)
bpy.types.register(MATERIAL_PT_halo)
bpy.types.register(MATERIAL_PT_flare)
bpy.types.register(MATERIAL_PT_physics)
bpy.types.register(MATERIAL_PT_strand)
bpy.types.register(MATERIAL_PT_options)
bpy.types.register(MATERIAL_PT_shadow)
# Volumetrics
class VolumeButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "material"
def poll(self, context):
mat = context.material
engine = context.scene.render_data.engine
return mat and (mat.type == 'VOLUME') and (engine in self.COMPAT_ENGINES)
class MATERIAL_PT_volume_shading(VolumeButtonsPanel):
__label__ = "Shading"
__default_closed__ = False
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def draw(self, context):
layout = self.layout
mat = context.material
vol = context.material.volume
row = layout.row()
row.itemR(vol, "density")
row.itemR(vol, "scattering")
split = layout.split()
col = split.column()
col.itemR(vol, "absorption")
col.itemR(vol, "absorption_color", text="")
col = split.column()
col.itemR(vol, "emission")
col.itemR(vol, "emission_color", text="")
class MATERIAL_PT_volume_scattering(VolumeButtonsPanel):
__label__ = "Scattering"
__default_closed__ = False
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def draw(self, context):
layout = self.layout
vol = context.material.volume
split = layout.split()
col = split.column()
col.itemR(vol, "scattering_mode", text="")
if vol.scattering_mode == 'SINGLE_SCATTERING':
col.itemR(vol, "light_cache")
sub = col.column()
sub.active = vol.light_cache
sub.itemR(vol, "cache_resolution")
elif vol.scattering_mode in ('MULTIPLE_SCATTERING', 'SINGLE_PLUS_MULTIPLE_SCATTERING'):
col.itemR(vol, "cache_resolution")
col = col.column(align=True)
col.itemR(vol, "ms_diffusion")
col.itemR(vol, "ms_spread")
col.itemR(vol, "ms_intensity")
col = split.column()
# col.itemL(text="Anisotropic Scattering:")
col.itemR(vol, "phase_function", text="")
if vol.phase_function in ('SCHLICK', 'HENYEY-GREENSTEIN'):
col.itemR(vol, "asymmetry")
class MATERIAL_PT_volume_transp(VolumeButtonsPanel):
__label__= "Transparency"
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def draw(self, context):
layout = self.layout
mat = context.material
rayt = context.material.raytrace_transparency
row= layout.row()
row.itemR(mat, "transparency_method", expand=True)
row.active = mat.transparency and (not mat.shadeless)
class MATERIAL_PT_volume_integration(VolumeButtonsPanel):
__label__ = "Integration"
__default_closed__ = False
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def draw(self, context):
layout = self.layout
mat = context.material
vol = context.material.volume
split = layout.split()
col = split.column()
col.itemL(text="Step Calculation:")
col.itemR(vol, "step_calculation", text="")
col = col.column(align=True)
col.itemR(vol, "step_size")
col.itemR(vol, "shading_step_size")
col = split.column()
col.itemL()
col.itemR(vol, "depth_cutoff")
col.itemR(vol, "density_scale")
bpy.types.register(MATERIAL_PT_volume_shading)
bpy.types.register(MATERIAL_PT_volume_scattering)
bpy.types.register(MATERIAL_PT_volume_transp)
bpy.types.register(MATERIAL_PT_volume_integration)

View File

@@ -0,0 +1,181 @@
import bpy
class ObjectButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "object"
class OBJECT_PT_context_object(ObjectButtonsPanel):
__show_header__ = False
def draw(self, context):
layout = self.layout
ob = context.object
row = layout.row()
row.itemL(text="", icon='ICON_OBJECT_DATA')
row.itemR(ob, "name", text="")
class OBJECT_PT_transform(ObjectButtonsPanel):
__label__ = "Transform"
def draw(self, context):
layout = self.layout
ob = context.object
row = layout.row()
row.column().itemR(ob, "location")
row.column().itemR(ob, "rotation")
row.column().itemR(ob, "scale")
class OBJECT_PT_relations(ObjectButtonsPanel):
__label__ = "Relations"
def draw(self, context):
layout = self.layout
ob = context.object
split = layout.split()
col = split.column()
col.itemR(ob, "layers")
col.itemS()
col.itemR(ob, "pass_index")
col = split.column()
col.itemL(text="Parent:")
col.itemR(ob, "parent", text="")
sub = col.column()
split = sub.split(percentage=0.3)
split.itemL(text="Type:")
split.itemR(ob, "parent_type", text="")
parent = ob.parent
if parent and ob.parent_type == 'BONE' and parent.type == 'ARMATURE':
sub.item_pointerR(ob, "parent_bone", parent.data, "bones", text="")
sub.active = parent != None
class OBJECT_PT_groups(ObjectButtonsPanel):
__label__ = "Groups"
def draw(self, context):
layout = self.layout
ob = context.object
split = layout.split()
split.item_menu_enumO("object.group_add", "group", text="Add to Group")
split.itemL()
for group in bpy.data.groups:
if ob.name in group.objects:
col = layout.column(align=True)
col.set_context_pointer("group", group)
row = col.box().row()
row.itemR(group, "name", text="")
row.itemO("object.group_remove", text="", icon='VICON_X')
split = col.box().split()
split.column().itemR(group, "layer", text="Dupli")
split.column().itemR(group, "dupli_offset", text="")
class OBJECT_PT_display(ObjectButtonsPanel):
__label__ = "Display"
def draw(self, context):
layout = self.layout
ob = context.object
row = layout.row()
row.itemR(ob, "max_draw_type", text="Type")
row.itemR(ob, "draw_bounds_type", text="Bounds")
flow = layout.column_flow()
flow.itemR(ob, "draw_name", text="Name")
flow.itemR(ob, "draw_axis", text="Axis")
flow.itemR(ob, "draw_wire", text="Wire")
flow.itemR(ob, "draw_texture_space", text="Texture Space")
flow.itemR(ob, "x_ray", text="X-Ray")
flow.itemR(ob, "draw_transparent", text="Transparency")
class OBJECT_PT_duplication(ObjectButtonsPanel):
__label__ = "Duplication"
def draw(self, context):
layout = self.layout
ob = context.object
layout.itemR(ob, "dupli_type", expand=True)
if ob.dupli_type == 'FRAMES':
split = layout.split()
col = split.column(align=True)
col.itemR(ob, "dupli_frames_start", text="Start")
col.itemR(ob, "dupli_frames_end", text="End")
col = split.column(align=True)
col.itemR(ob, "dupli_frames_on", text="On")
col.itemR(ob, "dupli_frames_off", text="Off")
layout.itemR(ob, "dupli_frames_no_speed", text="No Speed")
elif ob.dupli_type == 'VERTS':
layout.itemR(ob, "dupli_verts_rotation", text="Rotation")
elif ob.dupli_type == 'FACES':
row = layout.row()
row.itemR(ob, "dupli_faces_scale", text="Scale")
row.itemR(ob, "dupli_faces_inherit_scale", text="Inherit Scale")
elif ob.dupli_type == 'GROUP':
layout.itemR(ob, "dupli_group", text="Group")
class OBJECT_PT_animation(ObjectButtonsPanel):
__label__ = "Animation"
def draw(self, context):
layout = self.layout
ob = context.object
split = layout.split()
col = split.column()
col.itemL(text="Time Offset:")
col.itemR(ob, "time_offset_edit", text="Edit")
row = col.row()
row.itemR(ob, "time_offset_particle", text="Particle")
row.active = len(ob.particle_systems) != 0
row = col.row()
row.itemR(ob, "time_offset_parent", text="Parent")
row.active = ob.parent != None
row = col.row()
row.itemR(ob, "slow_parent")
row.active = ob.parent != None
col.itemR(ob, "time_offset", text="Offset")
col = split.column()
col.itemL(text="Track:")
col.itemR(ob, "track", text="")
col.itemR(ob, "track_axis", text="Axis")
col.itemR(ob, "up_axis", text="Up Axis")
row = col.row()
row.itemR(ob, "track_override_parent", text="Override Parent")
row.active = ob.parent != None
bpy.types.register(OBJECT_PT_context_object)
bpy.types.register(OBJECT_PT_transform)
bpy.types.register(OBJECT_PT_relations)
bpy.types.register(OBJECT_PT_groups)
bpy.types.register(OBJECT_PT_display)
bpy.types.register(OBJECT_PT_duplication)
bpy.types.register(OBJECT_PT_animation)

View File

@@ -0,0 +1,535 @@
import bpy
class ConstraintButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "constraint"
def draw_constraint(self, con):
layout = self.layout
box = layout.template_constraint(con)
if box:
# match enum type to our functions, avoids a lookup table.
getattr(self, con.type)(box, con)
# show/key buttons here are most likely obsolete now, with
# keyframing functionality being part of every button
if con.type not in ('RIGID_BODY_JOINT', 'NULL'):
box.itemR(con, "influence")
def space_template(self, layout, con, target=True, owner=True):
if target or owner:
row = layout.row()
row.itemL(text="Convert:")
if target:
row.itemR(con, "target_space", text="")
if target and owner:
row.itemL(icon='ICON_ARROW_LEFTRIGHT')
if owner:
row.itemR(con, "owner_space", text="")
def target_template(self, layout, con, subtargets=True):
layout.itemR(con, "target") # XXX limiting settings for only 'curves' or some type of object
if con.target and subtargets:
if con.target.type == 'ARMATURE':
layout.item_pointerR(con, "subtarget", con.target.data, "bones", text="Bone")
if con.type == 'COPY_LOCATION':
row = layout.row()
row.itemL(text="Head/Tail:")
row.itemR(con, "head_tail", text="")
elif con.target.type in ('MESH', 'LATTICE'):
layout.item_pointerR(con, "subtarget", con.target, "vertex_groups", text="Vertex Group")
def CHILD_OF(self, layout, con):
self.target_template(layout, con)
split = layout.split()
col = split.column()
col.itemL(text="Location:")
col.itemR(con, "locationx", text="X")
col.itemR(con, "locationy", text="Y")
col.itemR(con, "locationz", text="Z")
col = split.column()
col.itemL(text="Rotation:")
col.itemR(con, "rotationx", text="X")
col.itemR(con, "rotationy", text="Y")
col.itemR(con, "rotationz", text="Z")
col = split.column()
col.itemL(text="Scale:")
col.itemR(con, "sizex", text="X")
col.itemR(con, "sizey", text="Y")
col.itemR(con, "sizez", text="Z")
row = layout.row()
row.itemO("constraint.childof_set_inverse")
row.itemO("constraint.childof_clear_inverse")
def TRACK_TO(self, layout, con):
self.target_template(layout, con)
row = layout.row()
row.itemL(text="To:")
row.itemR(con, "track", expand=True)
row = layout.row()
#row.itemR(con, "up", text="Up", expand=True) # XXX: up and expand don't play nice together
row.itemR(con, "up", text="Up")
row.itemR(con, "target_z")
self.space_template(layout, con)
def IK(self, layout, con):
self.target_template(layout, con)
layout.itemR(con, "pole_target")
if con.pole_target and con.pole_target.type == 'ARMATURE':
layout.item_pointerR(con, "pole_subtarget", con.pole_target.data, "bones", text="Bone")
split = layout.split()
col = split.column()
col.itemR(con, "iterations")
col.itemR(con, "chain_length")
sub = col.column()
sub.active = con.pole_target
sub.itemR(con, "pole_angle")
col.itemL(text="Weight:")
col.itemR(con, "weight", text="Position", slider=True)
sub = col.column()
sub.active = con.rotation
sub.itemR(con, "orient_weight", text="Rotation", slider=True)
col = split.column()
col.itemR(con, "tail")
col.itemR(con, "rotation")
col.itemR(con, "targetless")
col.itemR(con, "stretch")
def FOLLOW_PATH(self, layout, con):
self.target_template(layout, con)
split = layout.split()
col = split.column()
col.itemR(con, "curve_follow")
col = split.column()
col.itemR(con, "fixed_position")
if con.fixed_position:
col.itemR(con, "offset_percentage", text="Offset")
else:
col.itemR(con, "offset")
row = layout.row()
row.itemL(text="Forward:")
row.itemR(con, "forward", expand=True)
row = layout.row()
row.itemR(con, "up", text="Up")
row.itemL()
def LIMIT_ROTATION(self, layout, con):
split = layout.split()
col = split.column()
col.itemR(con, "use_limit_x")
sub = col.column()
sub.active = con.use_limit_x
sub.itemR(con, "minimum_x", text="Min")
sub.itemR(con, "maximum_x", text="Max")
col = split.column()
col.itemR(con, "use_limit_y")
sub = col.column()
sub.active = con.use_limit_y
sub.itemR(con, "minimum_y", text="Min")
sub.itemR(con, "maximum_y", text="Max")
col = split.column()
col.itemR(con, "use_limit_z")
sub = col.column()
sub.active = con.use_limit_z
sub.itemR(con, "minimum_z", text="Min")
sub.itemR(con, "maximum_z", text="Max")
row = layout.row()
row.itemR(con, "limit_transform")
row.itemL()
row = layout.row()
row.itemL(text="Convert:")
row.itemR(con, "owner_space", text="")
def LIMIT_LOCATION(self, layout, con):
split = layout.split()
col = split.column()
col.itemR(con, "use_minimum_x")
sub = col.column()
sub.active = con.use_minimum_x
sub.itemR(con, "minimum_x", text="")
col.itemR(con, "use_maximum_x")
sub = col.column()
sub.active = con.use_maximum_x
sub.itemR(con, "maximum_x", text="")
col = split.column()
col.itemR(con, "use_minimum_y")
sub = col.column()
sub.active = con.use_minimum_y
sub.itemR(con, "minimum_y", text="")
col.itemR(con, "use_maximum_y")
sub = col.column()
sub.active = con.use_maximum_y
sub.itemR(con, "maximum_y", text="")
col = split.column()
col.itemR(con, "use_minimum_z")
sub = col.column()
sub.active = con.use_minimum_z
sub.itemR(con, "minimum_z", text="")
col.itemR(con, "use_maximum_z")
sub = col.column()
sub.active = con.use_maximum_z
sub.itemR(con, "maximum_z", text="")
row = layout.row()
row.itemR(con, "limit_transform")
row.itemL()
row = layout.row()
row.itemL(text="Convert:")
row.itemR(con, "owner_space", text="")
def LIMIT_SCALE(self, layout, con):
split = layout.split()
col = split.column()
col.itemR(con, "use_minimum_x")
sub = col.column()
sub.active = con.use_minimum_x
sub.itemR(con, "minimum_x", text="")
col.itemR(con, "use_maximum_x")
sub = col.column()
sub.active = con.use_maximum_x
sub.itemR(con, "maximum_x", text="")
col = split.column()
col.itemR(con, "use_minimum_y")
sub = col.column()
sub.active = con.use_minimum_y
sub.itemR(con, "minimum_y", text="")
col.itemR(con, "use_maximum_y")
sub = col.column()
sub.active = con.use_maximum_y
sub.itemR(con, "maximum_y", text="")
col = split.column()
col.itemR(con, "use_minimum_z")
sub = col.column()
sub.active = con.use_minimum_z
sub.itemR(con, "minimum_z", text="")
col.itemR(con, "use_maximum_z")
sub = col.column()
sub.active = con.use_maximum_z
sub.itemR(con, "maximum_z", text="")
row = layout.row()
row.itemR(con, "limit_transform")
row.itemL()
row = layout.row()
row.itemL(text="Convert:")
row.itemR(con, "owner_space", text="")
def COPY_ROTATION(self, layout, con):
self.target_template(layout, con)
split = layout.split()
col = split.column()
col.itemR(con, "rotate_like_x", text="X")
sub = col.column()
sub.active = con.rotate_like_x
sub.itemR(con, "invert_x", text="Invert")
col = split.column()
col.itemR(con, "rotate_like_y", text="Y")
sub = col.column()
sub.active = con.rotate_like_y
sub.itemR(con, "invert_y", text="Invert")
col = split.column()
col.itemR(con, "rotate_like_z", text="Z")
sub = col.column()
sub.active = con.rotate_like_z
sub.itemR(con, "invert_z", text="Invert")
layout.itemR(con, "offset")
self.space_template(layout, con)
def COPY_LOCATION(self, layout, con):
self.target_template(layout, con)
split = layout.split()
col = split.column()
col.itemR(con, "locate_like_x", text="X")
sub = col.column()
sub.active = con.locate_like_x
sub.itemR(con, "invert_x", text="Invert")
col = split.column()
col.itemR(con, "locate_like_y", text="Y")
sub = col.column()
sub.active = con.locate_like_y
sub.itemR(con, "invert_y", text="Invert")
col = split.column()
col.itemR(con, "locate_like_z", text="Z")
sub = col.column()
sub.active = con.locate_like_z
sub.itemR(con, "invert_z", text="Invert")
layout.itemR(con, "offset")
self.space_template(layout, con)
def COPY_SCALE(self, layout, con):
self.target_template(layout, con)
row = layout.row(align=True)
row.itemR(con, "size_like_x", text="X")
row.itemR(con, "size_like_y", text="Y")
row.itemR(con, "size_like_z", text="Z")
layout.itemR(con, "offset")
self.space_template(layout, con)
#def SCRIPT(self, layout, con):
def ACTION(self, layout, con):
self.target_template(layout, con)
layout.itemR(con, "action")
layout.itemR(con, "transform_channel")
split = layout.split()
col = split.column(align=True)
col.itemR(con, "start_frame", text="Start")
col.itemR(con, "end_frame", text="End")
col = split.column(align=True)
col.itemR(con, "minimum", text="Min")
col.itemR(con, "maximum", text="Max")
row = layout.row()
row.itemL(text="Convert:")
row.itemR(con, "owner_space", text="")
def LOCKED_TRACK(self, layout, con):
self.target_template(layout, con)
row = layout.row()
row.itemL(text="To:")
row.itemR(con, "track", expand=True)
row = layout.row()
row.itemL(text="Lock:")
row.itemR(con, "locked", expand=True)
def LIMIT_DISTANCE(self, layout, con):
self.target_template(layout, con)
col = layout.column(align=True);
col.itemR(con, "distance")
col.itemO("constraint.limitdistance_reset")
row = layout.row()
row.itemL(text="Clamp Region:")
row.itemR(con, "limit_mode", text="")
def STRETCH_TO(self, layout, con):
self.target_template(layout, con)
row = layout.row()
row.itemR(con, "original_length", text="Rest Length")
row.itemO("constraint.stretchto_reset", text="Reset")
col = layout.column()
col.itemR(con, "bulge", text="Volume Variation")
row = layout.row()
row.itemL(text="Volume:")
row.itemR(con, "volume", expand=True)
row.itemL(text="Plane:")
row.itemR(con, "keep_axis", expand=True)
def FLOOR(self, layout, con):
self.target_template(layout, con)
row = layout.row()
row.itemR(con, "sticky")
row.itemR(con, "use_rotation")
layout.itemR(con, "offset")
row = layout.row()
row.itemL(text="Min/Max:")
row.itemR(con, "floor_location", expand=True)
def RIGID_BODY_JOINT(self, layout, con):
self.target_template(layout, con)
layout.itemR(con, "pivot_type")
layout.itemR(con, "child")
row = layout.row()
row.itemR(con, "disable_linked_collision", text="No Collision")
row.itemR(con, "draw_pivot", text="Display Pivot")
split = layout.split()
col = split.column(align=True)
col.itemL(text="Pivot:")
col.itemR(con, "pivot_x", text="X")
col.itemR(con, "pivot_y", text="Y")
col.itemR(con, "pivot_z", text="Z")
col = split.column(align=True)
col.itemL(text="Axis:")
col.itemR(con, "axis_x", text="X")
col.itemR(con, "axis_y", text="Y")
col.itemR(con, "axis_z", text="Z")
#Missing: Limit arrays (not wrapped in RNA yet)
def CLAMP_TO(self, layout, con):
self.target_template(layout, con)
row = layout.row()
row.itemL(text="Main Axis:")
row.itemR(con, "main_axis", expand=True)
row = layout.row()
row.itemR(con, "cyclic")
def TRANSFORM(self, layout, con):
self.target_template(layout, con)
layout.itemR(con, "extrapolate_motion", text="Extrapolate")
split = layout.split()
col = split.column()
col.itemL(text="Source:")
col.row().itemR(con, "map_from", expand=True)
sub = col.row(align=True)
sub.itemL(text="X:")
sub.itemR(con, "from_min_x", text="")
sub.itemR(con, "from_max_x", text="")
sub = col.row(align=True)
sub.itemL(text="Y:")
sub.itemR(con, "from_min_y", text="")
sub.itemR(con, "from_max_y", text="")
sub = col.row(align=True)
sub.itemL(text="Z:")
sub.itemR(con, "from_min_z", text="")
sub.itemR(con, "from_max_z", text="")
split = layout.split()
col = split.column()
col.itemL(text="Destination:")
col.row().itemR(con, "map_to", expand=True)
sub = col.row(align=True)
sub.itemR(con, "map_to_x_from", text="")
sub.itemR(con, "to_min_x", text="")
sub.itemR(con, "to_max_x", text="")
sub = col.row(align=True)
sub.itemR(con, "map_to_y_from", text="")
sub.itemR(con, "to_min_y", text="")
sub.itemR(con, "to_max_y", text="")
sub = col.row(align=True)
sub.itemR(con, "map_to_z_from", text="")
sub.itemR(con, "to_min_z", text="")
sub.itemR(con, "to_max_z", text="")
self.space_template(layout, con)
def SHRINKWRAP (self, layout, con):
self.target_template(layout, con)
layout.itemR(con, "distance")
layout.itemR(con, "shrinkwrap_type")
if con.shrinkwrap_type == 'PROJECT':
row = layout.row(align=True)
row.itemR(con, "axis_x")
row.itemR(con, "axis_y")
row.itemR(con, "axis_z")
class OBJECT_PT_constraints(ConstraintButtonsPanel):
__label__ = "Constraints"
__context__ = "constraint"
def poll(self, context):
return (context.object)
def draw(self, context):
layout = self.layout
ob = context.object
row = layout.row()
row.item_menu_enumO("object.constraint_add", "type")
row.itemL();
for con in ob.constraints:
self.draw_constraint(con)
class BONE_PT_constraints(ConstraintButtonsPanel):
__label__ = "Constraints"
__context__ = "bone"
def poll(self, context):
ob = context.object
return (ob and ob.type == 'ARMATURE' and context.bone)
def draw(self, context):
layout = self.layout
ob = context.object
pchan = ob.pose.pose_channels[context.bone.name]
row = layout.row()
row.item_menu_enumO("pose.constraint_add", "type")
row.itemL();
for con in pchan.constraints:
self.draw_constraint(con)
bpy.types.register(OBJECT_PT_constraints)
bpy.types.register(BONE_PT_constraints)

View File

@@ -0,0 +1,959 @@
import bpy
def particle_panel_enabled(psys):
return psys.point_cache.baked==False and psys.edited==False
def particle_panel_poll(context):
psys = context.particle_system
if psys==None: return False
if psys.settings==None: return False
return psys.settings.type in ('EMITTER', 'REACTOR', 'HAIR')
def point_cache_ui(self, cache, enabled, particles, smoke):
layout = self.layout
layout.set_context_pointer("PointCache", cache)
row = layout.row()
row.template_list(cache, "point_cache_list", cache, "active_point_cache_index", rows=2 )
col = row.column(align=True)
col.itemO("ptcache.add_new", icon='ICON_ZOOMIN', text="")
col.itemO("ptcache.remove", icon='ICON_ZOOMOUT', text="")
row = layout.row()
row.itemL(text="File Name:")
if particles:
row.itemR(cache, "external")
if cache.external:
split = layout.split(percentage=0.80)
split.itemR(cache, "name", text="")
split.itemR(cache, "index", text="")
layout.itemL(text="File Path:")
layout.itemR(cache, "filepath", text="")
layout.itemL(text=cache.info)
else:
layout.itemR(cache, "name", text="")
if not particles:
row = layout.row()
row.enabled = enabled
row.itemR(cache, "start_frame")
row.itemR(cache, "end_frame")
row = layout.row()
if cache.baked == True:
row.itemO("ptcache.free_bake", text="Free Bake")
else:
row.item_booleanO("ptcache.bake", "bake", True, text="Bake")
sub = row.row()
sub.enabled = (cache.frames_skipped or cache.outdated) and enabled
sub.itemO("ptcache.bake", "bake", False, text="Calculate to Current Frame")
row = layout.row()
row.enabled = enabled
row.itemO("ptcache.bake_from_cache", text="Current Cache to Bake")
row.itemR(cache, "step");
if not smoke:
row = layout.row()
sub = row.row()
sub.enabled = enabled
sub.itemR(cache, "quick_cache")
row.itemR(cache, "disk_cache")
layout.itemL(text=cache.info)
layout.itemS()
row = layout.row()
row.item_booleanO("ptcache.bake_all", "bake", True, text="Bake All Dynamics")
row.itemO("ptcache.free_bake_all", text="Free All Bakes")
layout.itemO("ptcache.bake_all", "bake", False, text="Update All Dynamics to current frame")
class ParticleButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "particle"
def poll(self, context):
return particle_panel_poll(context)
class PARTICLE_PT_particles(ParticleButtonsPanel):
__show_header__ = False
def poll(self, context):
return (context.particle_system or context.object)
def draw(self, context):
layout = self.layout
ob = context.object
psys = context.particle_system
if ob:
row = layout.row()
row.template_list(ob, "particle_systems", ob, "active_particle_system_index", rows=2)
col = row.column(align=True)
col.itemO("object.particle_system_add", icon='ICON_ZOOMIN', text="")
col.itemO("object.particle_system_remove", icon='ICON_ZOOMOUT', text="")
if psys and not psys.settings:
split = layout.split(percentage=0.32)
col = split.column()
col.itemL(text="Name:")
col.itemL(text="Settings:")
col = split.column()
col.itemR(psys, "name", text="")
col.template_ID(psys, "settings", new="particle.new")
elif psys:
part = psys.settings
split = layout.split(percentage=0.32)
col = split.column()
col.itemL(text="Name:")
if part.type in ('EMITTER', 'REACTOR', 'HAIR'):
col.itemL(text="Settings:")
col.itemL(text="Type:")
col = split.column()
col.itemR(psys, "name", text="")
if part.type in ('EMITTER', 'REACTOR', 'HAIR'):
col.template_ID(psys, "settings", new="particle.new")
#row = layout.row()
#row.itemL(text="Viewport")
#row.itemL(text="Render")
if part:
if part.type not in ('EMITTER', 'REACTOR', 'HAIR'):
layout.itemL(text="No settings for fluid particles")
return
row=col.row()
row.enabled = particle_panel_enabled(psys)
row.itemR(part, "type", text="")
row.itemR(psys, "seed")
split = layout.split(percentage=0.65)
if part.type=='HAIR':
if psys.edited==True:
split.itemO("particle.edited_clear", text="Free Edit")
else:
split.itemL(text="")
row = split.row()
row.enabled = particle_panel_enabled(psys)
row.itemR(part, "hair_step")
if psys.edited==True:
if psys.global_hair:
layout.itemO("particle.connect_hair")
layout.itemL(text="Hair is disconnected.")
else:
layout.itemO("particle.disconnect_hair")
layout.itemL(text="")
elif part.type=='REACTOR':
split.enabled = particle_panel_enabled(psys)
split.itemR(psys, "reactor_target_object")
split.itemR(psys, "reactor_target_particle_system", text="Particle System")
class PARTICLE_PT_emission(ParticleButtonsPanel):
__label__ = "Emission"
def poll(self, context):
if particle_panel_poll(context):
return not context.particle_system.point_cache.external
else:
return False
def draw(self, context):
layout = self.layout
psys = context.particle_system
part = psys.settings
layout.enabled = particle_panel_enabled(psys) and not psys.multiple_caches
row = layout.row()
row.itemR(part, "amount")
split = layout.split()
col = split.column(align=True)
col.itemR(part, "start")
col.itemR(part, "end")
col = split.column(align=True)
col.itemR(part, "lifetime")
col.itemR(part, "random_lifetime", slider=True)
layout.row().itemL(text="Emit From:")
row = layout.row()
row.itemR(part, "emit_from", expand=True)
row = layout.row()
row.itemR(part, "trand")
if part.distribution!='GRID':
row.itemR(part, "even_distribution")
if part.emit_from=='FACE' or part.emit_from=='VOLUME':
row = layout.row()
row.itemR(part, "distribution", expand=True)
row = layout.row()
if part.distribution=='JIT':
row.itemR(part, "userjit", text="Particles/Face")
row.itemR(part, "jitter_factor", text="Jittering Amount", slider=True)
elif part.distribution=='GRID':
row.itemR(part, "grid_resolution")
class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel):
__label__ = "Hair dynamics"
__default_closed__ = True
def poll(self, context):
psys = context.particle_system
if psys==None: return False
if psys.settings==None: return False
return psys.settings.type == 'HAIR'
def draw_header(self, context):
#cloth = context.cloth.collision_settings
#self.layout.active = cloth_panel_enabled(context.cloth)
#self.layout.itemR(cloth, "enable_collision", text="")
psys = context.particle_system
self.layout.itemR(psys, "hair_dynamics", text="")
def draw(self, context):
layout = self.layout
psys = context.particle_system
part = psys.settings
cloth = psys.cloth.settings
layout.enabled = psys.hair_dynamics
split = layout.split()
col = split.column()
col.itemL(text="Quality:")
col.itemR(cloth, "quality", text="Steps",slider=True)
col.itemL(text="Gravity:")
col.itemR(cloth, "gravity", text="")
col = split.column()
col.itemL(text="Material:")
sub = col.column(align=True)
sub.itemR(cloth, "pin_stiffness", text="Stiffness")
sub.itemR(cloth, "mass")
col.itemL(text="Damping:")
sub = col.column(align=True)
sub.itemR(cloth, "spring_damping", text="Spring")
sub.itemR(cloth, "air_damping", text="Air")
layout.itemR(cloth, "internal_friction", slider="True")
class PARTICLE_PT_cache(ParticleButtonsPanel):
__label__ = "Cache"
__default_closed__ = True
def poll(self, context):
psys = context.particle_system
if psys==None: return False
if psys.settings==None: return False
phystype = psys.settings.physics_type
if phystype == 'NO' or phystype == 'KEYED':
return False
return psys.settings.type in ('EMITTER', 'REACTOR') or (psys.settings.type == 'HAIR' and psys.hair_dynamics)
def draw(self, context):
layout = self.layout
psys = context.particle_system
point_cache_ui(self, psys.point_cache, particle_panel_enabled(psys), not psys.hair_dynamics, 0)
class PARTICLE_PT_initial(ParticleButtonsPanel):
__label__ = "Velocity"
def poll(self, context):
if particle_panel_poll(context):
psys = context.particle_system
return psys.settings.physics_type != 'BOIDS' and not psys.point_cache.external
else:
return False
def draw(self, context):
layout = self.layout
psys = context.particle_system
part = psys.settings
layout.enabled = particle_panel_enabled(psys)
layout.row().itemL(text="Direction:")
split = layout.split()
sub = split.column()
sub.itemR(part, "normal_factor")
if part.emit_from=='PARTICLE':
sub.itemR(part, "particle_factor")
else:
sub.itemR(part, "object_factor", slider=True)
sub.itemR(part, "random_factor")
sub.itemR(part, "tangent_factor")
sub.itemR(part, "tangent_phase", slider=True)
sub = split.column()
sub.itemL(text="TODO:")
sub.itemL(text="Object aligned")
sub.itemL(text="direction: X, Y, Z")
if part.type=='REACTOR':
sub.itemR(part, "reactor_factor")
sub.itemR(part, "reaction_shape", slider=True)
else:
sub.itemL(text="")
layout.row().itemL(text="Rotation:")
split = layout.split()
sub = split.column()
sub.itemR(part, "rotation_mode", text="Axis")
split = layout.split()
sub = split.column()
sub.itemR(part, "rotation_dynamic")
sub.itemR(part, "random_rotation_factor", slider=True)
sub = split.column()
sub.itemR(part, "phase_factor", slider=True)
sub.itemR(part, "random_phase_factor", text="Random", slider=True)
layout.row().itemL(text="Angular velocity:")
layout.row().itemR(part, "angular_velocity_mode", expand=True)
split = layout.split()
sub = split.column()
sub.itemR(part, "angular_velocity_factor", text="")
class PARTICLE_PT_physics(ParticleButtonsPanel):
__label__ = "Physics"
def poll(self, context):
if particle_panel_poll(context):
return not context.particle_system.point_cache.external
else:
return False
def draw(self, context):
layout = self.layout
psys = context.particle_system
part = psys.settings
layout.enabled = particle_panel_enabled(psys)
row = layout.row()
row.itemR(part, "physics_type", expand=True)
if part.physics_type != 'NO':
row = layout.row()
col = row.column(align=True)
col.itemR(part, "particle_size")
col.itemR(part, "random_size", slider=True)
col = row.column(align=True)
col.itemR(part, "mass")
col.itemR(part, "sizemass", text="Multiply mass with size")
if part.physics_type == 'NEWTON':
split = layout.split()
sub = split.column()
sub.itemL(text="Forces:")
sub.itemR(part, "brownian_factor")
sub.itemR(part, "drag_factor", slider=True)
sub.itemR(part, "damp_factor", slider=True)
sub.itemR(part, "integrator")
sub = split.column()
sub.itemR(part, "acceleration")
elif part.physics_type == 'KEYED':
split = layout.split()
sub = split.column()
row = layout.row()
col = row.column()
col.active = not psys.keyed_timing
col.itemR(part, "keyed_loops", text="Loops")
row.itemR(psys, "keyed_timing", text="Use Timing")
layout.itemL(text="Keys:")
elif part.physics_type=='BOIDS':
boids = part.boids
row = layout.row()
row.itemR(boids, "allow_flight")
row.itemR(boids, "allow_land")
row.itemR(boids, "allow_climb")
split = layout.split()
sub = split.column()
col = sub.column(align=True)
col.active = boids.allow_flight
col.itemR(boids, "air_max_speed")
col.itemR(boids, "air_min_speed", slider="True")
col.itemR(boids, "air_max_acc", slider="True")
col.itemR(boids, "air_max_ave", slider="True")
col.itemR(boids, "air_personal_space")
row = col.row()
row.active = (boids.allow_land or boids.allow_climb) and boids.allow_flight
row.itemR(boids, "landing_smoothness")
sub = split.column()
col = sub.column(align=True)
col.active = boids.allow_land or boids.allow_climb
col.itemR(boids, "land_max_speed")
col.itemR(boids, "land_jump_speed")
col.itemR(boids, "land_max_acc", slider="True")
col.itemR(boids, "land_max_ave", slider="True")
col.itemR(boids, "land_personal_space")
col.itemR(boids, "land_stick_force")
row = layout.row()
col = row.column(align=True)
col.itemL(text="Battle:")
col.itemR(boids, "health")
col.itemR(boids, "strength")
col.itemR(boids, "aggression")
col.itemR(boids, "accuracy")
col.itemR(boids, "range")
col = row.column()
col.itemL(text="Misc:")
col.itemR(part, "gravity")
col.itemR(boids, "banking", slider=True)
col.itemR(boids, "height", slider=True)
if part.physics_type=='NEWTON':
sub.itemR(part, "size_deflect")
sub.itemR(part, "die_on_collision")
elif part.physics_type=='KEYED' or part.physics_type=='BOIDS':
if part.physics_type=='BOIDS':
layout.itemL(text="Relations:")
row = layout.row()
row.template_list(psys, "targets", psys, "active_particle_target_index")
col = row.column()
subrow = col.row()
subcol = subrow.column(align=True)
subcol.itemO("particle.new_target", icon='ICON_ZOOMIN', text="")
subcol.itemO("particle.remove_target", icon='ICON_ZOOMOUT', text="")
subrow = col.row()
subcol = subrow.column(align=True)
subcol.itemO("particle.target_move_up", icon='VICON_MOVE_UP', text="")
subcol.itemO("particle.target_move_down", icon='VICON_MOVE_DOWN', text="")
key = psys.active_particle_target
if key:
row = layout.row()
if part.physics_type=='KEYED':
col = row.column()
#doesn't work yet
#col.red_alert = key.valid
col.itemR(key, "object", text="")
col.itemR(key, "system", text="System")
col = row.column();
col.active = psys.keyed_timing
col.itemR(key, "time")
col.itemR(key, "duration")
else:
subrow = row.row()
#doesn't work yet
#subrow.red_alert = key.valid
subrow.itemR(key, "object", text="")
subrow.itemR(key, "system", text="System")
layout.itemR(key, "mode", expand=True)
class PARTICLE_PT_boidbrain(ParticleButtonsPanel):
__label__ = "Boid Brain"
def poll(self, context):
psys = context.particle_system
if psys==None: return False
if psys.settings==None: return False
if psys.point_cache.external: return False
return psys.settings.physics_type=='BOIDS'
def draw(self, context):
boids = context.particle_system.settings.boids
layout = self.layout
layout.enabled = particle_panel_enabled(psys)
# Currently boids can only use the first state so these are commented out for now.
#row = layout.row()
#row.template_list(boids, "states", boids, "active_boid_state_index", compact="True")
#col = row.row()
#subrow = col.row(align=True)
#subrow.itemO("boid.boidstate_add", icon='ICON_ZOOMIN', text="")
#subrow.itemO("boid.boidstate_del", icon='ICON_ZOOMOUT', text="")
#subrow = row.row(align=True)
#subrow.itemO("boid.boidstate_move_up", icon='VICON_MOVE_UP', text="")
#subrow.itemO("boid.boidstate_move_down", icon='VICON_MOVE_DOWN', text="")
state = boids.active_boid_state
#layout.itemR(state, "name", text="State name")
row = layout.row()
row.itemR(state, "ruleset_type")
if state.ruleset_type=='FUZZY':
row.itemR(state, "rule_fuzziness", slider=True)
else:
row.itemL(text="")
row = layout.row()
row.template_list(state, "rules", state, "active_boid_rule_index")
col = row.column()
subrow = col.row()
subcol = subrow.column(align=True)
subcol.item_menu_enumO("boid.boidrule_add", "type", icon='ICON_ZOOMIN', text="")
subcol.itemO("boid.boidrule_del", icon='ICON_ZOOMOUT', text="")
subrow = col.row()
subcol = subrow.column(align=True)
subcol.itemO("boid.boidrule_move_up", icon='VICON_MOVE_UP', text="")
subcol.itemO("boid.boidrule_move_down", icon='VICON_MOVE_DOWN', text="")
rule = state.active_boid_rule
if rule:
row = layout.row()
row.itemR(rule, "name", text="")
#somebody make nice icons for boids here please! -jahka
row.itemR(rule, "in_air", icon='VICON_MOVE_UP', text="")
row.itemR(rule, "on_land", icon='VICON_MOVE_DOWN', text="")
row = layout.row()
if rule.type == 'GOAL':
row.itemR(rule, "object")
row = layout.row()
row.itemR(rule, "predict")
elif rule.type == 'AVOID':
row.itemR(rule, "object")
row = layout.row()
row.itemR(rule, "predict")
row.itemR(rule, "fear_factor")
elif rule.type == 'FOLLOW_PATH':
row.itemL(text="Not yet functional.")
elif rule.type == 'AVOID_COLLISION':
row.itemR(rule, "boids")
row.itemR(rule, "deflectors")
row.itemR(rule, "look_ahead")
elif rule.type == 'FOLLOW_LEADER':
row.itemR(rule, "object", text="")
row.itemR(rule, "distance")
row = layout.row()
row.itemR(rule, "line")
subrow = row.row()
subrow.active = rule.line
subrow.itemR(rule, "queue_size")
elif rule.type == 'AVERAGE_SPEED':
row.itemR(rule, "speed", slider=True)
row.itemR(rule, "wander", slider=True)
row.itemR(rule, "level", slider=True)
elif rule.type == 'FIGHT':
row.itemR(rule, "distance")
row.itemR(rule, "flee_distance")
class PARTICLE_PT_render(ParticleButtonsPanel):
__label__ = "Render"
def poll(self, context):
psys = context.particle_system
if psys==None: return False
if psys.settings==None: return False
return True;
def draw(self, context):
layout = self.layout
psys = context.particle_system
part = psys.settings
row = layout.row()
row.itemR(part, "material")
row.itemR(psys, "parent");
split = layout.split()
sub = split.column()
sub.itemR(part, "emitter");
sub.itemR(part, "parent");
sub = split.column()
sub.itemR(part, "unborn");
sub.itemR(part, "died");
row = layout.row()
row.itemR(part, "ren_as", expand=True)
split = layout.split()
sub = split.column()
if part.ren_as == 'LINE':
sub.itemR(part, "line_length_tail")
sub.itemR(part, "line_length_head")
sub = split.column()
sub.itemR(part, "velocity_length")
elif part.ren_as == 'PATH':
if (part.type!='HAIR' and part.physics_type!='KEYED' and psys.point_cache.baked==False):
box = layout.box()
box.itemL(text="Baked or keyed particles needed for correct rendering.")
return
sub.itemR(part, "render_strand")
colsub = sub.column()
colsub.active = part.render_strand == False
colsub.itemR(part, "render_adaptive")
colsub = sub.column()
colsub.active = part.render_adaptive or part.render_strand == True
colsub.itemR(part, "adaptive_angle")
colsub = sub.column()
colsub.active = part.render_adaptive == True and part.render_strand == False
colsub.itemR(part, "adaptive_pix")
sub.itemR(part, "hair_bspline")
sub.itemR(part, "render_step", text="Steps")
sub = split.column()
sub.itemL(text="Timing:")
sub.itemR(part, "abs_path_time")
sub.itemR(part, "path_start", text="Start", slider= not part.abs_path_time)
sub.itemR(part, "path_end", text="End", slider= not part.abs_path_time)
sub.itemR(part, "random_length", text="Random", slider=True)
row = layout.row()
col = row.column()
if part.type=='HAIR' and part.render_strand==True and part.child_type=='FACES':
layout.itemR(part, "enable_simplify")
if part.enable_simplify==True:
row = layout.row()
row.itemR(part, "simplify_refsize")
row.itemR(part, "simplify_rate")
row.itemR(part, "simplify_transition")
row = layout.row()
row.itemR(part, "viewport")
subrow = row.row()
subrow.active = part.viewport==True
subrow.itemR(part, "simplify_viewport")
elif part.ren_as == 'OBJECT':
sub.itemR(part, "dupli_object")
elif part.ren_as == 'GROUP':
sub.itemR(part, "dupli_group")
split = layout.split()
sub = split.column()
sub.itemR(part, "whole_group")
sub = split.column()
colsub = sub.column()
colsub.active = part.whole_group == False
colsub.itemR(part, "rand_group")
elif part.ren_as == 'BILLBOARD':
sub.itemL(text="Align:")
row = layout.row()
row.itemR(part, "billboard_align", expand=True)
row.itemR(part, "billboard_lock", text="Lock")
row = layout.row()
row.itemR(part, "billboard_object")
row = layout.row()
col = row.column(align=True)
col.itemL(text="Tilt:")
col.itemR(part, "billboard_tilt", text="Angle", slider=True)
col.itemR(part, "billboard_random_tilt", slider=True)
col = row.column()
col.itemR(part, "billboard_offset")
row = layout.row()
row.itemR(psys, "billboard_normal_uv")
row = layout.row()
row.itemR(psys, "billboard_time_index_uv")
row = layout.row()
row.itemL(text="Split uv's:")
row.itemR(part, "billboard_uv_split", text="Number of splits")
row = layout.row()
row.itemR(psys, "billboard_split_uv")
row = layout.row()
row.itemL(text="Animate:")
row.itemR(part, "billboard_animation", expand=True)
row.itemL(text="Offset:")
row.itemR(part, "billboard_split_offset", expand=True)
if part.ren_as == 'HALO' or part.ren_as == 'LINE' or part.ren_as=='BILLBOARD':
row = layout.row()
col = row.column()
col.itemR(part, "trail_count")
if part.trail_count > 1:
col.itemR(part, "abs_path_time", text="Length in frames")
col = row.column()
col.itemR(part, "path_end", text="Length", slider=not part.abs_path_time)
col.itemR(part, "random_length", text="Random", slider=True)
else:
col = row.column()
col.itemL(text="")
class PARTICLE_PT_draw(ParticleButtonsPanel):
__label__ = "Display"
__default_closed__ = True
def poll(self, context):
psys = context.particle_system
if psys==None: return False
if psys.settings==None: return False
return True;
def draw(self, context):
layout = self.layout
psys = context.particle_system
part = psys.settings
row = layout.row()
row.itemR(part, "draw_as", expand=True)
if part.draw_as=='NONE' or (part.ren_as=='NONE' and part.draw_as=='RENDER'):
return
path = (part.ren_as=='PATH' and part.draw_as=='RENDER') or part.draw_as=='PATH'
if path and part.type!='HAIR' and part.physics_type!='KEYED' and psys.point_cache.baked==False:
box = layout.box()
box.itemL(text="Baked or keyed particles needed for correct drawing.")
return
row = layout.row()
row.itemR(part, "display", slider=True)
if part.draw_as!='RENDER' or part.ren_as=='HALO':
row.itemR(part, "draw_size")
else:
row.itemL(text="")
row = layout.row()
col = row.column()
col.itemR(part, "show_size")
col.itemR(part, "velocity")
col.itemR(part, "num")
if part.physics_type == 'BOIDS':
col.itemR(part, "draw_health")
col = row.column()
col.itemR(part, "material_color", text="Use material color")
if (path):
col.itemR(part, "draw_step")
else:
subcol = col.column()
subcol.active = part.material_color==False
#subcol.itemL(text="color")
#subcol.itemL(text="Override material color")
class PARTICLE_PT_children(ParticleButtonsPanel):
__label__ = "Children"
__default_closed__ = True
def draw(self, context):
layout = self.layout
psys = context.particle_system
part = psys.settings
layout.row().itemR(part, "child_type", expand=True)
if part.child_type=='NONE':
return
row = layout.row()
col = row.column(align=True)
col.itemR(part, "child_nbr", text="Display")
col.itemR(part, "rendered_child_nbr", text="Render")
col = row.column(align=True)
if part.child_type=='FACES':
col.itemR(part, "virtual_parents", slider=True)
else:
col.itemR(part, "child_radius", text="Radius")
col.itemR(part, "child_roundness", text="Roundness", slider=True)
col = row.column(align=True)
col.itemR(part, "child_size", text="Size")
col.itemR(part, "child_random_size", text="Random")
layout.row().itemL(text="Effects:")
row = layout.row()
col = row.column(align=True)
col.itemR(part, "clump_factor", slider=True)
col.itemR(part, "clumppow", slider=True)
col = row.column(align=True)
col.itemR(part, "rough_endpoint")
col.itemR(part, "rough_end_shape")
row = layout.row()
col = row.column(align=True)
col.itemR(part, "rough1")
col.itemR(part, "rough1_size")
col = row.column(align=True)
col.itemR(part, "rough2")
col.itemR(part, "rough2_size")
col.itemR(part, "rough2_thres", slider=True)
row = layout.row()
col = row.column(align=True)
col.itemR(part, "child_length", slider=True)
col.itemR(part, "child_length_thres", slider=True)
col = row.column(align=True)
col.itemL(text="Space reserved for")
col.itemL(text="hair parting controls")
layout.row().itemL(text="Kink:")
layout.row().itemR(part, "kink", expand=True)
split = layout.split()
sub = split.column()
sub.itemR(part, "kink_amplitude")
sub.itemR(part, "kink_frequency")
sub = split.column()
sub.itemR(part, "kink_shape", slider=True)
class PARTICLE_PT_effectors(ParticleButtonsPanel):
__label__ = "Effectors"
__default_closed__ = True
def draw(self, context):
layout = self.layout
psys = context.particle_system
part = psys.settings
layout.itemR(part, "effector_group")
layout.itemR(part, "eweight_all", slider=True)
layout.itemS()
layout.itemR(part, "eweight_spherical", slider=True)
layout.itemR(part, "eweight_vortex", slider=True)
layout.itemR(part, "eweight_magnetic", slider=True)
layout.itemR(part, "eweight_wind", slider=True)
layout.itemR(part, "eweight_curveguide", slider=True)
layout.itemR(part, "eweight_texture", slider=True)
layout.itemR(part, "eweight_harmonic", slider=True)
layout.itemR(part, "eweight_charge", slider=True)
layout.itemR(part, "eweight_lennardjones", slider=True)
class PARTICLE_PT_vertexgroups(ParticleButtonsPanel):
__label__ = "Vertexgroups"
__default_closed__ = True
def draw(self, context):
layout = self.layout
psys = context.particle_system
part = psys.settings
layout.itemL(text="Nothing here yet.")
#row = layout.row()
#row.itemL(text="Vertex Group")
#row.itemL(text="Negate")
#row = layout.row()
#row.itemR(psys, "vertex_group_density")
#row.itemR(psys, "vertex_group_density_negate", text="")
#row = layout.row()
#row.itemR(psys, "vertex_group_velocity")
#row.itemR(psys, "vertex_group_velocity_negate", text="")
#row = layout.row()
#row.itemR(psys, "vertex_group_length")
#row.itemR(psys, "vertex_group_length_negate", text="")
#row = layout.row()
#row.itemR(psys, "vertex_group_clump")
#row.itemR(psys, "vertex_group_clump_negate", text="")
#row = layout.row()
#row.itemR(psys, "vertex_group_kink")
#row.itemR(psys, "vertex_group_kink_negate", text="")
#row = layout.row()
#row.itemR(psys, "vertex_group_roughness1")
#row.itemR(psys, "vertex_group_roughness1_negate", text="")
#row = layout.row()
#row.itemR(psys, "vertex_group_roughness2")
#row.itemR(psys, "vertex_group_roughness2_negate", text="")
#row = layout.row()
#row.itemR(psys, "vertex_group_roughness_end")
#row.itemR(psys, "vertex_group_roughness_end_negate", text="")
#row = layout.row()
#row.itemR(psys, "vertex_group_size")
#row.itemR(psys, "vertex_group_size_negate", text="")
#row = layout.row()
#row.itemR(psys, "vertex_group_tangent")
#row.itemR(psys, "vertex_group_tangent_negate", text="")
#row = layout.row()
#row.itemR(psys, "vertex_group_rotation")
#row.itemR(psys, "vertex_group_rotation_negate", text="")
#row = layout.row()
#row.itemR(psys, "vertex_group_field")
#row.itemR(psys, "vertex_group_field_negate", text="")
bpy.types.register(PARTICLE_PT_particles)
bpy.types.register(PARTICLE_PT_hair_dynamics)
bpy.types.register(PARTICLE_PT_cache)
bpy.types.register(PARTICLE_PT_emission)
bpy.types.register(PARTICLE_PT_initial)
bpy.types.register(PARTICLE_PT_physics)
bpy.types.register(PARTICLE_PT_boidbrain)
bpy.types.register(PARTICLE_PT_render)
bpy.types.register(PARTICLE_PT_draw)
bpy.types.register(PARTICLE_PT_children)
bpy.types.register(PARTICLE_PT_effectors)
bpy.types.register(PARTICLE_PT_vertexgroups)

View File

@@ -0,0 +1,172 @@
import bpy
from buttons_particle import point_cache_ui
def cloth_panel_enabled(md):
return md.point_cache.baked==False
class PhysicButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "physics"
def poll(self, context):
ob = context.object
rd = context.scene.render_data
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
class PHYSICS_PT_cloth(PhysicButtonsPanel):
__label__ = "Cloth"
def draw(self, context):
layout = self.layout
md = context.cloth
ob = context.object
split = layout.split()
split.operator_context = 'EXEC_DEFAULT'
if md:
# remove modifier + settings
split.set_context_pointer("modifier", md)
split.itemO("object.modifier_remove", text="Remove")
row = split.row(align=True)
row.itemR(md, "render", text="")
row.itemR(md, "realtime", text="")
else:
# add modifier
split.item_enumO("object.modifier_add", "type", 'CLOTH', text="Add")
split.itemL()
if md:
cloth = md.settings
layout.active = cloth_panel_enabled(md)
split = layout.split()
col = split.column()
col.itemL(text="Quality:")
col.itemR(cloth, "quality", text="Steps",slider=True)
col.itemL(text="Gravity:")
col.itemR(cloth, "gravity", text="")
col.itemR(cloth, "pin_cloth", text="Pin")
sub = col.column(align=True)
sub.active = cloth.pin_cloth
sub.itemR(cloth, "pin_stiffness", text="Stiffness")
sub.item_pointerR(cloth, "mass_vertex_group", ob, "vertex_groups", text="")
col = split.column()
col.itemL(text="Presets...")
col.itemL(text="TODO!")
col.itemL(text="Material:")
sub = col.column(align=True)
sub.itemR(cloth, "mass")
sub.itemR(cloth, "structural_stiffness", text="Structural")
sub.itemR(cloth, "bending_stiffness", text="Bending")
col.itemL(text="Damping:")
sub = col.column(align=True)
sub.itemR(cloth, "spring_damping", text="Spring")
sub.itemR(cloth, "air_damping", text="Air")
# Disabled for now
"""
if cloth.mass_vertex_group:
layout.itemL(text="Goal:")
col = layout.column_flow()
col.itemR(cloth, "goal_default", text="Default")
col.itemR(cloth, "goal_spring", text="Stiffness")
col.itemR(cloth, "goal_friction", text="Friction")
"""
class PHYSICS_PT_cloth_cache(PhysicButtonsPanel):
__label__ = "Cloth Cache"
__default_closed__ = True
def poll(self, context):
return (context.cloth)
def draw(self, context):
md = context.cloth
point_cache_ui(self, md.point_cache, cloth_panel_enabled(md), 0, 0)
class PHYSICS_PT_cloth_collision(PhysicButtonsPanel):
__label__ = "Cloth Collision"
__default_closed__ = True
def poll(self, context):
return (context.cloth)
def draw_header(self, context):
cloth = context.cloth.collision_settings
self.layout.active = cloth_panel_enabled(context.cloth)
self.layout.itemR(cloth, "enable_collision", text="")
def draw(self, context):
layout = self.layout
cloth = context.cloth.collision_settings
md = context.cloth
layout.active = cloth.enable_collision and cloth_panel_enabled(md)
split = layout.split()
col = split.column()
col.itemR(cloth, "collision_quality", slider=True, text="Quality")
col.itemR(cloth, "min_distance", slider=True, text="Distance")
col.itemR(cloth, "friction")
col = split.column()
col.itemR(cloth, "enable_self_collision", text="Self Collision")
sub = col.column()
sub.active = cloth.enable_self_collision
sub.itemR(cloth, "self_collision_quality", slider=True, text="Quality")
sub.itemR(cloth, "self_min_distance", slider=True, text="Distance")
class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel):
__label__ = "Cloth Stiffness Scaling"
__default_closed__ = True
def poll(self, context):
return (context.cloth != None)
def draw_header(self, context):
cloth = context.cloth.settings
self.layout.active = cloth_panel_enabled(context.cloth)
self.layout.itemR(cloth, "stiffness_scaling", text="")
def draw(self, context):
layout = self.layout
md = context.cloth
ob = context.object
cloth = context.cloth.settings
layout.active = cloth.stiffness_scaling and cloth_panel_enabled(md)
split = layout.split()
col = split.column()
col.itemL(text="Structural Stiffness:")
sub = col.column(align=True)
sub.itemR(cloth, "structural_stiffness_max", text="Max")
sub.item_pointerR(cloth, "structural_stiffness_vertex_group", ob, "vertex_groups", text="")
col = split.column()
col.itemL(text="Bending Stiffness:")
sub = col.column(align=True)
sub.itemR(cloth, "bending_stiffness_max", text="Max")
sub.item_pointerR(cloth, "bending_vertex_group", ob, "vertex_groups", text="")
bpy.types.register(PHYSICS_PT_cloth)
bpy.types.register(PHYSICS_PT_cloth_cache)
bpy.types.register(PHYSICS_PT_cloth_collision)
bpy.types.register(PHYSICS_PT_cloth_stiffness)

View File

@@ -0,0 +1,230 @@
import bpy
class PhysicButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "physics"
def poll(self, context):
rd = context.scene.render_data
return (context.object) and (not rd.use_game_engine)
class PHYSICS_PT_field(PhysicButtonsPanel):
__label__ = "Force Fields"
__default_closed__ = True
def draw(self, context):
layout = self.layout
ob = context.object
field = ob.field
#layout.active = field.enabled
split = layout.split(percentage=0.2)
split.itemL(text="Type:")
split.itemR(field, "type",text="")
split = layout.split()
if field.type == 'GUIDE':
layout.itemR(field, "guide_path_add")
elif field.type == 'WIND':
split.itemR(field, "strength")
col = split.column()
col.itemR(field, "noise")
col.itemR(field, "seed")
elif field.type == 'VORTEX':
split.itemR(field, "strength")
split.itemL()
elif field.type in ('SPHERICAL', 'CHARGE', 'LENNARDJ'):
split.itemR(field, "strength")
col = split.column()
col.itemR(field, "planar")
col.itemR(field, "surface")
elif field.type == 'BOID':
split.itemR(field, "strength")
split.itemR(field, "surface")
elif field.type == 'MAGNET':
split.itemR(field, "strength")
split.itemR(field, "planar")
elif field.type == 'HARMONIC':
col = split.column()
col.itemR(field, "strength")
col.itemR(field, "harmonic_damping", text="Damping")
col = split.column()
col.itemR(field, "planar")
col.itemR(field, "surface")
elif field.type == 'TEXTURE':
col = split.column()
col.itemR(field, "strength")
col.itemR(field, "texture", text="")
col.itemR(field, "texture_mode", text="")
col.itemR(field, "texture_nabla")
col = split.column()
col.itemR(field, "use_coordinates")
col.itemR(field, "root_coordinates")
col.itemR(field, "force_2d")
if field.type in ('HARMONIC', 'SPHERICAL', 'CHARGE', 'WIND', 'VORTEX', 'TEXTURE', 'MAGNET', 'BOID'):
layout.itemL(text="Falloff:")
layout.itemR(field, "falloff_type", expand=True)
split = layout.split(percentage=0.35)
col = split.column()
col.itemR(field, "positive_z", text="Positive Z")
col.itemR(field, "use_min_distance", text="Use Minimum")
col.itemR(field, "use_max_distance", text="Use Maximum")
col = split.column()
col.itemR(field, "falloff_power", text="Power")
sub = col.column()
sub.active = field.use_min_distance
sub.itemR(field, "minimum_distance", text="Distance")
sub = col.column()
sub.active = field.use_max_distance
sub.itemR(field, "maximum_distance", text="Distance")
if field.falloff_type == 'CONE':
layout.itemS()
split = layout.split(percentage=0.35)
col = split.column()
col.itemL(text="Angular:")
col.itemR(field, "use_radial_min", text="Use Minimum")
col.itemR(field, "use_radial_max", text="Use Maximum")
col = split.column()
col.itemR(field, "radial_falloff", text="Power")
sub = col.column()
sub.active = field.use_radial_min
sub.itemR(field, "radial_minimum", text="Angle")
sub = col.column()
sub.active = field.use_radial_max
sub.itemR(field, "radial_maximum", text="Angle")
elif field.falloff_type == 'TUBE':
layout.itemS()
split = layout.split(percentage=0.35)
col = split.column()
col.itemL(text="Radial:")
col.itemR(field, "use_radial_min", text="Use Minimum")
col.itemR(field, "use_radial_max", text="Use Maximum")
col = split.column()
col.itemR(field, "radial_falloff", text="Power")
sub = col.column()
sub.active = field.use_radial_min
sub.itemR(field, "radial_minimum", text="Distance")
sub = col.column()
sub.active = field.use_radial_max
sub.itemR(field, "radial_maximum", text="Distance")
#if ob.type in 'CURVE':
#if field.type == 'GUIDE':
#colsub = col.column(align=True)
#if field.type != 'NONE':
#layout.itemR(field, "strength")
#if field.type in ('HARMONIC', 'SPHERICAL', 'CHARGE', "LENNARDj"):
#if ob.type in ('MESH', 'SURFACE', 'FONT', 'CURVE'):
#layout.itemR(field, "surface")
class PHYSICS_PT_collision(PhysicButtonsPanel):
__label__ = "Collision"
__default_closed__ = True
def poll(self, context):
ob = context.object
rd = context.scene.render_data
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
def draw(self, context):
layout = self.layout
md = context.collision
split = layout.split()
split.operator_context = 'EXEC_DEFAULT'
if md:
# remove modifier + settings
split.set_context_pointer("modifier", md)
split.itemO("object.modifier_remove", text="Remove")
col = split.column()
#row = split.row(align=True)
#row.itemR(md, "render", text="")
#row.itemR(md, "realtime", text="")
coll = md.settings
else:
# add modifier
split.item_enumO("object.modifier_add", "type", 'COLLISION', text="Add")
split.itemL()
coll = None
if coll:
settings = context.object.collision
layout.active = settings.enabled
split = layout.split()
col = split.column()
col.itemL(text="Particle:")
col.itemR(settings, "permeability", slider=True)
col.itemL(text="Particle Damping:")
sub = col.column(align=True)
sub.itemR(settings, "damping_factor", text="Factor", slider=True)
sub.itemR(settings, "random_damping", text="Random", slider=True)
col.itemL(text="Soft Body and Cloth:")
sub = col.column(align=True)
sub.itemR(settings, "outer_thickness", text="Outer", slider=True)
sub.itemR(settings, "inner_thickness", text="Inner", slider=True)
layout.itemL(text="Force Fields:")
layout.itemR(md, "absorption", text="Absorption")
col = split.column()
col.itemL(text="")
col.itemR(settings, "kill_particles")
col.itemL(text="Particle Friction:")
sub = col.column(align=True)
sub.itemR(settings, "friction_factor", text="Factor", slider=True)
sub.itemR(settings, "random_friction", text="Random", slider=True)
col.itemL(text="Soft Body Damping:")
col.itemR(settings, "damping", text="Factor", slider=True)
bpy.types.register(PHYSICS_PT_field)
bpy.types.register(PHYSICS_PT_collision)

View File

@@ -0,0 +1,260 @@
import bpy
class PhysicButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "physics"
def poll(self, context):
ob = context.object
rd = context.scene.render_data
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
class PHYSICS_PT_fluid(PhysicButtonsPanel):
__label__ = "Fluid"
def draw(self, context):
layout = self.layout
md = context.fluid
ob = context.object
split = layout.split()
split.operator_context = 'EXEC_DEFAULT'
if md:
# remove modifier + settings
split.set_context_pointer("modifier", md)
split.itemO("object.modifier_remove", text="Remove")
row = split.row(align=True)
row.itemR(md, "render", text="")
row.itemR(md, "realtime", text="")
fluid = md.settings
else:
# add modifier
split.item_enumO("object.modifier_add", "type", 'FLUID_SIMULATION', text="Add")
split.itemL()
fluid = None
if fluid:
layout.itemR(fluid, "type")
if fluid.type == 'DOMAIN':
layout.itemO("fluid.bake", text="Bake Fluid Simulation", icon='ICON_MOD_FLUIDSIM')
split = layout.split()
col = split.column()
col.itemL(text="Resolution:")
col.itemR(fluid, "resolution", text="Final")
col.itemL(text="Render Display:")
col.itemR(fluid, "render_display_mode", text="")
col.itemL(text="Time:")
sub = col.column(align=True)
sub.itemR(fluid, "start_time", text="Start")
sub.itemR(fluid, "end_time", text="End")
col = split.column()
col.itemL(text="Required Memory: " + fluid.memory_estimate)
col.itemR(fluid, "preview_resolution", text="Preview")
col.itemL(text="Viewport Display:")
col.itemR(fluid, "viewport_display_mode", text="")
col.itemL()
col.itemR(fluid, "generate_speed_vectors")
col.itemR(fluid, "reverse_frames")
layout.itemR(fluid, "path", text="")
elif fluid.type == 'FLUID':
split = layout.split()
col = split.column()
col.itemL(text="Volume Initialization:")
col.itemR(fluid, "volume_initialization", text="")
col.itemR(fluid, "export_animated_mesh")
col = split.column()
col.itemL(text="Initial Velocity:")
col.itemR(fluid, "initial_velocity", text="")
elif fluid.type == 'OBSTACLE':
split = layout.split()
col = split.column()
col.itemL(text="Volume Initialization:")
col.itemR(fluid, "volume_initialization", text="")
col.itemR(fluid, "export_animated_mesh")
col = split.column()
col.itemL(text="Slip Type:")
col.itemR(fluid, "slip_type", text="")
if fluid.slip_type == 'PARTIALSLIP':
col.itemR(fluid, "partial_slip_factor", slider=True, text="Amount")
col.itemL(text="Impact:")
col.itemR(fluid, "impact_factor", text="Factor")
elif fluid.type == 'INFLOW':
split = layout.split()
col = split.column()
col.itemL(text="Volume Initialization:")
col.itemR(fluid, "volume_initialization", text="")
col.itemR(fluid, "export_animated_mesh")
col.itemR(fluid, "local_coordinates")
col = split.column()
col.itemL(text="Inflow Velocity:")
col.itemR(fluid, "inflow_velocity", text="")
elif fluid.type == 'OUTFLOW':
split = layout.split()
col = split.column()
col.itemL(text="Volume Initialization:")
col.itemR(fluid, "volume_initialization", text="")
col.itemR(fluid, "export_animated_mesh")
split.column()
elif fluid.type == 'PARTICLE':
split = layout.split(percentage=0.5)
col = split.column()
col.itemL(text="Influence:")
col.itemR(fluid, "particle_influence", text="Size")
col.itemR(fluid, "alpha_influence", text="Alpha")
col = split.column()
col.itemL(text="Type:")
col.itemR(fluid, "drops")
col.itemR(fluid, "floats")
col = split.column()
col.itemL()
col.itemR(fluid, "tracer")
layout.itemR(fluid, "path", text="")
elif fluid.type == 'CONTROL':
split = layout.split()
col = split.column()
col.itemL(text="")
col.itemR(fluid, "quality", slider=True)
col.itemR(fluid, "reverse_frames")
col = split.column()
col.itemL(text="Time:")
sub = col.column(align=True)
sub.itemR(fluid, "start_time", text="Start")
sub.itemR(fluid, "end_time", text="End")
split = layout.split()
col = split.column()
col.itemL(text="Attraction Force:")
sub = col.column(align=True)
sub.itemR(fluid, "attraction_strength", text="Strength")
sub.itemR(fluid, "attraction_radius", text="Radius")
col = split.column()
col.itemL(text="Velocity Force:")
sub = col.column(align=True)
sub.itemR(fluid, "velocity_strength", text="Strength")
sub.itemR(fluid, "velocity_radius", text="Radius")
class PHYSICS_PT_domain_gravity(PhysicButtonsPanel):
__label__ = "Domain World"
__default_closed__ = True
def poll(self, context):
md = context.fluid
if md:
return (md.settings.type == 'DOMAIN')
def draw(self, context):
layout = self.layout
fluid = context.fluid.settings
split = layout.split()
col = split.column()
col.itemL(text="Gravity:")
col.itemR(fluid, "gravity", text="")
col.itemL(text="Real World Size:")
col.itemR(fluid, "real_world_size", text="Metres")
col = split.column()
col.itemL(text="Viscosity Presets:")
sub = col.column(align=True)
sub.itemR(fluid, "viscosity_preset", text="")
if fluid.viscosity_preset == 'MANUAL':
sub.itemR(fluid, "viscosity_base", text="Base")
sub.itemR(fluid, "viscosity_exponent", text="Exponent", slider=True)
else:
sub.itemL()
sub.itemL()
col.itemL(text="Optimization:")
sub = col.column(align=True)
sub.itemR(fluid, "grid_levels", slider=True)
sub.itemR(fluid, "compressibility", slider=True)
class PHYSICS_PT_domain_boundary(PhysicButtonsPanel):
__label__ = "Domain Boundary"
__default_closed__ = True
def poll(self, context):
md = context.fluid
if md:
return (md.settings.type == 'DOMAIN')
def draw(self, context):
layout = self.layout
fluid = context.fluid.settings
split = layout.split()
col = split.column()
col.itemL(text="Slip Type:")
sub = col.column(align=True)
sub.itemR(fluid, "slip_type", text="")
if fluid.slip_type == 'PARTIALSLIP':
sub.itemR(fluid, "partial_slip_factor", slider=True, text="Amount")
col = split.column()
col.itemL(text="Surface:")
sub = col.column(align=True)
sub.itemR(fluid, "surface_smoothing", text="Smoothing")
sub.itemR(fluid, "surface_subdivisions", text="Subdivisions")
class PHYSICS_PT_domain_particles(PhysicButtonsPanel):
__label__ = "Domain Particles"
__default_closed__ = True
def poll(self, context):
md = context.fluid
if md:
return (md.settings.type == 'DOMAIN')
def draw(self, context):
layout = self.layout
fluid = context.fluid.settings
col = layout.column(align=True)
col.itemR(fluid, "tracer_particles")
col.itemR(fluid, "generate_particles")
bpy.types.register(PHYSICS_PT_fluid)
bpy.types.register(PHYSICS_PT_domain_gravity)
bpy.types.register(PHYSICS_PT_domain_boundary)
bpy.types.register(PHYSICS_PT_domain_particles)

View File

@@ -0,0 +1,182 @@
import bpy
from buttons_particle import point_cache_ui
class PhysicButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "physics"
def poll(self, context):
ob = context.object
rd = context.scene.render_data
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
class PHYSICS_PT_smoke(PhysicButtonsPanel):
__label__ = "Smoke"
def draw(self, context):
layout = self.layout
md = context.smoke
ob = context.object
split = layout.split()
split.operator_context = 'EXEC_DEFAULT'
if md:
# remove modifier + settings
split.set_context_pointer("modifier", md)
split.itemO("object.modifier_remove", text="Remove")
row = split.row(align=True)
row.itemR(md, "render", text="")
row.itemR(md, "realtime", text="")
else:
# add modifier
split.item_enumO("object.modifier_add", "type", 'SMOKE', text="Add")
split.itemL()
if md:
layout.itemR(md, "smoke_type", expand=True)
if md.smoke_type == 'TYPE_DOMAIN':
domain = md.domain_settings
split = layout.split()
col = split.column()
col.itemL(text="Resolution:")
col.itemR(domain, "maxres", text="Divisions")
col = split.column()
col.itemL(text="Behavior:")
col.itemR(domain, "alpha")
col.itemR(domain, "beta")
col.itemR(domain, "dissolve_smoke", text="Dissolve")
sub = col.column()
sub.active = domain.dissolve_smoke
sub.itemR(domain, "dissolve_speed", text="Time")
sub.itemR(domain, "dissolve_smoke_log", text="Slow")
elif md.smoke_type == 'TYPE_FLOW':
flow = md.flow_settings
split = layout.split()
col = split.column()
col.itemR(flow, "outflow")
col.itemL(text="Particle System:")
col.item_pointerR(flow, "psys", ob, "particle_systems", text="")
if md.flow_settings.outflow:
col = split.column()
else:
col = split.column()
col.itemL(text="Behavior:")
col.itemR(flow, "temperature")
col.itemR(flow, "density")
#elif md.smoke_type == 'TYPE_COLL':
# layout.itemS()
class PHYSICS_PT_smoke_groups(PhysicButtonsPanel):
__label__ = "Smoke Groups"
__default_closed__ = True
def poll(self, context):
md = context.smoke
if md:
return (md.smoke_type == 'TYPE_DOMAIN')
return False
def draw(self, context):
layout = self.layout
group = context.smoke.domain_settings
split = layout.split()
col = split.column()
col.itemL(text="Flow Group:")
col.itemR(group, "fluid_group", text="")
#col.itemL(text="Effector Group:")
#col.itemR(group, "eff_group", text="")
col = split.column()
col.itemL(text="Collision Group:")
col.itemR(group, "coll_group", text="")
class PHYSICS_PT_smoke_cache(PhysicButtonsPanel):
__label__ = "Smoke Cache"
__default_closed__ = True
def poll(self, context):
md = context.smoke
return md and (md.smoke_type == 'TYPE_DOMAIN')
def draw(self, context):
layout = self.layout
md = context.smoke.domain_settings
cache = md.point_cache_low
point_cache_ui(self, cache, cache.baked==False, 0, 1)
class PHYSICS_PT_smoke_highres(PhysicButtonsPanel):
__label__ = "Smoke High Resolution"
__default_closed__ = True
def poll(self, context):
md = context.smoke
return md and (md.smoke_type == 'TYPE_DOMAIN')
def draw_header(self, context):
high = context.smoke.domain_settings
self.layout.itemR(high, "highres", text="")
def draw(self, context):
layout = self.layout
md = context.smoke.domain_settings
split = layout.split()
col = split.column()
col.itemL(text="Resolution:")
col.itemR(md, "amplify", text="Divisions")
col = split.column()
col.itemL(text="Noise Method:")
col.row().itemR(md, "noise_type", text="")
col.itemR(md, "strength")
col.itemR(md, "viewhighres")
class PHYSICS_PT_smoke_cache_highres(PhysicButtonsPanel):
__label__ = "Smoke High Resolution Cache"
__default_closed__ = True
def poll(self, context):
md = context.smoke
return md and (md.smoke_type == 'TYPE_DOMAIN') and md.domain_settings.highres
def draw(self, context):
layout = self.layout
md = context.smoke.domain_settings
cache = md.point_cache_high
point_cache_ui(self, cache, cache.baked==False, 0, 1)
bpy.types.register(PHYSICS_PT_smoke)
bpy.types.register(PHYSICS_PT_smoke_cache)
bpy.types.register(PHYSICS_PT_smoke_highres)
bpy.types.register(PHYSICS_PT_smoke_groups)
bpy.types.register(PHYSICS_PT_smoke_cache_highres)

View File

@@ -0,0 +1,231 @@
import bpy
from buttons_particle import point_cache_ui
def softbody_panel_enabled(md):
return md.point_cache.baked==False
class PhysicButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "physics"
def poll(self, context):
ob = context.object
rd = context.scene.render_data
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
class PHYSICS_PT_softbody(PhysicButtonsPanel):
__label__ = "Soft Body"
def draw(self, context):
layout = self.layout
md = context.soft_body
ob = context.object
split = layout.split()
split.operator_context = "EXEC_DEFAULT"
if md:
# remove modifier + settings
split.set_context_pointer("modifier", md)
split.itemO("object.modifier_remove", text="Remove")
row = split.row(align=True)
row.itemR(md, "render", text="")
row.itemR(md, "realtime", text="")
else:
# add modifier
split.item_enumO("object.modifier_add", "type", 'SOFT_BODY', text="Add")
split.itemL("")
if md:
softbody = md.settings
# General
split = layout.split()
split.enabled = softbody_panel_enabled(md)
col = split.column()
col.itemL(text="Object:")
col.itemR(softbody, "mass")
col.itemR(softbody, "friction")
col = split.column()
col.itemL(text="Simulation:")
col.itemR(softbody, "gravity")
col.itemR(softbody, "speed")
class PHYSICS_PT_softbody_cache(PhysicButtonsPanel):
__label__ = "Soft Body Cache"
__default_closed__ = True
def poll(self, context):
return (context.soft_body)
def draw(self, context):
md = context.soft_body
point_cache_ui(self, md.point_cache, softbody_panel_enabled(md), 0, 0)
class PHYSICS_PT_softbody_goal(PhysicButtonsPanel):
__label__ = "Soft Body Goal"
__default_closed__ = True
def poll(self, context):
return (context.soft_body)
def draw_header(self, context):
softbody = context.soft_body.settings
self.layout.active = softbody_panel_enabled(context.soft_body)
self.layout.itemR(softbody, "use_goal", text="")
def draw(self, context):
layout = self.layout
md = context.soft_body
softbody = md.settings
ob = context.object
layout.active = softbody.use_goal and softbody_panel_enabled(md)
split = layout.split()
# Goal
split = layout.split()
col = split.column()
col.itemL(text="Goal Strengths:")
col.itemR(softbody, "goal_default", text="Default")
sub = col.column(align=True)
sub.itemR(softbody, "goal_min", text="Minimum")
sub.itemR(softbody, "goal_max", text="Maximum")
col = split.column()
col.itemL(text="Goal Settings:")
col.itemR(softbody, "goal_spring", text="Stiffness")
col.itemR(softbody, "goal_friction", text="Damping")
layout.item_pointerR(softbody, "goal_vertex_group", ob, "vertex_groups", text="Vertex Group")
class PHYSICS_PT_softbody_edge(PhysicButtonsPanel):
__label__ = "Soft Body Edges"
__default_closed__ = True
def poll(self, context):
return (context.soft_body)
def draw_header(self, context):
softbody = context.soft_body.settings
self.layout.active = softbody_panel_enabled(context.soft_body)
self.layout.itemR(softbody, "use_edges", text="")
def draw(self, context):
layout = self.layout
md = context.soft_body
softbody = md.settings
ob = context.object
layout.active = softbody.use_edges and softbody_panel_enabled(md)
split = layout.split()
col = split.column()
col.itemL(text="Springs:")
col.itemR(softbody, "pull")
col.itemR(softbody, "push")
col.itemR(softbody, "damp")
col.itemR(softbody, "plastic")
col.itemR(softbody, "bending")
col.itemR(softbody, "spring_length", text="Length")
col = split.column()
col.itemR(softbody, "stiff_quads")
sub = col.column()
sub.active = softbody.stiff_quads
sub.itemR(softbody, "shear")
col.itemR(softbody, "new_aero", text="Aero")
sub = col.column()
sub.enabled = softbody.new_aero
sub.itemR(softbody, "aero", text="Factor")
col.itemL(text="Collision:")
col.itemR(softbody, "edge_collision", text="Edge")
col.itemR(softbody, "face_collision", text="Face")
class PHYSICS_PT_softbody_collision(PhysicButtonsPanel):
__label__ = "Soft Body Collision"
__default_closed__ = True
def poll(self, context):
return (context.soft_body)
def draw_header(self, context):
softbody = context.soft_body.settings
self.layout.active = softbody_panel_enabled(context.soft_body)
self.layout.itemR(softbody, "self_collision", text="")
def draw(self, context):
layout = self.layout
md = context.soft_body
softbody = md.settings
ob = context.object
layout.active = softbody.self_collision and softbody_panel_enabled(md)
layout.itemL(text="Collision Type:")
layout.itemR(softbody, "collision_type", expand=True)
col = layout.column(align=True)
col.itemL(text="Ball:")
col.itemR(softbody, "ball_size", text="Size")
col.itemR(softbody, "ball_stiff", text="Stiffness")
col.itemR(softbody, "ball_damp", text="Dampening")
class PHYSICS_PT_softbody_solver(PhysicButtonsPanel):
__label__ = "Soft Body Solver"
__default_closed__ = True
def poll(self, context):
return (context.soft_body)
def draw(self, context):
layout = self.layout
md = context.soft_body
softbody = md.settings
ob = context.object
layout.active = softbody_panel_enabled(md)
# Solver
split = layout.split()
col = split.column(align=True)
col.itemL(text="Step Size:")
col.itemR(softbody, "minstep")
col.itemR(softbody, "maxstep")
col.itemR(softbody, "auto_step", text="Auto-Step")
col = split.column()
col.itemR(softbody, "error_limit")
col.itemL(text="Helpers:")
col.itemR(softbody, "choke")
col.itemR(softbody, "fuzzy")
layout.itemL(text="Diagnostics:")
layout.itemR(softbody, "diagnose")
bpy.types.register(PHYSICS_PT_softbody)
bpy.types.register(PHYSICS_PT_softbody_cache)
bpy.types.register(PHYSICS_PT_softbody_goal)
bpy.types.register(PHYSICS_PT_softbody_edge)
bpy.types.register(PHYSICS_PT_softbody_collision)
bpy.types.register(PHYSICS_PT_softbody_solver)

463
release/ui/buttons_scene.py Normal file
View File

@@ -0,0 +1,463 @@
import bpy
class RenderButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "scene"
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
def poll(self, context):
rd = context.scene.render_data
return (rd.use_game_engine==False) and (rd.engine in self.COMPAT_ENGINES)
class SCENE_PT_render(RenderButtonsPanel):
__label__ = "Render"
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def draw(self, context):
layout = self.layout
rd = context.scene.render_data
row = layout.row()
row.itemO("screen.render", text="Image", icon='ICON_RENDER_RESULT')
row.item_booleanO("screen.render", "animation", True, text="Animation", icon='ICON_RENDER_ANIMATION')
layout.itemR(rd, "display_mode", text="Display")
class SCENE_PT_layers(RenderButtonsPanel):
__label__ = "Layers"
__default_closed__ = True
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def draw(self, context):
layout = self.layout
scene = context.scene
rd = scene.render_data
row = layout.row()
row.template_list(rd, "layers", rd, "active_layer_index", rows=2)
col = row.column(align=True)
col.itemO("scene.render_layer_add", icon='ICON_ZOOMIN', text="")
col.itemO("scene.render_layer_remove", icon='ICON_ZOOMOUT', text="")
rl = rd.layers[rd.active_layer_index]
split = layout.split()
col = split.column()
col.itemR(scene, "visible_layers", text="Scene")
col = split.column()
col.itemR(rl, "visible_layers", text="Layer")
layout.itemR(rl, "light_override", text="Light")
layout.itemR(rl, "material_override", text="Material")
layout.itemS()
layout.itemL(text="Include:")
split = layout.split()
col = split.column()
col.itemR(rl, "zmask")
row = col.row()
row.itemR(rl, "zmask_negate", text="Negate")
row.active = rl.zmask
col.itemR(rl, "all_z")
col = split.column()
col.itemR(rl, "solid")
col.itemR(rl, "halo")
col.itemR(rl, "ztransp")
col = split.column()
col.itemR(rl, "sky")
col.itemR(rl, "edge")
col.itemR(rl, "strand")
if rl.zmask:
split = layout.split()
split.itemL(text="Zmask Layers:")
split.column().itemR(rl, "zmask_layers", text="")
layout.itemS()
split = layout.split()
col = split.column()
col.itemL(text="Passes:")
col.itemR(rl, "pass_combined")
col.itemR(rl, "pass_z")
col.itemR(rl, "pass_vector")
col.itemR(rl, "pass_normal")
col.itemR(rl, "pass_uv")
col.itemR(rl, "pass_mist")
col.itemR(rl, "pass_object_index")
col = split.column()
col.itemL()
col.itemR(rl, "pass_color")
col.itemR(rl, "pass_diffuse")
row = col.row()
row.itemR(rl, "pass_specular")
row.itemR(rl, "pass_specular_exclude", text="", icon='ICON_X')
row = col.row()
row.itemR(rl, "pass_shadow")
row.itemR(rl, "pass_shadow_exclude", text="", icon='ICON_X')
row = col.row()
row.itemR(rl, "pass_ao")
row.itemR(rl, "pass_ao_exclude", text="", icon='ICON_X')
row = col.row()
row.itemR(rl, "pass_reflection")
row.itemR(rl, "pass_reflection_exclude", text="", icon='ICON_X')
row = col.row()
row.itemR(rl, "pass_refraction")
row.itemR(rl, "pass_refraction_exclude", text="", icon='ICON_X')
class SCENE_PT_shading(RenderButtonsPanel):
__label__ = "Shading"
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def draw(self, context):
layout = self.layout
rd = context.scene.render_data
split = layout.split()
col = split.column()
col.itemR(rd, "render_textures", text="Textures")
col.itemR(rd, "render_shadows", text="Shadows")
col.itemR(rd, "render_sss", text="Subsurface Scattering")
col.itemR(rd, "render_envmaps", text="Environment Map")
col = split.column()
col.itemR(rd, "render_raytracing", text="Ray Tracing")
col.itemR(rd, "color_management")
col.itemR(rd, "alpha_mode", text="Alpha")
class SCENE_PT_performance(RenderButtonsPanel):
__label__ = "Performance"
__default_closed__ = True
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def draw(self, context):
layout = self.layout
rd = context.scene.render_data
split = layout.split()
col = split.column(align=True)
col.itemL(text="Threads:")
col.row().itemR(rd, "threads_mode", expand=True)
sub = col.column()
sub.enabled = rd.threads_mode == 'THREADS_FIXED'
sub.itemR(rd, "threads")
col.itemL(text="Tiles:")
col.itemR(rd, "parts_x", text="X")
col.itemR(rd, "parts_y", text="Y")
col = split.column()
col.itemL(text="Memory:")
sub = col.column()
sub.itemR(rd, "save_buffers")
sub.enabled = not rd.full_sample
sub = col.column()
sub.active = rd.use_compositing
sub.itemR(rd, "free_image_textures")
sub = col.column()
sub.active = rd.render_raytracing
sub.itemL(text="Ray Tracing Octree:")
sub.itemR(rd, "octree_resolution", text="")
class SCENE_PT_post_processing(RenderButtonsPanel):
__label__ = "Post Processing"
__default_closed__ = True
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def draw(self, context):
layout = self.layout
rd = context.scene.render_data
split = layout.split()
col = split.column()
col.itemR(rd, "use_compositing")
col.itemR(rd, "use_sequencer")
col = split.column()
col.itemR(rd, "dither_intensity", text="Dither", slider=True)
layout.itemS()
split = layout.split()
col = split.column()
col.itemR(rd, "fields", text="Fields")
sub = col.column()
sub.active = rd.fields
sub.row().itemR(rd, "field_order", expand=True)
sub.itemR(rd, "fields_still", text="Still")
col = split.column()
col.itemR(rd, "edge")
sub = col.column()
sub.active = rd.edge
sub.itemR(rd, "edge_threshold", text="Threshold", slider=True)
sub.itemR(rd, "edge_color", text="")
class SCENE_PT_output(RenderButtonsPanel):
__label__ = "Output"
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def draw(self, context):
layout = self.layout
rd = context.scene.render_data
layout.itemR(rd, "output_path", text="")
split = layout.split()
col = split.column()
col.itemR(rd, "file_format", text="")
col.row().itemR(rd, "color_mode", text="Color", expand=True)
col = split.column()
col.itemR(rd, "file_extensions")
col.itemR(rd, "use_overwrite")
col.itemR(rd, "use_placeholder")
if rd.file_format in ('AVIJPEG', 'JPEG'):
split = layout.split()
split.itemR(rd, "quality", slider=True)
elif rd.file_format == 'OPENEXR':
split = layout.split()
col = split.column()
col.itemR(rd, "exr_codec")
subsplit = split.split()
col = subsplit.column()
col.itemR(rd, "exr_half")
col.itemR(rd, "exr_zbuf")
col = subsplit.column()
col.itemR(rd, "exr_preview")
elif rd.file_format == 'JPEG2000':
split = layout.split()
col = split.column()
col.itemL(text="Depth:")
col.row().itemR(rd, "jpeg_depth", expand=True)
col = split.column()
col.itemR(rd, "jpeg_preset", text="")
col.itemR(rd, "jpeg_ycc")
col.itemR(rd, "exr_preview")
elif rd.file_format in ('CINEON', 'DPX'):
split = layout.split()
col = split.column()
col.itemR(rd, "cineon_log", text="Convert to Log")
col = split.column(align=True)
col.active = rd.cineon_log
col.itemR(rd, "cineon_black", text="Black")
col.itemR(rd, "cineon_white", text="White")
col.itemR(rd, "cineon_gamma", text="Gamma")
elif rd.file_format == 'TIFF':
split = layout.split()
split.itemR(rd, "tiff_bit")
class SCENE_PT_encoding(RenderButtonsPanel):
__label__ = "Encoding"
__default_closed__ = True
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def poll(self, context):
rd = context.scene.render_data
return rd.file_format in ('FFMPEG', 'XVID', 'H264', 'THEORA')
def draw(self, context):
layout = self.layout
rd = context.scene.render_data
split = layout.split()
split.itemR(rd, "ffmpeg_format")
if rd.ffmpeg_format in ('AVI', 'QUICKTIME', 'MKV', 'OGG'):
split.itemR(rd, "ffmpeg_codec")
else:
split.itemL()
split = layout.split()
col = split.column()
col.itemR(rd, "ffmpeg_video_bitrate")
col.itemL(text="Rate:")
col.itemR(rd, "ffmpeg_minrate", text="Minimum")
col.itemR(rd, "ffmpeg_maxrate", text="Maximum")
col.itemR(rd, "ffmpeg_buffersize", text="Buffer")
col = split.column()
col.itemR(rd, "ffmpeg_gopsize")
col.itemR(rd, "ffmpeg_autosplit")
col.itemL(text="Mux:")
col.itemR(rd, "ffmpeg_muxrate", text="Rate")
col.itemR(rd, "ffmpeg_packetsize", text="Packet Size")
row = layout.row()
row.itemL(text="Audio:")
row = layout.row()
row.itemR(rd, "ffmpeg_audio_codec")
split = layout.split()
col = split.column()
col.itemR(rd, "ffmpeg_audio_bitrate")
col = split.column()
col.itemR(rd, "ffmpeg_multiplex_audio")
class SCENE_PT_antialiasing(RenderButtonsPanel):
__label__ = "Anti-Aliasing"
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def draw_header(self, context):
rd = context.scene.render_data
self.layout.itemR(rd, "antialiasing", text="")
def draw(self, context):
layout = self.layout
rd = context.scene.render_data
layout.active = rd.antialiasing
split = layout.split()
col = split.column()
col.row().itemR(rd, "antialiasing_samples", expand=True)
col.itemR(rd, "full_sample")
col = split.column()
col.itemR(rd, "pixel_filter", text="")
col.itemR(rd, "filter_size", text="Size", slider=True)
class SCENE_PT_dimensions(RenderButtonsPanel):
__label__ = "Dimensions"
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def draw(self, context):
layout = self.layout
scene = context.scene
rd = scene.render_data
split = layout.split()
col = split.column()
sub = col.column(align=True)
sub.itemL(text="Resolution:")
sub.itemR(rd, "resolution_x", text="X")
sub.itemR(rd, "resolution_y", text="Y")
sub.itemR(rd, "resolution_percentage", text="")
sub.itemL(text="Aspect Ratio:")
sub.itemR(rd, "pixel_aspect_x", text="X")
sub.itemR(rd, "pixel_aspect_y", text="Y")
row = col.row()
row.itemR(rd, "use_border", text="Border")
rowsub = row.row()
rowsub.active = rd.use_border
rowsub.itemR(rd, "crop_to_border", text="Crop")
col = split.column(align=True)
col.itemL(text="Frame Range:")
col.itemR(scene, "start_frame", text="Start")
col.itemR(scene, "end_frame", text="End")
col.itemR(scene, "frame_step", text="Step")
col.itemL(text="Frame Rate:")
col.itemR(rd, "fps")
col.itemR(rd, "fps_base",text="/")
class SCENE_PT_stamp(RenderButtonsPanel):
__label__ = "Stamp"
__default_closed__ = True
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def draw_header(self, context):
rd = context.scene.render_data
self.layout.itemR(rd, "render_stamp", text="")
def draw(self, context):
layout = self.layout
rd = context.scene.render_data
layout.active = rd.render_stamp
split = layout.split()
col = split.column()
col.itemR(rd, "stamp_time", text="Time")
col.itemR(rd, "stamp_date", text="Date")
col.itemR(rd, "stamp_frame", text="Frame")
col.itemR(rd, "stamp_scene", text="Scene")
col.itemR(rd, "stamp_camera", text="Camera")
col.itemR(rd, "stamp_filename", text="Filename")
col.itemR(rd, "stamp_marker", text="Marker")
col.itemR(rd, "stamp_sequence_strip", text="Seq. Strip")
col = split.column()
col.active = rd.render_stamp
col.itemR(rd, "stamp_foreground", slider=True)
col.itemR(rd, "stamp_background", slider=True)
col.itemR(rd, "stamp_font_size", text="Font Size")
row = layout.split(percentage=0.2)
row.itemR(rd, "stamp_note", text="Note")
sub = row.row()
sub.active = rd.stamp_note
sub.itemR(rd, "stamp_note_text", text="")
class SCENE_PT_unit(RenderButtonsPanel):
__label__ = "Units"
__default_closed__ = True
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def draw(self, context):
layout = self.layout
unit = context.scene.unit_settings
col = layout.column()
col.row().itemR(unit, "system", expand=True)
row = layout.row()
row.active = (unit.system != 'NONE')
row.itemR(unit, "scale_length", text="Scale")
row.itemR(unit, "use_separate")
bpy.types.register(SCENE_PT_render)
bpy.types.register(SCENE_PT_layers)
bpy.types.register(SCENE_PT_dimensions)
bpy.types.register(SCENE_PT_antialiasing)
bpy.types.register(SCENE_PT_shading)
bpy.types.register(SCENE_PT_output)
bpy.types.register(SCENE_PT_encoding)
bpy.types.register(SCENE_PT_performance)
bpy.types.register(SCENE_PT_post_processing)
bpy.types.register(SCENE_PT_stamp)
bpy.types.register(SCENE_PT_unit)

View File

@@ -0,0 +1,758 @@
import bpy
class TextureButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "texture"
def poll(self, context):
tex = context.texture
return (tex and (tex.type != 'NONE' or tex.use_nodes))
class TEXTURE_PT_preview(TextureButtonsPanel):
__label__ = "Preview"
def draw(self, context):
layout = self.layout
tex = context.texture
slot = context.texture_slot
ma = context.material
la = context.lamp
wo = context.world
br = context.brush
if ma:
layout.template_preview(tex, parent=ma, slot=slot)
elif la:
layout.template_preview(tex, parent=la, slot=slot)
elif wo:
layout.template_preview(tex, parent=wo, slot=slot)
elif br:
layout.template_preview(tex, parent=br, slot=slot)
else:
layout.template_preview(tex, slot=slot)
class TEXTURE_PT_context_texture(TextureButtonsPanel):
__show_header__ = False
def poll(self, context):
return (context.material or context.world or context.lamp or context.brush or context.texture)
def draw(self, context):
layout = self.layout
tex = context.texture
id = context.material
if not id: id = context.lamp
if not id: id = context.world
if not id: id = context.brush
space = context.space_data
if id:
row = layout.row()
row.template_list(id, "textures", id, "active_texture_index", rows=2)
split = layout.split(percentage=0.65)
if id:
split.template_ID(id, "active_texture", new="texture.new")
elif tex:
split.template_ID(space, "pin_id")
if (not space.pin_id) and (
context.sculpt_object or
context.vertex_paint_object or
context.weight_paint_object or
context.texture_paint_object
):
split.itemR(space, "brush_texture", text="Brush", toggle=True)
if tex:
layout.itemR(tex, "use_nodes")
split = layout.split(percentage=0.2)
if tex.use_nodes:
slot = context.texture_slot
split.itemL(text="Output:")
split.itemR(slot, "output_node", text="")
else:
split.itemL(text="Type:")
split.itemR(tex, "type", text="")
class TEXTURE_PT_colors(TextureButtonsPanel):
__label__ = "Colors"
__default_closed__ = True
def draw(self, context):
layout = self.layout
tex = context.texture
layout.itemR(tex, "use_color_ramp", text="Ramp")
if tex.use_color_ramp:
layout.template_color_ramp(tex.color_ramp, expand=True)
split = layout.split()
split.itemR(tex, "rgb_factor", text="Multiply RGB")
col = split.column()
col.itemL(text="Adjust:")
col.itemR(tex, "brightness")
col.itemR(tex, "contrast")
# Texture Slot Panels #
class TextureSlotPanel(TextureButtonsPanel):
def poll(self, context):
return (
context.texture_slot and
TextureButtonsPanel.poll(self, context)
)
class TEXTURE_PT_mapping(TextureSlotPanel):
__label__ = "Mapping"
def draw(self, context):
layout = self.layout
ma = context.material
la = context.lamp
wo = context.world
br = context.brush
tex = context.texture_slot
textype = context.texture
if not br:
split = layout.split(percentage=0.3)
col = split.column()
col.itemL(text="Coordinates:")
col = split.column()
col.itemR(tex, "texture_coordinates", text="")
if tex.texture_coordinates == 'ORCO':
"""
ob = context.object
if ob and ob.type == 'MESH':
split = layout.split(percentage=0.3)
split.itemL(text="Mesh:")
split.itemR(ob.data, "texco_mesh", text="")
"""
elif tex.texture_coordinates == 'UV':
split = layout.split(percentage=0.3)
split.itemL(text="Layer:")
split.itemR(tex, "uv_layer", text="")
elif tex.texture_coordinates == 'OBJECT':
split = layout.split(percentage=0.3)
split.itemL(text="Object:")
split.itemR(tex, "object", text="")
if ma:
split = layout.split(percentage=0.3)
split.itemL(text="Projection:")
split.itemR(tex, "mapping", text="")
split = layout.split()
col = split.column()
if tex.texture_coordinates in ('ORCO', 'UV'):
col.itemR(tex, "from_dupli")
elif tex.texture_coordinates == 'OBJECT':
col.itemR(tex, "from_original")
else:
col.itemL()
col = split.column()
row = col.row()
row.itemR(tex, "x_mapping", text="")
row.itemR(tex, "y_mapping", text="")
row.itemR(tex, "z_mapping", text="")
if br:
layout.itemR(tex, "brush_map_mode", expand=True)
row = layout.row()
row.active = tex.brush_map_mode in ('FIXED', 'TILED')
row.itemR(tex, "angle")
row = layout.row()
row.active = tex.brush_map_mode in ('TILED', '3D')
row.column().itemR(tex, "size")
else:
row = layout.row()
row.column().itemR(tex, "offset")
row.column().itemR(tex, "size")
class TEXTURE_PT_influence(TextureSlotPanel):
__label__ = "Influence"
def draw(self, context):
layout = self.layout
ma = context.material
la = context.lamp
wo = context.world
br = context.brush
textype = context.texture
tex = context.texture_slot
def factor_but(layout, active, toggle, factor, name):
row = layout.row(align=True)
row.itemR(tex, toggle, text="")
sub = row.row()
sub.active = active
sub.itemR(tex, factor, text=name, slider=True)
if ma:
if ma.type in ['SURFACE', 'HALO', 'WIRE']:
split = layout.split()
col = split.column()
col.itemL(text="Diffuse:")
factor_but(col, tex.map_diffuse, "map_diffuse", "diffuse_factor", "Intensity")
factor_but(col, tex.map_colordiff, "map_colordiff", "colordiff_factor", "Color")
factor_but(col, tex.map_alpha, "map_alpha", "alpha_factor", "Alpha")
factor_but(col, tex.map_translucency, "map_translucency", "translucency_factor", "Translucency")
col.itemL(text="Specular:")
factor_but(col, tex.map_specular, "map_specular", "specular_factor", "Intensity")
factor_but(col, tex.map_colorspec, "map_colorspec", "colorspec_factor", "Color")
factor_but(col, tex.map_hardness, "map_hardness", "hardness_factor", "Hardness")
col = split.column()
col.itemL(text="Shading:")
factor_but(col, tex.map_ambient, "map_ambient", "ambient_factor", "Ambient")
factor_but(col, tex.map_emit, "map_emit", "emit_factor", "Emit")
factor_but(col, tex.map_mirror, "map_mirror", "mirror_factor", "Mirror")
factor_but(col, tex.map_raymir, "map_raymir", "raymir_factor", "Ray Mirror")
col.itemL(text="Geometry:")
factor_but(col, tex.map_normal, "map_normal", "normal_factor", "Normal")
factor_but(col, tex.map_warp, "map_warp", "warp_factor", "Warp")
factor_but(col, tex.map_displacement, "map_displacement", "displacement_factor", "Displace")
#sub = col.column()
#sub.active = tex.map_translucency or tex.map_emit or tex.map_alpha or tex.map_raymir or tex.map_hardness or tex.map_ambient or tex.map_specularity or tex.map_reflection or tex.map_mirror
#sub.itemR(tex, "default_value", text="Amount", slider=True)
elif ma.type == 'VOLUME':
split = layout.split()
col = split.column()
factor_but(col, tex.map_density, "map_density", "density_factor", "Density")
factor_but(col, tex.map_emission, "map_emission", "emission_factor", "Emission")
factor_but(col, tex.map_absorption, "map_absorption", "absorption_factor", "Absorption")
factor_but(col, tex.map_scattering, "map_scattering", "scattering_factor", "Scattering")
col = split.column()
col.itemL(text=" ")
factor_but(col, tex.map_alpha, "map_coloremission", "coloremission_factor", "Emission Color")
factor_but(col, tex.map_colorabsorption, "map_colorabsorption", "colorabsorption_factor", "Absorption Color")
elif la:
row = layout.row()
factor_but(row, tex.map_color, "map_color", "color_factor", "Color")
factor_but(row, tex.map_shadow, "map_shadow", "shadow_factor", "Shadow")
elif wo:
split = layout.split()
col = split.column()
factor_but(col, tex.map_blend, "map_blend", "blend_factor", "Blend")
factor_but(col, tex.map_horizon, "map_horizon", "horizon_factor", "Horizon")
col = split.column()
factor_but(col, tex.map_zenith_up, "map_zenith_up", "zenith_up_factor", "Zenith Up")
factor_but(col, tex.map_zenith_down, "map_zenith_down", "zenith_down_factor", "Zenith Down")
layout.itemS()
split = layout.split()
col = split.column()
col.itemR(tex, "blend_type", text="Blend")
col.itemR(tex, "rgb_to_intensity")
sub = col.column()
sub.active = tex.rgb_to_intensity
sub.itemR(tex, "color", text="")
col = split.column()
col.itemR(tex, "negate", text="Negative")
col.itemR(tex, "stencil")
if ma or wo:
col.itemR(tex, "default_value", text="DVar", slider=True)
# Texture Type Panels #
class TextureTypePanel(TextureButtonsPanel):
def poll(self, context):
tex = context.texture
return (tex and tex.type == self.tex_type and not tex.use_nodes)
class TEXTURE_PT_clouds(TextureTypePanel):
__label__ = "Clouds"
tex_type = 'CLOUDS'
def draw(self, context):
layout = self.layout
tex = context.texture
layout.itemR(tex, "stype", expand=True)
layout.itemL(text="Noise:")
layout.itemR(tex, "noise_type", text="Type", expand=True)
layout.itemR(tex, "noise_basis", text="Basis")
flow = layout.column_flow()
flow.itemR(tex, "noise_size", text="Size")
flow.itemR(tex, "noise_depth", text="Depth")
flow.itemR(tex, "nabla", text="Nabla")
class TEXTURE_PT_wood(TextureTypePanel):
__label__ = "Wood"
tex_type = 'WOOD'
def draw(self, context):
layout = self.layout
tex = context.texture
layout.itemR(tex, "noisebasis2", expand=True)
layout.itemR(tex, "stype", expand=True)
col = layout.column()
col.active = tex.stype in ('RINGNOISE', 'BANDNOISE')
col.itemL(text="Noise:")
col.row().itemR(tex, "noise_type", text="Type", expand=True)
col.itemR(tex, "noise_basis", text="Basis")
flow = layout.column_flow()
flow.active = tex.stype in ('RINGNOISE', 'BANDNOISE')
flow.itemR(tex, "noise_size", text="Size")
flow.itemR(tex, "turbulence")
flow.itemR(tex, "nabla")
class TEXTURE_PT_marble(TextureTypePanel):
__label__ = "Marble"
tex_type = 'MARBLE'
def draw(self, context):
layout = self.layout
tex = context.texture
layout.itemR(tex, "stype", expand=True)
layout.itemR(tex, "noisebasis2", expand=True)
layout.itemL(text="Noise:")
layout.itemR(tex, "noise_type", text="Type", expand=True)
layout.itemR(tex, "noise_basis", text="Basis")
flow = layout.column_flow()
flow.itemR(tex, "noise_size", text="Size")
flow.itemR(tex, "noise_depth", text="Depth")
flow.itemR(tex, "turbulence")
flow.itemR(tex, "nabla")
class TEXTURE_PT_magic(TextureTypePanel):
__label__ = "Magic"
tex_type = 'MAGIC'
def draw(self, context):
layout = self.layout
tex = context.texture
row = layout.row()
row.itemR(tex, "noise_depth", text="Depth")
row.itemR(tex, "turbulence")
class TEXTURE_PT_blend(TextureTypePanel):
__label__ = "Blend"
tex_type = 'BLEND'
def draw(self, context):
layout = self.layout
tex = context.texture
layout.itemR(tex, "progression")
layout.itemR(tex, "flip_axis")
class TEXTURE_PT_stucci(TextureTypePanel):
__label__ = "Stucci"
tex_type = 'STUCCI'
def draw(self, context):
layout = self.layout
tex = context.texture
layout.itemR(tex, "stype", expand=True)
layout.itemL(text="Noise:")
layout.itemR(tex, "noise_type", text="Type", expand=True)
layout.itemR(tex, "noise_basis", text="Basis")
row = layout.row()
row.itemR(tex, "noise_size", text="Size")
row.itemR(tex, "turbulence")
class TEXTURE_PT_image(TextureTypePanel):
__label__ = "Image"
tex_type = 'IMAGE'
def draw(self, context):
layout = self.layout
tex = context.texture
layout.template_texture_image(tex)
class TEXTURE_PT_image_sampling(TextureTypePanel):
__label__ = "Image Sampling"
__default_closed__ = True
tex_type = 'IMAGE'
def draw(self, context):
layout = self.layout
tex = context.texture
slot = context.texture_slot
split = layout.split()
"""
col = split.column()
col.itemR(tex, "flip_axis")
col.itemR(tex, "normal_map")
if slot:
row = col.row()
row.active = tex.normal_map
row.itemR(slot, "normal_map_space", text="")
"""
col = split.column()
col.itemL(text="Alpha:")
col.itemR(tex, "use_alpha", text="Use")
col.itemR(tex, "calculate_alpha", text="Calculate")
col.itemR(tex, "invert_alpha", text="Invert")
col.itemL(text="Flip:")
col.itemR(tex, "flip_axis", text="X/Y Axis")
col = split.column()
col.itemL(text="Filter:")
col.itemR(tex, "filter", text="")
col.itemR(tex, "mipmap")
row = col.row()
row.active = tex.mipmap
row.itemR(tex, "mipmap_gauss", text="Gauss")
col.itemR(tex, "interpolation")
if tex.mipmap and tex.filter != 'DEFAULT':
if tex.filter == 'FELINE':
col.itemR(tex, "filter_probes", text="Probes")
else:
col.itemR(tex, "filter_eccentricity", text="Eccentricity")
class TEXTURE_PT_image_mapping(TextureTypePanel):
__label__ = "Image Mapping"
__default_closed__ = True
tex_type = 'IMAGE'
def draw(self, context):
layout = self.layout
tex = context.texture
layout.itemR(tex, "extension")
split = layout.split()
if tex.extension == 'REPEAT':
col = split.column(align=True)
col.itemL(text="Repeat:")
col.itemR(tex, "repeat_x", text="X")
col.itemR(tex, "repeat_y", text="Y")
col = split.column(align=True)
col.itemL(text="Mirror:")
col.itemR(tex, "mirror_x", text="X")
col.itemR(tex, "mirror_y", text="Y")
elif tex.extension == 'CHECKER':
col = split.column(align=True)
row = col.row()
row.itemR(tex, "checker_even", text="Even")
row.itemR(tex, "checker_odd", text="Odd")
split.itemR(tex, "checker_distance", text="Distance")
layout.itemS()
split = layout.split()
col = split.column(align=True)
#col.itemR(tex, "crop_rectangle")
col.itemL(text="Crop Minimum:")
col.itemR(tex, "crop_min_x", text="X")
col.itemR(tex, "crop_min_y", text="Y")
col = split.column(align=True)
col.itemL(text="Crop Maximum:")
col.itemR(tex, "crop_max_x", text="X")
col.itemR(tex, "crop_max_y", text="Y")
class TEXTURE_PT_plugin(TextureTypePanel):
__label__ = "Plugin"
tex_type = 'PLUGIN'
def draw(self, context):
layout = self.layout
tex = context.texture
layout.itemL(text="Nothing yet")
class TEXTURE_PT_envmap(TextureTypePanel):
__label__ = "Environment Map"
tex_type = 'ENVIRONMENT_MAP'
def draw(self, context):
layout = self.layout
tex = context.texture
layout.itemL(text="Nothing yet")
class TEXTURE_PT_musgrave(TextureTypePanel):
__label__ = "Musgrave"
tex_type = 'MUSGRAVE'
def draw(self, context):
layout = self.layout
tex = context.texture
layout.itemR(tex, "musgrave_type")
split = layout.split()
col = split.column()
col.itemR(tex, "highest_dimension", text="Dimension")
col.itemR(tex, "lacunarity")
col.itemR(tex, "octaves")
col = split.column()
if (tex.musgrave_type in ('HETERO_TERRAIN', 'RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL')):
col.itemR(tex, "offset")
if (tex.musgrave_type in ('RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL')):
col.itemR(tex, "gain")
col.itemR(tex, "noise_intensity", text="Intensity")
layout.itemL(text="Noise:")
layout.itemR(tex, "noise_basis", text="Basis")
row = layout.row()
row.itemR(tex, "noise_size", text="Size")
row.itemR(tex, "nabla")
class TEXTURE_PT_voronoi(TextureTypePanel):
__label__ = "Voronoi"
tex_type = 'VORONOI'
def draw(self, context):
layout = self.layout
tex = context.texture
split = layout.split()
col = split.column()
col.itemL(text="Distance Metric:")
col.itemR(tex, "distance_metric", text="")
sub = col.column()
sub.active = tex.distance_metric == 'MINKOVSKY'
sub.itemR(tex, "minkovsky_exponent", text="Exponent")
col.itemL(text="Coloring:")
col.itemR(tex, "coloring", text="")
col.itemR(tex, "noise_intensity", text="Intensity")
col = split.column(align=True)
col.itemL(text="Feature Weights:")
col.itemR(tex, "weight_1", text="1", slider=True)
col.itemR(tex, "weight_2", text="2", slider=True)
col.itemR(tex, "weight_3", text="3", slider=True)
col.itemR(tex, "weight_4", text="4", slider=True)
layout.itemL(text="Noise:")
row = layout.row()
row.itemR(tex, "noise_size", text="Size")
row.itemR(tex, "nabla")
class TEXTURE_PT_distortednoise(TextureTypePanel):
__label__ = "Distorted Noise"
tex_type = 'DISTORTED_NOISE'
def draw(self, context):
layout = self.layout
tex = context.texture
layout.itemR(tex, "noise_distortion")
layout.itemR(tex, "noise_basis", text="Basis")
flow = layout.column_flow()
flow.itemR(tex, "distortion", text="Distortion")
flow.itemR(tex, "noise_size", text="Size")
flow.itemR(tex, "nabla")
class TEXTURE_PT_voxeldata(TextureButtonsPanel):
__idname__= "TEXTURE_PT_voxeldata"
__label__ = "Voxel Data"
def poll(self, context):
tex = context.texture
return (tex and tex.type == 'VOXEL_DATA')
def draw(self, context):
layout = self.layout
tex = context.texture
vd = tex.voxeldata
layout.itemR(vd, "file_format")
if vd.file_format in ['BLENDER_VOXEL', 'RAW_8BIT']:
layout.itemR(vd, "source_path")
if vd.file_format == 'RAW_8BIT':
layout.itemR(vd, "resolution")
elif vd.file_format == 'SMOKE':
layout.itemR(vd, "domain_object")
layout.itemR(vd, "still")
row = layout.row()
row.active = vd.still
row.itemR(vd, "still_frame_number")
layout.itemR(vd, "interpolation")
layout.itemR(vd, "intensity")
class TEXTURE_PT_pointdensity(TextureButtonsPanel):
__idname__= "TEXTURE_PT_pointdensity"
__label__ = "Point Density"
def poll(self, context):
tex = context.texture
return (tex and tex.type == 'POINT_DENSITY')
def draw(self, context):
layout = self.layout
tex = context.texture
pd = tex.pointdensity
layout.itemR(pd, "point_source", expand=True)
split = layout.split()
col = split.column()
if pd.point_source == 'PARTICLE_SYSTEM':
col.itemL(text="Object:")
col.itemR(pd, "object", text="")
sub = col.column()
sub.enabled = pd.object
if pd.object:
sub.itemL(text="System:")
sub.item_pointerR(pd, "particle_system", pd.object, "particle_systems", text="")
sub.itemL(text="Cache:")
sub.itemR(pd, "particle_cache", text="")
else:
col.itemL(text="Object:")
col.itemR(pd, "object", text="")
col.itemL(text="Cache:")
col.itemR(pd, "vertices_cache", text="")
col.itemS()
col.itemL(text="Color Source:")
col.itemR(pd, "color_source", text="")
if pd.color_source in ('PARTICLE_SPEED', 'PARTICLE_VELOCITY'):
col.itemR(pd, "speed_scale")
if pd.color_source in ('PARTICLE_SPEED', 'PARTICLE_AGE'):
layout.template_color_ramp(pd.color_ramp, expand=True)
col = split.column()
col.itemL()
col.itemR(pd, "radius")
col.itemL(text="Falloff:")
col.itemR(pd, "falloff", text="")
if pd.falloff == 'SOFT':
col.itemR(pd, "falloff_softness")
class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel):
__label__ = "Turbulence"
def poll(self, context):
tex = context.texture
return (tex and tex.type == 'POINT_DENSITY')
def draw_header(self, context):
layout = self.layout
tex = context.texture
pd = tex.pointdensity
layout.itemR(pd, "turbulence", text="")
def draw(self, context):
layout = self.layout
tex = context.texture
pd = tex.pointdensity
layout.active = pd.turbulence
split = layout.split()
col = split.column()
col.itemL(text="Influence:")
col.itemR(pd, "turbulence_influence", text="")
col.itemL(text="Noise Basis:")
col.itemR(pd, "noise_basis", text="")
col = split.column()
col.itemL()
col.itemR(pd, "turbulence_size")
col.itemR(pd, "turbulence_depth")
col.itemR(pd, "turbulence_strength")
bpy.types.register(TEXTURE_PT_context_texture)
bpy.types.register(TEXTURE_PT_preview)
bpy.types.register(TEXTURE_PT_clouds) # Texture Type Panels
bpy.types.register(TEXTURE_PT_wood)
bpy.types.register(TEXTURE_PT_marble)
bpy.types.register(TEXTURE_PT_magic)
bpy.types.register(TEXTURE_PT_blend)
bpy.types.register(TEXTURE_PT_stucci)
bpy.types.register(TEXTURE_PT_image)
bpy.types.register(TEXTURE_PT_image_sampling)
bpy.types.register(TEXTURE_PT_image_mapping)
bpy.types.register(TEXTURE_PT_plugin)
bpy.types.register(TEXTURE_PT_envmap)
bpy.types.register(TEXTURE_PT_musgrave)
bpy.types.register(TEXTURE_PT_voronoi)
bpy.types.register(TEXTURE_PT_distortednoise)
bpy.types.register(TEXTURE_PT_voxeldata)
bpy.types.register(TEXTURE_PT_pointdensity)
bpy.types.register(TEXTURE_PT_pointdensity_turbulence)
bpy.types.register(TEXTURE_PT_colors)
bpy.types.register(TEXTURE_PT_mapping)
bpy.types.register(TEXTURE_PT_influence)

182
release/ui/buttons_world.py Normal file
View File

@@ -0,0 +1,182 @@
import bpy
class WorldButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
__context__ = "world"
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
def poll(self, context):
rd = context.scene.render_data
return (context.world) and (not rd.use_game_engine) and (rd.engine in self.COMPAT_ENGINES)
class WORLD_PT_preview(WorldButtonsPanel):
__label__ = "Preview"
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def draw(self, context):
self.layout.template_preview(context.world)
class WORLD_PT_context_world(WorldButtonsPanel):
__show_header__ = False
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def poll(self, context):
rd = context.scene.render_data
return (not rd.use_game_engine) and (rd.engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
scene = context.scene
world = context.world
space = context.space_data
split = layout.split(percentage=0.65)
if scene:
split.template_ID(scene, "world", new="world.new")
elif world:
split.template_ID(space, "pin_id")
class WORLD_PT_world(WorldButtonsPanel):
__label__ = "World"
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def draw(self, context):
layout = self.layout
world = context.world
row = layout.row()
row.itemR(world, "paper_sky")
row.itemR(world, "blend_sky")
row.itemR(world, "real_sky")
row = layout.row()
row.column().itemR(world, "horizon_color")
col = row.column()
col.itemR(world, "zenith_color")
col.active = world.blend_sky
row.column().itemR(world, "ambient_color")
class WORLD_PT_mist(WorldButtonsPanel):
__label__ = "Mist"
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def draw_header(self, context):
world = context.world
self.layout.itemR(world.mist, "enabled", text="")
def draw(self, context):
layout = self.layout
world = context.world
layout.active = world.mist.enabled
flow = layout.column_flow()
flow.itemR(world.mist, "intensity", slider=True)
flow.itemR(world.mist, "start")
flow.itemR(world.mist, "depth")
flow.itemR(world.mist, "height")
layout.itemR(world.mist, "falloff")
class WORLD_PT_stars(WorldButtonsPanel):
__label__ = "Stars"
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def draw_header(self, context):
world = context.world
self.layout.itemR(world.stars, "enabled", text="")
def draw(self, context):
layout = self.layout
world = context.world
layout.active = world.stars.enabled
flow = layout.column_flow()
flow.itemR(world.stars, "size")
flow.itemR(world.stars, "color_randomization", text="Colors")
flow.itemR(world.stars, "min_distance", text="Min. Dist")
flow.itemR(world.stars, "average_separation", text="Separation")
class WORLD_PT_ambient_occlusion(WorldButtonsPanel):
__label__ = "Ambient Occlusion"
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def draw_header(self, context):
world = context.world
self.layout.itemR(world.ambient_occlusion, "enabled", text="")
def draw(self, context):
layout = self.layout
ao = context.world.ambient_occlusion
layout.active = ao.enabled
layout.itemR(ao, "gather_method", expand=True)
split = layout.split()
col = split.column()
col.itemL(text="Attenuation:")
col.itemR(ao, "distance")
col.itemR(ao, "falloff")
sub = col.row()
sub.active = ao.falloff
sub.itemR(ao, "falloff_strength", text="Strength")
if ao.gather_method == 'RAYTRACE':
col = split.column()
col.itemL(text="Sampling:")
col.itemR(ao, "sample_method", text="")
sub = col.column()
sub.itemR(ao, "samples")
if ao.sample_method == 'ADAPTIVE_QMC':
sub.itemR(ao, "threshold")
sub.itemR(ao, "adapt_to_speed", slider=True)
elif ao.sample_method == 'CONSTANT_JITTERED':
sub.itemR(ao, "bias")
if ao.gather_method == 'APPROXIMATE':
col = split.column()
col.itemL(text="Sampling:")
col.itemR(ao, "error_tolerance", text="Error")
col.itemR(ao, "pixel_cache")
col.itemR(ao, "correction")
col = layout.column()
col.itemL(text="Influence:")
col.row().itemR(ao, "blend_mode", expand=True)
split = layout.split()
col = split.column()
col.itemR(ao, "energy")
col = split.column()
colsub = col.split(percentage=0.3)
colsub.itemL(text="Color:")
colsub.itemR(ao, "color", text="")
bpy.types.register(WORLD_PT_context_world)
bpy.types.register(WORLD_PT_preview)
bpy.types.register(WORLD_PT_world)
bpy.types.register(WORLD_PT_ambient_occlusion)
bpy.types.register(WORLD_PT_mist)
bpy.types.register(WORLD_PT_stars)

View File

@@ -0,0 +1,36 @@
import bpy
class Buttons_HT_header(bpy.types.Header):
__space_type__ = 'PROPERTIES'
def draw(self, context):
layout = self.layout
so = context.space_data
scene = context.scene
row= layout.row(align=True)
row.template_header()
if context.area.show_menus:
sub = row.row(align=True)
sub.itemM("Buttons_MT_view", text="View")
row = layout.row()
row.itemR(so, "buttons_context", expand=True, text="")
row.itemR(scene, "current_frame")
class Buttons_MT_view(bpy.types.Menu):
__space_type__ = 'PROPERTIES'
__label__ = "View"
def draw(self, context):
layout = self.layout
so = context.space_data
col = layout.column()
col.itemR(so, "panel_alignment", expand=True)
bpy.types.register(Buttons_HT_header)
bpy.types.register(Buttons_MT_view)

446
release/ui/space_console.py Normal file
View File

@@ -0,0 +1,446 @@
import bpy
import bpy_ops # XXX - should not need to do this
del bpy_ops
class CONSOLE_HT_header(bpy.types.Header):
__space_type__ = 'CONSOLE'
def draw(self, context):
sc = context.space_data
# text = sc.text
layout = self.layout
row= layout.row(align=True)
row.template_header()
if context.area.show_menus:
sub = row.row(align=True)
if sc.console_type == 'REPORT':
sub.itemM("CONSOLE_MT_report")
else:
sub.itemM("CONSOLE_MT_console")
layout.itemS()
layout.itemR(sc, "console_type", expand=True)
if sc.console_type == 'REPORT':
row = layout.row(align=True)
row.itemR(sc, "show_report_debug", text="Debug")
row.itemR(sc, "show_report_info", text="Info")
row.itemR(sc, "show_report_operator", text="Operators")
row.itemR(sc, "show_report_warn", text="Warnings")
row.itemR(sc, "show_report_error", text="Errors")
row = layout.row()
row.enabled = sc.show_report_operator
row.itemO("console.report_replay")
class CONSOLE_MT_console(bpy.types.Menu):
__space_type__ = 'CONSOLE'
__label__ = "Console"
def draw(self, context):
layout = self.layout
sc = context.space_data
layout.column()
layout.itemO("console.clear")
layout.itemO("console.copy")
layout.itemO("console.paste")
class CONSOLE_MT_report(bpy.types.Menu):
__space_type__ = 'CONSOLE'
__label__ = "Report"
def draw(self, context):
layout = self.layout
sc = context.space_data
layout.column()
layout.itemO("console.select_all_toggle")
layout.itemO("console.select_border")
layout.itemO("console.report_delete")
layout.itemO("console.report_copy")
def add_scrollback(text, text_type):
for l in text.split('\n'):
bpy.ops.console.scrollback_append(text=l.replace('\t', ' '), type=text_type)
def get_console(console_id):
'''
helper function for console operators
currently each text datablock gets its own console - code.InteractiveConsole()
...which is stored in this function.
console_id can be any hashable type
'''
import sys, code
try: consoles = get_console.consoles
except:consoles = get_console.consoles = {}
# clear all dead consoles, use text names as IDs
# TODO, find a way to clear IDs
'''
for console_id in list(consoles.keys()):
if console_id not in bpy.data.texts:
del consoles[id]
'''
try:
namespace, console, stdout, stderr = consoles[console_id]
except:
namespace = {'__builtins__':__builtins__} # locals()
namespace['bpy'] = bpy
console = code.InteractiveConsole(namespace)
import io
stdout = io.StringIO()
stderr = io.StringIO()
consoles[console_id]= namespace, console, stdout, stderr
return namespace, console, stdout, stderr
class CONSOLE_OT_exec(bpy.types.Operator):
'''
Execute the current console line as a python expression.
'''
__idname__ = "console.execute"
__label__ = "Console Execute"
__register__ = False
# Both prompts must be the same length
PROMPT = '>>> '
PROMPT_MULTI = '... '
# is this working???
'''
def poll(self, context):
return (context.space_data.type == 'PYTHON')
''' # its not :|
def execute(self, context):
import sys
sc = context.space_data
try:
line = sc.history[-1].line
except:
return ('CANCELLED',)
if sc.console_type != 'PYTHON':
return ('CANCELLED',)
namespace, console, stdout, stderr = get_console(hash(context.region))
# redirect output
sys.stdout = stdout
sys.stderr = stderr
# run the console
if not line.strip():
line_exec = '\n' # executes a multiline statement
else:
line_exec = line
is_multiline = console.push(line_exec)
stdout.seek(0)
stderr.seek(0)
output = stdout.read()
output_err = stderr.read()
# cleanup
sys.stdout = sys.__stdout__
sys.stderr = sys.__stderr__
sys.last_traceback = None
# So we can reuse, clear all data
stdout.truncate(0)
stderr.truncate(0)
bpy.ops.console.scrollback_append(text = sc.prompt+line, type='INPUT')
if is_multiline: sc.prompt = self.PROMPT_MULTI
else: sc.prompt = self.PROMPT
# insert a new blank line
bpy.ops.console.history_append(text="", current_character=0, remove_duplicates= True)
# Insert the output into the editor
# not quite correct because the order might have changed, but ok 99% of the time.
if output: add_scrollback(output, 'OUTPUT')
if output_err: add_scrollback(output_err, 'ERROR')
return ('FINISHED',)
def autocomp(bcon):
'''
This function has been taken from a BGE console autocomp I wrote a while ago
the dictionaty bcon is not needed but it means I can copy and paste from the old func
which works ok for now.
could be moved into its own module.
'''
def is_delimiter(ch):
'''
For skipping words
'''
if ch == '_':
return False
if ch.isalnum():
return False
return True
def is_delimiter_autocomp(ch):
'''
When autocompleteing will earch back and
'''
if ch in '._[] "\'':
return False
if ch.isalnum():
return False
return True
def do_autocomp(autocomp_prefix, autocomp_members):
'''
return text to insert and a list of options
'''
autocomp_members = [v for v in autocomp_members if v.startswith(autocomp_prefix)]
print("AUTO: '%s'" % autocomp_prefix)
print("MEMBERS: '%s'" % str(autocomp_members))
if not autocomp_prefix:
return '', autocomp_members
elif len(autocomp_members) > 1:
# find a common string between all members after the prefix
# 'ge' [getA, getB, getC] --> 'get'
# get the shortest member
min_len = min([len(v) for v in autocomp_members])
autocomp_prefix_ret = ''
for i in range(len(autocomp_prefix), min_len):
char_soup = set()
for v in autocomp_members:
char_soup.add(v[i])
if len(char_soup) > 1:
break
else:
autocomp_prefix_ret += char_soup.pop()
print(autocomp_prefix_ret)
return autocomp_prefix_ret, autocomp_members
elif len(autocomp_members) == 1:
return autocomp_members[0][len(autocomp_prefix):], []
else:
return '', []
def BCon_PrevChar(bcon):
cursor = bcon['cursor']-1
if cursor<0:
return None
try:
return bcon['edit_text'][cursor]
except:
return None
def BCon_NextChar(bcon):
try:
return bcon['edit_text'][bcon['cursor']]
except:
return None
def BCon_cursorLeft(bcon):
bcon['cursor'] -= 1
if bcon['cursor'] < 0:
bcon['cursor'] = 0
def BCon_cursorRight(bcon):
bcon['cursor'] += 1
if bcon['cursor'] > len(bcon['edit_text']):
bcon['cursor'] = len(bcon['edit_text'])
def BCon_AddScrollback(bcon, text):
bcon['scrollback'] = bcon['scrollback'] + text
def BCon_cursorInsertChar(bcon, ch):
if bcon['cursor']==0:
bcon['edit_text'] = ch + bcon['edit_text']
elif bcon['cursor']==len(bcon['edit_text']):
bcon['edit_text'] = bcon['edit_text'] + ch
else:
bcon['edit_text'] = bcon['edit_text'][:bcon['cursor']] + ch + bcon['edit_text'][bcon['cursor']:]
bcon['cursor']
if bcon['cursor'] > len(bcon['edit_text']):
bcon['cursor'] = len(bcon['edit_text'])
BCon_cursorRight(bcon)
TEMP_NAME = '___tempname___'
cursor_orig = bcon['cursor']
ch = BCon_PrevChar(bcon)
while ch != None and (not is_delimiter(ch)):
ch = BCon_PrevChar(bcon)
BCon_cursorLeft(bcon)
if ch != None:
BCon_cursorRight(bcon)
#print (cursor_orig, bcon['cursor'])
cursor_base = bcon['cursor']
autocomp_prefix = bcon['edit_text'][cursor_base:cursor_orig]
print("PREFIX:'%s'" % autocomp_prefix)
# Get the previous word
if BCon_PrevChar(bcon)=='.':
BCon_cursorLeft(bcon)
ch = BCon_PrevChar(bcon)
while ch != None and is_delimiter_autocomp(ch)==False:
ch = BCon_PrevChar(bcon)
BCon_cursorLeft(bcon)
cursor_new = bcon['cursor']
if ch != None:
cursor_new+=1
pytxt = bcon['edit_text'][cursor_new:cursor_base-1].strip()
print("AUTOCOMP EVAL: '%s'" % pytxt)
#try:
if pytxt:
bcon['console'].runsource(TEMP_NAME + '=' + pytxt, '<input>', 'single')
# print val
else: ##except:
val = None
try:
val = bcon['namespace'][TEMP_NAME]
del bcon['namespace'][TEMP_NAME]
except:
val = None
if val:
autocomp_members = dir(val)
autocomp_prefix_ret, autocomp_members = do_autocomp(autocomp_prefix, autocomp_members)
bcon['cursor'] = cursor_orig
for v in autocomp_prefix_ret:
BCon_cursorInsertChar(bcon, v)
cursor_orig = bcon['cursor']
if autocomp_members:
BCon_AddScrollback(bcon, ', '.join(autocomp_members))
del val
else:
# Autocomp global namespace
autocomp_members = bcon['namespace'].keys()
if autocomp_prefix:
autocomp_members = [v for v in autocomp_members if v.startswith(autocomp_prefix)]
autocomp_prefix_ret, autocomp_members = do_autocomp(autocomp_prefix, autocomp_members)
bcon['cursor'] = cursor_orig
for v in autocomp_prefix_ret:
BCon_cursorInsertChar(bcon, v)
cursor_orig = bcon['cursor']
if autocomp_members:
BCon_AddScrollback(bcon, ', '.join(autocomp_members))
bcon['cursor'] = cursor_orig
class CONSOLE_OT_autocomplete(bpy.types.Operator):
'''
Evaluate the namespace up until the cursor and give a list of options or complete the name if there is only one.
'''
__idname__ = "console.autocomplete"
__label__ = "Console Autocomplete"
__register__ = False
def poll(self, context):
return context.space_data.type == 'PYTHON'
def execute(self, context):
sc = context.space_data
namespace, console, stdout, stderr = get_console(hash(context.region))
current_line = sc.history[-1]
line = current_line.line
if not console:
return ('CANCELLED',)
if sc.console_type != 'PYTHON':
return ('CANCELLED',)
# fake cursor, use for autocomp func.
bcon = {}
bcon['cursor'] = current_line.current_character
bcon['console'] = console
bcon['edit_text'] = line
bcon['namespace'] = namespace
bcon['scrollback'] = '' # nor from the BGE console
# This function isnt aware of the text editor or being an operator
# just does the autocomp then copy its results back
autocomp(bcon)
# 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 anymore
if bcon['scrollback']:
add_scrollback(bcon['scrollback'], 'INFO')
# copy back
current_line.line = bcon['edit_text']
current_line.current_character = bcon['cursor']
context.area.tag_redraw()
return ('FINISHED',)
bpy.types.register(CONSOLE_HT_header)
bpy.types.register(CONSOLE_MT_console)
bpy.types.register(CONSOLE_MT_report)
bpy.ops.add(CONSOLE_OT_exec)
bpy.ops.add(CONSOLE_OT_autocomplete)

View File

@@ -0,0 +1,42 @@
import bpy
class FILEBROWSER_HT_header(bpy.types.Header):
__space_type__ = 'FILE_BROWSER'
def draw(self, context):
layout = self.layout
st = context.space_data
params = st.params
layout.template_header(menus=False)
row = layout.row(align=True)
row.itemO("file.parent", text="", icon='ICON_FILE_PARENT')
row.itemO("file.refresh", text="", icon='ICON_FILE_REFRESH')
row.itemO("file.previous", text="", icon='ICON_PREV_KEYFRAME')
row.itemO("file.next", text="", icon='ICON_NEXT_KEYFRAME')
row = layout.row(align=True)
row.itemO("file.directory_new", text="", icon='ICON_NEWFOLDER')
layout.itemR(params, "display", expand=True, text="")
layout.itemR(params, "sort", expand=True, text="")
layout.itemR(params, "hide_dot")
layout.itemR(params, "do_filter")
row = layout.row(align=True)
row.itemR(params, "filter_folder", text="");
row.itemR(params, "filter_blender", text="");
row.itemR(params, "filter_image", text="");
row.itemR(params, "filter_movie", text="");
row.itemR(params, "filter_script", text="");
row.itemR(params, "filter_font", text="");
row.itemR(params, "filter_sound", text="");
row.itemR(params, "filter_text", text="");
row.active = params.do_filter
bpy.types.register(FILEBROWSER_HT_header)

381
release/ui/space_image.py Normal file
View File

@@ -0,0 +1,381 @@
import bpy
class IMAGE_MT_view(bpy.types.Menu):
__space_type__ = 'IMAGE_EDITOR'
__label__ = "View"
def draw(self, context):
layout = self.layout
sima = context.space_data
uv = sima.uv_editor
settings = context.tool_settings
show_uvedit = sima.show_uvedit
layout.itemO("image.properties", icon='ICON_MENU_PANEL')
layout.itemS()
layout.itemR(sima, "update_automatically")
if show_uvedit:
layout.itemR(settings, "uv_local_view") # Numpad /
layout.itemS()
layout.itemO("image.view_zoom_in")
layout.itemO("image.view_zoom_out")
layout.itemS()
ratios = [[1, 8], [1, 4], [1, 2], [1, 1], [2, 1], [4, 1], [8, 1]];
for a, b in ratios:
text = "Zoom %d:%d" % (a, b)
layout.item_floatO("image.view_zoom_ratio", "ratio", a/float(b), text=text)
layout.itemS()
if show_uvedit:
layout.itemO("image.view_selected")
layout.itemO("image.view_all")
layout.itemO("screen.screen_full_area")
class IMAGE_MT_select(bpy.types.Menu):
__space_type__ = 'IMAGE_EDITOR'
__label__ = "Select"
def draw(self, context):
layout = self.layout
layout.itemO("uv.select_border")
layout.item_booleanO("uv.select_border", "pinned", True)
layout.itemS()
layout.itemO("uv.select_all_toggle")
layout.itemO("uv.select_inverse")
layout.itemO("uv.unlink_selection")
layout.itemS()
layout.itemO("uv.select_pinned")
layout.itemO("uv.select_linked")
class IMAGE_MT_image(bpy.types.Menu):
__space_type__ = 'IMAGE_EDITOR'
__label__ = "Image"
def draw(self, context):
layout = self.layout
sima = context.space_data
ima = sima.image
layout.itemO("image.new")
layout.itemO("image.open")
show_render = sima.show_render
if ima:
if not show_render:
layout.itemO("image.replace")
layout.itemO("image.reload")
layout.itemO("image.save")
layout.itemO("image.save_as")
if ima.source == 'SEQUENCE':
layout.itemO("image.save_sequence")
if not show_render:
layout.itemS()
if ima.packed_file:
layout.itemO("image.unpack")
else:
layout.itemO("image.pack")
# only for dirty && specific image types, perhaps
# this could be done in operator poll too
if ima.dirty:
if ima.source in ('FILE', 'GENERATED') and ima.type != 'MULTILAYER':
layout.item_booleanO("image.pack", "as_png", True, text="Pack As PNG")
layout.itemS()
layout.itemR(sima, "image_painting")
class IMAGE_MT_uvs_showhide(bpy.types.Menu):
__space_type__ = 'IMAGE_EDITOR'
__label__ = "Show/Hide Faces"
def draw(self, context):
layout = self.layout
layout.itemO("uv.reveal")
layout.itemO("uv.hide")
layout.item_booleanO("uv.hide", "unselected", True)
class IMAGE_MT_uvs_transform(bpy.types.Menu):
__space_type__ = 'IMAGE_EDITOR'
__label__ = "Transform"
def draw(self, context):
layout = self.layout
layout.itemO("tfm.translate")
layout.itemO("tfm.rotate")
layout.itemO("tfm.resize")
class IMAGE_MT_uvs_mirror(bpy.types.Menu):
__space_type__ = 'IMAGE_EDITOR'
__label__ = "Mirror"
def draw(self, context):
layout = self.layout
layout.operator_context = "EXEC_REGION_WIN"
props= layout.itemO("tfm.mirror", text="X Axis", properties=True)
props.constraint_axis[0]= True
props= layout.itemO("tfm.mirror", text="Y Axis", properties=True)
props.constraint_axis[1]= True
class IMAGE_MT_uvs_weldalign(bpy.types.Menu):
__space_type__ = 'IMAGE_EDITOR'
__label__ = "Weld/Align"
def draw(self, context):
layout = self.layout
layout.itemO("uv.weld") # W, 1
layout.items_enumO("uv.align", "axis") # W, 2/3/4
class IMAGE_MT_uvs(bpy.types.Menu):
__space_type__ = 'IMAGE_EDITOR'
__label__ = "UVs"
def draw(self, context):
layout = self.layout
sima = context.space_data
uv = sima.uv_editor
settings = context.tool_settings
layout.itemR(uv, "snap_to_pixels")
layout.itemR(uv, "constrain_to_image_bounds")
layout.itemS()
layout.itemR(uv, "live_unwrap")
layout.itemO("uv.unwrap")
layout.item_booleanO("uv.pin", "clear", True, text="Unpin")
layout.itemO("uv.pin")
layout.itemS()
layout.itemO("uv.pack_islands")
layout.itemO("uv.average_islands_scale")
layout.itemO("uv.minimize_stretch")
layout.itemO("uv.stitch")
layout.itemS()
layout.itemM("IMAGE_MT_uvs_transform")
layout.itemM("IMAGE_MT_uvs_mirror")
layout.itemM("IMAGE_MT_uvs_weldalign")
layout.itemS()
layout.itemR(settings, "proportional_editing")
layout.item_menu_enumR(settings, "proportional_editing_falloff")
layout.itemS()
layout.itemM("IMAGE_MT_uvs_showhide")
class IMAGE_HT_header(bpy.types.Header):
__space_type__ = 'IMAGE_EDITOR'
def draw(self, context):
layout = self.layout
sima = context.space_data
ima = sima.image
iuser = sima.image_user
settings = context.tool_settings
show_render = sima.show_render
show_paint = sima.show_paint
show_uvedit = sima.show_uvedit
row = layout.row(align=True)
row.template_header()
# menus
if context.area.show_menus:
sub = row.row(align=True)
sub.itemM("IMAGE_MT_view")
if show_uvedit:
sub.itemM("IMAGE_MT_select")
if ima and ima.dirty:
sub.itemM("IMAGE_MT_image", text="Image*")
else:
sub.itemM("IMAGE_MT_image", text="Image")
if show_uvedit:
sub.itemM("IMAGE_MT_uvs")
layout.template_ID(sima, "image", new="image.new")
# uv editing
if show_uvedit:
uvedit = sima.uv_editor
layout.itemR(uvedit, "pivot", text="", icon_only=True)
layout.itemR(settings, "uv_sync_selection", text="")
if settings.uv_sync_selection:
layout.itemR(settings, "mesh_selection_mode", text="", expand=True)
else:
layout.itemR(settings, "uv_selection_mode", text="", expand=True)
layout.itemR(uvedit, "sticky_selection_mode", text="", icon_only=True)
pass
row = layout.row(align=True)
row.itemR(settings, "snap", text="")
if settings.snap:
row.itemR(settings, "snap_mode", text="")
"""
mesh = context.edit_object.data
row.item_pointerR(mesh, "active_uv_layer", mesh, "uv_textures")
"""
if ima:
# layers
layout.template_image_layers(ima, iuser)
# painting
layout.itemR(sima, "image_painting", text="")
# draw options
row = layout.row(align=True)
row.itemR(sima, "draw_channels", text="", expand=True)
row = layout.row(align=True)
if ima.type == 'COMPOSITE':
row.itemO("image.record_composite", icon='ICON_REC')
if ima.type == 'COMPOSITE' and ima.source in ('MOVIE', 'SEQUENCE'):
row.itemO("image.play_composite", icon='ICON_PLAY')
if show_uvedit or sima.image_painting:
layout.itemR(sima, "update_automatically", text="")
class IMAGE_PT_game_properties(bpy.types.Panel):
__space_type__ = 'IMAGE_EDITOR'
__region_type__ = 'UI'
__label__ = "Game Properties"
def poll(self, context):
rd = context.scene.render_data
sima = context.space_data
return (sima and sima.image) and (rd.engine == 'BLENDER_GAME')
def draw(self, context):
layout = self.layout
sima = context.space_data
ima = sima.image
split = layout.split()
col = split.column()
col.itemR(ima, "clamp_x")
col.itemR(ima, "clamp_y")
col.itemR(ima, "mapping", expand=True)
col.itemR(ima, "tiles")
col = split.column()
sub = col.column(align=True)
sub.itemR(ima, "animated")
subsub = sub.column()
subsub.active = ima.animated
subsub.itemR(ima, "animation_start", text="Start")
subsub.itemR(ima, "animation_end", text="End")
subsub.itemR(ima, "animation_speed", text="Speed")
sub = col.row(align=True)
sub.active = ima.tiles or ima.animated
sub.itemR(ima, "tiles_x", text="X")
sub.itemR(ima, "tiles_y", text="Y")
class IMAGE_PT_view_properties(bpy.types.Panel):
__space_type__ = 'IMAGE_EDITOR'
__region_type__ = 'UI'
__label__ = "Display"
def poll(self, context):
sima = context.space_data
return (sima and (sima.image or sima.show_uvedit))
def draw(self, context):
layout = self.layout
sima = context.space_data
ima = sima.image
show_uvedit = sima.show_uvedit
uvedit = sima.uv_editor
split = layout.split()
col = split.column()
if ima:
col.itemR(ima, "display_aspect", text="Aspect Ratio")
col = split.column()
col.itemL(text="Coordinates:")
col.itemR(sima, "draw_repeated", text="Repeat")
if show_uvedit:
col.itemR(uvedit, "normalized_coordinates", text="Normalized")
elif show_uvedit:
col.itemL(text="Coordinates:")
col.itemR(uvedit, "normalized_coordinates", text="Normalized")
if show_uvedit:
col = layout.column()
row = col.row()
row.itemR(uvedit, "edge_draw_type", expand=True)
split = layout.split()
col = split.column()
col.itemR(uvedit, "draw_stretch", text="Stretch")
sub = col.column()
sub.active = uvedit.draw_stretch
sub.row().itemR(uvedit, "draw_stretch_type", expand=True)
col = split.column()
col.itemR(uvedit, "draw_smooth_edges", text="Smooth")
col.itemR(uvedit, "draw_modified_edges", text="Modified")
#col.itemR(uvedit, "draw_edges")
#col.itemR(uvedit, "draw_faces")
bpy.types.register(IMAGE_MT_view)
bpy.types.register(IMAGE_MT_select)
bpy.types.register(IMAGE_MT_image)
bpy.types.register(IMAGE_MT_uvs_showhide)
bpy.types.register(IMAGE_MT_uvs_transform)
bpy.types.register(IMAGE_MT_uvs_mirror)
bpy.types.register(IMAGE_MT_uvs_weldalign)
bpy.types.register(IMAGE_MT_uvs)
bpy.types.register(IMAGE_HT_header)
bpy.types.register(IMAGE_PT_game_properties)
bpy.types.register(IMAGE_PT_view_properties)

254
release/ui/space_info.py Normal file
View File

@@ -0,0 +1,254 @@
import bpy
class INFO_HT_header(bpy.types.Header):
__space_type__ = 'INFO'
def draw(self, context):
layout = self.layout
st = context.space_data
scene = context.scene
rd = scene.render_data
row = layout.row(align=True)
row.template_header()
if context.area.show_menus:
sub = row.row(align=True)
sub.itemM("INFO_MT_file")
sub.itemM("INFO_MT_add")
if rd.use_game_engine:
sub.itemM("INFO_MT_game")
else:
sub.itemM("INFO_MT_render")
sub.itemM("INFO_MT_help")
layout.template_ID(context.window, "screen", new="screen.new", unlink="screen.delete")
layout.template_ID(context.screen, "scene", new="scene.new", unlink="scene.delete")
if rd.multiple_engines:
layout.itemR(rd, "engine", text="")
layout.itemS()
layout.template_operator_search()
layout.template_running_jobs()
layout.itemL(text=scene.statistics())
class INFO_MT_file(bpy.types.Menu):
__space_type__ = 'INFO'
__label__ = "File"
def draw(self, context):
layout = self.layout
layout.operator_context = "EXEC_AREA"
layout.itemO("wm.read_homefile", text="New")
layout.operator_context = "INVOKE_AREA"
layout.itemO("wm.open_mainfile", text="Open...")
layout.item_menu_enumO("wm.open_recentfile", "file", text="Open Recent")
layout.itemO("wm.recover_last_session")
layout.itemS()
layout.operator_context = "EXEC_AREA"
layout.itemO("wm.save_mainfile", text="Save")
layout.operator_context = "INVOKE_AREA"
layout.itemO("wm.save_as_mainfile", text="Save As...")
layout.itemO("screen.userpref_show", text="User Preferences...")
layout.itemS()
layout.itemM("INFO_MT_file_import")
layout.itemM("INFO_MT_file_export")
layout.itemS()
layout.itemM("INFO_MT_file_external_data")
layout.itemS()
layout.operator_context = "EXEC_AREA"
layout.itemO("wm.exit_blender", text="Quit")
class INFO_MT_file_import(bpy.types.Menu):
__space_type__ = 'INFO'
__label__ = "Import"
def draw(self, context):
layout = self.layout
layout.itemL(text="Nothing yet")
layout.itemO("WM_OT_collada_import", text="COLLADA")
class INFO_MT_file_export(bpy.types.Menu):
__space_type__ = 'INFO'
__label__ = "Export"
def draw(self, context):
layout = self.layout
layout.itemO("export.ply", text="PLY")
layout.itemO("WM_OT_collada_export", text="COLLADA")
class INFO_MT_file_external_data(bpy.types.Menu):
__space_type__ = 'INFO'
__label__ = "External Data"
def draw(self, context):
layout = self.layout
layout.itemO("file.pack_all", text="Pack into .blend file")
layout.itemO("file.unpack_all", text="Unpack into Files...")
layout.itemS()
layout.itemO("file.make_paths_relative")
layout.itemO("file.make_paths_absolute")
layout.itemO("file.report_missing_files")
layout.itemO("file.find_missing_files")
class INFO_MT_add(bpy.types.Menu):
__space_type__ = 'INFO'
__label__ = "Add"
def draw(self, context):
layout = self.layout
layout.operator_context = "EXEC_SCREEN"
layout.item_menu_enumO("object.mesh_add", "type", text="Mesh", icon='ICON_OUTLINER_OB_MESH')
layout.item_menu_enumO("object.curve_add", "type", text="Curve", icon='ICON_OUTLINER_OB_CURVE')
layout.item_menu_enumO("object.surface_add", "type", text="Surface", icon='ICON_OUTLINER_OB_SURFACE')
layout.item_menu_enumO("object.metaball_add", "type", 'META', icon='ICON_OUTLINER_OB_META')
layout.itemO("object.text_add", text="Text", icon='ICON_OUTLINER_OB_FONT')
layout.itemS()
layout.itemO("object.armature_add", text="Armature", icon='ICON_OUTLINER_OB_ARMATURE')
layout.item_enumO("object.add", "type", 'LATTICE', icon='ICON_OUTLINER_OB_LATTICE')
layout.item_enumO("object.add", "type", 'EMPTY', icon='ICON_OUTLINER_OB_EMPTY')
layout.itemS()
layout.item_enumO("object.add", "type", 'CAMERA', icon='ICON_OUTLINER_OB_CAMERA')
layout.item_enumO("object.add", "type", 'LAMP', icon='ICON_OUTLINER_OB_LAMP')
class INFO_MT_game(bpy.types.Menu):
__space_type__ = 'INFO'
__label__ = "Game"
def draw(self, context):
layout = self.layout
gs = context.scene.game_data
layout.itemO("view3d.game_start")
layout.itemS()
layout.itemR(gs, "show_debug_properties")
layout.itemR(gs, "show_framerate_profile")
layout.itemR(gs, "show_physics_visualization")
layout.itemR(gs, "deprecation_warnings")
class INFO_MT_render(bpy.types.Menu):
__space_type__ = 'INFO'
__label__ = "Render"
def draw(self, context):
layout = self.layout
rd = context.scene.render_data
layout.itemO("screen.render", text="Render Image")
layout.item_booleanO("screen.render", "animation", True, text="Render Animation")
layout.itemS()
layout.itemO("screen.render_view_show")
class INFO_MT_help(bpy.types.Menu):
__space_type__ = 'INFO'
__label__ = "Help"
def draw(self, context):
layout = self.layout
layout.itemO("help.manual")
layout.itemO("help.release_logs")
layout.itemS()
layout.itemO("help.blender_website")
layout.itemO("help.blender_eshop")
layout.itemO("help.developer_community")
layout.itemO("help.user_community")
bpy.types.register(INFO_HT_header)
bpy.types.register(INFO_MT_file)
bpy.types.register(INFO_MT_file_import)
bpy.types.register(INFO_MT_file_export)
bpy.types.register(INFO_MT_file_external_data)
bpy.types.register(INFO_MT_add)
bpy.types.register(INFO_MT_game)
bpy.types.register(INFO_MT_render)
bpy.types.register(INFO_MT_help)
# Help operators
import bpy_ops # XXX - should not need to do this
del bpy_ops
class HelpOperator(bpy.types.Operator):
def execute(self, context):
try: import webbrowser
except: webbrowser = None
if webbrowser:
webbrowser.open(self.__URL__)
else:
raise Exception("Operator requires a full Python installation")
return ('FINISHED',)
class HELP_OT_manual(HelpOperator):
__idname__ = "help.manual"
__label__ = "Manual"
__URL__ = 'http://wiki.blender.org/index.php/Manual'
class HELP_OT_release_logs(HelpOperator):
__idname__ = "help.release_logs"
__label__ = "Release Logs"
__URL__ = 'http://www.blender.org/development/release-logs/'
class HELP_OT_blender_website(HelpOperator):
__idname__ = "help.blender_website"
__label__ = "Blender Website"
__URL__ = 'http://www.blender.org/'
class HELP_OT_blender_eshop(HelpOperator):
__idname__ = "help.blender_eshop"
__label__ = "Blender e-Shop"
__URL__ = 'http://www.blender3d.org/e-shop'
class HELP_OT_developer_community(HelpOperator):
__idname__ = "help.developer_community"
__label__ = "Developer Community"
__URL__ = 'http://www.blender.org/community/get-involved/'
class HELP_OT_user_community(HelpOperator):
__idname__ = "help.user_community"
__label__ = "User Community"
__URL__ = 'http://www.blender.org/community/user-community/'
bpy.ops.add(HELP_OT_manual)
bpy.ops.add(HELP_OT_release_logs)
bpy.ops.add(HELP_OT_blender_website)
bpy.ops.add(HELP_OT_blender_eshop)
bpy.ops.add(HELP_OT_developer_community)
bpy.ops.add(HELP_OT_user_community)

29
release/ui/space_logic.py Normal file
View File

@@ -0,0 +1,29 @@
import bpy
class LOGIC_PT_properties(bpy.types.Panel):
__space_type__ = 'LOGIC_EDITOR'
__region_type__ = 'UI'
__label__ = "Properties"
def poll(self, context):
ob = context.active_object
return ob and ob.game
def draw(self, context):
layout = self.layout
ob = context.active_object
game = ob.game
layout.itemO("object.game_property_new", text="Add Game Property")
for i, prop in enumerate(game.properties):
row = layout.row(align=True)
row.itemR(prop, "name", text="")
row.itemR(prop, "type", text="")
row.itemR(prop, "value", text="", toggle=True) # we dont care about the type. rna will display correctly
row.itemR(prop, "debug", text="", toggle=True, icon='ICON_INFO')
row.item_intO("object.game_property_remove", "index", i, text="", icon='ICON_X')
bpy.types.register(LOGIC_PT_properties)

120
release/ui/space_node.py Normal file
View File

@@ -0,0 +1,120 @@
import bpy
class NODE_HT_header(bpy.types.Header):
__space_type__ = 'NODE_EDITOR'
def draw(self, context):
layout = self.layout
snode = context.space_data
row = layout.row(align=True)
row.template_header()
if context.area.show_menus:
sub = row.row(align=True)
sub.itemM("NODE_MT_view")
sub.itemM("NODE_MT_select")
sub.itemM("NODE_MT_add")
sub.itemM("NODE_MT_node")
row = layout.row()
row.itemR(snode, "tree_type", text="", expand=True)
if snode.tree_type == 'MATERIAL':
ob = snode.id_from
id = snode.id
if ob:
layout.template_ID(ob, "active_material", new="material.new")
if id:
layout.itemR(id, "use_nodes")
elif snode.tree_type == 'TEXTURE':
row.itemR(snode, "texture_type", text="", expand=True)
id = snode.id
id_from = snode.id_from
if id_from:
layout.template_ID(id_from, "active_texture", new="texture.new")
if id:
layout.itemR(id, "use_nodes")
elif snode.tree_type == 'COMPOSITING':
id = snode.id
layout.itemR(id, "use_nodes")
layout.itemR(id.render_data, "free_unused_nodes", text="Free Unused")
layout.itemR(snode, "backdrop")
class NODE_MT_view(bpy.types.Menu):
__space_type__ = 'NODE_EDITOR'
__label__ = "View"
def draw(self, context):
layout = self.layout
# layout.itemO("grease_pencil..")
# layout.itemS()
layout.itemO("view2d.zoom_in")
layout.itemO("view2d.zoom_out")
layout.itemS()
layout.itemO("node.view_all")
layout.itemO("screen.screen_full_area")
class NODE_MT_select(bpy.types.Menu):
__space_type__ = 'NODE_EDITOR'
__label__ = "Select"
def draw(self, context):
layout = self.layout
layout.itemO("node.select_border")
# XXX
# layout.itemS()
# layout.itemO("node.select_all")
# layout.itemO("node.select_linked_from")
# layout.itemO("node.select_linked_to")
class NODE_MT_node(bpy.types.Menu):
__space_type__ = 'NODE_EDITOR'
__label__ = "Node"
def draw(self, context):
layout = self.layout
layout.itemO("tfm.translate")
layout.itemO("tfm.resize")
layout.itemO("tfm.rotate")
layout.itemS()
layout.itemO("node.duplicate")
layout.itemO("node.delete")
# XXX
# layout.itemS()
# layout.itemO("node.make_link")
# layout.itemS()
# layout.itemO("node.edit_group")
# layout.itemO("node.ungroup")
# layout.itemO("node.group")
# layout.itemO("node.make_link")
layout.itemS()
layout.itemO("node.visibility_toggle")
# XXX
# layout.itemO("node.rename")
# layout.itemS()
# layout.itemO("node.show_cyclic_dependencies")
bpy.types.register(NODE_HT_header)
bpy.types.register(NODE_MT_view)
bpy.types.register(NODE_MT_select)
bpy.types.register(NODE_MT_node)

View File

@@ -0,0 +1,52 @@
import bpy
class OUTLINER_HT_header(bpy.types.Header):
__space_type__ = 'OUTLINER'
def draw(self, context):
so = context.space_data
sce = context.scene
layout = self.layout
row = layout.row(align=True)
row.template_header()
if context.area.show_menus:
sub = row.row(align=True)
sub.itemM("OUTLINER_MT_view")
row = layout.row()
row.itemR(so, "display_mode", text="")
if so.display_mode == 'DATABLOCKS':
row = layout.row(align=True)
row.itemO("anim.keyingset_add_new", text="", icon=31)
# row.itemR(sce, "active_keyingset", text="KS: ")
# ks = sce.keyingsets[sce.active_keyingset - 1]
# row.itemR(ks, "name", text="")
## row.itemR(sce, "keyingsets")
row = layout.row()
row.itemO("outliner.keyingset_add_selected", text="", icon=31)
row.itemO("outliner.keyingset_remove_selected", text="", icon=32)
row.itemO("anim.insert_keyframe", text="", icon=514)
row.itemO("anim.delete_keyframe", text="", icon=513)
class OUTLINER_MT_view(bpy.types.Menu):
__space_type__ = 'OUTLINER'
__label__ = "View"
def draw(self, context):
layout = self.layout
so = context.space_data
col = layout.column()
col.itemR(so, "show_restriction_columns")
#layout.itemO("text.new")
bpy.types.register(OUTLINER_HT_header)
bpy.types.register(OUTLINER_MT_view)

View File

@@ -0,0 +1,602 @@
import bpy
def act_strip(context):
try: return context.scene.sequence_editor.active_strip
except: return None
# Header
class SEQUENCER_HT_header(bpy.types.Header):
__space_type__ = 'SEQUENCE_EDITOR'
def draw(self, context):
layout = self.layout
st = context.space_data
row = layout.row(align=True)
row.template_header()
if context.area.show_menus:
sub = row.row(align=True)
sub.itemM("SEQUENCER_MT_view")
row.itemS()
if st.display_mode == 'SEQUENCER':
sub.itemM("SEQUENCER_MT_select")
sub.itemM("SEQUENCER_MT_marker")
sub.itemM("SEQUENCER_MT_add")
sub.itemM("SEQUENCER_MT_strip")
layout.itemR(st, "display_mode", text="")
if st.display_mode == 'SEQUENCER':
layout.itemS()
layout.itemO("sequencer.reload")
else:
layout.itemR(st, "display_channel", text="Channel")
class SEQUENCER_MT_view(bpy.types.Menu):
__space_type__ = 'SEQUENCE_EDITOR'
__label__ = "View"
def draw(self, context):
layout = self.layout
st = context.space_data
layout.column()
"""
uiBlock *block= uiBeginBlock(C, ar, "seq_viewmenu", UI_EMBOSSP);
short yco= 0, menuwidth=120;
if (sseq->mainb == SEQ_DRAW_SEQUENCE) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
"Play Back Animation "
"in all Sequence Areas|Alt A", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
}
else {
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL,
"Grease Pencil...", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
uiDefMenuSep(block);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
"Play Back Animation "
"in this window|Alt A", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
}
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
"Play Back Animation in all "
"3D Views and Sequence Areas|Alt Shift A",
0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
"""
layout.itemS()
layout.itemO("sequencer.view_all")
layout.itemO("sequencer.view_selected")
layout.itemS()
layout.itemO("screen.screen_full_area", text="Toggle Full Screen")
"""
/* Lock Time */
uiDefIconTextBut(block, BUTM, 1, (v2d->flag & V2D_VIEWSYNC_SCREEN_TIME)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
"Lock Time to Other Windows|", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
/* Draw time or frames.*/
uiDefMenuSep(block);
"""
layout.itemR(st, "draw_frames")
if st.display_mode == 'IMAGE':
layout.itemR(st, "draw_safe_margin")
if st.display_mode == 'WAVEFORM':
layout.itemR(st, "seperate_color_preview")
"""
if(!sa->full) uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Maximize Window|Ctrl UpArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0,0, "");
else uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Tile Window|Ctrl DownArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
"""
class SEQUENCER_MT_select(bpy.types.Menu):
__space_type__ = 'SEQUENCE_EDITOR'
__label__ = "Select"
def draw(self, context):
layout = self.layout
st = context.space_data
layout.column()
layout.item_enumO("sequencer.select_active_side", "side", 'LEFT', text="Strips to the Left")
layout.item_enumO("sequencer.select_active_side", "side", 'RIGHT', text="Strips to the Right")
layout.itemS()
layout.item_enumO("sequencer.select_handles", "side", 'BOTH', text="Surrounding Handles")
layout.item_enumO("sequencer.select_handles", "side", 'LEFT', text="Left Handle")
layout.item_enumO("sequencer.select_handles", "side", 'RIGHT', text="Right Handle")
layout.itemS()
layout.itemO("sequencer.select_linked")
layout.itemO("sequencer.select_all_toggle")
layout.itemO("sequencer.select_inverse")
class SEQUENCER_MT_marker(bpy.types.Menu):
__space_type__ = 'SEQUENCE_EDITOR'
__label__ = "Marker (TODO)"
def draw(self, context):
layout = self.layout
st = context.space_data
layout.column()
layout.itemO("marker.add", text="Add Marker")
layout.itemO("marker.duplicate", text="Duplicate Marker")
layout.itemO("marker.move", text="Grab/Move Marker")
layout.itemO("marker.delete", text="Delete Marker")
layout.itemS()
layout.itemL(text="ToDo: Name Marker")
#layout.itemO("sequencer.sound_strip_add", text="Transform Markers") # toggle, will be rna - (sseq->flag & SEQ_MARKER_TRANS)
class SEQUENCER_MT_add(bpy.types.Menu):
__space_type__ = 'SEQUENCE_EDITOR'
__label__ = "Add"
def draw(self, context):
layout = self.layout
st = context.space_data
layout.column()
layout.itemO("sequencer.scene_strip_add", text="Scene")
layout.itemO("sequencer.movie_strip_add", text="Movie")
layout.itemO("sequencer.image_strip_add", text="Image")
layout.itemO("sequencer.sound_strip_add", text="Sound")
layout.itemM("SEQUENCER_MT_add_effect")
class SEQUENCER_MT_add_effect(bpy.types.Menu):
__space_type__ = 'SEQUENCE_EDITOR'
__label__ = "Effect Strip..."
def draw(self, context):
layout = self.layout
st = context.space_data
layout.column()
layout.item_enumO("sequencer.effect_strip_add", 'type', 'ADD')
layout.item_enumO("sequencer.effect_strip_add", 'type', 'SUBTRACT')
layout.item_enumO("sequencer.effect_strip_add", 'type', 'ALPHA_OVER')
layout.item_enumO("sequencer.effect_strip_add", 'type', 'ALPHA_UNDER')
layout.item_enumO("sequencer.effect_strip_add", 'type', 'GAMMA_CROSS')
layout.item_enumO("sequencer.effect_strip_add", 'type', 'MULTIPLY')
layout.item_enumO("sequencer.effect_strip_add", 'type', 'OVER_DROP')
layout.item_enumO("sequencer.effect_strip_add", 'type', 'PLUGIN')
layout.item_enumO("sequencer.effect_strip_add", 'type', 'WIPE')
layout.item_enumO("sequencer.effect_strip_add", 'type', 'GLOW')
layout.item_enumO("sequencer.effect_strip_add", 'type', 'TRANSFORM')
layout.item_enumO("sequencer.effect_strip_add", 'type', 'COLOR')
layout.item_enumO("sequencer.effect_strip_add", 'type', 'SPEED')
class SEQUENCER_MT_strip(bpy.types.Menu):
__space_type__ = 'SEQUENCE_EDITOR'
__label__ = "Strip"
def draw(self, context):
layout = self.layout
st = context.space_data
layout.operator_context = 'INVOKE_REGION_WIN'
layout.column()
layout.item_enumO("tfm.transform", "mode", 'TRANSLATION', text="Grab/Move")
layout.item_enumO("tfm.transform", "mode", 'TIME_EXTEND', text="Grab/Extend from frame")
# uiItemO(layout, NULL, 0, "sequencer.strip_snap"); // TODO - add this operator
layout.itemS()
layout.item_enumO("sequencer.cut", "type", 'HARD', text="Cut (hard) at frame")
layout.item_enumO("sequencer.cut", "type", 'SOFT', text="Cut (soft) at frame")
layout.itemO("sequencer.images_separate")
layout.itemS()
layout.itemO("sequencer.duplicate")
layout.itemO("sequencer.delete")
strip = act_strip(context)
if strip:
stype = strip.type
if stype=='EFFECT':
layout.itemS()
layout.itemO("sequencer.effect_change")
layout.itemO("sequencer.effect_reassign_inputs")
elif stype=='IMAGE':
layout.itemS()
layout.itemO("sequencer.image_change")
elif stype=='SCENE':
layout.itemS()
layout.itemO("sequencer.scene_change", text="Change Scene")
elif stype=='MOVIE':
layout.itemS()
layout.itemO("sequencer.movie_change")
layout.itemS()
layout.itemO("sequencer.meta_make")
layout.itemO("sequencer.meta_separate")
#if (ed && (ed->metastack.first || (ed->act_seq && ed->act_seq->type == SEQ_META))) {
# uiItemS(layout);
# uiItemO(layout, NULL, 0, "sequencer.meta_toggle");
#}
layout.itemS()
layout.itemO("sequencer.reload")
layout.itemS()
layout.itemO("sequencer.lock")
layout.itemO("sequencer.unlock")
layout.itemO("sequencer.mute")
layout.itemO("sequencer.unmute")
layout.item_booleanO("sequencer.mute", "unselected", 1, text="Mute Deselected Strips")
layout.itemO("sequencer.snap")
# Panels
class SequencerButtonsPanel(bpy.types.Panel):
__space_type__ = 'SEQUENCE_EDITOR'
__region_type__ = 'UI'
def poll(self, context):
return context.space_data.display_mode == 'SEQUENCER' and act_strip(context) != None
class SequencerButtonsPanel_Output(bpy.types.Panel):
__space_type__ = 'SEQUENCE_EDITOR'
__region_type__ = 'UI'
def poll(self, context):
return context.space_data.display_mode != 'SEQUENCER'
class SEQUENCER_PT_edit(SequencerButtonsPanel):
__label__ = "Edit Strip"
def draw(self, context):
layout = self.layout
strip = act_strip(context)
split = layout.split(percentage=0.3)
split.itemL(text="Name:")
split.itemR(strip, "name", text="")
split = layout.split(percentage=0.3)
split.itemL(text="Type:")
split.itemR(strip, "type", text="")
split = layout.split(percentage=0.3)
split.itemL(text="Blend:")
split.itemR(strip, "blend_mode", text="")
row = layout.row()
if strip.mute == True:
row.itemR(strip, "mute", toggle=True, icon='ICON_RESTRICT_VIEW_ON', text="")
elif strip.mute == False:
row.itemR(strip, "mute", toggle=True, icon='ICON_RESTRICT_VIEW_OFF', text="")
sub = row.row()
sub.active = (not strip.mute)
sub.itemR(strip, "blend_opacity", text="Opacity", slider=True)
row = layout.row()
row.itemR(strip, "lock")
row.itemR(strip, "frame_locked", text="Frame Lock")
col = layout.column()
col.enabled = not strip.lock
col.itemR(strip, "channel")
col.itemR(strip, "start_frame")
col.itemR(strip, "length")
col = layout.column(align=True)
col.itemL(text="Offset:")
col.itemR(strip, "start_offset", text="Start")
col.itemR(strip, "end_offset", text="End")
col = layout.column(align=True)
col.itemL(text="Still:")
col.itemR(strip, "start_still", text="Start")
col.itemR(strip, "end_still", text="End")
class SEQUENCER_PT_effect(SequencerButtonsPanel):
__label__ = "Effect Strip"
def poll(self, context):
if context.space_data.display_mode != 'SEQUENCER':
return False
strip = act_strip(context)
if not strip:
return False
return strip.type in ('COLOR', 'WIPE', 'GLOW', 'SPEED', 'TRANSFORM')
def draw(self, context):
layout = self.layout
strip = act_strip(context)
if strip.type == 'COLOR':
layout.itemR(strip, "color")
elif strip.type == 'WIPE':
col = layout.column()
col.itemR(strip, "transition_type")
col.itemL(text="Direction:")
col.row().itemR(strip, "direction", expand=True)
col = layout.column()
col.itemR(strip, "blur_width", slider=True)
if strip.transition_type in ('SINGLE', 'DOUBLE'):
col.itemR(strip, "angle")
elif strip.type == 'GLOW':
flow = layout.column_flow()
flow.itemR(strip, "threshold", slider=True)
flow.itemR(strip, "clamp", slider=True)
flow.itemR(strip, "boost_factor")
flow.itemR(strip, "blur_distance")
row = layout.row()
row.itemR(strip, "quality", slider=True)
row.itemR(strip, "only_boost")
elif strip.type == 'SPEED':
layout.itemR(strip, "global_speed")
flow = layout.column_flow()
flow.itemR(strip, "curve_velocity")
flow.itemR(strip, "curve_compress_y")
flow.itemR(strip, "frame_blending")
elif strip.type == 'TRANSFORM':
col = layout.column()
col.itemR(strip, "interpolation")
col.itemR(strip, "translation_unit")
col = layout.column(align=True)
col.itemL(text="Position X:")
col.itemR(strip, "translate_start_x", text="Start")
col.itemR(strip, "translate_end_x", text="End")
col = layout.column(align=True)
col.itemL(text="Position Y:")
col.itemR(strip, "translate_start_y", text="Start")
col.itemR(strip, "translate_end_y", text="End")
layout.itemS()
col = layout.column(align=True)
col.itemL(text="Scale X:")
col.itemR(strip, "scale_start_x", text="Start")
col.itemR(strip, "scale_end_x", text="End")
col = layout.column(align=True)
col.itemL(text="Scale Y:")
col.itemR(strip, "scale_start_y", text="Start")
col.itemR(strip, "scale_end_y", text="End")
layout.itemS()
col = layout.column(align=True)
col.itemL(text="Rotation:")
col.itemR(strip, "rotation_start", text="Start")
col.itemR(strip, "rotation_end", text="End")
class SEQUENCER_PT_input(SequencerButtonsPanel):
__label__ = "Strip Input"
def poll(self, context):
if context.space_data.display_mode != 'SEQUENCER':
return False
strip = act_strip(context)
if not strip:
return False
return strip.type in ('MOVIE', 'IMAGE')
def draw(self, context):
layout = self.layout
strip = act_strip(context)
split = layout.split(percentage=0.2)
col = split.column()
col.itemL(text="Path:")
col = split.column()
col.itemR(strip, "directory", text="")
# Current element for the filename
elem = strip.getStripElem(context.scene.current_frame)
if elem:
split = layout.split(percentage=0.2)
col = split.column()
col.itemL(text="File:")
col = split.column()
col.itemR(elem, "filename", text="") # strip.elements[0] could be a fallback
layout.itemR(strip, "use_translation", text="Image Offset:")
if strip.transform:
col = layout.column(align=True)
col.active = strip.use_translation
col.itemR(strip.transform, "offset_x", text="X")
col.itemR(strip.transform, "offset_y", text="Y")
layout.itemR(strip, "use_crop", text="Image Crop:")
if strip.crop:
col = layout.column(align=True)
col.active = strip.use_crop
col.itemR(strip.crop, "top")
col.itemR(strip.crop, "left")
col.itemR(strip.crop, "bottom")
col.itemR(strip.crop, "right")
col = layout.column(align=True)
col.itemL(text="Trim Duration:")
col.itemR(strip, "animation_start_offset", text="Start")
col.itemR(strip, "animation_end_offset", text="End")
class SEQUENCER_PT_sound(SequencerButtonsPanel):
__label__ = "Sound"
def poll(self, context):
if context.space_data.display_mode != 'SEQUENCER':
return False
strip = act_strip(context)
if not strip:
return False
return strip.type in ('SOUND', )
def draw(self, context):
layout = self.layout
strip = act_strip(context)
layout.template_ID(strip, "sound", new="sound.open")
layout.itemS()
layout.itemR(strip.sound, "filename", text="")
row = layout.row()
if strip.sound.packed_file:
row.itemO("sound.unpack", icon='ICON_PACKAGE', text="Unpack")
else:
row.itemO("sound.pack", icon='ICON_UGLYPACKAGE', text="Pack")
row.itemR(strip.sound, "caching")
class SEQUENCER_PT_filter(SequencerButtonsPanel):
__label__ = "Filter"
def poll(self, context):
if context.space_data.display_mode != 'SEQUENCER':
return False
strip = act_strip(context)
if not strip:
return False
return strip.type in ('MOVIE', 'IMAGE', 'SCENE', 'META')
def draw(self, context):
layout = self.layout
strip = act_strip(context)
col = layout.column()
col.itemL(text="Video:")
col.itemR(strip, "strobe")
col.itemR(strip, "de_interlace")
col = layout.column()
col.itemL(text="Colors:")
col.itemR(strip, "multiply_colors", text="Multiply")
col.itemR(strip, "premultiply")
col.itemR(strip, "convert_float")
col = layout.column()
col.itemL(text="Flip:")
col.itemR(strip, "flip_x", text="X")
col.itemR(strip, "flip_y", text="Y")
col.itemR(strip, "reverse_frames", text="Backwards")
layout.itemR(strip, "use_color_balance")
if strip.color_balance: # TODO - need to add this somehow
row = layout.row()
row.active = strip.use_color_balance
col = row.column()
col.itemR(strip.color_balance, "lift")
col.itemR(strip.color_balance, "inverse_lift", text="Inverse")
col = row.column()
col.itemR(strip.color_balance, "gamma")
col.itemR(strip.color_balance, "inverse_gamma", text="Inverse")
col = row.column()
col.itemR(strip.color_balance, "gain")
col.itemR(strip.color_balance, "inverse_gain", text="Inverse")
class SEQUENCER_PT_proxy(SequencerButtonsPanel):
__label__ = "Proxy"
def poll(self, context):
if context.space_data.display_mode != 'SEQUENCER':
return False
strip = act_strip(context)
if not strip:
return False
return strip.type in ('MOVIE', 'IMAGE', 'SCENE', 'META')
def draw_header(self, context):
layout = self.layout
strip = act_strip(context)
layout.itemR(strip, "use_proxy", text="")
def draw(self, context):
layout = self.layout
strip = act_strip(context)
flow = layout.column_flow()
flow.itemR(strip, "proxy_custom_directory")
if strip.proxy: # TODO - need to add this somehow
flow.itemR(strip.proxy, "directory")
flow.itemR(strip.proxy, "file")
class SEQUENCER_PT_view(SequencerButtonsPanel_Output):
__label__ = "View Settings"
def draw(self, context):
layout = self.layout
st = context.space_data
col = layout.column()
col.itemR(st, "draw_overexposed") # text="Zebra"
col.itemR(st, "draw_safe_margin")
bpy.types.register(SEQUENCER_HT_header) # header/menu classes
bpy.types.register(SEQUENCER_MT_view)
bpy.types.register(SEQUENCER_MT_select)
bpy.types.register(SEQUENCER_MT_marker)
bpy.types.register(SEQUENCER_MT_add)
bpy.types.register(SEQUENCER_MT_add_effect)
bpy.types.register(SEQUENCER_MT_strip)
bpy.types.register(SEQUENCER_PT_edit) # sequencer panels
bpy.types.register(SEQUENCER_PT_effect)
bpy.types.register(SEQUENCER_PT_input)
bpy.types.register(SEQUENCER_PT_sound)
bpy.types.register(SEQUENCER_PT_filter)
bpy.types.register(SEQUENCER_PT_proxy)
bpy.types.register(SEQUENCER_PT_view) # view panels

245
release/ui/space_text.py Normal file
View File

@@ -0,0 +1,245 @@
import bpy
class TEXT_HT_header(bpy.types.Header):
__space_type__ = 'TEXT_EDITOR'
def draw(self, context):
layout = self.layout
st = context.space_data
text = st.text
row = layout.row(align=True)
row.template_header()
if context.area.show_menus:
sub = row.row(align=True)
sub.itemM("TEXT_MT_text")
if text:
sub.itemM("TEXT_MT_edit")
sub.itemM("TEXT_MT_format")
if text and text.modified:
row = layout.row()
# row.color(redalert)
row.itemO("text.resolve_conflict", text="", icon='ICON_HELP')
layout.template_ID(st, "text", new="text.new", unlink="text.unlink")
row = layout.row(align=True)
row.itemR(st, "line_numbers", text="")
row.itemR(st, "word_wrap", text="")
row.itemR(st, "syntax_highlight", text="")
if text:
row = layout.row()
if text.filename != "":
if text.dirty:
row.itemL(text="File: *%s (unsaved)" % text.filename)
else:
row.itemL(text="File: %s" % text.filename )
else:
if text.library:
row.itemL(text="Text: External")
else:
row.itemL(text="Text: Internal")
class TEXT_PT_properties(bpy.types.Panel):
__space_type__ = 'TEXT_EDITOR'
__region_type__ = 'UI'
__label__ = "Properties"
def draw(self, context):
layout = self.layout
st = context.space_data
flow = layout.column_flow()
flow.itemR(st, "line_numbers")
flow.itemR(st, "word_wrap")
flow.itemR(st, "syntax_highlight")
flow.itemR(st, "live_edit")
flow = layout.column_flow()
flow.itemR(st, "font_size")
flow.itemR(st, "tab_width")
class TEXT_PT_find(bpy.types.Panel):
__space_type__ = 'TEXT_EDITOR'
__region_type__ = 'UI'
__label__ = "Find"
def draw(self, context):
layout = self.layout
st = context.space_data
# find
col = layout.column(align=True)
row = col.row()
row.itemR(st, "find_text", text="")
row.itemO("text.find_set_selected", text="", icon='ICON_TEXT')
col.itemO("text.find")
# replace
col = layout.column(align=True)
row = col.row()
row.itemR(st, "replace_text", text="")
row.itemO("text.replace_set_selected", text="", icon='ICON_TEXT')
col.itemO("text.replace")
# mark
layout.itemO("text.mark_all")
# settings
row = layout.row()
row.itemR(st, "find_wrap", text="Wrap")
row.itemR(st, "find_all", text="All")
class TEXT_MT_text(bpy.types.Menu):
__space_type__ = 'TEXT_EDITOR'
__label__ = "Text"
def draw(self, context):
layout = self.layout
st = context.space_data
text = st.text
layout.column()
layout.itemO("text.new")
layout.itemO("text.open")
if text:
layout.itemO("text.reload")
layout.column()
layout.itemO("text.save")
layout.itemO("text.save_as")
if text.filename != "":
layout.itemO("text.make_internal")
layout.column()
layout.itemO("text.run_script")
#ifndef DISABLE_PYTHON
# XXX if(BPY_is_pyconstraint(text))
# XXX uiMenuItemO(head, 0, "text.refresh_pyconstraints");
#endif
layout.itemS()
layout.itemO("text.properties", icon='ICON_MENU_PANEL')
#ifndef DISABLE_PYTHON
# XXX layout.column()
# XXX uiDefIconTextBlockBut(block, text_template_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Script Templates", 0, yco-=20, 120, 19, "");
# XXX uiDefIconTextBlockBut(block, text_plugin_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Text Plugins", 0, yco-=20, 120, 19, "");
#endif
class TEXT_MT_edit_view(bpy.types.Menu):
__space_type__ = 'TEXT_EDITOR'
__label__ = "View"
def draw(self, context):
layout = self.layout
layout.item_enumO("text.move", "type", 'FILE_TOP', text="Top of File")
layout.item_enumO("text.move", "type", 'FILE_BOTTOM', text="Bottom of File")
class TEXT_MT_edit_select(bpy.types.Menu):
__space_type__ = 'TEXT_EDITOR'
__label__ = "Select"
def draw(self, context):
layout = self.layout
layout.itemO("text.select_all")
layout.itemO("text.select_line")
class TEXT_MT_edit_markers(bpy.types.Menu):
__space_type__ = 'TEXT_EDITOR'
__label__ = "Markers"
def draw(self, context):
layout = self.layout
layout.itemO("text.markers_clear")
layout.itemO("text.next_marker")
layout.itemO("text.previous_marker")
class TEXT_MT_format(bpy.types.Menu):
__space_type__ = 'TEXT_EDITOR'
__label__ = "Format"
def draw(self, context):
layout = self.layout
layout.itemO("text.indent")
layout.itemO("text.unindent")
layout.itemS()
layout.itemO("text.comment")
layout.itemO("text.uncomment")
layout.itemS()
layout.item_menu_enumO("text.convert_whitespace", "type")
class TEXT_MT_edit_to3d(bpy.types.Menu):
__space_type__ = 'TEXT_EDITOR'
__label__ = "Text To 3D Object"
def draw(self, context):
layout = self.layout
layout.item_booleanO("text.to_3d_object", "split_lines", False, text="One Object");
layout.item_booleanO("text.to_3d_object", "split_lines", True, text="One Object Per Line");
class TEXT_MT_edit(bpy.types.Menu):
__space_type__ = 'TEXT_EDITOR'
__label__ = "Edit"
def poll(self, context):
return (context.space_data.text)
def draw(self, context):
layout = self.layout
layout.itemO("ed.undo")
layout.itemO("ed.redo")
layout.itemS()
layout.itemO("text.cut")
layout.itemO("text.copy")
layout.itemO("text.paste")
layout.itemS()
layout.itemM("TEXT_MT_edit_view")
layout.itemM("TEXT_MT_edit_select")
layout.itemM("TEXT_MT_edit_markers")
layout.itemS()
layout.itemO("text.jump")
layout.itemO("text.properties", text="Find...")
layout.itemS()
layout.itemM("TEXT_MT_edit_to3d")
bpy.types.register(TEXT_HT_header)
bpy.types.register(TEXT_PT_properties)
bpy.types.register(TEXT_PT_find)
bpy.types.register(TEXT_MT_text)
bpy.types.register(TEXT_MT_format)
bpy.types.register(TEXT_MT_edit)
bpy.types.register(TEXT_MT_edit_view)
bpy.types.register(TEXT_MT_edit_select)
bpy.types.register(TEXT_MT_edit_markers)
bpy.types.register(TEXT_MT_edit_to3d)

151
release/ui/space_time.py Normal file
View File

@@ -0,0 +1,151 @@
import bpy
class TIME_HT_header(bpy.types.Header):
__space_type__ = 'TIMELINE'
def draw(self, context):
layout = self.layout
st = context.space_data
scene = context.scene
rd = context.scene.render_data
tools = context.tool_settings
screen = context.screen
row = layout.row(align=True)
row.template_header()
if context.area.show_menus:
sub = row.row(align=True)
sub.itemM("TIME_MT_view")
sub.itemM("TIME_MT_frame")
sub.itemM("TIME_MT_playback")
layout.itemR(scene, "use_preview_range", text="PR")
row = layout.row(align=True)
if not scene.use_preview_range:
row.itemR(scene, "start_frame", text="Start")
row.itemR(scene, "end_frame", text="End")
else:
row.itemR(scene, "preview_range_start_frame", text="Start")
row.itemR(scene, "preview_range_end_frame", text="End")
layout.itemR(scene, "current_frame", text="")
layout.itemS()
row = layout.row(align=True)
row.item_booleanO("screen.frame_jump", "end", False, text="", icon='ICON_REW')
row.item_booleanO("screen.keyframe_jump", "next", False, text="", icon='ICON_PREV_KEYFRAME')
if not screen.animation_playing:
row.item_booleanO("screen.animation_play", "reverse", True, text="", icon='ICON_PLAY_REVERSE')
row.itemO("screen.animation_play", text="", icon='ICON_PLAY')
else:
sub = row.row()
sub.scale_x = 2.0
sub.itemO("screen.animation_play", text="", icon='ICON_PAUSE')
row.item_booleanO("screen.keyframe_jump", "next", True, text="", icon='ICON_NEXT_KEYFRAME')
row.item_booleanO("screen.frame_jump", "end", True, text="", icon='ICON_FF')
row = layout.row(align=True)
row.itemR(tools, "enable_auto_key", text="", toggle=True, icon='ICON_REC')
if screen.animation_playing and tools.enable_auto_key:
subsub = row.row()
subsub.itemR(tools, "record_with_nla", toggle=True)
layout.itemR(rd, "sync_audio", text="", toggle=True, icon='ICON_SPEAKER')
layout.itemS()
row = layout.row(align=True)
row.item_pointerR(scene, "active_keying_set", scene, "keying_sets", text="")
row.itemO("anim.insert_keyframe", text="", icon='ICON_KEY_HLT')
row.itemO("anim.delete_keyframe", text="", icon='ICON_KEY_DEHLT')
class TIME_MT_view(bpy.types.Menu):
__space_type__ = 'TIMELINE'
__label__ = "View"
def draw(self, context):
layout = self.layout
st = context.space_data
layout.itemO("anim.time_toggle")
layout.itemS()
layout.itemR(st, "only_selected")
class TIME_MT_frame(bpy.types.Menu):
__space_type__ = 'TIMELINE'
__label__ = "Frame"
def draw(self, context):
layout = self.layout
tools = context.tool_settings
layout.itemO("marker.add", text="Add Marker")
layout.itemO("marker.duplicate", text="Duplicate Marker")
layout.itemO("marker.move", text="Grab/Move Marker")
layout.itemO("marker.delete", text="Delete Marker")
layout.itemL(text="ToDo: Name Marker")
layout.itemS()
layout.itemO("time.start_frame_set")
layout.itemO("time.end_frame_set")
layout.itemS()
sub = layout.row()
sub.active = tools.enable_auto_key
sub.itemM("TIME_MT_autokey")
class TIME_MT_playback(bpy.types.Menu):
__space_type__ = 'TIMELINE'
__label__ = "Playback"
def draw(self, context):
layout = self.layout
st = context.space_data
rd = context.scene.render_data
layout.itemR(st, "play_top_left")
layout.itemR(st, "play_all_3d")
layout.itemR(st, "play_anim")
layout.itemR(st, "play_buttons")
layout.itemR(st, "play_image")
layout.itemR(st, "play_sequencer")
layout.itemS()
layout.itemR(st, "continue_physics")
layout.itemS()
layout.itemR(rd, "sync_audio", icon='ICON_SPEAKER')
class TIME_MT_autokey(bpy.types.Menu):
__space_type__ = 'TIMELINE'
__label__ = "Auto-Keyframing Mode"
def draw(self, context):
layout = self.layout
tools = context.tool_settings
layout.active = tools.enable_auto_key
layout.item_enumR(tools, "autokey_mode", 'ADD_REPLACE_KEYS')
layout.item_enumR(tools, "autokey_mode", 'REPLACE_KEYS')
bpy.types.register(TIME_HT_header)
bpy.types.register(TIME_MT_view)
bpy.types.register(TIME_MT_frame)
bpy.types.register(TIME_MT_autokey)
bpy.types.register(TIME_MT_playback)

View File

@@ -0,0 +1,418 @@
import bpy
class USERPREF_HT_header(bpy.types.Header):
__space_type__ = 'USER_PREFERENCES'
def draw(self, context):
layout = self.layout
layout.template_header(menus=False)
userpref = context.user_preferences
layout.operator_context = "EXEC_AREA"
layout.itemO("wm.save_homefile", text="Save As Default")
class USERPREF_MT_view(bpy.types.Menu):
__space_type__ = 'USER_PREFERENCES'
__label__ = "View"
def draw(self, context):
layout = self.layout
class USERPREF_PT_tabs(bpy.types.Panel):
__space_type__ = 'USER_PREFERENCES'
__show_header__ = False
def draw(self, context):
layout = self.layout
userpref = context.user_preferences
layout.itemR(userpref, "active_section", expand=True)
class USERPREF_PT_view(bpy.types.Panel):
__space_type__ = 'USER_PREFERENCES'
__label__ = "View"
__show_header__ = False
def poll(self, context):
userpref = context.user_preferences
return (userpref.active_section == 'VIEW_CONTROLS')
def draw(self, context):
layout = self.layout
userpref = context.user_preferences
view = userpref.view
split = layout.split()
col = split.column()
sub = col.split(percentage=0.85)
sub1 = sub.column()
sub1.itemL(text="Display:")
sub1.itemR(view, "tooltips")
sub1.itemR(view, "display_object_info", text="Object Info")
sub1.itemR(view, "use_large_cursors")
sub1.itemR(view, "show_view_name", text="View Name")
sub1.itemR(view, "show_playback_fps", text="Playback FPS")
sub1.itemR(view, "global_scene")
sub1.itemR(view, "pin_floating_panels")
sub1.itemR(view, "object_center_size")
sub1.itemS()
sub1.itemS()
sub1.itemS()
sub1.itemR(view, "show_mini_axis", text="Display Mini Axis")
sub2 = sub1.column()
sub2.enabled = view.show_mini_axis
sub2.itemR(view, "mini_axis_size", text="Size")
sub2.itemR(view, "mini_axis_brightness", text="Brightness")
col = split.column()
sub = col.split(percentage=0.85)
sub1 = sub.column()
sub1.itemL(text="View Manipulation:")
sub1.itemR(view, "auto_depth")
sub1.itemR(view, "global_pivot")
sub1.itemR(view, "zoom_to_mouse")
sub1.itemR(view, "rotate_around_selection")
sub1.itemS()
sub1.itemL(text="Zoom Style:")
sub1.row().itemR(view, "viewport_zoom_style", expand=True)
sub1.itemL(text="Orbit Style:")
sub1.row().itemR(view, "view_rotation", expand=True)
sub1.itemR(view, "perspective_orthographic_switch")
sub1.itemR(view, "smooth_view")
sub1.itemR(view, "rotation_angle")
sub1.itemS()
sub1.itemL(text="NDOF Device:")
sub1.itemR(view, "ndof_pan_speed", text="Pan Speed")
sub1.itemR(view, "ndof_rotate_speed", text="Orbit Speed")
col = split.column()
sub = col.split(percentage=0.85)
sub1 = sub.column()
sub1.itemL(text="Mouse Buttons:")
sub1.itemR(view, "left_mouse_button_select")
sub1.itemR(view, "right_mouse_button_select")
sub1.itemR(view, "emulate_3_button_mouse")
sub1.itemR(view, "use_middle_mouse_paste")
sub1.itemR(view, "middle_mouse_rotate")
sub1.itemR(view, "middle_mouse_pan")
sub1.itemR(view, "wheel_invert_zoom")
sub1.itemR(view, "wheel_scroll_lines")
sub1.itemS()
sub1.itemS()
sub1.itemS()
sub1.itemL(text="Menus:")
sub1.itemR(view, "open_mouse_over")
sub1.itemL(text="Menu Open Delay:")
sub1.itemR(view, "open_toplevel_delay", text="Top Level")
sub1.itemR(view, "open_sublevel_delay", text="Sub Level")
col = split.column()
sub = col.split(percentage=0.85)
sub1 = sub.column()
#manipulator
sub1.itemR(view, "use_manipulator")
sub2 = sub1.column()
sub2.enabled = view.use_manipulator
sub2.itemR(view, "manipulator_size", text="Size")
sub2.itemR(view, "manipulator_handle_size", text="Handle Size")
sub2.itemR(view, "manipulator_hotspot", text="Hotspot")
sub1.itemS()
sub1.itemS()
sub1.itemS()
sub1.itemL(text="Toolbox:")
sub1.itemR(view, "use_column_layout")
sub1.itemL(text="Open Toolbox Delay:")
sub1.itemR(view, "open_left_mouse_delay", text="Hold LMB")
sub1.itemR(view, "open_right_mouse_delay", text="Hold RMB")
class USERPREF_PT_edit(bpy.types.Panel):
__space_type__ = 'USER_PREFERENCES'
__label__ = "Edit"
__show_header__ = False
def poll(self, context):
userpref = context.user_preferences
return (userpref.active_section == 'EDIT_METHODS')
def draw(self, context):
layout = self.layout
userpref = context.user_preferences
edit = userpref.edit
view = userpref.view
split = layout.split()
col = split.column()
sub = col.split(percentage=0.85)
sub1 = sub.column()
sub1.itemL(text="Materials:")
sub1.itemR(edit, "material_linked_object", text="Linked to Object")
sub1.itemR(edit, "material_linked_obdata", text="Linked to ObData")
sub1.itemS()
sub1.itemS()
sub1.itemS()
sub1.itemL(text="New Objects:")
sub1.itemR(edit, "enter_edit_mode")
sub1.itemR(edit, "align_to_view")
sub1.itemS()
sub1.itemS()
sub1.itemS()
sub1.itemL(text="Transform:")
sub1.itemR(edit, "drag_immediately")
col = split.column()
sub = col.split(percentage=0.85)
sub1 = sub.column()
sub1.itemL(text="Snap:")
sub1.itemR(edit, "snap_translate", text="Translate")
sub1.itemR(edit, "snap_rotate", text="Rotate")
sub1.itemR(edit, "snap_scale", text="Scale")
sub1.itemS()
sub1.itemS()
sub1.itemS()
sub1.itemL(text="Grease Pencil:")
sub1.itemR(edit, "grease_pencil_manhattan_distance", text="Manhattan Distance")
sub1.itemR(edit, "grease_pencil_euclidean_distance", text="Euclidean Distance")
sub1.itemR(edit, "grease_pencil_smooth_stroke", text="Smooth Stroke")
# sub1.itemR(edit, "grease_pencil_simplify_stroke", text="Simplify Stroke")
sub1.itemR(edit, "grease_pencil_eraser_radius", text="Eraser Radius")
col = split.column()
sub = col.split(percentage=0.85)
sub1 = sub.column()
sub1.itemL(text="Keyframing:")
sub1.itemR(edit, "use_visual_keying")
sub1.itemR(edit, "new_interpolation_type")
sub1.itemS()
sub1.itemR(edit, "auto_keying_enable", text="Auto Keyframing")
sub2 = sub1.column()
sub2.enabled = edit.auto_keying_enable
sub2.row().itemR(edit, "auto_keying_mode", expand=True)
sub2.itemR(edit, "auto_keyframe_insert_available", text="Only Insert Available")
sub2.itemR(edit, "auto_keyframe_insert_needed", text="Only Insert Needed")
sub1.itemS()
sub1.itemS()
sub1.itemS()
sub1.itemL(text="Undo:")
sub1.itemR(edit, "global_undo")
sub1.itemR(edit, "undo_steps", text="Steps")
sub1.itemR(edit, "undo_memory_limit", text="Memory Limit")
sub1.itemS()
sub1.itemS()
sub1.itemS()
col = split.column()
sub = col.split(percentage=0.85)
sub1 = sub.column()
sub1.itemL(text="Duplicate:")
sub1.itemR(edit, "duplicate_mesh", text="Mesh")
sub1.itemR(edit, "duplicate_surface", text="Surface")
sub1.itemR(edit, "duplicate_curve", text="Curve")
sub1.itemR(edit, "duplicate_text", text="Text")
sub1.itemR(edit, "duplicate_metaball", text="Metaball")
sub1.itemR(edit, "duplicate_armature", text="Armature")
sub1.itemR(edit, "duplicate_lamp", text="Lamp")
sub1.itemR(edit, "duplicate_material", text="Material")
sub1.itemR(edit, "duplicate_texture", text="Texture")
sub1.itemR(edit, "duplicate_ipo", text="F-Curve")
sub1.itemR(edit, "duplicate_action", text="Action")
sub1.itemR(edit, "duplicate_particle", text="Particle")
class USERPREF_PT_system(bpy.types.Panel):
__space_type__ = 'USER_PREFERENCES'
__label__ = "System"
__show_header__ = False
def poll(self, context):
userpref = context.user_preferences
return (userpref.active_section == 'SYSTEM_OPENGL')
def draw(self, context):
layout = self.layout
userpref = context.user_preferences
system = userpref.system
lan = userpref.language
split = layout.split()
col = split.column()
sub = col.split(percentage=0.85)
sub1 = sub.column()
sub1.itemR(system, "emulate_numpad")
sub1.itemS()
sub1.itemS()
#Weight Colors
sub1.itemL(text="Weight Colors:")
sub1.itemR(system, "use_weight_color_range", text="Use Custom Range")
sub2 = sub1.column()
sub2.active = system.use_weight_color_range
sub2.template_color_ramp(system.weight_color_range, expand=True)
sub1.itemS()
sub1.itemS()
#sequencer
sub1.itemL(text="Sequencer:")
sub1.itemR(system, "prefetch_frames")
sub1.itemR(system, "memory_cache_limit")
col = split.column()
sub = col.split(percentage=0.85)
sub1 = sub .column()
#System
sub1.itemL(text="System:")
sub1.itemR(lan, "dpi")
sub1.itemR(system, "auto_run_python_scripts")
sub1.itemR(system, "frame_server_port")
sub1.itemR(system, "filter_file_extensions")
sub1.itemR(system, "hide_dot_files_datablocks")
sub1.itemR(lan, "scrollback", text="Console Scrollback")
sub1.itemS()
sub1.itemS()
sub1.itemL(text="Sound:")
sub1.itemR(system, "audio_device")
sub2 = sub1.column()
sub2.active = system.audio_device != 'AUDIO_DEVICE_NULL'
sub2.itemR(system, "enable_all_codecs")
sub2.itemR(system, "game_sound")
sub2.itemR(system, "audio_channels")
sub2.itemR(system, "audio_mixing_buffer")
sub2.itemR(system, "audio_sample_rate")
sub2.itemR(system, "audio_sample_format")
col = split.column()
sub = col.split(percentage=0.85)
sub1 = sub.column()
#OpenGL
sub1.itemL(text="OpenGL:")
sub1.itemR(system, "clip_alpha", slider=True)
sub1.itemR(system, "use_mipmaps")
sub1.itemL(text="Window Draw Method:")
sub1.row().itemR(system, "window_draw_method", expand=True)
sub1.itemL(text="Textures:")
sub1.itemR(system, "gl_texture_limit", text="Limit Size")
sub1.itemR(system, "texture_time_out", text="Time Out")
sub1.itemR(system, "texture_collection_rate", text="Collection Rate")
class USERPREF_PT_filepaths(bpy.types.Panel):
__space_type__ = 'USER_PREFERENCES'
__label__ = "File Paths"
__show_header__ = False
def poll(self, context):
userpref = context.user_preferences
return (userpref.active_section == 'FILE_PATHS')
def draw(self, context):
layout = self.layout
userpref = context.user_preferences
paths = userpref.filepaths
split = layout.split()
col = split.column()
col.itemL(text="File Paths:")
sub = col.split(percentage=0.3)
sub.itemL(text="Fonts:")
sub.itemR(paths, "fonts_directory", text="")
sub = col.split(percentage=0.3)
sub.itemL(text="Textures:")
sub.itemR(paths, "textures_directory", text="")
sub = col.split(percentage=0.3)
sub.itemL(text="Texture Plugins:")
sub.itemR(paths, "texture_plugin_directory", text="")
sub = col.split(percentage=0.3)
sub.itemL(text="Sequence Plugins:")
sub.itemR(paths, "sequence_plugin_directory", text="")
sub = col.split(percentage=0.3)
sub.itemL(text="Render Output:")
sub.itemR(paths, "render_output_directory", text="")
sub = col.split(percentage=0.3)
sub.itemL(text="Scripts:")
sub.itemR(paths, "python_scripts_directory", text="")
sub = col.split(percentage=0.3)
sub.itemL(text="Sounds:")
sub.itemR(paths, "sounds_directory", text="")
sub = col.split(percentage=0.3)
sub.itemL(text="Temp:")
sub.itemR(paths, "temporary_directory", text="")
col = split.column()
sub = col.split(percentage=0.2)
sub1 = sub.column()
sub2 = sub.column()
sub2.itemL(text="Save & Load:")
sub2.itemR(paths, "use_relative_paths")
sub2.itemR(paths, "compress_file")
sub2.itemR(paths, "load_ui")
sub2.itemS()
sub2.itemS()
sub2.itemL(text="Auto Save:")
sub2.itemR(paths, "save_version")
sub2.itemR(paths, "recent_files")
sub2.itemR(paths, "save_preview_images")
sub2.itemR(paths, "auto_save_temporary_files")
sub3 = sub2.column()
sub3.enabled = paths.auto_save_temporary_files
sub3.itemR(paths, "auto_save_time", text="Timer (mins)")
class USERPREF_PT_language(bpy.types.Panel):
__space_type__ = 'USER_PREFERENCES'
__label__ = "Language"
__show_header__ = False
def poll(self, context):
userpref = context.user_preferences
return (userpref.active_section == 'LANGUAGE_COLORS')
def draw(self, context):
layout = self.layout
userpref = context.user_preferences
lan = userpref.language
split = layout.split()
col = split.column()
col.itemR(lan, "language")
col.itemL(text="Translate:")
col.itemR(lan, "translate_tooltips", text="Tooltips")
col.itemR(lan, "translate_buttons", text="Labels")
col.itemR(lan, "translate_toolbox", text="Toolbox")
col.itemS()
col.itemS()
col.itemR(lan, "use_textured_fonts")
col = split.column()
bpy.types.register(USERPREF_HT_header)
bpy.types.register(USERPREF_MT_view)
bpy.types.register(USERPREF_PT_tabs)
bpy.types.register(USERPREF_PT_view)
bpy.types.register(USERPREF_PT_edit)
bpy.types.register(USERPREF_PT_system)
bpy.types.register(USERPREF_PT_filepaths)
bpy.types.register(USERPREF_PT_language)

1353
release/ui/space_view3d.py Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,748 @@
import bpy
class View3DPanel(bpy.types.Panel):
__space_type__ = 'VIEW_3D'
__region_type__ = 'TOOLS'
# ********** default tools for objectmode ****************
class VIEW3D_PT_tools_objectmode(View3DPanel):
__context__ = "objectmode"
__label__ = "Object Tools"
def draw(self, context):
layout = self.layout
layout.itemL(text="Transform:")
col = layout.column(align=True)
col.itemO("tfm.translate")
col.itemO("tfm.rotate")
col.itemO("tfm.resize", text="Scale")
layout.itemL(text="Object:")
col = layout.column(align=True)
col.itemO("object.duplicate")
col.itemO("object.delete")
active_object= context.active_object
if active_object and active_object.type == 'MESH':
layout.itemL(text="Shading:")
col = layout.column(align=True)
col.itemO("object.shade_smooth", text="Smooth")
col.itemO("object.shade_flat", text="Flat")
layout.itemL(text="Keyframes:")
col = layout.column(align=True)
col.itemO("anim.insert_keyframe_menu", text="Insert")
col.itemO("anim.delete_keyframe_v3d", text="Remove")
layout.itemL(text="Repeat:")
col = layout.column(align=True)
col.itemO("screen.repeat_last")
col.itemO("screen.repeat_history", text="History...")
col.itemO("screen.redo_last", text="Tweak...")
# ********** default tools for editmode_mesh ****************
class VIEW3D_PT_tools_meshedit(View3DPanel):
__context__ = "mesh_edit"
__label__ = "Mesh Tools"
def draw(self, context):
layout = self.layout
layout.itemL(text="Transform:")
col = layout.column(align=True)
col.itemO("tfm.translate")
col.itemO("tfm.rotate")
col.itemO("tfm.resize", text="Scale")
layout.itemL(text="Mesh:")
col = layout.column(align=True)
col.itemO("mesh.duplicate")
col.itemO("mesh.delete")
layout.itemL(text="Modeling:")
col = layout.column(align=True)
col.itemO("mesh.extrude")
col.itemO("mesh.subdivide")
col.itemO("mesh.spin")
col.itemO("mesh.screw")
layout.itemL(text="Shading:")
col = layout.column(align=True)
col.itemO("mesh.faces_shade_smooth", text="Smooth")
col.itemO("mesh.faces_shade_flat", text="Flat")
layout.itemL(text="UV Mapping:")
col = layout.column(align=True)
col.itemO("uv.mapping_menu", text="Unwrap")
col.itemO("mesh.uvs_rotate")
col.itemO("mesh.uvs_mirror")
layout.itemL(text="Repeat:")
col = layout.column(align=True)
col.itemO("screen.repeat_last")
col.itemO("screen.repeat_history", text="History...")
col.itemO("screen.redo_last", text="Tweak...")
# ********** default tools for editmode_curve ****************
class VIEW3D_PT_tools_curveedit(View3DPanel):
__context__ = "curve_edit"
__label__ = "Curve Tools"
def draw(self, context):
layout = self.layout
layout.itemL(text="Transform:")
col = layout.column(align=True)
col.itemO("tfm.translate")
col.itemO("tfm.rotate")
col.itemO("tfm.resize", text="Scale")
layout.itemL(text="Curve:")
col = layout.column(align=True)
col.itemO("curve.duplicate")
col.itemO("curve.delete")
col.itemO("curve.cyclic_toggle")
col.itemO("curve.switch_direction")
col.itemO("curve.spline_type_set")
layout.itemL(text="Modeling:")
col = layout.column(align=True)
col.itemO("curve.extrude")
col.itemO("curve.subdivide")
layout.itemL(text="Repeat:")
col = layout.column(align=True)
col.itemO("screen.repeat_last")
col.itemO("screen.repeat_history", text="History...")
col.itemO("screen.redo_last", text="Tweak...")
# ********** default tools for editmode_surface ****************
class VIEW3D_PT_tools_surfaceedit(View3DPanel):
__context__ = "surface_edit"
__label__ = "Surface Tools"
def draw(self, context):
layout = self.layout
layout.itemL(text="Transform:")
col = layout.column(align=True)
col.itemO("tfm.translate")
col.itemO("tfm.rotate")
col.itemO("tfm.resize", text="Scale")
layout.itemL(text="Curve:")
col = layout.column(align=True)
col.itemO("curve.duplicate")
col.itemO("curve.delete")
col.itemO("curve.cyclic_toggle")
col.itemO("curve.switch_direction")
layout.itemL(text="Modeling:")
col = layout.column(align=True)
col.itemO("curve.extrude")
col.itemO("curve.subdivide")
layout.itemL(text="Repeat:")
col = layout.column(align=True)
col.itemO("screen.repeat_last")
col.itemO("screen.repeat_history", text="History...")
col.itemO("screen.redo_last", text="Tweak...")
# ********** default tools for editmode_text ****************
class VIEW3D_PT_tools_textedit(View3DPanel):
__context__ = "text_edit"
__label__ = "Text Tools"
def draw(self, context):
layout = self.layout
layout.itemL(text="Text Edit:")
col = layout.column(align=True)
col.itemO("font.text_copy", text="Copy")
col.itemO("font.text_cut", text="Cut")
col.itemO("font.text_paste", text="Paste")
layout.itemL(text="Style:")
col = layout.column(align=True)
col.itemO("font.case_set")
col.itemO("font.style_toggle")
layout.itemL(text="Repeat:")
col = layout.column(align=True)
col.itemO("screen.repeat_last")
col.itemO("screen.repeat_history", text="History...")
col.itemO("screen.redo_last", text="Tweak...")
# ********** default tools for editmode_armature ****************
class VIEW3D_PT_tools_armatureedit(View3DPanel):
__context__ = "armature_edit"
__label__ = "Armature Tools"
def draw(self, context):
layout = self.layout
layout.itemL(text="Transform:")
col = layout.column(align=True)
col.itemO("tfm.translate")
col.itemO("tfm.rotate")
col.itemO("tfm.resize", text="Scale")
layout.itemL(text="Bones:")
col = layout.column(align=True)
col.itemO("armature.bone_primitive_add", text="Add")
col.itemO("armature.duplicate", text="Duplicate")
col.itemO("armature.delete", text="Delete")
layout.itemL(text="Modeling:")
layout.itemO("armature.extrude")
layout.itemL(text="Repeat:")
col = layout.column(align=True)
col.itemO("screen.repeat_last")
col.itemO("screen.repeat_history", text="History...")
col.itemO("screen.redo_last", text="Tweak...")
# ********** default tools for editmode_mball ****************
class VIEW3D_PT_tools_mballedit(View3DPanel):
__context__ = "mball_edit"
__label__ = "Meta Tools"
def draw(self, context):
layout = self.layout
layout.itemL(text="Transform:")
col = layout.column(align=True)
col.itemO("tfm.translate")
col.itemO("tfm.rotate")
col.itemO("tfm.resize", text="Scale")
layout.itemL(text="Repeat:")
col = layout.column(align=True)
col.itemO("screen.repeat_last")
col.itemO("screen.repeat_history", text="History...")
col.itemO("screen.redo_last", text="Tweak...")
# ********** default tools for editmode_lattice ****************
class VIEW3D_PT_tools_latticeedit(View3DPanel):
__context__ = "lattice_edit"
__label__ = "Lattice Tools"
def draw(self, context):
layout = self.layout
layout.itemL(text="Transform:")
col = layout.column(align=True)
col.itemO("tfm.translate")
col.itemO("tfm.rotate")
col.itemO("tfm.resize", text="Scale")
layout.itemL(text="Repeat:")
col = layout.column(align=True)
col.itemO("screen.repeat_last")
col.itemO("screen.repeat_history", text="History...")
col.itemO("screen.redo_last", text="Tweak...")
# ********** default tools for posemode ****************
class VIEW3D_PT_tools_posemode(View3DPanel):
__context__ = "posemode"
__label__ = "Pose Tools"
def draw(self, context):
layout = self.layout
layout.itemL(text="Transform:")
col = layout.column(align=True)
col.itemO("tfm.translate")
col.itemO("tfm.rotate")
col.itemO("tfm.resize", text="Scale")
layout.itemL(text="Bones:")
col = layout.column(align=True)
col.itemO("pose.hide", text="Hide")
col.itemO("pose.reveal", text="Reveal")
layout.itemL(text="Keyframes:")
col = layout.column(align=True)
col.itemO("anim.insert_keyframe_menu", text="Insert")
col.itemO("anim.delete_keyframe_v3d", text="Remove")
layout.itemL(text="Pose:")
col = layout.column(align=True)
col.itemO("pose.copy", text="Copy")
col.itemO("pose.paste", text="Paste")
layout.itemL(text="Library:")
col = layout.column(align=True)
col.itemO("poselib.pose_add", text="Add")
col.itemO("poselib.pose_remove", text="Remove")
layout.itemL(text="Repeat:")
col = layout.column(align=True)
col.itemO("screen.repeat_last")
col.itemO("screen.repeat_history", text="History...")
col.itemO("screen.redo_last", text="Tweak...")
# ********** default tools for paint modes ****************
class PaintPanel(bpy.types.Panel):
__space_type__ = 'VIEW_3D'
__region_type__ = 'TOOLS'
def paint_settings(self, context):
ts = context.tool_settings
if context.sculpt_object:
return ts.sculpt
elif context.vertex_paint_object:
return ts.vertex_paint
elif context.weight_paint_object:
return ts.weight_paint
elif context.texture_paint_object:
return ts.image_paint
elif context.particle_edit_object:
return ts.particle_edit
return False
class VIEW3D_PT_tools_brush(PaintPanel):
__label__ = "Brush"
def poll(self, context):
return self.paint_settings(context)
def draw(self, context):
layout = self.layout
settings = self.paint_settings(context)
brush = settings.brush
if not context.particle_edit_object:
col = layout.split().column()
row = col.row()
row.template_list(settings, "brushes", settings, "active_brush_index", rows=2)
col.template_ID(settings, "brush", new="brush.add")
# Particle Mode #
# XXX This needs a check if psys is editable.
if context.particle_edit_object:
# XXX Select Particle System
layout.column().itemR(settings, "tool", expand=True)
if settings.tool != 'NONE':
col = layout.column()
col.itemR(brush, "size", slider=True)
col.itemR(brush, "strength", slider=True)
if settings.tool == 'ADD':
col = layout.column()
col.itemR(settings, "add_interpolate")
sub = col.column(align=True)
sub.active = settings.add_interpolate
sub.itemR(brush, "steps", slider=True)
sub.itemR(settings, "add_keys", slider=True)
elif settings.tool == 'LENGTH':
layout.itemR(brush, "length_mode", expand=True)
elif settings.tool == 'PUFF':
layout.itemR(brush, "puff_mode", expand=True)
# Sculpt Mode #
elif context.sculpt_object and settings.brush:
col = layout.column()
col.itemS()
row = col.row(align=True)
row.itemR(brush, "size", slider=True)
row.itemR(brush, "size_pressure", toggle=True, text="")
if brush.sculpt_tool != 'GRAB':
row = col.row(align=True)
row.itemR(brush, "strength", slider=True)
row.itemR(brush, "strength_pressure", text="")
col = layout.column()
if brush.sculpt_tool in ('DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'):
col.itemR(brush, "flip_direction")
if brush.sculpt_tool == 'LAYER':
col.itemR(brush, "persistent")
col.itemO("sculpt.set_persistent_base")
col.itemR(brush, "sculpt_tool")
# Texture Paint Mode #
elif context.texture_paint_object:
col = layout.column(align=True)
col.item_enumR(settings, "tool", 'DRAW')
col.item_enumR(settings, "tool", 'SOFTEN')
col.item_enumR(settings, "tool", 'CLONE')
col.item_enumR(settings, "tool", 'SMEAR')
col = layout.column()
col.itemR(brush, "color", text="")
row = col.row(align=True)
row.itemR(brush, "size", slider=True)
row.itemR(brush, "size_pressure", toggle=True, text="")
row = col.row(align=True)
row.itemR(brush, "strength", slider=True)
row.itemR(brush, "strength_pressure", toggle=True, text="")
col.itemR(brush, "blend")
# Weight Paint Mode #
elif context.weight_paint_object:
layout.itemR(context.tool_settings, "vertex_group_weight", text="Weight", slider=True)
col = layout.column()
row = col.row(align=True)
row.itemR(brush, "size", slider=True)
row.itemR(brush, "size_pressure", toggle=True, text="")
row = col.row(align=True)
row.itemR(brush, "strength", slider=True)
row.itemR(brush, "strength_pressure", toggle=True, text="")
# Vertex Paint Mode #
elif context.vertex_paint_object:
col = layout.column()
col.itemR(brush, "color", text="")
row = col.row(align=True)
row.itemR(brush, "size", slider=True)
row.itemR(brush, "size_pressure", toggle=True, text="")
row = col.row(align=True)
row.itemR(brush, "strength", slider=True)
row.itemR(brush, "strength_pressure", toggle=True, text="")
class VIEW3D_PT_tools_brush_stroke(PaintPanel):
__label__ = "Stroke"
__default_closed__ = True
def poll(self, context):
settings = self.paint_settings(context)
return (settings and settings.brush and (context.sculpt_object or
context.vertex_paint_object or
context.weight_paint_object or
context.texture_paint_object))
def draw(self, context):
layout = self.layout
settings = self.paint_settings(context)
brush = settings.brush
texture_paint = context.texture_paint_object
if context.sculpt_object:
if brush.sculpt_tool != 'LAYER':
layout.itemR(brush, "anchored")
layout.itemR(brush, "rake")
layout.itemR(brush, "airbrush")
col = layout.column()
col.active = brush.airbrush
col.itemR(brush, "rate", slider=True)
if not texture_paint:
layout.itemR(brush, "smooth_stroke")
col = layout.column()
col.active = brush.smooth_stroke
col.itemR(brush, "smooth_stroke_radius", text="Radius", slider=True)
col.itemR(brush, "smooth_stroke_factor", text="Factor", slider=True)
layout.itemR(brush, "space")
row = layout.row(align=True)
row.active = brush.space
row.itemR(brush, "spacing", text="Distance", slider=True)
if texture_paint:
row.itemR(brush, "spacing_pressure", toggle=True, text="")
class VIEW3D_PT_tools_brush_curve(PaintPanel):
__label__ = "Curve"
__default_closed__ = True
def poll(self, context):
settings = self.paint_settings(context)
return (settings and settings.brush and settings.brush.curve)
def draw(self, context):
layout = self.layout
settings = self.paint_settings(context)
brush = settings.brush
layout.template_curve_mapping(brush.curve)
layout.item_menu_enumO("brush.curve_preset", property="shape")
class VIEW3D_PT_sculpt_options(PaintPanel):
__label__ = "Options"
def poll(self, context):
return context.sculpt_object
def draw(self, context):
layout = self.layout
sculpt = context.tool_settings.sculpt
col = layout.column()
col.itemR(sculpt, "partial_redraw", text="Partial Refresh")
col.itemR(sculpt, "show_brush")
split = self.layout.split()
col = split.column()
col.itemL(text="Symmetry:")
col.itemR(sculpt, "symmetry_x", text="X")
col.itemR(sculpt, "symmetry_y", text="Y")
col.itemR(sculpt, "symmetry_z", text="Z")
col = split.column()
col.itemL(text="Lock:")
col.itemR(sculpt, "lock_x", text="X")
col.itemR(sculpt, "lock_y", text="Y")
col.itemR(sculpt, "lock_z", text="Z")
# ********** default tools for weightpaint ****************
class VIEW3D_PT_tools_weightpaint(View3DPanel):
__context__ = "weightpaint"
__label__ = "Options"
def draw(self, context):
layout = self.layout
wpaint = context.tool_settings.weight_paint
col = layout.column()
col.itemL(text="Blend:")
col.itemR(wpaint, "mode", text="")
col.itemR(wpaint, "all_faces")
col.itemR(wpaint, "normals")
col.itemR(wpaint, "spray")
col.itemR(wpaint, "vertex_dist", text="Distance")
# Commented out because the Apply button isn't an operator yet, making these settings useless
# col.itemL(text="Gamma:")
# col.itemR(wpaint, "gamma", text="")
# col.itemL(text="Multiply:")
# col.itemR(wpaint, "mul", text="")
# Also missing now:
# Soft, Vgroup, X-Mirror and "Clear" Operator.
# ********** default tools for vertexpaint ****************
class VIEW3D_PT_tools_vertexpaint(View3DPanel):
__context__ = "vertexpaint"
__label__ = "Options"
def draw(self, context):
layout = self.layout
vpaint = context.tool_settings.vertex_paint
col = layout.column()
col.itemL(text="Blend:")
col.itemR(vpaint, "mode", text="")
col.itemR(vpaint, "all_faces")
col.itemR(vpaint, "normals")
col.itemR(vpaint, "spray")
col.itemR(vpaint, "vertex_dist", text="Distance")
# Commented out because the Apply button isn't an operator yet, making these settings useless
# col.itemL(text="Gamma:")
# col.itemR(vpaint, "gamma", text="")
# col.itemL(text="Multiply:")
# col.itemR(vpaint, "mul", text="")
# ********** default tools for texturepaint ****************
class VIEW3D_PT_tools_projectpaint(View3DPanel):
__context__ = "projectpaint"
__label__ = "Project Paint"
def poll(self, context):
return context.tool_settings.image_paint.tool != 'SMEAR'
def draw_header(self, context):
layout = self.layout
ipaint = context.tool_settings.image_paint
layout.itemR(ipaint, "use_projection", text="")
def draw(self, context):
layout = self.layout
ipaint = context.tool_settings.image_paint
settings = context.tool_settings.image_paint
use_projection= ipaint.use_projection
col = layout.column()
sub = col.column()
sub.active = use_projection
sub.itemR(ipaint, "use_occlude")
sub.itemR(ipaint, "use_backface_cull")
split = layout.split()
col = split.column()
col.active = (use_projection)
col.itemR(ipaint, "use_normal_falloff")
col = split.column()
col.active = (ipaint.use_normal_falloff and use_projection)
col.itemR(ipaint, "normal_angle", text="")
split = layout.split(percentage=0.7)
col = split.column(align=False)
col.active = (use_projection)
col.itemR(ipaint, "use_stencil_layer")
col = split.column(align=False)
col.active = (use_projection and ipaint.use_stencil_layer)
col.itemR(ipaint, "invert_stencil", text="Inv")
col = layout.column()
sub = col.column()
sub.active = (settings.tool == 'CLONE')
sub.itemR(ipaint, "use_clone_layer")
sub = col.column()
sub.itemR(ipaint, "seam_bleed")
# ********** default tools for particle mode ****************
class VIEW3D_PT_tools_particlemode(View3DPanel):
__context__ = "particlemode"
__label__ = "Options"
def draw(self, context):
layout = self.layout
pe = context.tool_settings.particle_edit
ob = pe.object
row = layout.row()
row.itemL(text="Edit:")
row.itemR(pe, "type", text="")
if pe.type == 'PARTICLES':
if ob.particle_systems:
if len(ob.particle_systems) > 1:
layout.template_list(ob, "particle_systems", ob, "active_particle_system_index", type='ICONS')
ptcache = ob.particle_systems[ob.active_particle_system_index].point_cache
else:
for md in ob.modifiers:
if md.type==pe.type:
ptcache = md.point_cache
if ptcache and len(ptcache.point_cache_list) > 1:
layout.template_list(ptcache, "point_cache_list", ptcache, "active_point_cache_index", type='ICONS')
if not pe.editable:
layout.itemL(text="Point cache must be baked")
layout.itemL(text="to enable editing!")
col = layout.column(align=True)
if pe.hair:
col.active = pe.editable
col.itemR(pe, "emitter_deflect", text="Deflect emitter")
sub = col.row()
sub.active = pe.emitter_deflect
sub.itemR(pe, "emitter_distance", text="Distance")
col = layout.column(align=True)
col.active = pe.editable
col.itemL(text="Keep:")
col.itemR(pe, "keep_lengths", text="Lenghts")
col.itemR(pe, "keep_root", text="Root")
if not pe.hair:
col.itemL(text="Correct:")
col.itemR(pe, "auto_velocity", text="Velocity")
col = layout.column(align=True)
col.active = pe.editable
col.itemL(text="Draw:")
col.itemR(pe, "draw_step", text="Path Steps")
if pe.type == 'PARTICLES':
col.itemR(pe, "draw_particles", text="Particles")
col.itemR(pe, "fade_time")
sub = col.row()
sub.active = pe.fade_time
sub.itemR(pe, "fade_frames", slider=True)
bpy.types.register(VIEW3D_PT_tools_objectmode)
bpy.types.register(VIEW3D_PT_tools_meshedit)
bpy.types.register(VIEW3D_PT_tools_curveedit)
bpy.types.register(VIEW3D_PT_tools_surfaceedit)
bpy.types.register(VIEW3D_PT_tools_textedit)
bpy.types.register(VIEW3D_PT_tools_armatureedit)
bpy.types.register(VIEW3D_PT_tools_mballedit)
bpy.types.register(VIEW3D_PT_tools_latticeedit)
bpy.types.register(VIEW3D_PT_tools_posemode)
bpy.types.register(VIEW3D_PT_tools_brush)
bpy.types.register(VIEW3D_PT_tools_brush_stroke)
bpy.types.register(VIEW3D_PT_tools_brush_curve)
bpy.types.register(VIEW3D_PT_sculpt_options)
bpy.types.register(VIEW3D_PT_tools_vertexpaint)
bpy.types.register(VIEW3D_PT_tools_weightpaint)
bpy.types.register(VIEW3D_PT_tools_projectpaint)
bpy.types.register(VIEW3D_PT_tools_particlemode)

View File

@@ -40,6 +40,7 @@ struct ImBuf;
struct Tex;
struct anim;
struct Scene;
struct ListBase;
/* call from library */
void free_image(struct Image *me);

View File

@@ -1737,7 +1737,6 @@ public:
if (twoSided)
ep.addExtraTechniqueParameter("GOOGLEEARTH", "show_double_sided", 1);
ep.addExtraTechniques(mSW);
ep.closeProfile();
if (twoSided)
mSW->appendTextBlock("<extra><technique profile=\"MAX3D\"><double_sided>1</double_sided></technique></extra>");

View File

@@ -56,6 +56,7 @@
#include "COLLADAFWVisualScene.h"
#include "COLLADAFWFileInfo.h"
#include "COLLADAFWArrayPrimitiveType.h"
#include "COLLADAFWLibraryNodes.h"
#include "COLLADASaxFWLLoader.h"
@@ -1627,6 +1628,13 @@ private:
// }
// }
for (i = 0; i < totuvset; i++) {
if (mesh->getUVCoords().getLength(i) == 0) {
totuvset = 0;
break;
}
}
for (i = 0; i < totuvset; i++) {
CustomData_add_layer(&me->fdata, CD_MTFACE, CD_CALLOC, NULL, me->totface);
//this->set_layername_map[i] = CustomData_get_layer_name(&me->fdata, CD_MTFACE, i);
@@ -3240,7 +3248,9 @@ private:
std::map<COLLADAFW::UniqueId, Lamp*> uid_lamp_map;
std::map<Material*, TexIndexTextureArrayMap> material_texture_mapping_map;
std::map<COLLADAFW::UniqueId, Object*> object_map;
std::map<COLLADAFW::UniqueId, COLLADAFW::Node*> node_map;
std::vector<const COLLADAFW::VisualScene*> vscenes;
std::vector<Object*> libnode_ob;
std::map<COLLADAFW::UniqueId, COLLADAFW::Node*> root_map; // find root joint by child joint uid, for bone tree evaluation during resampling
@@ -3294,6 +3304,19 @@ public:
/** This method is called after the last write* method. No other methods will be called after this.*/
virtual void finish()
{
std::vector<const COLLADAFW::VisualScene*>::iterator it;
for (it = vscenes.begin(); it != vscenes.end(); it++) {
// TODO: create a new scene except the selected <visual_scene> - use current blender scene for it
Scene *sce = CTX_data_scene(mContext);
const COLLADAFW::NodePointerArray& roots = (*it)->getRootNodes();
for (unsigned int i = 0; i < roots.getCount(); i++) {
write_node(roots[i], NULL, sce, NULL, false);
}
}
armature_importer.make_armatures(mContext);
#if 0
armature_importer.fix_animation();
#endif
@@ -3305,6 +3328,29 @@ public:
translate_anim_recursive(roots[i]);
}
if (libnode_ob.size()) {
Scene *sce = CTX_data_scene(mContext);
fprintf(stderr, "got %u library nodes to free\n", libnode_ob.size());
// free all library_nodes
std::vector<Object*>::iterator it;
for (it = libnode_ob.begin(); it != libnode_ob.end(); it++) {
Object *ob = *it;
Base *base = object_in_scene(ob, sce);
if (base) {
BLI_remlink(&sce->base, base);
free_libblock_us(&G.main->object, base->object);
if (sce->basact==base)
sce->basact= NULL;
MEM_freeN(base);
}
}
libnode_ob.clear();
DAG_scene_sort(CTX_data_main(mContext), sce);
DAG_ids_flush_update(CTX_data_main(mContext), 0);
}
}
@@ -3356,39 +3402,81 @@ public:
// XXX could store the scene id, but do nothing for now
return true;
}
Object *create_camera_object(COLLADAFW::InstanceCamera *camera, Object *ob, Scene *sce)
Object *create_camera_object(COLLADAFW::InstanceCamera *camera, Scene *sce)
{
const COLLADAFW::UniqueId& cam_uid = camera->getInstanciatedObjectId();
if (uid_camera_map.find(cam_uid) == uid_camera_map.end()) {
fprintf(stderr, "Couldn't find camera by UID. \n");
fprintf(stderr, "Couldn't find camera by UID.\n");
return NULL;
}
ob = add_object(sce, OB_CAMERA);
Object *ob = add_object(sce, OB_CAMERA);
Camera *cam = uid_camera_map[cam_uid];
Camera *old_cam = (Camera*)ob->data;
old_cam->id.us--;
ob->data = cam;
if (old_cam->id.us == 0) free_libblock(&G.main->camera, old_cam);
old_cam->id.us--;
if (old_cam->id.us == 0)
free_libblock(&G.main->camera, old_cam);
return ob;
}
Object *create_lamp_object(COLLADAFW::InstanceLight *lamp, Object *ob, Scene *sce)
Object *create_lamp_object(COLLADAFW::InstanceLight *lamp, Scene *sce)
{
const COLLADAFW::UniqueId& lamp_uid = lamp->getInstanciatedObjectId();
if (uid_lamp_map.find(lamp_uid) == uid_lamp_map.end()) {
fprintf(stderr, "Couldn't find lamp by UID. \n");
return NULL;
}
ob = add_object(sce, OB_LAMP);
Object *ob = add_object(sce, OB_LAMP);
Lamp *la = uid_lamp_map[lamp_uid];
Lamp *old_lamp = (Lamp*)ob->data;
old_lamp->id.us--;
ob->data = la;
if (old_lamp->id.us == 0) free_libblock(&G.main->lamp, old_lamp);
old_lamp->id.us--;
if (old_lamp->id.us == 0)
free_libblock(&G.main->lamp, old_lamp);
return ob;
}
Object *create_instance_node(Object *source_ob, COLLADAFW::Node *source_node, COLLADAFW::Node *instance_node, Scene *sce, bool is_library_node)
{
Object *obn = copy_object(source_ob);
obn->recalc |= OB_RECALC_ALL;
scene_add_base(sce, obn);
if (instance_node)
anim_importer.read_node_transform(instance_node, obn);
else
anim_importer.read_node_transform(source_node, obn);
DAG_scene_sort(CTX_data_main(mContext), sce);
DAG_ids_flush_update(CTX_data_main(mContext), 0);
COLLADAFW::NodePointerArray &children = source_node->getChildNodes();
if (children.getCount()) {
for (unsigned int i = 0; i < children.getCount(); i++) {
COLLADAFW::Node *child_node = children[i];
const COLLADAFW::UniqueId& child_id = child_node->getUniqueId();
if (object_map.find(child_id) == object_map.end())
continue;
COLLADAFW::InstanceNodePointerArray &inodes = child_node->getInstanceNodes();
Object *new_child = NULL;
if (inodes.getCount()) {
const COLLADAFW::UniqueId& id = inodes[0]->getInstanciatedObjectId();
new_child = create_instance_node(object_map[id], node_map[id], child_node, sce, is_library_node);
}
else {
new_child = create_instance_node(object_map[child_id], child_node, NULL, sce, is_library_node);
}
set_parent(new_child, obn, mContext, true);
if (is_library_node)
libnode_ob.push_back(new_child);
}
}
return obn;
}
void write_node (COLLADAFW::Node *node, COLLADAFW::Node *parent_node, Scene *sce, Object *par)
void write_node (COLLADAFW::Node *node, COLLADAFW::Node *parent_node, Scene *sce, Object *par, bool is_library_node)
{
Object *ob = NULL;
bool is_joint = node->getType() == COLLADAFW::Node::JOINT;
@@ -3411,10 +3499,10 @@ public:
material_texture_mapping_map);
}
else if (camera.getCount() != 0) {
ob = create_camera_object(camera[0], ob, sce);
ob = create_camera_object(camera[0], sce);
}
else if (lamp.getCount() != 0) {
ob = create_lamp_object(lamp[0], ob, sce);
ob = create_lamp_object(lamp[0], sce);
}
else if (controller.getCount() != 0) {
COLLADAFW::InstanceGeometry *geom = (COLLADAFW::InstanceGeometry*)controller[0];
@@ -3422,7 +3510,17 @@ public:
}
// XXX instance_node is not supported yet
else if (inst_node.getCount() != 0) {
return;
const COLLADAFW::UniqueId& node_id = inst_node[0]->getInstanciatedObjectId();
if (object_map.find(node_id) == object_map.end()) {
fprintf(stderr, "Cannot find node to instanciate.\n");
ob = NULL;
}
else {
Object *source_ob = object_map[node_id];
COLLADAFW::Node *source_node = node_map[node_id];
ob = create_instance_node(source_ob, source_node, node, sce, is_library_node);
}
}
// if node is empty - create empty object
// XXX empty node may not mean it is empty object, not sure about this
@@ -3434,7 +3532,11 @@ public:
// check if object is not NULL
if (!ob) return;
object_map[node->getUniqueId()] = ob;
object_map[node->getUniqueId()] = ob;
node_map[node->getUniqueId()] = node;
if (is_library_node)
libnode_ob.push_back(ob);
}
anim_importer.read_node_transform(node, ob);
@@ -3448,7 +3550,7 @@ public:
// if node has child nodes write them
COLLADAFW::NodePointerArray &child_nodes = node->getChildNodes();
for (unsigned int i = 0; i < child_nodes.getCount(); i++) {
write_node(child_nodes[i], node, sce, ob);
write_node(child_nodes[i], node, sce, ob, is_library_node);
}
}
@@ -3467,17 +3569,6 @@ public:
// we link Objects with Meshes here
vscenes.push_back(visualScene);
// TODO: create a new scene except the selected <visual_scene> - use current blender
// scene for it
Scene *sce = CTX_data_scene(mContext);
const COLLADAFW::NodePointerArray& roots = visualScene->getRootNodes();
for (unsigned int i = 0; i < roots.getCount(); i++) {
write_node(roots[i], NULL, sce, NULL);
}
armature_importer.make_armatures(mContext);
return true;
}
@@ -3487,6 +3578,14 @@ public:
@return The writer should return true, if writing succeeded, false otherwise.*/
virtual bool writeLibraryNodes ( const COLLADAFW::LibraryNodes* libraryNodes )
{
Scene *sce = CTX_data_scene(mContext);
const COLLADAFW::NodePointerArray& nodes = libraryNodes->getNodes();
for (unsigned int i = 0; i < nodes.getCount(); i++) {
write_node(nodes[i], NULL, sce, NULL, true);
}
return true;
}

View File

@@ -1053,6 +1053,7 @@ int WM_operator_redo_popup(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
/* ***************** Debug menu ************************* */
static uiBlock *wm_block_create_menu(bContext *C, ARegion *ar, void *arg_op)
@@ -2844,6 +2845,7 @@ void WM_OT_radial_control_partial(wmOperatorType *ot)
RNA_def_float_color(ot->srna, "texture_color", 4, tex_color, 0.0f, FLT_MAX, "Texture Color", "Radial control texture color", 0.0f, 1.0f);
}
/* ************************** timer for testing ***************** */
/* uses no type defines, fully local testing function anyway... ;) */
@@ -3032,7 +3034,6 @@ void wm_operatortype_init(void)
WM_operatortype_append(WM_OT_debug_menu);
WM_operatortype_append(WM_OT_splash);
WM_operatortype_append(WM_OT_search_menu);
WM_operatortype_append(WM_OT_call_menu);
#ifdef WITH_COLLADA
/* XXX: move these */
@@ -3040,6 +3041,7 @@ void wm_operatortype_init(void)
WM_operatortype_append(WM_OT_collada_import);
#endif
WM_operatortype_append(WM_OT_call_menu);
}
/* circleselect-like modal operators */