You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#ttp 334968 - TOOLS FEATURE: Add primitive collision inside the static mesh editor #branch UE4 #change GenerateSimpleCollision funcs now return true if any collision was built Moved Prompt to build collision into a func (to remove duplicate code), and modified so that the options are Yes=Replace, No=Add-To, Cancel = Cancel. Added CalcBoundingSphyl code which is loosely based on the Sphere code in that it finds the best axis to align the sphyl with (but locally rotates so it can treat the Z axis as length, regardless). It they finds the radius to best enclose the Sphyl (same as Sphere, but 2D). Then it increase the length of the Sphyl until that encapsulates all the remaining points. Replace instances of AddZeroed with Add(FKTypeElem()) so that the vtable would be created correctly if a base struct was introduced. Moved PhysX code which scales the Elems from ModifyPrimitiveSize to their own struct func (ScaleElem) so that it could be used elsewhere. Added new struct FPrimData which contains the PrimType and PrimIndex so we can look the corresponding collision Elem up in our BodySetup. The static mesh editor session which is open for a particular static mesh keeps track of these using the following: IsPrimValid û Checks to see if the prim data could be valid HasSelectedPrims û Returns true if there are any selected prims IsSelectedPrim û Check to see if the prim data is selected AddSelectedPrim û Adds prim data to our selection RemoveSelectedPrim û Removes prim data from our selection RemoveInvalidPrism - Removes any prims which are no longer valid from the selection ClearSelectedPrims û Removes all the prim data from our selection DuplicateSelectedPrims û Duplicates the selected prims TranslateSelectedPrims - Translates the selected prims by a specified amount RotateSelectedPrims - Rotates the selected prims by a specified amount ScaleSelectedPrims - Scales the selected prims by a specified amount CalcSelectedPrimsAABB - Calculates the bounding box of the selected prims DeleteSelectedPrims û Deletes the selected prims GetLastSelectedPrimTransform û Gets the transform of the last prim which was added to the selection. GetPrimTransform - Gets the transform of a specified prim SetPrimTransform - Sets the transform of a specified prim Added placeholder calls to begin/end transaction where itÆs needed whenever the bodysetup prims are modified. Added new Static Mesh Editor menu option to create a capsule/sphyl Added dedicated collision toggle flag to the Static Mesh Editor so we could manage our own handling of the draw functions in order to inject hit proxies where needed so we can test when theyÆve been clicked on in the viewport. Widget now works when selecting collision Elems. Space toggles the manipulation method. SelectedPrims can be trans/rot/scaled using the editor widget. Prims can be duplicated or deleted either using menu entries or keyboard shortcuts. Alt+drag is also supported for duplication. ProcessClick was updated so that whenever a new selection type is clicked on the previous types are deselected (sockets, prims, edges), and other code location were updated to clear the selected prims where appropriate. Modified OnFocusViewportToSelection so that it also focuses on the selected elems too Modified SetSelectedSocket so that when passing NULL it deselects all the sockets [CL 2104326 by Andrew Brown in Main branch]
47 lines
5.4 KiB
C++
47 lines
5.4 KiB
C++
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "StaticMeshEditorModule.h"
|
|
#include "StaticMeshEditor.h"
|
|
#include "StaticMeshEditorActions.h"
|
|
#include "SStaticMeshEditorViewport.h"
|
|
|
|
void FStaticMeshEditorCommands::RegisterCommands()
|
|
{
|
|
UI_COMMAND( SetShowWireframe, "Wireframe", "Toggles the viewmode of the Preview Pane between a lit view and a wireframe view.", EUserInterfaceActionType::ToggleButton, FInputGesture() );
|
|
UI_COMMAND( SetShowVertexColor, "Vert Colors", "Toggles vertex colors.", EUserInterfaceActionType::ToggleButton, FInputGesture() );
|
|
UI_COMMAND( SetDrawUVs, "UV", "Toggles display of the static mesh's UVs for the specified channel.", EUserInterfaceActionType::ToggleButton, FInputGesture() );
|
|
UI_COMMAND( SetShowGrid, "Grid", "Displays the viewport grid.", EUserInterfaceActionType::ToggleButton, FInputGesture() );
|
|
UI_COMMAND( SetShowBounds, "Bounds", "Toggles display of the bounds of the static mesh.", EUserInterfaceActionType::ToggleButton, FInputGesture() );
|
|
UI_COMMAND( SetShowCollision, "Collision", "Toggles display of the simplified collision mesh of the static mesh, if one has been assigned.", EUserInterfaceActionType::ToggleButton, FInputGesture() );
|
|
UI_COMMAND( ResetCamera, "Reset Camera", "Resets the camera to focus on the static mesh", EUserInterfaceActionType::Button, FInputGesture() );
|
|
UI_COMMAND( SetShowSockets, "Sockets", "Displays the static mesh sockets.", EUserInterfaceActionType::ToggleButton, FInputGesture() );
|
|
UI_COMMAND( SetDrawAdditionalData, "Additional Data", "Draw additional user data associated with asset.", EUserInterfaceActionType::ToggleButton, FInputGesture() );
|
|
|
|
UI_COMMAND( SetShowNormals, "Normals", "Toggles display of vertex normals in the Preview Pane.", EUserInterfaceActionType::ToggleButton, FInputGesture() );
|
|
UI_COMMAND( SetShowTangents, "Tangents", "Toggles display of vertex tangents in the Preview Pane.", EUserInterfaceActionType::ToggleButton, FInputGesture() );
|
|
UI_COMMAND( SetShowBinormals, "Binormals", "Toggles display of vertex binormals (orthogonal vector to normal and tangent) in the Preview Pane.", EUserInterfaceActionType::ToggleButton, FInputGesture() );
|
|
UI_COMMAND( SetShowPivot, "Show Pivot", "Display the pivot location of the static mesh.", EUserInterfaceActionType::ToggleButton, FInputGesture() );
|
|
|
|
UI_COMMAND( CreateDOP10X, "10DOP-X Simplified Collision", "Generates a new axis-aligned box collision mesh with the 4 X-axis aligned edges beveled (10 total sides) encompassing the static mesh.", EUserInterfaceActionType::Button, FInputGesture() );
|
|
UI_COMMAND( CreateDOP10Y, "10DOP-Y Simplified Collision", "Generates a new axis-aligned box collision mesh with the 4 Y-axis aligned edges beveled (10 total sides) encompassing the static mesh.", EUserInterfaceActionType::Button, FInputGesture() );
|
|
UI_COMMAND( CreateDOP10Z, "10DOP-Z Simplified Collision", "Generates a new axis-aligned box collision mesh with the 4 Z-axis aligned edges beveled (10 total sides) encompassing the static mesh.", EUserInterfaceActionType::Button, FInputGesture() );
|
|
UI_COMMAND( CreateDOP18, "18DOP Simplified Collision", "Generates a new axis-aligned box collision mesh with all edges beveled (18 total sides) encompassing the static mesh.", EUserInterfaceActionType::Button, FInputGesture() );
|
|
UI_COMMAND( CreateDOP26, "26DOP Simplified Collision", "Generates a new axis-aligned box collision mesh with all edges and corners beveled (26 total sides) encompassing the static mesh.", EUserInterfaceActionType::Button, FInputGesture() );
|
|
|
|
UI_COMMAND( CreateBoxCollision, "Box Simplified Collision", "Generates a new box collision mesh encompassing the static mesh.", EUserInterfaceActionType::Button, FInputGesture() );
|
|
UI_COMMAND( CreateSphereCollision, "Sphere Simplified Collision", "Generates a new sphere collision mesh encompassing the static mesh.", EUserInterfaceActionType::Button, FInputGesture() );
|
|
UI_COMMAND( CreateSphylCollision, "Capsule Simplified Collision", "Generates a new capsule collision mesh encompassing the static mesh.", EUserInterfaceActionType::Button, FInputGesture() );
|
|
UI_COMMAND( CreateAutoConvexCollision, "Auto Convex Collision", "Opens the Auto Convex Collision Tool for generating a new convex collision mesh, or meshes.", EUserInterfaceActionType::Button, FInputGesture() );
|
|
UI_COMMAND( RemoveCollision, "Remove Collision", "Removes any simplified collision assigned to the static mesh.", EUserInterfaceActionType::Button, FInputGesture() );
|
|
UI_COMMAND( ConvertBoxesToConvex, "Convert Boxes to Convex", "Converts any simple box collision meshes to convex collision meshes.", EUserInterfaceActionType::Button, FInputGesture() );
|
|
|
|
UI_COMMAND( CopyCollisionFromSelectedMesh, "Copy Collision from Selected Static Mesh", "Copy collision from the static mesh selected in Content Browser.", EUserInterfaceActionType::Button, FInputGesture() );
|
|
|
|
UI_COMMAND( FindSource, "Find Source", "Opens explorer at the location of this asset.", EUserInterfaceActionType::Button, FInputGesture() );
|
|
|
|
UI_COMMAND( GenerateUniqueUVs, "Generate Unique UVs...", "Opens the _Generate Unique UVs_ pane for generating a set of unique (non-overlapping) texture coordinates.", EUserInterfaceActionType::Button, FInputGesture() );
|
|
|
|
UI_COMMAND( ChangeMesh, "Change Mesh", "Changes the static mesh asset loaded in the Static Mesh Editor to the asset currently selected in the Content Browser.", EUserInterfaceActionType::Button, FInputGesture() );
|
|
}
|
|
|