Object selector


How can I do in Python an object selector/chooser/pickerlike this one?

I already have a working Panel. I understand the last step is to call row.prop (scene,“objectname”)in my panel.
Probably I have to create something similar to an StringProperty in my register method, but what?


I kind of got it with

row.prop_search(scene, "objectname", bpy.data, "objects", text="")

And also I had to define objectname as an String.

BUT the result I get is different to the one in the picture and it has 2 big downsides: I can not filter by types of objects and there is no graphical picker (or whatever is that thing called)

Any ideas to get the one from the picture?

If you have the addon that that pic is from you can you “right click > view source” to see how they did it.

The object picker is hard-coded, and the property stores actual datablock IDs. You can’t achieve that with Python.