• 0 Votes
    5 Posts
    620 Views
    ?
    @ferdinand Thank you. I'll try to cache myself.
  • Add button to run a script

    Cinema 4D SDK
    12
    0 Votes
    12 Posts
    2k Views
    ferdinandF
    Hello @stereo_stan, without further questions or replies, we will consider this topic as solved by Monday, the 30th and flag it accordingly. Thank you for your understanding, Ferdinand
  • SplineCustomGui settings issue

    Cinema 4D SDK r21 python windows
    11
    2
    0 Votes
    11 Posts
    2k Views
    ferdinandF
    You need to call NodeData.InitAttr() in NodeData.Init. E.g.: def Init(self, node): """ """ self.InitAttr(node, float, c4d.PY_TUBEOBJECT_RAD) self.InitAttr(node, float, c4d.PY_TUBEOBJECT_IRADX) node[c4d.PY_TUBEOBJECT_RAD] = 200.0 node[c4d.PY_TUBEOBJECT_IRADX] = 50.0 return True But you should check the allocation problem first, it is the most likely culprit. Se the edit in my last posting. Cheers, Ferdinand
  • 0 Votes
    3 Posts
    827 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
  • 0 Votes
    16 Posts
    3k Views
    ferdinandF
    Hey Andreas, no need to feel sorry. It is valuable for us to be aware of this, as this could cause more serious problems further down the road, even though it is hard to reproduce for now. We have pushed this off to QA for now, due to them having the required tools (hardware) to assess this more thoroughly. I do not see anything inherently wrong with that. But the only ones who could answer this with complete certainty are the developers who wrote the Cinema 4D core. And until we cannot say with a reasonable degree of certainty that this is a reproduceable bug that we want to address, I will not bother them with this, since there is other "stuff" in front of the queue for them anyway. I have forked your second part of the question, as I would like to keep this thread clean, as I would anticipate that QA will confirm this bug, it then going to the developers, and we will then report back here. Which will get a bit convoluted when there is a second question being discussed here. The topic can be found here. I understand that this is not the most satisfying procedure for you, as it will take a bit of time. The issue of yours must go through our bug tracking system now first, rather than taking the shortcut we sometimes offer here, of us talking with the developers and then creating an issue if we decide to do so. Cheers, Ferdinand
  • 0 Votes
    5 Posts
    2k Views
    a_blockA
    Hi Ferdinand, thanks for the confirmation and looking into it. While it's a bit unfortunate, I do not consider this a major road block. From my side this thread can be considered close. Cheers
  • 0 Votes
    2 Posts
    415 Views
    M
    Hi, @Boony2000 you are right, the documentation will be fixed. Cheers, Maxime.
  • No save prompt after userchange

    Cinema 4D SDK r21 windows python
    3
    0 Votes
    3 Posts
    533 Views
    B
    Hi! Thanks for your input! I just found the cause. There is an os.kill call on the C4DPL_ENDPROGRAM message. If you leave it out some python stuff seems to keep running and preventing Cinema from being opened again. I am assuming that's why the original author did that. I will just catch the dirty flag myself and deal with unsaved scenes before terminating the process. Unless you know a more elegant way. I will mark this as solved. Thanks again. P.S.: This is off topic, but trying to reply I would always get an error and I had to log out and in again to post this. EDIT: I found the elegant solution - Adding c4d.documents.CloseAllDocuments() before the process termination handles the save dialogs perfectly!
  • VariableChanged Struct is missing its maps?

    Cinema 4D SDK r23 c++ windows
    8
    0 Votes
    8 Posts
    1k Views
    CairynC
    @ferdinand said in VariableChanged Struct is missing its maps?: TEST TEST forbidden to post? No, it's not Sorry, that's the message from the system that I got in the other thread, repeatedly. So I tried it here, and it posted without difficulty. Then I tried in the other thread again, and it worked. Then I deleted all these postings. But as the original message that I tried to post was lost to the error, I didn't bother to write it again. Quite strange error, haven't seen it before, and it didn't come with any explanation WHY it was forbidden to post.
  • DescID [] operator crashes?

    Cinema 4D SDK c++ windows r23
    3
    1
    0 Votes
    3 Posts
    415 Views
    fwilleke80F
    Already found the reason, sorry to bother you, all good Cheers, Frank
  • Errors building math.framework

    Cinema 4D SDK c++ windows r23
    5
    0 Votes
    5 Posts
    524 Views
    fwilleke80F
    Oh yes, it works. Therefore, the topic is solved Cheers, Frank
  • 0 Votes
    5 Posts
    820 Views
    K
    Hi, It looks like the problem got solved by Sized function. Thanks a lot @m_magalhaes and @m_adam !!
  • 2 Votes
    8 Posts
    2k Views
    ferdinandF
    Dear community, this bug has been fixed and will be integrated with an upcoming release of Cinema 4D S24 (hopefully the next one). Cheers, Ferdinand
  • Is MSG_TRANSLATE_POINTS still in use?

    Cinema 4D SDK c++ r23 windows
    5
    0 Votes
    5 Posts
    720 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...
  • 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
  • 0 Votes
    3 Posts
    661 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
    363 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]
  • 0 Votes
    4 Posts
    511 Views
    ferdinandF
    Hi @blastframe, yes, that would be one, and probably the more modern way to do it. I personally like also an explicit call to the base implementation. I think it is more readable for someone else reading your code. But that is probably a rather subjective choice. So for clarity, I am speaking about something like this: foo = bar * baz return c4d.gui.GeUserArea.InputEvent(self, msg) There is of course the advantage of super taking care of calling the proper implementation(s) for you which is not taken care of by this approach, but you cannot have everything and in this case things are rather unambiguous for us here Cheers, Ferdinand
  • Erratic Keyboard Messages in GeDialog

    Cinema 4D SDK python r23 windows
    7
    0 Votes
    7 Posts
    1k Views
    ?
    @mp5gosu Sorry, I missed it! That works! In case other devs have a solution, I'll mark yours as the right answer. Thank you!
  • 0 Votes
    3 Posts
    459 Views
    ?
    @ferdinand Thank you, Ferdinand for the thorough answer and ideas for workarounds. I don't quite have my head around how to use threading in Cinema 4D yet but you've inspired me to look into it. Thank you!