Skip to content

Commit

Permalink
Added TestForDDImageVersion.cxx to FindNuke.cmake so that we can work…
Browse files Browse the repository at this point in the history
…out which version of nuke we are building against. This now gets appended to the '$CMAKE_INSTALL_PREFIX/lib/nuke${Nuke_DDImageVersion}'. This makes it easier to build and run against multiple versions of nuke.

Added init.py and menu.py so that the ocio nuke plugins can be setup with the NUKE_PATH searchpath, to make it easier to test and integrate into our toolchains.

Updated the INSTALL file to reflect these changes.
  • Loading branch information
malcolmhumphreys committed Dec 13, 2010
1 parent 0077676 commit c95536a
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 31 deletions.
33 changes: 6 additions & 27 deletions INSTALL
Expand Up @@ -6,47 +6,26 @@ Python2.5 must be specified if you want to use the python bindings
> cd <YOUR_OCIO_DIR>
> mkdir -p build && cd build
> mkdir -p install
> env NDK_PATH=/net/apps/spinux1/foundry/nuke6.1v2/ cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_INSTALL_PREFIX=install -D OCIO_NAMESPACE=OpenColorIO_Nuke -D PYTHON=/usr/bin/python2.5 ../
> make -j8 && make install

In Nuke's init.py (and menu.py):

