61 #include "TypeBSplineCurve.hh"
64 #include <OpenFlipper/common/BackupData.hh>
66 #include "BSplineCurveBackup.hh"
70 TypeBSplineCurvePlugin::
71 TypeBSplineCurvePlugin():
72 renderControlPolygonAction_(0),
73 renderCurveAction_(0),
74 renderCPSelectionAction_(0),
75 renderKnotSelectionAction_(0),
76 renderNoSelectionAction_(0)
89 if ( OpenFlipper::Options::gui() ){
91 QMenu* contextMenu =
new QMenu(
"Rendering");
93 QString iconPath = OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator();
109 QActionGroup* group =
new QActionGroup(
this);
110 group->setExclusive(
true);
120 renderKnotSelectionAction_ =
new QAction(tr(
"Render Knot Selection"), group);
121 renderKnotSelectionAction_->setStatusTip(tr(
"Render Knot Selection"));
123 renderKnotSelectionAction_->setCheckable(
true);
124 renderKnotSelectionAction_->setChecked(
true);
127 renderNoSelectionAction_ =
new QAction(tr(
"Don't Render Selection"), group);
128 renderNoSelectionAction_->setStatusTip(tr(
"Don't Render Selection"));
130 renderNoSelectionAction_->setCheckable(
true);
131 renderNoSelectionAction_->setChecked(
true);
141 contextMenu->addSeparator();
143 contextMenu->addAction(renderKnotSelectionAction_);
144 contextMenu->addAction(renderNoSelectionAction_);
155 if ( _objectId == -1)
164 if(bsplineCurveObject != 0){
178 int objectId = contextObject.toInt();
189 if(bsplineCurveObject != 0){
200 int objectId = contextObject.toInt();
211 if(bsplineCurveObject != 0){
221 QVariant contextObject = _action->data();
222 int objectId = contextObject.toInt();
233 if(bsplineCurveObject != 0){
237 }
else if(_action == renderKnotSelectionAction_) {
240 }
else if(_action == renderNoSelectionAction_) {
250 TypeBSplineCurvePlugin::
254 setTypeIcon(
"BSplineCurve",
"BSplineCurveType.png");
279 object->target(
true);
284 object->target(
true);
288 object->target(
true);
291 QString
name =
"BSplineCurve_" + QString::number( object->
id() ) +
".bsc";
295 object->setName( f.fileName() );
298 const QColor color = OpenFlipper::Options::defaultColor();
299 const ACG::Vec4f default_color(color.redF(), color.greenF(), color.blueF(), color.alphaF());
300 object->materialNode()->set_color(default_color);
308 emit emptyObjectAdded (object->
id() );
315 void TypeBSplineCurvePlugin::generateBackup(
int _id, QString _name,
UpdateType _type ){
322 if ( splineObj != 0 ){
328 backupData = dynamic_cast< BackupData* >(object->
objectData(OBJECT_BACKUPS));
332 object->setObjectData(OBJECT_BACKUPS, backupData);
343 #if QT_VERSION < 0x050000
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.
QString name()
Return a name for the plugin.
DLLEXPORT void setTypeIcon(DataType _id, QString _icon)
Set an Icon for a given DataType.
QAction * renderCurveAction_
Context menu action.
PerObjectData * objectData(QString _dataName)
Returns the object data pointer.
int targetCount()
Get the number of target objects.
void storeBackup(BaseBackup *_backup)
store a backup
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
bool getObject(int _identifier, BSplineCurveObject *&_object)
virtual void updatedObject(int _objectId)
An object has been changed or added by this plugin.
#define DATA_BSPLINE_CURVE
DLLEXPORT DataType addDataType(QString _name, QString _readableName)
Adds a datatype and returns the id for the new type.
QAction * renderControlPolygonAction_
Context menu action.
void pluginsInitialized()
Second initialization phase.
QString getObjectinfo()
Get all Info for the Object as a string.
bool hasObjectData(QString _dataName)
Checks if object data with given name is available.
void slotRenderControlPolygon()
Slot triggered from context menu, if the control polygon should be rendered.
int addEmpty()
Create an empty object.
void slotRenderSelection(QAction *_action)
Slot triggered from context menu, if the selection rendering should be altered.
The Menu will be shown when an object was picked.
ACG::SceneGraph::BSplineCurveNodeT< BSplineCurve > * splineCurveNode()
Get the scenegraph Node.
DataType supportedType()
Return your supported object type( e.g. DATA_TRIANGLE_MESH )
int objectCount()
Get the number of available objects.
QAction * renderCPSelectionAction_
Context menu action (render selection texture)
BSplineCurveObject * bsplineCurveObject(BaseObjectData *_object)
Cast an BaseObject to a BSplineCurveObject if possible.
void slotRenderCurve()
Slot triggered from context menu, if the curve should be rendered.
void slotUpdateContextMenu(int _objectId)
Class that encapsulates a backup.
Abstract class that is used to store backups.