Bläddra i källkod

add MeshRoadEditorGui::onRoadCreation callback
use it, and the RoadEditorGui::onRoadCreation one to assign default road matrials on initial creation

AzaezelX 2 år sedan
förälder
incheckning
15d5aafadb

+ 4 - 0
Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp

@@ -677,6 +677,10 @@ void GuiMeshRoadEditorCtrl::on3DMouseDown(const Gui3DMouseEvent & event)
       // Submit it.               
       undoMan->addAction( action );
 
+      //send a callback to script after were done here if one exists
+      if (isMethod("onRoadCreation"))
+         Con::executef(this, "onRoadCreation");
+
 		return;
    }
 	else if ( mMode == mAddNodeMode )

+ 7 - 0
Templates/BaseGame/game/tools/meshRoadEditor/meshRoadEditorGui.tscript

@@ -84,6 +84,13 @@ function MeshRoadEditorGui::onRoadSelected( %this, %road )
    }
 }
 
+function MeshRoadEditorGui::onRoadCreation( %this )
+{
+   %this.road.TopMaterialAsset = "Core_GameObjects:DefaultDecalRoadMaterial";
+   %this.road.SideMaterialAsset = "Core_GameObjects:DefaultRoadMaterialOther";
+   %this.road.BottomMaterialAsset = "Core_GameObjects:DefaultRoadMaterialOther";
+}
+
 function MeshRoadEditorGui::onNodeSelected( %this, %nodeIdx )
 {
    if ( %nodeIdx == -1 )

+ 1 - 0
Templates/BaseGame/game/tools/roadEditor/roadEditorGui.tscript

@@ -79,6 +79,7 @@ function RoadEditorGui::onEscapePressed( %this )
 //just in case we need it later
 function RoadEditorGui::onRoadCreation( %this )
 {
+   %this.road.MaterialAsset = "Core_GameObjects:DefaultDecalRoadMaterial";
 }
 
 function RoadEditorGui::onRoadSelected( %this, %road )