1
$\begingroup$

Does Blender have a scene description language (SDL) that I can view and edit in real-time? Something like JSON or XML? Often, I can work faster with text than a GUI.

$\endgroup$
2
$\begingroup$

The bpy module and the API provided by Blender is pretty close to a scene description language.

Switch to Console Editor.

Now you can interactively make modifications to the scene.

The bpy module is already imported into the console.

>>> list(bpy.context.scene.objects)

[bpy.data.objects['Point.002'], bpy.data.objects['Point.001'], bpy.data.objects['Point'], bpy.data.objects['Cylinder.006'], bpy.data.objects['Cylinder.005'], bpy.data.objects['Cylinder.004'], bpy.data.objects['Cylinder.003'], bpy.data.objects['Cylinder.002'], bpy.data.objects['Cylinder.001'], bpy.data.objects['Cylinder'], bpy.data.objects['Suzanne'], bpy.data.objects['Plane']]

>>> bpy.context.scene.objects['Suzanne'].location.x = 1
>>> bpy.context.scene.objects['Suzanne'].location.x = 0

C is an alias for bpy.context, so you can also do

>>> C.object.location.x = 0

You can keyframe object properties (In the example below we are adding a keyframe on x location attribute)

The data related to the scene can be accessed from the context directly.

>>> C.scene.frame_current = 1

>>> C.object.keyframe_insert('location', index=0)

>>> C.scene.frame_current = 25
>>> C.object.location.x = 5
>>> C.object.keyframe_insert('location', index=0)

Links to some important blender python API modules

  1. https://docs.blender.org/api/current/info_quickstart.html
  2. https://docs.blender.org/api/current/bpy.context.html
| improve this answer | |
$\endgroup$
1
$\begingroup$

Blender has an extensive Python API that allows to access and modification of much of it's data, not sure if it fulfills your purpose.

It also has a DNA/RNA based data structure that describes the scene and all of the .blend file structure.

Also see https://stackoverflow.com/questions/11961557/what-is-an-rna-or-dna-property

| improve this answer | |
$\endgroup$
  • $\begingroup$ Are DNA and RNA abbrevations? I really miss the documantation about these concepts. $\endgroup$ – Prag Aug 19 '17 at 3:56

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.