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
90af8be6
Commit
90af8be6
authored
13 years ago
by
Kalle-Samuli Riihikoski
Browse files
Options
Downloads
Patches
Plain Diff
Now you can multiselect objects and press import button and it will update all selected objects.
parent
50bbabdc
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
io_coat3D/coat.py
+103
-96
103 additions, 96 deletions
io_coat3D/coat.py
with
103 additions
and
96 deletions
io_coat3D/coat.py
+
103
−
96
View file @
90af8be6
...
@@ -287,114 +287,121 @@ class SCENE_OT_import(bpy.types.Operator):
...
@@ -287,114 +287,121 @@ class SCENE_OT_import(bpy.types.Operator):
scene
=
context
.
scene
scene
=
context
.
scene
coat3D
=
bpy
.
context
.
scene
.
coat3D
coat3D
=
bpy
.
context
.
scene
.
coat3D
coat
=
bpy
.
coat3D
coat
=
bpy
.
coat3D
activeobj
=
bpy
.
context
.
active_object
.
name
test
=
bpy
.
context
.
selected_objects
mat_list
=
[]
act_first
=
bpy
.
context
.
scene
.
objects
.
active
scene
.
objects
[
activeobj
].
select
=
True
for
act_name
in
test
:
objekti
=
scene
.
objects
[
activeobj
]
activeobj
=
act_name
.
name
coat3D
.
loca
=
objekti
.
location
mat_list
=
[]
coat3D
.
rota
=
objekti
.
rotation_euler
scene
.
objects
[
activeobj
].
select
=
True
coa
=
bpy
.
context
.
scene
.
objects
.
active
.
coat3D
objekti
=
scene
.
objects
[
activeobj
]
coat3D
.
loca
=
objekti
.
location
exportfile
=
coat3D
.
exchangedir
coat3D
.
rota
=
objekti
.
rotation_euler
path3b_n
=
coat3D
.
exchangedir
coa
=
bpy
.
context
.
scene
.
objects
.
active
.
coat3D
path3b_n
+=
(
'
last_saved_3b_file.txt
'
)
exportfile
+=
(
'
%sexport.txt
'
%
(
os
.
sep
))
if
(
os
.
path
.
isfile
(
exportfile
)):
export_file
=
open
(
exportfile
)
for
line
in
export_file
:
if
line
.
rfind
(
'
.3b
'
):
objekti
.
coat3D
.
coatpath
=
line
coat
[
'
active_coat
'
]
=
line
export_file
.
close
()
os
.
remove
(
exportfile
)
if
(
objekti
.
material_slots
):
for
obj_mat
in
objekti
.
material_slots
:
mat_list
.
append
(
obj_mat
.
material
)
act_mat_index
=
objekti
.
active_material_index
if
(
coat3D
.
importmesh
and
os
.
path
.
isfile
(
coa
.
objectdir
)):
mtl
=
coa
.
objectdir
mtl
=
mtl
.
replace
(
'
.obj
'
,
'
.mtl
'
)
if
(
os
.
path
.
isfile
(
mtl
)):
os
.
remove
(
mtl
)
exportfile
=
coat3D
.
exchangedir
bpy
.
ops
.
import_scene
.
obj
(
filepath
=
coa
.
objectdir
,
axis_forward
=
'
Y
'
,
axis_up
=
'
Z
'
)
path3b_n
=
coat3D
.
exchangedir
obj_proxy
=
scene
.
objects
[
0
]
path3b_n
+=
(
'
last_saved_3b_file.txt
'
)
bpy
.
ops
.
object
.
select_all
(
action
=
'
TOGGLE
'
)
exportfile
+=
(
'
%sexport.txt
'
%
(
os
.
sep
))
obj_proxy
.
select
=
True
if
(
os
.
path
.
isfile
(
exportfile
)):
if
(
coa
.
export_on
):
export_file
=
open
(
exportfile
)
bpy
.
ops
.
object
.
origin_set
(
type
=
'
ORIGIN_GEOMETRY
'
,
center
=
'
MEDIAN
'
)
for
line
in
export_file
:
if
line
.
rfind
(
'
.3b
'
):
objekti
.
coat3D
.
coatpath
=
line
coat
[
'
active_coat
'
]
=
line
export_file
.
close
()
os
.
remove
(
exportfile
)
bpy
.
ops
.
object
.
transform_apply
(
rotation
=
True
)
proxy_mat
=
obj_proxy
.
material_slots
[
0
].
material
obj_proxy
.
data
.
materials
.
pop
(
0
)
proxy_mat
.
user_clear
()
if
(
objekti
.
material_slots
):
bpy
.
data
.
materials
.
remove
(
proxy_mat
)
for
obj_mat
in
objekti
.
material_slots
:
bpy
.
ops
.
object
.
select_all
(
action
=
'
TOGGLE
'
)
mat_list
.
append
(
obj_mat
.
material
)
act_mat_index
=
objekti
.
active_material_index
scene
.
objects
.
active
=
obj_proxy
obj_data
=
objekti
.
data
.
id_data
objekti
.
data
=
obj_proxy
.
data
.
id_data
if
(
bpy
.
data
.
meshes
[
obj_data
.
name
].
users
==
0
):
bpy
.
data
.
meshes
.
remove
(
obj_data
)
objekti
.
data
.
id_data
.
name
=
obj_data
.
name
obj_proxy
.
select
=
True
if
(
coat3D
.
importmesh
and
os
.
path
.
isfile
(
coa
.
objectdir
)):
bpy
.
ops
.
object
.
delete
()
mtl
=
coa
.
objectdir
objekti
.
select
=
True
mtl
=
mtl
.
replace
(
'
.obj
'
,
'
.mtl
'
)
bpy
.
context
.
scene
.
objects
.
active
=
objekti
if
(
os
.
path
.
isfile
(
mtl
)):
os
.
remove
(
mtl
)
bpy
.
ops
.
import_scene
.
obj
(
filepath
=
act_name
.
coat3D
.
objectdir
,
axis_forward
=
'
Y
'
,
axis_up
=
'
Z
'
)
obj_proxy
=
scene
.
objects
[
0
]
bpy
.
ops
.
object
.
select_all
(
action
=
'
TOGGLE
'
)
obj_proxy
.
select
=
True
if
(
coa
.
export_on
):
bpy
.
ops
.
object
.
origin_set
(
type
=
'
ORIGIN_GEOMETRY
'
,
center
=
'
MEDIAN
'
)
bpy
.
ops
.
object
.
transform_apply
(
rotation
=
True
)
proxy_mat
=
obj_proxy
.
material_slots
[
0
].
material
obj_proxy
.
data
.
materials
.
pop
(
0
)
proxy_mat
.
user_clear
()
bpy
.
data
.
materials
.
remove
(
proxy_mat
)
bpy
.
ops
.
object
.
select_all
(
action
=
'
TOGGLE
'
)
if
(
coat3D
.
smooth_on
):
bpy
.
ops
.
object
.
shade_smooth
()
else
:
bpy
.
ops
.
object
.
shade_flat
()
if
(
os
.
path
.
isfile
(
path3b_n
)):
path3b_fil
=
open
(
path3b_n
)
for
lin
in
path3b_fil
:
objekti
.
coat3D
.
path3b
=
lin
path3b_fil
.
close
()
os
.
remove
(
path3b_n
)
if
(
coat3D
.
importmesh
and
not
(
os
.
path
.
isfile
(
coa
.
objectdir
))):
scene
.
objects
.
active
=
obj_proxy
coat3D
.
importmesh
=
False
if
(
mat_list
and
coat3D
.
importmesh
):
obj_data
=
objekti
.
data
.
id_data
for
mat_one
in
mat_list
:
objekti
.
data
=
obj_proxy
.
data
.
id_data
objekti
.
data
.
materials
.
append
(
mat_one
)
if
(
bpy
.
data
.
meshes
[
obj_data
.
name
].
users
==
0
):
objekti
.
active_material_index
=
act_mat_index
bpy
.
data
.
meshes
.
remove
(
obj_data
)
objekti
.
data
.
id_data
.
name
=
obj_data
.
name
if
(
mat_list
):
for
obj_mate
in
objekti
.
material_slots
:
obj_proxy
.
select
=
True
for
tex_slot
in
obj_mate
.
material
.
texture_slots
:
bpy
.
ops
.
object
.
delete
()
if
(
hasattr
(
tex_slot
,
'
texture
'
)):
objekti
.
select
=
True
if
(
tex_slot
.
texture
.
type
==
'
IMAGE
'
):
bpy
.
context
.
scene
.
objects
.
active
=
objekti
tex_slot
.
texture
.
image
.
reload
()
if
(
coat3D
.
importmod
):
mod_list
=
[]
for
mod_index
in
objekti
.
modifiers
:
objekti
.
modifiers
.
remove
(
mod_index
)
if
(
coat3D
.
smooth_on
):
bpy
.
ops
.
object
.
shade_smooth
()
else
:
bpy
.
ops
.
object
.
shade_flat
()
if
(
os
.
path
.
isfile
(
path3b_n
)):
path3b_fil
=
open
(
path3b_n
)
for
lin
in
path3b_fil
:
objekti
.
coat3D
.
path3b
=
lin
path3b_fil
.
close
()
os
.
remove
(
path3b_n
)
if
(
coat3D
.
importmesh
and
not
(
os
.
path
.
isfile
(
coa
.
objectdir
))):
coat3D
.
importmesh
=
False
if
(
mat_list
and
coat3D
.
importmesh
):
for
mat_one
in
mat_list
:
objekti
.
data
.
materials
.
append
(
mat_one
)
objekti
.
active_material_index
=
act_mat_index
if
(
coat3D
.
importtextures
):
if
(
mat_list
):
export
=
''
for
obj_mate
in
objekti
.
material_slots
:
tex
.
gettex
(
mat_list
,
objekti
,
scene
,
export
)
for
tex_slot
in
obj_mate
.
material
.
texture_slots
:
if
(
hasattr
(
tex_slot
,
'
texture
'
)):
if
(
tex_slot
.
texture
.
type
==
'
IMAGE
'
):
tex_slot
.
texture
.
image
.
reload
()
if
(
coat3D
.
importmod
):
mod_list
=
[]
for
mod_index
in
objekti
.
modifiers
:
objekti
.
modifiers
.
remove
(
mod_index
)
if
(
coat3D
.
importtextures
):
export
=
''
tex
.
gettex
(
mat_list
,
objekti
,
scene
,
export
)
for
act_name
in
test
:
act_name
.
select
=
True
bpy
.
context
.
scene
.
objects
.
active
=
act_first
return
(
'
FINISHED
'
)
return
(
'
FINISHED
'
)
class
SCENE_OT_import3b
(
bpy
.
types
.
Operator
):
class
SCENE_OT_import3b
(
bpy
.
types
.
Operator
):
...
...
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