1. #1

    Lightbulb Back from the Ashes - The Intuos Plugin Dream lives again

    It is alive!!!!


    After a little more than one year, I am back trying to write an external app in order to tighten the integration between ZB and my Intuos tablet.


    Shortly after my last post, I almost gave up due to the apparent impossibility to capture tablet data from another app. But after quite a strugle, I managed to overcome this obstacle.


    Not only that, but now I have managed to extract all the information I need (wheel position, stylus id, etc) from the driver.

    All I need to do now is find a way to send these to ZB. And to do this, I need help with a few 'basic' doubts about ZScript:

    1- How can I get/set the current brush through ZScript?
    2- Can I set brush settings (like zIntensity, radius, etc) directly through ZScript?
    3- Can I call functions from an app/dll implemented in C# from ZScript?
    4- Can a ZScript run in an infinite loop for as long as it is active without freezing the app?
    5- Can an external app cause ZB to run a specific script without sending keyboard messages?

    My first idea was to study the ZScript ref, but I can't seem to find it online. The link at the top of this forum is dead.

    Thanks in advance

    Sygnus
    Last edited by Sygnus; 04-16-12 at 09:09 PM.

  2. #2

    Default Found a few answers...

    Decided to record some basic actions on ZB and inspect the generated scripts and found answers to most of my questions.

    There are still some bits that I can't get from recorded sessions and still require help, though.

    1- How can I get/set the current brush through ZScript?
    Found how to set the current brush (using IPress)
    Still have to find out how to GET the current brush
    2- Can I set brush settings (like zIntensity, radius, etc) directly through ZScript?
    Covered: [ISet,Drawraw Size,X], [ISet,Draw:Focal Shift, X], etc
    3- Can I call functions from an app/dll implemented in C# from ZScript?
    Got it too: FileExecute.
    4- Can a ZScript run in an infinite loop for as long as it is active without freezing the app?
    I guess Sleep/Sleepagain would be just the thing... if only they would take fractions of a second... will have to think a little more about this one.
    5- Can an external app cause ZB to run a specific script without sending keyboard messages?
    The biggest chalange so far. Really need help whith this one! Please!

    By the way, found the links to the ZScript Ref:
    http://www.pixologic.com/docs/index.php/ZScript_Basics
    http://www.pixologic.com/docs/index.php/ZScript_Command_Reference

  3. #3
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    8,687

    Default

    1. You can find out the current brush either by using:

    [IGetTitle,Brush:Current Brush,1]

    or from the 'Item Info' slider (the slider at the top of the palette):

    [IGetTitle,Brush:Item Info,0]

    Note that the return value varies for these two and you'll need to be careful how you use them. For example, the Item Info slider returns the name of the brush with a period (.) on the end. You'll probably need to trim this off using [StrExtract].

    The Item Info slider is useful for getting/setting the brush as you can use the numerical values -

    [VarSet,brushID,[IGet,Brush:Item Info]]
    //do stuff
    [ISet,Brush:Item Info, #brushID]

    However note that if you want to get/set masking or selection brushes you will need to simulate the Ctrl/Shift keypresses using [IKeyPress]. And don't forget that the brushes that are available will vary depending on what type of tool is selected (they're different for ZSketch).

    4. You can use [Sleep] with fractions of a second. However it is only active while the zscript is active. The active zscript is replaced as soon as the user loads a different plugin/zscript (for example, by using the [ ] to change brush size).

    5. You can use ShellExecute in a separate app to get ZBrush to load a zscript (a ZSC file). You need to pass in the full path to the ZBrush executable and the zscript file.

    HTH,

  4. #4

    Default

    Dear Marcus,

    [IGetTitle,Brush:Current Brush,1]
    is exactly what I was looking for! Thank you!

    I'm not sure yet whether ZB will talk directly to my app or send messages via micro files, but either way, with the name of the brush I can use IPress to select a brush when I need it.

    About
    ShellExecute,
    could you give me an example (in C++ or any other language)?

    Also, I have one more question: is there a way to create shortcuts composed of multiple keys, like the ones on the brush selection? Say, ctrl+alt+88 to set zIntensity to 88%, or something similar? And how can I use ISetHotKey to assign hotkeys for special keys like F1-F12, Alt+something, etc?

    Thanks again

    Sygnus
    Last edited by Sygnus; 04-17-12 at 08:06 AM.

  5. #5
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    8,687

    Default

    1. C++ ShellExecute example attached. Note that if you place the ZSC file inside the Pixologic folder (or a subfolder of this) then ZBrush will expect to find it in the default ZScripts folder and you'll get an error. Likewise, if you only specify a file name ZBrush will look in the ZScripts folder for the ZSC.

    2. You can specify key combinations such as Ctrl+'k' for hotkeys using the ASCII values (so Ctrl+'k' would be 512 + 107 or 619). You can get these values by saving out a hotkey and examining the StartupHotkeys.txt file in the ZStartup/Hotkeys folder.

    You can't use a hotkey to automatically set a value. You'd have to create a plugin button that set the specific amount and use the hotkey on that.

    HTH,
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •