Halloween Costume ideas 2015
Articles by "group"
@dorothiar #arttips #interview 101 2 Column Template 2012 mentee 2013 2013 mentee 2014 2014 mentee 2014 Portfolio Winner 2014 SCBWI Portfolio Mentorship Winner 2015 mentee 3 Column Template 360 3d 3d print 3d printing 3delight 8bit Abbey McCulloch abstract acryla gouache acrylic action addon adobe Adobe Flash CS3 Adobe Illustrator Advanced Tutorials advection Advertising advice Agata Wierzbicka agents airplane Al Wiseman ALA Alan E. Cober Alan Lee Alex Ross Alexandra Compain-Tissier Alexandra Lekias Alexandra Levasseur Alexandre Korobov Alexis Winter algorithm alien ALT Amelie Hegardt Amit Shimoni amusement an Ana Aranda analog Andrea Hrjnak Andrea Hrnjak andrea offermann andreaoffermann andreazuill Andy Musser Angela DiTerlizzi Angelika Peißker animal logic animals animation animation nodes anime anisculpt Anja Kroencke Anna Higgie Anna Jensen Anna McKay Annabel Briens AnneBerry Anneke Krull Annu Kilpeläinen anstudy anthology António Soares ar arduino area armature arrange array array modifier arrow art art director art directors Art is fun! art reps art tools Artaksiniya arthictecture arthur rackham artists artwork ase Ashlyn Anstee Asian aspiring asset atom attribute attribute transfer audio Audrey Kawasaki augmented reality aurasma Aurelius Battaglia author illustrator automatic automation Autumn Whitehurst avatar Avrom Yanovsky AW14/15 award awards Babeth Lafon Babies baboon Baby Love Background background color bacteria bake baking ball Bamboo banner Banner images banner making Barbara Dziadosz barcode basic bbox beads beats Bec Winnel beginner Bel Johnstone Ben Denison Bernie Fuchs Berto Martinez Beth Krush better photos bge Bijou Karman Bike biscuit bishop black and white black and white art Blair Breitenstein blam blender blender game engine blender3d blending Blinkie Blinky blob blocks Blog Tips blogger Blogging Friends blogs Blonde blur effect in pixlr and photoshop blur images and pictures bmesh bmesh viewer bolognaragazziaward bombing bone bone modeling bones book book launch books boomerang bottle bounding box bowl bpy brian eno brian ormiston Brian Sanders brian won brick bridge Bridget Davies bright Brooke Boynton Hughes build modifier building burns business Buttons bvh cage Caitlin Shearer caldecott calibration camera camera settings camera tips Candle capcom card career Carole Wilmet cartoony Cassandra Rhodin cast Catherine Campbell Cecilia Carlstedt cell center pivot centipede cg cg photography chair challenge Chanel changin color in pixlr changing color chaos character Character Bible character development charcoal charles Charlie Dot Charlie Hebdo Children children's book illustration chocolate Christina Drejenstam christina forshay Christina K christinaforshay Christmas Cindy Derby circle circle dance city cityengine clock clones cloning cloth Cloud based clover CMYK Coco Chanel Cody and the Fountain of Happiness coffee collect collection Collections collision color color balance color cast color correction color mode color study colorful Commercial Use complexity component compositing composition computational thinking computer concept art Condensed Posts conference connect connect the dot connection Connie Lim Conrad Roset constrain constrast contagion content Contest contracts control converter copy copyright Corinna Luyken count Courtney Brims crack Craft craftsmanship Craig & Karl creative creativity creature cricket Cristina Garcia Martin critic criticism critique Crop Crop Tool cross section crowd csv cubism curve curve modifier custom Custom Blog Design Custom Blog Design Tutorial Custom Blog Designers Custom Illustration custom properties Custom Signature custom xml cut cutting plane cycle cycles dae Damien Florébert Cuypers Dan Hillier dance Daniel Egnéus Daniel Segrove Danny Roberts Daren Newman Dasha Tolstikova data data path David Blossom david diaz David Shrigley David Stone Martin Dean Hardscrabble Debbie debbie ohi debbieohi deform deformer degrees deleting background in pixler demo demoscene desaturation of images design design by numbers design process Design Tips dictionaries dictionary Different Text Writing in Pixlr digital digital paint Digital Scrapbook Freebies Digital Scrapbooking disk distance distractions distribute diversion DIY DIY Contest Dolf Veenvliet Doll Doll Bones dolls domino domino effect doodle Doodles door doraemon Doris Jackson Dorothia Rohner dots dpi draw drawing drill driven driver drivers dual versions dummy duplicate duplicates duplication dupliframe dvd dynamic dynamic paint dynamic text E Simms Campbell Easy easy pixlr Easy Tutorials Ed Graham Ed Vebell editing editing photos editors education effect effects ego Eleanor Dalton electric Elia Fernández eliza wheeler Elizabeth Mayville elizawheeler Emily Forgot Emma Zanelli emoticon happy-face Emotional storytelling empathetic characters empty entoforms envy epicycloid EPS Illustration Epson scanner erasers Erin Armstrong Erin Petson erinoshea ernest shepard Esra Roise euler evaluate line Eveline Tarunadjaja evenly spacing vertex event everywhere door exhibition Expandable Posts experiments explode exploded view export expression extrude eye eye color in pixlr eye trick eyeball face rig facial expressions facial setup factory Faiyaz Jafri Families fashion illustration fashion week fcurve feature Featured Fee Harding Feedback fence Fernanda Guedes fibonacci Fifi Lapin file File Types Finalists Finding Nemo fire fix photos Flash Tutorials flicker flip flip flop floor flop flow flower Flowers fnmatch focal point follow up font Fontaine Anderson Fonts food footage For Sale force form formula fractal fracture frame Frames Francois Berthoud Frank Bellamy Frank Furlong Franklin McMahon freckles Fred Steffen FrederiqueBertrand Free for Commercial Use Free for Personal Use Free Stock Photography Free transform tool Freebies Frenchillustration Fritz Siebel frosted mylar fruit ninja Fumi Mini Nakamura Fun function futurism FW2017 fx Gabriel Moreno Gabriella Ibarra game game animation gameart gamma gangnam style Garance Doré Gary Fernandéz gel medium generate generative generator geometric geometry Gerald Lazare Géraldine Georges GIF Gildo Medina Girl Giuseppe Castellano Giveaway glorar goals golden ratio google google docs Google Tools Grant Young graph graphite graphite transfer grease pencil grid group group node growth Gucci Guest Guil Godier gustave dore hair handbook Harper's Bazaar harpercollins Harvey Schmidt Haute Couture head Headers heat map Helena Hauss hexagon hexagonal grid Hiroshi Mizuno Hiroshi Tanabe Holiday Holly Black homology honeycomb hook horror houdini how to how to blur a face or an object in pixlr How to change eye color how to delete an object how to desaturate an image how to edit a image in pixlr how to erase an object how to fix red eye problem how to fix red eyes in pixlt How to fix the parts in pixlr in photoshop How to make a banner in pixlr How to overlap the nevus how to remove a object How to remove an object in pixlr how to remove red eyes How to Remove the Background of an Image in Pixlr How to remove the parts that you don't want in pixlr and photoshop how to replace color How to write a Patterned Text in Pixlr how-to Hsiao-Ron Cheng hsv hue humor Hyshil I love illustration magazine idea ideas Igor+André illusion illustrating illustration illustration board Illustration Books Illustration Intensive Illustration Now! Fashion illustration process Illustrations Illustrative Berlin illustrator Illustrator Intensive Illustrator Tutorials iloveillustration magazine image ediditing lessons Image Ready image sequences image theft imaginative import import text import vertex color improving photos inbetween index visualizer Info Ingrid Bockting ink inktober input Inspiration inspirational quotes install instance instance switching intensive interaction Intermediate Tutorials internet interoperability interpolation intersect intersect edges intersecting intersection interview introduction invoke subprogram io ipad Irana Doucer Isabella Hemmersbach islam islamic iteration Izzie Klingels Jack Hearne Jack Tremblay James Dignan James Gurney japanese Jason Brooks Jean Kim Jeanne Detallante Jen and Chris Creed Photography jen betton Jen Rofé Jenny Mörtsell Jeremy Combot Jeslyn Kate Jesse Auersalo Jessica Jessica Lanan jessicalanan jewellery jewelry jiggle Jim Schaeffing Joe Bowler Joe Cleary Joe Isom Joe Krush Johanna Goodman john maeda John Vernon Lord joint Jordan Sondler JPEG JPG jpop juana martinez-neal juanamartinezneal Judge Judit Garcia Talavera Judith van den Hoek Judy Byron Schachner Jules Julien Julian Beever Julie Verhoeven Jump Break Tool JW Anderson K-Fai Steele Kaethe Butcher Kareem Iliya karel zeman Kate van Harreveld Kathrin Kuhn Kathryn Ault Noble Kathryn Noble Katie Kath kdtree Kei Meguro Kelly Beeman Kelly Light Kelly Smith kelly sonnack Kelly Thompson keyframe keyframing kidlit kidlitartists kimberlygee Kirkus Review Kisoo Chai Kodak Konstantin Kakanias Korean illustration Kotaro Chiba Kozue Himi Kremos Ksenia Finogeeva KT Smail kuler Kustaa Saksi Lanan Laptop larry gritz lasso tool latte lattice Laura Callaghan Laura Laine Lauren Rille layer layering Layla Holzer layout leaf learning learning blender LED Leendert meets Ingrid lego length Leonard Starr lessons levels LFW A/W 14 liangzhu liero lightbox lighting lightning Lina Bodén Lina Ekstrand Linda Dorn line line connect line drawing lines Links Linky Love Linn Olofsdotter Lionel Gilbert Lisa Anchin Lisa Billvik Lisa Krannichfeld lisaanchin lisbeth zwerger Liselotte Watkins list list comprehension List First Last listing locator lofting logo Logo Design Lola Dupré London Fashion Week loop looping loops looptools Lorraine Fox lossless lossy lost weekend lostweekend lotte reininger Louis Glanzman louis vuitton Luciana Rondolini luciograph LULU* lv Lynnie Zulu Mac macgyver macouno maeda Magda Antoniuk magic Magnus Voll Mathiassen mailing mailings maker Makiko Sugawa making banners Malika Favre MAMP mandala manga map map range maplelam mapping Marcel George Maren Esdar Margot Macé Margot van Huijkelom Maribeth Olson Marie El-Ahmar Marilyn Conover Marina Esmeraldo Marine Marbleindex mario Marlies Niemeijer Marsha Riti Martha Rago Martin Krusche Martine Johanna mask masking material materials math matrix matrix apply matryoshka Matt Baker matte medium Matthew Woodson maya maze mdd Meagan Morrison measure megaman Megan Hess Meizhen Xu Mel Crawford memory mentee mentees mentors mentorship program Mercer Mayer Meridth McKean Gimbel mesh mesh cutter meshlab Meta Tags metal gear rising Meyoko Mia Overgaard Micca mice Michael Sanderson Michela Picchi middle grade midi miku Milan milipede minidom Minima Mio Matsumoto mirror cut Misc Miss Blackbirdy miss maple's seeds Miss Take Mitchell Hooks mixamo mixing Mobile Apps mocap mod model modeling modifier modular modulation modulus mold molecule molly idle Molly Ruttan Molly Ruttan Illustration money monitors monkey mono-zero monster monster university morph morpher mosaic mosquito motion motion capture motion capture mouse motion trail moto360 mountain muji Muriel Wood Murray Tinkelman mushroom Music and Podcasts My dead pony Nadia Flower Naiad Einsel Naja Conrad-Hansen Natalie Brockett Natalie Foss nathan vegdahl nautilus Nav Bar navigation needle-felting negotiating Neil Boyle neon nescbwi14 nested New Blogger Questions New Blogger Template Tutorials new user pixlr new year new york New York Fashion week Newbery nicholas nicholas bishop Nicholas Hong Niki Pilkington Niso Ramponi nla No Software node node-based nodebox noise non linear animation Non-Web Font normal Noumeda Carbone npr number NURBS NYFW object object color change object info octopus offset Ola Volo Olaf Hayek old formats opaque projector open movie open shading language open source openshadinglanguage opensoundcontrol optical organization origami original art show Ornaments osc Oscar Schlienger osipa osl outline outliner output Pages paint paint weight painting painting on illustration board painting on wood painting with movie painting with numbers Pair pandas panorama Paper paper lantern parabola parametric parent parenting particle particle info node particles pat david Pat Zietlow Miller pattern Patterned Text Paul Faassen Paul X. Johnson Paula Sanz Caballero PC pdb pebbles pencil Pencil Sketch pencils Penguin perfume perlin Peter Helck Photo CD.8B photo editing software Photo Reference Photobucket photographing art Photographs photography photomerge photoshop Photoshop Brushes Photoshop CS3 Photoshop elements photoshop pixlr desaturaion Photoshop tips Photoshop Tutorials Picture Book Builders picture books Pierre Louis Mascia Piet Paris Pietari Posti pingpong pinnochio pipes pixar pixel pixel art pixel generator pixlr Pixlr advanced Pixlr blog pixlr desaturate keep a colorful part pixlr editting pixlr express Pixlr forum Pixlr free transform Pixlr Lesson Pixlr lessons Pixlr mobile Pixlr resizing images pixlr shortcuts Pixlr tools pixlr tutorial pixlr tutorial with pictures Pixlr Tutorials pixlr white black pixlr.com plant plot plotting ply PNG PNG Illustration podcast point point color pointilism polka dots polyCut polygon Pomme Chan pop-overs portfolio Portfolio award portfolio showcase portfolio-advice portrait position Post Dividers postcard poster Posting pot powdered graphite powerhousemuseum Prada presentation print printmaking Prize procedular procedural process processing programming projection Promotion property prototype PSD psy publishing pulse puppet puppetry pydriver pydrivers pyhandler pyhandlers pyramide python quad quick select set quick tips qumarion Rabbit Moon Rachel Ryle radians radius ramp random random motion randomization randomize range float raspi Ray Houlihan reading reading XML READY-TO-WEAR realflow Rebecca Clarke rebecca dautremer Rebecka Skog rebuild recursive recursivedrawing red eye remove reducing glare reference referencing release remesh modifier remix removal remove remove red eyes remove unwanted objects Removing backgroung render rendering renderman repeat repeater repeating replace replacement replacing color representation rerouter resample resampling research Resizing image resolutions retopology retro review revolve rgb rib Ricardo Fumanal Richard Scarry rig rigging rigify Rikke Jorgensen ring ripple roadkill Robert Heindel Robert J. Lee Robert McCloskey Robert Shore Roberta Zeta Robin Rosenthal robot robotic rocks Rodolfo Montalvo Roller Coaster rotation Rousseau rsl Rubin Pfeffer ruler tool Russ Mills russian rut S/S14 S/S15 S/S16 Sabine Pieper sadako Saftey Pins Sainte Maria Sale Sam Weber Sanda Suy Sandy Kossin santoso Sara Andreasson Sara Singh Sarah Jacoby saturation artist tools scan scanners scanning scatter scbwi SCBWI 2015 mentee SCBWI conference scbwi germany SCBWI mentorship scbwi-la scratch scratchboards screensaver screw screw modifier script scrub sculpting seamless Seamless Patterns Search Engines select by material select by name select by type SEO sequence series set keyframe set keyframes shader shading shadow Shannon Stirnweis shape grammars shape key shapekeys shapes shards shatter Sheilah Beckett shell ship shipping shipwright Shoes SHOWstudio shuffle Sid Barron Sidebar Titles Signature Silja Goetz silkworm Simon and Schuster Simon Varela simple simplicity simulation sine Site Engine Optimization Sjoukje Bierma sketch Sketches sketching skin skin modifier skinning slice slicing slides sloth slow parent smoke smoothstep SN snake Sneek Peek snippet Snow Snow White Snowflakes soccerball social media Social Media Buttons Social Networking society of illustrators Society6 soft body softbody Sonia Menti sound sound wave space spaceship sparta special spider spiderman spiderweb spin spiral Spiros Halaris Spiros Halaris x Urban Decay spline Spot Healing Tool spreadsheet SS16 stack stacking stair stamp Stan Galli star starfish stencyl step Steven G. Dobson still Stina Persson stone stones storytelling strand strand info strands street art string stripes structure studies studio style stylistic summary Summary Posts Summer sun supplies surface Susan Farrington suzanne Suzanne Kaufman sverchok swatch switch sydney system table table of contents take out background Tal Drori tangent tangled Taschen teaching teapot Template Templates tentacle Tess Jacobson Tex Avery text text editor Text Formats Text Styles in Pixlr texture texturing The Cartorialist The Grudge Keeper The Purple Book thinker1 Thomas B. Sawyer thread TIFF tile tilecam tiling time time code Tina Berning Tina Kugler tips tips for artists Toby Neilan Tom Baxter Tom Bjarnason tombow tomie depaola tool tools topology tower Tracy Turnbull Train transfer drawing transferring sketch transform transformation transit travel triangle wave Tricia Springstubb trigger tris tristan lock tube tubes Tutorials twitter type tool typeface typography unbake unity3d universal unquad utah uv valentine Valentino Valerie Servais vanilla variable variation variety vase vector vectorized Velwyn Yossy venus Veronica Ballart Lilja vertex vertex color vertex group vertex paint vertex weight VFX Victoria Boysen video Videos viewer Vintage virtual virtual studio visualization vivid vividfestival VOGUE volumetric voronoi Vote voxel voxelated voxelation walking teapot Walter Einsel wand tool water soluble graphite watercolor wav wave we need diverse books web webbing Week Themes weight welcome Wendy magazine Wendy Plovmand what casues red eyes What is Pixlr Wherever You Go Wide Awake Bear wiggle Will Davies Winner Winnie Fitch Winnie Truong Winter wire wired wireframe wolfram Woman wood woodwork wool wooly wordpress work workflow World writing writing XML www.pixlr.com XML YA yayoi kusama Yelena Bryksenkova yoda Yoko Furusho Yuliya zaha hadid zen zsphere

