void FCameraCutTrackEditor::OnLockCameraClicked(ECheckBoxState CheckBoxState)
{
	if (CheckBoxState == ECheckBoxState::Checked)
	{
		for (int32 i = 0; i < GEditor->LevelViewportClients.Num(); ++i)
		{		
			FLevelEditorViewportClient* LevelVC = GEditor->LevelViewportClients[i];
			if (LevelVC && LevelVC->IsPerspective() && LevelVC->AllowsCinematicPreview() && LevelVC->GetViewMode() != VMI_Unknown)
			{
				LevelVC->SetActorLock(nullptr);
				LevelVC->bLockedCameraView = false;
				LevelVC->UpdateViewForLockedActor();
				LevelVC->Invalidate();
			}
		}
		GetSequencer()->SetPerspectiveViewportCameraCutEnabled(true);
	}
	else
	{
		GetSequencer()->UpdateCameraCut(nullptr, nullptr);
		GetSequencer()->SetPerspectiveViewportCameraCutEnabled(false);
	}

	GetSequencer()->SetGlobalTime(GetSequencer()->GetGlobalTime());
}
bool FBeginModifyLandscapeCommand::Update()
{
	//Find the landscape
	FEdModeLandscape* LandscapeEdMode = (FEdModeLandscape*)GLevelEditorModeTools().GetActiveMode(FBuiltinEditorModes::EM_Landscape);

	//Find a location on the edge of the landscape along the x axis so the default camera can see it in the distance.
	FVector LandscapeSizePerComponent = LandscapeEdMode->UISettings->NewLandscape_QuadsPerSection * LandscapeEdMode->UISettings->NewLandscape_SectionsPerComponent * LandscapeEdMode->UISettings->NewLandscape_Scale;
	FVector TargetLoctaion(0);
	TargetLoctaion.X = -LandscapeSizePerComponent.X * (LandscapeEdMode->UISettings->NewLandscape_ComponentCount.X / 2.f);

	ALandscapeProxy* Proxy = LandscapeEdMode->CurrentToolTarget.LandscapeInfo.Get()->GetCurrentLevelLandscapeProxy(true);
	if (Proxy)
	{
		TargetLoctaion = Proxy->LandscapeActorToWorld().InverseTransformPosition(TargetLoctaion);
	}

	//Begin using the sculpting tool
	FLevelEditorViewportClient* SelectedViewport = LandscapeTestUtils::FindSelectedViewport();
	LandscapeEdMode->CurrentTool->BeginTool(SelectedViewport, LandscapeEdMode->CurrentToolTarget, TargetLoctaion);
	SelectedViewport->Invalidate();

	UE_LOG(LogLandscapeAutomationTests, Display, TEXT("Modified the landscape using the sculpt tool"));

	return true;
}
Exemple #3
0
bool FLayers::RenameLayer( const FName OriginalLayerName, const FName& NewLayerName )
{
	// We specifically don't pass the original LayerName by reference to avoid it changing
	// it's original value, in case, it would be the reference of the Layer's actually FName
	if ( OriginalLayerName == NewLayerName )
	{
		return false;
	}

	TWeakObjectPtr< ULayer > Layer;
	if( !TryGetLayer( OriginalLayerName, Layer ) )
	{
		return false;
	}

	Layer->Modify();
	Layer->LayerName = NewLayerName;
	Layer->ActorStats.Empty();
	// Iterate over all actors, swapping layers.
	for( FActorIterator It(GetWorld()) ; It ; ++It )
	{
		const TWeakObjectPtr< AActor > Actor = *It;
		if( !IsActorValidForLayer( Actor ) )
		{
			continue;
		}

		if ( FLayers::RemoveActorFromLayer( Actor, OriginalLayerName ) )
		{
			// No need to mark the actor as modified these functions take care of that
			AddActorToLayer( Actor, NewLayerName );
		}
	}

	// update all views's hidden layers if they had this one
	for ( int32 ViewIndex = 0; ViewIndex < Editor->LevelViewportClients.Num(); ViewIndex++ )
	{
		FLevelEditorViewportClient* ViewportClient = Editor->LevelViewportClients[ ViewIndex ];
		if ( ViewportClient->ViewHiddenLayers.Remove( OriginalLayerName ) > 0 )
		{
			ViewportClient->ViewHiddenLayers.AddUnique( NewLayerName );
			ViewportClient->Invalidate();
		}
	}

	LayersChanged.Broadcast( ELayersAction::Rename, Layer, "LayerName" );

	return true;
}