Coder Social home page Coder Social logo

x-plane / xplaneforexporter Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 2.81 MB

Our .for exporter addon for Blender

Home Page: https://github.com/X-Plane/XPlaneForExporter

License: GNU General Public License v3.0

Python 95.64% Forth 4.36%
blender-addon python

xplaneforexporter's People

Contributors

danita avatar pbednar73 avatar tngreene avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

xplaneforexporter's Issues

Implement SKIP_SURFACE

Implement SKIP_SURFACE!

  • UI needs SKIP_SURFACE list, with +/- buttons to add and remove, and an enum of choices
  • Unit test to show that, by default, "water" is skipped, when "water" is removed that exports, and all the rest of our choices are exported
  • Code in forest_file.py

Write 3D model vertices and IDX table per MESH

This will end up being a lot like XPlane2Blender, but with lots of little VERTEX tables. The bone_index and bone_weight stuff can wait for that bug. First we'll just see it in X-Plane

  • Unit test of 3D trees
  • exporter code
  • screenshot of it in X-Plane!

Use Mesh name instead of Object Name for 3D meshes

We use the object name for objects in two places

  1. MESH name
  2. Ensuring we don't write the same name twice

We need to use the mesh data name or when a mesh gets re-used between objects the mesh table will be redundant twice

Implement perlin _PARAMS directive

We have the directives in, but, we don't have the unit tests or do any validations

  • Unit test showing we export the correct values only when enabled

  • Unit test showing we give an error if Amplitude is outside of [-1, 1]

  • Is a wavelength of 0 a problem? Does that mean anything? I think its fine.

Awesome logger!

It would be awesome to implement some of the ideas in X-Plane/XPlane2Blender#329

  • Console logger in exporter
  • InternalTextBlock logger
  • Logger message has error codes
  • Error codes are well organized!
  • Supports messages
  • Can give problem datablocks to do something with later
  • Filter by types
  • Write log to file
  • Far better API than XPlane2Blender's log
  • Unit test that logger logs to TextBlock, file, prints message and type code successfully, and filter by message type functions filter

Implement 3D Trees!

3D Trees are a very new and exciting part of our ecosystem. The full docs (as it were) are on Google Docs.

  • Learn what more 3D models are needed for test cases and what people might be modeling and how
  • Teach exporter to look for 3D model under tree. What happens if there is a billboard and a 3D mesh? Are they exclusive?
  • New Empty RNA props: <lod_near> <lod_far>? Or if we have lods per mesh, would these be on the mesh? #10
  • Take 3D model and output its vertices #11
  • Take 3D model, find it's bone weights and output that #12
  • unit tests a long the way as things settle into place, but not like what we have with #1!

Implement TREE frequency weight system

Right now we're using a frequency prop which you'd still have to do the math to make sure that each TREE with that layer number adds up to 1.0. Petr and I had this exchange:

I'd like to know a little more about what you meant by "weighted importance".

If you have Trees A, B, C, D and they should ultimately have the frequencies (not that you would normally hand calculate this)

[.5, .25, .125, .125]
What values would you put in the UI for each tree?
tree_freq = (tree_weight / sum_of_all_weights) * 100

So for your example I can use weights like:
2, 1, 0.5, 0.5
or
4, 2, 1, 1

