Skip to content

Commit

Permalink
Merge pull request #17 from luisbarrancos/bump2d_params
Browse files Browse the repository at this point in the history
Extra parameters for built-in bump2d node
  • Loading branch information
est77 committed Feb 19, 2017
2 parents 72d20fd + 14da0cc commit a06bb14
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 6 deletions.
27 changes: 21 additions & 6 deletions scripts/appleseedMaya/aetemplate/__init__.py
Expand Up @@ -39,7 +39,7 @@ def __init__(self, nodeName):
logger.debug('Built custom appleseed AETemplate.')

def __buildVisibilitySection(self):
self.beginLayout('Visibility' ,collapse=1)
self.beginLayout('Visibility' , collapse=1)
self.addControl('asVisibilityCamera' , label='Camera')
self.addControl('asVisibilityLight' , label='Light')
self.addControl('asVisibilityShadow' , label='Shadow')
Expand All @@ -48,23 +48,38 @@ def __buildVisibilitySection(self):
self.addControl('asVisibilityGlossy' , label='Glossy')
self.endLayout()

def __buildBumpSection(self):
self.beginLayout('Bump' , collapse=1)
self.addControl('asNormalMap' , label='Normal Map')
self.addControl('asNormalMapMode' , label='Map Mode')
self.addSeparator()
self.addControl('asNormalMapFlipR' , label='Flip Red Channel')
self.addControl('asNormalMapFlipG' , label='Flip Green Channel')
self.addControl('asNormalMapSwapRG' , label='Swap R/G Channels')
self.endLayout()

def buildBody(self, nodeName):
self.thisNode = pm.PyNode(nodeName)

if self.thisNode.type() == 'areaLight':
self.beginLayout('Appleseed' ,collapse=1)
self.beginLayout('Appleseed' , collapse=1)
self.addControl('asIntensityScale', label='Intensity Scale')
self.addControl('asExposure', label='Exposure')
self.addControl('asNormalize', label='Normalize')
self.addControl('asExposure' , label='Exposure')
self.addControl('asNormalize' , label='Normalize')
self.__buildVisibilitySection()
self.endLayout()

if self.thisNode.type() == 'bump2d':
self.beginLayout('Appleseed' , collapse=1)
self.__buildBumpSection()
self.endLayout()

if self.thisNode.type() == 'camera':
self.beginLayout('Appleseed' ,collapse=1)
self.beginLayout('Appleseed' , collapse=1)
self.endLayout()

if self.thisNode.type() == 'mesh':
self.beginLayout('Appleseed' ,collapse=1)
self.beginLayout('Appleseed' , collapse=1)
self.__buildVisibilitySection()
self.addControl('asMediumPriority', label='Medium Priority')
self.endLayout()
Expand Down
64 changes: 64 additions & 0 deletions src/appleseedmaya/extensionAttributes.cpp
Expand Up @@ -201,6 +201,69 @@ void addAreaLightExtensionAttributes()
modifier.doIt();
}

void addBump2dExtensionAttributes()
{
MNodeClass nodeClass("bump2d");
MDGModifier modifier;

MStatus status;

MFnNumericAttribute numAttrFn;

MObject attr = numAttrFn.createColor(
"asNormalMap",
"asNormalMap",
&status);

numAttrFn.setUsedAsColor(true);
numAttrFn.setDefault(0.0);

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

attr = createNumericAttribute<int>(
numAttrFn,
"asNormalMapMode",
"asNormalMapMode",
MFnNumericData::kInt,
0,
status);
AttributeUtils::makeInput(numAttrFn);
modifier.addExtensionAttribute(nodeClass, attr);

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

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

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

modifier.doIt();
}

void addShadingEngineExtensionAttrs()
{
}
Expand All @@ -211,6 +274,7 @@ MStatus addExtensionAttributes()
{
addMeshExtensionAttributes();
addAreaLightExtensionAttributes();
addBump2dExtensionAttributes();
addShadingEngineExtensionAttrs();

return MS::kSuccess;
Expand Down

0 comments on commit a06bb14

Please sign in to comment.