• MatrixToHPB Negative values

    Cinema 4D SDK python r20
    4
    0 Votes
    4 Posts
    1k Views
    r_giganteR
    Hi @owen, thanks for following up. As @m_adam has already pointed out there's actually no difference in the values defininig a matrix representing a rotation on -30, -390, 330 or 690 on a certain axis. The lifesafer in this case is to use the already mentioned GetOptimalAngle which actually provides you with the HPB vector that would minimize the rotation given the previous HPB and the current HPB. For the sake of completeness let's assume that at frame 0 H = 0 whilst at frame 1 H = -5. Running the following code just returns the "expected" HPB vector def main(): # set the lastHPB to the previous frame value (in this case zero) lastHPB = c4d.Vector(0,0,0) # retrieve the current rotation order rotOrder = op.GetRotationOrder() # convert from matrix to HPB representation currentHPB = c4d.utils.MatrixToHPB(op.GetMg(), rotOrder) # get the optimal HPB vector optimalHPB = c4d.utils.GetOptimalAngle(lastHPB, currentHPB, rotOrder) print optimalHPB Now using this strategy and knowing the HPB of a clone at the previous frame, you are able to obtain a meaningful HPB representing of the matrix describing the rotation at the current frame of a certain clone (or object). Best, Riccardo
  • How to copy (and remove) userdata via python ?

    Cinema 4D SDK r19 python
    8
    0 Votes
    8 Posts
    3k Views
    M
    Seems I also forget to mention but please use About Tags and Tagging like so you can mark a specific version.
  • Using c4dpy to show Class Documentation?

    Cinema 4D SDK
    3
    2
    0 Votes
    3 Posts
    1k Views
    dskeithD
    Hi Maxime - thank you very much for the response, and I'm glad to hear you're considering it for the future.
  • 0 Votes
    3 Posts
    1k Views
    eZioPanE
    Hi, @m_adam Thank you for your kindness and the inspiring answer! It's a GREAT Christmas present for me! So sorry asking XPresso related questions in this forum. The problem I faced is a little bit complex than this: I need sample Effectors' total Output Strengths in the position from a Polygon Object's Points, and store the result into a Vertex Color Map attached for further use. This problem bothers me for months, and I didn't find any clue until your post. I have never think about using Python Node with global variable in XPresso Network can keep the data as I need and do the magic! From the bottom of my heart, I want to say THANK YOU. The answer you give not only solve this problem, but also inspire me re-thinking of ObjectList Node and Python Node, and how these nodes executed in an XPresso Network. Just let me THANK YOU AGAIN! Best wishes for you to have a wonderful holiday!
  • Slow Python in R20 ?

    Cinema 4D SDK r19 r20 python
    4
    0 Votes
    4 Posts
    1k Views
    M
    After a reboot, I'm able to reproduce it again... I will create a bug report and more testing after Season's Greetings & SDK Team Vacation. Anyway thanks a lot. Cheers, Maxime.
  • 0 Votes
    3 Posts
    1k Views
    M
    @m_adam wow! I did what you say,it works!! you are so cool!! thank you very much!!! yeah!!
  • How to get spline offset by spline point index ?

    Cinema 4D SDK python
    13
    0 Votes
    13 Posts
    4k Views
    ferdinandF
    Hi @everyone, as a little disclaimer, this is my private take on this topic. Cinema does calculate the length of a spline (at least with SplineHelp) in a rather unpretentious fashion as the sum of the Euclidean norms of the underlying LineObject segments, i.e., there is no fancy arc-length calculation going on. Which makes sense in Cinema, since the discrete LineObject is what does effectively count, and not the smooth SplineObject. Since you can get access to the LineObject of a SplineObject and also convert between SplineObject and LineObject vertex indices with SplineHelp.SplineToLineIndex() , this also means that you can both calculate the length of spline as a total and up to a specific vertex. Which then should mean that you can calculate the relative offset for a spline vertex yourself. Practically you can cut out the SplineObject altogether when sampling a spline and just use its associated LineObject. The one nice thing that SplineHelp does for you is though, that it implements a parallel transport for the frames of spline points for you. I.e., realizes that the normals of spline points point into a direction humans would consider "correct" (mathematically these normals are not correct, due to them being modified by parallel transport, but they will look smoother, won't flip when then curvature of the spline flips). Cheers, Ferdinand
  • 0 Votes
    5 Posts
    2k Views
    D
    @s_bach i see. thx, nevertheless. well, as said, the only way to avoid that collision seems to be: put the plugins into the plugin-folder of the main application. while discussing the other part of my problem (see symbolcache-topic) on other forums (the german c4dnetwork, that is), it became apparent, that other ppl also do have those collision-messages with r20 - and they, too, do not experience those plugins to be not working. if at any time this "problem" should become of interest for you, let me know, if there's something that i could do/deliver/add any detail, to support you in your efforts. cheers, mesut.
  • 0 Votes
    10 Posts
    2k Views
    DunhouD
    @m_adam Thanks a lot for this example A big shout out !
  • Quit Cinema after SAVE_AFTER message

    Cinema 4D SDK r20 python
    3
    0 Votes
    3 Posts
    815 Views
    B
    Hi @m_adam! Thank you for your response. I looked for a way to mark the post as a question while submitting, I didn't think to look at the submitted post again for that option. I'll remember next time. KillDocument and Exiting were never ment to run consecutively, they were just two things I wanted to try for different scenarios. I should have clarified that. StopAllThreads() unfortunately wasn't enough, but adding in a small message plugin to trigger the exit from the CoreMessage() did the trick. I'm now changing a global boolean for the CoreMessage() to look for. Is that what you had in mind? Thank you for your help, everything works now. I'll make sure and try and find the "mark as solved" button on my way out Edit: I can't actually mark your comment as the solution, only this one...
  • Shortcuts for buttons from gui.GeDialog

    Cinema 4D SDK r20 python
    4
    0 Votes
    4 Posts
    2k Views
    FlavioDinizF
    Thanks a lot @C4DS @m_adam ! So I think it's better to create separate CommandDataplugins to perform the same action of each button, it's less complicated and allow the user to change the keyboard shortcuts and exclude the need of the GUI being always open. Although the m_adam suggestions may be useful for other plugins ideas I have. I'll try it later. Thanksss !
  • Bevel selection after a CSTO

    Cinema 4D SDK python r20
    2
    3
    0 Votes
    2 Posts
    595 Views
    a_blockA
    Hi Pim, no, I don't think so. Basically the Selection tag reacts to MSG_POINTS_CHANGED and MSG_POLYGONS_CHANGED, in the end adding or removing the needed amount of points or polygons in the selection array. But there's no information, what to do with for example additional points. And so it heavily depends on where the new points/polygons are added and also which tool does so, what the outcome for those selected entities will be. Something that will probably be addressed in future with the CustomDataTag introduced in R20. Cheers, Andreas
  • Checknames option

    Cinema 4D SDK python r20
    3
    0 Votes
    3 Posts
    1k Views
    P
    Works great, thanks. -Pim
  • 0 Votes
    2 Posts
    938 Views
    M
    Hi @pyr, In Python, there is a GIL which do not allow Python by design to execute something in parallel. In Cinema 4D all our functions (so everything which is in the c4d python module) is "GIL safe" in order to avoid any issue with Python memory. So in Cinema 4D thread are designed for doing GUI, or background stuff. Moreover, keep in mind creating a Thread have a cost in term of time (to create, execute, delete them). Finally, I would like to point you to multiprocessing vs multi-threading. Note that since it's more an algorithm problem than an issue related to our API, we can only provide you hints. btw, I also turned your topic as a question. See Q&A New Functionality. Cheers, Maxime.
  • Bevel Object Type

    Cinema 4D SDK python r20
    3
    0 Votes
    3 Posts
    856 Views
    P
    Thanks. And yes, I used that value already. -Pim
  • 0 Votes
    3 Posts
    1k Views
    A
    Amazing! Thank you again Andreas!
  • Confusing ToolData content

    Cinema 4D SDK python c++ r19 r20
    20
    1 Votes
    20 Posts
    6k Views
    S
    Congrats on the new forum! it is very informative About time
  • Objectdata and Bevel objects

    Cinema 4D SDK python r20
    6
    2
    0 Votes
    6 Posts
    2k Views
    P
    Hi Riccardo, I am not sure what you mean, but I guess you mean that you define selection tags on one of the children and use that selection on the resulting objectdata object? -Pim
  • Please help - Python script

    Cinema 4D SDK python
    3
    1 Votes
    3 Posts
    1k Views
    a_blockA
    Hi, I'm afraid @Cairyn already contributed everything we could. We need to leave this to the community. Sorry. I have moved this to the General Programming & Plugins Discussions category, as I don't regard it as a very C4D specific question. Please, correct me, if I'm wrong. Cheers, Andreas
  • SetDocumentData options for exporting

    Cinema 4D SDK r20 python
    4
    0 Votes
    4 Posts
    2k Views
    M
    Hi @Rage I guess export_OBJ example on our Github repository is what you are looking for. Note for the moment values of the BaseContainer are not available in the Python Documentation. But you could find them in the C++ documentation about fobjexport2.h. If you have any question please let me know. Cheers, Maxime.