@@ -10,21 +10,25 @@ public IGH_DocumentObject Upgrade(IGH_DocumentObject target, GH_Document documen
10
10
{
11
11
PythonComponent_OBSOLETE component_OBSOLETE = target as PythonComponent_OBSOLETE ;
12
12
if ( component_OBSOLETE == null )
13
- {
14
13
return null ;
15
- }
14
+
16
15
ZuiPythonComponent component_new = new ZuiPythonComponent ( ) ;
17
16
18
- component_new . HideCodeInput = component_OBSOLETE . HideCodeInput ;
19
- if ( component_new . HideCodeInput )
20
- component_new . Params . Input . RemoveAt ( 0 ) ;
17
+ bool show_code_input = false ;
18
+ if ( component_OBSOLETE . CodeInputVisible )
19
+ {
20
+ // see if the "code" input on the old component really has anything
21
+ // hooked up to it. If not, don't show the input
22
+ show_code_input = component_OBSOLETE . Params . Input [ 0 ] . SourceCount > 0 ;
23
+ }
24
+ component_new . CodeInputVisible = show_code_input ;
21
25
22
26
component_new . HideCodeOutput = component_OBSOLETE . HideCodeOutput ;
23
27
24
28
if ( component_new . HideCodeOutput )
25
29
component_new . Params . Output . RemoveAt ( 0 ) ;
26
30
27
- if ( component_new . HideCodeInput )
31
+ if ( ! component_new . CodeInputVisible )
28
32
component_new . CodeInput = component_OBSOLETE . CodeInput ;
29
33
30
34
component_OBSOLETE . Dispose ( ) ;
@@ -36,37 +40,36 @@ public IGH_DocumentObject Upgrade(IGH_DocumentObject target, GH_Document documen
36
40
foreach ( var c in component_new . Params . Input )
37
41
{
38
42
var sc = c as Param_ScriptVariable ;
39
- if ( sc != null )
40
- {
41
- IGH_TypeHint newHint ;
43
+ if ( sc == null ) continue ;
44
+ IGH_TypeHint newHint ;
42
45
43
- if ( toRhinoScript )
44
- {
45
- if ( PythonHints . ToNewRhinoscriptHint ( sc . TypeHint , out newHint ) )
46
- sc . TypeHint = newHint ;
47
- }
48
- else
49
- {
50
- if ( PythonHints . ToNewRhinoCommonHint ( sc . TypeHint , out newHint ) )
51
- sc . TypeHint = newHint ;
52
- }
46
+ if ( toRhinoScript )
47
+ {
48
+ if ( PythonHints . ToNewRhinoscriptHint ( sc . TypeHint , out newHint ) )
49
+ sc . TypeHint = newHint ;
50
+ }
51
+ else
52
+ {
53
+ if ( PythonHints . ToNewRhinoCommonHint ( sc . TypeHint , out newHint ) )
54
+ sc . TypeHint = newHint ;
53
55
}
54
56
}
55
57
}
56
58
59
+ component_new . CodeInputVisible = show_code_input ;
57
60
return component_new ;
58
61
}
59
62
return null ;
60
63
}
61
64
62
65
public Guid UpgradeFrom
63
66
{
64
- get { return new Guid ( PythonComponent_OBSOLETE . Id ) ; }
67
+ get { return typeof ( PythonComponent_OBSOLETE ) . GUID ; }
65
68
}
66
69
67
70
public Guid UpgradeTo
68
71
{
69
- get { return new Guid ( ZuiPythonComponent . Id ) ; }
72
+ get { return typeof ( ZuiPythonComponent ) . GUID ; }
70
73
}
71
74
72
75
public DateTime Version
0 commit comments