In many scripts we wrote so far, we may have been creating a bunch of objects without thinking about how we could access them again in the future for further processing. It is my bad, I should have thought about that earlier.

Although we may have named the objects nicely like: Object.1, Object.2, Object.3, etc OR Object.001, Object.002, Object.003, etc, and we could probably select the objects again by name or by pattern, maybe it is a good idea to start to put them in Group.

I think, there is probably a more Pythonic way to store Group that can be accessed later (even after the file is closed), but I think Blender Group is a nice place to internally store list of objects.

We all know Blender has quite a nice Group system that will work between Blender scenes.

Objects linked to the same Group is also easily selectable whenever we do Select by the Same Group. I usually select an object and then Shift+G and select Group:


Grouped objects are also easily seen as list from the Outliner:


Let's take a quick look on how we can group objects and some basic Python way to group and link objects.

BEFORE CHECKING GROUP... LET'S CREATE AN ANIMATION

I am going to do a quick step by step exercise on keyframing and animation again. In previous post, I think I have been going too fast with Blender Python and keyframing.

I always start with Blender default scene, so you can follow along. Understand every steps so that you know which block of codes you will need next time if you want to copy paste or if you want to undo and re-run part of codes.

For step 005 for example, you can choose the one you like.


import bpy
import random

# 001 Hide default Camera and Lamp

