2013년 2월 22일
double array attribute가 연결상태에서 업데이트되지 않을 때,
[a.out] -> [b.in] 처럼 두 노드 사이에 double array attribute 를 연결시킬 때,
a.out 은 매 프레임마다 업데이트되지만 b.in 은 처음 연결된 직후 상태의 값에서 변하지 않을 때가 있다.
예)
select -r pPlaneShape1; addAttr -ln "rmanvFfoam" -dt "doubleArray"; connectAttr ZOceanEnvWaveGen1.foamMap pPlaneShape1.rmanvFfoam;
b.in attribute 의 cached 속성값이 기본적으로 1 (true)로 설정되어 있기 때문이다.
만약 노드 b 가 커스텀 노드라면 attribute b::initialize() 함수에서 in 을 attribute 로 등록할 때
MFnAttribute::setCached(0) 함수를 이용하여 이 속성을 설정해주면 되지만,
위의 예제와 같이 mesh 노드의 경우 built-in node 이기 때문에 이러한 방식으로 문제를 해결할 수 없다.
하지만 a::compute() 함수 내에서 connection 을 찾아서 해당 attribute 의 속성값을 설정하는 방식으로 이
문제를 해결할 수 있다.
예)
MObject thisMObj( thisMObject() ); MObjectArray connectedNodeObjs; MPlugArray connectedPlgObjs; GetConnections( thisMObj, "foamMap", connectedNodeObjs, connectedPlgObjs ); if( connectedPlgObjs.length() ) { MObject attrObj( connectedPlgObjs[0].attribute() ); MFnAttribute attrFn( attrObj ); attrFn.setCached( false ); }