This commit is contained in:
h z
2024-06-21 20:57:19 +08:00
commit 7eed16cd02
48 changed files with 1599 additions and 0 deletions

2
.gitattributes vendored Executable file
View File

@@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

3
.gitignore vendored Executable file
View File

@@ -0,0 +1,3 @@
# Godot 4+ specific ignores
.godot/
android/

13
.idea/.idea.VirtualChemDemo/.idea/.gitignore generated vendored Executable file
View File

@@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/projectSettingsUpdater.xml
/modules.xml
/contentModel.xml
/.idea.VirtualChemDemo.iml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

BIN
Assets/Atom.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 B

34
Assets/Atom.png.import Executable file
View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dwdq5w17xjv18"
path="res://.godot/imported/Atom.png-82387415c8a4b737bd2c35a7fc20bb08.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Atom.png"
dest_files=["res://.godot/imported/Atom.png-82387415c8a4b737bd2c35a7fc20bb08.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
Assets/Bottle.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

34
Assets/Bottle.png.import Executable file
View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dnfv1cab4fbb1"
path="res://.godot/imported/Bottle.png-5cc68d0152334bdf774876c7b2f304da.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Bottle.png"
dest_files=["res://.godot/imported/Bottle.png-5cc68d0152334bdf774876c7b2f304da.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
Assets/ConnectPendingAtom.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 B

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b5rdjefwmh10t"
path="res://.godot/imported/ConnectPendingAtom.png-20c452cc3a92c27df01519b154992d5c.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/ConnectPendingAtom.png"
dest_files=["res://.godot/imported/ConnectPendingAtom.png-20c452cc3a92c27df01519b154992d5c.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
Assets/Content.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

34
Assets/Content.png.import Executable file
View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://daq4xhxh3x5s8"
path="res://.godot/imported/Content.png-8bacee953efbc1db37a83269b1f6ac9f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Content.png"
dest_files=["res://.godot/imported/Content.png-8bacee953efbc1db37a83269b1f6ac9f.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
Assets/Flask.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

34
Assets/Flask.png.import Executable file
View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://chx2yte05x4lj"
path="res://.godot/imported/Flask.png-e92b272abe676f7b1b1836b6e73ea766.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Flask.png"
dest_files=["res://.godot/imported/Flask.png-e92b272abe676f7b1b1836b6e73ea766.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
Assets/FlaskContent.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 B

34
Assets/FlaskContent.png.import Executable file
View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bcly47aut0nc4"
path="res://.godot/imported/FlaskContent.png-c312b67a447fe1f204fda81bc9550539.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/FlaskContent.png"
dest_files=["res://.godot/imported/FlaskContent.png-c312b67a447fe1f204fda81bc9550539.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
Assets/FlaskSeperator.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 B

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b5g6vjintef0"
path="res://.godot/imported/FlaskSeperator.png-420534126e054a5f806c5803d478669e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/FlaskSeperator.png"
dest_files=["res://.godot/imported/FlaskSeperator.png-420534126e054a5f806c5803d478669e.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

11
GlobalAccess/GlobalScene.cs Executable file
View File

@@ -0,0 +1,11 @@
public static class GlobalScene
{
public static MainScene MainScene { get; set; }
public static CompoundConstructor CompoundConstructor { get; set; }
public static VirtualChemDemo Demo { get; set; }
public static MainControlPanel MainControlPanel { get; set; }
public static Flask Flask { get; set; }
public static StringLoader StringLoader { get; set; }
}

31
Scenes/AddAtom.cs Executable file
View File

@@ -0,0 +1,31 @@
using Godot;
using VirtualChemistry.Constants;
public partial class AddAtom : MenuButton
{
public CompoundConstructor CompoundConstructor => GlobalScene.CompoundConstructor;
private void BuildMenu()
{
PopupMenu menu = GetPopup();
menu.Clear();
foreach (var w in menu.GetSignalConnectionList(PopupMenu.SignalName.IdPressed))
menu.Disconnect(PopupMenu.SignalName.IdPressed, w["callable"].AsCallable());
for (int i = 1; i <= 15; i++)
menu.AddItem(ChemistryConstant.ElementSymbols[i-1], i);
menu.Connect(PopupMenu.SignalName.IdPressed, Callable.From((int idx) => MenuHandle(idx)));
}
private void MenuHandle(int idx) => CompoundConstructor.AddAtomOf(idx);
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
BuildMenu();
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
}

31
Scenes/Atom.cs Executable file
View File

@@ -0,0 +1,31 @@
using Godot;
using VirtualChemistry.Chemistry.Atoms.Implements;
public partial class Atom : TextureRect
{
private Sprite2D ConnectPending { get; set; }
private Label PendingBond { get; set; }
public BaseAtom BaseAtom { get; set; } = BaseAtom.Null;
private Label ElementName { get; set; }
public AtomActions AtomActions { get; set; }
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
ElementName = GetNode<Label>("ElementName");
ElementName.Text = BaseAtom.Element;
ConnectPending = GetNode<Sprite2D>("ConnectPending");
PendingBond = GetNode<Label>("PendingBond");
AtomActions = GetNode<AtomActions>("AtomActions");
}
public override Variant _GetDragData(Vector2 atPosition)
{
return this;
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
}

41
Scenes/Atom.tscn Normal file
View File

@@ -0,0 +1,41 @@
[gd_scene load_steps=5 format=3 uid="uid://c6f1pohr81e62"]
[ext_resource type="Texture2D" uid="uid://dwdq5w17xjv18" path="res://Assets/Atom.png" id="1_8mgmq"]
[ext_resource type="Script" path="res://Scenes/Atom.cs" id="2_iicki"]
[ext_resource type="Script" path="res://Scenes/AtomActions.cs" id="3_3mce0"]
[ext_resource type="Texture2D" uid="uid://b5rdjefwmh10t" path="res://Assets/ConnectPendingAtom.png" id="4_l6xxo"]
[node name="Atom" type="TextureRect"]
offset_right = 64.0
offset_bottom = 64.0
texture = ExtResource("1_8mgmq")
script = ExtResource("2_iicki")
[node name="AtomActions" type="MenuButton" parent="."]
layout_mode = 0
offset_right = 64.0
offset_bottom = 64.0
button_mask = 2
script = ExtResource("3_3mce0")
[node name="ElementName" type="Label" parent="."]
layout_mode = 0
offset_left = 13.0
offset_top = 21.0
offset_right = 53.0
offset_bottom = 44.0
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_colors/font_outline_color = Color(0, 0.176471, 0.901961, 0.917647)
horizontal_alignment = 1
[node name="ConnectPending" type="Sprite2D" parent="."]
visible = false
position = Vector2(32, 32)
texture = ExtResource("4_l6xxo")
[node name="PendingBond" type="Label" parent="."]
layout_mode = 0
offset_left = 68.0
offset_top = 22.0
offset_right = 108.0
offset_bottom = 45.0

66
Scenes/AtomActions.cs Executable file
View File

@@ -0,0 +1,66 @@
using Godot;
using System.Collections.Generic;
using VirtualChemistry.Chemistry.Bonds.Implements;
public partial class AtomActions : MenuButton
{
public Atom Atom => GetParent<Atom>();
private Dictionary<int, BaseBond> BondMap { get; set; } = new();
private CompoundConstructor CompoundConstructor => GlobalScene.CompoundConstructor;
public void BuildMenu()
{
PopupMenu menu = GetPopup();
menu.Clear();
foreach (var w in menu.GetSignalConnectionList(PopupMenu.SignalName.IdPressed))
menu.Disconnect(PopupMenu.SignalName.IdPressed, w["callable"].AsCallable());
menu.AddItem("Remove Atom", 0);
int idx = 1;
BondMap.Clear();
foreach (BaseBond b in Atom.BaseAtom.UnconnectedBonds)
{
BondMap[idx] = b;
menu.AddItem(b.BondType, idx);
if(CompoundConstructor.ConnectPending == b)
menu.SetItemDisabled(idx, true);
idx++;
}
menu.Connect(PopupMenu.SignalName.IdPressed, Callable.From((int id) => MenuHandle(id)));
}
private void MenuHandle(int idx)
{
if (idx == 0)
{
CompoundConstructor.RemoveAtomOf(Atom);
return;
}
if (CompoundConstructor.ConnectPending == BaseBond.Null)
{
CompoundConstructor.ConnectPending = BondMap[idx];
CompoundConstructor.PendingAtom = Atom;
}
else
{
CompoundConstructor.ConnectAtoms(Atom, BondMap[idx]);
}
BuildMenu();
}
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
BuildMenu();
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
public override Variant _GetDragData(Vector2 atPosition)
{
return GetParent();
}
}

34
Scenes/Bond.cs Executable file
View File

@@ -0,0 +1,34 @@
using Godot;
public partial class Bond : Line2D
{
public Atom AtomFrom { get; set; }
public Atom AtomTo { get; set; }
private Label BondTypeA { get; set; }
private Label BondTypeB { get; set; }
public string TypeA { get; set; }
public string TypeB { get; set; }
public override void _Ready()
{
BondTypeA = GetNode<Label>("BondTypeA");
BondTypeB = GetNode<Label>("BondTypeB");
}
public void BondUpdate()
{
Vector2 v1 = AtomFrom.Position + new Vector2(32, 32);
Vector2 v2 = AtomTo.Position + new Vector2(32, 32);
Vector2 m = (v1 + v2) / 2;
Points = new[] { v1, m, v2 };
BondTypeA.Position = m - new Vector2(10, 10);
BondTypeB.Position = m + new Vector2(10, 10);
BondTypeA.Text = TypeA;
BondTypeB.Text = TypeB;
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
}

18
Scenes/Bond.tscn Normal file
View File

@@ -0,0 +1,18 @@
[gd_scene load_steps=2 format=3 uid="uid://ngc8dex7loqv"]
[ext_resource type="Script" path="res://Scenes/Bond.cs" id="1_rpgkt"]
[node name="Bond" type="Line2D"]
default_color = Color(1, 0.0392157, 1, 0.690196)
joint_mode = 2
begin_cap_mode = 2
end_cap_mode = 2
script = ExtResource("1_rpgkt")
[node name="BondTypeA" type="Label" parent="."]
offset_right = 40.0
offset_bottom = 23.0
[node name="BondTypeB" type="Label" parent="."]
offset_right = 40.0
offset_bottom = 23.0

92
Scenes/Bottle.cs Executable file
View File

@@ -0,0 +1,92 @@
using Godot;
using System.Linq;
using VirtualChemistry.Chemistry.Compounds.Implements;
using VirtualChemistry.Chemistry.Containers;
using VirtualChemistry.Chemistry.Mixtures.Implements;
public partial class Bottle : MenuButton, IChemicalContainer
{
private double ContainerVolume { get; set; }
private HeterogeneousMixture HeterogeneousMixture { get; set; }
public double Volume() => ContainerVolume;
public HeterogeneousMixture Content { get; set; }
public double EnvironmentPressure { get; set; }
public double EnvironmentTemperature { get; set; }
public HeterogeneousMixture ChemicalContent { get; set; } = HeterogeneousMixture.Null;
public HomogeneousMixture MainComponent => ChemicalContent.Layers
.DefaultIfEmpty(HomogeneousMixture.Null)
.MaxBy(x => x.Amount);
public Compound MainCompound => MainComponent.Compounds
.DefaultIfEmpty(Compound.Null)
.MaxBy(x => x.Amount);
private const string Empty = "Empty";
private string PotionName => $"Main: {(MainCompound == Compound.Null ? Empty : MainCompound.Expression)}";
private string PotionAmount => $"Amount: {(MainCompound == Compound.Null ? 0d : ChemicalContent.Amount)}";
public Sprite2D ContentTexture { get; set; }
private void BuildMenu()
{
PopupMenu menu = GetPopup();
menu.Clear();
foreach (var w in menu.GetSignalConnectionList(PopupMenu.SignalName.IdPressed))
menu.Disconnect(PopupMenu.SignalName.IdPressed, w["callable"].AsCallable());
menu.AddItem(PotionName, 0);
menu.AddItem(PotionAmount, 1);
menu.SetItemDisabled(0, true);
menu.SetItemDisabled(1, true);
menu.AddItem("Construct", 2);
menu.AddItem("Fill From Flask", 3);
menu.AddItem("Load From String", 4);
menu.AddItem("Add to Flask", 5);
menu.AddItem("Save to String", 6);
menu.AddItem("Discard", 7);
menu.Connect(PopupMenu.SignalName.IdPressed, Callable.From((int idx) => MenuHandle(idx)));
}
private void MenuHandle(int idx)
{
switch (idx)
{
case 2:
GlobalScene.Demo.SelectedBottle = this;
GlobalScene.MainScene.SwitchToConstructor();
return;
case 3:
ChemicalContent = GlobalScene.Flask.Content;
ChemicalContent.Container = this;
GlobalScene.Flask.Content = HeterogeneousMixture.Null;
GlobalScene.Flask.Update();
return;
case 4:
return;
default:
return;
}
}
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
ContentTexture = GetNode<Sprite2D>("Content");
if (ChemicalContent == HeterogeneousMixture.Null)
ContentTexture.Modulate = new Color(0, 0, 0, 0);
else
{
ContentTexture.Modulate = new Color(
MainComponent.ColorRed,
MainComponent.ColorGreen,
MainComponent.ColorBlue,
MainComponent.ColorTransparent
);
}
BuildMenu();
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
}

19
Scenes/Bottle.tscn Normal file
View File

@@ -0,0 +1,19 @@
[gd_scene load_steps=4 format=3 uid="uid://u7apjw1vvak3"]
[ext_resource type="Texture2D" uid="uid://dnfv1cab4fbb1" path="res://Assets/Bottle.png" id="1_ghgoa"]
[ext_resource type="Script" path="res://Scenes/Bottle.cs" id="1_i76fj"]
[ext_resource type="Texture2D" uid="uid://daq4xhxh3x5s8" path="res://Assets/Content.png" id="2_s0bcd"]
[node name="Bottle" type="MenuButton"]
custom_minimum_size = Vector2(64, 64)
offset_right = 64.0
offset_bottom = 64.0
script = ExtResource("1_i76fj")
[node name="Bottle" type="Sprite2D" parent="."]
position = Vector2(34, 32)
texture = ExtResource("1_ghgoa")
[node name="Content" type="Sprite2D" parent="."]
position = Vector2(34, 32)
texture = ExtResource("2_s0bcd")

146
Scenes/CompoundConstructor.cs Executable file
View File

@@ -0,0 +1,146 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Godot;
using VirtualChemistry.Chemistry.Atoms.Implements;
using VirtualChemistry.Chemistry.Atoms.Resolver;
using VirtualChemistry.Chemistry.Bonds.Implements;
using VirtualChemistry.Chemistry.Compounds.Implements;
using VirtualChemistry.Chemistry.Mixtures.Implements;
public partial class CompoundConstructor : Panel
{
private HeterogeneousMixture HeterogeneousMixture { get; set; }
public HomogeneousMixture HomogeneousMixture { get; set; }
public HashSet<Atom> Atoms { get; set; } = new();
public BaseBond ConnectPending { get; set; } = BaseBond.Null;
public Atom PendingAtom { get; set; }
public Dictionary<Atom, HashSet<Bond>> BondMap { get; set; } = new();
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
GlobalScene.CompoundConstructor = this;
HeterogeneousMixture = new();
HomogeneousMixture = HeterogeneousMixture.AddLayer();
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
public override bool _CanDropData(Vector2 atPosition, Variant data)
{
return true;
}
public override void _DropData(Vector2 atPosition, Variant data)
{
Atom a = data.As<Atom>();
a.Position = atPosition;
if(BondMap.ContainsKey(a))
foreach (Bond b in BondMap[a])
b.BondUpdate();
}
public void AddAtomOf(int idx)
{
BaseAtom a = AtomResolver.Resolve(idx);
Compound c = a.GrabCompound;
c.Amount = 1;
Atom at = ResourceLoader.Load<PackedScene>("res://Scenes/Atom.tscn").Instantiate<Atom>();
at.BaseAtom = a;
AddChild(at);
at.Position = new(500, 500);
HomogeneousMixture.AddCompound(c);
Atoms.Add(at);
}
public void RemoveAtomOf(Atom atom)
{
foreach (BaseBond b in atom.BaseAtom.ConnectedBonds)
b.Disconnect();
Bond[] toRemove = Array.Empty<Bond>();
if (BondMap.TryGetValue(atom, out HashSet<Bond> value))
toRemove = value.ToArray();
foreach (Bond b in toRemove)
{
BondMap[b.AtomFrom].Remove(b);
BondMap[b.AtomTo].Remove(b);
RemoveChild(b);
}
atom.BaseAtom.Compound.HomogeneousMixture.Compounds.Remove(atom.BaseAtom.Compound);
atom.BaseAtom.Compound.HomogeneousMixture = HomogeneousMixture.Null;
atom.BaseAtom.Compound = Compound.Null;
RemoveChild(atom);
Atoms.Remove(atom);
}
public void ConnectAtoms(Atom a, BaseBond b)
{
b.Connect(ConnectPending);
Bond bond = ResourceLoader.Load<PackedScene>("res://Scenes/Bond.tscn").Instantiate<Bond>();
bond.AtomFrom = PendingAtom;
bond.AtomTo = a;
bond.TypeA = ConnectPending.BondType;
bond.TypeB = b.BondType;
if (!BondMap.ContainsKey(a))
BondMap[a] = new HashSet<Bond>();
BondMap[a].Add(bond);
if (!BondMap.ContainsKey(PendingAtom!))
BondMap[PendingAtom] = new HashSet<Bond>();
BondMap[PendingAtom].Add(bond);
ConnectPending = BaseBond.Null;
a.AtomActions.BuildMenu();
PendingAtom.AtomActions.BuildMenu();
PendingAtom = null;
AddChild(bond);
bond.BondUpdate();
}
private void Back()
{
GlobalScene.MainScene.SwitchToDemo();
}
private void Build()
{
HeterogeneousMixture.Container = GlobalScene.Demo.SelectedBottle;
GlobalScene.Demo.SelectedBottle.Content = HeterogeneousMixture;
Clear();
}
private void Clear(bool save = true)
{
if (!save)
{
foreach (Atom atom in Atoms)
RemoveAtomOf(atom);
return;
}
HashSet<Bond> removedBonds = new();
foreach (Atom atom in Atoms)
{
RemoveChild(atom);
foreach (Bond bond in BondMap[atom])
{
if (!removedBonds.Contains(bond))
RemoveChild(bond);
removedBonds.Add(bond);
}
}
Atoms = new();
BondMap = new();
HeterogeneousMixture = new HeterogeneousMixture();
}
private void ForceClear() => Clear(false);
}

View File

@@ -0,0 +1,43 @@
[gd_scene load_steps=3 format=3 uid="uid://c1ww4cmceq16t"]
[ext_resource type="Script" path="res://Scenes/CompoundConstructor.cs" id="1_bhwhs"]
[ext_resource type="Script" path="res://Scenes/AddAtom.cs" id="2_ddlyc"]
[node name="CompoundConstructor" type="Panel"]
offset_left = -370.0
offset_top = -182.0
offset_right = 1678.0
offset_bottom = 842.0
script = ExtResource("1_bhwhs")
[node name="ControlLayer" type="CanvasLayer" parent="."]
[node name="Controller" type="HBoxContainer" parent="ControlLayer"]
offset_left = 57.0
offset_top = 588.0
offset_right = 877.0
offset_bottom = 632.0
[node name="AddAtom" type="MenuButton" parent="ControlLayer/Controller"]
layout_mode = 2
text = "Add Atom ^"
script = ExtResource("2_ddlyc")
[node name="BuildMixture" type="Button" parent="ControlLayer/Controller"]
layout_mode = 2
text = "Build
"
[node name="Clear" type="Button" parent="ControlLayer/Controller"]
layout_mode = 2
text = "Clear"
[node name="Back" type="Button" parent="ControlLayer/Controller"]
layout_mode = 2
text = "Back"
[node name="MovingLayer" type="CanvasLayer" parent="."]
[connection signal="pressed" from="ControlLayer/Controller/BuildMixture" to="." method="Build"]
[connection signal="pressed" from="ControlLayer/Controller/Clear" to="." method="ForceClear"]
[connection signal="pressed" from="ControlLayer/Controller/Back" to="." method="Back"]

60
Scenes/Flask.cs Executable file
View File

@@ -0,0 +1,60 @@
using Godot;
using Mathool.DataStructure;
using VirtualChemistry.Chemistry.Containers;
using VirtualChemistry.Chemistry.Mixtures.Implements;
public partial class Flask : TextureRect, IChemicalContainer
{
public double ContainerVolume { get; set; } = 100;
public double Volume() => ContainerVolume;
public HeterogeneousMixture Content { get; set; }
public double EnvironmentPressure { get; set; }
public double EnvironmentTemperature { get; set; }
public IsomorphicMap<HomogeneousMixture, FlaskContent> Map { get; set; } = new();
private void BuildMap()
{
foreach (HomogeneousMixture m in Content.Layers)
{
if (!Map.ContainsKey(m))
{
FlaskContent fc = ResourceLoader
.Load<PackedScene>("res://Scenes/FlaskContent.tscn")
.Instantiate<FlaskContent>();
fc.Mixture = m;
AddChild(fc);
fc.Position = new(0, -(float)fc.StartFrom);
}
}
foreach (FlaskContent fc in Map.Values)
{
if (fc.Mixture.HeterogeneousMixture == HeterogeneousMixture.Null)
{
Map.Remove(fc);
RemoveChild(fc);
}
}
}
public void Update()
{
BuildMap();
foreach (FlaskContent fc in Map.Values)
fc.UpdateVolumeAndPosition();
}
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
GlobalScene.Flask = this;
Content = HeterogeneousMixture.Null;
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
}

10
Scenes/Flask.tscn Normal file
View File

@@ -0,0 +1,10 @@
[gd_scene load_steps=3 format=3 uid="uid://bde5n0vfm6jvs"]
[ext_resource type="Texture2D" uid="uid://chx2yte05x4lj" path="res://Assets/Flask.png" id="1_b34pm"]
[ext_resource type="Script" path="res://Scenes/Flask.cs" id="2_j1pe5"]
[node name="Flask" type="TextureRect"]
offset_right = 40.0
offset_bottom = 40.0
texture = ExtResource("1_b34pm")
script = ExtResource("2_j1pe5")

65
Scenes/FlaskContent.cs Executable file
View File

@@ -0,0 +1,65 @@
using Godot;
using Mathool.DataStructure.Link;
using VirtualChemistry.Chemistry.Mixtures.Implements;
public partial class FlaskContent : ColorRect
{
public HomogeneousMixture Mixture { get; set; } = HomogeneousMixture.Null;
private const double ContainerHeight = 512d;
public double ContainerVolume => Mixture.HeterogeneousMixture.Container.Volume();
public double Volume => Mixture.Volume;
private TextureButton Mask { get; set; }
public double VolumeStartFrom {
get
{
double res = 0;
for (LinkNode<HomogeneousMixture> iter = Mixture.Layer.Previous; !iter.IsEnding; iter = iter.Previous)
res += iter.Value.Volume;
return res;
}
}
private ColorRect Bar { get; set; }
private AnimationPlayer AP { get; set; }
public double StartFrom => (VolumeStartFrom / ContainerVolume) * ContainerHeight;
public void UpdateVolumeAndPosition()
{
double height = (Volume / ContainerVolume) * ContainerHeight;
Animation a = AP.GetAnimation("HeightChange");
a.TrackSetKeyValue(0, 0, Size);
a.TrackSetKeyValue(0, 1, new Vector2(Size.X, (float)height));
AP.Play("HeightChange");
AP.Play("PositionChange");
a = AP.GetAnimation("PositionChange");
a.TrackSetKeyValue(0,0,Position);
a.TrackSetKeyValue(0,1, new Vector2(Position.X, -(float)StartFrom));
AP.Play();
}
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
Bar = GetNode<ColorRect>("Bar");
AP = GetNode<AnimationPlayer>("AP");
Mask = GetNode<TextureButton>("Mask");
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
private void OnSizeChange() => Mask.Size = Size;
private void OnMouseEnter() => AP.Play("MouseEntered");
private void OnMouseExit() => AP.PlayBackwards("MouseEntered");
private void OnClick()
{
GlobalScene.MainControlPanel.Update(Mixture);
}
}

84
Scenes/FlaskContent.tscn Normal file
View File

@@ -0,0 +1,84 @@
[gd_scene load_steps=6 format=3 uid="uid://bvn25sn10au02"]
[ext_resource type="Script" path="res://Scenes/FlaskContent.cs" id="1_4wcwd"]
[sub_resource type="Animation" id="Animation_04bwn"]
resource_name = "HeightChange"
length = 0.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:size")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.4995),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(128, 4), Vector2(128, 4)]
}
[sub_resource type="Animation" id="Animation_itbox"]
resource_name = "MouseEntered"
length = 0.15
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Bar:size")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1332),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(150, 2), Vector2(170, 2)]
}
[sub_resource type="Animation" id="Animation_qjpxn"]
resource_name = "PositionChange"
length = 0.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.4995),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(0, 0), Vector2(0, 0)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_5ty26"]
_data = {
"HeightChange": SubResource("Animation_04bwn"),
"MouseEntered": SubResource("Animation_itbox"),
"PositionChange": SubResource("Animation_qjpxn")
}
[node name="FlaskContent" type="ColorRect"]
custom_minimum_size = Vector2(128, 0)
offset_right = 128.0
offset_bottom = 4.0
script = ExtResource("1_4wcwd")
[node name="Bar" type="ColorRect" parent="."]
layout_mode = 0
offset_right = 170.0
offset_bottom = 2.0
color = Color(0.160784, 0, 0, 0.701961)
[node name="AP" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_5ty26")
}
[node name="Mask" type="TextureButton" parent="."]
layout_mode = 0
offset_right = 128.0
offset_bottom = 4.0
[connection signal="resized" from="." to="." method="OnSizeChange"]
[connection signal="mouse_entered" from="Mask" to="." method="OnMouseEnter"]
[connection signal="mouse_exited" from="Mask" to="." method="OnMouseExit"]

View File

@@ -0,0 +1,80 @@
using Godot;
using System.Linq;
using VirtualChemistry.Chemistry.Compounds.Implements;
using VirtualChemistry.Chemistry.Mixtures.Implements;
public partial class MainControlPanel : HBoxContainer
{
private HSlider EnvTemperature { get; set; }
private HSlider ContainerVolume { get; set; }
private HomogeneousMixture SelectedMixture { get; set; }
private Label Density { get; set; }
private Label Volume { get; set; }
private Label HeatConductivity { get; set; }
private Label Amount { get; set; }
private Label Temperature { get; set; }
private Tree Compounds { get; set; }
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
EnvTemperature = GetNode<HSlider>("V1/EnvTemperature");
ContainerVolume = GetNode<HSlider>("V1/ContainerVolume");
Density = GetNode<Label>("V2/HDensity/Density");
Volume = GetNode<Label>("V2/HVolume/Volume");
HeatConductivity = GetNode<Label>("V2/HHeatConductivity/HeatConductivity");
Amount = GetNode<Label>("V2/HAmount/Amount");
Temperature = GetNode<Label>("V2/HTemperature/Temperature");
Compounds = GetNode<Tree>("V3/Compounds");
GlobalScene.MainControlPanel = this;
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
public void Update(HomogeneousMixture mixture)
{
SelectedMixture = mixture;
}
public void Update()
{
if (SelectedMixture == HomogeneousMixture.Null)
return;
Density.Text = $"{SelectedMixture.Density}";
Volume.Text = $"{SelectedMixture.Volume}";
HeatConductivity.Text = $"{SelectedMixture.HeatConductivity}";
Amount.Text = $"{SelectedMixture.Amount}";
Temperature.Text = $"{SelectedMixture.Temperature}";
}
private void BuildTree()
{
Compounds.Clear();
var groups = SelectedMixture.Compounds.GroupBy(x => x.Expression);
foreach (var group in groups)
{
TreeItem t = Compounds.CreateItem();
t.SetText(0, group.Key);
t.SetSelectable(0, false);
int i = 1;
foreach (Compound c in group)
{
TreeItem x = Compounds.CreateItem(t);
x.SetText(0, $"{i}th isomer");
x.SetMeta("isoExp", c.IsoRepresentation);
}
}
}
private void IsomerSelectedHandler()
{
GlobalScene.Demo.FullRepr.Text = Compounds
.GetSelected()
.GetMeta("isoExp")
.AsString();
}
}

View File

@@ -0,0 +1,123 @@
[gd_scene load_steps=2 format=3 uid="uid://re3bwidsx0do"]
[ext_resource type="Script" path="res://Scenes/MainControlPanel.cs" id="1_r6pkl"]
[node name="MainControlPanel" type="HBoxContainer"]
script = ExtResource("1_r6pkl")
[node name="VSeparator3" type="VSeparator" parent="."]
layout_mode = 2
[node name="V1" type="VBoxContainer" parent="."]
layout_mode = 2
[node name="OneStep" type="Button" parent="V1"]
layout_mode = 2
text = "One Step
"
[node name="RemoveTop" type="Button" parent="V1"]
layout_mode = 2
text = "Remove Top"
[node name="RemoveBottom" type="Button" parent="V1"]
layout_mode = 2
text = "Remove Bottom"
[node name="Label" type="Label" parent="V1"]
layout_mode = 2
text = "Env Temperature"
[node name="EnvTemperature" type="HSlider" parent="V1"]
layout_mode = 2
[node name="Label2" type="Label" parent="V1"]
layout_mode = 2
text = "Container Volume"
[node name="ContainerVolume" type="HSlider" parent="V1"]
layout_mode = 2
[node name="VSeparator" type="VSeparator" parent="."]
layout_mode = 2
[node name="V2" type="VBoxContainer" parent="."]
layout_mode = 2
[node name="Label" type="Label" parent="V2"]
layout_mode = 2
text = "Selected Mixture Measures"
[node name="HDensity" type="HBoxContainer" parent="V2"]
layout_mode = 2
[node name="Label" type="Label" parent="V2/HDensity"]
layout_mode = 2
text = "Density: "
[node name="Density" type="Label" parent="V2/HDensity"]
layout_mode = 2
text = "0"
[node name="HVolume" type="HBoxContainer" parent="V2"]
layout_mode = 2
[node name="Label" type="Label" parent="V2/HVolume"]
layout_mode = 2
text = "Volume: "
[node name="Volume" type="Label" parent="V2/HVolume"]
layout_mode = 2
text = "0"
[node name="HHeatConductivity" type="HBoxContainer" parent="V2"]
layout_mode = 2
[node name="Label" type="Label" parent="V2/HHeatConductivity"]
layout_mode = 2
text = "Heat Conductivity: "
[node name="HeatConductivity" type="Label" parent="V2/HHeatConductivity"]
layout_mode = 2
text = "0"
[node name="HAmount" type="HBoxContainer" parent="V2"]
layout_mode = 2
[node name="Label" type="Label" parent="V2/HAmount"]
layout_mode = 2
text = "Amount: "
[node name="Amount" type="Label" parent="V2/HAmount"]
layout_mode = 2
text = "0"
[node name="HTemperature" type="HBoxContainer" parent="V2"]
layout_mode = 2
[node name="Label" type="Label" parent="V2/HTemperature"]
layout_mode = 2
text = "Temperature: "
[node name="Temperature" type="Label" parent="V2/HTemperature"]
layout_mode = 2
text = "0"
[node name="VSeparator2" type="VSeparator" parent="."]
layout_mode = 2
[node name="V3" type="VBoxContainer" parent="."]
layout_mode = 2
[node name="Label" type="Label" parent="V3"]
layout_mode = 2
text = "Compounents"
[node name="Compounds" type="Tree" parent="V3"]
custom_minimum_size = Vector2(150, 200)
layout_mode = 2
[node name="VSeparator4" type="VSeparator" parent="."]
layout_mode = 2
[connection signal="item_selected" from="V3/Compounds" to="." method="IsomerSelectedHandler"]

46
Scenes/MainScene.cs Normal file
View File

@@ -0,0 +1,46 @@
using Godot;
using System;
public partial class MainScene : Node2D
{
public Node CurrentScene { get; set; }
public VirtualChemDemo Demo { get; set; }
public override void _Ready()
{
GlobalScene.MainScene = this;
Demo = GetNode<VirtualChemDemo>("Demo");
CurrentScene = Demo;
}
public void SwitchToConstructor()
{
if (CurrentScene == GlobalScene.CompoundConstructor)
return;
if (CurrentScene != Demo)
throw new Exception("?");
if (GlobalScene.CompoundConstructor == null)
GlobalScene.CompoundConstructor = ResourceLoader
.Load<PackedScene>("res://Scenes/CompoundConstructor.tscn")
.Instantiate<CompoundConstructor>();
RemoveChild(Demo);
AddChild(GlobalScene.CompoundConstructor);
CurrentScene = GlobalScene.CompoundConstructor;
}
public void SwitchToDemo()
{
if (CurrentScene == Demo)
return;
if (CurrentScene != GlobalScene.CompoundConstructor)
throw new Exception("?");
RemoveChild(CurrentScene);
AddChild(Demo);
CurrentScene = Demo;
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
}

9
Scenes/MainScene.tscn Normal file
View File

@@ -0,0 +1,9 @@
[gd_scene load_steps=3 format=3 uid="uid://cgdqxc2mx6w8l"]
[ext_resource type="Script" path="res://Scenes/MainScene.cs" id="1_uwony"]
[ext_resource type="PackedScene" uid="uid://br78rurjakp3a" path="res://Scenes/VirtualChemDemo.tscn" id="2_vpu75"]
[node name="MainScene" type="Node2D"]
script = ExtResource("1_uwony")
[node name="Demo" parent="." instance=ExtResource("2_vpu75")]

35
Scenes/StringLoader.cs Normal file
View File

@@ -0,0 +1,35 @@
using Godot;
using VirtualChemistry.Chemistry.Mixtures.Implements;
using VirtualChemistry.Chemistry.Mixtures.Resolver;
public partial class StringLoader : Window
{
public TextEdit Input { get; set; }
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
Input = GetNode<TextEdit>("Input");
GlobalScene.StringLoader = this;
}
private void Load()
{
string expression = Input.Text;
HeterogeneousMixture mixture = HeterogeneousMixtureResolver.Resolve(expression);
GlobalScene.Demo.SelectedBottle.Content = mixture;
mixture.Container = GlobalScene.Demo.SelectedBottle;
Visible = false;
}
private void Cancel()
{
Visible = false;
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
}

43
Scenes/StringLoader.tscn Normal file
View File

@@ -0,0 +1,43 @@
[gd_scene load_steps=2 format=3 uid="uid://cubdalatqln4x"]
[ext_resource type="Script" path="res://Scenes/StringLoader.cs" id="1_qoxxp"]
[node name="StringLoader" type="Window"]
size = Vector2i(500, 250)
script = ExtResource("1_qoxxp")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -225.0
offset_top = -37.5
offset_right = 225.0
offset_bottom = 37.5
grow_horizontal = 2
grow_vertical = 2
[node name="Label" type="Label" parent="VBoxContainer"]
layout_mode = 2
text = "Expression:"
[node name="Input" type="TextEdit" parent="VBoxContainer"]
custom_minimum_size = Vector2(450, 40)
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
alignment = 1
[node name="Load" type="Button" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Load"
[node name="Cancel" type="Button" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Cancel"
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Load" to="." method="Load"]
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Cancel" to="." method="Cancel"]

30
Scenes/VirtualChemDemo.cs Executable file
View File

@@ -0,0 +1,30 @@
using Godot;
public partial class VirtualChemDemo : Node2D
{
public Flask Flask { get; set; }
public RichTextLabel FullRepr { get; set; }
public Bottle SelectedBottle { get; set; }
private StringLoader ExpressionLoader { get; set; }
public void OneStep()
{
Flask.Content.OneStep();
Flask.Update();
}
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
ExpressionLoader = GetNode<StringLoader>("ExpressionLoader");
ExpressionLoader.Visible = false;
FullRepr = GetNode<RichTextLabel>("HRepr/FullRepr");
Flask = GetNode<Flask>("Flask");
GlobalScene.Demo = this;
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
}

View File

@@ -0,0 +1,87 @@
[gd_scene load_steps=6 format=3 uid="uid://br78rurjakp3a"]
[ext_resource type="Script" path="res://Scenes/VirtualChemDemo.cs" id="1_aartk"]
[ext_resource type="PackedScene" uid="uid://re3bwidsx0do" path="res://Scenes/MainControlPanel.tscn" id="2_cfpbe"]
[ext_resource type="PackedScene" uid="uid://u7apjw1vvak3" path="res://Scenes/Bottle.tscn" id="2_ei0nr"]
[ext_resource type="PackedScene" uid="uid://bde5n0vfm6jvs" path="res://Scenes/Flask.tscn" id="3_p6s6c"]
[ext_resource type="PackedScene" uid="uid://cubdalatqln4x" path="res://Scenes/StringLoader.tscn" id="5_5y6ld"]
[node name="VicrtualChemDemo" type="Node2D"]
script = ExtResource("1_aartk")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
offset_right = 40.0
offset_bottom = 40.0
[node name="HSeparator" type="HSeparator" parent="VBoxContainer"]
layout_mode = 2
[node name="MainControlPanel" parent="VBoxContainer" instance=ExtResource("2_cfpbe")]
layout_mode = 2
[node name="HSeparator2" type="HSeparator" parent="VBoxContainer"]
layout_mode = 2
[node name="Potions" type="HBoxContainer" parent="."]
offset_left = 70.0
offset_top = 553.0
offset_right = 670.0
offset_bottom = 621.0
[node name="Prev" type="Button" parent="Potions"]
layout_mode = 2
text = "<-"
[node name="Items" type="HBoxContainer" parent="Potions"]
layout_mode = 2
[node name="MenusButton" parent="Potions/Items" instance=ExtResource("2_ei0nr")]
layout_mode = 2
[node name="Bottle" parent="Potions/Items" instance=ExtResource("2_ei0nr")]
layout_mode = 2
[node name="Bottle2" parent="Potions/Items" instance=ExtResource("2_ei0nr")]
layout_mode = 2
[node name="Bottle3" parent="Potions/Items" instance=ExtResource("2_ei0nr")]
layout_mode = 2
[node name="Bottle4" parent="Potions/Items" instance=ExtResource("2_ei0nr")]
layout_mode = 2
[node name="Bottle5" parent="Potions/Items" instance=ExtResource("2_ei0nr")]
layout_mode = 2
[node name="Bottle6" parent="Potions/Items" instance=ExtResource("2_ei0nr")]
layout_mode = 2
[node name="Bottle7" parent="Potions/Items" instance=ExtResource("2_ei0nr")]
layout_mode = 2
[node name="Next" type="Button" parent="Potions"]
layout_mode = 2
text = "->"
[node name="Flask" parent="." instance=ExtResource("3_p6s6c")]
offset_left = 747.0
offset_top = 57.0
offset_right = 875.0
offset_bottom = 569.0
[node name="HRepr" type="HBoxContainer" parent="."]
offset_left = 32.0
offset_top = 272.0
offset_right = 702.0
offset_bottom = 352.0
[node name="Label" type="Label" parent="HRepr"]
layout_mode = 2
text = "Full Expression"
[node name="FullRepr" type="RichTextLabel" parent="HRepr"]
custom_minimum_size = Vector2(550, 80)
layout_mode = 2
[node name="ExpressionLoader" parent="." instance=ExtResource("5_5y6ld")]
position = Vector2i(250, 200)

12
VirtualChemDemo.csproj Executable file
View File

@@ -0,0 +1,12 @@
<Project Sdk="Godot.NET.Sdk/4.3.0-beta.1">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net7.0</TargetFramework>
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'ios' ">net8.0</TargetFramework>
<EnableDynamicLoading>true</EnableDynamicLoading>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\VirtualChemistry\VirtualChemistry\VirtualChemistry.csproj" />
<ProjectReference Include="..\Mathool\Mathool.csproj" />
</ItemGroup>
</Project>

51
VirtualChemDemo.sln Executable file
View File

@@ -0,0 +1,51 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VirtualChemDemo", "VirtualChemDemo.csproj", "{477897FC-42F3-4DA7-A051-6015F15BAEAF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mathool", "..\Mathool\Mathool.csproj", "{7D360478-C41C-4E3A-82A8-A71EFBC779F8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MethoolTest", "..\MethoolTest\MethoolTest.csproj", "{2A928C8C-37C0-4699-8D6B-1D70CE9D251C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VirtualChemistry", "..\..\VirtualChemistry\VirtualChemistry\VirtualChemistry.csproj", "{48CA73EA-2BEA-4D2B-9063-54EA52BBBC1A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VirtualChemistryTest", "..\VirtualChemistryTest\VirtualChemistryTest.csproj", "{01065452-98E1-4EB6-A8CC-CF387CA91623}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
ExportDebug|Any CPU = ExportDebug|Any CPU
ExportRelease|Any CPU = ExportRelease|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{477897FC-42F3-4DA7-A051-6015F15BAEAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{477897FC-42F3-4DA7-A051-6015F15BAEAF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{477897FC-42F3-4DA7-A051-6015F15BAEAF}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU
{477897FC-42F3-4DA7-A051-6015F15BAEAF}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU
{477897FC-42F3-4DA7-A051-6015F15BAEAF}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU
{477897FC-42F3-4DA7-A051-6015F15BAEAF}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU
{7D360478-C41C-4E3A-82A8-A71EFBC779F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7D360478-C41C-4E3A-82A8-A71EFBC779F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7D360478-C41C-4E3A-82A8-A71EFBC779F8}.ExportDebug|Any CPU.ActiveCfg = Debug|Any CPU
{7D360478-C41C-4E3A-82A8-A71EFBC779F8}.ExportDebug|Any CPU.Build.0 = Debug|Any CPU
{7D360478-C41C-4E3A-82A8-A71EFBC779F8}.ExportRelease|Any CPU.ActiveCfg = Debug|Any CPU
{7D360478-C41C-4E3A-82A8-A71EFBC779F8}.ExportRelease|Any CPU.Build.0 = Debug|Any CPU
{2A928C8C-37C0-4699-8D6B-1D70CE9D251C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2A928C8C-37C0-4699-8D6B-1D70CE9D251C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A928C8C-37C0-4699-8D6B-1D70CE9D251C}.ExportDebug|Any CPU.ActiveCfg = Debug|Any CPU
{2A928C8C-37C0-4699-8D6B-1D70CE9D251C}.ExportDebug|Any CPU.Build.0 = Debug|Any CPU
{2A928C8C-37C0-4699-8D6B-1D70CE9D251C}.ExportRelease|Any CPU.ActiveCfg = Debug|Any CPU
{2A928C8C-37C0-4699-8D6B-1D70CE9D251C}.ExportRelease|Any CPU.Build.0 = Debug|Any CPU
{48CA73EA-2BEA-4D2B-9063-54EA52BBBC1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{48CA73EA-2BEA-4D2B-9063-54EA52BBBC1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{48CA73EA-2BEA-4D2B-9063-54EA52BBBC1A}.ExportDebug|Any CPU.ActiveCfg = Debug|Any CPU
{48CA73EA-2BEA-4D2B-9063-54EA52BBBC1A}.ExportDebug|Any CPU.Build.0 = Debug|Any CPU
{48CA73EA-2BEA-4D2B-9063-54EA52BBBC1A}.ExportRelease|Any CPU.ActiveCfg = Debug|Any CPU
{48CA73EA-2BEA-4D2B-9063-54EA52BBBC1A}.ExportRelease|Any CPU.Build.0 = Debug|Any CPU
{01065452-98E1-4EB6-A8CC-CF387CA91623}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{01065452-98E1-4EB6-A8CC-CF387CA91623}.Debug|Any CPU.Build.0 = Debug|Any CPU
{01065452-98E1-4EB6-A8CC-CF387CA91623}.ExportDebug|Any CPU.ActiveCfg = Debug|Any CPU
{01065452-98E1-4EB6-A8CC-CF387CA91623}.ExportDebug|Any CPU.Build.0 = Debug|Any CPU
{01065452-98E1-4EB6-A8CC-CF387CA91623}.ExportRelease|Any CPU.ActiveCfg = Debug|Any CPU
{01065452-98E1-4EB6-A8CC-CF387CA91623}.ExportRelease|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
EndGlobal

1
icon.svg Executable file
View File

@@ -0,0 +1 @@
<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg"><rect x="2" y="2" width="124" height="124" rx="14" fill="#363d52" stroke="#212532" stroke-width="4"/><g transform="scale(.101) translate(122 122)"><g fill="#fff"><path d="M105 673v33q407 354 814 0v-33z"/><path d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z" fill="#478cbf"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></g></svg>

After

Width:  |  Height:  |  Size: 949 B

37
icon.svg.import Executable file
View File

@@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://2q5wms78fwi5"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

20
project.godot Normal file
View File

@@ -0,0 +1,20 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[application]
config/name="VirtualChemDemo"
run/main_scene="res://Scenes/MainScene.tscn"
config/features=PackedStringArray("4.3", "C#", "Forward Plus")
config/icon="res://icon.svg"
[dotnet]
project/assembly_name="VirtualChemDemo"