Merged changes in the trunk up to revision 27992.
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Sun, 4 Apr 2010 19:50:22 +0000 (19:50 +0000)
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Sun, 4 Apr 2010 19:50:22 +0000 (19:50 +0000)
247 files changed:
CMakeLists.txt
config/darwin-config.py
config/win32-vc-config.py
projectfiles_vc9/blender/blenlib/BLI_blenlib.vcproj
release/plugins/sequence/blur.c
release/scripts/io/export_fbx.py
release/scripts/io/export_mdd.py
release/scripts/io/export_obj.py
release/scripts/io/import_anim_bvh.py
release/scripts/io/import_scene_3ds.py
release/scripts/io/import_scene_obj.py
release/scripts/io/import_shape_mdd.py
release/scripts/io/netrender/client.py
release/scripts/keyingsets/keyingsets_utils.py
release/scripts/modules/bpy_types.py
release/scripts/modules/rigify/__init__.py
release/scripts/modules/rigify/eye_balls.py
release/scripts/modules/rigify/eye_lid.py
release/scripts/modules/rigify/mouth.py
release/scripts/modules/rigify/stretch.py
release/scripts/op/add_mesh_torus.py
release/scripts/op/image.py
release/scripts/op/nla.py [new file with mode: 0644]
release/scripts/op/screen_play_rendered_anim.py
release/scripts/op/sequencer.py
release/scripts/ui/properties_animviz.py
release/scripts/ui/properties_data_armature.py
release/scripts/ui/properties_data_curve.py
release/scripts/ui/properties_data_modifier.py
release/scripts/ui/properties_object.py
release/scripts/ui/properties_object_constraint.py
release/scripts/ui/properties_particle.py
release/scripts/ui/properties_physics_cloth.py
release/scripts/ui/properties_physics_common.py
release/scripts/ui/properties_physics_fluid.py
release/scripts/ui/properties_render.py
release/scripts/ui/properties_scene.py
release/scripts/ui/properties_texture.py
release/scripts/ui/space_buttons.py
release/scripts/ui/space_image.py
release/scripts/ui/space_info.py
release/scripts/ui/space_sequencer.py
release/scripts/ui/space_text.py
release/scripts/ui/space_time.py
release/scripts/ui/space_userpref.py
release/scripts/ui/space_view3d.py
release/scripts/ui/space_view3d_toolbar.py
source/blender/blenfont/intern/blf_font.c
source/blender/blenkernel/BKE_action.h
source/blender/blenkernel/BKE_blender.h
source/blender/blenkernel/BKE_cloth.h
source/blender/blenkernel/BKE_library.h
source/blender/blenkernel/BKE_nla.h
source/blender/blenkernel/BKE_pointcache.h
source/blender/blenkernel/BKE_scene.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/action.c
source/blender/blenkernel/intern/anim.c
source/blender/blenkernel/intern/cloth.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/customdata.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/material.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/modifier.c
source/blender/blenkernel/intern/nla.c
source/blender/blenkernel/intern/node.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenkernel/intern/pointcache.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/sequencer.c
source/blender/blenkernel/intern/smoke.c
source/blender/blenlib/BLI_blenlib.h
source/blender/blenlib/BLI_dynamiclist.h [deleted file]
source/blender/blenlib/BLI_listbase.h
source/blender/blenlib/BLI_math_color.h
source/blender/blenlib/intern/dynamiclist.c [deleted file]
source/blender/blenlib/intern/math_color.c
source/blender/blenlib/intern/path_util.c
source/blender/blenlib/intern/storage.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/collada/DocumentExporter.cpp
source/blender/collada/DocumentImporter.cpp
source/blender/editors/animation/anim_draw.c
source/blender/editors/animation/anim_markers.c
source/blender/editors/animation/fmodifier_ui.c
source/blender/editors/animation/keyframes_edit.c
source/blender/editors/animation/keyframes_general.c
source/blender/editors/animation/keyframing.c
source/blender/editors/armature/editarmature.c
source/blender/editors/armature/meshlaplacian.c
source/blender/editors/armature/poselib.c
source/blender/editors/curve/curve_ops.c
source/blender/editors/datafiles/B.blend.c
source/blender/editors/include/ED_keyframes_edit.h
source/blender/editors/include/ED_mesh.h
source/blender/editors/include/ED_object.h
source/blender/editors/include/ED_render.h
source/blender/editors/include/ED_transform.h
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_draw.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_intern.h
source/blender/editors/interface/interface_ops.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/interface/interface_style.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/interface/interface_widgets.c
source/blender/editors/interface/resources.c
source/blender/editors/interface/view2d_ops.c
source/blender/editors/mesh/editmesh.c
source/blender/editors/mesh/editmesh_add.c
source/blender/editors/mesh/editmesh_mods.c
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/mesh/mesh_ops.c
source/blender/editors/mesh/meshtools.c
source/blender/editors/object/object_add.c
source/blender/editors/object/object_constraint.c
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_hook.c
source/blender/editors/object/object_modifier.c
source/blender/editors/object/object_ops.c
source/blender/editors/physics/particle_edit.c
source/blender/editors/physics/physics_pointcache.c
source/blender/editors/render/render_intern.h
source/blender/editors/render/render_internal.c
source/blender/editors/render/render_ops.c
source/blender/editors/render/render_preview.c
source/blender/editors/render/render_shading.c
source/blender/editors/screen/screen_context.c
source/blender/editors/screen/screen_edit.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/space_action/action_edit.c
source/blender/editors/space_action/action_select.c
source/blender/editors/space_buttons/buttons_context.c
source/blender/editors/space_buttons/buttons_intern.h
source/blender/editors/space_file/file_draw.c
source/blender/editors/space_file/file_ops.c
source/blender/editors/space_file/filelist.c
source/blender/editors/space_file/filesel.c
source/blender/editors/space_graph/graph_buttons.c
source/blender/editors/space_graph/graph_draw.c
source/blender/editors/space_graph/graph_edit.c
source/blender/editors/space_graph/graph_select.c
source/blender/editors/space_image/image_buttons.c
source/blender/editors/space_image/image_draw.c
source/blender/editors/space_image/image_intern.h
source/blender/editors/space_image/image_ops.c
source/blender/editors/space_image/space_image.c
source/blender/editors/space_nla/nla_buttons.c
source/blender/editors/space_nla/nla_edit.c
source/blender/editors/space_node/drawnode.c
source/blender/editors/space_node/node_draw.c
source/blender/editors/space_node/node_ops.c
source/blender/editors/space_sequencer/sequencer_add.c
source/blender/editors/space_sequencer/sequencer_draw.c
source/blender/editors/space_sequencer/sequencer_select.c
source/blender/editors/space_text/text_ops.c
source/blender/editors/space_view3d/drawarmature.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_intern.h
source/blender/editors/space_view3d/view3d_ops.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform.h
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/transform/transform_manipulator.c
source/blender/editors/transform/transform_ops.c
source/blender/editors/util/ed_util.c
source/blender/editors/uvedit/uvedit_draw.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/makesdna/DNA_cloth_types.h
source/blender/makesdna/DNA_color_types.h
source/blender/makesdna/DNA_customdata_types.h
source/blender/makesdna/DNA_modifier_types.h
source/blender/makesdna/DNA_particle_types.h
source/blender/makesdna/DNA_space_types.h
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesdna/DNA_view2d_types.h
source/blender/makesrna/RNA_access.h
source/blender/makesrna/intern/rna_action.c
source/blender/makesrna/intern/rna_actuator.c
source/blender/makesrna/intern/rna_animation.c
source/blender/makesrna/intern/rna_animation_api.c
source/blender/makesrna/intern/rna_animviz.c
source/blender/makesrna/intern/rna_armature.c
source/blender/makesrna/intern/rna_cloth.c
source/blender/makesrna/intern/rna_constraint.c
source/blender/makesrna/intern/rna_curve.c
source/blender/makesrna/intern/rna_define.c
source/blender/makesrna/intern/rna_fcurve.c
source/blender/makesrna/intern/rna_image.c
source/blender/makesrna/intern/rna_internal.h
source/blender/makesrna/intern/rna_key.c
source/blender/makesrna/intern/rna_main.c
source/blender/makesrna/intern/rna_material.c
source/blender/makesrna/intern/rna_modifier.c
source/blender/makesrna/intern/rna_nla.c
source/blender/makesrna/intern/rna_nodetree.c
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_object_force.c
source/blender/makesrna/intern/rna_particle.c
source/blender/makesrna/intern/rna_pose.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_sequencer.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_texture.c
source/blender/makesrna/intern/rna_userdef.c
source/blender/makesrna/intern/rna_wm.c
source/blender/makesrna/intern/rna_wm_api.c
source/blender/makesrna/intern/rna_world.c
source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c
source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c
source/blender/nodes/intern/CMP_nodes/CMP_image.c
source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c
source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c
source/blender/nodes/intern/CMP_util.c
source/blender/nodes/intern/CMP_util.h
source/blender/nodes/intern/SHD_nodes/SHD_material.c
source/blender/python/generic/blf.c
source/blender/render/extern/include/RE_pipeline.h
source/blender/render/extern/include/RE_raytrace.h
source/blender/render/intern/raytrace/rayobject.cpp
source/blender/render/intern/source/pipeline.c
source/blender/render/intern/source/rayshade.c
source/blender/render/intern/source/rendercore.c
source/blender/render/intern/source/zbuf.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/WM_types.h
source/blender/windowmanager/intern/wm_dragdrop.c
source/blender/windowmanager/intern/wm_event_system.c
source/blender/windowmanager/intern/wm_gesture.c
source/blender/windowmanager/intern/wm_init_exit.c
source/blender/windowmanager/intern/wm_operators.c
source/blender/windowmanager/wm_event_types.h
source/blenderplayer/bad_level_call_stubs/stubs.c
source/gameengine/Converter/BL_BlenderDataConversion.cpp
source/gameengine/Ketsji/KX_GameObject.cpp
source/gameengine/PyDoc/GameTypes.py
source/gameengine/PyDoc/how_to_build_win.txt [new file with mode: 0644]

