Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

objName is not defined #81

Open
MrLuer opened this issue Mar 3, 2020 · 2 comments
Open

objName is not defined #81

MrLuer opened this issue Mar 3, 2020 · 2 comments

Comments

@MrLuer
Copy link

MrLuer commented Mar 3, 2020

I want to get bounding box in training images,so I change the branch to pm-render-bounding-box and run run_create_data got errors below. in master branch everything work well

Traceback (most recent call last):
File "/root/labelfusion/scripts/renderTrainingImages.py", line 40, in
rti = RenderTrainingImages(app.view, app.viewOptions, pathDict)
File "/root/labelfusion/modules/labelfusion/rendertrainingimages.py", line 34, in init
self.initialize()
File "/root/labelfusion/modules/labelfusion/rendertrainingimages.py", line 52, in initialize
self.enableLighting()
File "/root/labelfusion/modules/labelfusion/rendertrainingimages.py", line 89, in enableLighting
bbox = obj.findChild(objName + ' bbox')
NameError: global name 'objName' is not defined
Done.

@EulerWong
Copy link

you need to define the var objName where this enableLighting function can access.

@EulerWong
Copy link

replace your enableLighting function with this, as following:

def enableLighting(self):
view = self.view
viewOptions = self.viewOptions

    viewOptions.setProperty('Gradient background', False)
    viewOptions.setProperty('Orientation widget', False)
    viewOptions.setProperty('Background color', [0.0,0.0,0.0])

    if view.renderer().GetBackgroundTexture():
        view.renderer().TexturedBackgroundOn()

    for obj in om.findObjectByName('data files').children():
        objName = obj.getProperty('Name')
        obj.actor.GetProperty().LightingOn()
        obj.setProperty('Color', self.storedColors[obj.getProperty('Name')])
        bbox = obj.findChild(objName + ' bbox')
        bbox.setProperty('Visible', self.renderBoundingBox)
    view.forceRender()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants