SOLVED How to get a realpath of asset in c4d R19 by python ?

I tried "GetAllAssets()" and "GetAllTextures()", but I can't get realpath...

this is my test code:

# -*- coding: utf-8 -*-
"""
该模块用于解析场景使用,
无论插件提交,还是客户端提交,
解析方面的工作都在这个模块实现
"""
import c4d


class Parse:
    # Override
    def __init__(self, doc):
        """
        parameters::
            doc ==> 当前C4D场景
        """
        self.doc = doc

    def assetParse(self):
        """
        资源解析,解析场景中所有资源,
        是否存在,路径等信息
        """
        assets = c4d.documents.GetAllAssets(self.doc, False, "")
        if not assets:
            assets = self.doc.GetAllTextures()
        
        self.assets = assets
    
    def test(self):
        self.doc.SendInfo(
            c4d.MSG_DOCUMENTINFO_TYPE_MAKEPROJECT,
            c4d.FORMAT_C4DEXPORT,
            self.doc.GetDocumentName()
        )
    

if __name__ == "__main__":
    c4d.CallCommand(13957) # Clear Console
    
    doc = c4d.documents.GetActiveDocument()
    doc_parsed = Parse(doc)
    doc_parsed.assetParse()
    
    # for i in doc_parsed.assets[0]:
    #     print i
        
    for i in doc_parsed.assets:
        print i

Hi @Артём, first of all welcome in the plugincafe community 🙂

You can use c4d.GenerateTexturePath to retrieve an absolute path from a relative URL.

You should also pass the document path, you can get it with BaseDocument.GetDocumentPath.

Cheers,
Maxime.

Thanks !
It works !
🙂

Hello @Артём,

without any further questions, we will consider this topic as solved by Monday, the 25th and flag it accordingly.

Thank you for your understanding,
Ferdinand