Films Training Blog
Pipeline and Tools Characters
Pipeline and Tools Characters
search Login Join
favorite

Development Fund

Support Blender Core Development with a monthly contribution.

theaters

Blender Studio

The creators who share. Access production content and knowledge from the Open Movies.

code

Blender Developer Blog

Latest news and updates on Blender development.

people

Get Involved

Join the community and help with design, development, docs and more.

bar_chart

Open Data

A platform to collect and display the Blender Benchmark results.

menu_book

Blender Docs

Documentation on Blender's features, tools and API.

Blender Conference

The yearly event that brings together the Blender community in one place.

download

Get Blender

Download the latest Blender version, or try the beta!

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

16th August 2017

info License: CC-BY
flag Report Problem

Published by

Sybren A. Stüvel

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

3 Comments

Join to comment publicly.

gagan.zedinteractive

15th April 2019 - 11:14

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

21st October 2020 - 12:00

*@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

25th April 2022 - 09:11

@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.

Blender Studio

The Creators Who Share.

Facebook Logo Twitter Logo YouTube Logo
  • Films
  • Blog
  • Training
Pipeline and Tools
  • Cloud Rig
  • Blender Kitsu
  • Contact Sheet Add-on
  • Blender Purge
  • Blender Cloud Services
Characters
  • Einar
  • Security Bot
  • Huginn
  • Pack Bot
Studio
  • Terms & Conditions
  • Privacy Policy
  • Contact
  • Remixing Music
  • Blender.org
Loading...