diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ed4a9b5dc4..c17e5abddc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -154,12 +154,6 @@ jobs: echo CORTEX_DEPENDENCIES_HASH=`python config/installDependencies.py --archiveURL ${{ matrix.dependenciesURL }} --dependenciesDir ${{ env.CORTEX_BUILD_NAME }} --outputFormat "{archiveDigest}"` >> $GITHUB_ENV shell: bash - - name: Install 3Delight - run: | - python ./.github/workflows/main/installDelight.py - echo DELIGHT=$GITHUB_WORKSPACE/3delight >> $GITHUB_ENV - shell: bash - - name: Cache uses: actions/cache@v3 with: diff --git a/.github/workflows/main/installDelight.py b/.github/workflows/main/installDelight.py deleted file mode 100644 index befa08bf5b..0000000000 --- a/.github/workflows/main/installDelight.py +++ /dev/null @@ -1,90 +0,0 @@ -import sys -import os -import shutil -import subprocess - -if sys.version_info[0] < 3 : - from urllib import urlretrieve -else : - from urllib.request import urlretrieve - -delightVersion="1.1.12" -delightDirectory="free/beta/2018-11-01-oIDoJTpO" - -baseUrl = "https://3delight-downloads.s3-us-east-2.amazonaws.com" - -if sys.platform.startswith("linux") : # pre Python 3.3 the major version is added at the end - package="3DelightNSI-{}-Linux-x86_64".format( delightVersion ) - - url = "{baseUrl}/{delightDirectory}/{package}.tar.xz".format( - baseUrl = baseUrl, - delightDirectory = delightDirectory, - package = package - ) - - print( "Downloading 3Delight \"{}\"".format( url ) ) - archiveFileName, headers = urlretrieve( url ) - - exitStatus = os.system( "tar -xf {} -C .".format( archiveFileName ) ) - if exitStatus != 0 : - exit( exitStatus ) - - shutil.copytree( "./{}/3delight/Linux-x86_64".format( package ), "./3delight" ) - -elif sys.platform == "darwin" : - package="3DelightNSI-{}-Darwin-Universal".format( delightVersion ) - - url = "{baseUrl}/{delightDirectory}/{package}.dmg".format( - baseUrl = baseUrl, - delightDirectory = delightDirectory, - package = package - ) - - print( "Downloading 3Delight \"{}\"".format( url ) ) - archiveFileName, headers = urlretrieve( url ) - - subprocess.check_call( - [ - "sudo", - "hdiutil", - "mount", - archiveFileName, - ] - ) - subprocess.check_call( - [ - "sudo", - "installer", - "-pkg", - "/Volumes/3Delight NSI " - "{delightVersion}/3DelightNSI-{delightVersion}-Darwin-x86_64.pkg".format( - delightVersion = delightVersion - ), - "-target", - "/", - ] - ) - subprocess.check_call( - [ - "sudo", - "mv", - "/Applications/3Delight", - "./3delight", - ] - ) - - -elif sys.platform == "win32": - package = "3DelightNSI-{}-setup.exe".format( delightVersion ) - - url = "{baseUrl}/{delightDirectory}/{package}".format( - baseUrl = baseUrl, - delightDirectory = delightDirectory, - package = package - ) - - print( "Downloading 3Delight \"{}\"".format( url ) ) - archiveFileName, headers = urlretrieve( url ) - - subprocess.check_call( [ archiveFileName, "/VERYSILENT", "/DIR=3delight" ] ) - diff --git a/.github/workflows/main/options.posix b/.github/workflows/main/options.posix index 8ce444fb02..b79fdb742b 100644 --- a/.github/workflows/main/options.posix +++ b/.github/workflows/main/options.posix @@ -9,8 +9,6 @@ build = "./" + os.environ.get( "CORTEX_BUILD_NAME" ) INSTALL_PREFIX = build INSTALL_DOC_DIR = build + "/doc" -INSTALL_RMANPROCEDURAL_NAME = build + "/build/renderMan/procedurals/iePython" -INSTALL_RMANDISPLAY_NAME = build + "/renderMan/displayDrivers/ieDisplay" INSTALL_PYTHON_DIR = build + "/python" INSTALL_IECORE_OPS = "" @@ -64,7 +62,6 @@ USD_LIB_PREFIX = "usd_" # Renderers # ========= -RMAN_ROOT = os.environ["DELIGHT"] APPLESEED_ROOT = deps + "/appleseed" APPLESEED_INCLUDE_PATH = deps + "/appleseed/include" APPLESEED_LIB_PATH = deps + "/appleseed/lib" diff --git a/.github/workflows/main/options.windows b/.github/workflows/main/options.windows index 90307d6cba..6b32021728 100644 --- a/.github/workflows/main/options.windows +++ b/.github/workflows/main/options.windows @@ -8,8 +8,6 @@ build = os.environ.get( "CORTEX_BUILD_NAME" ) INSTALL_PREFIX = build INSTALL_DOC_DIR = build + "\\doc" -INSTALL_RMANPROCEDURAL_NAME = build + "\\build\\renderMan\\procedurals\\iePython" -INSTALL_RMANDISPLAY_NAME = build + "\\renderMan\\displayDrivers\\ieDisplay" INSTALL_PYTHON_DIR = build + "\\python" INSTALL_IECORE_OPS = "" @@ -52,8 +50,6 @@ DOXYGEN = deps + "\\doxygen\\doxygen.exe" # Renderers # ========= -RMAN_ROOT = os.environ["DELIGHT"] - APPLESEED_ROOT = deps + "\\appleseed" APPLESEED_INCLUDE_PATH = deps + "\\appleseed\\include" APPLESEED_LIB_PATH = deps + "\\appleseed\\lib" diff --git a/SConstruct b/SConstruct index bec1a8814f..cdc8f4bba0 100644 --- a/SConstruct +++ b/SConstruct @@ -339,14 +339,6 @@ o.Add( "", ) -# Renderman options - -o.Add( - "RMAN_ROOT", - "The directory in which your RenderMan renderer is installed.", - "", -) - # Nuke options o.Add( @@ -711,12 +703,6 @@ o.Add( "$INSTALL_PREFIX/glsl", ) -o.Add( - "INSTALL_RMANDISPLAY_NAME", - "The name under which to install the renderman displays.", - "$INSTALL_PREFIX/rmanDisplays/$IECORE_NAME", -) - o.Add( "INSTALL_MEL_DIR", "The directory in which to install mel scripts.", @@ -2133,43 +2119,6 @@ if doConfigure : NoCache( vdbTest ) vdbTestEnv.Alias( "testVDB", vdbTest ) -########################################################################################### -# Build and install the renderman display driver -########################################################################################### - -if doConfigure : - - riDisplayDriverEnv = env.Clone( IECORE_NAME = "ieDisplay", SHLIBPREFIX="" ) - riDisplayDriverEnv.Append( CXXFLAGS = [ systemIncludeArgument, "$RMAN_ROOT/include" ] ) - - c = configureSharedLibrary( riDisplayDriverEnv ) - if not c.CheckCXXHeader( "ndspy.h" ) : - - sys.stderr.write( "WARNING : ndspy.h not found - check RMAN_ROOT.\n" ) - c.Finish() - - else : - - c.Finish() - - # we can't append this before configuring, as then it gets built as - # part of the configure process - riDisplayDriverEnv.Append( - LIBS = [ - os.path.basename( coreEnv.subst( "$INSTALL_LIB_NAME" ) ), - os.path.basename( imageEnv.subst( "$INSTALL_LIB_NAME" ) ), - ] - ) - - riDisplayDriver = riDisplayDriverEnv.SharedLibrary( "src/rmanDisplays/ieDisplay/" + os.path.basename( riDisplayDriverEnv.subst( "$INSTALL_RMANDISPLAY_NAME" ) ), "src/rmanDisplays/ieDisplay/IEDisplay.cpp" ) - riDisplayDriverInstall = riDisplayDriverEnv.Install( os.path.dirname( riDisplayDriverEnv.subst( "$INSTALL_RMANDISPLAY_NAME" ) ), riDisplayDriver ) - riDisplayDriverEnv.NoCache( riDisplayDriverInstall ) - riDisplayDriverEnv.AddPostAction( riDisplayDriverInstall, lambda target, source, env : makeLibSymLinks( riDisplayDriverEnv, libNameVar="INSTALL_RMANDISPLAY_NAME" ) ) - riDisplayDriverEnv.Alias( "install", riDisplayDriverInstall ) - riDisplayDriverEnv.Alias( "installRI", riDisplayDriverInstall ) - - Default( [ riDisplayDriver ] ) - ########################################################################################### # Build, install and test the optional CoreGL library and bindings ########################################################################################### diff --git a/config/ie/options b/config/ie/options index 8a3e5d723e..ae134b7267 100644 --- a/config/ie/options +++ b/config/ie/options @@ -252,20 +252,6 @@ if targetApp : else: appPrefix = os.path.join( installPrefix, targetApp, targetAppMajorVersion ) -# find 3delight. we only build the 3delight stuff if the compiler we're building with is suitable. -dlReg = None -dlVersion = getOption( "DL_VERSION", os.environ.get( "DL_VERSION", None ) ) -try : - dlReg = IEEnv.registry["apps"]["3delight"][dlVersion][platform] - if dlReg["compiler"]==compiler : - RMAN_ROOT = dlReg["location"] - os.environ["DELIGHT_CONF"] = "/software/config/3delight" - - # Add ribdepends location to path - os.environ["PATH"] = os.path.join( RMAN_ROOT, "bin" ) + ":" + os.environ["PATH"] -except : - pass - appleseedReg = None appleseedVersion = getOption( "APPLESEED_VERSION", os.environ.get("APPLESEED_VERSION", "") ) try : @@ -482,8 +468,6 @@ testLibs = [ os.path.join( pythonReg["location"], compiler, compilerVersion, "lib" ), os.path.join( compilerReg["location"], "lib" ), ] -if dlReg : - testLibs.append( dlReg["location"] + "/lib" ) if appleseedReg : testLibs.extend( [ APPLESEED_LIB_PATH, OSL_LIB_PATH, OIIO_LIB_PATH ] ) TEST_LIBPATH = ":".join( testLibs ) @@ -500,16 +484,9 @@ if targetApp : INSTALL_LIB_NAME = os.path.join( appPrefix, "lib", "$IECORE_NAME-$IECORE_COMPATIBILITY_VERSION" ) INSTALL_PYTHONLIB_NAME = os.path.join( appPrefix, "lib", "$IECORE_NAME-$IECORE_COMPATIBILITY_VERSION-python$PYTHON_VERSION" ) INSTALL_PYTHON_DIR = os.path.join( appPrefix, "python" ) - INSTALL_RMANLIB_NAME = os.path.join( appPrefix, "lib", "$IECORE_NAME-$IECORE_COMPATIBILITY_VERSION" ) INSTALL_APPLESEEDLIB_NAME = os.path.join( appPrefix, "lib", "$IECORE_NAME-$IECORE_COMPATIBILITY_VERSION" ) INSTALL_ALEMBICLIB_NAME = os.path.join( appPrefix, "lib", "$IECORE_NAME-$IECORE_COMPATIBILITY_VERSION" ) INSTALL_USDLIB_NAME = os.path.join( appPrefix, "lib", "$IECORE_NAME-$IECORE_COMPATIBILITY_VERSION" ) - # we don't want to build the renderman procedurals when we build apps, as otherwise they end - # up causing linking conflicts at rendertime. this is because the procedural would be linking to the - # boost version an app needs, whereas the other libraries are linking to the correct boost version for - # 3delight, so we just install the procedurals into a temp directory where they can't do any harm. - INSTALL_RMANPROCEDURAL_NAME = os.path.join( "tmp", os.environ['USER'], "unwantedRManProcedurals/$IECORE_NAME-$IECORE_COMPATIBILITY_VERSION" ) - INSTALL_RMANDISPLAY_NAME = os.path.join( "tmp", os.environ['USER'], "unwantedRManDisplays/$IECORE_NAME-$IECORE_COMPATIBILITY_VERSION" ) INSTALL_APPLESEEDOUTPUTDRIVER_NAME = os.path.join( "tmp", os.environ['USER'], "unwantedAppleseedDrivers/$IECORE_NAME-$IECORE_COMPATIBILITY_VERSION" ) else : INSTALL_HEADER_DIR = os.path.join( basePrefix, "include" ) @@ -517,12 +494,6 @@ else : INSTALL_LIB_NAME = os.path.join( basePrefix, "lib", compiler, compilerVersion, "$IECORE_NAME-$IECORE_COMPATIBILITY_VERSION" ) INSTALL_PYTHONLIB_NAME = os.path.join( basePrefix, "lib", compiler, compilerVersion, "$IECORE_NAME-$IECORE_COMPATIBILITY_VERSION-python$PYTHON_VERSION" ) INSTALL_PYTHON_DIR = os.path.join( basePrefix, "python", pythonVersion, compiler, compilerVersion ) - # We use basePrefix for IECoreRI, but dlPrefix for the renderman procedurals. See the note in - # the dlReg section for an explanation. - INSTALL_RMANLIB_NAME = os.path.join( basePrefix, "lib", compiler, compilerVersion, "$IECORE_NAME-$IECORE_COMPATIBILITY_VERSION" ) - if dlVersion: - INSTALL_RMANPROCEDURAL_NAME = os.path.join( basePrefix, "3delight", dlVersion, "procedurals", "python", "$PYTHON_VERSION", compiler, compilerVersion, "$IECORE_NAME" ) - INSTALL_RMANDISPLAY_NAME = os.path.join( basePrefix, "3delight", dlVersion, "displayDrivers", compiler, compilerVersion, "$IECORE_NAME" ) INSTALL_APPLESEEDLIB_NAME = os.path.join( basePrefix, "appleseed", appleseedVersion, "lib", compiler, compilerVersion, "$IECORE_NAME-$IECORE_COMPATIBILITY_VERSION" ) INSTALL_APPLESEEDOUTPUTDRIVER_NAME = os.path.join( basePrefix, "appleseed", appleseedVersion, "plugins", compiler, compilerVersion, "$IECORE_NAME" ) INSTALL_ALEMBICLIB_NAME = os.path.join( basePrefix, "lib", compiler, compilerVersion, "$IECORE_NAME-$IECORE_COMPATIBILITY_VERSION" ) diff --git a/config/installDependencies.py b/config/installDependencies.py index ecf7983717..2e43d747c5 100755 --- a/config/installDependencies.py +++ b/config/installDependencies.py @@ -114,7 +114,6 @@ os.path.join( "lib", "IECore*" ), os.path.join( "python", "IECore*" ), os.path.join( "resources", "IECore*" ), - "renderMan", "procedurals", ] : for f in glob.glob( os.path.join( args.dependenciesDir, pattern ) ) : diff --git a/src/rmanDisplays/ieDisplay/IEDisplay.cpp b/src/rmanDisplays/ieDisplay/IEDisplay.cpp deleted file mode 100644 index 35ea6f15d2..0000000000 --- a/src/rmanDisplays/ieDisplay/IEDisplay.cpp +++ /dev/null @@ -1,380 +0,0 @@ -////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2010-2013, Image Engine Design Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of Image Engine Design nor the names of any -// other contributors to this software may be used to endorse or -// promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////// - -#include - -#include "ndspy.h" - -#include "IECore/MessageHandler.h" -#include "IECore/SimpleTypedData.h" -#include "IECore/VectorTypedData.h" - -#include "IECoreImage/DisplayDriver.h" - -using namespace std; -using namespace Imath; -using namespace IECore; - -// deal with UserParameter naming differences between prman and 3delight -#ifdef PRMANEXPORT - -#define UP_VALUETYPE vtype -#define UP_VALUECOUNT vcount - -#else - -#define UP_VALUETYPE valueType -#define UP_VALUECOUNT valueCount - -#endif - -extern "C" -{ - -PtDspyError DspyImageOpen( PtDspyImageHandle *image, const char *driverName, const char *fileName, int width, int height, int paramcount, const UserParameter *parameters, int formatCount, PtDspyDevFormat *format, PtFlagStuff *flags ) -{ - - *image = nullptr; - - // get channel names - - vector channels; - - if( formatCount == 1 ) - { - channels.push_back( "R" ); - } - else if( formatCount == 3 ) - { - channels.push_back( "R" ); - channels.push_back( "G" ); - channels.push_back( "B" ); - } - else if( formatCount == 4 ) - { - channels.push_back( "R" ); - channels.push_back( "G" ); - channels.push_back( "B" ); - channels.push_back( "A" ); - } - else - { - msg( Msg::Error, "Dspy::imageOpen", "Invalid number of channels!" ); - return PkDspyErrorBadParams; - } - for( int i = 0; i < formatCount; i++ ) - { - format[i].type = PkDspyFloat32 | PkDspyByteOrderNative; - } - - // process the parameter list. we use some of the parameters to help determine - // the display and data windows, and the others we convert ready to passed to - // DisplayDriver::create(). - - V2i originalSize( width, height ); - V2i origin( 0 ); - - CompoundDataPtr convertedParameters = new CompoundData; - - for( int p = 0; p < paramcount; p++ ) - { - if ( !strcmp( parameters[p].name, "OriginalSize" ) && parameters[p].UP_VALUETYPE == (char)'i' && parameters[p].UP_VALUECOUNT == (char)2 && parameters[p].nbytes == (int) (parameters[p].UP_VALUECOUNT * sizeof(int)) ) - { - originalSize.x = static_cast(parameters[p].value)[0]; - originalSize.y = static_cast(parameters[p].value)[1]; - } - else if ( !strcmp( parameters[p].name, "origin" ) && parameters[p].UP_VALUETYPE == (char)'i' && parameters[p].UP_VALUECOUNT == (char)2 && parameters[p].nbytes == (int)(parameters[p].UP_VALUECOUNT * sizeof(int)) ) - { - origin.x = static_cast(parameters[p].value)[0]; - origin.y = static_cast(parameters[p].value)[1]; - } - else if( 0 == strcmp( parameters[p].name, "layername" ) && parameters[p].UP_VALUETYPE == 's' ) - { - const string layerName = *(const char **)(parameters[p].value); - if( !layerName.empty() ) - { - for( auto &channel : channels ) - { - channel = layerName + "." + channel; - } - } - } - else - { - DataPtr newParam; - - if ( !parameters[p].nbytes ) - { - continue; - } - - const int *pInt; - const float *pFloat; - char const **pChar; - - // generic converter - switch( parameters[p].UP_VALUETYPE ) - { - case 'i': - // sanity check - if ( parameters[p].nbytes / parameters[p].UP_VALUECOUNT != sizeof(int) ) - { - msg( Msg::Error, "Dspy::imageOpen", "Invalid int data size" ); - continue; - } - pInt = static_cast(parameters[p].value); - if ( parameters[p].UP_VALUECOUNT == 1 ) - { - newParam = new IntData( pInt[0] ); - } - else - { - std::vector< int > newVec( pInt, pInt + parameters[p].UP_VALUECOUNT ); - newParam = new IntVectorData( newVec ); - } - break; - case 'f': - if ( parameters[p].nbytes / parameters[p].UP_VALUECOUNT != sizeof(float) ) - { - msg( Msg::Error, "Dspy::imageOpen", "Invalid float data size" ); - continue; - } - pFloat = static_cast(parameters[p].value); - if ( parameters[p].UP_VALUECOUNT == 1 ) - { - newParam = new FloatData( pFloat[0] ); - } - else - { - std::vector< float > newVec( pFloat, pFloat + parameters[p].UP_VALUECOUNT ); - newParam = new FloatVectorData( newVec ); - } - break; - case 's': - pChar = (const char **)(parameters[p].value); - if ( parameters[p].UP_VALUECOUNT == 1 ) - { - newParam = new StringData( pChar[0] ); - } - else - { - StringVectorDataPtr newStringVec = new StringVectorData(); - for ( int s = 0; s < parameters[p].UP_VALUECOUNT; s++ ) - { - newStringVec->writable().push_back( pChar[s] ); - } - newParam = newStringVec; - } - break; - default : - // we shouldn't ever get here... - break; - } - if( newParam ) - { - convertedParameters->writable()[ parameters[p].name ] = newParam; - } - } - } - - convertedParameters->writable()[ "fileName" ] = new StringData( fileName ); - - // calculate display and data windows - - Box2i displayWindow( - V2i( 0 ), - originalSize - V2i( 1 ) - ); - - Box2i dataWindow( - origin, - origin + V2i( width - 1, height - 1) - ); - - // create the display driver - - IECoreImage::DisplayDriverPtr dd = nullptr; - try - { - const StringData *driverType = convertedParameters->member( "driverType", true /* throw if missing */ ); - dd = IECoreImage::DisplayDriver::create( driverType->readable(), displayWindow, dataWindow, channels, convertedParameters ); - } - catch( std::exception &e ) - { - msg( Msg::Error, "Dspy::imageOpen", e.what() ); - return PkDspyErrorUnsupported; - } - - if( !dd ) - { - msg( Msg::Error, "Dspy::imageOpen", "DisplayDriver::create returned 0." ); - return PkDspyErrorUnsupported; - } - - // update flags and return - - if( dd->scanLineOrderOnly() ) - { - flags->flags |= PkDspyFlagsWantsScanLineOrder; - } - - dd->addRef(); // this will be removed in imageClose() - *image = (PtDspyImageHandle)dd.get(); - return PkDspyErrorNone; - -} - - -PtDspyError DspyImageQuery( PtDspyImageHandle image, PtDspyQueryType type, int size, void *data ) -{ - IECoreImage::DisplayDriver *dd = static_cast( image ); - - if( type == PkRedrawQuery ) - { - if( (!dd->scanLineOrderOnly()) && dd->acceptsRepeatedData() ) - { - ((PtDspyRedrawInfo *)data)->redraw = 1; - } - else - { - ((PtDspyRedrawInfo *)data)->redraw = 0; - } - return PkDspyErrorNone; - } - -#ifndef PRMANEXPORT - - // 3delight extensions - - if( type == PkProgressiveQuery ) - { - if( (!dd->scanLineOrderOnly()) && dd->acceptsRepeatedData() ) - { - ((PtDspyProgressiveInfo *)data)->acceptProgressive = 1; - } - else - { - ((PtDspyProgressiveInfo *)data)->acceptProgressive = 0; - } - return PkDspyErrorNone; - } - -#endif - - return PkDspyErrorUnsupported; -} - -PtDspyError DspyImageData( PtDspyImageHandle image, int xMin, int xMaxPlusOne, int yMin, int yMaxPlusOne, int entrySize, const unsigned char *data ) -{ - IECoreImage::DisplayDriver *dd = static_cast( image ); - Box2i dataWindow = dd->dataWindow(); - - // convert coordinates from cropped image to original image coordinates. - Box2i box( V2i( xMin + dataWindow.min.x, yMin + dataWindow.min.y ), V2i( xMaxPlusOne - 1 + dataWindow.min.x, yMaxPlusOne - 1 + dataWindow.min.y ) ); - int channels = dd->channelNames().size(); - int blockSize = (xMaxPlusOne - xMin) * (yMaxPlusOne - yMin); - int bufferSize = channels * blockSize; - - if( entrySize % sizeof(float) ) - { - msg( Msg::Error, "Dspy::imageData", "The entry size is not multiple of sizeof(float)!" ); - return PkDspyErrorUnsupported; - } - - if( entrySize == (int)(channels*sizeof(float)) ) - { - try - { - dd->imageData( box, (const float *)data, bufferSize ); - } - catch( std::exception &e ) - { - if( strcmp( e.what(), "stop" ) == 0 ) - { - /// \todo I would prefer DisplayDriver::imageData to have a return - /// value which could be used to request stop/continue behaviour. - /// prman doesn't seem to support PkDspyErrorStop, which should - /// also be resolved at some point. -#ifdef PRMANEXPORT - return PkDspyErrorUndefined; -#else - return PkDspyErrorStop; -#endif - } - else - { - msg( Msg::Error, "Dspy::imageData", e.what() ); - return PkDspyErrorUndefined; - } - } - } - else - { - msg( Msg::Error, "Dspy::imageData", "Unexpected entry size value!" ); - return PkDspyErrorBadParams; - } - return PkDspyErrorNone; -} - -PtDspyError DspyImageClose( PtDspyImageHandle image ) -{ - if ( !image ) - { - return PkDspyErrorNone; - } - - IECoreImage::DisplayDriver *dd = static_cast( image ); - try - { - dd->imageClose(); - } - catch( std::exception &e ) - { - msg( Msg::Error, "Dspy::imageClose", e.what() ); - } - - try - { - dd->removeRef(); - } - catch( std::exception &e ) - { - msg( Msg::Error, "DspyImageData", e.what() ); - return PkDspyErrorBadParams; - } - - return PkDspyErrorNone; -} - -} // extern "C"