Exemple #1
0
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();
	mapValid.SetEmpty();
	}
Exemple #2
0
RefResult Noise::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, 
   PartID& partID, RefMessage message ) {
	switch (message) {
		case REFMSG_CHANGE:
			ivalid.SetEmpty();
			cacheValid.SetEmpty();
			if (hTarget == pblock)
				{
			// see if this message came from a changing parameter in the pblock,
			// if so, limit rollout update to the changing item and update any active viewport texture
				ParamID changing_param = pblock->LastNotifyParamID();
//				if (hTarget != xyzGen && hTarget != texout ) 
				noise_param_blk.InvalidateUI(changing_param);
				// notify our dependents that we've changed
				// NotifyChanged();  //DS this is redundant
#ifdef SHOW_3DMAPS_WITH_2D
				if (changing_param != -1)
					DiscardTexHandle();
#endif
				}
#ifdef SHOW_3DMAPS_WITH_2D
			else if (hTarget == xyzGen) 
				{
				DiscardTexHandle();
				}
#endif

			break;
		}
	return(REF_SUCCEED);
	}
Exemple #3
0
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;
	}
Exemple #4
0
// This method is responsible for responding to the change notification
// messages sent by the texmap dependants.
RefResult Smoke::NotifyRefChanged(const Interval& changeInt, 
	RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate ) {
	switch (message) {
		case REFMSG_CHANGE:
			mapValid.SetEmpty();
			texValidity.SetEmpty();
			if (hTarget == pblock)
				{
				ParamID changing_param = pblock->LastNotifyParamID();
				smoke_param_blk.InvalidateUI(changing_param);
#ifdef SHOW_3DMAPS_WITH_2D
				if (changing_param != -1)
					DiscardTexHandle();
#endif
				}
#ifdef SHOW_3DMAPS_WITH_2D
			else if (hTarget == xyzGen) 
				{
				DiscardTexHandle();
				}
#endif

			// One of the texmap dependants have changed.  We set our
			// validity interval to empty and invalidate the dialog
			// so it gets redrawn.
//			texValidity.SetEmpty();
//			if (hTarget != xyzGen) {
//				if (paramDlg) 
//					paramDlg->pmap->Invalidate();
//			}
			break;
/*
		case REFMSG_GET_PARAM_DIM: {
			// This returns the 'dimension' of the parameter.  This is 
			// the type and order of magnitude of the parameter.
			GetParamDim *gpd = (GetParamDim *)partID;
			switch (gpd->index) {
				case PB_SIZE: gpd->dim =  stdWorldDim; 	break;
				case PB_ITER:
				case PB_EXP:
				case PB_PHASE:
					gpd->dim = defaultDim; break;
				case PB_COL1: 
				case PB_COL2: gpd->dim = stdColor255Dim; break;
			}
			return REF_STOP; 
		}

		case REFMSG_GET_PARAM_NAME: {
			// This returns the name that will appear in track view
			// of the parameter.
			GetParamName *gpn = (GetParamName *)partID;
			gpn->name = GetString(nameIDs[gpn->index]);
			return REF_STOP; 
		}
*/
	}
	return(REF_SUCCEED);
}
Exemple #5
0
void Mask::SetSubTexmap(int i, Texmap *m) {
	ReplaceReference(i,m);
	if (i==0)
		{
		mask_param_blk.InvalidateUI(mask_map1);
		mapValid.SetEmpty();
		}	
	else if (i==1)
		{
		mask_param_blk.InvalidateUI(mask_map2);
		mapValid.SetEmpty();
		}	

	}
