Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BlenderPhi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
raas
BlenderPhi
Commits
998b9241
Commit
998b9241
authored
May 5, 2013
by
Campbell Barton
Browse files
Options
Downloads
Patches
Plain Diff
correct bmesh api crossref and update uv-operator template.
parent
36c4dc2d
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
release/scripts/templates_py/operator_uv.py
+11
-18
11 additions, 18 deletions
release/scripts/templates_py/operator_uv.py
source/blender/python/bmesh/bmesh_py_types.c
+15
-6
15 additions, 6 deletions
source/blender/python/bmesh/bmesh_py_types.c
with
26 additions
and
24 deletions
release/scripts/templates_py/operator_uv.py
+
11
−
18
View file @
998b9241
import
bpy
import
bpy
import
bmesh
def
main
(
context
):
def
main
(
context
):
obj
=
context
.
active_object
obj
=
context
.
active_object
mesh
=
obj
.
data
me
=
obj
.
data
bm
=
bmesh
.
from_edit_mesh
(
me
)
is_editmode
=
(
obj
.
mode
==
'
EDIT
'
)
uv_layer
=
bm
.
loops
.
layers
.
uv
.
verify
()
if
is_editmode
:
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
OBJECT
'
,
toggle
=
False
)
if
not
mesh
.
uv_textures
:
uvtex
=
bpy
.
ops
.
mesh
.
uv_texture_add
()
else
:
uvtex
=
mesh
.
uv_textures
.
active
# adjust UVs
# adjust UVs
for
i
,
uv
in
enumerate
(
uvtex
.
data
)
:
for
f
in
bm
.
faces
:
uvs
=
uv
.
uv1
,
uv
.
uv2
,
uv
.
uv3
,
uv
.
uv4
for
l
in
f
.
loops
:
for
j
,
v_idx
in
enumerate
(
mesh
.
faces
[
i
].
vertices
):
luv
=
l
[
uv_layer
]
if
uv
.
select
_uv
[
j
]
:
if
l
uv
.
select
:
# apply the location of the vertex as a UV
# apply the location of the vertex as a UV
uv
s
[
j
][:]
=
mesh
.
vertices
[
v_idx
]
.
co
.
xy
l
uv
.
uv
=
l
.
vert
.
co
.
xy
if
is_editmode
:
bmesh
.
update_edit_mesh
(
me
)
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
EDIT
'
,
toggle
=
False
)
class
UvOperator
(
bpy
.
types
.
Operator
):
class
UvOperator
(
bpy
.
types
.
Operator
):
...
@@ -33,8 +27,7 @@ class UvOperator(bpy.types.Operator):
...
@@ -33,8 +27,7 @@ class UvOperator(bpy.types.Operator):
@classmethod
@classmethod
def
poll
(
cls
,
context
):
def
poll
(
cls
,
context
):
obj
=
context
.
active_object
return
(
context
.
mode
==
'
EDIT_MESH
'
)
return
(
obj
and
obj
.
type
==
'
MESH
'
)
def
execute
(
self
,
context
):
def
execute
(
self
,
context
):
main
(
context
)
main
(
context
)
...
...
This diff is collapsed.
Click to expand it.
source/blender/python/bmesh/bmesh_py_types.c
+
15
−
6
View file @
998b9241
...
@@ -592,8 +592,17 @@ static PyObject *bpy_bmloop_is_convex_get(BPy_BMLoop *self)
...
@@ -592,8 +592,17 @@ static PyObject *bpy_bmloop_is_convex_get(BPy_BMLoop *self)
* ^^^^^^^ */
* ^^^^^^^ */
/* note: use for bmvert/edge/face/loop seq's use these, not bmelemseq directly */
/* note: use for bmvert/edge/face/loop seq's use these, not bmelemseq directly */
PyDoc_STRVAR
(
bpy_bmelemseq_layers_doc
,
PyDoc_STRVAR
(
bpy_bmelemseq_layers_vert_doc
,
"custom-data layers (read-only).
\n\n
:type: :class:`BMLayerAccess`"
"custom-data layers (read-only).
\n\n
:type: :class:`BMLayerAccessVert`"
);
PyDoc_STRVAR
(
bpy_bmelemseq_layers_edge_doc
,
"custom-data layers (read-only).
\n\n
:type: :class:`BMLayerAccessEdge`"
);
PyDoc_STRVAR
(
bpy_bmelemseq_layers_face_doc
,
"custom-data layers (read-only).
\n\n
:type: :class:`BMLayerAccessFace`"
);
PyDoc_STRVAR
(
bpy_bmelemseq_layers_loop_doc
,
"custom-data layers (read-only).
\n\n
:type: :class:`BMLayerAccessLoop`"
);
);
static
PyObject
*
bpy_bmelemseq_layers_get
(
BPy_BMElemSeq
*
self
,
void
*
htype
)
static
PyObject
*
bpy_bmelemseq_layers_get
(
BPy_BMElemSeq
*
self
,
void
*
htype
)
{
{
...
@@ -759,21 +768,21 @@ static PyGetSetDef bpy_bmloop_getseters[] = {
...
@@ -759,21 +768,21 @@ static PyGetSetDef bpy_bmloop_getseters[] = {
};
};
static
PyGetSetDef
bpy_bmvertseq_getseters
[]
=
{
static
PyGetSetDef
bpy_bmvertseq_getseters
[]
=
{
{(
char
*
)
"layers"
,
(
getter
)
bpy_bmelemseq_layers_get
,
(
setter
)
NULL
,
(
char
*
)
bpy_bmelemseq_layers_doc
,
(
void
*
)
BM_VERT
},
{(
char
*
)
"layers"
,
(
getter
)
bpy_bmelemseq_layers_get
,
(
setter
)
NULL
,
(
char
*
)
bpy_bmelemseq_layers_
vert_
doc
,
(
void
*
)
BM_VERT
},
{
NULL
,
NULL
,
NULL
,
NULL
,
NULL
}
/* Sentinel */
{
NULL
,
NULL
,
NULL
,
NULL
,
NULL
}
/* Sentinel */
};
};
static
PyGetSetDef
bpy_bmedgeseq_getseters
[]
=
{
static
PyGetSetDef
bpy_bmedgeseq_getseters
[]
=
{
{(
char
*
)
"layers"
,
(
getter
)
bpy_bmelemseq_layers_get
,
(
setter
)
NULL
,
(
char
*
)
bpy_bmelemseq_layers_doc
,
(
void
*
)
BM_EDGE
},
{(
char
*
)
"layers"
,
(
getter
)
bpy_bmelemseq_layers_get
,
(
setter
)
NULL
,
(
char
*
)
bpy_bmelemseq_layers_
edge_
doc
,
(
void
*
)
BM_EDGE
},
{
NULL
,
NULL
,
NULL
,
NULL
,
NULL
}
/* Sentinel */
{
NULL
,
NULL
,
NULL
,
NULL
,
NULL
}
/* Sentinel */
};
};
static
PyGetSetDef
bpy_bmfaceseq_getseters
[]
=
{
static
PyGetSetDef
bpy_bmfaceseq_getseters
[]
=
{
{(
char
*
)
"layers"
,
(
getter
)
bpy_bmelemseq_layers_get
,
(
setter
)
NULL
,
(
char
*
)
bpy_bmelemseq_layers_doc
,
(
void
*
)
BM_FACE
},
{(
char
*
)
"layers"
,
(
getter
)
bpy_bmelemseq_layers_get
,
(
setter
)
NULL
,
(
char
*
)
bpy_bmelemseq_layers_
face_
doc
,
(
void
*
)
BM_FACE
},
/* face only */
/* face only */
{(
char
*
)
"active"
,
(
getter
)
bpy_bmfaceseq_active_get
,
(
setter
)
bpy_bmfaceseq_active_set
,
(
char
*
)
bpy_bmfaceseq_active_doc
,
NULL
},
{(
char
*
)
"active"
,
(
getter
)
bpy_bmfaceseq_active_get
,
(
setter
)
bpy_bmfaceseq_active_set
,
(
char
*
)
bpy_bmfaceseq_active_doc
,
NULL
},
{
NULL
,
NULL
,
NULL
,
NULL
,
NULL
}
/* Sentinel */
{
NULL
,
NULL
,
NULL
,
NULL
,
NULL
}
/* Sentinel */
};
};
static
PyGetSetDef
bpy_bmloopseq_getseters
[]
=
{
static
PyGetSetDef
bpy_bmloopseq_getseters
[]
=
{
{(
char
*
)
"layers"
,
(
getter
)
bpy_bmelemseq_layers_get
,
(
setter
)
NULL
,
(
char
*
)
bpy_bmelemseq_layers_doc
,
(
void
*
)
BM_LOOP
},
{(
char
*
)
"layers"
,
(
getter
)
bpy_bmelemseq_layers_get
,
(
setter
)
NULL
,
(
char
*
)
bpy_bmelemseq_layers_
loop_
doc
,
(
void
*
)
BM_LOOP
},
{
NULL
,
NULL
,
NULL
,
NULL
,
NULL
}
/* Sentinel */
{
NULL
,
NULL
,
NULL
,
NULL
,
NULL
}
/* Sentinel */
};
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment