Skip to content

Commit

Permalink
Add type IDs, NEtemplates, icons for new shaders
Browse files Browse the repository at this point in the history
namely asASCCDL, asBlendNormals, asRaySwitchSurface, asSurfaceLuminance.
  • Loading branch information
luisbarrancos committed Mar 10, 2019
1 parent ba40c33 commit dd1dfc2
Show file tree
Hide file tree
Showing 27 changed files with 1,586 additions and 656 deletions.
Binary file added icons/asAscCdl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/asBlendNormals.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/asColorCorrect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/asInvertColor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/asMatte.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/asRaySwitchSurface.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/asSurfaceLuminance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/asSwitchSurface.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,993 changes: 1,345 additions & 648 deletions icons/mayaseed_icons1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/render_asAscCdl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/render_asBlendNormals.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/render_asColorCorrect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/render_asInvertColor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/render_asMatte.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/render_asRaySwitchSurface.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/render_asSurfaceLuminance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions scripts/appleseedMaya/AETemplates/NEasAscCdlTemplate.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version='1.0' encoding='UTF-8'?>
<templates>
<using package='maya'/>
<template name='NEasAscCdl'>
<attribute name='outColor' type='maya.float3'>
<label>Out Color</label>
</attribute>
<attribute name='color' type='maya.float3'>
<label>Color</label>
</attribute>
<attribute name='slope' type='maya.float'>
<label>Slope</label>
</attribute>
<attribute name='offset' type='maya.float'>
<label>Offset</label>
</attribute>
<attribute name='power' type='maya.float'>
<label>Power</label>
</attribute>
<attribute name='saturation' type='maya.float'>
<label>Saturation</label>
</attribute>
</template>
<view name='NEDefault' template='NEasAscCdl'>
<property name='outColor'/>
<property name='color'/>
<property name='slope'/>
<property name='offset'/>
<property name='power'/>
<property name='saturation'/>
</view>
</templates>
24 changes: 24 additions & 0 deletions scripts/appleseedMaya/AETemplates/NEasBlendNormalsTemplate.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version='1.0' encoding='UTF-8'?>
<templates>
<using package='maya'/>
<template name='NEasBlendNormals'>
<attribute name='outNormal' type='maya.float3'>
<label>Out Normal</label>
</attribute>
<attribute name='normalA' type='maya.float3'>
<label>Normal A</label>
</attribute>
<attribute name='normalB' type='maya.float3'>
<label>Normal B</label>
</attribute>
<attribute name='weight' type='maya.float'>
<label>Weight</label>
</attribute>
</template>
<view name='NEDefault' template='NEasBlendNormals'>
<property name='outNormal'/>
<property name='normalA'/>
<property name='normalB'/>
<property name='weight'/>
</view>
</templates>
44 changes: 44 additions & 0 deletions scripts/appleseedMaya/AETemplates/NEasRaySwitchSurfaceTemplate.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version='1.0' encoding='UTF-8'?>
<templates>
<using package='maya'/>
<template name='NEasRaySwitchSurface'>
<attribute name='outColor' type='maya.float3'>
<label>Out Color</label>
</attribute>
<attribute name='materialCamera' type='maya.float3'>
<label>Material Camera</label>
</attribute>
<attribute name='materialShadow' type='maya.float3'>
<label>Material Shadow</label>
</attribute>
<attribute name='materialTransparency' type='maya.float3'>
<label>Material Transparency</label>
</attribute>
<attribute name='materialDiffuse' type='maya.float3'>
<label>Material Diffuse</label>
</attribute>
<attribute name='materialSpecular' type='maya.float3'>
<label>Material Specular</label>
</attribute>
<attribute name='materialGlossy' type='maya.float3'>
<label>Material Glossy</label>
</attribute>
<attribute name='materialLight' type='maya.float3'>
<label>Material Light</label>
</attribute>
<attribute name='materialSubsurface' type='maya.float3'>
<label>Material Subsurface</label>
</attribute>
</template>
<view name='NEDefault' template='NEasRaySwitchSurface'>
<property name='outColor'/>
<property name='materialCamera'/>
<property name='materialShadow'/>
<property name='materialTransparency'/>
<property name='materialDiffuse'/>
<property name='materialSpecular'/>
<property name='materialGlossy'/>
<property name='materialLight'/>
<property name='materialSubsurface'/>
</view>
</templates>
16 changes: 16 additions & 0 deletions scripts/appleseedMaya/AETemplates/NEasSurfaceLuminanceTemplate.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version='1.0' encoding='UTF-8'?>
<templates>
<using package='maya'/>
<template name='NEasSurfaceLuminance'>
<attribute name='outColor' type='maya.float3'>
<label>Out Color</label>
</attribute>
<attribute name='color' type='maya.float3'>
<label>Color</label>
</attribute>
</template>
<view name='NEDefault' template='NEasSurfaceLuminance'>
<property name='outColor'/>
<property name='color'/>
</view>
</templates>
24 changes: 22 additions & 2 deletions scripts/appleseedMaya/AETemplates/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,20 @@ def buildBody(self, nodeName):
self.beginLayout('appleseed', collapse=1)
self.addControl('asIntensityScale', label='Intensity Scale')
self.addControl('asExposure', label='Exposure')
self.addSeparator()
self.addControl('asNormalize', label='Normalize')
self.addControl('asCastIndirectLight', label='Cast Indirect Light')
self.addSeparator()
self.addControl('asImportanceMultiplier', label='Importance Multiplier')
self.__buildVisibilitySection()
self.endLayout()

