Get/SetWorldPluginData



  • On 26/10/2013 at 17:04, xxxxxxxx wrote:

    Anyone had any experience using c4d.plugins.GetWorldPluginData or c4d.plugins.SetWorldPluginData? Trying to create user preferences that will show up in the Prefs Dialog box. I see that the c++ documentation has a "PrefsDialogObject" but don't see anything like that in the Python doc(and not being a c++ kinda guy, that is greek to me lol). I see how the c4d.plugins.GetWorldPluginData or c4d.plugins.SetWorldPluginData can be used to retrieve or set the base container holding the user prefs, but how do you tell c4d to create them in the actual dialog itself?

    Thanks in advance for any inspiring wisdom!



  • On 27/10/2013 at 01:04, xxxxxxxx wrote:

    hi,

    i am not entirely sure what you are actually asking, but here are few thoughts ;)

    1. No PrefsDialogObject has not been wrapped for python. But you can of course write a cpp
    plugin to set any preference data for your python plugins. It is really not that hard as there
    is a quite extensive example in the sdk.

    2. Alternatively you could write just a CommandData / dialog plugin in python. Be aware
    that PrefsDialogObject will be build upon a description so do come with the formal restrictions 
    of these. So things might be not in the common place with a CommandData plugin, but also 
    might look prettier than with a PrefsDialogObject .

    3. On a more general note you can store anything in any BaseList2D as long as you 'own'
    the id (in form of a plugin cafe id). That does work the same way for all BaseList2D. The
    world preferences are just a plugin with their own BaseList2D repr. You could for example
    simply do something like that :

    wbc = c4d.GetWorldContainerInstance()
    mySettings = wbc[myPluginID] # bc with your plugin settings
    prettyImportant = wbc[myPluginID][someID]
    wbc[myPluginID][anotherID] = 'EvenMoreImportant'
    

    With that concept you could also store the number editor renderings which have been started 
    in a BaseDocument or the time the user has been surfing on facebook since the start of c4d in 
    every parametric sphere object in the scene. The WorldPluginData methods are just there to 
    make things easier for you and sort of combine the wbc and the mySettings step.



  • On 31/10/2013 at 12:45, xxxxxxxx wrote:

    Thanks for the reply littledevil!

    Essentially I have a plugin that currently reads/writes user dialog preferences to a text file. This method works, but only if the user is an admin and has privileges to read/write to directories(on Windows they have to right click and select "Run as Administrator").

    What I want to accomplish is to add my plugin preferences, a dropdown box (to select the desired dialog layout) and an float interface (to set dialog width or height), to the c4d preferences so that the user doesn't have to run c4d as an administrator.

    Hope that makes sense!



  • On 13/11/2013 at 08:02, xxxxxxxx wrote:

    To make your interface for the settings, just create a GeDialog implementation providing the desired
    widgets and functionality. You should store new/modified files in the User-directory instead of the
    Cinema 4D application directory because it will always be writable. This is also why it is preferred for users
    to install their plugins in the user-directory.

    You can either tell the user to install your plugin in the user-directory or chose a unique path that you
    will store your data in. You can get the user-directory via

    > c4d.storage.GeGetC4DPath(c4d.C4D_PATH_LIBRARY_USER)

    Best,
    -Niklas


Log in to reply