Home > other >  Python: AttributeError: AttributeError: "NoneType" object has no attributes "inputs&q
Python: AttributeError: AttributeError: "NoneType" object has no attributes "inputs&q

Time:09-18

in the software to use plug-ins times wrong, the last sentence is AttributeError:" NoneType "object has no attributes" inputs "

The original tip
Back last time (on the phone) :
execute the file "C: \ Users \ \ Administrator \ AppData \ Roaming \ Blender Foundation \ Blender 2.81 \ \ scripts \ addons \ DECALmachine \ operators \ bake py", line 133
Target_mask=bake_target_mask (bakescene bakebasepath, target. The name, 'mask' bakeimg, bakemat, margin=0, ray_distance=ray_distance)
File "C: \ Users \ \ Administrator \ AppData \ Roaming \ Blender Foundation \ Blender 2.81 \ \ scripts \ addons \ DECALmachine \ utils \ bake py", in 161, is located in bake_target_mask
Tree. The links. The new (emit outputs [' Emission '], the output. The inputs [' Surface '])
AttributeError: "NoneType" object has no attributes "inputs"


Location: & lt; Unknown locations & gt; : 1



This is the original py files


# TODO: always bake combine masks?


Class Bake (bpy) types) Operator) :
Bl_idname="machin3. Bake_decals"
Bl_label="MACHIN3: Bake Decals"
Bl_description="description"
Bl_options={' REGISTER ', 'UNDO'}

@ classmethod
Def poll (CLS, context) :
If get_prefs (). Pil and context. Mode=='OBJECT' :
Dm=context. The scene. The dm
If any ([dm export_bake_color, dm export_bake_normal, dm. Export_bake_aocurvheight, dm. Export_bake_masks]) :
Return [obj for obj in context. Selected_objects if obj. Type=='MESH' and not obj. DM. Isdecal and obj. Data. Uv_layers and not obj. DM. Prebakepreviewmats and not obj. Name=='Combined']

Def the execute (self, the context) :
# only non decal mesh objects with decal children can be baked down to
The targets=[obj for obj in context. Selected_objects if obj. Type=='MESH' and not obj. DM. Isdecal and obj. Data. Uv_layers and [the child for the child in obj. Children if child. DM. Isdecal] and not obj. DM. Prebakepreviewmats and not obj. Name=='Combined']

If the targets:
Start=datetime. Now ()

Templatepath=OS. Path. Join (get_path (), "the resources", "Templates. Blend")
(get_path exportpath=OS. Path. The join (), "assets" and "Export")
Bakespath=OS. Path. Join (exportpath, "bakes")
Blendname=OS. Path. The basename (bpy. Data. Filepath) [: - 6] if bpy) data. The filepath else '
Bakebasepath=create_bakebasepath (bakespath blendname)

# get the current cyclcles device
Device=context. Scene. Cycles. The device

Dm=context. The scene. The dm

Width=dm. Export_bake_x
Height=dm. Export_bake_y
Supersample=int (dm. Export_bake_supersample)
Samples=dm. Export_bake_samples

# turn off prefs. Edit. Use_enter_edit_mode
Init_prefs (context)

Print (" \ nInfo: Starting to bake decals to % s, samples with the at % s % s and % dx Anti Aliasing using the % s -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "% ("," join ([for the target with a target. The name in the targets]), the "x". Join ([STR (width), STR (height)]), samples, supersample, device))

If supersample:
Width *=supersample
Height *=supersample

Margin=dm. Export_bake_margin
Ray_distance=dm. Export_bake_distance
Triangulate=dm. Export_bake_triangulate

Combine_bakes=dm. Export_bake_combine_bakes and len (targets) & gt; 1
Preview_bakes=dm. Export_bake_preview
Open_bake_folder=dm. Export_bake_open_folder
Substance_naming=dm. Export_bake_substance_naming

Bake_color=dm. Export_bake_color
Bake_normal=dm. Export_bake_normal
Bake_aocurvheight=dm. Export_bake_aocurvheight
Bake_masks=dm. Export_bake_masks


# first, remove any orphan decals, otherwise you may get the problems linking decals to the bakescene, especially in the local view with orphan decals (not backups)
Remove_decal_orphans (debug=True)

# get the current (pre bakescene) view_layer
View_layer=context. View_layer

# the get and set the create scene
Bakescene=append_scene (templatepath, "Bake")

# the switch to the bakescene
The context. The window. The scene=bakescene

# set the bakescene cycles device
Bakescene. Cycles. Device=device

# set the samples
Bakescene. Cycles. Samples=samples

# set tilesize "according to render the size, see https://devtalk.blender.org/t/why-is-texture-baking-so-mind-meltingly-slow/5653
# -based on my tests, I can not see any speed improvement, in fact it 's what seconds slower, * 256-2048
# if device=='CPU' :
# bpy. Context. Scene. Render. Tile_x=width
# bpy. Context. Scene. Render. Tile_y=height

# get baketypes
Baketypes=[]

If bake_color:
Baketypes. Append (' COLOR ')

If bake_normal:
Baketypes. Append (' NORMAL ')

If bake_aocurvheight:
Baketypes. Append (' AO_CURV_HEIGHT ')

If bake_masks:
Baketypes. Append (' SUBSET)

# the initialize bakes dict, which collects the main bakes per target
Bakes={}

For the target in the targets:
Bakes/target={}

If baketypes:
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related