示例#1
0
void PSCM_Accessor::Set(PB2Value &v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t)
{
	switch(id)
	{
	//	case anima_specular_body:
		case anima_rgb_value:
	//	case anima_specular_head:   

			if (obj!=NULL)
				obj->UpdateMaterialValues();

			break;

		case anima_max_model_value:

			if (obj!=NULL)
				obj->UpdateMaxModel();

			UpdateLabelInfo();
			break;

		case anima_filepath: 

			MeshObject::meshObject->Clear();

			UpdateLabelInfo();
			//MeshObject::meshObject->Load(v.s,FindNodeRef(MeshObject::meshObject));

			//MeshObject::meshObject->Load();
		//	map->SetCubeMapFile(v.s); 
			break;

	}
}
示例#2
0
//
// Set the range of the meter and updates the display.
//
void CMeterCtrl::SetRange(int range1, int range2, BOOL range_auto)
{
	auto_range = range_auto;
	// Disallow setting the ranges to the same value.
	if (range1 == range2)
		return;

	min_range = ((range1 < range2) ? range1 : range2);
	max_range = ((range1 > range2) ? range1 : range2);

	// Make sure that the needle value is within the new range and update
	// the actual angle that the needle should be.
	if (value < min_range)
		actual_angle = 0;
	else if (value > max_range)
		actual_angle = NEEDLE_SWEEP;
	else
		actual_angle = (int)(value / (max_range - min_range) * NEEDLE_SWEEP);

	// Update the displayed scale and marker labels.
	UpdateScaleInfo();
	UpdateLabelInfo();

	RedrawWindow();
}
示例#3
0
//
// Handles WM_CREATE message (Window is being created)
//
int CMeterCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	CRect control_box;
	POINT temp_point;

	// Allow the framework to create the window
	VERIFY(CWnd::OnCreate(lpCreateStruct) == 0);

	// Store the control's client area rectangle
	GetClientRect(&control_box);

	// Determine where the pivot point should be located.
	// Get the length of the longest radius that will fit inside the box.
	outer_radius = (int)min(control_box.Width() / 2, control_box.Height()
				/ (1 + cos(PIVOT_ARC_ANGLE * PI / 180)));
	inner_radius = (int)(outer_radius * .70);
	pivot_point.x = (int)(control_box.Width() / 2);
	pivot_point.y = outer_radius;

	// Set the size of the rectangle containing the dial.
	meter_box.left = pivot_point.x - outer_radius;
	meter_box.top = pivot_point.y - outer_radius;
	meter_box.right = pivot_point.x + outer_radius;
	meter_box.bottom = pivot_point.y + outer_radius;

	// Initialize the needle's center pivot circle.
	pivot_radius = inner_radius / 12;
	needle_pivot.SetRect(pivot_point.x - pivot_radius,
			     pivot_point.y - pivot_radius, pivot_point.x + pivot_radius, pivot_point.y + pivot_radius);

	// Set the points for the bounding pie wedge.
	CalculatePoint(0, inner_radius, &(min_point.x), &(min_point.y));
	max_point.x = pivot_point.x + (pivot_point.x - min_point.x);
	max_point.y = min_point.y;

	// Now set the needle to the resting position.
	shown_angle = 0;
	actual_angle = 0;
	SetNeedlePoints();

	// Create the text box for the scale display.
	CalculatePoint(0, inner_radius, &scale_box.right, &temp_point.y);
	CalculatePoint(0, outer_radius, &temp_point.x, &scale_box.bottom);
	CalculatePoint(NEEDLE_SWEEP, inner_radius, &scale_box.left, &scale_box.top);

	// Initialize information needed to display the scale and labels.
	scale_font.CreateFont((int)(outer_radius * .2), 0, 0, 0, FW_NORMAL, FALSE,
			      FALSE, FALSE, ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS,
			      DEFAULT_QUALITY, DEFAULT_PITCH, "Arial");
	label_font.CreateFont((int)(outer_radius * .18), 0, 0, 0, FW_NORMAL, FALSE,
			      FALSE, FALSE, ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS,
			      DEFAULT_QUALITY, DEFAULT_PITCH, "Arial");
	marker_pen.CreatePen(PS_SOLID, 2, 0x00FFFFFF);
	label_box_size = (int)(outer_radius * .1);
	label_radius = (int)(outer_radius * .8275);
	tick_mark_radius = (int)(outer_radius * .96);
	UpdateScaleInfo();
	UpdateLabelInfo();

	// Set the points for the rectangle surrounding the watermark arc.
	watermark_box.left = pivot_point.x - inner_radius - 2;
	watermark_box.top = pivot_point.y - inner_radius - 2;
	watermark_box.right = pivot_point.x + inner_radius + 2;
	watermark_box.bottom = pivot_point.y + inner_radius + 2;

	return 0;
}
示例#4
0
		INT_PTR DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
		{
			switch (msg) 
			{
				case WM_INITDIALOG:

					meshObj = (MeshObject*)map->GetParamBlock()->GetOwner();
					//node = meshObj->GetNode();

					if (meshObj!=NULL)
					{
						//QString name = QFileInfo(meshObj->animaPath).fileName();
						
						hwndLbl = GetDlgItem(hWnd, IDC_FILE_NAME);
						if(hwndLbl!=NULL)
						{
							hwndLblFileName = hwndLbl;
							UpdateFileNameInfo();
							//LPARAM a = (LPARAM)name.toAscii().data();
							//SendMessage(hwndLbl, WM_SETTEXT, 0, (LPARAM) a);
						}
				
						QString sceneDesc=meshObj->GetSceneDesc();
						hwndLbl = GetDlgItem(hWnd, IDC_STATIC_SCENE_INFO);
						if (hwndLbl!=NULL)
						{
							hwndLblInfo = hwndLbl;
							UpdateLabelInfo();
							//LPARAM a1 = (LPARAM)sceneDesc.toAscii().data();
							////SendMessage(hwndLblInfo, WM_SETTEXT, 0, (LPARAM) a1);
							//char bb[10];
							//strcpy(bb,"jkjhjh\0");
							//SendMessage(hwndLblInfo, WM_SETTEXT, 0, (LPARAM) bb);
						}
					}

					//  load the shader dropdown
					////hwndCombo = GetDlgItem(hWnd, IDC_COMBO_PRESET);
					////SendMessage(hwndCombo, CB_RESETCONTENT, 0L, 0L);

					////meshObj = (MeshObject*)map->GetParamBlock()->GetOwner();

					////index = 0;
					////Anima::ModelExporter::GetModelExporterRenderTypeList(Anima::ModelExporterType::MAX,0,render_list);
					////i=0;
					////foreach(Anima::ModelExporterRenderType type , render_list)
					////{
					////	QString &dsc = Anima::ModelExporter::GetRenderTypeDesc(type);
					////	LPARAM a = (LPARAM)dsc.toAscii().data();
					//////	int n = SendMessage(hwndCombo, CB_ADDSTRING, 0L, a );
					////	int n = ComboBox_InsertString(hwndCombo,-1,a);

					////	SendMessage(hwndCombo, CB_SETITEMDATA, n, i);
					////	if (type == meshObj->current_render_type)
					////		index = i;
					////	i++;
					////}

					//// //EnableWindow(GetDlgItem(hWnd, IDC_MTLID_NAMES_COMBO), false);

					////	//p=10;
					//// //SendMessage(hwndCombo, CB_SETMINVISIBLE, (WPARAM)p, 0);
					//// SendMessage(hwndCombo, CB_SETCURSEL, (WPARAM)index, 0);

					return TRUE;

				case WM_COMMAND:
					 switch (LOWORD(wParam))
					 {
						case IDC_BUTTON_FILE_BROWSE:
						case IDC_BUTTON_RELOAD:
						case IDC_BUTTON_REBUILD:
							HANDLE_MSG(hWnd,WM_COMMAND,OnDlgCommand);
							break;
						case IDC_COMBO_PRESET:
							switch( HIWORD(wParam) )
							{
								 HANDLE_MSG(hWnd,WM_COMMAND,OnDlgCommand);

								//case WM_COMMAND:

								//	// push
								//	wndCombo = GetDlgItem(hWnd, IDC_COMBO_PRESET);

								//	break;

								case CBN_DROPDOWN:
									{
									return TRUE;
									}

								case CBN_SELCHANGE: { // select a new item from the combo box

			//					/*	int sel = (int)SendMessage((HWND)lParam, CB_GETITEMDATA, SendMessage((HWND)lParam, CB_GETCURSEL, 0, 0), 0);
			//						if(sel>=0)
			//						{
			//							meshObj = (MeshObject*)map->GetParamBlock()->GetOwner();

			//							pRollup = meshObj->ip->GetCommandPanelRollup();

			//							Anima::ModelExporter::GetModelExporterRenderTypeList(Anima::ModelExporterType::MAX,0,render_list);
			//
			//							meshObj->current_render_type =render_list[sel];

			//							show = meshObj->current_render_type == Anima::ModelExporterRenderType_DEFAULT;
			//							if (show)
			//							{
			//								for(int i=0;i<pRollup->GetNumPanels();i++)
			//								{
			//									if (defaultWindList.contains(pRollup->GetPanelDlg(i)))
			//									{
			//										pRollup->Show(i);
			//									}
			//								}
			//							}
			//							else
			//							{
			//								for(int i=0;i<pRollup->GetNumPanels();i++)
			//								{
			//									if (defaultWindList.contains(pRollup->GetPanelDlg(i)))
			//									{
			//										pRollup->Hide(i);
			//									}
			//								}
			//							}

			//							pRollup->UpdateLayout ();
			//							meshObj->RebuildMaterial();
			//						}
			//						*/
									return TRUE;
								}
							}
					 }
			}
			return FALSE;
		}
