Roberto14 Posted January 12, 2017 Share Posted January 12, 2017 Hi all guys, i have a suggestion about materials in LE: if a material can have a sort of ID ( a string for example ) that can be assigned in the editor and then used in a script or c++ code to quickly identify the material by coder without a path string manupulation. For example using material "Materials\\Concrete\\concrete_clean.mat", ( if i don't mistake ) can be simplified into "concrete_clean" but first removing the path and then removing the extension. With the user specified ID a material in c++ can be easly identified by using for example: if ( pickinfo.surface->material->ID == "concrete" ( defined inLE editor ) ) { ... } This would be very useful for footsteps, bullet impact or other things.. 1 Quote I'm not english, so please sorry for my grammatical errors I'm using Leadwerks and can programm in C++ and LUA Link to comment Share on other sites More sharing options...
Josh Posted January 12, 2017 Share Posted January 12, 2017 This will do what you need: http://www.leadwerks.com/werkspace/page/api-reference/_/filesystem/filesystemstripall-r649 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
martyj Posted January 12, 2017 Share Posted January 12, 2017 I think he means more of something like Material::LoadById("bullet_impact") instead of Material::Load("some\long\pathname\bullet_impact_d.mat") Quote Link to comment Share on other sites More sharing options...
Rick Posted January 12, 2017 Share Posted January 12, 2017 If the point of wanting this is to Id later in code for a check like in his example then what josh said should work. If the point is to be able to make one change to point to what a name is pointing to instead of finding and changing each loading of said code then what he's asking for makes sense. Does that come up often is the question. Often enough to warrant the code to set this up in the editor. Seems lower on the priority of things. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.