Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Copy UV and material/textures to another object

Author
Message
RustyKristy
2
Years of Service
User Offline
Joined: 13th Jan 2016
Location:
Posted: 11th Jul 2018 12:22
It's been a while since and I have to follow up with a new thread since I can't reply on my old one here

The above thread already solved copying the UV set to another object and I had a chance to get back to this and now checking with other dbo models, there's a problem with getting the right material from the 2nd UV as opening the output model, it seems it is reading from the 1st UV but both UV channels materials are there.
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 11th Jul 2018 13:15
ah yes, I recall posting a code error on that thread. I am interested in this and will have a "revisit" and get some code together as I've done a lot of DBO/texture/multi material type of code and format conversion stuff which has been pretty challenging and very satisfying. I'll fire up DBPro and have a play with some code after work.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Mage
11
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 11th Jul 2018 21:22
I have also been working on converting the DBO format and found the going slow. I have noticed there are omission errors in the DBO specification document. I also have been doing a little bit of work a day so I don't burn out and can maintain progress. It's been slow going but I haven't run into any road blocks yet. I will first read all of the codes and dump the data into a text file (phase 1). Then I will convert that code to store the data in appropriate variables and arrays (phase 2). Then I will have the code repack the data into a byte for byte perfect DBO file (phase 3). Since I have already done this for the other format I am working with I will then begin code to convert the data from one format to the other (phase 4). Then do the reverse (phase 5). Then the easy part give it all a nice GUI (phase 6).

I'm sure weighted verts and animations will be convoluted an nearly impossible to figure out. Especially if the angles are stored differently and some sort of university level calculus course is needed understand and implement the conversions. Maybe.
RustyKristy
2
Years of Service
User Offline
Joined: 13th Jan 2016
Location:
Posted: 16th Jul 2018 14:43 Edited at: 16th Jul 2018 14:44
Hey, nice to hear from you again BoTR that would be awesome, thanks. Any update on this btw?

@Mage
Actually I'm only concerned with static objects with multiple UVs/materials and it would also be interesting to check out your work if it supports it and then some.
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 16th Jul 2018 19:10
@RustyKristy: ah, I knew I meant to do something......will have a look as soon as I get some spare time...shouldn't be long.....
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Mage
11
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 16th Jul 2018 19:58
RustyKristy wrote: "Actually I'm only concerned with static objects with multiple UVs/materials and it would also be interesting to check out your work if it supports it and then some."

What I am working on would cover that but I am still a long way from releasing anything viable as I am too distracted with other things to work at a fast pace. Also I am working purely from a file format perspective. That involves basically needing to be able to parse and repack objects completely.

This seems like a "Phase 3" problem.

I am getting confused by your grammar in the opening post. Can you in detail describe the information that needs to be copied from Object 1 to Object 2? If I get to Phase 3 then I will be able to open the file up, make changes, and save it again.
For example I have already done this for another file format where the material is merely stored as a string. So opening the file, changing the string, and then re-saving would change the material.
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 19th Jul 2018 06:54 Edited at: 19th Jul 2018 07:33
@RustyKristy-I'm having a look at this currently, and I'm not sure what your code looks like, but if your using Chris Tates' original code, I think I may have (or not) spotted a potential error. Just finding my DBO with multi texture staging and will play around wth the code and correct where applicable. In the meantime, what happens if you use this code (Chris Tates')?:

I think the issue here is the original code that copies all the uv layers of 1 object to another is only looking at stage 1 (sourceUV), so I changed the sourceStage (1) to the same as the var targetStage i.e. I've set sourceStage to the same as targetStage, but can't test to see if it works yet until I find my DBO. Obviously update the code to copy from whatever stage to whatever stage you like. Will test as soon as I can get to my DBO that uses multi-staging. Change the FOR ... NEXT statement to whatever values you need to :

[update-tested on the "Hummer_dynamic.DBO" from the DesertStorm Pack (FPSC model 75) and ran code and copied UV layers ok. Attached files here. out.dbo is the result. ]