RefResult CompositeMat::NotifyRefChanged(
		Interval changeInt, 
		RefTargetHandle hTarget, 
		PartID& partID, 
		RefMessage message)
	{
	switch (message) {
 		case REFMSG_CHANGE:
			if (hTarget == pblock2)	{
				ivalid.SetEmpty();
//				compmat_param_blk.InvalidateUI();
				ParamID changing_param = pblock2->LastNotifyParamID();
				compmat_param_blk.InvalidateUI(changing_param);
				if( (changing_param == compmat_amount )
					||(changing_param == compmat_map_on )
					||(changing_param == compmat_type ))
				{
					mReshadeRQ = RR_NeedReshade;
				} else if( changing_param == compmat_mtls ) {
					mReshadeRQ = RR_NeedPreshade; // really want to get from mtl, but dont have it
//					NotifyChanged();
				}
			} else {
				ivalid.SetEmpty();
				NotifyChanged();
			}

			if (hTarget != NULL) {
				switch (hTarget->SuperClassID()) {
					case MATERIAL_CLASS_ID: {
						// never hit for this mtl ????
						IReshading* r = static_cast<IReshading*>(hTarget->GetInterface(IID_IReshading));
						mReshadeRQ = r == NULL ? RR_None : r->GetReshadeRequirements();
					} break;
				}
			}
			break;
		case REFMSG_SUBANIM_STRUCTURE_CHANGED:
			if ((hTarget!=this))
				return REF_SUCCEED;

			mReshadeRQ = RR_NeedPreshade;
			NotifyChanged();
			break;
			
	}
	return REF_SUCCEED;
}
Exemple #7
0
RefResult Gradient::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, 
   PartID& partID, RefMessage message ) 
{
	switch (message) 
	{
		case REFMSG_CHANGE:
		{
			ivalid.SetEmpty();
			if (hTarget == pblock) {
				// see if this message came from a changing parameter in the pblock,
				// if so, limit rollout update to the changing item and update any active viewport texture
				ParamID changing_param = pblock->LastNotifyParamID();
				if (hTarget != uvGen && hTarget != texout) 
					grad_param_blk.InvalidateUI(changing_param);
				if (changing_param != -1)
					DiscardTexHandle();
				}
			// notify our dependents that we've changed
			// NotifyChanged();  //DS this is redundant
			break;
		}

		case REFMSG_UV_SYM_CHANGE:
			DiscardTexHandle();  
			break;
	}
	return(REF_SUCCEED);
}
Exemple #8
0
// This method is called to reset the texmap back to its default values.
void Planet::Init() {
	// Reset the XYZGen or allocate a new one
	if (xyzGen) 
		xyzGen->Reset();
	else 
		ReplaceReference(0, GetNewDefaultXYZGen());	


//	ReplaceReference(1, CreateParameterBlock(pbdesc, 
//		PB_LENGTH, PLANET_PB_VERSION));
//	if (paramDlg) 
//		paramDlg->pmap->SetParamBlock(pblock);

	// Set the inital parameters
	// {10,20,80},{10,30,80},{10,40,90},{10,100,12},
	// {100,80,12},{80,20,8},{100,80,50},{100,100,100}
	SetColor(0, Color(0.04f, 0.08f, 0.31f), TimeValue(0));
	SetColor(1, Color(0.04f, 0.12f, 0.31f), TimeValue(0));
	SetColor(2, Color(0.04f, 0.16f, 0.31f), TimeValue(0));
	SetColor(3, Color(0.04f, 0.39f, 0.05f), TimeValue(0));
	SetColor(4, Color(0.39f, 0.31f, 0.05f), TimeValue(0));
	SetColor(5, Color(0.31f, 0.08f, 0.03f), TimeValue(0));
	SetColor(6, Color(0.39f, 0.31f, 0.20f), TimeValue(0));
	SetColor(7, Color(0.39f, 0.39f, 0.39f), TimeValue(0));

	SetSize(40.0f, TimeValue(0));
	SetIsland(0.5f, TimeValue(0));
	SetPercent(60.0f, TimeValue(0));
	SetSeed(12345, TimeValue(0));
	blend = 1;

	// Set the validity interval of the texture to empty
	texValidity.SetEmpty();
}
Exemple #9
0
void Output::Init() {
	ivalid.SetEmpty();
	if (texout) texout->Reset();
	else ReplaceReference( 1, GetNewDefaultTextureOutput());	
	texout->SetRollupOpen(1);
	mapOn[0] = 1;
	}
Exemple #10
0
RefResult Composite::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, 
   PartID& partID, RefMessage message ) {
	switch (message) {
		case REFMSG_CHANGE:			
			if (paramDlg) 
				paramDlg->Invalidate();
			if (pblock->LastNotifyParamID() == comptex_tex && pblock->Count(comptex_tex) != subTex.Count())
				SetNumMaps(pblock->Count(comptex_tex));
			else if (pblock->LastNotifyParamID() == comptex_ons && pblock->Count(comptex_ons) != subTex.Count())
				SetNumMaps(pblock->Count(comptex_ons));
			DiscardTexHandles(); // DS 5/4/00
			ivalid.SetEmpty();
			if (paramDlg&&Active())
				paramDlg->ip->MtlChanged();
			break;
		
		case REFMSG_GET_PARAM_DIM:
			return REF_STOP; 
		
		case REFMSG_GET_PARAM_NAME: {
			GetParamName *gpn = (GetParamName*)partID;
			gpn->name= GetSubTexmapSlotName(gpn->index);			
			return REF_STOP; 
			}
		}
	return(REF_SUCCEED);
	}
