-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from garvita-tiwari/Texture
Texture
- Loading branch information
Showing
10 changed files
with
51 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
__pycache__/ | ||
renders/ | ||
build/ | ||
dist/ | ||
.venv-blender | ||
*.zip | ||
data_samples | ||
preview.png | ||
hdri_thumbs/ | ||
temp.png | ||
blender_render.log | ||
# Ignore everything | ||
* | ||
|
||
# Allow these files | ||
*.py # Python source code | ||
*.md # Markdown files, e.g. the Readme | ||
requirements.txt # requirements for pip | ||
main-linux.spec | ||
main-windows.spec | ||
assets/HDRIs/*.hdr # HDRI images | ||
assets/textures/brick.png # Texture files should be png only for highest quality | ||
assets/textures/iron.png | ||
assets/textures/wood.png | ||
assets/default_settings.yaml # Default settings should be included, but not "settings.yaml" | ||
assets/gui/icon.ico # Program icon | ||
assets/gui/empty_bg.png # Empty image if no render has happend yet | ||
/assets/gui/preview_unavailable.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import bpy | ||
|
||
#import the Texture image | ||
def load_texture(texture_path: str, material: bpy.types.Material): | ||
if material.node_tree.nodes.get("Image Texture") is None: | ||
texImage = material.node_tree.nodes.new(type = "ShaderNodeTexImage") | ||
else: | ||
texImage = material.node_tree.nodes.get("Image Texture") | ||
texImage.image = bpy.data.images.load(bpy.path.relpath(texture_path)) | ||
|
||
#disp is path of Base color | ||
disp=material.node_tree.nodes["Principled BSDF"].inputs["Base Color"] | ||
|
||
#connect the node between 'Base Color' of bsdf and 'Color' of texImage | ||
material.node_tree.links.new(disp,texImage.outputs[0]) | ||
|
||
|
||
def delete_texture(material: bpy.types.Material): | ||
disp=material.node_tree.nodes["Principled BSDF"].inputs["Base Color"] | ||
material.node_tree.links.remove(disp.links[0]) |
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.