From cde1d68f78960905f10ae33fb93637e55efd0506 Mon Sep 17 00:00:00 2001 From: JeffR Date: Sat, 25 Dec 2021 12:30:31 -0600 Subject: [PATCH] Fixes handling in the generic creator function to deal with commands formatted with "return " at the start AND without Fixes assignment of default material to convex shape when the toolbar button is pressed to create a 1u cube automatically. --- .../BaseGame/game/tools/convexEditor/convexEditorGui.tscript | 2 ++ .../game/tools/worldEditor/scripts/editors/creator.ed.tscript | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/Templates/BaseGame/game/tools/convexEditor/convexEditorGui.tscript b/Templates/BaseGame/game/tools/convexEditor/convexEditorGui.tscript index 253508d75..09215601a 100644 --- a/Templates/BaseGame/game/tools/convexEditor/convexEditorGui.tscript +++ b/Templates/BaseGame/game/tools/convexEditor/convexEditorGui.tscript @@ -51,6 +51,8 @@ function ConvexEditorGui::onSleep( %this ) function ConvexEditorGui::createConvexBox( %this ) { %obj = genericCreateObject( "ConvexShape" ); + %obj.setMaterial(%this.materialName); //set whatever the editor has as it's default material to the new one + %this.handleDeselect(); %this.selectConvex( %obj ); %this.dropSelectionAtScreenCenter(); diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/editors/creator.ed.tscript b/Templates/BaseGame/game/tools/worldEditor/scripts/editors/creator.ed.tscript index 201347e2e..7ec1015a7 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/editors/creator.ed.tscript +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/editors/creator.ed.tscript @@ -227,6 +227,10 @@ function ObjectCreator::createObject( %this, %cmd ) %this.setNewObjectGroup( getScene(0) ); pushInstantGroup(); + + if(startsWith(%cmd, "return ")) + %objId = eval(%cmd); + else %objId = eval("return " @ %cmd); popInstantGroup();