mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-12-23 00:10:07 +00:00
Removed mayaPolySmooth example
Also removed the remaining Maya dependencies. These were most useful during the early days of OpenSubdiv. Now OpenSubdiv has been integrated directly into Maya and these examples serve little purpose.
This commit is contained in:
parent
da07d232f3
commit
8babf1e12b
@ -60,7 +60,7 @@ before_script:
|
||||
|
||||
script:
|
||||
- mkdir build && cd build
|
||||
- cmake -DNO_TBB=1 -DNO_OMP=1 -DNO_CUDA=1 -DNO_OPENCL=1 -DNO_MAYA=1 -DNO_PTEX=1 -DNO_GLTESTS=1 -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ..
|
||||
- cmake -DNO_TBB=1 -DNO_OMP=1 -DNO_CUDA=1 -DNO_OPENCL=1 -DNO_PTEX=1 -DNO_GLTESTS=1 -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ..
|
||||
- make
|
||||
- make test
|
||||
|
||||
|
@ -267,13 +267,11 @@ set(CMAKE_SUPPRESS_REGENERATION TRUE)
|
||||
option(PTEX_LOCATION "Path to Ptex" "")
|
||||
option(GLEW_LOCATION "Path to GLEW" "")
|
||||
option(GLFW_LOCATION "Path to GLFW" "")
|
||||
option(MAYA_LOCATION "Path to Maya" "")
|
||||
|
||||
option(NO_LIB "Disable the opensubdiv libs build (caveat emptor)" OFF)
|
||||
option(NO_EXAMPLES "Disable examples build" OFF)
|
||||
option(NO_TUTORIALS "Disable tutorials build" OFF)
|
||||
option(NO_REGRESSION "Disable regression tests build" OFF)
|
||||
option(NO_MAYA "Disable Maya plugin build" OFF)
|
||||
option(NO_PTEX "Disable PTex support" OFF)
|
||||
option(NO_DOC "Disable documentation build" OFF)
|
||||
option(NO_OMP "Disable OpenMP backend" OFF)
|
||||
@ -334,10 +332,6 @@ if (WIN32 AND NOT NO_DX)
|
||||
find_package(DXSDK)
|
||||
endif()
|
||||
|
||||
if (NOT NO_MAYA)
|
||||
find_package(Maya 201200)
|
||||
endif()
|
||||
|
||||
if (NOT NO_DOC)
|
||||
find_package(Doxygen 1.8.4)
|
||||
find_package(Docutils 0.9)
|
||||
@ -506,22 +500,6 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT NO_MAYA)
|
||||
if(MAYA_FOUND)
|
||||
add_definitions(
|
||||
-DOPENSUBDIV_HAS_MAYA
|
||||
)
|
||||
else()
|
||||
message(WARNING
|
||||
"Maya was not found : the OpenSubdiv mayaViwer plugin will not be "
|
||||
"available. If you do have Maya installed and see this message, "
|
||||
"please add your Maya path to FindMaya.cmake in "
|
||||
"${PROJECT_SOURCE_DIR}/cmake or set it through the MAYA_LOCATION "
|
||||
"cmake command line argument or environment variable."
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Link examples & regressions dynamically against Osd
|
||||
if( OSD_GPU )
|
||||
set( OSD_LINK_TARGET osd_dynamic_cpu osd_dynamic_gpu )
|
||||
|
@ -84,7 +84,7 @@ For more details about OpenSubdiv, see [Pixar Graphics Technologies](http://grap
|
||||
```
|
||||
"c:/Program Files (x86)/CMake/bin/cmake.exe" ^
|
||||
-G "Visual Studio 12 Win64" ^
|
||||
-D NO_MAYA=1 -D NO_PTEX=1 -D NO_DOC=1 ^
|
||||
-D -D NO_PTEX=1 -D NO_DOC=1 ^
|
||||
-D NO_OMP=1 -D NO_TBB=1 -D NO_CUDA=1 -D NO_OPENCL=1 -D NO_CLEW=1 ^
|
||||
-D "GLEW_LOCATION=*YOUR GLEW INSTALL LOCATION*" ^
|
||||
-D "GLFW_LOCATION=*YOUR GLFW INSTALL LOCATION*" ^
|
||||
@ -95,7 +95,7 @@ For more details about OpenSubdiv, see [Pixar Graphics Technologies](http://grap
|
||||
### Linux
|
||||
|
||||
```
|
||||
cmake -D NO_MAYA=1 -D NO_PTEX=1 -D NO_DOC=1 \
|
||||
cmake -D -D NO_PTEX=1 -D NO_DOC=1 \
|
||||
-D NO_OMP=1 -D NO_TBB=1 -D NO_CUDA=1 -D NO_OPENCL=1 -D NO_CLEW=1 \
|
||||
-D GLEW_LOCATION="*YOUR GLEW INSTALL LOCATION*" \
|
||||
-D GLFW_LOCATION="*YOUR GLFW INSTALL LOCATION*" \
|
||||
@ -106,7 +106,7 @@ make
|
||||
### OSX
|
||||
|
||||
```
|
||||
cmake -D NO_MAYA=1 -D NO_PTEX=1 -D NO_DOC=1 \
|
||||
cmake -D -D NO_PTEX=1 -D NO_DOC=1 \
|
||||
-D NO_OMP=1 -D NO_TBB=1 -D NO_CUDA=1 -D NO_OPENCL=1 -D NO_CLEW=1 \
|
||||
-D GLFW_LOCATION="*YOUR GLFW INSTALL LOCATION*" \
|
||||
..
|
||||
@ -125,13 +125,11 @@ make
|
||||
-DPTEX_LOCATION=[path to Ptex]
|
||||
-DGLEW_LOCATION=[path to GLEW]
|
||||
-DGLFW_LOCATION=[path to GLFW]
|
||||
-DMAYA_LOCATION=[path to Maya]
|
||||
|
||||
-DNO_LIB=1 // disable the opensubdiv libs build (caveat emptor)
|
||||
-DNO_EXAMPLES=1 // disable examples build
|
||||
-DNO_TUTORIALS=1 // disable tutorials build
|
||||
-DNO_REGRESSION=1 // disable regression tests build
|
||||
-DNO_MAYA=1 // disable Maya plugin build
|
||||
-DNO_PTEX=1 // disable PTex support
|
||||
-DNO_DOC=1 // disable documentation build
|
||||
-DNO_OMP=1 // disable OpenMP
|
||||
|
@ -20,7 +20,7 @@ build_script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake --version
|
||||
- cmake -G "Visual Studio %Configuration%" -DNO_TBB=1 -DNO_OMP=1 -DNO_CUDA=1 -DNO_MAYA=1 -DNO_PTEX=1 -DNO_DOC=1 -DNO_CLEW=1 -DNO_OPENGL=1 -DNO_OPENCL=1 ..
|
||||
- cmake -G "Visual Studio %Configuration%" -DNO_TBB=1 -DNO_OMP=1 -DNO_CUDA=1 -DNO_PTEX=1 -DNO_DOC=1 -DNO_CLEW=1 -DNO_OPENGL=1 -DNO_OPENCL=1 ..
|
||||
- cmake --build . --config Release
|
||||
|
||||
test_script:
|
||||
|
@ -1,256 +0,0 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
# - Maya finder module
|
||||
# This module searches for a valid Maya instalation.
|
||||
# It searches for Maya's devkit, libraries, executables
|
||||
# and related paths (scripts)
|
||||
#
|
||||
# Variables that will be defined:
|
||||
# MAYA_FOUND Defined if a Maya installation has been detected
|
||||
# MAYA_EXECUTABLE Path to Maya's executable
|
||||
# MAYA_<lib>_FOUND Defined if <lib> has been found
|
||||
# MAYA_<lib>_LIBRARY Path to <lib> library
|
||||
# MAYA_INCLUDE_DIRS Path to the devkit's include directories
|
||||
# MAYA_API_VERSION Maya version (6 digits)
|
||||
#
|
||||
# IMPORTANT: Currently, there's only support for OSX platform and Maya version 2012.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2011-2012 Francisco Requena <frarees@gmail.com>
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
if(APPLE)
|
||||
find_path(MAYA_BASE_DIR
|
||||
../../devkit/include/maya/MFn.h
|
||||
HINTS
|
||||
"${MAYA_LOCATION}"
|
||||
"$ENV{MAYA_LOCATION}"
|
||||
"/Applications/Autodesk/maya2015/Maya.app/Contents"
|
||||
"/Applications/Autodesk/maya2014/Maya.app/Contents"
|
||||
"/Applications/Autodesk/maya2013.5/Maya.app/Contents"
|
||||
"/Applications/Autodesk/maya2013/Maya.app/Contents"
|
||||
"/Applications/Autodesk/maya2012.17/Maya.app/Contents"
|
||||
"/Applications/Autodesk/maya2012/Maya.app/Contents"
|
||||
"/Applications/Autodesk/maya2011/Maya.app/Contents"
|
||||
"/Applications/Autodesk/maya2010/Maya.app/Contents"
|
||||
)
|
||||
find_path(MAYA_LIBRARY_DIR libOpenMaya.dylib
|
||||
HINTS
|
||||
"${MAYA_LOCATION}"
|
||||
"$ENV{MAYA_LOCATION}"
|
||||
"${MAYA_BASE_DIR}"
|
||||
PATH_SUFFIXES
|
||||
Maya.app/contents/MacOS/
|
||||
DOC
|
||||
"Maya's libraries path"
|
||||
)
|
||||
endif(APPLE)
|
||||
|
||||
if(UNIX)
|
||||
find_path(MAYA_BASE_DIR
|
||||
include/maya/MFn.h
|
||||
HINTS
|
||||
"${MAYA_LOCATION}"
|
||||
"$ENV{MAYA_LOCATION}"
|
||||
"/usr/autodesk/maya2015-x64"
|
||||
"/usr/autodesk/maya2014-x64"
|
||||
"/usr/autodesk/maya2013-x64"
|
||||
"/usr/autodesk/maya2012.17-x64"
|
||||
"/usr/autodesk/maya2012-x64"
|
||||
"/usr/autodesk/maya2011-x64"
|
||||
"/usr/autodesk/maya2010-x64"
|
||||
)
|
||||
find_path(MAYA_LIBRARY_DIR
|
||||
libOpenMaya.so
|
||||
HINTS
|
||||
"${MAYA_LOCATION}"
|
||||
"$ENV{MAYA_LOCATION}"
|
||||
"${MAYA_BASE_DIR}"
|
||||
PATH_SUFFIXES
|
||||
lib/
|
||||
DOC
|
||||
"Maya's libraries path"
|
||||
)
|
||||
endif(UNIX)
|
||||
|
||||
if(WIN32)
|
||||
find_path(MAYA_BASE_DIR
|
||||
include/maya/MFn.h
|
||||
HINTS
|
||||
"${MAYA_LOCATION}"
|
||||
"$ENV{MAYA_LOCATION}"
|
||||
"C:/Program Files/Autodesk/Maya2015.5-x64"
|
||||
"C:/Program Files/Autodesk/Maya2015.5"
|
||||
"C:/Program Files/Autodesk/Maya2014.5-x64"
|
||||
"C:/Program Files/Autodesk/Maya2014.5"
|
||||
"C:/Program Files/Autodesk/Maya2013.5-x64"
|
||||
"C:/Program Files/Autodesk/Maya2013.5"
|
||||
"C:/Program Files (x86)/Autodesk/Maya2013.5"
|
||||
"C:/Autodesk/maya-2013.5x64"
|
||||
"C:/Program Files/Autodesk/Maya2013-x64"
|
||||
"C:/Program Files/Autodesk/Maya2013"
|
||||
"C:/Program Files (x86)/Autodesk/Maya2013"
|
||||
"C:/Autodesk/maya-2013x64"
|
||||
"C:/Program Files/Autodesk/Maya2012-x64"
|
||||
"C:/Program Files/Autodesk/Maya2012"
|
||||
"C:/Program Files (x86)/Autodesk/Maya2012"
|
||||
"C:/Autodesk/maya-2012x64"
|
||||
"C:/Program Files/Autodesk/Maya2011-x64"
|
||||
"C:/Program Files/Autodesk/Maya2011"
|
||||
"C:/Program Files (x86)/Autodesk/Maya2011"
|
||||
"C:/Autodesk/maya-2011x64"
|
||||
"C:/Program Files/Autodesk/Maya2010-x64"
|
||||
"C:/Program Files/Autodesk/Maya2010"
|
||||
"C:/Program Files (x86)/Autodesk/Maya2010"
|
||||
"C:/Autodesk/maya-2010x64"
|
||||
)
|
||||
find_path(MAYA_LIBRARY_DIR
|
||||
OpenMaya.lib
|
||||
HINTS
|
||||
"${MAYA_LOCATION}"
|
||||
"$ENV{MAYA_LOCATION}"
|
||||
"${MAYA_BASE_DIR}"
|
||||
PATH_SUFFIXES
|
||||
lib/
|
||||
DOC
|
||||
"Maya's libraries path"
|
||||
)
|
||||
endif(WIN32)
|
||||
|
||||
find_path(MAYA_INCLUDE_DIR
|
||||
maya/MFn.h
|
||||
HINTS
|
||||
"${MAYA_LOCATION}"
|
||||
"$ENV{MAYA_LOCATION}"
|
||||
"${MAYA_BASE_DIR}"
|
||||
PATH_SUFFIXES
|
||||
../../devkit/include/
|
||||
include/
|
||||
DOC
|
||||
"Maya's devkit headers path"
|
||||
)
|
||||
|
||||
find_path(MAYA_LIBRARY_DIR
|
||||
OpenMaya
|
||||
HINTS
|
||||
"${MAYA_LOCATION}"
|
||||
"$ENV{MAYA_LOCATION}"
|
||||
"${MAYA_BASE_DIR}"
|
||||
PATH_SUFFIXES
|
||||
../../devkit/include/
|
||||
include/
|
||||
DOC
|
||||
"Maya's devkit headers path"
|
||||
)
|
||||
|
||||
list(APPEND MAYA_INCLUDE_DIRS ${MAYA_INCLUDE_DIR})
|
||||
|
||||
find_path(MAYA_DEVKIT_INC_DIR
|
||||
GL/glext.h
|
||||
HINTS
|
||||
"${MAYA_LOCATION}"
|
||||
"$ENV{MAYA_LOCATION}"
|
||||
"${MAYA_BASE_DIR}"
|
||||
PATH_SUFFIXES
|
||||
/devkit/plug-ins/
|
||||
DOC
|
||||
"Maya's devkit headers path"
|
||||
)
|
||||
|
||||
list(APPEND MAYA_INCLUDE_DIRS ${MAYA_DEVKIT_INC_DIR})
|
||||
|
||||
foreach(MAYA_LIB
|
||||
OpenMaya
|
||||
OpenMayaAnim
|
||||
OpenMayaFX
|
||||
OpenMayaRender
|
||||
OpenMayaUI
|
||||
Image
|
||||
Foundation
|
||||
IMFbase
|
||||
tbb
|
||||
cg
|
||||
cgGL)
|
||||
|
||||
find_library(MAYA_${MAYA_LIB}_LIBRARY
|
||||
${MAYA_LIB}
|
||||
HINTS
|
||||
"${MAYA_LOCATION}"
|
||||
"$ENV{MAYA_LOCATION}"
|
||||
"${MAYA_BASE_DIR}"
|
||||
PATH_SUFFIXES
|
||||
MacOS/
|
||||
lib/
|
||||
DOC
|
||||
"Maya's ${MAYA_LIB} library path"
|
||||
)
|
||||
|
||||
|
||||
if (MAYA_${MAYA_LIB}_LIBRARY)
|
||||
list(APPEND MAYA_LIBRARIES ${MAYA_${MAYA_LIB}_LIBRARY})
|
||||
endif()
|
||||
endforeach(MAYA_LIB)
|
||||
|
||||
find_program(MAYA_EXECUTABLE
|
||||
maya
|
||||
HINTS
|
||||
"${MAYA_LOCATION}"
|
||||
"$ENV{MAYA_LOCATION}"
|
||||
"${MAYA_BASE_DIR}"
|
||||
PATH_SUFFIXES
|
||||
MacOS/
|
||||
bin/
|
||||
DOC
|
||||
"Maya's executable path"
|
||||
)
|
||||
|
||||
if(MAYA_INCLUDE_DIRS AND EXISTS "${MAYA_INCLUDE_DIR}/maya/MTypes.h")
|
||||
|
||||
# Tease the MAYA_API_VERSION numbers from the lib headers
|
||||
file(STRINGS ${MAYA_INCLUDE_DIR}/maya/MTypes.h TMP REGEX "#define MAYA_API_VERSION.*$")
|
||||
string(REGEX MATCHALL "[0-9]+" MAYA_API_VERSION ${TMP})
|
||||
endif()
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set MAYA_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(Maya
|
||||
REQUIRED_VARS
|
||||
MAYA_EXECUTABLE
|
||||
MAYA_INCLUDE_DIRS
|
||||
MAYA_LIBRARIES
|
||||
VERSION_VAR
|
||||
MAYA_API_VERSION
|
||||
)
|
@ -79,7 +79,3 @@ if (DXSDK_FOUND AND NOT NO_DX)
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
if (MAYA_FOUND AND (NOT NO_MAYA))
|
||||
add_subdirectory(mayaPolySmooth)
|
||||
endif()
|
||||
|
@ -1,137 +0,0 @@
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
#ifndef _EXAMPLE_MAYA_UTIL_H_
|
||||
#define _EXAMPLE_MAYA_UTIL_H_
|
||||
|
||||
#include <maya/MColor.h>
|
||||
#include <maya/MFloatVector.h>
|
||||
#include <maya/MFnDependencyNode.h>
|
||||
#include <maya/MFnNumericData.h>
|
||||
#include <maya/MMatrix.h>
|
||||
#include <maya/MPlug.h>
|
||||
#include <maya/MString.h>
|
||||
#include <maya/MVector.h>
|
||||
|
||||
|
||||
#define CHECK_GL_ERROR(...) \
|
||||
if (GLuint err = glGetError()) { \
|
||||
fprintf(stderr, "GL error %x :", err); \
|
||||
fprintf(stderr, "%s", __VA_ARGS__); \
|
||||
}
|
||||
|
||||
|
||||
#define MERROR(status, msg) \
|
||||
{ \
|
||||
MGlobal::displayError(MString(msg)); \
|
||||
fprintf(stderr, "%s [ %s:%d ]\n", msg, __FILE__, __LINE__); \
|
||||
}
|
||||
|
||||
#define MCHECK_PRINT(status, msg) \
|
||||
if (status.error()) \
|
||||
{ \
|
||||
MGlobal::displayError(MString(msg)); \
|
||||
fprintf(stderr, "%s [ %s:%d ]\n", msg, __FILE__, __LINE__); \
|
||||
}
|
||||
|
||||
#define MCHECK_RETURN(status, msg) \
|
||||
if (status.error()) \
|
||||
{ \
|
||||
MGlobal::displayError(MString(msg)); \
|
||||
fprintf(stderr, "%s [ %s:%d ]\n", msg, __FILE__, __LINE__); \
|
||||
return status; \
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Templated funtions able to retrieve any attribute that
|
||||
// can be retrieved via the overloaded MPlug::getValue()
|
||||
// methods. Any attributes that need MPlug::getData()
|
||||
// Need to use non-templated functions below
|
||||
//
|
||||
template<class T> static int
|
||||
findAttribute( MFnDependencyNode &depFn, const char *attr, T *val )
|
||||
{
|
||||
MStatus stat;
|
||||
MPlug plug;
|
||||
T tmp;
|
||||
|
||||
// careful version - returns -1 if attribute missing
|
||||
plug = depFn.findPlug(attr, &stat);
|
||||
if (stat != MS::kSuccess) return -1;
|
||||
|
||||
stat = plug.getValue(tmp);
|
||||
if ( stat != MS::kSuccess ) return -1;
|
||||
|
||||
*val = tmp;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
template<class T> static void
|
||||
getAttribute( MObject& object, MObject& attr, T *val )
|
||||
{
|
||||
// fast version - crash & burn if attribute missing
|
||||
MPlug plug(object, attr);
|
||||
plug.getValue(*val);
|
||||
}
|
||||
|
||||
|
||||
static MColor
|
||||
getColor(MObject object, MObject attr)
|
||||
{
|
||||
MPlug plug(object, attr);
|
||||
MObject data;
|
||||
plug.getValue(data);
|
||||
MFnNumericData numFn(data);
|
||||
float color[3];
|
||||
numFn.getData(color[0], color[1], color[2]);
|
||||
return MColor(color[0], color[1], color[2]);
|
||||
}
|
||||
|
||||
static MFloatVector
|
||||
getVector(MObject object, MObject attr)
|
||||
{
|
||||
MPlug plug(object, attr);
|
||||
MObject data;
|
||||
plug.getValue(data);
|
||||
MFnNumericData numFn(data);
|
||||
float color[3];
|
||||
numFn.getData(color[0], color[1], color[2]);
|
||||
return MVector(color[0], color[1], color[2]);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
// reverse to dst,src ?
|
||||
setMatrix(const MMatrix &mat, float *dst)
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
for (int j = 0; j < 4; ++j)
|
||||
dst[i*4+j] = float(mat(i, j));
|
||||
}
|
||||
|
||||
|
||||
#endif // _EXAMPLE_MAYA_UTIL_H_
|
||||
|
@ -1,130 +0,0 @@
|
||||
#
|
||||
# Copyright 2013 Autodesk, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
# *** mayaPolySmooth ***
|
||||
|
||||
set(MAYA_FIND_QUIETLY TRUE)
|
||||
|
||||
if(NOT MAYA_FOUND)
|
||||
message(STATUS
|
||||
"Maya could not be found, so the OpenSubdiv mayaPolySmooth plugin "
|
||||
"will not be available. If you do have Maya installed and see this message, "
|
||||
"please add your Maya path to cmake/FindMaya.cmake or set it in "
|
||||
"the MAYA_LOCATION environment variable."
|
||||
)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(PLATFORM_LIBRARIES
|
||||
"${OSD_LINK_TARGET}"
|
||||
)
|
||||
|
||||
include_directories(
|
||||
"${OPENSUBDIV_INCLUDE_DIR}"
|
||||
"${MAYA_INCLUDE_DIRS}"
|
||||
)
|
||||
|
||||
set(SOURCE_FILES
|
||||
mayaPolySmooth.cpp
|
||||
)
|
||||
|
||||
set(HEADER_FILES
|
||||
mayaPolySmooth.h
|
||||
)
|
||||
|
||||
if(UNIX)
|
||||
set(PLATFORM_COMPILE_FLAGS
|
||||
-D_BOOL
|
||||
-DREQUIRE_IOSTREAM
|
||||
-DLINUX
|
||||
)
|
||||
set(PLATFORM_PLUGIN_EXTENSION
|
||||
.so
|
||||
)
|
||||
set(PLATFORM_LINK_FLAGS
|
||||
)
|
||||
elseif(WIN32)
|
||||
set(PLATFORM_COMPILE_FLAGS
|
||||
/D_AFXDLL
|
||||
/DNT_PLUGIN
|
||||
/DREQUIRE_IOSTREAM
|
||||
)
|
||||
set(PLATFORM_PLUGIN_EXTENSION
|
||||
.mll
|
||||
)
|
||||
set(PLATFORM_LINK_FLAGS
|
||||
"/export:initializePlugin /export:uninitializePlugin"
|
||||
)
|
||||
endif()
|
||||
|
||||
add_definitions(
|
||||
${PLATFORM_COMPILE_FLAGS}
|
||||
)
|
||||
|
||||
add_library(maya_polySmoothNode SHARED
|
||||
${SOURCE_FILES}
|
||||
${HEADER_FILES}
|
||||
$<TARGET_OBJECTS:sdc_obj>
|
||||
$<TARGET_OBJECTS:vtr_obj>
|
||||
$<TARGET_OBJECTS:far_obj>
|
||||
)
|
||||
|
||||
set_target_properties(maya_polySmoothNode
|
||||
PROPERTIES
|
||||
OUTPUT_NAME "mayaPolySmooth"
|
||||
PREFIX ""
|
||||
SUFFIX ${PLATFORM_PLUGIN_EXTENSION}
|
||||
LINK_FLAGS "${PLATFORM_LINK_FLAGS}"
|
||||
)
|
||||
|
||||
target_link_libraries(maya_polySmoothNode
|
||||
"${MAYA_Foundation_LIBRARY}"
|
||||
"${MAYA_OpenMaya_LIBRARY}"
|
||||
"${MAYA_OpenMayaRender_LIBRARY}"
|
||||
"${MAYA_OpenMayaUI_LIBRARY}"
|
||||
)
|
||||
|
||||
install(TARGETS maya_polySmoothNode DESTINATION "${CMAKE_PLUGINDIR_BASE}")
|
||||
|
||||
add_custom_target(maya_polySmoothNode_melScripts
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E copy
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/mayaPolySmooth.mel"
|
||||
"${OpenSubdiv_BINARY_DIR}/${CMAKE_LIBDIR_BASE}/mayaPolySmooth.mel"
|
||||
DEPENDS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/mayaPolySmooth.mel"
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
"${OpenSubdiv_BINARY_DIR}/${CMAKE_LIBDIR_BASE}/mayaPolySmooth.mel"
|
||||
DESTINATION
|
||||
"${CMAKE_PLUGINDIR_BASE}"
|
||||
)
|
||||
|
||||
add_custom_target(mayaPolySmooth
|
||||
ALL
|
||||
DEPENDS
|
||||
maya_polySmoothNode maya_polySmoothNode_melScripts
|
||||
)
|
File diff suppressed because it is too large
Load Diff
@ -1,64 +0,0 @@
|
||||
//
|
||||
// Copyright 2013 Autodesk, Inc.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
#ifndef _MayaPolySmooth
|
||||
#define _MayaPolySmooth
|
||||
|
||||
#include <maya/MPxNode.h>
|
||||
#include <maya/MTypeId.h>
|
||||
|
||||
|
||||
class MayaPolySmooth : public MPxNode {
|
||||
|
||||
public:
|
||||
|
||||
MayaPolySmooth();
|
||||
|
||||
virtual ~MayaPolySmooth();
|
||||
|
||||
virtual MStatus compute( const MPlug& plug, MDataBlock& data );
|
||||
|
||||
static void * creator();
|
||||
|
||||
static MStatus initialize();
|
||||
|
||||
public:
|
||||
|
||||
// MAYA_NODE_BUILDER:BEG [ATTRIBUTE DECLARATION] ==========
|
||||
static MObject a_inputPolymesh; // This is a description for this attribute
|
||||
static MObject a_output; // This is a description for this attribute
|
||||
static MObject a_subdivisionLevels; // The number of recursive quad subdivisions to perform on each face.
|
||||
static MObject a_recommendedIsolation; // The recommended number of levels of isolation / subdivision based on topology
|
||||
static MObject a_vertBoundaryMethod; // Controls how boundary edges and vertices are interpolated. <ul> <li>Smooth, Edges: Renderman: InterpolateBoundaryEdgeOnly</li> <li>Smooth, Edges and Corners: Renderman: InterpolateBoundaryEdgeAndCorner</li> </ul>
|
||||
static MObject a_fvarBoundaryMethod; // Controls how boundaries are treated for face-varying data (UVs and Vertex Colors). <ul> <li>Bi-linear (None): Renderman: InterpolateBoundaryNone</li> <li>Smooth, (Edge Only): Renderman: InterpolateBoundaryEdgeOnly</li> <li>Smooth, (Edges and Corners: Renderman: InterpolateBoundaryEdgeAndCorner</li> <li>Smooth, (ZBrush and Maya "Smooth Internal Only"): Renderman: InterpolateBoundaryAlwaysSharp</li> </ul>
|
||||
static MObject a_fvarPropagateCorners; //
|
||||
static MObject a_smoothTriangles; // Apply a special subdivision rule be applied to all triangular faces that was empirically determined to make triangles subdivide more smoothly.
|
||||
static MObject a_creaseMethod; // Controls how boundary edges and vertices are interpolated. <ul> <li>Normal</li> <li>Chaikin: Improves the appearance of multiedge creases with varying weight</li> </ul>
|
||||
// MAYA_NODE_BUILDER:END [ATTRIBUTE DECLARATION] ==========
|
||||
|
||||
static const MTypeId id;
|
||||
static const MString typeNameStr;
|
||||
};
|
||||
|
||||
#endif // _MayaPolySmooth
|
@ -1,167 +0,0 @@
|
||||
//
|
||||
// Copyright 2013 Autodesk, Inc.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
// ===========================
|
||||
// USER INTERFACE
|
||||
// ===========================
|
||||
|
||||
//
|
||||
// Add the UI for the mayaPolySmooth plugin
|
||||
//
|
||||
global proc mayaPolySmooth_addUI() {
|
||||
|
||||
mayaPolySmooth_removeUI();
|
||||
|
||||
// Make sure the "Edit Mesh" menu has been built
|
||||
global string $gPolygonsEditMeshMenu;
|
||||
string $editMeshCreateCmd = `menu -q -pmc $gPolygonsEditMeshMenu`;
|
||||
eval($editMeshCreateCmd);
|
||||
|
||||
// Add to the menu
|
||||
setParent -m $gPolygonsEditMeshMenu;
|
||||
menuItem -label "+ OSD Subdivide Meshes"
|
||||
-command "mayaPolySmooth({})"
|
||||
"mayaPolySmooth_menuItem";
|
||||
}
|
||||
|
||||
//
|
||||
// Remove the UI for the mayaPolySmooth plugin
|
||||
//
|
||||
global proc mayaPolySmooth_removeUI() {
|
||||
|
||||
if (`menuItem -ex "mayaPolySmooth_menuItem"`) {
|
||||
deleteUI -mi "mayaPolySmooth_menuItem";
|
||||
}
|
||||
}
|
||||
|
||||
global proc AEmayaPolySmoothTemplate( string $nodeName ) {
|
||||
|
||||
editorTemplate -beginScrollLayout;
|
||||
|
||||
editorTemplate -beginLayout "Subdivision Attributes" -collapse 0;
|
||||
|
||||
editorTemplate -addControl "displayMesh";
|
||||
editorTemplate -addControl "subdivisionLevels";
|
||||
editorTemplate -addControl "recommendedIsolation";
|
||||
editorTemplate -addControl "vertBoundaryMethod";
|
||||
editorTemplate -addControl "fvarBoundaryMethod";
|
||||
editorTemplate -addControl "fvarPropagateCorners";
|
||||
editorTemplate -addControl "smoothTriangles";
|
||||
editorTemplate -addControl "creaseMethod";
|
||||
|
||||
editorTemplate -endLayout;
|
||||
|
||||
editorTemplate -addExtraControls;
|
||||
|
||||
editorTemplate -endScrollLayout;
|
||||
}
|
||||
|
||||
// ===========================
|
||||
// COMMANDS
|
||||
// ===========================
|
||||
|
||||
//
|
||||
// Command to OSD Subdivide the selected or specified meshes
|
||||
//
|
||||
global proc string[] mayaPolySmooth(string $meshes[]) {
|
||||
|
||||
string $mayaPolySmoothNodes[];
|
||||
|
||||
// parameter to conditionally insert an intermediate mesh node before the
|
||||
// mayaPolySmooth node to allow editing the base mesh
|
||||
int $showBaseMesh = 1;
|
||||
|
||||
// Store off the original selection so can restore it below
|
||||
string $origSel[] = `ls -sl`;
|
||||
|
||||
// If no meshes specified on the commandline, then act on all selected meshes
|
||||
if (`size $meshes` == 0) {
|
||||
$meshes = `ls -sl -dag -type mesh`;
|
||||
}
|
||||
|
||||
// Loop over each specified mesh and add mayaPolySmooth mesh operator
|
||||
for ($mesh in $meshes) {
|
||||
// Create a temp mesh operation that will guarantee we have construction history
|
||||
string $tmpMeshOp[] = `polyTriangulate -name "dummyMeshOperation#" -ch true -nodeState 1 $mesh`;
|
||||
string $inMeshAttr[] = `listConnections -plugs true ($tmpMeshOp[0]+".inputPolymesh")`;
|
||||
string $outMeshAttr[] = `listConnections -plugs true ($tmpMeshOp[0]+".output")`;
|
||||
|
||||
// Insert base mesh node
|
||||
string $baseMeshShape;
|
||||
if ($showBaseMesh) {
|
||||
string $meshT[] = `listRelatives -parent $mesh`;
|
||||
$baseMeshShape = `createNode mesh -parent $meshT[0] -name ($mesh+"_base")`;
|
||||
setAttr ($baseMeshShape+".overrideEnabled") 1;
|
||||
setAttr ($baseMeshShape+".overrideShading") 0;
|
||||
connectAttr ($inMeshAttr[0]) ($baseMeshShape+".inMesh");
|
||||
$inMeshAttr[0] = ($baseMeshShape+".outMesh");
|
||||
}
|
||||
|
||||
// Create and connect the mayaPolySmooth node
|
||||
string $mayaPolySmooth = `createNode mayaPolySmooth`;
|
||||
connectAttr ($inMeshAttr[0]) ($mayaPolySmooth+".inputPolymesh");
|
||||
connectAttr -force ($mayaPolySmooth+".output") ($outMeshAttr[0]);
|
||||
|
||||
polyMergeUV -d 0.01 -ch 1 $mesh;
|
||||
|
||||
if ($showBaseMesh) {
|
||||
addAttr -ln "displayMesh" -at "enum" -en "Cage:Smooth:Cage+Smooth" -defaultValue 2 $mayaPolySmooth;
|
||||
setAttr -e-keyable true ($mayaPolySmooth+".displayMesh");
|
||||
expression -name ($mayaPolySmooth+"_expr") -string ($mesh+".visibility = ("+$mayaPolySmooth+".displayMesh != 0);\nif ("+$mayaPolySmooth+".displayMesh == 1)\n\t"+$mesh+".overrideDisplayType = 0;\nelse\n\t"+$mesh+".overrideDisplayType = 2;\n"+$baseMeshShape+".intermediateObject = ("+$mayaPolySmooth+".displayMesh == 1);") -alwaysEvaluate 0 -unitConversion "none";
|
||||
setAttr ($mesh+".overrideEnabled") 1;
|
||||
}
|
||||
|
||||
// Remove the temp mesh operation
|
||||
delete $tmpMeshOp[0];
|
||||
|
||||
// Append to the list of nodes that were created
|
||||
$mayaPolySmoothNodes[`size $mayaPolySmoothNodes`] = $mayaPolySmooth;
|
||||
}
|
||||
|
||||
// Restore original selection
|
||||
select $origSel;
|
||||
|
||||
// Return created mayaPolySmooth nodes
|
||||
return $mayaPolySmoothNodes;
|
||||
}
|
||||
|
||||
//
|
||||
// Clearnup the DAG from nodes created with mayaPolySmooth
|
||||
//
|
||||
global proc mayaPolySmoothCleanup() {
|
||||
|
||||
string $nodes[] = `ls -type mayaPolySmooth`;
|
||||
|
||||
for ($node in $nodes) {
|
||||
|
||||
string $mergeUVNodes[] = `listConnections -s on -sh on -t polyMergeUV ($node+".output")`;
|
||||
|
||||
string $expressionNodes[] = `listConnections -s on -t expression ($node+".displayMesh")`;
|
||||
|
||||
string $refinedNodes[] = `listConnections -s on -sh on -t mesh ($mergeUVNodes[0]+".output")`;
|
||||
|
||||
delete $node $mergeUVNodes[0] $refinedNodes[0] $expressionNodes[0];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user