[Paraview] Object Inspector Tabs

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Mon Aug 8 17:29:45 EDT 2011


Brian,

There are a few things to remember about ParaView:
* the source/filter and it's representation proxy are created
separately. The representation is generally not created until after
the first accept.
* a source can have multiple representation proxies (one for each
view). As view are split/closed/visibility changed, these
representation can get created/deleted dynamically. pqPipelineSource
fires signals (representationAdded / representationRemoved) when that
happens.
* there is at most one active view at one time. Sicne there's one
representation proxy per source per view, you'll see that the display
tab is refreshed as one changes the active view.

Now based on this, you need to decide how your panel is going to behave:
* Does it affect all representations in all views, or does it behave
like the display-tab and affect only the active view.
* When the source if first created, it's not going to have any
representations, how do you want the panel to behave in that case. One
possibility is that the checkbox-value is saved and then when
represenation is added, you change the property based on the value of
the checkbox.

If you don't mind elaborating on the use-case that you're trying to
solve, I can hack the plugin you sent me to behave accordingly.

Utkarsh





On Mon, Aug 8, 2011 at 1:20 PM, Utkarsh Ayachit
<utkarsh.ayachit at kitware.com> wrote:
> Can you package your code a plugin that you can share and I can try it
> out? It will be easier to figure out the problems when I look at the
> code.
>
> Utkarsh
>
> On Mon, Aug 8, 2011 at 12:57 PM, Panneton, Brian C USA CTR (US)
> <brian.c.panneton.ctr at mail.mil> wrote:
>> I'm still somewhat unsure on how to do this since I now have two ProxyGroups (sources and representations) within one Custom Panel. When I do, vtkSMIntVectorProperty* prop = dynamic_cast<vtkSMIntVectorProperty*>(this->proxy()->GetProperty("GlyphLegend"));, prop is null. When I do this for widgets that are within the ProxyGroup 'source' they work and can be updated as you would expect.
>>
>> My guess is because I should be using a different proxy. I tried to do this by using this->proxy()->GetProxyManager()->GetProxy("representations", "MyRepresentation") however this just segfaults.
>>
>> Any ideas?
>> ________________________________________
>> From: Utkarsh Ayachit [utkarsh.ayachit at kitware.com]
>> Sent: Friday, August 05, 2011 4:15 PM
>> To: Panneton, Brian C USA CTR (US)
>> Subject: Re: [Paraview] Object Inspector Tabs
>>
>> Is yours a custom panel? In that case you have to manually update the
>> property using the value from the widget (use can use
>> this->propertyManager() to help you with linking widgets to
>> properties).
>>
>> On Fri, Aug 5, 2011 at 12:03 PM, Panneton, Brian C USA CTR (US)
>> <brian.c.panneton.ctr at mail.mil> wrote:
>>> Ah, I had the functions in protected. Once I moved them to public it worked.
>>>
>>> However, it only called the Set on initial load. It does not call it after I modify it and press the accept button. In my panel I have created a QObject::connect for the widget and the signal stateChanged(int). I catch the signal and do this->SetModified(), allowing me to hit accept. Once I hit accept, the SetSomeBoolVar(int) never gets called.
>>>
>>> Do I have to manually update the Property throught the proxy? I had thought it would be taken care of for me.
>>>
>>> Thanks,
>>> Brian
>>>
>>> ________________________________________
>>> From: Utkarsh Ayachit [utkarsh.ayachit at kitware.com]
>>> Sent: Friday, August 05, 2011 11:07 AM
>>> To: Panneton, Brian C USA CTR (US)
>>> Cc: ParaView
>>> Subject: Re: [Paraview] Object Inspector Tabs
>>>
>>> The fact that "SetSomeBoolVar" is not in the *CLientServer.cxx file is
>>> the problem. It has nothing to do with the XML, but for some reason
>>> the parser that generates the CLientServer.cxx file decided that the
>>> method is not "wrappable". If you can attach the header file, I may be
>>> able to tell what the issue may be.
>>>
>>> Utkarsh
>>>
>>> On Fri, Aug 5, 2011 at 10:50 AM, Panneton, Brian C USA CTR (US)
>>> <brian.c.panneton.ctr at mail.mil> wrote:
>>>> The file was created, however it does not contain "SetSomeBoolVar". Does it matter that I have two ProxyGroups in my ServerManagerConfiguration: sources and representations?
>>>> ________________________________________
>>>> From: Utkarsh Ayachit [utkarsh.ayachit at kitware.com]
>>>> Sent: Friday, August 05, 2011 10:19 AM
>>>> To: Panneton, Brian C USA CTR (US)
>>>> Cc: ParaView
>>>> Subject: Re: [Paraview] Object Inspector Tabs
>>>>
>>>> Try to locate vtkMyRepresentationClientServer.cxx file in the binary
>>>> directory. Was that generated? Open and see if it include a condition
>>>> for "SetSomeBoolVar" in it.
>>>>
>>>> Utkarsh
>>>>
>>>> On Fri, Aug 5, 2011 at 10:07 AM, Panneton, Brian C USA CTR (US)
>>>> <brian.c.panneton.ctr at mail.mil> wrote:
>>>>> Yes, this is what I have for ADD_PARAVIEW_PLUGIN
>>>>>
>>>>> [code]
>>>>> ADD_PARAVIEW_PLUGIN(MyPlugin "1.0"
>>>>>    SERVER_MANAGER_XML plugin/MyPlugin.xml
>>>>>    SERVER_MANAGER_SOURCES
>>>>>        vtkReader/vtkMyReader.cxx
>>>>>        representations/vtkMyRepresentation.cxx
>>>>>    GUI_RESOURCE_FILES plugin/MyPluginGUI.xml
>>>>>    GUI_INTERFACES ${IFACES}
>>>>>    SOURCES panel/MyReaderPanel.cxx
>>>>>            ${MOC_SRCS} ${IFACE_SRCS}
>>>>>            ${RCS_SOURCES} ${UI_BUILT_SOURCES}
>>>>> )
>>>>> [/code]
>>>>>
>>>>> For my ProxyGroup representations XML I have this:
>>>>>
>>>>> [code]
>>>>> <ProxyGroup name="representations">
>>>>>        <RepresentationProxy name="MyRepresentation"
>>>>>            class="vtkMyRepresentation"
>>>>>            processes="client|renderserver|dataserver"
>>>>>            base_proxygroup="representations"
>>>>>            base_proxyname="SurfaceRepresentation">
>>>>>
>>>>>               <IntVectorProperty
>>>>>                  name="GlyphLegend"
>>>>>                  command="SetSomeBoolVar"
>>>>>                  number_of_elements="1"
>>>>>                  default_values="1">
>>>>>                 <BooleanDomain name="bool"/>
>>>>>              </IntVectorProperty>
>>>>>        </RepresentationProxy>
>>>>>
>>>>>        <Extension name="GeometryRepresentation">
>>>>>            <RepresentationType subproxy="MyRepresentation"
>>>>>                text="My Mapper" subtype="Surface" />
>>>>>
>>>>>            <SubProxy>
>>>>>                <Proxy name="MyRepresentation"
>>>>>                    proxygroup="representations"
>>>>>                    proxyname="MyRepresentation">
>>>>>                </Proxy>
>>>>>                <ShareProperties subproxy="SurfaceRepresentation">
>>>>>                    <Exception name="Input" />
>>>>>                    <Exception name="Visibility" />
>>>>>                    <Exception name="Representation" />
>>>>>                </ShareProperties>
>>>>>            </SubProxy>
>>>>>        </Extension>
>>>>>    </ProxyGroup>
>>>>> [/code]
>>>>>
>>>>>
>>>>> Then in vtkMyRepresentation I have a setter and getter for SetSomeBoolVar(int) and GetSomeBoolVar().
>>>>>
>>>>> I also have a ProxyGroup for sources but I didn't think that would conflict.
>>>>>
>>>>> Thanks,
>>>>> Brian
>>>>>
>>>>>
>>>>> ________________________________________
>>>>> From: Utkarsh Ayachit [utkarsh.ayachit at kitware.com]
>>>>> Sent: Friday, August 05, 2011 9:54 AM
>>>>> To: Panneton, Brian C USA CTR (US)
>>>>> Cc: ParaView
>>>>> Subject: Re: [Paraview] Object Inspector Tabs
>>>>>
>>>>> What's your CMakeLists. txt file? Was vtkMyRepresentation specified as
>>>>> SERVER_MANAGER_SOURCES in the ADD_PARAVIEW_PLUGIN call?
>>>>>
>>>>> Utkarsh
>>>>>
>>>>>
>>>>> On Thu, Aug 4, 2011 at 5:00 PM, Panneton, Brian C USA CTR (US)
>>>>> <brian.c.panneton.ctr at mail.mil> wrote:
>>>>>> Okay, so instead of adding tabs like Properties, Display and Information, I created a Qt TabWidget which possibly does what I want but I am not sure.
>>>>>>
>>>>>> Right now, on my custom panel, I have options that modify the input to my reader. I am looking to also add options to modify part of my custom representation. Am I able to do this from my current custom panel? How would the XML look?
>>>>>>
>>>>>> I tried setting up my SMC as such without luck:
>>>>>> [code]
>>>>>> <ServerManagerConfiguration>
>>>>>>  <ProxyGroup name="representations">
>>>>>>   <RepresentationProxy name ... class="vtkMyRepresentation" ..>
>>>>>>    ... < { properties defined here such as intvectorproperty} > ...
>>>>>>    </RepresentationProxy>
>>>>>>  </ProxyGroup>
>>>>>>  <ProxyGroup name="sources">
>>>>>>    <SourceProxy name ... class="vtkMyReader" ..>
>>>>>>    ... < { properties defined here } > ...
>>>>>>    </SourceProxy>
>>>>>>  </ProxyGroup>
>>>>>> </ServerManagerConfiguration>
>>>>>> [/code]
>>>>>>
>>>>>> But this will end up giving me the error even though I have a vtkMyRepresentation::SetMyProperty(int) in the source:
>>>>>> [code]
>>>>>> vtkPVSessionCore (0x16e71130): Object type: vtkMyRepresentation, could not find requested method: "SetMyProperty"
>>>>>> or the method was called with incorrect arguments.
>>>>>>
>>>>>> while processing
>>>>>> Message 0 = Invoke
>>>>>>  Argument 0 = vtk_object_pointer {vtkMyRepresentation (0x1829dfb0)}
>>>>>>  Argument 1 = string_value {SetMyProperty}
>>>>>>  Argument 2 = int32_value {1}
>>>>>> [/code]
>>>>>>
>>>>>> Any ideas?
>>>>>>
>>>>>> Thanks,
>>>>>> Brian
>>>>>> ________________________________________
>>>>>> From: Utkarsh Ayachit [utkarsh.ayachit at kitware.com]
>>>>>> Sent: Thursday, August 04, 2011 12:09 PM
>>>>>> To: Brian C. Panneton (CONTR)
>>>>>> Cc: paraview at paraview.org
>>>>>> Subject: Re: [Paraview] Object Inspector Tabs
>>>>>>
>>>>>> Nope, this is not possible through plugins yet. You can add a
>>>>>> brand-new dock widget through plugins but not add a new tab to the
>>>>>> Object Inspector widget.
>>>>>>
>>>>>> Utkarsh
>>>>>>
>>>>>> On Thu, Aug 4, 2011 at 11:56 AM, Brian C. Panneton (CONTR)
>>>>>> <brian.c.panneton.ctr at us.army.mil> wrote:
>>>>>>> I was wondering if there was an example of how to add a new tab to the
>>>>>>> Object Inspector for a plugin. I remember being told that it is possible,
>>>>>>> but I can't seem to find any examples.
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Brian Panneton
>>>>>>> _______________________________________________
>>>>>>> Powered by www.kitware.com
>>>>>>>
>>>>>>> Visit other Kitware open-source projects at
>>>>>>> http://www.kitware.com/opensource/opensource.html
>>>>>>>
>>>>>>> Please keep messages on-topic and check the ParaView Wiki at:
>>>>>>> http://paraview.org/Wiki/ParaView
>>>>>>>
>>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>>> http://www.paraview.org/mailman/listinfo/paraview
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>


More information about the ParaView mailing list