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
4b94ad37
Commit
4b94ad37
authored
14 years ago
by
Kalle-Samuli Riihikoski
Browse files
Options
Downloads
Patches
Plain Diff
New 3b path feature added.
parent
43217b12
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
+6
-0
6 additions, 0 deletions
io_coat3D/__init__.py
io_coat3D/coat.py
+68
-22
68 additions, 22 deletions
io_coat3D/coat.py
io_coat3D/tex.py
+3
-1
3 additions, 1 deletion
io_coat3D/tex.py
with
77 additions
and
23 deletions
io_coat3D/__init__.py
+
6
−
0
View file @
4b94ad37
...
...
@@ -83,6 +83,12 @@ def register():
default
=
""
)
coat3D
.
path3b
=
StringProperty
(
name
=
"
3B Path
"
,
subtype
=
"
FILE_PATH
"
,
default
=
""
)
class
coat3D
(
bpy
.
types
.
IDPropertyGroup
):
pass
...
...
This diff is collapsed.
Click to expand it.
io_coat3D/coat.py
+
68
−
22
View file @
4b94ad37
...
...
@@ -93,7 +93,16 @@ class SCENE_PT_Main(ObjectButtonsPanel,bpy.types.Panel):
if
(
bpy
.
context
.
selected_objects
):
if
(
context
.
selected_objects
[
0
].
type
==
'
MESH
'
):
row
.
label
(
text
=
"
%s Path:
"
%
(
bpy
.
context
.
scene
.
objects
.
active
.
name
))
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
=
""
)
...
...
@@ -102,6 +111,9 @@ class SCENE_PT_Main(ObjectButtonsPanel,bpy.types.Panel):
if
(
coat
[
'
status
'
]
==
1
):
Blender_folder
=
(
"
%s%sBlender
"
%
(
coat3D
.
exchangedir
,
os
.
sep
))
Blender_export
=
Blender_folder
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
))):
...
...
@@ -117,12 +129,22 @@ class SCENE_PT_Main(ObjectButtonsPanel,bpy.types.Panel):
obj_path
=
line
break
obj_pathh
.
close
()
print
(
"
%s
"
%
obj_path
)
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
(
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
:
print
(
"
ei toimi
"
)
path_on
=
0
for
palikka
in
bpy
.
context
.
scene
.
objects
:
if
(
palikka
.
type
==
'
MESH
'
):
...
...
@@ -138,6 +160,9 @@ class SCENE_PT_Main(ObjectButtonsPanel,bpy.types.Panel):
bpy
.
ops
.
import_scene
.
obj
(
filepath
=
obj_path
)
new_obj
=
scene
.
objects
[
0
]
scene
.
objects
[
0
].
coat3D
.
objectdir
=
export
if
(
path_on
):
scene
.
objects
[
0
].
coat3D
.
path3b
=
path_export
os
.
remove
(
Blender_export
)
bpy
.
context
.
scene
.
objects
.
active
=
new_obj
...
...
@@ -155,6 +180,7 @@ class SCENE_PT_Main(ObjectButtonsPanel,bpy.types.Panel):
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
()
...
...
@@ -175,12 +201,25 @@ class SCENE_PT_Settings(ObjectButtonsPanel,bpy.types.Panel):
layout
=
self
.
layout
scene
=
context
.
scene
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
=
""
)
row
=
layout
.
row
()
if
(
bpy
.
context
.
scene
.
objects
.
active
):
coa
=
bpy
.
context
.
scene
.
objects
.
active
.
coat3D
row
=
layout
.
row
()
row
.
label
(
text
=
"
3b path:
"
)
row
=
layout
.
row
()
row
.
prop
(
coa
,
"
path3b
"
,
text
=
""
)
#colL = row.column()
#colR = row.column()
#colL.prop(coat3D,"export_box")
...
...
@@ -201,12 +240,7 @@ class SCENE_PT_Settings(ObjectButtonsPanel,bpy.types.Panel):
#row = layout.row()
#colL = row.column()
#colR = row.column()
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
"
)
...
...
@@ -302,6 +336,8 @@ class SCENE_OT_import(bpy.types.Operator):
coa
=
bpy
.
context
.
scene
.
objects
.
active
.
coat3D
exportfile
=
coat3D
.
exchangedir
path3b_n
=
coat3D
.
exchangedir
path3b_n
+=
(
'
last_saved_3b_file.txt
'
)
exportfile
+=
(
'
%sexport.txt
'
%
(
os
.
sep
))
if
(
os
.
path
.
isfile
(
exportfile
)):
export_file
=
open
(
exportfile
)
...
...
@@ -335,6 +371,7 @@ class SCENE_OT_import(bpy.types.Operator):
proxy_mat
.
user_clear
()
bpy
.
data
.
materials
.
remove
(
proxy_mat
)
bpy
.
ops
.
object
.
select_all
(
action
=
'
TOGGLE
'
)
if
(
coat3D
.
export_pos
):
scene
.
objects
.
active
=
objekti
objekti
.
select
=
True
...
...
@@ -382,6 +419,7 @@ class SCENE_OT_import(bpy.types.Operator):
bpy
.
ops
.
object
.
delete
()
objekti
.
select
=
True
bpy
.
context
.
scene
.
objects
.
active
=
objekti
...
...
@@ -389,6 +427,13 @@ class SCENE_OT_import(bpy.types.Operator):
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
...
...
@@ -427,19 +472,20 @@ class SCENE_OT_load3b(bpy.types.Operator):
def
invoke
(
self
,
context
,
event
):
checkname
=
''
coat3D
=
bpy
.
context
.
scene
.
coat3D
scene
=
context
.
scene
importfile
=
coat3D
.
exchangedir
importfile
+=
(
'
%simport.txt
'
%
(
os
.
sep
))
coat_path
=
bpy
.
context
.
active_object
.
coat3D
.
coatpath
file
=
open
(
importfile
,
"
w
"
)
file
.
write
(
"
%s
"
%
(
coat_path
))
file
.
write
(
"
\n
%s
"
%
(
coat_path
))
file
.
write
(
"
\n
[3B]
"
)
file
.
close
()
coat
[
'
active_coat
'
]
=
coat_path
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
()
return
(
'
FINISHED
'
)
...
...
This diff is collapsed.
Click to expand it.
io_coat3D/tex.py
+
3
−
1
View file @
4b94ad37
...
...
@@ -37,7 +37,7 @@ def find_index(objekti):
def
gettex
(
mat_list
,
objekti
,
scene
,
export
):
coat3D
=
bpy
.
context
.
scene
.
coat3D
coa
=
bpy
.
context
.
scene
.
objects
.
active
.
coat3D
if
(
bpy
.
context
.
scene
.
render
.
engine
==
'
VRAY_RENDER
'
or
bpy
.
context
.
scene
.
render
.
engine
==
'
VRAY_RENDER_PREVIEW
'
):
vray
=
True
...
...
@@ -73,6 +73,7 @@ def gettex(mat_list, objekti, scene,export):
if
(
tex_slot
.
texture
.
type
==
'
IMAGE
'
):
tex_slot
.
texture
.
image
.
reload
()
else
:
coa
=
bpy
.
context
.
scene
.
objects
.
active
.
coat3D
nimi
=
objname
(
coa
.
objectdir
)
if
(
coa
.
texturefolder
):
osoite
=
os
.
path
.
dirname
(
coa
.
texturefolder
)
+
os
.
sep
...
...
@@ -235,6 +236,7 @@ def gettex(mat_list, objekti, scene,export):
objekti
.
active_material
.
texture_slots
[
index
].
uv_layer
=
objekti
.
data
.
uv_textures
.
active
.
name
objekti
.
active_material
.
texture_slots
[
index
].
use_map_color_diffuse
=
False
objekti
.
active_material
.
texture_slots
[
index
].
use_map_normal
=
True
objekti
.
active_material
.
texture_slots
[
index
].
normal_factor
=
-
1
if
(
bring_spec
==
1
and
texcoat
[
'
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