2enum SCR_EMapDataExportType
14[WorkbenchToolAttribute(
"Export Map data",
"Export data of various types from the current world",
"", awesomeFontCode: 0xF0AC)]
15class SCR_WorldMapExportTool : WorldEditorTool
22 protected ResourceName m_sDestinationPath;
24 [
Attribute(
"0", UIWidgets.ComboBox,
"Export type", enumType: SCR_EMapDataExportType,
category:
"Export File")]
25 protected SCR_EMapDataExportType
m_eType;
31 [
Attribute(
"1", UIWidgets.CheckBox,
"Generation of Roads' data",
category:
"Geometry 2D")]
32 protected bool m_bGenerateRoads;
34 [
Attribute(
"1", UIWidgets.CheckBox,
"Save Roads' data to exported file",
category:
"Geometry 2D")]
35 protected bool m_bSaveRoads;
37 [
Attribute(
"1", UIWidgets.CheckBox,
"Generation of Powerlines' data",
category:
"Geometry 2D")]
38 protected bool m_bGeneratePowerLines;
40 [
Attribute(
"1", UIWidgets.CheckBox,
"Save Powerlines' data to exported file",
category:
"Geometry 2D")]
41 protected bool m_bSavePowerLines;
43 [
Attribute(
"1", UIWidgets.CheckBox,
"Generation of Buildings' data",
category:
"Geometry 2D")]
44 protected bool m_bGenerateBuildings;
46 [
Attribute(
"1", UIWidgets.CheckBox,
"Save Buildings' data to exported file",
category:
"Geometry 2D")]
47 protected bool m_bSaveBuildings;
49 [
Attribute(
"1", UIWidgets.CheckBox,
"Generation of Areas' data",
category:
"Geometry 2D")]
50 protected bool m_bGenerateAreas;
52 [
Attribute(
"1", UIWidgets.CheckBox,
"Ignore Generator entities during generation",
category:
"Geometry 2D")]
53 protected bool m_bIgnoreGeneratorAreas;
55 [
Attribute(
"1", UIWidgets.CheckBox,
"Save Areas' data to exported file",
category:
"Geometry 2D")]
56 protected bool m_bSaveAreas;
58 [
Attribute(
"1", UIWidgets.CheckBox,
"Generation of Water Bodies' data",
category:
"Geometry 2D")]
59 protected bool m_bGenerateWaterBodies;
61 [
Attribute(
"1", UIWidgets.CheckBox,
"Save Water Bodies' data to exported file",
category:
"Geometry 2D")]
62 protected bool m_bSaveWaterBodies;
64 [
Attribute(
"1", UIWidgets.CheckBox,
"Generation of Hills' data",
category:
"Geometry 2D")]
65 protected bool m_bGenerateHills;
67 [
Attribute(
"50.0", UIWidgets.Slider,
"Minimum hill height",
"30 155 5",
category:
"Geometry 2D")]
68 protected float m_fHillMinimumHeight;
70 [
Attribute(
"1", UIWidgets.CheckBox,
"Save Hills' data to exported file",
category:
"Geometry 2D")]
71 protected bool m_bSaveHills;
77 [
Attribute(
"1.0 1.0 1.0 1.0", UIWidgets.ColorPicker,
"Land color Bright",
category:
"Rasterization")]
78 protected ref Color m_LandColorBright;
80 [
Attribute(
"0.5 0.5 0.5 1.0", UIWidgets.ColorPicker,
"Land color Dark",
category:
"Rasterization")]
81 protected ref Color m_LandColorDark;
83 [
Attribute(
"0.863 0.980 1.0 1.0", UIWidgets.ColorPicker,
"Ocean color Bright",
category:
"Rasterization")]
84 protected ref Color m_OceanColorBright;
86 [
Attribute(
"0.757 0.91 0.929 1.0", UIWidgets.ColorPicker,
"Ocean color Dark",
category:
"Rasterization")]
87 protected ref Color m_OceanColorDark;
89 [
Attribute(
"2.5", UIWidgets.Slider,
"Land scale factor",
"0 10 0.1",
category:
"Rasterization")]
90 protected float m_fLandScale;
92 [
Attribute(
"1.2", UIWidgets.Slider,
"Ocean scale factor",
"0 10 0.1",
category:
"Rasterization")]
93 protected float m_fOceanScale;
95 [
Attribute(
"500.0", UIWidgets.Slider,
"Height scale factor",
"-1000 1000 1.0",
category:
"Rasterization")]
96 protected float m_fHeightScale;
98 [
Attribute(
"60.0", UIWidgets.Slider,
"Depth scale factor",
"-1000 1000 1.0",
category:
"Rasterization")]
99 protected float m_fDepthScale;
101 [
Attribute(
"-50.0", UIWidgets.Slider,
"Depth Lerp meters",
"-1000 1000 1.0",
category:
"Rasterization")]
102 protected float m_fDepthLerpMeters;
104 [
Attribute(
"0.5", UIWidgets.Slider,
"Shade intensity factor",
"0.5 15 0.01",
category:
"Rasterization")]
105 protected float m_fShadeIntensity;
107 [
Attribute(
"1.8", UIWidgets.Slider,
"Height intensity factor",
"0.5 15 0.01",
category:
"Rasterization")]
108 protected float m_fHeightIntensity;
110 [
Attribute(
"1", UIWidgets.CheckBox,
"Include Areas defined by Generators",
category:
"Rasterization")]
111 protected bool m_bIncludeGeneratorAreas;
113 [
Attribute(
"0.608 0.784 0.529 1.0", UIWidgets.ColorPicker,
"Forest area color",
category:
"Rasterization")]
114 protected ref Color m_ForestAreaColor;
116 [
Attribute(
"1.25", UIWidgets.Slider,
"Forest area intensity factor",
"0.5 15 0.01",
category:
"Rasterization")]
117 protected float forestAreaIntensity;
119 [
Attribute(
"0.745 0.745 0.745 1.0", UIWidgets.ColorPicker,
"Other area color",
category:
"Rasterization")]
120 protected ref Color m_OtherAreaColor;
122 [
Attribute(
"1.0", UIWidgets.Slider,
"Other area intensity factor",
"0.5 15 0.01",
category:
"Rasterization")]
123 protected float m_fOtherAreaIntensity;
125 protected ref MapDataExporter m_DataExporter =
new MapDataExporter();
147 case DataExportErrorType.DataExportErrorNoCompatibleWorld:
return "World is not compatible";
149 case DataExportErrorType.DataExportErrorNotSavingToFile:
return "Not saving to file, Default Map created";
151 case DataExportErrorType.DataExportErrorNoLandOrOcean:
return "No Land or Ocean color found";
155 return "Unknown, code=" + errorCode;
160 protected bool Export()
162 WorldEditor worldEditor = Workbench.GetModule(WorldEditor);
163 WorldEditorAPI worldEditorAPI = worldEditor.GetApi();
165 worldEditorAPI.GetWorldPath(worldPath);
167 WBProgressDialog progress =
new WBProgressDialog(
"Processing", worldEditor);
169 string exportPath = m_sDestinationPath.GetPath();
171 if (
m_eType == SCR_EMapDataExportType.GEOMETRY_2D)
175 if (!m_bGenerateRoads)
178 if (!m_bGeneratePowerLines)
181 if (!m_bGenerateBuildings)
184 if (!m_bGenerateAreas)
187 if (!m_bGenerateWaterBodies)
190 if (!m_bGenerateHills)
197 if (!m_bSavePowerLines)
200 if (!m_bSaveBuildings)
206 if (!m_bSaveWaterBodies)
212 DataExportErrorType result = m_DataExporter.ExportData(
EMapDataType.Geometry2D, exportPath, worldPath, m_fHillMinimumHeight, m_bIgnoreGeneratorAreas, generateFlags, saveFlags);
215 string reason = GetReportMessage(result);
220 else if (
m_eType == SCR_EMapDataExportType.SOUNDMAP)
226 string reason = GetReportMessage(result);
231 else if (
m_eType == SCR_EMapDataExportType.RASTERIZATION)
234 DataExportErrorType result = m_DataExporter.SetupColors(m_LandColorBright, m_LandColorDark, m_OceanColorBright, m_OceanColorDark, m_ForestAreaColor, m_OtherAreaColor);
236 result = m_DataExporter.ExportRasterization(exportPath, worldPath, m_fLandScale, m_fOceanScale, m_fHeightScale, m_fDepthScale, m_fDepthLerpMeters, m_fShadeIntensity, m_fHeightIntensity, m_bIncludeGeneratorAreas, forestAreaIntensity, m_fOtherAreaIntensity);
240 string reason = GetReportMessage(result);
251class WorldDataExport : WorkbenchPlugin
257 ResourceManager rb = Workbench.GetModule(ResourceManager);
259 rb.GetCmdLine(
"-world",
path);
261 rb.GetCmdLine(
"-type",
type);
263 rb.GetCmdLine(
"-saveDir", dir);
268 if (rb.GetCmdLine(
"-excludehills", tmp))
274 if (ExportWorldData(
path,
type, dir, generateflags, saveFlags))
286 Workbench.OpenModule(WorldEditor);
287 WorldEditor worldEditor = Workbench.GetModule(WorldEditor);
288 if (!worldEditor.SetOpenedResource(
path))
294 bool exportMap =
true;
295 bool exportSound =
true;
296 bool exportRasterization =
true;
299 if (
type.StartsWith(
"2DMap"))
302 exportRasterization =
false;
304 else if (
type.StartsWith(
"SoundMap"))
307 exportRasterization =
false;
309 else if (
type.StartsWith(
"2DRasterization"))
316 WorldEditorAPI worldEditorAPI = worldEditor.GetApi();
318 worldEditorAPI.GetWorldPath(worldPath);
320 MapDataExporter mapDataExporter =
new MapDataExporter();
322 WBProgressDialog progress =
new WBProgressDialog(
"Processing", worldEditor);
329 string reason = SCR_WorldMapExportTool.GetReportMessage(result);
341 string reason = SCR_WorldMapExportTool.GetReportMessage(result);
347 if (exportRasterization)
351 const Color landColorBright =
new Color(1.0, 1.0, 1.0, 1.0);
352 const Color landColorDark =
new Color(0.5, 0.5, 0.5, 1.0);
353 const Color oceanColorBright =
new Color(0.863, 0.980, 1.0, 1.0);
354 const Color oceanColorDark =
new Color(0.757, 0.91, 0.929, 1.0);
355 const float landScale = 2.5;
356 const float oceanScale = 1.2;
357 const float heightScale = 500.0;
358 const float depthScale = 60.0;
359 const float depthLerpMeters = -50.0;
360 const float shadeIntensity = 0.5;
361 const float heightIntensity = 1.8;
362 const bool includeGeneratorAreas =
true;
363 const Color forestAreaColor =
new Color(0.608, 0.784, 0.529, 1.0);
364 const float forestAreaIntensity = 1.25;
365 const Color otherAreaColor =
new Color(0.745, 0.745, 0.745, 1.0);
366 const float otherAreaIntensity = 1.0;
368 DataExportErrorType result = mapDataExporter.SetupColors(landColorBright, landColorDark, oceanColorBright, oceanColorDark, forestAreaColor, otherAreaColor);
370 result = mapDataExporter.ExportRasterization(dir, worldPath, landScale, oceanScale, heightScale, depthScale, depthLerpMeters, shadeIntensity, heightIntensity, includeGeneratorAreas, forestAreaIntensity, otherAreaIntensity);
374 string reason = SCR_WorldMapExportTool.GetReportMessage(result);
381 Print(
"WorldDataExport: export successful!",
LogLevel.VERBOSE);
bool Execute(notnull SCR_AIGroupUtilityComponent groupUtility, vector targetPosition, SCR_AIActivitySmokeCoverFeatureProperties smokeCoverProperties, notnull array< AIAgent > avoidAgents, notnull array< AIAgent > excludeAgents, int maxPositionCount=1, SCR_AIActivityBase contextActivity=null)
SCR_ECampaignBaseType m_eType
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
class WorkbenchDialog_AbortRetryIgnore ButtonAttribute("OK", true)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
SCR_FieldOfViewSettings Attribute