How to Add Files Dir to AddCombobox?PLZ!
-
On 20/10/2015 at 08:09, xxxxxxxx wrote:
Hi Guys!
How can I show a folder with file names in side a AddCombobox , like with the FS SDK for 3ds Max and Bender Plug-in, to add effects to the object, its a drop down list of all the files effects names and it attach to the object on which one you select in the list.So like what I want is how can i make it find effects Folder in Fsx folder and show them in the AddComboBox list :
C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Effects
Then Tag with the model or a null, so I guess I make a Command Plug-in generate a Tag or just make a Tag Plug-in for it.Example:
So how Can i Get File C4d Find the Folder and AddComboBox read it
self.format_list = self.AddComboBox(Exporter_Button, c4d.BFH_SCALEFIT, 46, 0, False)
self.AddChild(Exporter_Button, thee_Ds, '3D Studio (*.3ds)')
self.AddChild(Exporter_Button, Alembic_abc, 'Alembic (*.abc)')
self.AddChild(Exporter_Button, DAE_1_4, 'COLLADA 1.4 (*.dae)')
self.AddChild(Exporter_Button, Direct_3D, 'Direct 3D (*.x)')
self.AddChild(Exporter_Button, FBX_ALL, 'FBX (*.fbx)')
#-------------------------------------------------------------------------------------------------------------#Now this is i saw from the Guys how made the Blender Python Plugin code :
if yo want Download to see the whole thing:
http://www.fsdeveloper.com/wiki/index.php?title=Blender2FSX_Toolset_manual(Reason Why i only post a little of the code cause its a lot and he have it broken up in to multi py files for blender, So its best you Download and take a look at it)
CODE:
import bpy
import xml.etree.ElementTree as etree
from mathutils import Vector
from os import urandom
from winreg import OpenKey, QueryValueEx, HKEY_LOCAL_MACHINE, REG_SZ, REG_EXPAND_SZ
#-----------------------------------------------------------#Help or Tips,
Ashton -
On 21/10/2015 at 09:14, xxxxxxxx wrote:
This what I find but its a MaxScript guys. and I don't understand. PlZ help!
I will try something then show what i come up with.\--Define all of the rollouts possible to use starting with: \--THE EFFECTS ROLLOUT Rollout effectsRollout "Attach Effect" ( \--Prompt for the effects directory, then gather all the effects in that directory. fn defineFXList = ( local effectsList = #() local thisFSPath = maxUtils.getRegKey "HKEY_LOCAL_MACHINE" "SOFTWARE\Microsoft\microsoft games\flight simulator\10.0" "SetupPath" global thisEffectsDir = thisFSPath + "effects" if not doesFileExist thisEffectsDir then ( thisEffectsDir = getSavePath caption:"I can't find your Flightsim effects directory. Please locate the effects directory you want to choose from." ) if thisEffectsDir != undefined then ( for f in getFiles (thisEffectsDir + "\\\\\*.fx") do ( append effectsList (getFilenameFile f) ) ) return effectsList ) dropdownlist attachedEffect "Effect to attach:" items:(defineFXList ()) height:30 edittext effectParams "Effect Params:" fieldwidth:184 height:100 \--When the effect drop down list is changed, update the name text box to use the name of that effect on attachedEffect selected newAttachedEffect do
-
On 26/10/2015 at 05:39, xxxxxxxx wrote:
Hi Ashton,
I assume you want to do this in a dialog.
Then it is actually pretty simple:
a) Browse the desired directory using standard Python functions. For example os.walk() comes to mind.
b) Use GeDialog.AddChild() to add the filenames to your combobox. -
On 26/10/2015 at 17:09, xxxxxxxx wrote:
i will try that Andreas
and thanks man -
On 30/10/2015 at 04:00, xxxxxxxx wrote:
Hi Guys and Andreas,
It did not work and didn't show up in the plugin lists , what i did wrong?
Plugin was working and till this happen, when I add this feature.CODE:
#--------| Imports |-------#
#-------------------------------------#
from winreg import HKEY_LOCAL_MACHINE
#-------------------------------------#def EffectsDir(self) :
for root, dirs, files, in os.walk("HKEY_LOCAL_MACHINE", "SOFTWARE\\Microsoft\\microsoft games\\flight simulator\10.0") :
EffectsDir = thisFSPath
global thisEffectsDir = thisFSPath + "effects")#------------------| Interface CINEMA 4D to FLIGHT SIM! Layout |----------------------------#
class C4DtoFlightSimDialog(c4d.gui.GeDialog) :def CreateLayout(self) :
self.GroupBegin(20078, c4d.BFH_SCALEFIT | c4d.BFV_BOTTOM, 3, 0, "")
self.AddCheckbox(Selected_1, c4d.BFH_LEFT, 250, 0, "Selected Object Only")
self.SetBool(Selected_1, True)
self.AddStaticText(0, c4d.BFH_LEFT, 90, 0, "FORMAT :")
#---------------------------------------------------------------------------------#
self.AddComboBox(Exporter_Button, c4d.BFH_SCALEFIT, 46, 0, False)
self.AddChild(Exporter_Button, EffectsDir)
self.GroupEnd()
#-------------------------------------------------------------------------------------------------------------------------#Help or Tips,
Asthon -
On 30/10/2015 at 04:59, xxxxxxxx wrote:
Hi Ashton, keep the console open when testing your plugin. You will probably find an IOError there. You can't use the standart filesystem functions for accessing the registry. Use the winreg module instead