GithubHelp home page GithubHelp logo

denetii / io_thps_scene Goto Github PK

View Code? Open in Web Editor NEW
58.0 8.0 12.0 1.52 MB

THPS Scene import/export for Blender

Home Page: http://tharchive.net/misc/io_thps_scene.html

Python 100.00%
blender thps tony-hawk level-editor

io_thps_scene's Introduction

io_thps_scene

This Blender addon allows you to export a scene as a custom level for some of the classic THPS games. Also includes a variety of import tools to load existing levels/assets, as well as a fully integrated lightmap baking tool.

Migrating from Blender 2.79

Unfortunately, due to various breaking changes introduced with Blender 2.8x, there is no way to seamlessly convert old .blend files that were developed on Blender 2.79. However, I have written a pair of scripts that will take care of it for you. You'll still need Blender 2.79 installed on your system, and you need to know how to run scripts in the text editor. Grab these two scripts here: https://gist.github.com/denetii/6e66891505b32fc7c64c22031288d7f4

'Step 1' is a script that needs to be run on your .blend file from within Blender 2.79. Once that's done, save a copy of your scene, then open the new copy in 2.8x and run the 'Step 2' script in there. Your scene should now be fully migrated and exportable from within 2.8x. The addon has been tested on 2.83.4, but should be compatible with most of the 2.8x versions.

While support for the 2.79 addon isn't stopping yet, eventually the development will move fully to the 2.8x addon.

Installation/Documentation

The complete documentation and changelog can be found at: http://tharchive.net/misc/io_thps_scene.html You can download the addon from there, or grab the newest release on GitHub. It should be a zip file containing two other zip files. Extract the one that corresponds to your Blender version:

  • io_thps_scene_blender2.79.zip is for Blender 2.79
  • io_thps_scene_blender2.8.zip is for Blender 2.8 and newer. Has been developed on 2.83 LTS, but is also compatible with 2.9x

Ensure the zip file you extract is renamed to io_thps_scene.zip, or the installation may not work correctly. Once done, go to Blender's addon manager, click 'Install add-on from file', then choose the zip file you just created. The addon should then appear in the list - click the checkbox to activate it.

There are a few options you can configure, such as viewport colors and menu options. If you wish to use game asset integration, then configure the path to your THPS game installation(s) here.

Changes from the 2.79 version

Since the addon was just migrated, most of the functionality will appear virtually the same as in the 2.79 releases. However, there are a few things to note:

  • The removal of Blender Internal from 2.8 means that I had to implement a way to translate the 'legacy' THPS material/material pass settings into shader nodes for Cycles/Eevee. The result is a much more accurate viewport representation of your materials, including proper handling of vertex colors, vertex alpha, and most blending modes. This will be particularly noticeable when working with imported scenes from the base THPS games.
  • To simplify installation/first time setup, there is no secondary thug_tools package required for setup. All necessary assets are bundled in with the addon code.
  • Because Blender 2.8 finally uses RGBA instead of RGB for vertex color channels, there is no need for a second 'alpha' channel to represent vertex alpha on your meshes. The conversion script moves the R value from the 'alpha' RGB into the 'color' channel's alpha value.
  • Exporting scenes is now much faster without using the 'Speed Hack' export option. The difference in performance is now much lower, perhaps negating the need for the speed hack. But it will remain there for now. This ultimately means you don't have to completely triangulate the scene if you want faster exporting. (This update will come to the 2.79 addon as well)
  • Viewport rendering performance is lower than in 2.79 when a large number of objects that use the addon's color codes (collision flags, auto-rails, etc) are selected at once. This is partly due to the updated OpenGL version in 2.8 removing display lists, but the viewport drawing code needs to be rewritten anyway.

Examples

I host a selection of custom levels built with this addon on the Tony Hawk Archive: http://tharchive.net/misc/custom_levels.html You can also find a larger collection of custom levels at THPSX: http://thpsx.com/community-upload-list/

io_thps_scene's People

Contributors

denetii avatar morten1337 avatar slfx77 avatar theonlyames avatar vadru93 avatar wdywtbt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

io_thps_scene's Issues

Blender 2.9

I got error "cannot import name "THPS4ColToScene" from 'io_thps_scene.import_thps4'" when i tried to use this addon in Blender 2.9

Bug when parsing script names from THUG_SCRIPTS

Script names are not properly cleaned up when importing from THUG_SCRIPTS. In particular, whitespace is allowed, which can cause script names to have spaces in them when imported - which could definitely produce undesirable results when exported.

Broken UVs.

UVs are completely and utterly fucked. Materials do not apply correctly.

Using Blender 3.6.7.

Unable to run in blender 2.93

Hi, when I try and enable the addon within blender I get this error.
blender log here

Traceback (most recent call last): File "/usr/share/blender/2.93/scripts/modules/addon_utils.py", line 386, in enable mod.register() File "/home/tamago/.config/blender/2.93/scripts/addons/io_thps_scene/__init__.py", line 29, in register auto_load.register() File "/home/tamago/.config/blender/2.93/scripts/addons/io_thps_scene/auto_load.py", line 28, in register bpy.utils.register_class(cls) ValueError: bpy_struct "THUGMergedObjects" registration error: vertex_groups could not register

Unable to bake lightmaps (Blender Render)

I've been running into this issue and cannot for the life of me figure out what is causing it.
Whenever I try to bake 'Lighting only' or 'Ambient Occlusion' lightmaps using the Blender Render mode, I get the following error:

