Body
costumy.classes.Body
The Body
class is the base class for other bodies. It does not work directly.
Bodies offers simple ways to get measurements and references point to drape garment ontop of.
Source code in costumy/classes/body.py
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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
|
object = None
instance-attribute
Body's blender Object
armature = None
instance-attribute
Body's armature Object
pattern = None
instance-attribute
Copy of the last Pattern used in body.dressup
garment = None
instance-attribute
Garment created by body.dressup
references
property
Dict of various usefull points/positions in blender coordinates made from measurer and defined by the measurement_definition json.
measures
property
Dict of Measures in mm defined by the measurement_definitions.json
weight
property
EXPERIMENTAL: Approximative weight in kg of self.object
assuming its density is 1010kg/m³
height
property
EXPERIMENTAL:
Approximative height of self.object
in meters.
The body should be standing (a-pose or t-pose), not sitting/laying/bending
NOTE
This may not be accurate because it depends on the subclass implementation. It also depends on the pose. Having legs a bit apart will change the height a bit. Sitting or bending will make the height really bad.
NOTE
The height could be implemented in self.measure or self.references too, there might be a missmatch
__init__(measure_definitions)
Init a Body
class, meant to be use by class inerithing this one.
The measure_definitions can be the name of a file located in costumy/data/measurements_definitions
or a full path to an other json
Parameters:
Name | Type | Description | Default |
---|---|---|---|
measure_definitions
|
str | Path
|
name(str) of a measurements_definitions.json or its full Path |
required |
Source code in costumy/classes/body.py
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 |
|
setup()
Setup the body (Add the current body in the current bpy scene)
Source code in costumy/classes/body.py
60 61 62 |
|
dress_up(pattern, drape=True)
EXPERIMENTAL: Make a garment from a pattern and place it on the current body. Usefull to render human with clothes
makes a copy of the given pattern first, align it if its from a Design, and defines self.pattern
and self.garment
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pattern
|
Pattern
|
Pattern to make a garment |
required |
drape
|
bool
|
If false, garment is not simulated but still placed in 3D, great for quick debbuging. Defaults to True. |
True
|
Source code in costumy/classes/body.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
|
render_preview(output_path)
EXPERIMENTAL: Quick front face and ortographic viewport render of the current body, with its garment if any
Source code in costumy/classes/body.py
156 157 158 159 160 161 162 163 164 165 166 |
|
as_obj(output_path)
Export the body mesh as an obj
Source code in costumy/classes/body.py
168 169 170 171 |
|
costumy.bodies.SMPL
Bases: Body
SMPL (Restrictive licence, non commercial only) You must install the smpl_blender_addon and respect the licence to use
https://smpl.is.tue.mpg.de/
Source code in costumy/bodies/smpl.py
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 64 65 66 67 68 69 70 71 72 73 |
|
__init__(shapes=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], gender='female')
Initialize an SMPL body. SMPL is under a restrictive licence and must be installed manually. See docs/installation.md and https://smpl.is.tue.mpg.de/
Parameters:
Name | Type | Description | Default |
---|---|---|---|
shapes
|
list
|
List of SMPL body parameters. Defaults to [0,0,0,0,0,0,0,0,0,0]. |
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
gender
|
str
|
"male" or "female". Defaults to "female". |
'female'
|
Source code in costumy/bodies/smpl.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
from_random_shapes(gender='female')
classmethod
Init an SMPL body from random shapes between -2.5 and 2.5
Source code in costumy/bodies/smpl.py
29 30 31 32 33 |
|
costumy.bodies.Cmorph
Bases: Body
Cmorph Experimental class using mb-lab bodies (AGL3) with CharMorph Add-on
see https://github.com/Upliner/CharMorph and https://mb-lab-community.github.io/MB-Lab.github.io/
Source code in costumy/bodies/cmorph.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
|
morphs
property
Current charmorph morphs
__init__(age=0, mass=0, tone=0, base_model='mb_male', measurement_definition=None)
Init a Body
instance using CharMorph. Currently only supports
Parameters:
Name | Type | Description | Default |
---|---|---|---|
age
|
int
|
Factor between -1.0 and 1.0 affecting age related morphs. Defaults to 0. |
0
|
mass
|
int
|
Factor between -1.0 and 1.0 affecting mass related morphs. Defaults to 0. |
0
|
tone
|
int
|
Factor between -1.0 and 1.0 affecting tone related morphs. Defaults to 0. |
0
|
base_model
|
str
|
3D model name (mb_female, mb_male). Defaults to "mb_male". |
'mb_male'
|
measurement_definition
|
str | Path
|
measurement definition json file name or abs path. Defaults to None. |
None
|
Source code in costumy/bodies/cmorph.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
randomize(strength=0.25)
Randomize the body morphology
Source code in costumy/bodies/cmorph.py
156 157 158 159 160 161 162 163 |
|
clear_pose()
Set the pose bones rotation to 0
Source code in costumy/bodies/cmorph.py
165 166 167 168 169 |
|
jitter_pose(strength=0.25)
Set the rotation of some predefined bones randomly within predefined range of value
Parameters:
Name | Type | Description | Default |
---|---|---|---|
strength
|
float
|
How strong the rotation is. Defaults to 0.25. |
0.25
|
Source code in costumy/bodies/cmorph.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
|