This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "EditorUtilityWidgetBlueprint.h" | |
#include "EditorUtilitySubsystem.h" | |
UObject * Blueprint = UEditorAssetLibrary::LoadAsset(FString(TEXT("EditorUtilityWidgetBlueprint'/Game/EditorUtilities/MyWidget.MyWidget'"))); | |
if(IsValid(Blueprint)) { | |
UEditorUtilityWidgetBlueprint* EditorWidget = Cast<UEditorUtilityWidgetBlueprint>(Blueprint); | |
if (IsValid(EditorWidget)) { | |
UEditorUtilitySubsystem* EditorUtilitySubsystem = GEditor->GetEditorSubsystem<UEditorUtilitySubsystem>(); | |
EditorUtilitySubsystem->SpawnAndRegisterTab(EditorWidget); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Editor/EditorEngine.h" | |
#include "Subsystems/AssetEditorSubsystem.h" | |
void UMyBlueprintLibrary::OpenWidgetInAssetEditor(UWidget * SelfWidget) { | |
if(IsValid(SelfWidget)) | |
{ | |
UObject * GeneratedBy = SelfWidget->WidgetGeneratedBy.Get(); | |
if(IsValid(GeneratedBy)) | |
{ | |
UAssetEditorSubsystem* AssetEditorSubsystem = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example by Filip Sivak, written for https://filipsivak.medium.com/ | |
import unreal | |
@unreal.uenum() | |
class MyPythonEnum(unreal.EnumBase): | |
FIRST = unreal.uvalue(0) | |
SECOND = unreal.uvalue(1) | |
FOURTH = unreal.uvalue(3) | |
@unreal.ustruct() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unreal | |
import subprocess | |
import pkg_resources | |
from pathlib import Path | |
PYTHON_INTERPRETER_PATH = unreal.get_interpreter_executable_path() | |
assert Path(PYTHON_INTERPRETER_PATH).exists(), f"Python not found at '{PYTHON_INTERPRETER_PATH}'" | |
def pip_install(packages): | |
# dont show window |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool UWindowResizeBlueprintLibrary::SetWindowNoResize(FText WindowName) | |
{ | |
const TSharedPtr<SDockTab> ActiveTab = FGlobalTabmanager::Get()->GetActiveTab(); | |
if(ActiveTab.IsValid()) | |
{ | |
const TSharedPtr<SWindow> Window = ActiveTab->GetParentWindow(); | |
if(Window.IsValid() && Window->GetTitle().EqualTo(WindowName)) | |
{ | |
Window->SetSizingRule(ESizingRule::FixedSize); | |
return true; |