2013-09-26 19:04:57 +00:00
|
|
|
//
|
|
|
|
// Copyright 2013 Pixar
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "Apache License")
|
|
|
|
// with the following modification; you may not use this file except in
|
|
|
|
// compliance with the Apache License and the following modification to it:
|
|
|
|
// Section 6. Trademarks. is deleted and replaced with:
|
|
|
|
//
|
|
|
|
// 6. Trademarks. This License does not grant permission to use the trade
|
|
|
|
// names, trademarks, service marks, or product names of the Licensor
|
|
|
|
// and its affiliates, except as required to comply with Section 4(c) of
|
|
|
|
// the License and to reproduce the content of the NOTICE file.
|
|
|
|
//
|
|
|
|
// You may obtain a copy of the Apache License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the Apache License with the above modification is
|
|
|
|
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
// KIND, either express or implied. See the Apache License for the specific
|
|
|
|
// language governing permissions and limitations under the Apache License.
|
|
|
|
//
|
2012-12-11 01:15:13 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Common utilities for map file attributes
|
|
|
|
//
|
|
|
|
global proc
|
|
|
|
AEopenSubdivPtexShader_fileBrowser( string $nodeAttr )
|
|
|
|
{
|
|
|
|
string $attr = `match "[^.]+$" $nodeAttr`;
|
|
|
|
string $uiAttr = `interToUI $attr`;
|
|
|
|
string $imgFilters = "PNG (*.png);;TIFF (*.tif);;JPEG (*.jpg);;All files (*.*)";
|
|
|
|
|
|
|
|
string $result[] = `fileDialog2 -caption ("Choose "+$uiAttr)
|
|
|
|
-fileMode 1
|
|
|
|
-fileFilter $imgFilters
|
|
|
|
-selectFileFilter "All files"
|
|
|
|
`;
|
|
|
|
|
|
|
|
string $filename = "";
|
|
|
|
if (size($result) > 0)
|
|
|
|
{
|
|
|
|
$filename = $result[0];
|
|
|
|
setAttr $nodeAttr -type "string" $filename;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
proc
|
|
|
|
buildMapRow( string $nodeAttr )
|
|
|
|
{
|
|
|
|
string $attr = `match "[^.]+$" $nodeAttr`;
|
|
|
|
string $fileField = ($attr+"_fileField");
|
|
|
|
string $browserBtn = ($attr+"_browserBtn");
|
|
|
|
|
|
|
|
setUITemplate -pst attributeEditorTemplate;
|
|
|
|
rowLayout -nc 3 -h 25;
|
|
|
|
text -label `interToUI $attr`;
|
|
|
|
textField $fileField;
|
|
|
|
symbolButton -image "navButtonBrowse.png" $browserBtn;
|
|
|
|
setParent ..;
|
|
|
|
setUITemplate -ppt;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Custom controls for adding file browser to map attributes
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
// colorFile
|
|
|
|
//
|
|
|
|
global proc
|
|
|
|
AEopenSubdivPtexShader_colorFileNew( string $nodeAttr )
|
|
|
|
{
|
|
|
|
// build row with text field and file browser button
|
|
|
|
buildMapRow( $nodeAttr );
|
|
|
|
AEopenSubdivPtexShader_colorFileReplace $nodeAttr;
|
|
|
|
}
|
|
|
|
|
|
|
|
global proc
|
|
|
|
AEopenSubdivPtexShader_colorFileReplace (string $nodeAttr)
|
|
|
|
{
|
|
|
|
string $attr = `match "[^.]+$" $nodeAttr`;
|
|
|
|
string $fileField = ($attr+"_fileField");
|
|
|
|
string $browserBtn = ($attr+"_browserBtn");
|
|
|
|
|
|
|
|
connectControl -fileName $fileField $nodeAttr;
|
|
|
|
button -e -c
|
|
|
|
("AEopenSubdivPtexShader_fileBrowser \"" + $nodeAttr + "\"" ) $browserBtn;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// displacementFile
|
|
|
|
//
|
|
|
|
global proc
|
|
|
|
AEopenSubdivPtexShader_displacementFileNew( string $nodeAttr )
|
|
|
|
{
|
|
|
|
// build row with text field and file browser button
|
|
|
|
buildMapRow( $nodeAttr );
|
|
|
|
AEopenSubdivPtexShader_displacementFileReplace $nodeAttr;
|
|
|
|
}
|
|
|
|
|
|
|
|
global proc
|
|
|
|
AEopenSubdivPtexShader_displacementFileReplace (string $nodeAttr)
|
|
|
|
{
|
|
|
|
string $attr = `match "[^.]+$" $nodeAttr`;
|
|
|
|
string $fileField = ($attr+"_fileField");
|
|
|
|
string $browserBtn = ($attr+"_browserBtn");
|
|
|
|
|
|
|
|
connectControl -fileName $fileField $nodeAttr;
|
|
|
|
button -e -c
|
|
|
|
("AEopenSubdivPtexShader_fileBrowser \"" + $nodeAttr + "\"" ) $browserBtn;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// occlusionFile
|
|
|
|
//
|
|
|
|
global proc
|
|
|
|
AEopenSubdivPtexShader_occlusionFileNew( string $nodeAttr )
|
|
|
|
{
|
|
|
|
// build row with text field and file browser button
|
|
|
|
buildMapRow( $nodeAttr );
|
|
|
|
AEopenSubdivPtexShader_occlusionFileReplace $nodeAttr;
|
|
|
|
}
|
|
|
|
|
|
|
|
global proc
|
|
|
|
AEopenSubdivPtexShader_occlusionFileReplace (string $nodeAttr)
|
|
|
|
{
|
|
|
|
string $attr = `match "[^.]+$" $nodeAttr`;
|
|
|
|
string $fileField = ($attr+"_fileField");
|
|
|
|
string $browserBtn = ($attr+"_browserBtn");
|
|
|
|
|
|
|
|
connectControl -fileName $fileField $nodeAttr;
|
|
|
|
button -e -c
|
|
|
|
("AEopenSubdivPtexShader_fileBrowser \"" + $nodeAttr + "\"" ) $browserBtn;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// diffuseEnvironmentMap
|
|
|
|
//
|
|
|
|
global proc
|
|
|
|
AEopenSubdivPtexShader_diffuseEnvironmentMapNew( string $nodeAttr )
|
|
|
|
{
|
|
|
|
// build row with text field and file browser button
|
|
|
|
buildMapRow( $nodeAttr );
|
|
|
|
AEopenSubdivPtexShader_diffuseEnvironmentMapReplace $nodeAttr;
|
|
|
|
}
|
|
|
|
|
|
|
|
global proc
|
|
|
|
AEopenSubdivPtexShader_diffuseEnvironmentMapReplace (string $nodeAttr)
|
|
|
|
{
|
|
|
|
string $attr = `match "[^.]+$" $nodeAttr`;
|
|
|
|
string $fileField = ($attr+"_fileField");
|
|
|
|
string $browserBtn = ($attr+"_browserBtn");
|
|
|
|
|
|
|
|
connectControl -fileName $fileField $nodeAttr;
|
|
|
|
button -e -c
|
|
|
|
("AEopenSubdivPtexShader_fileBrowser \"" + $nodeAttr + "\"" ) $browserBtn;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// specularEnvironmentMap
|
|
|
|
//
|
|
|
|
global proc
|
|
|
|
AEopenSubdivPtexShader_specularEnvironmentMapNew( string $nodeAttr )
|
|
|
|
{
|
|
|
|
// build row with text field and file browser button
|
|
|
|
buildMapRow( $nodeAttr );
|
|
|
|
AEopenSubdivPtexShader_specularEnvironmentMapReplace $nodeAttr;
|
|
|
|
}
|
|
|
|
|
|
|
|
global proc
|
|
|
|
AEopenSubdivPtexShader_specularEnvironmentMapReplace (string $nodeAttr)
|
|
|
|
{
|
|
|
|
string $attr = `match "[^.]+$" $nodeAttr`;
|
|
|
|
string $fileField = ($attr+"_fileField");
|
|
|
|
string $browserBtn = ($attr+"_browserBtn");
|
|
|
|
|
|
|
|
connectControl -fileName $fileField $nodeAttr;
|
|
|
|
button -e -c
|
|
|
|
("AEopenSubdivPtexShader_fileBrowser \"" + $nodeAttr + "\"" ) $browserBtn;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
global proc
|
|
|
|
AEopenSubdivPtexShaderTemplate(string $nodeName)
|
|
|
|
{
|
|
|
|
// swatch rendering not implemented yet
|
|
|
|
// AEswatchDisplay $nodeName;
|
|
|
|
|
|
|
|
editorTemplate -beginScrollLayout;
|
|
|
|
|
|
|
|
editorTemplate -beginLayout "Subdivision" -collapse false;
|
|
|
|
editorTemplate -addControl "adaptive";
|
|
|
|
editorTemplate -addControl "scheme";
|
|
|
|
editorTemplate -addControl "kernel";
|
|
|
|
editorTemplate -addControl "level";
|
|
|
|
editorTemplate -addControl "tessFactor";
|
|
|
|
editorTemplate -addControl "interpolateBoundary";
|
|
|
|
editorTemplate -endLayout;
|
|
|
|
|
|
|
|
editorTemplate -beginLayout "PTex" -collapse false;
|
|
|
|
editorTemplate -callCustom "AEopenSubdivPtexShader_colorFileNew"
|
|
|
|
"AEopenSubdivPtexShader_colorFileReplace"
|
|
|
|
"colorFile";
|
|
|
|
editorTemplate -callCustom "AEopenSubdivPtexShader_displacementFileNew"
|
|
|
|
"AEopenSubdivPtexShader_displacementFileReplace"
|
|
|
|
"displacementFile";
|
|
|
|
editorTemplate -callCustom "AEopenSubdivPtexShader_occlusionFileNew"
|
|
|
|
"AEopenSubdivPtexShader_occlusionFileReplace"
|
|
|
|
"occlusionFile";
|
|
|
|
editorTemplate -endLayout;
|
|
|
|
|
|
|
|
editorTemplate -beginLayout "Shader" -collapse false;
|
|
|
|
editorTemplate -addControl "wireframe";
|
|
|
|
editorTemplate -addControl "shaderSource";
|
|
|
|
editorTemplate -beginNoOptimize;
|
|
|
|
editorTemplate -addControl "enableColor";
|
|
|
|
editorTemplate -addControl "enableDisplacement";
|
|
|
|
editorTemplate -addControl "enableOcclusion";
|
|
|
|
editorTemplate -addControl "enableNormal";
|
|
|
|
editorTemplate -endNoOptimize;
|
|
|
|
|
|
|
|
editorTemplate -addSeparator;
|
|
|
|
editorTemplate -addControl "diffuse";
|
|
|
|
editorTemplate -addControl "ambient";
|
|
|
|
editorTemplate -addControl "specular";
|
|
|
|
|
|
|
|
editorTemplate -addSeparator;
|
|
|
|
editorTemplate -addControl "fresnelBias";
|
|
|
|
editorTemplate -addControl "fresnelScale";
|
|
|
|
editorTemplate -addControl "fresnelPower";
|
|
|
|
editorTemplate -addControl "light";
|
|
|
|
editorTemplate -endLayout;
|
|
|
|
|
|
|
|
editorTemplate -beginLayout "Environment" -collapse false;
|
|
|
|
editorTemplate -callCustom "AEopenSubdivPtexShader_diffuseEnvironmentMapNew"
|
|
|
|
"AEopenSubdivPtexShader_diffuseEnvironmentMapReplace"
|
|
|
|
"diffuseEnvironmentMap";
|
|
|
|
editorTemplate -callCustom "AEopenSubdivPtexShader_specularEnvironmentMapNew"
|
|
|
|
"AEopenSubdivPtexShader_specularEnvironmentMapReplace"
|
|
|
|
"specularEnvironmentMap";
|
|
|
|
editorTemplate -endLayout;
|
|
|
|
|
|
|
|
// include/call base class/node attributes
|
|
|
|
AEdependNodeTemplate $nodeName;
|
|
|
|
|
|
|
|
editorTemplate -addExtraControls;
|
|
|
|
editorTemplate -endScrollLayout;
|
|
|
|
|
|
|
|
editorTemplate -suppress "outColor";
|
|
|
|
editorTemplate -suppress "outTransparency";
|
|
|
|
editorTemplate -suppress "outMatteOpacity";
|
|
|
|
editorTemplate -suppress "outGlowColor";
|
|
|
|
editorTemplate -suppress "enableHwShading";
|
|
|
|
editorTemplate -suppress "varyingParameters";
|
|
|
|
editorTemplate -suppress "uniformParameters";
|
|
|
|
}
|
|
|
|
|