• Override material tag in take

    r25 c++
    13
    0 Votes
    13 Posts
    2k Views
    ferdinandF
    Hey @krfft, thanks for posting your detailed results. Cheers, Ferdinand
  • How to Rotate an Object

    r25 s24 r23 python macos windows
    7
    0 Votes
    7 Posts
    2k Views
    ferdinandF
    Hello @WDP, this question would technically also be a new topic, please follow these rules. There is no formal notion of an object axis in the sense of a moveable entity in the API. Objects have their matrices (the global and the local one), which are effectively their own coordinate system opposed to the world coordinate system (or transform or frame when you prefer these terms over coordinate system). So, when you want to reproduce what is possible in the app, and move, rotate, or scale the axes of an object, without moving the geomtery of the object itself, then you will have to transform the vertices of that object. So, when the object has the world offset (0, 0, 0) and you want to move the axes to (100, 0, 0), you must first set the global object matrix to an offset of (100, 0, 0) and then apply the inverse of a transform that translates by (100, 0, 0) to all its vertices. I would recommend reading the matrix manual I did post in my first answer here. This will however only be possible for editable point objects, e.g., a c4d.PolygonObject. You are showing a generator object, i.e., a c4d.BaseObject with some cached geometry in your screenshot. You cannot move the axes for these objects, neither in the SDK nor in the app itself. We had recently this topic which dealt with moving the axes of a polygon object. Cheers, Ferdinand
  • 0 Votes
    17 Posts
    4k Views
    ferdinandF
    Hey, good to hear that it does work for you (for now) I do not think that the definition of mgOrientationDelta is the culprit. It is just another way of doing what was done before with .MulV, i.e., it is just a transform without the offset component. As I indicated in my last posting, I did not spend much time with debugging your code, I just copied over the tag stuff and wrote the rest from scratch. I do not think that we do have to change anything here in the topic structure. But if you personally feel it would be better so, you can of course do it. At least I think you can, you have to open the topic tools button: [image: 1636375556111-18e1f9a6-d363-44c1-87a5-14e4a50e058e-image.png] and there you should then have this button: [image: 1636375625878-0faeb0a9-2343-4c7d-b971-4a059576700b-image.png] If you do not, well then only mods can do that Cheers, Ferdinand
  • How do I put objects into the timeline?

    r23 python
    5
    0 Votes
    5 Posts
    1k Views
    ferdinandF
    Hello @Cairyn, thank you for reaching out to us. Clarification: I am not looking for the iteration of objects, for the selection, or for the folding. Just for the method that will show the object/the track in timeline xxx. I wouldn't mind if someone could confirm that there is no access at all to the Timeline elements, or present an alternative...) You can add BaseList2D to a Timeline Manger by simply adding a CTrack to them. But you are probably after the special case where an object is being placed by drag and drop into a Timeline. This is a special case since the object has then no track. When you delete the last track of an object in a Timeline, then the object will be removed. This makes the drag and drop case a special case. Internally, the objects of a Timeline Manager are tracked in a list-like structure which is populated by traversing a document and events like object creation or drag and drop. It will automatically ingest all BaseList2D that have a track (and remove such that do not have tracks anymore). Nodes without a track that have been dragged and dropped into a Timeline are added "manually" to that list without being deleted. This works as far as I understand with a GeMarker being added to them. So technically, one might be able to replicate this in C++ by also adding that marker, but its content is not public and might carry other side effects. What I found out while playing around with tracks, is that one can add "fake" tracks by either completely making up a track id, which are then called just "track", or incomplete ids, e.g., for the position of an object. This could serve as a clean slate if desired but could also have side effects. [image: 1636374366235-ac3dd38c-8e5d-4f48-a3cd-941ae2c987cc-image.png] descId = c4d.DescID(c4d.DescLevel(c4d.ID_BASEOBJECT_REL_POSITION, c4d.DTYPE_VECTOR, 0)) track = c4d.CTrack(op, descId) op.InsertTrackSorted(track) c4d.EventAdd() Preventing the object being removed from the Timeline when deleting its last track is not possible in Python. At least I do not see a way to do it at the moment. Cheers, Ferdinand
  • Replace Plugins in a Running Cinema 4D Instance

    c++ r23 windows macos
    12
    0 Votes
    12 Posts
    3k 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());
  • Python Objekte X Y Z

    Moved python r21 windows macos
    8
    0 Votes
    8 Posts
    2k Views
    W
    Thank you very much!
  • Ensuring only 1 specific pyTag in a document?

    python r20 s24
    9
    0 Votes
    9 Posts
    2k Views
    ferdinandF
    Okay, thanks for the heads up
  • Dynamics Body Tag & GetVirtualObjects

    python
    3
    1
    0 Votes
    3 Posts
    900 Views
    ferdinandF
    Hello @mfersaoui, Without any further questions, we will regard this topic as solved and flag it accordingly by Monday, September, the 8th. Thank you for your understanding, Ferdinand
  • Creating my own color preferences

    3
    0 Votes
    3 Posts
    687 Views
    ferdinandF
    Hello @tdapper , Without any further questions, we will regard this topic as solved and flag it accordingly by Monday, September, the 8th. Thank you for your understanding, Ferdinand
  • OpenInputStream() works incorrect.

    2
    0 Votes
    2 Posts
    657 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; }
  • How to control Picture Viewer by Python in C4D R19 ?

    4
    0 Votes
    4 Posts
    1k Views
    ferdinandF
    Hello @Артём, without any further questions, we will consider this topic as solved by Tuesday, November the 2nd and flag it accordingly. Thank you for your understanding, Ferdinand
  • C4D Freezes after consecutive Import/Export

    python
    4
    0 Votes
    4 Posts
    1k Views
    ferdinandF
    Hello @orestiskon, without any further questions, we will consider this topic as solved by Tuesday, November the 2nd and flag it accordingly. Thank you for your understanding, Ferdinand
  • Undo SetSceneCamera

    5
    0 Votes
    5 Posts
    692 Views
    ferdinandF
    Hello @kbar, without any further questions, we will consider this topic as solved by Tuesday, November the 2nd and flag it accordingly. Thank you for your understanding, Ferdinand
  • Get identical document as the Render document

    python
    5
    0 Votes
    5 Posts
    1k Views
    ferdinandF
    Hello @orestiskon, without any further questions, we will consider this topic as solved by Tuesday, November the 2nd and flag it accordingly. Thank you for your understanding, Ferdinand
  • R25 - Compile plugin issue

    8
    0 Votes
    8 Posts
    2k Views
    ferdinandF
    Hello @jwzegelaar, without any further questions, we will consider this topic as solved by Tuesday, November the 2nd and flag it accordingly. Thank you for your understanding, Ferdinand
  • How to get Data unit

    r21 python
    3
    1
    0 Votes
    3 Posts
    437 Views
    chuanzhenC
    @ferdinand Thanks,great!
  • 0 Votes
    10 Posts
    2k Views
    ManuelM
    hi, this will be fixed on the next update. Cheers, Manuel
  • Where can I download the SDK for R15-R19?

    c++
    4
    0 Votes
    4 Posts
    617 Views
    ferdinandF
    Hello @ingvarai, My old posts are likely gone, I assume. Your old posts are not gone, but they are not linked to your account anymore, since the accounts of the old forum have not been migrated to the current forum. The old postings have been imported into the Legacy Forum category, in case of C++ questions mostly into SDK Help. So, you cannot search for all postings assigend to an account anymore, since they are attached now to the @Helper account. But when there is a certain topic you do remember, you will usually find it with some searching. Cheers, Ferdinand
  • gNew deprecated, ok, but NewObj generates compiler error

    c++
    3
    0 Votes
    3 Posts
    455 Views
    ingvaraiI
    Hi and thanks for this. It is my bad.. I didn't read the docs carefully enough / or did not understand the docs. Now this works! -Ingvar
  • Constant tracking of object position with Python

    python r23
    5
    0 Votes
    5 Posts
    899 Views
    D
    Hello @ferdinand , this example was perfect for me, thank you very much!