Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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
    • Recent
    • Tags
    • Users
    • Register
    • Login

    How do I reproduce [IKeyPress, SHIFT + CTRL, [CanvasClick,[MouseHPos],[MouseVPos]]] in ZBrush Python?

    Scheduled Pinned Locked Moved ZBrush SDK
    windows
    1 Posts 1 Posters 40 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P Offline
      pocacola
      last edited by pocacola

      I’m trying to convert this ZScript behavior to ZBrush Python:
      [IKeyPress, SHIFT + CTRL, [CanvasClick,[MouseHPos],[MouseVPos]]]

      My Python attempt is:
      var = zbc.get_mouse_pos()
      zbc.press_key("SHIFT + CTRL", lambda: zbc.canvas_click(var[0], var[1]))

      I’ve also tried several variations of the shortcut string, but none of them work.

      What I already know:

      zbc.canvas_click(var[0], var[1]) works by itself.
      The problem only starts when I try to combine it with zbc.press_key().

      I already have a workaround by using zbc.press("macro button with [IKeyPress, SHIFT + CTRL, [CanvasClick,[MouseHPos],[MouseVPos]]] inside").

      What works and what doesn't:
      [Fails] zbc.press_key("CTRL+z")
      [Works] zbc.press_key("N", lambda: press("Document:New Document")) (don't know what "N" does)
      [Works] zbc.press_key("e", lambda: print("Scale mode enabled")) (don't know what "e" does)
      [Works] zbc.press_key("SHIFT+p", lambda: zbc.press("Tool:Subtool:MoveUp")) (correctly simulates moving subtool to the top, i had to add a key ("p") to the shift modifier for it to work)

      What i would like to have clarified:
      Is there a supported Python equivalent to ctrl + shift click?
      If zbc.press_key() is the wrong tool, what is it actually doing internally?
      Does it simulate real keyboard state?
      Does it support modifier-only combinations like SHIFT+CTRL without a normal key?
      Is this expected to fail with canvas_click() specifically?
      In other words, does press_key() work only for certain commands, but not for canvas interaction?
      I’m trying to avoid guesses here. A concrete answer about what press_key() can and cannot do would help a lot.

      1 Reply Last reply Reply Quote 0
      • First post
        Last post