Custom UI : what is the html code for the Scene Browser "Styles" tab ?
All  1-2  3-5

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

 

 
 
Show messages: All  1-2  3-5