Ejemplo n.º 1
0
    def draw(self, context):
        layout = self.layout
        slot = context.texture_slot
        node = context.texture_node
        space = context.space_data
        tex = context.texture
        idblock = context_tex_datablock(context)
        pin_id = space.pin_id

        if space.use_pin_id and not isinstance(pin_id, bpy.types.Texture):
            idblock = id_tex_datablock(pin_id)
            pin_id = None

        if not space.use_pin_id:
            layout.prop(space, "texture_context", expand=True)

        tex_collection = (pin_id is None) and (node is None) and (
            not isinstance(idblock, bpy.types.Brush))

        if tex_collection:
            row = layout.row()

            row.template_list("TEXTURE_UL_texslots",
                              "",
                              idblock,
                              "texture_slots",
                              idblock,
                              "active_texture_index",
                              rows=2)

            col = row.column(align=True)
            col.operator("texture.slot_move", text="",
                         icon='TRIA_UP').type = 'UP'
            col.operator("texture.slot_move", text="",
                         icon='TRIA_DOWN').type = 'DOWN'
            col.menu("TEXTURE_MT_specials", icon='DOWNARROW_HLT', text="")

        if tex_collection:
            layout.template_ID(idblock, "active_texture", new="texture.new")
        elif node:
            layout.template_ID(node, "texture", new="texture.new")
        elif idblock:
            layout.template_ID(idblock, "texture", new="texture.new")

        if pin_id:
            layout.template_ID(space, "pin_id")

        if tex:
            split = layout.split(percentage=0.2)

            if slot and tex.use_nodes:
                split.label(text="Output:")
                split.prop(slot, "output_node", text="")

            if not tex.use_nodes:
                layout.prop(tex, 'type', text="Texture")
                if tex.type == 'VRAY':
                    layout.prop(tex.vray, 'type', text="Type")
Ejemplo n.º 2
0
	def draw(self, context):
		layout = self.layout
		slot = context.texture_slot
		node = context.texture_node
		space = context.space_data
		tex = context.texture
		idblock = context_tex_datablock(context)
		pin_id = space.pin_id

		if space.use_pin_id and not isinstance(pin_id, bpy.types.Texture):
			idblock = id_tex_datablock(pin_id)
			pin_id = None

		if not space.use_pin_id:
			layout.prop(space, "texture_context", expand=True)

		tex_collection = (pin_id is None) and (node is None) and (not isinstance(idblock, bpy.types.Brush))

		if tex_collection:
			row = layout.row()

			row.template_list("TEXTURE_UL_texslots", "", idblock, "texture_slots", idblock, "active_texture_index", rows=2)

			col = row.column(align=True)
			col.operator("texture.slot_move", text="", icon='TRIA_UP').type = 'UP'
			col.operator("texture.slot_move", text="", icon='TRIA_DOWN').type = 'DOWN'
			col.menu("TEXTURE_MT_specials", icon='DOWNARROW_HLT', text="")

		if tex_collection:
			layout.template_ID(idblock, "active_texture", new="texture.new")
		elif node:
			layout.template_ID(node, "texture", new="texture.new")
		elif idblock:
			layout.template_ID(idblock, "texture", new="texture.new")

		if pin_id:
			layout.template_ID(space, "pin_id")

		if tex:
			split = layout.split(percentage=0.2)

			if slot and tex.use_nodes:
				split.label(text="Output:")
				split.prop(slot, "output_node", text="")

			if not tex.use_nodes:
				layout.prop(tex, 'type', text="Texture")
				if tex.type == 'VRAY':
					layout.prop(tex.vray, 'type', text="Type")
Ejemplo n.º 3
0
    def draw(self, context):
        layout = self.layout

        slot = getattr(context, "texture_slot", None)
        node = getattr(context, "texture_node", None)
        space = context.space_data
        tex = context.texture
        idblock = context_tex_datablock(context)
        pin_id = space.pin_id

        space.use_limited_texture_context = True

        if space.use_pin_id and not isinstance(pin_id, Texture):
            idblock = id_tex_datablock(pin_id)
            pin_id = None

        if not space.use_pin_id:
            row = layout.row(align=True)

            op = row.operator("luxcore.switch_texture_context",
                              text="Particles",
                              icon="PARTICLES")
            op.target = "PARTICLES"

            op = row.operator("luxcore.switch_texture_context",
                              text="Other",
                              icon="TEXTURE")
            op.target = "OTHER"

            pin_id = None

        if space.texture_context == 'OTHER':
            if not pin_id:
                row = layout.row()
                row.template_texture_user()
            user = context.texture_user
            if user or pin_id:
                layout.separator()

                row = layout.row()

                if pin_id:
                    row.template_ID(space, "pin_id")
                else:
                    propname = context.texture_user_property.identifier
                    row.template_ID(user, propname, new="texture.new")

                if tex:
                    split = layout.split(percentage=0.2)
                    if tex.use_nodes:
                        if slot:
                            split.label(text="Output:")
                            split.prop(slot, "output_node", text="")
                    else:
                        split.label(text="Type:")
                        split.prop(tex, "type", text="")
            return

        tex_collection = (pin_id is None) and (node is None) and (
            not isinstance(idblock, Brush))

        if tex_collection:
            row = layout.row()

            row.template_list("TEXTURE_UL_texslots",
                              "",
                              idblock,
                              "texture_slots",
                              idblock,
                              "active_texture_index",
                              rows=2)

            col = row.column(align=True)
            col.operator("texture.slot_move", text="",
                         icon='TRIA_UP').type = 'UP'
            col.operator("texture.slot_move", text="",
                         icon='TRIA_DOWN').type = 'DOWN'
            col.menu("TEXTURE_MT_specials", icon='DOWNARROW_HLT', text="")

        if tex_collection:
            layout.template_ID(idblock, "active_texture", new="texture.new")
        elif node:
            layout.template_ID(node, "texture", new="texture.new")
        elif idblock:
            layout.template_ID(idblock, "texture", new="texture.new")

        if pin_id:
            layout.template_ID(space, "pin_id")

        if tex:
            split = layout.split(percentage=0.2)
            if tex.use_nodes:
                if slot:
                    split.label(text="Output:")
                    split.prop(slot, "output_node", text="")
            else:
                split.label(text="Type:")
                split.prop(tex, "type", text="")
Ejemplo n.º 4
0
    def draw(self, context):
        layout = self.layout
        slot = getattr(context, "texture_slot", None)
        node = getattr(context, "texture_node", None)
        space = context.space_data
        tex = context.texture
        idblock = context_tex_datablock(context)
        pin_id = space.pin_id

        space.use_limited_texture_context = True

        if space.use_pin_id and not isinstance(pin_id, Texture):
            idblock = id_tex_datablock(pin_id)
            pin_id = None

        if not space.use_pin_id:
            layout.prop(space, "texture_context", expand=True)
            pin_id = None

        # copied from Blender, but not use atm
        # TODO: review
        #'''
        if space.texture_context == 'OTHER':
            if not pin_id:
                layout.template_texture_user()
            user = context.texture_user
            if user or pin_id:
                layout.separator()

                split = layout.split(percentage=0.65)
                col = split.column()

                if pin_id:
                    col.template_ID(space, "pin_id")
                else:
                    propname = context.texture_user_property.identifier
                    col.template_ID(user, propname, new="texture.new")

                if tex:
                    split = layout.split(percentage=0.2)
                    if tex.use_nodes:
                        if slot:
                            split.label(text="Output:")
                            split.prop(slot, "output_node", text="")
                    else:
                        split.label(text="Type:")
                        split.prop(tex, "yaf_tex_type", text="")
            return
        #"""

        tex_collection = (pin_id is None) and (node is None) and (
            not isinstance(idblock, Brush))

        if tex_collection:
            row = layout.row()
            if bpy.app.version < (2, 65, 3):
                row.template_list(idblock,
                                  "texture_slots",
                                  idblock,
                                  "active_texture_index",
                                  rows=2)
            else:
                row.template_list("TEXTURE_UL_texslots",
                                  "",
                                  idblock,
                                  "texture_slots",
                                  idblock,
                                  "active_texture_index",
                                  rows=2)

            col = row.column(align=True)
            col.operator("texture.slot_move", text="",
                         icon='TRIA_UP').type = 'UP'
            col.operator("texture.slot_move", text="",
                         icon='TRIA_DOWN').type = 'DOWN'
            col.menu("TEXTURE_MT_specials", icon='DOWNARROW_HLT', text="")

        split = layout.split(percentage=0.65)
        col = split.column()

        if tex_collection:
            col.template_ID(idblock, "active_texture", new="texture.new")
        elif node:
            col.template_ID(node, "texture", new="texture.new")
        elif idblock:
            col.template_ID(idblock, "texture", new="texture.new")

        if pin_id:
            col.template_ID(space, "pin_id")

        col = split.column()

        if tex:
            split = layout.split(percentage=0.2)

            if tex.use_nodes:

                if slot:
                    split.label(text="Output:")
                    split.prop(slot, "output_node", text="")

            else:
                split.label(text="Type:")
                split.prop(tex, "yaf_tex_type", text="")
