project-navigation
Personal tools

Author Topic: Basic Question  (Read 9868 times)

Offline ManDrake13

  • Rookie
  • ***
  • Posts: 16
    • View Profile
Basic Question
« on: June 09, 2015, 03:17:00 pm »
I want to start with the fact that I'm a programmer, not a graphic designer, so I'm in an alien field so to speak. I'm looking for some sort of basic walkthrough that would allow me to something really simple, like change the color of a shotgun shell from red to yellow for example. I've started going over all the information on the website, it recommends Blender, but I can't get anything to load properly into Blender. I saw that there is a python program that can covert them somehow, but I'm not clear how. Do you have something for people with a dangerously low level of knowledge and experience. if I could just figure out how to change colors of things, so I could tell the differences in my mods, I'd be happy with that. Any suggestions?

Offline Noordung

  • Squad Leader
  • ****
  • Posts: 285
    • View Profile
Re: Basic Question
« Reply #1 on: June 09, 2015, 08:20:48 pm »
search import/export scripts for md2 format. for changing shotgun color you need to change skin. for that you can use gimp - free program.

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: Basic Question
« Reply #2 on: June 09, 2015, 08:44:43 pm »
If you only want to change the color do as Noordung says and just edit the skin (a simple .png/.jpg file) with your preferred image editor — for your example the Riot Shotgun ammo skin is base/models/weapons/shotgun2/shotgun_clip.jpg, the tutorial you'll need depends on your image editing program of course.

For that you don't need Blender, only bother with Blender if you actually want to change the *shape* of an object in game, in that case the impor/export scripts are in our repository (src/tools/blender), check the Blender manual on how to use add-ons: http://www.blender.org/manual/extensions/python/add_ons.html

Offline ManDrake13

  • Rookie
  • ***
  • Posts: 16
    • View Profile
Re: Basic Question
« Reply #3 on: June 10, 2015, 02:52:16 pm »
Thanks for the info. It took a a couple of hours, but I finally managed to get what I wanted to happen to happen with GIMP. So I cloned the existing magazine and switched the color of the shell on top. Turns out the term export was an important key word cause you can't save it in jpg format, except with an export in GIMP. Updated my weapons_human.ufo file to point to it. And everything is coming out red like before. So I suspect that this where the discussion on the md2 files comes in. You mentioned an import/export script for those. Originally I assumed it was GIMP, but I couldn't find an md2 option in GIMP. When I searched, I found mention of the md2.pl script, but it's not clear to me what I should do with this.

ubuntu@ubuntu2:~/ufoai/base/models/weapons/shotgun2$ ~/ufoai/src/tools/md2.pl info shotgun_clip_yellow.md2
MD2 file found.
NumFrames: 1 (max is 512)
NumSkins: 1 (max is 32)
NumXYZ: 50 (max is 2048)
NumST: 95
NumTris: 92 (max is 4096)
NumGLcmds: 0
SkinWidth: 256
SkinHeight: 256

So what is my next step? I'm presuming because I copied the red md2 file, that it's pointed to the red md2 image still. I'm also not sure where the external shell that I see in the image inside the game. But I see the same thing on the medikit as well, the big needle image isn't in the jpg, so it must be built with some other information somehow. So I suspect the md2 files do all sorts of special stuff.

So is there a recommended tool for digging into md2 for Linux?

Offline Noordung

  • Squad Leader
  • ****
  • Posts: 285
    • View Profile
Re: Basic Question
« Reply #4 on: June 10, 2015, 03:03:39 pm »
You have to replace the old picture with new one in game folder and use the same name.
py script is blender thing it goes to blender/2.73a (or what ever version of blender you are using) /python
than open blender and file import/export should be new options.
but you have to realize that blender is for model, GIMP is for skin - like photoshop.

Offline ManDrake13

  • Rookie
  • ***
  • Posts: 16
    • View Profile
Re: Basic Question
« Reply #5 on: June 10, 2015, 03:46:59 pm »
Well remember, I'm a programmer, so I'm extremely literal about things, especially when I'm walking into something I don't understand. So you should probably assume that you are talking to a 3 year old when trying to describe this stuff.

So I downloaded the latest Blender version 2.74 for Linux. I did a simple copy operation like you said to copy all the python scripts into the python directory for Blender.

