示例#1
0
RefResult MatMod::NotifyRefChanged(
      const Interval& changeInt, 
      RefTargetHandle hTarget, 
         PartID& partID, 
		 RefMessage message, 
		 BOOL propagate) 
      {
   switch (message) {
      case REFMSG_CHANGE:
         if (pmapParam && pmapParam->GetParamBlock()==pblock) {
            pmapParam->Invalidate();
            }
         break;

      case REFMSG_GET_PARAM_DIM: {
         GetParamDim *gpd = (GetParamDim*)partID;
         switch (gpd->index) {            
            case 0:
            default: gpd->dim = defaultDim; break;
            }        
         return REF_HALT; 
         }

      case REFMSG_GET_PARAM_NAME: {
         GetParamName *gpn = (GetParamName*)partID;
         switch (gpn->index) {            
            case PB_MATID: gpn->name = GetString(IDS_RB_MATERIALID); break;
            default:    gpn->name = TSTR(_T("")); break;
            }
         return REF_HALT; 
         }
      }
   return REF_SUCCEED;
   }
示例#2
0
文件: spherify.cpp 项目: 2asoft/xray
RefResult SpherifyMod::NotifyRefChanged(Interval changeInt,
	RefTargetHandle hTarget, PartID& partID, RefMessage message) {

	switch (message) {
		case REFMSG_CHANGE:
			if (pmap && pmap->GetParamBlock()==pblock) {
				pmap->Invalidate();
				}
			break;

		case REFMSG_GET_PARAM_DIM: { 
			GetParamDim *gpd = (GetParamDim*)partID;
			switch (gpd->index) {
				case PB_PERCENT:
					gpd->dim = defaultDim;
					break;
			};
			return REF_STOP; 
		}

		case REFMSG_GET_PARAM_NAME: {
			GetParamName *gpn = (GetParamName*)partID;
			switch (gpn->index) {
				case PB_PERCENT:
					gpn->name = PERCENT_PARAM_NAME;
					break;
			};
			return REF_STOP; 
		}
	}
	return REF_SUCCEED;
}
示例#3
0
文件: optmod.cpp 项目: 2asoft/xray
RefResult OptMod::NotifyRefChanged(
		Interval changeInt, 
		RefTargetHandle hTarget, 
   		PartID& partID, 
   		RefMessage message) 
   	{
	switch (message) {
		case REFMSG_CHANGE: {			
			if (pmapParam && pmapParam->GetParamBlock()==pblock) {
				pmapParam->Invalidate();
				}			
			int man = FALSE;
			if (pblock) pblock->GetValue(PB_MANUPDATE,0,man,FOREVER);
			if (man) return REF_STOP;
			break;
			}

		case REFMSG_GET_PARAM_DIM: {
			GetParamDim *gpd = (GetParamDim*)partID;
			switch (gpd->index) {
				case PB_FACETHRESH1:
				case PB_FACETHRESH2:
				case PB_EDGETHRESH1:
				case PB_EDGETHRESH2:	gpd->dim = stdAngleDim; break;				
				case PB_MAXEDGE1:
				case PB_MAXEDGE2:		gpd->dim = stdWorldDim; break;
				default:				gpd->dim = defaultDim; break;
				}			
			return REF_STOP; 
			}

		case REFMSG_GET_PARAM_NAME: {
			GetParamName *gpn = (GetParamName*)partID;
			switch (gpn->index) {
				case PB_FACETHRESH1:	gpn->name = GetString(IDS_RB_FACETHRESHL1); break;
				case PB_FACETHRESH2:	gpn->name = GetString(IDS_RB_FACETHRESHL2); break;
				case PB_EDGETHRESH1:	gpn->name = GetString(IDS_RB_EDGETHRESHL1); break;
				case PB_EDGETHRESH2:	gpn->name = GetString(IDS_RB_EDGETHRESHL2); break;
				case PB_BIAS1:			gpn->name = GetString(IDS_RB_BIASL1); break;
				case PB_BIAS2:			gpn->name = GetString(IDS_RB_BIASL2); break;
				case PB_MAXEDGE1:		gpn->name = GetString(IDS_RB_MAXEDGE1); break;
				case PB_MAXEDGE2:		gpn->name = GetString(IDS_RB_MAXEDGE2); break;
				default:				gpn->name = TSTR(_T("")); break;
				}
			return REF_STOP; 
			}
		}
	return REF_SUCCEED;
	}
