Blender Studio
  • Films
  • Training
  • Characters
  • Pipeline
  • Blog
  • Sign in
  • Join
  • BLENDER.ORG

    • Download

      Get the latest Blender, older versions, or experimental builds.

    • What's New

      Stay up-to-date with the new features in the latest Blender releases.

    LEARNING & RESOURCES

    • Blender Studio

      Access production assets and knowledge from the open movies.

    • Manual

      Documentation on the usage and features in Blender.

    DEVELOPMENT

    • Developers Blog

      Latest development updates, by Blender developers.

    • Documentation

      Guidelines, release notes and development docs.

    • Benchmark

      A platform to collect and share results of the Blender Benchmark.

    • Blender Conference

      The yearly event that brings the community together.

    DONATE

    • Development Fund

      Support core development with a monthly contribution.

    • One-time Donations

      Perform a single donation with more payment options available.

Films
Training
Blog
Pipeline and Tools
Characters
Search
Login
Join

Course

Scripting for Artists
feed Course Overview
feed Blender Versions
Videos keyboard_arrow_down
  1. 01

    Introduction & copy-pasting

    Free
  2. 02

    Names & Objects

  3. 03

    Stuff on Lists

  4. 04

    Data Types

  5. 05

    Collections: Mass-Rename of Objects

  6. 06

    Blender Collections

    Free
  7. 07

    For vs. While

    Free
  8. 08

    Your Own Operator

    Free
  9. 09

    From Script to Add-on

    Free
  10. 10

    User Interfaces

    Free
  11. 11

    Custom Properties

    Free
  12. 12

    Asset Linking

    Free
  13. 13

    Roast my Add-on

    Free
  14. 14

    The Roast of Nature Clicker

    Free
  15. 15

    Modal Operators

    Free
  16. 16

    Readability & Understandability

Tech keyboard_arrow_down
  1. 01

    Updating F-Curves

  2. 02

    Render 10,000 OBJ files

  3. 03

    Mass-Rename Bones & Vertex Groups

  4. 04

    Rendering from 'all' angles

Course

Scripting for Artists
feed Blender Versions
Videos keyboard_arrow_down
  1. 01

    Introduction & copy-pasting

    Free
  2. 02

    Names & Objects

  3. 03

    Stuff on Lists

  4. 04

    Data Types

  5. 05

    Collections: Mass-Rename of Objects

  6. 06

    Blender Collections

    Free
  7. 07

    For vs. While

    Free
  8. 08

    Your Own Operator

    Free
  9. 09

    From Script to Add-on

    Free
  10. 10

    User Interfaces

    Free
  11. 11

    Custom Properties

    Free
  12. 12

    Asset Linking

    Free
  13. 13

    Roast my Add-on

    Free
  14. 14

    The Roast of Nature Clicker

    Free
  15. 15

    Modal Operators

    Free
  16. 16

    Readability & Understandability

Tech keyboard_arrow_down
  1. 01

    Updating F-Curves

  2. 02

    Render 10,000 OBJ files

  3. 03

    Mass-Rename Bones & Vertex Groups

  4. 04

    Rendering from 'all' angles

You need to login to view this content

You can join Blender Studio for €11.50/month and get access to all of our training & film content instantly!

Login Join Blender Studio

Tech

Render 10,000 OBJ files

Aug. 16th, 2017

info License: CC-BY
Report Problem
Sybren A. Stüvel
Sybren A. Stüvel Publisher

This is the second video in a series of “tech videos” in which Sybren discusses concrete problems seen on Stack Exchange. This video is all about loading 10,000 individual OBJ files and rendering them to 10,000 images.

  • Use of pathlib.Path to access the filesystem
  • Loading, rendering, and subsequently removing from memory, individual OBJ files
  • Breaking out of loops with the break statement.

Links from the video

  • The question on Stack Exchange
  • Python's pathlib module
  • The break statement

The Slides

Slides are only visible to Blender Cloud susbcribers

Join to comment publicly.

3 comments

gagan.zedinteractive
gagan.zedinteractive April 15th, 2019

Hi Sybren

First of all thank you very much for making these wonderful tutorials These tutorials are very helpful.

I need some help from you to achieve some functionality.

I have tried loading fbx files and rendered them through this scripting.

Apart from this i want to achieve the following working -

  1. I want to open blender files located at a given path.
  2. Change textures of some objects in that blender file
  3. Set angle of the camera
  4. Render the scene and save the render at a given location.

This will go in a loop for many blender scenes same like you did for .obj files but instead i want to do the same for blender whole scene file with proper lighting.

From above points I have checked the 1 and 4 point and i hope i will be able to achieve the 2 and 3 point also. But my problem is when i open a blender file using following script -

obj_root = pathlib.Path("I:/PythonBlender/first.blend") bpy.ops.wm.open_mainfile(filepath= str(obj_root))

the old file running the python scripts is closed and this new first.blend file is opened in blender. I want my python scripts to keep running and the scenes should load as an addon. and remove the addon scenes after rendering is finished.

Please help me achieve this functionality. Thankyou so much

Jarosław Dzedzej
Jarosław Dzedzej Oct. 21st, 2020

*@gagan.zedinteractive* not sure if it will work, but I think you should try appending the scene to the current blend file instead of opening a new .blend (as you are in fact running a separate instance of blender) , this I guess should leve the script running and allow you to interact with the additional scene in your original .blend (not sure how to do it in python though)

Show more replies
Sybren A. Stüvel
Sybren A. Stüvel April 25th, 2022

@gagan.zedinteractive You can start another Blender instance from Blender itself. That's the easiest way to get this kind of processing done. Run blender --help to see all the possible options. Probably the form you'd want to use is blender.exe thefile.blend -P thescript.py, where thescript.py takes care of everything that needs to happen with that particular file.

  • Films
  • Training
  • Blog
Pipeline and Tools
  • Cloud Rig
  • Blender Kitsu
  • Contact Sheet Add-on
  • Blender Purge
  • Blender Cloud Services
Characters
  • Cat
  • Dog
  • Chicken & Sets
  • Einar
Studio
  • Terms & Conditions
  • Privacy Policy
  • Contact
  • Remixing Music
  • blender.org

Blender Studio

The creators who share.

Facebook Logo Twitter Logo YouTube Logo
Loading...