Layer Rename Callback

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
  06 June 2011
Layer Rename Callback

Hi, was looking to see if there was a way of either preventing layer renaming or at least flagging it. An earlier post here mentions it, only it doesn't appear to work as hoped.

http://forums.cgsociety.org/showthr...p?f=98&t=860786

DenisT, could you kindly elaborate on how to get the when construct working with this? the help suggests that the name[s] change handler is -

Quote: Signaled when the name of an object is changed if this occurs because a user edits the name in one of the 3ds Max command panels. The handler is called repeatedly with each character that is changed.


I thought maybe its not working as the layer manager is not classed as a command panel??
__________________
Regards,
Pete

Read my technical blog - lonerobot.net
 
  06 June 2011
I've been looking into this for a long time (as you noticed in that other thread) and never found a solution to get a rename event. I use a when construct to get some other property changes to work:
when parameters layer change id:#outliner_layers layer do outliner_callbacks.layerParametersChanged layer;

This does not work for the name however. I think that somewhere in the implementation of them, they forgot to fire the event.
 
  06 June 2011
Hi Pier,

Yes it's been on my wishlist for a while too, I'll flag it as a bug in the beta forum. Thanks.
__________________
Regards,
Pete

Read my technical blog - lonerobot.net
 
  06 June 2011
What you could if it was critical to get this callback, and you felt like going the really long and hard way around things, is create a c# class that wraps a nativeWindow class, get the handle of the layer window using dialogMonitorOps, feed that to the c# class, and override it's WndProc event. in the WndProc event, listen for text changed messages.

Create a delegate that will launch an event in the c# class, and register this event in maxscript.

Needless to say this idea is not tested but I have had success listening to other Win32 messages using NativeWindow
 
  06 June 2011
Originally Posted by LoneRobot: Hi, was looking to see if there was a way of either preventing layer renaming or at least flagging it. An earlier post here mentions it, only it doesn't appear to work as hoped.

http://forums.cgsociety.org/showthr...p?f=98&t=860786

DenisT, could you kindly elaborate on how to get the when construct working with this? the help suggests that the name[s] change handler is -



I thought maybe its not working as the layer manager is not classed as a command panel??


http://forums.cgsociety.org/showpos...456&postcount=2
there are my apologizes. There is no any known for me callback or event in mxs fired by layer renaming.
 
  06 June 2011
Not a problem, no apology necessary Denis!

(and thanks for the idea, Lo)
__________________
Regards,
Pete

Read my technical blog - lonerobot.net
 
  06 June 2011
Originally Posted by lo: What you could if it was critical to get this callback, and you felt like going the really long and hard way around things, is create a c# class that wraps a nativeWindow class, get the handle of the layer window using dialogMonitorOps, feed that to the c# class, and override it's WndProc event. in the WndProc event, listen for text changed messages.


usually people need the layer rename event (or callback) for custom Layer Manager to replace the built-in Layer Managed Dialog.

The problem is:
name property is not really a parameter of layer. (it's why its changing doesn't fire event on when name(parameters) change).

setname method sends notification directly to LayerManager interface. If the Layer Manager Dialog is open the interface updates its UI. It creates an illusion that max has some hidden (unknown, undocumented, etc.) event (or callback) to use. If the dialog is closed we can't catch any message about layer renaming.

Last edited by denisT : 06 June 2011 at 10:38 PM.
 
  06 June 2011
Not sure I understand what you are saying...

Is the problem:

a) no way to catch when a user has manually changed a name in the max layer manager?

or

b) something else?
 
  06 June 2011
Originally Posted by lo: Not sure I understand what you are saying...

Is the problem:

a) no way to catch when a user has manually changed a name in the max layer manager?

or

b) something else?


there is no way to catch layer renaming when the layer manager dialog is closed
 
  06 June 2011
Originally Posted by denisT: there is no way to catch layer renaming when the layer manager dialog is closed


alright, but under what circumstances can that happen? How can one change the layer name if not by script and not via the layer manager?
 
  06 June 2011
Originally Posted by lo: alright, but under what circumstances can that happen? How can one change the layer name if not by script and not via the layer manager?


i'm talking about changing by someone else's script.
 
  06 June 2011
Originally Posted by denisT: i'm talking about changing by someone else's script.


yup, can't think of a solution for that one...
 
  06 June 2011
Originally Posted by denisT: i'm talking about changing by someone else's script.

The layer name is read-only for script access.
Due to the docs - they worried from scripters that can put dups names, hehe...
__________________
* everyone can win previous war
 
  06 June 2011
Originally Posted by Panayot: The layer name is read-only for script access.
Due to the docs - they worried from scripters that can put dups names, hehe...

the name property is read-only.
setname method sets the name.
 
  06 June 2011
Originally Posted by denisT: the name property is read-only.
setname method sets the name.

thanks, you are right
__________________
* everyone can win previous war

Last edited by Panayot : 06 June 2011 at 10:40 PM.
 
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 10:53 AM.


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