示例#4
0
RefResult NormalMod::NotifyRefChanged(
      const Interval& changeInt, 
      RefTargetHandle hTarget, 
         PartID& partID, 
		 RefMessage message, 
		 BOOL propagate) 
      {  
   switch (message) {
      case REFMSG_CHANGE:
         if (pmapParam && pmapParam->GetParamBlock()==pblock) {
            pmapParam->Invalidate();
            }
         break;
      }
   return REF_SUCCEED;
   }
示例#5
0
文件: optmod.cpp 项目: 2asoft/xray
void OptMod::ModifyObject(TimeValue t, ModContext &mc, ObjectState *os, INode *node)
	{
	float faceThresh, edgeThresh, bias, maxEdge;
	int preserveMat, preserveSmooth, which, render=0, autoEdge;
	DWORD flags = 0;
	Interval valid = FOREVER;
	int nv,nf;

	int man;
	pblock->GetValue(PB_MANUPDATE,t,man,valid);
	if (man && !forceUpdate && !TestAFlag(A_RENDER)) return;
	forceUpdate = FALSE;

	if (TestAFlag(A_RENDER)) {
		pblock->GetValue(PB_RENDER,t,which,valid);
	} else {
		pblock->GetValue(PB_VIEWS,t,which,valid);
		}	
	
	pblock->GetValue(PB_AUTOEDGE,t,autoEdge,valid);

	if (which==0) {
		pblock->GetValue(PB_FACETHRESH1,t,faceThresh,valid);
		pblock->GetValue(PB_EDGETHRESH1,t,edgeThresh,valid);	
		pblock->GetValue(PB_BIAS1,t,bias,valid);
		pblock->GetValue(PB_PRESERVEMAT1,t,preserveMat,valid);
		pblock->GetValue(PB_PRESERVESMOOTH1,t,preserveSmooth,valid);
		pblock->GetValue(PB_MAXEDGE1,t,maxEdge,valid);
	} else {
		pblock->GetValue(PB_FACETHRESH2,t,faceThresh,valid);
		pblock->GetValue(PB_EDGETHRESH2,t,edgeThresh,valid);	
		pblock->GetValue(PB_BIAS2,t,bias,valid);
		pblock->GetValue(PB_PRESERVEMAT2,t,preserveMat,valid);
		pblock->GetValue(PB_PRESERVESMOOTH2,t,preserveSmooth,valid);
		pblock->GetValue(PB_MAXEDGE2,t,maxEdge,valid);
		}
	
	assert(os->obj->IsSubClassOf(triObjectClassID));
	TriObject *triOb = (TriObject *)os->obj;
	nv = triOb->GetMesh().getNumVerts();
	nf = triOb->GetMesh().getNumFaces();

	if (preserveMat) flags |= OPTIMIZE_SAVEMATBOUNDRIES;
	if (preserveSmooth) flags |= OPTIMIZE_SAVESMOOTHBOUNDRIES;
	if (autoEdge) flags |= OPTIMIZE_AUTOEDGE;

	if (faceThresh!=0.0f) {
		GetAsyncKeyState(VK_ESCAPE); // clear the state
		HCURSOR hCur;
		if (nf > 2000) hCur = SetCursor(LoadCursor(NULL,IDC_WAIT));

		triOb->GetMesh().Optimize(
			faceThresh,edgeThresh, bias*0.5f, maxEdge, flags,this);

		if (nf > 200) SetCursor(hCur);
		}

	triOb->GetMesh().InvalidateTopologyCache ();
	triOb->PointsWereChanged();
	triOb->UpdateValidity(GEOM_CHAN_NUM,valid);
	triOb->UpdateValidity(TOPO_CHAN_NUM,valid);
	triOb->UpdateValidity (TEXMAP_CHAN_NUM, valid);
	triOb->UpdateValidity (VERT_COLOR_CHAN_NUM, valid);

	if (pmapParam && pmapParam->GetParamBlock()==pblock && !TestAFlag(A_RENDER)) {
		TSTR buf;
		buf.printf("%d / %d",nv,triOb->GetMesh().getNumVerts());
		SetWindowText(GetDlgItem(pmapParam->GetHWnd(),IDC_OPT_VERTCOUNT),buf);
		buf.printf("%d / %d",nf,triOb->GetMesh().getNumFaces());
		SetWindowText(GetDlgItem(pmapParam->GetHWnd(),IDC_OPT_FACECOUNT),buf);
		}
	}