示例#5
0
void OnDlgCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
	bool load=false;
	if (id == IDC_BUTTON_REBUILD)
	{
		QString embeddedFile =MeshObject::meshObject->embeddedFile;
		int yy=0;

		if (embeddedFile!="" && MeshObject::meshObject->animaPath!="")
		{
			clearObject();

			//MeshObject *obj  = (MeshObject*)CreateInstance(GEOMOBJECT_CLASS_ID, MeshObject_CLASS_ID);
			//assert(obj);
			//INode *node = CreateRootNode(importInt,globalInt);
			//if (!node) return ;

			MeshObject::meshObject->Load(MeshObject::meshObject->animaPath,FindNodeRef(MeshObject::meshObject),false,true);
		}

	}
    else if (id == IDC_BUTTON_FILE_BROWSE)
	{
		load=true;
	}
	else if (id == IDC_BUTTON_RELOAD)
	{
		try
		{
			
		//MeshObject::meshObject->LoadFromGUI(MeshObject::meshObject->animaPath,FindNodeRef(MeshObject::meshObject));
			Anima::_LogDebug(QString("Reload %1").arg(MeshObject::meshObject->animaPath),__FUNCTION__,__LINE__);

			if (QFile(MeshObject::meshObject->animaPath).exists())
			{
				clearObject();
				MeshObject::meshObject->Load(MeshObject::meshObject->animaPath,FindNodeRef(MeshObject::meshObject),true,true);
			}
			else
			{
				Anima::_LogDebug("File not found",__FUNCTION__,__LINE__);
				MessageBox(NULL, _T(QString("The path to the original .ani scene has changed (%1) .\r\n\ Please use the Browser window to navigate and locate the new file.").arg(MeshObject::meshObject->animaPath).toAscii().data()), _T("WARNING!"), MB_OK);
				load=true;
			}
			UpdateLabelInfo();
		}
		catch(Anima::CoreException &e)
		{
			MessageBox(NULL, _T(QString("The path to the original .ani scene has changed (%1) .\r\n\ Please use the Browser window to navigate and locate the new file.").arg(MeshObject::meshObject->animaPath).toAscii().data()), _T("WARNING!"), MB_OK);

			Anima::_LogDebug(e.Message(),__FUNCTION__,__LINE__);
			load=true;
		}
	
	//	Anima::CommandManager::Singleton.Load(fileName);
	}

	if (load)
	{
		OPENFILENAME ofn;
		char szFileName[MAX_PATH] = "";

		ZeroMemory(&ofn, sizeof(ofn));

		strcpy(szFileName,MeshObject::meshObject->animaPath.toAscii().data());
		ofn.lStructSize = sizeof(ofn); // SEE NOTE BELOW
		ofn.hwndOwner = hwnd;
		ofn.lpstrFilter = "AXYZ Anima Files (*.ani)\0*.ani\0All Files (*.*)\0*.*\0";
		ofn.lpstrFile = szFileName;
		ofn.nMaxFile = MAX_PATH;
		ofn.lpstrTitle		= "Load a 'Anima' File";
		ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY ;//|OFN_ALLOWMULTISELECT;
		ofn.lpstrDefExt = "ani";

		if(GetOpenFileName(&ofn))
		{
			// Do something usefull with the filename stored in szFileName 
			clearObject();
			//MeshObject::meshObject->LoadFromGUI(szFileName,FindNodeRef(MeshObject::meshObject));
			MeshObject::meshObject->Load(szFileName,FindNodeRef(MeshObject::meshObject),true,true);

			UpdateFileNameInfo();
			UpdateLabelInfo();
		}

		//QString path = QFileDialog::getOpenFileName(NULL  ,"Load a 'Anima' File","","Anima (*.ani)");
		//if (path!="")
		{
			//MeshObject::meshObject->Clear();
		//	MeshObject::meshObject->Load(path,FindNodeRef(MeshObject::meshObject));

		/*	QString name = QFileInfo(path).fileName();
			HWND hwndLbl = GetDlgItem(hwnd, IDC_FILE_NAME);
			LPARAM a = (LPARAM)name.toAscii().data();
			SendMessage(hwndLbl, WM_SETTEXT, 0, (LPARAM) a);*/
		}
	}
}