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

    Material Distinct ID

    SDK Help
    0
    3
    221
    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 13/09/2015 at 05:03, xxxxxxxx wrote:

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

      ---------
      Greetings !

      I have created 50 materials of a Material Data plugin.

      I need each one of them to use a different ID (in a member variable). 
      Can i use the Material Pointer as ID ? is it safe ?
      GetNodeID returns the ID of the plugin

      Is there any message that is triggered on Material create or destroy ?

      Thank you.

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

        On 13/09/2015 at 07:31, xxxxxxxx wrote:

        Depends on your requirements. When the scene is loaded from disk,
        the address is certainly a different one. If you're using the addrss. use 
        the address of the associated BaseMaterial.

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

          On 14/09/2015 at 02:58, xxxxxxxx wrote:

          Hello,

          as Niklas said, the best solution depends on what exactly you want to do. If you already have a unique ID in a member variable stored any you want to access that data from the outside you can implement GetDParameter() and SetDParameter() to make it available.

          If you want to compare materials inside a document you could use the marker returned from GetMarker(). You can also add custom unique data by simply storing it in the material's BaseContainer. There is also AddUniqueID() which is typically used in I/O workflows.

          If you ask when to set the unique ID you might want to check the message MSG_MENUPREPARE to configure your new material.

          Best wishes,
          Sebastian

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