Merge branch 'Preview4_0' into alpha40/updateSDL2022

This commit is contained in:
AzaezelX 2022-05-05 17:55:04 -05:00
commit af88302935
34 changed files with 478 additions and 547 deletions

56
.github/workflows/cmake.yml vendored Normal file
View file

@ -0,0 +1,56 @@
name: CMake
on:
push:
branches: [ Preview4_0 ]
pull_request:
branches: [ Preview4_0 ]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build:
if: github.repository == 'TorqueGameEngines/Torque3D'
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- uses: seanmiddleditch/gha-setup-ninja@master
- uses: ilammy/msvc-dev-cmd@v1
- name: Setup Environment
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get install -y \
build-essential \
nasm \
libogg-dev \
libxft-dev \
libx11-dev \
libxxf86vm-dev \
libopenal-dev \
libfreetype6-dev \
libxcursor-dev \
libxinerama-dev \
libxi-dev \
libxrandr-dev \
libxss-dev \
libglu1-mesa-dev \
libgtk-3-dev
fi
shell: bash
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DTORQUE_APP_NAME=Torque3D
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

1
.gitignore vendored
View file

@ -183,3 +183,4 @@ My Projects/
Project Manager.exe
projects.xml
Qt*.dll
.vs

View file

@ -247,7 +247,7 @@ bool TerrainAsset::getAssetByFilename(StringTableEntry fileName, AssetPtr<Terrai
{
//Didn't find any assets
//If possible, see if we can run an in-place import and the get the asset from that
#if TORQUE_DEBUG
#ifdef TORQUE_DEBUG
Con::warnf("TerrainAsset::getAssetByFilename - Attempted to in-place import a terrainFile(%s) that had no associated asset", fileName);
#endif

View file

@ -399,7 +399,12 @@ U32 ConditionalExprNode::compile(CodeStream& codeStream, U32 ip, TypeReq type)
TypeReq ConditionalExprNode::getPreferredType()
{
return trueExpr->getPreferredType();
// We can't make it calculate a type based on subsequent expressions as the expression
// could be a string, or just numbers. To play it safe, stringify anything that deals with
// a conditional, and let the interpreter cast as needed to other types safely.
//
// See: Regression Test 7 in ScriptTest. It has a string result in the else portion of the ?: ternary.
return TypeReqString;
}
//------------------------------------------------------------

View file

@ -1079,6 +1079,22 @@ TEST(Script, MiscRegressions)
)");
ASSERT_EQ(regression6.getBool(), true);
ConsoleValue regression7 = RunScript(R"(
function Tween::vectorAdd(%v1, %v2)
{
%temp = "";
for (%i = 0; %i < getWordCount(%v1); %i++) {
%e = getWord(%v1, %i) + getWord(%v2, %i);
%temp = %i == 0 ? %e : %temp SPC %e;
}
return %temp;
}
return Tween::vectorAdd("1 2 3", "4 5 6");
)");
ASSERT_STREQ(regression7.getString(), "5 7 9");
}
#endif

View file

