Exemplo n.º 1
0
 def updatePreset(self, context):
     if self.preset != "0":
         # if preset, set preset
         if self.previousSetting != self.preset:
             using = self.p[self.preset]
             self.source = using[0]
             self.vTrunc = using[1]
             self.eTrunc = using[2]
             self.dual = using[3]
             self.snub = using[4]
         else:
             using = self.p[self.preset]
             result0 = self.source == using[0]
             result1 = abs(self.vTrunc - using[1]) < 0.004
             result2 = abs(self.eTrunc - using[2]) < 0.0015
             result4 = using[4] == self.snub or ((using[4] == "Left") and
                                             self.snub in ["Left", "Right"])
             if (result0 and result1 and result2 and result4):
                 if self.p[self.previousSetting][3] != self.dual:
                     if self.preset[0] == "d":
                         self.preset = self.preset[1:]
                     else:
                         self.preset = "d" + self.preset
             else:
                 self.preset = "0"
     updateNode(self, context)
Exemplo n.º 2
0
    def mode_change(self, context):
        # just because click doesn't mean we need to change mode
        mode = self.mode
        if mode == self.current_mode:
            return

        if mode == 'VERTEX':
            n = 2 if "Vert A" in self.inputs else 1
            while len(self.inputs) > n:
                self.inputs.remove(self.inputs[-1])
            if n == 1:
                self.inputs.new('VerticesSocket', "Vert A", "Vert A")

        if mode == 'AXIS':
            n = 2 if "Vert A" in self.inputs else 1
            if n == 2:
                while len(self.inputs) > n:
                    self.inputs.remove(self.inputs[-1])
                self.inputs.new('VerticesSocket', "Vert B", "Vert B")
            else:
                while len(self.inputs) > n:
                    self.inputs.remove(self.inputs[-1])                
                self.inputs.new('VerticesSocket', "Vert A", "Vert A")
                self.inputs.new('VerticesSocket', "Vert B", "Vert B")

        if mode == 'PLANE':
            while len(self.inputs) > 1:
                self.inputs.remove(self.inputs[-1])
            self.inputs.new('MatrixSocket', "Plane", "Plane")

        self.current_mode = mode
        updateNode(self, context)
Exemplo n.º 3
0
    def update_mode(self, context):
        if self.mode == self.last_mode:
            return

        self.last_mode = self.mode
        self.update_sockets(context)
        updateNode(self, context)
Exemplo n.º 4
0
    def update_angles(self, context):
        """ Convert angle values to selected angle units """
        if self.last_angle_units == "RAD":
            if self.angle_units == "RAD":
                au = 1.0  # RAD -> RAD
            elif self.angle_units == "DEG":
                au = 180.0 / pi  # RAD -> DEG
            elif self.angle_units == "UNI":
                au = 0.5 / pi  # RAD -> UNI

        elif self.last_angle_units == "DEG":
            if self.angle_units == "RAD":
                au = pi / 180  # DEG -> RAD
            elif self.angle_units == "DEG":
                au = 1.0  # DEG -> DEG
            elif self.angle_units == "UNI":
                au = 1.0 / 360  # DEG -> UNI

        elif self.last_angle_units == "UNI":
            if self.angle_units == "RAD":
                au = 2 * pi  # UNI -> RAD
            elif self.angle_units == "DEG":
                au = 360  # UNI -> DEG
            elif self.angle_units == "UNI":
                au = 1.0  # UNI -> UNI

        self.last_angle_units = self.angle_units

        self.updating = True  # inhibit update calls

        self.twist = au * self.twist  # convert to current angle units
        self.phase = au * self.phase  # convert to current angle units

        self.updating = False
        updateNode(self, context)
Exemplo n.º 5
0
    def mode_change(self, context):

        if not (self.items_ == self.current_op):
            self.label = self.items_
            self.update_outputs_and_inputs()
            self.current_op = self.items_
            updateNode(self, context)
Exemplo n.º 6
0
    def update_mode(self, context):
        self.inputs['Radius'].hide_safe = (self.mode not in ['BySphere', 'ByPlane', 'ByCylinder', 'BBox'])
        self.inputs['Center'].hide_safe = (self.mode not in ['BySphere', 'ByPlane', 'ByCylinder', 'Outside', 'BBox'])
        self.inputs['Percent'].hide_safe = (self.mode not in ['BySide', 'ByNormal', 'EdgeDir', 'Outside'])
        self.inputs['Direction'].hide_safe = (self.mode not in ['BySide', 'ByNormal', 'ByPlane', 'ByCylinder', 'EdgeDir'])

        updateNode(self, context)
Exemplo n.º 7
0
    def mode_change(self, context):

        if not (self.selected_hyper == self.current_hyper):
            self.label = self.selected_hyper
            self.update_outputs_and_inputs()
            self.current_hyper = self.selected_hyper
            updateNode(self, context)
Exemplo n.º 8
0
    def update_mode(self, context):
        self.inputs['Matrices'].hide_safe = (self.transform_mode != "Matrix")
        self.inputs['Height'].hide_safe = (self.transform_mode != "Normal")
        self.inputs['Scale'].hide_safe = (self.transform_mode != "Normal")

        if self.transform_mode == "Normal":
            self.multiple = True
        updateNode(self, context)
Exemplo n.º 9
0
 def update_value(self, context):
     if self.int_ < self.minim:
         self.int_ = self.minim
         return
     if self.int_ > self.maxim:
         self.int_ = self.maxim
         return
     updateNode(self, context)
Exemplo n.º 10
0
def property_change(node, context, origin):
    if origin == 'input_mode_one':
        node.inputs[0].prop_name = {'Float': 'x_', 'Int': 'xi_'}.get(getattr(node, origin))
    elif origin == 'input_mode_two' and len(node.inputs) == 2:
        node.inputs[1].prop_name = {'Float': 'y_', 'Int': 'yi_'}.get(getattr(node, origin))
    else:
        pass
    updateNode(node, context)
Exemplo n.º 11
0
 def update_mode(self, context):
     self.inputs['Verts A'].hide_safe = self.nest_objs
     self.inputs['Polys A'].hide_safe = self.nest_objs
     self.inputs['Verts B'].hide_safe = self.nest_objs
     self.inputs['Polys B'].hide_safe = self.nest_objs
     self.inputs['Verts Nested'].hide_safe = not self.nest_objs
     self.inputs['Polys Nested'].hide_safe = not self.nest_objs
     updateNode(self, context)
Exemplo n.º 12
0
 def update_mode(self, context):
     self.outputs['NewVertices'].hide_safe = not self.show_new
     self.outputs['NewEdges'].hide_safe = not self.show_new
     self.outputs['NewFaces'].hide_safe = not self.show_new
     self.outputs['OldVertices'].hide_safe = not self.show_old
     self.outputs['OldEdges'].hide_safe = not self.show_old
     self.outputs['OldFaces'].hide_safe = not self.show_old
     updateNode(self, context)
Exemplo n.º 13
0
    def update_type(self, context):
        if self.numType == 'INT':
            self.inputs['v1'].prop_name = "value_int1"
            self.inputs['v2'].prop_name = "value_int2"
        else: # float type
            self.inputs['v1'].prop_name = "value_float1"
            self.inputs['v2'].prop_name = "value_float2"

        updateNode(self, context)
Exemplo n.º 14
0
    def update_mode(self, context):
        if self.mode == 'EXT_INT':
            self.inputs['R'].prop_name = "torus_eR"
            self.inputs['r'].prop_name = "torus_iR"
        else:
            self.inputs['R'].prop_name = "torus_R"
            self.inputs['r'].prop_name = "torus_r"

        updateNode(self, context)
Exemplo n.º 15
0
 def update_mode(self, context):
     # switch radii input sockets (R,r) <=> (eR,iR)
     if self.mode == 'EXT_INT':
         self.inputs['R'].prop_name = "ring_eR"
         self.inputs['r'].prop_name = "ring_iR"
     else:
         self.inputs['R'].prop_name = "ring_R"
         self.inputs['r'].prop_name = "ring_r"
     updateNode(self, context)
    def set_child_quota(self, context):
        updateNode(self, context)

        # post update check
        if self.auto_release:
            parent = self.name_node_generated_parent
            if parent:
                for obj in bpy.data.objects[parent].children:
                    if not obj.name == self.name_child:
                        obj.parent = None
