Page 1 of 1

Selden's short wish list

Posted: Fri Dec 01, 2017 8:48 pm
by selden
Here are some features that I, as an Addon author, would like to be able to use.

1. "Include" statements in catalog files (.ssc, .stc and dsc)
for example,

Code: Select all

Include ""
Include "stargen/newsystem/"
Some of my .SSC files for Celestia v1.6.1 have become particularly unwieldy. It'd be nice to be able to break them up into pieces which load in a well-defined order. Although Windows normally loads files in alphabetical order, this is not the case for Linux, where files usually seem to be loaded in order of increasing inode value, which can be different for different file systems. The current fix for this random sequence of loading is to include all of the SSC declarations for a particular Addon in a single file.

2. Right-Mouse-Button menu items for Stars which are the same as those available for SSC objects, including the various "Reference Marks" and, eventually, "Alternate Surfaces". (The latter would probably require far more coding than showing Reference Marks would.)

Re: Selden's short wish list

Posted: Sat Dec 02, 2017 9:16 pm
by Janus

A quick glance through loadsolarsystemobjects shows it may be possible to create a recursive loop in that function.
Right now it recognizes 'Add', 'Replace' & 'Modify' keywords.
If 'Include' were added to the list, then it may be possible for the routine to call itself replacing the current filename, with the named one.
This is only at a glance however, actual parse tracing would be needed, but it looks feasible.

I have already been tinkering with adding extra directories for additional textures.
Right now there are lores, medres & hires.
I was looking at adding infrared, untraviolet, xray, alt1, alt2, alt3 to cover bodies and stars alike.
I also had delusions of later being able to combine textures, but that is currently well beyond my knowledge level.


Re: Selden's short wish list

Posted: Wed Dec 13, 2017 5:13 pm
by Janus
Okay, as for the "Include" function.

I believe I have a starting point.

I will be making a temp fork and adding the keyword to make recursive load calls.
My question however, is should I start with stars or solar system objects.

I do not know which would make it easier for you test with.


Re: Selden's short wish list

Posted: Wed Dec 13, 2017 9:08 pm
by selden
I'd prefer the initial attempt to be for SSC (planetary) catalogs. They're the ones which wind up being the longest and most complex in my Addons.

Re: Selden's short wish list

Posted: Thu Feb 01, 2018 4:32 pm
by Janus

The include function became include/append during testing.

Still doesn't work the way I really want it to.

However, during this I traced part of the randomness to a routine called enumfiles.
It reads directories and acts on them in the order returned by the OS.

Since every OS will return different reads of directories nearly every time you read one, the loading order is essentially random.
I fixed that by tweaking enumfiles to read a directory listing into two temp variables.
Filenames & Directorynames, then sort them case insensitively.
It then loads the files, before branching into the subdirectories, all in the same order every time.
Now you can depend on all the files in the directories above a file having been loaded before it is loaded.

While this does not meet the actual original goal, I think it adds value by reducing the chaos of loading.

I have offered the code to Alexell via MP on his forum, but I have not heard back from him for over a week now.

I will be posting a new source archive in a few days, once I have cleaned up some of my comments and properly formatted the code.