Examples

Browse the code examples and fragments of the SDK.

Code Examples

Code examples cover a complete task or workflow and are bound to a subject area. Only few code examples exist but they are usually longer and more complex than code fragments.

Name

Description

Example hello_world

Demonstrates how to write a basic script to create an editable cube in the center of the canvas and sets up the view.

Gui

Example gui_notebar

Demonstrates how to show a progress indicator with a message when running a long task.

Example gui_notes

Demonstrates how to build and run a modal dialog (a note).

Example gui_palette

Demonstrates how to build and run a non-modal dialog (a pallette).

Example gui_zscript_port

Provides an example for a very literal port of a ZScript script to Python.

Modeling

Example mod_curve_lightning

Demonstrates how to construct curves in a tool.

Example mod_subtool_array

Demonstrates how to construct an array of sub tools within a tool.

Example mod_subtool_export

Demonstrates how to batch export all sub-tools in a ZBrush file to OBJ format.

Example lib_zb_math

Contains a basic math library used by some of the modeling examples.

System

Example sys_timeline_camera

Demonstrates how to create a turntable animation for the current tool in ZBrush.

Example sys_timeline_colors

Demonstrates how to add and delete keyframes in the timeline of ZBrush.

Code Fragments

Code fragments demonstrate a specific API feature such as a class or function in a brief manner. They are not as comprehensive as full code examples but much more numerous. Fragments are also directly embedded into the entities they cover in the API Index; and it is therefore often easier to browse the API to explore them.

Name

Description

Fragment zbrush.commands.add_button

Code fragment for zbrush.commands.add_button.

Fragment zbrush.commands.add_curve_point

Code fragment for zbrush.commands.add_curve_point.

Fragment zbrush.commands.add_new_curve

Code fragment for zbrush.commands.add_new_curve.

Fragment zbrush.commands.add_note_button

Code fragment for zbrush.commands.add_note_button.

Fragment zbrush.commands.add_note_switch

Code fragment for zbrush.commands.add_note_switch.

Fragment zbrush.commands.add_palette

Code fragment for zbrush.commands.add_palette.

Fragment zbrush.commands.add_slider

Code fragment for zbrush.commands.add_slider.

Fragment zbrush.commands.add_subpalette

Code fragment for zbrush.commands.add_subpalette.

Fragment zbrush.commands.add_switch

Code fragment for zbrush.commands.add_switch.

Fragment zbrush.commands.add_zsphere

Code fragment for zbrush.commands.add_zsphere.

Fragment zbrush.commands.ask_filename

Code fragment for zbrush.commands.ask_filename.

Fragment zbrush.commands.ask_string

Code fragment for zbrush.commands.ask_string.

Fragment zbrush.commands.canvas_click

Code fragment for zbrush.commands.canvas_click.

Fragment zbrush.commands.canvas_stroke

Code fragment for zbrush.commands.canvas_stroke.

Fragment zbrush.commands.canvas_strokes

Code fragment for zbrush.commands.canvas_strokes.

Fragment zbrush.commands.click

Code fragment for zbrush.commands.click.

Fragment zbrush.commands.close

Code fragment for zbrush.commands.close.

Fragment zbrush.commands.config

Code fragment for zbrush.commands.config.

Fragment zbrush.commands.create_displacement_map

Code fragment for zbrush.commands.create_displacement_map.

Fragment zbrush.commands.create_mesh_from_curves

Code fragment for zbrush.commands.create_mesh_from_curves.

Fragment zbrush.commands.create_normal_map

Code fragment for zbrush.commands.create_normal_map.

Fragment zbrush.commands.curves_to_ui

Code fragment for zbrush.commands.curves_to_ui.

Fragment zbrush.commands.delete_curves

Code fragment for zbrush.commands.delete_curves.

Fragment zbrush.commands.delete_interface_item

Code fragment for zbrush.commands.delete_interface_item.

Fragment zbrush.commands.delete_keyframe

Code fragment for zbrush.commands.delete_keyframe.

Fragment zbrush.commands.delete_zsphere

Code fragment for zbrush.commands.delete_zsphere.

Fragment zbrush.commands.edit_zsphere

Code fragment for zbrush.commands.edit_zsphere.

Fragment zbrush.commands.exists

Code fragment for zbrush.commands.exists.

Fragment zbrush.commands.freeze

Code fragment for zbrush.commands.freeze.

Fragment zbrush.commands.get

Code fragment for zbrush.commands.get.

Fragment zbrush.commands.get_active_subtool_index

Code fragment for zbrush.commands.get_active_subtool_index.

Fragment zbrush.commands.get_active_tool_index

Code fragment for zbrush.commands.get_active_tool_index.

Fragment zbrush.commands.get_active_tool_path

Code fragment for zbrush.commands.get_active_tool_path.

Fragment zbrush.commands.get_active_track_index

Code fragment for zbrush.commands.get_active_track_index.

Fragment zbrush.commands.get_canvas_pan

