ZBrushCentral

plugin UI states issue

Hello Marcus

I have an issue with startup routine that manage the uistates, mainly the swicths items. yes again :slight_smile:

To help you to understand the problem ,i had create a test plugin so you can see the exact problem i run through.

The plugin ui have 6 switches button.
It creates a memblock at the top level using the [memgetsize] like as it s common to do it.

The main Issue happen when switch from plugin to another, which force zbrush to reexecute the script entirely with the startup Routine.
The Switch doesn’t work correctly, i have to click twice before it get again responsive to my click.

From what i know we need to delete the memoryblock after we change the button state. but when i have the [MemDelete, p_uiSwitchesState] line uncommented
when i click on the switch it tell me ā€œThe Specified memory block couldn’t be found.ā€

so i always keep it alive, which is no good at all.

i let you few notes for feedback, so it’s easy to see the functioning, but the source for the bug is still invisible for my eyes.

you can dwl the plugin here :

Best Regards
Nicolas

Hi Nicolas,

  1. Your memory test name is missing the ā€œp_ā€ at the beginning, so that block never exists.
  2. You create the memory block from file twice, so when you get the result into ā€œtestmemā€ the block always already exists, so that always fails.
  3. You don’t need to delete the memory block.
  4. You don’t need to call the ā€œUIStateToFileā€ routine from within the Startup routine. It’s called from each switch which is enough.
  5. You call the ā€œStartupā€ routine from the end of the script which is the wrong place. It needs to be called before the interface is constructed so that the switch states are set correctly.

HTH,

  1. yes i notice that, it was a mistake when i had packed
  2. even when i just create the mem from the file, it
  3. yes i understood that during the night test , i must to keep the mem alive so we can access data.
  4. ok my bad ;x
  5. yes but it always tell me the interface could not be found ,even when the startup routine is possitioned before the UI.

With the script version you had fixed for me, it doesn’t work for me.
It works if I start a new zb session, and if i hot reload the plugin ( from another script )
like that :

[If, [IExists, "Zplugin:UIState Plugin" ], [IClose, "Zplugin:UIState Plugin"] ] [FileNameSetNext, "uistate_plugin.txt"] [IPress, "ZScript:load"]

I tested that with Zb to ps cc plugin because the plugins operate the same way with startup and uistate features.

I gonna pack you another version for you to see stay tuned :slight_smile:
and thank you a lot. Long time i try to fix that one but no success with it.

That version works if you start Zbrush , not by loading the plugin.
The problem is that plugin test is a skeleton of what i have and even on the toolset plugin i try to apply that, it still doesn’t work, and it bug even on new zb session.

This version also has an error in the memblock naming - the block created using MemCreateFromFile has a different name. So the switches memblock is not created.

I’ve no idea why the version I sent should give problems but I suspect you’ve got a conflict somewhere in your installation. I’d check what you’ve got in the ZPlugs64 folder. This method is the same as for many Pixologic plugins which generally work without problems. When they do cause problems it’s invariably because the user has an old version also installed, or some other conflict.

This version also has an error in the memblock naming - the block created using MemCreateFromFile has a different name. So the switches memblock is not created.

yes sorry i did that mistake again when preparing the zscript for you.
But actually even with that fixed, the script cannot found the switches.

pMO09io.png

i cleaned up the Zplug64 directory, removing all plugin which are not official.and deleted the zbrushdata directory and restarted zbrush. nothing is solving the issue i get.
but know you say that , i tested to remove my own plugins , which are a number of 6, and i can hot reload the uistate plugin now :wink:

i keep you posted about the progress on that , thx you Marcus :wink:

You might try changing the Startup routine test from:

[If,[IExists,ā€œZplugin:UIstate Plugin:Logoā€],

to:

[If,[IExists,ā€œZplugin:UIstate Plugin:Switch06ā€],

(So that the check is for the last switch of the interface.)

Alternatively, use a memory block instead:

[If,[MemGetSize,NK_StartupMem],

and create the memblock at the very end of the script:

[If,[MemGetSize,NK_StartupMem],[MVarDef,NK_StartupMem,1,0]]

i removed all other plugins, than i was able to understand why kind of conflict generated this issue.

that line in startup routine
[If,[IExists,ā€œZplugin:Matiere:About:Logoā€]

I have several plugins and all have this startup features
the issue is that one :
i use this same method :
[If,[IExists,ā€œZplugin:zIllustrator:About:Logoā€]

etc…
And that the source of the conflict
now i rename all logo button to ā€œPluginname_Logoā€ instead, make sure it check a button that has a different name.
Ffrom that i cleaned up a lot of stuff and follow a strict naming for my Memblock variables :slight_smile:

I had been able to fix 5 of 6 plugins already, it runs smoothly now, thank you a lot again for your precious help.

Glad you have solved the problem and that’s useful information, thanks for posting!

yeah that’s interesting, do you think it’s a bug, that IExists check the wrong button path ?
If you can report that to the dev team ?

I’ve noticed before that it’s not always necessary to use the exact path to things. This doesn’t only apply to zscripted items. In that respect, it is a bug. But there may be very good technical reasons for having it that way. I’ll look into it, and let the developers know if I find anything useful.