Exemple #11
0
// Stores the 'i-th' sub-texmap managed by the material or texture.
void Smoke::SetSubTexmap(int i, Texmap *m) {
	ReplaceReference(i+2, m);
	if (i==0)
		{
		smoke_param_blk.InvalidateUI(smoke_map1);
		mapValid.SetEmpty();
		}
	else if (i==1)
		{
		smoke_param_blk.InvalidateUI(smoke_map2);
		mapValid.SetEmpty();
		}

//	if (paramDlg)
//		paramDlg->UpdateSubTexNames();
}
Exemple #12
0
// Stores the 'i-th' sub-texmap managed by the material or texture.
void Speckle::SetSubTexmap(int i, Texmap *m) {
	ReplaceReference(i+2, m);
	if (i==0)
		{
		speckle_param_blk.InvalidateUI(speckle_map1);
		texValidity.SetEmpty();
		}
	else if (i==1)
		{
		speckle_param_blk.InvalidateUI(speckle_map2);
		texValidity.SetEmpty();
		}

//	if (paramDlg)
//		paramDlg->UpdateSubTexNames();
}
Exemple #13
0
RefResult SWrapObject::NotifyRefChanged( 
		Interval changeInt,
		RefTargetHandle hTarget, 
		PartID& partID, 
		RefMessage message )
	{				
	switch (message) {		
		case REFMSG_CHANGE:	
			{ if (hTarget==custnode) cmValid.SetEmpty();
			  if (hTarget==pblock) InvalidateUI();
			SimpleWSMObject::NotifyRefChanged(changeInt,hTarget,partID,message);
			}
			break;
		case REFMSG_TARGET_DELETED:	
			{ if (hTarget==custnode) custnode=NULL;
			}
			break;
		case REFMSG_NODE_NAMECHANGE:
			{ if (hTarget==custnode) 
			  { custname = TSTR(custnode->GetName());
			    ShowName();
				}
			  break;
			}
		default: SimpleWSMObject::NotifyRefChanged(changeInt,hTarget,partID,message);
		}
	return REF_SUCCEED;
	}
void OrientConstRotation::Copy(Control *from)
{
	if(GetLocked()==false)
	{
	Quat fvalRot;
	if (from->ClassID()==ClassID()) {
		OrientConstRotation *ctrl = (OrientConstRotation*)from;
		// a copy will construct its own pblock to keep the pblock-to-owner 1-to-1.
		ReplaceReference(ORIENT_ROT_PBLOCK_REF, CloneRefHierarchy(ctrl->pblock));
		curRot   =			ctrl->curRot;
		baseRotQuatLocal =  ctrl->baseRotQuatLocal;
		baseRotQuatWorld =  ctrl->baseRotQuatWorld;
		flags    = ctrl->flags;
		mLocked = ctrl->mLocked;
	} else {
		if(from&&GetLockedTrackInterface(from))
		  mLocked = GetLockedTrackInterface(from)->GetLocked();
		from->GetValue(GetCOREInterface()->GetTime(), &fvalRot, Interval(0, 0));	// to know the object orientation before the
		firstTimeFlag = 1;
		baseRotQuatLocal = fvalRot;
		baseRotQuatLocal.Normalize(); // current controller was active
		}
	ivalid.SetEmpty();
	NotifyDependents(FOREVER,PART_ALL,REFMSG_CHANGE);
	}
}
Exemple #15
0
// This method is called to reset the texmap back to its default values.
void Speckle::Init() {
	// Reset the XYZGen or allocate a new one
	if (xyzGen) 
		xyzGen->Reset();
	else 
		ReplaceReference(0, GetNewDefaultXYZGen());	

	// Set the inital colors and size
	SetColor(0, DEFAULT_COLOR1, TimeValue(0));
	SetColor(1, DEFAULT_COLOR2, TimeValue(0));
    RegisterDistanceDefault(_T("Speckle Params"), _T("Size"), DEFAULT_SPECKLE_SIZE, IN_TO_M(DEFAULT_SPECKLE_SIZE));
    float size = GetDistanceDefault(_T("Speckle Params"), _T("Size"));
    SetSize(size, TimeValue(0));
	// Set the validity interval of the texture to empty
	texValidity.SetEmpty();
	mapValid.SetEmpty();
}
Exemple #16
0
void Gradient::Init() 
	{
	if (uvGen) uvGen->Reset();
	else ReplaceReference( UVGEN_REF, GetNewDefaultUVGen());	
	if (texout) texout->Reset();
	else ReplaceReference( TEXOUT_REF, GetNewDefaultTextureOutput());
	ivalid.SetEmpty();
	}
Exemple #17
0
void StraussShader::Reset()
{
// StraussCD.MakeAutoParamBlocks(this);   // make and intialize paramblock2

   ivalid.SetEmpty();
   SetDiffuseClr( Color(0.5f,0.5f,0.5f), 0 );
   SetGlossiness( 0.2f,0);   
   SetMetalness( 0.0f,0);   
}
Exemple #18
0
		void DiscardTexHandles() {
			for (int i=0; i<MAXTEXHANDLES; i++) {
				if (texHandle[i]) {
					texHandle[i]->DeleteThis();
					texHandle[i] = NULL;
					}
				}
			texHandleValid.SetEmpty();
			}
Exemple #19
0
//From MtlBase
void SampleShaderPlugin::Reset() 
{
	if (uvGen) uvGen->Reset();
	else ReplaceReference( 0, GetNewDefaultUVGen());	
	//TODO: Reset texmap back to its default values
	
	ivalid.SetEmpty();
	
}
Exemple #20
0
void Output::SetSubTexmap(int i, Texmap *m) {
	ReplaceReference(i,m);
	if (i==0)
		{
		output_param_blk.InvalidateUI(output_map1);
		ivalid.SetEmpty();
		}	

	}
Exemple #21
0
//From MtlBase
void CrackVisualizer::Reset() 
{
	if (uvGen) uvGen->Reset();
	else ReplaceReference( 0, GetNewDefaultUVGen());	
	//TODO: Reset texmap back to its default values

	ivalid.SetEmpty();

}
Exemple #22
0
void Noise::SetSubTexmap(int i, Texmap *m) {
	ReplaceReference(i+2,m);

	if (i==0)
		{
		noise_param_blk.InvalidateUI(noise_map1);
		ivalid.SetEmpty();
		cacheValid.SetEmpty();
		}	
	else if (i==1)
		{
		noise_param_blk.InvalidateUI(noise_map2);
		ivalid.SetEmpty();
		cacheValid.SetEmpty();
		}	

//	if (paramDlg)
//		paramDlg->UpdateSubTexNames();
	}
Exemple #23
0
void Composite::Init() 
	{	
	macroRecorder->Disable();
	ivalid.SetEmpty();
	offset = 0;
	subTex.Resize(0);
//	mapOn.Resize(0);
	SetNumMaps(2);
	macroRecorder->Enable();
	}
Exemple #24
0
void Plate::Init() {
	ivalid.SetEmpty();
	nth = 1;
	do_nth = TRUE;
	applyBlur = TRUE;
	useEnvMap = TRUE;
	SetBlur(1.0f, TimeValue(0));
	SetThick(0.5f, TimeValue(0));
	SetRefrAmt(1.0f, TimeValue(0));
	}
Exemple #25
0
void Gradient::SetSubTexmap(int i, Texmap *m) {
	ReplaceReference(i+2,m);
	if (i==0)
		{
		grad_param_blk.InvalidateUI(grad_map1);
		ivalid.SetEmpty();
		}
	else if (i==1)
		{
		grad_param_blk.InvalidateUI(grad_map2);
		ivalid.SetEmpty();
		}	
	else if (i==2)
		{
		grad_param_blk.InvalidateUI(grad_map3);
		ivalid.SetEmpty();
		}	

	}