index 8b690cdd81a3c23262a4dc1907c40fdda08a58c5..ba344a0a434377a8bc72b253d482dc8d756d0b1d 100644 (file)
@@ -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)
index b0e6948001b099dfbea2f231ce9f58f5915d1176..bac4c9ab165a4a14267621025b5d3bd5ed5010a6 100644 (file)
@@ -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)
index 4799f91647cd3e6503217cfe8d56f2da61575bc2..3e8dfc3d5dfbbe2ae374d76248d9373a8d50d3a4 100644 (file)
@@ -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'
index 03cdcf9875b9cd729fc4a69618dd82f267fd83de..72a3ae9a2f4e5d06543a8dc27dd43e49a2061aa2 100644 (file)
                                RelativePath="..\..\..\source\blender\blenlib\intern\DLRB_tree.c"\r
                                >\r
                        </File>\r
-                       <File\r
-                               RelativePath="..\..\..\source\blender\blenlib\intern\dynamiclist.c"\r
-                               >\r
-                       </File>\r
                        <File\r
                                RelativePath="..\..\..\source\blender\blenlib\intern\dynlib.c"\r
                                >\r
                                RelativePath="..\..\..\source\blender\blenlib\BLI_dlrbTree.h"\r
                                >\r
                        </File>\r
-                       <File\r
-                               RelativePath="..\..\..\source\blender\blenlib\BLI_dynamiclist.h"\r
-                               >\r
-                       </File>\r
                        <File\r
                                RelativePath="..\..\..\source\blender\blenlib\BLI_edgehash.h"\r
                                >\r
                                RelativePath="..\..\..\source\blender\blenlib\BLI_mempool.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\..\source\blender\blenlib\BLI_path_util.h"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\..\source\blender\blenlib\BLI_pbvh.h"\r
                                >\r
index 261bfa4035121e2c633e0669c901b2ccf43cc6aa..c23a924ac6508f06274ad3cf8bc4c122e78f2b58 100644 (file)
@@ -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;
index bc1a0b82d852221f3a4d38090cbaedb7c68d9fcc..a69addf72f5b8b75750d7828ec0510d97b900ef3 100644 (file)
@@ -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:
index cf72169121cadc56b2306e5e28d74f0f1d23577f..be3ddbc73bd9a1e9cd8ccf76f548db19f0460ae3 100644 (file)
@@ -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):
index 1f3b8c7db47efb72a4c8264297e2175fa8d7a840..6ea00a74435b281ef0007a544133ceaf090c4ea2 100644 (file)
@@ -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()
index 364bd6e96eeda601990d78a54de79889c5711eee..e6142a2db8a3655e4cd32b9d5e4a44e2dc29ef4f 100644 (file)
@@ -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():
index d1dbdc625632712d47f376b8114d48e613b13756..19bb734028b9cebd5012d5d7f23f29845270c20e 100644 (file)
@@ -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)
index e12d0c8eaac4e0f53165122281a10267b7e96ce1..9a147b06b07eac015ad2bcaa9fc546423040e27f 100644 (file)
@@ -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():
index 106645eaa6b673acea99af44e9a6af1f469335db..884fa92ddd01b8995685b8e5f790a119fa855d02 100644 (file)
@@ -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)
index 792a699bfe8507e40c1903600ed6d31f5fdd6a9f..3acc0e1c2e1c42a4cea9bacd4ad39315705431b5 100644 (file)
@@ -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
index 3d57130b6e57adcc2c9c3299b2bd5dba500719a3..2b0793fe36b7eec6423542d0fb940beb6affa9a4 100644 (file)
@@ -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()
index 060de71163771d5c3a22aa0507295c909a424cb6..16fac74b9d0f47d52193ed3028c80da0f56c776b 100644 (file)
@@ -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
index ec9afd78dce07dde402e9481e0751ca5a8d843ac..ee6cc934c1b2aa4863196ec4c3d68a9724b48d39 100644 (file)
@@ -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():
index 9cb3c8229b02ee6d4fe513e84659631f8f0f7f66..8c126151024476759e18bb0024cfcd95b5b34ce1 100644 (file)
@@ -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'
index 39804e6b7042a31097ed5642431ce355926b3edc..6eb1ff87d825cce4dcfb263c6bdf867258f81130 100644 (file)
@@ -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'
index 31d7c5a1ce966a589c554d6cb90612ffd3e6af60..4defd28f56a3838004a90c217c1c78c2e43e0273 100644 (file)
@@ -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'
index 3727c484d6aec866a1028b3c0b33c378a7e2d773..1c3d317b4b17b814bae39bc1fe75be019390de13 100644 (file)
@@ -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):
index 825b23c49e1ab0b098375e3eeabac9e055ac30a8..601cc712dda9e62218de87d77e2ed219b1b1123e 100644 (file)
@@ -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():
index e0e75a1f17a86e942ed54b8cdf4273076c5ffba4..f362f55d37ef69ea7acc34fa0399bab7b0454979 100644 (file)
@@ -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,
diff --git a/release/scripts/op/nla.py b/release/scripts/op/nla.py
new file mode 100644 (file)
index 0000000..db8c0be
--- /dev/null
@@ -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()
index e809251de7c9b4d4c48f36f6de0c168377b157ea..2ecd445df1d02eb3a1603ee39a5836779bf4f507 100644 (file)
@@ -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]
index 76d5c9cfee922d25983a8c7a2feba463ab95010f..b3b674cb97ec4320172211a4c1642cdbf7614f4d 100644 (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.")
index 15cd80c6fdfa7c0fe1444f1d18d159a584c9b25b..311a8b119cfaf516e0aad0785108f469bf0c459b 100644 (file)
@@ -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")
index 4f382d550e29649fcb079cdb14d125e58cbf3d91..976c2ad78d5f57914dccef3c4958f5a4ea9bab8a 100644 (file)
@@ -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")
index 8e381986f23509579713dc91f24c33ca7f71ada4..62c81df2eceacefa3a0fc8c43770a0d19bc10ad3 100644 (file)
@@ -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")
index 8bf1617c12416689a1b3b0489539f343861262e3..5ae971bce6fbcc2a5c6422ed9e2f843105e5db37 100644 (file)
@@ -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")
+            col = split.column()
+            col.prop(md, "precision")
 
-                if wide_ui:
-                    col = split.column()
-                col.prop(md, "dynamic")
+            if wide_ui:
+                col = split.column()
+            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()
index d83253bf77182ad650f6cf6270ada807033fa789..7169d9369043bf189bf32991ebbdee09d63a8f81 100644 (file)
@@ -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()
index 47306dd92ac2f945ccd7c931e4a90eb3f58008fb..481da716e02737a9ef29cc305f48d9df1d039e10 100644 (file)
@@ -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)
index dbd2b90fea2c64d3a6f413a1faf23c334434dad3..54ddb6da8a69098ffbe4c47fc0a561a434c010bc 100644 (file)
@@ -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):
index 22a83e02ba70e3f8a140c2eb544f8d3a69f491fb..8761e8a38c0c42d8027c6967204ae9aa2f94c3fd 100644 (file)
@@ -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
index 9b24115d4920f3c3745d3b11f74a7261af0da91b..372509773ef68cb388f87d18127bab5e9d370841 100644 (file)
@@ -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()
 
