blender-2.49


changing the color of object in blender


I did the following steps to create a new material and link it to the object:
Select an object.
In Button window (at bottom) select 'Shading' (a gray ball) and then 'Material buttons' (red ball)
In 'Link and pipeline', press 'Add new'.
Edit material color ('Col').
I want to change the color randomly using this script:
from random import random
import Blender
from Blender import *
scn = Blender.Scene.GetCurrent()
ob = scn.objects.active
m = ob.getData(mesh=True)
if(len(m.materials) < 1):
mat = Material.New('newMat')
m.materials += [mat] m.materials[0].rgbCol = [random(), random(), random()]
Blender.Redraw()
Why doesn't the color of the object change?
Because, random() returns a number between 0 and 1. I expect rgbcol must be between 0 and 255.
try this:
m.materials += [mat]m.materials[0].rgbCol(random()*255, random()*255, random()*255)
it is changing the color, (unless it has some other problem) but the effect is too small to be noticable.

Related Links

changing the color of object in blender

Categories

HOME
go
scikit-learn
twitter-bootstrap-3
polymer
fpga
github-for-windows
redux-form
rdbms
oracle-apex-5
gradient
appcelerator
alarm
tivoli
google-apps
angularfire2
nfs
flume
rcloud
accessibility
augeas
redis-sentinel
gruntfile
azure-iot-hub
null-pointer
dreamweaver
joptionpane
highstock
siri
mat
soot
alm
complex-numbers
utorrent
left-join
papaparse
gnat-gps
sharding
video-capture
parse-tree
git-rewrite-history
graphhopper
ideascript
password-protection
loading
resolution
odoo-website
laravel-elixir
android-ibeacon
optimizely
flask-restful
xbmc
openresty
opennms
identification
spring-data-couchbase
headless
testrail
simplepie
flex4.6
neon
nikeplus-api
nservicebus5
bizagi
nullable
spring-retry
computer-architecture
jdi
coda
visual-sourcesafe-2005
sha512
graphics2d
gamekit
delayed-execution
rapidsvn
theos
psr-4
xml-namespaces
gnumeric
scriptaculous
notorm
kendo-dataviz
oocss
rolify
fb.ui
iboutlet
thttpd
infobright
luabind
uipagecontrol
massive
inline-formset
cdonts
load-time
dot-emacs
openfaces
blender-2.49
request-headers
purepdf
cldc
todos
linfu-dynamicproxy

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App