Skip to content

Commit 2450f15

Browse files
committed
excise: Drop Script::asset field.
It's a duplicate with Script::id now.
1 parent 84f5095 commit 2450f15

File tree

4 files changed

+2
-13
lines changed

4 files changed

+2
-13
lines changed

crates/bevy_mod_scripting_core/src/asset.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,7 @@ pub(crate) fn sync_script_data<P: IntoScriptPluginParams>(
173173
info!("{}: Loading static script: {:?}", P::LANGUAGE, id);
174174
commands.queue(CreateOrUpdateScript::<P>::new(
175175
Handle::Weak(*id),
176-
asset.content.clone(),
177-
Some(script_assets.reserve_handle().clone_weak()),
176+
asset.content.clone(), // Cloning seems bad!
178177
));
179178
}
180179
}
@@ -228,7 +227,6 @@ pub(crate) fn eval_script<P: IntoScriptPluginParams>(
228227
commands.queue(CreateOrUpdateScript::<P>::new(
229228
script_id,
230229
asset.content.clone(),
231-
None,
232230
));
233231
}
234232
} else {

crates/bevy_mod_scripting_core/src/commands.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,17 @@ impl<P: IntoScriptPluginParams> Command for DeleteScript<P> {
6767
pub struct CreateOrUpdateScript<P: IntoScriptPluginParams> {
6868
id: Handle<ScriptAsset>,
6969
content: Box<[u8]>,
70-
asset: Option<Handle<ScriptAsset>>,
7170
// Hack to make this Send, C does not need to be Send since it is not stored in the command
7271
_ph: std::marker::PhantomData<fn(P::R, P::C)>,
7372
}
7473

7574
#[profiling::all_functions]
7675
impl<P: IntoScriptPluginParams> CreateOrUpdateScript<P> {
7776
/// Creates a new CreateOrUpdateScript command with the given ID, content and asset
78-
pub fn new(id: Handle<ScriptAsset>, content: Box<[u8]>, asset: Option<Handle<ScriptAsset>>) -> Self {
77+
pub fn new(id: Handle<ScriptAsset>, content: Box<[u8]>) -> Self {
7978
Self {
8079
id,
8180
content,
82-
asset,
8381
_ph: std::marker::PhantomData,
8482
}
8583
}
@@ -145,7 +143,6 @@ impl<P: IntoScriptPluginParams> CreateOrUpdateScript<P> {
145143
handler_ctxt.scripts.insert(
146144
Script {
147145
id: self.id.clone(),
148-
asset: self.asset.clone(),
149146
context,
150147
},
151148
);
@@ -194,7 +191,6 @@ impl<P: IntoScriptPluginParams> Command for CreateOrUpdateScript<P> {
194191
// make a new script with the shared context
195192
let script = Script {
196193
id: self.id.clone(),
197-
asset: self.asset.clone(),
198194
context: assigned_shared_context.clone(),
199195
};
200196
// it can potentially be loaded but without a successful script reload but that

crates/bevy_mod_scripting_core/src/script.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,6 @@ impl<P: IntoScriptPluginParams> Default for Scripts<P> {
129129
pub struct Script<P: IntoScriptPluginParams> {
130130
/// The id of the script
131131
pub id: Handle<ScriptAsset>,
132-
/// TODO: Let's remove asset if possible.
133-
/// the asset holding the content of the script if it comes from an asset
134-
pub asset: Option<Handle<ScriptAsset>>,
135132
/// The context of the script, possibly shared with other scripts
136133
pub context: Arc<Mutex<P::C>>,
137134
}
@@ -140,7 +137,6 @@ impl<P: IntoScriptPluginParams> Clone for Script<P> {
140137
fn clone(&self) -> Self {
141138
Self {
142139
id: self.id.clone(),
143-
asset: self.asset.clone(),
144140
context: self.context.clone(),
145141
}
146142
}

crates/testing_crates/script_integration_test_harness/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,6 @@ pub fn run_plugin_script_load_benchmark<
515515
CreateOrUpdateScript::<P>::new(
516516
Handle::Weak(random_script_id),
517517
content.clone().into(),
518-
None,
519518
),
520519
is_reload,
521520
)

0 commit comments

Comments
 (0)