-
-
Save Evilsine/181156262078428996d4d71b9f149d60 to your computer and use it in GitHub Desktop.
import c4d | |
doc: c4d.documents.BaseDocument # The currently active document. | |
op: c4d.BaseObject | None # The primary selected object in `doc`. Can be `None`. | |
def allEqual(iterator): | |
iterator = iter(iterator) | |
try: | |
first = next(iterator) | |
except StopIteration: | |
return True | |
return all(first == x for x in iterator) | |
def main() -> None: | |
doc.StartUndo() | |
sel = doc.GetActiveObjects(0) | |
for obj in sel: | |
tracks = obj.GetCTracks() | |
for track in tracks: | |
curve = track.GetCurve() | |
keyCount = curve.GetKeyCount() | |
keys = [] | |
for key in range(keyCount): | |
keys.append(curve.GetKey(key).GetValue()) | |
if allEqual(keys) == True: | |
doc.AddUndo(c4d.UNDOTYPE_DELETE, track) | |
track.Remove() | |
doc.EndUndo() | |
c4d.EventAdd() | |
if __name__ == '__main__': | |
main() |
not working :( , any tips?
which version of c4d are you on? and does it output any error in the python console when you run the script?
not working :( , any tips?
which version of c4d are you on? and does it output any error in the python console when you run the script?
I use c4d 2023, in the python console it does not run :(
not working :( , any tips?
which version of c4d are you on? and does it output any error in the python console when you run the script?
I use c4d 2023, in the python console it does not run :(
I tested the script in 2023.2.2 and it's working fine for me. just to make sure you're using the script correctly, can you download the script as a .py file, put it into your user script folder and run it under the user script section in the extensions menu?
not working :( , any tips?
which version of c4d are you on? and does it output any error in the python console when you run the script?
I use c4d 2023, in the python console it does not run :(
I tested the script in 2023.2.2 and it's working fine for me. just to make sure you're using the script correctly, can you download the script as a .py file, put it into your user script folder and run it under the user script section in the extensions menu?
perfect, I have version 2023.1.3 and I will try with 2023.2.2.
thank you very much!
not working :( , any tips?