Skip to content

Commit 36742bf

Browse files
committed
Merge branch '0.59_maintenance'
2 parents 263a09c + 8295c3a commit 36742bf

File tree

30 files changed

+2681
-132
lines changed

30 files changed

+2681
-132
lines changed

Changes.md

+47
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,43 @@ Build
115115
- OpenVDB 7.2.2.
116116
- Cortex 10.2.0.0.
117117

118+
0.59.x.x (relative to 0.59.7.0)
119+
========
120+
121+
Features
122+
--------
123+
124+
- Viewer : Added multiple color inspectors. <kbd>Ctrl</kbd>+click on an image
125+
to create a pixel inspector, or <kbd>Ctrl</kbd>+drag to create an area
126+
inspector. The image footer now shows the results from all your inspectors,
127+
and allows you to add or delete them.
128+
- FilterQuery : Added a new node for querying the results of a filter at a specific location.
129+
130+
Improvements
131+
------------
132+
133+
- TabbedContainer : Added menu button to allow selection of tabs that are not
134+
visible due to a lack of horizontal space.
135+
136+
Fixes
137+
-----
138+
139+
- Arnold : Fixed rendering of encapsulated objects for which automatic instancing
140+
is not possible. Examples include curves with non-zero `ai:curves:min_pixel_width`
141+
and meshes with non-zero `ai:polymesh:subdiv_adaptive_error`.
142+
- PlugValueWidget : Fixed bug that tried to update the widget before all graph edits were complete.
143+
- GraphEditor : Fixed framing of nodes dropped into the editor. This was incorrect when the editor was
144+
not at the default zoom.
145+
- OSL Constant : Fixed usage as a surface shader in Arnold.
146+
147+
API
148+
---
149+
150+
- Context : Added forwards compatibility for methods added to provide enhanced
151+
performance in Gaffer 0.60. This allows the same code to be compiled for both
152+
Gaffer 0.60 and Gaffer 0.59 (but with only the Gaffer 0.60 build benefiting
153+
from improved performance).
154+
118155
0.59.7.0 (relative to 0.59.6.0)
119156
========
120157

@@ -579,6 +616,16 @@ Build
579616
- OpenSSL 1.1.1h
580617
- See https://github.com/GafferHQ/dependencies/releases/tag/2.1.1 for full details.
581618

619+
0.58.6.x (relative to 0.58.6.5)
620+
========
621+
622+
Fixes
623+
-----
624+
625+
- Arnold : Fixed rendering of encapsulated objects for which automatic instancing
626+
is not possible. Examples include curves with non-zero `ai:curves:min_pixel_width`
627+
and meshes with non-zero `ai:polymesh:subdiv_adaptive_error`.
628+
582629
0.58.6.5 (relative to 0.58.6.4)
583630
========
584631

SConstruct

