Posts: 10
Threads: 0
Joined: May 2017
05-13-2017, 12:04 AM
(This post was last modified: 05-13-2017, 12:30 AM by Sylk.)
(05-11-2017, 10:48 AM)Carpaccio Wrote: Uh, problem with the Telltale Importer. Any time I try to import anything (so far with "Wolf Among Us"), it gives me the error "Unable to convert mat() to type: Material".
I cant testing it but looks like possible conflict with another script, using "mat" as global or function.
Try to add the word "local", like this :
Code: local mat = standardMaterial()
to the lines 1153, 1818, 2469, 3173, 4050, 4170, 4269, 4368, 5200, 5320, 5419, 5518, 6332, 6452, 6551 and 6650
05-13-2017, 04:07 AM
(This post was last modified: 05-14-2017, 02:24 PM by Random Talking Bush.)
(05-12-2017, 08:01 PM)Sylk Wrote: Hi RTB, thanks for your job.
I'm new here and I submit you an R4 mod with some modifications to increase the import speed. Around 50% faster now.
I'd make these mods since R1 but it's time to share it
E.g. with time to import ZELDA_miko from BOTW, in 3dsMax 2017:
R4: "Done! (208.177 Seconds)"
my R4 mod: "Done! (102.12 Seconds)"
See attachment (i've put old code parts in comment blocks).
Enjoy.
PS: Sorry for my english. Ah, thanks for your help! And it just so happens that I was also in the process of cleaning things up with the script, too, so I've added your changes to the newest revision.
Code: Script has been optimized so that models will import significantly faster, thanks to Sylk!
Changed "mat = standardMaterial()" to "local PolyMat = standardMaterial()" to fix potential problems, as suggested by Sylk.
Shaved off about a thousand lines of redundant coding since the way vertex buffers are read has now been rewritten.
Added an option to print debug information to the Listener, so the separate "_Debug" script is no longer necessary.
https://mega.nz/#!q4QwyBKa!5dBeE0YtWCqLM...h1q0l-nkZ0
Hopefully I didn't accidentally break anything with the revision, but things seemed to work alright for the models I've tried. Either way, be sure to let me know if there's anything else I can improve!
(05-13-2017, 12:04 AM)Sylk Wrote: I cant testing it but looks like possible conflict with another script, using "mat" as global or function.
Try to add the word "local", like this :
Code: local mat = standardMaterial()
to the lines 1153, 1818, 2469, 3173, 4050, 4170, 4269, 4368, 5200, 5320, 5419, 5518, 6332, 6452, 6551 and 6650 Would that fix it for you, Carpaccio? I've already (also) added that to the BFRES script, so if it works for you I'll go update my Telltale script with that change. If not, I'll try changing the "mat" referencing to a different name.
Posts: 10
Threads: 0
Joined: May 2017
05-13-2017, 07:38 AM
(This post was last modified: 05-13-2017, 07:40 AM by Sylk.)
(05-13-2017, 04:07 AM)Random Talking Bush Wrote: Ah, thanks for your help! And it just so happens that I was also in the process of cleaning things up with the script, too, so I've added your changes to the newest revision.
Hopefully I didn't accidentally break anything with the revision, but things seemed to work alright for the models I've tried. Either way, be sure to let me know if there's anything else I can improve!
You're welcome.
Not really matter but you forgot the "disableSceneRedraw()" between lines 194/195.
Here's a lil function to limit range, for type byte nor other custom range.
Code: fn range Lo Hi val=(
val=case of(
(val>Hi):Hi
(val<Lo):Lo
default:val
)
)
to reduce this kind of code:
Code: --Color Info--
(AttrArr[attr].attName == "_c0"):(
case of (
(AttrArr[attr].vertType == 0x020A):(
var1 = var1 * 2
var2 = var2 * 2
var3 = var3 * 2
var4 = var4 as float / 127
case of (
(var1 < 0):(var1 = 0)
(var1 > 254):(var1 = 255)
)
case of (
(var2 < 0):(var2 = 0)
(var2 > 254):(var2 = 255)
)
case of (
(var3 < 0):(var3 = 0)
(var3 > 254):(var3 = 255)
)
case of (
(var4 < 0):(var4 = 0)
(var4 > 1):(var4 = 1)
)
)
(AttrArr[attr].vertType == 0x080F):(
var1 = var1 * 255
var2 = var2 * 255
var3 = var3 * 255
case of (
(var1 < 0):(var1 = 0)
(var1 > 255):(var1 = 255)
)
case of (
(var2 < 0):(var2 = 0)
(var2 > 255):(var2 = 255)
)
case of (
(var3 < 0):(var3 = 0)
(var3 > 255):(var3 = 255)
)
)
(AttrArr[attr].vertType == 0x0813):(
var1 = var1 * 255
var2 = var2 * 255
var3 = var3 * 255
case of (
(var1 < 0):(var1 = 0)
(var1 > 255):(var1 = 255)
)
case of (
(var2 < 0):(var2 = 0)
(var2 > 255):(var2 = 255)
)
case of (
(var3 < 0):(var3 = 0)
(var3 > 255):(var3 = 255)
)
)
)
append Color_Array[var1,var2,var3]
-- append Alpha_Array var4
)
to this shorter
Code: --Color Info--
(AttrArr[attr].attName == "_c0"):(
case of (
(AttrArr[attr].vertType == 0x020A):(
var1 = range 0 254 (var1 * 2)
var2 = range 0 254 (var2 * 2)
var3 = range 0 254 (var3 * 2)
var4 = range 0 1 (var4 as float / 127)
)
(AttrArr[attr].vertType == 0x080F):(
var1 = range 0 255 (var1 * 255)
var2 = range 0 255 (var2 * 255)
var3 = range 0 255 (var3 * 255)
)
(AttrArr[attr].vertType == 0x0813):(
var1 = range 0 255 (var1 * 255)
var2 = range 0 255 (var2 * 255)
var3 = range 0 255 (var3 * 255)
)
)
append Color_Array[var1,var2,var3]
-- append Alpha_Array var4
)
05-13-2017, 01:11 PM
(This post was last modified: 05-14-2017, 02:23 PM by Random Talking Bush.)
(05-13-2017, 07:38 AM)Sylk Wrote: You're welcome.
Not really matter but you forgot the "disableSceneRedraw()" between lines 194/195. Whoops! I've added that in now, as well as the color code optimizations!
https://mega.nz/#!q4QwyBKa!5dBeE0YtWCqLM...h1q0l-nkZ0
(EDIT: Re-uploaded with a couple of minor fixes added.)
Posts: 1,674
Threads: 278
Joined: Jun 2008
Yeah the change didn't seem to make a difference unfortunately. I don't really know why, it gives me the same error as before.
(05-13-2017, 02:53 PM)Carpaccio Wrote: Yeah the change didn't seem to make a difference unfortunately. I don't really know why, it gives me the same error as before. *scratches head*
I just downloaded 3DS Max 2014 for myself and tested it, and everything imported just fine. Either way, try this script and let me know if that works.
https://mega.nz/#!65gljDJb!5P0EizVzIxftM...7mV_oIZ2WY
Posts: 1,674
Threads: 278
Joined: Jun 2008
This one works! Maybe I have some weird problem with my installation for max to cause problems with the other scripts...
(05-13-2017, 05:05 PM)Carpaccio Wrote: This one works! Maybe I have some weird problem with my installation for max to cause problems with the other scripts... Certainly is odd, to say the least. I'll continue using the alternative naming setup for that from now on, just in case.
Posts: 10
Threads: 0
Joined: May 2017
05-13-2017, 06:41 PM
(This post was last modified: 05-13-2017, 07:29 PM by Sylk.)
(05-13-2017, 05:06 PM)Random Talking Bush Wrote: (05-13-2017, 05:05 PM)Carpaccio Wrote: This one works! Maybe I have some weird problem with my installation for max to cause problems with the other scripts... Certainly is odd, to say the least. I'll continue using the alternative naming setup for that from now on, just in case.
That's why it's better to avoid too common names. Typically we use specific prefixes or long names like e.g. "bfMat" or "bfres_mat" to avoid potential conflicts.
Also that's why it's important to use global variables/function only if it's absolutly necessary. The bad to its "mysterious" crappy script... A global function named "mat' is the worst thing a dev can do...
(Although, the name of my function is not ideal either. Not as risky as "mat" but "vRange" or "rangeLimiter" would be safer for example. Don't release update just for that, just think for the next one).
Anyway, about code improvment, we can optimize its size for sure but not prior (it's already lite), i'll check how we can boost speed again.
Posts: 10
Threads: 0
Joined: May 2017
05-13-2017, 11:31 PM
(This post was last modified: 05-13-2017, 11:47 PM by Sylk.)
- So, about structure scope, none of globals in this script was justified, then i did it properly. The globals "f" an "p" was especialy risky!
Now these mods prevents any conflicts from BFRES importer to other scripts (the reverse depends on the other scripts).
To do this I moved the functions and globals inside the rollout block (between controls and controls event handlers)
- Also I reduced the redundant "--UV info--" part into a shorter block. I left old part in comment.
BFRES Script_R5_scope.zip (Size: 9.8 KB / Downloads: 234)
PS: "range" function has been renamed too.
(05-13-2017, 11:31 PM)Sylk Wrote: - So, about structure scope, none of globals in this script was justified, then i did it properly. The globals "f" an "p" was especialy risky!
Now these mods prevents any conflicts from BFRES importer to other scripts (the reverse depends on the other scripts).
To do this I moved the functions and globals inside the rollout block (between controls and controls event handlers)
- Also I reduced the redundant "--UV info--" part into a shorter block. I left old part in comment.
PS: "range" function has been renamed too. Thanks again, I've applied that to the main script now. I also went and added the same kind of changes for the bone IDs / weight sections.
https://mega.nz/#!q4QwyBKa!5dBeE0YtWCqLM...h1q0l-nkZ0
Posts: 4
Threads: 1
Joined: May 2017
05-14-2017, 03:56 PM
(This post was last modified: 05-14-2017, 05:39 PM by Random Talking Bush.)
(05-14-2017, 03:55 PM)Scorpionguy1993 Wrote: Tekken 4? (09-10-2016, 10:52 AM)Random Talking Bush Wrote: (NOTE: THIS TOPIC IS NOT FOR REQUESTS!)
(EDIT: Added a hotfix for my Telltale Games model-importer script now.)
Code: Fixed up a rigging issue with certain importers.
https://mega.nz/#!npxnDAYI!PxjAzFz8Aw-Nr...gTQGjeK2B8
Posts: 10
Threads: 0
Joined: May 2017
Radiobuttons are not clickable because the length of the labels covers them.
This code fix it and relooks ui a bit:
Code: rollout BFRESImporter "Wii U BFRES model importer" width:390 height:230
(
local r1=85,r2=10
label lblDisclaimer "This script was written by ItsEasyActually and Random Talking Bush, with some assistance from both Ploaj and Sylk. If you use it, consider giving us all thanks for this. If something doesn't work right, please contact RTB on The VG Resource (Random Talking Bush), Twitter, Tumblr or Steam (RandomTBush) so that any problems can be fixed." \
pos:[8,8] width:375 height:75
button btnLoad "Load BFRES" pos:[8,85] width:90 height:20
button btnImport "Import BFMDL" pos:[108,85] width:90 height:20
dropdownlist lstFMDL pos:[208,85] width:175 height:20 items:#()
label lblOptions "Options:" pos:[8,115] width:375 height:15
radiobuttons tglTexFormat "Texture format:" labels:#("DDS","PNG") height:10 columns:2 offsets:#([r1,-16],[r2,-16]) align:#left
radiobuttons tglUVLayers "UV layering:" labels:#("Split","Merge","No") height:10 columns:3 offsets:#([r1,-16],[r2,-16],[-r1+r2*2.5,-16]) align:#left
radiobuttons tglRigModel "Import rigging:" labels:#("Yes","No") height:10 columns:2 offsets:#([r1,-16],[r2+4,-16]) align:#left
radiobuttons tglLODs "Import LODs:" labels:#("No","Yes") height:10 columns:2 offsets:#([r1,-16],[r2+7,-16]) align:#left
checkbox tglDebug "Print debug information to Listener" pos:[8,BFRESImporter.height-20] width:200
label lblUpdate "(Updated 05/16/2017)" pos:[BFRESImporter.width-115,BFRESImporter.height-19] width:110
Posts: 1
Threads: 0
Joined: May 2017
Hi. I'm not sure if I understood correctly.
You make 3ds max script for import 3d models from nier automata, right ?
Are you working on importing animations also, or is it dreams ?
It would be great to have this.
|