stig-atle / io_scene_pbrt

Exporter for blender that exports the scene into pbrt's ascii file format.
59 stars 16 forks source link

How to export? #12

Closed szellmann closed 5 years ago

szellmann commented 5 years ago

Trying to test your exporter. Probably the error is sitting in front of the screen, but whenever I hit "Export scene" blender opens the render dialog. Render engine is PBRT_Renderer and I have entered an output folder path. I'm on macOS 10.13, Blender 2.8 beta. When hovering over "Export scene" Blender actually shows a tooltip saying "Render active scene.":

Screen Shot 2019-05-30 at 21 10 59
szellmann commented 5 years ago

Alright, I'm a Blender noop. But at least now I got a console output and a stacktrace:

Starting calling pbrt_export
Output path:
/Username/obj/
Exporting meshes to:   
/Username/obj/ply
Exporting textures to: 
/Username/obj/textures
Ply directory did not exist, creating: 
Fetching camera..
regular scene cam
render res:  1920  x  1080
Exporting camera:  Camera
Traceback (most recent call last):
  File "/Username/Library/Application Support/Blender/2.80/scripts/addons/io_scene_pbrt-master/render_exporter.py", line 28, in render
    export_pbrt(bpy.data.scenes[0].exportpath, scene)
  File "/Username/Library/Application Support/Blender/2.80/scripts/addons/io_scene_pbrt-master/render_exporter.py", line 922, in export_pbrt
    export_camera(pbrt_file)
  File "/Username/Library/Application Support/Blender/2.80/scripts/addons/io_scene_pbrt-master/render_exporter.py", line 146, in export_camera
    aperture=bpy.data.scenes['Scene'].camera.data.cycles.aperture_size
AttributeError: 'CyclesCameraSettings' object has no attribute 'aperture_size'

location: <unknown location>:-1

location: <unknown location>:-1

I will probably have to set the camera parameters somehow.

Edit: it seems like 2.8's CyclesCameraSettings does not have member aperture_size.

stig-atle commented 5 years ago

Does the sample scene export? If you are not exporting the sample scene - do you have a camera in the scene you are trying to export?

The 'aperture_size' setting is used for DOF. I have pushed a fix that disables the dof for now. I need to move the DOF settings anyways, `since now the cycles camera settings disappears when you switch to PBRT renderer. So install the latest and give that a try and report back.

szellmann commented 5 years ago

Hi, thanks for your answer!

Outch, I never even tested with the sample scene, that one exports just fine indeed! The scene I tried to export before doesn't have an explicitly set camera, just some simple geometry (my use-case would just be to export some simple geometry + light sources). But I think just in order to try your plugin I can start from the sample scene and adapt that one.

It anyway seems to me that the CyclesCameraSettings class has changed from 2.79 to 2.80 and there is just no member aperture_size anymore: https://docs.blender.org/api/blender2.8/bpy.types.CyclesCameraSettings.html

So install the latest and give that a try and report back.

Will do later and report back in case of errors!

Btw. when manually setting the output directory (as opposed to choosing it with the dialog), when you don't append a / then the exporter will create new directories ply and textures whose names start with the name of the base directory, so e.g. if output dir is /Username/pbrt then the plugin will create /Username/pbrtply and /Username/pbrttextures instead of /Username/pbrt/ply.

stig-atle commented 5 years ago

It needs a camera to export properly. I have not yet fixed so that you can export without a camera in the scene.

I'll write a new 'bug ticket' for the path issue you mention.

stig-atle commented 5 years ago

I added a error message when no camera exists in the scene. This makes it clear to the user that a camera is needed.