UNSOLVED update error?

I was trying to include the login data inside the spline handlers but I had updating errors, I thought it was due to hierarchy but I ended up using python tags and still I had the same error, I don't know what's happening.


Hello @jh23,

Thank you for reaching out to us. Unfortunately, your question is not clear to us. I would in general recommend having a look at our Forum Guidelines: Structure of a Question section.

Interpreting your script:

I am not quite sure what constitutes 'login data' and 'spline handlers' in the sentence 'I was trying to include the login data inside the spline handlers' ? Are you talking about the initialization arguments passed to the Init method of c4d.utils.SplineLengthData? Your whole question is also missing a description of what you want to achieve and the always essential executable code listing.

Reading the rest of the script, I assume you are trying to write the 'Depth' fields of the IK-Spline Tag with the length of the spline divided by your magic number 3.783. Since IK-Spline tag instances have dynamic descriptions, you can add and remove handles, the IDs 10004 and 10014 will not work for every tag (but do work for this one of yours). So, for me your script is doing what it is intended to do, it sets both 'Depth' fields to 5.193206487661137; although I cannot make much of what the meaning of that is due to lack of context.

So, for more support, I would have to ask you to explain what you want to achieve, specifically in contrast to what is not working for you now.


I apologize, the translator does not help much, as I said, I created a spline chain, where the depth of its handles depends on the length of the spline, my problem was that when I did it with only xpresso, it showed errors when rotating, because it took time update.


thinking that the error was either hierarchy, the spline node, or how to order the xpresso I did the same thing but with a python tag, despite this the same problem was present.

import c4d
#Welcome to the world of Python
def main():
     spline = op[c4d.ID_USERDATA,2] # spline object
     length = c4d.utils.SplineLengthData(spline)
     Long = length.GetLength()
     op[c4d.ID_USERDATA,1][10004] = Long /3.783
     #[10004] = control depth 1 iKsplinetag
     op[c4d.ID_USERDATA,1][10014] = Long /3.783
     #[10014] = control depth 2 iKsplinetag

And speaking of the number "3,783" I used it only for my purpose as it corrected the strength of the depth of the controls

Hello @jh23,

Thank you for your update. I will take a look next week, as I won't have the time tomorrow, Friday.


Any kind of help is appreciated.

Hello @jh23,

My apologies, I forgot your thread in the 2023.1 release hectic, I will have a look next thing tomorrow morning.


Hello @jh23,

@jh23 said in update error?:

my problem was that when I did it with only xpresso, it showed errors when rotating, because it took time update.


My apologies for the delay, but I am still not 100% sure if I understand you correctly. But after looking at your scene and the screen cast, my understanding is that you are fighting here with priority issues. I.e.:

  1. You select a IK-spline controller.
  2. You press down the left mouse button and rotate the controller.
  3. The IK-spline tag, and the IK-system is doing its work.
  4. The IK model and the viewport update.
  5. You stop rotating.
  6. The Python tag kicks in.
  7. The IK model and the viewport update again.

And you want to get rid of the second update to have a more convenient editing experience.

First of all, R20 is far out of scope of SDK and general user support. I do not even have an R20 license here. The general issue remains with all later versions of Cinema 4D but is less severe than with your screencast of R20. The core issues are here:

  1. How the IK-spline updates, this not an SDK issue and seems to have been improved with R21 as I can reproduce the shading errors you have.
  2. The IK evaluation and the Python tag execution priority.

Here is a R21 screencast, the updating-twice issue is quite subtle compared to your screen cast. I do not get the shading errors you get beyond 90°. When I rotate far enough, and the mesh starts to self-intersect, I will get them too. But this issue won't 'settle', i.e., won't change after the second update. prio_ik_snapping.gif

  1. The main issue is a priority issue plus the quantization of the rotation you enabled, causing it to be very visible that things are updated twice.
  2. You can enable "Frame Dependent" in the Python tag to mitigate the issue.
  3. Calling EventAdd() in your script is not necessary, the expression being called is already an event.


The file: python_spline_ik.c4d
The result: ik_frame_dep.gif
The code:

import c4d

# The inverse of your magic number
MAGIC_NUMBER = 1. / 3.783

def main():
    # Bail when there is no tag linked and when the tag is not of type Tcaikspline
    tag = op[c4d.ID_USERDATA, 1]
    if not isinstance(tag, c4d.BaseTag) or not tag.CheckType(1019862):
        raise RuntimeError("Linked object is not an IK-Tag.")

    # Get the spline used by the IK tag.
    spline = tag[c4d.ID_CA_IKSPLINE_TAG_SPLINE]
    if not isinstance(spline, c4d.SplineObject):
        raise RuntimeError("Linked object in IK-Tag is not a spline object.")

    # Do your magic number calculation.
    helper = c4d.utils.SplineLengthData(spline)
    newDepth = helper.GetLength() * MAGIC_NUMBER

    # Update the two 'Depth' parameters.
    for cid in (10004, 10014):
        tag[cid] = newDepth