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
a77bfac8
Commit
a77bfac8
authored
13 years ago
by
Kalle-Samuli Riihikoski
Browse files
Options
Downloads
Patches
Plain Diff
Cleaning the UI.
parent
45e8032f
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
+74
-153
74 additions, 153 deletions
io_coat3D/coat.py
with
74 additions
and
153 deletions
io_coat3D/coat.py
+
74
−
153
View file @
a77bfac8
...
...
@@ -97,45 +97,23 @@ class SCENE_PT_Main(ObjectButtonsPanel,bpy.types.Panel):
if
(
bpy
.
context
.
scene
.
objects
.
active
):
coa
=
bpy
.
context
.
scene
.
objects
.
active
.
coat3D
if
(
os
.
path
.
isdir
(
coat3D
.
exchangedir
)):
foldder
=
coat3D
.
exchangedir
if
(
foldder
.
rfind
(
'
Exchange
'
)
>=
0
):
coat
[
'
status
'
]
=
1
else
:
coat
[
'
status
'
]
=
0
else
:
coat
[
'
status
'
]
=
0
if
(
coat
[
'
status
'
]
==
1
):
Blender_folder
=
(
"
%s%sBlender
"
%
(
coat3D
.
exchangedir
,
os
.
sep
))
Blender_export
=
Blender_folder
path3b_now
=
coat3D
.
exchangedir
path3b_now
+=
(
'
last_saved_3b_file.txt
'
)
Blender_export
+=
(
'
%sexport.txt
'
%
(
os
.
sep
))
Blender_folder
=
(
"
%s%sBlender
"
%
(
coat3D
.
exchangedir
,
os
.
sep
))
Blender_export
=
Blender_folder
path3b_now
=
coat3D
.
exchangedir
path3b_now
+=
(
'
last_saved_3b_file.txt
'
)
Blender_export
+=
(
'
%sexport.txt
'
%
(
os
.
sep
))
if
(
not
(
os
.
path
.
isdir
(
Blender_folder
))):
os
.
makedirs
(
Blender_folder
)
Blender_folder
=
os
.
path
.
join
(
Blender_folder
,
"
run.txt
"
)
file
=
open
(
Blender_folder
,
"
w
"
)
file
.
close
()
if
(
not
(
os
.
path
.
isdir
(
Blender_folder
))):
os
.
makedirs
(
Blender_folder
)
Blender_folder
=
os
.
path
.
join
(
Blender_folder
,
"
run.txt
"
)
file
=
open
(
Blender_folder
,
"
w
"
)
file
.
close
()
#Here you add your GUI
row
=
layout
.
row
()
row
.
prop
(
coat3D
,
"
type
"
,
text
=
""
)
row
=
layout
.
row
()
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
colL
=
row
.
column
()
colR
=
row
.
column
()
...
...
@@ -143,10 +121,6 @@ class SCENE_PT_Main(ObjectButtonsPanel,bpy.types.Panel):
colL
.
operator
(
"
import_applink.pilgway_3d_coat
"
,
text
=
"
Update
"
)
if
(
os
.
path
.
isfile
(
Blender_export
)):
row
=
layout
.
row
()
row
.
operator
(
"
import3b_applink.pilgway_3d_coat
"
,
text
=
"
Bring from 3D-Coat
"
)
if
(
coat3D
.
exchange_found
==
False
):
row
=
layout
.
row
()
row
.
label
(
text
=
"
Applink didn
'
t find your 3d-Coat/Excahnge folder.
"
)
...
...
@@ -175,12 +149,22 @@ class SCENE_OT_export(bpy.types.Operator):
activeobj
=
bpy
.
context
.
active_object
.
name
obj
=
scene
.
objects
[
activeobj
]
coa
=
bpy
.
context
.
scene
.
objects
.
active
.
coat3D
export_ok
=
False
coat3D
.
exchangedir
,
folder_objects
,
folder_textures
=
set_folders
()
if
(
coat3D
.
exchange_found
==
False
):
return
{
'
FINISHED
'
}
if
(
bpy
.
context
.
selected_objects
==
[]):
return
{
'
FINISHED
'
}
else
:
for
objec
in
bpy
.
context
.
selected_objects
:
if
objec
.
type
==
'
MESH
'
:
export_ok
=
True
if
(
export_ok
==
False
):
return
{
'
FINISHED
'
}
importfile
=
coat3D
.
exchangedir
texturefile
=
coat3D
.
exchangedir
importfile
+=
(
'
%simport.txt
'
%
(
os
.
sep
))
...
...
@@ -260,6 +244,29 @@ class SCENE_OT_import(bpy.types.Operator):
act_first
=
bpy
.
context
.
scene
.
objects
.
active
bpy
.
context
.
scene
.
game_settings
.
material_mode
=
'
GLSL
'
coat3D
.
exchangedir
,
folder_objects
,
folder_textures
=
set_folders
()
Blender_folder
=
(
"
%s%sBlender
"
%
(
coat3D
.
exchangedir
,
os
.
sep
))
Blender_export
=
Blender_folder
path3b_now
=
coat3D
.
exchangedir
path3b_now
+=
(
'
last_saved_3b_file.txt
'
)
Blender_export
+=
(
'
%sexport.txt
'
%
(
os
.
sep
))
new_applink_name
=
'
False
'
new_object
=
False
print
(
Blender_export
)
if
(
os
.
path
.
isfile
(
Blender_export
)):
obj_pathh
=
open
(
Blender_export
)
new_object
=
True
for
line
in
obj_pathh
:
new_applink_name
=
line
break
obj_pathh
.
close
()
for
scene_objects
in
bpy
.
context
.
scene
.
objects
:
if
(
scene_objects
.
type
==
'
MESH
'
):
if
(
scene_objects
.
coat3D
.
applink_name
==
new_applink_name
):
new_object
=
False
for
act_name
in
test
:
coa
=
act_name
.
coat3D
path_object
=
coa
.
applink_name
...
...
@@ -421,132 +428,46 @@ class SCENE_OT_import(bpy.types.Operator):
act_name
.
select
=
True
bpy
.
context
.
scene
.
objects
.
active
=
act_first
return
{
'
FINISHED
'
}
class
SCENE_OT_import3b
(
bpy
.
types
.
Operator
):
bl_idname
=
"
import3b_applink.pilgway_3d_coat
"
bl_label
=
"
Brings mesh from 3D-Coat
"
bl_description
=
"
Bring 3D-Coat Mesh
"
bl_options
=
{
'
UNDO
'
}
def
invoke
(
self
,
context
,
event
):
coat3D
=
bpy
.
context
.
scene
.
coat3D
scene
=
context
.
scene
Blender_folder
=
(
"
%s%sBlender
"
%
(
coat3D
.
exchangedir
,
os
.
sep
))
Blender_export
=
Blender_folder
path3b_now
=
coat3D
.
exchangedir
path3b_now
+=
(
'
last_saved_3b_file.txt
'
)
Blender_export
+=
(
'
%sexport.txt
'
%
(
os
.
sep
))
import_no
=
0
mat_list
=
[]
obj_path
=
''
obj_pathh
=
open
(
Blender_export
)
for
line
in
obj_pathh
:
obj_path
=
line
break
obj_pathh
.
close
()
export
=
obj_path
mod_time
=
os
.
path
.
getmtime
(
obj_path
)
mtl_list
=
obj_path
.
replace
(
'
.obj
'
,
'
.mtl
'
)
if
(
os
.
path
.
isfile
(
mtl_list
)):
os
.
remove
(
mtl_list
)
if
(
new_object
==
True
):
coat3D
=
bpy
.
context
.
scene
.
coat3D
scene
=
context
.
scene
if
(
os
.
path
.
isfile
(
path3b_now
)):
path3b_file
=
open
(
path3b_now
)
for
lin
in
path3b_file
:
path_export
=
lin
path_on
=
1
path3b_file
.
close
()
os
.
remove
(
path3b_now
)
else
:
path_on
=
0
for
palikka
in
bpy
.
context
.
scene
.
objects
:
if
(
palikka
.
type
==
'
MESH
'
):
if
(
palikka
.
coat3D
.
objectdir
==
export
):
#objectdir muutettava
import_no
=
1
target
=
palikka
break
if
(
import_no
):
new_obj
=
palikka
import_no
=
0
else
:
bpy
.
ops
.
import_scene
.
obj
(
filepath
=
obj_path
,
axis_forward
=
'
X
'
,
axis_up
=
'
Y
'
)
Blender_folder
=
(
"
%s%sBlender
"
%
(
coat3D
.
exchangedir
,
os
.
sep
))
Blender_export
=
Blender_folder
path3b_now
=
coat3D
.
exchangedir
path3b_now
+=
(
'
last_saved_3b_file.txt
'
)
Blender_export
+=
(
'
%sexport.txt
'
%
(
os
.
sep
))
mat_list
=
[]
obj_path
=
''
export
=
new_applink_name
mod_time
=
os
.
path
.
getmtime
(
new_applink_name
)
mtl_list
=
new_applink_name
.
replace
(
'
.obj
'
,
'
.mtl
'
)
if
(
os
.
path
.
isfile
(
mtl_list
)):
os
.
remove
(
mtl_list
)
bpy
.
ops
.
import_scene
.
obj
(
filepath
=
new_applink_name
,
axis_forward
=
'
X
'
,
axis_up
=
'
Y
'
)
bpy
.
ops
.
object
.
transform_apply
(
rotation
=
True
)
new_obj
=
scene
.
objects
[
0
]
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
scene
.
objects
[
0
].
coat3D
.
applink_name
=
export
#objectdir muutettava
os
.
remove
(
Blender
_export
)
os
.
remove
(
Blender_export
)
bpy
.
context
.
scene
.
objects
.
active
=
new_obj
bpy
.
context
.
scene
.
objects
.
active
=
new_obj
bpy
.
ops
.
object
.
shade_smooth
()
Blender_tex
=
(
"
%s%stextures.txt
"
%
(
coat3D
.
exchangedir
,
os
.
sep
))
mat_list
.
append
(
new_obj
.
material_slots
[
0
].
material
)
tex
.
gettex
(
mat_list
,
new_obj
,
scene
,
export
)
return
{
'
FINISHED
'
}
class
SCENE_OT_load3b
(
bpy
.
types
.
Operator
):
bl_idname
=
"
import_applink.pilgway_3d_coat_3b
"
bl_label
=
"
Loads 3b linked into object
"
bl_description
=
"
Loads 3b linked into object
"
def
invoke
(
self
,
context
,
event
):
checkname
=
''
coa
=
bpy
.
context
.
scene
.
objects
.
active
.
coat3D
if
(
coa
.
path3b
):
coat3D
=
bpy
.
context
.
scene
.
coat3D
scene
=
context
.
scene
importfile
=
coat3D
.
exchangedir
importfile
+=
(
'
%simport.txt
'
%
(
os
.
sep
))
coat_path
=
bpy
.
context
.
active_object
.
coat3D
.
path3b
file
=
open
(
importfile
,
"
w
"
)
file
.
write
(
"
%s
"
%
(
coat_path
))
file
.
write
(
"
\n
%s
"
%
(
coat_path
))
file
.
write
(
"
\n
[3B]
"
)
file
.
close
()
bpy
.
ops
.
object
.
shade_smooth
()
Blender_tex
=
(
"
%s%stextures.txt
"
%
(
coat3D
.
exchangedir
,
os
.
sep
))
mat_list
.
append
(
new_obj
.
material_slots
[
0
].
material
)
tex
.
gettex
(
mat_list
,
new_obj
,
scene
,
export
)
return
{
'
FINISHED
'
}
class
SCENE_OT_deltex
(
bpy
.
types
.
Operator
):
bl_idname
=
"
import_applink.pilgway_3d_deltex
"
# XXX, name?
bl_label
=
"
Picks Object
'
s name into path
"
bl_description
=
"
Loads 3b linked into object
"
def
invoke
(
self
,
context
,
event
):
if
(
bpy
.
context
.
selected_objects
):
if
(
context
.
selected_objects
[
0
].
type
==
'
MESH
'
):
coat3D
=
bpy
.
context
.
scene
.
coat3D
coa
=
bpy
.
context
.
scene
.
objects
.
active
.
coat3D
scene
=
context
.
scene
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
#objectdir muutettava
just_nimi
=
tex
.
justname
(
nimi
)
just_nimi
+=
'
_
'
files
=
os
.
listdir
(
osoite
)
for
i
in
files
:
if
(
i
.
rfind
(
just_nimi
)
>=
0
):
del_osoite
=
osoite
+
i
os
.
remove
(
del_osoite
)
return
{
'
FINISHED
'
}
from
bpy
import
*
from
mathutils
import
Vector
,
Matrix
...
...
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