@ -46,7 +46,7 @@ void GFXCardProfiler::loadProfileScript(const char* aScriptName)
if(data == NULL)
{
#if TORQUE_DEBUG
#ifdef TORQUE_DEBUG
Con::warnf(" - No card profile %s exists", scriptName.c_str());
#endif
return;
@ -54,7 +54,7 @@ void GFXCardProfiler::loadProfileScript(const char* aScriptName)
const char *script = static_cast<const char *>(data);
#if TORQUE_DEBUG
#ifdef TORQUE_DEBUG
Con::printf(" - Loaded card profile %s", scriptName.c_str());
#endif

View file

@ -45,7 +45,7 @@ GFXGLTextureObject::GFXGLTextureObject(GFXDevice * aDevice, GFXTextureProfile *p
mFrameAllocatorPtr(NULL)
{
#if TORQUE_DEBUG
#ifdef TORQUE_DEBUG
mFrameAllocatorMarkGuard = FrameAllocator::getWaterMark();
#endif
@ -90,7 +90,7 @@ GFXLockedRect* GFXGLTextureObject::lock(U32 mipLevel, RectI *inRect)
mFrameAllocatorMark = FrameAllocator::getWaterMark();
mFrameAllocatorPtr = (U8*)FrameAllocator::alloc( size );
mLockedRect.bits = mFrameAllocatorPtr;
#if TORQUE_DEBUG
#ifdef TORQUE_DEBUG
mFrameAllocatorMarkGuard = FrameAllocator::getWaterMark();
#endif

View file

@ -102,10 +102,10 @@ private:
//FrameAllocator
U32 mFrameAllocatorMark;
#if TORQUE_DEBUG
#ifdef TORQUE_DEBUG
U32 mFrameAllocatorMarkGuard;
#endif
U8 *mFrameAllocatorPtr;
};
#endif
#endif

View file

@ -208,7 +208,7 @@ GFXGLPreserveInteger TORQUE_CONCAT(preserve_, __LINE__) (GL_READ_FRAMEBUFFER, GL
GFXGLPreserveInteger TORQUE_CONCAT(preserve2_, __LINE__) (GL_DRAW_FRAMEBUFFER, GL_DRAW_FRAMEBUFFER_BINDING, (GFXGLPreserveInteger::BindFn)glBindFramebuffer)
#if TORQUE_DEBUG
#ifdef TORQUE_DEBUG
// Handy macro for checking the status of a framebuffer. Framebuffers can fail in
// all sorts of interesting ways, these are just the most common. Further, no existing GL profiling

View file

@ -42,7 +42,7 @@ void TamlCustomField::set( const char* pFieldName, const char* pFieldValue )
// Set field name.
mFieldName = StringTable->insert( pFieldName );
#if TORQUE_DEBUG
#ifdef TORQUE_DEBUG
// Is the field value too big?
if ( dStrlen(pFieldValue) >= sizeof(mFieldValue) )
{

View file

@ -640,7 +640,7 @@ public:
private:
inline TamlCustomField* registerField( TamlCustomField* pCustomField )
{
#if TORQUE_DEBUG
#ifdef TORQUE_DEBUG
// Ensure a field name conflict does not exist.
for( Vector<TamlCustomField*>::iterator nodeFieldItr = mFields.begin(); nodeFieldItr != mFields.end(); ++nodeFieldItr )
{
@ -724,7 +724,7 @@ public:
// Set ignore-empty flag.
pCustomNode->setIgnoreEmpty( ignoreEmpty );
#if TORQUE_DEBUG
#ifdef TORQUE_DEBUG
// Ensure a node name conflict does not exist.
for( TamlCustomNodeVector::iterator nodeItr = mNodes.begin(); nodeItr != mNodes.end(); ++nodeItr )
{

View file

@ -46,6 +46,9 @@
#if defined(__FreeBSD__)
#include <sys/types.h>
#endif
#if defined(__APPLE__)
#include <sys/syslimits.h>
#endif
#include <utime.h>
/* these are for reading directors, getting stats, etc. */

View file

@ -1250,7 +1250,7 @@ void DiffuseVertColorFeatureHLSL::processVert( Vector< ShaderComponent* >& comp
outColor->setStructName( "OUT" );
outColor->setType( "float4" );
output = new GenOp( " @ = @.bgra;\r\n", outColor, inColor );
output = new GenOp( " @ = @;\r\n", outColor, inColor );
}
else
output = NULL; // Nothing we need to do.

View file

@ -53,25 +53,10 @@ function ConsoleEntry::eval()
$Con::warnVoidAssignment = false;
echo("==>" @ %text);
if( !startsWith(%text, "function ")
&& !startsWith(%text, "datablock ")
&& !startsWith(%text, "foreach(")
&& !startsWith(%text, "foreach$(")
&& !startsWith(%text, "if(")
&& !startsWith(%text, "while(")
&& !startsWith(%text, "for(")
&& !startsWith(%text, "switch(")
&& !startsWith(%text, "switch$("))
%result = eval("return" SPC %text);
else
eval(%text);
eval(%text);
$Con::warnVoidAssignment = %oldWarnVoidAssignment;
ConsoleEntry.setValue("");
// Echo result.
if(%result !$= "")
echo(%result);
}
function ToggleConsole(%make)

View file

@ -836,11 +836,11 @@ function OptionsMenuSettingsList::addOptionBoolRow(%this, %label, %targetPrefVar
if(%qualityLevelList $= $yesNoList && isInt(%defaultValue))
{
%defaultValue = convertBoolToYesNo(!%defaultValue);
%defaultValue = convertBoolToYesNo(%defaultValue);
}
else if(%qualityLevelList $= $onOffList && isInt(%defaultValue))
{
%defaultValue = convertBoolToOnOff(!%defaultValue);
%defaultValue = convertBoolToOnOff(%defaultValue);
}
return %this.addOptionRow(%label, %targetPrefVar, %qualityLevelList,
@ -995,9 +995,11 @@ function MenuOptionsButton::onChange(%this)
OptionsMenu.unappliedChanges.add(%targetVar, "\"" @ %saveReadyValue @ "\"" );
}
else
{
OptionsMenu.unappliedChanges.setValue("\"" @ %saveReadyValue @ "\"", %prefIndex);
}
}
}
else if(%optionMode == 1)
{
%currentValue = %this.getValue();
@ -1009,7 +1011,9 @@ function MenuOptionsButton::onChange(%this)
OptionsMenu.unappliedChanges.add(%targetVar, "\"" @ %currentValue @ "\"" );
}
else
{
OptionsMenu.unappliedChanges.setValue("\"" @ %currentValue @ "\"", %prefIndex);
}
}
//Update the UI in case there's responsive logic

View file

@ -157,8 +157,8 @@ $guiContent = new GuiControl(AssetBrowser) {
position = "204 80";
extent = "615 608";
minExtent = "383 274";
horizSizing = "center";
vertSizing = "center";
horizSizing = "windowRelative";
vertSizing = "windowRelative";
profile = "ToolsGuiWindowProfile";
visible = "1";
active = "1";
@ -276,6 +276,7 @@ $guiContent = new GuiControl(AssetBrowser) {
hovertime = "1000";
isContainer = "0";
internalName = "ImportAssetButton";
command="AssetBrowser.importNewFile();";
canSave = "1";
canSaveDynamicFields = "0";
};
@ -770,7 +771,7 @@ $guiContent = new GuiControl(AssetBrowser) {
position = "0 0";
extent = "23 23";
minExtent = "8 2";
horizSizing = "left";
horizSizing = "right";
vertSizing = "bottom";
profile = "ToolsGuiSolidDefaultProfile";
visible = "1";

View file

@ -169,6 +169,15 @@ function AssetBrowserPlugin::onWorldEditorStartup( %this )
{
}
function AssetBrowserPlugin::onWorldEditorShutdown( %this )
{
//force close us real fast to save off current settings/configs
if(AssetBrowser.isAwake())
{
AssetBrowser.hideDialog();
}
}
function AssetBrowserPlugin::initSettings( %this )
{
EditorSettings.beginGroup( "Assets", true );

View file

@ -368,8 +368,6 @@ function AssetBrowser::buildAssetPreview( %this, %asset, %moduleName )
%this.previewData.doubleClickCommand = "";
}
AssetPreviewArray.empty();
%previewImage = "core/art/warnmat";
if(/*%moduleName !$= "" && */ModuleDatabase.findModule(%moduleName, 1) !$= "")
@ -512,6 +510,7 @@ function AssetBrowser::buildAssetPreview( %this, %asset, %moduleName )
textLocation = "Bottom";
extent = %previewSize.x SPC %previewSize.y + %textBottomPad;
buttonType = "RadioButton";
buttonMargin = "0 -10";
profile = ToolsGuiDefaultProfile;
};
@ -528,11 +527,16 @@ function AssetBrowser::buildAssetPreview( %this, %asset, %moduleName )
%previewButton.iconLocation = "Left";
%previewButton.textLocation = "Right";
%previewButton.setextent(120,20);
%previewButton.buttonMargin = "0 0";
AssetBrowser.previewListMode = true;
}
else
{
%size = %previewSize.x * %previewScaleSize;
%previewButton.setextent(%size,%size + %textBottomPad);
AssetBrowser.previewListMode = false;
}
//%previewButton.extent = %previewSize.x + %previewBounds SPC %previewSize.y + %previewBounds + 24;
@ -549,6 +553,8 @@ function AssetBrowser::buildAssetPreview( %this, %asset, %moduleName )
%doubleClickCommand = "AssetBrowser.editAsset( "@%assetDesc@" );";
}
%this.previewData.previewLoaded = true;
//Build out the preview
%buildCommand = %this @ ".build" @ %assetType @ "Preview(\"" @ %assetDesc @ "\"," @ %this.previewData @ ");";
eval(%buildCommand);
@ -579,7 +585,8 @@ function AssetBrowser::buildAssetPreview( %this, %asset, %moduleName )
AssetBrowser-->assetList.add(%previewButton);
// add to the array object for reference later
AssetPreviewArray.add( %previewButton, %this.previewData.previewImage );
if(%this.previewData.previewLoaded == false)
AssetPreviewArray.add( %previewButton );
}
function AssetBrowser::refresh(%this)
@ -607,6 +614,25 @@ function AssetBrowser::doRefresh(%this)
%this.dirty = false;
}
}
function AssetBrowser::populatePreviewImages(%this)
{
echo("AssetBrowser::populatePreviewImages() - Previews to generate: " @ AssetPreviewArray.count());
for(%i=0; %i < AssetPreviewArray.count(); %i++)
{
%previewButton = AssetPreviewArray.getKey(%i);
%type = %previewButton.assetType;
echo(" - Generating preview for asset: " @ %previewButton.moduleName @ ":" @ %previewButton.assetName);
AssetBrowser.call("generate" @ %previewButton.assetType @ "PreviewImage", %previewButton);
AssetPreviewArray.erase(%i);
echo(" - done, scheduling another pass");
AssetBrowser.schedule(32, "populatePreviewImages");
return;
}
}
//
//
/*function AssetPreviewButton::onClick(%this)
@ -716,7 +742,6 @@ function AssetBrowser::loadDirectories( %this )
//}
// }
AssetPreviewArray.empty();
AssetBrowser-->filterTree.buildVisibleTree(true);
@ -1495,7 +1520,11 @@ function AssetBrowser::doRebuildAssetArray(%this)
{
if(AssetBrowser.assetTypeFilter !$= "")
{
if(AssetBrowser.assetTypeFilter $= %assetType)
%filtersCount = getWordCount(AssetBrowser.assetTypeFilter);
for(%fltrIdx = 0; %fltrIdx < %filtersCount; %fltrIdx++)
{
%fltr = getWord(AssetBrowser.assetTypeFilter, %fltrIdx);
if(%fltr $= %assetType)
{
$AssetBrowser::AssetArray.add( %moduleName, %assetId );
@ -1503,6 +1532,7 @@ function AssetBrowser::doRebuildAssetArray(%this)
%finalAssetCount++;
}
}
}
else
{
//got it.
@ -1550,7 +1580,22 @@ function AssetBrowser::doRebuildAssetArray(%this)
}
//Add Non-Asset Scripted Objects. Datablock, etc based
if(AssetBrowser.assetTypeFilter $= "" && %breadcrumbPath !$= "" && isDirectory(%breadcrumbPath))
%hasDBFilter = true;
if(AssetBrowser.assetTypeFilter !$= "")
{
%hasDBFilter = false;
%filterCount = getWordCount(AssetBrowser.assetTypeFilter);
for(%fltrIdx = 0; %fltrIdx < %filterCount; %fltrIdx++)
{
%fltr = getWord(AssetBrowser.assetTypeFilter, %fltrIdx);
if(%fltr $= "Datablock" || %fltr $= "Datablocks")
{
%hasDBFilter = true;
break;
}
}
}
if(%hasDBFilter && %breadcrumbPath !$= "" && isDirectory(%breadcrumbPath))
{
%category = getWord( %breadcrumbPath, 1 );
%dataGroup = "DataBlockGroup";
@ -1768,6 +1813,10 @@ function AssetBrowser::doRebuildAssetArray(%this)
%name = %creatorObj.val[1];
%func = %creatorObj.val[2];
%searchActive = AssetSearchTerms.count() != 0;
if(%searchActive && !matchesSearch(%name, "Creator"))
continue;
$AssetBrowser::AssetArray.add( %name, "Creator" TAB %creatorObj );
}
}
@ -1776,6 +1825,8 @@ function AssetBrowser::doRebuildAssetArray(%this)
for(%i=0; %i < $AssetBrowser::AssetArray.count(); %i++)
AssetBrowser.buildAssetPreview( $AssetBrowser::AssetArray.getValue(%i), $AssetBrowser::AssetArray.getKey(%i) );
//Queue population of any non-Type Card preview images
AssetBrowser.schedule(32, "populatePreviewImages");
AssetBrowser_FooterText.text = %finalAssetCount @ " Assets";

View file

@ -175,20 +175,48 @@ function AssetBrowser::importImageAsset(%this, %assetItem)
AssetDatabase.refreshAsset(%assetId);
}
function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData, %forcePreviewRegenerate)
function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData)
{
if(%forcePreviewRegenerate $= "")
%forcePreviewRegenerate = false;
//%module = %this.dirHandler.getModuleFromAddress(makeRelativePath(filePath(%assetDef.getImagePath())));
%module = %this.dirHandler.getModuleFromAddress(makeRelativePath(filePath(%assetDef.getImagePath())));
%previewPath = "tools/resources/previewCache/" @ %module.moduleId @ "/";
%previewData.previewImage = "ToolsModule:genericAssetIcon_image";
%previewData.previewLoaded = false; //this marks it for loading progressively later
%previewData.assetName = %assetDef.assetName;
%previewData.assetPath = %assetDef.scriptFile;
%previewData.assetFriendlyName = %assetDef.assetName;
%previewData.assetDesc = %assetDef.description;
//image info
//%info = %assetDef.getImageInfo();
%previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\n" @
"Asset Type: Image Asset\n" @
"Asset Definition ID: " @ %assetDef @ "\n" @
"Image Type: " @ %assetDef.imageType @ "\n" @
/* "Format: " @ getWord(%info, 0) @ "\n" @
"Height: " @ getWord(%info, 1) @ "\n" @
"Width: " @ getWord(%info, 2) @ "\n" @
"Depth: " @ getWord(%info, 3) @ "\n" @ */
"Image File path: " @ %assetDef.getImagePath();
}
function AssetBrowser::generateImageAssetPreviewImage(%this, %previewButton, %forceRegenerate)
{
if(%forceRegenerate $= "")
%forceRegenerate = false;
%previewPath = "tools/resources/previewCache/" @ %previewButton.moduleName @ "/";
if(!IsDirectory(%previewPath))
{
%this.dirHandler.createFolder(%previewPath);
}
%generatePreview = false;
%assetId = %previewButton.moduleName @ ":" @ %previewButton.assetName;
%assetDef = AssetDatabase.acquireAsset(%assetId);
%previewFilePath = %previewPath @ %assetDef.assetName @ "_Preview.png";
if(!isFile(%previewFilePath) || (compareFileTimes(%assetDef.getImagePath(), %previewFilePath) == 1))
@ -196,12 +224,10 @@ function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData, %f
%generatePreview = true;
}
%previewAssetName = %module.moduleId @ "_" @ %assetDef.assetName @ "_PreviewImage";
%previewAssetName = %previewButton.moduleName @ "_" @ %assetDef.assetName @ "_PreviewImage";
if(%generatePreview || %forcePreviewRegenerate)
if(%generatePreview || %forceRegenerate)
{
displayEditorLoadingGui("Generating Image Asset Preview...");
%success = saveScaledImage(%assetDef.getImagePath(), %previewFilePath, EditorSettings.value("Assets/Browser/PreviewImageSize"));
if(%success)
@ -222,49 +248,28 @@ function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData, %f
%toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1);
%success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath);
if(!%success)
{
return false; //failed to register the preview image for some reason?
}
}
else
{
%previewFilePath = %assetDef.getImagePath();
%previewAssetName = %module.moduleId @ ":" @ %assetDef.assetName;
%previewButton.bitmapAsset = %previewAssetName;
return true;
}
hideEditorLoadingGui();
}
else
{
%previewAssetName = "ToolsModule:" @ %previewAssetName;
}
//Revalidate. If it didn't work, just use the default placeholder one
if(!isFile(%previewFilePath))
//just map the existing one then
if(AssetDatabase.isDeclaredAsset("ToolsModule:" @ %previewAssetName))
{
%previewData.previewImage = "ToolsModule:genericAssetIcon_image";
%previewButton.bitmapAsset = "ToolsModule:" @ %previewAssetName;
return true;
}
else
{
%previewData.previewImage = %previewAssetName;
}
%previewData.assetName = %assetDef.assetName;
%previewData.assetPath = %assetDef.scriptFile;
%previewData.assetFriendlyName = %assetDef.assetName;
%previewData.assetDesc = %assetDef.description;
//image info
%info = %assetDef.getImageInfo();
%previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\n" @
"Asset Type: Image Asset\n" @
"Asset Definition ID: " @ %assetDef @ "\n" @
"Image Type: " @ %assetDef.imageType @ "\n" @
"Format: " @ getWord(%info, 0) @ "\n" @
"Height: " @ getWord(%info, 1) @ "\n" @
"Width: " @ getWord(%info, 2) @ "\n" @
"Depth: " @ getWord(%info, 3) @ "\n" @
"Image File path: " @ %assetDef.getImagePath();
return false;
}
//Renames the asset

