Multi-Buttons with Python



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

    On 04/06/2011 at 07:17, xxxxxxxx wrote:

    You never said that it runs automatically at start up.
    That's good to know.

    -ScottA



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

    On 04/06/2011 at 07:19, xxxxxxxx wrote:

    I thought you will recognize it. ^^
    If you think a bit about it, you will notice that a .pyp file *must* be executed at startup. Or when do you want your plugin to be registered if not at startup ? :)

    Cheers



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

    On 04/06/2011 at 07:59, xxxxxxxx wrote:

    I was hoping that this might possibly be a way to change some of the C4D interface options when C4D starts up.

    I just started looking into this:

    from  os  import remove  
    import os  
    import time  
    import c4d  
    from c4d import gui, utils  
      
    start = time.time()  
    if start > 1300000000:  
     gui.MessageDialog("Welcome")  
       
    path = r"C:\Users\user\AppData\Roaming\MAXON\CINEMA 4D R12 Demo_0E6F67AE\prefs\coffeesymbolcache"  
      
    remove(path)
    

    The timer function isn't working properly in this example.
    But hopefully you should get the idea what I'm trying to do with it.

    -ScottA



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

    On 04/06/2011 at 08:35, xxxxxxxx wrote:

    From the docs:

    Can I execute code on startup of CINEMA 4D?
    In some cases it might be necessary that you need to execute Python code on startup of CINEMA 4D before any other Python stuff is loaded. In this case, go to the user folder of CINEMA 4D and create a file in the python prefs   {USER_FOLDER}/prefs/python/.
    _
    _
    > > python_init.py Autostart Python Code.



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

    On 04/06/2011 at 08:59, xxxxxxxx wrote:

    Thanks for the heads up.
    I'll give it a try.

    -ScottA

    Edit:
    The problem I'm running into is that this python file runs before C4D has finished loading. So it doesn't accept the code in it.

    For example:
    If I wanted the UI to load with the scale tool active. And I put c4d.CallCommand(200000089) in the file. It doesn't work because the python file is trying to execute that command before C4D has finished loading.

    I was wondering if this kind of thing was possible to do?



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

    On 04/06/2011 at 09:39, xxxxxxxx wrote:

    No, this is not possible. Btw, opening GUI is blocked on startup.



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

    On 04/06/2011 at 09:49, xxxxxxxx wrote:

    Sorry to hear that.
    But thanks for the help.

    -ScottA



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

    On 04/06/2011 at 10:27, xxxxxxxx wrote:

    Haha, I already found a workaround some time ago.
    I wanted to insert an object into the document on c4d start up. But it didn't work. I found out that the active document on startup isnt the same as when c4d has finished loading.

    So what to do ? Start a Thread on C4D startup that compares the current document with the document you got when the thread actually started within a while-loop.

    If the document is not the same, C4D did finish loading.

    Cheers,



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

    On 04/06/2011 at 10:37, xxxxxxxx wrote:

    Do you have an example of this?

    -ScottA



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

    On 04/06/2011 at 10:50, xxxxxxxx wrote:

    Of course, you should now me now ;-D

    Example Code

    Cheers,



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

    On 04/06/2011 at 10:52, xxxxxxxx wrote:

    Why don't you use the template.c4d? This file is loaded on startup



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

    On 04/06/2011 at 11:14, xxxxxxxx wrote:

    That's pretty cool niklas. 👍

    -ScottA


Log in to reply