python - Blender gives a `NameError` error when calling get_strokes() - Stack Overflow

I'm currently working on an addon for Blender that turns the camera view into an SVG. There's

I'm currently working on an addon for Blender that turns the camera view into an SVG. There's this error that shows up when I try calling get_strokes()

File "d:\Blender builds\Blender 4.2.1\4.2\scripts\freestyle\modules\freestyle\utils.py", line 95, in get_strokes
    return tuple(map(Operators().get_stroke_from_index, range(Operators().get_strokes_size())))
 
NameError: name 'Operators' is not defined

This function exists in Blender's api. It's the first time I'm coding an addon for Blender, so I might be missing something obvious.

To replicate this, you can set up a Python 3.7 environment and install bpy and numpy, and finally run bpy_post_install. For example on Conda:

conda create -n blender python=3.7 -y
conda activate blender
pip install bpy numpy
bpy_post_install

Then run the following code:

import bpy
from freestyle.utils import get_strokes

var = get_strokes()

I really need to get the strokes from the freestyle linesets for the project I'm working on at work. I'm now stuck on this part. I tried looking into the code of the existing addon Freestyle SVG Exporter to try to find how to do it, but I'm very lost.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742415658a4439689.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信