🏡 spPaint3d resurrection

sppaint3d ui

Table of Contents

Description

spPaint3d is an object placement tool, very similar to geometryPaint from Maya. At this time, this is not a "scatter" tool as it does not contain any flood-like feature. It is entirely raycast based, so it doesn't expect any UVs from the target surfaces in order to properly place object. However, it doesn't allow for any kind of follicle-like functionality.

See Features for more details.

place mode demo paint mode demo

How-to Install

First and foremost, the packaged files will need to be unpacked and copied somewhere. However, this somewhere should not really matter that much. Maya offers some nice ways to run scripts from different locations without too much trouble setting it up. This version of the script is intended to be used as a module, and a few things must be done in order for this module to be recognized and usable by Maya.

Downloadable link can be found here: https://sppaint3d.helikoid.com

Maya has some documentation about using modules. This information is located on Autodesk's website: Distributing Maya plugins - Using Modules. It's essentially 3 different moving parts:

As with anything in Maya, there are multiple ways to deploy modules... Here are the most common scenarios:

  1. Insert here some custom deployment method. In this case, you most probably already know how to manipulate such module files; feel free to ignore everything in this paragraph ;)
  2. Copying the script files in one location but copying the module definition file elsewhere. This scenario requires updating the content of the module file to point at the location where the rest of the scripts are stored. This particular installation scenario is automated with the provided drag and drop installer script.
  3. Copying both the script files & the module definition file in the same location. In this case, you should in theory only need to verify this location is visible by the MAYA_MODULE_PATH environment variable. This installation scenario is rendered easier for the Windows users by using the provided install environment batch file.

Drag and Drop installation scenario

installer script

When dragging and then dropping this installation script inside the Maya viewport, it will setup the various things needed for the script to run properly. Specifically, it will automatically copy the module definition file to one of the default locations and make the appropriate modifications to it. In theory, there is nothing else to do afterwards, the script should be functional. The rest of this paragraph is unnecessary!

If however a fully manual installation is preferred, please look below for an example on how to edit the module file to change its content appropriately.

Manually editing the module file

module definition file

Shown below is the original version of the module file. It should work "as-is" if the folder where the module is copied is added to the Maya's module path environment variable (see below).

Note: In the scenario described here, both the module definition file and the rest of the script files and folders are located alongside in the same folder!

+ sppaint3d 2022.0 .

PYTHONPATH +:= scripts

In case the module file is moved elsewhere than where the packaged files were copied, then it must be edited as shown below as an example. The path where the actual package files are located must be added in place of the original value.

Note 1: The example below shows a windows-like path.

Note 2: This folder path can also be a relative path if that's more convenient (and possible).

Note 3: The location where this module file is located must either be one of the default location, or added to that MAYA_MODULE_PATH environment variable!

+ sppaint3d 2022.0 C:/some_folder/some_sub_folder/sppaint3d

PYTHONPATH +:= scripts

Updating the MAYA_MODULE_PATH environment variable

This installation guide will not go in depth about how to edit manually environment variable. If that's something your use-case requires, plenty of information is already available on the internet, such as Maya's own help regarding environment variables

However, this version of the script should include a batch file named 'install_environment.bat' which should append the folder where this batch file is located to the MAYA_MODULE_PATH environment variable. It should be as simple as copying both the module definition file with this batch file together, then executing this batch file to expose this location to Maya module system.

setup environment batch file

Note: This batch file only works on Windows! Also, it might require to be run as administrator (from its right-click menu)

run as adminstrator

Features

History

I've written this tool mainly because I could not find a decent enough way to use the standard geometryPaint script for my particular workflow. I couldn't do what I needed to with its inherent limitations (both from the surface UVs and the grid). However, if the limited features of the original geometryPaint script was not a hindrance to you, then there's little chance you'll find this script useful.

I come from a 3DS Max background, a very long time ago... I was a heavy user of the awesome AdvancedPainter script for years, I used it a lot in my daily workflow. Then, I had to use Maya, and I became increasingly frustrated that I couldn't find a decent object placement script with a similar workflow in Maya. So it's no big surprise the script from Herman Saksono (and the one from Neil Blevins to some extent) was a major inspiration while working on this Maya version.

Hopefully this script will be useful to others than myself. Feel free to send me some email if you happen to use it and like it (or not).

Maya 2011 Note: Qt changed a lot of stuff, and without too much surprise a lot of things are currently broken (vanilla 2011 pre-service pack). A few features are sort of broken because of this, place mode is the most affected, but things should work, kind of.

Maya 2022 Note: From this release onward, Maya uses python 3 as the default (soon only) python version. There's a good chance that the subsequent versions (if any) will remain python 2 compliant only for minor updates.

Thanks to Julien Lefebvre and Gabriel Charest for helping me debug all this. Thanks to Rick Gilliland for his help regarding Python & Maya API and for pointing me in the right direction following Maya 2011 crash extravaganza. Finally, thanks to all those who attempted to reach out to me throughout the years, during which this script took on a life of its own... And my apologies to all those I have yet to send a reply to.

Limitations

How-to Use

How-to run the script:

Type the following commands in the script editor:

import sppaint3d.gui as sppaint3d_gui

sppaint3d_gui.spPaint3dWin()

Creating a shelf icon

Once the commands above have been typed in the script editor (This needs to be in a python tab!), follow the steps below:

  1. Select the 2 lines containing the above commands
  2. Drag the highlighted selection and drop it in the desired shelf
  3. Select the Python option in the new popup dialog being shown:

save_to_shelf

Tool configuration

script_setup

Options are accessed from the Options button from the main UI window. For now, there is very little options, but hopefully this window will grow with time. Also, for now, it is not necessary to run the setup, the script will assume default behavior if options are not set.

Brush Geometry - Source Objects

geometry_source

This is where the script will look at for duplicating geometry on the paint surfaces (ie: the brush geometry). The script only let polygon objects and locators be added to the list. The source objects can be anywhere in the DAG hierarchy as long as this hierarchy is kept relatively simple. Also, they can be anywhere in the world. Make sure to add all the objects you need in this list before starting painting. The script is not very permitting at this time regarding weird DAG hierarchies and won't allow objects with ambiguous DAG path to be added to this list.

Note: If source objects are buried in a hierarchy, any parent node with non-frozen transform will most probably cause the generated objects to be misplaced. This is a known issues.

Transform Setup

transform_setup

This is where the user can setup the various random factors the script will use for each instance it will create.

The uniform scale option should be self-explanatory (when this option is On, settings from X will be used for Y and Z).

Distribution Objects

distribution_objects

This is the list of the objects the script will paint onto (ie: the landscape). The script only allow for polygon objects to be inserted in this list.

Paint

paint

Paint Options

paint_options

This is where lies some late options for generating the new objects.