Forum: Blender


Subject: Blender Python Shader (Cycles) Automation

RobynsVeil opened this issue on Oct 18, 2015 · 32 posts


RobynsVeil posted Sun, 01 November 2015 at 2:15 PM

Not sure where to post this question, really, but as it does involve the end user's experience and since you and Poser users are my target users for this script, I guess I'll ask here.

At this point, there are two sections in the script that need to be edited, line 47:

sys.path.append("/home/robyn/Documents/Blender/Projects/AllScripts")

... a hard-coded path statement that lets the script (this one, currently 'Shaders032.py) know where to find the figureDefs.py dictionary file: information, I'm sure, I can obtain with code...

... and this mess, starting on line 291:

    figurObj = 'V4'   # also used to identify fig in figureDefs.py
    textPath = '/home/robyn/Documents/Blender/Projects/AllTextures/AllSkin/V4/'

    clrALimb = 'Syri_Limbs.jpg'
    clrLLimb = 'Syri_Limbs.jpg'
    bmpALimb = 'Syri_LimbsB.jpg'
    bmpLLimb = 'Syri_LimbsB.jpg'
    spcALimb = None
    spclLimb = None
    clr_Body = 'Syri_Torso.jpg'
    bmp_Body = 'Syri_TorsoB.jpg'
    spc_Body = None
    clr_Face = 'Syri_Face.jpg'
    bmp_Face = 'Syri_FaceB.jpg'
    spc_Face = None
    clr_Eyes = 'EyesMochachino.jpg'
    clrMouth = 'Syri_Teeth.jpg'
    clr_Lash = 'BaseLashes05.png'

Which the first is no biggie, finding a solution for the second has been a bit of a quandary.

Clearly, it has to come out of the script. That's key. I've toyed with config files that live with the other two scripts, but then those will need to be somehow swapped out when a new figure with a different set of colour, bump and spec maps (images) gets loaded. I guess what would be easiest - for me - is to set up a 'dictionary' file that gets written to - and lives with - the texture/colour image files. Basically, the 'dictionary would look like this:

dictMaps = {
    'clrALimb': 'Syri_Limbs.jpg',
    'clrLLimb': 'Syri_Limbs.jpg',
    'bmpALimb': 'Syri_LimbsB.jpg',
    'bmpLLimb': 'Syri_LimbsB.jpg',
    'spcALimb': None,
    'spclLimb': None,
    'clr_Body': 'Syri_Torso.jpg',
    'bmp_Body': 'Syri_TorsoB.jpg',
    'spc_Body': None,
    'clr_Face': 'Syri_Face.jpg',
    'bmp_Face': 'Syri_FaceB.jpg',
    'spc_Face': None,
    'clr_Eyes':  'EyesMochachino.jpg',
    'clrMouth': 'Syri_Teeth.jpg',
    'clr_Lash': 'BaseLashes05.png',
}

The figurObj value could be assigned by a dropdown in a panel app (needs to be one referenced in the figureDef.py dictionary, like 'V4' or 'Dawn') and textPath I would get from the user navigating to where the images and this 'dictionary' in a imageList.py.

Does all that seem too hard? 😅

Monterey/Mint21.x/Win10 - Blender3.x - PP11.3(cm) - Musescore3.6.2

Wir sind gewohnt, daß die Menschen verhöhnen was sie nicht verstehen
[it is clear that humans have contempt for that which they do not understand] 

Metaphor of Chooks