index c6fd7e930d96206ffce6a62426b3dfe9992d4f0d..c033b6b68709141e85859cdf9f7ffb31194dc49c 100644 (file)
@@ -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()
index 553e6a8b4edf79605b00bec8b7c36d98a70d3129..ed0f70a18b1aacb74e4a805fb053dbb54a7d7ebe 100644 (file)
@@ -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:")
index 714f22f5ca68887336d94e5cd3d36b1b0f57dcc6..4b48ec926a6a102a30594ed2f61b4acca22d37b7 100644 (file)
@@ -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
index 2894761e7ac3be0992492e3290ded5b6ce9cd93b..7a2213c719c4913ec66abbf4e079ee024d1e3679 100644 (file)
@@ -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):
index 019f751449f4d36928c3eb15f84e9d84c33ba09d..9fc30a8189b0e0ce0be91213789d82a2f7b160fa 100644 (file)
@@ -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):
index b8c5c0104074ca2c5b46ae5ec9ddc30923b71d9b..1c48b99939d4dab1738ce4272d2a8a23da5a5942 100644 (file)
@@ -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()
index f8f8f5cefe36db339b77cf36c1864958640cc2d4..e1dccc0c9f0d635460c874c5d4649796b3015bfd 100644 (file)
@@ -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
index 9d7ac872c7532510870539ecabcefd93b13941d7..4680c5c1d19e499fa191fc2bc648fac603c91f9b 100644 (file)
@@ -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()
index 3a789566a6136c745bb9a5a3f50d024924e35c5e..9f52ae25121cd5c97dbdb852ed4056c7bb32b8e0 100644 (file)
@@ -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):
index cfd5fdfce0b578c9fd6487e44cd729631e9b4776..7417b9659b2d9d35b51c2180e521c999be9c3d6a 100644 (file)
@@ -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()
 
