getting a list of ObjectType and Tags[SOLVED]

Cheers all,

Currently working on a project that is going to involve Panda3d and Pure Data. There is specific information embedded in our blender model egg via ObjectType and Tags that we are trying to get at in order to then parse that information thru to Pure Data to automatically generate subpatches. At the moment I am a bit stuck.

The following is what I’ve done so far.

In Blender:

  • added an ObjectType tag to define whether the model is a space or an aperture
  • added additional tags to the model that are specific to parameters that need to be transmitted over to Pure Data
  • exported the egg and viewed to ensure the info is there

In Panda:

  • added to the config.prc file both space and apertures as follows:

egg-object-type-aperture aperture { 1 }
egg-object-type-space space { 1 }

What I need to be able to get it to do:

  • get a list of ObjectTypes, which objects are apertures and which are spaces
  • get a list of the tags that are associated with those specific tags so that I can parse out the object with its parameters out to Pure Data via OSC

I am a rookie programmer and with Panda/python so I am unsure it this is the right approach to take. At the moment it just queries for the ‘atten’ tag. I tried the listTags(ostream) but realized that the info goes to the console so it’s commented out.

Is there a command where I can get it or query to list out the ObjectTypes?

How can I get at the tag info without having to query it individually?

Thanks for any pointers / help in advance. Again, I am new at this so pardon for any confusion or ill use of terms, etc.

I get it to list out (partial list) of which I need to send via OSC what is in brackets:

S5 does not have atten
ModelNode S4 [absorb basicSpace dim material] T:m(pos -3.8856 0.001349 0.960276)

A1 has atten
ModelNode A0 [atten direction filter] T:m(pos 14.755 0.329209 1.01629)

Here is the code so far:

import direct.directbase.DirectStart

def getInfo (nodepath,depth):
for i in range(0,depth):
print " ",
n = nodepath.getNode(0); print n
node_name = n.getName()

#p = n.listTags(ostream)

if n.hasTag("atten"):
	print node_name + " has atten"
	print node_name + " does not have atten"
    #print n.getTag("atten")

for np2 in nodepath.getChildren():

environ = loader.loadModel(model)

#sets % transparency & true for the environ model
environ.setAlphaScale(0.5) (1,-20,15),0,0)


run() :confused:

I’m not quite sure what you’re up to, but maybe you meant to map the ObjectTag into “atten” tags? That would be more like:

egg-object-type-aperture <Tag> atten { aperture }
egg-object-type-space <Tag> atten { space }


how would i call up a list of the tags?

What’s wrong with the code you have written? Seems like it would find all nodes with tag “atten”. Isn’t that what you want?


sorry, i am new at this. not sure i am using the right syntax to describe this

i just want to be able to query the objecttype, aperture or space, and then have it spit out a list of the tags associated with those objects and their values.

i don’t want to have to query each one individually, it would be nice to be able to do that dynamically. the syntax may change and there may be more tags that we need to send from the model to pure data.

i have been unable to locate how to query the objecttype…where in the node is that? all i get are modelnode, modelnode, etc.

ObjectType doesn’t exist in the loaded model. It’s only an egg syntax, and it’s basically a macro substitution for some other egg syntax. You get to say what each ObjectType get converted into. Whatever it gets converted into, you can look for that in the resulting model, but you can’t look for the ObjectType, because it’s gone.

(If you really do want to look for the ObjectType itself, you have to load up the egg file via the EggData interface. But I doubt this is what you really want.)

To get a list of tags on the node, use something like this:

s = StringStream()
tags = s.getData().split('\n')

But I’m not sure what you mean exactly by “aperture” and “space”. Those don’t sound like concepts in Panda3D. Are they Blender concepts? Are they concepts in your own system? How do you intend to represent these concepts in the scene graph–do you want a tag called “aperture” with a particular value, or do you want a tag called “atten” with a value of “aperture”?


Thanks for the response and help David!

A little background on the project and where this space and aperture concept is coming from. The project is making a VR soundscape exploration environment in Panda that works in conjunction with generating real time sounds in Pure Data. The Panda scene is going to have a model with rooms (spaces) and doorways (apertures). There will also be sound emanating objects which will be affected by the spaces. In order to work out the spatialization in the sound synthesis for the listener we need to know the path from the sound object to the listener(ie. sound object, in a room, thru an aperture, thru a room, to the listener. This is being done with a pathfinding algorithm in Panda.

Now, in blender, the multi-room model is being marked with dummy objects at each doorway (aperture) and each room (space) that have tags denoting room dimension, material assignments, filters that all need to be parsed via panda thru OSC to pure data where pure data will automatically generate sub patches based on all these attributes. The aperture and space objects also need to get parsed to the pathfinding algorithm - but that is irrelevent at this point.

pure data is basically going to need to know: aperture or space?
if aperture, what’s the name, the tags and values
if space, what’s the name, the tags and values

I would like to be able to set a tag for the object name to be either aperture or space and then have a bunch of other tags describing the attributes of the space (room) or aperture (doorway/opening)

ha! I was wondering about StringStream, but the more I had looked into the resources it seemed that it was something used for external assets.

Thank you David!

StringStream worked perfectly!