Description | Import a heightfield. |
---|---|
Author | Aaron Torpy |
Created | 2014/02/22 03:58 |
Requires | L3DT v11.11 |
Download | import_hf.zs |
This script allows users to import a heightfield into an existing project without having to start a new project. It can be used to re-import a heightfield after editing in other software.
// Author: A. Torpy // Created: 22 Feb 2014 // Purpose: Load a heightfield into an existing project if <not <project.IsInit>> project.InitProject endif hvar hMap set hMap <GetMap "HF"> assert hMap "Cannot get heightfield!" // exit immediately if HF is not initialised if <not <iseq 0 <map.GetWidth hMap>>> // store a backup L3DTio_Backup.BackupMap "HF" "Import HF" 0 "view.ShowMap \"HF\"" // free HF map.Free hMap endif // initialise and edit file selector filesel FS filesel.Init &FS true NULL "Heightfield files|*.hfz;*.hf2;*.hff;*.ter;*.bt;*.png;*.bmp;*.tga|All files (*.*)|*.*|" NULL NULL assert <EditUI &FS "Select heightfield to import"> "Import aborted" // initialise and edit settings list assert <map.LoadFile2 hMap <filesel.GetPathA &FS> HF false true> "Error loading file" map.SetFlag hMap 1 true // set 'Ready' flag map.SetFlag hMap 5 false // clear 'modified' flag // refresh the heightfield view.ShowMap "HF"