Skip to content

Commit

Permalink
Merge pull request #626 from autodesk-forks/adsk_contrib/soft_range_a…
Browse files Browse the repository at this point in the history
…nd_step

Added UISoftMin, UISoftMax, and UIStep attributes
  • Loading branch information
JGamache-autodesk authored Oct 16, 2019
2 parents b8a2434 + c7d7ad5 commit 94100ed
Show file tree
Hide file tree
Showing 13 changed files with 172 additions and 99 deletions.
24 changes: 12 additions & 12 deletions libraries/bxdf/standard_surface.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
doc="Color tint on the specular reflection." />
<input name="specular_roughness" type="float" value="0.2" uimin="0.0" uimax="1.0" uiname="Specular Roughness" uifolder="Specular"
doc="The roughness of the specular reflection. Lower numbers produce sharper reflections, higher numbers produce blurrier reflections." />
<input name="specular_IOR" type="float" value="1.5" uimin="0.0" uimax="3.0" uiname="Index of Refraction" uifolder="Specular"
<input name="specular_IOR" type="float" value="1.5" uimin="0.0" uisoftmax="3.0" uiname="Index of Refraction" uifolder="Specular"
doc="Index of refraction for specular reflection." />
<input name="specular_anisotropy" type="float" value="0" uimin="0.0" uimax="1.0" uiname="Specular Anisotropy" uifolder="Specular" uiadvanced="true"
doc="The directional bias of reflected and transmitted light resulting in materials appearing rougher or glossier in certain directions." />
Expand All @@ -29,23 +29,23 @@
doc="Transmission of light through the surface for materials such as glass or water. The greater the value the more transparent the material." />
<input name="transmission_color" type="color3" value="1, 1, 1" uimin="0,0,0" uimax="1,1,1" uiname="Transmission Color" uifolder="Transmission" uiadvanced="true"
doc="Color tint on the transmitted light." />
<input name="transmission_depth" type="float" value="0" uimin="0.0" uimax="100.0" uiname="Transmission Depth" uifolder="Transmission" uiadvanced="true"
<input name="transmission_depth" type="float" value="0" uimin="0.0" uisoftmax="100.0" uiname="Transmission Depth" uifolder="Transmission" uiadvanced="true"
doc="Specifies the distance light travels inside the material before its becomes exactly the transmission color according to Beer's law." />
<input name="transmission_scatter" type="color3" value="0, 0, 0" uimin="0,0,0" uimax="1,1,1" uiname="Transmission Scatter" uifolder="Transmission" uiadvanced="true"
doc="Scattering coefficient of the interior medium. Suitable for a large body of liquid or one that is fairly thick, such as an ocean, honey, ice, or frosted glass." />
<input name="transmission_scatter_anisotropy" type="float" value="0" uimin="0.0" uimax="1.0" uiname="Transmission Anisotropy" uifolder="Transmission" uiadvanced="true"
doc="The amount of directional bias, or anisotropy, of the scattering." />
<input name="transmission_dispersion" type="float" value="0" uimin="0.0" uimax="100.0" uiname="Transmission Dispersion" uifolder="Transmission" uiadvanced="true"
<input name="transmission_dispersion" type="float" value="0" uimin="0.0" uisoftmax="100.0" uiname="Transmission Dispersion" uifolder="Transmission" uiadvanced="true"
doc="Dispersion amount, describing how much the index of refraction varies across wavelengths." />
<input name="transmission_extra_roughness" type="float" value="0" uimin="0.0" uimax="1.0" uiname="Transmission Roughness" uifolder="Transmission" uiadvanced="true"
<input name="transmission_extra_roughness" type="float" value="0" uimin="-1.0" uisoftmin="0.0" uimax="1.0" uiname="Transmission Roughness" uifolder="Transmission" uiadvanced="true"
doc="Additional roughness on top of specular roughness. Positive values blur refractions more than reflections, and negative values blur refractions less." />
<input name="subsurface" type="float" value="0" uimin="0.0" uimax="1.0" uiname="Subsurface" uifolder="Subsurface" uiadvanced="true"
doc="The blend between diffuse reflection and subsurface scattering. A value of 1.0 indicates full subsurface scattering and a value 0 for diffuse reflection only." />
<input name="subsurface_color" type="color3" value="1, 1, 1" uimin="0,0,0" uimax="1,1,1" uiname="Subsurface Color" uifolder="Subsurface" uiadvanced="true"
doc="The color of the subsurface scattering effect." />
<input name="subsurface_radius" type="color3" value="1, 1, 1" uimin="0,0,0" uimax="1,1,1" uiname="Subsurface Radius" uifolder="Subsurface" uiadvanced="true"
doc="The mean free path. The distance which light can travel before being scattered inside the surface." />
<input name="subsurface_scale" type="float" value="1" uimin="0.0" uimax="10.0" uiname="Subsurface Scale" uifolder="Subsurface" uiadvanced="true"
<input name="subsurface_scale" type="float" value="1" uimin="0.0" uisoftmax="10.0" uiname="Subsurface Scale" uifolder="Subsurface" uiadvanced="true"
doc="Scalar weight for the subsurface radius value." />
<input name="subsurface_anisotropy" type="float" value="0" uimin="0.0" uimax="1.0" uiname="Subsurface Anisotropy" uifolder="Subsurface" uiadvanced="true"
doc="The direction of subsurface scattering. 0 scatters light evenly, positive values scatter forward and negative values scatter backward." />
Expand All @@ -65,19 +65,19 @@
doc="The amount of directional bias, or anisotropy, of the clear-coat layer." />
<input name="coat_rotation" type="float" value="0.0" uimin="0.0" uimax="1.0" uiname="Coat Rotation" uifolder="Coat" uiadvanced="true"
doc="The rotation of the anisotropic effect of the clear-coat layer." />
<input name="coat_IOR" type="float" value="1.5" uimin="0.0" uimax="3.0" uiname="Coat Index of Refraction" uifolder="Coat"
<input name="coat_IOR" type="float" value="1.5" uimin="0.0" uisoftmax="3.0" uiname="Coat Index of Refraction" uifolder="Coat"
doc="The index of refraction of the clear-coat layer." />
<input name="coat_normal" type="vector3" defaultgeomprop="Nworld" uimin="0,0,0" uimax="1,1,1" uiname="Coat normal" uifolder="Coat"
<input name="coat_normal" type="vector3" defaultgeomprop="Nworld" uiname="Coat normal" uifolder="Coat"
doc="Input normal for clear-coat layer" />
<input name="coat_affect_color" type="float" value="0" uimin="0,0,0" uimax="1,1,1" uiname="Coat Affect Color" uifolder="Coat" uiadvanced="true"
<input name="coat_affect_color" type="float" value="0" uimin="0" uimax="1" uiname="Coat Affect Color" uifolder="Coat" uiadvanced="true"
doc="Controls the saturation of diffuse reflection and subsurface scattering below the clear-coat." />
<input name="coat_affect_roughness" type="float" value="0" uiname="Coat Affect Roughness" uifolder="Coat" uiadvanced="true"
<input name="coat_affect_roughness" type="float" value="0" uimin="0" uimax="1" uiname="Coat Affect Roughness" uifolder="Coat" uiadvanced="true"
doc="Controls the roughness of the specular reflection in the layers below the clear-coat." />
<input name="thin_film_thickness" type="float" value="0" uimin="0.0" uimax="2000.0" uiname="Thin Film Thickness" uifolder="Thin Film" uiadvanced="true"
<input name="thin_film_thickness" type="float" value="0" uimin="0.0" uisoftmax="2000.0" uiname="Thin Film Thickness" uifolder="Thin Film" uiadvanced="true"
doc="The thickness of the thin film layer on a surface. Use for materials such as multitone car paint or soap bubbles." />
<input name="thin_film_IOR" type="float" value="1.5" uimin="0.0" uimax="3.0" uiname="Thin Film Index of Refraction" uifolder="Thin Film" uiadvanced="true"
<input name="thin_film_IOR" type="float" value="1.5" uimin="0.0" uisoftmax="3.0" uiname="Thin Film Index of Refraction" uifolder="Thin Film" uiadvanced="true"
doc="The index of refraction of the medium surrounding the material." />
<input name="emission" type="float" value="0" uimin="0.0" uimax="1.0" uiname="Emission" uifolder="Emission"
<input name="emission" type="float" value="0" uimin="0.0" uisoftmax="1.0" uiname="Emission" uifolder="Emission"
doc="The amount of emitted incandescent light." />
<input name="emission_color" type="color3" value="1, 1, 1" uimin="0,0,0" uimax="1,1,1" uiname="Emission Color" uifolder="Emission"
doc="The color of the emitted light." />
Expand Down
60 changes: 38 additions & 22 deletions python/Scripts/mxdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,26 @@ def usage():
print 'Usage: mxdoc.py <file.mtlx> [<outputfile.md>]'
print '- Default output file name is "nodedef_documentation.md"'

HEADERS = ('Name', 'Type', 'Default Value',
'UI min', 'UI max',
'UI Soft Min', 'UI Soft Max',
'UI step', 'UI group',
'Description', 'UI Advanced',
'Connectable')

ATTR_NAMES = ('uimin', 'uimax',
'uisoftmin', 'uisoftmax',
'uistep', 'uifolder',
'doc', 'uiadvanced')

def main():
if len(sys.argv) < 2:
usage()
sys.exit(0)

outfilename = 'nodedef_documentation.md'
if len(sys.argv) > 2:
outfilename = sys.argv[2]
outfilename = sys.argv[2]

filename = sys.argv[1]

Expand All @@ -43,30 +55,34 @@ def main():
for nd in nodedefs:
file.write('- *Nodedef*: %s\n' % nd.getName())
file.write('- *Type*: %s\n' % nd.getType())
file.write('- *Doc*: %s\n' % nd.getAttribute('doc'))
file.write('| Name | Type | Default Value | UI min | UI max | UI group | Description | UI Advanced | Connectable |\n')
file.write('| ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |\n')
file.write('- *Doc*: %s\n\n' % nd.getAttribute('doc'))
file.write('| ' + ' | '.join(HEADERS) + ' |\n')
file.write('|' + ' ---- |' * len(HEADERS) + '\n')
for inp in nd.getInputs():
name = inp.getName()
type = inp.getType();
value = inp.getValue()
uimin = inp.getAttribute('uimin')
uimax = inp.getAttribute('uimax')
uifolder = inp.getAttribute('uifolder')
docattr = inp.getAttribute('doc')
adv = inp.getAttribute('uiadvanced')
buf = '| %s | %s | %s | %s | %s | %s | %s | %s | %s |\n' % (name, type, value, uimin, uimax, uifolder, docattr, adv, "true")
infos = []
infos.append(inp.getName())
infos.append(inp.getType())
val = inp.getValue()
if infos[1] == "float":
val = round(val, 6)
infos.append(str(val))
for attrname in ATTR_NAMES:
infos.append(inp.getAttribute(attrname))
infos.append("true")
buf = '| ' + " | ".join(infos) + ' |\n'
file.write(buf)
for p in nd.getParameters():
name = p.getName()
type = p.getType();
value = inp.getValue()
uimin = p.getAttribute('uimin')
uimax = p.getAttribute('uimax')
uifolder = p.getAttribute('uifolder')
docattr = p.getAttribute('doc')
adv = inp.getAttribute('uiadvanced')
buf = '| %s | %s | %s | %s | %s | %s | %s | %s | %s |\n' % (name, type, value, uimin, uimax, uifolder, docattr, adv, "false")
infos = []
infos.append(p.getName())
infos.append(p.getType())
val = p.getValue()
if infos[1] == "float":
val = round(val, 6)
infos.append(str(val))
for attrname in ATTR_NAMES:
infos.append(p.getAttribute(attrname))
infos.append("false")
buf = '| ' + " | ".join(infos) + ' |\n'
file.write(buf)

file.close()
Expand Down
48 changes: 0 additions & 48 deletions python/Scripts/nodedef_documentation.md

This file was deleted.

Loading

0 comments on commit 94100ed

Please sign in to comment.