- fbx: permit empty deformers.
parent
666f2776d7
commit
3e3eb6fb7c
|
@ -622,6 +622,10 @@ private:
|
||||||
const WeightIndexArray& indices = cluster->GetIndices();
|
const WeightIndexArray& indices = cluster->GetIndices();
|
||||||
const WeightArray& weights = cluster->GetWeights();
|
const WeightArray& weights = cluster->GetWeights();
|
||||||
|
|
||||||
|
if(indices.empty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const MatIndexArray& mats = geo.GetMaterialIndices();
|
const MatIndexArray& mats = geo.GetMaterialIndices();
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
|
|
@ -82,25 +82,29 @@ Cluster::Cluster(uint64_t id, const Element& element, const Document& doc, const
|
||||||
{
|
{
|
||||||
const Scope& sc = GetRequiredScope(element);
|
const Scope& sc = GetRequiredScope(element);
|
||||||
|
|
||||||
const Element& Indexes = GetRequiredElement(sc,"Indexes",&element);
|
const Element* const Indexes = sc["Indexes"];
|
||||||
const Element& Weights = GetRequiredElement(sc,"Weights",&element);
|
const Element* const Weights = sc["Weights"];
|
||||||
|
|
||||||
const Element& Transform = GetRequiredElement(sc,"Transform",&element);
|
const Element& Transform = GetRequiredElement(sc,"Transform",&element);
|
||||||
const Element& TransformLink = GetRequiredElement(sc,"TransformLink",&element);
|
const Element& TransformLink = GetRequiredElement(sc,"TransformLink",&element);
|
||||||
|
|
||||||
transform = ReadMatrix(Transform);
|
transform = ReadMatrix(Transform);
|
||||||
transformLink = ReadMatrix(TransformLink);
|
transformLink = ReadMatrix(TransformLink);
|
||||||
|
|
||||||
ReadVectorDataArray(indices,Indexes);
|
// it is actually possible that there be Deformer's with no weights
|
||||||
ReadVectorDataArray(weights,Weights);
|
if (!!Indexes != !!Weights) {
|
||||||
|
DOMError("either Indexes or Weights are missing from Cluster",&element);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Indexes) {
|
||||||
|
ReadVectorDataArray(indices,*Indexes);
|
||||||
|
ReadVectorDataArray(weights,*Weights);
|
||||||
|
}
|
||||||
|
|
||||||
if(indices.size() != weights.size()) {
|
if(indices.size() != weights.size()) {
|
||||||
DOMError("sizes of index and weight array don't match up",&element);
|
DOMError("sizes of index and weight array don't match up",&element);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!indices.size()) {
|
|
||||||
DOMWarning("encountered empty deformer",&element);
|
|
||||||
}
|
|
||||||
|
|
||||||
// read assigned node
|
// read assigned node
|
||||||
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"Deformer");
|
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"Deformer");
|
||||||
BOOST_FOREACH(const Connection* con, conns) {
|
BOOST_FOREACH(const Connection* con, conns) {
|
||||||
|
|
|
@ -739,13 +739,16 @@ public:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** get the list of deformer weights associated with this cluster */
|
/** get the list of deformer weights associated with this cluster.
|
||||||
|
* Use #GetIndices() to get the associated vertices. Both arrays
|
||||||
|
* have the same size (and may also be empty). */
|
||||||
const WeightArray& GetWeights() const {
|
const WeightArray& GetWeights() const {
|
||||||
return weights;
|
return weights;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** get indices into the vertex data of the geometry associated
|
/** get indices into the vertex data of the geometry associated
|
||||||
* with this cluster.*/
|
* with this cluster. Use #GetWeights() to get the associated weights.
|
||||||
|
* Both arrays have the same size (and may also be empty). */
|
||||||
const WeightIndexArray& GetIndices() const {
|
const WeightIndexArray& GetIndices() const {
|
||||||
return indices;
|
return indices;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue