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
    • Unread
    • Recent
    • Tags
    • Users
    • Login
    1. Maxon Developers Forum
    2. danniccs
    D
    • Profile
    • Following 0
    • Followers 0
    • Topics 5
    • Posts 17
    • Best 0
    • Controversial 0
    • Groups 0

    danniccs

    @danniccs

    0
    Reputation
    6
    Profile views
    17
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    danniccs Unfollow Follow

    Latest posts made by danniccs

    • RE: Vertex Map Tag not in sync error

      Hi Ilia,

      Thank you very much, I was not aware of that!

      Cheers!

      posted in Cinema 4D SDK
      D
      danniccs
    • Vertex Map Tag not in sync error

      Hello,

      I am running the following code to create a vertex map tag on an object (targetObject is a sphere BaseObject every time I call the function):

      # Make object editable
      res = c4d.utils.SendModelingCommand(
      		command = c4d.MCOMMAND_MAKEEDITABLE,
      		list = [targetObject],
      		mode = c4d.MODELINGCOMMANDMODE_ALL,
      		doc = doc )
      
      if res is False or res is True:
      	raise TypeError()
      elif isinstance( res, list ):
      	doc.InsertObject( res[0] )
      
      vertexMapTag = res[0].GetTag( c4d.Tvertexmap )
      if vertexMapTag is None:
      	vertexMapTag = c4d.BaseTag( c4d.Tvertexmap )
      	vertexMapTag[c4d.ID_TAGFIELD_ENABLE] = True
      	vertexMapTag[c4d.ID_TAGFIELD_INVERT] = False
      	vertexMapTag[c4d.ID_TAGFIELD_DEFORMED] = False
      	res[0].InsertTag( vertexMapTag )
      c4d.EventAdd()
      

      After running this I get a sphere with a UVW tag and a vertex map tag, as intended. However, when I select the sphere and select the paint tool, I get the following error:

      77c31dba-62a2-448c-a4d7-e20ae34ed77a-image.png

      What is causing the tag to not be in sync?

      Thank you for your help,
      Daniel

      posted in Cinema 4D SDK python 2024 windows
      D
      danniccs
    • RE: Populating a Bitmap Shader without a file

      Hey Ferdinand, thanks again for the quick reply.

      What we're going to do is basically have a "cache" location, as you said, where we will save the users' textures when they bake the stack. I would also prefer the approach you showed using the document's asset repository, but since the textures might be very heavy, it would probably lead to very large document sizes for a lot of users, especially if they use several textures/have several stacks with textures. I'm working on implementing solution 1.1, using the Message system to move things around. However, thank you very much for the code example, I will probably use something similar with other assets that are not as large as textures.

      Cheers,
      Daniel

      posted in Cinema 4D SDK
      D
      danniccs
    • RE: Populating a Bitmap Shader without a file

      Hi Ferdinand and Maxime,

      I think I was unclear when asking the last question, my bad. I get that the issue would be that we would essentially have a Filename that does not resolve if the image was in working memory (using a RamDisk or a MemoryFileStruct) and then shut down and re-launched Cinema 4D. I was originally wondering if we could trigger a function (probably using the modifier Message function) when saving the scene to save the image on the physical disk at that point, and change the Filename in the shader accordingly. However we've decided not to try putting the image in memory at all, and directly save it to the disk. I'll try to explain what we're trying to achieve so the situation is a bit clearer, I would love your input on this.

      We currently have an object consisting of a stack that performs computations. We are implementing functionality so that the entire stack can be baked into a single object, which helps speed up computations. The collapse is reversible, so we want the user to be able to "unbake" the object. We also want the user to be able to save the stack to the physical disk as a "baked" object. If one of the objects in the stack (let's call it object A) uses a texture, we save the texture as an image with the baked object. We essentially serialize the image and use it in the calculations, then save it to the physical disk. However, if the user "unbakes" the object, we need to take the serialized image and generate a texture for object A to use. The texture could be an image found on the disk, a gradient created in C4D, some procedurally generated image, etc.

      What we are currently considering is to simply save the texture as an image at the moment that the stack is baked, and use a Filename pointing to it if the stack is unbaked. However, if the scene had not been saved before, we would have to create the image as a temp file and copy it to wherever the scene is saved on the disk afterwards. Is there something I might be missing in the Cinema 4D SDK that could improve this approach, or even be a better way to handle the situation?

      Thanks a lot for the help,
      Daniel

      posted in Cinema 4D SDK
      D
      danniccs
    • RE: Populating a Bitmap Shader without a file

      Hi Ferdinand,

      Thank you very much for the answer! Don't worry about it, I was also dealing with other tasks in the interim. The volatility might be an issue, we might have to write manual code to save scenes if necessary. That would just involve saving the image file somewhere on the actual disk and changing the where the shader points to, right?

      Thank you for the example, I'll work on implementing something similar in our code and get back to you if anything comes up.

      Cheers,
      Daniel

      posted in Cinema 4D SDK
      D
      danniccs
    • RE: Populating a Bitmap Shader without a file

      Hi @m_adam,

      I've been trying to use a RamDiskInterface to store the images I need in memory, but I can't see a way to create a file using it. I can see the CreateLazyFile method, but that's not available before C4D 2024, and I need support back to R25. I am looking into MemoryFileStruct and it seems promising, I was just wondering if the RamDiskInterface is preferred when creating multiple files in memory.

      Cheers,
      Daniel Bauer

      posted in Cinema 4D SDK
      D
      danniccs
    • RE: Populating a Bitmap Shader without a file

      Hi Maxime,

      Thank you very much for the answer! Sorry I haven't responded in a while, some other issues came up. I'll try using the method you mentioned, the image structure should not be a problem because we save images already generated in Cinema 4D. I'll get back to you once I get a chance to implement it.

      Thanks again,
      Daniel

      posted in Cinema 4D SDK
      D
      danniccs
    • Populating a Bitmap Shader without a file

      Hi,
      In our plugin we generate images which we would like to use as texture maps in our modifiers. I've been following the BaseShader manual and can see that I can create a Bitmap Shader and populate the bitmap with a file:

      // configure the bitmap shader and the material
      bitmapShader>SetParameter(ConstDescID(DescLevel(BITMAPSHADER_FILENAME)), imageFile, DESCFLAGS_SET::NONE);
      

      (This is from the C4D documentation). I was wondering if it's possible to populate the BaseShader bitmap without saving the image to the disk.

      Thank you very much,
      Daniel

      posted in Cinema 4D SDK c++
      D
      danniccs
    • RE: Passing data to a CommandData plugin from Python

      Hi Maxime, thank you very much for your answer! I wasn't sure if storing things in the global document BaseContainer was a good approach, but it's working well.

      Cheers,
      Daniel

      posted in Cinema 4D SDK
      D
      danniccs
    • Passing data to a CommandData plugin from Python

      Hello,

      I have a command plugin that inherits from CommandData, defined and registered in C++. I am trying to create a Python script which calls this command plugin, but I want to pass data to it so it can use that data in its Execute() function. I can modify the class in C++ if necessary. Can I do this in Python? I know I can pass data using the Message() function, but have not found a way to use that from Python.

      Thank you for the help,
      Daniel

      posted in Cinema 4D SDK 2023 2024 c++ python r25
      D
      danniccs