def draw(self, context): layout = self.layout col = layout.column() # layout.template_icon_view(bkit_ratings, property, show_labels=False, scale=6.0, scale_popup=5.0) col.label(text=self.message) row = col.row() row.prop(self, 'rating_quality_ui', expand=True, icon_only=True, emboss=False) # row.label(text=str(self.rating_quality)) col.separator() row = layout.row() row.label(text=f"How many hours did this {self.asset_type} save you?") if self.asset_type in ('model', 'scene'): row = layout.row() if utils.profile_is_validator(): col.prop(self, 'rating_work_hours') row.prop(self, 'rating_work_hours_ui', expand=True, icon_only=False, emboss=True) if float(self.rating_work_hours_ui) > 100: utils.label_multiline(layout, text=f"\nThat's huge! please be sure to give such rating only to godly {self.asset_type}s.\n", width=500) elif float(self.rating_work_hours_ui) > 18: layout.separator() utils.label_multiline(layout, text=f"\nThat's a lot! please be sure to give such rating only to amazing {self.asset_type}s.\n", width=500) else: row = layout.row() row.prop(self, 'rating_work_hours_ui_1_5', expand=True, icon_only=False, emboss=True)
def draw(self, context): props = utils.get_upload_props() layout = self.layout if self.reupload: # layout.prop(self, 'metadata') layout.prop(self, 'main_file') layout.prop(self, 'thumbnail') if props.asset_base_id != '' and not self.reupload: layout.label(text="Really upload as new? ") layout.label(text="Do this only when you create a new asset from an old one.") layout.label(text="For updates of thumbnail or model use reupload.") if props.is_private == 'PUBLIC': if self.asset_type == 'MODEL': utils.label_multiline(layout, text='You marked the asset as public.\n' 'This means it will be validated by our team.\n\n' 'Please test your upload after it finishes:\n' '- Open a new file\n' '- Find the asset and download it\n' '- Check if it snaps correctly to surfaces\n' '- Check if it has all textures and renders as expected\n' '- Check if it has correct size in world units (for models)' , width=400) else: utils.label_multiline(layout, text='You marked the asset as public.\n' 'This means it will be validated by our team.\n\n' 'Please test your upload after it finishes:\n' '- Open a new file\n' '- Find the asset and download it\n' '- Check if it works as expected\n' , width=400)
def draw(self, context): props = utils.get_upload_props() layout = self.layout if self.reupload: # layout.prop(self, 'metadata') layout.prop(self, 'main_file') layout.prop(self, 'thumbnail') if props.asset_base_id != '' and not self.reupload: layout.label(text="Really upload as new? ") layout.label( text="Do this only when you create a new asset from an old one." ) layout.label( text="For updates of thumbnail or model use reupload.") if props.is_private == 'PUBLIC': utils.label_multiline( layout, text='public assets are validated several hours' ' or days after upload. Remember always to ' 'test download your asset to a clean file' ' to see if it uploaded correctly.', width=300)
def draw(self, context): layout = self.layout utils.label_multiline(layout, text=self.message) layout.active_default = True op = layout.operator("wm.url_open", text=self.link_text, icon='QUESTION') op.url = self.url
def draw_ratings_menu(self, context, layout): pcoll = icons.icon_collections["main"] profile_name = '' profile = bpy.context.window_manager.get('bkit profile') if profile and len(profile['user']['firstName']) > 0: profile_name = ' ' + profile['user']['firstName'] col = layout.column() # layout.template_icon_view(bkit_ratings, property, show_labels=False, scale=6.0, scale_popup=5.0) row = col.row() row.label(text='Quality:', icon='SOLO_ON') row = col.row() row.label(text='Please help the community by rating quality:') row = col.row() row.prop(self, 'rating_quality_ui', expand=True, icon_only=True, emboss=False) if self.rating_quality > 0: # row = col.row() row.label(text=f' Thanks{profile_name}!', icon='FUND') # row.label(text=str(self.rating_quality)) col.separator() col.separator() row = col.row() row.label(text='Complexity:', icon_value=pcoll['dumbbell'].icon_id) row = col.row() row.label(text=f"How many hours did this {self.asset_type} save you?") if utils.profile_is_validator(): row = col.row() row.prop(self, 'rating_work_hours') if self.asset_type in ('model', 'scene'): row = col.row() row.prop(self, 'rating_work_hours_ui', expand=True, icon_only=False, emboss=True) if float(self.rating_work_hours_ui) > 100: utils.label_multiline(col, text=f"\nThat's huge! please be sure to give such rating only to godly {self.asset_type}s.\n", width=500) elif float(self.rating_work_hours_ui) > 18: col.separator() utils.label_multiline(col, text=f"\nThat's a lot! please be sure to give such rating only to amazing {self.asset_type}s.\n", width=500) elif self.asset_type == 'hdr': row = col.row() row.prop(self, 'rating_work_hours_ui_1_10', expand=True, icon_only=False, emboss=True) else: row = col.row() row.prop(self, 'rating_work_hours_ui_1_5', expand=True, icon_only=False, emboss=True) if self.rating_work_hours > 0: row = col.row() row.label(text=f'Thanks{profile_name}, you are amazing!', icon='FUND')
def draw_panel_material_search(self, context): wm = context.scene props = wm.blenderkit_mat layout = self.layout row = layout.row() row.prop(props, "search_keywords", text="", icon='VIEWZOOM') draw_assetbar_show_hide(row, props) layout.prop(props, "own_only") utils.label_multiline(layout, text=props.report)
def draw_upload_common(layout, props, asset_type, context): op = layout.operator("wm.url_open", text="Read upload instructions", icon='QUESTION') if asset_type == 'MODEL': op.url = paths.BLENDERKIT_MODEL_UPLOAD_INSTRUCTIONS_URL if asset_type == 'MATERIAL': op.url = paths.BLENDERKIT_MATERIAL_UPLOAD_INSTRUCTIONS_URL if asset_type == 'BRUSH': op.url = paths.BLENDERKIT_BRUSH_UPLOAD_INSTRUCTIONS_URL row = layout.row(align=True) if props.upload_state != '': utils.label_multiline(layout, text=props.upload_state, width=context.region.width) if props.uploading: op = layout.operator('object.kill_bg_process', text="", icon='CANCEL') op.process_source = asset_type op.process_type = 'UPLOAD' layout = layout.column() layout.enabled = False # if props.upload_state.find('Error') > -1: # layout.label(text = props.upload_state) if props.asset_base_id == '': optext = 'Upload %s' % asset_type.lower() op = layout.operator("object.blenderkit_upload", text=optext, icon='EXPORT') op.asset_type = asset_type if props.asset_base_id != '': op = layout.operator("object.blenderkit_upload", text='Reupload asset', icon='EXPORT') op.asset_type = asset_type op.reupload = True op = layout.operator("object.blenderkit_upload", text='Upload as new asset', icon='EXPORT') op.asset_type = asset_type op.reupload = False # layout.label(text = 'asset id, overwrite only for reuploading') layout.label(text='asset has a version online.') # row = layout.row() # row.enabled = False # row.prop(props, 'asset_base_id', icon='FILE_TICK') # row = layout.row() # row.enabled = False # row.prop(props, 'id', icon='FILE_TICK') layout.prop(props, 'category') if asset_type == 'MODEL' and props.subcategory != '': # by now block this for other asset types. layout.prop(props, 'subcategory') layout.prop(props, 'is_private', expand=True) if props.is_private == 'PUBLIC': layout.prop(props, 'license')
def draw_panel_model_upload(self, context): ob = bpy.context.active_object while ob.parent is not None: ob = ob.parent props = ob.blenderkit layout = self.layout draw_upload_common(layout, props, 'MODEL', context) prop_needed(layout, props, 'name', props.name) col = layout.column() if props.is_generating_thumbnail: col.enabled = False prop_needed(col, props, 'thumbnail', props.has_thumbnail, False) if bpy.context.scene.render.engine in ('CYCLES', 'BLENDER_EEVEE'): col.operator("object.blenderkit_generate_thumbnail", text='Generate thumbnail', icon='IMAGE') # row = layout.row(align=True) if props.is_generating_thumbnail: row = layout.row(align=True) row.label(text=props.thumbnail_generating_state) op = row.operator('object.kill_bg_process', text="", icon='CANCEL') op.process_source = 'MODEL' op.process_type = 'THUMBNAILER' elif props.thumbnail_generating_state != '': utils.label_multiline(layout, text=props.thumbnail_generating_state) layout.prop(props, 'description') layout.prop(props, 'tags') # prop_needed(layout, props, 'style', props.style) # prop_needed(layout, props, 'production_level', props.production_level) layout.prop(props, 'style') layout.prop(props, 'production_level') layout.prop(props, 'condition') layout.prop(props, 'is_free') layout.prop(props, 'pbr') layout.label(text='design props:') layout.prop(props, 'manufacturer') layout.prop(props, 'designer') layout.prop(props, 'design_collection') layout.prop(props, 'design_variant') layout.prop(props, 'use_design_year') if props.use_design_year: layout.prop(props, 'design_year') row = layout.row() row.prop(props, 'work_hours') layout.prop(props, 'adult')
def draw_panel_scene_search(self, context): s = context.scene props = s.blenderkit_scene layout = self.layout # layout.label(text = "common search properties:") row = layout.row() row.prop(props, "search_keywords", text="", icon='VIEWZOOM') draw_assetbar_show_hide(row, props) layout.prop(props, "own_only") utils.label_multiline(layout, text=props.report) # layout.prop(props, "search_style") # if props.search_style == 'OTHER': # layout.prop(props, "search_style_other") # layout.prop(props, "search_engine") layout.separator()
def draw_panel_material_upload(self, context): o = bpy.context.active_object mat = bpy.context.active_object.active_material props = mat.blenderkit layout = self.layout draw_upload_common(layout, props, 'MATERIAL', context) prop_needed(layout, props, 'name', props.name) layout.prop(props, 'description') layout.prop(props, 'style') # if props.style == 'OTHER': # layout.prop(props, 'style_other') # layout.prop(props, 'engine') # if props.engine == 'OTHER': # layout.prop(props, 'engine_other') layout.prop(props, 'tags') # layout.prop(props,'shaders')#TODO autofill on upload # row = layout.row() layout.prop(props, 'is_free') layout.prop(props, 'pbr') layout.prop(props, 'uv') layout.prop(props, 'animated') layout.prop(props, 'texture_size_meters') # THUMBNAIL row = layout.row() if props.is_generating_thumbnail: row.enabled = False prop_needed(row, props, 'thumbnail', props.has_thumbnail, False) if props.is_generating_thumbnail: row = layout.row(align=True) row.label(text=props.thumbnail_generating_state, icon='RENDER_STILL') op = row.operator('object.kill_bg_process', text="", icon='CANCEL') op.process_source = 'MATERIAL' op.process_type = 'THUMBNAILER' elif props.thumbnail_generating_state != '': utils.label_multiline(layout, text=props.thumbnail_generating_state) if bpy.context.scene.render.engine in ('CYCLES', 'BLENDER_EEVEE'): layout.operator("object.blenderkit_material_thumbnail", text='Render thumbnail with Cycles', icon='EXPORT')
def draw(self, context): # draw asset properties here layout = self.layout o = utils.get_active_model() # o = bpy.context.active_object if o.get('asset_data') is None: utils.label_multiline(layout, text='To upload this asset to BlenderKit, go to the Find and Upload Assets panel.') layout.prop(o, 'name') if o.get('asset_data') is not None: ad = o['asset_data'] layout.label(text=str(ad['name'])) if o.instance_type == 'COLLECTION' and o.instance_collection is not None: layout.operator('object.blenderkit_bring_to_scene', text='Bring to scene') layout.label(text='Ratings:') draw_panel_model_rating(self, context) layout.label(text='Asset tools:') draw_asset_context_menu(self, context, ad)
def draw_panel_model_search(self, context): s = context.scene props = s.blenderkit_models layout = self.layout row = layout.row() row.prop(props, "search_keywords", text="", icon='VIEWZOOM') draw_assetbar_show_hide(row, props) icon = 'NONE' if props.report == 'You need Full plan to get this item.': icon = 'ERROR' utils.label_multiline(layout, text=props.report, icon=icon) if props.report == 'You need Full plan to get this item.': layout.operator("wm.url_open", text="Get Full plan", icon='URL').url = paths.BLENDERKIT_PLANS layout.prop(props, "search_style") layout.prop(props, "own_only") layout.prop(props, "free_only")
def draw(self, context): layout = self.layout utils.label_multiline(layout, text=self.message)
def draw(self, context): s = context.scene ui_props = s.blenderkitUI user_preferences = bpy.context.preferences.addons['blenderkit'].preferences wm = bpy.context.window_manager layout = self.layout # layout.prop_tabs_enum(ui_props, "asset_type", icon_only = True) row = layout.row() # row.scale_x = 1.6 # row.scale_y = 1.6 # row.prop(ui_props, 'down_up', expand=True, icon_only=False) # row.label(text='') # row = row.split().row() # layout.alert = True # layout.alignment = 'CENTER' row = layout.row(align=True) row.scale_x = 1.6 row.scale_y = 1.6 # split = row.split(factor=.5) row.prop(ui_props, 'asset_type', expand=True, icon_only=False) # row = layout.column(align = False) # layout.prop(ui_props, 'asset_type', expand=False, text='') w = context.region.width if user_preferences.login_attempt: draw_login_progress(layout) return if len(user_preferences.api_key) < 20 and user_preferences.asset_counter > 20: if user_preferences.enable_oauth: draw_login_buttons(layout) else: op = layout.operator("wm.url_open", text="Get your API Key", icon='QUESTION') op.url = paths.BLENDERKIT_SIGNUP_URL layout.label(text='Paste your API Key:') layout.prop(user_preferences, 'api_key', text='') layout.separator() # if bpy.data.filepath == '': # layout.alert = True # utils.label_multiline(layout, text="It's better to save your file first.", width=w) # layout.alert = False # layout.separator() if ui_props.down_up == 'SEARCH': if utils.profile_is_validator(): search_props = utils.get_search_props() layout.prop(search_props, 'search_verification_status') if ui_props.asset_type == 'MODEL': # noinspection PyCallByClass draw_panel_model_search(self, context) if ui_props.asset_type == 'SCENE': # noinspection PyCallByClass draw_panel_scene_search(self, context) elif ui_props.asset_type == 'MATERIAL': draw_panel_material_search(self, context) elif ui_props.asset_type == 'BRUSH': if context.sculpt_object or context.image_paint_object: # noinspection PyCallByClass draw_panel_brush_search(self, context) else: utils.label_multiline(layout, text='switch to paint or sculpt mode.', width=context.region.width) return elif ui_props.down_up == 'UPLOAD': if not ui_props.assetbar_on: text = 'Show asset preview - ;' else: text = 'Hide asset preview - ;' op = layout.operator('view3d.blenderkit_asset_bar', text=text, icon='EXPORT') op.keep_running = False op.do_search = False op.tooltip = 'Show/Hide asset preview' e = s.render.engine if e not in ('CYCLES', 'BLENDER_EEVEE'): rtext = 'Only Cycles and EEVEE render engines are currently supported. ' \ 'Please use Cycles for all assets you upload to BlenderKit.' utils.label_multiline(layout, rtext, icon='ERROR', width=w) return; if ui_props.asset_type == 'MODEL': #utils.label_multiline(layout, "Uploaded models won't be available in b2.79", icon='ERROR') if bpy.context.view_layer.objects.active is not None: draw_panel_model_upload(self, context) else: layout.label(text='selet object to upload') elif ui_props.asset_type == 'SCENE': draw_panel_scene_upload(self, context) elif ui_props.asset_type == 'MATERIAL': #utils.label_multiline(layout, "Uploaded materials won't be available in b2.79", icon='ERROR') if bpy.context.view_layer.objects.active is not None and bpy.context.active_object.active_material is not None: draw_panel_material_upload(self, context) else: utils.label_multiline(layout, text='select object with material to upload materials', width=w) elif ui_props.asset_type == 'BRUSH': if context.sculpt_object or context.image_paint_object: draw_panel_brush_upload(self, context) else: layout.label(text='switch to paint or sculpt mode.') elif ui_props.down_up == 'RATING': # the poll functions didn't work here, don't know why. if ui_props.asset_type == 'MODEL': # TODO improve poll here to parenting structures if bpy.context.view_layer.objects.active is not None and bpy.context.active_object.get( 'asset_data') != None: ad = bpy.context.active_object.get('asset_data') layout.label(text=ad['name']) draw_panel_model_rating(self, context) if ui_props.asset_type == 'MATERIAL': if bpy.context.view_layer.objects.active is not None and \ bpy.context.active_object.active_material is not None and \ bpy.context.active_object.active_material.blenderkit.asset_base_id != '': layout.label(text=bpy.context.active_object.active_material.blenderkit.name + ' :') # noinspection PyCallByClass draw_panel_material_ratings(self, context) if ui_props.asset_type == 'BRUSH': if context.sculpt_object or context.image_paint_object: props = utils.get_brush_props(context) if props.asset_base_id != '': layout.label(text=props.name + ' :') # noinspection PyCallByClass draw_panel_brush_ratings(self, context) if ui_props.asset_type == 'TEXTURE': layout.label(text='not yet implemented')
def draw_message(source, context): layout = source.layout utils.label_multiline(layout, text=message) draw_login_buttons(layout)