From e01004f6de9d96b20ec5b20750dce12a93d38ed3 Mon Sep 17 00:00:00 2001 From: Leo Date: Sat, 15 Jan 2022 15:03:21 +0100 Subject: [PATCH] fix using correct pip install --- ops/__init__.py | 27 +++++++++++++++++++++++++++ ui/__init__.py | 24 ++++++++++++------------ 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/ops/__init__.py b/ops/__init__.py index fddccb1..e5a0727 100644 --- a/ops/__init__.py +++ b/ops/__init__.py @@ -1,5 +1,11 @@ +<<<<<<< Updated upstream import os, subprocess +======= +import os +import sys +>>>>>>> Stashed changes import json +from sre_constants import SUCCESS import bpy import bge_netlogic import bge_netlogic.utilities as utils @@ -42,6 +48,27 @@ ] +class NLInstallUplogicModuleOperator(bpy.types.Operator): + bl_idname = "bge_netlogic.install_uplogic_module" + bl_label = "Install or Update Uplogic Module" + bl_description = ( + 'Downloads the latest version of the uplogic module required for ' + 'running logic nodes.\n\n' + 'NOTE:This may take a few seconds and requires internet connection.' + ) + bl_options = {'REGISTER', 'UNDO'} + + def execute(self, context): + utils.notify('Installing uplogic module...') + try: + os.system(f'{sys.executable} -m ensurepip') + os.system(f'{sys.executable} -m pip install uplogic') + utils.success('Installed.') + except Exception: + utils.error('Install failed.') + return {"FINISHED"} + + class TreeCodeWriterOperator(bpy.types.Operator): bl_idname = "bgenetlogic.treecodewriter_operator" bl_label = "Timed code writer" diff --git a/ui/__init__.py b/ui/__init__.py index 88401ab..bfee665 100644 --- a/ui/__init__.py +++ b/ui/__init__.py @@ -131,15 +131,15 @@ def draw_item(self, context, layout, data, item, icon, active_data, active_propn class BGE_PT_GlobalValuePanel(bpy.types.Panel): - bl_label = "Globals" - bl_space_type = "NODE_EDITOR" - bl_region_type = "UI" - bl_category = "Dashboard" + bl_label = "Scene Game Properties" + bl_space_type = "PROPERTIES" + bl_region_type = "WINDOW" + bl_context = 'scene' + bl_category = "Global Values" @classmethod def poll(cls, context): - enabled = (context.space_data.tree_type == BGELogicTree.bl_idname) - return enabled + return True def draw(self, context): layout = self.layout @@ -469,11 +469,11 @@ def draw(self, context): text="Apply To Selected", icon='PREFERENCES' ).owner = "BGE_PT_LogicPanel" - tree = context.space_data.edit_tree - if tree: - r = apply.row() - r.label(text='Apply As:') - r.prop(tree, 'mode', toggle=True, text='Component' if tree.mode else 'Bricks') + # tree = context.space_data.edit_tree + # if tree: + # r = apply.row() + # r.label(text='Apply As:') + # r.prop(tree, 'mode', toggle=True, text='Component' if tree.mode else 'Bricks') code = layout.box() code.operator( bge_netlogic.ops.NLGenerateLogicNetworkOperator.bl_idname, @@ -671,7 +671,7 @@ class BGELogicTree(bpy.types.NodeTree): mode: bpy.props.BoolProperty( name='Compile Mode', default=False, - description='Whether to apply this tree using bricks or as a component.\nNOTE: Changing this value does not remove already applied trees', + description='Nope', update=update_tree_mode )