View file

@ -426,8 +426,43 @@ function AssetBrowser::importMaterialAsset(%this, %assetItem)
function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData, %forcePreviewRegenerate)
{
if(%forcePreviewRegenerate $= "")
%forcePreviewRegenerate = false;
%previewData.previewImage = "ToolsModule:genericAssetIcon_image";
%previewData.previewLoaded = false; //this marks it for loading progressively later
%previewData.assetName = %assetDef.assetName;
%previewData.assetPath = %assetDef.scriptFile;
%previewData.assetFriendlyName = %assetDef.assetName;
%previewData.assetDesc = %assetDef.description;
if(%this.selectMode)
%previewData.doubleClickCommand = "AssetBrowser.selectAsset( AssetBrowser.selectedAsset );";
else
%previewData.doubleClickCommand = "AssetBrowser.editAsset( "@%assetDef@" );";
%definitionPath = %assetDef.getScriptPath();
if(%definitionPath $= "")
%definitionPath = %assetDef.getFilename();
%previewData.tooltip = "Asset Name: " @ %assetDef.assetName @
"\nAsset Type: Material Asset" @
"\nAsset Definition ID: " @ %assetDef @
"\nDefinition Path: " @ %definitionPath;
if(!%this.selectMode)
{
%previewData.doubleClickCommand = "AssetBrowser.editAsset( "@%assetDef@" );";
}
}
function AssetBrowser::generateMaterialAssetPreviewImage(%this, %previewButton, %forceRegenerate)
{
if(%forceRegenerate $= "")
%forceRegenerate = false;
%assetId = %previewButton.moduleName @ ":" @ %previewButton.assetName;
%assetDef = AssetDatabase.acquireAsset(%assetId);
%module = %this.dirHandler.getModuleFromAddress(makeRelativePath(filePath(AssetDatabase.getAssetFilePath(%assetDef.getAssetId()))));
%previewPath = "tools/resources/previewCache/" @ %module.moduleId @ "/";
@ -456,10 +491,8 @@ function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData,
%previewAssetName = %module.moduleId @ "_" @ %assetDef.assetName @ "_PreviewImage";
if(%generatePreview || %forcePreviewRegenerate)
if(%generatePreview || %forceRegenerate)
{
displayEditorLoadingGui("Generating Material Asset Preview...");
if(isObject(%assetDef.materialDefinitionName))
{
//real fast, we'll be 100% sure that the image resource we need is loaded
@ -490,50 +523,28 @@ function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData,
%toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1);
%success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath);
if(!%success)
{
return false; //failed to register the preview image for some reason?
}
}
else
%previewButton.bitmapAsset = %previewAssetName;
return true;
}
}
else
{
//just map the existing one then
if(AssetDatabase.isDeclaredAsset("ToolsModule:" @ %previewAssetName))
{
error("Failed to generate preview for material: " @ %assetDef.materialDefinitionName);
%previewButton.bitmapAsset = "ToolsModule:" @ %previewAssetName;
return true;
}
hideEditorLoadingGui();
}
//Revalidate. If it didn't work, just use the default placeholder one
if(!isFile(%previewFilePath))
{
%previewData.previewImage = "ToolsModule:materialIcon_image";
}
else
{
%previewData.previewImage = "ToolsModule:" @ %previewAssetName;
}
%previewData.assetName = %assetDef.assetName;
%previewData.assetPath = %assetDef.scriptFile;
%previewData.assetFriendlyName = %assetDef.assetName;
%previewData.assetDesc = %assetDef.description;
if(%this.selectMode)
%previewData.doubleClickCommand = "AssetBrowser.selectAsset( AssetBrowser.selectedAsset );";
else
%previewData.doubleClickCommand = "AssetBrowser.editAsset( "@%assetDef@" );";
%definitionPath = %assetDef.getScriptPath();
if(%definitionPath $= "")
%definitionPath = %assetDef.getFilename();
%previewData.tooltip = "Asset Name: " @ %assetDef.assetName @
"\nAsset Type: Material Asset" @
"\nAsset Definition ID: " @ %assetDef @
"\nDefinition Path: " @ %definitionPath;
if(!%this.selectMode)
{
%previewData.doubleClickCommand = "AssetBrowser.editAsset( "@%assetDef@" );";
}
return false;
}
function AssetBrowser::onMaterialAssetEditorDropped(%this, %assetDef, %position)

