mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-12-11 11:50:04 +00:00
3ae50d1c50
New text: 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.
148 lines
4.9 KiB
Plaintext
148 lines
4.9 KiB
Plaintext
//
|
|
// 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.
|
|
//
|
|
|
|
//
|
|
// Common utilities for map file attributes
|
|
//
|
|
global proc
|
|
AEopenSubdivShader_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
|
|
//
|
|
|
|
//
|
|
// diffuseMap
|
|
//
|
|
global proc
|
|
AEopenSubdivShader_diffuseMapNew( string $nodeAttr )
|
|
{
|
|
// build row with text field and file browser button
|
|
buildMapRow( $nodeAttr );
|
|
AEopenSubdivShader_diffuseMapReplace $nodeAttr;
|
|
}
|
|
|
|
global proc
|
|
AEopenSubdivShader_diffuseMapReplace (string $nodeAttr)
|
|
{
|
|
string $attr = `match "[^.]+$" $nodeAttr`;
|
|
string $fileField = ($attr+"_fileField");
|
|
string $browserBtn = ($attr+"_browserBtn");
|
|
|
|
connectControl -fileName $fileField $nodeAttr;
|
|
button -e -c
|
|
("AEopenSubdivShader_fileBrowser \"" + $nodeAttr + "\"" ) $browserBtn;
|
|
}
|
|
|
|
|
|
|
|
global proc
|
|
AEopenSubdivShaderTemplate(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 -addControl "interpolateUVBoundary";
|
|
editorTemplate -endLayout;
|
|
|
|
editorTemplate -beginLayout "Appearance" -collapse false;
|
|
editorTemplate -addControl "wireframe";
|
|
editorTemplate -addSeparator;
|
|
editorTemplate -addControl "diffuse";
|
|
editorTemplate -addControl "ambient";
|
|
editorTemplate -addControl "specular";
|
|
editorTemplate -addControl "shininess";
|
|
editorTemplate -endLayout;
|
|
|
|
editorTemplate -beginLayout "Texture" -collapse false;
|
|
editorTemplate -callCustom "AEopenSubdivShader_diffuseMapNew"
|
|
"AEopenSubdivShader_diffuseMapReplace"
|
|
"diffuseMap";
|
|
editorTemplate -addControl "uvSet";
|
|
editorTemplate -endLayout;
|
|
|
|
editorTemplate -beginLayout "Shader" -collapse true;
|
|
editorTemplate -addControl "shaderSource";
|
|
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";
|
|
}
|
|
|