bpy.data.objects['Camera'].layers[1] = True

bpy.data.objects['Lamp'].layers[1] = True

bpy.data.objects['Camera'].layers[0] = False
bpy.data.objects['Lamp'].layers[0] = False

# 002 Select and delete default Cube
bpy.data.objects['Cube'].select = True
bpy.ops.object.delete(use_global=False)



# Create a single material that respect Object Color
mat = bpy.data.materials.new('MyMaterial')

# 003 Create a bunch of new Cubes (should we give them material? yes, let's give one material to all)
totalCube = 25
cubeSet = [] 

for number in range(totalCube):
    bpy.ops.mesh.primitive_cube_add(location = [0, 0, number])
    selectedObject = bpy.context.selected_objects
    mesh = selectedObject[0]
    mesh.name = 'MyCube.%s' % number
    mesh.scale = 0.45, 0.45, 0.45
    
    # Keep our newly created cubes in Set
    cubeSet.append(selectedObject[0])
    
    # Apply our special Material
    bpy.context.object.data.materials.append(mat)


# 004 Set keyframes for Position XYZ value at Frame 1 and 10 (to hold position) for every cubes
for cube in cubeSet:
    cube.keyframe_insert('location', frame=1)
    cube.keyframe_insert('location', frame=10)

# 005 A Move our Cubes to new position (5 unit in positive Y) at frame 20 and set keyframes