Exemplo n.º 17
0
    def on_update_dims(self, context):
        if self.dimensions < 4:
            self.formula4 = ""
        if self.dimensions < 3:
            self.formula3 = ""
        if self.dimensions < 2:
            self.formula2 = ""

        self.adjust_sockets()
        updateNode(self, context)
Exemplo n.º 18
0
 def reload(self):
     if self.textmode == "CSV":
         self.reload_csv()
     elif self.textmode == "SV":
         self.reload_sv()
     elif self.textmode == "JSON":
         self.reload_json()
     # if we turn on reload on update we need a safety check for this
     # too work.
     updateNode(self, None)
Exemplo n.º 19
0
    def reload(self):
        # reload should ONLY be called from operator on ui change
        if self.textmode == 'CSV':
            self.reload_csv()
        elif self.textmode == 'SV':
            self.reload_sv()
        elif self.textmode == 'JSON':
            self.reload_json()

        # if we turn on reload on update we need a safety check for this to work.
        updateNode(self, None)
Exemplo n.º 20
0
    def mode_change(self, context):

        # just because click doesn't mean we need to change mode
        mode = self.mode
        if mode == self.current_mode:
            return

        self.inputs[-1].prop_name = {'LAZYRANGE': 'stop_'}.get(mode, 'count_')

        self.current_mode = mode
        updateNode(self, context)
Exemplo n.º 21
0
 def update_mode(self, context):
     cls = globals()[self.mode]
     while len(self.outputs) > 0:
         self.outputs.remove(self.outputs[0])
     for ocls, oname in cls.outputs:
         self.outputs.new(ocls, oname)
     if hasattr(cls, "default_submode"):
         self.submode = cls.default_submode
     else:
         self.submode = None
     updateNode(self, context)
Exemplo n.º 22
0
 def update_size(self, context, sizeID):
     if self.syncing:
         return
     if self.linkSizes:
         self.syncing = True
         if sizeID == "X":  # updating X => sync Y
             self.sizey = self.sizex / self.sizeRatio
         else:  # updating Y => sync X
             self.sizex = self.sizey * self.sizeRatio
         self.syncing = False
     updateNode(self, context)
Exemplo n.º 23
0
    def update_mode(self, context):

        # hide all input sockets
        for k, names in input_sockets.items():
            for name in names:
                self.inputs[name].hide_safe = True

        # show mode specific input sockets
        for name in input_sockets[self.mode]:
            self.inputs[name].hide_safe = False

        updateNode(self, context)
Exemplo n.º 24
0
    def handle_accumulative(self, context):
        '''start cache'''

        data = self.node_cache.get(0)
        if not self.accumulative:
            for i in range(len(data)):
                self.accumulativity_set_data([], i)
            self.accumulative_parse = False

        if not data:
            self.node_cache[0] = {}
        updateNode(self, context)
Exemplo n.º 25
0
    def wrapped_update(self, context):
        if self.selected_mode == 'USER':
            if len(self.inputs) == 1:
                self.inputs.new('StringsSocket', "Width").prop_name = 'width_custom_tex'
                self.inputs.new('StringsSocket', "Height").prop_name = 'height_custom_tex'
        else:

            if len(self.inputs) == 3:
                self.inputs.remove(self.inputs[-1])
                self.inputs.remove(self.inputs[-1])

        updateNode(self, context)
Exemplo n.º 26
0
    def adjust_inputs(self, context):
        m = self.type_selected_mode
        si = self.inputs

        if m == 'Int' and si[2].prop_name[-1] == 'f':
            si[2].prop_name = 'low_i'
            si[3].prop_name = 'high_i'
        
        elif m == 'Float' and si[2].prop_name[-1] == 'i':
            si[2].prop_name = 'low_f'
            si[3].prop_name = 'high_f'

        updateNode(self, context)
