How can i refresh Details Panel in C++?
what i see on the forum doesn’t work for me
Thanks
I haven’t tried this, but perhaps the following should work?
// Get the details view for the current editor mode
IDetailsView* DetailsView = PropertyEditorModule->GetDetailView();
// Force a refresh of the details panel
if (DetailsView != nullptr)
{
DetailsView->ForceRefresh();
}
Here, PropertyEditorModule
is a pointer to the FModuleManager
instance for the editor, which you can get by including the following header:
#include "Modules/ModuleManager.h"
Have you looked at this: IDetailsView | Unreal Engine Documentation?
I managed to do it.
These codes includes SelectActor, SelectActors(array input) functions. It’s made to enable selecting something from the blueprint in the editor.
This is a way how to do it;
- I created a plugin with Blueprint Function Library template.
- I created an AActor C++ class from Unreal engine, in the Public file of the plugin.
*I didn’t write everything below, I just wrote what you need to write. the name of my plugin is UmutsPlugin (I will not publish it, there is only this one)
What the code is working AActor UmutActor (Umut is my name )
Build.cs
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
"Blutility",
"CoreUObject",
"Engine",
"Slate",
"UnrealEd",
"UMG",
"Blutility",
"PropertyEditor",
// ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"CoreUObject",
"InputCore",
"Engine",
"Slate",
"SlateCore",
"PropertyEditor",
"LevelEditor",
"UMGEditor"
// ... add private dependencies that you statically link with here ...
}
);
UmutActor.h
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "UmutActor.generated.h"
//Add these functions and variables
UFUNCTION(BlueprintCallable, Category= "Umut's Functions")
bool SelectActor(const AActor* ActorToSelect);
//this function will select the actor
void XYZ(const AActor* ActorToSelect);
TArray<UObject*> SelectedObjects;
UmutActor.cpp
#include "UmutActor.h"
#include "Editor.h"
#include "LevelEditor.h"
#include "PropertyEditorModule.h"
#include "GameFramework/Actor.h"
#include "Net/RepLayout.h"
#include "Modules/ModuleManager.h"
bool AUmutActor::SelectActor(const AActor* ActorToSelect)
{
GEditor->SelectNone(true,true);
if(ActorToSelect != nullptr)
{
SelectedObjects.Empty();
AActor* MyActor = const_cast<AActor*>(ActorToSelect);
SelectedObjects.Add(MyActor);
XYZ(ActorToSelect);
}
else
{
GEngine-> AddOnScreenDebugMessage(6546,5,FColor::Black,FString::Printf(TEXT("ERROR: UmutActor: THERE IS NO INPUT")));
return false;
}
return true;
}
// This function selects actors seperately.
void AUmutActor::XYZ(const AActor* ActorToSelect)
{
FLevelEditorModule& LevelEditorModule = FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor");
AActor* MyActor = const_cast<AActor*>(ActorToSelect);
GEditor->SelectActor(MyActor ,true,true,true,true);
FPropertyEditorModule& PropertyEditorModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
PropertyEditorModule.UpdatePropertyViews(SelectedObjects);
LevelEditorModule.BroadcastActorSelectionChanged(SelectedObjects, true);
MyActor = nullptr;
SelectedObjects.Empty();
}
Then, you can create an UmutActor BP child class, and you can call SelectActor (or SelectActorS) function.
2 Likes