bpy.context.scene.frame_current = 20

for cube in cubeSet:
    cube.location[1] += 5
    cube.keyframe_insert('location', frame=20)


# OFFSET BY FRAME
# 005 B If we like to offset each frame slightly

frameTarget = 20
frameOffset = 3
bpy.context.scene.frame_current = frameTarget

for cube in cubeSet:
    cube.location[1] += 20
    cube.keyframe_insert('location', frame=frameTarget)
    frameTarget += frameOffset
   

OFFSET BY FRAME BY RANDOM
# 005 C If we like to offset by random

frameTarget = 30
bpy.context.scene.frame_current = frameTarget

for cube in cubeSet:
    frameOffset = random.randrange(-10,10)
    cube.location[1] += 20
    frameTargetWithOffset = frameTarget + frameOffset
    cube.keyframe_insert('location', frame=frameTargetWithOffset)


GROUPING STUFF

OK, now we have something to group on. We have not actually group any of objects we have created.

But, within the Python script above, we have also put our newly created objects in a LIST, called "cubeSet". Since we already do that, we just pass on the List and tell Blender to link to new Group.

Reference:
http://blenderartists.org/forum/showthread.php?218394-Python-Grouping-objects

import bpy

''' APPEND SCRIPT BELOW AT THE VERY BOTTOM TO GROUP STUFF'''

objects_to_group = cubeSet

for item in objects_to_group:
    item.select = True
    bpy.context.scene.objects.active = item
    bpy.ops.object.group_link(group="myGroup")



RE-SELECTING GROUP
Whenever we like to select our objects again in the future, we simply do something like below.


import bpy


groupname = 'myGroup'
for object in bpy.data.groups[groupname].objects:
    object.select = True


We then just need to worry about the SORTING of objects by name.

MODIFYING FURTHER
Once we are able to re-select our objects, we can continue further and 

import bpy

frameOrigin = 40
frameTarget = 60
frameOffset = 3

groupname = 'myGroup'

for object in bpy.data.groups[groupname].objects:

    # set origin keyframe
    bpy.context.scene.frame_current = 40
    object.keyframe_insert('scale', frame=frameOrigin)
    frameOrigin += frameOffset

    # set target keyframe
    
    bpy.context.scene.frame_current = frameTarget
    object.scale[1] *= 10
    object.keyframe_insert('scale', frame=frameTarget)
    frameTarget += frameOffset


What we have been doing so far with Blender Python is kind of Animation with Offset. We simply applying same animation to every object and then offset the keyframe for each animation.

I am actually curious on how we can achieve this using other mean, such as using Action Curve or maybe Drivers.

RANDOM ARRANGEMENT
Things get a little bit more interesting if you add RANDOM here and there. Not everything need to be aligned and move and stop at the same time. Whether you are using the default Python Random module or other means (noise, perlin, etc). Maybe we look into this in near future.