elif self.thisNode.type() in {'pointLight', 'spotLight', 'directionalLight'}:
self.beginLayout('appleseed', collapse=1)
self.addControl('asCastIndirectLight', label='Cast Indirect Light')
self.addControl('asImportanceMultiplier', label='Importance Multiplier')
self.endLayout()

elif self.thisNode.type() == 'bump2d':
self.beginLayout('appleseed', collapse=1)
self.addControl('asNormalMapMode', label='Map Mode')
Expand All @@ -105,12 +115,21 @@ def buildBody(self, nodeName):

elif self.thisNode.type() == 'mesh':
self.beginLayout('appleseed', collapse=1)

self.__buildVisibilitySection()

self.beginLayout('Alpha Map', collapse=1)
self.callCustom(
self.meshAlphaMapNew, self.meshAlphaMapUpdate, 'asAlphaMap')
self.addControl('asMediumPriority', label='Medium Priority')
self.addControl('asIsPhotonTarget', label='Photon Target')
self.endLayout()

self.beginLayout('Rendering', collapse=1)
self.addControl('asMediumPriority', label='IOR Medium Priority')
self.addSeparator()
self.addControl('asSubsurfaceSet', label='SSS Set')
self.addSeparator()
self.addControl('asIsPhotonTarget', label='SPPM Photon Target')
self.endLayout()

self.beginLayout('Export', collapse=1)
self.addControl('asExportUVs', label='Export UVs')
Expand All @@ -123,6 +142,7 @@ def buildBody(self, nodeName):
elif self.thisNode.type() == 'shadingEngine':
self.beginLayout('appleseed', collapse=1)
self.addControl('asDoubleSided', label='Double Sided')
self.addSeparator()
self.addControl('asShadingSamples', label='Shading Samples')
self.endLayout()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,21 @@ def buildBody(self, nodeName):
self.beginLayout('Sky Attributes', collapse=0)
self.addControl('sunTheta')
self.addControl('sunPhi')
self.addSeparator()
self.addControl('turbidity')
self.addControl('turbidityScale')
self.addControl('turbidityScale')
self.addSeparator()
self.addControl('luminanceScale')
self.addControl('luminanceGamma')
self.addControl('saturationScale')
self.addSeparator()
self.addControl('horizonShift')
self.addControl('groundAlbedo')
self.endLayout()

self.beginLayout('Sun Attributes', collapse=0)
self.addControl('sunEnable')
self.addSeparator()
self.addControl('sunRadianceScale')
self.addControl('sunSizeScale')
self.endLayout()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ def beginLayout(self, name, collapse=True):
def buildBody(self, nodeName):
self.beginLayout('Map', collapse=0)
self.addControl("map")
self.addSeparator()
self.addControl("intensity")
self.addControl("exposure")
self.addSeparator()
self.addControl("hShift")
self.addControl("vShift")
self.endLayout()
Expand Down
17 changes: 17 additions & 0 deletions src/appleseedmaya/exporters/lightexporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,32 @@ void LightExporter::createEntities(
asr::ColorEntityFactory::create(colorName.asChar(), params, values));
}

auto extraControls = [&](asr::ParamArray& lightParams)
{
bool castIndirectLight = true;
AttributeUtils::get(node(), "asCastIndirectLight", castIndirectLight);
lightParams.insert("cast_indirect_light", castIndirectLight);

float importanceMultiplier = 1.0f;
AttributeUtils::get(node(), "asImportanceMultiplier", importanceMultiplier);
lightParams.insert("importance_multiplier", importanceMultiplier);
};

