50 #include "BSplineCurveSelectionPlugin.hh" 57 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
66 curve->select_controlpoint(i);
74 emit scriptInfo(
"selectAllControlPoints(ObjectId)");
82 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
89 curve->deselect_controlpoint(i);
93 emit scriptInfo(
"deselectAllControlPoints(ObjectId)");
101 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
110 if(curve->controlpoint_selected(i))
111 curve->deselect_controlpoint(i);
113 curve->select_controlpoint(i);
121 emit scriptInfo(
"invertControlPointSelection(ObjectId)");
129 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
139 bool breakWhile =
false;
141 bool oneFound =
false;
144 if(curve->controlpoint_selected(i)) {
158 emit scriptInfo(
"deleteSelectedControlPoints(ObjectId)");
163 if( _ids.empty())
return;
168 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
174 for(IdList::const_iterator it = _ids.begin(); it != _ids.end(); ++it) {
176 if(_deselect) curve->deselect_controlpoint(*it);
177 else curve->select_controlpoint(*it);
182 QString selection =
"selectControlPoints(ObjectId, [ " + QString::number(_ids[0]);
184 for (uint i = 1 ; i < _ids.size(); ++i) {
185 selection +=
", " + QString::number(_ids[i]);
191 emit scriptInfo(selection);
201 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
208 if(curve->controlpoint_selected(i))
209 list.push_back((
int)i);
223 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
231 for(
unsigned int i = 0; i < curve->
n_knots(); ++i) {
240 emit scriptInfo(
"selectAllKnots(ObjectId)");
248 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
255 for(
unsigned int i = 0; i < curve->
n_knots(); ++i) {
260 emit scriptInfo(
"deselectAllKnots(ObjectId)");
268 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
276 for(
unsigned int i = 0; i < curve->
n_knots(); ++i) {
288 emit scriptInfo(
"invertKnotSelection(ObjectId)");
296 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
306 bool breakWhile =
false;
308 bool oneFound =
false;
310 for(; i < curve->
n_knots(); ++i) {
318 if((i >= curve->
n_knots()) && !oneFound) {
325 emit scriptInfo(
"deleteSelectedKnots(ObjectId)");
330 if(_ids.empty())
return;
335 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
341 for(IdList::const_iterator it = _ids.begin(); it != _ids.end(); ++it) {
342 if(*it < (
int)curve->
n_knots()) {
349 QString selection =
"selectKnots(ObjectId, [ " + QString::number(_ids[0]);
351 for (uint i = 1 ; i < _ids.size(); ++i) {
352 selection +=
", " + QString::number(_ids[i]);
358 emit scriptInfo(selection);
368 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
374 for(
unsigned int i = 0; i < curve->
n_knots(); ++i) {
376 list.push_back((
int)i);
IdList getKnotSelection(int _objectId)
Get current knot selection.
void delete_control_point(int _idx)
delete control point at given index
bool getObject(int _identifier, BSplineCurveObject *&_object)
void selectKnots(int _objectId, const IdList &_ids, bool _deselect=false)
Select specific knots of a curve.
void selectAllKnots(int _objectId)
Select all knots of a curve.
BSplineCurve * splineCurve(BaseObjectData *_object)
Get a Bspline curve from an object.
unsigned int n_control_points() const
Returns the number of control points.
unsigned int n_knots() const
Returns the number of knots.
void deleteSelectedKnots(int _objectId)
Delete selected knots.
IdList getControlPointSelection(int _objectId)
Get current control point selection.
BSplineCurveObject * bsplineCurveObject(BaseObjectData *_object)
Cast an BaseObject to a BSplineCurveObject if possible.
ACG::SceneGraph::BSplineCurveNodeT< BSplineCurve > * splineCurveNode()
Get the scenegraph Node.
void deselectAllKnots(int _objectId)
Deselect all knots of a curve.
void selectAllControlPoints(int _objectId)
Select all control points of a curve.
std::vector< int > IdList
Standard Type for id Lists used for scripting.
void selectControlPoints(int _objectId, const IdList &_ids, bool _deselect=false)
Select specific control points of a curve.
Knotvector * get_knotvector_ref()
get a reference to the knotvector
void deleteSelectedControlPoints(int _objectId)
Delete selected control points.
void deselectAllControlPoints(int _objectId)
Deselect all control points of a curve.
void invertControlPointSelection(int _objectId)
Invert control point selection.
void invertKnotSelection(int _objectId)
Invert knot selection.