diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-03-12 03:05:44 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-03-12 03:05:44 +0300 |
commit | b2b015a396372e39a7035f394f06405b68423fed (patch) | |
tree | d198df235a4a2156a2b869218e7238e16e857838 /materials_utils | |
parent | c7f6ef3fef1315e97fd7326c08b7c7ad7b82762a (diff) |
Update for changes to Blender
Diffstat (limited to 'materials_utils')
-rw-r--r-- | materials_utils/__init__.py | 32 | ||||
-rw-r--r-- | materials_utils/materials_cycles_converter.py | 24 | ||||
-rw-r--r-- | materials_utils/warning_messages_utils.py | 4 |
3 files changed, 30 insertions, 30 deletions
diff --git a/materials_utils/__init__.py b/materials_utils/__init__.py index 8c606742..6c2c1349 100644 --- a/materials_utils/__init__.py +++ b/materials_utils/__init__.py @@ -949,7 +949,7 @@ class VIEW3D_OT_set_new_material_name(Operator): def draw(self, context): layout = self.layout - scene = context.scene.mat_specials + scene = context.scene.mat_context_menu box = layout.box() box.label(text="Base name:") @@ -1004,7 +1004,7 @@ class VIEW3D_OT_assign_material(Operator): def execute(self, context): actob = context.active_object - scene = context.scene.mat_specials + scene = context.scene.mat_context_menu mn = self.matname tweak = scene.use_tweak @@ -1206,7 +1206,7 @@ class VIEW3D_OT_select_material_by_name(Operator): def execute(self, context): if use_mat_menu_type() == 'POPUP': mats_col = context.scene.mat_specials_mats - scene = context.scene.mat_specials + scene = context.scene.mat_context_menu len_mats = len(mats_col) mat_index = scene.index_mat @@ -1579,7 +1579,7 @@ class MATERIAL_OT_check_converter_path(Operator): def check_valid_path(self, context): sc = context.scene - paths = bpy.path.abspath(sc.mat_specials.conv_path) + paths = bpy.path.abspath(sc.mat_context_menu.conv_path) if bpy.data.filepath == "": warning_messages(self, "DIR_PATH_EMPTY", override=True) @@ -1665,10 +1665,10 @@ def draw_ui_list_popups(self, context, obj_data=False): col.template_list( "VIEW3D_UL_assign_material_popup_ui", - 'mat_specials', + 'mat_context_menu', context.scene, 'mat_specials_mats', - context.scene.mat_specials, + context.scene.mat_context_menu, 'index_mat', rows=10 ) @@ -1689,7 +1689,7 @@ class VIEW3D_MT_assign_material(Menu): layout.label(text="*No active Object in the Scene*", icon="INFO") use_separator(self, context) - mat_prop_name = context.scene.mat_specials.set_material_name + mat_prop_name = context.scene.mat_context_menu.set_material_name add_new = layout.operator( "view3d.assign_material", text="Add New", icon='ZOOMIN' @@ -1975,7 +1975,7 @@ class MATERIAL_MT_scenemassive_opt(Menu): def draw(self, context): layout = self.layout - scene = context.scene.mat_specials + scene = context.scene.mat_context_menu layout.prop(scene, "EXTRACT_ALPHA", text="Extract Alpha Textures (slow)") @@ -2037,7 +2037,7 @@ class MATERIAL_PT_scenemassive(Panel): box = col.box() box.label(text="Save Directory") split = box.split(0.85) - split.prop(sc.mat_specials, "conv_path", text="", icon="RENDER_RESULT") + split.prop(sc.mat_context_menu, "conv_path", text="", icon="RENDER_RESULT") split.operator("material.check_converter_path", text="", icon="EXTERNAL_DATA") @@ -2378,7 +2378,7 @@ class VIEW3D_MT_material_utils_pref(AddonPreferences): box = col_m.box() box.label(text="Save Directory") split = box.split(0.85) - split.prop(sc.mat_specials, "conv_path", text="", icon="RENDER_RESULT") + split.prop(sc.mat_context_menu, "conv_path", text="", icon="RENDER_RESULT") split.operator( "material.check_converter_path", text="", icon="EXTERNAL_DATA" @@ -2664,7 +2664,7 @@ def register(): warning_messages_utils.MAT_SPEC_NAME = __name__ # Register Scene Properties - bpy.types.Scene.mat_specials = PointerProperty( + bpy.types.Scene.mat_context_menu = PointerProperty( type=material_specials_scene_props ) bpy.types.Scene.mat_specials_mats = CollectionProperty( @@ -2678,8 +2678,8 @@ def register(): kmi = km.keymap_items.new('wm.call_menu', 'Q', 'PRESS', shift=True) kmi.properties.name = "VIEW3D_MT_master_material" - bpy.types.MATERIAL_MT_specials.prepend(menu_move) - bpy.types.MATERIAL_MT_specials.append(menu_func) + bpy.types.MATERIAL_MT_context_menu.prepend(menu_move) + bpy.types.MATERIAL_MT_context_menu.append(menu_func) def unregister(): @@ -2692,10 +2692,10 @@ def unregister(): km.keymap_items.remove(kmi) break - bpy.types.MATERIAL_MT_specials.remove(menu_move) - bpy.types.MATERIAL_MT_specials.remove(menu_func) + bpy.types.MATERIAL_MT_context_menu.remove(menu_move) + bpy.types.MATERIAL_MT_context_menu.remove(menu_func) - del bpy.types.Scene.mat_specials + del bpy.types.Scene.mat_context_menu del bpy.types.Scene.mat_specials_mats bpy.utils.unregister_module(__name__) diff --git a/materials_utils/materials_cycles_converter.py b/materials_utils/materials_cycles_converter.py index 11d2affa..573e4309 100644 --- a/materials_utils/materials_cycles_converter.py +++ b/materials_utils/materials_cycles_converter.py @@ -117,8 +117,8 @@ def BakingText(tex, mode, tex_type=None): sizeX = tex.texture.image.size[0] sizeY = tex.texture.image.size[1] else: - bake_size = (int(sc.mat_specials.img_bake_size) if - sc.mat_specials.img_bake_size else 1024) + bake_size = (int(sc.mat_context_menu.img_bake_size) if + sc.mat_context_menu.img_bake_size else 1024) sizeX = bake_size sizeY = bake_size @@ -143,7 +143,7 @@ def BakingText(tex, mode, tex_type=None): check_area = False if check_area: - paths = bpy.path.abspath(sc.mat_specials.conv_path) + paths = bpy.path.abspath(sc.mat_context_menu.conv_path) tex_name = getattr(getattr(tex.texture, "image", None), "name", None) texture_name = (tex_name.rpartition(".")[0] if tex_name else tex.texture.name) new_tex_name = "baked" @@ -207,7 +207,7 @@ def AutoNodeInitiate(active=False, operator=None): CHECK_AUTONODE = True collect_report("_______________________", True, False) AutoNode(active, operator) - if sc.mat_specials.SET_FAKE_USER: + if sc.mat_context_menu.SET_FAKE_USER: SetFakeUserTex() else: warning_messages(operator, 'DIR_PATH_CONVERT', override=True) @@ -281,7 +281,7 @@ def AutoNode(active=False, operator=None): link_fail = True # Create other shader types only sculpt/texture paint mode is False - sculpt_paint = sc.mat_specials.SCULPT_PAINT + sculpt_paint = sc.mat_context_menu.SCULPT_PAINT if sculpt_paint is False: cmat_is_transp = cmat.use_transparency and cmat.alpha < 1 @@ -451,10 +451,10 @@ def AutoNode(active=False, operator=None): img = None if tex.texture.type == 'IMAGE': - if sc.mat_specials.EXTRACT_ALPHA and tex.texture.use_alpha: + if sc.mat_context_menu.EXTRACT_ALPHA and tex.texture.use_alpha: if (not os_path.exists(bpy.path.abspath(tex.texture.image.filepath + "_BAKING.png")) or - sc.mat_specials.EXTRACT_OW): + sc.mat_context_menu.EXTRACT_OW): baked_path = BakingText(tex, 'ALPHA') if baked_path: @@ -488,9 +488,9 @@ def AutoNode(active=False, operator=None): collect_report("ERROR: A problem occurred with loading an image for {} " "(possibly missing)".format(tex.texture.name)) else: - if sc.mat_specials.EXTRACT_PTEX or (sc.mat_specials.EXTRACT_ALPHA and ma_alpha): + if sc.mat_context_menu.EXTRACT_PTEX or (sc.mat_context_menu.EXTRACT_ALPHA and ma_alpha): if (not os_path.exists(bpy.path.abspath(tex.texture.name + "_PTEXT.jpg")) or - sc.mat_specials.EXTRACT_OW): + sc.mat_context_menu.EXTRACT_OW): tex_type = tex.texture.type.lower() collect_report("Attempting to Extract Procedural Texture type: " + tex_type) baked_path = BakingText(tex, 'PTEX', tex_type) @@ -673,8 +673,8 @@ def AutoNode(active=False, operator=None): if sculpt_paint: try: # create a new image for texture painting and make it active - img_size = (int(sc.mat_specials.img_bake_size) if - sc.mat_specials.img_bake_size else 1024) + img_size = (int(sc.mat_context_menu.img_bake_size) if + sc.mat_context_menu.img_bake_size else 1024) paint_mat_name = getattr(cmat, "name", "NO NAME") paint_img_name = "Paint Base Image {}".format(paint_mat_name) bpy.ops.image.new(name=paint_img_name, width=img_size, height=img_size, @@ -848,7 +848,7 @@ def create_mix_node(TreeNodes, links, nodes, loc, start, median_point, row, fram def unwrap_active_object(context): - enable_unwrap = context.scene.mat_specials.UV_UNWRAP + enable_unwrap = context.scene.mat_context_menu.UV_UNWRAP if enable_unwrap: obj_name = getattr(context.active_object, "name", "UNNAMED OBJECT") try: diff --git a/materials_utils/warning_messages_utils.py b/materials_utils/warning_messages_utils.py index 435bcdfd..1ce12d9d 100644 --- a/materials_utils/warning_messages_utils.py +++ b/materials_utils/warning_messages_utils.py @@ -6,7 +6,7 @@ import bpy # Globals # # change the name for the properties settings -MAT_SPEC_NAME = "materials_specials" +MAT_SPEC_NAME = "materials_context_menu" # collect messages for the report operator COLLECT_REPORT = [] @@ -139,7 +139,7 @@ def collect_report(collection="", is_start=False, is_final=False): # collection passes a string for appending to COLLECT_REPORT global # is_final switches to the final report with the operator in __init__ global COLLECT_REPORT - scene = bpy.context.scene.mat_specials + scene = bpy.context.scene.mat_context_menu use_report = scene.enable_report if is_start: |