[Paraview-developers] Bind a points table from a properties panel directly with a 3D widget, not with its representation
Maxim Torgonskiy
kriolog at gmail.com
Mon Apr 3 21:28:57 EDT 2017
Hello,
I'm trying to create a paraview plugin for vtkSeedsWidget. The problem
occurs when I try to bind handle positions from a QTreeWidget of the
pqSeedsPropertyWidget directly with the vtkSeedsWidget (I should do
that because unlike vtkPolyLine{Widget,Representation}
creation/removal can be governed only through the Widget part):
pqSeedsPropertyWidget::pqSeedsPropertyWidget(
vtkSMProxy* smproxy,
vtkSMPropertyGroup* smgroup,
QWidget* parent
) :
...
if (vtkSMProperty* handlePositions =
smgroup->GetProperty("HandlePositions")) {
Internals->PointsAdaptor = new
pqSignalAdaptorTreeWidget(Internals->Ui.handlesTable, true);
addPropertyLink(Internals->PointsAdaptor, "values",
SIGNAL(valuesChanged()), handlePositions);
}
...
}
where HandlePositions corresponds to the vtkSeedsWidget:
<ProxyGroup name="3d_widgets">
<Proxy base_proxygroup="3d_widgets"
base_proxyname="WidgetBase"
class="vtkSeedsWidget"
name="SeedsWidget">
<DoubleVectorProperty command="SetHandlePosition"
default_values="0 0 1 0 0 0"
information_property="HandlePositionsInfo"
name="HandlePositions"
number_of_elements="6"
number_of_elements_per_command="3"
repeat_command="1"
set_number_command="SetNumberOfHandles"
use_index="1">
</DoubleVectorProperty>
<DoubleVectorProperty command="GetHandlePositions"
information_only="1"
name="HandlePositionsInfo">
<DoubleArrayInformationHelper />
</DoubleVectorProperty>
</Proxy>
</ProxyGroup>
In the vtkSeedsWidget class I've added these corresponding functions:
void vtkSeedsWidget::SetNumberOfHandles(int n)
{...}
void vtkSeedsWidget::SetHandlePosition(int i, double x, double y, double z)
{...}
vtkDoubleArray* vtkSeedsWidget::GetHandlePositions()
{...}
The forward connection from the table to the 3D widget works as
expected, but the backward one doesn't (function GetHandlePositions is
called once during construction but never after the InvokeEvent is
called in the vtkSeedsWidget). I understand that I shouldn't expect to
have this behavior "out of box" but I didn't find how to modify the
code to make it work (or I need at least understand that it's not
possible :) ). Could you please help me with this little problem?
Thanks,
Maxim
More information about the Paraview-developers
mailing list