Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Register
    • Login
    1. Maxon Developers Forum
    2. MPB
    M
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 4
    • Groups 0

    MPB

    @MPB

    0
    Reputation
    2
    Profile views
    4
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    MPB Unfollow Follow

    Latest posts made by MPB

    • RE: Finding out the latest asset version number/string via python

      Hi Ferdinant,
      Great! Thank you for your support - I really appreciate it! 👏

      with...

      asset: maxon.AssetDescription = repo.FindLatestAsset(
              maxon.AssetTypes.File(), aid, maxon.Id(), maxon.ASSET_FIND_MODE.LATEST)
      version_string: str = maxon.AssetInterface.GetVersionString(asset)
      version_string = version_string[:-19].strip() #deleting the timestamp
      

      I could filter out the Version String. Thank you again for your help. 👍

      Cheers,
      MPB

      posted in Cinema 4D SDK
      M
      MPB
    • RE: Finding out the latest asset version number/string via python

      Thank you Ferdinand,

      ok, but how do I get the string of the asset version? I cannot find any reference to the version string in the examples from "asset_metadata_r26.py". I've also searched the SDK and the Asset Framework, but couldn't find anything that would point me in the right direction.

      Or is it not possible to print out the string of a asset-version?

      Really sorry for the inconvenience.

      posted in Cinema 4D SDK
      M
      MPB
    • RE: Finding out the latest asset version number/string via python

      Hi Ferdinant,

      I'm very sorry for not thinking more about my post. Yes, the devil is in the details: I'm trying to access the version description and - if possible - counting it up +0.1 for the automatic upload of a new version of the asset.

      Here is part of my code as an example, although it's just a proof of concept at the moment. I've added some comments for clarification.

      def process_object(obj, doc, repo, target_category_id, force_new_id=False): #creating a new asset and using the commentary-tag to store asset information
          tag = obj.GetTag(c4d.Tannotation) or obj.MakeTag(c4d.Tannotation)
          tag.SetName(TAG_NAME)
          tag[c4d.ANNOTATIONTAG_TEXT] = obj.GetName()
      
          existing_id_str = tag[c4d.ANNOTATIONTAG_URL] #using the URL-field for the asset-id
          asset_id = None
          if existing_id_str and not force_new_id:
              try:
                  temp_id = maxon.Id(existing_id_str)
                  
                  #check if the asset-ID is in the database
                  asset_desc = repo.FindLatestAsset(maxon.AssetTypes.File().GetId(), temp_id, maxon.Id(), maxon.ASSET_FIND_MODE.LATEST)
                  if not asset_desc.IsNullValue(): #if the asset is found....
                      asset_id = temp_id  #...use the temp ID as the current ID
                      
                      #get latest version description and try to set the version number +0.1
                      print(asset_desc.GetVersion())
                      print(asset_desc.GetRepositoryId())
                      print(asset_desc.GetMetaData())
                      current_version_str = str(asset_desc.GetVersion()) # <--- this is the tricky part --- 
                      if current_version_str:
                          try:
                              current_version = float(current_version_str) + 0.1 #try to convert it to float and add 0.1
                          except ValueError:
                              current_version = 1.0 #...if unsuccessful (string that shouldn't be used), then start with 1.0 again
                      else: #if none
                          current_version = 1.0
      .....
      

      I hope this makes sense.
      Thank you very much for any help!

      posted in Cinema 4D SDK
      M
      MPB
    • Finding out the latest asset version number/string via python

      Hi! I'm currently trying to get the latest version of an asset in the asset browser. At first, I thought it should work with "assetDescription.GetVersion()", but that only gives me some kind of ID. The same goes for "GetIdAndVersion()".

      Maybe someone here has an idea on how to get the latest asset version number (or string) in python?

      Cheers!
      MPB

      posted in Cinema 4D SDK python 2026
      M
      MPB