project-navigation
Personal tools

Author Topic: Scaling Question.  (Read 16357 times)

Offline ManDrake13

  • Rookie
  • ***
  • Posts: 16
    • View Profile
Scaling Question.
« on: June 27, 2015, 04:45:30 pm »
OK, I'm taking another stab graphics after the previous success changing the color of something. So one of my mods is a Mini-Medikit. So my goal was straight forward enough, I'm not brave enough to try to build a completely new model, so I decided to steal the existing one and tweak it. I figured out from searching that what I call proportions is called scaling by artistic people. It appears the challenge with this is just learning an entire new language of terms. So my goal is to make 1x2 mini-medikit for my mod to use. So I did the standard thing made a model directory and copied in the original medikit to work with.

So I copied over the JPG file and renamed it to be minimedikit.jpg and I copied over the md2 file with provided perl script for doing such things. I remembered from my previous experience that I needed to give the JPG part the required naming convention rather than  what the actual JPG name.

Code: [Select]
$ ~/ufoai/src/tools/md2.pl skinedit ../../../../../base/models/weapons/medikit/medikit.md2 minimedikit.md2 .minimedikit
IN = "../../../../../base/models/weapons/medikit/medikit.md2"
OUT= "minimedikit.md2"
TEX= ".minimedikit"
MD2 file found.
1 Skin(s) found
Skin 0 old: ".medikit"
Skin 0 new: ".minimedikit"
Writing model to minimedikit.md2

So then I edited the JPG in GIMP. Once I realized the terminology problem it was fairly straight forward. Image->Scale Image, click the chain looking thingy to making it accept a different proportion, cut the image from 256 to 128 for the X axis, then export as a JPG. And you are done. Figuring all that out took an hour, but it's simple once you get the terminology problems worked out.

Then I went back to the beast Blender. I imported in the minimedikit.md2 file that I'd created with the Quake II Python script for md2. Loaded up fine and I could see the medikit model floating in space on the screen. It took me a bit, but I finally accidentally selected the image by clicking on the upside down triangle under the image name. That brought me up in image edit mode, which I'd been trying to find. And on the left hand side lots of new buttons came up,one of them said Scaling, which I recognized and clicked. Took a while after that to make my mouse movements to stop doing scaling automatically, which was completely annoying. I finally figured out I could click the scaling button twice and it would give me numbers I could type in to control scaling. Then I figured out X axis was what I would call the Z axis, and Y axis was what I would call the X axis, and Z axis was what I would call the Y axis. So once I figured out Blender world out of rotation with my world, I was able to edit the correct proportion. So I set the Y axis to be .5 instead of 1. The imagine on the screen looked correct, I was happy, so I decided I needed to get it saved and tested.

And that's where my dream of a simple process went completely off the rails. When I tried to export it with Quake II MD2 exporter I got the following error. It appears what I've tried to do violates some fundamental principal of what we expect to happen.

Code: [Select]
Creating mesh.....Done
Animating - progress: 100%.
Model imported
Error: Modifier cannot be applied to a mesh with shape keys

Traceback (most recent call last):
  File "/home/ubuntu/.config/blender/2.73/scripts/addons/io_mesh_md2.py", line 859, in triangulateMesh
    bpy.ops.object.modifier_apply(modifier=modifier.name)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy/ops.py", line 189, in __call__
    ret = op_call(self.idname_py(), None, kw)
RuntimeError: Error: Modifier cannot be applied to a mesh with shape keys


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ubuntu/.config/blender/2.73/scripts/addons/io_mesh_md2.py", line 984, in __init__
    self.info = ObjectInfo(self.object)
  File "/home/ubuntu/.config/blender/2.73/scripts/addons/io_mesh_md2.py", line 934, in __init__
    mesh = Util.triangulateMesh(object)
  File "/home/ubuntu/.config/blender/2.73/scripts/addons/io_mesh_md2.py", line 865, in triangulateMesh
    bpy.ops.mesh.quads_convert_to_tris(use_beauty=False)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy/ops.py", line 189, in __call__
    ret = op_call(self.idname_py(), None, kw)
TypeError: Converting py args to operator properties: : keyword "use_beauty" unrecognized

