|
| 1 | +////////////////////////////////////////////////////////////////////////// |
| 2 | +// |
| 3 | +// Copyright (c) 2021, Cinesite VFX Ltd. All rights reserved. |
| 4 | +// |
| 5 | +// Redistribution and use in source and binary forms, with or without |
| 6 | +// modification, are permitted provided that the following conditions are |
| 7 | +// met: |
| 8 | +// |
| 9 | +// * Redistributions of source code must retain the above |
| 10 | +// copyright notice, this list of conditions and the following |
| 11 | +// disclaimer. |
| 12 | +// |
| 13 | +// * Redistributions in binary form must reproduce the above |
| 14 | +// copyright notice, this list of conditions and the following |
| 15 | +// disclaimer in the documentation and/or other materials provided with |
| 16 | +// the distribution. |
| 17 | +// |
| 18 | +// * Neither the name of John Haddon nor the names of |
| 19 | +// any other contributors to this software may be used to endorse or |
| 20 | +// promote products derived from this software without specific prior |
| 21 | +// written permission. |
| 22 | +// |
| 23 | +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS |
| 24 | +// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
| 25 | +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 26 | +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
| 27 | +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 28 | +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 29 | +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 30 | +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 31 | +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 32 | +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 33 | +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 34 | +// |
| 35 | +////////////////////////////////////////////////////////////////////////// |
| 36 | + |
| 37 | +#ifndef GAFFERSCENE_FILTERQUERY_H |
| 38 | +#define GAFFERSCENE_FILTERQUERY_H |
| 39 | + |
| 40 | +#include "GafferScene/Export.h" |
| 41 | +#include "GafferScene/TypeIds.h" |
| 42 | + |
| 43 | +#include "Gaffer/ComputeNode.h" |
| 44 | +#include "Gaffer/NumericPlug.h" |
| 45 | +#include "Gaffer/StringPlug.h" |
| 46 | +#include "Gaffer/TypedObjectPlug.h" |
| 47 | + |
| 48 | +namespace GafferScene |
| 49 | +{ |
| 50 | + |
| 51 | +IE_CORE_FORWARDDECLARE( ScenePlug ) |
| 52 | +IE_CORE_FORWARDDECLARE( FilterPlug ) |
| 53 | + |
| 54 | +class GAFFERSCENE_API FilterQuery : public Gaffer::ComputeNode |
| 55 | +{ |
| 56 | + |
| 57 | + public : |
| 58 | + |
| 59 | + FilterQuery( const std::string &name=defaultName<FilterQuery>() ); |
| 60 | + ~FilterQuery() override; |
| 61 | + |
| 62 | + GAFFER_NODE_DECLARE_TYPE( GafferScene::FilterQuery, FilterQueryTypeId, ComputeNode ); |
| 63 | + |
| 64 | + ScenePlug *scenePlug(); |
| 65 | + const ScenePlug *scenePlug() const; |
| 66 | + |
| 67 | + FilterPlug *filterPlug(); |
| 68 | + const FilterPlug *filterPlug() const; |
| 69 | + |
| 70 | + Gaffer::StringPlug *locationPlug(); |
| 71 | + const Gaffer::StringPlug *locationPlug() const; |
| 72 | + |
| 73 | + Gaffer::BoolPlug *exactMatchPlug(); |
| 74 | + const Gaffer::BoolPlug *exactMatchPlug() const; |
| 75 | + |
| 76 | + Gaffer::BoolPlug *descendantMatchPlug(); |
| 77 | + const Gaffer::BoolPlug *descendantMatchPlug() const; |
| 78 | + |
| 79 | + Gaffer::BoolPlug *ancestorMatchPlug(); |
| 80 | + const Gaffer::BoolPlug *ancestorMatchPlug() const; |
| 81 | + |
| 82 | + Gaffer::StringPlug *closestAncestorPlug(); |
| 83 | + const Gaffer::StringPlug *closestAncestorPlug() const; |
| 84 | + |
| 85 | + void affects( const Gaffer::Plug *input, AffectedPlugsContainer &outputs ) const override; |
| 86 | + |
| 87 | + protected : |
| 88 | + |
| 89 | + Gaffer::IntPlug *matchPlug(); |
| 90 | + const Gaffer::IntPlug *matchPlug() const; |
| 91 | + |
| 92 | + // Used in the computation of `ancestorMatchPlug()`. This uses |
| 93 | + // `${scene:path}` rather than `locationPlug()` so can be used in |
| 94 | + // recursive computes to inherit results from ancestor contexts. |
| 95 | + Gaffer::StringPlug *closestAncestorInternalPlug(); |
| 96 | + const Gaffer::StringPlug *closestAncestorInternalPlug() const; |
| 97 | + |
| 98 | + void hash( const Gaffer::ValuePlug *output, const Gaffer::Context *context, IECore::MurmurHash &h ) const override; |
| 99 | + void compute( Gaffer::ValuePlug *output, const Gaffer::Context *context ) const override; |
| 100 | + Gaffer::ValuePlug::CachePolicy computeCachePolicy( const Gaffer::ValuePlug *output ) const override; |
| 101 | + |
| 102 | + static size_t g_firstPlugIndex; |
| 103 | + |
| 104 | +}; |
| 105 | + |
| 106 | +IE_CORE_DECLAREPTR( FilterQuery ) |
| 107 | + |
| 108 | +} // namespace GafferScene |
| 109 | + |
| 110 | +#endif // GAFFERSCENE_FILTERQUERY_H |
0 commit comments