44 #include "BSplineCurveSelectionPlugin.hh" 51 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
60 curve->select_controlpoint(i);
68 emit scriptInfo(
"selectAllControlPoints(ObjectId)");
76 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
83 curve->deselect_controlpoint(i);
87 emit scriptInfo(
"deselectAllControlPoints(ObjectId)");
95 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
104 if(curve->controlpoint_selected(i))
105 curve->deselect_controlpoint(i);
107 curve->select_controlpoint(i);
115 emit scriptInfo(
"invertControlPointSelection(ObjectId)");
123 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
133 bool breakWhile =
false;
135 bool oneFound =
false;
138 if(curve->controlpoint_selected(i)) {
152 emit scriptInfo(
"deleteSelectedControlPoints(ObjectId)");
157 if( _ids.empty())
return;
162 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
168 for(IdList::const_iterator it = _ids.begin(); it != _ids.end(); ++it) {
170 if(_deselect) curve->deselect_controlpoint(*it);
171 else curve->select_controlpoint(*it);
176 QString selection =
"selectControlPoints(ObjectId, [ " + QString::number(_ids[0]);
178 for (uint i = 1 ; i < _ids.size(); ++i) {
179 selection +=
", " + QString::number(_ids[i]);
185 emit scriptInfo(selection);
195 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
202 if(curve->controlpoint_selected(i))
203 list.push_back((
int)i);
217 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
225 for(
unsigned int i = 0; i < curve->
n_knots(); ++i) {
234 emit scriptInfo(
"selectAllKnots(ObjectId)");
242 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
249 for(
unsigned int i = 0; i < curve->
n_knots(); ++i) {
254 emit scriptInfo(
"deselectAllKnots(ObjectId)");
262 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
270 for(
unsigned int i = 0; i < curve->
n_knots(); ++i) {
282 emit scriptInfo(
"invertKnotSelection(ObjectId)");
290 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
300 bool breakWhile =
false;
302 bool oneFound =
false;
304 for(; i < curve->
n_knots(); ++i) {
312 if((i >= curve->
n_knots()) && !oneFound) {
319 emit scriptInfo(
"deleteSelectedKnots(ObjectId)");
324 if(_ids.empty())
return;
329 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
335 for(IdList::const_iterator it = _ids.begin(); it != _ids.end(); ++it) {
336 if(*it < (
int)curve->
n_knots()) {
343 QString selection =
"selectKnots(ObjectId, [ " + QString::number(_ids[0]);
345 for (uint i = 1 ; i < _ids.size(); ++i) {
346 selection +=
", " + QString::number(_ids[i]);
352 emit scriptInfo(selection);
362 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
368 for(
unsigned int i = 0; i < curve->
n_knots(); ++i) {
370 list.push_back((
int)i);
BSplineCurve * splineCurve(BaseObjectData *_object)
Get a Bspline curve from an object.
unsigned int n_knots() const
Returns the number of knots.
BSplineCurveObject * bsplineCurveObject(BaseObjectData *_object)
Cast an BaseObject to a BSplineCurveObject if possible.
IdList getControlPointSelection(int _objectId)
Get current control point selection.
void invertKnotSelection(int _objectId)
Invert knot selection.
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
void delete_control_point(int _idx)
delete control point at given index
void selectAllKnots(int _objectId)
Select all knots of a curve.
void selectAllControlPoints(int _objectId)
Select all control points of a curve.
void deselectAllKnots(int _objectId)
Deselect all knots of a curve.
std::vector< int > IdList
Standard Type for id Lists used for scripting.
void deleteSelectedControlPoints(int _objectId)
Delete selected control points.
void invertControlPointSelection(int _objectId)
Invert control point selection.
void selectControlPoints(int _objectId, const IdList &_ids, bool _deselect=false)
Select specific control points of a curve.
unsigned int n_control_points() const
Returns the number of control points.
void deselectAllControlPoints(int _objectId)
Deselect all control points of a curve.
Knotvector * get_knotvector_ref()
get a reference to the knotvector
ACG::SceneGraph::BSplineCurveNodeT< BSplineCurve > * splineCurveNode()
Get the scenegraph Node.
void deleteSelectedKnots(int _objectId)
Delete selected knots.
void selectKnots(int _objectId, const IdList &_ids, bool _deselect=false)
Select specific knots of a curve.
IdList getKnotSelection(int _objectId)
Get current knot selection.