diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2020-02-28 16:18:50 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2020-02-28 16:30:49 +0300 |
commit | bcac081ad5ced938d1056e0f9f08f220a9bc7e25 (patch) | |
tree | cc1555fc2f39c5cbe4a85e789398e3946df79307 | |
parent | 95d0e04ed1d8ac8c77aa62dc51f3d63bc09c786e (diff) |
OpenSubdiv: Allow less topology callbacks assigned
Useful for cases when topology does not need to have any
crease or UV layers. Now instead of assigning callbacks
which returns zero data is possible to simply assign the
callback itself to NULL.
-rw-r--r-- | intern/opensubdiv/internal/opensubdiv_converter_factory.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/intern/opensubdiv/internal/opensubdiv_converter_factory.cc b/intern/opensubdiv/internal/opensubdiv_converter_factory.cc index 0c1514f2fea..a42adf72c49 100644 --- a/intern/opensubdiv/internal/opensubdiv_converter_factory.cc +++ b/intern/opensubdiv/internal/opensubdiv_converter_factory.cc @@ -140,6 +140,12 @@ inline bool TopologyRefinerFactory<TopologyRefinerData>::assignComponentTags( using OpenSubdiv::Sdc::Crease; const OpenSubdiv_Converter *converter = cb_data.converter; const bool full_topology_specified = converter->specifiesFullTopology(converter); + if (!full_topology_specified && converter->getNumEdges == NULL) { + assert(converter->getEdgeSharpness == NULL); + assert(converter->getVertexSharpness == NULL); + assert(converter->isInfiniteSharpVertex == NULL); + return true; + } const int num_edges = converter->getNumEdges(converter); for (int edge_index = 0; edge_index < num_edges; ++edge_index) { const float sharpness = converter->getEdgeSharpness(converter, edge_index); @@ -190,6 +196,13 @@ inline bool TopologyRefinerFactory<TopologyRefinerData>::assignFaceVaryingTopolo TopologyRefiner &refiner, const TopologyRefinerData &cb_data) { const OpenSubdiv_Converter *converter = cb_data.converter; + if (converter->getNumUVLayers == NULL) { + assert(converter->precalcUVLayer == NULL); + assert(converter->getNumUVCoordinates == NULL); + assert(converter->getFaceCornerUVIndex == NULL); + assert(converter->finishUVLayer == NULL); + return true; + } const int num_layers = converter->getNumUVLayers(converter); if (num_layers <= 0) { // No UV maps, we can skip any face-varying data. |