Giter Club home page Giter Club logo

blendradiant's Introduction

BlendRadiant

This is a fork of c-d-a's io_export_qmap Blender Addon, with the aim of modifying it until it can export maps that are directly readable by (Gtk/Net)Radiant. Another aim is to add tools that facilitate the creation of entire maps (including lights, models, entities, ... and not just brushes) in Blender, basically allowing users to do everything they could otherwise do in (Gtk/Net)Radiant - hence the name BlendRadiant.

Status

Right now, only the UI has been worked on, while the actual export functionality has only had features removed compared to io_export_qmap. I only put this on GitHub to have an issue tracker.

BlendRadiant object properties in Blender UI

BlendRadiant Add-on preferences in Blender UI

Required features until "minimal viability"

  • Export meshes as "rooms" ("Make Room" in (Gtk/Net)Radiant)
  • Export entity key-value pairs
    • Read entity definitions from Radiant gamepack files
    • UI for setting entity classname and attributes
    • Actual export
  • Export lights
    • Export as ordinary entities (no special case for lights)
    • Special UI that is more limited version of entity UI (?)
  • Either output directly as Brush Primitive map (Radiant format) or use q3map2 to convert after export
  • Fix texture issues
  • Massive cleanup

Features that would be nice to have

  • Global scale factor
  • Export as models
  • Read shader definitions (existing addons?)
    • Alternatively: export rudimentary shader based on Blender material as placeholder
  • Approximate lights from Blender's native light properties
  • Scale mesh with point entity class so bounding box matches spec

Below is io_export_qmap's original README:


Exports either individual faces as pyramids, or objects as convex brushes. Uses material names for texture assignment and material image size for scaling. Supports UVs both in standard Quake and in Valve220 format (adapted from EricW's implementation for OBJ2MAP). Offers custom grid. Allows saving to clipboard.

The exporter ensures that the brushes are convex and the faces planar. You don't have to triangulate the meshes in advance, but in some cases it can help with UVs (e.g. with mid-edge vertices). There's room for improvement, but it should work fine as is.

Standard format UV export is lossy (no shearing). I don't really expect anyone to be using it over Valve220 anyway, but it should produce decent results for id1-style detailing. Single-axis curves should be fine, no miracles though.

Only tested in Trenchbroom for now. Might need to change precision for other editors. Let me know if it works/breaks elsewhere.

blendradiant's People

Contributors

stingray300k avatar c-d-a avatar joeedh avatar

Stargazers

Vioxini avatar  avatar Hermann Rolfes avatar Razvan B. avatar

Watchers

Razvan B. avatar Hermann Rolfes avatar

blendradiant's Issues

Fix texture issues

Right now, exported standard Q3 maps converted via q3map2 open fine in NetRadiant, but moving a wall makes it crash because it can't handle the texture transform. So something is wrong. Could be just that standard Q3 textures aren't fully supported by io_export_qmap => try using qbsp to convert from Valve220 to Brush Primitves.

Better UI for choosing suggested or own entity classname / key names

Right now I use special "search" operators bound to buttons next to the text field(s), but that seems rather hacky. Blender 2.93's randomize attribute geometry nodes have a text field which shows suggestions once you type, with an extra suggestion marked with a "+" icon for exactly what you typed. That's exactly what I'd need here.

Don't use enums for things loaded from FS / dynamically changed

See comment here:

# TODO having this as an enum is actually wrong because they're saved as
# ints, so whenever the directory changes it will mess up its meaning...
# somehow only use enum for UI but save as str

Not sure how to do this. Last time I checked there was no way for Blender addons to listen to "events" such as the user selecting something in a drop-down menu. One option would be an additional button that needs to be pressed to "lock in" one's selection, but that is outrageously stupid.

Global "include in map" flag?

Right now, the logic for inclusion in the map is:

  • all mesh-type objects that don't have mesh_as="NONE" (or MODEL because that's not implemented yet)
  • even those meshes that do have mesh_as="NONE" if they have an entity classname or entity key-value pairs set
  • objects of any other type if they have an entity classname or entity key-value pairs set

Perhaps it would be better if, in addition to that, there was a global "include in map" flag at the top of the BlendRadiant properties for easily switching "off" certain objects without having to change any of their properties?

Fix nomenclature (.map)

Right now there are a lot of terms like "non-brush" / "brushless" entities - in entities.ent, these are simply called "point" entities, in contrast to "brush entities" which are called "group entities".
I think "brush entities" is pretty established, but the other thing should definitely be called "point entities".

Better UI for entity values

E.g. if it's a number, show Blender's native integer thing, etc. Types are defined in entities.ent for each key.
Perhaps that would require moving it out of template_list, but that's fine by me, anyway.

Scale mesh bounding box to point entity specs

entities.ent defines dimensions for point entities. Meshes in Blender marked as Mesh as: Nothing but with entity stuff set could be scaled so their bounding box matches these dimensions.

Fix nomenclature (Blender)

Naming of classes etc. is all over the place... some use Blender's recommendations, others don't. Look up how to name what and fix.
Also, all operators etc. should have the blendradiant_ prefix (BlenderKit does it that way, makes sense).

Copy entire scene before exporting?

Right now, high-level modifications to objects (e.g. applying modifiers) are made by duplicating them first right before the export so the original remains untouched, then deleting them after the export is complete. This is a bit stupid as it does modify the scene itself and if something goes wrong, there will be leftover duplicates polluting it.

A bettter approach would be to do something like suggested here, save the entire scene somewhere else and operate on that copy. AFAICT the "Save As Copy" function could be used for that (save in some tmp dir), followed by launching a new Blender instance in batch mode as a subprocess to operate on that copy. This would leave the original scene entirely untouched.

Would help with #3.

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.