ConverterPIXWrapper - Import PMG models to Blender with ease [v1.5 - 16. 1. 2018]

User avatar
RootlessAgrarian
Posts: 383
Joined: 25 Nov 2015 18:43
Location: Cortes Island BC Canada

Re: ConverterPIXWrapper - Import PMG models to Blender with ease [v1.4 - 23. 8. 2017]

#171 Post by RootlessAgrarian » 16 Dec 2017 01:26

@50Keda

first let me say a huge THANKS for converterPIX which finally makes it possible for me to learn to create content for ETS2/ATS with my OSX gaming machine. I really appreciate the work you have put into this tool. I think it might be life-changing :-) I love this sim so much that I'm really motivated to learn and someday contribute.

I am still figuring out all the little secrets of the directory structures, and have not yet tested a mod; conversion-tools (running manually in a VirtualBox Windoze 10 environment) seem to be doing the right thing, i.e. they do create rsrc folder tree with @dep, @cache and so on, but I have not yet repackaged as a mod and tried loading. I will work on this final step over the weekend and let you know. I'm pretty excited about all this...
Last edited by RootlessAgrarian on 17 Dec 2017 06:58, edited 1 time in total.
Level 42 and rising... i7 8700K -- AMD Radeon 5700XT -- ASUS MAXIMUS XI HERO - WIN10
NoCabView minimod
Euro Bike Simulator
The Beginner's Guide To SCS Mapping (WIP)
User avatar
RootlessAgrarian
Posts: 383
Joined: 25 Nov 2015 18:43
Location: Cortes Island BC Canada

Re: ConverterPIXWrapper - Import PMG models to Blender with ease [v1.4 - 23. 8. 2017]

#172 Post by RootlessAgrarian » 17 Dec 2017 06:57

@50Keda

OK, I believe I have almost got it.

A few gotchas. I could not figure out the Blender (output) conversion tools for some time because the Conversion Helper panel was incomplete (most of it was missing!). See how it's incomplete, Conversion Helper is just one line with one button? That's scrolled all the way down, btw.

[ external image ]

The reason for the incomplete panel was a missing icon. Blender's error log was throwing errors: the icon "X_VEC" was not found in some list of valid icons (in Blender python scripts drawing the UI) and I had to track this down and substitute one that could be found, such as QUESTION. I don't know enough about adding icons to Blender scripts to know why this was broken or where to fix it. SCS problem I think because it is in their io_scs_tools addon. Anyway, for the record, my copy of BlenderTools 1.9 had this problem with Blender 2.79 -- this took me a while to figure out!

Finally got that fixed and could see the entire conversion helper panel which made a lot more sense! I have previously scs_extracted my entire base.scs and converterPIXed the whole thing into base_exp. I wrote my own script to populate a Blender Project base folder hierarchy with "share" and "material.db" and so on. I then tried importing my favourite truck model, Mercedes Actros 2014. I could import it OK, set up my paths, view only the solid model parts (get rid of the collision boxes using the SCS view buttons) and select and edit meshes. This was encouraging so I decided to put a few dents and dings on my truck just to see if I could mod it. I just pushed some edges and vertices around to make it look crunched:

[ external image ]

I then used the Export and Convert buttons. Export worked on the first try, writing 8x4.pim and so on to the correct location. Convert took a while longer, I had to fix one more problem which was that the SCS Blender Tools expect wineconsole to be installed OSX style in Applications, whereas mine was installed Linux style in /usr/local/bin ... so I had to edit the script scene.py to use the right path. Suggest this should be made configurable from Blender interface.

And now, very exciting, the conversion ran correctly! I saw loads of conversion tools messages in my wineconsole. It took a while -- I think my project base hierarchy has a bit too much stuff in it for just editing the truck body, because I pulled all the mercedes_actros_2014 parts out of the game base. But at last it finished.

I then tried Package Mod and was thrilled to see a mod in the target dir, all zipped and ready to go. I loaded the mod in my 1.28 copy (Steam) of ETS2 and yippee, it was seen as a valid mod and it did load, but Yikes, I did not get what I expected! My truck was not just dented, it was deranged!

[ external image ]

I have no idea what went wrong there. It looks almost like the meshes I altered were simply rejected by the game engine. Or not exported from Blender in the first place. Or...? I selected the entire truck (or I thought so, it was outlined in orange) for export, it did export the 8x4.pim and related files in the right place. I don't know why my modded truck ended up so hopelessly broken, or why it is red instead of the correct paint colour, but maybe someone can help me understand this. So long as this is not an error in the conversion tools I think the pipeline does work for OSX.
Level 42 and rising... i7 8700K -- AMD Radeon 5700XT -- ASUS MAXIMUS XI HERO - WIN10
NoCabView minimod
Euro Bike Simulator
The Beginner's Guide To SCS Mapping (WIP)
User avatar
50keda
SCS Software
Posts: 1699
Joined: 07 Dec 2012 11:59

