tag:blogger.com,1999:blog-71837449881488264122024-02-06T21:36:05.607-08:00Tech and Art of Serge ScherbakovMy personal works in Tech Art.Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.comBlogger35125tag:blogger.com,1999:blog-7183744988148826412.post-38106481409070661452015-09-01T13:25:00.000-07:002015-09-03T23:27:12.920-07:00Maya script for snapping vertices and aligning normals.Hey everybody,<br />
<br />
I would like to share with you a script for removing a seam between meshes. It closes gaps between meshes and aligns normals to make seam invisible. We use it in <a href="http://sf.my.com/" target="_blank">"Skyforge"</a> for hiding a seam between the neck and the head of a character.<br />
<br />
<br />
<a name='more'></a>How it works:<br />
<ul>
<li>Select vertices or edges on the first mesh and press "<b>Ref</b>" button. Script will store your selection as a "reference group".</li>
<li>Select vertices or edges on the second mesh</li>
<li>Now if you press "<b>Snap</b>" button each vertex in the selection will be snapped to the nearest in the reference group</li>
<li>If you press "<b>AR</b>" button (Align with Reference), normal in the each vertex of selection will be aligned with the normal in the nearest reference vertex.</li>
<li>If you press "<b>AA</b>" button (Align with Average), normal in the each vertex will be set to average of current normal and normal of the nearest reference vertex.</li>
</ul>
<div>
Look at the video to see how it works.</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/_nvqA_jFENM?feature=player_embedded" width="560"></iframe>
</div>
<div>
<br />
<br />
<a href="https://drive.google.com/file/d/0B50XXbgVH7cKWU5yS1dTd3N1UTA/view?usp=sharing" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" height="62" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiiPsG6NBcPaQgTtEHuq4LOnkbkfkyyM1CdVnVEMfmhBPREMyJb93unxsmYDQ6yAmp8TGegBPnPR6ek2N_cSj67mBVHRK2gLNKJFhuoyMXBoccozl3ByvW1Y7VfkXsh72vNj6QLCK2xXRw/s200/download_code.jpg" width="200" /></a>
<br />
<br />
Feel free to ask, if you have any question.<br />
<br /></div>
Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.com1tag:blogger.com,1999:blog-7183744988148826412.post-50122366253116999462014-04-23T22:43:00.000-07:002014-04-23T22:44:38.145-07:00Project "SKYFORGE" AnnouncementHi, All<br />
Just want to share with you exciting news. The project, that I'm currently working on, recently has been announced.
Take a look at the trailer.<br />
<br />
<iframe allowfullscreen="" frameborder="0" height="315" src="//www.youtube.com/embed/0_eV6RhtRr0" width="560"></iframe>Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.com0tag:blogger.com,1999:blog-7183744988148826412.post-13900771573039302992013-12-02T13:30:00.001-08:002013-12-02T14:05:04.574-08:00Voxels part 2. MAYA .NET API and MFnMesh::allIntersections. <div dir="ltr" style="text-align: left;" trbidi="on">
In <a href="http://www.serge-scherbakov.com/2013/11/creating-voxels-in-maya-or-how-to-work.html">part one</a> we created a simple script, which generates voxels for a selected mesh object using<br />
MFnMesh::allIntersections function. In this part we are going to write a VoxelGenerator node using Maya .NET API. Why node? Because we want to update our voxel on mesh changes. Actually I believe this node can be created using Maya python API, but i did it using C# in order to learn it, and check how usefull it is.<br />
<br />
Let's define node attributes. Number and position of voxels depend on a grid density and a base object position in 3D space. So the input attributes should be: input - (short) "density", (kMesh) "inputGeometry", and output - (int) "voxelsNumber".<br />
<br />
I use Microsoft Visual Studio 2013 and Autodesk Maya 2014. For easy start download and install Maya C# Wizards for Visual Studio. You can find it in <a href="http://around-the-corner.typepad.com/adn/2013/06/new-maya-ccpython-plug-in-wizards.html" target="_blank">Cyrille Fauvel blog</a>. After the installation create a new maya plugin in the Visual Studio and let's begin!<br />
<div align="center">
<br />
<iframe horizontalAlign = "center" allowfullscreen="" frameborder="0" height="480" src="//www.youtube.com/embed/2IzWz_FoXZE" width="640">Demo</iframe>
<br />
</div>
<a name='more'></a>
Maya Plugin Wizard creates files myNode.cs and myPlugin.cs.
We don't need to change anything in the file myPlugin.cs, so I cut out all comments to make it much shorter.
<br />
<br />
<b>myPlugin.cs</b>
<pre class="brush: csharp">
using Autodesk.Maya.OpenMaya;
// This line is not mandatory, but improves loading performances
[assembly: ExtensionPlugin(typeof(voxelGenerator.MyPlugin))]
namespace voxelGenerator
{
public class MyPlugin : IExtensionPlugin
{
public bool InitializePlugin()
{
return true;
}
public bool UninitializePlugin()
{
return true;
}
public string GetMayaDotNetSdkBuildVersion()
{
return "";
}
}
}
</pre>
File myNode.cs contains a primary node class. It defines node name, input and output attributes and compute() method. All magic is born in this file.
I added my comments to make it more comprehensible.
<br />
<br />
<b>myNode.cs</b>
<pre class="brush: csharp">
using System.Diagnostics;
using Autodesk.Maya.OpenMaya;
using voxelGenerator;
[assembly: MPxNodeClass(typeof(MayaNetPlugin.VoxelGenerator), "VoxelGenerator",
0x00010111)]
namespace MayaNetPlugin
{
// This class is instantiated by Maya for each node created in a Maya
// scene.
public class VoxelGenerator : MPxNode //, IMPxNode
{
// -------------------------
// Input node attributes
private static MObject oVoxelType;
[MPxNodeNumeric("density",
"density",
MFnNumericData.Type.kShort,
Keyable = true,
Min1 = 2)]
public static MObject oDensity = null;
private MFnNumericAttribute aDensity;
public static MObject oInputMesh;
// -------------------------
// Output node attribute
public static MObject oOutput;
// -------------------------
// internal Class attributes
private VoxelGrid grid;
private Stopwatch sw;
public VoxelGenerator()
{
// set default value for the input attribute
aDensity = new MFnNumericAttribute(oDensity);
aDensity.setDefault(5);
}
/// <summary>
/// Compute Node method
/// </summary>
/// <param name="plug"></param>
/// <param name="dataBlock"></param>
/// <returns></returns>
override public bool compute(MPlug plug, MDataBlock dataBlock)
{
MDataHandle meshDataHandle = dataBlock.inputValue(oInputMesh);
MObject oConnectedMesh = meshDataHandle.asMesh;
sw = new Stopwatch();
switch (oConnectedMesh.apiType)
{
case MFn.Type.kInvalid:
MGlobal.displayInfo("No mesh connected.");
dataBlock.setClean(plug);
return false;
case MFn.Type.kMeshData:
{
sw.Start();
// get connected mesh
MPlug mesh_mplug = new MPlug(thisMObject(), oInputMesh);
MPlugArray plugs = new MPlugArray();
mesh_mplug.connectedTo(plugs, true, true);
MObject connectedMesh = plugs[0].node;
// get value of the attribute Type
MDataHandle voxelTypeDataHandle = dataBlock.inputValue(oVoxelType);
short voxelType = voxelTypeDataHandle.asShort;
// get value of the attribute Density
MDataHandle densityDataHandle = dataBlock.inputValue(oDensity);
short density = densityDataHandle.asShort;
// delete existing voxels if exist
if (grid != null)
grid.DeleteVoxels();
// generate voxels based on input mesh, type and density attributes
grid = new VoxelGrid(connectedMesh,
voxelType,
density);
// set grid.VoxelCount as value of the output attribute
MDataHandle outputHandle = dataBlock.outputValue(oOutput);
outputHandle.asInt = grid.VoxelCount;
sw.Stop();
MGlobal.displayInfo("calculation time (ms): " +
sw.Elapsed.Milliseconds);
break;
}
}
dataBlock.setClean(plug);
return true;
}
[MPxNodeInitializer]
public static void initialize()
{
MFnEnumAttribute enumAttr = new MFnEnumAttribute();
MFnTypedAttribute typedAttr = new MFnTypedAttribute();
MFnNumericAttribute numAttr = new MFnNumericAttribute();
// -------------------------------
// Create attributes section
// attribute Type
VoxelGenerator.oVoxelType = enumAttr.create("voxelType", "type");
enumAttr.addField("World", 0);
enumAttr.addField("Local", 1);
// attribute inputMesh
VoxelGenerator.oInputMesh = typedAttr.create("inputMesh",
"iMesh",
MFnData.Type.kMesh);
typedAttr.disconnectBehavior = MFnAttribute.DisconnectBehavior.kReset;
// attribute output number of voxels
VoxelGenerator.oOutput = numAttr.create("output",
"out",
MFnNumericData.Type.kInt);
numAttr.isReadable = true;
numAttr.isStorable = false;
// Add attributes section
addAttribute(VoxelGenerator.oVoxelType);
addAttribute(VoxelGenerator.oInputMesh);
addAttribute(VoxelGenerator.oOutput);
// Affect attributes section
attributeAffects(oVoxelType, oOutput);
attributeAffects(oDensity, oOutput);
attributeAffects(oInputMesh, oOutput);
}
}
}
</pre>
File VoxelGrid.cs contains methods DeleteVoxels() and GenerateVoxels(). We call in these two methods on each update in order to regenerate voxels.
<br />
<br />
<b>VoxelGrid.cs</b>
<pre class="brush: csharp">
using System;
using Autodesk.Maya.OpenMaya;
namespace voxelGenerator
{
class VoxelGrid
{
private enum Type {world, local};
private Type voxelType; // Type of the VoxelGrid (world or object oriented)
private MDagPath mesh_dpath; // Input mesh as MDagPath
private MFnMesh mfnMesh; // Poly Function Set for input mesh
private MBoundingBox bbox; // Bounding box of the input mesh
private MObjectArray voxelObjects; // Array of voxels
private short density; // Voxels density
private const float borderOffset = 0.01f; // Grid offset (inside a volume)
private float step; // Grid step
double xlen; // Bounding box length along x
double ylen; // Bounding box length along y
double zlen; // Bounding box length along z
public int VoxelCount; // Number of created voxel nodes
private MMatrix mExclusive; // MDagPath.exclusiveMatrix of input mesh
/// <summary>
/// Class Constructor
/// </summary>
/// <param name="oMesh">input mesh</param>
/// <param name="typeIndex">type of an algorithm used for a grid generation</param>
/// <param name="density">A number of voxels placed along
/// the shortest dimension of a bounding box</param>
public VoxelGrid(MObject oMesh, short typeIndex,
short density)
{
voxelType = (VoxelGrid.Type)typeIndex;
this.density = density;
mesh_dpath = MDagPath.getAPathTo(oMesh);
mExclusive = mesh_dpath.exclusiveMatrix;
voxelObjects = new MObjectArray();
bbox = GetBoundingBox();
// get lengths of a mesh bounding box
xlen = bbox.max.x - bbox.min.x;
ylen = bbox.max.y - bbox.min.y;
zlen = bbox.max.z - bbox.min.z;
//find which length is the minimal
double minEdge = xlen;
if (minEdge > ylen) minEdge = ylen;
if (minEdge > zlen) minEdge = zlen;
// calculate spacing between voxels
step = (float)((minEdge - 2 * minEdge * borderOffset) / (this.density - 1));
// create voxels
GenerateVoxels();
}
/// <summary>
/// Generate voxels grid based on bounding box of the mesh
/// and method returning true if voxel is inside mesh.
/// </summary>
private void GenerateVoxels()
{
// the second (outer) point for tracing ray
MFloatPoint outerPoint = new MFloatPoint((float)(bbox.max.x * 2),
(float)(bbox.max.y * 2),
(float)(bbox.max.z * 2));
mfnMesh = new MFnMesh(mesh_dpath);
var transformationMatrix = new MTransformationMatrix(mExclusive);
var rotation = transformationMatrix.rotation;
// --------------------------------------------------
// block of parameters for MFnMesh.allIntersections()
// --------------------------------------------------
MFloatVector rayDirection = new MFloatVector(outerPoint);
MIntArray faceIds = null;
MIntArray triIds = null;
const bool idsSorted = false;
MSpace.Space space = MSpace.Space.kWorld;
int maxParam = 999999;
bool testBothDirections = false;
MMeshIsectAccelParams accelParams = null;
bool sortHits = true;
MFloatPointArray hitPoints = new MFloatPointArray();
MFloatArray hitRayParams = new MFloatArray();
MIntArray hitFaces = new MIntArray();
// --------------------------------------------------
// create function set to work with voxels transforms
MFnTransform newVoxel_mfnTransform = new MFnTransform();
MDagModifier dagModifier = new MDagModifier();
for (double x = bbox.min.x + xlen * borderOffset;
x < bbox.max.x;
x += step)
{
for (double y = bbox.min.y + ylen * borderOffset;
y < bbox.max.y;
y += step)
{
for (double z = bbox.min.z + zlen * borderOffset;
z < bbox.max.z;
z += step)
{
var point = new MPoint(x, y, z);
if (voxelType == VoxelGrid.Type.local)
LocalToWorldSpace(ref point);
var fPoint = new MFloatPoint((float) point.x,
(float) point.y,
(float) point.z);
hitPoints.clear();
mfnMesh.allIntersections(fPoint,
rayDirection,
faceIds,
triIds,
idsSorted,
space,
maxParam,
testBothDirections,
accelParams,
sortHits,
hitPoints,
hitRayParams,
hitFaces,
null, null, null,
0.000001f);
// check if number of intersections are odd
// if true finish current loop
if (hitPoints.length%2 == 0) continue;
// if number of intersections are even
// point is inside the mesh => create voxel
MObject newVoxel = dagModifier.createNode("locator",
MObject.kNullObj);
MDagPath newVoxel_mdp = MDagPath.getAPathTo(newVoxel);
voxelObjects.append(newVoxel);
newVoxel_mfnTransform.setObject(newVoxel_mdp);
newVoxel_mfnTransform.setTranslation(new MVector(fPoint.x,
fPoint.y,
fPoint.z),
MSpace.Space.kWorld);
if (voxelType == VoxelGrid.Type.local)
newVoxel_mfnTransform.setRotation(rotation);
}
}
}
dagModifier.doIt(); // Create all generated voxels
VoxelCount = (int)this.voxelObjects.length;
}
/// <summary>
/// Transform MPoint using mesh transformation matrix
/// </summary>
/// <param name="point"></param>
private void LocalToWorldSpace(ref MPoint point)
{
MMatrix mInclusive = mesh_dpath.inclusiveMatrix;
point = point.multiply(mInclusive);
}
/// <summary>
/// Delete (MObject) voxels stored in this.voxelObjects
/// Call befor grid update.
/// </summary>
public void DeleteVoxels()
{
for (int i = 0; i < voxelObjects.length; i++)
{
try
{
MGlobal.deleteNode(voxelObjects[i]);
}
catch (Exception)
{
}
}
voxelObjects.clear();
}
/// <summary>
/// Return bounding box for a input mesh
/// in object space or world space
/// depending on VoxelGrid.Type
/// </summary>
/// <returns></returns>
private MBoundingBox GetBoundingBox()
{
MFnDagNode mesh_dagNode = new MFnDagNode(mesh_dpath);
MBoundingBox bbox = mesh_dagNode.boundingBox;
if (voxelType == VoxelGrid.Type.world)
{
bbox.transformUsing(mExclusive);
}
return bbox;
}
}
}
</pre>
How to use this plugin:
Load plugin and create voxel node:
<pre class="brush: csharp">
cmds.loadPlugin('voxelGenerator.nll.dll')
cmds.createNode('VoxelGenerator')
</pre>
create any polymesh object and connect its worldMesh to the input of created VoxelGenerator node e.g.
<pre class="brush: csharp">
cmds.connectAttr('pPrismShape1.worldMesh', 'VoxelGenerator1.inputMesh')
</pre>
<br />
Download <a href="https://app.box.com/s/zggbm4l9dhfl3yskv5r5">Visual Studio project</a> with the files above. Compiled in VS 2013 and tested in Maya 2014. Don't forget to add openmayacpp.dll and openmayacs.dll files to References.
</div>Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.com0tag:blogger.com,1999:blog-7183744988148826412.post-78712354247969760852013-11-05T02:52:00.001-08:002013-12-01T12:27:33.989-08:00Creating voxels in Maya, or how to work with MFnMesh::allIntersections. Part 1<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
Hello everyone,<br />
I would like to share with you some interesting stuff.<br />
<br />
Let's fill an object with voxels. In order to do it we need to determine if voxel point is inside the mesh.
And it's true, if a ray started at this point in any direction, intersects mesh triangles and number of intersections are even.<br />
<br />
<a name='more'></a>Therefore, to fill up the mesh with voxels we need to generate a 3D grid based on object's bounding box, and check each grid point, how many times it intersects the mesh. A key Maya API command in this task is <a class="el" href="http://docs.autodesk.com/MAYAUL/2013/ENU/Maya-API-Documentation/cpp_ref/class_m_fn_mesh.html#aa6c4717b168258664d399fb92e2cdcee" style="color: #4665a2; font-family: 'Lucida Grande', Verdana, Geneva, Arial, sans-serif; font-size: 12px; font-weight: bold;" translate="no">allIntersections</a> in the class <a class="toc_selected" href="http://docs.autodesk.com/MAYAUL/2013/ENU/Maya-API-Documentation/cpp_ref/class_m_fn_mesh.html" id="nodeAhchorcpp_ref_class_m_fn_mesh_html" style="color: #4665a2; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold; line-height: 15px; text-decoration: none; white-space: nowrap;" target="content">MFnMesh</a>.<br />
Okey, let's write some code. I will comment all important parts right in the script.</div>
<pre class="brush: python">import maya.cmds as cmds
import maya.OpenMaya as om
import time
DENSITY = 10 # density of voxels
BORDER = 0.01 # shift border voxels inside a mesh for this amount,
# to avoid misses of border voxels due to math on floats
# Float range generator
def frange(start, stop, step):
r = start
while not r > stop:
yield r
r += step
def main():
if not cmds.ls(sl = True):
cmds.warning('Select mesh to generate voxels.')
return
# Get MFnMesh function set for selected mesh
obj = cmds.ls(sl = True)[0]
selection = om.MSelectionList()
selection.add(obj)
obj_mdagpath = om.MDagPath()
selection.getDagPath(0, obj_mdagpath)
obj_mfnMesh = om.MFnMesh(obj_mdagpath)
# Get bounding box for selected mesh and calculate grid step
bbox = cmds.xform (obj, q = True, ws = True, boundingBox = True)
grp = cmds.group(em = True, name = 'grp')
xlen = bbox[3] - bbox[0]
ylen = bbox[4] - bbox[1]
zlen = bbox[5] - bbox[2]
step = round(((bbox[3] - bbox[0]) - 2* xlen * BORDER) /(DENSITY -1), 3)
print 'step:', step
# Init all required flags of MFnMesh.allIntersections()
rayDirection = om.MFloatVector(bbox[3]*2, bbox[4]*2, bbox[5]*2) # outer ray point
faceIds = None
triIds =None
idsSorted = False
space = om.MSpace.kWorld
maxParam = 999999
testBothDirections = False
accelParams = None
sortHits = True
hitPoints = om.MFloatPointArray()
hitRayParams = om.MFloatArray()
hitFaces = om.MIntArray()
voxelCount = 0
# it's not necessary but we want to know how many time computation takes.
start_time = time.time()
# Iterate through 3D grid based on mesh bounding box
for x in frange(bbox[0] + xlen*BORDER, bbox[3], step):
for y in frange(bbox[1]+ ylen*BORDER, bbox[4], step):
for z in frange(bbox[2] + zlen*BORDER, bbox[5], step):
raySource = om.MFloatPoint(x, y, z)
# Don't forget to clear hitPoints variable or get unpredictable result
hitPoints.clear()
obj_mfnMesh.allIntersections(raySource,
rayDirection,
faceIds,
triIds,
idsSorted,
space,
maxParam,
testBothDirections,
accelParams,
sortHits,
hitPoints,
hitRayParams,
hitFaces,
None,None,None,
0.000001)
# if number of intersections is odd, point of grid is inside mesh volume
if hitPoints.length()%2 ==1:
loc = cmds.spaceLocator()[0]
cmds.setAttr(loc + '.scale',0.05,0.05,0.05)
cmds.xform(loc, ws = True, t = [x,y,z])
cmds.parent(loc, grp)
voxelCount +=1
print 'Number of created voxel primitives:', voxelCount
print 'Script completed in ', round(time.time() - start_time, 4), "seconds"
</pre>
How to use it: Select any mesh object, and run the script.
<br />
<b>Remark:</b>
Nothing special. Only one thing confused me, and it took time to understand what was wrong. In each loop of the cycle before usage in the mfnMesh.allIntersections method, we need to clear array hitPoints, or it has wrong values.
<br />
In Part2 we are going to create Voxel node using C# and Maya .NET API.
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_EYlbtUKVbPDPK-qb0Pq7xDw-pDqBDFvmn42lLRBYrI4TjlYKjBAsukJvWIuzMktM4kEarrdZZm9RE7g8a3d_Zf3oO7SaA-l9KVEQFgb15UBBfxH3xCOsNrNEsfr5N8mnMjLuEVKLGrxV/s1600/voxelp2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_EYlbtUKVbPDPK-qb0Pq7xDw-pDqBDFvmn42lLRBYrI4TjlYKjBAsukJvWIuzMktM4kEarrdZZm9RE7g8a3d_Zf3oO7SaA-l9KVEQFgb15UBBfxH3xCOsNrNEsfr5N8mnMjLuEVKLGrxV/s320/voxelp2.jpg" /></a></div>
<br />
Thank you. See you soon in Part 2.</div>
Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.com0tag:blogger.com,1999:blog-7183744988148826412.post-65099421068998926922013-05-29T13:22:00.000-07:002013-05-29T13:26:23.435-07:00MAYA: Snippet for curve knot vector.<div dir="ltr" style="text-align: left;" trbidi="on">
<div>
In order to create curve by CVs we need to construct knot vector. It should have numberOfCVs + degree - 1 knot values. This small snippet takes number of CV and degree of the curve, and returns knot vector values as list. Maybe it will be useful for somebody.
<br /></div>
<pre class="brush: python">
def createKnotVectorString(cvNum, degree):
"""
@param int cvNum: number of CVs in constructing curve.
@param int degree: degree of constructing curve.
@return list
"""
if cvNum <= degree:
print "warning, number of CVs can't be less than degree + 1"
return None
tailsSize = degree
knotsNum = cvNum + degree - 1
knotsArray = [0]*knotsNum
for i in range(0, len(knotsArray)-degree+1):
knotsArray[i + degree-1] = i
tailValue = knotsArray[-tailsSize-1] + 1
for i in range(1,tailsSize):
knotsArray[-i] = tailValue
return knotsArray
print createKnotVectorString(4, 3)
</pre>
</div>Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.com0tag:blogger.com,1999:blog-7183744988148826412.post-32446823279915716212013-03-19T01:30:00.000-07:002013-03-19T01:37:25.712-07:00Open MAYA API: Working with iterators (part 2)<div dir="ltr" style="text-align: left;" trbidi="on">
As a part of tools for work with polygon hairs i created small script to select cap edges of poly stripes.
The task was: create script which converts any selection (poly object, poly vertices, poly edges or poly faces) to edges which lie on the caps of poly stripes.
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRI3VtLCBzr80bWoItnJeSxKbtR-v1d778C4zKaThgT5jkpj_ko1xwwjEQrpmGxOYiGRCfJ8_vAB25uUCYQWwceI5aHpkcGvZ0ctkPZh9Z-7YknBS9DbBY_tEVFO39yPeUH5lZK2IwcUdT/s1600/capEdges.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="186" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRI3VtLCBzr80bWoItnJeSxKbtR-v1d778C4zKaThgT5jkpj_ko1xwwjEQrpmGxOYiGRCfJ8_vAB25uUCYQWwceI5aHpkcGvZ0ctkPZh9Z-7YknBS9DbBY_tEVFO39yPeUH5lZK2IwcUdT/s320/capEdges.jpg" width="320" /></a></div>
<br />
<br />
<a name='more'></a><br />
<br />
<pre class="brush: python">import maya.OpenMaya as om
import maya.cmds as cmds
def edgeCapSelector():
# Check if vertices or faces were selected.
# If True convert selection to edges.
verts = cmds.filterExpand(sm = 31, ex = True, fullPath = True)
faces = cmds.filterExpand(sm = 31, ex = True, fullPath = True)
if verts is not None or faces is not None:
cmds.ConvertSelectionToEdges()
# Create variable of special class MScriptUtil.
# It's required to store pointer to integer variable.
mutil = om.MScriptUtil()
# Create variable "resultSelection" of type MSelectionList to store cap edges.
resultSelection = om.MSelectionList()
# Create variable "selection" to store current selection.
selection = om.MSelectionList()
# Fill "selection" with list of selected objects.
om.MGlobal.getActiveSelectionList(selection)
# Create iterator through list of selected objects.
selection_iter = om.MItSelectionList(selection)
# Creatre variable to store DagPath to selected object
selection_DagPath = om.MDagPath()
# Create variable to store iterating edge as MObject.
component_edge = om.MObject()
# Create variable to store pointer to interger value.
# There is no other way to get to Python value from Maya API function which return &int
int_Ptr = mutil.asIntPtr()
# Variable to store currently iterating object as MObject.
selectedMObject = om.MObject()
# Main loop of selection iterator.
while not selection_iter.isDone():
# Get list of selected edges (if components are selected, but not object)
selection_iter.getDagPath(selection_DagPath, component_edge)
if selection_iter.hasComponents():
# Create iterator through SELECTED edges, if edges are in selection.
edge_iter = om.MItMeshEdge(selection_DagPath, component_edge)
else:
# Create iterator through ALL edges of currently iterating selected object,
# becouse object is selected, but not components.
selection_iter.getDependNode(selectedMObject)
edge_iter = om.MItMeshEdge(selectedMObject)
# Main loop of edges iterator
while not edge_iter.isDone():
# get pointer to int with number of edges connected to currently iterating
edge_iter.numConnectedEdges(int_Ptr)
# get value from int pointer
numConEdges = mutil.getInt(int_Ptr)
# check if it's really polystripe
if numConEdges != 2 and numConEdges !=4 and numConEdges != 3:
print edge_iter.index()
cmds.error('Topology error. Check mesh topology.')
# if current edge is connected to two edges it's cap edge
if numConEdges == 2:
# add cap edge to MSelectionList where we store results
resultSelection.add(selection_DagPath, edge_iter.currentItem())
# get next edge and go to loop begginning
edge_iter.next()
selection_iter.next()
# if we found cap edges select and highlight them. We highlight them because
# usually selection is also highlighted in maya, so it looks more natural
# for user.
if resultSelection.length() > 0:
om.MGlobal.setSelectionMode(om.MGlobal.kSelectComponentMode)
om.MGlobal.setHiliteList(selection)
om.MGlobal.setActiveSelectionList(resultSelection)
edgeCapSelector()
</pre>
<br /></div>Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.com2tag:blogger.com,1999:blog-7183744988148826412.post-51812526731646096082013-03-13T12:29:00.002-07:002013-03-14T11:09:11.271-07:00Open MAYA API: Working with iterators (part 1)<div dir="ltr" style="text-align: left;" trbidi="on">
Iterators are special classes which have methods to navigate through objects or components. <br />
<a class="el" href="http://docs.autodesk.com/MAYAUL/2013/ENU/Maya-API-Documentation/cpp_ref/class_m_it_selection_list.html" style="color: #4665a2; font-family: 'Lucida Grande', Verdana, Geneva, Arial, sans-serif; font-size: 12px; font-weight: bold; text-decoration: initial;" target="_blank">MItSelectionList</a>- navigate through selected objects<br />
<a class="el" href="http://docs.autodesk.com/MAYAUL/2013/ENU/Maya-API-Documentation/cpp_ref/class_m_it_dependency_nodes.html#a7301abf58dfa8362f6aab9aff10932dd" style="color: #4665a2; font-family: 'Lucida Grande', Verdana, Geneva, Arial, sans-serif; font-size: 12px; font-weight: bold;" target="_blank" translate="no">MItDependencyNodes</a> - navigate through all maya nodes. Especially useful to navigate through specific type of maya objects. For example to traverse all cameras, or lights, or meshes.<br />
<a class="el" href="http://docs.autodesk.com/MAYAUL/2013/ENU/Maya-API-Documentation/cpp_ref/class_m_it_mesh_polygon.html" style="color: #4665a2; font-family: 'Lucida Grande', Verdana, Geneva, Arial, sans-serif; font-size: 12px; font-weight: bold;" target="_blank">MItMeshPolygon</a>, <a class="el" href="http://docs.autodesk.com/MAYAUL/2013/ENU/Maya-API-Documentation/cpp_ref/class_m_it_mesh_vertex.html" style="color: #4665a2; font-family: 'Lucida Grande', Verdana, Geneva, Arial, sans-serif; font-size: 12px; font-weight: bold;" target="_blank">MItMeshVertex</a>, <a class="el" href="http://docs.autodesk.com/MAYAUL/2013/ENU/Maya-API-Documentation/cpp_ref/class_m_it_mesh_edge.html" style="color: #4665a2; font-family: 'Lucida Grande', Verdana, Geneva, Arial, sans-serif; font-size: 12px; font-weight: bold;" target="_blank">MItMeshEdge</a>, <a class="el" href="http://docs.autodesk.com/MAYAUL/2013/ENU/Maya-API-Documentation/cpp_ref/class_m_it_mesh_face_vertex.html" style="color: #4665a2; font-family: 'Lucida Grande', Verdana, Geneva, Arial, sans-serif; font-size: 12px; font-weight: bold;" target="_blank">MItMeshFaceVertex</a> to navigate through specific components of the poly object.<br />
<br />
<a name='more'></a><br />
<br />
There are many other iterators in maya api. You can find them in API class list. All of them start with MIt.<br />
General syntax to work with iterators in python is following. For example let's navigate through all cameras in the current scene:<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: #202020; background: black; border-width: .1em .1em .1em .8em; border: solid gray; color: white; overflow: auto; padding: .2em .6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16</pre>
</td><td><pre style="line-height: 125%; margin: 0;"><span style="color: #6ab825; font-weight: bold;">import</span> <span style="color: #447fcf; text-decoration: underline;">maya.OpenMaya</span> <span style="color: #6ab825; font-weight: bold;">as</span> <span style="color: #447fcf; text-decoration: underline;">om</span>
<span style="color: #6ab825; font-weight: bold;">def</span> <span style="color: #447fcf;">getCameras</span><span style="color: #d0d0d0;">():</span>
<span style="color: #999999; font-style: italic;"># Create iterator traverse all camera nodes</span>
<span style="color: #d0d0d0;">camera_iter</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">om.MItDependencyNodes(om.MFn.kCamera)</span>
<span style="color: #999999; font-style: italic;"># Loop though iterator objects</span>
<span style="color: #6ab825; font-weight: bold;">while</span> <span style="color: #6ab825; font-weight: bold;">not</span> <span style="color: #d0d0d0;">camera_iter.isDone():</span>
<span style="color: #999999; font-style: italic;"># camera_iter.thisNode() points to current MObject in iterator</span>
<span style="color: #d0d0d0;">camera_mObject</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">camera_iter.thisNode()</span>
<span style="color: #999999; font-style: italic;"># let's print all cameras names</span>
<span style="color: #d0d0d0;">dagPath</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">om.MDagPath.getAPathTo(camera_mObject)</span>
<span style="color: #6ab825; font-weight: bold;">print</span> <span style="color: #d0d0d0;">dagPath.fullPathName()</span>
<span style="color: #999999; font-style: italic;"># Takes next object in "while" loop.</span>
<span style="color: #999999; font-style: italic;"># Don't forget it, or you will get infinite loop.</span>
<span style="color: #d0d0d0;">camera_iter.next()</span>
<span style="color: #d0d0d0;">getCameras()</span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
<br />
Another example - iterating through selected object:<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: #202020; background: black; border-width: .1em .1em .1em .8em; border: solid gray; color: white; overflow: auto; padding: .2em .6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19</pre>
</td><td><pre style="line-height: 125%; margin: 0;"><span style="color: #6ab825; font-weight: bold;">import</span> <span style="color: #447fcf; text-decoration: underline;">maya.OpenMaya</span> <span style="color: #6ab825; font-weight: bold;">as</span> <span style="color: #447fcf; text-decoration: underline;">om</span>
<span style="color: #6ab825; font-weight: bold;">def</span> <span style="color: #447fcf;">getSelection</span><span style="color: #d0d0d0;">():</span>
<span style="color: #999999; font-style: italic;"># Create object named selection and type - SelectionList</span>
<span style="color: #d0d0d0;">selection</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">om.MSelectionList()</span>
<span style="color: #999999; font-style: italic;"># Fill variable "selection" with list of selected objects</span>
<span style="color: #d0d0d0;">om.MGlobal.getActiveSelectionList(selection)</span>
<span style="color: #999999; font-style: italic;"># Create iterator through list of selected object</span>
<span style="color: #d0d0d0;">selection_iter</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">om.MItSelectionList(selection)</span>
<span style="color: #d0d0d0;">obj</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">om.MObject()</span>
<span style="color: #999999; font-style: italic;"># Loop though iterator objects</span>
<span style="color: #6ab825; font-weight: bold;">while</span> <span style="color: #6ab825; font-weight: bold;">not</span> <span style="color: #d0d0d0;">selection_iter.isDone():</span>
<span style="color: #999999; font-style: italic;"># Now we can do anything with each of selected objects.</span>
<span style="color: #999999; font-style: italic;"># In this example lets just print path to iterating objects. </span>
<span style="color: #d0d0d0;">selection_iter.getDependNode(obj)</span>
<span style="color: #d0d0d0;">dagPath</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">om.MDagPath.getAPathTo(obj)</span>
<span style="color: #6ab825; font-weight: bold;">print</span> <span style="color: #d0d0d0;">dagPath.fullPathName()</span>
<span style="color: #d0d0d0;">selection_iter.next()</span>
<span style="color: #d0d0d0;">getSelection()</span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
<br />
<br /></div>
Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.com4tag:blogger.com,1999:blog-7183744988148826412.post-57358687527482307092013-02-04T02:25:00.000-08:002013-02-04T02:33:26.360-08:00Allow only one instance of python script.<div dir="ltr" style="text-align: left;" trbidi="on">
What if you need to run python script only if it's not already running? Or kill old copy before run new one? One of the way is:<br />
<br />
<ul style="text-align: left;">
<li>Check if special file exists. If it's true, one copy of script is already running. Now kill it or exit from second copy.</li>
<li>Create temporary file with PID of script process.</li>
<li>Delete pid-file at the end of the script.</li>
</ul>
<div>
Here is the code:</div>
<!-- HTML generated using hilite.me --><br />
<div style="background: #202020; background: black; border-width: .1em .1em .1em .8em; border: solid gray; color: white; overflow: auto; padding: .2em .6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0;"> 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63</pre>
</td><td><pre style="line-height: 125%; margin: 0;"><span style="color: #6ab825; font-weight: bold;">import</span> <span style="color: #447fcf; text-decoration: underline;">tempfile</span>
<span style="color: #6ab825; font-weight: bold;">import</span> <span style="color: #447fcf; text-decoration: underline;">ctypes</span>
<span style="color: #6ab825; font-weight: bold;">import</span> <span style="color: #447fcf; text-decoration: underline;">os</span>
<span style="color: #999999; font-style: italic;"># Path to file storing PID of running script process. </span>
<span style="color: #999999; font-style: italic;"># Place it outside of methods in the beggining, or make sure it visible for all methods, which use it.</span>
<span style="color: #d0d0d0;">pid_file</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">tempfile.gettempdir()</span> <span style="color: #d0d0d0;">+</span> <span style="color: #ed9d13;">'tmp_armor_pid.txt'</span>
<span style="color: #999999; font-style: italic;"># This method checks if file pid_file exists. </span>
<span style="color: #999999; font-style: italic;"># If it was found, depends of mode - exit, or kill process which PID is stored in file. </span>
<span style="color: #6ab825; font-weight: bold;">def</span> <span style="color: #447fcf;">scriptStarter</span><span style="color: #d0d0d0;">(mode</span> <span style="color: #d0d0d0;">=</span> <span style="color: #ed9d13;">'force'</span><span style="color: #d0d0d0;">):</span>
<span style="color: #ed9d13;">'''</span>
<span style="color: #ed9d13;"> if mode = force - kill runing script and run new one</span>
<span style="color: #ed9d13;"> if mode != force - run script only if it's not already running</span>
<span style="color: #ed9d13;"> '''</span>
<span style="color: #6ab825; font-weight: bold;">if</span> <span style="color: #d0d0d0;">os.path.exists(pid_file):</span>
<span style="color: #6ab825; font-weight: bold;">print</span> <span style="color: #ed9d13;">'old copy found'</span>
<span style="color: #6ab825; font-weight: bold;">if</span> <span style="color: #d0d0d0;">mode</span> <span style="color: #d0d0d0;">==</span> <span style="color: #ed9d13;">'force'</span><span style="color: #d0d0d0;">:</span>
<span style="color: #6ab825; font-weight: bold;">print</span> <span style="color: #ed9d13;">'running copy found, killing it'</span>
<span style="color: #999999; font-style: italic;"># reading PID from file and convert it to int</span>
<span style="color: #d0d0d0;">pid</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">int</span><span style="color: #d0d0d0;">((</span><span style="color: #24909d;">open</span><span style="color: #d0d0d0;">(pid_file).read()))</span>
<span style="color: #6ab825; font-weight: bold;">print</span> <span style="color: #ed9d13;">'pid have been read:'</span><span style="color: #d0d0d0;">,</span> <span style="color: #d0d0d0;">pid</span>
<span style="color: #999999; font-style: italic;"># If you use pythton 2.7 or above just use os.kill to terminate PID process.</span>
<span style="color: #999999; font-style: italic;"># In case of python 2.6 run method killing selected PID</span>
<span style="color: #d0d0d0;">kill(pid)</span>
<span style="color: #6ab825; font-weight: bold;">else</span><span style="color: #d0d0d0;">:</span>
<span style="color: #6ab825; font-weight: bold;">print</span> <span style="color: #ed9d13;">'running copy found, leaving'</span>
<span style="color: #999999; font-style: italic;"># not force mode. Just don't run new copy. Leaving.</span>
<span style="color: #6ab825; font-weight: bold;">raise</span> <span style="color: #bbbbbb;">SystemExit</span>
<span style="color: #999999; font-style: italic;"># If we are here, mode == force, old copy killed, writing PID for new script process </span>
<span style="color: #24909d;">open</span><span style="color: #d0d0d0;">(pid_file,</span> <span style="color: #ed9d13;">'w'</span><span style="color: #d0d0d0;">).write(</span><span style="color: #24909d;">str</span><span style="color: #d0d0d0;">(os.getpid()))</span>
<span style="color: #6ab825; font-weight: bold;">def</span> <span style="color: #447fcf;">kill</span><span style="color: #d0d0d0;">(pid):</span>
<span style="color: #ed9d13;">"""kill function for Win32"""</span>
<span style="color: #d0d0d0;">kernel32</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">ctypes.windll.kernel32</span>
<span style="color: #d0d0d0;">handle</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">kernel32.OpenProcess(</span><span style="color: #3677a9;">1</span><span style="color: #d0d0d0;">,</span> <span style="color: #3677a9;">0</span><span style="color: #d0d0d0;">,</span> <span style="color: #d0d0d0;">pid)</span>
<span style="color: #6ab825; font-weight: bold;">return</span> <span style="color: #d0d0d0;">(</span><span style="color: #3677a9;">0</span> <span style="color: #d0d0d0;">!=</span> <span style="color: #d0d0d0;">kernel32.TerminateProcess(handle,</span> <span style="color: #3677a9;">0</span><span style="color: #d0d0d0;">))</span>
<span style="color: #999999; font-style: italic;"># Delete pid-file befor script finish. </span>
<span style="color: #999999; font-style: italic;"># Dont forget to run this method at the end of the script</span>
<span style="color: #999999; font-style: italic;"># If you use PyQt call it in overloaded closeEvent() </span>
<span style="color: #6ab825; font-weight: bold;">def</span> <span style="color: #447fcf;">removePIDfile</span><span style="color: #d0d0d0;">():</span>
<span style="color: #6ab825; font-weight: bold;">print</span> <span style="color: #ed9d13;">'deleting pidfile'</span>
<span style="color: #6ab825; font-weight: bold;">try</span><span style="color: #d0d0d0;">:</span>
<span style="color: #d0d0d0;">os.remove(pid_file)</span>
<span style="color: #6ab825; font-weight: bold;">except</span> <span style="color: #bbbbbb;">OSError</span><span style="color: #d0d0d0;">:</span>
<span style="color: #6ab825; font-weight: bold;">pass</span>
<span style="color: #6ab825; font-weight: bold;">return</span>
<span style="color: #6ab825; font-weight: bold;">def</span> <span style="color: #447fcf;">main</span><span style="color: #d0d0d0;">():</span>
<span style="color: #999999; font-style: italic;"># check if script is already running </span>
<span style="color: #d0d0d0;">scriptStarter(</span><span style="color: #ed9d13;">'force'</span><span style="color: #d0d0d0;">)</span>
<span style="color: #ed9d13;">'''YOUR SCRIPT CODE HERE'''</span>
<span style="color: #999999; font-style: italic;"># remove pid-file before exit.</span>
<span style="color: #d0d0d0;">removePIDfile()</span>
<span style="color: #6ab825; font-weight: bold;">if</span> <span style="color: #d0d0d0;">__name__==</span><span style="color: #ed9d13;">"__main__"</span><span style="color: #d0d0d0;">:</span>
<span style="color: #d0d0d0;">main()</span>
</pre>
</td></tr>
</tbody></table>
</div>
</div>
Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.com1tag:blogger.com,1999:blog-7183744988148826412.post-19672462587046861962013-02-03T11:06:00.001-08:002013-02-03T11:06:47.969-08:00Sublime Text editor customization.<div dir="ltr" style="text-align: left;" trbidi="on">
<a href="http://www.sublimetext.com/" target="_blank">Sublime Text</a> - very powerful and flexible text editor. It has syntax highlight and auto-complete for different programming languages, including python. Also, you can find syntax highlighting files for maya MEL. One of the most useful thing in Sublime is multiline edit. This feature is awesome. Check official web site of this editor for more info and download. I'm sure you will like it.<br />
Although it has nice look by default i want to tell you about two improvements i use to get look of it like on screenshot below:<br />
<a name='more'></a><br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiI3UpQFjdKquzrp27pJgZjvNrrRrQNsCXUneiGyU6LTOY2bPXLR048BaPXaDGNwB99LMRIPvvqraUc50It59hxdIaPDRUmmCF4W5z5L-_FunHUtSSYY9JGenur-4AsZrZ6NmWJw448U9jF/s1600/sublime.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="218" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiI3UpQFjdKquzrp27pJgZjvNrrRrQNsCXUneiGyU6LTOY2bPXLR048BaPXaDGNwB99LMRIPvvqraUc50It59hxdIaPDRUmmCF4W5z5L-_FunHUtSSYY9JGenur-4AsZrZ6NmWJw448U9jF/s320/sublime.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<br />
<ul style="text-align: left;">
<li>Theme <a href="https://github.com/buymeasoda/soda-theme/" target="_blank">Soda Dark</a>. Use installation instruction at download page.</li>
<li><a href="https://github.com/adobe/source-code-pro" target="_blank">Source Code Pro </a> - nice looking fonts, created by Adobe. I prefer Source Code Pro Semibold. Install fonts into system.</li>
</ul>
<div>
Now in sublime editor go to Preferences - Settings User. And insert following lines into settings file:
<br />
<blockquote>
"soda_classic_tabs": false, // square tabs <br />
"theme": "Soda Dark.sublime-theme", <br />
"font_face": "Source Code Pro Semibold", <br />
"font_size": 10 // size you prefer</blockquote>
</div>
<div>
<br /></div>
</div>
Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.com0tag:blogger.com,1999:blog-7183744988148826412.post-83782957541866159602013-01-15T11:47:00.000-08:002013-01-15T11:50:01.632-08:00Crease Edges to Hard, Hard Edges to Crease.<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
Hard edges are the best way to represent crease edges on low poly model. But when modelling it can be difficult to keep these two edge properties in proper order, due to constantly changing of the model. This little script will help you to do it.<br />
It works in two modes:</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<ul style="text-align: left;">
<li><b>crease2Normal</b> - makes crease edges hard (and vise versa, not crease edges - soft) </li>
<li><b>normal2Crease</b> - makes hard edge crease.</li>
</ul>
<div>
Take a look at screenshots below to see how it works.<br />
<br />
<a name='more'></a><br /></div>
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjs5CCjSup8HUWaiI6HrGhiNw1UcgzSVOEkzQosQ1jHX3H8HP7q7I7hwCQ9QWLBt2mdQtBRKwu9evjQIw6srW8Vqm4cGwGv-OGcrvL2O-iWDFTXlWTfCEuRl1ZbofhoZddiquiSMV1FXpKT/s1600/creaseToNormalBefore.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="153" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjs5CCjSup8HUWaiI6HrGhiNw1UcgzSVOEkzQosQ1jHX3H8HP7q7I7hwCQ9QWLBt2mdQtBRKwu9evjQIw6srW8Vqm4cGwGv-OGcrvL2O-iWDFTXlWTfCEuRl1ZbofhoZddiquiSMV1FXpKT/s200/creaseToNormalBefore.png" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">crease2Normal edges befor</td></tr>
</tbody></table>
<div dir="ltr" style="text-align: left;" trbidi="on">
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjckQhRw3WFDt-5nV5dcvxtbEIGq_S4iADwyEbf8eSDrex6l4p05xdIw4K3HVbJFWaAc-TRsKmSb97ofwYn5JgI0xdH3S7g364l-91cqA00KfsJkbJ-3o-eUMQzAExZOkRcepKh4_oVAN0X/s1600/creaseToNormalAfter.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="153" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjckQhRw3WFDt-5nV5dcvxtbEIGq_S4iADwyEbf8eSDrex6l4p05xdIw4K3HVbJFWaAc-TRsKmSb97ofwYn5JgI0xdH3S7g364l-91cqA00KfsJkbJ-3o-eUMQzAExZOkRcepKh4_oVAN0X/s200/creaseToNormalAfter.png" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">crease2Normal edges after</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjud8ekZeOQ5_4Kv8HaQzSgMgeU8cQa7cuZiITaBrQnd704-1ECf4MwRUjQ16E1DpThKiI7KObzHelTQ7K_BagCMuZpAZ-JYM2PeA25_pn1g5LGTg-ixBwk_CCVfaI5GI-N3AP6NI8XgEnp/s1600/NormalToCrease.png" imageanchor="1" style="margin-left: auto; margin-right: auto; text-align: center;"><img border="0" height="153" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjud8ekZeOQ5_4Kv8HaQzSgMgeU8cQa7cuZiITaBrQnd704-1ECf4MwRUjQ16E1DpThKiI7KObzHelTQ7K_BagCMuZpAZ-JYM2PeA25_pn1g5LGTg-ixBwk_CCVfaI5GI-N3AP6NI8XgEnp/s200/NormalToCrease.png" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">normal2Crease</td></tr>
</tbody></table>
</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
To install copy script bellow on shelf button. This button will be "<i>Crease to Hard Edges" </i>mode.<br />
To make button with "<i>Hard Edges to Crease</i>" mode, copy the same script to new button and replace text <span style="background-color: black; color: #ed9d13; line-height: 16px;">'c2n'</span> at last string with text <i> </i><span style="background-color: black; color: #ed9d13; line-height: 16px;">'n2c'</span> .<br />
<br /></div>
<!-- HTML generated using hilite.me --></div>
<div style="background: #202020; background: black; border-width: .1em .1em .1em .8em; border: solid gray; color: white; overflow: auto; padding: .2em .6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0;"> 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
39
40
41
42
43
44</pre>
</td><td><pre style="line-height: 125%; margin: 0;"><span style="color: #ed9d13;">''' [Crease To Normal]</span>
<span style="color: #ed9d13;">Created on 23.07.2012</span>
<span style="color: #ed9d13;">edgeCreaser - uses edge Crease info to make it hard edge, or use Hard edge info to make edge crease.</span>
<span style="color: #ed9d13;">@author: Serge Scherbakov</span>
<span style="color: #ed9d13;">'''</span>
<span style="color: #6ab825; font-weight: bold;">import</span> <span style="color: #447fcf; text-decoration: underline;">maya.cmds</span> <span style="color: #6ab825; font-weight: bold;">as</span> <span style="color: #447fcf; text-decoration: underline;">cmds</span>
<span style="color: #6ab825; font-weight: bold;">class</span> <span style="color: #447fcf; text-decoration: underline;">edgeCreaser</span><span style="color: #d0d0d0;">():</span>
<span style="color: orange;">@staticmethod</span>
<span style="color: #6ab825; font-weight: bold;">def</span> <span style="color: #447fcf;">apply</span><span style="color: #d0d0d0;">(mode</span> <span style="color: #d0d0d0;">=</span> <span style="color: #ed9d13;">'c2n'</span><span style="color: #d0d0d0;">):</span>
<span style="color: #d0d0d0;">hardList</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">[]</span>
<span style="color: #d0d0d0;">softList</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">[]</span>
<span style="color: #d0d0d0;">selection</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">cmds.ls(sl</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">)</span>
<span style="color: #d0d0d0;">el</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">cmds.polyListComponentConversion(toEdge</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">)</span>
<span style="color: #d0d0d0;">cmds.select</span> <span style="color: #d0d0d0;">(el,</span> <span style="color: #d0d0d0;">r</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">)</span>
<span style="color: #d0d0d0;">edgeList</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">cmds.ls(</span> <span style="color: #d0d0d0;">sl</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">,</span> <span style="color: #d0d0d0;">fl</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">)</span>
<span style="color: #6ab825; font-weight: bold;">if</span> <span style="color: #d0d0d0;">mode</span> <span style="color: #d0d0d0;">==</span> <span style="color: #ed9d13;">'c2n'</span><span style="color: #d0d0d0;">:</span>
<span style="color: #6ab825; font-weight: bold;">for</span> <span style="color: #d0d0d0;">edge</span> <span style="color: #6ab825; font-weight: bold;">in</span> <span style="color: #d0d0d0;">edgeList:</span>
<span style="color: #6ab825; font-weight: bold;">if</span> <span style="color: #d0d0d0;">cmds.polyCrease(edge,</span> <span style="color: #d0d0d0;">q</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">,</span> <span style="color: #d0d0d0;">value</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">)[</span><span style="color: #3677a9;">0</span><span style="color: #d0d0d0;">]</span> <span style="color: #d0d0d0;">></span> <span style="color: #3677a9;">0.0</span><span style="color: #d0d0d0;">:</span>
<span style="color: #d0d0d0;">hardList.append(edge)</span>
<span style="color: #6ab825; font-weight: bold;">else</span><span style="color: #d0d0d0;">:</span>
<span style="color: #d0d0d0;">softList.append(edge)</span>
<span style="color: #d0d0d0;">cmds.select(selection,</span> <span style="color: #d0d0d0;">r</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">)</span>
<span style="color: #d0d0d0;">vertsList</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">cmds.polyListComponentConversion(toVertex</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">)</span>
<span style="color: #d0d0d0;">cmds.select(vertsList</span> <span style="color: #d0d0d0;">,</span> <span style="color: #d0d0d0;">r</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">)</span>
<span style="color: #d0d0d0;">cmds.polyNormalPerVertex(ufn</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">)</span>
<span style="color: #6ab825; font-weight: bold;">if</span> <span style="color: #d0d0d0;">hardList:</span>
<span style="color: #d0d0d0;">cmds.polySoftEdge(hardList,</span> <span style="color: #d0d0d0;">a</span> <span style="color: #d0d0d0;">=</span> <span style="color: #3677a9;">0</span><span style="color: #d0d0d0;">)</span>
<span style="color: #6ab825; font-weight: bold;">if</span> <span style="color: #d0d0d0;">softList:</span>
<span style="color: #d0d0d0;">cmds.polySoftEdge(softList,</span> <span style="color: #d0d0d0;">a</span> <span style="color: #d0d0d0;">=</span> <span style="color: #3677a9;">180</span><span style="color: #d0d0d0;">)</span>
<span style="color: #6ab825; font-weight: bold;">if</span> <span style="color: #d0d0d0;">mode</span> <span style="color: #d0d0d0;">==</span> <span style="color: #ed9d13;">'n2c'</span><span style="color: #d0d0d0;">:</span>
<span style="color: #6ab825; font-weight: bold;">for</span> <span style="color: #d0d0d0;">edge</span> <span style="color: #6ab825; font-weight: bold;">in</span> <span style="color: #d0d0d0;">edgeList:</span>
<span style="color: #d0d0d0;">eInfo</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">cmds.polyInfo(edge,</span> <span style="color: #d0d0d0;">ev</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">)</span>
<span style="color: #6ab825; font-weight: bold;">if</span> <span style="color: #ed9d13;">'Hard'</span> <span style="color: #6ab825; font-weight: bold;">in</span> <span style="color: #d0d0d0;">eInfo[</span><span style="color: #3677a9;">0</span><span style="color: #d0d0d0;">]:</span>
<span style="color: #d0d0d0;">hardList.append(edge)</span>
<span style="color: #6ab825; font-weight: bold;">else</span><span style="color: #d0d0d0;">:</span>
<span style="color: #d0d0d0;">softList.append(edge)</span>
<span style="color: #6ab825; font-weight: bold;">if</span> <span style="color: #d0d0d0;">softList:</span>
<span style="color: #d0d0d0;">cmds.polyCrease(softList,</span> <span style="color: #d0d0d0;">operation</span> <span style="color: #d0d0d0;">=</span> <span style="color: #3677a9;">1</span><span style="color: #d0d0d0;">)</span>
<span style="color: #6ab825; font-weight: bold;">if</span> <span style="color: #d0d0d0;">hardList:</span>
<span style="color: #d0d0d0;">cmds.polyCrease(hardList,</span> <span style="color: #d0d0d0;">value</span> <span style="color: #d0d0d0;">=</span> <span style="color: #3677a9;">10</span><span style="color: #d0d0d0;">)</span>
<span style="color: #d0d0d0;">cmds.select(selection,</span> <span style="color: #d0d0d0;">r</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">)</span>
<span style="color: #d0d0d0;">edgeCreaser.apply(</span><span style="color: #ed9d13;">'c2n'</span><span style="color: #d0d0d0;">)</span>
</pre>
</td></tr>
</tbody></table>
</div>
</div>
Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.com2tag:blogger.com,1999:blog-7183744988148826412.post-73852874023606056552012-12-25T11:16:00.000-08:002012-12-25T11:31:54.383-08:00Syntax Highlighter whitespace bug<div dir="ltr" style="text-align: left;" trbidi="on">
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 "<b>ANDnbsp</b>" 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 <a href="http://hilite.me">http://hilite.me</a>
<br /></div>Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.com0tag:blogger.com,1999:blog-7183744988148826412.post-79968875144139280832012-12-23T22:13:00.000-08:002013-03-28T02:24:04.634-07:00Maya PyQt UI template<div dir="ltr" style="text-align: left;" trbidi="on">
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 <i>uifile = 'c:/test.ui' </i>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.
</div>
<!-- HTML generated using hilite.me --><br />
<div style="background: #202020; background: black; border-width: .1em .1em .1em .8em; border: solid gray; color: white; overflow: auto; padding: .2em .6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0;"> 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</pre>
</td><td><pre style="line-height: 125%; margin: 0;"><span style="color: #6ab825; font-weight: bold;">import</span> <span style="color: #447fcf; text-decoration: underline;">maya.OpenMayaUI</span> <span style="color: #6ab825; font-weight: bold;">as</span> <span style="color: #447fcf; text-decoration: underline;">apiUI</span>
<span style="color: #6ab825; font-weight: bold;">from</span> <span style="color: #447fcf; text-decoration: underline;">PyQt4</span> <span style="color: #6ab825; font-weight: bold;">import</span> <span style="color: #d0d0d0;">QtCore,</span> <span style="color: #d0d0d0;">uic</span>
<span style="color: #6ab825; font-weight: bold;">import</span> <span style="color: #447fcf; text-decoration: underline;">sip</span>
<span style="color: #d0d0d0;">uifile</span> <span style="color: #d0d0d0;">=</span> <span style="color: #ed9d13;">'c:/test.ui'</span>
<span style="color: #d0d0d0;">form,</span> <span style="color: #d0d0d0;">base</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">uic.loadUiType(uifile)</span>
<span style="color: #6ab825; font-weight: bold;">def</span> <span style="color: #447fcf;">getMayaWindow</span><span style="color: #d0d0d0;">():</span>
<span style="color: #ed9d13;">"""</span>
<span style="color: #ed9d13;"> Get the main Maya window as a QtGui.QMainWindow instance</span>
<span style="color: #ed9d13;"> @return: QtGui.QMainWindow instance of the top level Maya windows</span>
<span style="color: #ed9d13;"> """</span>
<span style="color: #d0d0d0;">ptr</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">apiUI.MQtUtil.mainWindow()</span>
<span style="color: #6ab825; font-weight: bold;">if</span> <span style="color: #d0d0d0;">ptr</span> <span style="color: #6ab825; font-weight: bold;">is</span> <span style="color: #6ab825; font-weight: bold;">not</span> <span style="color: #24909d;">None</span><span style="color: #d0d0d0;">:</span>
<span style="color: #6ab825; font-weight: bold;">return</span> <span style="color: #d0d0d0;">sip.wrapinstance(</span><span style="color: #24909d;">long</span><span style="color: #d0d0d0;">(ptr),</span> <span style="color: #d0d0d0;">QtCore.QObject)</span>
<span style="color: #6ab825; font-weight: bold;">class</span> <span style="color: #447fcf; text-decoration: underline;">testQtWindow</span><span style="color: #d0d0d0;">(form,</span> <span style="color: #d0d0d0;">base):</span>
<span style="color: #6ab825; font-weight: bold;">def</span> <span style="color: #447fcf;">__init__</span><span style="color: #d0d0d0;">(</span><span style="color: #24909d;">self</span><span style="color: #d0d0d0;">,</span> <span style="color: #d0d0d0;">parent</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">getMayaWindow()):</span>
<span style="color: #24909d;">super</span><span style="color: #d0d0d0;">(testQtWindow,</span><span style="color: #24909d;">self</span><span style="color: #d0d0d0;">).__init__(parent)</span>
<span style="color: #24909d;">self</span><span style="color: #d0d0d0;">.setupUi(</span><span style="color: #24909d;">self</span><span style="color: #d0d0d0;">)</span>
<span style="color: #6ab825; font-weight: bold;">def</span> <span style="color: #447fcf;">main</span><span style="color: #d0d0d0;">():</span>
<span style="color: #6ab825; font-weight: bold;">global</span> <span style="color: #d0d0d0;">win</span>
<span style="color: #6ab825; font-weight: bold;">try</span><span style="color: #d0d0d0;">:</span>
<span style="color: #d0d0d0;">win.close()</span>
<span style="color: #6ab825; font-weight: bold;">except</span><span style="color: #d0d0d0;">:</span>
<span style="color: #6ab825; font-weight: bold;">pass</span>
<span style="color: #d0d0d0;">win</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">testQtWindow()</span>
<span style="color: #d0d0d0;">win.show()</span>
<span style="color: #6ab825; font-weight: bold;">if</span> <span style="color: #d0d0d0;">__name__==</span><span style="color: #ed9d13;">"__main__"</span><span style="color: #d0d0d0;">:</span>
<span style="color: #d0d0d0;">main()</span>
</pre>
</td></tr>
</tbody></table>
</div>
Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.com0tag:blogger.com,1999:blog-7183744988148826412.post-59791746167964960472012-12-21T11:52:00.002-08:002012-12-21T11:52:58.862-08:00Man head sculpt. Anatomy practice.Started as quicksculpt, but later decided to spend more time on it.
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNSGWQDCOq43iMN8VXFINbdLcKtYh4ColeFErjtcwUwYDBM7lGP_eu4gC1NTZmd9y2Z5uWlp3vNmBmJocBWxT9_YpJNsdoGlgN4BA1x9rbd20_uTe4kXUpSIphrLEBgC1OBQCKbQ7ljQzN/s1600/quickhead02.12.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="320" width="273" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNSGWQDCOq43iMN8VXFINbdLcKtYh4ColeFErjtcwUwYDBM7lGP_eu4gC1NTZmd9y2Z5uWlp3vNmBmJocBWxT9_YpJNsdoGlgN4BA1x9rbd20_uTe4kXUpSIphrLEBgC1OBQCKbQ7ljQzN/s320/quickhead02.12.jpg" /></a></div>
Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.com0tag:blogger.com,1999:blog-7183744988148826412.post-46848468623375567262012-12-21T02:57:00.000-08:002012-12-24T00:14:23.692-08:00PyQt application template<div dir="ltr" style="text-align: left;" trbidi="on">
This is template for PyQt application. It's good point to start studying PyQt.<br />
<ul style="text-align: left;">
<li>create ui-file in QtDesigner</li>
<li>save it to disk</li>
<li>replace 'c:/test.ui' with real path to created ui</li>
<li>execute py-file. Make sure to run it with <i>pythonw</i>, not with <i>python</i>. In this case, command window will not pop up (on windows system).</li>
</ul>
</div>
<!-- HTML generated using hilite.me --><div style="background: #202020; overflow:auto;width:auto;color:white;background:black;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><table><tr><td><pre style="margin: 0; line-height: 125%"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24</pre></td><td><pre style="margin: 0; line-height: 125%"><span style="color: #6ab825; font-weight: bold">from</span> <span style="color: #447fcf; text-decoration: underline">PyQt4</span> <span style="color: #6ab825; font-weight: bold">import</span> <span style="color: #d0d0d0">QtGui,</span> <span style="color: #d0d0d0">uic</span>
<span style="color: #6ab825; font-weight: bold">import</span> <span style="color: #447fcf; text-decoration: underline">sys</span>
<span style="color: #999999; font-style: italic"># replace 'c:/test.ui' with real path to ui-file created in QtDesigner</span>
<span style="color: #d0d0d0">uifile</span> <span style="color: #d0d0d0">=</span> <span style="color: #ed9d13">'c:/test.ui'</span>
<span style="color: #d0d0d0">form,</span> <span style="color: #d0d0d0">base</span> <span style="color: #d0d0d0">=</span> <span style="color: #d0d0d0">uic.loadUiType(uifile)</span>
<span style="color: #6ab825; font-weight: bold">class</span> <span style="color: #447fcf; text-decoration: underline">testQtWindow</span><span style="color: #d0d0d0">(QtGui.QMainWindow):</span>
<span style="color: #6ab825; font-weight: bold">def</span> <span style="color: #447fcf">__init__</span><span style="color: #d0d0d0">(</span><span style="color: #24909d">self</span><span style="color: #d0d0d0">,</span> <span style="color: #d0d0d0">parent=</span><span style="color: #24909d">None</span><span style="color: #d0d0d0">):</span>
<span style="color: #d0d0d0">QtGui.QWidget.__init__(</span><span style="color: #24909d">self</span><span style="color: #d0d0d0">,</span> <span style="color: #d0d0d0">parent)</span>
<span style="color: #24909d">self</span><span style="color: #d0d0d0">.ui</span> <span style="color: #d0d0d0">=</span> <span style="color: #d0d0d0">form()</span>
<span style="color: #24909d">self</span><span style="color: #d0d0d0">.ui.setupUi(</span><span style="color: #24909d">self</span><span style="color: #d0d0d0">)</span>
<span style="color: #6ab825; font-weight: bold">def</span> <span style="color: #447fcf">main</span><span style="color: #d0d0d0">():</span>
<span style="color: #d0d0d0">app</span> <span style="color: #d0d0d0">=</span> <span style="color: #d0d0d0">QtGui.QApplication(sys.argv)</span>
<span style="color: #d0d0d0">myapp</span> <span style="color: #d0d0d0">=</span> <span style="color: #d0d0d0">testQtWindow()</span>
<span style="color: #d0d0d0">myapp.show()</span>
<span style="color: #d0d0d0">sys.exit(app.exec_())</span>
<span style="color: #6ab825; font-weight: bold">if</span> <span style="color: #d0d0d0">__name__==</span><span style="color: #ed9d13">"__main__"</span><span style="color: #d0d0d0">:</span>
<span style="color: #d0d0d0">main()</span>
</pre></td></tr></table></div>
Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.com0tag:blogger.com,1999:blog-7183744988148826412.post-46859965418107070352012-12-19T10:57:00.002-08:002012-12-19T12:12:00.886-08:00Split face between selected vertices in MAYA<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
This MEL-script splits face between selected vertices. Both vertices should belong to one face. New adge will be constructed between selected verts.</div>
Usage:<br />
- copy script to you scripts directory<br />
- source it in MAYA (or reboot maya)<br />
- select to vertices on mesh<br />
- run command <i>isplitByVertex </i>or place it on shelf
<br />
<a href="https://www.opendrive.com/files?MF81MTM5OTgxX2s4SVJL">Download script</a></div>
Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.com0tag:blogger.com,1999:blog-7183744988148826412.post-42972333919205654602012-12-17T12:50:00.001-08:002013-01-31T12:35:00.076-08:00Switch wireframe on shaded.<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
One more small script. Now to use shelf button to switch wireframe on shaded mode. Instead of Shading->Wireframe on shaded menu.<br />
Usage:<br />
- make new shelf button with script text (python command)<br />
- press "5" to turn shaded view in current MAYA viewport<br />
- press created shelf button<br />
It turns on and off wireframe on objects in current viewport.</div>
<!-- HTML generated using hilite.me --><br />
<div style="background: #202020; background: black; border-width: .1em .1em .1em .8em; border: solid gray; color: white; overflow: auto; padding: .2em .6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16</pre>
</td><td><pre style="line-height: 125%; margin: 0;"><span style="color: #ed9d13;">'''</span>
<span style="color: #ed9d13;">@author: Serge Scherbakov</span>
<span style="color: #ed9d13;">Date: 25.07.2012</span>
<span style="color: #ed9d13;">'''</span>
<span style="color: #6ab825; font-weight: bold;">import</span> <span style="color: #447fcf; text-decoration: underline;">maya.cmds</span> <span style="color: #6ab825; font-weight: bold;">as</span> <span style="color: #447fcf; text-decoration: underline;">cmds</span>
<span style="color: #6ab825; font-weight: bold;">def</span> <span style="color: #447fcf;">wireframeSwitcher</span><span style="color: #d0d0d0;">():</span>
<span style="color: #d0d0d0;">viewport</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">cmds.getPanel(</span> <span style="color: #d0d0d0;">withFocus</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">)</span>
<span style="color: #6ab825; font-weight: bold;">if</span> <span style="color: #ed9d13;">'modelPanel'</span> <span style="color: #6ab825; font-weight: bold;">in</span> <span style="color: #d0d0d0;">viewport:</span>
<span style="color: #d0d0d0;">currentState</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">cmds.modelEditor(</span> <span style="color: #d0d0d0;">viewport,</span> <span style="color: #d0d0d0;">q</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">,</span> <span style="color: #d0d0d0;">wireframeOnShaded</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">)</span>
<span style="color: #6ab825; font-weight: bold;">if</span> <span style="color: #d0d0d0;">currentState:</span>
<span style="color: #d0d0d0;">cmds.modelEditor(</span> <span style="color: #d0d0d0;">viewport,</span> <span style="color: #d0d0d0;">edit</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">,</span> <span style="color: #d0d0d0;">wireframeOnShaded</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">False</span><span style="color: #d0d0d0;">)</span>
<span style="color: #6ab825; font-weight: bold;">else</span><span style="color: #d0d0d0;">:</span>
<span style="color: #d0d0d0;">cmds.modelEditor(</span> <span style="color: #d0d0d0;">viewport,</span> <span style="color: #d0d0d0;">edit</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">,</span> <span style="color: #d0d0d0;">wireframeOnShaded</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">)</span>
<span style="color: #d0d0d0;">wireframeSwitcher()</span>
</pre>
</td></tr>
</tbody></table>
</div>
</div>
Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.com2tag:blogger.com,1999:blog-7183744988148826412.post-30431968286997635602012-12-17T12:34:00.000-08:002013-01-15T13:29:43.256-08:00Align pivots in Maya<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
This script allows you to copy object pivot translation and rotation from one object to another one.
How to use:<br />
- copy code to the script editor "Python tab"<br />
- select source object<br />
- select target object<br />
- execute script<br />
Works on multiple selection. Align all object pivots with last selected.
</div>
<!-- HTML generated using hilite.me --><br />
<div style="background: #202020; background: black; border-width: .1em .1em .1em .8em; border: solid gray; color: white; overflow: auto; padding: .2em .6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0;"> 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</pre>
</td><td><pre style="line-height: 125%; margin: 0;"><span style="color: #ed9d13;">'''</span>
<span style="color: #ed9d13;">Align pivots by Serge Scherbakov.</span>
<span style="color: #ed9d13;">Usage:</span>
<span style="color: #ed9d13;">1. Select source object(s)</span>
<span style="color: #ed9d13;">2. Add to selection target object</span>
<span style="color: #ed9d13;">3. Run script by 'import copyPivot\n copyPivot.copyPivot()</span>
<span style="color: #ed9d13;">'''</span>
<span style="color: #6ab825; font-weight: bold;">import</span> <span style="color: #447fcf; text-decoration: underline;">maya.cmds</span> <span style="color: #6ab825; font-weight: bold;">as</span> <span style="color: #447fcf; text-decoration: underline;">cmds</span>
<span style="color: #6ab825; font-weight: bold;">import</span> <span style="color: #447fcf; text-decoration: underline;">maya.mel</span> <span style="color: #6ab825; font-weight: bold;">as</span> <span style="color: #447fcf; text-decoration: underline;">mel</span>
<span style="color: #6ab825; font-weight: bold;">def</span> <span style="color: #447fcf;">copyPivot</span> <span style="color: #d0d0d0;">():</span>
<span style="color: #d0d0d0;">sourceObj</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">cmds.ls(sl</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">)[</span><span style="color: #24909d;">len</span><span style="color: #d0d0d0;">(cmds.ls(sl</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">))-</span><span style="color: #3677a9;">1</span><span style="color: #d0d0d0;">]</span>
<span style="color: #d0d0d0;">targetObj</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">cmds.ls(sl</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">)[</span><span style="color: #3677a9;">0</span><span style="color: #d0d0d0;">:(</span><span style="color: #24909d;">len</span><span style="color: #d0d0d0;">(cmds.ls(sl</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">))-</span><span style="color: #3677a9;">1</span><span style="color: #d0d0d0;">)]</span>
<span style="color: #d0d0d0;">parentList</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">[]</span>
<span style="color: #6ab825; font-weight: bold;">for</span> <span style="color: #d0d0d0;">obj</span> <span style="color: #6ab825; font-weight: bold;">in</span> <span style="color: #d0d0d0;">targetObj:</span>
<span style="color: #6ab825; font-weight: bold;">if</span> <span style="color: #d0d0d0;">cmds.listRelatives(</span> <span style="color: #d0d0d0;">obj,</span> <span style="color: #d0d0d0;">parent</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">):</span>
<span style="color: #d0d0d0;">parentList.append(cmds.listRelatives(</span> <span style="color: #d0d0d0;">obj,</span> <span style="color: #d0d0d0;">parent</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">)[</span><span style="color: #3677a9;">0</span><span style="color: #d0d0d0;">])</span>
<span style="color: #6ab825; font-weight: bold;">else</span><span style="color: #d0d0d0;">:</span>
<span style="color: #d0d0d0;">parentList.append(</span><span style="color: #ed9d13;">''</span><span style="color: #d0d0d0;">)</span>
<span style="color: #6ab825; font-weight: bold;">if</span> <span style="color: #24909d;">len</span><span style="color: #d0d0d0;">(cmds.ls(sl</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">))<</span><span style="color: #3677a9;">2</span><span style="color: #d0d0d0;">:</span>
<span style="color: #d0d0d0;">cmds.error(</span><span style="color: #ed9d13;">'select 2 or more objects.'</span><span style="color: #d0d0d0;">)</span>
<span style="color: #d0d0d0;">pivotTranslate</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">cmds.xform</span> <span style="color: #d0d0d0;">(sourceObj,</span> <span style="color: #d0d0d0;">q</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">,</span> <span style="color: #d0d0d0;">ws</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">,</span> <span style="color: #d0d0d0;">rotatePivot</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">)</span>
<span style="color: #d0d0d0;">cmds.parent(targetObj,</span> <span style="color: #d0d0d0;">sourceObj)</span>
<span style="color: #d0d0d0;">cmds.makeIdentity(targetObj,</span> <span style="color: #d0d0d0;">a</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">,</span> <span style="color: #d0d0d0;">t</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">,</span> <span style="color: #d0d0d0;">r</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">,</span> <span style="color: #d0d0d0;">s</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">)</span>
<span style="color: #d0d0d0;">cmds.xform</span> <span style="color: #d0d0d0;">(targetObj,</span> <span style="color: #d0d0d0;">ws</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">,</span> <span style="color: #d0d0d0;">pivots</span> <span style="color: #d0d0d0;">=</span> <span style="color: #d0d0d0;">pivotTranslate)</span>
<span style="color: #6ab825; font-weight: bold;">for</span> <span style="color: #d0d0d0;">ind</span> <span style="color: #6ab825; font-weight: bold;">in</span> <span style="color: #24909d;">range</span><span style="color: #d0d0d0;">(</span><span style="color: #24909d;">len</span><span style="color: #d0d0d0;">(targetObj)):</span>
<span style="color: #6ab825; font-weight: bold;">if</span> <span style="color: #d0d0d0;">parentList[ind]</span> <span style="color: #d0d0d0;">!=</span> <span style="color: #ed9d13;">''</span> <span style="color: #d0d0d0;">:</span>
<span style="color: #d0d0d0;">cmds.parent(targetObj[ind],</span> <span style="color: #d0d0d0;">parentList[ind])</span>
<span style="color: #6ab825; font-weight: bold;">else</span><span style="color: #d0d0d0;">:</span>
<span style="color: #d0d0d0;">cmds.parent(targetObj[ind],</span> <span style="color: #d0d0d0;">world</span> <span style="color: #d0d0d0;">=</span> <span style="color: #24909d;">True</span><span style="color: #d0d0d0;">)</span>
<span style="color: #d0d0d0;">copyPivot()</span>
</pre>
</td></tr>
</tbody></table>
</div>
</div>
Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.com17tag:blogger.com,1999:blog-7183744988148826412.post-23248103515710497222012-12-17T12:03:00.001-08:002012-12-19T12:12:40.567-08:00Extract poly component index in 1 string.<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
To extract index of maya polycomponent (face, edge or vertex) you can use the following expression. Python power is awesome.</div>
<pre class="brush:python;">edgeIndex = str(edge).split('[')[1].split(']')[0]
</pre>
</div>
Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.com1tag:blogger.com,1999:blog-7183744988148826412.post-73483375100735410622012-04-02T06:57:00.001-07:002012-12-18T03:05:39.818-08:00goblin rogue WIP5<div dir="ltr" style="text-align: left;" trbidi="on">
Two new WIPs of the model i'm working on.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_Fr17lYYJzEimNLCwKsDWELl_UkZW8YdAlGuVixr6QYzV1sACpeMEvLJsQTIthEX9jX9sUbNdlZvoLUpNrC2ZdWr0TNj0btwcUhXWsngaQKdqiUHLWMc3ZeObgC9a_ngMbssSVUtKR-97/s1600/wip51.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="193" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_Fr17lYYJzEimNLCwKsDWELl_UkZW8YdAlGuVixr6QYzV1sACpeMEvLJsQTIthEX9jX9sUbNdlZvoLUpNrC2ZdWr0TNj0btwcUhXWsngaQKdqiUHLWMc3ZeObgC9a_ngMbssSVUtKR-97/s400/wip51.jpg" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxfrSKwlTqsCgSE_p3nVCrkli1K6jfvf-28ZwRqeu1AuZvEWofkszyi_VXLsXcD6_pTt18Dsa2wxN_3Ad5Yv4SrHmvXQYRFh9ClbSQn40N_8PX2zUqiiebe26B-lysTMiaCodR-U3V-Yn5/s1600/wip5_closer.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxfrSKwlTqsCgSE_p3nVCrkli1K6jfvf-28ZwRqeu1AuZvEWofkszyi_VXLsXcD6_pTt18Dsa2wxN_3Ad5Yv4SrHmvXQYRFh9ClbSQn40N_8PX2zUqiiebe26B-lysTMiaCodR-U3V-Yn5/s400/wip5_closer.jpg" width="400" /></a></div>
<br />
<br /></div>Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.com0tag:blogger.com,1999:blog-7183744988148826412.post-56638447771204584002012-03-27T06:50:00.003-07:002012-03-27T06:50:43.493-07:00Shoulder armor test polypaint<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNfjE-Qv-pVXt3PERhw1IPPaHY8RvQOxByouDx96mHmVHEOEH_61TUGTvf3Ldu8Wa-JEnTH29Oesezqoa7iBIz_ezdRUy8unuqdEYVfOef50dxoCNPK1qr7jUykvNOt5WGddh-3OSKcHAe/s1600/wip4.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="232" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNfjE-Qv-pVXt3PERhw1IPPaHY8RvQOxByouDx96mHmVHEOEH_61TUGTvf3Ldu8Wa-JEnTH29Oesezqoa7iBIz_ezdRUy8unuqdEYVfOef50dxoCNPK1qr7jUykvNOt5WGddh-3OSKcHAe/s400/wip4.jpg" width="400" /></a></div>
<br /></div>Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.com0tag:blogger.com,1999:blog-7183744988148826412.post-77948455398750177432012-03-19T07:12:00.000-07:002012-03-19T07:12:55.602-07:00goblin model progress<div dir="ltr" style="text-align: left;" trbidi="on">
Just want to share progress in goblin modelling.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjE8Xe2B52L4b_KusVU0zUrp0sJ7x3kEf8-52ymkNvj03OrIc0ObqI565Px6nkSYy4B7yCRLQZVCEE9t9tvhS-lDE_ebpwmV3Y27SDE3ktwpH6j7a2ZFTJQpCZsuY8_tLZVwgdCFzAqhK6x/s1600/wip3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="186" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjE8Xe2B52L4b_KusVU0zUrp0sJ7x3kEf8-52ymkNvj03OrIc0ObqI565Px6nkSYy4B7yCRLQZVCEE9t9tvhS-lDE_ebpwmV3Y27SDE3ktwpH6j7a2ZFTJQpCZsuY8_tLZVwgdCFzAqhK6x/s400/wip3.jpg" width="400" /></a></div>
<br /></div>Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.com0tag:blogger.com,1999:blog-7183744988148826412.post-10392532785875875772012-03-14T07:14:00.000-07:002012-03-14T07:14:25.678-07:00Goblin rogue WIP<div dir="ltr" style="text-align: left;" trbidi="on">
I would like to share with you some shots from my current project. It's goblin rogue model with Tier5 armor.<br />
The first image is Blizzard art which i use as reference.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxmXRcNVXwqIDw6r5wms01qBownbDMipLBh0oCHEuoevkYNTdZNyokT9jQlyunDWa-L0VEdl1Oz1Un9fQll4NdGdzDzwSXguTtEL7EXNGA3noUDhFT9vL9-9p33CBRnBtWBcQEe2QpkMnr/s1600/goblin_1024x0768.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxmXRcNVXwqIDw6r5wms01qBownbDMipLBh0oCHEuoevkYNTdZNyokT9jQlyunDWa-L0VEdl1Oz1Un9fQll4NdGdzDzwSXguTtEL7EXNGA3noUDhFT9vL9-9p33CBRnBtWBcQEe2QpkMnr/s320/goblin_1024x0768.jpg" width="320" /></a></div>
<br />
<br />
Body base shape:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPQiSpGt36potejTUYH-hMmjdoEhv8nKhekPt3-Un5ThQs6wMdlJmK29L3AWy51cvrXhS5IK19jKu-oxRxRCT-uRxXwBb2CSsmseueFo6_kGelbQbEB1R1ZZLhStlv3vIzMZY1noBDeniG/s1600/wip1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPQiSpGt36potejTUYH-hMmjdoEhv8nKhekPt3-Un5ThQs6wMdlJmK29L3AWy51cvrXhS5IK19jKu-oxRxRCT-uRxXwBb2CSsmseueFo6_kGelbQbEB1R1ZZLhStlv3vIzMZY1noBDeniG/s320/wip1.jpg" width="320" /></a></div>
<br />
Head with test polypaint:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgL7S311eJwjMHi2YgLKVzQMUuVkbGl1JtdezJqytYNokNegfzlN3TJSCyNwyA7dqC1fgGNq81akAc_B3QnVzn-ERPQXIabKA_GL1aLfuuZTQSigr-EgaOdOSX9IMdRZVujYxTztIfLpoy/s1600/wip2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgL7S311eJwjMHi2YgLKVzQMUuVkbGl1JtdezJqytYNokNegfzlN3TJSCyNwyA7dqC1fgGNq81akAc_B3QnVzn-ERPQXIabKA_GL1aLfuuZTQSigr-EgaOdOSX9IMdRZVujYxTztIfLpoy/s320/wip2.jpg" width="320" /></a></div>
<br />
Another view of head:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgE97oW8daEPgf0fho1ctyf_yd2met8QnsYtIHbDzR8Faf6BmRD5-8rm9gw_24aEZWjYLS35YV6blcc6Lm8HcVNSqoQLkZ54fuMkFN9LDX6zXIuLi03NcfUruTCJc-ams0_RpaUMo8vrG-Q/s1600/wip2a.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgE97oW8daEPgf0fho1ctyf_yd2met8QnsYtIHbDzR8Faf6BmRD5-8rm9gw_24aEZWjYLS35YV6blcc6Lm8HcVNSqoQLkZ54fuMkFN9LDX6zXIuLi03NcfUruTCJc-ams0_RpaUMo8vrG-Q/s320/wip2a.jpg" width="320" /></a></div>
<br /></div>Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.com0tag:blogger.com,1999:blog-7183744988148826412.post-60035275686794552932012-03-14T07:02:00.001-07:002012-03-14T07:04:42.471-07:00World of Warcraft rifle (final)<div dir="ltr" style="text-align: left;" trbidi="on">
Final model with poly paint. Zbrush BPR render.<br />
Hope you like it. Any comments are welcome.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTws0AqrFoFLXQVfd9k_2Q8tQ3HEhj0PZ-whBtvX2o8nBfQdufaRizZzYxVqrKAUmhHkDZWn_3cQM-3clhiIdukL-zuTQu8NwuF_Fu_qBoJPp8VfZf36FtsxWbmKlVOzpIYdSdQYKxABol/s1600/rifle_compose.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="255" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTws0AqrFoFLXQVfd9k_2Q8tQ3HEhj0PZ-whBtvX2o8nBfQdufaRizZzYxVqrKAUmhHkDZWn_3cQM-3clhiIdukL-zuTQu8NwuF_Fu_qBoJPp8VfZf36FtsxWbmKlVOzpIYdSdQYKxABol/s400/rifle_compose.jpg" width="400" /></a></div>
<br /></div>Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.com0tag:blogger.com,1999:blog-7183744988148826412.post-18930262759194987962012-03-11T01:34:00.002-08:002012-12-18T03:06:03.348-08:00Oaf polypainted<div dir="ltr" style="text-align: left;" trbidi="on">
Let me introduce you Hobgoblin Oaf!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaaYN3kwjozn_t1HgK-vUVP8_vAo1V88Y2JLAqZwDOIM8e4b_dNiNnVJtkJ6_QhyYIVCq32VloxQleXY0lFjHzqa1_ZIWTnPixIymj_X-OZBY5mftncGP4DYt3h5NNLc3Q8DmNYfCYkO9e/s1600/Ogre_compose.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="204" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaaYN3kwjozn_t1HgK-vUVP8_vAo1V88Y2JLAqZwDOIM8e4b_dNiNnVJtkJ6_QhyYIVCq32VloxQleXY0lFjHzqa1_ZIWTnPixIymj_X-OZBY5mftncGP4DYt3h5NNLc3Q8DmNYfCYkO9e/s320/Ogre_compose.jpg" width="320" /></a></div>
<br /></div>Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.com0tag:blogger.com,1999:blog-7183744988148826412.post-68328542877954084662012-03-05T22:33:00.003-08:002012-03-05T22:33:44.235-08:00Sci-fi armor<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
</div>
<div style="text-align: left;">
Sci-fi armor WIP. Need to change some parts, and add details.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXde8-5LTRI-zg9BUlxiz8WCKzlOp-o_3z8mjzgpRlwJKwGb7AlPHU_hN8jTxlTkpY5G_RPZhiFYfGkkyFnyYjGUFM0MsVemr4fjVg7Pf6KxR_0LbHhO1oC-OsULsYdzqw6qrOhqF6-jxz/s1600/femaleArmor_WIP2_compose.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="255" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXde8-5LTRI-zg9BUlxiz8WCKzlOp-o_3z8mjzgpRlwJKwGb7AlPHU_hN8jTxlTkpY5G_RPZhiFYfGkkyFnyYjGUFM0MsVemr4fjVg7Pf6KxR_0LbHhO1oC-OsULsYdzqw6qrOhqF6-jxz/s400/femaleArmor_WIP2_compose.jpg" width="400" /></a></div>
<br /></div>Sergehttp://www.blogger.com/profile/16154540237706105618noreply@blogger.com2