Quote
ubuntu@ubuntu2:~/blender-2.74-linux-glibc211-x86_64/2.74/python$ cp ~/ufoai/src/tools/blender/
export_marker_list.py  io_mesh_md2.py         io_scene_tag.py       
ubuntu@ubuntu2:~/blender-2.74-linux-glibc211-x86_64/2.74/python$ cp ~/ufoai/src/tools/blender/* .
ubuntu@ubuntu2:~/blender-2.74-linux-glibc211-x86_64/2.74/python$ ll
total 68
drwxr-xr-x 3 ubuntu ubuntu  4096 Jun 10 09:20 ./
drwxr-xr-x 5 ubuntu ubuntu  4096 Mar 31 10:54 ../
-rwxrwxr-x 1 ubuntu ubuntu  3322 Jun 10 09:20 export_marker_list.py*
-rwxrwxr-x 1 ubuntu ubuntu 36319 Jun 10 09:20 io_mesh_md2.py*
-rwxrwxr-x 1 ubuntu ubuntu 13035 Jun 10 09:20 io_scene_tag.py*
drwxr-xr-x 3 ubuntu ubuntu  4096 Mar 31 10:54 lib/
ubuntu@ubuntu2:~/blender-2.74-linux-glibc211-x86_64/2.74/python$

But no new options appeared import/export menu. I noticed you were using 2.73a, so I downloaded it instead and did the same copy operation with the same results, no new options appeared in the import or export value. Now I see there is a scripts directory at the same level as python and I see there are a lot of python scripts at two levels down in the python directory. But I suspect that I'm missing something obvious here.

Offline Noordung

  • Squad Leader
  • ****
  • Posts: 285
    • View Profile
Re: Basic Question
« Reply #6 on: June 10, 2015, 05:26:39 pm »
Im using windows so not sure how it is in linux.
also looks like its blender/2.74/python/lib
also you have to go file user preferences and enable script.

not really remember where to add scripts since im only using 2 or 3 of them, but im 90% its blender/2.74/python/lib

Offline ManDrake13

  • Rookie
  • ***
  • Posts: 16
    • View Profile
Re: Basic Question
« Reply #7 on: June 10, 2015, 06:09:56 pm »
OK, I think there is a problem with Blender 2.74, I finally figured out how to get to console window and I see this error.

found bundled python: /home/ubuntu/blender-2.74-linux-glibc211-x86_64/2.74/python
multiple addons with the same name:
  '/home/ubuntu/blender-2.74-linux-glibc211-x86_64/2.74/scripts/addons/io_mesh_md2.py'
  '/home/ubuntu/.config/blender/2.74/scripts/addons/io_mesh_md2.py'
multiple addons with the same name:
  '/home/ubuntu/blender-2.74-linux-glibc211-x86_64/2.74/scripts/addons/io_scene_tag.py'
  '/home/ubuntu/.config/blender/2.74/scripts/addons/io_scene_tag.py'

So it looks like 2.74 is copying the add-on into two places and that's why it's not working.

On 2.73, I figured out that when said enable the script, you were really saying:

File -> User Preferences -> Add-ons -> Install from File for each of the two python scripts.

Once I realized it was hosed in 2.74 and switch and did the same thing in 2.73, it all started to work. Now I've got my image, but I think the default box is around it. Which I think I can get rid of. Let me experiment for a few minutes with it. I think I'm getting close.

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: Basic Question
« Reply #8 on: June 10, 2015, 08:10:57 pm »
I'll stress this again you don't need to bother with Blender unless you really want to change the *shape* of the object...

That said, yes the md2 is still pointing to the old red skin, you can either open the md2 with an hex editor and change it to point to the new skin (skins are stored as plain text usually near the beginning of the file) or use the ufomodel tool provided with the game to edit skin names, with it you can even add more skins to the file — you can specify which skin to use in the ufo scripts (Yes, importing and re-exporting it in Blender will also allow you to edit skins, but that's overkill IMHO)

(Also sorry should have mentioned you need to edit the skins before for some reason I just assumed you'd edit the file 'in place')

Offline ManDrake13

  • Rookie
  • ***
  • Posts: 16
    • View Profile
Re: Basic Question
« Reply #9 on: June 10, 2015, 10:38:41 pm »
Well getting Blender allowed me to compare the two objects directly allowed me to see what my actual problem was. Turns out it was in the step that I used with make the md2 file that caused the issue.

What I attempted to do was this.

~/ufoai/src/tools/md2.pl skinedit ../../../../../base/models/weapons/shotgun2/shotgun_clip.md2 shotgun_clip_yellow.md2 shotgun_clip_yellow.jpg

What I noticed when I was suspicious of the output, once I could see it in Blender, I went back to the messages that md2.pl script put out.

IN = "../../../../../base/models/weapons/shotgun2/shotgun_clip.md2"
OUT= "shotgun_clip_yellow.md2"
TEX= "shotgun_clip_yellow.jpg"
MD2 file found.
1 Skin(s) found
Skin 0 old: ".shotgun_clip"
Skin 0 new: "shotgun_clip_yellow.jpg"
Writing model to shotgun_clip_yellow.md2

So I noticed the old skin name was completely different different than what I thought it should be. Based on that, I went back and redid it to look like this:

~/ufoai/src/tools/md2.pl skinedit ../../../../../base/models/weapons/shotgun2/shotgun_clip.md2 shotgun_clip_yellow.md2 .shotgun_clip_yellow

And suddenly it all started working properly. I ran all these in the models directory of my mod builder system, so for normal people it will be one level higher in the directory structure. I was just designing a way to keep my mods separate from one another so I could add and remove them easily.

Thanks for all the help Noordung and DarkRain. Now I have the ability to add models to my mods working properly. But the whole double script thing in Blender 2.74 is a bit annoying. We should probably have someone that knows what their doing look at that and see if it's just me or if we need to document that so no one else gets hung up on it.