Code fragment for zbrush.commands.get_canvas_pan.

Fragment zbrush.commands.get_canvas_zoom

Code fragment for zbrush.commands.get_canvas_zoom.

Fragment zbrush.commands.get_flags

Code fragment for zbrush.commands.get_flags.

Fragment zbrush.commands.get_from_note

Code fragment for zbrush.commands.get_from_note.

Fragment zbrush.commands.get_height

Code fragment for zbrush.commands.get_height.

Fragment zbrush.commands.get_hotkey

Code fragment for zbrush.commands.get_hotkey.

Fragment zbrush.commands.get_id

Code fragment for zbrush.commands.get_id.

Fragment zbrush.commands.get_info

Code fragment for zbrush.commands.get_info.

Fragment zbrush.commands.get_keyframe_time

Code fragment for zbrush.commands.get_keyframe_time.

Fragment zbrush.commands.get_keyframes_count

Code fragment for zbrush.commands.get_keyframes_count.

Fragment zbrush.commands.get_last_stroke

Code fragment for zbrush.commands.get_last_stroke.

Fragment zbrush.commands.get_last_typed_filename

Code fragment for zbrush.commands.get_last_typed_filename.

Fragment zbrush.commands.get_last_used_filename

Code fragment for zbrush.commands.get_last_used_filename.

Fragment zbrush.commands.get_left_mouse_button_state

Code fragment for zbrush.commands.get_left_mouse_button_state.

Fragment zbrush.commands.get_max

Code fragment for zbrush.commands.get_max.

Fragment zbrush.commands.get_min

Code fragment for zbrush.commands.get_min.

Fragment zbrush.commands.get_mod

Code fragment for zbrush.commands.get_mod.

Fragment zbrush.commands.get_mouse_pos

Code fragment for zbrush.commands.get_mouse_pos.

Fragment zbrush.commands.get_next_filename

Code fragment for zbrush.commands.get_next_filename.

Fragment zbrush.commands.get_pos

Code fragment for zbrush.commands.get_pos.

Fragment zbrush.commands.get_secondary

Code fragment for zbrush.commands.get_secondary.

Fragment zbrush.commands.get_status

Code fragment for zbrush.commands.get_status.

Fragment zbrush.commands.get_subtool_count

Code fragment for zbrush.commands.get_subtool_count.

Fragment zbrush.commands.get_subtool_folder_index

Code fragment for zbrush.commands.get_subtool_folder_index.

Fragment zbrush.commands.get_subtool_folder_name

Code fragment for zbrush.commands.get_subtool_folder_name.

Fragment zbrush.commands.get_subtool_id

Code fragment for zbrush.commands.get_subtool_id.

Fragment zbrush.commands.get_subtool_status

Code fragment for zbrush.commands.get_subtool_status.

Fragment zbrush.commands.get_timeline_time

Code fragment for zbrush.commands.get_timeline_time.

Fragment zbrush.commands.get_title

Code fragment for zbrush.commands.get_title.

Fragment zbrush.commands.get_tool_count

Code fragment for zbrush.commands.get_tool_count.

Fragment zbrush.commands.get_tool_path

Code fragment for zbrush.commands.get_tool_path.

Fragment zbrush.commands.get_transform

Code fragment for zbrush.commands.get_transform.

Fragment zbrush.commands.get_transpose

Code fragment for zbrush.commands.get_transpose.

Fragment zbrush.commands.get_width

Code fragment for zbrush.commands.get_width.

Fragment zbrush.commands.get_zsphere

Code fragment for zbrush.commands.get_zsphere.

Fragment zbrush.commands.has_next_filename

Code fragment for zbrush.commands.has_next_filename.

Fragment zbrush.commands.hide

Code fragment for zbrush.commands.hide.

Fragment zbrush.commands.is_disabled

Code fragment for zbrush.commands.is_disabled.

Fragment zbrush.commands.is_enabled

Code fragment for zbrush.commands.is_enabled.

Fragment zbrush.commands.is_locked

Code fragment for zbrush.commands.is_locked.

Fragment zbrush.commands.is_unlocked

Code fragment for zbrush.commands.is_unlocked.

Fragment zbrush.commands.load_stroke

Code fragment for zbrush.commands.load_stroke.

Fragment zbrush.commands.load_strokes

Code fragment for zbrush.commands.load_strokes.

Fragment zbrush.commands.locate_subtool

Code fragment for zbrush.commands.locate_subtool.

Fragment zbrush.commands.locate_subtool_by_name

Code fragment for zbrush.commands.locate_subtool_by_name.

Fragment zbrush.commands.lock

Code fragment for zbrush.commands.lock.

Fragment zbrush.commands.maximize

Code fragment for zbrush.commands.maximize.

Fragment zbrush.commands.merge_undo

Code fragment for zbrush.commands.merge_undo.

Fragment zbrush.commands.message_ok

Code fragment for zbrush.commands.message_ok.

Fragment zbrush.commands.message_ok_cancel

Code fragment for zbrush.commands.message_ok_cancel.

