Notifications
Clear all

[Closed] How to read animation data from binary file .octprx through maxscript?

Hello!

Is there some way to read data from binary proxy file .octprx (Octane Proxy) via maxscript? Rather, I need to get information about the number of frames from the file in order to find out whether this proxy is animated or not. I have a large library of proxy files and I want to sort it so that animated proxies are separated from static ones.
In the list of properties of the proxy object, there is no property for accessing this data.
Perhaps this can be done with C# or .NET? I asked this question on the OTOY form, but no one answered me.
For those who want to help me, here is a link to a simple animated proxy file: https://we.tl/t-98kJ8YKUEx

Thanks to all!

13 Replies

no people from russia are allowed to download or use wetransfer in any way.
Banning downloads will certainly help the fkn war to stop…
Upload it somewhere else if you wish

Agree. It’s very sad when convenient services behave like idiots
I also had to use wetransfer over a VPN.
I re-uploaded the file to Google Drive: https://drive.google.com/file/d/1NYkI6gGpZYwRVN4piUoTMtFnespKVnKr/view?usp=sharing

I think we need to find the string with the text “Frame count:” in this binary file and get the number of frames from it, which is indicated after the colon. But I don’t know how to do it in maxscript…

UPD: I found a way to get the number of frames from an animated .vrmesh proxy file (VRay Proxy), but this code does not work for an .octprx file (Octane Proxy):

(
prxFile=@"C:\TEMP\Tube001_proxy.vrmesh"
fn ProxyFileReaderAssembly = (
		source = ""
		source += "using System;\n"
		source += "using System.IO;\n"
		source += "\n"
		source += "public class prxFileReader\n"
		source += "{\n"
		source += "	public int getFrameNumber(string filePath)\n"
		source += "	{\n"
		source += "		byte[] buffer = null;\n"
		source += "		int FrameCount = 0;\n"
		source += "		\n"
		source += "		FileStream prxM = new FileStream(filePath, FileMode.Open);\n"
		source += "		try\n"
		source += "		{\n"
		source += "	    	prxM.Seek(11, SeekOrigin.Begin);  // skipping fileversion and description."
		source += "			\n"
		source += "	    	UInt64 lutOffset;\n"
		source += "	    	buffer = new byte[8];\n"
		source += "	    	prxM.Read(buffer, 0, buffer.Length);\n"
		source += "	    	lutOffset = BitConverter.ToUInt64(buffer, 0);\n"
		source += "			\n"
		source += "	    	prxM.Seek((long)lutOffset, SeekOrigin.Begin);\n"
		source += "			\n"
		source += "	    	buffer = new byte[4];\n"
		source += "	     	prxM.Read(buffer, 0, buffer.Length);\n"
		source += "	    	UInt32 numVoxels = (BitConverter.ToUInt32(buffer, 0));\n"
		source += "	     	prxM.Seek(36*numVoxels, SeekOrigin.Current);\n"
		source += "	    	FrameCount = 1;\n"
		source += "			\n"
		source += "	    	while (numVoxels != 0)\n"
		source += "	    	{\n"
		source += "	       		buffer = new byte[4];\n"
		source += "	        	prxM.Read(buffer, 0, buffer.Length);\n"
		source += "	       		numVoxels = (BitConverter.ToUInt32(buffer, 0));\n"
		source += "	        	if (numVoxels == 0) { break; }\n"
		source += "	        	FrameCount++;\n"
		source += "	         	prxM.Seek(36 * numVoxels, SeekOrigin.Current);\n"
		source += "	    	}\n"
		source += "	    	prxM.Close();\n"
		source += "		}\n"
		source += "		catch (Exception)\n"
		source += "		{\n"
		source += "	    	prxM.Close();\n"
		source += "	    	throw;\n"
		source += "		}\n"
		source += "		return FrameCount;\n"
		source += "	}\n"
		source += "}\n"

		csharpProvider = dotnetobject "Microsoft.CSharp.CSharpCodeProvider"
		compilerParams = dotnetobject "System.CodeDom.Compiler.CompilerParameters"
		compilerParams.ReferencedAssemblies.Add "System.dll"
		compilerParams.GenerateInMemory = on
		compilerResults = csharpProvider.CompileAssemblyFromSource compilerParams #(source)
		(compilerResults.CompiledAssembly).CreateInstance "prxFileReader"
	)
proxyFileReader=ProxyFileReaderAssembly()
frameNumber=proxyFileReader.getFrameNumber prxFile
)

Is it possible to somehow tweak this code for .octprx files?

.octprx files are likely to be compressed, so you can’t find any plaintext. Worth asking octane devs which one they use

many chunks of data start with this byte pattern and since I’m not an octane user it is hard to tell if it has any relation to frame count or not
image

Thank you, Serejah.
I looked at the file attributes in Binary Viewer and it showed that the file is not compressed.
_230106134859

Unfortunately, I do not know how to contact the Octane developers, I do not have their contacts. I asked a question on the OTOY forum, but no one answered me.

In 3ds Max, the proxy settings for the object into which the .octrx file is loaded looks like this:
_230106142329
When you click on the “info” button, a window opens with information about the proxy file and the number of frames:
octprx_info
I would like to get this information without having to upload the file to the proxy object.

ha, this file contains exactly 101 patterns of C0 02 00 00 02 00
but perhaps you need to use a longer pattern to exclude false-positive matches

results 101 matches
image

Hmm… It can be a description of the state of the object in each animation frame (position, scale, number of faces, number of vertices, etc.). But it is unlikely that this can be taken as the number of frames. Most likely somewhere there should be just the number “101” with a binding to the text “Frame count:” (this can be a property name).
I can get an array with bytes, but I don’t know how to translate these bytes into plain text, or how to find exactly those bytes that contain the number of frames.

Could we talk in private messages in Russian?

if you have lots of proxy files check if the frame count is stored at the beginning of a file.
at least this one you uploaded indeed contains 101 value

sure

I’m pretty sure you can’t find the “Frame count” tag in the file… so all what you do is kind of a hack. I think it would be easier to write to developers of the Octane plugin and ask them about definition (structure) of file’s header. It shouldn’t be a secret, and the guys will most likely give it to you.

2 Replies
(@serejah)
Joined: 10 months ago

Posts: 0

frame count is stored at the 13th byte from the beginning of the file

(@denist)
Joined: 10 months ago

Posts: 0

most likely it is two bytes at least

I have an idea… I think the file is storing the key numbers as an integer value. Save several files with different “noticeable” key numbers – for example, 4379, 5338… Try to find them in the files, and get some kind of system.

Page 1 / 2