When compiling to Python, I got an unbound variable error for an extern for Blender's mathutils.Vector class. The error is triggered when I do:
vertex.co[0] += xOffset;
vertex.co[1] += yOffset;
vertex.co[2] += zOffset;
vertex.co[0] = vertex.co[0] + xOffset;
vertex.co[1] = vertex.co[1] + yOffset;
vertex.co[2] = vertex.co[2] + zOffset;
Unbound variable, please report this
{
v_id = 17787;
v_name = `;
v_type = blendhaxe.mathutils.Vector;
v_capture = false;
v_extra = None;
v_meta = [];
v_pos = src/duflite/functions/MorphMesh.hx: 1528-1551;
}
Unbound variable, please report this
{
v_id = 17788;
v_name = `;
v_type = blendhaxe.mathutils.Vector;
v_capture = false;
v_extra = None;
v_meta = [];
v_pos = src/duflite/functions/MorphMesh.hx: 1566-1589;
}
Unbound variable, please report this
{
v_id = 17789;
v_name = `;
v_type = blendhaxe.mathutils.Vector;
v_capture = false;
v_extra = None;
v_meta = [];
v_pos = src/duflite/functions/MorphMesh.hx: 1604-1627;
}
src/duflite/functions/MorphMesh.hx:24: lines 24-68 Compiler failure: Failed to locate variable declaration
src/duflite/functions/MorphMesh.hx:24: lines 24-68 Please submit an issue at https://github.com/HaxeFoundation/haxe/issues/new
src/duflite/functions/MorphMesh.hx:24: lines 24-68 Attach the expression example and the following information:
Haxe: 4.3.7; OS type: windows;
File "src/filters/renameVars.ml", line 336, characters 20-27
Called from RenameVars.run in file "src/filters/renameVars.ml", line 336, characters 2-27
Called from Stdlib__List.fold_left in file "list.ml", line 121, characters 24-34
Called from TUnification.rec_stack_loop in file "src/core/tUnification.ml", line 458, characters 10-15
Called from FiltersCommon.run_expression_filters.process_field in file "src/filters/filtersCommon.ml", line 75, characters 23-71
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
Called from FiltersCommon.run_expression_filters in file "src/filters/filtersCommon.ml", line 81, characters 2-46
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
Called from Filters.run in file "src/filters/filters.ml", line 1015, characters 1-96
Called from Compiler.filter in file "src/compiler/compiler.ml", line 309, characters 1-81
Called from Compiler.compile in file "src/compiler/compiler.ml", line 344, characters 3-33
Called from Compiler.compile_safe in file "src/compiler/compiler.ml", line 364, characters 1-5
Called from Compiler.compile_ctx.run in file "src/compiler/compiler.ml", line 451, characters 2-162
Called from Compiler.catch_completion_and_exit in file "src/compiler/compiler.ml", line 425, characters 2-9
Called from Compiler.HighLevel.entry.loop in file "src/compiler/compiler.ml", line 647, characters 5-43
Called from Compiler.HighLevel.entry in file "src/compiler/compiler.ml", line 657, characters 13-22
Called from Server.process in file "src/compiler/server.ml", line 971, characters 1-39
Called from Dune__exe__Haxe in file "src/compiler/haxe.ml", line 53, characters 0-56
File "src/core/globals.ml", line 156, characters 1-7: Assertion failed
package blendhaxe.mathutils;
// python
import python.Exceptions;
import python.Tuple;
// blendhaxe
import blendhaxe.Enums;
import blendhaxe.math.PyMath;
@:pythonImport("mathutils", "Vector")
private extern class Vector_Impl implements ArrayAccess<Float> {
public static function Fill(size:Int, ?fill:Float=0.0): Vector;
public static function Linspace(start:Float, stop:Float, size:Int): Vector;
public static function Range(start:Int, stop:Int, ?step:Int=1): Vector;
public static function Repeat(vector:Vector, size:Int): Vector;
public function angle(other:Vector, ?fallback:Dynamic=null): Dynamic;
public function angle_signed(other:Vector, ?fallback:Dynamic=null): Dynamic;
public function copy(): Vector;
public function cross(other:Vector): Dynamic;
public function dot(other:Vector): Float;
public function freeze(): Vector;
@:native("__getitem__")
public function get(index:Int): Float;
@:native("__len__")
public function len(): Int;
public function lerp(other:Vector, factor:Float): Vector;
public function negate(): Void;
public function new(seq:Array<Float>): Void;
public function normalize(): Void;
public function normalized(): Vector;
public function orthogonal(): Vector;
public function project(other:Vector): Vector;
public function reflect(mirror:Vector): Vector;
public function resize(size:Int): Int;
public function resize_2d(): Void;
public function resize_3d(): Void;
public function resize_4d(): Void;
public function resized(size:Int): Vector;
public function rotate(other:Dynamic): Void;
public function rotation_difference(other:Vector): Quaternion;
@:native("__setitem__")
public function set(index:Int, value:Float): Void;
public function slerp(other:Vector, factor:Float, ?fallback:Dynamic=null): Vector;
public function to_2d(): Vector;
public function to_3d(): Vector;
public function to_4d(): Vector;
public function to_track_quat(?track:AxisSigned=AxisSigned.Z_POS, ?up:Axis=Axis.Y): Quaternion;
public function to_tuple(?precision:Int=-1): Tuple<... Float>;
public function zero(): Void;
public var is_frozen:Bool;
public var is_valid:Bool;
public var is_wrapped:Bool;
public var length:Float;
public var length_squared:Float;
public var magnitude:Float;
public var owner:Dynamic;
public var w:Float;
public var x:Float;
public var y:Float;
public var z:Float;
}
@:forward @:forwardStatics
abstract Vector(Vector_Impl) from Vector_Impl to Vector_Impl {
@:op(A + B)
public function addVector(other:Vector): Vector {
checkLength(other);
var values:Array<Float> = [ for (i in 0 ... this.len()) this[i] + other[i] ];
return new Vector_Impl(values);
}
private function checkLength(other:Vector): Void {
var msg:String = "Vector dimensions do not match";
if (this.len() != other.len()) { throw new RuntimeError(msg); }
return;
}
@:op(A / B)
public function divideFloat(divisor:Float): Vector {
var values:Array<Float> = [ for (i in 0 ... this.len()) this[i] / divisor ];
return new Vector_Impl(values);
}
@:op(A == B)
public function equality(other:Dynamic): Bool {
if (Std.isOfType(other, Vector_Impl) == false) {
return false;
}
var that:Vector = cast other;
var length:Int = this.len();
if (length != that.len()) {
return false;
}
for (i in 0 ... length) {
if (PyMath.isclose(this[i], that[i]) == false) {
return false;
}
}
return true;
}
@:op([])
public function get(index:Int): Float;
public function new(seq:Array<Float>): Void {
if (seq.length < 2) {
throw new RuntimeError("Vector must have at least two dimensions");
}
this = new Vector_Impl(seq);
return;
}
@:op(A * B)
public function multiplyVector(other:Vector): Vector {
checkLength(other);
var values:Array<Float> = [ for (i in 0 ... this.len()) this[i] * other[i] ];
return new Vector_Impl(values);
}
@:op(A * B)
public function multiplyFloat(scalar:Float): Vector {
var values:Array<Float> = [ for (i in 0 ... this.len()) this[i] * scalar ];
return new Vector_Impl(values);
}
@:op(-A)
public function negate(): Void;
@:op([])
public function set(index:Int, value:Float): Void;
@:op(A - B)
public function subtractVector(other:Vector): Vector {
checkLength(other);
var values:Array<Float> = [ for (i in 0 ... this.len()) this[i] - other[i] ];
return new Vector_Impl(values);
}
}
When compiling to Python, I got an unbound variable error for an extern for Blender's
mathutils.Vectorclass. The error is triggered when I do:But this works:
Error message:
Class definition when error was hit: