Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Script Another Discrepency
#1
I had a function in version 2 that inserted layers into a specific layer group.

I'm now trying to use the same procedure in Gimp 3 but have run into a type error.

First here's the doc:

Quote:This procedure adds the specified layer to the image at the given position. If the specified parent is a valid layer group (See 'gimp-item-is-group' and 'gimp-layer-group-new') then the layer is added inside the group. If the parent is 0, the layer is added inside the main stack, outside of any group. The position argument specifies the location of the layer inside the stack (or the group, if a valid parent was supplied), starting from the top (0) and increasing. If the position is specified as -1 and the parent is specified as 0, then the layer is inserted above the active layer, or inside the group if the active layer is a layer group. The layer type must be compatible with the image base type.


However if I pass a valid GroupLayer as the value of parent I get the following error:


Code:
TypeError: could not convert (<PDBStatusType.SUCCESS: 3>, <Gimp.GroupLayer object at 0x7f359387fa40 (GimpGroupLayer at 0x5596f842c040)>)
to type 'GimpLayer' when setting property 'GimpProcedureConfig-gimp-image-insert-layer.parent'

Is there another way to insert layers into a specific LayerGroup ?

Edit I was trying to further figure things out and I notice that passing a LayerGroup to the procedure gimp-item-is-group results in a similar typecast error:


Code:
TypeError: could not convert (<PDBStatusType.SUCCESS: 3>, <Gimp.GroupLayer object at 0x7f70a7ebb180 (GimpGroupLayer at 0x5561a26ba060)>)
to type 'GimpItem' when setting property 'GimpProcedureConfig-gimp-item-is-group.item'


Thanks.

This was human error on my part passed the wrong item.  Sorry.
Reply


Messages In This Thread
Python Script Another Discrepency - by silenuznowan - 04-01-2025, 08:37 PM
RE: Python Script Another Discrepency - by Ofnuts - 04-01-2025, 09:36 PM
RE: Python Script Another Discrepency - by Ofnuts - 04-01-2025, 10:14 PM
RE: Python Script Another Discrepency - by Ofnuts - 04-01-2025, 11:42 PM
RE: Python Script Another Discrepency - by Ofnuts - 04-03-2025, 09:13 AM

Forum Jump: