Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2016-04-26 14:39:12 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-04-26 14:39:12 +0300
commitfe34f82e7059bb6b89dfc88b55f030111f2d431f (patch)
treedb791c9a6b8eb7930725a21569e01fefee5a3a89 /io_shape_mdd
parent8b80d24da9e99b51cafb3533d0b4351b358fcf75 (diff)
Make rest-frame optional (default off)
When the rest frame is included, increase the total-frame variable written to the MDD. D1923 by @unixcyclist with edits
Diffstat (limited to 'io_shape_mdd')
-rw-r--r--io_shape_mdd/__init__.py14
-rw-r--r--io_shape_mdd/export_mdd.py13
2 files changed, 20 insertions, 7 deletions
diff --git a/io_shape_mdd/__init__.py b/io_shape_mdd/__init__.py
index beef8d4c..7715b18f 100644
--- a/io_shape_mdd/__init__.py
+++ b/io_shape_mdd/__init__.py
@@ -39,7 +39,12 @@ if "bpy" in locals():
import bpy
-from bpy.props import StringProperty, IntProperty, FloatProperty
+from bpy.props import (
+ BoolProperty,
+ FloatProperty,
+ IntProperty,
+ StringProperty,
+ )
from bpy_extras.io_utils import ExportHelper, ImportHelper
@@ -95,7 +100,7 @@ class ExportMDD(bpy.types.Operator, ExportHelper):
# get first scene to get min and max properties for frames, fps
- minframe = 1
+ minframe = 0
maxframe = 300000
minfps = 1.0
maxfps = 120.0
@@ -120,6 +125,11 @@ class ExportMDD(bpy.types.Operator, ExportHelper):
min=minframe, max=maxframe,
default=250,
)
+ use_rest_frame = BoolProperty(
+ name="Rest Frame",
+ description="Write the rest state at the first frame",
+ default=False,
+ )
@classmethod
def poll(cls, context):
diff --git a/io_shape_mdd/export_mdd.py b/io_shape_mdd/export_mdd.py
index e7fda3ac..155f6641 100644
--- a/io_shape_mdd/export_mdd.py
+++ b/io_shape_mdd/export_mdd.py
@@ -51,7 +51,7 @@ def check_vertcount(mesh, vertcount):
raise Exception('Error, number of verts has changed during animation, cannot export')
-def save(context, filepath="", frame_start=1, frame_end=300, fps=25.0):
+def save(context, filepath="", frame_start=1, frame_end=300, fps=25.0, use_rest_frame=False):
"""
Blender.Window.WaitCursor(1)
@@ -82,6 +82,9 @@ def save(context, filepath="", frame_start=1, frame_end=300, fps=25.0):
numverts = len(me.vertices)
numframes = frame_end - frame_start + 1
+ if use_rest_frame:
+ numframes += 1
+
f = open(filepath, 'wb') # no Errors yet:Safe to create file
# Write the header
@@ -90,10 +93,10 @@ def save(context, filepath="", frame_start=1, frame_end=300, fps=25.0):
# Write the frame times (should we use the time IPO??)
f.write(pack(">%df" % (numframes), *[frame / fps for frame in range(numframes)])) # seconds
- #rest frame needed to keep frames in sync
- check_vertcount(me, numverts)
- me.transform(mat_flip * obj.matrix_world)
- f.write(pack(">%df" % (numverts * 3), *[axis for v in me.vertices for axis in v.co]))
+ if use_rest_frame:
+ check_vertcount(me, numverts)
+ me.transform(mat_flip * obj.matrix_world)
+ f.write(pack(">%df" % (numverts * 3), *[axis for v in me.vertices for axis in v.co]))
for frame in range(frame_start, frame_end + 1): # in order to start at desired frame
scene.frame_set(frame)