def __update_cmd_list(self): # Get commands list obj = self.operation.gettargetobject() if self.check_filter.IsChecked(): clazz = obj.getclass() cmd_protos = cmdmgrdlg.get_class_commands(clazz, True) if obj.isa('nentityobject'): for component in self.gameplay_cmds.keys(): if obj.hascomponent(component): cmd_protos.extend(self.gameplay_cmds[component]) else: for object in self.globals_cmds.keys(): if obj.isa(object): cmd_protos.extend(self.globals_cmds[object]) else: cmd_protos = obj.getcmds() cmds = [] for proto in cmd_protos: if proto.find('_') == -1: cmds.append(proto) else: cmds.append(proto.split('_')[1]) # Fill commands choice list, discarding filtered commands cmds.sort() self.choice_cmd.Clear() self.choice_cmd.AppendItems(cmds) # Select current command, if not filtered out cmd = self.operation.gettargetcommand() index = self.choice_cmd.FindString(cmd) if index != wx.NOT_FOUND: self.choice_cmd.SetSelection(index)
def __update_cmd_list(self): # Get commands list obj = self.operation.gettargetobject() if self.check_filter.IsChecked(): clazz = obj.getclass() cmd_protos = cmdmgrdlg.get_class_commands( clazz, True ) if obj.isa('nentityobject'): for component in self.gameplay_cmds.keys(): if obj.hascomponent( component ): cmd_protos.extend( self.gameplay_cmds[component] ) else: for object in self.globals_cmds.keys(): if obj.isa( object ): cmd_protos.extend( self.globals_cmds[object] ) else: cmd_protos = obj.getcmds() cmds = [] for proto in cmd_protos: if proto.find('_') == -1: cmds.append( proto ) else: cmds.append( proto.split('_')[1] ) # Fill commands choice list, discarding filtered commands cmds.sort() self.choice_cmd.Clear() self.choice_cmd.AppendItems( cmds ) # Select current command, if not filtered out cmd = self.operation.gettargetcommand() index = self.choice_cmd.FindString( cmd ) if index != wx.NOT_FOUND: self.choice_cmd.SetSelection( index )
def __get_inputs_format(self): # TODO: Replace by using the xml format when available for all commands # Get the input types prototype obj = self.operation.gettargetobject() cmd = self.operation.gettargetcommand() obj_class_name = obj.getclass() (found_ok, custom_list) = self.__check_for_custom_inputs(obj_class_name, cmd) if found_ok: return custom_list in_types = 'v' cmd_protos = cmdmgrdlg.get_class_commands(obj_class_name, True) cmd_protos.extend(obj.getcmds()) # look through the list of class and object commands for one matching # the target command name - if you find it, break out of the loop, get # the inputs and return them as a list of format objects for proto in cmd_protos: if proto.split('_')[1] == cmd: in_types = proto.split('_')[2] break # Create basic format for input types, like the one used for xml format list_of_format_objects = [] if in_types != 'v': for type in in_types: if type == propgrid.Type_Bool: name = 'Boolean' elif type == propgrid.Type_Float: name = 'Float' elif type == propgrid.Type_Int: name = 'Integer' elif type == propgrid.Type_Object: name = 'Object' elif type == propgrid.Type_String: name = 'String' else: name = 'Unknown' list_of_format_objects.append({ 'name': name, propgrid.Format_Type: type, propgrid.Format_Editor: None, propgrid.Format_Max: None, propgrid.Format_Min: None, propgrid.Format_Step: None, propgrid.Format_Subtype: None, propgrid.Format_Flags: None, propgrid.Format_Enums: None }) return list_of_format_objects
def __get_inputs_format(self): # TODO: Replace by using the xml format when available for all commands # Get the input types prototype obj = self.operation.gettargetobject() cmd = self.operation.gettargetcommand() obj_class_name = obj.getclass() (found_ok, custom_list) = self.__check_for_custom_inputs(obj_class_name, cmd) if found_ok: return custom_list in_types = 'v' cmd_protos = cmdmgrdlg.get_class_commands(obj_class_name, True) cmd_protos.extend( obj.getcmds() ) # look through the list of class and object commands for one matching # the target command name - if you find it, break out of the loop, get # the inputs and return them as a list of format objects for proto in cmd_protos: if proto.split('_')[1] == cmd: in_types = proto.split('_')[2] break # Create basic format for input types, like the one used for xml format list_of_format_objects = [] if in_types != 'v': for type in in_types: if type == propgrid.Type_Bool: name = 'Boolean' elif type == propgrid.Type_Float: name = 'Float' elif type == propgrid.Type_Int: name = 'Integer' elif type == propgrid.Type_Object: name = 'Object' elif type == propgrid.Type_String: name = 'String' else: name = 'Unknown' list_of_format_objects.append( { 'name': name, propgrid.Format_Type: type, propgrid.Format_Editor: None, propgrid.Format_Max: None, propgrid.Format_Min: None, propgrid.Format_Step: None, propgrid.Format_Subtype: None, propgrid.Format_Flags: None, propgrid.Format_Enums: None } ) return list_of_format_objects