**Traceback (most recent call last):
  File "C:\Users\Amy\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_thps_scene\bake.py", line 1003, in execute
    bake_thug_lightmaps(meshes, context)
  File "C:\Users\Amy\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_thps_scene\bake.py", line 621, in bake_thug_lightmaps
    test_mat = orig_mats[orig_index]
TypeError: 'NoneType' object is not subscriptable**

Here's the full console log:


BAKING LIGHTING FOR OBJECT #1 OF 1: Cube


Object lightmap resolution is: 128x128
Resolution after scene scale is: 128x128
Removing existing images/UV maps.
ID user decrement error: IMLM_DAY_Cube (from '[Main]'): 0 <= 0
PyContext 'window' not found
PyContext 'window' not found

Starting unwrap
Generating lengths...done
...done
Consolidating Boxes...Consolidated 0 boxes, done
Packing Boxes 6...done
writing back UVsdone
finished all 0.00
Traceback (most recent call last):
File "C:\Users\Amy\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_thps_scene\bake.py", line 1003, in execute
bake_thug_lightmaps(meshes, context)
File "C:\Users\Amy\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_thps_scene\bake.py", line 621, in bake_thug_lightmaps
test_mat = orig_mats[orig_index]
TypeError: 'NoneType' object is not subscriptable

location: :-1

location: :-1

Blender 3.x support?

I was able to sort of get the plugin to work on Blender 3.1.2, but while I can export a model successfully, I get errors and intermittent lockups whenever I try to start up Blender with the plugin enabled.

Plugin claims an upgrade to 2.8x is required, potentially old build used in 1.1.0 release

Using the io_thps_scene.zip found inside of the release 1.1.0 zip, the internal version of the plugin states that the io_thps_scene is still 1.0.0. Looking on other forums, it seems that this error comes up when a plugin is outdated, not when the Blender version is outdated. Did an old build get mistaken for the newest release? Are there scripts that are outdated that don't work on the current 1.1.0 release?

I'm pretty confident I got the same error message for both versions when trying to enable the plugin. Here's how the plugin appears in the plugin manager for both Blender 2.83.13 LTS and 2.91.0:

image

Installing it brings up this message:
image

Curiously, I did not find either a 2.7 or a 2.8x version of the plugin when I downloaded the latest release:
image

I couldn't find any other .zip files in this project's source or in the other release.

Is there a version of this plugin that matches more of what the Readme currently says? That's fine if the 2.7 version been phased out already, but I'm not sure why the current version isn't working even with 2.83.13 LTS. Any guidance is appreciated.

Linux path issues

Currently when exporting a level on Linux backslashes are still used in the output paths.

No such file or directory: '/home/riha/Documents/THUG+ Levels/Levels\LevelA/LevelA.qb'

screenshot

Should be a easy fix.

THPS2X is not supported

I did notice that

# THPS1 psx files have some key differences, mostly in mesh definition
if magic == b"\x03\x00\x02\x00":
version_num = VERSION_NUM_THPS1
elif magic == b"\x03\x00\x02\x00":
version_num = VERSION_NUM_THPS2X
uses the same value twice. This makes it impossible for VERSION_NUM_THPS2X to be used.

Additionally, nothing ever checks for VERSION_NUM_THPS2X.

I have recently worked on https://github.com/JayFoxRox/thps2-tools which includes some THPS2X support (See my Patreon post for more information about goals and when I learned about this project).

Assets missing scenes?

Maybe they moved but should the assets folder contain a scenes folder? I noticed the previous versions with thug_tools does have this folder but those blends don't seem to work well in 2.8x.

Broken Materials.

Material information is not imported. Materials are completely blank and without any identifiable information.

Using Blender 3.6.7.

Incompatible with Blender 2.80

The latest blender release introduced breaking changes to add-ons. This add-on no longer works on 2.80.
The following exception is printed to the console when trying to load the plugin:

Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender\2.80\scripts\modules\addon_utils.py", line 351, in enable
    mod = __import__(module_name)
  File "C:\Users\djoslin\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\io_thps_scene\__init__.py", line 22, in <module>
    modules = developer_utils.setup_addon_modules(__path__, __name__, "bpy" in locals())
  File "C:\Users\djoslin\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\io_thps_scene\developer_utils.py", line 39, in setup_addon_modules
    modules = import_submodules(names)
  File "C:\Users\djoslin\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\io_thps_scene\developer_utils.py", line 30, in import_submodules
    modules.append(importlib.import_module("." + name, package_name))
  File "C:\Program Files\Blender Foundation\Blender\2.80\python\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Users\djoslin\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\io_thps_scene\import_nodes.py", line 11, in <module>
    from . scene_props import thug_empty_update
  File "C:\Users\djoslin\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\io_thps_scene\scene_props.py", line 9, in <module>
    from . ui_draw import *
  File "C:\Users\djoslin\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\io_thps_scene\ui_draw.py", line 24, in <module>
    draw_stuff_display_list_id = bgl.glGenLists(1)
AttributeError: module 'bgl' has no attribute 'glGenLists'

io_thps_scene not found

I can't seem to export a very simple scene because it keeps on saying that "io_thps_scene" not found

I created a very simple scene just to learn the ropes of exporting and using the plug-in etc, but when I tried to export I get the error message saying that "io_thps_scene" was not found, did i forget to do something while installing the add-on?

Many thanks

People keep on saying that is better to use Blender 2.79b or something but I quite like the UI on this version, would love it if I could stick to this one.

Windows 10
Blender version: 2.8.4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.