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
21d0fbf5
Commit
21d0fbf5
authored
11 years ago
by
Bastien Montagne
Browse files
Options
Downloads
Patches
Plain Diff
Fix import image as plane to work in Blender Game engine mode too.
parent
e7e74d4d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
io_import_images_as_planes.py
+5
-5
5 additions, 5 deletions
io_import_images_as_planes.py
with
5 additions
and
5 deletions
io_import_images_as_planes.py
+
5
−
5
View file @
21d0fbf5
...
@@ -317,8 +317,7 @@ class IMPORT_OT_image_to_plane(Operator, AddObjectHelper):
...
@@ -317,8 +317,7 @@ class IMPORT_OT_image_to_plane(Operator, AddObjectHelper):
# the add utils don't work in this case because many objects are added disable relevant things beforehand
# the add utils don't work in this case because many objects are added disable relevant things beforehand
editmode
=
context
.
user_preferences
.
edit
.
use_enter_edit_mode
editmode
=
context
.
user_preferences
.
edit
.
use_enter_edit_mode
context
.
user_preferences
.
edit
.
use_enter_edit_mode
=
False
context
.
user_preferences
.
edit
.
use_enter_edit_mode
=
False
if
(
context
.
active_object
and
if
context
.
active_object
and
context
.
active_object
.
mode
==
'
EDIT
'
:
context
.
active_object
.
mode
==
'
EDIT
'
):
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
OBJECT
'
)
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
OBJECT
'
)
self
.
import_images
(
context
)
self
.
import_images
(
context
)
...
@@ -333,16 +332,17 @@ class IMPORT_OT_image_to_plane(Operator, AddObjectHelper):
...
@@ -333,16 +332,17 @@ class IMPORT_OT_image_to_plane(Operator, AddObjectHelper):
images
=
(
load_image
(
path
,
directory
)
for
path
in
import_list
)
images
=
(
load_image
(
path
,
directory
)
for
path
in
import_list
)
if
engine
==
'
BLENDER_RENDER
'
:
if
engine
in
{
'
BLENDER_RENDER
'
,
'
BLENDER_GAME
'
}
:
textures
=
[]
textures
=
[]
for
img
in
images
:
for
img
in
images
:
self
.
set_image_options
(
img
)
self
.
set_image_options
(
img
)
textures
.
append
(
self
.
create_image_textures
(
context
,
img
))
textures
.
append
(
self
.
create_image_textures
(
context
,
img
))
materials
=
(
self
.
create_material_for_texture
(
tex
)
for
tex
in
textures
)
materials
=
(
self
.
create_material_for_texture
(
tex
)
for
tex
in
textures
)
elif
engine
==
'
CYCLES
'
:
elif
engine
==
'
CYCLES
'
:
materials
=
(
self
.
create_cycles_material
(
img
)
for
img
in
images
)
materials
=
(
self
.
create_cycles_material
(
img
)
for
img
in
images
)
else
:
return
planes
=
tuple
(
self
.
create_image_plane
(
context
,
mat
)
for
mat
in
materials
)
planes
=
tuple
(
self
.
create_image_plane
(
context
,
mat
)
for
mat
in
materials
)
...
@@ -357,7 +357,7 @@ class IMPORT_OT_image_to_plane(Operator, AddObjectHelper):
...
@@ -357,7 +357,7 @@ class IMPORT_OT_image_to_plane(Operator, AddObjectHelper):
def
create_image_plane
(
self
,
context
,
material
):
def
create_image_plane
(
self
,
context
,
material
):
engine
=
context
.
scene
.
render
.
engine
engine
=
context
.
scene
.
render
.
engine
if
engine
==
'
BLENDER_RENDER
'
:
if
engine
in
{
'
BLENDER_RENDER
'
,
'
BLENDER_GAME
'
}
:
img
=
material
.
texture_slots
[
0
].
texture
.
image
img
=
material
.
texture_slots
[
0
].
texture
.
image
elif
engine
==
'
CYCLES
'
:
elif
engine
==
'
CYCLES
'
:
nodes
=
material
.
node_tree
.
nodes
nodes
=
material
.
node_tree
.
nodes
...
...
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