Navigation

    • Register
    • Login
    • Search
    1. Home
    2. Hexbob6
    H

    Hexbob6

    @Hexbob6

    0
    Reputation
    6
    Posts
    117
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    • Profile
    • More
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups
    Hexbob6 Follow

    Best posts made by Hexbob6

    This user does not have any upvoted posts yet.

    Latest posts made by Hexbob6

    RE: Creating custom dynamic 'hot corners'?

    Hi @ferdinand, thanks for the rapid response and the link to the previous CommandData plugin answer, I'll be bookmarking that for future reference!

    I am a bit unsure what you mean by "hot corners". Are you talking about for example the icon of the Coordinate Manager as shown below...

    Those are the things, yes! I wasn't sure exactly what to call them, but saw they were listed as 'hot corners' in the r25 release notes :)

    ...you cannot toggle the Xpresso or Thinking Particles dialog in this manner.

    I believe this might explain my problem though! Thinking about it I probably only tested these editor types before posting my question. I assume because the original Redshift Shader Graph editor uses an xpresso-like editor, that could be the reason for me being unable to toggle it in a similar way to the other managers? Strange that the Redshift IPR allows me to toggle, however, although it isn't xpresso-like so perhaps that's the reason?

    ...due to simply not having been retrofitted.

    So, to confirm, you're saying there isn't a work around for such editors if they haven't been retrofitted, either via python or otherwise?

    As a bonus question, do you know of a way to toggle tabbed groups of managers with an icon (and not via the folding behaviour accessed by ctrl+clicking the hamburger menu). For example, pressing the red icon could close/hide the whole of the purple area despite it consisting of 2 tabbed groups?

    2023-05-11_22h45_23.png

    Thanks again!

    posted in General Talk •
    Creating custom dynamic 'hot corners'?

    Hi there,

    Apologies first of all if this is the wrong area/forum to post this in, please point me to the right place or delete if so!

    I typically use a dual-monitor setup for C4D, however am currently trying to create a new custom layout that has quick access to all of my typically used managers/commands on a single monitor. The 'hot corners' - 4 palette icons that dynamically toggle the different asset, material, coords and dope sheet managers - were a great addition in R25 and seem like they'd be something that I'd like to make use of for the single monitor layout! Unfortunately, I don't seem to be able to find a way to add custom hot corners for, say, the RS Shader Graph editor.

    Is this something that's possible in the current implementation of the hot corners, or are they somehow hard-coded in their current state? I also noticed that adding a new dope sheet icon to the interface shows an 'open in a new window' icon next to it, which isn't present in the same hot corner icon, leading me to suspect it does somehow differ to the usual command?

    Any help would be appreciated! :)

    posted in General Talk •
    RE: Best practices for a plugin containing multiple commands

    Wow, thank you both for such detailed and informative replies!

    First of all, apologies @ferdinand for the tag issues, I was consulting the guidelines whilst typing my question but managed to miss the OS tag. Not sure if it matters too much for python dev, but I am on a Windows machine. I did however notice that the tag list doesn't seem to be updated to include R25 just yet (the version I'm currently working with), so it may need adding by the team. It doesn't look like I'm able to edit my original post past a certain time, but if you have the ability feel free to update :)

    Useful to know about the distinction between CommandData.ExecuteOptionID() and CommandData.ExecuteSubID(). The cogwheel icon present on some of the in-built commands was something that I'd noticed previously and been curious as to the implementation of - assumed it was just some complex code magic that added an additional button to the menu UI, ha!

    I guess that you're probably right in that I shouldn't try to run before I can walk, and if there's no limit to the amount of plugin IDs permitted (makes sense if there are hundreds of thousands of them going spare! ;) ), then the keep-it-simple approach of registering multiple IDs would probably be best at this stage. For future reference though, if it is functionally the same as registering multiple IDs, do you know of any resources showing the implementation of CommandData.ExecuteSubID(), besides the docs; is this something that could be a candidate for an additional example in the SDK plugins repo?

    @Cairyn thanks for offering a more general insight into the situational decisions behind why something might be the 'best' choice (or not a choice at all!). I'm a designer first and foremost with an interest in coding, rather than the other way around, so considering the UX of a potential plugin and how it could fit into my own workflow is something I'm keen not to ignore :)

    To be a little more specific about how the plugin will function: essentially it will be a set of commands allowing the user to rapidly navigate around the viewport in a way that's a bit more custom than the default 'front, back, left, right, etc' views, as well as the ability to toggle between perspective and parallel views, ideally while keeping the same projection matrix (the hard bit!). My intention is to bind these commands to separate shortcuts so that they're a 'function at your fingertips' :) Actually I do have some additional questions about the ability to set keyboard shortcuts via a plugin, instead of the command manager, and how Cinema then deals with shortcut conflicts, but I think that's one for another thread!

    Definitely going to refer back to these suggestions as I continue my learning journey.

    Thank you both again!

    posted in Cinema 4D SDK •
    Best practices for a plugin containing multiple commands

    Hi there, I'm working on creating my first python plugin for c4d and wrapping my head around the intricacies of the api (so forgive me if my general knowledge is a bit lacklustre, and terminology a bit off :) ).

    The plugin itself allows a custom way of navigating the editor/user selected camera based on custom created Command Data commands. For example, the user presses the 'A' key (arbitrary) to move the camera to one position, the 'B' key (also arbitrary) to move it to another, etc.

    I'm curious as to what the recommended best practices are for creating these custom commands as I couldn't find many examples of Command Data plugins that create multiple commands in the sdk or forum examples. The immediately obvious way is to create and register multiple c4d.plugins.CommandData classes within the main .pyp file, as follows:

    import c4d
    
    PLUGIN_ID_1 = 1000000 #Test ID
    PLUGIN_ID_2 = 1000001 #Test ID
    
    #Create first command example
    class ExampleCameraCommandA(c4d.plugins.CommandData):
    
        def Execute (self, doc):
            #Execute camera code here...
            return True
    
    #Create second command example
    class ExampleCameraCommandB(c4d.plugins.CommandData):
    
        def Execute (self, doc):
            #Execute camera code here...
            return True
    
    if __name__ == "__main__":
    
        #Registers first custom command
        c4d.plugins.RegisterCommandPlugin (
            id = PLUGIN_ID_1,
            str = "Example Command A",
            info = 0, #PLUGINFLAG_COMMAND_HOTKEY(?)
            help = "Moves camera to point A.",
            dat = ExampleCameraCommandA(),
            icon = None)
    
        #Registers second custom command
        c4d.plugins.RegisterCommandPlugin (
            id = PLUGIN_ID_2,
            str = "Example Command B",
            info = 0, #PLUGINFLAG_COMMAND_HOTKEY(?)
            help = "Moves camera to point B.",
            dat = ExampleCameraCommandB(),
            icon = None)
    
    

    Really my main issue with this, is that it seems a bit overkill to generate multiple pluginIDs for essentially one plugin (albeit one that will contain many custom commands) - is this really how it should be done?

    The only other point of potential interest that I could see in the docs were the CommandData.GetSubContainer(), CommandData.ExecuteSubID() and CommandData.ExecuteOptionID() methods, but couldn't find many examples of their use and implementation to learn from...

    Any light shed on this topic would be very much appreciated, thanks in advance! :)

    posted in Cinema 4D SDK •
    RE: Adding Multiple Keyboard Shortcuts within a Python Script

    Hi @m_adam , thank you for the detailed reply! You're right there are a couple of parts to my question, so it might be helpful if I give a simplified example of what I'm trying to do.

    Essentially, I want to create a script that allows me to switch between different camera views (top, right, left, etc) by pressing the number keys. Whilst it would be easy to create a number of '.py' files using c4d.CallCommand() and then assign them all manually in the 'Customise Commands' manager, I was hoping I'd be able to create a script that runs for the duration that Cinema is open and reads the user's keypresses, returning c4d.CallCommand() when specified keys are pressed.

    Based on the first part of your answer I'd assume I'd need something along the lines of this... but I can't seem to get it to work.

    import c4d
    
    def main():
    
        bc = c4d.BaseContainer()
    
            # If the '7' key is pressed, enter 'Top' View
            if c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD, c4d.KEY_7, bc):
                if bc[c4d.BFM_INPUT_VALUE] == 1:
                    c4d.CallCommand(12083)  # Enters 'Top' View
    
            # If the '3' key is pressed, enter 'Right' View
            elif c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD, c4d.KEY_3, bc):
                if bc[c4d.BFM_INPUT_VALUE] == 1:
                     c4d.CallCommand(12080)  # Enters 'Right' View
    
    if __name__=='__main__':
        main()
    

    Any ideas? Thanks again, Maxime! :)

    posted in Cinema 4D SDK •
    Adding Multiple Keyboard Shortcuts within a Python Script

    I am new to Cinema, having come from a different 3D software, and have been playing around with the Python API to create various scripts replicating certain functionality in my original software. These scripts have been very simple, typically calling/toggling commands, and I have been binding them to different keyboard shortcuts using the 'Customise Commands' Manager.

    My problem is that there is a script I'd like to create that would ideally map different commands to individual key-presses from within the script. Short of creating multiple smaller scripts and binding each of them to individual keys, I was wondering if it was possible to assign shortcuts from within the script itself? Obviously (I'd assume?), this singular script would have to run at startup.

    For example:

    if  a_key is pressed:
        # do_something
    
    elif a_different_key is pressed:
        # do_something_else
    

    Any detailed answers would be appreciated as I'm still fairly new to Python.
    Thanks!

    posted in Cinema 4D SDK •