Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3509 Members - Latest Member: lioneltenel

26. May 2012, 10:17:03 pm
Xith3D CommunityGeneral CategorySupport (Moderator: Marvin Fröhlich)OBJLoader and names in obj-File
Pages: 1 [2]
Print
Author Topic: OBJLoader and names in obj-File  (Read 2292 times)
Andre Pohlmann
Enjoying the stay
*
Offline Offline

Posts: 89


View Profile Email
« Reply #15 on: 22. May 2007, 10:30:16 am »

hmmm...

1. My object is displayed now... My mistake... I had to choose the name from the material not from the o-line. So it works fine ^^

2. @Marvin: System.out.println(mapTG.getChild(0).getName()); returns "top" ...
thats the name set to every copy. That means that every object, attached via sharedCopy() gets this Name... it might be better to set the name to the copied one.
It is not that important to me, except I got a situation where I had to select these objects again and by name Wink

Except these little 'low-bugs' (cant find the right word) it is a good work so far.

Thanks to both of you!
Logged
Andre Pohlmann
Enjoying the stay
*
Offline Offline

Posts: 89


View Profile Email
« Reply #16 on: 02. June 2007, 08:27:12 am »

Hi,

I got definitly a situation where I need to get one shape by name.

Ta-Re and I used to modify the code from FaceList and OBJGroup to solve our problem.
It is not a good solution, so maybe someone will find a better way.

Code:
    @Override
    public Group build(VertexList verts, TexList texs, NormalList normals, LoadedGraph<? super GroupNode> graph, int flags)
    {

        Group group = new Group();
        Group superGroup = super.build(verts, texs, normals, graph, flags, shapeName);
       
        for (int i = 0; i < groups.size(); i++) {
       
            Group childGroup = groups.get(i).build(verts, texs, normals, graph, flags);
        shapeName = groups.get(i).name;
       
            if (childGroup != null) {
            group.addChild(childGroup);
                childGroup.setName(name);
            }
        }
       
        if (superGroup != null) {
        group.addChild(superGroup);
            superGroup.setName(name);
        }
       
        if(name != null && !name.equals("top")) {
        graph.getNamedObjects().put(name, group);
        }
        return group;
    }

That's the modifikation in OBJGroup, therefore a static String shapeName is needed.
If super is called it will deliver the shapeName variable.
In Facelist we overload the method and added a shape.setName(name) after the shapeconstruction.

As long as the obj-files wont change that much, it will work.

Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #17 on: 02. June 2007, 03:25:05 pm »

Are you sure, you committed the change? I can't see it in SVN.

Marvin
Logged
Andre Pohlmann
Enjoying the stay
*
Offline Offline

Posts: 89


View Profile Email
« Reply #18 on: 02. June 2007, 03:30:30 pm »

I am sure that I didn't  Wink

I am no dev and I thought it might be the best if someone looks over it... eg Amos.


Logged
Pages: 1 [2]
Print
Jump to:  

Theme orange-lt created by panic