Code Monkey home page Code Monkey logo

bpy_script's Introduction

zen_cms

a small cms that takes .txt files or .markdown files.

edit zen_cms.js script_table to order the links of the sidebar. like:

var script_table = {};
script_table['Edge_Tools_VTX'] = "Edge_Tools.txt";
script_table['Add_Vertex'] = "Add_Vertex.txt";
script_table['On_Comments'] = "On_Comments.markdown";

let zen_cms.js do the rest. visit zeffii.github.io

bpy_script's People

Contributors

zeffii avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

blendercn-org

bpy_script's Issues

text to grease pencil

  • test if can create grease pencil strokes
  • make minimal architectural typeface as strokes
  • make text to strokes addon for node view

scrub values in Blender Text Editor

Along the lines of tributary.io, i want to make Blender Text Editor a bit more interactive. Here's the primary checklist:

  • skeleton class
  • select word boundary from caret position
  • detect float, int
  • ctrl + +, scrub up
  • on scrub call run
  • draw slider, make it interactive, make it print replacement values
  • send slider changes to scrub code (and call run)
  • configure minimum time difference between redraws

VSFM to Blender

@stansellb here.

Thanks for letting me bounce this off of you. The add-on/script I'm attempting to modify is meant for the bundler software as created by Konrad Kölzer found here - http://koelzk.crispy-cow.de/article/9/importing-bundler-scenes-to-blender (also available by digging through the Blender Add-on repository). It works fairly well with scenes exported from Visual SFM, as long as the files and directory structure are altered beforehand:

VSFM produces a directory structure similar to:
-Directories.../
-->Subdirectories.../
--->dense.nvm.cmp/
---->00/
----->data/
------undistorted images
-----bundle.rd.out (camera data - position, orientation, focal length, etc)
-----list.txt (list of undistorted images in data subdirectory)

However the script requires a specific structure:
/selected directory/
-bundle/
--bundle.out (same as bundle.rd.out, except renamed)
-list.txt (items in original file are prefixed with 'visualize' for some reason, the script requires the images be in the 'root' of the selected directory. Using a text editor, I can replace 'visualize' with './' and it works [at least in a Mac/Unix environment], but I'd rather edit the script so this isn't necessary)
-images (concordant with list.txt)

The import script does a good job with the point cloud, however has the disadvantage of creating a new camera and one textured plane for every image in the list. While seemingly accurate, it has the disadvantages of lagging the display (especially when there are large numbers of images) and switching active cameras can be a pain, as I'm sure you know.

I have a theory that perhaps importing the images as a movie clip (one image per frame) then using either a driver or subsequent keyframes to control the position, rotation, focal length, and even distortion of the lens of a single camera would be more efficient. One would then just set the movie clip as a background image of the camera and be free to model by cycling through the images and camera positions. If multiple cameras were desired, they could be easily achieved using a dupliframes modifier (I think).

Just to be clear, I'm not attempting camera tracking (inserting objects into footage), but photogrammetry (reconstructing real places/items in the 3D space). I've found other methods, but they seem to be either out of my direct control (123D Catch), obtuse (Meshlabs), more complicated than they should be (python photogrammetry toolbox), or way more effort than I care to invest (ArcheOS).

'My' idea was actually inspired by this tutorial: http://youtu.be/xjjW2yKjUDM and I think it could be a viable workflow if I can get all of the details fleshed out. I'm making some progress, but haven't produced a working plugin yet as I have some python experience but am new to the Blender API. I would sincerely appreciate any advice/assistance you could provide.

temp place for websockets in Blender Nodes

# ##### BEGIN GPL LICENSE BLOCK #####
#
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#  as published by the Free Software Foundation; either version 2
#  of the License, or (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software Foundation,
#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####

import webbrowser

import bpy
from bpy.props import IntProperty, FloatProperty, BoolProperty, StringProperty
import bmesh
from mathutils import Vector

from node_tree import SverchCustomTreeNode, VerticesSocket, StringsSocket
from data_structure import updateNode, SvSetSocketAnyType, SvGetSocketAnyType

# class DrawHTML(object):

#     def __init__(self, node):
#         pass

#     def populate_html(self):
#         pass

#     def get_html(self):
#         return self.html


class WebModalTimerOperator(bpy.types.Operator):
    """Operator which runs its self from a timer"""
    bl_idname = "wm.web_modal_timer_operator"
    bl_label = "Web Modal Timer Operator"

    _timer = None
    mode = StringProperty(default='')
    node_name = StringProperty(default='')
    node_group = StringProperty(default='')

    def modal(self, context, event):
        if self.node_group and self.node_name:
            ng = bpy.data.node_groups.get(self.node_group)
            n = ng.nodes[self.node_name]
        else:
            return {'PASS_THROUGH'}

        if not (event.type == 'TIMER'):
            return {'PASS_THROUGH'}

        if not n.active:
            self.cancel(context)
            return {'FINISHED'}

        self.process(ng, n)
        return {'PASS_THROUGH'}

    def process(self, ng, n):
        ''' reaches here only if event is TIMER and n.active '''
        print('meee!', ng, n)

    def event_dispatcher(self, context, type_op):
        if type_op == 'start':
            context.node.active = True
            wm = context.window_manager
            self._timer = wm.event_timer_add(1, context.window)
            wm.modal_handler_add(self)

            # start webbrowser
            url = "C:\\Users\\User\\Documents\\tapi.html"
            # url = "http://www.python.org"
            webbrowser.open(url)

        if type_op == 'end':
            context.node.active = False

    def execute(self, context):
        n = context.node
        self.node_name = context.node.name
        self.node_group = context.node.id_data.name

        self.event_dispatcher(context, self.mode)
        return {'RUNNING_MODAL'}

    def cancel(self, context):
        wm = context.window_manager
        wm.event_timer_remove(self._timer)


class SvWebsocketNode(bpy.types.Node, SverchCustomTreeNode):
    ''' SvWebsocketNode '''
    bl_idname = 'SvWebsocketNode'
    bl_label = 'WebsocketNode'
    bl_icon = 'OUTLINER_OB_EMPTY'

    draw_to_host = BoolProperty(description="switch it on and off", default=0, name='draw_to_host')
    active = BoolProperty(description="current state", default=0, name='comms on')
    State = FloatProperty(default=1.0, name='State')

    def init(self, context):
        self.inputs.new('StringsSocket', "State", "State").prop_name = 'State'
        self.inputs.new('VerticesSocket', "coords_3d", "coords_3d")

    def draw_buttons(self, context, layout):
        row = layout.row()
        flash_operator = 'wm.web_modal_timer_operator'
        tstr = 'start' if not self.active else 'end'

        row.operator(flash_operator, text=tstr).mode = tstr

    def update(self):
        if not len(self.inputs) == 2:
            self.active = 0
            return

        #if self.draw_to_host and not self.active:
        #    web_obj = DrawHTML()
        pass

    def update_socket(self, context):
        self.update()


def register():
    bpy.utils.register_class(SvWebsocketNode)
    bpy.utils.register_class(WebModalTimerOperator)


def unregister():
    bpy.utils.unregister_class(SvWebsocketNode)
    bpy.utils.unregister_class(WebModalTimerOperator)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.