• Website
  • Search
  • Member List
  • Help
  • Old Forum
  • Social Media
    •   @Wings3dOfficial
    •   @Wings3dOfficial
    •   Wings3dOfficial
    •   Wings3dOfficial
  • Register
  • Login
  • Website
  • Search
  • Member List
  • Help
  • Old Forum
  • Register
  • Login
Wings 3D Development Forum Wings 3D Programming v
1 2 3 4 Next »
batch importer

 
  • 0 Vote(s) - 0 Average
batch importer

hartsantler
Offline

Junior Member

Posts: 8
Threads: 3
Joined: Sep 2018
#1
09-08-2018, 04:12 PM
I am trying to figure out how to batch import multiple obj and collada files when wings starts up.
I'm new to erlang, and taken a look at the code in: e3d_obj.erl, wings_console.erl, wings_start.erl, wpa.erl, wpc_collada.erl, and wings_plugin.erl.

So far i have this code, which loads my obj, but then fails to update the view or show it in the Wings UI. What am i missing?

Code:
{ok, E3DFile} = e3d_obj:import("/home/username/test.obj").
St0 = wpa:get_state().
wings_import:import(E3DFile, St0).

https://github.com/dgud/wings/issues/298
micheus
Offline

Forum's Admin and Support | Bug fixer
Posts: 3,675
Threads: 183
Joined: Jun 2012
#2
09-08-2018, 08:31 PM (This post was last modified: 09-08-2018, 08:31 PM by micheus.)
I'm not expert, so maybe my suggestion can not to work. Smile

Import will return the new #st{}, then maybe you just need to update it by send that information to the main geometry window who handle most the command messages:
Code:
...
St = wings_import:import(E3DFile, St0),
wings_wm:send_after_redraw(geom, {update_state,St}).
[Image: tw.png] @MicheusVieira [Image: yt.png] @MicheusVieira [Image: da.png] Micheuss [Image: ig.png] micheus4wings3d
* Wings3D Team stands for: Björn and Dan
hartsantler
Offline

Junior Member

Posts: 8
Threads: 3
Joined: Sep 2018
#3
09-08-2018, 09:00 PM
actually i'm getting an error from `wings_import:import(E3dFile, wpa:get_state()).`
the error is:
Code:
** exception error: no function clause matching
                    gb_trees:get_1(wings_shape,nil) (gb_trees.erl, line 244)
     in function  wings_shape:new/3 (wings_shape.erl, line 64)
     in call from wings_import:translate_objects/7 (wings_import.erl, line 46)
     in call from wings_import:import/2 (wings_import.erl, line 31)
micheus
Offline

Forum's Admin and Support | Bug fixer
Posts: 3,675
Threads: 183
Joined: Jun 2012
#4
09-08-2018, 09:12 PM
Did you already tried to print out the value of St0 in the line bellow?
St0 = wpa:get_state().
[Image: tw.png] @MicheusVieira [Image: yt.png] @MicheusVieira [Image: da.png] Micheuss [Image: ig.png] micheus4wings3d
* Wings3D Team stands for: Björn and Dan
hartsantler
Offline

Junior Member

Posts: 8
Threads: 3
Joined: Sep 2018
#5
09-08-2018, 09:53 PM
printing St0 gives this:
Code:
{st,
                              {0,nil},
                              face,false,[],
                              {0,nil},
                              none,
                              {1,
                               {default,
                                [{maps,[]},
                                 {opengl,
                                  [{ambient,
                                    {0.7898538076923077,0.8133333333333334,
                                     0.6940444444444445,1.0}},
                                   {diffuse,
                                    {0.7898538076923077,0.8133333333333334,
                                     0.6940444444444445,1.0}},
                                   {emission,{0.0,0.0,0.0,1.0}},
                                   {shininess,0.0},
                                   {specular,{0.0,0.0,...}},
                                   {vertex_colors,set}]}],
                                nil,nil}},
                              [],undefined,false,1,none,none,
                              {0,{}},
                              {0,nil},
                              ignore,undefined,undefined,
                              {ignore,ignore},
                              empty_scene,
                              {[],[]},
                              true,[]}])
micheus
Offline

Forum's Admin and Support | Bug fixer
Posts: 3,675
Threads: 183
Joined: Jun 2012
#6
09-08-2018, 10:58 PM
Yeap, it's a invalid (null) #st{}
[Image: tw.png] @MicheusVieira [Image: yt.png] @MicheusVieira [Image: da.png] Micheuss [Image: ig.png] micheus4wings3d
* Wings3D Team stands for: Björn and Dan
« Next Oldest | Next Newest »

Users browsing this thread: 3 Guest(s)



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D - Powered by MyBB

Linear Mode
Threaded Mode