• Is MSG_TRANSLATE_POINTS still in use?

    c++ r23 windows
    5
    0 Votes
    5 Posts
    734 Views
    CairynC
    thank you for looking! Looks as if that message is indeed dead. Without a translation map, it would be fairly useless... The original use I had for it was in a Morph plugin (goes back to R8) so the various morph shapes could keep track of changes done to the original mesh. It's not properly working there any more; guess I know now why My current use is a Symmetry plugin I just finished. Right now, it only works by mapping right points and left points, and duplicating positional changes. I am now looking into possibilities to track added or removed points (and maybe polygons) on one side to duplicate that too. The TRANSLATE messages used to do that, including special information like "point A was merged with point B", but naturally all tools need to support that, and apparently the new kernel has moved on to some other method. I guess I'll investigate whether MSG_POINTS_CHANGED is now carrying the required information...
  • Xcode warnings about internationalization and language

    macos c++
    10
    1
    0 Votes
    10 Posts
    1k Views
    fwilleke80F
    Thank you!
  • Double clicking behaviour in a Field List.

    c++ r20 r21 r23 s22 s24
    3
    1 Votes
    3 Posts
    393 Views
    kbarK
    This is for my own plugin. I was looking for a flag that I could set. Totally forgot about just checking for the parameter being set. Great solution. Thanks.
  • Python API OpenGL Information

    r23 python
    7
    1 Votes
    7 Posts
    1k Views
    ferdinandF
    Hello @wuzelwazel, thank you for reaching out to us. I am sorry if I gave you the impression that this will be fixed with S24. This issue is still on our radar, but it does not have the highest priority. I am also unfortunately not a liberty to give you a time frame when this will be done. Thank you for your understanding, Ferdinand
  • [fwd] Add command to right click parameter menu

    c++ windows macos
    2
    1
    0 Votes
    2 Posts
    325 Views
    ferdinandF
    Dear user, thank you for reaching out to us. Is it possible, via C++, to add a command to the right click menu that pops up for a parameter in C4D? Unfortunately, that is not possible. The context menu of a DescriptionCustomGui is sealed off from user access. The specific context menu is not meant to be modified. I would like to call a command and somehow get the parameter that was right clicked on as well. I don't think this is possible at all, but can't hurt to ask just in case. You are right, this is also not possible, at least in the context you are most likely talking about. You can get hold of the selected element(s) in a DescriptionCustomGui via GetDescIDSelection() (Link), but this requires one to get hold of that DescriptionCustomGui obviously. Since you are very likely talking about the Attribute Manger, this is effectively not possible, since you cannot get hold of it from the SDK side (in the way you want to). For a custom GeDialog with a DescriptionCustomGui this would be possible. While we can technically get hold of an Attribute Manager when implementing nodes, I do not see a way to get hold of its DescriptionCustomGui nonetheless. Cheers, Ferdinand
  • GetDocumentPath() returning wrong path?

    5
    0 Votes
    5 Posts
    650 Views
    C
    Hi @ferdinand, Your explanation and the given example solved all problems. I don't know why I did not found that earlier. Thanks, Chris
  • 0 Votes
    9 Posts
    1k Views
    B
    @m_adam Thanks for confirmation. Will close this thead now. Looking forward to the documentation
  • Create a Take

    r23 python
    5
    1
    0 Votes
    5 Posts
    744 Views
    ferdinandF
    Hello @pim, without any further feedback or questions, we will consider this topic as solved by Wednesday and flag it accordingly. Thank you for your understanding, Ferdinand
  • How to delete obj in the environment from a button in userdata

    Moved r20 python
    4
    0 Votes
    4 Posts
    754 Views
    ferdinandF
    Hello @JH23, without any further feedback or questions, we will consider this topic as solved by Wednesday and flag it accordingly. Thank you for your understanding, Ferdinand
  • Importing morph problem

    r21
    12
    0 Votes
    12 Posts
    2k Views
    ferdinandF
    Hello @AiMiDi, without any further feedback or questions, we will consider this topic as solved by Wednesday and flag it accordingly. Thank you for your understanding, Ferdinand
  • How to set Roughness texture to material?

    Moved
    3
    0 Votes
    3 Posts
    539 Views
    C
    Hello Maxime, Thanks for fixing the category for my post. I am new to Cinema4D. I found the correct IDs by opening the UI for the material and drag and drop the settings into the Python console. Kind Regards, Chris
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • Get normals of an arbitrary Cinema 4d object

    r23 maxon api c++ windows sdk
    3
    1
    0 Votes
    3 Posts
    669 Views
    M
    Aha I see, this makes sense for the NormalTag data. And yeah of course cross product is what I need... Regarding the primitives not turning into polygon object, I thought that was happening with a cube, but now after testing it again it definitely is. So I must have been mistaken before. Thanks for the help, going to mark this as solved.
  • 0 Votes
    2 Posts
    367 Views
    ferdinandF
    Dear user, the problem with your example code is that you do use a VoxelizationInterface which is not well suited for this task. The type DistanceQueryInterface(Documentation) is much better suited for the task. You should also be more cautious with statements like the following, taken from your code, voxelRef = maxon::PolyVoxelization().Create() iferr_ignore("Could not create VoxelizationRef"); as stepping over a failure of initialization will lead to crashes. At the end of this posting you will find an example for how to use DistanceQueryInterface as well as some light comments on error handling. I hope this helps and cheers, Ferdinand /* This function expects a point object (A) to be the first object in the scene, followed by a polygon object (B) as the second object. It will then return the index for closest polygon in B for each vertex in A. */ static maxon::Result<void> Pc13296(BaseDocument* doc) { iferr_scope; // Get the first and second node in the scene. The first one is expected // to be a point node, serving as a point source, and the second one is // expected to be a polygon node, serving as a polygon source. BaseObject* node = doc->GetFirstObject(); if (node == nullptr || !node->IsInstanceOf(Opoint)) { ApplicationOutput("Please provide a point object as the first node in the scene."_s); return maxon::OK; } PointObject* pointNode = static_cast<PointObject*>(node); node = node->GetNext(); if (node == nullptr || !node->IsInstanceOf(Opolygon)) { ApplicationOutput("Please provide a polygon object as the second node in the scene."_s); return maxon::OK; } PolygonObject* polygonNode = static_cast<PolygonObject*> (node); // Get access to the point and polygon data and the global transforms of both nodes. const Vector* points = pointNode->GetPointR(); const CPolygon* polygons = polygonNode->GetPolygonR(); const int pointCount = pointNode->GetPointCount(); const int polygonCount = polygonNode->GetPolygonCount(); Matrix mgPointNode = pointNode->GetMg(); // We invert it right away, as we only will need it in this form. Matrix iMgPolygonNode = ~polygonNode->GetMg(); // When an error is being raised by Cinema we should be cautious with using iferr_ingore, as // then the code will keep running in the current scope. In some cases like manipulating an // array like structure this can be useful. But when an initialization of an entity fails, we // almost never want to keep going, as trying to use that not initialized object then will be // a sure fire way to crash Cinema 4D. Instead we can either use iferr_return to simply leave // the current scope, use iferr_throw to throw a specific error or handle it manually with // iferr(). Below you will find a two examples. // Create a reference to the distance query interface. maxon::DistanceQueryRef distanceQuery = maxon::DistanceCalculator().Create() iferr_return; // Pass true for the second argument to voxelize the input to speed up larger queries. Just as // with any optimization, for smaller data sets this voxelization setup might eat up all the // performance benefits gained latter on. iferr(distanceQuery.Init(polygonNode, false)) { ApplicationOutput("Failed to initialize DistanceQueryInterfacae for @", polygonNode->GetName()); return maxon::OK; } // Go over all vertices and query them for the closest polygon (id) in the other mesh. float distance = 0; Vector p; for (int poindId = 0; poindId < pointCount; poindId++) { // The point in the point mesh converted first to global coordinates and then to local // coordinates in the polygon node. We have to do that because the points in the point // source live in their own coordinate system as well the ones in the polygon source. p = mgPointNode * iMgPolygonNode * points[poindId]; maxon::PrimitiveInformation info; distance = distanceQuery.GetClosestMeshPrimitive(p, info); ApplicationOutput("Closest polygon id for point id @: @", poindId, info.GetRealPolyIndex()); } return maxon::OK; } The output/setup: [image: 1617968576078-642545d3-3ffa-467e-9123-cf0a328b18f1-image.png]
  • Wrong editor preview of material plugins with TextureTag repetitions

    s22 c++
    4
    0 Votes
    4 Posts
    799 Views
    D
    Thanks for the investigation. At least now we are aware the problem is not on our side. Cheers, Deyan
  • python plugin in debugging mode

    2
    0 Votes
    2 Posts
    817 Views
    M
    Hi @Yaroslav this is indeed possible however a bit clunky for the moment, but here a full step by step. Install pip with c4dpy -m ensurepip Install Python Visual Studio Debugger with c4dpy -m pip install ptvsd. Within Visual Studio in your launch.json just set up a basic attach setting, here is mine but for more information see Python debug configurations in Visual Studio Code. { "version": "0.2.0", "configurations": [ { "name": "Cinema 4D: Remote Debugger Attacher", "type": "python", "request": "attach", "connect": { "host": "127.0.0.1", "port": 3000 }, "pathMappings": [ { "localRoot": "${workspaceFolder}", "remoteRoot": "." } ] }, ] } The *.pyp plugin should be of course in the same workspace as your launch.json. Edit the *.pyp plugin and write the next code in the first line of your pyp file. import ptvsd ptvsd.enable_attach(address = ('127.0.0.1', 3000)) Start Cinema 4D, wait until its UI is loaded, meaning the pyp plugin is loaded, and the client (your script) is attachable from a debugger. Run the previously created debug configuration (called Cinema 4D: Remote Debugger Attacher). Put a breakpoint somewhere (like in the Execute of a CommandData) to trigger the BP. Enjoy Note this also works nicely for the script, however for script you should call ptvsd.wait_for_attach() after the ptvsd.enable_attach. Cheers, Maxime.
  • Get the String of the Font Data?

    r21 python
    4
    0 Votes
    4 Posts
    527 Views
    B
    @Cairyn @ferdinand Thanks for the response. Printing the base container with their indexes worked in my use case
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    13 Views
    No one has replied
  • Write a python code into a Python Effector

    python
    10
    0 Votes
    10 Posts
    2k Views
    H
    @Cairyn Thank you for your help ! That's it. I confused it all with the wrong word. Sory... Your answers help me very nicely @ferdinand I apologize about going out of the guidelines. I understand this and will create new topic for that point
  • ObjectData::Draw

    c++ r21
    3
    1
    0 Votes
    3 Posts
    528 Views
    A
    Thanks for your answer, it solved my problem. Thank, AiMiDi