Assertion Error

I’ve tried to tease this out. I don’t know what I’m doing wrong. Running Win32, P3D 1.7.2 from the terminal.

Assertion failed: (_flags & F_lock_count) != 0 at line 68 of c:\buildslave\release_sdk_win32\build\panda3d\built\include\mutexSimpleImpl.I

I’ve narrowed the code to this line (when it’s commented out there’s no problem.):

vertWriter.addData3f(point)

a few lines before the vertWriter is constructed

formatArray=GeomVertexArrayFormat()
format=GeomVertexFormat(GeomVertexFormat.getV3n3())
format.addArray(formatArray)
format=GeomVertexFormat.registerFormat(format)
vdata=GeomVertexData("body vertices", format, Geom.UHStatic)
vertWriter=GeomVertexWriter(vdata, "vertex")

The “point” argument of the vertWriter call is the product of this line:

point = self.spinnerets[i].getPos(NP)

Any help would be most appreciated. I need to get this to work for a project I’m working on.

This is a threading problem. It’s not related to the actual line that reports the error, but indicates that something has gone corrupt in the low-level threading primitives.

Perhaps you have multiple threads accessing Panda objects, using the standard python threading library, instead of stdpy.threading?

David

Thanks for the reply David,

I don’t think I’m doing anything with multiple threads.

The code is in a standard ‘for’ loop. In fact, the Fractal Plant example runs fine on my box. But I can’t tell how what I’ve written is structurally different than the sample. If anything my version is more simple since I’m not doing multiple recursive iterations like in the sample.

I do have a webcamera running. But I don’t know why that would make a difference. I also have an ARtoolkit marker in the scene but it’s not directly related to what I’m doing here.

Hmm, can you create a simple program that reproduces the crash?

David

Sure. Thanks so much for the help. I copied the relevant code. This small program gives me the same crash- same place.

from pandac.PandaModules import * 
from direct.directbase.DirectStart import *
formatArray=GeomVertexArrayFormat()
format=GeomVertexFormat(GeomVertexFormat.getV3n3())
format.addArray(formatArray)
format=GeomVertexFormat.registerFormat(format)
vdata=GeomVertexData("body vertices", format, Geom.UHStatic)
vertWriter=GeomVertexWriter(vdata, "vertex")

startRow = vdata.getNumRows()
vertWriter.setRow(startRow)
imageCoordinates = [[388,366],[423,374],[446,404],[425,432],[388,440],[356,434],[331,404],[349,376]]
NP = NodePath('NP')
NP.reparentTo(render)
x_half = 512
y_half = 512
spinneret = NodePath('spin')
spinneret.reparentTo(render)
for i in range(len(imageCoordinates)):
	
	coordinates = imageCoordinates[i]
	x = float(coordinates[0])
	y = float(coordinates[1])
	dx = (x-x_half)/(2*x_half)  
	dy = (y-y_half)/(-2*y_half)
	spinneret.setPos(dx,dy,0)  
	point = spinneret.getPos(NP)
	vertWriter.addData3f(point)   #Vertex writer saves the 3D position

Ah, you have created a GeomVertexFormat with two arrays, one of which is completely empty. I think this empty array is causing problems. Is there any reason for this array? If you add even one column to the array, the problem goes away:

formatArray=GeomVertexArrayFormat()
formatArray.addColumn('foo', 1, Geom.NTUint8, Geom.COther)

I should add a check to GeomVertexFormat.registerFormat() that there are no empty arrays; that can only be a mistake.

David

PERFECT!!!

Thank you so much. I would have never found it. I obviously don’t really understand very much of the vertex arrays even after reading the manual multiple times.

Thanks again.