Texmap *plRTProjDirLight::GetProjMap() { // If we don't have one, create one plLayerTex *layer = (plLayerTex *)fProjPB->GetTexmap( kTexmap, 0 ); if( layer == nil || layer->ClassID() != LAYER_TEX_CLASS_ID ) { layer = new plLayerTex; fProjPB->SetValue( kTexmap, 0, (Texmap *)layer ); IParamBlock2 *bitmapPB = layer->GetParamBlockByID( plLayerTex::kBlkBitmap ); bitmapPB->SetValue( kBmpUseBitmap, 0, 1 ); } // Backwards compatability here PBBitmap *bitmap = fProjPB->GetBitmap( kProjMap, 0 ); if( bitmap != nil ) { layer->SetBitmap( &bitmap->bi ); fProjPB->SetValue( kProjMap, 0, (PBBitmap *)nil ); } if( layer ) { const char* dbgTexName = layer->GetName(); IParamBlock2 *bitmapPB = layer->GetParamBlockByID(plLayerTex::kBlkBitmap); hsAssert(bitmapPB, "LayerTex with no param block"); int noCompress = fProjPB->GetInt(kProjNoCompress); int noMip = fProjPB->GetInt(kProjNoMip); bitmapPB->SetValue(kBmpNonCompressed, TimeValue(0), noCompress); bitmapPB->SetValue(kBmpNoFilter, TimeValue(0), noMip); } return (Texmap *)layer; }
void Mask::Update(TimeValue t, Interval& valid) { if (Param1) { pblock->SetValue( mask_map1_on, 0, mapOn[0]); pblock->SetValue( mask_map2_on, 0, mapOn[1]); pblock->SetValue( mask_invert, 0, invertMask); Param1 = FALSE; } if (!ivalid.InInterval(t)) { ivalid.SetInfinite(); pblock->GetValue( mask_map1_on, t, mapOn[0], ivalid); pblock->GetValue( mask_map2_on, t, mapOn[1], ivalid); pblock->GetValue( mask_invert, t, invertMask, ivalid); NotifyDependents(FOREVER, PART_TEXMAP, REFMSG_DISPLAY_MATERIAL_CHANGE); } if (!mapValid.InInterval(t)) { mapValid.SetInfinite(); for (int i=0; i<NSUBTEX; i++) { if (subTex[i]) subTex[i]->Update(t,mapValid); } } valid &= mapValid; valid &= ivalid; }
Texmap *plRTSpotLight::GetProjMap() { if( !fLightPB->GetInt( kUseProjectorBool ) ) return nil; Interval valid = Interval(0,0); if( !GetTex() ) { if( fLightPB->GetInt( kUseProjectorBool ) ) { PBBitmap* bitmap = fLightPB->GetBitmap( kProjMapTexButton, 0 ); SetProjMap( &bitmap->bi ); } } if( GetTex() ) { const char* dbgTexName = GetTex()->GetName(); IParamBlock2 *bitmapPB = fTex->GetParamBlockByID(plLayerTex::kBlkBitmap); hsAssert(bitmapPB, "LayerTex with no param block"); int noCompress = fLightPB->GetInt(kProjNoCompress); int noMip = fLightPB->GetInt(kProjNoMip); bitmapPB->SetValue(kBmpNonCompressed, TimeValue(0), noCompress); bitmapPB->SetValue(kBmpNoFilter, TimeValue(0), noMip); } return (Texmap *)GetTex(); }
void OrenNayarBlinnShader::Update(TimeValue t, Interval &valid) { Point3 p, p2; if( inUpdate ) return; inUpdate = TRUE; if (!ivalid.InInterval(t)) { ivalid.SetInfinite(); // pblock->GetValue( onb_ambient, t, p, ivalid ); // ambient = LimitColor(Color(p.x,p.y,p.z)); pblock->GetValue( onb_diffuse, t, p, ivalid ); diffuse= LimitColor(Color(p.x,p.y,p.z)); pblock->GetValue( onb_ambient, t, p2, ivalid ); if( lockAD && (p!=p2)){ pblock->SetValue( onb_ambient, t, diffuse); ambient = diffuse; } else { pblock->GetValue( onb_ambient, t, p, ivalid ); ambient = Bound(Color(p.x,p.y,p.z)); } pblock->GetValue( onb_specular, t, p2, ivalid ); if( lockDS && (p!=p2)){ pblock->SetValue( onb_specular, t, diffuse); specular = diffuse; } else { pblock->GetValue( onb_specular, t, p, ivalid ); specular = Bound(Color(p.x,p.y,p.z)); } // pblock->GetValue( onb_specular, t, p, ivalid ); // specular = LimitColor(Color(p.x,p.y,p.z)); pblock->GetValue( onb_glossiness, t, glossiness, ivalid ); LIMIT0_1(glossiness); pblock->GetValue( onb_specular_level, t, specularLevel, ivalid ); LIMITMINMAX(specularLevel,0.0f,9.99f); pblock->GetValue( onb_soften, t, softThresh, ivalid); LIMIT0_1(softThresh); pblock->GetValue( onb_self_illum_amnt, t, selfIllum, ivalid ); LIMIT0_1(selfIllum); pblock->GetValue( onb_self_illum_color, t, p, ivalid ); selfIllumClr = LimitColor(Color(p.x,p.y,p.z)); pblock->GetValue( onb_diffuse_level, t, diffLevel, ivalid ); LIMITMINMAX(diffLevel,0.0f, 4.00f); pblock->GetValue( onb_roughness, t, diffRough, ivalid ); LIMIT0_1(diffRough); // also get the non-animatables in case changed from scripter or other pblock accessors pblock->GetValue(onb_ds_lock, t, lockDS, ivalid); pblock->GetValue(onb_ad_lock, t, lockAD, ivalid); pblock->GetValue(onb_ad_texlock, t, lockADTex, ivalid); pblock->GetValue(onb_use_self_illum_color, t, selfIllumClrOn, ivalid); curTime = t; } valid &= ivalid; inUpdate = FALSE; }
BOOL plFootstepSoundComponentProc::DlgProc(TimeValue t, IParamMap2 *pm, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { IParamBlock2 *pb = pm->GetParamBlock(); HWND hSurface = GetDlgItem(hWnd, IDC_COMP_FOOTSTEP_SOUND_SURFACE); HWND hPick = GetDlgItem(hWnd, IDC_COMP_FOOTSTEP_SOUND_PICK); INode *curPick = nil; int curSurface = 0; switch (msg) { case WM_INITDIALOG: { int i; for (i = 0; i < plArmatureEffectsMgr::kMaxSurface; i++) ComboBox_AddString(hSurface, plArmatureEffectsMgr::SurfaceStrings[i]); curSurface = pb->GetInt(ParamID(plFootstepSoundComponent::kSurface)); ComboBox_SetCurSel(hSurface, curSurface); curPick = pb->GetINode(ParamID(plFootstepSoundComponent::kSurfaceList), 0, curSurface); Button_SetText(hPick, (curPick == nil ? "None" : curPick->GetName())); } return TRUE; case WM_COMMAND: if (HIWORD(wParam) == BN_CLICKED) { if (LOWORD(wParam) == IDC_COMP_FOOTSTEP_SOUND_PICK) { std::vector<Class_ID> cids; cids.push_back(RANDOM_SOUND_COMPONENT_ID); if (plPick::NodeRefKludge(pb, plFootstepSoundComponent::kNodePicker, &cids, true, false)) { curPick = pb->GetINode(ParamID(plFootstepSoundComponent::kNodePicker)); curSurface = pb->GetInt(ParamID(plFootstepSoundComponent::kSurface)); pb->SetValue(ParamID(plFootstepSoundComponent::kSurfaceList), 0, curPick, curSurface); Button_SetText(hPick, (curPick == nil ? "None" : curPick->GetName())); } return TRUE; } } else if (LOWORD(wParam) == IDC_COMP_FOOTSTEP_SOUND_SURFACE) { curSurface = ComboBox_GetCurSel(hSurface); curPick = pb->GetINode(ParamID(plFootstepSoundComponent::kSurfaceList), 0, curSurface); pb->SetValue(ParamID(plFootstepSoundComponent::kSurface), 0, curSurface); Button_SetText(hPick, (curPick == nil ? "None" : curPick->GetName())); } } return FALSE; }
//void RendSpline::UpdateAspect(HWND hWnd, TimeValue t) //{ // // //ISpinnerControl *iSpin = GetISpinner(GetDlgItem(hWnd, IDC_ASPECTSPIN)); // // // //iSpin->SetValue(this->GetAspect((UseViewOrRenderParams(t)== rbViewport)),FALSE); // //ReleaseISpinner(iSpin); //} void RendSpline::OnSetWidthLength(HWND hWnd, ParamID lengthID, ParamID widthID, TimeValue t, BOOL widthSet) { static BOOL reenter = FALSE; if(reenter) return; reenter = TRUE; ISpinnerControl *iSpin = GetISpinner(GetDlgItem(hWnd, IDC_ASPECTSPIN)); BOOL aspectlocked; float length, width; if(UseViewOrRenderParams(t) == rbViewport) pblock->GetValue(rnd_v2_vpt_aspect_lock,t,aspectlocked,FOREVER); else pblock->GetValue(rnd_v2_aspect_lock,t,aspectlocked,FOREVER); pblock->GetValue(lengthID,t,length,FOREVER); pblock->GetValue(widthID,t,width,FOREVER); if(!aspectlocked) { CheckAspectLock(t); if(width == 0.0f) { width = EPS; //iSpin->SetValue(0.0f, FALSE); //iSpin->SetIndeterminate(TRUE); } else iSpin->SetValue(length/width, FALSE); } else { if(widthSet) { pblock->SetValue(lengthID,t,mAspect*width); } else { if(mAspect == 0.0f) mAspect = EPS; //pblock->SetValue(widthID,t,0.0f); pblock->SetValue(widthID,t,length/mAspect); } } ReleaseISpinner(iSpin); reenter = FALSE; }
BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { int id = LOWORD(wParam); int code = HIWORD(wParam); IParamBlock2 *pb = map->GetParamBlock(); HWND cbox = NULL; char* buffer = NULL; int selection; switch (msg) { case WM_INITDIALOG: int j; for (j = 0; j < plClothingMgr::kMaxGroup; j++) { cbox = GetDlgItem(hWnd, IDC_COMP_AVATAR_CLOTHING_GROUP); SendMessage(cbox, CB_ADDSTRING, 0, (LPARAM)plClothingMgr::GroupStrings[j]); } selection = pb->GetInt(ParamID(plAvatarComponent::kClothingGroup)); SendMessage(cbox, CB_SETCURSEL, selection, 0); for (j = 0; j < plArmatureMod::kMaxBoneBase; j++) { cbox = GetDlgItem(hWnd, IDC_COMP_AVATAR_SKELETON); SendMessage(cbox, CB_ADDSTRING, 0, (LPARAM)plArmatureMod::BoneStrings[j]); } selection = pb->GetInt(ParamID(plAvatarComponent::kSkeleton)); SendMessage(cbox, CB_SETCURSEL, selection, 0); return TRUE; case WM_COMMAND: if (id == IDC_COMP_AVATAR_CLOTHING_GROUP) { selection = SendMessage(GetDlgItem(hWnd, id), CB_GETCURSEL, 0, 0); pb->SetValue(plAvatarComponent::kClothingGroup, t, selection); return TRUE; } if (id == IDC_COMP_AVATAR_SKELETON) { selection = SendMessage(GetDlgItem(hWnd, id), CB_GETCURSEL, 0, 0); pb->SetValue(plAvatarComponent::kSkeleton, t, selection); return TRUE; } break; } return FALSE; }
void ResponderWait::CmdRemoved(IParamBlock2 *state, int delIdx) { int numCmds = state->Count(kStateCmdParams); for (int i = delIdx; i < numCmds; i++) { IParamBlock2 *pb = GetWaitBlk(state, i); int who = pb->GetInt(kWaitWho); if (who == delIdx) pb->SetValue(kWaitWho, 0, -1); if (who > delIdx) pb->SetValue(kWaitWho, 0, who-1); } }
void Noise::Init() { if (xyzGen) xyzGen->Reset(); else ReplaceReference( XYZGEN_REF, GetNewDefaultXYZGen()); if (texout) texout->Reset(); else ReplaceReference( TEXOUT_REF, GetNewDefaultTextureOutput()); ivalid.SetEmpty(); cacheValid.SetEmpty(); macroRecorder->Disable(); // disable macrorecorder during reset SetColor(0, Color(0.0f,0.0f,0.0f), TimeValue(0)); SetColor(1, Color(1.0f,1.0f,1.0f), TimeValue(0)); noiseType = NOISE_REGULAR; #ifndef RENDER_VER RegisterDistanceDefault(_T("Noise Params"), _T("Size"), DEFAULT_NOISE_SIZE, IN_TO_M(DEFAULT_NOISE_SIZE)); float size = GetDistanceDefault(_T("Noise Params"), _T("Size")); SetSize(size, TimeValue(0)); #else SetSize(DEFAULT_NOISE_SIZE, TimeValue(0)); #endif SetPhase(.0f,TimeValue(0)); SetLevels(3.0f,TimeValue(0)); pblock->SetValue(noise_hithresh,0,1.0f); macroRecorder->Enable(); for (int i=0; i<NSUBTEX; i++) mapOn[i] = 1; }
void plResponderComponent::IFixOldPB() { if (fCompPB) { if (fCompPB->Count(kResponderState) == 0) { IParamBlock2 *pb = CreateParameterBlock2(&gStateBlock, nil); int idx = fCompPB->Append(kResponderState, 1, (ReferenceTarget**)&pb); pb->SetValue(kStateCmdSwitch, 0, idx); } if (fCompPB->Count(kResponderStateName) == 0) { char *name = ""; fCompPB->Append(kResponderStateName, 1, &name); } // Make sure there is an enabled value for each command in the state for (int i = 0; i < fCompPB->Count(kResponderState); i++) { IParamBlock2* pb = (IParamBlock2*)fCompPB->GetReferenceTarget(kResponderState, 0, i); if (pb->Count(kStateCmdEnabled) != pb->Count(kStateCmdParams)) pb->SetCount(kStateCmdEnabled, pb->Count(kStateCmdParams)); } } }
void plResponderProc::MoveCommand(int oldIdx, int newIdx) { // Move data int insertIdx = (newIdx > oldIdx) ? newIdx+1 : newIdx; int deleteIdx = (newIdx < oldIdx) ? oldIdx+1 : oldIdx; ReferenceTarget *targ = fStatePB->GetReferenceTarget(kStateCmdParams, 0, oldIdx); fStatePB->Insert(kStateCmdParams, insertIdx, 1, &targ); fStatePB->Delete(kStateCmdParams, deleteIdx, 1); ReferenceTarget *wait = fStatePB->GetReferenceTarget(kStateCmdWait, 0, oldIdx); fStatePB->Insert(kStateCmdWait, insertIdx, 1, &wait); fStatePB->Delete(kStateCmdWait, deleteIdx, 1); BOOL oldEnabled = fStatePB->GetInt(kStateCmdEnabled, 0, oldIdx); BOOL newEnabled = fStatePB->GetInt(kStateCmdEnabled, 0, newIdx); fStatePB->SetValue(kStateCmdEnabled, 0, oldEnabled, newIdx); fStatePB->SetValue(kStateCmdEnabled, 0, newEnabled, oldIdx); ResponderWait::CmdMoved(fStatePB, oldIdx, newIdx); LoadList(); // Reselect item // (This doesn't send the LBN_SELCHANGE message so we do that manually) ListBox_SetCurSel(fhList, newIdx); ICreateCmdRollups(); }
/// Called to update the controls of the dialog virtual void Update( TimeValue t, Interval &valid, IParamMap2 *map ) { ICustButton *bmSelectBtn; IParamBlock2 *pblock; int i; long buttons[ 6 ] = { IDC_FRONT_NAME, IDC_BACK_NAME, IDC_LEFT_NAME, IDC_RIGHT_NAME, IDC_TOP_NAME, IDC_BOTTOM_NAME }; BitmapInfo bi; ParamMap2UserDlgProc::Update( t, valid, map ); pblock = map->GetParamBlock(); for( i = plStaticEnvLayer::kBmpFrontBitmap; i <= plStaticEnvLayer::kBmpBottomBitmap; i++ ) { bmSelectBtn = GetICustButton( GetDlgItem( map->GetHWnd(), buttons[ i ] ) ); PBBitmap *pbbm = pblock->GetBitmap( i, t ); if( pbbm ) bmSelectBtn->SetText( (TCHAR *)pbbm->bi.Filename() ); else bmSelectBtn->SetText( _T( "None" ) ); ReleaseICustButton( bmSelectBtn ); } plStaticEnvLayer *layer = (plStaticEnvLayer *)map->GetParamBlock()->GetOwner(); bi.SetName( layer->GetBaseFilename( t ) ); SetDlgItemText( map->GetHWnd(), IDC_BASE_FILENAME, bi.Filename() ); map->Enable( plStaticEnvLayer::kBmpGenerateFaces, ( bi.Name() == NULL || bi.Name()[ 0 ] == 0 ) ? FALSE : TRUE ); bmSelectBtn = GetICustButton( GetDlgItem( map->GetHWnd(), IDC_GENERATE_FACES ) ); bmSelectBtn->SetText( _T( "Generate From Node" ) ); ReleaseICustButton( bmSelectBtn ); i = pblock->GetInt( plStaticEnvLayer::kBmpTextureSize, t ); pblock->SetValue( plStaticEnvLayer::kBmpLastTextureSize, t, i ); }
void CellTex::Init() { if (xyzGen) xyzGen->Reset(); else ReplaceReference(1, GetNewDefaultXYZGen()); if (texout) texout->Reset(); else ReplaceReference(2, GetNewDefaultTextureOutput()); RegisterDistanceDefault(_T("Cellular Params"), _T("Size"), 5.0f, IN_TO_M(5.0f)); float size = GetDistanceDefault(_T("Cellular Params"), _T("Size")); pblock->SetValue(cellular_size,0,size); /* pblock->SetValue(PB_CELLCOL,0,Point3(1,1,1)); pblock->SetValue(PB_DIVCOL1,0,Point3(.5f,.5f,.5f)); pblock->SetValue(PB_DIVCOL2,0,Point3(0,0,0)); pblock->SetValue(PB_SIZE,0,5.0f); pblock->SetValue(PB_SPREAD,0,0.5f); pblock->SetValue(PB_LOW,0,0.0f); pblock->SetValue(PB_MID,0,0.5f); pblock->SetValue(PB_HIGH,0,1.0f); pblock->SetValue(PB_FRACT,0,0); pblock->SetValue(PB_ITER,0,3.0f); pblock->SetValue(PB_USECELLMAP,0,1); pblock->SetValue(PB_USEDIV1MAP,0,1); pblock->SetValue(PB_USEDIV2MAP,0,1); pblock->SetValue(PB_SMOOTH,0,0.1f); pblock->SetValue(PB_ADAPT,0,1); if (paramDlg) paramDlg->pmap->SetParamBlock(pblock); */ fract = 0; ivalid.SetEmpty(); }
BOOL OrientConstRotation::AppendTarget(INode *target, float weight){ if (target == NULL){ float var = 50.0f; int ct = pblock->Count(orientation_target_list); int ctf = pblock->Count(orientation_target_weight); theHold.Begin(); pblock->SetCount(orientation_target_list, ct + 1); pblock->SetValue(orientation_target_list, GetCOREInterface()->GetTime(), target, ct); pblock->Append(orientation_target_weight, 1, &var, 1); theHold.Accept(GetString(IDS_AG_ORIENTATION_LIST)); return TRUE; } else if (!(target->TestForLoop(FOREVER,(ReferenceMaker *) this)!=REF_SUCCEED)) { for (int i = 0; i < pblock->Count(orientation_target_list); i++){ if (target == pblock->GetINode(orientation_target_list, GetCOREInterface()->GetTime(), i)){ return FALSE; // the target is already in the targetlist } } theHold.Begin(); pblock->Append(orientation_target_list, 1, &target, 1); pblock->Append(orientation_target_weight, 1, &weight, 1); theHold.Accept(GetString(IDS_AG_ORIENTATION_LIST)); return TRUE; } return FALSE; }
virtual BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { int id = LOWORD(wParam); int code = HIWORD(wParam); IParamBlock2 *pb = map->GetParamBlock(); HWND cbox = NULL; switch (msg) { case WM_INITDIALOG: int i; for (i = 0; i < plMAXCameraLayer::kMaxUVSrc; i++) { cbox = GetDlgItem(hWnd, IDC_CAM_LAYER_UV_SRC); SendMessage(cbox, CB_ADDSTRING, 0, (LPARAM)plMAXCameraLayer::kUVStrings[i]); } UpdateDisplay(map); return TRUE; case WM_COMMAND: if (id == IDC_CAM_LAYER_UV_SRC) { pb->SetValue(plMAXCameraLayer::kUVSource, t, SendMessage(GetDlgItem(hWnd, id), CB_GETCURSEL, 0, 0)); return TRUE; } else if (id == IDC_CAM_LAYER_EXPLICIT_CAM) { UpdateDisplay(map); return TRUE; } break; } return FALSE; }
void Planet::SetPercent(float f, TimeValue t) { percent = f; // Also set land as percent/100. land = f/100.0f; // pblock->SetValue(PB_PERCENT, t, f); pblock->SetValue(planet_percent, t, f); }
void Water::SetNum(int i, TimeValue t, BOOL init) { count = i; waves.SetCount(count); waves.Resize(count); // pblock->SetValue(PB_NUM, t, i); pblock->SetValue(water_num, t, i); if (init) ReInit(); }
void Noise::SetLowThresh(float v) { if (pblock != NULL) { pblock->SetValue(noise_lowthresh,GetCOREInterface()->GetTime(),v); noise_param_blk.InvalidateUI(noise_lowthresh); } }
void Splat::SetThresh(float f, TimeValue t) { thresh = f; if (thresh < EPSILON) thresh = EPSILON; if (thresh > 1.0f-EPSILON) thresh = 1.0f-EPSILON; // pblock->SetValue(PB_THRESH, t, thresh); pblock->SetValue(splat_threshold, t, thresh); }
BOOL OrientConstRotation::SetTargetWeight(int targetNumber, float weight){ if (targetNumber >= 0 && targetNumber < pblock->Count(orientation_target_list)){ pblock->SetValue(orientation_target_weight, GetCOREInterface()->GetTime(), weight, targetNumber); return TRUE; } else{ return FALSE; } }
IParamBlock2 *plResponderCmdAnim::CreatePB(int idx) { int type = IndexToOldType(idx); // Create the paramblock and save it's type IParamBlock2 *pb = CreateParameterBlock2(&gResponderAnimBlock, nil); pb->SetValue(kRespAnimType, 0, type); return pb; }
void addbend() { try { float radius = 10, height = 10, angle = 10; int segments = 20; // Create a new object using CreateInstance() Object *obj = (Object*)CreateInstance(GEOMOBJECT_CLASS_ID, Class_ID(CYLINDER_CLASS_ID, 0)); // Get ahold of the parameter block IParamArray *iCylParams = obj->GetParamBlock(); // Get the current animation time TimeValue time = GetCOREInterface()->GetTime(); // Set the value of radius, height and segments. iCylParams->SetValue(obj->GetParamBlockIndex(CYLINDER_RADIUS), time, radius); iCylParams->SetValue(obj->GetParamBlockIndex(CYLINDER_HEIGHT), time, height); iCylParams->SetValue(obj->GetParamBlockIndex(CYLINDER_SEGMENTS), time, segments); auto* ip = GetCOREInterface(); INode *node = ip->CreateObjectNode(obj); //Create a new object using CreateInstance() auto pINode = ip->GetSelNode(0); log(L"New node name is {0} : \n", pINode->GetName()); // Get the current animation time /*iCylParams->SetValue(obj->GetParamBlockIndex(CYLINDER_RADIUS), time, 10); iCylParams->SetValue(obj->GetParamBlockIndex(CYLINDER_HEIGHT), time, 20); iCylParams->SetValue(obj->GetParamBlockIndex(CYLINDER_SEGMENTS), time, 10);*/ // Create a bend modifier Modifier *bend = (Modifier*)ip->CreateInstance(OSM_CLASS_ID, Class_ID(BENDOSM_CLASS_ID, 0)); log(L"{}",bend->GetName().data()); // Set the bend angle IParamBlock2* ipBendBlock = ((Animatable*)bend)->GetParamBlock(0); //only one pblock2 //ipBendBlock->SetValue(BEND_ANGLE, time, 10); ipBendBlock->SetValue(BEND_ANGLE, time, angle); GetCOREInterface12()->AddModifier(*pINode, *bend); GetCOREInterface12()->AddModifier(*node, *bend); } catch (const std::exception& e) { /*e.what(); log("Exception: " + std::string(e.what()));*/ } }
void mrTwoSidedShader::TranslateParameters(imrTranslation& translationInterface, imrShader* shader, TimeValue t, Interval& valid) { // The "map" parameters are translated using the shader connections. // The color parameters have already been translated by the automatic system if((shader != NULL) && (m_mainPB != NULL)) { BOOL frontMapOn; BOOL backMapOn; Texmap* frontMap; Texmap* backMap; AColor frontColor; AColor backColor; // Get the map values m_mainPB->GetValue(kMainPID_FrontColor, t, frontColor, valid); m_mainPB->GetValue(kMainPID_BackColor, t, backColor, valid); m_mainPB->GetValue(kMainPID_FrontMapOn, t, frontMapOn, valid); m_mainPB->GetValue(kMainPID_BackMapOn, t, backMapOn, valid); m_mainPB->GetValue(kMainPID_FrontMap, t, frontMap, valid); m_mainPB->GetValue(kMainPID_BackMap, t, backMap, valid); // Get the parameter blocks used to store the parameters IParamBlock2* parametersPB = shader->GetParametersParamBlock(); IParamBlock2* connectionsPB = shader->GetConnectionsParamBlock(); if((parametersPB != NULL) && (connectionsPB != NULL)) { ParamID paramID; // Translate the colors if(GetParamIDByName(paramID, _T("front"), parametersPB)) { parametersPB->SetValue(paramID, 0, frontColor); // Value must be set at time 0, this is a restriction of the system. } if(GetParamIDByName(paramID, _T("back"), parametersPB)) { parametersPB->SetValue(paramID, 0, backColor); // Value must be set at time 0, this is a restriction of the system. } // Set the shader connections. The shaders must be set before the "shader ON" flags // since setting a shader automatically turns the "ON" flag ON. if(GetParamIDByName(paramID, _T("front.shader"), connectionsPB)) { connectionsPB->SetValue(paramID, 0, frontMap); // Value must be set at time 0, this is a restriction of the system. } if(GetParamIDByName(paramID, _T("back.shader"), connectionsPB)) { connectionsPB->SetValue(paramID, 0, backMap); // Value must be set at time 0, this is a restriction of the system. } if(GetParamIDByName(paramID, _T("front.connected"), connectionsPB)) { connectionsPB->SetValue(paramID, 0, frontMapOn); // Value must be set at time 0, this is a restriction of the system. } if(GetParamIDByName(paramID, _T("back.connected"), connectionsPB)) { connectionsPB->SetValue(paramID, 0, backMapOn); // Value must be set at time 0, this is a restriction of the system. } } else { DbgAssert(false); } } else { DbgAssert(false); } }
void Set(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t) { if (id == plLODAvatarComponent::kMeshNodeAddBtn) { plLODAvatarComponent *comp = (plLODAvatarComponent *)owner; IParamBlock2 *pb = comp->GetParamBlockByID(plLODAvatarComponent::kBlkComp); int LodBeginState = pb->GetInt(plLODAvatarComponent::kLODState); INode *node = pb->GetINode(plLODAvatarComponent::kMeshNodeAddBtn, t); if (node) pb->SetValue(plLODAvatarComponent::kMeshNodeTab, t, node, LodBeginState); } }
void SmoothingGroupUIHandler::SetSmoothing (HWND hWnd, int buttonID, EPolyMod *pMod) { ICustButton *pBut = GetICustButton (GetDlgItem (hWnd, buttonID)); if (pBut == NULL) return; bool set = pBut->IsChecked()!=0; IParamBlock2 *pBlock = pMod->getParamBlock (); int i = buttonID - IDC_SMOOTH_GRP1; DWORD bit = DWORD(1)<<i; theHold.Begin (); bool startFresh = (pMod->GetPolyOperationID() != ep_op_smooth); if (startFresh) pMod->EpModSetOperation (ep_op_smooth); int acceptID; if (set) { int smoothers = startFresh ? 0 : pBlock->GetInt (epm_smooth_group_set); DWORD *realSmoothers = (DWORD *)((void *)&smoothers); (*realSmoothers) |= bit; pBlock->SetValue (epm_smooth_group_set, 0, smoothers); acceptID = IDS_SET_SMOOTHING; } else { int smoothers = startFresh ? 0 : pBlock->GetInt (epm_smooth_group_clear); DWORD *realSmoothers = (DWORD *)((void *)&smoothers); (*realSmoothers) |= bit; pBlock->SetValue (epm_smooth_group_clear, 0, smoothers); // Make sure to remove this from the ones being "set" as well, if needed: if (!startFresh && (smoothers = pBlock->GetInt (epm_smooth_group_set)) != 0) { if ((*realSmoothers) & bit) { (*realSmoothers) -= bit; pBlock->SetValue (epm_smooth_group_set, 0, smoothers); } } acceptID = IDS_CLEAR_SMOOTHING; } theHold.Accept (GetString (acceptID)); }
int Noise::FixLevel0() { // old files had level==0: this is to fix them if (pblock) { float l; Interval ivalid; pblock->GetValue( noise_levels, 0, l, ivalid ); if (l<1.0f) { pblock->SetValue( noise_levels, 0, 1.0f ); return 1; } } return 0; }
void CompositeMat::Init() { ivalid.SetEmpty(); Mtl *sm1 = NULL; Interval iv; pblock2->GetValue(compmat_mtls,0,sm1,iv,0); if (sm1 == NULL) { // pblock2->SetValue(compmat_mtls,0,m,i); HoldSuspend hs; // LAM - 6/12/04 - defect 571821 Mtl* mtl = (Mtl*)GetStdMtl2Desc()->Create(); hs.Resume(); pblock2->SetValue(compmat_mtls,0, mtl ,0); } }
void RendSpline::OnSetAspect(HWND hWnd, TimeValue t, ParamID widthID, ParamID lengthID) { CheckAspectLock(t); ISpinnerControl *iSpin = GetISpinner(GetDlgItem(hWnd, IDC_ASPECTSPIN)); mAspect = iSpin->GetFVal(); float width; pblock->GetValue(widthID,t,width,FOREVER); pblock->SetValue(lengthID,t,mAspect*width); ReleaseISpinner(iSpin); }
void RendSpline::SetGenUVW(BOOL sw) { if (sw==HasUVW()) return; else { BOOL doRender, doDisplay; pblock->GetValue(rnd_render,0.0f,doRender,FOREVER); // check if it's renderable pblock->GetValue(rnd_display,0.0f,doDisplay,FOREVER); // check if it's renderable if (doRender || doDisplay) pblock->SetValue(rnd_genuvw,0.0f,sw,0); // sets UVW ON if needed } UpdateUI(); //TODO: Set the plugin internal value to sw }
void plResponderWaitProc::LoadWho(bool setDefault) { HWND hWho = GetDlgItem(fhDlg, IDC_WAIT_WHO); int who = fWaitPB->GetInt(kWaitWho); ComboBox_ResetContent(hWho); int numFound = 0; // Copy all the commands before this one to the 'who' combo box for (int i = 0; i < fCurCmd; i++) { IParamBlock2 *pb = GetCmdParams(i); plResponderCmd *cmd = plResponderCmd::Find(pb); if (cmd->IsWaitable(pb)) { int idx = ComboBox_AddString(hWho, cmd->GetInstanceName(pb)); ComboBox_SetItemData(hWho, idx, i); // If the saved 'who' is valid, select it and check the wait checkbox if (who == i) { ComboBox_SetCurSel(hWho, idx); CheckDlgButton(fhDlg, IDC_CHECK_WAIT, BST_CHECKED); EnableWindow(hWho, TRUE); } numFound++; } } // Pick the last item in the who combo as the default if (setDefault && numFound > 0) { HWND hWho = GetDlgItem(fhDlg, IDC_WAIT_WHO); int idx = ComboBox_GetItemData(hWho, numFound-1); fWaitPB->SetValue(kWaitWho, 0, idx); ComboBox_SetCurSel(hWho, numFound-1); CheckDlgButton(fhDlg, IDC_CHECK_WAIT, BST_CHECKED); EnableWindow(hWho, TRUE); } // Disable the wait checkbox if there are no waitable commands behind this one EnableWindow(GetDlgItem(fhDlg, IDC_CHECK_WAIT), (numFound > 0)); }