forked from StrafesNET/strafe-client
wip
This commit is contained in:
parent
ff7b12e90e
commit
bb7ccd97bb
@ -10,16 +10,27 @@ fn class_is_a(class: &str, superclass: &str) -> bool {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
fn recursive_collect_superclass(objects: &mut std::vec::Vec<rbx_dom_weak::types::Ref>,dom: &rbx_dom_weak::WeakDom, instance: &rbx_dom_weak::Instance, superclass: &str){
|
||||||
pub fn get_objects(dom:rbx_dom_weak::WeakDom, superclass: &str) -> Result<std::vec::Vec<rbx_dom_weak::Instance>, Box<dyn std::error::Error>> {
|
for &referent in instance.children() {
|
||||||
let mut objects = std::vec::Vec::<rbx_dom_weak::Instance>::new();
|
if let Some(c) = dom.get_by_ref(referent) {
|
||||||
//move matching instances into objects
|
if class_is_a(c.class.as_str(), superclass) {
|
||||||
let (_,mut instances) = dom.into_raw();
|
objects.push(c.referent());//copy ref
|
||||||
for (_,instance) in instances.drain() {
|
}
|
||||||
if class_is_a(instance.class.as_str(), superclass) {
|
recursive_collect_superclass(objects,dom,c,superclass);
|
||||||
objects.push(instance);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
fn get_texture_refs(dom:&rbx_dom_weak::WeakDom) -> Vec<rbx_dom_weak::types::Ref>{
|
||||||
|
let mut objects = std::vec::Vec::new();
|
||||||
|
recursive_collect_superclass(&mut objects, dom, dom.root(),"Decal");
|
||||||
|
//get ids
|
||||||
|
//clear vec
|
||||||
|
//next class
|
||||||
|
objects
|
||||||
|
}
|
||||||
|
pub fn get_objects(dom:rbx_dom_weak::WeakDom, superclass: &str) -> Result<std::vec::Vec<rbx_dom_weak::types::Ref>, Box<dyn std::error::Error>> {
|
||||||
|
let mut objects = std::vec::Vec::new();
|
||||||
|
recursive_collect_superclass(&mut objects, &dom, dom.root(),superclass);
|
||||||
|
|
||||||
return Ok(objects)
|
return Ok(objects)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user