Re: ConverterPIXWrapper - Import PMG models to Blender with ease [v1.4 - 23. 8. 2017]

#173 Post by 50keda » 17 Dec 2017 09:34

1) Blender 2.79 requires BlenderTools version 1.10. Older version are not compatible with latest Blender for the reason you stated yourself :)

2) Well configurable path for wine is not gonna happen. If wineconsole is registred in /usr/bin folder then it should automatically work. On the otherhand I am now writting what user should do if wineconsole is not properly installed (as said this was rewritten internally and will be released in 1.11) ;)

3) I am suspicus about your mod folder structure as you said that it took long to convert it. Well just for one truck it shouldn't! Enlighten me how did you use converter pix, what you converted and hod did you set scs project base path? Or create a video :P
User avatar
RootlessAgrarian
Posts: 383
Joined: 25 Nov 2015 18:43
Location: Cortes Island BC Canada

Re: ConverterPIXWrapper - Import PMG models to Blender with ease [v1.4 - 23. 8. 2017]

#174 Post by RootlessAgrarian » 17 Dec 2017 21:11

50keda wrote: 17 Dec 2017 09:34 1) Blender 2.79 requires BlenderTools version 1.10. Older version are not compatible with latest Blender for the reason you stated yourself :)
OOPS :oops: I didn't realise BT was out of date already. You know how Steam installs are, they keep updating things automagically so my Blender quietly went from 2.78 to 2.79 without my noticing it. My bad.
2) Well configurable path for wine is not gonna happen. If wineconsole is registred in /usr/bin folder then it should automatically work. On the otherhand I am now writting what user should do if wineconsole is not properly installed (as said this was rewritten internally and will be released in 1.11) ;)
Well a non-contributing user should really never argue with the author(s) so I won't ;) But this is no biggie -- even a n00b like me is quite capable of putting a sym link in /usr/bin or editing the source. What would be even more useful imho would be if any error was not just caught but verbosely reported when the final "command" is executed in the operators/scene.py script. I don't speak python at all and could not get this to work, but there is a variant command exec which I think looks something like this

Code: Select all

outstr = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True)
and this actually captures the output from the command in case it fails. To my ignorant eye it looks like there's an error catch in scene.py but no interest in the output, where 'command' finally gets executed:

Code: Select all

   # try to run conversion tools
            if subprocess.call(command, shell=True) == 0:
                self.report({'INFO'}, "Conversion done!")
            else:
                self.report({'ERROR'}, "Can't run conversion tools or there were errors by converting!" 
and that makes me nervous. I did actually have it failing for a while, and it was quite a struggle to find out why, as the error message is so unhelpful. If I had to choose, I'd much rather have error catch with verbose output on the actual exec of convert.cmd, than the configurable winepath (should I call it whinepath since I'm whining about it?) which is easy for me to work around.
3) I am suspicus about your mod folder structure as you said that it took long to convert it. Well just for one truck it shouldn't! Enlighten me how did you use converter pix, what you converted and hod did you set scs project base path? Or create a video :P
You could not possibly be more suspicious than I am :-) since I still don't quite know what I'm doing here. I'm sure I haven't got it right yet. You have to remember that I have never modded any game, ever, and am completely unfamiliar with the general conventions, let alone the specifics of ETS2. What I did was write a little script (still WIP) in tcl that fishes in the unpacked hierarchies for chunks relevant to a search string, such as "mercedes_actros_2014". It also collects all "share" folders, "material/environment", and other bits that (according to tutorials I saw on YT) seem to be needed at import time for all models. Dunno if you have ever read any Tcl but it is fairly transparent as languages go:

Code: Select all

#!/usr/local/bin/tclsh
#
#
package require Tclx

proc findCopy f {
	global projname
	set cmd "find . -name $f -print"
	echo "CMD $cmd"
	set tlist [split [eval exec $cmd] \n]
	set nres [llength $tlist]
#	 first grab all the simple files
	set cmd "find . -name $f -print | cpio -pdm ../$projname"
# 	then for those which are dirs, copy their contents entire
	foreach t $tlist {
	    puts stderr "     copying bits of target:  $t"
	    if [file isdirectory $t] {
 	    system "find $t -print | cpio -pdm ../$projname"
	    }
	}
	return $nres
}

set targname [lindex $argv 0]
set projname "NEW_$targname"
set game "ets2"

if {[llength $argv] > 2} {
	set game [lindex $argv 1]
}

echo "setting up new project $projname"

