Ah, the joys of switching assets to a different engine.
Anyway, the issue is this. We have an environment, in MAX 5. All the materials have a structure like this:
Diffuse - RGB Tint - Bitmap
Unfortunately, the engine we are switching to, the exporters do not recognise the RGB Tint, and is dropping the bitmap, so we have a very flat world. Resources are tight atm, so rather than re-tooling the exporter, I need to find a solution in MAX. I would like to keep the RGB Tint in the materials, as this gives me the opportunity to lay down blocks of colour to multiplay over bitmaps.
I need to figure out a MAXScript to take
Diffuse - RGB Tint - Bitmap
and give me:
Diffuse - Bitmap
Unfortunately, I don't have my MAXScript books with me here at work, or I would be plugging away now. Was wondering if any MAXScript gurus knew of anything already out there that could do this, or a suitable script that can be jerry-rigged into the task?
Replies
http://plugins.angstraum.at/
One way that might work is to use BFF to convert the scene to a script file, then replace all the RGB Tints with a global replacer (I like ReplaceEm ), then load the script back in.
Although a script jock will probably come along with a better way...
-- remove rgbtint
for m in scenematerials do (
if (classof m == standardmaterial and classof m.diffusemap == rgb_tint) then
(
m.diffusemap = m.diffusemap.map1
)
)
The trouble is, I need to find away of copying the bitmap value sitting in the RGB tint slot, and pasting that into the diffuse.
All materials are standard, but they are sitting in multi-sub lists.
Not done MAXScript for materials before.
*dives back into help files*
<font class="small">Code:</font><hr /><pre>
function relink_diffuse m = (
if (classof m.diffusemap == rgb_tint) then
(
m.diffusemap = m.diffusemap.map1
)
)
function process_mat m = (
if (classof m == standardmaterial) then (
relink_diffuse m
)
else if (classof m == multimaterial) then
(
for subs in m.materiallist do (
process_mat subs
)
)
)
function removetint = (
for m in scenematerials do (
process_mat m
)
)
</pre><hr />
<font class="small">Code:</font><hr /><pre>-- Syntax error: at ), expected <factor>
-- In line: )</pre><hr />
When pasted into the MAXscript listener
I have tried wrapping it in a utility, but I get feedback on the listener with that, and nothing happening.
<font class="small">Code:</font><hr /><pre>Utility removergbtint "Remove RGB Tint"
(
Button remove "Remove RGB Tint"
on remove pressed do
(
function relink_diffuse m = (
if (classof m.diffusemap == rgb_tint) then
(
m.diffusemap = m.diffusemap.map1
)
)
function process_mat m = (
if (classof m == standardmaterial) then (
relink_diffuse m
)
else if (classof m == multimaterial) then
(
for subs in m.materiallist do (
process_mat subs
)
)
)
function removetint = (
for m in scenematerials do (
process_mat m
)
)
)
)</pre><hr />
Using MAX 5 here
removetint() on pressed, I fixed your utility here
http://planetquake.com/polycount/cottages/crazybutcher/code/removetint.ms