Quantcast

Jump to content

» «
Photo

[REL|Beta] DFF Import/Export script for Blender

152 replies to this topic
GT-1
  • GT-1

  • Feroci Racing
  • Joined: 21 Nov 2003

#61

Posted 10 May 2004 - 03:47 PM

I always wondered where all them stars came from hollower and now I know where, this script must be great because everyone has said so, but I just read through the first part of the readme and I have version 2.33 with the updated script and it will not open the updated script that you said worked with this version. I just recieve an error when trying to open and I get transferred back onto the main screen. Ill have a read through sometime to get more used to this. smile.gif

It is something I have done wrong it must be as you have all got this working but with different versions.

Good work though hollower from what people have seen.

Hollower
  • Hollower

    theomachist

  • Members
  • Joined: 09 Sep 2002

#62

Posted 10 May 2004 - 06:50 PM

QUOTE (GT-1 @ May 10 2004, 09:47)
I just recieve an error when trying to open and I get transferred back onto the main screen.

You are probably opening from Blender's main menu. I kind of glossed over this part in my tutorial because as it says "learn Blender first" so I assumed people would figure out how to set up a split window for the text editor. I gave the link for the online Blender documentation a few posts back. The section Understanding the interface should help. The text editor's File menu is at the bottom of the text editor's panel.

I haven't utilized a feature of Blender where I could integrate the script into the main menu because it involves splitting the script into two, import and export, and I don't know how to keep the GUI which is kind of necessary for the various options and the feedback from the status window. So I'm going to stick with using the text editor window.

QUOTE (GT-1)
Good work though hollower from what people have seen.

Thanks. Remember, don't try to do a player model as the first thing. smile.gif Take the time to learn Blender's workflow, even if you only plan to use it as a conversion stage.

sonix
  • sonix

    Stoned Monkey.

  • Members
  • Joined: 23 Apr 2004

#63

Posted 11 May 2004 - 03:51 AM

Thanks, Hollower. I forgot about the CTRL+SHIFT+P, as you had advised me before. Will check this out asap.

I notice in the script there are references to .col files. Is this support for colision files or just a colour variable for Blender?

