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!