我有一个具有嵌套层结构的XCD文件:
image
front-layer
content-layer
content-layer-name-1
content-layer-name-2
content-layer-name-3
back-layer
我用image = pdb.gimp_file_load(xcf_file, xcf_file)
打开文件,可以得到front-layer
、content-layer
和{image.layers[0]
,image.layers[1]
和{content-layer
中的子层。在
我可以使用pdb.gimp_image_get_layer_by_name(image, 'content-layer-name-3')
,但我不知道层的名称。在
我尝试pdb.gimp_item_get_children(image.layers[1])
,但是这个方法返回INT32ARRAY
,并且我还没有找到如何通过其id检索项
如何在Gimp(2.8)中使用Python从组层获取子层?在
在这个开发周期中,gimppython基本上没有得到维护(您可以将这大部分归咎于我自己)。在
完成的少数更新之一是创建“Item”类,并在其上实现一个类方法,该类方法允许使用PDB方法返回的数字ID来检索项。在
因此,您可以使用,就像您发现的
pdb.gimp_item_get_children(group_layer)
,并在 返回的子级ID使用gimp.Item.from_id
检索实际层。在下面是一个GIMP控制台部分,我在这里“手动”检索子层:
**更新**
我花了一些黑客时间,gimp2.8final将提供对层组的适当支持-你将需要以上的黑客到gimp2.8rc1,但如果你现在从git master构建项目,层组显示为“GroupLayer”的实例,并具有“layers”属性,其工作方式与图像中的“layers”属性类似。在
commit 75242a03e45ce751656384480e747ca30d728206
^{pr2}$感谢你的失败,我正在努力解决同样的问题,因为我正在更新我的插件从2.6到2.7~2.8。这里是编辑的函数:
相关问题 更多 >
编程相关推荐