forked from blender/blender
Export curves #46
@ -78,7 +78,7 @@ pxr::VtValue CurvesData::get_data(pxr::SdfPath const &id, pxr::TfToken const &ke
|
|||||||
ret = uvs_;
|
ret = uvs_;
|
||||||
}
|
}
|
||||||
else if (key == pxr::HdTokens->widths) {
|
else if (key == pxr::HdTokens->widths) {
|
||||||
ret = width_;
|
ret = widths_;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -120,7 +120,9 @@ pxr::HdPrimvarDescriptorVector CurvesData::primvar_descriptors(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (interpolation == pxr::HdInterpolationConstant) {
|
else if (interpolation == pxr::HdInterpolationConstant) {
|
||||||
primvars.emplace_back(pxr::HdTokens->widths, interpolation, pxr::HdPrimvarRoleTokens->none);
|
if (!widths_.empty()) {
|
||||||
|
primvars.emplace_back(pxr::HdTokens->widths, interpolation, pxr::HdPrimvarRoleTokens->none);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return primvars;
|
return primvars;
|
||||||
}
|
}
|
||||||
@ -133,23 +135,6 @@ pxr::SdfPath CurvesData::material_id() const
|
|||||||
return mat_data_->prim_id;
|
return mat_data_->prim_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CurvesData::double_sided(pxr::SdfPath const &id) const
|
|
||||||
{
|
|
||||||
if (mat_data_) {
|
|
||||||
return mat_data_->double_sided;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CurvesData::update_double_sided(MaterialData *mat_data)
|
|
||||||
{
|
|
||||||
if (mat_data_ == mat_data) {
|
|
||||||
ID_LOG(2, "");
|
|
||||||
scene_delegate_->GetRenderIndex().GetChangeTracker().MarkRprimDirty(
|
|
||||||
prim_id, pxr::HdChangeTracker::DirtyDoubleSided);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CurvesData::available_materials(std::set<pxr::SdfPath> &paths) const
|
void CurvesData::available_materials(std::set<pxr::SdfPath> &paths) const
|
||||||
{
|
{
|
||||||
if (mat_data_ && !mat_data_->prim_id.IsEmpty()) {
|
if (mat_data_ && !mat_data_->prim_id.IsEmpty()) {
|
||||||
@ -160,7 +145,7 @@ void CurvesData::available_materials(std::set<pxr::SdfPath> &paths) const
|
|||||||
void CurvesData::write_curves(Curves *curves)
|
void CurvesData::write_curves(Curves *curves)
|
||||||
{
|
{
|
||||||
curve_vertex_counts_.clear();
|
curve_vertex_counts_.clear();
|
||||||
width_.clear();
|
widths_.clear();
|
||||||
vertices_.clear();
|
vertices_.clear();
|
||||||
|
|
||||||
const float *radii = (const float *)CustomData_get_layer_named(
|
const float *radii = (const float *)CustomData_get_layer_named(
|
||||||
@ -172,13 +157,12 @@ void CurvesData::write_curves(Curves *curves)
|
|||||||
|
|
||||||
for (int i = 0; i < curves->geometry.curve_num; i++) {
|
for (int i = 0; i < curves->geometry.curve_num; i++) {
|
||||||
const int first_point_index = *(curves->geometry.curve_offsets + i);
|
const int first_point_index = *(curves->geometry.curve_offsets + i);
|
||||||
const int num_points = *(curves->geometry.curve_offsets + i + 1) -
|
const int num_points = *(curves->geometry.curve_offsets + i + 1) - first_point_index;
|
||||||
*(curves->geometry.curve_offsets + i);
|
|
||||||
curve_vertex_counts_.push_back(num_points);
|
curve_vertex_counts_.push_back(num_points);
|
||||||
|
|
||||||
/* Set radius similar to Cycles if isn't set */
|
/* Set radius similar to Cycles if isn't set */
|
||||||
float radius = radii ? radii[i] : 0.01f;
|
float radius = radii ? radii[i] : 0.01f;
|
||||||
width_.push_back(radius);
|
widths_.push_back(radius);
|
||||||
|
|
||||||
for (int j = 0; j < num_points; j++) {
|
for (int j = 0; j < num_points; j++) {
|
||||||
const int index = first_point_index + j;
|
const int index = first_point_index + j;
|
||||||
|
@ -29,12 +29,8 @@ class CurvesData : public ObjectData {
|
|||||||
pxr::HdBasisCurvesTopology curves_topology(pxr::SdfPath const &id) const;
|
pxr::HdBasisCurvesTopology curves_topology(pxr::SdfPath const &id) const;
|
||||||
pxr::HdPrimvarDescriptorVector primvar_descriptors(pxr::HdInterpolation interpolation) const;
|
pxr::HdPrimvarDescriptorVector primvar_descriptors(pxr::HdInterpolation interpolation) const;
|
||||||
pxr::SdfPath material_id() const;
|
pxr::SdfPath material_id() const;
|
||||||
bool double_sided(pxr::SdfPath const &id) const;
|
|
||||||
void update_double_sided(MaterialData *mat_data);
|
|
||||||
void available_materials(std::set<pxr::SdfPath> &paths) const;
|
void available_materials(std::set<pxr::SdfPath> &paths) const;
|
||||||
|
|
||||||
pxr::HdCullStyle cull_style = pxr::HdCullStyleBackUnlessDoubleSided;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void write_curves(Curves *curves);
|
void write_curves(Curves *curves);
|
||||||
void write_uv_maps(Curves *curves);
|
void write_uv_maps(Curves *curves);
|
||||||
|
Loading…
Reference in New Issue
Block a user