From 7bef1bd16aabda2b0b6c1be12bc71f26d90f0cf2 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 18 Jun 2008 12:01:52 +0000 Subject: [PATCH] From Jean-Sebastien Guay, "When copying a node that had uniforms on it, the copy constructor of osg::Uniform would not copy the array of the original uniform (either _intArray or _floatArray) because none had been allocated and the copy constructor checks that *both* this's array and rhs's array are valid. I added a call to allocateDataArray() if rhs has (at least) one valid array, which should allocate the right array according to the type. Since the type was copied from rhs, it should create the same array as rhs has, so then it should copy the data in the following lines. " --- src/osg/Uniform.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/osg/Uniform.cpp b/src/osg/Uniform.cpp index df506ec07..780684e44 100644 --- a/src/osg/Uniform.cpp +++ b/src/osg/Uniform.cpp @@ -218,6 +218,7 @@ void Uniform::copyData(const Uniform& rhs) { // caller must ensure that _type==rhs._type _numElements = rhs._numElements; + if (rhs._floatArray.valid() || rhs._intArray.valid()) allocateDataArray(); if( _floatArray.valid() && rhs._floatArray.valid() ) *_floatArray = *rhs._floatArray; if( _intArray.valid() && rhs._intArray.valid() ) *_intArray = *rhs._intArray; dirty();