Merge branch 'Preview4_0' into kermithelpme

This commit is contained in:
AzaezelX 2021-10-03 17:23:52 -05:00
commit 52040fb072
29 changed files with 397 additions and 92 deletions

View file

@ -1802,7 +1802,7 @@ function matchesSearch(%assetName, %assetType)
}
else
{
if(%assetName.tags !$= %word)
if(strstr(strlwr(%assetName.tags), strlwr(%word)) != -1)
%matchTags = true;
}
}

View file

@ -1097,9 +1097,6 @@ function MaterialEditorGui::updateActiveMaterial(%this, %propertyField, %value,
{
MaterialEditorGui.setMaterialDirty();
if(%value $= "")
%value = "\"\"";
// Here is where we handle undo actions with slider controls. We want to be able to
// undo every onMouseUp; so we overrite the same undo action when necessary in order
// to achieve this desired effect.
@ -1130,7 +1127,7 @@ function MaterialEditorGui::updateActiveMaterial(%this, %propertyField, %value,
if (MaterialEditorGui.livePreview == true)
{
MaterialEditorGui.setFieldValue(%propertyField, %value);
MaterialEditorGui.currentMaterial.setFieldValue(%propertyField, %value);
MaterialEditorGui.currentMaterial.flush();
MaterialEditorGui.currentMaterial.reload();
}
@ -1263,8 +1260,8 @@ function MaterialEditorGui::doUpdateTextureMap( %this, %assetId )
%bitmap = strreplace(%bitmap,"tools/materialEditor/scripts/","");
%bitmapCtrl.setBitmap(%bitmap);
%textCtrl.setText(%assetId);
MaterialEditorGui.updateActiveMaterial(%type @ "Map[" @ %layer @ "]","\"\"");
MaterialEditorGui.updateActiveMaterial(%type @ "MapAsset[" @ %layer @ "]","\"" @ %assetId @ "\"");
MaterialEditorGui.updateActiveMaterial(%type @ "Map[" @ %layer @ "]","");
MaterialEditorGui.updateActiveMaterial(%type @ "MapAsset[" @ %layer @ "]", %assetId);
}
}
@ -1276,7 +1273,7 @@ function MaterialEditorGui::updateDetailScale(%this,%newScale)
{
%layer = MaterialEditorGui.currentLayer;
%detailScale = "\"" @ %newScale SPC %newScale @ "\"";
%detailScale = %newScale SPC %newScale;
MaterialEditorGui.updateActiveMaterial("detailScale[" @ %layer @ "]", %detailScale);
}
@ -1284,7 +1281,7 @@ function MaterialEditorGui::updateDetailNormalStrength(%this,%newStrength)
{
%layer = MaterialEditorGui.currentLayer;
%detailStrength = "\"" @ %newStrength @ "\"";
%detailStrength = %newStrength;
MaterialEditorGui.updateActiveMaterial("detailNormalMapStrength[" @ %layer @ "]", %detailStrength);
}
@ -1295,7 +1292,7 @@ function MaterialEditorGui::updateRotationOffset(%this, %isSlider, %onMouseUp)
%Y = MaterialEditorPropertiesWindow-->RotationTextEditV.getText();
MaterialEditorPropertiesWindow-->RotationCrosshair.setPosition(45*mAbs(%X)-2, 45*mAbs(%Y)-2);
MaterialEditorGui.updateActiveMaterial("rotPivotOffset[" @ %layer @ "]","\"" @ %X SPC %Y @ "\"",%isSlider,%onMouseUp);
MaterialEditorGui.updateActiveMaterial("rotPivotOffset[" @ %layer @ "]", %X SPC %Y,%isSlider,%onMouseUp);
}
function MaterialEditorGui::updateRotationSpeed(%this, %isSlider, %onMouseUp)
@ -1457,7 +1454,7 @@ function MaterialEditorGui::syncGuiColor(%this, %guiCtrl, %propname, %color)
%a = getWord(%color,3);
%colorSwatch = (%r SPC %g SPC %b SPC %a);
%color = "\"" @ %r SPC %g SPC %b SPC %a @ "\"";
%color = %r SPC %g SPC %b SPC %a;
%guiCtrl.color = %colorSwatch;
MaterialEditorGui.updateActiveMaterial(%propName, %color);

View file

@ -516,31 +516,24 @@ function testFilenameExtensions(%filename)
function processLegacyField(%line, %originalFieldName, %newFieldName)
{
if(!strIsMatchExpr("*"@%originalFieldName@"=*\"*\";*", %line) &&
!strIsMatchExpr("*"@%originalFieldName@"[*=*\"*\";*", %line) &&
!strIsMatchExpr("*"@%originalFieldName@" *=*\"*\";*", %line))
if(!strIsMatchExpr("*"@%originalFieldName@"=*;*", %line) &&
!strIsMatchExpr("*"@%originalFieldName@"[*=*;*", %line) &&
!strIsMatchExpr("*"@%originalFieldName@" *=*;*", %line))
return %line;
%outLine = strreplace(%line, %originalFieldName, %newFieldName);
//get the value
%value = "";
%pos = strpos(%outLine, "= \"");
%pos = strpos(%outLine, "=");
if(%pos != -1)
{
%endPos = strpos(%outLine, "\";", %pos);
%endPos = strpos(%outLine, ";", %pos);
%value = getSubStr(%outLine, %pos+1, %endPos-%pos-1);
%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);
}
%originalValue = %value;
%value = trim(%value);
%value = strreplace(%value, "\"", "");
}
if(%outLine !$= %line && %pos != -1 && %endPos != -1 && %value !$= "")
@ -557,8 +550,13 @@ function processLegacyField(%line, %originalFieldName, %newFieldName)
if(isObject(%targetFilename))
{
if(%originalFieldName $= "soundProfile")
//likely a material name, so handle it that way
%assetId = MaterialAsset::getAssetIdByMaterialName(%targetFilename);
if(%assetId $= "" || %assetId $= "Core_Rendering:NoMaterial")
{
//if not, just do a lookup directly to see if it was another asset by that name
//e.g. sound profiles when converted will match names
$ProjectImporter::assetQuery.clear();
%foundAssets = AssetDatabase.findAssetName($ProjectImporter::assetQuery, %targetFilename);
if(%foundAssets != 0)
@ -566,11 +564,6 @@ function processLegacyField(%line, %originalFieldName, %newFieldName)
%assetId = $ProjectImporter::assetQuery.getAsset(0);
}
}
else
{
//likely a material name, so handle it that way
%assetId = MaterialAsset::getAssetIdByMaterialName(%targetFilename);
}
}
else
{
@ -605,6 +598,11 @@ function processLegacyField(%line, %originalFieldName, %newFieldName)
if(%assetId !$= "" && AssetDatabase.isDeclaredAsset(%assetId))
{
echo("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))
%assetId = "\"" @ %assetId @ "\"";
//if (%assetId.getStatusString() $= "Ok")
%outLine = strReplace(%outLine, %value, %assetId);
//else

View file

@ -227,7 +227,7 @@ function EWCreatorWindow::createObject( %this, %cmd )
%this.setNewObjectGroup( getScene(0) );
pushInstantGroup();
%objId = eval(%cmd);
%objId = eval("return " @ %cmd);
popInstantGroup();
if( isObject( %objId ) )