Using AI to develop DAZ Script
Hi all,
Because I haven't seen any mention, I thought I'd share my experiences. I've had excellent results with Clause Sonnet 3.5 as well as ChatGPT 4o (which is still supposed to be better at code genreation that o1 apparently?).
While Claude pointed out that it doesn't know much about DAZ Script, telling it to write Qt Script from 4.8.7 worked without error, unlike trying any version of ECMAScript or JavaScript.
The trick to getting code that runs is describing the DAZ Script API to it, so that it knows how to make certain calls. I just told it a few class names, methods, and parameters, and documented it in the way that DAZ should have, and it just works.
I did not write a single line of the code I posted elsewhere to generate JSON describing the visibility of Geoshells. It took me longer to get over the encroaching feeling of guilt than it did to perfect both the generation of a data model to represent all the visibilty and then to dump it as JSON. Claude didn't get it perfect on the first try only because my explanation of the data model I wanted was wrong.
In retrospect, I should have just described what I wanted end to end, and let it come up with the data model too... it's so hard to realize that I, as a carbon based organism, can't be trusted to do any part of this anymore, at least for relatively straightforward tasks like this. That's scary but exhilarating at the same time.
Comments
I asked both Sonnet 3 and ChatGPT 4o:
"write me code using daz3d scripting API that populates a dzListView with 3 items"
Sonnet 3 gave me almost flawless script, while ChatGPT 4o gave me useless code I couldn't use. Apparently, ChatGPT likes making up functions or methods that don't exist, just to satisfy the goal of answering my question. The end task of AI is to answer your question, and it always seems to find a way to do that, even if the answer is not entirely correct.
Yes, Claude certainly seems to be better than ChatGPT 4o, in my experience as well, as it is reputed to. I got better results in both by specifying Qt Script.
It'd be awesome if we had community-driven documentation of the scripting API for the purposes of code generation with AI.
After telling it about a few functions, e.g. DzGeometryShellNode.findMaterialGroupVisibilityControl(), DzGeometryShellNode.findFacetGroupVisibilityControl() that I learned about from Omniflux, ChatGPT got it right, as well.
Which means you used the Daz documentation, so it is subject to the EULA - "Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution 3.0 Unported" Make sure you adhere to its license terms.
How on earth did you come to that conclusion?
It's almost as if you don't know that QObject supports introspection and will tell you things that its authors didn't think you needed to know and didn't document. Nor that just knowing a method's name is just about all the information you would get from the documentation anyway.
When I release the next version, I'll challenge you to find any derivative DAZ code for which attribution is due. You won't find any.
But so that I cannot even be accused of impropriety of any type, I am going to segregate the const QString that holds the script, apply the license, and let everyone who sees it wonder in what way, shape, or form this is a derivative work that required attribution.
I never did before, but I am really starting to ask myself why I am doing this.
I ama ware that it is possible to get the method/object names - but I was not aware that one could get the parameter names (other than by use information from the docs).
I read your post as saying you had given it the input variable names.
Two compliance officers were at my company's (one of the Big 5 Aerospace contractors) New Year's party. As I suspected, your idea about how copyright works is your own invention. The converstation shifted back to more fun, entertaining things when I couldn't answer one of them asking what copyrighted work I had derived my code from, because it is original code. She said unequivocably that writing original code from a published API has never invoked copyright, even if I had used the docs (which I didn't), and that's been upheld by court rulings many, many times. The most notable case is the microcode for x86 compatible processors developed from the published databooks that described the ISA, which are copyrighted by Intel.
A fairly obvious outcome, as otherwise every DAZ Script ever written would invoke the copyright.
But the actually interesting thing that I learned was that, because I used an LLM, I can't copyright the code, either. So I still have to segregate it, and not apply my own copyright as I do for the rest of the codebase.
Which wasn't the concern - the concern was that you trained/guided the AI using the copyright docs, not that you wreote your own code after studying them but without copying them (copying sections of code is not exempt, and does require abiding by the license).
For the last time, I did not use the docs AT ALL. I gave it my own impressions based on my own research and the advice of others. I was fairly explicit about that, and I even suggested continuing the effort that worked so well in the form of community driven documentation. I don't know how you could still come to the conclusion that I used DAZ docs, after all of that. Can we end this now?
I have to add that reverse engineering - using methods to find members of an object - is against the EULA, and that using undocumented features caries a high risk of future breakage, as has been cautioned on numerous other occasions. The information, undocumented stuff aside, is availble and has samples available to show its use under a very light license - but that does have some requirements, principally proper attribution, and does set limits on the license terms that the user of the docs can impose on their end-users.
It usually takes days to get a reply from Compliance, but in this case it is taking minutes. People from that office that I don't know and who I didn't even ask are now chiming in.
The most prevalent argument is that a metaobject system that makes introspection possible as part of its intended use fails the legal test for reverse engineering.
The second most prevalent is that as another part of the legal test for reverse engineering, there must have been a reasonable effort to conceal the inner workings, i.e. not explicitly providing the means to observe the behavior, as DAZ Script does.
The third is that reverse engineering generally applies to binary compiled code, a bias that I clearly see in section 5 of the EULA.
The fourth is that even if I had read the public documentation and produced a program from what I had learned, it would not even be a copyright issue at all, already affirmed in case law (whatever that is).
Why do you keep bringing up the same irrelevant point? You cannot still not understand that I didn't use any of the samples. Other than the two calls not part of the SDK but were described in the release notes, the DAZ Script API was analogous to the SDK and easy to guess.
I should really get back to work, but I admit that I am looking forward to your next assertion.
Another late straggler from Compliance:
Reverse engineering must also be an attempt to subvert security or understand implementation details, and method signatures are not part of implementation details, something already affirmed in Case Law (and I now know that Case Law just means there's already a written legal opinion on it).
They go home a 3pm PST if you'd like to get in another round.
I didn't - I pointed to both sources of published information - docs and, for cocmpleteness, samples - which have the same license.
Since we don't know what information the people you are quoting have been given it isn't really posible to reply to those statements.
Regardless, you have made public statements encouraging an approach to script writing and I need to make sure that any onlookers are aware that your interpretation of the situation is not the only one posted so that they can consider their courses of action.
Your interpretation of reverse engineering is quite interesting.
There has to be at least an act of disassembly to be accused of reverse engineering, and calling a method definitely does not disassemble bytes into source code. It's like accusing someone of using Notepad to read a text file as reverse engineering.
Since I am legitimately trying to do the right thing and gave them all the info she asked for, instead of just that info which would encourage favorable advice, I am willing to put my faith in the, albeit free, legal advice from the Compliance department of a Fortune 100 company.
@Seven193
It's nice to see common sense beginning to shine through. I didn't know the legal definition nor that there even was one, until literally this morning. I was just reasonably sure that I wasn't doing it :)
Something interesting and related that she said was to compare it to the DMCA; remember that one? In order for it to protect your copyright, there must be in place an effort to protect it, even if it is as obvious and ineffective as rot13 encoding. Anything but making it trivial for people to observe the data (like QObject does) would have been sufficient to invoke the DMCA. You perfectly paraphrased the advice I got; you can't accuse people of reverse engineering if all it took was Notepad, or in my case, are offered explicit facilities to observe the data.
Ifd lawyerly advice was definitive and unarguable we wouldn't need courts. All I can do is pass on the information/view I have been given to ensure that people reading this thread are aware that the offered technique is not seen as legitimate by Daz.
I literally read the FBX exporter plugin file with notepad years ago when they broke it to find the error and help another user without the previous copy since one cannot redistribute it, and got accused of that by Richard Haseltine
(I know nothing of coding but could see they cut off a sentence that was in the previous version which broke it)
it was eventually fixed next builld
now they are handling it out like candy on GiHub
I've had great results creating Daz Scripts with ChatGPT and Claude AI.
To help the AI, I'll copy code from the Daz Documentation Center and tell it to find the solution based on the code provided. That fixes most issues and the code becomes error free. I've already created scripts that allow me to do cropped animation renderings, viewport renderings per frames specified, or viewport renderings every 4th frame.
To get the viewport renderings to work a specific frame range I provided ChatGPT the code in this link below:
http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/rendering/render_to_viewport/start
It is the FBX Importer that is on GitHub, not the exporter, I beleive.
Which seems a fairly clearly a breach of the EULA, if you distribute it, since it is a mechanical derivative of the original script (you din't look at the script and learn from it, then write your own code by typing it out). As far as I am aware AI is not transformative - AI output is not protected by copyright, and cannot erase an existing copyright on an input.
As I have noted before, complying with the CC 3.0 license is not onerous. It needs to be remembered that the samples are supplied not by someone working on the clock for daz but as a voluntary act of support in free time - if the mild license terms are not abided by, as is all too often the case (not just in the context of AI as discussed here) then that volunteer may well reach the point of feeling the game is not worth the candle, and we will all lose.
Hi Richard,
Thanks for the info. I appreciate all your posts that I have seen over the years. Daz 3D has really grown on me. I recently started looking at the animation features. I have animated before in 3dsmax but more on a hobby level and sporadically. I also worked with Javascript and CSS styling in the past on a few projects so I am familiar with modifying code to achieve results I am after.
I think the animation features of Daz is underated. Many people complain online about how limited it is. But I think a lot can be accomplished AS-IS via the built-in features and scripts. The timeline works great for me. I like the keyframe approach and have used it before in 3dsmax. I bought iClone a few years ago and it has been sitting collecting dust. It may be great for animation but Daz completely outshines when it comes to creating characters and scenes - at least for me. So I decided I'd better figure out animation in Daz since I will probably not do that in iClone. But we'll see.
Regarding the scripts I created with the help of ChatGPT - I see that as no different than using a calculator, hammer, paint brush, measuring tape or whatever. It's just a tool. In the end I had to direct the AI tool to give me what I wanted. If those scripts were available it would have been great. I ended up spending about 2 days to get it working. I had to troubleshoot via the Script IDE pane and went through many, many error troubleshootings with ChatGPT mostly but also Claude. Your documentation is available to the public online and samples are given to illustrate how to use the code. When I realized that the AI had trouble getting the code 100% working I provided the documentation that is publicly available. I also posted the scripts to help others here on this forum.
I spent the time to make it happen, and the code allows me to achieve what has not been achievable - to my knowledge.
For example, there were numerous posts where Daz users asked if there was a way to do a spot render of an animation image .png sequence. This is not currently possible via the program interface or any existing scripts that I know of - I looked. I was able to create a script with the help of the AI tools so I could do spot renders of an animation. I can specify the size and location of the region, and where the image sequence files should be saved. It could be a big timesaver for people that have to render animation corrections. I posted the code in that animation frames thread and you have posted in it as well. Please feel free to review the code to see if there is any issue with it being shared. It's for informational purposes only and to help other Daz users. Feel free to remove it. I just tried to help and dedicated my time (2 days) to make those scripts and posts and contribute since I have utilized the help others have provided here and elsewhere and thought I'd return the favor.
I have started using ChatGPT now to help me learn how to use Daz and troubleshoot problems with my characters.
Here is one example it provided on how to make a prop conform to the shape of a figure in an animation:
Solution 2: Convert the Prop to a Conforming Item
If you're still having issues with deformation, consider converting the prop into a conforming item. This will allow it to follow the body’s deformations much more naturally.
Use the Transfer Utility:
Fit the Prop to G8F:
Test the Deformation:
^^^^^^^^^^
This is an extremely clear and detailed guide that gets to the point and is very helpful.
The issue isn't the script per se - but it is using the code samples, so it should follow the requirement of the CC 3 license (though admitedly it would be impossible to give a precise breakdown of the changes made - I would suggest adding a link to the samples you used and explain how you used them). This isn't about stopping people from using the docs and samples, it's a matter of asking that the terms be respected; unfortunately this has become a serious concern as a lot of people don't, even in cases where there is no AI input to cloud the perception of what may be due.