User Tools

Site Tools


Samples

Several sample scripts are provided below to illustrate some of the most common methods of extending Daz Studio and to help get you started developing your own scripts. These samples are provided for use under the CC Attribution 3.0 Unported license. All works derived from these samples must adhere to the terms of the license.

Each script in the samples section provides a linked title above the body of the script. Clicking this title will prompt you to choose a location and a file name to save the sample to. The saved file will include a copyright/license statement and the URL for the page that the sample came from near the top.

General

Timing

String Manipulation

  • Sanitize File Path - Demonstrates how to use Regular Expression to strip illegal characters from a file path.

General Interface

  • Simple Input Dialog - Displays an input widget within a simple dialog that has the standard button layout found throughout the application, and reacts according to whether the user accepts or cancels.
  • Simple Image Dialog - Displays an image within a standard dialog.
  • widget_test - Tests various aspects of the various widget types.
  • Display Document - Dynamically locates a document in a mapped content directory and then prompts the OS to perform its default handling of the file.
  • Copy UI from Channel - Copies the interface of another channel (i.e., General Release, Public Build, Publishing Build, Private Build, Dev Build) to the channel of the executing build.

Specific Interface

  • Environment Backdrop Dialog - Causes the Environment pane to be shown; if docked or shown the pane is shown in place, otherwise the pane is shown in a non-modal dialog.

Education/Assistance

  • Guide Pages - An overview of the concept behind Guide Pages, and the folder/files used to implement the concept.
  • Tip Pages - An overview of the concept behind Tip Pages, and the folder/files used to implement the concept.
  • Lesson Strips - An overview of the concept behind the Lesson Strips, and the folder/files used to implement the concept.
  • Interactive Lessons - An overview of the Interactive Lesson concept.

Metadata

Stores

  • Add Store Id - Adds a StoreId to the database so that metadata that defines a product associated with that StoreId can be imported and ultimately show up within the database driven content views.
  • Remove Store Id - Removes a StoreId from the database.
  • Store Info - Lists information about the StoreIds in the database.

Products

Assets

File Input/Output

Save Filters

  • savefilter_settings - Allows you to inspect the script accessible settings of each save filter.

Support Assets

Importers

  • Importer Settings - Allows you to inspect the script accessible settings of each importer.
  • Silent OBJ Import - Imports a Wavefront Object (*.obj), without displaying the importer settings dialog.
  • Silent FBX Import - Imports an Autodesk FBX file, without displaying the importer settings dialog.
  • import_obj_morph_loader_silent - Uses the Wavefront Object (*.obj) importer to provide options for loading a directory full of morph targets and control the Morph Loader Pro plugin without displaying the its option dialog.

Exporters

  • Exporter Settings - Allows you to inspect the script accessible settings of each exporter.
  • Silent OBJ Export - Exports a Wavefront Object (*.obj), without displaying the exporter settings dialog.
  • Silent FBX Export - Exports an Autodesk FBX file, without displaying the exporter settings dialog.
  • Export TriAx to Poser - Exports a TriAx Weight Mapped figure (e.g., Genesis) to Poser 9 and/or Pro 2012, without displaying the settings dialog for the Poser Character (*.cr2) exporter or the Wavefront Object (*.obj) exporter.

Conversion

  • DSA Converter - Converts ascii scripts (*.dsa) to their binary (*.dsb) or encrypted (*.dse) counterpart.

Listing

Directory Mapping

  • Save Mapped Paths - Produces another script that will clear any currently mapped content directories and subsequently set the mapped content directories to those that were mapped at the time the script was saved.
  • Install Manager Config (from DAZ Studio) - Parses information from an .ini file, converts it into a JSON object, provides a dialog that allows a user to select options that modify the data, and then converts the data back into its original form as it writes it back to the .ini file.
  • Install Manager Config (to DAZ Studio) - Parses information from an .ini file, converts it into a JSON object, provides a dialog that allows a user to select options for importing the data, and then modify the application settings to incorporate the data.

Actions

Elements

  • post_load_file_data_item - Stores data on an element and causes a file to be loaded after that element has been loaded.
  • Post-Load Script Data Item - Stores data on an element and causes a script to be executed after that element has been loaded, with the additional option of configuring how that script runs using stored settings.

Nodes

  • Create Instance - Creates an Instance of the primary selected object in the scene.
  • Create Instance Group - Creates an Instance Group of the primary selected Instance in the scene and any Instance siblings with the same target and mode.
  • Create Geometry Shell - Creates a Geometry Shell of the primary selected object in the scene and sets the offset distance of the Push Modifier that is automatically added.
  • Convert Figure to Props - Converts a complete figure into a collection of props, without any exporting/importing.
  • Node FaceGroup Map - Reveals the face group on a mesh that is associated with a given node; used to provide node selection in the viewport using the geometry for the object.
  • adjust_rigging_to_shape - Adjusts the positions of a figure's bones based on the difference between the default shape and the current shape.

Materials

  • Deep Copy - Performs a “deep copy” of one material to another.
  • Select by Tag - Selects materials that have a particular tag.

Properties

  • Node Properties - Allows you to access all properties associated with a given node.
  • Node Property Presentations - Allows you to change colors used by all properties associated with a given node.
  • Node Property Sliders - Dynamically creates sliders for specific properties associated with a given node.
  • erc_freeze - 'Freezes' (links) the current state of numeric properties on a node (or multiple nodes) to a controller property.

Geometry

  • Geometry Info - Prints geometry information for the selected node.
  • generate_cube - Generates a geometric cube, demonstrating use of the geometry pipeline.
  • generate_cylinder - Generates a geometric cylinder, demonstrating use of the geometry pipeline.
  • generate_cone - Generates a geometric cone, demonstrating use of the geometry pipeline.
  • Generate Sphere - Generates a geometric sphere, demonstrating use of the geometry pipeline.
  • generate_torus - Generates a geometric torus, demonstrating use of the geometry pipeline.
  • Generate Plane - Generates a geometric plane, demonstrating use of the geometry pipeline.

Images

Core Functionality

Tools

  • calculator - The source for a calculator, written completely using DAZ Script' intrinsic types.

Utilities

  • Version Conversion - Converts a Daz Studio version string into its 32 and 64 bit hexadecimal and decimal values.

Custom Shaders

Presets

Material Definitions

Shader Definitions

  • constant_shader_definition - The source for a shader definition script, a support file required by the Material Definition sample linked above, that builds the properties accessible to users, in the UI, via the Surface tab.
  • example_shader_definition - The source for an example shader definition script, showing property creation for passing tokens to the shader and alternatively for use in setting attributes via the rendertime script(s).

Shaders

  • constant_surface_shader - The RenderMan Shading Language (RSL) source for the standard RenderMan Constant Surface Shader.

Render-Time

  • default_rendertime_script - The source for a render time script, a support file required by the sample linked above, that sets object attributes.

Rendering

General

  • Render Settings - Find Property - Allows you to retrieve a property displayed in the Render Settings pane, for the active renderer, using its name so that you can then modify its value.

Scripted Renderer

Remote Operation

  • Sub Script - Remotely executes another script, passing in predefined arguments to control the operation of the target script.
  • Figure Metrics - No Dialog - Remotely executes the Figure Metrics script, included as part of the Measure Metrics product, by passing in predefined arguments to control the operation of the script without displaying its dialog.