I think the whole procedural animation thing is a little bit like controlled movement. Maybe like ballet or other dance performance or airplane airshow, we can carefully plan every formation of movement in a mathematical kind of way.

The best example for this is Beijing Olympic 2008. It was an extravagant performance by Chinese military and martial artist and dancer. Don't know exactly how they can do that, but I think they plan the whole performance using computer program of some sort.

Thinking about this further, we could have the same setup and simulation using Blender Particle system, actually. We could Keyframe Particle, tell it to move in random kind of way using Particle Boids, make them move and affected by Force, etc.

At some point, we also probably want to take consideration of manual animation curve as INPUT. That will be a lot more interesting.

BONUS: RANDOM MOVEMENT OF CUBE WITH RANDOM HSB COLOR

Below will be the exact same example like above, but I am applying a random HSB Color to each cube as Object Color.


import bpy
import random
import colorsys

# 001 Hide default Camera and Lamp
bpy.data.objects['Camera'].layers[1] = True
bpy.data.objects['Lamp'].layers[1] = True

bpy.data.objects['Camera'].layers[0] = False
bpy.data.objects['Lamp'].layers[0] = False

# 002 Select and delete default Cube
bpy.data.objects['Cube'].select = True
bpy.ops.object.delete(use_global=False)

# Create a single material that respect Object Color
mat = bpy.data.materials.new('MyMaterial')
mat.use_object_color = True

# 003 Create a bunch of new Cubes (should we give them material? yes, let's give one material to all)
totalCube = 25
cubeSet = [] 

for number in range(totalCube):
                    
    bpy.ops.mesh.primitive_cube_add(location = [0, 0, number])
    selectedObject = bpy.context.selected_objects
    mesh = selectedObject[0]
    mesh.name = 'MyCube.%s' % number
    mesh.scale = 0.45, 0.45, 0.45
    
    
    # Rainbow Spectrum Color HSB
    
    randomHueValue = random.uniform(0.0,1)
    
    convertedRGBvalue = colorsys.hsv_to_rgb(randomHueValue, .6, 1.0)
    
    # This will return Tuple of (R,G,B), you need to extract them using Index
    
    alphaValue = 1.0
    
    mesh.color = (
                    convertedRGBvalue[0], 
                    convertedRGBvalue[1], 
                    convertedRGBvalue[2] , 
                    alphaValue)
    
    # Keep our newly created cubes in Set
    cubeSet.append(selectedObject[0])
    
    # Apply our special Material
    bpy.context.object.data.materials.append(mat)


# 004 Set keyframes for Position XYZ value at Frame 1 and 10 (to hold position) for every cubes
for cube in cubeSet:
    cube.keyframe_insert('location', frame=1)
    cube.keyframe_insert('location', frame=10)


