ok, solved it. It was just a matter of hierarchy: # nukescripts.*precomp*.PrecompOptionsDialog = MyPrecompOptionsDialog instead of nukescripts.PrecompOptionsDialog = MyPrecompOptionsDialog
Although, the whole concept is apparently called "monkey patching". So lets see how long this works before everything breaks apart. :-) On 11 June 2014 15:00, Håkan Blomdahl <hakanblomd...@gmail.com> wrote: > Hi, > > unfortunately its not that simple. I wish. > > The precomp-system is setting its defaults in python code in the a class > called: > > class PrecompOptionsDialog( panels.PythonPanel ): > ... in the module "nukescripts" > exxample path: > C:\Program Files\Nuke7.0v8\plugins\nukescripts > > I want to override this class with my own, ( so I don't need to change the > code in each installation local installation ). > But I can't seem to get the hang of overriding classes within modules. > > I'll keep on googling... > > > > > > On 11 June 2014 13:58, Elias Ericsson Rydberg < > elias.ericsson.rydb...@gmail.com> wrote: > >> If it's just a case of just setting a different default value it should >> be easy. There's a python for beginners video on youtube by Frank. It shows >> exactly how to do this kind of thing. In his example he set the blur to >> different value, should be the same but with a path in your case. >> >> Cheers, >> Elias Ericsson Rydberg >> >> onsdag 11 juni 2014 skrev Håkan Blomdahl <hakanblomd...@gmail.com>: >> >> Hi! >>> >>> I wondering if someone has an idea of how to replace the Precomp-dialog >>> Class? >>> >>> *Basically I want to replace the defaults on where to store the precomp >>> script.* >>> >>> My futile attempts looks along the lines of this: >>> >>> import nukescripts >>> class MyPrecompOptionsDialog( nukescripts.panels.PythonPanel ): >>> def __init__( self ): >>> nukescripts.panels.PythonPanel.__init__( self, "MY Precomp Nodes", >>> "uk.co.thefoundry.PrecompOptionsDialog" ) >>> self.scriptPath = nuke.File_Knob( "script", "Precomp script path " ) >>> *... the original precomp code ...* >>> >>> >>> #Replace! >>> original_precomp_dialog = nukescripts.PrecompOptionsDialog >>> nukescripts.PrecompOptionsDialog = MyPrecompOptionsDialog >>> >>> but, when I run the precomp code the original dialog pops up. >>> >>> >>> >>> >>> >> _______________________________________________ >> Nuke-python mailing list >> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ >> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python >> >> > > > -- > Håkan Blomdahl > Filmgate AB > > Järntorget 3 > 413 04 Göteborg > Sweden > > www.filmgate.se > ha...@filmgate.se > +46 (0)31- 701 02 00 > -- Håkan Blomdahl Filmgate AB Järntorget 3 413 04 Göteborg Sweden www.filmgate.se ha...@filmgate.se +46 (0)31- 701 02 00
_______________________________________________ Nuke-python mailing list Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python