L3DT users' wiki
Large 3D terrain generator

Scripts > Import HF

Description Import a heightfield.
Author Aaron Torpy
Created 2014/02/22 03:58
Requires L3DT v11.11
Download import_hf.zs

About

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.

Script contents

// 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"
 
scripts/import_heightfield.txt · Last modified: 2017/08/31 05:50 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki