Tuesday, December 25, 2012

Syntax Highlighter whitespace bug

I used to use Alex Gorbatchev Syntax Highlighter to make python code looks nice. But due to bug in copy function (empty strings are replaced with "ANDnbsp" and so becomes corrupted), i had to switch to another static converter. If anybody know how to fix syntax highlighter please let me know. Currently i use http://hilite.me

Sunday, December 23, 2012

Maya PyQt UI template

Use the following code to show PyQt *.ui in Autodesk maya. It will load all stuff located in ui file and create window attached to maya-window. Copy this code to maya script editor, replace string uifile = 'c:/test.ui' with real path to your ui-file (use forward slash even on windows). Now execute this code, and you will get your UI-window in maya. 

 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
import maya.OpenMayaUI as apiUI
from PyQt4 import QtCore, uic
import sip


uifile = 'c:/test.ui'
form, base = uic.loadUiType(uifile)


def getMayaWindow():
    """
    Get the main Maya window as a QtGui.QMainWindow instance
    @return: QtGui.QMainWindow instance of the top level Maya windows
    """
    ptr = apiUI.MQtUtil.mainWindow()
    if ptr is not None:
        return sip.wrapinstance(long(ptr), QtCore.QObject)


class testQtWindow(form, base):
    def __init__(self, parent = getMayaWindow()):
        super(testQtWindow,self).__init__(parent)
        self.setupUi(self)



def main():
    global win
    try:
        win.close()
    except:
        pass
    win = testQtWindow()
    win.show()


if __name__=="__main__":
    main()

Friday, December 21, 2012

Man head sculpt. Anatomy practice.

Started as quicksculpt, but later decided to spend more time on it.

PyQt application template

This is template for PyQt application. It's good point to start studying PyQt.
  • create ui-file in QtDesigner
  • save it to disk
  • replace 'c:/test.ui' with real path to created ui
  • execute py-file. Make sure to run it with pythonw, not with python. In this case, command window will not pop up (on windows system).
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from PyQt4 import QtGui, uic
import sys

# replace 'c:/test.ui' with real path to ui-file created in QtDesigner
uifile = 'c:/test.ui'
form, base = uic.loadUiType(uifile)


class testQtWindow(QtGui.QMainWindow):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = form()
        self.ui.setupUi(self)


def main():
    app = QtGui.QApplication(sys.argv)
    myapp = testQtWindow()
    myapp.show()
    sys.exit(app.exec_())


if __name__=="__main__":
    main()

Wednesday, December 19, 2012

Split face between selected vertices in MAYA

This MEL-script splits face between selected vertices. Both vertices should belong to one face. New adge will be constructed between selected verts.
Usage:
     - copy script to you scripts directory
     - source it in MAYA (or reboot maya)
     - select to vertices on mesh
     - run command isplitByVertex or place it on shelf
Download script

Monday, December 17, 2012

Switch wireframe on shaded.

One more small script. Now to use shelf button to switch wireframe on shaded mode. Instead of Shading->Wireframe on shaded menu.
Usage:
- make new shelf button with script text (python command)
- press "5" to turn shaded view in current MAYA viewport
- press created shelf button
It turns on and off wireframe on objects in current viewport.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
'''
@author: Serge Scherbakov
Date: 25.07.2012
'''
import maya.cmds as cmds
 
def wireframeSwitcher():
    viewport = cmds.getPanel( withFocus = True)
    if 'modelPanel' in viewport:
        currentState = cmds.modelEditor( viewport, q = True, wireframeOnShaded = True)
        if currentState:
            cmds.modelEditor( viewport, edit = True, wireframeOnShaded = False)
        else:
            cmds.modelEditor( viewport, edit = True, wireframeOnShaded = True)
             
wireframeSwitcher()

Align pivots in Maya

This script allows you to copy object pivot translation and rotation from one object to another one. How to use:
 - copy code to the script editor "Python tab"
 - select source object
 - select target object
 - execute script
Works on multiple selection. Align all object pivots with last selected.

 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
'''
Align pivots by Serge Scherbakov.
Usage:
1. Select source object(s)
2. Add to selection target object
3. Run script by 'import copyPivot\n copyPivot.copyPivot()
'''
 
import maya.cmds as cmds
import maya.mel as mel
 
def copyPivot ():
    sourceObj = cmds.ls(sl = True)[len(cmds.ls(sl = True))-1]
    targetObj = cmds.ls(sl = True)[0:(len(cmds.ls(sl = True))-1)]
    parentList = []
    for obj in targetObj:
        if cmds.listRelatives( obj, parent = True):
            parentList.append(cmds.listRelatives( obj, parent = True)[0])
        else:
            parentList.append('')
    if len(cmds.ls(sl = True))<2:
        cmds.error('select 2 or more objects.')
    pivotTranslate = cmds.xform (sourceObj, q = True, ws = True, rotatePivot = True)
    cmds.parent(targetObj, sourceObj)
    cmds.makeIdentity(targetObj, a = True, t = True, r = True, s = True)
    cmds.xform (targetObj, ws = True, pivots = pivotTranslate)
    for ind in range(len(targetObj)):
        if parentList[ind] != '' : 
            cmds.parent(targetObj[ind], parentList[ind])
        else:
            cmds.parent(targetObj[ind], world = True)
     
 
copyPivot()

Extract poly component index in 1 string.

To extract index of maya polycomponent (face, edge or vertex) you can use the following expression. Python power is awesome.
edgeIndex = str(edge).split('[')[1].split(']')[0]

Monday, April 2, 2012

Monday, March 19, 2012

Wednesday, March 14, 2012

Goblin rogue WIP

I would like to share with you some shots from my current project. It's goblin rogue model with Tier5 armor.
The first image is Blizzard art which i use as reference.



Body base shape:

Head with test polypaint:

Another view of head:

World of Warcraft rifle (final)

Final model with poly paint. Zbrush BPR render.
Hope you like it. Any comments are welcome.


Sunday, March 11, 2012

Monday, March 5, 2012

Thursday, February 2, 2012

Thursday, January 26, 2012

Dagger (world of warcraft)

Hello. This is dagger model, from World of Warcraft. It's not finished yet, need to add details in Zbrush. But anyway want to share this image with you.


Monday, January 23, 2012

Finished model - Sword (world of warcraft)

I liked sketch of this sword, and i decided to create the model. One more model (dagger) is in progress.


Friday, January 20, 2012

One more sculpt.

One more sculpt i did some month ago.


quick sketch 29.12.2011

Hello! Here is quick sketch i did before new year in spare time. Just for practice and fun.
Started from sphere, later converted to dynamesh. Ear is standart from ear insert brush. :)


Tuesday, January 17, 2012

Wolrd Of Warcraft sword model. WIP.

My tribute to Blizzard. I saw sketch of this sword and i like it very match. In the same time working on dagger model from world of warcraft. WIP images will show soon.

It's not finished yet. Some elements is not ready, and i want to improve scratches and other small details, but overall it's about completed.


Hello world!

Hi all!
In this blog i will share my 3D stuff. It will be sketchbook of my works, created in  Zbrush, MAYA and other tools.
Thanks for your visit, and hope to see you again.