zoukankan      html  css  js  c++  java
  • ue4 python修饰器

    UClass Decorators (Python)

    @unreal.uclass(), @unreal.ufunction() and @unreal.uproperty()

    Description

    By default, ordinary Python classes, functions and properties do not get exposed to Unreal's UObject reflection system, which means standard Python classes cannot fully override Unreal base classes, standard Python functions cannot subscribe to Unreal events or delegates, and standard Python properties cannot be accessed from C++ through UObject reflection.

    The decorators @unreal.uclass() @unreal.ufunction() and @unreal.uproperty() are required to correctly expose classes, functions and properties to Unreal's reflection system, and provide Unreal-specific metadata, much like the UCLASS(), UFUNCTION() and UPROPERTY() defines in C++.

    Parameters

    The @unreal decorators in Python require a somewhat different set of parameters compared to their C++ equivalents. These are some of the parameters to the @unreal.ufunction() decorator in Python:

    • ret=<type> - Specifies the return type of the function. Python functions with the ufunction() decorator usually have only one return value. Required unless override=True.

    • params=[<type>,...] - Specifies the types of the arguments to the function. Required unless override=True.

    • override=True - Specifies that this function overrides a virtual UFunction in a parent UClass, and should inherit its type specifiers. With this parameter, ret and params are no longer needed.

    • meta=dict() - Dictionary containing standard Unreal parameters as seen in UFUNCTION() in C++.

    Atomic types must be specified as Python Data Types, not C++ data types.

    Sample

    @unreal.uclass() class MyExampleObject(unreal.Object): @unreal.ufunction(ret=bool,params=[str],meta=dict(Category="A")) def is_valid_name(self,in_name): return bool(in_name)
     
     
     
    https://unrealcommunity.wiki/unreal-python-annotations-cphmykf1
  • 相关阅读:
    [转载] 美团-云鹏: 写给工程师的十条精进原则
    Docker测试一个静态网站
    Docker容器访问外部世界
    Docker容器间通信
    Docker网络(host、bridge、none)详细介绍
    Docker的资源限制(内存、CPU、IO)详细篇
    esxi中CentOS7不停机加磁盘并扩容现有分区
    ESXI6.5安装CentOS7教程
    Linux查看占用CPU和内存的 的程序
    Centos7使用脚本搭建LVS的DR模式。
  • 原文地址:https://www.cnblogs.com/Shaojunping/p/15078071.html
Copyright © 2011-2022 走看看