Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

249: Create the 2.49 to 2.79 converter! #348

Open
10 of 18 tasks
tngreene opened this issue May 4, 2018 · 6 comments
Open
10 of 18 tasks

249: Create the 2.49 to 2.79 converter! #348

tngreene opened this issue May 4, 2018 · 6 comments
Assignees
Labels
2.49 Converter Bugs/Features related to the 2.49 Converter Feature

Comments

@tngreene
Copy link
Contributor

tngreene commented May 4, 2018

Many artists are, in 2019, stuck using 2.49 because their work is locked away. We need a way to open a 2.49 project in Blender, scrape and correct previous properties, and map them to new ones. This is a major undertaking and so it shall be split into multiple parts. I envision this as part of the addon, like a button you press to cleanup a file.

This bug serves as the central hub for finding (some) other parts of the project

Major Parts

General Steps

DataRefs Conversion

None!

Materials

Textures

UI

Features

@tngreene tngreene self-assigned this May 4, 2018
@tngreene
Copy link
Contributor Author

tngreene commented May 4, 2018

XPlane2Blender Documentation Sources

In a conversation with Ben about manipulators he said

Key values map of properties is fixed, not a hash table, class with members.
Members always have value. Scheme is fixed, unlike in 2.78

Blender 2.49 Documentation Sources

@tngreene
Copy link
Contributor Author

tngreene commented May 4, 2018

Plan Of Attack

(In a slightly ordered list)

  • Learn enough of how Blender 2.49 works to get around the UI, make cubes
  • Learn enough of 2.49 XPlane2Blender to make OBJs with cubes
  • Dig into source code and try to identify where how settings and values are taken
  • Start making the 2.49 to 2.78 translation guide of how 2.49 settings get turned into 2.78 properties
  • More to come

@der-On
Copy link
Contributor

der-On commented May 7, 2018

Dig into source code and try to identify where how settings and values are taken

The old blender 2.49 exporter is basically a giant heavily nested loop. "Magic" values and settings are taken from various strange settings mainly in the game-engine and face-properties site of blender.

Beware from single or two letter variables all over the place and if else constructs of darkness. ;)

@tngreene
Copy link
Contributor Author

tngreene commented May 8, 2018

Talking with some developers on #blenderpython it seems that the conversion happens in
blender\source\blender\blenloader\intern\versioning_(250|260|270).c. The legacy and other properties are copied and transformed in those files.

Edit: versioning_legacy is actually unused!

In versioning_legacy.c see bl_do_versions_pre250, in versioning_250.c see blo_do_versions_250, etc etc.

These are called in blenloader\intern\readfile.c, line 8500 - 8503 as part of it's do_versions method (which is part of the you, guessed it, reading file sequence)

@tngreene
Copy link
Contributor Author

tngreene commented May 16, 2018

Overview of Animation System

Important classes

  • XPlaneExport.Anim
  • XPlaneExport
  • XPlaneAnimObject.doapply
    # The dataref values are encoded into properties here
    # datarefs values
    for boneno in range(len(datarefs)):
        ref=datarefs[boneno].split('/')
        name=make_short_name(datarefs[boneno])
        #name=ref[-1]
        if indices[boneno]!=None: name='%s[%d]' % (name, indices[boneno])
        if len(ref)>1 or name in lookup:
            # write vals for ambiguous and unusable datarefs, but not invalid
            for frameno in range(len(vals[boneno])):
                if not ((frameno==0 and vals[boneno][frameno]==0) or
                        (frameno==(len(vals[boneno])-1) and vals[boneno][frameno]==1)):
                    props['%s_v%d' % (name, frameno+1)]=vals[boneno][frameno]
                if loops[boneno]:
                    props[name+'_loop']=loops[boneno]

@tngreene tngreene added the 2.49 Converter Bugs/Features related to the 2.49 Converter label May 17, 2018
@tngreene tngreene added good first issue Bugs in one or two easy plces that can be fixed quickly in progress and removed good first issue Bugs in one or two easy plces that can be fixed quickly labels Aug 24, 2018
@bsupnik
Copy link
Collaborator

bsupnik commented Aug 28, 2018

Notes from Ted's first successful animation translation:

  • The STATIC animations induced by this import have no dataref names I don't no whether this is actually a latent (or always present) output bug in 2.78 or due to missing data in the translion, but

    ANIM_trans 5 0 0 5 0 0
    ANIM_rotate 1 0 0 90.00020741 90.00020741

There should be some kind of dummy dataref name for both of these, e.g. no_ref or none. MAtching existing 2.78 dummy dataref convention would be sane.

Every animation brought forward shows optimization bug #331 - not surprising since all 2.49 projects are armature based. We probably need to resolve #331 to consider 2.49 import comparable performance-wise.

@tngreene tngreene changed the title Create the 2.49 to 2.7x converter! 249: Create the 2.49 to 2.7x converter! Sep 20, 2018
@tngreene tngreene changed the title 249: Create the 2.49 to 2.7x converter! 249: Create the 2.49 to 2.79 converter! Jul 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.49 Converter Bugs/Features related to the 2.49 Converter Feature
Projects
None yet
Development

No branches or pull requests

3 participants