Custom UI : what is the html code for the Scene Browser "Styles" tab ?

Next
 From:  pior (PIOR_O)
10119.1 
Hello Michael and all,

I am currently working on refining my custom UI but I hit a roadblock. I'd like to make the Styles tab (from the Scene Browser) live in its own little popup, that I could call with a shortcut similarly to this tool search/filter box I've put together a little while back :



FWIW The code to call this kind of popup from a shortcut is :
moi.ui.createDialog( 'moi://appdata/xxx/index.html', 'resizeable', moi.ui.mainWindow );

And then the index.html file can hold any content - both regular html and moi-specific commands.

Digging through the commands folder I see references to the various elements of the scene browser but I am unable to piece together the bits that would make a functionning Styles panel, so I suppose I must be missing some dependency somehow. And ideally I'd like to consolidate the code into one single html file for easy edits too. The goal being to be able to call this little panel from a shortcut and having it be a popup :



Many thanks if you can help !

EDITED: 20 Jan 2021 by PIOR_O


  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10119.2 In reply to 10119.1 
Hi Pior, the scene browser is implemented as one big custom control that is placed using a <moi:SceneBrowser> tag in HTML.

All of its internals like populating and updating the different sections and handling events and such are all implemented by code inside moi_lib.dll . It's not set up to have just one portion of it yanked out and placed somewhere else so what you are describing isn't very feasible, sorry.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  pior (PIOR_O)
10119.3 In reply to 10119.2 
Hello Michael -
I see, and that probably explains why I was having a hard time extracting it, so to speak. Thank you for the explanations as always :)

On that topic, are there any shortcuts/commands related to the Styles tab ? Like for instance to put the current selected objects inside a given color layer, and hiding/unhiding a Style altogether. This could be very useful for quickly turning off construction guides I believe.

EDITED: 21 Jan 2021 by PIOR_O

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10119.4 In reply to 10119.3 
Hi Pior,

re:
> On that topic, are there any shortcuts/commands related to the Styles tab ?

Yes there are several ways that scripts can access and modify style data.


> Like for instance to put the current selected objects inside a given color layer,

That would go like this:

script: var style = moi.geometryDatabase.findStyle( 'Green', true /*CreateIfNotFound*/ ); moi.geometryDatabase.getSelectedObjects().setProperty( 'styleIndex', style.index );


> and hiding/unhiding a Style altogether.

That's done by hiding/unhiding objects that have a given style index, like this:

script: /* Hide objects with style = Green */ var style = moi.geometryDatabase.findStyle( 'Green', true /*CreateIfNotFound*/ ); var objs = moi.geometryDatabase.getObjects(); for ( var i = 0; i < objs.length; ++i ) { var obj = objs.item(i); if ( obj.styleIndex == style.index ) { obj.hidden = true; } }

script: /* Show objects with style = Green */ var style = moi.geometryDatabase.findStyle( 'Green', true /*CreateIfNotFound*/ ); var objs = moi.geometryDatabase.getObjects(); for ( var i = 0; i < objs.length; ++i ) { var obj = objs.item(i); if ( obj.styleIndex == style.index ) { obj.hidden = false; } }

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  pior (PIOR_O)
10119.5 In reply to 10119.4 
Hello Michael -
That worked beautifully, as always ! I find myself using only one or two Styles beyond the default Black (to store a few sketched lines and templates) so all I had to do was to assign a few hotkeys. This is working great, thanks :)
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All