2

開いている SVG ファイルで実行できるスクリプトを開発しようとしています。すべてのパスを繰り返し処理し、パスを任意の色で塗りつぶしたい (コードのこの部分は後で置き換えます)。これの最初の段階はパスを反復するだけで、これを行う方法がわかりません。私のコードは以下のとおりです - 繰り返し処理されているパスが表示されないのはなぜですか?

#!/usr/bin/env python
# -*- coding: utf-8 -*-

from gimpfu import *

def plugin_main(image, layer, path):
    vectors_count, vectors = pdb.gimp_image_get_vectors(image)
    for n in vectors:
        pdb.gimp_image_select_item(image,CHANNEL-OP-REPLACE,n)
        foreground = pdb.gimp_context_get_foreground()
        pdb.gimp_edit_fill(image.layers[0], foreground)

register(
    "create_polygon_art",
    "Fills all the paths with the average color within path",
    "Fills all the paths with the average color within path",
    "Bryton Pilling",
    "Bryton Pilling",
    "2018",
    "<Image>/Filters/Fill all paths with average color",
    "RGB*, GRAY*",
    [],
    [],
    plugin_main
)

main()

また、次のような反復に単純なものを使用するなど、グーグルで見つけたさまざまなアプローチも試しました。

for v in gimp.Vectors

しかし、何を試しても、パスの反復の証拠を得ることができないようです。

Windows 10 64 ビットで gimp 2.10.6 を使用しています。

4

1 に答える 1