Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Add a "don't show this message again" checkbox

    Scheduled Pinned Locked Moved PYTHON Development
    2 Posts 0 Posters 224 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      On 14/10/2016 at 15:35, xxxxxxxx wrote:

      I used the script below to allow deactivation of the plugin update notifications, by writing a .txt file under the writeable startup directory of cinema 4d.
      Is it possible to do that without writing a .txt file?

      I have simplified this code, just to give you an idea of what I want to do.

        
      filePath = os.path.join(c4d.storage.GeGetStartupWritePath(), 'plugins', 'PluginName', 'notification.txt')  
      CHECKBOX = 1001  
        
      class updateDialog( c4d.gui.GeDialog) :  
        
        def CreateLayout(self) :  
            self.AddCheckbox(CHECKBOX, c4d.BFH_SCALEFIT, 0, 0, name=" Don't show this message again! ")  
        
            return True  
              
        def Command(self, id, msg) :  
                  
            if self.GetBool(CHECKBOX) == True :          
                fn = os.open( filePath, os.O_WRONLY|os.O_TRUNC|os.O_CREAT, 0600)  
                os.write(fn, "Disable Update Notifications")  
                os.close(fn)  
            return True  
        
      class MyClass(c4d.plugins.CommandData) :  
        
        def Execute(self, doc) :  
            if not os.path.exists(filePath) :  
                dlg = updateDialog()  
                dlg.Open(c4d.DLG_TYPE_MODAL, xpos= 700, ypos= 250, defaultw=600, defaulth=0)  
            return True  
      
      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 17/10/2016 at 08:15, xxxxxxxx wrote:

        Hi Mustapha,

        you could store this information in the "world container".
        You can get that BaseContainer via GetWorldContainerInstance().
        But please don't store the information directly in there. Instead get a PluginID[URL-REMOVED] and store a BaseContainer at that ID in the world container. Then you can store whatever you want in your own BaseContainer.


        [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post