index 11969abfbb1ac7f81444ae0156cf3d717286cc0f..6a244c79857575e85c3f0c2f59adaeaae27ae6c1 100644 (file)
@@ -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 != '':
index 3cc588ecbaa77dbabad132bf57c33daa31912c53..fa0c5029416714c0e68d8b5937b3b710f589d60e 100644 (file)
@@ -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")
index 603ed93efeda4fabe47860d5975a09683e9e41bc..099e7944784635ce90f01c667ed1b5e385256e32 100644 (file)
@@ -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 #
 
index 2289cf7fc89dcd4b106368bb54bfd3df3bed70ef..f7c5531f0ac6b78ec724657658ccaca5a615c78a 100644 (file)
@@ -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;
 
index 214b5a32cd6a955df0a182a1d56228f1d0b2a359..4d3f000c863faa3c50621c8038c10f66deecb0ef 100644 (file)
@@ -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);
 
index 8865757b85a464c8fd2d873ad88cce65ad8595c4..64c5823f06f8a176e3759501c6b68ca2999d69e9 100644 (file)
@@ -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
index a8a0d7daa89f55a4e78ae61ff1c0cf4078831e45..d8b3fcfd0bb0e0b8d91287e0fb44a9dbe1e5d50f 100644 (file)
@@ -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 );
index 454666566dc6230fab0d544d9ad47a018a3e6a5c..cb61a08f3ba3b72cef009bbdbeda429f5d6a999a 100644 (file)
@@ -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);
index 5b842965225532d53453d9c335ea958f89b0fa79..30bce613dbe6ab8895daf58ed5968a78d9fd7e75 100644 (file)
@@ -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);
index 55f11e1066b86b2ad2dda389ce76e51f7cca6d81..170965a223a2241aee32b99f5d7d22ec5e15abba 100644 (file)
@@ -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);
index 09fb705dd70742e0e5be6dfdeaa8c35b9fa97007..090979b33e9f98ed010d421383a61c99d49f8255 100644 (file)
@@ -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);
index 9d15ac3f348c5c672bc6228d6691d1a4fdafea00..f4e3a60803e296f492f54952e7fe675543f4cb15 100644 (file)
@@ -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);
-       }
+       else
+               orco= get_orco_coords_dm(ob, em, layer, &free);
 