if {![file isdirectory $projname]} {
	mkdir $projname
} else {
	puts stderr "Sorry, '$projname' already exists."
	puts stderr "ENTER Y to DELETE EXISTING PROJECT, anything else to exit"
	set ans N
	gets stdin ans
	if {[string toupper $ans] == "Y"} {
		system "/bin/rm -rf $projname"
	} else {
		exit 1
	}
}

# the paths to be followed are so specific that it's hard to generalise
# but vehicles and models have 'share' in their paths and characters seem not to
#
# this gets all the translated (middle format) files created by converterPIX
# this is a wildcard match, all others are precise
puts stderr "IN ${game}base_exp"
cd ${game}base_exp
pwd
set cmd "find . -name $targname\\\* -print"
echo "CMD $cmd"
set tlist [split [eval exec $cmd] \n]
# first grab all the named files
set cmd "find . -name $targname\\\* -print | cpio -pdm ../$projname"
# then for those which are dirs, copy them entire
foreach t $tlist {
    puts stderr "     copying bits of target:  $t"
    if [file isdirectory $t] {
 	system "find $t -print | cpio -pdm ../$projname"
    }
}
#
# now get the generic/shared stuff
# everyone might need environment
puts stderr "COPY ENVIRONMENT"
# set cmd "find . -name environment -print"
set n [findCopy environment]
puts stderr "Copied $n targets"
# system "find . -name environment -print | cpio -pdm ../$projname"
#
if {[string first "character" $targname] >= 0} {
# 	if character model you need their textures
	puts stderr "COPY CHARACTER TEXTURES"
	system "find ./model/mover/characters/textures -print | cpio -pdm ../$projname"
} else {
#	if vehicle model you need share
	puts stderr "COPY all SHARE folders"
	findCopy share
#	system "find . -name share -print | cpio -pdm ../$projname"
}
# #
#
# this gets the files from the original tree which converterPIX has not copied
#
cd ../${game}base
puts stderr "IN ${game}base"
pwd

puts stderr "COPY ORIGINAL material.db and hookup"
#
system "find . -name material.db -print | cpio -pdm ../$projname"
# findCopy material.db

if {[string first character $targname] < 0} {
	findCopy hookup
#	system "find . -name 'hookup' -print | cpio -pdm ../$projname"
}
cd ..
So my script pulled in not only the mercedes_actros_2014 vehicle/truck files but also every accessory for the truck. I have no idea (yet) how to discover the dependency tree for a model, i.e. the list of only files it actually needs for a successful import into Blender, so I just grabbed everything that seemed relevant. When (on a second try at the model edit) I deleted the irrelevant bits from my project base hierarchy -- like all those accessories -- the conversion was indeed faster. But I was still converting tons of texture and material stuff that I probably didn't need.

Here is what I did (workflow):

0) prepared an empty Blender file with appropriate lighting and camera
1) unpacked the base.scs and def.scs from my 1.28 ETS2 using scs extract, I believe I did this in my VB Windows environment. took a while but I only have to do it once. I now have a def and a base folder, the base folder very deep and large.
2) moved these folders into my OSX workspace
3) ran converterPIX (OSX version) on the base folder, so after a few busy minutes I ended up with a base_exp folder hierarchy containing the files converted to open (middle) format; not tackling animations yet so only have to do this once
4) used my own "fishing" script (above) to reach into both base and base_exp to pull out everything that seemed relevant to mercedes_actros_2014 and put it into a project base dir which I called NEW_mercedes_actros_2014
5) configured this folder in BT to be my Project Base Folder.
6) set all the other file paths in BT (did not bother with road sign and other .sii because I just wanted the truck) so that they all stopped being pink and were a neutral gray
7) used Import SCS (pim) option from the Blender File/Import menu to import 8x4.pim from my Project Base Folder

[ I found that truck.pim was weird -- it seemed to have all possible wheel configurations all in one model, very confusing visually -- but 8x4.pim seemed to be just the basic truck as I know it.]

8) got the import I expected, a big chocolate brown collision box
9) used the SCS view shortcut buttons to select the "cube" option (see only the solid model, not the collision or other aspects).
10) The solid view truck looked fine, and when I turned on Material view, I saw a red shiny truck (vehicle-paint texture and default paint colour). This looked like what other people show in tutorial videos so I guess it must be right. I could change the default paint colour using the BT panel.

11) I then used stock Blender UI to select a chunk of the truck, go into mesh edit mode, and start pushing vertices and edges around to make crude dents. I didn't care if they looked good, just wanted to change the truck in a way I would notice when I loaded the mod.

12) having made my ugly dents I saved the Blender file and kept working:
13) used the big Export button to export the model and verified externally that the new .pim etc was saved to the correct location in the Project Base hierarchy
14) used the Convert button to convert it. The wineconsole popped up and babbled at me for a while. I checked rsrc dir and saw that there was output, links etc.
15) I had already set up the path for mod folder in BT (created an empty dir for it) and given it a name. So I pushed the Package Mod button and yes, content was put into my Mod Folder and zipped.

