• How to add "scripts" to a menu?

    2024 python
    4
    0 Votes
    4 Posts
    1k Views
    ferdinandF
    Hey @mogh, I know that you did not meant any harm and the word hijack was a bit strong - which is why reworded that before you answered. But topics should remain focused on a singular thing, the specific question of the original poster, rather than being a collection of questions from multiple people which roughly align with whatever broader topic they see embodied in a thread. Cheers, Ferdinand
  • 0 Votes
    8 Posts
    2k Views
    C
    @i_mazlov , Do you speak Russian?
  • Overlapping images with transparency with BaseBitmap

    2024 windows c++
    16
    0 Votes
    16 Posts
    3k Views
    sasha_janvierS
    Thank you very kindly, @ferdinand! I had already started exploring the maxon::ParallelImage class as I suspected it to be the ideal path forward for my case, so it's great to have my suspicions be validated! I will make sure to start a new thread if I have any questions related to this class. Thank you very much once again. Your assistance has been indispensable! Cheers
  • Add Material to Active Layer in Material Manager

    c++
    2
    0 Votes
    2 Posts
    413 Views
    ferdinandF
    Hello @antonia-nyagolova, Welcome to the Maxon developers forum and its community, it is great to have you with us! Getting Started Before creating your next postings, we would recommend making yourself accustomed with our forum and support procedures. You did not do anything wrong, we point all new users to these rules. Forum Overview: Provides a broad overview of the fundamental structure and rules of this forum, such as the purpose of the different sub-forums or the fact that we will ban users who engage in hate speech or harassment. Support Procedures: Provides a more in detail overview of how we provide technical support for APIs here. This topic will tell you how to ask good questions and limits of our technical support. Forum Features: Provides an overview of the technical features of this forum, such as Markdown markup or file uploads. It is strongly recommended to read the first two topics carefully, especially the section Support Procedures: Asking Questions. About your First Question I am not quite sure what you mean by 'Active Layer in [the] Material Manager'? Do you mean the tabs to filter materials by layer in the Material Manager? [image: 1710172255086-93afa897-ab3d-41ca-9d27-f0de1545ffa7-image.png] We generally do not expose managers/UIs in our API, so you unfortunately cannot get hold of that information. Cheers, Ferdinand
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    8 Views
    No one has replied
  • How to set the position of a node manually?

    python 2024
    4
    0 Votes
    4 Posts
    684 Views
    ferdinandF
    Hey @momoko, I understood why you asked, as this is common thing to do. Even for our own other node system, Xpresso aka GraphView, doing this is possible in the API. I just provided an explanation as to why the Nodes Team did it like this and why they very likely will never change that (as it would break their design pattern). So that you and future readers can understand why we do this instead of just being confronted with a blunt "no" Cheers, Ferdinand
  • How to set a custom color for a node?

    python 2024
    7
    0 Votes
    7 Posts
    1k Views
    M
    @ferdinand You are amazing! Thanks
  • Matrix and Vector access

    r23 python
    7
    0 Votes
    7 Posts
    1k Views
    ferdinandF
    Hey @datamilch, Thank you for reaching out to us. In general we prefer if users open new threads for their questions. You are of course welcome to link to an existing topic and say that your question relates to that. The reason for that is that even when the question of another user is right on-topic as it is here the case with your question (which in the most other cases will not be true), it still tends to derail a thread. I have not forked your question since you are on-topic. About your Question I think this thread can be a bit opaque for beginners as @Cairyn and @m_adam have approached this topic on a very technical level. The important thing to understand, is that both BaseObject.GetMg() and the fields of a c4d.Matrix, i.e., off, v1, v2, and v3 return a copy of the requested object, not an instance. In plain terms this means that the matrix/vector one retrieves is not the one used by the object/matrix but a copy of it. So, we can totally do this: >>> mg Matrix(v1: (1, 0, 0); v2: (0, 1, 0); v3: (0, 0, 1); off: (0, 0, 0)) >>> mg.off.x = 5 but it does not do what we think it would do, we changed the x-value of the returned copy, not the off vector used by the mg instance. >>> mg.off.x 0.0 >>> mg Matrix(v1: (1, 0, 0); v2: (0, 1, 0); v3: (0, 0, 1); off: (0, 0, 0)) But we can certainly set the x-component of the global offset of an object in one line. import c4d cube: c4d.BaseObject = c4d.BaseObject(c4d.Ocube) # ONE: Using parameter access # We set the the x component of the global position and the global rotation using parameter access. # There are also parameters for the relative, aka local, transform values, as well as special things # like a frozen transform. There are also functions on BaseObject which do the same thing but at # least I never use them. # See: https://developers.maxon.net/docs/py/2024_3_0/classic_resource/base_list/obase.html cube[c4d.ID_BASEOBJECT_GLOBAL_POSITION,c4d.VECTOR_X] = 9.9 cube[c4d.ID_BASEOBJECT_GLOBAL_ROTATION] = c4d.Vector(0, 0, c4d.utils.DegToRad(45)) # TWO: Use matrix and vector constructors # In three steps ... mg: c4d.Matrix = cube.GetMg() mg.off = c4d.Vector(9.9, mg.off.y, mg.off.z) cube.SetMg(mg) # ... or in two steps, although this is a bit stupid. mg: c4d.Matrix = cube.GetMg() cube.SetMg(c4d.Matrix(c4d.Vector(9.9, mg.off.y, mg.off.z), mg.v1, mg.v2, mg.v3)) # THREE: Using transforms # This is not exactly the same as the two other cases, but it is the most common operation. Here we # do not set the global x-position of #cube to 9.9, but we move it 9.9 units in the x-direction. # In code we often operate on objects with the identity transform/matrix, i.e., which "sit at origin # with the standard size and orientation". In that case transforms act the same as if we would just # set these values. The other case is that you have an object at (1, 2, 3) and then move it (3, 2, 1) # units, transforms also work for this. For the case where the object is at (1, 2, 3) and you want # to _set_ it to (9.9, 2, 3) a transform won't work unless you do the math. # Freshly instantiated objects have the identity transform, we can just pile transforms on top of # that to "set" the values. sphere: c4d.BaseObject = c4d.BaseObject(c4d.Osphere) # Just move it 9.9 units in the x-direction. sphere.SetMg(sphere.GetMg() * c4d.utils.MatrixMove(c4d.Vector(9.9, 0, 0))) # Or first move it 9.9 units in the x-direction and then rotate it 45 degrees around the z-axis. This # would also "pile" onto the previous transform we have already applied. Note that matrix # multiplication is also not commutative, i.e., first moving something and then rotating it (might) # yield something different than first rotating and then moving. sphere.SetMg(sphere.GetMg() * c4d.utils.MatrixMove(c4d.Vector(9.9, 0, 0)) * c4d.utils.MatrixRotZ(c4d.utils.DegToRad(45))) Cheers, Ferdinand
  • 0 Votes
    3 Posts
    653 Views
    i_mazlovI
    Hello @JACK0319 , I'm not sure what you consider the "correct result", but it looks good here: [image: 1709806382074-9888272b-b870-4514-80e9-e16f01e6dc14-image.png] However, there're a couple things to mention about your script. First, there SendModelingCommand() function executes passes itself, so there's no need in munally running ExecutePasses() function. Second, in the last line you insert the result object from the CSTO command into document stored in doc variable. At this point doc still points to the document that was active before you executed function InsertBaseDocument(). After this function call, GetActiveDocument() returns the same document that you have in temp_doc. However, there's one edge case, which happens if you execute InsertBaseDocument() function while currently active document is empty. In this case, current document is deallocated and doc points to the invalid document. This is why you see the corresponding log in python console: ReferenceError: the object 'c4d.documents.BaseDocument' is not alive By the way, this is similar behavior you notice when clicking on [+] button [image: 1709807443046-0dd7ae71-413a-4cf6-b981-b42ca06e488b-image.png] multiple times: it kills currently active empty document and activates new empty document instead. There're multiple solutions for you depending on what are your intentions with this script: If you only need baked object inserted to currently active document, there's no need in attaching your temporary document to cinema with the InsertBaseDocument() function If otherwise you need the temporary document to be inserted to cinema, consider attaching it after you insert cache to the old document. If you're attaching temp_doc to cinema only for debugging purposes, you can early exit your script to not let it go to the insertion step. Another option could be to "touch" original document (e.g. by inserting c4d.Onull object at the beginning of the script and removing it in the end). Cheers, Ilia
  • how to set the path of a Textre node manually?

    windows macos python 2024
    5
    0 Votes
    5 Posts
    807 Views
    ferdinandF
    No need to be sorry
  • how to limit the type of files we can import?

    python 2024
    3
    0 Votes
    3 Posts
    528 Views
    M
    @i_mazlov Thanks for your response! I learnt a lot!
  • How to use GetAllNimbusRefs in 2023

    2023 c++ windows
    5
    0 Votes
    5 Posts
    955 Views
    kbarK
    Thanks @ferdinand! Appreciate everything you do. Also what the rest of the sdk support and docs team are doing! Not an easy job keeping on top of all these changes.
  • This topic is deleted!

    1
    2
    0 Votes
    1 Posts
    17 Views
    No one has replied
  • Dialog window with palette

    python
    3
    1
    0 Votes
    3 Posts
    670 Views
    merkvilsonM
    Is it possible to save and load the group window in a way similar to the l4d files?
  • How to specify file type subdirectory for MSG_RENAMETEXTURES

    c++
    2
    0 Votes
    2 Posts
    465 Views
    ferdinandF
    Hey @Deyan, Thank you for reaching out to us. The answer for public users is, no, you cannot do that, and even with a bit deeper access this will be tricky. Cheers, Ferdinand
  • How to get only tracks displayed in timeline User Mode

    python 2024
    3
    0 Votes
    3 Posts
    666 Views
    K
    Hi @ferdinand , Thank you for clarifying. I needed a solution for my tool to determine which track/key is displayed&selected. But if I can't do that in user mode, I'll make sure my tools don't work when the timeline is in user mode.
  • Python: Detect Plugins

    2024 python windows
    12
    0 Votes
    12 Posts
    2k Views
    J
    Thanks for the response. I'll see if this does what I need it to John Thomas
  • Rename Layers with Python containing Emoji?

    2024 python windows
    3
    3
    0 Votes
    3 Posts
    632 Views
    ferdinandF
    Hello @gaschka, Thank you for reaching out to us. Yes, this is an encoding issue. In general, Unicode is supported by the Python to C++ bindings, as you can see, French, German, and Turkish diacritics are all correctly transported, as well as Chinese characters. [image: 1709563393413-5bfdbc74-f638-4fd8-8df9-2b95479b233b-image.png] But all these are part of the Basic Multilingual Plane (BMP) while the emojis are part of the Supplementary Multilingual Plane (SMP) of the Unicode table. It could either be that there is something not implemented or some bits get chopped off while data is sent to the C++ layer. I don't really know, the person who is responsible for the Python bindings, @m_adam, is on vacation. I will ask him once he is back, as I too would be guessing what is happening here exactly. Cheers, Ferdinand
  • How to make static texts bold? Icons?

    2024 python
    2
    0 Votes
    2 Posts
    506 Views
    ferdinandF
    Hello @momoko, Thank you for reaching out to us. I understand that especially when getting familiar with a new API that the thirst for knowledge is immeasurable and the questions are uncountable but I must also point out our Support Guidelines here, especially our Support Topic Rules. A support topic should be mono-thematic, i.e., usually have one question only. If you have multiple questions, please open multiple topics. Please also make sure that your questions are repeatable as outlined in the guidelines. Usually this means complete code. I can guess from the context in this case that you are talking about GeDialog but I might not be able to in a more complex case. How can I make a static text bold? I tried some common methods in Python but they didn't work! I am not sure what you mean with common methods in Python, but you can make a static text font bold by a bit counterintuitively setting its border style. There is no italic option and bold emphasis should be used only very selectively. self.AddStaticText(id=2001, flags=c4d.BFH_SCALEFIT, name="Hello World", borderstyle=c4d.BORDER_WITH_TITLE_BOLD) How can I add an icon to a button without using custom icons? Does Cinema4D provide any default icon like Blender? I am not 100% sure how this is meant. Buttons with icons and text are a bit atypical in Cinema 4D and usually only appear in palettes. The standard dialog button cannot have an icon. But you can use a CUSTOMGUI_BITMAPBUTTON, but they are not really meant to have a caption. You can find a Python example here. Cheers, Ferdinand
  • How to preserve the animation of a sphere

    s26 c++ windows
    9
    2
    0 Votes
    9 Posts
    2k Views
    P
    @i_mazlov thank you very much