Exemplo n.º 27
0
    def mode_change(self, context):

        # just because click doesn't mean we need to change mode
        mode = self.mode
        if mode == self.current_mode:
            return

        if mode == 'FRANGE':
            self.inputs[1].prop_name = 'stop_'
            self.inputs[2].prop_name = 'step_'
        elif mode == 'FRANGE_COUNT':
            self.inputs[1].prop_name = 'stop_'
            self.inputs[2].prop_name = 'count_'
        else:
            self.inputs[1].prop_name = 'step_'
            self.inputs[2].prop_name = 'count_'

        self.current_mode = mode
        updateNode(self, context)
Exemplo n.º 28
0
    def change_inputs(self, context):

        self.id_data.freeze(hard=True)
        # inputs
        nrInputs = 1
        if self.items_ in self.constant:
            nrInputs = 0
        elif self.items_ in self.fx:
            nrInputs = 1
        elif self.items_ in self.fxy:
            nrInputs = 2
            # ugly hack to verify int property, should be improved.
            if self.items_ =='ROUND-N':
                if 'Y' in self.inputs:
                    self.inputs['Y'].prop_name = 'i_y'

        self.set_inputs(nrInputs)
        self.id_data.unfreeze(hard=True)
        updateNode(self, context)
Exemplo n.º 29
0
    def mode_change(self, context):
        if self.mode == 'XYZ':
            while len(self.inputs) > 2:
                self.inputs.remove(self.inputs[-1])
        if self.mode == 'DIST':
            while len(self.inputs) > 2:
                self.inputs.remove(self.inputs[-1])
            self.inputs.new('VerticesSocket', 'Base Point', 'Base Point')

        if self.mode == 'AXIS':
            while len(self.inputs) > 2:
                self.inputs.remove(self.inputs[-1])
            self.inputs.new('MatrixSocket', 'Mat')

        if self.mode == 'USER':
            while len(self.inputs) > 2:
                self.inputs.remove(self.inputs[-1])
            self.inputs.new('StringsSocket', 'Index Data', 'Index Data')

        updateNode(self, [])
Exemplo n.º 30
0
    def wrapped_update(self, context):
        add = self.mk_input_sockets
        remove = self.rm_input_sockets

        current_mode = socket_count_to_mode.get(len(self.inputs))
        new_mode = fractal_type_to_mode.get(self.fractal_type)

        actionables = {
            'AB': (add, ('offset',)),
            'BA': (remove, ('offset',)),
            'BC': (add, ('gain',)),
            'CB': (remove, ('gain',)),
            'AC': (add, ('offset', 'gain')),
            'CA': (remove, ('offset', 'gain'))
            }.get(current_mode + new_mode)

        if actionables:
            socket_func, names = actionables
            socket_func(*names)
        updateNode(self, context)
Exemplo n.º 31
0
 def loop_forward_timer(self, context):
     debug("* Timer: loop_forward_timer")
     for timer in self.timers:
         timer.loop_forward()
     self.sync_time_slider(1)
     updateNode(self, context)
Exemplo n.º 32
0
 def props_changed_and_update(self, context):
     if self.node_id in evolver_mem:
         self.info_label = "Props changed since execution"
     updateNode(self, context)
Exemplo n.º 33
0
 def update_sockets(self, context):
     if not self.inputs["Old Min"].is_linked:
         self.inputs["Old Min"].hide_safe = self.auto_limits
     if not self.inputs["Old Max"].is_linked:
         self.inputs["Old Max"].hide_safe = self.auto_limits
     updateNode(self, context)
Exemplo n.º 34
0
 def execute(self, context):
     node = bpy.data.node_groups[self.treename].nodes[self.nodename]
     idx = self.item_index
     node.control_points[idx].sharp = not node.control_points[idx].sharp
     updateNode(node, context)
     return {'FINISHED'}
Exemplo n.º 35
0
    def update_ellipsoid(self, context):
        if self.updating:
            return

        self.presets = "_"
        updateNode(self, context)
Exemplo n.º 36
0
 def mode_change(self, context):
     self.inputs[1].prop_name = self.mode
     updateNode(self, context)