16) I renamed the zipfile to .scs instead of .zip and put it in ETS2 mod folder and started the game
17) loaded the mod (no errors), resumed play and I saw the weirdly destroyed truck which you see in the photos above.

That's my story and I'm stickin' to it :-) Embarrassed to admit I don't actually know how to make a movie of my screen (hey, Im a dinosaur, I spent most of my life on the command line and in vim) but I can look it up and try to video the whole process from step 4 on if that would help explain why the chunks of truck I edit are now missing or invisible...
Level 42 and rising... i7 8700K -- AMD Radeon 5700XT -- ASUS MAXIMUS XI HERO - WIN10
NoCabView minimod
Euro Bike Simulator
The Beginner's Guide To SCS Mapping (WIP)
User avatar
RootlessAgrarian
Posts: 383
Joined: 25 Nov 2015 18:43
Location: Cortes Island BC Canada

Re: ConverterPIXWrapper - Import PMG models to Blender with ease [v1.4 - 23. 8. 2017]

#175 Post by RootlessAgrarian » 21 Dec 2017 23:57

I can now confirm that all these tools seem to work fine in the Windows 10 environment with ETS2 1.30 -- conversion suite, BT, and c'pix wrapper. Having experienced this streamlined, automated workflow I don't feel like going back to the complex manual procedure outlined above!

I may return at some point to the effort to make all this work for OSX, but for right now I'm just trying to learn how it is supposed to work in Win-land. I do have one major problem right now which is that even though the tools and workflow seem to be working perfectly, when I load my mod into 1.30 ETS2 in Win-land, the game CTD. I've posted this issue separately.
Level 42 and rising... i7 8700K -- AMD Radeon 5700XT -- ASUS MAXIMUS XI HERO - WIN10
NoCabView minimod
Euro Bike Simulator
The Beginner's Guide To SCS Mapping (WIP)
User avatar
50keda
SCS Software
Posts: 1699
Joined: 07 Dec 2012 11:59

Re: ConverterPIXWrapper - Import PMG models to Blender with ease [v1.5 - 16. 1. 2018]

#176 Post by 50keda » 16 Jan 2018 13:12

New version 1.5 was just released!

Changelog and everything else can be found on github. So go ahead and try it out: https://github.com/simon50keda/Converte ... ses/latest

Enjoy!
User avatar
AlexeyP
Posts: 441
Joined: 06 May 2015 12:35
Location: Saint-Petersburg, Russia

Re: ConverterPIXWrapper - Import PMG models to Blender with ease [v1.5 - 16. 1. 2018]

#177 Post by AlexeyP » 16 Jan 2018 14:01

Thanks for the plugin update, 50keda!
Retired modder
User avatar
daniminho
Posts: 623
Joined: 15 Oct 2015 12:58
Location: Portugal

Re: ConverterPIXWrapper - Import PMG models to Blender with ease [v1.5 - 16. 1. 2018]

#178 Post by daniminho » 16 Jan 2018 23:18

Need some help.. I imported a trailer (that I've already imported & exported previously) in blender and it exports and converts correctly without any problem. But when I go to the game it crashes in the loading screen.. The error it's this one:

Code: Select all

00:01:09.030 : <ERROR> [material] 'syntax error' at line 6 in file '/automat/eb/ebf792db455f1161.mat'.
00:01:09.030 : <ERROR> [material] Error parsing material file '/automat/eb/ebf792db455f1161.mat'.
00:01:09.288 : <ERROR> [material] 'syntax error' at line 6 in file '/automat/eb/ebf792db455f1161.mat'.
00:01:09.288 : <ERROR> [material] Error parsing material file '/automat/eb/ebf792db455f1161.mat'.
User avatar
MDModder
Posts: 350
Joined: 06 Nov 2015 07:00

Re: ConverterPIXWrapper - Import PMG models to Blender with ease [v1.5 - 16. 1. 2018]

#179 Post by MDModder » 17 Jan 2018 10:55

It would be possible to add the ability to convert several .pmg in one shot
User avatar
salessio2
Posts: 1187
Joined: 26 May 2015 23:24
Location: Italy
Contact:

Re: ConverterPIXWrapper - Import PMG models to Blender with ease [v1.5 - 16. 1. 2018]

#180 Post by salessio2 » 17 Jan 2018 16:01

Hi all, I've got this error when I try toload my longline interior, does anybody know how to fix it?

[ external image ]
Post Reply

Return to “General discussion”

Who is online

Users browsing this forum: No registered users and 6 guests