Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ToonzScript API documentation #187

Open
Kristianfriis opened this issue Jan 8, 2024 · 7 comments
Open

ToonzScript API documentation #187

Kristianfriis opened this issue Jan 8, 2024 · 7 comments

Comments

@Kristianfriis
Copy link

Ask a question related to OpenToonz

Hi there,
Just a quick question about the documentation for scripting in Opentoonz.

Is the list of classes and methods complete? The reason I ask is, I obtained some documentation for ToonzScript in Toonz, which has a lot more API's one could tap into.

I have an idea for a tool that might help me when using Opentoonz, but it only looks to be possible according to the Toonz scripting API documentation and not OpenToonz.

Of course I understand that the API might not be the same, but was just curious :)

@RodneyBaker
Copy link
Collaborator

Hi @Kristianfriis
Most of the ToonzScript documentation (for Toonz) works the same as with Opentoonz although that is quite limited.
Perhaps you gained access to some additional documentation that isn't historically or publicly availalable but I suspect it's the same information that has made its way into Opentoonz documentation.

Some of the scripts appears to work... some do not.
It isn't entirely clear (to me) why although some of that might just be my poor lack of understanding.

If you can share some of the script you have in mind we can certainly look into it and where the script engine might be broken perhaps that can even be fixed.

Opentoonz has gained a few scripting capbilities the older Toonz implementation didn't have such as some command line interfacings/options. Most of my attempts to use those however did not succeed.

Others who have delved more deeply into that area of the code should be able to answer your question with better detail but I want to let you know the generalized answer which is that the scripting should largely be the same for Toonz and Opentoonz... although very limited in scope.

I'm looking for a good excuse to investigate Toonz scripting again so please do share your thoughts on how you hope to move forward. The more interest there is in scripting the more likely we'll see improvement.

@Kristianfriis
Copy link
Author

Kristianfriis commented Jan 8, 2024

Hi @RodneyBaker

Okay, I have done some trial runs, but nothing extensive yet.
Since it is a little bit touch and go, whether it works or not, I will simply try and build the script that I think will help me.

I have never touched C++ , so I am hoping I can accomplish what I want through scripting.

I will share it as soon as I have something ready'ish 😃

@RodneyBaker
Copy link
Collaborator

RodneyBaker commented Jan 17, 2024

I should have said more about this as I have always been intereseted in toonzscript and from time to time discover new things about it. I also easily forget what I've learned!

Some time back I ran across this gem that uses python to create scripts/assist Opentoonz:

https://github.com/kogaki/toonzscript_music/tree/master

All this to suggest that the use of python... and even AI approaches... may be a great way to plus up Opentoonz scripting.

Please do share any and all you discover as we may yet get scripting going more fully yet.

Credit and thanks to: keisuke ogaki (@kogaki)

@RodneyBaker
Copy link
Collaborator

RodneyBaker commented Jan 18, 2024

@Kristianfriis
If you type "for (x in this.Scene) print(x);" into the Script console you get a long list of recognized terms/words which I must assume come from Qt's scripting environment. Please see attached for the terms I get in the output.

There are about 1150 words.

In my estimation this does not suggest all can be used in scripting... or does it.

RecognizedWords.txt

@RodneyBaker
Copy link
Collaborator

RodneyBaker commented Jan 18, 2024

I'm currently having problems running any script in Opentoonz so I need to investigate.

Update: I had forgotten that OT only recognizes/runs scripts from the stuff/library/scripts directory of which there is none by default... although there are script directories automatically created in other places. Scripts stored there must be copied into a scripts directory in the library.

Still not able to fully run scripts unfortunately.

Update: Not sure what was going on but scripting is running just fine now.
Very strange that it wasn't.

@RodneyBaker
Copy link
Collaborator

RodneyBaker commented Jul 9, 2024

Here of late I have found the regular Opentoonz documenation to have some really good information on toonzscript.
Much of it I had read before but the information never sank in.
Lately however it has started to make a lot more sense.

Here's a link to that: https://opentoonz.readthedocs.io/en/latest/toonzscript.html?

The link to original scripts on the toonz site probably won't work but it can be pulled up using the wayback machine at archive.org.

@Kristianfriis I'm not sure how your research into toonzscript has been going but I'm curious.

@RodneyBaker
Copy link
Collaborator

RodneyBaker commented Aug 6, 2024

Transferring this discussion to OT-docs

@RodneyBaker RodneyBaker transferred this issue from opentoonz/opentoonz Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants