Merged changes in the trunk up to revision 27992.

This commit is contained in:
Tamito Kajiyama 2010-04-04 19:50:22 +00:00
commit f9e2f6acd7
247 changed files with 15282 additions and 11754 deletions

@ -460,8 +460,8 @@ IF(APPLE)
IF(WITH_SNDFILE)
SET(SNDFILE ${LIBDIR}/sndfile)
SET(SNDFILE_INC ${SNDFILE}/include)
SET(SNDFILE_LIB sndfile)
SET(SNDFILE_LIBPATH ${SNDFILE}/lib)
SET(SNDFILE_LIB sndfile FLAC ogg vorbis vorbisenc)
SET(SNDFILE_LIBPATH ${SNDFILE}/lib ${FFMPEG}/lib)
ENDIF(WITH_SNDFILE)
SET(PYTHON_VERSION 3.1)

@ -131,8 +131,8 @@ BF_JACK_LIBPATH = '${BF_JACK}/lib'
WITH_BF_SNDFILE = True
BF_SNDFILE = LIBDIR + '/sndfile'
BF_SNDFILE_INC = '${BF_SNDFILE}/include'
BF_SNDFILE_LIB = 'sndfile'
BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib'
BF_SNDFILE_LIB = 'sndfile FLAC ogg vorbis vorbisenc'
BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib ${BF_FFMPEG}/lib' #ogg libs are stored in ffmpeg dir
WITH_BF_SDL = True
BF_SDL = LIBDIR + '/sdl' #$(shell sdl-config --prefix)

@ -187,5 +187,8 @@ PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:IX86','/INCREMENTAL:NO','/N
# BF_PROFILE_LINKFLAGS = ['-pg']
# BF_PROFILE = False
#turn off makebsc by default ( as 64 bit version does ) .. takes ages to build .. for nothing ( well some M$ addicts may disagree )
BF_BSC=False
BF_BUILDDIR = '..\\build\\win32-vc'
BF_INSTALLDIR='..\\install\\win32-vc'

@ -531,10 +531,6 @@
RelativePath="..\..\..\source\blender\blenlib\intern\DLRB_tree.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\blenlib\intern\dynamiclist.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\blenlib\intern\dynlib.c"
>
@ -688,10 +684,6 @@
RelativePath="..\..\..\source\blender\blenlib\BLI_dlrbTree.h"
>
</File>
<File
RelativePath="..\..\..\source\blender\blenlib\BLI_dynamiclist.h"
>
</File>
<File
RelativePath="..\..\..\source\blender\blenlib\BLI_edgehash.h"
>
@ -776,6 +768,10 @@
RelativePath="..\..\..\source\blender\blenlib\BLI_mempool.h"
>
</File>
<File
RelativePath="..\..\..\source\blender\blenlib\BLI_path_util.h"
>
</File>
<File
RelativePath="..\..\..\source\blender\blenlib\BLI_pbvh.h"
>

@ -160,7 +160,7 @@ void doblur(struct ImBuf *mbuf, float fac, Cast *cast)
char *irect, *prect, *mrect;
float *irectf, *prectf, *mrectf;
/* wich buffers ? */
/* which buffers ? */
if(fac>7.0) fac= 7.0;
if(fac<=1.0) return;

