void RendSpline::CheckAspectLock(TimeValue t)
{
	ParamID lengthID;
	ParamID widthID;
	ParamID aspectlockID;
	float length, width, aspect = 1.0f;
	BOOL aspectlocked = FALSE;

	if(UseViewOrRenderParams(t) == rbViewport)
	{
		widthID = rnd_v2_vpt_width;
		lengthID = rnd_v2_vpt_length;
		aspectlockID = rnd_v2_vpt_aspect_lock;
	}
	else
	{
		widthID = rnd_v2_width;
		lengthID = rnd_v2_length;
		aspectlockID = rnd_v2_aspect_lock;
	}
	pblock->GetValue(lengthID,t,length,FOREVER);
	pblock->GetValue(widthID,t,width,FOREVER);
	pblock->GetValue(aspectlockID,t,aspectlocked,FOREVER);	

	IParamMap2 *map = pblock->GetMap(0);

	if(map)
	{
		ISpinnerControl *iSpin = GetISpinner(GetDlgItem(map->GetHWnd(), IDC_ASPECTSPIN));
		aspect = iSpin->GetFVal();
	}

	pblock->GetMap()->Enable(aspectlockID,((length != 0.0f && width != 0.0f && aspect != 0.0f) || aspectlocked));
}
    void Set(PB2Value& val, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t)
    {
        if (!owner)
            return;

        plStaticEnvLayer* layer = (plStaticEnvLayer*)owner;
        IParamBlock2 *pb = layer->GetParamBlockByID(plStaticEnvLayer::kBlkBitmap);

        switch (id)
        {
        case plStaticEnvLayer::kBmpFrontBitmap:
        case plStaticEnvLayer::kBmpBackBitmap:
        case plStaticEnvLayer::kBmpLeftBitmap:
        case plStaticEnvLayer::kBmpRightBitmap:
        case plStaticEnvLayer::kBmpTopBitmap:
        case plStaticEnvLayer::kBmpBottomBitmap:
            // Set up the enums so these would match...
            if (pb->GetMap())
                pb->GetMap()->Invalidate( id );
            // Update the bitmap saved by the layer
            //layer->SetBitmap( id, &val.bm->bi );
            break;

        case plStaticEnvLayer::kBmpBaseFilename:
            if( pb->GetMap() )
            {
                pb->GetMap()->Enable( plStaticEnvLayer::kBmpGenerateFaces, ( val.s == NULL || val.s[ 0 ] == 0 ) ? FALSE : TRUE );

                ICustButton     *bmSelectBtn = GetICustButton( GetDlgItem( pb->GetMap()->GetHWnd(), IDC_GENERATE_FACES ) );
                bmSelectBtn->SetText( _T( "Generate From Node" ) );
                ReleaseICustButton( bmSelectBtn );
            }
            break;
        }
    }
//From ReferenceMaker 
RefResult RendSpline::NotifyRefChanged(
		const Interval& changeInt, RefTargetHandle hTarget,
		PartID& partID, RefMessage message, BOOL propagate) 
{
	if(hTarget == pblock && message == REFMSG_CHANGE)
	{
		ParamID changing_param = pblock->LastNotifyParamID();
		IParamMap2 *map = pblock->GetMap();
		if(!map)
			return REF_SUCCEED;

		switch(changing_param)
		{
			case rnd_v2_width:
				OnSetWidthLength(map->GetHWnd(), rnd_v2_length, rnd_v2_width, GetCOREInterface()->GetTime(), TRUE);
				break;
			case rnd_v2_vpt_width:
				OnSetWidthLength(map->GetHWnd(), rnd_v2_vpt_length, rnd_v2_vpt_width, GetCOREInterface()->GetTime(), TRUE);
				break;
			case rnd_v2_length:
				OnSetWidthLength(map->GetHWnd(), rnd_v2_length, rnd_v2_width, GetCOREInterface()->GetTime(), FALSE);
				break;
			case rnd_v2_vpt_length:
				OnSetWidthLength(map->GetHWnd(), rnd_v2_vpt_length, rnd_v2_vpt_width, GetCOREInterface()->GetTime(), FALSE);
				break;
		}
	}

	return REF_SUCCEED;
}
Exemple #4
0
RefResult SymmetryMod::NotifyRefChanged( const Interval& changeInt,RefTargetHandle hTarget, 
						   PartID& partID, RefMessage message, BOOL propagate) {
	ParamID pid;
	int weld;
	IParamMap2 *pPMap;
	HWND hDialog, hThreshLabel;

	switch (message) {
	case REFMSG_CHANGE:
		if (hTarget != mp_pblock)
			break;
		pid = mp_pblock->LastNotifyParamID ();
		if (pid != kSymWeld) 
			break;

		pPMap = mp_pblock->GetMap(kSymmetryParams);
		if (!pPMap)
			break;
		hDialog = pPMap->GetHWnd();
		if (!hDialog)
			break;

		mp_pblock->GetValue (kSymWeld, TimeValue(0), weld, FOREVER);
		hThreshLabel = GetDlgItem (hDialog, IDC_SYM_THRESH_LABEL);
		if (hThreshLabel) 
			EnableWindow (hThreshLabel, weld);
		break;
	}
	return REF_SUCCEED;
}
Exemple #5
0
void Matte::EnableStuff() {
   if (pblock) {
      IParamMap2 *map = pblock->GetMap();
      if (map) {
         map->Enable(matte_reflection_amount, reflmap?TRUE:FALSE);
         map->Enable(matte_affect_alpha, opaque?FALSE:TRUE);
         }
      }
   }
