[Bf-python] Updating a panel

CoDEmanX codemanx at gmx.de
Mon Sep 17 00:40:22 CEST 2012


so if your timer works (print gets executed), you can tag_redraw() the 
region your panel is in, example for View3D Toolshelf:

def redraw_view3d_tools():
     for area in bpy.context.screen.areas:
         if area.type == 'VIEW_3D':
             for region in area.regions:
                 if region.type == 'TOOLS':
                     region.tag_redraw()

                     # mostly just one toolshelf, so we can stop here
                     return

you can also tag_redraw() the whole area, which will implicitly redraw 
all regions.


Am 16.09.2012 13:59, schrieb Matt Ebb:
> I don't know if there's a good way to do this. :(
>
> Being abale to send notifiers would be great, but i don't think it's
> possible. I have a situation like this where I want the UI to be
> refreshed after completing a file system scan in a separate thread.
> The dodgy method I use is to set a property that I know triggers a
> notifier to itself (eg. mat.diffuse_color = mat.diffuse_color). Seems
> to do the job...
>
> On Sun, Sep 16, 2012 at 8:58 PM, jerome <jerome.le.chat at free.fr> wrote:
>> Le 15/09/2012 21:55, Nicholas Bishop a écrit :
>>> I'm writing a script that displays a panel in the scene properties.
>>> The panel is populated with information obtained from a server via a
>>> socket. I'm using an operator and event_timer_add() to periodically
>>> poll the socket for updates. I can see with print() that this is
>>> working correctly, but I can't find how to signal my bpy panel to
>>> update itself -- I don't see an equivalent to WM_event_add_notifier()
>>> in bpy.
>>>
>>> I'm very new to Blender's Python API, any help is appreciated.
>>>
>>> Thanks,
>>> -Nicholas
>>> _______________________________________________
>>> Bf-python mailing list
>>> Bf-python at blender.org
>>> http://lists.blender.org/mailman/listinfo/bf-python
>>>
>> hi,
>> I would try to use a modal hooked to the 3d view, since panels are
>> updated by user inputs in the 3d view,
>> you could trigger something from here I guess.
>>
>> _______________________________________________
>> Bf-python mailing list
>> Bf-python at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-python
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python
>



More information about the Bf-python mailing list