Home Technical Talk

MAXScript: Bitmap reload lag

polycounter lvl 16
Offline / Send Message
Sam Hatami polycounter lvl 16
Hello there.

I'm trying to learn MAXScript in hope of getting some useful macros for my beloved hobby :). I'll try and be as specific as possible.

Background
The engine I'm currently pointed toward uses ASE's as static meshes for it's level editor imports (yes Q4Rad). The editor needs to find the correct material path from the *BITMAP definitions in the ASE file. In practise this is done by, in post, finding all the bitmap definitions and change to the correct path. The game material path is structured in this way (quake based):

\\<basefolder>\<sub-directory of material>\<material name.tga>

Goal
To remove the post processing work inside the file.

Current state
I've created a small macro that changes the bitmap filepath in the standard matertial slot 1.(Note: It's from here the *BITMAP definition is taken). However! Since its a odd filepath, max obviously wants to find it, but it can't and therefore it freezes for a couple of seconds.
obj_name=$.name
od_base_path = "\\"+"\\base"
od_mat_path =od_base_path+"\\"+obj_name+".tga" 
meditMaterials[1].name = obj_name
meditMaterials[1].diffuseMap = Bitmaptexture fileName: od_mat_path
meditMaterials[1].diffuseMapEnable = off
$.material = meditMaterials[1]

Issue
How do I interfere with the bitmap path reload? or maybe its not even a reload? Perhaps I need to use a callback?

Replies

  • monster
    Options
    Offline / Send Message
    monster polycounter
    I thought I replied to this...

    The problem is that it thinks \\basefolder is a network location, so the lag is it trying to access the network several times before failing.

    I would probably write a script that exports the ase file, then have the script change the ase file on the disk. Or you could live with the lag.

    Also, there is no need to put the material in the Material Editor. You could just say:

    $.material.name = obj_name
    $.material.diffuseMap = Bitmaptexture fileName: od_mat_path
Sign In or Register to comment.