Setting default properties of filters doesn't work with XML

Hello,

I have noticed that when a filter’s output is vtkMultiBlocDataSet, the chosen representation is “Outline”. In this representation I can’t see the data generated by my filter, so I have to change it manually to “Surface” each time I add my filter to the pipeline.

In the XML file of the filter, I added this hint to set the default representation of my filter to Surface

Representation type=“Surface”

But it didn’t work…

In other cases, I also have a problem with “Coloring” defaulting to “Solid Color” or “vtkBlockColors” and not the array I added to the vtkPointData of an vtkImageData belonging to vtkMultiBlockDataSet; So, I also have to fix that manually.

I feel that XML “hints” are futile (e.g. ShowComponentLabels hint doesn’t work to show the labels of a table representing DoubleVectorProperty).

What can I change in the code to fix that fastly ?

That’s not entirely correct. For example try loading the can.ex2 dataset from ParaView examples dataset. It renders as surface, by default.

I suspect you’re being hit by the Outline Threshold. There’s a separate setting that controls if the data is too big and better rendered as outline by default.

image

Try adjusting this from the Settings (or Preferences on macOS) dialog.

Hello,

I tried playing with the outline threshold but the representation is still “Outlline”.

The solution I found is to modify this method of the source file “vtkSMRepresentationTypeDomain.cxx” :

int vtkSMRepresentationTypeDomain::SetDefaultValues(
vtkSMProperty* property, bool use_unchecked_values)

// for vtkImageData show slice (for 2D datasets) or outline (for all others).
if (info->DataSetTypeIsA(“vtkImageData”))
{
const int* ext = info->GetExtent();

if (ext[0] == ext[1] || ext[2] == ext[3] || ext[4] == ext[5])
{
  if ((info->GetCompositeDataSetType() == -1) && this->IsInDomain("Slice", temp))
  {
    helper.Set("Slice");
    return 1;
  }
  // The fix that will permit vtkMultiBlocDataSet representation to default to "Surface"
  else if (this->IsInDomain("Surface", temp))
  {
    helper.Set("Surface");
    return 1;
  }
}
else if (this->IsInDomain("Outline", temp))
{
  helper.Set("Outline");
  return 1;
}

Otherwise, I carry 2-D vtkImageData in the vtkMultiBlocDataSet (not heavy data).

Curiously, the code I added fixed my color issue too !

So there’s only one problem I want to fix now :

ShowComponentLabels hint doesn’t work to show the labels of a table representing DoubleVectorProperty).

Is that feature works only for a specific plugin ? Which source file can I debug to fix that issue ? I know that in “void pqDoubleVectorPropertyWidget::propertyDomainModified(vtkObject* domainObject)” we test if “ShowComponentLabels” hint is available in the “vtkPVXMLElement” named “hints” but then I don’t understand why it’s not being used for my filter (it has number_of_elements_per_command=2).

If you don’t mind, can you create a separate topic for a new issue please? It’s better for archival purposes, easy for someone else follow the thread to follow the conversation, also easier on the responders. thanks in advance.

OK, you are right !