English Envmap_o_matic:Problem!

I downloaded the english version of the Envmap_o_matic and when I run it I get “python script error-check console”. Then highlighted in red is:

ob=Blender.Object.Get(PlaneObname)

I name the plane “Mirror.001”, so I don’t know what the problem is.
I’m using Blender 2.28c

Here is the rest of the code:

##########################

jm soler © june 2001->february 2002

Python’s Mirror-O-Matic

##########################3
import Blender
from Blender import Object
from Blender import NMesh
import sys

PlaneObname=‘Mirror.001’
EmptyObCibleName=‘Mirror_Prime’
CameraName=‘Camera.001’

a=0
b=0
c=0
d=0

x,y,z=0.0,0.0,0.0

def multmat(M):
global x,y,z
x1 = (x * M[0][0]) + (y * M[1][0]) + (z * M[2][0]) + M[3][0]
y1 = (x * M[0][1]) + (y * M[1][1]) + (z * M[2][1]) + M[3][1]
z1 = (x * M[0][2]) + (y * M[1][2]) + (z * M[2][2]) + M[3][2]
#w1 = (x * M[0][3]) + (y * M[1][3]) + (z * M[2][3]) + M[3][3]
x=x1;y=y1;z=z1

coefficients du plan

#----------------------------------------------

similar function is used in tesselate

script but the effect is limited to

the local objetc space

def EquationPlan (v1,v2,v3,M):
global a,b,c,d,x,y,z

#get vertice coord in local object space
x =v1.co[0] 
y =v1.co[1]
z =v1.co[2]
#set point in global  Blender space
multmat(M)
X1=x; Y1=y; Z1=z;

#repeat with second point
x =v2.co[0] 
y =v2.co[1]
z =v2.co[2]
multmat(M)
X2=x; Y2=y; Z2=z;

#repeat with third point
x =v3.co[0] 
y =v3.co[1]
z =v3.co[2]
multmat(M)
X3=x; Y3=y; Z3=z;


a  = Y1 * (Z2 - Z3) + Y2 * (Z3 - Z1) + Y3 * (Z1 - Z2)
b  = -X1 * (Z2 - Z3) + X2 * (Z1 - Z3) - X3 * (Z1 - Z2)
c  = X1 * (Y2 - Y3) - X2 * (Y1 - Y3) + X3 * (Y1 - Y2)
d  = -X1*(Y2*Z3-Y3*Z2)+X2*(Y1*Z3-Y3*Z1)-X3*(Y1*Z2-Y2*Z1)

#Point miroite dans le plan
def point_miroite(nx,ny,nz,k,p):
A=-2*(nxp[3][0]+nyp[3][1]+nzp[3][2]+k)/(nxnx+nyny+nznz)
print p[3][0]
Z=[nxA+p[3][0], nyA+p[3][1], nz*A+p[3][2]]
return Z

def testmirror():
global a,b,c,d
ob=Blender.Object.Get(PlaneObname)
P0=NMesh.GetRaw(PlaneObname)

#------------------------------
# Matrix is needed but 
# curiously get the whole
# and try to read parts of it
# may crash down blender 
#-------------------------------
mat1=ob.mat[0]
mat2=ob.mat[1]
mat3=ob.mat[2]
mat4=ob.mat[3]
mat0=[mat1,mat2,mat3,mat4]

obcible=Blender.Object.Get(EmptyObCibleName)

camera=Blender.Object.Get(CameraName)

if (ob==None):
    return
elif (obcible==None):
    return
elif (camera==None):
    return
else:
    me=ob.data
    cible=obcible.data
    nom=me.name
    #v=me.verts[0]
    f = me.faces[0]
    dv=f.v

    EquationPlan (dv[0],dv[1],dv[2],mat0)
    print 'ok'
    #print a,b,c,d
    obcible.LocX,obcible.LocY,obcible.LocZ= point_miroite(a,b,c,d,camera.mat)

testmirror()
sys.stdout.flush()

Make sure it’s the name of the OBject, not the name of the MEsh.

Martin

Thanks

That was the problem?

Martin

You could try the other Alt Key with P when running the script, I find this can help some scripts to run which have the similar error message as your problem is producing.

Withnail.

Objects appear to be rendered larger in mirror than actually modeled.
Is this normal?

Can we see a picture?

(the author of the script)

I don’t have a website to upload the image

I just used the script in the rippled water tutorial in the 2.0 guide and the same thing happened. Objects are reflected larger than modeled.

You can send an example to my email address.

Having problems connecting to your site, will try later.

If the reflection is too large, it means the empty is too close to the object relative to the camera, so it sounds like the envmap-o-matic has made a serious miscalculation.

The empty is at the right place .

I received the file weeks ago and :
1/ there is no reflexion in this file because the “image”
seen by rgs3 is not a reflected image but the objet itself. This
object is exactly between the mirror and the camera…
2/ the envmap was not correctly defined, in fact: it was not
defined at all.