diff --git a/Engine/source/T3D/assets/GUIAsset.cpp b/Engine/source/T3D/assets/GUIAsset.cpp
index acef864db..a8f4fe0f3 100644
--- a/Engine/source/T3D/assets/GUIAsset.cpp
+++ b/Engine/source/T3D/assets/GUIAsset.cpp
@@ -102,7 +102,7 @@ void GUIAsset::initPersistFields()
&setScriptFile, &getScriptFile, "Path to the script file for the gui");
addProtectedField("GUIFile", TypeAssetLooseFilePath, Offset(mGUIFile, GUIAsset),
- &setScriptFile, &getScriptFile, "Path to the gui file");
+ &setGUIFile, &getGUIFile, "Path to the gui file");
}
//------------------------------------------------------------------------------
diff --git a/Engine/source/T3D/assets/ShapeAsset.cpp b/Engine/source/T3D/assets/ShapeAsset.cpp
index c145965a1..fb3be2341 100644
--- a/Engine/source/T3D/assets/ShapeAsset.cpp
+++ b/Engine/source/T3D/assets/ShapeAsset.cpp
@@ -623,8 +623,8 @@ const char* ShapeAsset::generateCachedPreviewImage(S32 resolution, String overri
String dumpPath = String(mFilePath) + "_Preview.dds";
- char* returnBuffer = Con::getReturnBuffer(dumpPath.length());
- dSprintf(returnBuffer, dumpPath.length(), "%s", dumpPath.c_str());
+ char* returnBuffer = Con::getReturnBuffer(128);
+ dSprintf(returnBuffer, 128, "%s", dumpPath.c_str());
/*FileStream stream;
if (stream.open(dumpPath, Torque::FS::File::Write))
diff --git a/Engine/source/T3D/assets/assetImporter.cpp b/Engine/source/T3D/assets/assetImporter.cpp
index 7c0bda9ae..7bb109f02 100644
--- a/Engine/source/T3D/assets/assetImporter.cpp
+++ b/Engine/source/T3D/assets/assetImporter.cpp
@@ -2099,22 +2099,28 @@ void AssetImporter::processShapeMaterialInfo(AssetImportObject* assetItem, S32 m
String imgFileName = AssetImporter::findImagePath(testFilePath.getPath() + "/" + testFilePath.getFileName());
if (imgFileName.isNotEmpty())
filePath = imgFileName;
+ else
+ filePath = ""; //no luck, so we just won't try importing in the image
}
}
matAssetItem = addImportingAsset("MaterialAsset", shapePathBase + "/" + matName, assetItem, matName);
- AssetImportObject* imageAssetItem = addImportingAsset("ImageAsset", filePath, matAssetItem, "");
- String suffixType;
- String suffix = parseImageSuffixes(imageAssetItem->assetName, &suffixType);
- if (suffix.isNotEmpty())
+ if (!filePath.isEmpty())
{
- imageAssetItem->imageSuffixType = suffixType;
- }
- else
- {
- //we'll assume it's albedo
- imageAssetItem->imageSuffixType = "Albedo";
+ AssetImportObject* imageAssetItem = addImportingAsset("ImageAsset", filePath, matAssetItem, "");
+
+ String suffixType;
+ String suffix = parseImageSuffixes(imageAssetItem->assetName, &suffixType);
+ if (suffix.isNotEmpty())
+ {
+ imageAssetItem->imageSuffixType = suffixType;
+ }
+ else
+ {
+ //we'll assume it's albedo
+ imageAssetItem->imageSuffixType = "Albedo";
+ }
}
}
else
diff --git a/Engine/source/persistence/taml/taml.cpp b/Engine/source/persistence/taml/taml.cpp
index b05b0d8bc..2bfd104b9 100644
--- a/Engine/source/persistence/taml/taml.cpp
+++ b/Engine/source/persistence/taml/taml.cpp
@@ -217,6 +217,11 @@ ImplementEnumType(_TamlFormatMode,
FileStream stream;
+ if (StringTable->insert("c://.asset.taml") == StringTable->insert(mFilePathBuffer))
+ {
+ bool asdfasdf = true;
+ }
+
// File opened?
if (!stream.open(mFilePathBuffer, Torque::FS::File::Write))
{
diff --git a/Engine/source/persistence/taml/taml_ScriptBinding.h b/Engine/source/persistence/taml/taml_ScriptBinding.h
index 6e4a3ed09..841fadb8f 100644
--- a/Engine/source/persistence/taml/taml_ScriptBinding.h
+++ b/Engine/source/persistence/taml/taml_ScriptBinding.h
@@ -256,8 +256,10 @@ DefineEngineFunction(TamlWrite, bool, (SimObject* simObject, const char* filenam
}
else
{
- // No, so warn.
- Con::warnf( "TamlWrite() - Setting binary compression is only valid for XML formatting." );
+#ifdef TORQUE_DEBUG
+ // No, so warn.
+ Con::warnf( "TamlWrite() - Setting binary compression is only valid for XML formatting." );
+#endif
}
// Turn-off auto-formatting.
diff --git a/Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml b/Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml
index 8417b1fa4..faa7ab1e6 100644
--- a/Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml
+++ b/Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml
@@ -100,7 +100,7 @@
LOS
- 1
+ 0
0
FolderPrefix
1
diff --git a/Templates/BaseGame/game/tools/projectImporter/guis/projectImporter.gui b/Templates/BaseGame/game/tools/projectImporter/guis/projectImporter.gui
index 480e71704..bed599d3e 100644
--- a/Templates/BaseGame/game/tools/projectImporter/guis/projectImporter.gui
+++ b/Templates/BaseGame/game/tools/projectImporter/guis/projectImporter.gui
@@ -45,25 +45,27 @@ $guiContent = new GuiControl(ProjectImportCtrl) {
canSave = "1";
canSaveDynamicFields = "0";
- new GuiSplitContainer() {
- orientation = "Vertical";
- splitterSize = "2";
- splitPoint = "152 100";
- fixedPanel = "FirstPanel";
- fixedSize = "100";
- docking = "None";
+ new GuiScrollCtrl(ProejctImportPageContainer) {
+ willFirstRespond = "1";
+ hScrollBar = "dynamic";
+ vScrollBar = "dynamic";
+ lockHorizScroll = "0";
+ lockVertScroll = "0";
+ constantThumbHeight = "0";
+ childMargin = "0 0";
+ mouseWheelScrollSpeed = "-1";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
- position = "6 24";
- extent = "531 445";
- minExtent = "64 64";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "ToolsGuiSolidDefaultProfile";
+ position = "0 25";
+ extent = "541 437";
+ minExtent = "8 2";
+ horizSizing = "width";
+ vertSizing = "height";
+ profile = "ToolsGuiScrollProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
@@ -72,844 +74,497 @@ $guiContent = new GuiControl(ProjectImportCtrl) {
canSave = "1";
canSaveDynamicFields = "0";
- new GuiPanel() {
- docking = "Client";
+ new GuiContainer(ProjectImportWizardPage0) {
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
- position = "0 0";
- extent = "150 445";
- minExtent = "16 16";
- horizSizing = "right";
+ position = "1 1";
+ extent = "365 429";
+ minExtent = "8 2";
+ horizSizing = "width";
vertSizing = "bottom";
profile = "GuiDefaultProfile";
- visible = "1";
+ visible = "0";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
- internalName = "Panel1";
+ internalName = "page0";
+ hidden = "1";
canSave = "1";
canSaveDynamicFields = "0";
- new GuiScrollCtrl() {
- willFirstRespond = "1";
- hScrollBar = "dynamic";
- vScrollBar = "dynamic";
- lockHorizScroll = "0";
- lockVertScroll = "0";
- constantThumbHeight = "0";
- childMargin = "0 0";
- mouseWheelScrollSpeed = "-1";
- margin = "0 0 0 0";
- padding = "0 0 0 0";
- anchorTop = "1";
- anchorBottom = "0";
- anchorLeft = "1";
- anchorRight = "0";
- position = "0 0";
- extent = "150 445";
+ new GuiMLTextCtrl() {
+ lineSpacing = "2";
+ allowColorChars = "0";
+ maxChars = "-1";
+ text = "Welcome! This project importer will assist you in importing in legacy projects into this build of Torque3D.";
+ useURLMouseCursor = "0";
+ position = "23 21";
+ extent = "328 28";
minExtent = "8 2";
- horizSizing = "width";
- vertSizing = "height";
- profile = "ToolsGuiScrollProfile";
+ horizSizing = "right";
+ vertSizing = "bottom";
+ profile = "ToolsGuiMLTextProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
- isContainer = "1";
+ isContainer = "0";
+ canSave = "1";
+ canSaveDynamicFields = "0";
+ };
+ new GuiMLTextCtrl() {
+ lineSpacing = "2";
+ allowColorChars = "0";
+ maxChars = "-1";
+ text = "To continue, click Next.";
+ useURLMouseCursor = "0";
+ position = "23 77";
+ extent = "328 14";
+ minExtent = "8 2";
+ horizSizing = "right";
+ vertSizing = "bottom";
+ profile = "ToolsGuiMLTextProfile";
+ visible = "1";
+ active = "1";
+ tooltipProfile = "GuiToolTipProfile";
+ hovertime = "1000";
+ isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
-
- new GuiTextListCtrl() {
- columns = "0";
- fitParentWidth = "1";
- clipColumnText = "0";
- rowHeightPadding = "2";
- position = "1 1";
- extent = "135 128";
- minExtent = "8 2";
- horizSizing = "width";
- vertSizing = "height";
- profile = "ToolsGuiDefaultProfile";
- visible = "1";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "1";
- internalName = "stepsList";
- canSave = "1";
- canSaveDynamicFields = "0";
- };
- new GuiControl() {
- position = "1 1";
- extent = "150 445";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "GuiDefaultProfile";
- visible = "1";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "1";
- canSave = "1";
- canSaveDynamicFields = "0";
- };
};
};
- new GuiPanel() {
- docking = "Client";
+ new GuiContainer(ProjectImportWizardPage1) {
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
- position = "154 0";
- extent = "377 445";
- minExtent = "16 16";
- horizSizing = "right";
+ position = "1 1";
+ extent = "539 429";
+ minExtent = "8 2";
+ horizSizing = "width";
vertSizing = "bottom";
profile = "GuiDefaultProfile";
- visible = "1";
+ visible = "0";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
- internalName = "panel2";
+ internalName = "page1";
+ hidden = "1";
canSave = "1";
canSaveDynamicFields = "0";
- new GuiScrollCtrl() {
- willFirstRespond = "1";
- hScrollBar = "dynamic";
- vScrollBar = "dynamic";
- lockHorizScroll = "0";
- lockVertScroll = "0";
- constantThumbHeight = "0";
- childMargin = "0 0";
- mouseWheelScrollSpeed = "-1";
+ new GuiMLTextCtrl() {
+ lineSpacing = "2";
+ allowColorChars = "0";
+ maxChars = "-1";
+ text = "First, you must select what version of Torque3D the prior project\'s content is coming from.";
+ useURLMouseCursor = "0";
+ position = "23 21";
+ extent = "328 28";
+ minExtent = "8 2";
+ horizSizing = "right";
+ vertSizing = "bottom";
+ profile = "ToolsGuiMLTextProfile";
+ visible = "0";
+ active = "1";
+ tooltipProfile = "GuiToolTipProfile";
+ hovertime = "1000";
+ isContainer = "0";
+ hidden = "1";
+ canSave = "1";
+ canSaveDynamicFields = "0";
+ };
+ new GuiPopUpMenuCtrl() {
+ maxPopupHeight = "200";
+ sbUsesNAColor = "0";
+ reverseTextList = "0";
+ bitmapBounds = "16 16";
+ maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
- position = "0 0";
- extent = "377 445";
+ position = "138 104";
+ extent = "268 18";
minExtent = "8 2";
- horizSizing = "width";
- vertSizing = "height";
- profile = "ToolsGuiScrollProfile";
- visible = "1";
+ horizSizing = "center";
+ vertSizing = "bottom";
+ profile = "ToolsGuiPopUpMenuProfile";
+ visible = "0";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
+ internalName = "previousContentVersionPopup";
+ hidden = "1";
canSave = "1";
canSaveDynamicFields = "0";
+ };
+ new GuiMLTextCtrl() {
+ lineSpacing = "2";
+ allowColorChars = "0";
+ maxChars = "-1";
+ text = "Now that that\'s selected, press Next to continue.";
+ useURLMouseCursor = "0";
+ position = "23 181";
+ extent = "328 14";
+ minExtent = "8 2";
+ horizSizing = "right";
+ vertSizing = "bottom";
+ profile = "ToolsGuiMLTextProfile";
+ visible = "0";
+ active = "1";
+ tooltipProfile = "GuiToolTipProfile";
+ hovertime = "1000";
+ isContainer = "0";
+ hidden = "1";
+ canSave = "1";
+ canSaveDynamicFields = "0";
+ };
+ };
+ new GuiContainer(ProjectImportWizardPage2) {
+ margin = "0 0 0 0";
+ padding = "0 0 0 0";
+ anchorTop = "1";
+ anchorBottom = "0";
+ anchorLeft = "1";
+ anchorRight = "0";
+ position = "1 1";
+ extent = "538 429";
+ minExtent = "8 2";
+ horizSizing = "width";
+ vertSizing = "bottom";
+ profile = "GuiDefaultProfile";
+ visible = "0";
+ active = "1";
+ tooltipProfile = "GuiToolTipProfile";
+ hovertime = "1000";
+ isContainer = "1";
+ internalName = "page2";
+ hidden = "1";
+ canSave = "1";
+ canSaveDynamicFields = "0";
- new GuiContainer(ProjectImportWizardPage0) {
- margin = "0 0 0 0";
- padding = "0 0 0 0";
- anchorTop = "1";
- anchorBottom = "0";
- anchorLeft = "1";
- anchorRight = "0";
- position = "1 1";
- extent = "365 429";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "GuiDefaultProfile";
- visible = "0";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "1";
- internalName = "page0";
- hidden = "1";
- canSave = "1";
- canSaveDynamicFields = "0";
+ new GuiMLTextCtrl() {
+ lineSpacing = "2";
+ allowColorChars = "0";
+ maxChars = "-1";
+ text = "Next, where is the previous project\'s content?";
+ useURLMouseCursor = "0";
+ position = "23 21";
+ extent = "328 14";
+ minExtent = "8 2";
+ horizSizing = "right";
+ vertSizing = "bottom";
+ profile = "ToolsGuiMLTextProfile";
+ visible = "0";
+ active = "1";
+ tooltipProfile = "GuiToolTipProfile";
+ hovertime = "1000";
+ isContainer = "0";
+ hidden = "1";
+ canSave = "1";
+ canSaveDynamicFields = "0";
+ };
+ new GuiMLTextCtrl() {
+ lineSpacing = "2";
+ allowColorChars = "0";
+ maxChars = "-1";
+ text = "Now, point to the folder to be imported.";
+ useURLMouseCursor = "0";
+ position = "123 221";
+ extent = "328 14";
+ minExtent = "8 2";
+ horizSizing = "right";
+ vertSizing = "bottom";
+ profile = "ToolsGuiMLTextProfile";
+ visible = "0";
+ active = "1";
+ tooltipProfile = "GuiToolTipProfile";
+ hovertime = "1000";
+ isContainer = "0";
+ hidden = "1";
+ canSave = "1";
+ canSaveDynamicFields = "0";
+ };
+ new GuiButtonCtrl() {
+ text = "Find Folder";
+ groupNum = "-1";
+ buttonType = "PushButton";
+ useMouseEvents = "0";
+ position = "123 246";
+ extent = "330 30";
+ minExtent = "8 2";
+ horizSizing = "right";
+ vertSizing = "bottom";
+ profile = "ToolsGuiButtonProfile";
+ visible = "0";
+ active = "1";
+ command = "ProjectImportWindow.selectOGFolder();";
+ tooltipProfile = "GuiToolTipProfile";
+ hovertime = "1000";
+ isContainer = "0";
+ internalName = "selectOriginalContentFolderBtn";
+ hidden = "1";
+ canSave = "1";
+ canSaveDynamicFields = "0";
+ };
+ new GuiMLTextCtrl() {
+ lineSpacing = "2";
+ allowColorChars = "0";
+ maxChars = "-1";
+ useURLMouseCursor = "0";
+ position = "23 341";
+ extent = "500 14";
+ minExtent = "8 2";
+ horizSizing = "center";
+ vertSizing = "bottom";
+ profile = "ToolsGuiMLTextProfile";
+ visible = "0";
+ active = "1";
+ tooltipProfile = "GuiToolTipProfile";
+ hovertime = "1000";
+ isContainer = "0";
+ internalName = "targetImportingPath";
+ hidden = "1";
+ canSave = "1";
+ canSaveDynamicFields = "0";
+ };
+ };
+ new GuiContainer(ProjectImportWizardPage3) {
+ margin = "0 0 0 0";
+ padding = "0 0 0 0";
+ anchorTop = "1";
+ anchorBottom = "0";
+ anchorLeft = "1";
+ anchorRight = "0";
+ position = "1 1";
+ extent = "539 429";
+ minExtent = "8 2";
+ horizSizing = "right";
+ vertSizing = "bottom";
+ profile = "GuiDefaultProfile";
+ visible = "0";
+ active = "1";
+ tooltipProfile = "GuiToolTipProfile";
+ hovertime = "1000";
+ isContainer = "1";
+ internalName = "page3";
+ hidden = "1";
+ canSave = "1";
+ canSaveDynamicFields = "0";
- new GuiMLTextCtrl() {
- lineSpacing = "2";
- allowColorChars = "0";
- maxChars = "-1";
- text = "Welcome! This project importer will assist you in importing in legacy projects into this build of Torque3D.";
- useURLMouseCursor = "0";
- useTypeOverTime = "0";
- typeOverTimeSpeedMS = "10";
- typeoutSoundRate = "-1";
- position = "23 21";
- extent = "328 28";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "ToolsGuiMLTextProfile";
- visible = "1";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "0";
- canSave = "1";
- canSaveDynamicFields = "0";
- };
- new GuiMLTextCtrl() {
- lineSpacing = "2";
- allowColorChars = "0";
- maxChars = "-1";
- text = "To continue, click Next.";
- useURLMouseCursor = "0";
- useTypeOverTime = "0";
- typeOverTimeSpeedMS = "10";
- typeoutSoundRate = "-1";
- position = "23 77";
- extent = "328 14";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "ToolsGuiMLTextProfile";
- visible = "1";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "0";
- canSave = "1";
- canSaveDynamicFields = "0";
- };
- };
- new GuiContainer(ProjectImportWizardPage1) {
- margin = "0 0 0 0";
- padding = "0 0 0 0";
- anchorTop = "1";
- anchorBottom = "0";
- anchorLeft = "1";
- anchorRight = "0";
- position = "1 1";
- extent = "365 429";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "GuiDefaultProfile";
- visible = "0";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "1";
- internalName = "page1";
- hidden = "1";
- canSave = "1";
- canSaveDynamicFields = "0";
+ new GuiMLTextCtrl() {
+ lineSpacing = "2";
+ allowColorChars = "0";
+ maxChars = "-1";
+ text = "Under normal circumstances, all game content in Torque3D is grouped together in packages named Modules. These are placed into the game\'s data/ directory, which the system automatically scans on start. ";
+ useURLMouseCursor = "0";
+ position = "23 21";
+ extent = "328 56";
+ minExtent = "8 2";
+ horizSizing = "right";
+ vertSizing = "bottom";
+ profile = "ToolsGuiMLTextProfile";
+ visible = "0";
+ active = "1";
+ tooltipProfile = "GuiToolTipProfile";
+ hovertime = "1000";
+ isContainer = "0";
+ hidden = "1";
+ canSave = "1";
+ canSaveDynamicFields = "0";
+ };
+ new GuiMLTextCtrl() {
+ lineSpacing = "2";
+ allowColorChars = "0";
+ maxChars = "-1";
+ text = "To port your legacy content, first we need a module to port the content into. Please provide a module name in the text field below, and the importer will create a new module folder for you.";
+ useURLMouseCursor = "0";
+ position = "23 85";
+ extent = "325 42";
+ minExtent = "8 2";
+ horizSizing = "right";
+ vertSizing = "bottom";
+ profile = "ToolsGuiMLTextProfile";
+ visible = "0";
+ active = "1";
+ tooltipProfile = "GuiToolTipProfile";
+ hovertime = "1000";
+ isContainer = "0";
+ hidden = "1";
+ canSave = "1";
+ canSaveDynamicFields = "0";
+ };
+ new GuiMLTextCtrl() {
+ lineSpacing = "2";
+ allowColorChars = "0";
+ maxChars = "-1";
+ text = "For your convenience, we\'ve pre-populated the field with the name of the folder you\'d selected to import, but you can change it to whatever you want the module to be!";
+ useURLMouseCursor = "0";
+ position = "119 157";
+ extent = "325 42";
+ minExtent = "8 2";
+ horizSizing = "center";
+ vertSizing = "bottom";
+ profile = "ToolsGuiMLTextProfile";
+ visible = "0";
+ active = "1";
+ tooltipProfile = "GuiToolTipProfile";
+ hovertime = "1000";
+ isContainer = "0";
+ hidden = "1";
+ canSave = "1";
+ canSaveDynamicFields = "0";
+ };
+ new GuiTextEditCtrl() {
+ historySize = "0";
+ tabComplete = "0";
+ sinkAllKeyEvents = "0";
+ password = "0";
+ passwordMask = "*";
+ maxLength = "1024";
+ margin = "0 0 0 0";
+ padding = "0 0 0 0";
+ anchorTop = "1";
+ anchorBottom = "0";
+ anchorLeft = "1";
+ anchorRight = "0";
+ position = "175 215";
+ extent = "209 18";
+ minExtent = "8 2";
+ horizSizing = "right";
+ vertSizing = "bottom";
+ profile = "GuiTextEditProfile";
+ visible = "0";
+ active = "1";
+ tooltipProfile = "GuiToolTipProfile";
+ hovertime = "1000";
+ isContainer = "1";
+ internalName = "newModuleName";
+ hidden = "1";
+ canSave = "1";
+ canSaveDynamicFields = "0";
+ };
+ };
+ new GuiContainer(ProjectImportWizardPage4) {
+ margin = "0 0 0 0";
+ padding = "0 0 0 0";
+ anchorTop = "1";
+ anchorBottom = "0";
+ anchorLeft = "1";
+ anchorRight = "0";
+ position = "1 1";
+ extent = "539 429";
+ minExtent = "8 2";
+ horizSizing = "right";
+ vertSizing = "bottom";
+ profile = "GuiDefaultProfile";
+ visible = "0";
+ active = "1";
+ tooltipProfile = "GuiToolTipProfile";
+ hovertime = "1000";
+ isContainer = "1";
+ internalName = "page4";
+ hidden = "1";
+ canSave = "1";
+ canSaveDynamicFields = "0";
- new GuiMLTextCtrl() {
- lineSpacing = "2";
- allowColorChars = "0";
- maxChars = "-1";
- text = "First, you must select what version of Torque3D the prior project\'s content is coming from.";
- useURLMouseCursor = "0";
- useTypeOverTime = "0";
- typeOverTimeSpeedMS = "10";
- typeoutSoundRate = "-1";
- position = "23 21";
- extent = "328 28";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "ToolsGuiMLTextProfile";
- visible = "1";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "0";
- canSave = "1";
- canSaveDynamicFields = "0";
- };
- new GuiPopUpMenuCtrl() {
- maxPopupHeight = "200";
- sbUsesNAColor = "0";
- reverseTextList = "0";
- bitmapBounds = "16 16";
- maxLength = "1024";
- margin = "0 0 0 0";
- padding = "0 0 0 0";
- anchorTop = "1";
- anchorBottom = "0";
- anchorLeft = "1";
- anchorRight = "0";
- position = "50 104";
- extent = "268 18";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "ToolsGuiPopUpMenuProfile";
- visible = "1";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "1";
- internalName = "previousContentVersionPopup";
- canSave = "1";
- canSaveDynamicFields = "0";
- };
- new GuiMLTextCtrl() {
- lineSpacing = "2";
- allowColorChars = "0";
- maxChars = "-1";
- text = "Now that that\'s selected, press Next to continue.";
- useURLMouseCursor = "0";
- useTypeOverTime = "0";
- typeOverTimeSpeedMS = "10";
- typeoutSoundRate = "-1";
- position = "23 181";
- extent = "328 14";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "ToolsGuiMLTextProfile";
- visible = "1";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "0";
- canSave = "1";
- canSaveDynamicFields = "0";
- };
- };
- new GuiContainer(ProjectImportWizardPage2) {
- margin = "0 0 0 0";
- padding = "0 0 0 0";
- anchorTop = "1";
- anchorBottom = "0";
- anchorLeft = "1";
- anchorRight = "0";
- position = "1 1";
- extent = "365 429";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "GuiDefaultProfile";
- visible = "1";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "1";
- internalName = "page2";
- canSave = "1";
- canSaveDynamicFields = "0";
+ new GuiMLTextCtrl() {
+ lineSpacing = "2";
+ allowColorChars = "0";
+ maxChars = "-1";
+ text = "Before we run the actual import, we\'ll start by preprocessing the files so we know what we\'re working with. This may take a moment.";
+ useURLMouseCursor = "0";
+ position = "23 21";
+ extent = "328 42";
+ minExtent = "8 2";
+ horizSizing = "right";
+ vertSizing = "bottom";
+ profile = "ToolsGuiMLTextProfile";
+ visible = "1";
+ active = "1";
+ tooltipProfile = "GuiToolTipProfile";
+ hovertime = "1000";
+ isContainer = "0";
+ canSave = "1";
+ canSaveDynamicFields = "0";
+ };
+ new GuiMLTextCtrl() {
+ lineSpacing = "2";
+ allowColorChars = "0";
+ maxChars = "-1";
+ text = "Done!";
+ useURLMouseCursor = "0";
+ position = "107 181";
+ extent = "328 14";
+ minExtent = "8 2";
+ horizSizing = "center";
+ vertSizing = "bottom";
+ profile = "ToolsGuiMLTextProfile";
+ visible = "0";
+ active = "1";
+ tooltipProfile = "GuiToolTipProfile";
+ hovertime = "1000";
+ isContainer = "0";
+ internalName = "preprocessCompleteText";
+ hidden = "1";
+ canSave = "1";
+ canSaveDynamicFields = "0";
+ };
+ };
+ new GuiContainer(ProjectImportWizardFinalPage) {
+ margin = "0 0 0 0";
+ padding = "0 0 0 0";
+ anchorTop = "1";
+ anchorBottom = "0";
+ anchorLeft = "1";
+ anchorRight = "0";
+ position = "1 1";
+ extent = "539 429";
+ minExtent = "8 2";
+ horizSizing = "width";
+ vertSizing = "bottom";
+ profile = "GuiDefaultProfile";
+ visible = "0";
+ active = "1";
+ tooltipProfile = "GuiToolTipProfile";
+ hovertime = "1000";
+ isContainer = "1";
+ hidden = "1";
+ canSave = "1";
+ canSaveDynamicFields = "0";
- new GuiMLTextCtrl() {
- lineSpacing = "2";
- allowColorChars = "0";
- maxChars = "-1";
- text = "Next, where is the previous project\'s content?";
- useURLMouseCursor = "0";
- useTypeOverTime = "0";
- typeOverTimeSpeedMS = "10";
- typeoutSoundRate = "-1";
- position = "23 21";
- extent = "328 14";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "ToolsGuiMLTextProfile";
- visible = "1";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "0";
- canSave = "1";
- canSaveDynamicFields = "0";
- };
- new GuiRadioCtrl() {
- text = "Existing folder in current project\'s data/ folder";
- groupNum = "-1";
- buttonType = "RadioButton";
- useMouseEvents = "0";
- position = "22 53";
- extent = "320 52";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "ToolsGuiRadioProfile";
- visible = "1";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "0";
- internalName = "internalFolderBtn";
- canSave = "1";
- canSaveDynamicFields = "0";
- };
- new GuiRadioCtrl() {
- text = "Existing folder not in the current project\'s data/ folder";
- groupNum = "-1";
- buttonType = "RadioButton";
- useMouseEvents = "0";
- position = "22 109";
- extent = "320 52";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "ToolsGuiRadioProfile";
- visible = "1";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "0";
- internalName = "externalFolderBtn";
- canSave = "1";
- canSaveDynamicFields = "0";
- };
- new GuiRadioCtrl() {
- text = "Core and Tools";
- groupNum = "-1";
- buttonType = "RadioButton";
- useMouseEvents = "0";
- position = "22 157";
- extent = "320 52";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "ToolsGuiRadioProfile";
- visible = "1";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "0";
- internalName = "coreAndToolsBtn";
- canSave = "1";
- canSaveDynamicFields = "0";
- };
- new GuiMLTextCtrl() {
- lineSpacing = "2";
- allowColorChars = "0";
- maxChars = "-1";
- text = "Now, point to the folder to be imported.";
- useURLMouseCursor = "0";
- useTypeOverTime = "0";
- typeOverTimeSpeedMS = "10";
- typeoutSoundRate = "-1";
- position = "23 221";
- extent = "328 14";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "ToolsGuiMLTextProfile";
- visible = "1";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "0";
- canSave = "1";
- canSaveDynamicFields = "0";
- };
- new GuiButtonCtrl() {
- text = "Find Folder";
- groupNum = "-1";
- buttonType = "PushButton";
- useMouseEvents = "0";
- position = "19 246";
- extent = "330 30";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "ToolsGuiButtonProfile";
- visible = "1";
- active = "1";
- command = "ProjectImportWindow.selectOGFolder();";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "0";
- internalName = "selectOriginalContentFolderBtn";
- canSave = "1";
- canSaveDynamicFields = "0";
- };
- new GuiMLTextCtrl() {
- lineSpacing = "2";
- allowColorChars = "0";
- maxChars = "-1";
- useURLMouseCursor = "0";
- useTypeOverTime = "0";
- typeOverTimeSpeedMS = "10";
- typeoutSoundRate = "-1";
- position = "23 341";
- extent = "328 14";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "ToolsGuiMLTextProfile";
- visible = "1";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "0";
- internalName = "targetImportingPath";
- canSave = "1";
- canSaveDynamicFields = "0";
- };
- };
- new GuiContainer(ProjectImportWizardPage3) {
- margin = "0 0 0 0";
- padding = "0 0 0 0";
- anchorTop = "1";
- anchorBottom = "0";
- anchorLeft = "1";
- anchorRight = "0";
- position = "1 1";
- extent = "365 429";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "GuiDefaultProfile";
- visible = "0";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "1";
- internalName = "page3";
- hidden = "1";
- canSave = "1";
- canSaveDynamicFields = "0";
-
- new GuiMLTextCtrl() {
- lineSpacing = "2";
- allowColorChars = "0";
- maxChars = "-1";
- text = "Under normal circumstances, all game content in Torque3D is grouped together in packages named Modules. These are placed into the game\'s data/ directory, which the system automatically scans on start. ";
- useURLMouseCursor = "0";
- useTypeOverTime = "0";
- typeOverTimeSpeedMS = "10";
- typeoutSoundRate = "-1";
- position = "23 21";
- extent = "328 56";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "ToolsGuiMLTextProfile";
- visible = "1";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "0";
- canSave = "1";
- canSaveDynamicFields = "0";
- };
- new GuiMLTextCtrl() {
- lineSpacing = "2";
- allowColorChars = "0";
- maxChars = "-1";
- text = "To port your legacy content, first we need a module to port the content into. Please provide a module name in the text field below, and the importer will create a new module folder for you.";
- useURLMouseCursor = "0";
- useTypeOverTime = "0";
- typeOverTimeSpeedMS = "10";
- typeoutSoundRate = "-1";
- position = "23 85";
- extent = "325 42";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "ToolsGuiMLTextProfile";
- visible = "1";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "0";
- canSave = "1";
- canSaveDynamicFields = "0";
- };
- new GuiMLTextCtrl() {
- lineSpacing = "2";
- allowColorChars = "0";
- maxChars = "-1";
- text = "For your convenience, we\'ve pre-populated the field with the name of the folder you\'d selected to import, but you can change it to whatever you want the module to be!";
- useURLMouseCursor = "0";
- useTypeOverTime = "0";
- typeOverTimeSpeedMS = "10";
- typeoutSoundRate = "-1";
- position = "23 157";
- extent = "325 42";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "ToolsGuiMLTextProfile";
- visible = "1";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "0";
- canSave = "1";
- canSaveDynamicFields = "0";
- };
- new GuiTextEditCtrl() {
- historySize = "0";
- tabComplete = "0";
- sinkAllKeyEvents = "0";
- password = "0";
- passwordMask = "*";
- maxLength = "1024";
- margin = "0 0 0 0";
- padding = "0 0 0 0";
- anchorTop = "1";
- anchorBottom = "0";
- anchorLeft = "1";
- anchorRight = "0";
- position = "79 215";
- extent = "209 18";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "GuiTextEditProfile";
- visible = "1";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "1";
- internalName = "newModuleName";
- canSave = "1";
- canSaveDynamicFields = "0";
- };
- };
- new GuiContainer(ProjectImportWizardPage4) {
- margin = "0 0 0 0";
- padding = "0 0 0 0";
- anchorTop = "1";
- anchorBottom = "0";
- anchorLeft = "1";
- anchorRight = "0";
- position = "1 1";
- extent = "365 429";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "GuiDefaultProfile";
- visible = "0";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "1";
- internalName = "page4";
- hidden = "1";
- canSave = "1";
- canSaveDynamicFields = "0";
-
- new GuiMLTextCtrl() {
- lineSpacing = "2";
- allowColorChars = "0";
- maxChars = "-1";
- useURLMouseCursor = "0";
- useTypeOverTime = "0";
- typeOverTimeSpeedMS = "10";
- typeoutSoundRate = "-1";
- position = "23 21";
- extent = "328 14";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "ToolsGuiMLTextProfile";
- visible = "1";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "0";
- internalName = "fileCopyText";
- canSave = "1";
- canSaveDynamicFields = "0";
- };
- };
- new GuiContainer(ProjectImportWizardPage5) {
- margin = "0 0 0 0";
- padding = "0 0 0 0";
- anchorTop = "1";
- anchorBottom = "0";
- anchorLeft = "1";
- anchorRight = "0";
- position = "1 1";
- extent = "365 429";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "GuiDefaultProfile";
- visible = "0";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "1";
- internalName = "page5";
- hidden = "1";
- canSave = "1";
- canSaveDynamicFields = "0";
-
- new GuiMLTextCtrl() {
- lineSpacing = "2";
- allowColorChars = "0";
- maxChars = "-1";
- text = "Now we actually run the import of the files and content. This will process the original files into assets, and updating any references in scripts to utilize the new AssetIDs.";
- useURLMouseCursor = "0";
- useTypeOverTime = "0";
- typeOverTimeSpeedMS = "10";
- typeoutSoundRate = "-1";
- position = "23 21";
- extent = "328 42";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "ToolsGuiMLTextProfile";
- visible = "1";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "0";
- canSave = "1";
- canSaveDynamicFields = "0";
- };
- new GuiMLTextCtrl() {
- lineSpacing = "2";
- allowColorChars = "0";
- maxChars = "-1";
- text = "Processing...";
- useURLMouseCursor = "0";
- useTypeOverTime = "0";
- typeOverTimeSpeedMS = "10";
- typeoutSoundRate = "-1";
- position = "64 141";
- extent = "245 14";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "ToolsGuiDefaultProfile";
- visible = "1";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "0";
- internalName = "processingText";
- canSave = "1";
- canSaveDynamicFields = "0";
- };
- };
- new GuiContainer(ProjectImportWizardPage6) {
- margin = "0 0 0 0";
- padding = "0 0 0 0";
- anchorTop = "1";
- anchorBottom = "0";
- anchorLeft = "1";
- anchorRight = "0";
- position = "1 1";
- extent = "365 429";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "GuiDefaultProfile";
- visible = "0";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "1";
- internalName = "page6";
- hidden = "1";
- canSave = "1";
- canSaveDynamicFields = "0";
-
- new GuiMLTextCtrl() {
- lineSpacing = "2";
- allowColorChars = "0";
- maxChars = "-1";
- text = "We\'ll now go through and process any script files to ensure they use the currently designated extension.";
- useURLMouseCursor = "0";
- useTypeOverTime = "0";
- typeOverTimeSpeedMS = "10";
- typeoutSoundRate = "-1";
- position = "23 21";
- extent = "328 28";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "ToolsGuiMLTextProfile";
- visible = "1";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "0";
- canSave = "1";
- canSaveDynamicFields = "0";
- };
- new GuiMLTextCtrl() {
- lineSpacing = "2";
- allowColorChars = "0";
- maxChars = "-1";
- text = "Processing...";
- useURLMouseCursor = "0";
- useTypeOverTime = "0";
- typeOverTimeSpeedMS = "10";
- typeoutSoundRate = "-1";
- position = "64 141";
- extent = "245 14";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "ToolsGuiDefaultProfile";
- visible = "1";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "0";
- internalName = "processingText";
- canSave = "1";
- canSaveDynamicFields = "0";
- };
- };
- new GuiContainer(ProjectImportWizardPage7) {
- margin = "0 0 0 0";
- padding = "0 0 0 0";
- anchorTop = "1";
- anchorBottom = "0";
- anchorLeft = "1";
- anchorRight = "0";
- position = "1 1";
- extent = "365 429";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "GuiDefaultProfile";
- visible = "0";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "1";
- internalName = "page7";
- hidden = "1";
- canSave = "1";
- canSaveDynamicFields = "0";
-
- new GuiMLTextCtrl() {
- lineSpacing = "2";
- allowColorChars = "0";
- maxChars = "-1";
- text = "And with that, your legacy project content has been imported in as a Torque3D 4.0 ready module!";
- useURLMouseCursor = "0";
- useTypeOverTime = "0";
- typeOverTimeSpeedMS = "10";
- typeoutSoundRate = "-1";
- position = "23 141";
- extent = "328 28";
- minExtent = "8 2";
- horizSizing = "right";
- vertSizing = "bottom";
- profile = "ToolsGuiMLTextProfile";
- visible = "1";
- active = "1";
- tooltipProfile = "GuiToolTipProfile";
- hovertime = "1000";
- isContainer = "0";
- canSave = "1";
- canSaveDynamicFields = "0";
- };
- };
+ new GuiMLTextCtrl() {
+ lineSpacing = "2";
+ allowColorChars = "0";
+ maxChars = "-1";
+ text = "And with that, your legacy project content has been imported in as a Torque3D-ready module!";
+ useURLMouseCursor = "0";
+ position = "119 173";
+ extent = "328 28";
+ minExtent = "8 2";
+ horizSizing = "right";
+ vertSizing = "bottom";
+ profile = "ToolsGuiMLTextProfile";
+ visible = "0";
+ active = "1";
+ tooltipProfile = "GuiToolTipProfile";
+ hovertime = "1000";
+ isContainer = "0";
+ hidden = "1";
+ canSave = "1";
+ canSaveDynamicFields = "0";
};
};
};
@@ -956,32 +611,6 @@ $guiContent = new GuiControl(ProjectImportCtrl) {
canSave = "1";
canSaveDynamicFields = "0";
};
- new GuiBitmapButtonCtrl() {
- bitmapAsset = "ToolsModule:iconInformation_image";
- bitmapMode = "Centered";
- autoFitExtents = "0";
- useModifiers = "0";
- useStates = "1";
- masked = "0";
- groupNum = "-1";
- buttonType = "PushButton";
- useMouseEvents = "0";
- position = "-187 555";
- extent = "22 22";
- minExtent = "8 2";
- horizSizing = "left";
- vertSizing = "bottom";
- profile = "ToolsGuiButtonProfile";
- visible = "1";
- active = "1";
- command = "ImportAssetWindow.toggleLogWindow();";
- tooltipProfile = "GuiToolTipProfile";
- tooltip = "View Import Log";
- hovertime = "1000";
- isContainer = "0";
- canSave = "1";
- canSaveDynamicFields = "0";
- };
};
};
//--- OBJECT WRITE END ---
diff --git a/Templates/BaseGame/game/tools/projectImporter/importers/pre40/T3Dpre4ProjectImporter.tscript b/Templates/BaseGame/game/tools/projectImporter/importers/pre40/T3Dpre4ProjectImporter.tscript
new file mode 100644
index 000000000..693d22a6c
--- /dev/null
+++ b/Templates/BaseGame/game/tools/projectImporter/importers/pre40/T3Dpre4ProjectImporter.tscript
@@ -0,0 +1,1376 @@
+function T3Dpre4ProjectImporter::init()
+{
+ //register this importer option to the project importer listing
+ if(isObject(T3Dpre4ProjectImporter))
+ T3Dpre4ProjectImporter.delete();
+
+ new ScriptObject(T3Dpre4ProjectImporter);
+
+ //Now we register the importer so it shows in the listing
+ $ProjectImporter::importerList.add("Pre-4.0 T3D Project", T3Dpre4ProjectImporter);
+
+ %result = AssetDatabase.acquireAsset("ToolsModule:pre40ImporterGuis");
+}
+
+T3Dpre4ProjectImporter::init(); //kick off the setup
+
+function T3Dpre4ProjectImporter::setupPages(%this)
+{
+ ProjectImportWindow.addImporterPage(Pre40ImporterPage0);
+ ProjectImportWindow.addImporterPage(Pre40ImporterPage1);
+
+ ProjectImportWindow.refreshPage();
+}
+
+//
+//
+function T3Dpre4ProjectImporter::setupModule(%this)
+{
+ %newModuleName = $ProjectImporter::moduleName;
+
+ projectImporterLog("Setup up Module named: " @ %newModuleName);
+
+ %moduleFilePath = "data/" @ %newModuleName;
+ %moduleDefinitionFilePath = %moduleFilePath @ "/" @ %newModuleName @ ".module";
+ %moduleScriptFilePath = %moduleFilePath @ "/" @ %newModuleName @ "." @ $TorqueScriptFileExtension;
+
+ if(!isImportingFile($ProjectImporter::sourceContentFolder @ "/" @ %newModuleName @ ".module"))
+ {
+ %newModule = new ModuleDefinition()
+ {
+ ModuleId = %newModuleName;
+ versionId = 1;
+ ScriptFile = %newModuleName @ "." @ $TorqueScriptFileExtension;
+ CreateFunction="onCreate";
+ DestroyFunction="onDestroy";
+ Group = "Game";
+
+ new DeclaredAssets()
+ {
+ Extension = "asset.taml";
+ Recurse = true;
+ };
+ };
+
+ TAMLWrite(%newModule, %moduleDefinitionFilePath);
+ }
+
+ //if we don't already have a incoming file that matches this, then we'll want to make a new one
+ if(!isImportingFile($ProjectImporter::sourceContentFolder @ "/" @ %newModuleName @ ".cs") &&
+ !isImportingFile($ProjectImporter::sourceContentFolder @ "/" @ %newModuleName @ "." @ $TorqueScriptFileExtension))
+ {
+ //Now generate the script file for it
+ %file = new FileObject();
+ %templateFile = new FileObject();
+
+ %moduleTemplateCodeFilePath = AssetBrowser.templateFilesPath @ "module.tscript.template";
+
+ if(%file.openForWrite(%moduleScriptFilePath) && %templateFile.openForRead(%moduleTemplateCodeFilePath))
+ {
+ while( !%templateFile.isEOF() )
+ {
+ %line = %templateFile.readline();
+ %line = strreplace( %line, "@@", %newModuleName );
+
+ %file.writeline(%line);
+ //projectImporterLog(%line);
+ }
+
+ %file.close();
+ %templateFile.close();
+ }
+ else
+ {
+ %file.close();
+ %templateFile.close();
+
+ projectImporterLog("CreateNewModule - Something went wrong and we couldn't write the script file!");
+ }
+ }
+
+ //force a refresh of our modules list
+ ModuleDatabase.ignoreLoadedGroups(true);
+ ModuleDatabase.scanModules( "data", false );
+ %success = ModuleDatabase.loadExplicit(%newModuleName, 1);
+ ModuleDatabase.ignoreLoadedGroups(false);
+
+ //force a reload of the Module lists
+ AssetBrowser.refresh();
+}
+
+/*function T3Dpre4ProjectImporter::copyFiles(%this)
+{
+ %currentPage = ProjectImportWindow.getCurrentPage();
+
+ %currentPage-->fileCopyText.setText("Beginning copy of files to new module folder now. This may take a few minutes...");
+ Canvas.repaint();
+
+ %file = findFirstFileMultiExpr( $ProjectImporter::sourceContentFolder @ "/*.*", true);
+
+ while( %file !$= "" )
+ {
+ %filePath = filePath(%file);
+ %fileName = fileName(%file);
+ %fileBase = fileBase(%file);
+ %fileExt = fileExt(%file);
+
+ if(endsWith(%fileName, ".asset.taml"))
+ {
+ %fileBase = strreplace(%fileBase, ".asset", "");
+ %fileExt = ".asset.taml";
+ }
+
+ if(%fileExt $= ".dll" || %fileExt $= ".log" || %fileExt $= ".exe" || %fileExt $= ".manifest"|| %fileExt $= ".h" ||
+ %fileExt $= ".cpp" || %fileExt $= ".so" || %fileExt $= ".do" || %fileExt $= ".lib" ||%fileExt $= ".exp")
+ {
+ %file = findNextFileMultiExpr( $ProjectImporter::sourceContentFolder @ "/*.*" );
+ continue;
+ }
+
+ //filter out some unneeded folders
+ %slashCount = getTokenCount(%filePath, "/");
+ %topFolder = getToken(%filePath, "/", %slashCount-1);
+ if(%topFolder $= "")
+ %topFolder = getToken(%filePath, "/", %slashCount-2);
+
+ if(%topFolder $= "creator" || %topFolder $= "tools" || %topFolder $= "web")
+ {
+ %file = findNextFileMultiExpr( $ProjectImporter::sourceContentFolder @ "/*.*" );
+ continue;
+ }
+
+ %targetFilePath = strReplace(%file, $ProjectImporter::sourceContentFolder, $ProjectImporter::modulePath);
+
+ %sanitizedFilename = sanitizeString(%fileBase);
+ if(startsWith(%sanitizedFilename, "_"))
+ {
+ %sanitizedFilename = substr(%sanitizedFilename, 1, -1);
+ }
+ if(%sanitizedFilename !$= %fileBase)
+ {
+ %targetFilePath = filePath(%targetFilePath) @ "/" @ %sanitizedFilename @ %fileExt;
+ }
+
+ %targetFolder = filePath(%targetFilePath);
+
+ if(!isDirectory(%targetFolder))
+ {
+ DirectoryHandler::createFolder(0, %targetFolder);
+ }
+
+ if(!pathCopy(%file, %targetFilePath, false))
+ {
+ projectImporterLog("Legacy Project Importer, failed to copy file: " @ %file @ " to destination: " @ %targetFilePath);
+ }
+
+ %file = findNextFileMultiExpr( $ProjectImporter::sourceContentFolder @ "/*.*" );
+ }
+
+ //
+ //Now that we've done that, we'll load and scan the module for asset defs
+ %file = findFirstFileMultiExpr( $ProjectImporter::modulePath @ "/*.asset.taml", true);
+
+ while( %file !$= "" )
+ {
+ %moduleName = AssetBrowser.dirHandler.getModuleFromAddress(%file).ModuleId;
+ %moduleDef = ModuleDatabase.findModule(%moduleName, 1);
+
+ AssetDatabase.addDeclaredAsset(%moduleDef, %file);
+
+ %file = findNextFileMultiExpr( $ProjectImporter::modulePath @ "/*.asset.taml" );
+ }
+ //
+
+ %currentPage-->fileCopyText.setValue("File copy done! Press Next to continue.");
+
+ ProjectImportWindow-->nextButton.setActive(true);
+ Canvas.repaint();
+}
+
+function T3Dpre4ProjectImporter::processImportedFiles(%this)
+{
+ if($ProjectImporter::importMode $= "CoreAndTools")
+ {
+ $ProjectImporter::modulePath = "Core";
+ %this.doImport();
+
+ $ProjectImporter::modulePath = "Tools";
+ %this.doImport();
+ }
+ else
+ {
+ %this.doImport();
+ }
+
+ %currentPage = ProjectImportWindow.getCurrentPage();
+
+ %currentPage-->processingText.setText("Processing of files done! Press Next to continue.");
+ ProjectImportWindow-->nextButton.setActive(true);
+ Canvas.repaint();
+}*/
+
+function T3Dpre4ProjectImporter::doContentImport(%this)
+{
+ //Store off the current default import config
+ %this.defaultConfig = EditorSettings.value("Assets/AssetImporDefaultConfig", "");
+ EditorSettings.setValue("Assets/AssetImporDefaultConfig", "LegacyProjectImport");
+
+ //Update asset content
+ beginImageImport();
+
+ %this.beginMaterialFilesImport();
+
+ beginShapeImport();
+ beginTerrainImport();
+
+ %this.beginSoundProfilesImport();
+}
+
+function T3Dpre4ProjectImporter::doScriptImport(%this)
+{
+ beginLevelImport();
+ beginGUIImport();
+
+ %this.beginScriptFilesImport();
+
+ %this.beginAssetAndModuleImport();
+
+ %this.writeImportingFiles();
+
+ EditorSettings.setValue("Assets/AssetImporDefaultConfig", %this.defaultConfig);
+}
+
+function T3Dpre4ProjectImporter::writeImportingObject(%this, %arrayObj)
+{
+ if(!isObject(%arrayObj) || %arrayObj.skip)
+ return;
+
+ for(%i=0; %i < %arrayObj.count(); %i++)
+ {
+ %objectLine = %arrayObj.getKey(%i);
+ if(isObject(%objectLine))
+ {
+ if(%objectLine.skip == false)
+ {
+ %this.writeImportingObject(%objectLine);
+ }
+ }
+ else
+ {
+ $ProjectImporter::fileObject.writeLine(%objectLine);
+ }
+ }
+}
+
+function T3Dpre4ProjectImporter::writeImportingFiles(%this)
+{
+ //First, we need to go through and process all loose image files. This will
+ //get us shape assets, and if the import config deigns, material assets.
+ %currentAddress = $ProjectImporter::modulePath;
+
+ for(%i=0; %i < $ProjectImporter::FileList.count(); %i++)
+ {
+ %file = $ProjectImporter::FileList.getKey(%i);
+ %rootFileSectionObject = $ProjectImporter::FileList.getValue(%i);
+
+ if(!%rootFileSectionObject.skip && !%rootFileSectionObject.binaryFile)
+ {
+ %path = filePath(%rootFileSectionObject.fileDestination);
+
+ if(!IsDirectory(%path))
+ {
+ DirectoryHandler::createFolder(0, %path);
+ }
+
+ if ( $ProjectImporter::fileObject.openForWrite( %rootFileSectionObject.fileDestination ) )
+ {
+ %this.writeImportingObject(%rootFileSectionObject);
+
+ $ProjectImporter::fileObject.close();
+ }
+ }
+
+ if($ProjectImporter::useExistingModule)
+ {
+ //clean up legact files if they've been renamed or whatnot
+ if(%file !$= %rootFileSectionObject.fileDestination)
+ {
+ fileDelete(%file);
+ }
+ }
+ }
+}
+
+//
+function T3Dpre4ProjectImporter::processMaterialObjects(%this, %arrayObj)
+{
+ if(!isObject(%arrayObj))
+ return;
+
+ //We only really care about materials for this
+ if(%arrayObj.elementType $= "function" ||
+ (%arrayObj.elementType $= "Object" && %arrayObj.classType !$= "Material" && %arrayObj.classType !$= "CustomMaterial"))
+ {
+ return;
+ }
+
+ for(%e=0; %e < %arrayObj.count(); %e++)
+ {
+ %lineObj = %arrayObj.getKey(%e);
+ if(isObject(%lineObj))
+ {
+ if( %lineObj.elementType $= "Object")
+ {
+ if(%lineObj.classType $= "Material" || %lineObj.classType $= "CustomMaterial")
+ {
+ %materialName = %lineObj.objectName;
+ if(%materialName $= "")
+ {
+ %mapToName = findObjectField(%lineObj, "mapTo");
+ %lineObj.objectName = %mapToName @ "_mat";
+ }
+
+ %sanitizedName = sanitizeString(%materialName);
+ if(startsWith(%sanitizedName, "_"))
+ {
+ %sanitizedName = getSubStr(%sanitizedName, 1, -1);
+ }
+
+ projectImporterLog("processMaterialObjects() - beginning processing of material: " @ %sanitizedName);
+
+ if(%lineObj.objectName !$= %sanitizedName)
+ renameObjectName(%lineObj, %sanitizedName);
+
+ //Now, we process the fields to be asset-ified on our object
+ for(%l=0; %l < %lineObj.count(); %l++)
+ {
+ %objectCodeLine = %lineObj.getKey(%l);
+ if(!isObject(%objectCodeLine))
+ {
+ %resultLine = T3Dpre4ProjectImporter.processMaterialLine(%objectCodeLine);
+ if(%resultLine !$= %objectCodeLine)
+ {
+ projectImporterLog(" processed line: " @ %resultLine @ " from: " @ %objectCodeLine);
+ %lineObj.setKey(%resultLine, %l);
+ }
+ }
+ }
+
+ //This walks through the class heirarchy so in the event we get a
+ //class that has a shared common root class like with water or materials
+ //we can process with that class to cover the probability space
+
+ %inheritanceList = getClassHierarchy(%lineObj.classType);
+ for (%classDepth = 0; %classDepth < getWordCount(%inheritanceList); %classDepth++)
+ {
+ %subclass = getWord(%inheritanceList, %classDepth);
+ %processFunction = "process" @ %subclass @ "Object";
+ if(T3Dpre4ProjectImporter.isMethod(%processFunction))
+ {
+ T3Dpre4ProjectImporter.call(%processFunction, %lineObj, %sanitizedName);
+ }
+ }
+ }
+ else if(%lineObj.classType $= "TerrainMaterial")
+ {
+ %intName = findObjectField(%lineObj, "internalName");
+ %materialName = %intName @ "_terrainMat";
+
+ %sanitizedName = sanitizeString(%materialName);
+ if(startsWith(%sanitizedName, "_"))
+ {
+ %sanitizedName = getSubStr(%sanitizedName, 1, -1);
+ }
+
+ if(%intName !$= %sanitizedName)
+ setObjectField(%lineObj, "internalName", %sanitizedName);
+
+ //Now, we process the fields to be asset-ified on our object
+ for(%l=0; %l < %lineObj.count(); %l++)
+ {
+ %objectCodeLine = %lineObj.getKey(%l);
+ if(!isObject(%objectCodeLine))
+ {
+ %resultLine = T3Dpre4ProjectImporter.processTerrainMaterialLine(%objectCodeLine);
+ if(%resultLine !$= %objectCodeLine)
+ {
+ projectImporterLog(" processed line: " @ %resultLine @ " from: " @ %objectCodeLine);
+ %lineObj.setKey(%resultLine, %l);
+ }
+ }
+ }
+
+ //This walks through the class heirarchy so in the event we get a
+ //class that has a shared common root class like with water or materials
+ //we can process with that class to cover the probability space
+
+ %inheritanceList = getClassHierarchy(%lineObj.classType);
+ for (%classDepth = 0; %classDepth < getWordCount(%inheritanceList); %classDepth++)
+ {
+ %subclass = getWord(%inheritanceList, %classDepth);
+ %processFunction = "process" @ %subclass @ "Object";
+ if(T3Dpre4ProjectImporter.isMethod(%processFunction))
+ {
+ T3Dpre4ProjectImporter.call(%processFunction, %lineObj, %sanitizedName);
+ }
+ }
+ }
+ else
+ {
+ continue;
+ }
+ /**/
+ %oN = %lineObj.objectName;
+
+ %lineObj.processed = true;
+ %lineObj.skip = true;
+ }
+
+ //Recurse down as needed
+ %this.processMaterialObjects(%lineObj);
+ }
+ }
+}
+
+function T3Dpre4ProjectImporter::beginMaterialFilesImport(%this)
+{
+ projectImporterLog("===========================================");
+ projectImporterLog("Importing Material definitions");
+ projectImporterLog("===========================================");
+
+ for(%i=0; %i < $ProjectImporter::FileList.count(); %i++)
+ {
+ %file = $ProjectImporter::FileList.getKey(%i);
+ %rootFileSectionObject = $ProjectImporter::FileList.getValue(%i);
+
+ $ProjectImporter::currentFilePath = filePath(%rootFileSectionObject.fileDestination) @ "/"; //give context to the file we're processing
+
+ if(%rootFileSectionObject.binaryFile == true || %rootFileSectionObject.imported == true)
+ continue;
+
+ %this.processMaterialObjects(%rootFileSectionObject);
+ }
+
+ projectImporterLog("===========================================");
+ projectImporterLog("Importing Material definitions finished");
+ projectImporterLog("===========================================");
+}
+
+//
+function T3Dpre4ProjectImporter::processSoundProfileObjects(%this, %arrayObj)
+{
+ if(!isObject(%arrayObj))
+ return;
+
+ //We only really care about materials for this
+ if((%arrayObj.elementType $= "Object" && %arrayObj.classType !$= "SFXProfile"))
+ {
+ return;
+ }
+
+ for(%e=0; %e < %arrayObj.count(); %e++)
+ {
+ %lineObj = %arrayObj.getKey(%e);
+ if(isObject(%lineObj))
+ {
+ if( %lineObj.elementType $= "Object")
+ {
+ if(%lineObj.classType $= "SFXProfile")
+ {
+ %profileName = %lineObj.objectName;
+
+ %sanitizedName = sanitizeString(%profileName);
+ if(startsWith(%sanitizedName, "_"))
+ {
+ %sanitizedName = getSubStr(%sanitizedName, 1, -1);
+ }
+
+ projectImporterLog("processSoundProfileObjects() - beginning processing of SFXProfile: " @ %sanitizedName);
+
+ if(%lineObj.objectName !$= %sanitizedName)
+ renameObjectName(%lineObj, %sanitizedName);
+
+ //This walks through the class heirarchy so in the event we get a
+ //class that has a shared common root class like with water or materials
+ //we can process with that class to cover the probability space
+ %inheritanceList = getClassHierarchy(%lineObj.classType);
+ for (%classDepth = 0; %classDepth < getWordCount(%inheritanceList); %classDepth++)
+ {
+ %subclass = getWord(%inheritanceList, %classDepth);
+ %processFunction = "process" @ %subclass @ "Object";
+ if(T3Dpre4ProjectImporter.isMethod(%processFunction))
+ {
+ T3Dpre4ProjectImporter.call(%processFunction, %lineObj, %sanitizedName);
+ }
+ }
+
+ //Now, we process the fields to be asset-ified on our object
+ for(%l=0; %l < %lineObj.count(); %l++)
+ {
+ %objectCodeLine = %lineObj.getKey(%l);
+ if(!isObject(%objectCodeLine))
+ {
+ %resultLine = T3Dpre4ProjectImporter.processSFXProfileLine(%objectCodeLine);
+ if(%resultLine !$= %objectCodeLine)
+ {
+ projectImporterLog(" processed line: " @ %resultLine @ " from: " @ %objectCodeLine);
+ %lineObj.setKey(%resultLine, %l);
+ }
+ }
+ }
+ }
+ else
+ {
+ continue;
+ }
+
+ %lineObj.processed = true;
+ %lineObj.skip = true;
+ }
+
+ //Recurse down as needed
+ %this.processSoundProfileObjects(%lineObj);
+ }
+ }
+}
+
+function T3Dpre4ProjectImporter::beginSoundProfilesImport(%this)
+{
+ projectImporterLog("===========================================");
+ projectImporterLog("Importing Sound Profiles");
+ projectImporterLog("===========================================");
+
+ for(%i=0; %i < $ProjectImporter::FileList.count(); %i++)
+ {
+ %file = $ProjectImporter::FileList.getKey(%i);
+ %rootFileSectionObject = $ProjectImporter::FileList.getValue(%i);
+
+ $ProjectImporter::currentFilePath = filePath(%rootFileSectionObject.fileDestination) @ "/"; //give context to the file we're processing
+
+ if(%rootFileSectionObject.binaryFile == true || %rootFileSectionObject.imported == true)
+ continue;
+
+ %this.processSoundProfileObjects(%rootFileSectionObject);
+ }
+
+ projectImporterLog("===========================================");
+ projectImporterLog("Importing Sound Profiles finished");
+ projectImporterLog("===========================================");
+}
+
+//
+function T3Dpre4ProjectImporter::processScripts(%this, %arrayObj)
+{
+ if(!isObject(%arrayObj))
+ return;
+
+ //We only really care about materials for this
+ if((%arrayObj.elementType $= "Object" && (%arrayObj.classType $= "Material" || %arrayObj.classType $= "CustomMaterial" || %arrayObj.classType $= "TerrainMaterial")))
+ {
+ return;
+ }
+
+ for(%e=0; %e < %arrayObj.count(); %e++)
+ {
+ %lineObj = %arrayObj.getKey(%e);
+ if(isObject(%lineObj) && !%lineObj.skip)
+ {
+ if( %lineObj.elementType $= "Object")
+ {
+ %sanitizedName = sanitizeString(%lineObj.objectName);
+ if(startsWith(%sanitizedName, "_"))
+ {
+ %sanitizedName = getSubStr(%sanitizedName, 1, -1);
+ }
+
+ if(%sanitizedName !$= "")
+ projectImporterLog("processScriptObjects() - beginning processing of object: " @ %lineObj.classType @ "(" @ %sanitizedName @ ")");
+ else
+ projectImporterLog("processScriptObjects() - beginning processing of object: " @ %lineObj.classType @ "()");
+
+ if(%lineObj.objectName !$= %sanitizedName && %lineObj.objectName !$= "")
+ renameObjectName(%lineObj, %sanitizedName);
+
+ //This walks through the class heirarchy so in the event we get a
+ //class that has a shared common root class like with water or materials
+ //we can process with that class to cover the probability space
+
+ %inheritanceList = getClassHierarchy(%lineObj.classType);
+ for (%classDepth = 0; %classDepth < getWordCount(%inheritanceList); %classDepth++)
+ {
+ %subclass = getWord(%inheritanceList, %classDepth);
+ %processFunction = "process" @ %subclass @ "Object";
+
+ if(T3Dpre4ProjectImporter.isMethod(%processFunction))
+ {
+ T3Dpre4ProjectImporter.call(%processFunction, %lineObj, %sanitizedName);
+ }
+
+ //Now, we process the fields to be asset-ified on our object
+ for(%l=0; %l < %lineObj.count(); %l++)
+ {
+ %objectCodeLine = %lineObj.getKey(%l);
+ if(!isObject(%objectCodeLine))
+ {
+ %processLineFunction = "process" @ %subclass @ "Line";
+ if(T3Dpre4ProjectImporter.isMethod(%processLineFunction))
+ {
+ %resultLine = T3Dpre4ProjectImporter.call(%processLineFunction, %objectCodeLine);
+
+ if(%resultLine !$= %objectCodeLine)
+ {
+ projectImporterLog(" processed line: " @ %resultLine @ " from: " @ %objectCodeLine);
+ %lineObj.setKey(%resultLine, %l);
+ }
+ }
+ }
+ }
+ }
+
+ %lineObj.processed = true;
+ }
+ else if(%lineObj.elementType $= "function")
+ {
+ //Now, we process the fields to be asset-ified on our object
+ for(%l=0; %l < %lineObj.count(); %l++)
+ {
+ %functionCodeLine = %lineObj.getKey(%l);
+ if(!isObject(%functionCodeLine))
+ {
+ %resultLine = %functionCodeLine;
+
+ if(strIsMatchExpr("*exec(*.cs*)*", %functionCodeLine) || strIsMatchExpr("*exec(*.tscript*)*", %functionCodeLine))
+ {
+ %scriptExtRemovedLine = strReplace(%functionCodeLine, ".cs", "");
+ %scriptExtRemovedLine = strReplace(%scriptExtRemovedLine, ".tscript", "");
+ %resultLine = %scriptExtRemovedLine;
+ }
+ else if(strIsMatchExpr("*queueexec(*.cs*)*", %functionCodeLine) || strIsMatchExpr("*queueexec(*.tscript*)*", %functionCodeLine))
+ {
+ %scriptExtRemovedLine = strReplace(%functionCodeLine, ".cs", "");
+ %scriptExtRemovedLine = strReplace(%scriptExtRemovedLine, ".tscript", "");
+ %resultLine = %scriptExtRemovedLine;
+ }
+ else if(strIsMatchExpr("*registerDatablock(*.cs*)*", %functionCodeLine) || strIsMatchExpr("*registerDatablock(*.tscript*)*", %functionCodeLine))
+ {
+ %scriptExtRemovedLine = strReplace(%functionCodeLine, ".cs", "");
+ %scriptExtRemovedLine = strReplace(%scriptExtRemovedLine, ".tscript", "");
+ %resultLine = %scriptExtRemovedLine;
+ }
+ else if(strIsMatchExpr("*%this.addSequence(\"*);", %functionCodeLine))
+ {
+ %resultLine = processLegacyShapeConstructorField(%functionCodeLine);
+ }
+
+ if(%resultLine !$= %functionCodeLine)
+ {
+ %lineObj.setKey(%resultLine, %l);
+ }
+ }
+ }
+
+ %lineObj.processed = true;
+ }
+
+ //Recurse down as needed
+ %this.processScripts(%lineObj);
+ }
+ }
+}
+
+function T3Dpre4ProjectImporter::beginScriptFilesImport(%this)
+{
+ //First, we need to go through and process all loose image files. This will
+ //get us shape assets, and if the import config deigns, material assets.
+ %currentAddress = $ProjectImporter::modulePath;
+
+ for(%i=0; %i < $ProjectImporter::FileList.count(); %i++)
+ {
+ %file = $ProjectImporter::FileList.getKey(%i);
+ %rootFileSectionObject = $ProjectImporter::FileList.getValue(%i);
+ //%file = %rootFileSectionObject.fileDestination;
+
+ //if(%rootFileSectionObject.imported == true)
+ // continue;
+
+ %filename = %rootFileSectionObject.fileName;
+ %fileExt = %rootFileSectionObject.fileExt;
+ %fileBase = %rootFileSectionObject.fileBase;
+ %filePath = filePath(%file);
+
+ if(%fileExt !$= ".cs" &&
+ %fileExt !$= ".tscript" &&
+ %fileExt !$= ".mis" &&
+ %fileExt !$= ".gui" &&
+ %fileExt !$= ".prefab")
+ {
+ continue;
+ }
+
+ $ProjectImporter::currentFilePath = filePath(%rootFileSectionObject.fileDestination) @ "/";
+
+ projectImporterLog("T3Dpre4ProjectImporter::beginScriptFilesImport() - Processing script file: " @ %file);
+ %this.processScripts(%rootFileSectionObject);
+ }
+
+ projectImporterLog("Legacy Project Importer - Processing of imported code files done!");
+}
+
+//
+function T3Dpre4ProjectImporter::processModuleFile(%this, %moduleObj)
+{
+ if(!isObject(%moduleObj))
+ return;
+
+ %moduleObj.echo();
+
+ //really, we only care here about ensuring the file extensions are cleaned up
+ for(%l=0; %l < %moduleObj.count(); %l++)
+ {
+ %line = %moduleObj.getKey(%l);
+ if(strIsMatchExpr("*.cs\"", %line))
+ {
+ %resultLine = strReplace(%line, ".cs\"", "\"");
+ %moduleObj.setKey(%resultLine, %l);
+ }
+ }
+}
+
+function T3Dpre4ProjectImporter::processAssetFile(%this, %assetObj)
+{
+ if(!isObject(%assetObj))
+ return;
+
+ %assetObj.echo();
+
+ //really, we only care here about ensuring the file extensions are cleaned up
+ for(%l=0; %l < %assetObj.count(); %l++)
+ {
+ %line = %assetObj.getKey(%l);
+ if(strIsMatchExpr("*.cs\"", %line))
+ {
+ %resultLine = strReplace(%line, ".cs\"", "\"");
+ %assetObj.setKey(%resultLine, %l);
+ }
+ }
+}
+
+function T3Dpre4ProjectImporter::beginAssetAndModuleImport(%this)
+{
+ //First, we need to go through and process all loose image files. This will
+ //get us shape assets, and if the import config deigns, material assets.
+ %currentAddress = $ProjectImporter::modulePath;
+
+ for(%i=0; %i < $ProjectImporter::FileList.count(); %i++)
+ {
+ %file = $ProjectImporter::FileList.getKey(%i);
+ %rootFileSectionObject = $ProjectImporter::FileList.getValue(%i);
+
+ %filename = %rootFileSectionObject.fileName;
+ %fileExt = %rootFileSectionObject.fileExt;
+ %fileBase = %rootFileSectionObject.fileBase;
+ %filePath = filePath(%file);
+
+ if(%fileExt $= ".module")
+ {
+ projectImporterLog("T3Dpre4ProjectImporter::beginAssetAndModuleImport() - processing file: " @ %file);
+ $ProjectImporter::currentFilePath = filePath(%rootFileSectionObject.fileDestination) @ "/";
+ %this.processModuleFile(%rootFileSectionObject);
+ %rootFileSectionObject.processed = true;
+ }
+ else if(%fileExt $= ".asset.taml")
+ {
+ projectImporterLog("T3Dpre4ProjectImporter::beginAssetAndModuleImport() - processing file: " @ %file);
+ $ProjectImporter::currentFilePath = filePath(%rootFileSectionObject.fileDestination) @ "/";
+ %this.processAssetFile(%rootFileSectionObject);
+ %rootFileSectionObject.processed = true;
+ }
+ }
+
+ projectImporterLog("Legacy Project Importer - Processing of imported asset and module files done!");
+}
+
+//To implement a custom class to have it's fields processed, just utilize this template function
+//and replace the class/field spaces as appropriate
+/*
+function T3Dpre4ProjectImporter::processLine(%this, %line)
+{
+ %outLine = processLegacyField(%line, "", "");
+
+ if(%outLine !$= %line)
+ return %outLine;
+ else
+ return %line;
+}
+*/
+//==============================================================================
+// Misc Object Classes
+//==============================================================================
+function T3Dpre4ProjectImporter::genProcessor(%classType, %conversionMap)
+{
+ %stryng = "function T3Dpre4ProjectImporter::process" @%classType@ "Line(%this, %line){\n";
+ %count = getWordCount(%conversionMap);
+ for (%i = 0; %i<%count; %i+=2)
+ {
+ %stryng = %stryng @ " %outLine = processLegacyField(%line,\""@ getWord(%conversionMap,%i)@ "\",\""@ getWord(%conversionMap,%i+1)@"\");\n";
+ %stryng = %stryng @ " if(%outLine !$= %line) return %outLine;\n";
+ }
+ %stryng = %stryng @ " return %line;\n}";
+ eval(%stryng);
+}
+
+T3Dpre4ProjectImporter::genProcessor("TSShapeConstructor", "baseShape baseShapeAsset shapeName shapeAsset");
+T3Dpre4ProjectImporter::genProcessor("BasicClouds", "texture textureAsset");
+T3Dpre4ProjectImporter::genProcessor("CloudLayer", "texture textureAsset");
+T3Dpre4ProjectImporter::genProcessor("DecalRoad", "material materialAsset");
+T3Dpre4ProjectImporter::genProcessor("MeshRoad", "topMaterial topMaterialAsset bottomMaterial bottomMaterialAsset sideMaterial sideMaterialAsset");
+T3Dpre4ProjectImporter::genProcessor("ScatterSky", "moonMat moonMatAsset");
+T3Dpre4ProjectImporter::genProcessor("Sun", "coronaMaterial coronaMaterialAsset");
+T3Dpre4ProjectImporter::genProcessor("VolumetricFog", "shape ShapeAsset texture textureAsset");
+T3Dpre4ProjectImporter::genProcessor("WaterObject", "rippleTex rippleTexAsset foamTex foamTexAsset depthGradientTex depthGradientTexAsset");
+T3Dpre4ProjectImporter::genProcessor("ConvexShape", "material materialAsset");
+T3Dpre4ProjectImporter::genProcessor("RenderMesh", "material materialAsset");
+T3Dpre4ProjectImporter::genProcessor("RenderShape", "shape shapeAsset");
+T3Dpre4ProjectImporter::genProcessor("GroundCover", "material materialAsset shape shapeAsset shapeFilename shapeAsset");
+T3Dpre4ProjectImporter::genProcessor("GroundPlane", "material materialAsset");
+T3Dpre4ProjectImporter::genProcessor("LevelInfo", "accuTexture accuTextureAsset");
+T3Dpre4ProjectImporter::genProcessor("TSStatic", "shape shapeAsset shapeName shapeAsset");
+T3Dpre4ProjectImporter::genProcessor("TSForestItemData", "shape shapeAsset shapeName shapeAsset shapeFile shapeAsset");
+T3Dpre4ProjectImporter::genProcessor("TerrainBlock", "terrainFile terrainAsset");
+T3Dpre4ProjectImporter::genProcessor("afxMagicMissileData", "projectileShape projectileShapeAsset projectileShapeName projectileShapeAsset sound projectileSoundAsset");
+T3Dpre4ProjectImporter::genProcessor("afxBillboardData", "texture textureAsset");
+T3Dpre4ProjectImporter::genProcessor("afxModelData", "shapeName shapeAsset shapeFile shapeAsset");
+T3Dpre4ProjectImporter::genProcessor("afxZodiacData", "texture textureAsset");
+T3Dpre4ProjectImporter::genProcessor("afxZodiacPlaneData", "texture textureAsset");
+T3Dpre4ProjectImporter::genProcessor("sfxEmitter", "track soundAsset filename soundAsset");
+T3Dpre4ProjectImporter::genProcessor("LightningData", "thunderSounds ThunderSoundAsset strikeSound StrikeSoundAsset");
+//==============================================================================
+// Levels
+//==============================================================================
+function T3Dpre4ProjectImporter::processMissionGroupLine(%this, %line, %missionName)
+{
+ %outline = strreplace(%line, "SimGroup(MissionGroup)", "Scene(" @ %missionName @ ")");
+
+ if(%outLine !$= %line)
+ return %outLine;
+ else
+ return %line;
+}
+
+function T3Dpre4ProjectImporter::processLevelInfoLine(%this, %line)
+{
+ %outline = strreplace(%line, "ScriptObject(MissionInfo)", "LevelInfo(theLevelInfo)");
+
+ if(%outLine !$= %line)
+ return %outLine;
+ else
+ return %line;
+}
+
+function T3Dpre4ProjectImporter::processSkyLine(%this, %line)
+{
+ %outline = strreplace(%line, "Sky", "Skybox");
+
+ if(%outLine !$= %line)
+ return %outLine;
+ else
+ return %line;
+}
+
+function T3Dpre4ProjectImporter::processWaterLine(%this, %line)
+{
+ %outline = strreplace(%line, "Water", "WaterPlane");
+
+ if(%outLine !$= %line)
+ return %outLine;
+ else
+ return %line;
+}
+
+//==============================================================================
+// GUIs
+//==============================================================================
+T3Dpre4ProjectImporter::genProcessor("GuiIconButtonCtrl", "bitmap bitmapAsset iconBitmap bitmapAsset");
+T3Dpre4ProjectImporter::genProcessor("GuiToolboxButtonCtrl", "normalBitmap normalBitmapAsset loweredBitmap loweredBitmapAsset hoverBitmap hoverBitmapAsset");
+T3Dpre4ProjectImporter::genProcessor("GuiBitmapCtrl", "bitmap bitmapAsset");
+T3Dpre4ProjectImporter::genProcessor("GuiMaterialCtrl", "material materialAsset");
+T3Dpre4ProjectImporter::genProcessor("GuiCursor", "bitmap bitmapAsset");
+T3Dpre4ProjectImporter::genProcessor("GuiChunkedBitmapCtrl", "bitmap bitmapAsset");
+T3Dpre4ProjectImporter::genProcessor("GuiProgressBitmap", "bitmap bitmapAsset");
+T3Dpre4ProjectImporter::genProcessor("GuiMissionArea", "handleBitmap handleBitmapAsset");
+T3Dpre4ProjectImporter::genProcessor("WorldEditor", "selectHandle selectHandleAsset defaultHandle defaultHandleAsset lockedHandle lockedHandleAsset");
+T3Dpre4ProjectImporter::genProcessor("GuiControlProfile", "bitmap bitmapAsset");
+T3Dpre4ProjectImporter::genProcessor("GuiMLTextCtrl", "deniedSound deniedSoundAsset");
+
+function T3Dpre4ProjectImporter::processGuiBitmapButtonCtrlLine(%this, %line)
+{
+ %outLine = processGuiBitmapButtonCtrlField(%line, "bitmap", "bitmapAsset");
+ if(%outLine !$= %line) return %outLine;
+
+ return %line;
+}
+
+//==============================================================================
+// Datablocks
+//==============================================================================
+T3Dpre4ProjectImporter::genProcessor("ForestItemData", "shape shapeAsset");
+T3Dpre4ProjectImporter::genProcessor("CubeMapData", "cubemapFace cubeMapFaceAsset cubemap cubemapAsset cubeFace cubeMapFaceAsset");
+T3Dpre4ProjectImporter::genProcessor("DebrisData", "shape shapeAsset shapeFile shapeAsset");
+T3Dpre4ProjectImporter::genProcessor("DecalData", "material materialAsset");
+T3Dpre4ProjectImporter::genProcessor("ExplosionData", "explosionShape explosionShapeAsset");
+T3Dpre4ProjectImporter::genProcessor("ParticleData", "texture textureAsset textureName textureAsset textureExt textureExtAsset textureExtName textureExtAsset");
+T3Dpre4ProjectImporter::genProcessor("PrecipitationData", "drop dropAsset dropTexture dropAsset splash splashAsset splashTexture splashAsset soundProfile soundAsset");
+T3Dpre4ProjectImporter::genProcessor("SplashData", "texture textureAsset soundProfile SoundAsset");
+T3Dpre4ProjectImporter::genProcessor("LightFlareData", "flareTexture flareTextureAsset");
+T3Dpre4ProjectImporter::genProcessor("PhysicsDebrisData", "shape shapeAsset shapeFile shapeAsset");
+T3Dpre4ProjectImporter::genProcessor("PhysicsShapeData", "shape shapeAsset shapeName shapeAsset");
+T3Dpre4ProjectImporter::genProcessor("ProjectileData", "projectileShape projectileShapeAsset projectileShapeName projectileShapeAsset sound projectileSoundAsset");
+T3Dpre4ProjectImporter::genProcessor("ShapeBaseData", "shapeFile shapeAsset shape shapeAsset debrisShape debrisShapeAsset debrisShapeName debrisShapeAsset");
+T3Dpre4ProjectImporter::genProcessor("ShapeBaseImageData", "shape shapeAsset[0] shapeFP shapeAsset[1] shapeFile shapeAsset[0] shapeFileFP shapeAsset[1] stateSound stateSoundAsset");
+T3Dpre4ProjectImporter::genProcessor("ProximityMineData","armingSound ArmSoundAsset TriggerSound TriggerSoundAsset");
+T3Dpre4ProjectImporter::genProcessor("WheeledVehicleTire", "shape shapeAsset shapeFile shapeAsset");
+T3Dpre4ProjectImporter::genProcessor("WheeledVehicleData", "engineSound engineSoundAsset squealSound squealSoundAsset");
+T3Dpre4ProjectImporter::genProcessor("FlyingVehicleData", "engineSound engineSoundAsset jetSound jetSoundAsset");
+T3Dpre4ProjectImporter::genProcessor("HoverVehicleData", "engineSound engineSoundAsset jetSound jetSoundAsset floatSound floatSoundAsset");
+
+//==============================================================================
+// Datablocks - Long Lists
+//==============================================================================
+// - RigidShapeData
+$rigidEntriesList = "softImpactSound softImpactSoundAsset hardImpactSound hardImpactSoundAsset";
+$rigidEntriesList = $rigidEntriesList SPC "exitingWater exitingWaterAsset impactWaterEasy impactWaterEasyAsset";
+$rigidEntriesList = $rigidEntriesList SPC "impactWaterMedium impactWaterMediumAsset impactWaterHard impactWaterHardAsset";
+$rigidEntriesList = $rigidEntriesList SPC "waterWakeSound waterWakeSoundAsset";
+T3Dpre4ProjectImporter::genProcessor("RigidShapeData",$rigidEntriesList);
+// - PlayerData
+$PlayerEntriesList = "shapeFP shapeFPAsset shapeNameFP shapeFPAsset";
+$PlayerEntriesList = $PlayerEntriesList SPC "FootSoftSound FootSoftAsset FootHardSound FootHardAsset FootMetalSound FootMetalAsset";
+$PlayerEntriesList = $PlayerEntriesList SPC "FootSnowSound FootSnowAsset FootShallowSound FootShallowSplashAsset";
+$PlayerEntriesList = $PlayerEntriesList SPC "FootWadingSound FootWadingAsset FootUnderwaterSound FootUnderWaterAsset";
+$PlayerEntriesList = $PlayerEntriesList SPC "FootBubblesSound FootBubblesAsset movingBubblesSound MoveBubblesAsset";
+$PlayerEntriesList = $PlayerEntriesList SPC "waterBreathSound WaterBreathAsset";
+$PlayerEntriesList = $PlayerEntriesList SPC "impactSoftSound ImpactSoftAsset impactHardSound impactHardAsset";
+$PlayerEntriesList = $PlayerEntriesList SPC "impactMetalSound ImpactMetalAsset impactSnowSound impactSnowAsset";
+$PlayerEntriesList = $PlayerEntriesList SPC "impactWaterEasy impactWaterEasyAsset impactWaterMedium impactWaterMediumAsset impactWaterHard impactWaterHardAsset";
+$PlayerEntriesList = $PlayerEntriesList SPC "exitingWater ExitWaterAsset";
+T3Dpre4ProjectImporter::genProcessor("PlayerData", $PlayerEntriesList);
+// - Material
+$MaterialEntriesList = "baseTex diffuseMapAsset diffuseMap diffuseMapAsset";
+$MaterialEntriesList = $MaterialEntriesList SPC "lightMap lightMapAsset toneMap toneMapAsset";
+$MaterialEntriesList = $MaterialEntriesList SPC "detailTex detailMapAsset detailMap detailMapAsset detailNormalMap detailNormalMapAsset";
+$MaterialEntriesList = $MaterialEntriesList SPC "overlayTex overlayMapAsset overlayMap overlayMapAsset";
+$MaterialEntriesList = $MaterialEntriesList SPC "bumpTex normalMapAsset normalMap normalMapAsset";
+$MaterialEntriesList = $MaterialEntriesList SPC "ormConfigMap ormConfigMapAsset roughMap roughMapAsset";
+$MaterialEntriesList = $MaterialEntriesList SPC "aoMap aoMapAsset metalMap metalMapAsset";
+$MaterialEntriesList = $MaterialEntriesList SPC "glowMap glowMapAsset";
+$MaterialEntriesList = $MaterialEntriesList SPC "customFootstepSound customFootstepSoundAsset customImpactSound customImpactSoundAsset";
+T3Dpre4ProjectImporter::genProcessor("Material", $MaterialEntriesList);
+//==============================================================================
+// Materials
+//==============================================================================
+function T3Dpre4ProjectImporter::processMaterialObject(%this, %fileObject, %objectName)
+{
+ %matAsset = MaterialAsset::getAssetIdByMaterialName(%objectName);
+
+ if(%matAsset $= "" || %matAsset $= "Core_Rendering:NoMaterial")
+ {
+ %assetName = %objectName;
+
+ %moduleName = AssetBrowser.dirHandler.getModuleFromAddress($ProjectImporter::modulePath).ModuleId;
+
+ %assetPath = $ProjectImporter::currentFilePath @ "/";
+
+ %tamlpath = %assetPath @ %assetName @ ".asset.taml";
+ %scriptPath = %assetPath @ %assetName @ "." @ $TorqueScriptFileExtension;//%fileObject.fileDestination;
+
+ if(isFile(%tamlpath))
+ {
+ projectImporterLog("T3Dpre4ProjectImporter::processMaterialObject() - Failed to create as taml file already exists: " @ %fileObject.fileName);
+ return false;
+ }
+
+ %asset = new MaterialAsset()
+ {
+ AssetName = %assetName;
+ versionId = 1;
+ shaderData = "";
+ materialDefinitionName = %assetName;
+ scriptFile = fileBase(%scriptPath);
+ };
+
+ //Now we make our scripted definition "real", and append it to our asset
+ //so it is serialized.
+ /*%objectDefinition = "";
+ for(%l=0; %l < %fileObject.count(); %l++)
+ {
+ %objectLine = %fileObject.getKey(%l);
+ if(!isObject(%objectLine))
+ {
+ %objectDefinition = %objectDefinition @ %objectLine;
+ }
+ }
+
+ eval(%objectDefinition);
+
+ if(isObject(%objectName))
+ {
+ %asset.add(%objectName);
+ }*/
+
+ if(!isDirectory(%assetPath))
+ {
+ DirectoryHandler::createFolder(0, %assetPath);
+ }
+
+ %success = false;
+ if(TamlWrite(%asset, %tamlpath))
+ {
+ //now write the script file
+ if ( $ProjectImporter::fileObject.openForWrite( %scriptPath ) )
+ {
+ for(%i=0; %i < %fileObject.count(); %i++)
+ {
+ %objectLine = %fileObject.getKey(%i);
+ if(isObject(%objectLine))
+ {
+ %defineLine = %fileObject.getKey(0);
+ $ProjectImporter::fileObject.writeLine(%defineLine);
+ }
+ else
+ {
+ $ProjectImporter::fileObject.writeLine(%objectLine);
+ }
+ }
+
+ $ProjectImporter::fileObject.close();
+ }
+
+ %moduleDef = ModuleDatabase.findModule(%moduleName, 1);
+
+ %success = AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
+ }
+
+ if(!%success)
+ return false;
+ }
+
+ return false;
+}
+
+function T3Dpre4ProjectImporter::processTerrainMaterialLine(%this, %line)
+{
+ %outLine = processLegacyField(%line, "diffuseMap", "diffuseMapAsset");
+ if(%outLine !$= %line) return %outLine;
+ %outLine = processLegacyField(%line, "normalMap", "normalMapAsset");
+ if(%outLine !$= %line) return %outLine;
+ %outLine = processLegacyField(%line, "detailMap", "detailMapAsset");
+ if(%outLine !$= %line) return %outLine;
+ %outLine = processLegacyField(%line, "ORMConfigMap", "ORMConfigMapAsset");
+ if(%outLine !$= %line) return %outLine;
+ %outLine = processLegacyField(%line, "macroMap", "macroMapAsset");
+ if(%outLine !$= %line) return %outLine;
+ return %line;
+}
+
+function T3Dpre4ProjectImporter::processTerrainMaterialObject(%this, %fileObject, %objectName)
+{
+ %matAsset = TerrainMaterialAsset::getAssetIdByMaterialName(%objectName);
+
+ if(%matAsset $= "" || %matAsset $= "Core_Rendering:noMaterial")
+ {
+ %assetName = %objectName;
+
+ %moduleName = AssetBrowser.dirHandler.getModuleFromAddress($ProjectImporter::modulePath).ModuleId;
+
+ %assetPath = $ProjectImporter::currentFilePath @ "/";
+
+ %tamlpath = %assetPath @ %assetName @ ".asset.taml";
+ %scriptPath = %assetPath @ %assetName @ "." @ $TorqueScriptFileExtension;//%fileObject.fileDestination;
+
+ if(isFile(%tamlpath))
+ {
+ projectImporterLog("T3Dpre4ProjectImporter::processTerrainMaterialObject() - Failed to create as taml file already exists: " @ %fileObject.fileName);
+ return false;
+ }
+
+ %asset = new TerrainMaterialAsset()
+ {
+ AssetName = %assetName;
+ versionId = 1;
+ shaderData = "";
+ materialDefinitionName = %objectName;
+ scriptFile = fileName(%scriptPath);
+ };
+
+ %success = false;
+ if(TamlWrite(%asset, %tamlpath))
+ {
+ %moduleDef = ModuleDatabase.findModule(%moduleName, 1);
+
+ %success = AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
+ }
+
+ if(!%success)
+ return false;
+ }
+
+ return false;
+}
+//==============================================================================
+// PostEffects
+//==============================================================================
+T3Dpre4ProjectImporter::genProcessor("PostEffect", "texture textureAsset");
+
+//==============================================================================
+// Sounds
+// Sounds are a little weird because there's so much data tied up in a given sound
+// source. So our approach is find old SFXProfiles and process those into sound assets
+// by cross-referencing the filename for existing asset definitions.
+// Using existing SFXProfiles allows us to also injest the descriptions, giving us
+// our meta-properties on the sound asset itself.
+//==============================================================================
+T3Dpre4ProjectImporter::genProcessor("SFXAmbience", "soundTrack soundTrackAsset");
+T3Dpre4ProjectImporter::genProcessor("SFXPlayList", "track trackAsset");
+
+function T3Dpre4ProjectImporter::processSFXProfileLine(%this, %line)
+{
+ return %line;
+}
+
+function T3Dpre4ProjectImporter::processSFXProfileObject(%this, %file, %objectName)
+{
+ %soundFilename = findObjectField(%file, "filename");
+
+ %soundFilename = sanitizeFilename(%soundFilename);
+
+ if(fileExt(%soundFilename) $= "")
+ {
+ %soundFilename = testFilenameExtensions(%soundFilename);
+ }
+
+ %soundAsset = SoundAsset::getAssetIdByFilename(%soundFilename);
+
+ //Throw a warn that this file's already been claimed and move on
+ if(%soundAsset !$= "")
+ {
+ projectImporterLog("T3Dpre4ProjectImporter::processSFXProfileObject() - attempting to process SFXProfile " @ %objectName
+ @ " but its filename is already associated to another sound asset. Continuing, but be aware.");
+ }
+
+ %assetName = %objectName;
+
+ %moduleName = AssetBrowser.dirHandler.getModuleFromAddress(%soundFilename).ModuleId;
+
+ %assetPath = filePath(%soundFilename) @ "/";
+
+ %tamlpath = %assetPath @ %assetName @ ".asset.taml";
+
+ if(isFile(%tamlpath))
+ {
+ projectImporterLog("T3Dpre4ProjectImporter::processSFXProfileObject() - Failed to create as taml file already exists: " @ %soundFilename);
+ return false;
+ }
+
+ %asset = new SoundAsset()
+ {
+ AssetName = %assetName;
+ versionId = 1;
+ shaderData = "";
+ soundFile = fileBase(%soundFilename) @ fileExt(%soundFilename);
+ };
+
+ %descriptionName = findObjectField(%file, "description");
+
+ if(%descriptionName !$= "")
+ {
+ //Optimization, see if we already have this description by happenstance
+ if(isObject(%descriptionName))
+ {
+ %asset.sourceGroup = %descriptionName.sourceGroup;
+ %asset.volume = %descriptionName.volume;
+ %asset.pitch = %descriptionName.pitch;
+ %asset.isLooping = %descriptionName.isLooping;
+ %asset.priority = %descriptionName.priority;
+ %asset.useHardware = %descriptionName.useHardware;
+ %asset.is3D = %descriptionName.is3D;
+ %asset.minDistance = %descriptionName.minDistance;
+ %asset.maxDistance = %descriptionName.maxDistance;
+ %asset.scatterDistance = %descriptionName.scatterDistance;
+ %asset.coneInsideAngle = %descriptionName.coneInsideAngle;
+ %asset.coneOutsideAngle = %descriptionName.coneOutsideAngle;
+ %asset.coneOutsideVolume = %descriptionName.coneOutsideVolume;
+ %asset.rolloffFactor = %descriptionName.rolloffFactor;
+ %asset.isStreaming = %descriptionName.isStreaming;
+ }
+ else
+ {
+ %objFileFinder = "";
+ //first check our cache
+ if(isObject($ProjectImporter::SFXDescriptionCache) &&
+ $ProjectImporter::SFXDescriptionCache.getIndexFromKey(%descriptionName) !$= "")
+ {
+ %key = $ProjectImporter::SFXDescriptionCache.getIndexFromKey(%descriptionName);
+ %objFileFinder = $ProjectImporter::SFXDescriptionCache.getValue(%key);
+ }
+ else
+ {
+ %objFileFinder = findObjectInFiles(%descriptionName);
+ }
+
+ if(%objFileFinder !$= "")
+ {
+ %valueArray = new ArrayObject();
+
+ %fileObj = getField(%objFileFinder, 0);
+
+ %valueArray.add("sourceGroup" SPC findObjectField(%fileObj, "sourceGroup"));
+ %valueArray.add("volume" SPC findObjectField(%fileObj, "volume"));
+ %valueArray.add("pitch" SPC findObjectField(%fileObj, "pitch"));
+ %valueArray.add("isLooping" SPC findObjectField(%fileObj, "isLooping"));
+ %valueArray.add("priority" SPC findObjectField(%fileObj, "priority"));
+ %valueArray.add("useHardware" SPC findObjectField(%fileObj, "useHardware"));
+ %valueArray.add("is3D" SPC findObjectField(%fileObj, "is3D"));
+ %valueArray.add("minDistance" SPC findObjectField(%fileObj, "minDistance"));
+ %valueArray.add("maxDistance" SPC findObjectField(%fileObj, "maxDistance"));
+ %valueArray.add("scatterDistance" SPC findObjectField(%fileObj, "scatterDistance"));
+ %valueArray.add("coneInsideAngle" SPC findObjectField(%fileObj, "coneInsideAngle"));
+ %valueArray.add("coneOutsideAngle" SPC findObjectField(%fileObj, "coneOutsideAngle"));
+ %valueArray.add("coneOutsideVolume" SPC findObjectField(%fileObj, "coneOutsideVolume"));
+ %valueArray.add("rolloffFactor" SPC findObjectField(%fileObj, "rolloffFactor"));
+ %valueArray.add("isStreaming" SPC findObjectField(%fileObj, "isStreaming"));
+
+ if(isObject($ProjectImporter::SFXDescriptionCache))
+ {
+ $ProjectImporter::SFXDescriptionCache.add(%descriptionName, %objFileFinder);
+ }
+
+ for(%v=0; %v < %valueArray.Count(); %v++)
+ {
+ %varSet = %valueArray.getKey(%v);
+ %var = getWord(%varSet, 0);
+ %varVal = getWord(%varSet, 1);
+
+ if(%varVal !$= "")
+ %asset.setFieldValue(%var, %varVal);
+ }
+
+ %valueArray.delete();
+ }
+ }
+ }
+
+ %success = false;
+ if(TamlWrite(%asset, %tamlpath))
+ {
+ %moduleDef = ModuleDatabase.findModule(%moduleName, 1);
+
+ %success = AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
+ }
+
+ if(!%success)
+ return false;
+
+ %file.skip = true;
+
+ return true;
+}
+
+function T3Dpre4ProjectImporter::processAudioProfileObject(%this, %file, %objectName)
+{
+ return %this.processSFXProfileObject(%file, %objectName);
+}
+
+function T3Dpre4ProjectImporter::processSFXDescriptionObject(%this, %file, %objectName)
+{
+ //$ProjectImporter::ToRemoveObjectList.add(%objectName, %file TAB 0);
+
+ return true;
+}
+
+function T3Dpre4ProjectImporter::processAudioDescriptionObject(%this, %file, %objectName)
+{
+ $ProjectImporter::ToRemoveObjectList.add(%objectName, %file TAB 0);
+
+ return true;
+}
+
+//==============================================================================
+// Misc Utility functions
+//==============================================================================
+//This is functionally identical to processLegacyField, but we have to special-snowflake our asset lookups
+//due to it using suffix-based indirections
+function processGuiBitmapButtonCtrlField(%line, %originalFieldName, %newFieldName)
+{
+ if(!strIsMatchExpr("*"@%originalFieldName@"=*\"*\";*", %line) &&
+ !strIsMatchExpr("*"@%originalFieldName@"[*=*\"*\";*", %line) &&
+ !strIsMatchExpr("*"@%originalFieldName@" *=*\"*\";*", %line))
+ return %line;
+
+ %outLine = strreplace(%line, %originalFieldName, %newFieldName);
+
+ //get the value
+ %value = "";
+ %pos = strpos(%outLine, "= \"");
+ if(%pos != -1)
+ {
+ %endPos = strpos(%outLine, "\";", %pos);
+
+ %value = getSubStr(%outLine, %pos+3, %endPos-%pos-3);
+ }
+ else
+ {
+ %pos = strpos(%outLine, "=\"");
+ if(%pos != -1)
+ {
+ %endPos = strpos(%outLine, "\";", %pos);
+
+ %value = getSubStr(%outLine, %pos+2, %endPos-%pos-2);
+ }
+ }
+
+ if(%outLine !$= %line && %pos != -1 && %endPos != -1 && %value !$= "")
+ {
+ projectImporterLog("Legacy Project Importer - processing legacy field line: " @ %line);
+
+ if(startsWith(%value, "$") || startsWith(%value, "#"))
+ {
+ //These are going to be texture/render targets, and we can leave them alone
+ return %line;
+ }
+
+ %targetFilename = sanitizeFilename(%value);
+
+ //If we still have nothing, then we fail it out
+ if(!isFile(%targetFilename))
+ {
+ projectImporterLog("Legacy Project Importer - file described in line could not be found/is not valid");
+ return %line;
+ }
+
+ $ProjectImporter::assetQuery.clear();
+ %foundAssets = AssetDatabase.findAssetLooseFile($ProjectImporter::assetQuery, %targetFilename);
+ if(%foundAssets != 0)
+ {
+ %assetId = $ProjectImporter::assetQuery.getAsset(0);
+ projectImporterLog("Legacy Project Importer - processing of legacy field line's value: " @ %value @ " has found a matching AssetId: " @ %assetId);
+ }
+
+ if(%assetId !$= "" && AssetDatabase.isDeclaredAsset(%assetId))
+ {
+ //if (%assetId.getStatusString() $= "Ok")
+ %outLine = strReplace(%outLine, %value, %assetId);
+ //else
+ // error("Asset assignment failure:", %assetId, getStatusString());
+ }
+ }
+
+ if(%outLine !$= %line)
+ {
+ projectImporterLog("Legacy Project Importer - processing of legacy line: " @ %line @ " has been updated to: " @ %outLine);
+ return %outLine;
+ }
+ else
+ {
+ return %line;
+ }
+}
\ No newline at end of file
diff --git a/Templates/BaseGame/game/tools/projectImporter/importers/pre40/pre40ImporterGuis.asset.taml b/Templates/BaseGame/game/tools/projectImporter/importers/pre40/pre40ImporterGuis.asset.taml
new file mode 100644
index 000000000..32d091f0c
--- /dev/null
+++ b/Templates/BaseGame/game/tools/projectImporter/importers/pre40/pre40ImporterGuis.asset.taml
@@ -0,0 +1,7 @@
+
diff --git a/Templates/BaseGame/game/tools/projectImporter/importers/pre40/pre40ImporterGuis.gui b/Templates/BaseGame/game/tools/projectImporter/importers/pre40/pre40ImporterGuis.gui
new file mode 100644
index 000000000..6cbd3eb5c
--- /dev/null
+++ b/Templates/BaseGame/game/tools/projectImporter/importers/pre40/pre40ImporterGuis.gui
@@ -0,0 +1,129 @@
+//--- OBJECT WRITE BEGIN ---
+new GuiContainer(Pre40ImporterPage0) {
+ margin = "0 0 0 0";
+ padding = "0 0 0 0";
+ anchorTop = "1";
+ anchorBottom = "0";
+ anchorLeft = "1";
+ anchorRight = "0";
+ position = "1 1";
+ extent = "539 429";
+ minExtent = "8 2";
+ horizSizing = "width";
+ vertSizing = "bottom";
+ profile = "GuiDefaultProfile";
+ visible = "1";
+ active = "1";
+ tooltipProfile = "GuiToolTipProfile";
+ hovertime = "1000";
+ isContainer = "1";
+ canSave = "1";
+ canSaveDynamicFields = "1";
+
+ new GuiMLTextCtrl() {
+ lineSpacing = "2";
+ allowColorChars = "0";
+ maxChars = "-1";
+ text = "Next, we'll import in content files, such as image, models and sounds.";
+ useURLMouseCursor = "0";
+ position = "111 21";
+ extent = "328 28";
+ minExtent = "8 2";
+ horizSizing = "right";
+ vertSizing = "bottom";
+ profile = "ToolsGuiMLTextProfile";
+ visible = "1";
+ active = "1";
+ tooltipProfile = "GuiToolTipProfile";
+ hovertime = "1000";
+ isContainer = "0";
+ canSave = "1";
+ canSaveDynamicFields = "0";
+ };
+ new GuiMLTextCtrl() {
+ lineSpacing = "2";
+ allowColorChars = "0";
+ maxChars = "-1";
+ text = "Processing...";
+ useURLMouseCursor = "0";
+ position = "152 141";
+ extent = "245 14";
+ minExtent = "8 2";
+ horizSizing = "right";
+ vertSizing = "bottom";
+ profile = "ToolsGuiDefaultProfile";
+ visible = "1";
+ active = "1";
+ tooltipProfile = "GuiToolTipProfile";
+ hovertime = "1000";
+ isContainer = "0";
+ internalName = "processingText";
+ canSave = "1";
+ canSaveDynamicFields = "0";
+ };
+};
+
+new GuiContainer(Pre40ImporterPage1) {
+ margin = "0 0 0 0";
+ padding = "0 0 0 0";
+ anchorTop = "1";
+ anchorBottom = "0";
+ anchorLeft = "1";
+ anchorRight = "0";
+ position = "1 1";
+ extent = "539 429";
+ minExtent = "8 2";
+ horizSizing = "width";
+ vertSizing = "bottom";
+ profile = "GuiDefaultProfile";
+ visible = "1";
+ active = "1";
+ tooltipProfile = "GuiToolTipProfile";
+ hovertime = "1000";
+ isContainer = "1";
+ canSave = "1";
+ canSaveDynamicFields = "1";
+
+ new GuiMLTextCtrl() {
+ lineSpacing = "2";
+ allowColorChars = "0";
+ maxChars = "-1";
+ text = "Now, we'll import in script-based files such as guis, levels and scripts.";
+ useURLMouseCursor = "0";
+ position = "111 21";
+ extent = "328 28";
+ minExtent = "8 2";
+ horizSizing = "right";
+ vertSizing = "bottom";
+ profile = "ToolsGuiMLTextProfile";
+ visible = "1";
+ active = "1";
+ tooltipProfile = "GuiToolTipProfile";
+ hovertime = "1000";
+ isContainer = "0";
+ canSave = "1";
+ canSaveDynamicFields = "0";
+ };
+ new GuiMLTextCtrl() {
+ lineSpacing = "2";
+ allowColorChars = "0";
+ maxChars = "-1";
+ text = "Processing...";
+ useURLMouseCursor = "0";
+ position = "152 141";
+ extent = "245 14";
+ minExtent = "8 2";
+ horizSizing = "right";
+ vertSizing = "bottom";
+ profile = "ToolsGuiDefaultProfile";
+ visible = "1";
+ active = "1";
+ tooltipProfile = "GuiToolTipProfile";
+ hovertime = "1000";
+ isContainer = "0";
+ internalName = "processingText";
+ canSave = "1";
+ canSaveDynamicFields = "0";
+ };
+};
+//--- OBJECT WRITE END ---
diff --git a/Templates/BaseGame/game/tools/projectImporter/importers/pre40/pre40ImporterGuis.tscript b/Templates/BaseGame/game/tools/projectImporter/importers/pre40/pre40ImporterGuis.tscript
new file mode 100644
index 000000000..4ad259602
--- /dev/null
+++ b/Templates/BaseGame/game/tools/projectImporter/importers/pre40/pre40ImporterGuis.tscript
@@ -0,0 +1,92 @@
+function Pre40ImporterPage0::openPage(%this)
+{
+ ProjectImportWindow-->nextButton.setActive(false);
+ %this-->processingText.setText("Processing...");
+ Canvas.repaint();
+
+ //copy binary files over
+ for(%i=0; %i < $ProjectImporter::FileList.count(); %i++)
+ {
+ %file = $ProjectImporter::FileList.getKey(%i);
+ %rootFileSectionObject = $ProjectImporter::FileList.getValue(%i);
+ if(%rootFileSectionObject.binaryFile == true)
+ {
+ %filePath = filePath(%file);
+ %fileName = %rootFileSectionObject.fileName;
+ %fileBase = %rootFileSectionObject.fileBase;
+ %fileExt = %rootFileSectionObject.fileExt;
+
+ //filter out some unneeded folders
+ %slashCount = getTokenCount(%filePath, "/");
+ %topFolder = getToken(%filePath, "/", %slashCount-1);
+ if(%topFolder $= "")
+ %topFolder = getToken(%filePath, "/", %slashCount-2);
+
+ if(%topFolder $= "creator" || %topFolder $= "tools" || %topFolder $= "web")
+ {
+ %file = findNextFileMultiExpr( $ProjectImporter::sourceContentFolder @ "/*.*" );
+ continue;
+ }
+
+ %targetFilePath = strReplace(%file, $ProjectImporter::sourceContentFolder, $ProjectImporter::modulePath);
+
+ %sanitizedFilename = sanitizeString(%fileBase);
+ if(startsWith(%sanitizedFilename, "_"))
+ {
+ %sanitizedFilename = substr(%sanitizedFilename, 1, -1);
+ }
+ if(%sanitizedFilename !$= %fileBase)
+ {
+ %targetFilePath = filePath(%targetFilePath) @ "/" @ %sanitizedFilename @ %fileExt;
+ }
+
+ %targetFolder = filePath(%targetFilePath);
+
+ if(!isDirectory(%targetFolder))
+ {
+ DirectoryHandler::createFolder(0, %targetFolder);
+ }
+
+ if(!pathCopy(%file, %targetFilePath, false))
+ {
+ $ProjectImporter::log.add("Legacy Project Importer, failed to copy file: " @ %file @ " to destination: " @ %targetFilePath);
+ continue;
+ }
+
+ %rootFileSectionObject.localPath = %targetFilePath;
+
+ //If it was an asset definition file, go ahead and register it
+ if(%rootFileSectionObject.isAssetFile)
+ {
+ %moduleName = AssetBrowser.dirHandler.getModuleFromAddress(%targetFilePath).ModuleId;
+ %moduleDef = ModuleDatabase.findModule(%moduleName, 1);
+
+ AssetDatabase.addDeclaredAsset(%moduleDef, %targetFilePath);
+ }
+ }
+ }
+
+ //Now, we need to do some initial importing processing
+ T3Dpre4ProjectImporter.doContentImport();
+
+ //Once that's done, update the text of the UI
+ %this-->processingText.setText("Done!");
+ ProjectImportWindow-->nextButton.setActive(true);
+ Canvas.repaint();
+}
+
+function Pre40ImporterPage1::openPage(%this)
+{
+ ProjectImportWindow-->nextButton.setActive(false);
+ %this-->processingText.setText("Processing...");
+ Canvas.repaint();
+
+ //Now, we need to do some initial importing processing
+ T3Dpre4ProjectImporter.doScriptImport();
+
+ //Once that's done, update the text of the UI
+ %this-->processingText.setText("Done!");
+ ProjectImportWindow-->nextButton.setActive(true);
+ Canvas.repaint();
+}
+
diff --git a/Templates/BaseGame/game/tools/projectImporter/main.tscript b/Templates/BaseGame/game/tools/projectImporter/main.tscript
index da7fd3a3b..b7e871f1c 100644
--- a/Templates/BaseGame/game/tools/projectImporter/main.tscript
+++ b/Templates/BaseGame/game/tools/projectImporter/main.tscript
@@ -24,11 +24,6 @@ function initializeProjectImporter()
echo(" % - Initializing Project Importer");
exec("./scripts/projectImporter." @ $TorqueScriptFileExtension);
-
- //Versioned actions
- exec("./scripts/pre40/T3Dpre4ProjectImporter." @ $TorqueScriptFileExtension);
-
-
exec("./guis/projectImporter.gui");
new ScriptObject( ProjectImporterPlugin )
diff --git a/Templates/BaseGame/game/tools/projectImporter/scripts/pre40/T3Dpre4ProjectImporter.tscript b/Templates/BaseGame/game/tools/projectImporter/scripts/pre40/T3Dpre4ProjectImporter.tscript
deleted file mode 100644
index 041cabbc9..000000000
--- a/Templates/BaseGame/game/tools/projectImporter/scripts/pre40/T3Dpre4ProjectImporter.tscript
+++ /dev/null
@@ -1,1320 +0,0 @@
-function T3Dpre4ProjectImporter::setupModule(%this)
-{
- %newModuleName = $ProjectImporter::moduleName;
-
- $ProjectImporter::log.add("Creating a new Module named: " @ %newModuleName);
-
- %moduleFilePath = "data/" @ %newModuleName;
- %moduleDefinitionFilePath = %moduleFilePath @ "/" @ %newModuleName @ ".module";
- %moduleScriptFilePath = %moduleFilePath @ "/" @ %newModuleName @ "." @ $TorqueScriptFileExtension;
-
- %newModule = new ModuleDefinition()
- {
- ModuleId = %newModuleName;
- versionId = 1;
- ScriptFile = %newModuleName @ "." @ $TorqueScriptFileExtension;
- CreateFunction="onCreate";
- DestroyFunction="onDestroy";
- Group = "Game";
-
- new DeclaredAssets()
- {
- Extension = "asset.taml";
- Recurse = true;
- };
- };
-
- TAMLWrite(%newModule, %moduleDefinitionFilePath);
-
- //Now generate the script file for it
- %file = new FileObject();
- %templateFile = new FileObject();
-
- %moduleTemplateCodeFilePath = AssetBrowser.templateFilesPath @ "module.tscript.template";
-
- if(%file.openForWrite(%moduleScriptFilePath) && %templateFile.openForRead(%moduleTemplateCodeFilePath))
- {
- while( !%templateFile.isEOF() )
- {
- %line = %templateFile.readline();
- %line = strreplace( %line, "@@", %newModuleName );
-
- %file.writeline(%line);
- //$ProjectImporter::log.add(%line);
- }
-
- %file.close();
- %templateFile.close();
- }
- else
- {
- %file.close();
- %templateFile.close();
-
- $ProjectImporter::log.add("CreateNewModule - Something went wrong and we couldn't write the script file!");
- }
-
- //force a refresh of our modules list
- ModuleDatabase.ignoreLoadedGroups(true);
- ModuleDatabase.scanModules( "data", false );
- %success = ModuleDatabase.loadExplicit(%newModuleName, 1);
- ModuleDatabase.ignoreLoadedGroups(false);
-
- //force a reload of the Module lists
- AssetBrowser.refresh();
-}
-
-function T3Dpre4ProjectImporter::copyFiles(%this)
-{
- %currentPage = ProjectImportWindow.getCurrentPage();
-
- %currentPage-->fileCopyText.setText("Beginning copy of files to new module folder now. This may take a few minutes...");
- Canvas.repaint();
-
- %file = findFirstFileMultiExpr( $ProjectImporter::sourceContentFolder @ "/*.*", true);
-
- while( %file !$= "" )
- {
- %filePath = filePath(%file);
- %fileName = fileName(%file);
- %fileBase = fileBase(%file);
- %fileExt = fileExt(%file);
-
- if(endsWith(%fileName, ".asset.taml"))
- {
- %fileBase = strreplace(%fileBase, ".asset", "");
- %fileExt = ".asset.taml";
- }
-
- if(%fileExt $= ".dll" || %fileExt $= ".log" || %fileExt $= ".exe" || %fileExt $= ".manifest"|| %fileExt $= ".h" ||
- %fileExt $= ".cpp" || %fileExt $= ".so" || %fileExt $= ".do" || %fileExt $= ".lib" ||%fileExt $= ".exp")
- {
- %file = findNextFileMultiExpr( $ProjectImporter::sourceContentFolder @ "/*.*" );
- continue;
- }
-
- //filter out some unneeded folders
- %slashCount = getTokenCount(%filePath, "/");
- %topFolder = getToken(%filePath, "/", %slashCount-1);
- if(%topFolder $= "")
- %topFolder = getToken(%filePath, "/", %slashCount-2);
-
- if(%topFolder $= "creator" || %topFolder $= "tools" || %topFolder $= "web")
- {
- %file = findNextFileMultiExpr( $ProjectImporter::sourceContentFolder @ "/*.*" );
- continue;
- }
-
- %targetFilePath = strReplace(%file, $ProjectImporter::sourceContentFolder, $ProjectImporter::modulePath);
-
- %sanitizedFilename = sanitizeString(%fileBase);
- if(startsWith(%sanitizedFilename, "_"))
- {
- %sanitizedFilename = substr(%sanitizedFilename, 1, -1);
- }
- if(%sanitizedFilename !$= %fileBase)
- {
- %targetFilePath = filePath(%targetFilePath) @ "/" @ %sanitizedFilename @ %fileExt;
- }
-
- %targetFolder = filePath(%targetFilePath);
-
- if(!isDirectory(%targetFolder))
- {
- DirectoryHandler::createFolder(0, %targetFolder);
- }
-
- if(!pathCopy(%file, %targetFilePath, false))
- {
- $ProjectImporter::log.add("Legacy Project Importer, failed to copy file: " @ %file @ " to destination: " @ %targetFilePath);
- }
-
- %file = findNextFileMultiExpr( $ProjectImporter::sourceContentFolder @ "/*.*" );
- }
-
- //
- //Now that we've done that, we'll load and scan the module for asset defs
- %file = findFirstFileMultiExpr( $ProjectImporter::modulePath @ "/*.asset.taml", true);
-
- while( %file !$= "" )
- {
- %moduleName = AssetBrowser.dirHandler.getModuleFromAddress(%file).ModuleId;
- %moduleDef = ModuleDatabase.findModule(%moduleName, 1);
-
- AssetDatabase.addDeclaredAsset(%moduleDef, %file);
-
- %file = findNextFileMultiExpr( $ProjectImporter::modulePath @ "/*.asset.taml" );
- }
- //
-
- %currentPage-->fileCopyText.setValue("File copy done! Press Next to continue.");
-
- ProjectImportWindow-->nextButton.setActive(true);
- Canvas.repaint();
-}
-
-function T3Dpre4ProjectImporter::processImportedFiles(%this)
-{
- if($ProjectImporter::importMode $= "CoreAndTools")
- {
- $ProjectImporter::modulePath = "Core";
- %this.doImport();
-
- $ProjectImporter::modulePath = "Tools";
- %this.doImport();
- }
- else
- {
- %this.doImport();
- }
-
- %currentPage = ProjectImportWindow.getCurrentPage();
-
- %currentPage-->processingText.setText("Processing of files done! Press Next to continue.");
- ProjectImportWindow-->nextButton.setActive(true);
- Canvas.repaint();
-}
-
-function T3Dpre4ProjectImporter::doImport(%this)
-{
- //Store off the current default import config
- %defaultConfig = EditorSettings.value("Assets/AssetImporDefaultConfig", "");
- EditorSettings.setValue("Assets/AssetImporDefaultConfig", "LegacyProjectImport");
-
- //Update asset content
- beginImageImport();
-
- %this.beginMaterialFilesImport();
-
- beginShapeImport();
- beginTerrainImport();
- beginLevelImport();
- beginGUIImport();
-
- %this.beginCodeFilesImport();
-
- EditorSettings.setValue("Assets/AssetImporDefaultConfig", %defaultConfig);
-}
-
-function T3Dpre4ProjectImporter::beginMaterialFilesImport(%this)
-{
- %currentPage = ProjectImportWindow.getCurrentPage();
-
- //First, wipe out any files inside the folder first
- %file = findFirstFileMultiExpr( $ProjectImporter::modulePath @ "/*/materials.*", true);
-
- %objectClassStack = new ArrayObject();
- %fileOutputLines = new ArrayObject();
-
- $ProjectImporter::log.add("Legacy Project Importer - Beginning processing of imported code files");
-
- //Walk through and process all code files to update references
- while( %file !$= "" )
- {
- %fileWasChanged = false;
-
- %filename = fileName(%file);
- %fileBase = fileBase(%file);
- %fileExt = fileExt(%file);
- %filePath = filePath(%file);
-
- $ProjectImporter::currentFilePath = %filePath @ "/";
-
- %currentPage-->processingText.setText("Processing material script file: " @ %file);
- Canvas.repaint();
-
- if ( $ProjectImporter::fileObject.openForRead( %file ) )
- {
- $ProjectImporter::log.add("Legacy Project Importer - Beginning process of file: " @ %file);
- %lineNum = 0;
- while ( !$ProjectImporter::fileObject.isEOF() )
- {
- %line = $ProjectImporter::fileObject.readLine();
- %trimmedLine = trim(%line);
-
- if(strIsMatchExpr("*new*(*)*", %line) && strpos(%line, "::") == -1)
- {
- %className = findObjectClass(%line, "new");
- if (%className $= "") continue;
-
- if(%className !$= "Material" && %className !$= "CustomMaterial" && %className !$= "TerrainMaterial" && %className !$= "CubemapData")
- {
- %lineNum++;
- %fileOutputLines.push_back(%line);
- continue;
- }
-
- %objectClassStack.push_back(%className);
-
- %objectName = findObjectName(%line, "new");
-
- if(%objectName $= "" && %className $= "TerrainMaterial")
- {
- %intName = findObjectField("internalName");
- %objectName = %intName @ "_terrainMat";
- %line = strReplace(%line, "()", "(" @ %intName @ ")");
-
- %fileWasChanged = true;
- }
- else if(%objectName $= "" && %className $= "Material")
- {
- %mapToName = findObjectField("mapTo");
- %objectName = %mapToName @ "_mat";
- %line = strReplace(%line, "()", "(" @ %mapToName @ ")");
-
- %fileWasChanged = true;
- }
-
- %sanitizedName = sanitizeString(%objectName);
- if(startsWith(%sanitizedName, "_"))
- {
- %sanitizedName = substr(%sanitizedName, 1, -1);
- }
- if(%sanitizedName !$= %objectName)
- {
- %line = strReplace(%line, %objectName, %sanitizedName);
-
- %fileWasChanged = true;
- }
-
- if(%objectClassStack.count() == 1)
- {
- %currentObjClass = %objectClassStack.getKey(%objectClassStack.count()-1);
-
- //we only process top-level objects directly
- %inheritanceList = getClassHierarchy(%currentObjClass);
- for (%classDepth =0; %classDepthprocessingText.setText("Processing file: " @ %file);
- Canvas.repaint();
-
- if ( $ProjectImporter::fileObject.openForRead( %file ) )
- {
- $ProjectImporter::log.add("Legacy Project Importer - Beginning process of file: " @ %file);
- %lineNum = 0;
- while ( !$ProjectImporter::fileObject.isEOF() )
- {
- %line = $ProjectImporter::fileObject.readLine();
- %trimmedLine = trim(%line);
-
- if(strIsMatchExpr("*new*(*)*", %line) && strpos(%line, "::") == -1)
- {
- %className = findObjectClass(%line, "new");
- if (%className $= "") continue;
-
- %objectClassStack.push_back(%className);
-
- %objectName = findObjectName(%line, "new");
-
- if(strIsMatchExpr("*%guiContent*=*new*", %line))
- {
- %line = strReplace(%line, "%guiContent", "$guiContent");
- %fileWasChanged = true;
- }
-
- if(%objectName !$= "")
- {
- %sanitizedName = sanitizeString(%objectName);
- if(startsWith(%sanitizedName, "_"))
- {
- %sanitizedName = substr(%sanitizedName, 1, -1);
- }
- if(%sanitizedName !$= %objectName)
- {
- %line = strReplace(%line, %objectName, %sanitizedName);
-
- %fileWasChanged = true;
- }
-
- if(%objectClassStack.count() == 1)
- {
- %currentObjClass = %objectClassStack.getKey(%objectClassStack.count()-1);
-
- //we only process top-level objects directly
- %inheritanceList = getClassHierarchy(%currentObjClass);
- for (%classDepth =0; %classDepthprocessingText.setText("Processing material script file: " @ %file);
- Canvas.repaint();
-
- %targetFilePath = %filePath @ "/" @ %fileBase @ "." @ $TorqueScriptFileExtension;
- if(!pathCopy(%file, %targetFilePath))
- {
- $ProjectImporter::log.add("T3Dpre4ProjectImporter::processScriptExtensions() - Failed to create renamed script file for file: " @ %file);
- }
- else
- {
- if(!fileDelete(%file))
- {
- $ProjectImporter::log.add("T3Dpre4ProjectImporter::processScriptExtensions() - Failed to remove old script file for rename: " @ %file);
- }
- }
-
- if($TorqueScriptFileExtension $= "tscript")
- %file = findNextFileMultiExpr( $ProjectImporter::modulePath @ "/*/*.cs");
- else
- %file = findNextFileMultiExpr( $ProjectImporter::modulePath @ "/*/*.tscript");
- }
-
- %currentPage = ProjectImportWindow.getCurrentPage();
-
- %currentPage-->processingText.setText("Processing of script files done! Press Next to continue.");
- ProjectImportWindow-->nextButton.setActive(true);
- Canvas.repaint();
-
- $ProjectImporter::log.add("Legacy Project Importer - Beginning processing of script files extensions complete");
-}
-
-//To implement a custom class to have it's fields processed, just utilize this template function
-//and replace the class/field spaces as appropriate
-/*
-function T3Dpre4ProjectImporter::processLine(%this, %line)
-{
- %outLine = processLegacyField(%line, "", "");
-
- if(%outLine !$= %line)
- return %outLine;
- else
- return %line;
-}
-*/
-//==============================================================================
-// Misc Object Classes
-//==============================================================================
-function T3Dpre4ProjectImporter::genProcessor(%classType, %conversionMap)
-{
- %stryng = "function T3Dpre4ProjectImporter::process" @%classType@ "Line(%this, %line){\n";
- %count = getWordCount(%conversionMap);
- for (%i = 0; %i<%count; %i+=2)
- {
- %stryng = %stryng @ " %outLine = processLegacyField(%line,\""@ getWord(%conversionMap,%i)@ "\",\""@ getWord(%conversionMap,%i+1)@"\");\n";
- %stryng = %stryng @ " if(%outLine !$= %line) return %outLine;\n";
- }
- %stryng = %stryng @ " return %line;\n}";
- eval(%stryng);
-}
-
-T3Dpre4ProjectImporter::genProcessor("TSShapeConstructor", "baseShape baseShapeAsset shapeName shapeAsset");
-T3Dpre4ProjectImporter::genProcessor("BasicClouds", "texture textureAsset");
-T3Dpre4ProjectImporter::genProcessor("CloudLayer", "texture textureAsset");
-T3Dpre4ProjectImporter::genProcessor("DecalRoad", "material materialAsset");
-T3Dpre4ProjectImporter::genProcessor("MeshRoad", "topMaterial topMaterialAsset bottomMaterial bottomMaterialAsset sideMaterial sideMaterialAsset");
-T3Dpre4ProjectImporter::genProcessor("ScatterSky", "moonMat moonMatAsset");
-T3Dpre4ProjectImporter::genProcessor("Sun", "coronaMaterial coronaMaterialAsset");
-T3Dpre4ProjectImporter::genProcessor("VolumetricFog", "shape ShapeAsset texture textureAsset");
-T3Dpre4ProjectImporter::genProcessor("WaterObject", "rippleTex rippleTexAsset foamTex foamTexAsset depthGradientTex depthGradientTexAsset");
-T3Dpre4ProjectImporter::genProcessor("ConvexShape", "material materialAsset");
-T3Dpre4ProjectImporter::genProcessor("RenderMesh", "material materialAsset");
-T3Dpre4ProjectImporter::genProcessor("RenderShape", "shape shapeAsset");
-T3Dpre4ProjectImporter::genProcessor("GroundCover", "material materialAsset shape shapeAsset shapeFilename shapeAsset");
-T3Dpre4ProjectImporter::genProcessor("GroundPlane", "material materialAsset");
-T3Dpre4ProjectImporter::genProcessor("LevelInfo", "accuTexture accuTextureAsset");
-T3Dpre4ProjectImporter::genProcessor("TSStatic", "shape shapeAsset shapeName shapeAsset");
-T3Dpre4ProjectImporter::genProcessor("TSForestItemData", "shape shapeAsset shapeName shapeAsset shapeFile shapeAsset");
-T3Dpre4ProjectImporter::genProcessor("TerrainBlock", "terrainFile terrainAsset");
-T3Dpre4ProjectImporter::genProcessor("afxMagicMissileData", "projectileShape projectileShapeAsset projectileShapeName projectileShapeAsset sound projectileSoundAsset");
-T3Dpre4ProjectImporter::genProcessor("afxBillboardData", "texture textureAsset");
-T3Dpre4ProjectImporter::genProcessor("afxModelData", "shapeName shapeAsset shapeFile shapeAsset");
-T3Dpre4ProjectImporter::genProcessor("afxZodiacData", "texture textureAsset");
-T3Dpre4ProjectImporter::genProcessor("afxZodiacPlaneData", "texture textureAsset");
-T3Dpre4ProjectImporter::genProcessor("sfxEmitter", "track soundAsset filename soundAsset");
-T3Dpre4ProjectImporter::genProcessor("LightningData", "thunderSounds ThunderSoundAsset strikeSound StrikeSoundAsset");
-//==============================================================================
-// Levels
-//==============================================================================
-function T3Dpre4ProjectImporter::processMissionGroupLine(%this, %line, %missionName)
-{
- %outline = strreplace(%line, "SimGroup(MissionGroup)", "Scene(" @ %missionName @ ")");
-
- if(%outLine !$= %line)
- return %outLine;
- else
- return %line;
-}
-
-function T3Dpre4ProjectImporter::processLevelInfoLine(%this, %line)
-{
- %outline = strreplace(%line, "ScriptObject(MissionInfo)", "LevelInfo(theLevelInfo)");
-
- if(%outLine !$= %line)
- return %outLine;
- else
- return %line;
-}
-
-function T3Dpre4ProjectImporter::processSkyLine(%this, %line)
-{
- %outline = strreplace(%line, "Sky", "Skybox");
-
- if(%outLine !$= %line)
- return %outLine;
- else
- return %line;
-}
-
-function T3Dpre4ProjectImporter::processWaterLine(%this, %line)
-{
- %outline = strreplace(%line, "Water", "WaterPlane");
-
- if(%outLine !$= %line)
- return %outLine;
- else
- return %line;
-}
-
-//==============================================================================
-// GUIs
-//==============================================================================
-T3Dpre4ProjectImporter::genProcessor("GuiIconButtonCtrl", "bitmap bitmapAsset iconBitmap bitmapAsset");
-T3Dpre4ProjectImporter::genProcessor("GuiToolboxButtonCtrl", "normalBitmap normalBitmapAsset loweredBitmap loweredBitmapAsset hoverBitmap hoverBitmapAsset");
-T3Dpre4ProjectImporter::genProcessor("GuiBitmapCtrl", "bitmap bitmapAsset");
-T3Dpre4ProjectImporter::genProcessor("GuiMaterialCtrl", "material materialAsset");
-T3Dpre4ProjectImporter::genProcessor("GuiCursor", "bitmap bitmapAsset");
-T3Dpre4ProjectImporter::genProcessor("GuiChunkedBitmapCtrl", "bitmap bitmapAsset");
-T3Dpre4ProjectImporter::genProcessor("GuiProgressBitmap", "bitmap bitmapAsset");
-T3Dpre4ProjectImporter::genProcessor("GuiMissionArea", "handleBitmap handleBitmapAsset");
-T3Dpre4ProjectImporter::genProcessor("WorldEditor", "selectHandle selectHandleAsset defaultHandle defaultHandleAsset lockedHandle lockedHandleAsset");
-T3Dpre4ProjectImporter::genProcessor("GuiControlProfile", "bitmap bitmapAsset");
-T3Dpre4ProjectImporter::genProcessor("GuiMLTextCtrl", "deniedSound deniedSoundAsset");
-
-function T3Dpre4ProjectImporter::processGuiBitmapButtonCtrlLine(%this, %line)
-{
- %outLine = processGuiBitmapButtonCtrlField(%line, "bitmap", "bitmapAsset");
- if(%outLine !$= %line) return %outLine;
-
- return %line;
-}
-
-//==============================================================================
-// Datablocks
-//==============================================================================
-T3Dpre4ProjectImporter::genProcessor("ForestItemData", "shape shapeAsset");
-T3Dpre4ProjectImporter::genProcessor("CubeMapData", "cubemapFace cubeMapFaceAsset cubemap cubemapAsset cubeFace cubeMapFaceAsset");
-T3Dpre4ProjectImporter::genProcessor("DebrisData", "shape shapeAsset shapeFile shapeAsset");
-T3Dpre4ProjectImporter::genProcessor("DecalData", "material materialAsset");
-T3Dpre4ProjectImporter::genProcessor("ExplosionData", "explosionShape explosionShapeAsset");
-T3Dpre4ProjectImporter::genProcessor("ParticleData", "texture textureAsset textureName textureAsset textureExt textureExtAsset textureExtName textureExtAsset");
-T3Dpre4ProjectImporter::genProcessor("PrecipitationData", "drop dropAsset dropTexture dropAsset splash splashAsset splashTexture splashAsset soundProfile soundAsset");
-T3Dpre4ProjectImporter::genProcessor("SplashData", "texture textureAsset soundProfile SoundAsset");
-T3Dpre4ProjectImporter::genProcessor("LightFlareData", "flareTexture flareTextureAsset");
-T3Dpre4ProjectImporter::genProcessor("PhysicsDebrisData", "shape shapeAsset shapeFile shapeAsset");
-T3Dpre4ProjectImporter::genProcessor("PhysicsShapeData", "shape shapeAsset shapeName shapeAsset");
-T3Dpre4ProjectImporter::genProcessor("ProjectileData", "projectileShape projectileShapeAsset projectileShapeName projectileShapeAsset sound projectileSoundAsset");
-T3Dpre4ProjectImporter::genProcessor("ShapeBaseData", "shapeFile shapeAsset shape shapeAsset debrisShape debrisShapeAsset debrisShapeName debrisShapeAsset");
-T3Dpre4ProjectImporter::genProcessor("ShapeBaseImageData", "shape shapeAsset[0] shapeFP shapeAsset[1] shapeFile shapeAsset[0] shapeFileFP shapeAsset[1] stateSound stateSoundAsset");
-T3Dpre4ProjectImporter::genProcessor("ProximityMineData","armingSound ArmSoundAsset TriggerSound TriggerSoundAsset");
-T3Dpre4ProjectImporter::genProcessor("WheeledVehicleTire", "shape shapeAsset shapeFile shapeAsset");
-T3Dpre4ProjectImporter::genProcessor("WheeledVehicleData", "engineSound engineSoundAsset squealSound squealSoundAsset");
-T3Dpre4ProjectImporter::genProcessor("FlyingVehicleData", "engineSound engineSoundAsset jetSound jetSoundAsset");
-T3Dpre4ProjectImporter::genProcessor("HoverVehicleData", "engineSound engineSoundAsset jetSound jetSoundAsset floatSound floatSoundAsset");
-
-//==============================================================================
-// Datablocks - Long Lists
-//==============================================================================
-// - RigidShapeData
-$rigidEntriesList = "softImpactSound softImpactSoundAsset hardImpactSound hardImpactSoundAsset";
-$rigidEntriesList = $rigidEntriesList SPC "exitingWater exitingWaterAsset impactWaterEasy impactWaterEasyAsset";
-$rigidEntriesList = $rigidEntriesList SPC "impactWaterMedium impactWaterMediumAsset impactWaterHard impactWaterHardAsset";
-$rigidEntriesList = $rigidEntriesList SPC "waterWakeSound waterWakeSoundAsset";
-T3Dpre4ProjectImporter::genProcessor("RigidShapeData",$rigidEntriesList);
-// - PlayerData
-$PlayerEntriesList = "shapeFP shapeFPAsset shapeNameFP shapeFPAsset";
-$PlayerEntriesList = $PlayerEntriesList SPC "FootSoftSound FootSoftAsset FootHardSound FootHardAsset FootMetalSound FootMetalAsset";
-$PlayerEntriesList = $PlayerEntriesList SPC "FootSnowSound FootSnowAsset FootShallowSound FootShallowSplashAsset";
-$PlayerEntriesList = $PlayerEntriesList SPC "FootWadingSound FootWadingAsset FootUnderwaterSound FootUnderWaterAsset";
-$PlayerEntriesList = $PlayerEntriesList SPC "FootBubblesSound FootBubblesAsset movingBubblesSound MoveBubblesAsset";
-$PlayerEntriesList = $PlayerEntriesList SPC "waterBreathSound WaterBreathAsset";
-$PlayerEntriesList = $PlayerEntriesList SPC "impactSoftSound ImpactSoftAsset impactHardSound impactHardAsset";
-$PlayerEntriesList = $PlayerEntriesList SPC "impactMetalSound ImpactMetalAsset impactSnowSound impactSnowAsset";
-$PlayerEntriesList = $PlayerEntriesList SPC "impactWaterEasy impactWaterEasyAsset impactWaterMedium impactWaterMediumAsset impactWaterHard impactWaterHardAsset";
-$PlayerEntriesList = $PlayerEntriesList SPC "exitingWater ExitWaterAsset";
-T3Dpre4ProjectImporter::genProcessor("PlayerData", $PlayerEntriesList);
-// - Material
-$MaterialEntriesList = "baseTex diffuseMapAsset diffuseMap diffuseMapAsset";
-$MaterialEntriesList = $MaterialEntriesList SPC "lightMap lightMapAsset toneMap toneMapAsset";
-$MaterialEntriesList = $MaterialEntriesList SPC "detailTex detailMapAsset detailMap detailMapAsset detailNormalMap detailNormalMapAsset";
-$MaterialEntriesList = $MaterialEntriesList SPC "overlayTex overlayMapAsset overlayMap overlayMapAsset";
-$MaterialEntriesList = $MaterialEntriesList SPC "bumpTex normalMapAsset normalMap normalMapAsset";
-$MaterialEntriesList = $MaterialEntriesList SPC "ormConfigMap ormConfigMapAsset roughMap roughMapAsset";
-$MaterialEntriesList = $MaterialEntriesList SPC "aoMap aoMapAsset metalMap metalMapAsset";
-$MaterialEntriesList = $MaterialEntriesList SPC "glowMap glowMapAsset";
-$MaterialEntriesList = $MaterialEntriesList SPC "customFootstepSound customFootstepSoundAsset customImpactSound customImpactSoundAsset";
-T3Dpre4ProjectImporter::genProcessor("Material", $MaterialEntriesList);
-//==============================================================================
-// Materials
-//==============================================================================
-function T3Dpre4ProjectImporter::processMaterialObject(%this, %file, %objectName)
-{
- %matAsset = MaterialAsset::getAssetIdByMaterialName(%objectName);
-
- if(%matAsset $= "" || %matAsset $= "Core_Rendering:NoMaterial")
- {
- %assetName = %objectName;
-
- %moduleName = AssetBrowser.dirHandler.getModuleFromAddress(%file).ModuleId;
-
- %assetPath = filePath(%file) @ "/";
-
- %tamlpath = %assetPath @ %assetName @ ".asset.taml";
-
- if(isFile(%tamlpath))
- {
- $ProjectImporter::log.add("T3Dpre4ProjectImporter::processMaterialObject() - Failed to create as taml file already exists: " @ %file);
- return false;
- }
-
- %asset = new MaterialAsset()
- {
- AssetName = %assetName;
- versionId = 1;
- shaderData = "";
- materialDefinitionName = %assetName;
- scriptFile = fileBase(%file);
- };
-
- TamlWrite(%asset, %tamlpath);
-
- %moduleDef = ModuleDatabase.findModule(%moduleName, 1);
- %success = AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
-
- if(!%success)
- return false;
- }
-
- return false;
-}
-
-function T3Dpre4ProjectImporter::processTerrainMaterialLine(%this, %line)
-{
- %outLine = processLegacyField(%line, "diffuseMap", "diffuseMapAsset");
- if(%outLine !$= %line) return %outLine;
- %outLine = processLegacyField(%line, "normalMap", "normalMapAsset");
- if(%outLine !$= %line) return %outLine;
- %outLine = processLegacyField(%line, "detailMap", "detailMapAsset");
- if(%outLine !$= %line) return %outLine;
- %outLine = processLegacyField(%line, "ORMConfigMap", "ORMConfigMapAsset");
- if(%outLine !$= %line) return %outLine;
- %outLine = processLegacyField(%line, "macroMap", "macroMapAsset");
- if(%outLine !$= %line) return %outLine;
- return %line;
-}
-
-function T3Dpre4ProjectImporter::processTerrainMaterialObject(%this, %file, %objectName)
-{
- %matAsset = TerrainMaterialAsset::getAssetIdByMaterialName(%objectName);
-
- if(%matAsset $= "" || %matAsset $= "Core_Rendering:noMaterial")
- {
- %assetName = %objectName;
-
- %moduleName = AssetBrowser.dirHandler.getModuleFromAddress(%file).ModuleId;
-
- %assetPath = filePath(%file) @ "/";
-
- %tamlpath = %assetPath @ %assetName @ ".asset.taml";
-
- if(isFile(%tamlpath))
- {
- $ProjectImporter::log.add("T3Dpre4ProjectImporter::processTerrainMaterialObject() - Failed to create as taml file already exists: " @ %file);
- return false;
- }
-
- %asset = new TerrainMaterialAsset()
- {
- AssetName = %assetName;
- versionId = 1;
- shaderData = "";
- materialDefinitionName = %objectName;
- scriptFile = fileName(%file);
- };
-
- TamlWrite(%asset, %tamlpath);
-
- %moduleDef = ModuleDatabase.findModule(%moduleName, 1);
- %success = AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
-
- if(!%success)
- return false;
- }
-
- return false;
-}
-//==============================================================================
-// PostEffects
-//==============================================================================
-T3Dpre4ProjectImporter::genProcessor("PostEffect", "texture textureAsset");
-
-//==============================================================================
-// Sounds
-// Sounds are a little weird because there's so much data tied up in a given sound
-// source. So our approach is find old SFXProfiles and process those into sound assets
-// by cross-referencing the filename for existing asset definitions.
-// Using existing SFXProfiles allows us to also injest the descriptions, giving us
-// our meta-properties on the sound asset itself.
-//==============================================================================
-T3Dpre4ProjectImporter::genProcessor("SFXAmbience", "soundTrack soundTrackAsset");
-T3Dpre4ProjectImporter::genProcessor("SFXPlayList", "track trackAsset");
-
-function T3Dpre4ProjectImporter::processSFXProfileLine(%this, %line)
-{
- return %line;
-}
-
-function T3Dpre4ProjectImporter::processSFXProfileObject(%this, %file, %objectName)
-{
- %soundFilename = findObjectField("filename");
-
- %soundFilename = sanitizeFilename(%soundFilename);
-
- %soundAsset = SoundAsset::getAssetIdByFilename(%soundFilename);
-
- //Throw a warn that this file's already been claimed and move on
- if(%soundAsset !$= "")
- {
- $ProjectImporter::log.add("T3Dpre4ProjectImporter::processSFXProfileObject() - attempting to process SFXProfile " @ %objectName
- @ " but its filename is already associated to another sound asset. Continuing, but be aware.");
- }
-
- %assetName = %objectName;
-
- %moduleName = AssetBrowser.dirHandler.getModuleFromAddress(%soundFilename).ModuleId;
-
- %assetPath = filePath(%soundFilename) @ "/";
-
- %tamlpath = %assetPath @ %assetName @ ".asset.taml";
-
- if(isFile(%tamlpath))
- {
- $ProjectImporter::log.add("T3Dpre4ProjectImporter::processSFXProfileObject() - Failed to create as taml file already exists: " @ %soundFilename);
- return false;
- }
-
- %asset = new SoundAsset()
- {
- AssetName = %assetName;
- versionId = 1;
- shaderData = "";
- soundFile = fileBase(%soundFilename) @ fileExt(%soundFilename);
- };
-
- %descriptionName = findObjectField("description");
-
- if(%descriptionName !$= "")
- {
- //Optimization, see if we already have this description by happenstance
- if(isObject(%descriptionName))
- {
- %asset.sourceGroup = %descriptionName.sourceGroup;
- %asset.volume = %descriptionName.volume;
- %asset.pitch = %descriptionName.pitch;
- %asset.isLooping = %descriptionName.isLooping;
- %asset.priority = %descriptionName.priority;
- %asset.useHardware = %descriptionName.useHardware;
- %asset.is3D = %descriptionName.is3D;
- %asset.minDistance = %descriptionName.minDistance;
- %asset.maxDistance = %descriptionName.maxDistance;
- %asset.scatterDistance = %descriptionName.scatterDistance;
- %asset.coneInsideAngle = %descriptionName.coneInsideAngle;
- %asset.coneOutsideAngle = %descriptionName.coneOutsideAngle;
- %asset.coneOutsideVolume = %descriptionName.coneOutsideVolume;
- %asset.rolloffFactor = %descriptionName.rolloffFactor;
- %asset.isStreaming = %descriptionName.isStreaming;
- }
- else
- {
- %objFileFinder = "";
- //first check our cache
- if(isObject($ProjectImporter::SFXDescriptionCache) &&
- $ProjectImporter::SFXDescriptionCache.getIndexFromKey(%descriptionName) !$= "")
- {
- %key = $ProjectImporter::SFXDescriptionCache.getIndexFromKey(%descriptionName);
- %objFileFinder = $ProjectImporter::SFXDescriptionCache.getValue(%key);
- }
- else
- {
- %objFileFinder = findObjectInFiles(%descriptionName);
- }
-
- if(%objFileFinder !$= "")
- {
- %valueArray = new ArrayObject();
-
- %fileObj = getField(%objFileFinder, 0);
-
- %valueArray.add("sourceGroup" SPC findObjectField("sourceGroup", %fileObj));
- %valueArray.add("volume" SPC findObjectField("volume", %fileObj));
- %valueArray.add("pitch" SPC findObjectField("pitch", %fileObj));
- %valueArray.add("isLooping" SPC findObjectField("isLooping", %fileObj));
- %valueArray.add("priority" SPC findObjectField("priority", %fileObj));
- %valueArray.add("useHardware" SPC findObjectField("useHardware", %fileObj));
- %valueArray.add("is3D" SPC findObjectField("is3D", %fileObj));
- %valueArray.add("minDistance" SPC findObjectField("minDistance", %fileObj));
- %valueArray.add("maxDistance" SPC findObjectField("maxDistance", %fileObj));
- %valueArray.add("scatterDistance" SPC findObjectField("scatterDistance", %fileObj));
- %valueArray.add("coneInsideAngle" SPC findObjectField("coneInsideAngle", %fileObj));
- %valueArray.add("coneOutsideAngle" SPC findObjectField("coneOutsideAngle", %fileObj));
- %valueArray.add("coneOutsideVolume" SPC findObjectField("coneOutsideVolume", %fileObj));
- %valueArray.add("rolloffFactor" SPC findObjectField("rolloffFactor", %fileObj));
- %valueArray.add("isStreaming" SPC findObjectField("isStreaming", %fileObj));
-
- if(isObject($ProjectImporter::SFXDescriptionCache))
- {
- $ProjectImporter::SFXDescriptionCache.add(%descriptionName, %objFileFinder);
- }
-
- for(%v=0; %v < %valueArray.Count(); %v++)
- {
- %varSet = %valueArray.getKey(%v);
- %var = getWord(%varSet, 0);
- %varVal = getWord(%varSet, 1);
-
- if(%varVal !$= "")
- %asset.setFieldValue(%var, %varVal);
- }
-
- %valueArray.delete();
- }
- }
- }
-
- TamlWrite(%asset, %tamlpath);
-
- %moduleDef = ModuleDatabase.findModule(%moduleName, 1);
- %success = AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
-
- if(!%success)
- return false;
-
- //Now mark the original SFXProfile for removal from the file as it's redundant
- //now that we have the asset def
- $ProjectImporter::ToRemoveObjectList.add(%objectName, %file TAB 0);
-
- return true;
-}
-
-function T3Dpre4ProjectImporter::processAudioProfileObject(%this, %file, %objectName)
- {
- return %this.processSFXProfileObject(%file, %objectName);
- }
-
-function T3Dpre4ProjectImporter::processSFXDescriptionObject(%this, %file, %objectName)
- {
- $ProjectImporter::ToRemoveObjectList.add(%objectName, %file TAB 0);
-
- return true;
-}
-
-function T3Dpre4ProjectImporter::processAudioDescriptionObject(%this, %file, %objectName)
-{
- $ProjectImporter::ToRemoveObjectList.add(%objectName, %file TAB 0);
-
- return true;
-}
-
-//==============================================================================
-// Misc Utility functions
-//==============================================================================
-//This is functionally identical to processLegacyField, but we have to special-snowflake our asset lookups
-//due to it using suffix-based indirections
-function processGuiBitmapButtonCtrlField(%line, %originalFieldName, %newFieldName)
-{
- if(!strIsMatchExpr("*"@%originalFieldName@"=*\"*\";*", %line) &&
- !strIsMatchExpr("*"@%originalFieldName@"[*=*\"*\";*", %line) &&
- !strIsMatchExpr("*"@%originalFieldName@" *=*\"*\";*", %line))
- return %line;
-
- %outLine = strreplace(%line, %originalFieldName, %newFieldName);
-
- //get the value
- %value = "";
- %pos = strpos(%outLine, "= \"");
- if(%pos != -1)
- {
- %endPos = strpos(%outLine, "\";", %pos);
-
- %value = getSubStr(%outLine, %pos+3, %endPos-%pos-3);
- }
- else
- {
- %pos = strpos(%outLine, "=\"");
- if(%pos != -1)
- {
- %endPos = strpos(%outLine, "\";", %pos);
-
- %value = getSubStr(%outLine, %pos+2, %endPos-%pos-2);
- }
- }
-
- if(%outLine !$= %line && %pos != -1 && %endPos != -1 && %value !$= "")
- {
- $ProjectImporter::log.add("Legacy Project Importer - processing legacy field line: " @ %line);
-
- if(startsWith(%value, "$") || startsWith(%value, "#"))
- {
- //These are going to be texture/render targets, and we can leave them alone
- return %line;
- }
-
- %targetFilename = sanitizeFilename(%value);
-
- //If we still have nothing, then we fail it out
- if(!isFile(%targetFilename))
- {
- $ProjectImporter::log.add("Legacy Project Importer - file described in line could not be found/is not valid");
- return %line;
- }
-
- $ProjectImporter::assetQuery.clear();
- %foundAssets = AssetDatabase.findAssetLooseFile($ProjectImporter::assetQuery, %targetFilename);
- if(%foundAssets != 0)
- {
- %assetId = $ProjectImporter::assetQuery.getAsset(0);
- $ProjectImporter::log.add("Legacy Project Importer - processing of legacy field line's value: " @ %value @ " has found a matching AssetId: " @ %assetId);
- }
-
- if(%assetId !$= "" && AssetDatabase.isDeclaredAsset(%assetId))
- {
- //if (%assetId.getStatusString() $= "Ok")
- %outLine = strReplace(%outLine, %value, %assetId);
- //else
- // error("Asset assignment failure:", %assetId, getStatusString());
- }
- }
-
- if(%outLine !$= %line)
- {
- $ProjectImporter::log.add("Legacy Project Importer - processing of legacy line: " @ %line @ " has been updated to: " @ %outLine);
- return %outLine;
- }
- else
- {
- return %line;
- }
-}
\ No newline at end of file
diff --git a/Templates/BaseGame/game/tools/projectImporter/scripts/projectImporter.tscript b/Templates/BaseGame/game/tools/projectImporter/scripts/projectImporter.tscript
index f00941776..8688df941 100644
--- a/Templates/BaseGame/game/tools/projectImporter/scripts/projectImporter.tscript
+++ b/Templates/BaseGame/game/tools/projectImporter/scripts/projectImporter.tscript
@@ -1,5 +1,7 @@
$ProjectImporter::rootDir = "tools";
+$ProjectImporter::writeToConsole = false;
+
function ProjectImporter::beginProjectImport()
{
Canvas.pushDialog(ProjectImportCtrl);
@@ -15,20 +17,36 @@ function ProjectImportWindow::onWake(%this)
else
$ProjectImporter::log.empty();
+ if(!isObject($ProjectImporter::importerList))
+ $ProjectImporter::importerList = new ArrayObject();
+ else
+ $ProjectImporter::importerList.empty();
+
+ //This array is for containing the importer pages for the wizard
+ if(!isObject($ProjectImporter::importerPageList))
+ $ProjectImporter::importerPageList = new ArrayObject();
+ else
+ $ProjectImporter::importerPageList.empty();
+
%this.importStepNumber = 0;
- %this-->stepsList.clear();
- %this-->stepsList.addRow(0, "Welcome");
- %this-->stepsList.addRow(1, "Previous Project Ver.");
- %this-->stepsList.addRow(2, "Locate Previous Project Content");
- %this-->stepsList.addRow(3, "Set New Module Name");
- %this-->stepsList.addRow(4, "Copy Old Files");
- %this-->stepsList.addRow(5, "Update Script Extensions");
- %this-->stepsList.addRow(6, "Import");
- %this-->stepsList.addRow(7, "Done");
- %this.stepCount = %this-->stepsList.rowCount()-1;
+ ProejctImportPageContainer.callOnChildren("setHidden", true);
- %this.showPage(0);
+ $ProjectImporter::importerPageList.add(ProjectImportWizardPage0);
+ $ProjectImporter::importerPageList.add(ProjectImportWizardPage1);
+ $ProjectImporter::importerPageList.add(ProjectImportWizardPage2);
+ $ProjectImporter::importerPageList.add(ProjectImportWizardPage3);
+ $ProjectImporter::importerPageList.add(ProjectImportWizardPage4);
+
+ %this.setStep(0);
+
+ //now we iterate over our importers to get them registered and set up
+ for( %file = findFirstFile( "tools/projectImporter/importers/*." @ $TorqueScriptFileExtension );
+ %file !$= "";
+ %file = findNextFile( "tools/projectImporter/importers/*." @ $TorqueScriptFileExtension ))
+ {
+ exec( %file );
+ }
}
function ProjectImportWindow::previousStep(%this)
@@ -38,12 +56,14 @@ function ProjectImportWindow::previousStep(%this)
%this.importStepNumber--;
+ %this.pageChanged = true;
+
%this.showPage(%this.importStepNumber);
}
function ProjectImportWindow::nextStep(%this)
{
- if(%this.importStepNumber == %this.stepCount)
+ if(%this.importStepNumber == $ProjectImporter::importerPageList.count())
{
Canvas.popDialog(ProjectImportCtrl);
return;
@@ -51,12 +71,14 @@ function ProjectImportWindow::nextStep(%this)
%this.importStepNumber++;
+ %this.pageChanged = true;
+
%this.showPage(%this.importStepNumber);
}
function ProjectImportWindow::setStep(%this, %stepNum)
{
- if(%stepNum >= %this.stepCount)
+ if(%stepNum >= $ProjectImporter::importerPageList.count())
{
Canvas.popDialog(ProjectImportCtrl);
return;
@@ -67,6 +89,8 @@ function ProjectImportWindow::setStep(%this, %stepNum)
%this.importStepNumber = %stepNum;
+ %this.pageChanged = true;
+
%this.showPage(%this.importStepNumber);
}
@@ -95,27 +119,42 @@ function ProjectImportWindow::selectOGFolder(%this)
%dlg.delete();
}
+function ProjectImportWindow::refreshPage(%this)
+{
+ for(%i=0; %i < $ProjectImporter::importerPageList.count(); %i++)
+ {
+ %page = $ProjectImporter::importerPageList.getKey(%i);
+ %page.setHidden(true);
+ %page.callOnChildren("setHidden", true);
+ }
+
+ %page = $ProjectImporter::importerPageList.getKey(%this.importStepNumber);
+ %page.setHidden(false);
+ %page.callOnChildren("setHidden", false);
+}
+
function ProjectImportWindow::showPage(%this, %pageIndex)
{
- if(%pageIndex < 0 || %pageIndex > %this.stepCount)
+ if(%pageIndex < 0 || %pageIndex > $ProjectImporter::importerPageList.count())
return;
%this.importStepNumber = %pageIndex;
- %this-->stepsList.clearSelection();
- %this-->stepsList.setSelectedById(%this.importStepNumber);
- for(%i=0; %i < %this-->stepsList.rowCount(); %i++)
+ %this.refreshPage();
+
+ if(%this.pageChanged)
{
- (ProjectImportWizardPage @ %i).setHidden(true);
+ //run page logic
+ %page = $ProjectImporter::importerPageList.getKey(%this.importStepNumber);
+ %page.openPage();
}
- (ProjectImportWizardPage @ %this.importStepNumber).setHidden(false);
- (ProjectImportWizardPage @ %this.importStepNumber).openPage();
+ %this.pageChanged = false;
}
function ProjectImportWindow::getCurrentPage(%this)
{
- return (ProjectImportWizardPage @ %this.importStepNumber);
+ return $ProjectImporter::importerPageList.getKey(%this.importStepNumber);
}
function ProjectImportWizardPage0::openPage(%this)
@@ -123,24 +162,19 @@ function ProjectImportWizardPage0::openPage(%this)
ProjectImportWindow-->backButton.setHidden(true);
}
-function ProjectImportWizardPage0::processPage(%this)
-{
-}
-
function ProjectImportWizardPage1::openPage(%this)
{
ProjectImportWindow-->backButton.setHidden(false);
%this-->previousContentVersionPopup.clear();
- //this-->previousContentVersionPopup.add("Torque Game Engine");
- //%this-->previousContentVersionPopup.add("Torque Shader Engine");
- %this-->previousContentVersionPopup.add("Torque 3D Pre-4.0");
-}
-
-function ProjectImportWizardPage1::processPage(%this)
-{
+
+ for(%i=0; %i < $ProjectImporter::importerList.count(); %i++)
+ {
+ %this-->previousContentVersionPopup.add($ProjectImporter::importerList.getKey(%i));
+ }
}
+//Select destination folder
function ProjectImportWizardPage2::openPage(%this)
{
%version = ProjectImportWizardPage1-->previousContentVersionPopup.getSelected();
@@ -151,45 +185,73 @@ function ProjectImportWizardPage2::openPage(%this)
return;
}
- ProjectImportWizardPage2-->internalFolderBtn.setStateOn(false);
- ProjectImportWizardPage2-->externalFolderBtn.setStateOn(false);
- ProjectImportWizardPage2-->coreAndToolsBtn.setStateOn(false);
$ProjectImporter::sourceContentFolder = "";
%this-->targetImportingPath.setText("");
Canvas.repaint(); //force it to refresh the page so we're up to date.
- switch$(%version)
- {
- case 0:
- $ProjectImporter::versionMode = "T3Dpre4Project";
- default:
- $ProjectImporter::versionMode = "T3Dpre4Project";
- }
+ $ProjectImporter::versionMode = $ProjectImporter::importerList.getKey(%version);
if(isObject($ProjectImporter::importTool))
$ProjectImporter::importTool.delete();
- $ProjectImporter::importTool = new ScriptObject($ProjectImporter::versionMode @ "Importer");
+ $ProjectImporter::importTool = $ProjectImporter::importerList.getValue(%version);
- if(isObject($ProjectImporter::SFXDescriptionCache))
- $ProjectImporter::SFXDescriptionCache.delete();
+ //if(isObject($ProjectImporter::SFXDescriptionCache))
+ // $ProjectImporter::SFXDescriptionCache.delete();
- $ProjectImporter::SFXDescriptionCache = new ArrayObject();
+ //$ProjectImporter::SFXDescriptionCache = new ArrayObject();
- if(isObject($ProjectImporter::ToRemoveObjectList))
- $ProjectImporter::ToRemoveObjectList.delete();
+ //if(isObject($ProjectImporter::ToRemoveObjectList))
+ // $ProjectImporter::ToRemoveObjectList.delete();
- $ProjectImporter::ToRemoveObjectList = new ArrayObject();
-}
-
-function ProjectImportWizardPage2::processPage(%this)
-{
+ //$ProjectImporter::ToRemoveObjectList = new ArrayObject();
+
+ $ProjectImporter::importTool.setupPages(); //Have the importer register it's pages
+
+ //And then add our final page
+ $ProjectImporter::importerPageList.add(ProjectImportWizardFinalPage);
}
function ProjectImportWizardPage3::openPage(%this)
{
- if(ProjectImportWizardPage2-->internalFolderBtn.isStateOn())
+ %dataFullPath = makeFullPath("data/");
+ %coreFullPath = makeFullPath("core/");
+ %toolsFullPath = makeFullPath("tools/");
+ if(startsWith(makeFullPath("data/"), $ProjectImporter::sourceContentFolder))
+ {
+ %moduleDef = AssetBrowser.dirHandler.getModuleFromAddress(makeRelativePath($ProjectImporter::sourceContentFolder));
+ if(isObject(%moduleDef))
+ {
+ //already a valid module in place so just skip this step
+ $ProjectImporter::useExistingModule = true;
+ $ProjectImporter::moduleName = %moduleDef.moduleId;
+ $ProjectImporter::modulePath = "data/" @ $ProjectImporter::moduleName;
+ ProjectImportWindow.setStep(4);
+ }
+ }
+ else if(startsWith(makeFullPath("core/"), $ProjectImporter::sourceContentFolder) ||
+ startsWith(makeFullPath("tools/"), $ProjectImporter::sourceContentFolder))
+ {
+ ProjectImportWindow.setStep(5);
+ }
+ else
+ {
+ %slashCount = getTokenCount($ProjectImporter::sourceContentFolder, "/");
+ %topFolder = getToken($ProjectImporter::sourceContentFolder, "/", %slashCount-1);
+ if(%topFolder $= "")
+ %topFolder = getToken($ProjectImporter::sourceContentFolder, "/", %slashCount-2);
+
+ //clean up invalid characters and stuff
+ %topFolder = sanitizeString(%topFolder);
+
+ $ProjectImporter::useExistingModule = false;
+ $ProjectImporter::moduleName = %topFolder; //preseed the module name
+ $ProjectImporter::modulePath = "data/" @ $ProjectImporter::moduleName;
+
+ ProjectImportWizardPage3-->newModuleName.setText($ProjectImporter::moduleName);
+ }
+ /*if(ProjectImportWizardPage2-->internalFolderBtn.isStateOn())
{
$ProjectImporter::importMode = "InternalFolder";
}
@@ -246,15 +308,373 @@ function ProjectImportWizardPage3::openPage(%this)
else if($ProjectImporter::importMode $= "CoreAndTools")
{
ProjectImportWindow.setStep(5);
- }
+ }*/
}
-function ProjectImportWizardPage3::processPage(%this)
+//
+function preprocessImportingFiles()
{
+ //========================================================
+ //BEGIN THE PREPROCESS
+ if(isObject($ProjectImporter::FileList))
+ $ProjectImporter::FileList.delete();
+
+ $ProjectImporter::FileList = new ArrayObject();
+
+ %file = findFirstFileMultiExpr( $ProjectImporter::sourceContentFolder @ "/*.*", true);
+
+ //First, we go through and tabulate all valid files we'll want to copy over into
+ //our destination point. We're not copying them yet, but we're building the list
+ while( %file !$= "" )
+ {
+ %fileExt = fileExt(%file);
+
+ if(%fileExt $= ".dll" || %fileExt $= ".log" || %fileExt $= ".exe" || %fileExt $= ".manifest"|| %fileExt $= ".h" ||
+ %fileExt $= ".cpp" || %fileExt $= ".so" || %fileExt $= ".do" || %fileExt $= ".lib" ||%fileExt $= ".exp")
+ {
+ %file = findNextFileMultiExpr( $ProjectImporter::sourceContentFolder @ "/*.*" );
+ continue;
+ }
+
+ %fileArrayObj = new ArrayObject();
+
+ %fileArrayObj.fileDestination = strreplace(%file, $ProjectImporter::sourceContentFolder, $ProjectImporter::modulePath);
+ %fileArrayObj.fileDestination = sanitizeFilename(%fileArrayObj.fileDestination);
+
+ %fileArrayObj.imported = false;
+
+ //if it was a cs file, we'll be changing the eventual destination extension to comply to
+ //our set script extension
+ if(fileExt(%fileArrayObj.fileDestination) $= ".cs")
+ {
+ %fileArrayObj.fileDestination = filePath(%fileArrayObj.fileDestination) @ "/" @ fileBase(%fileArrayObj.fileDestination) @ "." @ $TorqueScriptFileExtension;
+ }
+
+ $ProjectImporter::FileList.add(%file, %fileArrayObj);
+
+ %file = findNextFileMultiExpr( $ProjectImporter::sourceContentFolder @ "/*.*" );
+ }
+
+ $ProjectImporter::fileElementStack = new ArrayObject();
+
+ //Now that we've got the list of files we consider to be valid to import,
+ //we'll preprocess them. This lets us 'understand' the contents and for
+ //script-type files, we can parse them to figure out object defines and the like
+ //which will simplify things when we actually apply any changes to update it to
+ //the new project format later
+ for(%i=0; %i < $ProjectImporter::FileList.count(); %i++)
+ {
+ %file = $ProjectImporter::FileList.getKey(%i);
+ %rootFileSectionObject = $ProjectImporter::FileList.getValue(%i);
+
+ %fileExt = fileExt(%file);
+
+ %rootFileSectionObject.fileName = fileName(%file);
+ %rootFileSectionObject.fileBase = fileBase(%file);
+ %rootFileSectionObject.fileExt = %fileExt;
+
+ if(endsWith(%file, ".asset.taml"))
+ {
+ %rootFileSectionObject.fileExt = ".asset.taml";
+ %rootFileSectionObject.isAssetFile = true;
+ }
+ else if(%fileExt !$= ".cs" && %fileExt !$= ".tscript" && %fileExt !$= ".gui" &&
+ %fileExt !$= ".mis" && %fileExt !$= ".prefab" && %fileExt !$= ".module")
+ {
+ //we don't do this for binary files, for...obvious reasons
+
+ %rootFileSectionObject.binaryFile = true;
+
+ if(isImageFormat(%fileExt))
+ %rootFileSectionObject.isImageFile = true;
+ else if(isShapeFormat(%fileExt))
+ %rootFileSectionObject.isShapeFile = true;
+ else if(isSoundFormat(%fileExt))
+ %rootFileSectionObject.isSoundFile = true;
+ else if(%fileExt $= ".ter")
+ %rootFileSectionObject.isTerrainFile = true;
+ continue;
+ }
+
+ %rootFileSectionObject.binaryFile = false;
+ %currentFileSectionObject = %rootFileSectionObject;
+ %insideFunction = false;
+ %insideObjectBlock = false;
+ %insideCommentBlock = false;
+
+ if ( $ProjectImporter::fileObject.openForRead( %file ) )
+ {
+ echo("Processing File: " @ %file);
+ echo("-------------------------------------");
+
+ while ( !$ProjectImporter::fileObject.isEOF() )
+ {
+ %line = $ProjectImporter::fileObject.readLine();
+
+ if(strIsMatchExpr("*new*(*)*", %line) && !strIsMatchExpr("*\"*new*(*)*\"*", %line))
+ {
+ %start = strpos(%line, "new ");
+ %end = strpos(%line, "(", %start);
+
+ if(%start != -1 && %end != -1)
+ {
+ %className = getSubStr(%line, %start + 4, %end-%start-4);
+ }
+
+ %nameEnd = strpos(%line, ")", %end);
+
+ %objectName = getSubStr(%line, %end+1, %nameEnd-%end-1);
+
+ %inheritanceSplit = strpos(%objectName, ":");
+ if(%inheritanceSplit != -1)
+ {
+ %objectName = getSubStr(%objectName, 0, %inheritanceSplit);
+ }
+
+ %parentFileSectionObject = %currentFileSectionObject;
+
+ %currentFileSectionObject = new ArrayObject();
+ %currentFileSectionObject.elementType = "object";
+ %currentFileSectionObject.classType = %className;
+ %currentFileSectionObject.objectName = %objectName;
+ %currentFileSectionObject.fileName = %file;
+ %currentFileSectionObject.skip = false;
+ %currentFileSectionObject.fileDestination = %rootFileSectionObject.fileDestination;
+ %insideObjectBlock = true;
+
+ %currentFileSectionObject.add(%line);
+
+ %parentFileSectionObject.add(%currentFileSectionObject);
+
+ //Now for a sanity check, see if we kill the object on the same line as we make it
+ //sometimes people try and be 'efficient' with their code linecount wise
+ if(strIsMatchExpr("*};*", %line))
+ {
+ %currentFileSectionObject = %parentFileSectionObject;
+
+ %insideFunction = false;
+ %insideObjectBlock = false;
+
+ if(%currentFileSectionObject.elementType $= "function")
+ %insideFunction = true;
+ if(%currentFileSectionObject.elementType $= "object")
+ %insideObjectBlock = true;
+ }
+ }
+ else if(strIsMatchExpr("*datablock*(*)*", %line))
+ {
+ %start = strpos(%line, "datablock ");
+ %end = strpos(%line, "(", %start);
+
+ if(%start != -1 && %end != -1)
+ {
+ %className = getSubStr(%line, %start + 10, %end-%start-10);
+ }
+
+ %nameEnd = strpos(%line, ")", %end);
+
+ %objectName = getSubStr(%line, %end+1, %nameEnd-%end-1);
+
+ %inheritanceSplit = strpos(%objectName, ":");
+ if(%inheritanceSplit != -1)
+ {
+ %objectName = getSubStr(%objectName, 0, %inheritanceSplit);
+ }
+
+ %parentFileSectionObject = %currentFileSectionObject;
+
+ %currentFileSectionObject = new ArrayObject();
+ %currentFileSectionObject.elementType = "object";
+ %currentFileSectionObject.classType = %className;
+ %currentFileSectionObject.objectName = %objectName;
+ %currentFileSectionObject.fileName = %file;
+ %currentFileSectionObject.skip = false;
+ %currentFileSectionObject.fileDestination = %rootFileSectionObject.fileDestination;
+ %insideObjectBlock = true;
+
+ %currentFileSectionObject.add(%line);
+
+ %parentFileSectionObject.add(%currentFileSectionObject);
+
+ //Now for a sanity check, see if we kill the object on the same line as we make it
+ //sometimes people try and be 'efficient' with their code linecount wise
+ if(strIsMatchExpr("*};*", %line))
+ {
+ %currentFileSectionObject = %parentFileSectionObject;
+
+ %insideFunction = false;
+ %insideObjectBlock = false;
+
+ if(%currentFileSectionObject.elementType $= "function")
+ %insideFunction = true;
+ if(%currentFileSectionObject.elementType $= "object")
+ %insideObjectBlock = true;
+ }
+ }
+ else if(strIsMatchExpr("*singleton*(*)*", %line))
+ {
+ %start = strpos(%line, "singleton ");
+ %end = strpos(%line, "(", %start);
+
+ if(%start != -1 && %end != -1)
+ {
+ %className = getSubStr(%line, %start + 10, %end-%start-10);
+ }
+
+ %nameEnd = strpos(%line, ")", %end);
+
+ %objectName = getSubStr(%line, %end+1, %nameEnd-%end-1);
+
+ %inheritanceSplit = strpos(%objectName, ":");
+ if(%inheritanceSplit != -1)
+ {
+ %objectName = getSubStr(%objectName, 0, %inheritanceSplit);
+ }
+
+ %parentFileSectionObject = %currentFileSectionObject;
+
+ %currentFileSectionObject = new ArrayObject();
+ %currentFileSectionObject.elementType = "object";
+ %currentFileSectionObject.classType = %className;
+ %currentFileSectionObject.objectName = %objectName;
+ %currentFileSectionObject.fileName = %file;
+ %currentFileSectionObject.skip = false;
+ %currentFileSectionObject.fileDestination = %rootFileSectionObject.fileDestination;
+ %insideObjectBlock = true;
+
+ %currentFileSectionObject.add(%line);
+
+ %parentFileSectionObject.add(%currentFileSectionObject);
+
+ //Now for a sanity check, see if we kill the object on the same line as we make it
+ //sometimes people try and be 'efficient' with their code linecount wise
+ if(strIsMatchExpr("*};*", %line))
+ {
+ %currentFileSectionObject = %parentFileSectionObject;
+
+ %insideFunction = false;
+ %insideObjectBlock = false;
+
+ if(%currentFileSectionObject.elementType $= "function")
+ %insideFunction = true;
+ if(%currentFileSectionObject.elementType $= "object")
+ %insideObjectBlock = true;
+ }
+ }
+ else if(strIsMatchExpr("*function*(*)*", %line))
+ {
+ %start = strpos(%line, "function ");
+ %end = strpos(%line, "(", %start);
+
+ if(%start != -1 && %end != -1)
+ {
+ %functionName = getSubStr(%line, %start + 9, %end-%start-9);
+ }
+
+ %parentFileSectionObject = %currentFileSectionObject;
+
+ %currentFileSectionObject = new ArrayObject();
+ %currentFileSectionObject.elementType = "function";
+ %currentFileSectionObject.functionName = %functionName;
+ %currentFileSectionObject.fileDestination = %rootFileSectionObject.fileDestination;
+ %currentFileSectionObject.scopeDepth = 0;
+
+ %insideFunction = true;
+ %insideObjectBlock = false;
+
+ %currentFileSectionObject.add(%line);
+
+ %parentFileSectionObject.add(%currentFileSectionObject);
+
+ if(strIsMatchExpr("*{*", %line))
+ {
+ %currentFileSectionObject.scopeDepth++;
+ }
+ if(strIsMatchExpr("*}*", %line))
+ {
+ %currentFileSectionObject.scopeDepth--;
+
+ if(%currentFileSectionObject.scopeDepth == 0) //we've fully backed out of the function scope, so resolve back to the parent
+ {
+ %currentFileSectionObject = %parentFileSectionObject;
+
+ %insideFunction = false;
+ %insideObjectBlock = false;
+
+ if(%currentFileSectionObject.elementType $= "function")
+ %insideFunction = true;
+ if(%currentFileSectionObject.elementType $= "object")
+ %insideObjectBlock = true;
+ }
+ }
+ }
+ else
+ {
+ %currentFileSectionObject.add(%line);
+
+ if(%insideFunction && strIsMatchExpr("*{*", %line))
+ {
+ %currentFileSectionObject.scopeDepth++;
+ }
+ if(%insideFunction && strIsMatchExpr("*}*", %line))
+ {
+ %currentFileSectionObject.scopeDepth--;
+
+ if(%currentFileSectionObject.scopeDepth == 0) //we've fully backed out of the function scope, so resolve back to the parent
+ {
+ %currentFileSectionObject = %parentFileSectionObject;
+
+ %insideFunction = false;
+ %insideObjectBlock = false;
+
+ if(%currentFileSectionObject.elementType $= "function")
+ %insideFunction = true;
+ if(%currentFileSectionObject.elementType $= "object")
+ %insideObjectBlock = true;
+ }
+ }
+ else if(%insideObjectBlock && strIsMatchExpr("*};*", %line) && !strIsMatchExpr("*\"*};*\";*", %line))
+ {
+ %currentFileSectionObject = %parentFileSectionObject;
+
+ %insideFunction = false;
+ %insideObjectBlock = false;
+
+ if(%currentFileSectionObject.elementType $= "function")
+ %insideFunction = true;
+ if(%currentFileSectionObject.elementType $= "object")
+ %insideObjectBlock = true;
+ }
+ else if(!%insideFunction && !%insideObjectBlock)
+ {
+ if(strIsMatchExpr("*/\**", %line))
+ {
+ %insideCommentBlock = true;
+ }
+ else if(%insideCommentBlock && strIsMatchExpr("*\*/*", %line))
+ {
+ %insideCommentBlock = false;
+ }
+ else if(!%insideCommentBlock && !strIsMatchExpr("*//*", %line))
+ {
+ %rootFileSectionObject.hasNonCommentFloatingCode = true;
+ }
+ }
+ }
+ }
+ }
+
+ $ProjectImporter::fileObject.close();
+ }
}
+//
function ProjectImportWizardPage4::openPage(%this)
{
+ ProjectImportWindow-->preprocessCompleteText.setHidden(true);
+
+ Canvas.repaint();
+
ProjectImportWindow-->backButton.setHidden(true);
ProjectImportWindow-->nextButton.setActive(false);
@@ -270,14 +690,10 @@ function ProjectImportWizardPage4::openPage(%this)
%sourcePath = $ProjectImporter::sourceContentFolder;
%targetPath = makeFullPath($ProjectImporter::modulePath);
- //If the source path starts with the module target path at all, we're already that folder, or a subfolder in it, so skip filecopy
- if(!startsWith(%sourcePath, %targetPath))
- $ProjectImporter::importTool.copyFiles();
- else
- ProjectImportWindow.nextStep();
+ preprocessImportingFiles();
//if we gen'd a new module setup, double check we didn't copy over a module script file under a legacy extension
- if(!$ProjectImporter::useExistingModule)
+ /*if(!$ProjectImporter::useExistingModule)
{
%newModuleName = $ProjectImporter::moduleName;
%moduleFilePath = "data/" @ %newModuleName;
@@ -291,11 +707,12 @@ function ProjectImportWizardPage4::openPage(%this)
fileDelete(%moduleFilePath @ "/" @ %newModuleName @ "." @ $TorqueScriptFileExtension);
}
}
- }
-}
+ }*/
-function ProjectImportWizardPage4::processPage(%this)
-{
+ ProjectImportWindow-->nextButton.setActive(true);
+ ProjectImportWindow-->preprocessCompleteText.setHidden(false);
+
+ Canvas.repaint();
}
function ProjectImportWizardPage5::openPage(%this)
@@ -306,10 +723,6 @@ function ProjectImportWizardPage5::openPage(%this)
$ProjectImporter::importTool.processImportedFiles();
}
-function ProjectImportWizardPage5::processPage(%this)
-{
-}
-
function ProjectImportWizardPage6::openPage(%this)
{
ProjectImportWindow-->nextButton.setActive(false);
@@ -351,11 +764,7 @@ function ProjectImportWizardPage6::openPage(%this)
}
}
-function ProjectImportWizardPage6::processPage(%this)
-{
-}
-
-function ProjectImportWizardPage7::openPage(%this)
+function ProjectImportWizardFinalPage::openPage(%this)
{
//writing console log
%logFileObj = new FileObject();
@@ -375,11 +784,19 @@ function ProjectImportWizardPage7::openPage(%this)
%logFileObj.delete();
}
+//
+function ProjectImportWindow::addImporterPage(%this, %page)
+{
+ ProejctImportPageContainer.add(%page);
+ $ProjectImporter::importerPageList.add(%page);
+}
+//
+
function beginProjectImport()
{
- $ProjectImporter::log.add("===========================================");
- $ProjectImporter::log.add("Beginning Project Import");
- $ProjectImporter::log.add("===========================================");
+ projectImporterLog("===========================================");
+ projectImporterLog("Beginning Project Import");
+ projectImporterLog("===========================================");
$ProjectImporter::assetQuery = new AssetQuery();
$ProjectImporter::importer = new AssetImporter();
@@ -410,9 +827,9 @@ function beginProjectImport()
$ProjectImporter::importer.delete();
$ProjectImporter::persistMgr.delete();
- $ProjectImporter::log.add("===========================================");
- $ProjectImporter::log.add("Finished Project Import");
- $ProjectImporter::log.add("===========================================");
+ projectImporterLog("===========================================");
+ projectImporterLog("Finished Project Import");
+ projectImporterLog("===========================================");
AssetBrowser.refresh(); //update the AB just in case
}
@@ -478,7 +895,7 @@ function sanitizeFilename(%file)
%targetFilename = %targetPath @ "/" @ %targetName @ %targetExt;
}
- if(!isFile(%targetFilename))
+ /*if(!isFile(%targetFilename))
{
%bitmapFile = %targetPath @ "/" @ %targetName @ "_n" @ %targetExt;
if(isFile(%bitmapFile))
@@ -497,9 +914,22 @@ function sanitizeFilename(%file)
return %file;
}
else
- {
+ {*/
return %targetFilename;
+ //}
+}
+
+function isImportingFile(%checkFile)
+{
+ for(%i=0; %i < $ProjectImporter::FileList.count(); %i++)
+ {
+ %file = $ProjectImporter::FileList.getKey(%i);
+
+ if(%file $= %checkFile)
+ return true;
}
+
+ return false;
}
function testFilenameExtensions(%filename)
@@ -560,7 +990,7 @@ function processLegacyField(%line, %originalFieldName, %newFieldName)
if(%outLine !$= %line && %pos != -1 && %endPos != -1 && %value !$= "")
{
- $ProjectImporter::log.add("Legacy Project Importer - processing legacy field line: " @ %line);
+ projectImporterLog("Legacy Project Importer - processing legacy field line: " @ %line);
if(startsWith(%value, "$") || startsWith(%value, "#"))
{
@@ -570,6 +1000,12 @@ function processLegacyField(%line, %originalFieldName, %newFieldName)
%targetFilename = sanitizeFilename(%value);
+ %fileExt = fileExt(%targetFilename);
+ if(%fileExt $= "")
+ {
+ %targetFilename = testFilenameExtensions(%targetFilename);
+ }
+
if(isObject(%targetFilename))
{
//likely a material name, so handle it that way
@@ -591,18 +1027,17 @@ function processLegacyField(%line, %originalFieldName, %newFieldName)
{
if(!isFile(%targetFilename))
{
- if(%originalFieldName $= "soundProfile")
+ //We may just have a discrete name we need to look up instead
+ $ProjectImporter::assetQuery.clear();
+ %foundAssets = AssetDatabase.findAssetName($ProjectImporter::assetQuery, %targetFilename);
+ if(%foundAssets != 0)
{
- $ProjectImporter::assetQuery.clear();
- %foundAssets = AssetDatabase.findAssetName($ProjectImporter::assetQuery, %targetFilename);
- if(%foundAssets != 0)
- {
- %assetId = $ProjectImporter::assetQuery.getAsset(0);
- }
+ %assetId = $ProjectImporter::assetQuery.getAsset(0);
}
else
{
- $ProjectImporter::log.add("Legacy Project Importer - file described in line could not be found/is not valid");
+ //Ultimately, we didn't find it and need to cut our losses
+ projectImporterLog("Legacy Project Importer - file described in line could not be found/is not valid");
return %line;
}
}
@@ -619,7 +1054,7 @@ function processLegacyField(%line, %originalFieldName, %newFieldName)
if(%assetId !$= "" && AssetDatabase.isDeclaredAsset(%assetId))
{
- $ProjectImporter::log.add("Legacy Project Importer - processing of legacy field line's value: " @ %value @ " has found a matching AssetId: " @ %assetId);
+ projectImporterLog("Legacy Project Importer - processing of legacy field line's value: " @ %value @ " has found a matching AssetId: " @ %assetId);
//double check if this already had the quotes around the value or not
if(!strIsMatchExpr("*\"*\"*", %originalValue))
@@ -634,7 +1069,7 @@ function processLegacyField(%line, %originalFieldName, %newFieldName)
if(%outLine !$= %line)
{
- $ProjectImporter::log.add("Legacy Project Importer - processing of legacy line: " @ %line @ " has been updated to: " @ %outLine);
+ projectImporterLog("Legacy Project Importer - processing of legacy line: " @ %line @ " has been updated to: " @ %outLine);
return %outLine;
}
else
@@ -672,7 +1107,7 @@ function processLegacyShapeConstructorField(%line)
if(%foundAssets != 0)
{
%assetId = $ProjectImporter::assetQuery.getAsset(0);
- $ProjectImporter::log.add("Legacy Project Importer - processing of legacy shape constructor addSequence line's value: " @ %animSourcePath @ " has found a matching AssetId: " @ %assetId);
+ projectImporterLog("Legacy Project Importer - processing of legacy shape constructor addSequence line's value: " @ %animSourcePath @ " has found a matching AssetId: " @ %assetId);
}
if(%assetId !$= "" && AssetDatabase.isDeclaredAsset(%assetId))
@@ -685,7 +1120,7 @@ function processLegacyShapeConstructorField(%line)
if(%outLine !$= %line)
{
- $ProjectImporter::log.add("Legacy Project Importer - processing of legacy shape constructor addSequence line: " @ %line @ " has been updated to: " @ %outLine);
+ projectImporterLog("Legacy Project Importer - processing of legacy shape constructor addSequence line: " @ %line @ " has been updated to: " @ %outLine);
return %outLine;
}
else
@@ -694,256 +1129,226 @@ function processLegacyShapeConstructorField(%line)
}
}
-function findObjectClass(%line, %createWord)
+function renameObjectName(%object, %newName)
{
- //we have a new object, add it to the stack
- //substr to peel the class name
- %start = strpos(%line, %createWord @ " ");
- %end = strpos(%line, "(", %start);
- %createLen = strlen(%createWord @ " ");
-
- if(%start != -1 && %end != -1)
+ for(%e=0; %e < %object.count(); %e++)
{
- %className = getSubStr(%line, %start + %createLen, %end-%start-%createLen);
-
- %className = trim(%className);
-
- return %className;
- }
-
- return "";
-}
-
-function findObjectName(%line, %createWord)
-{
- //we have a new object, add it to the stack
- //substr to peel the class name
- %start = strpos(%line, %createWord @ " ");
- %end = strpos(%line, "(", %start);
-
- %nameEnd = strpos(%line, ")", %end);
-
- %objectName = getSubStr(%line, %end+1, %nameEnd-%end-1);
-
- if(%objectName !$= "")
- {
- if(strpos(%objectName, ":") != -1)
+ %objectLine = %object.getKey(%e);
+ if(!isObject(%objectLine))
{
- %objectName = getSubStr(%objectName, 0, strpos(%objectName, ":"));
- }
-
- if(strpos(%objectName, ",") != -1)
- {
- %objectName = getSubStr(%objectName, 0, strpos(%objectName, ","));
- }
-
- %objectName = trim(%objectName);
- }
-
- return %objectName;
-}
-
-function findObjectField(%fieldName, %fileObj)
-{
- if(%fileObj $= "")
- %fileObj = $ProjectImporter::fileObject;
-
- %value = "";
- %peekLineOffset = 0;
- %peekLine = %fileObj.peekLine(%peekLineOffset);
- while(!strIsMatchExpr("*};*", %peekLine) &&
- !strIsMatchExpr("*singleton*(*)*", %peekLine) &&
- !strIsMatchExpr("*new*(*)*", %peekLine) &&
- !strIsMatchExpr("*datablock*(*)*", %peekLine)&&
- !strIsMatchExpr("\n", %peekLine) &&
- !strIsMatchExpr("\r", %peekLine))
- {
- if(strpos(strlwr(%peekLine), strlwr(%fieldName)) != -1)
- {
- %value = "";
- %pos = strpos(%peekLine, "= \"");
- if(%pos != -1)
+ if(strIsMatchExpr("*singleton*(*)*", %objectLine) &&
+ strIsMatchExpr("*new*(*)*", %objectLine) &&
+ strIsMatchExpr("*datablock*(*)*", %objectLine))
{
- %endPos = strpos(%peekLine, "\";", %pos);
-
- %value = getSubStr(%peekLine, %pos+3, %endPos-%pos-3);
- break;
- }
-
- %pos = strpos(%peekLine, "=\"");
- if(%pos != -1)
- {
- %endPos = strpos(%peekLine, "\";", %pos);
-
- %value = getSubStr(%peekLine, %pos+2, %endPos-%pos-2);
- break;
- }
-
- %pos = strpos(%peekLine, "= ");
- if(%pos != -1)
- {
- %endPos = strpos(%peekLine, ";", %pos);
-
- %value = getSubStr(%peekLine, %pos+2, %endPos-%pos-2);
- break;
- }
-
- %pos = strpos(%peekLine, "=");
- if(%pos != -1)
- {
- %endPos = strpos(%peekLine, ";", %pos);
-
- %value = getSubStr(%peekLine, %pos+2, %endPos-%pos-2);
- break;
+ %newLine = strreplace(%object.objectName, %newName);
+
+ echo("renameObjectName() - lines changed from:");
+ echo(%objectLine);
+ echo("to:");
+ echo(%newLine);
+
+ %object.setKey(%newLine, %e);
}
}
-
- %peekLineOffset++;
- %peekLine = %fileObj.peekLine(%peekLineOffset);
- }
-
- return %value;
-}
-
-function findObjectInFiles(%objectName)
-{
- //First, wipe out any files inside the folder first
- %file = findFirstFileMultiExpr( "*.*", true);
-
- %fileObj = new FileObject();
-
- while( %file !$= "" )
- {
- %filename = fileName(%file);
- %fileBase = fileBase(%file);
- %fileExt = fileExt(%file);
- %filePath = filePath(%file);
-
- if ( %fileObj.openForRead( %file ) )
- {
- %lineNum = 0;
- while ( !%fileObj.isEOF() )
- {
- %line = %fileObj.readLine();
- %trimmedLine = trim(%line);
-
- if(strIsMatchExpr("*new*(*)*", %line) && strpos(%line, "::") == -1)
- {
- %className = findObjectClass(%line, "new");
- if (%className $= "") continue;
-
- %objName = findObjectName(%line, "new");
-
- if(%objectName $= %objName)
- {
- return %fileObj TAB %file TAB %lineNum;
- }
- }
- else if(strIsMatchExpr("*datablock*(*)*", %line) && strpos(%line, "::") == -1)
- {
- %className = findObjectClass(%line, "datablock");
- if (%className $= "") continue;
-
- %objName = findObjectName(%line, "datablock");
-
- if(%objectName $= %objName)
- {
- return %fileObj TAB %file TAB %lineNum;
- }
- }
- else if(strIsMatchExpr("*singleton*(*)*", %line) && strpos(%line, "::") == -1)
- {
- %className = findObjectClass(%line, "singleton");
- if (%className $= "") continue;
-
- %objName = findObjectName(%line, "singleton");
-
- if(%objectName $= %objName)
- {
- return %fileObj TAB %file TAB %lineNum;
- }
- }
-
- %lineNum++;
- }
-
- %fileObj.close();
- }
- else
- {
- $ProjectImporter::log.add("findObjectInFiles() - File not able to be opened: " @ %file);
- }
-
- %file = findNextFileMultiExpr( "*.*" );
}
-
- %fileObj.delete();
-
- return "";
}
+
+function findObjectField(%object, %fieldName)
+{
+ %return = "";
+ for(%e=0; %e < %object.count(); %e++)
+ {
+ %objectLine = %object.getKey(%e);
+ if(!isObject(%objectLine))
+ {
+ if(!strIsMatchExpr("*};*", %objectLine) &&
+ !strIsMatchExpr("*singleton*(*)*", %objectLine) &&
+ !strIsMatchExpr("*new*(*)*", %objectLine) &&
+ !strIsMatchExpr("*datablock*(*)*", %objectLine)&&
+ !strIsMatchExpr("\n", %objectLine) &&
+ !strIsMatchExpr("\r", %objectLine))
+ {
+ if(strpos(strlwr(%objectLine), strlwr(%fieldName)) != -1)
+ {
+ %pos = strpos(%objectLine, "= \"");
+ if(%pos != -1)
+ {
+ %endPos = strpos(%objectLine, "\";", %pos);
+
+ %return = getSubStr(%objectLine, %pos+3, %endPos-%pos-3);
+ break;
+ }
+
+ %pos = strpos(%objectLine, "=\"");
+ if(%pos != -1)
+ {
+ %endPos = strpos(%objectLine, "\";", %pos);
+
+ %return = getSubStr(%objectLine, %pos+2, %endPos-%pos-2);
+ break;
+ }
+
+ %pos = strpos(%objectLine, "= ");
+ if(%pos != -1)
+ {
+ %endPos = strpos(%objectLine, ";", %pos);
+
+ %return = getSubStr(%objectLine, %pos+2, %endPos-%pos-2);
+ break;
+ }
+
+ %pos = strpos(%objectLine, "=");
+ if(%pos != -1)
+ {
+ %endPos = strpos(%objectLine, ";", %pos);
+
+ %return = getSubStr(%objectLine, %pos+2, %endPos-%pos-2);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return %return;
+}
+
+function setObjectField(%object, %fieldName, %newValue)
+{
+ for(%e=0; %e < %object.count(); %e++)
+ {
+ %objectLine = %object.getKey(%e);
+ if(!isObject(%objectLine))
+ {
+ if(!strIsMatchExpr("*};*", %objectLine) &&
+ !strIsMatchExpr("*singleton*(*)*", %objectLine) &&
+ !strIsMatchExpr("*new*(*)*", %objectLine) &&
+ !strIsMatchExpr("*datablock*(*)*", %objectLine)&&
+ !strIsMatchExpr("\n", %objectLine) &&
+ !strIsMatchExpr("\r", %objectLine))
+ {
+ if(strpos(strlwr(%objectLine), strlwr(%fieldName)) != -1)
+ {
+ %pos = strpos(%objectLine, "= \"");
+ if(%pos != -1)
+ {
+ %endPos = strpos(%objectLine, "\";", %pos);
+
+ %value = getSubStr(%objectLine, %pos+3, %endPos-%pos-3);
+ %editedLine = strreplace(%objectLine, %value, %newValue);
+ %object.setKey(%editedLine, %e);
+ break;
+ }
+
+ %pos = strpos(%objectLine, "=\"");
+ if(%pos != -1)
+ {
+ %endPos = strpos(%objectLine, "\";", %pos);
+
+ %value = getSubStr(%objectLine, %pos+2, %endPos-%pos-2);
+ %editedLine = strreplace(%objectLine, %value, %newValue);
+ %object.setKey(%editedLine, %e);
+ break;
+ }
+
+ %pos = strpos(%objectLine, "= ");
+ if(%pos != -1)
+ {
+ %endPos = strpos(%objectLine, ";", %pos);
+
+ %value = getSubStr(%objectLine, %pos+2, %endPos-%pos-2);
+ %editedLine = strreplace(%objectLine, %value, %newValue);
+ %object.setKey(%editedLine, %e);
+ break;
+ }
+
+ %pos = strpos(%objectLine, "=");
+ if(%pos != -1)
+ {
+ %endPos = strpos(%objectLine, ";", %pos);
+
+ %value = getSubStr(%objectLine, %pos+2, %endPos-%pos-2);
+ %editedLine = strreplace(%objectLine, %value, %newValue);
+ %object.setKey(%editedLine, %e);
+ break;
+ }
+ }
+ }
+ }
+ }
+}
+
+function projectImporterLog(%line)
+{
+ if($ProjectImporter::writeToConsole)
+ echo(%line);
+
+ $ProjectImporter::log.add(%line);
+}
+
//==============================================================================
//Shape Importing
//==============================================================================
function beginShapeImport()
{
- $ProjectImporter::log.add("===========================================");
- $ProjectImporter::log.add("Importing 3D Shape files");
- $ProjectImporter::log.add("===========================================");
- //First, we need to go through and process all loose shape files. This will
- //get us shape assets, material assets image, assets and animation assets.
+ projectImporterLog("===========================================");
+ projectImporterLog("Importing 3D Shape files");
+ projectImporterLog("===========================================");
+
+ //First, we need to go through and process all loose image files. This will
+ //get us shape assets, and if the import config deigns, material assets.
%currentAddress = $ProjectImporter::modulePath;
- //First, wipe out any files inside the folder first
- %file = findFirstFileMultiExpr( %currentAddress @ "/*.*", true);
-
- while( %file !$= "" )
- {
- if(endsWith(%file, "cached.dts"))
- {
- %file = findNextFileMultiExpr( %currentAddress @ "/*.*" );
- continue;
- }
-
- %filename = fileName(%file);
- %fileExt = fileExt(%file);
- %filePath = filePath(%file);
-
- //Specific exclusions
- if(endsWith(%filename, "cached.dts"))
- {
- %file = findNextFileMultiExpr( %currentAddress @ "/*.*" );
- continue;
- }
+ for(%i=0; %i < $ProjectImporter::FileList.count(); %i++)
+ {
+ %file = $ProjectImporter::FileList.getKey(%i);
+ %rootFileSectionObject = $ProjectImporter::FileList.getValue(%i);
+ %destinationPath = %rootFileSectionObject.fileDestination;
+ if(isFile(%file) && %rootFileSectionObject.isShapeFile == true && %rootFileSectionObject.imported == false)
+ {
+ if(!IsDirectory(filePath(%destinationPath)))
+ {
+ DirectoryHandler::createFolder(0, filePath(%destinationPath));
+ }
+
+ if(!pathCopy(%file, %destinationPath, false))
+ {
+ projectImporterLog("ProjectImporter::beginShapeImport() - failed to copy shape: " @ %file @
+ " to destination: " @ %destinationPath);
+ continue;
+ }
+
+ if(endsWith(%destinationPath, "cached.dts"))
+ {
+ continue;
+ }
- if(isShapeFormat(%fileExt))
- {
$ProjectImporter::assetQuery.clear();
- %assetsFound = AssetDatabase.findAssetLooseFile($ProjectImporter::assetQuery, %file);
+ %assetsFound = AssetDatabase.findAssetLooseFile($ProjectImporter::assetQuery, %destinationPath);
if(%assetsFound == 0)
{
- ProjectImportWizardPage5-->processingText.setText("Processing Shape Asset file: " @ %file);
+ //ProjectImportWizardPage5-->processingText.setText("Processing Shape Asset file: " @ %file);
Canvas.repaint();
//No asset found associated to this fileas far as we can determine, so time to import it
-
- $ProjectImporter::log.add("Importing 3D Shape file: " @ %file);
- %assetId = $ProjectImporter::importer.autoImportFile(%file);
+ projectImporterLog("Importing 3D Shape file: " @ %destinationPath);
+ %assetId = $ProjectImporter::importer.autoImportFile(%destinationPath);
getImporterLogs();
if(%assetId !$= "")
{
- $ProjectImporter::log.add("Finished importing 3D Shape file, resulting in asset with an id of: " @ %assetId);
- $ProjectImporter::log.add("");
+ projectImporterLog("Finished importing 3D Shape file, resulting in asset with an id of: " @ %assetId);
+ projectImporterLog("");
+
+ %rootFileSectionObject.imported = true;
}
}
}
-
- %file = findNextFileMultiExpr( %currentAddress @ "/*.*" );
}
- $ProjectImporter::log.add("===========================================");
- $ProjectImporter::log.add("Finished Importing 3D Shape files");
- $ProjectImporter::log.add("===========================================");
+ projectImporterLog("===========================================");
+ projectImporterLog("Finished Importing 3D Shape files");
+ projectImporterLog("===========================================");
}
//==============================================================================
@@ -952,56 +1357,62 @@ function beginShapeImport()
//==============================================================================
function beginImageImport()
{
- $ProjectImporter::log.add("===========================================");
- $ProjectImporter::log.add("Importing Image files");
- $ProjectImporter::log.add("===========================================");
+ projectImporterLog("===========================================");
+ projectImporterLog("Importing Image files");
+ projectImporterLog("===========================================");
+
//First, we need to go through and process all loose image files. This will
//get us image assets, and if the import config deigns, material assets.
%currentAddress = $ProjectImporter::modulePath;
- //First, wipe out any files inside the folder first
- %file = findFirstFileMultiExpr( %currentAddress @ "/*.*", true);
-
- while( %file !$= "" )
- {
- %filename = fileName(%file);
- %fileExt = fileExt(%file);
- %filePath = filePath(%file);
-
- if(isImageFormat(%fileExt))
- {
- if(%filename $= "skybox_1.png")
+ for(%i=0; %i < $ProjectImporter::FileList.count(); %i++)
+ {
+ %file = $ProjectImporter::FileList.getKey(%i);
+ %rootFileSectionObject = $ProjectImporter::FileList.getValue(%i);
+ %destinationPath = %rootFileSectionObject.fileDestination;
+ if(isFile(%file) && %rootFileSectionObject.isImageFile == true && %rootFileSectionObject.imported == false)
+ {
+ if(!IsDirectory(filePath(%destinationPath)))
{
- %aefgadfg = true;
+ DirectoryHandler::createFolder(0, filePath(%destinationPath));
}
+ if(!pathCopy(%file, %destinationPath, false))
+ {
+ projectImporterLog("ProjectImporter::beginImageImport() - failed to copy image: " @ %file @
+ " to destination: " @ %destinationPath);
+ continue;
+ }
+
+ projectImporterLog("Beginning of Import of Image file: " @ %file);
+
$ProjectImporter::assetQuery.clear();
- %assetsFound = AssetDatabase.findAssetLooseFile($ProjectImporter::assetQuery, %file);
+ %assetsFound = AssetDatabase.findAssetLooseFile($ProjectImporter::assetQuery, %destinationPath);
if(%assetsFound == 0)
{
- ProjectImportWizardPage5-->processingText.setText("Processing Image Asset file: " @ %file);
+ //ProjectImportWizardPage5-->processingText.setText("Processing Image Asset file: " @ %file);
Canvas.repaint();
//No asset found associated to this fileas far as we can determine, so time to import it
- $ProjectImporter::log.add("Importing Image file: " @ %file);
- %assetId = $ProjectImporter::importer.autoImportFile(%file);
+ projectImporterLog(" No Existing ImageAsset found. Continuing Import.");
+ %assetId = $ProjectImporter::importer.autoImportFile(%destinationPath);
getImporterLogs();
if(%assetId !$= "")
{
- $ProjectImporter::log.add("Finished importing Image file, resulting in asset with an id of: " @ %assetId);
- $ProjectImporter::log.add("");
+ projectImporterLog("Finished importing Image file, resulting in asset with an id of: " @ %assetId);
+ projectImporterLog("");
+
+ %rootFileSectionObject.imported = true;
}
}
}
-
- %file = findNextFileMultiExpr( %currentAddress @ "/*.*" );
}
- $ProjectImporter::log.add("===========================================");
- $ProjectImporter::log.add("Finished Importing Image files");
- $ProjectImporter::log.add("===========================================");
+ projectImporterLog("===========================================");
+ projectImporterLog("Finished Importing Image files");
+ projectImporterLog("===========================================");
}
//==============================================================================
@@ -1010,47 +1421,61 @@ function beginImageImport()
//==============================================================================
function beginTerrainImport()
{
- $ProjectImporter::log.add("===========================================");
- $ProjectImporter::log.add("Importing Terrain files");
- $ProjectImporter::log.add("===========================================");
+ projectImporterLog("===========================================");
+ projectImporterLog("Importing Terrain files");
+ projectImporterLog("===========================================");
+ //First, we need to go through and process all loose image files. This will
+ //get us shape assets, and if the import config deigns, material assets.
%currentAddress = $ProjectImporter::modulePath;
- //First, wipe out any files inside the folder first
- %file = findFirstFileMultiExpr( %currentAddress @ "/*.*", true);
-
- while( %file !$= "" )
- {
- %fileName = fileName(%file);
- %fileExt = fileExt(%file);
- %filePath = filePath(%file);
- if(%fileExt $= ".ter")
- {
+ for(%i=0; %i < $ProjectImporter::FileList.count(); %i++)
+ {
+ %file = $ProjectImporter::FileList.getKey(%i);
+ %rootFileSectionObject = $ProjectImporter::FileList.getValue(%i);
+ %destinationPath = %rootFileSectionObject.fileDestination;
+ if(isFile(%file) && %rootFileSectionObject.isTerrainFile == true && %rootFileSectionObject.imported == false)
+ {
+ /*%filename = %rootFileSectionObject.fileName;
+ %fileExt = %rootFileSectionObject.fileExt;
+ %filePath = filePath(%file);
+
%sanitizedFile = sanitizeFilename(%file);
if(%sanitizedFile !$= %file)
{
%file = %sanitizedFile;
%fileName = fileName(%file);
%filePath = filePath(%file);
+ }*/
+ if(!IsDirectory(filePath(%destinationPath)))
+ {
+ DirectoryHandler::createFolder(0, filePath(%destinationPath));
+ }
+
+ if(!pathCopy(%file, %destinationPath, false))
+ {
+ projectImporterLog("ProjectImporter::beginTerrainImport() - failed to copy terrain: " @ %file @
+ " to destination: " @ %destinationPath);
+ continue;
}
$ProjectImporter::assetQuery.clear();
- %assetsFound = AssetDatabase.findAssetLooseFile($ProjectImporter::assetQuery, %file);
+ %assetsFound = AssetDatabase.findAssetLooseFile($ProjectImporter::assetQuery, %destinationPath);
if(%assetsFound == 0)
{
- ProjectImportWizardPage5-->processingText.setText("Processing Terrain Asset file: " @ %file);
+ //ProjectImportWizardPage5-->processingText.setText("Processing Terrain Asset file: " @ %file);
Canvas.repaint();
- $ProjectImporter::log.add("Importing Terrain file: " @ %file);
+ projectImporterLog("Importing Terrain file: " @ %destinationPath);
- %moduleDef = AssetBrowser.dirHandler.getModuleFromAddress(%file);
+ %moduleDef = AssetBrowser.dirHandler.getModuleFromAddress(%destinationPath);
%moduleName = %moduleDef.ModuleID;
%modulePath = %moduleDef.ModulePath;
//test import config here for forcing type suffixes
- %assetName = fileBase(%file);
+ %assetName = fileBase(%destinationPath);
- %assetPath = %filePath @ "/";
+ %assetPath = filePath(%destinationPath) @ "/";
%tamlpath = %assetPath @ %assetName @ ".asset.taml";
@@ -1058,15 +1483,90 @@ function beginTerrainImport()
{
AssetName = %assetName;
versionId = 1;
- terrainFile = %fileName;
+ terrainFile = fileName(%destinationPath);
};
if(TamlWrite(%asset, %tamlpath))
{
AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
- $ProjectImporter::log.add("Finished importing Terrain file, resulting in asset with an id of: " @ %moduleName @ ":" @ %assetName);
- $ProjectImporter::log.add("");
+ projectImporterLog("Finished importing Terrain file, resulting in asset with an id of: " @ %moduleName @ ":" @ %assetName);
+ projectImporterLog("");
+
+ %rootFileSectionObject.imported = true;
+ }
+ }
+ }
+ }
+
+ projectImporterLog("===========================================");
+ projectImporterLog("Finished Importing Terrain files");
+ projectImporterLog("===========================================");
+}
+//==============================================================================
+
+//==============================================================================
+//Sound Importing
+//==============================================================================
+function beginSoundImport()
+{
+ projectImporterLog("===========================================");
+ projectImporterLog("Importing Sound files");
+ projectImporterLog("===========================================");
+
+ //First, we need to go through and process all loose image files. This will
+ //get us shape assets, and if the import config deigns, material assets.
+ %currentAddress = $ProjectImporter::modulePath;
+
+ for(%i=0; %i < $ProjectImporter::FileList.count(); %i++)
+ {
+ %file = $ProjectImporter::FileList.getKey(%i);
+ %rootFileSectionObject = $ProjectImporter::FileList.getValue(%i);
+ %destinationPath = %rootFileSectionObject.fileDestination;
+ if(isFile(%file) && %rootFileSectionObject.isSoundFile == true && %rootFileSectionObject.imported == false)
+ {
+ /*%filename = %rootFileSectionObject.fileName;
+ %fileExt = %rootFileSectionObject.fileExt;
+ %filePath = filePath(%file);
+
+ %sanitizedFile = sanitizeFilename(%file);
+ if(%sanitizedFile !$= %file)
+ {
+ %file = %sanitizedFile;
+ %fileName = fileName(%file);
+ %filePath = filePath(%file);
+ }*/
+ if(!IsDirectory(filePath(%destinationPath)))
+ {
+ DirectoryHandler::createFolder(0, filePath(%destinationPath));
+ }
+
+ if(!pathCopy(%file, %destinationPath, false))
+ {
+ projectImporterLog("ProjectImporter::beginSoundImport() - failed to copy sound: " @ %file @
+ " to destination: " @ %destinationPath);
+ continue;
+ }
+
+ $ProjectImporter::assetQuery.clear();
+ %assetsFound = AssetDatabase.findAssetLooseFile($ProjectImporter::assetQuery, %destinationPath);
+ if(%assetsFound == 0)
+ {
+ //ProjectImportWizardPage5-->processingText.setText("Processing Image Asset file: " @ %file);
+ Canvas.repaint();
+
+ //No asset found associated to this fileas far as we can determine, so time to import it
+
+ projectImporterLog(" No Existing SoundAsset found. Continuing Import.");
+ %assetId = $ProjectImporter::importer.autoImportFile(%destinationPath);
+ getImporterLogs();
+
+ if(%assetId !$= "")
+ {
+ projectImporterLog("Finished importing Sound file, resulting in asset with an id of: " @ %assetId);
+ projectImporterLog("");
+
+ %rootFileSectionObject.imported = true;
}
}
}
@@ -1074,95 +1574,97 @@ function beginTerrainImport()
%file = findNextFileMultiExpr( %currentAddress @ "/*.*" );
}
- $ProjectImporter::log.add("===========================================");
- $ProjectImporter::log.add("Finished Importing Terrain files");
- $ProjectImporter::log.add("===========================================");
+ projectImporterLog("===========================================");
+ projectImporterLog("Finished Importing Sound files");
+ projectImporterLog("===========================================");
}
//==============================================================================
-//==============================================================================
-//Sound Importing
-//==============================================================================
-
-//==============================================================================
-
//==============================================================================
//Gui Importing
//==============================================================================
function beginGUIImport()
{
- $ProjectImporter::log.add("===========================================");
- $ProjectImporter::log.add("Importing GUIs");
- $ProjectImporter::log.add("===========================================");
+ projectImporterLog("===========================================");
+ projectImporterLog("Importing GUIs");
+ projectImporterLog("===========================================");
+ //First, we need to go through and process all loose image files. This will
+ //get us shape assets, and if the import config deigns, material assets.
%currentAddress = $ProjectImporter::modulePath;
- //First, wipe out any files inside the folder first
- %file = findFirstFileMultiExpr( %currentAddress @ "/*.*", true);
-
- while( %file !$= "" )
- {
- %fileName = fileName(%file);
- %fileExt = fileExt(%file);
- %filePath = filePath(%file);
- if(%fileExt $= ".gui")
- {
+ for(%i=0; %i < $ProjectImporter::FileList.count(); %i++)
+ {
+ %file = $ProjectImporter::FileList.getKey(%i);
+ %rootFileSectionObject = $ProjectImporter::FileList.getValue(%i);
+ %destinationPath = %rootFileSectionObject.fileDestination;
+ if(isFile(%file) && %rootFileSectionObject.fileExt $= ".gui" && %rootFileSectionObject.imported == false)
+ {
$ProjectImporter::assetQuery.clear();
- %assetsFound = AssetDatabase.findAssetLooseFile($ProjectImporter::assetQuery, %file);
+ %assetsFound = AssetDatabase.findAssetLooseFile($ProjectImporter::assetQuery, %destinationPath);
if(%assetsFound == 0)
{
- ProjectImportWizardPage5-->processingText.setText("Processing GUI Asset file: " @ %file);
+ //ProjectImportWizardPage5-->processingText.setText("Processing GUI Asset file: " @ %file);
Canvas.repaint();
- if ( $ProjectImporter::fileObject.openForRead( %file ) )
+ %guiObjectName = "";
+
+ //find our root GUI item
+ for(%g = 0; %g < %rootFileSectionObject.count(); %g++)
{
- while ( !$ProjectImporter::fileObject.isEOF() )
+ %fileElement = %rootFileSectionObject.getKey(%g);
+ if(%fileElement.elementType $= "Object")
{
- %line = $ProjectImporter::fileObject.readLine();
-
- if(strIsMatchExpr("*new*(*)*", %line))
+ %guiObjectName = %fileElement.objectName;
+ %delcareLine = %fileElement.getKey(0);
+ if(startsWith(%delcareLine, "%guiContent"))
{
- %start = strpos(%line, "new ");
- %end = strpos(%line, "(", %start);
-
- if(%start != -1 && %end != -1)
+ %equalPos = strPos(%delcareLine, "=");
+ if(%equalPos != -1)
{
- %className = getSubStr(%line, %start + 4, %end-%start-4);
+ %declareSubStr = getSubStr(%delcareLine, %equalPos + 1);
+
+ //update the line to remove the unneeded local var
+ %fileElement.setKey(%declareSubStr, 0);
}
-
- %nameEnd = strpos(%line, ")", %end);
-
- %objectName = getSubStr(%line, %end+1, %nameEnd-%end-1);
-
- if(%objectName !$= "")
- {
- if(strpos(%objectName, ":") != -1)
- {
- %objectName = getSubStr(%objectName, 0, strpos(%objectName, ":"));
- }
- }
-
- processGUIntoAsset(%objectName, %file);
- break;
}
+ break;
}
}
- $ProjectImporter::fileObject.close();
+ if(%guiObjectName $= "")
+ {
+ projectImporterLog("ProjectImporter::beginGUIImport() - failed to find root GUI control in file: " @ %file);
+ continue;
+ }
+
+ if(!IsDirectory(filePath(%destinationPath)))
+ {
+ DirectoryHandler::createFolder(0, filePath(%destinationPath));
+ }
+
+ if(!pathCopy(%file, %destinationPath, false))
+ {
+ projectImporterLog("ProjectImporter::beginGUIImport() - failed to copy GUI: " @ %file @
+ " to destination: " @ %destinationPath);
+ continue;
+ }
+
+ processGUIntoAsset(%guiObjectName, %destinationPath);
+
+ %rootFileSectionObject.imported = true;
}
}
-
- %file = findNextFileMultiExpr( %currentAddress @ "/*.*" );
}
- $ProjectImporter::log.add("===========================================");
- $ProjectImporter::log.add("Finished Importing GUIs");
- $ProjectImporter::log.add("===========================================");
+ projectImporterLog("===========================================");
+ projectImporterLog("Finished Importing GUIs");
+ projectImporterLog("===========================================");
}
function processGUIntoAsset(%guiName, %file)
{
- $ProjectImporter::log.add("Processing GUI into asset: " @ %guiName @ ", file: " @ %file);
+ projectImporterLog("Processing GUI into asset: " @ %guiName @ ", file: " @ %file);
%filePath = filePath(%file);
%fileName = fileBase(%file);
@@ -1177,9 +1679,9 @@ function processGUIntoAsset(%guiName, %file)
%tamlpath = %assetPath @ %assetName @ ".asset.taml";
%scriptFile = "";
- if(isFile(%filePath @ "/" @ %fileName @ ".cs"))
+ if(isImportingFile(%filePath @ "/" @ %fileName @ ".tscript"))
{
- %scriptFile = %fileName @ ".cs";
+ %scriptFile = %fileName @ ".tscript";
}
%asset = new GUIAsset()
@@ -1190,9 +1692,10 @@ function processGUIntoAsset(%guiName, %file)
guiFile = fileName(%file);
};
- TamlWrite(%asset, %tamlpath);
-
- AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
+ if(TamlWrite(%asset, %tamlpath))
+ {
+ AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
+ }
return %tamlpath;
}
@@ -1209,9 +1712,9 @@ function processGUIntoAsset(%guiName, %file)
//==============================================================================
function beginPostFXImport()
{
- $ProjectImporter::log.add("===========================================");
- $ProjectImporter::log.add("Importing PostFXs");
- $ProjectImporter::log.add("===========================================");
+ projectImporterLog("===========================================");
+ projectImporterLog("Importing PostFXs");
+ projectImporterLog("===========================================");
%count = PostFXManager.Count();
for(%i=0; %i < %count; %i++)
@@ -1220,7 +1723,7 @@ function beginPostFXImport()
if(isObject(%postEffect))
{
- $ProjectImporter::log.add("Processing import of PostFX: " @ %postEffect.getName());
+ projectImporterLog("Processing import of PostFX: " @ %postEffect.getName());
//$ProjectImporter::persistMgr.setDirty(%gui);
}
@@ -1228,9 +1731,9 @@ function beginPostFXImport()
//$ProjectImporter::persistMgr.saveDirty();
- $ProjectImporter::log.add("===========================================");
- $ProjectImporter::log.add("Finished Importing PostFXs");
- $ProjectImporter::log.add("===========================================");
+ projectImporterLog("===========================================");
+ projectImporterLog("Finished Importing PostFXs");
+ projectImporterLog("===========================================");
}
//==============================================================================
@@ -1239,36 +1742,50 @@ function beginPostFXImport()
//==============================================================================
function beginLevelImport()
{
- $ProjectImporter::log.add("===========================================");
- $ProjectImporter::log.add("Importing Level files");
- $ProjectImporter::log.add("===========================================");
+ projectImporterLog("===========================================");
+ projectImporterLog("Importing Level files");
+ projectImporterLog("===========================================");
+ //First, we need to go through and process all loose image files. This will
+ //get us shape assets, and if the import config deigns, material assets.
%currentAddress = $ProjectImporter::modulePath;
- //First, wipe out any files inside the folder first
- %file = findFirstFileMultiExpr( %currentAddress @ "/*.*", true);
-
- while( %file !$= "" )
- {
- %fileName = fileName(%file);
- %fileExt = fileExt(%file);
- %filePath = filePath(%file);
- %fileBase = fileBase(%file);
-
- if(%fileExt $= ".mis")
- {
+ for(%i=0; %i < $ProjectImporter::FileList.count(); %i++)
+ {
+ %file = $ProjectImporter::FileList.getKey(%i);
+ %rootFileSectionObject = $ProjectImporter::FileList.getValue(%i);
+ %destinationPath = %rootFileSectionObject.fileDestination;
+ if(isFile(%file) && %rootFileSectionObject.fileExt $= ".mis" && %rootFileSectionObject.imported == false)
+ {
+ %fileName = fileName(%destinationPath);
+ %fileExt = fileExt(%destinationPath);
+ %fileBase = fileBase(%destinationPath);
+ %filePath = filePath(%destinationPath);
+
+ if(!IsDirectory(filePath(%destinationPath)))
+ {
+ DirectoryHandler::createFolder(0, filePath(%destinationPath));
+ }
+
+ if(!pathCopy(%file, %destinationPath, false))
+ {
+ projectImporterLog("ProjectImporter::beginLevelImport() - failed to copy level: " @ %file @
+ " to destination: " @ %destinationPath);
+ continue;
+ }
+
%newAsset = false;
$ProjectImporter::assetQuery.clear();
- %assetsFound = AssetDatabase.findAssetLooseFile($ProjectImporter::assetQuery, %file);
+ %assetsFound = AssetDatabase.findAssetLooseFile($ProjectImporter::assetQuery, %destinationPath);
if(%assetsFound == 0)
{
- ProjectImportWizardPage5-->processingText.setText("Processing Level Asset file: " @ %file);
+ //ProjectImportWizardPage5-->processingText.setText("Processing Level Asset file: " @ %file);
Canvas.repaint();
- $ProjectImporter::log.add("Importing Level file: " @ %file);
+ projectImporterLog("Importing Level file: " @ %file);
- %moduleName = AssetBrowser.dirHandler.getModuleFromAddress(%file).ModuleId;
+ %moduleName = AssetBrowser.dirHandler.getModuleFromAddress(%destinationPath).ModuleId;
%assetName = %fileBase;
@@ -1276,7 +1793,7 @@ function beginLevelImport()
if(AssetDatabase.isDeclaredAsset(%moduleName @ ":" @ %assetName))
{
- $ProjectImporter::log.add("Legacy Project Importer - trying to process a level into an asset that already exists");
+ projectImporterLog("Legacy Project Importer - trying to process a level into an asset that already exists");
return false;
}
@@ -1301,24 +1818,28 @@ function beginLevelImport()
}
//Time to process the associated files
- if(isFile(%filePath @ "/" @ %fileBase @ ".decal"))
- {
- %asset.decalsFile = %fileBase @ ".decal";
- }
- if(isFile(%filePath @ "/" @ %fileBase @ ".forest"))
- {
- %asset.forestFile = %fileBase @ ".forest";
- }
- if(isFile(%filePath @ "/" @ %fileBase @ ".nav"))
- {
- %asset.decalsFile = %fileBase @ ".nav";
- }
- if(isFile(%filePath @ "/" @ %fileBase @ ".postfx.preset"))
- {
- %asset.postFXPresetFile = %fileBase @ ".postfx.preset";
- }
-
- if(isFile(%filePath @ "/" @ %fileBase @ ".png"))
+ if(isFile(%filePath @ "/" @ %fileBase @ ".decal"))
+ {
+ %asset.decalsFile = %fileBase @ ".decal";
+ }
+ else if(isFile(%filePath @ "/" @ %fileBase @ "mis.decal"))
+ {
+ %asset.decalsFile = %fileBase @ "mis.decal";
+ }
+ if(isFile(%filePath @ "/" @ %fileBase @ ".forest"))
+ {
+ %asset.forestFile = %fileBase @ ".forest";
+ }
+ if(isFile(%filePath @ "/" @ %fileBase @ ".nav"))
+ {
+ %asset.decalsFile = %fileBase @ ".nav";
+ }
+ if(isFile(%filePath @ "/" @ %fileBase @ ".postfx.preset"))
+ {
+ %asset.postFXPresetFile = %fileBase @ ".postfx.preset";
+ }
+
+ if(isFile(%filePath @ "/" @ %fileBase @ ".png"))
%previewImageAsset = ImageAsset::getAssetIdByFilename(%filePath @ "/" @ %fileBase @ ".png");
else if(isFile(%filePath @ "/" @ %fileBase @ "_preview.png"))
%previewImageAsset = ImageAsset::getAssetIdByFilename(%filePath @ "/" @ %fileBase @ "_preview.png");
@@ -1337,28 +1858,30 @@ function beginLevelImport()
if(%previewImageAsset !$= "")
{
- %asset.addAssetDependencyField(previewImageAsset, %previewImageAsset);
+ %asset.addAssetDependencyField(previewImageAsset, %previewImageAsset);
+ }
+
+ if(TamlWrite(%asset, %tamlpath))
+ {
+ if(%newAsset)
+ {
+ %moduleDef = ModuleDatabase.findModule(%moduleName, 1);
+
+ %success = AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
+ }
+ else
+ {
+ %asset.refreshAsset();
}
-
- TamlWrite(%asset, %tamlpath);
-
- if(%newAsset)
- {
- %moduleDef = ModuleDatabase.findModule(%moduleName, 1);
- %success = AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
- }
- else
- {
- %asset.refreshAsset();
}
+
+ %rootFileSectionObject.imported = true;
}
-
- %file = findNextFileMultiExpr( %currentAddress @ "/*.*" );
}
- $ProjectImporter::log.add("===========================================");
- $ProjectImporter::log.add("Finished Importing Level files");
- $ProjectImporter::log.add("===========================================");
+ projectImporterLog("===========================================");
+ projectImporterLog("Finished Importing Level files");
+ projectImporterLog("===========================================");
}
//==============================================================================
@@ -1397,9 +1920,9 @@ function ProjectImporter::deleteAssetDefinitions(%targetFolder)
function doDeleteAssetDefinitions()
{
- $ProjectImporter::log.add("===========================================");
- $ProjectImporter::log.add("Deleting Asset Definitions");
- $ProjectImporter::log.add("===========================================");
+ projectImporterLog("===========================================");
+ projectImporterLog("Deleting Asset Definitions");
+ projectImporterLog("===========================================");
%currentAddress = $deleteAssetDefsTargetFolder;
@@ -1415,27 +1938,27 @@ function doDeleteAssetDefinitions()
{
if(fileDelete(%file))
{
- $ProjectImporter::log.add("File: " @ %file @ " deleted successfully.");
+ projectImporterLog("File: " @ %file @ " deleted successfully.");
}
else
{
- $ProjectImporter::log.add("File: " @ %file @ " failed to delete.");
+ projectImporterLog("File: " @ %file @ " failed to delete.");
}
}
%file = findNextFileMultiExpr( %currentAddress @ "/*.asset.taml" );
}
- $ProjectImporter::log.add("===========================================");
- $ProjectImporter::log.add("Finished Deleting Asset Definitions");
- $ProjectImporter::log.add("===========================================");
+ projectImporterLog("===========================================");
+ projectImporterLog("Finished Deleting Asset Definitions");
+ projectImporterLog("===========================================");
}
function scanForDuplicateFiles(%toTestFile)
{
- $ProjectImporter::log.add("===========================================");
- $ProjectImporter::log.add("Scanning for duplicate files!");
- $ProjectImporter::log.add("===========================================");
+ projectImporterLog("===========================================");
+ projectImporterLog("Scanning for duplicate files!");
+ projectImporterLog("===========================================");
//First, wipe out any files inside the folder first
%file = findFirstFileMultiExpr( "*/*.*", true);
@@ -1479,8 +2002,8 @@ function scanForDuplicateFiles(%toTestFile)
if(%moduleName !$= "" && %testModuleName !$= "" && %moduleName $= %testModuleName)
{
//report the probable duplicate
- $ProjectImporter::log.add("Probable duplicate asset detected!");
- $ProjectImporter::log.add("Files: " @ %file @ " and " @ %toTestFile @ " have matching names and exist within the same module!");
+ projectImporterLog("Probable duplicate asset detected!");
+ projectImporterLog("Files: " @ %file @ " and " @ %toTestFile @ " have matching names and exist within the same module!");
}
}
}
@@ -1494,6 +2017,6 @@ function getImporterLogs()
%lineCount = $ProjectImporter::importer.getActivityLogLineCount();
for(%i=0; %i < %lineCount; %i++)
{
- $ProjectImporter::log.add($ProjectImporter::importer.getActivityLogLine(%i));
+ projectImporterLog($ProjectImporter::importer.getActivityLogLine(%i));
}
}
\ No newline at end of file