The Guicommon Module

Project Name: MakeHuman

Product Home Page: http://www.makehuman.org/

Code Home Page: https://bitbucket.org/MakeHuman/makehuman/

Authors: Manuel Bastioni, Marc Flerackers

Copyright(c): MakeHuman Team 2001-2015

Licensing: AGPL3 (http://www.makehuman.org/doc/node/the_makehuman_application.html)

This file is part of MakeHuman (www.makehuman.org).

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Coding Standards: See http://www.makehuman.org/node/165

Abstract

Common GUI elements extracted from gui3d to minimize coupling with gui backend.

class guicommon.Object(mesh, position=[0.0, 0.0, 0.0], visible=True)[source]

An object on the screen.

Parameters:
  • position (list or tuple) – The position in 3d space.
  • mesh – The mesh object.
  • visible (Boolean) – Wether the object should be initially visible.
changeVertexMask(vertsMask)[source]

Apply a face mask to the meshes (original seed mesh, subdivided mesh and proxied meshes) specified by a vertex mask. The vertex mask is a list of booleans, one for each vertex, where True means not masked (visible), and False means masked (hidden). A face is masked if all of the vertices that define it are masked.

clearTexture()[source]

This method is used to clear an object’s texture.

configureShading(diffuse=None, bump=None, normal=None, displacement=None, spec=None, vertexColors=None)[source]

Configure shader options and set the necessary properties based on the material configuration of this object. This can be done without an actual shader being set for this object. Call this method when changes are made to the material property.

getSubdivisionMesh(update=True)[source]

Create or update the Catmull-Clark subdivided (or smoothed) mesh for this mesh. This does not change the status of isSubdivided(), use setSubdivided() for that.

If this mesh is doubled by a proxy, when isProxied() is true, a subdivision mesh for the proxy is used.

Returns the subdivided mesh data.

isSubdivided()[source]

Returns whether this mesh is currently set to be subdivided (or smoothed).

setCull(cull)[source]

This method is used to specify whether or not the object is back-face culled.

Parameters:cull (0 => no culling, >0 => draw front faces, <0 => draw back faces) – Whether and how to cull
setDepthless(depthless)[source]

This method is used to specify whether or not the object occludes or is occluded by other objects

Parameters:depthless (Boolean) – Whether or not the object is occluded or occludes.
setLoc(locx, locy, locz)[source]

This method is used to set the location of the object in the 3D coordinate space of the scene.

Parameters:
  • locx (float) – The x coordinate of the object.
  • locy (float) – The y coordinate of the object.
  • locz (float) – The z coordinate of the object.
setRot(rx, ry, rz)[source]

This method sets the orientation of the object in the 3D coordinate space of the scene.

Parameters:
  • rx (float) – Rotation around the x-axis.
  • ry (float) – Rotation around the y-axis.
  • rz (float) – Rotation around the z-axis.
setScale(scale, scaleY=None, scaleZ=1)[source]

This method sets the scale of the object in the 3D coordinate space of the scene, relative to the initially defined size of the object.

Parameters:
  • scale (float) – Scale along the x-axis, uniform scale if other params not specified.
  • scaleY (float) – Scale along the x-axis.
  • scaleZ (float) – Scale along the x-axis.
setShadeless(shadeless)[source]

This method is used to specify whether or not the object is affected by lights. This is used for certain GUI controls to give them a more 2D type appearance (predominantly the top bar of GUI controls).

NOTE enabling this option disables the use of the shader configured in the material.

Parameters:shadeless (Boolean) – Whether or not the object is unaffected by lights.
setShader(shader)[source]

This method is used to specify the shader.

Parameters:shader (string) – The path to a pair of shader files.
setShaderParameter(name, value)[source]

Updates the shader parameters.

setSolid(solid)[source]

This method is used to specify whether or not the object is drawn solid or wireframe.

Parameters:solid (Boolean) – Whether or not the object is drawn solid or wireframe.
setSubdivided(flag, update=True)[source]

Set whether this mesh is to be subdivided (or smoothed). When set to true, the subdivision mesh is automatically created or updated.

setTexture(path)[source]

This method is used to specify the path of a file on disk containing the object texture.

Parameters:
  • path (str) – The path of a texture file.
  • cache (dict) – The texture cache to use.

Table Of Contents

Previous topic

The Gui3D Module

Next topic

The Managed_file Module