Export to .smc addon: ValueError: too many values to unpack (expected 3)

First things first, I’m not experienced with Blender at all (actually, I never used it before :stuck_out_tongue: ). Also, I know nothing of Python since I am so used to AngleScript. So, here’s some backstory: This game called “Cube 2: Sauerbraten” has an ingame editor. A user modified the game to import .smc models as world geometry. He gave an addon that converts any model into .smc for use in his modified version of the game to import that .smc. I just got a random chair model from Yobi 3D. I can import the model fine. I then enable the addon. After that I go to “Export -> Sauerbraten (.smc)”. It doesn’t do anything and just displays an error on the top right. I went into the console and this is the output:

---- Sauerbraten Exporter ----
Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\io_expor
t_smc.py", line 223, in execute
    grid.solve(obj,mesh,props.useExpPIM,self.progress_bar)
  File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\io_expor
t_smc.py", line 84, in solve
    location, normal, index = obj.closest_point_on_mesh(p)
ValueError: too many values to unpack (expected 3)


location: <unknown location>:-1


location: <unknown location>:-1

If it is any help, I'm on a Windows 7 Professional PC with Blender 2.78 installed

Also, the addon is found at: “https:// github .com/wrack/blender-smc-exporter”

Help?

Edit:
If you can’t get it by the url, I attached the addon to this post.

Attachments

io_export_smc.zip (2.98 KB)

    location, normal, index = obj.closest_point_on_mesh(p)
ValueError: too many values to unpack (expected 3)

Mesh might need to be triangulated.

Select your object
Tab into Edit mode
Select all of the mesh (toggled by A)
Ctrl T
Tab into Object mode
Export

Didn’t check the script / could be wrong.

Nope didn’t work. After checking lines 84 and 223 of the addon code (I didn’t know what I was looking at), I researched a bit and that a function with “=” has to have 3 values after it (that’s why it expected 3). But what is weird is that it HAS 3 variable after it. I’m confused, but of course I am, I know nothing about Python :spin: )

Author is using Blender 2.61 https://www.youtube.com/watch?v=bHa9MK-lxUI which you can get here https://download.blender.org/release/Blender2.61/

Ok, so now every object I open is now stuck in wireframe mode! I’ve researched and this setting minimum draw type has to be changed… though I noticed most of the models I open are missing many parts than seen in the newer blender version. So I can’t actually select the MODEL itself, only lights, and an invisible mesh. Help? I am attaching the model here. [REMOVED]

Edit: nvm, I ripped the model in the newer version and I tried to open it up in the older version. That error pop-up went away too quick.

Using this to rip the model, apparently I can only use the newer version of blender to rip it. So, I am going to save a copy of the blend model with legacy mesh format option. I’ll edit this post to see how it goes.

QUOTE:

That worked thanks

You can update the addon for Blender 2.78 . (See Api 2.78)

New version of the function object.closest_point_on_mesh returns four parametrs.

Return (result, location, normal, index):
result type: boolean

(line 84)
should be


result, location, normal, index = obj.closest_point_on_mesh(p)

The property object.data.faces now is called polygons: (line 106 )


v = mesh.vertices[mesh.polygons[index].vertices[i]]

Nope, got this: (plus, using the older version works just fine.)

---- Sauerbraten Exporter ----Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\io_expor
t_smc_updated.py", line 223, in execute
    grid.solve(obj,mesh,props.useExpPIM,self.progress_bar)
  File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\io_expor
t_smc_updated.py", line 91, in solve
    if self.pointInsideMesh(p,obj):
  File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\io_expor
t_smc_updated.py", line 125, in pointInsideMesh
    location,normal,index = ob.ray_cast(orig,orig+axis*10000.0)
ValueError: too many values to unpack (expected 3)


location: <unknown location>:-1


location: <unknown location>:-1

line 125


                result,location,normal,index = ob.ray_cast(orig,orig+axis*10000.0)