|
In addition to the observations in the first post of this thread, the delayed update behavior for the sceneMaterials global MAXScript variable also occurs when importing scenes from Wavefront (OBJ), and 3D Studio (3DS) files. As indicated in the first post, this is also occurring with FBX files as well. This seems to suggest that there is an issue involving the generic import plugin interface, which all importers are derived from. I have attached a ZIP file containing the FBX, 3DS, and OBJ files.
Observation:
There appears to be an internal timer in 3ds Max whose timeout setting is at exactly 5 minutes, or 300 seconds. When the timer expires, it triggers an event that causes the global sceneMaterials variable to be updated to reflect the actual scene materials (as indicated in the Material Editor/Get Material/Browse From:/scene). After the timer expires, it resets back to 5 minutes, and the cycle continues. Also, it appears that the sceneMaterial variable is being updated immediately after assigning a new material to an object via the Material Editor, regardless whether or not the timer has expired, which is great.
Potential Solution:
When importing scenes into 3ds Max, the generic 3ds Max import plugin class should issue an update for the sceneMaterials global variable after the specific import plugin (FBX, OBJ, 3DS, etc) has finished completely.
How to Reproduce the Observation:
NOTE—Use a stop watch or timer (with second accuracy) as indicated below (iPhone does a great job at this :) It may be helpful to read all of the steps first to get an idea of the procedure because some of the steps are time sensitive (need to be completed as quickly as possible).
01) Open 3ds Max 2010.
02) Open the MAXScript Listener.
03) Reset 3ds Max.
04) Import the file sphere.obj.
--> Make sure to import materials.
--> For the FBX, use the default Autodesk M&E preset.
--> For the 3DS, use the default import settings.
05) In the MAXScript Listener, evaluate the following statement once per second:
--> Use the stop watch or timer to do this.
--> It may be helpful to copy the statement to the clipboard (CTRL+C),
--> and then simply paste (CTRL+V) the statement and press ENTER,
--> so that the statement evaluates about once every second.
--> NOTE: I tried using the sleep statement and while loop, but that
--> appears to have an effect on the 3ds Max internal timer, so
--> I had to copy and paste once every second instead.
--> MAXScript STATEMENT:
--> for mat in sceneMaterials do print mat.name
--> The statement will most likely print an “OK” in the beginning.
--> When the sceneMaterials variable has been updated,
--> the statement will print the names of any materials.
06) IMPORTANT: As soon as the statement prints the name of any materials, immediately reset the stop watch or timer back to zero, and let it continue to count from zero. Then, immediately Reset 3ds Max and reimport the sphere.obj file again (try to do all of this as quickly as possible). The purpose of this step is to synchronize our procedures to zero with the internal 3ds Max timer.
07) Repeat step 05 for the newly imported scene.
08) The statement should print the name of any materials at 5 minutes or 300 seconds, but will print “OK” until then.
09) IMPORTANT: When the statement prints the names of any materials, immediately reset the stop watch or timer back to zero, and let it continue to count from zero.
10) Let the timer count to 2 minutes, or 120 seconds.
11) Once the timer reaches 2 minutes, Reset 3ds Max and reimport the sphere.obj scene.
12) Evaluate the statement to confirm that no materials are printed. Just an “OK” should be printed.
13) Let the timer count to 4 minutes, or 240 seconds.
14) Once the timer reaches 4 minutes, Reset 3ds Max and reimport the sphere.obj scene.
15) Evaluate the statement to confirm that no materials are printed. Just an “OK” should be printed.
16) Let the timer count to 4.5 minutes or 270 seconds.
17) Once the timer reaches 4.5 minutes, repeat step 05 (evaluating the statement once every second).
18) The statement should print the names of any materials when the timer reaches 5 minutes or 300 seconds.
19) Repeat steps 03 to 18 for the file sphere.3DS.
20) Repeat steps 03 to 18 for the file sphere.FBX.
Thanks a bunch for any confirmation of these steps!
Robert
Robert G Graf
http://www.goofers.org
|