# OFFSET BY FRAME BY RANDOM
# 005 C If we like to offset by random

frameTarget = 30
bpy.context.scene.frame_current = frameTarget

for cube in cubeSet:
    frameOffset = random.randrange(-10,10)
    cube.location[1] += 20
    frameTargetWithOffset = frameTarget + frameOffset
    cube.keyframe_insert('location', frame=frameTargetWithOffset)




ANIMATE SCALE?
How about another example, and this time we animate the SCALE:

import bpy
import random
import colorsys

# 001 Hide default Camera and Lamp
bpy.data.objects['Camera'].layers[1] = True
bpy.data.objects['Lamp'].layers[1] = True

bpy.data.objects['Camera'].layers[0] = False
bpy.data.objects['Lamp'].layers[0] = False

# 002 Select and delete default Cube
bpy.data.objects['Cube'].select = True
bpy.ops.object.delete(use_global=False)

# Create a single material that respect Object Color
mat = bpy.data.materials.new('MyMaterial')
mat.use_object_color = True

# 003 Create a bunch of new Cubes (should we give them material? yes, let's give one material to all)
totalCube = 25
cubeSet = [] 

for number in range(totalCube):
                    
    bpy.ops.mesh.primitive_cube_add(location = [0, 0, number])
    selectedObject = bpy.context.selected_objects
    mesh = selectedObject[0]
    mesh.name = 'MyCube.%s' % number
    mesh.scale = 0.45, 0.45, 0.45
    
    
    # Rainbow Spectrum Color HSB
    
    randomHueValue = random.uniform(0.0,1)
    
    convertedRGBvalue = colorsys.hsv_to_rgb(randomHueValue, .6, 1.0)
    
    # This will return Tuple of (R,G,B), you need to extract them using Index
    
    alphaValue = 1.0
    
    mesh.color = (
                    convertedRGBvalue[0], 
                    convertedRGBvalue[1], 
                    convertedRGBvalue[2] , 
                    alphaValue)
    
    # Keep our newly created cubes in Set
    cubeSet.append(selectedObject[0])
    
    # Apply our special Material
    bpy.context.object.data.materials.append(mat)


# 004 Set keyframes for Position XYZ value at Frame 1 and 10 (to hold position) for every cubes
for cube in cubeSet:
    cube.keyframe_insert('scale', frame=1)
    cube.keyframe_insert('scale', frame=10)


# ANIMATE SCALE

    
frameOrigin = 40
frameTarget = 60
frameOffset = 3

for cube in cubeSet:

    # set origin keyframe
    bpy.context.scene.frame_current = 40
    cube.keyframe_insert('scale', frame=frameOrigin)
    frameOrigin += frameOffset

    # set target keyframe
    
    bpy.context.scene.frame_current = frameTarget
    cube.scale[1] *= 10
    cube.keyframe_insert('scale', frame=frameTarget)
    frameTarget += frameOffset


What if we want the color to be more organized like Rainbow Spectrum color? Let's modify the script again slightly (by normalizing the Hue color):

import bpy
import random
import colorsys

# 001 Hide default Camera and Lamp
bpy.data.objects['Camera'].layers[1] = True
bpy.data.objects['Lamp'].layers[1] = True

bpy.data.objects['Camera'].layers[0] = False
bpy.data.objects['Lamp'].layers[0] = False

# 002 Select and delete default Cube
bpy.data.objects['Cube'].select = True
bpy.ops.object.delete(use_global=False)

# Create a single material that respect Object Color
mat = bpy.data.materials.new('MyMaterial')
mat.use_object_color = True

# 003 Create a bunch of new Cubes (should we give them material? yes, let's give one material to all)
totalCube = 25
cubeSet = [] 

for number in range(totalCube):
                    
    bpy.ops.mesh.primitive_cube_add(location = [0, 0, number])
    selectedObject = bpy.context.selected_objects
    mesh = selectedObject[0]
    mesh.name = 'MyCube.%s' % number
    mesh.scale = 0.45, 0.45, 0.45
    
    
    # Rainbow Spectrum Color HSB
    
    rainbowHueValue = number/totalCube
    
    convertedRGBvalue = colorsys.hsv_to_rgb(rainbowHueValue, .6, 1.0)
    
    # This will return Tuple of (R,G,B), you need to extract them using Index
    
    alphaValue = 1.0
    
    mesh.color = (
                    convertedRGBvalue[0], 
                    convertedRGBvalue[1], 
                    convertedRGBvalue[2] , 
                    alphaValue)
    
    # Keep our newly created cubes in Set
    cubeSet.append(selectedObject[0])
    
    # Apply our special Material
    bpy.context.object.data.materials.append(mat)


