[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27382] branches/render25: Render Branch: svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r27366 :27381

Brecht Van Lommel brecht at blender.org
Wed Mar 10 12:01:26 CET 2010


Revision: 27382
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27382
Author:   blendix
Date:     2010-03-10 12:01:26 +0100 (Wed, 10 Mar 2010)

Log Message:
-----------
Render Branch: svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r27366:27381

Modified Paths:
--------------
    branches/render25/intern/itasc/Armature.cpp
    branches/render25/release/scripts/ui/properties_texture.py
    branches/render25/source/blender/blenkernel/BKE_particle.h
    branches/render25/source/blender/blenkernel/intern/customdata.c
    branches/render25/source/blender/blenkernel/intern/fluidsim.c
    branches/render25/source/blender/blenkernel/intern/image.c
    branches/render25/source/blender/blenkernel/intern/library.c
    branches/render25/source/blender/blenkernel/intern/packedFile.c
    branches/render25/source/blender/blenkernel/intern/particle_system.c
    branches/render25/source/blender/blenkernel/intern/pointcache.c
    branches/render25/source/blender/blenkernel/intern/sequencer.c
    branches/render25/source/blender/blenkernel/intern/softbody.c
    branches/render25/source/blender/blenkernel/intern/sound.c
    branches/render25/source/blender/blenkernel/intern/text.c
    branches/render25/source/blender/blenkernel/intern/writeavi.c
    branches/render25/source/blender/blenkernel/intern/writeffmpeg.c
    branches/render25/source/blender/blenlib/BLI_path_util.h
    branches/render25/source/blender/blenlib/intern/bpath.c
    branches/render25/source/blender/blenlib/intern/path_util.c
    branches/render25/source/blender/blenloader/intern/readfile.c
    branches/render25/source/blender/collada/DocumentExporter.cpp
    branches/render25/source/blender/editors/interface/interface_draw.c
    branches/render25/source/blender/editors/interface/interface_handlers.c
    branches/render25/source/blender/editors/interface/interface_ops.c
    branches/render25/source/blender/editors/interface/view2d_ops.c
    branches/render25/source/blender/editors/mesh/editmesh_add.c
    branches/render25/source/blender/editors/object/object_modifier.c
    branches/render25/source/blender/editors/physics/physics_fluid.c
    branches/render25/source/blender/editors/screen/screendump.c
    branches/render25/source/blender/editors/space_console/space_console.c
    branches/render25/source/blender/editors/space_file/file_ops.c
    branches/render25/source/blender/editors/space_file/filesel.c
    branches/render25/source/blender/editors/space_file/writeimage.c
    branches/render25/source/blender/editors/space_image/image_ops.c
    branches/render25/source/blender/editors/space_outliner/outliner.c
    branches/render25/source/blender/editors/space_text/text_ops.c
    branches/render25/source/blender/editors/space_view3d/drawobject.c
    branches/render25/source/blender/makesdna/DNA_space_types.h
    branches/render25/source/blender/makesrna/SConscript
    branches/render25/source/blender/makesrna/intern/rna_image_api.c
    branches/render25/source/blender/quicktime/apple/qtkit_export.m
    branches/render25/source/blender/quicktime/apple/quicktime_export.c
    branches/render25/source/blender/render/intern/source/lamp.c
    branches/render25/source/blender/windowmanager/intern/wm_operators.c
    branches/render25/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt
    branches/render25/source/blenderplayer/bad_level_call_stubs/SConscript
    branches/render25/source/blenderplayer/bad_level_call_stubs/stubs.c
    branches/render25/source/creator/creator.c
    branches/render25/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
    branches/render25/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
    branches/render25/source/gameengine/Ketsji/KX_Light.h
    branches/render25/source/gameengine/Ketsji/KX_PythonInit.cpp
    branches/render25/source/gameengine/Ketsji/KX_Scene.cpp

Added Paths:
-----------
    branches/render25/release/scripts/io/import_shape_mdd.py
    branches/render25/release/scripts/modules/rigify/shape_key_control.py
    branches/render25/release/scripts/modules/rigify/tail_control.py
    branches/render25/release/scripts/op/fcurve_euler_filter.py
    branches/render25/release/scripts/op/image.py
    branches/render25/release/scripts/op/object_align.py
    branches/render25/release/scripts/templates/operator_modal.py
    branches/render25/release/scripts/templates/operator_modal_draw.py

