Retrieving Egg Tags

I’m looking to store a mass value in the egg files for use with physics.
I exported a plane with a tag, for testing purposes

<CoordinateSystem> { Z-up }

<Comment> { "Egg laid by Chicken for Blender vR44" }

<Group> Plane {
  <Transform> {
    <Matrix4> {
      1.000000 0.000000 0.000000 0.000000
      0.000000 0.000000 1.000000 0.000000
      0.000000 -1.000000 0.000000 0.000000
      0.000000 0.000000 0.000000 1.000000
    }
  }
  <Tag> weight { 425 }
  <VertexPool> Plane {
    <Vertex> 0 {
      1.0 3.42285417787e-008 0.999999940395
    }
    <Vertex> 1 {
      -0.999999642372 3.42285559896e-008 1.00000035763
    }
    <Vertex> 2 {
      -1.00000011921 -3.42285346733e-008 -0.999999821186
    }
    <Vertex> 3 {
      1.0 -3.42285417787e-008 -1.0
    }
  }
  <Polygon> {
    <Normal> { 0.000000 -1.000000 0.000000 }
    <VertexRef> { 0 1 2 3 <Ref> { Plane } }
  }
}

I’m trying to retrieve the value of the weight tag. Is it possible to do this in code? I tried using getTag and getNetTag, but they both returned empty strings.

object=loader.loadModel('./test.egg') #load the model
print object.getNetTag('weight')

Is it possible to get the value of the tag, and how would i go about retrieving it?

You need to find the plane node and then as for its weight

import direct.directbase.DirectStart
m = loader.loadModel('./help.egg') #load the model
m.ls()
plane = m.find("**/Plane")
plane.ls()
print plane.getNetTag('weight') 

output:

ModelRoot help.egg
  PandaNode 
    GeomNode Plane (1 geoms) [weight] T:m(hpr 0 90 0)
GeomNode Plane (1 geoms) [weight] T:m(hpr 0 90 0)
425

Thanks for your help. :slight_smile: