Some handy scripts

All about making tracks for MX Simulator
jlv
Site Admin
Posts: 12824
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: Some handy scripts

Postby jlv » Thu Nov 24, 2011 1:21 am

The shell script works OK for Linux but it's a pain to get it working on Windows. You'd need to install Cygwin and you'd still have unix/dos line ending issues.

I unlocked DJ's post. Let the noob spamming begin!
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.

User avatar
MOTO NATIOM112
Posts: 314
Joined: Sun Sep 11, 2011 9:16 pm
Team: MV Films

Re: Some handy scripts

Postby MOTO NATIOM112 » Thu Nov 24, 2011 2:38 am

jlv wrote:The shell script works OK for Linux but it's a pain to get it working on Windows. You'd need to install Cygwin and you'd still have unix/dos line ending issues.

I unlocked DJ's post. Let the noob spamming begin!

lol
Image

User avatar
wheels1758
Posts: 4121
Joined: Tue Oct 21, 2008 5:20 pm
Location: Washington, USA
Contact:

Re: Some handy scripts

Postby wheels1758 » Thu Nov 24, 2011 7:31 pm

jlv wrote:You should make it take separate x, y and z scales so you can use it for making billboard to full detail transition models. Look near the end of this post (Smoothing the LOD Transistion) for an example of when it would be useful.

Which topic is locked?


JM Scaling Script

New:
--Will not allow identical input/output filenames
--Separate x, y, z multipliers

Syntax-

Code: Select all

python jm_scaler.py input.jm scale_x scale_y scale_z output.jm


Wheels wrote:Let me know if you have problems. It only works for JM1 files. And it only works with Python 2.6. Hows that for versatility? :lol:

User avatar
DJ99X
Posts: 15467
Joined: Tue Jan 15, 2008 11:36 am
Location: Land Down Under

Re: Some handy scripts

Postby DJ99X » Fri Nov 25, 2011 12:43 am

Thats pretty sick!

I'll try and update that thread

User avatar
Shadow
Posts: 2751
Joined: Sun Dec 02, 2007 5:10 pm
Team: FSK
Location: Finland

Re: Some handy scripts

Postby Shadow » Sat Jan 14, 2012 11:10 pm

Anyone care to update jlv's .jm export script to work in v2.61 blender? They've changed the addon installation info and I can't figure out how to get it working.
Image
Those who possess strength have also known adversity.

jlv
Site Admin
Posts: 12824
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: Some handy scripts

Postby jlv » Sun Jan 15, 2012 6:01 am

Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.

User avatar
Shadow
Posts: 2751
Joined: Sun Dec 02, 2007 5:10 pm
Team: FSK
Location: Finland

Re: Some handy scripts

Postby Shadow » Sun Jan 15, 2012 12:10 pm

Thank you! :D
Image
Those who possess strength have also known adversity.

User avatar
haggqvist
Posts: 352
Joined: Sun Jan 31, 2010 11:44 am
Location: Sweden

Re: Some handy scripts

Postby haggqvist » Thu Nov 15, 2012 8:57 pm

Here are two python scripts that re-calculates the coordinates for trackfiles.
Thanks to WHEELS for testing and feedback.

Track rescaling script:
This one just re-calculates the coordinates for all trackfiles to fit a new scale in a user supplied new_terrain.hf file.

Link:
http://www.mediafire.com/?uwgsjue5zvr0a96

Instructions:
  1. Make a new terrain.hf file with the new scale in it and place it in the trackfolder.
  2. Run the script from the command line, either from the trackfolder or just enter the path to the trackfolder manually when prompted.
  3. The new trackfiles are now ready for use and the old ones have been saved with a *_old suffix.


Track crop script:
This one re-calculates the coordinates for all trackfiles from a given set of crop values for the terrain.png, see the image below.
Image

Link:
http://www.mediafire.com/?msits2s3o83j7a7

Instructions:
  1. Run the script from the command line, either from the trackfolder or just enter the path to the trackfolder manually when prompted.
  2. Supply the crop values when prompted.
  3. The new trackfiles are now ready for use and the old ones have been saved with a *_old suffix.
Image

User avatar
wheels1758
Posts: 4121
Joined: Tue Oct 21, 2008 5:20 pm
Location: Washington, USA
Contact:

Re: Some handy scripts

Postby wheels1758 » Mon Jun 24, 2013 9:43 pm

....Manual Shape/Collision File Creator Helper Script Thingy For Blender....

http://www.mediafire.com/view/i7dfvb0ib6i655m/shape.creator.py