Fragment zbrush.commands.message_yes_no

Code fragment for zbrush.commands.message_yes_no.

Fragment zbrush.commands.message_yes_no_cancel

Code fragment for zbrush.commands.message_yes_no_cancel.

Fragment zbrush.commands.minimize

Code fragment for zbrush.commands.minimize.

Fragment zbrush.commands.modify

Code fragment for zbrush.commands.modify.

Fragment zbrush.commands.new_curves

Code fragment for zbrush.commands.new_curves.

Fragment zbrush.commands.new_keyframe

Code fragment for zbrush.commands.new_keyframe.

Fragment zbrush.commands.pixol_pick

Code fragment for zbrush.commands.pixol_pick.

Fragment zbrush.commands.press

Code fragment for zbrush.commands.press.

Fragment zbrush.commands.press_key

Code fragment for zbrush.commands.press_key.

Fragment zbrush.commands.query_mesh3d

Code fragment for zbrush.commands.query_mesh3d.

Fragment zbrush.commands.randomize

Code fragment for zbrush.commands.randomize.

Fragment zbrush.commands.reset

Code fragment for zbrush.commands.reset.

Fragment zbrush.commands.resolve_path

Code fragment for zbrush.commands.resolve_path.

Fragment zbrush.commands.rgb

Code fragment for zbrush.commands.rgb.

Fragment zbrush.commands.select_subtool

Code fragment for zbrush.commands.select_subtool.

Fragment zbrush.commands.select_tool

Code fragment for zbrush.commands.select_tool.

Fragment zbrush.commands.set

Code fragment for zbrush.commands.set.

Fragment zbrush.commands.set_active_track_index

Code fragment for zbrush.commands.set_active_track_index.

Fragment zbrush.commands.set_canvas_pan

Code fragment for zbrush.commands.set_canvas_pan.

Fragment zbrush.commands.set_canvas_zoom

Code fragment for zbrush.commands.set_canvas_zoom.

Fragment zbrush.commands.set_color

Code fragment for zbrush.commands.set_color.

Fragment zbrush.commands.set_hotkey

Code fragment for zbrush.commands.set_hotkey.

Fragment zbrush.commands.set_keyframe_time

Code fragment for zbrush.commands.set_keyframe_time.

Fragment zbrush.commands.set_max

Code fragment for zbrush.commands.set_max.

Fragment zbrush.commands.set_min

Code fragment for zbrush.commands.set_min.

Fragment zbrush.commands.set_mod

Code fragment for zbrush.commands.set_mod.

Fragment zbrush.commands.set_next_filename

Code fragment for zbrush.commands.set_next_filename.

Fragment zbrush.commands.set_status

Code fragment for zbrush.commands.set_status.

Fragment zbrush.commands.set_subtool_status

Code fragment for zbrush.commands.set_subtool_status.

Fragment zbrush.commands.set_timeline_time

Code fragment for zbrush.commands.set_timeline_time.

Fragment zbrush.commands.set_timeline_to_keyframe_time

Code fragment for zbrush.commands.set_timeline_to_keyframe_time.

Fragment zbrush.commands.set_tool_path

Code fragment for zbrush.commands.set_tool_path.

Fragment zbrush.commands.set_transform

Code fragment for zbrush.commands.set_transform.

Fragment zbrush.commands.set_transpose

Code fragment for zbrush.commands.set_transpose.

Fragment zbrush.commands.set_zsphere

Code fragment for zbrush.commands.set_zsphere.

Fragment zbrush.commands.show

Code fragment for zbrush.commands.show.

Fragment zbrush.commands.show_actions

Code fragment for zbrush.commands.show_actions.

Fragment zbrush.commands.show_note

Code fragment for zbrush.commands.show_note.

Fragment zbrush.commands.stroke

Code fragment for zbrush.commands.stroke.

Fragment zbrush.commands.stroke.__init__

Code fragment for zbrush.commands.Stroke.__init__.

Fragment zbrush.commands.system_info

Code fragment for zbrush.commands.system_info.

Fragment zbrush.commands.toggle

Code fragment for zbrush.commands.toggle.

Fragment zbrush.commands.un_press

Code fragment for zbrush.commands.un_press.

Fragment zbrush.commands.unlock

Code fragment for zbrush.commands.unlock.

Fragment zbrush.commands.update

Code fragment for zbrush.commands.update.

Fragment zbrush.commands.zbrush_info

Code fragment for zbrush.commands.zbrush_info.

Fragment zbrush.utils.clear_output

Code fragment for zbrush.utils.clear_output.

Fragment zbrush.utils.run_path

Code fragment for zbrush.utils.run_path.

Fragment zbrush.utils.run_script

Code fragment for zbrush.utils.run_script.

Fragment zbrush.zscript_compatibility.rand

Code fragment for zbrush.zscript_compatibility.rand.

Fragment zbrush.zscript_compatibility.rand_int

Code fragment for zbrush.zscript_compatibility.rand_int.