View file

@ -265,8 +265,44 @@ function AssetBrowser::importShapeAsset(%this, %assetItem)
function AssetBrowser::buildShapeAssetPreview(%this, %assetDef, %previewData, %forcePreviewRegenerate)
{
if(%forcePreviewRegenerate $= "")
%forcePreviewRegenerate = false;
%previewData.previewImage = "ToolsModule:genericAssetIcon_image";
%previewData.previewLoaded = false; //this marks it for loading progressively later
%previewData.assetName = %assetDef.assetName;
%previewData.assetPath = %assetDef.fileName;
%previewData.assetFriendlyName = %assetDef.assetName;
%previewData.assetDesc = %assetDef.description;
%previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\n" @
"Asset Type: Shape Asset\n" @
"Asset Definition ID: " @ %assetDef @ "\n" @
"Shape File path: " @ %assetDef.getShapePath();
if(%this.selectMode)
{
%previewData.doubleClickCommand = "AssetBrowser.selectAsset( AssetBrowser.selectedAsset );";
}
else
{
if(EditorSettings.value("Assets/Browser/doubleClickAction", "Edit Asset") $= "Edit Asset")
{
%previewData.doubleClickCommand = "AssetBrowser.editAsset( "@%assetDef@" );";
}
else
{
%previewData.doubleClickCommand = "AssetBrowser.onShapeAssetEditorDropped( "@%assetDef@" );";
}
}
}
function AssetBrowser::generateShapeAssetPreviewImage(%this, %previewButton, %forceRegenerate)
{
if(%forceRegenerate $= "")
%forceRegenerate = false;
%assetId = %previewButton.moduleName @ ":" @ %previewButton.assetName;
%assetDef = AssetDatabase.acquireAsset(%assetId);
%module = %this.dirHandler.getModuleFromAddress(makeRelativePath(filePath(%assetDef.getShapePath())));
%previewPath = "tools/resources/previewCache/" @ %module.moduleId @ "/";
@ -286,10 +322,8 @@ function AssetBrowser::buildShapeAssetPreview(%this, %assetDef, %previewData, %f
%previewAssetName = %module.moduleId @ "_" @ %assetDef.assetName @ "_PreviewImage";
if(%generatePreview || %forcePreviewRegenerate)
if(%generatePreview || %forceRegenerate)
{
displayEditorLoadingGui("Generating Shape Asset Preview...");
//real fast, we'll be 100% sure that the image resource we need is loaded
%matSlot0AssetId = %assetDef.materialSlot0;
@ -322,46 +356,31 @@ function AssetBrowser::buildShapeAssetPreview(%this, %assetDef, %previewData, %f
%toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1);
%success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath);
}
hideEditorLoadingGui();
if(!%success)
{
return false; //failed to register the preview image for some reason?
}
//Revalidate. If it didn't work, just use the default placeholder one
if(!isFile(%previewFilePath))
{
%previewData.previewImage = "ToolsModule:genericAssetIcon_image";
}
else
{
%previewData.previewImage = "ToolsModule:" @ %previewAssetName;
%previewAssetName = "ToolsModule:" @ %previewAssetName;
}
%previewData.assetName = %assetDef.assetName;
%previewData.assetPath = %assetDef.fileName;
%previewData.assetFriendlyName = %assetDef.assetName;
%previewData.assetDesc = %assetDef.description;
%previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\n" @
"Asset Type: Shape Asset\n" @
"Asset Definition ID: " @ %assetDef @ "\n" @
"Shape File path: " @ %assetDef.getShapePath();
if(%this.selectMode)
{
%previewData.doubleClickCommand = "AssetBrowser.selectAsset( AssetBrowser.selectedAsset );";
%previewButton.bitmapAsset = %previewAssetName;
return true;
}
else
{
if(EditorSettings.value("Assets/Browser/doubleClickAction", "Edit Asset") $= "Edit Asset")
//just map the existing one then
if(AssetDatabase.isDeclaredAsset("ToolsModule:" @ %previewAssetName))
{
%previewData.doubleClickCommand = "AssetBrowser.editAsset( "@%assetDef@" );";
}
else
{
%previewData.doubleClickCommand = "AssetBrowser.onShapeAssetEditorDropped( "@%assetDef@" );";
%previewButton.bitmapAsset = "ToolsModule:" @ %previewAssetName;
return true;
}
}
return false;
}
function AssetBrowser::onShapeAssetEditorDropped(%this, %assetDef, %position)

