from uuid import getnode as gm #line:1
import base64 #line:2
import c4d #line:3
from ssp_ids import *#line:4
from ssp_utils_pref import *#line:5
from ssp_utils import *#line:6
class MessageDataSSP (c4d .plugins .MessageData ):#line:12
    _docLast =None #line:13
    _docNameLast =''#line:14
    _docPathLast =''#line:15
    _numDocsLast =0 #line:17
    def CoreMessage (O0OOOOO0O00000OO0 ,OO000O0O0O0OOOO0O ,O0O0000OO0O00OO00 ):#line:19
        if not GetPrefPluginEnabled ():#line:20
            return True #line:21
        if OO000O0O0O0OOOO0O ==c4d .EVMSG_CHANGE :#line:23
            OO00000OOO00O0000 =c4d .documents .GetActiveDocument ()#line:24
            O000OO00O00O00OOO =OO00000OOO00O0000 .GetDocumentName ()#line:25
            OOOO0O00OOOO00O0O =OO00000OOO00O0000 .GetDocumentPath ()#line:26
            OOO0OOOOO0OO00O0O =c4d .documents .GetFirstDocument ()#line:28
            O0000O00O00OOO0O0 =0 #line:29
            while OOO0OOOOO0OO00O0O is not None :#line:30
                O0000O00O00OOO0O0 +=1 #line:31
                OOO0OOOOO0OO00O0O =OOO0OOOOO0OO00O0O .GetNext ()#line:32
            if O0OOOOO0O00000OO0 ._docLast is None or not O0OOOOO0O00000OO0 ._docLast .IsAlive ()or OO00000OOO00O0000 !=O0OOOOO0O00000OO0 ._docLast or O000OO00O00O00OOO !=O0OOOOO0O00000OO0 ._docNameLast or OOOO0O00OOOO00O0O !=O0OOOOO0O00000OO0 ._docPathLast or O0000O00O00OOO0O0 !=O0OOOOO0O00000OO0 ._numDocsLast :#line:36
                O0OOOOO0O00000OO0 .UpdateScenesData ()#line:37
                O0OOOOO0O00000OO0 ._docLast =OO00000OOO00O0000 #line:39
                O0OOOOO0O00000OO0 ._docNameLast =O0OOOOO0O00000OO0 ._docLast .GetDocumentName ()#line:40
                O0OOOOO0O00000OO0 ._docPathLast =O0OOOOO0O00000OO0 ._docLast .GetDocumentPath ()#line:41
                c4d .SpecialEventAdd (PLUGIN_ID_COREMESSAGE ,p1 =SUBID_COREMESSAGE_UPDATE )#line:43
        elif OO000O0O0O0OOOO0O ==PLUGIN_ID_COREMESSAGE_2 :#line:45
            O0OOOOO0O00000OO0 .UpdateScenesData ()#line:46
            O0OOOOO0O00000OO0 ._docLast =c4d .documents .GetActiveDocument ()#line:48
            O0OOOOO0O00000OO0 ._docNameLast =O0OOOOO0O00000OO0 ._docLast .GetDocumentName ()#line:49
            O0OOOOO0O00000OO0 ._docPathLast =O0OOOOO0O00000OO0 ._docLast .GetDocumentPath ()#line:50
            c4d .SpecialEventAdd (PLUGIN_ID_COREMESSAGE ,p1 =SUBID_COREMESSAGE_UPDATE )#line:52
        return True #line:54
    def VerifySceneData (O0O00000O00O000O0 ,OOO00O0O00OO00OO0 ,O0OO0OOOOO0O0O000 ):#line:57
        OO0O0OOOOO00O0O00 =base64 .b16decode #line:58
        O000000OO000O0OO0 =c4d .plugins .GetWorldPluginData (PLUGIN_ID )#line:60
        if O000000OO000O0OO0 is None :#line:61
            return None #line:62
        O0OOO00O0O0OOOO00 =(1 <<O0OO0OOOOO0O0O000 )*50 #line:64
        O00O0OO0O00OO0OO0 =lambda O00000OO000O00000 :str (OO0O0OOOOO00O0O00 (O00000OO000O00000 ))#line:65
        O00OOOOOOOOOOO0O0 =O000000OO000O0OO0 .GetString (O0OOO00O0O0OOOO00 +1 )#line:67
        O00O0O00O0O0000OO =OOO00O0O00OO00OO0 #line:68
        if O00OOOOOOOOOOO0O0 is None :#line:69
            return O00OOOOOOOOOOO0O0 #line:70
        O00OOOOOOOOOOO0O0 =str (O00OOOOOOOOOOO0O0 ).replace (' ','')#line:72
        OO0OOOO000O0O000O =O000000OO000O0OO0 .GetString (int (O0OOO00O0O0OOOO00 *2.5 )-148 )[3 :6 ]#line:74
        OOO00OO00OOO000O0 =('b'+O00OOOOOOOOOOO0O0 )[2 :5 ]#line:75
        OOOO0OO0000O00O00 =O00O0OO0O00OO0OO0 (b'313258')[O0OOO00O0O0OOOO00 -98 :-1 *O0OO0OOOOO0O0O000 ]#line:76
        if OO0OOOO000O0O000O ==OOO00OO00OOO000O0 and OOOO0OO0000O00O00 in O00OOOOOOOOOOO0O0 :#line:78
            return O00O0O00O0O0000OO #line:79
        return None #line:81
    def UpdateScenesData (OO0O00O000OO0O0OO ):#line:84
        OOOO0O00O0OOOOOO0 =c4d .BaseContainer ()#line:85
        O00O000O000OO0OO0 =c4d .BaseContainer ()#line:86
        OOO000O00O0O00OOO =c4d .BaseContainer ()#line:87
        O000OOO0O000OOOOO =c4d .BaseContainer ()#line:88
        O000O0000OOO0000O =c4d .BaseContainer ()#line:89
        OO000O0OO0OO000O0 =c4d .BaseContainer ()#line:90
        OOOOO0O000O0OO0OO =GetScenes ()#line:91
        OOO000000OOO0O000 =GetScenesFavorite ()#line:92
        O000OO00000O00O00 =GetScenesReopen ()#line:93
        O000OOO00O0O0000O =c4d .documents .GetFirstDocument ()#line:95
        OO000000OOOOOO000 =c4d .documents .GetActiveDocument ()#line:96
        OOO0OO0000O00O000 ={}#line:97
        OO000OOO0O0OOO000 =None #line:99
        while O000OOO00O0O0000O is not None :#line:100
            OO000OOO0O0OOO000 =O000OOO00O0O0000O #line:101
            O000OOO00O0O0000O =O000OOO00O0O0000O .GetNext ()#line:102
        O000OOO00O0O0000O =OO000OOO0O0OOO000 #line:104
        OO0O00O000OO0O0OO ._numDocsLast =0 #line:106
        while O000OOO00O0O0000O is not None :#line:107
            OO0O00O000OO0O0OO ._numDocsLast +=1 #line:108
            O00O00O0O0O0O0000 ,OO00O000OO0000OOO ,O0O0OOO00O0000O00 ,OOOO00O0O00O00O00 =GetDocumentPathFull (O000OOO00O0O0000O )#line:110
            OOOO0O00O0OOOOOO0 .SetString (OO00O000OO0000OOO ,O00O00O0O0O0O0000 )#line:112
            O000OOO0O000OOOOO .SetString (OO00O000OO0000OOO ,O0O0OOO00O0000O00 )#line:113
            O00O000O000OO0OO0 .SetBool (OO00O000OO0000OOO ,OOO000000OOO0O000 .GetBool (OO00O000OO0000OOO ,False ))#line:114
            OOO000O00O0O00OOO .SetBool (OO00O000OO0000OOO ,O000OO00000O00O00 .GetBool (OO00O000OO0000OOO ,OOOO00O0O00O00O00 ))#line:115
            O000O0000OOO0000O .SetBool (OO00O000OO0000OOO ,OOOO00O0O00O00O00 )#line:116
            OO000O0OO0OO000O0 .SetBool (OO00O000OO0000OOO ,O000OOO00O0O0000O ==OO000000OOOOOO000 )#line:117
            O000OOO00O0O0000O =O000OOO00O0O0000O .GetPred ()#line:119
        OOOO0O00O0OOOOOO0 =OO0O00O000OO0O0OO .VerifySceneData (OOOO0O00O0OOOOOO0 ,1 )#line:121
        if OOOO0O00O0OOOOOO0 is None :#line:122
            return #line:123
        SetScenes (OOOO0O00O0OOOOOO0 )#line:125
        SetScenesNames (O000OOO0O000OOOOO )#line:126
        SetScenesFavorite (O00O000O000OO0OO0 )#line:127
        SetScenesReopen (OOO000O00O0O00OOO )#line:128
        SetScenesIsSaved (O000O0000OOO0000O )#line:129
        SetScenesIsActive (OO000O0OO0OO000O0 )#line:130
