OLD | NEW |
1 //-***************************************************************************** | 1 //-***************************************************************************** |
2 // | 2 // |
3 // Copyright (c) 2009-2011, | 3 // Copyright (c) 2009-2011, |
4 // Sony Pictures Imageworks Inc. and | 4 // Sony Pictures Imageworks Inc. and |
5 // Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd. | 5 // Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd. |
6 // | 6 // |
7 // All rights reserved. | 7 // All rights reserved. |
8 // | 8 // |
9 // Redistribution and use in source and binary forms, with or without | 9 // Redistribution and use in source and binary forms, with or without |
10 // modification, are permitted provided that the following conditions are | 10 // modification, are permitted provided that the following conditions are |
(...skipping 21 matching lines...) Expand all Loading... |
32 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 32 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
33 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 33 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
34 // | 34 // |
35 //-***************************************************************************** | 35 //-***************************************************************************** |
36 | 36 |
37 #include "MayaPointPrimitiveWriter.h" | 37 #include "MayaPointPrimitiveWriter.h" |
38 #include "MayaUtility.h" | 38 #include "MayaUtility.h" |
39 | 39 |
40 MayaPointPrimitiveWriter::MayaPointPrimitiveWriter( | 40 MayaPointPrimitiveWriter::MayaPointPrimitiveWriter( |
41 double iFrame, MDagPath & iDag, Alembic::AbcGeom::OObject & iParent, | 41 double iFrame, MDagPath & iDag, Alembic::AbcGeom::OObject & iParent, |
42 uint32_t iTimeIndex, | 42 Alembic::Util::uint32_t iTimeIndex, |
43 bool iWriteVisibility, bool iForceStatic) : | 43 const JobArgs & iArgs) : |
44 mIsAnimated(false), mDagPath(iDag) | 44 mIsAnimated(false), mDagPath(iDag) |
45 { | 45 { |
46 MFnParticleSystem particle(mDagPath); | 46 MFnParticleSystem particle(mDagPath); |
47 Alembic::AbcGeom::OPoints obj(iParent, particle.name().asChar(), | 47 MString name = particle.name(); |
| 48 if (iArgs.stripNamespace) |
| 49 { |
| 50 name = util::stripNamespaces(name); |
| 51 } |
| 52 Alembic::AbcGeom::OPoints obj(iParent, name.asChar(), |
48 iTimeIndex); | 53 iTimeIndex); |
49 mSchema = obj.getSchema(); | 54 mSchema = obj.getSchema(); |
50 | 55 |
51 Alembic::Abc::OCompoundProperty cp = mSchema.getArbGeomParams(); | 56 Alembic::Abc::OCompoundProperty cp; |
52 mAttrs = AttributesWriterPtr(new AttributesWriter(cp, particle, | 57 if (AttributesWriter::hasAnyAttr(particle, iArgs)) |
53 iTimeIndex, iWriteVisibility, iForceStatic)); | 58 { |
| 59 cp = mSchema.getArbGeomParams(); |
| 60 } |
| 61 |
| 62 mAttrs = AttributesWriterPtr(new AttributesWriter(cp, obj, particle, |
| 63 iTimeIndex, iArgs)); |
54 | 64 |
55 MObject object = iDag.node(); | 65 MObject object = iDag.node(); |
56 if (!iForceStatic && util::isAnimated(object)) | 66 if (iTimeIndex != 0 && util::isAnimated(object)) |
57 mIsAnimated = true; | 67 mIsAnimated = true; |
58 | 68 |
59 write(iFrame); | 69 write(iFrame); |
60 } | 70 } |
61 | 71 |
62 void MayaPointPrimitiveWriter::write(double iFrame) | 72 void MayaPointPrimitiveWriter::write(double iFrame) |
63 { | 73 { |
64 std::vector<float> position; | 74 std::vector<float> position; |
65 std::vector<float> velocity; | 75 std::vector<float> velocity; |
66 std::vector< uint64_t > particleIds; | 76 std::vector< Alembic::Util::uint64_t > particleIds; |
67 std::vector<float> width; | 77 std::vector<float> width; |
68 float constantwidth = -1.0; | 78 float constantwidth = -1.0; |
69 | 79 |
70 bool runupFromStart = false; | 80 bool runupFromStart = false; |
71 MTime to(iFrame); | 81 MTime to(iFrame); |
72 | 82 |
73 // need to force re-evaluation | 83 // need to force re-evaluation |
74 MFnParticleSystem particle(mDagPath); | 84 MFnParticleSystem particle(mDagPath); |
75 particle.evaluateDynamics(to, runupFromStart); | 85 particle.evaluateDynamics(to, runupFromStart); |
76 | 86 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 unsigned int MayaPointPrimitiveWriter::getNumCVs() | 150 unsigned int MayaPointPrimitiveWriter::getNumCVs() |
141 { | 151 { |
142 MFnParticleSystem particle(mDagPath); | 152 MFnParticleSystem particle(mDagPath); |
143 return particle.count(); | 153 return particle.count(); |
144 } | 154 } |
145 | 155 |
146 bool MayaPointPrimitiveWriter::isAnimated() const | 156 bool MayaPointPrimitiveWriter::isAnimated() const |
147 { | 157 { |
148 return mIsAnimated; | 158 return mIsAnimated; |
149 } | 159 } |
OLD | NEW |