Did you try SlopeConstraint? What exactly, in your case is defined as not passable?
If, for example, you want to select not only the flank of the mountain but the top where the slope becomes small again, in order to paint it, then you can try (SlopeConstraint or HeightConstraint), or you can also try floodfilling (https://code.wildfiregames.com/D2828) if you want to check the area reachable starting from a specific point in the map.