X3D: Don't write line-no into objects by default

This is handy for debugging, not general use.
so only do this when DEBUG is set.

Also use a custom property instead of registering RNA.
This commit is contained in:
Campbell Barton 2015-10-24 14:49:09 +11:00
parent f780885f11
commit 22602daa3d
1 changed files with 3 additions and 7 deletions

View File

@ -3024,10 +3024,12 @@ def importShape_ProcessObject(vrmlname, bpydata, geom, geom_spec, node,
# the data
# bpymesh.transform(getFinalMatrix(node))
bpyob = node.blendObject = bpy.data.objects.new(vrmlname, bpydata)
bpyob.source_line_no = geom.lineno
bpyob.matrix_world = getFinalMatrix(node, None, ancestry, global_matrix)
bpy.context.scene.objects.link(bpyob).select = True
if DEBUG:
bpyob["source_line_no"] = geom.lineno
def importText(geom, ancestry, bpyima):
fmt = geom.getChildBySpec('FontStyle')
@ -3454,12 +3456,6 @@ def load_web3d(path,
# Used when adding blender primitives
GLOBALS['CIRCLE_DETAIL'] = PREF_CIRCLE_DIV
# Enable custom property for source line number
if not hasattr(bpy.types.Object, "source_line_no"):
bpy.types.Object.source_line_no = bpy.props.IntProperty(
name="Source Line #",
description="Node position in the source X3D/VRML file")
#root_node = vrml_parse('/_Cylinder.wrl')
if path.lower().endswith('.x3d'):
root_node, msg = x3d_parse(path)