Pymel / Python Coding

Author: admin

3delight geo attributes

# create geo attribute string $dga_node = DGA_create(); DGA_visibilityTransmissionCreateAttr($dga_node); DGA_visibleToCameraCreateAttr($dga_node); DGA_geometryCurves($dga_node); setAttr ($dga_node + “.visibilityTransmission”) 0; //opaque string $sl[] = ls -sl -l; DL_setObjectAttrib($dga_node, “delightGeoAttribs”, $sl); # change property of existing geo attribute string $dga_node = “delightGeoAttribs2”; setAttr ($dga_node + “.visibilityTransmission”) 1; //opaque For creating mask set per selection:

Processing to Maya

Set up command ports in Maya First thing is to open a port in maya this enables a processing sketch to communicate in real time back to maya. The port numbers need to match up with those used in the sketch.

Example of sending mouse position from processing sketch to sphere in maya…

Triple Shading Switch for per object shading

I wanted to render using the maya hardware renderer (very quick). For this to work colors need to be visible in the viewer. Triple Shading Switch in Maya is equivalent to Renderman per object primitive variable shading that I’ve used on other projects. Scroll down for alternative 3delight/Renderman version with pros and cons.    …

Dictionaries, Pickle and Python

### data sample from country-capitals.csv United Arab Emirates,Abu Dhabi,24.4666666667,54.366667,AE,Asia Nigeria,Abuja,9.0833333333,7.533333,NG,Africa Parse a .csv file and create a Dictionary.

Dump Dictionary Data out to Pickle File

Import Pickle File and Do Something with Dictionary Data

Normalized Values

Sometimes its helpful to have a data range scaled into another range aka normalised. I’ve used this for things like having numbers scale into a color ramp that works in the 0-1 range

In this example I needed to set minutes to fit into a 0-10 range and the inputVal is minutes