# 004 Set keyframes for Position XYZ value at Frame 1 and 10 (to hold position) for every cubes
for cube in cubeSet:
    cube.keyframe_insert('scale', frame=1)
    cube.keyframe_insert('scale', frame=10)


# ANIMATE SCALE

frameOrigin = 40
frameTarget = 60
frameOffset = 3

for cube in cubeSet:

    # set origin keyframe
    bpy.context.scene.frame_current = 40
    cube.keyframe_insert('scale', frame=frameOrigin)
    frameOrigin += frameOffset

    # set target keyframe
    
    bpy.context.scene.frame_current = frameTarget
    cube.scale[1] *= 10
    cube.keyframe_insert('scale', frame=frameTarget)
    frameTarget += frameOffset


ADD ROTATION?
One more experiment. How about we also animation the rotation? Let's give that a try. We have never do anything with Rotation after all. For rotation, looks like we need to import Math Module because the rotation needs to be in RADIAN instead of DEGREE.

A bit of Math refreshment (I found by Google-ing)
  • degrees = radians * 180 / math.pi
  • radians = degrees * math.pi /180

import bpy
import random
import colorsys
import math

# 001 Hide default Camera and Lamp
bpy.data.objects['Camera'].layers[1] = True
bpy.data.objects['Lamp'].layers[1] = True

bpy.data.objects['Camera'].layers[0] = False
bpy.data.objects['Lamp'].layers[0] = False

# 002 Select and delete default Cube
bpy.data.objects['Cube'].select = True
bpy.ops.object.delete(use_global=False)

# Create a single material that respect Object Color
mat = bpy.data.materials.new('MyMaterial')
mat.use_object_color = True

# 003 Create a bunch of new Cubes (should we give them material? yes, let's give one material to all)
totalCube = 25
cubeSet = [] 

for number in range(totalCube):
                    
    bpy.ops.mesh.primitive_cube_add(location = [0, 0, number])
    selectedObject = bpy.context.selected_objects
    mesh = selectedObject[0]
    mesh.name = 'MyCube.%s' % number
    mesh.scale = 0.45, 0.45, 0.45
    
    
    # Rainbow Spectrum Color HSB
    
    rainbowHueValue = number/totalCube
    
    convertedRGBvalue = colorsys.hsv_to_rgb(rainbowHueValue, .6, 1.0)
    
    # This will return Tuple of (R,G,B), you need to extract them using Index
    
    alphaValue = 1.0
    
    mesh.color = (
                    convertedRGBvalue[0], 
                    convertedRGBvalue[1], 
                    convertedRGBvalue[2] , 
                    alphaValue)
    
    # Keep our newly created cubes in Set
    cubeSet.append(selectedObject[0])
    
    # Apply our special Material
    bpy.context.object.data.materials.append(mat)


# 004 Set keyframes for Position XYZ value at Frame 1 and 10 (to hold position) for every cubes
for cube in cubeSet:
    cube.keyframe_insert('scale', frame=1)
    cube.keyframe_insert('scale', frame=10)


# ANIMATE SCALE

frameOrigin = 40
frameTarget = 60
frameOffset = 3

for cube in cubeSet:

    # set origin keyframe
    bpy.context.scene.frame_current = 40
    cube.keyframe_insert('scale', frame=frameOrigin)
    frameOrigin += frameOffset

    # set target keyframe
    
    bpy.context.scene.frame_current = frameTarget
    cube.scale[1] *= 10
    cube.keyframe_insert('scale', frame=frameTarget)
    frameTarget += frameOffset
    
    
# KEYFRAME ROTATION ORIGIN
for cube in cubeSet:
    cube.keyframe_insert('rotation_euler', frame=150)

# ANIMATE ROTATION AND KEYFRAME

frameOrigin = 150
frameTarget = 250
frameOffset = 3

for cube in cubeSet:

    # set origin keyframe
    bpy.context.scene.frame_current = 40
    cube.keyframe_insert('rotation_euler', frame=frameOrigin)
    frameOrigin += frameOffset

    # set target keyframe
    
    bpy.context.scene.frame_current = frameTarget
    cube.rotation_euler[2] = 360 * math.pi /180
    cube.keyframe_insert('rotation_euler', frame=frameTarget)
    frameTarget += frameOffset







MKRdezign

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget