Daz studio scripting for beginners
dshortt04
Posts: 8
Hi All,
I am starting to look at scripting (from the very beginning) for a university project. I was wondering if anyone knows of beginner tutorials that might show how to add a character to a scene, add an environment, maybe add clothes to a character/figure. Just basic stuff to help me start to get an understanding of the basic syntax and how to write/read the scripts. Anything I have looked at so far assumes the reader knows at certain amount. Anything would be helpful thank you.
Comments
Have you looked at the samples? http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/start
Hi there, Yes I am looking through that material but am yet to come across something that I either can make sense of or use. I was hoping for something more like a tutorial as in step 1, step 2 etc. Although I do feel with more of an understanding the sample section will be more helpful. Thank you for replying.
Winterbrose channel in youtube
@GiGi_7 Thanks - a helpful link.
nowadays you just ask GPT to do it just if it doesn't get something right you just paste a sample That's close to what you want from the link he gave you at the top and GPT knows this stuff it will just do it might take a few tries..
A difference between Open Source and Closed Source that I would not have dreamed about just a year ago:
"Write a DAZScript function to return the vertices of the primary selection."
"Write a Blender Python function to return the vertices of the active object."
In Blender, you can use its Python API to access and manipulate scene elements, including the active object and its vertices. Here's a Python function that will return the vertices of the active object in Blender:
python
import bpy def get_active_object_vertices(): active_obj = bpy.context.active_object if active_obj is None: return "No active object selected." if active_obj.type != 'MESH': return "The active object is not a mesh." # Ensure the object is in object mode so that we can access its data bpy.ops.object.mode_set(mode='OBJECT') vertices = [] for vertex in active_obj.data.vertices: vertices.append(vertex.co) return vertices # Example usage: vertices = get_active_object_vertices() if isinstance(vertices, list): print("Vertices of the active object are:", vertices) else: print(vertices)
This function checks if there's an active object and if it's a mesh. If both conditions are met, it will go through the object's vertices and append them to a list, which it then returns.
Feel free to modify the function as you see fit or integrate it into a larger script or add-on to enhance your Blender workflow. Given your aspirations in 3D animation, mastering the Blender Python API could be invaluable.
Just one more reason to prefer Open Source in all things.
As with any AI, the source of the training data is open to question. Did it avoid the Daz Sample sripts that existed at the time, or the scripts some of us had posted to the forums? I would be very surprised if its above sample is respecting the license terms of the Blender Python scripts it was trained on. Of couse we don't yet know the legallity of this usage - the suits going through the courts have yet to reach even an initial verdict - but i very much doubt that ChatGPT are respecting the intent or spirit of the open source licenses even if they are eventually deemed not to be in formal, legal breach.
The whole point of the GPL is to guarantee and perpetuate its users' right to examine, understand, modify, improve, and redistribute for any purpose. RMS was quite clear on that: It isn't free if someone can tell you what you can do with it. People often forget the great phrase "Free as in speech, not free as in beer".
And, as I pointed out in the previous post, GPL is not the only form of open source license. In any event, this is not a licensing thread, it is a thread about learning to script, so there is no need for further discussion.