Fixed "base class not created yet" GafferRenderMan import error.

This occurred if GafferScene had not been imported prior to importing GafferRenderMan.
Added _copy parameter to Shader::state() python binding.

This follows the same rationale as TypedObjectPlug::getValue() - boost::python insists on a non-const return value, but we don't trust python code not to modify the data, so we return a copy as a matter of course. The additional parameter allows the original data to be returned, and is intended only really for use in test cases. The current motivation is to be able to accurately benchmark shader performance from python without having the results marred by unnecessary overhead.
Optimised Shader::stateHash() and Shader::state().

Profiling revealed that a lot of time was being spent in the FilteredRecursiveChildIterators that are used to iterate over the plugs representing shader parameters. Replacing these with a manual walk over the plugs yields a reduction of ~35% in runtime when calling both Shader::stateHash() and Shader::state().

It would be nice in future to also optimise the FilteredRecursiveChildIterator rather than to have to make these local optimisations. It seems that much of the overhead is in the use of the std::vector for the m_stack member data, as it allocates memory. An experiment using a fixed size array allocated on the stack rather than the heap did give a good speedup (~25%), but since this particular part of the code will be quite performance critical for IPR, it seemed best to go with the faster option. We should consider the fixed-size-array optimisation for FilteredRecursiveChildIterator at some point, falling back to heap allocation only when the iteration goes deeper than some fixed limit.
Merge pull request #876 from johnhaddon/shaderOptimisation

Shader optimisation