• How to check if the object/document in on Render Queue

    sdk c++
    3
    0 Votes
    3 Posts
    588 Views
    ferdinandF
    Hello @victor, without any further replies or questions, we will consider this thread as solved by Thursday and flag it accordingly. Thank you for your understanding, Ferdinand
  • XPresso Material Links Brake when Importing through Command Line

    Moved
    3
    0 Votes
    3 Posts
    471 Views
    ferdinandF
    Hello @janine-mcmaster, without any further replies or questions, we will consider this thread as solved by Thursday and flag it accordingly. Thank you for your understanding, Ferdinand
  • Set Ngons with Python

    7
    0 Votes
    7 Posts
    1k Views
    ferdinandF
    Hi, I am back at work now, if any questions remain, please feel free to ask them. Cheers, Ferdinand
  • DESC_PARENT_COLLAPSE Display

    r20 c++ sdk
    5
    0 Votes
    5 Posts
    979 Views
    J
    Thanks for the response. I was assuming that would be the case. John Terenece
  • Insert scene under object

    python
    5
    0 Votes
    5 Posts
    887 Views
    ROMANR
    Mike, thank you a lot!
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    17 Views
    No one has replied
  • Xpresso set port for all nodes

    python
    3
    0 Votes
    3 Posts
    631 Views
    ROMANR
    @m_magalhaes Thank you for answer!
  • Checking if Cache/Deform Cache Is Dirty?

    c++ r20
    4
    0 Votes
    4 Posts
    781 Views
    D
    Thanks, that was exactly what I needed!
  • Hide "Camera Dependent" from PriorityData

    python
    3
    0 Votes
    3 Posts
    550 Views
    orestiskonO
    Thanks Maxime, "NOCAMERA;" worked, and the priority was a typo, now it does work!
  • How to get spline offset by spline point index ?

    python
    13
    0 Votes
    13 Posts
    3k Views
    ferdinandF
    Hi @everyone, as a little disclaimer, this is my private take on this topic. Cinema does calculate the length of a spline (at least with SplineHelp) in a rather unpretentious fashion as the sum of the Euclidean norms of the underlying LineObject segments, i.e., there is no fancy arc-length calculation going on. Which makes sense in Cinema, since the discrete LineObject is what does effectively count, and not the smooth SplineObject. Since you can get access to the LineObject of a SplineObject and also convert between SplineObject and LineObject vertex indices with SplineHelp.SplineToLineIndex() , this also means that you can both calculate the length of spline as a total and up to a specific vertex. Which then should mean that you can calculate the relative offset for a spline vertex yourself. Practically you can cut out the SplineObject altogether when sampling a spline and just use its associated LineObject. The one nice thing that SplineHelp does for you is though, that it implements a parallel transport for the frames of spline points for you. I.e., realizes that the normals of spline points point into a direction humans would consider "correct" (mathematically these normals are not correct, due to them being modified by parallel transport, but they will look smoother, won't flip when then curvature of the spline flips). Cheers, Ferdinand
  • Getting the value of a gadget

    Moved
    3
    0 Votes
    3 Posts
    380 Views
    R
    Thank you so much. That did it!!
  • How can I update custom tokens when rendering with the Takes System?

    python
    5
    0 Votes
    5 Posts
    862 Views
    N
    Amazing, thank you @ferdinand! I figured GetActiveDocument() was the issue, so I was attempting to use takeData.GetCurrentTake() instead in the GetResolutionTakes callback but it still was exactly the same issue where the active take does not change. I didn't know about the callback data argument that already contains the correct document state in data[0], so thank you for letting me know to use that instead and pointing me to further details in the RegisterToken Documentation. Replacing: doc = c4d.documents.GetActiveDocument() with doc = data[0] renderData = doc.GetRenderData(takeData) with renderData = data[1] to get the following code below worked perfectly: def GetCameraName(data): doc = data[0] bd = doc.GetRenderBaseDraw() sceneCam = bd.GetSceneCamera(doc) camName = sceneCam.GetName() return camName.upper() def GetResolutionActive(data): renderData = data[1] renderResX = round(renderData[c4d.RDATA_XRES]) if renderResX >= 1920: return "highRes" else: return "lowRes" Thank you again very much for the help! Really appreciate it.
  • Checking Object Manager Filtering

    r23 python
    3
    0 Votes
    3 Posts
    534 Views
    CairynC
    @m_magalhaes Thanks for the confirmation. I have meanwhile found that while the API doesn't cover the OM window states, you can still call CallCommand and IsCommandChecked on the functions. c4d.CallCommand(100004762) # Show Search Bar c4d.CallCommand(100004719) # Show Path Bar c4d.CallCommand(100004746) # Show Filter They only address the last used OM though; it doesn't seem to be possible to target a specific OM (like it is possible with the Open/Close flags which are stored as NBITs). And of course it doesn't tell me anything about the current visibility of an object in the OM. If the developers will think about commands to cover the filter/search/root conditions, they may want to go one step back and think about a more general concept to handle the multi-copy windows (Object Manager, Attribute Manager, Timeline) in some way that allows me to ask what was the last window, the active window, a window by index.
  • How to Hide Generator Plugin from the menu?

    python
    5
    0 Votes
    5 Posts
    782 Views
    M
    Unfortually no you can't.
  • Set up selected user data value

    3
    1
    0 Votes
    3 Posts
    528 Views
    ROMANR
    @ferdinand Sorry for the late reply. Yes you understood me correctly. Will this be fixed in new c4d versions?
  • Getting the proper formatting/display on .RES

    macos python r23 sdk
    8
    1
    0 Votes
    8 Posts
    1k Views
    M
    Correct, thanks for poitning it I will add a task to improve documentation of Custom GUI
  • Copy mesh from one object to another with Python

    9
    0 Votes
    9 Posts
    2k Views
    K
    @ferdinand I get Ngon translation map and applied MCOMMAND_MELT but stuck again — as I understand SendModellingCommand only returns new object with melted ngons, but my goal is to correct object that already exists in scene... Is there any other ways of setting up Ngon translation map with python?
  • 0 Votes
    5 Posts
    1k Views
    E
    ok, my apologies. i guess my question is at what point to i check for dirty, and at what point do i insert the nulls?
  • 0 Votes
    4 Posts
    802 Views
    mfersaouiM
    @mfersaoui Hi, I found the following solution: FileMenu = c4d.BaseContainer() resource = c4d.plugins.GeResource() resource.InitAsGlobal() FileMenu.InsData(c4d.MENURESOURCE_SUBTITLE, resource.LoadString(12587))
  • How to set the shadow for polygon drawing

    c++ r21
    3
    1
    0 Votes
    3 Posts
    681 Views
    ferdinandF
    Hello @aimidi, thank you for reaching out to us. Please excuse the delay, but your questions had to be reassigned internally, which is why I only took it on yesterday. The main reason for your problems is the incomplete initialization of Vector Box_vc[4] = {Vector(0)};. Box_vc should be initialized with four vectors as you do declare yourself. This partial initialization causes the shading errors you did experience. Please also note that you did flag your posting as R21, which is out of the support cycle. Below I do provide some example code written for S24. It should work on R21, since there have been no changes to the involved interfaces and methods as far as I am aware of, but I did not try to compile the code for R21. The code is also narrative in nature and lines out a few other problems with the code provided by you. I hope this will be helpful to you. Cheers, Ferdinand The result: [image: example.gif] The code: // Example for some drawing operations via ObjectData::Draw(). // // Draws a white polygon and a red cube in the local coordinate system of the BaseObject. The main // problem of your code was that you did not initialize the color array properly. // // As discussed in: // https://developers.maxon.net/forum/topic/13441 #include "c4d.h" #include "c4d_symbols.h" class Pc13441 : public ObjectData { INSTANCEOF(Pc13441, ObjectData) public: static NodeData* Alloc() { return NewObjClear(Pc13441); } DRAWRESULT Draw(BaseObject* op, DRAWPASS drawpass, BaseDraw* bd, BaseDrawHelp* bh) { if (drawpass == DRAWPASS::OBJECT) { if (op == nullptr || bd == nullptr) { return DRAWRESULT::FAILURE; } // Set the drawing matrix to the global matrix of the object we are drawing for. This is // more intuitive than what you did, because we can now just draw as if the origin of // our object is the origin of the drawing space and also will respect the orientation // of the that object. Or in short: We will draw in the local matrix of op. bd->SetMatrix_Matrix(nullptr, op->GetMg()); // The replacement for the drawing size parameter(s) of your example. Vector poylgonSize = Vector(100); // We are now going to draw a manually shaded polygon. This will ignore shading defined // by the user/scene. The user turning on and off shadows in the viewport or moving // lights will have no impact on this. // Define the vertices of the polygon to draw. Vector vertices[4] = { Vector(+poylgonSize.x, +poylgonSize.y, 0), Vector(-poylgonSize.x, +poylgonSize.y, 0), Vector(-poylgonSize.x, -poylgonSize.y, 0), Vector(+poylgonSize.x, -poylgonSize.y, 0) }; // Define the color for each vertex to draw, Cinema will interpolate between these // colors. Vector colors[4] = { Vector(1), Vector(1), Vector(1), Vector(1) }; // You did not initialize this array properly and also did pass in black as a color. // So, this, // // Vector colors[4] = { Vector(0) }; // // where we only initialize the 0th element, is not equivalent to that: // // Vector colors[4] = { Vector(0), Vector(0), Vector(0), Vector(0) }; // // The first one will give you the weird shading errors you had while the latter will // give you an all black polygon. Black as a color is of course not that useful if we // want to see some shading. // If our polygon is a quad or triangle. bool isQuad = true; // Set the drawing transparency to about 50%. bd->SetTransparency(127); // Draw the polygon. bd->DrawPolygon(vertices, colors, isQuad); // Now we are going to draw a box. // The size of the box. float boxSize = 50; // A transform for the box, we are going to draw it a bit off-center, so that it does // not overlap with the polygon we did draw. Matrix boxTransform = Matrix(); boxTransform.off = Vector(200, 0, 0); // The color for the box, this can only be a solid color. Vector boxColor = Vector(1, 0, 0); // And if we want to draw it as a wire frame. bool isWireFrame = false; // Draw the box. bd->DrawBox(boxTransform, boxSize, boxColor, isWireFrame); // For more complex drawing operations one could use DrawPoly() to draw a single // polygon, while respecting scene shading, or DrawPolygonObject() to draw a BaseObject // that is a PolygonObject. Which will also respect user defined scene shading by // default. I would not recommend constructing such polygon object to draw in Draw() as // this method is rather performance critical. If possible, this should be done // beforehand, i.e., in a cached manner. } return SUPER::Draw(op, drawpass, bd, bh); } };