creating a splash screen for a plugin



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 29/11/2012 at 09:50, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   r13 
    Platform:      Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    Hey plugin cafe-ers
    i've been toying around in C++ and I was wondering if anyone had any information on how to create a splash screen during a plugin initialization.  I'm an experienced programmer but I'm still grasping onto how to develop good plugins for C4D.
    Thanks
    Jimmy



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 30/11/2012 at 08:22, xxxxxxxx wrote:

    Has anyone ever even created a splash screen for a plugin initialization?  I can't be the first person to have ever asked that question?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 30/11/2012 at 08:50, xxxxxxxx wrote:

    TBH I've never seen one and I'm sure that if it was possible we'd all be doing it. So it's probably for the best if we can't do it. Otherwise loading Cinema would mean a quick flash of a zillion different splash screens as each plugin loaded. Not a pleasant thought.

    Edit: I suppose you could have the plugin display a dialog when it calls its Init() function. But you'd need to have a good reason IMO to do that, not just for the sake of it.

    Steve



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 30/11/2012 at 09:18, xxxxxxxx wrote:

    Let me clarify, I don't want a splash screen during C4D startup, when you see "plugin initialization...."

    I want a splash screen during plugin startup, as I'm initializing a microsoft kinect it takes time for the hardware to startup and I don't want the user to question if the microsoft kinect is working or not.  I've seen splash screens during Maya plugin initialization but not during C4D plugin initialization.

    I'm porting a plugin from Maya to C4D and I need to have uniform functionality across both platforms.
    Sorry for the confusion Steve,
    Jimmy



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 30/11/2012 at 09:52, xxxxxxxx wrote:

    Oh, in that case, just create a GeDialog that contains a Bitmap (maybe in a GeUserArea) and open it during initialization.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 30/11/2012 at 09:56, xxxxxxxx wrote:

    @c4dJack,
    I hate it when people ask this to me but do you have any example code I could bum off you to get me started?
    Jimmy



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 30/11/2012 at 10:04, xxxxxxxx wrote:

    There's a way to make a dialog not show it's menu and borders. Which sort of looks like a splash screen image if you put a large bitmap button, or UserArea with an image on it.
    I found it in the SDK by accident when looking for something else. And of course now that I want to find it again on purpose I can't find it.😠

    The only other thing I can think of is to draw a bitmap image to the main scene editor window with DrawTexture().

    There's also the progress bar for a more traditional style loading..... visual aid.

    -ScottA



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 30/11/2012 at 10:09, xxxxxxxx wrote:

    Check the SDK examples, there are at least two of them (ActiveObjectDialog and AsyncDialog) that deal with a GeDialog.

    Alternatively, check out the article "TreeViews made simple" on the C4D Programming blog, as it also uses a GeDialog:
    http://c4dprogramming.wordpress.com/2012/11/25/treeview-made-simple-part-1/



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 30/11/2012 at 10:48, xxxxxxxx wrote:

    To chime in here, we are talking about dll plugins running in an application. Most times, such things as 'splash screens' and so forth are a bit beyond these ancillary supports. I agree with ScottA and c4djack. You can create a GeDialog with a GeUserArea (or even a BitmapButton that doesn't act like a button) that acts like a splash screen when your plugin's Init() method is called. Realize that Init() is called not only for creation but during document loading and copy-pasting. Again, a reason why application plugins don't normally do 'splash screens' and other application things. You may be better off listening for a particular Message() when your plugin is first created (MSG_MENUPREPARE for instance). :)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 01/12/2012 at 03:31, xxxxxxxx wrote:

    I agree, Robert.

    Jameshcoppens: You might want to consider using the Progress Bar to show connection status to the Kinect.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 01/12/2012 at 05:44, xxxxxxxx wrote:

    @c4djack & @kuroyume0161,
    Agreed, I am going to have to put some type of progress bar just for my own sake so that I know where the hardware is at in the initialization.  I'll keep everyone updated as to where I'm at with the development.
    jimmy
    http://www.jimmycoppens.com



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 03/12/2012 at 09:07, xxxxxxxx wrote:

    @kuroyume0161,
    What do you mean that " Realize that Init() is called not only for creation but during document loading and copy-pasting"  Could you go into greater detail of what you are talking about.
    Jimmy



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 03/12/2012 at 10:17, xxxxxxxx wrote:

    undo stacks (animation/changing values) and rendering are some examples where c4d creates a copy and therefore causes Init() to be fired. init goes of more or less all the time :)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/12/2012 at 08:36, xxxxxxxx wrote:

    So Here is the question I have I am utilizing a base class that inherits from GeDialog, I am overriding the InitValues function in my base class where I will put my initialization of the Kinect hardware.  From what I gather of this thread, that is a bad idea because there are multiple calls to the InitValues function, where would be a good design choice to put the initialization of that code?

    Robert mentioned that I should listen for a message during plugin creation, that seems to me like something an InitValues function would implicitly do.

    Robert do you have any example code you could post to show how you've listened for a particular message during plugin creation?
    Jimmy



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/12/2012 at 09:08, xxxxxxxx wrote:

    wouldn't be the plugin RegisterMyPlugin method a good place to check and init hardware if you 
    have to ? if the hardware (kinect) fails you wouldn't have to register the plugin at all ?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/12/2012 at 09:37, xxxxxxxx wrote:

    Ferdinand,
    I think that design is a good idea with the exception that initialization could potentially take a few seconds.  If it is in the process of  initialization then I can't put up a splash screen to show the progress of the initialization because the plugin hasn't been registered yet and I can't bring up a GeDialog.  I also don't want to initialize the hardware unless it the user is actually using the plugin.  If I put the initialization in the RegisterMyPlugin function won't it get initialized immediately?

    thoughts?
    Jimmy



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/12/2012 at 09:43, xxxxxxxx wrote:

    Now, InitValues() for a GeDialog is different than the Init() in plugins (which is declared in the NodeData class so that it exists for a good portion of plugin types). InitValues() is for configuring the values of the GUI elements of the GeDialog. It is called every time the dialog is opened.

    Depending on the plugin, you may actually want to initialize the hardware in PluginStart() in main.cpp - if you only need to initialize it once. If you need to be able to do it whenever the user 'connects' it, then you will need something that polls for it. In the former case, you can get a pointer to your plugin data from the RegisterMyPlugin() method and call your own method to do the initialization.

    // + Main.cpp   
    MyPlugin* RegisterMyPlugin();   
      
    static MyPlugin* mp =     NULL;   
      
    //*---------------------------------------------------------------------------*   
    Bool PluginStart()   
    //*---------------------------------------------------------------------------*   
    {   
         // register hooks and return   
         mp =       RegisterMyPlugin();   
         if (!mp)   return FALSE;   
         return mp->InitHardware();   
    }   
    // - Main.cpp   
      
      
    // + MyPlugin.cpp   
    // Initialize Hardware   
    // Note: must be declared public: to be called from other places   
    //*---------------------------------------------------------------------------*   
    Bool MyPlugin::InitHardware()   
    //*---------------------------------------------------------------------------*   
    {   
    // Do your hardware initilization   
    // ...   
    return TRUE; // on success   
    return FALSE; // on failure   
    }   
      
    // Global Registrant Method for MyPlugin   
    //*---------------------------------------------------------------------------*   
    MyPlugin* RegisterMyPlugin()   
    //*---------------------------------------------------------------------------*   
    {   
         // Allocate an instance here   
         // - this is only good for single instance plugins like a CommandData   
         MyPlugin*     mp =     gNew MyPlugin();   
         if (!mp)                    return NULL;   
         // Call the C4D Plugin Registration method   
         if (RegisterCommandDataPlugin(blah, blah, ..., blah, mp)) return mp;   
         return NULL;   
    }   
    // - MyPlugin.cpp
    

    Even if you are using another type of plugin, it may be wise to create a dummy CommandData plugin just to do the hardware initialization. You can always have it do nothing when selected from the Plugins menu - but registration and hardware initialization will always occur during startup of Cinema 4D.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/12/2012 at 09:55, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Ferdinand,I think that design is a good idea with the exception that initialization could potentially take a few seconds.  If it is in the process of  initialization then I can't put up a splash screen to show the progress of the initialization because the plugin hasn't been registered yet and I can't bring up a GeDialog.  I also don't want to initialize the hardware unless it the user is actually using the plugin.  If I put the initialization in the RegisterMyPlugin function won't it get initialized immediately? thoughts?Jimmy

    It will depend on the type of plugin. It appears that you are using a CommandData with a GeDialog. You could put a call to InitHardware() in the Execute() of your CommandData-derived class. To avoid reinitialization (unless you want to verify it each time), you could add a member to your CommandData-derived class that keeps the state of the hardware initialization (such as Bool HardwareInitialized). Set it TRUE when initialization has occurred successfully and check for it whenever InitHardware() is called again. There is only one instance of a CommandData plugin created (unlike Objects, Tags, etc. which can have multiple instances existing simultaneously, even in multiple open documents). Thus, the state member will be valid whenever the user executes your plugin.

    ETA: More information on the type of plugin you are creating would help. :)


Log in to reply