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
    1. Maxon Developers Forum
    2. Pheolix
    P
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Best 0
    • Controversial 0
    • Groups 0

    Pheolix

    @Pheolix

    0
    Reputation
    1
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Pheolix Unfollow Follow

    Latest posts made by Pheolix

    • Feedback on C4D Plugin – Mapping Textures to a Pixel Grid (Cinema 4D 2024 SDK)

      Hey everyone,

      I've been working on a Cinema 4D plugin that maps and arranges textures onto a pixel grid. The goal is to make it easier to create voxel-style or Minecraft-like models by linking real-world units (e.g., centimeters) to pixels. (for example, 1 pixel = 6.25 cm)

      Right now, I’ve left out most of the other planned features, since I mainly want to confirm whether I’m heading in the right direction with my current approach or if I’ve gone off track somewhere.

      I’m still fairly new to the Cinema 4D SDK (using the Cinema 4D 2024 SDK and the cinema namespace), so I’d really appreciate any feedback on whether this implementation makes sense and if I’m structuring it correctly.

      using namespace cinema;
      
      // Function to create the vox UV islands
      maxon::Result<void> VoxUvIslandCommand::CreateVoxUVIslands(Float pixelSize)
      {
      	// Implement a customizable pixel grid that has the grid set to 128x128, 256X256 or 512x512 for optimal packaging
      	// A pixel should match a set size in the 3d world like 6.25 cm
      	
      	// Allocate the document
      	BaseDocument* doc = AutoAlloc(GetActiveDocument());
      
      	// Allocate the objects needed to create the UV islands
      	AutoAlloc<BaseObject> selectedObject;
      	AutoAlloc<BaseBitmap> bitmap;
      	AutoAlloc<BaseTag> foundTag;
      	AutoAlloc<UVWTag> foundUVWTag;
      	if (!doc || !selectedObject || !bitmap || !foundTag)
      		return maxon::FAILED;
      
      	selectedObject = AutoAlloc(doc->GetActiveObject());
      
      	if (!selectedObject)
      		return maxon::FAILED;
      
      	// Get the UV data from the selected object
      	foundUVWTag = AutoAlloc((UVWTag*)selectedObject->GetTag(Tuvw));
      	
      	// Check if the UVW tag exists, otherwise create it
      	if (!foundUVWTag) {
      
      	}
      
      	// Check if the UVW tag is valid
      	if (foundUVWTag->GetType() != Tuvw)
      		return maxon::FAILED;
      
      	Int32 dataCount = foundUVWTag->GetDataCount();
      
      	// Get the UV data from the UVW tag
      	bitmap = AutoAlloc((BaseBitmap*)foundUVWTag->GetObject());
      	
      
      	return maxon::OK;
      }
      

      A huge thanks in advance to anyone willing to take a look. Any feedback and/or suggestions are greatly appreciated!

      posted in Cinema 4D SDK s24 c++ 2024 windows
      P
      Pheolix