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)); } } }
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; }
void Composite::SetSubTexmap(int i, Texmap *m) { if (i>=subTex.Count()) { int n = subTex.Count(); subTex.SetCount(i+1); pblock->SetCount(comptex_tex,i+1); for (int j=n; j<=i; j++) subTex[j] = NULL; } ReplaceReference(i+1,m); ivalid.SetEmpty(); if (paramDlg) paramDlg->UpdateSubTexNames(); }
void Composite::SetNumMaps(int n) { int ct = subTex.Count(); if (n!=ct) { if (n<ct) { for (int i=n; i<ct; i++) { // Tell mtledit to deactivate texture map in UI if (subTex[i]) subTex[i]->DeactivateMapsInTree(); ReplaceReference(i+1,NULL); } } subTex.SetCount(n); // [dl | 01oct2003] Bug#525010. Initialize the new elements in the tab or pblock->SetCount() // may try to deference an invalid pointer from this tab. for(int j = ct; j < n; ++j) { subTex[j] = NULL; } // mapOn.SetCount(n); pblock->SetCount(comptex_tex,n); macroRec->Disable(); // JBW 4/21/99, only record one count change pblock->SetCount(comptex_ons,n); macroRec->Enable(); if (n>ct) { for (int i=ct; i<subTex.Count(); i++) { subTex[i] = NULL; pblock->SetValue(comptex_ons,0,TRUE,i); // mapOn[i] = TRUE; } } NotifyChanged(); } }