For targetStage = 0 to 7
` Copy the UV layer on limb zero
//CopyObjectUVLayer(2,0,1,0,targetStage,1)
sourceStage = targetStage
CopyObjectUVLayer(2,0,1,0,targetStage,sourceStage)
Next


Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others

Attachments

Login to view attachments
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 19th Jul 2018 09:43
actually the above initial testing isn't the best test as the cloned object already has the same texture data as the source DBO object. So I will test the source DBO against a plain and untextured DBO and see if the code still works. I'm not sure 100% it will, but you never know.

Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 19th Jul 2018 13:40
ok, so it appears that after testing against a non-textured object, the code above doesn't really work. When I exported both the source / target DBO's out locally and imported / exported back out from Fragmotion as X format, the target only has 1 material/texture in the materiallist part of the X file. I'm going to try my converter and see if I get a fully multi textured Hummer or single textured even though both materials/textures show in Fragmotion in DBO format, but only 1 texture/mat comes is shown when importing X file back into FM. In theory my program should work. Confused? same here ha ... just kidding.....
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 19th Jul 2018 17:43
ok, missed this code mistake, should be source not target:

Still playing around with all this, as there are other issues with the code.
` Lock source limb for vertex access
// Lock VertexData For Limb targetObject, targetLimb, 2
Lock VertexData For Limb sourceObject, sourceLimb
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 19th Jul 2018 22:30 Edited at: 20th Jul 2018 12:33
After a bit more 'dabbling', for the Humvee example. It has 1 limb and 2 textures/materials. And the actual UV data is actually present in staging (or layers) 0 and 8, so not 0 and 1 as I would have thought. Now in X format , my DBO2X program grabs these UVs from the DBO data and in the materiallist , the 2 UV's are actually 0,0,0,0,0 etc and 1,1,1,1,1 and then the 2 materials/texturefilenames are embedded near the "texturefilename" part of the ascii file. I think I'll get the code right and tidied up and then post here as soon as possible.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 20th Jul 2018 17:22 Edited at: 20th Jul 2018 22:08
final code and DBO/textures attached so you can play around. Obviously change what stages/layers you want to copy, experiment. I can't take credit for the original code which was supplied by Chris Tate (thanks Chris), but I've made some small corrections to it:

