No random color
All  1-6  7-19

Previous
Next
 From:  Michael Gibson
4517.7 In reply to 4517.4 
Hi Pilou,

> About the palette
> something from a 2d prog like toshop who gives a palette of
> 100 colors (if 100 colors are needing)

Unfortunately that takes quite a bit of work to produce a UI for that kind of full Photoshop color palette management.

That's beyond what I can do in a few minutes with a script, you would need to develop something of that level of complexity on your own - I could try to help you out in some particular spots if you want to undertake it.

- 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:  BurrMan
4517.8 In reply to 4517.6 
Haaaaahahahaaa... That is cool!
  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:  Frenchy Pilou (PILOU)
4517.9 
Michael you rock again! Bravo!
I suppose there is no problem to give a negative increment
red - = 4 (if it's the syntax and take care of a last result less 0 :)

No problem about the toshop palette with your script i can yet make some crazzy gradients!

EDITED: 17 Sep 2011 by PILOU

  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:  Frenchy Pilou (PILOU)
4517.10 
And how apply these new gradients styles to the selection of Objects ? :)

I know for apply them as random mode but with these new gradients in normal mode?
(by Michael)
script: /* Assign random styles to solids */ var styles = moi.geometryDatabase.getObjectStyles(); var breps = moi.geometryDatabase.getObjects().getBReps(); for ( var i = 0; i < breps.length; ++i ) { var brep = breps.item(i); var style_index = Math.floor(Math.random() * styles.length); brep.styleIndex = style_index; }

Surely trivial but...
works only if number of objects <= numbers of styles
how make if numbers of object are bigger than the gradients and wanted cyclic result?
(of course i can reselect the no color objects and relaunch the script but... :)

something like this ? modification of the script above :)
script: /* Assign styles to solids */ var styles = moi.geometryDatabase.getObjectStyles(); var breps = moi.geometryDatabase.getObjects().getBReps(); for ( var i = 0; i < breps.length; ++i ) { var brep = breps.item(i); var style_index = i; brep.styleIndex = style_index; }

here nice result for the gradients'style!

EDITED: 18 Sep 2011 by PILOU

  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
4517.11 In reply to 4517.9 
Hi Pilou,

> I suppose there is no problem to give a negative increment
> red - = 4 (if it's the syntax and take care of a last result less 0 :)

Hmmm, I don't think that script was expecting for the numbers to become negative. You may need to add in an additional Math.abs( ); call to take the absolute value for that case, something like:

script: /* Make gradient styles */ var red = 12, green = 15, blue = 20; for ( var i = 1; i <= 100; ++i ) { var style = moi.geometryDatabase.addStyle(); style.name = 'Gradient ' + i; style.color = (Math.abs(red%256)<<16) | (Math.abs(green%256)<<8) | Math.abs(blue%256); red += 2; green += 3; blue -= 7; }

- 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:  Frenchy Pilou (PILOU)
4517.12 In reply to 4517.11 
Sorry for the complexification but now that is total control for generate gradient by hand ;)

EDITED: 17 Sep 2011 by PILOU

  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
4517.13 In reply to 4517.10 
Hi Pilou,

> something like this ? modification of the script above :)

Yup, it looks like that works, except the only problem would be if you had more than 100 objects the ones that were above the last style index will end up with the default first style applied to them instead, since that would be trying to assign them a style that does not exist.

So maybe you would want to wrap around to avoid that, something like:

script: /* Assign styles to solids */ var styles = moi.geometryDatabase.getObjectStyles(); var breps = moi.geometryDatabase.getObjects().getBReps(); var style_index = 0; for ( var i = 0; i < breps.length; ++i, ++style_index ) { if ( style_index == styles.length ) { style_index = 0; } var brep = breps.item(i); brep.styleIndex = style_index; }

This one when it reaches the last style it will start over at 0 for the next style after that.

- 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:  Frenchy Pilou (PILOU)
4517.14 In reply to 4517.13 
Works like a charm!
Total success!
Bravo!
here test with the default Styles modified the black one in yellow ;)
The 2 orange red on the bottom left side are just the new beginning as 100 is not dividing by 7 :)

EDITED: 18 Sep 2011 by PILOU

  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
4517.15 In reply to 4517.14 
Now you can create many candy models! :)

- 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:  Frenchy Pilou (PILOU)
4517.16 
Hello Michael
does your plug accept value like this red -=5.7 ? or it's truncated to 5 or 6 ?



EDITED: 19 Sep 2011 by PILOU

  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:  Mike K4ICY (MAJIKMIKE)
4517.17 In reply to 4517.16 
Neat spiral thing, Pilou... makes me hungry for gummmmy worms. :-)

  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
4517.18 In reply to 4517.16 
Hi Pilou,

> does your plug accept value like this red -=5.7 ? or it's truncated to 5 or 6 ?

I think that should work - the actual color value used will automatically get truncated to an integer value. Let me know if it doesn't seem to work right.

- 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:  Frenchy Pilou (PILOU)
4517.19 In reply to 4517.18 
All works fine when we enter decimal value so we have not to think when we make divide rgb color by number of styles :)

It's not very ergononomic but very efficient! :)

I have made a little tut ;)

EDITED: 19 Sep 2011 by PILOU

  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-6  7-19