Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asset.object_path doesn't exist in 5.1 #10

Open
francoisgfx opened this issue Jan 14, 2023 · 6 comments
Open

asset.object_path doesn't exist in 5.1 #10

francoisgfx opened this issue Jan 14, 2023 · 6 comments

Comments

@francoisgfx
Copy link

Hello,

To let you know that part of the code doesn't work on 5.1 anyway :
https://github.com/ue4plugins/tk-unreal/blob/master/hooks/tk-multi-publish2/basic/collector.py#L183

@francoisgfx
Copy link
Author

also it seems by dumping the selected asset attr, that several informations are not working :

LogPython: obj.asset_class = Name("None")
LogPython: obj.asset_class_path = <Struct 'TopLevelAssetPath' (0x000005065DF5427C) {package_name: "/Script/LevelSequence", asset_name: "LevelSequence"}>

asset_class always return None.
I need to get the information from asset_class_path -> asset_name value to get the correct value

object_path doesn't exist in the list as mentionned before. It seems that package_path is the correct attr now.

"""
                LogPython: obj.__add__ = <method-wrapper '__add__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__and__ = <method-wrapper '__and__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__bool__ = <method-wrapper '__bool__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__class__ = <class 'AssetData'>
                LogPython: obj.__copy__ = <built-in method __copy__ of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__delattr__ = <method-wrapper '__delattr__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__dir__ = <built-in method __dir__ of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__doc__ = "A struct to hold important information about an assets found by the Asset Registry\nThis struct is transient and should never be serialized\r\n\r\n**C++ Source:**\r\n\r\n- **Module**: CoreUObject\r\n- **File**: NoExportTypes.h\r\n\r\n**Editor Properties:** (see get_editor_property/set_editor_property)\r\n\r\n- ``asset_class`` (Name):  [Read-Write] Asset Class:\r\n  The name of the asset's class\r\n  deprecated: Short asset class name must be converted to full asset pathname. Use AssetClassPath instead.\r\n- ``asset_class_path`` (TopLevelAssetPath):  [Read-Write] Asset
                Class Path:\r\n  The path name of the asset's class\r\n- ``asset_name`` (Name):  [Read-Write] Asset Name:\r\n  The name of the asset without the package\r\n- ``package_name`` (Name):  [Read-Write] Package Name:\r\n  The name of the package in which the asset is found, this is the full long package name such as /Game/Path/Package\r\n- ``package_path`` (Name):  [Read-Write] Package Path:\r\n  The path to the package in which the asset is found, this is /Game/Path with the Package stripped off"
                LogPython: obj.__eq__ = <method-wrapper '__eq__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__format__ = <built-in method __format__ of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__ge__ = <method-wrapper '__ge__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__getattribute__ = <method-wrapper '__getattribute__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__gt__ = <method-wrapper '__gt__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__hash__ = <method-wrapper '__hash__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__iadd__ = <method-wrapper '__iadd__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__iand__ = <method-wrapper '__iand__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__ilshift__ = <method-wrapper '__ilshift__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__imod__ = <method-wrapper '__imod__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__imul__ = <method-wrapper '__imul__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__init__ = <method-wrapper '__init__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__init_subclass__ = <built-in method __init_subclass__ of type object at 0x0000050651343048>
                LogPython: obj.__ior__ = <method-wrapper '__ior__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__irshift__ = <method-wrapper '__irshift__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__isub__ = <method-wrapper '__isub__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__itruediv__ = <method-wrapper '__itruediv__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__ixor__ = <method-wrapper '__ixor__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__le__ = <method-wrapper '__le__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__lshift__ = <method-wrapper '__lshift__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__lt__ = <method-wrapper '__lt__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__mod__ = <method-wrapper '__mod__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__mul__ = <method-wrapper '__mul__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__ne__ = <method-wrapper '__ne__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__neg__ = <method-wrapper '__neg__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__new__ = <built-in method __new__ of type object at 0x00007FFEBBA68790>
                LogPython: obj.__or__ = <method-wrapper '__or__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__radd__ = <method-wrapper '__radd__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__rand__ = <method-wrapper '__rand__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__reduce__ = <built-in method __reduce__ of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__reduce_ex__ = <built-in method __reduce_ex__ of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__repr__ = <method-wrapper '__repr__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__rlshift__ = <method-wrapper '__rlshift__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__rmod__ = <method-wrapper '__rmod__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__rmul__ = <method-wrapper '__rmul__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__ror__ = <method-wrapper '__ror__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__rrshift__ = <method-wrapper '__rrshift__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__rshift__ = <method-wrapper '__rshift__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__rsub__ = <method-wrapper '__rsub__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__rtruediv__ = <method-wrapper '__rtruediv__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__rxor__ = <method-wrapper '__rxor__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__setattr__ = <method-wrapper '__setattr__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__sizeof__ = <built-in method __sizeof__ of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__str__ = <method-wrapper '__str__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__sub__ = <method-wrapper '__sub__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__subclasshook__ = <built-in method __subclasshook__ of type object at 0x0000050651343048>
                LogPython: obj.__truediv__ = <method-wrapper '__truediv__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.__xor__ = <method-wrapper '__xor__' of AssetData object at 0x00000215AAC4D540>
                LogPython: obj._post_init = <built-in method _post_init of AssetData object at 0x00000215AAC4D540>
                LogPython: obj._wrapper_meta_data = <PyWrapperBaseMetaData object at 0x00000215D8CAF530>
                **LogPython: obj.asset_class = Name("None")
                LogPython: obj.asset_class_path = <Struct 'TopLevelAssetPath' (0x00000506DF7A2B5C) {package_name: "/Script/Engine", asset_name: "StaticMesh"}>**
                **LogPython: obj.asset_name = Name("SM_DwarfBall")**
                LogPython: obj.assign = <built-in method assign of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.cast = <built-in method cast of type object at 0x0000050651343048>
                LogPython: obj.copy = <built-in method copy of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.export_text = <built-in method export_text of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.get_asset = <built-in method get_asset of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.get_class = <built-in method get_class of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.get_editor_property = <built-in method get_editor_property of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.get_export_text_name = <built-in method get_export_text_name of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.get_full_name = <built-in method get_full_name of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.get_tag_value = <built-in method get_tag_value of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.import_text = <built-in method import_text of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.is_asset_loaded = <built-in method is_asset_loaded of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.is_redirector = <built-in method is_redirector of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.is_u_asset = <built-in method is_u_asset of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.is_valid = <built-in method is_valid of AssetData object at 0x00000215AAC4D540>
                **LogPython: obj.package_name = Name("/Game/LookDevRig/Props/Ball/SM_DwarfBall")
                LogPython: obj.package_path = Name("/Game/LookDevRig/Props/Ball")**
                LogPython: obj.set_editor_properties = <built-in method set_editor_properties of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.set_editor_property = <built-in method set_editor_property of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.static_struct = <built-in method static_struct of type object at 0x0000050651343048>
                LogPython: obj.to_soft_object_path = <built-in method to_soft_object_path of AssetData object at 0x00000215AAC4D540>
                LogPython: obj.to_tuple = <built-in method to_tuple of AssetData object at 0x00000215AAC4D540>
                """

