「利用者:Vitorbalbio/PythonModifier」の版間の差分

提供: wiki
移動先: 案内検索
(Created page with "=Overview= This page describe my initial, incomplete proposal for add custom "Python Modifiers" support =Justification= Today we have a lot of flexibility writing tools for bl...")
 
(1版 をインポートしました)
 
(相違点なし)

2018年6月29日 (金) 06:08時点における最新版

Overview

This page describe my initial, incomplete proposal for add custom "Python Modifiers" support

Justification

Today we have a lot of flexibility writing tools for blender with the add-on API but many times we want a more interactive and non destructible way to make things in blender. For that goal i'm proposing add support for Custom Python Modifiers in Blender.

UI Mockup

I propose to have a new modifier type named "Python" that will be contained in the Modifiers list.

Modifier API

With that Modifier we can select a Text datablock that will be read. Here's a example of how can be a custom python modifier script:

import bpy
class CustomWave_Modifier(bpy.types.Custom_Modifier):
    bl_idname = "md.custom_wave"
    bl_label = "Custom Wave Modifier"

    scale = IntProperty(0.1) 

    def execute(self, context, object):
        Mesh = object.data:
        for face in Mesh.polygons:
            for vert in face.vertices:
                vert.z = math.sin(scene.frame_current) + vert.x * scale
        return Mesh
     
    def Draw(self,context,object):
        self.layout.label("Custom Wave")
        self.layout.prop(self,"scale")
        return {'FINISHED'}

def register():
    bpy.ops.EnableModifier(CustomWave_Modifier)


Codding

I Already added a new python Modifier and Python Modifier type data