Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    C4D Material parameters return wrong values

    SDK Help
    0
    5
    462
    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.
    • H
      Helper
      last edited by

      On 24/09/2015 at 04:03, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R17 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      Hello.

      Not sure if it's a bug or not but when i create a C4D material and then i try to retrieve it's specular parameters, i get wrong values.

      Here is the test case:
      -Create a C4D Material.
      -Use only  Reflectance channel (disable the rest).
      -Go to Reflectance > Default Specular and set reflection color and brightness.
      -Get the parameters:

      TextureTag* tag = (TextureTag* )object->GetTag(Ttexture);
      Material* material = (Material* )GetParameterLink(*tag,TEXTURETAG_MATERIAL,Mmaterial);
      Vector s_color =  < Get MATERIAL_SPECULAR_COLOR Parameter >
      Real s_brightness =  < Get MATERIAL_SPECULAR_BRIGHTNESS Parameter >
      

      This is how i get the parameters (Vector Example) :

      GeData ge_data;
      if (object.GetParameter(DescLevel(param_id), ge_data, DESCFLAGS_GET_0))
          return ge_data.GetVector();
      

      The above code returns always 1,1,1 for color and 1 for brightness.

      Now, what's strange is that if i save the project and try the above procedure again, i get the correct values (using the exact same code).

      Do i do anything wrong ?

      Thank you for your time.

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 24/09/2015 at 06:09, xxxxxxxx wrote:

        not sure, probably:
        return ge_data.GetVector();

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          On 24/09/2015 at 07:27, xxxxxxxx wrote:

          I misstyped the code. fixed it.

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            On 25/09/2015 at 04:43, xxxxxxxx wrote:

            I mean i fixed the code in this thread. 
            Not the issue.

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              On 25/09/2015 at 08:08, xxxxxxxx wrote:

              Hi,

              I'd prefer to get some contiguous pieces of code, instead of a few lines pseudo code. Especially when talking about Reflectance the details can be important.
              From the first few lines of "code", I assume, you are accessing the Reflectance channel "old style". I'd recommend to rather use the Reflectance Layers directly to access the parameters.
              There's an article about Reflectance in the SDK documentation, that may be helpful.

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