Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
  • Loading branch information
eglaubauf committed Jun 1, 2020
2 parents a2c57e0 + 9d63a6a commit 6ce3ce5
Show file tree
Hide file tree
Showing 7 changed files with 201 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,5 @@ dmypy.json

.vscode/settings.json
.code-workspace
python2.7libs/materialConvert_RS/eg_convert.py
python2.7libs/materialConvert_RS/.vscode/settings.json
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ A collection of scripts for Redshift in SideFx Houdini

- easy Usage via Right-Click Menus and provided shelf
- easy Install via Packages Workflow - see more below
<<<<<<< HEAD
- Tested on Houdini 18.0.416 & Redshift 3.0.18
- should be compatible with 17.5 as well, but untested by myself.
- Tested on Windows 10 and Linux (Ubuntu 20.04)
=======
- Tested on Houdini 18.0.460 & Redshift 3.0.21
- Tested on Windows 10
>>>>>>> dev
### Installation:

Expand Down
Binary file modified otls/eg_MacBethRedshift.hdalc
Binary file not shown.
3 changes: 3 additions & 0 deletions python2.7libs/materialBuild_RS/eg_RSMat.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ def get_material_builder(self):
"""Returns the MaterialBuilder"""
return self.material_builder

def get_rsMat(self):
return self.rs_mat

def get_path(self):
"""Returns the Path to the MaterialBuilder"""
return self.material_builder.path()
Expand Down
Empty file.
190 changes: 190 additions & 0 deletions python2.7libs/materialConvert_RS/controller.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
#####################################
# LICENSE #
#####################################
#
# Copyright (C) 2020 Elmar Glaubauf
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

import hou

from PySide2 import QtWidgets, QtCore

import materialBuild_RS.core as core
import materialBuild_RS.view as view

# Where is this script?
# SCRIPT_LOC = os.path.split(__file__)[0]

reload(core)
reload(view)

'''
Open with
import materialBuild_RS.controller as matBuildRS
reload(matBuildRS)
matBuildRS.open()
'''

develop = False
tmpWindow = None


def open(develop=False):

if develop:
reload(core)
reload(view)
try:
tmpWindow.close()
except:
pass

tmpWindow = Controller()
tmpWindow.show()


class Controller(QtWidgets.QDialog, view.Ui_RSMatBuilder):

def __init__(self, parent=hou.qt.mainWindow()):
super(Controller, self).__init__(parent)

self.setupUi(self)
self.configure_uistates()

# Set Houdini Style to Window
self.setProperty("houdiniStyle", True)
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
self.core = core.Core()
self.create_connections()

# linking Buttons to Functions
def create_connections(self):

self.cbx_applyMat.toggled.connect(self.set_apply_mat)
self.cbx_context.toggled.connect(self.set_context)
self.cbx_convert.toggled.connect(self.set_convert)
self.cbx_setupOGL.toggled.connect(self.set_ogl)
self.cbx_useTex.toggled.connect(self.use_tex)

self.cbx_heightDisp.toggled.connect(self.set_height_displace)
self.cbx_ccDiffuse.toggled.connect(self.set_cc_diffuse)
self.cbx_diffLinear.toggled.connect(self.set_diff_linear)
self.fld_username.textChanged.connect(self.set_name)

self.buttonBox.rejected.connect(self.destroy)
self.buttonBox.accepted.connect(self.execute)

def configure_uistates(self):
self.cbx_convert.setDisabled(True)
self.cbx_heightDisp.setDisabled(True)
self.cbx_ccDiffuse.setDisabled(True)
self.cbx_diffLinear .setDisabled(True)


def set_apply_mat(self):
if self.cbx_applyMat.isChecked():
self.core.set_apply_mat(True)
else:
self.core.set_apply_mat(False)

def set_context(self):
if self.cbx_context.isChecked():
self.core.set_context(True)
else:
self.core.set_context(False)

def set_ogl(self):
if self.cbx_setupOGL.isChecked():
self.core.set_ogl(True)
else:
self.core.set_ogl(False)

def set_name(self):
self.core.set_name(self.fld_username.text())

def use_tex(self):
if not self.cbx_useTex.isChecked():
# Disable Texture Options
self.cbx_convert.setDisabled(True)
self.cbx_convert.setChecked(False)
self.set_convert()

self.cbx_heightDisp.setDisabled(True)
self.cbx_heightDisp.setChecked(False)
self.set_height_displace()

self.cbx_ccDiffuse.setDisabled(True)
self.cbx_ccDiffuse.setChecked(False)
self.set_cc_diffuse()

self.cbx_diffLinear.setDisabled(True)
self.cbx_diffLinear.setChecked(False)
self.set_diff_linear()

else:
self.cbx_convert.setDisabled(False)
self.cbx_heightDisp.setDisabled(False)
self.cbx_ccDiffuse.setDisabled(False)
self.cbx_diffLinear.setDisabled(False)


self.core.set_use_tex(self.cbx_useTex.isChecked())

def set_convert(self):
if self.cbx_convert.isChecked():
self.core.set_convert(True)
else:
self.core.set_convert(False)

def set_height_displace(self):
if self.cbx_heightDisp.isChecked():
self.core.set_height_displace(True)
else:
self.core.set_height_displace(False)

def set_cc_diffuse(self):
if self.cbx_ccDiffuse.isChecked():
self.core.set_cc_diffuse(True)
else:
self.core.set_cc_diffuse(False)

def set_diff_linear(self):
if self.cbx_diffLinear.isChecked():
self.core.set_diff_linear(True)
else:
self.core.set_diff_linear(False)

def apply_user_settings(self):
# Choose Textures
if self.core.get_use_tex():
f = hou.ui.selectFile(title="Please choose Files to create a Material from", collapse_sequences=False, image_chooser=False, multiple_select=True, file_type=hou.fileType.Image)
self.core.set_files(f)

# Convert Textures
if self.core.get_convert():
self.core.convert_tex()

# Execute Material Creation
def execute(self):
self.apply_user_settings()
self.core.create_material()
self.destroy()
1 change: 1 addition & 0 deletions toolbar/egRedshiftTools.shelf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<memberTool name="setup OGL"/>
<memberTool name="convert OCIO"/>
<memberTool name="clear OGL"/>
<memberTool name="Convert Mantra (Alpha)"/>
</toolshelf>

<tool name="RS MaterialBuild" label="RSMaterialBuild" icon="$EGRS_ICONS/redshift.png">
Expand Down

0 comments on commit 6ce3ce5

Please sign in to comment.