[Bf-python] blender python script error

Cook, Rich cook47 at llnl.gov
Thu Nov 7 19:19:54 CET 2013


Aha, one thing I notice is that the tool tips take you to the documentation for the python equivalent.  That's pretty dang cool.

On Nov 7, 2013, at 9:53 AM, "Cook, Rich" <cook47 at llnl.gov<mailto: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.  For example, http://www.blender.org/documentation/blender_python_api_2_69_1/info_api_reference.html seems like a good introduction, but I am having trouble understanding the relationship and definition of the various concepts, such as contexts, objects, etc.

For example, what is the difference between bpy.context.scene and bpy.data.scenes['Scene'] ?
Are they pointing to the same object?  I don't even know where to look for the answer!  Do I need to just practice and keep asking for specifics until it all dawns on me, or is there a really good book or reference to all this?

My goal in the end is to do this, all in python:

Set up camera, lights, and a camera path.  Import a mesh to view, and animate the scene, swapping out meshes at regular intervals to let the mesh evolve while zooming in, adjusting lights and properties, etc., to capture the best appearance.

Thanks!

On Nov 7, 2013, at 9:01 AM, Bassam Kurdali <bassam at urchn.org<mailto:bassam at urchn.org>> wrote:

Try

bpy.context.scene.frame_set()

Operators rely on context so it can get hard to satisfy them (you could also try making a timeline window visible). You can override context by paying an optional dict to the operator but I've found this tricky to get right in practice.
Oh, and welcome to this blender thing,
Bassam

"Cook, Rich" <cook47 at llnl.gov<mailto:cook47 at llnl.gov>> wrote:

Hi, I'm new to this here blender thingie.  I was trying some code out to import a few meshes from a science run, and am getting an error I cannot get past.  I was going to import the timesteps as separate meshes, then set keyframes on visibility for each mesh at different timesteps in order to "animate" them.  Per http://blenderscripting.blogspot.de/2011/07/scripted-keyframing-of-hide-hide-render.html

I am getting the following error:

>>> bpy.ops.anim.change_frame(frame = 5)
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
  File "/Volumes/MacProHD/cook47-stuff/Programs/graphics/Blender/blender.app/Contents/MacOS/2.68/scripts/modules/bpy/ops.py", line 188, in __call__
    ret = op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.anim.change_frame.poll() Expected an timeline/animation area to be active

I do have a timeline visible in the GUI.  I'm not sure what blender is trying to tell me.

I'm probably going to change approaches and just load one mesh at a time, set up the scene, render, and move to the next, etc.  However, my technical curiosity has the best of me here.  I'd like to understand why I cannot set a timestep here.

Thanks!

<span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Monaco; font-size: 13px; font

--
✐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)




--
✐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/20131107/477dfa23/attachment.html>


More information about the Bf-python mailing list