From 7cdace8da3774c584018cc45b47aa666000c577a Mon Sep 17 00:00:00 2001 From: JeffR Date: Sun, 12 Jun 2022 04:27:32 -0500 Subject: [PATCH 1/4] Fixes bounds scaling issue making the object box in the editor be double the convex's size Fixes loading of modified surfaceTextures by properly inserting into stringtable Fixes display of the active and default material previews in the ConvexShape editor Adds buttons to hollow and recenter selected convex to tool window --- Engine/source/T3D/convexShape.cpp | 2 +- .../worldEditor/guiConvexShapeEditorCtrl.cpp | 2 +- .../convexEditor/convexEditorGui.tscript | 20 ++--- .../convexEditor/convexEditorSidebarGui.gui | 89 ++++++++++++++++++- 4 files changed, 95 insertions(+), 18 deletions(-) diff --git a/Engine/source/T3D/convexShape.cpp b/Engine/source/T3D/convexShape.cpp index 5a6ceb4df..14d2d0502 100644 --- a/Engine/source/T3D/convexShape.cpp +++ b/Engine/source/T3D/convexShape.cpp @@ -263,7 +263,7 @@ bool ConvexShape::protectedSetSurfaceTexture(void *object, const char *index, co surfaceMaterial surface; - surface._setMaterial(data); + surface._setMaterial(StringTable->insert(data)); shape->mSurfaceTextures.push_back(surface); diff --git a/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.cpp b/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.cpp index ae1b90df8..5ed87fb0d 100644 --- a/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.cpp +++ b/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.cpp @@ -1075,7 +1075,7 @@ void GuiConvexEditorCtrl::renderScene(const RectI & updateRect) Point3F boxPos = objBox.getCenter(); objMat.mulP( boxPos ); - drawer->drawObjectBox( desc, objBox.getExtents(), boxPos, objMat, ColorI::WHITE ); + drawer->drawObjectBox( desc, objBox.getExtents() / 2, boxPos, objMat, ColorI::WHITE ); } else { diff --git a/Templates/BaseGame/game/tools/convexEditor/convexEditorGui.tscript b/Templates/BaseGame/game/tools/convexEditor/convexEditorGui.tscript index bc067c746..dbfdade80 100644 --- a/Templates/BaseGame/game/tools/convexEditor/convexEditorGui.tscript +++ b/Templates/BaseGame/game/tools/convexEditor/convexEditorGui.tscript @@ -38,7 +38,7 @@ function ConvexEditorGui::onWake( %this ) %mat = %matName; } - ConvexEditorOptionsWindow-->matPreviewBtn.setBitmap( getAssetPreviewImage(%mat.getDiffuseMap(0))); + ConvexEditorOptionsWindow-->matPreviewBtn.bitmapAsset = getAssetPreviewImage(%mat.getDiffuseMap(0)); ConvexEditorOptionsWindow.activeMaterial = %mat; } @@ -78,7 +78,7 @@ function ConvexEditorGui::onSelectionChanged( %this, %shape, %face ) ConvexEditorOptionsWindow-->defMatPreviewBtn.setText(""); %shapeMat = %shape.getMaterial(); - ConvexEditorOptionsWindow-->defMatPreviewBtn.setBitmap(getAssetPreviewImage(%shapeMat.getDiffuseMap(0))); + ConvexEditorOptionsWindow-->defMatPreviewBtn.bitmapAsset = getAssetPreviewImage(%shapeMat.getDiffuseMap(0)); ConvexEditorOptionsWindow.activeShape = %shape; @@ -166,18 +166,8 @@ function ConvexEditorMaterialBtn::gotMaterialName(%this, %name) //eval(%this.object @ "." @ %this.targetField @ " = " @ %name @ ";"); //%this.object.changeMaterial(getTrailingNumber(%this.targetField), %name); //%this.object.inspectorApply(); - %diffusemap = %materialAsset.materialDefinitionName.getDiffuseMap(0); - if(%diffusemap $= "") - { - %diffuseAsset = %materialAsset.materialDefinitionName.getDiffuseMapAsset(0); - if(%diffuseAsset !$= "") - { - %diffuseAssetDef = AssetDatabase.acquireAsset(%diffuseAsset); - %diffusemap = %diffuseAssetDef.getImagePath(); - } - } - - ConvexEditorOptionsWindow-->matPreviewBtn.setBitmap(getAssetPreviewImage(%diffusemap)); + %diffusemap = %materialAsset.materialDefinitionName.getDiffuseMapAsset(0); + ConvexEditorOptionsWindow-->matPreviewBtn.bitmapAsset = getAssetPreviewImage(%diffusemap); ConvexEditorOptionsWindow.activeMaterial = %materialAsset.getAssetId(); } @@ -242,7 +232,7 @@ function ConvexEditorDefaultMaterialBtn::gotMaterialName(%this, %name) } } - ConvexEditorOptionsWindow-->defMatPreviewBtn.setBitmap(getAssetPreviewImage(%diffusemap)); + ConvexEditorOptionsWindow-->defMatPreviewBtn.bitmapAsset = getAssetPreviewImage(%diffusemap); ConvexEditorOptionsWindow.activeShape.setMaterial(%name); diff --git a/Templates/BaseGame/game/tools/convexEditor/convexEditorSidebarGui.gui b/Templates/BaseGame/game/tools/convexEditor/convexEditorSidebarGui.gui index 99d9b1852..91a1357c3 100644 --- a/Templates/BaseGame/game/tools/convexEditor/convexEditorSidebarGui.gui +++ b/Templates/BaseGame/game/tools/convexEditor/convexEditorSidebarGui.gui @@ -23,7 +23,7 @@ $guiContnt = new GuiControl(ConvexEditorOptions) anchorRight = "0"; Position = Canvas.extent.x - 209 SPC getWord(EditorGuiToolbar.extent, 1) - 2; - Extent = "210 485"; + Extent = "210 550"; minExtent = "210 298"; horizSizing = "windowRelative"; vertSizing = "windowRelative"; @@ -745,6 +745,93 @@ $guiContnt = new GuiControl(ConvexEditorOptions) }; }; }; + + new GuiContainer() { + docking = "Top"; + margin = "0 0 3 3"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "4 502"; + extent = "1432 50"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "inspectorStyleRolloutDarkProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextCtrl() { + text = "Brush Actions"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "5 0"; + extent = "121 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + + new GuiButtonCtrl() { + text = "Hollow Selected"; + groupNum = "-1"; + buttonType = "PushButton"; + position = "5 22"; + extent = "90 21"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + command = "ConvexEditorGui.hollowSelection();"; + }; + + new GuiButtonCtrl() { + text = "Recenter Selected"; + groupNum = "-1"; + buttonType = "PushButton"; + position = "100 22"; + extent = "110 21"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + command = "ConvexEditorGui.recenterSelection();"; + }; + }; }; }; //--- OBJECT WRITE END --- From c91002d5ec86fc034c4781fe43f19fe44241990b Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Mon, 13 Jun 2022 21:10:28 -0500 Subject: [PATCH 2/4] fix out of bounds reference in arrayobject --- Engine/source/console/arrayObject.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Engine/source/console/arrayObject.cpp b/Engine/source/console/arrayObject.cpp index 4c18ac306..009803cfb 100644 --- a/Engine/source/console/arrayObject.cpp +++ b/Engine/source/console/arrayObject.cpp @@ -155,8 +155,9 @@ bool ArrayObject::_addKeyFromField( void *object, const char *index, const char S32 ArrayObject::getIndexFromValue( const String &value ) const { + S32 currentIndex = mMin(mCurrentIndex, 0); S32 foundIndex = -1; - for ( S32 i = mCurrentIndex; i < mArray.size(); i++ ) + for ( S32 i = currentIndex; i < mArray.size(); i++ ) { if ( isEqual( mArray[i].value, value ) ) { @@ -167,7 +168,7 @@ S32 ArrayObject::getIndexFromValue( const String &value ) const if( foundIndex < 0 ) { - for ( S32 i = 0; i < mCurrentIndex; i++ ) + for ( S32 i = 0; i < currentIndex; i++ ) { if ( isEqual( mArray[i].value, value ) ) { @@ -184,8 +185,9 @@ S32 ArrayObject::getIndexFromValue( const String &value ) const S32 ArrayObject::getIndexFromKey( const String &key ) const { + S32 currentIndex = mMin(mCurrentIndex, 0); S32 foundIndex = -1; - for ( S32 i = mCurrentIndex; i < mArray.size(); i++ ) + for ( S32 i = currentIndex; i < mArray.size(); i++ ) { if ( isEqual( mArray[i].key, key ) ) { @@ -196,7 +198,7 @@ S32 ArrayObject::getIndexFromKey( const String &key ) const if( foundIndex < 0 ) { - for ( S32 i = 0; i < mCurrentIndex; i++ ) + for ( S32 i = 0; i < currentIndex; i++ ) { if ( isEqual( mArray[i].key, key ) ) { @@ -213,8 +215,9 @@ S32 ArrayObject::getIndexFromKey( const String &key ) const S32 ArrayObject::getIndexFromKeyValue( const String &key, const String &value ) const { + S32 currentIndex = mMin(mCurrentIndex, 0); S32 foundIndex = -1; - for ( S32 i = mCurrentIndex; i < mArray.size(); i++ ) + for ( S32 i = currentIndex; i < mArray.size(); i++ ) { if ( isEqual( mArray[i].key, key ) && isEqual( mArray[i].value, value ) ) { @@ -225,7 +228,7 @@ S32 ArrayObject::getIndexFromKeyValue( const String &key, const String &value ) if ( foundIndex < 0 ) { - for ( S32 i = 0; i < mCurrentIndex; i++ ) + for ( S32 i = 0; i < currentIndex; i++ ) { if ( isEqual( mArray[i].key, key ) && isEqual( mArray[i].value, value ) ) { From 691eb5f2bad32121130067720df6a8c4bba5d1a2 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Tue, 14 Jun 2022 22:40:40 -0500 Subject: [PATCH 3/4] fix computeForwardProbes shadergen gl side --- Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp index 5d40ba8bf..213cc3726 100644 --- a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp @@ -3053,7 +3053,7 @@ void ReflectionProbeFeatGLSL::processPix(Vector& componentList } //Reflection vec - String computeForwardProbes = String(" @.rgb = computeForwardProbes(@,@,@,@,@,@,@,@,@,\r\n\t\t"); + String computeForwardProbes = String(" @ = computeForwardProbes(@,@,@,@,@,@,@,@,@,\r\n\t\t"); computeForwardProbes += String("@,@,\r\n\t\t"); computeForwardProbes += String("@,@).rgb; \r\n"); From a808990bc6b94b746825ef12b8e7da27b68d25ad Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Wed, 15 Jun 2022 16:46:54 -0500 Subject: [PATCH 4/4] you want the higher number, not the lower --- Engine/source/console/arrayObject.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Engine/source/console/arrayObject.cpp b/Engine/source/console/arrayObject.cpp index 009803cfb..6449775ef 100644 --- a/Engine/source/console/arrayObject.cpp +++ b/Engine/source/console/arrayObject.cpp @@ -155,7 +155,7 @@ bool ArrayObject::_addKeyFromField( void *object, const char *index, const char S32 ArrayObject::getIndexFromValue( const String &value ) const { - S32 currentIndex = mMin(mCurrentIndex, 0); + S32 currentIndex = mMax(mCurrentIndex, 0); S32 foundIndex = -1; for ( S32 i = currentIndex; i < mArray.size(); i++ ) { @@ -185,7 +185,7 @@ S32 ArrayObject::getIndexFromValue( const String &value ) const S32 ArrayObject::getIndexFromKey( const String &key ) const { - S32 currentIndex = mMin(mCurrentIndex, 0); + S32 currentIndex = mMax(mCurrentIndex, 0); S32 foundIndex = -1; for ( S32 i = currentIndex; i < mArray.size(); i++ ) { @@ -215,7 +215,7 @@ S32 ArrayObject::getIndexFromKey( const String &key ) const S32 ArrayObject::getIndexFromKeyValue( const String &key, const String &value ) const { - S32 currentIndex = mMin(mCurrentIndex, 0); + S32 currentIndex = mMax(mCurrentIndex, 0); S32 foundIndex = -1; for ( S32 i = currentIndex; i < mArray.size(); i++ ) {