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:
authorBastien Montagne <montagne29@wanadoo.fr>2014-08-25 17:33:23 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2014-08-25 17:33:23 +0400
commit09dd79eddd8e57951ae9cfb3237e58f40c86138c (patch)
tree346cb4dd4360185b69d6b84aae7196d811a28740 /io_export_pc2.py
parent9c84ce1262ed4468fe7a3b04b0404cd9e3cb93a8 (diff)
Fix T41118: Mesh cache modifier cannot use sub-frames stored in .pc2 files?
Actually issue was in pc2 exporter, which was not handling subframes correctly.
Diffstat (limited to 'io_export_pc2.py')
-rw-r--r--io_export_pc2.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/io_export_pc2.py b/io_export_pc2.py
index 663f3a5f..e00ee46b 100644
--- a/io_export_pc2.py
+++ b/io_export_pc2.py
@@ -19,8 +19,8 @@
bl_info = {
"name": "Export Pointcache Format(.pc2)",
"author": "Florian Meyer (tstscr)",
- "version": (1, 0),
- "blender": (2, 57, 0),
+ "version": (1, 1),
+ "blender": (2, 71, 0),
"location": "File > Export > Pointcache (.pc2)",
"description": "Export mesh Pointcache data (.pc2)",
"warning": "",
@@ -41,16 +41,17 @@ cacheFile -pc2 1 -pcf "<insert filepath of source>" -f "<insert target filename
"""
import bpy
-from bpy.props import *
-import mathutils, math, struct
+from bpy.props import BoolProperty, IntProperty, EnumProperty
+import mathutils
+from bpy_extras.io_utils import ExportHelper
+
from os import remove
import time
-from bpy_extras.io_utils import ExportHelper
+import math
+import struct
-def getSampling(start, end, sampling):
- samples = [start + x * sampling
- for x in range(int((end - start) / sampling) + 1)]
- return samples
+def get_sampled_frames(start, end, sampling):
+ return [math.modf(start + x * sampling) for x in range(int((end - start) / sampling) + 1)]
def do_export(context, props, filepath):
mat_x90 = mathutils.Matrix.Rotation(-math.pi/2, 4, 'X')
@@ -62,7 +63,7 @@ def do_export(context, props, filepath):
apply_modifiers = props.apply_modifiers
me = ob.to_mesh(sc, apply_modifiers, 'PREVIEW')
vertCount = len(me.vertices)
- sampletimes = getSampling(start, end, sampling)
+ sampletimes = get_sampled_frames(start, end, sampling)
sampleCount = len(sampletimes)
# Create the header
@@ -74,7 +75,7 @@ def do_export(context, props, filepath):
file.write(headerStr)
for frame in sampletimes:
- sc.frame_set(frame)
+ sc.frame_set(int(frame[1]), frame[0]) # stupid modf() gives decimal part first!
me = ob.to_mesh(sc, apply_modifiers, 'PREVIEW')
if len(me.vertices) != vertCount: