示例#1
0
void EditPolyMod::GetPaintMask( MeshPaintHost* host, BitArray& sel, FloatTab& softSel ) {
	EditPolyData* modData = static_cast<EditPolyData*>(host);
	if (!modData->GetMesh()) return;
	MNMesh& mesh = *(modData->GetMesh());
	sel = mesh.VertexTempSel ();
	float* weights = mesh.getVSelectionWeights ();
	int count = (weights==NULL? 0:mesh.VNum());
	softSel.SetCount(count);
	if( count>0 ) memcpy( softSel.Addr(0), weights, count*sizeof(float) );
}
示例#2
0
void EditPolyMod::GetPaintInputVertPos( MeshPaintHost* host, Point3Tab& vertPos ) {
	EditPolyData* modData = static_cast<EditPolyData*>(host);
	MNMesh *pMesh = modData->GetMesh();
	DbgAssert (pMesh);
	if (!pMesh) return;	// avoid crashing.
	MNMesh& mesh = *(pMesh);
	int count = mesh.VNum();
	vertPos.SetCount( count );
	for( int i=0; i<count; i++ ) vertPos[i] = mesh.v[i].p;
}
示例#3
0
void EditPolyMod::ApplyPaintDeform( MeshPaintHost* host ,BitArray *invalidVerts) {
	EditPolyData* modData = static_cast<EditPolyData*>(host);

	// Make sure we're set to the right operation:
	EpModSetOperation (ep_op_paint_deform);
	modData->SetPolyOpData (ep_op_paint_deform);

	LocalPaintDeformData *pDeform = (LocalPaintDeformData *) modData->GetPolyOpData();
	pDeform->SetOffsets (host->GetPaintDeformCount(), host->GetPaintDeformOffsets(), modData->GetMesh());

	EpModLocalDataChanged (PART_DISPLAY);
}
示例#4
0
void EditPolyMod::ApplyPaintSel( MeshPaintHost* host ) {
	EditPolyData* modData = static_cast<EditPolyData*>(host);
	if (!modData->GetMesh()) return;
	MNMesh& mesh = *(modData->GetMesh());

	//arValid = NEVER;
	// TODO: Where do we keep this soft selection?
	float* destWeights = mesh.getVSelectionWeights();
	float* srcWeights = modData->GetPaintSelValues();
	int count = modData->GetPaintSelCount();

	if (mesh.numv < count) {
		DbgAssert (false);
		count = mesh.numv;
	}

	memcpy( destWeights, srcWeights, count * sizeof(float) );

	if (mesh.numv > count) {
		DbgAssert (false);
		for (int i=count; i<mesh.numv; i++) destWeights[i] = 0.0f;
	}
}
示例#5
0
MNMesh *EditPolyMod::EpModGetMesh (INode *pNode) {
	EditPolyData *pData = GetEditPolyDataForNode (pNode);
	if (!pData) return NULL;
	return pData->GetMesh();
}
void MaterialUIHandler::UpdateCurrentMaterial (HWND hWnd, EPolyMod *pMod, TimeValue t, Interval & validity)
{
	MtlID mat = 0;
	bool determined = false;

	if (pMod->GetPolyOperationID() == ep_op_set_material)
	{
		int materialHolder;
		pMod->getParamBlock()->GetValue (epm_material, t, materialHolder, validity);
		mat = materialHolder;
		determined = true;
	}
	else
	{
		bool useStackSelection = pMod->getParamBlock()->GetInt (epm_stack_selection) != 0;

		bool init = false;
		ModContextList list;
		INodeTab nodes;
		pMod->EpModGetIP()->GetModContexts (list, nodes);
      int i;
		for (i=0; i<list.Count(); i++)
		{
			EditPolyData *pData = (EditPolyData *) list[i]->localData;
			if (!pData) continue;
			MNMesh *pMesh = pData->GetMesh();
			if (!pMesh) {
				validity = NEVER;
				continue;
			}

			DWORD l_selFlag = useStackSelection ? MN_EDITPOLY_STACK_SELECT:MN_SEL;

         int j;
			for (j=0; j<pMesh->numf; j++)
			{
				if (!pMesh->f[j].GetFlag (l_selFlag)) 
					continue;
				if (pMesh->f[j].GetFlag (MN_DEAD))
					continue;

				if (!init)
				{
					mat = pMesh->f[j].material;
					init = true;
				}
				else if (mat != pMesh->f[j].material) break;
			}

			if (j<pMesh->numf) break;
		}
		nodes.DisposeTemporary ();

		determined = (i>=list.Count()) && init;
	}

	ISpinnerControl *spin = GetISpinner(GetDlgItem(hWnd,IDC_MAT_IDSPIN));
	spin->SetIndeterminate(!determined);
	if (determined) spin->SetValue (int(mat+1), FALSE);
	ReleaseISpinner(spin);

	spin = GetISpinner(GetDlgItem(hWnd,IDC_MAT_IDSPIN_SEL)); 
	spin->SetIndeterminate(!determined);
	if (determined) spin->SetValue (int(mat+1), FALSE);
	ReleaseISpinner(spin);

	if (GetDlgItem (hWnd, IDC_MTLID_NAMES_COMBO)) { 
		ValidateUINameCombo(hWnd, pMod);   
	}
}