29 #define _unused(x) ((void)(x)) 31 #include "SUAPI-CppWrapper/model/LoopInput.hpp" 36 #include "SUAPI-CppWrapper/Initialize.hpp" 37 #include "SUAPI-CppWrapper/model/Edge.hpp" 38 #include "SUAPI-CppWrapper/model/Curve.hpp" 39 #include "SUAPI-CppWrapper/model/GeometryInput.hpp" 40 #include "SUAPI-CppWrapper/model/Material.hpp" 41 #include "SUAPI-CppWrapper/model/Layer.hpp" 45 SULoopInputRef LoopInput::create_loop_input_ref() {
46 SULoopInputRef loop_input = SU_INVALID;
47 SULoopInputCreate(&loop_input);
55 m_loop_input(create_loop_input_ref())
60 m_loop_input(loop_input),
91 for (
size_t i=0; i < loop_edge_properties.size(); ++i) {
93 if (SU_API_VERSION_MAJOR >= 5) {
94 set_edge_hidden(i, loop_edge_properties[i].hidden);
95 set_edge_soft(i, loop_edge_properties[i].soft);
96 set_edge_smooth(i, loop_edge_properties[i].smooth);
97 Material edge_material = loop_edge_properties[i].material;
98 if (!!edge_material) {
99 set_edge_material(i, edge_material);
101 Layer edge_layer = loop_edge_properties[i].layer;
103 set_edge_layer(i, edge_layer);
112 m_loop_input(create_loop_input_ref())
118 LoopInput::~LoopInput() {
119 if (!m_attached && SUIsValid(m_loop_input)) {
120 SUResult res = SULoopInputRelease(&m_loop_input);
121 assert(res == SU_ERROR_NONE); _unused(res);
142 SULoopInputRef LoopInput::ref()
const {
146 LoopInput::operator SULoopInputRef()
const {
150 LoopInput::operator SULoopInputRef*() {
151 return &m_loop_input;
154 LoopInput::operator bool()
const {
155 if (SUIsInvalid(m_loop_input)) {
158 if (m_edge_num > 2) {
168 throw std::logic_error(
"CW::LoopInput::add_vertex_index(): LoopInput is null");
170 SUResult res = SULoopInputAddVertexIndex(m_loop_input, index);
171 assert(res == SU_ERROR_NONE); _unused(res);
177 LoopInput& LoopInput::set_edge_hidden(
const size_t edge_index,
const bool hidden) {
179 throw std::logic_error(
"CW::LoopInput::set_edge_hidden(): LoopInput is null");
181 SUResult res = SULoopInputEdgeSetHidden(m_loop_input, edge_index, hidden);
182 if(res == SU_ERROR_OUT_OF_RANGE) {
183 throw std::invalid_argument(
"CW::LoopInput::set_edge_hidden(): edge_index is larger than the number of vertices in the LoopInput");
185 assert(res == SU_ERROR_NONE); _unused(res);
189 LoopInput& LoopInput::set_edge_soft(
const size_t edge_index,
const bool soft) {
191 throw std::logic_error(
"CW::LoopInput::set_edge_soft(): LoopInput is null");
193 SUResult res = SULoopInputEdgeSetSoft(m_loop_input, edge_index, soft);
194 if(res == SU_ERROR_OUT_OF_RANGE) {
195 throw std::invalid_argument(
"CW::LoopInput::set_edge_soft(): edge_index is larger than the number of vertices in the LoopInput");
197 assert(res == SU_ERROR_NONE); _unused(res);
201 LoopInput& LoopInput::set_edge_smooth(
const size_t edge_index,
const bool smooth) {
203 throw std::logic_error(
"CW::LoopInput::set_edge_smooth(): LoopInput is null");
205 SUResult res = SULoopInputEdgeSetSoft(m_loop_input, edge_index, smooth);
206 if(res == SU_ERROR_OUT_OF_RANGE) {
207 throw std::invalid_argument(
"CW::LoopInput::set_edge_smooth(): edge_index is larger than the number of vertices in the LoopInput");
209 assert(res == SU_ERROR_NONE); _unused(res);
213 LoopInput& LoopInput::set_edge_material(
const size_t edge_index,
const Material& material) {
215 throw std::logic_error(
"CW::LoopInput::set_edge_material(): LoopInput is null");
217 SUResult res = SULoopInputEdgeSetMaterial(m_loop_input, edge_index, material.ref());
218 if(res == SU_ERROR_OUT_OF_RANGE) {
219 throw std::invalid_argument(
"CW::LoopInput::set_edge_material(): edge_index is larger than the number of vertices in the LoopInput");
221 assert(res == SU_ERROR_NONE); _unused(res);
224 LoopInput& LoopInput::set_edge_layer(
const size_t edge_index,
const Layer& layer) {
226 throw std::logic_error(
"CW::LoopInput::set_edge_layer(): LoopInput is null");
228 SUResult res = SULoopInputEdgeSetLayer(m_loop_input, edge_index, layer.
ref());
229 if(res == SU_ERROR_OUT_OF_RANGE) {
230 throw std::invalid_argument(
"CW::LoopInput::set_edge_layer(): edge_index is larger than the number of vertices in the LoopInput");
232 assert(res == SU_ERROR_NONE); _unused(res);