BLenses first public release

As described previously, BLenses.py provides a means of matching the Blender camera’s field-of-view (FOV) setting to a specified real-world camera (“camera” being a combination of lens and film/sensor). While not an optical lens simulation, it does provide good perspective-matching for real-world/Blender-world compositing. There’s also options that facilitate animating focal length/FOV and depth-of-field values.

No reports of reproducible bugs so far, a month after the test release, so I suppose a public release is in order. The BLenses documentation site has a link near the top of page 1 that will d/l a small zip archive (there’s three files in the d/l). The script header has a mailto for bug reports, or you can post in this thread.

BLenses documentation & download

The BLenses documentation is really impressive! Very thorough and pedagogic. Thank you for sharing.

This is simply amazing work. And this brilliant peace of code really calls for hard-code integration. Thank you chipmasque, really great job.

Very nice script.

This is the patch to fix a problem with Linux:

--- BLenses.py.orig    2007-10-30 23:02:13.000000000 +0100
+++ BLenses.py    2007-10-30 23:36:10.000000000 +0100
@@ -39,6 +39,7 @@
 import Blender
 from Blender import *
 import math
+import os
 
 #####################################################################################
 # FUNCTIONS
@@ -785,7 +786,7 @@
 curTexts = Text.Get()
 if    curTexts == []:
     try:
-        Text.Load(ScrDir+"\BLensAnim.py")
+        Text.Load(os.path.join(ScrDir,"BLensAnim.py"))
         HaveScrLink = True
     except:
         HaveScrLink = False
@@ -798,7 +799,7 @@
             HaveScrLink = True
             break
     try:
-        Text.Load(ScrDir+"\BLensAnim.py")
+        Text.Load(os.path.join(ScrDir,"BLensAnim.py"))
         HaveScrLink = True
     except:
         HaveScrLink = False

thanks for the comments, folks. hope it proves useful.

marioamb, your Linux fix is much appreciated. I’ve run into cross-platform issues with Python before, but have no means of testing & solving them, so any feedback like this is gold, 'specially for a tyro Blenderscripter :slight_smile:

EDIT: Fix incorporated – thanks again!

wow! I’m speechless! Thanks for your efforts! This is a very valuable add-on to blender’s power! :wink:

Kudos. Well done on the doc’s, too. This should be quite useful. :slight_smile: Keep up the good work.

Yeah, I really like your comprehensive documentation about camera and scene matching.
Awesome work.

Hi chipmasque
thank you very much for this wonderful script !!!

Greetings Patrick

hi, very good script, thanks!!!

in linux the script can’t find the camera presets, what should i do?

i put it in the /.blender/scripts/bpydata/config

It’s probably another pathing issue – I’m not that good yet at writing Python that’s robust for all OS’s, so I’ll check the code and see if I need to generalize the path specification for the presets file (as I learned to do with the other files in the patch noted above).

EDIT – irrelevant text removed :slight_smile:

Thanks for the heads up!

Newly-patched version 0.0.3 now available, should fix this one remaining path specification issue. Thanks for your patience!

Hi

Trying out your script on Linux, blender built from SVN, i get this error trying to use the image Apeture/Camera profile Presets, it tells me it can’t find the BLensProfiles.cfg although it’s there and permissions are ok.

.blender/scripts/bpymodules/BPyRegistry.py", line 202, in LoadConfigData
exec(pysrc)
File “<string>”, line 1
BLensProfiles = {
^
SyntaxError: invalid syntax

thanks

Not sure how to address this problem, yellow. Far as I can tell, the error isn’t in the BLenses script but rather in BPyRegistry.py, which I have no control over. The error report is of a "syntax error’, but the erroneous text specified does not exist in BLenses.

First, make sure you’re using the latest version of BLenses (0.0.3), which fixed some pathing errors that produced similar probs (but gave a different error report).

Since you’re using an SVN build, I can’t comment on any conditions that may have given rise to this error, as I can’t test against every possible build. Haven’t received any reports of similar error from the release build, however. I just tested it (WinXP) successfully in 2.45 release. Maybe try the same steps using 2.45 release – if it works OK, then I can only assume that the SVN build you’re using has a bug, or at least some variance from the release build that I have no way of identifying or adjusting for.

BLensProfiles.cfg is just a text file, so if you need the data, you could open it in any number of ways and simply enter the settings manually. The file has info about its data structure so you can read it fairly easily. Bit of a pain, but workarounds often are.

Which SVN build produced the problem, btw? Maybe contact the builder and see if you can get any more info.

hi

I downloaded BLenses 0.0.3 from your website so I’m sure I’m using latest.

I tried using Blender 2.44 from the Ubuntu repository, which I would imagine is the official BF version 2.44 and I get the same error.

I did wonder about entering the data manually, which is no problem really, I’d really like to try the script out on some archi viz I’m doing, so no problem. :slight_smile:

The SVN build was done by myself on this machine, as usual.

Thanks for the advice, perhaps it’s still an OS thing?

Perhaps it’s OS related, but since the problem doesn’t seem to develop in the BLenses script, but rather in a separate module that is referenced by a function call in the script, not sure what I can do about it. If someone with more savvy about Blender in Linux can help shed some light, I’d be happy to try a fix, but since I can’t test on Linux, I’m limited to suggesting workarounds.

It shouldn’t be a pathing issue, since that was addressed earlier (see the posts above) by keying the path structure to the OS, unless there’s a new arrangement of folders in your build. Could you post the exact full path to the folder where you have the BLensProfiles.cfg stashed? I could check that against the script directives.

Wish I had more positive support to offer on this, but I’ll help as much as I can.

Hey chipman! can you open source this script so we can put it in the wiki along with the doc so that it is never lost, please? I think this is one of those “go pro” scripts that really makes Blender suited/applicable for professional use. Would you mind converting your HTML to wiki for the Scripts section?