ParaView Synchronize attribute values to the GUI

Hello, I set the model transparency with the following code:

pqPipelineSource* source = reinterpret_cast<pqPipelineSource*>(it->second);
pqDataRepresentation* representation = source->getRepresentation(pqActiveObjects::instance().activeView());
if (nullptr == representation)
{
	return;
}
vtkPVCompositeRepresentation* composite_representation = dynamic_cast<vtkPVCompositeRepresentation*>(representation->getProxy()->GetClientSideObject());
if (nullptr == composite_representation)
{
	return;
}
vtkGeometryRepresentation* active_representation = dynamic_cast<vtkGeometryRepresentation*>(composite_representation->GetActiveRepresentation());
if (nullptr != active_representation)
{
	active_representation->SetOpacity(0.3);
}

Problem: The model transparency has changed. How do I automatically synchronize the value of the slider on the GUI?

Best regards.

Do not use GetClientSideObject.

Set the Opacity property on the representation proxy.

Is there a relevant example for this reference?
thank you very much!

vtkSMPropertyHelper(representation->getProxy(), "Opacity").Set(0.3);

Thank you very much for your help, thank you!
Ask another question, if I don’t use GetClientSideObject, is there any other way to get vtkGeometryRepresentation via pqPipelineSource? Or can I get vtkActor directly from pqPipelineSource?
Thank you!

You are not supposed to recover the vtkObject client-side, except on very specific case.

What are you trying to achieve ?

For example, I added the following code to vtkPVInteractorStyle:
vtkPropPicker* picker = vtkPropPicker::New();
vtkActor* pickActor = picker->GetActor();
I need to judge which pqPipelineSource is picked up based on the vtkActor.

If you do not plan to support remote rendering in your application. You can do it this way.

If you plan to, you will need to do it like it is done in ParaView
Take a look into vtkSMRenderViewProxy::PickBlock