• How can I update custom tokens when rendering with the Takes System?

    python
    5
    0 Votes
    5 Posts
    848 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
    511 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
    779 Views
    M
    Unfortually no you can't.
  • Set up selected user data value

    3
    1
    0 Votes
    3 Posts
    517 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
    777 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
    678 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); } };
  • How is the Plugin ID parameter used by GeDialogs?

    macos windows python r21 s24
    3
    0 Votes
    3 Posts
    824 Views
    a_blockA
    Hello Ferdinand, yes, I was talking about the plugin ID argument of GeDialog.Open() and Restore(). Thanks for your explanation. I'm completely fine with your answer, despite some seeming here and there. I do understand the problems a codebase grown over decades can cause for answering such questions definitely. Nevertheless your explanations largely sync with my expectations from quite a few experiments. Regarding the mentioned issue of the other thread, I can acknowledge, the plugin ID parameter did not seem to have influence on the issue in my experiments. This question here was really more targeted the sizing issues I have with requesters of varying content. And your answer provides me with some confidence, I can make use of different plugin IDs (I should probably rather say unique IDs from Plugin Café) even if they are not related to any registered plugins at all. While I had already thought so and did not find any issues with this practice, it's always a bit hard to know for sure from the outside. And there's always this feeling one could be doing something harmful, which will only bite at the worst possible point in future. Thanks for the clarification. Cheers, Andreas
  • Select the object on which the plugin Tag is associated

    5
    0 Votes
    5 Posts
    807 Views
    mocolocoM
    I changed my code to use BaseDocument.SearchObject(self, name) and it is working perfectly without compromising anything. Thanks again, Cheers, Christophe
  • Enable Isoline Editing in tool plugin

    13
    0 Votes
    13 Posts
    2k Views
    ferdinandF
    Hi @mdr74, yes, it is and thanks for doing it! Cheers, Ferdinand
  • 0 Votes
    10 Posts
    2k Views
    ManuelM
    Hi, This question has been answered by email. You can use the DescriptionProcessors to build/rebuild the wires inside the Usernode. Cheers, Manuel
  • render progress callback is called wrong by Redshift

    python r21
    4
    0 Votes
    4 Posts
    700 Views
    ferdinandF
    Hello @Boony2000, without any further questions or postings, we will consider this topic as solved by Wednesday and flag it accordingly. Cheers, Ferdinand
  • Finding name/handle to last object merged into scene

    3
    0 Votes
    3 Posts
    622 Views
    ferdinandF
    Hello @nicholas_yue, without any further questions or postings, we will consider this topic as solved by Wednesday and flag it accordingly. Cheers, Ferdinand
  • How can I retrieve the copied data?

    python
    3
    0 Votes
    3 Posts
    559 Views
    ferdinandF
    Hello @kng_ito, without any further questions or postings, we will consider this topic as solved by Wednesday and flag it accordingly. Cheers, Ferdinand
  • Insert User Data Track in Python

    Moved
    10
    0 Votes
    10 Posts
    2k Views
    ferdinandF
    Hello @JH23, without any further questions or postings, we will consider this topic as solved by Wednesday and flag it accordingly. Cheers, Ferdinand
  • create a cube that disappears when you return?

    Moved
    10
    0 Votes
    10 Posts
    2k Views
    ferdinandF
    Hello @JH23, without any further questions or postings, we will consider this topic as solved by Wednesday and flag it accordingly. Cheers, Ferdinand
  • Help needed with sketch material

    4
    0 Votes
    4 Posts
    667 Views
    I
    It worked! Thank you so much!
  • MCOMMAND JOIN Polygon max limit ?

    7
    0 Votes
    7 Posts
    1k Views
    M
    Hi with release R24, the new limit is now 500 millions points. Cheers, Maxime.