Steps: (Correspond to images below)
  1. Open Blender with your object. Make sure Y axis is vertical (don't NEED to 'apply' rotation).
  2. Add a sphere (uv or iso). Place and scale in OBJECT mode.
  3. Add as many spheres as your heart desires. Scale them all differently if you feel so inclined.
  4. Open the text editor in a different panel.
  5. Open text block. Find and select the provided script. It will show up in the text editor.
  6. Select all your spheres and click "Run Script". You'll have to specify a filename (it should end in .shp)
  7. If you experience errors, turn on Blender's system console.
  8. You'll see an error message like this if you did it wrong. Otherwise it will say how many spheres were written.
  9. Open the file in notepadd++ (or whatever you use). Find and replace friction_coefficient, spring_constant, and damping_coefficient with your desired values.

Image
Image
Image
Image
Image
Image
Image
Image
Image

User avatar
haggqvist
Posts: 352
Joined: Sun Jan 31, 2010 11:44 am
Location: Sweden

Re: Some handy scripts

Postby haggqvist » Mon Jun 24, 2013 10:43 pm

Cheers WHEELS, now the track fencing will have extremely annoying collisions for the rest of the GP-series... :lol:
Image

User avatar
wheels1758
Posts: 4121
Joined: Tue Oct 21, 2008 5:20 pm
Location: Washington, USA
Contact:

Re: Some handy scripts

Postby wheels1758 » Tue Jun 25, 2013 12:35 am

....Banner Maker Helper Thingy For Blender....

http://www.mediafire.com/download/1b6pb2903n65bfp/curve.to.banner.py

Steps: (Correspond to images below)
  1. Open Blender and import the terrain mesh. This is kinda complicated. I think Haggqvist documented it somewhere...
  2. Go to top view (7 on numpad). Were going to use Z as up, and convert when we export the JM. Add a bezier curve. Extrude, scale, rotate as needed in EDIT MODE.
  3. Subdivide the life out of that bezier curve. The more subdivisions, the closer to the specified width the fence sections will be.
  4. Alt + C and convert curve to mesh. Check the 'Keep Original' for safety.
  5. Open text editor. Find and select the provided script. Load it. It will show up in the text editor. You can change FENCE_WIDTH and FENCE_END_PRECISION to suit your needs (I use 10 feet for the nationals fencing, then 80 or 90 percent is fine).
  6. Go to object mode. Select the bezier curve. Click 'Run Script'. Open the system console if there are errors.
  7. Set your snap settings like this. Still in the top view, select the new mesh, go to edit mode, select all verts, move in the Z direction (G, Z), hold ctrl and click on the terrain mesh. This should snap all verts to the mesh.
  8. Extrude the line of verts vertically. You have a line of banners. UV map as required for your banner skin.

Image
Image
Image
Image
Image
Image
Image
Image

760Liam
Posts: 1403
Joined: Sun Jul 03, 2011 5:33 pm
Location: California

Re: Some handy scripts

Postby 760Liam » Tue Jun 25, 2013 12:41 am

:shock: AMAZING!!!
Image

jlv
Site Admin
Posts: 12824
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: Some handy scripts

Postby jlv » Tue Jun 25, 2013 1:31 am

haggqvist wrote:Cheers WHEELS, now the track fencing will have extremely annoying collisions for the rest of the GP-series... :lol:

If you do that, try to break it up into multiple objects. One object with hundreds of spheres will be much slower than 10 obects with 10 per object since the bounding sphere test is per object.
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.

User avatar
yzmxer608
Posts: 15229
Joined: Mon Dec 29, 2008 4:30 am
Team: Race Tech/SD
Location: Wisconsin, U.S.A

Re: Some handy scripts

Postby yzmxer608 » Tue Jun 25, 2013 2:59 am

I love you Wheeler.
TeamHavocRacing wrote:If I had a nickel for every time someone asked for this, I would have a whole shitload of nickels.

User avatar
haggqvist
Posts: 352
Joined: Sun Jan 31, 2010 11:44 am
Location: Sweden

Re: Some handy scripts

Postby haggqvist » Tue Jun 25, 2013 8:00 am

jlv wrote:
haggqvist wrote:Cheers WHEELS, now the track fencing will have extremely annoying collisions for the rest of the GP-series... :lol:

If you do that, try to break it up into multiple objects. One object with hundreds of spheres will be much slower than 10 obects with 10 per object since the bounding sphere test is per object.

It was mostly a joke as I probably won't have time to get it done for the tracks this year but cheers for the heads up.
I really wish there was time for it though as it would be a really handy way of keeping people on the track without littering the things with zillions of bales.

On the tech side; as it is now the fencing is split up into 14 parts for the GP-tracks, i.e. one .jm placed at 0,0 for every banner texture.
Would the collision testing be faster if the fence objects where split up even further e.g. with a separate .jm for every single continuous segment that has the same texture?
My idea was to place 2-4 spheres along the top edge of each fence segment and set up the collision values so that it's fairly easy to go across it at slower speeds while still making you crash when you run into it at higher speeds and lower angles of intersection.


ALL CAPS WHEELS wrote:....Banner Maker Helper Thingy For Blender....

Thank you for taking the time to finish this!

However, I would just like to add that since the release of Blender 2.64 it's really easy to import terrains and there's no need for the gamma-related voodoo of old.
There are now options for setting the color space for a texture in the texture panel i.e. it's now possible to use the source terrain.png from the trackfolder directly as a heightmap for the displacement modifier.
This is really handy because the .blend file for the terrain can now be set up at an early stage since all changes to the terrain.png will be updated automatically.

Here's a screenshot of the texture panel option, just set the value to linear.
Image
Image


Return to “Track Editing”

Who is online

Users browsing this forum: No registered users and 2 guests