If the choice is between a proper power factor corrected 240v charger and the DC genny output then No No No!.
Proper PF corrected chargers like the Victron, Mastervolt etc etc are a zillion times more efficient at charging your battery. The amount of charge achieved per litre of fuel used is far greater than the generator’s DC output can achieve and a proper charger is going to be more sympatico to the needs and condition of your batteries. Add to that the fact that you are running the generator engine whether you use the Dc output or plug a proper charger into the 240V.
So if you are stuck in the middle of the Gobi desert and need to charge your battery so you can radio for help and the only means of doing so is the DC output on a generator. Consider using smoke signals whilst you wait for the battery to charge.