@ferdinand Thank you for this; it makes things much clearer. I am very grateful we have the forum to clarify these issues.
Posts made by blastframe
RE: CCurve.FindPrevUnmuted & CCurve.FindNextUnmuted
RE: Updating F-Curves in Timeline on EditSlider Drag
You should use
Hi Manuel, that was simple, thank you very much! That's a bit confusing though because I'm changing an F-Curve. What's
Updating F-Curves in Timeline on EditSlider Drag
I have a script that updates the keyframe at the current time's value while dragging an EditSlider. Is it possible to also update the keyframe in the Timeline while dragging? Currently the associated object updates in the Viewport using c4d.DrawViews but the keyframe in the F-Curve Timeline only updates on release of the EditSlider's handle. Here is the code I'm using to redraw:
c4d.DrawViews(c4d.DRAWFLAGS_NO_THREAD | c4d.DRAWFLAGS_FORCEFULLREDRAW) c4d.GeSyncMessage(c4d.EVMSG_FCURVECHANGE) c4d.EventAdd(c4d.EVENT_ANIMATE)
CCurve.FindPrevUnmuted & CCurve.FindNextUnmuted
I am trying to use CCurve.FindPrevUnmuted & CCurve.FindNextUnmuted. In this example based on @m_magalhaes
CreateKeydemo, I'm passing the middle key's index to these respective methods. Both return the middle key which is unexpected. Based on the documentation, FindPrevUnmuted should return the previous unmuted key and FindNextUnmuted should return the next unmuted key using the index parameter as the starting index. Am I using this incorrectly or is something else going wrong? Thank you!
import c4d def CreateKey(curve, time, value, interpolation): keyDict = curve.AddKey(time) if keyDict is None: raise MemoryError("Failed to create a key") key = keyDict["key"] keyIndex = keyDict["nidx"] key.SetValue(curve, value) curve.SetKeyDefault(doc, keyIndex) key.SetInterpolation(curve, interpolation) return key, keyIndex def main(): obj = c4d.BaseObject(c4d.Ocube) trackY = c4d.CTrack(obj, c4d.DescID(c4d.DescLevel(c4d.ID_BASEOBJECT_POSITION, c4d.DTYPE_VECTOR, 0), c4d.DescLevel(c4d.VECTOR_Y, c4d.DTYPE_REAL, 0))) curveY = trackY.GetCurve() keyA, keyAIndex = CreateKey(curveY, c4d.BaseTime(0), value=0, interpolation=c4d.CINTERPOLATION_SPLINE) keyBTime = c4d.BaseTime(10, doc.GetFps()) keyB, keyBIndex = CreateKey(curveY, keyBTime, value=100, interpolation=c4d.CINTERPOLATION_SPLINE) bt = c4d.BaseTime(5, doc.GetFps()) keyDict = curveY.AddKeyAdaptTangent(bt, True, True) # -------------- # prevKey = curveY.FindPrevUnmuted(keyDict["nidx"]) nextKey = curveY.FindNextUnmuted(keyDict["nidx"]) print("prevKey index:",prevKey,", prevKey value:",prevKey.GetValue()) #returns keyDict's values print("nextKey index:",nextKey,", nextKey value:",nextKey.GetValue()) #returns keyDict's values # -------------- # obj.InsertTrackSorted(trackY) doc.InsertObject(obj) c4d.EventAdd() if __name__ == '__main__': main()
RE: Creating a Keyframe similar to Ctrl-Clicking the Curve
@ferdinand That was exactly what I was seeking, thank you, Ferdinand!
Creating a Keyframe similar to Ctrl-Clicking the Curve
When in the Timeline, if I hold Ctrl/Cmd and click on the curve, Cinema 4D adds a keyframe that matches the contour of the curve perfectly.
The tangents of the new key and neighboring keys are properly weighted.
When I try to do this with the code below, I get a keyframe whose angles do not match the curve and where the Left & Right times of the neighboring keys are not adjusted.
keyDict = keyCurve.AddKey(keyTime) keyIndex = keyDict["nidx"] key = keyDict["key"] key.SetValue(keyCurve,value) key[c4d.ID_CKEY_PRESET] = c4d.ID_CKEY_PRESET_NEWAUTOWEIGHTED
The tangents of the key seem to be weighted properly using
ID_CKEY_PRESET_NEWAUTOWEIGHTED, but how can I get the angle of the tangents to match the curve and the Left & Right Time of the neighboring keys to adjust so the curve's contour doesn't change as in the Ctrl-Click key creation scenario?
Description & Example in Documentation for CCurve.AddKey
I wanted to report an error in the documentation for CCurve.AddKey. It currently describes it as Find a writable key by time. which is the same description as CCurve.FindKey. The code example also seems to be for CCurve.FindKey as it does not use the
addedvariable in the example, but the
RE: Request: Combobox Icons
@zipit Thank you for the reply. That is exactly what I was I was seeking.
I think the documentation for GeDialog.AddChild should explain this ampersand operation as it would be impossible for a developer to know otherwise from just the documentation. It just says:
child (str) – Name of the item to add.
iconidsyntax is mentioned in the UserData Properties so the inconsistency is confusing:
I have added the tag you requested.
Request: Combobox Icons
Unless I'm missing something, it seems like Comboboxes/Integer Cycle dropdowns have the option for icons everywhere they appear except in GeDialog. I'd like to request that you add this icon option to the GeDialog please as they are very informative & quickly scannable to the user, particularly with long lists.