Stamp the timeline markers as cut number

Blender 2.66

I’m getting to know Blender VSE. It’s quite capable of making an animatic.

There are really helpful addons that make editting in Blender easier:

seq_addon

jump2cut

Making animatic, you’ll need to imprint cut number or frame number on the video itself for easy referencing later. In other editting software, like Premiere, you have to create titles one by one, but in Blender, you can use stamp to imprint these information with less effort.

stamp

I put markers at every cut, rename them to cut number, the ‘Marker’ stamp then would indicate the cut number.

markerAsCut

Using mouse to position the playhead at the exact cutting point could be cumbersome, I end up assigning a shotcut key of the ‘Cut previous’ / ‘Cut next’ of the Jump-to-cut addon to the < and > keys respectively.

addshortcut

Then my process of putting markers at the cutting point would be pressing keyboard

>  m > m > m > m …and so on

After every markers is put in place I rename them all at once with this script

import bpy
i = 1
for Marker in bpy.context.scene.timeline_markers:
Marker.name=str(i)
i=i+1

(there should be indentation for the last 2 lines, WordPress rips them off)

Turn on Stamp and the information would be imprinted on the rendered frames

*I’m still looking for an easy way to change the word ‘Marker’ on the rendered frame to something else, at the moment it seems like it was hard-coded in the source, which could be next to impossible to change. 😦

————————————————————————————–

update:
I’ve found the code to change the word ‘Marker’.

It’s in source/blender/blendkernel/intern/image.c

line 1531

Screenshot from 2013-04-28 11:05:00

I have to re-compile blender, though.

Screenshot from 2013-04-28 11:09:42

More elaborated solution would be a textbox for user to enter custom prefix. I’ll look into that later. All hail the Opensource !!! 😀

Advertisements

Dust is gone

Not many update lately. I’ve been through a big chaos in my life.
Now the dust is gone, it’s time to look ahead again.

My resolution this year would be submitting a masterpiece to Animation theater in Siggraph Asia 2013 in HK.( of course, made with Blender.)
sculpt

I’ve learned many things from this project. So there will be more tips or tutorials soon. ;-D

 

Always use relative path

Blender 2.63a

When working cross platform,it’s important to have all blend files use relative path. That every other files linked into the blend can be found in the path relate to it, with no OS specific mount point.
By doing

File->External Data->Make all path relative

And see the result message at the top of the screen if something went wrong. This way you can be sure that your blend will be opened in other OS fine, provide that you don’t change the folder structures.

This can be useful for archiving the project after you finish it, by storing the whole folder structures as is, you can move your project anywhere without losing links or external textures.

Copy camera aperture settings from main camera to stereo

Blender 2.63a
Stereoscopic Add-on 1.6.7 

Stereoscopic camera add-on from http://www.noeol.de/s3d/ helps generate stereo camera for 3D rendering.

It does the job well, except when working with DoF in Cycles. The add-on doesn’t copy the aperture setting from main camera the the stereo ones.

So I wrote a  script to automate this.

After setting up stereo cameras, create an empty text and paste this script.

import bpy

thisCam = bpy.data.objects["L_Camera"]

thisCam.data.cycles.aperture_blades = bpy.data.objects["Camera"].data.cycles.aperture_blades
thisCam.data.cycles.aperture_size = bpy.data.objects["Camera"].data.cycles.aperture_size
thisCam.data.cycles.aperture_rotation = bpy.data.objects["Camera"].data.cycles.aperture_rotation
thisCam.data.cycles.aperture_type = bpy.data.objects["Camera"].data.cycles.aperture_type

thisCam = bpy.data.objects["R_Camera"]

thisCam.data.cycles.aperture_blades = bpy.data.objects["Camera"].data.cycles.aperture_blades
thisCam.data.cycles.aperture_size = bpy.data.objects["Camera"].data.cycles.aperture_size
thisCam.data.cycles.aperture_rotation = bpy.data.objects["Camera"].data.cycles.aperture_rotation
thisCam.data.cycles.aperture_type = bpy.data.objects["Camera"].data.cycles.aperture_type

and run script.

Use spreadsheet to generate batch render command

Blender 2.63a
Libre Office 3.4.4

Being able to render from command line is convenient, to queue up many files for rendering, you could create a batch file (like renderall.bat) contain these command.

blender -b scene1blah.blend -a
blender -b scene2blahblah.blend -a
blender -b scene3blah.blend -a

so on…

And run the renderall.bat from command line.

Problem is the amount of typing/copy&pasting those commands if you have like a few hundred shots to render could be overwhelming.

Spreadsheet like LibreOffice Calc is coming to rescue.

Assume you’re in Windows. In cmd, cd to the drive/folder where you keep those blend files. Then

dir /B /O N *.blend >allblend.txt

This will list every files ended with .blend and write into a new text file called allblend.txt, sorted by name.

Run Calc. Click menu Insert->Sheet from file

Browse to the allblend.txt, you just created. OK with default settings, you’ll end up with each blend file in its row in column A.

Click and drag to hilight every cells in A and move them to B

In an empty cell A1, type in ‘blender -b’. And duplicate this to every A row by dragging the lower right corner of the A1 cell down to the last row.

Also, in cell C1, type ‘-a’ and duplicate it down to every C row.

Your spreadsheet should look like this

You can remove rows that you don’t want to render.

Now save as … Text CVS (.cvs)

There would be a dialogue pop up to ask for ‘Field Delimiter‘, change this one to {space}

You’ll have a .cvs file, which is actually a normal text file that you can change the extention to .bat and execute it as a rendering queue.

Use Python script to generate render filepath

Blender 2.63a

When dealing with hundreds of shots, it could be painful to change the render filepath manually. So I wrote a script to automate this task based on .blend file name.

For example, I organise my files to be named like – S05C04_20120727.blend
Where S = scene, C = cut, and those 8 digits are the date this file has been changed.

I like my render filename to be the same with blend file but strip the date part out.

So, in Text Editor, paste this script

import bpy

currentfilename = bpy.path.display_name_from_filepath(bpy.data.filepath)

#this will store the current file name (with ".blend" truncated)
#into a variable called "currentfilename"
#so now, currentfilename hold a string 'S05C04_20120727'

renderfilepath = '//../render/'+currentfilename[:-9]+'/'+currentfilename[:-8]

#the [:-9] means truncate last 9 charactors out of the string
#so currentfilename[:9] would be 'S05C04'
#and currentfilename[:-8] would be 'S05C04_'
#renderpath variable would be '//../render/S05C04/S05C04_'

bpy.data.scenes['Scene'].render.filepath = renderfilepath
#don't forget to change 'Scene' to your actual scene name

Now press ‘Run Script’, you’ll see the render filepath change.

You can run this script with other blend file as well. For running from command line without opening the GUI, You have to add another line at the end

bpy.ops.wm.save_mainfile(filepath=bpy.data.filepath)
#to save changes that you've made.

and save it as a .py, like – renderpath.py

Now, from command line, run

blender -b S03C12_20120727.blend -P renderpath.py

This will change the setting inside the S03C12_20120727.blend file without the need to run Blender GUI.