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
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login
    1. Maxon Developers Forum
    2. yaya
    3. Topics
    Y
    • Profile
    • Following 0
    • Followers 0
    • Topics 13
    • Posts 53
    • Best 1
    • Controversial 0
    • Groups 0

    Topics created by yaya

    • Y

      Plugin does not appear in Expression on client's Cinema 4D

      Cinema 4D SDK
      • s26 2024 c++ windows • • yaya
      24
      0
      Votes
      24
      Posts
      3.6k
      Views

      Y

      Oh, you've edited your previous message! Thanks! I will try it.

    • Y

      New Simulation system: the Compound Collision Shape is no longer available?

      General Talk
      • 2025 c++ • • yaya
      7
      0
      Votes
      7
      Posts
      1.5k
      Views

      i_mazlovI

      Hi @yaya,

      I see your point here and I can only guess if such behavior is expected or not, as this is (and I've already mentioned this to you earlier) a question that has nothing to do with development.

      In general it sounds like a bug, so you're very welcome to reach out to our Support Team and ask them for a proper workaround if they actually classify this issue as a bug.

      I'm moving your thread to general talk section in case someone from our community might be willing to share their experience on that topic.

      Cheers,
      Ilia

    • Y

      3d Connector problem after 2024.4 update

      Bugs
      • c++ 2024 windows • • yaya
      10
      0
      Votes
      10
      Posts
      2.6k
      Views

      ferdinandF

      addendum, I briefly spoke with the dev:

      In SetDParameter, there is code that sets the correct group automatically if force_type or force_type_mode is specified, and the other way around. One thing to keep in mind is that, when you set the parameter force_type_group, the mode is set to default value for that group, i.e., ball and socket for spherical, hinge for angular, slider for linear. This is what you see ig you play in with the dropdown menus in the UI as well. So, if one first sets force_type_mode and then force_type_group, the latter resets the mode to a possibly different value. But in the code snippet attached it looks though like the order is correct (assuming is the actual code used in the plugin).

      In a way, I understand that if you are setting mode and group manually from you plugin and you know what you are doing, you are setting a combination that makes sense. But in general, to be extra safe, I decided to go with this solution, so if you change the group the mode is automatically set to something that makes sense. And, btw, also when you set the mode there is a check on the group, and if the values don't match it gets overwritten with the correct group.

      so, valid options are:

      simply set force_type (as before) set force_type_group and force_type_mode (in this order) only set force_type_mode (group set automatically)

      If any of these don't give the expected combination it is a bug

      I think he too struggled a bit with understanding what you did concretely, so I would recommend creating a bug report as lined out above.

      Cheers,
      Ferdinand

    • Y

      BaseSelect::Free() in 2024 - Access violation reading location

      Cinema 4D SDK
      • 2024 • • yaya
      8
      0
      Votes
      8
      Posts
      1.2k
      Views

      ferdinandF

      Hey @yaya,

      okay, and your your plugin hook is ObjectData, right? Your plugin is the 'RagDoll' entity, in your screen grab? It is really hard to get here anywhere without code, but here are a few guesses:

      Are you 'abusing' your ObjectData hook by modifying the scene it is contained in? ObjectData is bound to the threading restrictions in most of its methods, because most run not on the main thread. This is more relevant than ever with 2024, because more methods have been parallelized. You can modify the scene from an ObjectData plugin, but you must be on the main thread to do it, by for example defer execution to the MT or use a method like Message which often runs on the MT (but I would still avoid doing it when possible). Modyfing the scene means for example inserting, objects, materials, shaders, etc. or adding events. Modifying your cache to your likeing in getVirtualObjects is of course okay. This could also be a nasty side effect of the new data access system.

      But these two are of course fairly speculative since I almost know nothing about your plugin. And you said, when I understand you correctly, that you already this problem in the past, and then somehow fixed it by illegally freeing the selection of the object.

      I would recommend doing the following things:

      Reduce the complexity of your example scene, that thing is way too complex. Make it as simple as possible by removing as many things as possible with the problem still happening. Run Make Editable and Current State to Object separately on instances of your faulty plugin output. Analyze the content of the caches to see what is actually happening in the places "where things go wrong". Either you are somehow missing full objects in your cache or skip some data, etc. Just do normal debugging then: Set a breakpoint on GetVirtualObjects in your plugin and step through the code, trying to figure out when you "loose" parts. Avoid skipping 'boring' parts as you easily miss the problem then.

      Other than that, I will have to see code, because otherwise there is no magic wand move with which I could guess what is going wrong here for you.

      Cheers,
      Ferdinand

    • Y

      Get ID of Undo-ed parameter...?

      Cinema 4D SDK
      • c++ s26 • • yaya
      5
      0
      Votes
      5
      Posts
      879
      Views

      Y

      Thank you for your explanation. I suspected that most likely it would not be possible to catch the moment of the beginning of Undo/Redo. Sad...

      So if to consider your advice:...
      @manuel said in Get ID of Undo-ed parameter...?:

      You can either update all your objects based on the new data or check all your structure and check if it needs any updates.

      ...if I want to call update function in MSG_DOCUMENTINFO_TYPE_UNDO, so how to retrieve the correct object which have been updated here? (it should be my node). As I think I do not need make update in situations when Undo was made for another objects in the scene.

      And also I did not understand the second part in the quote. What the structure should I check? Structure of parameters of my node? Or structure of objects? And how to check that they need any updates?

    • Y

      InExcludeData modifying in the ParalelFor?

      Cinema 4D SDK
      • c++ s26 sdk • • yaya
      7
      0
      Votes
      7
      Posts
      1.0k
      Views

      ferdinandF

      Hello @yaya

      And actually as I understand it is pretty logical.
      I have 2 InExData parameters in my plugin. So when I copying 3000 items into 2 InExData`s, plus adding 3000 objects into the scene, then the number of operations increases up to 9 000.

      It depends a bit on what you consider an 'operation' in this context, but I would say your calculation is at least misleading. Due to the copying nature of IncludeExcludeData::InsertObject, inserting objects is not a constant cost operation (other than your example implies). It scales linearly with the number of items already in the list (in practice probably even a little bit worse, because the copying itself calls a function which is non-constant).

      So, when you have a list with 5 items and add one, it is 5 + 1 = 6 - you must copy over the five old items and then add the new one - operations. And adding 5 items in total to an empty list would be 1 + 2 + 3 + 4 + 5 = 15 operations. The term operations is a bit fuzzy here, and there is a lot of room for interpretation, but what I want to make clear is that adding an item to an InExcludeData is not a constant operation. So, adding 3000 items to an InExcludeData does not result in 9000 operations, but 4498500. From this also follows, that it is computationally advantageous to store items in a larger number of lists, e.g., adding to two InExcludeData 1500 items each, costs 1124250 operations per batch, i.e., 'only' 2248500 operations for all 3000 items.

      Splitting up the data is IMHO your best route of optimization. InExcludeData is also simply not intended for such a large number of objects being stored in them. And as stressed before: I would really test first if InExcludeData is indeed the culprit. ::InsertObject has been designed in a way which does not mesh that well with what you want to do. But I do not really see it eating up 10 seconds, even for 3000 objects. I personally would expect the other calls in your loop to take up more time. But that is very hard to guesstimate from afar, and I might be wrong.

      Cheers,
      Ferdinand

    • Y

      GetMg() returns not the actual coordinates

      Cinema 4D SDK
      • • • yaya
      8
      0
      Votes
      8
      Posts
      1.3k
      Views

      ferdinandF

      Hello @yaya,

      without any further questions and other postings, we will consider this topic as solved and flag it as such by Friday, 17/06/2022.

      Thank you for your understanding,
      Ferdinand

    • Y

      ssl certificate error in debug console

      Cinema 4D SDK
      • c++ r21 • • yaya
      8
      0
      Votes
      8
      Posts
      1.2k
      Views

      Y

      Hi @ferdinand, I did not get this problem in R23 and R25 yet. Maybe it exists, but I did not see.
      I got it only in R21. But as @m_magalhaes mentioned: it is known issue and was fixed in later releases, so I leave it.

    • Y

      R24 compiling issue (error C2220: the following warning is treated as an error)

      Cinema 4D SDK
      • c++ project tool python s24 sdk • • yaya
      4
      0
      Votes
      4
      Posts
      1.4k
      Views

      ferdinandF

      Hello @yaya,

      without any further questions we will consider this topic as solved by Friday, December the 17th.

      Thank you for your understanding,
      Ferdinand

    • Y

      Replace Plugins in a Running Cinema 4D Instance

      Cinema 4D SDK
      • c++ r23 windows macos • • yaya
      12
      0
      Votes
      12
      Posts
      2.5k
      Views

      Y

      Oh! Forget guys my message above!

      The calling of Python code from C++ plugin in @kbar 's advice does the trick! 🙂

      If someone from the future who will read this thread will need the code example, I just use the code snippet from here: https://developers.maxon.net/docs/cpp/2023_2/page_maxonapi_python.html

      and feed to it this code:

      // call it from somewhere String code = "import c4d\nimport maxon\nimport os "; code+= "\n\nprint(f'This is simple message')"; code += "\nos.rename('C:/Code/sdk/plugins/myPlugin/myPlugin.xdl64', 'C:/Code/sdk/plugins/myPlugin/old_myPlugin.old')"; ExecutePythonScript(code, GetActiveDocument());

      😄

    • Y

      OpenInputStream() works incorrect.

      Cinema 4D SDK
      • • • yaya
      2
      0
      Votes
      2
      Posts
      499
      Views

      ferdinandF

      Hello @yaya,

      thank you for reaching out to us. Your example does build for me in R23, at least regarding the mentioned line of code:

      const maxon::InputStreamRef inputStream = webFile.OpenInputStream() iferr_return;

      Your example is however incomplete, it is missing the include statement to include iostreams.h which is likely causing your error. But there should be more errors for you in this stretch of code, since for example the line const maxon::Url webFile = (maxon::Url("https://www.mysite.com/Somevideo.mp4"_s))iferr_return is also incorrect. Find a commented example at the end of my posting for details.

      On SDK help search there is no a link to a "InputStreamRef".

      The maxon API does provide in C++ a managed memory environment, i.e., garbage collection, akin to managed languages like C# or Python. Which means all objects are split into the actual object instance and references to that instance. The object instance is then reference counted and deallocated once there are no references to it anymore. So, when you have a ThingRef, it is actually just a reference to an instance of a ThingInterface (at least most of the time, copy-on-write object references do not have the Ref postfix, i.e., the reference for a COW ThingInterface would be called Thing). The Doxygen parser (the tool we are using for documentation) does struggle heavily with all the metaprogramming we do and cannot properly ingest Ref entities. This is a bit tricky subject we are aware of and working on to, but this will take some time.

      Long story short, you would have to search here for InputStreamInterface. There is also our Entity Creation Manual which does expand a bit on the topic of interfaces and their references.

      If you continue to have problems, please make sure to post your full code and not just a snippet, as it otherwise mostly guesswork for us to figure out where your problem lies.

      Cheers,
      Ferdinand

      // You must include this header in order to have access to the full interface definitions. #include "maxon\iostreams.h" maxon::Result<void> SomeFunction() { iferr_scope; // The iferr_return here was incorrect. In our example it is required because we concatenate there // two urls. UrlInterface.operator+ is a maxon::Result, i.e., requires error handling. Just // initializing a Url does not have any error handling and therefor requires no iferr_return. const maxon::Url url("https://www.mysite.com/Somevideo.mp4"_s); const maxon::UrlScheme scheme = url.GetScheme(); const maxon::Bool isHTTP = scheme == maxon::URLSCHEME_HTTP; const maxon::Bool isHTTPS = scheme == maxon::URLSCHEME_HTTPS; if (isHTTP || isHTTPS) { const maxon::InputStreamRef inputStream = url.OpenInputStream() iferr_return; const maxon::Int length = inputStream.GetStreamLength() iferr_return; maxon::BaseArray<maxon::Char> data; data.Resize(length) iferr_return; inputStream.Read(data) iferr_return; inputStream.Close() iferr_return; // trgetUrl was not defined in your/our example, so I did redefine it here as someUrl. const maxon::Url someUrl("https://www.yoursite.com/"_s); // This will be "https://www.yoursite.com/Somevideo.mp4", i.e., GetName returns the last // component of a Url, e.g., "Somevideo.mp4" in this case. Here we need the iferr_return, since // UrlInterface.operator+ can fail, i.e., return an error. const maxon::Url anotherUrl = (someUrl + url.GetName()) iferr_return; const maxon::OutputStreamRef outputStream = anotherUrl.OpenOutputStream() iferr_return; outputStream.Write(data) iferr_return; outputStream.Close() iferr_return; } return maxon::OK; }
    • Y

      "two-leveled" ID ( [50004,1] ) of a Constraint Tag? C++

      Cinema 4D SDK
      • c++ r25 • • yaya
      3
      0
      Votes
      3
      Posts
      516
      Views

      Y

      Hello @ferdinand ,

      Thank you for your answer!
      I made a search by the forum but have lost your post above because of I sorted topics only for a C++. My bad)
      I also read the C++ manual for a DescID and DescLevel and the examples in there. But they are not cover the examples like my above for a [50004,1] - IDs (or maybe I've not found).
      For a Python version of my plugin I did not have a problem with understanding the access to the parameters at all. But on C++...
      For example I stuck in my mind with figuring out how does the second DescLevel work. But after your explanation above I understand it. The first level DescLevel in your code locates this sub-container: изображение_2021-10-15_181737.png

      And next with the codeline:

      const DescLevel secondLevel (0, DTYPE_LONG, 0);

      we access into the one of this items.

      So I've changed your your code into:

      const DescLevel secondLevel (1, DTYPE_LONG, 0);

      and I got access into the 5004,1 item.

      Thank you very much!

    • Y

      C++ The product of the Matrix and another type function does not exist?

      Cinema 4D SDK
      • • • yaya
      8
      0
      Votes
      8
      Posts
      1.1k
      Views

      Y

      Hello @ferdinand
      I've tested it a bit and now I've finished with this:

      instead of this:

      matrixA= c4d.utils.MatrixMove(c4d.Vector(0,10,0)) matrixB = myObject.GetMg().__mul__(matrixA)

      to this:

      Matrix matrix = MatrixMove(Vector(0, 10, 0)); Vector vector = myObject->GetMg() * matrix.off;

      It looks it works for me.
      Thank you again!