Skip to content

Commit

Permalink
Merge pull request ImageEngine#1238 from andrewkaufman/nuke13
Browse files Browse the repository at this point in the history
Update for Nuke 13
  • Loading branch information
andrewkaufman authored Feb 17, 2022
2 parents 7f59e66 + 12091fe commit caf96d6
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 40 deletions.
4 changes: 2 additions & 2 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -2636,7 +2636,7 @@ if doConfigure :
os.path.basename( glEnv.subst( "$INSTALL_LIB_NAME" ) ),
] )

nukeEnv.Append( LIBS = [ nukeLibName, "boost_python$BOOST_LIB_SUFFIX" ] )
nukeEnv.Append( LIBS = [ nukeLibName, "boost_python" + boostPythonLibSuffix ] )

nukeEnv.Append(
CPPFLAGS = [
Expand Down Expand Up @@ -2733,7 +2733,7 @@ if doConfigure :

# nuke tests

nukeTest = nukeTestEnv.Command( "test/IECoreNuke/resultsPython.txt", nukeLibrary, "echo \"execfile( '$TEST_NUKE_SCRIPT' )\" | $NUKE_ROOT/Nuke${NUKE_MAJOR_VERSION}.${NUKE_MINOR_VERSION} -t" )
nukeTest = nukeTestEnv.Command( "test/IECoreNuke/resultsPython.txt", nukeLibrary, "$NUKE_ROOT/Nuke${NUKE_MAJOR_VERSION}.${NUKE_MINOR_VERSION} -t $TEST_NUKE_SCRIPT" )
NoCache( nukeTest )
nukeTestEnv.Depends( nukeTest, glob.glob( "test/IECoreNuke/*.py" ) )
nukeTestEnv.Depends( nukeTest, nukePythonModule )
Expand Down
6 changes: 0 additions & 6 deletions config/ie/options
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,6 @@ if targetApp=="nuke" :

nukeVersion = targetAppVersion
nukeReg = IEEnv.registry["apps"]["nuke"][nukeVersion][platform]

# nuke 12.2 ships its own USD so we link against that
if distutils.version.LooseVersion(nukeVersion) >= distutils.version.LooseVersion("12.2") :
USD_INCLUDE_PATH = os.path.join( nukeReg["location"], "include" )
USD_LIB_PATH = os.path.join( nukeReg["location"], nukeReg["libPaths"][0] )

NUKE_ROOT = nukeReg["location"]
NUKE_LICENSE_FILE = nukeReg["wrapperEnvVars"]["foundry_LICENSE"]
INSTALL_NUKELIB_NAME = os.path.join( appPrefix, "lib", "$IECORE_NAME-$IECORE_COMPATIBILITY_VERSION" )
Expand Down
2 changes: 1 addition & 1 deletion python/IECoreNuke/FnAxis.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import nuke
import imath
import IECore
from KnobAccessors import getKnobValue
from .KnobAccessors import getKnobValue

## This function set can be used to manipulate any nodes which have
# an axis knob. This includes the Axis, TransformGeo and Camera nodes.
Expand Down
2 changes: 1 addition & 1 deletion python/IECoreNuke/FnOpHolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import nuke

import IECoreNuke
import _IECoreNuke
from . import _IECoreNuke

class FnOpHolder( IECoreNuke.FnParameterisedHolder ) :

Expand Down
7 changes: 4 additions & 3 deletions python/IECoreNuke/FnParameterisedHolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@
import nuke

import IECore
from _IECoreNuke import _parameterisedHolderGetParameterisedResult
from _IECoreNuke import _parameterisedHolderSetModifiedParametersInput
from ._IECoreNuke import _parameterisedHolderGetParameterisedResult
from ._IECoreNuke import _parameterisedHolderSetModifiedParametersInput
import six

class FnParameterisedHolder :

def __init__( self, node ) :

if isinstance( node, basestring ) :
if isinstance( node, six.string_types ) :
self.__node = nuke.toNode( node )
else :
self.__node = node
Expand Down
6 changes: 3 additions & 3 deletions python/IECoreNuke/KnobConverters.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from __future__ import with_statement
import nuke
import IECore
from StringUtil import nukeFileSequence, ieCoreFileSequence
from .StringUtil import nukeFileSequence, ieCoreFileSequence

__parameterKnobConverters = []

Expand Down Expand Up @@ -236,15 +236,15 @@ def __createNumericVectorParameterKnob( knobHolder, parameter, knobName, knobLab
def __numericVectorParameterToKnob( knobHolder, parameter, knobName ):

knob = knobHolder.knobs()[knobName]
knob.setValue( " ".join( map( lambda v: str(v), parameter.getValue() ) ) )
knob.setValue( " ".join( [str(v) for v in parameter.getValue()] ) )

def __numericVectorParameterFromKnob( knobHolder, parameter, knobName ) :

dataVectorType = type( parameter.getValue() )
dataType = IECore.DataTraits.valueTypeFromSequenceType( dataVectorType )
values = knobHolder.knobs()[knobName].getText().strip()
if len(values) :
dataValues = map( lambda v: dataType(v), values.split() )
dataValues = [dataType(v) for v in values.split()]
parameter.setValue( dataVectorType( dataValues ) )
else :
parameter.setValue( dataVectorType() )
Expand Down
7 changes: 4 additions & 3 deletions python/IECoreNuke/StringUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
##########################################################################

import re
from six.moves import range

def __toFormatString( match ):
txt = match.group(0)
Expand All @@ -49,7 +50,7 @@ def __toNumberSign( match ):
if len(txt) :
cc = int(txt)
if txt[0] != '0' and cc > 1 :
raise RuntimeError, "Frame numbers padded with space is not supported!"
raise RuntimeError("Frame numbers padded with space is not supported!")
result = ""
for c in range( cc ) :
result = result + "#"
Expand All @@ -58,9 +59,9 @@ def __toNumberSign( match ):
## Converts IECore standard file sequence path to Nuke's syntax
def nukeFileSequence( ieCorefs ) :

return re.sub( "#+", __toFormatString, ieCorefs )
return re.sub( r"#+", __toFormatString, ieCorefs )

## Converts Nuke standard file sequence path to IECore's syntax
def ieCoreFileSequence( nukefs ) :

return re.sub( "%([0-9]*)d", __toNumberSign, nukefs )
return re.sub( r"%([0-9]*)d", __toNumberSign, nukefs )
18 changes: 9 additions & 9 deletions python/IECoreNuke/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@

__import__( "IECore" )

from _IECoreNuke import *
from ._IECoreNuke import *

from KnobAccessors import setKnobValue, getKnobValue
from FnAxis import FnAxis
from StringUtil import nukeFileSequence, ieCoreFileSequence
from KnobConverters import registerParameterKnobConverters, createKnobsFromParameter, setKnobsFromParameter, setParameterFromKnobs
from FnParameterisedHolder import FnParameterisedHolder
from UndoManagers import UndoState, UndoDisabled, UndoEnabled, UndoBlock
from TestCase import TestCase
from FnOpHolder import FnOpHolder
from .KnobAccessors import setKnobValue, getKnobValue
from .FnAxis import FnAxis
from .StringUtil import nukeFileSequence, ieCoreFileSequence
from .KnobConverters import registerParameterKnobConverters, createKnobsFromParameter, setKnobsFromParameter, setParameterFromKnobs
from .FnParameterisedHolder import FnParameterisedHolder
from .UndoManagers import UndoState, UndoDisabled, UndoEnabled, UndoBlock
from .TestCase import TestCase
from .FnOpHolder import FnOpHolder

__import__( "IECore" ).loadConfig( "CORTEX_STARTUP_PATHS", subdirectory = "IECoreNuke" )
6 changes: 3 additions & 3 deletions src/IECoreNuke/ClassParameterHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void ClassParameterHandler::setState( IECore::Parameter *parameter, const IECore
boost::python::object pythonParameter( ParameterPtr( const_cast<Parameter *>( parameter ) ) );
pythonParameter.attr( "setClass" )( className, classVersion, classSearchPathEnvVar );
}
catch( boost::python::error_already_set )
catch( boost::python::error_already_set &e )
{
PyErr_Print();
}
Expand Down Expand Up @@ -126,7 +126,7 @@ IECore::ObjectPtr ClassParameterHandler::getState( const IECore::Parameter *para
result->members()["__classVersion"] = new IECore::IntData( classVersion );
result->members()["__searchPathEnvVar"] = new IECore::StringData( searchPathEnvVar );
}
catch( boost::python::error_already_set )
catch( boost::python::error_already_set &e )
{
PyErr_Print();
}
Expand Down Expand Up @@ -234,7 +234,7 @@ void ClassParameterHandler::classChooserKnob( const IECore::Parameter *parameter
}

}
catch( boost::python::error_already_set )
catch( boost::python::error_already_set &e )
{
PyErr_Print();
}
Expand Down
6 changes: 3 additions & 3 deletions src/IECoreNuke/ClassVectorParameterHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void ClassVectorParameterHandler::setState( IECore::Parameter *parameter, const
boost::python::object pythonParameter( ParameterPtr( const_cast<Parameter *>( parameter ) ) );
pythonParameter.attr( "setClasses" )( classes );
}
catch( boost::python::error_already_set )
catch( boost::python::error_already_set &e )
{
PyErr_Print();
}
Expand Down Expand Up @@ -141,7 +141,7 @@ IECore::ObjectPtr ClassVectorParameterHandler::getState( const IECore::Parameter
result->members()["__classNames"] = classNames;
result->members()["__classVersions"] = classVersions;
}
catch( boost::python::error_already_set )
catch( boost::python::error_already_set &e )
{
PyErr_Print();
}
Expand Down Expand Up @@ -178,7 +178,7 @@ void ClassVectorParameterHandler::addEditKnobs( const IECore::Parameter *paramet
buildAddMenu( addKnob, parameter, parameterPath );
buildRemoveMenu( removeKnob, parameter, parameterPath );
}
catch( boost::python::error_already_set )
catch( boost::python::error_already_set &e )
{
PyErr_Print();
}
Expand Down
6 changes: 3 additions & 3 deletions src/IECoreNuke/DisplayIop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

#include "boost/bind/bind.hpp"
#include "boost/lexical_cast.hpp"
#include "boost/signal.hpp"
#include "boost/signals2.hpp"

using namespace boost::placeholders;
using namespace IECore;
Expand Down Expand Up @@ -124,11 +124,11 @@ class NukeDisplayDriver : public IECoreImage::ImageDisplayDriver
/// This signal is emitted when a new NukeDisplayDriver has been created.
/// This allows nuke nodes to pick up the new DisplayDrivers even when they're
/// created in some other code, such as a DisplayDriverServer.
typedef boost::signal<void( NukeDisplayDriver * )> InstanceCreatedSignal;
typedef boost::signals2::signal<void( NukeDisplayDriver * )> InstanceCreatedSignal;
static InstanceCreatedSignal instanceCreatedSignal;

/// This signal is emitted when this NukeDisplayDriver instance receives new data.
typedef boost::signal<void( NukeDisplayDriver *, const Imath::Box2i &box )> DataReceivedSignal;
typedef boost::signals2::signal<void( NukeDisplayDriver *, const Imath::Box2i &box )> DataReceivedSignal;
DataReceivedSignal dataReceivedSignal;

private :
Expand Down
2 changes: 1 addition & 1 deletion src/IECoreNuke/DrawableHolder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ IECoreGL::ConstScenePtr DrawableHolder::scene()
m_scene->setCamera( 0 );

}
catch( boost::python::error_already_set )
catch( boost::python::error_already_set &e )
{
IECorePython::ScopedGILLock gilLock;
PyErr_Print();
Expand Down
5 changes: 3 additions & 2 deletions test/IECoreNuke/SceneCacheReaderTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import IECore
import IECoreImage
import IECoreNuke
from six.moves import range

class SceneCacheReaderTest( IECoreNuke.TestCase ) :

Expand All @@ -60,7 +61,7 @@ def testLoadedScriptWithRetime( self ) :
nuke.scriptOpen("test/IECoreNuke/scripts/sceneCacheTest.nk" )
w = nuke.toNode("Write1")
frames = [ 1, 10, 20, 30, 40, 50, 60, 70, 80 ]
nuke.executeMultiple( [ w ], map( lambda f: (f,f,1), frames ) )
nuke.executeMultiple( [ w ], [(f,f,1) for f in frames] )
for f in frames :
imageA = IECore.Reader.create( "test/IECoreNuke/scripts/data/sceneCacheExpectedResults.%04d.exr" % f )()
imageB = IECore.Reader.create( "test/IECoreNuke/scripts/data/sceneCacheTestResults.%04d.exr" % f )()
Expand All @@ -83,7 +84,7 @@ def testUVMapping( self ):
nuke.scriptOpen("test/IECoreNuke/scripts/sceneCacheTestUV.nk" )
w = nuke.toNode("Write1")
frames = [ 1, 10, 20, 30, 40, 50 ]
nuke.executeMultiple( [ w ], map( lambda f: (f,f,1), frames ) )
nuke.executeMultiple( [ w ], [(f,f,1) for f in frames] )
for f in frames :
imageA = IECore.Reader.create( "test/IECoreNuke/scripts/data/sceneCacheExpectedUVResults.%04d.exr" % f )()
imageB = IECore.Reader.create( "test/IECoreNuke/scripts/data/sceneCacheTestResultsUV.%04d.exr" % f )()
Expand Down

0 comments on commit caf96d6

Please sign in to comment.