Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blender-addons
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
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
blender-addons
Commits
1a967e18
Commit
1a967e18
authored
11 years ago
by
Paul Geraskin
Browse files
Options
Downloads
Patches
Plain Diff
[TextureAtlas] Many fixes:
- if polygons are hidde - If Object is non selectable - if object is hidden
parent
6a87cfc5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
uv_texture_atlas.py
+29
-22
29 additions, 22 deletions
uv_texture_atlas.py
with
29 additions
and
22 deletions
uv_texture_atlas.py
+
29
−
22
View file @
1a967e18
...
@@ -143,7 +143,8 @@ class RunAuto(Operator):
...
@@ -143,7 +143,8 @@ class RunAuto(Operator):
group
=
scene
.
ms_lightmap_groups
[
scene
.
ms_lightmap_groups_index
]
group
=
scene
.
ms_lightmap_groups
[
scene
.
ms_lightmap_groups_index
]
context
.
area
.
type
=
'
VIEW_3D
'
context
.
area
.
type
=
'
VIEW_3D
'
if
scene
.
objects
.
active
is
not
None
:
if
context
.
mode
is
not
'
OBJECT
'
and
scene
.
objects
.
active
is
not
None
:
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
OBJECT
'
,
toggle
=
False
)
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
OBJECT
'
,
toggle
=
False
)
if
group
.
bake
is
True
and
bpy
.
data
.
groups
[
group
.
name
].
objects
:
if
group
.
bake
is
True
and
bpy
.
data
.
groups
[
group
.
name
].
objects
:
...
@@ -173,15 +174,16 @@ class RunStart(Operator):
...
@@ -173,15 +174,16 @@ class RunStart(Operator):
def
execute
(
self
,
context
):
def
execute
(
self
,
context
):
scene
=
context
.
scene
scene
=
context
.
scene
#
old_context = context.area.type
old_context
=
context
.
area
.
type
# Check if group exists
# Check if group exists
if
check_group_exist
(
self
,
context
)
is
False
:
if
check_group_exist
(
self
,
context
)
is
False
:
return
{
'
CANCELLED
'
}
return
{
'
CANCELLED
'
}
context
.
area
.
type
=
'
VIEW_3D
'
group
=
scene
.
ms_lightmap_groups
[
scene
.
ms_lightmap_groups_index
]
group
=
scene
.
ms_lightmap_groups
[
scene
.
ms_lightmap_groups_index
]
if
scene
.
objects
.
active
is
not
None
:
if
context
.
mode
is
not
'
OBJECT
'
and
scene
.
objects
.
active
is
not
None
:
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
OBJECT
'
,
toggle
=
False
)
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
OBJECT
'
,
toggle
=
False
)
if
group
.
bake
is
True
and
bpy
.
data
.
groups
[
group
.
name
].
objects
and
bpy
.
data
.
objects
.
get
(
group
.
name
+
"
_mergedObject
"
)
is
None
:
if
group
.
bake
is
True
and
bpy
.
data
.
groups
[
group
.
name
].
objects
and
bpy
.
data
.
objects
.
get
(
group
.
name
+
"
_mergedObject
"
)
is
None
:
...
@@ -198,6 +200,8 @@ class RunStart(Operator):
...
@@ -198,6 +200,8 @@ class RunStart(Operator):
else
:
else
:
self
.
report
({
'
INFO
'
},
"
Not All Objects Are Visible!!!
"
)
self
.
report
({
'
INFO
'
},
"
Not All Objects Are Visible!!!
"
)
context
.
area
.
type
=
old_context
return
{
'
FINISHED
'
}
return
{
'
FINISHED
'
}
...
@@ -217,7 +221,7 @@ class RunFinish(Operator):
...
@@ -217,7 +221,7 @@ class RunFinish(Operator):
group
=
scene
.
ms_lightmap_groups
[
scene
.
ms_lightmap_groups_index
]
group
=
scene
.
ms_lightmap_groups
[
scene
.
ms_lightmap_groups_index
]
context
.
area
.
type
=
'
VIEW_3D
'
context
.
area
.
type
=
'
VIEW_3D
'
if
scene
.
objects
.
active
is
not
None
:
if
context
.
mode
is
not
'
OBJECT
'
and
scene
.
objects
.
active
is
not
None
:
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
OBJECT
'
,
toggle
=
False
)
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
OBJECT
'
,
toggle
=
False
)
if
group
.
bake
is
True
and
bpy
.
data
.
groups
[
group
.
name
].
objects
:
if
group
.
bake
is
True
and
bpy
.
data
.
groups
[
group
.
name
].
objects
:
...
@@ -300,7 +304,7 @@ class AddSelectedToGroup(Operator):
...
@@ -300,7 +304,7 @@ class AddSelectedToGroup(Operator):
obj_group
=
bpy
.
data
.
groups
.
new
(
group_name
)
obj_group
=
bpy
.
data
.
groups
.
new
(
group_name
)
# Add objects to a group
# Add objects to a group
if
scene
.
objects
.
active
is
not
None
:
if
context
.
mode
is
not
'
OBJECT
'
and
scene
.
objects
.
active
is
not
None
:
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
OBJECT
'
,
toggle
=
False
)
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
OBJECT
'
,
toggle
=
False
)
for
object
in
context
.
selected_objects
:
for
object
in
context
.
selected_objects
:
...
@@ -324,8 +328,9 @@ class SelectGroup(Operator):
...
@@ -324,8 +328,9 @@ class SelectGroup(Operator):
if
check_group_exist
(
self
,
context
)
is
False
:
if
check_group_exist
(
self
,
context
)
is
False
:
return
{
'
CANCELLED
'
}
return
{
'
CANCELLED
'
}
if
scene
.
objects
.
active
is
not
None
:
if
context
.
mode
is
not
'
OBJECT
'
and
scene
.
objects
.
active
is
not
None
:
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
OBJECT
'
,
toggle
=
False
)
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
OBJECT
'
,
toggle
=
False
)
bpy
.
ops
.
object
.
select_all
(
action
=
'
DESELECT
'
)
bpy
.
ops
.
object
.
select_all
(
action
=
'
DESELECT
'
)
obj_group
=
bpy
.
data
.
groups
[
group_name
]
obj_group
=
bpy
.
data
.
groups
[
group_name
]
for
object
in
obj_group
.
objects
:
for
object
in
obj_group
.
objects
:
...
@@ -349,7 +354,7 @@ class RemoveFromGroup(Operator):
...
@@ -349,7 +354,7 @@ class RemoveFromGroup(Operator):
if
check_group_exist
(
self
,
context
)
is
False
:
if
check_group_exist
(
self
,
context
)
is
False
:
return
{
'
CANCELLED
'
}
return
{
'
CANCELLED
'
}
if
scene
.
objects
.
active
is
not
None
:
if
context
.
mode
is
not
'
OBJECT
'
and
scene
.
objects
.
active
is
not
None
:
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
OBJECT
'
,
toggle
=
False
)
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
OBJECT
'
,
toggle
=
False
)
for
group
in
scene
.
ms_lightmap_groups
:
for
group
in
scene
.
ms_lightmap_groups
:
...
@@ -387,7 +392,7 @@ class RemoveOtherUVs(Operator):
...
@@ -387,7 +392,7 @@ class RemoveOtherUVs(Operator):
if
check_group_exist
(
self
,
context
)
is
False
:
if
check_group_exist
(
self
,
context
)
is
False
:
return
{
'
CANCELLED
'
}
return
{
'
CANCELLED
'
}
if
scene
.
objects
.
active
is
not
None
:
if
context
.
mode
is
not
'
OBJECT
'
and
scene
.
objects
.
active
is
not
None
:
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
OBJECT
'
,
toggle
=
False
)
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
OBJECT
'
,
toggle
=
False
)
# bpy.ops.object.select_all(action='DESELECT')
# bpy.ops.object.select_all(action='DESELECT')
...
@@ -499,9 +504,11 @@ class CreateLightmap(Operator):
...
@@ -499,9 +504,11 @@ class CreateLightmap(Operator):
for
object
in
obj_group
.
objects
:
for
object
in
obj_group
.
objects
:
# Remove non MESH objects
# Remove non MESH objects
if
object
.
type
!=
'
MESH
'
:
if
object
.
type
!=
'
MESH
'
:
NON_MESH_LIST
.
append
(
object
)
NON_MESH_LIST
.
append
(
object
)
elif
object
.
type
==
'
MESH
'
and
len
(
object
.
data
.
vertices
)
==
0
:
NON_MESH_LIST
.
append
(
object
)
else
:
else
:
# Add Image to faces
# Add Image to faces
if
object
.
data
.
uv_textures
.
active
is
None
:
if
object
.
data
.
uv_textures
.
active
is
None
:
...
@@ -556,18 +563,14 @@ class MergeObjects(Operator):
...
@@ -556,18 +563,14 @@ class MergeObjects(Operator):
me
.
update
()
me
.
update
()
ob_merge
.
select
=
False
ob_merge
.
select
=
False
activeNowObject
=
bpy
.
data
.
groups
[
self
.
group_name
].
objects
[
0
]
bpy
.
ops
.
object
.
select_all
(
action
=
'
DESELECT
'
)
bpy
.
ops
.
object
.
select_all
(
action
=
'
DESELECT
'
)
OBJECTLIST
=
bpy
.
data
.
groups
[
self
.
group_name
].
objects
[:]
for
object
in
bpy
.
data
.
groups
[
self
.
group_name
].
objects
:
for
obj
in
OBJECTLIST
:
obj
.
select
=
True
scene
.
objects
.
active
=
activeNowObject
#
M
ake
O
bject
Single User
#
m
ake
o
bject
temporary unhidden
# bpy.ops.object.make_single_user(type='SELECTED_OBJECTS', object=True,
isObjHideSelect
=
object
.
hide_select
# obdata=True, material=False, texture=False, animation=
False
)
object
.
hide
=
False
for
object
in
OBJECTLIST
:
object
.
hide_select
=
False
bpy
.
ops
.
object
.
select_all
(
action
=
'
DESELECT
'
)
bpy
.
ops
.
object
.
select_all
(
action
=
'
DESELECT
'
)
object
.
select
=
True
object
.
select
=
True
...
@@ -578,8 +581,7 @@ class MergeObjects(Operator):
...
@@ -578,8 +581,7 @@ class MergeObjects(Operator):
uv
.
active
=
True
uv
.
active
=
True
scene
.
objects
.
active
=
object
scene
.
objects
.
active
=
object
# generate temp Duplicate Objects with copied modifier,properties
# Duplicate Temp Object
# and logic bricks
bpy
.
ops
.
object
.
select_all
(
action
=
'
DESELECT
'
)
bpy
.
ops
.
object
.
select_all
(
action
=
'
DESELECT
'
)
object
.
select
=
True
object
.
select
=
True
scene
.
objects
.
active
=
object
scene
.
objects
.
active
=
object
...
@@ -591,6 +593,7 @@ class MergeObjects(Operator):
...
@@ -591,6 +593,7 @@ class MergeObjects(Operator):
object
.
hide_render
=
True
object
.
hide_render
=
True
object
.
hide
=
True
object
.
hide
=
True
object
.
select
=
False
object
.
select
=
False
object
.
hide_select
=
isObjHideSelect
# remove unused UV
# remove unused UV
# remove UVs
# remove UVs
...
@@ -632,8 +635,6 @@ class MergeObjects(Operator):
...
@@ -632,8 +635,6 @@ class MergeObjects(Operator):
scene
.
objects
.
active
=
ob_merge
scene
.
objects
.
active
=
ob_merge
bpy
.
ops
.
object
.
join
()
bpy
.
ops
.
object
.
join
()
OBJECTLIST
.
clear
()
# clear array
# make Unwrap
# make Unwrap
bpy
.
ops
.
object
.
select_all
(
action
=
'
DESELECT
'
)
bpy
.
ops
.
object
.
select_all
(
action
=
'
DESELECT
'
)
ob_merge
.
select
=
True
ob_merge
.
select
=
True
...
@@ -644,6 +645,7 @@ class MergeObjects(Operator):
...
@@ -644,6 +645,7 @@ class MergeObjects(Operator):
if
unwrapType
==
'
0
'
or
unwrapType
==
'
1
'
:
if
unwrapType
==
'
0
'
or
unwrapType
==
'
1
'
:
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
EDIT
'
)
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
EDIT
'
)
bpy
.
ops
.
mesh
.
reveal
()
bpy
.
ops
.
mesh
.
select_all
(
action
=
'
SELECT
'
)
bpy
.
ops
.
mesh
.
select_all
(
action
=
'
SELECT
'
)
if
unwrapType
==
'
0
'
:
if
unwrapType
==
'
0
'
:
...
@@ -689,6 +691,7 @@ class SeparateObjects(Operator):
...
@@ -689,6 +691,7 @@ class SeparateObjects(Operator):
scene
.
objects
.
active
=
ob_merged
scene
.
objects
.
active
=
ob_merged
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
EDIT
'
)
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
EDIT
'
)
bpy
.
ops
.
mesh
.
reveal
()
bpy
.
ops
.
mesh
.
select_all
(
action
=
'
DESELECT
'
)
bpy
.
ops
.
mesh
.
select_all
(
action
=
'
DESELECT
'
)
ob_merged
.
vertex_groups
.
active_index
=
ob_merged
.
vertex_groups
[
ob_merged
.
vertex_groups
.
active_index
=
ob_merged
.
vertex_groups
[
ms_obj
.
name
].
index
ms_obj
.
name
].
index
...
@@ -708,11 +711,15 @@ class SeparateObjects(Operator):
...
@@ -708,11 +711,15 @@ class SeparateObjects(Operator):
if
ms_obj
.
name
in
scene
.
objects
:
if
ms_obj
.
name
in
scene
.
objects
:
ob_merged
.
select
=
False
ob_merged
.
select
=
False
ob_original
=
scene
.
objects
[
ms_obj
.
name
]
ob_original
=
scene
.
objects
[
ms_obj
.
name
]
isOriginalToSelect
=
ob_original
.
hide_select
ob_original
.
hide_select
=
False
ob_original
.
hide
=
False
ob_original
.
hide
=
False
ob_original
.
select
=
True
ob_original
.
select
=
True
scene
.
objects
.
active
=
ob_separeted
scene
.
objects
.
active
=
ob_separeted
bpy
.
ops
.
object
.
join_uvs
()
bpy
.
ops
.
object
.
join_uvs
()
ob_original
.
hide_render
=
False
ob_original
.
hide_render
=
False
ob_original
.
select
=
False
ob_original
.
hide_select
=
isOriginalToSelect
# delete separeted object
# delete separeted object
bpy
.
ops
.
object
.
select_all
(
action
=
'
DESELECT
'
)
bpy
.
ops
.
object
.
select_all
(
action
=
'
DESELECT
'
)
...
...
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