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
96e13f19
Commit
96e13f19
authored
13 years ago
by
Kalle-Samuli Riihikoski
Browse files
Options
Downloads
Patches
Plain Diff
3D-Coat Applink version 2 released :)
parent
cc14230c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
io_coat3D/__init__.py
+16
-1
16 additions, 1 deletion
io_coat3D/__init__.py
io_coat3D/coat.py
+172
-190
172 additions, 190 deletions
io_coat3D/coat.py
io_coat3D/tex.py
+10
-8
10 additions, 8 deletions
io_coat3D/tex.py
with
198 additions
and
199 deletions
io_coat3D/__init__.py
+
16
−
1
View file @
96e13f19
...
...
@@ -53,12 +53,17 @@ def register():
class
ObjectCoat3D
(
bpy
.
types
.
PropertyGroup
):
objpath
=
StringProperty
(
name
=
"
Object_Path
"
)
applink_name
=
StringProperty
(
name
=
"
Object_Applink_name
"
)
coatpath
=
StringProperty
(
name
=
"
Coat_Path
"
)
objectdir
=
StringProperty
(
name
=
"
ObjectPath
"
,
subtype
=
"
FILE_PATH
"
)
objecttime
=
StringProperty
(
name
=
"
ObjectTime
"
,
subtype
=
"
FILE_PATH
"
)
texturefolder
=
StringProperty
(
name
=
"
Texture folder:
"
,
subtype
=
"
DIR_PATH
"
)
path3b
=
StringProperty
(
name
=
"
3B Path
"
,
subtype
=
"
FILE_PATH
"
)
export_on
=
BoolProperty
(
name
=
"
Export_On
"
,
description
=
"
Add Modifiers and export
"
,
default
=
False
)
dime
=
FloatVectorProperty
(
name
=
"
dime
"
,
description
=
"
Dimension
"
)
loc
=
FloatVectorProperty
(
name
=
"
Location
"
,
description
=
"
Location
"
)
rot
=
FloatVectorProperty
(
name
=
"
Rotation
"
,
description
=
"
Rotation
"
,
subtype
=
'
EULER
'
)
sca
=
FloatVectorProperty
(
name
=
"
Scale
"
,
description
=
"
Scale
"
)
class
SceneCoat3D
(
bpy
.
types
.
PropertyGroup
):
...
...
@@ -70,6 +75,11 @@ def register():
name
=
"
FilePath
"
,
subtype
=
"
DIR_PATH
"
)
exchangefolder
=
StringProperty
(
name
=
"
FilePath
"
,
subtype
=
"
DIR_PATH
"
)
...
...
@@ -81,6 +91,11 @@ def register():
description
=
"
Allows to skip import dialog
"
,
default
=
True
)
exchange_found
=
BoolProperty
(
name
=
"
Exchange Found
"
,
description
=
"
Alert if Exchange folder is not found
"
,
default
=
True
)
export_box
=
BoolProperty
(
name
=
"
Export window
"
,
description
=
"
Allows to skip export dialog
"
,
...
...
This diff is collapsed.
Click to expand it.
io_coat3D/coat.py
+
172
−
190
View file @
96e13f19
...
...
@@ -27,6 +27,53 @@ bpy.coat3D = dict()
bpy
.
coat3D
[
'
active_coat
'
]
=
''
bpy
.
coat3D
[
'
status
'
]
=
0
def
set_folders
():
platform
=
os
.
sys
.
platform
coat3D
=
bpy
.
context
.
scene
.
coat3D
if
(
platform
==
'
win32
'
):
folder_objects
=
os
.
path
.
expanduser
(
"
~
"
)
+
os
.
sep
+
'
Documents
'
+
os
.
sep
+
'
3DC2Blender
'
+
os
.
sep
+
'
Objects
'
folder_textures
=
os
.
path
.
expanduser
(
"
~
"
)
+
os
.
sep
+
'
Documents
'
+
os
.
sep
+
'
3DC2Blender
'
+
os
.
sep
+
'
Textures
'
+
os
.
sep
if
(
not
(
os
.
path
.
isdir
(
folder_objects
))):
os
.
makedirs
(
folder_objects
)
if
(
not
(
os
.
path
.
isdir
(
folder_textures
))):
os
.
makedirs
(
folder_textures
)
exchange
=
os
.
path
.
expanduser
(
"
~
"
)
+
os
.
sep
+
'
Documents
'
+
os
.
sep
+
'
3D-CoatV3
'
+
os
.
sep
+
'
Exchange
'
else
:
folder_objects
=
os
.
path
.
expanduser
(
"
~
"
)
+
os
.
sep
+
'
3DC2Blender
'
+
os
.
sep
+
'
Objects
'
folder_textures
=
os
.
path
.
expanduser
(
"
~
"
)
+
os
.
sep
+
'
3DC2Blender
'
+
os
.
sep
+
'
Textures
'
+
os
.
sep
if
(
not
(
os
.
path
.
isdir
(
folder_objects
))):
os
.
makedirs
(
folder_objects
)
if
(
not
(
os
.
path
.
isdir
(
folder_textures
))):
os
.
makedirs
(
folder_textures
)
exchange
=
os
.
path
.
expanduser
(
"
~
"
)
+
os
.
sep
+
'
3D-CoatV3
'
+
os
.
sep
+
'
Exchange
'
if
(
os
.
path
.
isdir
(
exchange
)):
coat3D
.
exchange_found
=
True
else
:
if
(
platform
==
'
win32
'
):
exchange_path
=
os
.
path
.
expanduser
(
"
~
"
)
+
os
.
sep
+
'
Documents
'
+
os
.
sep
+
'
3DC2Blender
'
+
os
.
sep
+
'
Exchange_folder.txt
'
else
:
exchange_path
=
os
.
path
.
expanduser
(
"
~
"
)
+
os
.
sep
+
'
3DC2Blender
'
+
os
.
sep
+
'
Exchange_folder.txt
'
if
(
os
.
path
.
isfile
(
exchange_path
)):
ex_path
=
''
ex_pathh
=
open
(
exchange_path
)
for
line
in
ex_pathh
:
ex_path
=
line
break
ex_pathh
.
close
()
if
(
os
.
path
.
isdir
(
ex_path
)
and
ex_path
.
rfind
(
'
Exchange
'
)
>=
0
):
exchange
=
ex_path
coat3D
.
exchange_found
=
True
else
:
coat3D
.
exchange_found
=
False
else
:
coat3D
.
exchange_found
=
False
return
exchange
,
folder_objects
,
folder_textures
class
ObjectButtonsPanel
():
bl_space_type
=
'
PROPERTIES
'
bl_region_type
=
'
WINDOW
'
...
...
@@ -76,123 +123,44 @@ class SCENE_PT_Main(ObjectButtonsPanel,bpy.types.Panel):
row
=
layout
.
row
()
row
.
prop
(
coat3D
,
"
type
"
,
text
=
""
)
row
=
layout
.
row
()
if
(
context
.
selected_objects
and
bpy
.
context
.
mode
==
'
OBJECT
'
):
if
(
context
.
selected_objects
[
0
].
type
==
'
MESH
'
):
row
.
active
=
True
else
:
row
.
active
=
False
if
(
context
.
selected_objects
):
for
selected
in
context
.
selected_objects
:
if
(
selected
.
type
==
'
MESH
'
):
row
.
active
=
True
break
else
:
row
.
active
=
False
else
:
row
.
active
=
False
if
(
not
(
bpy
.
context
.
selected_objects
)
and
os
.
path
.
isfile
(
Blender_export
)):
row
.
active
=
True
row
.
operator
(
"
import3b_applink.pilgway_3d_coat
"
,
text
=
"
Bring from 3D-Coat
"
)
else
:
colL
=
row
.
column
()
colR
=
row
.
column
()
colL
.
operator
(
"
export_applink.pilgway_3d_coat
"
,
text
=
"
Export
"
)
colL
.
label
(
text
=
"
Export Settings:
"
)
colL
.
prop
(
coat3D
,
"
exportover
"
)
if
(
coat3D
.
exportover
):
colL
.
prop
(
coat3D
,
"
exportmod
"
)
colL
.
prop
(
coat3D
,
"
exportfile
"
)
colL
.
prop
(
coat3D
,
"
export_pos
"
)
colR
.
operator
(
"
import_applink.pilgway_3d_coat
"
,
text
=
"
Import
"
)
colR
.
label
(
text
=
"
Import Settings:
"
)
colR
.
prop
(
coat3D
,
"
importmesh
"
)
colR
.
prop
(
coat3D
,
"
importmod
"
)
colR
.
prop
(
coat3D
,
"
importtextures
"
)
# This is Disabled, because of the blender bug.
#colR.prop(coat3D,"importlevel")
row
=
layout
.
row
()
if
(
bpy
.
context
.
selected_objects
):
if
(
context
.
selected_objects
[
0
].
type
==
'
MESH
'
):
coa
=
context
.
selected_objects
[
0
].
coat3D
colL
=
row
.
column
()
colR
=
row
.
column
()
colL
.
label
(
text
=
"
Object Path:
"
)
if
(
coa
.
path3b
):
colR
.
active
=
True
else
:
colR
.
active
=
False
colR
.
operator
(
"
import_applink.pilgway_3d_coat_3b
"
,
text
=
"
Load 3b
"
)
row
=
layout
.
row
()
row
.
prop
(
coa
,
"
objectdir
"
,
text
=
""
)
row
=
layout
.
row
()
if
(
context
.
selected_objects
):
if
(
context
.
selected_objects
[
0
].
type
==
'
MESH
'
):
coa
=
bpy
.
context
.
selected_objects
[
0
].
coat3D
row
=
layout
.
row
()
row
.
label
(
text
=
"
Texture output folder:
"
)
row
=
layout
.
row
()
row
.
prop
(
coa
,
"
texturefolder
"
,
text
=
""
)
row
=
layout
.
row
()
if
(
coat
[
'
status
'
]
==
0
):
row
.
label
(
text
=
"
Exchange Folder: not connected
"
)
else
:
row
.
label
(
text
=
"
Exchange Folder: connected
"
)
class
SCENE_PT_Settings
(
ObjectButtonsPanel
,
bpy
.
types
.
Panel
):
bl_label
=
"
Applink Settings
"
bl_space_type
=
"
PROPERTIES
"
bl_region_type
=
"
WINDOW
"
bl_context
=
"
scene
"
colL
=
row
.
column
()
colR
=
row
.
column
()
colR
.
operator
(
"
export_applink.pilgway_3d_coat
"
,
text
=
"
Transfer
"
)
colL
.
operator
(
"
import_applink.pilgway_3d_coat
"
,
text
=
"
Update
"
)
def
draw
(
self
,
context
):
layout
=
self
.
layout
coat3D
=
bpy
.
context
.
scene
.
coat3D
row
=
layout
.
row
()
if
(
bpy
.
context
.
selected_objects
):
if
(
context
.
selected_objects
[
0
].
type
==
'
MESH
'
):
row
.
active
=
True
else
:
row
.
active
=
False
row
.
operator
(
"
import_applink.pilgway_3d_deltex
"
,
text
=
"
Delete Textures
"
)
row
=
layout
.
row
()
row
.
label
(
text
=
"
Exchange Folder:
"
)
row
=
layout
.
row
()
row
.
prop
(
coat3D
,
"
exchangedir
"
,
text
=
""
)
if
(
bpy
.
context
.
scene
.
objects
.
active
):
coa
=
bpy
.
context
.
scene
.
objects
.
active
.
coat3D
if
(
os
.
path
.
isfile
(
Blender_export
)):
row
=
layout
.
row
()
row
.
label
(
text
=
"
3b path:
"
)
row
.
operator
(
"
import3b_applink.pilgway_3d_coat
"
,
text
=
"
Bring from 3D-Coat
"
)
if
(
coat3D
.
exchange_found
==
False
):
row
=
layout
.
row
()
row
.
prop
(
coa
,
"
path3b
"
,
text
=
"
"
)
row
.
label
(
text
=
"
Applink didn
'
t find your 3d-Coat/Excahnge folder.
"
)
row
=
layout
.
row
()
row
.
label
(
text
=
"
Default Folder:
"
)
row
.
label
(
"
Please select it and press Transfer button again
"
)
row
=
layout
.
row
()
row
.
prop
(
coat3D
,
"
defaultfolder
"
,
text
=
""
)
row
.
prop
(
coat3D
,
"
exchangefolder
"
,
text
=
""
)
#colL = row.column()
#colR = row.column()
#colL.prop(coat3D,"export_box")
#colR.prop(coat3D,"import_box")
#if(not(coat3D.export_box)):
# row = layout.row()
# colL.label(text="Export settings:")
# row = layout.row()
# colL = row.column()
# colR = row.column()
# colL.prop(coat3D,"export_color")
# colL.prop(coat3D,"export_spec")
# colL.prop(coat3D,"export_normal")
# colL.prop(coat3D,"export_disp")
# colR.prop(coat3D,"export_position")
# colR.prop(coat3D,"export_export_zero_layer")
# colR.prop(coat3D,"export_coarse")
#row = layout.row()
#colL = row.column()
#colR = row.column()
class
SCENE_OT_export
(
bpy
.
types
.
Operator
):
bl_idname
=
"
export_applink.pilgway_3d_coat
"
...
...
@@ -204,66 +172,66 @@ class SCENE_OT_export(bpy.types.Operator):
checkname
=
''
coat3D
=
bpy
.
context
.
scene
.
coat3D
scene
=
context
.
scene
coat3D
.
export_on
=
False
activeobj
=
bpy
.
context
.
active_object
.
name
obj
=
scene
.
objects
[
activeobj
]
coa
=
bpy
.
context
.
scene
.
objects
.
active
.
coat3D
if
(
coa
.
objectdir
==
''
and
(
coat3D
.
defaultfolder
)):
coa
.
objectdir
=
coat3D
.
defaultfolder
coat3D
.
exchangedir
,
folder_objects
,
folder_textures
=
set_folders
()
if
(
coat3D
.
exchange_found
==
False
):
return
{
'
FINISHED
'
}
importfile
=
coat3D
.
exchangedir
texturefile
=
coat3D
.
exchangedir
importfile
+=
(
'
%simport.txt
'
%
(
os
.
sep
))
texturefile
+=
(
'
%stextures.txt
'
%
(
os
.
sep
))
looking
=
True
object_index
=
0
if
(
coa
.
applink_name
and
os
.
path
.
isfile
(
coa
.
applink_name
)):
checkname
=
coa
.
applink_name
else
:
while
(
looking
==
True
):
checkname
=
folder_objects
+
os
.
sep
+
activeobj
checkname
=
(
"
%s%.2d.obj
"
%
(
checkname
,
object_index
))
if
(
os
.
path
.
isfile
(
checkname
)):
object_index
+=
1
else
:
looking
=
False
coa
.
applink_name
=
checkname
importfile
=
coat3D
.
exchangedir
texturefile
=
coat3D
.
exchangedir
importfile
+=
(
'
%simport.txt
'
%
(
os
.
sep
))
texturefile
+=
(
'
%stextures.txt
'
%
(
os
.
sep
))
if
(
os
.
path
.
isfile
(
texturefile
)):
os
.
remove
(
texturefile
)
checkname
=
coa
.
objectdir
if
(
coa
.
objectdir
[
-
4
:]
!=
'
.obj
'
):
checkname
+=
(
'
%s.obj
'
%
(
activeobj
))
bpy
.
ops
.
object
.
origin_set
(
type
=
'
ORIGIN_GEOMETRY
'
,
center
=
'
MEDIAN
'
)
if
(
not
(
os
.
path
.
isfile
(
checkname
))
or
coat3D
.
exportover
):
if
(
coat3D
.
export_pos
):
bpy
.
ops
.
object
.
transform_apply
(
location
=
True
,
rotation
=
True
,
scale
=
True
)
coa
.
loc
=
obj
.
location
coa
.
rot
=
obj
.
rotation_euler
coa
.
sca
=
obj
.
scale
coa
.
dime
=
obj
.
dimensions
bpy
.
ops
.
export_scene
.
obj
(
filepath
=
checkname
,
use_selection
=
True
,
use_apply_modifiers
=
coat3D
.
exportmod
,
use_blen_objects
=
False
,
group_by_material
=
True
,
use_materials
=
False
,
keep_vertex_order
=
True
,
axis_forward
=
'
X
'
,
axis_up
=
'
Y
'
)
bpy
.
ops
.
object
.
origin_set
(
type
=
'
ORIGIN_GEOMETRY
'
,
center
=
'
MEDIAN
'
)
coa
.
export_on
=
True
else
:
bpy
.
ops
.
object
.
origin_set
(
type
=
'
ORIGIN_GEOMETRY
'
,
center
=
'
MEDIAN
'
)
coat3D
.
loca
=
obj
.
location
coat3D
.
rota
=
obj
.
rotation_euler
coat3D
.
scal
=
obj
.
scale
obj
.
location
=
(
0
,
0
,
0
)
obj
.
rotation_euler
=
(
0
,
0
,
0
)
obj
.
scale
=
(
1
,
1
,
1
)
bpy
.
ops
.
export_scene
.
obj
(
filepath
=
checkname
,
use_selection
=
True
,
use_apply_modifiers
=
coat3D
.
exportmod
,
use_blen_objects
=
False
,
group_by_material
=
True
,
use_materials
=
False
,
keep_vertex_order
=
True
,
axis_forward
=
'
X
'
,
axis_up
=
'
Y
'
)
obj
.
location
=
coat3D
.
loca
obj
.
rotation_euler
=
coat3D
.
rota
obj
.
scale
=
coat3D
.
scal
coa
.
export_on
=
False
if
(
coat3D
.
exportfile
==
False
):
file
=
open
(
importfile
,
"
w
"
)
file
.
write
(
"
%s
"
%
(
checkname
))
file
.
write
(
"
\n
%s
"
%
(
checkname
))
file
.
write
(
"
\n
[%s]
"
%
(
coat3D
.
type
))
if
(
coa
.
texturefolder
):
file
.
write
(
"
\n
[TexOutput:%s
"
%
(
coa
.
texturefolder
))
file
.
close
()
coa
.
objectdir
=
checkname
obj
.
location
=
(
0
,
0
,
0
)
obj
.
rotation_euler
=
(
0
,
0
,
0
)
obj
.
scale
=
(
1
,
1
,
1
)
bpy
.
ops
.
export_scene
.
obj
(
filepath
=
coa
.
applink_name
,
use_selection
=
True
,
use_apply_modifiers
=
False
,
use_blen_objects
=
True
,
group_by_material
=
True
,
use_materials
=
False
,
keep_vertex_order
=
True
,
axis_forward
=
'
X
'
,
axis_up
=
'
Y
'
)
obj
.
location
=
coa
.
loc
obj
.
rotation_euler
=
coa
.
rot
obj
.
scale
=
coa
.
sca
file
=
open
(
importfile
,
"
w
"
)
file
.
write
(
"
%s
"
%
(
checkname
))
file
.
write
(
"
\n
%s
"
%
(
checkname
))
file
.
write
(
"
\n
[%s]
"
%
(
coat3D
.
type
))
file
.
write
(
"
\n
[TexOutput:%s]
"
%
(
folder_textures
))
file
.
close
()
coa
.
objecttime
=
str
(
os
.
path
.
getmtime
(
coa
.
applink_name
))
return
{
'
FINISHED
'
}
class
SCENE_OT_import
(
bpy
.
types
.
Operator
):
...
...
@@ -278,8 +246,12 @@ class SCENE_OT_import(bpy.types.Operator):
coat
=
bpy
.
coat3D
test
=
bpy
.
context
.
selected_objects
act_first
=
bpy
.
context
.
scene
.
objects
.
active
for
act_name
in
test
:
if
act_name
.
type
==
'
MESH
'
and
os
.
path
.
isfile
(
act_name
.
coat3D
.
objectdir
):
coa
=
act_name
.
coat3D
path_object
=
coa
.
applink_name
print
(
path_object
)
if
act_name
.
type
==
'
MESH
'
and
os
.
path
.
isfile
(
path_object
):
multires_on
=
False
activeobj
=
act_name
.
name
mat_list
=
[]
...
...
@@ -287,7 +259,8 @@ class SCENE_OT_import(bpy.types.Operator):
objekti
=
scene
.
objects
[
activeobj
]
coat3D
.
loca
=
objekti
.
location
coat3D
.
rota
=
objekti
.
rotation_euler
coa
=
act_name
.
coat3D
coat3D
.
dime
=
objekti
.
scale
#See if there is multres modifier.
...
...
@@ -315,40 +288,52 @@ class SCENE_OT_import(bpy.types.Operator):
coat
[
'
active_coat
'
]
=
line
export_file
.
close
()
os
.
remove
(
exportfile
)
if
(
len
(
objekti
.
material_slots
)
==
0
):
delete_material
=
False
else
:
delete_material
=
True
if
(
objekti
.
material_slots
):
if
(
not
(
objekti
.
active_material
)
and
objekti
.
material_slots
):
act_mat_index
=
objekti
.
active_material_index
if
(
not
(
hasattr
(
objekti
.
active_material
,
'
texture_slots
'
))):
materials_old
=
bpy
.
data
.
materials
.
keys
()
bpy
.
ops
.
material
.
new
()
materials_new
=
bpy
.
data
.
materials
.
keys
()
new_ma
=
list
(
set
(
materials_new
).
difference
(
set
(
materials_old
)))
new_mat
=
new_ma
[
0
]
ki
=
bpy
.
data
.
materials
[
new_mat
]
objekti
.
material_slots
[
act_mat_index
].
material
=
ki
for
obj_mat
in
objekti
.
material_slots
:
mat_list
.
append
(
obj_mat
.
material
)
materials_old
=
bpy
.
data
.
materials
.
keys
()
bpy
.
ops
.
material
.
new
()
materials_new
=
bpy
.
data
.
materials
.
keys
()
new_ma
=
list
(
set
(
materials_new
).
difference
(
set
(
materials_old
)))
new_mat
=
new_ma
[
0
]
ki
=
bpy
.
data
.
materials
[
new_mat
]
objekti
.
material_slots
[
act_mat_index
].
material
=
ki
if
(
coat3D
.
importmesh
and
os
.
path
.
isfile
(
coa
.
objectdir
)):
mtl
=
coa
.
objectdir
if
(
os
.
path
.
isfile
(
path_object
)
and
(
coa
.
objecttime
!=
str
(
os
.
path
.
getmtime
(
path_object
)))):
if
(
objekti
.
material_slots
):
act_mat_index
=
objekti
.
active_material_index
for
obj_mat
in
objekti
.
material_slots
:
mat_list
.
append
(
obj_mat
.
material
)
coa
.
dime
=
objekti
.
dimensions
coa
.
objecttime
=
str
(
os
.
path
.
getmtime
(
path_object
))
mtl
=
coa
.
applink_name
mtl
=
mtl
.
replace
(
'
.obj
'
,
'
.mtl
'
)
if
(
os
.
path
.
isfile
(
mtl
)):
os
.
remove
(
mtl
)
bpy
.
ops
.
import_scene
.
obj
(
filepath
=
act_name
.
coat3D
.
object
dir
,
axis_forward
=
'
X
'
,
axis_up
=
'
Y
'
)
bpy
.
ops
.
import_scene
.
obj
(
filepath
=
path_
object
,
axis_forward
=
'
X
'
,
axis_up
=
'
Y
'
)
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
,
1
)
proxy_mat
.
user_clear
()
bpy
.
data
.
materials
.
remove
(
proxy_mat
)
if
(
delete_material
):
obj_proxy
.
data
.
materials
.
pop
(
0
,
1
)
proxy_mat
.
user_clear
()
bpy
.
data
.
materials
.
remove
(
proxy_mat
)
bpy
.
ops
.
object
.
select_all
(
action
=
'
TOGGLE
'
)
if
(
coat3D
.
importlevel
):
...
...
@@ -371,6 +356,7 @@ class SCENE_OT_import(bpy.types.Operator):
obj_proxy
.
select
=
True
bpy
.
ops
.
object
.
delete
()
objekti
.
select
=
True
objekti
.
scale
=
coat3D
.
dime
bpy
.
context
.
scene
.
objects
.
active
=
objekti
if
(
os
.
path
.
isfile
(
path3b_n
)):
...
...
@@ -380,7 +366,7 @@ class SCENE_OT_import(bpy.types.Operator):
path3b_fil
.
close
()
os
.
remove
(
path3b_n
)
if
(
coat3D
.
importmesh
and
not
(
os
.
path
.
isfile
(
coa
.
object
dir
))):
if
(
coat3D
.
importmesh
and
not
(
os
.
path
.
isfile
(
path_
object
))):
coat3D
.
importmesh
=
False
if
(
mat_list
and
coat3D
.
importmesh
):
...
...
@@ -397,13 +383,10 @@ class SCENE_OT_import(bpy.types.Operator):
if
tex_slot
.
texture
.
image
is
not
None
:
tex_slot
.
texture
.
image
.
reload
()
if
(
coat3D
.
importmod
):
for
mod_index
in
objekti
.
modifiers
[:]:
objekti
.
modifiers
.
remove
(
mod_index
)
if
(
coat3D
.
importtextures
):
export
=
''
tex
.
gettex
(
mat_list
,
objekti
,
scene
,
export
)
export
=
''
tex
.
gettex
(
mat_list
,
objekti
,
scene
,
export
)
if
(
multires_on
):
temp_file
=
coat3D
.
exchangedir
...
...
@@ -420,7 +403,7 @@ class SCENE_OT_import(bpy.types.Operator):
#bpy.ops.object.multires_external_pack()
bpy
.
ops
.
object
.
shade_smooth
()
for
act_name
in
test
:
act_name
.
select
=
True
bpy
.
context
.
scene
.
objects
.
active
=
act_first
...
...
@@ -471,7 +454,7 @@ class SCENE_OT_import3b(bpy.types.Operator):
for
palikka
in
bpy
.
context
.
scene
.
objects
:
if
(
palikka
.
type
==
'
MESH
'
):
if
(
palikka
.
coat3D
.
objectdir
==
export
):
if
(
palikka
.
coat3D
.
objectdir
==
export
):
#objectdir muutettava
import_no
=
1
target
=
palikka
break
...
...
@@ -483,7 +466,8 @@ class SCENE_OT_import3b(bpy.types.Operator):
bpy
.
ops
.
import_scene
.
obj
(
filepath
=
obj_path
,
axis_forward
=
'
X
'
,
axis_up
=
'
Y
'
)
bpy
.
ops
.
object
.
transform_apply
(
rotation
=
True
)
new_obj
=
scene
.
objects
[
0
]
scene
.
objects
[
0
].
coat3D
.
objectdir
=
export
new_obj
.
coat3D
.
applink_name
=
obj_path
scene
.
objects
[
0
].
coat3D
.
objectdir
=
export
#objectdir muutettava
if
(
path_on
):
scene
.
objects
[
0
].
coat3D
.
path3b
=
path_export
...
...
@@ -535,11 +519,11 @@ class SCENE_OT_deltex(bpy.types.Operator):
coat3D
=
bpy
.
context
.
scene
.
coat3D
coa
=
bpy
.
context
.
scene
.
objects
.
active
.
coat3D
scene
=
context
.
scene
nimi
=
tex
.
objname
(
coa
.
objectdir
)
nimi
=
tex
.
objname
(
coa
.
objectdir
)
#objectdir muutettava
if
(
coa
.
texturefolder
):
osoite
=
os
.
path
.
dirname
(
coa
.
texturefolder
)
+
os
.
sep
else
:
osoite
=
os
.
path
.
dirname
(
coa
.
objectdir
)
+
os
.
sep
osoite
=
os
.
path
.
dirname
(
coa
.
objectdir
)
+
os
.
sep
#objectdir muutettava
just_nimi
=
tex
.
justname
(
nimi
)
just_nimi
+=
'
_
'
...
...
@@ -639,8 +623,6 @@ class VIEW3D_MT_ExportMenu(bpy.types.Menu):
layout
.
prop
(
coat3D
,
"
exportover
"
)
if
(
coat3D
.
exportover
):
layout
.
prop
(
coat3D
,
"
exportmod
"
)
layout
.
prop
(
coat3D
,
"
exportfile
"
)
layout
.
prop
(
coat3D
,
"
export_pos
"
)
class
VIEW3D_MT_ExtraMenu
(
bpy
.
types
.
Menu
):
bl_label
=
"
Extra
"
...
...
This diff is collapsed.
Click to expand it.
io_coat3D/tex.py
+
10
−
8
View file @
96e13f19
...
...
@@ -31,6 +31,7 @@ def find_index(objekti):
def
gettex
(
mat_list
,
objekti
,
scene
,
export
):
coat3D
=
bpy
.
context
.
scene
.
coat3D
coa
=
objekti
.
coat3D
if
(
bpy
.
context
.
scene
.
render
.
engine
==
'
VRAY_RENDER
'
or
bpy
.
context
.
scene
.
render
.
engine
==
'
VRAY_RENDER_PREVIEW
'
):
vray
=
True
...
...
@@ -57,7 +58,7 @@ def gettex(mat_list, objekti, scene,export):
if
(
export
):
objekti
.
coat3D
.
objpath
=
export
nimi
=
os
.
path
.
split
(
export
)[
1
]
osoite
=
os
.
path
.
dirname
(
export
)
+
os
.
sep
osoite
=
os
.
path
.
dirname
(
export
)
+
os
.
sep
#pitaa ehka muuttaa
for
mate
in
objekti
.
material_slots
:
for
tex_slot
in
mate
.
material
.
texture_slots
:
if
(
hasattr
(
tex_slot
,
'
texture
'
)):
...
...
@@ -65,19 +66,20 @@ def gettex(mat_list, objekti, scene,export):
if
tex_slot
.
texture
.
image
is
not
None
:
tex_slot
.
texture
.
image
.
reload
()
else
:
coa
=
objekti
.
coat3D
nimi
=
os
.
path
.
split
(
coa
.
objectdir
)[
1
]
if
(
coa
.
texturefolder
):
osoite
=
os
.
path
.
dirname
(
coa
.
texturefolder
)
+
os
.
sep
if
(
os
.
sys
.
platform
==
'
win32
'
):
osoite
=
os
.
path
.
expanduser
(
"
~
"
)
+
os
.
sep
+
'
Documents
'
+
os
.
sep
+
'
3DC2Blender
'
+
os
.
sep
+
'
Textures
'
+
os
.
sep
else
:
osoite
=
os
.
path
.
dirname
(
coa
.
objectdir
)
+
os
.
sep
just_nimi
=
os
.
path
.
splitext
(
nimi
)[
0
]
+
'
_
'
osoite
=
os
.
path
.
expanduser
(
"
~
"
)
+
os
.
sep
+
'
3DC2Blender
'
+
os
.
sep
+
'
Textures
'
+
os
.
sep
ki
=
os
.
path
.
split
(
coa
.
applink_name
)[
1
]
ko
=
os
.
path
.
splitext
(
ki
)[
0
]
just_nimi
=
ko
+
'
_
'
just_nimi_len
=
len
(
just_nimi
)
print
(
'
terve:
'
+
coa
.
applink_name
)
if
(
len
(
objekti
.
material_slots
)
!=
0
):
for
obj_tex
in
objekti
.
active_material
.
texture_slots
:
if
(
hasattr
(
obj_tex
,
'
texture
'
)):
if
(
obj_tex
.
texture
):
if
(
obj_tex
.
texture
.
type
==
'
IMAGE
'
):
if
(
obj_tex
.
use_map_color_diffuse
):
bring_color
=
0
;
if
(
obj_tex
.
use_map_specular
):
...
...
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