@ -2041,7 +2041,7 @@ def write(filename, batch_objects = None, \
# ob_base.makeDisplayList()
# This causes the makeDisplayList command to effect the mesh
scene.set_frame(scene.current_frame)
scene.set_frame(scene.frame_current)
# Blender.Set('curframe', Blender.Get('curframe'))
@ -2216,7 +2216,7 @@ def write(filename, batch_objects = None, \
ob_base.make_display_list()
# ob_base.makeDisplayList()
# This causes the makeDisplayList command to effect the mesh
scene.set_frame(scene.current_frame)
scene.set_frame(scene.frame_current)
# Blender.Set('curframe', Blender.Get('curframe'))
del tmp_ob_type, tmp_objects
@ -2701,9 +2701,9 @@ Connections: {''')
return int(0.5 + ((t/fps) * 46186158000))
fps = float(render.fps)
start = scene.start_frame
start = scene.frame_start
# start = render.sFrame
end = scene.end_frame
end = scene.frame_end
# end = render.eFrame
if end < start: start, end = end, start
if start==end: ANIM_ENABLE = False
@ -2713,7 +2713,7 @@ Connections: {''')
if ANIM_ENABLE and [tmp for tmp in ob_anim_lists if tmp]:
frame_orig = scene.current_frame
frame_orig = scene.frame_current
# frame_orig = Blender.Get('curframe')
if ANIM_OPTIMIZE:

@ -82,7 +82,7 @@ def write(filename, sce, ob, PREF_STARTFRAME, PREF_ENDFRAME, PREF_FPS):
bpy.ops.object.mode_set(mode='OBJECT')
orig_frame = sce.current_frame
orig_frame = sce.frame_current
sce.set_frame(PREF_STARTFRAME)
me = ob.create_mesh(True, 'PREVIEW')
@ -162,8 +162,8 @@ class ExportMDD(bpy.types.Operator):
path = StringProperty(name="File Path", description="File path used for exporting the MDD file", maxlen=1024)
check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'})
fps = IntProperty(name="Frames Per Second", description="Number of frames/second", min=minfps, max=maxfps, default=25)
start_frame = IntProperty(name="Start Frame", description="Start frame for baking", min=minframe, max=maxframe, default=1)
end_frame = IntProperty(name="End Frame", description="End frame for baking", min=minframe, max=maxframe, default=250)
frame_start = IntProperty(name="Start Frame", description="Start frame for baking", min=minframe, max=maxframe, default=1)
frame_end = IntProperty(name="End Frame", description="End frame for baking", min=minframe, max=maxframe, default=250)
def poll(self, context):
ob = context.active_object
@ -173,7 +173,7 @@ class ExportMDD(bpy.types.Operator):
if not self.properties.path:
raise Exception("filename not set")
write(self.properties.path, context.scene, context.active_object,
self.properties.start_frame, self.properties.end_frame, self.properties.fps)
self.properties.frame_start, self.properties.frame_end, self.properties.fps)
return {'FINISHED'}
def invoke(self, context, event):

@ -839,14 +839,14 @@ def do_export(filename, context,
for scn in export_scenes:
# scn.makeCurrent() # If already current, this is not slow.
# context = scn.getRenderingContext()
orig_frame = scn.current_frame
orig_frame = scn.frame_current
if EXPORT_ALL_SCENES: # Add scene name into the context_name
context_name[1] = '_%s' % bpy.utils.clean_name(scn.name) # WARNING, its possible that this could cause a collision. we could fix if were feeling parranoied.
# Export an animation?
if EXPORT_ANIMATION:
scene_frames = range(scn.start_frame, context.end_frame+1) # Up to and including the end frame.
scene_frames = range(scn.frame_start, context.frame_end + 1) # Up to and including the end frame.
else:
scene_frames = [orig_frame] # Dont export an animation.
@ -855,7 +855,7 @@ def do_export(filename, context,
if EXPORT_ANIMATION: # Add frame to the filename.
context_name[2] = '_%.6d' % frame
scn.current_frame = frame
scn.frame_current = frame
if EXPORT_SEL_ONLY:
export_objects = context.selected_objects
else:
@ -874,7 +874,7 @@ def do_export(filename, context,
EXPORT_POLYGROUPS, EXPORT_CURVE_AS_NURBS)
scn.current_frame = orig_frame
scn.frame_current = orig_frame
# Restore old active scene.
# orig_scene.makeCurrent()

@ -321,11 +321,11 @@ def bvh_node_dict2objects(context, bvh_nodes, IMPORT_START_FRAME=1, IMPORT_LOOP=
# 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 frame_current in range(len(bvh_node.anim_data)):
Blender.Set('curframe', frame_current + IMPORT_START_FRAME)
for bvh_node in bvh_nodes.values():
lx, ly, lz, rx, ry, rz = bvh_node.anim_data[current_frame]
lx, ly, lz, rx, ry, rz = bvh_node.anim_data[frame_current]
rest_head_local = bvh_node.rest_head_local
bvh_node.temp.loc = rest_head_local + Vector(lx, ly, lz)
@ -508,16 +508,16 @@ def bvh_node_dict2armature(context, bvh_nodes, ROT_MODE='XYZ', IMPORT_START_FRAM
prev_euler = [Euler() for i in range(len(bvh_nodes))]
# 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
for frame_current in range(len(bvh_node.anim_data)-1): # skip the first frame (rest frame)
# print frame_current
# if current_frame==40: # debugging
# if frame_current==40: # debugging
# break
# Dont neet to set the current frame
for i, bvh_node in enumerate(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]
lx, ly, lz, rx, ry, rz = bvh_node.anim_data[frame_current + 1]
if bvh_node.has_rot:
bone_rotation_matrix = Euler(rx, ry, rz).to_matrix().resize4x4()
@ -565,7 +565,7 @@ class BvhImporter(bpy.types.Operator):
path = StringProperty(name="File Path", description="File path used for importing the OBJ file", maxlen=1024, default="")
scale = FloatProperty(name="Scale", description="Scale the BVH by this value", min=0.0001, max=1000000.0, soft_min=0.001, soft_max=100.0, default=0.1)
start_frame = IntProperty(name="Start Frame", description="Starting frame for the animation", default=1)
frame_start = IntProperty(name="Start Frame", description="Starting frame for the animation", default=1)
loop = BoolProperty(name="Loop", description="Loop the animation playback", default=False)
rotate_mode = EnumProperty(items=(
('QUATERNION', "Quaternion", "Convert rotations to quaternions"),
@ -597,7 +597,7 @@ class BvhImporter(bpy.types.Operator):
bvh_node_dict2armature(context, bvh_nodes,
ROT_MODE=self.properties.rotate_mode,
IMPORT_START_FRAME=self.properties.start_frame,
IMPORT_START_FRAME=self.properties.frame_start,
IMPORT_LOOP=self.properties.loop)
print('Done in %.4f\n' % (time.time() - t1))
@ -609,7 +609,8 @@ class BvhImporter(bpy.types.Operator):
return {'RUNNING_MODAL'}
menu_func = lambda self, context: self.layout.operator(BvhImporter.bl_idname, text="Motion Capture (.bvh)")
def menu_func(self, context):
self.layout.operator(BvhImporter.bl_idname, text="Motion Capture (.bvh)")
def register():

@ -1030,8 +1030,8 @@ class IMPORT_OT_autodesk_3ds(bpy.types.Operator):
return {'RUNNING_MODAL'}
menu_func = lambda self, context: self.layout.operator(IMPORT_OT_autodesk_3ds.bl_idname, text="3D Studio (.3ds)")
def menu_func(self, context):
self.layout.operator(IMPORT_OT_autodesk_3ds.bl_idname, text="3D Studio (.3ds)")
def register():
bpy.types.register(IMPORT_OT_autodesk_3ds)

@ -322,7 +322,7 @@ def load_image(imagepath, dirname):
for path in variants:
if os.path.exists(path):
return bpy.data.add_image(path)
return bpy.data.images.load(path)
else:
print(path, "doesn't exist")
@ -521,7 +521,6 @@ def split_mesh(verts_loc, faces, unique_materials, filepath, SPLIT_OB_OR_GROUP,
'''
Takes vert_loc and faces, and seperates into multiple sets of
(verts_loc, faces, unique_materials, dataname)
This is done so objects do not overload the 16 material limit.
'''
filename = stripExt(stripPath(filepath))
@ -715,9 +714,8 @@ def create_mesh(scn, new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_l
me= bpy.data.meshes.new(dataname)
# make sure the list isnt too big
for material in materials[0:16]:
for material in materials:
me.add_material(material)
# me.materials= materials[0:16] # make sure the list isnt too big.
#me.verts.extend([(0,0,0)]) # dummy vert
me.add_geometry(len(verts_loc), 0, len(faces))
@ -772,8 +770,6 @@ def create_mesh(scn, new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_l
if context_material:
if context_material_old is not context_material:
mat= material_mapping[context_material]
if mat>15:
mat= 15
context_material_old= context_material
blender_face.material_index= mat
@ -1363,7 +1359,7 @@ def load_obj_ui(filepath, BATCH_LOAD= False):
'Separate objects from obj...',\
('Object', SPLIT_OBJECTS, 'Import OBJ Objects into Blender Objects'),\
('Group', SPLIT_GROUPS, 'Import OBJ Groups into Blender Objects'),\
('Material', SPLIT_MATERIALS, 'Import each material into a seperate mesh (Avoids > 16 per mesh error)'),\
('Split Materials', SPLIT_MATERIALS, 'Import each material into a seperate mesh'),\
'Options...',\
('Keep Vert Order', KEEP_VERT_ORDER, 'Keep vert and face order, disables some other options.'),\
('Clamp Scale:', CLAMP_SIZE, 0.0, 1000.0, 'Clamp the size to this maximum (Zero to Disable)'),\
@ -1449,7 +1445,7 @@ def load_obj_ui(filepath, BATCH_LOAD= False):
Draw.BeginAlign()
SPLIT_OBJECTS = Draw.Toggle('Object', EVENT_REDRAW, ui_x+9, ui_y+89, 55, 21, SPLIT_OBJECTS.val, 'Import OBJ Objects into Blender Objects', do_split)
SPLIT_GROUPS = Draw.Toggle('Group', EVENT_REDRAW, ui_x+64, ui_y+89, 55, 21, SPLIT_GROUPS.val, 'Import OBJ Groups into Blender Objects', do_split)
SPLIT_MATERIALS = Draw.Toggle('Material', EVENT_REDRAW, ui_x+119, ui_y+89, 60, 21, SPLIT_MATERIALS.val, 'Import each material into a seperate mesh (Avoids > 16 per mesh error)', do_split)
SPLIT_MATERIALS = Draw.Toggle('Split Materials', EVENT_REDRAW, ui_x+119, ui_y+89, 60, 21, SPLIT_MATERIALS.val, 'Import each material into a seperate mesh', do_split)
Draw.EndAlign()
# Only used for user feedback
@ -1587,7 +1583,7 @@ class IMPORT_OT_obj(bpy.types.Operator):
CREATE_EDGES = BoolProperty(name="Lines as Edges", description="Import lines and faces with 2 verts as edge", default= True)
SPLIT_OBJECTS = BoolProperty(name="Object", description="Import OBJ Objects into Blender Objects", default= True)
SPLIT_GROUPS = BoolProperty(name="Group", description="Import OBJ Groups into Blender Objects", default= True)
SPLIT_MATERIALS = BoolProperty(name="Material", description="Import each material into a seperate mesh (Avoids > 16 per mesh error)", default= True)
SPLIT_MATERIALS = BoolProperty(name="Split Materials", description="Import each material into a seperate mesh", default= False)
# old comment: only used for user feedback
# disabled this option because in old code a handler for it disabled SPLIT* params, it's not passed to load_obj
# KEEP_VERT_ORDER = BoolProperty(name="Keep Vert Order", description="Keep vert and face order, disables split options, enable for morph targets", default= True)
@ -1621,7 +1617,8 @@ class IMPORT_OT_obj(bpy.types.Operator):
return {'RUNNING_MODAL'}
menu_func = lambda self, context: self.layout.operator(IMPORT_OT_obj.bl_idname, text="Wavefront (.obj)")
def menu_func(self, context):
self.layout.operator(IMPORT_OT_obj.bl_idname, text="Wavefront (.obj)")
def register():

@ -45,17 +45,17 @@ def mdd_import(filepath, ob, scene, PREF_START_FRAME=0, PREF_JUMP=1):
frames, points = unpack(">2i", file.read(8))
time = unpack((">%df" % frames), file.read(frames * 4))
print('\tpoints:%d frames:%d' % (points,frames))
print('\tpoints:%d frames:%d' % (points, frames))
# If target object doesn't have Basis shape key, create it.
try:
num_keys = len( ob.data.shape_keys.keys )
num_keys = len(ob.data.shape_keys.keys)
except:
basis = ob.add_shape_key()
basis.name = "Basis"
ob.data.update()
scene.current_frame = PREF_START_FRAME
scene.frame_current = PREF_START_FRAME
def UpdateMesh(ob, fr):
@ -68,13 +68,11 @@ def mdd_import(filepath, ob, scene, PREF_START_FRAME=0, PREF_JUMP=1):
index = len(ob.data.shape_keys.keys)-1
ob.shape_key_lock = True
verts = ob.data.shape_keys.keys[ len(ob.data.shape_keys.keys)-1 ].data
verts = ob.data.shape_keys.keys[len(ob.data.shape_keys.keys)-1].data
for v in verts:
# 12 is the size of 3 floats
x,y,z= unpack('>3f', file.read(12))
v.co[:] = x,z,y
for v in verts: # 12 is the size of 3 floats
v.co[:] = unpack('>3f', file.read(12))
#me.update()
ob.shape_key_lock = False
@ -82,15 +80,15 @@ def mdd_import(filepath, ob, scene, PREF_START_FRAME=0, PREF_JUMP=1):
# insert keyframes
shape_keys = ob.data.shape_keys
scene.current_frame -= 1
scene.frame_current -= 1
ob.data.shape_keys.keys[index].value = 0.0
shape_keys.keys[len(ob.data.shape_keys.keys)-1].keyframe_insert("value")
scene.current_frame += 1
scene.frame_current += 1
ob.data.shape_keys.keys[index].value = 1.0
shape_keys.keys[len(ob.data.shape_keys.keys)-1].keyframe_insert("value")
scene.current_frame += 1
scene.frame_current += 1
ob.data.shape_keys.keys[index].value = 0.0
shape_keys.keys[len(ob.data.shape_keys.keys)-1].keyframe_insert("value")
@ -120,8 +118,7 @@ class importMDD(bpy.types.Operator):
# to the class instance from the operator settings before calling.
path = StringProperty(name="File Path", description="File path used for importing the MDD file", maxlen=1024)
#fps = IntProperty(name="Frames Per Second", description="Number of frames/second", min=minfps, max=maxfps, default=25)
start_frame = IntProperty(name="Start Frame", description="Start frame for inserting animation", min=minframe, max=maxframe, default=0)
frame_start = IntProperty(name="Start Frame", description="Start frame for inserting animation", min=minframe, max=maxframe, default=0)
def poll(self, context):
ob = context.active_object
@ -131,7 +128,7 @@ class importMDD(bpy.types.Operator):
if not self.properties.path:
raise Exception("filename not set")
mdd_import( self.properties.path, bpy.context.active_object, context.scene, self.properties.start_frame, 1)
mdd_import(self.properties.path, bpy.context.active_object, context.scene, self.properties.frame_start, 1)
return {'FINISHED'}
@ -149,6 +146,7 @@ def register():
bpy.types.register(importMDD)
bpy.types.INFO_MT_file_import.append(menu_func)
def unregister():
bpy.types.unregister(importMDD)
bpy.types.INFO_MT_file_import.remove(menu_func)

@ -96,10 +96,10 @@ def clientSendJob(conn, scene, anim = False):
job = netrender.model.RenderJob()
if anim:
for f in range(scene.start_frame, scene.end_frame + 1):
for f in range(scene.frame_start, scene.frame_end + 1):
job.addFrame(f)
else:
job.addFrame(scene.current_frame)
job.addFrame(scene.frame_current)
filename = bpy.data.filename
job.addFile(filename)
@ -228,7 +228,7 @@ class NetworkRenderEngine(bpy.types.RenderEngine):
self.update_stats("", "Network render waiting for results")
requestResult(conn, job_id, scene.current_frame)
requestResult(conn, job_id, scene.frame_current)
response = conn.getresponse()
if response.status == http.client.NO_CONTENT:
@ -236,12 +236,12 @@ class NetworkRenderEngine(bpy.types.RenderEngine):
netsettings.job_id = clientSendJob(conn, scene)
job_id = netsettings.job_id
requestResult(conn, job_id, scene.current_frame)
requestResult(conn, job_id, scene.frame_current)
response = conn.getresponse()
while response.status == http.client.ACCEPTED and not self.test_break():
time.sleep(1)
requestResult(conn, job_id, scene.current_frame)
requestResult(conn, job_id, scene.frame_current)
response = conn.getresponse()
# cancel new jobs (animate on network) on break

@ -81,7 +81,7 @@ def get_transform_generators_base_info(data):
path = ""
# data on ID-blocks directly should get grouped by the KeyingSet
grouping = None;
grouping = None
else:
# get the path to the ID-block
path = data.path_to_id()

@ -490,7 +490,7 @@ class Header(StructRNA, _GenericUI):
class Menu(StructRNA, _GenericUI):
__slots__ = ()
def path_menu(self, searchpaths, operator):
def path_menu(self, searchpaths, operator, props_default={}):
layout = self.layout
# hard coded to set the operators 'path' to the filename.
@ -511,7 +511,12 @@ class Menu(StructRNA, _GenericUI):
if f.startswith("."):
continue
layout.operator(operator, text=bpy.utils.display_name(f)).path = path
props = layout.operator(operator, text=bpy.utils.display_name(f))
for attr, value in props_default.items():
setattr(props, attr, value)
props.path = path
def draw_preset(self, context):
"""Define these on the subclass

@ -234,12 +234,12 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
bone_gen = obj.pose.bones[bone.name]
# Rotation mode and transform locks
bone_gen.rotation_mode = bone.rotation_mode
bone_gen.lock_rotation = tuple(bone.lock_rotation)
bone_gen.lock_rotation_w = bone.lock_rotation_w
bone_gen.rotation_mode = bone.rotation_mode
bone_gen.lock_rotation = tuple(bone.lock_rotation)
bone_gen.lock_rotation_w = bone.lock_rotation_w
bone_gen.lock_rotations_4d = bone.lock_rotations_4d
bone_gen.lock_location = tuple(bone.lock_location)
bone_gen.lock_scale = tuple(bone.lock_scale)
bone_gen.lock_location = tuple(bone.lock_location)
bone_gen.lock_scale = tuple(bone.lock_scale)
# Custom properties
for prop in bone.keys():

@ -241,8 +241,8 @@ def control(obj, definitions, base_names, options):
con.subtarget = target_ctrl
con.action = spread_action
con.transform_channel = 'SCALE_X'
con.start_frame = -20
con.end_frame = 20
con.frame_start = -20
con.frame_end = 20
con.minimum = 0.0
con.maximum = 2.0
con.target_space = 'LOCAL'

@ -433,8 +433,8 @@ def control(obj, definitions, base_names, options):
con.subtarget = upper_lid_ctrl
con.action = close_action
con.transform_channel = 'LOCATION_Y'
con.start_frame = -30
con.end_frame = 30
con.frame_start = -30
con.frame_end = 30
con.minimum = -distance*2
con.maximum = distance
con.target_space = 'LOCAL'
@ -452,8 +452,8 @@ def control(obj, definitions, base_names, options):
con.subtarget = upper_lid_ctrl
con.action = close_action
con.transform_channel = 'LOCATION_Y'
con.start_frame = -30
con.end_frame = 30
con.frame_start = -30
con.frame_end = 30
con.minimum = -distance*2
con.maximum = distance
con.target_space = 'LOCAL'
@ -470,8 +470,8 @@ def control(obj, definitions, base_names, options):
con.subtarget = upper_lid_ctrl
con.action = close_action
con.transform_channel = 'LOCATION_Y'
con.start_frame = -30
con.end_frame = 30
con.frame_start = -30
con.frame_end = 30
con.minimum = -distance*2
con.maximum = distance
con.target_space = 'LOCAL'
@ -488,8 +488,8 @@ def control(obj, definitions, base_names, options):
con.subtarget = upper_lid_ctrl
con.action = close_action
con.transform_channel = 'LOCATION_Y'
con.start_frame = -30
con.end_frame = 30
con.frame_start = -30
con.frame_end = 30
con.minimum = -distance*2
con.maximum = distance
con.target_space = 'LOCAL'
@ -506,8 +506,8 @@ def control(obj, definitions, base_names, options):
con.subtarget = upper_lid_ctrl
con.action = close_action
con.transform_channel = 'LOCATION_Y'
con.start_frame = -30
con.end_frame = 30
con.frame_start = -30
con.frame_end = 30
con.minimum = -distance*2
con.maximum = distance
con.target_space = 'LOCAL'
@ -525,8 +525,8 @@ def control(obj, definitions, base_names, options):
con.subtarget = lower_lid_ctrl
con.action = close_action
con.transform_channel = 'LOCATION_Y'
con.start_frame = -30
con.end_frame = 30
con.frame_start = -30
con.frame_end = 30
con.minimum = -distance
con.maximum = distance*2
con.target_space = 'LOCAL'
@ -543,8 +543,8 @@ def control(obj, definitions, base_names, options):
con.subtarget = lower_lid_ctrl
con.action = close_action
con.transform_channel = 'LOCATION_Y'
con.start_frame = -30
con.end_frame = 30
con.frame_start = -30
con.frame_end = 30
con.minimum = -distance
con.maximum = distance*2
con.target_space = 'LOCAL'
@ -561,8 +561,8 @@ def control(obj, definitions, base_names, options):
con.subtarget = lower_lid_ctrl
con.action = close_action
con.transform_channel = 'LOCATION_Y'
con.start_frame = -30
con.end_frame = 30
con.frame_start = -30
con.frame_end = 30
con.minimum = -distance
con.maximum = distance*2
con.target_space = 'LOCAL'
@ -579,8 +579,8 @@ def control(obj, definitions, base_names, options):
con.subtarget = lower_lid_ctrl
con.action = close_action
con.transform_channel = 'LOCATION_Y'
con.start_frame = -30
con.end_frame = 30
con.frame_start = -30
con.frame_end = 30
con.minimum = -distance
con.maximum = distance*2
con.target_space = 'LOCAL'
@ -597,8 +597,8 @@ def control(obj, definitions, base_names, options):
con.subtarget = lower_lid_ctrl
con.action = close_action
con.transform_channel = 'LOCATION_Y'
con.start_frame = -30
con.end_frame = 30
con.frame_start = -30
con.frame_end = 30
con.minimum = -distance
con.maximum = distance*2
con.target_space = 'LOCAL'

@ -543,8 +543,8 @@ def control(obj, definitions, base_names, options):
con.subtarget = jopent
con.action = open_action
con.transform_channel = 'SCALE_Y'
con.start_frame = 0
con.end_frame = 60
con.frame_start = 0
con.frame_end = 60
con.minimum = 0.0
con.maximum = 1.0
con.target_space = 'LOCAL'
@ -561,8 +561,8 @@ def control(obj, definitions, base_names, options):
con.subtarget = jopent
con.action = open_action
con.transform_channel = 'SCALE_Y'
con.start_frame = 0
con.end_frame = 60
con.frame_start = 0
con.frame_end = 60
con.minimum = 0.0
con.maximum = 1.0
con.target_space = 'LOCAL'
@ -579,8 +579,8 @@ def control(obj, definitions, base_names, options):
con.subtarget = jopent
con.action = open_action
con.transform_channel = 'SCALE_Y'
con.start_frame = 0
con.end_frame = 60
con.frame_start = 0
con.frame_end = 60
con.minimum = 0.0
con.maximum = 1.0
con.target_space = 'LOCAL'
@ -597,8 +597,8 @@ def control(obj, definitions, base_names, options):
con.subtarget = jopent
con.action = open_action
con.transform_channel = 'SCALE_Y'
con.start_frame = 0
con.end_frame = 60
con.frame_start = 0
con.frame_end = 60
con.minimum = 0.0
con.maximum = 1.0
con.target_space = 'LOCAL'
@ -615,8 +615,8 @@ def control(obj, definitions, base_names, options):
con.subtarget = jopent
con.action = open_action
con.transform_channel = 'SCALE_Y'
con.start_frame = 0
con.end_frame = 60
con.frame_start = 0
con.frame_end = 60
con.minimum = 0.0
con.maximum = 1.0
con.target_space = 'LOCAL'
@ -633,8 +633,8 @@ def control(obj, definitions, base_names, options):
con.subtarget = jopent
con.action = open_action
con.transform_channel = 'SCALE_Y'
con.start_frame = 0
con.end_frame = 60
con.frame_start = 0
con.frame_end = 60
con.minimum = 0.0
con.maximum = 1.0
con.target_space = 'LOCAL'
@ -651,8 +651,8 @@ def control(obj, definitions, base_names, options):
con.subtarget = jopent
con.action = open_action
con.transform_channel = 'SCALE_Y'
con.start_frame = 0
con.end_frame = 60
con.frame_start = 0
con.frame_end = 60
con.minimum = 0.0
con.maximum = 1.0
con.target_space = 'LOCAL'
@ -669,8 +669,8 @@ def control(obj, definitions, base_names, options):
con.subtarget = jopent
con.action = open_action
con.transform_channel = 'SCALE_Y'
con.start_frame = 0
con.end_frame = 60
con.frame_start = 0
con.frame_end = 60
con.minimum = 0.0
con.maximum = 1.0
con.target_space = 'LOCAL'

@ -41,12 +41,12 @@ RIG_TYPE = "stretch"
# pbone = obj.pose.bones['Bone']
# pbone['type'] = 'copy'
bool_map = {0:False, 1:True,
0.0:False, 1.0:True,
"false":False, "true":True,
"False":False, "True":True,
"no":False, "yes":True,
"No":False, "Yes":True}
bool_map = {0: False, 1: True,
0.0: False, 1.0: True,
"false": False, "true": True,
"False": False, "True": True,
"no": False, "yes": True,
"No": False, "Yes": True}
def metarig_definition(obj, orig_bone_name):

@ -154,9 +154,8 @@ class AddTorus(bpy.types.Operator):
return {'FINISHED'}
# Add to the menu
menu_func = (lambda self, context: self.layout.operator(AddTorus.bl_idname,
text="Torus", icon='MESH_DONUT'))
def menu_func(self, context):
self.layout.operator(AddTorus.bl_idname, text="Torus", icon='MESH_DONUT')
def register():

@ -21,6 +21,7 @@
import bpy
from bpy.props import StringProperty
class EditExternally(bpy.types.Operator):
'''Edit image in an external application'''
bl_idname = "image.external_edit"
@ -74,7 +75,7 @@ class EditExternally(bpy.types.Operator):
self.properties.path = path
self.execute(context)
return {'FINISHED'}
@ -181,7 +182,6 @@ class ProjectApply(bpy.types.Operator):
return {'FINISHED'}
classes = [
EditExternally,
SaveDirty,

205
release/scripts/op/nla.py Normal file

@ -0,0 +1,205 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
import bpy
def pose_info():
from Mathutils import Matrix
info = {}
obj = bpy.context.object
pose = obj.pose
pose_items = pose.bones.items()
for name, pbone in pose_items:
binfo = {}
bone = pbone.bone
binfo["parent"] = getattr(bone.parent, "name", None)
binfo["bone"] = bone
binfo["pbone"] = pbone
binfo["matrix_local"] = bone.matrix_local.copy()
try:
binfo["matrix_local_inv"] = binfo["matrix_local"].copy().invert()
except:
binfo["matrix_local_inv"] = Matrix()
binfo["matrix"] = bone.matrix.copy()
binfo["matrix_pose"] = pbone.matrix.copy()
try:
binfo["matrix_pose_inv"] = binfo["matrix_pose"].copy().invert()
except:
binfo["matrix_pose_inv"] = Matrix()
print(binfo["matrix_pose"])
info[name] = binfo
for name, pbone in pose_items:
binfo = info[name]
binfo_parent = binfo.get("parent", None)
if binfo_parent:
binfo_parent = info[binfo_parent]
matrix = binfo["matrix_pose"]
rest_matrix = binfo["matrix_local"]
if binfo_parent:
matrix = binfo_parent["matrix_pose_inv"] * matrix
rest_matrix = binfo_parent["matrix_local_inv"] * rest_matrix
matrix = rest_matrix.copy().invert() * matrix
binfo["matrix_key"] = matrix.copy()
return info
def bake(frame_start, frame_end, step=1, only_selected=False):
# import nla; reload(nla); nla.bake()
scene = bpy.context.scene
obj = bpy.context.object
pose = obj.pose
info_ls = []
frame_range = range(frame_start, frame_end + 1, step)
# could spped this up by applying steps here too...
for f in frame_range:
scene.set_frame(f)
info = pose_info()
info_ls.append(info)
f += 1
action = bpy.data.actions.new("Action")
bpy.context.object.animation_data.action = action
pose_items = pose.bones.items()
for name, pbone in pose_items:
if only_selected and not pbone.selected:
continue
for f in frame_range:
matrix = info_ls[int((f - frame_start) / step)][name]["matrix_key"]
#pbone.location = matrix.translation_part()
#pbone.rotation_quaternion = matrix.to_quat()
pbone.matrix_local = [f for v in matrix for f in v]
pbone.keyframe_insert("location", -1, f)
rotation_mode = pbone.rotation_mode
if rotation_mode == 'QUATERNION':
pbone.keyframe_insert("rotation_quaternion", -1, f)
elif rotation_mode == 'AXIS_ANGLE':
pbone.keyframe_insert("rotation_axis_angle", -1, f)
else: # euler, XYZ, ZXY etc
pbone.keyframe_insert("rotation_euler", -1, f)
pbone.keyframe_insert("scale", -1, f)
# assign groups, could become a more generic function
agrp_loc = action.groups.add("Location")
agrp_rot = action.groups.add("Rotation")
agrp_sca = action.groups.add("Scale")
for fcu in action.fcurves:
path = fcu.data_path.rsplit(".", 1)[-1]
if path.startswith("loc"):
fcu.group = agrp_loc
if path.startswith("rot"):
fcu.group = agrp_rot
if path.startswith("sca"):
fcu.group = agrp_sca
return action
from bpy.props import *
class BakeAction(bpy.types.Operator):
'''Add a torus mesh'''
bl_idname = "nla.bake"
bl_label = "Bake Action"
bl_options = {'REGISTER', 'UNDO'}
frame_start = IntProperty(name="Start Frame",
description="Start frame for baking",
default=1, min=1, max=300000)
frame_end = IntProperty(name="End Frame",
description="End frame for baking",
default=250, min=1, max=300000)
step = IntProperty(name="Frame Step",
description="Frame Step",
default=1, min=1, max=120)
only_selected = BoolProperty(name="Only Selected",
default=True)
def execute(self, context):
props = self.properties
action = bake(props.frame_start, props.frame_end, props.step, props.only_selected)
# basic cleanup, could move elsewhere
for fcu in action.fcurves:
keyframe_points = fcu.keyframe_points
i = 1
while i < len(fcu.keyframe_points) - 1:
val_prev = keyframe_points[i - 1].co[1]
val_next = keyframe_points[i + 1].co[1]
val = keyframe_points[i].co[1]
if abs(val - val_prev) + abs(val - val_next) < 0.0001:
keyframe_points.remove(keyframe_points[i])
else:
i += 1
return {'FINISHED'}
def invoke(self, context, event):
wm = context.manager
return wm.invoke_props_dialog(self)
#def menu_func(self, context):
# self.layout.operator(BakeAction.bl_idname, text="Bake Armature Action")
def register():
bpy.types.register(BakeAction)
# bpy.types.INFO_MT_mesh_add.append(menu_func)
def unregister():
bpy.types.unregister(BakeAction)
# bpy.types.INFO_MT_mesh_add.remove(menu_func)
if __name__ == "__main__":
register()

@ -89,11 +89,11 @@ class PlayRenderedAnim(bpy.types.Operator):
if is_movie == False and preset in ('FRAMECYCLER', 'RV', 'MPLAYER'):
# replace the number with '#'
file_a = rd.frame_path(frame=0)
# TODO, make an api call for this
frame_tmp = 9
file_b = rd.frame_path(frame=frame_tmp)
while len(file_a) == len(file_b):
frame_tmp = (frame_tmp * 10) + 9
print(frame_tmp)
@ -103,7 +103,7 @@ class PlayRenderedAnim(bpy.types.Operator):
file = ''.join([(c if file_b[i] == c else "#") for i, c in enumerate(file_a)])
else:
# works for movies and images
file = rd.frame_path(frame=scene.start_frame)
file = rd.frame_path(frame=scene.frame_start)
file = bpy.utils.expandpath(file) # expand '//'
@ -116,7 +116,7 @@ class PlayRenderedAnim(bpy.types.Operator):
opts = [file, "-playback_speed", str(rd.fps)]
cmd.extend(opts)
elif preset == 'FRAMECYCLER':
opts = [file, "%d-%d" % (scene.start_frame, scene.end_frame)]
opts = [file, "%d-%d" % (scene.frame_start, scene.frame_end)]
cmd.extend(opts)
elif preset == 'RV':
opts = ["-fps", str(rd.fps), "-play", "[ %s ]" % file]

@ -49,22 +49,22 @@ class SequencerCrossfadeSounds(bpy.types.Operator):
if seq2 == None:
self.report({'ERROR'}, "Select 2 sound strips.")
return {'CANCELLED'}
if seq1.start_frame_final > seq2.start_frame_final:
if seq1.frame_final_start > seq2.frame_final_start:
s = seq1
seq1 = seq2
seq2 = s
if seq1.end_frame_final > seq2.start_frame_final:
tempcfra = context.scene.current_frame
context.scene.current_frame = seq2.start_frame_final
if seq1.frame_final_end > seq2.frame_final_start:
tempcfra = context.scene.frame_current
context.scene.frame_current = seq2.frame_final_start
seq1.keyframe_insert('volume')
context.scene.current_frame = seq1.end_frame_final
context.scene.frame_current = seq1.frame_final_end
seq1.volume = 0
seq1.keyframe_insert('volume')
seq2.keyframe_insert('volume')
context.scene.current_frame = seq2.start_frame_final
context.scene.frame_current = seq2.frame_final_start
seq2.volume = 0
seq2.keyframe_insert('volume')
context.scene.current_frame = tempcfra
context.scene.frame_current = tempcfra
return {'FINISHED'}
else:
self.report({'ERROR'}, "The selected strips don't overlap.")

@ -49,8 +49,8 @@ class MotionPathButtonsPanel(bpy.types.Panel):
sub.prop(mps, "before_current", text="Before")
sub.prop(mps, "after_current", text="After")
elif (mps.type == 'RANGE'):
sub.prop(mps, "start_frame", text="Start")
sub.prop(mps, "end_frame", text="End")
sub.prop(mps, "frame_start", text="Start")
sub.prop(mps, "frame_end", text="End")
sub.prop(mps, "frame_step", text="Step")
if bones:
@ -88,8 +88,8 @@ class OnionSkinButtonsPanel(bpy.types.Panel):
sub = col.column(align=True)
if arm.ghost_type == 'RANGE':
sub.prop(arm, "ghost_start_frame", text="Start")
sub.prop(arm, "ghost_end_frame", text="End")
sub.prop(arm, "ghost_frame_start", text="Start")
sub.prop(arm, "ghost_frame_end", text="End")
sub.prop(arm, "ghost_size", text="Step")
elif arm.ghost_type == 'CURRENT_FRAME':
sub.prop(arm, "ghost_step", text="Range")

@ -186,8 +186,8 @@ class DATA_PT_ghost(DataButtonsPanel):
sub = col.column(align=True)
if arm.ghost_type == 'RANGE':
sub.prop(arm, "ghost_start_frame", text="Start")
sub.prop(arm, "ghost_end_frame", text="End")
sub.prop(arm, "ghost_frame_start", text="Start")
sub.prop(arm, "ghost_frame_end", text="End")
sub.prop(arm, "ghost_size", text="Step")
elif arm.ghost_type == 'CURRENT_FRAME':
sub.prop(arm, "ghost_step", text="Range")

@ -120,7 +120,6 @@ class DATA_PT_shape_curve(DataButtonsPanel):
if is_curve or is_text:
sub = col.column()
sub.active = (curve.dimensions == '2D')
sub.label(text="Caps:")
sub.prop(curve, "front")
sub.prop(curve, "back")

@ -368,7 +368,6 @@ class DATA_PT_modifiers(DataButtonsPanel):
sub = col.column()
sub.label(text="Object:")
sub.prop(md, "object", text="")
sub.prop(md, "mode", text="")
sub.active = not md.is_bound
if wide_ui:
col = split.column()
@ -386,15 +385,14 @@ class DATA_PT_modifiers(DataButtonsPanel):
else:
layout.operator("object.meshdeform_bind", text="Bind")
if md.mode == 'VOLUME':
split = layout.split()
split = layout.split()
col = split.column()
col.prop(md, "precision")
if wide_ui:
col = split.column()
col.prop(md, "precision")
if wide_ui:
col = split.column()
col.prop(md, "dynamic")
col.prop(md, "dynamic")
def MIRROR(self, layout, ob, md, wide_ui):
layout.prop(md, "merge_limit")
@ -499,14 +497,14 @@ class DATA_PT_modifiers(DataButtonsPanel):
def SCREW(self, layout, ob, md, wide_ui):
split = layout.split()
col = split.column()
col.prop(md, "axis")
col.prop(md, "object", text="AxisOb")
col.prop(md, "angle")
col.prop(md, "steps")
col.prop(md, "render_steps")
if wide_ui:
col = split.column()
row = col.row()
@ -518,7 +516,6 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.prop(md, "use_normal_calculate")
col.prop(md, "use_normal_flip")
col.prop(md, "iterations")
def SHRINKWRAP(self, layout, ob, md, wide_ui):
split = layout.split()
@ -625,11 +622,13 @@ class DATA_PT_modifiers(DataButtonsPanel):
layout.label(text="See Soft Body panel.")
def SOLIDIFY(self, layout, ob, md, wide_ui):
layout.prop(md, "offset")
split = layout.split()
col = split.column()
col.prop(md, "thickness")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
col.label(text="Crease:")
col.prop(md, "edge_crease_inner", text="Inner")
col.prop(md, "edge_crease_outer", text="Outer")
@ -637,7 +636,15 @@ class DATA_PT_modifiers(DataButtonsPanel):
if wide_ui:
col = split.column()
col.label()
col.prop(md, "offset")
colsub = col.column()
colsub.active = (md.vertex_group is not "")
colsub.prop(md, "invert", text="Invert")
if wide_ui:
col.label(text="")
col.prop(md, "use_rim")
col.prop(md, "use_even_offset")
col.prop(md, "use_quality_normals")
@ -661,6 +668,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
if wide_ui:
col = split.column()
col.label(text="Options:")
col.prop(md, "subsurf_uv")
col.prop(md, "optimal_display")
def SURFACE(self, layout, ob, md, wide_ui):
@ -689,9 +697,12 @@ class DATA_PT_modifiers(DataButtonsPanel):
if wide_ui:
col = split.column()
sub = col.column(align=True)
sub.label(text="Aspect Ratio:")
sub.prop(md, "horizontal_aspect_ratio", text="Horizontal")
sub.prop(md, "vertical_aspect_ratio", text="Vertical")
sub.prop(md, "aspect_x", text="Aspect X")
sub.prop(md, "aspect_y", text="Aspect Y")
sub = col.column(align=True)
sub.prop(md, "scale_x", text="Scale X")
sub.prop(md, "scale_y", text="Scale Y")
def WAVE(self, layout, ob, md, wide_ui):
split = layout.split()

@ -35,12 +35,15 @@ class OBJECT_PT_context_object(ObjectButtonsPanel):
def draw(self, context):
layout = self.layout
space = context.space_data
ob = context.object
row = layout.row()
row.label(text="", icon='OBJECT_DATA')
row.prop(ob, "name", text="")
if space.use_pin_id:
row.template_ID(space, "pin_id")
else:
row.prop(ob, "name", text="")
class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel):
@ -269,6 +272,8 @@ class OBJECT_PT_duplication(ObjectButtonsPanel):
layout.prop(ob, "dupli_group", text="")
# XXX: the following options are all quite buggy, ancient hacks that should be dropped
class OBJECT_PT_animation(ObjectButtonsPanel):
bl_label = "Animation Hacks"
bl_default_closed = True
@ -294,7 +299,7 @@ class OBJECT_PT_animation(ObjectButtonsPanel):
row.prop(ob, "slow_parent")
row.active = (ob.parent is not None)
col.prop(ob, "time_offset", text="Offset")
# XXX: these are still used for a few curve-related tracking features
if wide_ui:
col = split.column()

@ -496,8 +496,8 @@ class ConstraintButtonsPanel(bpy.types.Panel):
col = split.column(align=True)
col.label(text="Action Length:")
col.prop(con, "start_frame", text="Start")
col.prop(con, "end_frame", text="End")
col.prop(con, "frame_start", text="Start")
col.prop(con, "frame_end", text="End")
if wide_ui:
col = split.column(align=True)

@ -395,6 +395,43 @@ class PARTICLE_PT_physics(ParticleButtonsPanel):
sub.prop(part, "integrator")
sub.prop(part, "time_tweak")
elif part.physics_type == 'FLUID':
fluid = part.fluid
split = layout.split()
sub = split.column()
sub.label(text="Forces:")
sub.prop(part, "brownian_factor")
sub.prop(part, "drag_factor", slider=True)
sub.prop(part, "damp_factor", slider=True)
sub = split.column()
sub.prop(part, "size_deflect")
sub.prop(part, "die_on_collision")
sub.prop(part, "integrator")
sub.prop(part, "time_tweak")
split = layout.split()
sub = split.column()
sub.label(text="Fluid Interaction:")
sub.prop(fluid, "fluid_radius", slider=True)
sub.prop(fluid, "stiffness_k")
sub.prop(fluid, "stiffness_knear")
sub.prop(fluid, "rest_density")
sub.label(text="Viscosity:")
sub.prop(fluid, "viscosity_omega", text="Linear")
sub.prop(fluid, "viscosity_beta", text="Square")
sub = split.column()
sub.label(text="Springs:")
sub.prop(fluid, "spring_k", text="Force", slider=True)
sub.prop(fluid, "rest_length", slider=True)
layout.label(text="Multiple fluids interactions:")
sub.label(text="Buoyancy:")
sub.prop(fluid, "buoyancy", slider=True)
elif part.physics_type == 'KEYED':
split = layout.split()
sub = split.column()
@ -454,7 +491,7 @@ class PARTICLE_PT_physics(ParticleButtonsPanel):
col.prop(boids, "banking", slider=True)
col.prop(boids, "height", slider=True)
if part.physics_type == 'KEYED' or part.physics_type == 'BOIDS':
if part.physics_type == 'KEYED' or part.physics_type == 'BOIDS' or part.physics_type == 'FLUID':
if part.physics_type == 'BOIDS':
layout.label(text="Relations:")
@ -484,7 +521,7 @@ class PARTICLE_PT_physics(ParticleButtonsPanel):
col.active = psys.keyed_timing
col.prop(key, "time")
col.prop(key, "duration")
else:
elif part.physics_type == 'BOIDS':
sub = row.row()
#doesn't work yet
#sub.red_alert = key.valid
@ -492,6 +529,12 @@ class PARTICLE_PT_physics(ParticleButtonsPanel):
sub.prop(key, "system", text="System")
layout.prop(key, "mode", expand=True)
elif part.physics_type == 'FLUID':
sub = row.row()
#doesn't work yet
#sub.red_alert = key.valid
sub.prop(key, "object", text="")
sub.prop(key, "system", text="System")
class PARTICLE_PT_boidbrain(ParticleButtonsPanel):

@ -129,6 +129,12 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel):
col.prop(cloth, "goal_friction", text="Friction")
"""
key = ob.data.shape_keys
if key:
col.label(text="Rest Shape Key:")
col.prop_object(cloth, "rest_shape_key", key, "keys", text="")
class PHYSICS_PT_cloth_cache(PhysicButtonsPanel):
bl_label = "Cloth Cache"
@ -181,6 +187,7 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel):
layout.prop(cloth, "group")
class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel):
bl_label = "Cloth Stiffness Scaling"
bl_default_closed = True

@ -53,8 +53,8 @@ def point_cache_ui(self, context, cache, enabled, particles, smoke):
if not particles:
row = layout.row()
row.enabled = enabled
row.prop(cache, "start_frame")
row.prop(cache, "end_frame")
row.prop(cache, "frame_start")
row.prop(cache, "frame_end")
row = layout.row()

@ -53,7 +53,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
row = split.row(align=True)
row.prop(md, "render", text="")
row.prop(md, "realtime", text="")
fluid = md.settings
else:
@ -75,11 +75,11 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
layout.prop(fluid, "type", text="")
if fluid.type not in ('NONE', 'DOMAIN', 'PARTICLE'):
layout.prop(fluid, "active", text="")
layout = layout.column()
if fluid.type not in ('NONE', 'DOMAIN', 'PARTICLE'):
layout.active = fluid.active
if fluid.type == 'DOMAIN':
layout.operator("fluid.bake", text="Bake Fluid Simulation", icon='MOD_FLUIDSIM')
split = layout.split()
@ -243,7 +243,7 @@ class PHYSICS_PT_domain_gravity(PhysicButtonsPanel):
else:
col.label(text="Gravity:")
col.prop(fluid, "gravity", text="")
if scene.unit_settings.system != 'NONE':
col.label(text="Using Scene Size Units", icon="SCENE_DATA")
sub = col.column()

@ -566,8 +566,8 @@ class RENDER_PT_dimensions(RenderButtonsPanel):
col = split.column()
sub = col.column(align=True)
sub.label(text="Frame Range:")
sub.prop(scene, "start_frame", text="Start")
sub.prop(scene, "end_frame", text="End")
sub.prop(scene, "frame_start", text="Start")
sub.prop(scene, "frame_end", text="End")
sub.prop(scene, "frame_step", text="Step")
sub.label(text="Frame Rate:")

@ -89,6 +89,7 @@ class SCENE_PT_keying_sets(SceneButtonsPanel):
row = layout.row()
col = row.column()
# XXX: this fails because index is not what this expects...
col.template_list(scene, "keying_sets", scene, "active_keying_set_index", rows=2)
col = row.column(align=True)
@ -96,7 +97,7 @@ class SCENE_PT_keying_sets(SceneButtonsPanel):
col.operator("anim.keying_set_remove", icon='ZOOMOUT', text="")
ks = scene.active_keying_set
if ks:
if ks and ks.absolute:
row = layout.row()
col = row.column()
@ -119,7 +120,7 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel):
bl_label = "Active Keying Set"
def poll(self, context):
return (context.scene.active_keying_set and context.scene.active_keying_set.absolute);
return (context.scene.active_keying_set and context.scene.active_keying_set.absolute)
def draw(self, context):
layout = self.layout
@ -162,7 +163,7 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel):
col.prop(ksp, "grouping")
if ksp.grouping == 'NAMED':
col.prop(ksp, "group")
col.label(text="Keyframing Settings:")
col.prop(ksp, "insertkey_needed", text="Needed")
col.prop(ksp, "insertkey_visual", text="Visual")
@ -310,8 +311,10 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
f.write("%s, '%s'" % (id_bpy_path, ksp.data_path))
# array index settings (if applicable)
if ksp.entire_array is False:
f.write(", entire_array=False, array_index=%d" % ksp.array_index)
if ksp.entire_array:
f.write(", index=-1")
else:
f.write(", index=%d" % ksp.array_index)
# grouping settings (if applicable)
# NOTE: the current default is KEYINGSET, but if this changes, change this code too

@ -29,8 +29,8 @@ class TEXTURE_MT_specials(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.operator("material.mtex_copy", icon='COPYDOWN')
layout.operator("material.mtex_paste", icon='PASTEDOWN')
layout.operator("texture.slot_copy", icon='COPYDOWN')
layout.operator("texture.slot_paste", icon='PASTEDOWN')
class TEXTURE_MT_envmap_specials(bpy.types.Menu):

@ -38,7 +38,7 @@ class Buttons_HT_header(bpy.types.Header):
row = layout.row()
row.prop(so, "buttons_context", expand=True, text="")
row.prop(scene, "current_frame")
row.prop(scene, "frame_current")
class Buttons_MT_view(bpy.types.Menu):

@ -252,7 +252,7 @@ class IMAGE_HT_header(bpy.types.Header):
iuser = sima.image_user
toolsettings = context.tool_settings
# show_render = sima.show_render
show_render = sima.show_render
# show_paint = sima.show_paint
show_uvedit = sima.show_uvedit
@ -276,6 +276,8 @@ class IMAGE_HT_header(bpy.types.Header):
sub.menu("IMAGE_MT_uvs")
layout.template_ID(sima, "image", new="image.new")
if not show_render:
layout.prop(sima, "image_pin", text="")
# uv editing
if show_uvedit:
@ -406,6 +408,7 @@ class IMAGE_PT_view_histogram(bpy.types.Panel):
layout.template_histogram(sima, "histogram")
class IMAGE_PT_sample_line(bpy.types.Panel):
bl_space_type = 'IMAGE_EDITOR'
bl_region_type = 'PREVIEW'
@ -421,6 +424,7 @@ class IMAGE_PT_sample_line(bpy.types.Panel):
sima = context.space_data
layout.template_histogram(sima, "sample_histogram")
class IMAGE_PT_view_properties(bpy.types.Panel):
bl_space_type = 'IMAGE_EDITOR'
bl_region_type = 'UI'
@ -458,6 +462,9 @@ class IMAGE_PT_view_properties(bpy.types.Panel):
if show_uvedit:
col = layout.column()
col.prop(uvedit, "cursor_location")
col = layout.column()
col.label(text="UVs:")
row = col.row()

@ -241,7 +241,7 @@ class INFO_MT_add(bpy.types.Menu):
if(len(bpy.data.groups) > 10):
layout.operator_context = 'INVOKE_DEFAULT'
layout.operator("object.group_instance_add", "type", text="Group Instance...", icon='OUTLINER_OB_EMPTY')
layout.operator("object.group_instance_add", text="Group Instance...", icon='OUTLINER_OB_EMPTY')
else:
layout.operator_menu_enum("object.group_instance_add", "type", text="Group Instance", icon='OUTLINER_OB_EMPTY')
@ -309,6 +309,8 @@ class INFO_MT_help(bpy.types.Menu):
layout.separator()
layout.operator("help.python_api", icon='URL')
layout.operator("help.operator_cheat_sheet")
layout.separator()
layout.operator("wm.splash")
# Help operators

@ -245,21 +245,24 @@ class SEQUENCER_MT_strip(bpy.types.Menu):
if strip:
stype = strip.type
if stype == 'EFFECT':
layout.separator()
layout.operator("sequencer.effect_change")
layout.operator("sequencer.effect_reassign_inputs")
# XXX note strip.type is never equal to 'EFFECT', look at seq_type_items within rna_sequencer.c
if stype == 'EFFECT':
pass
# layout.separator()
# layout.operator("sequencer.effect_change")
# layout.operator("sequencer.effect_reassign_inputs")
elif stype == 'IMAGE':
layout.separator()
# layout.operator("sequencer.image_change")
layout.operator("sequencer.rendersize")
elif stype == 'SCENE':
layout.separator()
layout.operator("sequencer.scene_change", text="Change Scene")
pass
# layout.separator()
# layout.operator("sequencer.scene_change", text="Change Scene")
elif stype == 'MOVIE':
layout.separator()
layout.operator("sequencer.movie_change")
# layout.operator("sequencer.movie_change")
layout.operator("sequencer.rendersize")
layout.separator()
@ -347,20 +350,20 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel):
col = layout.column()
col.enabled = not strip.lock
col.prop(strip, "channel")
col.prop(strip, "start_frame")
col.prop(strip, "frame_start")
subrow = col.split(percentage=0.66)
subrow.prop(strip, "length")
subrow.label(text="%.2f sec" % (strip.length / (render.fps / render.fps_base)))
col = layout.column(align=True)
col.label(text="Offset:")
col.prop(strip, "start_offset", text="Start")
col.prop(strip, "end_offset", text="End")
col.prop(strip, "frame_offset_start", text="Start")
col.prop(strip, "frame_offset_end", text="End")
col = layout.column(align=True)
col.label(text="Still:")
col.prop(strip, "start_still", text="Start")
col.prop(strip, "end_still", text="End")
col.prop(strip, "frame_still_start", text="Start")
col.prop(strip, "frame_still_end", text="End")
class SEQUENCER_PT_preview(bpy.types.Panel):
@ -377,7 +380,7 @@ class SEQUENCER_PT_preview(bpy.types.Panel):
col = layout.column()
col.active = render.use_sequencer_gl_preview
col.prop(render, "sequencer_gl_preview", text="")
col = layout.column()
col.prop(render, "use_sequencer_gl_render", text="Open GL Render")
col = layout.column()
@ -579,7 +582,7 @@ class SEQUENCER_PT_input_image(SEQUENCER_PT_input):
# Current element for the filename
elem = strip.getStripElem(context.scene.current_frame)
elem = strip.getStripElem(context.scene.frame_current)
if elem:
split = layout.split(percentage=0.2)
col = split.column()

@ -177,7 +177,7 @@ class TEXT_MT_templates(bpy.types.Menu):
bl_label = "Script Templates"
def draw(self, context):
self.path_menu(bpy.utils.script_paths("templates"), "text.open")
self.path_menu(bpy.utils.script_paths("templates"), "text.open", {"internal": True})
class TEXT_MT_edit_view(bpy.types.Menu):

@ -43,13 +43,13 @@ class TIME_HT_header(bpy.types.Header):
row = layout.row(align=True)
if not scene.use_preview_range:
row.prop(scene, "start_frame", text="Start")
row.prop(scene, "end_frame", text="End")
row.prop(scene, "frame_start", text="Start")
row.prop(scene, "frame_end", text="End")
else:
row.prop(scene, "preview_range_start_frame", text="Start")
row.prop(scene, "preview_range_end_frame", text="End")
row.prop(scene, "preview_range_frame_start", text="Start")
row.prop(scene, "preview_range_frame_end", text="End")
layout.prop(scene, "current_frame", text="")
layout.prop(scene, "frame_current", text="")
layout.separator()

@ -165,16 +165,18 @@ class USERPREF_HT_header(bpy.types.Header):
layout.operator_context = 'EXEC_AREA'
layout.operator("wm.save_homefile", text="Save As Default")
layout.operator_context = 'INVOKE_DEFAULT'
if userpref.active_section == 'INPUT':
layout.operator_context = 'INVOKE_DEFAULT'
op = layout.operator("wm.keyconfig_export", "Export Key Configuration...")
op = layout.operator("wm.keyconfig_export")
op.path = "keymap.py"
op = layout.operator("wm.keyconfig_import", "Import Key Configuration...")
op = layout.operator("wm.keyconfig_import")
op.path = "keymap.py"
elif userpref.active_section == 'ADDONS':
layout.operator_context = 'INVOKE_DEFAULT'
op = layout.operator("wm.addon_install", "Install Add-On...")
op = layout.operator("wm.addon_install")
op.path = "*.py"
elif userpref.active_section == 'THEMES':
op = layout.operator("ui.reset_default_theme")
class USERPREF_PT_tabs(bpy.types.Panel):
@ -376,7 +378,8 @@ class USERPREF_PT_edit(bpy.types.Panel):
col.separator()
col.label(text="New F-Curve Defaults:")
col.prop(edit, "new_interpolation_type", text="Interpolation")
col.prop(edit, "keyframe_new_interpolation_type", text="Interpolation")
col.prop(edit, "keyframe_new_handle_type", text="Handles")
col.prop(edit, "insertkey_xyz_to_rgb", text="XYZ to RGB")
col.separator()
@ -712,14 +715,24 @@ class USERPREF_PT_theme(bpy.types.Panel):
col.prop(graph, "active_channels_group")
col.prop(graph, "dopesheet_channel")
col.prop(graph, "dopesheet_subchannel")
col.prop(graph, "vertex")
col.prop(graph, "frame_current")
col = split.column()
col.prop(graph, "current_frame")
col.prop(graph, "vertex")
col.prop(graph, "handle_vertex")
col.prop(graph, "handle_vertex_select")
col.separator()
col.prop(graph, "handle_vertex_size")
col.separator()
col.separator()
col.prop(graph, "handle_free")
col.prop(graph, "handle_auto")
col.prop(graph, "handle_vect")
col.prop(graph, "handle_align")
col.prop(graph, "handle_sel_free")
col.prop(graph, "handle_sel_auto")
col.prop(graph, "handle_sel_vect")
col.prop(graph, "handle_sel_align")
elif theme.theme_area == 'FILE_BROWSER':
file_browse = theme.file_browser
@ -762,7 +775,7 @@ class USERPREF_PT_theme(bpy.types.Panel):
col = split.column()
col.prop(nla, "strips")
col.prop(nla, "strips_selected")
col.prop(nla, "current_frame")
col.prop(nla, "frame_current")
elif theme.theme_area == 'DOPESHEET_EDITOR':
dope = theme.dopesheet_editor
@ -785,7 +798,7 @@ class USERPREF_PT_theme(bpy.types.Panel):
col.prop(dope, "long_key_selected")
col = split.column()
col.prop(dope, "current_frame")
col.prop(dope, "frame_current")
col.prop(dope, "dopesheet_channel")
col.prop(dope, "dopesheet_subchannel")
@ -832,7 +845,7 @@ class USERPREF_PT_theme(bpy.types.Panel):
col = split.column()
col.prop(seq, "meta_strip")
col.prop(seq, "current_frame")
col.prop(seq, "frame_current")
col.prop(seq, "keyframe")
col.prop(seq, "draw_action")
@ -891,7 +904,7 @@ class USERPREF_PT_theme(bpy.types.Panel):
col.prop(time, "grid")
col = split.column()
col.prop(time, "current_frame")
col.prop(time, "frame_current")
elif theme.theme_area == 'NODE_EDITOR':
node = theme.node_editor
@ -1285,8 +1298,8 @@ class USERPREF_PT_input(bpy.types.Panel):
sub.row().prop(inputs, "view_rotation", expand=True)
sub.label(text="Zoom Style:")
sub.row().prop(inputs, "viewport_zoom_style", expand=True)
if inputs.viewport_zoom_style == 'DOLLY':
sub.row().prop(inputs, "zoom_style", text="")
if inputs.zoom_style == 'DOLLY':
sub.row().prop(inputs, "zoom_axis", expand=True)
sub.prop(inputs, "invert_zoom_direction")
@ -1299,11 +1312,12 @@ class USERPREF_PT_input(bpy.types.Panel):
#sub.prop(view, "wheel_scroll_lines", text="Scroll Lines")
col.separator()
''' not implemented yet
sub = col.column()
sub.label(text="NDOF Device:")
sub.prop(inputs, "ndof_pan_speed", text="Pan Speed")
sub.prop(inputs, "ndof_rotate_speed", text="Orbit Speed")
'''
row.separator()
@ -1488,6 +1502,10 @@ class USERPREF_PT_addons(bpy.types.Panel):
split = column.row().split(percentage=0.15)
split.label(text='Location:')
split.label(text=info["location"])
if info["description"]:
split = column.row().split(percentage=0.15)
split.label(text='Description:')
split.label(text=info["description"])
if info["url"]:
split = column.row().split(percentage=0.15)
split.label(text="Internet:")
@ -1517,7 +1535,7 @@ class USERPREF_PT_addons(bpy.types.Panel):
from bpy.props import *
def addon_info_get(mod, info_basis={"name": "", "author": "", "version": "", "blender": "", "location": "", "url": "", "category": "", "expanded": False}):
def addon_info_get(mod, info_basis={"name": "", "author": "", "version": "", "blender": "", "location": "", "description": "", "url": "", "category": "", "expanded": False}):
addon_info = getattr(mod, "bl_addon_info", {})
# avoid re-initializing
@ -1600,7 +1618,7 @@ class WM_OT_addon_disable(bpy.types.Operator):
class WM_OT_addon_install(bpy.types.Operator):
"Install an addon"
bl_idname = "wm.addon_install"
bl_label = "Install Add-On"
bl_label = "Install Add-On..."
module = StringProperty(name="Module", description="Module name of the addon to disable")
@ -1705,9 +1723,9 @@ class WM_OT_keyconfig_test(bpy.types.Operator):
def kmistr(kmi):
if km.modal:
s = ["kmi = km.add_modal_item(\'%s\', \'%s\', \'%s\'" % (kmi.propvalue, kmi.type, kmi.value)]
s = ["kmi = km.items.add_modal(\'%s\', \'%s\', \'%s\'" % (kmi.propvalue, kmi.type, kmi.value)]
else:
s = ["kmi = km.add_item(\'%s\', \'%s\', \'%s\'" % (kmi.idname, kmi.type, kmi.value)]
s = ["kmi = km.items.add(\'%s\', \'%s\', \'%s\'" % (kmi.idname, kmi.type, kmi.value)]
if kmi.any:
s.append(", any=True")
@ -1913,9 +1931,9 @@ class WM_OT_keyconfig_export(bpy.types.Operator):
f.write("km = kc.add_keymap('%s', space_type='%s', region_type='%s', modal=%s)\n\n" % (km.name, km.space_type, km.region_type, km.modal))
for kmi in km.items:
if km.modal:
f.write("kmi = km.add_modal_item('%s', '%s', '%s'" % (kmi.propvalue, kmi.type, kmi.value))
f.write("kmi = km.items.add_modal('%s', '%s', '%s'" % (kmi.propvalue, kmi.type, kmi.value))
else:
f.write("kmi = km.add_item('%s', '%s', '%s'" % (kmi.idname, kmi.type, kmi.value))
f.write("kmi = km.items.add('%s', '%s', '%s'" % (kmi.idname, kmi.type, kmi.value))
if kmi.any:
f.write(", any=True")
else:
@ -2019,9 +2037,9 @@ class WM_OT_keyitem_add(bpy.types.Operator):
kc = wm.default_keyconfig
if km.modal:
km.add_modal_item("", 'A', 'PRESS') # kmi
km.items.add_modal("", 'A', 'PRESS') # kmi
else:
km.add_item("none", 'A', 'PRESS') # kmi
km.items.add("none", 'A', 'PRESS') # kmi
# clear filter and expand keymap so we can see the newly added item
if kc.filter != '':

@ -250,8 +250,11 @@ class VIEW3D_MT_view(bpy.types.Menu):
layout.operator("view3d.viewnumpad", text="Camera").type = 'CAMERA'
layout.operator("view3d.viewnumpad", text="Top").type = 'TOP'
layout.operator("view3d.viewnumpad", text="Bottom").type = 'BOTTOM'
layout.operator("view3d.viewnumpad", text="Front").type = 'FRONT'
layout.operator("view3d.viewnumpad", text="Back").type = 'BACK'
layout.operator("view3d.viewnumpad", text="Right").type = 'RIGHT'
layout.operator("view3d.viewnumpad", text="Left").type = 'LEFT'
layout.menu("VIEW3D_MT_view_cameras", text="Cameras")
@ -1919,12 +1922,12 @@ class VIEW3D_PT_3dview_display(bpy.types.Panel):
col.active = display_all
split = col.split(percentage=0.55)
split.prop(view, "display_floor", text="Grid Floor")
row = split.row(align=True)
row.prop(view, "display_x_axis", text="X", toggle=True)
row.prop(view, "display_y_axis", text="Y", toggle=True)
row.prop(view, "display_z_axis", text="Z", toggle=True)
sub = col.column(align=True)
sub.active = (display_all and view.display_floor)
sub.prop(view, "grid_lines", text="Lines")

@ -606,7 +606,7 @@ class VIEW3D_PT_tools_brush(PaintPanel):
col = layout.column()
col.active = (brush.blend not in ('ERASE_ALPHA', 'ADD_ALPHA'))
col.prop(brush, "use_alpha")
# Weight Paint Mode #

@ -232,8 +232,8 @@ void blf_font_buffer(FontBLF *font, char *str)
yb= g->pitch < 0 ? 0 : g->height-1;
if (font->b_fbuf) {
for (y= 0; y < height_clip; y++) {
for (x= 0; x < width_clip; x++) {
for (y=(chy >= 0 ? 0:-chy); y < height_clip; y++) {
for (x=(chx >= 0 ? 0:-chx); x < width_clip; x++) {
a= *(g->bitmap + x + (yb * g->pitch)) / 255.0f;

@ -105,6 +105,9 @@ struct bActionGroup *get_active_actiongroup(struct bAction *act);
/* Make the given Action Group the active one */
void set_active_action_group(struct bAction *act, struct bActionGroup *agrp, short select);
/* Add a new action group with the given name to the action */
struct bActionGroup *action_groups_add_new(struct bAction *act, const char name[]);
/* Add given channel into (active) group */
void action_groups_add_channel(struct bAction *act, struct bActionGroup *agrp, struct FCurve *fcurve);

@ -45,7 +45,7 @@ struct Scene;
struct Main;
#define BLENDER_VERSION 252
#define BLENDER_SUBVERSION 2
#define BLENDER_SUBVERSION 4
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0

@ -126,6 +126,7 @@ typedef struct ClothVertex
float mass; /* mass / weight of the vertex */
float goal; /* goal, from SB */
float impulse[3]; /* used in collision.c */
float *xrest; /* temporary valid for building springs */
unsigned int impulse_count; /* same as above */
float avg_spring_len; /* average length of connected springs */
float struct_stiff;
@ -240,6 +241,7 @@ void cloth_init ( ClothModifierData *clmd );
DerivedMesh *clothModifier_do ( ClothModifierData *clmd, struct Scene *scene, Object *ob, DerivedMesh *dm, int useRenderParams, int isFinalCalc );
void cloth_update_normals ( ClothVertex *verts, int nVerts, MFace *face, int totface );
int cloth_uses_vgroup(ClothModifierData *clmd);
// needed for collision.c
void bvhtree_update_from_cloth ( ClothModifierData *clmd, int moving );

@ -53,7 +53,7 @@ int id_unlink(struct ID *id, int test);
int new_id(struct ListBase *lb, struct ID *id, const char *name);
struct ListBase *wich_libbase(struct Main *mainlib, short type);
struct ListBase *which_libbase(struct Main *mainlib, short type);
#define MAX_LIBARRAY 40
int set_listbasepointers(struct Main *main, struct ListBase **lb);

@ -77,6 +77,8 @@ void BKE_nlatrack_sort_strips(struct NlaTrack *nlt);
short BKE_nlatrack_add_strip(struct NlaTrack *nlt, struct NlaStrip *strip);
short BKE_nlatrack_get_bounds(struct NlaTrack *nlt, float bounds[2]);
/* ............ */
struct NlaStrip *BKE_nlastrip_find_active(struct NlaTrack *nlt);

@ -236,7 +236,7 @@ void BKE_ptcache_id_from_cloth(PTCacheID *pid, struct Object *ob, struct ClothMo
void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct Object *ob, struct SmokeModifierData *smd);
void BKE_ptcache_id_from_smoke_turbulence(PTCacheID *pid, struct Object *ob, struct SmokeModifierData *smd);
void BKE_ptcache_ids_from_object(struct ListBase *lb, struct Object *ob);
void BKE_ptcache_ids_from_object(struct ListBase *lb, struct Object *ob, struct Scene *scene, int duplis);
/***************** Global funcs ****************************/
void BKE_ptcache_remove(void);

@ -47,9 +47,8 @@ struct Main;
#define SCE_COPY_LINK_DATA 2
#define SCE_COPY_FULL 3
/* note; doesn't work when scene is empty */
#define SETLOOPER(s, b) sce= s, b= (Base*)sce->base.first; b; b= (Base*)(b->next?b->next:sce->set?(sce=sce->set)->base.first:NULL)
#define SETLOOPER(s, b) sce= s, b= _setlooper_base_step(&sce, NULL); b; b= _setlooper_base_step(&sce, b)
struct Base *_setlooper_base_step(struct Scene **sce, struct Base *base);
void free_avicodecdata(struct AviCodecData *acd);
void free_qtcodecdata(struct QuicktimeCodecData *acd);

@ -36,6 +36,7 @@
#include "MEM_guardedalloc.h"
#include "DNA_cloth_types.h"
#include "DNA_key_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
@ -49,6 +50,7 @@
#include "BKE_cdderivedmesh.h"
#include "BKE_displist.h"
#include "BKE_key.h"
#include "BKE_modifier.h"
#include "BKE_mesh.h"
#include "BKE_object.h"
@ -1450,55 +1452,88 @@ static float *get_editmesh_orco_verts(EditMesh *em)
/* orco custom data layer */
static DerivedMesh *create_orco_dm(Object *ob, Mesh *me, EditMesh *em)
static void *get_orco_coords_dm(Object *ob, EditMesh *em, int layer, int *free)
{
*free= 0;
if(layer == CD_ORCO) {
/* get original coordinates */
*free= 1;
if(em)
return (float(*)[3])get_editmesh_orco_verts(em);
else
return (float(*)[3])get_mesh_orco_verts(ob);
}
else if(layer == CD_CLOTH_ORCO) {
/* apply shape key for cloth, this should really be solved
by a more flexible customdata system, but not simple */
if(!em) {
ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth);
KeyBlock *kb= key_get_keyblock(ob_get_key(ob), clmd->sim_parms->shapekey_rest);
if(kb->data)
return kb->data;
}
return NULL;
}
return NULL;
}
static DerivedMesh *create_orco_dm(Object *ob, Mesh *me, EditMesh *em, int layer)
{
DerivedMesh *dm;
float (*orco)[3];
int free;
if(em) {
dm= CDDM_from_editmesh(em, me);
orco= (float(*)[3])get_editmesh_orco_verts(em);
}
else {
dm= CDDM_from_mesh(me, ob);
orco= (float(*)[3])get_mesh_orco_verts(ob);
if(em) dm= CDDM_from_editmesh(em, me);
else dm= CDDM_from_mesh(me, ob);
orco= get_orco_coords_dm(ob, em, layer, &free);
if(orco) {
CDDM_apply_vert_coords(dm, orco);
if(free) MEM_freeN(orco);
}
CDDM_apply_vert_coords(dm, orco);
CDDM_calc_normals(dm);
MEM_freeN(orco);
return dm;
}
static void add_orco_dm(Object *ob, EditMesh *em, DerivedMesh *dm, DerivedMesh *orcodm)
static void add_orco_dm(Object *ob, EditMesh *em, DerivedMesh *dm, DerivedMesh *orcodm, int layer)
{
float (*orco)[3], (*layerorco)[3];
int totvert;
int totvert, free;
totvert= dm->getNumVerts(dm);
if(orcodm) {
orco= MEM_callocN(sizeof(float)*3*totvert, "dm orco");
free= 1;
if(orcodm->getNumVerts(orcodm) == totvert)
orcodm->getVertCos(orcodm, orco);
else
dm->getVertCos(dm, orco);
}
else {
if(em) orco= (float(*)[3])get_editmesh_orco_verts(em);
else orco= (float(*)[3])get_mesh_orco_verts(ob);
}
transform_mesh_orco_verts(ob->data, orco, totvert, 0);
if((layerorco = DM_get_vert_data_layer(dm, CD_ORCO))) {
memcpy(layerorco, orco, sizeof(float)*totvert);
MEM_freeN(orco);
}
else
DM_add_vert_layer(dm, CD_ORCO, CD_ASSIGN, orco);
orco= get_orco_coords_dm(ob, em, layer, &free);
if(orco) {
if(layer == CD_ORCO)
transform_mesh_orco_verts(ob->data, orco, totvert, 0);
if(!(layerorco = DM_get_vert_data_layer(dm, layer))) {
DM_add_vert_layer(dm, layer, CD_CALLOC, NULL);
layerorco = DM_get_vert_data_layer(dm, layer);
}
memcpy(layerorco, orco, sizeof(float)*3*totvert);
if(free) MEM_freeN(orco);
}
}
/* weight paint colors */
@ -1604,9 +1639,9 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
Mesh *me = ob->data;
ModifierData *firstmd, *md;
LinkNode *datamasks, *curr;
CustomDataMask mask;
CustomDataMask mask, nextmask;
float (*deformedVerts)[3] = NULL;
DerivedMesh *dm, *orcodm, *finaldm;
DerivedMesh *dm, *orcodm, *clothorcodm, *finaldm;
int numVerts = me->totvert;
int required_mode;
@ -1679,6 +1714,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
*/
dm = NULL;
orcodm = NULL;
clothorcodm = NULL;
for(;md; md = md->next, curr = curr->next) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
@ -1695,11 +1731,13 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
if(useDeform < 0 && mti->dependsOnTime && mti->dependsOnTime(md)) continue;
/* add an orco layer if needed by this modifier */
if(dm && mti->requiredDataMask) {
if(mti->requiredDataMask)
mask = mti->requiredDataMask(ob, md);
if(mask & CD_MASK_ORCO)
add_orco_dm(ob, NULL, dm, orcodm);
}
else
mask = 0;
if(dm && (mask & CD_MASK_ORCO))
add_orco_dm(ob, NULL, dm, orcodm, CD_ORCO);
/* How to apply modifier depends on (a) what we already have as
* a result of previous modifiers (could be a DerivedMesh or just
@ -1766,26 +1804,20 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
}
}
/* create an orco derivedmesh in parallel */
mask= (CustomDataMask)GET_INT_FROM_POINTER(curr->link);
if(mask & CD_MASK_ORCO) {
if(!orcodm)
orcodm= create_orco_dm(ob, me, NULL);
mask &= ~CD_MASK_ORCO;
DM_set_only_copy(orcodm, mask);
ndm = mti->applyModifier(md, ob, orcodm, useRenderParams, 0);
if(ndm) {
/* if the modifier returned a new dm, release the old one */
if(orcodm && orcodm != ndm) orcodm->release(orcodm);
orcodm = ndm;
}
}
/* determine which data layers are needed by following modifiers */
if(curr->next)
nextmask= (CustomDataMask)GET_INT_FROM_POINTER(curr->next->link);
else
nextmask= dataMask;
/* set the DerivedMesh to only copy needed data */
mask= (CustomDataMask)GET_INT_FROM_POINTER(curr->link);
DM_set_only_copy(dm, mask);
/* add cloth rest shape key if need */
if(mask & CD_MASK_CLOTH_ORCO)
add_orco_dm(ob, NULL, dm, clothorcodm, CD_CLOTH_ORCO);
/* add an origspace layer if needed */
if(((CustomDataMask)GET_INT_FROM_POINTER(curr->link)) & CD_MASK_ORIGSPACE)
if(!CustomData_has_layer(&dm->faceData, CD_ORIGSPACE))
@ -1806,6 +1838,38 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
deformedVerts = NULL;
}
}
/* create an orco derivedmesh in parallel */
if(nextmask & CD_MASK_ORCO) {
if(!orcodm)
orcodm= create_orco_dm(ob, me, NULL, CD_ORCO);
nextmask &= ~CD_MASK_ORCO;
DM_set_only_copy(orcodm, nextmask);
ndm = mti->applyModifier(md, ob, orcodm, useRenderParams, 0);
if(ndm) {
/* if the modifier returned a new dm, release the old one */
if(orcodm && orcodm != ndm) orcodm->release(orcodm);
orcodm = ndm;
}
}
/* create cloth orco derivedmesh in parallel */
if(nextmask & CD_MASK_CLOTH_ORCO) {
if(!clothorcodm)
clothorcodm= create_orco_dm(ob, me, NULL, CD_CLOTH_ORCO);
nextmask &= ~CD_MASK_CLOTH_ORCO;
DM_set_only_copy(clothorcodm, nextmask);
ndm = mti->applyModifier(md, ob, clothorcodm, useRenderParams, 0);
if(ndm) {
/* if the modifier returned a new dm, release the old one */
if(clothorcodm && clothorcodm != ndm) clothorcodm->release(clothorcodm);
clothorcodm = ndm;
}
}
}
/* grab modifiers until index i */
@ -1846,16 +1910,18 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
/* add an orco layer if needed */
if(dataMask & CD_MASK_ORCO) {
add_orco_dm(ob, NULL, finaldm, orcodm);
add_orco_dm(ob, NULL, finaldm, orcodm, CD_ORCO);
if(deform_r && *deform_r)
add_orco_dm(ob, NULL, *deform_r, NULL);
add_orco_dm(ob, NULL, *deform_r, NULL, CD_ORCO);
}
*final_r = finaldm;
if(orcodm)
orcodm->release(orcodm);
if(clothorcodm)
clothorcodm->release(clothorcodm);
if(deformedVerts && deformedVerts != inputVertexCos)
MEM_freeN(deformedVerts);
@ -1930,7 +1996,7 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri
if(dm && mti->requiredDataMask) {
mask = mti->requiredDataMask(ob, md);
if(mask & CD_MASK_ORCO)
add_orco_dm(ob, em, dm, orcodm);
add_orco_dm(ob, em, dm, orcodm, CD_ORCO);
}
/* How to apply modifier depends on (a) what we already have as
@ -1987,7 +2053,7 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri
mask= (CustomDataMask)GET_INT_FROM_POINTER(curr->link);
if(mask & CD_MASK_ORCO) {
if(!orcodm)
orcodm= create_orco_dm(ob, ob->data, em);
orcodm= create_orco_dm(ob, ob->data, em, CD_ORCO);
mask &= ~CD_MASK_ORCO;
DM_set_only_copy(orcodm, mask);
@ -2060,7 +2126,7 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri
/* add an orco layer if needed */
if(dataMask & CD_MASK_ORCO)
add_orco_dm(ob, em, *final_r, orcodm);
add_orco_dm(ob, em, *final_r, orcodm, CD_ORCO);
if(orcodm)
orcodm->release(orcodm);

@ -238,6 +238,30 @@ void set_active_action_group (bAction *act, bActionGroup *agrp, short select)
}
}
/* Add a new action group with the given name to the action */
bActionGroup *action_groups_add_new (bAction *act, const char name[])
{
bActionGroup *agrp;
/* sanity check: must have action and name */
if (ELEM(NULL, act, name))
return NULL;
/* allocate a new one */
agrp = MEM_callocN(sizeof(bActionGroup), "bActionGroup");
/* make it selected, with default name */
agrp->flag = AGRP_SELECTED;
strncpy(agrp->name, name[0] ? name : "Group", sizeof(agrp->name));
/* add to action, and validate */
BLI_addtail(&act->groups, agrp);
BLI_uniquename(&act->groups, agrp, "Group", '.', offsetof(bActionGroup, name), sizeof(agrp->name));
/* return the new group */
return agrp;
}
/* Add given channel into (active) group
* - assumes that channel is not linked to anything anymore
* - always adds at the end of the group

@ -837,7 +837,7 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
/* mballs have a different dupli handling */
if(ob->type!=OB_MBALL) ob->flag |= OB_DONE; /* doesnt render */
if(par->mode & OB_MODE_EDIT) {
if(me->edit_mesh) {
dm->foreachMappedVert(dm, vertex_dupli__mapFunc, (void*) &vdd);
}
else {
@ -1048,7 +1048,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
else go= go->next; /* group loop */
}
if(par->mode & OB_MODE_EDIT) {
if(em) {
MEM_freeN(mface);
MEM_freeN(mvert);
}
@ -1073,7 +1073,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
ParticleCacheKey *cache;
float ctime, pa_time, scale = 1.0f;
float tmat[4][4], mat[4][4], pamat[4][4], vec[3], size=0.0;
float (*obmat)[4], (*oldobmat)[4], recurs_mat[4][4];
float (*obmat)[4], (*oldobmat)[4];
int lay, a, b, counter, hair = 0;
int totpart, totchild, totgroup=0, pa_num;
@ -1090,10 +1090,6 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
if(!psys_check_enabled(par, psys))
return;
/* particles are already in world space, don't want the object mat twice */
if(par_space_mat)
mul_m4_m4m4(recurs_mat, psys->imat, par_space_mat);
ctime = bsystem_time(scene, par, (float)scene->r.cfra, 0.0);
totpart = psys->totpart;
@ -1237,7 +1233,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
mul_m4_m4m4(tmat, oblist[b]->obmat, pamat);
mul_mat3_m4_fl(tmat, size*scale);
if(par_space_mat)
mul_m4_m4m4(mat, tmat, recurs_mat);
mul_m4_m4m4(mat, tmat, par_space_mat);
else
copy_m4_m4(mat, tmat);
@ -1263,7 +1259,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
VECADD(tmat[3], tmat[3], vec);
if(par_space_mat)
mul_m4_m4m4(mat, tmat, recurs_mat);
mul_m4_m4m4(mat, tmat, par_space_mat);
else
copy_m4_m4(mat, tmat);

@ -721,6 +721,15 @@ static void cloth_to_object (Object *ob, ClothModifierData *clmd, DerivedMesh *
}
int cloth_uses_vgroup(ClothModifierData *clmd)
{
return (((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SCALING ) ||
(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL )) &&
((clmd->sim_parms->vgroup_mass>0) ||
(clmd->sim_parms->vgroup_struct>0)||
(clmd->sim_parms->vgroup_bend>0)));
}
/**
* cloth_apply_vgroup - applies a vertex group as specified by type
*
@ -744,11 +753,7 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm )
verts = clothObj->verts;
if (((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SCALING ) ||
(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL )) &&
((clmd->sim_parms->vgroup_mass>0) ||
(clmd->sim_parms->vgroup_struct>0)||
(clmd->sim_parms->vgroup_bend>0)))
if (cloth_uses_vgroup(clmd))
{
for ( i = 0; i < numverts; i++, verts++ )
{
@ -805,6 +810,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
int i = 0;
MVert *mvert = NULL;
ClothVertex *verts = NULL;
float (*shapekey_rest)[3]= NULL;
float tnull[3] = {0,0,0};
Cloth *cloth = NULL;
float maxdist = 0;
@ -842,7 +848,11 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
clmd->clothObject->springs = NULL;
clmd->clothObject->numsprings = -1;
if( clmd->sim_parms->shapekey_rest )
shapekey_rest = dm->getVertDataArray ( dm, CD_CLOTH_ORCO );
mvert = dm->getVertArray ( dm );
verts = clmd->clothObject->verts;
// set initial values
@ -850,8 +860,16 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
{
if(first)
{
VECCOPY ( verts->x, mvert[i].co );
copy_v3_v3( verts->x, mvert[i].co );
mul_m4_v3( ob->obmat, verts->x );
if( shapekey_rest ) {
verts->xrest= shapekey_rest[i];
mul_m4_v3( ob->obmat, verts->xrest );
}
else
verts->xrest = verts->x;
}
/* no GUI interface yet */
@ -1070,7 +1088,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
{
spring->ij = MIN2(medge[i].v1, medge[i].v2);
spring->kl = MAX2(medge[i].v2, medge[i].v1);
VECSUB ( temp, cloth->verts[spring->kl].x, cloth->verts[spring->ij].x );
VECSUB ( temp, cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest );
spring->restlen = sqrt ( INPR ( temp, temp ) );
clmd->sim_parms->avg_spring_len += spring->restlen;
cloth->verts[spring->ij].avg_spring_len += spring->restlen;
@ -1116,7 +1134,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
spring->ij = MIN2(mface[i].v1, mface[i].v3);
spring->kl = MAX2(mface[i].v3, mface[i].v1);
VECSUB ( temp, cloth->verts[spring->kl].x, cloth->verts[spring->ij].x );
VECSUB ( temp, cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest );
spring->restlen = sqrt ( INPR ( temp, temp ) );
spring->type = CLOTH_SPRING_TYPE_SHEAR;
spring->stiffness = (cloth->verts[spring->kl].shear_stiff + cloth->verts[spring->ij].shear_stiff) / 2.0;
@ -1139,7 +1157,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
spring->ij = MIN2(mface[i].v2, mface[i].v4);
spring->kl = MAX2(mface[i].v4, mface[i].v2);
VECSUB ( temp, cloth->verts[spring->kl].x, cloth->verts[spring->ij].x );
VECSUB ( temp, cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest );
spring->restlen = sqrt ( INPR ( temp, temp ) );
spring->type = CLOTH_SPRING_TYPE_SHEAR;
spring->stiffness = (cloth->verts[spring->kl].shear_stiff + cloth->verts[spring->ij].shear_stiff) / 2.0;
@ -1181,7 +1199,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
spring->ij = MIN2(tspring2->ij, index2);
spring->kl = MAX2(tspring2->ij, index2);
VECSUB ( temp, cloth->verts[spring->kl].x, cloth->verts[spring->ij].x );
VECSUB ( temp, cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest );
spring->restlen = sqrt ( INPR ( temp, temp ) );
spring->type = CLOTH_SPRING_TYPE_BENDING;
spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0;
@ -1221,7 +1239,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
spring->ij = tspring2->ij;
spring->kl = tspring->kl;
VECSUB ( temp, cloth->verts[spring->kl].x, cloth->verts[spring->ij].x );
VECSUB ( temp, cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest );
spring->restlen = sqrt ( INPR ( temp, temp ) );
spring->type = CLOTH_SPRING_TYPE_BENDING;
spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0;

@ -1227,49 +1227,47 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
/* if a font object is being edited, then do nothing */
// XXX if( ob == obedit && ob->type == OB_FONT ) return;
if(cu->bevobj && cu->bevobj!=ob) {
if(cu->bevobj->type==OB_CURVE) {
bevcu= cu->bevobj->data;
if(bevcu->ext1==0.0 && bevcu->ext2==0.0) {
ListBase bevdisp= {NULL, NULL};
facx= cu->bevobj->size[0];
facy= cu->bevobj->size[1];
if(cu->bevobj) {
bevcu= cu->bevobj->data;
if(bevcu->ext1==0.0 && bevcu->ext2==0.0) {
ListBase bevdisp= {NULL, NULL};
facx= cu->bevobj->size[0];
facy= cu->bevobj->size[1];
if (forRender) {
makeDispListCurveTypes_forRender(scene, cu->bevobj, &bevdisp, NULL, 0);
dl= bevdisp.first;
} else {
if (forRender) {
makeDispListCurveTypes_forRender(scene, cu->bevobj, &bevdisp, NULL, 0);
dl= bevdisp.first;
} else {
dl= bevcu->disp.first;
if(dl==0) {
makeDispListCurveTypes(scene, cu->bevobj, 0);
dl= bevcu->disp.first;
if(dl==0) {
makeDispListCurveTypes(scene, cu->bevobj, 0);
dl= bevcu->disp.first;
}
}
while(dl) {
if ELEM(dl->type, DL_POLY, DL_SEGM) {
dlnew= MEM_mallocN(sizeof(DispList), "makebevelcurve1");
*dlnew= *dl;
dlnew->verts= MEM_mallocN(3*sizeof(float)*dl->parts*dl->nr, "makebevelcurve1");
memcpy(dlnew->verts, dl->verts, 3*sizeof(float)*dl->parts*dl->nr);
if(dlnew->type==DL_SEGM) dlnew->flag |= (DL_FRONT_CURVE|DL_BACK_CURVE);
BLI_addtail(disp, dlnew);
fp= dlnew->verts;
nr= dlnew->parts*dlnew->nr;
while(nr--) {
fp[2]= fp[1]*facy;
fp[1]= -fp[0]*facx;
fp[0]= 0.0;
fp+= 3;
}
}
dl= dl->next;
}
freedisplist(&bevdisp);
}
while(dl) {
if ELEM(dl->type, DL_POLY, DL_SEGM) {
dlnew= MEM_mallocN(sizeof(DispList), "makebevelcurve1");
*dlnew= *dl;
dlnew->verts= MEM_mallocN(3*sizeof(float)*dl->parts*dl->nr, "makebevelcurve1");
memcpy(dlnew->verts, dl->verts, 3*sizeof(float)*dl->parts*dl->nr);
if(dlnew->type==DL_SEGM) dlnew->flag |= (DL_FRONT_CURVE|DL_BACK_CURVE);
BLI_addtail(disp, dlnew);
fp= dlnew->verts;
nr= dlnew->parts*dlnew->nr;
while(nr--) {
fp[2]= fp[1]*facy;
fp[1]= -fp[0]*facx;
fp[0]= 0.0;
fp+= 3;
}
}
dl= dl->next;
}
freedisplist(&bevdisp);
}
}
else if(cu->ext1==0.0 && cu->ext2==0.0) {

@ -794,13 +794,14 @@ const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
layerSwap_mcol, layerDefault_mcol},
{sizeof(MCol)*4, "MCol", 4, "TexturedCol", NULL, NULL, layerInterp_mcol,
layerSwap_mcol, layerDefault_mcol},
{sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL}
};
const char *LAYERTYPENAMES[CD_NUMTYPES] = {
"CDMVert", "CDMSticky", "CDMDeformVert", "CDMEdge", "CDMFace", "CDMTFace",
"CDMCol", "CDOrigIndex", "CDNormal", "CDFlags","CDMFloatProperty",
"CDMIntProperty","CDMStringProperty", "CDOrigSpace", "CDOrco", "CDMTexPoly", "CDMLoopUV",
"CDMloopCol", "CDTangent", "CDMDisps", "CDWeightMCol"};
"CDMloopCol", "CDTangent", "CDMDisps", "CDWeightMCol", "CDClothOrco"};
const CustomDataMask CD_MASK_BAREMESH =
CD_MASK_MVERT | CD_MASK_MEDGE | CD_MASK_MFACE;
@ -813,7 +814,7 @@ const CustomDataMask CD_MASK_EDITMESH =
CD_MASK_MCOL|CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_PROP_STR | CD_MASK_MDISPS;
const CustomDataMask CD_MASK_DERIVEDMESH =
CD_MASK_MSTICKY | CD_MASK_MDEFORMVERT | CD_MASK_MTFACE |
CD_MASK_MCOL | CD_MASK_ORIGINDEX | CD_MASK_PROP_FLT | CD_MASK_PROP_INT |
CD_MASK_MCOL | CD_MASK_ORIGINDEX | CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_CLOTH_ORCO |
CD_MASK_PROP_STR | CD_MASK_ORIGSPACE | CD_MASK_ORCO | CD_MASK_TANGENT | CD_MASK_WEIGHT_MCOL;
const CustomDataMask CD_MASK_BMESH =
CD_MASK_MSTICKY | CD_MASK_MDEFORMVERT | CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_PROP_STR;
@ -847,7 +848,7 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
{
const LayerTypeInfo *typeInfo;
CustomDataLayer *layer, *newlayer;
int i, type, number = 0, lasttype = -1, lastactive = 0, lastrender = 0, lastclone = 0, lastmask = 0;
int i, type, number = 0, lasttype = -1, lastactive = 0, lastrender = 0, lastclone = 0, lastmask = 0, lastflag = 0;
for(i = 0; i < source->totlayer; ++i) {
layer = &source->layers[i];
@ -862,15 +863,16 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
lastclone = layer->active_clone;
lastmask = layer->active_mask;
lasttype = type;
lastflag = layer->flag;
}
else
number++;
if(layer->flag & CD_FLAG_NOCOPY) continue;
if(lastflag & CD_FLAG_NOCOPY) continue;
else if(!((int)mask & (int)(1 << (int)type))) continue;
else if(number < CustomData_number_of_layers(dest, type)) continue;
if((alloctype == CD_ASSIGN) && (layer->flag & CD_FLAG_NOFREE))
if((alloctype == CD_ASSIGN) && (lastflag & CD_FLAG_NOFREE))
newlayer = customData_add_layer__internal(dest, type, CD_REFERENCE,
layer->data, totelem, layer->name);
else
@ -882,6 +884,7 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
newlayer->active_rnd = lastrender;
newlayer->active_clone = lastclone;
newlayer->active_mask = lastmask;
newlayer->flag |= lastflag & (CD_FLAG_EXTERNAL|CD_FLAG_IN_MEMORY);
}
}
}
@ -891,6 +894,9 @@ void CustomData_copy(const struct CustomData *source, struct CustomData *dest,
{
memset(dest, 0, sizeof(*dest));
if(source->external)
dest->external= MEM_dupallocN(source->external);
CustomData_merge(source, dest, mask, alloctype, totelem);
}

@ -1580,21 +1580,24 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
if(forRender || nu->hide==0) {
if(nu->pntsv==1) {
len= SEGMENTSU(nu)*nu->resolu;
dl= MEM_callocN(sizeof(DispList), "makeDispListsurf");
dl->verts= MEM_callocN(len*3*sizeof(float), "dlverts");
BLI_addtail(dispbase, dl);
dl->parts= 1;
dl->nr= len;
dl->col= nu->mat_nr;
dl->charidx= nu->charidx;
dl->rt= nu->flag;
/* dl->rt will be used as flag for render face and */
/* CU_2D conflicts with R_NOPUNOFLIP */
dl->rt= nu->flag & ~CU_2D;
data= dl->verts;
if(nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY;
else dl->type= DL_SEGM;
makeNurbcurve(nu, data, NULL, NULL, nu->resolu, 3*sizeof(float));
}
else {
@ -1606,11 +1609,14 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
dl->col= nu->mat_nr;
dl->charidx= nu->charidx;
dl->rt= nu->flag;
/* dl->rt will be used as flag for render face and */
/* CU_2D conflicts with R_NOPUNOFLIP */
dl->rt= nu->flag & ~CU_2D;
data= dl->verts;
dl->type= DL_SURF;
dl->parts= (nu->pntsu*nu->resolu); /* in reverse, because makeNurbfaces works that way */
dl->nr= (nu->pntsv*nu->resolv);
if(nu->flagv & CU_NURB_CYCLIC) dl->flag|= DL_CYCL_U; /* reverse too! */
@ -1651,6 +1657,15 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
float (*deformedVerts)[3];
int numVerts;
/* Bevel and taper objects should always be curves */
if (cu->bevobj && cu->bevobj->type != OB_CURVE) {
cu->bevobj = NULL;
}
if (cu->taperobj && cu->taperobj->type != OB_CURVE) {
cu->taperobj = NULL;
}
if(cu->editnurb)
nubase= cu->editnurb;
else
@ -1683,26 +1698,29 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
float *fp1, *data;
BevPoint *bevp;
int a,b;
if (bl->nr) { /* blank bevel lists can happen */
/* exception handling; curve without bevel or extrude, with width correction */
if(dlbev.first==NULL) {
dl= MEM_callocN(sizeof(DispList), "makeDispListbev");
dl->verts= MEM_callocN(3*sizeof(float)*bl->nr, "dlverts");
BLI_addtail(dispbase, dl);
if(bl->poly!= -1) dl->type= DL_POLY;
else dl->type= DL_SEGM;
if(dl->type==DL_SEGM) dl->flag = (DL_FRONT_CURVE|DL_BACK_CURVE);
dl->parts= 1;
dl->nr= bl->nr;
dl->col= nu->mat_nr;
dl->charidx= nu->charidx;
dl->rt= nu->flag;
/* dl->rt will be used as flag for render face and */
/* CU_2D conflicts with R_NOPUNOFLIP */
dl->rt= nu->flag & ~CU_2D;
a= dl->nr;
bevp= (BevPoint *)(bl+1);
data= dl->verts;
@ -1716,10 +1734,10 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
}
else {
DispList *dlb;
for (dlb=dlbev.first; dlb; dlb=dlb->next) {
/* for each part of the bevel use a separate displblock */
/* for each part of the bevel use a separate displblock */
dl= MEM_callocN(sizeof(DispList), "makeDispListbev1");
dl->verts= data= MEM_callocN(3*sizeof(float)*dlb->nr*bl->nr, "dlverts");
BLI_addtail(dispbase, dl);
@ -1734,11 +1752,15 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
dl->nr= dlb->nr;
dl->col= nu->mat_nr;
dl->charidx= nu->charidx;
dl->rt= nu->flag;
/* dl->rt will be used as flag for render face and */
/* CU_2D conflicts with R_NOPUNOFLIP */
dl->rt= nu->flag & ~CU_2D;
dl->bevelSplitFlag= MEM_callocN(sizeof(*dl->col2)*((bl->nr+0x1F)>>5), "col2");
bevp= (BevPoint *)(bl+1);
/* for each point of poly make a bevel piece */
/* for each point of poly make a bevel piece */
bevp= (BevPoint *)(bl+1);
for(a=0; a<bl->nr; a++,bevp++) {
float fac=1.0;
@ -1748,7 +1770,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
} else {
fac = calc_taper(scene, cu->taperobj, a, bl->nr);
}
if (bevp->split_tag) {
dl->bevelSplitFlag[a>>5] |= 1<<(a&0x1F);
}
@ -1762,9 +1784,9 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
vec[0]= fp1[1]+widfac;
vec[1]= fp1[2];
vec[2]= 0.0;
mul_qt_v3(bevp->quat, vec);
data[0]= bevp->vec[0] + fac*vec[0];
data[1]= bevp->vec[1] + fac*vec[1];
data[2]= bevp->vec[2] + fac*vec[2];

@ -1894,13 +1894,16 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
memset(&rres, 0, sizeof(RenderResult));
if(!(rres.rectx > 0 && rres.recty > 0)) {
RE_ReleaseResultImage(re);
if(from_render)
RE_ReleaseResultImage(re);
return NULL;
}
/* release is done in BKE_image_release_ibuf using lock_r */
if(from_render)
if(from_render) {
BLI_lock_thread(LOCK_VIEWER);
*lock_r= re;
}
/* this gives active layer, composite or seqence result */
rect= (unsigned int *)rres.rect32;
@ -1909,9 +1912,9 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
dither= iuser->scene->r.dither_intensity;
/* get compo/seq result by default */
if(rres.rectf && layer==0);
if(rres.compo_seq && layer==0);
else if(rres.layers.first) {
RenderLayer *rl= BLI_findlink(&rres.layers, layer-(rres.rectf?1:0));
RenderLayer *rl= BLI_findlink(&rres.layers, layer-(rres.compo_seq?1:0));
if(rl) {
RenderPass *rpass;
@ -1934,6 +1937,9 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
}
}
if(!(rectf || rect))
return NULL;
ibuf= image_get_ibuf(ima, IMA_NO_INDEX, 0);
/* make ibuf if needed, and initialize it */
@ -1942,17 +1948,12 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
}
if(!(rectf || rect))
return ibuf;
ibuf->x= rres.rectx;
ibuf->y= rres.recty;
if(ibuf->rect_float!=rectf || rect) { /* ensure correct redraw */
BLI_lock_thread(LOCK_CUSTOM1);
if(ibuf->rect_float!=rectf || rect) /* ensure correct redraw */
imb_freerectImBuf(ibuf);
BLI_unlock_thread(LOCK_CUSTOM1);
}
if(rect)
ibuf->rect= rect;
@ -1991,7 +1992,7 @@ static ImBuf *image_get_ibuf_threadsafe(Image *ima, ImageUser *iuser, int *frame
if(ima->lastframe != frame)
ima->tpageflag |= IMA_TPAGE_REFRESH;
ima->lastframe = frame;
}
}
else if(ima->type==IMA_TYPE_MULTILAYER) {
frame= iuser?iuser->framenr:ima->lastframe;
index= iuser?iuser->multi_index:IMA_NO_INDEX;
@ -2155,10 +2156,13 @@ ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r)
void BKE_image_release_ibuf(Image *ima, void *lock)
{
/* for getting image during threaded render / compositing, need to release */
if(lock == ima)
if(lock == ima) {
BLI_unlock_thread(LOCK_VIEWER); /* viewer image */
else if(lock)
}
else if(lock) {
RE_ReleaseResultImage(lock); /* render result */
BLI_unlock_thread(LOCK_VIEWER); /* view image imbuf */
}
}
ImBuf *BKE_image_get_ibuf(Image *ima, ImageUser *iuser)

@ -347,7 +347,7 @@ int id_unlink(ID *id, int test)
if(id->us == 0) {
if(test) return 1;
lb= wich_libbase(mainlib, GS(id->name));
lb= which_libbase(mainlib, GS(id->name));
free_libblock(lb, id);
return 1;
@ -356,7 +356,7 @@ int id_unlink(ID *id, int test)
return 0;
}
ListBase *wich_libbase(Main *mainlib, short type)
ListBase *which_libbase(Main *mainlib, short type)
{
switch( type ) {
case ID_SCE:
@ -658,7 +658,7 @@ void *copy_libblock(void *rt)
id= rt;
lb= wich_libbase(G.main, GS(id->name));
lb= which_libbase(G.main, GS(id->name));
idn= alloc_libblock(lb, GS(id->name), id->name+2);
if(idn==NULL) {
@ -867,7 +867,7 @@ void free_main(Main *mainvar)
ID *find_id(char *type, char *name) /* type: "OB" or "MA" etc */
{
ListBase *lb= wich_libbase(G.main, GS(type));
ListBase *lb= which_libbase(G.main, GS(type));
return BLI_findstring(lb, name, offsetof(ID, name) + 2);
}
@ -1175,7 +1175,7 @@ int new_id(ListBase *lb, ID *id, const char *tname)
if(id->lib) return 0;
/* if no libdata given, look up based on ID */
if(lb==NULL) lb= wich_libbase(G.main, GS(id->name));
if(lb==NULL) lb= which_libbase(G.main, GS(id->name));
/* if no name given, use name of current ID
* else make a copy (tname args can be const) */
@ -1236,11 +1236,17 @@ static void image_fix_relative_path(Image *ima)
#define LIBTAG(a) if(a && a->id.lib) {a->id.flag &=~LIB_INDIRECT; a->id.flag |= LIB_EXTERN;}
static void lib_indirect_test_id(ID *id)
static void lib_indirect_test_id(ID *id, Library *lib)
{
if(id->lib)
if(id->lib) {
/* datablocks that were indirectly related are now direct links
* without this, appending data that has a link to other data will fail to write */
if(lib && id->lib->parent == lib) {
id_lib_extern(id);
}
return;
}
if(GS(id->name)==ID_OB) {
Object *ob= (Object *)id;
@ -1336,7 +1342,7 @@ void all_local(Library *lib, int untagged_only)
a= set_listbasepointers(G.main, lbarray);
while(a--) {
for(id= lbarray[a]->first; id; id=id->next)
lib_indirect_test_id(id);
lib_indirect_test_id(id, lib);
}
}
@ -1348,7 +1354,7 @@ void test_idbutton(char *name)
ID *idtest;
lb= wich_libbase(G.main, GS(name-2) );
lb= which_libbase(G.main, GS(name-2) );
if(lb==0) return;
/* search for id */
@ -1383,7 +1389,7 @@ void rename_id(ID *id, char *name)
ListBase *lb;
strncpy(id->name+2, name, 21);
lb= wich_libbase(G.main, GS(id->name) );
lb= which_libbase(G.main, GS(id->name) );
new_id(lb, id, name);
}

@ -1346,70 +1346,3 @@ void paste_matcopybuf(Material *ma)
scrarea_queue_winredraw(curarea);
*/
}
static short mtexcopied=0; /* must be reset on file load */
static MTex mtexcopybuf;
void clear_mat_mtex_copybuf(void)
{ /* use for file reload */
mtexcopied= 0;
}
void copy_mat_mtex_copybuf(ID *id)
{
MTex **mtex= NULL;
switch(GS(id->name)) {
case ID_MA:
mtex= &(((Material *)id)->mtex[(int)((Material *)id)->texact]);
break;
case ID_LA:
// la->mtex[(int)la->texact] // TODO
break;
case ID_WO:
// mtex= wrld->mtex[(int)wrld->texact]; // TODO
break;
}
if(mtex && *mtex) {
memcpy(&mtexcopybuf, *mtex, sizeof(MTex));
mtexcopied= 1;
}
else {
mtexcopied= 0;
}
}
void paste_mat_mtex_copybuf(ID *id)
{
MTex **mtex= NULL;
if(mtexcopied == 0 || mtexcopybuf.tex==NULL)
return;
switch(GS(id->name)) {
case ID_MA:
mtex= &(((Material *)id)->mtex[(int)((Material *)id)->texact]);
break;
case ID_LA:
// la->mtex[(int)la->texact] // TODO
break;
case ID_WO:
// mtex= wrld->mtex[(int)wrld->texact]; // TODO
break;
}
if(mtex) {
if(*mtex==NULL) {
*mtex= MEM_mallocN(sizeof(MTex), "mtex copy");
}
else if((*mtex)->tex) {
(*mtex)->tex->id.us--;
}
memcpy(*mtex, &mtexcopybuf, sizeof(MTex));
id_us_plus((ID *)mtexcopybuf.tex);
}
}

@ -629,6 +629,12 @@ static void make_edges_mdata(MVert *allvert, MFace *allface, int totvert, int to
medge->v2= ed->v2;
if(old==0 || ed->is_draw) medge->flag= ME_EDGEDRAW|ME_EDGERENDER;
if(ed->is_loose) medge->flag|= ME_LOOSEEDGE;
/* order is swapped so extruding this edge as a surface wont flip face normals
* with cyclic curves */
if(ed->v1+1 != ed->v2) {
SWAP(int, medge->v1, medge->v2);
}
medge++;
}
else {
@ -768,11 +774,8 @@ int nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase, MVert **allvert, int
totvlak+= dl->parts*(dl->nr-1);
}
else if(dl->type==DL_POLY) {
/* cyclic polys are filled. except when 3D */
if(cu->flag & CU_3D) {
totvert+= dl->parts*dl->nr;
totvlak+= dl->parts*dl->nr;
}
totvert+= dl->parts*dl->nr;
totvlak+= dl->parts*dl->nr;
}
else if(dl->type==DL_SURF) {
totvert+= dl->parts*dl->nr;
@ -824,27 +827,24 @@ int nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase, MVert **allvert, int
}
else if(dl->type==DL_POLY) {
/* 3d polys are not filled */
if(cu->flag & CU_3D) {
startvert= vertcount;
a= dl->parts*dl->nr;
data= dl->verts;
while(a--) {
VECCOPY(mvert->co, data);
data+=3;
vertcount++;
mvert++;
}
startvert= vertcount;
a= dl->parts*dl->nr;
data= dl->verts;
while(a--) {
VECCOPY(mvert->co, data);
data+=3;
vertcount++;
mvert++;
}
for(a=0; a<dl->parts; a++) {
ofs= a*dl->nr;
for(b=0; b<dl->nr; b++) {
mface->v1= startvert+ofs+b;
if(b==dl->nr-1) mface->v2= startvert+ofs;
else mface->v2= startvert+ofs+b+1;
if(smooth) mface->flag |= ME_SMOOTH;
mface++;
}
for(a=0; a<dl->parts; a++) {
ofs= a*dl->nr;
for(b=0; b<dl->nr; b++) {
mface->v1= startvert+ofs+b;
if(b==dl->nr-1) mface->v2= startvert+ofs;
else mface->v2= startvert+ofs+b+1;
if(smooth) mface->flag |= ME_SMOOTH;
mface++;
}
}
}

@ -3606,6 +3606,7 @@ static void uvprojectModifier_initData(ModifierData *md)
umd->flags = 0;
umd->num_projectors = 1;
umd->aspectx = umd->aspecty = 1.0f;
umd->scalex = umd->scaley = 1.0f;
}
static void uvprojectModifier_copyData(ModifierData *md, ModifierData *target)
@ -3621,6 +3622,8 @@ static void uvprojectModifier_copyData(ModifierData *md, ModifierData *target)
tumd->num_projectors = umd->num_projectors;
tumd->aspectx = umd->aspectx;
tumd->aspecty = umd->aspecty;
tumd->scalex = umd->scalex;
tumd->scaley = umd->scaley;
}
static CustomDataMask uvprojectModifier_requiredDataMask(Object *ob, ModifierData *md)
@ -3692,6 +3695,8 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
char uvname[32];
float aspx= umd->aspectx ? umd->aspectx : 1.0f;
float aspy= umd->aspecty ? umd->aspecty : 1.0f;
float scax= umd->scalex ? umd->scalex : 1.0f;
float scay= umd->scaley ? umd->scaley : 1.0f;
int free_uci= 0;
aspect = aspx / aspy;
@ -3829,6 +3834,22 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
project_from_camera(tface->uv[2], coords[mf->v3], projectors[0].uci);
if(mf->v3)
project_from_camera(tface->uv[3], coords[mf->v4], projectors[0].uci);
if(scax != 1.0f) {
tface->uv[0][0] = ((tface->uv[0][0] - 0.5f) * scax) + 0.5f;
tface->uv[1][0] = ((tface->uv[1][0] - 0.5f) * scax) + 0.5f;
tface->uv[2][0] = ((tface->uv[2][0] - 0.5f) * scax) + 0.5f;
if(mf->v3)
tface->uv[3][0] = ((tface->uv[3][0] - 0.5f) * scax) + 0.5f;
}
if(scay != 1.0f) {
tface->uv[0][1] = ((tface->uv[0][1] - 0.5f) * scay) + 0.5f;
tface->uv[1][1] = ((tface->uv[1][1] - 0.5f) * scay) + 0.5f;
tface->uv[2][1] = ((tface->uv[2][1] - 0.5f) * scay) + 0.5f;
if(mf->v3)
tface->uv[3][1] = ((tface->uv[3][1] - 0.5f) * scay) + 0.5f;
}
}
else {
/* apply transformed coords as UVs */
@ -5697,6 +5718,7 @@ static void solidifyModifier_copyData(ModifierData *md, ModifierData *target)
SolidifyModifierData *smd = (SolidifyModifierData*) md;
SolidifyModifierData *tsmd = (SolidifyModifierData*) target;
tsmd->offset = smd->offset;
tsmd->offset_fac = smd->offset_fac;
tsmd->crease_inner = smd->crease_inner;
tsmd->crease_outer = smd->crease_outer;
tsmd->crease_rim = smd->crease_rim;
@ -5734,6 +5756,19 @@ static DerivedMesh *solidifyModifier_applyModifier(ModifierData *md,
float (*vert_nors)[3]= NULL;
float ofs_orig= - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset);
float ofs_new= smd->offset - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset);
/* weights */
MDeformVert *dvert= NULL, *dv= NULL;
int defgrp_index= -1;
int defgrp_invert = ((smd->flag & MOD_SOLIDIFY_VGROUP_INV) != 0);
defgrp_index= defgroup_name_index(ob, smd->defgrp_name);
if (defgrp_index >= 0)
dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
orig_mface = dm->getFaceArray(dm);
orig_medge = dm->getEdgeArray(dm);
orig_mvert = dm->getVertArray(dm);
@ -5758,7 +5793,8 @@ static DerivedMesh *solidifyModifier_applyModifier(ModifierData *md,
#define ADD_EDGE_USER(_v1, _v2, edge_ord) \
eidx= GET_INT_FROM_POINTER(BLI_edgehash_lookup(edgehash, _v1, _v2)); \
if(edge_users[eidx] == INVALID_UNUSED) { \
edge_users[eidx]= (_v1 < _v2) ? i:(i+numFaces); \
ed= orig_medge + eidx; \
edge_users[eidx]= (_v1 < _v2) == (ed->v1 < ed->v2) ? i:(i+numFaces); \
edge_order[eidx]= edge_ord; \
} else { \
edge_users[eidx]= INVALID_PAIR; \
@ -5866,16 +5902,38 @@ static DerivedMesh *solidifyModifier_applyModifier(ModifierData *md,
if((smd->flag & MOD_SOLIDIFY_EVEN) == 0) {
/* no even thickness, very simple */
float scalar_short = smd->offset / 32767.0f;
float scalar_short;
float scalar_short_vgroup;
if(smd->offset < 0.0f) mv= mvert+numVerts;
else mv= mvert;
for(i=0; i<numVerts; i++, mv++) {
mv->co[0] += mv->no[0] * scalar_short;
mv->co[1] += mv->no[1] * scalar_short;
mv->co[2] += mv->no[2] * scalar_short;
if(ofs_new != 0.0f) {
scalar_short= scalar_short_vgroup= ofs_new / 32767.0f;
mv= mvert + ((ofs_new >= ofs_orig) ? 0 : numVerts);
dv= dvert;
for(i=0; i<numVerts; i++, mv++) {
if(dv) {
if(defgrp_invert) scalar_short_vgroup = scalar_short * (1.0f - defvert_find_weight(dv, defgrp_index));
else scalar_short_vgroup = scalar_short * defvert_find_weight(dv, defgrp_index);
dv++;
}
VECADDFAC(mv->co, mv->co, mv->no, scalar_short_vgroup);
}
}
if(ofs_orig != 0.0f) {
scalar_short= scalar_short_vgroup= ofs_orig / 32767.0f;
mv= mvert + ((ofs_new >= ofs_orig) ? numVerts : 0); /* same as above but swapped, intentional use of 'ofs_new' */
dv= dvert;
for(i=0; i<numVerts; i++, mv++) {
if(dv) {
if(defgrp_invert) scalar_short_vgroup = scalar_short * (1.0f - defvert_find_weight(dv, defgrp_index));
else scalar_short_vgroup = scalar_short * defvert_find_weight(dv, defgrp_index);
dv++;
}
VECADDFAC(mv->co, mv->co, mv->no, scalar_short_vgroup);
}
}
}
else {
/* make a face normal layer if not present */
@ -5927,12 +5985,38 @@ static DerivedMesh *solidifyModifier_applyModifier(ModifierData *md,
}
}
if(smd->offset < 0.0f) mv= mvert+numVerts;
else mv= mvert;
/* vertex group support */
if(dvert) {
dv= dvert;
if(defgrp_invert) {
for(i=0; i<numVerts; i++, dv++) {
vert_angles[i] *= (1.0f - defvert_find_weight(dv, defgrp_index));
}
}
else {
for(i=0; i<numVerts; i++, dv++) {
vert_angles[i] *= defvert_find_weight(dv, defgrp_index);
}
}
}
for(i=0; i<numVerts; i++, mv++) {
if(vert_accum[i]) { /* zero if unselected */
madd_v3_v3fl(mv->co, vert_nors[i], smd->offset * (vert_angles[i] / vert_accum[i]));
if(ofs_new) {
mv= mvert + ((ofs_new >= ofs_orig) ? 0 : numVerts);
for(i=0; i<numVerts; i++, mv++) {
if(vert_accum[i]) { /* zero if unselected */
madd_v3_v3fl(mv->co, vert_nors[i], ofs_new * (vert_angles[i] / vert_accum[i]));
}
}
}
if(ofs_orig) {
mv= mvert + ((ofs_new >= ofs_orig) ? numVerts : 0); /* same as above but swapped, intentional use of 'ofs_new' */
for(i=0; i<numVerts; i++, mv++) {
if(vert_accum[i]) { /* zero if unselected */
madd_v3_v3fl(mv->co, vert_nors[i], ofs_orig * (vert_angles[i] / vert_accum[i]));
}
}
}
@ -6489,7 +6573,7 @@ static DerivedMesh *screwModifier_applyModifier(ModifierData *md, Object *ob,
ed_loop_flip= 1;
}
else {
/* not so simple to work out wich edge is higher */
/* not so simple to work out which edge is higher */
sub_v3_v3v3(tmp_vec1, tmpf1, vc_tmp->co);
sub_v3_v3v3(tmp_vec1, tmpf2, vc_tmp->co);
normalize_v3(tmp_vec1);
@ -6978,9 +7062,13 @@ static void clothModifier_updateDepgraph(
static CustomDataMask clothModifier_requiredDataMask(Object *ob, ModifierData *md)
{
CustomDataMask dataMask = 0;
ClothModifierData *clmd = (ClothModifierData*)md;
/* ask for vertexgroups if we need them */
dataMask |= (1 << CD_MDEFORMVERT);
if(cloth_uses_vgroup(clmd))
dataMask |= (1 << CD_MDEFORMVERT);
if(clmd->sim_parms->shapekey_rest != 0)
dataMask |= (1 << CD_CLOTH_ORCO);
return dataMask;
}
@ -7917,10 +8005,11 @@ static void explodeModifier_createFacepa(ExplodeModifierData *emd,
MDeformVert *dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
float val;
if(dvert){
for(i=0; i<totvert; i++){
int defgrp_index= emd->vgroup-1;
for(i=0; i<totvert; i++, dvert++){
val = BLI_frand();
val = (1.0f-emd->protect)*val + emd->protect*0.5f;
if(val < defvert_find_weight(dvert+i,emd->vgroup-1))
if(val < defvert_find_weight(dvert, defgrp_index))
vertpa[i] = -1;
}
}

@ -39,10 +39,12 @@
#include "BLI_ghash.h"
#include "DNA_anim_types.h"
#include "DNA_scene_types.h"
#include "BKE_action.h"
#include "BKE_fcurve.h"
#include "BKE_nla.h"
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_utildefines.h"
@ -828,8 +830,8 @@ void BKE_nlameta_flush_transforms (NlaStrip *mstrip)
strip->end= nEnd;
RNA_pointer_create(NULL, &RNA_NlaStrip, strip, &ptr);
RNA_float_set(&ptr, "start_frame", nStart);
RNA_float_set(&ptr, "end_frame", nEnd);
RNA_float_set(&ptr, "frame_start", nStart);
RNA_float_set(&ptr, "frame_end", nEnd);
}
else {
/* just apply the changes in offset to both ends of the strip */
@ -956,6 +958,35 @@ short BKE_nlatrack_add_strip (NlaTrack *nlt, NlaStrip *strip)
return BKE_nlastrips_add_strip(&nlt->strips, strip);
}
/* Get the extents of the given NLA-Track including gaps between strips,
* returning whether this succeeded or not
*/
short BKE_nlatrack_get_bounds (NlaTrack *nlt, float bounds[2])
{
NlaStrip *strip;
/* initialise bounds */
if (bounds)
bounds[0] = bounds[1] = 0.0f;
else
return 0;
/* sanity checks */
if ELEM(NULL, nlt, nlt->strips.first)
return 0;
/* lower bound is first strip's start frame */
strip = nlt->strips.first;
bounds[0] = strip->start;
/* upper bound is last strip's end frame */
strip = nlt->strips.last;
bounds[1] = strip->end;
/* done */
return 1;
}
/* NLA Strips -------------------------------------- */
/* Find the active NLA-strip within the given track */
@ -1474,7 +1505,10 @@ short BKE_nla_tweakmode_enter (AnimData *adt)
}
}
if ELEM3(NULL, activeTrack, activeStrip, activeStrip->act) {
printf("NLA tweakmode enter - neither active requirement found \n");
if (G.f & G_DEBUG) {
printf("NLA tweakmode enter - neither active requirement found \n");
printf("\tactiveTrack = %p, activeStrip = %p \n", activeTrack, activeStrip);
}
return 0;
}
@ -1553,4 +1587,29 @@ void BKE_nla_tweakmode_exit (AnimData *adt)
adt->flag &= ~ADT_NLA_EDIT_ON;
}
/* Baking Tools ------------------------------------------- */
void BKE_nla_bake (Scene *scene, ID *id, AnimData *adt, int flag)
{
/* verify that data is valid
* 1) Scene and AnimData must be provided
* 2) there must be tracks to merge...
*/
if ELEM3(NULL, scene, adt, adt->nla_tracks.first)
return;
/* if animdata currently has an action, 'push down' this onto the stack first */
if (adt->action)
BKE_nla_action_pushdown(adt);
/* get range of motion to bake, and the channels involved... */
/* temporarily mute the action, and start keying to it */
/* start keying... */
/* unmute the action */
}
/* *************************************************** */

@ -2573,6 +2573,8 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree)
for(sock= node->outputs.first; sock; sock= sock->next) {
sock->new_sock->ns.data= sock->ns.data;
compbuf_set_node(sock->new_sock->ns.data, node->new_node);
sock->ns.data= NULL;
sock->new_sock->new_sock= sock;
}

@ -2502,7 +2502,7 @@ void object_handle_update(Scene *scene, Object *ob)
BKE_animsys_evaluate_animdata(data_id, adt, ctime, ADT_RECALC_DRIVERS);
// here was vieweditdatamask? XXX
if(ob->mode & OB_MODE_EDIT) {
if(em) {
makeDerivedMesh(scene, ob, em, CD_MASK_BAREMESH);
BKE_mesh_end_editmesh(ob->data, em);
} else

@ -355,6 +355,12 @@ int psys_uses_gravity(ParticleSimulationData *sim)
/************************************************/
/* Freeing stuff */
/************************************************/
void fluid_free_settings(SPHFluidSettings *fluid)
{
if(fluid)
MEM_freeN(fluid);
}
void psys_free_settings(ParticleSettings *part)
{
BKE_free_animdata(&part->id);
@ -367,6 +373,7 @@ void psys_free_settings(ParticleSettings *part)
BLI_freelistN(&part->dupliweights);
boid_free_settings(part->boids);
fluid_free_settings(part->fluid);
}
void free_hair(Object *ob, ParticleSystem *psys, int dynamics)

@ -24,7 +24,7 @@
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
* Contributor(s): Raul Fernandez Hernandez (Farsthary), Stephen Swhitehorn.
*
* ***** END GPL LICENSE BLOCK *****
*/
@ -2270,6 +2270,137 @@ static void psys_update_effectors(ParticleSimulationData *sim)
precalc_guides(sim, sim->psys->effectors);
}
/*************************************************
SPH fluid physics
In theory, there could be unlimited implementation
of SPH simulators
**************************************************/
void particle_fluidsim(ParticleSystem *psys, ParticleData *pa, ParticleSettings *part, ParticleSimulationData *sim, float dfra, float cfra, float mass){
/****************************************************************************************************************
* This code uses in some parts adapted algorithms from the pseduo code as outlined in the Research paper
* Titled: Particle-based Viscoelastic Fluid Simulation.
* Authors: Simon Clavet, Philippe Beaudoin and Pierre Poulin
*
* Website: http://www.iro.umontreal.ca/labs/infographie/papers/Clavet-2005-PVFS/
* Presented at Siggraph, (2005)
*
*****************************************************************************************************************/
KDTree *tree = psys->tree;
KDTreeNearest *ptn = NULL;
SPHFluidSettings *fluid = part->fluid;
ParticleData *second_particle;
float start[3], end[3], v[3];
float temp[3];
float q, radius, D;
float p, pnear, pressure_near, pressure;
float dtime = dfra * psys_get_timestep(sim);
float omega = fluid->viscosity_omega;
float beta = fluid->viscosity_omega;
float massfactor = 1.0f/mass;
int n, neighbours;
radius = fluid->radius;
VECCOPY(start, pa->prev_state.co);
VECCOPY(end, pa->state.co);
sub_v3_v3v3(v, end, start);
mul_v3_fl(v, 1.f/dtime);
neighbours = BLI_kdtree_range_search(tree, radius, start, NULL, &ptn);
/* use ptn[n].co to store relative direction */
for(n=1; n<neighbours; n++) {
sub_v3_v3(ptn[n].co, start);
normalize_v3(ptn[n].co);
}
/* Viscosity - Algorithm 5 */
if (omega > 0.f || beta > 0.f) {
float u, I;
for(n=1; n<neighbours; n++) {
second_particle = psys->particles + ptn[n].index;
q = ptn[n].dist/radius;
sub_v3_v3v3(temp, v, second_particle->prev_state.vel);
u = dot_v3v3(ptn[n].co, temp);
if (u > 0){
I = dtime * ((1-q) * (omega * u + beta * u*u)) * 0.5f;
madd_v3_v3fl(v, ptn[n].co, -I * massfactor);
}
}
}
/* Hooke's spring force */
if (fluid->spring_k > 0.f) {
float D, L = fluid->rest_length;
for(n=1; n<neighbours; n++) {
/* L is a factor of radius */
D = dtime * 10.f * fluid->spring_k * (1.f - L) * (L - ptn[n].dist/radius);
madd_v3_v3fl(v, ptn[n].co, -D * massfactor);
}
}
/* Update particle position */
VECADDFAC(end, start, v, dtime);
/* Double Density Relaxation - Algorithm 2 */
p = 0;
pnear = 0;
for(n=1; n<neighbours; n++) {
q = ptn[n].dist/radius;
p += ((1-q)*(1-q));
pnear += ((1-q)*(1-q)*(1-q));
}
p *= part->mass;
pnear *= part->mass;
pressure = fluid->stiffness_k * (p - fluid->rest_density);
pressure_near = fluid->stiffness_knear * pnear;
for(n=1; n<neighbours; n++) {
q = ptn[n].dist/radius;
D = dtime * dtime * (pressure*(1-q) + pressure_near*(1-q)*(1-q))* 0.5f;
madd_v3_v3fl(end, ptn[n].co, -D * massfactor);
}
/* Artificial buoyancy force in negative gravity direction */
if (fluid->buoyancy >= 0.f && psys_uses_gravity(sim)) {
float B = -dtime * dtime * fluid->buoyancy * (p - fluid->rest_density) * 0.5f;
madd_v3_v3fl(end, sim->scene->physics_settings.gravity, -B * massfactor);
}
/* apply final result and recalculate velocity */
VECCOPY(pa->state.co, end);
sub_v3_v3v3(pa->state.vel, end, start);
mul_v3_fl(pa->state.vel, 1.f/dtime);
if(ptn){ MEM_freeN(ptn); ptn=NULL;}
}
static void apply_particle_fluidsim(ParticleSystem *psys, ParticleData *pa, ParticleSettings *part, ParticleSimulationData *sim, float dfra, float cfra){
ParticleTarget *pt;
float dtime = dfra*psys_get_timestep(sim);
float particle_mass = part->mass;
particle_fluidsim(psys, pa, part, sim, dfra, cfra, particle_mass);
/*----check other SPH systems (Multifluids) , each fluid has its own parameters---*/
for(pt=sim->psys->targets.first; pt; pt=pt->next) {
ParticleSystem *epsys = psys_get_target_system(sim->ob, pt);
if(epsys)
particle_fluidsim(epsys, pa, epsys->part, sim, dfra, cfra, particle_mass);
}
/*----------------------------------------------------------------*/
}
/************************************************/
/* Newtonian physics */
/************************************************/
@ -2799,7 +2930,7 @@ static void deflect_particle(ParticleSimulationData *sim, int p, float dfra, flo
deflections=max_deflections;
}
else {
float nor_vec[3], tan_vec[3], tan_vel[3], vel[3];
float nor_vec[3], tan_vec[3], tan_vel[3];
float damp, frict;
float inp, inp_v;
@ -3248,6 +3379,14 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
psys_update_particle_tree(BLI_findlink(&pt->ob->particlesystem, pt->psys-1), cfra);
}
}
else if(part->phystype==PART_PHYS_FLUID){
ParticleTarget *pt = psys->targets.first;
psys_update_particle_tree(psys, cfra);
for(; pt; pt=pt->next) { /* Updating others systems particle tree for fluid-fluid interaction */
if(pt->ob) psys_update_particle_tree(BLI_findlink(&pt->ob->particlesystem, pt->psys-1), cfra);
}
}
/* main loop: calculate physics for all particles */
LOOP_SHOWN_PARTICLES {
@ -3318,6 +3457,22 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
}
break;
}
case PART_PHYS_FLUID:
{
/* do global forces & effectors */
apply_particle_forces(sim, p, pa_dfra, cfra);
/* do fluid sim */
apply_particle_fluidsim(psys, pa, part, sim, pa_dfra, cfra);
/* deflection */
if(sim->colliders)
deflect_particle(sim, p, pa_dfra, cfra);
/* rotations, SPH particles are not physical particles, just interpolation particles, thus rotation has not a direct sense for them */
rotate_particle(part, pa, pa_dfra, timestep);
break;
}
}
if(pa->alive == PARS_DYING){
@ -3727,6 +3882,21 @@ void psys_check_boid_data(ParticleSystem *psys)
pa->boid = NULL;
}
}
static void fluid_default_settings(ParticleSettings *part){
SPHFluidSettings *fluid = part->fluid;
fluid->radius = 0.5f;
fluid->spring_k = 0.f;
fluid->rest_length = 0.5f;
fluid->viscosity_omega = 2.f;
fluid->viscosity_beta = 0.f;
fluid->stiffness_k = 0.1f;
fluid->stiffness_knear = 0.05f;
fluid->rest_density = 10.f;
fluid->buoyancy = 0.f;
}
static void psys_changed_physics(ParticleSimulationData *sim)
{
ParticleSettings *part = sim->psys->part;
@ -3756,6 +3926,10 @@ static void psys_changed_physics(ParticleSimulationData *sim)
state->flag |= BOIDSTATE_CURRENT;
BLI_addtail(&part->boids->states, state);
}
else if(part->phystype == PART_PHYS_FLUID && part->fluid == NULL) {
part->fluid = MEM_callocN(sizeof(SPHFluidSettings), "SPH Fluid Settings");
fluid_default_settings(part);
}
psys_check_boid_data(sim->psys);
}

@ -48,6 +48,7 @@
#include "WM_api.h"
#include "BKE_anim.h"
#include "BKE_blender.h"
#include "BKE_cloth.h"
#include "BKE_depsgraph.h"
@ -90,6 +91,9 @@
#define PTCACHE_DATA_FROM(data, type, from) if(data[type]) { memcpy(data[type], from, ptcache_data_size[type]); }
#define PTCACHE_DATA_TO(data, type, index, to) if(data[type]) { memcpy(to, (char*)data[type] + (index ? index * ptcache_data_size[type] : 0), ptcache_data_size[type]); }
/* could be made into a pointcache option */
#define DURIAN_POINTCACHE_LIB_OK 1
int ptcache_data_size[] = {
sizeof(int), // BPHYS_DATA_INDEX
3 * sizeof(float), // BPHYS_DATA_LOCATION:
@ -556,7 +560,7 @@ static void ptcache_interpolate_cloth(int index, void *cloth_v, void **data, flo
static int ptcache_totpoint_cloth(void *cloth_v, int cfra)
{
ClothModifierData *clmd= cloth_v;
return clmd->clothObject->numverts;
return clmd->clothObject ? clmd->clothObject->numverts : 0;
}
/* Creating ID's */
@ -982,7 +986,7 @@ void BKE_ptcache_id_from_cloth(PTCacheID *pid, Object *ob, ClothModifierData *cl
pid->info_types= 0;
}
void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob)
void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int duplis)
{
PTCacheID *pid;
ParticleSystem *psys;
@ -1024,6 +1028,23 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob)
}
}
}
if(scene && (duplis-- > 0) && (ob->transflag & OB_DUPLI)) {
ListBase *lb_dupli_ob;
if((lb_dupli_ob=object_duplilist(scene, ob))) {
DupliObject *dob;
for(dob= lb_dupli_ob->first; dob; dob= dob->next) {
ListBase lb_dupli_pid;
BKE_ptcache_ids_from_object(&lb_dupli_pid, dob->ob, scene, duplis);
addlisttolist(lb, &lb_dupli_pid);
if(lb_dupli_pid.first)
printf("Adding Dupli\n");
}
free_object_duplilist(lb_dupli_ob); /* does restore */
}
}
}
@ -1132,10 +1153,11 @@ static PTCacheFile *ptcache_file_open(PTCacheID *pid, int mode, int cfra)
FILE *fp = NULL;
char filename[(FILE_MAXDIR+FILE_MAXFILE)*2];
#ifndef DURIAN_POINTCACHE_LIB_OK
/* don't allow writing for linked objects */
if(pid->ob->id.lib && mode == PTCACHE_FILE_WRITE)
return NULL;
#endif
if (!G.relbase_valid && (pid->cache->flag & PTCACHE_EXTERNAL)==0) return NULL; /* save blend file before using disk pointcache */
BKE_ptcache_id_filename(pid, filename, cfra, 1, 1);
@ -1873,9 +1895,11 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, int cfra)
if(!pid->cache || pid->cache->flag & PTCACHE_BAKED)
return;
#ifndef DURIAN_POINTCACHE_LIB_OK
/* don't allow clearing for linked objects */
if(pid->ob->id.lib)
return;
#endif
/*if (!G.relbase_valid) return; *//* save blend file before using pointcache */
@ -2303,14 +2327,15 @@ PointCache *BKE_ptcache_copy_list(ListBase *ptcaches_new, ListBase *ptcaches_old
/* Baking */
static int count_quick_cache(Scene *scene, int *quick_step)
{
Base *base = scene->base.first;
Base *base;
PTCacheID *pid;
ListBase pidlist;
int autocache_count= 0;
Scene *sce; /* for macro only */
for(base = scene->base.first; base; base = base->next) {
for(SETLOOPER(scene, base)) {
if(base->object) {
BKE_ptcache_ids_from_object(&pidlist, base->object);
BKE_ptcache_ids_from_object(&pidlist, base->object, scene, MAX_DUPLI_RECUR);
for(pid=pidlist.first; pid; pid=pid->next) {
if((pid->cache->flag & PTCACHE_BAKED)
@ -2377,6 +2402,7 @@ static void *ptcache_make_cache_thread(void *ptr) {
void BKE_ptcache_make_cache(PTCacheBaker* baker)
{
Scene *scene = baker->scene;
Scene *sce; /* SETLOOPER macro only */
Base *base;
ListBase pidlist;
PTCacheID *pid = baker->pid;
@ -2408,7 +2434,7 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker)
/* get all pids from the object and search for smoke low res */
ListBase pidlist2;
PTCacheID *pid2;
BKE_ptcache_ids_from_object(&pidlist2, pid->ob);
BKE_ptcache_ids_from_object(&pidlist2, pid->ob, scene, MAX_DUPLI_RECUR);
for(pid2=pidlist2.first; pid2; pid2=pid2->next) {
if(pid2->type == PTCACHE_TYPE_SMOKE_DOMAIN)
{
@ -2441,9 +2467,9 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker)
cache->flag &= ~PTCACHE_BAKED;
}
}
else for(base=scene->base.first; base; base= base->next) {
for(SETLOOPER(scene, base)) {
/* cache/bake everything in the scene */
BKE_ptcache_ids_from_object(&pidlist, base->object);
BKE_ptcache_ids_from_object(&pidlist, base->object, scene, MAX_DUPLI_RECUR);
for(pid=pidlist.first; pid; pid=pid->next) {
cache = pid->cache;
@ -2524,8 +2550,8 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker)
BKE_ptcache_write_cache(pid, 0);
}
}
else for(base=scene->base.first; base; base= base->next) {
BKE_ptcache_ids_from_object(&pidlist, base->object);
else for(SETLOOPER(scene, base)) {
BKE_ptcache_ids_from_object(&pidlist, base->object, scene, MAX_DUPLI_RECUR);
for(pid=pidlist.first; pid; pid=pid->next) {
/* skip hair particles */

@ -898,15 +898,20 @@ float frame_to_float (Scene *scene, int cfra) /* see also bsystem_time in objec
return ctime;
}
static void scene_update_newframe(Scene *sce, unsigned int lay)
static void scene_update_newframe(Scene *scene, int cfra, unsigned int lay)
{
Base *base;
Object *ob;
int cfra_back= scene->r.cfra;
scene->r.cfra= cfra;
for(base= sce->base.first; base; base= base->next) {
for(base= scene->base.first; base; base= base->next) {
ob= base->object;
object_handle_update(sce, ob); // bke_object.h
object_handle_update(scene, ob); // bke_object.h
if(ob->dup_group && (ob->transflag & OB_DUPLIGROUP))
group_handle_recalc_and_update(scene, ob, ob->dup_group);
/* only update layer when an ipo */
// XXX old animation system
@ -914,6 +919,8 @@ static void scene_update_newframe(Scene *sce, unsigned int lay)
// base->lay= ob->lay;
//}
}
scene->r.cfra= cfra_back;
}
/* this is called in main loop, doing tagged updates before redraw */
@ -921,6 +928,7 @@ void scene_update_tagged(Scene *scene)
{
Scene *sce;
Base *base;
Object *ob;
float ctime = frame_to_float(scene, scene->r.cfra);
/* update all objects: drivers, matrices, displists, etc. flags set
@ -929,12 +937,23 @@ void scene_update_tagged(Scene *scene)
/* sets first, we allow per definition current scene to have
dependencies on sets, but not the other way around. */
if(scene->set) {
for(SETLOOPER(scene->set, base))
object_handle_update(scene, base->object);
for(SETLOOPER(scene->set, base)) {
ob= base->object;
object_handle_update(scene, ob);
if(ob->dup_group && (ob->transflag & OB_DUPLIGROUP))
group_handle_recalc_and_update(scene, ob, ob->dup_group);
}
}
for(base= scene->base.first; base; base= base->next) {
object_handle_update(scene, base->object);
ob= base->object;
object_handle_update(scene, ob);
if(ob->dup_group && (ob->transflag & OB_DUPLIGROUP))
group_handle_recalc_and_update(scene, ob, ob->dup_group);
}
/* recalc scene animation data here (for sequencer) */
@ -945,6 +964,7 @@ void scene_update_tagged(Scene *scene)
BKE_animsys_evaluate_animdata(&scene->id, adt, ctime, 0);
}
/* XXX - this is called far to often, should be made apart of the depgraph */
BKE_ptcache_quick_cache_all(scene);
/* in the future this should handle updates for all datablocks, not
@ -981,10 +1001,11 @@ void scene_update_for_newframe(Scene *sce, unsigned int lay)
/* sets first, we allow per definition current scene to have dependencies on sets */
for(sce_iter= sce->set; sce_iter; sce_iter= sce_iter->set)
scene_update_newframe(sce_iter, lay);
for(sce_iter= sce->set; sce_iter; sce_iter= sce_iter->set) {
scene_update_newframe(sce_iter, sce->r.cfra, lay);
}
scene_update_newframe(sce, lay);
scene_update_newframe(sce, sce->r.cfra, lay);
}
/* return default layer, also used to patch old files */
@ -1039,3 +1060,26 @@ float get_render_aosss_error(RenderData *r, float error)
return error;
}
/* helper function for the SETLOOPER macro */
Base *_setlooper_base_step(Scene **sce, Base *base)
{
if(base && base->next) {
/* common case, step to the next */
return base->next;
}
else if(base==NULL && (*sce)->base.first) {
/* first time looping, return the scenes first base */
return (Base *)(*sce)->base.first;
}
else {
/* reached the end, get the next base in the set */
while((*sce= (*sce)->set)) {
base= (Base *)(*sce)->base.first;
if(base) {
return base;
}
}
}
return NULL;
}

@ -1750,19 +1750,15 @@ static void input_preprocess(Scene *scene, Sequence *seq, TStripElem *se, int cf
if(seq->flag & SEQ_MAKE_FLOAT) {
if (!se->ibuf->rect_float) {
if (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) {
IMB_float_from_rect(se->ibuf);
} else {
int profile = IB_PROFILE_NONE;
/* no color management:
* don't disturb the existing profiles */
SWAP(int, se->ibuf->profile, profile);
int profile = IB_PROFILE_NONE;
/* no color management:
* don't disturb the existing profiles */
SWAP(int, se->ibuf->profile, profile);
IMB_float_from_rect(se->ibuf);
SWAP(int, se->ibuf->profile, profile);
}
IMB_float_from_rect(se->ibuf);
SWAP(int, se->ibuf->profile, profile);
}
if (se->ibuf->rect) {
imb_freerectImBuf(se->ibuf);

@ -1156,10 +1156,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
framenr = scene->r.cfra;
// printf("time: %d\n", scene->r.cfra);
if(framenr == smd->time)
return;
printf("time: %d\n", scene->r.cfra);
cache = sds->point_cache[0];
BKE_ptcache_id_from_smoke(&pid, ob, smd);
@ -1206,11 +1203,23 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
if(cache_result_wt == PTCACHE_READ_EXACT)
{
BKE_ptcache_validate(cache_wt, framenr);
return;
}
else
{
; /* don't return in the case we only got low res cache but no high res cache */
/* we still need to calculate the high res cache */
}
}
return;
else
return;
}
/* only calculate something when we advanced a frame */
if(framenr == smd->time)
return;
tstart();
smoke_calc_domain(scene, ob, smd);

@ -74,8 +74,6 @@ extern "C" {
#include "BLI_listbase.h"
#include "BLI_dynamiclist.h"
#include "BLI_string.h"
#include "BLI_path_util.h"

@ -1,65 +0,0 @@
/**
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Contributor(s): Jiri Hnidek.
*
* Documentation of Two way dynamic list with access array can be found at:
*
* http://wiki.blender.org/bin/view.pl/Blenderwiki/DynamicListWithAccessArray
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef BLI_DYNAMIC_LIST_H
#define BLI_DYNAMIC_LIST_H
#include "DNA_listBase.h"
/*
* Access array using realloc
*/
typedef struct DynamicArray{
unsigned int count; /* count of items in list */
unsigned int max_item_index; /* max available index */
unsigned int last_item_index; /* max used index */
void **items; /* dynamicaly allocated array of pointers
pointing at items in list */
} DynamicArray;
/*
* Two way dynamic list with access array
*/
typedef struct DynamicList {
struct DynamicArray da; /* access array */
struct ListBase lb; /* two way linked dynamic list */
} DynamicList;
/* note: 'index' is a string.h function, do not use in includes */
struct DynamicList *BLI_dlist_from_listbase(struct ListBase *);
struct ListBase *BLI_listbase_from_dlist(struct DynamicList *, struct ListBase *);
void * BLI_dlist_find_link(struct DynamicList *, unsigned int);
unsigned int BLI_count_items(struct DynamicList *);
void BLI_dlist_free_item(struct DynamicList *, unsigned int);
void BLI_dlist_rem_item(struct DynamicList *, unsigned int);
void * BLI_dlist_add_item_index(struct DynamicList *, void *, unsigned int);
void BLI_dlist_destroy(struct DynamicList *);
void BLI_dlist_init(struct DynamicList *);
void BLI_dlist_reinit(struct DynamicList *);
#endif

@ -32,9 +32,9 @@
#ifndef BLI_LISTBASE_H
#define BLI_LISTBASE_H
//#include "DNA_listbase.h"
struct ListBase;
struct LinkData;
#include "DNA_listBase.h"
//struct ListBase;
//struct LinkData;
#ifdef __cplusplus
extern "C" {

@ -41,20 +41,25 @@ extern "C" {
#define BLI_PR_NONE 0
#define BLI_PR_SRGB 1
#define BLI_PR_REC709 2
/* YCbCr */
#define BLI_YCC_ITU_BT601 0
#define BLI_YCC_ITU_BT709 1
#define BLI_YCC_JFIF_0_255 2
/******************* Conversion to RGB ********************/
void hsv_to_rgb(float h, float s, float v, float *r, float *g, float *b);
void hex_to_rgb(char *hexcol, float *r, float *g, float *b);
void yuv_to_rgb(float y, float u, float v, float *lr, float *lg, float *lb);
void ycc_to_rgb(float y, float cb, float cr, float *lr, float *lg, float *lb);
void ycc_to_rgb(float y, float cb, float cr, float *lr, float *lg, float *lb, int colorspace);
void xyz_to_rgb(float x, float y, float z, float *r, float *g, float *b, int colorspace);
void cpack_to_rgb(unsigned int col, float *r, float *g, float *b);
/***************** Conversion from RGB ********************/
void rgb_to_yuv(float r, float g, float b, float *ly, float *lu, float *lv);
void rgb_to_ycc(float r, float g, float b, float *ly, float *lcb, float *lcr);
void rgb_to_ycc(float r, float g, float b, float *ly, float *lcb, float *lcr, int colorspace);
void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv);
unsigned int rgb_to_cpack(float r, float g, float b);
unsigned int hsv_to_cpack(float h, float s, float v);

@ -1,264 +0,0 @@
/* util.c
*
* various string, file, list operations.
*
*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*
*/
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
#include "BLI_dynamiclist.h"
#define PAGE_SIZE 4
/*=====================================================================================*/
/* Methods for access array (realloc) */
/*=====================================================================================*/
/* remove item with index */
static void rem_array_item(struct DynamicArray *da, unsigned int index)
{
da->items[index]=NULL;
da->count--;
if(index==da->last_item_index){
while((!da->items[da->last_item_index]) && (da->last_item_index>0)){
da->last_item_index--;
}
}
}
/* add array (if needed, then realloc) */
static void add_array_item(struct DynamicArray *da, void *item, unsigned int index)
{
/* realloc of access array */
if(da->max_item_index < index){
unsigned int i, max = da->max_item_index;
void **nitems;
do {
da->max_item_index += PAGE_SIZE; /* OS can allocate only PAGE_SIZE Bytes */
} while(da->max_item_index<=index);
nitems = (void**)MEM_mallocN(sizeof(void*)*(da->max_item_index+1), "dlist access array");
for(i=0;i<=max;i++)
nitems[i] = da->items[i];
/* set rest pointers to the NULL */
for(i=max+1; i<=da->max_item_index; i++)
nitems[i]=NULL;
MEM_freeN(da->items); /* free old access array */
da->items = nitems;
}
da->items[index] = item;
da->count++;
if(index > da->last_item_index) da->last_item_index = index;
}
/* free access array */
static void destroy_array(DynamicArray *da)
{
da->count=0;
da->last_item_index=0;
da->max_item_index=0;
MEM_freeN(da->items);
da->items = NULL;
}
/* initialize dynamic array */
static void init_array(DynamicArray *da)
{
unsigned int i;
da->count=0;
da->last_item_index=0;
da->max_item_index = PAGE_SIZE-1;
da->items = (void*)MEM_mallocN(sizeof(void*)*(da->max_item_index+1), "dlist access array");
for(i=0; i<=da->max_item_index; i++) da->items[i]=NULL;
}
/* reinitialize dynamic array */
static void reinit_array(DynamicArray *da)
{
destroy_array(da);
init_array(da);
}
/*=====================================================================================*/
/* Methods for two way dynamic list with access array */
/*=====================================================================================*/
/* create new two way dynamic list with access array from two way dynamic list
* it doesn't copy any items to new array or something like this It is strongly
* recomended to use BLI_dlist_ methods for adding/removing items from dynamic list
* unless you can end with inconsistence system !!! */
DynamicList *BLI_dlist_from_listbase(ListBase *lb)
{
DynamicList *dlist;
Link *item;
int i=0, count;
if(!lb) return NULL;
count = BLI_countlist(lb);
dlist = MEM_mallocN(sizeof(DynamicList), "temp dynamic list");
/* ListBase stuff */
dlist->lb.first = lb->first;
dlist->lb.last = lb->last;
/* access array stuff */
dlist->da.count=count;
dlist->da.max_item_index = count-1;
dlist->da.last_item_index = count -1;
dlist->da.items = (void*)MEM_mallocN(sizeof(void*)*count, "temp dlist access array");
item = (Link*)lb->first;
while(item){
dlist->da.items[i] = (void*)item;
item = item->next;
i++;
}
/* to prevent you of using original ListBase :-) */
lb->first = lb->last = NULL;
return dlist;
}
/* take out ListBase from DynamicList and destroy all temporary structures of DynamicList */
ListBase *BLI_listbase_from_dlist(DynamicList *dlist, ListBase *lb)
{
if(!dlist) return NULL;
if(!lb) lb = (ListBase*)MEM_mallocN(sizeof(ListBase), "ListBase");
lb->first = dlist->lb.first;
lb->last = dlist->lb.last;
/* free all items of access array */
MEM_freeN(dlist->da.items);
/* free DynamicList*/
MEM_freeN(dlist);
return lb;
}
/* return pointer at item from th dynamic list with access array */
void *BLI_dlist_find_link(DynamicList *dlist, unsigned int index)
{
if(!dlist || !dlist->da.items) return NULL;
if((index <= dlist->da.last_item_index) && (index >= 0) && (dlist->da.count>0)){
return dlist->da.items[index];
}
else {
return NULL;
}
}
/* return count of items in the dynamic list with access array */
unsigned int BLI_count_items(DynamicList *dlist)
{
if(!dlist) return 0;
return dlist->da.count;
}
/* free item from the dynamic list with access array */
void BLI_dlist_free_item(DynamicList *dlist, unsigned int index)
{
if(!dlist || !dlist->da.items) return;
if((index <= dlist->da.last_item_index) && (dlist->da.items[index])){
BLI_freelinkN(&(dlist->lb), dlist->da.items[index]);
rem_array_item(&(dlist->da), index);
}
}
/* remove item from the dynamic list with access array */
void BLI_dlist_rem_item(DynamicList *dlist, unsigned int index)
{
if(!dlist || !dlist->da.items) return;
if((index <= dlist->da.last_item_index) && (dlist->da.items[index])){
BLI_remlink(&(dlist->lb), dlist->da.items[index]);
rem_array_item(&(dlist->da), index);
}
}
/* add item to the dynamic list with access array (index) */
void* BLI_dlist_add_item_index(DynamicList *dlist, void *item, unsigned int index)
{
if(!dlist || !dlist->da.items) return NULL;
if((index <= dlist->da.max_item_index) && (dlist->da.items[index])) {
/* you can't place item at used index */
return NULL;
}
else {
add_array_item(&(dlist->da), item, index);
BLI_addtail(&(dlist->lb), item);
return item;
}
}
/* destroy dynamic list with access array */
void BLI_dlist_destroy(DynamicList *dlist)
{
if(!dlist) return;
BLI_freelistN(&(dlist->lb));
destroy_array(&(dlist->da));
}
/* initialize dynamic list with access array */
void BLI_dlist_init(DynamicList *dlist)
{
if(!dlist) return;
dlist->lb.first = NULL;
dlist->lb.last = NULL;
init_array(&(dlist->da));
}
/* reinitialize dynamic list with acces array */
void BLI_dlist_reinit(DynamicList *dlist)
{
if(!dlist) return;
BLI_freelistN(&(dlist->lb));
reinit_array(&(dlist->da));
}
/*=====================================================================================*/

@ -109,7 +109,9 @@ void yuv_to_rgb(float y, float u, float v, float *lr, float *lg, float *lb)
*lb=b;
}
void rgb_to_ycc(float r, float g, float b, float *ly, float *lcb, float *lcr)
/* The RGB inputs are supposed gamma corrected and in the range 0 - 1.0f */
/* Output YCC have a range of 16-235 and 16-240 exepect with JFIF_0_255 where the range is 0-255 */
void rgb_to_ycc(float r, float g, float b, float *ly, float *lcb, float *lcr, int colorspace)
{
float sr,sg, sb;
float y, cr, cb;
@ -118,24 +120,53 @@ void rgb_to_ycc(float r, float g, float b, float *ly, float *lcb, float *lcr)
sg=255.0f*g;
sb=255.0f*b;
y=(0.257f*sr)+(0.504f*sg)+(0.098f*sb)+16.0f;
cb=(-0.148f*sr)-(0.291f*sg)+(0.439f*sb)+128.0f;
cr=(0.439f*sr)-(0.368f*sg)-(0.071f*sb)+128.0f;
switch (colorspace) {
case BLI_YCC_ITU_BT601 :
y=(0.257f*sr)+(0.504f*sg)+(0.098f*sb)+16.0f;
cb=(-0.148f*sr)-(0.291f*sg)+(0.439f*sb)+128.0f;
cr=(0.439f*sr)-(0.368f*sg)-(0.071f*sb)+128.0f;
break;
case BLI_YCC_ITU_BT709 :
y=(0.183f*sr)+(0.614f*sg)+(0.062f*sb)+16.0f;
cb=(-0.101f*sr)-(0.338f*sg)+(0.439f*sb)+128.0f;
cr=(0.439f*sr)-(0.399f*sg)-(0.040f*sb)+128.0f;
break;
case BLI_YCC_JFIF_0_255 :
y=(0.299f*sr)+(0.587f*sg)+(0.114f*sb)+16.0f;
cb=(-0.16874f*sr)-(0.33126f*sg)+(0.5f*sb)+128.0f;
cr=(0.5f*sr)-(0.41869f*sg)-(0.08131f*sb)+128.0f;
break;
}
*ly=y;
*lcb=cb;
*lcr=cr;
}
void ycc_to_rgb(float y, float cb, float cr, float *lr, float *lg, float *lb)
/* YCC input have a range of 16-235 and 16-240 exepect with JFIF_0_255 where the range is 0-255 */
/* RGB outputs are in the range 0 - 1.0f */
void ycc_to_rgb(float y, float cb, float cr, float *lr, float *lg, float *lb, int colorspace)
{
float r,g,b;
r=1.164f*(y-16.0f)+1.596f*(cr-128.0f);
g=1.164f*(y-16.0f)-0.813f*(cr-128.0f)-0.392f*(cb-128.0f);
b=1.164f*(y-16.0f)+2.017f*(cb-128.0f);
switch (colorspace) {
case BLI_YCC_ITU_BT601 :
r=1.164f*(y-16.0f)+1.596f*(cr-128.0f);
g=1.164f*(y-16.0f)-0.813f*(cr-128.0f)-0.392f*(cb-128.0f);
b=1.164f*(y-16.0f)+2.017f*(cb-128.0f);
break;
case BLI_YCC_ITU_BT709 :
r=1.164f*(y-16.0f)+1.793f*(cr-128.0f);
g=1.164f*(y-16.0f)-0.534f*(cr-128.0f)-0.213f*(cb-128.0f);
b=1.164f*(y-16.0f)+2.115f*(cb-128.0f);
break;
case BLI_YCC_JFIF_0_255 :
r=y+1.402f*cr - 179.456f;
g=y-0.34414f*cb - 0.71414f*cr + 135.45984f;
b=y+1.772f*cb - 226.816f;
break;
}
*lr=r/255.0f;
*lg=g/255.0f;
*lb=b/255.0f;

@ -791,34 +791,6 @@ char *BLI_gethome(void) {
}
}
}
#if 0
ret = getenv("USERPROFILE");
if (ret) {
if (BLI_exists(ret)) { /* from fop, also below... */
sprintf(dir, "%s\\Application Data\\Blender Foundation\\Blender", ret);
BLI_recurdir_fileops(dir);
if (BLI_exists(dir)) {
strcat(dir,"\\.blender");
if(BLI_exists(dir)) return(dir);
}
}
}
#endif
/*
Saving in the Windows dir is less than desirable.
Use as a last resort ONLY! (aphex)
*/
ret = getenv("WINDOWS");
if (ret) {
if(BLI_exists(ret)) return ret;
}
ret = getenv("WINDIR");
if (ret) {
if(BLI_exists(ret)) return ret;
}
return "C:\\Temp"; /* sheesh! bad, bad, bad! (aphex) */
#endif

@ -293,10 +293,8 @@ void BLI_adddirstrings()
struct direntry * file;
struct tm *tm;
time_t zero= 0;
file = &files[0];
for(num=0;num<actnum;num++){
for(num=0, file= files; num<actnum; num++, file++){
#ifdef WIN32
mode = 0;
strcpy(file->mode1, types[0]);
@ -325,43 +323,43 @@ void BLI_adddirstrings()
#endif
#ifdef WIN32
strcpy(files[num].owner,"user");
strcpy(file->owner,"user");
#else
{
struct passwd *pwuser;
pwuser = getpwuid(files[num].s.st_uid);
pwuser = getpwuid(file->s.st_uid);
if ( pwuser ) {
strcpy(files[num].owner, pwuser->pw_name);
BLI_strncpy(file->owner, pwuser->pw_name, sizeof(file->owner));
} else {
sprintf(files[num].owner, "%d", files[num].s.st_uid);
snprintf(file->owner, sizeof(file->owner), "%d", file->s.st_uid);
}
}
#endif
tm= localtime(&files[num].s.st_mtime);
tm= localtime(&file->s.st_mtime);
// prevent impossible dates in windows
if(tm==NULL) tm= localtime(&zero);
strftime(files[num].time, 8, "%H:%M", tm);
strftime(files[num].date, 16, "%d-%b-%y", tm);
strftime(file->time, 8, "%H:%M", tm);
strftime(file->date, 16, "%d-%b-%y", tm);
/*
* Seems st_size is signed 32-bit value in *nix and Windows. This
* will buy us some time until files get bigger than 4GB or until
* everyone starts using __USE_FILE_OFFSET64 or equivalent.
*/
st_size= files[num].s.st_size;
st_size= file->s.st_size;
if (st_size > 1024*1024*1024) {
sprintf(files[num].size, "%.2f GB", ((double)st_size)/(1024*1024*1024));
sprintf(file->size, "%.2f GB", ((double)st_size)/(1024*1024*1024));
}
else if (st_size > 1024*1024) {
sprintf(files[num].size, "%.1f MB", ((double)st_size)/(1024*1024));
sprintf(file->size, "%.1f MB", ((double)st_size)/(1024*1024));
}
else if (st_size > 1024) {
sprintf(files[num].size, "%d KB", (int)(st_size/1024));
sprintf(file->size, "%d KB", (int)(st_size/1024));
}
else {
sprintf(files[num].size, "%d B", (int)st_size);
sprintf(file->size, "%d B", (int)st_size);
}
strftime(datum, 32, "%d-%b-%y %H:%M", tm);
@ -377,15 +375,13 @@ void BLI_adddirstrings()
sprintf(size, "%10d", (int) st_size);
}
sprintf(buf,"%s %s %s %7s %s %s %10s %s", file->mode1, file->mode2, file->mode3, files[num].owner, files[num].date, files[num].time, size,
files[num].relname);
sprintf(buf,"%s %s %s %7s %s %s %10s %s", file->mode1, file->mode2, file->mode3, file->owner, file->date, file->time, size,
file->relname);
files[num].string=MEM_mallocN(strlen(buf)+1, "filestring");
if (files[num].string){
strcpy(files[num].string,buf);
file->string=MEM_mallocN(strlen(buf)+1, "filestring");
if (file->string){
strcpy(file->string,buf);
}
file++;
}
}

@ -120,7 +120,7 @@
#include "BKE_group.h"
#include "BKE_image.h"
#include "BKE_lattice.h"
#include "BKE_library.h" // for wich_libbase
#include "BKE_library.h" // for which_libbase
#include "BKE_main.h" // for Main
#include "BKE_mesh.h" // for ME_ defines (patching)
#include "BKE_modifier.h"
@ -429,7 +429,7 @@ static void split_libdata(ListBase *lb, Main *first)
mainvar= first;
while(mainvar) {
if(mainvar->curlib==id->lib) {
lbn= wich_libbase(mainvar, GS(id->name));
lbn= which_libbase(mainvar, GS(id->name));
BLI_remlink(lb, id);
BLI_addtail(lbn, id);
break;
@ -3038,6 +3038,7 @@ static void direct_link_particlesettings(FileData *fd, ParticleSettings *part)
link_list(fd, &part->dupliweights);
part->boids= newdataadr(fd, part->boids);
part->fluid= newdataadr(fd, part->fluid);
if(part->boids) {
BoidState *state;
@ -4689,7 +4690,7 @@ static void *restore_pointer_by_name(Main *mainp, ID *id, int user)
{
if(id) {
ListBase *lb= wich_libbase(mainp, GS(id->name));
ListBase *lb= which_libbase(mainp, GS(id->name));
if(lb) { // there's still risk of checking corrupt mem (freed Ids in oops)
ID *idn= lb->first;
@ -5382,10 +5383,10 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID
/* do after read_struct, for dna reconstruct */
if(bhead->code==ID_ID) {
lb= wich_libbase(main, GS(id->name));
lb= which_libbase(main, GS(id->name));
}
else {
lb= wich_libbase(main, bhead->code);
lb= which_libbase(main, bhead->code);
}
BLI_addtail(lb, id);
@ -10964,8 +10965,8 @@ char *bhead_id_name(FileData *fd, BHead *bhead)
static ID *is_yet_read(FileData *fd, Main *mainvar, BHead *bhead)
{
const char *idname= bhead_id_name(fd, bhead);
/* wich_libbase can be NULL, intentionally not using idname+2 */
return BLI_findstring(wich_libbase(mainvar, GS(idname)), idname, offsetof(ID, name));
/* which_libbase can be NULL, intentionally not using idname+2 */
return BLI_findstring(which_libbase(mainvar, GS(idname)), idname, offsetof(ID, name));
}
static void expand_doit(FileData *fd, Main *mainvar, void *old)
@ -12135,8 +12136,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
if(fd==NULL) {
/* printf and reports for now... its important users know this */
printf("read library: %s\n", mainptr->curlib->name);
BKE_reportf(basefd->reports, RPT_INFO, "read library: '%s'\n", mainptr->curlib->name);
printf("read library: '%s', '%s'\n", mainptr->curlib->filename, mainptr->curlib->name);
BKE_reportf(basefd->reports, RPT_INFO, "read library: '%s', '%s'\n", mainptr->curlib->filename, mainptr->curlib->name);
fd= blo_openblenderfile(mainptr->curlib->filename, basefd->reports);

@ -652,6 +652,9 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase)
for(; state; state=state->next)
write_boid_state(wd, state);
}
if(part->fluid && part->phystype == PART_PHYS_FLUID){
writestruct(wd, DATA, "SPHFluidSettings", 1, part->fluid);
}
}
part= part->id.next;
}

@ -1948,7 +1948,7 @@ protected:
addSampler(sampler);
std::string target = translate_id(ob_name)
+ "/" + get_transform_sid(fcu->rna_path, -1, axis_name);
+ "/" + get_transform_sid(fcu->rna_path, -1, axis_name, true);
addChannel(COLLADABU::URI(empty, sampler_id), target);
closeAnimation();
@ -2096,7 +2096,7 @@ protected:
if (axis > -1)
axis_name = axis_names[axis];
std::string transform_sid = get_transform_sid(NULL, tm_type, axis_name);
std::string transform_sid = get_transform_sid(NULL, tm_type, axis_name, false);
BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char*)translate_id(ob_name).c_str(),
(char*)translate_id(bone_name).c_str(), (char*)transform_sid.c_str());
@ -2367,24 +2367,47 @@ protected:
return source_id;
}
std::string get_transform_sid(char *rna_path, int tm_type, const char *axis_name)
// for rotation, axis name is always appended and the value of append_axis is ignored
std::string get_transform_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis)
{
std::string tm_name;
// when given rna_path, determine tm_type from it
if (rna_path) {
char *name = extract_transform_name(rna_path);
if (strstr(name, "rotation"))
return std::string("rotation") + std::string(axis_name) + ".ANGLE";
else if (!strcmp(name, "location") || !strcmp(name, "scale"))
return std::string(name);
}
else {
if (tm_type == 0)
return std::string("rotation") + std::string(axis_name) + ".ANGLE";
tm_type = 0;
else if (!strcmp(name, "scale"))
tm_type = 1;
else if (!strcmp(name, "location"))
tm_type = 2;
else
return tm_type == 1 ? "scale" : "location";
tm_type = -1;
}
return NULL;
switch (tm_type) {
case 0:
return std::string("rotation") + std::string(axis_name) + ".ANGLE";
case 1:
tm_name = "scale";
break;
case 2:
tm_name = "location";
break;
default:
tm_name = "";
break;
}
if (tm_name.size()) {
if (append_axis)
return tm_name + std::string(".") + std::string(axis_name);
else
return tm_name;
}
return std::string("");
}
char *extract_transform_name(char *rna_path)

@ -273,6 +273,23 @@ public:
{
unit_converter->dae_matrix_to_mat4(m, ((COLLADAFW::Matrix*)tm)->getMatrix());
}
void dae_translate_to_v3(COLLADAFW::Transformation *tm, float v[3])
{
dae_vector3_to_v3(((COLLADAFW::Translate*)tm)->getTranslation(), v);
}
void dae_scale_to_v3(COLLADAFW::Transformation *tm, float v[3])
{
dae_vector3_to_v3(((COLLADAFW::Scale*)tm)->getScale(), v);
}
void dae_vector3_to_v3(const COLLADABU::Math::Vector3 &v3, float v[3])
{
v[0] = v3.x;
v[1] = v3.y;
v[2] = v3.z;
}
};
// only for ArmatureImporter to "see" MeshImporter::get_object_by_geom_uid
@ -2398,10 +2415,7 @@ public:
float rest[4][4], irest[4][4];
if (is_joint) {
if (is_joint)
get_joint_rest_mat(irest_dae, root, node);
else
evaluate_transform_at_frame(irest_dae, node, 0.0f);
get_joint_rest_mat(irest_dae, root, node);
invert_m4(irest_dae);
Bone *bone = get_named_bone((bArmature*)ob->data, bone_name);
@ -2471,11 +2485,12 @@ public:
float fra = *it;
float mat[4][4];
float matfra[4][4];
unit_m4(mat);
unit_m4(matfra);
// calc object-space mat
evaluate_transform_at_frame(mat, node, fra);
evaluate_transform_at_frame(matfra, node, fra);
// for joints, we need a special matrix
if (is_joint) {
@ -2486,13 +2501,16 @@ public:
// calc M
calc_joint_parent_mat_rest(par, NULL, root, node);
mul_m4_m4m4(temp, mat, par);
mul_m4_m4m4(temp, matfra, par);
// evaluate_joint_world_transform_at_frame(temp, NULL, , node, fra);
// calc special matrix
mul_serie_m4(mat, irest, temp, irest_dae, rest, NULL, NULL, NULL, NULL);
}
else {
copy_m4_m4(mat, matfra);
}
float val[4];
@ -2517,17 +2535,15 @@ public:
#ifdef ARMATURE_TEST
if (is_joint) {
evaluate_transform_at_frame(mat, node, fra);
switch (tm_type) {
case COLLADAFW::Transformation::ROTATE:
mat4_to_quat(val, mat);
mat4_to_quat(val, matfra);
break;
case COLLADAFW::Transformation::SCALE:
mat4_to_size(val, mat);
mat4_to_size(val, matfra);
break;
case COLLADAFW::Transformation::TRANSLATE:
copy_v3_v3(val, mat[3]);
copy_v3_v3(val, matfra[3]);
break;
default:
break;
@ -2611,89 +2627,100 @@ public:
}
}
// return true to indicate that mat contains a sane value
bool evaluate_animation(COLLADAFW::Transformation *tm, float mat[4][4], float fra)
{
const COLLADAFW::UniqueId& listid = tm->getAnimationList();
COLLADAFW::Transformation::TransformationType type = tm->getTransformationType();
if (animlist_map.find(listid) != animlist_map.end()) {
const COLLADAFW::AnimationList *animlist = animlist_map[listid];
const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings();
if (type != COLLADAFW::Transformation::ROTATE && type != COLLADAFW::Transformation::SCALE &&
type != COLLADAFW::Transformation::TRANSLATE) {
fprintf(stderr, "animation of transformation %d is not supported yet\n", type);
return false;
}
if (bindings.getCount()) {
for (unsigned int j = 0; j < bindings.getCount(); j++) {
std::vector<FCurve*>& curves = curve_map[bindings[j].animation];
COLLADAFW::AnimationList::AnimationClass animclass = bindings[j].animationClass;
COLLADAFW::Transformation::TransformationType type = tm->getTransformationType();
bool xyz = ((type == COLLADAFW::Transformation::TRANSLATE || type == COLLADAFW::Transformation::SCALE) && bindings[j].animationClass == COLLADAFW::AnimationList::POSITION_XYZ);
if (animlist_map.find(listid) == animlist_map.end())
return false;
if (type == COLLADAFW::Transformation::ROTATE) {
if (curves.size() != 1) {
fprintf(stderr, "expected 1 curve, got %u\n", curves.size());
const COLLADAFW::AnimationList *animlist = animlist_map[listid];
const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings();
if (bindings.getCount()) {
float vec[3];
bool is_scale = (type == COLLADAFW::Transformation::SCALE);
if (type == COLLADAFW::Transformation::SCALE)
dae_scale_to_v3(tm, vec);
else if (type == COLLADAFW::Transformation::TRANSLATE)
dae_translate_to_v3(tm, vec);
for (unsigned int j = 0; j < bindings.getCount(); j++) {
const COLLADAFW::AnimationList::AnimationBinding& binding = bindings[j];
std::vector<FCurve*>& curves = curve_map[binding.animation];
COLLADAFW::AnimationList::AnimationClass animclass = binding.animationClass;
if (type == COLLADAFW::Transformation::ROTATE) {
if (curves.size() != 1) {
fprintf(stderr, "expected 1 curve, got %u\n", curves.size());
return false;
}
else {
if (animclass == COLLADAFW::AnimationList::ANGLE) {
COLLADABU::Math::Vector3& axis = ((COLLADAFW::Rotate*)tm)->getRotationAxis();
float ax[3] = {axis[0], axis[1], axis[2]};
float angle = evaluate_fcurve(curves[0], fra);
axis_angle_to_mat4(mat, ax, angle);
return true;
}
else {
if (animclass == COLLADAFW::AnimationList::ANGLE) {
COLLADABU::Math::Vector3& axis = ((COLLADAFW::Rotate*)tm)->getRotationAxis();
float ax[3] = {axis[0], axis[1], axis[2]};
float angle = evaluate_fcurve(curves[0], fra);
axis_angle_to_mat4(mat, ax, angle);
return true;
}
else {
// TODO support other animclasses
fprintf(stderr, "<rotate> animclass %d is not supported yet\n", bindings[j].animationClass);
}
// TODO support other animclasses
fprintf(stderr, "<rotate> animclass %d is not supported yet\n", animclass);
return false;
}
}
else if (type == COLLADAFW::Transformation::SCALE || type == COLLADAFW::Transformation::TRANSLATE) {
if ((!xyz && curves.size() == 1) || (xyz && curves.size() == 3)) {
bool animated = true;
bool scale = (type == COLLADAFW::Transformation::SCALE);
}
else {
bool is_xyz = animclass == COLLADAFW::AnimationList::POSITION_XYZ;
float vec[3] = {0.0f, 0.0f, 0.0f};
if (scale)
vec[0] = vec[1] = vec[2] = 1.0f;
switch (animclass) {
case COLLADAFW::AnimationList::POSITION_X:
vec[0] = evaluate_fcurve(curves[0], fra);
break;
case COLLADAFW::AnimationList::POSITION_Y:
vec[1] = evaluate_fcurve(curves[0], fra);
break;
case COLLADAFW::AnimationList::POSITION_Z:
vec[2] = evaluate_fcurve(curves[0], fra);
break;
case COLLADAFW::AnimationList::POSITION_XYZ:
vec[0] = evaluate_fcurve(curves[0], fra);
vec[1] = evaluate_fcurve(curves[1], fra);
vec[2] = evaluate_fcurve(curves[2], fra);
break;
default:
fprintf(stderr, "<%s> animclass %d is not supported yet\n", scale ? "scale" : "translate", animclass);
animated = false;
break;
}
if (animated) {
if (scale)
size_to_mat4(mat, vec);
else
copy_v3_v3(mat[3], vec);
}
return animated;
}
else {
fprintf(stderr, "expected 1 or 3 curves, got %u, animclass is %d\n", curves.size(), animclass);
if ((!is_xyz && curves.size() == 1) || (is_xyz && curves.size() == 3)) {
switch (animclass) {
case COLLADAFW::AnimationList::POSITION_X:
vec[0] = evaluate_fcurve(curves[0], fra);
break;
case COLLADAFW::AnimationList::POSITION_Y:
vec[1] = evaluate_fcurve(curves[0], fra);
break;
case COLLADAFW::AnimationList::POSITION_Z:
vec[2] = evaluate_fcurve(curves[0], fra);
break;
case COLLADAFW::AnimationList::POSITION_XYZ:
vec[0] = evaluate_fcurve(curves[0], fra);
vec[1] = evaluate_fcurve(curves[1], fra);
vec[2] = evaluate_fcurve(curves[2], fra);
break;
default:
fprintf(stderr, "<%s> animclass %d is not supported yet\n", is_scale ? "scale" : "translate", animclass);
break;
}
}
else {
// not very useful for user
fprintf(stderr, "animation of transformation %d is not supported yet\n", type);
if (is_xyz)
fprintf(stderr, "expected 3 curves, got %u, animclass=%d\n", curves.size(), animclass);
else
fprintf(stderr, "expected 1 curve, got %u, animclass=%d\n", curves.size(), animclass);
return false;
}
}
}
if (is_scale)
size_to_mat4(mat, vec);
else
copy_v3_v3(mat[3], vec);
return true;
}
return false;

@ -307,11 +307,11 @@ AnimData *ANIM_nla_mapping_get(bAnimContext *ac, bAnimListElem *ale)
/* ------------------- */
/* helper function for ANIM_nla_mapping_apply_fcurve() -> "restore", i.e. mapping points back to action-time */
static short bezt_nlamapping_restore(BeztEditData *bed, BezTriple *bezt)
static short bezt_nlamapping_restore(KeyframeEditData *ked, BezTriple *bezt)
{
/* AnimData block providing scaling is stored in 'data', only_keys option is stored in i1 */
AnimData *adt= (AnimData *)bed->data;
short only_keys= (short)bed->i1;
AnimData *adt= (AnimData *)ked->data;
short only_keys= (short)ked->i1;
/* adjust BezTriple handles only if allowed to */
if (only_keys == 0) {
@ -325,11 +325,11 @@ static short bezt_nlamapping_restore(BeztEditData *bed, BezTriple *bezt)
}
/* helper function for ANIM_nla_mapping_apply_fcurve() -> "apply", i.e. mapping points to NLA-mapped global time */
static short bezt_nlamapping_apply(BeztEditData *bed, BezTriple *bezt)
static short bezt_nlamapping_apply(KeyframeEditData *ked, BezTriple *bezt)
{
/* AnimData block providing scaling is stored in 'data', only_keys option is stored in i1 */
AnimData *adt= (AnimData*)bed->data;
short only_keys= (short)bed->i1;
AnimData *adt= (AnimData*)ked->data;
short only_keys= (short)ked->i1;
/* adjust BezTriple handles only if allowed to */
if (only_keys == 0) {
@ -349,16 +349,16 @@ static short bezt_nlamapping_apply(BeztEditData *bed, BezTriple *bezt)
*/
void ANIM_nla_mapping_apply_fcurve (AnimData *adt, FCurve *fcu, short restore, short only_keys)
{
BeztEditData bed;
BeztEditFunc map_cb;
KeyframeEditData ked;
KeyframeEditFunc map_cb;
/* init edit data
* - AnimData is stored in 'data'
* - only_keys is stored in 'i1'
*/
memset(&bed, 0, sizeof(BeztEditData));
bed.data= (void *)adt;
bed.i1= (int)only_keys;
memset(&ked, 0, sizeof(KeyframeEditData));
ked.data= (void *)adt;
ked.i1= (int)only_keys;
/* get editing callback */
if (restore)
@ -367,7 +367,7 @@ void ANIM_nla_mapping_apply_fcurve (AnimData *adt, FCurve *fcu, short restore, s
map_cb= bezt_nlamapping_apply;
/* apply to F-Curve */
ANIM_fcurve_keys_bezier_loop(&bed, fcu, NULL, map_cb, NULL);
ANIM_fcurve_keyframes_loop(&ked, fcu, NULL, map_cb, NULL);
}
/* *************************************************** */
@ -409,12 +409,12 @@ float ANIM_unit_mapping_get_factor (Scene *scene, ID *id, FCurve *fcu, short res
/* ----------------------- */
/* helper function for ANIM_unit_mapping_apply_fcurve -> mapping callback for unit mapping */
static short bezt_unit_mapping_apply (BeztEditData *bed, BezTriple *bezt)
static short bezt_unit_mapping_apply (KeyframeEditData *ked, BezTriple *bezt)
{
/* mapping factor is stored in f1, flags are stored in i1 */
short only_keys= (bed->i1 & ANIM_UNITCONV_ONLYKEYS);
short sel_vs= (bed->i1 & ANIM_UNITCONV_SELVERTS);
float fac= bed->f1;
short only_keys= (ked->i1 & ANIM_UNITCONV_ONLYKEYS);
short sel_vs= (ked->i1 & ANIM_UNITCONV_SELVERTS);
float fac= ked->f1;
/* adjust BezTriple handles only if allowed to */
if (only_keys == 0) {
@ -433,8 +433,8 @@ static short bezt_unit_mapping_apply (BeztEditData *bed, BezTriple *bezt)
/* Apply/Unapply units conversions to keyframes */
void ANIM_unit_mapping_apply_fcurve (Scene *scene, ID *id, FCurve *fcu, short flag)
{
BeztEditData bed;
BeztEditFunc sel_cb;
KeyframeEditData ked;
KeyframeEditFunc sel_cb;
float fac;
/* calculate mapping factor, and abort if nothing to change */
@ -446,9 +446,9 @@ void ANIM_unit_mapping_apply_fcurve (Scene *scene, ID *id, FCurve *fcu, short fl
* - mapping factor is stored in f1
* - flags are stored in 'i1'
*/
memset(&bed, 0, sizeof(BeztEditData));
bed.f1= (float)fac;
bed.i1= (int)flag;
memset(&ked, 0, sizeof(KeyframeEditData));
ked.f1= (float)fac;
ked.i1= (int)flag;
/* only selected? */
if (flag & ANIM_UNITCONV_ONLYSEL)
@ -457,7 +457,7 @@ void ANIM_unit_mapping_apply_fcurve (Scene *scene, ID *id, FCurve *fcu, short fl
sel_cb= NULL;
/* apply to F-Curve */
ANIM_fcurve_keys_bezier_loop(&bed, fcu, sel_cb, bezt_unit_mapping_apply, NULL);
ANIM_fcurve_keyframes_loop(&ked, fcu, sel_cb, bezt_unit_mapping_apply, NULL);
// FIXME: loop here for samples should be generalised
// TODO: only sel?

@ -61,6 +61,7 @@
#include "ED_util.h"
#include "ED_numinput.h"
#include "ED_object.h"
#include "ED_types.h"
/* ************* Marker API **************** */

@ -572,19 +572,19 @@ static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, sho
/* block 2: start range settings */
col= uiLayoutColumn(layout, 1);
uiItemR(col, &ptr, "use_start_frame", 0, NULL, 0);
uiItemR(col, &ptr, "use_frame_start", 0, NULL, 0);
subcol = uiLayoutColumn(col, 1);
uiLayoutSetActive(subcol, RNA_boolean_get(&ptr, "use_start_frame"));
uiItemR(subcol, &ptr, "start_frame", 0, NULL, 0);
uiLayoutSetActive(subcol, RNA_boolean_get(&ptr, "use_frame_start"));
uiItemR(subcol, &ptr, "frame_start", 0, NULL, 0);
/* block 3: end range settings */
col= uiLayoutColumn(layout, 1);
uiItemR(col, &ptr, "use_end_frame", 0, NULL, 0);
uiItemR(col, &ptr, "use_frame_end", 0, NULL, 0);
subcol = uiLayoutColumn(col, 1);
uiLayoutSetActive(subcol, RNA_boolean_get(&ptr, "use_end_frame"));
uiItemR(subcol, &ptr, "end_frame", 0, NULL, 0);
uiItemR(subcol, &ptr, "frame_end", 0, NULL, 0);
}
/* --------------- */

@ -61,7 +61,7 @@
/* This file defines an API and set of callback-operators for non-destructive editing of keyframe data.
*
* Two API functions are defined for actually performing the operations on the data:
* ANIM_fcurve_keys_bezier_loop()
* ANIM_fcurve_keyframes_loop()
* which take the data they operate on, a few callbacks defining what operations to perform.
*
* As operators which work on keyframes usually apply the same operation on all BezTriples in
@ -84,56 +84,56 @@
/* This function is used to loop over BezTriples in the given F-Curve, applying a given
* operation on them, and optionally applies an F-Curve validation function afterwards.
*/
short ANIM_fcurve_keys_bezier_loop(BeztEditData *bed, FCurve *fcu, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb)
short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, FCurve *fcu, KeyframeEditFunc bezt_ok, KeyframeEditFunc bezt_cb, FcuEditFunc fcu_cb)
{
BezTriple *bezt;
int i;
BezTriple *bezt;
int i;
/* sanity check */
if (ELEM(NULL, fcu, fcu->bezt))
return 0;
/* set the F-Curve into the editdata so that it can be accessed */
if (bed) {
bed->fcu= fcu;
bed->curIndex= 0;
}
if (ked) {
ked->fcu= fcu;
ked->curIndex= 0;
}
/* if function to apply to bezier curves is set, then loop through executing it on beztriples */
if (bezt_cb) {
if (bezt_cb) {
/* if there's a validation func, include that check in the loop
* (this is should be more efficient than checking for it in every loop)
*/
if (bezt_ok) {
for (bezt=fcu->bezt, i=0; i < fcu->totvert; bezt++, i++) {
if (bed) bed->curIndex= i;
if (ked) ked->curIndex= i;
/* Only operate on this BezTriple if it fullfills the criteria of the validation func */
if (bezt_ok(bed, bezt)) {
if (bezt_ok(ked, bezt)) {
/* Exit with return-code '1' if function returns positive
* This is useful if finding if some BezTriple satisfies a condition.
*/
if (bezt_cb(bed, bezt)) return 1;
if (bezt_cb(ked, bezt)) return 1;
}
}
}
else {
for (bezt=fcu->bezt, i=0; i < fcu->totvert; bezt++, i++) {
if (bed) bed->curIndex= i;
if (ked) ked->curIndex= i;
/* Exit with return-code '1' if function returns positive
* This is useful if finding if some BezTriple satisfies a condition.
*/
if (bezt_cb(bed, bezt)) return 1;
* This is useful if finding if some BezTriple satisfies a condition.
*/
if (bezt_cb(ked, bezt)) return 1;
}
}
}
}
/* unset the F-Curve from the editdata now that it's done */
if (bed) {
bed->fcu= NULL;
bed->curIndex= 0;
}
if (ked) {
ked->fcu= NULL;
ked->curIndex= 0;
}
/* if fcu_cb (F-Curve post-editing callback) has been specified then execute it */
if (fcu_cb)
@ -146,7 +146,7 @@ short ANIM_fcurve_keys_bezier_loop(BeztEditData *bed, FCurve *fcu, BeztEditFunc
/* -------------------------------- Further Abstracted (Not Exposed Directly) ----------------------------- */
/* This function is used to loop over the keyframe data in an Action Group */
static short agrp_keys_bezier_loop(BeztEditData *bed, bActionGroup *agrp, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb)
static short agrp_keyframes_loop(KeyframeEditData *ked, bActionGroup *agrp, KeyframeEditFunc bezt_ok, KeyframeEditFunc bezt_cb, FcuEditFunc fcu_cb)
{
FCurve *fcu;
@ -156,7 +156,7 @@ static short agrp_keys_bezier_loop(BeztEditData *bed, bActionGroup *agrp, BeztEd
/* only iterate over the F-Curves that are in this group */
for (fcu= agrp->channels.first; fcu && fcu->grp==agrp; fcu= fcu->next) {
if (ANIM_fcurve_keys_bezier_loop(bed, fcu, bezt_ok, bezt_cb, fcu_cb))
if (ANIM_fcurve_keyframes_loop(ked, fcu, bezt_ok, bezt_cb, fcu_cb))
return 1;
}
@ -164,7 +164,7 @@ static short agrp_keys_bezier_loop(BeztEditData *bed, bActionGroup *agrp, BeztEd
}
/* This function is used to loop over the keyframe data in an Action */
static short act_keys_bezier_loop(BeztEditData *bed, bAction *act, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb)
static short act_keyframes_loop(KeyframeEditData *ked, bAction *act, KeyframeEditFunc bezt_ok, KeyframeEditFunc bezt_cb, FcuEditFunc fcu_cb)
{
FCurve *fcu;
@ -174,7 +174,7 @@ static short act_keys_bezier_loop(BeztEditData *bed, bAction *act, BeztEditFunc
/* just loop through all F-Curves */
for (fcu= act->curves.first; fcu; fcu= fcu->next) {
if (ANIM_fcurve_keys_bezier_loop(bed, fcu, bezt_ok, bezt_cb, fcu_cb))
if (ANIM_fcurve_keyframes_loop(ked, fcu, bezt_ok, bezt_cb, fcu_cb))
return 1;
}
@ -182,7 +182,7 @@ static short act_keys_bezier_loop(BeztEditData *bed, bAction *act, BeztEditFunc
}
/* This function is used to loop over the keyframe data of an AnimData block */
static short adt_keys_bezier_loop(BeztEditData *bed, AnimData *adt, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb, int filterflag)
static short adt_keyframes_loop(KeyframeEditData *ked, AnimData *adt, KeyframeEditFunc bezt_ok, KeyframeEditFunc bezt_cb, FcuEditFunc fcu_cb, int filterflag)
{
/* sanity check */
if (adt == NULL)
@ -194,13 +194,13 @@ static short adt_keys_bezier_loop(BeztEditData *bed, AnimData *adt, BeztEditFunc
/* just loop through all F-Curves acting as Drivers */
for (fcu= adt->drivers.first; fcu; fcu= fcu->next) {
if (ANIM_fcurve_keys_bezier_loop(bed, fcu, bezt_ok, bezt_cb, fcu_cb))
if (ANIM_fcurve_keyframes_loop(ked, fcu, bezt_ok, bezt_cb, fcu_cb))
return 1;
}
}
else if (adt->action) {
/* call the function for actions */
if (act_keys_bezier_loop(bed, adt->action, bezt_ok, bezt_cb, fcu_cb))
if (act_keyframes_loop(ked, adt->action, bezt_ok, bezt_cb, fcu_cb))
return 1;
}
@ -208,7 +208,7 @@ static short adt_keys_bezier_loop(BeztEditData *bed, AnimData *adt, BeztEditFunc
}
/* This function is used to loop over the keyframe data in an Object */
static short ob_keys_bezier_loop(BeztEditData *bed, Object *ob, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb, int filterflag)
static short ob_keyframes_loop(KeyframeEditData *ked, Object *ob, KeyframeEditFunc bezt_ok, KeyframeEditFunc bezt_cb, FcuEditFunc fcu_cb, int filterflag)
{
Key *key= ob_get_key(ob);
@ -218,13 +218,13 @@ static short ob_keys_bezier_loop(BeztEditData *bed, Object *ob, BeztEditFunc bez
/* firstly, Object's own AnimData */
if (ob->adt) {
if (adt_keys_bezier_loop(bed, ob->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
if (adt_keyframes_loop(ked, ob->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
return 1;
}
/* shapekeys */
if ((key && key->adt) && !(filterflag & ADS_FILTER_NOSHAPEKEYS)) {
if (adt_keys_bezier_loop(bed, key->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
if (adt_keyframes_loop(ked, key->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
return 1;
}
@ -240,7 +240,7 @@ static short ob_keys_bezier_loop(BeztEditData *bed, Object *ob, BeztEditFunc bez
continue;
/* add material's data */
if (adt_keys_bezier_loop(bed, ma->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
if (adt_keyframes_loop(ked, ma->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
return 1;
}
}
@ -252,7 +252,7 @@ static short ob_keys_bezier_loop(BeztEditData *bed, Object *ob, BeztEditFunc bez
Camera *ca= (Camera *)ob->data;
if ((ca->adt) && !(filterflag & ADS_FILTER_NOCAM)) {
if (adt_keys_bezier_loop(bed, ca->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
if (adt_keyframes_loop(ked, ca->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
return 1;
}
}
@ -262,7 +262,7 @@ static short ob_keys_bezier_loop(BeztEditData *bed, Object *ob, BeztEditFunc bez
Lamp *la= (Lamp *)ob->data;
if ((la->adt) && !(filterflag & ADS_FILTER_NOLAM)) {
if (adt_keys_bezier_loop(bed, la->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
if (adt_keyframes_loop(ked, la->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
return 1;
}
}
@ -274,7 +274,7 @@ static short ob_keys_bezier_loop(BeztEditData *bed, Object *ob, BeztEditFunc bez
Curve *cu= (Curve *)ob->data;
if ((cu->adt) && !(filterflag & ADS_FILTER_NOCUR)) {
if (adt_keys_bezier_loop(bed, cu->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
if (adt_keyframes_loop(ked, cu->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
return 1;
}
}
@ -284,7 +284,7 @@ static short ob_keys_bezier_loop(BeztEditData *bed, Object *ob, BeztEditFunc bez
MetaBall *mb= (MetaBall *)ob->data;
if ((mb->adt) && !(filterflag & ADS_FILTER_NOMBA)) {
if (adt_keys_bezier_loop(bed, mb->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
if (adt_keyframes_loop(ked, mb->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
return 1;
}
}
@ -294,7 +294,7 @@ static short ob_keys_bezier_loop(BeztEditData *bed, Object *ob, BeztEditFunc bez
bArmature *arm= (bArmature *)ob->data;
if ((arm->adt) && !(filterflag & ADS_FILTER_NOARM)) {
if (adt_keys_bezier_loop(bed, arm->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
if (adt_keyframes_loop(ked, arm->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
return 1;
}
}
@ -304,7 +304,7 @@ static short ob_keys_bezier_loop(BeztEditData *bed, Object *ob, BeztEditFunc bez
Mesh *me= (Mesh *)ob->data;
if ((me->adt) && !(filterflag & ADS_FILTER_NOMESH)) {
if (adt_keys_bezier_loop(bed, me->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
if (adt_keyframes_loop(ked, me->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
return 1;
}
}
@ -319,7 +319,7 @@ static short ob_keys_bezier_loop(BeztEditData *bed, Object *ob, BeztEditFunc bez
if (ELEM(NULL, psys->part, psys->part->adt))
continue;
if (adt_keys_bezier_loop(bed, psys->part->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
if (adt_keyframes_loop(ked, psys->part->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
return 1;
}
}
@ -328,7 +328,7 @@ static short ob_keys_bezier_loop(BeztEditData *bed, Object *ob, BeztEditFunc bez
}
/* This function is used to loop over the keyframe data in a Scene */
static short scene_keys_bezier_loop(BeztEditData *bed, Scene *sce, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb, int filterflag)
static short scene_keyframes_loop(KeyframeEditData *ked, Scene *sce, KeyframeEditFunc bezt_ok, KeyframeEditFunc bezt_cb, FcuEditFunc fcu_cb, int filterflag)
{
World *wo= (sce) ? sce->world : NULL;
bNodeTree *ntree= (sce) ? sce->nodetree : NULL;
@ -339,19 +339,19 @@ static short scene_keys_bezier_loop(BeztEditData *bed, Scene *sce, BeztEditFunc
/* Scene's own animation */
if (sce->adt) {
if (adt_keys_bezier_loop(bed, sce->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
if (adt_keyframes_loop(ked, sce->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
return 1;
}
/* World */
if (wo && wo->adt) {
if (adt_keys_bezier_loop(bed, wo->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
if (adt_keyframes_loop(ked, wo->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
return 1;
}
/* NodeTree */
if (ntree && ntree->adt) {
if (adt_keys_bezier_loop(bed, ntree->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
if (adt_keyframes_loop(ked, ntree->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
return 1;
}
@ -360,7 +360,7 @@ static short scene_keys_bezier_loop(BeztEditData *bed, Scene *sce, BeztEditFunc
}
/* This function is used to loop over the keyframe data in a DopeSheet summary */
static short summary_keys_bezier_loop(BeztEditData *bed, bAnimContext *ac, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb, int filterflag)
static short summary_keyframes_loop(KeyframeEditData *ked, bAnimContext *ac, KeyframeEditFunc bezt_ok, KeyframeEditFunc bezt_cb, FcuEditFunc fcu_cb, int filterflag)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@ -376,7 +376,7 @@ static short summary_keys_bezier_loop(BeztEditData *bed, bAnimContext *ac, BeztE
/* loop through each F-Curve, working on the keyframes until the first curve aborts */
for (ale= anim_data.first; ale; ale= ale->next) {
ret_code= ANIM_fcurve_keys_bezier_loop(bed, ale->data, bezt_ok, bezt_cb, fcu_cb);
ret_code= ANIM_fcurve_keyframes_loop(ked, ale->data, bezt_ok, bezt_cb, fcu_cb);
if (ret_code)
break;
@ -390,7 +390,7 @@ static short summary_keys_bezier_loop(BeztEditData *bed, bAnimContext *ac, BeztE
/* --- */
/* This function is used to apply operation to all keyframes, regardless of the type */
short ANIM_animchannel_keys_bezier_loop(BeztEditData *bed, bAnimListElem *ale, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb, int filterflag)
short ANIM_animchannel_keyframes_loop(KeyframeEditData *ked, bAnimListElem *ale, KeyframeEditFunc bezt_ok, KeyframeEditFunc bezt_cb, FcuEditFunc fcu_cb, int filterflag)
{
/* sanity checks */
if (ale == NULL)
@ -400,29 +400,29 @@ short ANIM_animchannel_keys_bezier_loop(BeztEditData *bed, bAnimListElem *ale, B
switch (ale->datatype) {
/* direct keyframe data (these loops are exposed) */
case ALE_FCURVE: /* F-Curve */
return ANIM_fcurve_keys_bezier_loop(bed, ale->key_data, bezt_ok, bezt_cb, fcu_cb);
return ANIM_fcurve_keyframes_loop(ked, ale->key_data, bezt_ok, bezt_cb, fcu_cb);
/* indirect 'summaries' (these are not exposed directly)
* NOTE: must keep this code in sync with the drawing code and also the filtering code!
*/
case ALE_GROUP: /* action group */
return agrp_keys_bezier_loop(bed, (bActionGroup *)ale->data, bezt_ok, bezt_cb, fcu_cb);
return agrp_keyframes_loop(ked, (bActionGroup *)ale->data, bezt_ok, bezt_cb, fcu_cb);
case ALE_ACT: /* action */
return act_keys_bezier_loop(bed, (bAction *)ale->key_data, bezt_ok, bezt_cb, fcu_cb);
return act_keyframes_loop(ked, (bAction *)ale->key_data, bezt_ok, bezt_cb, fcu_cb);
case ALE_OB: /* object */
return ob_keys_bezier_loop(bed, (Object *)ale->key_data, bezt_ok, bezt_cb, fcu_cb, filterflag);
return ob_keyframes_loop(ked, (Object *)ale->key_data, bezt_ok, bezt_cb, fcu_cb, filterflag);
case ALE_SCE: /* scene */
return scene_keys_bezier_loop(bed, (Scene *)ale->data, bezt_ok, bezt_cb, fcu_cb, filterflag);
return scene_keyframes_loop(ked, (Scene *)ale->data, bezt_ok, bezt_cb, fcu_cb, filterflag);
case ALE_ALL: /* 'all' (DopeSheet summary) */
return summary_keys_bezier_loop(bed, (bAnimContext *)ale->data, bezt_ok, bezt_cb, fcu_cb, filterflag);
return summary_keyframes_loop(ked, (bAnimContext *)ale->data, bezt_ok, bezt_cb, fcu_cb, filterflag);
}
return 0;
}
/* This function is used to apply operation to all keyframes, regardless of the type without needed an AnimListElem wrapper */
short ANIM_animchanneldata_keys_bezier_loop(BeztEditData *bed, void *data, int keytype, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb, int filterflag)
short ANIM_animchanneldata_keyframes_loop(KeyframeEditData *ked, void *data, int keytype, KeyframeEditFunc bezt_ok, KeyframeEditFunc bezt_cb, FcuEditFunc fcu_cb, int filterflag)
{
/* sanity checks */
if (data == NULL)
@ -432,22 +432,22 @@ short ANIM_animchanneldata_keys_bezier_loop(BeztEditData *bed, void *data, int k
switch (keytype) {
/* direct keyframe data (these loops are exposed) */
case ALE_FCURVE: /* F-Curve */
return ANIM_fcurve_keys_bezier_loop(bed, data, bezt_ok, bezt_cb, fcu_cb);
return ANIM_fcurve_keyframes_loop(ked, data, bezt_ok, bezt_cb, fcu_cb);
/* indirect 'summaries' (these are not exposed directly)
* NOTE: must keep this code in sync with the drawing code and also the filtering code!
*/
case ALE_GROUP: /* action group */
return agrp_keys_bezier_loop(bed, (bActionGroup *)data, bezt_ok, bezt_cb, fcu_cb);
return agrp_keyframes_loop(ked, (bActionGroup *)data, bezt_ok, bezt_cb, fcu_cb);
case ALE_ACT: /* action */
return act_keys_bezier_loop(bed, (bAction *)data, bezt_ok, bezt_cb, fcu_cb);
return act_keyframes_loop(ked, (bAction *)data, bezt_ok, bezt_cb, fcu_cb);
case ALE_OB: /* object */
return ob_keys_bezier_loop(bed, (Object *)data, bezt_ok, bezt_cb, fcu_cb, filterflag);
return ob_keyframes_loop(ked, (Object *)data, bezt_ok, bezt_cb, fcu_cb, filterflag);
case ALE_SCE: /* scene */
return scene_keys_bezier_loop(bed, (Scene *)data, bezt_ok, bezt_cb, fcu_cb, filterflag);
return scene_keyframes_loop(ked, (Scene *)data, bezt_ok, bezt_cb, fcu_cb, filterflag);
case ALE_ALL: /* 'all' (DopeSheet summary) */
return summary_keys_bezier_loop(bed, (bAnimContext *)data, bezt_ok, bezt_cb, fcu_cb, filterflag);
return summary_keyframes_loop(ked, (bAnimContext *)data, bezt_ok, bezt_cb, fcu_cb, filterflag);
}
return 0;
@ -484,50 +484,50 @@ void ANIM_editkeyframes_refresh(bAnimContext *ac)
/* ************************************************************************** */
/* BezTriple Validation Callbacks */
static short ok_bezier_frame(BeztEditData *bed, BezTriple *bezt)
static short ok_bezier_frame(KeyframeEditData *ked, BezTriple *bezt)
{
/* frame is stored in f1 property (this float accuracy check may need to be dropped?) */
return IS_EQ(bezt->vec[1][0], bed->f1);
return IS_EQ(bezt->vec[1][0], ked->f1);
}
static short ok_bezier_framerange(BeztEditData *bed, BezTriple *bezt)
static short ok_bezier_framerange(KeyframeEditData *ked, BezTriple *bezt)
{
/* frame range is stored in float properties */
return ((bezt->vec[1][0] > bed->f1) && (bezt->vec[1][0] < bed->f2));
return ((bezt->vec[1][0] > ked->f1) && (bezt->vec[1][0] < ked->f2));
}
static short ok_bezier_selected(BeztEditData *bed, BezTriple *bezt)
static short ok_bezier_selected(KeyframeEditData *ked, BezTriple *bezt)
{
/* this macro checks all beztriple handles for selection... */
return BEZSELECTED(bezt);
}
static short ok_bezier_value(BeztEditData *bed, BezTriple *bezt)
static short ok_bezier_value(KeyframeEditData *ked, BezTriple *bezt)
{
/* value is stored in f1 property
* - this float accuracy check may need to be dropped?
* - should value be stored in f2 instead so that we won't have conflicts when using f1 for frames too?
*/
return IS_EQ(bezt->vec[1][1], bed->f1);
return IS_EQ(bezt->vec[1][1], ked->f1);
}
static short ok_bezier_valuerange(BeztEditData *bed, BezTriple *bezt)
static short ok_bezier_valuerange(KeyframeEditData *ked, BezTriple *bezt)
{
/* value range is stored in float properties */
return ((bezt->vec[1][1] > bed->f1) && (bezt->vec[1][1] < bed->f2));
return ((bezt->vec[1][1] > ked->f1) && (bezt->vec[1][1] < ked->f2));
}
static short ok_bezier_region(BeztEditData *bed, BezTriple *bezt)
static short ok_bezier_region(KeyframeEditData *ked, BezTriple *bezt)
{
/* rect is stored in data property (it's of type rectf, but may not be set) */
if (bed->data)
return BLI_in_rctf(bed->data, bezt->vec[1][0], bezt->vec[1][1]);
if (ked->data)
return BLI_in_rctf(ked->data, bezt->vec[1][0], bezt->vec[1][1]);
else
return 0;
}
BeztEditFunc ANIM_editkeyframes_ok(short mode)
KeyframeEditFunc ANIM_editkeyframes_ok(short mode)
{
/* eEditKeyframes_Validate */
switch (mode) {
@ -552,32 +552,32 @@ BeztEditFunc ANIM_editkeyframes_ok(short mode)
/* Assorted Utility Functions */
/* helper callback for <animeditor>_cfrasnap_exec() -> used to help get the average time of all selected beztriples */
short bezt_calc_average(BeztEditData *bed, BezTriple *bezt)
short bezt_calc_average(KeyframeEditData *ked, BezTriple *bezt)
{
/* only if selected */
if (bezt->f2 & SELECT) {
/* store average time in float 1 (only do rounding at last step) */
bed->f1 += bezt->vec[1][0];
ked->f1 += bezt->vec[1][0];
/* store average value in float 2 (only do rounding at last step)
* - this isn't always needed, but some operators may also require this
*/
bed->f2 += bezt->vec[1][1];
ked->f2 += bezt->vec[1][1];
/* increment number of items */
bed->i1++;
ked->i1++;
}
return 0;
}
/* helper callback for columnselect_<animeditor>_keys() -> populate list CfraElems with frame numbers from selected beztriples */
short bezt_to_cfraelem(BeztEditData *bed, BezTriple *bezt)
short bezt_to_cfraelem(KeyframeEditData *ked, BezTriple *bezt)
{
/* only if selected */
if (bezt->f2 & SELECT) {
CfraElem *ce= MEM_callocN(sizeof(CfraElem), "cfraElem");
BLI_addtail(&bed->list, ce);
BLI_addtail(&ked->list, ce);
ce->cfra= bezt->vec[1][0];
}
@ -586,11 +586,11 @@ short bezt_to_cfraelem(BeztEditData *bed, BezTriple *bezt)
}
/* used to remap times from one range to another
* requires: bed->data = BeztEditCD_Remap
* requires: ked->data = BeztEditCD_Remap
*/
void bezt_remap_times(BeztEditData *bed, BezTriple *bezt)
void bezt_remap_times(KeyframeEditData *ked, BezTriple *bezt)
{
BeztEditCD_Remap *rmap= (BeztEditCD_Remap*)bed->data;
BeztEditCD_Remap *rmap= (BeztEditCD_Remap*)ked->data;
const float scale = (rmap->newMax - rmap->newMin) / (rmap->oldMax - rmap->oldMin);
/* perform transform on all three handles unless indicated otherwise */
@ -605,7 +605,7 @@ void bezt_remap_times(BeztEditData *bed, BezTriple *bezt)
/* Transform */
/* snaps the keyframe to the nearest frame */
static short snap_bezier_nearest(BeztEditData *bed, BezTriple *bezt)
static short snap_bezier_nearest(KeyframeEditData *ked, BezTriple *bezt)
{
if (bezt->f2 & SELECT)
bezt->vec[1][0]= (float)(floor(bezt->vec[1][0]+0.5));
@ -613,9 +613,9 @@ static short snap_bezier_nearest(BeztEditData *bed, BezTriple *bezt)
}
/* snaps the keyframe to the neares second */
static short snap_bezier_nearestsec(BeztEditData *bed, BezTriple *bezt)
static short snap_bezier_nearestsec(KeyframeEditData *ked, BezTriple *bezt)
{
const Scene *scene= bed->scene;
const Scene *scene= ked->scene;
const float secf = (float)FPS;
if (bezt->f2 & SELECT)
@ -624,24 +624,24 @@ static short snap_bezier_nearestsec(BeztEditData *bed, BezTriple *bezt)
}
/* snaps the keyframe to the current frame */
static short snap_bezier_cframe(BeztEditData *bed, BezTriple *bezt)
static short snap_bezier_cframe(KeyframeEditData *ked, BezTriple *bezt)
{
const Scene *scene= bed->scene;
const Scene *scene= ked->scene;
if (bezt->f2 & SELECT)
bezt->vec[1][0]= (float)CFRA;
return 0;
}
/* snaps the keyframe time to the nearest marker's frame */
static short snap_bezier_nearmarker(BeztEditData *bed, BezTriple *bezt)
static short snap_bezier_nearmarker(KeyframeEditData *ked, BezTriple *bezt)
{
if (bezt->f2 & SELECT)
bezt->vec[1][0]= (float)ED_markers_find_nearest_marker_time(&bed->list, bezt->vec[1][0]);
bezt->vec[1][0]= (float)ED_markers_find_nearest_marker_time(&ked->list, bezt->vec[1][0]);
return 0;
}
/* make the handles have the same value as the key */
static short snap_bezier_horizontal(BeztEditData *bed, BezTriple *bezt)
static short snap_bezier_horizontal(KeyframeEditData *ked, BezTriple *bezt)
{
if (bezt->f2 & SELECT) {
bezt->vec[0][1]= bezt->vec[2][1]= bezt->vec[1][1];
@ -653,14 +653,14 @@ static short snap_bezier_horizontal(BeztEditData *bed, BezTriple *bezt)
}
/* value to snap to is stored in the custom data -> first float value slot */
static short snap_bezier_value(BeztEditData *bed, BezTriple *bezt)
static short snap_bezier_value(KeyframeEditData *ked, BezTriple *bezt)
{
if (bezt->f2 & SELECT)
bezt->vec[1][1]= bed->f1;
bezt->vec[1][1]= ked->f1;
return 0;
}
BeztEditFunc ANIM_editkeyframes_snap(short type)
KeyframeEditFunc ANIM_editkeyframes_snap(short type)
{
/* eEditKeyframes_Snap */
switch (type) {
@ -683,9 +683,9 @@ BeztEditFunc ANIM_editkeyframes_snap(short type)
/* --------- */
static short mirror_bezier_cframe(BeztEditData *bed, BezTriple *bezt)
static short mirror_bezier_cframe(KeyframeEditData *ked, BezTriple *bezt)
{
const Scene *scene= bed->scene;
const Scene *scene= ked->scene;
float diff;
if (bezt->f2 & SELECT) {
@ -696,7 +696,7 @@ static short mirror_bezier_cframe(BeztEditData *bed, BezTriple *bezt)
return 0;
}
static short mirror_bezier_yaxis(BeztEditData *bed, BezTriple *bezt)
static short mirror_bezier_yaxis(KeyframeEditData *ked, BezTriple *bezt)
{
float diff;
@ -708,7 +708,7 @@ static short mirror_bezier_yaxis(BeztEditData *bed, BezTriple *bezt)
return 0;
}
static short mirror_bezier_xaxis(BeztEditData *bed, BezTriple *bezt)
static short mirror_bezier_xaxis(KeyframeEditData *ked, BezTriple *bezt)
{
float diff;
@ -720,25 +720,25 @@ static short mirror_bezier_xaxis(BeztEditData *bed, BezTriple *bezt)
return 0;
}
static short mirror_bezier_marker(BeztEditData *bed, BezTriple *bezt)
static short mirror_bezier_marker(KeyframeEditData *ked, BezTriple *bezt)
{
/* mirroring time stored in f1 */
if (bezt->f2 & SELECT) {
const float diff= (bed->f1 - bezt->vec[1][0]);
bezt->vec[1][0]= (bed->f1 + diff);
const float diff= (ked->f1 - bezt->vec[1][0]);
bezt->vec[1][0]= (ked->f1 + diff);
}
return 0;
}
static short mirror_bezier_value(BeztEditData *bed, BezTriple *bezt)
static short mirror_bezier_value(KeyframeEditData *ked, BezTriple *bezt)
{
float diff;
/* value to mirror over is stored in the custom data -> first float value slot */
if (bezt->f2 & SELECT) {
diff= (bed->f1 - bezt->vec[1][1]);
bezt->vec[1][1]= (bed->f1 + diff);
diff= (ked->f1 - bezt->vec[1][1]);
bezt->vec[1][1]= (ked->f1 + diff);
}
return 0;
@ -746,7 +746,7 @@ static short mirror_bezier_value(BeztEditData *bed, BezTriple *bezt)
/* Note: for markers and 'value', the values to use must be supplied as the first float value */
// calchandles_fcurve
BeztEditFunc ANIM_editkeyframes_mirror(short type)
KeyframeEditFunc ANIM_editkeyframes_mirror(short type)
{
switch (type) {
case MIRROR_KEYS_CURFRAME: /* mirror over current frame */
@ -769,7 +769,7 @@ BeztEditFunc ANIM_editkeyframes_mirror(short type)
/* Settings */
/* Sets the selected bezier handles to type 'auto' */
static short set_bezier_auto(BeztEditData *bed, BezTriple *bezt)
static short set_bezier_auto(KeyframeEditData *ked, BezTriple *bezt)
{
if((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) {
if (bezt->f1 & SELECT) bezt->h1= HD_AUTO; /* the secret code for auto */
@ -787,7 +787,7 @@ static short set_bezier_auto(BeztEditData *bed, BezTriple *bezt)
}
/* Sets the selected bezier handles to type 'vector' */
static short set_bezier_vector(BeztEditData *bed, BezTriple *bezt)
static short set_bezier_vector(KeyframeEditData *ked, BezTriple *bezt)
{
if ((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) {
if (bezt->f1 & SELECT) bezt->h1= HD_VECT;
@ -807,7 +807,7 @@ static short set_bezier_vector(BeztEditData *bed, BezTriple *bezt)
/* Queries if the handle should be set to 'free' or 'align' */
// NOTE: this was used for the 'toggle free/align' option
// currently this isn't used, but may be restored later
static short bezier_isfree(BeztEditData *bed, BezTriple *bezt)
static short bezier_isfree(KeyframeEditData *ked, BezTriple *bezt)
{
if ((bezt->f1 & SELECT) && (bezt->h1)) return 1;
if ((bezt->f3 & SELECT) && (bezt->h2)) return 1;
@ -815,7 +815,7 @@ static short bezier_isfree(BeztEditData *bed, BezTriple *bezt)
}
/* Sets selected bezier handles to type 'align' */
static short set_bezier_align(BeztEditData *bed, BezTriple *bezt)
static short set_bezier_align(KeyframeEditData *ked, BezTriple *bezt)
{
if (bezt->f1 & SELECT) bezt->h1= HD_ALIGN;
if (bezt->f3 & SELECT) bezt->h2= HD_ALIGN;
@ -823,7 +823,7 @@ static short set_bezier_align(BeztEditData *bed, BezTriple *bezt)
}
/* Sets selected bezier handles to type 'free' */
static short set_bezier_free(BeztEditData *bed, BezTriple *bezt)
static short set_bezier_free(KeyframeEditData *ked, BezTriple *bezt)
{
if (bezt->f1 & SELECT) bezt->h1= HD_FREE;
if (bezt->f3 & SELECT) bezt->h2= HD_FREE;
@ -832,7 +832,7 @@ static short set_bezier_free(BeztEditData *bed, BezTriple *bezt)
/* Set all selected Bezier Handles to a single type */
// calchandles_fcurve
BeztEditFunc ANIM_editkeyframes_handles(short code)
KeyframeEditFunc ANIM_editkeyframes_handles(short code)
{
switch (code) {
case HD_AUTO: /* auto */
@ -853,21 +853,21 @@ BeztEditFunc ANIM_editkeyframes_handles(short code)
/* ------- */
static short set_bezt_constant(BeztEditData *bed, BezTriple *bezt)
static short set_bezt_constant(KeyframeEditData *ked, BezTriple *bezt)
{
if (bezt->f2 & SELECT)
bezt->ipo= BEZT_IPO_CONST;
return 0;
}
static short set_bezt_linear(BeztEditData *bed, BezTriple *bezt)
static short set_bezt_linear(KeyframeEditData *ked, BezTriple *bezt)
{
if (bezt->f2 & SELECT)
bezt->ipo= BEZT_IPO_LIN;
return 0;
}
static short set_bezt_bezier(BeztEditData *bed, BezTriple *bezt)
static short set_bezt_bezier(KeyframeEditData *ked, BezTriple *bezt)
{
if (bezt->f2 & SELECT)
bezt->ipo= BEZT_IPO_BEZ;
@ -876,7 +876,7 @@ static short set_bezt_bezier(BeztEditData *bed, BezTriple *bezt)
/* Set the interpolation type of the selected BezTriples in each F-Curve to the specified one */
// ANIM_editkeyframes_ipocurve_ipotype() !
BeztEditFunc ANIM_editkeyframes_ipo(short code)
KeyframeEditFunc ANIM_editkeyframes_ipo(short code)
{
switch (code) {
case BEZT_IPO_CONST: /* constant */
@ -890,21 +890,21 @@ BeztEditFunc ANIM_editkeyframes_ipo(short code)
/* ------- */
static short set_keytype_keyframe(BeztEditData *bed, BezTriple *bezt)
static short set_keytype_keyframe(KeyframeEditData *ked, BezTriple *bezt)
{
if (bezt->f2 & SELECT)
BEZKEYTYPE(bezt)= BEZT_KEYTYPE_KEYFRAME;
return 0;
}
static short set_keytype_breakdown(BeztEditData *bed, BezTriple *bezt)
static short set_keytype_breakdown(KeyframeEditData *ked, BezTriple *bezt)
{
if (bezt->f2 & SELECT)
BEZKEYTYPE(bezt)= BEZT_KEYTYPE_BREAKDOWN;
return 0;
}
static short set_keytype_extreme(BeztEditData *bed, BezTriple *bezt)
static short set_keytype_extreme(KeyframeEditData *ked, BezTriple *bezt)
{
if (bezt->f2 & SELECT)
BEZKEYTYPE(bezt)= BEZT_KEYTYPE_EXTREME;
@ -912,7 +912,7 @@ static short set_keytype_extreme(BeztEditData *bed, BezTriple *bezt)
}
/* Set the interpolation type of the selected BezTriples in each F-Curve to the specified one */
BeztEditFunc ANIM_editkeyframes_keytype(short code)
KeyframeEditFunc ANIM_editkeyframes_keytype(short code)
{
switch (code) {
case BEZT_KEYTYPE_BREAKDOWN: /* breakdown */
@ -930,21 +930,21 @@ BeztEditFunc ANIM_editkeyframes_keytype(short code)
/* ******************************************* */
/* Selection */
static short select_bezier_add(BeztEditData *bed, BezTriple *bezt)
static short select_bezier_add(KeyframeEditData *ked, BezTriple *bezt)
{
/* Select the bezier triple */
BEZ_SEL(bezt);
return 0;
}
static short select_bezier_subtract(BeztEditData *bed, BezTriple *bezt)
static short select_bezier_subtract(KeyframeEditData *ked, BezTriple *bezt)
{
/* Deselect the bezier triple */
BEZ_DESEL(bezt);
return 0;
}
static short select_bezier_invert(BeztEditData *bed, BezTriple *bezt)
static short select_bezier_invert(KeyframeEditData *ked, BezTriple *bezt)
{
/* Invert the selection for the bezier triple */
bezt->f2 ^= SELECT;
@ -959,7 +959,7 @@ static short select_bezier_invert(BeztEditData *bed, BezTriple *bezt)
return 0;
}
BeztEditFunc ANIM_editkeyframes_select(short selectmode)
KeyframeEditFunc ANIM_editkeyframes_select(short selectmode)
{
switch (selectmode) {
case SELECT_ADD: /* add */
@ -984,11 +984,11 @@ BeztEditFunc ANIM_editkeyframes_select(short selectmode)
/* ----------- */
static short selmap_build_bezier_more(BeztEditData *bed, BezTriple *bezt)
static short selmap_build_bezier_more(KeyframeEditData *ked, BezTriple *bezt)
{
FCurve *fcu= bed->fcu;
char *map= bed->data;
int i= bed->curIndex;
FCurve *fcu= ked->fcu;
char *map= ked->data;
int i= ked->curIndex;
/* if current is selected, just make sure it stays this way */
if (BEZSELECTED(bezt)) {
@ -1019,11 +1019,11 @@ static short selmap_build_bezier_more(BeztEditData *bed, BezTriple *bezt)
return 0;
}
static short selmap_build_bezier_less(BeztEditData *bed, BezTriple *bezt)
static short selmap_build_bezier_less(KeyframeEditData *ked, BezTriple *bezt)
{
FCurve *fcu= bed->fcu;
char *map= bed->data;
int i= bed->curIndex;
FCurve *fcu= ked->fcu;
char *map= ked->data;
int i= ked->curIndex;
/* if current is selected, check the left/right keyframes
* since it might need to be deselected (but otherwise no)
@ -1061,7 +1061,7 @@ static short selmap_build_bezier_less(BeztEditData *bed, BezTriple *bezt)
}
/* Get callback for building selection map */
BeztEditFunc ANIM_editkeyframes_buildselmap(short mode)
KeyframeEditFunc ANIM_editkeyframes_buildselmap(short mode)
{
switch (mode) {
case SELMAP_LESS: /* less */
@ -1076,10 +1076,10 @@ BeztEditFunc ANIM_editkeyframes_buildselmap(short mode)
/* ----------- */
/* flush selection map values to the given beztriple */
short bezt_selmap_flush(BeztEditData *bed, BezTriple *bezt)
short bezt_selmap_flush(KeyframeEditData *ked, BezTriple *bezt)
{
char *map= bed->data;
short on= map[bed->curIndex];
char *map= ked->data;
short on= map[ked->curIndex];
/* select or deselect based on whether the map allows it or not */
if (on) {

@ -500,7 +500,7 @@ short copy_animedit_keys (bAnimContext *ac, ListBase *anim_data)
* - skip if no selected keyframes found (so no need to create unnecessary copy-buffer data)
* - this check should also eliminate any problems associated with using sample-data
*/
if (ANIM_fcurve_keys_bezier_loop(NULL, fcu, NULL, ANIM_editkeyframes_ok(BEZT_OK_SELECTED), NULL) == 0)
if (ANIM_fcurve_keyframes_loop(NULL, fcu, NULL, ANIM_editkeyframes_ok(BEZT_OK_SELECTED), NULL) == 0)
continue;
/* init copybuf item info */

@ -176,16 +176,8 @@ FCurve *verify_fcurve (bAction *act, const char group[], const char rna_path[],
grp= action_groups_find_named(act, group);
/* no matching groups, so add one */
if (grp == NULL) {
/* Add a new group, and make it active */
grp= MEM_callocN(sizeof(bActionGroup), "bActionGroup");
grp->flag = AGRP_SELECTED;
strncpy(grp->name, group, sizeof(grp->name));
BLI_addtail(&act->groups, grp);
BLI_uniquename(&act->groups, grp, "Group", '.', offsetof(bActionGroup, name), sizeof(grp->name));
}
if (grp == NULL)
grp= action_groups_add_new(act, group);
/* add F-Curve to group */
action_groups_add_channel(act, grp, fcu);
@ -225,27 +217,16 @@ int insert_bezt_fcurve (FCurve *fcu, BezTriple *bezt, short flag)
if (replace) {
/* sanity check: 'i' may in rare cases exceed arraylen */
if ((i >= 0) && (i < fcu->totvert)) {
/* take care with the handletypes and other info if the replacement flags are set */
if (flag & INSERTKEY_REPLACE) {
BezTriple *dst= (fcu->bezt + i);
float dy= bezt->vec[1][1] - dst->vec[1][1];
/* just apply delta value change to the handle values */
dst->vec[0][1] += dy;
dst->vec[1][1] += dy;
dst->vec[2][1] += dy;
// TODO: perform some other operations?
}
else {
char oldKeyType= BEZKEYTYPE(fcu->bezt + i);
/* just brutally replace the values */
*(fcu->bezt + i) = *bezt;
/* special exception for keyframe type - copy value back so that this info isn't lost */
BEZKEYTYPE(fcu->bezt + i)= oldKeyType;
}
/* just change the values when replacing, so as to not overwrite handles */
BezTriple *dst= (fcu->bezt + i);
float dy= bezt->vec[1][1] - dst->vec[1][1];
/* just apply delta value change to the handle values */
dst->vec[0][1] += dy;
dst->vec[1][1] += dy;
dst->vec[2][1] += dy;
// TODO: perform some other operations?
}
}
/* keyframing modes allow to not replace keyframe */
@ -253,14 +234,14 @@ int insert_bezt_fcurve (FCurve *fcu, BezTriple *bezt, short flag)
/* insert new - if we're not restricted to replacing keyframes only */
BezTriple *newb= MEM_callocN((fcu->totvert+1)*sizeof(BezTriple), "beztriple");
/* add the beztriples that should occur before the beztriple to be pasted (originally in ei->icu) */
/* add the beztriples that should occur before the beztriple to be pasted (originally in fcu) */
if (i > 0)
memcpy(newb, fcu->bezt, i*sizeof(BezTriple));
/* add beztriple to paste at index i */
*(newb + i)= *bezt;
/* add the beztriples that occur after the beztriple to be pasted (originally in icu) */
/* add the beztriples that occur after the beztriple to be pasted (originally in fcu) */
if (i < fcu->totvert)
memcpy(newb+i+1, fcu->bezt+i, (fcu->totvert-i)*sizeof(BezTriple));
@ -305,17 +286,19 @@ int insert_vert_fcurve (FCurve *fcu, float x, float y, short flag)
BezTriple beztr;
int a;
/* set all three points, for nicer start position */
/* set all three points, for nicer start position
* NOTE: +/- 1 on vec.x for left and right handles is so that 'free' handles work ok...
*/
memset(&beztr, 0, sizeof(BezTriple));
beztr.vec[0][0]= x;
beztr.vec[0][0]= x-1.0f;
beztr.vec[0][1]= y;
beztr.vec[1][0]= x;
beztr.vec[1][1]= y;
beztr.vec[2][0]= x;
beztr.vec[2][0]= x+1.0f;
beztr.vec[2][1]= y;
beztr.ipo= U.ipo_new; /* use default interpolation mode here... */
beztr.f1= beztr.f2= beztr.f3= SELECT;
beztr.h1= beztr.h2= HD_AUTO; // XXX what about when we replace an old one?
beztr.h1= beztr.h2= U.keyhandles_new; /* use default handle type here */
//BEZKEYTYPE(&beztr)= scene->keytype; /* default keyframe type */
/* add temp beztriple to keyframes */
@ -336,18 +319,9 @@ int insert_vert_fcurve (FCurve *fcu, float x, float y, short flag)
/* set handletype and interpolation */
if ((fcu->totvert > 2) && (flag & INSERTKEY_REPLACE)==0) {
BezTriple *bezt= (fcu->bezt + a);
char h1, h2;
/* set handles (autohandles by default) */
h1= h2= HD_AUTO;
if (a > 0) h1= (bezt-1)->h2;
if (a < fcu->totvert-1) h2= (bezt+1)->h1;
bezt->h1= h1;
bezt->h2= h2;
/* set interpolation from previous (if available) */
// FIXME: this doesn't work if user tweaked the interpolation specifically, and they were just overwriting some existing key in the process...
if (a > 0) bezt->ipo= (bezt-1)->ipo;
else if (a < fcu->totvert-1) bezt->ipo= (bezt+1)->ipo;

@ -4573,19 +4573,22 @@ static int dgroup_skinnable(Object *ob, Bone *bone, void *datap)
* pointers to bDeformGroups, all with names
* of skinnable bones.
*/
bDeformGroup ***hgroup, *defgroup;
bDeformGroup ***hgroup, *defgroup= NULL;
int a, segments;
struct { Object *armob; void *list; int heat; } *data= datap;
int wpmode = (ob->mode & OB_MODE_WEIGHT_PAINT);
bArmature *arm= data->armob->data;
if (!(ob->mode & OB_MODE_WEIGHT_PAINT) || !(bone->flag & BONE_HIDDEN_P)) {
if (!wpmode || !(bone->flag & BONE_HIDDEN_P)) {
if (!(bone->flag & BONE_NO_DEFORM)) {
if (data->heat && data->armob->pose && get_pose_channel(data->armob->pose, bone->name))
segments = bone->segments;
else
segments = 1;
if (!(defgroup = defgroup_find_name(ob, bone->name)))
defgroup = ED_vgroup_add_name(ob, bone->name);
if(!wpmode || ((arm->layer & bone->layer) && (bone->flag & BONE_SELECTED)))
if (!(defgroup = defgroup_find_name(ob, bone->name)))
defgroup = ED_vgroup_add_name(ob, bone->name);
if (data->list != NULL) {
hgroup = (bDeformGroup ***) &data->list;
@ -4711,7 +4714,7 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m
selected = MEM_callocN(numbones*sizeof(int), "selected");
for (j=0; j < numbones; ++j) {
bone = bonelist[j];
bone = bonelist[j];
dgroup = dgrouplist[j];
/* handle bbone */
@ -4759,7 +4762,7 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m
selected[j] = 1;
/* find flipped group */
if (mirror) {
if (dgroup && mirror) {
char name[32];
BLI_strncpy(name, dgroup->name, 32);

@ -618,13 +618,24 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
LaplacianSystem *sys;
MFace *mface;
float solution, weight;
int *vertsflipped = NULL;
int *vertsflipped = NULL, *mask= NULL;
int a, totface, j, bbone, firstsegment, lastsegment, thrownerror = 0;
/* count triangles */
/* count triangles and create mask */
if(me->editflag & ME_EDIT_PAINT_MASK)
mask= MEM_callocN(sizeof(int)*me->totvert, "heat_bone_weighting mask");
for(totface=0, a=0, mface=me->mface; a<me->totface; a++, mface++) {
totface++;
if(mface->v4) totface++;
if(mask && (mface->flag & ME_FACE_SEL)) {
mask[mface->v1]= 1;
mask[mface->v2]= 1;
mask[mface->v3]= 1;
if(mface->v4)
mask[mface->v4]= 1;
}
}
/* create laplacian */
@ -661,6 +672,9 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
/* clear weights */
if(bbone && firstsegment) {
for(a=0; a<me->totvert; a++) {
if(mask && !mask[a])
continue;
ED_vgroup_vert_remove(ob, dgrouplist[j], a);
if(vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0)
ED_vgroup_vert_remove(ob, dgroupflip[j], vertsflipped[a]);
@ -679,6 +693,9 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
if(laplacian_system_solve(sys)) {
/* load solution into vertex groups */
for(a=0; a<me->totvert; a++) {
if(mask && !mask[a])
continue;
solution= laplacian_system_get_solution(a);
if(bbone) {
@ -723,6 +740,9 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
/* remove too small vertex weights */
if(bbone && lastsegment) {
for(a=0; a<me->totvert; a++) {
if(mask && !mask[a])
continue;
weight= ED_vgroup_vert_weight(ob, dgrouplist[j], a);
weight= heat_limit_weight(weight);
if(weight <= 0.0f)
@ -740,6 +760,7 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
/* free */
if(vertsflipped) MEM_freeN(vertsflipped);
if(mask) MEM_freeN(mask);
heat_system_free(sys);
@ -1865,6 +1886,7 @@ static void harmonic_coordinates_bind(Scene *scene, MeshDeformModifierData *mmd,
BLI_memarena_free(mdb->memarena);
}
#if 0
static void heat_weighting_bind(Scene *scene, DerivedMesh *dm, MeshDeformModifierData *mmd, MeshDeformBind *mdb)
{
LaplacianSystem *sys;
@ -1932,6 +1954,7 @@ static void heat_weighting_bind(Scene *scene, DerivedMesh *dm, MeshDeformModifie
mmd->bindweights= mdb->weights;
}
#endif
void mesh_deform_bind(Scene *scene, DerivedMesh *dm, MeshDeformModifierData *mmd, float *vertexcos, int totvert, float cagemat[][4])
{
@ -1960,10 +1983,14 @@ void mesh_deform_bind(Scene *scene, DerivedMesh *dm, MeshDeformModifierData *mmd
mul_v3_m4v3(mdb.vertexcos[a], mdb.cagemat, vertexcos + a*3);
/* solve */
#if 0
if(mmd->mode == MOD_MDEF_VOLUME)
harmonic_coordinates_bind(scene, mmd, &mdb);
else
heat_weighting_bind(scene, dm, mmd, &mdb);
#else
harmonic_coordinates_bind(scene, mmd, &mdb);
#endif
/* assign bind variables */
mmd->bindcos= (float*)mdb.cagecos;

@ -704,8 +704,8 @@ static void poselib_apply_pose (tPoseLib_PreviewData *pld)
bAction *act= pld->act;
bActionGroup *agrp;
BeztEditData bed;
BeztEditFunc group_ok_cb;
KeyframeEditData ked;
KeyframeEditFunc group_ok_cb;
int frame= 1;
/* get the frame */
@ -717,15 +717,15 @@ static void poselib_apply_pose (tPoseLib_PreviewData *pld)
/* init settings for testing groups for keyframes */
group_ok_cb= ANIM_editkeyframes_ok(BEZT_OK_FRAMERANGE);
memset(&bed, 0, sizeof(BeztEditData));
bed.f1= ((float)frame) - 0.5f;
bed.f2= ((float)frame) + 0.5f;
memset(&ked, 0, sizeof(KeyframeEditData));
ked.f1= ((float)frame) - 0.5f;
ked.f2= ((float)frame) + 0.5f;
/* start applying - only those channels which have a key at this point in time! */
for (agrp= act->groups.first; agrp; agrp= agrp->next) {
/* check if group has any keyframes */
if (ANIM_animchanneldata_keys_bezier_loop(&bed, agrp, ALE_GROUP, NULL, group_ok_cb, NULL, 0)) {
if (ANIM_animchanneldata_keyframes_loop(&ked, agrp, ALE_GROUP, NULL, group_ok_cb, NULL, 0)) {
/* has keyframe on this frame, so try to get a PoseChannel with this name */
pchan= get_pose_channel(pose, agrp->name);

@ -216,6 +216,6 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
/* menus */
WM_keymap_add_menu(keymap, "VIEW3D_MT_hook", HKEY, KM_PRESS, KM_CTRL, 0);
ED_object_generic_keymap(keyconf, keymap, TRUE);
ED_object_generic_keymap(keyconf, keymap, 2);
}

File diff suppressed because it is too large Load Diff

@ -96,7 +96,7 @@ typedef enum eEditKeyframes_Mirror {
/* --- Generic Properties for Bezier Edit Tools ----- */
typedef struct BeztEditData {
typedef struct KeyframeEditData {
/* generic properties/data access */
ListBase list; /* temp list for storing custom list of data to check */
struct Scene *scene; /* pointer to current scene - many tools need access to cfra/etc. */
@ -107,14 +107,14 @@ typedef struct BeztEditData {
/* current iteration data */
struct FCurve *fcu; /* F-Curve that is being iterated over */
int curIndex; /* index of current keyframe being iterated over */
} BeztEditData;
} KeyframeEditData;
/* ------- Function Pointer Typedefs ---------------- */
/* callback function that refreshes the F-Curve after use */
typedef void (*FcuEditFunc)(struct FCurve *fcu);
/* callback function that operates on the given BezTriple */
typedef short (*BeztEditFunc)(BeztEditData *bed, struct BezTriple *bezt);
typedef short (*KeyframeEditFunc)(KeyframeEditData *ked, struct BezTriple *bezt);
/* ------- Custom Data Type Defines ------------------ */
@ -128,15 +128,15 @@ typedef struct BeztEditCD_Remap {
/* functions for looping over keyframes */
/* function for working with F-Curve data only (i.e. when filters have been chosen to explicitly use this) */
short ANIM_fcurve_keys_bezier_loop(BeztEditData *bed, struct FCurve *fcu, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb);
short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, struct FCurve *fcu, KeyframeEditFunc bezt_ok, KeyframeEditFunc bezt_cb, FcuEditFunc fcu_cb);
/* function for working with any type (i.e. one of the known types) of animation channel
* - filterflag is bDopeSheet->flag (DOPESHEET_FILTERFLAG)
*/
short ANIM_animchannel_keys_bezier_loop(BeztEditData *bed, struct bAnimListElem *ale, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb, int filterflag);
short ANIM_animchannel_keyframes_loop(KeyframeEditData *ked, struct bAnimListElem *ale, KeyframeEditFunc bezt_ok, KeyframeEditFunc bezt_cb, FcuEditFunc fcu_cb, int filterflag);
/* same as above, except bAnimListElem wrapper is not needed...
* - keytype is eAnim_KeyType
*/
short ANIM_animchanneldata_keys_bezier_loop(BeztEditData *bed, void *data, int keytype, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb, int filterflag);
short ANIM_animchanneldata_keyframes_loop(KeyframeEditData *ked, void *data, int keytype, KeyframeEditFunc bezt_ok, KeyframeEditFunc bezt_cb, FcuEditFunc fcu_cb, int filterflag);
/* functions for making sure all keyframes are in good order */
void ANIM_editkeyframes_refresh(struct bAnimContext *ac);
@ -144,40 +144,40 @@ void ANIM_editkeyframes_refresh(struct bAnimContext *ac);
/* ----------- BezTriple Callback Getters ---------- */
/* accessories */
BeztEditFunc ANIM_editkeyframes_ok(short mode);
KeyframeEditFunc ANIM_editkeyframes_ok(short mode);
/* edit */
BeztEditFunc ANIM_editkeyframes_snap(short mode);
BeztEditFunc ANIM_editkeyframes_mirror(short mode);
BeztEditFunc ANIM_editkeyframes_select(short mode);
BeztEditFunc ANIM_editkeyframes_handles(short mode);
BeztEditFunc ANIM_editkeyframes_ipo(short mode);
BeztEditFunc ANIM_editkeyframes_keytype(short mode);
KeyframeEditFunc ANIM_editkeyframes_snap(short mode);
KeyframeEditFunc ANIM_editkeyframes_mirror(short mode);
KeyframeEditFunc ANIM_editkeyframes_select(short mode);
KeyframeEditFunc ANIM_editkeyframes_handles(short mode);
KeyframeEditFunc ANIM_editkeyframes_ipo(short mode);
KeyframeEditFunc ANIM_editkeyframes_keytype(short mode);
/* -------- BezTriple Callbacks (Selection Map) ---------- */
/* Get a callback to populate the selection settings map
* requires: bed->custom = char[] of length fcurve->totvert
* requires: ked->custom = char[] of length fcurve->totvert
*/
BeztEditFunc ANIM_editkeyframes_buildselmap(short mode);
KeyframeEditFunc ANIM_editkeyframes_buildselmap(short mode);
/* Change the selection status of the keyframe based on the map entry for this vert
* requires: bed->custom = char[] of length fcurve->totvert
* requires: ked->custom = char[] of length fcurve->totvert
*/
short bezt_selmap_flush(BeztEditData *bed, struct BezTriple *bezt);
short bezt_selmap_flush(KeyframeEditData *ked, struct BezTriple *bezt);
/* ----------- BezTriple Callback (Assorted Utilities) ---------- */
/* used to calculate the the average location of all relevant BezTriples by summing their locations */
short bezt_calc_average(BeztEditData *bed, struct BezTriple *bezt);
short bezt_calc_average(KeyframeEditData *ked, struct BezTriple *bezt);
/* used to extract a set of cfra-elems from the keyframes */
short bezt_to_cfraelem(BeztEditData *bed, struct BezTriple *bezt);
short bezt_to_cfraelem(KeyframeEditData *ked, struct BezTriple *bezt);
/* used to remap times from one range to another
* requires: bed->custom = BeztEditCD_Remap
* requires: ked->custom = BeztEditCD_Remap
*/
void bezt_remap_times(BeztEditData *bed, struct BezTriple *bezt);
void bezt_remap_times(KeyframeEditData *ked, struct BezTriple *bezt);
/* ************************************************ */
/* Destructive Editing API (keyframes_general.c) */

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