try:
print 'Setting up Local OpenColorIO'
ocioroot = <YOUR_OCIO_DIR>
sys.path.append(os.path.join(ocioroot, "build/install/lib/python'))
import PyOpenColorIO as OCIO

nuke.load(os.path.join(ocioroot, 'build/install/lib/nuke/OCIOColorSpace.so')
nuke.load(os.path.join(ocioroot, 'build/install/lib/nuke/OCIODisplay.so')
nuke.load(os.path.join(ocioroot, 'build/install/lib/nuke/OCIOFileTransform.so')
nuke.load(os.path.join(ocioroot, 'build/install/lib/nuke/OCIOLogConvert.so')

nuke.menu('Nodes').addMenu('Color').addCommand('OCIOColorSpace', 'nuke.createNode("OCIOColorSpace")')
nuke.menu('Nodes').addMenu('Color').addCommand('OCIODisplay', 'nuke.createNode("OCIODisplay")')
nuke.menu('Nodes').addMenu('Color').addCommand('OCIOFileTransform', 'nuke.createNode("OCIOFileTransform")')
nuke.menu('Nodes').addMenu('Color').addCommand('OCIOLogConvert', 'nuke.createNode("OCIOLogConvert")')
> env NDK_PATH=/net/apps/spinux1/foundry/nuke6.1v2/ cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_INSTALL_PREFIX=install -D OCIO_NAMESPACE=OpenColorIO_Nuke -D PYTHON=/usr/bin/python2.5 ../

except Exception,e:
print 'Error loading user OpenColorIO'
> make -j8 && make install

Set the ocio profile to use:
> setenv OCIO /net/homedirs/jeremys/git/OpenColorIO/configs/spivfx/config.ocio

Launch Nuke:
> setenv OCIO <PATH_TO_OCIO_PROFILE>/config.ocio
> env LD_LIBRARY_PATH=<YOUR_OCIO_DIR>/build/install/lib/ nuke
> setenv OCIO_ROOT=${PWD}/install
> setenv LD_LIBRARY_PATH=${OCIO_ROOT}/lib:${LD_LIBRARY_PATH}
> setenv NUKE_PATH=${OCIO_ROOT}/lib/nuke6.1v2:${OCIO_ROOT}/share/nuke:${NUKE_PATH}
> nuke

Launch nuke, then load the plugin (either interactively, or in init.py and menu.py respectively for the two commands):

Connect an image to the OCIOColorSpace node to test.




----------------------------------------------------------------------------------------------------------------------


OpenColorIO is set up for CMake ( http://www.cmake.org/cmake/help/cmake-2-8-docs.html ). On Unix, building should look like this:

$ mkdir build && cd build
Expand Down
9 changes: 9 additions & 0 deletions share/cmake/FindNuke.cmake
Expand Up @@ -85,3 +85,12 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS( "Nuke" DEFAULT_MSG
Nuke_LIBRARIES
Nuke_LIBRARY_DIR
)

SET( Nuke_DDImageVersion "" )
IF( NUKE_FOUND )
TRY_RUN(NUKE_VERSION_EXITCODE NUKE_VERSION_COMPILED
${CMAKE_BINARY_DIR} ${CMAKE_MODULE_PATH}/TestForDDImageVersion.cxx
COMPILE_DEFINITIONS "-I${Nuke_INCLUDE_DIR}"
RUN_OUTPUT_VARIABLE Nuke_DDImageVersion)
message(STATUS "Nuke_DDImageVersion: --${Nuke_DDImageVersion}--")
ENDIF()
7 changes: 7 additions & 0 deletions share/cmake/TestForDDImageVersion.cxx
@@ -0,0 +1,7 @@
#include <iostream>
#include "DDImage/ddImageVersionNumbers.h"
int main(int, char*[])
{
std::cout << kDDImageVersion;
return 0;
}
34 changes: 34 additions & 0 deletions share/nuke/init.py
@@ -0,0 +1,34 @@

import nuke

EBANNER = "OCIO Error: "

try:
import PyOpenColorIO as OCIO
except Exception, e:
print '%s%s' % (EBANNER, 'Loading OCIO python module')
print e

try:
nuke.load('OCIOColorSpace')
except Exception, e:
print '%s%s' % (EBANNER, 'Loading OCIOColorSpace')
print e

try:
nuke.load('OCIODisplay')
except Exception, e:
print '%s%s' % (EBANNER, 'Loading OCIODisplay')
print e

try:
nuke.load('OCIOFileTransform')
except Exception, e:
print '%s%s' % (EBANNER, 'loading OCIOFileTransform')
print e

try:
nuke.load('OCIOLogConvert')
except Exception, e:
print '%s%s' % (EBANNER, 'loading OCIOLogConvert')
print e
14 changes: 14 additions & 0 deletions share/nuke/menu.py
@@ -0,0 +1,14 @@

toolbar = nuke.toolbar('Nodes')

if nuke.pluginExists( 'OCIOColorSpace' ):
toolbar.addCommand( 'Color/OCIOColorSpace',"nuke.createNode('OCIOColorSpace')")

if nuke.pluginExists( 'OCIODisplay' ):
toolbar.addCommand( 'Color/OCIODisplay',"nuke.createNode('OCIODisplay')")

if nuke.pluginExists( 'OCIOFileTransform' ):
toolbar.addCommand( 'Color/OCIOFileTransform',"nuke.createNode('OCIOFileTransform')")

if nuke.pluginExists( 'OCIOLogConvert' ):
toolbar.addCommand( 'Color/OCIOLogConvert',"nuke.createNode('OCIOLogConvert')")
20 changes: 16 additions & 4 deletions src/nuke/CMakeLists.txt
Expand Up @@ -89,9 +89,21 @@ if( NUKE_FOUND )
DEPENDS NukeOCIOFileTransform
DEPENDS NukeOCIOLogConvert
)
install(TARGETS NukeOCIOColorSpace DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/nuke)
install(TARGETS NukeOCIODisplay DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/nuke)
install(TARGETS NukeOCIOLogConvert DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/nuke)
install(TARGETS NukeOCIOFileTransform DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/nuke)

install(TARGETS NukeOCIOColorSpace
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/nuke${Nuke_DDImageVersion})

install(TARGETS NukeOCIODisplay
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/nuke${Nuke_DDImageVersion})

install(TARGETS NukeOCIOLogConvert
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/nuke${Nuke_DDImageVersion})

install(TARGETS NukeOCIOFileTransform
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/nuke${Nuke_DDImageVersion})

install(DIRECTORY ${CMAKE_SOURCE_DIR}/share/nuke
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/
PATTERN .svn EXCLUDE)

endif()

0 comments on commit c95536a

Please sign in to comment.