-
-
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?
![image](https://private-user-images.githubusercontent.com/13325407/303186305-00c0be9a-6bef-4d04-a064-d5e1b46456b5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkwNTE3MDQsIm5iZiI6MTcxOTA1MTQwNCwicGF0aCI6Ii8xMzMyNTQwNy8zMDMxODYzMDUtMDBjMGJlOWEtNmJlZi00ZDA0LWEwNjQtZDVlMWI0NjQ1NmI1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIyVDEwMTY0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA4Y2YyN2Q3ZTBkYmMxNzYwNDBkZGY5MTVkNzRmMDFiMjY0MzYxYzIxYjRhNTI5Mzk1MTBlNmI2ZDExNGExZDYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.xvg6hxysifb-RS60_lfbmELmQbSyZSzvTe4u7CJ9DMs)
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?