folkertdev / freestyle-svg-exporter

a Blender addon for exporting stylized lines created by the Freestyle render engine to an SVG format.
54 stars 18 forks source link

Blender 2.8 compatibility #13

Open JanWerder opened 5 years ago

JanWerder commented 5 years ago

With the release of blender 2.8 this plugin seems to break. The script itself should be ported to work with the new blender release.

I started a fork over at https://github.com/JanWerder/freestyle-svg-exporter

The current problem seems to be that the RenderSettings object no longer offers the layers attribute freestyle = scene.render.layers.active.freestyle_settings AttributeError: 'RenderSettings' object has no attribute 'layers' (https://github.com/folkertdev/freestyle-svg-exporter/blob/master/render_freestyle_svg.py#L243)

gut4 commented 5 years ago

Hi. I tried your fork but still have this error.

EtagiBI commented 5 years ago

@folkertdev, aren't you planning to update your addon for 2.8 compatibility?

xuv commented 5 years ago

@EtagiBI Maybe Folkert is busy atm. If we can get him a tested PR that works. He will probably happily merge it.

folkertdev commented 5 years ago

Yes, a PR or some more information would be much appreciated. I've not been following the blender development news as closely lately. @JanWerder did you find a fix for the layer issue?

EtagiBI commented 5 years ago

I suppose that icompatibility comes from API syntax changes. There're no render layers in 2.8. Instead, they presented view layers: https://wiki.blender.org/wiki/Reference/Release_Notes/2.80/Python_API/Scene_and_Object_API

JanWerder commented 5 years ago

@folkertdev No, I didn't, but the link from @EtagiBI seems promising.

folkertdev commented 5 years ago

so, it seems like changing from render layers to view layers is the only thing required. I've pushed that change to a branch here.

Can you give that a go and verify that it works correctly?

folkertdev commented 5 years ago

@JanWerder, re

Referencing #13 here. It works so far, but crashes on line 523, when the the selected path is not writeable. Apart from that it seems stable to me!

Is this on windows? on linux it picks /tmp/{svgname}.svg by default.

JanWerder commented 5 years ago

On Windows it takes C:{svgname}.svg, which is not writeable on some systems. Maybe taking the folder from which the .blend file was opened, would solve the issue

folkertdev commented 5 years ago

the exporter takes the default path from the scene's default render output path (scene > output > filepath), so I'd like to keep using that.

So is the default render output location also C:\? (that seems weird)

JanWerder commented 5 years ago

Seems so at least for me. But changing it is not an issue. But crashes hard, so you have to find that out via the console. A statement to catch that exception and throw a message, would be a good solution as well , I think.

folkertdev commented 5 years ago

does it actually output the rendered image (.png, .jpg) then? or is nothing actually produced. I would like to follow the standard behavior for the image output as much as possible.

Anyhow, it's hard to catch exceptions I don't get so I might be able to run this on a windows system during the weekend, but I'm also open to PRs

EtagiBI commented 5 years ago

Since I also have Windows, I would like to participate in testing. How am I supposed to install the addon? Blender refuses to install it from file because render_freestyle_svg already exists in ...\2.80\scripts\addons.

folkertdev commented 5 years ago

@EtagiBI that would be great. I think you can copy the file into the \2.80\scripts\addons directory (overwriting the existing one) and it should work.

EtagiBI commented 5 years ago

@EtagiBI that would be great. I think you can copy the file into the \2.80\scripts\addons directory (overwriting the existing one) and it should work.

Thanks! I tested a new version within my script and it worked without any errors.

nickmadestories commented 5 years ago

image

I'm not seeing any of the 2.7 options for the SVG Export panel using @JanWerder 's fork:

image

Any ideas?

perepau commented 5 years ago

I tried it, same problem as @nickmadedesign Info panel says:

Traceback (most recent call last):
  File "/home/perepau/Programas/blender-2.80-14884cda1ff5-linux-glibc224-x86_64/2.80/scripts/addons/render_freestyle_svg.py", line 243, in draw
    freestyle = scene.render.layers.active.freestyle_settings
AttributeError: 'RenderSettings' object has no attribute 'layers'

location: <unknown location>:-1

Hope it helps...

uillis commented 5 years ago

I ran the plugin from the branch: https://github.com/folkertdev/freestyle-svg-exporter/tree/blender28 on Windows and it errored because it was expecting this path to exist "C:/tmp/" After i added that path, the svg result appeared as "C:/tmp/0001.svg" Haven't tried to do much so far, but it might work in a pinch. Thanks!

chihab27 commented 4 years ago

With the release of blender 2.8 this plugin seems to break. The script itself should be ported to work with the new blender release.

I started a fork over at https://github.com/JanWerder/freestyle-svg-exporter

The current problem seems to be that the RenderSettings object no longer offers the layers attribute freestyle = scene.render.layers.active.freestyle_settings AttributeError: 'RenderSettings' object has no attribute 'layers' (https://github.com/folkertdev/freestyle-svg-exporter/blob/master/render_freestyle_svg.py#L243)

Hi everybody, This is because of a change in the API structure, now layers is no longer an attribute of render, alternatively, you can use this function: bpy.context.window.view_layer.freestyle_settings