Container Dump
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/08/2012 at 13:43, xxxxxxxx wrote:
User Information:
Cinema 4D Version:
Platform:
Language(s) :---------
I posted this earlier in another thread, but thought I'd go ahead and post an expanded version of it for anyone interested...static String VecToString(const Vector& vec) { return String(RealToString(vec.x)+" "+RealToString(vec.y)+" "+RealToString(vec.z)); } static void DumpMatrix(Matrix xform) { GePrint("==================="); GePrint("v1 = " + VecToString(xform.v1)); GePrint("v2 = " + VecToString(xform.v2)); GePrint("v3 = " + VecToString(xform.v3)); GePrint("off = " + VecToString(xform.off)); GePrint("==================="); } void container_dump(BaseContainer *pBc, LONG tab=0) { if(!pBc) return; LONG id, j, i=0; String tabStr; for(j=0; j<tab; j++) tabStr += "____"; while (TRUE) { id = pBc->GetIndexId(i++); if (id==NOTOK) break; BaseContainer *pbc = NULL; GeData data = pBc->GetData(id); switch(data.GetType()) { case DA_NIL: GePrint(tabStr+LongToString(i)+") id: "+LongToString(id)+" - DA_NIL"); break; case DA_VOID: GePrint(tabStr+LongToString(i)+") id: "+LongToString(id)+" - DA_VOID"); break; case DA_LONG: GePrint(tabStr+LongToString(i)+") id: "+LongToString(id)+" - DA_LONG ("+LongToString(data.GetLong())+")"); break; case DA_REAL: GePrint(tabStr+LongToString(i)+") id: "+LongToString(id)+" - DA_REAL ("+RealToString(data.GetReal())+")"); break; case DA_TIME: GePrint(tabStr+LongToString(i)+") id: "+LongToString(id)+" - DA_TIME ("+RealToString(data.GetTime().GetNumerator())+" / "+RealToString(data.GetTime().GetDenominator())+")"); break; case DA_VECTOR: GePrint(tabStr+LongToString(i)+") id: "+LongToString(id)+" - DA_VECTOR ("+VecToString(data.GetVector())+")"); break; case DA_MATRIX: GePrint(tabStr+LongToString(i)+") id: "+LongToString(id)+" - DA_MATRIX..."); DumpMatrix(data.GetMatrix()); break; case DA_LLONG: GePrint(tabStr+LongToString(i)+") id: "+LongToString(id)+" - DA_LLONG ("+LLongToString(data.GetLLong())+")"); break; case DA_BYTEARRAY: GePrint(tabStr+LongToString(i)+") id: "+LongToString(id)+" - DA_BYTEARRAY"); break; case DA_STRING: GePrint(tabStr+LongToString(i)+") id: "+LongToString(id)+" - DA_STRING (\""+data.GetString()+"\")"); break; case DA_FILENAME: GePrint(tabStr+LongToString(i)+") id: "+LongToString(id)+" - DA_FILENAME (\""+data.GetFilename().GetString()+"\")"); break; case DA_CONTAINER: GePrint(tabStr+LongToString(i)+") id: "+LongToString(id)+" - DA_CONTAINER"); pbc = data.GetContainer(); container_dump(pbc, tab+1); break; case DA_ALIASLINK: GePrint(tabStr+LongToString(i)+") id: "+LongToString(id)+" - DA_ALIASLINK"); break; case DA_MARKER: GePrint(tabStr+LongToString(i)+") id: "+LongToString(id)+" - DA_MARKER"); break; case DA_MISSINGPLUG: GePrint(tabStr+LongToString(i)+") id: "+LongToString(id)+" - DA_MISSINGPLUG"); break; case DA_CUSTOMDATATYPE: GePrint(tabStr+LongToString(i)+") id: "+LongToString(id)+" - DA_CUSTOMDATATYPE"); break; default: GePrint(tabStr+LongToString(i)+") id: "+LongToString(id)+" - unknown"); break; } } }
...this may be helpful if you're trying to debug some container.
Cheers.