/*********************************************************************\ Function name : CCustomSubDialog::InitValues Description : Created at : 27.03.02, @ 12:07:33 Created by : Thomas Kunert Modified by : \*********************************************************************/ Bool CCustomSubDialog::InitValues(void) { Int32 lID = FIRST_CUSTOM_ELEMENT_ID; Int32 i; CCustomElements* pElement = g_pCustomElements->GetItem(m_pElement->m_lElement); if (!pElement) return true; if (!m_pElement->m_pbcGUI) return true; BaseContainer* pBC = &m_pElement->m_pbcGUI[m_pElement->m_lElement]; SetBool(IDC_CUSTOM_OPEN_CLOSE, pElement->m_bIsOpen); for (i = 0; m_pProp && m_pProp[i].type != CUSTOMTYPE_END; i++, lID++) { CustomProperty* pProp = &pElement->m_pProp[i]; if (pProp->type == CUSTOMTYPE_FLAG) SetBool(lID, pBC, pProp->id); else if (pProp->type == CUSTOMTYPE_LONG) SetInt32(lID, pBC, pProp->id); else if (pProp->type == CUSTOMTYPE_REAL) SetFloat(lID, pBC, pProp->id); else if (pProp->type == CUSTOMTYPE_STRING) SetString(lID, pBC, pProp->id); else if (pProp->type == CUSTOMTYPE_VECTOR) { Vector v = pBC->GetVector(pProp->id); SetFloat(lID++,v.x); SetFloat(lID++,v.y); SetFloat(lID,v.z); } } return true; }
INITRENDERRESULT ColorWeightShader::InitRender (BaseShader *chn, const InitRenderStruct &irs) { const InitRenderStruct *mirs = &irs; #else Int32 ColorWeightShader::InitRender (BaseShader *chn, InitRenderStruct *irs) { const InitRenderStruct *mirs = irs; #endif BaseContainer *data = chn->GetDataInstance(); m_shader = (BaseShader*)data->GetLink(COLORWEIGHT_TEXTURE,mirs->doc,Xbase); m_color = data->GetVector(COLORWEIGHT_COLOR); if (m_shader) return m_shader->InitRender(irs); return INITRENDERRESULT_OK; } void ColorWeightShader::FreeRender(BaseShader *sh) { if (m_shader) m_shader->FreeRender(); m_shader=NULL; } Vector ColorWeightShader::Output(BaseShader *sh, ChannelData *cd) { if(m_shader) { Vector v = m_shader->Sample(cd); return Vector(v.x*m_color.x, v.y*m_color.y, v.z*m_color.z); } return m_color; } #ifdef C4D_R13 Bool ColorWeightShader::Message(GeListNode *node, LONG type, void *msgdat) #else Bool ColorWeightShader::Message(GeListNode *node, Int32 type, void *msgdat) #endif { BaseContainer *data = ((BaseShader*)node)->GetDataInstance(); HandleInitialChannel(node,COLORWEIGHT_TEXTURE,type,msgdat); HandleShaderMessage(node,(BaseShader*)data->GetLink(COLORWEIGHT_TEXTURE,node->GetDocument(),Xbase),type,msgdat); return TRUE; }
/*********************************************************************\ Function name : CDialogCustomElement::Save Description : Created at : 27.03.02, @ 14:54:04 Created by : Thomas Kunert Modified by : \*********************************************************************/ Bool CDialogCustomElement::Save(BaseFile* pFile, String strFill) { if (g_pCustomElements && m_lElement >= 0 && m_lElement < g_pCustomElements->Entries()) { CustomProperty* pProp; CCustomElements* pElement = g_pCustomElements->GetItem(m_lElement); if (!pElement) return true; if (!m_pbcGUI) return false; BaseContainer* pBC = &m_pbcGUI[m_lElement]; pProp = pElement->m_pProp; WriteString(pFile, pElement->m_pChResSym); WriteString(pFile, " "); WriteString(pFile, m_strControlID); LineBreak(pFile, strFill); WriteString(pFile, "{"); LineBreak(pFile, strFill + *g_pstrFillSave); SaveAlignment(pFile); LineBreak(pFile, strFill); if (pElement->m_bIsOpen) { WriteString(pFile, *g_pstrFillSave); WriteString(pFile, "OPEN"); WriteString(pFile, "; "); LineBreak(pFile, strFill); } Int32 i; for (i = 0; pProp && pProp[i].type != CUSTOMTYPE_END; i++) { Bool b = false; if (pProp[i].type == CUSTOMTYPE_FLAG) { if (pBC->GetBool(pProp[i].id)) { WriteString(pFile, *g_pstrFillSave); WriteString(pFile, pProp[i].ident); WriteString(pFile, "; "); b = true; } } else if (pProp[i].type == CUSTOMTYPE_LONG) { WriteString(pFile, *g_pstrFillSave); WriteString(pFile, pProp[i].ident); WriteString(pFile, " "); WriteString(pFile, String::IntToString(pBC->GetInt32(pProp[i].id))); // XXX: BITMAPBUTTON SIZE is a CUSTOMTYPE_LONG property, yet it // requires a tuple for the SIZE parameter. Can we find a better // way than hardcoding this? // https://github.com/nr-plugins/resedit/issues/2 if (String(pElement->m_pChResSym) == String("BITMAPBUTTON") && String(pProp[i].ident) == String("SIZE")) { WriteString(pFile, ", "); WriteString(pFile, String::IntToString(pBC->GetInt32(pProp[i].id))); } WriteString(pFile, "; "); b = true; } else if (pProp[i].type == CUSTOMTYPE_REAL) { WriteString(pFile, *g_pstrFillSave); WriteString(pFile, pProp[i].ident); WriteString(pFile, " "); WriteString(pFile, String::FloatToString(pBC->GetFloat(pProp[i].id))); WriteString(pFile, "; "); b = true; } else if (pProp[i].type == CUSTOMTYPE_STRING) { if (pBC->GetString(pProp[i].id).Content()) { WriteString(pFile, *g_pstrFillSave); WriteString(pFile, pProp[i].ident); WriteString(pFile, " "); WriteString(pFile, pBC->GetString(pProp[i].id)); WriteString(pFile, "; "); b = true; } } else if (pProp[i].type == CUSTOMTYPE_VECTOR) { WriteString(pFile, *g_pstrFillSave); WriteString(pFile, pProp[i].ident); WriteString(pFile, " "); WriteString(pFile, String::FloatToString(pBC->GetVector(pProp[i].id).x)); WriteString(pFile, " "); WriteString(pFile, String::FloatToString(pBC->GetVector(pProp[i].id).y)); WriteString(pFile, " "); WriteString(pFile, String::FloatToString(pBC->GetVector(pProp[i].id).z)); WriteString(pFile, " "); WriteString(pFile, "; "); b = true; } if (b) LineBreak(pFile, strFill); } WriteString(pFile, "}"); } return true; }