[Closed] SDK Missing maps
Hi, I am trying to create a function that will tell me if there are any missing maps within my scene. I have been trying to use EnumAuxFiles to find all the missing maps. But it just doesn’t seem to want to work. I’ve been using CJRender.cpp as the reference for this. Is this the right way or is there a another way ?? Thanks!
it has to work. it’s basic method used everywhere in the system. what is not working for you?
Ok, I got it working with the Nodes, although, its super slow and only picks up missing mtl on nodes (so in some scenes its missing some/all missing maps). I’ve tried using the interface EnumAuxFiles, but it always return 0 missing files … so I’m not sure what to do xD Code is below:
This is the AssestEnumCallBack Class (all from CJRender.cpp)
class CheckFileNames: public AssetEnumCallback {
public:
NameTab* missingMaps;
BitmapInfo bi;
CheckFileNames(NameTab* n);
void RecordAsset(const MaxSDK::AssetManagement::AssetUser&asset);
};
//************************************************************************
// Class to manage names of missing maps
//************************************************************************
CheckFileNames::CheckFileNames(NameTab* n)
{
missingMaps = n;
}
//************************************************************************
// Add a name to the list if it's not already there
//************************************************************************
void CheckFileNames::RecordAsset(const MaxSDK::AssetManagement::AssetUser&asset)
{
if (asset.GetId()!=MaxSDK::AssetManagement::kInvalidId) {
if (missingMaps->FindName(asset.GetFileName())<0) {
missingMaps->AddName(asset.GetFileName());
}
}
}
This is the function checking for the missing maps.
//------------------------------------------------------------------------------------------------------------------------------------
// Check Missing Maps
//------------------------------------------------------------------------------------------------------------------------------------
void CheckSceneTools::CheckMissingMaps(){
NameTab mapFiles;
CheckFileNames checkNames(&mapFiles);
for(int i = 0; i < AllNodes.Count(); i++){
INode* node = AllNodes[i];
node->EnumAuxFiles(checkNames, FILE_ENUM_MISSING_ONLY);
}
MCHAR Debug[256];
swprintf(Debug, _T(" %i
"), mapFiles.Count());
mprintf(Debug);
mflush();
}
I want something like the Bitmap/Photometric Paths Utility, where it searches through the Material Editor, and then can pick up the missing maps.
why do you use all nodes if you need materials? use MtlBase… all materials of the material editor you can get with IMtlEditInterface.
Hi, Ok, but doesn’t that limit me to the 24 Mtls I can have within the mtleditor ?? As I want to get all the missing maps within the scene. Sorry, I may have not been clear about it !
Or is there a way to access the mtls via the Mat/Map Browser ??
yes. it will be limited by 24, but…
I want something like the Bitmap/Photometric Paths Utility, where it searches through the Material Editor, and then can pick up the missing maps.
you said about the material editor.
if you need all missed maps in the scene and you don’t know where to search you have to recurse whole scene. the Interface method is exactly for that.
it should be an example in max sdk
if you need only missed files in scene materials you can start enumerating from top level nodes.
Interface::GetRootNode(), INode::NumberOfChildren(), INode::GetChildNode(i)).
Hi, Sorry about the confusion. I agree, all the doc’s say to use the interface one, although, when I do, it comes back with no missing files … I’m not sure if I need to change the callback code or not ?? I will go through the sdk again to see if I missed anything !! I mean, do you know why my interface wouldn’t pick up all the scene’s materials ?? Thanks for all the help !!