// // Returns the controlling object from an external object // IBaseInstance *System::GetControllerObject(IPluginObject *pObject) { IBaseInstance *pResult = NULL; if (pObject != NULL) { IDocNode *pNode = Lookup::GetNodeForExtInst(pObject); if (pNode != NULL) { pResult = pNode->GetNodeObject(); } } return pResult; }
void OpenGLShaderQuad::PostInitialize(ISystem *ySys, IPluginObjectInstance *pInstance) { OpenGLShaderBase::Initialize(ySys, std::string(vertexshader_source->v->string), std::string(pixelshader_source->v->string)); OpenGLShaderBase::ReloadIfNeeded(true); if (program == NULL) { ySys->GetLogger("GLShaderQuad")->Error("Shader program load error"); exit(1); } // TODO: Go through children and find any shader parameters IDocNode *pNode = pInstance->GetDocumentNode(); int nChildren = pNode->GetNumChildren(kNodeType_ObjectInstance); if (nChildren == 0) return; pInstance->GetLogger()->Debug("Checking %d child nodes for shader parameters",nChildren); for (int i=0;i<nChildren;i++) { // IPluginObjectInstance *pObject = pDoc->GetChildAt(pInstance, i, kNodeType_ObjectInstance); IDocNode *pChildNode = pNode->GetChildAt(i, kNodeType_ObjectInstance); IPluginObjectInstance *pObject = dynamic_cast<IPluginObjectInstance *>(pChildNode->GetNodeObject()); OpenGLShaderParameter *shaderParam = dynamic_cast<OpenGLShaderParameter *> (pObject->GetExtObject()); if (shaderParam != NULL) { shaderParams.push_back(shaderParam); } else { pInstance->GetLogger()->Error("Unsupported child type, gl.ShaderQuad only supports 'gl.ShaderParam'"); } } pInstance->GetLogger()->Debug("Dump params"); for(int i=0;i<shaderParams.size();i++) { OpenGLShaderParameter *param = shaderParams[i]; std::string name = param->GetName(); std::string tname = param->GetTypeName(); ShaderParamType tParam = param->GetType(); pInstance->GetLogger()->Debug(" name: %s, type=%s (%d)", name.c_str(), tname.c_str(), tParam); } }
void YaptCurveFacade::PostInitialize(ISystem *ySys, IPluginObjectInstance *pInstance) { ILogger *pLogger = ySys->GetLogger("YaptCurveFacade");//Logger::GetLogger("YaptCurveFacade"); pLogger->Debug("PostInitialize"); if (pCurve != NULL) { pLogger->Debug("Dispose curve - not implemented, leaking memory"); } // 'unknown' not supported (it's pointless) so just add '1' to the incoming type pCurve = Curve::CreateCurve(kCurveClass(curveType->v->int_val+1), channels->v->int_val); IDocNode *pNode = pInstance->GetDocumentNode(); int nChildren = pNode->GetNumChildren(kNodeType_ObjectInstance); pLogger->Debug("Assigning keys from children (num childs = '%d')",nChildren); int i; pLogger->Enter(); for (i=0;i<nChildren;i++) { // IPluginObjectInstance *pObject = pDoc->GetChildAt(pInstance, i, kNodeType_ObjectInstance); IDocNode *pChildNode = pNode->GetChildAt(i, kNodeType_ObjectInstance); IPluginObjectInstance *pObject = dynamic_cast<IPluginObjectInstance *>(pChildNode->GetNodeObject()); GenericCurveKey *pCurveKey = dynamic_cast<GenericCurveKey *> (pObject->GetExtObject()); if (pCurveKey != NULL) { Key *pKey = pCurveKey->GetKey(); if (pKey != NULL) { pKey->t *= tScale->v->float_val; pCurve->AddKey(pKey); pLogger->Debug("Added key '%d' at t=%f",i,pKey->t); } else { pLogger->Debug("Key is NULL!"); exit(1); } } else { pLogger->Error("Unsupported child type, Animation curves only supports 'GenericKey' derivates"); } } pLogger->Leave(); }