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

    Dealing with Symbolcache

    Cinema 4D SDK
    python
    4
    12
    2.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.
    • merkvilsonM
      merkvilson
      last edited by

      Hello PluginCafe! 🙂

      Whenever I'm making changes in my plugin's description, I have to delete the Symbolcache file to make it work properly.
      Indeed, deleting Symbolcache takes only a few seconds, but I'm not writing plugins just for personal using. I'm selling them, and for time to time, I'm releasing new updates.
      I included a ReadMe file about removing Symbolcache but many users still can find it and I don't want to force them to manually perform such actions.
      Why C4D works in this way and is it possible to bypass this behavior?

      1 Reply Last reply Reply Quote 0
      • merkvilsonM
        merkvilson
        last edited by

        btw, I tried to overwrite Symbolcache file when a plugin is open the first time by utilizing this code

        c4d.storage.GeGetStartupWritePath()
        path = c4d.storage.GeGetC4DPath(c4d.C4D_PATH_PREFS)
        path += r"\symbolcache"
        
        with open(path, 'w') as symbolcache:
            symbolcache.write("")
        

        It worked when I tested it, but it seems like my computer was an expectation since it failed on my clients' pcs.
        They provided this bug report.
        alt text

        seems like c4d.storage.GeGetC4DPath(c4d.C4D_PATH_PREFS) provides wrong directory.

        1 Reply Last reply Reply Quote 0
        • mikeudinM
          mikeudin
          last edited by

          May be there is unicode symbols problem. Try this

          f = open(fn.decode("utf-8"))

          Checkout my python tutorials, plugins, scripts, xpresso presets and more
          https://mikeudin.net

          1 Reply Last reply Reply Quote 3
          • M
            mp5gosu
            last edited by mp5gosu

            'open' or any other pure python function needs to be decoded as utf8.

            See hint here: https://developers.maxon.net/docs/py/2023_2/modules/c4d.storage/index.html?highlight=loaddialog#c4d.storage.LoadDialog

            Edit: a little late. 🙂

            1 Reply Last reply Reply Quote 3
            • merkvilsonM
              merkvilson
              last edited by

              Thanks, folks! 💙
              I'll double-check this.

              1 Reply Last reply Reply Quote 0
              • M
                m_adam
                last edited by m_adam

                Hi @merkvilson, symbolcache is as the name says, a cache version of the symbols in order to speed up the startup of Cinema 4D.

                So delete it each time you launch your plugin is really not recommended and could cause some issues (missing symbols and so on, since python is available after the generation of the symbolcache). While we do understand the issue, we don't have any workaround to it.
                Regarding the issue, this is mostly due to utf8 handling as @mikeudin pointed.

                The best way is to "educate your customer".

                • Launch Cinema 4D.
                • Open the preference.
                • Click on the bottom button "Open Preference".
                • Go to the pref folder.
                • Delete the symbolcache.
                • Restart Cinema 4D.

                Cheers,
                Maxime.

                MAXON SDK Specialist

                Development Blog, MAXON Registered Developer

                1 Reply Last reply Reply Quote 2
                • merkvilsonM
                  merkvilson
                  last edited by merkvilson

                  Thanks, m_adam. I know about this way. I already include this gif to all my plugins but customers are still complaining, and I need to automate this process.
                  alt text

                  Btw, am I the only one who has this problem? I've never seen anything like this in others' plugins.
                  I tested plenty of 3rd party plugins with all its updates, but I never had to delete Symbolcache or alter the prefs directly in any way.

                  1 Reply Last reply Reply Quote 0
                  • merkvilsonM
                    merkvilson
                    last edited by

                    It's not necessary to delete Symbolcache each time when I launch the plugin.
                    I will create a simple txt file with the basic info in prefs directory via my plugin.
                    plugin will check if this txt file is created. if not, then it will create it. if created, then it will check the info about the versions of my plugins. if the version is updated, then it will delete the symbolcache. I hope this gonna work. 😁

                    1 Reply Last reply Reply Quote 0
                    • M
                      m_adam
                      last edited by m_adam

                      Hi @merkvilson, after more investigation here is the current behavior.
                      SymbolCache is only monitoring filename, so here is the condition to update the symbolcache file:

                      • The name of the resource file is new.
                      • The name of the resource file is removed.

                      Any modifications of the content of your resource files are not taking into account (aka not updated to the symbols cache)

                      So another solution for you could be to rename your resource files for each release of your plugin where the content of your file actually changed.

                      With that's said I've filled a feature request to our development team, to monitor change in files as well.
                      Cheers,
                      Maxime.

                      MAXON SDK Specialist

                      Development Blog, MAXON Registered Developer

                      merkvilsonM 1 Reply Last reply Reply Quote 2
                      • merkvilsonM
                        merkvilson @m_adam
                        last edited by

                        @m_adam
                        Thank you, Maxime for taking your time into it! You're doing a great job! 💙

                        I was struggling with Symbolcache for a long time. 😂

                        Currently, I'm writing a custom module for it.

                        btw, what's the best way of importing custom modules into .pyp/.pypv Files? As I remember from the old forum, unlike the usual importing process, there is some condition in .pyp/.pypv files which we should take into account.

                        1 Reply Last reply Reply Quote 0
                        • M
                          m_adam
                          last edited by

                          While the final goal is the same, please open a new thread for your question regarding import 🙂

                          Cheers,
                          Maxime.

                          MAXON SDK Specialist

                          Development Blog, MAXON Registered Developer

                          1 Reply Last reply Reply Quote 1
                          • M
                            m_adam
                            last edited by

                            Hi with the latest update of Cinema 4D (R24 SP1),
                            any update to a description files should now be reflected correctly to the symbolcache files, so it's not needed to delete it manually anymore.

                            Cheers,
                            Maxime.

                            MAXON SDK Specialist

                            Development Blog, MAXON Registered Developer

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