New to the Python Console

I’m just learning python in Blender and how to use the Python Console.
I can access the properties of a mesh and change things like the name, but I’ve hit a stumbling block.

Can someone tell me if it’s possible to set the value for “blend_type” in the console.

class bpy.types.MeshTextureFace(bpy_struct)¶
UV mapping, texturing and game engine data for a face

Transparency blending mode
Type :	enum in [‘OPAQUE’, ‘ADD’, ‘ALPHA’, ‘CLIPALPHA’], default ‘OPAQUE’

I can’t seem to access it.

If you’re not familiar with this, in “Edit” mode with a mesh selected, this property is available in the “Object Data” tab, on the “Texture Face” panel.


Perhaps that is only available in the game engine? Can you describe the effect you wish to achieve, because i think you’ll have to add two materials with a texture each to get that effect. Loved your masking tutorials btw, great calm approach.

Thanks, glad you liked it. I’ve received a lot of good feedback so far. That tutorial series was very time-consuming to make. I submitted it twice to BlenderNation, but for some reason that guy won’t publish it. I can’t figure out why. He puts such trivial, and marginally blender-related news stories up all the time, but my 6-part 3-hour free tutorial series doesn’t pass his test! Go figure. Check it out here.

I’m just trying to get my head around what is possible to access in the Python-Console.
I can’t seem to access the “MeshTextureFace” settings from code in the console.
Does anyone know if this is possible?

let’s step back from the code/python… what in plain english are you wanting to achieve in a visual sense?

About blendernation, it might be that there is a conflict of interest sometimes. You did 6 tutorials and spread them for free, on a topic that others might want to squeeze some money out of. I can only hope the real reason is due to something less contemptible.

This is purely for experimentation at this point. I’m trying to understand the limits of the Python Console. What you can and can’t modify from within Blender with scripting, or with the console.

Sometimes if the tooltip isn’t useful, you can explore the scripts/startup/bl_ui folder. In this case describes that panel.

class DATA_PT_texface(MeshButtonsPanel, bpy.types.Panel):
    bl_label = "Texture Face"

    def poll(cls, context):
        ob = context.active_object

        return (context.mode == 'EDIT_MESH') and ob and ob.type == 'MESH'

    def draw(self, context):
        layout = self.layout
        col = layout.column()

        me = context.mesh

        tf = <b>me.faces.active_tface</b>

        if tf:
            if context.scene.render.engine != 'BLENDER_GAME':
                col.label(text="Options only supported in Game Engine")

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

            col.prop(tf, "use_image")
            col.prop(tf, "use_light")
            col.prop(tf, "hide")
            col.prop(tf, "use_collision")

            col.prop(tf, "use_blend_shared")
            col.prop(tf, "use_twoside")
            col.prop(tf, "use_object_color")

            col = split.column()

            col.prop(tf, "use_halo")
            col.prop(tf, "use_billboard")
            col.prop(tf, "use_shadow_cast")
            col.prop(tf, "use_bitmap_text")
            col.prop(tf, "use_alpha_sort")

            col = layout.column()
            col.prop(tf, "blend_type")
            col.label(text="No UV Texture")

so… a little digging came up with:

&gt;&gt;&gt; dir(
['__doc__', '__module__', '__slots__', 'bl_rna', 'blend_type', 'hide', 'image', 'pin_uv', 'rna_type', 'select_uv', 'use_alpha_sort', 'use_billboard', 'use_bitmap_text', 'use_blend_shared', 'use_collision', 'use_halo', 'use_image', 'use_light', 'use_object_color', 'use_shadow_cast', 'use_twoside', 'uv', 'uv1', 'uv2', 'uv3', 'uv4', 'uv_raw']



if you wanted to set it you would do = 'ALPHA'

i’m not sure if you will see the difference when rendering with Blender Internal, it could be that it only really has working effect on Blender Game renders.


Well, I have to hand it to you, that works perfectly.
Thanks for the tip about looking at the panel code, because the tool tip completely led me astray.

Thank you, I have a lot to learn about Python coding in Blender.

There’s a lot of nooks and crannies like this in bpy. The ‘fringes’ aren’t documented that well because they are roads less travelled. Like in this instance, you have to dig a little through scripts/startup/bl_ui

you can mark your thread [Solved] by editing your first post -> go advanced …and change the prefix from the dropdown.

check my blender python scripting blog some time, for a variety of non-ui examples

The change suggested in your python scripting could be a little bit more ‘strange’
Like in this picture?

# variables 
z_float = 0.0
amp = 0.7               #pkhg this is changed
profile_radius = 1.0
n_petals = 14
n_verts = n_petals * 28
section_angle = 360.0 / n_verts
position = (2*(math.pi/(n_verts/n_petals)))

# consumables
Verts = []
Edges = []

# makes vertex coordinates
for i in range(n_verts):
    # difference is a function of the position on the circumference

    difference = amp * math.cos(i*position)
    if difference &gt; 0:
        difference = difference**5 # &lt;=== or cos(difference) pkhg changed!