Exemple #26
0
IOResult Matte::Load(ILoad *iload) { 
	ULONG nb;
	int id;
	version = 0;
	IOResult res;
	
	opaque = FALSE;

	while (IO_OK==(res=iload->OpenChunk())) {
		switch(id = iload->CurChunkID())  {
			case MTL_HDR_CHUNK:
				res = MtlBase::Load(iload);
				ivalid.SetEmpty();
				break;
			case FOGBG_CHUNK:
				fogBG = TRUE;
				break;
			case SHADOWBG_CHUNK:
				shadowBG = TRUE;
				break;
			case SHADALPHA_CHUNK:
				shadowAlpha = TRUE;
				break;
			case OPAQUE_CHUNK:
				opaque = TRUE;
				break;
			case FOG_OBJDEPTH_CHUNK:
				fogObjDepth = TRUE;
				break;
			case MATTE_VERSION_CHUNK:
				iload->Read(&version,sizeof(int), &nb);
				break;
			}
		iload->CloseChunk();
		if (res!=IO_OK) 
			return res;
		}

	if (version  < 2)
		{

	// JBW: register old version ParamBlock to ParamBlock2 converter
		ParamBlock2PLCB* plcb = new ParamBlock2PLCB(versions, NUM_OLDVERSIONS, &matte_param_blk, this, PB_REF);
		iload->RegisterPostLoadCallback(plcb);

		MattePostLoadCallback* matteplcb = new MattePostLoadCallback(this);
		iload->RegisterPostLoadCallback(matteplcb);
		}


//	iload->RegisterPostLoadCallback(
//		new ParamBlockPLCB(versions,NUM_OLDVERSIONS,&curVersion,this,PB_REF));
	return IO_OK;
                                                      
	}
Exemple #27
0
RefResult Matte::NotifyRefChanged(
      const Interval& changeInt, 
      RefTargetHandle hTarget, 
      PartID& partID, 
	  RefMessage message, 
	  BOOL propagate)
   {
   switch (message) {
      case REFMSG_CHANGE:
         if (hTarget == pblock)
            {
            ivalid.SetEmpty();
         // see if this message came from a changing parameter in the pblock,
         // if so, limit rollout update to the changing item and update any active viewport texture
            ParamID changing_param = pblock->LastNotifyParamID();
            matte_param_blk.InvalidateUI(changing_param);
            if( (changing_param == matte_receive_shadows)
               ||(changing_param == matte_shadow_brightness)
               ||(changing_param == matte_color)
               ||(changing_param == matte_reflection_amount)
               ||(changing_param == matte_use_reflection_map))
            {
               mReshadeRQ = RR_NeedReshade;
            } else if (changing_param == -1) 
               mReshadeRQ = RR_NeedPreshade;
             else 
               mReshadeRQ = RR_None;
         }

         if (hTarget != NULL) {

            switch (hTarget->SuperClassID()) {
               case TEXMAP_CLASS_ID: {
                     mReshadeRQ = RR_NeedPreshade;
               } break;
//             default:
//                mReshadeRQ =RR_NeedReshade;
//             break;
            }

         }
         break;

      case REFMSG_SUBANIM_STRUCTURE_CHANGED:
//       if (partID == 0) 
//          mReshadeRQ = RR_None;
//       else {
//          mReshadeRQ = RR_NeedPreshade;
//          NotifyChanged();
//       }
         break;
      
   }
   return REF_SUCCEED;
}
Exemple #28
0
RefResult Mask::NotifyRefChanged(const Interval& changeInt, RefTargetHandle hTarget, 
   PartID& partID, RefMessage message, BOOL propagate ) {
	switch (message) {
		case REFMSG_CHANGE:
			ivalid.SetEmpty();
			mapValid.SetEmpty();
			if (hTarget == pblock)
				{
			//if (paramDlg&&!paramDlg->isActive) 
				ParamID changing_param = pblock->LastNotifyParamID();
				mask_param_blk.InvalidateUI(changing_param);
				}

//			if (paramDlg) 
//					paramDlg->Invalidate();
			break;

		}
	return(REF_SUCCEED);
	}
Exemple #29
0
void CellTex::SetSubTexmap(int i, Texmap *m)
	{
	ReplaceReference(i+3,m);
	if (i==0)
		{
		cellular_param_blk.InvalidateUI(cellular_celmap);
		ivalid.SetEmpty();
		}
	else if (i==1)
		{
		cellular_param_blk.InvalidateUI(cellular_divmap1);
		ivalid.SetEmpty();
		}
	else if (i==2)
		{
		cellular_param_blk.InvalidateUI(cellular_divmap2);
		ivalid.SetEmpty();
		}

//	if (paramDlg) paramDlg->UpdateSubTexNames();
	}
Exemple #30
0
void StraussShader::CopyStdParams( Shader* pFrom )
{
   macroRecorder->Disable(); 
   // don't want to see this parameter copying in macrorecorder

      SetAmbientClr( pFrom->GetAmbientClr(0,0), 0 );
      SetDiffuseClr( pFrom->GetDiffuseClr(0,0), 0 );
      SetGlossiness( pFrom->GetGlossiness(0,0), 0 );

   macroRecorder->Enable();
   ivalid.SetEmpty();   
}