location: <unknown location>:-1

location: <unknown location>:-1
Traceback (most recent call last):
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 662, in draw_ls
    func(self, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 42, in draw
    VIEW3D_MT_editor_menus.draw_collapsible(context, layout)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 771, in draw_collapsible
    cls.draw_menus(layout, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 159, in draw_menus
    layout.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
AttributeError: 'ID' object has no attribute 'type'
Traceback (most recent call last):
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 662, in draw_ls
    func(self, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 42, in draw
    VIEW3D_MT_editor_menus.draw_collapsible(context, layout)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 771, in draw_collapsible
    cls.draw_menus(layout, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 159, in draw_menus
    layout.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
AttributeError: 'ID' object has no attribute 'type'
Traceback (most recent call last):
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 662, in draw_ls
    func(self, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 42, in draw
    VIEW3D_MT_editor_menus.draw_collapsible(context, layout)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 771, in draw_collapsible
    cls.draw_menus(layout, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 159, in draw_menus
    layout.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
AttributeError: 'ID' object has no attribute 'type'
Traceback (most recent call last):
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 662, in draw_ls
    func(self, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 42, in draw
    VIEW3D_MT_editor_menus.draw_collapsible(context, layout)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 771, in draw_collapsible
    cls.draw_menus(layout, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 159, in draw_menus
    layout.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
AttributeError: 'ID' object has no attribute 'type'
Traceback (most recent call last):
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 662, in draw_ls
    func(self, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 42, in draw
    VIEW3D_MT_editor_menus.draw_collapsible(context, layout)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 771, in draw_collapsible
    cls.draw_menus(layout, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 159, in draw_menus
    layout.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
AttributeError: 'ID' object has no attribute 'type'
Traceback (most recent call last):
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 662, in draw_ls
    func(self, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 42, in draw
    VIEW3D_MT_editor_menus.draw_collapsible(context, layout)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 771, in draw_collapsible
    cls.draw_menus(layout, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 159, in draw_menus
    layout.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
AttributeError: 'ID' object has no attribute 'type'
Traceback (most recent call last):
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 662, in draw_ls
    func(self, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 42, in draw
    VIEW3D_MT_editor_menus.draw_collapsible(context, layout)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 771, in draw_collapsible
    cls.draw_menus(layout, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 159, in draw_menus
    layout.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
AttributeError: 'ID' object has no attribute 'type'
Traceback (most recent call last):
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 662, in draw_ls
    func(self, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 42, in draw
    VIEW3D_MT_editor_menus.draw_collapsible(context, layout)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 771, in draw_collapsible
    cls.draw_menus(layout, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 159, in draw_menus
    layout.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
AttributeError: 'ID' object has no attribute 'type'
Traceback (most recent call last):
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 662, in draw_ls
    func(self, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 42, in draw
    VIEW3D_MT_editor_menus.draw_collapsible(context, layout)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 771, in draw_collapsible
    cls.draw_menus(layout, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 159, in draw_menus
    layout.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
AttributeError: 'ID' object has no attribute 'type'
Traceback (most recent call last):
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 662, in draw_ls
    func(self, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 42, in draw
    VIEW3D_MT_editor_menus.draw_collapsible(context, layout)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 771, in draw_collapsible
    cls.draw_menus(layout, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 159, in draw_menus
    layout.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
AttributeError: 'ID' object has no attribute 'type'
Traceback (most recent call last):
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 662, in draw_ls
    func(self, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 42, in draw
    VIEW3D_MT_editor_menus.draw_collapsible(context, layout)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 771, in draw_collapsible
    cls.draw_menus(layout, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 159, in draw_menus
    layout.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
AttributeError: 'ID' object has no attribute 'type'
Traceback (most recent call last):
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 662, in draw_ls
    func(self, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 42, in draw
    VIEW3D_MT_editor_menus.draw_collapsible(context, layout)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 771, in draw_collapsible
    cls.draw_menus(layout, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 159, in draw_menus
    layout.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
AttributeError: 'ID' object has no attribute 'type'
Traceback (most recent call last):
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 662, in draw_ls
    func(self, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 42, in draw
    VIEW3D_MT_editor_menus.draw_collapsible(context, layout)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 771, in draw_collapsible
    cls.draw_menus(layout, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 159, in draw_menus
    layout.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
AttributeError: 'ID' object has no attribute 'type'
Traceback (most recent call last):
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 662, in draw_ls
    func(self, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 42, in draw
    VIEW3D_MT_editor_menus.draw_collapsible(context, layout)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/modules/bpy_types.py", line 771, in draw_collapsible
    cls.draw_menus(layout, context)
  File "/home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/scripts/startup/bl_ui/space_view3d.py", line 159, in draw_menus
    layout.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
AttributeError: 'ID' object has no attribute 'type'

So I'm back for some help, either for what I should have done, or what step I've missed that will resolve my issue.

Offline Noordung

  • Squad Leader
  • ****
  • Posts: 285
    • View Profile
Re: Scaling Question.
« Reply #1 on: June 27, 2015, 07:43:22 pm »
for exporting model you need to unwrap it first. search some tutorials on youtube how to unwrap it. its actually simple.
than model must be in 0.0.0. coordinates. press n in blender and in upper right corner you go to 0.0.0. coordinates. also i think you should done is press ctrl+a and click in rotation and scale. this should be done before unwrapping or you might have some problems with textures. also press shift+c to add you starting point to 0.0.0. coordinate. i think that is all... also there might be some wiki about here how to export that explains better than me.
ah yes you need to be in object view.

Offline ManDrake13

  • Rookie
  • ***
  • Posts: 16
    • View Profile
Re: Scaling Question.
« Reply #2 on: June 28, 2015, 02:39:51 pm »
Wow, that was a very long and very nasty rabbit hole that led me to a dead-end. So I read over the documentation on models again, and I need to understand what exactly is happening. I saw a reference that some things get lost in translation. Is that what is happening to me? So I import the object in, but this unwrapping thing isn't embedded in the object. Instead the system has some other set of instructions it's using that maps it to the correct spots. Since it doesn't have the wrapping map any more, Blender guesses and it's guesses appear to always be wrong is YouTube is to be believed. So the reality is that there is no such thing as a working prototype to start from, because the game files are already in a non-Blender friendly format. My dreams of just changing the proportions and feeding it a smaller image and altering the mapping were always impossible?


Offline Noordung

  • Squad Leader
  • ****
  • Posts: 285
    • View Profile
Re: Scaling Question.
« Reply #3 on: June 28, 2015, 03:14:21 pm »
well i think first aid kit is simple box, or am i mistaken? for suck simple form might be easier to just make new model.
dont have md2 importer on blender im using now so i cant really check it...

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: Scaling Question.
« Reply #4 on: June 29, 2015, 03:46:26 am »
@ManDrake13: Forget about unwrapping: the importer should have imported the UV map from the md2 already, the problem seem to be that the newest blender version is not fully compatible with our current script (originally tested with the 2.6 series) it still should work for your purpose, you'll need to uncheck the "Import animation" option (left of the screen below the recently used directory list) when importing the model  — you don't need animation anyway, equipment uses static model in game — and make sure the option to "Export animation" is unchecked when exporting.

Edit: Also you don't need to scale the texture, just scaling the model should be enough
« Last Edit: June 29, 2015, 04:06:16 am by DarkRain »

Offline ManDrake13

  • Rookie
  • ***
  • Posts: 16
    • View Profile
Re: Scaling Question.
« Reply #5 on: June 29, 2015, 03:43:31 pm »
Thanks DarkRain! That got me past that export problem. It exported just fine this time. When I tried to load it in the game, I got the following error.

Code: [Select]
"version" is "UFO: Alien Invasion 2.6-dev AMD64 Jun 28 2015 Linux DEBUG"
********************
ERROR: model models/weapons/minimedikit/minimedikit.md2 has invalid skin dimensions '0 x 0'
********************
failed to upload file '/home/ubuntu/.ufoai/2.6-dev/techmods_26_public/ufoconsole.log': Failed to open/read local data from file/application
failed to upload file '/home/ubuntu/.ufoai/2.6-dev/techmods_26_public/ufoconsole.log': Failed to open/read local data from file/application

I just did the most basic steps, imported model with no Import Animation. Changed the scale for Y axis to be .5, and exported the model.

So I did an info on the md2 file to see what I could see.

Code: [Select]
ubuntu@Ubuntu13:~/ufoai/mods/techmods_26/standalone/minimedikit/models
$ ~/ufoai/src/tools/md2.pl info minimedikit.md2
MD2 file found.
NumFrames: 1 (max is 512)
NumSkins: 1 (max is 32)
NumXYZ: 104 (max is 2048)
NumST: 95
NumTris: 158 (max is 4096)
NumGLcmds: 0
SkinWidth: 0
SkinHeight: 0
ubuntu@Ubuntu13:~/ufoai/mods/techmods_26/standalone/minimedikit/models
$ ~/ufoai/src/tools/md2.pl info ../../../../../base/models/weapons/medikit/medikit.md2
MD2 file found.
NumFrames: 1 (max is 512)
NumSkins: 1 (max is 32)
NumXYZ: 104 (max is 2048)
NumST: 148
NumTris: 158 (max is 4096)
NumGLcmds: 0
SkinWidth: 256
SkinHeight: 256

And sure enough Skin width and height were set to zeros. I remembered from when I was reverse engineering the md2.pl script seeing something about skin sizes.

Code: [Select]
ubuntu@Ubuntu13:~/ufoai/mods/techmods_26/standalone/minimedikit/models
$ ~/ufoai/src/tools/md2.pl skinsize minimedikit.md2
IN=OUT= "minimedikit.md2"
MD2 file found.
Changing skin sizes ...
Current size: 0w x 0h
Enter new width in pixel (0):128
Enter new height in pixel (0):256
Writing model to minimedikit.md2
ubuntu@Ubuntu13:~/ufoai/mods/techmods_26/standalone/minimedikit/models
$ ~/ufoai/src/tools/md2.pl info minimedikit.md2
MD2 file found.
NumFrames: 1 (max is 512)
NumSkins: 1 (max is 32)
NumXYZ: 104 (max is 2048)
NumST: 95
NumTris: 158 (max is 4096)
NumGLcmds: 0
SkinWidth: 128
SkinHeight: 256

So I reloaded the game and this time, it came up a blue wireframe in the menus and Ufopedia, but as soon as I tried to load it on a character it would disappear. I remembered your comment about not scaling the texture, so I went back again and redid the same steps above but this time, I set the skinsize to be 256x256 instead, but it yielded the same results even with an unmodified copy of the medikit image. A blue wireframe image instead, which is exactly the size I imagined in the beginning, so I think it's just the skin wrapping part that I'm doing wrong.

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: Scaling Question.
« Reply #6 on: June 30, 2015, 04:37:02 am »
Well at least some progress...

It seems that the wrong skin size is because Blender couldn't load the model's texture and thus on exporting the size was set to zero, I'll need to check if that's a problem with the importer...

As for the blue wireframe, some posibilities: Maybe the game can't load the texture for some reason? Are there any warning/error messages in the log (or console output)? Did you end trying to unwrap the model or edit the UV map?

Offline ManDrake13

  • Rookie
  • ***
  • Posts: 16
    • View Profile
Re: Scaling Question.
« Reply #7 on: June 30, 2015, 03:21:02 pm »
That was my first thought too, but there is nothing in the log about a texture failure for the minimedikit. I attached the game log, that I ran with the minimedikit enabled as the only mod using +set developer 1 to turn on the additional debugging information. I see the Actor skin warnings, but those have been hanging around for a while now on 2.6, they haven't seemed to cause any adverse affects to playing the game.

No, I didn't unwrap or anything. This was created with literally the three steps I list, import uncheck Import Animation like you said, I did the n thing that Noordung mention to bring up the scaling menu faster, I put in the .5 for Y in the scaling section, and then literally just exported. The check box was already unchecked in that case. Here is the command console results that came out of Blender when I did this.

Code: [Select]
ubuntu@Ubuntu13:~/blender-2.73a-linux-glibc211-x86_64
$ ./blender
connect failed: No such file or directory
Read new prefs: /home/ubuntu/.config/blender/2.73/config/userpref.blend
found bundled python: /home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/python
Reading: /home/ubuntu/ufoai/mods/techmods_26/standalone/minimedikit/models/minimedikit.md2....Done
CustomData_copy_data_layer: warning null data for CDMTFace type ((nil) --> 0x7f1ffd00e008), skipping
Creating mesh.....Done
Model imported
minimedikit:  ('104 vertices', '158 faces')
Export progress: 100% - Model exported.
Saved session recovery to '/tmp/quit.blend'

Blender quit


I didn't notice the warning message there before, because it exported successfully. Maybe that's the problem, because that's in the importer execution like you suspected.

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: Scaling Question.
« Reply #8 on: June 30, 2015, 08:45:34 pm »
Please try the most recent md2 plugin from the repo, the problem was the incorrect skin size on import: since skin size is used to calculate the UV map on export and thus it was nuked (multiplied by the zeroed skin size)

The new version of the addon should try harder to load the texture when importing and if everything else fails will set a default skin size on export so the UV map isn't all zeroes

(Animation export issues not fixed yet)

Offline ManDrake13

  • Rookie
  • ***
  • Posts: 16
    • View Profile
Re: Scaling Question.
« Reply #9 on: July 01, 2015, 01:13:09 am »
No luck. I did a git pull

Code: [Select]
ubuntu@Ubuntu13:~/ufoai
$ git pull
remote: Counting objects: 40, done.
remote: Compressing objects: 100% (31/31), done.
remote: Total 31 (delta 22), reused 0 (delta 0)
Unpacking objects: 100% (31/31), done.
From git://git.code.sf.net/p/ufoai/code
   707f219..7aa7b56  master     -> origin/master
Updating 707f219..7aa7b56
Fast-forward
 src/client/cgame/campaign/cp_missions.cpp |  2 +-
 src/tools/blender/io_mesh_md2.py          | 26 +++++++++++++++++++-------
 2 files changed, 20 insertions(+), 8 deletions(-)

and installed the script again.

Code: [Select]
ubuntu@Ubuntu13:~/blender-2.73a-linux-glibc211-x86_64
$ ./blender
connect failed: No such file or directory
Read new prefs: /home/ubuntu/.config/blender/2.73/config/userpref.blend
found bundled python: /home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/python
reloading addon: io_mesh_md2 1435408318.457492 1435691440.972961 /home/ubuntu/.config/blender/2.73/scripts/addons/io_mesh_md2.py
Modules Installed from '/home/ubuntu/ufoai/src/tools/blender/io_mesh_md2.py' into '/home/ubuntu/.config/blender/2.73/scripts/addons' ()
trying to save userpref at /home/ubuntu/.config/blender/2.73/config/userpref.blend ok
Reading: /home/ubuntu/ufoai/mods/techmods_26/standalone/minimedikit/models/minimedikit.md2....Done
CustomData_copy_data_layer: warning null data for CDMTFace type ((nil) --> 0x7f38d6806008), skipping
Creating mesh.....Done
Animating - progress: 100%.
Model imported
Saved session recovery to '/tmp/quit.blend'

Blender quit

Same warning.

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: Scaling Question.
« Reply #10 on: July 01, 2015, 01:51:46 am »
But it's only a warning, right? Did you try to re-export the mesh and see if it works (it really should)?

Offline ManDrake13

  • Rookie
  • ***
  • Posts: 16
    • View Profile
Re: Scaling Question.
« Reply #11 on: July 01, 2015, 02:15:40 am »
Right. I was over thinking it. Sorry about that. So I ignored the warning. I did a clean start over again to my base value. Imported, scaled, and exported the md2 file. Confirmed that it had default values correctly.

Code: [Select]
ubuntu@Ubuntu13:~/ufoai/mods/techmods_26/standalone/minimedikit/models
$ ~/ufoai/src/tools/md2.pl skinedit ../../../../../base/models/weapons/medikit/medikit.md2 minimedikit.md2 .minimedikit
IN = "../../../../../base/models/weapons/medikit/medikit.md2"
OUT= "minimedikit.md2"
TEX= ".minimedikit"
MD2 file found.
1 Skin(s) found
Skin 0 old: ".medikit"
Skin 0 new: ".minimedikit"
Writing model to minimedikit.md2
ubuntu@Ubuntu13:~/ufoai/mods/techmods_26/standalone/minimedikit/models
$ ll
total 28
drwxrwxr-x 2 ubuntu ubuntu  4096 Jun 29 08:53 ./
drwxrwxr-x 4 ubuntu ubuntu  4096 Jun 30 15:16 ../
-rw-rw-r-- 1 ubuntu ubuntu 15501 Jun 29 09:28 minimedikit.jpg
-rw-rw-r-- 1 ubuntu ubuntu  2864 Jun 30 20:03 minimedikit.md2
ubuntu@Ubuntu13:~/ufoai/mods/techmods_26/standalone/minimedikit/models
$ ~/ufoai/src/tools/md2.pl info minimedikit.md2
MD2 file found.
NumFrames: 1 (max is 512)
NumSkins: 1 (max is 32)
NumXYZ: 104 (max is 2048)
NumST: 95
NumTris: 158 (max is 4096)
NumGLcmds: 0
SkinWidth: 256
SkinHeight: 256

Then I rebuilt my mod and started it up and got the following error.

Code: [Select]
executing keys.cfg
executing autoexec.cfg
"version" is "UFO: Alien Invasion 2.6-dev AMD64 Jun 28 2015 Linux DEBUG"
R_LoadActorSkinsFromModel: Skin models/soldiers/ugv_ares/ares_w_default not found, defaulting to: models/soldiers/ugv_ares/ares_w
No skin for #0 of 'weapons/minimedikit/minimedikit'
80 static models loaded
CL_LanguageInit: language settings are stored in configuration: en
...using language: en_ZW.utf8
SDL_ttf version 2.0.11 - we need at least 2.0.7
...registering 14 fonts

In the game, now instead of being blue it's red, this looks like what happened when I tried to use the real image name when I did my skin edit, it would show up properly in Blender, but gave me a red outline in the game. That was when I figured out that it needed .<jpgname> for it to actually show up and it couldn't have the file extension on it. I want this to be a typo, but I can't see it if it is.
« Last Edit: July 01, 2015, 03:04:29 am by ManDrake13 »

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: Scaling Question.
« Reply #12 on: July 01, 2015, 05:34:14 am »
Well, that error means the game can't load the texture, double check the final directory structure once you 'install' your mod: you seem to be creating the md2 at mods/techmods_26/standalone/minimedikit/models while the log suggest the game is looking for it in weapons/minimedikit (which I'm not sure if means base/models/weapons/minimedikit or mods/<yourmod>/models/weapons/minimedikit)

If all else fails post your mod here (compressed archive) so we can have a look, another pair of eyes or two could help spotting what is going wrong.

Offline ManDrake13

  • Rookie
  • ***
  • Posts: 16
    • View Profile
Re: Scaling Question.
« Reply #13 on: July 01, 2015, 02:25:21 pm »
I can complete understand the concern. I have 20+ mods for the game, so I had to start separating them to allow for easier debugging. So I work on them in the standalone directory and then do a build mod, which creates a proper mod directory for game usage. You are correct that the standalone directory would never work for the game.

Code: [Select]
ubuntu@Ubuntu13:~/ufoai
$ git pull
remote: Counting objects: 29, done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 24 (delta 16), reused 0 (delta 0)
Unpacking objects: 100% (24/24), done.
From git://git.code.sf.net/p/ufoai/code
   7aa7b56..72898b1  master     -> origin/master
Updating 7aa7b56..72898b1
Fast-forward
 src/tools/blender/io_mesh_md2.py | 103 +++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------
 1 file changed, 47 insertions(+), 56 deletions(-)

So I saw you pushed a new fix overnight, so I reran my tests and got the same result. Which made no sense to me. A single line of code change should change something even if it's absolutely minor. So I became suspicious that something wasn't actually being changed. And there is only one thing in the process that isn't us, and it's Blender. So even though I was reloading the new copy of io_mesh_md2.py every time, it appears that blender wasn't actually changing it. So I went back end and deleted the script completely from Blender. Then reloaded it from scratch.

Code: [Select]
ubuntu@Ubuntu13:~/blender-2.73a-linux-glibc211-x86_64
$ ./blender
connect failed: No such file or directory
Read new prefs: /home/ubuntu/.config/blender/2.73/config/userpref.blend
found bundled python: /home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/python
reloading addon: io_mesh_md2 1435751192.8296928 1435752005.9417028 /home/ubuntu/.config/blender/2.73/scripts/addons/io_mesh_md2.py
Modules Installed from '/home/ubuntu/ufoai/src/tools/blender/io_mesh_md2.py' into '/home/ubuntu/.config/blender/2.73/scripts/addons' ()
trying to save userpref at /home/ubuntu/.config/blender/2.73/config/userpref.blend ok
addon_utils.disable: io_mesh_md2 not loaded.
Modules Installed from '/home/ubuntu/ufoai/src/tools/blender/io_mesh_md2.py' into '/home/ubuntu/.config/blender/2.73/scripts/addons' (io_mesh_md2)
trying to save userpref at /home/ubuntu/.config/blender/2.73/config/userpref.blend ok
Saved session recovery to '/tmp/quit.blend'

Blender quit
ubuntu@Ubuntu13:~/blender-2.73a-linux-glibc211-x86_64
$ ./blender
connect failed: No such file or directory
Read new prefs: /home/ubuntu/.config/blender/2.73/config/userpref.blend
found bundled python: /home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/python
reloading addon: io_mesh_md2 1435752038.5777032 1435752180.137705 /home/ubuntu/.config/blender/2.73/scripts/addons/io_mesh_md2.py
Modules Installed from '/home/ubuntu/ufoai/src/tools/blender/io_mesh_md2.py' into '/home/ubuntu/.config/blender/2.73/scripts/addons' ()
reloading addon: io_mesh_md2 1435752180.137705 1435752209.1097054 /home/ubuntu/.config/blender/2.73/scripts/addons/io_mesh_md2.py
Modules Installed from '/home/ubuntu/ufoai/src/tools/blender/io_mesh_md2.py' into '/home/ubuntu/.config/blender/2.73/scripts/addons' ()
trying to save userpref at /home/ubuntu/.config/blender/2.73/config/userpref.blend ok

Blender quit
ubuntu@Ubuntu13:~/blender-2.73a-linux-glibc211-x86_64
$ ./blender
connect failed: No such file or directory
Read new prefs: /home/ubuntu/.config/blender/2.73/config/userpref.blend
found bundled python: /home/ubuntu/blender-2.73a-linux-glibc211-x86_64/2.73/python
Reading: /home/ubuntu/ufoai/mods/techmods_26/standalone/minimedikit/models/minimedikit.md2....Done
Creating mesh.....Done
Model imported
minimedikit:  ('104 vertices', '158 faces')
Export progress: 100% - Model exported.
Saved session recovery to '/tmp/quit.blend'

Blender quit


Sure enough after that draconian measure what came out the other end worked properly with your new code.

Now that it works, the next question comes along, but you'll need to see the mod to actually understand what I'm talking about. I think the scaling option is throwing things off on the mod, because it's confusing the placement routine for orientation, it's like it's having trouble treating it like a 1x2 object now. The logical center of the object seems to be off. It puts it in the wrong orientation compare to objects of similar type.

Quote
For everyone else, this is a 2.6 only mod, built off of bleeding edge code and should not be considered stable or usable for any reason. The mod should be considered completely broke if found at some future date when 2.6 is released to the public, because the code changes could completely destroy the mod. DO NOT USE UNDER ANY CONDITIONS! Here there be dragons, run away.
« Last Edit: July 02, 2015, 01:13:17 pm by ManDrake13 »

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: Scaling Question.
« Reply #14 on: July 01, 2015, 03:21:03 pm »
So blender didn't correctly update the script... well I always copy the file(s) directly to my ~/.config/blender/<version>/scripts/addons/ directory overwriting the previous one, I didn't think of that... glad to hear you got it working now

Anyway, check your minimedikit shape property you have it turned around, it should be "0 0 1 2", you might also want to tweak the center and scale properties, here's an (admitedly brief) explanation of most item properties: http://ufoai.org/wiki/UFO-Scripts/weapon_*.ufo in case you didn't see it already
« Last Edit: July 01, 2015, 06:36:00 pm by DarkRain »