-       transform_mesh_orco_verts(ob->data, orco, totvert, 0);
+       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);
+               }
 
-       if((layerorco = DM_get_vert_data_layer(dm, CD_ORCO))) {
-               memcpy(layerorco, orco, sizeof(float)*totvert);
-               MEM_freeN(orco);
+               memcpy(layerorco, orco, sizeof(float)*3*totvert);
+               if(free) MEM_freeN(orco);
        }
-       else
-               DM_add_vert_layer(dm, CD_ORCO, CD_ASSIGN, 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);
index 2d52d6061b9507eabaf1efb92fd4b8b47874f4a7..365ac2371b8f7a78c560423ebeb4d9854ed421c4 100644 (file)
@@ -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 
index 1465f4550f5d4456af133557509911032074bcf4..b687062fe15ab46364e058e56b71ad20c82569c3 100644 (file)
@@ -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);
 
index 33fe6212cd238318fcaa040bf4866b2bf7ff2d30..2b11c4bdfa02c33afcbdf0f93d7fc8df65769736 100644 (file)
@@ -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;
index 9087a7ec4f2de126f294e96573f755cacfbec1eb..c87495d499e0d5eb23a1d576358a95841d5b419d 100644 (file)
@@ -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 (forRender) {
-                                       makeDispListCurveTypes_forRender(scene, cu->bevobj, &bevdisp, NULL, 0);
-                                       dl= bevdisp.first;
-                               } else {
+       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 {
+                               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;
-                                               }
+                       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);
+                               dl= dl->next;
                        }
+
+                       freedisplist(&bevdisp);
                }
        }
        else if(cu->ext1==0.0 && cu->ext2==0.0) {
index a755170aae616008b3bf438a9bc5431c4fc22976..0afb9a450dd05137b1e956fa904570c1de6f2906 100644 (file)
@@ -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);
 }
 
index 487ecb810d45dfca53047e3219b0a674002a076a..c65fac7d474ad6751ae5b69f1367a6423f29f274 100644 (file)
@@ -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];
index 2d5821572337036f8667e3ad38957958798803fc..63bfbc3d093f18c617530a42b71037e1baa04e49 100644 (file)
@@ -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)
index bea641d21403011ca0fbaaca3139a64bb57baeff..8605cf51b68f933d0c3cd6f2057322caded3f7f6 100644 (file)
@@ -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);                           
 }
index 6d1f9d1d1bfec208a7c5691c1fb1775b30ee2e29..1aa68bb832f60a602c5a0f1a1a51a0bdde5c387a 100644 (file)
@@ -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);
-       }
-}
index 543895a5973f5c1f361c7c3d48b898338beb4737..9e8767406b1839943943db7e8a1570bd1197993d 100644 (file)
@@ -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++;
                                }
                        }
                }
