// ExrChannelNameToNuke.h // Copyright (c) 2016 The Foundry Visionmongers Ltd. All Rights Reserved. // Created by Peter Crossley #ifndef DDImage_ExrChannelNameToNuke_h #define DDImage_ExrChannelNameToNuke_h #include #include #include #include // Class for converting an Exr channel name into a Nuke channel name // Stores the channel, layer and view determined from an exr // channel name. class ExrChannelNameToNuke { public: // Default constructor for std::map ExrChannelNameToNuke() {} // Construct from prefixed exr channel name ExrChannelNameToNuke(const char* name, const std::vector& views) { setFromPrefixedExrName(name, views); } //! Construct from prefixed exr channel name with collision avoidance. //! 'fileChannelNames' should contain the full set of prefixed channel names //! in the same EXR file/part. This is used to detect cases where both an //! uppercase ".R"/".G"/".B"/".A" channel AND a lowercase ".red"/".green"/ //! ".blue"/".alpha" channel exist under the same layer prefix - in which //! case the R/G/B/A -> red/green/blue/alpha conversion is skipped to keep //! the two channels distinct in Nuke. ExrChannelNameToNuke(const char* name, const std::vector& views, const std::set& fileChannelNames) { setFromPrefixedExrName(name, views, fileChannelNames); } /*! Convert the channel name from the exr file into a nuke name. */ void setFromPrefixedExrName(const char* channelname, const std::vector& views); //! Same as the above but with collision avoidance against the supplied set //! of channel names from the same file. See the corresponding constructor //! comment for details. void setFromPrefixedExrName(const char* channelname, const std::vector& views, const std::set& fileChannelNames); std::string nukeChannelName() const; std::string view() const { return _view; } bool hasLayer() const { return !_layer.empty(); } bool hasView() const { return !_view.empty(); } private: std::string _chan; std::string _layer; std::string _view; }; #endif // DDImage_ExrChannelNameToNuke_h