Список всех свойств класса в Unreal 5 в PythonPython

Программы на Python
Anonymous
Список всех свойств класса в Unreal 5 в Python

Сообщение Anonymous »

На форуме Unreal есть сообщение, в котором задается вопрос, как составить список свойств, которые можно использовать для get_editor_property, предназначенного для Unreal 4.21:
https://www.youtube.com/ watch?v=2GptXWIgwqI&list=PLBLmKCAjA25Br8cOVzUroqi_Nwipg-IdP
Я пытался запустить это в Unreal 5.4, но, конечно, произошла ошибка из-за, возможно, некоторых изменений в API. Как правильно отформатировать это для текущей версии Unreal?
Вот что у меня есть:
header:
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "MyBlueprintFunctionLibrary.generated.h"

/**
*
*/
UCLASS()
class MYPROJECT_API UMyBlueprintFunctionLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category = "Unreal Python")
static TArray GetAllProperties(UClass* Class);
};

cpp:
// Fill out your copyright notice in the Description page of Project Settings.

#include "MyBlueprintFunctionLibrary.h"

TArray UMyBlueprintFunctionLibrary::GetAllProperties(UClass* Class) {
TArray Ret;
if (IsValid(Class)) {
for (TFieldIterator It(Class); It; ++It) {
FProperty* Property = *It;
if (Property->HasAnyPropertyFlags(EPropertyFlags::CPF_Edit)) {
Ret.Add(Property->GetName());
}
}
}
return Ret;
}


Подробнее здесь: https://stackoverflow.com/questions/789 ... -in-python

Вернуться в «Python»