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

    UI, Resource Descripion and all those .h, .str, .res

    Cinema 4D SDK
    4
    11
    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.
    • intenditoreI
      intenditore
      last edited by

      Despite I didn't want to ask you about that and fought much, I need help.
      Don't be offended, but Resource Descripion topic on CPP docs looks too stingy to dive into the theme and feel comfortable. The explanation makes the whole idea somehow clearer than before, but there are hidden underwater rocks around I can't identify, and the only info you can harvest is the line where the error is, but nothing about the cause. So:

      1. Isn't there a nice humanly-understandable guide into UI building with Resource description? I bet many need some better explanation than the one docs give. There are A LOT of questions - does the first id in .h "enum" must be the plugin id? Do we need to enum all the entries of .res or only the ones can call a Message()? What should be in c4d_symbols.h?..;
      2. What could be wrong in my instance? Those are my res.desc. files (ids are named for the test). It all worked nice when there was only one button, but after I simply added more it's always giving me two errors cycling (until I kill the process).
        What did I mess up?

      2020-04-19_04-28-29.png
      2020-04-19_04-28-43.png
      2020-04-19_04-29-08.png
      2020-04-19_04-29-14.png

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

        Hi,

        enumerations in C-languages delimit their elements with commas, while statements are delimited by semicolons. So in your h(eader) file your enum should look something like this:

        enum
        {
            ONE=1,
            TWO=2,
            THREE=3,
        };
        

        edit: To avoid any confusion here - the semicolons in the res and str files are correct.
        edit2: I overlooked the additional semicolons, your res file is also malformed.

        Cheers,
        zipit

        MAXON SDK Specialist
        developers.maxon.net

        intenditoreI 1 Reply Last reply Reply Quote 1
        • intenditoreI
          intenditore @ferdinand
          last edited by

          @zipit many thanks, it worked out! But... Not for long
          Again. I only added STATICTEXT entry
          2020-04-19_15-53-02.png
          and now I get "Error reading resource file.... TautoLayer.res line 8.
          What could be wrong... So confusing!
          Nope, we still need a guide

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

            Hi,

            Elements in a resource file are delimited by their curly braces and their flags are delimited by semicolons. So you would have to get rid of the semicolons after the closing brackets in your screenshot, i.e. STATICTEXT YADAYADA { FLAG; ANOTHER_FLAG; } and not STATICTEXT YADAYADA { FLAG; ANOTHER_FLAG; };.

            Edit: FYI there do exist manuals for Cinema's resource system. Some more complex stuff is not documented though.

            General Resource Manual
            Specific Description Resource Manual (This is what you are doing right now).

            Cheers,
            zipit

            MAXON SDK Specialist
            developers.maxon.net

            1 Reply Last reply Reply Quote 2
            • intenditoreI
              intenditore
              last edited by intenditore

              I've studied those docs and couldn't get enough satisfaction 😞

              I've changed the semicolons for comas, and even deleted them all, but the error persists. I'm wondering what's happening there(

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

                Hi,

                there are no commas in a res file and you will need semicolons to delimit your flags (and also CYCLE elements). I understand that the system can be a bit confusing, but you should either reread my comments more carefully or study existing resource files.

                You have to remove the semicolons after an closing curly bracket in your screenshot. You will need to keep those delimiting your flags. The principal syntax in a res file is:

                ELEMENT {
                    FLAG;
                    ANOTHER_FLAG;
                
                    SUBELEMENT {
                        FLAG;
                        ANOTHER_FLAG;
                    }
                }
                

                Cheers,
                zipit

                MAXON SDK Specialist
                developers.maxon.net

                1 Reply Last reply Reply Quote 2
                • intenditoreI
                  intenditore
                  last edited by

                  I feel stupid. You tell me the right things but even when I used semicolons and seemingly screwed it all up it all still was functioning
                  Anyway, this one works
                  2020-04-19_18-25-17.png

                  But than I move the TXT_CREDIT to the top (changing ids accordingly!) and it gives two cycling errors relating to both .h (line 😎 and .res (line7) files

                  2020-04-19_18-25-51.png

                  Docs don't give an answer 😐

                  1 Reply Last reply Reply Quote 0
                  • P
                    PluginStudent
                    last edited by

                    Pro Tip: your installation of Cinema C4D contains the resource\modules\ folder.

                    In that folder, you find sub-folders. These sub-folders contain Cinema's resource files. So you actually have hundreds of example files for all of this.

                    And of course lots of examples on GitHub.

                    1 Reply Last reply Reply Quote 3
                    • P
                      PluginStudent
                      last edited by

                      And BTW, in your *.h file you miss the comma in line 7 : " = 1001,"

                      intenditoreI 1 Reply Last reply Reply Quote 2
                      • r_giganteR
                        r_gigante
                        last edited by

                        Hi @intenditore, thanks for reaching out us.

                        Thanks to @PluginStudent and @zipit seems like you're now back on track. One additional note is to always check that the .resfile is coherently using tab or spaces but not a mix of the twos which could instead cause unexpected troubles.

                        Best, R

                        1 Reply Last reply Reply Quote 0
                        • intenditoreI
                          intenditore @PluginStudent
                          last edited by

                          Brah... Third time spent fighting with stupid typos! :
                          @PluginStudent @zipit @r_gigante many thanks! I didn't assume you are using the same system inside the program and had no thought to take a look there!
                          Seems adding the "," helped it.
                          And, as I see, you must enumerate all the elements in your .h file, but though you can leave id blank.
                          Thank you!
                          %\

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