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

    SetUniqueIP gets lost

    Cinema 4D SDK
    c++
    2
    4
    718
    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.
    • R
      rui_mac
      last edited by rui_mac

      Let me try to explain what I need/want...

      • Inside the InitRender function I go through all the objects that are affected by the shader (the list of obtained from the VolumeData) and I assign a unique number to each, using SetUniqueIP.

      • Inside the Output function I read the unique number assigned to the object, using GetUniqueIP.

      However, I already noticed that the objects that I get inside the Output function are polygonal objects, meaning that it is already a converted version of the original objects that I got in the InitRender function.
      So, I guess that is why the UniqueIP gets lost.

      I also tried, inside the InitRender function, getting the object container, add it a new sub-container with an Int32 data container a unique number and loading back the modified container to the object, but it also seems not to carry over to the converted object.
      So, is there any way to store a unique number (an Int32) in an object so that it survives the conversion to polygon that I get in the Output function?

      i_mazlovI 1 Reply Last reply Reply Quote 0
      • R
        rui_mac
        last edited by

        It work now!! I don't know why it wasn't working but it was surely my mistake.

        1 Reply Last reply Reply Quote 0
        • i_mazlovI
          i_mazlov @rui_mac
          last edited by

          Hi @rui_mac,

          from your explanation it seems you're misunderstanding how the unique IP is supposed to function in cinema. Namely, with the SetUniqueIP() function one should assign a unique identification number to an object of a generator, which creates a hierarchy (i.e. more than one object). One's also supposed to use OBJECT_UNIQUEENUMERATION bit in such case. Inside Output you get polygonized representation of your scene (you can think of it as there's no concept of generator anymore), hence you're just lucky that you're getting back your unique IP there, or in other words you're not supposed to get it there.

          I suspect what you're trying to achieve is to assign some custom data in InitRender and later access it in the Output. If that's the case, you can implement a tag and assign your data to this tag. This would allow you to access this tag in the Output function, because your tag will be carried over during the "baking" process.

          For more info on tags please check the BaseTag and VariableTag Manual.

          Cheers,
          Ilia

          MAXON SDK Specialist
          developers.maxon.net

          R 1 Reply Last reply Reply Quote 0
          • R
            rui_mac @i_mazlov
            last edited by

            @i_mazlov

            Well, I got lucky, then 🙂
            As I'm assigning a set of IDs to the objects, using SetUniqueIP inside the InitRender function and I'm being able to read then back inside the Output function, with GetUniqueIP.

            I mean... my shader is working fine now, and I just need to polish it a bit.

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