View file

@ -111,8 +111,35 @@ function AssetBrowser::moveTerrainMaterialAsset(%this, %assetDef, %destination)
function AssetBrowser::buildTerrainMaterialAssetPreview(%this, %assetDef, %previewData, %forcePreviewRegenerate)
{
if(%forcePreviewRegenerate $= "")
%forcePreviewRegenerate = false;
%previewData.previewImage = "ToolsModule:genericAssetIcon_image";
%previewData.previewLoaded = false; //this marks it for loading progressively later
%previewData.assetName = %assetDef.assetName;
%previewData.assetPath = "";
%previewData.doubleClickCommand = "";
%previewData.assetFriendlyName = %assetDef.gameObjectName;
%previewData.assetDesc = %assetDef.description;
%previewData.tooltip = %assetDef.gameObjectName;
%definitionPath = %assetDef.getScriptPath();
if(%definitionPath $= "")
%definitionPath = %assetDef.getFilename();
%previewData.tooltip = "Asset Name: " @ %assetDef.assetName @
"\nAsset Type: Terrain Material Asset" @
"\nAsset Definition ID: " @ %assetDef @
"\nDefinition Path: " @ %definitionPath;
}
function AssetBrowser::generateTerrainMaterialAssetPreviewImage(%this, %previewButton, %forceRegenerate)
{
if(%forceRegenerate $= "")
%forceRegenerate = false;
%assetId = %previewButton.moduleName @ ":" @ %previewButton.assetName;
%assetDef = AssetDatabase.acquireAsset(%assetId);
%module = %this.dirHandler.getModuleFromAddress(makeRelativePath(filePath(AssetDatabase.getAssetFilePath(%assetDef.getAssetId()))));
%previewPath = "tools/resources/previewCache/" @ %module.moduleId @ "/";
@ -141,10 +168,8 @@ function AssetBrowser::buildTerrainMaterialAssetPreview(%this, %assetDef, %previ
%previewAssetName = %module.moduleId @ "_" @ %assetDef.assetName @ "_PreviewImage";
if(%generatePreview || %forcePreviewRegenerate)
if(%generatePreview || %forceRegenerate)
{
displayEditorLoadingGui("Generating Material Asset Preview...");
if(isObject(%assetDef.materialDefinitionName))
{
%previewShapeDef = AssetDatabase.acquireAsset("ToolsModule:previewSphereShape");
@ -169,38 +194,28 @@ function AssetBrowser::buildTerrainMaterialAssetPreview(%this, %assetDef, %previ
%toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1);
%success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath);
if(!%success)
{
return false; //failed to register the preview image for some reason?
}
}
hideEditorLoadingGui();
%previewButton.bitmapAsset = %previewAssetName;
return true;
}
//Revalidate. If it didn't work, just use the default placeholder one
if(!isFile(%previewFilePath))
{
%previewData.previewImage = "ToolsModule:terrainMaterialIcon_image";
}
else
{
%previewData.previewImage = "ToolsModule:" @ %previewAssetName;
//just map the existing one then
if(AssetDatabase.isDeclaredAsset("ToolsModule:" @ %previewAssetName))
{
%previewButton.bitmapAsset = "ToolsModule:" @ %previewAssetName;
return true;
}
}
%previewData.assetName = %assetDef.assetName;
%previewData.assetPath = "";
%previewData.doubleClickCommand = "";
%previewData.assetFriendlyName = %assetDef.gameObjectName;
%previewData.assetDesc = %assetDef.description;
%previewData.tooltip = %assetDef.gameObjectName;
%definitionPath = %assetDef.getScriptPath();
if(%definitionPath $= "")
%definitionPath = %assetDef.getFilename();
%previewData.tooltip = "Asset Name: " @ %assetDef.assetName @
"\nAsset Type: Terrain Material Asset" @
"\nAsset Definition ID: " @ %assetDef @
"\nDefinition Path: " @ %definitionPath;
return false;
}
function GuiInspectorTypeTerrainMaterialAssetPtr::onClick( %this, %fieldName )

View file