And thanks for the ti[p about the names being corrected on export, I was wondering about that.

Thanks again,

Sonix.

Hollower
  • Hollower

    theomachist

  • Members
  • Joined: 09 Sep 2002

#64

Posted 11 May 2004 - 04:10 AM

QUOTE (sonix @ May 10 2004, 21:51)
I notice in the script there are references to .col files. Is this support for colision files or just a colour variable for Blender?

I intend to add collision file support later. There are a few placeholders in the released script, but no functionality.

GT-1
  • GT-1

  • Feroci Racing
  • Joined: 21 Nov 2003

#65

Posted 11 May 2004 - 03:33 PM Edited by GT-1, 11 May 2004 - 06:36 PM.

Well after just a bit of messing around I worked out how to use the script and import a file into blender and I was tryin to add pre-lighting but I dont know how to add lights and sometimes all my controls seems to dissappeaer under the materials section ill keep trying though. smile.gif

sonix
  • sonix

    Stoned Monkey.

  • Members
  • Joined: 23 Apr 2004

#66

Posted 12 May 2004 - 12:45 AM

QUOTE (GT-1 @ May 11 2004, 15:33)
Well after just a bit of messing around I worked out how to use the script and import a file into blender and I was tryin to add pre-lighting but I dont know how to add lights and sometimes all my controls seems to dissappeaer under the materials section ill keep trying though. smile.gif

To add a lamp in Blender. Hold your mouse over the 3d window and press space bar. Click Add>Lamp.

To change settings for the lamps press the material icon to see the lamp icon and press that. To instance another lamp from an existing one, hold ALT+D. This will give you multiple lamps responding to the same set of lamp controls. Use duplicate SHIFT+D to have seperate lamp settings.

Your material settings will not be there if the mesh has no material applied. All you'll see is a blank area where the material buttons should be, and ADD>NEW in the top left corner of this blank area(click that to add a new material).)

The script imports the texture files (as long as they are unpacked from the relevant txd into the same directory as the dff file) and auto assigns materials to the mesh objects, so you shouldn't loose the buttons on those objects.

Hope this helps,


Sonix.

JernejL
  • JernejL

    Big Homie

  • Feroci Racing
  • Joined: 11 Mar 2002

#67

Posted 12 May 2004 - 02:44 PM

QUOTE (Hollower @ Mar 5 2004, 21:20)
Edit (May 4th): Blender 2.33 has just been released and it breaks compatability with this script. Stick with Blender 2.32 until I release a fix.

do you have a fix or where can i get the old version of blender?

GT-1
  • GT-1

  • Feroci Racing
  • Joined: 21 Nov 2003

#68

Posted 12 May 2004 - 07:08 PM

QUOTE (Delfi @ May 12 2004, 14:44)
QUOTE (Hollower @ Mar 5 2004, 21:20)
Edit (May 4th): Blender 2.33 has just been released and it breaks compatability with this script. Stick with Blender 2.32 until I release a fix.

do you have a fix or where can i get the old version of blender?

Im using blender 2.33 and the updated script above works for me I think anyway. There is a post above somewhere by Hollower with the changed script that should work. smile.gif

So there is no one way of just importing a file and then exporting this file with pre-lighting without placing the lamps all over the place, you cannot just import and then export with the lighting as im not too bothered about the shadows if not which I think is right I will just keep trying.

Ill catch you on MSN hollower. smile.gif

Hollower
  • Hollower

    theomachist

  • Members
  • Joined: 09 Sep 2002

#69

Posted 12 May 2004 - 08:24 PM

Delfi: My bad, I posted a fix but forgot to edit the first post. Done.

GT-1: Sorry, there needs to be real light in the scene. If you add no lights it will assign all black vertex colors which is exactly like a zmodeler export. Well, you can also paint them on but that would be even more work than prelighting.

JernejL
  • JernejL

    Big Homie

  • Feroci Racing
  • Joined: 11 Mar 2002

#70

Posted 12 May 2004 - 08:36 PM

and.. hollower does the script still calculate the normals on import?
custom normals do matter realy..

sonix
  • sonix

    Stoned Monkey.

  • Members
  • Joined: 23 Apr 2004

#71

Posted 13 May 2004 - 12:38 AM

QUOTE (Delfi @ May 12 2004, 20:36)
and.. hollower does the script still calculate the normals on import?
custom normals do matter realy..

Small fix if it doesn't. Enter EDIT mode for the mesh you want to check the normals dierction on. Press A to select all verts, then press CTRL+N to recalculate normals to face outside the mesh.

If you want to see the normals when in edit mode, press the normals button on the right hand side of the Edit buttons in Blender's interface.

To calculate all normals to face inside the mesh, select all verts and press space bar>edit>face normals>recalc inside.

Hope this helps, if the script doesn't recalc them on import.

Sonix.

Hollower
  • Hollower

    theomachist

  • Members
  • Joined: 09 Sep 2002

#72

Posted 13 May 2004 - 01:23 AM

It was just a tiny bugfix of one function so other than that it is still the same as the first release. Same deal if I release any other fixes under 0.1. More significant changes will come in 0.2 (I'm trying to number them so that the eventual 1.0 release will be a stable or final version, but there's no telling when or *if* that will happen). I will try to support custom normals if it is possible.

Sonix:
Delfi is refering to custom normals that are skewed to be not perpendicular to the face. I don't even know how to do that in Blender or if it is possible. The reason I'm not importing them from the dff file is because when I did they were all being lost after doing any mesh editing.

sonix
  • sonix

    Stoned Monkey.

  • Members
  • Joined: 23 Apr 2004

#73

Posted 13 May 2004 - 11:25 PM

Thanks Hollower, but I don't understand why custom normals would be needed. What are the benifits? Something to do with texturing?

Thought all normals were perpendicular anyway.

Confused Xinos. blink.gif

GT-1
  • GT-1

  • Feroci Racing
  • Joined: 21 Nov 2003

#74

Posted 15 May 2004 - 03:30 PM Edited by GT-1, 16 May 2004 - 09:44 AM.

Well we had a problem with exporting that .dff file which would not happen a error occured so I tried another file and went through all the stages and it exported fine but I need to check it ingame now, only the pre-lighting that is. smile.gif

Thanks Hollower

EDIT it did work all I need to do is to pratise were to put the lighting moving thingy dont know what its called but its all pratice.
This was alot darker before, on this side its light on the other side its slightly darker. smile.gif Thats how its supposed to be right, well im sure it worked although it could have been better.

user posted image

EDIT AGAIN I exported that all well and good and I came to the race track that blaer made also unlocked .dff file but I have a problem, I run the script as before go to import > find the file > and then I click select file and blender shuts down, straight back onto windows without saying any errors.
It was made in MAx but exported from Zmod the track that is to a .dff but this is a problem I did not have before. angry.gif

Hollower
  • Hollower

    theomachist

  • Members
  • Joined: 09 Sep 2002

#75

Posted 16 May 2004 - 07:44 PM

I have been conversing with GT-1 and thanks to his feedback I have located a couple of small bugs.

1.
I mentioned in the tutorial that you should enable the 'msplit' button when importing a model that came from Zmodeler. What I didn't know is that if you don't enable it and then try to re-export, the script will exit with a Python error if the mesh had more than one material. I can fix but it's not urgent...just don't do it. In the future I'll probably just auto-detect Zmodeler files and get rid of the option.

2.
The Filename and path fields are limited to 255 characters. Apparently if you select via browsing and the resulting path goes over the maximum, Blender just gives up and exits. Bleh! Of course I can put in a simple check and truncate the field if necessary.

GT-1
  • GT-1

  • Feroci Racing
  • Joined: 21 Nov 2003

#76

Posted 20 May 2004 - 02:41 PM

Will there ever be any way of gettin round the 16 materials limit for importing files into Blender, this has really started to become a problem and has become annoying but if not Ill have to live with it.

Thanks to my feedback, im honoroured but really it was my st00pidnes probs. biggrin.gif

Hollower
  • Hollower

    theomachist

  • Members
  • Joined: 09 Sep 2002

#77

Posted 20 May 2004 - 09:55 PM

QUOTE (GT-1 @ May 20 2004, 08:41)
Will there ever be any way of gettin round the 16 materials limit for importing files into Blender, this has really started to become a problem and has become annoying but if not Ill have to live with it.

I don't know. It's a hard-coded Blender limit not a script limit so I really only have a few unpleasant options.

1. I beg Blender developers to raise or remove the cap (I'm not advanced enough to mess with the source myself)

2. I make the importer split up a mesh into many smaller meshes and somehow keep them linked so they can be rejoined at export (the prospect of bugs with this scares me)

3. I somehow come up with a way to store "fake" materials so that even if they aren't loaded into Blender the information is still stored in memory. I don't know if this is possible but I'm looking into it.

It *may* be possible to do some patching with RWAnalyze. You could export a 'broken' file from Blender (if it doesn't cause the script to crash), open in RWA, export the geometry struct, open the original 'clean' file and import over the geometry struct. The material indices would be wrong, but Zmodeler makes them wrong too so maybe it could work. I haven't tested this theory yet.

QUOTE (GT-1)
Thanks to my feedback, im honoroured but really it was my st00pidnes probs. biggrin.gif

Well I didn't know about those two problems until you reported them. I need to know all the silly ways to break my script so I can plug up the holes. I figured I should post them here so others know what not to do.

ModelingMan
  • ModelingMan

    Crackalacking!

  • Feroci Racing
  • Joined: 23 Jan 2004

#78

Posted 20 May 2004 - 11:25 PM Edited by ModelingMan, 20 May 2004 - 11:27 PM.

I am having a problem exporting a dff. Blender was working fine, but all the models I have tried, after exporting a Fido model, crash the script. I tried using script b and c, and Blender v2.31a and 2.33a still no luck.

Any help is very much appreciated, as I am trying to get MarkPagliaro's patched peds fixed up for GTA:LC.

.:EDIT:.
Nevermind, I forgot to press msplit.

astro33
  • astro33

    astro33

  • Members
  • Joined: 30 Jan 2004

#79

Posted 27 May 2004 - 02:55 PM

nice script.. Hollower.

here is short flash movie of editing tommy head.

http://www.freewebs.com/astro33/9.htm

sonix
  • sonix

    Stoned Monkey.

  • Members
  • Joined: 23 Apr 2004

#80

Posted 01 June 2004 - 02:01 AM

Hollower, I'm still having a lot of problems with the script crashing on export.

I've managed to work out it's the hierachy that's causing it, but I'm unable to parent anything to anything without this happening. Creating parent without inverse crashes the script on export. Creating ordinary parent, also crashes the script on export. This is for GTAVC vehicles.

Please could you try a test for me, using 2.32 or 2.33 with the b or c script accordingly. Import an existing .dff file, it can be any, mod or original. Delete the chassis_hi mesh, add your own, parent this to the chassis dummy and try to export. There's usually the hierarchy list displayed in the console window, then errors in four code lines. (Will write these down if you need them.)

If you have no problem, then my comp system is not working properly. Do I need the latest release of python?

I have been making the mesh with Blender, then exporting as a DXF, converting this to LWO objects, then importing these into zmodeler into an existing dff file. This way I can set up the hierachy correctly in zmod. I then export as dff, and import into Blender with msplit.
This is the only way I can then get the script to export without crashing. Which is a pain in the butt.

Any chance of some help please?

Thanks,

Sonix.

Hollower
  • Hollower

    theomachist

  • Members
  • Joined: 09 Sep 2002

#81

Posted 01 June 2004 - 03:51 AM

Sonix:
I just followed the steps you gave on the VC Cheetah and it exported without errors. Imported cheetah.dff, deleted chassis_hi, made a cube for the new chassis tounge.gif , converted to triangles, assigned it one of the loaded materials, selected chassis_hi and chassis_dummy via SHIFT-F4, parented without inverse, selected the cheetah empty, exported as VC Vehicle. No errors.Here is a picture of the console.

If you give me the error messages I can locate where the script is failing and give an idea of what's going wrong on your end. Currently the script only uses built-in modules so you shouldn't even need a full Python install.

sonix
  • sonix

    Stoned Monkey.

  • Members
  • Joined: 23 Apr 2004

#82

Posted 01 June 2004 - 04:01 AM Edited by sonix, 01 June 2004 - 04:10 AM.

Ok thanks for the quick reply. The only thing I can see you're doing differently, is selecting the objects using Shift F4. I have been right clicking to select the chassis_hi mesh, then holding SHIFT and right clicking the Empty. Then doing parent without inverse.

The script usually writes the hierarchy list upto the crash point, which is one reason I think it's down to parenting errors on my part.

Will check again with the Shift F4 method to compare. I'm at work right now, so it won't be until tomorrow I can post back, unless you are able to try my method again by using just right mouse button select and shift. No worries if not, you've helped me out so much already.

---EDIT--- From memory, the usual lines stated, are 120, a couple of lines about 1450 and one 1600 ish I think, not much help I'm afraid, but will post full details asap. ---EDIT---

Thankyou very much,

Sonix.

Hollower
  • Hollower

    theomachist

  • Members
  • Joined: 09 Sep 2002

#83

Posted 01 June 2004 - 04:11 AM Edited by Hollower, 01 June 2004 - 04:14 AM.

Well it shouldn't make a big different how you select. I use the shift-f4 method because the chassis_dummy is underneath another empty and can't be selected in the 3d window. But order is important because the 'active' object is the one that becomes the parent. The active object is the lighter shade of pink and it's name is displayed in the lower-left corner of the 3d window.

Edit: the printout of the hierarchy is actually done before the exportation process starts, not during, so it doesn't indicate where the error happens. Any errors should be below the ===== line.

sonix
  • sonix

    Stoned Monkey.

  • Members
  • Joined: 23 Apr 2004

#84

Posted 01 June 2004 - 04:20 AM

Ok. I understand the selection process. I've just run some small tests (made a quick file in blender, 1 empty 1 uvsphere on a works comp. I had no file to import, but making one from scratch quickly and testing if export ok. GTAVC vehicle.)

Both methods worked ok on export, parent and parent without inverse. Maybe it's just when I'm working with complex hierachies.

Not to worry, I'll have a go today with a few different methods and also post back with error messages.

Huge thanks again,


Sonix.

DAALYMAN
  • DAALYMAN

    Square Civilian

  • Members
  • Joined: 27 Mar 2004

#85

Posted 01 June 2004 - 05:57 AM

very very cool script. i'm just a novice on blender that was a bit hard to get an understand on. but after that it was pretty easy.
i've only done small changes on the reg. models just getting to know the program more. and so far so good.
thank you.

[DRuG]NikT
  • [DRuG]NikT

    DRuG Baron

  • Members
  • Joined: 27 Jan 2004

#86

Posted 18 June 2004 - 07:13 PM

rah.gif rah.gif rah.gif

Rokkn plugin hollower.

I've been able to parent the skeleton to tommy, and he animates well in game... I've even had success assigning vertexs to the relevant groups such that they texture predictably - so THANKYOU!!! I look forward to more bone modelling advances... which leads to my question

I find when importing tommy into game his chin/jaw twists on an alarming angle when turning his head... the game engine masks a good view of it in most camera angles, but it is possible to see properly in 1st person view when on a bike, if you hold the "driveby shoot" keys while reversing the bike.

I know this may seem pedantic, but it is quite notticable that the face is wobbling on the spawn screen as it moves - I understand that choose from closest bones wont get the exact vertices, but even when I manually group/assign them I seem to get the same results?!

Is it just me??

Thats ma main quiz!

thanks at any rate

[DRuG]NikT

sonix
  • sonix

    Stoned Monkey.

  • Members
  • Joined: 23 Apr 2004

#87

Posted 21 June 2004 - 03:18 AM

Hi Hollower, I've been haviing problems with UVs on export. I've re-read your tutorial, but it doesn't mention anything about detaching faces that share materials.

If I have a cube for eg, if I UV map the top face use cube8bitbody64.bmp, and the front face use enginetop8bit64.bmp and the bottom face use cubebody128.bmp. I know i have to assign the relevant verticies the corresponding material as well, but if I then try to export this the uv mapping is all messed up.

So at the suggestion of Suction T Man I tried to detach the faces that had verts sharing materials, using Y key to split faces. Alas after this, the model won't export using your script. The same error message I had before returns over the same four lines of code as before.

I ask only because this multiple texture per vertex issue is not mentioned in your tutorial.

Any help you might be able to give would be greatly appreciated.

Link to problem.

Blender and in game screen shots, please click here.

Thanks,

Sonix.

sonix
  • sonix

    Stoned Monkey.

  • Members
  • Joined: 23 Apr 2004

#88

Posted 21 June 2004 - 03:18 AM

Sorry dble post by accident

Hollower
  • Hollower

    theomachist

  • Members
  • Joined: 09 Sep 2002

#89

Posted 21 June 2004 - 03:48 AM

sonix:
I have been aware of this bug for a while but I don't yet have a fix in place. The script converts UVs from per-face (Blender) to per-vertex (GTA) by simply taking the first occurance of a vertex and ignoring when it comes to the same vertex on another face. Evidently that method is flawed. I have since learned that Blender's "sticky" UVs are what I'm supposed to use. Right now I don't think simply making them sticky in Blender will work since the script still reads from the face, but maybe this info will help you figure something out since you probably know more Blender tricks than I do. One workaround I found that worked on some models (but made others worse) is to select all verts and press the 'Xsort' button. Give it a try...save a backup first obviously.

[DRuG]NikT:
There are a lot of possible reasons for that. The skeleton may not be lined up with model. Some vertices may have been unintentionally assigned to more than one group. Or, if intentionally assigned, the weights may not be blended properly. Blending overlapping bone influences is probably the hardest part to get right.

[DRuG]NikT
  • [DRuG]NikT

    DRuG Baron

  • Members
  • Joined: 27 Jan 2004

#90

Posted 28 June 2004 - 10:09 AM Edited by [DRuG]NikT, 23 June 2005 - 10:57 AM.

Thanks Hollower - turns out, indeed it was the vertex/group assignment - once I got them all neatly assigned to the right groups, it all came together.

I am able to tweak and then re-export to test pretty reliably too, so you absolutely 0wn!!

(I highly recommend vcmp/vcmm for this activity, and a bat file to copy the models about while you're building)

Next I gotta brush up on my mesh & texturing skillz, but in the meantime, since this thread looks to be aching for proof-of-produkt... cop this bag 'o beta's (special thanks to an, as yet, un-named modeller who did the head, which can be found on 3Dcafe in the free models areas).

user posted image user posted image
-CLICK TO SEE FULL SIZE- -CLICK TO SEE FULL SIZE-

Download DRuG-Alien.vcm
Download DRuG-Alien-Racer.vcm
Don't left click the above download links, right click and select "save as"

I have packaged the alien pictured above as a VCM to replace robber and racer separately. The shoes still need some work, and so does the texture, but at least the face doesn't twist up now when he turns his head.

You'll need to get Vice City Mod Manager to install it, you'll find it very good for adding/removing mods quik n easy at any rate.

[DRuG]NikT
http://drug.now.nu/




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users