43 #include "TypeBSplineSurface.hh" 52 TypeBSplineSurfacePlugin::
53 TypeBSplineSurfacePlugin() :
54 renderControlNetAction_(0),
55 renderSurfaceAction_(0),
56 renderCPSelectionAction_(0),
57 renderKnotSelectionAction_(0),
58 renderNoSelectionAction_(0)
70 if ( OpenFlipper::Options::gui() ){
72 QMenu* contextMenu =
new QMenu(
"Rendering");
74 QString iconPath = OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator();
77 renderControlNetAction_ =
new QAction(tr(
"Render Control Net"),
this);
78 renderControlNetAction_->setStatusTip(tr(
"Render Control Net"));
80 renderControlNetAction_->setCheckable(
true);
81 renderControlNetAction_->setChecked(
false);
84 renderSurfaceAction_ =
new QAction(tr(
"Render Surface"),
this);
85 renderSurfaceAction_->setStatusTip(tr(
"Render Surface"));
87 renderSurfaceAction_->setCheckable(
true);
88 renderSurfaceAction_->setChecked(
true);
90 QActionGroup* group =
new QActionGroup(
this);
91 group->setExclusive(
true);
101 renderKnotSelectionAction_ =
new QAction(tr(
"Render Knot Selection"), group);
102 renderKnotSelectionAction_->setStatusTip(tr(
"Render Knot Selection"));
104 renderKnotSelectionAction_->setCheckable(
true);
105 renderKnotSelectionAction_->setChecked(
true);
108 renderNoSelectionAction_ =
new QAction(tr(
"Don't Render Selection"), group);
109 renderNoSelectionAction_->setStatusTip(tr(
"Don't Render Selection"));
111 renderNoSelectionAction_->setCheckable(
true);
112 renderNoSelectionAction_->setChecked(
true);
115 connect(renderControlNetAction_, SIGNAL(triggered()),
this, SLOT(slotRenderControlNet()) );
116 connect(renderSurfaceAction_, SIGNAL(triggered()),
this, SLOT(slotRenderSurface()) );
120 contextMenu->addAction(renderControlNetAction_);
121 contextMenu->addAction(renderSurfaceAction_);
122 contextMenu->addSeparator();
124 contextMenu->addAction(renderKnotSelectionAction_);
125 contextMenu->addAction(renderNoSelectionAction_);
136 if ( _objectId == -1)
145 if(bsplineSurfaceObject != 0){
146 renderControlNetAction_->setChecked( bsplineSurfaceObject->
splineSurfaceNode()->render_control_net() );
147 renderSurfaceAction_->setChecked( bsplineSurfaceObject->
splineSurfaceNode()->render_bspline_surface() );
158 QVariant contextObject = renderControlNetAction_->data();
159 int objectId = contextObject.toInt();
170 if(bsplineSurfaceObject != 0){
171 bsplineSurfaceObject->
splineSurfaceNode()->render_control_net(renderControlNetAction_->isChecked());
180 QVariant contextObject = renderSurfaceAction_->data();
181 int objectId = contextObject.toInt();
192 if(bsplineSurfaceObject != 0){
193 bsplineSurfaceObject->
splineSurfaceNode()->render_bspline_surface(renderSurfaceAction_->isChecked());
202 QVariant contextObject = _action->data();
203 int objectId = contextObject.toInt();
214 if(bsplineSurfaceObject != 0){
218 }
else if(_action == renderKnotSelectionAction_) {
221 }
else if(_action == renderNoSelectionAction_) {
232 TypeBSplineSurfacePlugin::
235 addDataType(
"BSplineSurface",tr(
"B-Spline Surface"));
236 setTypeIcon(
"BSplineSurface",
"BSplineSurfaceType.png");
260 object->target(
true);
265 object->target(
true);
269 object->target(
true);
272 QString
name =
"BSplineSurface_" + QString::number( object->
id() ) +
".bss";
276 object->setName( f.fileName() );
279 const QColor color = OpenFlipper::Options::defaultColor();
280 const ACG::Vec4f default_color(color.redF(), color.greenF(), color.blueF(), color.alphaF());
281 object->materialNode()->set_color(default_color);
289 emit emptyObjectAdded (object->
id() );
void pluginsInitialized()
Second initialization phase.
void slotRenderControlNet()
Slot triggered from context menu, if the control net should be rendered.
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
int objectCount()
Get the number of available objects.
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
QString name()
Return a name for the plugin.
void slotUpdateContextMenu(int _objectId)
QAction * renderCPSelectionAction_
Context menu action (render selection texture)
ACG::SceneGraph::BSplineSurfaceNodeT< BSplineSurface > * splineSurfaceNode()
Return pointer to the bspline surface node.
DLLEXPORT DataType addDataType(QString _name, QString _readableName)
Adds a datatype and returns the id for the new type.
int addEmpty()
Create an empty object.
#define DATA_BSPLINE_SURFACE
DataType supportedType()
Return your supported object type( e.g. DATA_TRIANGLE_MESH )
void slotRenderSelection(QAction *_action)
Slot triggered from context menu, if the selection rendering should be altered.
DLLEXPORT void setTypeIcon(DataType _id, QString _icon)
Set an Icon for a given DataType.
int targetCount()
Get the number of target objects.
QString getObjectinfo()
Get all Info for the Object as a string.
void slotRenderSurface()
Slot triggered from context menu, if the surface should be rendered.
void slotRenderSelection(QAction *_action)
Slot triggered from context menu, if the selection rendering should be altered.
virtual void updatedObject(int _objectId)
An object has been changed or added by this plugin.
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.