Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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
    1. Maxon Developers Forum
    2. Hexbob6
    3. Topics
    H
    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 6
    • Best 0
    • Controversial 0
    • Groups 0

    Topics created by Hexbob6

    • H

      Creating custom dynamic 'hot corners'?

      General Talk
      • • • Hexbob6
      4
      0
      Votes
      4
      Posts
      937
      Views

      ferdinandF

      Hey @Hexbob6,

      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?

      Yes, the legacy Redshift material graph is using GraphView, a.k.a., Xpresso. And which dialogs support this folding feature and which not is primarily guided by feasibility and efficiency reasons.

      There never was an Open/Close Xpresso command in Cinema 4D as that would have been an ambiguous command since there can be dozens of Xpresso graphs in a scene. It is not an unsolvable problem, the new Node Editor has the same problem and it does solve it. But solving something like this would be more costly than throwing the four or five lines of code in there which realize the folding behavior in other dialogs.

      The Thinking Particles dialog in the Xpresso window on the other hand, does not have any such restrictions, at least I see none, and simply has not been adapted for efficiency reasons, as there are A LOT of dialogs in Cinema 4D.

      In any case, if you think that a feature X is missing in of our products, I would invite you to Submit Feedback in the
      Share your Ideas section of our end user support.

      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?

      Yes, a dialog shipped with Cinema 4D which is wrapped by a command which does not implement this behavior cannot be retrofitted by third parties. The reason for this is that the dialogs that realize things such as Node Editor, Object Manager, Xpresso Manager, etc. are not exposed in the public API. We only expose their associated commands. This is an intentional decision.

      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?

      Hm, I do not think so. There is AFAIK not a built-in feature like that, but the appropriate place to ask this would be end user support. Wrapping two commands into one (with either a full blown plugin or just a script) is not a problem. But dialog folding is undefined for tabbed dialogs as you show it in your screenshot. You could also file a feature request here in our support center.

      What you can however do, is put multiple dialogs into a layout, and write yourself either a script or plugin which cycles through them, fold/unfolding them one by one. Not exactly the same, but similar 🙂 For an example, see the end of my posting.

      Cheers,
      Ferdinand

      Result:

      Code:

      """Cycles the folding state of dialogs associated with multiple commands. Must be run as a Script Manager script. Could also be realized as a CommandData plugin for a fancier solution. """ from typing import Optional import c4d # ID definitions for the timeline and node editor commands. Technically not necessary, we could also # use the the integers directly, but makes things nicer to read. c4d.CID_TIMELINE_MANAGER: int = 465001541 c4d.CID_NODEEDITOR_MANAGER: int = 465002211 # Define the folding group we want to create, i.e., the script will cycle through these command IDs, # folding and unfolding dialogs associated with the command, each time it is pressed. PID_FOLDING_GROUP: tuple[int] = (c4d.CID_TIMELINE_MANAGER, c4d.CID_NODEEDITOR_MANAGER) # If #True, a state will be added at the end of the cycle, showing all dialogs. SHOW_ALL_AT_END: bool = False # If #True, a state will be added at the end of the cycle, hiding all dialogs. HIDE_ALL_AT_END: bool = True def GetNextCommandId() -> int | bool: """Determines the command ID of the next item in #PID_TOGGLE_GROUP. """ # Get the check state of all commands in PID_TOGGLE_GROUP. states: list[bool] = [c4d.IsCommandChecked(pid) for pid in PID_FOLDING_GROUP] if not any(states): return PID_FOLDING_GROUP[0] i: int = states.index(True) # Everything is open if all(states): return False if HIDE_ALL_AT_END else 0 # The cycle has reached the end elif i == len(PID_FOLDING_GROUP) - 1: if SHOW_ALL_AT_END: return True elif HIDE_ALL_AT_END: return False else: return PID_FOLDING_GROUP[0] # Pick the next item return PID_FOLDING_GROUP[i+1] def main() -> None: """Switches the group #PID_TOGGLE_GROUP to the next state. """ cid: int | bool = GetNextCommandId() for item in PID_FOLDING_GROUP: # Show the item when it is hidden and the to be shown item or all items should be shown. if not c4d.IsCommandChecked(item) and (cid == item or cid is True): c4d.CallCommand(item) # Hide the item when it is shown and not the to be shown item or all items should be hidden. elif c4d.IsCommandChecked(item) and (cid != item or cid is False): c4d.CallCommand(item) if __name__ == '__main__': main()
    • H

      Best practices for a plugin containing multiple commands

      Cinema 4D SDK
      • python • • Hexbob6
      4
      0
      Votes
      4
      Posts
      855
      Views

      H

      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!

    • H

      Adding Multiple Keyboard Shortcuts within a Python Script

      Cinema 4D SDK
      • r20 python sdk • • Hexbob6
      5
      0
      Votes
      5
      Posts
      2.3k
      Views

      M

      Hi @Hexbob6

      I'm wondering if your question has been answered. If so, please mark this thread as solved.

      Cheers,
      Maxime.