Friday, September 16, 2011

Visual Studio Custom Build Rules File for HelpNDoc version 3

This custom build rules file allows compilation of a HelpNDoc help  project file. This allows inclusion of the resulting ouput files within your VS setup and deployment projects.

I find this very handy to ensure I have the most current version of the help file included in the setup project without having to manually go and build the help file before building the setup files.  Prevents those moments where you wonder if you had pressed compile after that late night tweaks in the documentation...

This custom build rules file is for Visual Studio 2008 and HelpNDoc3.  It supports the command line switches for all the options including the template system. It's only slightly different from the version for HelpNDoc 2.

HelpNDoc3 Build Rule for VS2008.zip


Wednesday, September 7, 2011

Export script for Treadmill data from 3ds max to PointLightLab model file (Left Viewport Version)

This script exports a 28 point model from 3ds MAX to a PointLightLab model file format ( 2D version for V4 of PLL)



macroScript TM_LeftFacing_Exporter category:"DuncansTools"
(
	-- number of points to export
	num_dummies = 28
	-- array to hold the dummy refs
	dummy_array = #()
	--scaling factor
	scale = 0.3

	output_name = getSaveFileName caption:"PointLightLab Model File" types:"Models (*.pllm)|*.pllm|All Files (*.*)|*.*|"

	if output_name != undefined then 
	(
	
		output_file = createfile output_name
	
		--create the array of dummies
		for dummies = 1 to num_dummies do
		( 
			dummy_array[dummies] = execute ((if dummies < 10 then ("$Dummy0" ) else ("$Dummy")) + dummies as string)
		)

	
		--Write the file header--
		format "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\" ?>\n" to:output_file
		format "<!DOCTYPE DuncansModelFile SYSTEM \"C:\\Program Files\\DuncansTools\\PointLightLab\\configuration\\ModelFormatv4.dtd\">\n" to:output_file
		format "<DuncansModelFile Version=\"4.0\">\n\n" to:output_file
		
		for t = animationrange.start to animationrange.end do
		(
		
			format "<FrameSet>\n" to:output_file
		
			for dummies = 1 to num_dummies do
			( 
			
				at time t obj_1 = dummy_array[dummies].center
			
				format "<FramePoint Xpos=\"" to:output_file
				format "%" (obj_1.y * scale ) to:output_file
				format "\" Ypos=\"" to:output_file
				format "%" (obj_1.z * scale ) to:output_file
				format "\"/>\n" to:output_file
			
			)
			
			format "</FrameSet>\n\n" to:output_file
		)
		
		format "\n</DuncansModelFile>" to:output_file
		
		close output_file
		edit output_name
	
	)--end if

)--end macroScript

Monday, September 5, 2011

Import script for getting Treadmill Mocap data into 3ds MAX

Maxscript importer for .t3d files generated from PhaseSpace motion capture system using the a full suit and cap with 28 LED's. The .t3d files are generated from C3DWorkbench as simple tab delimited text files with X Y Z data on each line.  The number of points needs to be known before hand and set in the "num_dummies" var.  I was importing 5 second blocks of motion at 30 frames a second, hence the hard wired number of frames in "num_frames" var.

This script generates an array of dummy objects to hold the motion data as a point cloud style data set.  Each point's data is mapped as a keyframe on the dummy except where the point has dropped out or "popped" (if you use EEG nomenclature....) These are filtered out during the import to make it easier to fix the data in the curve editor.  Be careful of frame 0, as it does not seem to filter correctly. (Will figure this out later)


macroscript TM_Importer category: "DuncansTools"
(
	num_dummies = 28
	num_frames = 151
	dummy_array = #()
	
	animationRange = interval 0 num_frames
	
	--create the array of dummies
	for d = 1 to num_dummies do
	(
		dummy_array[d] = dummy ()
		dummy_array[d].boxsize = [1,1,1]
	)
	
	--local x = dummy_array[1].pos.controller	
	--showProperties x

	--get the text file ( tab delimeted works. from excel )
	in_name = getOpenFileName types:"Text  3d (*.t3d|*.t3d|All (*.*)|*.*|"
	if in_name != undefined then
	(
		in_file = openFile in_name
		if in_file != undefined then
		(
			-- turn on animation so we can automatically create keys 
			with animate on
			(
				for frames = 0 to num_frames - 1 do
				(
					for dummies = 1 to num_dummies do
					( 
						-- read the pairs of values from the file
						x_val = readValue in_file
						y_val = readValue in_file
						z_val = readValue in_file
						
						
					-- put the values to the dummies as motion keys
						
						if x_val < 0.5 or x_val > 0.5 then
						(
							at time frames dummy_array[dummies].pos.controller.x_position = x_val
						)
						
						if y_val < 0.5 or y_val > 0.5 then
						(
							at time frames dummy_array[dummies].pos.controller.y_position = y_val
						)
						
						if z_val < 0.5 or z_val > 0.5 then 
						(
							at time frames dummy_array[dummies].pos.controller.z_position = z_val
						)
					)
				)
			)
		)
		close in_file
	)
)
C3D Workbench

Version 1.2

* Removed "Open File" button and merged the functionality with the "Browse" button.
* Moved the "File Parameters" functionality to a seperate dialog. Witha access via a button from the main UI called "Show File Parameter

Info".
* Re-arranged the Main UI layout.
* Added more data mapping options in the view tools (XYZ,XZY,YZX,YXZ,ZYX,ZXY). These also map correctly during export if selected.
* Added "Center to View" button and functionality. TODO. This needs to calculate scale as part of the operation.
* Fixed bug in the rendering code that was not correctly positioning the view.
* Added Export to a simple raw tab delimited 3D file format (.t3d) which is for import into 3ds max via an import script.