Feature request: add getProxyFile() to two classes

Tech support and suggestions forum. If you only have a basic question on how to get started, please use the "newbies" forum in the community section.

Moderator: joepal

Feature request: add getProxyFile() to two classes

Postby blindsaypatten » Fri Oct 12, 2018 1:13 pm

Edit: nevermind, I can get what I need using the obj_file property on the proxy object.

I would like to write some extensions to mhx2 that will allow more of the asset work done in Blender to make the round trip from Blender to MakeHuman and back to Blender. For example, having more than one material per object.

The way I've been working on doing this is to add additional files in the directory the .mhclo file is in. Originally I thought I would add some values into the .mhclo file itself, but I got hopelessly bogged down in getting things preserved and accessible between import and export. Instead I am looking at just adding files to the directory and having the exporter access those files in order to include information in the exported .mhx2 files. For example, to add additional materials I created a .mham file that includes the additional material definitions together with the faces that they apply to. The addition material definitions are simply added to the list of materials in the exported .mhx2 file, and the face list is added to the geometry information. For example setting the material for the cornea so that it will be shaded with the Glass shader:
Code: Select all
            "material" : "Test16:High_poly2:Neweyes:high_poly:eye_brownmaterial",
            "auxmaterials" : [
                {
                    "material" : "Test16:High_poly2:Neweyes:high_poly:High_poly2glass",
                    "faces" : [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434]
                }
            ],

The mhx2 importer in Blender then creates the additional material and assigns it to the listed faces.

Clearly, these additional materials won't be reflected in MakeHuman, for now anyway, so the onus is on the asset author to have the primary material look presentable without the auxiliary materials.

All I need to make this work is two tiny mods to two files so that the exporter can access the filename of the .mhclo file.

In the Proxy class in shared/proxy.py
Code: Select all
    def getProxyFile(self):
        return self.file


In the Object class in core/guicommon.py add:
Code: Select all
    def getProxyFile(self):
        return self.proxy.getProxyFile() if self.proxy else None
blindsaypatten
 
Posts: 586
Joined: Tue Mar 14, 2017 11:16 pm

Return to Bugs, problems and feature requests

Who is online

Users browsing this forum: No registered users and 1 guest