PDA

View Full Version : Do not save Master Script in SCENE



papou
07-20-2017, 01:37 PM
Hi,
I'm really not familiar with Python.
I'm trying to fixe an old python script that is no more working with 2015.3

If Somebody can share me an easy exemple to prevent master script to be saved in Scene, that will save me a lot of time.

Thank you :)

Sensei
07-20-2017, 02:02 PM
You need to make Layout master plugin, instead of Scene one.. It's in C/C++ done by using appropriate type

LWSDK/html/classes/master.html

type
This can be one of the following.

LWMAST_SCENE
LWMAST_OBJECTS
LWMAST_EFFECTS

LWMAST_LAYOUT

But such Layout Masters are saved together with Layout. And started with Layout.

papou
07-20-2017, 02:59 PM
thank you for your time sensei.
I have add

def flags(self):
return lwsdk.LWMAST_LAYOUT | lwsdk.LWMASTF_RECEIVE_NOTIFICATIONS

But the script is persistent across scene clearing, so i think it's not working...

I will let it like the master script by default, saving in the scene...
I will just check that is not crashing LWSN...

^^

Sensei
07-20-2017, 03:14 PM
Try Add Plugins, so LW will learn about new flags and type, for a start.

There is 'type' field in C/C++ version of LWSDK, and there is flags(). Set both to appropriate constants.



def flags(self):
return lwsdk.LWMAST_LAYOUT | lwsdk.LWMASTF_RECEIVE_NOTIFICATIONS
^^^^^^^^^^^^^^^^^^^^^
They differ by F suffix..


f = flags( instance )
Returns flag bits combined using bitwise-or. The following flags are defined:

There are some new event codes available to master handlers via the event callback. These will only appear when the 'flags' callback returns the correct flags. These new events can occur in ScreamerNet as well as Layout. The flags available are:

LWMASTF_LAYOUT
This flag signals that this master handler should be considered a layout level plugin instead of a scene level plugin for the purposes of saving handler data.
LWMASTF_RECEIVE_NOTIFICATIONS
This flag signals that this master handler wants to receive LWEVNT_NOTIFY_ events, which are documented below in the eventData section.
LWMASTF_RECEIVE_NOTIFICATIONS_MESHPOINTS
This flag signals that this master handler wants to receive the LWEVNT_NOTIFY_MESHPOINTS_ALTERED event. It is necessary to specify the LWMASTF_RECEIVE_NOTIFICATIONS flag as well, in this case.



#define LWMAST_SCENE 0
/*
A scene level master handler gets destroyed when the scene is cleared
*/
#define LWMAST_LAYOUT 1
/*
A layout level master handler remains until user removes it or layout is closed
*/

/* 'flags' return choices */
#define LWMASTF_LAYOUT (1<<0)
/*
bit 0: Allows changing type to LWMAST_LAYOUT.
This is required when type is LWMAST_LAYOUT and you want it to stay that way
*/



I will just check that is not crashing LWSN...

Layout Master plugins dont work with LWSN, only Scene one does in limited way. f.e. commands are not received AFAIR.

papou
07-24-2017, 02:51 PM
Thank for your effort.