36 using Alembic::Abc::OObject;
37 using Alembic::AbcGeom::FloatArraySample;
38 using Alembic::AbcGeom::OBoolProperty;
39 using Alembic::AbcGeom::OCompoundProperty;
40 using Alembic::AbcGeom::ONuPatch;
41 using Alembic::AbcGeom::ONuPatchSchema;
52 const char *abc_parent_path = abc_parent.getFullName().c_str();
54 for (
size_t i = 0; i < num_nurbs; i++) {
55 std::stringstream patch_name_stream;
58 while (abc_parent.getChildHeader(patch_name_stream.str())) {
59 patch_name_stream <<
"_";
62 std::string patch_name = patch_name_stream.str();
63 CLOG_INFO(&
LOG, 2,
"exporting %s/%s", abc_parent_path, patch_name.c_str());
66 abc_nurbs_.push_back(nurbs);
67 abc_nurbs_schemas_.push_back(nurbs.getSchema());
73 if (abc_nurbs_.empty()) {
83 if (abc_nurbs_.empty()) {
84 return Alembic::Abc::OCompoundProperty();
96 return (cu->
key !=
nullptr);
104 static void get_knots(std::vector<float> &knots,
const int num_knots,
float *nu_knots)
106 if (num_knots <= 1) {
112 knots.reserve(num_knots + 2);
114 knots.push_back(0.0f);
116 for (
int i = 0; i < num_knots; i++) {
117 knots.push_back(nu_knots[i]);
120 knots[0] = 2.0f * knots[1] - knots[2];
121 knots.push_back(2.0f * knots[num_knots] - knots[num_knots - 1]);
129 if (
context.object->runtime.curve_cache->deformed_nurbs.first !=
nullptr) {
130 nulb = &
context.object->runtime.curve_cache->deformed_nurbs;
138 std::vector<float> knotsU;
141 std::vector<float> knotsV;
144 const int size = nu->pntsu * nu->pntsv;
145 std::vector<Imath::V3f> positions(
size);
146 std::vector<float> weights(
size);
148 const BPoint *bp = nu->bp;
150 for (
int i = 0; i <
size; i++, bp++) {
152 weights[i] = bp->
vec[3];
155 ONuPatchSchema::Sample
sample;
156 sample.setUOrder(nu->orderu + 1);
157 sample.setVOrder(nu->orderv + 1);
158 sample.setPositions(positions);
159 sample.setPositionWeights(weights);
160 sample.setUKnot(FloatArraySample(knotsU));
161 sample.setVKnot(FloatArraySample(knotsV));
167 OCompoundProperty user_props = abc_nurbs_schemas_[
count].getUserProperties();
170 OBoolProperty prop(user_props,
"endpoint_u");
175 OBoolProperty prop(user_props,
"endpoint_v");
180 OBoolProperty prop(user_props,
"cyclic_u");
185 OBoolProperty prop(user_props,
"cyclic_v");
ListBase * BKE_curve_nurbs_get(struct Curve *cu)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define CLOG_INFO(clg_ref, level,...)
Object is a sort of wrapper for general info.
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Alembic::Abc::OCompoundProperty abc_schema_prop_for_custom_props(T abc_schema)
uint32_t timesample_index_
const ABCWriterConstructorArgs args_
virtual bool check_is_animated(const HierarchyContext &context) const override
virtual bool is_supported(const HierarchyContext *context) const override
virtual void create_alembic_objects(const HierarchyContext *context) override
ABCNurbsWriter(const ABCWriterConstructorArgs &args)
virtual void do_write(HierarchyContext &context) override
virtual Alembic::Abc::OObject get_alembic_object() const override
Alembic::Abc::OCompoundProperty abc_prop_for_custom_props() override
static void sample(SocketReader *reader, int x, int y, float color[4])
static void get_knots(std::vector< float > &knots, const int num_knots, float *nu_knots)
BLI_INLINE void copy_yup_from_zup(float yup[3], const float zup[3])
struct SELECTID_Context context
Alembic::Abc::OObject abc_parent