@Craig422
Copy link

asset.asset_class also no longer works and needs to be replaced with asset.asset_class.path.asset_name in 5.1

This is the change I made on my collector code

for asset in unreal_sg.selected_assets:
if hasattr(asset, "asset_class_path"):
asset_class = asset.asset_class_path.asset_name
else:
asset_class = asset.asset_class
if asset_class == "LevelSequence":
if sequence_edits is None:
sequence_edits = self.retrieve_sequence_edits(asset.package_name)
self.collect_level_sequence(parent_item, asset, sequence_edits)
else:
self.create_asset_item(
parent_item,
# :class:Name instances, we cast them to strings otherwise
# string operations fail down the line..
"%s" % asset.package_name,
"%s" % asset_class,
"%s" % asset.asset_name,
)

@Craig422
Copy link

Also asset_helper.get_assets_by_class("LevelSequence") is broken in 5.1 - I passed package_name to the retrieve_sequence_edits call

def retrieve_sequence_edits(self,package_name):
    """
    Build a dictionary for all Level Sequences where keys are Level Sequences
    and values the list of edits they are in.

    :returns: A dictionary of :class:`unreal.LevelSequence` where values are
              lists of :class:`SequenceEdit`.
    """
    sequence_edits = defaultdict(list)

    asset_helper = unreal.AssetRegistryHelpers.get_asset_registry()
    # Retrieve all Level Sequence assets

    # TODO Unreal 5.1 look like it has a bug retrieving level sequences -

    all_level_sequences = asset_helper.get_assets_by_package_name(package_name)

    for lvseq_asset in all_level_sequences:
        lvseq = unreal.load_asset(lvseq_asset.package_name, unreal.LevelSequence)

@Craig422
Copy link

need to do the same in collect_movie_renders

@Craig422
Copy link

The problem that I have not been able to fix is that MoviePipelineNewProcessExecutor does not work in 5.1 and anything that uses this will fail. I have submitted the bug to Unreal bug submissions. Case # 00518239

@gplsteph
Copy link
Contributor

Hello, problems with the UE api should be fixed now in v1.3.0, and support for UE 5.4 has been added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants