Halloween Costume ideas 2015
Articles by "string"
@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



Our focus this time is Text Object in AN.

Like I mentioned last time, Text Object manipulation is very interesting. I am always fond of text, font, typography, and recently I am into Emoji, but that's probably another story. But you might want to try using text that is not alphabet ABC, maybe Japanese characters, Chinese, Korean, Thai, Arabic maybe.

Basic Text Input

The most basic text input is the one we type into "String Input" node, that can be created by selecting Text - Input.


STRING TYPE CONVERSION

In programming, text is often called String type which is made up of Characters. String is a more correct term, but we get used to Text so in AN often we found String and Text are interchangeable, with same meaning. Depends on the context I guess.

Also, Number type (Float, Integer, etc) is not String, but we can convert Number into String and usually String back into Number when evaluated. I do not know yet if AN can convert String back into number, but we will find out soon. For now, it seems like converting other types into String is more easy.


JOINING STRING

Like Numbers, we can combine, split, join multiple Strings. For joining, my guess is that we use "Join Text" node. Which is correct, but interestingly, we get "Create List" node automatically created by AN. Which is make sense.

Below, I have 4 strings: "Apple", "Banana", "Mango", and "Durian". So I combine them, and it takes 2 steps:
- Create LIST of those String Elements
- Combine the LIST into a single String to pass to Text Object Output


If you do Python programming, this should be familiar to you. For non-programmer, you can follow along and try to understand what each node does. Below I am using "Debug" node to see the output of each step.

You may notice the option of "Joint Text" node, there is this Separator field, where you can type in the "in between" for text string elements. Normally you put black space " " for example. Below, I am using capital "X" in between those elements.


SPLITING STRING
If we can combine String, we can also split string.

Very often, we have a sentences made up of "words" separated by space and sometimes we want to split them into each separate "words".

We can do that very simply by using Split Text.

Now here, we are breaking text / sentence into their elements / words. So we get this automatic "Get List Element" created, when we want to pass it into Text Object Output. Change the Index number and see what word you get.


Split Text has few handy options, feel free to try it yourself. It is pretty useful.

TEXT IN & TEXT OUT

Blender always has this awesome Text Editor feature that talks to every part of Blender. AN can talk to Text Editor easily.

"Text Block Reader" can bring any text from Text Editor, and vice versa "Text Block Writer", we can output text! All these kinds of pair nodes in AN is handy and you can understand both at the same time just by doing the opposite.

Let's try "Text Block Reader" node. Since we are also already know "Split Text" node, we can use that to break the text into each separate element, using "Lines" separator.


Ok, I realized here that we really want to see all the words in the screen. How do we do that? You guess what? Loop? Yes.

We need to use Loop. Don't worry, it's rather simple, once you understand it. Not easy, but learnable.

My step by step thinking process is like this:
1. Create "Loop Input" node.
2. Next, you either click on (+) New Iterator and create Object List and String List (because we know that we will be needing duplicate instances of Text Object, and also we will bring in list of String elements). OR... another way is to backward noodle plug from "Text Object Output" Object and Text into the "Loop Input" node.
3. Then, we will Invoke our Subprogram. Our "Invoke Subprogram" will then be able to accept multiple or array of elements.


Above, you see, there is one important thing, we need to enable "Deep Copy" option, for "Object Instancer" node. Deep Copy allows us to actually insert out "String" element into each Text Object instance copy.

At the moment, all our text will be jumbled up on top of each other at 0,0,0 World Origin.

We can use our previous knowledge to place text in positions. For that we need "Object Transform Output" node. And we just need to add those via Loop Input and Invoke Subprogram.



CHALLENGE: See if you can recreate the top most image of this article. Random rotate the text, and based on your own words supplised via Text Block, perhaps you can "replicate" it.

"Text Block Writer" node can output data, for example, below I am writing Edge Indices information of Suzanne.


OTHER TEXT NODES

There are many other nodes that deal with Text / String data. Feel free to try them yourself, while seeing the output.




It has been quite a while since I posted that old post on Blender Python Scripting topic:
http://blendersushi.blogspot.com.au/2012/03/programming-one-can-script.html

I am keeping my eyes on that post and will continue to update it overtime as I gain more understanding of concept of programming, and how one can use programming inside 3D software like Blender, and how Python is utilized. I probably will re-write some of my approach in explaining Blender Python to you. It is only recently that I actually started to understand Python and programming a little bit better (than last time).

I will babble a little bit, but if you think you are a pro and want to skip, just go to subheading "PROGRAM START HERE". Do not miss "IF BUCKY CAN, YOU CAN" though if you are beginner in Python.

