# # Inject Overlay # # Creates an overlay material for the SkinHip zone on V4 # import poser import os # Path setup AppPath = os.path.dirname(poser.AppLocation()) MaskFilePath = os.path.join(AppPath,'Runtime' + os.sep + 'Python' + os.sep +'poserScripts' + os.sep + 'ScriptsMenu' + os.sep +'SkinVue' + os.sep +'V4Huntress' + os.sep + 'ThongMask.jpg') OverlayFilePath = os.path.join(AppPath,'Runtime' + os.sep + 'Python' + os.sep +'poserScripts' + os.sep + 'ScriptsMenu' + os.sep +'SkinVue' + os.sep +'V4Huntress' + os.sep + 'Overlay.jpg') def CreateOverlay(): # Create a new node for the blender blendernode = curMat.ShaderTree().CreateNode(poser.kNodeTypeCodeBLENDER) blendernode.InputByInternalName("Blending").SetFloat(1.0) blendernode.SetLocation(400,10) blendernode.SetInputsCollapsed(1) # Create a new Node for the Overlay Texture overlaynode = curMat.ShaderTree().CreateNode(poser.kNodeTypeCodeIMAGEMAP) overlaynode.InputByInternalName("Image_Source").SetString(OverlayFilePath) overlaynode.SetName("Overlay") overlaynode.SetLocation(400,40) overlaynode.SetInputsCollapsed(1) # Create a new node for the Mask map masknode = curMat.ShaderTree().CreateNode(poser.kNodeTypeCodeIMAGEMAP) masknode.InputByInternalName("Image_Source").SetString(MaskFilePath) masknode.SetName("Mask") masknode.SetLocation(400,70) masknode.SetInputsCollapsed(1) # Get the current node that's plugged into the diffuse color input on the posersurface tree oldnode = curMat.ShaderTree().NodeByInternalName("PoserSurface").InputByInternalName("Diffuse_Color").InNode() # Connect the old node to Input_1 on the new blender node oldnode.ConnectToInput(blendernode.InputByInternalName("Input_1")) ## Connect the overlay material to Input_2 on the new blender node overlaynode.ConnectToInput(blendernode.InputByInternalName("Input_2")) # Connect the mask node to the Blending input of the new blender node masknode.ConnectToInput(blendernode.InputByInternalName("Blending")) # Wire the blender node to the Diffuse_Color input of the PoserSurface node blendernode.ConnectToInput(curMat.ShaderTree().NodeByInternalName("PoserSurface").InputByInternalName("Diffuse_Color")) curMat.ShaderTree().UpdatePreview() def ShowMessage(message): poser.DialogSimple.MessageBox(message) ### Start program #### # Get Current Actor curAct = poser.Scene().CurrentActor() try: # Get the V4 SkinHip material MatZones = ("2_SkinHip") # add to this any additional mat zones if necessary for thisMatZone in MatZones: curMat = curAct.Material(thisMatZone) CreateOverlay() ShowMessage("Finished") except: ShowMessage("Error: Invalid Figure Selected\n" + thisMatZone + " Material Not Found") #end of script