+1-1
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ libraries = {
818818

819819
"GafferImageUI" : {
820820
"envAppends" : {
821-
"LIBS" : [ "IECoreGL$CORTEX_LIB_SUFFIX", "Gaffer", "GafferImage", "GafferUI", "OpenColorIO$OCIO_LIB_SUFFIX" ],
821+
"LIBS" : [ "IECoreGL$CORTEX_LIB_SUFFIX", "Gaffer", "GafferImage", "GafferUI", "OpenColorIO$OCIO_LIB_SUFFIX", "IECoreScene$CORTEX_LIB_SUFFIX" ],
822822
},
823823
"pythonEnvAppends" : {
824824
"LIBS" : [ "GafferBindings", "GafferUI", "GafferImage", "GafferImageUI" ],

include/GafferImage/ImageStats.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class GAFFERIMAGE_API ImageStats : public Gaffer::ComputeNode
5454

5555
public :
5656

57-
ImageStats( const std::string &name=staticTypeName() );
57+
ImageStats( const std::string &name=defaultName<ImageStats>() );
5858
~ImageStats() override;
5959

6060
GAFFER_NODE_DECLARE_TYPE( GafferImage::ImageStats, ImageStatsTypeId, Gaffer::ComputeNode );

include/GafferImageUI/ImageView.h

+29
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343

4444
#include "GafferUI/View.h"
4545

46+
#include "Gaffer/BoxPlug.h"
47+
#include "Gaffer/CompoundNumericPlug.h"
4648
#include "Gaffer/NumericPlug.h"
4749
#include "Gaffer/TypedPlug.h"
4850

@@ -115,6 +117,33 @@ class GAFFERIMAGEUI_API ImageView : public GafferUI::View
115117
static void registeredDisplayTransforms( std::vector<std::string> &names );
116118
static GafferImage::ImageProcessorPtr createDisplayTransform( const std::string &name );
117119

120+
class ColorInspectorPlug : public Gaffer::ValuePlug
121+
{
122+
public :
123+
enum class Mode
124+
{
125+
Cursor,
126+
Pixel,
127+
Area
128+
};
129+
130+
GAFFER_PLUG_DECLARE_TYPE( ColorInspectorPlug, ColorInspectorPlugTypeId, Gaffer::ValuePlug );
131+
132+
ColorInspectorPlug( const std::string &name = defaultName<ColorInspectorPlug>(), Direction direction=In, unsigned flags=Default );
133+
134+
Gaffer::IntPlug *modePlug();
135+
const Gaffer::IntPlug *modePlug() const;
136+
137+
Gaffer::V2iPlug *pixelPlug();
138+
const Gaffer::V2iPlug *pixelPlug() const;
139+
140+
Gaffer::Box2iPlug *areaPlug();
141+
const Gaffer::Box2iPlug *areaPlug() const;
142+
143+
bool acceptsChild( const GraphComponent *potentialChild ) const override;
144+
Gaffer::PlugPtr createCounterpart( const std::string &name, Plug::Direction direction ) const override;
145+
};
146+
118147
protected :
119148

120149
/// May be called from a subclass constructor to add a converter

include/GafferImageUI/TypeIds.h

+4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ enum TypeId
4545
ImageViewTypeId = 110850,
4646
ImageGadgetTypeId = 110851,
4747
V2fContextVariableTypeId = 110852,
48+
Box2iContextVariableTypeId = 110853,
49+
ColorInspectorPlugTypeId = 110854,
50+
Box2iGadgetTypeId = 110855,
51+
V2iGadgetTypeId = 110856,
4852

4953
LastTypeId = 110899
5054
};

include/GafferScene/FilterQuery.h

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
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

include/GafferScene/TypeIds.h

+1
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ enum TypeId
159159
UnencapsulateTypeId = 110614,
160160
MotionPathTypeId = 110615,
161161
InstancerContextVariablePlugTypeId = 110616,
162+
FilterQueryTypeId = 110617,
162163

163164
PreviewGeometryTypeId = 110648,
164165
PreviewProceduralTypeId = 110649,

python/GafferArnoldTest/IECoreArnoldPreviewTest/RendererTest.py

+72
Original file line numberDiff line numberDiff line change
@@ -2591,6 +2591,78 @@ def render( self, renderer ) :
25912591
self.assertIsNone( arnold.AiNodeLookUpUserParameter( sphere, "user:a" ) )
25922592
self.assertIsNone( arnold.AiNodeLookUpUserParameter( sphere, "user:b" ) )
25932593

2594+
def testProceduralWithCurves( self ) :
2595+
2596+
class CurvesProcedural( GafferScene.Private.IECoreScenePreview.Procedural ) :
2597+
2598+
def __init__( self, minPixelWidth ) :
2599+
2600+
GafferScene.Private.IECoreScenePreview.Procedural.__init__( self )
2601+
2602+
self.__minPixelWidth = minPixelWidth
2603+
2604+
def render( self, renderer ) :
2605+
2606+
curves = IECoreScene.CurvesPrimitive(
2607+
IECore.IntVectorData( [ 4 ] ),
2608+
IECore.CubicBasisf.catmullRom(),
2609+
False,
2610+
IECore.V3fVectorData( [
2611+
imath.V3f( 0, -1, 0 ),
2612+
imath.V3f( 0, -1, 0 ),
2613+
imath.V3f( 0, 1, 0 ),
2614+
imath.V3f( 0, 1, 0 ),
2615+
] )
2616+
)
2617+
2618+
renderer.object(
2619+
"/curves",
2620+
curves,
2621+
renderer.attributes( IECore.CompoundObject( {
2622+
"ai:curves:min_pixel_width" : IECore.FloatData( self.__minPixelWidth )
2623+
} ) ),
2624+
)
2625+
2626+
IECore.registerRunTimeTyped( CurvesProcedural )
2627+
2628+
# We repeat the test with and without a min pixel width.
2629+
# This exercises the instanced and non-instanced code paths
2630+
# in the procedural renderer backend.
2631+
for minPixelWidth in ( 0.0, 1.0 ) :
2632+
2633+
renderer = GafferScene.Private.IECoreScenePreview.Renderer.create(
2634+
"Arnold",
2635+
GafferScene.Private.IECoreScenePreview.Renderer.RenderType.Batch,
2636+
)
2637+
2638+
renderer.object(
2639+
"/procedural",
2640+
CurvesProcedural( minPixelWidth ),
2641+
renderer.attributes( IECore.CompoundObject() )
2642+
).transform( imath.M44f().translate( imath.V3f( 0, 0, -1 ) ) )
2643+
2644+
outputFileName = os.path.join( self.temporaryDirectory(), "beauty.exr" )
2645+
renderer.output(
2646+
"test",
2647+
IECoreScene.Output(
2648+
outputFileName,
2649+
"exr",
2650+
"rgba",
2651+
{
2652+
}
2653+
)
2654+
)
2655+
2656+
renderer.render()
2657+
del renderer
2658+
2659+
# We should find the curves visible in the centre pixel.
2660+
image = IECoreImage.ImageReader( outputFileName ).read()
2661+
dimensions = image.dataWindow.size() + imath.V2i( 1 )
2662+
centreIndex = dimensions.x * int( dimensions.y * 0.5 ) + int( dimensions.x * 0.5 )
2663+
color = imath.Color3f( image["R"][centreIndex], image["G"][centreIndex], image["B"][centreIndex] )
2664+
self.assertEqual( color, imath.Color3f( 1 ) )
2665+
25942666
@staticmethod
25952667
def __aovShaders() :
25962668

0 commit comments

Comments
 (0)