SOLVED Changing Asset References to Absolute

Hi Manuel,

thanks for the quick answer.

GetAllAssetsNew() is an S22 function. I need to support R17 to S24 and following. So that's unfortunately not a real option in my case. While it certainly is a nice function to know about. I had overlooked it completely up to now. Thanks.

Thus I will have to find all asset references manually. I guess, this includes iterating all objects, tags and materials (including all subshaders), including all their branches. And for all of these I will then need to browse the entire description in order to find any entries of types DTYPE_FILENMAME, DTYPE_TEXTURE and DTYPE_STRING. Additionally probably all parameters of types DTYPE_SUBCONTAINER and DTYPE_LINK would need further examination. And with the last one one would most likely need to be extra careful not to end up iterating in an endless loop...

But even then, I'm not sure I would get everything. I may be wrong, but I remember some of the old SLA shaders not really adhering to the rules. Also I think for example the MultiShader did not properly handle subshaders as children. So in these cases I will probably also need to check the descriptions for other types like subshaders, in order to continue iterating over these as well. And up to here we are not even talking about third party materials, shaders, nodal networks, etc...

Plus all of this will be needed to be examined over the entire frame range?

But maybe I'm overcomplicating things and it's way easier. Not sure.

Cheers,
Andreas

Edit: Typos
Edit (obviously I submitted too fast, sorry): Added other data types to consider.

Hi,

Well, I thought "Andreas", but my fingers typed something else. Sorry.

Any particular reason why you do not use GetAllAssetsNew? This function has the flag ASSETDATA_FLAG_CURRENTFRAMEONLY that could be the answer to the other thread. (Ferdinand will answer it)

You also have this thread where Riccardo use it to change the path of textures.

You also have the object from where it come from and the Id of the parameter.

About the fireproof well, that's what the 'save project with assets' use. We don't better i would say.

Cheers,
Manuel

About the fireproof well, that's what the 'save project with assets' use. We don't better i would say.

I think, "Save Project with Assets" is a bit simpler, as it only needs MSG_GETALLASSETS and MSG_CLEARSUGGESTEDFOLDERS, if I'm not mistaken. These we have available in Python as well. But I need to revert the process. And since MSG_RENAMETEXTURES is missing, I'm afraid it will get tedious in best case. With that message, it's in the responsibility of every entity to react correctly, well knowing the assets it uses. But without, I will have to manually find out, and that is in my mind as described above not completely trivial.

But don't get me wrong. I do not blame you. Not at all.

Though I certainly would appreciate, if Maxon at least considered fixing the MergeDocument() (in SDK as well as for users). That won't help me at all. But would be nice. Plus I wouldn't be sad to have the entire "trio" of messages (MSG_GETALLASSETS, MSG_CLEARSUGGESTEDFOLDERS and MSG_RENAMETEXTURES) available in Python. Doesn't help me either, now, but might be nice for future projects.

Cheers

you are right, that's the other way around, GetAllAssets (and GetAllAssetsNew) are doing the same than "Save Project with assets.. " and they all broadcast MSG_GETALLASSETS. I will talk with others tomorrow again 🙂

Cheers,
Manuel

I have the feeling, I sound like I'm not appreciating the help you are trying to provide. That is not my intention. I appreciate your answers a lot. And I am well aware you can not provide support back to R17, nor is it your job to provide me with a solution.

The main question you have already answered. MSG_RENAMETXTURES is not available, so I can stop trying to get that approach working.

Otherwise my only hope is, I may be thinking way too complicated and some hint from you might be able to interrupt the loop in my head.

I have the feeling, I sound like I'm not appreciating the help you are trying to provide.

Not at all but I'm afraid there will be no solution from r17 to s22..

I will need to check the difference between GetAllAssets and GetAllAssetsNew because GetAllAssets is there since r15.

Cheers,
Manuel

GetAllAssets() only provides me with a list of filenames. But no information, which entities are using a reference to these, nor which parameter the reference would be.
Anyway, don't worry. As you correctly stated, there will be no easy solution covering the version range I need. Which leaves me with the route of doing it manually.

I am so dang stupid!

All the time I assumed we were talking about the same function, but we are not. I apologize. I was completely stuck with GetAllTextures(), not realizing you were talking about GetAllAssets(). Even after reading the docs of GetAllAssetsNew() I was completely blind to this fact.

I apologize, probably evidence, yet, no excuse, how badly this problem was weighing on my mind... Yes, GetAllAssets() indeed makes a difference. Sorry, sorry!!!

Edit: The one being capable of reading clearly has an advantage in life...

Hi,
well i didn't posted my answer this morning.

About the difference between GetAllAssets and GetAllAssetsNew, the New was introduced to change the returned value and to keep binary compatibility between versions.

That's explain why i got the feeling we were not on the same track ^^

The problem is that the Owner have been added in R20 only, so even GetAllAssets will not help you with previous version. So, you are back to the problem with almost no solution from the sdk.

Side note: one question, why are you merging those documents? If it's to render them (with some sort of studio setup), you can add the first tex folder to the asset list in the preferences so all assets should be founded.

I'm going to open a bug entry for the merge function.

Cheers,
Manuel

Yep, I'm saw the version hints. Yet, getting down to R20 already means a lot to me. Having learned to read during this communication even more so. So, thanks for teaching me this, as well as for pointing me to GetAllAssets().

The merge is not only to render the document. It's a pretty fundamental thing in this plugin. And we had an eye on the tex folders in prefs as well. 🙂 But in earlier versions, there were only ten folder entries there and we can not rely on the user not using these.

Hello @a_block,

without further questions or postings, we will consider this topic as solved by Wednesday and flag it accordingly.

Thank you for your understanding,
Ferdinand

Thank you Andreas for closing it.

Cheers,
Ferdinand