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

    rui_mac

    @rui_mac

    3
    Reputation
    180
    Profile views
    171
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    rui_mac Unfollow Follow

    Best posts made by rui_mac

    • RE: Use of undeclared identifier 'g_resource'

      I did included the c4d_resource.h and the error disappeared.
      I was migrating by simply fixing the errors that appeared inside Xcode, until everything was clear.
      But now, I started by duplicating a similar plugin from the sdk and pasting just the parts of the code that belong to my plugin.

      posted in Cinema 4D SDK
      R
      rui_mac
    • RE: Get a simple polygonal version of any object

      The "solution" I came up with was this:

      	doc=op.GetDocument()
      	doc2=c4d.documents.IsolateObjects(doc,[op])
      	doc3=doc2.Polygonize(False)
      

      and then go through all the objects of doc2, recursively.
      Is this a correct way of doing things?

      posted in General Talk
      R
      rui_mac
    • RE: Shader crashes when quitting with unfinished IRR

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

      posted in Cinema 4D SDK
      R
      rui_mac

    Latest posts made by rui_mac

    • RE: Shader crashes when quitting with unfinished IRR

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

      posted in Cinema 4D SDK
      R
      rui_mac
    • Shader crashes when quitting with unfinished IRR

      I coded a shader and it is working fine.
      However, when I have IRR on and I quit Cinema4D before the IRR finishes rendering, I get a crash. If the IRR finishes and I quit, everything works fine.
      What could it be?

      posted in Cinema 4D SDK c++
      R
      rui_mac
    • RE: BakeShaderIntoBaseBitmap and Alphas

      @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.

      posted in Cinema 4D SDK
      R
      rui_mac
    • RE: SetUniqueIP gets lost

      @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.

      posted in Cinema 4D SDK
      R
      rui_mac
    • RE: BakeShaderIntoBaseBitmap and Alphas

      I was able to solve it by reading the alpha directly from the image file.
      But I will past my previous code here (the one that was not creating any alpha) as soon as I get home.

      posted in Cinema 4D SDK
      R
      rui_mac
    • RE: SetUniqueIP gets lost

      It work now!! I don't know why it wasn't working but it was surely my mistake.

      posted in Cinema 4D SDK
      R
      rui_mac
    • SetUniqueIP gets lost

      Let me try to explain what I need/want...

      • Inside the InitRender function I go through all the objects that are affected by the shader (the list of obtained from the VolumeData) and I assign a unique number to each, using SetUniqueIP.

      • Inside the Output function I read the unique number assigned to the object, using GetUniqueIP.

      However, I already noticed that the objects that I get inside the Output function are polygonal objects, meaning that it is already a converted version of the original objects that I got in the InitRender function.
      So, I guess that is why the UniqueIP gets lost.

      I also tried, inside the InitRender function, getting the object container, add it a new sub-container with an Int32 data container a unique number and loading back the modified container to the object, but it also seems not to carry over to the converted object.
      So, is there any way to store a unique number (an Int32) in an object so that it survives the conversion to polygon that I get in the Output function?

      posted in Cinema 4D SDK c++
      R
      rui_mac
    • RE: Create a dynamic list of structs or BaseContainers

      @spedler said in Create a dynamic list of structs or BaseContainers:

      Why not just use a BaseArray of the data structures you want to use? Re-initialise this every time InitRender is called then you can iterate through it when needed (presumably in the Output function?).

      You’ll also need to implement CopyTo() to make sure the data is available when rendering to the picture viewer.

      Steve

      That could be a good option but I need a list to different types of values. I could create an array of structs but I believe the BaseContainer already has everything I need.
      If I create the BaseContainer as a public variable inside my plugin shader class, it will be available to the Output function?

      posted in Cinema 4D SDK
      R
      rui_mac
    • Create a dynamic list of structs or BaseContainers

      I need to create a dynamic list of data that will be populated with a variable number of elements, in the InitRender method of a shader.
      I need to store a few Float values, an Int32 and a Matrix, so, I can use a struct of a BaseContainer.
      Maybe the BaseContainer is the best method as I can add to the BaseContainer another BaseContainer, creating a hierarchy that I can travel through, starting with the parent Container.
      What do you guys think? Am I thinking correctly?

      posted in Cinema 4D SDK c++
      R
      rui_mac
    • RE: How to know inside a shader what exact object is the shader attached.

      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?

      posted in Cinema 4D SDK
      R
      rui_mac