Modified: branches/render25/intern/itasc/Armature.cpp
===================================================================
--- branches/render25/intern/itasc/Armature.cpp	2010-03-10 08:17:18 UTC (rev 27381)
+++ branches/render25/intern/itasc/Armature.cpp	2010-03-10 11:01:26 UTC (rev 27382)
@@ -340,11 +340,6 @@
 	}
 	if ((joint.getNDof() == 1 && dof > 0) || (joint.getNDof() == 2 && dof > 1))
 		return -1;
-	if (joint.getType() < Joint::TransX || joint.getType() == Joint::Swing) {
-		// for rotation joint, the limit is given in degree, convert to radian
-		_min *= KDL::deg2rad;
-		_max *= KDL::deg2rad;
-	}
 	Joint_struct& p_joint = m_joints[segment_it->second.q_nr+dof];
 	p_joint.min = _min;
 	p_joint.max = _max;

Added: branches/render25/release/scripts/io/import_shape_mdd.py
===================================================================
--- branches/render25/release/scripts/io/import_shape_mdd.py	                        (rev 0)
+++ branches/render25/release/scripts/io/import_shape_mdd.py	2010-03-10 11:01:26 UTC (rev 27382)
@@ -0,0 +1,157 @@
+# ***** 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+# ***** END GPL LICENCE BLOCK *****
+
+# <pep8 compliant>
+
+# mdd importer by Bill L.Nieuwendorp
+# conversion to blender 2.5: Ivo Grigull (loolarge)
+#
+# Warning if the vertex order or vertex count differs from the
+# origonal model the mdd was Baked out from their will be Strange
+# behavior
+#
+# vertex animation to ShapeKeys with ipo  and gives the frame a value of 1.0 
+# A modifier to read mdd files would be Ideal but thats for another day :)
+#
+# Please send any fixes,updates,bugs to Slow67_at_Gmail.com
+# Bill Niewuendorp
+
+import bpy
+from struct import unpack
+
+
+def mdd_import(filepath, ob, scene, PREF_START_FRAME=0, PREF_JUMP=1):
+    
+    print('\n\nimporting mdd "%s"' % filepath)
+    
+    bpy.ops.object.mode_set(mode='OBJECT')
+
+    file = open(filepath, 'rb')
+    frames, points = unpack(">2i", file.read(8))
+    time = unpack((">%df" % frames), file.read(frames * 4))
+    
+    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 )
+    except:
+        basis = ob.add_shape_key()
+        basis.name = "Basis"
+        ob.data.update()
+
+    scene.current_frame = PREF_START_FRAME
+
+    def UpdateMesh(ob, fr):
+
+        # Insert new shape key
+        new_shapekey = ob.add_shape_key()
+        new_shapekey.name = ("frame_%.4d" % fr)
+        new_shapekey_name = new_shapekey.name
+
+        ob.active_shape_key_index = len(ob.data.shape_keys.keys)-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
+
+
+        for v in verts:
+            # 12 is the size of 3 floats
+            x,y,z= unpack('>3f', file.read(12))
+            v.co[:] = x,z,y
+        #me.update()
+        ob.shape_key_lock = False
+
+
+        # insert keyframes
+        shape_keys = ob.data.shape_keys
+
+        scene.current_frame -= 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
+        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
+        ob.data.shape_keys.keys[index].value = 0.0
+        shape_keys.keys[len(ob.data.shape_keys.keys)-1].keyframe_insert("value")
+
+        ob.data.update()
+
+
+    for i in range(frames):
+        UpdateMesh(ob, i)
+
+
+from bpy.props import *
+
+
+class importMDD(bpy.types.Operator):
+    '''Import MDD vertex keyframe file to shape keys'''
+    bl_idname = "import.mdd"
+    bl_label = "Import MDD"
+
+    # get first scene to get min and max properties for frames, fps
+
+    minframe = 1
+    maxframe = 300000
+    minfps = 1
+    maxfps = 120
+
+    # List of operator properties, the attributes will be assigned
+    # 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)
+
+
+    def poll(self, context):
+        ob = context.active_object
+        return (ob and ob.type == 'MESH')
+
+    def execute(self, context):
+        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)
+
+        return {'FINISHED'}
+
+    def invoke(self, context, event):
+        wm = context.manager
+        wm.add_fileselect(self)
+        return {'RUNNING_MODAL'}
+
+
+def menu_func(self, context):
+    self.layout.operator(importMDD.bl_idname, text="Lightwave Point Cache (.mdd)")
+
+
+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)
+
+if __name__ == "__main__":
+    register()

