File IO Notification [SDK]

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 03 March 2013   #1
File IO Notification [SDK]

There are 4 notifications in the SDK that can allegedly give information about what kind of IO operation is taking place:

#define 	NOTIFY_FILE_PRE_OPEN_PROCESS   0x000000AD
#define 	NOTIFY_FILE_POST_OPEN_PROCESS   0x0000008B
#define 	NOTIFY_FILE_PRE_SAVE_PROCESS   0x000000AE
#define 	NOTIFY_FILE_POST_SAVE_PROCESS   0x000000AF

Quote: All contain a CallParam that points to a struct{ int iProcessType; const MCHAR* filename; }.See File Process Type

where iProcessType should be one of these values:
#define 	FILE_PROCESS_SCENE   0x1
#define 	FILE_PROCESS_HOLD_FETCH   0x2
#define 	FILE_PROCESS_AUTOBAK   0x3


It seems if I use their struct definition, iProcessType is always 2, and the filename is gibberish.

Has anyone ever got this to work?
 
Old 03 March 2013   #2
this seems to work OK....

somewhere above the constructor....

#include "maxscrpt/Listener.h"
   #include "notify.h"


struct fileIONotifyParam
    { 
    	int iProcessType; 
    	const MCHAR* filename; 
    };
    
    static void file_pre_open_process_notify_proc(void* param, NotifyInfo* pInfo)
    {
    	fileIONotifyParam* ioparams = (fileIONotifyParam*)pInfo->callParam;
    
	if(ioparams)
	{
    		  the_listener->edit_stream->printf("id:%d filename:%s\n", ioparams->iProcessType, ioparams->filename);
    		   the_listener->edit_stream->flush();
	 }
    }



in the constructor this

RegisterNotification(file_pre_open_process_notify_  proc, this, NOTIFY_FILE_PRE_OPEN_PROCESS);


then in the destructor this

UnRegisterNotification(file_pre_open_process_notif  y_proc, this, NOTIFY_FILE_PRE_OPEN_PROCESS);

Last edited by Klunk : 03 March 2013 at 09:58 PM.
 
Old 03 March 2013   #3
Oh shit. My bad, I was casting the wrong pointer!
Sorry, I'm tired

Thanks for the help.
 
Old 03 March 2013   #4
btw, why do you use
the_listener->edit_stream->printf("text")

instead of
mprintf("text")

Is there a difference?
 
Old 03 March 2013   #5
probably not
 
Old 03 March 2013   #6
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 02:28 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.