Hello, is this able to color objects individually? because i have been coloring my models in gdevelop with this but if there is more than 1 model in the scene, i cant color each one individually without coloring all of them, good extension tho its really great!
Viewing post in Material3D GDevelop extension comments
That's out of scope of this extension. You need to select specific object(s) to color using picking conditions of GDevelop.
One way to do it is to set an object variable and set up different values for the variable in the editor, then use actions to pick objects individually and color them with different colors.
More info here: https://wiki.gdevelop.io/gdevelop5/events/object-picking/
Yeah thats exactly what i mean, there is no way to do that, i tried it in a way that i made variables for each model that determine the color of it, one had 1 and the other 2, but object picking just didn't work with the "Set Color to" Action in this extension, try it for yourself because i dont think the problem has anything to do with the way im using the extension.
The new version was just released and it solves this problem!
Check out release notes!
Thanks! this actually helps alot, By the way can you make it so theres an action for changing color of a model but by its material slot? like in the MeshMaterial extension? I say this because i use that extension but it has the problem that you already fixed but also has the color by slot feature that this extension doesnt have yet, if this could be done it would be awesome but if you wont do it its alright, just a suggestion!
Hello! I saw this feature in the Pandako extension (A3F). You can try using his code.
let MakeUniqueMaterial = function(Obj3D) {
if (!Obj3D.userData.A3F) {
Obj3D.userData.A3F = {};
}
if (!Obj3D.userData.A3F.UniqueMaterial) {
Obj3D.userData.A3F.UniqueMaterial = true;
//
Obj3D.addEventListener("removed", gdjs._A3F.DisposeUniqueMaterial);
//
const CopyMat = {};
Obj3D.traverse((Child) => {
if (Child.material) {
if (Array.isArray(Child.material)) {
for (let i = 0; i < Child.material.length; i++) {
if (!CopyMat[Child.material[i].uuid]) {
CopyMat[Child.material[i].uuid] = Child.material[i].clone();
}
Child.material[i] = CopyMat[Child.material[i].uuid];
}
} else {
if (!CopyMat[Child.material.uuid]) {
CopyMat[Child.material.uuid] = Child.material.clone();
}
Child.material = CopyMat[Child.material.uuid];
}
}
});
}
};