Seems fine enough! Though I'd like to stick to ints.

  • Replace frequency prop with Weighted Importance prop
  • Unit test showing that weights are properly used and all frequencies - per layer number (we'll have multiple layer numbers) add up to 100
  • Code for importance feature

Build version and all that stuff

Right now all we have for version numbering is what is in init.py. XPlane2Blender has this extremely complicated data model vs build number system that has caused more headaches that it has really ever been worth.

I think for this version we can get away with simply well defined use of Blender's addon version, and some custom flag saying when it was built and if it is alpha,beta

So, no DATA_MODEL property this time - since .for is a very very simple spec.

  • Unit test showing we have "YYYYMMDDMMSS" or "NO_BUILDNUMBER"
  • Unit test showing we have "dev", "alpha", "beta", "rc"

No legacy file!

TODO: Review spec to make sure our ordering of the VerStruct stuff makes more sense this time.

Also to do, can we do without the whole version history thing? This, was, again, very complicated and so far for XPlane2Blender I've never had to do more than see the last version they used (which was either a way old version or the previous version)

Validations for 3D LODs

We need to show that the LODs are within spec for bad cases (and maybe a few more good cases. Not sure what those are yet). Also need validation that no 3D LOD goes beyond Max LOD?

Small billboards being counted as 0 height

Petr gave me this file tiny_billboard_issue.zip

I believe the issue is that since the grass billboard is less than .or equal to .5 meters high the height is getting rounded down to 0

Add X-Plane SHADER global attributes

At the top of the header we're going to want

SHADER_2D
TEXTURE billboards.png
TEXTURE_NORMAL billboards_NML.png

SHADER_3D
TEXTURE trees_3d.png
TEXTURE_NORMAL trees_3d_NML.png

Along with other standards listed here: https://developer.x-plane.com/article/standard-shading-options-for-x-plane-10-scenery/#Availability_of_Extensions (but certainly not all of them)

  • Clarify with Petr what he wants
    • TEXTURE
    • TEXTURE_LIT
    • TEXTURE_NORMAL
    • NO_BLEND
    • SPECULAR
    • BUMP_LEVEL
    • NO_SHADOW
    • SHADOW_BLEND
    • NORMAL_METALNESS
    • NORMAL_TRANSLUCENCY (new)
  • RNA - where we put it
    1. Exporter looks at 2 string properties (or autodetect from children) in each Forest - the names of the SHADER_2D and SHADER_3D material datablocks
    2. The materials have the properties to set the header directives - with more space in the UI and better ability to re-use between forests
    3. As we figure out what the standard node set up should be we can move properties from the Material Properties tab to the shader setup
  • Unit test
  • Code

Implement per 3D Mesh LOD RNA

The tentative spec says that each 3D tree will be having its own LOD. We'll need

  • lod_near, lod_far per XPlaneForMeshSettings
  • Unit test showing correct version
  • Unit test showing validations for bad cases doesn't work
  • Exporter code activated during writing a ForestTree

Unit test backlog checklist

I've been developing this addon like a mad man without much pause for making unit tests. Tsk, tsk.

Directives

  • GLOBAL directives
    • TEXTURE
    • LOD
    • SCALE_X/Y (should match img)
    • SPACING
    • RANDOM
    • NO_SHADOW
  • SKIP_SURFACE (#2)
    • SKIP_SURFACE water included by default in UI, in case someone is making trees in a swamp I guess and needs it then and only then?
    • SKIP_SURFACE additional directives given
  • GROUP and layer number system (#3, #4)
  • perlin _PARAMS (#5)

WYSIWYG trees

  • Vertical detected regardless of how it was made 4c46ccb
  • Horizontal detected regardless of how it was made
  • TREE parameters detected
  • Y_QUAD parameters detected (#8)

General stuff

  • Hidden (as shown in the viewport) stuff is not exported
  • Logger logs and each transport type works
  • No sub collections = no layer numbers = invalid forest

Re-org of No-Blend, add Blend Hash

We currently have

- Has No Blend
- Has Specular
- Has Bump Level

But what we need is

- [No Blend | Blend Hash] (enum property shown with `expand=True`)
- Has Specular
- Has Bump Level

No Blend and Blend Hash (or rather, BLEND_HASH)

  • Property change
  • Change xplane_std_shader_directives unit test

Implement GROUP and layer number system

If using _PARAMs, we're using the GROUP system. If not, each sub collection just gives a layer number.

In either case the representation is the same - the 2nd level collections are the the form of "

  • Unit for good cases
    • GROUP and layer numbers given properly
    • layer number comes from name
    • collection with just "1" or whatever for a name still work
    • empty sub collection is ignored
    • All trees under the same collection share the same layer number, even if linking was used
  • Unit test for bad cases
    • bad names "1badname", "no number", "1.234 float used instead", "-1 negative number given", etc
    • duplicate layer numbers made - no collections "2 layer numbers" and "2 another collection"
  • Code for GROUP system
  • Code for regular layer system

WYSIWYG Y_QUAD parameters

Y_QUAD has the following parameters and where they should come from

  • Unit test showing UV co-ords chosen properly, offset is None, or in a corner, WIDTH matches, elevation matches, rotation matches
  • Unit test for errors if elevation is < 1, no UVs given, WIDTH is 0, offset_x/y is negative or out of UV bounds
  • <s> UV coords
  • <t> UV coords
  • <w> UV coords
  • <h> UV coords
  • <offset_center_x> origin point relative to rest of quad
  • <offset_center_y>origin point relative to rest of quad
  • <y_quad_width> WIDTH (as defined by longest side) scaled to UV coords
  • Z position of Y_QUAD object
  • rotation around Z axis in degrees

Stop using material texture node for anything

Turns out it is annoying and unclear to need to give a material's texture slot in one part of the program (getting the size) and just a file path in another

  • unit test (update old ones?)
  • Code

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.