• Distribute asset library as a zip file

    2024
    3
    0 Votes
    3 Posts
    615 Views
    P
    Hi Ferdinand, Thank you for the detailed description, it's very useful, I have a good understanding now how this should work. Yes, the main goal here is installer optimization. Unfortunately, hosting online is not an option. I'll give it a thorough testing to see if we hit any limitations with this approach, and we might drop the idea if so. Thanks, Peter
  • What is the meaning of code like `doc: c4d.documents.BaseDocument`?

    python
    4
    0 Votes
    4 Posts
    845 Views
    L
    Hello, Ferdinand! Thank you for your attention to my question, your time, and your academic explanations.
  • 0 Votes
    5 Posts
    1k Views
    R
    I was just looking for the exact same thing and would second the need for these 3 hooks without the need for a Python Generator object. It would make the pipeline integration of C4D much more straightforward. @m_adam
  • How to change the projection type for a created material.

    2023 python windows
    5
    0 Votes
    5 Posts
    1k Views
    ferdinandF
    Hey @lednevandrey, without wanting to be rude, I really struggle with understanding what you want to convey. Material[c4d.TEXTURETAG_PROJECTION] = c4d.TEXTURETAG_PROJECTION_UVW does not work because Python is case sensitive and you gave your BaseMaterial instance the symbol material. So, Python is complaining about that. But as said before, a material, i.e., BaseMaterial is not the right place to set the projection. It is the counter part to the thing you see in the Material Manager of Cinema 4D and has no projection. The projection is set in the Material Tag, which slightly confusingly is called TextureTag in the API. Cheers, Ferdinand """Assigns the first material in the document to the selected object and sets its projection to UVW. """ import c4d import mxutils doc: c4d.documents.BaseDocument # The currently active document. op: c4d.BaseObject | None # The primary selected object in `doc`. Can be `None`. def main() -> None: """Called by Cinema 4D when the script is being executed. """ if not op: raise ValueError("Please select an object.") # Get the first material in the document. material: c4d.BaseMaterial = doc.GetFirstMaterial() if not material: raise ValueError("No materials found in the document.") # Get the first existing texture tag on #op or create a new one when none exists. tag: c4d.BaseTag = op.GetTag(c4d.Ttexture) or op.MakeTag(c4d.Ttexture) if not tag: raise ValueError("Failed to get or create a texture tag.") # Set the material and projection. tag[c4d.TEXTURETAG_MATERIAL] = material tag[c4d.TEXTURETAG_PROJECTION] = c4d.TEXTURETAG_PROJECTION_UVW # Update the Cinema 4D UI. c4d.EventAdd() if __name__ == '__main__': main()
  • Shader crashes when quitting with unfinished IRR

    c++
    3
    0 Votes
    3 Posts
    578 Views
    R
    It seems not to crash now. I made sure I freed all the bitmaps and flushed all containers.
  • 0 Votes
    6 Posts
    986 Views
    ferdinandF
    Great to hear that you found your solution! Do not hesitate to ask more questions when you run into problems while exploring our Python API. But just as a heads up, we prefer users opening new topics for new questions. For details see the Support Procedures linked above. Cheers, Ferdinand
  • Query Morph Order Based on the UI Order?

    2024 python
    3
    1
    0 Votes
    3 Posts
    681 Views
    B
    Hi @ferdinand Thanks for the response. Found a workaround it. Basically, just name the poses properly in a sorting order. Query the GetName() method and perform my own sorting. Regards, Ben
  • Not able to post?

    s26 python
    2
    0 Votes
    2 Posts
    468 Views
    ferdinandF
    Hey @ELJeffery, Thank you for pointing this out. We are generally aware of this issue. If anyone else is experiencing similar issues, please point them out. While we are aware that the issue exists and we can see the incident reports in the back end, it is not 100% clear to us how frequent this does happen to human users (and how urgent this is issue is). So, when you run into the issue too, please drop us here the Cloudflare Ray ID of your error page. As an FYI, the issue usually rectifies itself after a few minutes. Cheers, Ferdinand
  • C4DAtom.SetParameter/GetParameter help

    2024 python
    3
    0 Votes
    3 Posts
    527 Views
    i_mazlovI
    Hi @ops, Thanks for reaching out to us and thanks for sharing your solution with the community, this is highly appreciated! You're right, the most common way of accessing object's attributes is by using subscript operator. Cheers, Ilia
  • Alembic Export Options Not Working

    python s22
    7
    0 Votes
    7 Posts
    2k Views
    BigRoyB
    Just want to confirm here that I'm facing this same issue - only setting the negative state first and then the positive state after seems to make this work. So, thanks for the workaround. Here's the reported bug on our pipeline: https://github.com/ynput/ayon-cinema4d/issues/6 And this is what fixed it: https://github.com/ynput/ayon-cinema4d/pull/8 Looking at 'what' fixes it this most definitely sounds like a bug. (I tested in Cinema4D 2023.2.2 on Windows 10)
  • React to Set Color Space from the Asset Inspector

    c++ 2023
    2
    1
    0 Votes
    2 Posts
    576 Views
    M
    Hi sadly it is not possible for the moment, I will talk to the responsible team to see if that's possible. Cheers, Maxime.
  • BakeShaderIntoBaseBitmap and Alphas

    c++
    4
    0 Votes
    4 Posts
    782 Views
    R
    @i_mazlov Here is a snippet of my code: BaseShader* shader; shader = (BaseShader*)dat->GetLink(CUBICFACE_BACK_TEXTURE, irs.doc); if (shader != nullptr) { AutoAlloc<BaseBitmap> bitmap; if (bitmap != nullptr) { const IMAGERESULT imageResult = bitmap->Init(quality, quality, 32, INITBITMAPFLAGS::NONE); if (imageResult == IMAGERESULT::OK) { shader->BakeShaderIntoBaseBitmap(*bitmap, *irs.doc, nullptr, true, irs.document_colorprofile, irs.linear_workflow, true, 0, quality-1, 0, quality-1); cfdata.bt_back = BaseBitmap::Alloc(); bitmap->CopyTo(cfdata.bt_back); } } } However, even if the texture placed in the link CUBICFACE_BACK_TEXTURE is a PNG with trnasparency or a shader that creates an alpha (like Fire or Flame), the resulting bitmap never gets an alpha.
  • SetUniqueIP gets lost

    c++
    4
    0 Votes
    4 Posts
    820 Views
    R
    @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.
  • Import and managing 'merged' Alembic

    python 2023
    4
    1
    0 Votes
    4 Posts
    1k Views
    i_mazlovI
    Hi @BigRoy, in python the lifetime of the objects is handled automatically so you're right, there's no need to do anything special to destruct the object. Good job on your project! Thanks for sharing it with the community! Cheers, Ilia
  • Create a dynamic list of structs or BaseContainers

    c++
    4
    0 Votes
    4 Posts
    820 Views
    i_mazlovI
    Hi @rui_mac, As long as it fits your needs there's nothing to add against using BaseContainers in your case. However, if you don't need to store hierarchical data, the simpler approach of using BaseArray can sometimes end up in a cleaner implementation. You can use the generic Data type to handle values of different types. Cheers, Ilia
  • Merged Alembic Generator object, how to check if it is a camera?

    python
    2
    0 Votes
    2 Posts
    487 Views
    i_mazlovI
    Hi @BigRoy, For the alembic camera, you can use c4d.MSG_GETREALCAMERADATA, for example: def main(): data = dict() op.Message(c4d.MSG_GETREALCAMERADATA, data) print(data['res']) Another option (which would work for other object types as well) would be to check type of the object's cache using GetCache(). Cheers, Ilia
  • How to know inside a shader what exact object is the shader attached.

    c++
    3
    0 Votes
    3 Posts
    567 Views
    R
    Ok, found out what is wrong. The code inside the Output is being executed in multiple threads. So, one thread may be calculating the color of one object but the data I have in my struct is from another object being calculated by another thread. Is there any way to force a shader to be only calculate in a single thread? Or, is there any way to get a unique value from each object so that I can store a set of structures in the InitRender method, and detect which one is being rendered in the Output method and use the correct structure of data?
  • Notarizing a Mac plugin

    c++ macos
    2
    1 Votes
    2 Posts
    582 Views
    ferdinandF
    Hey @spedler, Thank you for reaching out to us and for pointing out that issue. We are aware that our code signing documentation requires an overhaul. This not only means updating the rather dated MacOS guide, but also providing a guide for Windows since code signing also has become more and more important under Windows. And although not yet as restrictive as MacOS, the Microsoft Secure Future Initative is pointing to a future of execution policies on Windows similar in strictness to the one's found on MacOS. Cinema 4D itself is evolving in a similar fashion, as recently lined out in About the necessity of code signing plugins. We have currently no immediate plans to make code signing for all plugins technically mandatory, Cinema 4D is currently still loading unsigned binaries, but we strongly encourage users to (properly) sign their plugins, especially under MacOS. What has changed since Cinema 4D 2024, is that Cinema 4D will not load binaries with an expired certificate anymore (note that an expired certificate is not the same as an expired license, see the linked posting for details). I currently plan to update the guides in 2025 Q1 or Q2. It was actually already planned for 2024 but I never got to it. But just before I left for vacation I at least already requested the necessary licenses to further research and write the new guides But this is neither my current or next task. However, given the relative closeness of the task of overhauling the code signing documentation, I will probably not 'monkey patch' the current documentation. When there are any questions regarding code signing plugins for Cinema 4D on either Windows or MacOS, please do not hesitate to ask or discuss them here. Cheers, Ferdinand PS: I am still on vacation, so I will likely not respond to any follow-ups until I am back.
  • Message from Object or Tag to CommandData/GeDialog Plugin

    windows 2023 python
    3
    0 Votes
    3 Posts
    640 Views
    i_mazlovI
    Hi @datamilch, you can use the EVMSG_CHANGE message as a trigger to check your objects for changes. The timer approach might seem imprecise from the first glance, but can actually be used, I don't think there're any significant reasons against it. Additionally, the recent change was made to make BaseList2D being hashable. This effectively means you can operate with your objects in a dict. The python tag approach is the least efficient, although would still work, yes. You're saying your GeDialog plugin uses "mostly the ideantical userdata". If it was "identical", you could potentially use c4d.gui.DescriptionCustomGui with the SetObject function to make it point to your object. This way you can avoid hassling around all the data sync, because it is all handled as a built-in functionality of this class. This is how the attribute manager effectively works, or the Active Object Dialog as well. For your further postings please follow our guidelines on How to Ask Questions, namely: Please consolidate your questions into a singular posting by editing your last posting Cheers, Ilia
  • Update Xref filepath without user interaction

    python 2023 windows
    2
    1
    0 Votes
    2 Posts
    570 Views
    M
    Hey BigRoy, sadly it's still impossible, I will start the discussion again, thanks for the reminder. Cheers, Maxime.