0 votes

Hello all. Bold part gives the error. Thanks in advance

extends Camera
var http
var loader
var on = 0
var dir = Directory.new()

const TMPFILE = 'C:/Users/kunaly/Documents/httpclient//tmp0.jpg'

func process(delta):
#checkInput()
if loader:
var err = loader.poll()
if err == ERR
FILEEOF: # load finished
var resource = loader.get
resource()
loader = null
set_image(resource)

func getimage():
http.set
downloadfile('C:/Users/kunaly/Documents/httpclient//temp'+str(on)+'.jpg')
http.request("http://169.0.0.1:5000/image.jpg")

func imagedownloaded(result,responsecode,headers,body):
if result == OK:
if responsecode == 200:
loader = ResourceLoader.load
interactive('C:/Users/kunaly/Documents/httpclient//temp'+str(on)+'.jpg')
set
process(true)

func set_image(resource):
getnode("MeshInstance").getmaterialoverride().setshader_param("Image",resource)

if dir.file_exists('C:/Users/kunaly/Documents/http_client//temp'+str(on)+'.jpg'):
    dir.remove('C:/Users/kunaly/Documents/http_client//temp'+str(on)+'.jpg')

on += 1
get_image()

func ready():
set
process(true)
#setprocessinput(true)
http = getnode("HTTPRequest")
http.set
usethreads(true)
http.connect("request
completed",self,'image_downloaded')

##
#httpInputRequest = get_node("httpInputRequest")
##could put a return request here
get_image()
in Engine by (12 points)
edited by

1 Answer

0 votes

You're attempting to call a function called set_shadder_param on something that is a null instance (i.e. doesn't exist, thus does not have such a function). To fix that, select the MeshInstance-node in the scene tree, then unfold the "Geometry"-section in the property inspector and create a new Shader-/SpatialMaterial as "Material Override".

by (10,329 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.