##########################################################
NOTE 2012.12.07:
I am looking for simplest "Syntax Highlighter" for Code Snippet. At the moment the Python Code written here looks pretty ugly and messy because the lines and tabs are not presented nicely as it supposed to). Anyhow, if you first copy-paste the code inside the box into a good text editor (Sublime, NotePad++), it should work. In Python, space and Tab often matters when writing code.
##########################################################

FROM FIRST STEP TO NEXT STEP
Ok, so that post should be "the first step" if you also want to get into programming. This post I am writing will be still touching BASIC of Python but also jumping  into INTERMEDIATE level.

Here, I am not writing Python theory per se, but this post will be kind of like written documentation to share some notes that I collected while I am studying Python and trying to find SOLUTION for PROBLEM.

WAY OF TEACHING AND CODING
I want to emphasize something that I learned recently:
Modern education is no longer about TEACHER and STUDENT, but more likely it is a COLLABORATION between people to think CREATIVELY in finding SOLUTION for PROBLEM. This is seriously applicable when you are learning 3D using Blender on your own, with helps of Online Community.

Learn to Google for information and read and filter forum postings. Do ask forum if you are completely stuck and cannot find solution anywhere else. Even nicer is to have some kind of meetup to talk and get active about your passion (Blender in this case). You are your own teacher.

I will try to be like a MENTOR. I do not know everything, but I will try showing you the way. Maybe you already have solution yourself though.

IF BUCKY CAN, YOU CAN
First thing first, I must share this with you, I stumbled into this awesome YouTube Channel full of interesting materials, owned by a guy named Bucky. Bucky teaches all kind of stuffs in his own way. Although most of the stuffs there are "basic" but this guy really teaches the basic really well. I actually would like to adapt his way of teaching for my future video tutorials.

Bucky also teaches Python Basics, here is a link to Playlist for snippet of videos explaining the foundation of Python:
http://www.youtube.com/course?list=ECEA1FEF17E1E5C0DA&feature=plcp

It is not related directly to Blender, but it will give you excellent introduction on Python.

Bucky is a great teacher, I salute people like this.

WHAT IS THE TASK YOU WANT TO DO USING PYTHON?
This is an important question once you get a hang of Python and programming a little bit better. What interest you the most?
  • Tools and UI creation
  • Data I/O (Input Output)
  • 3D Data Manipulation
  • Rigging and Animation
  • Visual Effects
  • Game (physics, behaviour, interaction)
(Although I sound like I know things, but I am also still figuring a lot of things. So please keep that in mind and bear with me,)

Whenever thinking about Blender Python, beginner programmers tends to what to accomplish big tasks. Even me, was kind of naively thinking to achieve complex stuffs.

Have you watched the movie "Jiro Dream of Sushi (2011)"?
http://www.imdb.com/title/tt1772925/

Well, that movie is basically a documentary about Master of Sushi called Jiro in Japan. Any beginner apprentice would like to work with the Master takes years (to learn how to prepare Squid perfectly) before allowed to touch Fish and create Sushi.

It will be frustrating. You will make thousands of mistakes.

Anyways, if you are stuck, always go few back steps, maybe you need certain "basic" skills in order to successfully complete that task.

In this post, I will attempt to show you this simple task that I manage to accomplish using Blender and Python. You will learn a lot just by accomplishing small task.

000. PROGRAM START HERE
Enough babbling around let's get started.

I bet Python can do a lot of stuffs, but for beginner like me, I have big interest in how Python can be used to bring DATA in and out from one place to another. In our context, let see how Blender can take data from outside and then process into something that you can render.

I seriously do not know how to do this, this morning. But now 7+ hours later, I finally understand and decided to spend some time writing this notes to share with you.

001. THE TASK IS...
To import data and create 3D visualization in Blender using Python.

002. WHAT IS THE DATA? 
Or in programming context, what type of data are we dealing here?

I cannot write all the theory regarding DATA TYPE, but however you can Google and read some articles or video tutorials on data type in programming in general.

Watch and look up for these terminologies:
  • String -> string of text
  • Float -> floating value of number eg. 14.233, 1.245
  • Integer -> round number eg. 5, 9, 1456
  • Boolean -> True or False
  • List --> you will deal with list a lot in Python, it is the strength of Python
  • Array
  • Tuple
  • Dictionary
003. PREPARE THE RAW DATA
For this example, I just use a simple Tabular Data in a Spreadsheet that I created inside Google Doc Spreadsheet. It looks like this:

Very simple row x column tabular data. The COLUMN x ROW data basically contains:
  • Name (text data)
  • Number (number data)
  • Color (text data)
Total 11 row of data.

How do we bring that data into Blender using Python?

There are probably many ways to do that, but one thing that I certain is using CSV (Comma Separated Value) file format.

From Google Docs, you simply to to File - Download As - CSV. You will then get a file in CSV format. It is basically a text format, but the data comes as rows of text, with comma separated value, like below:

helloworld,14,red
one,23,green
two,67,blue
three,43,blue
four,77,red
five,99,green
six,45,red
seven,32,blue
eight,78,green
nine,22,red
ten,73,blue

CSV file format is something that Python can process quite nicely using Python CSV Module. Anyhow, let's slowly see how this can be accomplish. Let's bring in this data into Blender using Python.

004. READING CSV
I learn how to read CSV by reading this blog post:

I like that blog a lot, and I think you will also find it useful. Lots of great snippet (short Python code) that you can study and use.

Basically, you need to import the CSV file.
file = csv.reader(open('\\Users\Jimmy\Desktop\data.csv', newline=''), delimiter=',')

Make sure that you write the correct directory path. I use Windows 7, so the data path is as below:
'\\Users\Jimmy\Desktop\data.csv'

Then you parse the data using CSV module.

The STARTER PYTHON SCRIPT inside Blender then goes like this:
import bpy # THIS IS A MUST TO IMPORT ALL BLENDER PYTHON MODULE
import csv # IMPORT CSV MODULE

# READ INPUT FILE

file = csv.reader(open('\\Users\Jimmy\Desktop\data.csv', newline=''), delimiter=',')

for idx, row in enumerate(file):
if idx<11: # this is hard coded at the moment
print(idx,row)

I modify the script slightly below, just to get the TOTAL OF ROW, I seriously think there is a better way, but for now, it is a hack.

Maybe the file also needs to be closed to prevent memory leaks. But I leave that for later.

Remember that you need to be inside Blender Scripting layout and place the script inside the Text Editor Panel. You then run the script using hotkey Alt+P.




When run, that Python code will import (open) the data.csv and go through the loop and print every row of data of the CSV file and print out the: ROW INDEX + the value for each row as LIST of STRING.

If your script is executed correctly, you will see something like below on the Blender console window:


This means that you successfully import the CSV data (Strings) into Blender.

Next step will be to process the data further. The data itself is really simple and ready to use, it is a type of LIST of STRING that you can simply use in Blender.

In order to have much simpler LIST data that I can process in loop for every line, I modify the script again like below:

import bpy # THIS IS A MUST TO IMPORT ALL BLENDER PYTHON MODULE
import csv # IMPORT CSV MODULE

# READ INPUT FILE

file = csv.reader(open('\\Users\Jimmy\Desktop\data.csv', newline=''), delimiter=',')

curRow = [] #empty placeholder for current row

for idx, row in enumerate(file):
if idx<11: # this is hard coded at the moment

curRow = row



The "curRow" variable there is a new LIST data variable that further break the CSV data into easier data to pass on.

005. STRING INTO 3D TEXT OBJECT
First data is String type and we can simply pass it to Blender to create 3D Text Object.

Via Google Search, I stumbled into this video tutorial: 

That video should explain clearly how you can use Python inside Blender to create Text Object with string data that you are supplying. 

So based from that information, our code becomes like below:

import bpy # THIS IS A MUST TO IMPORT ALL BLENDER PYTHON MODULE
import csv # IMPORT CSV MODULE

# READ INPUT FILE

file = csv.reader(open('\\Users\Jimmy\Desktop\data.csv', newline=''), delimiter=',')

curRow = [] #empty placeholder for current row

for idx, row in enumerate(file):
if idx<11: # this is hard coded but you can use

curRow = row

# display first data index as string
bpy.ops.object.text_add(location=(0,idx,0), rotation=(0,0,0))
bpy.ops.object.editmode_toggle()
bpy.ops.font.delete()
bpy.ops.font.text_insert(text=curRow[0])
bpy.ops.object.editmode_toggle()




You see how the first column of data which were originally in tabular format is now spit out as 3D Text Object and visualized in 3D!

We are good and on the right track!

The process continues for the other data on Column 2 and 3 (from the original Tabular Data)

006. NUMBER
Our number data is simple.

It is totally up to you how you like to visualize it. To be really simple, we just pass on the NUMBER into SCALE. I use 3D Polygon Cube and Scale them in one axis to create BAR kind of type of visualization, based on the number provided. And I simply place them on location.

The script is now like this:

import bpy # THIS IS A MUST TO IMPORT ALL BLENDER PYTHON MODULE
import csv # IMPORT CSV MODULE

