void UShapeComponent::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) { if (!IsTemplate()) { UpdateBodySetup(); // do this before reregistering components so that new values are used for collision } Super::PostEditChangeProperty(PropertyChangedEvent); }
void UPaperTileMap::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) { const FName PropertyName = (PropertyChangedEvent.Property != nullptr) ? PropertyChangedEvent.Property->GetFName() : NAME_None; //@TODO: Determine when these are really needed, as they're seriously expensive! FTileMapReregisterContext ReregisterTileMapComponents(this); ValidateSelectedLayerIndex(); if (PropertyName == GET_MEMBER_NAME_CHECKED(UPaperTileMap, HexSideLength)) { HexSideLength = FMath::Max<int32>(HexSideLength, 0); // The side length needs to be included in the overall tile height TileHeight += HexSideLength; } TileWidth = FMath::Max(TileWidth, 1); TileHeight = FMath::Max(TileHeight, 1); MapWidth = FMath::Max(MapWidth, 1); MapHeight = FMath::Max(MapHeight, 1); if (PixelsPerUnrealUnit <= 0.0f) { PixelsPerUnrealUnit = 1.0f; } if ((PropertyName == GET_MEMBER_NAME_CHECKED(UPaperTileMap, MapWidth)) || (PropertyName == GET_MEMBER_NAME_CHECKED(UPaperTileMap, MapHeight))) { ResizeMap(MapWidth, MapHeight, /*bForceResize=*/ true); } else { // Make sure that the layers are all of the right size for (UPaperTileLayer* TileLayer : TileLayers) { if ((TileLayer->GetLayerWidth() != MapWidth) || (TileLayer->GetLayerHeight() != MapHeight)) { TileLayer->Modify(); TileLayer->ResizeMap(MapWidth, MapHeight); } } } if (!IsTemplate()) { UpdateBodySetup(); } Super::PostEditChangeProperty(PropertyChangedEvent); }
void UCubiquityMeshComponent::UpdateCollision() { //UE_LOG(CubiquityLog, Log, TEXT("UCubiquityMeshComponent::UpdateCollision")); if (bPhysicsStateCreated) { DestroyPhysicsState(); UpdateBodySetup(); CreatePhysicsState(); ModelBodySetup->InvalidatePhysicsData(); ModelBodySetup->CreatePhysicsMeshes(); //UE_LOG(CubiquityLog, Log, TEXT("Physics updated")); } }
void UBoxComponent::SetBoxExtent(FVector NewBoxExtent, bool bUpdateOverlaps) { BoxExtent = NewBoxExtent; MarkRenderStateDirty(); // do this if already created // otherwise, it hasn't been really created yet if (bPhysicsStateCreated) { DestroyPhysicsState(); UpdateBodySetup(); CreatePhysicsState(); if ( bUpdateOverlaps && IsCollisionEnabled() && GetOwner() ) { UpdateOverlaps(); } } }
void UCapsuleComponent::SetCapsuleSize(float NewRadius, float NewHalfHeight, bool bUpdateOverlaps) { CapsuleHalfHeight = FMath::Max(NewHalfHeight, NewRadius); CapsuleRadius = NewRadius; MarkRenderStateDirty(); // do this if already created // otherwise, it hasn't been really created yet if (bPhysicsStateCreated) { DestroyPhysicsState(); UpdateBodySetup(); CreatePhysicsState(); if ( bUpdateOverlaps && IsCollisionEnabled() && GetOwner() ) { UpdateOverlaps(); } } }
void UPaperTileMapRenderComponent::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) { const FName PropertyName = (PropertyChangedEvent.Property != NULL) ? PropertyChangedEvent.Property->GetFName() : NAME_None; if ((PropertyName == GET_MEMBER_NAME_CHECKED(UPaperTileMapRenderComponent, MapWidth)) || (PropertyName == GET_MEMBER_NAME_CHECKED(UPaperTileMapRenderComponent, MapHeight))) { MapWidth = FMath::Max(MapWidth, 1); MapHeight = FMath::Max(MapHeight, 1); // Resize all of the existing layers for (int32 LayerIndex = 0; LayerIndex < TileLayers.Num(); ++LayerIndex) { UPaperTileLayer* TileLayer = TileLayers[LayerIndex]; TileLayer->ResizeMap(MapWidth, MapHeight); } } if (!IsTemplate()) { UpdateBodySetup(); } Super::PostEditChangeProperty(PropertyChangedEvent); }
UBodySetup* UShapeComponent::GetBodySetup() { UpdateBodySetup(); return ShapeBodySetup; }
UBodySetup* UCubiquityMeshComponent::GetBodySetup() { UpdateBodySetup(); return ModelBodySetup; }
UBodySetup* UPaperTileMapRenderComponent::GetBodySetup() { UpdateBodySetup(); return ShapeBodySetup; }