Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Changing Asset References to Absolute

    Cinema 4D SDK
    python
    3
    14
    1.9k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ManuelM
      Manuel
      last edited by Manuel

      Hi Andreas,

      Could you please use the tags and the "ask a question" feature of the forum? ^^

      Creating MSG_RENAMETEXTURES is not possible in python.

      Your best chance is to open the project A, retrieve all the assets using GetAllAssetsNew and make them absolute path and after that merge the documents.

      Cheers,
      Manuel

      MAXON SDK Specialist

      MAXON Registered Developer

      1 Reply Last reply Reply Quote 0
      • a_blockA
        a_block
        last edited by a_block

        Hi,

        my name is Andreas. And yes, sorry, I forgot to set the tags. When I realized, you had already done so.

        And I was afraid of this answer. Yet, can you give me a hint, how to make all asset references absolute in a scene, considering all kinds of scene ingredients and plugins? I mentioned, that I am aware of this option and that I would consider this difficult to achieve. Maybe I'm wrong and it is easier as I think. Can you give me a hint? Especially as I mentioned in a second thread, GetAllTextures() does also not seem like a fireproof way of determining all resources.

        Cheers

        Edit: Now thinking about it, I actually had set the tags in this thread. What I forgot was, to set it as a "Question".

        1 Reply Last reply Reply Quote 0
        • ManuelM
          Manuel
          last edited by Manuel

          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

          MAXON SDK Specialist

          MAXON Registered Developer

          1 Reply Last reply Reply Quote 0
          • a_blockA
            a_block
            last edited by a_block

            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.

            1 Reply Last reply Reply Quote 0
            • a_blockA
              a_block
              last edited by a_block

              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

              1 Reply Last reply Reply Quote 0
              • ManuelM
                Manuel
                last edited by Manuel

                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

                MAXON SDK Specialist

                MAXON Registered Developer

                1 Reply Last reply Reply Quote 0
                • a_blockA
                  a_block
                  last edited by

                  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.

                  1 Reply Last reply Reply Quote 0
                  • ManuelM
                    Manuel
                    last edited by Manuel

                    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

                    MAXON SDK Specialist

                    MAXON Registered Developer

                    1 Reply Last reply Reply Quote 0
                    • a_blockA
                      a_block
                      last edited by a_block

                      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...

                      1 Reply Last reply Reply Quote 0
                      • ManuelM
                        Manuel
                        last edited by

                        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

                        MAXON SDK Specialist

                        MAXON Registered Developer

                        1 Reply Last reply Reply Quote 0
                        • a_blockA
                          a_block
                          last edited by a_block

                          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.

                          1 Reply Last reply Reply Quote 0
                          • ferdinandF
                            ferdinand
                            last edited by ferdinand

                            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

                            MAXON SDK Specialist
                            developers.maxon.net

                            1 Reply Last reply Reply Quote 0
                            • ferdinandF
                              ferdinand
                              last edited by

                              Thank you Andreas for closing it.

                              Cheers,
                              Ferdinand

                              MAXON SDK Specialist
                              developers.maxon.net

                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post