thanks also to the person (I can't recall) who created the Humvee model from the Desert Storm Pack. This is free on github FPSC open source. model pack 75 if I remember.

Also note, that this DBO has 1 limb so the target limb will be 1 as there are NO verts/UV's in limb 0. Change to use 0 if no limbs in your DBO/model. I find it useful to use PERFORM CHECKLIST FOR OBJECT LIMBS and then loop through each limb and see if it has an FVF size / verts/ indices etc.

For learners of the language, texture staging can be achieved by using:

Texture objectId, stagenum, image-->

e.g.
Texture 1,1,1 -> texture object 1, assign to stage/layer 1 and use image number 1
Texture 1,2,2 -> texture object 1, assign to stage/layer 2 and use image number 2

There is also a 'TEXTURE LIMB' command which allows you to texture limbs individually if your using commands such as ADD LIMB/Link Limb etc.
been a while since I played with those for my own tools, but they are useful.

Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others

Attachments

Login to view attachments
RustyKristy
2
Years of Service
User Offline
Joined: 13th Jan 2016
Location:
Posted: 21st Jul 2018 00:29
This is so awesome BOTR! I already tested your previous Humvee output and so far it looks good! I will give it a try asap. Big Thanks buddy!
RustyKristy
2
Years of Service
User Offline
Joined: 13th Jan 2016
Location:
Posted: 21st Jul 2018 00:37
Quote: "I am getting confused by your grammar in the opening post. Can you in detail describe the information that needs to be copied from Object 1 to Object 2? If I get to Phase 3 then I will be able to open the file up, make changes, and save it again.
For example I have already done this for another file format where the material is merely stored as a string. So opening the file, changing the string, and then re-saving would change the material."


@Mage

Yes, again basically I have a standard DBO model with a 2nd UV texture (ie. lightmap) and I want to have a separate model with the lightmapped texture only. That's all. unfortunately, there is not a lot of editor tools out there that fully supports the DBO format (except a few paid ones which is also not 100% working). There are some that I tried, but features are lacking like this one that I posted.

btw, Is DBO still supported on newer products like Game Guru or AGK2? just curious
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 21st Jul 2018 08:06 Edited at: 21st Jul 2018 08:11
@RustyKristy: no problem at at. I will have to test out using lightmap texture (FPSC DBO by any chance?). GameGuru supports DBO as it originally was written in DBPro and later got converted to C+. AppGameKit doesn't support DBO at the moment. my current version app DBO2X does convert to either X or OBJ that can be imported into AGK. It still needs more work to get it as close to perfect as possible as it also converts GameGuru's PBR / EBE DBO structures as Lee updated the DBO format for those when making updates to GameGuru.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
RustyKristy
2
Years of Service
User Offline
Joined: 13th Jan 2016
Location:
Posted: 21st Jul 2018 12:19 Edited at: 21st Jul 2018 12:30
Nice! Yes, I was hoping that it will cover all DBO versions, particularly the ones with multiple UVs or at least UV2 for lightmapping like FPSC as you mentioned. I'm not sure with animations though as with my experience so far, I have not found any use case where it will be needed.

So I already made the effort to create a basic FPSC map with lightmaps baked in for UV2 (see Attachment). I just got the assets from the Arteria Sci-Fi pack posted on the Github FPSC repo link. Here is the screencap..





I have tested this with the old code on the previous thread and so far it is the same problem and here are the results:





The first two at top was produced with the said older code with some modification to output both diffuse and the objective and attempt to export the uv2 object (OutLM.dbo). I have provided a compiled exe as well for fast checking.

As for the bottom left, this is a quick attempt to check the result by manually assigning it in fragmotion with the single lightmap texture and so it seems it does not copy or assign the material to the transferred UV, which I would think would be the case and as far as I know that technically this needs to be done by code as well.

The bottom right would be the ideal result which I have assigned manually in fragmotion, matching the material number and group number, as simple as that it turns out. I'm not sure how to go about this with DBPro and it would be nice to just export two dbo outputs that can be merged with outside tools like Blender, since it is still a problem to import, open or convert a DBO file to a common/standard format.

As for the above code that you posted recently, apparently I'm just seeing vertices when opening it with fragmotion with my earlier tests.

Typo: The last bottom right result is actually a fragmotion UGH file and not in DBO format (ManualAssignMaterial.UGH, see zip file).

Attachments

Login to view attachments
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 21st Jul 2018 12:32 Edited at: 21st Jul 2018 14:22
@RustyKristy-ok, I see what you want now, thanks for the pics/zip. My segautowelder/autowelder imports/exports FPSC textured levels so you can import into GG or what ever loads in an X or DBO file. It unfortunately ignores lightmaps, but now I think about it, I could just get it to look at the lightmaps and ignore the .dds textures etc. So it might be I have the code already just needs some tweaking. So in theory it should texture/bake the lightmaps into the DBO FPSC level for each limb in Fragmotion but might be more to it than I realise. This should be possible to do, let's see what I can come up with.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 21st Jul 2018 19:30 Edited at: 21st Jul 2018 19:45
here is a code snippet from my Autowelder tool (the next SegAutoWelder incarnation), which has super fast FPSC level import/export feature (fully textured). This bit of code excludes the lightmap files. So I will update the code and do some reworking to get the program to reproduce the FPSC level but using the lightmaps. But I'm assuming from the above pic (bottom right) you still want to see the segment textures that were used? A lot of the code needs major improvments anyway with some new techniques I've picked up over the last few months or so. The level exporter also allows other options and re-centers the level a 0,0,0 if you want to or keep the original position. once I get some good results, I'll upload some pics.

[edit-added a pic of Autowelder with the In.DBO level displayed untextured at the moment. So the plan is to get it textured using the 2nd UV layer (lightmap) textures]
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others

Attachments

Login to view attachments
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 21st Jul 2018 21:36 Edited at: 21st Jul 2018 21:59
here is the In.DBO level now textured using the lightmap textures using the updated Autowelder and another pic showing the wall textures. there's hope in all this after all , time to have more fun with this and get it to look like the bottom right pic above that RustyKritst posted
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others

Attachments

Login to view attachments
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 23rd Jul 2018 08:59
so getting a lot further with this and doing additional testing and dumping out UV info to file for each stage per limb that make up the "universe.dbo". so my code uses texture limb with the staging option added in. So hopefully after work I'll have more some decent results post UV copying. All going well, I'll add some more pics later or tomorrow
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 24th Jul 2018 08:49 Edited at: 24th Jul 2018 09:16
ok so a good result so far after I modified the 0.png lightmap texture with a paint program as well as copying UV layer(s). Did this in a separate test program but will update my Autowelder program again soon. Will probably write the c+ version with a bit more time on my hands. Here is a pic :
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others

Attachments

Login to view attachments
RustyKristy
2
Years of Service
User Offline
Joined: 13th Jan 2016
Location:
Posted: 24th Jul 2018 10:01
Looks good BoTR. Do you have any working updated code to post? So far I haven't got any code working since this thread got started. thanks.
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 24th Jul 2018 11:25 Edited at: 24th Jul 2018 11:26
yes, I have the code , although it's split into 2 test programs, my AutoWelder app and other test app. Just a case of grabbing the right sections of code in Autowelder and adding it to the test code app + cleaning it up/optimising etc, then will post.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 24th Jul 2018 13:53
ok, so the pic above (couple of posts up) was actually based on loading in DBOs. The below looks a little different when loading in the mesh equivalents (both DBOs and X's were exported by Autowelder), so looks (I think) more like what RustyKristy posted (bottom right pic):

Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others

Attachments

Login to view attachments
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 24th Jul 2018 21:49 Edited at: 6th Aug 2018 11:20
Here is the final, final code:

You will have to modify the 0.dds or 0.png with a white background (or experiment with another colour) and save out as either DDS or PNG. Also, place the media files in the project folder.
Here the code breaks up the FPSC level DBO into limb objects and then copies the UVs over. You could if you want save each limb out as a DBO or .X file for loading in later.
What I usually do with FPSC Level DBO's is reposition the vertices so that the level sits at 0,0,0, but for demo purposes and to keep code short I've left it out.

Experiment and have fun with the code.
[update: the 2nd pic shows a BlackIceMod posteffects FPSC level (tonemapping universe.dbo). I didn't modify the lightmap for this one]

Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others

Attachments

Login to view attachments
RustyKristy
2
Years of Service
User Offline
Joined: 13th Jan 2016
Location:
Posted: 24th Jul 2018 23:47 Edited at: 24th Jul 2018 23:49
thanks BoTR, I tried the code as is and used my previous attachment and placed it in the app directory. I now got the attached screenshot result instead. I also provided a 0_white.png texture and copied over the wall_simple2tex.dds texture. Am I missing something here?



From what it looks like, it is picking up a diffuse texture and still not finding and applying the lightmap 0.dds file.

Attachments

Login to view attachments
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 25th Jul 2018 06:43 Edited at: 6th Aug 2018 11:21
should be ok as is , I'm using the same code as above. for the 0_white.png, it should work if you made sure you only filled the background with white and not the foreground [edit-actually I just tried with foreground filled with white and still came out ok] . Of course you could try the testing against the original 0.png/0.dds files, but you'll have black exterior walls.

I've attached my 0_white.png here for comparison with your one.

[updated code now attached. This generates small X mesh files post UV object copying and then loads and textures them. This should work for you ok now.]

Note: we are only loading in the lightmap image now and also converting the object fvf to 274. Opening the X files in notepad will show the new UV coordinates. A lot of my test code was very very long, dumping out text files showing old and new UV coords for each object/mesh. So I know the copyobjectUV function works correctly.

Note2: You might want to consider creating a dummy object and attaching the meshes as limbs and then texturing the limbs. That way you can save out the whole level as 1 object file.

Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others

Attachments

Login to view attachments
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 25th Jul 2018 18:55 Edited at: 25th Jul 2018 19:07
another pic, but this time the code was updated to use limbs (textured) and then saved out as 1 DBO object:
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others

Attachments

Login to view attachments
RustyKristy
2
Years of Service
User Offline
Joined: 13th Jan 2016
Location:
Posted: 26th Jul 2018 02:08
nice, will try this one BoTR. Is the updated code with the saved as 1 DBO object? thanks
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 26th Jul 2018 07:40
sure, here is the code and some extra useful functions:

Another piece of code I usually add (and might add later) is the collection of textures used for the whole source DBO. This list then gets sorted and any duplicates get removed from the list.
Then with the addition of another bit of code that handles the limb texture assignment, you can load in and texture limbs using only the minimum of images over and over. Good resource optimization.

Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
RustyKristy
2
Years of Service
User Offline
Joined: 13th Jan 2016
Location:
Posted: 26th Jul 2018 11:55 Edited at: 26th Jul 2018 11:56
awesome thanks, getting these new errors now as I assume these are extended commands or custom functions

I commented each line until I got it to compile..

Quote: "
Welcome to DarkBASIC Professional Editor
Compiling project...
Could not understand command at line 224.
Compilation Failed (Syntax Errors)
Compiling project...
Could not determine parameter type of 'fast upper$(extract fileext$(file$))' at line 247.
Compilation Failed (Syntax Errors)
Compiling project...
Could not determine parameter type of 'fast upper$(extract fileext$(file$))' at line 247.
Compilation Failed (Syntax Errors)
Compiling project...
Could not determine parameter type of 'extract fileext$(file$)' at line 247.
Compilation Failed (Syntax Errors)
Compiling project...
Subscript must be Integer or DWORD when referencing an array at line 249.
Compilation Failed (Syntax Errors)
Compiling project...
Subscript must be Integer or DWORD when referencing an array at line 256.
Compilation Failed (Syntax Errors)
Compiling project...
Could not determine parameter type of 'fast upper$(file$)' at line 257.
Compilation Failed (Syntax Errors)
Compiling project...
Command out of place at line 259.
Compilation Failed (Syntax Errors)
Compiling project...
Could not understand command at line 270.
Compilation Failed (Syntax Errors)
Compiling project...
Could not understand command at line 275.
Compilation Failed (Syntax Errors)
Compiling project...
Could not determine parameter type of 'fast len(src$)' at line 279.
Compilation Failed (Syntax Errors)
Compiling project...
Compilation Successful
"
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 26th Jul 2018 13:09
ah yes, you need IanM's matrix1utils plugin, or remove the offending commands and replace with equivalent functions which are fairly easy to write. I've used the plugin just for speedy development.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 27th Jul 2018 06:45
replace all fast <command> with just <command> e.g. fast len = len
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 27th Jul 2018 12:01
of course the above final code only uses 1 image , but what if there were multiple lightmap images you say? Well, I have code that looks at all the textures used and creates a unique list of textures needed for the DBO. The code then loads in each unique texture and textures each limb with the correct lightmap texture image only. so this could be 0.dds, 1.dds, 2.dds etc.........
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 28th Jul 2018 07:48 Edited at: 6th Aug 2018 11:20
If you don't have or don't want to use Matrix1tils, here are some functions to replace/use. You can drop the "fast" from "Fast Len" or similar command to use standard DBP commands :

[update 29Jul18: minor mod to ChangeFext$ and ExtractFext$ functions]

Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 31st Jul 2018 07:33
IanM's marix1utils can be found here: https://forum.thegamecreators.com/thread/85209#m2355306
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
RustyKristy
2
Years of Service
User Offline
Joined: 13th Jan 2016
Location:
Posted: 31st Jul 2018 08:00
Thanks BoTR, was not feeling well within these past few days so just got back to this, will check this out. I have the MatrixUtils but not all are installed. If I can use it without those, the better. I hope the replacement function works.
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 31st Jul 2018 08:46 Edited at: 31st Jul 2018 08:46
@RustyKristy: Hope your feeling better. Yes i've tested the replacement functions and work fine. I'll post 2 more final versions, 1 using M1utils and 1 without. Also, the final code loads in unique texture filename and texture's each limb according to it's assigned texture/image ID.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 31st Jul 2018 12:55 Edited at: 6th Aug 2018 11:19
Final code (uses M1Utils):

If you want to work with other "universe.dbo" type files, copy the dbo over into the app folder. Copy the levelbank folder containing the lightmap textures over to the app folder. Comment out the line that converts the suffix to a .PNG format (only used for the example In.DBO). Also , if you want to delete any old temp files in your Appdata, Local, Temp area, then uncomment the CleanUpTempFiles(tmpfld,suff$,"dbpdata",7,"") line. Should import into Fragmotion without issue.
Also, remember yout can update these 2 lines if you want to be more specific with input / output DBO filenames:

dboin$="in.dbo"
dboout$="out.dbo"

Ok, so that's enough of lightmap UV swapping for a while, onto other stuff now

[01Aug18: small update-added rawlist$(t).image=img to stop program from bombing out]



Also, forgot that the code uses a Styx command tempdir$(), but you can either replace this with a temp folder of your choice or install Styx,
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 1st Aug 2018 14:27
updated code above, added the line "rawlist$(t).image=img" to prevent error occuring on deletion of images (clean up process). We only want to delete each unique image ID and I forgot to assign .image to img var within the rawlist$() array.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
RustyKristy
2
Years of Service
User Offline
Joined: 13th Jan 2016
Location:
Posted: 2nd Aug 2018 22:19 Edited at: 2nd Aug 2018 22:19
Hi, ok I tried the non matrix utils code and I get this:

Could not understand command at line 50.

which is this

array insert at bottom(rawlist$() )

willing to try the matrix utils, if you let me know the specific number or DLL name, there's a lot of them.
chafari
Valued Member
12
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 2nd Aug 2018 22:44
Quote: "Hi, ok I tried the non matrix utils code and I get this:

Could not understand command at line 50.

which is this

array insert at bottom(rawlist$() )"

Same here...in both codes, and I have Matrixutils....I still use winndows Vista
I'm not a grumpy grandpa
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 2nd Aug 2018 22:58
"Array Insert At Bottom" is a standard DBPro command,
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
chafari
Valued Member
12
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 2nd Aug 2018 23:15
Perhaps there's a peoblem in variable rawlist$()
I'm not a grumpy grandpa
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 3rd Aug 2018 06:51 Edited at: 3rd Aug 2018 07:12
nope, otherwise it wouldn't work for me. I just copied and pasted the code from the non-MU1 version from above and compiled it without issue. I'm using DBProEX on Windows10. I'll test on the retail version, though it shouldn't make any difference.

My suggesstion would be to try code below in a new project and compile (F4) and see if it compiles successfully. If not, something wrong with your DBPro install/compiler or conflicting DLLs e.g. DBPro plugins:
I'll check the code again to make sure there are no MU1 related commands. The MU1 version uses dll 29 and 16. I will also double check this.

type tstring
raw_name as string // S offset = 0
isdup as boolean // B offset = 4
limb as integer // limb number // offset = 8
image as integer // image number // offset = 12
textured as boolean // offset = 16
endtype

dim rawlist$() as tstring

array insert at bottom(rawlist$() )
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 3rd Aug 2018 07:19 Edited at: 3rd Aug 2018 07:27
In addition to the above there is a command that uses Styx....

tmpfld = tempdir$()

If you don't have Styx, just replace it with a temporary folder of your choice. it points to the the appdata\local\temp folder under users<username> depending on your OS.

Actually another thought is that the non-MU1 isn't truly non-MU because the code needs get arrayptr and sortptr and other ptr related stuff. I recommend using the MU1 code , installing MU1 (16 and 29) and Styx if you have it or just do the above with tmpfld. I've removed the code from the above, it needs updating.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 3rd Aug 2018 09:43 Edited at: 3rd Aug 2018 09:43
so got a bit confused as I take most of the commands for granted these days and don't think much about which plugin they come from. Ok so for the extract fileext$ and extract filename$ etc, these are actually Styx commands and not M1U plugin commands. Anyway, I don't really feel like rewriting a complete sort array ptr like function and other MU1 functions as this would take too long and I don't have time, so I would definitely recommend just installing Matrix utils plugin. If you don't have it, I'll post it. If you don't have Styx plugin, I'll post it.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 3rd Aug 2018 09:47 Edited at: 3rd Aug 2018 11:37
better still, here is the "useful" links link, you can find Styx there:

https://anyhowengine.wordpress.com/useful-links/

Be careful with Matrix utils and styx the strings dll conflicts if I recall.

matrix1utils attached:

Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others

Attachments

Login to view attachments
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 3rd Aug 2018 13:01
hmmm interesting, I also tried to run the program using DBPro Online and get same error message you both got. Maybe that's why I now use the open source DBProEx. I might install the retail version 7.7 and see if I get same issue.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
chafari
Valued Member
12
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 3rd Aug 2018 13:16 Edited at: 3rd Aug 2018 13:19
Thanks Botr . I didn't even know I had styx installed in my laptop . it keeps the same error in line 50 array insert at bottom(rawlist$() ) . I have aswell matrixutils dll ...I have used long ago. Some time ago, I made a lightmapper with the help of Evoldved funcktion and it really works ok, but I can only save to dbo. I was trying to save to .x with my converter dbo2x but you can't keep the lightmapping unless we could somehow reder to texture like Blender do ...I was interested in this thread from begining to see if I could guess something with it. I have test your last update, and my laptop krash ...I had to unplug even the electricity because it was like dead .

Like most grumpy grandpa , I don't like too much updates and I still use old Dbpro 1.074 but I don't think that could be my problem as I have tested it aswell with 1.77 and same result.
Thankyou anyway for your effort .
I'm not a grumpy grandpa

Login to post a reply

Server time is: 2018-11-14 05:42:36
Your offset time is: 2018-11-14 05:42:36