Get World Tracks (C#)


#1

How we can iterate over world tracks in C#? I want to add this tracks to a treeview:
Sound
Environments
Effects
Materials


#2
(
	g = (dotNetClass "Autodesk.Max.GlobalInterface").Instance
	
	tvroot = g.coreinterface.TrackViewRootNode
	format "tvroot.numItems: %\n" tvroot.numItems
	tvnodes = for n = 0 to tvroot.numItems-1 collect 
	(
		format "%: %\n" n (tvroot.GetName n)
		_n = tvroot.GetNode n

		if isProperty _n #numsubs and _n.NumSubs > 0 do
		(
			for nn = 0 to _n.NumSubs - 1 do
			(
				format "	%: %\n" nn (_n.GetName nn)
			)			
		)
		
		_n
	)

)

It doesn’t perfectly match to what I have in trackviews ( there’s no scenematerials and medit materials), but maybe you will figure it out.
%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5

	tvroot.numItems: 16
	0: Video Post
	1: Global Tracks
		0: Float
		1: Point3
		2: Point4
		3: Position
		4: Rotation
		5: Scale
		6: Block Control
	2: Block Manager Wrapper TVNode
		0: Block Manager Wrapper
	3: Propagation Manager Wrapper TVNode
		0: Propagation Manager Wrapper
	4: Biped
		0: GlobMain
		1: Reservoir
	5: Reaction Manager
	6: Anim Layer Control Manager
	7: Parameter Collector
	8: Scene Effects
	9: SME
		0: View1
	10: BitmapProxyManagerImp Latch
	11: BitmapPagerData
	12: SceneStateManager
	13: BatchRenderManager
	14: File Link
		0: FileLink_LinkTable
	15: ADT Object Manager Wrapper TVNode
		0: ADT Object Manager Wrapper
showProperties trackViewNodes
  .Video_Post : TrackViewNode
  .Global_Tracks : TrackViewNode
  .Block_Manager_Wrapper_TVNode : TrackViewNode
  .Propagation_Manager_Wrapper_TVNode : TrackViewNode
  .Biped : TrackViewNode
  .Anim_Layer_Control_Manager : Controller
  .Parameter_Collector : TrackViewNode
  .Scene_Effects : TrackViewNode
  .SME : TrackViewNode
  .BitmapProxyManagerImp_Latch : TrackViewNode
  .BitmapPagerData : TrackViewNode
  .SceneStateManager : TrackViewNode
  .BatchRenderManager : TrackViewNode
  .File_Link : TrackViewNode
  .ADT_Object_Manager_Wrapper_TVNode : TrackViewNode

#3

This is great Serejah, But I think I was looking in wrong place. I just want to rapid access to the sound tracks, replace them or remove them…
So I think I should look for different interfaces. Do you know how we can access prosound interface? Or effects list, environment list?


#4

There’s nothing about prosound in SDK reference nor in sdk files (both c# & cpp). It is exposed to maxscript only.

What is this?


#5

What you see in the Environemts and Effects dialog (8).


#6

Max default sound functionality (Load , Play, Pause, Mute, Delete) is enough for me. I found this in MaxSDK/Samples/Utilities/UtilTest.cpp

void UtilTest::SetWAV()
	{
	// Get the current sound object.
	SoundObj *snd = ip->GetSoundObject();
	
	// See if we can get a wave interface
	IWaveSound *iWav = GetWaveSoundInterface(snd);
	if (iWav) {
		// Set the sound file
		IAssetManager* assetMgr = IAssetManager::GetInstance();
		if(!assetMgr)return;
		if (!iWav->SetSoundFile(assetMgr->GetAsset(_T("test.wav"),kSoundAsset))) {
			MessageBox(hPanel,
				_T("Unable to load TEST.WAV"),
				_T("Util Test"),MB_OK);
			return;
			}
		// Set the offset to 10 frames.
		iWav->SetStartTime(GetTicksPerFrame() * 10);
	} else {
		MessageBox(hPanel,
			_T("No IWaveSound interface"),
			_T("Util Test"),MB_OK);
		}
	}

But I have problem to convert it to the C# code.


#7
g.coreinterface.Atmospherics
g.coreinterface.Effects

.
something like this?

so = g.coreinterface.SoundObject
ws = so.GetInterface (dotNetClass "autodesk.max.interfaceid").Wavesound

btw. Do you use tools like dnSpy or similar to explore max managed dlls?
For me it is always the first step to know whether something can be accessed/created using c# sdk or not.


#8

Thank You! , No, How I could use that? is it a decompiler?