[Bf-python] Bf-python Digest, Vol 105, Issue 3

Cook, Rich cook47 at llnl.gov
Fri Nov 8 18:58:01 CET 2013


Thank you so much both for the helpful tips and hints!
I'm not a blender expert, in fact I'm a novice.  I'm just trying to ramp up to see if blender is a good fit for my visualization toolchain, and if it is reliably scriptable then I believe it will become a powerful tool indeed.
Thanks
-- Rich


From: Bassam Kurdali <bassam at urchn.org<mailto:bassam at urchn.org>>
Date: November 7, 2013 10:46:09 AM PST
To: Blender Foundation Python list <bf-python at blender.org<mailto:bf-python at blender.org>>
Reply-To: <bassam at urchn.org<mailto:bassam at urchn.org>>, Blender Foundation Python list <bf-python at blender.org<mailto:bf-python at blender.org>>


Some helpful hints that I found useful when learning the api, first few
are from context menu on buttons:
1- right click on a button -> copy data path; gives you the path of the
property based from the datablock it is on, in the copy/paste buffer.
2- right click on a button -> edit source! crib code from blender's UI
itself. (opens in a text editor, you have to browse it to find the file)
3- autocompletion in the py console in blender FTW; lets you explore
almost anything.
4- help - > py api reference; while everything is not perfectly
documented, it is mostly the case, and searchable.
5- outliner-> Datablocks: allows you to brows the data structure in
blender almost exactly as it is in the api.
6- knowing blender helps as you are already familiar with the concepts,
the py api mostly exposes the same stuff you are used to dealing with.

Finally context is a bit of a tricky thing, it passes the same types of
data you get from bpy.data, but this is telling you 'what is my current
state' rather than everything in the file; it is used by operators,
panels, and maybe your own functions. Most easily understood in terms of
tools i.e. : User makes a selection in a viewport(changes context),
Operator runs(for instance, deletes the selection) using that
context,User gets desired result(those vertices are deleted)

From Python they are cumbersome, I tend to avoid them if I can, or use
them sparingly.
Hope that helped!

On Thu, 2013-11-07 at 19:31 +0100, Brecht Van Lommel wrote:
For the specific question you are asking, this is probably the page to read:
http://www.blender.org/documentation/blender_python_api_2_69_1/info_quickstart.html

bpy.context.scene is the active scene, while bpy.data.scenes['Scene']
is the scene named 'Scene'. They can be the same, it depends which
scene the user has selected.

On Thu, Nov 7, 2013 at 6:53 PM, Cook, Rich <cook47 at llnl.gov> wrote:
Thanks, that's helpful.
I have been having an issue with the documentation.  It's very hard to
explore.  There doesn't appear to be an API reference that actually
enumerates and describes all the various functions.
--
✐Richard Cook
✇ Lawrence Livermore National Laboratory
Bldg-453 Rm-4024, Mail Stop L-557
7000 East Avenue,  Livermore, CA, 94550, USA
☎ (office) (925) 423-9605
☎ (fax) (925) 423-6961
---
Information Management & Graphics Grp., Services & Development Div., Integrated Computing & Communications Dept.
(opinions expressed herein are mine and not those of LLNL)



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20131108/3673913e/attachment.html>


More information about the Bf-python mailing list