0
$\begingroup$

I want to have a prop_search box that searches over two different bpy_prop_collection's.

My thinking on this is that I need to create a combined bpy_prop_collection using a parent class (say bpy.types.ID) and add all the values from the two lists to it.

But this doesn't seem possible for a few reasons, but mostly because it doesn't seem that you are allowed to change a bpy_prop_collection (or any prop type?) during a draw() call (where the prop_search is called).

So, is it possible to have a prop_search work with multiple collections some how?

Eg:

class SomeClass():
   myProp: bpy.props.PointerProperty(type=bpy.types.ID, name="my", description="prop")

   def draw(self, layout):
      self.collection = bpy.props.CollectionProperty(type=bpy.types.ID, name="foo", description="bah")
      for name, val in context.blend_data.objects.items():
         self.collection[name] = val
      for name, val in context.blend_data.collections.items():
         self.collection[name] = val
      layout.prop_search(self, "myProp", self, "collection")

$\endgroup$
  • $\begingroup$ Even if it doesn't work can you add code to clarify what you are trying to achieve. A prop search sets one prop by searching another. eg blender.stackexchange.com/questions/110572/… $\endgroup$ – batFINGER Mar 20 at 8:48
  • $\begingroup$ @batFINGER right and I want my prop_search to be able to search the concatenation of two collection properties. $\endgroup$ – hekete Mar 20 at 10:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.