@ -139,6 +139,33 @@ function newAssetUpdatePath(%newPath)
NewAssetTargetModule.text = AssetBrowser.dirHandler.getModuleFromAddress(AssetBrowser.dirHandler.currentAddress).ModuleId;
}
//
function AssetBrowser::importNewFile(%this)
{
%importingPath = "";
%dlg = new OpenFileDialog()
{
Filters = "(All Files (*.*)|*.*|";
DefaultFile = "";
ChangePath = false;
MustExist = true;
MultipleFiles = false;
forceRelativePath = false;
};
if ( %dlg.Execute() )
{
%importingPath = makeFullPath(%dlg.FileName);
}
%dlg.delete();
AssetBrowser.onBeginDropFiles();
AssetBrowser.onDropFile(%importingPath);
AssetBrowser.onEndDropFiles();
}
//
function NewAssetTargetModule::onSelect(%this, %idx, %idy)
{

View file

@ -1,7 +1,7 @@
singleton GuiControlProfile(AssetBrowserPreviewImageAsset : ToolsGuiDefaultProfile)
{
fillColor = "128 128 128 255"; //hovered/selected
//fillColorNA = "230 126 0 255"; //fill color default
fillcolor = EditorSettings.value("Theme/windowBackgroundColor");
fillColorHL = EditorSettings.value("Theme/fieldBGHLColor");
border = true;
borderColor = "230 126 0 255";
@ -10,7 +10,8 @@ singleton GuiControlProfile(AssetBrowserPreviewImageAsset : ToolsGuiDefaultProfi
singleton GuiControlProfile(AssetBrowserPreviewMaterialAsset : ToolsGuiDefaultProfile)
{
fillColor = "128 128 128 255"; //hovered/selected
fillcolor = EditorSettings.value("Theme/windowBackgroundColor");
fillColorHL = EditorSettings.value("Theme/fieldBGHLColor");
border = true;
borderColor = "0 100 0 255";
@ -19,7 +20,8 @@ singleton GuiControlProfile(AssetBrowserPreviewMaterialAsset : ToolsGuiDefaultPr
singleton GuiControlProfile(AssetBrowserPreviewShapeAsset : ToolsGuiDefaultProfile)
{
fillColor = "128 128 128 255"; //hovered/selected
fillcolor = EditorSettings.value("Theme/windowBackgroundColor");
fillColorHL = EditorSettings.value("Theme/fieldBGHLColor");
border = true;
borderColor = "0 0 200 255";
@ -28,7 +30,8 @@ singleton GuiControlProfile(AssetBrowserPreviewShapeAsset : ToolsGuiDefaultProfi
singleton GuiControlProfile(AssetBrowserPreviewShapeAnimationAsset : ToolsGuiDefaultProfile)
{
fillColor = "128 128 128 255"; //hovered/selected
fillcolor = EditorSettings.value("Theme/windowBackgroundColor");
fillColorHL = EditorSettings.value("Theme/fieldBGHLColor");
border = true;
borderColor = "0 0 200 255";
@ -37,7 +40,8 @@ singleton GuiControlProfile(AssetBrowserPreviewShapeAnimationAsset : ToolsGuiDef
singleton GuiControlProfile(AssetBrowserPreviewSoundAsset : ToolsGuiDefaultProfile)
{
fillColor = "128 128 128 255"; //hovered/selected
fillcolor = EditorSettings.value("Theme/windowBackgroundColor");
fillColorHL = EditorSettings.value("Theme/fieldBGHLColor");
border = true;
borderColor = "75 101 135 255";
@ -46,7 +50,8 @@ singleton GuiControlProfile(AssetBrowserPreviewSoundAsset : ToolsGuiDefaultProfi
singleton GuiControlProfile(AssetBrowserPreviewTerrainAsset : ToolsGuiDefaultProfile)
{
fillColor = "128 128 128 255"; //hovered/selected
fillcolor = EditorSettings.value("Theme/windowBackgroundColor");
fillColorHL = EditorSettings.value("Theme/fieldBGHLColor");
border = true;
borderColor = "200 198 198 255";
@ -55,7 +60,8 @@ singleton GuiControlProfile(AssetBrowserPreviewTerrainAsset : ToolsGuiDefaultPro
singleton GuiControlProfile(AssetBrowserPreviewTerrainMaterialAsset : ToolsGuiDefaultProfile)
{
fillColor = "128 128 128 255"; //hovered/selected
fillcolor = EditorSettings.value("Theme/windowBackgroundColor");
fillColorHL = EditorSettings.value("Theme/fieldBGHLColor");
border = true;
borderColor = "200 198 198 255";
@ -64,7 +70,8 @@ singleton GuiControlProfile(AssetBrowserPreviewTerrainMaterialAsset : ToolsGuiDe
singleton GuiControlProfile(AssetBrowserPreviewStateMachineAsset : ToolsGuiDefaultProfile)
{
fillColor = "128 128 128 255"; //hovered/selected
fillcolor = EditorSettings.value("Theme/windowBackgroundColor");
fillColorHL = EditorSettings.value("Theme/fieldBGHLColor");
border = true;
borderColor = "0 76 135 255";
@ -73,7 +80,8 @@ singleton GuiControlProfile(AssetBrowserPreviewStateMachineAsset : ToolsGuiDefau
singleton GuiControlProfile(AssetBrowserPreviewGUIAsset : ToolsGuiDefaultProfile)
{
fillColor = "128 128 128 255"; //hovered/selected
fillcolor = EditorSettings.value("Theme/windowBackgroundColor");
fillColorHL = EditorSettings.value("Theme/fieldBGHLColor");
border = true;
borderColor = "17 5 44 255";
@ -82,7 +90,8 @@ singleton GuiControlProfile(AssetBrowserPreviewGUIAsset : ToolsGuiDefaultProfile
singleton GuiControlProfile(AssetBrowserPreviewLevelAsset : ToolsGuiDefaultProfile)
{
fillColor = "128 128 128 255"; //hovered/selected
fillcolor = EditorSettings.value("Theme/windowBackgroundColor");
fillColorHL = EditorSettings.value("Theme/fieldBGHLColor");
border = true;
borderColor = "0 208 186 255";

View file

@ -285,6 +285,12 @@ new GuiControlProfile( ToolsGuiTextArrayProfile : ToolsGuiTextProfile )
if( !isObject( ToolsGuiTextListProfile ) )
new GuiControlProfile( ToolsGuiTextListProfile : ToolsGuiTextProfile )
{
fontColor = EditorSettings.value("Theme/fieldTextColor");
fontColorHL = EditorSettings.value("Theme/fieldTextHLColor");
fontColorSEL = EditorSettings.value("Theme/fieldTextSELColor");
fillColor = EditorSettings.value("Theme/fieldBGColor");
fillColorHL = EditorSettings.value("Theme/fieldBGHLColor");
fillColorSEL = EditorSettings.value("Theme/fieldBGSELColor");
tab = true;
canKeyFocus = true;
category = "Tools";

View file

@ -45,7 +45,7 @@ $guiContent = new GuiControl() {
EdgeSnap = "1";
text = "Shapes";
new GuiTabBookCtrl() {
new GuiTabBookCtrl(ShapeEditorTabbook) {
internalName = "tabBook";
canSaveDynamicFields = "0";
isContainer = "1";
@ -175,126 +175,8 @@ $guiContent = new GuiControl() {
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
text = "Library";
text = "Assets";
maxLength = "1024";
new GuiContainer() {
isContainer = "1";
HorizSizing = "width";
VertSizing = "height";
position = "0 0";
Extent = "202 146";
MinExtent = "0 -500";
Profile = "GuiInspectorProfile";
};
new GuiBitmapBorderCtrl() {
isContainer = "1";
HorizSizing = "width";
VertSizing = "height";
position = "0 0";
Extent = "202 146";
MinExtent = "0 -500";
Profile = "ToolsGuiTabBorderProfile";
};
new GuiBitmapButtonCtrl() {
canSaveDynamicFields = "0";
isContainer = "0";
Profile = "ToolsGuiButtonProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "3 4";
Extent = "20 19";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
Command = "ShapeEdSelectWindow.navigateUp();";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
groupNum = "0";
buttonType = "PushButton";
useMouseEvents = "0";
bitmapAsset = "ToolsModule:folderUp_image";
};
new GuiPopUpMenuCtrl(ShapeEdSelectMenu) {
canSaveDynamicFields = "0";
isContainer = "0";
Profile = "ToolsGuiPopUpMenuProfile";
HorizSizing = "width";
VertSizing = "bottom";
position = "26 4";
Extent = "172 18";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
text = "art";
maxLength = "1024";
maxPopupHeight = "200";
sbUsesNAColor = "0";
reverseTextList = "0";
bitmapBounds = "16 16";
};
new GuiScrollCtrl() {
canSaveDynamicFields = "0";
isContainer = "1";
Profile = "ToolsGuiScrollProfile";
HorizSizing = "width";
VertSizing = "height";
position = "0 24";
Extent = "202 122";
MinExtent = "8 -500";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
willFirstRespond = "1";
hScrollBar = "dynamic";
vScrollBar = "dynamic";
lockHorizScroll = false;
lockVertScroll = "false";
constantThumbHeight = "0";
childMargin = "0 0";
mouseWheelScrollSpeed = "-1";
new GuiDynamicCtrlArrayControl() {
internalName = "shapeLibrary";
canSaveDynamicFields = "0";
isContainer = "1";
Profile = "ToolsGuiTransparentProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "1 1";
Extent = "189 42";
MinExtent = "8 11";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
colCount = "1";
colSize = "64";
rowCount = "0";
RowSize = "64";
rowSpacing = "4";
colSpacing = "4";
frozen = "0";
autoCellSize = "1";
fillRowFirst = "1";
dynamicSize = "1";
};
};
};
//---------------------------------------------------------------

View file

@ -127,7 +127,6 @@ function ShapeEditorPlugin::onWorldEditorStartup(%this)
ShapeEdSeqNodeTabBook.selectPage(0);
ShapeEdAdvancedWindow-->tabBook.selectPage(0);
ShapeEdSelectWindow-->tabBook.selectPage(0);
ShapeEdSelectWindow.navigate("");
SetToggleButtonValue( ShapeEditorToolbar-->orbitNodeBtn, 0 );
SetToggleButtonValue( ShapeEditorToolbar-->ghostMode, 0 );

View file

@ -366,230 +366,6 @@ function ShapeEdShapeTreeView::onSelect( %this, %obj )
ShapeEdHintMenu.setSelected( %hintId );
}
// Find all DTS or COLLADA models. Note: most of this section was shamelessly
// stolen from creater.ed.tscript => great work whoever did the original!
function ShapeEdSelectWindow::navigate( %this, %address )
{
// Freeze the icon array so it doesn't update until we've added all of the
// icons
%this-->shapeLibrary.frozen = true;
%this-->shapeLibrary.clear();
ShapeEdSelectMenu.clear();
%filePatterns = getFormatExtensions();
%fullPath = findFirstFileMultiExpr( %filePatterns );
while ( %fullPath !$= "" )
{
// Ignore cached DTS files
if ( endswith( %fullPath, "cached.dts" ) )
{
%fullPath = findNextFileMultiExpr( %filePatterns );
continue;
}
// Ignore assets in the tools folder
%fullPath = makeRelativePath( %fullPath, getMainDotCSDir() );
%splitPath = strreplace( %fullPath, " ", "_" );
%splitPath = strreplace( %splitPath, "/", " " );
if ( getWord( %splitPath, 0 ) $= "tools" )
{
%fullPath = findNextFileMultiExpr( %filePatterns );
continue;
}
%dirCount = getWordCount( %splitPath ) - 1;
%pathFolders = getWords( %splitPath, 0, %dirCount - 1 );
// Add this file's path ( parent folders ) to the
// popup menu if it isn't there yet.
%temp = strreplace( %pathFolders, " ", "/" );
%temp = strreplace( %temp, "_", " " );
%r = ShapeEdSelectMenu.findText( %temp );
if ( %r == -1 )
ShapeEdSelectMenu.add( %temp );
// Is this file in the current folder?
if ( stricmp( %pathFolders, %address ) == 0 )
{
%this.addShapeIcon( %fullPath );
}
// Then is this file in a subfolder we need to add
// a folder icon for?
else
{
%wordIdx = 0;
%add = false;
if ( %address $= "" )
{
%add = true;
%wordIdx = 0;
}
else
{
for ( ; %wordIdx < %dirCount; %wordIdx++ )
{
%temp = getWords( %splitPath, 0, %wordIdx );
if ( stricmp( %temp, %address ) == 0 )
{
%add = true;
%wordIdx++;
break;
}
}
}
if ( %add == true )
{
%folder = getWord( %splitPath, %wordIdx );
// Add folder icon if not already present
%ctrl = %this.findIconCtrl( %folder );
if ( %ctrl == -1 )
%this.addFolderIcon( %folder );
}
}
%fullPath = findNextFileMultiExpr( %filePatterns );
}
%this-->shapeLibrary.sort( "alphaIconCompare" );
for ( %i = 0; %i < %this-->shapeLibrary.getCount(); %i++ )
%this-->shapeLibrary.getObject( %i ).autoSize = false;
%this-->shapeLibrary.frozen = false;
%this-->shapeLibrary.refresh();
%this.address = %address;
ShapeEdSelectMenu.sort();
%str = strreplace( %address, " ", "/" );
%r = ShapeEdSelectMenu.findText( %str );
if ( %r != -1 )
ShapeEdSelectMenu.setSelected( %r, false );
else
ShapeEdSelectMenu.setText( %str );
}
function ShapeEdSelectWindow::navigateDown( %this, %folder )
{
if ( %this.address $= "" )
%address = %folder;
else
%address = %this.address SPC %folder;
// Because this is called from an IconButton::onClick command
// we have to wait a tick before actually calling navigate, else
// we would delete the button out from under itself.
%this.schedule( 1, "navigate", %address );
}
function ShapeEdSelectWindow::navigateUp( %this )
{
%count = getWordCount( %this.address );
if ( %count == 0 )
return;
if ( %count == 1 )
%address = "";
else
%address = getWords( %this.address, 0, %count - 2 );
%this.navigate( %address );
}
function ShapeEdSelectWindow::findIconCtrl( %this, %name )
{
for ( %i = 0; %i < %this-->shapeLibrary.getCount(); %i++ )
{
%ctrl = %this-->shapeLibrary.getObject( %i );
if ( %ctrl.text $= %name )
return %ctrl;
}
return -1;
}
function ShapeEdSelectWindow::createIcon( %this )
{
%ctrl = new GuiIconButtonCtrl()
{
profile = "GuiCreatorIconButtonProfile";
iconLocation = "Left";
textLocation = "Right";
extent = "348 19";
textMargin = 8;
buttonMargin = "2 2";
autoSize = false;
sizeIconToButton = true;
makeIconSquare = true;
buttonType = "radioButton";
groupNum = "-1";
};
return %ctrl;
}
function ShapeEdSelectWindow::addFolderIcon( %this, %text )
{
%ctrl = %this.createIcon();
%ctrl.altCommand = "ShapeEdSelectWindow.navigateDown( \"" @ %text @ "\" );";
%ctrl.iconBitmap = "tools/gui/images/folder.png";
%ctrl.text = %text;
%ctrl.tooltip = %text;
%ctrl.class = "CreatorFolderIconBtn";
%ctrl.buttonType = "radioButton";
%ctrl.groupNum = "-1";
%this-->shapeLibrary.addGuiControl( %ctrl );
}
function ShapeEdSelectWindow::addShapeIcon( %this, %fullPath )
{
%ctrl = %this.createIcon();
%ext = fileExt( %fullPath );
%file = fileBase( %fullPath );
%fileLong = %file @ %ext;
%tip = %fileLong NL
"Size: " @ fileSize( %fullPath ) / 1000.0 SPC "KB" NL
"Date Created: " @ fileCreatedTime( %fullPath ) NL
"Last Modified: " @ fileModifiedTime( %fullPath );
%ctrl.altCommand = "ShapeEdSelectWindow.onSelect( \"" @ %fullPath @ "\" );";
%ctrl.iconBitmap = ( ( %ext $= ".dts" ) ? EditorIconRegistry::findIconByClassName( "TSStatic" ) : "tools/gui/images/iconCollada" );
%ctrl.text = %file;
%ctrl.class = "CreatorStaticIconBtn";
%ctrl.tooltip = %tip;
%ctrl.buttonType = "radioButton";
%ctrl.groupNum = "-1";
// Check if a shape specific icon is available
%formats = ".png .jpg .dds .bmp .gif .jng .tga";
%count = getWordCount( %formats );
for ( %i = 0; %i < %count; %i++ )
{
%ext = getWord( %formats, %i );
if ( isFile( %fullPath @ %ext ) )
{
%ctrl.iconBitmap = %fullPath @ %ext;
break;
}
}
%this-->shapeLibrary.addGuiControl( %ctrl );
}
function ShapeEdSelectMenu::onSelect( %this, %id, %text )
{
%split = strreplace( %text, "/", " " );
ShapeEdSelectWindow.navigate( %split );
}
// Update the GUI in response to the shape selection changing
function ShapeEdPropWindow::update_onShapeSelectionChanged( %this )
{
@ -3444,3 +3220,18 @@ function showShapeEditorPreview()
%visible = ShapeEditorToolbar-->showPreview.getValue();
ShapeEdPreviewGui.setVisible( %visible );
}
//
function ShapeEditorTabbook::onTabSelected( %this )
{
if( ShapeEditorTabbook.getSelectedPage() == 1)
{
AssetBrowser.showDialog("ShapeAsset", "openShapeInShapeEditor");
}
}
function openShapeInShapeEditor(%shapeAssetId)
{
%assetDef = AssetDatabase.acquireAsset(%shapeAssetId);
AssetBrowser.editShapeAsset(%assetDef);
}

View file

@ -176,6 +176,29 @@ $guiContent = new GuiControl() {
};
};
};
new GuiTabPageCtrl() {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "1";
Profile = "ToolsGuiEditorTabPage";
HorizSizing = "width";
VertSizing = "height";
position = "0 19";
Extent = "197 271";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
text = "Assets";
maxLength = "1024";
};
};
new GuiBitmapButtonCtrl() {
canSaveDynamicFields = "0";

View file

@ -586,7 +586,7 @@ function TerrainImportGuiAddOpacityMap( %name )
// once per channel in the file
// currently it works with just grayscale.
%channelsTxt = "R" TAB "G" TAB "B" TAB "A";
%bitmapInfo = getBitmapinfo( %name );
%bitmapInfo = getBitmapinfo( makeFullPath(%name) );
%channelCount = getWord( %bitmapInfo, 2 );

View file

@ -1932,9 +1932,8 @@ function EditorTreeTabBook::onTabSelected( %this )
}
else
{
EWTreeWindow-->DeleteSelection.visible = false;
EWTreeWindow-->LockSelection.visible = false;
EWTreeWindow-->AddSimGroup.visible = false;
AssetBrowser.showDialog("ShapeAsset Datablock");
EditorTreeTabBook.selectPage(0);
}
}

View file

@ -191,6 +191,7 @@ package EditorDisconnectOverride
{
if ( isObject( Editor ) && Editor.isEditorEnabled() )
{
EditorGui.saveAs = false; //whatever edits we were doing are irrelevent now
%mainMenuGUI = ProjectSettings.value("UI/mainMenuName");
if (isObject( %mainMenuGUI ))
Editor.close( %mainMenuGUI );

View file

@ -158,7 +158,7 @@ function EditorGui::buildMenus(%this)
//%fileMenu.appendItem("Create Blank Terrain" TAB "" TAB "Canvas.pushDialog( CreateNewTerrainGui );");
%fileMenu.appendItem("Create Blank Terrain" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"TerrainAsset\", AssetBrowser.selectedModule, createTerrainBlock);");
%fileMenu.appendItem("Import Terrain Heightmap" TAB "" TAB "Canvas.pushDialog( TerrainImportGui );");
%fileMenu.appendItem("Import Terrain Heightmap" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"TerrainAsset\", AssetBrowser.selectedModule, createTerrainBlock); Canvas.pushDialog( TerrainImportGui );");
%fileMenu.appendItem("Export Terrain Heightmap" TAB "" TAB "Canvas.pushDialog( TerrainExportGui );");
%fileMenu.appendItem("-");

View file

@ -467,6 +467,19 @@ if(WIN32)
ENDFOREACH()
endif()
else()
if(${CMAKE_VERSION} VERSION_LESS "3.16.0")
macro(CHECK_OBJC_SOURCE_COMPILES SOURCE VAR)
set(PREV_REQUIRED_DEFS "${CMAKE_REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_DEFINITIONS "-x objective-c ${PREV_REQUIRED_DEFS}")
CHECK_C_SOURCE_COMPILES(${SOURCE} ${VAR})
set(CMAKE_REQUIRED_DEFINITIONS "${PREV_REQUIRED_DEFS}")
endmacro()
else()
include(CheckOBJCSourceCompiles)
if (APPLE)
enable_language(OBJC)
endif()
endif()
# TODO: improve default settings on other platforms
set(TORQUE_CXX_FLAGS_EXECUTABLES "" CACHE STRING "")
mark_as_advanced(TORQUE_CXX_FLAGS_EXECUTABLES)