Vraag: A JQuery like API for Blender

When using the Blender API, searching for particular data structures is a very common task. So I thought I’d try to build a selector syntax like the one JQuery uses and emulate part of the JQuery API.

I asked google to translate “query” to Dutch, and it gave me “Vraag”.

This is my script so far:


The main goal is to cut down on typing. Both in drivers, the console and in scripts, it is useful to have an expressive query syntax which understands a bit about blender’s data types and hierarchical notions.

For example

>>> V(“object”)

Selects all objects in the file.

>>> V("#Cube")

Selects any data object called Cube (not only objects!)

>>> V(“object#Cube”)

Selects an object called Cube, much like bpy.data.objects[“Cube”].

>>> V("#Scene1 camera")

Returns the Camera struct in scene Scene1.

You can also use the context to query data objects:

>>> V("@scene object")

Returns all objects in the scene.

Some “Vraag Functions” have been implemented for the VraagList returned by the calls above.

For example:

>>> V("#Suzanne").hide()
>>> V("#Suzanne").show()

Hides and Shows data objects named Suzanne.

>>> V(“object”).prop(“hide_render”)

Returns a list of values from the hide_render property of all objects.

Vraag is still a work in progress, and before I release it I would like to gather some input and opinions on the API and what you would like to see supported. Not all data types have been implemented yet, and also not all “hierarchical relationships”.

And of course, this library makes it easy to shoot yourself in the foot, just as the original JQuery :wink:

So please let me know if you would find this library useful and what you would like to see in it!