# READ INPUT FILE

file = csv.reader(open('\\Users\Jimmy\Desktop\data.csv', newline=''), delimiter=',')

curRow = [] #empty placeholder for current row

for idx, row in enumerate(file):
if idx<11: # this is hard coded but you can use

curRow = row

# PROCESS COLUMN ONE
# display first data index as string
bpy.ops.object.text_add(location=(0,idx,0), rotation=(0,0,0))
bpy.ops.object.editmode_toggle()
bpy.ops.font.delete()
bpy.ops.font.text_insert(text=curRow[0])
bpy.ops.object.editmode_toggle()

# PROCESS COLUMN TWO
# create cube and transform resize
bpy.ops.mesh.primitive_cube_add(view_align=False, enter_editmode=False, location=(0, 0, 0), rotation=(0, 0, 0))


# store the location of current 3d cursor
saved_location = bpy.context.scene.cursor_location.copy() # returns a copy of the vector

# give 3dcursor new coordinates
bpy.context.scene.cursor_location = (0.0,0.0,-1.0)

# set the origin on the current object to the 3dcursor location
bpy.ops.object.origin_set(type='ORIGIN_CURSOR')

# set 3dcursor location back to the stored location
bpy.context.scene.cursor_location = saved_location


myScale = int(curRow[1])


