python-fu/ 映射到对象:错误的参数类型

python-fu/ Map to Object: Wrong parameter type

翻遍我的代码后,我迫不及待地上网询问,希望有人能帮助我。我正在尝试开发一个 python-fu 脚本,其中一个重要部分是将图像映射到一个对象。但是每当我尝试调用 pdb.plug_in_map_object() 时,控制台都会显示 File "<input>", line 29, in <module> TypeError: wrong parameter type。 我当前的代码如下所示:

pdb.plug_in_map_object(
#image, drawable, maptype=sphere
gimp.Image,gimp.Layer,1,
#viewpoint x, y, z
0.5,0.5,1,
#position x, y, z
0.5,0.5,0,
#first-axis x, y, z
1,0,0,
#second-axis x, y, z
0,1,0,
#rotation-angle x, y, z
0,0,0,
#lighttype=none
2,
#light color (r,g,b)
(0,0,0),
#light position x, y, z
-0.5,-0.5,2,
#light direction x, y, z
-1,-1,1,
#ambientintesity, diffuseintesity, dissufereflectivity, specularreflectivity
0.3,1,0.5,0.5,
#highlight, antialiasing, tiled, newimage, traparentbackground, radius
27,1,0,0,1,0.25,
#scale x, y, z
0.5,0.5,0.5,
#cylinderlegth, 8 drawables for cylinders & boxes
0,gimp.Layer,gimp.Layer,gimp.Layer,gimp.Layer,gimp.Layer,gimp.Layer,gimp.Layer,gimp.Layer
);

(请注意,这不是我在脚本中使用的代码,我使用这些丑陋且毫无意义的 gimp.Layer 来让 python 控制台接受它。我希望能够在填写正确的值之前正确调用函数。)

错误中提到的第 29 行是最后一行,仅包含一个 PF_INT32 和八个 PF_DRAWABLE。这正是 oldest as well as in the latest (GIMP git) source code i found (if you don't want to download the latest gimp code, i uploaded the relevant file here).

中提及这些参数的方式

有人可以告诉我我做错了什么吗?

它现在可以工作了,唯一改变的是我使用了一些随机(现有)层而不是调用 gimp.Layer。所以就我而言,我只是通过 image.activelayer 使用当前活动层。无论如何映射到球体都没有关系,这些图层仅在映射到立方体或球体时使用