Added: branches/render25/release/scripts/modules/rigify/shape_key_control.py
===================================================================
--- branches/render25/release/scripts/modules/rigify/shape_key_control.py	                        (rev 0)
+++ branches/render25/release/scripts/modules/rigify/shape_key_control.py	2010-03-10 11:01:26 UTC (rev 27382)
@@ -0,0 +1,320 @@
+# ##### 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
+from rigify import RigifyError
+from rigify_utils import copy_bone_simple
+from rna_prop_ui import rna_idprop_ui_prop_get
+
+#METARIG_NAMES = ("cpy",)
+RIG_TYPE = "shape_key_control"
+
+
+def addget_shape_key(obj, name="Key"):
+    """ Fetches a shape key, or creates it if it doesn't exist
+    """
+    # Create a shapekey set if it doesn't already exist
+    if obj.data.shape_keys is None:
+        shape = obj.add_shape_key(name="Basis", from_mix=False)
+        obj.active_shape_key_index = 0
+
+    # Get the shapekey, or create it if it doesn't already exist
+    if name in obj.data.shape_keys.keys:
+        shape_key = obj.data.shape_keys.keys[name]
+    else:
+        shape_key = obj.add_shape_key(name=name, from_mix=False)
+
+    return shape_key
+
+
+def addget_shape_key_driver(obj, name="Key"):
+    """ Fetches the driver for the shape key, or creates it if it doesn't
+        already exist.
+    """
+    driver_path = 'keys["' + name + '"].value'
+    fcurve = None
+    driver = None
+    new = False
+    if obj.data.shape_keys.animation_data is not None:
+        for driver_s in obj.data.shape_keys.animation_data.drivers:
+            if driver_s.data_path == driver_path:
+                fcurve = driver_s
+    if fcurve == None:
+        fcurve = obj.data.shape_keys.keys[name].driver_add("value", 0)
+        fcurve.driver.type = 'AVERAGE'
+        new = True
+
+    return fcurve, new
+
+
+# TODO:
+def metarig_template():
+    # generated by rigify.write_meta_rig
+    #bpy.ops.object.mode_set(mode='EDIT')
+    #obj = bpy.context.active_object
+    #arm = obj.data
+    #bone = arm.edit_bones.new('Bone')
+    #bone.head[:] = 0.0000, 0.0000, 0.0000
+    #bone.tail[:] = 0.0000, 0.0000, 1.0000
+    #bone.roll = 0.0000
+    #bone.connected = False
+    #
+    #bpy.ops.object.mode_set(mode='OBJECT')
+    #pbone = obj.pose.bones['Bone']
+    #pbone['type'] = 'copy'
+    pass
+
+
+def metarig_definition(obj, orig_bone_name):
+    bone = obj.data.bones[orig_bone_name]
+    return [bone.name]
+
+
+def main(obj, definitions, base_names, options):
+    """ A rig that drives shape keys with the local transforms and/or custom
+        properties of a single bone.
+        A different shape can be driven by the negative value of a transform as
+        well by giving a comma-separated list of two shapes.
+
+        Required options:
+            mesh:  name of mesh object(s) to add/get shapekeys to/from
+                   (if multiple objects, make a comma-separated list)
+        Optional options:
+            loc_<x/y/z>:       name of the shape key to tie to translation of the bone
+            loc_<x/y/z>_fac:   default multiplier of the bone influence on the shape key
+            rot_<x/y/z>:       name of the shape key to tie to rotation of the bone
+            rot_<x/y/z>_fac:   default multiplier of the bone influence on the shape key
+            scale_<x/y/z>:     name of the shape key to tie to scale of the bone
+            scale_<x/y/z>_fac: default multiplier of the bone influence on the shape key

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list