new CharCustom("Beard06","Soul Patch","|ELVEN_MALE|SYLVAN_MALE|HUMAN_MALE|DARK ELVEN_MALE|GOBLIN_MALE|"),
function filterCharCustom(type, filter = ""){
//type as CharCustomType
//as string like CUSTOM_ENABLE_FOR_ALL "ELVEN_MALE|DWARVEN_MALE|"
//returns an array of CharCustom
var result = [];
filter = "|"+string_upper(filter)+"|";
var arrToFilter = [];
switch(type){
case CharCustomType.Gender: arrToFilter = global.customGender; break;
case CharCustomType.Race: arrToFilter = global.customRace; break;
case CharCustomType.Beard: arrToFilter = global.customBeard; break;
case CharCustomType.Hair: arrToFilter = global.customHair; break;
case CharCustomType.EarExtra: arrToFilter = global.customEarExtra; break;
case CharCustomType.Eyebrow: arrToFilter = global.customEyebrow; break;
case CharCustomType.Eye: arrToFilter = global.customEye; break;
case CharCustomType.Mouth: arrToFilter = global.customMouth; break;
case CharCustomType.OnSkin: arrToFilter = global.customOnSkin; break;
case CharCustomType.ColorSkin: arrToFilter = global.customColorSkin; break;
case CharCustomType.ColorHair: arrToFilter = global.customColorHair; break;
case CharCustomType.ColorEyes: arrToFilter = global.customColorEyes; break;
}
var valueNow; //as CharCustom
for (var i=0; i<array_length(arrToFilter); ++i) {
valueNow = arrToFilter[i];
if( filter == "" || valueNow.enabledFor == "" ||
string_pos(filter, valueNow.enabledFor) != 0 ){
array_push(result, valueNow);
}
}
return result;
}
//THE CUSTOMIZATION ITEMS FOR CHARS
function CharCustom(_id, _name, _enabledFor) constructor {
keyId = _id;
name = _name;
enabledFor = _enabledFor; //"DWARF_MALE|DWARF_FEMALE|"
}
Hey, thanks for the answers @rwkay! =]Hmmm I cannot check the code just now but I think you might get this info from sprite_get_info() function
Russell
Could be! I checked the code and there is definitely an array of slots and on the slot it has an attachmentName (not sure if that is the info you are after)Maybe it's in there (in one of the maps), but it's not documented?
There are definite use cases for this and the info is already there so querying it to find all available attatchments should be possible.Unfortunately, sprite_get_info() don't provide the info that I need. Like, it have the attachment it's set now, but there is a list of attachments that should be possible, but I can't find it in the structure. (like ElfEar and HumanEar in the SlotEar)
skeleton_slot_list()
to return all slots, a companion function to return all attachments for a slot makes sense.skeleton_attachments_list()
, skeleton_slot_list_attachments()
or something like that.Thanks for filing that, it's not a necessity but would be really helpful and cut down on the manual work needed between artist/coder if you can simply query the skeleton to find out what the attachments are and what they have been named by the artist etc. It just removes a few extra steps and saves time and possible human error.Hmm, ok @rIKmAN, you're the resident Spine speciallist here after all. =]
Ok, made a ticket for that. Maybe it helps other people.
By the way, the above code could cause a Memory Leak? Should I open another topic? XD
Cheers!
Kezarus