Filtering UIList #47837

Closed
opened 2016-03-18 13:45:21 +01:00 by Aleksandr Zinovev · 8 comments

System Information
Kubuntu 15.10
Nvidia GeForce 9600 GT (driver: 340.96)

Blender Version
Broken: 2.77 Hash: 9777c5b
Worked: 2.77 rc2

Short description of error
filter_items function is broken (all items should be visible):
filter.png

import bpy

class MyItem(bpy.types.PropertyGroup):
    pass

class TEXT_UL_my_list(bpy.types.UIList):
    def filter_items(self, context, data, propname):
        return [self.bitflag_filter_item] * 3, []

class TEXT_PT_my_panel(bpy.types.Panel):
    bl_space_type = 'TEXT_EDITOR'
    bl_region_type = 'UI'
    bl_label = "My Panel"
    
    def draw(self, context):
        self.layout.template_list(
            "TEXT_UL_my_list", "",
            context.window_manager, "collection", 
            context.window_manager, "collection_index")

bpy.utils.register_module(__name__)

if not hasattr(bpy.types.WindowManager, "collection"):
    bpy.types.WindowManager.collection = \
        bpy.props.CollectionProperty(type=MyItem)
    bpy.types.WindowManager.collection_index = bpy.props.IntProperty()

    for i in range(0, 3):
        item = bpy.context.window_manager.collection.add()
        item.name="Item %d" % i

Exact steps for others to reproduce the error
Run the script in blender's text editor.

**System Information** Kubuntu 15.10 Nvidia GeForce 9600 GT (driver: 340.96) **Blender Version** Broken: 2.77 Hash: 9777c5b Worked: 2.77 rc2 **Short description of error** *filter_items* function is broken (all items should be visible): ![filter.png](https://archive.blender.org/developer/F296739/filter.png) ``` import bpy class MyItem(bpy.types.PropertyGroup): pass class TEXT_UL_my_list(bpy.types.UIList): def filter_items(self, context, data, propname): return [self.bitflag_filter_item] * 3, [] class TEXT_PT_my_panel(bpy.types.Panel): bl_space_type = 'TEXT_EDITOR' bl_region_type = 'UI' bl_label = "My Panel" def draw(self, context): self.layout.template_list( "TEXT_UL_my_list", "", context.window_manager, "collection", context.window_manager, "collection_index") bpy.utils.register_module(__name__) if not hasattr(bpy.types.WindowManager, "collection"): bpy.types.WindowManager.collection = \ bpy.props.CollectionProperty(type=MyItem) bpy.types.WindowManager.collection_index = bpy.props.IntProperty() for i in range(0, 3): item = bpy.context.window_manager.collection.add() item.name="Item %d" % i ``` **Exact steps for others to reproduce the error** Run the script in blender's text editor.
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Author
Member

Added subscriber: @AleksandrZinovev-2

Added subscriber: @AleksandrZinovev-2

Added subscriber: @NikoLeopold

Added subscriber: @NikoLeopold

Can confirm this. Still broken on Arch Linux, currently Blender 2.77 6aeb1f7f.
If you leave the flt_flags return value empty, i.e. remove [self.bitflag_filter_item] * 3, or use a different factor, then it works. But yep since the flag value is the same its likely an issue with its interpretation.

Can confirm this. Still broken on Arch Linux, currently Blender 2.77 6aeb1f7f. If you leave the flt_flags return value empty, i.e. remove `[self.bitflag_filter_item] * 3`, or use a different factor, then it works. But yep since the flag value is the same its likely an issue with its interpretation.

This issue was referenced by blender/blender@7f03e7cc3c

This issue was referenced by blender/blender@7f03e7cc3cbcebd43226d05e7039ba014a56c50a

Added subscriber: @mont29

Added subscriber: @mont29

Grmllll… no choice but to use 1 << 30 value here instead. Hope this will not break any existing code :/

Grmllll… no choice but to use `1 << 30` value here instead. Hope this will not break any existing code :/

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Bastien Montagne self-assigned this 2016-03-19 17:10:34 +01:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#47837
No description provided.