Hello. I have a serious question and me can be helped by brainstorming from all over the community.
I want to find a way to control individual elements of an object without changing the source code Celestia. For example, enable/disable rings, switch between the sphere and 3D model, change the atmosphere or clouds. Switching should occur in the program itself without the need for a restart.
With "Lua Edu Tools" it is possible to only turn on/off whole object, but do not change its properties. Working variant with two different objects (with different names) does not suit me. And the function "Modify" requires a restart.
Can I implement the idea using scripts (CEL, CELX)? Or somehow yet?
Thank you for any help.
Control individual elements
Forum rules
Please help to make this forum more useful by checking the FAQs before posting! Keep it clean, keep it civil, keep it truthful, stay on topic, be responsible, share your knowledge.
Please help to make this forum more useful by checking the FAQs before posting! Keep it clean, keep it civil, keep it truthful, stay on topic, be responsible, share your knowledge.
-
Topic authorArt Blos
- Moderator
- Posts: 1150
- Joined: 31.08.2017
- Age: 32
- With us: 7 years 2 months
- Location: Volgodonsk, Rostov Oblast, Russia
Control individual elements
Founder and head of the project "Celestia Origin"
SSC objects have several characteristics which can be changed by making an appropriate CelX function call.
For specifics, see the list of object methods at https://en.wikibooks.org/wiki/Celestia/Celx_Scripting/CELX_Lua_Methods/Celx_object
A workaround for those characteristics which are not supported is to use the "setvisible" function, using it to replace one object by another.
For specifics, see the list of object methods at https://en.wikibooks.org/wiki/Celestia/Celx_Scripting/CELX_Lua_Methods/Celx_object
A workaround for those characteristics which are not supported is to use the "setvisible" function, using it to replace one object by another.
Selden
I have been working on something like this myself.
In my case, it is replicating constellations as script controllable paths to show travel.
Making them individually showable, and in stages if desired, unlike constellations that are all or nothing.
However, all you are really talking about is recognizing individual attributes of objects at run time.
Simply expanding a scripts ability to dive into the class/subclass structures is not hard, just time consuming.
SolarSystem::Body::RingSystem.GetRings can be made script accessible, as can SetRings.
Feel like learning some C/C++ ?
Janus.
In my case, it is replicating constellations as script controllable paths to show travel.
Making them individually showable, and in stages if desired, unlike constellations that are all or nothing.
However, all you are really talking about is recognizing individual attributes of objects at run time.
Simply expanding a scripts ability to dive into the class/subclass structures is not hard, just time consuming.
SolarSystem::Body::RingSystem.GetRings can be made script accessible, as can SetRings.
Feel like learning some C/C++ ?
Janus.
-
Topic authorArt Blos
- Moderator
- Posts: 1150
- Joined: 31.08.2017
- Age: 32
- With us: 7 years 2 months
- Location: Volgodonsk, Rostov Oblast, Russia
Janus wrote:Feel like learning some C/C++ ?
Art Blos wrote:without changing the source code Celestia
Let it be so. If only it worked. But I would like to make sure that scripts are the only solution.Janus wrote:Simply expanding a scripts ability to dive into the class/subclass structures is not hard, just time consuming.
Founder and head of the project "Celestia Origin"
Unfortunately, by itself, ring visibility is not one of the available options. As a result, one much change the visibility of two complete Saturn definitions, one containing one ring definition (e.g. the default Saturn definition provided with Celestia) and one containing the other (e.g. Saturn_rings2).
For example, create this ssc file:
saturn2.ssc
I have left out most of the SSC definition. You'll have to fill it in appropriately, perhaps copying the text from Celestia's file solarsys.ssc
Here's a script which replaces Saturn with Saturn2 or Saturn2 by Saturn, depending on which is currently visible:
toggle_saturn.celx
For example, create this ssc file:
saturn2.ssc
Code: Select all
"Saturn2" "Sol"
{
Visible false
Texture "saturn.*"
# much omitted
Rings {
Inner 74500
Outer 140220
Texture "saturn_rings2.png" # specify image for new rings
}
}
I have left out most of the SSC definition. You'll have to fill it in appropriately, perhaps copying the text from Celestia's file solarsys.ssc
Here's a script which replaces Saturn with Saturn2 or Saturn2 by Saturn, depending on which is currently visible:
toggle_saturn.celx
Code: Select all
obj1 = celestia:find("Sol/Saturn")
obj2 = celestia:find("Sol/Saturn2")
if obj1:visible() then
obj1:setvisible(false)
obj2:setvisible(true)
else
obj1:setvisible(true)
obj2:setvisible(false)
end
Selden
-
Topic authorArt Blos
- Moderator
- Posts: 1150
- Joined: 31.08.2017
- Age: 32
- With us: 7 years 2 months
- Location: Volgodonsk, Rostov Oblast, Russia
Then this method is no better than control through "Lua Edu Tools". Again duplicate objects and the catalog is littered. Hence the disappointing conclusion that scripts will not help me.selden wrote:Unfortunately, by itself, ring visibility is not one of the available options.
No more ideas?
Founder and head of the project "Celestia Origin"