Exemple #6
0
void Gradient::EnableStuff() {
	if (pblock) {
		IParamMap2 *map = pblock->GetMap();
		pblock->GetValue( grad_noise_type, 0, noiseType, FOREVER );
		if (map) {
			map->Enable(grad_levels, noiseType==NOISE_REGULAR?FALSE:TRUE);
			}
		}
	}
void RendSpline::ParamAccessor::Set(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t)
{
	if (owner != NULL && RendSpline::paramDlgProc != NULL)
	{
		RendSpline* mod = static_cast<RendSpline*>(owner);
		IParamBlock2* pb = owner->GetParamBlock(0);
		if (pb != NULL)
		{
			IParamMap2* pm = pb->GetMap(0);
			
			if (pm != NULL)
				RendSpline::paramDlgProc->Update(pm->GetHWnd(), t, id);
		}
	}
}
void OrientConstRotation::EndEditParams( IObjParam *ip, ULONG flags,Animatable *next )
{
	if(editCont!=NULL)
	{
		editCont = NULL;
		IParamMap2* pmap = pblock->GetMap();
		if (pmap != NULL)
		{
			if (next && next->ClassID() == ClassID() && ((OrientConstRotation*)next)->pblock&&((OrientConstRotation*)next)->GetLocked()==false)
			{
				pmap->SetParamBlock(((OrientConstRotation*)next)->pblock);
				ip->ClearPickMode();
			}
			else
				orientCD.EndEditParams(ip, this, flags | END_EDIT_REMOVEUI, next);
		}
		else
		{
			int index = aprops.FindProperty(PROPID_INTERPUI);
			if (index>=0) {
				InterpCtrlUI *ui = (InterpCtrlUI*)aprops[index];
				if (ui->hParams) {
					ip->UnRegisterDlgWnd(ui->hParams);
					ip->DeleteRollupPage(ui->hParams);			
					}
				index = aprops.FindProperty(PROPID_INTERPUI);
				if (index>=0) {
					delete aprops[index];
					aprops.Delete(index,1);
					}
				}	
		}
			ip->UnRegisterTimeChangeCallback(&orientConstTimeChangeCallback);
			ip->ClearPickMode(); // need this, otherwise will crash on undo, while pickmode is active.
			this->ip = NULL;
			hWnd = NULL;
	}
}
void OrientConstRotation::BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev )
{
	if(GetLocked()==false)
	{
		this->ip = ip;
		editCont = this;
		if (flags & BEGIN_EDIT_HIERARCHY) {
			InterpCtrlUI *ui;
			ui = new InterpCtrlUI(NULL,ip,this);
			DWORD f=0;			
			SetProperty(PROPID_INTERPUI,ui);		
		} 
		else {
			orientCD.BeginEditParams(ip, this, flags, prev);
		}

		ip->RegisterTimeChangeCallback(&orientConstTimeChangeCallback);
		orientConstTimeChangeCallback.orient_controller = this;
		
		IParamMap2* pmap = pblock->GetMap();
		if (pmap) hWnd = pmap->GetHWnd();

		if (last_selection < 0){
			RedrawListbox(GetCOREInterface()->GetTime());
		}
		else {
			RedrawListbox(GetCOREInterface()->GetTime(), last_selection);
			ISpinnerControl* spin = GetISpinner(GetDlgItem(hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER));
			if (spin != NULL){
				float value = pblock->GetFloat(orientation_target_weight, GetCOREInterface()->GetTime(), last_selection);
				spin->SetValue(value, FALSE);
			}
			ReleaseISpinner(spin);

		}
	}
}