class classtype_route(Structure):
_pack_ = 1
_fields_ = [("pstr_name",c_uint32),
- ("id_start",c_uint32)]
+ ("id_start",c_uint32),
+ ("colour",c_float*3)]
# Exporter
# ==============================================================================
entdata_length += sizeof( classtype_route )
r = classtype_route()
r.pstr_name = emplace_string("not-implemented")
+ r.colour[0] = obj.cv_data.colour[0]
+ r.colour[1] = obj.cv_data.colour[1]
+ r.colour[2] = obj.cv_data.colour[2]
+
if obj.cv_data.target != None:
- r.target = obj.cv_data.target.cv_data.uid
+ r.id_start = obj.cv_data.target.cv_data.uid
entdata_buffer += [r]
def drawbpath(o0,o1,c0,c1):
drawsbpath(o0,o1,c0,c1,1.0,1.0)
- def drawbline(o0,o1,c0,c1):
+ def drawbline(p0,p1,c0,c1):
nonlocal verts, colours
- verts += [o0.location]
- verts += [o1.location]
+ verts += [p0,p1]
colours += [c0,c1]
-
- for obj in bpy.context.collection.objects:
- if obj.cv_data.classtype == 'k_classtype_gate' and False:
- if obj.cv_data.target != None:
- p0 = obj.location
- p1 = obj.cv_data.target.location
- for i in range(20):
- t = i/20.0
- t1 = (i+0.5)/20.0
-
- pa = p0*t+p1*(1.0-t)
- pb = p0*t1+p1*(1.0-t1)
-
- verts += [(pa[0],pa[1],pa[2])]
- verts += [(pb[0],pb[1],pb[2])]
- colours += [(0,1,0,1.0),(1,0,0,1.0)]
+ for obj in bpy.context.collection.objects:
+ if obj.cv_data.classtype == 'k_classtype_gate':
if obj.type == 'MESH':
dims = obj.data.cv_data.v0
else:
verts += [(v1[0],v1[1],v1[2])]
colours += [(1,1,0,1),(1,1,0,1)]
+ sw = (0.4,0.4,0.4,0.2)
+ if obj.cv_data.target != None:
+ drawbline( obj.location, obj.cv_data.target.location, sw,sw )
+
+ elif obj.cv_data.classtype == 'k_classtype_route_node':
+ sw = Vector((0.4,0.4,0.4,0.2))
+ sw2 = Vector((1.5,0.2,0.2,0.0))
+ if obj.cv_data.target != None:
+ drawbpath( obj, obj.cv_data.target, sw, sw )
+ if obj.cv_data.target1 != None:
+ drawbpath( obj, obj.cv_data.target1, sw, sw )
+
+ drawbhandle( obj, 1.0, (0.8,0.8,0.8,1.0) )
+ drawbhandle( obj, -1.0, (0.4,0.4,0.4,1.0) )
+
+ p1 = obj.location+ \
+ obj.matrix_world.to_quaternion() @ Vector((0,0,-6+1.5))
+ drawbline( obj.location, p1, sw,sw2 )
+
+
elif obj.cv_data.classtype == 'k_classtype_block':
a = obj.data.cv_data.v0
b = obj.data.cv_data.v1
verts += [(v0[0],v0[1],v0[2])]
verts += [(v1[0],v1[1],v1[2])]
colours += [(0,1,1,1),(0,1,1,1)]
-
+
elif obj.cv_data.classtype == 'k_classtype_route':
vs = [None]*2
vs[0] = obj.location
loop_complete = False
while si > 0:
+ if stack_i[si-1] == 2:
+ si -= 1
+ continue
+
+ if si == 0: # Loop failed to complete
+ break
+
node = stack[si-1]
targets = [None,None]
if node.cv_data.classtype == 'k_classtype_route_node':
targets[1] = node.cv_data.target1
-
+
nextnode = targets[stack_i[si-1]]
stack_i[si-1] += 1
si += 1
continue
- if stack_i[si-1] == 2:
- si -= 1
-
- if si == 0: # Loop failed to complete
- break
-
if loop_complete:
course_colours = [Vector((0,0.8,0.2,1.0)), \
Vector((0,0.3,0.9,1.0)), \
target1: bpy.props.PointerProperty( type=bpy.types.Object, name="target1", \
poll=cv_poll_target )
+ colour: bpy.props.FloatVectorProperty(name="colour",subtype='COLOR',\
+ min=0.0,max=1.0)
+
classtype: bpy.props.EnumProperty(
name="Format",
items = [
elif active_object.cv_data.classtype == 'k_classtype_route':
_.layout.prop( active_object.cv_data, "target" )
+ _.layout.prop( active_object.cv_data, "colour" )
elif active_object.cv_data.classtype == 'k_classtype_block':
mesh = active_object.data