Skip to content

Commit

Permalink
add "from version" in light import tool
Browse files Browse the repository at this point in the history
  • Loading branch information
CX-kkk committed May 9, 2018
1 parent 33231a2 commit 0fb91c5
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 10 deletions.
2 changes: 1 addition & 1 deletion core/assign_shader.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
import maya.cmds as cmds
import pymel.core as pm
import core.import_shading_group as isg
import import_shading_group as isg


def check_engine(engine, namespace=''):
Expand Down
12 changes: 12 additions & 0 deletions core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,15 @@ def get_all_published_versions(file_path, task=None):
return version_list


def get_certain_version(file_path, version, task):
"""
:param str file_path:
:param str version: eg:001
:return:
"""
naming = NamingAPI.parser(file_path)
naming.version = version
naming.task = task
match_path = naming.get_publish_full_path()
return match_path
21 changes: 13 additions & 8 deletions gui/main_win.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,19 @@ def __init__(self, parent=None):
_loadUi(ui_file, self)

self.setWindowTitle('test Tool')
self.current_file_path = core.get_current_scene_file()
self.switch_bool = self.get_radio_button_options(self.QFrame_opt) == 'from_version'
self.init_ui()
self.init_layout()
self.init_connectiond()
test_path = 'X:/pipelinernd_rnd-0000/zzz_dev/test_shot/3d/anim/_publish/v005'
self.lineEdit_path.setText(test_path)
# test_path = 'X:/pipelinernd_rnd-0000/zzz_dev/test_shot/3d/anim/_publish/v005'
# self.lineEdit_path.setText(test_path)

def init_ui(self):
current_file_path = core.get_current_scene_file()
all_versions = utils.get_all_published_versions(current_file_path, 'anim')
self.set_version_combobox()

def set_version_combobox(self):
all_versions = utils.get_all_published_versions(self.current_file_path, 'anim')
self.comboBox_version.clear()
self.comboBox_version.addItems(all_versions)

Expand Down Expand Up @@ -82,10 +85,12 @@ def get_abc(self, full_path):

def get_abc_from_version(self):
version = self.get_combobox_options(self.comboBox_version)
# full_path = os.path.join('/sw/...', version)
# if os.path.exists(full_path):
# self.get_abc(full_path)
print version
file_path = utils.get_certain_version(self.current_file_path, version, 'anim')
full_path = os.path.dirname(file_path)
# self.lineEdit_path.setText(full_path)
if os.path.exists(full_path):
self.get_abc(full_path)
print 'Get abc cache from: ',full_path

def get_abc_from_path(self):
full_path = self.get_line_edit_options(self.lineEdit_path)
Expand Down
11 changes: 10 additions & 1 deletion gui/win.ui
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
<property name="text">
<string>Load from version</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
Expand All @@ -39,7 +42,7 @@
<string>Load from path</string>
</property>
<property name="checked">
<bool>true</bool>
<bool>false</bool>
</property>
</widget>
</item>
Expand All @@ -61,6 +64,9 @@
</item>
<item>
<widget class="QWidget" name="QWidget_from_version" native="true">
<property name="enabled">
<bool>true</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>1</number>
Expand Down Expand Up @@ -99,6 +105,9 @@
</item>
<item>
<widget class="QWidget" name="QWidget_from_path" native="true">
<property name="enabled">
<bool>false</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="leftMargin">
<number>1</number>
Expand Down

0 comments on commit 0fb91c5

Please sign in to comment.