Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 
Share Thread:
Reddit Facebook Twitter
Objects exported in reverse order
01-26-2013, 07:47 PM (This post was last modified: 01-26-2013 07:53 PM by micheus.)
Post: #5
RE: Objects exported in reverse order
oort, I don't think the wings_export.erl must be changed. It's working as it is - in this case. As each exporter has its particularities I believe that is our responsibility as programmer work around this kind of "problem".

I took a look at the code again (I couldn't change it and test), but - in accord with you've answered me - I believe that the meshlights are being exported in this part of the code:
Code:
section(F, "Objects"),
    foreach(fun (#e3d_object{name=Name,obj=Mesh}) ->
            export_object(F, "w_"++format(Name), Mesh, MatsGb),
            println(F)
        end, Objs),
foreach just call the function passing each item in its order in the list.

If you've changed the result order when changed wings_export file, it seems that you will need only to use an other "integrator" in this code above.
Try to change the code to this one:
Code:
section(F, "Objects"),
    foldr(fun (#e3d_object{name=Name,obj=Mesh}, _) ->
            export_object(F, "w_"++format(Name), Mesh, MatsGb),
            println(F)
        end, [], Objs),

or you can use that one already existent, but reverting the list of objects before use it:
Code:
section(F, "Objects"),
    foreach(fun (#e3d_object{name=Name,obj=Mesh}) ->
            export_object(F, "w_"++format(Name), Mesh, MatsGb),
            println(F)
        end, reverse(Objs)),

and if you still need to change the ID sequence, you can use my first suggestion with some small changes to the code:
Code:
section(F, "Objects"),
    foldr(fun (#e3d_object{name=Name,obj=Mesh}, Id) ->
            export_object(F, "w_"++format(Name), Mesh, MatsGb, Id),
            println(F),
            Id+1
        end, 0, Objs),
and then you need to add the Id parameter to export_object function.
Reply


Messages In This Thread
Objects exported in reverse order - oort - 01-25-2013, 06:33 AM
RE: Objects exported in reverse order - micheus - 01-26-2013 07:47 PM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)