BOOL PFOperatorSimplePositionDlgProc::DlgProc( TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { IParamBlock2* pblock; switch ( msg ) { case WM_INITDIALOG: // Send the message to notify the initialization of dialog map->GetParamBlock()->NotifyDependents( FOREVER, (PartID)map, kSimplePosition_RefMsg_InitDlg ); break; case WM_DESTROY: break; case WM_COMMAND: pblock = (map != NULL) ? map->GetParamBlock() : NULL; switch ( LOWORD( wParam ) ) { case IDC_NEW: if (pblock) pblock->NotifyDependents( FOREVER, PART_OBJ, kSimplePosition_RefMsg_NewRand ); break; case kSimplePosition_message_lock: if (pblock) UpdateInheritSpeedDlg( hWnd, pblock->GetInt(kSimplePosition_lock, t), pblock->GetInt(kSimplePosition_inherit, t)); break; case kSimplePosition_message_type: if (pblock) UpdateDistinctPointsDlg( hWnd, pblock->GetInt(kSimplePosition_type, t), pblock->GetInt(kSimplePosition_distinctOnly, t)); break; } break; } return FALSE; }
//+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+ //| custom UI update for Duration Test | //+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+ INT_PTR TestGoToRotationDlgProc::DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { IParamBlock2* pblock; case WM_INITDIALOG: // Send the message to notify the initialization of dialog map->GetParamBlock()->NotifyDependents( FOREVER, (PartID)map, kGoToRotation_RefMsg_InitDlg ); break; case WM_COMMAND: pblock = map->GetParamBlock(); switch (LOWORD(wParam)) { case IDC_NEW: if (pblock) pblock->NotifyDependents(FOREVER, PART_OBJ, kGoToRotation_RefMsg_NewRand); return TRUE; case kGoToRotation_message_sync: if (pblock) UpdateSyncDlg( hWnd, pblock->GetInt(kGoToRotation_syncBy,t) ); break; case kGoToRotation_message_variation: if (pblock) UpdateVariationDlg( hWnd, pblock->GetTimeValue(kGoToRotation_variation,t), pblock->GetFloat(kGoToRotation_spinVariation,t) ); break; case kGoToRotation_message_match: if (pblock) UpdateMatchDlg( hWnd, pblock->GetInt(kGoToRotation_matchSpin,t) ); break; } break; } return FALSE; }
void PFOperatorSimpleOrientationDlgProc::SetCtlByDir(IParamMap2* map, HWND hWnd) { BOOL bEulerSpinOn = false; if(map && hWnd) { IParamBlock2* ppb = map->GetParamBlock(); if(ppb) { int iDir = ppb->GetInt(kSimpleOrientation_direction, 0); if((iDir == kSO_World) || (iDir == kSO_Speed) || (iDir == kSO_SpeedFollow)) bEulerSpinOn = true; EnableWindow(GetDlgItem(hWnd, IDC_XTEXT), bEulerSpinOn); ISpinnerControl* psc = GetISpinner(GetDlgItem(hWnd, IDC_XSPIN)); psc->Enable(bEulerSpinOn); ReleaseISpinner(psc); EnableWindow(GetDlgItem(hWnd, IDC_YTEXT), bEulerSpinOn); psc = GetISpinner(GetDlgItem(hWnd, IDC_YSPIN)); psc->Enable(bEulerSpinOn); ReleaseISpinner(psc); EnableWindow(GetDlgItem(hWnd, IDC_ZTEXT), bEulerSpinOn); psc = GetISpinner(GetDlgItem(hWnd, IDC_ZSPIN)); psc->Enable(bEulerSpinOn); ReleaseISpinner(psc); bool bDivergenceAvailable = ((iDir != kSO_Rand_3D) && (iDir != kSO_SpeedFollow)); EnableWindow(GetDlgItem(hWnd, IDC_DIVERGENCETEXT), bDivergenceAvailable); psc = GetISpinner(GetDlgItem(hWnd, IDC_DIVERGENCESPIN)); psc->Enable(bDivergenceAvailable); ReleaseISpinner(psc); EnableWindow(GetDlgItem(hWnd, IDC_RESTRICTTOAXIS), bDivergenceAvailable); bool bRestrictToAxis = (ppb->GetInt(kSimpleOrientation_restrictToAxis, 0) != 0) && bDivergenceAvailable; EnableWindow(GetDlgItem(hWnd, IDC_DIVERGENCEAXISBOX), bRestrictToAxis); EnableWindow(GetDlgItem(hWnd, IDC_AXISXTEXT), bRestrictToAxis); psc = GetISpinner(GetDlgItem(hWnd, IDC_AXISXSPIN)); psc->Enable(bRestrictToAxis); ReleaseISpinner(psc); EnableWindow(GetDlgItem(hWnd, IDC_AXISYTEXT), bRestrictToAxis); psc = GetISpinner(GetDlgItem(hWnd, IDC_AXISYSPIN)); psc->Enable(bRestrictToAxis); ReleaseISpinner(psc); EnableWindow(GetDlgItem(hWnd, IDC_AXISZTEXT), bRestrictToAxis); psc = GetISpinner(GetDlgItem(hWnd, IDC_AXISZSPIN)); psc->Enable(bRestrictToAxis); ReleaseISpinner(psc); bool bChaosAvailable = (iDir != kSO_SpeedFollow); EnableWindow(GetDlgItem(hWnd, IDC_UNIQUENESSBOX), bChaosAvailable); EnableWindow(GetDlgItem(hWnd, IDC_SEEDTEXT), bChaosAvailable); psc = GetISpinner(GetDlgItem(hWnd, IDC_SEEDSPIN)); psc->Enable(bChaosAvailable); ReleaseISpinner(psc); ICustButton* but = GetICustButton(GetDlgItem(hWnd, IDC_NEW)); but->Enable(bChaosAvailable); ReleaseICustButton(but); } } }
void UpdateDisplay(IParamMap2 *pmap) { HWND hWnd = pmap->GetHWnd(); IParamBlock2 *pb = pmap->GetParamBlock(); HWND cbox; cbox = GetDlgItem(hWnd, IDC_CAM_LAYER_UV_SRC); SendMessage(cbox, CB_SETCURSEL, pb->GetInt(plMAXCameraLayer::kUVSource), 0); bool reflect = (pb->GetInt(ParamID(plMAXCameraLayer::kExplicitCam)) == 0); EnableWindow(GetDlgItem(hWnd, IDC_CAM_LAYER_UV_SRC), !reflect); }
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; }
/// Clamp texture sizes to a power of 2 void IClampTexSizeSpinner( TimeValue t, IParamMap2 *map ) { IParamBlock2 *pblock = map->GetParamBlock(); int lastVal = pblock->GetInt( plStaticEnvLayer::kBmpLastTextureSize, t ); int tempVal, newVal = pblock->GetInt( plStaticEnvLayer::kBmpTextureSize, t ); if( newVal < lastVal ) { lastVal = newVal; for( tempVal = 1; tempVal < newVal; tempVal <<= 1 ); newVal = tempVal >> 1; }
plLayerInterface *plLayerConverter::IConvertDynamicTextLayer( plPlasmaMAXLayer *layer, plMaxNode *maxNode, uint32_t blendFlags, bool preserveUVOffset, bool upperLayer ) { hsGuardBegin( "plLayerConverter::IConvertDynamicTextLayer" ); plDynamicTextLayer *maxLayer; IParamBlock2 *bitmapPB; plLocation loc; maxLayer = (plDynamicTextLayer *)layer; loc = maxNode->GetLocation(); bitmapPB = maxLayer->GetParamBlockByID( plDynamicTextLayer::kBlkBitmap ); if( !bitmapPB ) { fErrorMsg->Set( !bitmapPB, "Plasma Layer Error", "Bitmap paramblock for Plasma Layer not found" ).Show(); fErrorMsg->Set(); return nil; } // Get a new layer to play with plLayer *plasmaLayer = ICreateLayer( plString::FromUtf8( maxLayer->GetName() ), upperLayer, loc ); /// UV Gen IProcessUVGen( maxLayer, plasmaLayer, nil, preserveUVOffset ); // Create the "texture" plDynamicTextMap *texture = ICreateDynTextMap( plasmaLayer->GetKeyName(), bitmapPB->GetInt( plDynamicTextLayer::kBmpExportWidth ), bitmapPB->GetInt( plDynamicTextLayer::kBmpExportHeight ), bitmapPB->GetInt( plDynamicTextLayer::kBmpIncludeAlphaChannel ), maxNode ); // Set the initial bitmap if necessary uint32_t *initBuffer = IGetInitBitmapBuffer( maxLayer ); if( initBuffer != nil ) { texture->SetInitBuffer( initBuffer ); delete [] initBuffer; } // Add the texture in hsgResMgr::ResMgr()->AddViaNotify( texture->GetKey(), new plLayRefMsg( plasmaLayer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture ), plRefFlags::kActiveRef ); // All done! return (plLayerInterface *)plasmaLayer; hsGuardEnd; }
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; }
// Called at the start of each frame void VRayCamera::frameBegin(VR::VRayRenderer *vray) { const VR::VRayFrameData &fdata = vray->getFrameData(); TimeValue t = fdata.t; stereo_camera=pblock->GetInt(pb_camera, t); // angles in paramblock are automatically converted to radians, so no need to convert here fov_angle = pblock->GetFloat(pb_fov_angle, t); parallax_distance = pblock->GetFloat(pb_parallax_distance, t); separation = pblock->GetFloat(pb_separation, t); neck_offset = pblock->GetFloat(pb_neck_offset, t); forward_tilt = pblock->GetFloat(pb_forward_tilt, t); tilt_compensation = pblock->GetInt(pb_tilt_compensation, t); separation_map = pblock->GetBitmap(pb_separation_map, t); if (separation_map != NULL) { separation_map->Load(); if (separation_map->bm != NULL) { separation_map->bm->SetFilter(BMM_FILTER_PYRAMID); } } head_turn_map = pblock->GetBitmap(pb_head_turn_map, t); if (head_turn_map != NULL) { head_turn_map->Load(); if (head_turn_map->bm != NULL) { head_turn_map->bm->SetFilter(BMM_FILTER_PYRAMID); } } head_tilt_map = pblock->GetBitmap(pb_head_tilt_map, t); if (head_tilt_map != NULL) { head_tilt_map->Load(); if (head_tilt_map->bm != NULL) { head_tilt_map->bm->SetFilter(BMM_FILTER_PYRAMID); } } vertical_mode = pblock->GetInt(pb_vertical_mode, t); flip_x = pblock->GetInt(pb_flip_x, t); flip_y = pblock->GetInt(pb_flip_y, t); //fov=pblock->GetFloat(pb_fov, fdata.t); fov = 1.0; // fov_angle/ 2.0f; // [rz] testing only. Need better approximation formula. targetDist = GetTDist((TimeValue) fdata.t); aperture = 0.0f; camera.SetPos(fdata.camToWorld.offs, -fdata.camToWorld.m[2], fdata.camToWorld.m[1], fdata.camToWorld.m[0]); camera.Init(fdata.imgWidth, fdata.imgHeight, fov, 1.0f, aperture, targetDist); this->vray = vray; }
uint32_t *plLayerConverter::IGetInitBitmapBuffer( plDynamicTextLayer *layer ) const { uint32_t *buffer; hsRGBAColor32 *buffPtr; uint16_t width, height; IParamBlock2 *bitmapPB = layer->GetParamBlockByID( plDynamicTextLayer::kBlkBitmap ); Bitmap *initBitmap = layer->GetBitmap( TimeValue( 0 ) ); if( bitmapPB->GetInt( (ParamID)plDynamicTextLayer::kBmpUseInitImage ) == 0 || initBitmap == nil ) return nil; width = bitmapPB->GetInt( (ParamID)plDynamicTextLayer::kBmpExportWidth ); height = bitmapPB->GetInt( (ParamID)plDynamicTextLayer::kBmpExportHeight ); buffer = new uint32_t[ width * height ]; if( buffer == nil ) return nil; // Fill buffer from the MAX bitmap PixelBuf l64( width ); BMM_Color_64 *p64 = l64.Ptr(); buffPtr = (hsRGBAColor32 *)buffer; for( int y = 0; y < height; y++ ) { hsRGBAColor32 color; if( !initBitmap->GetLinearPixels( 0, y, width, p64 ) ) { delete [] buffer; return nil; } for( int x = 0; x < width; x++ ) { const float konst = 255.f / 65535.f; color.SetARGB((uint8_t)(p64[ x ].a * konst), (uint8_t)(p64[ x ].r * konst), (uint8_t)(p64[ x ].g * konst), (uint8_t)(p64[ x ].b * konst)); buffPtr[ x ] = color; } buffPtr += width; } return buffer; }
// A command was moved from oldIdx to newIdx. Fix all the wait commands. void ResponderWait::CmdMoved(IParamBlock2 *state, int oldIdx, int newIdx) { int numCmds = state->Count(kStateCmdParams); // Moved forward if (oldIdx < newIdx) { // Patch up the commands that were ahead of this one for (int i = oldIdx; i < numCmds; i++) { if (i == newIdx) continue; IParamBlock2 *pb = GetWaitBlk(state, i); int who = pb->GetInt(kWaitWho); // If the command was waiting on the moved one, and is now behind it, invalidate it if (who == oldIdx && i < newIdx) pb->SetValue(kWaitWho, 0, -1); // else if (who == oldIdx) pb->SetValue(kWaitWho, 0, newIdx); // If it was waiting on one ahead of it, correct the index else if (who > oldIdx && who <= newIdx) pb->SetValue(kWaitWho, 0, who-1); } } // Moved backward else { // If this command was waiting on any of the commands now ahead of it, invalidate it IParamBlock2 *movedPB = GetWaitBlk(state, newIdx); int who = movedPB->GetInt(kWaitWho); if (who >= newIdx) movedPB->SetValue(kWaitWho, 0, -1); for (int i = newIdx+1; i < numCmds; i++) { // Is this command waiting on any of the commands it is moving in back of? IParamBlock2 *pb = GetWaitBlk(state, i); int who = pb->GetInt(kWaitWho); if (who == oldIdx) pb->SetValue(kWaitWho, 0, newIdx); if (who >= newIdx && who < oldIdx) pb->SetValue(kWaitWho, 0, who+1); } } }
const char* plResponderProc::GetCommandName(int cmdIdx) { static char buf[256]; if (fStatePB->Count(kStateCmdParams) > cmdIdx) { buf[0] = '\0'; BOOL enabled = fStatePB->GetInt(kStateCmdEnabled, 0, cmdIdx); if (!enabled) strcat(buf, "[D]"); IParamBlock2 *cmdPB = (IParamBlock2*)fStatePB->GetReferenceTarget(kStateCmdParams, 0, cmdIdx); plResponderCmd *cmd = plResponderCmd::Find(cmdPB); IParamBlock2 *waitPB = (IParamBlock2*)fStatePB->GetReferenceTarget(kStateCmdWait, 0, cmdIdx); int waitingOn = ResponderWait::GetWaitingOn(waitPB); if (waitingOn != -1) { char num[10]; sprintf(num, "(%d)", waitingOn+1); strcat(buf, num); } strcat(buf, cmd->GetInstanceName(cmdPB)); return buf; } hsAssert(0, "Bad index to GetCommandName"); return nil; }
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 ); }
BOOL PFOperatorSimpleShapeDlgProc::DlgProc( TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { IParamBlock2* pblock; switch ( msg ) { case WM_INITDIALOG: // Send the message to notify the initialization of dialog pblock = map->GetParamBlock(); if (pblock) pblock->NotifyDependents( FOREVER, (PartID)map, kSimpleShape_RefMsg_InitDlg ); break; case WM_DESTROY: break; case WM_COMMAND: switch ( LOWORD( wParam ) ) { case kSimpleShape_message_useScale: pblock = map->GetParamBlock(); if (pblock) UpdateScaleDlg(hWnd, pblock->GetInt(kSimpleShape_useScale, 0) ); break; } break; } return FALSE; }
BOOL plResponderAnimProc::DlgProc(TimeValue t, IParamMap2 *pm, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: { IParamBlock2 *pb = pm->GetParamBlock(); int type = pb->GetInt(kRespAnimType); // Only show the loop control if this is a loop command int show = (type == kRespondLoopAnimOn) ? SW_SHOW : SW_HIDE; ShowWindow(GetDlgItem(hWnd, IDC_LOOP_COMBO), show); ShowWindow(GetDlgItem(hWnd, IDC_LOOP_TEXT), show); // Resize the dialog if we're not using the loop control if (type != kRespondLoopAnimOn) { RECT itemRect, clientRect; GetWindowRect(GetDlgItem(hWnd, IDC_LOOP_TEXT), &itemRect); GetWindowRect(hWnd, &clientRect); SetWindowPos(hWnd, NULL, 0, 0, clientRect.right-clientRect.left, itemRect.top-clientRect.top, SWP_NOMOVE | SWP_NOZORDER); } if (IsSoundMsg(type)) SetDlgItemText(hWnd, IDC_COMP_TEXT, "Sound Component"); } break; } return plAnimCompProc::DlgProc(t, pm, hWnd, msg, wParam, lParam); }
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; int selection; switch (msg) { case WM_INITDIALOG: cbox = GetDlgItem(hWnd, IDC_GRASS_WAVE); SendMessage(cbox, CB_ADDSTRING, 0, (LPARAM)"1"); SendMessage(cbox, CB_ADDSTRING, 1, (LPARAM)"2"); SendMessage(cbox, CB_ADDSTRING, 2, (LPARAM)"3"); SendMessage(cbox, CB_ADDSTRING, 3, (LPARAM)"4"); selection = pb->GetInt(plGrassComponent::kWave); ISetToWave(selection, hWnd, pb, map); return TRUE; case WM_COMMAND: case CC_SPINNER_CHANGE: int wave = SendMessage(GetDlgItem(hWnd, IDC_GRASS_WAVE), CB_GETCURSEL, 0, 0); if (id == IDC_GRASS_WAVE) { if (wave != pb->GetInt(ParamID(plGrassComponent::kWave))) ISetToWave(wave, hWnd, pb, map); } else if (id == IDC_GRASS_DIST_X || id == IDC_GRASS_DIST_X_SPIN) pb->SetValue(plGrassComponent::kDistXTab, 0, pb->GetFloat(ParamID(plGrassComponent::kDistX)), wave); else if (id == IDC_GRASS_DIST_Y || id == IDC_GRASS_DIST_Y_SPIN) pb->SetValue(plGrassComponent::kDistYTab, 0, pb->GetFloat(ParamID(plGrassComponent::kDistY)), wave); else if (id == IDC_GRASS_DIST_Z || id == IDC_GRASS_DIST_Z_SPIN) pb->SetValue(plGrassComponent::kDistZTab, 0, pb->GetFloat(ParamID(plGrassComponent::kDistZ)), wave); else if (id == IDC_GRASS_DIR_X || id == IDC_GRASS_DIR_X_SPIN) pb->SetValue(plGrassComponent::kDirXTab, 0, pb->GetFloat(ParamID(plGrassComponent::kDirX)), wave); else if (id == IDC_GRASS_DIR_Y || id == IDC_GRASS_DIR_Y_SPIN) pb->SetValue(plGrassComponent::kDirYTab, 0, pb->GetFloat(ParamID(plGrassComponent::kDirY)), wave); else if (id == IDC_GRASS_SPEED || id == IDC_GRASS_SPEED_SPIN) pb->SetValue(plGrassComponent::kSpeedTab, 0, pb->GetFloat(ParamID(plGrassComponent::kSpeed)), wave); return TRUE; } return FALSE; }
void plResponderProc::LoadState() { fStatePB = (IParamBlock2*)fPB->GetReferenceTarget(kResponderState, 0, fCurState); IRemoveCmdRollups(); LoadList(); HWND hSwitchCombo = GetDlgItem(fhDlg, IDC_SWITCH_COMBO); ComboBox_SetCurSel(hSwitchCombo, fStatePB->GetInt(kStateCmdSwitch)); }
BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: { IParamBlock2 *pb = map->GetParamBlock(); // Enable the min and max controls (that are only valid with stop points) // if at least one of the targets has a stop point plAnimComponent *comp = (plAnimComponent*)pb->GetOwner(); int num = comp->NumTargets(); bool stopPoints = false; for (int i = 0; i < num; i++) { if (DoesHaveStopPoints(comp->GetTarget(i))) { stopPoints = true; break; } } EnableStopPoints(map, stopPoints); // If we're doing an ease, set the ease rollup to open if (pb->GetInt(kAnimEaseInType) != plAnimEaseTypes::kNoEase || pb->GetInt(kAnimEaseOutType) != plAnimEaseTypes::kNoEase) PostMessage(hWnd, WM_ROLLOUT_OPEN, 0, 0); } return TRUE; // Max doesn't know about the rollup until after WM_CREATE, so we get // around it by posting a message case WM_ROLLOUT_OPEN: { IRollupWindow *rollup = GetCOREInterface()->GetCommandPanelRollup(); int idx = rollup->GetPanelIndex(hWnd); rollup->SetPanelOpen(idx, TRUE); } return TRUE; } return FALSE; }
INT_PTR PFOperatorMaterialFrequencyDlgProc::DlgProc( TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { // BOOL alignTo, angleDistortion; IParamBlock2* pblock; switch ( msg ) { case WM_INITDIALOG: // Send the message to notify the initialization of dialog map->GetParamBlock()->NotifyDependents( FOREVER, (PartID)map, kMaterialFrequency_RefMsg_InitDlg ); break; case WM_DESTROY: break; case WM_COMMAND: switch ( LOWORD( wParam ) ) { case IDC_NEW: map->GetParamBlock()->NotifyDependents( FOREVER, PART_OBJ, kMaterialFrequency_RefMsg_NewRand ); break; case kMaterialFrequency_message_assignMaterial: pblock = map->GetParamBlock(); if (pblock != NULL) UpdateAssignMaterialDlg( hWnd, pblock->GetInt(kMaterialFrequency_assignMaterial, t), pblock->GetInt(kMaterialFrequency_assignID, t), pblock->GetMtl(kMaterialFrequency_material, t) ); break; case kMaterialFrequency_message_numSubMtls: pblock = map->GetParamBlock(); if (pblock != NULL) UpdateNumSubMtlsDlg( hWnd, pblock->GetMtl(kMaterialFrequency_material, t) ); break; case kMaterialFrequency_message_assignID: pblock = map->GetParamBlock(); if (pblock != NULL) UpdateAssignIDDlg( hWnd, pblock->GetInt(kMaterialFrequency_assignID, t)); break; } break; } return FALSE; }
void plResponderProc::IDrawComboItem(DRAWITEMSTRUCT *dis) { if (dis->itemID == -1) // empty item return; // The colors depend on whether the item is selected. COLORREF clrForeground = SetTextColor(dis->hDC, GetSysColor(dis->itemState & ODS_SELECTED ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT)); COLORREF clrBackground = SetBkColor(dis->hDC, GetSysColor(dis->itemState & ODS_SELECTED ? COLOR_HIGHLIGHT : COLOR_WINDOW)); // Calculate the vertical and horizontal position. TEXTMETRIC tm; GetTextMetrics(dis->hDC, &tm); int y = (dis->rcItem.bottom + dis->rcItem.top - tm.tmHeight) / 2; int x = LOWORD(GetDialogBaseUnits()) / 4; // If this is a command, not a state, make it bold HFONT oldFont = nil; if (dis->itemData != kStateName) { LOGFONT lf; memset(&lf, 0, sizeof(lf)); lf.lfHeight = tm.tmHeight; lf.lfWeight = FW_BOLD; GetTextFace(dis->hDC, LF_FACESIZE, lf.lfFaceName); HFONT boldFont = CreateFontIndirect(&lf); oldFont = SelectFont(dis->hDC, boldFont); } // Get and display the text for the list item. char buf[256]; ComboBox_GetLBText(dis->hwndItem, dis->itemID, buf); if (fPB->GetInt(kResponderStateDef) == dis->itemID) { char buf2[256]; sprintf(buf2, "* %s", buf); strcpy(buf, buf2); } ExtTextOut(dis->hDC, x, y, ETO_CLIPPED | ETO_OPAQUE, &dis->rcItem, buf, strlen(buf), NULL); // Restore the previous colors. SetTextColor(dis->hDC, clrForeground); SetBkColor(dis->hDC, clrBackground); if (oldFont) DeleteFont(SelectFont(dis->hDC, oldFont)); // If the item has the focus, draw focus rectangle. if (dis->itemState & ODS_FOCUS) DrawFocusRect(dis->hDC, &dis->rcItem); }
void ISetupScaleLock(IParamMap2* map, BOOL onInit=false) { IParamBlock2 *pb = map->GetParamBlock(); if( pb->GetInt(plDistribComponent_old::kLockScaleXYZ) ) { map->Enable(plDistribComponent_old::kLockScaleXY, FALSE); map->Enable(plDistribComponent_old::kScaleLoY, FALSE); map->Enable(plDistribComponent_old::kScaleHiY, FALSE); map->Enable(plDistribComponent_old::kScaleLoZ, FALSE); map->Enable(plDistribComponent_old::kScaleHiZ, FALSE); } else if( pb->GetInt(plDistribComponent_old::kLockScaleXY) ) { map->Enable(plDistribComponent_old::kLockScaleXY, TRUE); map->Enable(plDistribComponent_old::kScaleLoY, FALSE); map->Enable(plDistribComponent_old::kScaleHiY, FALSE); map->Enable(plDistribComponent_old::kScaleLoZ, TRUE); map->Enable(plDistribComponent_old::kScaleHiZ, TRUE); } else { map->Enable(plDistribComponent_old::kLockScaleXY, TRUE); map->Enable(plDistribComponent_old::kScaleLoY, TRUE); map->Enable(plDistribComponent_old::kScaleHiY, TRUE); map->Enable(plDistribComponent_old::kScaleLoZ, TRUE); map->Enable(plDistribComponent_old::kScaleHiZ, TRUE); } if( onInit ) { map->SetTooltip(plDistribComponent_old::kLockScaleXY, TRUE, "Lock scale in X and Y" ); map->SetTooltip(plDistribComponent_old::kLockScaleXYZ, TRUE, "Lock scale in X, Y and Z (uniform scale)" ); } }
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); } }
// Determine if any of the wait commands will be invalidated by this move bool ResponderWait::ValidateCmdMove(IParamBlock2 *state, int oldIdx, int newIdx) { // Moving forward if (oldIdx < newIdx) { // Are any of the commands ahead of this one waiting on it? for (int i = oldIdx+1; i <= newIdx; i++) { IParamBlock2 *pb = GetWaitBlk(state, i); if (pb->GetInt(kWaitWho) == oldIdx) { int ret = hsMessageBox("You are moving this command ahead of another command that waits on it.\nAre you sure you want to do that?", "Warning", hsMessageBoxYesNo); if (ret == hsMBoxYes) return true; else return false; } } } // Moving backward else { // Is this command waiting on any of the commands it is moving in back of? IParamBlock2 *pb = GetWaitBlk(state, oldIdx); int who = pb->GetInt(kWaitWho); if (who >= newIdx && who < oldIdx) { int ret = hsMessageBox("You are moving this command behind another command that it is waiting on.\nAre you sure you want to do that?", "Warning", hsMessageBoxYesNo); if (ret == hsMBoxYes) return true; else return false; } } return true; }
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)); }
void plResponderComponent::IConvertCmds(plMaxNode* node, plErrorMsg* pErrMsg, int state, CmdIdxs& cmdIdxs) { IParamBlock2 *statePB = (IParamBlock2*)fCompPB->GetReferenceTarget(kResponderState, 0, state); plResponderModifier *responder = IGetResponderMod(node); // Add the messages to the logic modifier for (int i = 0; i < statePB->Count(kStateCmdParams); i++) { plMessage *msg = nil; BOOL enabled = statePB->GetInt(kStateCmdEnabled, 0, i); if (!enabled) continue; IParamBlock2 *cmdPB = (IParamBlock2*)statePB->GetReferenceTarget(kStateCmdParams, 0, i); try { plResponderCmd *cmd = plResponderCmd::Find(cmdPB); if (cmd) msg = cmd->CreateMsg(node, pErrMsg, cmdPB); } catch (char *reason) { char buf[512]; char stateName[128]; const char *curStateName = fCompPB->GetStr(kResponderStateName, 0, state); if (curStateName && *curStateName != '\0') strcpy(stateName, fCompPB->GetStr(kResponderStateName, 0, state)); else sprintf(stateName, "State %d", state+1); sprintf(buf, "A responder command failed to export.\n\nResponder:\t%s\nState:\t\t%s\nCommand:\t%d\n\nReason: %s", GetINode()->GetName(), stateName, i+1, reason); pErrMsg->Set(true, "Responder Warning", buf).Show(); pErrMsg->Set(false); } if (msg) { msg->SetSender(responder->GetKey()); responder->AddCommand(msg, state); int idx = responder->fStates[state].fCmds.Count()-1; cmdIdxs[i] = idx; } } }
//+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+ //| custom UI update for Duration Test | //+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+ INT_PTR TestSpawnOnCollisionDlgProc::DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { IParamBlock2* pblock; case WM_INITDIALOG: pblock = map->GetParamBlock(); UpdateSpawnTypeDlg( hWnd, pblock->GetInt(kSpawnCollision_spawnType,t), pblock->GetInt(kSpawnCollision_deleteParent,t) ); UpdateSpeedTypeDlg( hWnd, pblock->GetInt(kSpawnCollision_speedType,t) ); UpdateRandomSeedDlg( hWnd, pblock->GetFloat(kSpawnCollision_spawnAble,t), pblock->GetFloat(kSpawnCollision_numVariation,t), pblock->GetFloat(kSpawnCollision_speedVariation,t), pblock->GetFloat(kSpawnCollision_speedDivergence,t), pblock->GetFloat(kSpawnCollision_scaleVariation,t) ); break; case WM_COMMAND: pblock = map->GetParamBlock(); switch (LOWORD(wParam)) { case IDC_NEW: if (pblock) pblock->NotifyDependents(FOREVER, PART_OBJ, kSpawnCollision_RefMsg_NewRand); return TRUE; case IDC_COLLISION_PICKNODE: if (pblock) pblock->NotifyDependents( FOREVER, 0, kSpawnCollision_RefMsg_ResetValidatorAction ); break; case IDC_BYLIST: if (pblock) pblock->NotifyDependents( FOREVER, 0, kSpawnCollision_RefMsg_ListSelect ); break; case kSpawnCollision_message_type: pblock = map->GetParamBlock(); UpdateSpawnTypeDlg( hWnd, pblock->GetInt(kSpawnCollision_spawnType,t), pblock->GetInt(kSpawnCollision_deleteParent,t) ); break; case kSpawnCollision_message_speed: pblock = map->GetParamBlock(); UpdateSpeedTypeDlg( hWnd, pblock->GetInt(kSpawnCollision_speedType,t) ); break; case kSpawnCollision_message_random: pblock = map->GetParamBlock(); UpdateRandomSeedDlg( hWnd, pblock->GetFloat(kSpawnCollision_spawnAble,t), pblock->GetFloat(kSpawnCollision_numVariation,t), pblock->GetFloat(kSpawnCollision_speedVariation,t), pblock->GetFloat(kSpawnCollision_speedDivergence,t), pblock->GetFloat(kSpawnCollision_scaleVariation,t) ); break; case kSpawnCollision_message_deflectors: pblock = map->GetParamBlock(); if (pblock) UpdateDeflectorsDlg( hWnd, pblock->Count(kSpawnCollision_deflectors) ); break; } 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 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)); }
void Set(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t) { if (id == plClothingComponent::kMeshNodeAddBtn) { plClothingComponent *comp = (plClothingComponent *)owner; IParamBlock2 *pb = comp->GetParamBlockByID(plClothingComponent::kBlkComp); int state = pb->GetInt(plClothingComponent::kLODState); INode *node = pb->GetINode(plClothingComponent::kMeshNodeAddBtn); if (node) pb->SetValue(plClothingComponent::kMeshNodeTab, 0, node, state); } if (id == plClothingComponent::kMeshNodeTab) { plComponentBase *comp = (plComponentBase*)owner; comp->NotifyDependents(FOREVER, PART_ALL, REFMSG_USER_COMP_REF_CHANGED); } }