if (depNodeFn.typeName() == "directionalLight")
{
lightFactory = lightFactories.lookup("directional_light");
lightParams.insert("irradiance", colorName.asChar());
lightParams.insert("irradiance_multiplier", intensity);

extraControls(lightParams);
}
else if (depNodeFn.typeName() == "pointLight")
{
lightFactory = lightFactories.lookup("point_light");
lightParams.insert("intensity", colorName.asChar());
lightParams.insert("intensity_multiplier", intensity);

extraControls(lightParams);
}
else if (depNodeFn.typeName() == "spotLight")
{
Expand All @@ -154,6 +169,8 @@ void LightExporter::createEntities(
AttributeUtils::get(node(), "penumbraAngle", penumbraAngle);
const double outerAngle = coneAngle.asDegrees() + 2.0 * penumbraAngle.asDegrees();
lightParams.insert("outer_angle", outerAngle);

extraControls(lightParams);
}
else
{
Expand Down
6 changes: 3 additions & 3 deletions src/appleseedmaya/exporters/shadingnodeexporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ void ShadingNodeExporter::exportValue(
{
bool boolValue;
if (AttributeUtils::get(plug, boolValue))
ss << "int " << boolValue ? "1" : "0";
ss << "int " << (boolValue ? "1" : "0"); // ?: has lower precedence than <<
}
}
else if (paramInfo.paramType == "matrix")
Expand Down Expand Up @@ -545,8 +545,8 @@ void ShadingNodeExporter::exportValue(
{
MObject attr = plug.attribute();
MFnEnumAttribute fnEnumAttr(attr);
int intValue = plug.asInt();
MString value = fnEnumAttr.fieldName(intValue);
short shortValue = plug.asShort();
MString value = fnEnumAttr.fieldName(shortValue);
ss << "string " << value;
}
else
Expand Down
72 changes: 72 additions & 0 deletions src/appleseedmaya/extensionattributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include <maya/MFnStringData.h>
#include <maya/MFnTypedAttribute.h>
#include <maya/MNodeClass.h>
#include <maya/MString.h>
#include "appleseedmaya/_endmayaheaders.h"

namespace
Expand Down Expand Up @@ -225,6 +226,8 @@ namespace
MFnNumericData::kFloat,
1.0f,
status);
numAttrFn.setSoftMin(0.0f);
numAttrFn.setSoftMax(10.0f);
AttributeUtils::makeInput(numAttrFn);
modifier.addExtensionAttribute(nodeClass, attr);

Expand All @@ -235,6 +238,8 @@ namespace
MFnNumericData::kFloat,
0.0f,
status);
numAttrFn.setSoftMin(0.0f);
numAttrFn.setSoftMax(16.0f);
AttributeUtils::makeInput(numAttrFn);
modifier.addExtensionAttribute(nodeClass, attr);

Expand All @@ -245,13 +250,79 @@ namespace
MFnNumericData::kBoolean,
false,
status);
numAttrFn.setKeyable(false);
AttributeUtils::makeInput(numAttrFn);
modifier.addExtensionAttribute(nodeClass, attr);

attr = createNumericAttribute<bool>(
numAttrFn,
"asCastIndirectLight",
"asCastIndirectLight",
MFnNumericData::kBoolean,
true,
status);
numAttrFn.setKeyable(false);
AttributeUtils::makeInput(numAttrFn);
modifier.addExtensionAttribute(nodeClass, attr);

attr = createNumericAttribute<float>(
numAttrFn,
"asImportanceMultiplier",
"asImportanceMultiplier",
MFnNumericData::kFloat,
1.0f,
status);
numAttrFn.setMin(0.0f);
numAttrFn.setSoftMax(10.0f);

AttributeUtils::makeInput(numAttrFn);
modifier.addExtensionAttribute(nodeClass, attr);

addVisibilityExtensionAttributes(nodeClass, modifier);
modifier.doIt();
}

void addDeltaLightExtensionAttributes()
{
for (const MString& light : {"pointLight", "spotLight", "directionalLight"})
{
MNodeClass nodeClass(light);
MDGModifier modifier;

MStatus status;

MFnNumericAttribute numAttrFn;

MObject attr = createNumericAttribute<bool>(
numAttrFn,
"asCastIndirectLight",
"asCastIndirectLight",
MFnNumericData::kBoolean,
true,
status);
numAttrFn.setKeyable(false);

AttributeUtils::makeInput(numAttrFn);
modifier.addExtensionAttribute(nodeClass, attr);

attr = createNumericAttribute<float>(
numAttrFn,
"asImportanceMultiplier",
"asImportanceMultiplier",
MFnNumericData::kFloat,
1.0f,
status);
numAttrFn.setMin(0.0f);
numAttrFn.setSoftMax(10.0f);

AttributeUtils::makeInput(numAttrFn);
modifier.addExtensionAttribute(nodeClass, attr);

addVisibilityExtensionAttributes(nodeClass, modifier);
modifier.doIt();
}
}

void addBump2dExtensionAttributes()
{
MNodeClass nodeClass("bump2d");
Expand Down Expand Up @@ -388,6 +459,7 @@ MStatus addExtensionAttributes()
{
addMeshExtensionAttributes();
addAreaLightExtensionAttributes();
addDeltaLightExtensionAttributes();
addBump2dExtensionAttributes();
addShadingEngineExtensionAttrs();
addCameraExtensionAttrs();
Expand Down
Loading

0 comments on commit dd1dfc2

Please sign in to comment.