• 0 Votes
    4 Posts
    983 Views
    ManuelM
    hi, I had a look but as @zipit said, there's not way in python. Cheers, Manuel
  • Flat UV Projection in Python

    Cinema 4D SDK python
    3
    0 Votes
    3 Posts
    1k Views
    ?
    Thank you very much @zipit ! That works great.
  • 0 Votes
    3 Posts
    824 Views
    delizadeD
    thank you for your help.
  • Matrix and Vector access

    Cinema 4D SDK r23 python
    7
    0 Votes
    7 Posts
    2k 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
    7 Posts
    2k Views
    ?
    @zipit My sincerest gratitude for your help. Not only did you get my project unblocked, but you answered my follow-up questions. I have learned a lot from you. Thank you!
  • Create New Take Using Python

    Moved Cinema 4D SDK
    9
    0 Votes
    9 Posts
    3k Views
    D
    @m_adam Thanks for your help. Apologies for not following the rules. I'm struggling with the rules of Python at the moment so it's not surprising! Will try to be a better poster in future.
  • Connect C4D with Tkinter (External Application) ?

    Cinema 4D SDK r21 python
    12
    0 Votes
    12 Posts
    3k Views
    B
    @r_gigante Thanks for the response and the website reference. I was able to work the code with the following revisions: def CoreMessage(self, id, bc): if id == 1234: P1MSG_UN = bc.GetVoid(c4d.BFM_CORE_PAR1) pythonapi.PyCObject_AsVoidPtr.restype = c_int pythonapi.PyCObject_AsVoidPtr.argtypes = [py_object] P1MSG_EN = pythonapi.PyCObject_AsVoidPtr(P1MSG_UN) # check message and act if (P1MSG_EN == 1): c4d.documents.GetActiveDocument().InsertObject(c4d.BaseObject(c4d.Ocube)) elif (P1MSG_EN == 2): c4d.documents.GetActiveDocument().InsertObject(c4d.BaseObject(c4d.Osphere)) Thanks again. Will close this thread now.
  • How to fillet a ObjectData edge in Python?

    General Talk
    9
    1
    0 Votes
    9 Posts
    2k Views
    ?
    @zipit Absolutely incredible work! So elegant! Thank you very much @m_adam Thank you for the reply and confirmation!
  • Priority Delay on Stacking Skin Deformers

    Cinema 4D SDK r21 python
    16
    0 Votes
    16 Posts
    2k Views
    B
    Hi, Just checking if this is now resolved in the current version of C4D (2023).
  • Unable to Set Priority Data for Skin Deformer

    Cinema 4D SDK r21 python
    6
    0 Votes
    6 Posts
    770 Views
    ManuelM
    @zipit said in Unable to Set Priority Data for Skin Deformer: probably overlooked correct, friday evening
  • Unusual "NoneType" Error for GetDeformCache()

    Cinema 4D SDK r21 python
    12
    0 Votes
    12 Posts
    3k Views
    B
    Hi @m_magalhaes Ah gotcha. I guess I can't change the deformer's priority. Anyhow. Thanks for the confirmation.
  • Phong Tag with ObjectData

    Cinema 4D SDK python
    6
    0 Votes
    6 Posts
    1k Views
    ?
    It's working! Thank you @zipit , @r_gigante , & @m_adam ! Have an excellent weekend. A note for future readers One issue with my demo code is I wasn't passing the op from GetVirtualObjects to the CreateMyObject method. @m_adam created a new object (newObj) and only calls GetTag on the op (variable name: node). phongTag = node.GetTag(c4d.Tphong)
  • 'SetRealTag' Request

    Cinema 4D SDK
    3
    0 Votes
    3 Posts
    504 Views
    ?
    @m_magalhaes Hi Manuel! Thanks for the update.
  • Error reading resource Line 1

    Cinema 4D SDK r20 c++ python windows
    3
    0 Votes
    3 Posts
    1k Views
    B
    After a LOT of testing around I finally found the culprit. The header file was encoded UTF-8 with BOM. I finally figured it out after noticing that two versions of the header file that worked or didn't work had a 3 byte difference in file size. No idea how that snuck in there, but now it finally works. Also now it makes sense that the error was pointing to line 1.
  • Polygon Selections with ObjectData Plugin

    Cinema 4D SDK python
    6
    1
    0 Votes
    6 Posts
    908 Views
    ?
    @zipit Sorry, it embarrassingly didn't occur to me that your file example was working because I didn't see the Selection Tags as with the Generators. Thanks again for it! For the best user experience, there would be a proxy tag so the user can link & reference it by name. @m_magalhaes , any updates on the SetRealTag implementation in the SDK? I created a request for the SDK here: SetRealTag Request Thank you.
  • 0 Votes
    6 Posts
    1k Views
    M
    Hi @lasselauch sorry for the late reply, I asked about the developer responsible for it. On Windows we use the WebView control of the last iteration of iexplore MS shipped for 8.1 - Internet Explorer 11 (user-agent ID: "Trident"). It supports >most< things other modern browsers do, but sadly not everything... Especially the JS support has become a problem since IE11 is missing parts of the ECMA 6 standard and needs 'polyfills' to emulate those. Many JS frameworks / libraries don't offer IE11 compatibility and instead rely on the developer to add those polyfills themselves. One of the improvements IE11 received back then was the developer console+tools so the user could use those to track > down the JS issues and resolve them." I also forwarded your request about the ability to disable Javascript, but so far nothing planned atm, so the only workaround I see is either fix your javascript framework (maybe a huge task) or you can disable your javascript based on the user agent and if it's an IE11. Hope this help, Cheers, Maxime.
  • Remove a GeDialog Tab Group

    Cinema 4D SDK python
    3
    0 Votes
    3 Posts
    797 Views
    ?
    @m_adam I'm good with using Python this way. Thanks Maxime.
  • TreeView Menu

    Cinema 4D SDK python
    6
    1
    0 Votes
    6 Posts
    2k Views
    ferdinandF
    Hi, without further feedback, we will consider this thread as solved by Wednesday and flag it accordingly. Cheers, Ferdinand
  • RDATA_PATH not working with Render Settings

    Cinema 4D SDK r23 python
    3
    1
    0 Votes
    3 Posts
    498 Views
    M
    Hi @blastframe as demonstrated in tokensystem_render_r17.py you should always operate on the BaseContainer. Cheers, Maxime.