uint8_t *plMaxNodeBase::IGetSceneViewerChunk() { uint8_t *SVChunk = nil; AppDataChunk *adc = GetAppDataChunk(PLASMA_MAX_CLASSID, GUP_CLASS_ID, kPlasmaSceneViewerChunk); if (adc) SVChunk = (uint8_t*)adc->data; else { // Does not exist, create a new one... SVChunk = (uint8_t*)MAX_new(1); *SVChunk = 0; AddAppDataChunk(PLASMA_MAX_CLASSID, GUP_CLASS_ID, kPlasmaSceneViewerChunk, 1, SVChunk); } hsAssert(SVChunk, "SceneViewer chunk not found or created"); return SVChunk; }
void plMaxNodeBase::SetMaxNodeData(plMaxNodeData * pdat) { const char* dbgNodeName = GetName(); // If object is a component, don't add node data if (IsComponent()) return; AppDataChunk *adc = GetAppDataChunk(PLASMA_MAX_CLASSID, GUP_CLASS_ID, kPlasmaMaxNodeDataChunk); // If pointer is nil, remove any data if (!pdat) { if( adc ) { plMaxNodeData *pDataChunk = (plMaxNodeData*)adc->data; pDataChunk->DeInit(); } RemoveAppDataChunk(PLASMA_MAX_CLASSID, GUP_CLASS_ID, kPlasmaMaxNodeDataChunk); return; } if (!adc) { // Does not exist, create a new one... int len = sizeof(plMaxNodeData); plMaxNodeData *pDataChunk = (plMaxNodeData *)MAX_new(len); memcpy(pDataChunk, pdat, sizeof(*pdat)); pDataChunk->Init(); *pDataChunk = *pdat; AddAppDataChunk(PLASMA_MAX_CLASSID, GUP_CLASS_ID, kPlasmaMaxNodeDataChunk, len, pDataChunk); } else { plMaxNodeData *pDataChunk = (plMaxNodeData*)adc->data; // if someone does a GetMaxNodeData, they get a pointer to the data, // No need to set it, other wise set the Data chunk from the MaxNodeData passed in if (pDataChunk != pdat) *pDataChunk = *pdat; } }
void *operator new (size_t) { return MAX_new(sizeof(plActionTable)); }