delete layer
-
On 07/04/2017 at 09:56, xxxxxxxx wrote:
I was curious about the proper way to delete a layer with python. I know you can get the layer and do layer.Remove() which does delete the layer but it leaves the scene in a weird state sometimes. If I have objects solo'd when I use layer.Remove() it leaves all objects solo'd even though the layer is gone.
Is there a proper way to go about this?
Thanks
-
On 10/04/2017 at 08:48, xxxxxxxx wrote:
Hi,
there's a small note in the Layer Manual in C++ docs that tells the trick.
You basically need to clear the NBIT_SOLO_LAYER on the document, when removing a layer that has solo switched on.
Like so:import c4d def main() : l = op.GetLayerObject(doc) if l is None: return l.Remove() doc.ChangeNBit(c4d.NBIT_SOLO_LAYER, c4d.NBITCONTROL_CLEAR) c4d.EventAdd() if __name__=='__main__': main()
-
On 10/04/2017 at 12:01, xxxxxxxx wrote:
That did it, thanks Andreas!