Commit: 2891298ad26b6970fdb0899a537e442166adf00a
Author: Lukas Tönne
Date:   Wed Mar 25 13:35:52 2015 +0100
Branches: gooseberry
https://developer.blender.org/rB2891298ad26b6970fdb0899a537e442166adf00a

Fix wrong time sampling in customdata array properties.

The time sampling should be specified explicitly when creating
properties.

===================================================================

M       source/blender/pointcache/alembic/abc_customdata.cpp
M       source/blender/pointcache/alembic/abc_customdata.h
M       source/blender/pointcache/alembic/abc_mesh.cpp
M       source/blender/pointcache/alembic/abc_writer.h

===================================================================

diff --git a/source/blender/pointcache/alembic/abc_customdata.cpp 
b/source/blender/pointcache/alembic/abc_customdata.cpp
index 6f60a7f..a55270e 100644
--- a/source/blender/pointcache/alembic/abc_customdata.cpp
+++ b/source/blender/pointcache/alembic/abc_customdata.cpp
@@ -376,6 +376,11 @@ CustomDataWriter::~CustomDataWriter()
        }
 }
 
+void CustomDataWriter::init(TimeSamplingPtr time_sampling)
+{
+       m_time_sampling = time_sampling;
+}
+
 /* unique property name based on either layer name or index */
 std::string CustomDataWriter::cdtype_to_name(CustomData *cdata, CustomDataType 
type, int n)
 {
diff --git a/source/blender/pointcache/alembic/abc_customdata.h 
b/source/blender/pointcache/alembic/abc_customdata.h
index f943242..6201b55 100644
--- a/source/blender/pointcache/alembic/abc_customdata.h
+++ b/source/blender/pointcache/alembic/abc_customdata.h
@@ -48,6 +48,8 @@ struct CustomDataWriter {
        CustomDataWriter(const std::string &name, CustomDataMask cdmask);
        ~CustomDataWriter();
        
+       void init(Abc::TimeSamplingPtr time_sampling);
+       
        void write_sample(CustomData *cdata, int num_data, 
Abc::OCompoundProperty &parent);
        
        Abc::OCompoundProperty &props() { return m_props; }
@@ -57,7 +59,7 @@ struct CustomDataWriter {
        {
                LayerPropsMap::iterator it = m_layer_props.find(name);
                if (it == m_layer_props.end()) {
-                       PropertyT prop = PropertyT(parent, name, 0);
+                       PropertyT prop = PropertyT(parent, name, 
m_time_sampling);
                        m_layer_props.insert(LayerPropsPair(name, 
prop.getPtr()));
                        return prop;
                }
@@ -71,7 +73,7 @@ struct CustomDataWriter {
        {
                LayerPropsMap::iterator it = m_layer_props.find(name);
                if (it == m_layer_props.end()) {
-                       PropertyT prop = PropertyT(parent, name, 0);
+                       PropertyT prop = PropertyT(parent, name, 
m_time_sampling);
                        m_layer_props.insert(LayerPropsPair(name, 
prop.getPtr()));
                        return prop;
                }
@@ -86,6 +88,7 @@ private:
        std::string m_name;
        CustomDataMask m_cdmask;
        
+       Abc::TimeSamplingPtr m_time_sampling;
        Abc::OCompoundProperty m_props;
        LayerPropsMap m_layer_props;
 };
diff --git a/source/blender/pointcache/alembic/abc_mesh.cpp 
b/source/blender/pointcache/alembic/abc_mesh.cpp
index c502b07..7daa3b7 100644
--- a/source/blender/pointcache/alembic/abc_mesh.cpp
+++ b/source/blender/pointcache/alembic/abc_mesh.cpp
@@ -102,20 +102,26 @@ void AbcDerivedMeshWriter::init_abc(OObject parent)
 //     OCompoundProperty geom_props = schema.getArbGeomParams();
        OCompoundProperty user_props = schema.getUserProperties();
        
-       m_prop_vert_normals = ON3fArrayProperty(user_props, "vertex_normals", 
0);
-       m_prop_vert_flag = OCharArrayProperty(user_props, "vertex_flag", 0);
-       m_prop_vert_bweight = OCharArrayProperty(user_props, "vertex_bweight", 
0);
-       
-       m_prop_edge_verts = OUInt32ArrayProperty(user_props, "edge_verts", 0);
-       m_prop_edge_flag = OInt16ArrayProperty(user_props, "edge_flag", 0);
-       m_prop_edge_crease = OCharArrayProperty(user_props, "edge_crease", 0);
-       m_prop_edge_bweight = OCharArrayProperty(user_props, "edge_bweight", 0);
-       
-       m_prop_poly_mat_nr = OInt16ArrayProperty(user_props, "poly_mat_nr", 0);
-       m_prop_poly_flag = OCharArrayProperty(user_props, "poly_flag", 0);
-       
-       m_prop_loop_verts = OInt32ArrayProperty(user_props, "loop_verts", 0);
-       m_prop_loop_edges = OInt32ArrayProperty(user_props, "loop_edges", 0);
+       m_prop_vert_normals = ON3fArrayProperty(user_props, "vertex_normals", 
frame_sampling());
+       m_prop_vert_flag = OCharArrayProperty(user_props, "vertex_flag", 
frame_sampling());
+       m_prop_vert_bweight = OCharArrayProperty(user_props, "vertex_bweight", 
frame_sampling());
+       
+       m_prop_edge_verts = OUInt32ArrayProperty(user_props, "edge_verts", 
frame_sampling());
+       m_prop_edge_flag = OInt16ArrayProperty(user_props, "edge_flag", 
frame_sampling());
+       m_prop_edge_crease = OCharArrayProperty(user_props, "edge_crease", 
frame_sampling());
+       m_prop_edge_bweight = OCharArrayProperty(user_props, "edge_bweight", 
frame_sampling());
+       
+       m_prop_poly_mat_nr = OInt16ArrayProperty(user_props, "poly_mat_nr", 
frame_sampling());
+       m_prop_poly_flag = OCharArrayProperty(user_props, "poly_flag", 
frame_sampling());
+       
+       m_prop_loop_verts = OInt32ArrayProperty(user_props, "loop_verts", 
frame_sampling());
+       m_prop_loop_edges = OInt32ArrayProperty(user_props, "loop_edges", 
frame_sampling());
+       
+       m_vert_data_writer.init(frame_sampling());
+       m_edge_data_writer.init(frame_sampling());
+       m_face_data_writer.init(frame_sampling());
+       m_poly_data_writer.init(frame_sampling());
+       m_loop_data_writer.init(frame_sampling());
 }
 
 /* XXX modifiers are not allowed to generate poly normals on their own!
diff --git a/source/blender/pointcache/alembic/abc_writer.h 
b/source/blender/pointcache/alembic/abc_writer.h
index c8b6b6b..27c9abb 100644
--- a/source/blender/pointcache/alembic/abc_writer.h
+++ b/source/blender/pointcache/alembic/abc_writer.h
@@ -77,6 +77,7 @@ protected:
 
 class AbcWriter : public Writer {
 public:
+       Abc::TimeSamplingPtr frame_sampling() { return 
m_abc_archive->frame_sampling(); }
        
        void init(WriterArchive *archive)
        {

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to