[SOLVED] How do you identify if layer is a group layer or not?

For example, if you have layer_tree->get_selected_layer() How do you check if the returned layer is a group layer?

Also, if I’m running the code layer_tree->get_selected_layer()->get_parent_paste_canvas_layer() How do I check if the selected layer has a parent canvas/group before running the code? I’m guessing I have to do a try catch statement, but I’m not sure what error to catch.

something like here : github.com/synfig/synfig/blob/f … e.cpp#L301


That’s for selecting a layer’s parent layer. I wanted something to check if a layer has a parent layer. Thanks anyway.

etl::handle<Layer_PasteCanvas> paste= etl::handle<Layer_PasteCanvas>::cast_dynamic( layer->get_parent_paste_canvas_layer() ); if(paste) {

else, if not paste … no parent ?

Thanks, that’s what I needed.