Blenderownia
Blender praktycznie => Python, skrypty, pluginy i Blender Game Engine => Wątek zaczęty przez: mortom.ckm w 24.06.2020 11:13:37
-
Witam,
Mam takie pytania odnośnie UI, a mianowicie jak w temacie - chodzi mi o przeniesienie panelu "Color Management" z Properties do bocznego panelu w "Image Editor". Nie wiem jak ten temat ugryźć. Czy jest jakaś metoda na wywołanie takiej opcji w pytonie? A jeśli jest to mógłby mi ktoś pomóc w tej kwestii?
Pozdrawiam.
-
@mortom.ckm, z przeniesieniem w pythonie, takim żeby w jednym miejscu usunąć panel, a w innym utworzyć to nie wiem czy to będzie dobry pomysł. Natomiast jeśli chodzi o zrobienie duplikatu panelu w "Image Editor" to ja bym zrobił takie podejście.
Jeszcze jedna kwestia - to już standardowe opcje poza skryptem, ale jak chcesz edytować inny obraz niż wyrenderowany to musisz zaznaczyć w zakładce Image "view as render", a poźniej przy zapisywaniu "save as render".
from bpy.types import Panel
class ObjPanel(Panel):
bl_label = "Hello World"
bl_space_type = 'IMAGE_EDITOR'
bl_region_type = 'UI'
class color_management(ObjPanel):
bl_label = "Color Management"
bl_options = {'DEFAULT_CLOSED'}
bl_order = 100
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False # No animation.
scene = context.scene
view = scene.view_settings
flow = layout.grid_flow(row_major=True, columns=0, even_columns=False, even_rows=False, align=True)
col = flow.column()
col.prop(scene.display_settings, "display_device")
col.separator()
col.prop(view, "view_transform")
col.prop(view, "look")
col = flow.column()
col.prop(view, "exposure")
col.prop(view, "gamma")
col.separator()
col.prop(scene.sequencer_colorspace_settings, "name", text="Sequencer")
class color_management_curves(ObjPanel):
bl_label = "Use Curves"
bl_parent_id = "color_management"
bl_options = {'DEFAULT_CLOSED'}
def draw_header(self, context):
scene = context.scene
view = scene.view_settings
self.layout.prop(view, "use_curve_mapping", text="")
def draw(self, context):
layout = self.layout
scene = context.scene
view = scene.view_settings
layout.use_property_split = False
layout.use_property_decorate = False # No animation.
layout.enabled = view.use_curve_mapping
layout.template_curve_mapping(view, "curve_mapping", type='COLOR', levels=True)
def register():
from bpy.utils import register_class
register_class(color_management) # register first
register_class(color_management_curves)
if __name__ == "__main__":
register()