• Need help getting an old script to work in C4D

    Cinema 4D SDK python
    8
    0 Votes
    8 Posts
    1k Views
    ferdinandF
    Hello @bstone, Thank you for reaching out to us and welcome to the Cinema 4D community. And thank you @bentraje for answering the question. We do not have to add anything here, @bentraje already pointed out all the important bits Cheers, ferdinand
  • 0 Votes
    9 Posts
    1k Views
    ferdinandF
    Hello @bentraje, please excuse the delay, but this bug has been fixed in 2023.2, your code from above should work properly now. Cheers, Ferdinand
  • Complete Replica of a Native Objects UI?

    Cinema 4D SDK 2023 python
    7
    1
    0 Votes
    7 Posts
    2k Views
    B
    @iplai @ferdinand Thanks for providing details especially the third party API. Seems like a handy utility library I'll see what I can do with it.
  • IsConnected Method Not Working As Expected?

    Cinema 4D SDK 2023 python
    9
    0 Votes
    9 Posts
    1k Views
    ManuelM
    @bentraje said in IsConnected Method Not Working As Expected?: P.S. Just some minor nitpick, both method does not return the same type. The first returns a list. While the second return an iterator. Not really a problem per se since I can just convert the iterator to a list. Just some FYI in case you are interested. Thanks a lot for reporting that, we will fix this as soon as possible
  • Arrange Selected Node Method?

    Cinema 4D SDK 2023 python
    3
    1
    0 Votes
    3 Posts
    359 Views
    B
    @manuel gotcha. thanks for the confirmation.
  • Get Spline Points Positions from PLA keyframes

    Cinema 4D SDK python
    4
    0 Votes
    4 Posts
    2k Views
    ferdinandF
    Hey @joel, a 'dead' object means that Python tries to reference a node which does not exist in the C++ layer anymore, i.e., has been de- or reallocated. Since my function retrieves the tag on the spot and does not attempt to pass it outside of the function, it seems a bit unlikely that the tag is already dead, at least I am not experiencing any of this. Please provide the scene, code you are running, and the exact stack trace (do not forget to save your script first, so that the trace has the correct line numbers). Otherwise I will not be able to help you. Cheers, Ferdinand
  • Show "Hidden" Points?

    Cinema 4D SDK 2023 python
    3
    1
    0 Votes
    3 Posts
    351 Views
    B
    @Manuel RE: This might happen if you changed Yep yep this is what I'm currently doing. hehe Anyhow, your code works. Thanks!
  • Add Additional Script Path?

    General Talk r25 python
    3
    0 Votes
    3 Posts
    712 Views
    B
    @m_adam Thanks for the response. Modifying the environment varialbles works for my use case. Closing the thread now.
  • Replace "Shape Node"?

    Cinema 4D SDK 2023 python
    4
    0 Votes
    4 Posts
    689 Views
    B
    @ferdinand Thanks for the outlining the limitation. For options Yep the replace command does not carry over the connection so that's a no go. I just went with the python route. Works as expected. Basically, I just deleted all the points of the spline object through the resize object. Then rebuild it again with the reference. No problem so far. RE: scene nodes. Uhm I really find the nodes implementation clunky at the moment and this is coming from a user who uses Houdini. No plans in implementing it at all in my workflow.And the pyro being implemented as a tag and not as a scene nodes set-up tells a lot that they are not confident in that workflow. Too convoluted for what it is trying to achieve and doesn't use "attributes" like what Houdini and Blender can. I find it as a "toy" at the moment rather than an actual production tool. Anyway, will close this thread for now.
  • 0 Votes
    5 Posts
    2k Views
    K
    Hi @ferdinand, Thank you for the detailed explanation and the code. It works perfectly and the problem is solved!
  • Actively Link Hair Guides to a Spline or Alembic?

    Cinema 4D SDK r25 python
    3
    0 Votes
    3 Posts
    794 Views
    B
    Hi @ferdinand Thanks for the response and heads up on the crashes. RE: you want to control hair guide vertices programmatically Yep yep you are right on this part. Basically, have a geometric hair animated and simulated for preview. But rendered on the actual hair object. This is the workflow for other DCC, and the more logical one. This way you separate the hair source and hair generation. It's easier to debug. Anyhow, for looking at your python example, this should get me by on my current use case. Thanks for your illustration as always! Will close thread now.
  • Copy Assets to new Location

    Cinema 4D SDK python
    3
    0 Votes
    3 Posts
    763 Views
    C
    Hi ferdinand, I am very sorry for my lack of reading the Guidelines properly. But still, very huge thanks to you for the explanation anyway. This already helped me. I will try things out and will probably come back here with some code.
  • Asset Browser: Add Watch Folder

    Cinema 4D SDK python
    4
    0 Votes
    4 Posts
    2k Views
    a_blockA
    Thanks, Ferdinand. I'll take a closer look as soon as I find the time.
  • Make Node Callbacks Optional?

    Cinema 4D SDK python
    3
    0 Votes
    3 Posts
    427 Views
    B
    @ferdinand Thanks as always for the explanation. The illustration code works for my use case. Will close now thread
  • C4D 2023 Script Manager Doesn't Update?

    General Talk python
    3
    0 Votes
    3 Posts
    781 Views
    B
    @m_adam Thanks for the confirmation. Will close the thread for now.
  • Node Method IsValid() Throws ValueError

    Cinema 4D SDK python r25
    5
    0 Votes
    5 Posts
    547 Views
    B
    @m_adam Gotcha. Thanks for the heads up!
  • How to Modify the Axis of a Point Object?

    Cinema 4D SDK python
    7
    0 Votes
    7 Posts
    4k Views
    ferdinandF
    Hey @delizade, The script works for anything that is a c4d.PointObject, i.e., editable polygon and spline objects. But not for generators, e.g., the Cube object or the Circle spline, as you cannot edit their points and therefore have no control over the placement of their "axis" in relation to their vertices. When you want to set the transform of any BaseObject, e.g., a PointObject, a generator, or a null object, you must simply set either its local or global matrix. But this will not keep vertices 'in place' as generators and a null object have no vertices one could edit, and the vertices of PointObject instances must be corrected manually to achieve the 'move the axis idea'. But you can of course just set the global or local matrix (a.k.a. transform) of a BaseObject. Find an example below. For more detailled information, I would recommend having a look at the Matrix Manual. Cheers, Ferdinand The result, the two cubes are not at the same location because combining two transforms is not commutative, i.e., the order matters. A * B is not always the same as B * A for matrices: [image: 1669892200687-8392f997-7526-4a6d-b00b-e020d7669c59-image.png] The code: """Demonstrates the basic concept of transformations as realized by Cinema 4D. """ import c4d def main() -> None: """Constructs two transforms and applies them in the global coordinate system to two cube objects. """ # Construct a transform that translates by 500 units on the y-axis and one that rotates by # 45° on the x-axis. move: c4d.Matrix = c4d.utils.MatrixMove(c4d.Vector(0, 500, 0)) rotate: c4d.Matrix = c4d.utils.MatrixRotX(c4d.utils.DegToRad(45)) # Combine both transforms into a singular one by multiplying them. Note that matrix # multiplication, combining transforms, is not commutative. I.e., the order matters opposed # to numbers; move * rotate is not the same as rotate * move. tMoveRotate: c4d.Matrix = move * rotate tRotateMove: c4d.Matrix = rotate * move # Allocate two cube objects. cubeMoveRotate: c4d.BaseObject = c4d.BaseObject(c4d.Ocube) cubeRotateMove: c4d.BaseObject = c4d.BaseObject(c4d.Ocube) if None in (cubeMoveRotate, cubeRotateMove): raise MemoryError("Could not allocate cube object.") # And set their global matrix, i.e., the absolute transform in the global coordinate system. cubeMoveRotate.SetMg(tMoveRotate) cubeRotateMove.SetMg(tRotateMove) # Name both null objects, set their display color, insert them into the active document, and # push an update event. cubeMoveRotate.SetName("Cube: Move -> Rotate") cubeRotateMove.SetName("Cube: Rotate -> Move") cubeMoveRotate[c4d.ID_BASEOBJECT_USECOLOR] = c4d.ID_BASEOBJECT_USECOLOR_ALWAYS cubeRotateMove[c4d.ID_BASEOBJECT_USECOLOR] = c4d.ID_BASEOBJECT_USECOLOR_ALWAYS cubeMoveRotate[c4d.ID_BASEOBJECT_COLOR] = c4d.Vector(1, 0, 0) cubeRotateMove[c4d.ID_BASEOBJECT_COLOR] = c4d.Vector(0, 0, 1) doc.InsertObject(cubeMoveRotate) doc.InsertObject(cubeRotateMove) c4d.EventAdd() if __name__ == '__main__': main()
  • Drag and Drop from GeUserArea in Python

    Cinema 4D SDK python
    3
    0 Votes
    3 Posts
    1k Views
    a_blockA
    Hi Maxime, that's a bummer. Just a few additions: is done by calling HandleMouseDrag. Your code is paused until the drag operation ended Yes, no objection. But it should be said, during this "pause" one does still receive messages, among them BFM_DRAGRECEIVE_START and BFM_DRAGRECEIVE. Just not BFM_DRAGEND. Which makes me think, if only the receiver would not "consume" this message, it could already work... From a pure implementation point of view, it also does make sense since it would make no sense if each drag operation have to support all possible managers I wouldn't want it differently. But I still think, the initiator of an action deserves result information. after all these years, I'm still wondering, what's this obsession with not delivering feedback to a caller. Yes, I'm looking at you CallCommand()... Finally it is not possible to drag objects directly to the viewport I didn't even consider, drag and drop could work differently for materials and objects, or objects not working at all. So, thanks for the info and avoiding even more headache on my end. I guess, we are back to the drawing board then. Anyway, greetings to the team. Cheers, Andreas
  • Custom GUI Linkbox checking for Accepted types?

    Cinema 4D SDK r23 python
    3
    0 Votes
    3 Posts
    1k Views
    CairynC
    @ferdinand Thanks for the reply! Ah, of course, I should have considered that Command is actually the last message I get for that operation. This Message stuff totally got me on the wrong track. Naturally, resetting the link and thereby cancelling and reverting the user's drag or pick operation is not as nice as showing a "stop sign" mouse pointer during the operation. Since the ACCEPT clause in a Resource allows setting accepted types, I wonder why there is no API functionality allowing the same. It's not even in the C++ implementation. I suppose people should use external resources anyway, but seeing stuff in the API makes functionality clearer to me at least. Regarding PyCapsule, no, I didn't happen across that previously, I just took code from some other thread on this forum to get into the message. I was lazy and looked for PyCapsule in the Cinema 4D API doc, and assumed it undocumented when it wasn't found. Totally my fault, I should have checked the web too. Never program in an unfamiliar scope past midnight! Nice code btw.