Gimp-Script-Fu:从缓存插入到新层,插入到层映射中



我想将缓存中的当前图像插入到我的当前gimp项目中。通过ctrl+v可以很容易地做到这一点,但新层是浮动的。当你用它创建一个新的层时,它将是第一个层,我必须把它拖到层图中的正确位置。当我使用"插入为新层"时,层将在layermap中正确排序,但插入不会在之前选择的层的x/y位置!

我发现了一个做一些非常相似的事情的脚本,但它使用了gimp编辑复制&gimp编辑粘贴插入图层,这不是我想要的。如何更改此设置,以便它将从缓存中插入图像?

(define (script-fu-selection-to-layer inImage inLayer)
(let*
(
(isgroup (car (gimp-item-is-group inLayer)))
(parent (car (gimp-item-get-parent inLayer)))
(layername (car (gimp-item-get-name inLayer)))
(position (car (gimp-image-get-item-position inImage inLayer)))
(newlayer 0)
)
(if (= isgroup 0)
(begin
(gimp-image-undo-group-start inImage)
(gimp-edit-copy inLayer)
(set! newlayer (car (gimp-edit-paste inLayer 1)))
(gimp-floating-sel-to-layer newlayer)        
(gimp-item-set-name newlayer (string-append "insert-" layername))
(gimp-image-reorder-item inImage newlayer parent position)
(gimp-selection-none inImage)
(gimp-image-undo-group-end inImage)
)
(begin
(gimp-message "not usable on layergroups")
)
)  
)
)

只需删除(gimp-edit-copy inLayer)行,它就可以粘贴剪贴板中的任何内容。

最新更新