Exemplo n.º 37
0
    def toggle_state(self, context):
        for switch in self.switches:
            switch.toggle_state()

        updateNode(self, context)
Exemplo n.º 38
0
 def pause_timer(self, context):
     debug("* Timer: pause_timer")
     for timer in self.timers:
         timer.pause()
     updateNode(self, context)
Exemplo n.º 39
0
 def reset_timer(self, context):
     debug("* Timer: reset_timer")
     for timer in self.timers:
         timer.reset()
     self.sync_time_slider(0)
     updateNode(self, context)
Exemplo n.º 40
0
 def expire_timer(self, context):
     debug("* Timer: expire_timer")
     for timer in self.timers:
         timer.expire()
     self.sync_time_slider(1)
     updateNode(self, context)
Exemplo n.º 41
0
 def update_socket(self, context):
     updateNode(self, context)
Exemplo n.º 42
0
def update_wrapper(self, context):
    try:
        updateNode(context.node, context)
    except:
        ...
Exemplo n.º 43
0
 def execute(self, context):
     node = bpy.data.node_groups[self.treename].nodes[self.nodename]
     idx = self.item_index
     node.remove_column(idx)
     updateNode(node, context)
     return {'FINISHED'}
Exemplo n.º 44
0
 def update_mode(self, context):
     self.inputs['number'].hide_safe = self.mode == "find_range"
     self.inputs['radius'].hide_safe = self.mode == "find_n"
     updateNode(self, context)
Exemplo n.º 45
0
 def update_sockets_and_node(self, context):
     self.update_sockets()
     updateNode(self, context)
Exemplo n.º 46
0
 def stop_timer(self, context):
     debug("* Timer: stop_timer")
     for timer in self.timers:
         timer.stop()
     self.sync_time_slider(0)
     updateNode(self, context)
Exemplo n.º 47
0
 def update_operation(self, context):
     self.label = "Matrix " + self.operation.title()
     self.update_sockets()
     updateNode(self, context)
Exemplo n.º 48
0
 def start_timer(self, context):
     debug("* Timer: start_timer")
     for timer in self.timers:
         timer.start()
     updateNode(self, context)
Exemplo n.º 49
0
 def psuedo_update(self, context):
     for idx, socket in enumerate(self.selected_mode):
         self.outputs[idx].name = socket
     updateNode(self, context)
Exemplo n.º 50
0
 def update_mode(self, context):
     self.update_sockets()
     updateNode(self, context)
Exemplo n.º 51
0
 def mode_change(self, context):
     self.inputs['MaxAngle'].hide_safe = self.split_mode != 'NONPLANAR'
     updateNode(self, context)
Exemplo n.º 52
0
 def mode_change(self, context):
     if not (self.selected_axis == self.current_axis):
         self.label = self.selected_axis
         self.current_axis = self.selected_axis
         updateNode(self, context)
Exemplo n.º 53
0
 def update_labels_and_update(self, context):
     self.update_properties()
     updateNode(self, context)
Exemplo n.º 54
0
 def set_sockets(self, context):
     self.update_sockets()
     updateNode(self, context)
Exemplo n.º 55
0
    def update_spiral(self, context):
        if self.updating:
            return

        self.presets = " "
        updateNode(self, context)
Exemplo n.º 56
0
    def update_ellipse(self, context):
        if self.updating:
            return

        updateNode(self, context)
Exemplo n.º 57
0
 def change_prop(self, context):
     for i, name in enumerate(self.order):
         self.inputs[i].prop_name = name
     updateNode(self, context)
Exemplo n.º 58
0
 def change_mode(self, context):
     if self.unwrap:
         self.level_unwrap = max(1, self.level)
     else:
         self.level = self.level_unwrap
     updateNode(self, context)
Exemplo n.º 59
0
 def modifiers_handle(self, context):
     set_sv_depsgraph_need(self.modifiers)
     updateNode(self, context)
Exemplo n.º 60
0
 def execute(self, context):
     node = bpy.data.node_groups[self.treename].nodes[self.nodename]
     node.add_column()
     updateNode(node, context)
     return {'FINISHED'}