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

    Create Materials and Texture coordinates

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 411 Views
    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 Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 14/03/2008 at 09:23, xxxxxxxx wrote:

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

      ---------
      Hello,

      I am currently working on an import filter for our generic 3D format. Importing the actual mesh data works fine so far. However I am stuck at importing our materials and assigning the correct texture coordinates.

      I have two questions:

      1. How do I set the texture filename of the color_channel of a material?

      2. How do I set the uv coordinates for the polygon mesh? I know how to create a texture tag and attach this tag to the object, but I can't find out how to add the uv coordinates?

      Any help would be appreciated.

      Regards,
      Mark

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 18/03/2008 at 08:10, xxxxxxxx wrote:

        You set the path for textures through the BaseChannel's container.

        > \> BaseMaterial \*mat = NULL; \> mat = doc->GetFirstMaterial(); \> if(!mat) return TRUE; \> \> BaseChannel \*color = mat->GetChannel(CHANNEL_COLOR); \> if(!color) return TRUE; \> \> BaseContainer data = color->GetData(); \> data.SetString(BASECHANNEL_TEXTURE, "my_texture.jpg"); \> data.SetFilename(BASECHANNEL_SUGGESTEDFOLDER, "C:\ extures"); \> color->SetData(data); \>       \> mat->Message(MSG_UPDATE); \>

        You have to create an UVW tag for the polygon object. It contains as much UVW structures as the object has polygons. The UVWStruct contains four vectors, one for each point per polygon.

        > \> UVWTag \*uvw = NULL; \> uvw = UVWTag::Alloc(op->GetPolygonCount()); \> if(!uvw) return FALSE; \> \> op->InsertTag(uvw, NULL); \> \> op->Message(MSG_UPDATE); \>

        cheers,
        Matthias

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 18/03/2008 at 13:28, xxxxxxxx wrote:

          Hello Matthias,

          thank you very much. This is exactly what I was looking for.

          As a possible suggestion for a future SDK: Putting a slightly more complex IMPORT/EXPORT C++ sample plugin (maybe for 3DS format) into the SDK would reduce the number of questions in this forum and will tremendously increase the steepness of the learning curve.

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