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
    1. Maxon Developers Forum
    2. rui_mac
    3. Topics
    R
    • Profile
    • Following 0
    • Followers 0
    • Topics 52
    • Posts 171
    • Best 3
    • Controversial 0
    • Groups 0

    Topics created by rui_mac

    • R

      Shader crashes when quitting with unfinished IRR

      Cinema 4D SDK
      • c++ • • rui_mac
      3
      0
      Votes
      3
      Posts
      538
      Views

      R

      It seems not to crash now. I made sure I freed all the bitmaps and flushed all containers.

    • R

      SetUniqueIP gets lost

      Cinema 4D SDK
      • c++ • • rui_mac
      4
      0
      Votes
      4
      Posts
      719
      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.

    • R

      Create a dynamic list of structs or BaseContainers

      Cinema 4D SDK
      • c++ • • rui_mac
      4
      0
      Votes
      4
      Posts
      736
      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

    • R

      BakeShaderIntoBaseBitmap and Alphas

      Cinema 4D SDK
      • c++ • • rui_mac
      4
      0
      Votes
      4
      Posts
      713
      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.

    • R

      How to know inside a shader what exact object is the shader attached.

      Cinema 4D SDK
      • c++ • • rui_mac
      3
      0
      Votes
      3
      Posts
      501
      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?

    • R

      How to get the number of points in an object?

      Cinema 4D SDK
      • c++ • • rui_mac
      3
      0
      Votes
      3
      Posts
      583
      Views

      R

      Thank you very much, Ilia.
      I will look into both approaches.
      I only have to check it at the begining of the calculations of the shader, so the best way should be to make in the InitRender method, right? That way, all the possibly "slow" stuff only gets calculated once.

    • R

      Is InitRender called once for each frame of a render?

      Cinema 4D SDK
      • c++ 2024 • • rui_mac
      3
      0
      Votes
      3
      Posts
      569
      Views

      R

      Thank you very much, Ferdinand. I understand.

    • R

      Must I pay $99 each year to develop for Mac?

      General Talk
      • plugin-information chit-chat • • rui_mac
      4
      0
      Votes
      4
      Posts
      912
      Views

      ferdinandF

      You can compile your plugins that have been signed with the Xcode debug license in debug or release mode and run them as much as you want. You can even do this on a different machine, when you are okay with a warning here and there. When you want to get up to speed with the C++ SDK again, I would recommend having a look at Getting Started: First Steps, it guides you through all the steps necessary to compile the SDK on Windows and MacOS, and do simple things like adding your first plugin and debugging code.

    • R

      Getting the object it is being rendered, from inside a shader plugin

      Cinema 4D SDK
      • python 2024 • • rui_mac
      2
      0
      Votes
      2
      Posts
      304
      Views

      ferdinandF

      Hey @rui_mac,

      thank you for reaching out to us. In general only shaders which are volume shaders have access to the object for which they are being called for. In Python (or in COFFEE) you cannot implement volume shaders and therefore cannot access the object which is being rendered.

      When you are implementing a volume shader in C++, you can do this (untested pseudo code):

      cinema::Vector MyShader::Output(cinema::BaseShader* shader, cinema::ChannelData* cd){ // Get the volume data from the channel data. cinema::VolumeData* const vd = cd ? cd->vd : nullptr; if (!vd) return COLOR_RENDER_ERROR; // Get the ray objects. for (cinema::Int32 i; i < vd->GetObjCount(); i++) { const cinema::RayObject* const ro = vd->GetObj(i); if (!obj) continue; // Attempt to find the object this ray object has been constructed for. const cinema::BaseObject* const op = ro._texture_link ? ro._texture_link : ro._link; if (!op) return COLOR_RENDER_ERROR; // Do stuff with the object ... } return COLOR_RENDER_ERROR; }

      Cheers,
      Ferdinand

    • R

      Getting UV coordinates from a plane

      Cinema 4D SDK
      • python r21 • • rui_mac
      9
      0
      Votes
      9
      Posts
      1.3k
      Views

      ferdinandF

      Hey @rui_mac,

      no, they do not match the uvw coordinates. They are weights, please have look at the example I have linked to above, it likely does everything you need. GetPolyPointST expects a value in local object coordinates and returns weights for the polygon UVW coordinates. You get then your final coordinate by the bilinear interpolation of the UVW quad over the s,t weights. You can of course technically replicate all the math yourself, but as Ilia has pointed out this would be out of scope of support.

      Cheers,
      Ferdinand

    • R

      Force VertexMap display

      Cinema 4D SDK
      • python • • rui_mac
      18
      0
      Votes
      18
      Posts
      3.0k
      Views

      ymoonY

      @ferdinand, Is it possible to VertexColor, WeightMap(character rig) in the same way?
      Some games use VertexColor, so marking can always be useful.
      I tried to convert your code to VertexColor, but I lack knowledge. Please help us.

    • R

      How to detect click on a item in InExclude list?

      Cinema 4D SDK
      • python • • rui_mac
      10
      0
      Votes
      10
      Posts
      1.6k
      Views

      M

      Hi with the 2023.1 release, the method InExcludeData.GetData have been added to the Python SDK.

      Cheers,
      Maxime.

    • R

      Sometimes, IRR stops working when my plugin is placed on a scene.

      Cinema 4D SDK
      • python • • rui_mac
      11
      0
      Votes
      11
      Posts
      1.4k
      Views

      R

      Since I know exactly what methods access/check/change the self.xxxx variables, it is a risk I'm willing to take 😉
      As for the solution, I removed the c4d.EventAdd() and at the GetContour method I was simply calling the function that was creating the spline. Now I perform a few checks for "dirtyness" and only after they show that something is dirty, I call the function to produce the spline.

    • R

      GePrint no longer works?

      Cinema 4D SDK
      • • • rui_mac
      11
      0
      Votes
      11
      Posts
      1.5k
      Views

      M

      Hello @rui_mac,

      without further questions or postings, we will consider this topic as solved by Wednesday 31/05/2023 and flag it accordingly.

      Thank you for your understanding,
      Maxime.

    • R

      Developing for MacOS

      Cinema 4D SDK
      • c++ macos • • rui_mac
      6
      0
      Votes
      6
      Posts
      1.1k
      Views

      S

      @m_adam Thanks very much for your comments. You asked which parts of the manual page weren't clear. It's more that it's incomplete, in that it doesn't tell you how to get a bundle ID, app password or provider ID. Also, I don't think the statement that adding a timestamp is optional if you enable the hardended runtime is correct - from what I can see, you must provide a timestamp even though you enable the hardended runtime.

      The other thing is that invariably at some point the process is going to fail and there's no mention of what to do when it does. It's extremely frustrating when the notarization fails and you have to figure out why. Apart from that, the page is actually very good - just needs a bit more detail (IMO).

      Steve

    • R

      Updating my r20 C++ plugins to r21 and up

      Cinema 4D SDK
      • • • rui_mac
      9
      0
      Votes
      9
      Posts
      1.6k
      Views

      R

      @kbar, thank SO MUCH.
      I will look into it.

    • R

      Store SplineData inside a Container

      Cinema 4D SDK
      • python • • rui_mac
      3
      0
      Votes
      3
      Posts
      397
      Views

      ferdinandF

      Hey @rui_mac,

      thank you for reaching out to us. It is great to hear that you solved your problem yourself. I would however recommend to use BaseContainer.SetData.

      As a brief explanation, because the Python docs are not too clear on what can be written with SetData, and not all users/readers might be familiar with the C++ API. The SetData and GetData methods in C++ allow you to write anything that can be expressed as GeData into a BaseContainer. That type is not exposed in Python. When looking at the GeData documenation in C++, we can see that there is the constructor GeData (Int32 type, const CustomDataType &data), i.e., CustomDataType can be wrapped as GeData, i.e., SplineData can be written into a BaseContainer. Because this also comes up from time to time, you should be aware that the data is being copied. See example at the end of my posting for details.

      Cheers,
      Ferdinand

      """Demonstrates how to write SplineData into a BaseContainer. """ import c4d def UnpackData(bc: c4d.BaseContainer, cid: int) -> None: """ """ data: any = bc.GetData(cid) if not isinstance(data, c4d.SplineData): return print("\nThe first two knots of the spline in the container:") for i, knot in enumerate(data.GetKnots()[:2]): print (i, knot) def main() -> None: """ """ # Create a spline data instance and use MakeCubicSpline() to generate some data in it. spline: c4d.SplineData = c4d.SplineData() spline.MakeCubicSpline(lPoints=4) # Iterate over the knots. print("The first two knots of the original spline:") for i, knot in enumerate(spline.GetKnots()[:2]): print (i, knot) # Store the SplineData in a BaseContainer. The data will be copied, so any modification made # to #spline after inserting it, will not be reflected. print ("\nWriting spline into container.") bc: c4d.BaseContainer = c4d.BaseContainer() bc.SetData(1000, spline) # Modify the first knot of the spline. spline.SetKnot(0, c4d.Vector(1), c4d.FLAG_KNOT_T_BREAK) print("\nThe first two knots of the modified spline:") for i, knot in enumerate(spline.GetKnots()[:2]): print (i, knot) UnpackData(bc, 1000) if __name__ == '__main__': main()
    • R

      Pragma directives in Python?

      Bugs
      • python • • rui_mac
      5
      0
      Votes
      5
      Posts
      1.5k
      Views

      R

      Once again, thenk you very much for all the information, Ferdinand.
      What I had done already was the last "solution".
      I do have a file inside the plugin folder that, when the code detects that it is present, skips some verifications.
      So, I guess I will go on doing that. That even allows me to check for specific filenames and perform different actions for each one.
      I was just checking to see if there was any type of build-in mechanism to emulate that pragma directives did.
      And I do know that python is interpreted and that real pragma directives are evaluated in the prepass stage.
      But I didn't knew if the Source Protector performed some type of evaluation, when protecting the code.

    • R

      Getting the offset of MoGraph clones

      General Talk
      • • • rui_mac
      6
      0
      Votes
      6
      Posts
      1.1k
      Views

      ferdinandF

      Hello @rui_mac,

      without any further questions or replies, we will consider this thread as solved by Monday the 20th and flag it accordingly.

      Thank you for your understanding,
      Ferdinand