hvar pHF
set pHF <project.GetMap "HF">
assert pHF "Error: cannot get heightfield!"
assert <map.GetWidth pHF> "Error: heightfield not initialised!"
hvar hOutput
set hOutput <project.GetMap "HF_Grad">
if hOutput
L3DTio_Backup.BackupMap "HF_Grad" "HF_CalcGrad" 0 "view.ShowMap \"HF_Grad\""
map.Free hOutput
else
set hOutput <project.CreateMap "HF_Grad">
endif
if <not <calc.HF.CalcGrad pHF hOutput 0x7 true>>
echo "HF_CalcGrad.zs error - call to 'calc.HF.CalcGrad' failed"
return -1
endif
map.SetFlag hOutput 1 true // ready
map.SetFlag hOutput 5 true // modified
view.ShowMap "HF_Grad"
return 0