Exemple #1
0
    def bake(self, baketype):
        """
        arguments:
            ベイクタイプ
            baketypes = ['FULL', 'AO', 'SHADOW', 'NORMALS', 'TEXTURE', 'DISPLACEMENT', 'DERIVATIVE', 'VERTEX_COLORS', 'EMIT', 'ALPHA', 'MIRROR_INTENSITY', 'MIRROR_COLOR', 'SPEC_INTENSITY', 'SPEC_COLOR']
            ベイク元オブジェクト群
        """
        fjw.deselect()
        fjw.activate(self.obj)
        bpy.ops.object.shade_smooth()  #ソリッドだとガタガタになる
        fjw.select(self.from_objects)

        img = self.get_bakeimage(baketype)
        img = self.reassign_image_filepath(img)
        tex = self.get_baketex(baketype)
        tex.image = img
        self.save_dirtyimages()
        self.assign_uv_face(img)

        self.set_tslots_state(False)
        render = bpy.context.scene.render
        render.bake_type = baketype
        render.use_bake_to_vertex_color = False
        render.use_bake_selected_to_active = True
        render.use_textures = True
        render.use_bake_normalize = False
        render.bake_margin = 14
        bpy.context.scene.render.bake_distance = 0.2
        bpy.context.scene.render.bake_bias = 0.0001
        bpy.ops.object.bake_image()
        self.set_tslots_state(True)

        self.save_dirtyimages()
        bpy.ops.file.make_paths_relative()
    def execute(self,context):
        fjw.reject_notmesh()

        canvases = []
        targets = []
        #カスタムプロパティをチェック
        for obj in fjw.get_selected_list():
            if "canvas" in obj:
                canvases.append(obj)
                continue
            if "asset" in obj:
                targets.append(obj)
                continue

        #カンバス群にパッシブ追加
        fjw.deselect()
        fjw.activate(canvases[0])
        fjw.select(canvases)
        bpy.ops.rigidbody.objects_add(type='PASSIVE')

        #ターゲット群にアクティブ追加
        fjw.deselect()
        fjw.activate(targets[0])
        fjw.select(targets)
        bpy.ops.rigidbody.objects_add(type='ACTIVE')

        #アニメーション再生
        bpy.ops.screen.frame_jump()
        bpy.ops.screen.animation_play()

        #self.report({"INFO"},"")
        pass
        return {"FINISHED"}
Exemple #3
0
 def __export_setup(self, dirpath):
     fjw.deselect()
     fjw.select(self.get_export_objects())
     self.__simplify(2)
     for obj in self.objects:
         self.__disable_backsurface_edge(obj)
     #フレーム1に移動
     bpy.ops.screen.frame_jump(end=False)
def save_pre(context):
    #カメラにキー入らんでどうしようもないからこれでいれる!!!→2017/11/26 Blender2.79で修正されているのを確認
    #カメラにキー入れる
    if bpy.context.scene.tool_settings.use_keyframe_insert_auto:
        if bpy.context.scene.camera != None:
            if not fjw.in_localview():
                current = fjw.active()
                current_mode = "OBJECT"
                if current != None:
                    current_mode = fjw.active().mode
                fjw.mode("OBJECT")
                selection = fjw.get_selected_list()
                fjw.deselect()
                fjw.activate(bpy.context.scene.camera)
                bpy.ops.anim.keyframe_insert_menu(type='LocRotScale')
                if current != None:
                    fjw.deselect()
                    fjw.select(selection)
                    fjw.activate(current)
                    fjw.mode(current_mode)
Exemple #5
0
    def execute(self, context):
        fjw.reject_notmesh()

        canvases = []
        targets = []
        #カスタムプロパティをチェック
        for obj in fjw.get_selected_list():
            if "canvas" in obj:
                canvases.append(obj)
                continue
            if "asset" in obj:
                targets.append(obj)
                continue

        fjw.select(canvases)
        fjw.select(targets)

        bpy.ops.rigidbody.objects_remove()

        #self.report({"INFO"},"")
        pass
        return {"FINISHED"}