[Add-on] Snap Reflection Tool

I came a cross a what ever to this add-on https://developer.blender.org/T35069
It lets you “snap Reflection” - align light to exact place where you need reflection.
Seems to me quite powerful tool for product designers to light object in easy way.

Just a quick test …

Is there a build to test ?

I found the .py ^^


But on my test the light dosn’t take the orientation.


Thanks @vklidu, I try it speedly…

@pitiwazou: I used the same add-on (post 2015/5/12). Hmmm …
I tried point, sun, area, object lights and I can’t confirm that result.
I tried persp and ortho view - seems to me OK.

Now I tried Spot too and it goes somehow quite OK. I just noticed - lamp is not going always in normal direction, but probably it is correct to result wit reflection on touched place.
I’m not good for that, but probably its the right angle to get rays into a camera.
I mostly tried live render (shift+Z) just to place reflection and it seems to me it works.

I will try it again in n my spare time …

Hi there! I’m the author of this thing, thanx for checking this out :slight_smile:
I am aware this is very rough in places and I am planning a second round of fixes / enhancements for the near future… also open for suggestions…

@pitiwazou: there is a shortcut that toggles the orientation: LEFT_ALT while dragging --> could you check if this works for you?
@vklidu: there is an option “Bend towards diffuse shading”: if you turn this up to 1 it will point in the direction of the normal (which gives maximum reflectance for diffuse shaders), otherwise it will point to the reflectance vector (which obviously gives the maximum of very shiny shaders) --> could you check if this works for you?

I ran script from test editor and get an error

aceReflectionTool.py", line 763, in draw
KeyError: ‘bpy_prop_collection[key]: key “main” not found’

can you explain how do you work with this ?
I can see panel in tool panel but nothing appears there

happy bl

@2d23d Thank you for developing and sharing this code!

When i try to run python addon on a recent (including today’s) blender from builder i get following error

line 1084, in modal
    (bHit, oHitOb, oHitMat, vHitLoc, vHitNormal) = oScene.ray_cast(ray_origin, ray_target)
ValueError: too many values to unpack (expected 5)

Error is triggered by mouse movement, 3dview is stuck until selected before Lamp is moved.
Appreciate any suggestions on what could be the reasons behind this.

Edit: If i change line 1084 to

bHit, vHitLoc, vHitNormal, f_index, oHitOb, oHitMat   = oScene.ray_cast(ray_origin, ray_target)

i get addon working. Not sure this is the right order though.

Edit2: Should be correct according to this page

again: thanx for checking this out!
@RickyBlender: meant to be installed as an addon (e.g. via User Preferences)
@eppo: yep, I recall there was a change in the py API recarding ray_cast, will post a working version (also including some other changes) in a couple of days…

Yeah :slight_smile: So, I was right :slight_smile: OK - It works perfectly. Thank you