tonight i made a dirty script for bringing the r,g,b values from 2d programs like psp etc. to blender with equivalent r-g-b values.because you all know that 2d programs use max 255 stages of r,g,b values where blender does 1000.so if you want to bring the exact r,g,b values from an image tp blender you have to do some manual calculations.to avoid that i made the script.i know…i know it’s very easy…but hey it contains buttons too.so does it worthwhile to upload for you? :-?
Sounds great… I’m terrible when it comes to calculating things manually. Any help in exacting my 3D work is much appreciated!
If you run Linux here is a usefull one-liner for you to get the rgb-values of a color you know the name of. Just put it in a file (I call it rgb), make it executable (chmod a+x rgb) and put it somewhere in your path. Example: rgb tan
#!/bin/sh
showrgb | grep $1 | awk '{ printf("R: %.6f G: %.6f B: %.6f %s %s %s %s
",$1/255, $2/255, $3/255, $4, $5, $6, $7)}'
EDIT: Forgot to mention: you need showrgb installed (should come with your distribution)
Actually they use 256 stages of a color because you have to take ZERO into consideration ( 0 to 255 = 256 levels). Did you take that into account in your script?
yeah zero too…i was in hurry.but any help on when select a mesh its corresponding materials are also selected in python.it would have eased my task.
import Blender
MatList = []
ob = Blender.Object.GetSelected()
if ob:
if ob.data and ob.data.block_type == "NMesh":
MatList = [Blender.Material.Get(mat) for mat in ob.data.materials]
that should work
or, if you’re a fan of beautifully compressed code, you can try:
import Blender
MatList = [[Blender.Material.Get(mat) for mat in ob.data.materials for mat] for ob in Blender.Object.GetSelected() if ob.data and ob.data.block_type == "NMesh"]
Martin
hot damn!
ever since i first saw blender’s 0.000 to 1.000 and everything in between colour system, i’ve though “how hard would it be to make a little script to convert these values to the 0-255 values that i recognise?”
lazy boy that i am, it’s taken me two years to not do it, and you’ve now saved me the trouble.
cheers
BEAT