1. #31

    Default hi

    a new button called StartupMacro ? where can i find it? Tks

  2. #32
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,462

    Default

    Quote Originally Posted by ChunniePark
    a new button called StartupMacro ? where can i find it? Tks
    If you followed the instructions at the start of the thread and saved the macro to the ZStartup\Macros\Misc folder and called the file StartupMacro.txt then it will be in the Macro palette.

  3. #33
    Member Follow User Gallery
    Join Date
    Feb 2013
    Location
    BC, Canada
    Posts
    43

    Default

    Quote Originally Posted by marcus_civis View Post
    Thanks. This seems to be an issue with the default zscript, not the macro. The default zscript is running twice for some reason. To stop it, open the ZBrush 4R4/ZScripts/DefaultZScript.txt file in a text editor and replace the contents with this code:

    [CODE]
    //startup
    [If,[MemGetSize,startup_mem],,
    [MVarDef,startup_mem,1,0]
    [IPress,Macro:Macros:Misc:StartupTest]
    ]
    [pd][/CODE]

    Let me know if this does the trick.
    Hey Marcus, I noticed you or whoever wrote the docs for this page used the same method:

    https://support.pixologic.com/Knowle...ve-max-threads

    I'd like to point out a couple issues though.

    The script on that page is written incorrectly, it has an extra comma after the ISet line, causing it to not compile properly. So the "Home" menu does not actually popup on start. Now if you fix it by removing that comma, there's another issue, the code will be re-executed if you open up the ZScript view at the bottom of ZBrush, and will continue to try executing. This can be solved by removing the code in the True return of the MemGetSize, but then, you can no longer press the "DefaultZScript" button up top to execute that startup code whenever you want, as that button's description says it's meant for.

    I believe the correct methodology that should be suggested is to be using VarDef and VarSet, instead of MVars, that way when you press the DefaultZScript button, that function can return false again and redo the code, but won't keep executing if the script window is opened, making it safe for production.

    [VarDef, defaultStartMem, 0]
    [If, defaultStartMem,,
    [VarSet, defaultStartMem, 1]
    //Execute your startup code
    ][pd]


    Last edited by Invertex; 04-18-18 at 02:32 AM. Reason: Cleanup, code example

  4. #34
    Senior Member Follow User Gallery
    Join Date
    Feb 2015
    Location
    Paris
    Posts
    263

    Default

    that works for me :
    [If,1,
    [IFreeze,
    //Your Startup Options
    [IPress,Material:BasicMaterial]
    [IPress,Tool:PolyMesh3D]
    [CanvasStroke,(ZObjStrokeV02n11=H3B6V14BH3B6V14CH3B6V14DH3B6V14 EH3B6V150H3B6V151YH3B6V151K1XH3B6V152H3B6V152H3B6V 153H3B6V153)]
    [TransformSet, (Document:Width*.5), (Document:Height*.5), 0, 100, 100, 100, 0, 0, 0]
    [IPress,Transform:Edit]
    [IUnPress,Preferences:Lightbox:Open At Launch]
    ]
    ]
    be careful with the Zstartup master plugin which make the DefaultZscript button on top of Zbrush ui to do nothing.
    Plugins & Toolsets for Zbrush 4R8 : zCycler Pro | Plugin Manager |Matiere 3d | Twitter | @Facelessmindz

  5. #35
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,462

    Default

    Hi Invertex,

    Thanks for pointing that out, I'll get it corrected.

    The point of using MVarDef is that the memory block persists, so that you can have code only run once per ZBrush session. Your code will run any time the script is reloaded, such as after another script or plugin has been run. (Your code is fine - this may be what you want.)

    The new DefaultZScript file I've written is:

    //startup

    [If,[MemGetSize,startup_mem],
    [IPress,"Zplugin:Misc Utilities:Home Page"]
    ,
    [IShowActions,0]
    [IConfig,2018]
    [MVarDef,startup_mem,1,0]
    [ISet,Preferences:Performance:MaxThreads,4]
    [IPress,"Zplugin:Misc Utilities:Home Page"]
    ]


    (I've left out the [pd] at the end because no code will run after the Home page button is pressed - control passes to the Home Page launcher script.)

    The issue you were seeing with the code running every time you opened the ZScript Window is I think because some commands were outside the [If, statement.

  6. #36
    Member Follow User Gallery
    Join Date
    Feb 2013
    Location
    BC, Canada
    Posts
    43

    Default

    Quote Originally Posted by f☺celess View Post
    that works for me :
    [If,1,
    [IFreeze,
    //Your Startup Options
    [IPress,Material:BasicMaterial]
    [IPress,Tool:PolyMesh3D]
    [CanvasStroke,(ZObjStrokeV02n11=H3B6V14BH3B6V14CH3B6V14DH3B6V14 EH3B6V150H3B6V151YH3B6V151K1XH3B6V152H3B6V152H3B6V 153H3B6V153)]
    [TransformSet, (Document:Width*.5), (Document:Height*.5), 0, 100, 100, 100, 0, 0, 0]
    [IPress,Transform:Edit]
    [IUnPress,Preferences:Lightbox:Open At Launch]
    ]
    ]
    be careful with the Zstartup master plugin which make the DefaultZscript button on top of Zbrush ui to do nothing.
    This code will always return true, so if you expand the ZScript menu at the bottom of ZBrush, you'll notice your script will execute again. This is not behavior most would want, especially if being used in a production setting. (though given the info below, in this particular case it won't because Lightbox ends up taking control)

    Quote Originally Posted by marcus_civis View Post
    Hi Invertex,

    Thanks for pointing that out, I'll get it corrected.

    The point of using MVarDef is that the memory block persists, so that you can have code only run once per ZBrush session. Your code will run any time the script is reloaded, such as after another script or plugin has been run. (Your code is fine - this may be what you want.)

    The new DefaultZScript file I've written is:

    //startup

    [If,[MemGetSize,startup_mem],
    [IPress,"Zplugin:Misc Utilities:Home Page"]
    ,
    [IShowActions,0]
    [IConfig,2018]
    [MVarDef,startup_mem,1,0]
    [ISet,Preferences:Performance:MaxThreads,4]
    [IPress,"Zplugin:Misc Utilities:Home Page"]
    ]


    (I've left out the [pd] at the end because no code will run after the Home page button is pressed - control passes to the Home Page launcher script.)

    The issue you were seeing with the code running every time you opened the ZScript Window is I think because some commands were outside the [If, statement.
    Hi Marcus, there was no code outside of the conditional. There seems to be a deeper issue here with how the DefaultZScript file is being handled. Your code works if calling that Home Page button, which you mention is taking control after, so that is shining light on the issue here. I guess by default, ZBrush is not passing control off after the DefaultZScript runs, and thus it will continue to be there to execute when certain interface features are interacted with.

    If I swap out the Home Page IPress in your example with a simple material change:

    [If,[MemGetSize,startup_mem],
    [IPress,"Material:NormalRGBMat"]
    ,
    [IShowActions,0]
    [IConfig,2018]
    [MVarDef,startup_mem,1,0]
    [ISet,Preferences:Performance:MaxThreads,4]
    [IPress,"Material:NormalRGBMat"]
    ]


    Then the script will result in the behaviour I mentioned, executing whenever the ZScript console is opened, which I assume now is because control is no longer passed to anything else? This is unexpected behavior that isn't really explained. And I'm not aware of any commands that can tell ZBrush to "unload" the current script, as far as I know you'd have to set next file name to some blank script and call a load on that instead. Is there something we can call to pass control that the user wouldn't actually see, nor change any settings?

  7. #37
    Senior Member Follow User Gallery
    Join Date
    Feb 2015
    Location
    Paris
    Posts
    263

    Default

    when I tried to download the file from support website, it was impossible to download it, it works now, I can finally see what you expected.
    But anyway, I don't get the point with your not good for production argument.
    sorry but what kind of second behavior you want the defaultZscript button to have after the if you click on it after the session has started ?
    1. at session start, the script setup some option for you .
    2. click again after the session start, if you want to reset the zbrush environment even if this do not erase tools which are stacked in the tool panel like it would if you press init zbrush.
    the only thing is that you want to have the homepage script to popup at startup but not if you press the default script button.
    IF yes then my method is not correct, but I safe for production as the code don't retry endlessly to execute it. it will always return True, and for that reason I prefer to use my method, as I just prevent Zbrush to create persistant mem block when I don't need that.
    Also it better to have a naming convention for memblock naming, generic name can collide with other plugin which also create memblock at the startup process.
    Plugins & Toolsets for Zbrush 4R8 : zCycler Pro | Plugin Manager |Matiere 3d | Twitter | @Facelessmindz

  8. #38
    Member Follow User Gallery
    Join Date
    Feb 2013
    Location
    BC, Canada
    Posts
    43

    Default

    Quote Originally Posted by f☺celess View Post
    But anyway, I don't get the point with your not good for production argument.
    sorry but what kind of second behavior you want the defaultZscript button to have after the if you click on it after the session has started ?
    1. at session start, the script setup some option for you .
    2. click again after the session start, if you want to reset the zbrush environment even if this do not erase tools which are stacked in the tool panel like it would if you press init zbrush.
    the only thing is that you want to have the homepage script to popup at startup but not if you press the default script button.
    IF yes then my method is not correct, but I safe for production as the code don't retry endlessly to execute it. it will always return True, and for that reason I prefer to use my method, as I just prevent Zbrush to create persistant mem block when I don't need that.
    Also it better to have a naming convention for memblock naming, generic name can collide with other plugin which also create memblock at the startup process.
    I think you are completely missing the point in my last post. I can already get the intended behavior I want by using a regular Var instead of MVar, I said this in the beginning, this is not the issue. I don't want the Homepage menu either. The issue, like I explained in the previous post, is that if your startup script does not call something that forces a different script to load, such as Home Page does, then the Startup script never gets unloaded, and thus will be repeated any time the ZScript display is opened. I'm pointing out behaviour that goes against what you would expect the script to do, which is to run, and then unload itself, only reloading when you press the DefaultZScript button.

    I believe you are not understanding the issue, because the issue exists even with your script. I will show you a video of what I mean and why I said it is not "production safe" if your code can do things that might mess up a user's work.

    https://i.gyazo.com/353422be5fdf1dd9...ead26a4972.mp4

    This is your script exactly. ZBrush launches and the star is there. But see what happens when I "accidentally" click the ZScript console expansion at the bottom? Your script runs again and tool is set to Star again, even though I did not click the DefaultZScript Button. So surely you can see how, depending on what a team is doing in their startup scripts, this could easily lead to losses of work.

    The key point here is that this does not happen in the documentation example, because in that example, calling the "Home Page" causes a different script to be loaded, preventing this issue from happening, but most people would not know that it works specifically because of that Home Page IPress. I'm saying that this behavior should be documented and now asking if there is some other, more clean method to "unload" our script after it runs without having to bring up the Home Page or load some other script file.

    (also I do use my own memory names... But we're discussing the example here, so I stuck with the generic names to avoid any confusions)

  9. #39
    Senior Member Follow User Gallery
    Join Date
    Feb 2015
    Location
    Paris
    Posts
    263

    Default

    yeah I totally misunderstood the issue sorry.
    if you want it to work with a varset then you can try out that

    //startup
    [VarSet, zbTime, [ZBrushInfo, 2]]
    [If,( zbTime <= 15.000 )
    ,//cmds
    [Note, "a New Zbrush Session starts...",,.1]
    ,//else
    [Note, "do nothing",,.1]
    ]

    here if it check the Ztime info from the top title bar, and if the returned value is less or equal to 15 seconds, then it mean the Zbrush startup a new session.
    if the value is bigger, then I run the second part of the if condition.
    my personal opinion about all that is that Zbrush should use two different scripts
    one for the startup , one else for the script console.
    there is no bug, or any issue its just normal behavior, but it make me confuse a lot as yesterday the example code wasn't unavailable and my personal defaultscript.txt has that issue, that prevent to execute the second condition when pressing the Default script from the top menu.


    Plugins & Toolsets for Zbrush 4R8 : zCycler Pro | Plugin Manager |Matiere 3d | Twitter | @Facelessmindz

  10. #40
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,462

    Default

    Hi Invertex,

    Many thanks, I get the behaviour you describe with your code. (I'm not sure why I didn't see it before but I'm not going to spend time trying to find out...)

    The behaviour is not restricted to the DefaultZScript. Moving the ZScript Window divider will reload the current zscript, whatever that happens to be. In the normal way this won't affect the user; only if the current zscript runs code on loading. So, for example loading a zscript with:

    [If,1,
    [Note,"Hello World",,1]
    ]


    will display the note every time the divider is moved.

    I think this behaviour is left over from early versions of ZBrush when there were no plugins and zscript was used mostly for tutorials. If I ever knew about the behaviour I'd certainly forgotten.

    There's no way to simply unload a zscript, that I know of. So, apart from loading a second zscript, the best way I can think of is to specify behaviour for only when the DefaultZScript button is pressed, so that moving the divider does nothing:

    [If,[MemGetSize,startup_mem],
    [If,[IGetID,DefaultZScript]==[IGet,Preferences:Utilities:View Window Id],
    //code to run when DefaultZScript button is pressed
    ]
    ,
    [MVarDef,startup_mem,1,0]
    //code to run once at startup
    ]

    [PD]



    HTH,

  11. #41
    New Member Follow User Gallery
    Join Date
    Jan 2019
    Posts
    2

    Default

    sorry yet what sort of second conduct you need the defaultZscript catch to have after the in the event that you tap on it after the session has begun ?


    1. at session begin, the content setup some choice for you .


    2. click again after the session begin, on the off chance that you need to reset the zbrush condition regardless of whether this don't delete devices which are stacked in the instrument board like it would in the event that you press init zbrush.


    interestingly, you need to have the landing page content to popup at startup yet not on the off chance that you press the default content catch
    Bluestacks Kodi Lucky Patcher .


    In the event that truly, my technique isn't right, yet I alright for generation as the code don't retry unendingly to execute it. it will dependably return True, and therefore I want to utilize my technique, as I simply avert Zbrush to make persistant mem square when I needn't bother with that.

  12. #42
    New Member Follow User Gallery
    Join Date
    Mar 2019
    Posts
    1

    Default

    @rossi Thanks mate, worked for me! 9AppsCartoon HDVidmate

  13. #43

    Default

    Hi guys. Tried this startup code. And it doesn't open zproject.
    [If,[MemGetSize,startup_mem],
    [If,[IGetID,DefaultZScript]==[IGet,Preferences:Utilities:View Window Id],
    //code to run when DefaultZScript button is pressed
    [FileNameSetNext,"ZBRUSH_\ZProjects\START.ZPR"][IPress,File:Open]
    ]
    ,
    [MVarDef,startup_mem,1,0]
    //code to run once at startup
    [FileNameSetNext,"ZBRUSH_\ZProjects\START.ZPR"][IPress,File:Open]
    ]

    [PD]

Page 3 of 3 FirstFirst 123

Posting Permissions

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