Ejemplo n.º 5
0
    def draw(self, context):
        layout = self.layout        
        slot = getattr(context, "texture_slot", None)
        node = getattr(context, "texture_node", None)
        space = context.space_data
        tex = context.texture
        idblock = context_tex_datablock(context)
        pin_id = space.pin_id

        space.use_limited_texture_context = True

        if space.use_pin_id and not isinstance(pin_id, Texture):
            idblock = id_tex_datablock(pin_id)
            pin_id = None

        if not space.use_pin_id:
            layout.prop(space, "texture_context", expand=True)
            pin_id = None
        
        # copied from Blender, but not use atm
        # TODO: review
        #'''
        if space.texture_context == 'OTHER':
            if not pin_id:
                layout.template_texture_user()
            user = context.texture_user
            if user or pin_id:
                layout.separator()

                split = layout.split(percentage=0.65)
                col = split.column()

                if pin_id:
                    col.template_ID(space, "pin_id")
                else:
                    propname = context.texture_user_property.identifier
                    col.template_ID(user, propname, new="texture.new")

                if tex:
                    split = layout.split(percentage=0.2)
                    if tex.use_nodes:
                        if slot:
                            split.label(text="Output:")
                            split.prop(slot, "output_node", text="")
                    else:
                        split.label(text="Type:")
                        split.prop(tex, "yaf_tex_type", text="")
            return
        #"""

        tex_collection = (pin_id is None) and (node is None) and (not isinstance(idblock, Brush))

        if tex_collection:
            row = layout.row()
            if bpy.app.version < (2, 65, 3 ):
                row.template_list(idblock, "texture_slots", idblock, "active_texture_index", rows=2)
            else:
                row.template_list("TEXTURE_UL_texslots", "", idblock, "texture_slots", idblock, "active_texture_index", rows=2)

            col = row.column(align=True)
            col.operator("texture.slot_move", text="", icon='TRIA_UP').type = 'UP'
            col.operator("texture.slot_move", text="", icon='TRIA_DOWN').type = 'DOWN'
            col.menu("TEXTURE_MT_specials", icon='DOWNARROW_HLT', text="")

        split = layout.split(percentage=0.65)
        col = split.column()

        if tex_collection:
            col.template_ID(idblock, "active_texture", new="texture.new")
        elif node:
            col.template_ID(node, "texture", new="texture.new")
        elif idblock:
            col.template_ID(idblock, "texture", new="texture.new")

        if pin_id:
            col.template_ID(space, "pin_id")

        col = split.column()

        if tex:
            split = layout.split(percentage=0.2)

            if tex.use_nodes:

                if slot:
                    split.label(text="Output:")
                    split.prop(slot, "output_node", text="")

            else:
                split.label(text="Type:")
                split.prop(tex, "yaf_tex_type", text="")