index 96877a9ae9e5f01fcb3370c37a022efe4ac73fd4..76e49c0726bb6f581ac32d940f321e9de9482381 100644 (file)
@@ -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;
-
-               if(smd->offset < 0.0f)  mv= mvert+numVerts;
-               else                                    mv= mvert;
+               float scalar_short;
+               float scalar_short_vgroup;
+
+
+               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);
+                       }
+               }
 
-               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_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);
+                               }
+                       }
+               }
+
+               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]));
+                               }
+                       }
+               }
 
-               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_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;
                        }
                }
index 4af007a5f91094492da9340bc824ba92719643ab..ab2a6f713cb5fba694d9e861317fe31876ff917f 100644 (file)
 #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 */
+}
+
 /* *************************************************** */
index 5bd9694e768be1dbcee321aa347d1bd792f8618e..9ff7f1f29822ef3f2e05ad9ccc5697863e452efc 100644 (file)
@@ -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;
                }
index bb7c77408ac2c733d63622b32007e657c8c28ea7..ac679adb9c118e748d9b0a3453f34338e2cf70ac 100644 (file)
@@ -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
index bd9e041dab4326b0b7f87e7b321dc213119a74fd..7ad65820bbed43f2dd788cd2f867c391f15d9b39 100644 (file)
@@ -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)
index a8446c0009ff73805ccffc04d0509b404e966cbb..aa48336247c56d2c8934562aab28e6e5d06b2845 100644 (file)
@@ -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);
 }
index cbe294f134771a57bf2eced900bed3fd35735ede..807e25955a7f3bd392f17776d03d7162ea9c6d04 100644 (file)
@@ -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 */
index b8d8cd0dc8f3555f3af907922be5a304647e8386..d1edeb8322beac8e195bb600043249d37c7e5c56 100644 (file)
@@ -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;
+}
index 913ec3d4cae55a2f68ae9e089d28d5d7870f35e7..790087334c6270a7bddf2109c08a5388cfad73f2 100644 (file)
@@ -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);
index 00e810637601e5925bcbed9fd28198de42a22032..aa513ab0fb77d91a65d87ab4219f175024f6faf6 100644 (file)
@@ -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);
index 8b0625fc282294837e2735c06aa45f47de0502b5..3028161734c609e4fad37af1006d0331355eeb0b 100644 (file)
@@ -74,8 +74,6 @@ extern "C" {
 
 #include "BLI_listbase.h"
 
-#include "BLI_dynamiclist.h"
-
 #include "BLI_string.h"
 
 #include "BLI_path_util.h"
diff --git a/source/blender/blenlib/BLI_dynamiclist.h b/source/blender/blenlib/BLI_dynamiclist.h
deleted file mode 100644 (file)
index 1334d83..0000000
+++ /dev/null
@@ -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
index 1f6a1ee5a971ab9ec78c6e2d6fdcd05d94a73c1d..599487354c36662c4a2d35a696ac5402cda39453 100644 (file)
@@ -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" {
index 8c84df9c2459435703e3807876c6915300b6e602..72724c1c0f78c3575785d40adc51680ef33e9e51 100644 (file)
@@ -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);
diff --git a/source/blender/blenlib/intern/dynamiclist.c b/source/blender/blenlib/intern/dynamiclist.c
deleted file mode 100644 (file)
index f059ce3..0000000
+++ /dev/null
@@ -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));
-}
-
-/*=====================================================================================*/
index a1bb2754d95c7a252071900d9d3e8df36f521886..6aa85d140848ce2301db0a8b27fee6076122c20f 100644 (file)
@@ -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;
index f630ba30a688d1c95badb9cd95071ce1b03982e2..1fe847636bd265507cb1e7959b172c576fa9cadf 100644 (file)
@@ -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
index a2f30ae5b01ebe4a9967af0b3da8b904d0020dcd..d9fea2483b9468fe37149aaf1f808c6a735f4af9 100644 (file)
@@ -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) {
-