#bpy.ops.transform.resize(value=(0.5, 0.5, 0.5))
bpy.ops.transform.resize(value=(0.5, 0.5, myScale), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

bpy.ops.transform.translate(value=(5, idx, 0), constraint_axis=(False, False, False))


I basically take the data from Column Two, as now passed in by curRow[1] placeholder. It does that for every line. It is as if you are create Cube, move it into place, and scale it accordingly based on the data provided.


It actually works, but not optimized. You see how the BARS are really too long in Blender Unit. Perhaps later I can optimize the data range so that they can be "normalized" and scaled into manageable size.

I also did something with the 3D Cube Origin there using Python. Looks tricky, but really simple once understood. Read below blog post:

Dealing with Origin using Python

This is unrelated but interesting:

007. COLOR DATA
Ok, now we get to data in Column 3, which is COLOR type. Well, it is actually STRING data (text), where I specified: RED, GREEN, or BLUE.

To accomplish this, I actually brainstormed a bit. Rather than using "all Python solutions", I am thinking that maybe it is easier if you prepare some Materials named "red", "green", "blue" that can then be linked into the Object.

It would be interesting too, to actually try to create new material and change the Color Diffuse value using Python. I might add addendum that does that.

Typically Color data is in format of Vector, RGB (123, 122, 123). I have not looked into it yet.

Anyhow, the idea is really to prepare 3 Materials named "red", "green", "blue", and then using Python to apply it to the BARS.

Assigning Materials using Python
Assigning certain Materials (with specific name) to certain object in Blender is slightly tricky because you need some understanding of Blender Data Flow and Linking.

This forum post helps me a lot:

But this one also helps:

What would be interesting is to do also try this, importing Materials from other BLEND. Very cool, but you may want to do this later.

I borrow the code from ATOM (on Material creation), and plonked it in into our script. I think I need to digest this information a little further and try to explain what happening later. But for now, the idea is like this:

1. In Blender, you need to create Material Data for each Object. You cannot assign material if you don't first assign Material.
2. Once you have Material Data, as we know, Blender can have "Multiple Slots" per Material.
3. For our task here, we just need a single Material Data and change the value of Material Slot into the Material name that we specified.
4. Make sure that you have prepared the "red", "green", and "blue" Materials before running the script.

The code becoming like this:


import bpy


import csv





# READ CSV DATA FILE





file = csv.reader(open('\\Users\Jimmy\Desktop\data.csv', newline=''), delimiter=',')





curRow = [] #empty placeholder for current row





# ATOM


def returnMaterialByName(passedName):


    result = None


    for m in bpy.data.materials:


        if m.name == passedName:


            result = m


            break


    return result





def createNewMaterial (passedName):


    tempMat = bpy.data.materials.new(passedName)


    if tempMat != None:


        tempMat.diffuse_color = (0.5,0.6,0.7)


        tempMat.diffuse_shader = 'LAMBERT'


        tempMat.diffuse_intensity = 1.0


        tempMat.specular_color = (0.9,0.9,0.9)


        tempMat.specular_shader = 'COOKTORR'


        tempMat.specular_intensity = 0.5


        tempMat.alpha = 1.0


        tempMat.ambient = 0.3


        tempMat.emit = 0.2


    return tempMat





def aquireOrCreateMaterial(passedName):


    tempMat = returnMaterialByName(passedName)


    if tempMat == None:


        tempMat = createNewMaterial(passedName)


    return tempMat








for idx, row in enumerate(file):


    if idx < 10: #still hard coded, how to check the total line size or length


        print(idx,row)


        curRow = row


        


        # display first data index as string


        bpy.ops.object.text_add(location=(0,idx,0), rotation=(0,0,0))


        bpy.ops.object.editmode_toggle()


        bpy.ops.font.delete()


        bpy.ops.font.text_insert(text=curRow[0])


        bpy.ops.object.editmode_toggle()


               


        # create cube and transform resize


        bpy.ops.mesh.primitive_cube_add(view_align=False, enter_editmode=False, location=(0, 0, 0), rotation=(0, 0, 0))


             





        # store the location of current 3d cursor


        saved_location = bpy.context.scene.cursor_location.copy()  # returns a copy of the vector


        


        # give 3dcursor new coordinates


        bpy.context.scene.cursor_location = (0.0,0.0,-1.0)


        


        # set the origin on the current object to the 3dcursor location


        bpy.ops.object.origin_set(type='ORIGIN_CURSOR')


        


        # set 3dcursor location back to the stored location


        bpy.context.scene.cursor_location = saved_location


        myScale = int(curRow[1])




        #bpy.ops.transform.resize(value=(0.5, 0.5, 0.5))


        bpy.ops.transform.resize(value=(0.5, 0.5, myScale), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)





       


        bpy.ops.transform.translate(value=(5, idx, 0), constraint_axis=(False, False, False))







# create material


#bpy.ops.material.new()





# to script and create specific material with certain name will be difficult, another way is to create manually or import from outside BLEND and apply it using script


# if we manually already create certain material with certain name it will be easier, we simply need to apply it per selected object




        myObj = bpy.context.active_object


        print(myObj)


        


        


        # Program begins here.


        #bpy.ops.mesh.primitive_cylinder_add()


        #ob = bpy.context.active_object


        #ob.name = "myCylinder"


        me = myObj.data


        mat = aquireOrCreateMaterial ("myNewMaterial")


        me.materials.append(mat)





                


        # before applying below, you need to create material data slot first!


        myObj.material_slots[0].material = bpy.data.materials[curRow[2]]



When the script is run, hopefully you get the result like below:


So, there you have it, a whole documentation on how I accomplish this task of importing CSV data, passing it into Blender 3D Objects to visualize the data, using Python.

WHAT NEXT?
Actually even if the code is working, you can then take it further:
  • Further optimize the code and function
  • See what variations you can create with it
  • Create User Interface (UI) if required
This is a very basic example of how you can bring code from CSV, but I think you can do a lot from here.

Actually, this example is probably too hard for beginner programmers. It is probably useful to look into Python LIST as well, and how to work with list.

There are some parts where I jump and use the code without 100% understanding it. It does the job, but I need to take steps back and try to understand that part and simplify it.

The Material creation and assignment using Python should not be that complicated, just need a way to think and understand it.

At least if you and me manage to go through this exercise, you understand the workflow on how:
1. To bring data from CSV using Python in Blender.
2. Parse the data line by line using Python in Blender..
3. Further process the data and pass on the value to create 3D objects in Blender.

My WISHLIST to do using Python in near future:
  • Import and Export of Particle Data
  • Understand Python better, especially within Blender context, we want to be able to write out Blender data and read it back in on other 3D sofware like Maya, Houdini, Softimage.
  • Create Simulations
  • Create Random Looking Creature
  • Asset Management Pipeline
There is no doubt that Blender Python can be utilized to the level like below:
http://www.molecularmovies.com/toolkit/

UPDATE 2012.12.12: Blender PDB Atomic Molecular data importer
Well, in Blender 2.65 update, we have Protein Data Bank (PDB) Molecule Importer built in inside Blender!!! How awesome is that? You can actually study the Python of addons.
http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Import-Export/PDB

SEE ALSO: Bio Blender by Mike Pan
http://bioblender.eu/

This is Alcohol Atom formation.
Above is Alcohol PDB taken from here:
http://wbiomed.curtin.edu.au/biochem/tutorials/pdb/index.html

CHALLENGE:
For you, Blender Python genius that is mentally challenged:
  • Get live Twitter data and pass it into Blender
  • Get Facebook Data and visualize your friend's birthday across 12 months
  • Get live Yahoo! Weather data and visualize temperature of certain area in globe.

MKRdezign

Contact Form

Name

Email *

Message *

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