void FBehaviorTreeDebugger::OnInstanceSelectedInDropdown(UBehaviorTreeComponent* SelectedInstance) { if (SelectedInstance) { ClearDebuggerState(); AController* OldController = TreeInstance.IsValid() ? Cast<AController>(TreeInstance->GetOwner()) : NULL; APawn* OldPawn = OldController != NULL ? OldController->GetPawn() : NULL; USelection* SelectedActors = GEditor->GetSelectedActors(); if (SelectedActors && OldPawn) { SelectedActors->Deselect(OldPawn); } TreeInstance = SelectedInstance; if (SelectedActors && GEditor && SelectedInstance && SelectedInstance->GetOwner()) { AController* TestController = Cast<AController>(SelectedInstance->GetOwner()); APawn* Pawn = TestController != NULL ? TestController->GetPawn() : NULL; if (Pawn) { SelectedActors = GEditor->GetSelectedActors(); SelectedActors->Select(Pawn); AGameplayDebuggingReplicator::OnSelectionChangedDelegate.Broadcast(Pawn); } } Refresh(); } }
void UUnrealEdEngine::SetCurrentClass( UClass* InClass ) { USelection* SelectionSet = GetSelectedObjects(); SelectionSet->DeselectAll( UClass::StaticClass() ); if(InClass != NULL) { SelectionSet->Select( InClass ); } }
FReply FCurveColorCustomization::OnCreateButtonClicked() { if (CurveWidget.IsValid()) { FString DefaultAsset = FPackageName::GetLongPackagePath(Owner->GetOutermost()->GetName()) + TEXT("/") + Owner->GetName() + TEXT("_ExternalCurve"); TSharedRef<SDlgPickAssetPath> NewCurveDlg = SNew(SDlgPickAssetPath) .Title(LOCTEXT("NewCurveDialogTitle", "Choose Location for External Curve Asset")) .DefaultAssetPath(FText::FromString(DefaultAsset)); if (NewCurveDlg->ShowModal() != EAppReturnType::Cancel) { FString Package(NewCurveDlg->GetFullAssetPath().ToString()); FString Name(NewCurveDlg->GetAssetName().ToString()); FString Group(TEXT("")); // Find (or create!) the desired package for this object UPackage* Pkg = CreatePackage(NULL, *Package); UPackage* OutermostPkg = Pkg->GetOutermost(); TArray<UPackage*> TopLevelPackages; TopLevelPackages.Add( OutermostPkg ); if (!PackageTools::HandleFullyLoadingPackages(TopLevelPackages, LOCTEXT("CreateANewObject", "Create a new object"))) { // User aborted. return FReply::Handled(); } if (!PromptUserIfExistingObject(Name, Package, Group, Pkg)) { return FReply::Handled(); } // PromptUserIfExistingObject may have GCed and recreated our outermost package - re-acquire it here. OutermostPkg = Pkg->GetOutermost(); // Create a new asset and set it as the external curve FName AssetName = *Name; UCurveLinearColor* NewCurve = Cast<UCurveLinearColor>(CurveWidget->CreateCurveObject(UCurveLinearColor::StaticClass(), Pkg, AssetName)); if( NewCurve ) { // run through points of editor data and add to external curve for (int32 Index = 0; Index < 4; Index++) { CopyCurveData(&RuntimeCurve->ColorCurves[Index], &NewCurve->FloatCurves[Index]); } // Set the new object as the sole selection. USelection* SelectionSet = GEditor->GetSelectedObjects(); SelectionSet->DeselectAll(); SelectionSet->Select( NewCurve ); // Notify the asset registry FAssetRegistryModule::AssetCreated(NewCurve); // Mark the package dirty... OutermostPkg->MarkPackageDirty(); // Make sure expected type of pointer passed to SetValue, so that it's not interpreted as a bool ExternalCurveHandle->SetValue(NewCurve); } } } return FReply::Handled(); }