Skip to content

Commit e559734

Browse files
author
Lucio Moser
committed
Several fixes and some reengineering.
- Realized that Nuke calls knob_changed() and then, Op::append() and the shared Data values were being used causing inconsistent Hash computation. Now the append() function uses refreshed information based on knob values. - Prevent doing any computation on the knob_changed while the script is being loaded, and forces it at the end with the call to validate(). - Realized that the existence of a "root" knob prevents the file knob to have a TCL expressions such as [file dirname [value root.name] ]. So, renamed the knob to "sceneRoot". This causes warnings while loading previous Nuke scripts, but all the other knobs are loaded fine. The default value "/" is the only one used at IE and this change should not break scripts. - The changes in file and root attempt to keep selection by using the method loadAllFromKnobs(). - The knob_changed callback is not necessarily called by Nuke. There's some caching mechanism that prevents that from happening. the Op::append() on the other hand is reliable, so we stopped baking the selection list during knob_change and force it's recomputation in append(). - Eliminated some redundant hash values ( sceneHash and scene file for example). - Optimized loadAllFromKnobs() in preventing two calls to filterScene. - Using DD::Image::root_real_fps() instead of the hard coded 24fps in the computation of time. - Using error(msg) function in getSceneInterface to show in the Viewer when geo cannot be loaded (either the file does not exist of the root is invalid).
1 parent 17e90c1 commit e559734

File tree

2 files changed

+189
-223
lines changed

2 files changed

+189
-223
lines changed

include/IECoreNuke/SceneCacheReader.h

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ class SceneCacheReader : public DD::Image::SourceGeo
9494
// Returns the name of the item at index itemIndex in the SceneView_knob.
9595
const std::string &itemName( int itemIndex ) const;
9696
// Returns a SceneInterface for the root item.
97-
IECore::ConstSceneInterfacePtr getSceneInterface() const;
97+
IECore::ConstSceneInterfacePtr getSceneInterface();
9898
// Returns a SceneInterface for the item at path.
99-
IECore::ConstSceneInterfacePtr getSceneInterface( const std::string &path ) const;
99+
IECore::ConstSceneInterfacePtr getSceneInterface( const std::string &path );
100100
//@}
101101

102102
//! @name Methods which control the SceneView_knob
@@ -116,19 +116,12 @@ class SceneCacheReader : public DD::Image::SourceGeo
116116
/// is rebuilt then the selection will be lost. The filterScene() method must
117117
/// be called immediately afterwards.
118118
void rebuildSceneView();
119-
/// This recursive method is called from rebuildSceneView() and traverses the
120-
/// sceneInterface to build a list of item names and a mapping of the tags to
121-
/// the indices in the items.
122-
void buildSceneView( std::vector< std::string > &list, const IECore::ConstSceneInterfacePtr sceneInterface );
123119
/// Rebuilds the sceneView to show only items which are already selected or have
124-
/// a names that matches filterText and a tag which matches tagText.
120+
/// names that matches filterText and a tag which matches tagText.
125121
/// Passing an empty string to either filterText or tagText will disable the
126122
/// filtering of the names and tags respectively. This should be called
127123
/// immediately after any call to rebuildSceneView().
128-
void filterScene( const std::string &filterText, const std::string &tagText );
129-
/// Rebuilds the current geometry selection from the entries that are selected
130-
/// in the SceneView_knob.
131-
void rebuildSelection();
124+
void filterScene( const std::string &filterText, const std::string &tagText, bool keepSelection = true );
132125
/// Clear any selected geometry from the SceneView_knob.
133126
void clearSceneViewSelection();
134127
//@}
@@ -140,14 +133,11 @@ class SceneCacheReader : public DD::Image::SourceGeo
140133
void loadPrimitive( DD::Image::GeometryList &out, const std::string &path );
141134
/// Get the hash of the file path and root knob.
142135
DD::Image::Hash sceneHash() const;
143-
/// Evaluates the file path for the current context and returns the result.
144-
std::string filePath() const;
136+
/// Get the hash of the SceneView knob (the default hash implementation of that knob returns a constant hash...)
137+
DD::Image::Hash selectionHash( bool force = false ) const;
145138

146139
Imath::M44d worldTransform( IECore::ConstSceneInterfacePtr scene, IECore::SceneInterface::Path root, double time );
147140

148-
/// Returns an InternedString with the name of the geometry tag.
149-
static const IECore::InternedString &geometryTag();
150-
151141
// uses firstOp to return the Op that has the up-to-date private data
152142
SceneCacheReader *firstReader();
153143
const SceneCacheReader *firstReader() const;

0 commit comments

Comments
 (0)